glassjar 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,11 +21,11 @@ class S {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
Symbol.dispose && (S.prototype[Symbol.dispose] = S.prototype.free);
|
|
24
|
-
function
|
|
25
|
-
const w =
|
|
24
|
+
function m(C, A, g, I, Q, E) {
|
|
25
|
+
const w = O(C, B.__wbindgen_malloc), i = G, o = O(A, B.__wbindgen_malloc), q = G, h = F(g, B.__wbindgen_malloc, B.__wbindgen_realloc), p = G, d = F(I, B.__wbindgen_malloc, B.__wbindgen_realloc), z = G, f = F(Q, B.__wbindgen_malloc, B.__wbindgen_realloc), l = G;
|
|
26
26
|
B.configure_compiler_toolchain(w, i, o, q, h, p, d, z, f, l, E);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function X() {
|
|
29
29
|
B.main();
|
|
30
30
|
}
|
|
31
31
|
function b(C) {
|
|
@@ -46,25 +46,25 @@ function n() {
|
|
|
46
46
|
return BigInt(A);
|
|
47
47
|
},
|
|
48
48
|
__wbg_Error_8c4e43fe74559d73: function(A, g) {
|
|
49
|
-
return Error(
|
|
49
|
+
return Error(k(A, g));
|
|
50
50
|
},
|
|
51
51
|
__wbg_Number_04624de7d0e8332d: function(A) {
|
|
52
52
|
return Number(A);
|
|
53
53
|
},
|
|
54
54
|
__wbg_String_8f0eb39a4a4c2f66: function(A, g) {
|
|
55
|
-
const I = String(g), Q =
|
|
55
|
+
const I = String(g), Q = F(I, B.__wbindgen_malloc, B.__wbindgen_realloc), E = G;
|
|
56
56
|
N().setInt32(A + 4, E, !0), N().setInt32(A + 0, Q, !0);
|
|
57
57
|
},
|
|
58
58
|
__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(A, g) {
|
|
59
59
|
const I = g, Q = typeof I == "bigint" ? I : void 0;
|
|
60
|
-
N().setBigInt64(A + 8,
|
|
60
|
+
N().setBigInt64(A + 8, M(Q) ? BigInt(0) : Q, !0), N().setInt32(A + 0, !M(Q), !0);
|
|
61
61
|
},
|
|
62
62
|
__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(A) {
|
|
63
63
|
const g = A, I = typeof g == "boolean" ? g : void 0;
|
|
64
|
-
return
|
|
64
|
+
return M(I) ? 16777215 : I ? 1 : 0;
|
|
65
65
|
},
|
|
66
66
|
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(A, g) {
|
|
67
|
-
const I =
|
|
67
|
+
const I = x(g), Q = F(I, B.__wbindgen_malloc, B.__wbindgen_realloc), E = G;
|
|
68
68
|
N().setInt32(A + 4, E, !0), N().setInt32(A + 0, Q, !0);
|
|
69
69
|
},
|
|
70
70
|
__wbg___wbindgen_function_table_5ae7216dfcbcc506: function() {
|
|
@@ -103,7 +103,7 @@ function n() {
|
|
|
103
103
|
},
|
|
104
104
|
__wbg___wbindgen_number_get_8ff4255516ccad3e: function(A, g) {
|
|
105
105
|
const I = g, Q = typeof I == "number" ? I : void 0;
|
|
106
|
-
N().setFloat64(A + 8,
|
|
106
|
+
N().setFloat64(A + 8, M(Q) ? 0 : Q, !0), N().setInt32(A + 0, !M(Q), !0);
|
|
107
107
|
},
|
|
108
108
|
__wbg___wbindgen_rethrow_05525c567f154472: function(A) {
|
|
109
109
|
throw A;
|
|
@@ -113,18 +113,18 @@ function n() {
|
|
|
113
113
|
},
|
|
114
114
|
__wbg___wbindgen_string_get_72fb696202c56729: function(A, g) {
|
|
115
115
|
const I = g, Q = typeof I == "string" ? I : void 0;
|
|
116
|
-
var E =
|
|
116
|
+
var E = M(Q) ? 0 : F(Q, B.__wbindgen_malloc, B.__wbindgen_realloc), w = G;
|
|
117
117
|
N().setInt32(A + 4, w, !0), N().setInt32(A + 0, E, !0);
|
|
118
118
|
},
|
|
119
119
|
__wbg___wbindgen_throw_be289d5034ed271b: function(A, g) {
|
|
120
|
-
throw new Error(
|
|
120
|
+
throw new Error(k(A, g));
|
|
121
121
|
},
|
|
122
122
|
__wbg__wbg_cb_unref_d9b87ff7982e3b21: function(A) {
|
|
123
123
|
A._wbg_cb_unref();
|
|
124
124
|
},
|
|
125
125
|
__wbg_addEventListener_3acb0aad4483804c: function() {
|
|
126
126
|
return D(function(A, g, I, Q) {
|
|
127
|
-
A.addEventListener(
|
|
127
|
+
A.addEventListener(k(g, I), Q);
|
|
128
128
|
}, arguments);
|
|
129
129
|
},
|
|
130
130
|
__wbg_apply_2e22c45cb4f12415: function() {
|
|
@@ -179,7 +179,7 @@ function n() {
|
|
|
179
179
|
return A.crypto;
|
|
180
180
|
},
|
|
181
181
|
__wbg_customSections_193491b069139fb1: function(A, g, I) {
|
|
182
|
-
return WebAssembly.Module.customSections(A,
|
|
182
|
+
return WebAssembly.Module.customSections(A, k(g, I));
|
|
183
183
|
},
|
|
184
184
|
__wbg_data_5330da50312d0bc1: function(A) {
|
|
185
185
|
return A.data;
|
|
@@ -193,7 +193,7 @@ function n() {
|
|
|
193
193
|
__wbg_error_7534b8e9a36f1ab4: function(A, g) {
|
|
194
194
|
let I, Q;
|
|
195
195
|
try {
|
|
196
|
-
I = A, Q = g, console.error(
|
|
196
|
+
I = A, Q = g, console.error(k(A, g));
|
|
197
197
|
} finally {
|
|
198
198
|
B.__wbindgen_free(I, Q, 1);
|
|
199
199
|
}
|
|
@@ -205,7 +205,7 @@ function n() {
|
|
|
205
205
|
return A.exports;
|
|
206
206
|
},
|
|
207
207
|
__wbg_fetch_d1488f40cef1e210: function(A, g, I) {
|
|
208
|
-
return A.fetch(
|
|
208
|
+
return A.fetch(k(g, I));
|
|
209
209
|
},
|
|
210
210
|
__wbg_from_bddd64e7d5ff6941: function(A) {
|
|
211
211
|
return Array.from(A);
|
|
@@ -499,10 +499,10 @@ function n() {
|
|
|
499
499
|
return new Uint8Array(s(A, g));
|
|
500
500
|
},
|
|
501
501
|
__wbg_new_no_args_1c7c842f08d00ebb: function(A, g) {
|
|
502
|
-
return new Function(
|
|
502
|
+
return new Function(k(A, g));
|
|
503
503
|
},
|
|
504
504
|
__wbg_new_with_args_7bba34e94b1cfa40: function(A, g, I, Q) {
|
|
505
|
-
return new Function(
|
|
505
|
+
return new Function(k(A, g), k(I, Q));
|
|
506
506
|
},
|
|
507
507
|
__wbg_new_with_byte_offset_9120ba79e057895b: function(A, g) {
|
|
508
508
|
return new Uint8Array(A, g >>> 0);
|
|
@@ -571,7 +571,7 @@ function n() {
|
|
|
571
571
|
},
|
|
572
572
|
__wbg_removeEventListener_e63328781a5b9af9: function() {
|
|
573
573
|
return D(function(A, g, I, Q) {
|
|
574
|
-
A.removeEventListener(
|
|
574
|
+
A.removeEventListener(k(g, I), Q);
|
|
575
575
|
}, arguments);
|
|
576
576
|
},
|
|
577
577
|
__wbg_require_b74f47fc2d022fd6: function() {
|
|
@@ -631,24 +631,24 @@ function n() {
|
|
|
631
631
|
return A.slice(g >>> 0, I >>> 0);
|
|
632
632
|
},
|
|
633
633
|
__wbg_stack_0ed75d68575b0f3c: function(A, g) {
|
|
634
|
-
const I = g.stack, Q =
|
|
634
|
+
const I = g.stack, Q = F(I, B.__wbindgen_malloc, B.__wbindgen_realloc), E = G;
|
|
635
635
|
N().setInt32(A + 4, E, !0), N().setInt32(A + 0, Q, !0);
|
|
636
636
|
},
|
|
637
637
|
__wbg_static_accessor_GLOBAL_12837167ad935116: function() {
|
|
638
638
|
const A = typeof global > "u" ? null : global;
|
|
639
|
-
return
|
|
639
|
+
return M(A) ? 0 : U(A);
|
|
640
640
|
},
|
|
641
641
|
__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
|
|
642
642
|
const A = typeof globalThis > "u" ? null : globalThis;
|
|
643
|
-
return
|
|
643
|
+
return M(A) ? 0 : U(A);
|
|
644
644
|
},
|
|
645
645
|
__wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
|
|
646
646
|
const A = typeof self > "u" ? null : self;
|
|
647
|
-
return
|
|
647
|
+
return M(A) ? 0 : U(A);
|
|
648
648
|
},
|
|
649
649
|
__wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
|
|
650
650
|
const A = typeof window > "u" ? null : window;
|
|
651
|
-
return
|
|
651
|
+
return M(A) ? 0 : U(A);
|
|
652
652
|
},
|
|
653
653
|
__wbg_store_d1d951c98d9bed41: function() {
|
|
654
654
|
return D(function(A, g, I) {
|
|
@@ -665,7 +665,7 @@ function n() {
|
|
|
665
665
|
return A.then(g);
|
|
666
666
|
},
|
|
667
667
|
__wbg_toString_56d946daff83867b: function(A, g, I) {
|
|
668
|
-
const Q = g.toString(I), E =
|
|
668
|
+
const Q = g.toString(I), E = F(Q, B.__wbindgen_malloc, B.__wbindgen_realloc), w = G;
|
|
669
669
|
N().setInt32(A + 4, w, !0), N().setInt32(A + 0, E, !0);
|
|
670
670
|
},
|
|
671
671
|
__wbg_toString_964ff7fe6eca8362: function(A) {
|
|
@@ -697,22 +697,22 @@ function n() {
|
|
|
697
697
|
console.warn(A, g, I);
|
|
698
698
|
},
|
|
699
699
|
__wbindgen_cast_0000000000000001: function(A, g) {
|
|
700
|
-
return
|
|
700
|
+
return Y(A, g, B.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___, Z);
|
|
701
701
|
},
|
|
702
702
|
__wbindgen_cast_0000000000000002: function(A, g) {
|
|
703
|
-
return
|
|
703
|
+
return Y(A, g, B.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___, Z);
|
|
704
704
|
},
|
|
705
705
|
__wbindgen_cast_0000000000000003: function(A, g) {
|
|
706
|
-
return
|
|
706
|
+
return Y(A, g, B.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___, _);
|
|
707
707
|
},
|
|
708
708
|
__wbindgen_cast_0000000000000004: function(A, g) {
|
|
709
|
-
return
|
|
709
|
+
return Y(A, g, B.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_36932265c58943ab___JsValue____Output_______, u);
|
|
710
710
|
},
|
|
711
711
|
__wbindgen_cast_0000000000000005: function(A, g) {
|
|
712
|
-
return gA(A, g, B.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,
|
|
712
|
+
return gA(A, g, B.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______, v);
|
|
713
713
|
},
|
|
714
714
|
__wbindgen_cast_0000000000000006: function(A, g) {
|
|
715
|
-
return
|
|
715
|
+
return Y(A, g, B.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______, e);
|
|
716
716
|
},
|
|
717
717
|
__wbindgen_cast_0000000000000007: function(A) {
|
|
718
718
|
return A;
|
|
@@ -724,7 +724,7 @@ function n() {
|
|
|
724
724
|
return s(A, g);
|
|
725
725
|
},
|
|
726
726
|
__wbindgen_cast_000000000000000a: function(A, g) {
|
|
727
|
-
return
|
|
727
|
+
return k(A, g);
|
|
728
728
|
},
|
|
729
729
|
__wbindgen_cast_000000000000000b: function(A, g) {
|
|
730
730
|
return BigInt.asUintN(64, A) | BigInt.asUintN(64, g) << BigInt(64);
|
|
@@ -743,10 +743,10 @@ function n() {
|
|
|
743
743
|
}
|
|
744
744
|
};
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function u(C, A, g) {
|
|
747
747
|
B.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue_____(C, A, g);
|
|
748
748
|
}
|
|
749
|
-
function
|
|
749
|
+
function v(C, A, g) {
|
|
750
750
|
B.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent_____(C, A, g);
|
|
751
751
|
}
|
|
752
752
|
function e(C, A, g) {
|
|
@@ -777,7 +777,7 @@ function U(C) {
|
|
|
777
777
|
const a = typeof FinalizationRegistry > "u" ? { register: () => {
|
|
778
778
|
}, unregister: () => {
|
|
779
779
|
} } : new FinalizationRegistry((C) => C.dtor(C.a, C.b));
|
|
780
|
-
function
|
|
780
|
+
function x(C) {
|
|
781
781
|
const A = typeof C;
|
|
782
782
|
if (A == "number" || A == "boolean" || C == null)
|
|
783
783
|
return `${C}`;
|
|
@@ -794,9 +794,9 @@ function t(C) {
|
|
|
794
794
|
if (Array.isArray(C)) {
|
|
795
795
|
const Q = C.length;
|
|
796
796
|
let E = "[";
|
|
797
|
-
Q > 0 && (E +=
|
|
797
|
+
Q > 0 && (E += x(C[0]));
|
|
798
798
|
for (let w = 1; w < Q; w++)
|
|
799
|
-
E += ", " +
|
|
799
|
+
E += ", " + x(C[w]);
|
|
800
800
|
return E += "]", E;
|
|
801
801
|
}
|
|
802
802
|
const g = /\[object ([^\]]+)\]/.exec(toString.call(C));
|
|
@@ -822,17 +822,17 @@ function AA(C, A) {
|
|
|
822
822
|
return B.__externref_drop_slice(C, A), I;
|
|
823
823
|
}
|
|
824
824
|
function s(C, A) {
|
|
825
|
-
return C = C >>> 0,
|
|
825
|
+
return C = C >>> 0, R().subarray(C / 1, C / 1 + A);
|
|
826
826
|
}
|
|
827
827
|
let K = null;
|
|
828
828
|
function N() {
|
|
829
829
|
return (K === null || K.buffer.detached === !0 || K.buffer.detached === void 0 && K.buffer !== B.memory.buffer) && (K = new DataView(B.memory.buffer)), K;
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function k(C, A) {
|
|
832
832
|
return C = C >>> 0, CA(C, A);
|
|
833
833
|
}
|
|
834
834
|
let J = null;
|
|
835
|
-
function
|
|
835
|
+
function R() {
|
|
836
836
|
return (J === null || J.byteLength === 0) && (J = new Uint8Array(B.memory.buffer)), J;
|
|
837
837
|
}
|
|
838
838
|
function D(C, A) {
|
|
@@ -843,7 +843,7 @@ function D(C, A) {
|
|
|
843
843
|
B.__wbindgen_exn_store(I);
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function M(C) {
|
|
847
847
|
return C == null;
|
|
848
848
|
}
|
|
849
849
|
function gA(C, A, g, I) {
|
|
@@ -859,7 +859,7 @@ function gA(C, A, g, I) {
|
|
|
859
859
|
--Q.cnt === 0 && (Q.dtor(Q.a, Q.b), Q.a = 0, a.unregister(Q));
|
|
860
860
|
}, a.register(E, Q, Q), E;
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function Y(C, A, g, I) {
|
|
863
863
|
const Q = { a: C, b: A, cnt: 1, dtor: g }, E = (...w) => {
|
|
864
864
|
Q.cnt++;
|
|
865
865
|
const i = Q.a;
|
|
@@ -874,17 +874,17 @@ function R(C, A, g, I) {
|
|
|
874
874
|
--Q.cnt === 0 && (Q.dtor(Q.a, Q.b), Q.a = 0, a.unregister(Q));
|
|
875
875
|
}, a.register(E, Q, Q), E;
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function O(C, A) {
|
|
878
878
|
const g = A(C.length * 1, 1) >>> 0;
|
|
879
|
-
return
|
|
879
|
+
return R().set(C, g / 1), G = C.length, g;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function F(C, A, g) {
|
|
882
882
|
if (g === void 0) {
|
|
883
883
|
const i = L.encode(C), o = A(i.length, 1) >>> 0;
|
|
884
|
-
return
|
|
884
|
+
return R().subarray(o, o + i.length).set(i), G = i.length, o;
|
|
885
885
|
}
|
|
886
886
|
let I = C.length, Q = A(I, 1) >>> 0;
|
|
887
|
-
const E =
|
|
887
|
+
const E = R();
|
|
888
888
|
let w = 0;
|
|
889
889
|
for (; w < I; w++) {
|
|
890
890
|
const i = C.charCodeAt(w);
|
|
@@ -893,7 +893,7 @@ function k(C, A, g) {
|
|
|
893
893
|
}
|
|
894
894
|
if (w !== I) {
|
|
895
895
|
w !== 0 && (C = C.slice(w)), Q = g(Q, I, I = w + C.length * 3, 1) >>> 0;
|
|
896
|
-
const i =
|
|
896
|
+
const i = R().subarray(Q + w, Q + I), o = L.encodeInto(C, i);
|
|
897
897
|
w += o.written, Q = g(Q, I, w, 1) >>> 0;
|
|
898
898
|
}
|
|
899
899
|
return G = w, Q;
|
|
@@ -905,9 +905,9 @@ function V(C) {
|
|
|
905
905
|
let c = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
|
|
906
906
|
c.decode();
|
|
907
907
|
const IA = 2146435072;
|
|
908
|
-
let
|
|
908
|
+
let t = 0;
|
|
909
909
|
function CA(C, A) {
|
|
910
|
-
return
|
|
910
|
+
return t += A, t >= IA && (c = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), c.decode(), t = A), c.decode(R().subarray(C, C + A));
|
|
911
911
|
}
|
|
912
912
|
const L = new TextEncoder();
|
|
913
913
|
"encodeInto" in L || (L.encodeInto = function(C, A) {
|
|
@@ -956,7 +956,7 @@ async function EA(C) {
|
|
|
956
956
|
const { instance: g, module: I } = await BA(await C, A);
|
|
957
957
|
return QA(g);
|
|
958
958
|
}
|
|
959
|
-
var DA = new URL("https://cdn.jsdelivr.net/npm/glassjar@0.3.
|
|
959
|
+
var DA = new URL("https://cdn.jsdelivr.net/npm/glassjar@0.3.1/dist/engine_bg.wasm");
|
|
960
960
|
class wA {
|
|
961
961
|
enabled = !1;
|
|
962
962
|
verified;
|
|
@@ -1054,7 +1054,7 @@ function iA(C, A) {
|
|
|
1054
1054
|
if (C[g] !== A[g]) return !1;
|
|
1055
1055
|
return !0;
|
|
1056
1056
|
}
|
|
1057
|
-
const
|
|
1057
|
+
const T = "glassjar-wasm:";
|
|
1058
1058
|
function oA(C, A) {
|
|
1059
1059
|
const g = new URL(String(C), A);
|
|
1060
1060
|
if (g.protocol !== "https:" && g.protocol !== "http:")
|
|
@@ -1071,7 +1071,7 @@ addEventListener(
|
|
|
1071
1071
|
const A = C.data;
|
|
1072
1072
|
if (A?.type === "configure_cpp") {
|
|
1073
1073
|
if (C.stopImmediatePropagation(), !A.toolchain) throw new Error("Missing verified compiler seed");
|
|
1074
|
-
H.configureVerified(A.toolchain, A.cacheCompilerModule),
|
|
1074
|
+
H.configureVerified(A.toolchain, A.cacheCompilerModule), m(
|
|
1075
1075
|
A.toolchain.compiler,
|
|
1076
1076
|
A.toolchain.sysroot,
|
|
1077
1077
|
A.toolchain.compilerHash,
|
|
@@ -1094,7 +1094,7 @@ addEventListener(
|
|
|
1094
1094
|
}
|
|
1095
1095
|
);
|
|
1096
1096
|
try {
|
|
1097
|
-
const C = self.name.startsWith(
|
|
1097
|
+
const C = self.name.startsWith(T) ? oA(self.name.slice(T.length)) : void 0;
|
|
1098
1098
|
await EA({ module_or_path: C ?? DA }), P(
|
|
1099
1099
|
(A) => H.constructVerified(A)
|
|
1100
1100
|
), r(
|
|
@@ -1103,7 +1103,7 @@ try {
|
|
|
1103
1103
|
})
|
|
1104
1104
|
), b(
|
|
1105
1105
|
(A) => H.instantiated(A)
|
|
1106
|
-
),
|
|
1106
|
+
), X();
|
|
1107
1107
|
} catch (C) {
|
|
1108
1108
|
postMessage({
|
|
1109
1109
|
type: "error",
|
package/dist/engine_bg.wasm
CHANGED
|
Binary file
|
package/dist/glassjar.js
CHANGED
|
@@ -5,8 +5,8 @@ var m = { exports: {} }, CA;
|
|
|
5
5
|
function JA() {
|
|
6
6
|
if (CA) return m.exports;
|
|
7
7
|
CA = 1;
|
|
8
|
-
var Q = typeof Reflect == "object" ? Reflect : null, A = Q && typeof Q.apply == "function" ? Q.apply : function(E, o,
|
|
9
|
-
return Function.prototype.apply.call(E, o,
|
|
8
|
+
var Q = typeof Reflect == "object" ? Reflect : null, A = Q && typeof Q.apply == "function" ? Q.apply : function(E, o, k) {
|
|
9
|
+
return Function.prototype.apply.call(E, o, k);
|
|
10
10
|
}, g;
|
|
11
11
|
Q && typeof Q.ownKeys == "function" ? g = Q.ownKeys : Object.getOwnPropertySymbols ? g = function(E) {
|
|
12
12
|
return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E));
|
|
@@ -51,41 +51,41 @@ function JA() {
|
|
|
51
51
|
B.prototype.getMaxListeners = function() {
|
|
52
52
|
return N(this);
|
|
53
53
|
}, B.prototype.emit = function(E) {
|
|
54
|
-
for (var o = [],
|
|
55
|
-
var
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
else if (!
|
|
54
|
+
for (var o = [], k = 1; k < arguments.length; k++) o.push(arguments[k]);
|
|
55
|
+
var M = E === "error", R = this._events;
|
|
56
|
+
if (R !== void 0)
|
|
57
|
+
M = M && R.error === void 0;
|
|
58
|
+
else if (!M)
|
|
59
59
|
return !1;
|
|
60
|
-
if (
|
|
61
|
-
var
|
|
62
|
-
if (o.length > 0 && (
|
|
63
|
-
throw
|
|
64
|
-
var a = new Error("Unhandled error." + (
|
|
65
|
-
throw a.context =
|
|
60
|
+
if (M) {
|
|
61
|
+
var F;
|
|
62
|
+
if (o.length > 0 && (F = o[0]), F instanceof Error)
|
|
63
|
+
throw F;
|
|
64
|
+
var a = new Error("Unhandled error." + (F ? " (" + F.message + ")" : ""));
|
|
65
|
+
throw a.context = F, a;
|
|
66
66
|
}
|
|
67
|
-
var j =
|
|
67
|
+
var j = R[E];
|
|
68
68
|
if (j === void 0)
|
|
69
69
|
return !1;
|
|
70
70
|
if (typeof j == "function")
|
|
71
71
|
A(j, this, o);
|
|
72
72
|
else
|
|
73
|
-
for (var IA = j.length,
|
|
74
|
-
A(
|
|
73
|
+
for (var IA = j.length, YA = x(j, IA), k = 0; k < IA; ++k)
|
|
74
|
+
A(YA[k], this, o);
|
|
75
75
|
return !0;
|
|
76
76
|
};
|
|
77
|
-
function y(w, E, o,
|
|
78
|
-
var
|
|
79
|
-
if (D(o),
|
|
77
|
+
function y(w, E, o, k) {
|
|
78
|
+
var M, R, F;
|
|
79
|
+
if (D(o), R = w._events, R === void 0 ? (R = w._events = /* @__PURE__ */ Object.create(null), w._eventsCount = 0) : (R.newListener !== void 0 && (w.emit(
|
|
80
80
|
"newListener",
|
|
81
81
|
E,
|
|
82
82
|
o.listener ? o.listener : o
|
|
83
|
-
),
|
|
84
|
-
|
|
85
|
-
else if (typeof
|
|
86
|
-
|
|
87
|
-
var a = new Error("Possible EventEmitter memory leak detected. " +
|
|
88
|
-
a.name = "MaxListenersExceededWarning", a.emitter = w, a.type = E, a.count =
|
|
83
|
+
), R = w._events), F = R[E]), F === void 0)
|
|
84
|
+
F = R[E] = o, ++w._eventsCount;
|
|
85
|
+
else if (typeof F == "function" ? F = R[E] = k ? [o, F] : [F, o] : k ? F.unshift(o) : F.push(o), M = N(w), M > 0 && F.length > M && !F.warned) {
|
|
86
|
+
F.warned = !0;
|
|
87
|
+
var a = new Error("Possible EventEmitter memory leak detected. " + F.length + " " + String(E) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
88
|
+
a.name = "MaxListenersExceededWarning", a.emitter = w, a.type = E, a.count = F.length, I(a);
|
|
89
89
|
}
|
|
90
90
|
return w;
|
|
91
91
|
}
|
|
@@ -99,62 +99,62 @@ function JA() {
|
|
|
99
99
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
100
100
|
}
|
|
101
101
|
function S(w, E, o) {
|
|
102
|
-
var
|
|
103
|
-
return
|
|
102
|
+
var k = { fired: !1, wrapFn: void 0, target: w, type: E, listener: o }, M = J.bind(k);
|
|
103
|
+
return M.listener = o, k.wrapFn = M, M;
|
|
104
104
|
}
|
|
105
105
|
B.prototype.once = function(E, o) {
|
|
106
106
|
return D(o), this.on(E, S(this, E, o)), this;
|
|
107
107
|
}, B.prototype.prependOnceListener = function(E, o) {
|
|
108
108
|
return D(o), this.prependListener(E, S(this, E, o)), this;
|
|
109
109
|
}, B.prototype.removeListener = function(E, o) {
|
|
110
|
-
var
|
|
111
|
-
if (D(o),
|
|
110
|
+
var k, M, R, F, a;
|
|
111
|
+
if (D(o), M = this._events, M === void 0)
|
|
112
112
|
return this;
|
|
113
|
-
if (
|
|
113
|
+
if (k = M[E], k === void 0)
|
|
114
114
|
return this;
|
|
115
|
-
if (
|
|
116
|
-
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete
|
|
117
|
-
else if (typeof
|
|
118
|
-
for (
|
|
119
|
-
if (
|
|
120
|
-
a =
|
|
115
|
+
if (k === o || k.listener === o)
|
|
116
|
+
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete M[E], M.removeListener && this.emit("removeListener", E, k.listener || o));
|
|
117
|
+
else if (typeof k != "function") {
|
|
118
|
+
for (R = -1, F = k.length - 1; F >= 0; F--)
|
|
119
|
+
if (k[F] === o || k[F].listener === o) {
|
|
120
|
+
a = k[F].listener, R = F;
|
|
121
121
|
break;
|
|
122
122
|
}
|
|
123
|
-
if (
|
|
123
|
+
if (R < 0)
|
|
124
124
|
return this;
|
|
125
|
-
|
|
125
|
+
R === 0 ? k.shift() : p(k, R), k.length === 1 && (M[E] = k[0]), M.removeListener !== void 0 && this.emit("removeListener", E, a || o);
|
|
126
126
|
}
|
|
127
127
|
return this;
|
|
128
128
|
}, B.prototype.off = B.prototype.removeListener, B.prototype.removeAllListeners = function(E) {
|
|
129
|
-
var o,
|
|
130
|
-
if (
|
|
129
|
+
var o, k, M;
|
|
130
|
+
if (k = this._events, k === void 0)
|
|
131
131
|
return this;
|
|
132
|
-
if (
|
|
133
|
-
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) :
|
|
132
|
+
if (k.removeListener === void 0)
|
|
133
|
+
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : k[E] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete k[E]), this;
|
|
134
134
|
if (arguments.length === 0) {
|
|
135
|
-
var
|
|
136
|
-
for (
|
|
137
|
-
|
|
135
|
+
var R = Object.keys(k), F;
|
|
136
|
+
for (M = 0; M < R.length; ++M)
|
|
137
|
+
F = R[M], F !== "removeListener" && this.removeAllListeners(F);
|
|
138
138
|
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
|
|
139
139
|
}
|
|
140
|
-
if (o =
|
|
140
|
+
if (o = k[E], typeof o == "function")
|
|
141
141
|
this.removeListener(E, o);
|
|
142
142
|
else if (o !== void 0)
|
|
143
|
-
for (
|
|
144
|
-
this.removeListener(E, o[
|
|
143
|
+
for (M = o.length - 1; M >= 0; M--)
|
|
144
|
+
this.removeListener(E, o[M]);
|
|
145
145
|
return this;
|
|
146
146
|
};
|
|
147
|
-
function
|
|
148
|
-
var
|
|
149
|
-
if (
|
|
147
|
+
function Y(w, E, o) {
|
|
148
|
+
var k = w._events;
|
|
149
|
+
if (k === void 0)
|
|
150
150
|
return [];
|
|
151
|
-
var
|
|
152
|
-
return
|
|
151
|
+
var M = k[E];
|
|
152
|
+
return M === void 0 ? [] : typeof M == "function" ? o ? [M.listener || M] : [M] : o ? KA(M) : x(M, M.length);
|
|
153
153
|
}
|
|
154
154
|
B.prototype.listeners = function(E) {
|
|
155
|
-
return
|
|
155
|
+
return Y(this, E, !0);
|
|
156
156
|
}, B.prototype.rawListeners = function(E) {
|
|
157
|
-
return
|
|
157
|
+
return Y(this, E, !1);
|
|
158
158
|
}, B.listenerCount = function(w, E) {
|
|
159
159
|
return typeof w.listenerCount == "function" ? w.listenerCount(E) : L.call(w, E);
|
|
160
160
|
}, B.prototype.listenerCount = L;
|
|
@@ -173,8 +173,8 @@ function JA() {
|
|
|
173
173
|
return this._eventsCount > 0 ? g(this._events) : [];
|
|
174
174
|
};
|
|
175
175
|
function x(w, E) {
|
|
176
|
-
for (var o = new Array(E),
|
|
177
|
-
o[
|
|
176
|
+
for (var o = new Array(E), k = 0; k < E; ++k)
|
|
177
|
+
o[k] = w[k];
|
|
178
178
|
return o;
|
|
179
179
|
}
|
|
180
180
|
function p(w, E) {
|
|
@@ -188,25 +188,25 @@ function JA() {
|
|
|
188
188
|
return E;
|
|
189
189
|
}
|
|
190
190
|
function yA(w, E) {
|
|
191
|
-
return new Promise(function(o,
|
|
192
|
-
function F
|
|
193
|
-
w.removeListener(E,
|
|
191
|
+
return new Promise(function(o, k) {
|
|
192
|
+
function M(F) {
|
|
193
|
+
w.removeListener(E, R), k(F);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
typeof w.removeListener == "function" && w.removeListener("error",
|
|
195
|
+
function R() {
|
|
196
|
+
typeof w.removeListener == "function" && w.removeListener("error", M), o([].slice.call(arguments));
|
|
197
197
|
}
|
|
198
|
-
gA(w, E,
|
|
198
|
+
gA(w, E, R, { once: !0 }), E !== "error" && RA(w, M, { once: !0 });
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function RA(w, E, o) {
|
|
202
202
|
typeof w.on == "function" && gA(w, "error", E, o);
|
|
203
203
|
}
|
|
204
|
-
function gA(w, E, o,
|
|
204
|
+
function gA(w, E, o, k) {
|
|
205
205
|
if (typeof w.on == "function")
|
|
206
|
-
|
|
206
|
+
k.once ? w.once(E, o) : w.on(E, o);
|
|
207
207
|
else if (typeof w.addEventListener == "function")
|
|
208
|
-
w.addEventListener(E, function
|
|
209
|
-
|
|
208
|
+
w.addEventListener(E, function M(R) {
|
|
209
|
+
k.once && w.removeEventListener(E, M), o(R);
|
|
210
210
|
});
|
|
211
211
|
else
|
|
212
212
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof w);
|
|
@@ -303,7 +303,7 @@ function SA() {
|
|
|
303
303
|
}
|
|
304
304
|
function QA(Q) {
|
|
305
305
|
const A = V(Q, G.__wbindgen_malloc, G.__wbindgen_realloc), g = d, I = G.prefetch_urls(A, g);
|
|
306
|
-
var C =
|
|
306
|
+
var C = kA(I[0], I[1]).slice();
|
|
307
307
|
return G.__wbindgen_free(I[0], I[1] * 4, 4), C;
|
|
308
308
|
}
|
|
309
309
|
function hA() {
|
|
@@ -765,7 +765,7 @@ function hA() {
|
|
|
765
765
|
return new Uint8Array(A);
|
|
766
766
|
},
|
|
767
767
|
__wbg_new_from_slice_a3d2629dc1826784: function(A, g) {
|
|
768
|
-
return new Uint8Array(
|
|
768
|
+
return new Uint8Array(b(A, g));
|
|
769
769
|
},
|
|
770
770
|
__wbg_new_no_args_1c7c842f08d00ebb: function(A, g) {
|
|
771
771
|
return new Function(c(A, g));
|
|
@@ -822,7 +822,7 @@ function hA() {
|
|
|
822
822
|
return A.process;
|
|
823
823
|
},
|
|
824
824
|
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(A, g, I) {
|
|
825
|
-
Uint8Array.prototype.set.call(
|
|
825
|
+
Uint8Array.prototype.set.call(b(A, g), I);
|
|
826
826
|
},
|
|
827
827
|
__wbg_push_8ffdcb2063340ba5: function(A, g) {
|
|
828
828
|
return A.push(g);
|
|
@@ -879,7 +879,7 @@ function hA() {
|
|
|
879
879
|
}, arguments);
|
|
880
880
|
},
|
|
881
881
|
__wbg_set_cc56eefd2dd91957: function(A, g, I) {
|
|
882
|
-
A.set(
|
|
882
|
+
A.set(b(g, I));
|
|
883
883
|
},
|
|
884
884
|
__wbg_set_f43e577aea94465b: function(A, g, I) {
|
|
885
885
|
A[g >>> 0] = I;
|
|
@@ -990,7 +990,7 @@ function hA() {
|
|
|
990
990
|
return A;
|
|
991
991
|
},
|
|
992
992
|
__wbindgen_cast_0000000000000009: function(A, g) {
|
|
993
|
-
return
|
|
993
|
+
return b(A, g);
|
|
994
994
|
},
|
|
995
995
|
__wbindgen_cast_000000000000000a: function(A, g) {
|
|
996
996
|
return c(A, g);
|
|
@@ -1002,7 +1002,7 @@ function hA() {
|
|
|
1002
1002
|
return BigInt.asUintN(64, A);
|
|
1003
1003
|
},
|
|
1004
1004
|
__wbindgen_cast_000000000000000d: function(A, g) {
|
|
1005
|
-
var I =
|
|
1005
|
+
var I = kA(A, g).slice();
|
|
1006
1006
|
return G.__wbindgen_free(A, g * 4, 4), I;
|
|
1007
1007
|
},
|
|
1008
1008
|
__wbindgen_init_externref_table: function() {
|
|
@@ -1084,15 +1084,15 @@ function _(Q) {
|
|
|
1084
1084
|
return Q instanceof Error ? `${Q.name}: ${Q.message}
|
|
1085
1085
|
${Q.stack}` : I;
|
|
1086
1086
|
}
|
|
1087
|
-
function
|
|
1087
|
+
function kA(Q, A) {
|
|
1088
1088
|
Q = Q >>> 0;
|
|
1089
1089
|
const g = s(), I = [];
|
|
1090
1090
|
for (let C = Q; C < Q + 4 * A; C += 4)
|
|
1091
1091
|
I.push(G.__wbindgen_externrefs.get(g.getUint32(C, !0)));
|
|
1092
1092
|
return G.__externref_drop_slice(Q, A), I;
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1095
|
-
return Q = Q >>> 0,
|
|
1094
|
+
function b(Q, A) {
|
|
1095
|
+
return Q = Q >>> 0, T().subarray(Q / 1, Q / 1 + A);
|
|
1096
1096
|
}
|
|
1097
1097
|
let t = null;
|
|
1098
1098
|
function s() {
|
|
@@ -1101,9 +1101,9 @@ function s() {
|
|
|
1101
1101
|
function c(Q, A) {
|
|
1102
1102
|
return Q = Q >>> 0, tA(Q, A);
|
|
1103
1103
|
}
|
|
1104
|
-
let
|
|
1105
|
-
function
|
|
1106
|
-
return (
|
|
1104
|
+
let O = null;
|
|
1105
|
+
function T() {
|
|
1106
|
+
return (O === null || O.byteLength === 0) && (O = new Uint8Array(G.memory.buffer)), O;
|
|
1107
1107
|
}
|
|
1108
1108
|
function K(Q, A) {
|
|
1109
1109
|
try {
|
|
@@ -1147,10 +1147,10 @@ function Z(Q, A, g, I) {
|
|
|
1147
1147
|
function V(Q, A, g) {
|
|
1148
1148
|
if (g === void 0) {
|
|
1149
1149
|
const D = z.encode(Q), N = A(D.length, 1) >>> 0;
|
|
1150
|
-
return
|
|
1150
|
+
return T().subarray(N, N + D.length).set(D), d = D.length, N;
|
|
1151
1151
|
}
|
|
1152
1152
|
let I = Q.length, C = A(I, 1) >>> 0;
|
|
1153
|
-
const B =
|
|
1153
|
+
const B = T();
|
|
1154
1154
|
let i = 0;
|
|
1155
1155
|
for (; i < I; i++) {
|
|
1156
1156
|
const D = Q.charCodeAt(i);
|
|
@@ -1159,7 +1159,7 @@ function V(Q, A, g) {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
if (i !== I) {
|
|
1161
1161
|
i !== 0 && (Q = Q.slice(i)), C = g(C, I, I = i + Q.length * 3, 1) >>> 0;
|
|
1162
|
-
const D =
|
|
1162
|
+
const D = T().subarray(C + i, C + I), N = z.encodeInto(Q, D);
|
|
1163
1163
|
i += N.written, C = g(C, I, i, 1) >>> 0;
|
|
1164
1164
|
}
|
|
1165
1165
|
return d = i, C;
|
|
@@ -1173,7 +1173,7 @@ P.decode();
|
|
|
1173
1173
|
const dA = 2146435072;
|
|
1174
1174
|
let u = 0;
|
|
1175
1175
|
function tA(Q, A) {
|
|
1176
|
-
return u += A, u >= dA && (P = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), P.decode(), u = A), P.decode(
|
|
1176
|
+
return u += A, u >= dA && (P = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), P.decode(), u = A), P.decode(T().subarray(Q, Q + A));
|
|
1177
1177
|
}
|
|
1178
1178
|
const z = new TextEncoder();
|
|
1179
1179
|
"encodeInto" in z || (z.encodeInto = function(Q, A) {
|
|
@@ -1185,7 +1185,7 @@ const z = new TextEncoder();
|
|
|
1185
1185
|
});
|
|
1186
1186
|
let d = 0, G;
|
|
1187
1187
|
function xA(Q, A) {
|
|
1188
|
-
return G = Q.exports, t = null,
|
|
1188
|
+
return G = Q.exports, t = null, O = null, G.__wbindgen_start(), G;
|
|
1189
1189
|
}
|
|
1190
1190
|
async function VA(Q, A) {
|
|
1191
1191
|
if (typeof Response == "function" && Q instanceof Response) {
|
|
@@ -1222,13 +1222,13 @@ async function jA(Q) {
|
|
|
1222
1222
|
const { instance: g, module: I } = await VA(await Q, A);
|
|
1223
1223
|
return xA(g);
|
|
1224
1224
|
}
|
|
1225
|
-
const ZA = new URL("https://cdn.jsdelivr.net/npm/glassjar@0.3.
|
|
1225
|
+
const ZA = new URL("https://cdn.jsdelivr.net/npm/glassjar@0.3.1/dist/engine_bg.wasm"), WA = Object.freeze({
|
|
1226
1226
|
maxObjectBytes: 128 * 1024 * 1024,
|
|
1227
1227
|
maxEntries: 256,
|
|
1228
1228
|
maxMetadataBytes: 8 * 1024 * 1024,
|
|
1229
1229
|
maxEntryMetadataBytes: 1024 * 1024
|
|
1230
1230
|
});
|
|
1231
|
-
class
|
|
1231
|
+
class OA {
|
|
1232
1232
|
records = /* @__PURE__ */ new Map();
|
|
1233
1233
|
staged = /* @__PURE__ */ new Map();
|
|
1234
1234
|
stagingFailed = !1;
|
|
@@ -1288,7 +1288,7 @@ class TA {
|
|
|
1288
1288
|
if (this.stagingFailed) return !1;
|
|
1289
1289
|
const A = [...this.staged.values()];
|
|
1290
1290
|
for (const g of A) {
|
|
1291
|
-
if (!
|
|
1291
|
+
if (!TA(g.object)) return !1;
|
|
1292
1292
|
const I = await crypto.subtle.digest("SHA-256", g.object);
|
|
1293
1293
|
if (Array.from(
|
|
1294
1294
|
new Uint8Array(I),
|
|
@@ -1365,7 +1365,7 @@ class TA {
|
|
|
1365
1365
|
};
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1368
|
+
function TA(Q) {
|
|
1369
1369
|
if (!WebAssembly.validate(Q) || Q.length < 8) return !1;
|
|
1370
1370
|
let A = 8, g = !1;
|
|
1371
1371
|
const I = () => {
|
|
@@ -1471,17 +1471,17 @@ function mA(Q, A) {
|
|
|
1471
1471
|
throw new TypeError(`Engine Wasm must be served over http(s), not ${g.protocol}`);
|
|
1472
1472
|
return g.href;
|
|
1473
1473
|
}
|
|
1474
|
-
function
|
|
1474
|
+
function bA(Q) {
|
|
1475
1475
|
return new Worker(
|
|
1476
|
-
"" + new URL("assets/worker-
|
|
1476
|
+
"" + new URL("assets/worker-BgBM-gEP.js", import.meta.url).href,
|
|
1477
1477
|
{
|
|
1478
1478
|
type: "module",
|
|
1479
1479
|
name: Q?.name
|
|
1480
1480
|
}
|
|
1481
1481
|
);
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1484
|
-
return new
|
|
1483
|
+
function XA(Q) {
|
|
1484
|
+
return new bA(Q ? { name: lA + Q } : void 0);
|
|
1485
1485
|
}
|
|
1486
1486
|
const nA = "/dev/debugger-sh-host";
|
|
1487
1487
|
class wA {
|
|
@@ -1612,7 +1612,7 @@ const rA = [
|
|
|
1612
1612
|
sysroot: "8745c6af23fd841fa507d0c73f6b6b8e8da1b4ec216a6339739a28b38ff7227b",
|
|
1613
1613
|
exceptions: "20986166552953de0e3ca5c1e9f341e7aec8b9ba54dcb244d0d2b2f9ca843ab4"
|
|
1614
1614
|
});
|
|
1615
|
-
function
|
|
1615
|
+
function MA(Q = "legacy") {
|
|
1616
1616
|
if (Q === "legacy") return { profile: Q, digests: n };
|
|
1617
1617
|
if (Q === "stock-certified-v1" && rA.length > 0)
|
|
1618
1618
|
return { profile: Q, digests: n };
|
|
@@ -1626,7 +1626,7 @@ class f {
|
|
|
1626
1626
|
this.#A = A, this.hashMs = g;
|
|
1627
1627
|
}
|
|
1628
1628
|
static async load(A, g, I, C = n.exceptions, B = "legacy") {
|
|
1629
|
-
const i =
|
|
1629
|
+
const i = MA(B);
|
|
1630
1630
|
if (A.length !== 2) throw new Error("Missing C++ toolchain assets");
|
|
1631
1631
|
let D;
|
|
1632
1632
|
const N = await Promise.allSettled(
|
|
@@ -1642,7 +1642,7 @@ class f {
|
|
|
1642
1642
|
);
|
|
1643
1643
|
if (N[0].status === "rejected" || N[1].status === "rejected")
|
|
1644
1644
|
throw D?.error;
|
|
1645
|
-
const [y, J] = [N[0].value, N[1].value], [S,
|
|
1645
|
+
const [y, J] = [N[0].value, N[1].value], [S, Y] = await Promise.allSettled([
|
|
1646
1646
|
f.ingestOwned(y, J, !1, C),
|
|
1647
1647
|
g ? Promise.resolve().then(() => WebAssembly.compile(y)) : Promise.resolve(void 0)
|
|
1648
1648
|
]);
|
|
@@ -1651,8 +1651,8 @@ class f {
|
|
|
1651
1651
|
if (L.#A.compilerHash !== i.digests.compiler || L.#A.sysrootHash !== i.digests.sysroot || L.#A.exceptionsHash !== i.digests.exceptions)
|
|
1652
1652
|
throw new Error("C++ toolchain integrity mismatch");
|
|
1653
1653
|
if (I?.aborted) throw new DOMException("Toolchain loading aborted", "AbortError");
|
|
1654
|
-
if (
|
|
1655
|
-
return L.#A.stockProfile = i.profile === "stock-certified-v1", L.#A.module =
|
|
1654
|
+
if (Y.status === "rejected") throw Y.reason;
|
|
1655
|
+
return L.#A.stockProfile = i.profile === "stock-certified-v1", L.#A.module = Y.value, L;
|
|
1656
1656
|
}
|
|
1657
1657
|
/** Captures even Buffer/subclass inputs before the first asynchronous boundary. */
|
|
1658
1658
|
static async fromBytes(A, g, I) {
|
|
@@ -1701,8 +1701,8 @@ async function oA(Q) {
|
|
|
1701
1701
|
const A = await crypto.subtle.digest("SHA-256", Q);
|
|
1702
1702
|
return Array.from(new Uint8Array(A), (g) => g.toString(16).padStart(2, "0")).join("");
|
|
1703
1703
|
}
|
|
1704
|
-
let v,
|
|
1705
|
-
class
|
|
1704
|
+
let v, X;
|
|
1705
|
+
class FA {
|
|
1706
1706
|
stdout = new NA(1);
|
|
1707
1707
|
stderr = new NA(2);
|
|
1708
1708
|
stdin = new H();
|
|
@@ -1745,12 +1745,12 @@ class kA {
|
|
|
1745
1745
|
cacheValidation;
|
|
1746
1746
|
static async create(A, g = {}) {
|
|
1747
1747
|
const { wasmUrl: I, ...C } = g, B = I === void 0 ? void 0 : mA(I, globalThis.location?.href), i = structuredClone(C), D = B ?? null;
|
|
1748
|
-
if (
|
|
1748
|
+
if (X !== void 0 && X !== D)
|
|
1749
1749
|
throw new Error("The engine Wasm is already loaded from a different wasmUrl");
|
|
1750
|
-
|
|
1751
|
-
throw v = void 0,
|
|
1750
|
+
X = D, v ??= jA({ module_or_path: B ?? ZA }).catch((y) => {
|
|
1751
|
+
throw v = void 0, X = void 0, y;
|
|
1752
1752
|
}), await v;
|
|
1753
|
-
const N = new
|
|
1753
|
+
const N = new FA(A, i);
|
|
1754
1754
|
if (N.wasmUrl = B, A !== "c" && typeof window < "u" && typeof fetch < "u")
|
|
1755
1755
|
for (const y of QA(A))
|
|
1756
1756
|
fetch(y, { cache: "force-cache" }).then((J) => J.arrayBuffer()).catch(() => {
|
|
@@ -1769,9 +1769,9 @@ class kA {
|
|
|
1769
1769
|
throw new TypeError("C++ performance options require project and account identity");
|
|
1770
1770
|
if (I.compilerLifetime !== void 0 && !["idle", "project"].includes(I.compilerLifetime))
|
|
1771
1771
|
throw new TypeError("Invalid compiler lifetime");
|
|
1772
|
-
|
|
1772
|
+
MA(I.toolchainProfile), this.scope = Object.freeze({ ...I.scope }), this.options = Object.freeze({ ...I, scope: this.scope, idleTimeoutMs: C });
|
|
1773
1773
|
}
|
|
1774
|
-
this.objects = new
|
|
1774
|
+
this.objects = new OA(typeof I?.objectCache == "object" ? I.objectCache : {}), this.debugger = new fA(), this.lang = A;
|
|
1775
1775
|
}
|
|
1776
1776
|
/** A retained worker reuses clang, compiled once on this thread and cloned to it. */
|
|
1777
1777
|
get cacheCompilerModule() {
|
|
@@ -1879,10 +1879,10 @@ class kA {
|
|
|
1879
1879
|
const C = g && !I;
|
|
1880
1880
|
let B;
|
|
1881
1881
|
try {
|
|
1882
|
-
const
|
|
1883
|
-
if (
|
|
1884
|
-
const L =
|
|
1885
|
-
(typeof L != "string" || L.length > 1024 * 1024 || new TextEncoder().encode(L).byteLength > 1024 * 1024) && delete
|
|
1882
|
+
const Y = C || !this.cppArtifacts ? null : { ...this.cppArtifacts };
|
|
1883
|
+
if (Y?.cacheCertificate !== void 0) {
|
|
1884
|
+
const L = Y.cacheCertificate;
|
|
1885
|
+
(typeof L != "string" || L.length > 1024 * 1024 || new TextEncoder().encode(L).byteLength > 1024 * 1024) && delete Y.cacheCertificate;
|
|
1886
1886
|
}
|
|
1887
1887
|
B = {
|
|
1888
1888
|
fs: C ? {} : structuredClone(this.fs),
|
|
@@ -1892,10 +1892,10 @@ class kA {
|
|
|
1892
1892
|
new Uint8Array(x)
|
|
1893
1893
|
])
|
|
1894
1894
|
),
|
|
1895
|
-
cpp_artifacts: structuredClone(
|
|
1895
|
+
cpp_artifacts: structuredClone(Y)
|
|
1896
1896
|
};
|
|
1897
|
-
} catch (
|
|
1898
|
-
return Promise.resolve(h(
|
|
1897
|
+
} catch (Y) {
|
|
1898
|
+
return Promise.resolve(h(Y));
|
|
1899
1899
|
}
|
|
1900
1900
|
const i = !A && this.debugger.enabled, D = A ? void 0 : this.hostDevice;
|
|
1901
1901
|
if (D !== void 0 && (typeof D != "function" || !["c", "python"].includes(this.lang)))
|
|
@@ -1903,8 +1903,8 @@ class kA {
|
|
|
1903
1903
|
clearTimeout(this.idleTimer), i && this.retireWorker(), this.stdin[U].clear();
|
|
1904
1904
|
const N = !!this.slot;
|
|
1905
1905
|
let y;
|
|
1906
|
-
const J = new Promise((
|
|
1907
|
-
y =
|
|
1906
|
+
const J = new Promise((Y) => {
|
|
1907
|
+
y = Y;
|
|
1908
1908
|
});
|
|
1909
1909
|
this.promise = J;
|
|
1910
1910
|
const S = {
|
|
@@ -1950,12 +1950,12 @@ class kA {
|
|
|
1950
1950
|
this.objects.beginBatch(), this.active = S;
|
|
1951
1951
|
try {
|
|
1952
1952
|
if (this.slot || this.makeWorker(), !this.current(S)) return J;
|
|
1953
|
-
const
|
|
1953
|
+
const Y = this.slot;
|
|
1954
1954
|
this.lang === "c" && !this.toolchain && this.ensureToolchain().catch((L) => {
|
|
1955
|
-
this.current(S) && this.slot ===
|
|
1955
|
+
this.current(S) && this.slot === Y && this.finish(S, h(L));
|
|
1956
1956
|
}), this.slot.ready && this.dispatch(S);
|
|
1957
|
-
} catch (
|
|
1958
|
-
this.finish(S, h(
|
|
1957
|
+
} catch (Y) {
|
|
1958
|
+
this.finish(S, h(Y));
|
|
1959
1959
|
}
|
|
1960
1960
|
return J;
|
|
1961
1961
|
}
|
|
@@ -1963,7 +1963,7 @@ class kA {
|
|
|
1963
1963
|
return this.active === A && !A.settled;
|
|
1964
1964
|
}
|
|
1965
1965
|
makeWorker() {
|
|
1966
|
-
const A =
|
|
1966
|
+
const A = XA(this.wasmUrl), g = { worker: A, ready: !1, remove: () => {
|
|
1967
1967
|
} };
|
|
1968
1968
|
this.slot = g;
|
|
1969
1969
|
const I = (i) => {
|
|
@@ -2207,7 +2207,7 @@ class H {
|
|
|
2207
2207
|
export {
|
|
2208
2208
|
zA as Artifact,
|
|
2209
2209
|
fA as Debugger,
|
|
2210
|
-
|
|
2210
|
+
FA as Engine,
|
|
2211
2211
|
nA as HOST_DEVICE_PATH,
|
|
2212
2212
|
H as Stdin,
|
|
2213
2213
|
NA as Stdout
|
package/dist/glassjar.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(H,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(H=typeof globalThis<"u"?globalThis:H||self,x(H.engine={}))})(this,(function(H){"use strict";var x=typeof document<"u"?document.currentScript:null;function UA(Q){return Q&&Q.__esModule&&Object.prototype.hasOwnProperty.call(Q,"default")?Q.default:Q}var b={exports:{}},BA;function JA(){if(BA)return b.exports;BA=1;var Q=typeof Reflect=="object"?Reflect:null,A=Q&&typeof Q.apply=="function"?Q.apply:function(E,o,M){return Function.prototype.apply.call(E,o,M)},g;Q&&typeof Q.ownKeys=="function"?g=Q.ownKeys:Object.getOwnPropertySymbols?g=function(E){return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E))}:g=function(E){return Object.getOwnPropertyNames(E)};function I(w){console&&console.warn&&console.warn(w)}var C=Number.isNaN||function(E){return E!==E};function B(){B.init.call(this)}b.exports=B,b.exports.once=nA,B.EventEmitter=B,B.prototype._events=void 0,B.prototype._eventsCount=0,B.prototype._maxListeners=void 0;var i=10;function D(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(B,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(w){if(typeof w!="number"||w<0||C(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");i=w}}),B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},B.prototype.setMaxListeners=function(E){if(typeof E!="number"||E<0||C(E))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+E+".");return this._maxListeners=E,this};function N(w){return w._maxListeners===void 0?B.defaultMaxListeners:w._maxListeners}B.prototype.getMaxListeners=function(){return N(this)},B.prototype.emit=function(E){for(var o=[],M=1;M<arguments.length;M++)o.push(arguments[M]);var F=E==="error",Y=this._events;if(Y!==void 0)F=F&&Y.error===void 0;else if(!F)return!1;if(F){var k;if(o.length>0&&(k=o[0]),k instanceof Error)throw k;var q=new Error("Unhandled error."+(k?" ("+k.message+")":""));throw q.context=k,q}var X=Y[E];if(X===void 0)return!1;if(typeof X=="function")A(X,this,o);else for(var RA=X.length,vA=Z(X,RA),M=0;M<RA;++M)A(vA[M],this,o);return!0};function y(w,E,o,M){var F,Y,k;if(D(o),Y=w._events,Y===void 0?(Y=w._events=Object.create(null),w._eventsCount=0):(Y.newListener!==void 0&&(w.emit("newListener",E,o.listener?o.listener:o),Y=w._events),k=Y[E]),k===void 0)k=Y[E]=o,++w._eventsCount;else if(typeof k=="function"?k=Y[E]=M?[o,k]:[k,o]:M?k.unshift(o):k.push(o),F=N(w),F>0&&k.length>F&&!k.warned){k.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+k.length+" "+String(E)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=w,q.type=E,q.count=k.length,I(q)}return w}B.prototype.addListener=function(E,o){return y(this,E,o,!1)},B.prototype.on=B.prototype.addListener,B.prototype.prependListener=function(E,o){return y(this,E,o,!0)};function J(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(w,E,o){var M={fired:!1,wrapFn:void 0,target:w,type:E,listener:o},F=J.bind(M);return F.listener=o,M.wrapFn=F,F}B.prototype.once=function(E,o){return D(o),this.on(E,S(this,E,o)),this},B.prototype.prependOnceListener=function(E,o){return D(o),this.prependListener(E,S(this,E,o)),this},B.prototype.removeListener=function(E,o){var M,F,Y,k,q;if(D(o),F=this._events,F===void 0)return this;if(M=F[E],M===void 0)return this;if(M===o||M.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete F[E],F.removeListener&&this.emit("removeListener",E,M.listener||o));else if(typeof M!="function"){for(Y=-1,k=M.length-1;k>=0;k--)if(M[k]===o||M[k].listener===o){q=M[k].listener,Y=k;break}if(Y<0)return this;Y===0?M.shift():t(M,Y),M.length===1&&(F[E]=M[0]),F.removeListener!==void 0&&this.emit("removeListener",E,q||o)}return this},B.prototype.off=B.prototype.removeListener,B.prototype.removeAllListeners=function(E){var o,M,F;if(M=this._events,M===void 0)return this;if(M.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):M[E]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete M[E]),this;if(arguments.length===0){var Y=Object.keys(M),k;for(F=0;F<Y.length;++F)k=Y[F],k!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=M[E],typeof o=="function")this.removeListener(E,o);else if(o!==void 0)for(F=o.length-1;F>=0;F--)this.removeListener(E,o[F]);return this};function R(w,E,o){var M=w._events;if(M===void 0)return[];var F=M[E];return F===void 0?[]:typeof F=="function"?o?[F.listener||F]:[F]:o?rA(F):Z(F,F.length)}B.prototype.listeners=function(E){return R(this,E,!0)},B.prototype.rawListeners=function(E){return R(this,E,!1)},B.listenerCount=function(w,E){return typeof w.listenerCount=="function"?w.listenerCount(E):L.call(w,E)},B.prototype.listenerCount=L;function L(w){var E=this._events;if(E!==void 0){var o=E[w];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}B.prototype.eventNames=function(){return this._eventsCount>0?g(this._events):[]};function Z(w,E){for(var o=new Array(E),M=0;M<E;++M)o[M]=w[M];return o}function t(w,E){for(;E+1<w.length;E++)w[E]=w[E+1];w.pop()}function rA(w){for(var E=new Array(w.length),o=0;o<E.length;++o)E[o]=w[o].listener||w[o];return E}function nA(w,E){return new Promise(function(o,M){function F(k){w.removeListener(E,Y),M(k)}function Y(){typeof w.removeListener=="function"&&w.removeListener("error",F),o([].slice.call(arguments))}YA(w,E,Y,{once:!0}),E!=="error"&&uA(w,F,{once:!0})})}function uA(w,E,o){typeof w.on=="function"&&YA(w,"error",E,o)}function YA(w,E,o,M){if(typeof w.on=="function")M.once?w.once(E,o):w.on(E,o);else if(typeof w.addEventListener=="function")w.addEventListener(E,function F(Y){M.once&&w.removeEventListener(E,F),o(Y)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return b.exports}var LA=JA();const EA=UA(LA);class e{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,iA.unregister(this),A}free(){const A=this.__destroy_into_raw();G.__wbg_dapadapter_free(A,0)}attach(A){G.dapadapter_attach(this.__wbg_ptr,A)}detach(){G.dapadapter_detach(this.__wbg_ptr)}constructor(){const A=G.dapadapter_new();return this.__wbg_ptr=A>>>0,iA.register(this,this.__wbg_ptr,this),this}on(A){G.dapadapter_on(this.__wbg_ptr,A)}resetRun(){G.dapadapter_resetRun(this.__wbg_ptr)}sendMessage(A){return G.dapadapter_sendMessage(this.__wbg_ptr,A)}setFilterInternals(A){G.dapadapter_setFilterInternals(this.__wbg_ptr,A)}}Symbol.dispose&&(e.prototype[Symbol.dispose]=e.prototype.free);class W{static __wrap(A){A=A>>>0;const g=Object.create(W.prototype);return g.__wbg_ptr=A,oA.register(g,g.__wbg_ptr,g),g}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,oA.unregister(this),A}free(){const A=this.__destroy_into_raw();G.__wbg_trap_free(A,0)}static __wbg_wasmer_trap(){G.trap___wbg_wasmer_trap()}}Symbol.dispose&&(W.prototype[Symbol.dispose]=W.prototype.free);function SA(){let Q,A;try{const g=G.cpp_exception_hash();return Q=g[0],A=g[1],c(g[0],g[1])}finally{G.__wbindgen_free(Q,A,1)}}function DA(Q){const A=j(Q,G.__wbindgen_malloc,G.__wbindgen_realloc),g=d,I=G.prefetch_urls(A,g);var C=NA(I[0],I[1]).slice();return G.__wbindgen_free(I[0],I[1]*4,4),C}function hA(){return{__proto__:null,"./engine_bg.js":{__proto__:null,__wbg_BigInt_b7bbccdff258c9f2:function(A){return BigInt(A)},__wbg_Error_8c4e43fe74559d73:function(A,g){return Error(c(A,g))},__wbg_Number_04624de7d0e8332d:function(A){return Number(A)},__wbg_String_8f0eb39a4a4c2f66:function(A,g){const I=String(g),C=j(I,G.__wbindgen_malloc,G.__wbindgen_realloc),B=d;h().setInt32(A+4,B,!0),h().setInt32(A+0,C,!0)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(A,g){const I=g,C=typeof I=="bigint"?I:void 0;h().setBigInt64(A+8,p(C)?BigInt(0):C,!0),h().setInt32(A+0,!p(C),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(A){const g=A,I=typeof g=="boolean"?g:void 0;return p(I)?16777215:I?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(A,g){const I=_(g),C=j(I,G.__wbindgen_malloc,G.__wbindgen_realloc),B=d;h().setInt32(A+4,B,!0),h().setInt32(A+0,C,!0)},__wbg___wbindgen_function_table_5ae7216dfcbcc506:function(){return G.__wbindgen_export},__wbg___wbindgen_in_47fa6863be6f2f25:function(A,g){return A in g},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(A){return typeof A=="bigint"},__wbg___wbindgen_is_function_0095a73b8b156f76:function(A){return typeof A=="function"},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(A){const g=A;return typeof g=="object"&&g!==null},__wbg___wbindgen_is_string_cd444516edc5b180:function(A){return typeof A=="string"},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(A){return A===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(A,g){return A===g},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(A,g){return A==g},__wbg___wbindgen_lt_bb59cc3d23526e0d:function(A,g){return A<g},__wbg___wbindgen_neg_6b4d356dff49dcc6:function(A){return-A},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(A,g){const I=g,C=typeof I=="number"?I:void 0;h().setFloat64(A+8,p(C)?0:C,!0),h().setInt32(A+0,!p(C),!0)},__wbg___wbindgen_rethrow_05525c567f154472:function(A){throw A},__wbg___wbindgen_shr_ef8e07cce709eb54:function(A,g){return A>>g},__wbg___wbindgen_string_get_72fb696202c56729:function(A,g){const I=g,C=typeof I=="string"?I:void 0;var B=p(C)?0:j(C,G.__wbindgen_malloc,G.__wbindgen_realloc),i=d;h().setInt32(A+4,i,!0),h().setInt32(A+0,B,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(A,g){throw new Error(c(A,g))},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(A){A._wbg_cb_unref()},__wbg_addEventListener_3acb0aad4483804c:function(){return K(function(A,g,I,C){A.addEventListener(c(g,I),C)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return K(function(A,g,I){return Reflect.apply(A,g,I)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return K(function(A,g,I){return A.apply(g,I)},arguments)},__wbg_arrayBuffer_bb54076166006c39:function(){return K(function(A){return A.arrayBuffer()},arguments)},__wbg_bind_1dc37de2b9939128:function(A,g,I,C){return A.bind(g,I,C)},__wbg_bind_29ba380591735d8c:function(A,g,I){return A.bind(g,I)},__wbg_buffer_7b5f53e46557d8f1:function(A){return A.buffer},__wbg_byteLength_7b03c17ff1e4037f:function(A){return A.byteLength},__wbg_byteLength_b5d783d06792ed2c:function(A){return A.byteLength},__wbg_call_389efe28435a9388:function(){return K(function(A,g){return A.call(g)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return K(function(A,g,I){return A.call(g,I)},arguments)},__wbg_compareExchange_b578410c358e695e:function(){return K(function(A,g,I,C){return Atomics.compareExchange(A,g>>>0,I,C)},arguments)},__wbg_constructor_ad6c0ed428f55d34:function(A){return A.constructor},__wbg_crypto_86f2631e91b51511:function(A){return A.crypto},__wbg_customSections_193491b069139fb1:function(A,g,I){return WebAssembly.Module.customSections(A,c(g,I))},__wbg_data_5330da50312d0bc1:function(A){return A.data},__wbg_done_57b39ecd9addfe81:function(A){return A.done},__wbg_entries_58c7934c745daac7:function(A){return Object.entries(A)},__wbg_error_7534b8e9a36f1ab4:function(A,g){let I,C;try{I=A,C=g,console.error(c(A,g))}finally{G.__wbindgen_free(I,C,1)}},__wbg_exports_794a42000dacd046:function(A){return WebAssembly.Module.exports(A)},__wbg_exports_86b4926134c40288:function(A){return A.exports},__wbg_fetch_d1488f40cef1e210:function(A,g,I){return A.fetch(c(g,I))},__wbg_from_bddd64e7d5ff6941:function(A){return Array.from(A)},__wbg_getPrototypeOf_2653517f1dc884d5:function(){return K(function(A){return Reflect.getPrototypeOf(A)},arguments)},__wbg_getRandomValues_b3f15fcbfabb0f8b:function(){return K(function(A,g){A.getRandomValues(g)},arguments)},__wbg_getTime_1e3cd1391c5c3995:function(A){return A.getTime()},__wbg_getTimezoneOffset_81776d10a4ec18a8:function(A){return A.getTimezoneOffset()},__wbg_getUint32_bb6f5a401408e7fa:function(A,g,I){return A.getUint32(g>>>0,I!==0)},__wbg_get_7efbcc3819719b0f:function(){return K(function(A,g){return A.get(g>>>0)},arguments)},__wbg_get_9b94d73e6221f75c:function(A,g){return A[g>>>0]},__wbg_get_b3ed3ad4be2bc8ac:function(){return K(function(A,g){return Reflect.get(A,g)},arguments)},__wbg_get_index_253dd2a9e007656d:function(A,g){return A[g>>>0]},__wbg_get_index_9a5bfdd2ca49c65f:function(A,g){return A[g>>>0]},__wbg_get_with_ref_key_1dc361bd10053bfe:function(A,g){return A[g]},__wbg_grow_5d42bf28c2da22cb:function(){return K(function(A,g){return A.grow(g>>>0)},arguments)},__wbg_grow_d034989fce14cc8e:function(){return K(function(A,g){return A.grow(g>>>0)},arguments)},__wbg_imports_8333d40ab24779ad:function(A){return WebAssembly.Module.imports(A)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(A){let g;try{g=A instanceof ArrayBuffer}catch{g=!1}return g},__wbg_instanceof_Error_8573fe0b0b480f46:function(A){let g;try{g=A instanceof Error}catch{g=!1}return g},__wbg_instanceof_Function_2a29eec978bb3b11:function(A){let g;try{g=A instanceof Function}catch{g=!1}return g},__wbg_instanceof_Global_2db767b6b2347f01:function(A){let g;try{g=A instanceof WebAssembly.Global}catch{g=!1}return g},__wbg_instanceof_Map_53af74335dec57f4:function(A){let g;try{g=A instanceof Map}catch{g=!1}return g},__wbg_instanceof_Memory_dc8c61e3f831ee37:function(A){let g;try{g=A instanceof WebAssembly.Memory}catch{g=!1}return g},__wbg_instanceof_Module_d0d412b14363ba9a:function(A){let g;try{g=A instanceof WebAssembly.Module}catch{g=!1}return g},__wbg_instanceof_Object_1c6af87502b733ed:function(A){let g;try{g=A instanceof Object}catch{g=!1}return g},__wbg_instanceof_RangeError_0b0dd056bc557b89:function(A){let g;try{g=A instanceof RangeError}catch{g=!1}return g},__wbg_instanceof_Response_ee1d54d79ae41977:function(A){let g;try{g=A instanceof Response}catch{g=!1}return g},__wbg_instanceof_SharedArrayBuffer_91d8a2fa16a2cc26:function(A){let g;try{g=A instanceof SharedArrayBuffer}catch{g=!1}return g},__wbg_instanceof_Table_127f216e592f4159:function(A){let g;try{g=A instanceof WebAssembly.Table}catch{g=!1}return g},__wbg_instanceof_Tag_f1d6b24a98b95210:function(A){let g;try{g=A instanceof WebAssembly.Tag}catch{g=!1}return g},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(A){let g;try{g=A instanceof Uint8Array}catch{g=!1}return g},__wbg_isArray_d314bb98fcf08331:function(A){return Array.isArray(A)},__wbg_isSafeInteger_bfbc7332a9768d2a:function(A){return Number.isSafeInteger(A)},__wbg_is_f29129f676e5410c:function(A,g){return Object.is(A,g)},__wbg_iterator_6ff6560ca1568e55:function(){return Symbol.iterator},__wbg_length_32ed9a279acd054c:function(A){return A.length},__wbg_length_35a7bace40f36eac:function(A){return A.length},__wbg_length_aeb94ff17a8a8556:function(A){return A.length},__wbg_load_eff64ff5e429a422:function(){return K(function(A,g){return Atomics.load(A,g>>>0)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(A){return A.message},__wbg_msCrypto_d562bbe83e0d4b91:function(A){return A.msCrypto},__wbg_new_0728bd2d4c5d41dd:function(){return K(function(A){return new WebAssembly.Tag(A)},arguments)},__wbg_new_0_73afc35eb544e539:function(){return new Date},__wbg_new_245cd5c49157e602:function(A){return new Date(A)},__wbg_new_2ac7fa8be584d280:function(A,g,I){return new DataView(A,g>>>0,I>>>0)},__wbg_new_361308b2356cecd0:function(){return new Object},__wbg_new_3eb36ae241fe6f44:function(){return new Array},__wbg_new_4a996a46a82782b6:function(){return K(function(A,g){return new WebAssembly.Global(A,g)},arguments)},__wbg_new_57c27ff3ddf5b62c:function(){return K(function(A){return new WebAssembly.Module(A)},arguments)},__wbg_new_67274f72d5abea37:function(){return K(function(A){return new WebAssembly.Table(A)},arguments)},__wbg_new_8a6f238a6ece86ea:function(){return new Error},__wbg_new_a4e3cab1cdd635ba:function(){return K(function(A,g){return new WebAssembly.Instance(A,g)},arguments)},__wbg_new_b061c0550d9f3281:function(){return K(function(A){return new WebAssembly.Memory(A)},arguments)},__wbg_new_b5d9e2fb389fef91:function(A,g){try{var I={a:A,b:g},C=(i,D)=>{const N=I.a;I.a=0;try{return qA(N,I.b,i,D)}finally{I.a=N}};return new Promise(C)}finally{I.a=I.b=0}},__wbg_new_ca409f861989e0c5:function(A){return new SharedArrayBuffer(A>>>0)},__wbg_new_dca287b076112a51:function(){return new Map},__wbg_new_dd2b680c8bf6ae29:function(A){return new Uint8Array(A)},__wbg_new_from_slice_a3d2629dc1826784:function(A,g){return new Uint8Array(r(A,g))},__wbg_new_no_args_1c7c842f08d00ebb:function(A,g){return new Function(c(A,g))},__wbg_new_with_args_7bba34e94b1cfa40:function(A,g,I,C){return new Function(c(A,g),c(I,C))},__wbg_new_with_byte_offset_9120ba79e057895b:function(A,g){return new Uint8Array(A,g>>>0)},__wbg_new_with_byte_offset_and_length_aa261d9c9da49eb1:function(A,g,I){return new Uint8Array(A,g>>>0,I>>>0)},__wbg_new_with_byte_offset_and_length_bc2e7b72cc96d1c1:function(A,g,I){return new Int32Array(A,g>>>0,I>>>0)},__wbg_new_with_length_1763c527b2923202:function(A){return new Array(A>>>0)},__wbg_new_with_length_a2c39cbe88fd8ff1:function(A){return new Uint8Array(A>>>0)},__wbg_next_3482f54c49e8af19:function(){return K(function(A){return A.next()},arguments)},__wbg_next_418f80d8f5303233:function(A){return A.next},__wbg_node_e1f24f89a7336c2e:function(A){return A.node},__wbg_notify_78a90977fab74963:function(){return K(function(A,g){return Atomics.notify(A,g>>>0)},arguments)},__wbg_now_a3af9a2f4bbaa4d1:function(){return Date.now()},__wbg_now_ebffdf7e580f210d:function(A){return A.now()},__wbg_ok_87f537440a0acf85:function(A){return A.ok},__wbg_postMessage_2041f4e90af61318:function(){return K(function(A,g){A.postMessage(g)},arguments)},__wbg_process_3975fd6c72f520aa:function(A){return A.process},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(A,g,I){Uint8Array.prototype.set.call(r(A,g),I)},__wbg_push_8ffdcb2063340ba5:function(A,g){return A.push(g)},__wbg_queueMicrotask_0aa0a927f78f5d98:function(A){return A.queueMicrotask},__wbg_queueMicrotask_5bb536982f78a56f:function(A){queueMicrotask(A)},__wbg_randomFillSync_f8c153b79f285817:function(){return K(function(A,g){A.randomFillSync(g)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return K(function(A,g,I,C){A.removeEventListener(c(g,I),C)},arguments)},__wbg_require_b74f47fc2d022fd6:function(){return K(function(){return module.require},arguments)},__wbg_resolve_002c4b7d9d8f6b64:function(A){return Promise.resolve(A)},__wbg_setTimeout_e0aacd5a637418a6:function(){return K(function(A,g,I){return A.setTimeout(g,I)},arguments)},__wbg_setUint32_d168af7751a8557e:function(A,g,I,C){A.setUint32(g>>>0,I>>>0,C!==0)},__wbg_set_0af2522656c2a71b:function(){return K(function(A,g,I){A.set(g>>>0,I)},arguments)},__wbg_set_1eb0999cf5d27fc8:function(A,g,I){return A.set(g,I)},__wbg_set_25cf9deff6bf0ea8:function(A,g,I){A.set(g,I>>>0)},__wbg_set_3f1d0b984ed272ed:function(A,g,I){A[g]=I},__wbg_set_6cb8631f80447a67:function(){return K(function(A,g,I){return Reflect.set(A,g,I)},arguments)},__wbg_set_cc56eefd2dd91957:function(A,g,I){A.set(r(g,I))},__wbg_set_f43e577aea94465b:function(A,g,I){A[g>>>0]=I},__wbg_set_index_b3244a6c458021e4:function(A,g,I){A[g>>>0]=I},__wbg_set_index_f259b54e97f7b177:function(A,g,I){A[g>>>0]=I},__wbg_set_onmessage_ea7cc2ba099021cd:function(A,g){A.onmessage=g},__wbg_set_value_fc06e541de098215:function(A,g){A.value=g},__wbg_slice_8bbd46adb2100583:function(A,g,I){return A.slice(g>>>0,I>>>0)},__wbg_stack_0ed75d68575b0f3c:function(A,g){const I=g.stack,C=j(I,G.__wbindgen_malloc,G.__wbindgen_realloc),B=d;h().setInt32(A+4,B,!0),h().setInt32(A+0,C,!0)},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){const A=typeof global>"u"?null:global;return p(A)?0:T(A)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){const A=typeof globalThis>"u"?null:globalThis;return p(A)?0:T(A)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){const A=typeof self>"u"?null:self;return p(A)?0:T(A)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){const A=typeof window>"u"?null:window;return p(A)?0:T(A)},__wbg_store_d1d951c98d9bed41:function(){return K(function(A,g,I){return Atomics.store(A,g>>>0,I)},arguments)},__wbg_subarray_a96e1fef17ed23cb:function(A,g,I){return A.subarray(g>>>0,I>>>0)},__wbg_then_0d9fe2c7b1857d32:function(A,g,I){return A.then(g,I)},__wbg_then_b9e7b3b5f1a9e1b5:function(A,g){return A.then(g)},__wbg_toString_56d946daff83867b:function(A,g,I){const C=g.toString(I),B=j(C,G.__wbindgen_malloc,G.__wbindgen_realloc),i=d;h().setInt32(A+4,i,!0),h().setInt32(A+0,B,!0)},__wbg_toString_964ff7fe6eca8362:function(A){return A.toString()},__wbg_trap_new:function(A){return W.__wrap(A)},__wbg_validate_71c2d02a71bda62f:function(){return K(function(A){return WebAssembly.validate(A)},arguments)},__wbg_value_0546255b415e96c1:function(A){return A.value},__wbg_value_ce37a60e576310ff:function(A){return A.value},__wbg_versions_4e31226f5e8dc909:function(A){return A.versions},__wbg_wait_be5dae1e53f590f1:function(){return K(function(A,g,I){return Atomics.wait(A,g>>>0,I)},arguments)},__wbg_warn_81ab00e6e16e886d:function(A,g,I){console.warn(A,g,I)},__wbindgen_cast_0000000000000001:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,wA)},__wbindgen_cast_0000000000000002:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,wA)},__wbindgen_cast_0000000000000003:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,HA)},__wbindgen_cast_0000000000000004:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_36932265c58943ab___JsValue____Output_______,sA)},__wbindgen_cast_0000000000000005:function(A,g){return pA(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,cA)},__wbindgen_cast_0000000000000006:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,aA)},__wbindgen_cast_0000000000000007:function(A){return A},__wbindgen_cast_0000000000000008:function(A){return A},__wbindgen_cast_0000000000000009:function(A,g){return r(A,g)},__wbindgen_cast_000000000000000a:function(A,g){return c(A,g)},__wbindgen_cast_000000000000000b:function(A,g){return BigInt.asUintN(64,A)|BigInt.asUintN(64,g)<<BigInt(64)},__wbindgen_cast_000000000000000c:function(A){return BigInt.asUintN(64,A)},__wbindgen_cast_000000000000000d:function(A,g){var I=NA(A,g).slice();return G.__wbindgen_free(A,g*4,4),I},__wbindgen_init_externref_table:function(){const A=G.__wbindgen_externrefs,g=A.grow(4);A.set(0,void 0),A.set(g+0,void 0),A.set(g+1,null),A.set(g+2,!0),A.set(g+3,!1)}}}}function sA(Q,A,g){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,g)}function cA(Q,A,g){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent_____(Q,A,g)}function aA(Q,A,g){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent______1_(Q,A,g)}function HA(Q,A,g){const I=G.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_36932265c58943ab___JsValue__(Q,A,g);if(I[1])throw $(I[0])}function wA(Q,A,g){const I=G.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue__(Q,A,g);if(I[2])throw $(I[1]);return $(I[0])}function qA(Q,A,g,I){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue__wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,g,I)}const iA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>G.__wbg_dapadapter_free(Q>>>0,1)),oA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>G.__wbg_trap_free(Q>>>0,1));function T(Q){const A=G.__externref_table_alloc();return G.__wbindgen_externrefs.set(A,Q),A}const P=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>Q.dtor(Q.a,Q.b));function _(Q){const A=typeof Q;if(A=="number"||A=="boolean"||Q==null)return`${Q}`;if(A=="string")return`"${Q}"`;if(A=="symbol"){const C=Q.description;return C==null?"Symbol":`Symbol(${C})`}if(A=="function"){const C=Q.name;return typeof C=="string"&&C.length>0?`Function(${C})`:"Function"}if(Array.isArray(Q)){const C=Q.length;let B="[";C>0&&(B+=_(Q[0]));for(let i=1;i<C;i++)B+=", "+_(Q[i]);return B+="]",B}const g=/\[object ([^\]]+)\]/.exec(toString.call(Q));let I;if(g&&g.length>1)I=g[1];else return toString.call(Q);if(I=="Object")try{return"Object("+JSON.stringify(Q)+")"}catch{return"Object"}return Q instanceof Error?`${Q.name}: ${Q.message}
|
|
2
|
-
${Q.stack}`:I}function NA(Q,A){Q=Q>>>0;const g=h(),I=[];for(let C=Q;C<Q+4*A;C+=4)I.push(G.__wbindgen_externrefs.get(g.getUint32(C,!0)));return G.__externref_drop_slice(Q,A),I}function r(Q,A){return Q=Q>>>0,z().subarray(Q/1,Q/1+A)}let V=null;function h(){return(V===null||V.buffer.detached===!0||V.buffer.detached===void 0&&V.buffer!==G.memory.buffer)&&(V=new DataView(G.memory.buffer)),V}function c(Q,A){return Q=Q>>>0,tA(Q,A)}let O=null;function z(){return(O===null||O.byteLength===0)&&(O=new Uint8Array(G.memory.buffer)),O}function K(Q,A){try{return Q.apply(this,A)}catch(g){const I=T(g);G.__wbindgen_exn_store(I)}}function p(Q){return Q==null}function pA(Q,A,g,I){const C={a:Q,b:A,cnt:1,dtor:g},B=(...i)=>{C.cnt++;try{return I(C.a,C.b,...i)}finally{B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,P.unregister(C))},P.register(B,C,C),B}function f(Q,A,g,I){const C={a:Q,b:A,cnt:1,dtor:g},B=(...i)=>{C.cnt++;const D=C.a;C.a=0;try{return I(D,C.b,...i)}finally{C.a=D,B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,P.unregister(C))},P.register(B,C,C),B}function j(Q,A,g){if(g===void 0){const D=l.encode(Q),N=A(D.length,1)>>>0;return z().subarray(N,N+D.length).set(D),d=D.length,N}let I=Q.length,C=A(I,1)>>>0;const B=z();let i=0;for(;i<I;i++){const D=Q.charCodeAt(i);if(D>127)break;B[C+i]=D}if(i!==I){i!==0&&(Q=Q.slice(i)),C=g(C,I,I=i+Q.length*3,1)>>>0;const D=z().subarray(C+i,C+I),N=l.encodeInto(Q,D);i+=N.written,C=g(C,I,i,1)>>>0}return d=i,C}function $(Q){const A=G.__wbindgen_externrefs.get(Q);return G.__externref_table_dealloc(Q),A}let n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});n.decode();const dA=2146435072;let AA=0;function tA(Q,A){return AA+=A,AA>=dA&&(n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),n.decode(),AA=A),n.decode(z().subarray(Q,Q+A))}const l=new TextEncoder;"encodeInto"in l||(l.encodeInto=function(Q,A){const g=l.encode(Q);return A.set(g),{read:Q.length,written:g.length}});let d=0,G;function xA(Q,A){return G=Q.exports,V=null,O=null,G.__wbindgen_start(),G}async function VA(Q,A){if(typeof Response=="function"&&Q instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(Q,A)}catch(C){if(Q.ok&&g(Q.type)&&Q.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",C);else throw C}const I=await Q.arrayBuffer();return await WebAssembly.instantiate(I,A)}else{const I=await WebAssembly.instantiate(Q,A);return I instanceof WebAssembly.Instance?{instance:I,module:Q}:I}function g(I){switch(I){case"basic":case"cors":case"default":return!0}return!1}}async function jA(Q){if(G!==void 0)return G;Q!==void 0&&(Object.getPrototypeOf(Q)===Object.prototype?{module_or_path:Q}=Q:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),Q===void 0&&(Q=new URL("",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:x&&x.tagName.toUpperCase()==="SCRIPT"&&x.src||new URL("glassjar.umd.cjs",document.baseURI).href));const A=hA();(typeof Q=="string"||typeof Request=="function"&&Q instanceof Request||typeof URL=="function"&&Q instanceof URL)&&(Q=fetch(Q));const{instance:g,module:I}=await VA(await Q,A);return xA(g)}const ZA=new URL("https://cdn.jsdelivr.net/npm/glassjar@0.3.0/dist/engine_bg.wasm"),WA=Object.freeze({maxObjectBytes:128*1024*1024,maxEntries:256,maxMetadataBytes:8*1024*1024,maxEntryMetadataBytes:1024*1024});class TA{records=new Map;staged=new Map;stagingFailed=!1;objectBytes=0;metadataBytes=0;evictions=0;oversized=0;limits;constructor(A={}){this.limits=Object.freeze({...WA,...A});for(const g of Object.values(this.limits))if(!Number.isSafeInteger(g)||g<0)throw new RangeError("C++ cache limits must be nonnegative safe integers")}beginBatch(){this.discardBatch(),this.stagingFailed=!1}stage(A){if(this.stagingFailed)return;const g=this.recordSize(A);if(g===void 0||this.staged.has(A.source)){this.failBatch();return}const I=this.limits;for(;this.records.size&&(this.records.size+this.staged.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes);)this.remove(this.records.keys().next().value),this.evictions++;if(this.records.size+this.staged.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes||g>I.maxEntryMetadataBytes){this.oversized++,this.failBatch();return}this.staged.set(A.source,{...A,object:new Uint8Array(A.object),metadataBytes:g}),this.objectBytes+=A.object.byteLength,this.metadataBytes+=g}abandonBatch(){this.failBatch()}failBatch(){this.discardBatch(),this.stagingFailed=!0}recordSize(A){if(!(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(g=>!g||g==="."||g==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.key)||!/^[a-f0-9]{64}$/.test(A.object_hash)||A.receipt!=null&&typeof A.receipt!="string"||!(A.object instanceof Uint8Array)))return new TextEncoder().encode(JSON.stringify({source:A.source,key:A.key,object_hash:A.object_hash,...A.receipt==null?{}:{receipt:A.receipt}})).byteLength}async validateBatch(){if(this.stagingFailed)return!1;const A=[...this.staged.values()];for(const g of A){if(!OA(g.object))return!1;const I=await crypto.subtle.digest("SHA-256",g.object);if(Array.from(new Uint8Array(I),B=>B.toString(16).padStart(2,"0")).join("")!==g.object_hash)return!1}return!0}commitBatch(){for(const[A,g]of this.staged)this.remove(A),this.records.set(A,g);this.staged.clear(),this.stagingFailed=!1}discardBatch(){for(const A of this.staged.values())this.objectBytes-=A.object.byteLength,this.metadataBytes-=A.metadataBytes;this.staged.clear()}snapshot(){return[...this.records.values()].map(({source:A,key:g,object_hash:I,object:C,receipt:B})=>({source:A,key:g,object_hash:I,...B==null?{}:{receipt:B},object:C.slice()}))}touch(A){const g=this.records.get(A);g&&(this.records.delete(A),this.records.set(A,g))}put(A){if(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(B=>!B||B==="."||B==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.object_hash)||!/^[a-f0-9]{64}$/.test(A.key)||!(A.object instanceof Uint8Array))return;const g=this.recordSize(A);if(g===void 0)return;const I=this.limits;if(this.remove(A.source),I.maxEntries===0||A.object.byteLength>I.maxObjectBytes||g>I.maxMetadataBytes||g>I.maxEntryMetadataBytes){this.oversized++;return}for(;this.records.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes;)this.remove(this.records.keys().next().value),this.evictions++;const C={...A,object:new Uint8Array(A.object),metadataBytes:g};this.records.set(A.source,C),this.objectBytes+=C.object.byteLength,this.metadataBytes+=g}delete(A){this.remove(A)}remove(A){const g=this.records.get(A);g&&(this.objectBytes-=g.object.byteLength,this.metadataBytes-=g.metadataBytes,this.records.delete(A))}clear(){this.records.clear(),this.staged.clear(),this.stagingFailed=!1,this.objectBytes=this.metadataBytes=0}stats(){return{objectBytes:this.objectBytes,metadataBytes:this.metadataBytes,entries:this.records.size,stagingEntries:this.staged.size,stagingObjectBytes:[...this.staged.values()].reduce((A,g)=>A+g.object.byteLength,0),stagingMetadataBytes:[...this.staged.values()].reduce((A,g)=>A+g.metadataBytes,0),evictions:this.evictions,oversized:this.oversized}}}function OA(Q){if(!WebAssembly.validate(Q)||Q.length<8)return!1;let A=8,g=!1;const I=()=>{let C=0,B=0;for(let i=0;i<5&&A<Q.length;i++,B+=7){const D=Q[A++];if(C+=(D&127)*2**B,!(D&128))return C}throw new Error("Malformed object section")};try{for(;A<Q.length;){const C=Q[A++],B=I(),i=A+B;if(i>Q.length||C===8)return!1;if(C===0){const D=I();if(A+D>i)return!1;const N=new TextDecoder().decode(Q.subarray(A,A+D));if(A+=D,N==="linking"){if(g||I()!==2)return!1;g=!0}}A=i}return g}catch{return!1}}const U=Symbol();function s(Q){return Q instanceof Error?{type:"error",error:{type:Q.constructor.name,message:Q.message}}:{type:"error",error:{type:typeof Q,message:String(Q)}}}class GA{name;data;constructor(A,g){this.name=A,this.data=g}download(){const A=new Uint8Array(this.data),g=new Blob([A]),I=URL.createObjectURL(g),C=document.createElement("a");C.href=I,C.download=this.name,document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(I)}}class MA extends EA{[U];dap;enabled=!0;set filterInternals(A){this.dap.setFilterInternals(A)}constructor(){super(),this[U]={attach:this.attach.bind(this),detach:this.detach.bind(this),beginRun:()=>this.dap.resetRun()},this.onMessage=this.onMessage.bind(this),this.dap=new e,this.dap.on(this.onMessage)}send(A){return this.dap.sendMessage(A)}artifactListener=A=>{if(A.data.type!=="artifact")return;const g=new GA(A.data.name,new Uint8Array(A.data.data));this.emit("artifact",g)};attach(A){A.addEventListener("message",this.artifactListener),this.dap.attach(A)}detach(A){A.removeEventListener("message",this.artifactListener),this.dap.detach()}onMessage(A){this.emit("event",A)}}const zA="glassjar-wasm:";function fA(Q,A){const g=new URL(String(Q),A);if(g.protocol!=="https:"&&g.protocol!=="http:")throw new TypeError(`Engine Wasm must be served over http(s), not ${g.protocol}`);return g.href}function lA(Q){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/worker-uZ245g5u.js").href:new URL("assets/worker-uZ245g5u.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{type:"module",name:Q?.name})}function mA(Q){return new lA(Q?{name:zA+Q}:void 0)}const XA="/dev/debugger-sh-host";class FA{buffer=new SharedArrayBuffer(4+64*1024);length=new Int32Array(this.buffer,0,1);bytes=new Uint8Array(this.buffer,4);publish(A){Atomics.store(this.length,0,A),Atomics.notify(this.length,0)}}function gA(Q){try{return new Error(`Host device callback failed: ${Q instanceof Error?Q.message:String(Q)}`)}catch{return new Error("Host device callback failed")}}function kA(Q){try{const A=Q?.();if(A&&typeof A.then=="function")return Promise.resolve(A).catch(()=>{}),new TypeError("Host device cleanup must be synchronous")}catch(A){return gA(A)}}class bA{constructor(A){this.onFailure=A}incoming=new FA;outgoing=new FA;workerStart={guest_to_host:this.incoming.buffer,host_to_guest:this.outgoing.buffer};abort=new AbortController;listeners=new Set;cleanup;worker;writing=!1;open(A){let g;try{g=A({signal:this.abort.signal,onData:I=>{if(this.assertOpen(),typeof I!="function")throw new TypeError("Host device listener must be a function");return this.listeners.add(I),()=>{this.listeners.delete(I)}},write:I=>this.write(I)})}catch(I){throw gA(I)}if(g!==void 0&&typeof g!="function")throw Promise.resolve(g).catch(()=>{}),new TypeError("Host device opener must return a cleanup function or undefined");if(typeof g=="function")if(this.abort.signal.aborted){const I=kA(g);if(I)throw I}else this.cleanup=g}attach(A){this.assertOpen(),this.worker=A,A.addEventListener("message",this.onMessage)}assertOpen(){if(this.abort.signal.aborted)throw new Error("Host device is closed")}async write(A){if(this.assertOpen(),!(A instanceof Uint8Array))throw new TypeError("Host device writes require Uint8Array");if(this.writing)throw new Error("Await the previous host device write before writing again");this.writing=!0;try{const g=new Uint8Array(A),I=this.outgoing;let C=0;for(;C<g.length;){this.assertOpen();const B=Atomics.load(I.length,0);if(B!==0){await Atomics.waitAsync(I.length,0,B).value;continue}const i=g.subarray(C,C+I.bytes.length);I.bytes.set(i),I.publish(i.length),C+=i.length}}finally{this.writing=!1}}onMessage=A=>{if(!(this.abort.signal.aborted||A.data?.type!=="host_wake"))try{const g=Atomics.load(this.incoming.length,0);if(g<=0)return;const I=this.incoming.bytes.slice(0,g);this.incoming.publish(0);for(const C of this.listeners){if(this.abort.signal.aborted)break;Promise.resolve(C(I)).catch(B=>this.fail(B))}}catch(g){this.fail(g)}};fail(A){this.abort.signal.aborted||(this.close(),this.onFailure(gA(A)))}close(){if(this.abort.signal.aborted)return;this.worker?.removeEventListener("message",this.onMessage),this.worker=void 0,this.incoming.publish(-1),this.outgoing.publish(-1),this.abort.abort(),this.listeners.clear();const A=this.cleanup;return this.cleanup=void 0,kA(A)}}const PA=["4847c7cda81eb51b1cec18fe40b396605579fe84e17eca2760702b8a9666e4e1"],u=Object.freeze({compiler:"24fbed474c7b5b4968fd73fc4827440b93fb351c1b6264516130300eff3e7bf5",sysroot:"8745c6af23fd841fa507d0c73f6b6b8e8da1b4ec216a6339739a28b38ff7227b",exceptions:"20986166552953de0e3ca5c1e9f341e7aec8b9ba54dcb244d0d2b2f9ca843ab4"});function KA(Q="legacy"){if(Q==="legacy")return{profile:Q,digests:u};if(Q==="stock-certified-v1"&&PA.length>0)return{profile:Q,digests:u};throw new Error(`The ${Q} toolchain is not available in this build`)}class m{#A;hashCount=3;hashMs;constructor(A,g){this.#A=A,this.hashMs=g}static async load(A,g,I,C=u.exceptions,B="legacy"){const i=KA(B);if(A.length!==2)throw new Error("Missing C++ toolchain assets");let D;const N=await Promise.allSettled(A.map(async Z=>{try{const t=await fetch(Z,{cache:"force-cache",signal:I});if(!t.ok)throw new Error(`Cannot load C++ toolchain (${t.status})`);return new Uint8Array(await t.arrayBuffer())}catch(t){throw D??={error:t},t}}));if(N[0].status==="rejected"||N[1].status==="rejected")throw D?.error;const[y,J]=[N[0].value,N[1].value],[S,R]=await Promise.allSettled([m.ingestOwned(y,J,!1,C),g?Promise.resolve().then(()=>WebAssembly.compile(y)):Promise.resolve(void 0)]);if(S.status==="rejected")throw S.reason;const L=S.value;if(L.#A.compilerHash!==i.digests.compiler||L.#A.sysrootHash!==i.digests.sysroot||L.#A.exceptionsHash!==i.digests.exceptions)throw new Error("C++ toolchain integrity mismatch");if(I?.aborted)throw new DOMException("Toolchain loading aborted","AbortError");if(R.status==="rejected")throw R.reason;return L.#A.stockProfile=i.profile==="stock-certified-v1",L.#A.module=R.value,L}static async fromBytes(A,g,I){const C=new Uint8Array(A),B=new Uint8Array(g);return m.ingestOwned(C,B,I,u.exceptions)}static async ingestOwned(A,g,I,C){const B=performance.now(),i=await Promise.allSettled([yA(A),yA(g)]);if(i[0].status==="rejected")throw i[0].reason;if(i[1].status==="rejected")throw i[1].reason;const[D,N]=[i[0].value,i[1].value],y=I?await WebAssembly.compile(A):void 0;return new m({compiler:A,sysroot:g,compilerHash:D,sysrootHash:N,exceptionsHash:C,module:y},performance.now()-B)}matchesExpectation(A){return A.compilerSha256===this.#A.compilerHash&&A.sysrootSha256===this.#A.sysrootHash&&A.exceptionsSha256===this.#A.exceptionsHash}get identity(){return`${this.#A.compilerHash}:${this.#A.sysrootHash}:${this.#A.exceptionsHash}`}get identityBytes(){return this.#A.compiler.byteLength+this.#A.sysroot.byteLength}get compilerBytes(){return this.#A.compiler.byteLength}configure(A,g){try{return A.postMessage({...g,toolchain:this.#A}),!!this.#A.module}catch(I){if(!(I instanceof DOMException)||I.name!=="DataCloneError"||!this.#A.module)throw I;return A.postMessage({...g,toolchain:{...this.#A,module:void 0}}),!1}}}async function yA(Q){const A=await crypto.subtle.digest("SHA-256",Q);return Array.from(new Uint8Array(A),g=>g.toString(16).padStart(2,"0")).join("")}let IA,v;class CA{stdout=new QA(1);stderr=new QA(2);stdin=new a;debugger;lang;scope;fs={};binaryFiles={};cppArtifacts;hostDevice;options;retain;idleTimeoutMs;wasmUrl;objects;generation=0;scopeEpoch=0;operationId=0;disposed=!1;active;promise;slot;idleTimer;toolchain;toolchainLoading;toolchainController;initializing=new Set;toolchainIdentity;toolchainIngestions=0;toolchainHashCount=0;toolchainHashMs=0;compilerModuleCloned=!1;disposal;cancellationDraining;releaseDrain;releases=new Set;retirements=0;latest;cacheValidation;static async create(A,g={}){const{wasmUrl:I,...C}=g,B=I===void 0?void 0:fA(I,globalThis.location?.href),i=structuredClone(C),D=B??null;if(v!==void 0&&v!==D)throw new Error("The engine Wasm is already loaded from a different wasmUrl");v=D,IA??=jA({module_or_path:B??ZA}).catch(y=>{throw IA=void 0,v=void 0,y}),await IA;const N=new CA(A,i);if(N.wasmUrl=B,A!=="c"&&typeof window<"u"&&typeof fetch<"u")for(const y of DA(A))fetch(y,{cache:"force-cache"}).then(J=>J.arrayBuffer()).catch(()=>{});return N}constructor(A,g){const I=g.cpp;this.retain=g.retainWorker??I?.retainWorker??!0;const C=g.idleTimeoutMs??I?.idleTimeoutMs??3e4;if(!Number.isSafeInteger(C)||C<1||C>3e5)throw new RangeError("Worker idle timeout must be between 1 and 300000 milliseconds");if(this.idleTimeoutMs=C,I){if(A!=="c")throw new TypeError("C++ performance options require C/C++");if(!I.scope?.projectId||!I.scope.accountId)throw new TypeError("C++ performance options require project and account identity");if(I.compilerLifetime!==void 0&&!["idle","project"].includes(I.compilerLifetime))throw new TypeError("Invalid compiler lifetime");KA(I.toolchainProfile),this.scope=Object.freeze({...I.scope}),this.options=Object.freeze({...I,scope:this.scope,idleTimeoutMs:C})}this.objects=new TA(typeof I?.objectCache=="object"?I.objectCache:{}),this.debugger=new MA,this.lang=A}get cacheCompilerModule(){return this.options?.cacheCompilerModule??this.retain}get cacheStats(){return structuredClone({...this.objects.stats(),generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:this.operationId,cacheEpoch:this.generation,toolchainProfile:this.options?.toolchainProfile??"legacy",cacheEligible:this.cacheValidation?.eligible??!1,stockCertificateSha256:this.cacheValidation?.certificate,cacheEligibilitySnapshot:this.cacheValidation?.snapshot,cacheEligibilityOperationId:this.cacheValidation?.operationId,cacheEligibilityReason:this.cacheValidation?.reason,toolchainIdentityBytes:this.toolchain?.identityBytes??0,toolchainIngestions:this.toolchainIngestions,toolchainHashCount:this.toolchainHashCount,toolchainHashMs:this.toolchainHashMs,compilerModuleCloned:this.compilerModuleCloned,workerRetained:!!this.slot&&!this.active,workerRetirements:this.retirements,compilerModuleIdentityBytes:this.cacheCompilerModule?this.toolchain?.compilerBytes??0:0,latest:this.active?.stats??this.latest})}clearCaches(){this.cacheValidation=void 0,this.generation++,this.objects.clear(),this.toolchain=void 0,this.active||(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active||this.retireWorker()}stop(){return this.clearCaches(),this.cancelCurrentOperation()}cancelCurrentOperation(){if(this.cancellationDraining)return this.cancellationDraining;this.operationId++;const A=this.promise,g=this.active?.publication;this.retireWorker(),this.objects.discardBatch(),this.active&&this.finish(this.active,{type:"stopped"});const I=Promise.allSettled([A,g]).then(()=>{this.cancellationDraining===I&&(this.cancellationDraining=void 0)});return this.cancellationDraining=I,I}releaseCompilerResources(A={}){const g=A.signal;return g?.aborted?Promise.resolve("cancelled"):this.disposed?Promise.resolve("released"):new Promise(I=>{const C={resolve:I,signal:g,abort:()=>this.settleRelease(C,"cancelled")};this.releases.add(C),g?.addEventListener("abort",C.abort,{once:!0}),this.flushReleases()})}settleRelease(A,g){this.releases.delete(A)&&(A.signal?.removeEventListener("abort",A.abort),A.resolve(g))}flushReleases(){if(!(this.active||!this.releases.size||this.releaseDrain)){if(this.initializing.size){this.toolchainController?.abort();const A=[...this.initializing];this.toolchainLoading=void 0,this.releaseDrain=Promise.allSettled(A).then(()=>{this.releaseDrain=void 0,this.flushReleases()});return}this.retireWorker(),this.toolchainController?.abort(),this.toolchain=void 0,this.toolchainLoading=void 0;for(const A of this.releases)this.settleRelease(A,"released")}}dispose(){if(this.disposal)return this.disposal;this.disposed=!0,this.scopeEpoch++,this.fs={},this.binaryFiles={},this.cppArtifacts=void 0,this.hostDevice=void 0,this.stdout.removeAllListeners(),this.stderr.removeAllListeners(),this.debugger.removeAllListeners();const A=[...this.initializing];return this.toolchainController?.abort(),this.disposal=Promise.allSettled([this.stop(),...A]).then(()=>{this.latest=void 0,this.flushReleases()}),this.disposal}prepareCompiler(A){if(A?.validateCacheInputs!==void 0&&typeof A.validateCacheInputs!="boolean")return Promise.resolve(s(new TypeError("Invalid compiler preparation options")));const g=A?.validateCacheInputs===!0&&this.options?.toolchainProfile==="stock-certified-v1"&&!!this.options?.objectCache&&this.objects.limits.maxEntries>0&&this.objects.limits.maxObjectBytes>0&&this.objects.limits.maxMetadataBytes>0&&this.objects.limits.maxEntryMetadataBytes>0;return this.submit(!0,!0,g)}run(){return this.submit(!1)}compile(){return this.submit(!0)}submit(A,g=!1,I=!1){if(this.disposed)return Promise.resolve(s(new Error("Engine is disposed")));if(this.active||this.cancellationDraining)return Promise.resolve(s(new Error("An engine job is already active")));if(A&&this.lang!=="c")return Promise.resolve(s(new Error("Compile-only is supported for C/C++")));this.cacheValidation=void 0;const C=g&&!I;let B;try{const R=C||!this.cppArtifacts?null:{...this.cppArtifacts};if(R?.cacheCertificate!==void 0){const L=R.cacheCertificate;(typeof L!="string"||L.length>1024*1024||new TextEncoder().encode(L).byteLength>1024*1024)&&delete R.cacheCertificate}B={fs:C?{}:structuredClone(this.fs),binary_files:Object.fromEntries(Object.entries(C?{}:this.binaryFiles).map(([L,Z])=>[L,new Uint8Array(Z)])),cpp_artifacts:structuredClone(R)}}catch(R){return Promise.resolve(s(R))}const i=!A&&this.debugger.enabled,D=A?void 0:this.hostDevice;if(D!==void 0&&(typeof D!="function"||!["c","python"].includes(this.lang)))return Promise.resolve(s(new TypeError("Invalid host device configuration")));clearTimeout(this.idleTimer),i&&this.retireWorker(),this.stdin[U].clear();const N=!!this.slot;let y;const J=new Promise(R=>{y=R});this.promise=J;const S={generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:++this.operationId,cacheEpoch:this.generation,prepareOnly:g,validateCacheInputs:I,settled:!1,buildOnly:A,debug:i,opener:D,startedAt:performance.now(),resolve:y,stats:{operation:g?"prepare_compiler":A?"compile":"run",workerReadyMs:0,workerReused:N},start:{...B,lang:this.lang,prepare_compiler:g,validate_cache_inputs:I,scope_epoch:this.scopeEpoch,operation_id:this.operationId,cache_epoch:this.generation,is_debug:i,build_only:A,stdin_buffer:this.stdin[U].buffer,cpp_cache:this.options?.objectCache&&!i&&!g?{generation:this.generation,entries:this.objects.snapshot(),max_entry_metadata_bytes:Math.min(this.objects.limits.maxEntryMetadataBytes,this.objects.limits.maxMetadataBytes,1024*1024)}:null}};this.objects.beginBatch(),this.active=S;try{if(this.slot||this.makeWorker(),!this.current(S))return J;const R=this.slot;this.lang==="c"&&!this.toolchain&&this.ensureToolchain().catch(L=>{this.current(S)&&this.slot===R&&this.finish(S,s(L))}),this.slot.ready&&this.dispatch(S)}catch(R){this.finish(S,s(R))}return J}current(A){return this.active===A&&!A.settled}makeWorker(){const A=mA(this.wasmUrl),g={worker:A,ready:!1,remove:()=>{}};this.slot=g;const I=i=>{if(this.slot!==g)return;const D=i.data,N=this.active;if(D.type==="ready"){if(g.ready)return;g.ready=!0,N&&this.current(N)&&this.dispatch(N);return}if(!(!N||!this.current(N))){if(!g.ready&&D.type==="error"){this.finish(N,s(new Error(D.message)));return}if(!(D.operationId!==N.operationId||D.scopeEpoch!==N.scopeEpoch))try{if(D.type==="cpp_cache_eligibility"){if(this.options?.toolchainProfile!=="stock-certified-v1"||N.prepareOnly&&!N.validateCacheInputs)return;const y=S=>typeof S=="string"&&/^[0-9a-f]{64}$/.test(S),J=D.eligible===!0&&y(D.certificate_sha256)&&y(D.snapshot);this.cacheValidation={eligible:J,certificate:y(D.certificate_sha256)?D.certificate_sha256:void 0,snapshot:J?D.snapshot:void 0,operationId:N.operationId,reason:J?void 0:typeof D.reason=="string"?D.reason.slice(0,128):"stock-input-validation"}}else if(D.type==="stop")this.finish(N,{type:"completed",exitCode:D.exit_code,timing:{totalMs:performance.now()-N.startedAt,buildMs:D.build_ms,runMs:D.run_ms}});else if(D.type==="error")this.finish(N,s(new Error(D.message)));else if(D.type==="cpp_cache_object"&&D.generation===this.generation&&N.generation===this.generation)try{this.objects.stage(D)}catch{this.objects.abandonBatch()}else D.type==="cpp_cache_stats"&&D.generation===N.generation?N.stats.cache=D.stats:D.type==="cpp_cache_abandon"?this.objects.abandonBatch():D.type==="object_build_complete"?N.publication??=this.publishObjects(N,g):D.type==="compiler_module_stats"&&(N.stats.compilerModule=D)}catch(y){this.finish(N,s(y))}}},C=i=>{this.slot===g&&(this.clearCaches(),this.active?this.finish(this.active,s(i.error??new Error(i.message))):this.retireWorker())},B=()=>C({message:"Unreadable execution worker message"});this.debugger[U].attach(A),A.addEventListener("message",I),A.addEventListener("error",C),A.addEventListener("messageerror",B),g.remove=()=>{A.removeEventListener("message",I),A.removeEventListener("error",C),A.removeEventListener("messageerror",B),this.debugger[U].detach(A)}}async publishObjects(A,g){let I=!1;try{I=await this.objects.validateBatch()}catch{}if(!(!this.current(A)||this.slot!==g)){try{I&&A.cacheEpoch===this.generation?this.objects.commitBatch():(this.objects.abandonBatch(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-budget-or-validation"}))}catch{this.objects.clear(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-failure"})}this.current(A)&&g.worker.postMessage({type:"object_build_ack",scopeEpoch:A.scopeEpoch,operationId:A.operationId,cacheEpoch:A.cacheEpoch})}}ensureToolchain(){if(this.toolchain)return Promise.resolve(this.toolchain);if(this.toolchainLoading)return this.toolchainLoading;this.toolchainController=new AbortController;const A=m.load(DA("c"),this.cacheCompilerModule,this.toolchainController.signal,SA(),this.options?.toolchainProfile);return this.toolchainLoading=A,this.initializing.add(A),A.then(()=>this.initializing.delete(A),()=>{this.initializing.delete(A),this.toolchainLoading===A&&(this.toolchainLoading=void 0)}),A}async dispatch(A){const g=this.slot;if(!(!this.current(A)||!g))try{if(this.lang==="c"){const B=this.scopeEpoch,i=this.generation,D=this.ensureToolchain(),N=this.toolchain??await D;if(!this.current(A)||this.slot!==g||B!==this.scopeEpoch)return;const y=A.start.cpp_artifacts?.requiredToolchain;if(y&&!N.matchesExpectation(y)){this.finish(A,{type:"error",error:{type:"artifact-toolchain-integrity",message:"C++ artifacts require a different compiler, sysroot, or exception runtime"}});return}i===this.generation&&(this.toolchainIdentity&&this.toolchainIdentity!==N.identity&&(this.objects.clear(),A.start.cpp_cache=null),this.toolchain!==N&&(this.toolchainIngestions++,this.toolchainHashCount+=N.hashCount,this.toolchainHashMs+=N.hashMs),this.toolchainIdentity=N.identity,this.toolchain=N,this.toolchainLoading===D&&(this.toolchainLoading=void 0)),g.toolchain!==N&&(this.compilerModuleCloned=N.configure(g.worker,{type:"configure_cpp",cacheCompilerModule:this.cacheCompilerModule}),g.toolchain=N)}if(!this.current(A)||this.slot!==g)return;const I=g.worker;A.stats.workerReadyMs=performance.now()-A.startedAt;const C=B=>this.current(A)&&B.scopeEpoch===A.scopeEpoch&&B.operationId===A.operationId;if(this.stdout[U].attach(I,C),this.stderr[U].attach(I,C),A.prepareOnly||this.debugger[U].beginRun(),A.opener){if(A.device=new bA(B=>this.finish(A,s(B))),A.device.attach(I),A.device.open(A.opener),!this.current(A))return;A.start.host_device=A.device.workerStart}this.current(A)&&(I.postMessage(A.start),A.start.fs={},A.start.binary_files={},A.start.cpp_artifacts=null,A.start.cpp_cache=null)}catch(I){this.current(A)&&(this.toolchainLoading=void 0,this.finish(A,s(I)))}}finish(A,g){if(!this.current(A))return;(g.type!=="completed"||g.exitCode!==0)&&(this.cacheValidation=void 0),A.settled=!0;const I=this.slot?.worker;I&&(this.stdout[U].detach(I),this.stderr[U].detach(I));const C=A.device?.close();C&&(g=s(C));const B=g.type==="completed"&&g.exitCode===0&&!A.debug&&A.generation===this.generation&&!this.disposed;if(A.generation===this.generation)for(const i of A.stats.cache?.invalid_sources??[])this.objects.delete(i);if(B)for(const i of A.stats.cache?.hit_sources??[])this.objects.touch(i);this.objects.discardBatch(),this.latest=A.stats,this.stdin[U].clear(),(!B||!this.retain)&&this.retireWorker(),!this.disposed&&A.cacheEpoch===this.generation&&(this.slot||this.toolchain&&this.cacheCompilerModule)&&this.options?.compilerLifetime!=="project"&&(this.idleTimer=setTimeout(()=>{this.retireWorker(),this.toolchain=void 0,this.toolchainLoading=void 0},this.idleTimeoutMs)),!this.retain&&!this.cacheCompilerModule&&(this.toolchain=void 0),A.cacheEpoch!==this.generation&&(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active=void 0,this.promise=void 0,this.flushReleases(),A.resolve(g)}retireWorker(){clearTimeout(this.idleTimer);const A=this.slot;A&&(this.slot=void 0,A.remove(),this.stdout[U].detach(A.worker),this.stderr[U].detach(A.worker),A.worker.onerror=g=>g.preventDefault(),A.worker.terminate(),this.retirements++)}}class QA extends EA{constructor(A){super(),this.mode=A,this.callback=(g=>{const I=g.data;if(this.accepts&&!this.accepts(I)||I.type!=="stdout"||I.mode!==this.mode)return;const C=I.data;this.emit("data",C)}).bind(this),this[U]={attach:this.attach.bind(this),detach:this.detach.bind(this)}}callback;accepts;[U];attach(A,g){this.accepts=g,A.addEventListener("message",this.callback)}detach(A){A.removeEventListener("message",this.callback)}}class a{static BUFFER_SIZE=2048;static HEADER_SIZE=8;static DATA_SIZE=a.BUFFER_SIZE-a.HEADER_SIZE;static READ_IDX=0;static WRITE_IDX=1;static encoder=new TextEncoder;buffer=new SharedArrayBuffer(a.BUFFER_SIZE);generation=0;indices;data;[U];constructor(){this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,a.HEADER_SIZE);const A=()=>this.buffer;this[U]={clear:this.clear.bind(this),get buffer(){return A()}}}clear(){this.generation++,Atomics.notify(this.indices,a.READ_IDX),this.buffer=new SharedArrayBuffer(a.BUFFER_SIZE),this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,a.HEADER_SIZE)}async write(A){const g=typeof A=="string"?a.encoder.encode(A):A;return this.writeBytes(g)}async writeBytes(A){const{DATA_SIZE:g,READ_IDX:I,WRITE_IDX:C}=a;let B=0;const i=this.generation;for(;B<A.length&&i===this.generation;){const D=Atomics.load(this.indices,I);let N=Atomics.load(this.indices,C);N===g-1&&D>0&&(N=0);const y=D<=N?g-N-1:D-N-1;if(y===0){await Atomics.waitAsync(this.indices,I,D).value;continue}const J=Math.min(A.length-B,y);this.data.set(A.subarray(B,B+J),N),Atomics.store(this.indices,C,(N+J)%g),Atomics.notify(this.indices,C),B+=J}}}H.Artifact=GA,H.Debugger=MA,H.Engine=CA,H.HOST_DEVICE_PATH=XA,H.Stdin=a,H.Stdout=QA,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(H,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(H=typeof globalThis<"u"?globalThis:H||self,x(H.engine={}))})(this,(function(H){"use strict";var x=typeof document<"u"?document.currentScript:null;function UA(Q){return Q&&Q.__esModule&&Object.prototype.hasOwnProperty.call(Q,"default")?Q.default:Q}var X={exports:{}},BA;function JA(){if(BA)return X.exports;BA=1;var Q=typeof Reflect=="object"?Reflect:null,A=Q&&typeof Q.apply=="function"?Q.apply:function(E,o,k){return Function.prototype.apply.call(E,o,k)},g;Q&&typeof Q.ownKeys=="function"?g=Q.ownKeys:Object.getOwnPropertySymbols?g=function(E){return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E))}:g=function(E){return Object.getOwnPropertyNames(E)};function I(w){console&&console.warn&&console.warn(w)}var C=Number.isNaN||function(E){return E!==E};function B(){B.init.call(this)}X.exports=B,X.exports.once=nA,B.EventEmitter=B,B.prototype._events=void 0,B.prototype._eventsCount=0,B.prototype._maxListeners=void 0;var i=10;function D(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(B,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(w){if(typeof w!="number"||w<0||C(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");i=w}}),B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},B.prototype.setMaxListeners=function(E){if(typeof E!="number"||E<0||C(E))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+E+".");return this._maxListeners=E,this};function N(w){return w._maxListeners===void 0?B.defaultMaxListeners:w._maxListeners}B.prototype.getMaxListeners=function(){return N(this)},B.prototype.emit=function(E){for(var o=[],k=1;k<arguments.length;k++)o.push(arguments[k]);var M=E==="error",R=this._events;if(R!==void 0)M=M&&R.error===void 0;else if(!M)return!1;if(M){var F;if(o.length>0&&(F=o[0]),F instanceof Error)throw F;var q=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw q.context=F,q}var b=R[E];if(b===void 0)return!1;if(typeof b=="function")A(b,this,o);else for(var YA=b.length,vA=Z(b,YA),k=0;k<YA;++k)A(vA[k],this,o);return!0};function y(w,E,o,k){var M,R,F;if(D(o),R=w._events,R===void 0?(R=w._events=Object.create(null),w._eventsCount=0):(R.newListener!==void 0&&(w.emit("newListener",E,o.listener?o.listener:o),R=w._events),F=R[E]),F===void 0)F=R[E]=o,++w._eventsCount;else if(typeof F=="function"?F=R[E]=k?[o,F]:[F,o]:k?F.unshift(o):F.push(o),M=N(w),M>0&&F.length>M&&!F.warned){F.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(E)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=w,q.type=E,q.count=F.length,I(q)}return w}B.prototype.addListener=function(E,o){return y(this,E,o,!1)},B.prototype.on=B.prototype.addListener,B.prototype.prependListener=function(E,o){return y(this,E,o,!0)};function J(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(w,E,o){var k={fired:!1,wrapFn:void 0,target:w,type:E,listener:o},M=J.bind(k);return M.listener=o,k.wrapFn=M,M}B.prototype.once=function(E,o){return D(o),this.on(E,S(this,E,o)),this},B.prototype.prependOnceListener=function(E,o){return D(o),this.prependListener(E,S(this,E,o)),this},B.prototype.removeListener=function(E,o){var k,M,R,F,q;if(D(o),M=this._events,M===void 0)return this;if(k=M[E],k===void 0)return this;if(k===o||k.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete M[E],M.removeListener&&this.emit("removeListener",E,k.listener||o));else if(typeof k!="function"){for(R=-1,F=k.length-1;F>=0;F--)if(k[F]===o||k[F].listener===o){q=k[F].listener,R=F;break}if(R<0)return this;R===0?k.shift():t(k,R),k.length===1&&(M[E]=k[0]),M.removeListener!==void 0&&this.emit("removeListener",E,q||o)}return this},B.prototype.off=B.prototype.removeListener,B.prototype.removeAllListeners=function(E){var o,k,M;if(k=this._events,k===void 0)return this;if(k.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):k[E]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete k[E]),this;if(arguments.length===0){var R=Object.keys(k),F;for(M=0;M<R.length;++M)F=R[M],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=k[E],typeof o=="function")this.removeListener(E,o);else if(o!==void 0)for(M=o.length-1;M>=0;M--)this.removeListener(E,o[M]);return this};function Y(w,E,o){var k=w._events;if(k===void 0)return[];var M=k[E];return M===void 0?[]:typeof M=="function"?o?[M.listener||M]:[M]:o?rA(M):Z(M,M.length)}B.prototype.listeners=function(E){return Y(this,E,!0)},B.prototype.rawListeners=function(E){return Y(this,E,!1)},B.listenerCount=function(w,E){return typeof w.listenerCount=="function"?w.listenerCount(E):L.call(w,E)},B.prototype.listenerCount=L;function L(w){var E=this._events;if(E!==void 0){var o=E[w];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}B.prototype.eventNames=function(){return this._eventsCount>0?g(this._events):[]};function Z(w,E){for(var o=new Array(E),k=0;k<E;++k)o[k]=w[k];return o}function t(w,E){for(;E+1<w.length;E++)w[E]=w[E+1];w.pop()}function rA(w){for(var E=new Array(w.length),o=0;o<E.length;++o)E[o]=w[o].listener||w[o];return E}function nA(w,E){return new Promise(function(o,k){function M(F){w.removeListener(E,R),k(F)}function R(){typeof w.removeListener=="function"&&w.removeListener("error",M),o([].slice.call(arguments))}RA(w,E,R,{once:!0}),E!=="error"&&uA(w,M,{once:!0})})}function uA(w,E,o){typeof w.on=="function"&&RA(w,"error",E,o)}function RA(w,E,o,k){if(typeof w.on=="function")k.once?w.once(E,o):w.on(E,o);else if(typeof w.addEventListener=="function")w.addEventListener(E,function M(R){k.once&&w.removeEventListener(E,M),o(R)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return X.exports}var LA=JA();const EA=UA(LA);class e{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,iA.unregister(this),A}free(){const A=this.__destroy_into_raw();G.__wbg_dapadapter_free(A,0)}attach(A){G.dapadapter_attach(this.__wbg_ptr,A)}detach(){G.dapadapter_detach(this.__wbg_ptr)}constructor(){const A=G.dapadapter_new();return this.__wbg_ptr=A>>>0,iA.register(this,this.__wbg_ptr,this),this}on(A){G.dapadapter_on(this.__wbg_ptr,A)}resetRun(){G.dapadapter_resetRun(this.__wbg_ptr)}sendMessage(A){return G.dapadapter_sendMessage(this.__wbg_ptr,A)}setFilterInternals(A){G.dapadapter_setFilterInternals(this.__wbg_ptr,A)}}Symbol.dispose&&(e.prototype[Symbol.dispose]=e.prototype.free);class W{static __wrap(A){A=A>>>0;const g=Object.create(W.prototype);return g.__wbg_ptr=A,oA.register(g,g.__wbg_ptr,g),g}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,oA.unregister(this),A}free(){const A=this.__destroy_into_raw();G.__wbg_trap_free(A,0)}static __wbg_wasmer_trap(){G.trap___wbg_wasmer_trap()}}Symbol.dispose&&(W.prototype[Symbol.dispose]=W.prototype.free);function SA(){let Q,A;try{const g=G.cpp_exception_hash();return Q=g[0],A=g[1],c(g[0],g[1])}finally{G.__wbindgen_free(Q,A,1)}}function DA(Q){const A=j(Q,G.__wbindgen_malloc,G.__wbindgen_realloc),g=d,I=G.prefetch_urls(A,g);var C=NA(I[0],I[1]).slice();return G.__wbindgen_free(I[0],I[1]*4,4),C}function hA(){return{__proto__:null,"./engine_bg.js":{__proto__:null,__wbg_BigInt_b7bbccdff258c9f2:function(A){return BigInt(A)},__wbg_Error_8c4e43fe74559d73:function(A,g){return Error(c(A,g))},__wbg_Number_04624de7d0e8332d:function(A){return Number(A)},__wbg_String_8f0eb39a4a4c2f66:function(A,g){const I=String(g),C=j(I,G.__wbindgen_malloc,G.__wbindgen_realloc),B=d;h().setInt32(A+4,B,!0),h().setInt32(A+0,C,!0)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(A,g){const I=g,C=typeof I=="bigint"?I:void 0;h().setBigInt64(A+8,p(C)?BigInt(0):C,!0),h().setInt32(A+0,!p(C),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(A){const g=A,I=typeof g=="boolean"?g:void 0;return p(I)?16777215:I?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(A,g){const I=_(g),C=j(I,G.__wbindgen_malloc,G.__wbindgen_realloc),B=d;h().setInt32(A+4,B,!0),h().setInt32(A+0,C,!0)},__wbg___wbindgen_function_table_5ae7216dfcbcc506:function(){return G.__wbindgen_export},__wbg___wbindgen_in_47fa6863be6f2f25:function(A,g){return A in g},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(A){return typeof A=="bigint"},__wbg___wbindgen_is_function_0095a73b8b156f76:function(A){return typeof A=="function"},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(A){const g=A;return typeof g=="object"&&g!==null},__wbg___wbindgen_is_string_cd444516edc5b180:function(A){return typeof A=="string"},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(A){return A===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(A,g){return A===g},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(A,g){return A==g},__wbg___wbindgen_lt_bb59cc3d23526e0d:function(A,g){return A<g},__wbg___wbindgen_neg_6b4d356dff49dcc6:function(A){return-A},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(A,g){const I=g,C=typeof I=="number"?I:void 0;h().setFloat64(A+8,p(C)?0:C,!0),h().setInt32(A+0,!p(C),!0)},__wbg___wbindgen_rethrow_05525c567f154472:function(A){throw A},__wbg___wbindgen_shr_ef8e07cce709eb54:function(A,g){return A>>g},__wbg___wbindgen_string_get_72fb696202c56729:function(A,g){const I=g,C=typeof I=="string"?I:void 0;var B=p(C)?0:j(C,G.__wbindgen_malloc,G.__wbindgen_realloc),i=d;h().setInt32(A+4,i,!0),h().setInt32(A+0,B,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(A,g){throw new Error(c(A,g))},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(A){A._wbg_cb_unref()},__wbg_addEventListener_3acb0aad4483804c:function(){return K(function(A,g,I,C){A.addEventListener(c(g,I),C)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return K(function(A,g,I){return Reflect.apply(A,g,I)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return K(function(A,g,I){return A.apply(g,I)},arguments)},__wbg_arrayBuffer_bb54076166006c39:function(){return K(function(A){return A.arrayBuffer()},arguments)},__wbg_bind_1dc37de2b9939128:function(A,g,I,C){return A.bind(g,I,C)},__wbg_bind_29ba380591735d8c:function(A,g,I){return A.bind(g,I)},__wbg_buffer_7b5f53e46557d8f1:function(A){return A.buffer},__wbg_byteLength_7b03c17ff1e4037f:function(A){return A.byteLength},__wbg_byteLength_b5d783d06792ed2c:function(A){return A.byteLength},__wbg_call_389efe28435a9388:function(){return K(function(A,g){return A.call(g)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return K(function(A,g,I){return A.call(g,I)},arguments)},__wbg_compareExchange_b578410c358e695e:function(){return K(function(A,g,I,C){return Atomics.compareExchange(A,g>>>0,I,C)},arguments)},__wbg_constructor_ad6c0ed428f55d34:function(A){return A.constructor},__wbg_crypto_86f2631e91b51511:function(A){return A.crypto},__wbg_customSections_193491b069139fb1:function(A,g,I){return WebAssembly.Module.customSections(A,c(g,I))},__wbg_data_5330da50312d0bc1:function(A){return A.data},__wbg_done_57b39ecd9addfe81:function(A){return A.done},__wbg_entries_58c7934c745daac7:function(A){return Object.entries(A)},__wbg_error_7534b8e9a36f1ab4:function(A,g){let I,C;try{I=A,C=g,console.error(c(A,g))}finally{G.__wbindgen_free(I,C,1)}},__wbg_exports_794a42000dacd046:function(A){return WebAssembly.Module.exports(A)},__wbg_exports_86b4926134c40288:function(A){return A.exports},__wbg_fetch_d1488f40cef1e210:function(A,g,I){return A.fetch(c(g,I))},__wbg_from_bddd64e7d5ff6941:function(A){return Array.from(A)},__wbg_getPrototypeOf_2653517f1dc884d5:function(){return K(function(A){return Reflect.getPrototypeOf(A)},arguments)},__wbg_getRandomValues_b3f15fcbfabb0f8b:function(){return K(function(A,g){A.getRandomValues(g)},arguments)},__wbg_getTime_1e3cd1391c5c3995:function(A){return A.getTime()},__wbg_getTimezoneOffset_81776d10a4ec18a8:function(A){return A.getTimezoneOffset()},__wbg_getUint32_bb6f5a401408e7fa:function(A,g,I){return A.getUint32(g>>>0,I!==0)},__wbg_get_7efbcc3819719b0f:function(){return K(function(A,g){return A.get(g>>>0)},arguments)},__wbg_get_9b94d73e6221f75c:function(A,g){return A[g>>>0]},__wbg_get_b3ed3ad4be2bc8ac:function(){return K(function(A,g){return Reflect.get(A,g)},arguments)},__wbg_get_index_253dd2a9e007656d:function(A,g){return A[g>>>0]},__wbg_get_index_9a5bfdd2ca49c65f:function(A,g){return A[g>>>0]},__wbg_get_with_ref_key_1dc361bd10053bfe:function(A,g){return A[g]},__wbg_grow_5d42bf28c2da22cb:function(){return K(function(A,g){return A.grow(g>>>0)},arguments)},__wbg_grow_d034989fce14cc8e:function(){return K(function(A,g){return A.grow(g>>>0)},arguments)},__wbg_imports_8333d40ab24779ad:function(A){return WebAssembly.Module.imports(A)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(A){let g;try{g=A instanceof ArrayBuffer}catch{g=!1}return g},__wbg_instanceof_Error_8573fe0b0b480f46:function(A){let g;try{g=A instanceof Error}catch{g=!1}return g},__wbg_instanceof_Function_2a29eec978bb3b11:function(A){let g;try{g=A instanceof Function}catch{g=!1}return g},__wbg_instanceof_Global_2db767b6b2347f01:function(A){let g;try{g=A instanceof WebAssembly.Global}catch{g=!1}return g},__wbg_instanceof_Map_53af74335dec57f4:function(A){let g;try{g=A instanceof Map}catch{g=!1}return g},__wbg_instanceof_Memory_dc8c61e3f831ee37:function(A){let g;try{g=A instanceof WebAssembly.Memory}catch{g=!1}return g},__wbg_instanceof_Module_d0d412b14363ba9a:function(A){let g;try{g=A instanceof WebAssembly.Module}catch{g=!1}return g},__wbg_instanceof_Object_1c6af87502b733ed:function(A){let g;try{g=A instanceof Object}catch{g=!1}return g},__wbg_instanceof_RangeError_0b0dd056bc557b89:function(A){let g;try{g=A instanceof RangeError}catch{g=!1}return g},__wbg_instanceof_Response_ee1d54d79ae41977:function(A){let g;try{g=A instanceof Response}catch{g=!1}return g},__wbg_instanceof_SharedArrayBuffer_91d8a2fa16a2cc26:function(A){let g;try{g=A instanceof SharedArrayBuffer}catch{g=!1}return g},__wbg_instanceof_Table_127f216e592f4159:function(A){let g;try{g=A instanceof WebAssembly.Table}catch{g=!1}return g},__wbg_instanceof_Tag_f1d6b24a98b95210:function(A){let g;try{g=A instanceof WebAssembly.Tag}catch{g=!1}return g},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(A){let g;try{g=A instanceof Uint8Array}catch{g=!1}return g},__wbg_isArray_d314bb98fcf08331:function(A){return Array.isArray(A)},__wbg_isSafeInteger_bfbc7332a9768d2a:function(A){return Number.isSafeInteger(A)},__wbg_is_f29129f676e5410c:function(A,g){return Object.is(A,g)},__wbg_iterator_6ff6560ca1568e55:function(){return Symbol.iterator},__wbg_length_32ed9a279acd054c:function(A){return A.length},__wbg_length_35a7bace40f36eac:function(A){return A.length},__wbg_length_aeb94ff17a8a8556:function(A){return A.length},__wbg_load_eff64ff5e429a422:function(){return K(function(A,g){return Atomics.load(A,g>>>0)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(A){return A.message},__wbg_msCrypto_d562bbe83e0d4b91:function(A){return A.msCrypto},__wbg_new_0728bd2d4c5d41dd:function(){return K(function(A){return new WebAssembly.Tag(A)},arguments)},__wbg_new_0_73afc35eb544e539:function(){return new Date},__wbg_new_245cd5c49157e602:function(A){return new Date(A)},__wbg_new_2ac7fa8be584d280:function(A,g,I){return new DataView(A,g>>>0,I>>>0)},__wbg_new_361308b2356cecd0:function(){return new Object},__wbg_new_3eb36ae241fe6f44:function(){return new Array},__wbg_new_4a996a46a82782b6:function(){return K(function(A,g){return new WebAssembly.Global(A,g)},arguments)},__wbg_new_57c27ff3ddf5b62c:function(){return K(function(A){return new WebAssembly.Module(A)},arguments)},__wbg_new_67274f72d5abea37:function(){return K(function(A){return new WebAssembly.Table(A)},arguments)},__wbg_new_8a6f238a6ece86ea:function(){return new Error},__wbg_new_a4e3cab1cdd635ba:function(){return K(function(A,g){return new WebAssembly.Instance(A,g)},arguments)},__wbg_new_b061c0550d9f3281:function(){return K(function(A){return new WebAssembly.Memory(A)},arguments)},__wbg_new_b5d9e2fb389fef91:function(A,g){try{var I={a:A,b:g},C=(i,D)=>{const N=I.a;I.a=0;try{return qA(N,I.b,i,D)}finally{I.a=N}};return new Promise(C)}finally{I.a=I.b=0}},__wbg_new_ca409f861989e0c5:function(A){return new SharedArrayBuffer(A>>>0)},__wbg_new_dca287b076112a51:function(){return new Map},__wbg_new_dd2b680c8bf6ae29:function(A){return new Uint8Array(A)},__wbg_new_from_slice_a3d2629dc1826784:function(A,g){return new Uint8Array(r(A,g))},__wbg_new_no_args_1c7c842f08d00ebb:function(A,g){return new Function(c(A,g))},__wbg_new_with_args_7bba34e94b1cfa40:function(A,g,I,C){return new Function(c(A,g),c(I,C))},__wbg_new_with_byte_offset_9120ba79e057895b:function(A,g){return new Uint8Array(A,g>>>0)},__wbg_new_with_byte_offset_and_length_aa261d9c9da49eb1:function(A,g,I){return new Uint8Array(A,g>>>0,I>>>0)},__wbg_new_with_byte_offset_and_length_bc2e7b72cc96d1c1:function(A,g,I){return new Int32Array(A,g>>>0,I>>>0)},__wbg_new_with_length_1763c527b2923202:function(A){return new Array(A>>>0)},__wbg_new_with_length_a2c39cbe88fd8ff1:function(A){return new Uint8Array(A>>>0)},__wbg_next_3482f54c49e8af19:function(){return K(function(A){return A.next()},arguments)},__wbg_next_418f80d8f5303233:function(A){return A.next},__wbg_node_e1f24f89a7336c2e:function(A){return A.node},__wbg_notify_78a90977fab74963:function(){return K(function(A,g){return Atomics.notify(A,g>>>0)},arguments)},__wbg_now_a3af9a2f4bbaa4d1:function(){return Date.now()},__wbg_now_ebffdf7e580f210d:function(A){return A.now()},__wbg_ok_87f537440a0acf85:function(A){return A.ok},__wbg_postMessage_2041f4e90af61318:function(){return K(function(A,g){A.postMessage(g)},arguments)},__wbg_process_3975fd6c72f520aa:function(A){return A.process},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(A,g,I){Uint8Array.prototype.set.call(r(A,g),I)},__wbg_push_8ffdcb2063340ba5:function(A,g){return A.push(g)},__wbg_queueMicrotask_0aa0a927f78f5d98:function(A){return A.queueMicrotask},__wbg_queueMicrotask_5bb536982f78a56f:function(A){queueMicrotask(A)},__wbg_randomFillSync_f8c153b79f285817:function(){return K(function(A,g){A.randomFillSync(g)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return K(function(A,g,I,C){A.removeEventListener(c(g,I),C)},arguments)},__wbg_require_b74f47fc2d022fd6:function(){return K(function(){return module.require},arguments)},__wbg_resolve_002c4b7d9d8f6b64:function(A){return Promise.resolve(A)},__wbg_setTimeout_e0aacd5a637418a6:function(){return K(function(A,g,I){return A.setTimeout(g,I)},arguments)},__wbg_setUint32_d168af7751a8557e:function(A,g,I,C){A.setUint32(g>>>0,I>>>0,C!==0)},__wbg_set_0af2522656c2a71b:function(){return K(function(A,g,I){A.set(g>>>0,I)},arguments)},__wbg_set_1eb0999cf5d27fc8:function(A,g,I){return A.set(g,I)},__wbg_set_25cf9deff6bf0ea8:function(A,g,I){A.set(g,I>>>0)},__wbg_set_3f1d0b984ed272ed:function(A,g,I){A[g]=I},__wbg_set_6cb8631f80447a67:function(){return K(function(A,g,I){return Reflect.set(A,g,I)},arguments)},__wbg_set_cc56eefd2dd91957:function(A,g,I){A.set(r(g,I))},__wbg_set_f43e577aea94465b:function(A,g,I){A[g>>>0]=I},__wbg_set_index_b3244a6c458021e4:function(A,g,I){A[g>>>0]=I},__wbg_set_index_f259b54e97f7b177:function(A,g,I){A[g>>>0]=I},__wbg_set_onmessage_ea7cc2ba099021cd:function(A,g){A.onmessage=g},__wbg_set_value_fc06e541de098215:function(A,g){A.value=g},__wbg_slice_8bbd46adb2100583:function(A,g,I){return A.slice(g>>>0,I>>>0)},__wbg_stack_0ed75d68575b0f3c:function(A,g){const I=g.stack,C=j(I,G.__wbindgen_malloc,G.__wbindgen_realloc),B=d;h().setInt32(A+4,B,!0),h().setInt32(A+0,C,!0)},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){const A=typeof global>"u"?null:global;return p(A)?0:O(A)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){const A=typeof globalThis>"u"?null:globalThis;return p(A)?0:O(A)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){const A=typeof self>"u"?null:self;return p(A)?0:O(A)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){const A=typeof window>"u"?null:window;return p(A)?0:O(A)},__wbg_store_d1d951c98d9bed41:function(){return K(function(A,g,I){return Atomics.store(A,g>>>0,I)},arguments)},__wbg_subarray_a96e1fef17ed23cb:function(A,g,I){return A.subarray(g>>>0,I>>>0)},__wbg_then_0d9fe2c7b1857d32:function(A,g,I){return A.then(g,I)},__wbg_then_b9e7b3b5f1a9e1b5:function(A,g){return A.then(g)},__wbg_toString_56d946daff83867b:function(A,g,I){const C=g.toString(I),B=j(C,G.__wbindgen_malloc,G.__wbindgen_realloc),i=d;h().setInt32(A+4,i,!0),h().setInt32(A+0,B,!0)},__wbg_toString_964ff7fe6eca8362:function(A){return A.toString()},__wbg_trap_new:function(A){return W.__wrap(A)},__wbg_validate_71c2d02a71bda62f:function(){return K(function(A){return WebAssembly.validate(A)},arguments)},__wbg_value_0546255b415e96c1:function(A){return A.value},__wbg_value_ce37a60e576310ff:function(A){return A.value},__wbg_versions_4e31226f5e8dc909:function(A){return A.versions},__wbg_wait_be5dae1e53f590f1:function(){return K(function(A,g,I){return Atomics.wait(A,g>>>0,I)},arguments)},__wbg_warn_81ab00e6e16e886d:function(A,g,I){console.warn(A,g,I)},__wbindgen_cast_0000000000000001:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,wA)},__wbindgen_cast_0000000000000002:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,wA)},__wbindgen_cast_0000000000000003:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,HA)},__wbindgen_cast_0000000000000004:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_36932265c58943ab___JsValue____Output_______,sA)},__wbindgen_cast_0000000000000005:function(A,g){return pA(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,cA)},__wbindgen_cast_0000000000000006:function(A,g){return f(A,g,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,aA)},__wbindgen_cast_0000000000000007:function(A){return A},__wbindgen_cast_0000000000000008:function(A){return A},__wbindgen_cast_0000000000000009:function(A,g){return r(A,g)},__wbindgen_cast_000000000000000a:function(A,g){return c(A,g)},__wbindgen_cast_000000000000000b:function(A,g){return BigInt.asUintN(64,A)|BigInt.asUintN(64,g)<<BigInt(64)},__wbindgen_cast_000000000000000c:function(A){return BigInt.asUintN(64,A)},__wbindgen_cast_000000000000000d:function(A,g){var I=NA(A,g).slice();return G.__wbindgen_free(A,g*4,4),I},__wbindgen_init_externref_table:function(){const A=G.__wbindgen_externrefs,g=A.grow(4);A.set(0,void 0),A.set(g+0,void 0),A.set(g+1,null),A.set(g+2,!0),A.set(g+3,!1)}}}}function sA(Q,A,g){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,g)}function cA(Q,A,g){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent_____(Q,A,g)}function aA(Q,A,g){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent______1_(Q,A,g)}function HA(Q,A,g){const I=G.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_36932265c58943ab___JsValue__(Q,A,g);if(I[1])throw $(I[0])}function wA(Q,A,g){const I=G.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue__(Q,A,g);if(I[2])throw $(I[1]);return $(I[0])}function qA(Q,A,g,I){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue__wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,g,I)}const iA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>G.__wbg_dapadapter_free(Q>>>0,1)),oA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>G.__wbg_trap_free(Q>>>0,1));function O(Q){const A=G.__externref_table_alloc();return G.__wbindgen_externrefs.set(A,Q),A}const P=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>Q.dtor(Q.a,Q.b));function _(Q){const A=typeof Q;if(A=="number"||A=="boolean"||Q==null)return`${Q}`;if(A=="string")return`"${Q}"`;if(A=="symbol"){const C=Q.description;return C==null?"Symbol":`Symbol(${C})`}if(A=="function"){const C=Q.name;return typeof C=="string"&&C.length>0?`Function(${C})`:"Function"}if(Array.isArray(Q)){const C=Q.length;let B="[";C>0&&(B+=_(Q[0]));for(let i=1;i<C;i++)B+=", "+_(Q[i]);return B+="]",B}const g=/\[object ([^\]]+)\]/.exec(toString.call(Q));let I;if(g&&g.length>1)I=g[1];else return toString.call(Q);if(I=="Object")try{return"Object("+JSON.stringify(Q)+")"}catch{return"Object"}return Q instanceof Error?`${Q.name}: ${Q.message}
|
|
2
|
+
${Q.stack}`:I}function NA(Q,A){Q=Q>>>0;const g=h(),I=[];for(let C=Q;C<Q+4*A;C+=4)I.push(G.__wbindgen_externrefs.get(g.getUint32(C,!0)));return G.__externref_drop_slice(Q,A),I}function r(Q,A){return Q=Q>>>0,z().subarray(Q/1,Q/1+A)}let V=null;function h(){return(V===null||V.buffer.detached===!0||V.buffer.detached===void 0&&V.buffer!==G.memory.buffer)&&(V=new DataView(G.memory.buffer)),V}function c(Q,A){return Q=Q>>>0,tA(Q,A)}let T=null;function z(){return(T===null||T.byteLength===0)&&(T=new Uint8Array(G.memory.buffer)),T}function K(Q,A){try{return Q.apply(this,A)}catch(g){const I=O(g);G.__wbindgen_exn_store(I)}}function p(Q){return Q==null}function pA(Q,A,g,I){const C={a:Q,b:A,cnt:1,dtor:g},B=(...i)=>{C.cnt++;try{return I(C.a,C.b,...i)}finally{B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,P.unregister(C))},P.register(B,C,C),B}function f(Q,A,g,I){const C={a:Q,b:A,cnt:1,dtor:g},B=(...i)=>{C.cnt++;const D=C.a;C.a=0;try{return I(D,C.b,...i)}finally{C.a=D,B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,P.unregister(C))},P.register(B,C,C),B}function j(Q,A,g){if(g===void 0){const D=l.encode(Q),N=A(D.length,1)>>>0;return z().subarray(N,N+D.length).set(D),d=D.length,N}let I=Q.length,C=A(I,1)>>>0;const B=z();let i=0;for(;i<I;i++){const D=Q.charCodeAt(i);if(D>127)break;B[C+i]=D}if(i!==I){i!==0&&(Q=Q.slice(i)),C=g(C,I,I=i+Q.length*3,1)>>>0;const D=z().subarray(C+i,C+I),N=l.encodeInto(Q,D);i+=N.written,C=g(C,I,i,1)>>>0}return d=i,C}function $(Q){const A=G.__wbindgen_externrefs.get(Q);return G.__externref_table_dealloc(Q),A}let n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});n.decode();const dA=2146435072;let AA=0;function tA(Q,A){return AA+=A,AA>=dA&&(n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),n.decode(),AA=A),n.decode(z().subarray(Q,Q+A))}const l=new TextEncoder;"encodeInto"in l||(l.encodeInto=function(Q,A){const g=l.encode(Q);return A.set(g),{read:Q.length,written:g.length}});let d=0,G;function xA(Q,A){return G=Q.exports,V=null,T=null,G.__wbindgen_start(),G}async function VA(Q,A){if(typeof Response=="function"&&Q instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(Q,A)}catch(C){if(Q.ok&&g(Q.type)&&Q.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",C);else throw C}const I=await Q.arrayBuffer();return await WebAssembly.instantiate(I,A)}else{const I=await WebAssembly.instantiate(Q,A);return I instanceof WebAssembly.Instance?{instance:I,module:Q}:I}function g(I){switch(I){case"basic":case"cors":case"default":return!0}return!1}}async function jA(Q){if(G!==void 0)return G;Q!==void 0&&(Object.getPrototypeOf(Q)===Object.prototype?{module_or_path:Q}=Q:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),Q===void 0&&(Q=new URL("",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:x&&x.tagName.toUpperCase()==="SCRIPT"&&x.src||new URL("glassjar.umd.cjs",document.baseURI).href));const A=hA();(typeof Q=="string"||typeof Request=="function"&&Q instanceof Request||typeof URL=="function"&&Q instanceof URL)&&(Q=fetch(Q));const{instance:g,module:I}=await VA(await Q,A);return xA(g)}const ZA=new URL("https://cdn.jsdelivr.net/npm/glassjar@0.3.1/dist/engine_bg.wasm"),WA=Object.freeze({maxObjectBytes:128*1024*1024,maxEntries:256,maxMetadataBytes:8*1024*1024,maxEntryMetadataBytes:1024*1024});class OA{records=new Map;staged=new Map;stagingFailed=!1;objectBytes=0;metadataBytes=0;evictions=0;oversized=0;limits;constructor(A={}){this.limits=Object.freeze({...WA,...A});for(const g of Object.values(this.limits))if(!Number.isSafeInteger(g)||g<0)throw new RangeError("C++ cache limits must be nonnegative safe integers")}beginBatch(){this.discardBatch(),this.stagingFailed=!1}stage(A){if(this.stagingFailed)return;const g=this.recordSize(A);if(g===void 0||this.staged.has(A.source)){this.failBatch();return}const I=this.limits;for(;this.records.size&&(this.records.size+this.staged.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes);)this.remove(this.records.keys().next().value),this.evictions++;if(this.records.size+this.staged.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes||g>I.maxEntryMetadataBytes){this.oversized++,this.failBatch();return}this.staged.set(A.source,{...A,object:new Uint8Array(A.object),metadataBytes:g}),this.objectBytes+=A.object.byteLength,this.metadataBytes+=g}abandonBatch(){this.failBatch()}failBatch(){this.discardBatch(),this.stagingFailed=!0}recordSize(A){if(!(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(g=>!g||g==="."||g==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.key)||!/^[a-f0-9]{64}$/.test(A.object_hash)||A.receipt!=null&&typeof A.receipt!="string"||!(A.object instanceof Uint8Array)))return new TextEncoder().encode(JSON.stringify({source:A.source,key:A.key,object_hash:A.object_hash,...A.receipt==null?{}:{receipt:A.receipt}})).byteLength}async validateBatch(){if(this.stagingFailed)return!1;const A=[...this.staged.values()];for(const g of A){if(!TA(g.object))return!1;const I=await crypto.subtle.digest("SHA-256",g.object);if(Array.from(new Uint8Array(I),B=>B.toString(16).padStart(2,"0")).join("")!==g.object_hash)return!1}return!0}commitBatch(){for(const[A,g]of this.staged)this.remove(A),this.records.set(A,g);this.staged.clear(),this.stagingFailed=!1}discardBatch(){for(const A of this.staged.values())this.objectBytes-=A.object.byteLength,this.metadataBytes-=A.metadataBytes;this.staged.clear()}snapshot(){return[...this.records.values()].map(({source:A,key:g,object_hash:I,object:C,receipt:B})=>({source:A,key:g,object_hash:I,...B==null?{}:{receipt:B},object:C.slice()}))}touch(A){const g=this.records.get(A);g&&(this.records.delete(A),this.records.set(A,g))}put(A){if(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(B=>!B||B==="."||B==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.object_hash)||!/^[a-f0-9]{64}$/.test(A.key)||!(A.object instanceof Uint8Array))return;const g=this.recordSize(A);if(g===void 0)return;const I=this.limits;if(this.remove(A.source),I.maxEntries===0||A.object.byteLength>I.maxObjectBytes||g>I.maxMetadataBytes||g>I.maxEntryMetadataBytes){this.oversized++;return}for(;this.records.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes;)this.remove(this.records.keys().next().value),this.evictions++;const C={...A,object:new Uint8Array(A.object),metadataBytes:g};this.records.set(A.source,C),this.objectBytes+=C.object.byteLength,this.metadataBytes+=g}delete(A){this.remove(A)}remove(A){const g=this.records.get(A);g&&(this.objectBytes-=g.object.byteLength,this.metadataBytes-=g.metadataBytes,this.records.delete(A))}clear(){this.records.clear(),this.staged.clear(),this.stagingFailed=!1,this.objectBytes=this.metadataBytes=0}stats(){return{objectBytes:this.objectBytes,metadataBytes:this.metadataBytes,entries:this.records.size,stagingEntries:this.staged.size,stagingObjectBytes:[...this.staged.values()].reduce((A,g)=>A+g.object.byteLength,0),stagingMetadataBytes:[...this.staged.values()].reduce((A,g)=>A+g.metadataBytes,0),evictions:this.evictions,oversized:this.oversized}}}function TA(Q){if(!WebAssembly.validate(Q)||Q.length<8)return!1;let A=8,g=!1;const I=()=>{let C=0,B=0;for(let i=0;i<5&&A<Q.length;i++,B+=7){const D=Q[A++];if(C+=(D&127)*2**B,!(D&128))return C}throw new Error("Malformed object section")};try{for(;A<Q.length;){const C=Q[A++],B=I(),i=A+B;if(i>Q.length||C===8)return!1;if(C===0){const D=I();if(A+D>i)return!1;const N=new TextDecoder().decode(Q.subarray(A,A+D));if(A+=D,N==="linking"){if(g||I()!==2)return!1;g=!0}}A=i}return g}catch{return!1}}const U=Symbol();function s(Q){return Q instanceof Error?{type:"error",error:{type:Q.constructor.name,message:Q.message}}:{type:"error",error:{type:typeof Q,message:String(Q)}}}class GA{name;data;constructor(A,g){this.name=A,this.data=g}download(){const A=new Uint8Array(this.data),g=new Blob([A]),I=URL.createObjectURL(g),C=document.createElement("a");C.href=I,C.download=this.name,document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(I)}}class kA extends EA{[U];dap;enabled=!0;set filterInternals(A){this.dap.setFilterInternals(A)}constructor(){super(),this[U]={attach:this.attach.bind(this),detach:this.detach.bind(this),beginRun:()=>this.dap.resetRun()},this.onMessage=this.onMessage.bind(this),this.dap=new e,this.dap.on(this.onMessage)}send(A){return this.dap.sendMessage(A)}artifactListener=A=>{if(A.data.type!=="artifact")return;const g=new GA(A.data.name,new Uint8Array(A.data.data));this.emit("artifact",g)};attach(A){A.addEventListener("message",this.artifactListener),this.dap.attach(A)}detach(A){A.removeEventListener("message",this.artifactListener),this.dap.detach()}onMessage(A){this.emit("event",A)}}const zA="glassjar-wasm:";function fA(Q,A){const g=new URL(String(Q),A);if(g.protocol!=="https:"&&g.protocol!=="http:")throw new TypeError(`Engine Wasm must be served over http(s), not ${g.protocol}`);return g.href}function lA(Q){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/worker-BgBM-gEP.js").href:new URL("assets/worker-BgBM-gEP.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{type:"module",name:Q?.name})}function mA(Q){return new lA(Q?{name:zA+Q}:void 0)}const bA="/dev/debugger-sh-host";class MA{buffer=new SharedArrayBuffer(4+64*1024);length=new Int32Array(this.buffer,0,1);bytes=new Uint8Array(this.buffer,4);publish(A){Atomics.store(this.length,0,A),Atomics.notify(this.length,0)}}function gA(Q){try{return new Error(`Host device callback failed: ${Q instanceof Error?Q.message:String(Q)}`)}catch{return new Error("Host device callback failed")}}function FA(Q){try{const A=Q?.();if(A&&typeof A.then=="function")return Promise.resolve(A).catch(()=>{}),new TypeError("Host device cleanup must be synchronous")}catch(A){return gA(A)}}class XA{constructor(A){this.onFailure=A}incoming=new MA;outgoing=new MA;workerStart={guest_to_host:this.incoming.buffer,host_to_guest:this.outgoing.buffer};abort=new AbortController;listeners=new Set;cleanup;worker;writing=!1;open(A){let g;try{g=A({signal:this.abort.signal,onData:I=>{if(this.assertOpen(),typeof I!="function")throw new TypeError("Host device listener must be a function");return this.listeners.add(I),()=>{this.listeners.delete(I)}},write:I=>this.write(I)})}catch(I){throw gA(I)}if(g!==void 0&&typeof g!="function")throw Promise.resolve(g).catch(()=>{}),new TypeError("Host device opener must return a cleanup function or undefined");if(typeof g=="function")if(this.abort.signal.aborted){const I=FA(g);if(I)throw I}else this.cleanup=g}attach(A){this.assertOpen(),this.worker=A,A.addEventListener("message",this.onMessage)}assertOpen(){if(this.abort.signal.aborted)throw new Error("Host device is closed")}async write(A){if(this.assertOpen(),!(A instanceof Uint8Array))throw new TypeError("Host device writes require Uint8Array");if(this.writing)throw new Error("Await the previous host device write before writing again");this.writing=!0;try{const g=new Uint8Array(A),I=this.outgoing;let C=0;for(;C<g.length;){this.assertOpen();const B=Atomics.load(I.length,0);if(B!==0){await Atomics.waitAsync(I.length,0,B).value;continue}const i=g.subarray(C,C+I.bytes.length);I.bytes.set(i),I.publish(i.length),C+=i.length}}finally{this.writing=!1}}onMessage=A=>{if(!(this.abort.signal.aborted||A.data?.type!=="host_wake"))try{const g=Atomics.load(this.incoming.length,0);if(g<=0)return;const I=this.incoming.bytes.slice(0,g);this.incoming.publish(0);for(const C of this.listeners){if(this.abort.signal.aborted)break;Promise.resolve(C(I)).catch(B=>this.fail(B))}}catch(g){this.fail(g)}};fail(A){this.abort.signal.aborted||(this.close(),this.onFailure(gA(A)))}close(){if(this.abort.signal.aborted)return;this.worker?.removeEventListener("message",this.onMessage),this.worker=void 0,this.incoming.publish(-1),this.outgoing.publish(-1),this.abort.abort(),this.listeners.clear();const A=this.cleanup;return this.cleanup=void 0,FA(A)}}const PA=["4847c7cda81eb51b1cec18fe40b396605579fe84e17eca2760702b8a9666e4e1"],u=Object.freeze({compiler:"24fbed474c7b5b4968fd73fc4827440b93fb351c1b6264516130300eff3e7bf5",sysroot:"8745c6af23fd841fa507d0c73f6b6b8e8da1b4ec216a6339739a28b38ff7227b",exceptions:"20986166552953de0e3ca5c1e9f341e7aec8b9ba54dcb244d0d2b2f9ca843ab4"});function KA(Q="legacy"){if(Q==="legacy")return{profile:Q,digests:u};if(Q==="stock-certified-v1"&&PA.length>0)return{profile:Q,digests:u};throw new Error(`The ${Q} toolchain is not available in this build`)}class m{#A;hashCount=3;hashMs;constructor(A,g){this.#A=A,this.hashMs=g}static async load(A,g,I,C=u.exceptions,B="legacy"){const i=KA(B);if(A.length!==2)throw new Error("Missing C++ toolchain assets");let D;const N=await Promise.allSettled(A.map(async Z=>{try{const t=await fetch(Z,{cache:"force-cache",signal:I});if(!t.ok)throw new Error(`Cannot load C++ toolchain (${t.status})`);return new Uint8Array(await t.arrayBuffer())}catch(t){throw D??={error:t},t}}));if(N[0].status==="rejected"||N[1].status==="rejected")throw D?.error;const[y,J]=[N[0].value,N[1].value],[S,Y]=await Promise.allSettled([m.ingestOwned(y,J,!1,C),g?Promise.resolve().then(()=>WebAssembly.compile(y)):Promise.resolve(void 0)]);if(S.status==="rejected")throw S.reason;const L=S.value;if(L.#A.compilerHash!==i.digests.compiler||L.#A.sysrootHash!==i.digests.sysroot||L.#A.exceptionsHash!==i.digests.exceptions)throw new Error("C++ toolchain integrity mismatch");if(I?.aborted)throw new DOMException("Toolchain loading aborted","AbortError");if(Y.status==="rejected")throw Y.reason;return L.#A.stockProfile=i.profile==="stock-certified-v1",L.#A.module=Y.value,L}static async fromBytes(A,g,I){const C=new Uint8Array(A),B=new Uint8Array(g);return m.ingestOwned(C,B,I,u.exceptions)}static async ingestOwned(A,g,I,C){const B=performance.now(),i=await Promise.allSettled([yA(A),yA(g)]);if(i[0].status==="rejected")throw i[0].reason;if(i[1].status==="rejected")throw i[1].reason;const[D,N]=[i[0].value,i[1].value],y=I?await WebAssembly.compile(A):void 0;return new m({compiler:A,sysroot:g,compilerHash:D,sysrootHash:N,exceptionsHash:C,module:y},performance.now()-B)}matchesExpectation(A){return A.compilerSha256===this.#A.compilerHash&&A.sysrootSha256===this.#A.sysrootHash&&A.exceptionsSha256===this.#A.exceptionsHash}get identity(){return`${this.#A.compilerHash}:${this.#A.sysrootHash}:${this.#A.exceptionsHash}`}get identityBytes(){return this.#A.compiler.byteLength+this.#A.sysroot.byteLength}get compilerBytes(){return this.#A.compiler.byteLength}configure(A,g){try{return A.postMessage({...g,toolchain:this.#A}),!!this.#A.module}catch(I){if(!(I instanceof DOMException)||I.name!=="DataCloneError"||!this.#A.module)throw I;return A.postMessage({...g,toolchain:{...this.#A,module:void 0}}),!1}}}async function yA(Q){const A=await crypto.subtle.digest("SHA-256",Q);return Array.from(new Uint8Array(A),g=>g.toString(16).padStart(2,"0")).join("")}let IA,v;class CA{stdout=new QA(1);stderr=new QA(2);stdin=new a;debugger;lang;scope;fs={};binaryFiles={};cppArtifacts;hostDevice;options;retain;idleTimeoutMs;wasmUrl;objects;generation=0;scopeEpoch=0;operationId=0;disposed=!1;active;promise;slot;idleTimer;toolchain;toolchainLoading;toolchainController;initializing=new Set;toolchainIdentity;toolchainIngestions=0;toolchainHashCount=0;toolchainHashMs=0;compilerModuleCloned=!1;disposal;cancellationDraining;releaseDrain;releases=new Set;retirements=0;latest;cacheValidation;static async create(A,g={}){const{wasmUrl:I,...C}=g,B=I===void 0?void 0:fA(I,globalThis.location?.href),i=structuredClone(C),D=B??null;if(v!==void 0&&v!==D)throw new Error("The engine Wasm is already loaded from a different wasmUrl");v=D,IA??=jA({module_or_path:B??ZA}).catch(y=>{throw IA=void 0,v=void 0,y}),await IA;const N=new CA(A,i);if(N.wasmUrl=B,A!=="c"&&typeof window<"u"&&typeof fetch<"u")for(const y of DA(A))fetch(y,{cache:"force-cache"}).then(J=>J.arrayBuffer()).catch(()=>{});return N}constructor(A,g){const I=g.cpp;this.retain=g.retainWorker??I?.retainWorker??!0;const C=g.idleTimeoutMs??I?.idleTimeoutMs??3e4;if(!Number.isSafeInteger(C)||C<1||C>3e5)throw new RangeError("Worker idle timeout must be between 1 and 300000 milliseconds");if(this.idleTimeoutMs=C,I){if(A!=="c")throw new TypeError("C++ performance options require C/C++");if(!I.scope?.projectId||!I.scope.accountId)throw new TypeError("C++ performance options require project and account identity");if(I.compilerLifetime!==void 0&&!["idle","project"].includes(I.compilerLifetime))throw new TypeError("Invalid compiler lifetime");KA(I.toolchainProfile),this.scope=Object.freeze({...I.scope}),this.options=Object.freeze({...I,scope:this.scope,idleTimeoutMs:C})}this.objects=new OA(typeof I?.objectCache=="object"?I.objectCache:{}),this.debugger=new kA,this.lang=A}get cacheCompilerModule(){return this.options?.cacheCompilerModule??this.retain}get cacheStats(){return structuredClone({...this.objects.stats(),generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:this.operationId,cacheEpoch:this.generation,toolchainProfile:this.options?.toolchainProfile??"legacy",cacheEligible:this.cacheValidation?.eligible??!1,stockCertificateSha256:this.cacheValidation?.certificate,cacheEligibilitySnapshot:this.cacheValidation?.snapshot,cacheEligibilityOperationId:this.cacheValidation?.operationId,cacheEligibilityReason:this.cacheValidation?.reason,toolchainIdentityBytes:this.toolchain?.identityBytes??0,toolchainIngestions:this.toolchainIngestions,toolchainHashCount:this.toolchainHashCount,toolchainHashMs:this.toolchainHashMs,compilerModuleCloned:this.compilerModuleCloned,workerRetained:!!this.slot&&!this.active,workerRetirements:this.retirements,compilerModuleIdentityBytes:this.cacheCompilerModule?this.toolchain?.compilerBytes??0:0,latest:this.active?.stats??this.latest})}clearCaches(){this.cacheValidation=void 0,this.generation++,this.objects.clear(),this.toolchain=void 0,this.active||(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active||this.retireWorker()}stop(){return this.clearCaches(),this.cancelCurrentOperation()}cancelCurrentOperation(){if(this.cancellationDraining)return this.cancellationDraining;this.operationId++;const A=this.promise,g=this.active?.publication;this.retireWorker(),this.objects.discardBatch(),this.active&&this.finish(this.active,{type:"stopped"});const I=Promise.allSettled([A,g]).then(()=>{this.cancellationDraining===I&&(this.cancellationDraining=void 0)});return this.cancellationDraining=I,I}releaseCompilerResources(A={}){const g=A.signal;return g?.aborted?Promise.resolve("cancelled"):this.disposed?Promise.resolve("released"):new Promise(I=>{const C={resolve:I,signal:g,abort:()=>this.settleRelease(C,"cancelled")};this.releases.add(C),g?.addEventListener("abort",C.abort,{once:!0}),this.flushReleases()})}settleRelease(A,g){this.releases.delete(A)&&(A.signal?.removeEventListener("abort",A.abort),A.resolve(g))}flushReleases(){if(!(this.active||!this.releases.size||this.releaseDrain)){if(this.initializing.size){this.toolchainController?.abort();const A=[...this.initializing];this.toolchainLoading=void 0,this.releaseDrain=Promise.allSettled(A).then(()=>{this.releaseDrain=void 0,this.flushReleases()});return}this.retireWorker(),this.toolchainController?.abort(),this.toolchain=void 0,this.toolchainLoading=void 0;for(const A of this.releases)this.settleRelease(A,"released")}}dispose(){if(this.disposal)return this.disposal;this.disposed=!0,this.scopeEpoch++,this.fs={},this.binaryFiles={},this.cppArtifacts=void 0,this.hostDevice=void 0,this.stdout.removeAllListeners(),this.stderr.removeAllListeners(),this.debugger.removeAllListeners();const A=[...this.initializing];return this.toolchainController?.abort(),this.disposal=Promise.allSettled([this.stop(),...A]).then(()=>{this.latest=void 0,this.flushReleases()}),this.disposal}prepareCompiler(A){if(A?.validateCacheInputs!==void 0&&typeof A.validateCacheInputs!="boolean")return Promise.resolve(s(new TypeError("Invalid compiler preparation options")));const g=A?.validateCacheInputs===!0&&this.options?.toolchainProfile==="stock-certified-v1"&&!!this.options?.objectCache&&this.objects.limits.maxEntries>0&&this.objects.limits.maxObjectBytes>0&&this.objects.limits.maxMetadataBytes>0&&this.objects.limits.maxEntryMetadataBytes>0;return this.submit(!0,!0,g)}run(){return this.submit(!1)}compile(){return this.submit(!0)}submit(A,g=!1,I=!1){if(this.disposed)return Promise.resolve(s(new Error("Engine is disposed")));if(this.active||this.cancellationDraining)return Promise.resolve(s(new Error("An engine job is already active")));if(A&&this.lang!=="c")return Promise.resolve(s(new Error("Compile-only is supported for C/C++")));this.cacheValidation=void 0;const C=g&&!I;let B;try{const Y=C||!this.cppArtifacts?null:{...this.cppArtifacts};if(Y?.cacheCertificate!==void 0){const L=Y.cacheCertificate;(typeof L!="string"||L.length>1024*1024||new TextEncoder().encode(L).byteLength>1024*1024)&&delete Y.cacheCertificate}B={fs:C?{}:structuredClone(this.fs),binary_files:Object.fromEntries(Object.entries(C?{}:this.binaryFiles).map(([L,Z])=>[L,new Uint8Array(Z)])),cpp_artifacts:structuredClone(Y)}}catch(Y){return Promise.resolve(s(Y))}const i=!A&&this.debugger.enabled,D=A?void 0:this.hostDevice;if(D!==void 0&&(typeof D!="function"||!["c","python"].includes(this.lang)))return Promise.resolve(s(new TypeError("Invalid host device configuration")));clearTimeout(this.idleTimer),i&&this.retireWorker(),this.stdin[U].clear();const N=!!this.slot;let y;const J=new Promise(Y=>{y=Y});this.promise=J;const S={generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:++this.operationId,cacheEpoch:this.generation,prepareOnly:g,validateCacheInputs:I,settled:!1,buildOnly:A,debug:i,opener:D,startedAt:performance.now(),resolve:y,stats:{operation:g?"prepare_compiler":A?"compile":"run",workerReadyMs:0,workerReused:N},start:{...B,lang:this.lang,prepare_compiler:g,validate_cache_inputs:I,scope_epoch:this.scopeEpoch,operation_id:this.operationId,cache_epoch:this.generation,is_debug:i,build_only:A,stdin_buffer:this.stdin[U].buffer,cpp_cache:this.options?.objectCache&&!i&&!g?{generation:this.generation,entries:this.objects.snapshot(),max_entry_metadata_bytes:Math.min(this.objects.limits.maxEntryMetadataBytes,this.objects.limits.maxMetadataBytes,1024*1024)}:null}};this.objects.beginBatch(),this.active=S;try{if(this.slot||this.makeWorker(),!this.current(S))return J;const Y=this.slot;this.lang==="c"&&!this.toolchain&&this.ensureToolchain().catch(L=>{this.current(S)&&this.slot===Y&&this.finish(S,s(L))}),this.slot.ready&&this.dispatch(S)}catch(Y){this.finish(S,s(Y))}return J}current(A){return this.active===A&&!A.settled}makeWorker(){const A=mA(this.wasmUrl),g={worker:A,ready:!1,remove:()=>{}};this.slot=g;const I=i=>{if(this.slot!==g)return;const D=i.data,N=this.active;if(D.type==="ready"){if(g.ready)return;g.ready=!0,N&&this.current(N)&&this.dispatch(N);return}if(!(!N||!this.current(N))){if(!g.ready&&D.type==="error"){this.finish(N,s(new Error(D.message)));return}if(!(D.operationId!==N.operationId||D.scopeEpoch!==N.scopeEpoch))try{if(D.type==="cpp_cache_eligibility"){if(this.options?.toolchainProfile!=="stock-certified-v1"||N.prepareOnly&&!N.validateCacheInputs)return;const y=S=>typeof S=="string"&&/^[0-9a-f]{64}$/.test(S),J=D.eligible===!0&&y(D.certificate_sha256)&&y(D.snapshot);this.cacheValidation={eligible:J,certificate:y(D.certificate_sha256)?D.certificate_sha256:void 0,snapshot:J?D.snapshot:void 0,operationId:N.operationId,reason:J?void 0:typeof D.reason=="string"?D.reason.slice(0,128):"stock-input-validation"}}else if(D.type==="stop")this.finish(N,{type:"completed",exitCode:D.exit_code,timing:{totalMs:performance.now()-N.startedAt,buildMs:D.build_ms,runMs:D.run_ms}});else if(D.type==="error")this.finish(N,s(new Error(D.message)));else if(D.type==="cpp_cache_object"&&D.generation===this.generation&&N.generation===this.generation)try{this.objects.stage(D)}catch{this.objects.abandonBatch()}else D.type==="cpp_cache_stats"&&D.generation===N.generation?N.stats.cache=D.stats:D.type==="cpp_cache_abandon"?this.objects.abandonBatch():D.type==="object_build_complete"?N.publication??=this.publishObjects(N,g):D.type==="compiler_module_stats"&&(N.stats.compilerModule=D)}catch(y){this.finish(N,s(y))}}},C=i=>{this.slot===g&&(this.clearCaches(),this.active?this.finish(this.active,s(i.error??new Error(i.message))):this.retireWorker())},B=()=>C({message:"Unreadable execution worker message"});this.debugger[U].attach(A),A.addEventListener("message",I),A.addEventListener("error",C),A.addEventListener("messageerror",B),g.remove=()=>{A.removeEventListener("message",I),A.removeEventListener("error",C),A.removeEventListener("messageerror",B),this.debugger[U].detach(A)}}async publishObjects(A,g){let I=!1;try{I=await this.objects.validateBatch()}catch{}if(!(!this.current(A)||this.slot!==g)){try{I&&A.cacheEpoch===this.generation?this.objects.commitBatch():(this.objects.abandonBatch(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-budget-or-validation"}))}catch{this.objects.clear(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-failure"})}this.current(A)&&g.worker.postMessage({type:"object_build_ack",scopeEpoch:A.scopeEpoch,operationId:A.operationId,cacheEpoch:A.cacheEpoch})}}ensureToolchain(){if(this.toolchain)return Promise.resolve(this.toolchain);if(this.toolchainLoading)return this.toolchainLoading;this.toolchainController=new AbortController;const A=m.load(DA("c"),this.cacheCompilerModule,this.toolchainController.signal,SA(),this.options?.toolchainProfile);return this.toolchainLoading=A,this.initializing.add(A),A.then(()=>this.initializing.delete(A),()=>{this.initializing.delete(A),this.toolchainLoading===A&&(this.toolchainLoading=void 0)}),A}async dispatch(A){const g=this.slot;if(!(!this.current(A)||!g))try{if(this.lang==="c"){const B=this.scopeEpoch,i=this.generation,D=this.ensureToolchain(),N=this.toolchain??await D;if(!this.current(A)||this.slot!==g||B!==this.scopeEpoch)return;const y=A.start.cpp_artifacts?.requiredToolchain;if(y&&!N.matchesExpectation(y)){this.finish(A,{type:"error",error:{type:"artifact-toolchain-integrity",message:"C++ artifacts require a different compiler, sysroot, or exception runtime"}});return}i===this.generation&&(this.toolchainIdentity&&this.toolchainIdentity!==N.identity&&(this.objects.clear(),A.start.cpp_cache=null),this.toolchain!==N&&(this.toolchainIngestions++,this.toolchainHashCount+=N.hashCount,this.toolchainHashMs+=N.hashMs),this.toolchainIdentity=N.identity,this.toolchain=N,this.toolchainLoading===D&&(this.toolchainLoading=void 0)),g.toolchain!==N&&(this.compilerModuleCloned=N.configure(g.worker,{type:"configure_cpp",cacheCompilerModule:this.cacheCompilerModule}),g.toolchain=N)}if(!this.current(A)||this.slot!==g)return;const I=g.worker;A.stats.workerReadyMs=performance.now()-A.startedAt;const C=B=>this.current(A)&&B.scopeEpoch===A.scopeEpoch&&B.operationId===A.operationId;if(this.stdout[U].attach(I,C),this.stderr[U].attach(I,C),A.prepareOnly||this.debugger[U].beginRun(),A.opener){if(A.device=new XA(B=>this.finish(A,s(B))),A.device.attach(I),A.device.open(A.opener),!this.current(A))return;A.start.host_device=A.device.workerStart}this.current(A)&&(I.postMessage(A.start),A.start.fs={},A.start.binary_files={},A.start.cpp_artifacts=null,A.start.cpp_cache=null)}catch(I){this.current(A)&&(this.toolchainLoading=void 0,this.finish(A,s(I)))}}finish(A,g){if(!this.current(A))return;(g.type!=="completed"||g.exitCode!==0)&&(this.cacheValidation=void 0),A.settled=!0;const I=this.slot?.worker;I&&(this.stdout[U].detach(I),this.stderr[U].detach(I));const C=A.device?.close();C&&(g=s(C));const B=g.type==="completed"&&g.exitCode===0&&!A.debug&&A.generation===this.generation&&!this.disposed;if(A.generation===this.generation)for(const i of A.stats.cache?.invalid_sources??[])this.objects.delete(i);if(B)for(const i of A.stats.cache?.hit_sources??[])this.objects.touch(i);this.objects.discardBatch(),this.latest=A.stats,this.stdin[U].clear(),(!B||!this.retain)&&this.retireWorker(),!this.disposed&&A.cacheEpoch===this.generation&&(this.slot||this.toolchain&&this.cacheCompilerModule)&&this.options?.compilerLifetime!=="project"&&(this.idleTimer=setTimeout(()=>{this.retireWorker(),this.toolchain=void 0,this.toolchainLoading=void 0},this.idleTimeoutMs)),!this.retain&&!this.cacheCompilerModule&&(this.toolchain=void 0),A.cacheEpoch!==this.generation&&(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active=void 0,this.promise=void 0,this.flushReleases(),A.resolve(g)}retireWorker(){clearTimeout(this.idleTimer);const A=this.slot;A&&(this.slot=void 0,A.remove(),this.stdout[U].detach(A.worker),this.stderr[U].detach(A.worker),A.worker.onerror=g=>g.preventDefault(),A.worker.terminate(),this.retirements++)}}class QA extends EA{constructor(A){super(),this.mode=A,this.callback=(g=>{const I=g.data;if(this.accepts&&!this.accepts(I)||I.type!=="stdout"||I.mode!==this.mode)return;const C=I.data;this.emit("data",C)}).bind(this),this[U]={attach:this.attach.bind(this),detach:this.detach.bind(this)}}callback;accepts;[U];attach(A,g){this.accepts=g,A.addEventListener("message",this.callback)}detach(A){A.removeEventListener("message",this.callback)}}class a{static BUFFER_SIZE=2048;static HEADER_SIZE=8;static DATA_SIZE=a.BUFFER_SIZE-a.HEADER_SIZE;static READ_IDX=0;static WRITE_IDX=1;static encoder=new TextEncoder;buffer=new SharedArrayBuffer(a.BUFFER_SIZE);generation=0;indices;data;[U];constructor(){this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,a.HEADER_SIZE);const A=()=>this.buffer;this[U]={clear:this.clear.bind(this),get buffer(){return A()}}}clear(){this.generation++,Atomics.notify(this.indices,a.READ_IDX),this.buffer=new SharedArrayBuffer(a.BUFFER_SIZE),this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,a.HEADER_SIZE)}async write(A){const g=typeof A=="string"?a.encoder.encode(A):A;return this.writeBytes(g)}async writeBytes(A){const{DATA_SIZE:g,READ_IDX:I,WRITE_IDX:C}=a;let B=0;const i=this.generation;for(;B<A.length&&i===this.generation;){const D=Atomics.load(this.indices,I);let N=Atomics.load(this.indices,C);N===g-1&&D>0&&(N=0);const y=D<=N?g-N-1:D-N-1;if(y===0){await Atomics.waitAsync(this.indices,I,D).value;continue}const J=Math.min(A.length-B,y);this.data.set(A.subarray(B,B+J),N),Atomics.store(this.indices,C,(N+J)%g),Atomics.notify(this.indices,C),B+=J}}}H.Artifact=GA,H.Debugger=kA,H.Engine=CA,H.HOST_DEVICE_PATH=bA,H.Stdin=a,H.Stdout=QA,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
|