UNPKG

@easyflow/pixel

Version:

Easyflow client-side pixel SDK

1,110 lines 123 kB
var Ci = Object.defineProperty; var Ri = (e, n, t) => n in e ? Ci(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t; var C = (e, n, t) => Ri(e, typeof n != "symbol" ? n + "" : n, t); var O = /* @__PURE__ */ ((e) => (e.CHECKOUT_INITIALIZED = "checkout-initialized", e.PURCHASE_COMPLETED = "purchase-completed", e.PURCHASE_FAILED = "purchase-failed", e.PURCHASE_BTN_CLICKED = "purchase-btn-clicked", e.PIX_SELECTED = "pix-selected", e.PIX_GENERATED = "pix-generated", e.PIX_EXPIRED = "pix-expired", e.PIX_COPIED = "pix-copied", e.CREDIT_CARD_SELECTED = "credit-card-selected", e.CREDIT_CARD_FORM_COMPLETED = "credit-card-form-completed", e.BANK_BILLET_SELECTED = "bank-slip-selected", e.BANK_BILLET_GENERATED = "bank-slip-form-completed", e.ADDRESS_FORM_COMPLETED = "address-form-completed", e.DELIVERY_ADDRESS_COMPLETED = "delivery-address-completed", e.COUPON_ADDED = "coupon-added", e.COUPON_BOX_CLICKED = "coupon-box-clicked", e.COUPON_FORM_COMPLETED = "coupon-form-completed", e.COUPON_APPLY_FAILED = "coupon-apply-failed", e.USER_FORM_COMPLETED = "user-form-completed", e.PRE_CHECKOUT_FORM_COMPLETED = "pre-checkout-form-completed", e.CREDIT_CARD_FORM_INIT = "credit-card-form-init", e.COUPON_FORM_INIT = "coupon-form-init", e.USER_FORM_INIT = "user-form-init", e.PRE_CHECKOUT_FORM_INIT = "pre-checkout-form-init", e.CUSTOM_EVENT = "custom-event", e))(O || {}); const oe = { UTM: "__easyflow_utms", SESSION_ID: "__easyflow_session_id", FINGERPRINT_ID: "__easyflow_fingerprint_id", EXTRAS_ID: "__easyflow_extras" }; function Ni(e) { localStorage.setItem(oe.FINGERPRINT_ID, e); } function zi() { try { return localStorage.getItem(oe.FINGERPRINT_ID); } catch { return null; } } function Li() { const e = performance.timing, n = {}; for (const t in e) { const i = e[t]; typeof i == "number" && (n[t] = i); } return n; } function Mi() { return new Promise((e) => { const n = window.webkitRequestFileSystem; if (!n) return e(!1); n( window.TEMPORARY, 100, () => e(!1), () => e(!0) ); }); } function Fi() { return new Promise((e) => { const n = document.createElement("div"); n.className = "adsbox", n.style.height = "1px", document.body.appendChild(n), setTimeout(() => { const t = n.offsetHeight === 0; document.body.removeChild(n), e(t); }, 100); }); } async function Pi() { try { const [e, n] = await Promise.all([ Mi(), Fi() ]), t = { cookiesEnabled: navigator.cookieEnabled, doNotTrackEnable: navigator.doNotTrack === "1" || window.doNotTrack === "1", incognitoMode: e, adblockDetected: n }; localStorage.setItem(oe.EXTRAS_ID, JSON.stringify(t)); } catch (e) { console.error("Error saving extras to localStorage", e); } } function Ui() { const e = localStorage.getItem(oe.EXTRAS_ID); return e ? JSON.parse(e) : {}; } function $i() { var t; const e = new URLSearchParams(window.location.search), n = (i) => { const a = document.cookie.match(new RegExp("(^| )" + i + "=([^;]+)")); return a ? a[2] : void 0; }; return { session_id: localStorage.getItem(oe.SESSION_ID) || void 0, fingerprint_id: zi() || void 0, fbp: n("_fbp"), fbc: n("_fbc"), gclid: e.get("gclid"), ttclid: e.get("ttclid"), user_agent: navigator.userAgent, language: navigator.language, platform: navigator.platform, screen_resolution: `${window.screen.width}x${window.screen.height}`, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, current_url: window.location.href, referer: document.referrer, document_title: document.title, cookies_enabled: navigator.cookieEnabled, hardware_concurrency: navigator.hardwareConcurrency, device_memory: navigator.deviceMemory, touch_support: "ontouchstart" in window || navigator.maxTouchPoints > 0, timestamp_client: (/* @__PURE__ */ new Date()).toISOString(), page_visibility: document.visibilityState, load_time_ms: (t = performance.timing) != null && t.loadEventEnd ? performance.timing.loadEventEnd - performance.timing.navigationStart : void 0 }; } const Zi = [ "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content" ]; function Hi() { try { const e = localStorage.getItem(oe.UTM); return e ? JSON.parse(e) : {}; } catch { return {}; } } function Bi() { const e = new URLSearchParams(window.location.search); if (!localStorage.getItem(oe.UTM)) { const t = {}; Zi.forEach((i) => { const a = e.get(i); a && (t[i] = a); }), Object.keys(t).length > 0 && localStorage.setItem(oe.UTM, JSON.stringify(t)); } } function qt(e) { if (window.fbq) return; (function(t, i, a, r) { var o; if (t.fbq) return; const l = t.fbq = function() { l.callMethod ? l.callMethod.apply(l, arguments) : l.queue.push(arguments); }; t._fbq || (t._fbq = l), l.push = l, l.loaded = !0, l.version = "2.0", l.queue = []; const s = i.createElement(a); s.async = !0, s.src = r; const d = i.getElementsByTagName(a)[0]; (o = d.parentNode) == null || o.insertBefore(s, d); })( window, document, "script", "https://connect.facebook.net/en_US/fbevents.js" ); const n = setInterval(() => { typeof window.fbq == "function" && (e.map((t) => t.code).forEach((t) => { window.fbq("init", t), window.fbq("trackSingle", t, "PageView"); }), clearInterval(n)); }, 500); } const Ki = /* @__PURE__ */ new Set([ "Purchase", "InitiateCheckout", "AddPaymentInfo", "AddToCart", "ViewContent", "Lead", "CompleteRegistration", "PageView" ]); async function qi(e, n, t) { if (!e || typeof window.fbq != "function") return; const i = (n == null ? void 0 : n.idempotencyId) || (n == null ? void 0 : n.event_id), a = { ...e.data, ...n, ...i && { event_id: i } }, l = Ki.has(e.event) ? "track" : "trackCustom"; t != null && t.code ? window.fbq("trackSingle", t.code, e.event, a || {}) : window.fbq(l, e.event, a || {}); } let Gt = !1; function xt(e) { return !e || /^AW-/.test(e) || /^G-/.test(e) ? e : /^[0-9]+$/.test(e) ? `AW-${e}` : e; } async function jt(e) { var n; if (e != null && e.length) { if (!Gt) { const t = document.createElement("script"); t.async = !0; const i = xt(e[0].code); t.src = `https://www.googletagmanager.com/gtag/js?id=${i}`, document.head.appendChild(t), window.dataLayer = window.dataLayer || [], window.gtag = function() { window.dataLayer.push(arguments); }, window.gtag("js", /* @__PURE__ */ new Date()), Gt = !0; } for (const t of e) { const i = xt(t.code), a = (n = t.metadata) == null ? void 0 : n["conversion-label"]; /^AW-/.test(i) || /^[0-9]+$/.test(t.code), window.gtag("config", i, { send_page_view: !0, conversion_linker: !0, ...a && { conversion_label: a } }); } } } async function Gi(e, n, t) { var l, s; if (!e || typeof window.gtag != "function") return; const i = (n == null ? void 0 : n.idempotencyId) || (n == null ? void 0 : n.event_id); if (!!(t && ((l = t.metadata) != null && l["conversion-label"] || /^AW-/.test(t.code) || /^[0-9]+$/.test(t.code)))) { const d = xt(t.code), o = (s = t.metadata) == null ? void 0 : s["conversion-label"]; if (!o) return; const c = `${d}/${o}`, w = n == null ? void 0 : n.value, h = n == null ? void 0 : n.currency, f = { send_to: c, ...typeof w == "number" && { value: w }, ...h && { currency: h }, ...i && { event_id: i } }; window.gtag("event", "conversion", f); return; } const r = { ...e.data || {}, ...n || {}, ...i && { event_id: i } }; window.gtag("event", e.event, r || {}); } let Yt = !1; const kt = []; function Xt(e) { if (e != null && e.length) { Yt || (function(n, t, i) { n.TiktokAnalyticsObject = i; const a = n[i] = n[i] || []; a.methods = [ "page", "track", "identify", "instances", "debug", "on", "off", "once", "ready", "alias", "group", "enableCookie", "disableCookie", "load", "instance" ], a.setAndDefer = function(r, l) { r[l] = function() { Array.isArray(r) && r.push([l].concat(Array.prototype.slice.call(arguments, 0))); }; }; for (let r = 0; r < a.methods.length; r++) a.setAndDefer(a, a.methods[r]); a.load = function(r, l) { var c; const s = "https://analytics.tiktok.com/i18n/pixel/events.js"; a._i = a._i || {}, a._i[r] = [], a._i[r]._u = s, a._t = a._t || {}, a._t[r] = +/* @__PURE__ */ new Date(), a._o = a._o || {}, a._o[r] = l || {}; const d = t.createElement("script"); d.type = "text/javascript", d.async = !0, d.src = `${s}?sdkid=${r}&lib=${i}`; const o = t.getElementsByTagName("script")[0]; (c = o.parentNode) == null || c.insertBefore(d, o); }; }(window, document, "ttq"), Yt = !0); for (const n of e) { const t = n.code; kt.includes(t) || (window.ttq.load(t), window.ttq.page(), kt.push(t)); } } } async function ji(e, n, t) { var i, a, r, l; if (!(!e || typeof window.ttq != "object")) if (t != null && t.code) { const s = window.ttq.instance(t.code); if (s) { const d = (n == null ? void 0 : n.idempotencyId) || (n == null ? void 0 : n.event_id), o = { ...e == null ? void 0 : e.data, ...n, ...d && { event_id: d, content_id: d, email: (n == null ? void 0 : n.email) || ((i = n == null ? void 0 : n.buyer) == null ? void 0 : i.email), currency: "BRL", value: ((a = n == null ? void 0 : n.order) == null ? void 0 : a.totalValue) && parseFloat(n.order.totalValue.split(",")[0].replaceAll(".", "")) || 0 } }; s.track(e == null ? void 0 : e.event, o || {}); } else console.warn( `[EasyflowPixel][TikTok] instância não encontrada para pixel: ${t.code}` ); } else for (const s of kt) { const d = window.ttq.instance(s); if (d) { const o = (n == null ? void 0 : n.idempotencyId) || (n == null ? void 0 : n.event_id), c = { ...e == null ? void 0 : e.data, ...n, ...o && { event_id: o, content_id: o, email: (n == null ? void 0 : n.email) || ((r = n == null ? void 0 : n.buyer) == null ? void 0 : r.email), currency: "BRL", value: ((l = n == null ? void 0 : n.order) == null ? void 0 : l.totalValue) && parseFloat(n.order.totalValue.split(",")[0].replaceAll(".", "")) || 0 } }; d.track(e == null ? void 0 : e.event, c || {}); } } } var k = /* @__PURE__ */ ((e) => (e.META = "meta", e.GOOGLE = "google", e.TIKTOK = "tiktok", e.GTM = "gtm", e.EASYFLOW = "easyflow", e))(k || {}), Bn = /* @__PURE__ */ ((e) => (e.meta = "fbq", e.google = "gtag", e.tiktok = "ttq", e.easyflow = "efp", e.gtm = "gtm", e))(Bn || {}); /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */ const Yi = 4, Vt = 0, Wt = 1, Xi = 2; function ve(e) { let n = e.length; for (; --n >= 0; ) e[n] = 0; } const Vi = 0, Kn = 1, Wi = 2, Ji = 3, Qi = 258, Pt = 29, Pe = 256, Oe = Pe + 1 + Pt, pe = 30, Ut = 19, qn = 2 * Oe + 1, le = 15, st = 16, ea = 7, $t = 256, Gn = 16, jn = 17, Yn = 18, yt = ( /* extra bits for each length code */ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]) ), Je = ( /* extra bits for each distance code */ new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) ), ta = ( /* extra bits for each bit length code */ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]) ), Xn = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), na = 512, J = new Array((Oe + 2) * 2); ve(J); const Ae = new Array(pe * 2); ve(Ae); const Ce = new Array(na); ve(Ce); const Re = new Array(Qi - Ji + 1); ve(Re); const Zt = new Array(Pt); ve(Zt); const Qe = new Array(pe); ve(Qe); function lt(e, n, t, i, a) { this.static_tree = e, this.extra_bits = n, this.extra_base = t, this.elems = i, this.max_length = a, this.has_stree = e && e.length; } let Vn, Wn, Jn; function ct(e, n) { this.dyn_tree = e, this.max_code = 0, this.stat_desc = n; } const Qn = (e) => e < 256 ? Ce[e] : Ce[256 + (e >>> 7)], Ne = (e, n) => { e.pending_buf[e.pending++] = n & 255, e.pending_buf[e.pending++] = n >>> 8 & 255; }, $ = (e, n, t) => { e.bi_valid > st - t ? (e.bi_buf |= n << e.bi_valid & 65535, Ne(e, e.bi_buf), e.bi_buf = n >> st - e.bi_valid, e.bi_valid += t - st) : (e.bi_buf |= n << e.bi_valid & 65535, e.bi_valid += t); }, Y = (e, n, t) => { $( e, t[n * 2], t[n * 2 + 1] /*.Len*/ ); }, ei = (e, n) => { let t = 0; do t |= e & 1, e >>>= 1, t <<= 1; while (--n > 0); return t >>> 1; }, ia = (e) => { e.bi_valid === 16 ? (Ne(e, e.bi_buf), e.bi_buf = 0, e.bi_valid = 0) : e.bi_valid >= 8 && (e.pending_buf[e.pending++] = e.bi_buf & 255, e.bi_buf >>= 8, e.bi_valid -= 8); }, aa = (e, n) => { const t = n.dyn_tree, i = n.max_code, a = n.stat_desc.static_tree, r = n.stat_desc.has_stree, l = n.stat_desc.extra_bits, s = n.stat_desc.extra_base, d = n.stat_desc.max_length; let o, c, w, h, f, m, S = 0; for (h = 0; h <= le; h++) e.bl_count[h] = 0; for (t[e.heap[e.heap_max] * 2 + 1] = 0, o = e.heap_max + 1; o < qn; o++) c = e.heap[o], h = t[t[c * 2 + 1] * 2 + 1] + 1, h > d && (h = d, S++), t[c * 2 + 1] = h, !(c > i) && (e.bl_count[h]++, f = 0, c >= s && (f = l[c - s]), m = t[c * 2], e.opt_len += m * (h + f), r && (e.static_len += m * (a[c * 2 + 1] + f))); if (S !== 0) { do { for (h = d - 1; e.bl_count[h] === 0; ) h--; e.bl_count[h]--, e.bl_count[h + 1] += 2, e.bl_count[d]--, S -= 2; } while (S > 0); for (h = d; h !== 0; h--) for (c = e.bl_count[h]; c !== 0; ) w = e.heap[--o], !(w > i) && (t[w * 2 + 1] !== h && (e.opt_len += (h - t[w * 2 + 1]) * t[w * 2], t[w * 2 + 1] = h), c--); } }, ti = (e, n, t) => { const i = new Array(le + 1); let a = 0, r, l; for (r = 1; r <= le; r++) a = a + t[r - 1] << 1, i[r] = a; for (l = 0; l <= n; l++) { let s = e[l * 2 + 1]; s !== 0 && (e[l * 2] = ei(i[s]++, s)); } }, ra = () => { let e, n, t, i, a; const r = new Array(le + 1); for (t = 0, i = 0; i < Pt - 1; i++) for (Zt[i] = t, e = 0; e < 1 << yt[i]; e++) Re[t++] = i; for (Re[t - 1] = i, a = 0, i = 0; i < 16; i++) for (Qe[i] = a, e = 0; e < 1 << Je[i]; e++) Ce[a++] = i; for (a >>= 7; i < pe; i++) for (Qe[i] = a << 7, e = 0; e < 1 << Je[i] - 7; e++) Ce[256 + a++] = i; for (n = 0; n <= le; n++) r[n] = 0; for (e = 0; e <= 143; ) J[e * 2 + 1] = 8, e++, r[8]++; for (; e <= 255; ) J[e * 2 + 1] = 9, e++, r[9]++; for (; e <= 279; ) J[e * 2 + 1] = 7, e++, r[7]++; for (; e <= 287; ) J[e * 2 + 1] = 8, e++, r[8]++; for (ti(J, Oe + 1, r), e = 0; e < pe; e++) Ae[e * 2 + 1] = 5, Ae[e * 2] = ei(e, 5); Vn = new lt(J, yt, Pe + 1, Oe, le), Wn = new lt(Ae, Je, 0, pe, le), Jn = new lt(new Array(0), ta, 0, Ut, ea); }, ni = (e) => { let n; for (n = 0; n < Oe; n++) e.dyn_ltree[n * 2] = 0; for (n = 0; n < pe; n++) e.dyn_dtree[n * 2] = 0; for (n = 0; n < Ut; n++) e.bl_tree[n * 2] = 0; e.dyn_ltree[$t * 2] = 1, e.opt_len = e.static_len = 0, e.sym_next = e.matches = 0; }, ii = (e) => { e.bi_valid > 8 ? Ne(e, e.bi_buf) : e.bi_valid > 0 && (e.pending_buf[e.pending++] = e.bi_buf), e.bi_buf = 0, e.bi_valid = 0; }, Jt = (e, n, t, i) => { const a = n * 2, r = t * 2; return e[a] < e[r] || e[a] === e[r] && i[n] <= i[t]; }, ft = (e, n, t) => { const i = e.heap[t]; let a = t << 1; for (; a <= e.heap_len && (a < e.heap_len && Jt(n, e.heap[a + 1], e.heap[a], e.depth) && a++, !Jt(n, i, e.heap[a], e.depth)); ) e.heap[t] = e.heap[a], t = a, a <<= 1; e.heap[t] = i; }, Qt = (e, n, t) => { let i, a, r = 0, l, s; if (e.sym_next !== 0) do i = e.pending_buf[e.sym_buf + r++] & 255, i += (e.pending_buf[e.sym_buf + r++] & 255) << 8, a = e.pending_buf[e.sym_buf + r++], i === 0 ? Y(e, a, n) : (l = Re[a], Y(e, l + Pe + 1, n), s = yt[l], s !== 0 && (a -= Zt[l], $(e, a, s)), i--, l = Qn(i), Y(e, l, t), s = Je[l], s !== 0 && (i -= Qe[l], $(e, i, s))); while (r < e.sym_next); Y(e, $t, n); }, Tt = (e, n) => { const t = n.dyn_tree, i = n.stat_desc.static_tree, a = n.stat_desc.has_stree, r = n.stat_desc.elems; let l, s, d = -1, o; for (e.heap_len = 0, e.heap_max = qn, l = 0; l < r; l++) t[l * 2] !== 0 ? (e.heap[++e.heap_len] = d = l, e.depth[l] = 0) : t[l * 2 + 1] = 0; for (; e.heap_len < 2; ) o = e.heap[++e.heap_len] = d < 2 ? ++d : 0, t[o * 2] = 1, e.depth[o] = 0, e.opt_len--, a && (e.static_len -= i[o * 2 + 1]); for (n.max_code = d, l = e.heap_len >> 1; l >= 1; l--) ft(e, t, l); o = r; do l = e.heap[ 1 /*SMALLEST*/ ], e.heap[ 1 /*SMALLEST*/ ] = e.heap[e.heap_len--], ft( e, t, 1 /*SMALLEST*/ ), s = e.heap[ 1 /*SMALLEST*/ ], e.heap[--e.heap_max] = l, e.heap[--e.heap_max] = s, t[o * 2] = t[l * 2] + t[s * 2], e.depth[o] = (e.depth[l] >= e.depth[s] ? e.depth[l] : e.depth[s]) + 1, t[l * 2 + 1] = t[s * 2 + 1] = o, e.heap[ 1 /*SMALLEST*/ ] = o++, ft( e, t, 1 /*SMALLEST*/ ); while (e.heap_len >= 2); e.heap[--e.heap_max] = e.heap[ 1 /*SMALLEST*/ ], aa(e, n), ti(t, d, e.bl_count); }, en = (e, n, t) => { let i, a = -1, r, l = n[0 * 2 + 1], s = 0, d = 7, o = 4; for (l === 0 && (d = 138, o = 3), n[(t + 1) * 2 + 1] = 65535, i = 0; i <= t; i++) r = l, l = n[(i + 1) * 2 + 1], !(++s < d && r === l) && (s < o ? e.bl_tree[r * 2] += s : r !== 0 ? (r !== a && e.bl_tree[r * 2]++, e.bl_tree[Gn * 2]++) : s <= 10 ? e.bl_tree[jn * 2]++ : e.bl_tree[Yn * 2]++, s = 0, a = r, l === 0 ? (d = 138, o = 3) : r === l ? (d = 6, o = 3) : (d = 7, o = 4)); }, tn = (e, n, t) => { let i, a = -1, r, l = n[0 * 2 + 1], s = 0, d = 7, o = 4; for (l === 0 && (d = 138, o = 3), i = 0; i <= t; i++) if (r = l, l = n[(i + 1) * 2 + 1], !(++s < d && r === l)) { if (s < o) do Y(e, r, e.bl_tree); while (--s !== 0); else r !== 0 ? (r !== a && (Y(e, r, e.bl_tree), s--), Y(e, Gn, e.bl_tree), $(e, s - 3, 2)) : s <= 10 ? (Y(e, jn, e.bl_tree), $(e, s - 3, 3)) : (Y(e, Yn, e.bl_tree), $(e, s - 11, 7)); s = 0, a = r, l === 0 ? (d = 138, o = 3) : r === l ? (d = 6, o = 3) : (d = 7, o = 4); } }, oa = (e) => { let n; for (en(e, e.dyn_ltree, e.l_desc.max_code), en(e, e.dyn_dtree, e.d_desc.max_code), Tt(e, e.bl_desc), n = Ut - 1; n >= 3 && e.bl_tree[Xn[n] * 2 + 1] === 0; n--) ; return e.opt_len += 3 * (n + 1) + 5 + 5 + 4, n; }, sa = (e, n, t, i) => { let a; for ($(e, n - 257, 5), $(e, t - 1, 5), $(e, i - 4, 4), a = 0; a < i; a++) $(e, e.bl_tree[Xn[a] * 2 + 1], 3); tn(e, e.dyn_ltree, n - 1), tn(e, e.dyn_dtree, t - 1); }, la = (e) => { let n = 4093624447, t; for (t = 0; t <= 31; t++, n >>>= 1) if (n & 1 && e.dyn_ltree[t * 2] !== 0) return Vt; if (e.dyn_ltree[9 * 2] !== 0 || e.dyn_ltree[10 * 2] !== 0 || e.dyn_ltree[13 * 2] !== 0) return Wt; for (t = 32; t < Pe; t++) if (e.dyn_ltree[t * 2] !== 0) return Wt; return Vt; }; let nn = !1; const ca = (e) => { nn || (ra(), nn = !0), e.l_desc = new ct(e.dyn_ltree, Vn), e.d_desc = new ct(e.dyn_dtree, Wn), e.bl_desc = new ct(e.bl_tree, Jn), e.bi_buf = 0, e.bi_valid = 0, ni(e); }, ai = (e, n, t, i) => { $(e, (Vi << 1) + (i ? 1 : 0), 3), ii(e), Ne(e, t), Ne(e, ~t), t && e.pending_buf.set(e.window.subarray(n, n + t), e.pending), e.pending += t; }, fa = (e) => { $(e, Kn << 1, 3), Y(e, $t, J), ia(e); }, da = (e, n, t, i) => { let a, r, l = 0; e.level > 0 ? (e.strm.data_type === Xi && (e.strm.data_type = la(e)), Tt(e, e.l_desc), Tt(e, e.d_desc), l = oa(e), a = e.opt_len + 3 + 7 >>> 3, r = e.static_len + 3 + 7 >>> 3, r <= a && (a = r)) : a = r = t + 5, t + 4 <= a && n !== -1 ? ai(e, n, t, i) : e.strategy === Yi || r === a ? ($(e, (Kn << 1) + (i ? 1 : 0), 3), Qt(e, J, Ae)) : ($(e, (Wi << 1) + (i ? 1 : 0), 3), sa(e, e.l_desc.max_code + 1, e.d_desc.max_code + 1, l + 1), Qt(e, e.dyn_ltree, e.dyn_dtree)), ni(e), i && ii(e); }, _a = (e, n, t) => (e.pending_buf[e.sym_buf + e.sym_next++] = n, e.pending_buf[e.sym_buf + e.sym_next++] = n >> 8, e.pending_buf[e.sym_buf + e.sym_next++] = t, n === 0 ? e.dyn_ltree[t * 2]++ : (e.matches++, n--, e.dyn_ltree[(Re[t] + Pe + 1) * 2]++, e.dyn_dtree[Qn(n) * 2]++), e.sym_next === e.sym_end); var ha = ca, ua = ai, ma = da, ga = _a, pa = fa, wa = { _tr_init: ha, _tr_stored_block: ua, _tr_flush_block: ma, _tr_tally: ga, _tr_align: pa }; const ba = (e, n, t, i) => { let a = e & 65535 | 0, r = e >>> 16 & 65535 | 0, l = 0; for (; t !== 0; ) { l = t > 2e3 ? 2e3 : t, t -= l; do a = a + n[i++] | 0, r = r + a | 0; while (--l); a %= 65521, r %= 65521; } return a | r << 16 | 0; }; var ze = ba; const va = () => { let e, n = []; for (var t = 0; t < 256; t++) { e = t; for (var i = 0; i < 8; i++) e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1; n[t] = e; } return n; }, Ea = new Uint32Array(va()), xa = (e, n, t, i) => { const a = Ea, r = i + t; e ^= -1; for (let l = i; l < r; l++) e = e >>> 8 ^ a[(e ^ n[l]) & 255]; return e ^ -1; }; var L = xa, de = { 2: "need dictionary", /* Z_NEED_DICT 2 */ 1: "stream end", /* Z_STREAM_END 1 */ 0: "", /* Z_OK 0 */ "-1": "file error", /* Z_ERRNO (-1) */ "-2": "stream error", /* Z_STREAM_ERROR (-2) */ "-3": "data error", /* Z_DATA_ERROR (-3) */ "-4": "insufficient memory", /* Z_MEM_ERROR (-4) */ "-5": "buffer error", /* Z_BUF_ERROR (-5) */ "-6": "incompatible version" /* Z_VERSION_ERROR (-6) */ }, Ue = { /* Allowed flush values; see deflate() and inflate() below for details */ Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, //Z_VERSION_ERROR: -6, /* compression levels */ Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, /* Possible values of the data_type field (though see inflate()) */ Z_BINARY: 0, Z_TEXT: 1, //Z_ASCII: 1, // = Z_TEXT (deprecated) Z_UNKNOWN: 2, /* The deflate compression method */ Z_DEFLATED: 8 //Z_NULL: null // Use -1 or null inline, depending on var type }; const { _tr_init: ka, _tr_stored_block: St, _tr_flush_block: ya, _tr_tally: ie, _tr_align: Ta } = wa, { Z_NO_FLUSH: ae, Z_PARTIAL_FLUSH: Sa, Z_FULL_FLUSH: Aa, Z_FINISH: K, Z_BLOCK: an, Z_OK: F, Z_STREAM_END: rn, Z_STREAM_ERROR: X, Z_DATA_ERROR: Ia, Z_BUF_ERROR: dt, Z_DEFAULT_COMPRESSION: Da, Z_FILTERED: Oa, Z_HUFFMAN_ONLY: qe, Z_RLE: Ca, Z_FIXED: Ra, Z_DEFAULT_STRATEGY: Na, Z_UNKNOWN: za, Z_DEFLATED: it } = Ue, La = 9, Ma = 15, Fa = 8, Pa = 29, Ua = 256, At = Ua + 1 + Pa, $a = 30, Za = 19, Ha = 2 * At + 1, Ba = 15, I = 3, ne = 258, V = ne + I + 1, Ka = 32, we = 42, Ht = 57, It = 69, Dt = 73, Ot = 91, Ct = 103, ce = 113, Te = 666, P = 1, Ee = 2, _e = 3, xe = 4, qa = 3, fe = (e, n) => (e.msg = de[n], n), on = (e) => e * 2 - (e > 4 ? 9 : 0), te = (e) => { let n = e.length; for (; --n >= 0; ) e[n] = 0; }, Ga = (e) => { let n, t, i, a = e.w_size; n = e.hash_size, i = n; do t = e.head[--i], e.head[i] = t >= a ? t - a : 0; while (--n); n = a, i = n; do t = e.prev[--i], e.prev[i] = t >= a ? t - a : 0; while (--n); }; let ja = (e, n, t) => (n << e.hash_shift ^ t) & e.hash_mask, re = ja; const Z = (e) => { const n = e.state; let t = n.pending; t > e.avail_out && (t = e.avail_out), t !== 0 && (e.output.set(n.pending_buf.subarray(n.pending_out, n.pending_out + t), e.next_out), e.next_out += t, n.pending_out += t, e.total_out += t, e.avail_out -= t, n.pending -= t, n.pending === 0 && (n.pending_out = 0)); }, H = (e, n) => { ya(e, e.block_start >= 0 ? e.block_start : -1, e.strstart - e.block_start, n), e.block_start = e.strstart, Z(e.strm); }, D = (e, n) => { e.pending_buf[e.pending++] = n; }, ke = (e, n) => { e.pending_buf[e.pending++] = n >>> 8 & 255, e.pending_buf[e.pending++] = n & 255; }, Rt = (e, n, t, i) => { let a = e.avail_in; return a > i && (a = i), a === 0 ? 0 : (e.avail_in -= a, n.set(e.input.subarray(e.next_in, e.next_in + a), t), e.state.wrap === 1 ? e.adler = ze(e.adler, n, a, t) : e.state.wrap === 2 && (e.adler = L(e.adler, n, a, t)), e.next_in += a, e.total_in += a, a); }, ri = (e, n) => { let t = e.max_chain_length, i = e.strstart, a, r, l = e.prev_length, s = e.nice_match; const d = e.strstart > e.w_size - V ? e.strstart - (e.w_size - V) : 0, o = e.window, c = e.w_mask, w = e.prev, h = e.strstart + ne; let f = o[i + l - 1], m = o[i + l]; e.prev_length >= e.good_match && (t >>= 2), s > e.lookahead && (s = e.lookahead); do if (a = n, !(o[a + l] !== m || o[a + l - 1] !== f || o[a] !== o[i] || o[++a] !== o[i + 1])) { i += 2, a++; do ; while (o[++i] === o[++a] && o[++i] === o[++a] && o[++i] === o[++a] && o[++i] === o[++a] && o[++i] === o[++a] && o[++i] === o[++a] && o[++i] === o[++a] && o[++i] === o[++a] && i < h); if (r = ne - (h - i), i = h - ne, r > l) { if (e.match_start = n, l = r, r >= s) break; f = o[i + l - 1], m = o[i + l]; } } while ((n = w[n & c]) > d && --t !== 0); return l <= e.lookahead ? l : e.lookahead; }, be = (e) => { const n = e.w_size; let t, i, a; do { if (i = e.window_size - e.lookahead - e.strstart, e.strstart >= n + (n - V) && (e.window.set(e.window.subarray(n, n + n - i), 0), e.match_start -= n, e.strstart -= n, e.block_start -= n, e.insert > e.strstart && (e.insert = e.strstart), Ga(e), i += n), e.strm.avail_in === 0) break; if (t = Rt(e.strm, e.window, e.strstart + e.lookahead, i), e.lookahead += t, e.lookahead + e.insert >= I) for (a = e.strstart - e.insert, e.ins_h = e.window[a], e.ins_h = re(e, e.ins_h, e.window[a + 1]); e.insert && (e.ins_h = re(e, e.ins_h, e.window[a + I - 1]), e.prev[a & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = a, a++, e.insert--, !(e.lookahead + e.insert < I)); ) ; } while (e.lookahead < V && e.strm.avail_in !== 0); }, oi = (e, n) => { let t = e.pending_buf_size - 5 > e.w_size ? e.w_size : e.pending_buf_size - 5, i, a, r, l = 0, s = e.strm.avail_in; do { if (i = 65535, r = e.bi_valid + 42 >> 3, e.strm.avail_out < r || (r = e.strm.avail_out - r, a = e.strstart - e.block_start, i > a + e.strm.avail_in && (i = a + e.strm.avail_in), i > r && (i = r), i < t && (i === 0 && n !== K || n === ae || i !== a + e.strm.avail_in))) break; l = n === K && i === a + e.strm.avail_in ? 1 : 0, St(e, 0, 0, l), e.pending_buf[e.pending - 4] = i, e.pending_buf[e.pending - 3] = i >> 8, e.pending_buf[e.pending - 2] = ~i, e.pending_buf[e.pending - 1] = ~i >> 8, Z(e.strm), a && (a > i && (a = i), e.strm.output.set(e.window.subarray(e.block_start, e.block_start + a), e.strm.next_out), e.strm.next_out += a, e.strm.avail_out -= a, e.strm.total_out += a, e.block_start += a, i -= a), i && (Rt(e.strm, e.strm.output, e.strm.next_out, i), e.strm.next_out += i, e.strm.avail_out -= i, e.strm.total_out += i); } while (l === 0); return s -= e.strm.avail_in, s && (s >= e.w_size ? (e.matches = 2, e.window.set(e.strm.input.subarray(e.strm.next_in - e.w_size, e.strm.next_in), 0), e.strstart = e.w_size, e.insert = e.strstart) : (e.window_size - e.strstart <= s && (e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, e.insert > e.strstart && (e.insert = e.strstart)), e.window.set(e.strm.input.subarray(e.strm.next_in - s, e.strm.next_in), e.strstart), e.strstart += s, e.insert += s > e.w_size - e.insert ? e.w_size - e.insert : s), e.block_start = e.strstart), e.high_water < e.strstart && (e.high_water = e.strstart), l ? xe : n !== ae && n !== K && e.strm.avail_in === 0 && e.strstart === e.block_start ? Ee : (r = e.window_size - e.strstart, e.strm.avail_in > r && e.block_start >= e.w_size && (e.block_start -= e.w_size, e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, r += e.w_size, e.insert > e.strstart && (e.insert = e.strstart)), r > e.strm.avail_in && (r = e.strm.avail_in), r && (Rt(e.strm, e.window, e.strstart, r), e.strstart += r, e.insert += r > e.w_size - e.insert ? e.w_size - e.insert : r), e.high_water < e.strstart && (e.high_water = e.strstart), r = e.bi_valid + 42 >> 3, r = e.pending_buf_size - r > 65535 ? 65535 : e.pending_buf_size - r, t = r > e.w_size ? e.w_size : r, a = e.strstart - e.block_start, (a >= t || (a || n === K) && n !== ae && e.strm.avail_in === 0 && a <= r) && (i = a > r ? r : a, l = n === K && e.strm.avail_in === 0 && i === a ? 1 : 0, St(e, e.block_start, i, l), e.block_start += i, Z(e.strm)), l ? _e : P); }, _t = (e, n) => { let t, i; for (; ; ) { if (e.lookahead < V) { if (be(e), e.lookahead < V && n === ae) return P; if (e.lookahead === 0) break; } if (t = 0, e.lookahead >= I && (e.ins_h = re(e, e.ins_h, e.window[e.strstart + I - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), t !== 0 && e.strstart - t <= e.w_size - V && (e.match_length = ri(e, t)), e.match_length >= I) if (i = ie(e, e.strstart - e.match_start, e.match_length - I), e.lookahead -= e.match_length, e.match_length <= e.max_lazy_match && e.lookahead >= I) { e.match_length--; do e.strstart++, e.ins_h = re(e, e.ins_h, e.window[e.strstart + I - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart; while (--e.match_length !== 0); e.strstart++; } else e.strstart += e.match_length, e.match_length = 0, e.ins_h = e.window[e.strstart], e.ins_h = re(e, e.ins_h, e.window[e.strstart + 1]); else i = ie(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++; if (i && (H(e, !1), e.strm.avail_out === 0)) return P; } return e.insert = e.strstart < I - 1 ? e.strstart : I - 1, n === K ? (H(e, !0), e.strm.avail_out === 0 ? _e : xe) : e.sym_next && (H(e, !1), e.strm.avail_out === 0) ? P : Ee; }, me = (e, n) => { let t, i, a; for (; ; ) { if (e.lookahead < V) { if (be(e), e.lookahead < V && n === ae) return P; if (e.lookahead === 0) break; } if (t = 0, e.lookahead >= I && (e.ins_h = re(e, e.ins_h, e.window[e.strstart + I - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), e.prev_length = e.match_length, e.prev_match = e.match_start, e.match_length = I - 1, t !== 0 && e.prev_length < e.max_lazy_match && e.strstart - t <= e.w_size - V && (e.match_length = ri(e, t), e.match_length <= 5 && (e.strategy === Oa || e.match_length === I && e.strstart - e.match_start > 4096) && (e.match_length = I - 1)), e.prev_length >= I && e.match_length <= e.prev_length) { a = e.strstart + e.lookahead - I, i = ie(e, e.strstart - 1 - e.prev_match, e.prev_length - I), e.lookahead -= e.prev_length - 1, e.prev_length -= 2; do ++e.strstart <= a && (e.ins_h = re(e, e.ins_h, e.window[e.strstart + I - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart); while (--e.prev_length !== 0); if (e.match_available = 0, e.match_length = I - 1, e.strstart++, i && (H(e, !1), e.strm.avail_out === 0)) return P; } else if (e.match_available) { if (i = ie(e, 0, e.window[e.strstart - 1]), i && H(e, !1), e.strstart++, e.lookahead--, e.strm.avail_out === 0) return P; } else e.match_available = 1, e.strstart++, e.lookahead--; } return e.match_available && (i = ie(e, 0, e.window[e.strstart - 1]), e.match_available = 0), e.insert = e.strstart < I - 1 ? e.strstart : I - 1, n === K ? (H(e, !0), e.strm.avail_out === 0 ? _e : xe) : e.sym_next && (H(e, !1), e.strm.avail_out === 0) ? P : Ee; }, Ya = (e, n) => { let t, i, a, r; const l = e.window; for (; ; ) { if (e.lookahead <= ne) { if (be(e), e.lookahead <= ne && n === ae) return P; if (e.lookahead === 0) break; } if (e.match_length = 0, e.lookahead >= I && e.strstart > 0 && (a = e.strstart - 1, i = l[a], i === l[++a] && i === l[++a] && i === l[++a])) { r = e.strstart + ne; do ; while (i === l[++a] && i === l[++a] && i === l[++a] && i === l[++a] && i === l[++a] && i === l[++a] && i === l[++a] && i === l[++a] && a < r); e.match_length = ne - (r - a), e.match_length > e.lookahead && (e.match_length = e.lookahead); } if (e.match_length >= I ? (t = ie(e, 1, e.match_length - I), e.lookahead -= e.match_length, e.strstart += e.match_length, e.match_length = 0) : (t = ie(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++), t && (H(e, !1), e.strm.avail_out === 0)) return P; } return e.insert = 0, n === K ? (H(e, !0), e.strm.avail_out === 0 ? _e : xe) : e.sym_next && (H(e, !1), e.strm.avail_out === 0) ? P : Ee; }, Xa = (e, n) => { let t; for (; ; ) { if (e.lookahead === 0 && (be(e), e.lookahead === 0)) { if (n === ae) return P; break; } if (e.match_length = 0, t = ie(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++, t && (H(e, !1), e.strm.avail_out === 0)) return P; } return e.insert = 0, n === K ? (H(e, !0), e.strm.avail_out === 0 ? _e : xe) : e.sym_next && (H(e, !1), e.strm.avail_out === 0) ? P : Ee; }; function j(e, n, t, i, a) { this.good_length = e, this.max_lazy = n, this.nice_length = t, this.max_chain = i, this.func = a; } const Se = [ /* good lazy nice chain */ new j(0, 0, 0, 0, oi), /* 0 store only */ new j(4, 4, 8, 4, _t), /* 1 max speed, no lazy matches */ new j(4, 5, 16, 8, _t), /* 2 */ new j(4, 6, 32, 32, _t), /* 3 */ new j(4, 4, 16, 16, me), /* 4 lazy matches */ new j(8, 16, 32, 32, me), /* 5 */ new j(8, 16, 128, 128, me), /* 6 */ new j(8, 32, 128, 256, me), /* 7 */ new j(32, 128, 258, 1024, me), /* 8 */ new j(32, 258, 258, 4096, me) /* 9 max compression */ ], Va = (e) => { e.window_size = 2 * e.w_size, te(e.head), e.max_lazy_match = Se[e.level].max_lazy, e.good_match = Se[e.level].good_length, e.nice_match = Se[e.level].nice_length, e.max_chain_length = Se[e.level].max_chain, e.strstart = 0, e.block_start = 0, e.lookahead = 0, e.insert = 0, e.match_length = e.prev_length = I - 1, e.match_available = 0, e.ins_h = 0; }; function Wa() { this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = it, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(Ha * 2), this.dyn_dtree = new Uint16Array((2 * $a + 1) * 2), this.bl_tree = new Uint16Array((2 * Za + 1) * 2), te(this.dyn_ltree), te(this.dyn_dtree), te(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(Ba + 1), this.heap = new Uint16Array(2 * At + 1), te(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * At + 1), te(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; } const $e = (e) => { if (!e) return 1; const n = e.state; return !n || n.strm !== e || n.status !== we && //#ifdef GZIP n.status !== Ht && //#endif n.status !== It && n.status !== Dt && n.status !== Ot && n.status !== Ct && n.status !== ce && n.status !== Te ? 1 : 0; }, si = (e) => { if ($e(e)) return fe(e, X); e.total_in = e.total_out = 0, e.data_type = za; const n = e.state; return n.pending = 0, n.pending_out = 0, n.wrap < 0 && (n.wrap = -n.wrap), n.status = //#ifdef GZIP n.wrap === 2 ? Ht : ( //#endif n.wrap ? we : ce ), e.adler = n.wrap === 2 ? 0 : 1, n.last_flush = -2, ka(n), F; }, li = (e) => { const n = si(e); return n === F && Va(e.state), n; }, Ja = (e, n) => $e(e) || e.state.wrap !== 2 ? X : (e.state.gzhead = n, F), ci = (e, n, t, i, a, r) => { if (!e) return X; let l = 1; if (n === Da && (n = 6), i < 0 ? (l = 0, i = -i) : i > 15 && (l = 2, i -= 16), a < 1 || a > La || t !== it || i < 8 || i > 15 || n < 0 || n > 9 || r < 0 || r > Ra || i === 8 && l !== 1) return fe(e, X); i === 8 && (i = 9); const s = new Wa(); return e.state = s, s.strm = e, s.status = we, s.wrap = l, s.gzhead = null, s.w_bits = i, s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = a + 7, s.hash_size = 1 << s.hash_bits, s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + I - 1) / I), s.window = new Uint8Array(s.w_size * 2), s.head = new Uint16Array(s.hash_size), s.prev = new Uint16Array(s.w_size), s.lit_bufsize = 1 << a + 6, s.pending_buf_size = s.lit_bufsize * 4, s.pending_buf = new Uint8Array(s.pending_buf_size), s.sym_buf = s.lit_bufsize, s.sym_end = (s.lit_bufsize - 1) * 3, s.level = n, s.strategy = r, s.method = t, li(e); }, Qa = (e, n) => ci(e, n, it, Ma, Fa, Na), er = (e, n) => { if ($e(e) || n > an || n < 0) return e ? fe(e, X) : X; const t = e.state; if (!e.output || e.avail_in !== 0 && !e.input || t.status === Te && n !== K) return fe(e, e.avail_out === 0 ? dt : X); const i = t.last_flush; if (t.last_flush = n, t.pending !== 0) { if (Z(e), e.avail_out === 0) return t.last_flush = -1, F; } else if (e.avail_in === 0 && on(n) <= on(i) && n !== K) return fe(e, dt); if (t.status === Te && e.avail_in !== 0) return fe(e, dt); if (t.status === we && t.wrap === 0 && (t.status = ce), t.status === we) { let a = it + (t.w_bits - 8 << 4) << 8, r = -1; if (t.strategy >= qe || t.level < 2 ? r = 0 : t.level < 6 ? r = 1 : t.level === 6 ? r = 2 : r = 3, a |= r << 6, t.strstart !== 0 && (a |= Ka), a += 31 - a % 31, ke(t, a), t.strstart !== 0 && (ke(t, e.adler >>> 16), ke(t, e.adler & 65535)), e.adler = 1, t.status = ce, Z(e), t.pending !== 0) return t.last_flush = -1, F; } if (t.status === Ht) { if (e.adler = 0, D(t, 31), D(t, 139), D(t, 8), t.gzhead) D( t, (t.gzhead.text ? 1 : 0) + (t.gzhead.hcrc ? 2 : 0) + (t.gzhead.extra ? 4 : 0) + (t.gzhead.name ? 8 : 0) + (t.gzhead.comment ? 16 : 0) ), D(t, t.gzhead.time & 255), D(t, t.gzhead.time >> 8 & 255), D(t, t.gzhead.time >> 16 & 255), D(t, t.gzhead.time >> 24 & 255), D(t, t.level === 9 ? 2 : t.strategy >= qe || t.level < 2 ? 4 : 0), D(t, t.gzhead.os & 255), t.gzhead.extra && t.gzhead.extra.length && (D(t, t.gzhead.extra.length & 255), D(t, t.gzhead.extra.length >> 8 & 255)), t.gzhead.hcrc && (e.adler = L(e.adler, t.pending_buf, t.pending, 0)), t.gzindex = 0, t.status = It; else if (D(t, 0), D(t, 0), D(t, 0), D(t, 0), D(t, 0), D(t, t.level === 9 ? 2 : t.strategy >= qe || t.level < 2 ? 4 : 0), D(t, qa), t.status = ce, Z(e), t.pending !== 0) return t.last_flush = -1, F; } if (t.status === It) { if (t.gzhead.extra) { let a = t.pending, r = (t.gzhead.extra.length & 65535) - t.gzindex; for (; t.pending + r > t.pending_buf_size; ) { let s = t.pending_buf_size - t.pending; if (t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex, t.gzindex + s), t.pending), t.pending = t.pending_buf_size, t.gzhead.hcrc && t.pending > a && (e.adler = L(e.adler, t.pending_buf, t.pending - a, a)), t.gzindex += s, Z(e), t.pending !== 0) return t.last_flush = -1, F; a = 0, r -= s; } let l = new Uint8Array(t.gzhead.extra); t.pending_buf.set(l.subarray(t.gzindex, t.gzindex + r), t.pending), t.pending += r, t.gzhead.hcrc && t.pending > a && (e.adler = L(e.adler, t.pending_buf, t.pending - a, a)), t.gzindex = 0; } t.status = Dt; } if (t.status === Dt) { if (t.gzhead.name) { let a = t.pending, r; do { if (t.pending === t.pending_buf_size) { if (t.gzhead.hcrc && t.pending > a && (e.adler = L(e.adler, t.pending_buf, t.pending - a, a)), Z(e), t.pending !== 0) return t.last_flush = -1, F; a = 0; } t.gzindex < t.gzhead.name.length ? r = t.gzhead.name.charCodeAt(t.gzindex++) & 255 : r = 0, D(t, r); } while (r !== 0); t.gzhead.hcrc && t.pending > a && (e.adler = L(e.adler, t.pending_buf, t.pending - a, a)), t.gzindex = 0; } t.status = Ot; } if (t.status === Ot) { if (t.gzhead.comment) { let a = t.pending, r; do { if (t.pending === t.pending_buf_size) { if (t.gzhead.hcrc && t.pending > a && (e.adler = L(e.adler, t.pending_buf, t.pending - a, a)), Z(e), t.pending !== 0) return t.last_flush = -1, F; a = 0; } t.gzindex < t.gzhead.comment.length ? r = t.gzhead.comment.charCodeAt(t.gzindex++) & 255 : r = 0, D(t, r); } while (r !== 0); t.gzhead.hcrc && t.pending > a && (e.adler = L(e.adler, t.pending_buf, t.pending - a, a)); } t.status = Ct; } if (t.status === Ct) { if (t.gzhead.hcrc) { if (t.pending + 2 > t.pending_buf_size && (Z(e), t.pending !== 0)) return t.last_flush = -1, F; D(t, e.adler & 255), D(t, e.adler >> 8 & 255), e.adler = 0; } if (t.status = ce, Z(e), t.pending !== 0) return t.last_flush = -1, F; } if (e.avail_in !== 0 || t.lookahead !== 0 || n !== ae && t.status !== Te) { let a = t.level === 0 ? oi(t, n) : t.strategy === qe ? Xa(t, n) : t.strategy === Ca ? Ya(t, n) : Se[t.level].func(t, n); if ((a === _e || a === xe) && (t.status = Te), a === P || a === _e) return e.avail_out === 0 && (t.last_flush = -1), F; if (a === Ee && (n === Sa ? Ta(t) : n !== an && (St(t, 0, 0, !1), n === Aa && (te(t.head), t.lookahead === 0 && (t.strstart = 0, t.block_start = 0, t.insert = 0))), Z(e), e.avail_out === 0)) return t.last_flush = -1, F; } return n !== K ? F : t.wrap <= 0 ? rn : (t.wrap === 2 ? (D(t, e.adler & 255), D(t, e.adler >> 8 & 255), D(t, e.adler >> 16 & 255), D(t, e.adler >> 24 & 255), D(t, e.total_in & 255), D(t, e.total_in >> 8 & 255), D(t, e.total_in >> 16 & 255), D(t, e.total_in >> 24 & 255)) : (ke(t, e.adler >>> 16), ke(t, e.adler & 65535)), Z(e), t.wrap > 0 && (t.wrap = -t.wrap), t.pending !== 0 ? F : rn); }, tr = (e) => { if ($e(e)) return X; const n = e.state.status; return e.state = null, n === ce ? fe(e, Ia) : F; }, nr = (e, n) => { let t = n.length; if ($e(e)) return X; const i = e.state, a = i.wrap; if (a === 2 || a === 1 && i.status !== we || i.lookahead) return X; if (a === 1 && (e.adler = ze(e.adler, n, t, 0)), i.wrap = 0, t >= i.w_size) { a === 0 && (te(i.head), i.strstart = 0, i.block_start = 0, i.insert = 0); let d = new Uint8Array(i.w_size); d.set(n.subarray(t - i.w_size, t), 0), n = d, t = i.w_size; } const r = e.avail_in, l = e.next_in, s = e.input; for (e.avail_in = t, e.next_in = 0, e.input = n, be(i); i.lookahead >= I; ) { let d = i.strstart, o = i.lookahead - (I - 1); do i.ins_h = re(i, i.ins_h, i.window[d + I - 1]), i.prev[d & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = d, d++; while (--o); i.strstart = d, i.lookahead = I - 1, be(i); } return i.strstart += i.lookahead, i.block_start = i.strstart, i.insert = i.lookahead, i.lookahead = 0, i.match_length = i.prev_length = I - 1, i.match_available = 0, e.next_in = l, e.input = s, e.avail_in = r, i.wrap = a, F; }; var ir = Qa, ar = ci, rr = li, or = si, sr = Ja, lr = er, cr = tr, fr = nr, dr = "pako deflate (from Nodeca project)", Ie = { deflateInit: ir, deflateInit2: ar, deflateReset: rr, deflateResetKeep: or, deflateSetHeader: sr, deflate: lr, deflateEnd: cr, deflateSetDictionary: fr, deflateInfo: dr }; const _r = (e, n) => Object.prototype.hasOwnProperty.call(e, n); var hr = function(e) { const n = Array.prototype.slice.call(arguments, 1); for (; n.length; ) { const t = n.shift(); if (t) { if (typeof t != "object") throw new TypeError(t + "must be non-object"); for (const i in t) _r(t, i) && (e[i] = t[i]); } } return e; }, ur = (e) => { let n = 0; for (let i = 0, a = e.length; i < a; i++) n += e[i].length; const t = new Uint8Array(n); for (let i = 0, a = 0, r = e.length; i < r; i++) { let l = e[i]; t.set(l, a), a += l.length; } return t; }, at = { assign: hr, flattenChunks: ur }; let fi = !0; try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch { fi = !1; } const Le = new Uint8Array(256); for (let e = 0; e < 256; e++) Le[e] = e >= 252 ? 6 : e >= 248 ? 5 : e >= 240 ? 4 : e >= 224 ? 3 : e >= 192 ? 2 : 1; Le[254] = Le[254] = 1; var mr = (e) => { if (typeof TextEncoder == "function" && TextEncoder.prototype.encode) return new TextEncoder().encode(e); let n, t, i, a, r, l = e.length, s = 0; for (a = 0; a < l; a++) t = e.charCodeAt(a), (t & 64512) === 55296 && a + 1 < l && (i = e.charCodeAt(a + 1), (i & 64512) === 56320 && (t = 65536 + (t - 55296 << 10) + (i - 56320), a++)), s += t < 128 ? 1 : t < 2048 ? 2 : t < 65536 ? 3 : 4; for (n = new Uint8Array(s), r = 0, a = 0; r < s; a++) t = e.charCodeAt(a), (t & 64512) === 55296 && a + 1 < l && (i = e.charCodeAt(a + 1), (i & 64512) === 56320 && (t = 65536 + (t - 55296 << 10) + (i - 56320), a++)), t < 128 ? n[r++] = t : t < 2048 ? (n[r++] = 192 | t >>> 6, n[r++] = 128 | t & 63) : t < 65536 ? (n[r++] = 224 | t >>> 12, n[r++] = 128 | t >>> 6 & 63, n[r++] = 128 | t & 63) : (n[r++] = 240 | t >>> 18, n[r++] = 128 | t >>> 12 & 63, n[r++] = 128 | t >>> 6 & 63, n[r++] = 128 | t & 63); return n; }; const gr = (e, n) => { if (n < 65534 && e.subarray && fi) return String.fromCharCode.apply(null, e.length === n ? e : e.subarray(0, n)); let t = ""; for (let i = 0; i < n; i++) t += String.fromCharCode(e[i]); return t; }; var pr = (e, n) => { const t = n || e.length; if (typeof TextDecoder == "function" && TextDecoder.prototype.decode) return new TextDecoder().decode(e.subarray(0, n)); let i, a; const r = new Array(t * 2); for (a = 0, i = 0; i < t; ) { let l = e[i++]; if (l < 128) { r[a++] = l; continue; } let s = Le[l]; if (s > 4) { r[a++] = 65533, i += s - 1; continue; } for (l &= s === 2 ? 31 : s === 3 ? 15 : 7; s > 1 && i < t; ) l = l << 6 | e[i++] & 63, s--; if (s > 1) { r[a++] = 65533; continue; } l < 65536 ? r[a++] = l : (l -= 65536, r[a++] = 55296 | l >> 10 & 1023, r[a++] = 56320 | l & 1023); } return gr(r, a); }, wr = (e, n) => { n = n || e.length, n > e.length && (n = e.length); let t = n - 1; for (; t >= 0 && (e[t] & 192) === 128; ) t--; return t < 0 || t === 0 ? n : t + Le[e[t]] > n ? t : n; }, Me = { string2buf: mr, buf2string: pr, utf8border: wr }; function br() { this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; } var di = br; const _i = Object.prototype.toString, { Z_NO_FLUSH: vr, Z_SYNC_FLUSH: Er, Z_FULL_FLUSH: xr, Z_FINISH: kr, Z_OK: et, Z_STREAM_END: yr, Z_DEFAULT_COMPRESSION: Tr, Z_DEFAULT_STRATEGY: Sr, Z_DEFLATED: Ar } = Ue; function Ze(e) { this.options = at.assign({ level: Tr, method: Ar, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: Sr }, e || {}); let n = this.options; n.raw && n.windowBits > 0 ? n.windowBits = -n.windowBits : n.gzip && n.windowBits > 0 && n.windowBits < 16 && (n.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new di(), this.strm.avail_out = 0; let t = Ie.deflateInit2( this.strm, n.level, n.method, n.windowBits, n.memLevel, n.strategy ); if (t !== et) throw new Error(de[t]); if (n.header && Ie.deflateSetHeader(this.strm, n.header), n.dictionary) { let i; if (typeof n.dictionary == "string" ? i = Me.string2buf(n.dictionary) : _i.call(n.dictionary) === "[object ArrayBuffer]" ? i = new Uint8Array(n.dictionary) : i = n.dictionary, t = Ie.deflateSetDictionary(this.strm, i), t !== et) throw new Error(de[t]); this._dict_set = !0; } } Ze.prototype.push = function(e, n) { const t = this.strm, i = this.options.chunkSize; let a,