/*! Parts of this script are from the TurboWarp Packager , licensed as follows: Copyright (C) 2021-2024 Thomas Weber The Source Code Form of this program is available under the terms of the Mozilla Public License, v. 2.0. You can obtain a copy of the license at https://www.mozilla.org/en-US/MPL/2.0/. Parts of this script are from Scratch , licensed as follows: Copyright (c) 2016, Massachusetts Institute of Technology All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*! For license information please see scaffolding-min.js.LICENSE.txt */ !function (e) { function t(t) { for (var n, i, s = t[0], o = t[1], a = 0, c = []; a < s.length; a++)i = s[a], Object.prototype.hasOwnProperty.call(r, i) && r[i] && c.push(r[i][0]), r[i] = 0; for (n in o) Object.prototype.hasOwnProperty.call(o, n) && (e[n] = o[n]); for (l && l(t); c.length;)c.shift()() } var n = {}, r = { 0: 0 }; function i(t) { if (n[t]) return n[t].exports; var r = n[t] = { i: t, l: !1, exports: {} }; return e[t].call(r.exports, r, r.exports, i), r.l = !0, r.exports } i.e = function (e) { var t = [], n = r[e]; if (0 !== n) if (n) t.push(n[2]); else { var s = new Promise((function (t, i) { n = r[e] = [t, i] })); t.push(n[2] = s); var o, a = document.createElement("script"); a.charset = "utf-8", a.timeout = 120, i.nc && a.setAttribute("nonce", i.nc), a.src = function (e) { return i.p + "scaffolding/" + ({ 1: "vendors~iframe-extension-worker" }[e] || e) + ".js" }(e); var l = new Error; o = function (t) { a.onerror = a.onload = null, clearTimeout(c); var n = r[e]; if (0 !== n) { if (n) { var i = t && ("load" === t.type ? "missing" : t.type), s = t && t.target && t.target.src; l.message = "Loading chunk " + e + " failed.\n(" + i + ": " + s + ")", l.name = "ChunkLoadError", l.type = i, l.request = s, n[1](l) } r[e] = void 0 } }; var c = setTimeout((function () { o({ type: "timeout", target: a }) }), 12e4); a.onerror = a.onload = o, document.head.appendChild(a) } return Promise.all(t) }, i.m = e, i.c = n, i.d = function (e, t, n) { i.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n }) }, i.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, i.t = function (e, t) { if (1 & t && (e = i(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var n = Object.create(null); if (i.r(n), Object.defineProperty(n, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var r in e) i.d(n, r, function (t) { return e[t] }.bind(null, r)); return n }, i.n = function (e) { var t = e && e.__esModule ? function () { return e.default } : function () { return e }; return i.d(t, "a", t), t }, i.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, i.p = "", i.oe = function (e) { throw console.error(e), e }; var s = window.webpackJsonp = window.webpackJsonp || [], o = s.push.bind(s); s.push = t, s = s.slice(); for (var a = 0; a < s.length; a++)t(s[a]); var l = o; i(i.s = 415) }([function (e, t, n) { var r = n(36), i = n(93), s = n(37), o = s.TYPE, a = n(91), l = a.isNewline, c = a.isName, u = a.isValidEscape, d = a.isNumberStart, h = a.isIdentifierStart, p = a.charCodeCategory, m = a.isBOM, f = n(27), g = f.cmpStr, y = f.getNewlineLength, b = f.findWhiteSpaceEnd, v = f.consumeEscaped, S = f.consumeName, w = f.consumeNumber, k = f.consumeBadUrlRemnants, T = 16777215, x = 24; function E(e, t) { function n(t) { return t < E ? e.charCodeAt(t) : 0 } function s() { return M = w(e, M), h(n(M), n(M + 1), n(M + 2)) ? (L = o.Dimension, void (M = S(e, M))) : 37 === n(M) ? (L = o.Percentage, void M++) : void (L = o.Number) } function a() { const t = M; return M = S(e, M), g(e, t, M, "url") && 40 === n(M) ? 34 === n(M = b(e, M + 1)) || 39 === n(M) ? (L = o.Function, void (M = t + 4)) : void function () { for (L = o.Url, M = b(e, M); M < e.length; M++) { var t = e.charCodeAt(M); switch (p(t)) { case 41: return void M++; case p.Eof: return; case p.WhiteSpace: return 41 === n(M = b(e, M)) || M >= e.length ? void (M < e.length && M++) : (M = k(e, M), void (L = o.BadUrl)); case 34: case 39: case 40: case p.NonPrintable: return M = k(e, M), void (L = o.BadUrl); case 92: if (u(t, n(M + 1))) { M = v(e, M) - 1; break } return M = k(e, M), void (L = o.BadUrl) } } }() : 40 === n(M) ? (L = o.Function, void M++) : void (L = o.Ident) } function f(t) { for (t || (t = n(M++)), L = o.String; M < e.length; M++) { var r = e.charCodeAt(M); switch (p(r)) { case t: return void M++; case p.Eof: return; case p.WhiteSpace: if (l(r)) return M += y(e, M, r), void (L = o.BadString); break; case 92: if (M === e.length - 1) break; var i = n(M + 1); l(i) ? M += y(e, M + 1, i) : u(r, i) && (M = v(e, M) - 1) } } } t || (t = new r); for (var E = (e = String(e || "")).length, A = i(t.offsetAndType, E + 1), C = i(t.balance, E + 1), I = 0, O = m(n(0)), M = O, N = 0, R = 0, D = 0; M < E;) { var P = e.charCodeAt(M), L = 0; switch (C[I] = E, p(P)) { case p.WhiteSpace: L = o.WhiteSpace, M = b(e, M + 1); break; case 34: f(); break; case 35: c(n(M + 1)) || u(n(M + 1), n(M + 2)) ? (L = o.Hash, M = S(e, M + 1)) : (L = o.Delim, M++); break; case 39: f(); break; case 40: L = o.LeftParenthesis, M++; break; case 41: L = o.RightParenthesis, M++; break; case 43: d(P, n(M + 1), n(M + 2)) ? s() : (L = o.Delim, M++); break; case 44: L = o.Comma, M++; break; case 45: d(P, n(M + 1), n(M + 2)) ? s() : 45 === n(M + 1) && 62 === n(M + 2) ? (L = o.CDC, M += 3) : h(P, n(M + 1), n(M + 2)) ? a() : (L = o.Delim, M++); break; case 46: d(P, n(M + 1), n(M + 2)) ? s() : (L = o.Delim, M++); break; case 47: 42 === n(M + 1) ? (L = o.Comment, 1 === (M = e.indexOf("*/", M + 2) + 2) && (M = e.length)) : (L = o.Delim, M++); break; case 58: L = o.Colon, M++; break; case 59: L = o.Semicolon, M++; break; case 60: 33 === n(M + 1) && 45 === n(M + 2) && 45 === n(M + 3) ? (L = o.CDO, M += 4) : (L = o.Delim, M++); break; case 64: h(n(M + 1), n(M + 2), n(M + 3)) ? (L = o.AtKeyword, M = S(e, M + 1)) : (L = o.Delim, M++); break; case 91: L = o.LeftSquareBracket, M++; break; case 92: u(P, n(M + 1)) ? a() : (L = o.Delim, M++); break; case 93: L = o.RightSquareBracket, M++; break; case 123: L = o.LeftCurlyBracket, M++; break; case 125: L = o.RightCurlyBracket, M++; break; case p.Digit: s(); break; case p.NameStart: a(); break; case p.Eof: break; default: L = o.Delim, M++ }switch (L) { case N: for (N = (R = C[D = R & T]) >> x, C[I] = D, C[D++] = I; D < I; D++)C[D] === E && (C[D] = I); break; case o.LeftParenthesis: case o.Function: C[I] = R, R = (N = o.RightParenthesis) << x | I; break; case o.LeftSquareBracket: C[I] = R, R = (N = o.RightSquareBracket) << x | I; break; case o.LeftCurlyBracket: C[I] = R, R = (N = o.RightCurlyBracket) << x | I }A[I++] = L << x | M } for (A[I] = o.EOF << x | M, C[I] = E, C[E] = E; 0 !== R;)R = C[D = R & T], C[D] = E; return t.source = e, t.firstCharOffset = O, t.offsetAndType = A, t.tokenCount = I, t.balance = C, t.reset(), t.next(), t } Object.keys(s).forEach((function (e) { E[e] = s[e] })), Object.keys(a).forEach((function (e) { E[e] = a[e] })), Object.keys(f).forEach((function (e) { E[e] = f[e] })), e.exports = E }, function (e, t, n) { const r = n(31); r.enable(), e.exports = r("vm") }, function (e, t, n) { const r = n(23), i = e => { if ("string" != typeof e) return !1; for (let t = 0; t < e.length; t++) { const n = e.charCodeAt(t); if (48 === n || 9 === n) return !1 } return !0 }; class s { static toNumber(e) { if ("number" == typeof e) return Number.isNaN(e) ? 0 : e; const t = Number(e); return Number.isNaN(t) ? 0 : t } static toBoolean(e) { return "boolean" == typeof e ? e : "string" == typeof e ? "" !== e && "0" !== e && "false" !== e.toLowerCase() : Boolean(e) } static toString(e) { return String(e) } static toRgbColorList(e) { const t = s.toRgbColorObject(e); return [t.r, t.g, t.b] } static toRgbColorObject(e) { let t; return "string" == typeof e && "#" === e.substring(0, 1) ? (t = r.hexToRgb(e), t || (t = { r: 0, g: 0, b: 0, a: 255 })) : t = r.decimalToRgb(s.toNumber(e)), t } static isWhiteSpace(e) { return null === e || "string" == typeof e && 0 === e.trim().length } static compare(e, t) { let n = Number(e), r = Number(t); if (0 === n && i(e) ? n = NaN : 0 === r && i(t) && (r = NaN), isNaN(n) || isNaN(r)) { const n = String(e).toLowerCase(), r = String(t).toLowerCase(); return n < r ? -1 : n > r ? 1 : 0 } return n === 1 / 0 && r === 1 / 0 || n === -1 / 0 && r === -1 / 0 ? 0 : n - r } static isInt(e) { return "number" == typeof e ? !!isNaN(e) || e === Math.floor(e) : "boolean" == typeof e || "string" == typeof e && e.indexOf(".") < 0 } static get LIST_INVALID() { return "INVALID" } static get LIST_ALL() { return "ALL" } static toListIndex(e, t, n) { if ("number" != typeof e) { if ("all" === e) return n ? s.LIST_ALL : s.LIST_INVALID; if ("last" === e) return t > 0 ? t : s.LIST_INVALID; if ("random" === e || "any" === e) return t > 0 ? 1 + Math.floor(Math.random() * t) : s.LIST_INVALID } return (e = Math.floor(s.toNumber(e))) < 1 || e > t ? s.LIST_INVALID : e } } e.exports = s }, function (e, t) { e.exports = { BOOLEAN: "Boolean", BUTTON: "button", LABEL: "label", COMMAND: "command", CONDITIONAL: "conditional", EVENT: "event", HAT: "hat", LOOP: "loop", REPORTER: "reporter", XML: "xml" } }, function (e, t) { e.exports = { ANGLE: "angle", BOOLEAN: "Boolean", COLOR: "color", NUMBER: "number", STRING: "string", MATRIX: "matrix", NOTE: "note", IMAGE: "image", COSTUME: "costume", SOUND: "sound" } }, function (e, t) { e.exports = class { static degToRad(e) { return e * Math.PI / 180 } static radToDeg(e) { return 180 * e / Math.PI } static clamp(e, t, n) { return Math.min(Math.max(e, t), n) } static wrapClamp(e, t, n) { const r = n - t + 1; return e - Math.floor((e - t) / r) * r } static tan(e) { switch (e %= 360) { case -270: case 90: return 1 / 0; case -90: case 270: return -1 / 0; default: return Math.round(1e10 * Math.tan(Math.PI * e / 180)) / 1e10 } } static reducedSortOrdering(e) { const t = e.slice(0).sort(((e, t) => e - t)); return e.map((e => t.indexOf(e))) } static inclusiveRandIntWithout(e, t, n) { const r = t - e, i = e + Math.floor(Math.random() * r); return i >= n ? i + 1 : i } static scale(e, t, n, r, i) { return (e - t) / (n - t) * (i - r) + r } } }, function (e, t, n) { "use strict"; var r = n(128), i = n(129), s = n(70), o = n(69), a = n(68); function l(e, t) { return Object.keys(t).forEach((function (n) { e[n] = t[n] })), e } e.exports = function e() { var t = l({}, a), n = "en", c = {}, u = function (e) { return e }, d = null, h = "warning", p = {}; function m(e, t, s) { var o = "string" == typeof e ? e : e.default, a = y(o, "object" == typeof e && e.id || u(o), s || n); return (a.format || (a.format = i(r(a.message), s || n, p)))(t) } m.rich = function (e, t, s) { var o = "string" == typeof e ? e : e.default, a = y(o, "object" == typeof e && e.id || u(o), s || n); return (a.toParts || (a.toParts = i.toParts(r(a.message, { tagsType: f }), s || n, p)))(t) }; var f = "<>"; function g(e, t) { var n = e[2]; return function (e, t) { var r = "object" == typeof n ? function (e, t) { return Object.keys(e).reduce((function (n, r) { return n[r] = e[r](t), n }), {}) }(n, t) : n; return "function" == typeof e ? e(r) : e } } function y(e, t, n) { var r = o(n, c) || "en", i = c[r] || (c[r] = {}), s = i[t]; if ("string" == typeof s && (s = i[t] = { message: s }), !s) { var a = 'Translation for "' + t + '" in "' + r + '" is missing'; if ("warning" === h) "undefined" != typeof console && console.warn(a); else if ("ignore" !== h) throw new Error(a); var l = "function" == typeof d ? d(e, t, r) || e : d || e; s = i[t] = { message: l } } return s } function b(e, t, r, i, a) { "object" == typeof r && "object" != typeof i && (a = i, i = r, r = 0); var l = o(a || n, s), c = l && s[l][e] || v; return i["=" + +t] || i[c(t - r)] || i.other } function v() { return "other" } return p[f] = g, m.setup = function (e) { return (e = e || {}).locale && (n = e.locale), "translations" in e && (c = e.translations || {}), e.generateId && (u = e.generateId), "missingReplacement" in e && (d = e.missingReplacement), e.missingTranslation && (h = e.missingTranslation), e.formats && (e.formats.number && l(t.number, e.formats.number), e.formats.date && l(t.date, e.formats.date), e.formats.time && l(t.time, e.formats.time)), e.types && ((p = e.types)[f] = g), { locale: n, translations: c, generateId: u, missingReplacement: d, missingTranslation: h, formats: t, types: p } }, m.number = function (e, r, i) { var s = r && t.number[r] || t.parseNumberPattern(r) || t.number.default; return new Intl.NumberFormat(i || n, s).format(e) }, m.date = function (e, r, i) { var s = r && t.date[r] || t.parseDatePattern(r) || t.date.default; return new Intl.DateTimeFormat(i || n, s).format(e) }, m.time = function (e, r, i) { var s = r && t.time[r] || t.parseDatePattern(r) || t.time.default; return new Intl.DateTimeFormat(i || n, s).format(e) }, m.select = function (e, t) { return t[e] || t.other }, m.custom = function (e, t, n, r) { return e[1] in p ? p[e[1]](e, t)(n, r) : n }, m.plural = b.bind(null, "cardinal"), m.selectordinal = b.bind(null, "ordinal"), m.namespace = e, m }() }, function (e, t, n) { const r = n(1); class i { static withoutTrailingDigits(e) { let t = e.length - 1; for (; t >= 0 && "0123456789".indexOf(e.charAt(t)) > -1;)t--; return e.slice(0, t + 1) } static unusedName(e, t) { if (t.indexOf(e) < 0) return e; e = i.withoutTrailingDigits(e); let n = 2; for (; t.indexOf(e + n) >= 0;)n++; return e + n } static splitFirst(e, t) { const n = e.indexOf(t); return n >= 0 ? [e.substring(0, n), e.substring(n + 1)] : [e, null] } static stringify(e) { return JSON.stringify(e, ((e, t) => "number" != typeof t || t !== 1 / 0 && t !== -1 / 0 && !isNaN(t) ? t : 0)) } static replaceUnsafeChars(e) { if ("string" != typeof e) { if (!Array.isArray(e)) return r.error("Unexpected input recieved in replaceUnsafeChars"), e; e = String(e) } return e.replace(/[<>&'"]/g, (e => { switch (e) { case "<": return "lt"; case ">": return "gt"; case "&": return "amp"; case "'": return "apos"; case '"': return "quot" } })) } } e.exports = i }, function (e, t) { const n = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; e.exports = function () { const e = n.length, t = []; for (let r = 0; r < 20; r++)t[r] = n.charAt(Math.random() * e); return t.join("") } }, function (e, t) { var n; n = function () { return this }(); try { n = n || new Function("return this")() } catch (e) { "object" == typeof window && (n = window) } e.exports = n }, function (e, t, n) { const r = n(8), i = n(33); class s { constructor(e, t, n, i) { switch (this.id = e || r(), this.name = t, this.type = n, this.isCloud = i, this.type) { case s.SCALAR_TYPE: this.value = 0; break; case s.LIST_TYPE: this.value = []; break; case s.BROADCAST_MESSAGE_TYPE: this.value = this.name; break; default: throw new Error("Invalid variable type: ".concat(this.type)) } } toXML(e) { return e = !0 === e, '').concat(i(this.name), "") } static get SCALAR_TYPE() { return "" } static get LIST_TYPE() { return "list" } static get BROADCAST_MESSAGE_TYPE() { return "broadcast_msg" } } e.exports = s }, function (e, t, n) { var r; "undefined" != typeof self && self, r = function () { return function (e) { var t = {}; function n(r) { if (t[r]) return t[r].exports; var i = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports } return n.m = e, n.c = t, n.d = function (e, t, r) { n.o(e, t) || Object.defineProperty(e, t, { configurable: !1, enumerable: !0, get: r }) }, n.n = function (e) { var t = e && e.__esModule ? function () { return e.default } : function () { return e }; return n.d(t, "a", t), t }, n.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, n.p = "", n(n.s = 9) }([function (e, t, n) { "use strict"; t.__esModule = !0, t.copyExistingProperties = function (e, t) { Object.keys(t).forEach((function (n) { t.hasOwnProperty(n) && e.hasOwnProperty(n) && (t[n] = e[n]) })) }, t.copyNamedProperties = function (e, t, n) { e.forEach((function (e) { var r = t[e]; void 0 !== r && (n[e] = r) })) }, t.isBuffer = function (e, t) { return o || (o = e.createBuffer()), t instanceof o.constructor }, t.isRenderbuffer = function (e, t) { return a || (a = e.createRenderbuffer()), t instanceof a.constructor }, t.isShader = function (e, t) { return l || (l = e.createShader(e.VERTEX_SHADER)), t instanceof l.constructor }, t.isTexture = function (e, t) { return c || (c = e.createTexture()), t instanceof c.constructor }, t.isSampler = function (e, t) { if (!u) { if (!e.createSampler) return !1; u = e.createSampler() } return t instanceof u.constructor }, t.warn = t.error = void 0; var r, i = (r = n(2)) && r.__esModule ? r : { default: r }, s = i.default.console && i.default.console.error && "function" == typeof i.default.console.error ? i.default.console.error.bind(i.default.console) : function () { }; t.error = s; var o, a, l, c, u, d = i.default.console && i.default.console.warn && "function" == typeof i.default.console.warn ? i.default.console.warn.bind(i.default.console) : function () { }; t.warn = d }, function (e, t, n) { "use strict"; t.__esModule = !0, t.getGLTypeForTypedArray = function (e) { if (e instanceof Int8Array) return s; if (e instanceof Uint8Array) return o; if (e instanceof Uint8ClampedArray) return o; if (e instanceof Int16Array) return a; if (e instanceof Uint16Array) return l; if (e instanceof Int32Array) return c; if (e instanceof Uint32Array) return u; if (e instanceof Float32Array) return d; throw "unsupported typed array type" }, t.getGLTypeForTypedArrayType = function (e) { if (e === Int8Array) return s; if (e === Uint8Array) return o; if (e === Uint8ClampedArray) return o; if (e === Int16Array) return a; if (e === Uint16Array) return l; if (e === Int32Array) return c; if (e === Uint32Array) return u; if (e === Float32Array) return d; throw "unsupported typed array type" }, t.getTypedArrayTypeForGLType = function (e) { var t = h[e]; if (!t) throw "unknown gl type"; return t }, t.isArrayBuffer = void 0; var r, i = (r = n(2)) && r.__esModule ? r : { default: r }, s = 5120, o = 5121, a = 5122, l = 5123, c = 5124, u = 5125, d = 5126, h = {}, p = h; p[s] = Int8Array, p[o] = Uint8Array, p[a] = Int16Array, p[l] = Uint16Array, p[c] = Int32Array, p[u] = Uint32Array, p[d] = Float32Array, p[32819] = Uint16Array, p[32820] = Uint16Array, p[33635] = Uint16Array, p[5131] = Uint16Array, p[33640] = Uint32Array, p[35899] = Uint32Array, p[35902] = Uint32Array, p[36269] = Uint32Array, p[34042] = Uint32Array; var m = i.default.SharedArrayBuffer ? function (e) { return e && e.buffer && (e.buffer instanceof ArrayBuffer || e.buffer instanceof i.default.SharedArrayBuffer) } : function (e) { return e && e.buffer && e.buffer instanceof ArrayBuffer }; t.isArrayBuffer = m }, function (e, t, n) { "use strict"; t.__esModule = !0, t.default = void 0; var r = void 0 !== r ? r : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}; t.default = r }, function (e, t, n) { "use strict"; t.__esModule = !0, t.add = function (e, t, n) { return (n = n || new r(3))[0] = e[0] + t[0], n[1] = e[1] + t[1], n[2] = e[2] + t[2], n }, t.copy = function (e, t) { return (t = t || new r(3))[0] = e[0], t[1] = e[1], t[2] = e[2], t }, t.create = function (e, t, n) { var i = new r(3); return e && (i[0] = e), t && (i[1] = t), n && (i[2] = n), i }, t.cross = function (e, t, n) { n = n || new r(3); var i = e[2] * t[0] - e[0] * t[2], s = e[0] * t[1] - e[1] * t[0]; return n[0] = e[1] * t[2] - e[2] * t[1], n[1] = i, n[2] = s, n }, t.distance = function (e, t) { var n = e[0] - t[0], r = e[1] - t[1], i = e[2] - t[2]; return Math.sqrt(n * n + r * r + i * i) }, t.distanceSq = function (e, t) { var n = e[0] - t[0], r = e[1] - t[1], i = e[2] - t[2]; return n * n + r * r + i * i }, t.divide = function (e, t, n) { return (n = n || new r(3))[0] = e[0] / t[0], n[1] = e[1] / t[1], n[2] = e[2] / t[2], n }, t.divScalar = function (e, t, n) { return (n = n || new r(3))[0] = e[0] / t, n[1] = e[1] / t, n[2] = e[2] / t, n }, t.dot = function (e, t) { return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] }, t.lerp = function (e, t, n, i) { return (i = i || new r(3))[0] = (1 - n) * e[0] + n * t[0], i[1] = (1 - n) * e[1] + n * t[1], i[2] = (1 - n) * e[2] + n * t[2], i }, t.length = function (e) { return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]) }, t.lengthSq = function (e) { return e[0] * e[0] + e[1] * e[1] + e[2] * e[2] }, t.mulScalar = function (e, t, n) { return (n = n || new r(3))[0] = e[0] * t, n[1] = e[1] * t, n[2] = e[2] * t, n }, t.multiply = function (e, t, n) { return (n = n || new r(3))[0] = e[0] * t[0], n[1] = e[1] * t[1], n[2] = e[2] * t[2], n }, t.negate = function (e, t) { return (t = t || new r(3))[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t }, t.normalize = function (e, t) { t = t || new r(3); var n = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], i = Math.sqrt(n); return i > 1e-5 ? (t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i) : (t[0] = 0, t[1] = 0, t[2] = 0), t }, t.setDefaultType = function (e) { var t = r; return r = e, t }, t.subtract = function (e, t, n) { return (n = n || new r(3))[0] = e[0] - t[0], n[1] = e[1] - t[1], n[2] = e[2] - t[2], n }; var r = Float32Array }, function (e, t, n) { "use strict"; t.__esModule = !0, t.isWebGL1 = function (e) { return !e.texStorage2D }, t.isWebGL2 = function (e) { return !!e.texStorage2D }, t.glEnumToString = void 0; var r, i, s = (r = {}, i = {}, function (e, t) { return function (e) { var t = e.constructor.name; if (!r[t]) { for (var n in e) if ("number" == typeof e[n]) { var s = i[e[n]]; i[e[n]] = s ? "".concat(s, " | ").concat(n) : n } r[t] = !0 } }(e), i[t] || "0x" + t.toString(16) }); t.glEnumToString = s }, function (e, t, n) { "use strict"; t.__esModule = !0, t.createAttributeSetters = H, t.createProgram = L, t.createProgramFromScripts = function (e, t, n, r, i) { for (var s = N(n, r, i), o = [], a = 0; a < t.length; ++a) { var l = B(e, t[a], e[R[a]], s.errorCallback); if (!l) return null; o.push(l) } return L(e, o, s) }, t.createProgramFromSources = z, t.createProgramInfo = function (e, t, n, r, i) { var s = N(n, r, i), o = !0; if (t = t.map((function (e) { if (e.indexOf("\n") < 0) { var t = u(e); t ? e = t.text : (s.errorCallback("no element with id: " + e), o = !1) } return e })), !o) return null; var a = z(e, t, s); return a ? K(e, a) : null }, t.createProgramInfoFromProgram = K, t.createUniformSetters = j, t.createUniformBlockSpecFromProgram = V, t.createUniformBlockInfoFromProgram = q, t.createUniformBlockInfo = function (e, t, n) { return q(e, t.program, t.uniformBlockSpec, n) }, t.createTransformFeedback = function (e, t, n) { var r = e.createTransformFeedback(); return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK, r), e.useProgram(t.program), W(e, t, n), e.bindTransformFeedback(e.TRANSFORM_FEEDBACK, null), function (e, t, n) { for (var r in t.transformFeedbackInfo && (t = t.transformFeedbackInfo), n.attribs && (n = n.attribs), n) { var i = t[r]; i && e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER, i.index, null) } }(e, t, n), r }, t.createTransformFeedbackInfo = F, t.bindTransformFeedbackInfo = W, t.setAttributes = _, t.setBuffersAndAttributes = function (e, t, n) { n.vertexArrayObject ? e.bindVertexArray(n.vertexArrayObject) : (_(t.attribSetters || t, n.attribs), n.indices && e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, n.indices)) }, t.setUniforms = function e(t, n) { for (var r = t.uniformSetters || t, i = arguments.length, s = 1; s < i; ++s) { var o = arguments[s]; if (Array.isArray(o)) for (var a = o.length, l = 0; l < a; ++l)e(r, o[l]); else for (var c in o) { var u = r[c]; u && u(o[c]) } } }, t.setUniformBlock = function (e, t, n) { Y(e, t, n) && e.bufferData(e.UNIFORM_BUFFER, n.array, e.DYNAMIC_DRAW) }, t.setBlockUniforms = function (e, t) { var n = e.uniforms; for (var r in t) { var i = n[r]; if (i) { var s = t[r]; s.length ? i.set(s) : i[0] = s } } }, t.bindUniformBlock = Y; var r, i = a(n(4)), s = a(n(0)), o = (r = n(2)) && r.__esModule ? r : { default: r }; function a(e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t } var l = s.error, c = s.warn, u = o.default && o.default.document && o.default.document.getElementById ? o.default.document.getElementById.bind(o.default.document) : function () { return null }, d = 3553, h = 34067, p = 32879, m = 35866, f = {}; function g(e, t) { return f[t].bindPoint } function y(e, t) { return function (n) { e.uniform1i(t, n) } } function b(e, t) { return function (n) { e.uniform1iv(t, n) } } function v(e, t) { return function (n) { e.uniform2iv(t, n) } } function S(e, t) { return function (n) { e.uniform3iv(t, n) } } function w(e, t) { return function (n) { e.uniform4iv(t, n) } } function k(e, t, n, r) { var o = g(0, t); return i.isWebGL2(e) ? function (t) { var i, a; s.isTexture(e, t) ? (i = t, a = null) : (i = t.texture, a = t.sampler), e.uniform1i(r, n), e.activeTexture(e.TEXTURE0 + n), e.bindTexture(o, i), e.bindSampler(n, a) } : function (t) { e.uniform1i(r, n), e.activeTexture(e.TEXTURE0 + n), e.bindTexture(o, t) } } function T(e, t, n, r, o) { for (var a = g(0, t), l = new Int32Array(o), c = 0; c < o; ++c)l[c] = n + c; return i.isWebGL2(e) ? function (t) { e.uniform1iv(r, l), t.forEach((function (t, r) { var i, o; e.activeTexture(e.TEXTURE0 + l[r]), s.isTexture(e, t) ? (i = t, o = null) : (i = t.texture, o = t.sampler), e.bindSampler(n, o), e.bindTexture(a, i) })) } : function (t) { e.uniform1iv(r, l), t.forEach((function (t, n) { e.activeTexture(e.TEXTURE0 + l[n]), e.bindTexture(a, t) })) } } function x(e, t) { return function (n) { e.bindBuffer(e.ARRAY_BUFFER, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribPointer(t, n.numComponents || n.size, n.type || e.FLOAT, n.normalize || !1, n.stride || 0, n.offset || 0), void 0 !== n.divisor && e.vertexAttribDivisor(t, n.divisor) } } function E(e, t) { return function (n) { e.bindBuffer(e.ARRAY_BUFFER, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribIPointer(t, n.numComponents || n.size, n.type || e.INT, n.stride || 0, n.offset || 0), void 0 !== n.divisor && e.vertexAttribDivisor(t, n.divisor) } } function A(e, t, n) { var r = n.size, i = n.count; return function (n) { e.bindBuffer(e.ARRAY_BUFFER, n.buffer); for (var s = n.size || n.numComponents || r, o = s / i, a = n.type || e.FLOAT, l = f[a].size * s, c = n.normalize || !1, u = n.offset || 0, d = l / i, h = 0; h < i; ++h)e.enableVertexAttribArray(t + h), e.vertexAttribPointer(t + h, o, a, c, l, u + d * h), void 0 !== n.divisor && e.vertexAttribDivisor(t + h, n.divisor) } } f[5126] = { Type: Float32Array, size: 4, setter: function (e, t) { return function (n) { e.uniform1f(t, n) } }, arraySetter: function (e, t) { return function (n) { e.uniform1fv(t, n) } } }, f[35664] = { Type: Float32Array, size: 8, setter: function (e, t) { return function (n) { e.uniform2fv(t, n) } } }, f[35665] = { Type: Float32Array, size: 12, setter: function (e, t) { return function (n) { e.uniform3fv(t, n) } } }, f[35666] = { Type: Float32Array, size: 16, setter: function (e, t) { return function (n) { e.uniform4fv(t, n) } } }, f[5124] = { Type: Int32Array, size: 4, setter: y, arraySetter: b }, f[35667] = { Type: Int32Array, size: 8, setter: v }, f[35668] = { Type: Int32Array, size: 12, setter: S }, f[35669] = { Type: Int32Array, size: 16, setter: w }, f[5125] = { Type: Uint32Array, size: 4, setter: function (e, t) { return function (n) { e.uniform1ui(t, n) } }, arraySetter: function (e, t) { return function (n) { e.uniform1uiv(t, n) } } }, f[36294] = { Type: Uint32Array, size: 8, setter: function (e, t) { return function (n) { e.uniform2uiv(t, n) } } }, f[36295] = { Type: Uint32Array, size: 12, setter: function (e, t) { return function (n) { e.uniform3uiv(t, n) } } }, f[36296] = { Type: Uint32Array, size: 16, setter: function (e, t) { return function (n) { e.uniform4uiv(t, n) } } }, f[35670] = { Type: Uint32Array, size: 4, setter: y, arraySetter: b }, f[35671] = { Type: Uint32Array, size: 8, setter: v }, f[35672] = { Type: Uint32Array, size: 12, setter: S }, f[35673] = { Type: Uint32Array, size: 16, setter: w }, f[35674] = { Type: Float32Array, size: 16, setter: function (e, t) { return function (n) { e.uniformMatrix2fv(t, !1, n) } } }, f[35675] = { Type: Float32Array, size: 36, setter: function (e, t) { return function (n) { e.uniformMatrix3fv(t, !1, n) } } }, f[35676] = { Type: Float32Array, size: 64, setter: function (e, t) { return function (n) { e.uniformMatrix4fv(t, !1, n) } } }, f[35685] = { Type: Float32Array, size: 24, setter: function (e, t) { return function (n) { e.uniformMatrix2x3fv(t, !1, n) } } }, f[35686] = { Type: Float32Array, size: 32, setter: function (e, t) { return function (n) { e.uniformMatrix2x4fv(t, !1, n) } } }, f[35687] = { Type: Float32Array, size: 24, setter: function (e, t) { return function (n) { e.uniformMatrix3x2fv(t, !1, n) } } }, f[35688] = { Type: Float32Array, size: 48, setter: function (e, t) { return function (n) { e.uniformMatrix3x4fv(t, !1, n) } } }, f[35689] = { Type: Float32Array, size: 32, setter: function (e, t) { return function (n) { e.uniformMatrix4x2fv(t, !1, n) } } }, f[35690] = { Type: Float32Array, size: 48, setter: function (e, t) { return function (n) { e.uniformMatrix4x3fv(t, !1, n) } } }, f[35678] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: d }, f[35680] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: h }, f[35679] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: p }, f[35682] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: d }, f[36289] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: m }, f[36292] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: m }, f[36293] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: h }, f[36298] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: d }, f[36299] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: p }, f[36300] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: h }, f[36303] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: m }, f[36306] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: d }, f[36307] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: p }, f[36308] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: h }, f[36311] = { Type: null, size: 0, setter: k, arraySetter: T, bindPoint: m }; var C = {}; C[5126] = { size: 4, setter: x }, C[35664] = { size: 8, setter: x }, C[35665] = { size: 12, setter: x }, C[35666] = { size: 16, setter: x }, C[5124] = { size: 4, setter: E }, C[35667] = { size: 8, setter: E }, C[35668] = { size: 12, setter: E }, C[35669] = { size: 16, setter: E }, C[5125] = { size: 4, setter: E }, C[36294] = { size: 8, setter: E }, C[36295] = { size: 12, setter: E }, C[36296] = { size: 16, setter: E }, C[35670] = { size: 4, setter: E }, C[35671] = { size: 8, setter: E }, C[35672] = { size: 12, setter: E }, C[35673] = { size: 16, setter: E }, C[35674] = { size: 4, setter: A, count: 2 }, C[35675] = { size: 9, setter: A, count: 3 }, C[35676] = { size: 16, setter: A, count: 4 }; var I = void 0, O = /^[ \t]*\n/; function M(e, t, n, r) { var i = r || l, s = e.createShader(n), o = 0; if (O.test(t) && (o = 1, t = t.replace(O, "")), e.shaderSource(s, t), e.compileShader(s), !e.getShaderParameter(s, e.COMPILE_STATUS)) { var a = e.getShaderInfoLog(s); return i(function (e, t) { return t = t || 0, ++t, e.split("\n").map((function (e, n) { return n + t + ": " + e })).join("\n") }(t, o) + "\n*** Error compiling shader: " + a), e.deleteShader(s), null } return s } function N(e, t, n) { var r; if ("function" == typeof t && (n = t, t = void 0), "function" == typeof e) n = e, e = void 0; else if (e && !Array.isArray(e)) { if (e.errorCallback) return e; var i = e; n = i.errorCallback, e = i.attribLocations, r = i.transformFeedbackVaryings } var s = { errorCallback: n || l, transformFeedbackVaryings: r }; if (e) { var o = {}; Array.isArray(e) ? e.forEach((function (e, n) { o[e] = t ? t[n] : n })) : o = e, s.attribLocations = o } return s } var R = ["VERTEX_SHADER", "FRAGMENT_SHADER"]; function D(e) { return e.indexOf("frag") >= 0 ? I.FRAGMENT_SHADER : e.indexOf("vert") >= 0 ? I.VERTEX_SHADER : void 0 } function P(e, t) { t.forEach((function (t) { e.deleteShader(t) })) } function L(e, t, n, r, i) { for (var o = N(n, r, i), a = [], l = [], c = 0; c < t.length; ++c) { var d = t[c]; if ("string" == typeof d) { var h = u(d), p = h ? h.text : d, m = e[R[c]]; h && h.type && (m = D(h.type) || m), d = M(e, p, m, o.errorCallback), l.push(d) } s.isShader(e, d) && a.push(d) } if (a.length !== t.length) return o.errorCallback("not enough shaders for program"), P(e, l), null; var f = e.createProgram(); a.forEach((function (t) { e.attachShader(f, t) })), o.attribLocations && Object.keys(o.attribLocations).forEach((function (t) { e.bindAttribLocation(f, o.attribLocations[t], t) })); var g = o.transformFeedbackVaryings; if (g && (g.attribs && (g = g.attribs), Array.isArray(g) || (g = Object.keys(g)), e.transformFeedbackVaryings(f, g, o.transformFeedbackMode || e.SEPARATE_ATTRIBS)), e.linkProgram(f), !e.getProgramParameter(f, e.LINK_STATUS)) { var y = e.getProgramInfoLog(f); return o.errorCallback("Error in program linking:" + y), e.deleteProgram(f), P(e, l), null } return f } function B(e, t, n, r) { var i, s = u(t); if (!s) throw "*** Error: unknown script element" + t; i = s.text; var o = n || D(s.type); if (!o) throw "*** Error: unknown shader type"; return M(e, i, o, r) } function z(e, t, n, r, i) { for (var s = N(n, r, i), o = [], a = 0; a < t.length; ++a) { var l = M(e, t[a], e[R[a]], s.errorCallback); if (!l) return null; o.push(l) } return L(e, o, s) } function U(e) { var t = e.name; return t.startsWith("gl_") || t.startsWith("webgl_") } function j(e, t) { var n = 0; function r(t, r) { var i, s = e.getUniformLocation(t, r.name), o = r.size > 1 && "[0]" === r.name.substr(-3), a = r.type, l = f[a]; if (!l) throw "unknown type: 0x" + a.toString(16); if (l.bindPoint) { var c = n; n += r.size, i = o ? l.arraySetter(e, a, c, s, r.size) : l.setter(e, a, c, s, r.size) } else i = l.arraySetter && o ? l.arraySetter(e, s) : l.setter(e, s); return i.location = s, i } for (var i = {}, s = e.getProgramParameter(t, e.ACTIVE_UNIFORMS), o = 0; o < s; ++o) { var a = e.getActiveUniform(t, o); if (!U(a)) { var l = a.name; "[0]" === l.substr(-3) && (l = l.substr(0, l.length - 3)); var c = r(t, a); i[l] = c } } return i } function F(e, t) { for (var n = {}, r = e.getProgramParameter(t, e.TRANSFORM_FEEDBACK_VARYINGS), i = 0; i < r; ++i) { var s = e.getTransformFeedbackVarying(t, i); n[s.name] = { index: i, type: s.type, size: s.size } } return n } function W(e, t, n) { for (var r in t.transformFeedbackInfo && (t = t.transformFeedbackInfo), n.attribs && (n = n.attribs), n) { var i = t[r]; if (i) { var s = n[r]; s.offset ? e.bindBufferRange(e.TRANSFORM_FEEDBACK_BUFFER, i.index, s.buffer, s.offset, s.size) : e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER, i.index, s.buffer) } } } function V(e, t) { for (var n = e.getProgramParameter(t, e.ACTIVE_UNIFORMS), r = [], i = [], s = 0; s < n; ++s) { i.push(s), r.push({}); var o = e.getActiveUniform(t, s); if (U(o)) break; r[s].name = o.name } [["UNIFORM_TYPE", "type"], ["UNIFORM_SIZE", "size"], ["UNIFORM_BLOCK_INDEX", "blockNdx"], ["UNIFORM_OFFSET", "offset"]].forEach((function (n) { var s = n[0], o = n[1]; e.getActiveUniforms(t, i, e[s]).forEach((function (e, t) { r[t][o] = e })) })); for (var a = {}, l = e.getProgramParameter(t, e.ACTIVE_UNIFORM_BLOCKS), c = 0; c < l; ++c) { var u = e.getActiveUniformBlockName(t, c), d = { index: c, usedByVertexShader: e.getActiveUniformBlockParameter(t, c, e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER), usedByFragmentShader: e.getActiveUniformBlockParameter(t, c, e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER), size: e.getActiveUniformBlockParameter(t, c, e.UNIFORM_BLOCK_DATA_SIZE), uniformIndices: e.getActiveUniformBlockParameter(t, c, e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) }; d.used = d.usedByVertexSahder || d.usedByFragmentShader, a[u] = d } return { blockSpecs: a, uniformData: r } } var G = /\[\d+\]\.$/; function q(e, t, n, r) { var i = n.blockSpecs, s = n.uniformData, o = i[r]; if (!o) return c("no uniform block object named:", r), { name: r, uniforms: {} }; var a = new ArrayBuffer(o.size), l = e.createBuffer(), u = o.index; e.bindBuffer(e.UNIFORM_BUFFER, l), e.uniformBlockBinding(t, o.index, u); var d = r + "."; G.test(d) && (d = d.replace(G, ".")); var h = {}; return o.uniformIndices.forEach((function (e) { var t = s[e], n = f[t.type], r = n.Type, i = t.size * n.size, o = t.name; o.substr(0, d.length) === d && (o = o.substr(d.length)), h[o] = new r(a, t.offset, i / r.BYTES_PER_ELEMENT) })), { name: r, array: a, asFloat: new Float32Array(a), buffer: l, uniforms: h } } function Y(e, t, n) { var r = (t.uniformBlockSpec || t).blockSpecs[n.name]; if (r) { var i = r.index; return e.bindBufferRange(e.UNIFORM_BUFFER, i, n.buffer, n.offset || 0, n.array.byteLength), !0 } return !1 } function H(e, t) { for (var n = {}, r = e.getProgramParameter(t, e.ACTIVE_ATTRIBUTES), i = 0; i < r; ++i) { var s = e.getActiveAttrib(t, i); if (!U(s)) { var o = e.getAttribLocation(t, s.name), a = C[s.type], l = a.setter(e, o, a); l.location = o, n[s.name] = l } } return n } function _(e, t) { for (var n in t) { var r = e[n]; r && r(t[n]) } } function K(e, t) { var n = { program: t, uniformSetters: j(e, t), attribSetters: H(e, t) }; return i.isWebGL2(e) && (n.uniformBlockSpec = V(e, t), n.transformFeedbackInfo = F(e, t)), n } }, function (e, t, n) { "use strict"; t.__esModule = !0, t.axisRotate = function (e, t, n, r) { r = r || new i(16); var s = t[0], o = t[1], a = t[2], l = Math.sqrt(s * s + o * o + a * a), c = (s /= l) * s, u = (o /= l) * o, d = (a /= l) * a, h = Math.cos(n), p = Math.sin(n), m = 1 - h, f = c + (1 - c) * h, g = s * o * m + a * p, y = s * a * m - o * p, b = s * o * m - a * p, v = u + (1 - u) * h, S = o * a * m + s * p, w = s * a * m + o * p, k = o * a * m - s * p, T = d + (1 - d) * h, x = e[0], E = e[1], A = e[2], C = e[3], I = e[4], O = e[5], M = e[6], N = e[7], R = e[8], D = e[9], P = e[10], L = e[11]; return r[0] = f * x + g * I + y * R, r[1] = f * E + g * O + y * D, r[2] = f * A + g * M + y * P, r[3] = f * C + g * N + y * L, r[4] = b * x + v * I + S * R, r[5] = b * E + v * O + S * D, r[6] = b * A + v * M + S * P, r[7] = b * C + v * N + S * L, r[8] = w * x + k * I + T * R, r[9] = w * E + k * O + T * D, r[10] = w * A + k * M + T * P, r[11] = w * C + k * N + T * L, e !== r && (r[12] = e[12], r[13] = e[13], r[14] = e[14], r[15] = e[15]), r }, t.axisRotation = function (e, t, n) { n = n || new i(16); var r = e[0], s = e[1], o = e[2], a = Math.sqrt(r * r + s * s + o * o), l = (r /= a) * r, c = (s /= a) * s, u = (o /= a) * o, d = Math.cos(t), h = Math.sin(t), p = 1 - d; return n[0] = l + (1 - l) * d, n[1] = r * s * p + o * h, n[2] = r * o * p - s * h, n[3] = 0, n[4] = r * s * p - o * h, n[5] = c + (1 - c) * d, n[6] = s * o * p + r * h, n[7] = 0, n[8] = r * o * p + s * h, n[9] = s * o * p - r * h, n[10] = u + (1 - u) * d, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n }, t.copy = l, t.frustum = function (e, t, n, r, s, o, a) { a = a || new i(16); var l = t - e, c = r - n, u = s - o; return a[0] = 2 * s / l, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = 2 * s / c, a[6] = 0, a[7] = 0, a[8] = (e + t) / l, a[9] = (r + n) / c, a[10] = o / u, a[11] = -1, a[12] = 0, a[13] = 0, a[14] = s * o / u, a[15] = 0, a }, t.getAxis = function (e, t, n) { n = n || r.create(); var i = 4 * t; return n[0] = e[i + 0], n[1] = e[i + 1], n[2] = e[i + 2], n }, t.getTranslation = function (e, t) { return (t = t || r.create())[0] = e[12], t[1] = e[13], t[2] = e[14], t }, t.identity = c, t.inverse = u, t.lookAt = function (e, t, n, l) { l = l || new i(16); var c = s, u = o, d = a; return r.normalize(r.subtract(e, t, d), d), r.normalize(r.cross(n, d, c), c), r.normalize(r.cross(d, c, u), u), l[0] = c[0], l[1] = c[1], l[2] = c[2], l[3] = 0, l[4] = u[0], l[5] = u[1], l[6] = u[2], l[7] = 0, l[8] = d[0], l[9] = d[1], l[10] = d[2], l[11] = 0, l[12] = e[0], l[13] = e[1], l[14] = e[2], l[15] = 1, l }, t.multiply = function (e, t, n) { n = n || new i(16); var r = e[0], s = e[1], o = e[2], a = e[3], l = e[4], c = e[5], u = e[6], d = e[7], h = e[8], p = e[9], m = e[10], f = e[11], g = e[12], y = e[13], b = e[14], v = e[15], S = t[0], w = t[1], k = t[2], T = t[3], x = t[4], E = t[5], A = t[6], C = t[7], I = t[8], O = t[9], M = t[10], N = t[11], R = t[12], D = t[13], P = t[14], L = t[15]; return n[0] = r * S + l * w + h * k + g * T, n[1] = s * S + c * w + p * k + y * T, n[2] = o * S + u * w + m * k + b * T, n[3] = a * S + d * w + f * k + v * T, n[4] = r * x + l * E + h * A + g * C, n[5] = s * x + c * E + p * A + y * C, n[6] = o * x + u * E + m * A + b * C, n[7] = a * x + d * E + f * A + v * C, n[8] = r * I + l * O + h * M + g * N, n[9] = s * I + c * O + p * M + y * N, n[10] = o * I + u * O + m * M + b * N, n[11] = a * I + d * O + f * M + v * N, n[12] = r * R + l * D + h * P + g * L, n[13] = s * R + c * D + p * P + y * L, n[14] = o * R + u * D + m * P + b * L, n[15] = a * R + d * D + f * P + v * L, n }, t.negate = function (e, t) { return (t = t || new i(16))[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t[4] = -e[4], t[5] = -e[5], t[6] = -e[6], t[7] = -e[7], t[8] = -e[8], t[9] = -e[9], t[10] = -e[10], t[11] = -e[11], t[12] = -e[12], t[13] = -e[13], t[14] = -e[14], t[15] = -e[15], t }, t.ortho = function (e, t, n, r, s, o, a) { return (a = a || new i(16))[0] = 2 / (t - e), a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = 2 / (r - n), a[6] = 0, a[7] = 0, a[8] = 0, a[9] = 0, a[10] = 2 / (s - o), a[11] = 0, a[12] = (t + e) / (e - t), a[13] = (r + n) / (n - r), a[14] = (o + s) / (s - o), a[15] = 1, a }, t.perspective = function (e, t, n, r, s) { s = s || new i(16); var o = Math.tan(.5 * Math.PI - .5 * e), a = 1 / (n - r); return s[0] = o / t, s[1] = 0, s[2] = 0, s[3] = 0, s[4] = 0, s[5] = o, s[6] = 0, s[7] = 0, s[8] = 0, s[9] = 0, s[10] = (n + r) * a, s[11] = -1, s[12] = 0, s[13] = 0, s[14] = n * r * a * 2, s[15] = 0, s }, t.rotateX = function (e, t, n) { n = n || new i(16); var r = e[4], s = e[5], o = e[6], a = e[7], l = e[8], c = e[9], u = e[10], d = e[11], h = Math.cos(t), p = Math.sin(t); return n[4] = h * r + p * l, n[5] = h * s + p * c, n[6] = h * o + p * u, n[7] = h * a + p * d, n[8] = h * l - p * r, n[9] = h * c - p * s, n[10] = h * u - p * o, n[11] = h * d - p * a, e !== n && (n[0] = e[0], n[1] = e[1], n[2] = e[2], n[3] = e[3], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15]), n }, t.rotateY = function (e, t, n) { n = n || new i(16); var r = e[0], s = e[1], o = e[2], a = e[3], l = e[8], c = e[9], u = e[10], d = e[11], h = Math.cos(t), p = Math.sin(t); return n[0] = h * r - p * l, n[1] = h * s - p * c, n[2] = h * o - p * u, n[3] = h * a - p * d, n[8] = h * l + p * r, n[9] = h * c + p * s, n[10] = h * u + p * o, n[11] = h * d + p * a, e !== n && (n[4] = e[4], n[5] = e[5], n[6] = e[6], n[7] = e[7], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15]), n }, t.rotateZ = function (e, t, n) { n = n || new i(16); var r = e[0], s = e[1], o = e[2], a = e[3], l = e[4], c = e[5], u = e[6], d = e[7], h = Math.cos(t), p = Math.sin(t); return n[0] = h * r + p * l, n[1] = h * s + p * c, n[2] = h * o + p * u, n[3] = h * a + p * d, n[4] = h * l - p * r, n[5] = h * c - p * s, n[6] = h * u - p * o, n[7] = h * d - p * a, e !== n && (n[8] = e[8], n[9] = e[9], n[10] = e[10], n[11] = e[11], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15]), n }, t.rotationX = function (e, t) { t = t || new i(16); var n = Math.cos(e), r = Math.sin(e); return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = n, t[6] = r, t[7] = 0, t[8] = 0, t[9] = -r, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, t.rotationY = function (e, t) { t = t || new i(16); var n = Math.cos(e), r = Math.sin(e); return t[0] = n, t[1] = 0, t[2] = -r, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = r, t[9] = 0, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, t.rotationZ = function (e, t) { t = t || new i(16); var n = Math.cos(e), r = Math.sin(e); return t[0] = n, t[1] = r, t[2] = 0, t[3] = 0, t[4] = -r, t[5] = n, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, t.scale = function (e, t, n) { n = n || new i(16); var r = t[0], s = t[1], o = t[2]; return n[0] = r * e[0], n[1] = r * e[1], n[2] = r * e[2], n[3] = r * e[3], n[4] = s * e[4], n[5] = s * e[5], n[6] = s * e[6], n[7] = s * e[7], n[8] = o * e[8], n[9] = o * e[9], n[10] = o * e[10], n[11] = o * e[11], e !== n && (n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15]), n }, t.scaling = function (e, t) { return (t = t || new i(16))[0] = e[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e[1], t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e[2], t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, t.setAxis = function (e, t, n, r) { r !== e && (r = l(e, r)); var i = 4 * n; return r[i + 0] = t[0], r[i + 1] = t[1], r[i + 2] = t[2], r }, t.setDefaultType = function (e) { var t = i; return i = e, t }, t.setTranslation = function (e, t, n) { return n = n || c(), e !== n && (n[0] = e[0], n[1] = e[1], n[2] = e[2], n[3] = e[3], n[4] = e[4], n[5] = e[5], n[6] = e[6], n[7] = e[7], n[8] = e[8], n[9] = e[9], n[10] = e[10], n[11] = e[11]), n[12] = t[0], n[13] = t[1], n[14] = t[2], n[15] = 1, n }, t.transformDirection = function (e, t, n) { n = n || r.create(); var i = t[0], s = t[1], o = t[2]; return n[0] = i * e[0] + s * e[4] + o * e[8], n[1] = i * e[1] + s * e[5] + o * e[9], n[2] = i * e[2] + s * e[6] + o * e[10], n }, t.transformNormal = function (e, t, n) { n = n || r.create(); var i = u(e), s = t[0], o = t[1], a = t[2]; return n[0] = s * i[0] + o * i[1] + a * i[2], n[1] = s * i[4] + o * i[5] + a * i[6], n[2] = s * i[8] + o * i[9] + a * i[10], n }, t.transformPoint = function (e, t, n) { n = n || r.create(); var i = t[0], s = t[1], o = t[2], a = i * e[3] + s * e[7] + o * e[11] + e[15]; return n[0] = (i * e[0] + s * e[4] + o * e[8] + e[12]) / a, n[1] = (i * e[1] + s * e[5] + o * e[9] + e[13]) / a, n[2] = (i * e[2] + s * e[6] + o * e[10] + e[14]) / a, n }, t.translate = function (e, t, n) { n = n || new i(16); var r = t[0], s = t[1], o = t[2], a = e[0], l = e[1], c = e[2], u = e[3], d = e[4], h = e[5], p = e[6], m = e[7], f = e[8], g = e[9], y = e[10], b = e[11], v = e[12], S = e[13], w = e[14], k = e[15]; return e !== n && (n[0] = a, n[1] = l, n[2] = c, n[3] = u, n[4] = d, n[5] = h, n[6] = p, n[7] = m, n[8] = f, n[9] = g, n[10] = y, n[11] = b), n[12] = a * r + d * s + f * o + v, n[13] = l * r + h * s + g * o + S, n[14] = c * r + p * s + y * o + w, n[15] = u * r + m * s + b * o + k, n }, t.translation = function (e, t) { return (t = t || new i(16))[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = e[0], t[13] = e[1], t[14] = e[2], t[15] = 1, t }, t.transpose = function (e, t) { var n; if ((t = t || new i(16)) === e) return n = e[1], e[1] = e[4], e[4] = n, n = e[2], e[2] = e[8], e[8] = n, n = e[3], e[3] = e[12], e[12] = n, n = e[6], e[6] = e[9], e[9] = n, n = e[7], e[7] = e[13], e[13] = n, n = e[11], e[11] = e[14], e[14] = n, t; var r = e[0], s = e[1], o = e[2], a = e[3], l = e[4], c = e[5], u = e[6], d = e[7], h = e[8], p = e[9], m = e[10], f = e[11], g = e[12], y = e[13], b = e[14], v = e[15]; return t[0] = r, t[1] = l, t[2] = h, t[3] = g, t[4] = s, t[5] = c, t[6] = p, t[7] = y, t[8] = o, t[9] = u, t[10] = m, t[11] = b, t[12] = a, t[13] = d, t[14] = f, t[15] = v, t }; var r = function (e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t }(n(3)), i = Float32Array, s = r.create(), o = r.create(), a = r.create(); function l(e, t) { return (t = t || new i(16))[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t } function c(e) { return (e = e || new i(16))[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e } function u(e, t) { t = t || new i(16); var n = e[0], r = e[1], s = e[2], o = e[3], a = e[4], l = e[5], c = e[6], u = e[7], d = e[8], h = e[9], p = e[10], m = e[11], f = e[12], g = e[13], y = e[14], b = e[15], v = p * b, S = y * m, w = c * b, k = y * u, T = c * m, x = p * u, E = s * b, A = y * o, C = s * m, I = p * o, O = s * u, M = c * o, N = d * g, R = f * h, D = a * g, P = f * l, L = a * h, B = d * l, z = n * g, U = f * r, j = n * h, F = d * r, W = n * l, V = a * r, G = v * l + k * h + T * g - (S * l + w * h + x * g), q = S * r + E * h + I * g - (v * r + A * h + C * g), Y = w * r + A * l + O * g - (k * r + E * l + M * g), H = x * r + C * l + M * h - (T * r + I * l + O * h), _ = 1 / (n * G + a * q + d * Y + f * H); return t[0] = _ * G, t[1] = _ * q, t[2] = _ * Y, t[3] = _ * H, t[4] = _ * (S * a + w * d + x * f - (v * a + k * d + T * f)), t[5] = _ * (v * n + A * d + C * f - (S * n + E * d + I * f)), t[6] = _ * (k * n + E * a + M * f - (w * n + A * a + O * f)), t[7] = _ * (T * n + I * a + O * d - (x * n + C * a + M * d)), t[8] = _ * (N * u + P * m + L * b - (R * u + D * m + B * b)), t[9] = _ * (R * o + z * m + F * b - (N * o + U * m + j * b)), t[10] = _ * (D * o + U * u + W * b - (P * o + z * u + V * b)), t[11] = _ * (B * o + j * u + V * m - (L * o + F * u + W * m)), t[12] = _ * (D * p + B * y + R * c - (L * y + N * c + P * p)), t[13] = _ * (j * y + N * s + U * p - (z * p + F * y + R * s)), t[14] = _ * (z * c + V * y + P * s - (W * y + D * s + U * c)), t[15] = _ * (W * p + L * s + F * c - (j * c + V * p + B * s)), t } }, function (e, t, n) { "use strict"; t.__esModule = !0, t.createAttribsFromArrays = g, t.createBuffersFromArrays = function (e, t) { var n = {}; return Object.keys(t).forEach((function (r) { n[r] = b(e, t[r], r) })), t.indices ? (n.numElements = t.indices.length, n.elementType = r.getGLTypeForTypedArray(f(t.indices), "indices")) : n.numElements = function (e) { for (var t, n = 0; n < y.length && !((t = y[n]) in e); ++n); ii === y.length && (t = Object.keys(e)[0]); var r = e[t], i = u(r).length, s = m(r, t), o = i / s; if (i % s > 0) throw "numComponents " + s + " not correct for length " + i; return o }(t), n }, t.createBufferFromArray = b, t.createBufferFromTypedArray = l, t.createBufferInfoFromArrays = function (e, t) { var n = { attribs: g(e, t) }, i = t.indices; if (i) { var s = f(i, "indices"); n.indices = l(e, s, e.ELEMENT_ARRAY_BUFFER), n.numElements = s.length, n.elementType = r.getGLTypeForTypedArray(s) } else n.numElements = function (e, t) { var n, r; for (r = 0; r < y.length && !((n = y[r]) in t) && !((n = o.attribPrefix + n) in t); ++r); r === y.length && (n = Object.keys(t)[0]); var i = t[n]; e.bindBuffer(e.ARRAY_BUFFER, i.buffer); var s = e.getBufferParameter(e.ARRAY_BUFFER, e.BUFFER_SIZE); e.bindBuffer(e.ARRAY_BUFFER, null); var a = function (e, t) { return t === e.BYTE || t === e.UNSIGNED_BYTE ? 1 : t === e.SHORT || t === e.UNSIGNED_SHORT ? 2 : t === e.INT || t === e.UNSIGNED_INT || t === e.FLOAT ? 4 : 0 }(e, i.type), l = s / a, c = i.numComponents || i.size, u = l / c; if (u % 1 != 0) throw "numComponents " + c + " not correct for length " + length; return u }(e, n.attribs); return n }, t.setAttribInfoBufferFromArray = function (e, t, n, r) { n = f(n), void 0 !== r ? (e.bindBuffer(e.ARRAY_BUFFER, t.buffer), e.bufferSubData(e.ARRAY_BUFFER, r, n)) : a(e, e.ARRAY_BUFFER, t.buffer, n, t.drawType) }, t.setAttributePrefix = function (e) { o.attribPrefix = e }, t.setAttributeDefaults_ = function (e) { i.copyExistingProperties(e, o) }, t.getNumComponents_ = m, t.getArray_ = u; var r = s(n(1)), i = s(n(0)); function s(e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t } var o = { attribPrefix: "" }; function a(e, t, n, r, i) { e.bindBuffer(t, n), e.bufferData(t, r, i || e.STATIC_DRAW) } function l(e, t, n, r) { if (i.isBuffer(e, t)) return t; n = n || e.ARRAY_BUFFER; var s = e.createBuffer(); return a(e, n, s, t, r), s } function c(e) { return "indices" === e } function u(e) { return e.length ? e : e.data } var d = /coord|texture/i, h = /color|colour/i; function p(e, t) { var n; if (t % (n = d.test(e) ? 2 : h.test(e) ? 4 : 3) > 0) throw "Can not guess numComponents for attribute '" + e + "'. Tried " + n + " but " + t + " values is not evenly divisible by " + n + ". You should specify it."; return n } function m(e, t) { return e.numComponents || e.size || p(t, u(e).length) } function f(e, t) { if (r.isArrayBuffer(e)) return e; if (r.isArrayBuffer(e.data)) return e.data; Array.isArray(e) && (e = { data: e }); var n = e.type; return n || (n = c(t) ? Uint16Array : Float32Array), new n(e.data) } function g(e, t) { var n = {}; return Object.keys(t).forEach((function (i) { if (!c(i)) { var s, a, u, d, h, g = t[i], y = g.attrib || g.name || g.attribName || o.attribPrefix + i; if ("number" == typeof g || "number" == typeof g.data) { h = g.data || g; var b = g.type || Float32Array, v = h * b.BYTES_PER_ELEMENT; a = r.getGLTypeForTypedArrayType(b), u = void 0 !== g.normalize ? g.normalize : (w = b) === Int8Array || w === Uint8Array, d = g.numComponents || g.size || p(i, h), s = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, s), e.bufferData(e.ARRAY_BUFFER, v, g.drawType || e.STATIC_DRAW) } else { var S = f(g, i); s = l(e, S, void 0, g.drawType), a = r.getGLTypeForTypedArray(S), u = void 0 !== g.normalize ? g.normalize : function (e) { return e instanceof Int8Array || e instanceof Uint8Array }(S), d = m(g, i), h = S.length } n[y] = { buffer: s, numComponents: d, type: a, normalize: u, stride: g.stride || 0, offset: g.offset || 0, divisor: void 0 === g.divisor ? void 0 : g.divisor, drawType: g.drawType } } var w })), e.bindBuffer(e.ARRAY_BUFFER, null), n } var y = ["position", "positions", "a_position"]; function b(e, t, n) { var r = "indices" === n ? e.ELEMENT_ARRAY_BUFFER : e.ARRAY_BUFFER; return l(e, f(t, n), r) } }, function (e, t, n) { "use strict"; t.__esModule = !0, t.setTextureDefaults_ = function (e) { o.copyExistingProperties(e, c), e.textureColor && q(e.textureColor) }, t.createSampler = $, t.createSamplers = function (e, t) { var n = {}; return Object.keys(t).forEach((function (r) { n[r] = $(e, t[r]) })), n }, t.setSamplerParameters = J, t.createTexture = me, t.setEmptyTexture = pe, t.setTextureFromArray = he, t.loadTextureFromUrl = ce, t.setTextureFromElement = ie, t.setTextureFilteringForSize = ee, t.setTextureParameters = Z, t.setDefaultTextureColor = q, t.createTextures = function (e, t, n) { n = n || se; var r = 0, i = [], s = {}, o = {}; function a() { 0 === r && setTimeout((function () { n(i.length ? i : void 0, s, o) }), 0) } return Object.keys(t).forEach((function (n) { var l, c, u = t[n]; ("string" == typeof (c = u.src) || Array.isArray(c) && "string" == typeof c[0]) && (l = function (e, t, s) { o[n] = s, --r, e && i.push(e), a() }, ++r), s[n] = me(e, u, l) })), a(), s }, t.resizeTexture = function (e, t, n, r, i) { r = r || n.width, i = i || n.height; var s = n.target || e.TEXTURE_2D; e.bindTexture(s, t); var o, a = n.level || 0, l = n.internalFormat || n.format || e.RGBA, c = F(l), d = n.format || c.format, h = n.src; if (o = h && (u(h) || Array.isArray(h) && "number" == typeof h[0]) ? n.type || V(e, h, c.type) : n.type || c.type, s === e.TEXTURE_CUBE_MAP) for (var p = 0; p < 6; ++p)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + p, a, l, r, i, 0, d, o, null); else e.texImage2D(s, a, l, r, i, 0, d, o, null) }, t.getNumComponentsForFormat = function (e) { var t = L[e]; if (!t) throw "unknown format: " + e; return t.numColorComponents }, t.getBytesPerElementForInternalFormat = j; var r, i = l(n(4)), s = l(n(1)), o = l(n(0)), a = (r = n(2)) && r.__esModule ? r : { default: r }; function l(e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t } var c = { textureColor: new Uint8Array([128, 192, 255, 255]), textureOptions: {}, crossOrigin: void 0 }, u = s.isArrayBuffer, d = a.default.document && a.default.document.createElement ? a.default.document.createElement("canvas").getContext("2d") : null, h = 6406, p = 6407, m = 6408, f = 6409, g = 6410, y = 6402, b = 34041, v = 5120, S = 5121, w = 5122, k = 5123, T = 5124, x = 5125, E = 5126, A = 5131, C = 36193, I = 33640, O = 33319, M = 33320, N = 6403, R = 36244, D = 36248, P = 36249, L = {}, B = L; B[6406] = { numColorComponents: 1 }, B[6409] = { numColorComponents: 1 }, B[6410] = { numColorComponents: 2 }, B[p] = { numColorComponents: 3 }, B[m] = { numColorComponents: 4 }, B[N] = { numColorComponents: 1 }, B[36244] = { numColorComponents: 1 }, B[O] = { numColorComponents: 2 }, B[33320] = { numColorComponents: 2 }, B[p] = { numColorComponents: 3 }, B[36248] = { numColorComponents: 3 }, B[m] = { numColorComponents: 4 }, B[36249] = { numColorComponents: 4 }, B[6402] = { numColorComponents: 1 }, B[34041] = { numColorComponents: 2 }; var z = {}, U = z; function j(e, t) { var n = z[e]; if (!n) throw "unknown internal format"; var r = n.bytesPerElementMap[t]; if (void 0 === r) throw "unknown internal format"; return r } function F(e) { var t = z[e]; if (!t) throw "unknown internal format"; return { format: t.textureFormat, type: Array.isArray(t.type) ? t.type[0] : t.type } } function W(e) { return !(e & e - 1) } function V(e, t, n) { return u(t) ? s.getGLTypeForTypedArray(t) : n || e.UNSIGNED_BYTE } function G(e, t, n, r, i) { if (i % 1 != 0) throw "can't guess dimensions"; if (n || r) { if (r) { if (!n && (n = i / r) % 1) throw "can't guess dimensions" } else if ((r = i / n) % 1) throw "can't guess dimensions" } else { var s = Math.sqrt(i / (t === e.TEXTURE_CUBE_MAP ? 6 : 1)); s % 1 == 0 ? (n = s, r = s) : (n = i, r = 1) } return { width: n, height: r } } function q(e) { c.textureColor = new Uint8Array([255 * e[0], 255 * e[1], 255 * e[2], 255 * e[3]]) } U[6406] = { textureFormat: h, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [1, 2, 2, 4], type: [S, A, C, E] }, U[6409] = { textureFormat: f, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [1, 2, 2, 4], type: [S, A, C, E] }, U[6410] = { textureFormat: g, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [2, 4, 4, 8], type: [S, A, C, E] }, U[p] = { textureFormat: p, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [3, 6, 6, 12, 2], type: [S, A, C, E, 33635] }, U[m] = { textureFormat: m, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [4, 8, 8, 16, 2, 2], type: [S, A, C, E, 32819, 32820] }, U[33321] = { textureFormat: N, colorRenderable: !0, textureFilterable: !0, bytesPerElement: 1, type: S }, U[36756] = { textureFormat: N, colorRenderable: !1, textureFilterable: !0, bytesPerElement: 1, type: v }, U[33325] = { textureFormat: N, colorRenderable: !1, textureFilterable: !0, bytesPerElement: [4, 2], type: [E, A] }, U[33326] = { textureFormat: N, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 4, type: E }, U[33330] = { textureFormat: R, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 1, type: S }, U[33329] = { textureFormat: R, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 1, type: v }, U[33332] = { textureFormat: R, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 2, type: k }, U[33331] = { textureFormat: R, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 2, type: w }, U[33334] = { textureFormat: R, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: x }, U[33333] = { textureFormat: R, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: T }, U[33323] = { textureFormat: O, colorRenderable: !0, textureFilterable: !0, bytesPerElement: 2, type: S }, U[36757] = { textureFormat: O, colorRenderable: !1, textureFilterable: !0, bytesPerElement: 2, type: v }, U[33327] = { textureFormat: O, colorRenderable: !1, textureFilterable: !0, bytesPerElement: [8, 4], type: [E, A] }, U[33328] = { textureFormat: O, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 8, type: E }, U[33336] = { textureFormat: M, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 2, type: S }, U[33335] = { textureFormat: M, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 2, type: v }, U[33338] = { textureFormat: M, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: k }, U[33337] = { textureFormat: M, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: w }, U[33340] = { textureFormat: M, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 8, type: x }, U[33339] = { textureFormat: M, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 8, type: T }, U[32849] = { textureFormat: p, colorRenderable: !0, textureFilterable: !0, bytesPerElement: 3, type: S }, U[35905] = { textureFormat: p, colorRenderable: !1, textureFilterable: !0, bytesPerElement: 3, type: S }, U[36194] = { textureFormat: p, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [3, 2], type: [S, 33635] }, U[36758] = { textureFormat: p, colorRenderable: !1, textureFilterable: !0, bytesPerElement: 3, type: v }, U[35898] = { textureFormat: p, colorRenderable: !1, textureFilterable: !0, bytesPerElement: [12, 6, 4], type: [E, A, 35899] }, U[35901] = { textureFormat: p, colorRenderable: !1, textureFilterable: !0, bytesPerElement: [12, 6, 4], type: [E, A, 35902] }, U[34843] = { textureFormat: p, colorRenderable: !1, textureFilterable: !0, bytesPerElement: [12, 6], type: [E, A] }, U[34837] = { textureFormat: p, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 12, type: E }, U[36221] = { textureFormat: D, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 3, type: S }, U[36239] = { textureFormat: D, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 3, type: v }, U[36215] = { textureFormat: D, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 6, type: k }, U[36233] = { textureFormat: D, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 6, type: w }, U[36209] = { textureFormat: D, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 12, type: x }, U[36227] = { textureFormat: D, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 12, type: T }, U[32856] = { textureFormat: m, colorRenderable: !0, textureFilterable: !0, bytesPerElement: 4, type: S }, U[35907] = { textureFormat: m, colorRenderable: !0, textureFilterable: !0, bytesPerElement: 4, type: S }, U[36759] = { textureFormat: m, colorRenderable: !1, textureFilterable: !0, bytesPerElement: 4, type: v }, U[32855] = { textureFormat: m, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [4, 2, 4], type: [S, 32820, I] }, U[32854] = { textureFormat: m, colorRenderable: !0, textureFilterable: !0, bytesPerElement: [4, 2], type: [S, 32819] }, U[32857] = { textureFormat: m, colorRenderable: !0, textureFilterable: !0, bytesPerElement: 4, type: I }, U[34842] = { textureFormat: m, colorRenderable: !1, textureFilterable: !0, bytesPerElement: [16, 8], type: [E, A] }, U[34836] = { textureFormat: m, colorRenderable: !1, textureFilterable: !1, bytesPerElement: 16, type: E }, U[36220] = { textureFormat: P, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: S }, U[36238] = { textureFormat: P, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: v }, U[36975] = { textureFormat: P, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: I }, U[36214] = { textureFormat: P, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 8, type: k }, U[36232] = { textureFormat: P, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 8, type: w }, U[36226] = { textureFormat: P, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 16, type: T }, U[36208] = { textureFormat: P, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 16, type: x }, U[33189] = { textureFormat: y, colorRenderable: !0, textureFilterable: !1, bytesPerElement: [2, 4], type: [k, x] }, U[33190] = { textureFormat: y, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: x }, U[36012] = { textureFormat: y, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: E }, U[35056] = { textureFormat: b, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: 34042 }, U[36013] = { textureFormat: b, colorRenderable: !0, textureFilterable: !1, bytesPerElement: 4, type: 36269 }, Object.keys(U).forEach((function (e) { var t = U[e]; if (t.bytesPerElementMap = {}, Array.isArray(t.bytesPerElement)) t.bytesPerElement.forEach((function (e, n) { var r = t.type[n]; t.bytesPerElementMap[r] = e })); else { var n = t.type; t.bytesPerElementMap[n] = t.bytesPerElement } })); var Y = {}; function H(e, t) { void 0 !== t.colorspaceConversion && (Y.colorspaceConversion = e.getParameter(e.UNPACK_COLORSPACE_CONVERSION_WEBGL), e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, t.colorspaceConversion)), void 0 !== t.premultiplyAlpha && (Y.premultiplyAlpha = e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t.premultiplyAlpha)), void 0 !== t.flipY && (Y.flipY = e.getParameter(e.UNPACK_FLIP_Y_WEBGL), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, t.flipY)) } function _(e, t) { void 0 !== t.colorspaceConversion && e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, Y.colorspaceConversion), void 0 !== t.premultiplyAlpha && e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, Y.premultiplyAlpha), void 0 !== t.flipY && e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, Y.flipY) } function K(e) { Y.unpackAlignment = e.getParameter(e.UNPACK_ALIGNMENT), i.isWebGL2(e) && (Y.unpackRowLength = e.getParameter(e.UNPACK_ROW_LENGTH), Y.unpackImageHeight = e.getParameter(e.UNPACK_IMAGE_HEIGHT), Y.unpackSkipPixels = e.getParameter(e.UNPACK_SKIP_PIXELS), Y.unpackSkipRows = e.getParameter(e.UNPACK_SKIP_ROWS), Y.unpackSkipImages = e.getParameter(e.UNPACK_SKIP_IMAGES)) } function Q(e) { e.pixelStorei(e.UNPACK_ALIGNMENT, Y.unpackAlignment), i.isWebGL2(e) && (e.pixelStorei(e.UNPACK_ROW_LENGTH, Y.unpackRowLength), e.pixelStorei(e.UNPACK_IMAGE_HEIGHT, Y.unpackImageHeight), e.pixelStorei(e.UNPACK_SKIP_PIXELS, Y.unpackSkipPixels), e.pixelStorei(e.UNPACK_SKIP_ROWS, Y.unpackSkipRows), e.pixelStorei(e.UNPACK_SKIP_IMAGES, Y.unpackSkipImages)) } function X(e, t, n, r) { r.minMag && (n.call(e, t, e.TEXTURE_MIN_FILTER, r.minMag), n.call(e, t, e.TEXTURE_MAG_FILTER, r.minMag)), r.min && n.call(e, t, e.TEXTURE_MIN_FILTER, r.min), r.mag && n.call(e, t, e.TEXTURE_MAG_FILTER, r.mag), r.wrap && (n.call(e, t, e.TEXTURE_WRAP_S, r.wrap), n.call(e, t, e.TEXTURE_WRAP_T, r.wrap), (t === e.TEXTURE_3D || o.isSampler(e, t)) && n.call(e, t, e.TEXTURE_WRAP_R, r.wrap)), r.wrapR && n.call(e, t, e.TEXTURE_WRAP_R, r.wrapR), r.wrapS && n.call(e, t, e.TEXTURE_WRAP_S, r.wrapS), r.wrapT && n.call(e, t, e.TEXTURE_WRAP_T, r.wrapT), r.minLod && n.call(e, t, e.TEXTURE_MIN_LOD, r.minLod), r.maxLod && n.call(e, t, e.TEXTURE_MAX_LOD, r.maxLod), r.baseLevel && n.call(e, t, e.TEXTURE_BASE_LEVEL, r.baseLevel), r.maxLevel && n.call(e, t, e.TEXTURE_MAX_LEVEL, r.maxLevel) } function Z(e, t, n) { var r = n.target || e.TEXTURE_2D; e.bindTexture(r, t), X(e, r, e.texParameteri, n) } function J(e, t, n) { X(e, t, e.samplerParameteri, n) } function $(e, t) { var n = e.createSampler(); return J(e, n, t), n } function ee(e, t, n, r, s, o, a) { n = n || c.textureOptions, o = o || e.RGBA, a = a || e.UNSIGNED_BYTE; var l = n.target || e.TEXTURE_2D; if (r = r || n.width, s = s || n.height, e.bindTexture(l, t), function (e, t, n, r) { if (!i.isWebGL2(e)) return W(t) && W(n); var s = z[r]; if (!s) throw "unknown internal format"; return s.colorRenderable && s.textureFilterable }(e, r, s, o)) e.generateMipmap(l); else { var u = function (e) { var t = z[e]; if (!t) throw "unknown internal format"; return t.textureFilterable }(o) ? e.LINEAR : e.NEAREST; e.texParameteri(l, e.TEXTURE_MIN_FILTER, u), e.texParameteri(l, e.TEXTURE_MAG_FILTER, u), e.texParameteri(l, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(l, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE) } } function te(e) { return !0 === e.auto || void 0 === e.auto && void 0 === e.level } function ne(e, t) { return (t = t || {}).cubeFaceOrder || [e.TEXTURE_CUBE_MAP_POSITIVE_X, e.TEXTURE_CUBE_MAP_NEGATIVE_X, e.TEXTURE_CUBE_MAP_POSITIVE_Y, e.TEXTURE_CUBE_MAP_NEGATIVE_Y, e.TEXTURE_CUBE_MAP_POSITIVE_Z, e.TEXTURE_CUBE_MAP_NEGATIVE_Z] } function re(e, t) { var n = ne(e, t).map((function (e, t) { return { face: e, ndx: t } })); return n.sort((function (e, t) { return e.face - t.face })), n } function ie(e, t, n, r) { var i = (r = r || c.textureOptions).target || e.TEXTURE_2D, s = r.level || 0, o = n.width, l = n.height, u = r.internalFormat || r.format || e.RGBA, h = F(u), p = r.format || h.format, m = r.type || h.type; if (H(e, r), e.bindTexture(i, t), i === e.TEXTURE_CUBE_MAP) { var f, g, y = n.width, b = n.height; if (y / 6 === b) f = b, g = [0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0]; else if (b / 6 === y) f = y, g = [0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5]; else if (y / 3 == b / 2) f = y / 3, g = [0, 0, 1, 0, 2, 0, 0, 1, 1, 1, 2, 1]; else { if (y / 2 != b / 3) throw "can't figure out cube map from element: " + (n.src ? n.src : n.nodeName); f = y / 2, g = [0, 0, 1, 0, 0, 1, 1, 1, 0, 2, 1, 2] } d ? (d.canvas.width = f, d.canvas.height = f, o = f, l = f, re(e, r).forEach((function (t) { var r = g[2 * t.ndx + 0] * f, i = g[2 * t.ndx + 1] * f; d.drawImage(n, r, i, f, f, 0, 0, f, f), e.texImage2D(t.face, s, u, p, m, d.canvas) })), d.canvas.width = 1, d.canvas.height = 1) : a.default.createImageBitmap && (o = f, l = f, re(e, r).forEach((function (c) { var d = g[2 * c.ndx + 0] * f, h = g[2 * c.ndx + 1] * f; e.texImage2D(c.face, s, u, f, f, 0, p, m, null), a.default.createImageBitmap(n, d, h, f, f, { premultiplyAlpha: "none", colorSpaceConversion: "none" }).then((function (n) { H(e, r), e.bindTexture(i, t), e.texImage2D(c.face, s, u, p, m, n), _(e, r), te(r) && ee(e, t, r, o, l, u, m) })) }))) } else if (i === e.TEXTURE_3D || i === e.TEXTURE_2D_ARRAY) { var v = Math.min(n.width, n.height), S = Math.max(n.width, n.height), w = S / v; if (w % 1 != 0) throw "can not compute 3D dimensions of element"; var k = n.width === S ? 1 : 0, T = n.height === S ? 1 : 0; K(e), e.pixelStorei(e.UNPACK_ALIGNMENT, 1), e.pixelStorei(e.UNPACK_ROW_LENGTH, n.width), e.pixelStorei(e.UNPACK_IMAGE_HEIGHT, 0), e.pixelStorei(e.UNPACK_SKIP_IMAGES, 0), e.texImage3D(i, s, u, v, v, v, 0, p, m, null); for (var x = 0; x < w; ++x) { var E = x * v * k, A = x * v * T; e.pixelStorei(e.UNPACK_SKIP_PIXELS, E), e.pixelStorei(e.UNPACK_SKIP_ROWS, A), e.texSubImage3D(i, s, 0, 0, x, v, v, 1, p, m, n) } Q(e) } else e.texImage2D(i, s, u, p, m, n); _(e, r), te(r) && ee(e, t, r, o, l, u, m), Z(e, t, r) } function se() { } function oe(e) { return a.default.ImageBitmap && e instanceof a.default.ImageBitmap || a.default.ImageData && e instanceof a.default.ImageData || a.default.HTMLElement && e instanceof a.default.HTMLElement } function ae(e, t, n) { return oe(e) ? (setTimeout((function () { n(null, e) })), e) : function (e, t, n) { var r; if (n = n || se, a.default.Image) { r = new a.default.Image, void 0 !== (t = void 0 !== t ? t : c.crossOrigin) && (r.crossOrigin = t); var i = function () { r.removeEventListener("error", s), r.removeEventListener("load", l), r = null }, s = function () { var t = "couldn't load image: " + e; o.error(t), n(t, r), i() }, l = function () { n(null, r), i() }; return r.addEventListener("error", s), r.addEventListener("load", l), r.src = e, r } if (a.default.ImageBitmap) { var u, d, h = function () { n(u, d) }, p = {}; t && (p.mode = "cors"), fetch(e, p).then((function (e) { if (!e.ok) throw e; return e.blob() })).then((function (e) { return a.default.createImageBitmap(e, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) })).then((function (e) { d = e, setTimeout(h) })).catch((function (e) { u = e, setTimeout(h) })), r = null } return r }(e, t, n) } function le(e, t, n) { var r = (n = n || c.textureOptions).target || e.TEXTURE_2D; if (e.bindTexture(r, t), !1 !== n.color) { var i = function (e) { return e = e || c.textureColor, u(e) ? e : new Uint8Array([255 * e[0], 255 * e[1], 255 * e[2], 255 * e[3]]) }(n.color); if (r === e.TEXTURE_CUBE_MAP) for (var s = 0; s < 6; ++s)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + s, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, i); else r === e.TEXTURE_3D || r === e.TEXTURE_2D_ARRAY ? e.texImage3D(r, 0, e.RGBA, 1, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, i) : e.texImage2D(r, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, i) } } function ce(e, t, n, r) { return r = r || se, n = n || c.textureOptions, le(e, t, n), ae((n = Object.assign({}, n)).src, n.crossOrigin, (function (i, s) { i ? r(i, t, s) : (ie(e, t, s, n), r(null, t, s)) })) } function ue(e, t, n, r) { r = r || se; var i = n.src; if (6 !== i.length) throw "there must be 6 urls for a cubemap"; var s = n.level || 0, o = n.internalFormat || n.format || e.RGBA, a = F(o), l = n.format || a.format, c = n.type || e.UNSIGNED_BYTE, u = n.target || e.TEXTURE_2D; if (u !== e.TEXTURE_CUBE_MAP) throw "target must be TEXTURE_CUBE_MAP"; le(e, t, n), n = Object.assign({}, n); var d, h = 6, p = [], m = ne(e, n); d = i.map((function (i, a) { return ae(i, n.crossOrigin, (f = m[a], function (i, a) { --h, i ? p.push(i) : a.width !== a.height ? p.push("cubemap face img is not a square: " + a.src) : (H(e, n), e.bindTexture(u, t), 5 === h ? ne(e).forEach((function (t) { e.texImage2D(t, s, o, l, c, a) })) : e.texImage2D(f, s, o, l, c, a), _(e, n), te(n) && e.generateMipmap(u)), 0 === h && r(p.length ? p : void 0, t, d) })); var f })) } function de(e, t, n, r) { r = r || se; var i = n.src, s = n.internalFormat || n.format || e.RGBA, o = F(s), a = n.format || o.format, l = n.type || e.UNSIGNED_BYTE, c = n.target || e.TEXTURE_2D_ARRAY; if (c !== e.TEXTURE_3D && c !== e.TEXTURE_2D_ARRAY) throw "target must be TEXTURE_3D or TEXTURE_2D_ARRAY"; le(e, t, n), n = Object.assign({}, n); var u, h = i.length, p = [], m = n.level || 0, f = n.width, g = n.height, y = i.length, b = !0; u = i.map((function (i, o) { return ae(i, n.crossOrigin, (v = o, function (i, o) { if (--h, i) p.push(i); else { if (H(e, n), e.bindTexture(c, t), b) { b = !1, f = n.width || o.width, g = n.height || o.height, e.texImage3D(c, m, s, f, g, y, 0, a, l, null); for (var S = 0; S < y; ++S)e.texSubImage3D(c, m, 0, 0, S, f, g, 1, a, l, o) } else { var w = o; o.width === f && o.height === g || (w = d.canvas, d.canvas.width = f, d.canvas.height = g, d.drawImage(o, 0, 0, f, g)), e.texSubImage3D(c, m, 0, 0, v, f, g, 1, a, l, w), w === d.canvas && (d.canvas.width = 0, d.canvas.height = 0) } _(e, n), te(n) && e.generateMipmap(c) } 0 === h && r(p.length ? p : void 0, t, u) })); var v })) } function he(e, t, n, r) { var o = (r = r || c.textureOptions).target || e.TEXTURE_2D; e.bindTexture(o, t); var a = r.width, l = r.height, d = r.depth, h = r.level || 0, p = r.internalFormat || r.format || e.RGBA, m = F(p), f = r.format || m.format, g = r.type || V(e, n, m.type); if (u(n)) n instanceof Uint8ClampedArray && (n = new Uint8Array(n.buffer)); else { var y = s.getTypedArrayTypeForGLType(g); n = new y(n) } var b, v = j(p, g), S = n.byteLength / v; if (S % 1) throw "length wrong size for format: " + i.glEnumToString(e, f); if (o === e.TEXTURE_3D) if (a || l || d) !a || l && d ? !l || a && d ? (b = G(e, o, a, l, S / d), a = b.width, l = b.height) : (b = G(e, o, a, d, S / l), a = b.width, d = b.height) : (b = G(e, o, l, d, S / a), l = b.width, d = b.height); else { var w = Math.cbrt(S); if (w % 1 != 0) throw "can't guess cube size of array of numElements: " + S; a = w, l = w, d = w } else b = G(e, o, a, l, S), a = b.width, l = b.height; if (K(e), e.pixelStorei(e.UNPACK_ALIGNMENT, r.unpackAlignment || 1), H(e, r), o === e.TEXTURE_CUBE_MAP) { var k = S / 6 * (v / n.BYTES_PER_ELEMENT); re(e, r).forEach((function (t) { var r = k * t.ndx, i = n.subarray(r, r + k); e.texImage2D(t.face, h, p, a, l, 0, f, g, i) })) } else o === e.TEXTURE_3D ? e.texImage3D(o, h, p, a, l, d, 0, f, g, n) : e.texImage2D(o, h, p, a, l, 0, f, g, n); return _(e, r), Q(e), { width: a, height: l, depth: d, type: g } } function pe(e, t, n) { var r = n.target || e.TEXTURE_2D; e.bindTexture(r, t); var i = n.level || 0, s = n.internalFormat || n.format || e.RGBA, o = F(s), a = n.format || o.format, l = n.type || o.type; if (H(e, n), r === e.TEXTURE_CUBE_MAP) for (var c = 0; c < 6; ++c)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + c, i, s, n.width, n.height, 0, a, l, null); else r === e.TEXTURE_3D ? e.texImage3D(r, i, s, n.width, n.height, n.depth, 0, a, l, null) : e.texImage2D(r, i, s, n.width, n.height, 0, a, l, null); _(e, n) } function me(e, t, n) { n = n || se, t = t || c.textureOptions; var r = e.createTexture(), i = t.target || e.TEXTURE_2D, s = t.width || 1, o = t.height || 1, a = t.internalFormat || e.RGBA, l = F(a), d = t.type || l.type; e.bindTexture(i, r), i === e.TEXTURE_CUBE_MAP && (e.texParameteri(i, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(i, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE)); var h = t.src; if (h) if ("function" == typeof h && (h = h(e, t)), "string" == typeof h) ce(e, r, t, n); else if (u(h) || Array.isArray(h) && ("number" == typeof h[0] || Array.isArray(h[0]) || u(h[0]))) { var p = he(e, r, h, t); s = p.width, o = p.height, d = p.type } else if (Array.isArray(h) && ("string" == typeof h[0] || oe(h[0]))) i === e.TEXTURE_CUBE_MAP ? ue(e, r, t, n) : de(e, r, t, n); else { if (!oe(h)) throw "unsupported src type"; ie(e, r, h, t), s = h.width, o = h.height } else pe(e, r, t); return te(t) && ee(e, r, t, s, o, a, d), Z(e, r, t), r } }, function (e, t, n) { "use strict"; t.__esModule = !0; var r = { m4: !0, v3: !0, primitives: !0 }; t.primitives = t.v3 = t.m4 = void 0; var i = l(n(6)); t.m4 = i; var s = l(n(3)); t.v3 = s; var o = l(n(10)); t.primitives = o; var a = n(11); function l(e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t } Object.keys(a).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = a[e])) })) }, function (e, t, n) { "use strict"; t.__esModule = !0, t.create3DFVertices = C, t.createAugmentedTypedArray = h, t.createCubeVertices = x, t.createPlaneVertices = w, t.createSphereVertices = k, t.createTruncatedConeVertices = E, t.createXYQuadVertices = S, t.createCresentVertices = I, t.createCylinderVertices = O, t.createTorusVertices = M, t.createDiscVertices = N, t.deindexVertices = function (e) { var t = e.indices, n = {}, r = t.length; return Object.keys(e).filter(p).forEach((function (i) { for (var s = e[i], o = s.numComponents, a = h(o, r, s.constructor), l = 0; l < r; ++l)for (var c = t[l] * o, u = 0; u < o; ++u)a.push(s[c + u]); n[i] = a })), n }, t.flattenNormals = function (e) { if (e.indices) throw "can't flatten normals of indexed vertices. deindex them first"; for (var t = e.normal, n = t.length, r = 0; r < n; r += 9) { var i = t[r + 0], s = t[r + 1], o = t[r + 2], a = t[r + 3], l = t[r + 4], c = t[r + 5], u = i + a + t[r + 6], d = s + l + t[r + 7], h = o + c + t[r + 8], p = Math.sqrt(u * u + d * d + h * h); u /= p, d /= p, h /= p, t[r + 0] = u, t[r + 1] = d, t[r + 2] = h, t[r + 3] = u, t[r + 4] = d, t[r + 5] = h, t[r + 6] = u, t[r + 7] = d, t[r + 8] = h } return e }, t.makeRandomVertexColors = function (e, t) { t = t || {}; var n = e.position.numElements, r = h(4, n, Uint8Array), i = t.rand || function (e, t) { return t < 3 ? (n = 256, Math.random() * n | 0) : 255; var n }; if (e.color = r, e.indices) for (var s = 0; s < n; ++s)r.push(i(s, 0), i(s, 1), i(s, 2), i(s, 3)); else for (var o = t.vertsPerColor || 3, a = n / o, l = 0; l < a; ++l)for (var c = [i(l, 0), i(l, 1), i(l, 2), i(l, 3)], u = 0; u < o; ++u)r.push(c); return e }, t.reorientDirections = g, t.reorientNormals = y, t.reorientPositions = b, t.reorientVertices = v, t.concatVertices = function (e) { for (var t, n = {}, r = function (r) { var i = e[r]; Object.keys(i).forEach((function (e) { n[e] || (n[e] = []), t || "indices" === e || (t = e); var r = i[e], s = u(r, e), o = c(r).length / s; n[e].push(o) })) }, i = 0; i < e.length; ++i)r(i); var s = n[t], o = {}; return Object.keys(n).forEach((function (t) { var n = function (t) { for (var n, r = 0, i = 0; i < e.length; ++i) { var s = e[i][t]; r += c(s).length, n && !s.data || (n = s) } return { length: r, spec: n } }(t), r = B(n.spec, n.length); !function (t, n, r) { for (var i = 0, s = 0, o = 0; o < e.length; ++o) { var a = e[o][t], l = c(a); "indices" === t ? (L(l, r, s, i), i += n[o]) : L(l, r, s), s += l.length } }(t, s, c(r)), o[t] = r })), o }, t.duplicateVertices = function (e) { var t = {}; return Object.keys(e).forEach((function (n) { var r = e[n], i = c(r), s = B(r, i.length); L(i, c(s), 0), t[n] = s })), t }, t.createDiscBuffers = t.createDiscBufferInfo = t.createTorusBuffers = t.createTorusBufferInfo = t.createCylinderBuffers = t.createCylinderBufferInfo = t.createCresentBuffers = t.createCresentBufferInfo = t.createXYQuadBuffers = t.createXYQuadBufferInfo = t.createTruncatedConeBuffers = t.createTruncatedConeBufferInfo = t.createSphereBuffers = t.createSphereBufferInfo = t.createPlaneBuffers = t.createPlaneBufferInfo = t.createCubeBuffers = t.createCubeBufferInfo = t.create3DFBuffers = t.create3DFBufferInfo = void 0; var r = l(n(7)), i = l(n(0)), s = l(n(1)), o = l(n(6)), a = l(n(3)); function l(e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t } var c = r.getArray_, u = r.getNumComponents_; function d(e, t) { var n = 0; return e.push = function () { for (var t = 0; t < arguments.length; ++t) { var r = arguments[t]; if (r instanceof Array || s.isArrayBuffer(r)) for (var i = 0; i < r.length; ++i)e[n++] = r[i]; else e[n++] = r } }, e.reset = function (e) { n = e || 0 }, e.numComponents = t, Object.defineProperty(e, "numElements", { get: function () { return this.length / this.numComponents | 0 } }), e } function h(e, t, n) { return d(new (n || Float32Array)(e * t), e) } function p(e) { return "indices" !== e } function m(e, t, n) { for (var r = e.length, i = new Float32Array(3), s = 0; s < r; s += 3)n(t, [e[s], e[s + 1], e[s + 2]], i), e[s] = i[0], e[s + 1] = i[1], e[s + 2] = i[2] } function f(e, t, n) { n = n || a.create(); var r = t[0], i = t[1], s = t[2]; return n[0] = r * e[0] + i * e[1] + s * e[2], n[1] = r * e[4] + i * e[5] + s * e[6], n[2] = r * e[8] + i * e[9] + s * e[10], n } function g(e, t) { return m(e, t, o.transformDirection), e } function y(e, t) { return m(e, o.inverse(t), f), e } function b(e, t) { return m(e, t, o.transformPoint), e } function v(e, t) { return Object.keys(e).forEach((function (n) { var r = e[n]; n.indexOf("pos") >= 0 ? b(r, t) : n.indexOf("tan") >= 0 || n.indexOf("binorm") >= 0 ? g(r, t) : n.indexOf("norm") >= 0 && y(r, t) })), e } function S(e, t, n) { return e = e || 2, { position: { numComponents: 2, data: [(t = t || 0) + -1 * (e *= .5), (n = n || 0) + -1 * e, t + 1 * e, n + -1 * e, t + -1 * e, n + 1 * e, t + 1 * e, n + 1 * e] }, normal: [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], texcoord: [0, 0, 1, 0, 0, 1, 1, 1], indices: [0, 1, 2, 2, 1, 3] } } function w(e, t, n, r, i) { e = e || 1, t = t || 1, n = n || 1, r = r || 1, i = i || o.identity(); for (var s = (n + 1) * (r + 1), a = h(3, s), l = h(3, s), c = h(2, s), u = 0; u <= r; u++)for (var d = 0; d <= n; d++) { var p = d / n, m = u / r; a.push(e * p - .5 * e, 0, t * m - .5 * t), l.push(0, 1, 0), c.push(p, m) } for (var f = n + 1, g = h(3, n * r * 2, Uint16Array), y = 0; y < r; y++)for (var b = 0; b < n; b++)g.push((y + 0) * f + b, (y + 1) * f + b, (y + 0) * f + b + 1), g.push((y + 1) * f + b, (y + 1) * f + b + 1, (y + 0) * f + b + 1); return v({ position: a, normal: l, texcoord: c, indices: g }, i) } function k(e, t, n, r, i, s, o) { if (t <= 0 || n <= 0) throw Error("subdivisionAxis and subdivisionHeight must be > 0"); r = r || 0, s = s || 0; for (var a = (i = i || Math.PI) - r, l = (o = o || 2 * Math.PI) - s, c = (t + 1) * (n + 1), u = h(3, c), d = h(3, c), p = h(2, c), m = 0; m <= n; m++)for (var f = 0; f <= t; f++) { var g = f / t, y = m / n, b = l * g, v = a * y, S = Math.sin(b), w = Math.cos(b), k = Math.sin(v), T = w * k, x = Math.cos(v), E = S * k; u.push(e * T, e * x, e * E), d.push(T, x, E), p.push(1 - g, y) } for (var A = t + 1, C = h(3, t * n * 2, Uint16Array), I = 0; I < t; I++)for (var O = 0; O < n; O++)C.push((O + 0) * A + I, (O + 0) * A + I + 1, (O + 1) * A + I), C.push((O + 1) * A + I, (O + 0) * A + I + 1, (O + 1) * A + I + 1); return { position: u, normal: d, texcoord: p, indices: C } } var T = [[3, 7, 5, 1], [6, 2, 0, 4], [6, 7, 3, 2], [0, 1, 5, 4], [7, 6, 4, 5], [2, 3, 1, 0]]; function x(e) { for (var t = (e = e || 1) / 2, n = [[-t, -t, -t], [+t, -t, -t], [-t, +t, -t], [+t, +t, -t], [-t, -t, +t], [+t, -t, +t], [-t, +t, +t], [+t, +t, +t]], r = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], i = [[1, 0], [0, 0], [0, 1], [1, 1]], s = h(3, 24), o = h(3, 24), a = h(2, 24), l = h(3, 12, Uint16Array), c = 0; c < 6; ++c) { for (var u = T[c], d = 0; d < 4; ++d) { var p = n[u[d]], m = r[c], f = i[d]; s.push(p), o.push(m), a.push(f) } var g = 4 * c; l.push(g + 0, g + 1, g + 2), l.push(g + 0, g + 2, g + 3) } return { position: s, normal: o, texcoord: a, indices: l } } function E(e, t, n, r, i, s, o) { if (r < 3) throw Error("radialSubdivisions must be 3 or greater"); if (i < 1) throw Error("verticalSubdivisions must be 1 or greater"); for (var a = void 0 === s || s, l = void 0 === o || o, c = (a ? 2 : 0) + (l ? 2 : 0), u = (r + 1) * (i + 1 + c), d = h(3, u), p = h(3, u), m = h(2, u), f = h(3, r * (i + c) * 2, Uint16Array), g = r + 1, y = Math.atan2(e - t, n), b = Math.cos(y), v = Math.sin(y), S = i + (l ? 2 : 0), w = a ? -2 : 0; w <= S; ++w) { var k = w / i, T = n * k, x = void 0; w < 0 ? (T = 0, k = 1, x = e) : w > i ? (T = n, k = 1, x = t) : x = e + w / i * (t - e), -2 !== w && w !== i + 2 || (x = 0, k = 0), T -= n / 2; for (var E = 0; E < g; ++E) { var A = Math.sin(E * Math.PI * 2 / r), C = Math.cos(E * Math.PI * 2 / r); d.push(A * x, T, C * x), p.push(w < 0 || w > i ? 0 : A * b, w < 0 ? -1 : w > i ? 1 : v, w < 0 || w > i ? 0 : C * b), m.push(E / r, 1 - k) } } for (var I = 0; I < i + c; ++I)for (var O = 0; O < r; ++O)f.push(g * (I + 0) + 0 + O, g * (I + 0) + 1 + O, g * (I + 1) + 1 + O), f.push(g * (I + 0) + 0 + O, g * (I + 1) + 1 + O, g * (I + 1) + 0 + O); return { position: d, normal: p, texcoord: m, indices: f } } function A(e, t) { t = t || []; for (var n = [], r = 0; r < e.length; r += 4) { var i = e[r], s = e.slice(r + 1, r + 4); s.push.apply(s, t); for (var o = 0; o < i; ++o)n.push.apply(n, s) } return n } function C() { var e = [0, 0, 0, 0, 150, 0, 30, 0, 0, 0, 150, 0, 30, 150, 0, 30, 0, 0, 30, 0, 0, 30, 30, 0, 100, 0, 0, 30, 30, 0, 100, 30, 0, 100, 0, 0, 30, 60, 0, 30, 90, 0, 67, 60, 0, 30, 90, 0, 67, 90, 0, 67, 60, 0, 0, 0, 30, 30, 0, 30, 0, 150, 30, 0, 150, 30, 30, 0, 30, 30, 150, 30, 30, 0, 30, 100, 0, 30, 30, 30, 30, 30, 30, 30, 100, 0, 30, 100, 30, 30, 30, 60, 30, 67, 60, 30, 30, 90, 30, 30, 90, 30, 67, 60, 30, 67, 90, 30, 0, 0, 0, 100, 0, 0, 100, 0, 30, 0, 0, 0, 100, 0, 30, 0, 0, 30, 100, 0, 0, 100, 30, 0, 100, 30, 30, 100, 0, 0, 100, 30, 30, 100, 0, 30, 30, 30, 0, 30, 30, 30, 100, 30, 30, 30, 30, 0, 100, 30, 30, 100, 30, 0, 30, 30, 0, 30, 60, 30, 30, 30, 30, 30, 30, 0, 30, 60, 0, 30, 60, 30, 30, 60, 0, 67, 60, 30, 30, 60, 30, 30, 60, 0, 67, 60, 0, 67, 60, 30, 67, 60, 0, 67, 90, 30, 67, 60, 30, 67, 60, 0, 67, 90, 0, 67, 90, 30, 30, 90, 0, 30, 90, 30, 67, 90, 30, 30, 90, 0, 67, 90, 30, 67, 90, 0, 30, 90, 0, 30, 150, 30, 30, 90, 30, 30, 90, 0, 30, 150, 0, 30, 150, 30, 0, 150, 0, 0, 150, 30, 30, 150, 30, 0, 150, 0, 30, 150, 30, 30, 150, 0, 0, 0, 0, 0, 0, 30, 0, 150, 30, 0, 0, 0, 0, 150, 30, 0, 150, 0], t = A([18, 0, 0, 1, 18, 0, 0, -1, 6, 0, 1, 0, 6, 1, 0, 0, 6, 0, -1, 0, 6, 1, 0, 0, 6, 0, 1, 0, 6, 1, 0, 0, 6, 0, -1, 0, 6, 1, 0, 0, 6, 0, -1, 0, 6, -1, 0, 0]), n = A([18, 200, 70, 120, 18, 80, 70, 200, 6, 70, 200, 210, 6, 200, 200, 70, 6, 210, 100, 70, 6, 210, 160, 70, 6, 70, 180, 210, 6, 100, 70, 210, 6, 76, 210, 100, 6, 140, 210, 80, 6, 90, 130, 110, 6, 160, 160, 220], [255]), r = e.length / 3, i = { position: h(3, r), texcoord: h(2, r), normal: h(3, r), color: h(4, r, Uint8Array), indices: h(3, r / 3, Uint16Array) }; i.position.push(e), i.texcoord.push([.22, .19, .22, .79, .34, .19, .22, .79, .34, .79, .34, .19, .34, .19, .34, .31, .62, .19, .34, .31, .62, .31, .62, .19, .34, .43, .34, .55, .49, .43, .34, .55, .49, .55, .49, .43, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0]), i.normal.push(t), i.color.push(n); for (var s = 0; s < r; ++s)i.indices.push(s); return i } function I(e, t, n, r, i, s, o) { if (i <= 0) throw Error("subdivisionDown must be > 0"); var l = (o = o || 1) - (s = s || 0), c = 2 * (i + 1) * 4, u = h(3, c), d = h(3, c), p = h(2, c); function m(e, t, n) { return e + (t - e) * n } function f(t, n, o, c, h, f) { for (var g = 0; g <= i; g++) { var y = n / 1, b = g / i, v = 2 * (y - .5), S = (s + b * l) * Math.PI, w = Math.sin(S), k = Math.cos(S), T = m(e, t, w), x = v * r, E = k * e, A = w * T; u.push(x, E, A); var C = a.add(a.multiply([0, w, k], o), c); d.push(C), p.push(y * h + f, b) } } for (var g = 0; g < 2; g++) { var y = 2 * (g / 1 - .5); f(t, g, [1, 1, 1], [0, 0, 0], 1, 0), f(t, g, [0, 0, 0], [y, 0, 0], 0, 0), f(n, g, [1, 1, 1], [0, 0, 0], 1, 0), f(n, g, [0, 0, 0], [y, 0, 0], 0, 1) } var b = h(3, 2 * i * 4, Uint16Array); function v(e, t) { for (var n = 0; n < i; ++n)b.push(e + n + 0, e + n + 1, t + n + 0), b.push(e + n + 1, t + n + 1, t + n + 0) } var S = i + 1; return v(0 * S, 4 * S), v(5 * S, 7 * S), v(6 * S, 2 * S), v(3 * S, 1 * S), { position: u, normal: d, texcoord: p, indices: b } } function O(e, t, n, r, i, s) { return E(e, e, t, n, r, i, s) } function M(e, t, n, r, i, s) { if (n < 3) throw Error("radialSubdivisions must be 3 or greater"); if (r < 3) throw Error("verticalSubdivisions must be 3 or greater"); i = i || 0; for (var o = (s = s || 2 * Math.PI) - i, a = n + 1, l = r + 1, c = a * l, u = h(3, c), d = h(3, c), p = h(2, c), m = h(3, n * r * 2, Uint16Array), f = 0; f < l; ++f)for (var g = f / r, y = g * Math.PI * 2, b = Math.sin(y), v = e + b * t, S = Math.cos(y), w = S * t, k = 0; k < a; ++k) { var T = k / n, x = i + T * o, E = Math.sin(x), A = Math.cos(x), C = E * v, I = A * v, O = E * b, M = A * b; u.push(C, w, I), d.push(O, S, M), p.push(T, 1 - g) } for (var N = 0; N < r; ++N)for (var R = 0; R < n; ++R) { var D = 1 + R, P = 1 + N; m.push(a * N + R, a * P + R, a * N + D), m.push(a * P + R, a * P + D, a * N + D) } return { position: u, normal: d, texcoord: p, indices: m } } function N(e, t, n, r, i) { if (t < 3) throw Error("divisions must be at least 3"); i = i || 1, r = r || 0; for (var s = (t + 1) * ((n = n || 1) + 1), o = h(3, s), a = h(3, s), l = h(2, s), c = h(3, n * t * 2, Uint16Array), u = 0, d = e - r, p = t + 1, m = 0; m <= n; ++m) { for (var f = r + d * Math.pow(m / n, i), g = 0; g <= t; ++g) { var y = 2 * Math.PI * g / t, b = f * Math.cos(y), v = f * Math.sin(y); if (o.push(b, 0, v), a.push(0, 1, 0), l.push(1 - g / t, m / n), m > 0 && g !== t) { var S = u + (g + 1), w = u + g, k = u + g - p, T = u + (g + 1) - p; c.push(S, w, k), c.push(S, k, T) } } u += t + 1 } return { position: o, normal: a, texcoord: l, indices: c } } function R(e) { return function (t) { var n = e.apply(this, Array.prototype.slice.call(arguments, 1)); return r.createBuffersFromArrays(t, n) } } function D(e) { return function (t) { var n = e.apply(null, Array.prototype.slice.call(arguments, 1)); return r.createBufferInfoFromArrays(t, n) } } var P = ["numComponents", "size", "type", "normalize", "stride", "offset", "attrib", "name", "attribName"]; function L(e, t, n, r) { r = r || 0; for (var i = e.length, s = 0; s < i; ++s)t[n + s] = e[s] + r } function B(e, t) { var n = c(e), r = new n.constructor(t), s = r; return n.numComponents && n.numElements && d(r, n.numComponents), e.data && (s = { data: r }, i.copyNamedProperties(P, e, s)), s } var z = D(C); t.create3DFBufferInfo = z; var U = R(C); t.create3DFBuffers = U; var j = D(x); t.createCubeBufferInfo = j; var F = R(x); t.createCubeBuffers = F; var W = D(w); t.createPlaneBufferInfo = W; var V = R(w); t.createPlaneBuffers = V; var G = D(k); t.createSphereBufferInfo = G; var q = R(k); t.createSphereBuffers = q; var Y = D(E); t.createTruncatedConeBufferInfo = Y; var H = R(E); t.createTruncatedConeBuffers = H; var _ = D(S); t.createXYQuadBufferInfo = _; var K = R(S); t.createXYQuadBuffers = K; var Q = D(I); t.createCresentBufferInfo = Q; var X = R(I); t.createCresentBuffers = X; var Z = D(O); t.createCylinderBufferInfo = Z; var J = R(O); t.createCylinderBuffers = J; var $ = D(M); t.createTorusBufferInfo = $; var ee = R(M); t.createTorusBuffers = ee; var te = D(N); t.createDiscBufferInfo = te; var ne = R(N); t.createDiscBuffers = ne }, function (e, t, n) { "use strict"; t.__esModule = !0; var r = { addExtensionsToContext: !0, getContext: !0, getWebGLContext: !0, resizeCanvasToDisplaySize: !0, setDefaults: !0 }; t.addExtensionsToContext = b, t.getContext = function (e, t) { var n = function (e, t) { for (var n = ["webgl2", "webgl", "experimental-webgl"], r = null, i = 0; i < n.length; ++i)if (r = e.getContext(n[i], t)) { m.addExtensionsToContext && b(r); break } return r }(e, t); return n }, t.getWebGLContext = function (e, t) { var n = function (e, t) { for (var n = ["webgl", "experimental-webgl"], r = null, i = 0; i < n.length; ++i)if (r = e.getContext(n[i], t)) { m.addExtensionsToContext && b(r); break } return r }(e, t); return n }, t.resizeCanvasToDisplaySize = function (e, t) { t = t || 1, t = Math.max(0, t); var n = e.clientWidth * t | 0, r = e.clientHeight * t | 0; return (e.width !== n || e.height !== r) && (e.width = n, e.height = r, !0) }, t.setDefaults = function (e) { o.copyExistingProperties(e, m), i.setAttributeDefaults_(e), s.setTextureDefaults_(e) }; var i = p(n(7)); Object.keys(i).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = i[e])) })); var s = p(n(8)); Object.keys(s).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = s[e])) })); var o = p(n(0)), a = p(n(4)); Object.keys(a).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = a[e])) })); var l = n(12); Object.keys(l).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = l[e])) })); var c = n(13); Object.keys(c).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = c[e])) })); var u = n(5); Object.keys(u).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = u[e])) })); var d = n(1); Object.keys(d).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = d[e])) })); var h = n(14); function p(e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t } Object.keys(h).forEach((function (e) { "default" !== e && "__esModule" !== e && (Object.prototype.hasOwnProperty.call(r, e) || (t[e] = h[e])) })); var m = { addExtensionsToContext: !0 }, f = /^(.*?)_/; function g(e, t) { a.glEnumToString(e, 0); var n = e.getExtension(t); if (n) { var r = {}, i = f.exec(t)[1], s = "_" + i; for (var l in n) { var c = n[l], u = "function" == typeof c, d = u ? i : s, h = l; l.endsWith(d) && (h = l.substring(0, l.length - d.length)), void 0 !== e[h] ? u || e[h] === c || o.warn(h, e[h], c, l) : u ? e[h] = function (e) { return function () { return e.apply(n, arguments) } }(c) : (e[h] = c, r[h] = c) } r.constructor = { name: n.constructor.name }, a.glEnumToString(r, 0) } return n } var y = ["ANGLE_instanced_arrays", "EXT_blend_minmax", "EXT_color_buffer_float", "EXT_color_buffer_half_float", "EXT_disjoint_timer_query", "EXT_disjoint_timer_query_webgl2", "EXT_frag_depth", "EXT_sRGB", "EXT_shader_texture_lod", "EXT_texture_filter_anisotropic", "OES_element_index_uint", "OES_standard_derivatives", "OES_texture_float", "OES_texture_float_linear", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_vertex_array_object", "WEBGL_color_buffer_float", "WEBGL_compressed_texture_atc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb", "WEBGL_depth_texture", "WEBGL_draw_buffers"]; function b(e) { for (var t = 0; t < y.length; ++t)g(e, y[t]) } }, function (e, t, n) { "use strict"; t.__esModule = !0, t.drawBufferInfo = i, t.drawObjectList = function (e, t) { var n = null, s = null; t.forEach((function (t) { if (!1 !== t.active) { var o = t.programInfo, a = t.vertexArrayInfo || t.bufferInfo, l = !1, c = void 0 === t.type ? e.TRIANGLES : t.type; o !== n && (n = o, e.useProgram(o.program), l = !0), (l || a !== s) && (s && s.vertexArrayObject && !a.vertexArrayObject && e.bindVertexArray(null), s = a, r.setBuffersAndAttributes(e, o, a)), r.setUniforms(o, t.uniforms), i(e, a, c, t.count, t.offset, t.instanceCount) } })), s.vertexArrayObject && e.bindVertexArray(null) }; var r = function (e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t }(n(5)); function i(e, t, n, r, i, s) { n = void 0 === n ? e.TRIANGLES : n; var o = t.indices, a = t.elementType, l = void 0 === r ? t.numElements : r; i = void 0 === i ? 0 : i, a || o ? void 0 !== s ? e.drawElementsInstanced(n, l, void 0 === a ? e.UNSIGNED_SHORT : t.elementType, i, s) : e.drawElements(n, l, void 0 === a ? e.UNSIGNED_SHORT : t.elementType, i) : void 0 !== s ? e.drawArraysInstanced(n, i, l, s) : e.drawArrays(n, i, l) } }, function (e, t, n) { "use strict"; t.__esModule = !0, t.bindFramebufferInfo = function (e, t, n) { n = n || e.FRAMEBUFFER, t ? (e.bindFramebuffer(n, t.framebuffer), e.viewport(0, 0, t.width, t.height)) : (e.bindFramebuffer(n, null), e.viewport(0, 0, e.drawingBufferWidth, e.drawingBufferHeight)) }, t.createFramebufferInfo = function (e, t, n, s) { var o = e.FRAMEBUFFER, d = e.createFramebuffer(); e.bindFramebuffer(o, d), n = n || e.drawingBufferWidth, s = s || e.drawingBufferHeight; var h = 0, p = { framebuffer: d, attachments: [], width: n, height: s }; return (t = t || l).forEach((function (t) { var l = t.attachment, d = t.format, m = function (e) { return c[e] }(d); if (m || (m = a + h++), !l) if (function (e) { return u[e] }(d)) l = e.createRenderbuffer(), e.bindRenderbuffer(e.RENDERBUFFER, l), e.renderbufferStorage(e.RENDERBUFFER, d, n, s); else { var f = Object.assign({}, t); f.width = n, f.height = s, void 0 === f.auto && (f.auto = !1, f.min = f.min || f.minMag || e.LINEAR, f.mag = f.mag || f.minMag || e.LINEAR, f.wrapS = f.wrapS || f.wrap || e.CLAMP_TO_EDGE, f.wrapT = f.wrapT || f.wrap || e.CLAMP_TO_EDGE), l = r.createTexture(e, f) } if (i.isRenderbuffer(e, l)) e.framebufferRenderbuffer(o, m, e.RENDERBUFFER, l); else { if (!i.isTexture(e, l)) throw "unknown attachment type"; e.framebufferTexture2D(o, m, t.texTarget || e.TEXTURE_2D, l, t.level || 0) } p.attachments.push(l) })), p }, t.resizeFramebufferInfo = function (e, t, n, s, o) { s = s || e.drawingBufferWidth, o = o || e.drawingBufferHeight, t.width = s, t.height = o, (n = n || l).forEach((function (n, a) { var l = t.attachments[a], c = n.format; if (i.isRenderbuffer(e, l)) e.bindRenderbuffer(e.RENDERBUFFER, l), e.renderbufferStorage(e.RENDERBUFFER, c, s, o); else { if (!i.isTexture(e, l)) throw "unknown attachment type"; r.resizeTexture(e, l, n, s, o) } })) }; var r = s(n(8)), i = s(n(0)); function s(e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t } var o = 34041, a = 36064, l = [{ format: 6408, type: 5121, min: 9729, wrap: 33071 }, { format: o }], c = { 34041: 33306, 6401: 36128, 36168: 36128, 6402: 36096, 33189: 36096 }, u = { 32854: !0, 32855: !0, 36194: !0, 34041: !0, 33189: !0, 6401: !0, 36168: !0 } }, function (e, t, n) { "use strict"; t.__esModule = !0, t.createVertexArrayInfo = function (e, t, n) { var i = e.createVertexArray(); return e.bindVertexArray(i), t.length || (t = [t]), t.forEach((function (t) { r.setBuffersAndAttributes(e, t, n) })), e.bindVertexArray(null), { numElements: n.numElements, elementType: n.elementType, vertexArrayObject: i } }, t.createVAOAndSetAttributes = i, t.createVAOFromBufferInfo = function (e, t, n) { return i(e, t.attribSetters || t, n.attribs, n.indices) }; var r = function (e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var n in e) if (Object.prototype.hasOwnProperty.call(e, n)) { var r = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(e, n) : {}; r.get || r.set ? Object.defineProperty(t, n, r) : t[n] = e[n] } return t.default = e, t }(n(5)); function i(e, t, n, i) { var s = e.createVertexArray(); return e.bindVertexArray(s), r.setAttributes(t, n), i && e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, i), e.bindVertexArray(null), s } }]) }, e.exports = r() }, function (e, t) { e.exports = class { static simple(e) { return JSON.parse(JSON.stringify(e)) } } }, function (e, t) { class n { static get BACKGROUND_LAYER() { return "background" } static get VIDEO_LAYER() { return "video" } static get PEN_LAYER() { return "pen" } static get SPRITE_LAYER() { return "sprite" } static get LAYER_GROUPS() { return [n.BACKGROUND_LAYER, n.VIDEO_LAYER, n.PEN_LAYER, n.SPRITE_LAYER] } } e.exports = n }, function (e, t, n) { (function (t) { class n { constructor() { let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.nowObj; this.startTime = 0, this.nowObj = e } static get USE_PERFORMANCE() { return !1 } static get legacyDateCode() { return { now: function () { return (new Date).getTime() } } } static get nowObj() { return n.USE_PERFORMANCE && "undefined" != typeof self && self.performance && "now" in self.performance ? self.performance : Date.now ? Date : n.legacyDateCode } time() { return this.nowObj.now() } start() { this.startTime = this.nowObj.now() } timeElapsed() { return this.nowObj.now() - this.startTime } setTimeout(e, n) { return t.setTimeout(e, n) } clearTimeout(e) { t.clearTimeout(e) } } e.exports = n }).call(this, n(9)) }, function (e, t, n) { const r = n(134), i = n(136); class s { static base64ToUint8Array(e) { const t = r(e), n = t.length, i = new Uint8Array(n); for (let e = 0; e < n; e++)i[e] = t.charCodeAt(e); return i } static uint8ArrayToBase64(e) { let t = ""; const n = e.length; for (let r = 0; r < n; r++)t += String.fromCharCode(e[r]); return i(t) } static arrayBufferToBase64(e) { return s.uint8ArrayToBase64(new Uint8Array(e)) } } e.exports = s }, function (e, t, n) { const r = n(204), i = n(74), s = n(33), o = n(46), a = n(12), { Map: l } = n(24), c = n(76), u = n(77), d = n(1), h = n(10), p = n(47); class m { constructor(e, t) { this.runtime = e, this._blocks = {}, this._scripts = [], Object.defineProperty(this, "_cache", { writable: !0, enumerable: !1 }), this._cache = { inputs: {}, procedureParamNames: {}, procedureDefinitions: {}, _executeCached: {}, _monitored: null, scripts: {}, compiledScripts: {}, compiledProcedures: {}, proceduresPopulated: !1 }, this.forceNoGlow = t || !1 } getCachedCompileResult(e) { return Object.prototype.hasOwnProperty.call(this._cache.compiledScripts, e) ? this._cache.compiledScripts[e] : null } cacheCompileResult(e, t) { this._cache.compiledScripts[e] = { success: !0, value: t } } cacheCompileError(e, t) { this._cache.compiledScripts[e] = { success: !1, value: t } } static get BRANCH_INPUT_PREFIX() { return "SUBSTACK" } getBlock(e) { return this._blocks[e] } getScripts() { return this._scripts } getNextBlock(e) { const t = this._blocks[e]; return void 0 === t ? null : t.next } getBranch(e, t) { const n = this._blocks[e]; if (void 0 === n) return null; t || (t = 1); let r = m.BRANCH_INPUT_PREFIX; t > 1 && (r += t); const i = n.inputs[r]; return void 0 === i ? null : i.block } getOpcode(e) { return void 0 === e ? null : e.opcode } getFields(e) { return void 0 === e ? null : e.fields } getInputs(e) { if (void 0 === e) return null; let t = this._cache.inputs[e.id]; if (void 0 !== t) return t; t = {}; for (const n in e.inputs) n.substring(0, m.BRANCH_INPUT_PREFIX.length) !== m.BRANCH_INPUT_PREFIX && (t[n] = e.inputs[n]); return this._cache.inputs[e.id] = t, t } getMutation(e) { return void 0 === e ? null : e.mutation } getTopLevelScript(e) { let t = this._blocks[e]; if (void 0 === t) return null; for (; null !== t.parent;)t = this._blocks[t.parent]; return t.id } getProcedureDefinition(e) { const t = this._cache.procedureDefinitions[e]; if (void 0 !== t) return t; for (const t in this._blocks) { if (!Object.prototype.hasOwnProperty.call(this._blocks, t)) continue; const n = this._blocks[t]; if ("procedures_definition" === n.opcode) { const r = this._getCustomBlockInternal(n); if (r && r.mutation.proccode === e) return this._cache.procedureDefinitions[e] = t, t } } return this._cache.procedureDefinitions[e] = null, null } getProcedureParamNamesAndIds(e) { return this.getProcedureParamNamesIdsAndDefaults(e).slice(0, 2) } getProcedureParamNamesIdsAndDefaults(e) { const t = this._cache.procedureParamNames[e]; if (void 0 !== t) return t; for (const t in this._blocks) { if (!Object.prototype.hasOwnProperty.call(this._blocks, t)) continue; const n = this._blocks[t]; if ("procedures_prototype" === n.opcode && n.mutation.proccode === e) { const t = JSON.parse(n.mutation.argumentnames), r = JSON.parse(n.mutation.argumentids), i = JSON.parse(n.mutation.argumentdefaults); return this._cache.procedureParamNames[e] = [t, r, i], this._cache.procedureParamNames[e] } } const n = this.runtime.getAddonBlock(e); return n ? (this._cache.procedureParamNames[e] = n.namesIdsDefaults, n.namesIdsDefaults) : (this._cache.procedureParamNames[e] = null, null) } populateProcedureCache() { if (!this._cache.proceduresPopulated) { for (const e in this._blocks) { if (!Object.prototype.hasOwnProperty.call(this._blocks, e)) continue; const t = this._blocks[e]; if ("procedures_prototype" !== t.opcode) { if ("procedures_definition" === t.opcode) { const n = this._getCustomBlockInternal(t); if (n) { const t = n.mutation.proccode; this._cache.procedureDefinitions[t] || (this._cache.procedureDefinitions[t] = e); continue } } } else { const e = t.mutation.proccode; if (!this._cache.procedureParamNames[e]) { const n = JSON.parse(t.mutation.argumentnames), r = JSON.parse(t.mutation.argumentids), i = JSON.parse(t.mutation.argumentdefaults); this._cache.procedureParamNames[e] = [n, r, i] } } } this._cache.proceduresPopulated = !0 } } duplicate() { const e = new m(this.runtime, this.forceNoGlow); return e._blocks = a.simple(this._blocks), e._scripts = a.simple(this._scripts), e } blocklyListen(e) { if ("object" != typeof e) return; if ("string" != typeof e.blockId && "string" != typeof e.varId && "string" != typeof e.commentId) return; const t = this.runtime.getTargetForStage(), n = this.runtime.getEditingTarget(); if ("stackclick" !== e.element) switch (e.type) { case "create": { const t = r(e); for (let e = 0; e < t.length; e++)this.createBlock(t[e]); break } case "change": this.changeBlock({ id: e.blockId, element: e.element, name: e.name, value: e.newValue }); break; case "move": this.moveBlock({ id: e.blockId, oldParent: e.oldParentId, oldInput: e.oldInputName, newParent: e.newParentId, newInput: e.newInputName, newCoordinate: e.newCoordinate }); break; case "dragOutside": this.runtime.emitBlockDragUpdate(e.isOutside); break; case "endDrag": if (this.runtime.emitBlockDragUpdate(!1), e.isOutside) { const t = r(e); this.runtime.emitBlockEndDrag(t, e.blockId) } break; case "delete": if (!Object.prototype.hasOwnProperty.call(this._blocks, e.blockId) || this._blocks[e.blockId].shadow) return; this._blocks[e.blockId].topLevel && this.runtime.quietGlow(e.blockId), this.deleteBlock(e.blockId); break; case "var_create": if (this.resetCache(), e.isLocal && n && !n.isStage && !e.isCloud) n.lookupVariableById(e.varId) || (n.createVariable(e.varId, e.varName, e.varType), this.emitProjectChanged()); else { if (t.lookupVariableById(e.varId)) return; const n = this.runtime.targets.filter((e => e.isOriginal)); for (const t of n) if (t.lookupVariableByNameAndType(e.varName, e.varType, !0)) return; t.createVariable(e.varId, e.varName, e.varType, e.isCloud), this.emitProjectChanged() } break; case "var_rename": if (n && Object.prototype.hasOwnProperty.call(n.variables, e.varId)) n.renameVariable(e.varId, e.newName), n.blocks.updateBlocksAfterVarRename(e.varId, e.newName); else { t.renameVariable(e.varId, e.newName); const n = this.runtime.targets; for (let t = 0; t < n.length; t++) { n[t].blocks.updateBlocksAfterVarRename(e.varId, e.newName) } } this.emitProjectChanged(); break; case "var_delete": this.resetCache(); (n && Object.prototype.hasOwnProperty.call(n.variables, e.varId) ? n : t).deleteVariable(e.varId), this.emitProjectChanged(); break; case "comment_create": if (this.resetCache(), this.runtime.getEditingTarget()) { const t = this.runtime.getEditingTarget(); t.createComment(e.commentId, e.blockId, e.text, e.xy.x, e.xy.y, e.width, e.height, e.minimized), null === t.comments[e.commentId].x && null === t.comments[e.commentId].y && (t.comments[e.commentId].x = e.xy.x, t.comments[e.commentId].y = e.xy.y) } this.emitProjectChanged(); break; case "comment_change": if (this.resetCache(), this.runtime.getEditingTarget()) { const t = this.runtime.getEditingTarget(); if (!Object.prototype.hasOwnProperty.call(t.comments, e.commentId)) return void d.warn("Cannot change comment with id ".concat(e.commentId, " because it does not exist.")); const n = t.comments[e.commentId], r = e.newContents_; Object.prototype.hasOwnProperty.call(r, "minimized") && (n.minimized = r.minimized), Object.prototype.hasOwnProperty.call(r, "width") && Object.prototype.hasOwnProperty.call(r, "height") && (n.width = r.width, n.height = r.height), Object.prototype.hasOwnProperty.call(r, "text") && (n.text = r.text), this.emitProjectChanged() } break; case "comment_move": if (this.runtime.getEditingTarget()) { const t = this.runtime.getEditingTarget(); if (t && !Object.prototype.hasOwnProperty.call(t.comments, e.commentId)) return void d.warn("Cannot change comment with id ".concat(e.commentId, " because it does not exist.")); const n = t.comments[e.commentId], r = e.newCoordinate_; n.x = r.x, n.y = r.y, this.emitProjectChanged() } break; case "comment_delete": if (this.resetCache(), this.runtime.getEditingTarget()) { const t = this.runtime.getEditingTarget(); if (!Object.prototype.hasOwnProperty.call(t.comments, e.commentId)) return; if (delete t.comments[e.commentId], e.blockId) { const n = t.blocks.getBlock(e.blockId); if (!n) return void d.warn("Could not find block referenced by comment with id: ".concat(e.commentId)); delete n.comment } this.emitProjectChanged() } } else this.runtime.toggleScript(e.blockId, { stackClick: !0 }) } resetCache() { this._cache.inputs = {}, this._cache.procedureParamNames = {}, this._cache.procedureDefinitions = {}, this._cache._executeCached = {}, this._cache._monitored = null, this._cache.scripts = {}, this._cache.compiledScripts = {}, this._cache.compiledProcedures = {}, this._cache.proceduresPopulated = !1 } emitProjectChanged() { this.forceNoGlow || this.runtime.emitProjectChanged() } createBlock(e) { Object.prototype.hasOwnProperty.call(this._blocks, e.id) || (this._blocks[e.id] = e, e.topLevel && this._addScript(e.id), this.resetCache(), this.emitProjectChanged()) } changeBlock(e) { if (-1 === ["field", "mutation", "checkbox"].indexOf(e.element)) return; let t = this._blocks[e.id]; if (void 0 !== t) { switch (e.element) { case "field": if (!t.fields[e.name]) return; if ("VARIABLE" === e.name || "LIST" === e.name || "BROADCAST_OPTION" === e.name) { const n = this.runtime.getEditingTarget().lookupVariableById(e.value); n && (t.fields[e.name].value = n.name, t.fields[e.name].id = e.value) } else { t.fields[e.name].value = e.value, "sensing_of_object_menu" === t.opcode && ("_stage_" === t.fields.OBJECT.value ? this._blocks[t.parent].fields.PROPERTY.value = "backdrop #" : this._blocks[t.parent].fields.PROPERTY.value = "x position", this.runtime.requestBlocksUpdate()); const n = t.shadow && t.parent ? this._blocks[t.parent] : t; n.isMonitored && this.runtime.requestUpdateMonitor(l({ id: n.id, params: this._getBlockParams(n) })) } break; case "mutation": t.mutation = i(e.value); break; case "checkbox": { if (t.fields && Object.keys(t.fields).length > 0 && "data_variable" !== t.opcode && "data_listcontents" !== t.opcode) { const e = p(t.id, t.fields); let n = this.runtime.monitorBlocks.getBlock(e); n || (n = JSON.parse(JSON.stringify(t)), n.id = e, this.runtime.monitorBlocks.createBlock(n)), t = n } const n = t.isMonitored; t.isMonitored = e.value; let r = !1; "data_variable" === t.opcode ? r = !this.runtime.getTargetForStage().variables[t.fields.VARIABLE.id] : "data_listcontents" === t.opcode && (r = !this.runtime.getTargetForStage().variables[t.fields.LIST.id]); const i = r || Object.prototype.hasOwnProperty.call(this.runtime.monitorBlockInfo, t.opcode) && this.runtime.monitorBlockInfo[t.opcode].isSpriteSpecific; t.targetId = i ? t.targetId || this.runtime.getEditingTarget().id : null, n && !t.isMonitored ? this.runtime.requestHideMonitor(t.id) : !n && t.isMonitored && (this.runtime.requestShowMonitor(t.id) || this.runtime.requestAddMonitor(o({ id: t.id, targetId: t.targetId, spriteName: t.targetId ? this.runtime.getTargetById(t.targetId).getName() : null, opcode: t.opcode, params: this._getBlockParams(t), value: "", mode: "data_listcontents" === t.opcode ? "list" : "default" }))); break } }this.emitProjectChanged(), this.resetCache() } } moveBlock(e) { if (!Object.prototype.hasOwnProperty.call(this._blocks, e.id)) return; const t = this._blocks[e.id]; let n = !1; if (e.newCoordinate && (n = t.x !== e.newCoordinate.x || t.y !== e.newCoordinate.y, t.x = e.newCoordinate.x, t.y = e.newCoordinate.y), void 0 !== e.oldParent) { const t = this._blocks[e.oldParent]; void 0 !== e.oldInput && t.inputs[e.oldInput].block === e.id ? t.inputs[e.oldInput].block = null : t.next === e.id && (t.next = null), this._blocks[e.id].parent = null, n = !0 } if (void 0 === e.newParent) this._addScript(e.id); else { if (this._deleteScript(e.id), void 0 === e.newInput) this._blocks[e.newParent].next = e.id; else { let t = null; Object.prototype.hasOwnProperty.call(this._blocks[e.newParent].inputs, e.newInput) && (t = this._blocks[e.newParent].inputs[e.newInput].shadow), this._blocks[e.id].shadow && (t = e.id), this._blocks[e.newParent].inputs[e.newInput] = { name: e.newInput, block: e.id, shadow: t } } this._blocks[e.id].parent = e.newParent, n = !0 } this.resetCache(), n && this.emitProjectChanged() } runAllMonitored(e) { null === this._cache._monitored && (this._cache._monitored = Object.keys(this._blocks).filter((e => this.getBlock(e).isMonitored)).map((t => { const n = this.getBlock(t).targetId; return { blockId: t, target: n ? e.getTargetById(n) : null } }))); const t = this._cache._monitored; for (let n = 0; n < t.length; n++) { const { blockId: r, target: i } = t[n]; e.addMonitorScript(r, i) } } deleteBlock(e) { const t = this._blocks[e]; if (t) { null !== t.next && this.deleteBlock(t.next); for (const e in t.inputs) null !== t.inputs[e].block && this.deleteBlock(t.inputs[e].block), null !== t.inputs[e].shadow && t.inputs[e].shadow !== t.inputs[e].block && this.deleteBlock(t.inputs[e].shadow); this._deleteScript(e), delete this._blocks[e], this.resetCache(), this.emitProjectChanged() } } deleteAllBlocks() { Object.keys(this._blocks).forEach((e => this.deleteBlock(e))) } getAllVariableAndListReferences(e, t) { const n = e || this._blocks, r = Object.create(null); for (const e in n) { let i = null, s = null; if (n[e].fields.VARIABLE ? (i = n[e].fields.VARIABLE, s = h.SCALAR_TYPE) : n[e].fields.LIST ? (i = n[e].fields.LIST, s = h.LIST_TYPE) : t && n[e].fields.BROADCAST_OPTION && (i = n[e].fields.BROADCAST_OPTION, s = h.BROADCAST_MESSAGE_TYPE), i) { const e = i.id; r[e] ? r[e].push({ referencingField: i, type: s }) : r[e] = [{ referencingField: i, type: s }] } } return r } updateBlocksAfterVarRename(e, t) { const n = this._blocks; for (const r in n) { let i = null; if (n[r].fields.VARIABLE ? i = n[r].fields.VARIABLE : n[r].fields.LIST && (i = n[r].fields.LIST), i) { e === i.id && (i.value = t) } } } updateTargetSpecificBlocks(e) { const t = this._blocks; for (const n in t) e && "event_whenthisspriteclicked" === t[n].opcode ? t[n].opcode = "event_whenstageclicked" : e || "event_whenstageclicked" !== t[n].opcode || (t[n].opcode = "event_whenthisspriteclicked") } updateAssetName(e, t, n) { let r; if ("costume" === n) r = this._getCostumeField.bind(this); else if ("sound" === n) r = this._getSoundField.bind(this); else if ("backdrop" === n) r = this._getBackdropField.bind(this); else { if ("sprite" !== n) return; r = this._getSpriteField.bind(this) } const i = this._blocks; for (const n in i) { const i = r(n); i && i.value === e && (i.value = t) } this.resetCache() } updateSensingOfReference(e, t, n) { const r = this._blocks; let i = !1; for (const s in r) { const o = r[s]; if ("sensing_of" === o.opcode && o.fields.PROPERTY.value === e && o.inputs.OBJECT.block === o.inputs.OBJECT.shadow) { this.getBlock(o.inputs.OBJECT.block).fields.OBJECT.value === n && (o.fields.PROPERTY.value = t, i = !0) } } return i && this.resetCache(), i } _getCostumeField(e) { const t = this.getBlock(e); return t && Object.prototype.hasOwnProperty.call(t.fields, "COSTUME") ? t.fields.COSTUME : null } _getSoundField(e) { const t = this.getBlock(e); return t && Object.prototype.hasOwnProperty.call(t.fields, "SOUND_MENU") ? t.fields.SOUND_MENU : null } _getBackdropField(e) { const t = this.getBlock(e); return t && Object.prototype.hasOwnProperty.call(t.fields, "BACKDROP") ? t.fields.BACKDROP : null } _getSpriteField(e) { const t = this.getBlock(e); if (!t) return null; const n = ["TOWARDS", "TO", "OBJECT", "VIDEOONMENU2", "DISTANCETOMENU", "TOUCHINGOBJECTMENU", "CLONE_OPTION"]; for (let e = 0; e < n.length; e++) { const r = n[e]; if (Object.prototype.hasOwnProperty.call(t.fields, r)) return t.fields[r] } return null } toXML(e) { return this._scripts.map((t => this.blockToXML(t, e))).join() } blockToXML(e, t) { const n = this._blocks[e]; if (!n) return; const r = n.shadow ? "shadow" : "block"; let i = "<".concat(r, '\n id="').concat(s(n.id), '"\n type="').concat(s(n.opcode), '"\n ').concat(n.topLevel ? 'x="'.concat(n.x, '" y="').concat(n.y, '"') : "", "\n >"); const o = n.comment; o && (t ? Object.prototype.hasOwnProperty.call(t, o) ? i += t[o].toXML() : d.warn("Could not find comment with id: ".concat(o, " in provided comment descriptions.")) : d.warn("Cannot serialize comment with id: ".concat(o, "; no comment descriptions provided."))), n.mutation && (i += this.mutationToXML(n.mutation)); for (const e in n.inputs) { if (!Object.prototype.hasOwnProperty.call(n.inputs, e)) continue; const r = n.inputs[e]; (r.block || r.shadow) && (i += ''), r.block && (i += this.blockToXML(r.block, t)), r.shadow && r.shadow !== r.block && (i += this.blockToXML(r.shadow, t)), i += "") } for (const e in n.fields) { if (!Object.prototype.hasOwnProperty.call(n.fields, e)) continue; const t = n.fields[e]; i += '") } return n.next && (i += "".concat(this.blockToXML(n.next, t), "")), i += ""), i } mutationToXML(e) { let t = "<".concat(e.tagName); for (const n in e) { if ("children" === n || "tagName" === n) continue; let r = "string" == typeof e[n] ? s(e[n]) : e[n]; "blockInfo" === n && (r = s(JSON.stringify(e[n]))), t += " ".concat(n, '="').concat(r, '"') } t += ">"; for (let n = 0; n < e.children.length; n++)t += this.mutationToXML(e.children[n]); return t += ""), t } _getBlockParams(e) { const t = {}; for (const n in e.fields) t[n] = e.fields[n].value; for (const n in e.inputs) { const r = this._blocks[e.inputs[n].block]; for (const e in r.fields) t[e] = r.fields[e].value } return t } _getCustomBlockInternal(e) { if (e.inputs && e.inputs.custom_block) return this._blocks[e.inputs.custom_block.block] } _addScript(e) { this._scripts.indexOf(e) > -1 || (this._scripts.push(e), this._blocks[e].topLevel = !0) } _deleteScript(e) { const t = this._scripts.indexOf(e); t > -1 && this._scripts.splice(t, 1), this._blocks[e] && (this._blocks[e].topLevel = !1) } } c.getCached = function (e, t, n) { let r = e._cache._executeCached[t]; if (void 0 !== r) return r; const i = e.getBlock(t); return void 0 === i ? null : (r = void 0 === n ? { id: t, opcode: e.getOpcode(i), fields: e.getFields(i), inputs: e.getInputs(i), mutation: e.getMutation(i) } : new n(e, { id: t, opcode: e.getOpcode(i), fields: e.getFields(i), inputs: e.getInputs(i), mutation: e.getMutation(i) }), e._cache._executeCached[t] = r, r) }; const f = u._RuntimeScriptCache; u.getScripts = function (e, t) { let n = e._cache.scripts[t]; if (!n) { n = e._cache.scripts[t] = []; const r = e._scripts; for (let i = 0; i < r.length; i++) { const s = r[i]; e.getBlock(s).opcode === t && n.push(new f(e, s)) } } return n }, e.exports = m }, function (e, t, n) { var r = n(0).TYPE, i = r.WhiteSpace, s = r.Semicolon, o = r.LeftCurlyBracket, a = r.Delim; function l() { return this.scanner.tokenIndex > 0 && this.scanner.lookupType(-1) === i ? this.scanner.tokenIndex > 1 ? this.scanner.getTokenStart(this.scanner.tokenIndex - 1) : this.scanner.firstCharOffset : this.scanner.tokenStart } function c() { return 0 } e.exports = { name: "Raw", structure: { value: String }, parse: function (e, t, n) { var r, i = this.scanner.getTokenStart(e); return this.scanner.skip(this.scanner.getRawLength(e, t || c)), r = n && this.scanner.tokenStart > i ? l.call(this) : this.scanner.tokenStart, { type: "Raw", loc: this.getLocation(i, r), value: this.scanner.source.substring(i, r) } }, generate: function (e) { this.chunk(e.value) }, mode: { default: c, leftCurlyBracket: function (e) { return e === o ? 1 : 0 }, leftCurlyBracketOrSemicolon: function (e) { return e === o || e === s ? 1 : 0 }, exclamationMarkOrSemicolon: function (e, t, n) { return e === a && 33 === t.charCodeAt(n) || e === s ? 1 : 0 }, semicolonIncluded: function (e) { return e === s ? 2 : 0 } } } }, function (e, t, n) { "use strict"; (function (e) { var r = n(120), i = n(121), s = n(122); function o() { return l.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823 } function a(e, t) { if (o() < t) throw new RangeError("Invalid typed array length"); return l.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = l.prototype : (null === e && (e = new l(t)), e.length = t), e } function l(e, t, n) { if (!(l.TYPED_ARRAY_SUPPORT || this instanceof l)) return new l(e, t, n); if ("number" == typeof e) { if ("string" == typeof t) throw new Error("If encoding is specified then the first argument must be a string"); return d(this, e) } return c(this, e, t, n) } function c(e, t, n, r) { if ("number" == typeof t) throw new TypeError('"value" argument must not be a number'); return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function (e, t, n, r) { if (t.byteLength, n < 0 || t.byteLength < n) throw new RangeError("'offset' is out of bounds"); if (t.byteLength < n + (r || 0)) throw new RangeError("'length' is out of bounds"); t = void 0 === n && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t, n) : new Uint8Array(t, n, r); l.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = l.prototype : e = h(e, t); return e }(e, t, n, r) : "string" == typeof t ? function (e, t, n) { "string" == typeof n && "" !== n || (n = "utf8"); if (!l.isEncoding(n)) throw new TypeError('"encoding" must be a valid string encoding'); var r = 0 | m(t, n); e = a(e, r); var i = e.write(t, n); i !== r && (e = e.slice(0, i)); return e }(e, t, n) : function (e, t) { if (l.isBuffer(t)) { var n = 0 | p(t.length); return 0 === (e = a(e, n)).length || t.copy(e, 0, 0, n), e } if (t) { if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length" in t) return "number" != typeof t.length || (r = t.length) != r ? a(e, 0) : h(e, t); if ("Buffer" === t.type && s(t.data)) return h(e, t.data) } var r; throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.") }(e, t) } function u(e) { if ("number" != typeof e) throw new TypeError('"size" argument must be a number'); if (e < 0) throw new RangeError('"size" argument must not be negative') } function d(e, t) { if (u(t), e = a(e, t < 0 ? 0 : 0 | p(t)), !l.TYPED_ARRAY_SUPPORT) for (var n = 0; n < t; ++n)e[n] = 0; return e } function h(e, t) { var n = t.length < 0 ? 0 : 0 | p(t.length); e = a(e, n); for (var r = 0; r < n; r += 1)e[r] = 255 & t[r]; return e } function p(e) { if (e >= o()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + o().toString(16) + " bytes"); return 0 | e } function m(e, t) { if (l.isBuffer(e)) return e.length; if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer)) return e.byteLength; "string" != typeof e && (e = "" + e); var n = e.length; if (0 === n) return 0; for (var r = !1; ;)switch (t) { case "ascii": case "latin1": case "binary": return n; case "utf8": case "utf-8": case void 0: return W(e).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return 2 * n; case "hex": return n >>> 1; case "base64": return V(e).length; default: if (r) return W(e).length; t = ("" + t).toLowerCase(), r = !0 } } function f(e, t, n) { var r = !1; if ((void 0 === t || t < 0) && (t = 0), t > this.length) return ""; if ((void 0 === n || n > this.length) && (n = this.length), n <= 0) return ""; if ((n >>>= 0) <= (t >>>= 0)) return ""; for (e || (e = "utf8"); ;)switch (e) { case "hex": return M(this, t, n); case "utf8": case "utf-8": return A(this, t, n); case "ascii": return I(this, t, n); case "latin1": case "binary": return O(this, t, n); case "base64": return E(this, t, n); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return N(this, t, n); default: if (r) throw new TypeError("Unknown encoding: " + e); e = (e + "").toLowerCase(), r = !0 } } function g(e, t, n) { var r = e[t]; e[t] = e[n], e[n] = r } function y(e, t, n, r, i) { if (0 === e.length) return -1; if ("string" == typeof n ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, isNaN(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) { if (i) return -1; n = e.length - 1 } else if (n < 0) { if (!i) return -1; n = 0 } if ("string" == typeof t && (t = l.from(t, r)), l.isBuffer(t)) return 0 === t.length ? -1 : b(e, t, n, r, i); if ("number" == typeof t) return t &= 255, l.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(e, t, n) : Uint8Array.prototype.lastIndexOf.call(e, t, n) : b(e, [t], n, r, i); throw new TypeError("val must be string, number or Buffer") } function b(e, t, n, r, i) { var s, o = 1, a = e.length, l = t.length; if (void 0 !== r && ("ucs2" === (r = String(r).toLowerCase()) || "ucs-2" === r || "utf16le" === r || "utf-16le" === r)) { if (e.length < 2 || t.length < 2) return -1; o = 2, a /= 2, l /= 2, n /= 2 } function c(e, t) { return 1 === o ? e[t] : e.readUInt16BE(t * o) } if (i) { var u = -1; for (s = n; s < a; s++)if (c(e, s) === c(t, -1 === u ? 0 : s - u)) { if (-1 === u && (u = s), s - u + 1 === l) return u * o } else -1 !== u && (s -= s - u), u = -1 } else for (n + l > a && (n = a - l), s = n; s >= 0; s--) { for (var d = !0, h = 0; h < l; h++)if (c(e, s + h) !== c(t, h)) { d = !1; break } if (d) return s } return -1 } function v(e, t, n, r) { n = Number(n) || 0; var i = e.length - n; r ? (r = Number(r)) > i && (r = i) : r = i; var s = t.length; if (s % 2 != 0) throw new TypeError("Invalid hex string"); r > s / 2 && (r = s / 2); for (var o = 0; o < r; ++o) { var a = parseInt(t.substr(2 * o, 2), 16); if (isNaN(a)) return o; e[n + o] = a } return o } function S(e, t, n, r) { return G(W(t, e.length - n), e, n, r) } function w(e, t, n, r) { return G(function (e) { for (var t = [], n = 0; n < e.length; ++n)t.push(255 & e.charCodeAt(n)); return t }(t), e, n, r) } function k(e, t, n, r) { return w(e, t, n, r) } function T(e, t, n, r) { return G(V(t), e, n, r) } function x(e, t, n, r) { return G(function (e, t) { for (var n, r, i, s = [], o = 0; o < e.length && !((t -= 2) < 0); ++o)r = (n = e.charCodeAt(o)) >> 8, i = n % 256, s.push(i), s.push(r); return s }(t, e.length - n), e, n, r) } function E(e, t, n) { return 0 === t && n === e.length ? r.fromByteArray(e) : r.fromByteArray(e.slice(t, n)) } function A(e, t, n) { n = Math.min(e.length, n); for (var r = [], i = t; i < n;) { var s, o, a, l, c = e[i], u = null, d = c > 239 ? 4 : c > 223 ? 3 : c > 191 ? 2 : 1; if (i + d <= n) switch (d) { case 1: c < 128 && (u = c); break; case 2: 128 == (192 & (s = e[i + 1])) && (l = (31 & c) << 6 | 63 & s) > 127 && (u = l); break; case 3: s = e[i + 1], o = e[i + 2], 128 == (192 & s) && 128 == (192 & o) && (l = (15 & c) << 12 | (63 & s) << 6 | 63 & o) > 2047 && (l < 55296 || l > 57343) && (u = l); break; case 4: s = e[i + 1], o = e[i + 2], a = e[i + 3], 128 == (192 & s) && 128 == (192 & o) && 128 == (192 & a) && (l = (15 & c) << 18 | (63 & s) << 12 | (63 & o) << 6 | 63 & a) > 65535 && l < 1114112 && (u = l) }null === u ? (u = 65533, d = 1) : u > 65535 && (u -= 65536, r.push(u >>> 10 & 1023 | 55296), u = 56320 | 1023 & u), r.push(u), i += d } return function (e) { var t = e.length; if (t <= C) return String.fromCharCode.apply(String, e); var n = "", r = 0; for (; r < t;)n += String.fromCharCode.apply(String, e.slice(r, r += C)); return n }(r) } t.Buffer = l, t.SlowBuffer = function (e) { +e != e && (e = 0); return l.alloc(+e) }, t.INSPECT_MAX_BYTES = 50, l.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e.TYPED_ARRAY_SUPPORT : function () { try { var e = new Uint8Array(1); return e.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }, 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength } catch (e) { return !1 } }(), t.kMaxLength = o(), l.poolSize = 8192, l._augment = function (e) { return e.__proto__ = l.prototype, e }, l.from = function (e, t, n) { return c(null, e, t, n) }, l.TYPED_ARRAY_SUPPORT && (l.prototype.__proto__ = Uint8Array.prototype, l.__proto__ = Uint8Array, "undefined" != typeof Symbol && Symbol.species && l[Symbol.species] === l && Object.defineProperty(l, Symbol.species, { value: null, configurable: !0 })), l.alloc = function (e, t, n) { return function (e, t, n, r) { return u(t), t <= 0 ? a(e, t) : void 0 !== n ? "string" == typeof r ? a(e, t).fill(n, r) : a(e, t).fill(n) : a(e, t) }(null, e, t, n) }, l.allocUnsafe = function (e) { return d(null, e) }, l.allocUnsafeSlow = function (e) { return d(null, e) }, l.isBuffer = function (e) { return !(null == e || !e._isBuffer) }, l.compare = function (e, t) { if (!l.isBuffer(e) || !l.isBuffer(t)) throw new TypeError("Arguments must be Buffers"); if (e === t) return 0; for (var n = e.length, r = t.length, i = 0, s = Math.min(n, r); i < s; ++i)if (e[i] !== t[i]) { n = e[i], r = t[i]; break } return n < r ? -1 : r < n ? 1 : 0 }, l.isEncoding = function (e) { switch (String(e).toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "latin1": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return !0; default: return !1 } }, l.concat = function (e, t) { if (!s(e)) throw new TypeError('"list" argument must be an Array of Buffers'); if (0 === e.length) return l.alloc(0); var n; if (void 0 === t) for (t = 0, n = 0; n < e.length; ++n)t += e[n].length; var r = l.allocUnsafe(t), i = 0; for (n = 0; n < e.length; ++n) { var o = e[n]; if (!l.isBuffer(o)) throw new TypeError('"list" argument must be an Array of Buffers'); o.copy(r, i), i += o.length } return r }, l.byteLength = m, l.prototype._isBuffer = !0, l.prototype.swap16 = function () { var e = this.length; if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var t = 0; t < e; t += 2)g(this, t, t + 1); return this }, l.prototype.swap32 = function () { var e = this.length; if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var t = 0; t < e; t += 4)g(this, t, t + 3), g(this, t + 1, t + 2); return this }, l.prototype.swap64 = function () { var e = this.length; if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var t = 0; t < e; t += 8)g(this, t, t + 7), g(this, t + 1, t + 6), g(this, t + 2, t + 5), g(this, t + 3, t + 4); return this }, l.prototype.toString = function () { var e = 0 | this.length; return 0 === e ? "" : 0 === arguments.length ? A(this, 0, e) : f.apply(this, arguments) }, l.prototype.equals = function (e) { if (!l.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); return this === e || 0 === l.compare(this, e) }, l.prototype.inspect = function () { var e = "", n = t.INSPECT_MAX_BYTES; return this.length > 0 && (e = this.toString("hex", 0, n).match(/.{2}/g).join(" "), this.length > n && (e += " ... ")), "" }, l.prototype.compare = function (e, t, n, r, i) { if (!l.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); if (void 0 === t && (t = 0), void 0 === n && (n = e ? e.length : 0), void 0 === r && (r = 0), void 0 === i && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw new RangeError("out of range index"); if (r >= i && t >= n) return 0; if (r >= i) return -1; if (t >= n) return 1; if (this === e) return 0; for (var s = (i >>>= 0) - (r >>>= 0), o = (n >>>= 0) - (t >>>= 0), a = Math.min(s, o), c = this.slice(r, i), u = e.slice(t, n), d = 0; d < a; ++d)if (c[d] !== u[d]) { s = c[d], o = u[d]; break } return s < o ? -1 : o < s ? 1 : 0 }, l.prototype.includes = function (e, t, n) { return -1 !== this.indexOf(e, t, n) }, l.prototype.indexOf = function (e, t, n) { return y(this, e, t, n, !0) }, l.prototype.lastIndexOf = function (e, t, n) { return y(this, e, t, n, !1) }, l.prototype.write = function (e, t, n, r) { if (void 0 === t) r = "utf8", n = this.length, t = 0; else if (void 0 === n && "string" == typeof t) r = t, n = this.length, t = 0; else { if (!isFinite(t)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); t |= 0, isFinite(n) ? (n |= 0, void 0 === r && (r = "utf8")) : (r = n, n = void 0) } var i = this.length - t; if ((void 0 === n || n > i) && (n = i), e.length > 0 && (n < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds"); r || (r = "utf8"); for (var s = !1; ;)switch (r) { case "hex": return v(this, e, t, n); case "utf8": case "utf-8": return S(this, e, t, n); case "ascii": return w(this, e, t, n); case "latin1": case "binary": return k(this, e, t, n); case "base64": return T(this, e, t, n); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return x(this, e, t, n); default: if (s) throw new TypeError("Unknown encoding: " + r); r = ("" + r).toLowerCase(), s = !0 } }, l.prototype.toJSON = function () { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) } }; var C = 4096; function I(e, t, n) { var r = ""; n = Math.min(e.length, n); for (var i = t; i < n; ++i)r += String.fromCharCode(127 & e[i]); return r } function O(e, t, n) { var r = ""; n = Math.min(e.length, n); for (var i = t; i < n; ++i)r += String.fromCharCode(e[i]); return r } function M(e, t, n) { var r = e.length; (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r); for (var i = "", s = t; s < n; ++s)i += F(e[s]); return i } function N(e, t, n) { for (var r = e.slice(t, n), i = "", s = 0; s < r.length; s += 2)i += String.fromCharCode(r[s] + 256 * r[s + 1]); return i } function R(e, t, n) { if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint"); if (e + t > n) throw new RangeError("Trying to access beyond buffer length") } function D(e, t, n, r, i, s) { if (!l.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (t > i || t < s) throw new RangeError('"value" argument is out of bounds'); if (n + r > e.length) throw new RangeError("Index out of range") } function P(e, t, n, r) { t < 0 && (t = 65535 + t + 1); for (var i = 0, s = Math.min(e.length - n, 2); i < s; ++i)e[n + i] = (t & 255 << 8 * (r ? i : 1 - i)) >>> 8 * (r ? i : 1 - i) } function L(e, t, n, r) { t < 0 && (t = 4294967295 + t + 1); for (var i = 0, s = Math.min(e.length - n, 4); i < s; ++i)e[n + i] = t >>> 8 * (r ? i : 3 - i) & 255 } function B(e, t, n, r, i, s) { if (n + r > e.length) throw new RangeError("Index out of range"); if (n < 0) throw new RangeError("Index out of range") } function z(e, t, n, r, s) { return s || B(e, 0, n, 4), i.write(e, t, n, r, 23, 4), n + 4 } function U(e, t, n, r, s) { return s || B(e, 0, n, 8), i.write(e, t, n, r, 52, 8), n + 8 } l.prototype.slice = function (e, t) { var n, r = this.length; if ((e = ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), (t = void 0 === t ? r : ~~t) < 0 ? (t += r) < 0 && (t = 0) : t > r && (t = r), t < e && (t = e), l.TYPED_ARRAY_SUPPORT) (n = this.subarray(e, t)).__proto__ = l.prototype; else { var i = t - e; n = new l(i, void 0); for (var s = 0; s < i; ++s)n[s] = this[s + e] } return n }, l.prototype.readUIntLE = function (e, t, n) { e |= 0, t |= 0, n || R(e, t, this.length); for (var r = this[e], i = 1, s = 0; ++s < t && (i *= 256);)r += this[e + s] * i; return r }, l.prototype.readUIntBE = function (e, t, n) { e |= 0, t |= 0, n || R(e, t, this.length); for (var r = this[e + --t], i = 1; t > 0 && (i *= 256);)r += this[e + --t] * i; return r }, l.prototype.readUInt8 = function (e, t) { return t || R(e, 1, this.length), this[e] }, l.prototype.readUInt16LE = function (e, t) { return t || R(e, 2, this.length), this[e] | this[e + 1] << 8 }, l.prototype.readUInt16BE = function (e, t) { return t || R(e, 2, this.length), this[e] << 8 | this[e + 1] }, l.prototype.readUInt32LE = function (e, t) { return t || R(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3] }, l.prototype.readUInt32BE = function (e, t) { return t || R(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]) }, l.prototype.readIntLE = function (e, t, n) { e |= 0, t |= 0, n || R(e, t, this.length); for (var r = this[e], i = 1, s = 0; ++s < t && (i *= 256);)r += this[e + s] * i; return r >= (i *= 128) && (r -= Math.pow(2, 8 * t)), r }, l.prototype.readIntBE = function (e, t, n) { e |= 0, t |= 0, n || R(e, t, this.length); for (var r = t, i = 1, s = this[e + --r]; r > 0 && (i *= 256);)s += this[e + --r] * i; return s >= (i *= 128) && (s -= Math.pow(2, 8 * t)), s }, l.prototype.readInt8 = function (e, t) { return t || R(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e] }, l.prototype.readInt16LE = function (e, t) { t || R(e, 2, this.length); var n = this[e] | this[e + 1] << 8; return 32768 & n ? 4294901760 | n : n }, l.prototype.readInt16BE = function (e, t) { t || R(e, 2, this.length); var n = this[e + 1] | this[e] << 8; return 32768 & n ? 4294901760 | n : n }, l.prototype.readInt32LE = function (e, t) { return t || R(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24 }, l.prototype.readInt32BE = function (e, t) { return t || R(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3] }, l.prototype.readFloatLE = function (e, t) { return t || R(e, 4, this.length), i.read(this, e, !0, 23, 4) }, l.prototype.readFloatBE = function (e, t) { return t || R(e, 4, this.length), i.read(this, e, !1, 23, 4) }, l.prototype.readDoubleLE = function (e, t) { return t || R(e, 8, this.length), i.read(this, e, !0, 52, 8) }, l.prototype.readDoubleBE = function (e, t) { return t || R(e, 8, this.length), i.read(this, e, !1, 52, 8) }, l.prototype.writeUIntLE = function (e, t, n, r) { (e = +e, t |= 0, n |= 0, r) || D(this, e, t, n, Math.pow(2, 8 * n) - 1, 0); var i = 1, s = 0; for (this[t] = 255 & e; ++s < n && (i *= 256);)this[t + s] = e / i & 255; return t + n }, l.prototype.writeUIntBE = function (e, t, n, r) { (e = +e, t |= 0, n |= 0, r) || D(this, e, t, n, Math.pow(2, 8 * n) - 1, 0); var i = n - 1, s = 1; for (this[t + i] = 255 & e; --i >= 0 && (s *= 256);)this[t + i] = e / s & 255; return t + n }, l.prototype.writeUInt8 = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 1, 255, 0), l.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[t] = 255 & e, t + 1 }, l.prototype.writeUInt16LE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : P(this, e, t, !0), t + 2 }, l.prototype.writeUInt16BE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : P(this, e, t, !1), t + 2 }, l.prototype.writeUInt32LE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e) : L(this, e, t, !0), t + 4 }, l.prototype.writeUInt32BE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : L(this, e, t, !1), t + 4 }, l.prototype.writeIntLE = function (e, t, n, r) { if (e = +e, t |= 0, !r) { var i = Math.pow(2, 8 * n - 1); D(this, e, t, n, i - 1, -i) } var s = 0, o = 1, a = 0; for (this[t] = 255 & e; ++s < n && (o *= 256);)e < 0 && 0 === a && 0 !== this[t + s - 1] && (a = 1), this[t + s] = (e / o | 0) - a & 255; return t + n }, l.prototype.writeIntBE = function (e, t, n, r) { if (e = +e, t |= 0, !r) { var i = Math.pow(2, 8 * n - 1); D(this, e, t, n, i - 1, -i) } var s = n - 1, o = 1, a = 0; for (this[t + s] = 255 & e; --s >= 0 && (o *= 256);)e < 0 && 0 === a && 0 !== this[t + s + 1] && (a = 1), this[t + s] = (e / o | 0) - a & 255; return t + n }, l.prototype.writeInt8 = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 1, 127, -128), l.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[t] = 255 & e, t + 1 }, l.prototype.writeInt16LE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : P(this, e, t, !0), t + 2 }, l.prototype.writeInt16BE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : P(this, e, t, !1), t + 2 }, l.prototype.writeInt32LE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 4, 2147483647, -2147483648), l.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24) : L(this, e, t, !0), t + 4 }, l.prototype.writeInt32BE = function (e, t, n) { return e = +e, t |= 0, n || D(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), l.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : L(this, e, t, !1), t + 4 }, l.prototype.writeFloatLE = function (e, t, n) { return z(this, e, t, !0, n) }, l.prototype.writeFloatBE = function (e, t, n) { return z(this, e, t, !1, n) }, l.prototype.writeDoubleLE = function (e, t, n) { return U(this, e, t, !0, n) }, l.prototype.writeDoubleBE = function (e, t, n) { return U(this, e, t, !1, n) }, l.prototype.copy = function (e, t, n, r) { if (n || (n = 0), r || 0 === r || (r = this.length), t >= e.length && (t = e.length), t || (t = 0), r > 0 && r < n && (r = n), r === n) return 0; if (0 === e.length || 0 === this.length) return 0; if (t < 0) throw new RangeError("targetStart out of bounds"); if (n < 0 || n >= this.length) throw new RangeError("sourceStart out of bounds"); if (r < 0) throw new RangeError("sourceEnd out of bounds"); r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n); var i, s = r - n; if (this === e && n < t && t < r) for (i = s - 1; i >= 0; --i)e[i + t] = this[i + n]; else if (s < 1e3 || !l.TYPED_ARRAY_SUPPORT) for (i = 0; i < s; ++i)e[i + t] = this[i + n]; else Uint8Array.prototype.set.call(e, this.subarray(n, n + s), t); return s }, l.prototype.fill = function (e, t, n, r) { if ("string" == typeof e) { if ("string" == typeof t ? (r = t, t = 0, n = this.length) : "string" == typeof n && (r = n, n = this.length), 1 === e.length) { var i = e.charCodeAt(0); i < 256 && (e = i) } if (void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string"); if ("string" == typeof r && !l.isEncoding(r)) throw new TypeError("Unknown encoding: " + r) } else "number" == typeof e && (e &= 255); if (t < 0 || this.length < t || this.length < n) throw new RangeError("Out of range index"); if (n <= t) return this; var s; if (t >>>= 0, n = void 0 === n ? this.length : n >>> 0, e || (e = 0), "number" == typeof e) for (s = t; s < n; ++s)this[s] = e; else { var o = l.isBuffer(e) ? e : W(new l(e, r).toString()), a = o.length; for (s = 0; s < n - t; ++s)this[s + t] = o[s % a] } return this }; var j = /[^+\/0-9A-Za-z-_]/g; function F(e) { return e < 16 ? "0" + e.toString(16) : e.toString(16) } function W(e, t) { var n; t = t || 1 / 0; for (var r = e.length, i = null, s = [], o = 0; o < r; ++o) { if ((n = e.charCodeAt(o)) > 55295 && n < 57344) { if (!i) { if (n > 56319) { (t -= 3) > -1 && s.push(239, 191, 189); continue } if (o + 1 === r) { (t -= 3) > -1 && s.push(239, 191, 189); continue } i = n; continue } if (n < 56320) { (t -= 3) > -1 && s.push(239, 191, 189), i = n; continue } n = 65536 + (i - 55296 << 10 | n - 56320) } else i && (t -= 3) > -1 && s.push(239, 191, 189); if (i = null, n < 128) { if ((t -= 1) < 0) break; s.push(n) } else if (n < 2048) { if ((t -= 2) < 0) break; s.push(n >> 6 | 192, 63 & n | 128) } else if (n < 65536) { if ((t -= 3) < 0) break; s.push(n >> 12 | 224, n >> 6 & 63 | 128, 63 & n | 128) } else { if (!(n < 1114112)) throw new Error("Invalid code point"); if ((t -= 4) < 0) break; s.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, 63 & n | 128) } } return s } function V(e) { return r.toByteArray(function (e) { if ((e = function (e) { return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "") }(e).replace(j, "")).length < 2) return ""; for (; e.length % 4 != 0;)e += "="; return e }(e)) } function G(e, t, n, r) { for (var i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i)t[i + n] = e[i]; return i } }).call(this, n(9)) }, function (e, t, n) { "use strict"; var r, i = "object" == typeof Reflect ? Reflect : null, s = i && "function" == typeof i.apply ? i.apply : function (e, t, n) { return Function.prototype.apply.call(e, t, n) }; r = i && "function" == typeof i.ownKeys ? i.ownKeys : Object.getOwnPropertySymbols ? function (e) { return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)) } : function (e) { return Object.getOwnPropertyNames(e) }; var o = Number.isNaN || function (e) { return e != e }; function a() { a.init.call(this) } e.exports = a, e.exports.once = function (e, t) { return new Promise((function (n, r) { function i(n) { e.removeListener(t, s), r(n) } function s() { "function" == typeof e.removeListener && e.removeListener("error", i), n([].slice.call(arguments)) } y(e, t, s, { once: !0 }), "error" !== t && function (e, t, n) { "function" == typeof e.on && y(e, "error", t, n) }(e, i, { once: !0 }) })) }, a.EventEmitter = a, a.prototype._events = void 0, a.prototype._eventsCount = 0, a.prototype._maxListeners = void 0; var l = 10; function c(e) { if ("function" != typeof e) throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e) } function u(e) { return void 0 === e._maxListeners ? a.defaultMaxListeners : e._maxListeners } function d(e, t, n, r) { var i, s, o, a; if (c(n), void 0 === (s = e._events) ? (s = e._events = Object.create(null), e._eventsCount = 0) : (void 0 !== s.newListener && (e.emit("newListener", t, n.listener ? n.listener : n), s = e._events), o = s[t]), void 0 === o) o = s[t] = n, ++e._eventsCount; else if ("function" == typeof o ? o = s[t] = r ? [n, o] : [o, n] : r ? o.unshift(n) : o.push(n), (i = u(e)) > 0 && o.length > i && !o.warned) { o.warned = !0; var l = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit"); l.name = "MaxListenersExceededWarning", l.emitter = e, l.type = t, l.count = o.length, a = l, console && console.warn && console.warn(a) } return e } function h() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 0 === arguments.length ? this.listener.call(this.target) : this.listener.apply(this.target, arguments) } function p(e, t, n) { var r = { fired: !1, wrapFn: void 0, target: e, type: t, listener: n }, i = h.bind(r); return i.listener = n, r.wrapFn = i, i } function m(e, t, n) { var r = e._events; if (void 0 === r) return []; var i = r[t]; return void 0 === i ? [] : "function" == typeof i ? n ? [i.listener || i] : [i] : n ? function (e) { for (var t = new Array(e.length), n = 0; n < t.length; ++n)t[n] = e[n].listener || e[n]; return t }(i) : g(i, i.length) } function f(e) { var t = this._events; if (void 0 !== t) { var n = t[e]; if ("function" == typeof n) return 1; if (void 0 !== n) return n.length } return 0 } function g(e, t) { for (var n = new Array(t), r = 0; r < t; ++r)n[r] = e[r]; return n } function y(e, t, n, r) { if ("function" == typeof e.on) r.once ? e.once(t, n) : e.on(t, n); else { if ("function" != typeof e.addEventListener) throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e); e.addEventListener(t, (function i(s) { r.once && e.removeEventListener(t, i), n(s) })) } } Object.defineProperty(a, "defaultMaxListeners", { enumerable: !0, get: function () { return l }, set: function (e) { if ("number" != typeof e || e < 0 || o(e)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + "."); l = e } }), a.init = function () { void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0 }, a.prototype.setMaxListeners = function (e) { if ("number" != typeof e || e < 0 || o(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 }, a.prototype.getMaxListeners = function () { return u(this) }, a.prototype.emit = function (e) { for (var t = [], n = 1; n < arguments.length; n++)t.push(arguments[n]); var r = "error" === e, i = this._events; if (void 0 !== i) r = r && void 0 === i.error; else if (!r) return !1; if (r) { var o; if (t.length > 0 && (o = t[0]), o instanceof Error) throw o; var a = new Error("Unhandled error." + (o ? " (" + o.message + ")" : "")); throw a.context = o, a } var l = i[e]; if (void 0 === l) return !1; if ("function" == typeof l) s(l, this, t); else { var c = l.length, u = g(l, c); for (n = 0; n < c; ++n)s(u[n], this, t) } return !0 }, a.prototype.addListener = function (e, t) { return d(this, e, t, !1) }, a.prototype.on = a.prototype.addListener, a.prototype.prependListener = function (e, t) { return d(this, e, t, !0) }, a.prototype.once = function (e, t) { return c(t), this.on(e, p(this, e, t)), this }, a.prototype.prependOnceListener = function (e, t) { return c(t), this.prependListener(e, p(this, e, t)), this }, a.prototype.removeListener = function (e, t) { var n, r, i, s, o; if (c(t), void 0 === (r = this._events)) return this; if (void 0 === (n = r[e])) return this; if (n === t || n.listener === t) 0 == --this._eventsCount ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t)); else if ("function" != typeof n) { for (i = -1, s = n.length - 1; s >= 0; s--)if (n[s] === t || n[s].listener === t) { o = n[s].listener, i = s; break } if (i < 0) return this; 0 === i ? n.shift() : function (e, t) { for (; t + 1 < e.length; t++)e[t] = e[t + 1]; e.pop() }(n, i), 1 === n.length && (r[e] = n[0]), void 0 !== r.removeListener && this.emit("removeListener", e, o || t) } return this }, a.prototype.off = a.prototype.removeListener, a.prototype.removeAllListeners = function (e) { var t, n, r; if (void 0 === (n = this._events)) return this; if (void 0 === n.removeListener) return 0 === arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== n[e] && (0 == --this._eventsCount ? this._events = Object.create(null) : delete n[e]), this; if (0 === arguments.length) { var i, s = Object.keys(n); for (r = 0; r < s.length; ++r)"removeListener" !== (i = s[r]) && this.removeAllListeners(i); return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this } if ("function" == typeof (t = n[e])) this.removeListener(e, t); else if (void 0 !== t) for (r = t.length - 1; r >= 0; r--)this.removeListener(e, t[r]); return this }, a.prototype.listeners = function (e) { return m(this, e, !0) }, a.prototype.rawListeners = function (e) { return m(this, e, !1) }, a.listenerCount = function (e, t) { return "function" == typeof e.listenerCount ? e.listenerCount(t) : f.call(e, t) }, a.prototype.listenerCount = f, a.prototype.eventNames = function () { return this._eventsCount > 0 ? r(this._events) : [] } }, function (e, t) { function n(e) { return { prev: null, next: null, data: e } } function r(e, t, n) { var r; return null !== s ? (r = s, s = s.cursor, r.prev = t, r.next = n, r.cursor = e.cursor) : r = { prev: t, next: n, cursor: e.cursor }, e.cursor = r, r } function i(e) { var t = e.cursor; e.cursor = t.cursor, t.prev = null, t.next = null, t.cursor = s, s = t } var s = null, o = function () { this.cursor = null, this.head = null, this.tail = null }; o.createItem = n, o.prototype.createItem = n, o.prototype.updateCursors = function (e, t, n, r) { for (var i = this.cursor; null !== i;)i.prev === e && (i.prev = t), i.next === n && (i.next = r), i = i.cursor }, o.prototype.getSize = function () { for (var e = 0, t = this.head; t;)e++, t = t.next; return e }, o.prototype.fromArray = function (e) { var t = null; this.head = null; for (var r = 0; r < e.length; r++) { var i = n(e[r]); null !== t ? t.next = i : this.head = i, i.prev = t, t = i } return this.tail = t, this }, o.prototype.toArray = function () { for (var e = this.head, t = []; e;)t.push(e.data), e = e.next; return t }, o.prototype.toJSON = o.prototype.toArray, o.prototype.isEmpty = function () { return null === this.head }, o.prototype.first = function () { return this.head && this.head.data }, o.prototype.last = function () { return this.tail && this.tail.data }, o.prototype.each = function (e, t) { var n; void 0 === t && (t = this); for (var s = r(this, null, this.head); null !== s.next;)n = s.next, s.next = n.next, e.call(t, n.data, n, this); i(this) }, o.prototype.forEach = o.prototype.each, o.prototype.eachRight = function (e, t) { var n; void 0 === t && (t = this); for (var s = r(this, this.tail, null); null !== s.prev;)n = s.prev, s.prev = n.prev, e.call(t, n.data, n, this); i(this) }, o.prototype.forEachRight = o.prototype.eachRight, o.prototype.reduce = function (e, t, n) { var s; void 0 === n && (n = this); for (var o = r(this, null, this.head), a = t; null !== o.next;)s = o.next, o.next = s.next, a = e.call(n, a, s.data, s, this); return i(this), a }, o.prototype.reduceRight = function (e, t, n) { var s; void 0 === n && (n = this); for (var o = r(this, this.tail, null), a = t; null !== o.prev;)s = o.prev, o.prev = s.prev, a = e.call(n, a, s.data, s, this); return i(this), a }, o.prototype.nextUntil = function (e, t, n) { if (null !== e) { var s; void 0 === n && (n = this); for (var o = r(this, null, e); null !== o.next && (s = o.next, o.next = s.next, !t.call(n, s.data, s, this));); i(this) } }, o.prototype.prevUntil = function (e, t, n) { if (null !== e) { var s; void 0 === n && (n = this); for (var o = r(this, e, null); null !== o.prev && (s = o.prev, o.prev = s.prev, !t.call(n, s.data, s, this));); i(this) } }, o.prototype.some = function (e, t) { var n = this.head; for (void 0 === t && (t = this); null !== n;) { if (e.call(t, n.data, n, this)) return !0; n = n.next } return !1 }, o.prototype.map = function (e, t) { var n = new o, r = this.head; for (void 0 === t && (t = this); null !== r;)n.appendData(e.call(t, r.data, r, this)), r = r.next; return n }, o.prototype.filter = function (e, t) { var n = new o, r = this.head; for (void 0 === t && (t = this); null !== r;)e.call(t, r.data, r, this) && n.appendData(r.data), r = r.next; return n }, o.prototype.clear = function () { this.head = null, this.tail = null }, o.prototype.copy = function () { for (var e = new o, t = this.head; null !== t;)e.insert(n(t.data)), t = t.next; return e }, o.prototype.prepend = function (e) { return this.updateCursors(null, e, this.head, e), null !== this.head ? (this.head.prev = e, e.next = this.head) : this.tail = e, this.head = e, this }, o.prototype.prependData = function (e) { return this.prepend(n(e)) }, o.prototype.append = function (e) { return this.insert(e) }, o.prototype.appendData = function (e) { return this.insert(n(e)) }, o.prototype.insert = function (e, t) { if (null != t) if (this.updateCursors(t.prev, e, t, e), null === t.prev) { if (this.head !== t) throw new Error("before doesn't belong to list"); this.head = e, t.prev = e, e.next = t, this.updateCursors(null, e) } else t.prev.next = e, e.prev = t.prev, t.prev = e, e.next = t; else this.updateCursors(this.tail, e, null, e), null !== this.tail ? (this.tail.next = e, e.prev = this.tail) : this.head = e, this.tail = e; return this }, o.prototype.insertData = function (e, t) { return this.insert(n(e), t) }, o.prototype.remove = function (e) { if (this.updateCursors(e, e.prev, e, e.next), null !== e.prev) e.prev.next = e.next; else { if (this.head !== e) throw new Error("item doesn't belong to list"); this.head = e.next } if (null !== e.next) e.next.prev = e.prev; else { if (this.tail !== e) throw new Error("item doesn't belong to list"); this.tail = e.prev } return e.prev = null, e.next = null, e }, o.prototype.push = function (e) { this.insert(n(e)) }, o.prototype.pop = function () { if (null !== this.tail) return this.remove(this.tail) }, o.prototype.unshift = function (e) { this.prepend(n(e)) }, o.prototype.shift = function () { if (null !== this.head) return this.remove(this.head) }, o.prototype.prependList = function (e) { return this.insertList(e, this.head) }, o.prototype.appendList = function (e) { return this.insertList(e) }, o.prototype.insertList = function (e, t) { return null === e.head || (null != t ? (this.updateCursors(t.prev, e.tail, t, e.head), null !== t.prev ? (t.prev.next = e.head, e.head.prev = t.prev) : this.head = e.head, t.prev = e.tail, e.tail.next = t) : (this.updateCursors(this.tail, e.tail, null, e.head), null !== this.tail ? (this.tail.next = e.head, e.head.prev = this.tail) : this.head = e.head, this.tail = e.tail), e.head = null, e.tail = null), this }, o.prototype.replace = function (e, t) { "head" in t ? this.insertList(t, e) : this.insert(t, e), this.remove(e) }, e.exports = o }, function (e, t, n) { n(65), e.exports = { TextEncoder: TextEncoder, TextDecoder: TextDecoder } }, function (e, t, n) { (function (t, n, r, i) { e.exports = function e(t, n, r) { function i(o, a) { if (!n[o]) { if (!t[o]) { if (s) return s(o, !0); var l = new Error("Cannot find module '" + o + "'"); throw l.code = "MODULE_NOT_FOUND", l } var c = n[o] = { exports: {} }; t[o][0].call(c.exports, (function (e) { return i(t[o][1][e] || e) }), c, c.exports, e, t, n, r) } return n[o].exports } for (var s = !1, o = 0; o < r.length; o++)i(r[o]); return i }({ 1: [function (e, t, n) { "use strict"; var r = e("./utils"), i = e("./support"), s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; n.encode = function (e) { for (var t, n, i, o, a, l, c, u = [], d = 0, h = e.length, p = h, m = "string" !== r.getTypeOf(e); d < e.length;)p = h - d, i = m ? (t = e[d++], n = d < h ? e[d++] : 0, d < h ? e[d++] : 0) : (t = e.charCodeAt(d++), n = d < h ? e.charCodeAt(d++) : 0, d < h ? e.charCodeAt(d++) : 0), o = t >> 2, a = (3 & t) << 4 | n >> 4, l = 1 < p ? (15 & n) << 2 | i >> 6 : 64, c = 2 < p ? 63 & i : 64, u.push(s.charAt(o) + s.charAt(a) + s.charAt(l) + s.charAt(c)); return u.join("") }, n.decode = function (e) { var t, n, r, o, a, l, c = 0, u = 0, d = "data:"; if (e.substr(0, d.length) === d) throw new Error("Invalid base64 input, it looks like a data url."); var h, p = 3 * (e = e.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; if (e.charAt(e.length - 1) === s.charAt(64) && p--, e.charAt(e.length - 2) === s.charAt(64) && p--, p % 1 != 0) throw new Error("Invalid base64 input, bad content length."); for (h = i.uint8array ? new Uint8Array(0 | p) : new Array(0 | p); c < e.length;)t = s.indexOf(e.charAt(c++)) << 2 | (o = s.indexOf(e.charAt(c++))) >> 4, n = (15 & o) << 4 | (a = s.indexOf(e.charAt(c++))) >> 2, r = (3 & a) << 6 | (l = s.indexOf(e.charAt(c++))), h[u++] = t, 64 !== a && (h[u++] = n), 64 !== l && (h[u++] = r); return h } }, { "./support": 30, "./utils": 32 }], 2: [function (e, t, n) { "use strict"; var r = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), o = e("./stream/DataLengthProbe"); function a(e, t, n, r, i) { this.compressedSize = e, this.uncompressedSize = t, this.crc32 = n, this.compression = r, this.compressedContent = i } a.prototype = { getContentWorker: function () { var e = new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")), t = this; return e.on("end", (function () { if (this.streamInfo.data_length !== t.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch") })), e }, getCompressedWorker: function () { return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression) } }, a.createWorkerFrom = function (e, t, n) { return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression", t) }, t.exports = a }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function (e, t, n) { "use strict"; var r = e("./stream/GenericWorker"); n.STORE = { magic: "\0\0", compressWorker: function () { return new r("STORE compression") }, uncompressWorker: function () { return new r("STORE decompression") } }, n.DEFLATE = e("./flate") }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function (e, t, n) { "use strict"; var r = e("./utils"), i = function () { for (var e, t = [], n = 0; n < 256; n++) { e = n; for (var r = 0; r < 8; r++)e = 1 & e ? 3988292384 ^ e >>> 1 : e >>> 1; t[n] = e } return t }(); t.exports = function (e, t) { return void 0 !== e && e.length ? "string" !== r.getTypeOf(e) ? function (e, t, n, r) { var s = i, o = r + n; e ^= -1; for (var a = r; a < o; a++)e = e >>> 8 ^ s[255 & (e ^ t[a])]; return ~e }(0 | t, e, e.length, 0) : function (e, t, n, r) { var s = i, o = r + n; e ^= -1; for (var a = r; a < o; a++)e = e >>> 8 ^ s[255 & (e ^ t.charCodeAt(a))]; return ~e }(0 | t, e, e.length, 0) : 0 } }, { "./utils": 32 }], 5: [function (e, t, n) { "use strict"; n.base64 = !1, n.binary = !1, n.dir = !1, n.createFolders = !0, n.date = null, n.compression = null, n.compressionOptions = null, n.comment = null, n.unixPermissions = null, n.dosPermissions = null }, {}], 6: [function (e, t, n) { "use strict"; var r = null; r = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: r } }, { lie: 37 }], 7: [function (e, t, n) { "use strict"; var r = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), o = e("./stream/GenericWorker"), a = r ? "uint8array" : "array"; function l(e, t) { o.call(this, "FlateWorker/" + e), this._pako = null, this._pakoAction = e, this._pakoOptions = t, this.meta = {} } n.magic = "\b\0", s.inherits(l, o), l.prototype.processChunk = function (e) { this.meta = e.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(a, e.data), !1) }, l.prototype.flush = function () { o.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], !0) }, l.prototype.cleanUp = function () { o.prototype.cleanUp.call(this), this._pako = null }, l.prototype._createPako = function () { this._pako = new i[this._pakoAction]({ chunkSize: 65536, raw: !0, level: this._pakoOptions.level || -1 }); var e = this; this._pako.onData = function (t) { e.push({ data: t, meta: e.meta }) } }, n.compressWorker = function (e) { return new l("Deflate", e) }, n.uncompressWorker = function () { return new l("Inflate", {}) } }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function (e, t, n) { "use strict"; function r(e, t) { var n, r = ""; for (n = 0; n < t; n++)r += String.fromCharCode(255 & e), e >>>= 8; return r } function i(e, t, n, i, o, u) { var d, h, p = e.file, m = e.compression, f = u !== a.utf8encode, g = s.transformTo("string", u(p.name)), y = s.transformTo("string", a.utf8encode(p.name)), b = p.comment, v = s.transformTo("string", u(b)), S = s.transformTo("string", a.utf8encode(b)), w = y.length !== p.name.length, k = S.length !== b.length, T = "", x = "", E = "", A = p.dir, C = p.date, I = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; t && !n || (I.crc32 = e.crc32, I.compressedSize = e.compressedSize, I.uncompressedSize = e.uncompressedSize); var O = 0; t && (O |= 8), f || !w && !k || (O |= 2048); var M = 0, N = 0; A && (M |= 16), "UNIX" === o ? (N = 798, M |= function (e, t) { var n = e; return e || (n = t ? 16893 : 33204), (65535 & n) << 16 }(p.unixPermissions, A)) : (N = 20, M |= function (e) { return 63 & (e || 0) }(p.dosPermissions)), d = C.getUTCHours(), d <<= 6, d |= C.getUTCMinutes(), d <<= 5, d |= C.getUTCSeconds() / 2, h = C.getUTCFullYear() - 1980, h <<= 4, h |= C.getUTCMonth() + 1, h <<= 5, h |= C.getUTCDate(), w && (x = r(1, 1) + r(l(g), 4) + y, T += "up" + r(x.length, 2) + x), k && (E = r(1, 1) + r(l(v), 4) + S, T += "uc" + r(E.length, 2) + E); var R = ""; return R += "\n\0", R += r(O, 2), R += m.magic, R += r(d, 2), R += r(h, 2), R += r(I.crc32, 4), R += r(I.compressedSize, 4), R += r(I.uncompressedSize, 4), R += r(g.length, 2), R += r(T.length, 2), { fileRecord: c.LOCAL_FILE_HEADER + R + g + T, dirRecord: c.CENTRAL_FILE_HEADER + r(N, 2) + R + r(v.length, 2) + "\0\0\0\0" + r(M, 4) + r(i, 4) + g + T + v } } var s = e("../utils"), o = e("../stream/GenericWorker"), a = e("../utf8"), l = e("../crc32"), c = e("../signature"); function u(e, t, n, r) { o.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t, this.zipPlatform = n, this.encodeFileName = r, this.streamFiles = e, this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [] } s.inherits(u, o), u.prototype.push = function (e) { var t = e.meta.percent || 0, n = this.entriesCount, r = this._sources.length; this.accumulate ? this.contentBuffer.push(e) : (this.bytesWritten += e.data.length, o.prototype.push.call(this, { data: e.data, meta: { currentFile: this.currentFile, percent: n ? (t + 100 * (n - r - 1)) / n : 100 } })) }, u.prototype.openedSource = function (e) { this.currentSourceOffset = this.bytesWritten, this.currentFile = e.file.name; var t = this.streamFiles && !e.file.dir; if (t) { var n = i(e, t, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); this.push({ data: n.fileRecord, meta: { percent: 0 } }) } else this.accumulate = !0 }, u.prototype.closedSource = function (e) { this.accumulate = !1; var t = this.streamFiles && !e.file.dir, n = i(e, t, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); if (this.dirRecords.push(n.dirRecord), t) this.push({ data: function (e) { return c.DATA_DESCRIPTOR + r(e.crc32, 4) + r(e.compressedSize, 4) + r(e.uncompressedSize, 4) }(e), meta: { percent: 100 } }); else for (this.push({ data: n.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length;)this.push(this.contentBuffer.shift()); this.currentFile = null }, u.prototype.flush = function () { for (var e = this.bytesWritten, t = 0; t < this.dirRecords.length; t++)this.push({ data: this.dirRecords[t], meta: { percent: 100 } }); var n = this.bytesWritten - e, i = function (e, t, n, i, o) { var a = s.transformTo("string", o(i)); return c.CENTRAL_DIRECTORY_END + "\0\0\0\0" + r(e, 2) + r(e, 2) + r(t, 4) + r(n, 4) + r(a.length, 2) + a }(this.dirRecords.length, n, e, this.zipComment, this.encodeFileName); this.push({ data: i, meta: { percent: 100 } }) }, u.prototype.prepareNextSource = function () { this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume() }, u.prototype.registerPrevious = function (e) { this._sources.push(e); var t = this; return e.on("data", (function (e) { t.processChunk(e) })), e.on("end", (function () { t.closedSource(t.previous.streamInfo), t._sources.length ? t.prepareNextSource() : t.end() })), e.on("error", (function (e) { t.error(e) })), this }, u.prototype.resume = function () { return !!o.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), !0) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), !0)) }, u.prototype.error = function (e) { var t = this._sources; if (!o.prototype.error.call(this, e)) return !1; for (var n = 0; n < t.length; n++)try { t[n].error(e) } catch (e) { } return !0 }, u.prototype.lock = function () { o.prototype.lock.call(this); for (var e = this._sources, t = 0; t < e.length; t++)e[t].lock() }, t.exports = u }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function (e, t, n) { "use strict"; var r = e("../compressions"), i = e("./ZipFileWorker"); n.generateWorker = function (e, t, n) { var s = new i(t.streamFiles, n, t.platform, t.encodeFileName), o = 0; try { e.forEach((function (e, n) { o++; var i = function (e, t) { var n = e || t, i = r[n]; if (!i) throw new Error(n + " is not a valid compression method !"); return i }(n.options.compression, t.compression), a = n.options.compressionOptions || t.compressionOptions || {}, l = n.dir, c = n.date; n._compressWorker(i, a).withStreamInfo("file", { name: e, dir: l, date: c, comment: n.comment || "", unixPermissions: n.unixPermissions, dosPermissions: n.dosPermissions }).pipe(s) })), s.entriesCount = o } catch (e) { s.error(e) } return s } }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function (e, t, n) { "use strict"; function r() { if (!(this instanceof r)) return new r; if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); this.files = Object.create(null), this.comment = null, this.root = "", this.clone = function () { var e = new r; for (var t in this) "function" != typeof this[t] && (e[t] = this[t]); return e } } (r.prototype = e("./object")).loadAsync = e("./load"), r.support = e("./support"), r.defaults = e("./defaults"), r.version = "3.10.1", r.loadAsync = function (e, t) { return (new r).loadAsync(e, t) }, r.external = e("./external"), t.exports = r }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function (e, t, n) { "use strict"; var r = e("./utils"), i = e("./external"), s = e("./utf8"), o = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils"); function c(e) { return new i.Promise((function (t, n) { var r = e.decompressed.getContentWorker().pipe(new a); r.on("error", (function (e) { n(e) })).on("end", (function () { r.streamInfo.crc32 !== e.decompressed.crc32 ? n(new Error("Corrupted zip : CRC32 mismatch")) : t() })).resume() })) } t.exports = function (e, t) { var n = this; return t = r.extend(t || {}, { base64: !1, checkCRC32: !1, optimizedBinaryString: !1, createFolders: !1, decodeFileName: s.utf8decode }), l.isNode && l.isStream(e) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : r.prepareContent("the loaded zip file", e, !0, t.optimizedBinaryString, t.base64).then((function (e) { var n = new o(t); return n.load(e), n })).then((function (e) { var n = [i.Promise.resolve(e)], r = e.files; if (t.checkCRC32) for (var s = 0; s < r.length; s++)n.push(c(r[s])); return i.Promise.all(n) })).then((function (e) { for (var i = e.shift(), s = i.files, o = 0; o < s.length; o++) { var a = s[o], l = a.fileNameStr, c = r.resolve(a.fileNameStr); n.file(c, a.decompressed, { binary: !0, optimizedBinaryString: !0, date: a.date, dir: a.dir, comment: a.fileCommentStr.length ? a.fileCommentStr : null, unixPermissions: a.unixPermissions, dosPermissions: a.dosPermissions, createFolders: t.createFolders }), a.dir || (n.file(c).unsafeOriginalName = l) } return i.zipComment.length && (n.comment = i.zipComment), n })) } }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function (e, t, n) { "use strict"; var r = e("../utils"), i = e("../stream/GenericWorker"); function s(e, t) { i.call(this, "Nodejs stream input adapter for " + e), this._upstreamEnded = !1, this._bindStream(t) } r.inherits(s, i), s.prototype._bindStream = function (e) { var t = this; (this._stream = e).pause(), e.on("data", (function (e) { t.push({ data: e, meta: { percent: 0 } }) })).on("error", (function (e) { t.isPaused ? this.generatedError = e : t.error(e) })).on("end", (function () { t.isPaused ? t._upstreamEnded = !0 : t.end() })) }, s.prototype.pause = function () { return !!i.prototype.pause.call(this) && (this._stream.pause(), !0) }, s.prototype.resume = function () { return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), !0) }, t.exports = s }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function (e, t, n) { "use strict"; var r = e("readable-stream").Readable; function i(e, t, n) { r.call(this, t), this._helper = e; var i = this; e.on("data", (function (e, t) { i.push(e) || i._helper.pause(), n && n(t) })).on("error", (function (e) { i.emit("error", e) })).on("end", (function () { i.push(null) })) } e("../utils").inherits(i, r), i.prototype._read = function () { this._helper.resume() }, t.exports = i }, { "../utils": 32, "readable-stream": 16 }], 14: [function (e, n, r) { "use strict"; n.exports = { isNode: void 0 !== t, newBufferFrom: function (e, n) { if (t.from && t.from !== Uint8Array.from) return t.from(e, n); if ("number" == typeof e) throw new Error('The "data" argument must not be a number'); return new t(e, n) }, allocBuffer: function (e) { if (t.alloc) return t.alloc(e); var n = new t(e); return n.fill(0), n }, isBuffer: function (e) { return t.isBuffer(e) }, isStream: function (e) { return e && "function" == typeof e.on && "function" == typeof e.pause && "function" == typeof e.resume } } }, {}], 15: [function (e, t, n) { "use strict"; function r(e, t, n) { var r, i = s.getTypeOf(t), a = s.extend(n || {}, l); a.date = a.date || new Date, null !== a.compression && (a.compression = a.compression.toUpperCase()), "string" == typeof a.unixPermissions && (a.unixPermissions = parseInt(a.unixPermissions, 8)), a.unixPermissions && 16384 & a.unixPermissions && (a.dir = !0), a.dosPermissions && 16 & a.dosPermissions && (a.dir = !0), a.dir && (e = f(e)), a.createFolders && (r = m(e)) && g.call(this, r, !0); var d = "string" === i && !1 === a.binary && !1 === a.base64; n && void 0 !== n.binary || (a.binary = !d), (t instanceof c && 0 === t.uncompressedSize || a.dir || !t || 0 === t.length) && (a.base64 = !1, a.binary = !0, t = "", a.compression = "STORE", i = "string"); var y = null; y = t instanceof c || t instanceof o ? t : h.isNode && h.isStream(t) ? new p(e, t) : s.prepareContent(e, t, a.binary, a.optimizedBinaryString, a.base64); var b = new u(e, y, a); this.files[e] = b } var i = e("./utf8"), s = e("./utils"), o = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), l = e("./defaults"), c = e("./compressedObject"), u = e("./zipObject"), d = e("./generate"), h = e("./nodejsUtils"), p = e("./nodejs/NodejsStreamInputAdapter"), m = function (e) { "/" === e.slice(-1) && (e = e.substring(0, e.length - 1)); var t = e.lastIndexOf("/"); return 0 < t ? e.substring(0, t) : "" }, f = function (e) { return "/" !== e.slice(-1) && (e += "/"), e }, g = function (e, t) { return t = void 0 !== t ? t : l.createFolders, e = f(e), this.files[e] || r.call(this, e, null, { dir: !0, createFolders: t }), this.files[e] }; function y(e) { return "[object RegExp]" === Object.prototype.toString.call(e) } var b = { load: function () { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.") }, forEach: function (e) { var t, n, r; for (t in this.files) r = this.files[t], (n = t.slice(this.root.length, t.length)) && t.slice(0, this.root.length) === this.root && e(n, r) }, filter: function (e) { var t = []; return this.forEach((function (n, r) { e(n, r) && t.push(r) })), t }, file: function (e, t, n) { if (1 !== arguments.length) return e = this.root + e, r.call(this, e, t, n), this; if (y(e)) { var i = e; return this.filter((function (e, t) { return !t.dir && i.test(e) })) } var s = this.files[this.root + e]; return s && !s.dir ? s : null }, folder: function (e) { if (!e) return this; if (y(e)) return this.filter((function (t, n) { return n.dir && e.test(t) })); var t = this.root + e, n = g.call(this, t), r = this.clone(); return r.root = n.name, r }, remove: function (e) { e = this.root + e; var t = this.files[e]; if (t || ("/" !== e.slice(-1) && (e += "/"), t = this.files[e]), t && !t.dir) delete this.files[e]; else for (var n = this.filter((function (t, n) { return n.name.slice(0, e.length) === e })), r = 0; r < n.length; r++)delete this.files[n[r].name]; return this }, generate: function () { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.") }, generateInternalStream: function (e) { var t, n = {}; try { if ((n = s.extend(e || {}, { streamFiles: !1, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = n.type.toLowerCase(), n.compression = n.compression.toUpperCase(), "binarystring" === n.type && (n.type = "string"), !n.type) throw new Error("No output type specified."); s.checkSupport(n.type), "darwin" !== n.platform && "freebsd" !== n.platform && "linux" !== n.platform && "sunos" !== n.platform || (n.platform = "UNIX"), "win32" === n.platform && (n.platform = "DOS"); var r = n.comment || this.comment || ""; t = d.generateWorker(this, n, r) } catch (e) { (t = new o("error")).error(e) } return new a(t, n.type || "string", n.mimeType) }, generateAsync: function (e, t) { return this.generateInternalStream(e).accumulate(t) }, generateNodeStream: function (e, t) { return (e = e || {}).type || (e.type = "nodebuffer"), this.generateInternalStream(e).toNodejsStream(t) } }; t.exports = b }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function (e, t, n) { "use strict"; t.exports = e("stream") }, { stream: void 0 }], 17: [function (e, t, n) { "use strict"; var r = e("./DataReader"); function i(e) { r.call(this, e); for (var t = 0; t < this.data.length; t++)e[t] = 255 & e[t] } e("../utils").inherits(i, r), i.prototype.byteAt = function (e) { return this.data[this.zero + e] }, i.prototype.lastIndexOfSignature = function (e) { for (var t = e.charCodeAt(0), n = e.charCodeAt(1), r = e.charCodeAt(2), i = e.charCodeAt(3), s = this.length - 4; 0 <= s; --s)if (this.data[s] === t && this.data[s + 1] === n && this.data[s + 2] === r && this.data[s + 3] === i) return s - this.zero; return -1 }, i.prototype.readAndCheckSignature = function (e) { var t = e.charCodeAt(0), n = e.charCodeAt(1), r = e.charCodeAt(2), i = e.charCodeAt(3), s = this.readData(4); return t === s[0] && n === s[1] && r === s[2] && i === s[3] }, i.prototype.readData = function (e) { if (this.checkOffset(e), 0 === e) return []; var t = this.data.slice(this.zero + this.index, this.zero + this.index + e); return this.index += e, t }, t.exports = i }, { "../utils": 32, "./DataReader": 18 }], 18: [function (e, t, n) { "use strict"; var r = e("../utils"); function i(e) { this.data = e, this.length = e.length, this.index = 0, this.zero = 0 } i.prototype = { checkOffset: function (e) { this.checkIndex(this.index + e) }, checkIndex: function (e) { if (this.length < this.zero + e || e < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e + "). Corrupted zip ?") }, setIndex: function (e) { this.checkIndex(e), this.index = e }, skip: function (e) { this.setIndex(this.index + e) }, byteAt: function () { }, readInt: function (e) { var t, n = 0; for (this.checkOffset(e), t = this.index + e - 1; t >= this.index; t--)n = (n << 8) + this.byteAt(t); return this.index += e, n }, readString: function (e) { return r.transformTo("string", this.readData(e)) }, readData: function () { }, lastIndexOfSignature: function () { }, readAndCheckSignature: function () { }, readDate: function () { var e = this.readInt(4); return new Date(Date.UTC(1980 + (e >> 25 & 127), (e >> 21 & 15) - 1, e >> 16 & 31, e >> 11 & 31, e >> 5 & 63, (31 & e) << 1)) } }, t.exports = i }, { "../utils": 32 }], 19: [function (e, t, n) { "use strict"; var r = e("./Uint8ArrayReader"); function i(e) { r.call(this, e) } e("../utils").inherits(i, r), i.prototype.readData = function (e) { this.checkOffset(e); var t = this.data.subarray(this.zero + this.index, this.zero + this.index + e); return this.index += e, t }, t.exports = i }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function (e, t, n) { "use strict"; var r = e("./DataReader"); function i(e) { r.call(this, e) } e("../utils").inherits(i, r), i.prototype.byteAt = function (e) { return this.data.charCodeAt(this.zero + e) }, i.prototype.lastIndexOfSignature = function (e) { return this.data.lastIndexOf(e) - this.zero }, i.prototype.readAndCheckSignature = function (e) { return e === this.readData(4) }, i.prototype.readData = function (e) { this.checkOffset(e); var t = this.data.slice(this.zero + this.index, this.zero + this.index + e); return this.index += e, t }, t.exports = i }, { "../utils": 32, "./DataReader": 18 }], 21: [function (e, t, n) { "use strict"; var r = e("./ArrayReader"), i = e("./DataReader"); function s(e) { i.call(this, e) } e("../utils").inherits(s, r), s.prototype.readData = function (e) { if (this.checkOffset(e), 0 === e) return new Uint8Array(0); var t = this.data.subarray(this.zero + this.index, this.zero + this.index + e); return this.index += e, t }, t.exports = s }, { "../utils": 32, "./ArrayReader": 17, "./DataReader": 18 }], 22: [function (e, t, n) { "use strict"; var r = e("../utils"), i = e("../support"), s = e("./ArrayReader"), o = e("./StringReader"), a = e("./NodeBufferReader"), l = e("./Uint8ArrayReader"); t.exports = function (e) { var t = r.getTypeOf(e); return r.checkSupport(t), "string" !== t || i.uint8array ? "nodebuffer" === t ? new a(e) : i.uint8array ? new l(r.transformTo("uint8array", e)) : new s(r.transformTo("array", e)) : new o(e) } }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function (e, t, n) { "use strict"; n.LOCAL_FILE_HEADER = "PK", n.CENTRAL_FILE_HEADER = "PK", n.CENTRAL_DIRECTORY_END = "PK", n.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK", n.ZIP64_CENTRAL_DIRECTORY_END = "PK", n.DATA_DESCRIPTOR = "PK\b" }, {}], 24: [function (e, t, n) { "use strict"; var r = e("./GenericWorker"), i = e("../utils"); function s(e) { r.call(this, "ConvertWorker to " + e), this.destType = e } i.inherits(s, r), s.prototype.processChunk = function (e) { this.push({ data: i.transformTo(this.destType, e.data), meta: e.meta }) }, t.exports = s }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function (e, t, n) { "use strict"; var r = e("./GenericWorker"), i = e("../crc32"); function s() { r.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0) } e("../utils").inherits(s, r), s.prototype.processChunk = function (e) { this.streamInfo.crc32 = i(e.data, this.streamInfo.crc32 || 0), this.push(e) }, t.exports = s }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function (e, t, n) { "use strict"; var r = e("../utils"), i = e("./GenericWorker"); function s(e) { i.call(this, "DataLengthProbe for " + e), this.propName = e, this.withStreamInfo(e, 0) } r.inherits(s, i), s.prototype.processChunk = function (e) { if (e) { var t = this.streamInfo[this.propName] || 0; this.streamInfo[this.propName] = t + e.data.length } i.prototype.processChunk.call(this, e) }, t.exports = s }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function (e, t, n) { "use strict"; var r = e("../utils"), i = e("./GenericWorker"); function s(e) { i.call(this, "DataWorker"); var t = this; this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = !1, e.then((function (e) { t.dataIsReady = !0, t.data = e, t.max = e && e.length || 0, t.type = r.getTypeOf(e), t.isPaused || t._tickAndRepeat() }), (function (e) { t.error(e) })) } r.inherits(s, i), s.prototype.cleanUp = function () { i.prototype.cleanUp.call(this), this.data = null }, s.prototype.resume = function () { return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, r.delay(this._tickAndRepeat, [], this)), !0) }, s.prototype._tickAndRepeat = function () { this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (r.delay(this._tickAndRepeat, [], this), this._tickScheduled = !0)) }, s.prototype._tick = function () { if (this.isPaused || this.isFinished) return !1; var e = null, t = Math.min(this.max, this.index + 65536); if (this.index >= this.max) return this.end(); switch (this.type) { case "string": e = this.data.substring(this.index, t); break; case "uint8array": case "nodebuffer": e = this.data.subarray(this.index, t); break; case "array": e = this.data.slice(this.index, t) }return this.index = t, this.push({ data: e, meta: { percent: this.max ? this.index / this.max * 100 : 0 } }) }, t.exports = s }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function (e, t, n) { "use strict"; function r(e) { this.name = e || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = !0, this.isFinished = !1, this.isLocked = !1, this._listeners = { data: [], end: [], error: [] }, this.previous = null } r.prototype = { push: function (e) { this.emit("data", e) }, end: function () { if (this.isFinished) return !1; this.flush(); try { this.emit("end"), this.cleanUp(), this.isFinished = !0 } catch (e) { this.emit("error", e) } return !0 }, error: function (e) { return !this.isFinished && (this.isPaused ? this.generatedError = e : (this.isFinished = !0, this.emit("error", e), this.previous && this.previous.error(e), this.cleanUp()), !0) }, on: function (e, t) { return this._listeners[e].push(t), this }, cleanUp: function () { this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [] }, emit: function (e, t) { if (this._listeners[e]) for (var n = 0; n < this._listeners[e].length; n++)this._listeners[e][n].call(this, t) }, pipe: function (e) { return e.registerPrevious(this) }, registerPrevious: function (e) { if (this.isLocked) throw new Error("The stream '" + this + "' has already been used."); this.streamInfo = e.streamInfo, this.mergeStreamInfo(), this.previous = e; var t = this; return e.on("data", (function (e) { t.processChunk(e) })), e.on("end", (function () { t.end() })), e.on("error", (function (e) { t.error(e) })), this }, pause: function () { return !this.isPaused && !this.isFinished && (this.isPaused = !0, this.previous && this.previous.pause(), !0) }, resume: function () { if (!this.isPaused || this.isFinished) return !1; var e = this.isPaused = !1; return this.generatedError && (this.error(this.generatedError), e = !0), this.previous && this.previous.resume(), !e }, flush: function () { }, processChunk: function (e) { this.push(e) }, withStreamInfo: function (e, t) { return this.extraStreamInfo[e] = t, this.mergeStreamInfo(), this }, mergeStreamInfo: function () { for (var e in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e) && (this.streamInfo[e] = this.extraStreamInfo[e]) }, lock: function () { if (this.isLocked) throw new Error("The stream '" + this + "' has already been used."); this.isLocked = !0, this.previous && this.previous.lock() }, toString: function () { var e = "Worker " + this.name; return this.previous ? this.previous + " -> " + e : e } }, t.exports = r }, {}], 29: [function (e, n, r) { "use strict"; var i = e("../utils"), s = e("./ConvertWorker"), o = e("./GenericWorker"), a = e("../base64"), l = e("../support"), c = e("../external"), u = null; if (l.nodestream) try { u = e("../nodejs/NodejsStreamOutputAdapter") } catch (e) { } function d(e, n) { return new c.Promise((function (r, s) { var o = [], l = e._internalType, c = e._outputType, u = e._mimeType; e.on("data", (function (e, t) { o.push(e), n && n(t) })).on("error", (function (e) { o = [], s(e) })).on("end", (function () { try { var e = function (e, t, n) { switch (e) { case "blob": return i.newBlob(i.transformTo("arraybuffer", t), n); case "base64": return a.encode(t); default: return i.transformTo(e, t) } }(c, function (e, n) { var r, i = 0, s = null, o = 0; for (r = 0; r < n.length; r++)o += n[r].length; switch (e) { case "string": return n.join(""); case "array": return Array.prototype.concat.apply([], n); case "uint8array": for (s = new Uint8Array(o), r = 0; r < n.length; r++)s.set(n[r], i), i += n[r].length; return s; case "nodebuffer": return t.concat(n); default: throw new Error("concat : unsupported type '" + e + "'") } }(l, o), u); r(e) } catch (e) { s(e) } o = [] })).resume() })) } function h(e, t, n) { var r = t; switch (t) { case "blob": case "arraybuffer": r = "uint8array"; break; case "base64": r = "string" }try { this._internalType = r, this._outputType = t, this._mimeType = n, i.checkSupport(r), this._worker = e.pipe(new s(r)), e.lock() } catch (e) { this._worker = new o("error"), this._worker.error(e) } } h.prototype = { accumulate: function (e) { return d(this, e) }, on: function (e, t) { var n = this; return "data" === e ? this._worker.on(e, (function (e) { t.call(n, e.data, e.meta) })) : this._worker.on(e, (function () { i.delay(t, arguments, n) })), this }, resume: function () { return i.delay(this._worker.resume, [], this._worker), this }, pause: function () { return this._worker.pause(), this }, toNodejsStream: function (e) { if (i.checkSupport("nodestream"), "nodebuffer" !== this._outputType) throw new Error(this._outputType + " is not supported by this method"); return new u(this, { objectMode: "nodebuffer" !== this._outputType }, e) } }, n.exports = h }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function (e, n, r) { "use strict"; if (r.base64 = !0, r.array = !0, r.string = !0, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = void 0 !== t, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) r.blob = !1; else { var i = new ArrayBuffer(0); try { r.blob = 0 === new Blob([i], { type: "application/zip" }).size } catch (e) { try { var s = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder); s.append(i), r.blob = 0 === s.getBlob("application/zip").size } catch (e) { r.blob = !1 } } } try { r.nodestream = !!e("readable-stream").Readable } catch (e) { r.nodestream = !1 } }, { "readable-stream": 16 }], 31: [function (e, t, n) { "use strict"; for (var r = e("./utils"), i = e("./support"), s = e("./nodejsUtils"), o = e("./stream/GenericWorker"), a = new Array(256), l = 0; l < 256; l++)a[l] = 252 <= l ? 6 : 248 <= l ? 5 : 240 <= l ? 4 : 224 <= l ? 3 : 192 <= l ? 2 : 1; function c() { o.call(this, "utf-8 decode"), this.leftOver = null } function u() { o.call(this, "utf-8 encode") } a[254] = a[254] = 1, n.utf8encode = function (e) { return i.nodebuffer ? s.newBufferFrom(e, "utf-8") : function (e) { var t, n, r, s, o, a = e.length, l = 0; for (s = 0; s < a; s++)55296 == (64512 & (n = e.charCodeAt(s))) && s + 1 < a && 56320 == (64512 & (r = e.charCodeAt(s + 1))) && (n = 65536 + (n - 55296 << 10) + (r - 56320), s++), l += n < 128 ? 1 : n < 2048 ? 2 : n < 65536 ? 3 : 4; for (t = i.uint8array ? new Uint8Array(l) : new Array(l), s = o = 0; o < l; s++)55296 == (64512 & (n = e.charCodeAt(s))) && s + 1 < a && 56320 == (64512 & (r = e.charCodeAt(s + 1))) && (n = 65536 + (n - 55296 << 10) + (r - 56320), s++), n < 128 ? t[o++] = n : (n < 2048 ? t[o++] = 192 | n >>> 6 : (n < 65536 ? t[o++] = 224 | n >>> 12 : (t[o++] = 240 | n >>> 18, t[o++] = 128 | n >>> 12 & 63), t[o++] = 128 | n >>> 6 & 63), t[o++] = 128 | 63 & n); return t }(e) }, n.utf8decode = function (e) { return i.nodebuffer ? r.transformTo("nodebuffer", e).toString("utf-8") : function (e) { var t, n, i, s, o = e.length, l = new Array(2 * o); for (t = n = 0; t < o;)if ((i = e[t++]) < 128) l[n++] = i; else if (4 < (s = a[i])) l[n++] = 65533, t += s - 1; else { for (i &= 2 === s ? 31 : 3 === s ? 15 : 7; 1 < s && t < o;)i = i << 6 | 63 & e[t++], s--; 1 < s ? l[n++] = 65533 : i < 65536 ? l[n++] = i : (i -= 65536, l[n++] = 55296 | i >> 10 & 1023, l[n++] = 56320 | 1023 & i) } return l.length !== n && (l.subarray ? l = l.subarray(0, n) : l.length = n), r.applyFromCharCode(l) }(e = r.transformTo(i.uint8array ? "uint8array" : "array", e)) }, r.inherits(c, o), c.prototype.processChunk = function (e) { var t = r.transformTo(i.uint8array ? "uint8array" : "array", e.data); if (this.leftOver && this.leftOver.length) { if (i.uint8array) { var s = t; (t = new Uint8Array(s.length + this.leftOver.length)).set(this.leftOver, 0), t.set(s, this.leftOver.length) } else t = this.leftOver.concat(t); this.leftOver = null } var o = function (e, t) { var n; for ((t = t || e.length) > e.length && (t = e.length), n = t - 1; 0 <= n && 128 == (192 & e[n]);)n--; return n < 0 || 0 === n ? t : n + a[e[n]] > t ? n : t }(t), l = t; o !== t.length && (i.uint8array ? (l = t.subarray(0, o), this.leftOver = t.subarray(o, t.length)) : (l = t.slice(0, o), this.leftOver = t.slice(o, t.length))), this.push({ data: n.utf8decode(l), meta: e.meta }) }, c.prototype.flush = function () { this.leftOver && this.leftOver.length && (this.push({ data: n.utf8decode(this.leftOver), meta: {} }), this.leftOver = null) }, n.Utf8DecodeWorker = c, r.inherits(u, o), u.prototype.processChunk = function (e) { this.push({ data: n.utf8encode(e.data), meta: e.meta }) }, n.Utf8EncodeWorker = u }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function (e, t, r) { "use strict"; var i = e("./support"), s = e("./base64"), o = e("./nodejsUtils"), a = e("./external"); function l(e) { return e } function c(e, t) { for (var n = 0; n < e.length; ++n)t[n] = 255 & e.charCodeAt(n); return t } e("setimmediate"), r.newBlob = function (e, t) { r.checkSupport("blob"); try { return new Blob([e], { type: t }) } catch (r) { try { var n = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder); return n.append(e), n.getBlob(t) } catch (e) { throw new Error("Bug : can't construct the Blob.") } } }; var u = { stringifyByChunk: function (e, t, n) { var r = [], i = 0, s = e.length; if (s <= n) return String.fromCharCode.apply(null, e); for (; i < s;)"array" === t || "nodebuffer" === t ? r.push(String.fromCharCode.apply(null, e.slice(i, Math.min(i + n, s)))) : r.push(String.fromCharCode.apply(null, e.subarray(i, Math.min(i + n, s)))), i += n; return r.join("") }, stringifyByChar: function (e) { for (var t = "", n = 0; n < e.length; n++)t += String.fromCharCode(e[n]); return t }, applyCanBeUsed: { uint8array: function () { try { return i.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length } catch (e) { return !1 } }(), nodebuffer: function () { try { return i.nodebuffer && 1 === String.fromCharCode.apply(null, o.allocBuffer(1)).length } catch (e) { return !1 } }() } }; function d(e) { var t = 65536, n = r.getTypeOf(e), i = !0; if ("uint8array" === n ? i = u.applyCanBeUsed.uint8array : "nodebuffer" === n && (i = u.applyCanBeUsed.nodebuffer), i) for (; 1 < t;)try { return u.stringifyByChunk(e, n, t) } catch (e) { t = Math.floor(t / 2) } return u.stringifyByChar(e) } function h(e, t) { for (var n = 0; n < e.length; n++)t[n] = e[n]; return t } r.applyFromCharCode = d; var p = {}; p.string = { string: l, array: function (e) { return c(e, new Array(e.length)) }, arraybuffer: function (e) { return p.string.uint8array(e).buffer }, uint8array: function (e) { return c(e, new Uint8Array(e.length)) }, nodebuffer: function (e) { return c(e, o.allocBuffer(e.length)) } }, p.array = { string: d, array: l, arraybuffer: function (e) { return new Uint8Array(e).buffer }, uint8array: function (e) { return new Uint8Array(e) }, nodebuffer: function (e) { return o.newBufferFrom(e) } }, p.arraybuffer = { string: function (e) { return d(new Uint8Array(e)) }, array: function (e) { return h(new Uint8Array(e), new Array(e.byteLength)) }, arraybuffer: l, uint8array: function (e) { return new Uint8Array(e) }, nodebuffer: function (e) { return o.newBufferFrom(new Uint8Array(e)) } }, p.uint8array = { string: d, array: function (e) { return h(e, new Array(e.length)) }, arraybuffer: function (e) { return e.buffer }, uint8array: l, nodebuffer: function (e) { return o.newBufferFrom(e) } }, p.nodebuffer = { string: d, array: function (e) { return h(e, new Array(e.length)) }, arraybuffer: function (e) { return e.buffer }, uint8array: function (e) { return new Uint8Array(e.buffer, e.byteOffset, e.byteLength) }, nodebuffer: l }, r.transformTo = function (e, t) { if (t = t || "", !e) return t; r.checkSupport(e); var n = r.getTypeOf(t); return p[n][e](t) }, r.resolve = function (e) { for (var t = e.split("/"), n = [], r = 0; r < t.length; r++) { var i = t[r]; "." === i || "" === i && 0 !== r && r !== t.length - 1 || (".." === i ? n.pop() : n.push(i)) } return n.join("/") }, r.getTypeOf = function (e) { return "string" == typeof e ? "string" : "[object Array]" === Object.prototype.toString.call(e) ? "array" : i.nodebuffer && o.isBuffer(e) ? "nodebuffer" : i.uint8array && e instanceof Uint8Array ? "uint8array" : i.arraybuffer && e instanceof ArrayBuffer ? "arraybuffer" : void 0 }, r.checkSupport = function (e) { if (!i[e.toLowerCase()]) throw new Error(e + " is not supported by this platform") }, r.MAX_VALUE_16BITS = 65535, r.MAX_VALUE_32BITS = -1, r.pretty = function (e) { var t, n, r = ""; for (n = 0; n < (e || "").length; n++)r += "\\x" + ((t = e.charCodeAt(n)) < 16 ? "0" : "") + t.toString(16).toUpperCase(); return r }, r.delay = function (e, t, r) { n((function () { e.apply(r || null, t || []) })) }, r.inherits = function (e, t) { function n() { } n.prototype = t.prototype, e.prototype = new n }, r.extend = function () { var e, t, n = {}; for (e = 0; e < arguments.length; e++)for (t in arguments[e]) Object.prototype.hasOwnProperty.call(arguments[e], t) && void 0 === n[t] && (n[t] = arguments[e][t]); return n }, r.prepareContent = function (e, t, n, o, l) { return a.Promise.resolve(t).then((function (e) { var t = i.blob && (e instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(e))); return t && "undefined" != typeof FileReader ? new a.Promise((function (t, n) { var r = new FileReader; r.onload = function (e) { t(e.target.result) }, r.onerror = function (e) { n(e.target.error) }, r.readAsArrayBuffer(e) })) : t && "function" == typeof e.arrayBuffer ? e.arrayBuffer() : e })).then((function (t) { var u = r.getTypeOf(t); return u ? ("arraybuffer" === u ? t = r.transformTo("uint8array", t) : "string" === u && (l ? t = s.decode(t) : n && !0 !== o && (t = function (e) { return c(e, i.uint8array ? new Uint8Array(e.length) : new Array(e.length)) }(t))), t) : a.Promise.reject(new Error("Can't read the data of '" + e + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")) })) } }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function (e, t, n) { "use strict"; var r = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), o = e("./zipEntry"), a = e("./support"); function l(e) { this.files = [], this.loadOptions = e } l.prototype = { checkSignature: function (e) { if (!this.reader.readAndCheckSignature(e)) { this.reader.index -= 4; var t = this.reader.readString(4); throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t) + ", expected " + i.pretty(e) + ")") } }, isSignature: function (e, t) { var n = this.reader.index; this.reader.setIndex(e); var r = this.reader.readString(4) === t; return this.reader.setIndex(n), r }, readBlockEndOfCentral: function () { this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); var e = this.reader.readData(this.zipCommentLength), t = a.uint8array ? "uint8array" : "array", n = i.transformTo(t, e); this.zipComment = this.loadOptions.decodeFileName(n) }, readBlockZip64EndOfCentral: function () { this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; for (var e, t, n, r = this.zip64EndOfCentralSize - 44; 0 < r;)e = this.reader.readInt(2), t = this.reader.readInt(4), n = this.reader.readData(t), this.zip64ExtensibleData[e] = { id: e, length: t, value: n } }, readBlockZip64EndOfCentralLocator: function () { if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported") }, readLocalFiles: function () { var e, t; for (e = 0; e < this.files.length; e++)t = this.files[e], this.reader.setIndex(t.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t.readLocalPart(this.reader), t.handleUTF8(), t.processAttributes() }, readCentralDir: function () { var e; for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e = new o({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e); if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length) }, readEndOfCentral: function () { var e = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END); if (e < 0) throw this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Corrupted zip: can't find end of central directory") : new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); this.reader.setIndex(e); var t = e; if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) { if (this.zip64 = !0, (e = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); if (this.reader.setIndex(e), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral() } var n = this.centralDirOffset + this.centralDirSize; this.zip64 && (n += 20, n += 12 + this.zip64EndOfCentralSize); var r = t - n; if (0 < r) this.isSignature(t, s.CENTRAL_FILE_HEADER) || (this.reader.zero = r); else if (r < 0) throw new Error("Corrupted zip: missing " + Math.abs(r) + " bytes.") }, prepareReader: function (e) { this.reader = r(e) }, load: function (e) { this.prepareReader(e), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles() } }, t.exports = l }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function (e, t, n) { "use strict"; var r = e("./reader/readerFor"), i = e("./utils"), s = e("./compressedObject"), o = e("./crc32"), a = e("./utf8"), l = e("./compressions"), c = e("./support"); function u(e, t) { this.options = e, this.loadOptions = t } u.prototype = { isEncrypted: function () { return !(1 & ~this.bitFlag) }, useUTF8: function () { return !(2048 & ~this.bitFlag) }, readLocalPart: function (e) { var t, n; if (e.skip(22), this.fileNameLength = e.readInt(2), n = e.readInt(2), this.fileName = e.readData(this.fileNameLength), e.skip(n), -1 === this.compressedSize || -1 === this.uncompressedSize) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); if (null === (t = function (e) { for (var t in l) if (Object.prototype.hasOwnProperty.call(l, t) && l[t].magic === e) return l[t]; return null }(this.compressionMethod))) throw new Error("Corrupted zip : compression " + i.pretty(this.compressionMethod) + " unknown (inner file : " + i.transformTo("string", this.fileName) + ")"); this.decompressed = new s(this.compressedSize, this.uncompressedSize, this.crc32, t, e.readData(this.compressedSize)) }, readCentralPart: function (e) { this.versionMadeBy = e.readInt(2), e.skip(2), this.bitFlag = e.readInt(2), this.compressionMethod = e.readString(2), this.date = e.readDate(), this.crc32 = e.readInt(4), this.compressedSize = e.readInt(4), this.uncompressedSize = e.readInt(4); var t = e.readInt(2); if (this.extraFieldsLength = e.readInt(2), this.fileCommentLength = e.readInt(2), this.diskNumberStart = e.readInt(2), this.internalFileAttributes = e.readInt(2), this.externalFileAttributes = e.readInt(4), this.localHeaderOffset = e.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported"); e.skip(t), this.readExtraFields(e), this.parseZIP64ExtraField(e), this.fileComment = e.readData(this.fileCommentLength) }, processAttributes: function () { this.unixPermissions = null, this.dosPermissions = null; var e = this.versionMadeBy >> 8; this.dir = !!(16 & this.externalFileAttributes), 0 == e && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = !0) }, parseZIP64ExtraField: function () { if (this.extraFields[1]) { var e = r(this.extraFields[1].value); this.uncompressedSize === i.MAX_VALUE_32BITS && (this.uncompressedSize = e.readInt(8)), this.compressedSize === i.MAX_VALUE_32BITS && (this.compressedSize = e.readInt(8)), this.localHeaderOffset === i.MAX_VALUE_32BITS && (this.localHeaderOffset = e.readInt(8)), this.diskNumberStart === i.MAX_VALUE_32BITS && (this.diskNumberStart = e.readInt(4)) } }, readExtraFields: function (e) { var t, n, r, i = e.index + this.extraFieldsLength; for (this.extraFields || (this.extraFields = {}); e.index + 4 < i;)t = e.readInt(2), n = e.readInt(2), r = e.readData(n), this.extraFields[t] = { id: t, length: n, value: r }; e.setIndex(i) }, handleUTF8: function () { var e = c.uint8array ? "uint8array" : "array"; if (this.useUTF8()) this.fileNameStr = a.utf8decode(this.fileName), this.fileCommentStr = a.utf8decode(this.fileComment); else { var t = this.findExtraFieldUnicodePath(); if (null !== t) this.fileNameStr = t; else { var n = i.transformTo(e, this.fileName); this.fileNameStr = this.loadOptions.decodeFileName(n) } var r = this.findExtraFieldUnicodeComment(); if (null !== r) this.fileCommentStr = r; else { var s = i.transformTo(e, this.fileComment); this.fileCommentStr = this.loadOptions.decodeFileName(s) } } }, findExtraFieldUnicodePath: function () { var e = this.extraFields[28789]; if (e) { var t = r(e.value); return 1 !== t.readInt(1) || o(this.fileName) !== t.readInt(4) ? null : a.utf8decode(t.readData(e.length - 5)) } return null }, findExtraFieldUnicodeComment: function () { var e = this.extraFields[25461]; if (e) { var t = r(e.value); return 1 !== t.readInt(1) || o(this.fileComment) !== t.readInt(4) ? null : a.utf8decode(t.readData(e.length - 5)) } return null } }, t.exports = u }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function (e, t, n) { "use strict"; function r(e, t, n) { this.name = e, this.dir = n.dir, this.date = n.date, this.comment = n.comment, this.unixPermissions = n.unixPermissions, this.dosPermissions = n.dosPermissions, this._data = t, this._dataBinary = n.binary, this.options = { compression: n.compression, compressionOptions: n.compressionOptions } } var i = e("./stream/StreamHelper"), s = e("./stream/DataWorker"), o = e("./utf8"), a = e("./compressedObject"), l = e("./stream/GenericWorker"); r.prototype = { internalStream: function (e) { var t = null, n = "string"; try { if (!e) throw new Error("No output type specified."); var r = "string" === (n = e.toLowerCase()) || "text" === n; "binarystring" !== n && "text" !== n || (n = "string"), t = this._decompressWorker(); var s = !this._dataBinary; s && !r && (t = t.pipe(new o.Utf8EncodeWorker)), !s && r && (t = t.pipe(new o.Utf8DecodeWorker)) } catch (e) { (t = new l("error")).error(e) } return new i(t, n, "") }, async: function (e, t) { return this.internalStream(e).accumulate(t) }, nodeStream: function (e, t) { return this.internalStream(e || "nodebuffer").toNodejsStream(t) }, _compressWorker: function (e, t) { if (this._data instanceof a && this._data.compression.magic === e.magic) return this._data.getCompressedWorker(); var n = this._decompressWorker(); return this._dataBinary || (n = n.pipe(new o.Utf8EncodeWorker)), a.createWorkerFrom(n, e, t) }, _decompressWorker: function () { return this._data instanceof a ? this._data.getContentWorker() : this._data instanceof l ? this._data : new s(this._data) } }; for (var c = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], u = function () { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.") }, d = 0; d < c.length; d++)r.prototype[c[d]] = u; t.exports = r }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function (e, t, n) { (function (e) { "use strict"; var n, r, i = e.MutationObserver || e.WebKitMutationObserver; if (i) { var s = 0, o = new i(u), a = e.document.createTextNode(""); o.observe(a, { characterData: !0 }), n = function () { a.data = s = ++s % 2 } } else if (e.setImmediate || void 0 === e.MessageChannel) n = "document" in e && "onreadystatechange" in e.document.createElement("script") ? function () { var t = e.document.createElement("script"); t.onreadystatechange = function () { u(), t.onreadystatechange = null, t.parentNode.removeChild(t), t = null }, e.document.documentElement.appendChild(t) } : function () { setTimeout(u, 0) }; else { var l = new e.MessageChannel; l.port1.onmessage = u, n = function () { l.port2.postMessage(0) } } var c = []; function u() { var e, t; r = !0; for (var n = c.length; n;) { for (t = c, c = [], e = -1; ++e < n;)t[e](); n = c.length } r = !1 } t.exports = function (e) { 1 !== c.push(e) || r || n() } }).call(this, void 0 !== r ? r : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}], 37: [function (e, t, n) { "use strict"; var r = e("immediate"); function i() { } var s = {}, o = ["REJECTED"], a = ["FULFILLED"], l = ["PENDING"]; function c(e) { if ("function" != typeof e) throw new TypeError("resolver must be a function"); this.state = l, this.queue = [], this.outcome = void 0, e !== i && p(this, e) } function u(e, t, n) { this.promise = e, "function" == typeof t && (this.onFulfilled = t, this.callFulfilled = this.otherCallFulfilled), "function" == typeof n && (this.onRejected = n, this.callRejected = this.otherCallRejected) } function d(e, t, n) { r((function () { var r; try { r = t(n) } catch (r) { return s.reject(e, r) } r === e ? s.reject(e, new TypeError("Cannot resolve promise with itself")) : s.resolve(e, r) })) } function h(e) { var t = e && e.then; if (e && ("object" == typeof e || "function" == typeof e) && "function" == typeof t) return function () { t.apply(e, arguments) } } function p(e, t) { var n = !1; function r(t) { n || (n = !0, s.reject(e, t)) } function i(t) { n || (n = !0, s.resolve(e, t)) } var o = m((function () { t(i, r) })); "error" === o.status && r(o.value) } function m(e, t) { var n = {}; try { n.value = e(t), n.status = "success" } catch (e) { n.status = "error", n.value = e } return n } (t.exports = c).prototype.finally = function (e) { if ("function" != typeof e) return this; var t = this.constructor; return this.then((function (n) { return t.resolve(e()).then((function () { return n })) }), (function (n) { return t.resolve(e()).then((function () { throw n })) })) }, c.prototype.catch = function (e) { return this.then(null, e) }, c.prototype.then = function (e, t) { if ("function" != typeof e && this.state === a || "function" != typeof t && this.state === o) return this; var n = new this.constructor(i); return this.state !== l ? d(n, this.state === a ? e : t, this.outcome) : this.queue.push(new u(n, e, t)), n }, u.prototype.callFulfilled = function (e) { s.resolve(this.promise, e) }, u.prototype.otherCallFulfilled = function (e) { d(this.promise, this.onFulfilled, e) }, u.prototype.callRejected = function (e) { s.reject(this.promise, e) }, u.prototype.otherCallRejected = function (e) { d(this.promise, this.onRejected, e) }, s.resolve = function (e, t) { var n = m(h, t); if ("error" === n.status) return s.reject(e, n.value); var r = n.value; if (r) p(e, r); else { e.state = a, e.outcome = t; for (var i = -1, o = e.queue.length; ++i < o;)e.queue[i].callFulfilled(t) } return e }, s.reject = function (e, t) { e.state = o, e.outcome = t; for (var n = -1, r = e.queue.length; ++n < r;)e.queue[n].callRejected(t); return e }, c.resolve = function (e) { return e instanceof this ? e : s.resolve(new this(i), e) }, c.reject = function (e) { var t = new this(i); return s.reject(t, e) }, c.all = function (e) { var t = this; if ("[object Array]" !== Object.prototype.toString.call(e)) return this.reject(new TypeError("must be an array")); var n = e.length, r = !1; if (!n) return this.resolve([]); for (var o = new Array(n), a = 0, l = -1, c = new this(i); ++l < n;)u(e[l], l); return c; function u(e, i) { t.resolve(e).then((function (e) { o[i] = e, ++a !== n || r || (r = !0, s.resolve(c, o)) }), (function (e) { r || (r = !0, s.reject(c, e)) })) } }, c.race = function (e) { var t = this; if ("[object Array]" !== Object.prototype.toString.call(e)) return this.reject(new TypeError("must be an array")); var n = e.length, r = !1; if (!n) return this.resolve([]); for (var o, a = -1, l = new this(i); ++a < n;)o = e[a], t.resolve(o).then((function (e) { r || (r = !0, s.resolve(l, e)) }), (function (e) { r || (r = !0, s.reject(l, e)) })); return l } }, { immediate: 36 }], 38: [function (e, t, n) { "use strict"; var r = {}; (0, e("./lib/utils/common").assign)(r, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = r }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function (e, t, n) { "use strict"; var r = e("./zlib/deflate"), i = e("./utils/common"), s = e("./utils/strings"), o = e("./zlib/messages"), a = e("./zlib/zstream"), l = Object.prototype.toString, c = 0, u = -1, d = 0, h = 8; function p(e) { if (!(this instanceof p)) return new p(e); this.options = i.assign({ level: u, method: h, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: d, to: "" }, e || {}); var t = this.options; t.raw && 0 < t.windowBits ? t.windowBits = -t.windowBits : t.gzip && 0 < t.windowBits && t.windowBits < 16 && (t.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new a, this.strm.avail_out = 0; var n = r.deflateInit2(this.strm, t.level, t.method, t.windowBits, t.memLevel, t.strategy); if (n !== c) throw new Error(o[n]); if (t.header && r.deflateSetHeader(this.strm, t.header), t.dictionary) { var m; if (m = "string" == typeof t.dictionary ? s.string2buf(t.dictionary) : "[object ArrayBuffer]" === l.call(t.dictionary) ? new Uint8Array(t.dictionary) : t.dictionary, (n = r.deflateSetDictionary(this.strm, m)) !== c) throw new Error(o[n]); this._dict_set = !0 } } function m(e, t) { var n = new p(t); if (n.push(e, !0), n.err) throw n.msg || o[n.err]; return n.result } p.prototype.push = function (e, t) { var n, o, a = this.strm, u = this.options.chunkSize; if (this.ended) return !1; o = t === ~~t ? t : !0 === t ? 4 : 0, "string" == typeof e ? a.input = s.string2buf(e) : "[object ArrayBuffer]" === l.call(e) ? a.input = new Uint8Array(e) : a.input = e, a.next_in = 0, a.avail_in = a.input.length; do { if (0 === a.avail_out && (a.output = new i.Buf8(u), a.next_out = 0, a.avail_out = u), 1 !== (n = r.deflate(a, o)) && n !== c) return this.onEnd(n), !(this.ended = !0); 0 !== a.avail_out && (0 !== a.avail_in || 4 !== o && 2 !== o) || ("string" === this.options.to ? this.onData(s.buf2binstring(i.shrinkBuf(a.output, a.next_out))) : this.onData(i.shrinkBuf(a.output, a.next_out))) } while ((0 < a.avail_in || 0 === a.avail_out) && 1 !== n); return 4 === o ? (n = r.deflateEnd(this.strm), this.onEnd(n), this.ended = !0, n === c) : 2 !== o || (this.onEnd(c), !(a.avail_out = 0)) }, p.prototype.onData = function (e) { this.chunks.push(e) }, p.prototype.onEnd = function (e) { e === c && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = i.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg }, n.Deflate = p, n.deflate = m, n.deflateRaw = function (e, t) { return (t = t || {}).raw = !0, m(e, t) }, n.gzip = function (e, t) { return (t = t || {}).gzip = !0, m(e, t) } }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function (e, t, n) { "use strict"; var r = e("./zlib/inflate"), i = e("./utils/common"), s = e("./utils/strings"), o = e("./zlib/constants"), a = e("./zlib/messages"), l = e("./zlib/zstream"), c = e("./zlib/gzheader"), u = Object.prototype.toString; function d(e) { if (!(this instanceof d)) return new d(e); this.options = i.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e || {}); var t = this.options; t.raw && 0 <= t.windowBits && t.windowBits < 16 && (t.windowBits = -t.windowBits, 0 === t.windowBits && (t.windowBits = -15)), !(0 <= t.windowBits && t.windowBits < 16) || e && e.windowBits || (t.windowBits += 32), 15 < t.windowBits && t.windowBits < 48 && !(15 & t.windowBits) && (t.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new l, this.strm.avail_out = 0; var n = r.inflateInit2(this.strm, t.windowBits); if (n !== o.Z_OK) throw new Error(a[n]); if (this.header = new c, r.inflateGetHeader(this.strm, this.header), t.dictionary && ("string" == typeof t.dictionary ? t.dictionary = s.string2buf(t.dictionary) : "[object ArrayBuffer]" === u.call(t.dictionary) && (t.dictionary = new Uint8Array(t.dictionary)), t.raw && (n = r.inflateSetDictionary(this.strm, t.dictionary)) !== o.Z_OK)) throw new Error(a[n]) } function h(e, t) { var n = new d(t); if (n.push(e, !0), n.err) throw n.msg || a[n.err]; return n.result } d.prototype.push = function (e, t) { var n, a, l, c, d, h = this.strm, p = this.options.chunkSize, m = this.options.dictionary, f = !1; if (this.ended) return !1; a = t === ~~t ? t : !0 === t ? o.Z_FINISH : o.Z_NO_FLUSH, "string" == typeof e ? h.input = s.binstring2buf(e) : "[object ArrayBuffer]" === u.call(e) ? h.input = new Uint8Array(e) : h.input = e, h.next_in = 0, h.avail_in = h.input.length; do { if (0 === h.avail_out && (h.output = new i.Buf8(p), h.next_out = 0, h.avail_out = p), (n = r.inflate(h, o.Z_NO_FLUSH)) === o.Z_NEED_DICT && m && (n = r.inflateSetDictionary(this.strm, m)), n === o.Z_BUF_ERROR && !0 === f && (n = o.Z_OK, f = !1), n !== o.Z_STREAM_END && n !== o.Z_OK) return this.onEnd(n), !(this.ended = !0); h.next_out && (0 !== h.avail_out && n !== o.Z_STREAM_END && (0 !== h.avail_in || a !== o.Z_FINISH && a !== o.Z_SYNC_FLUSH) || ("string" === this.options.to ? (l = s.utf8border(h.output, h.next_out), c = h.next_out - l, d = s.buf2string(h.output, l), h.next_out = c, h.avail_out = p - c, c && i.arraySet(h.output, h.output, l, c, 0), this.onData(d)) : this.onData(i.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = !0) } while ((0 < h.avail_in || 0 === h.avail_out) && n !== o.Z_STREAM_END); return n === o.Z_STREAM_END && (a = o.Z_FINISH), a === o.Z_FINISH ? (n = r.inflateEnd(this.strm), this.onEnd(n), this.ended = !0, n === o.Z_OK) : a !== o.Z_SYNC_FLUSH || (this.onEnd(o.Z_OK), !(h.avail_out = 0)) }, d.prototype.onData = function (e) { this.chunks.push(e) }, d.prototype.onEnd = function (e) { e === o.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = i.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg }, n.Inflate = d, n.inflate = h, n.inflateRaw = function (e, t) { return (t = t || {}).raw = !0, h(e, t) }, n.ungzip = h }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function (e, t, n) { "use strict"; var r = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; n.assign = function (e) { for (var t, n, r = Array.prototype.slice.call(arguments, 1); r.length;) { var i = r.shift(); if (i) { if ("object" != typeof i) throw new TypeError(i + "must be non-object"); for (var s in i) t = i, n = s, Object.prototype.hasOwnProperty.call(t, n) && (e[s] = i[s]) } } return e }, n.shrinkBuf = function (e, t) { return e.length === t ? e : e.subarray ? e.subarray(0, t) : (e.length = t, e) }; var i = { arraySet: function (e, t, n, r, i) { if (t.subarray && e.subarray) e.set(t.subarray(n, n + r), i); else for (var s = 0; s < r; s++)e[i + s] = t[n + s] }, flattenChunks: function (e) { var t, n, r, i, s, o; for (t = r = 0, n = e.length; t < n; t++)r += e[t].length; for (o = new Uint8Array(r), t = i = 0, n = e.length; t < n; t++)s = e[t], o.set(s, i), i += s.length; return o } }, s = { arraySet: function (e, t, n, r, i) { for (var s = 0; s < r; s++)e[i + s] = t[n + s] }, flattenChunks: function (e) { return [].concat.apply([], e) } }; n.setTyped = function (e) { e ? (n.Buf8 = Uint8Array, n.Buf16 = Uint16Array, n.Buf32 = Int32Array, n.assign(n, i)) : (n.Buf8 = Array, n.Buf16 = Array, n.Buf32 = Array, n.assign(n, s)) }, n.setTyped(r) }, {}], 42: [function (e, t, n) { "use strict"; var r = e("./common"), i = !0, s = !0; try { String.fromCharCode.apply(null, [0]) } catch (e) { i = !1 } try { String.fromCharCode.apply(null, new Uint8Array(1)) } catch (e) { s = !1 } for (var o = new r.Buf8(256), a = 0; a < 256; a++)o[a] = 252 <= a ? 6 : 248 <= a ? 5 : 240 <= a ? 4 : 224 <= a ? 3 : 192 <= a ? 2 : 1; function l(e, t) { if (t < 65534 && (e.subarray && s || !e.subarray && i)) return String.fromCharCode.apply(null, r.shrinkBuf(e, t)); for (var n = "", o = 0; o < t; o++)n += String.fromCharCode(e[o]); return n } o[254] = o[254] = 1, n.string2buf = function (e) { var t, n, i, s, o, a = e.length, l = 0; for (s = 0; s < a; s++)55296 == (64512 & (n = e.charCodeAt(s))) && s + 1 < a && 56320 == (64512 & (i = e.charCodeAt(s + 1))) && (n = 65536 + (n - 55296 << 10) + (i - 56320), s++), l += n < 128 ? 1 : n < 2048 ? 2 : n < 65536 ? 3 : 4; for (t = new r.Buf8(l), s = o = 0; o < l; s++)55296 == (64512 & (n = e.charCodeAt(s))) && s + 1 < a && 56320 == (64512 & (i = e.charCodeAt(s + 1))) && (n = 65536 + (n - 55296 << 10) + (i - 56320), s++), n < 128 ? t[o++] = n : (n < 2048 ? t[o++] = 192 | n >>> 6 : (n < 65536 ? t[o++] = 224 | n >>> 12 : (t[o++] = 240 | n >>> 18, t[o++] = 128 | n >>> 12 & 63), t[o++] = 128 | n >>> 6 & 63), t[o++] = 128 | 63 & n); return t }, n.buf2binstring = function (e) { return l(e, e.length) }, n.binstring2buf = function (e) { for (var t = new r.Buf8(e.length), n = 0, i = t.length; n < i; n++)t[n] = e.charCodeAt(n); return t }, n.buf2string = function (e, t) { var n, r, i, s, a = t || e.length, c = new Array(2 * a); for (n = r = 0; n < a;)if ((i = e[n++]) < 128) c[r++] = i; else if (4 < (s = o[i])) c[r++] = 65533, n += s - 1; else { for (i &= 2 === s ? 31 : 3 === s ? 15 : 7; 1 < s && n < a;)i = i << 6 | 63 & e[n++], s--; 1 < s ? c[r++] = 65533 : i < 65536 ? c[r++] = i : (i -= 65536, c[r++] = 55296 | i >> 10 & 1023, c[r++] = 56320 | 1023 & i) } return l(c, r) }, n.utf8border = function (e, t) { var n; for ((t = t || e.length) > e.length && (t = e.length), n = t - 1; 0 <= n && 128 == (192 & e[n]);)n--; return n < 0 || 0 === n ? t : n + o[e[n]] > t ? n : t } }, { "./common": 41 }], 43: [function (e, t, n) { "use strict"; t.exports = function (e, t, n, r) { for (var i = 65535 & e, s = e >>> 16 & 65535, o = 0; 0 !== n;) { for (n -= o = 2e3 < n ? 2e3 : n; s = s + (i = i + t[r++] | 0) | 0, --o;); i %= 65521, s %= 65521 } return i | s << 16 } }, {}], 44: [function (e, t, n) { "use strict"; t.exports = { 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, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, 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, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 } }, {}], 45: [function (e, t, n) { "use strict"; var r = function () { for (var e, t = [], n = 0; n < 256; n++) { e = n; for (var r = 0; r < 8; r++)e = 1 & e ? 3988292384 ^ e >>> 1 : e >>> 1; t[n] = e } return t }(); t.exports = function (e, t, n, i) { var s = r, o = i + n; e ^= -1; for (var a = i; a < o; a++)e = e >>> 8 ^ s[255 & (e ^ t[a])]; return ~e } }, {}], 46: [function (e, t, n) { "use strict"; var r, i = e("../utils/common"), s = e("./trees"), o = e("./adler32"), a = e("./crc32"), l = e("./messages"), c = 0, u = 4, d = 0, h = -2, p = -1, m = 4, f = 2, g = 8, y = 9, b = 286, v = 30, S = 19, w = 2 * b + 1, k = 15, T = 3, x = 258, E = x + T + 1, A = 42, C = 113, I = 1, O = 2, M = 3, N = 4; function R(e, t) { return e.msg = l[t], t } function D(e) { return (e << 1) - (4 < e ? 9 : 0) } function P(e) { for (var t = e.length; 0 <= --t;)e[t] = 0 } function L(e) { var t = e.state, n = t.pending; n > e.avail_out && (n = e.avail_out), 0 !== n && (i.arraySet(e.output, t.pending_buf, t.pending_out, n, e.next_out), e.next_out += n, t.pending_out += n, e.total_out += n, e.avail_out -= n, t.pending -= n, 0 === t.pending && (t.pending_out = 0)) } function B(e, t) { s._tr_flush_block(e, 0 <= e.block_start ? e.block_start : -1, e.strstart - e.block_start, t), e.block_start = e.strstart, L(e.strm) } function z(e, t) { e.pending_buf[e.pending++] = t } function U(e, t) { e.pending_buf[e.pending++] = t >>> 8 & 255, e.pending_buf[e.pending++] = 255 & t } function j(e, t) { var n, r, i = e.max_chain_length, s = e.strstart, o = e.prev_length, a = e.nice_match, l = e.strstart > e.w_size - E ? e.strstart - (e.w_size - E) : 0, c = e.window, u = e.w_mask, d = e.prev, h = e.strstart + x, p = c[s + o - 1], m = c[s + o]; e.prev_length >= e.good_match && (i >>= 2), a > e.lookahead && (a = e.lookahead); do { if (c[(n = t) + o] === m && c[n + o - 1] === p && c[n] === c[s] && c[++n] === c[s + 1]) { s += 2, n++; do { } while (c[++s] === c[++n] && c[++s] === c[++n] && c[++s] === c[++n] && c[++s] === c[++n] && c[++s] === c[++n] && c[++s] === c[++n] && c[++s] === c[++n] && c[++s] === c[++n] && s < h); if (r = x - (h - s), s = h - x, o < r) { if (e.match_start = t, a <= (o = r)) break; p = c[s + o - 1], m = c[s + o] } } } while ((t = d[t & u]) > l && 0 != --i); return o <= e.lookahead ? o : e.lookahead } function F(e) { var t, n, r, s, l, c, u, d, h, p, m = e.w_size; do { if (s = e.window_size - e.lookahead - e.strstart, e.strstart >= m + (m - E)) { for (i.arraySet(e.window, e.window, m, m, 0), e.match_start -= m, e.strstart -= m, e.block_start -= m, t = n = e.hash_size; r = e.head[--t], e.head[t] = m <= r ? r - m : 0, --n;); for (t = n = m; r = e.prev[--t], e.prev[t] = m <= r ? r - m : 0, --n;); s += m } if (0 === e.strm.avail_in) break; if (c = e.strm, u = e.window, d = e.strstart + e.lookahead, p = void 0, (h = s) < (p = c.avail_in) && (p = h), n = 0 === p ? 0 : (c.avail_in -= p, i.arraySet(u, c.input, c.next_in, p, d), 1 === c.state.wrap ? c.adler = o(c.adler, u, p, d) : 2 === c.state.wrap && (c.adler = a(c.adler, u, p, d)), c.next_in += p, c.total_in += p, p), e.lookahead += n, e.lookahead + e.insert >= T) for (l = e.strstart - e.insert, e.ins_h = e.window[l], e.ins_h = (e.ins_h << e.hash_shift ^ e.window[l + 1]) & e.hash_mask; e.insert && (e.ins_h = (e.ins_h << e.hash_shift ^ e.window[l + T - 1]) & e.hash_mask, e.prev[l & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = l, l++, e.insert--, !(e.lookahead + e.insert < T));); } while (e.lookahead < E && 0 !== e.strm.avail_in) } function W(e, t) { for (var n, r; ;) { if (e.lookahead < E) { if (F(e), e.lookahead < E && t === c) return I; if (0 === e.lookahead) break } if (n = 0, e.lookahead >= T && (e.ins_h = (e.ins_h << e.hash_shift ^ e.window[e.strstart + T - 1]) & e.hash_mask, n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), 0 !== n && e.strstart - n <= e.w_size - E && (e.match_length = j(e, n)), e.match_length >= T) if (r = s._tr_tally(e, e.strstart - e.match_start, e.match_length - T), e.lookahead -= e.match_length, e.match_length <= e.max_lazy_match && e.lookahead >= T) { for (e.match_length--; e.strstart++, e.ins_h = (e.ins_h << e.hash_shift ^ e.window[e.strstart + T - 1]) & e.hash_mask, n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart, 0 != --e.match_length;); e.strstart++ } else e.strstart += e.match_length, e.match_length = 0, e.ins_h = e.window[e.strstart], e.ins_h = (e.ins_h << e.hash_shift ^ e.window[e.strstart + 1]) & e.hash_mask; else r = s._tr_tally(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++; if (r && (B(e, !1), 0 === e.strm.avail_out)) return I } return e.insert = e.strstart < T - 1 ? e.strstart : T - 1, t === u ? (B(e, !0), 0 === e.strm.avail_out ? M : N) : e.last_lit && (B(e, !1), 0 === e.strm.avail_out) ? I : O } function V(e, t) { for (var n, r, i; ;) { if (e.lookahead < E) { if (F(e), e.lookahead < E && t === c) return I; if (0 === e.lookahead) break } if (n = 0, e.lookahead >= T && (e.ins_h = (e.ins_h << e.hash_shift ^ e.window[e.strstart + T - 1]) & e.hash_mask, n = 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 = T - 1, 0 !== n && e.prev_length < e.max_lazy_match && e.strstart - n <= e.w_size - E && (e.match_length = j(e, n), e.match_length <= 5 && (1 === e.strategy || e.match_length === T && 4096 < e.strstart - e.match_start) && (e.match_length = T - 1)), e.prev_length >= T && e.match_length <= e.prev_length) { for (i = e.strstart + e.lookahead - T, r = s._tr_tally(e, e.strstart - 1 - e.prev_match, e.prev_length - T), e.lookahead -= e.prev_length - 1, e.prev_length -= 2; ++e.strstart <= i && (e.ins_h = (e.ins_h << e.hash_shift ^ e.window[e.strstart + T - 1]) & e.hash_mask, n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), 0 != --e.prev_length;); if (e.match_available = 0, e.match_length = T - 1, e.strstart++, r && (B(e, !1), 0 === e.strm.avail_out)) return I } else if (e.match_available) { if ((r = s._tr_tally(e, 0, e.window[e.strstart - 1])) && B(e, !1), e.strstart++, e.lookahead--, 0 === e.strm.avail_out) return I } else e.match_available = 1, e.strstart++, e.lookahead-- } return e.match_available && (r = s._tr_tally(e, 0, e.window[e.strstart - 1]), e.match_available = 0), e.insert = e.strstart < T - 1 ? e.strstart : T - 1, t === u ? (B(e, !0), 0 === e.strm.avail_out ? M : N) : e.last_lit && (B(e, !1), 0 === e.strm.avail_out) ? I : O } function G(e, t, n, r, i) { this.good_length = e, this.max_lazy = t, this.nice_length = n, this.max_chain = r, this.func = i } function q() { 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 = g, 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 i.Buf16(2 * w), this.dyn_dtree = new i.Buf16(2 * (2 * v + 1)), this.bl_tree = new i.Buf16(2 * (2 * S + 1)), P(this.dyn_ltree), P(this.dyn_dtree), P(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new i.Buf16(k + 1), this.heap = new i.Buf16(2 * b + 1), P(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new i.Buf16(2 * b + 1), P(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0 } function Y(e) { var t; return e && e.state ? (e.total_in = e.total_out = 0, e.data_type = f, (t = e.state).pending = 0, t.pending_out = 0, t.wrap < 0 && (t.wrap = -t.wrap), t.status = t.wrap ? A : C, e.adler = 2 === t.wrap ? 0 : 1, t.last_flush = c, s._tr_init(t), d) : R(e, h) } function H(e) { var t = Y(e); return t === d && function (e) { e.window_size = 2 * e.w_size, P(e.head), e.max_lazy_match = r[e.level].max_lazy, e.good_match = r[e.level].good_length, e.nice_match = r[e.level].nice_length, e.max_chain_length = r[e.level].max_chain, e.strstart = 0, e.block_start = 0, e.lookahead = 0, e.insert = 0, e.match_length = e.prev_length = T - 1, e.match_available = 0, e.ins_h = 0 }(e.state), t } function _(e, t, n, r, s, o) { if (!e) return h; var a = 1; if (t === p && (t = 6), r < 0 ? (a = 0, r = -r) : 15 < r && (a = 2, r -= 16), s < 1 || y < s || n !== g || r < 8 || 15 < r || t < 0 || 9 < t || o < 0 || m < o) return R(e, h); 8 === r && (r = 9); var l = new q; return (e.state = l).strm = e, l.wrap = a, l.gzhead = null, l.w_bits = r, l.w_size = 1 << l.w_bits, l.w_mask = l.w_size - 1, l.hash_bits = s + 7, l.hash_size = 1 << l.hash_bits, l.hash_mask = l.hash_size - 1, l.hash_shift = ~~((l.hash_bits + T - 1) / T), l.window = new i.Buf8(2 * l.w_size), l.head = new i.Buf16(l.hash_size), l.prev = new i.Buf16(l.w_size), l.lit_bufsize = 1 << s + 6, l.pending_buf_size = 4 * l.lit_bufsize, l.pending_buf = new i.Buf8(l.pending_buf_size), l.d_buf = 1 * l.lit_bufsize, l.l_buf = 3 * l.lit_bufsize, l.level = t, l.strategy = o, l.method = n, H(e) } r = [new G(0, 0, 0, 0, (function (e, t) { var n = 65535; for (n > e.pending_buf_size - 5 && (n = e.pending_buf_size - 5); ;) { if (e.lookahead <= 1) { if (F(e), 0 === e.lookahead && t === c) return I; if (0 === e.lookahead) break } e.strstart += e.lookahead, e.lookahead = 0; var r = e.block_start + n; if ((0 === e.strstart || e.strstart >= r) && (e.lookahead = e.strstart - r, e.strstart = r, B(e, !1), 0 === e.strm.avail_out)) return I; if (e.strstart - e.block_start >= e.w_size - E && (B(e, !1), 0 === e.strm.avail_out)) return I } return e.insert = 0, t === u ? (B(e, !0), 0 === e.strm.avail_out ? M : N) : (e.strstart > e.block_start && (B(e, !1), e.strm.avail_out), I) })), new G(4, 4, 8, 4, W), new G(4, 5, 16, 8, W), new G(4, 6, 32, 32, W), new G(4, 4, 16, 16, V), new G(8, 16, 32, 32, V), new G(8, 16, 128, 128, V), new G(8, 32, 128, 256, V), new G(32, 128, 258, 1024, V), new G(32, 258, 258, 4096, V)], n.deflateInit = function (e, t) { return _(e, t, g, 15, 8, 0) }, n.deflateInit2 = _, n.deflateReset = H, n.deflateResetKeep = Y, n.deflateSetHeader = function (e, t) { return e && e.state ? 2 !== e.state.wrap ? h : (e.state.gzhead = t, d) : h }, n.deflate = function (e, t) { var n, i, o, l; if (!e || !e.state || 5 < t || t < 0) return e ? R(e, h) : h; if (i = e.state, !e.output || !e.input && 0 !== e.avail_in || 666 === i.status && t !== u) return R(e, 0 === e.avail_out ? -5 : h); if (i.strm = e, n = i.last_flush, i.last_flush = t, i.status === A) if (2 === i.wrap) e.adler = 0, z(i, 31), z(i, 139), z(i, 8), i.gzhead ? (z(i, (i.gzhead.text ? 1 : 0) + (i.gzhead.hcrc ? 2 : 0) + (i.gzhead.extra ? 4 : 0) + (i.gzhead.name ? 8 : 0) + (i.gzhead.comment ? 16 : 0)), z(i, 255 & i.gzhead.time), z(i, i.gzhead.time >> 8 & 255), z(i, i.gzhead.time >> 16 & 255), z(i, i.gzhead.time >> 24 & 255), z(i, 9 === i.level ? 2 : 2 <= i.strategy || i.level < 2 ? 4 : 0), z(i, 255 & i.gzhead.os), i.gzhead.extra && i.gzhead.extra.length && (z(i, 255 & i.gzhead.extra.length), z(i, i.gzhead.extra.length >> 8 & 255)), i.gzhead.hcrc && (e.adler = a(e.adler, i.pending_buf, i.pending, 0)), i.gzindex = 0, i.status = 69) : (z(i, 0), z(i, 0), z(i, 0), z(i, 0), z(i, 0), z(i, 9 === i.level ? 2 : 2 <= i.strategy || i.level < 2 ? 4 : 0), z(i, 3), i.status = C); else { var p = g + (i.w_bits - 8 << 4) << 8; p |= (2 <= i.strategy || i.level < 2 ? 0 : i.level < 6 ? 1 : 6 === i.level ? 2 : 3) << 6, 0 !== i.strstart && (p |= 32), p += 31 - p % 31, i.status = C, U(i, p), 0 !== i.strstart && (U(i, e.adler >>> 16), U(i, 65535 & e.adler)), e.adler = 1 } if (69 === i.status) if (i.gzhead.extra) { for (o = i.pending; i.gzindex < (65535 & i.gzhead.extra.length) && (i.pending !== i.pending_buf_size || (i.gzhead.hcrc && i.pending > o && (e.adler = a(e.adler, i.pending_buf, i.pending - o, o)), L(e), o = i.pending, i.pending !== i.pending_buf_size));)z(i, 255 & i.gzhead.extra[i.gzindex]), i.gzindex++; i.gzhead.hcrc && i.pending > o && (e.adler = a(e.adler, i.pending_buf, i.pending - o, o)), i.gzindex === i.gzhead.extra.length && (i.gzindex = 0, i.status = 73) } else i.status = 73; if (73 === i.status) if (i.gzhead.name) { o = i.pending; do { if (i.pending === i.pending_buf_size && (i.gzhead.hcrc && i.pending > o && (e.adler = a(e.adler, i.pending_buf, i.pending - o, o)), L(e), o = i.pending, i.pending === i.pending_buf_size)) { l = 1; break } l = i.gzindex < i.gzhead.name.length ? 255 & i.gzhead.name.charCodeAt(i.gzindex++) : 0, z(i, l) } while (0 !== l); i.gzhead.hcrc && i.pending > o && (e.adler = a(e.adler, i.pending_buf, i.pending - o, o)), 0 === l && (i.gzindex = 0, i.status = 91) } else i.status = 91; if (91 === i.status) if (i.gzhead.comment) { o = i.pending; do { if (i.pending === i.pending_buf_size && (i.gzhead.hcrc && i.pending > o && (e.adler = a(e.adler, i.pending_buf, i.pending - o, o)), L(e), o = i.pending, i.pending === i.pending_buf_size)) { l = 1; break } l = i.gzindex < i.gzhead.comment.length ? 255 & i.gzhead.comment.charCodeAt(i.gzindex++) : 0, z(i, l) } while (0 !== l); i.gzhead.hcrc && i.pending > o && (e.adler = a(e.adler, i.pending_buf, i.pending - o, o)), 0 === l && (i.status = 103) } else i.status = 103; if (103 === i.status && (i.gzhead.hcrc ? (i.pending + 2 > i.pending_buf_size && L(e), i.pending + 2 <= i.pending_buf_size && (z(i, 255 & e.adler), z(i, e.adler >> 8 & 255), e.adler = 0, i.status = C)) : i.status = C), 0 !== i.pending) { if (L(e), 0 === e.avail_out) return i.last_flush = -1, d } else if (0 === e.avail_in && D(t) <= D(n) && t !== u) return R(e, -5); if (666 === i.status && 0 !== e.avail_in) return R(e, -5); if (0 !== e.avail_in || 0 !== i.lookahead || t !== c && 666 !== i.status) { var m = 2 === i.strategy ? function (e, t) { for (var n; ;) { if (0 === e.lookahead && (F(e), 0 === e.lookahead)) { if (t === c) return I; break } if (e.match_length = 0, n = s._tr_tally(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++, n && (B(e, !1), 0 === e.strm.avail_out)) return I } return e.insert = 0, t === u ? (B(e, !0), 0 === e.strm.avail_out ? M : N) : e.last_lit && (B(e, !1), 0 === e.strm.avail_out) ? I : O }(i, t) : 3 === i.strategy ? function (e, t) { for (var n, r, i, o, a = e.window; ;) { if (e.lookahead <= x) { if (F(e), e.lookahead <= x && t === c) return I; if (0 === e.lookahead) break } if (e.match_length = 0, e.lookahead >= T && 0 < e.strstart && (r = a[i = e.strstart - 1]) === a[++i] && r === a[++i] && r === a[++i]) { o = e.strstart + x; do { } while (r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && i < o); e.match_length = x - (o - i), e.match_length > e.lookahead && (e.match_length = e.lookahead) } if (e.match_length >= T ? (n = s._tr_tally(e, 1, e.match_length - T), e.lookahead -= e.match_length, e.strstart += e.match_length, e.match_length = 0) : (n = s._tr_tally(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++), n && (B(e, !1), 0 === e.strm.avail_out)) return I } return e.insert = 0, t === u ? (B(e, !0), 0 === e.strm.avail_out ? M : N) : e.last_lit && (B(e, !1), 0 === e.strm.avail_out) ? I : O }(i, t) : r[i.level].func(i, t); if (m !== M && m !== N || (i.status = 666), m === I || m === M) return 0 === e.avail_out && (i.last_flush = -1), d; if (m === O && (1 === t ? s._tr_align(i) : 5 !== t && (s._tr_stored_block(i, 0, 0, !1), 3 === t && (P(i.head), 0 === i.lookahead && (i.strstart = 0, i.block_start = 0, i.insert = 0))), L(e), 0 === e.avail_out)) return i.last_flush = -1, d } return t !== u ? d : i.wrap <= 0 ? 1 : (2 === i.wrap ? (z(i, 255 & e.adler), z(i, e.adler >> 8 & 255), z(i, e.adler >> 16 & 255), z(i, e.adler >> 24 & 255), z(i, 255 & e.total_in), z(i, e.total_in >> 8 & 255), z(i, e.total_in >> 16 & 255), z(i, e.total_in >> 24 & 255)) : (U(i, e.adler >>> 16), U(i, 65535 & e.adler)), L(e), 0 < i.wrap && (i.wrap = -i.wrap), 0 !== i.pending ? d : 1) }, n.deflateEnd = function (e) { var t; return e && e.state ? (t = e.state.status) !== A && 69 !== t && 73 !== t && 91 !== t && 103 !== t && t !== C && 666 !== t ? R(e, h) : (e.state = null, t === C ? R(e, -3) : d) : h }, n.deflateSetDictionary = function (e, t) { var n, r, s, a, l, c, u, p, m = t.length; if (!e || !e.state) return h; if (2 === (a = (n = e.state).wrap) || 1 === a && n.status !== A || n.lookahead) return h; for (1 === a && (e.adler = o(e.adler, t, m, 0)), n.wrap = 0, m >= n.w_size && (0 === a && (P(n.head), n.strstart = 0, n.block_start = 0, n.insert = 0), p = new i.Buf8(n.w_size), i.arraySet(p, t, m - n.w_size, n.w_size, 0), t = p, m = n.w_size), l = e.avail_in, c = e.next_in, u = e.input, e.avail_in = m, e.next_in = 0, e.input = t, F(n); n.lookahead >= T;) { for (r = n.strstart, s = n.lookahead - (T - 1); n.ins_h = (n.ins_h << n.hash_shift ^ n.window[r + T - 1]) & n.hash_mask, n.prev[r & n.w_mask] = n.head[n.ins_h], n.head[n.ins_h] = r, r++, --s;); n.strstart = r, n.lookahead = T - 1, F(n) } return n.strstart += n.lookahead, n.block_start = n.strstart, n.insert = n.lookahead, n.lookahead = 0, n.match_length = n.prev_length = T - 1, n.match_available = 0, e.next_in = c, e.input = u, e.avail_in = l, n.wrap = a, d }, n.deflateInfo = "pako deflate (from Nodeca project)" }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function (e, t, n) { "use strict"; t.exports = function () { this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1 } }, {}], 48: [function (e, t, n) { "use strict"; t.exports = function (e, t) { var n, r, i, s, o, a, l, c, u, d, h, p, m, f, g, y, b, v, S, w, k, T, x, E, A; n = e.state, r = e.next_in, E = e.input, i = r + (e.avail_in - 5), s = e.next_out, A = e.output, o = s - (t - e.avail_out), a = s + (e.avail_out - 257), l = n.dmax, c = n.wsize, u = n.whave, d = n.wnext, h = n.window, p = n.hold, m = n.bits, f = n.lencode, g = n.distcode, y = (1 << n.lenbits) - 1, b = (1 << n.distbits) - 1; e: do { m < 15 && (p += E[r++] << m, m += 8, p += E[r++] << m, m += 8), v = f[p & y]; t: for (; ;) { if (p >>>= S = v >>> 24, m -= S, 0 == (S = v >>> 16 & 255)) A[s++] = 65535 & v; else { if (!(16 & S)) { if (!(64 & S)) { v = f[(65535 & v) + (p & (1 << S) - 1)]; continue t } if (32 & S) { n.mode = 12; break e } e.msg = "invalid literal/length code", n.mode = 30; break e } w = 65535 & v, (S &= 15) && (m < S && (p += E[r++] << m, m += 8), w += p & (1 << S) - 1, p >>>= S, m -= S), m < 15 && (p += E[r++] << m, m += 8, p += E[r++] << m, m += 8), v = g[p & b]; n: for (; ;) { if (p >>>= S = v >>> 24, m -= S, !(16 & (S = v >>> 16 & 255))) { if (!(64 & S)) { v = g[(65535 & v) + (p & (1 << S) - 1)]; continue n } e.msg = "invalid distance code", n.mode = 30; break e } if (k = 65535 & v, m < (S &= 15) && (p += E[r++] << m, (m += 8) < S && (p += E[r++] << m, m += 8)), l < (k += p & (1 << S) - 1)) { e.msg = "invalid distance too far back", n.mode = 30; break e } if (p >>>= S, m -= S, (S = s - o) < k) { if (u < (S = k - S) && n.sane) { e.msg = "invalid distance too far back", n.mode = 30; break e } if (x = h, (T = 0) === d) { if (T += c - S, S < w) { for (w -= S; A[s++] = h[T++], --S;); T = s - k, x = A } } else if (d < S) { if (T += c + d - S, (S -= d) < w) { for (w -= S; A[s++] = h[T++], --S;); if (T = 0, d < w) { for (w -= S = d; A[s++] = h[T++], --S;); T = s - k, x = A } } } else if (T += d - S, S < w) { for (w -= S; A[s++] = h[T++], --S;); T = s - k, x = A } for (; 2 < w;)A[s++] = x[T++], A[s++] = x[T++], A[s++] = x[T++], w -= 3; w && (A[s++] = x[T++], 1 < w && (A[s++] = x[T++])) } else { for (T = s - k; A[s++] = A[T++], A[s++] = A[T++], A[s++] = A[T++], 2 < (w -= 3);); w && (A[s++] = A[T++], 1 < w && (A[s++] = A[T++])) } break } } break } } while (r < i && s < a); r -= w = m >> 3, p &= (1 << (m -= w << 3)) - 1, e.next_in = r, e.next_out = s, e.avail_in = r < i ? i - r + 5 : 5 - (r - i), e.avail_out = s < a ? a - s + 257 : 257 - (s - a), n.hold = p, n.bits = m } }, {}], 49: [function (e, t, n) { "use strict"; var r = e("../utils/common"), i = e("./adler32"), s = e("./crc32"), o = e("./inffast"), a = e("./inftrees"), l = 1, c = 2, u = 0, d = -2, h = 1, p = 852, m = 592; function f(e) { return (e >>> 24 & 255) + (e >>> 8 & 65280) + ((65280 & e) << 8) + ((255 & e) << 24) } function g() { this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new r.Buf16(320), this.work = new r.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0 } function y(e) { var t; return e && e.state ? (t = e.state, e.total_in = e.total_out = t.total = 0, e.msg = "", t.wrap && (e.adler = 1 & t.wrap), t.mode = h, t.last = 0, t.havedict = 0, t.dmax = 32768, t.head = null, t.hold = 0, t.bits = 0, t.lencode = t.lendyn = new r.Buf32(p), t.distcode = t.distdyn = new r.Buf32(m), t.sane = 1, t.back = -1, u) : d } function b(e) { var t; return e && e.state ? ((t = e.state).wsize = 0, t.whave = 0, t.wnext = 0, y(e)) : d } function v(e, t) { var n, r; return e && e.state ? (r = e.state, t < 0 ? (n = 0, t = -t) : (n = 1 + (t >> 4), t < 48 && (t &= 15)), t && (t < 8 || 15 < t) ? d : (null !== r.window && r.wbits !== t && (r.window = null), r.wrap = n, r.wbits = t, b(e))) : d } function S(e, t) { var n, r; return e ? (r = new g, (e.state = r).window = null, (n = v(e, t)) !== u && (e.state = null), n) : d } var w, k, T = !0; function x(e) { if (T) { var t; for (w = new r.Buf32(512), k = new r.Buf32(32), t = 0; t < 144;)e.lens[t++] = 8; for (; t < 256;)e.lens[t++] = 9; for (; t < 280;)e.lens[t++] = 7; for (; t < 288;)e.lens[t++] = 8; for (a(l, e.lens, 0, 288, w, 0, e.work, { bits: 9 }), t = 0; t < 32;)e.lens[t++] = 5; a(c, e.lens, 0, 32, k, 0, e.work, { bits: 5 }), T = !1 } e.lencode = w, e.lenbits = 9, e.distcode = k, e.distbits = 5 } function E(e, t, n, i) { var s, o = e.state; return null === o.window && (o.wsize = 1 << o.wbits, o.wnext = 0, o.whave = 0, o.window = new r.Buf8(o.wsize)), i >= o.wsize ? (r.arraySet(o.window, t, n - o.wsize, o.wsize, 0), o.wnext = 0, o.whave = o.wsize) : (i < (s = o.wsize - o.wnext) && (s = i), r.arraySet(o.window, t, n - i, s, o.wnext), (i -= s) ? (r.arraySet(o.window, t, n - i, i, 0), o.wnext = i, o.whave = o.wsize) : (o.wnext += s, o.wnext === o.wsize && (o.wnext = 0), o.whave < o.wsize && (o.whave += s))), 0 } n.inflateReset = b, n.inflateReset2 = v, n.inflateResetKeep = y, n.inflateInit = function (e) { return S(e, 15) }, n.inflateInit2 = S, n.inflate = function (e, t) { var n, p, m, g, y, b, v, S, w, k, T, A, C, I, O, M, N, R, D, P, L, B, z, U, j = 0, F = new r.Buf8(4), W = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; if (!e || !e.state || !e.output || !e.input && 0 !== e.avail_in) return d; 12 === (n = e.state).mode && (n.mode = 13), y = e.next_out, m = e.output, v = e.avail_out, g = e.next_in, p = e.input, b = e.avail_in, S = n.hold, w = n.bits, k = b, T = v, B = u; e: for (; ;)switch (n.mode) { case h: if (0 === n.wrap) { n.mode = 13; break } for (; w < 16;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (2 & n.wrap && 35615 === S) { F[n.check = 0] = 255 & S, F[1] = S >>> 8 & 255, n.check = s(n.check, F, 2, 0), w = S = 0, n.mode = 2; break } if (n.flags = 0, n.head && (n.head.done = !1), !(1 & n.wrap) || (((255 & S) << 8) + (S >> 8)) % 31) { e.msg = "incorrect header check", n.mode = 30; break } if (8 != (15 & S)) { e.msg = "unknown compression method", n.mode = 30; break } if (w -= 4, L = 8 + (15 & (S >>>= 4)), 0 === n.wbits) n.wbits = L; else if (L > n.wbits) { e.msg = "invalid window size", n.mode = 30; break } n.dmax = 1 << L, e.adler = n.check = 1, n.mode = 512 & S ? 10 : 12, w = S = 0; break; case 2: for (; w < 16;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (n.flags = S, 8 != (255 & n.flags)) { e.msg = "unknown compression method", n.mode = 30; break } if (57344 & n.flags) { e.msg = "unknown header flags set", n.mode = 30; break } n.head && (n.head.text = S >> 8 & 1), 512 & n.flags && (F[0] = 255 & S, F[1] = S >>> 8 & 255, n.check = s(n.check, F, 2, 0)), w = S = 0, n.mode = 3; case 3: for (; w < 32;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } n.head && (n.head.time = S), 512 & n.flags && (F[0] = 255 & S, F[1] = S >>> 8 & 255, F[2] = S >>> 16 & 255, F[3] = S >>> 24 & 255, n.check = s(n.check, F, 4, 0)), w = S = 0, n.mode = 4; case 4: for (; w < 16;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } n.head && (n.head.xflags = 255 & S, n.head.os = S >> 8), 512 & n.flags && (F[0] = 255 & S, F[1] = S >>> 8 & 255, n.check = s(n.check, F, 2, 0)), w = S = 0, n.mode = 5; case 5: if (1024 & n.flags) { for (; w < 16;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } n.length = S, n.head && (n.head.extra_len = S), 512 & n.flags && (F[0] = 255 & S, F[1] = S >>> 8 & 255, n.check = s(n.check, F, 2, 0)), w = S = 0 } else n.head && (n.head.extra = null); n.mode = 6; case 6: if (1024 & n.flags && (b < (A = n.length) && (A = b), A && (n.head && (L = n.head.extra_len - n.length, n.head.extra || (n.head.extra = new Array(n.head.extra_len)), r.arraySet(n.head.extra, p, g, A, L)), 512 & n.flags && (n.check = s(n.check, p, A, g)), b -= A, g += A, n.length -= A), n.length)) break e; n.length = 0, n.mode = 7; case 7: if (2048 & n.flags) { if (0 === b) break e; for (A = 0; L = p[g + A++], n.head && L && n.length < 65536 && (n.head.name += String.fromCharCode(L)), L && A < b;); if (512 & n.flags && (n.check = s(n.check, p, A, g)), b -= A, g += A, L) break e } else n.head && (n.head.name = null); n.length = 0, n.mode = 8; case 8: if (4096 & n.flags) { if (0 === b) break e; for (A = 0; L = p[g + A++], n.head && L && n.length < 65536 && (n.head.comment += String.fromCharCode(L)), L && A < b;); if (512 & n.flags && (n.check = s(n.check, p, A, g)), b -= A, g += A, L) break e } else n.head && (n.head.comment = null); n.mode = 9; case 9: if (512 & n.flags) { for (; w < 16;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (S !== (65535 & n.check)) { e.msg = "header crc mismatch", n.mode = 30; break } w = S = 0 } n.head && (n.head.hcrc = n.flags >> 9 & 1, n.head.done = !0), e.adler = n.check = 0, n.mode = 12; break; case 10: for (; w < 32;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } e.adler = n.check = f(S), w = S = 0, n.mode = 11; case 11: if (0 === n.havedict) return e.next_out = y, e.avail_out = v, e.next_in = g, e.avail_in = b, n.hold = S, n.bits = w, 2; e.adler = n.check = 1, n.mode = 12; case 12: if (5 === t || 6 === t) break e; case 13: if (n.last) { S >>>= 7 & w, w -= 7 & w, n.mode = 27; break } for (; w < 3;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } switch (n.last = 1 & S, w -= 1, 3 & (S >>>= 1)) { case 0: n.mode = 14; break; case 1: if (x(n), n.mode = 20, 6 !== t) break; S >>>= 2, w -= 2; break e; case 2: n.mode = 17; break; case 3: e.msg = "invalid block type", n.mode = 30 }S >>>= 2, w -= 2; break; case 14: for (S >>>= 7 & w, w -= 7 & w; w < 32;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if ((65535 & S) != (S >>> 16 ^ 65535)) { e.msg = "invalid stored block lengths", n.mode = 30; break } if (n.length = 65535 & S, w = S = 0, n.mode = 15, 6 === t) break e; case 15: n.mode = 16; case 16: if (A = n.length) { if (b < A && (A = b), v < A && (A = v), 0 === A) break e; r.arraySet(m, p, g, A, y), b -= A, g += A, v -= A, y += A, n.length -= A; break } n.mode = 12; break; case 17: for (; w < 14;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (n.nlen = 257 + (31 & S), S >>>= 5, w -= 5, n.ndist = 1 + (31 & S), S >>>= 5, w -= 5, n.ncode = 4 + (15 & S), S >>>= 4, w -= 4, 286 < n.nlen || 30 < n.ndist) { e.msg = "too many length or distance symbols", n.mode = 30; break } n.have = 0, n.mode = 18; case 18: for (; n.have < n.ncode;) { for (; w < 3;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } n.lens[W[n.have++]] = 7 & S, S >>>= 3, w -= 3 } for (; n.have < 19;)n.lens[W[n.have++]] = 0; if (n.lencode = n.lendyn, n.lenbits = 7, z = { bits: n.lenbits }, B = a(0, n.lens, 0, 19, n.lencode, 0, n.work, z), n.lenbits = z.bits, B) { e.msg = "invalid code lengths set", n.mode = 30; break } n.have = 0, n.mode = 19; case 19: for (; n.have < n.nlen + n.ndist;) { for (; M = (j = n.lencode[S & (1 << n.lenbits) - 1]) >>> 16 & 255, N = 65535 & j, !((O = j >>> 24) <= w);) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (N < 16) S >>>= O, w -= O, n.lens[n.have++] = N; else { if (16 === N) { for (U = O + 2; w < U;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (S >>>= O, w -= O, 0 === n.have) { e.msg = "invalid bit length repeat", n.mode = 30; break } L = n.lens[n.have - 1], A = 3 + (3 & S), S >>>= 2, w -= 2 } else if (17 === N) { for (U = O + 3; w < U;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } w -= O, L = 0, A = 3 + (7 & (S >>>= O)), S >>>= 3, w -= 3 } else { for (U = O + 7; w < U;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } w -= O, L = 0, A = 11 + (127 & (S >>>= O)), S >>>= 7, w -= 7 } if (n.have + A > n.nlen + n.ndist) { e.msg = "invalid bit length repeat", n.mode = 30; break } for (; A--;)n.lens[n.have++] = L } } if (30 === n.mode) break; if (0 === n.lens[256]) { e.msg = "invalid code -- missing end-of-block", n.mode = 30; break } if (n.lenbits = 9, z = { bits: n.lenbits }, B = a(l, n.lens, 0, n.nlen, n.lencode, 0, n.work, z), n.lenbits = z.bits, B) { e.msg = "invalid literal/lengths set", n.mode = 30; break } if (n.distbits = 6, n.distcode = n.distdyn, z = { bits: n.distbits }, B = a(c, n.lens, n.nlen, n.ndist, n.distcode, 0, n.work, z), n.distbits = z.bits, B) { e.msg = "invalid distances set", n.mode = 30; break } if (n.mode = 20, 6 === t) break e; case 20: n.mode = 21; case 21: if (6 <= b && 258 <= v) { e.next_out = y, e.avail_out = v, e.next_in = g, e.avail_in = b, n.hold = S, n.bits = w, o(e, T), y = e.next_out, m = e.output, v = e.avail_out, g = e.next_in, p = e.input, b = e.avail_in, S = n.hold, w = n.bits, 12 === n.mode && (n.back = -1); break } for (n.back = 0; M = (j = n.lencode[S & (1 << n.lenbits) - 1]) >>> 16 & 255, N = 65535 & j, !((O = j >>> 24) <= w);) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (M && !(240 & M)) { for (R = O, D = M, P = N; M = (j = n.lencode[P + ((S & (1 << R + D) - 1) >> R)]) >>> 16 & 255, N = 65535 & j, !(R + (O = j >>> 24) <= w);) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } S >>>= R, w -= R, n.back += R } if (S >>>= O, w -= O, n.back += O, n.length = N, 0 === M) { n.mode = 26; break } if (32 & M) { n.back = -1, n.mode = 12; break } if (64 & M) { e.msg = "invalid literal/length code", n.mode = 30; break } n.extra = 15 & M, n.mode = 22; case 22: if (n.extra) { for (U = n.extra; w < U;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } n.length += S & (1 << n.extra) - 1, S >>>= n.extra, w -= n.extra, n.back += n.extra } n.was = n.length, n.mode = 23; case 23: for (; M = (j = n.distcode[S & (1 << n.distbits) - 1]) >>> 16 & 255, N = 65535 & j, !((O = j >>> 24) <= w);) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (!(240 & M)) { for (R = O, D = M, P = N; M = (j = n.distcode[P + ((S & (1 << R + D) - 1) >> R)]) >>> 16 & 255, N = 65535 & j, !(R + (O = j >>> 24) <= w);) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } S >>>= R, w -= R, n.back += R } if (S >>>= O, w -= O, n.back += O, 64 & M) { e.msg = "invalid distance code", n.mode = 30; break } n.offset = N, n.extra = 15 & M, n.mode = 24; case 24: if (n.extra) { for (U = n.extra; w < U;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } n.offset += S & (1 << n.extra) - 1, S >>>= n.extra, w -= n.extra, n.back += n.extra } if (n.offset > n.dmax) { e.msg = "invalid distance too far back", n.mode = 30; break } n.mode = 25; case 25: if (0 === v) break e; if (A = T - v, n.offset > A) { if ((A = n.offset - A) > n.whave && n.sane) { e.msg = "invalid distance too far back", n.mode = 30; break } C = A > n.wnext ? (A -= n.wnext, n.wsize - A) : n.wnext - A, A > n.length && (A = n.length), I = n.window } else I = m, C = y - n.offset, A = n.length; for (v < A && (A = v), v -= A, n.length -= A; m[y++] = I[C++], --A;); 0 === n.length && (n.mode = 21); break; case 26: if (0 === v) break e; m[y++] = n.length, v--, n.mode = 21; break; case 27: if (n.wrap) { for (; w < 32;) { if (0 === b) break e; b--, S |= p[g++] << w, w += 8 } if (T -= v, e.total_out += T, n.total += T, T && (e.adler = n.check = n.flags ? s(n.check, m, T, y - T) : i(n.check, m, T, y - T)), T = v, (n.flags ? S : f(S)) !== n.check) { e.msg = "incorrect data check", n.mode = 30; break } w = S = 0 } n.mode = 28; case 28: if (n.wrap && n.flags) { for (; w < 32;) { if (0 === b) break e; b--, S += p[g++] << w, w += 8 } if (S !== (4294967295 & n.total)) { e.msg = "incorrect length check", n.mode = 30; break } w = S = 0 } n.mode = 29; case 29: B = 1; break e; case 30: B = -3; break e; case 31: return -4; default: return d }return e.next_out = y, e.avail_out = v, e.next_in = g, e.avail_in = b, n.hold = S, n.bits = w, (n.wsize || T !== e.avail_out && n.mode < 30 && (n.mode < 27 || 4 !== t)) && E(e, e.output, e.next_out, T - e.avail_out) ? (n.mode = 31, -4) : (k -= e.avail_in, T -= e.avail_out, e.total_in += k, e.total_out += T, n.total += T, n.wrap && T && (e.adler = n.check = n.flags ? s(n.check, m, T, e.next_out - T) : i(n.check, m, T, e.next_out - T)), e.data_type = n.bits + (n.last ? 64 : 0) + (12 === n.mode ? 128 : 0) + (20 === n.mode || 15 === n.mode ? 256 : 0), (0 == k && 0 === T || 4 === t) && B === u && (B = -5), B) }, n.inflateEnd = function (e) { if (!e || !e.state) return d; var t = e.state; return t.window && (t.window = null), e.state = null, u }, n.inflateGetHeader = function (e, t) { var n; return e && e.state && 2 & (n = e.state).wrap ? ((n.head = t).done = !1, u) : d }, n.inflateSetDictionary = function (e, t) { var n, r = t.length; return e && e.state ? 0 !== (n = e.state).wrap && 11 !== n.mode ? d : 11 === n.mode && i(1, t, r, 0) !== n.check ? -3 : E(e, t, r, r) ? (n.mode = 31, -4) : (n.havedict = 1, u) : d }, n.inflateInfo = "pako inflate (from Nodeca project)" }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function (e, t, n) { "use strict"; var r = e("../utils/common"), i = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], s = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], o = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], a = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; t.exports = function (e, t, n, l, c, u, d, h) { var p, m, f, g, y, b, v, S, w, k = h.bits, T = 0, x = 0, E = 0, A = 0, C = 0, I = 0, O = 0, M = 0, N = 0, R = 0, D = null, P = 0, L = new r.Buf16(16), B = new r.Buf16(16), z = null, U = 0; for (T = 0; T <= 15; T++)L[T] = 0; for (x = 0; x < l; x++)L[t[n + x]]++; for (C = k, A = 15; 1 <= A && 0 === L[A]; A--); if (A < C && (C = A), 0 === A) return c[u++] = 20971520, c[u++] = 20971520, h.bits = 1, 0; for (E = 1; E < A && 0 === L[E]; E++); for (C < E && (C = E), T = M = 1; T <= 15; T++)if (M <<= 1, (M -= L[T]) < 0) return -1; if (0 < M && (0 === e || 1 !== A)) return -1; for (B[1] = 0, T = 1; T < 15; T++)B[T + 1] = B[T] + L[T]; for (x = 0; x < l; x++)0 !== t[n + x] && (d[B[t[n + x]]++] = x); if (b = 0 === e ? (D = z = d, 19) : 1 === e ? (D = i, P -= 257, z = s, U -= 257, 256) : (D = o, z = a, -1), T = E, y = u, O = x = R = 0, f = -1, g = (N = 1 << (I = C)) - 1, 1 === e && 852 < N || 2 === e && 592 < N) return 1; for (; ;) { for (v = T - O, w = d[x] < b ? (S = 0, d[x]) : d[x] > b ? (S = z[U + d[x]], D[P + d[x]]) : (S = 96, 0), p = 1 << T - O, E = m = 1 << I; c[y + (R >> O) + (m -= p)] = v << 24 | S << 16 | w, 0 !== m;); for (p = 1 << T - 1; R & p;)p >>= 1; if (0 !== p ? (R &= p - 1, R += p) : R = 0, x++, 0 == --L[T]) { if (T === A) break; T = t[n + d[x]] } if (C < T && (R & g) !== f) { for (0 === O && (O = C), y += E, M = 1 << (I = T - O); I + O < A && !((M -= L[I + O]) <= 0);)I++, M <<= 1; if (N += 1 << I, 1 === e && 852 < N || 2 === e && 592 < N) return 1; c[f = R & g] = C << 24 | I << 16 | y - u } } return 0 !== R && (c[y + R] = T - O << 24 | 64 << 16), h.bits = C, 0 } }, { "../utils/common": 41 }], 51: [function (e, t, n) { "use strict"; t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" } }, {}], 52: [function (e, t, n) { "use strict"; var r = e("../utils/common"), i = 0, s = 1; function o(e) { for (var t = e.length; 0 <= --t;)e[t] = 0 } var a = 0, l = 29, c = 256, u = c + 1 + l, d = 30, h = 19, p = 2 * u + 1, m = 15, f = 16, g = 7, y = 256, b = 16, v = 17, S = 18, w = [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], k = [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], T = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], x = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], E = new Array(2 * (u + 2)); o(E); var A = new Array(2 * d); o(A); var C = new Array(512); o(C); var I = new Array(256); o(I); var O = new Array(l); o(O); var M, N, R, D = new Array(d); function P(e, t, n, r, i) { this.static_tree = e, this.extra_bits = t, this.extra_base = n, this.elems = r, this.max_length = i, this.has_stree = e && e.length } function L(e, t) { this.dyn_tree = e, this.max_code = 0, this.stat_desc = t } function B(e) { return e < 256 ? C[e] : C[256 + (e >>> 7)] } function z(e, t) { e.pending_buf[e.pending++] = 255 & t, e.pending_buf[e.pending++] = t >>> 8 & 255 } function U(e, t, n) { e.bi_valid > f - n ? (e.bi_buf |= t << e.bi_valid & 65535, z(e, e.bi_buf), e.bi_buf = t >> f - e.bi_valid, e.bi_valid += n - f) : (e.bi_buf |= t << e.bi_valid & 65535, e.bi_valid += n) } function j(e, t, n) { U(e, n[2 * t], n[2 * t + 1]) } function F(e, t) { for (var n = 0; n |= 1 & e, e >>>= 1, n <<= 1, 0 < --t;); return n >>> 1 } function W(e, t, n) { var r, i, s = new Array(m + 1), o = 0; for (r = 1; r <= m; r++)s[r] = o = o + n[r - 1] << 1; for (i = 0; i <= t; i++) { var a = e[2 * i + 1]; 0 !== a && (e[2 * i] = F(s[a]++, a)) } } function V(e) { var t; for (t = 0; t < u; t++)e.dyn_ltree[2 * t] = 0; for (t = 0; t < d; t++)e.dyn_dtree[2 * t] = 0; for (t = 0; t < h; t++)e.bl_tree[2 * t] = 0; e.dyn_ltree[2 * y] = 1, e.opt_len = e.static_len = 0, e.last_lit = e.matches = 0 } function G(e) { 8 < e.bi_valid ? z(e, e.bi_buf) : 0 < e.bi_valid && (e.pending_buf[e.pending++] = e.bi_buf), e.bi_buf = 0, e.bi_valid = 0 } function q(e, t, n, r) { var i = 2 * t, s = 2 * n; return e[i] < e[s] || e[i] === e[s] && r[t] <= r[n] } function Y(e, t, n) { for (var r = e.heap[n], i = n << 1; i <= e.heap_len && (i < e.heap_len && q(t, e.heap[i + 1], e.heap[i], e.depth) && i++, !q(t, r, e.heap[i], e.depth));)e.heap[n] = e.heap[i], n = i, i <<= 1; e.heap[n] = r } function H(e, t, n) { var r, i, s, o, a = 0; if (0 !== e.last_lit) for (; r = e.pending_buf[e.d_buf + 2 * a] << 8 | e.pending_buf[e.d_buf + 2 * a + 1], i = e.pending_buf[e.l_buf + a], a++, 0 === r ? j(e, i, t) : (j(e, (s = I[i]) + c + 1, t), 0 !== (o = w[s]) && U(e, i -= O[s], o), j(e, s = B(--r), n), 0 !== (o = k[s]) && U(e, r -= D[s], o)), a < e.last_lit;); j(e, y, t) } function _(e, t) { var n, r, i, s = t.dyn_tree, o = t.stat_desc.static_tree, a = t.stat_desc.has_stree, l = t.stat_desc.elems, c = -1; for (e.heap_len = 0, e.heap_max = p, n = 0; n < l; n++)0 !== s[2 * n] ? (e.heap[++e.heap_len] = c = n, e.depth[n] = 0) : s[2 * n + 1] = 0; for (; e.heap_len < 2;)s[2 * (i = e.heap[++e.heap_len] = c < 2 ? ++c : 0)] = 1, e.depth[i] = 0, e.opt_len--, a && (e.static_len -= o[2 * i + 1]); for (t.max_code = c, n = e.heap_len >> 1; 1 <= n; n--)Y(e, s, n); for (i = l; n = e.heap[1], e.heap[1] = e.heap[e.heap_len--], Y(e, s, 1), r = e.heap[1], e.heap[--e.heap_max] = n, e.heap[--e.heap_max] = r, s[2 * i] = s[2 * n] + s[2 * r], e.depth[i] = (e.depth[n] >= e.depth[r] ? e.depth[n] : e.depth[r]) + 1, s[2 * n + 1] = s[2 * r + 1] = i, e.heap[1] = i++, Y(e, s, 1), 2 <= e.heap_len;); e.heap[--e.heap_max] = e.heap[1], function (e, t) { var n, r, i, s, o, a, l = t.dyn_tree, c = t.max_code, u = t.stat_desc.static_tree, d = t.stat_desc.has_stree, h = t.stat_desc.extra_bits, f = t.stat_desc.extra_base, g = t.stat_desc.max_length, y = 0; for (s = 0; s <= m; s++)e.bl_count[s] = 0; for (l[2 * e.heap[e.heap_max] + 1] = 0, n = e.heap_max + 1; n < p; n++)g < (s = l[2 * l[2 * (r = e.heap[n]) + 1] + 1] + 1) && (s = g, y++), l[2 * r + 1] = s, c < r || (e.bl_count[s]++, o = 0, f <= r && (o = h[r - f]), a = l[2 * r], e.opt_len += a * (s + o), d && (e.static_len += a * (u[2 * r + 1] + o))); if (0 !== y) { do { for (s = g - 1; 0 === e.bl_count[s];)s--; e.bl_count[s]--, e.bl_count[s + 1] += 2, e.bl_count[g]--, y -= 2 } while (0 < y); for (s = g; 0 !== s; s--)for (r = e.bl_count[s]; 0 !== r;)c < (i = e.heap[--n]) || (l[2 * i + 1] !== s && (e.opt_len += (s - l[2 * i + 1]) * l[2 * i], l[2 * i + 1] = s), r--) } }(e, t), W(s, c, e.bl_count) } function K(e, t, n) { var r, i, s = -1, o = t[1], a = 0, l = 7, c = 4; for (0 === o && (l = 138, c = 3), t[2 * (n + 1) + 1] = 65535, r = 0; r <= n; r++)i = o, o = t[2 * (r + 1) + 1], ++a < l && i === o || (a < c ? e.bl_tree[2 * i] += a : 0 !== i ? (i !== s && e.bl_tree[2 * i]++, e.bl_tree[2 * b]++) : a <= 10 ? e.bl_tree[2 * v]++ : e.bl_tree[2 * S]++, s = i, c = (a = 0) === o ? (l = 138, 3) : i === o ? (l = 6, 3) : (l = 7, 4)) } function Q(e, t, n) { var r, i, s = -1, o = t[1], a = 0, l = 7, c = 4; for (0 === o && (l = 138, c = 3), r = 0; r <= n; r++)if (i = o, o = t[2 * (r + 1) + 1], !(++a < l && i === o)) { if (a < c) for (; j(e, i, e.bl_tree), 0 != --a;); else 0 !== i ? (i !== s && (j(e, i, e.bl_tree), a--), j(e, b, e.bl_tree), U(e, a - 3, 2)) : a <= 10 ? (j(e, v, e.bl_tree), U(e, a - 3, 3)) : (j(e, S, e.bl_tree), U(e, a - 11, 7)); s = i, c = (a = 0) === o ? (l = 138, 3) : i === o ? (l = 6, 3) : (l = 7, 4) } } o(D); var X = !1; function Z(e, t, n, i) { U(e, (a << 1) + (i ? 1 : 0), 3), function (e, t, n, i) { G(e), i && (z(e, n), z(e, ~n)), r.arraySet(e.pending_buf, e.window, t, n, e.pending), e.pending += n }(e, t, n, !0) } n._tr_init = function (e) { X || (function () { var e, t, n, r, i, s = new Array(m + 1); for (r = n = 0; r < l - 1; r++)for (O[r] = n, e = 0; e < 1 << w[r]; e++)I[n++] = r; for (I[n - 1] = r, r = i = 0; r < 16; r++)for (D[r] = i, e = 0; e < 1 << k[r]; e++)C[i++] = r; for (i >>= 7; r < d; r++)for (D[r] = i << 7, e = 0; e < 1 << k[r] - 7; e++)C[256 + i++] = r; for (t = 0; t <= m; t++)s[t] = 0; for (e = 0; e <= 143;)E[2 * e + 1] = 8, e++, s[8]++; for (; e <= 255;)E[2 * e + 1] = 9, e++, s[9]++; for (; e <= 279;)E[2 * e + 1] = 7, e++, s[7]++; for (; e <= 287;)E[2 * e + 1] = 8, e++, s[8]++; for (W(E, u + 1, s), e = 0; e < d; e++)A[2 * e + 1] = 5, A[2 * e] = F(e, 5); M = new P(E, w, c + 1, u, m), N = new P(A, k, 0, d, m), R = new P(new Array(0), T, 0, h, g) }(), X = !0), e.l_desc = new L(e.dyn_ltree, M), e.d_desc = new L(e.dyn_dtree, N), e.bl_desc = new L(e.bl_tree, R), e.bi_buf = 0, e.bi_valid = 0, V(e) }, n._tr_stored_block = Z, n._tr_flush_block = function (e, t, n, r) { var o, a, l = 0; 0 < e.level ? (2 === e.strm.data_type && (e.strm.data_type = function (e) { var t, n = 4093624447; for (t = 0; t <= 31; t++, n >>>= 1)if (1 & n && 0 !== e.dyn_ltree[2 * t]) return i; if (0 !== e.dyn_ltree[18] || 0 !== e.dyn_ltree[20] || 0 !== e.dyn_ltree[26]) return s; for (t = 32; t < c; t++)if (0 !== e.dyn_ltree[2 * t]) return s; return i }(e)), _(e, e.l_desc), _(e, e.d_desc), l = function (e) { var t; for (K(e, e.dyn_ltree, e.l_desc.max_code), K(e, e.dyn_dtree, e.d_desc.max_code), _(e, e.bl_desc), t = h - 1; 3 <= t && 0 === e.bl_tree[2 * x[t] + 1]; t--); return e.opt_len += 3 * (t + 1) + 5 + 5 + 4, t }(e), o = e.opt_len + 3 + 7 >>> 3, (a = e.static_len + 3 + 7 >>> 3) <= o && (o = a)) : o = a = n + 5, n + 4 <= o && -1 !== t ? Z(e, t, n, r) : 4 === e.strategy || a === o ? (U(e, 2 + (r ? 1 : 0), 3), H(e, E, A)) : (U(e, 4 + (r ? 1 : 0), 3), function (e, t, n, r) { var i; for (U(e, t - 257, 5), U(e, n - 1, 5), U(e, r - 4, 4), i = 0; i < r; i++)U(e, e.bl_tree[2 * x[i] + 1], 3); Q(e, e.dyn_ltree, t - 1), Q(e, e.dyn_dtree, n - 1) }(e, e.l_desc.max_code + 1, e.d_desc.max_code + 1, l + 1), H(e, e.dyn_ltree, e.dyn_dtree)), V(e), r && G(e) }, n._tr_tally = function (e, t, n) { return e.pending_buf[e.d_buf + 2 * e.last_lit] = t >>> 8 & 255, e.pending_buf[e.d_buf + 2 * e.last_lit + 1] = 255 & t, e.pending_buf[e.l_buf + e.last_lit] = 255 & n, e.last_lit++, 0 === t ? e.dyn_ltree[2 * n]++ : (e.matches++, t--, e.dyn_ltree[2 * (I[n] + c + 1)]++, e.dyn_dtree[2 * B(t)]++), e.last_lit === e.lit_bufsize - 1 }, n._tr_align = function (e) { U(e, 2, 3), j(e, y, E), function (e) { 16 === e.bi_valid ? (z(e, e.bi_buf), e.bi_buf = 0, e.bi_valid = 0) : 8 <= e.bi_valid && (e.pending_buf[e.pending++] = 255 & e.bi_buf, e.bi_buf >>= 8, e.bi_valid -= 8) }(e) } }, { "../utils/common": 41 }], 53: [function (e, t, n) { "use strict"; t.exports = function () { 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 } }, {}], 54: [function (e, t, n) { (function (e) { !function (e, t) { "use strict"; if (!e.setImmediate) { var n, r, s, o, a = 1, l = {}, c = !1, u = e.document, d = Object.getPrototypeOf && Object.getPrototypeOf(e); d = d && d.setTimeout ? d : e, n = "[object process]" === {}.toString.call(e.process) ? function (e) { i.nextTick((function () { p(e) })) } : function () { if (e.postMessage && !e.importScripts) { var t = !0, n = e.onmessage; return e.onmessage = function () { t = !1 }, e.postMessage("", "*"), e.onmessage = n, t } }() ? (o = "setImmediate$" + Math.random() + "$", e.addEventListener ? e.addEventListener("message", m, !1) : e.attachEvent("onmessage", m), function (t) { e.postMessage(o + t, "*") }) : e.MessageChannel ? ((s = new MessageChannel).port1.onmessage = function (e) { p(e.data) }, function (e) { s.port2.postMessage(e) }) : u && "onreadystatechange" in u.createElement("script") ? (r = u.documentElement, function (e) { var t = u.createElement("script"); t.onreadystatechange = function () { p(e), t.onreadystatechange = null, r.removeChild(t), t = null }, r.appendChild(t) }) : function (e) { setTimeout(p, 0, e) }, d.setImmediate = function (e) { "function" != typeof e && (e = new Function("" + e)); for (var t = new Array(arguments.length - 1), r = 0; r < t.length; r++)t[r] = arguments[r + 1]; var i = { callback: e, args: t }; return l[a] = i, n(a), a++ }, d.clearImmediate = h } function h(e) { delete l[e] } function p(e) { if (c) setTimeout(p, 0, e); else { var n = l[e]; if (n) { c = !0; try { !function (e) { var n = e.callback, r = e.args; switch (r.length) { case 0: n(); break; case 1: n(r[0]); break; case 2: n(r[0], r[1]); break; case 3: n(r[0], r[1], r[2]); break; default: n.apply(t, r) } }(n) } finally { h(e), c = !1 } } } } function m(t) { t.source === e && "string" == typeof t.data && 0 === t.data.indexOf(o) && p(+t.data.slice(o.length)) } }("undefined" == typeof self ? void 0 === e ? this : e : self) }).call(this, void 0 !== r ? r : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}] }, {}, [10])(10) }).call(this, n(18).Buffer, n(123).setImmediate, n(9), n(41)) }, function (e, t) { class n { static get RGB_BLACK() { return { r: 0, g: 0, b: 0 } } static get RGB_WHITE() { return { r: 255, g: 255, b: 255 } } static decimalToHex(e) { e < 0 && (e += 16777216); let t = Number(e).toString(16); return t = "#".concat("000000".substr(0, 6 - t.length)).concat(t), t } static decimalToRgb(e) { const t = e >> 24 & 255; return { r: e >> 16 & 255, g: e >> 8 & 255, b: 255 & e, a: t > 0 ? t : 255 } } static hexToRgb(e) { e.startsWith("#") && (e = e.substring(1)); const t = parseInt(e, 16); if (isNaN(t)) return null; if (6 === e.length) return { r: t >> 16 & 255, g: t >> 8 & 255, b: 255 & t }; if (3 === e.length) { const e = t >> 8 & 15, n = t >> 4 & 15, r = 15 & t; return { r: e << 4 | e, g: n << 4 | n, b: r << 4 | r } } return null } static rgbToHex(e) { return n.decimalToHex(n.rgbToDecimal(e)) } static rgbToDecimal(e) { return (e.r << 16) + (e.g << 8) + e.b } static hexToDecimal(e) { return n.rgbToDecimal(n.hexToRgb(e)) } static hsvToRgb(e) { let t = e.h % 360; t < 0 && (t += 360); const n = Math.max(0, Math.min(e.s, 1)), r = Math.max(0, Math.min(e.v, 1)), i = Math.floor(t / 60), s = t / 60 - i, o = r * (1 - n), a = r * (1 - n * s), l = r * (1 - n * (1 - s)); let c, u, d; switch (i) { default: case 0: c = r, u = l, d = o; break; case 1: c = a, u = r, d = o; break; case 2: c = o, u = r, d = l; break; case 3: c = o, u = a, d = r; break; case 4: c = l, u = o, d = r; break; case 5: c = r, u = o, d = a }return { r: Math.floor(255 * c), g: Math.floor(255 * u), b: Math.floor(255 * d) } } static rgbToHsv(e) { const t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.min(Math.min(t, n), r), s = Math.max(Math.max(t, n), r); let o = 0, a = 0; if (i !== s) { o = 60 * ((t === i ? 3 : n === i ? 5 : 1) - (t === i ? n - r : n === i ? r - t : t - n) / (s - i)) % 360, a = (s - i) / s } return { h: o, s: a, v: s } } static mixRgb(e, t, n) { if (n <= 0) return e; if (n >= 1) return t; const r = 1 - n; return { r: r * e.r + n * t.r, g: r * e.g + n * t.g, b: r * e.b + n * t.b } } } e.exports = n }, function (e, t, n) { e.exports = function () { "use strict"; var e = Array.prototype.slice; function t(e, t) { t && (e.prototype = Object.create(t.prototype)), e.prototype.constructor = e } function n(e) { return o(e) ? e : _(e) } function r(e) { return a(e) ? e : K(e) } function i(e) { return l(e) ? e : Q(e) } function s(e) { return o(e) && !c(e) ? e : X(e) } function o(e) { return !(!e || !e[d]) } function a(e) { return !(!e || !e[h]) } function l(e) { return !(!e || !e[p]) } function c(e) { return a(e) || l(e) } function u(e) { return !(!e || !e[m]) } t(r, n), t(i, n), t(s, n), n.isIterable = o, n.isKeyed = a, n.isIndexed = l, n.isAssociative = c, n.isOrdered = u, n.Keyed = r, n.Indexed = i, n.Set = s; var d = "@@__IMMUTABLE_ITERABLE__@@", h = "@@__IMMUTABLE_KEYED__@@", p = "@@__IMMUTABLE_INDEXED__@@", m = "@@__IMMUTABLE_ORDERED__@@", f = "delete", g = 5, y = 1 << g, b = y - 1, v = {}, S = { value: !1 }, w = { value: !1 }; function k(e) { return e.value = !1, e } function T(e) { e && (e.value = !0) } function x() { } function E(e, t) { t = t || 0; for (var n = Math.max(0, e.length - t), r = new Array(n), i = 0; i < n; i++)r[i] = e[i + t]; return r } function A(e) { return void 0 === e.size && (e.size = e.__iterate(I)), e.size } function C(e, t) { if ("number" != typeof t) { var n = t >>> 0; if ("" + n !== t || 4294967295 === n) return NaN; t = n } return t < 0 ? A(e) + t : t } function I() { return !0 } function O(e, t, n) { return (0 === e || void 0 !== n && e <= -n) && (void 0 === t || void 0 !== n && t >= n) } function M(e, t) { return R(e, t, 0) } function N(e, t) { return R(e, t, t) } function R(e, t, n) { return void 0 === e ? n : e < 0 ? Math.max(0, t + e) : void 0 === t ? e : Math.min(t, e) } var D = 0, P = 1, L = 2, B = "function" == typeof Symbol && Symbol.iterator, z = "@@iterator", U = B || z; function j(e) { this.next = e } function F(e, t, n, r) { var i = 0 === e ? t : 1 === e ? n : [t, n]; return r ? r.value = i : r = { value: i, done: !1 }, r } function W() { return { value: void 0, done: !0 } } function V(e) { return !!Y(e) } function G(e) { return e && "function" == typeof e.next } function q(e) { var t = Y(e); return t && t.call(e) } function Y(e) { var t = e && (B && e[B] || e[z]); if ("function" == typeof t) return t } function H(e) { return e && "number" == typeof e.length } function _(e) { return null == e ? oe() : o(e) ? e.toSeq() : ce(e) } function K(e) { return null == e ? oe().toKeyedSeq() : o(e) ? a(e) ? e.toSeq() : e.fromEntrySeq() : ae(e) } function Q(e) { return null == e ? oe() : o(e) ? a(e) ? e.entrySeq() : e.toIndexedSeq() : le(e) } function X(e) { return (null == e ? oe() : o(e) ? a(e) ? e.entrySeq() : e : le(e)).toSetSeq() } j.prototype.toString = function () { return "[Iterator]" }, j.KEYS = D, j.VALUES = P, j.ENTRIES = L, j.prototype.inspect = j.prototype.toSource = function () { return this.toString() }, j.prototype[U] = function () { return this }, t(_, n), _.of = function () { return _(arguments) }, _.prototype.toSeq = function () { return this }, _.prototype.toString = function () { return this.__toString("Seq {", "}") }, _.prototype.cacheResult = function () { return !this._cache && this.__iterateUncached && (this._cache = this.entrySeq().toArray(), this.size = this._cache.length), this }, _.prototype.__iterate = function (e, t) { return de(this, e, t, !0) }, _.prototype.__iterator = function (e, t) { return he(this, e, t, !0) }, t(K, _), K.prototype.toKeyedSeq = function () { return this }, t(Q, _), Q.of = function () { return Q(arguments) }, Q.prototype.toIndexedSeq = function () { return this }, Q.prototype.toString = function () { return this.__toString("Seq [", "]") }, Q.prototype.__iterate = function (e, t) { return de(this, e, t, !1) }, Q.prototype.__iterator = function (e, t) { return he(this, e, t, !1) }, t(X, _), X.of = function () { return X(arguments) }, X.prototype.toSetSeq = function () { return this }, _.isSeq = se, _.Keyed = K, _.Set = X, _.Indexed = Q; var Z, J, $, ee = "@@__IMMUTABLE_SEQ__@@"; function te(e) { this._array = e, this.size = e.length } function ne(e) { var t = Object.keys(e); this._object = e, this._keys = t, this.size = t.length } function re(e) { this._iterable = e, this.size = e.length || e.size } function ie(e) { this._iterator = e, this._iteratorCache = [] } function se(e) { return !(!e || !e[ee]) } function oe() { return Z || (Z = new te([])) } function ae(e) { var t = Array.isArray(e) ? new te(e).fromEntrySeq() : G(e) ? new ie(e).fromEntrySeq() : V(e) ? new re(e).fromEntrySeq() : "object" == typeof e ? new ne(e) : void 0; if (!t) throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: " + e); return t } function le(e) { var t = ue(e); if (!t) throw new TypeError("Expected Array or iterable object of values: " + e); return t } function ce(e) { var t = ue(e) || "object" == typeof e && new ne(e); if (!t) throw new TypeError("Expected Array or iterable object of values, or keyed object: " + e); return t } function ue(e) { return H(e) ? new te(e) : G(e) ? new ie(e) : V(e) ? new re(e) : void 0 } function de(e, t, n, r) { var i = e._cache; if (i) { for (var s = i.length - 1, o = 0; o <= s; o++) { var a = i[n ? s - o : o]; if (!1 === t(a[1], r ? a[0] : o, e)) return o + 1 } return o } return e.__iterateUncached(t, n) } function he(e, t, n, r) { var i = e._cache; if (i) { var s = i.length - 1, o = 0; return new j((function () { var e = i[n ? s - o : o]; return o++ > s ? W() : F(t, r ? e[0] : o - 1, e[1]) })) } return e.__iteratorUncached(t, n) } function pe(e, t) { return t ? me(t, e, "", { "": e }) : fe(e) } function me(e, t, n, r) { return Array.isArray(t) ? e.call(r, n, Q(t).map((function (n, r) { return me(e, n, r, t) }))) : ge(t) ? e.call(r, n, K(t).map((function (n, r) { return me(e, n, r, t) }))) : t } function fe(e) { return Array.isArray(e) ? Q(e).map(fe).toList() : ge(e) ? K(e).map(fe).toMap() : e } function ge(e) { return e && (e.constructor === Object || void 0 === e.constructor) } function ye(e, t) { if (e === t || e != e && t != t) return !0; if (!e || !t) return !1; if ("function" == typeof e.valueOf && "function" == typeof t.valueOf) { if ((e = e.valueOf()) === (t = t.valueOf()) || e != e && t != t) return !0; if (!e || !t) return !1 } return !("function" != typeof e.equals || "function" != typeof t.equals || !e.equals(t)) } function be(e, t) { if (e === t) return !0; if (!o(t) || void 0 !== e.size && void 0 !== t.size && e.size !== t.size || void 0 !== e.__hash && void 0 !== t.__hash && e.__hash !== t.__hash || a(e) !== a(t) || l(e) !== l(t) || u(e) !== u(t)) return !1; if (0 === e.size && 0 === t.size) return !0; var n = !c(e); if (u(e)) { var r = e.entries(); return t.every((function (e, t) { var i = r.next().value; return i && ye(i[1], e) && (n || ye(i[0], t)) })) && r.next().done } var i = !1; if (void 0 === e.size) if (void 0 === t.size) "function" == typeof e.cacheResult && e.cacheResult(); else { i = !0; var s = e; e = t, t = s } var d = !0, h = t.__iterate((function (t, r) { if (n ? !e.has(t) : i ? !ye(t, e.get(r, v)) : !ye(e.get(r, v), t)) return d = !1, !1 })); return d && e.size === h } function ve(e, t) { if (!(this instanceof ve)) return new ve(e, t); if (this._value = e, this.size = void 0 === t ? 1 / 0 : Math.max(0, t), 0 === this.size) { if (J) return J; J = this } } function Se(e, t) { if (!e) throw new Error(t) } function we(e, t, n) { if (!(this instanceof we)) return new we(e, t, n); if (Se(0 !== n, "Cannot step a Range by 0"), e = e || 0, void 0 === t && (t = 1 / 0), n = void 0 === n ? 1 : Math.abs(n), t < e && (n = -n), this._start = e, this._end = t, this._step = n, this.size = Math.max(0, Math.ceil((t - e) / n - 1) + 1), 0 === this.size) { if ($) return $; $ = this } } function ke() { throw TypeError("Abstract") } function Te() { } function xe() { } function Ee() { } _.prototype[ee] = !0, t(te, Q), te.prototype.get = function (e, t) { return this.has(e) ? this._array[C(this, e)] : t }, te.prototype.__iterate = function (e, t) { for (var n = this._array, r = n.length - 1, i = 0; i <= r; i++)if (!1 === e(n[t ? r - i : i], i, this)) return i + 1; return i }, te.prototype.__iterator = function (e, t) { var n = this._array, r = n.length - 1, i = 0; return new j((function () { return i > r ? W() : F(e, i, n[t ? r - i++ : i++]) })) }, t(ne, K), ne.prototype.get = function (e, t) { return void 0 === t || this.has(e) ? this._object[e] : t }, ne.prototype.has = function (e) { return this._object.hasOwnProperty(e) }, ne.prototype.__iterate = function (e, t) { for (var n = this._object, r = this._keys, i = r.length - 1, s = 0; s <= i; s++) { var o = r[t ? i - s : s]; if (!1 === e(n[o], o, this)) return s + 1 } return s }, ne.prototype.__iterator = function (e, t) { var n = this._object, r = this._keys, i = r.length - 1, s = 0; return new j((function () { var o = r[t ? i - s : s]; return s++ > i ? W() : F(e, o, n[o]) })) }, ne.prototype[m] = !0, t(re, Q), re.prototype.__iterateUncached = function (e, t) { if (t) return this.cacheResult().__iterate(e, t); var n = q(this._iterable), r = 0; if (G(n)) for (var i; !(i = n.next()).done && !1 !== e(i.value, r++, this);); return r }, re.prototype.__iteratorUncached = function (e, t) { if (t) return this.cacheResult().__iterator(e, t); var n = q(this._iterable); if (!G(n)) return new j(W); var r = 0; return new j((function () { var t = n.next(); return t.done ? t : F(e, r++, t.value) })) }, t(ie, Q), ie.prototype.__iterateUncached = function (e, t) { if (t) return this.cacheResult().__iterate(e, t); for (var n, r = this._iterator, i = this._iteratorCache, s = 0; s < i.length;)if (!1 === e(i[s], s++, this)) return s; for (; !(n = r.next()).done;) { var o = n.value; if (i[s] = o, !1 === e(o, s++, this)) break } return s }, ie.prototype.__iteratorUncached = function (e, t) { if (t) return this.cacheResult().__iterator(e, t); var n = this._iterator, r = this._iteratorCache, i = 0; return new j((function () { if (i >= r.length) { var t = n.next(); if (t.done) return t; r[i] = t.value } return F(e, i, r[i++]) })) }, t(ve, Q), ve.prototype.toString = function () { return 0 === this.size ? "Repeat []" : "Repeat [ " + this._value + " " + this.size + " times ]" }, ve.prototype.get = function (e, t) { return this.has(e) ? this._value : t }, ve.prototype.includes = function (e) { return ye(this._value, e) }, ve.prototype.slice = function (e, t) { var n = this.size; return O(e, t, n) ? this : new ve(this._value, N(t, n) - M(e, n)) }, ve.prototype.reverse = function () { return this }, ve.prototype.indexOf = function (e) { return ye(this._value, e) ? 0 : -1 }, ve.prototype.lastIndexOf = function (e) { return ye(this._value, e) ? this.size : -1 }, ve.prototype.__iterate = function (e, t) { for (var n = 0; n < this.size; n++)if (!1 === e(this._value, n, this)) return n + 1; return n }, ve.prototype.__iterator = function (e, t) { var n = this, r = 0; return new j((function () { return r < n.size ? F(e, r++, n._value) : W() })) }, ve.prototype.equals = function (e) { return e instanceof ve ? ye(this._value, e._value) : be(e) }, t(we, Q), we.prototype.toString = function () { return 0 === this.size ? "Range []" : "Range [ " + this._start + "..." + this._end + (1 !== this._step ? " by " + this._step : "") + " ]" }, we.prototype.get = function (e, t) { return this.has(e) ? this._start + C(this, e) * this._step : t }, we.prototype.includes = function (e) { var t = (e - this._start) / this._step; return t >= 0 && t < this.size && t === Math.floor(t) }, we.prototype.slice = function (e, t) { return O(e, t, this.size) ? this : (e = M(e, this.size), (t = N(t, this.size)) <= e ? new we(0, 0) : new we(this.get(e, this._end), this.get(t, this._end), this._step)) }, we.prototype.indexOf = function (e) { var t = e - this._start; if (t % this._step == 0) { var n = t / this._step; if (n >= 0 && n < this.size) return n } return -1 }, we.prototype.lastIndexOf = function (e) { return this.indexOf(e) }, we.prototype.__iterate = function (e, t) { for (var n = this.size - 1, r = this._step, i = t ? this._start + n * r : this._start, s = 0; s <= n; s++) { if (!1 === e(i, s, this)) return s + 1; i += t ? -r : r } return s }, we.prototype.__iterator = function (e, t) { var n = this.size - 1, r = this._step, i = t ? this._start + n * r : this._start, s = 0; return new j((function () { var o = i; return i += t ? -r : r, s > n ? W() : F(e, s++, o) })) }, we.prototype.equals = function (e) { return e instanceof we ? this._start === e._start && this._end === e._end && this._step === e._step : be(this, e) }, t(ke, n), t(Te, ke), t(xe, ke), t(Ee, ke), ke.Keyed = Te, ke.Indexed = xe, ke.Set = Ee; var Ae = "function" == typeof Math.imul && -2 === Math.imul(4294967295, 2) ? Math.imul : function (e, t) { var n = 65535 & (e |= 0), r = 65535 & (t |= 0); return n * r + ((e >>> 16) * r + n * (t >>> 16) << 16 >>> 0) | 0 }; function Ce(e) { return e >>> 1 & 1073741824 | 3221225471 & e } function Ie(e) { if (!1 === e || null == e) return 0; if ("function" == typeof e.valueOf && (!1 === (e = e.valueOf()) || null == e)) return 0; if (!0 === e) return 1; var t = typeof e; if ("number" === t) { if (e != e || e === 1 / 0) return 0; var n = 0 | e; for (n !== e && (n ^= 4294967295 * e); e > 4294967295;)n ^= e /= 4294967295; return Ce(n) } if ("string" === t) return e.length > je ? Oe(e) : Me(e); if ("function" == typeof e.hashCode) return e.hashCode(); if ("object" === t) return Ne(e); if ("function" == typeof e.toString) return Me(e.toString()); throw new Error("Value type " + t + " cannot be hashed.") } function Oe(e) { var t = Ve[e]; return void 0 === t && (t = Me(e), We === Fe && (We = 0, Ve = {}), We++, Ve[e] = t), t } function Me(e) { for (var t = 0, n = 0; n < e.length; n++)t = 31 * t + e.charCodeAt(n) | 0; return Ce(t) } function Ne(e) { var t; if (Be && void 0 !== (t = Le.get(e))) return t; if (void 0 !== (t = e[Ue])) return t; if (!De) { if (void 0 !== (t = e.propertyIsEnumerable && e.propertyIsEnumerable[Ue])) return t; if (void 0 !== (t = Pe(e))) return t } if (t = ++ze, 1073741824 & ze && (ze = 0), Be) Le.set(e, t); else { if (void 0 !== Re && !1 === Re(e)) throw new Error("Non-extensible objects are not allowed as keys."); if (De) Object.defineProperty(e, Ue, { enumerable: !1, configurable: !1, writable: !1, value: t }); else if (void 0 !== e.propertyIsEnumerable && e.propertyIsEnumerable === e.constructor.prototype.propertyIsEnumerable) e.propertyIsEnumerable = function () { return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments) }, e.propertyIsEnumerable[Ue] = t; else { if (void 0 === e.nodeType) throw new Error("Unable to set a non-enumerable property on object."); e[Ue] = t } } return t } var Re = Object.isExtensible, De = function () { try { return Object.defineProperty({}, "@", {}), !0 } catch (e) { return !1 } }(); function Pe(e) { if (e && e.nodeType > 0) switch (e.nodeType) { case 1: return e.uniqueID; case 9: return e.documentElement && e.documentElement.uniqueID } } var Le, Be = "function" == typeof WeakMap; Be && (Le = new WeakMap); var ze = 0, Ue = "__immutablehash__"; "function" == typeof Symbol && (Ue = Symbol(Ue)); var je = 16, Fe = 255, We = 0, Ve = {}; function Ge(e) { Se(e !== 1 / 0, "Cannot perform this action with an infinite size.") } function qe(e) { return null == e ? it() : Ye(e) && !u(e) ? e : it().withMutations((function (t) { var n = r(e); Ge(n.size), n.forEach((function (e, n) { return t.set(n, e) })) })) } function Ye(e) { return !(!e || !e[_e]) } t(qe, Te), qe.of = function () { var t = e.call(arguments, 0); return it().withMutations((function (e) { for (var n = 0; n < t.length; n += 2) { if (n + 1 >= t.length) throw new Error("Missing value for key: " + t[n]); e.set(t[n], t[n + 1]) } })) }, qe.prototype.toString = function () { return this.__toString("Map {", "}") }, qe.prototype.get = function (e, t) { return this._root ? this._root.get(0, void 0, e, t) : t }, qe.prototype.set = function (e, t) { return st(this, e, t) }, qe.prototype.setIn = function (e, t) { return this.updateIn(e, v, (function () { return t })) }, qe.prototype.remove = function (e) { return st(this, e, v) }, qe.prototype.deleteIn = function (e) { return this.updateIn(e, (function () { return v })) }, qe.prototype.update = function (e, t, n) { return 1 === arguments.length ? e(this) : this.updateIn([e], t, n) }, qe.prototype.updateIn = function (e, t, n) { n || (n = t, t = void 0); var r = gt(this, kn(e), t, n); return r === v ? void 0 : r }, qe.prototype.clear = function () { return 0 === this.size ? this : this.__ownerID ? (this.size = 0, this._root = null, this.__hash = void 0, this.__altered = !0, this) : it() }, qe.prototype.merge = function () { return ht(this, void 0, arguments) }, qe.prototype.mergeWith = function (t) { return ht(this, t, e.call(arguments, 1)) }, qe.prototype.mergeIn = function (t) { var n = e.call(arguments, 1); return this.updateIn(t, it(), (function (e) { return "function" == typeof e.merge ? e.merge.apply(e, n) : n[n.length - 1] })) }, qe.prototype.mergeDeep = function () { return ht(this, pt, arguments) }, qe.prototype.mergeDeepWith = function (t) { var n = e.call(arguments, 1); return ht(this, mt(t), n) }, qe.prototype.mergeDeepIn = function (t) { var n = e.call(arguments, 1); return this.updateIn(t, it(), (function (e) { return "function" == typeof e.mergeDeep ? e.mergeDeep.apply(e, n) : n[n.length - 1] })) }, qe.prototype.sort = function (e) { return Vt(dn(this, e)) }, qe.prototype.sortBy = function (e, t) { return Vt(dn(this, t, e)) }, qe.prototype.withMutations = function (e) { var t = this.asMutable(); return e(t), t.wasAltered() ? t.__ensureOwner(this.__ownerID) : this }, qe.prototype.asMutable = function () { return this.__ownerID ? this : this.__ensureOwner(new x) }, qe.prototype.asImmutable = function () { return this.__ensureOwner() }, qe.prototype.wasAltered = function () { return this.__altered }, qe.prototype.__iterator = function (e, t) { return new et(this, e, t) }, qe.prototype.__iterate = function (e, t) { var n = this, r = 0; return this._root && this._root.iterate((function (t) { return r++, e(t[1], t[0], n) }), t), r }, qe.prototype.__ensureOwner = function (e) { return e === this.__ownerID ? this : e ? rt(this.size, this._root, e, this.__hash) : (this.__ownerID = e, this.__altered = !1, this) }, qe.isMap = Ye; var He, _e = "@@__IMMUTABLE_MAP__@@", Ke = qe.prototype; function Qe(e, t) { this.ownerID = e, this.entries = t } function Xe(e, t, n) { this.ownerID = e, this.bitmap = t, this.nodes = n } function Ze(e, t, n) { this.ownerID = e, this.count = t, this.nodes = n } function Je(e, t, n) { this.ownerID = e, this.keyHash = t, this.entries = n } function $e(e, t, n) { this.ownerID = e, this.keyHash = t, this.entry = n } function et(e, t, n) { this._type = t, this._reverse = n, this._stack = e._root && nt(e._root) } function tt(e, t) { return F(e, t[0], t[1]) } function nt(e, t) { return { node: e, index: 0, __prev: t } } function rt(e, t, n, r) { var i = Object.create(Ke); return i.size = e, i._root = t, i.__ownerID = n, i.__hash = r, i.__altered = !1, i } function it() { return He || (He = rt(0)) } function st(e, t, n) { var r, i; if (e._root) { var s = k(S), o = k(w); if (r = ot(e._root, e.__ownerID, 0, void 0, t, n, s, o), !o.value) return e; i = e.size + (s.value ? n === v ? -1 : 1 : 0) } else { if (n === v) return e; i = 1, r = new Qe(e.__ownerID, [[t, n]]) } return e.__ownerID ? (e.size = i, e._root = r, e.__hash = void 0, e.__altered = !0, e) : r ? rt(i, r) : it() } function ot(e, t, n, r, i, s, o, a) { return e ? e.update(t, n, r, i, s, o, a) : s === v ? e : (T(a), T(o), new $e(t, r, [i, s])) } function at(e) { return e.constructor === $e || e.constructor === Je } function lt(e, t, n, r, i) { if (e.keyHash === r) return new Je(t, r, [e.entry, i]); var s, o = (0 === n ? e.keyHash : e.keyHash >>> n) & b, a = (0 === n ? r : r >>> n) & b; return new Xe(t, 1 << o | 1 << a, o === a ? [lt(e, t, n + g, r, i)] : (s = new $e(t, r, i), o < a ? [e, s] : [s, e])) } function ct(e, t, n, r) { e || (e = new x); for (var i = new $e(e, Ie(n), [n, r]), s = 0; s < t.length; s++) { var o = t[s]; i = i.update(e, 0, void 0, o[0], o[1]) } return i } function ut(e, t, n, r) { for (var i = 0, s = 0, o = new Array(n), a = 0, l = 1, c = t.length; a < c; a++, l <<= 1) { var u = t[a]; void 0 !== u && a !== r && (i |= l, o[s++] = u) } return new Xe(e, i, o) } function dt(e, t, n, r, i) { for (var s = 0, o = new Array(y), a = 0; 0 !== n; a++, n >>>= 1)o[a] = 1 & n ? t[s++] : void 0; return o[r] = i, new Ze(e, s + 1, o) } function ht(e, t, n) { for (var i = [], s = 0; s < n.length; s++) { var a = n[s], l = r(a); o(a) || (l = l.map((function (e) { return pe(e) }))), i.push(l) } return ft(e, t, i) } function pt(e, t, n) { return e && e.mergeDeep && o(t) ? e.mergeDeep(t) : ye(e, t) ? e : t } function mt(e) { return function (t, n, r) { if (t && t.mergeDeepWith && o(n)) return t.mergeDeepWith(e, n); var i = e(t, n, r); return ye(t, i) ? t : i } } function ft(e, t, n) { return 0 === (n = n.filter((function (e) { return 0 !== e.size }))).length ? e : 0 !== e.size || e.__ownerID || 1 !== n.length ? e.withMutations((function (e) { for (var r = t ? function (n, r) { e.update(r, v, (function (e) { return e === v ? n : t(e, n, r) })) } : function (t, n) { e.set(n, t) }, i = 0; i < n.length; i++)n[i].forEach(r) })) : e.constructor(n[0]) } function gt(e, t, n, r) { var i = e === v, s = t.next(); if (s.done) { var o = i ? n : e, a = r(o); return a === o ? e : a } Se(i || e && e.set, "invalid keyPath"); var l = s.value, c = i ? v : e.get(l, v), u = gt(c, t, n, r); return u === c ? e : u === v ? e.remove(l) : (i ? it() : e).set(l, u) } function yt(e) { return e = (e = (858993459 & (e -= e >> 1 & 1431655765)) + (e >> 2 & 858993459)) + (e >> 4) & 252645135, e += e >> 8, 127 & (e += e >> 16) } function bt(e, t, n, r) { var i = r ? e : E(e); return i[t] = n, i } function vt(e, t, n, r) { var i = e.length + 1; if (r && t + 1 === i) return e[t] = n, e; for (var s = new Array(i), o = 0, a = 0; a < i; a++)a === t ? (s[a] = n, o = -1) : s[a] = e[a + o]; return s } function St(e, t, n) { var r = e.length - 1; if (n && t === r) return e.pop(), e; for (var i = new Array(r), s = 0, o = 0; o < r; o++)o === t && (s = 1), i[o] = e[o + s]; return i } Ke[_e] = !0, Ke[f] = Ke.remove, Ke.removeIn = Ke.deleteIn, Qe.prototype.get = function (e, t, n, r) { for (var i = this.entries, s = 0, o = i.length; s < o; s++)if (ye(n, i[s][0])) return i[s][1]; return r }, Qe.prototype.update = function (e, t, n, r, i, s, o) { for (var a = i === v, l = this.entries, c = 0, u = l.length; c < u && !ye(r, l[c][0]); c++); var d = c < u; if (d ? l[c][1] === i : a) return this; if (T(o), (a || !d) && T(s), !a || 1 !== l.length) { if (!d && !a && l.length >= wt) return ct(e, l, r, i); var h = e && e === this.ownerID, p = h ? l : E(l); return d ? a ? c === u - 1 ? p.pop() : p[c] = p.pop() : p[c] = [r, i] : p.push([r, i]), h ? (this.entries = p, this) : new Qe(e, p) } }, Xe.prototype.get = function (e, t, n, r) { void 0 === t && (t = Ie(n)); var i = 1 << ((0 === e ? t : t >>> e) & b), s = this.bitmap; return s & i ? this.nodes[yt(s & i - 1)].get(e + g, t, n, r) : r }, Xe.prototype.update = function (e, t, n, r, i, s, o) { void 0 === n && (n = Ie(r)); var a = (0 === t ? n : n >>> t) & b, l = 1 << a, c = this.bitmap, u = !!(c & l); if (!u && i === v) return this; var d = yt(c & l - 1), h = this.nodes, p = u ? h[d] : void 0, m = ot(p, e, t + g, n, r, i, s, o); if (m === p) return this; if (!u && m && h.length >= kt) return dt(e, h, c, a, m); if (u && !m && 2 === h.length && at(h[1 ^ d])) return h[1 ^ d]; if (u && m && 1 === h.length && at(m)) return m; var f = e && e === this.ownerID, y = u ? m ? c : c ^ l : c | l, S = u ? m ? bt(h, d, m, f) : St(h, d, f) : vt(h, d, m, f); return f ? (this.bitmap = y, this.nodes = S, this) : new Xe(e, y, S) }, Ze.prototype.get = function (e, t, n, r) { void 0 === t && (t = Ie(n)); var i = (0 === e ? t : t >>> e) & b, s = this.nodes[i]; return s ? s.get(e + g, t, n, r) : r }, Ze.prototype.update = function (e, t, n, r, i, s, o) { void 0 === n && (n = Ie(r)); var a = (0 === t ? n : n >>> t) & b, l = i === v, c = this.nodes, u = c[a]; if (l && !u) return this; var d = ot(u, e, t + g, n, r, i, s, o); if (d === u) return this; var h = this.count; if (u) { if (!d && --h < Tt) return ut(e, c, h, a) } else h++; var p = e && e === this.ownerID, m = bt(c, a, d, p); return p ? (this.count = h, this.nodes = m, this) : new Ze(e, h, m) }, Je.prototype.get = function (e, t, n, r) { for (var i = this.entries, s = 0, o = i.length; s < o; s++)if (ye(n, i[s][0])) return i[s][1]; return r }, Je.prototype.update = function (e, t, n, r, i, s, o) { void 0 === n && (n = Ie(r)); var a = i === v; if (n !== this.keyHash) return a ? this : (T(o), T(s), lt(this, e, t, n, [r, i])); for (var l = this.entries, c = 0, u = l.length; c < u && !ye(r, l[c][0]); c++); var d = c < u; if (d ? l[c][1] === i : a) return this; if (T(o), (a || !d) && T(s), a && 2 === u) return new $e(e, this.keyHash, l[1 ^ c]); var h = e && e === this.ownerID, p = h ? l : E(l); return d ? a ? c === u - 1 ? p.pop() : p[c] = p.pop() : p[c] = [r, i] : p.push([r, i]), h ? (this.entries = p, this) : new Je(e, this.keyHash, p) }, $e.prototype.get = function (e, t, n, r) { return ye(n, this.entry[0]) ? this.entry[1] : r }, $e.prototype.update = function (e, t, n, r, i, s, o) { var a = i === v, l = ye(r, this.entry[0]); return (l ? i === this.entry[1] : a) ? this : (T(o), a ? void T(s) : l ? e && e === this.ownerID ? (this.entry[1] = i, this) : new $e(e, this.keyHash, [r, i]) : (T(s), lt(this, e, t, Ie(r), [r, i]))) }, Qe.prototype.iterate = Je.prototype.iterate = function (e, t) { for (var n = this.entries, r = 0, i = n.length - 1; r <= i; r++)if (!1 === e(n[t ? i - r : r])) return !1 }, Xe.prototype.iterate = Ze.prototype.iterate = function (e, t) { for (var n = this.nodes, r = 0, i = n.length - 1; r <= i; r++) { var s = n[t ? i - r : r]; if (s && !1 === s.iterate(e, t)) return !1 } }, $e.prototype.iterate = function (e, t) { return e(this.entry) }, t(et, j), et.prototype.next = function () { for (var e = this._type, t = this._stack; t;) { var n, r = t.node, i = t.index++; if (r.entry) { if (0 === i) return tt(e, r.entry) } else if (r.entries) { if (i <= (n = r.entries.length - 1)) return tt(e, r.entries[this._reverse ? n - i : i]) } else if (i <= (n = r.nodes.length - 1)) { var s = r.nodes[this._reverse ? n - i : i]; if (s) { if (s.entry) return tt(e, s.entry); t = this._stack = nt(s, t) } continue } t = this._stack = this._stack.__prev } return W() }; var wt = y / 4, kt = y / 2, Tt = y / 4; function xt(e) { var t = Pt(); if (null == e) return t; if (Et(e)) return e; var n = i(e), r = n.size; return 0 === r ? t : (Ge(r), r > 0 && r < y ? Dt(0, r, g, null, new It(n.toArray())) : t.withMutations((function (e) { e.setSize(r), n.forEach((function (t, n) { return e.set(n, t) })) }))) } function Et(e) { return !(!e || !e[At]) } t(xt, xe), xt.of = function () { return this(arguments) }, xt.prototype.toString = function () { return this.__toString("List [", "]") }, xt.prototype.get = function (e, t) { if ((e = C(this, e)) >= 0 && e < this.size) { var n = Ut(this, e += this._origin); return n && n.array[e & b] } return t }, xt.prototype.set = function (e, t) { return Lt(this, e, t) }, xt.prototype.remove = function (e) { return this.has(e) ? 0 === e ? this.shift() : e === this.size - 1 ? this.pop() : this.splice(e, 1) : this }, xt.prototype.insert = function (e, t) { return this.splice(e, 0, t) }, xt.prototype.clear = function () { return 0 === this.size ? this : this.__ownerID ? (this.size = this._origin = this._capacity = 0, this._level = g, this._root = this._tail = null, this.__hash = void 0, this.__altered = !0, this) : Pt() }, xt.prototype.push = function () { var e = arguments, t = this.size; return this.withMutations((function (n) { jt(n, 0, t + e.length); for (var r = 0; r < e.length; r++)n.set(t + r, e[r]) })) }, xt.prototype.pop = function () { return jt(this, 0, -1) }, xt.prototype.unshift = function () { var e = arguments; return this.withMutations((function (t) { jt(t, -e.length); for (var n = 0; n < e.length; n++)t.set(n, e[n]) })) }, xt.prototype.shift = function () { return jt(this, 1) }, xt.prototype.merge = function () { return Ft(this, void 0, arguments) }, xt.prototype.mergeWith = function (t) { return Ft(this, t, e.call(arguments, 1)) }, xt.prototype.mergeDeep = function () { return Ft(this, pt, arguments) }, xt.prototype.mergeDeepWith = function (t) { var n = e.call(arguments, 1); return Ft(this, mt(t), n) }, xt.prototype.setSize = function (e) { return jt(this, 0, e) }, xt.prototype.slice = function (e, t) { var n = this.size; return O(e, t, n) ? this : jt(this, M(e, n), N(t, n)) }, xt.prototype.__iterator = function (e, t) { var n = 0, r = Rt(this, t); return new j((function () { var t = r(); return t === Nt ? W() : F(e, n++, t) })) }, xt.prototype.__iterate = function (e, t) { for (var n, r = 0, i = Rt(this, t); (n = i()) !== Nt && !1 !== e(n, r++, this);); return r }, xt.prototype.__ensureOwner = function (e) { return e === this.__ownerID ? this : e ? Dt(this._origin, this._capacity, this._level, this._root, this._tail, e, this.__hash) : (this.__ownerID = e, this) }, xt.isList = Et; var At = "@@__IMMUTABLE_LIST__@@", Ct = xt.prototype; function It(e, t) { this.array = e, this.ownerID = t } Ct[At] = !0, Ct[f] = Ct.remove, Ct.setIn = Ke.setIn, Ct.deleteIn = Ct.removeIn = Ke.removeIn, Ct.update = Ke.update, Ct.updateIn = Ke.updateIn, Ct.mergeIn = Ke.mergeIn, Ct.mergeDeepIn = Ke.mergeDeepIn, Ct.withMutations = Ke.withMutations, Ct.asMutable = Ke.asMutable, Ct.asImmutable = Ke.asImmutable, Ct.wasAltered = Ke.wasAltered, It.prototype.removeBefore = function (e, t, n) { if (n === t ? 1 << t : 0 === this.array.length) return this; var r = n >>> t & b; if (r >= this.array.length) return new It([], e); var i, s = 0 === r; if (t > 0) { var o = this.array[r]; if ((i = o && o.removeBefore(e, t - g, n)) === o && s) return this } if (s && !i) return this; var a = zt(this, e); if (!s) for (var l = 0; l < r; l++)a.array[l] = void 0; return i && (a.array[r] = i), a }, It.prototype.removeAfter = function (e, t, n) { if (n === (t ? 1 << t : 0) || 0 === this.array.length) return this; var r, i = n - 1 >>> t & b; if (i >= this.array.length) return this; if (t > 0) { var s = this.array[i]; if ((r = s && s.removeAfter(e, t - g, n)) === s && i === this.array.length - 1) return this } var o = zt(this, e); return o.array.splice(i + 1), r && (o.array[i] = r), o }; var Ot, Mt, Nt = {}; function Rt(e, t) { var n = e._origin, r = e._capacity, i = Wt(r), s = e._tail; return o(e._root, e._level, 0); function o(e, t, n) { return 0 === t ? a(e, n) : l(e, t, n) } function a(e, o) { var a = o === i ? s && s.array : e && e.array, l = o > n ? 0 : n - o, c = r - o; return c > y && (c = y), function () { if (l === c) return Nt; var e = t ? --c : l++; return a && a[e] } } function l(e, i, s) { var a, l = e && e.array, c = s > n ? 0 : n - s >> i, u = 1 + (r - s >> i); return u > y && (u = y), function () { for (; ;) { if (a) { var e = a(); if (e !== Nt) return e; a = null } if (c === u) return Nt; var n = t ? --u : c++; a = o(l && l[n], i - g, s + (n << i)) } } } } function Dt(e, t, n, r, i, s, o) { var a = Object.create(Ct); return a.size = t - e, a._origin = e, a._capacity = t, a._level = n, a._root = r, a._tail = i, a.__ownerID = s, a.__hash = o, a.__altered = !1, a } function Pt() { return Ot || (Ot = Dt(0, 0, g)) } function Lt(e, t, n) { if ((t = C(e, t)) != t) return e; if (t >= e.size || t < 0) return e.withMutations((function (e) { t < 0 ? jt(e, t).set(0, n) : jt(e, 0, t + 1).set(t, n) })); t += e._origin; var r = e._tail, i = e._root, s = k(w); return t >= Wt(e._capacity) ? r = Bt(r, e.__ownerID, 0, t, n, s) : i = Bt(i, e.__ownerID, e._level, t, n, s), s.value ? e.__ownerID ? (e._root = i, e._tail = r, e.__hash = void 0, e.__altered = !0, e) : Dt(e._origin, e._capacity, e._level, i, r) : e } function Bt(e, t, n, r, i, s) { var o, a = r >>> n & b, l = e && a < e.array.length; if (!l && void 0 === i) return e; if (n > 0) { var c = e && e.array[a], u = Bt(c, t, n - g, r, i, s); return u === c ? e : ((o = zt(e, t)).array[a] = u, o) } return l && e.array[a] === i ? e : (T(s), o = zt(e, t), void 0 === i && a === o.array.length - 1 ? o.array.pop() : o.array[a] = i, o) } function zt(e, t) { return t && e && t === e.ownerID ? e : new It(e ? e.array.slice() : [], t) } function Ut(e, t) { if (t >= Wt(e._capacity)) return e._tail; if (t < 1 << e._level + g) { for (var n = e._root, r = e._level; n && r > 0;)n = n.array[t >>> r & b], r -= g; return n } } function jt(e, t, n) { void 0 !== t && (t |= 0), void 0 !== n && (n |= 0); var r = e.__ownerID || new x, i = e._origin, s = e._capacity, o = i + t, a = void 0 === n ? s : n < 0 ? s + n : i + n; if (o === i && a === s) return e; if (o >= a) return e.clear(); for (var l = e._level, c = e._root, u = 0; o + u < 0;)c = new It(c && c.array.length ? [void 0, c] : [], r), u += 1 << (l += g); u && (o += u, i += u, a += u, s += u); for (var d = Wt(s), h = Wt(a); h >= 1 << l + g;)c = new It(c && c.array.length ? [c] : [], r), l += g; var p = e._tail, m = h < d ? Ut(e, a - 1) : h > d ? new It([], r) : p; if (p && h > d && o < s && p.array.length) { for (var f = c = zt(c, r), y = l; y > g; y -= g) { var v = d >>> y & b; f = f.array[v] = zt(f.array[v], r) } f.array[d >>> g & b] = p } if (a < s && (m = m && m.removeAfter(r, 0, a)), o >= h) o -= h, a -= h, l = g, c = null, m = m && m.removeBefore(r, 0, o); else if (o > i || h < d) { for (u = 0; c;) { var S = o >>> l & b; if (S !== h >>> l & b) break; S && (u += (1 << l) * S), l -= g, c = c.array[S] } c && o > i && (c = c.removeBefore(r, l, o - u)), c && h < d && (c = c.removeAfter(r, l, h - u)), u && (o -= u, a -= u) } return e.__ownerID ? (e.size = a - o, e._origin = o, e._capacity = a, e._level = l, e._root = c, e._tail = m, e.__hash = void 0, e.__altered = !0, e) : Dt(o, a, l, c, m) } function Ft(e, t, n) { for (var r = [], s = 0, a = 0; a < n.length; a++) { var l = n[a], c = i(l); c.size > s && (s = c.size), o(l) || (c = c.map((function (e) { return pe(e) }))), r.push(c) } return s > e.size && (e = e.setSize(s)), ft(e, t, r) } function Wt(e) { return e < y ? 0 : e - 1 >>> g << g } function Vt(e) { return null == e ? Yt() : Gt(e) ? e : Yt().withMutations((function (t) { var n = r(e); Ge(n.size), n.forEach((function (e, n) { return t.set(n, e) })) })) } function Gt(e) { return Ye(e) && u(e) } function qt(e, t, n, r) { var i = Object.create(Vt.prototype); return i.size = e ? e.size : 0, i._map = e, i._list = t, i.__ownerID = n, i.__hash = r, i } function Yt() { return Mt || (Mt = qt(it(), Pt())) } function Ht(e, t, n) { var r, i, s = e._map, o = e._list, a = s.get(t), l = void 0 !== a; if (n === v) { if (!l) return e; o.size >= y && o.size >= 2 * s.size ? (r = (i = o.filter((function (e, t) { return void 0 !== e && a !== t }))).toKeyedSeq().map((function (e) { return e[0] })).flip().toMap(), e.__ownerID && (r.__ownerID = i.__ownerID = e.__ownerID)) : (r = s.remove(t), i = a === o.size - 1 ? o.pop() : o.set(a, void 0)) } else if (l) { if (n === o.get(a)[1]) return e; r = s, i = o.set(a, [t, n]) } else r = s.set(t, o.size), i = o.set(o.size, [t, n]); return e.__ownerID ? (e.size = r.size, e._map = r, e._list = i, e.__hash = void 0, e) : qt(r, i) } function _t(e, t) { this._iter = e, this._useKeys = t, this.size = e.size } function Kt(e) { this._iter = e, this.size = e.size } function Qt(e) { this._iter = e, this.size = e.size } function Xt(e) { this._iter = e, this.size = e.size } function Zt(e) { var t = vn(e); return t._iter = e, t.size = e.size, t.flip = function () { return e }, t.reverse = function () { var t = e.reverse.apply(this); return t.flip = function () { return e.reverse() }, t }, t.has = function (t) { return e.includes(t) }, t.includes = function (t) { return e.has(t) }, t.cacheResult = Sn, t.__iterateUncached = function (t, n) { var r = this; return e.__iterate((function (e, n) { return !1 !== t(n, e, r) }), n) }, t.__iteratorUncached = function (t, n) { if (t === L) { var r = e.__iterator(t, n); return new j((function () { var e = r.next(); if (!e.done) { var t = e.value[0]; e.value[0] = e.value[1], e.value[1] = t } return e })) } return e.__iterator(t === P ? D : P, n) }, t } function Jt(e, t, n) { var r = vn(e); return r.size = e.size, r.has = function (t) { return e.has(t) }, r.get = function (r, i) { var s = e.get(r, v); return s === v ? i : t.call(n, s, r, e) }, r.__iterateUncached = function (r, i) { var s = this; return e.__iterate((function (e, i, o) { return !1 !== r(t.call(n, e, i, o), i, s) }), i) }, r.__iteratorUncached = function (r, i) { var s = e.__iterator(L, i); return new j((function () { var i = s.next(); if (i.done) return i; var o = i.value, a = o[0]; return F(r, a, t.call(n, o[1], a, e), i) })) }, r } function $t(e, t) { var n = vn(e); return n._iter = e, n.size = e.size, n.reverse = function () { return e }, e.flip && (n.flip = function () { var t = Zt(e); return t.reverse = function () { return e.flip() }, t }), n.get = function (n, r) { return e.get(t ? n : -1 - n, r) }, n.has = function (n) { return e.has(t ? n : -1 - n) }, n.includes = function (t) { return e.includes(t) }, n.cacheResult = Sn, n.__iterate = function (t, n) { var r = this; return e.__iterate((function (e, n) { return t(e, n, r) }), !n) }, n.__iterator = function (t, n) { return e.__iterator(t, !n) }, n } function en(e, t, n, r) { var i = vn(e); return r && (i.has = function (r) { var i = e.get(r, v); return i !== v && !!t.call(n, i, r, e) }, i.get = function (r, i) { var s = e.get(r, v); return s !== v && t.call(n, s, r, e) ? s : i }), i.__iterateUncached = function (i, s) { var o = this, a = 0; return e.__iterate((function (e, s, l) { if (t.call(n, e, s, l)) return a++, i(e, r ? s : a - 1, o) }), s), a }, i.__iteratorUncached = function (i, s) { var o = e.__iterator(L, s), a = 0; return new j((function () { for (; ;) { var s = o.next(); if (s.done) return s; var l = s.value, c = l[0], u = l[1]; if (t.call(n, u, c, e)) return F(i, r ? c : a++, u, s) } })) }, i } function tn(e, t, n) { var r = qe().asMutable(); return e.__iterate((function (i, s) { r.update(t.call(n, i, s, e), 0, (function (e) { return e + 1 })) })), r.asImmutable() } function nn(e, t, n) { var r = a(e), i = (u(e) ? Vt() : qe()).asMutable(); e.__iterate((function (s, o) { i.update(t.call(n, s, o, e), (function (e) { return (e = e || []).push(r ? [o, s] : s), e })) })); var s = bn(e); return i.map((function (t) { return fn(e, s(t)) })) } function rn(e, t, n, r) { var i = e.size; if (void 0 !== t && (t |= 0), void 0 !== n && (n === 1 / 0 ? n = i : n |= 0), O(t, n, i)) return e; var s = M(t, i), o = N(n, i); if (s != s || o != o) return rn(e.toSeq().cacheResult(), t, n, r); var a, l = o - s; l == l && (a = l < 0 ? 0 : l); var c = vn(e); return c.size = 0 === a ? a : e.size && a || void 0, !r && se(e) && a >= 0 && (c.get = function (t, n) { return (t = C(this, t)) >= 0 && t < a ? e.get(t + s, n) : n }), c.__iterateUncached = function (t, n) { var i = this; if (0 === a) return 0; if (n) return this.cacheResult().__iterate(t, n); var o = 0, l = !0, c = 0; return e.__iterate((function (e, n) { if (!l || !(l = o++ < s)) return c++, !1 !== t(e, r ? n : c - 1, i) && c !== a })), c }, c.__iteratorUncached = function (t, n) { if (0 !== a && n) return this.cacheResult().__iterator(t, n); var i = 0 !== a && e.__iterator(t, n), o = 0, l = 0; return new j((function () { for (; o++ < s;)i.next(); if (++l > a) return W(); var e = i.next(); return r || t === P ? e : F(t, l - 1, t === D ? void 0 : e.value[1], e) })) }, c } function sn(e, t, n) { var r = vn(e); return r.__iterateUncached = function (r, i) { var s = this; if (i) return this.cacheResult().__iterate(r, i); var o = 0; return e.__iterate((function (e, i, a) { return t.call(n, e, i, a) && ++o && r(e, i, s) })), o }, r.__iteratorUncached = function (r, i) { var s = this; if (i) return this.cacheResult().__iterator(r, i); var o = e.__iterator(L, i), a = !0; return new j((function () { if (!a) return W(); var e = o.next(); if (e.done) return e; var i = e.value, l = i[0], c = i[1]; return t.call(n, c, l, s) ? r === L ? e : F(r, l, c, e) : (a = !1, W()) })) }, r } function on(e, t, n, r) { var i = vn(e); return i.__iterateUncached = function (i, s) { var o = this; if (s) return this.cacheResult().__iterate(i, s); var a = !0, l = 0; return e.__iterate((function (e, s, c) { if (!a || !(a = t.call(n, e, s, c))) return l++, i(e, r ? s : l - 1, o) })), l }, i.__iteratorUncached = function (i, s) { var o = this; if (s) return this.cacheResult().__iterator(i, s); var a = e.__iterator(L, s), l = !0, c = 0; return new j((function () { var e, s, u; do { if ((e = a.next()).done) return r || i === P ? e : F(i, c++, i === D ? void 0 : e.value[1], e); var d = e.value; s = d[0], u = d[1], l && (l = t.call(n, u, s, o)) } while (l); return i === L ? e : F(i, s, u, e) })) }, i } function an(e, t) { var n = a(e), i = [e].concat(t).map((function (e) { return o(e) ? n && (e = r(e)) : e = n ? ae(e) : le(Array.isArray(e) ? e : [e]), e })).filter((function (e) { return 0 !== e.size })); if (0 === i.length) return e; if (1 === i.length) { var s = i[0]; if (s === e || n && a(s) || l(e) && l(s)) return s } var c = new te(i); return n ? c = c.toKeyedSeq() : l(e) || (c = c.toSetSeq()), (c = c.flatten(!0)).size = i.reduce((function (e, t) { if (void 0 !== e) { var n = t.size; if (void 0 !== n) return e + n } }), 0), c } function ln(e, t, n) { var r = vn(e); return r.__iterateUncached = function (r, i) { var s = 0, a = !1; function l(e, c) { var u = this; e.__iterate((function (e, i) { return (!t || c < t) && o(e) ? l(e, c + 1) : !1 === r(e, n ? i : s++, u) && (a = !0), !a }), i) } return l(e, 0), s }, r.__iteratorUncached = function (r, i) { var s = e.__iterator(r, i), a = [], l = 0; return new j((function () { for (; s;) { var e = s.next(); if (!1 === e.done) { var c = e.value; if (r === L && (c = c[1]), t && !(a.length < t) || !o(c)) return n ? e : F(r, l++, c, e); a.push(s), s = c.__iterator(r, i) } else s = a.pop() } return W() })) }, r } function cn(e, t, n) { var r = bn(e); return e.toSeq().map((function (i, s) { return r(t.call(n, i, s, e)) })).flatten(!0) } function un(e, t) { var n = vn(e); return n.size = e.size && 2 * e.size - 1, n.__iterateUncached = function (n, r) { var i = this, s = 0; return e.__iterate((function (e, r) { return (!s || !1 !== n(t, s++, i)) && !1 !== n(e, s++, i) }), r), s }, n.__iteratorUncached = function (n, r) { var i, s = e.__iterator(P, r), o = 0; return new j((function () { return (!i || o % 2) && (i = s.next()).done ? i : o % 2 ? F(n, o++, t) : F(n, o++, i.value, i) })) }, n } function dn(e, t, n) { t || (t = wn); var r = a(e), i = 0, s = e.toSeq().map((function (t, r) { return [r, t, i++, n ? n(t, r, e) : t] })).toArray(); return s.sort((function (e, n) { return t(e[3], n[3]) || e[2] - n[2] })).forEach(r ? function (e, t) { s[t].length = 2 } : function (e, t) { s[t] = e[1] }), r ? K(s) : l(e) ? Q(s) : X(s) } function hn(e, t, n) { if (t || (t = wn), n) { var r = e.toSeq().map((function (t, r) { return [t, n(t, r, e)] })).reduce((function (e, n) { return pn(t, e[1], n[1]) ? n : e })); return r && r[0] } return e.reduce((function (e, n) { return pn(t, e, n) ? n : e })) } function pn(e, t, n) { var r = e(n, t); return 0 === r && n !== t && (null == n || n != n) || r > 0 } function mn(e, t, r) { var i = vn(e); return i.size = new te(r).map((function (e) { return e.size })).min(), i.__iterate = function (e, t) { for (var n, r = this.__iterator(P, t), i = 0; !(n = r.next()).done && !1 !== e(n.value, i++, this);); return i }, i.__iteratorUncached = function (e, i) { var s = r.map((function (e) { return e = n(e), q(i ? e.reverse() : e) })), o = 0, a = !1; return new j((function () { var n; return a || (n = s.map((function (e) { return e.next() })), a = n.some((function (e) { return e.done }))), a ? W() : F(e, o++, t.apply(null, n.map((function (e) { return e.value })))) })) }, i } function fn(e, t) { return se(e) ? t : e.constructor(t) } function gn(e) { if (e !== Object(e)) throw new TypeError("Expected [K, V] tuple: " + e) } function yn(e) { return Ge(e.size), A(e) } function bn(e) { return a(e) ? r : l(e) ? i : s } function vn(e) { return Object.create((a(e) ? K : l(e) ? Q : X).prototype) } function Sn() { return this._iter.cacheResult ? (this._iter.cacheResult(), this.size = this._iter.size, this) : _.prototype.cacheResult.call(this) } function wn(e, t) { return e > t ? 1 : e < t ? -1 : 0 } function kn(e) { var t = q(e); if (!t) { if (!H(e)) throw new TypeError("Expected iterable or array-like: " + e); t = q(n(e)) } return t } function Tn(e, t) { var n, r = function (s) { if (s instanceof r) return s; if (!(this instanceof r)) return new r(s); if (!n) { n = !0; var o = Object.keys(e); Cn(i, o), i.size = o.length, i._name = t, i._keys = o, i._defaultValues = e } this._map = qe(s) }, i = r.prototype = Object.create(xn); return i.constructor = r, r } t(Vt, qe), Vt.of = function () { return this(arguments) }, Vt.prototype.toString = function () { return this.__toString("OrderedMap {", "}") }, Vt.prototype.get = function (e, t) { var n = this._map.get(e); return void 0 !== n ? this._list.get(n)[1] : t }, Vt.prototype.clear = function () { return 0 === this.size ? this : this.__ownerID ? (this.size = 0, this._map.clear(), this._list.clear(), this) : Yt() }, Vt.prototype.set = function (e, t) { return Ht(this, e, t) }, Vt.prototype.remove = function (e) { return Ht(this, e, v) }, Vt.prototype.wasAltered = function () { return this._map.wasAltered() || this._list.wasAltered() }, Vt.prototype.__iterate = function (e, t) { var n = this; return this._list.__iterate((function (t) { return t && e(t[1], t[0], n) }), t) }, Vt.prototype.__iterator = function (e, t) { return this._list.fromEntrySeq().__iterator(e, t) }, Vt.prototype.__ensureOwner = function (e) { if (e === this.__ownerID) return this; var t = this._map.__ensureOwner(e), n = this._list.__ensureOwner(e); return e ? qt(t, n, e, this.__hash) : (this.__ownerID = e, this._map = t, this._list = n, this) }, Vt.isOrderedMap = Gt, Vt.prototype[m] = !0, Vt.prototype[f] = Vt.prototype.remove, t(_t, K), _t.prototype.get = function (e, t) { return this._iter.get(e, t) }, _t.prototype.has = function (e) { return this._iter.has(e) }, _t.prototype.valueSeq = function () { return this._iter.valueSeq() }, _t.prototype.reverse = function () { var e = this, t = $t(this, !0); return this._useKeys || (t.valueSeq = function () { return e._iter.toSeq().reverse() }), t }, _t.prototype.map = function (e, t) { var n = this, r = Jt(this, e, t); return this._useKeys || (r.valueSeq = function () { return n._iter.toSeq().map(e, t) }), r }, _t.prototype.__iterate = function (e, t) { var n, r = this; return this._iter.__iterate(this._useKeys ? function (t, n) { return e(t, n, r) } : (n = t ? yn(this) : 0, function (i) { return e(i, t ? --n : n++, r) }), t) }, _t.prototype.__iterator = function (e, t) { if (this._useKeys) return this._iter.__iterator(e, t); var n = this._iter.__iterator(P, t), r = t ? yn(this) : 0; return new j((function () { var i = n.next(); return i.done ? i : F(e, t ? --r : r++, i.value, i) })) }, _t.prototype[m] = !0, t(Kt, Q), Kt.prototype.includes = function (e) { return this._iter.includes(e) }, Kt.prototype.__iterate = function (e, t) { var n = this, r = 0; return this._iter.__iterate((function (t) { return e(t, r++, n) }), t) }, Kt.prototype.__iterator = function (e, t) { var n = this._iter.__iterator(P, t), r = 0; return new j((function () { var t = n.next(); return t.done ? t : F(e, r++, t.value, t) })) }, t(Qt, X), Qt.prototype.has = function (e) { return this._iter.includes(e) }, Qt.prototype.__iterate = function (e, t) { var n = this; return this._iter.__iterate((function (t) { return e(t, t, n) }), t) }, Qt.prototype.__iterator = function (e, t) { var n = this._iter.__iterator(P, t); return new j((function () { var t = n.next(); return t.done ? t : F(e, t.value, t.value, t) })) }, t(Xt, K), Xt.prototype.entrySeq = function () { return this._iter.toSeq() }, Xt.prototype.__iterate = function (e, t) { var n = this; return this._iter.__iterate((function (t) { if (t) { gn(t); var r = o(t); return e(r ? t.get(1) : t[1], r ? t.get(0) : t[0], n) } }), t) }, Xt.prototype.__iterator = function (e, t) { var n = this._iter.__iterator(P, t); return new j((function () { for (; ;) { var t = n.next(); if (t.done) return t; var r = t.value; if (r) { gn(r); var i = o(r); return F(e, i ? r.get(0) : r[0], i ? r.get(1) : r[1], t) } } })) }, Kt.prototype.cacheResult = _t.prototype.cacheResult = Qt.prototype.cacheResult = Xt.prototype.cacheResult = Sn, t(Tn, Te), Tn.prototype.toString = function () { return this.__toString(An(this) + " {", "}") }, Tn.prototype.has = function (e) { return this._defaultValues.hasOwnProperty(e) }, Tn.prototype.get = function (e, t) { if (!this.has(e)) return t; var n = this._defaultValues[e]; return this._map ? this._map.get(e, n) : n }, Tn.prototype.clear = function () { if (this.__ownerID) return this._map && this._map.clear(), this; var e = this.constructor; return e._empty || (e._empty = En(this, it())) }, Tn.prototype.set = function (e, t) { if (!this.has(e)) throw new Error('Cannot set unknown key "' + e + '" on ' + An(this)); if (this._map && !this._map.has(e) && t === this._defaultValues[e]) return this; var n = this._map && this._map.set(e, t); return this.__ownerID || n === this._map ? this : En(this, n) }, Tn.prototype.remove = function (e) { if (!this.has(e)) return this; var t = this._map && this._map.remove(e); return this.__ownerID || t === this._map ? this : En(this, t) }, Tn.prototype.wasAltered = function () { return this._map.wasAltered() }, Tn.prototype.__iterator = function (e, t) { var n = this; return r(this._defaultValues).map((function (e, t) { return n.get(t) })).__iterator(e, t) }, Tn.prototype.__iterate = function (e, t) { var n = this; return r(this._defaultValues).map((function (e, t) { return n.get(t) })).__iterate(e, t) }, Tn.prototype.__ensureOwner = function (e) { if (e === this.__ownerID) return this; var t = this._map && this._map.__ensureOwner(e); return e ? En(this, t, e) : (this.__ownerID = e, this._map = t, this) }; var xn = Tn.prototype; function En(e, t, n) { var r = Object.create(Object.getPrototypeOf(e)); return r._map = t, r.__ownerID = n, r } function An(e) { return e._name || e.constructor.name || "Record" } function Cn(e, t) { try { t.forEach(In.bind(void 0, e)) } catch (e) { } } function In(e, t) { Object.defineProperty(e, t, { get: function () { return this.get(t) }, set: function (e) { Se(this.__ownerID, "Cannot set on an immutable record."), this.set(t, e) } }) } function On(e) { return null == e ? Bn() : Mn(e) && !u(e) ? e : Bn().withMutations((function (t) { var n = s(e); Ge(n.size), n.forEach((function (e) { return t.add(e) })) })) } function Mn(e) { return !(!e || !e[Rn]) } xn[f] = xn.remove, xn.deleteIn = xn.removeIn = Ke.removeIn, xn.merge = Ke.merge, xn.mergeWith = Ke.mergeWith, xn.mergeIn = Ke.mergeIn, xn.mergeDeep = Ke.mergeDeep, xn.mergeDeepWith = Ke.mergeDeepWith, xn.mergeDeepIn = Ke.mergeDeepIn, xn.setIn = Ke.setIn, xn.update = Ke.update, xn.updateIn = Ke.updateIn, xn.withMutations = Ke.withMutations, xn.asMutable = Ke.asMutable, xn.asImmutable = Ke.asImmutable, t(On, Ee), On.of = function () { return this(arguments) }, On.fromKeys = function (e) { return this(r(e).keySeq()) }, On.prototype.toString = function () { return this.__toString("Set {", "}") }, On.prototype.has = function (e) { return this._map.has(e) }, On.prototype.add = function (e) { return Pn(this, this._map.set(e, !0)) }, On.prototype.remove = function (e) { return Pn(this, this._map.remove(e)) }, On.prototype.clear = function () { return Pn(this, this._map.clear()) }, On.prototype.union = function () { var t = e.call(arguments, 0); return 0 === (t = t.filter((function (e) { return 0 !== e.size }))).length ? this : 0 !== this.size || this.__ownerID || 1 !== t.length ? this.withMutations((function (e) { for (var n = 0; n < t.length; n++)s(t[n]).forEach((function (t) { return e.add(t) })) })) : this.constructor(t[0]) }, On.prototype.intersect = function () { var t = e.call(arguments, 0); if (0 === t.length) return this; t = t.map((function (e) { return s(e) })); var n = this; return this.withMutations((function (e) { n.forEach((function (n) { t.every((function (e) { return e.includes(n) })) || e.remove(n) })) })) }, On.prototype.subtract = function () { var t = e.call(arguments, 0); if (0 === t.length) return this; t = t.map((function (e) { return s(e) })); var n = this; return this.withMutations((function (e) { n.forEach((function (n) { t.some((function (e) { return e.includes(n) })) && e.remove(n) })) })) }, On.prototype.merge = function () { return this.union.apply(this, arguments) }, On.prototype.mergeWith = function (t) { var n = e.call(arguments, 1); return this.union.apply(this, n) }, On.prototype.sort = function (e) { return zn(dn(this, e)) }, On.prototype.sortBy = function (e, t) { return zn(dn(this, t, e)) }, On.prototype.wasAltered = function () { return this._map.wasAltered() }, On.prototype.__iterate = function (e, t) { var n = this; return this._map.__iterate((function (t, r) { return e(r, r, n) }), t) }, On.prototype.__iterator = function (e, t) { return this._map.map((function (e, t) { return t })).__iterator(e, t) }, On.prototype.__ensureOwner = function (e) { if (e === this.__ownerID) return this; var t = this._map.__ensureOwner(e); return e ? this.__make(t, e) : (this.__ownerID = e, this._map = t, this) }, On.isSet = Mn; var Nn, Rn = "@@__IMMUTABLE_SET__@@", Dn = On.prototype; function Pn(e, t) { return e.__ownerID ? (e.size = t.size, e._map = t, e) : t === e._map ? e : 0 === t.size ? e.__empty() : e.__make(t) } function Ln(e, t) { var n = Object.create(Dn); return n.size = e ? e.size : 0, n._map = e, n.__ownerID = t, n } function Bn() { return Nn || (Nn = Ln(it())) } function zn(e) { return null == e ? Vn() : Un(e) ? e : Vn().withMutations((function (t) { var n = s(e); Ge(n.size), n.forEach((function (e) { return t.add(e) })) })) } function Un(e) { return Mn(e) && u(e) } Dn[Rn] = !0, Dn[f] = Dn.remove, Dn.mergeDeep = Dn.merge, Dn.mergeDeepWith = Dn.mergeWith, Dn.withMutations = Ke.withMutations, Dn.asMutable = Ke.asMutable, Dn.asImmutable = Ke.asImmutable, Dn.__empty = Bn, Dn.__make = Ln, t(zn, On), zn.of = function () { return this(arguments) }, zn.fromKeys = function (e) { return this(r(e).keySeq()) }, zn.prototype.toString = function () { return this.__toString("OrderedSet {", "}") }, zn.isOrderedSet = Un; var jn, Fn = zn.prototype; function Wn(e, t) { var n = Object.create(Fn); return n.size = e ? e.size : 0, n._map = e, n.__ownerID = t, n } function Vn() { return jn || (jn = Wn(Yt())) } function Gn(e) { return null == e ? Qn() : qn(e) ? e : Qn().unshiftAll(e) } function qn(e) { return !(!e || !e[Hn]) } Fn[m] = !0, Fn.__empty = Vn, Fn.__make = Wn, t(Gn, xe), Gn.of = function () { return this(arguments) }, Gn.prototype.toString = function () { return this.__toString("Stack [", "]") }, Gn.prototype.get = function (e, t) { var n = this._head; for (e = C(this, e); n && e--;)n = n.next; return n ? n.value : t }, Gn.prototype.peek = function () { return this._head && this._head.value }, Gn.prototype.push = function () { if (0 === arguments.length) return this; for (var e = this.size + arguments.length, t = this._head, n = arguments.length - 1; n >= 0; n--)t = { value: arguments[n], next: t }; return this.__ownerID ? (this.size = e, this._head = t, this.__hash = void 0, this.__altered = !0, this) : Kn(e, t) }, Gn.prototype.pushAll = function (e) { if (0 === (e = i(e)).size) return this; Ge(e.size); var t = this.size, n = this._head; return e.reverse().forEach((function (e) { t++, n = { value: e, next: n } })), this.__ownerID ? (this.size = t, this._head = n, this.__hash = void 0, this.__altered = !0, this) : Kn(t, n) }, Gn.prototype.pop = function () { return this.slice(1) }, Gn.prototype.unshift = function () { return this.push.apply(this, arguments) }, Gn.prototype.unshiftAll = function (e) { return this.pushAll(e) }, Gn.prototype.shift = function () { return this.pop.apply(this, arguments) }, Gn.prototype.clear = function () { return 0 === this.size ? this : this.__ownerID ? (this.size = 0, this._head = void 0, this.__hash = void 0, this.__altered = !0, this) : Qn() }, Gn.prototype.slice = function (e, t) { if (O(e, t, this.size)) return this; var n = M(e, this.size); if (N(t, this.size) !== this.size) return xe.prototype.slice.call(this, e, t); for (var r = this.size - n, i = this._head; n--;)i = i.next; return this.__ownerID ? (this.size = r, this._head = i, this.__hash = void 0, this.__altered = !0, this) : Kn(r, i) }, Gn.prototype.__ensureOwner = function (e) { return e === this.__ownerID ? this : e ? Kn(this.size, this._head, e, this.__hash) : (this.__ownerID = e, this.__altered = !1, this) }, Gn.prototype.__iterate = function (e, t) { if (t) return this.reverse().__iterate(e); for (var n = 0, r = this._head; r && !1 !== e(r.value, n++, this);)r = r.next; return n }, Gn.prototype.__iterator = function (e, t) { if (t) return this.reverse().__iterator(e); var n = 0, r = this._head; return new j((function () { if (r) { var t = r.value; return r = r.next, F(e, n++, t) } return W() })) }, Gn.isStack = qn; var Yn, Hn = "@@__IMMUTABLE_STACK__@@", _n = Gn.prototype; function Kn(e, t, n, r) { var i = Object.create(_n); return i.size = e, i._head = t, i.__ownerID = n, i.__hash = r, i.__altered = !1, i } function Qn() { return Yn || (Yn = Kn(0)) } function Xn(e, t) { var n = function (n) { e.prototype[n] = t[n] }; return Object.keys(t).forEach(n), Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(t).forEach(n), e } _n[Hn] = !0, _n.withMutations = Ke.withMutations, _n.asMutable = Ke.asMutable, _n.asImmutable = Ke.asImmutable, _n.wasAltered = Ke.wasAltered, n.Iterator = j, Xn(n, { toArray: function () { Ge(this.size); var e = new Array(this.size || 0); return this.valueSeq().__iterate((function (t, n) { e[n] = t })), e }, toIndexedSeq: function () { return new Kt(this) }, toJS: function () { return this.toSeq().map((function (e) { return e && "function" == typeof e.toJS ? e.toJS() : e })).__toJS() }, toJSON: function () { return this.toSeq().map((function (e) { return e && "function" == typeof e.toJSON ? e.toJSON() : e })).__toJS() }, toKeyedSeq: function () { return new _t(this, !0) }, toMap: function () { return qe(this.toKeyedSeq()) }, toObject: function () { Ge(this.size); var e = {}; return this.__iterate((function (t, n) { e[n] = t })), e }, toOrderedMap: function () { return Vt(this.toKeyedSeq()) }, toOrderedSet: function () { return zn(a(this) ? this.valueSeq() : this) }, toSet: function () { return On(a(this) ? this.valueSeq() : this) }, toSetSeq: function () { return new Qt(this) }, toSeq: function () { return l(this) ? this.toIndexedSeq() : a(this) ? this.toKeyedSeq() : this.toSetSeq() }, toStack: function () { return Gn(a(this) ? this.valueSeq() : this) }, toList: function () { return xt(a(this) ? this.valueSeq() : this) }, toString: function () { return "[Iterable]" }, __toString: function (e, t) { return 0 === this.size ? e + t : e + " " + this.toSeq().map(this.__toStringMapper).join(", ") + " " + t }, concat: function () { return fn(this, an(this, e.call(arguments, 0))) }, includes: function (e) { return this.some((function (t) { return ye(t, e) })) }, entries: function () { return this.__iterator(L) }, every: function (e, t) { Ge(this.size); var n = !0; return this.__iterate((function (r, i, s) { if (!e.call(t, r, i, s)) return n = !1, !1 })), n }, filter: function (e, t) { return fn(this, en(this, e, t, !0)) }, find: function (e, t, n) { var r = this.findEntry(e, t); return r ? r[1] : n }, forEach: function (e, t) { return Ge(this.size), this.__iterate(t ? e.bind(t) : e) }, join: function (e) { Ge(this.size), e = void 0 !== e ? "" + e : ","; var t = "", n = !0; return this.__iterate((function (r) { n ? n = !1 : t += e, t += null != r ? r.toString() : "" })), t }, keys: function () { return this.__iterator(D) }, map: function (e, t) { return fn(this, Jt(this, e, t)) }, reduce: function (e, t, n) { var r, i; return Ge(this.size), arguments.length < 2 ? i = !0 : r = t, this.__iterate((function (t, s, o) { i ? (i = !1, r = t) : r = e.call(n, r, t, s, o) })), r }, reduceRight: function (e, t, n) { var r = this.toKeyedSeq().reverse(); return r.reduce.apply(r, arguments) }, reverse: function () { return fn(this, $t(this, !0)) }, slice: function (e, t) { return fn(this, rn(this, e, t, !0)) }, some: function (e, t) { return !this.every(tr(e), t) }, sort: function (e) { return fn(this, dn(this, e)) }, values: function () { return this.__iterator(P) }, butLast: function () { return this.slice(0, -1) }, isEmpty: function () { return void 0 !== this.size ? 0 === this.size : !this.some((function () { return !0 })) }, count: function (e, t) { return A(e ? this.toSeq().filter(e, t) : this) }, countBy: function (e, t) { return tn(this, e, t) }, equals: function (e) { return be(this, e) }, entrySeq: function () { var e = this; if (e._cache) return new te(e._cache); var t = e.toSeq().map(er).toIndexedSeq(); return t.fromEntrySeq = function () { return e.toSeq() }, t }, filterNot: function (e, t) { return this.filter(tr(e), t) }, findEntry: function (e, t, n) { var r = n; return this.__iterate((function (n, i, s) { if (e.call(t, n, i, s)) return r = [i, n], !1 })), r }, findKey: function (e, t) { var n = this.findEntry(e, t); return n && n[0] }, findLast: function (e, t, n) { return this.toKeyedSeq().reverse().find(e, t, n) }, findLastEntry: function (e, t, n) { return this.toKeyedSeq().reverse().findEntry(e, t, n) }, findLastKey: function (e, t) { return this.toKeyedSeq().reverse().findKey(e, t) }, first: function () { return this.find(I) }, flatMap: function (e, t) { return fn(this, cn(this, e, t)) }, flatten: function (e) { return fn(this, ln(this, e, !0)) }, fromEntrySeq: function () { return new Xt(this) }, get: function (e, t) { return this.find((function (t, n) { return ye(n, e) }), void 0, t) }, getIn: function (e, t) { for (var n, r = this, i = kn(e); !(n = i.next()).done;) { var s = n.value; if ((r = r && r.get ? r.get(s, v) : v) === v) return t } return r }, groupBy: function (e, t) { return nn(this, e, t) }, has: function (e) { return this.get(e, v) !== v }, hasIn: function (e) { return this.getIn(e, v) !== v }, isSubset: function (e) { return e = "function" == typeof e.includes ? e : n(e), this.every((function (t) { return e.includes(t) })) }, isSuperset: function (e) { return (e = "function" == typeof e.isSubset ? e : n(e)).isSubset(this) }, keyOf: function (e) { return this.findKey((function (t) { return ye(t, e) })) }, keySeq: function () { return this.toSeq().map($n).toIndexedSeq() }, last: function () { return this.toSeq().reverse().first() }, lastKeyOf: function (e) { return this.toKeyedSeq().reverse().keyOf(e) }, max: function (e) { return hn(this, e) }, maxBy: function (e, t) { return hn(this, t, e) }, min: function (e) { return hn(this, e ? nr(e) : sr) }, minBy: function (e, t) { return hn(this, t ? nr(t) : sr, e) }, rest: function () { return this.slice(1) }, skip: function (e) { return this.slice(Math.max(0, e)) }, skipLast: function (e) { return fn(this, this.toSeq().reverse().skip(e).reverse()) }, skipWhile: function (e, t) { return fn(this, on(this, e, t, !0)) }, skipUntil: function (e, t) { return this.skipWhile(tr(e), t) }, sortBy: function (e, t) { return fn(this, dn(this, t, e)) }, take: function (e) { return this.slice(0, Math.max(0, e)) }, takeLast: function (e) { return fn(this, this.toSeq().reverse().take(e).reverse()) }, takeWhile: function (e, t) { return fn(this, sn(this, e, t)) }, takeUntil: function (e, t) { return this.takeWhile(tr(e), t) }, valueSeq: function () { return this.toIndexedSeq() }, hashCode: function () { return this.__hash || (this.__hash = or(this)) } }); var Zn = n.prototype; Zn[d] = !0, Zn[U] = Zn.values, Zn.__toJS = Zn.toArray, Zn.__toStringMapper = rr, Zn.inspect = Zn.toSource = function () { return this.toString() }, Zn.chain = Zn.flatMap, Zn.contains = Zn.includes, Xn(r, { flip: function () { return fn(this, Zt(this)) }, mapEntries: function (e, t) { var n = this, r = 0; return fn(this, this.toSeq().map((function (i, s) { return e.call(t, [s, i], r++, n) })).fromEntrySeq()) }, mapKeys: function (e, t) { var n = this; return fn(this, this.toSeq().flip().map((function (r, i) { return e.call(t, r, i, n) })).flip()) } }); var Jn = r.prototype; function $n(e, t) { return t } function er(e, t) { return [t, e] } function tr(e) { return function () { return !e.apply(this, arguments) } } function nr(e) { return function () { return -e.apply(this, arguments) } } function rr(e) { return "string" == typeof e ? JSON.stringify(e) : String(e) } function ir() { return E(arguments) } function sr(e, t) { return e < t ? 1 : e > t ? -1 : 0 } function or(e) { if (e.size === 1 / 0) return 0; var t = u(e), n = a(e), r = t ? 1 : 0; return ar(e.__iterate(n ? t ? function (e, t) { r = 31 * r + lr(Ie(e), Ie(t)) | 0 } : function (e, t) { r = r + lr(Ie(e), Ie(t)) | 0 } : t ? function (e) { r = 31 * r + Ie(e) | 0 } : function (e) { r = r + Ie(e) | 0 }), r) } function ar(e, t) { return t = Ae(t, 3432918353), t = Ae(t << 15 | t >>> -15, 461845907), t = Ae(t << 13 | t >>> -13, 5), t = Ae((t = t + 3864292196 ^ e) ^ t >>> 16, 2246822507), t = Ce((t = Ae(t ^ t >>> 13, 3266489909)) ^ t >>> 16) } function lr(e, t) { return e ^ t + 2654435769 + (e << 6) + (e >> 2) } return Jn[h] = !0, Jn[U] = Zn.entries, Jn.__toJS = Zn.toObject, Jn.__toStringMapper = function (e, t) { return JSON.stringify(t) + ": " + rr(e) }, Xn(i, { toKeyedSeq: function () { return new _t(this, !1) }, filter: function (e, t) { return fn(this, en(this, e, t, !1)) }, findIndex: function (e, t) { var n = this.findEntry(e, t); return n ? n[0] : -1 }, indexOf: function (e) { var t = this.keyOf(e); return void 0 === t ? -1 : t }, lastIndexOf: function (e) { var t = this.lastKeyOf(e); return void 0 === t ? -1 : t }, reverse: function () { return fn(this, $t(this, !1)) }, slice: function (e, t) { return fn(this, rn(this, e, t, !1)) }, splice: function (e, t) { var n = arguments.length; if (t = Math.max(0 | t, 0), 0 === n || 2 === n && !t) return this; e = M(e, e < 0 ? this.count() : this.size); var r = this.slice(0, e); return fn(this, 1 === n ? r : r.concat(E(arguments, 2), this.slice(e + t))) }, findLastIndex: function (e, t) { var n = this.findLastEntry(e, t); return n ? n[0] : -1 }, first: function () { return this.get(0) }, flatten: function (e) { return fn(this, ln(this, e, !1)) }, get: function (e, t) { return (e = C(this, e)) < 0 || this.size === 1 / 0 || void 0 !== this.size && e > this.size ? t : this.find((function (t, n) { return n === e }), void 0, t) }, has: function (e) { return (e = C(this, e)) >= 0 && (void 0 !== this.size ? this.size === 1 / 0 || e < this.size : -1 !== this.indexOf(e)) }, interpose: function (e) { return fn(this, un(this, e)) }, interleave: function () { var e = [this].concat(E(arguments)), t = mn(this.toSeq(), Q.of, e), n = t.flatten(!0); return t.size && (n.size = t.size * e.length), fn(this, n) }, keySeq: function () { return we(0, this.size) }, last: function () { return this.get(-1) }, skipWhile: function (e, t) { return fn(this, on(this, e, t, !1)) }, zip: function () { return fn(this, mn(this, ir, [this].concat(E(arguments)))) }, zipWith: function (e) { var t = E(arguments); return t[0] = this, fn(this, mn(this, e, t)) } }), i.prototype[p] = !0, i.prototype[m] = !0, Xn(s, { get: function (e, t) { return this.has(e) ? e : t }, includes: function (e) { return this.has(e) }, keySeq: function () { return this.valueSeq() } }), s.prototype.has = Zn.includes, s.prototype.contains = s.prototype.includes, Xn(K, r.prototype), Xn(Q, i.prototype), Xn(X, s.prototype), Xn(Te, r.prototype), Xn(xe, i.prototype), Xn(Ee, s.prototype), { Iterable: n, Seq: _, Collection: ke, Map: qe, OrderedMap: Vt, List: xt, Stack: Gn, Set: On, OrderedSet: zn, Record: Tn, Range: we, Repeat: ve, is: ye, fromJS: pe } }() }, function (e, t, n) { const r = n(1), i = []; class s { constructor(e) { this.isLoop = !1, this.warpMode = e, this.justReported = null, this.reporting = "", this.reported = null, this.waitingReporter = null, this.params = null, this.executionContext = null, this.op = null } reset() { return this.isLoop = !1, this.warpMode = !1, this.justReported = null, this.reported = null, this.waitingReporter = null, this.params = null, this.executionContext = null, this.op = null, this } reuse() { let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.warpMode; return this.reset(), this.warpMode = Boolean(e), this } static create(e) { const t = i.pop(); return void 0 !== t ? (t.warpMode = Boolean(e), t) : new s(e) } static release(e) { void 0 !== e && i.push(e.reset()) } } class o { constructor(e) { this.topBlock = e, this.stack = [], this.stackFrames = [], this.status = 0, this.isKilled = !1, this.target = null, this.blockContainer = null, this.requestScriptGlowInFrame = !1, this.blockGlowInFrame = null, this.warpTimer = null, this.justReported = null, this.triedToCompile = !1, this.isCompiled = !1, this.timer = null, this.generator = null, this.procedures = null, this.executableHat = !1, this.compatibilityStackFrame = null } static get STATUS_RUNNING() { return 0 } static get STATUS_PROMISE_WAIT() { return 1 } static get STATUS_YIELD() { return 2 } static get STATUS_YIELD_TICK() { return 3 } static get STATUS_DONE() { return 4 } static getIdFromTargetAndBlock(e, t) { return "".concat(e.id, "&").concat(t) } getId() { return o.getIdFromTargetAndBlock(this.target, this.topBlock) } pushStack(e) { if (this.stack.push(e), this.stack.length > this.stackFrames.length) { const e = this.stackFrames[this.stackFrames.length - 1]; this.stackFrames.push(s.create(void 0 !== e && e.warpMode)) } } reuseStackForNextBlock(e) { this.stack[this.stack.length - 1] = e, this.stackFrames[this.stackFrames.length - 1].reuse() } popStack() { return s.release(this.stackFrames.pop()), this.stack.pop() } stopThisScript() { let e = this.peekStack(); for (; null !== e;) { const t = this.target.blocks.getBlock(e); if (this.peekStackFrame().waitingReporter) break; if (void 0 !== t && "procedures_call" === t.opcode) { this.goToNextBlock(); break } this.popStack(), e = this.peekStack() } 0 === this.stack.length && (this.requestScriptGlowInFrame = !1, this.status = o.STATUS_DONE) } peekStack() { return this.stack.length > 0 ? this.stack[this.stack.length - 1] : null } peekStackFrame() { return this.stackFrames.length > 0 ? this.stackFrames[this.stackFrames.length - 1] : null } peekParentStackFrame() { return this.stackFrames.length > 1 ? this.stackFrames[this.stackFrames.length - 2] : null } pushReportedValue(e) { this.justReported = void 0 === e ? null : e } initParams() { const e = this.peekStackFrame(); null === e.params && (e.params = {}) } pushParam(e, t) { this.peekStackFrame().params[e] = t } getParam(e) { for (let t = this.stackFrames.length - 1; t >= 0; t--) { const n = this.stackFrames[t]; if (null !== n.params) return Object.prototype.hasOwnProperty.call(n.params, e) ? n.params[e] : null } return null } getAllparams() { return this.peekStackFrame().params } atStackTop() { return this.peekStack() === this.topBlock } goToNextBlock() { const e = this.target.blocks.getNextBlock(this.peekStack()); this.reuseStackForNextBlock(e) } isRecursiveCall(e) { let t = 5; for (let n = this.stackFrames.length - 1 - 1; n >= 0; n--) { const r = this.target.blocks.getBlock(this.stackFrames[n].op.id); if ("procedures_call" === r.opcode && r.mutation.proccode === e) return !0; if (--t < 0) return !1 } return !1 } tryCompile() { if (!this.blockContainer) return; const e = n(208); this.triedToCompile = !0; const t = !this.stackClick, i = this.topBlock, s = this.blockContainer.getBlock(i) ? this.blockContainer : this.target.runtime.flyoutBlocks, o = t && s.getCachedCompileResult(i); if (o && !o.success) return; let a; if (o) a = o.value; else try { a = e(this), t && s.cacheCompileResult(i, a) } catch (e) { return r.error("cannot compile script", this.target.getName(), e), t && s.cacheCompileError(i, e), void this.target.runtime.emitCompileError(this.target, e) } this.procedures = {}; for (const e of Object.keys(a.procedures)) this.procedures[e] = a.procedures[e](this); this.generator = a.startingFunction(this)(), this.executableHat = a.executableHat, this.blockContainer.forceNoGlow || (this.blockGlowInFrame = this.topBlock, this.requestScriptGlowInFrame = !0), this.isCompiled = !0 } } o._StackFrame = s, e.exports = o }, function (e, t, n) { const r = n(253), i = n(265), s = n(89), o = n(85), a = n(267), l = n(88), c = n(55), u = n(86), d = n(367), h = n(54); e.exports = { BitmapAdapter: i, convertFonts: u, inlineSvgFonts: s, loadSvgString: o, sanitizeSvg: a, serializeSvgToString: l, SvgElement: c, SVGRenderer: r, fixForVanilla: d, DOMPurify: h } }, function (e, t, n) { var r = n(91), i = r.isDigit, s = r.isHexDigit, o = r.isUppercaseLetter, a = r.isName, l = r.isWhiteSpace, c = r.isValidEscape; function u(e, t) { return t < e.length ? e.charCodeAt(t) : 0 } function d(e, t, n) { return 13 === n && 10 === u(e, t + 1) ? 2 : 1 } function h(e, t, n) { var r = e.charCodeAt(t); return o(r) && (r |= 32), r === n } function p(e, t) { for (; t < e.length && i(e.charCodeAt(t)); t++); return t } function m(e, t) { if (s(u(e, (t += 2) - 1))) { for (var n = Math.min(e.length, t + 5); t < n && s(u(e, t)); t++); var r = u(e, t); l(r) && (t += d(e, t, r)) } return t } e.exports = { consumeEscaped: m, consumeName: function (e, t) { for (; t < e.length; t++) { var n = e.charCodeAt(t); if (!a(n)) { if (!c(n, u(e, t + 1))) break; t = m(e, t) - 1 } } return t }, consumeNumber: function (e, t) { var n = e.charCodeAt(t); if (43 !== n && 45 !== n || (n = e.charCodeAt(t += 1)), i(n) && (t = p(e, t + 1), n = e.charCodeAt(t)), 46 === n && i(e.charCodeAt(t + 1)) && (n = e.charCodeAt(t += 2), t = p(e, t)), h(e, t, 101)) { var r = 0; 45 !== (n = e.charCodeAt(t + 1)) && 43 !== n || (r = 1, n = e.charCodeAt(t + 2)), i(n) && (t = p(e, t + 1 + r + 1)) } return t }, consumeBadUrlRemnants: function (e, t) { for (; t < e.length; t++) { var n = e.charCodeAt(t); if (41 === n) { t++; break } c(n, u(e, t + 1)) && (t = m(e, t)) } return t }, cmpChar: h, cmpStr: function (e, t, n, r) { if (n - t !== r.length) return !1; if (t < 0 || n > e.length) return !1; for (var i = t; i < n; i++) { var s = e.charCodeAt(i), a = r.charCodeAt(i - t); if (o(s) && (s |= 32), s !== a) return !1 } return !0 }, getNewlineLength: d, findWhiteSpaceStart: function (e, t) { for (; t >= 0 && l(e.charCodeAt(t)); t--); return t + 1 }, findWhiteSpaceEnd: function (e, t) { for (; t < e.length && l(e.charCodeAt(t)); t++); return t } } }, function (e, t, n) { const r = n(45), i = n(16), s = n(53), o = n(10), a = n(52), l = n(46), c = n(13), u = n(1), d = n(8), h = n(5), p = n(7), m = n(84), f = n(375), { loadCostume: g } = n(35), { loadSound: y } = n(34), { deserializeCostume: b, deserializeSound: v } = n(104), S = Object.prototype.hasOwnProperty, w = ["argument", "colour", "control", "data", "event", "looks", "math", "motion", "operator", "procedures", "sensing", "sound"], k = 12, T = 13, x = { math_number: [4, "NUM"], math_positive_number: [5, "NUM"], math_whole_number: [6, "NUM"], math_integer: [7, "NUM"], math_angle: [8, "NUM"], colour_picker: [9, "COLOUR"], text: [10, "TEXT"], event_broadcast_menu: [11, "BROADCAST_OPTION"], data_variable: [k, "VARIABLE"], data_listcontents: [T, "LIST"] }, E = 8e3, A = function (e) { const t = function (e) { if (S.call(x, e.opcode)) { const t = x[e.opcode], n = t[0], r = t[1], i = e.fields[r], s = [n, i.value]; return "event_broadcast_menu" === e.opcode ? s.push(i.id) : "data_variable" !== e.opcode && "data_listcontents" !== e.opcode || (s.push(i.id), e.topLevel && (s.push(e.x ? Math.round(e.x) : 0), s.push(e.y ? Math.round(e.y) : 0))), s } return null }(e); if (t) return t; const n = Object.create(null); return n.opcode = e.opcode, n.next = e.next, n.parent = e.parent, n.inputs = function (e) { const t = Object.create(null); for (const n in e) S.call(e, n) && (e[n].block === e[n].shadow ? t[n] = [1, e[n].block] : null === e[n].shadow ? t[n] = [2, e[n].block] : t[n] = [3, e[n].block, e[n].shadow]); return t }(e.inputs), n.fields = function (e) { const t = Object.create(null); for (const n in e) S.call(e, n) && (t[n] = [e[n].value], Object.prototype.hasOwnProperty.call(e[n], "id") && t[n].push(e[n].id)); return t }(e.fields), n.shadow = e.shadow, e.topLevel ? (n.topLevel = !0, n.x = e.x ? Math.round(e.x) : 0, n.y = e.y ? Math.round(e.y) : 0) : n.topLevel = !1, e.mutation && (n.mutation = e.mutation), e.comment && (n.comment = e.comment), n }, C = function (e, t) { const n = e.inputs; for (const e in n) { const r = n[e]; for (let e = 1; e < r.length; e++) { if (!r[e]) continue; const n = r[e], i = t[n]; Array.isArray(i) && (r[e] = i, delete t[n]) } } return e }, I = function (e) { const t = e.indexOf("_"), n = e.substring(0, t).replace(/[^\w-]/g, "-"); if (-1 === w.indexOf(n) && "" !== n) return n }, O = (e, t) => { if (!t.extensionManager) return null; const n = t.extensionManager.getExtensionURLs(), r = {}; for (const t of e) { const e = n[t]; "string" == typeof e && (r[t] = e) } return 0 === Object.keys(r).length ? null : r }, M = function (e) { const t = Object.create(null), n = new Set; for (const r in e) { if (!Object.prototype.hasOwnProperty.call(e, r)) continue; t[r] = A(e[r]); const i = I(e[r].opcode); i && n.add(i) } for (const e in t) { const n = t[e]; t[e] = C(n, t) } for (const e in t) { const n = t[e]; Array.isArray(n) && [k, T].indexOf(n[0]) < 0 && (u.warn("Found an unexpected top level primitive with block ID: ".concat(e, "; deleting it from serialized blocks.")), delete t[e]) } return [t, Array.from(n)] }, N = function (e) { const t = Object.create(null); t.name = e.name; const n = e.broken || e; return t.bitmapResolution = n.bitmapResolution, t.dataFormat = n.dataFormat.toLowerCase(), t.assetId = n.assetId, t.md5ext = n.md5, t.rotationCenterX = n.rotationCenterX, t.rotationCenterY = n.rotationCenterY, t }, R = function (e) { const t = Object.create(null); t.name = e.name; const n = e.broken || e; return t.assetId = n.assetId, t.dataFormat = n.dataFormat.toLowerCase(), t.format = n.format, t.rate = n.rate, t.sampleCount = n.sampleCount, t.md5ext = n.md5, t }, D = e => "number" == typeof e || "string" == typeof e || "boolean" == typeof e, P = e => { if (Array.isArray(e)) { let t = null; for (let n = 0; n < e.length; n++)D(e[n]) || (t || (t = e.slice()), t[n] = "".concat(t[n])); return t || e } return D(e) ? e : "".concat(e) }, L = function (e, t) { const n = Object.create(null); let r = []; n.isStage = e.isStage, n.name = n.isStage ? "Stage" : e.name; const i = function (e) { const t = Object.create(null); t.variables = Object.create(null), t.lists = Object.create(null), t.broadcasts = Object.create(null); for (const n in e) { const r = e[n]; r.type !== o.BROADCAST_MESSAGE_TYPE ? r.type !== o.LIST_TYPE ? (t.variables[n] = [r.name, P(r.value)], r.isCloud && t.variables[n].push(!0)) : t.lists[n] = [r.name, P(r.value)] : t.broadcasts[n] = r.value } return t }(e.variables); return n.variables = i.variables, n.lists = i.lists, n.broadcasts = i.broadcasts, [n.blocks, r] = M(e.blocks), n.comments = function (e) { const t = Object.create(null); for (const n in e) { if (!Object.prototype.hasOwnProperty.call(e, n)) continue; const r = e[n], i = Object.create(null); i.blockId = r.blockId, i.x = r.x, i.y = r.y, i.width = r.width, i.height = r.height, i.minimized = r.minimized, r.text.length > E ? (i.text = r.text.substring(0, E), i.extraText = r.text.substring(E)) : i.text = r.text, t[n] = i } return t }(e.comments), (e.currentCostume < 0 || e.currentCostume >= e.costumes.length) && (u.warn("currentCostume property for target ".concat(e.name, " is out of range")), e.currentCostume = h.clamp(e.currentCostume, 0, e.costumes.length - 1)), n.currentCostume = e.currentCostume, n.costumes = e.costumes.map(N), n.sounds = e.sounds.map(R), Object.prototype.hasOwnProperty.call(e, "volume") && (n.volume = e.volume), Object.prototype.hasOwnProperty.call(e, "layerOrder") && (n.layerOrder = e.layerOrder), n.isStage ? (Object.prototype.hasOwnProperty.call(e, "tempo") && (n.tempo = e.tempo), Object.prototype.hasOwnProperty.call(e, "videoTransparency") && (n.videoTransparency = e.videoTransparency), Object.prototype.hasOwnProperty.call(e, "videoState") && (n.videoState = e.videoState), Object.prototype.hasOwnProperty.call(e, "textToSpeechLanguage") && (n.textToSpeechLanguage = e.textToSpeechLanguage)) : (n.visible = e.visible, n.x = e.x, n.y = e.y, n.size = e.size, n.direction = e.direction, n.draggable = e.draggable, n.rotationStyle = e.rotationStyle), r.forEach((e => { t.add(e) })), n }, B = (e, t) => { const n = {}; let r = !0; for (const [i, s] of Object.entries(e)) t.has(i) && null != s && (r = !1, n[i] = e[i]); return r ? null : n }, z = function (e, t, n, r) { if (!Array.isArray(e)) return e; const i = Object.create(null), s = d(); switch (i.id = s, i.next = null, i.parent = t, i.shadow = n, i.inputs = Object.create(null), e[0]) { case 4: i.opcode = "math_number", i.fields = { NUM: { name: "NUM", value: e[1] } }, i.topLevel = !1; break; case 5: i.opcode = "math_positive_number", i.fields = { NUM: { name: "NUM", value: e[1] } }, i.topLevel = !1; break; case 6: i.opcode = "math_whole_number", i.fields = { NUM: { name: "NUM", value: e[1] } }, i.topLevel = !1; break; case 7: i.opcode = "math_integer", i.fields = { NUM: { name: "NUM", value: e[1] } }, i.topLevel = !1; break; case 8: i.opcode = "math_angle", i.fields = { NUM: { name: "NUM", value: e[1] } }, i.topLevel = !1; break; case 9: i.opcode = "colour_picker", i.fields = { COLOUR: { name: "COLOUR", value: e[1] } }, i.topLevel = !1; break; case 10: i.opcode = "text", i.fields = { TEXT: { name: "TEXT", value: e[1] } }, i.topLevel = !1; break; case 11: i.opcode = "event_broadcast_menu", i.fields = { BROADCAST_OPTION: { name: "BROADCAST_OPTION", value: e[1], id: e[2], variableType: o.BROADCAST_MESSAGE_TYPE } }, i.topLevel = !1; break; case k: i.opcode = "data_variable", i.fields = { VARIABLE: { name: "VARIABLE", value: e[1], id: e[2], variableType: o.SCALAR_TYPE } }, e.length > 3 && (i.topLevel = !0, i.x = e[3], i.y = e[4]); break; case T: i.opcode = "data_listcontents", i.fields = { LIST: { name: "LIST", value: e[1], id: e[2], variableType: o.LIST_TYPE } }, e.length > 3 && (i.topLevel = !0, i.x = e[3], i.y = e[4]); break; default: return u.error("Found unknown primitive type during deserialization: ".concat(JSON.stringify(e))), null }return r[s] = i, s }, U = function (e, t, n) { const r = {}; for (const i in e) { if (!S.call(e, i)) continue; const s = e[i]; if (!Array.isArray(s)) continue; let o = null, a = null; const l = s[0]; 1 === l ? o = a = z(s[1], t, !0, n) : 2 === l ? o = z(s[1], t, !1, n) : (o = z(s[1], t, !1, n), a = z(s[2], t, !0, n)), r[i] = { name: i, block: o, shadow: a } } return r }, j = function (e) { const t = {}; for (const n in e) { if (!S.call(e, n)) continue; const r = e[n]; Array.isArray(r) && (t[n] = { name: n, value: r[0] }, r.length > 1 && (t[n].id = r[1]), "BROADCAST_OPTION" === n ? t[n].variableType = o.BROADCAST_MESSAGE_TYPE : "VARIABLE" === n ? t[n].variableType = o.SCALAR_TYPE : "LIST" === n && (t[n].variableType = o.LIST_TYPE)) } return t }, F = function (e) { for (const t in e) { if (!Object.prototype.hasOwnProperty.call(e, t)) continue; const n = e[t]; Array.isArray(n) ? (delete e[t], z(n, null, !1, e)) : (n.id = t, n.inputs = U(n.inputs, t, e), n.fields = j(n.fields)) } return e }; e.exports = { serialize: function (e, t) { let { allowOptimization: n = !0 } = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; const r = Object.create(null), i = new Set, s = t ? [e.getTargetById(t)] : e.targets.filter((e => e.isOriginal)), o = function (e) { const t = e.map((e => e.getLayerOrder())); return h.reducedSortOrdering(t) }(s), a = s.map((e => e.toJSON())); e.renderer && !t && a.forEach(((e, t) => { e.layerOrder = o[t] })); const l = a.map((e => L(e, i))).map(((e, t) => { const n = s[t], r = B(n.extensionStorage, i); return r && (e.extensionStorage = r), e })), c = e.fontManager.serializeJSON(); if (t) { const t = l[0]; i.size && (t.extensions = Array.from(i)); const n = O(i, e); return n && (t.extensionURLs = n), c && (t.customFonts = c), l[0] } const u = B(e.extensionStorage, i); u && (r.extensionStorage = u), r.targets = l, r.monitors = function (e, t, n) { const r = (t.stageWidth - 480) / 2, i = (t.stageHeight - 360) / 2; return e.valueSeq().filter((e => { const t = I(e.opcode); return !t || !!e.visible && (n.add(t), !0) })).map((e => { const t = { id: e.id, mode: e.mode, opcode: e.opcode, params: e.params, spriteName: e.spriteName, value: Array.isArray(e.value) ? [] : 0, width: e.width, height: e.height, x: e.x - r, y: e.y - i, visible: e.visible }; return "list" !== e.mode && (t.sliderMin = e.sliderMin, t.sliderMax = e.sliderMax, t.isDiscrete = e.isDiscrete), t })).toArray() }(e.getMonitorState(), e, i), r.extensions = Array.from(i); const d = O(i, e); d && (r.extensionURLs = d), c && (r.customFonts = c); const p = Object.create(null); return p.semver = "3.0.0", p.vm = "0.2.0", e.origin && (p.origin = e.origin), p.agent = "", p.platform = Object.assign({}, e.platform), r.meta = p, n && f(r), r }, deserialize: async function (e, t, n, d) { await ((e, t) => { if (!e.meta || !e.meta.platform) return; if (e.meta.platform.name === t.platform.name) return; let n = t.listenerCount(r.PLATFORM_MISMATCH); return 0 !== n ? new Promise((i => { t.emit(r.PLATFORM_MISMATCH, e.meta.platform, (() => { n--, 0 === n && i() })) })) : void 0 })(e, t); const f = { extensionIDs: new Set, extensionURLs: new Map }; if (e.meta && e.meta.origin ? t.origin = e.meta.origin : t.origin = null, e.extensionURLs) for (const [t, n] of Object.entries(e.extensionURLs)) f.extensionURLs.set(t, n); let S; S = e.customFonts ? t.fontManager.deserialize(e.customFonts, n, d) : Promise.resolve(); const w = ((d ? [e] : e.targets) || []).map(((e, t) => Object.assign(e, { targetPaneOrder: t }))).sort(((e, t) => e.layerOrder - t.layerOrder)), k = e.monitors || []; return S.then((() => w.map((e => function (e, t, n) { if (!Object.prototype.hasOwnProperty.call(e, "name")) return Promise.resolve(null); const r = { costumePromises: null, soundPromises: null, soundBank: t.audioEngine && t.audioEngine.createBank() }; return r.costumePromises = (e.costumes || []).map((e => { const r = { asset: e.asset, assetId: e.assetId, skinId: null, name: e.name, bitmapResolution: e.bitmapResolution, rotationCenterX: e.rotationCenterX, rotationCenterY: e.rotationCenterY }, i = e.dataFormat || e.assetType && e.assetType.runtimeFormat || "png", s = Object.prototype.hasOwnProperty.call(e, "md5ext") ? e.md5ext : "".concat(e.assetId, ".").concat(i); return r.md5 = s, r.dataFormat = i, t.wrapAssetRequest((() => b(r, t, n).then((() => g(s, r, t))))) })), r.soundPromises = (e.sounds || []).map((e => { const i = { assetId: e.assetId, format: e.format, rate: e.rate, sampleCount: e.sampleCount, name: e.name, md5: e.md5ext, dataFormat: e.dataFormat, data: null }; return t.wrapAssetRequest((() => v(i, t, n).then((() => y(i, t, r.soundBank))))) })), r }(e, t, n))))).then((e => Promise.resolve(e))).then((e => Promise.all(w.map(((n, r) => function (e, t, n, r, l) { if (!Object.prototype.hasOwnProperty.call(e, "name")) return Promise.resolve(null); const u = new i(t), d = new s(u, t); if (Object.prototype.hasOwnProperty.call(e, "name") && (d.name = e.name), Object.prototype.hasOwnProperty.call(e, "blocks")) { F(e.blocks); for (const t in e.blocks) { if (!Object.prototype.hasOwnProperty.call(e.blocks, t)) continue; const r = e.blocks[t]; u.createBlock(r); const i = I(r.opcode); i && n.extensionIDs.add(i) } } const { costumePromises: p } = l, { soundBank: m, soundPromises: f } = l, g = d.createClone(e.isStage ? c.BACKGROUND_LAYER : c.SPRITE_LAYER); if (Object.prototype.hasOwnProperty.call(e, "tempo") && (g.tempo = e.tempo), Object.prototype.hasOwnProperty.call(e, "volume") && (g.volume = e.volume), Object.prototype.hasOwnProperty.call(e, "videoTransparency") && (g.videoTransparency = e.videoTransparency), Object.prototype.hasOwnProperty.call(e, "videoState") && (g.videoState = e.videoState), Object.prototype.hasOwnProperty.call(e, "textToSpeechLanguage") && (g.textToSpeechLanguage = e.textToSpeechLanguage), Object.prototype.hasOwnProperty.call(e, "variables")) for (const n in e.variables) { const r = e.variables[n], i = 3 === r.length && r[2] && e.isStage && t.canAddCloudVariable(), s = new o(n, r[0], o.SCALAR_TYPE, i); i && t.addCloudVariable(), s.value = r[1], g.variables[s.id] = s } if (Object.prototype.hasOwnProperty.call(e, "lists")) for (const t in e.lists) { const n = e.lists[t], r = new o(t, n[0], o.LIST_TYPE, !1); r.value = n[1], g.variables[r.id] = r } if (Object.prototype.hasOwnProperty.call(e, "broadcasts")) for (const t in e.broadcasts) { const n = e.broadcasts[t], r = new o(t, n, o.BROADCAST_MESSAGE_TYPE, !1); g.variables[r.id] = r } if (Object.prototype.hasOwnProperty.call(e, "comments")) for (const t in e.comments) { const n = e.comments[t], r = new a(t, n.text + ("string" == typeof n.extraText ? n.extraText : ""), n.x, n.y, n.width, n.height, n.minimized); n.blockId && (r.blockId = n.blockId), g.comments[r.id] = r } return Object.prototype.hasOwnProperty.call(e, "x") && (g.x = e.x), Object.prototype.hasOwnProperty.call(e, "y") && (g.y = e.y), Object.prototype.hasOwnProperty.call(e, "direction") && (g.direction = h.wrapClamp(e.direction, -179, 180)), Object.prototype.hasOwnProperty.call(e, "size") && (g.size = e.size), Object.prototype.hasOwnProperty.call(e, "visible") && (g.visible = e.visible), Object.prototype.hasOwnProperty.call(e, "currentCostume") && (g.currentCostume = h.clamp(e.currentCostume, 0, e.costumes.length - 1)), Object.prototype.hasOwnProperty.call(e, "rotationStyle") && (g.rotationStyle = e.rotationStyle), Object.prototype.hasOwnProperty.call(e, "isStage") && (g.isStage = e.isStage), Object.prototype.hasOwnProperty.call(e, "targetPaneOrder") && (g.targetPaneOrder = e.targetPaneOrder), Object.prototype.hasOwnProperty.call(e, "draggable") && (g.draggable = e.draggable), Object.prototype.hasOwnProperty.call(e, "extensionStorage") && (g.extensionStorage = e.extensionStorage), Promise.all(p).then((e => { d.costumes = e })), Promise.all(f).then((e => { d.sounds = e, d.soundBank = m || null })), Promise.all(p.concat(f)).then((() => g)) }(n, t, f, 0, e[r])))))).then((e => e.map(((e, t) => (e.layerOrder = t, e))).sort(((e, t) => e.targetPaneOrder - t.targetPaneOrder)).map((e => (delete e.targetPaneOrder, e))))).then((e => function (e) { const t = m.getAllVarRefsForTargets(e, !0); e.forEach((e => { Object.keys(e.variables).forEach((t => { const n = p.replaceUnsafeChars(t); n !== t && (e.variables[t].id = n, e.variables[n] = e.variables[t], delete e.variables[t]) })) })); for (const e in t) { const n = p.replaceUnsafeChars(e); e !== n && m.updateVariableIdentifiers(t[e], n) } return e }(e))).then((n => (k.map((e => function (e, t, n, r) { const i = (t.stageWidth - 480) / 2, s = (t.stageHeight - 360) / 2; if (e.x += i, e.y += s, e.x = h.clamp(e.x, 0, t.stageWidth), e.y = h.clamp(e.y, 0, t.stageHeight), e.spriteName) { const t = n.filter((t => t.sprite.name === e.spriteName)); t && t.length > 0 ? e.targetId = t[0].id : u.warn("Tried to deserialize sprite specific monitor ".concat(e.opcode, " but could not find sprite ").concat(e.spriteName, ".")) } const a = t.monitorBlockInfo[e.opcode]; if ("data_listcontents" === e.opcode) { const t = e.targetId ? n.find((t => t.id === e.targetId)) : n.find((e => e.isStage)); t && Object.prototype.hasOwnProperty.call(t.variables, e.id) && (e.params.LIST = t.variables[e.id].name) } const c = {}; for (const t in e.params) { const n = { name: t, value: e.params[t] }; c[t] = n } "data_variable" !== e.opcode && "data_listcontents" !== e.opcode && a && a.isSpriteSpecific ? e.id = a.getId(e.targetId, c) : e.id = p.replaceUnsafeChars(e.id); const d = t.monitorBlocks._blocks[e.id]; if (d) d.isMonitored = e.visible, d.targetId = e.targetId; else { const n = { id: e.id, opcode: e.opcode, inputs: {}, fields: c, topLevel: !0, next: null, parent: null, shadow: !1, x: 0, y: 0, isMonitored: e.visible, targetId: e.targetId }; if ("data_variable" === e.opcode) { const t = n.fields.VARIABLE; t.id = e.id, t.variableType = o.SCALAR_TYPE } else if ("data_listcontents" === e.opcode) { const t = n.fields.LIST; t.id = e.id, t.variableType = o.LIST_TYPE } t.monitorBlocks.createBlock(n); const i = I(n.opcode); i && r.extensionIDs.add(i) } t.requestAddMonitor(l(e)) }(e, t, n, f))), Object.prototype.hasOwnProperty.call(e, "extensionStorage") && (t.extensionStorage = e.extensionStorage), n))).then((e => ({ targets: e, extensions: f }))) }, deserializeBlocks: F, serializeBlocks: M, deserializeStandaloneBlocks: e => { if ((e = JSON.parse(JSON.stringify(e))).extensionURLs) { const t = new Map; for (const [n, r] of Object.entries(e.extensionURLs)) t.set(n, r); return { blocks: e.blocks, extensionURLs: t } } return { blocks: e, extensionURLs: new Map } }, serializeStandaloneBlocks: (e, t) => { const n = new Set; for (const t of e) { const e = I(t.opcode); e && n.add(e) } const r = O(n, t); return r ? { blocks: e, extensionURLs: r } : e }, getExtensionIdForOpcode: I } }, function (e, t, n) { const r = n(11), i = n(38), s = n(384); e.exports = class { constructor(e, t) { this._renderer = t, this._id = e, this._rotationCenter = r.v3.create(0, 0), this._texture = null, this._uniforms = { u_skinSize: [0, 0], u_skin: null }, this._silhouette = new s, this.private = !1 } dispose() { this._id = i.ID_NONE } get id() { return this._id } get rotationCenter() { return this._rotationCenter } get size() { return [0, 0] } useNearest(e, t) { return !0 } calculateRotationCenter() { return [this.size[0] / 2, this.size[1] / 2] } getTexture(e) { return this._emptyImageTexture } getFenceBounds(e, t) { return e.getAABB(t) } getUniforms(e) { return this._uniforms.u_skin = this.getTexture(e), this._uniforms.u_skinSize = this.size, this._uniforms } emitWasAltered() { this._renderer.skinWasAltered(this) } updateSilhouette() { this._silhouette.unlazy() } _setTexture(e) { const t = this._renderer.gl; t.bindTexture(t.TEXTURE_2D, this._texture), t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, e), t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), this._silhouette.update(e) } setEmptyImageData() { if (this._texture = null, !this._emptyImageData) { this._emptyImageData = new ImageData(1, 1); const e = this._renderer.gl, t = { auto: !0, wrap: e.CLAMP_TO_EDGE, src: this._emptyImageData }; this._emptyImageTexture = r.createTexture(e, t) } this._rotationCenter[0] = 0, this._rotationCenter[1] = 0, this._silhouette.update(this._emptyImageData), this.emitWasAltered() } isTouchingNearest(e) { return this._silhouette.isTouchingNearest(e) } isTouchingLinear(e) { return this._silhouette.isTouchingLinear(e) } } }, function (e, t, n) { const r = n(11); class i { constructor(e) { this._gl = e, this._shaderCache = {}; for (const e in i.DRAW_MODE) Object.prototype.hasOwnProperty.call(i.DRAW_MODE, e) && (this._shaderCache[e] = []) } getShader(e, t) { const n = this._shaderCache[e]; e === i.DRAW_MODE.silhouette && (t &= ~(i.EFFECT_INFO.color.mask | i.EFFECT_INFO.brightness.mask)); let r = n[t]; return r || (r = n[t] = this._buildShader(e, t)), r } _buildShader(e, t) { const s = i.EFFECTS.length, o = ["#define DRAW_MODE_".concat(e)]; for (let e = 0; e < s; ++e)t & 1 << e && o.push("#define ENABLE_".concat(i.EFFECTS[e])); const a = "".concat(o.join("\n"), "\n"), l = a + n(387), c = a + n(388); let u = null; const d = r.createProgramInfo(this._gl, [l, c], null, null, (e => { console.error(e); const t = e.match(/\*\*\* Error compiling shader: ([\s\S]+)/); u = t ? t[1].trim() : e })); if (!d) throw new Error("Failed to compile shader (mode ".concat(e, ", effects ").concat(t, "): ").concat(u)); return d } } i.EFFECT_INFO = { color: { uniformName: "u_color", mask: 1, converter: e => e / 200 % 1, shapeChanges: !1 }, fisheye: { uniformName: "u_fisheye", mask: 2, converter: e => Math.max(0, (e + 100) / 100), shapeChanges: !0 }, whirl: { uniformName: "u_whirl", mask: 4, converter: e => -e * Math.PI / 180, shapeChanges: !0 }, pixelate: { uniformName: "u_pixelate", mask: 8, converter: e => Math.abs(e) / 10, shapeChanges: !0 }, mosaic: { uniformName: "u_mosaic", mask: 16, converter: e => (e = Math.round((Math.abs(e) + 10) / 10), Math.max(1, Math.min(e, 512))), shapeChanges: !0 }, brightness: { uniformName: "u_brightness", mask: 32, converter: e => Math.max(-100, Math.min(e, 100)) / 100, shapeChanges: !1 }, ghost: { uniformName: "u_ghost", mask: 64, converter: e => 1 - Math.max(0, Math.min(e, 100)) / 100, shapeChanges: !1 } }, i.EFFECTS = Object.keys(i.EFFECT_INFO), i.DRAW_MODE = { default: "default", straightAlpha: "straightAlpha", silhouette: "silhouette", colorMask: "colorMask", line: "line", background: "background" }, e.exports = i }, function (e, t) { const n = "undefined" == typeof document, r = n ? "" : "", i = n ? "" : "", s = `${n ? "" : ""}debug${r}`, o = `${n ? "" : ""}info${r}`, a = `${n ? "" : ""}warn${r}`, l = `${n ? "" : ""}error${r}`, c = (e = "") => { const t = t => c(e ? `${e} ${t}` : t), n = e ? [`${i}${e}${r}`] : []; return t.debug = t.log = console.debug.bind(console, ...n, s), t.info = console.log.bind(console, ...n, o), t.warn = t.warning = console.warn.bind(console, ...n, a), t.error = console.error.bind(console, ...n, l), t }; c.enable = c.disable = () => { }, e.exports = c }, function (e, t, n) { const r = n(71); e.exports = class extends r { constructor(e, t, n, r) { let i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null; super(), this._socket = e.getScratchLinkSocket("BLE"), this._socket.setOnOpen(this.requestPeripheral.bind(this)), this._socket.setOnClose(this.handleDisconnectError.bind(this)), this._socket.setOnError(this._handleRequestError.bind(this)), this._socket.setHandleMessage(this._handleMessage.bind(this)), this._sendMessage = this._socket.sendMessage.bind(this._socket), this._availablePeripherals = {}, this._connectCallback = r, this._connected = !1, this._characteristicDidChangeCallback = null, this._resetCallback = i, this._discoverTimeoutID = null, this._extensionId = t, this._peripheralOptions = n, this._runtime = e, this._socket.open() } requestPeripheral() { this._availablePeripherals = {}, this._discoverTimeoutID && window.clearTimeout(this._discoverTimeoutID), this._discoverTimeoutID = window.setTimeout(this._handleDiscoverTimeout.bind(this), 15e3), this.sendRemoteRequest("discover", this._peripheralOptions).catch((e => { this._handleRequestError(e) })) } connectPeripheral(e) { this.sendRemoteRequest("connect", { peripheralId: e }).then((() => { this._connected = !0, this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED), this._connectCallback() })).catch((e => { this._handleRequestError(e) })) } disconnect() { this._connected && (this._connected = !1), this._socket.isOpen() && this._socket.close(), this._discoverTimeoutID && window.clearTimeout(this._discoverTimeoutID), this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED) } isConnected() { return this._connected } startNotifications(e, t) { let n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null; const r = { serviceId: e, characteristicId: t }; return this._characteristicDidChangeCallback = n, this.sendRemoteRequest("startNotifications", r).catch((e => { this.handleDisconnectError(e) })) } read(e, t) { let n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; const r = { serviceId: e, characteristicId: t }; return arguments.length > 2 && void 0 !== arguments[2] && arguments[2] && (r.startNotifications = !0), n && (this._characteristicDidChangeCallback = n), this.sendRemoteRequest("read", r).catch((e => { this.handleDisconnectError(e) })) } write(e, t, n) { let r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null; const s = { serviceId: e, characteristicId: t, message: n }; return r && (s.encoding = r), null !== i && (s.withResponse = i), this.sendRemoteRequest("write", s).catch((e => { this.handleDisconnectError(e) })) } didReceiveCall(e, t) { switch (e) { case "didDiscoverPeripheral": this._availablePeripherals[t.peripheralId] = t, this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE, this._availablePeripherals), this._discoverTimeoutID && window.clearTimeout(this._discoverTimeoutID); break; case "userDidPickPeripheral": this._availablePeripherals[t.peripheralId] = t, this._runtime.emit(this._runtime.constructor.USER_PICKED_PERIPHERAL, this._availablePeripherals), this._discoverTimeoutID && window.clearTimeout(this._discoverTimeoutID); break; case "userDidNotPickPeripheral": this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT), this._discoverTimeoutID && window.clearTimeout(this._discoverTimeoutID); break; case "characteristicDidChange": this._characteristicDidChangeCallback && this._characteristicDidChangeCallback(t.message); break; case "ping": return 42 } } handleDisconnectError() { this._connected && (this.disconnect(), this._resetCallback && this._resetCallback(), this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR, { message: "Scratch lost connection to", extensionId: this._extensionId })) } _handleRequestError() { this._runtime.emit(this._runtime.constructor.PERIPHERAL_REQUEST_ERROR, { message: "Scratch lost connection to", extensionId: this._extensionId }) } _handleDiscoverTimeout() { this._discoverTimeoutID && window.clearTimeout(this._discoverTimeoutID), this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT) } } }, function (e, t, n) { const r = n(1); e.exports = function (e) { if ("string" != typeof e) { if (!Array.isArray(e)) return r.error("Unexpected input recieved in replaceUnsafeChars"), e; e = String(e) } return e.replace(/[<>&'"]/g, (e => { switch (e) { case "<": return "<"; case ">": return ">"; case "&": return "&"; case "'": return "'"; case '"': return """ } })) } }, function (e, t, n) { const r = n(7), i = n(1), s = function (e, t, n, r) { return e.assetId = t.assetId, n.audioEngine ? n.audioEngine.decodeSoundPlayer(Object.assign({}, e, { data: t.data })).then((t => { e.soundId = t.id; const i = t.buffer; return e.rate = i.sampleRate, e.sampleCount = i.length, null !== r && r.addSoundPlayer(t), n.isPackaged && (e.asset = null), e })) : (i.warn("No audio engine present; cannot load sound asset: ", e.md5), Promise.resolve(e)) }, o = function (e, t, n) { const r = e.asset, i = e.assetId, o = e.sampleCount, a = e.rate, l = e.format, c = e.dataFormat; return e.assetId = t.storage.defaultAssetId.Sound, e.asset = t.storage.get(e.assetId), e.md5 = "".concat(e.assetId, ".").concat(e.asset.dataFormat), s(e, e.asset, t, n).then((e => (e.broken = {}, e.broken.assetId = i, e.broken.md5 = "".concat(i, ".").concat(c), e.broken.asset = r, e.broken.sampleCount = o, e.broken.rate = a, e.broken.format = l, e.broken.dataFormat = c, e))) }; e.exports = { loadSound: function (e, t, n) { if (!t.storage) return i.warn("No storage module present; cannot load sound asset: ", e.md5), Promise.resolve(e); const a = r.splitFirst(e.md5, "."), l = a[0], c = a[1].toLowerCase(); return e.dataFormat = c, (e.asset && Promise.resolve(e.asset) || t.storage.load(t.storage.AssetType.Sound, l, c)).then((r => (e.asset = r, r ? s(e, r, t, n) : (i.warn("Failed to find sound data: ", e.md5), o(e, t, n))))).catch((r => (i.warn("Failed to load sound: ".concat(e.md5, " with error: ").concat(r)), o(e, t, n)))) }, loadSoundFromAsset: s } }, function (e, t, n) { const r = n(7), i = n(1), s = n(83), { loadSvgString: o, serializeSvgToString: a } = n(26), { parseVectorMetadata: l } = n(101), c = function (e, t, n, r) { return new Promise((i => { let s = e.asset.decodeText(); if (void 0 === n) { const t = l(s); t && (n = t, e.rotationCenterX = n[0], e.rotationCenterY = n[1]) } if (r && 2 === r) { const n = a(o(s, !0)); if (s !== n) { s = n; const r = t.storage; e.asset.encodeTextData(n, r.DataFormat.SVG, !0), e.assetId = e.asset.assetId, e.md5 = "".concat(e.assetId, ".").concat(e.dataFormat) } } e.skinId = t.renderer.createSVGSkin(s, n), e.size = t.renderer.getSkinSize(e.skinId), n || (n = t.renderer.getSkinRotationCenter(e.skinId), e.rotationCenterX = n[0], e.rotationCenterY = n[1], e.bitmapResolution = 1), t.isPackaged && (e.asset = null), i(e) })) }, u = new class { constructor() { this.pool = [], this.clearSoon = null } clear() { this.clearSoon || (this.clearSoon = new Promise((e => setTimeout(e, 1e3))).then((() => { this.pool.length = 0, this.clearSoon = null }))) } create() { return this.pool.pop() || document.createElement("canvas") } release(e) { this.clear(), this.pool.push(e) } }, d = e => new Promise(((t, n) => { const r = new Image; r.onload = function () { t(r), r.onload = null, r.onerror = null }, r.onerror = function () { n(new Error("Costume load failed. Asset could not be read.")), r.onload = null, r.onerror = null }, r.src = e })), h = new s((async e => { let t; for (let n = 0; n < 3; n++)try { if ("function" == typeof createImageBitmap) { const t = await createImageBitmap(new Blob([e.data.buffer], { type: e.assetType.contentType })); if (!t) throw new Error("createImageBitmap resolved with ".concat(t)); return t } return await d(e.encodeDataURI()) } catch (e) { t || (t = e), i.warn(e), await new Promise((e => setTimeout(e, 2e3 * Math.random()))) } throw t }), 25), p = function (e, t, n) { return function (e, t, n) { return e && e.asset ? t.v2BitmapAdapter ? Promise.all([e.asset, e.textLayerAsset].map((e => e ? h.do(e) : null))).then((r => { let [i, s] = r; if (!i) throw new Error("Loading bitmap costume base failed."); const o = 1 === e.bitmapResolution ? 2 : 1; let a, l; if (s) { l = u.create(), l.width = i.width, l.height = i.height; const e = l.getContext("2d"); e.drawImage(i, 0, 0), e.drawImage(s, 0, 0), a = l } else a = i; return 1 !== o && (a = t.v2BitmapAdapter.resize(a, a.width * o, a.height * o), l && u.release(l)), a.reusable = !1, n && (n[0] = n[0] * o, n[1] = n[1] * o, e.rotationCenterX = n[0], e.rotationCenterY = n[1]), e.bitmapResolution = 2, delete e.textLayerMD5, delete e.textLayerAsset, { image: a, rotationCenter: n, assetMatchesBase: 1 === o && !s } })).finally((() => { delete e.textLayerMD5, delete e.textLayerAsset })) : Promise.reject("No V2 Bitmap adapter present.") : Promise.reject("Costume load failed. Assets were missing.") }(e, t, n).then((n => (n.assetMatchesBase || function (n) { if (!t.v2BitmapAdapter) return Promise.reject("No V2 Bitmap adapter present."); const r = t.storage; e.asset = r.createAsset(r.AssetType.ImageBitmap, r.DataFormat.PNG, t.v2BitmapAdapter.convertDataURIToBinary(n), null, !0), e.dataFormat = r.DataFormat.PNG, e.assetId = e.asset.assetId, e.md5 = "".concat(e.assetId, ".").concat(e.dataFormat) }((e => { if (e instanceof HTMLCanvasElement) return e.toDataURL(); const t = u.create(); t.width = e.width, t.height = e.height, t.getContext("2d").drawImage(e, 0, 0); const n = t.toDataURL(); return u.release(t), n })(n.image)), n))).then((n => { let r, { image: i, rotationCenter: s } = n; s && (r = [s[0] / 2, s[1] / 2]), e.skinId = t.renderer.createBitmapSkin(i, e.bitmapResolution, r); const o = t.renderer.getSkinSize(e.skinId); return e.size = [2 * o[0], 2 * o[1]], s || (s = t.renderer.getSkinRotationCenter(e.skinId), e.rotationCenterX = 2 * s[0], e.rotationCenterY = 2 * s[1], e.bitmapResolution = 2), t.isPackaged && (e.asset = null), e })) }, m = function (e, t) { const n = e.asset, r = e.assetId, i = e.rotationCenterX, s = e.rotationCenterY, o = e.bitmapResolution, a = e.dataFormat, l = t.storage.AssetType, u = e.dataFormat === l.ImageVector.runtimeFormat; e.assetId = u ? t.storage.defaultAssetId.ImageVector : t.storage.defaultAssetId.ImageBitmap, e.asset = t.storage.get(e.assetId), e.md5 = "".concat(e.assetId, ".").concat(e.asset.dataFormat); return (u ? c(e, t) : p(e, t)).then((e => (e.broken = {}, e.broken.assetId = r, e.broken.md5 = "".concat(r, ".").concat(a), e.broken.asset = n, e.broken.dataFormat = a, e.broken.rotationCenterX = i, e.broken.rotationCenterY = s, e.broken.bitmapResolution = o, e))) }, f = function (e, t, n) { e.assetId = e.asset.assetId; if (!t.renderer) return i.warn("No rendering module present; cannot load costume: ", e.name), Promise.resolve(e); const r = t.storage.AssetType; let s; return "number" != typeof e.rotationCenterX || isNaN(e.rotationCenterX) || "number" != typeof e.rotationCenterY || isNaN(e.rotationCenterY) || (s = [e.rotationCenterX, e.rotationCenterY]), e.asset.assetType.runtimeFormat === r.ImageVector.runtimeFormat ? c(e, t, s, n).catch((n => (i.warn("Error loading vector image: ".concat(n)), m(e, t)))) : p(e, t, s).catch((n => (i.warn("Error loading bitmap image: ".concat(n)), m(e, t)))) }; e.exports = { loadCostume: function (e, t, n, s) { const o = r.splitFirst(e, "."), a = o[0], l = o[1].toLowerCase(); if (t.dataFormat = l, t.asset) return f(t, n, s); if (!n.storage) return i.warn("No storage module present; cannot load costume asset: ", e), Promise.resolve(t); if (!n.storage.defaultAssetId) return i.warn("No default assets found"), Promise.resolve(t); const c = n.storage.AssetType, u = "svg" === l ? c.ImageVector : c.ImageBitmap, d = n.storage.load(u, a, l); let h; return h = t.textLayerMD5 ? n.storage.load(c.ImageBitmap, t.textLayerMD5, "png") : Promise.resolve(null), Promise.all([d, h]).then((e => e[0] ? (t.asset = e[0], e[1] && (t.textLayerAsset = e[1]), f(t, n, s)) : m(t, n))).catch((e => (i.warn("Error loading costume: ", e), m(t, n)))) }, loadCostumeFromAsset: f } }, function (e, t, n) { var r = n(37), i = r.TYPE, s = r.NAME, o = n(27).cmpStr, a = i.EOF, l = i.WhiteSpace, c = i.Comment, u = 16777215, d = 24, h = function () { this.offsetAndType = null, this.balance = null, this.reset() }; h.prototype = { reset: function () { this.eof = !1, this.tokenIndex = -1, this.tokenType = 0, this.tokenStart = this.firstCharOffset, this.tokenEnd = this.firstCharOffset }, lookupType: function (e) { return (e += this.tokenIndex) < this.tokenCount ? this.offsetAndType[e] >> d : a }, lookupOffset: function (e) { return (e += this.tokenIndex) < this.tokenCount ? this.offsetAndType[e - 1] & u : this.source.length }, lookupValue: function (e, t) { return (e += this.tokenIndex) < this.tokenCount && o(this.source, this.offsetAndType[e - 1] & u, this.offsetAndType[e] & u, t) }, getTokenStart: function (e) { return e === this.tokenIndex ? this.tokenStart : e > 0 ? e < this.tokenCount ? this.offsetAndType[e - 1] & u : this.offsetAndType[this.tokenCount] & u : this.firstCharOffset }, getRawLength: function (e, t) { var n, r = e, i = this.offsetAndType[Math.max(r - 1, 0)] & u; e: for (; r < this.tokenCount && !((n = this.balance[r]) < e); r++)switch (t(this.offsetAndType[r] >> d, this.source, i)) { case 1: break e; case 2: r++; break e; default: this.balance[n] === r && (r = n), i = this.offsetAndType[r] & u }return r - this.tokenIndex }, isBalanceEdge: function (e) { return this.balance[this.tokenIndex] < e }, isDelim: function (e, t) { return t ? this.lookupType(t) === i.Delim && this.source.charCodeAt(this.lookupOffset(t)) === e : this.tokenType === i.Delim && this.source.charCodeAt(this.tokenStart) === e }, getTokenValue: function () { return this.source.substring(this.tokenStart, this.tokenEnd) }, getTokenLength: function () { return this.tokenEnd - this.tokenStart }, substrToCursor: function (e) { return this.source.substring(e, this.tokenStart) }, skipWS: function () { for (var e = this.tokenIndex, t = 0; e < this.tokenCount && this.offsetAndType[e] >> d === l; e++, t++); t > 0 && this.skip(t) }, skipSC: function () { for (; this.tokenType === l || this.tokenType === c;)this.next() }, skip: function (e) { var t = this.tokenIndex + e; t < this.tokenCount ? (this.tokenIndex = t, this.tokenStart = this.offsetAndType[t - 1] & u, t = this.offsetAndType[t], this.tokenType = t >> d, this.tokenEnd = t & u) : (this.tokenIndex = this.tokenCount, this.next()) }, next: function () { var e = this.tokenIndex + 1; e < this.tokenCount ? (this.tokenIndex = e, this.tokenStart = this.tokenEnd, e = this.offsetAndType[e], this.tokenType = e >> d, this.tokenEnd = e & u) : (this.tokenIndex = this.tokenCount, this.eof = !0, this.tokenType = a, this.tokenStart = this.tokenEnd = this.source.length) }, forEachToken(e) { for (var t = 0, n = this.firstCharOffset; t < this.tokenCount; t++) { var r = n, i = this.offsetAndType[t], s = i & u; n = s, e(i >> d, r, s, t) } }, dump() { var e = new Array(this.tokenCount); return this.forEachToken(((t, n, r, i) => { e[i] = { idx: i, type: s[t], chunk: this.source.substring(n, r), balance: this.balance[i] } })), e } }, e.exports = h }, function (e, t) { var n = { EOF: 0, Ident: 1, Function: 2, AtKeyword: 3, Hash: 4, String: 5, BadString: 6, Url: 7, BadUrl: 8, Delim: 9, Number: 10, Percentage: 11, Dimension: 12, WhiteSpace: 13, CDO: 14, CDC: 15, Colon: 16, Semicolon: 17, Comma: 18, LeftSquareBracket: 19, RightSquareBracket: 20, LeftParenthesis: 21, RightParenthesis: 22, LeftCurlyBracket: 23, RightCurlyBracket: 24, Comment: 25 }, r = Object.keys(n).reduce((function (e, t) { return e[n[t]] = t, e }), {}); e.exports = { TYPE: n, NAME: r } }, function (e, t) { e.exports = { ID_NONE: -1, Events: { UseHighQualityRenderChanged: "UseHighQualityRenderChanged", AllowPrivateSkinAccessChanged: "AllowPrivateSkinAccessChanged", NativeSizeChanged: "NativeSizeChanged" } } }, function (e, t, n) { const r = n(31); r.enable(), e.exports = r("scratch-audioengine") }, function (module, exports, __webpack_require__) { (function (process, global) { var __WEBPACK_AMD_DEFINE_RESULT__; (function () { "use strict"; var ERROR = "input is invalid type", WINDOW = "object" == typeof window, root = WINDOW ? window : {}; root.JS_MD5_NO_WINDOW && (WINDOW = !1); var WEB_WORKER = !WINDOW && "object" == typeof self, NODE_JS = !root.JS_MD5_NO_NODE_JS && "object" == typeof process && process.versions && process.versions.node; NODE_JS ? root = global : WEB_WORKER && (root = self); var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && "object" == typeof module && module.exports, AMD = __webpack_require__(374), ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && "undefined" != typeof ArrayBuffer, HEX_CHARS = "0123456789abcdef".split(""), EXTRA = [128, 32768, 8388608, -2147483648], SHIFT = [0, 8, 16, 24], OUTPUT_TYPES = ["hex", "array", "digest", "buffer", "arrayBuffer", "base64"], BASE64_ENCODE_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), blocks = [], buffer8; if (ARRAY_BUFFER) { var buffer = new ArrayBuffer(68); buffer8 = new Uint8Array(buffer), blocks = new Uint32Array(buffer) } !root.JS_MD5_NO_NODE_JS && Array.isArray || (Array.isArray = function (e) { return "[object Array]" === Object.prototype.toString.call(e) }), !ARRAY_BUFFER || !root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function (e) { return "object" == typeof e && e.buffer && e.buffer.constructor === ArrayBuffer }); var createOutputMethod = function (e) { return function (t) { return new Md5(!0).update(t)[e]() } }, createMethod = function () { var e = createOutputMethod("hex"); NODE_JS && (e = nodeWrap(e)), e.create = function () { return new Md5 }, e.update = function (t) { return e.create().update(t) }; for (var t = 0; t < OUTPUT_TYPES.length; ++t) { var n = OUTPUT_TYPES[t]; e[n] = createOutputMethod(n) } return e }, nodeWrap = function (method) { var crypto = eval("require('crypto')"), Buffer = eval("require('buffer').Buffer"), nodeMethod = function (e) { if ("string" == typeof e) return crypto.createHash("md5").update(e, "utf8").digest("hex"); if (null == e) throw ERROR; return e.constructor === ArrayBuffer && (e = new Uint8Array(e)), Array.isArray(e) || ArrayBuffer.isView(e) || e.constructor === Buffer ? crypto.createHash("md5").update(new Buffer(e)).digest("hex") : method(e) }; return nodeMethod }; function Md5(e) { if (e) blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0, this.blocks = blocks, this.buffer8 = buffer8; else if (ARRAY_BUFFER) { var t = new ArrayBuffer(68); this.buffer8 = new Uint8Array(t), this.blocks = new Uint32Array(t) } else this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0 } Md5.prototype.update = function (e) { if (!this.finalized) { var t, n = typeof e; if ("string" !== n) { if ("object" !== n) throw ERROR; if (null === e) throw ERROR; if (ARRAY_BUFFER && e.constructor === ArrayBuffer) e = new Uint8Array(e); else if (!(Array.isArray(e) || ARRAY_BUFFER && ArrayBuffer.isView(e))) throw ERROR; t = !0 } for (var r, i, s = 0, o = e.length, a = this.blocks, l = this.buffer8; s < o;) { if (this.hashed && (this.hashed = !1, a[0] = a[16], a[16] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = a[9] = a[10] = a[11] = a[12] = a[13] = a[14] = a[15] = 0), t) if (ARRAY_BUFFER) for (i = this.start; s < o && i < 64; ++s)l[i++] = e[s]; else for (i = this.start; s < o && i < 64; ++s)a[i >> 2] |= e[s] << SHIFT[3 & i++]; else if (ARRAY_BUFFER) for (i = this.start; s < o && i < 64; ++s)(r = e.charCodeAt(s)) < 128 ? l[i++] = r : r < 2048 ? (l[i++] = 192 | r >> 6, l[i++] = 128 | 63 & r) : r < 55296 || r >= 57344 ? (l[i++] = 224 | r >> 12, l[i++] = 128 | r >> 6 & 63, l[i++] = 128 | 63 & r) : (r = 65536 + ((1023 & r) << 10 | 1023 & e.charCodeAt(++s)), l[i++] = 240 | r >> 18, l[i++] = 128 | r >> 12 & 63, l[i++] = 128 | r >> 6 & 63, l[i++] = 128 | 63 & r); else for (i = this.start; s < o && i < 64; ++s)(r = e.charCodeAt(s)) < 128 ? a[i >> 2] |= r << SHIFT[3 & i++] : r < 2048 ? (a[i >> 2] |= (192 | r >> 6) << SHIFT[3 & i++], a[i >> 2] |= (128 | 63 & r) << SHIFT[3 & i++]) : r < 55296 || r >= 57344 ? (a[i >> 2] |= (224 | r >> 12) << SHIFT[3 & i++], a[i >> 2] |= (128 | r >> 6 & 63) << SHIFT[3 & i++], a[i >> 2] |= (128 | 63 & r) << SHIFT[3 & i++]) : (r = 65536 + ((1023 & r) << 10 | 1023 & e.charCodeAt(++s)), a[i >> 2] |= (240 | r >> 18) << SHIFT[3 & i++], a[i >> 2] |= (128 | r >> 12 & 63) << SHIFT[3 & i++], a[i >> 2] |= (128 | r >> 6 & 63) << SHIFT[3 & i++], a[i >> 2] |= (128 | 63 & r) << SHIFT[3 & i++]); this.lastByteIndex = i, this.bytes += i - this.start, i >= 64 ? (this.start = i - 64, this.hash(), this.hashed = !0) : this.start = i } return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 | 0, this.bytes = this.bytes % 4294967296), this } }, Md5.prototype.finalize = function () { if (!this.finalized) { this.finalized = !0; var e = this.blocks, t = this.lastByteIndex; e[t >> 2] |= EXTRA[3 & t], t >= 56 && (this.hashed || this.hash(), e[0] = e[16], e[16] = e[1] = e[2] = e[3] = e[4] = e[5] = e[6] = e[7] = e[8] = e[9] = e[10] = e[11] = e[12] = e[13] = e[14] = e[15] = 0), e[14] = this.bytes << 3, e[15] = this.hBytes << 3 | this.bytes >>> 29, this.hash() } }, Md5.prototype.hash = function () { var e, t, n, r, i, s, o = this.blocks; this.first ? t = ((t = ((e = ((e = o[0] - 680876937) << 7 | e >>> 25) - 271733879 | 0) ^ (n = ((n = (-271733879 ^ (r = ((r = (-1732584194 ^ 2004318071 & e) + o[1] - 117830708) << 12 | r >>> 20) + e | 0) & (-271733879 ^ e)) + o[2] - 1126478375) << 17 | n >>> 15) + r | 0) & (r ^ e)) + o[3] - 1316259209) << 22 | t >>> 10) + n | 0 : (e = this.h0, t = this.h1, n = this.h2, t = ((t += ((e = ((e += ((r = this.h3) ^ t & (n ^ r)) + o[0] - 680876936) << 7 | e >>> 25) + t | 0) ^ (n = ((n += (t ^ (r = ((r += (n ^ e & (t ^ n)) + o[1] - 389564586) << 12 | r >>> 20) + e | 0) & (e ^ t)) + o[2] + 606105819) << 17 | n >>> 15) + r | 0) & (r ^ e)) + o[3] - 1044525330) << 22 | t >>> 10) + n | 0), t = ((t += ((e = ((e += (r ^ t & (n ^ r)) + o[4] - 176418897) << 7 | e >>> 25) + t | 0) ^ (n = ((n += (t ^ (r = ((r += (n ^ e & (t ^ n)) + o[5] + 1200080426) << 12 | r >>> 20) + e | 0) & (e ^ t)) + o[6] - 1473231341) << 17 | n >>> 15) + r | 0) & (r ^ e)) + o[7] - 45705983) << 22 | t >>> 10) + n | 0, t = ((t += ((e = ((e += (r ^ t & (n ^ r)) + o[8] + 1770035416) << 7 | e >>> 25) + t | 0) ^ (n = ((n += (t ^ (r = ((r += (n ^ e & (t ^ n)) + o[9] - 1958414417) << 12 | r >>> 20) + e | 0) & (e ^ t)) + o[10] - 42063) << 17 | n >>> 15) + r | 0) & (r ^ e)) + o[11] - 1990404162) << 22 | t >>> 10) + n | 0, t = ((t += ((e = ((e += (r ^ t & (n ^ r)) + o[12] + 1804603682) << 7 | e >>> 25) + t | 0) ^ (n = ((n += (t ^ (r = ((r += (n ^ e & (t ^ n)) + o[13] - 40341101) << 12 | r >>> 20) + e | 0) & (e ^ t)) + o[14] - 1502002290) << 17 | n >>> 15) + r | 0) & (r ^ e)) + o[15] + 1236535329) << 22 | t >>> 10) + n | 0, t = ((t += ((r = ((r += (t ^ n & ((e = ((e += (n ^ r & (t ^ n)) + o[1] - 165796510) << 5 | e >>> 27) + t | 0) ^ t)) + o[6] - 1069501632) << 9 | r >>> 23) + e | 0) ^ e & ((n = ((n += (e ^ t & (r ^ e)) + o[11] + 643717713) << 14 | n >>> 18) + r | 0) ^ r)) + o[0] - 373897302) << 20 | t >>> 12) + n | 0, t = ((t += ((r = ((r += (t ^ n & ((e = ((e += (n ^ r & (t ^ n)) + o[5] - 701558691) << 5 | e >>> 27) + t | 0) ^ t)) + o[10] + 38016083) << 9 | r >>> 23) + e | 0) ^ e & ((n = ((n += (e ^ t & (r ^ e)) + o[15] - 660478335) << 14 | n >>> 18) + r | 0) ^ r)) + o[4] - 405537848) << 20 | t >>> 12) + n | 0, t = ((t += ((r = ((r += (t ^ n & ((e = ((e += (n ^ r & (t ^ n)) + o[9] + 568446438) << 5 | e >>> 27) + t | 0) ^ t)) + o[14] - 1019803690) << 9 | r >>> 23) + e | 0) ^ e & ((n = ((n += (e ^ t & (r ^ e)) + o[3] - 187363961) << 14 | n >>> 18) + r | 0) ^ r)) + o[8] + 1163531501) << 20 | t >>> 12) + n | 0, t = ((t += ((r = ((r += (t ^ n & ((e = ((e += (n ^ r & (t ^ n)) + o[13] - 1444681467) << 5 | e >>> 27) + t | 0) ^ t)) + o[2] - 51403784) << 9 | r >>> 23) + e | 0) ^ e & ((n = ((n += (e ^ t & (r ^ e)) + o[7] + 1735328473) << 14 | n >>> 18) + r | 0) ^ r)) + o[12] - 1926607734) << 20 | t >>> 12) + n | 0, t = ((t += ((s = (r = ((r += ((i = t ^ n) ^ (e = ((e += (i ^ r) + o[5] - 378558) << 4 | e >>> 28) + t | 0)) + o[8] - 2022574463) << 11 | r >>> 21) + e | 0) ^ e) ^ (n = ((n += (s ^ t) + o[11] + 1839030562) << 16 | n >>> 16) + r | 0)) + o[14] - 35309556) << 23 | t >>> 9) + n | 0, t = ((t += ((s = (r = ((r += ((i = t ^ n) ^ (e = ((e += (i ^ r) + o[1] - 1530992060) << 4 | e >>> 28) + t | 0)) + o[4] + 1272893353) << 11 | r >>> 21) + e | 0) ^ e) ^ (n = ((n += (s ^ t) + o[7] - 155497632) << 16 | n >>> 16) + r | 0)) + o[10] - 1094730640) << 23 | t >>> 9) + n | 0, t = ((t += ((s = (r = ((r += ((i = t ^ n) ^ (e = ((e += (i ^ r) + o[13] + 681279174) << 4 | e >>> 28) + t | 0)) + o[0] - 358537222) << 11 | r >>> 21) + e | 0) ^ e) ^ (n = ((n += (s ^ t) + o[3] - 722521979) << 16 | n >>> 16) + r | 0)) + o[6] + 76029189) << 23 | t >>> 9) + n | 0, t = ((t += ((s = (r = ((r += ((i = t ^ n) ^ (e = ((e += (i ^ r) + o[9] - 640364487) << 4 | e >>> 28) + t | 0)) + o[12] - 421815835) << 11 | r >>> 21) + e | 0) ^ e) ^ (n = ((n += (s ^ t) + o[15] + 530742520) << 16 | n >>> 16) + r | 0)) + o[2] - 995338651) << 23 | t >>> 9) + n | 0, t = ((t += ((r = ((r += (t ^ ((e = ((e += (n ^ (t | ~r)) + o[0] - 198630844) << 6 | e >>> 26) + t | 0) | ~n)) + o[7] + 1126891415) << 10 | r >>> 22) + e | 0) ^ ((n = ((n += (e ^ (r | ~t)) + o[14] - 1416354905) << 15 | n >>> 17) + r | 0) | ~e)) + o[5] - 57434055) << 21 | t >>> 11) + n | 0, t = ((t += ((r = ((r += (t ^ ((e = ((e += (n ^ (t | ~r)) + o[12] + 1700485571) << 6 | e >>> 26) + t | 0) | ~n)) + o[3] - 1894986606) << 10 | r >>> 22) + e | 0) ^ ((n = ((n += (e ^ (r | ~t)) + o[10] - 1051523) << 15 | n >>> 17) + r | 0) | ~e)) + o[1] - 2054922799) << 21 | t >>> 11) + n | 0, t = ((t += ((r = ((r += (t ^ ((e = ((e += (n ^ (t | ~r)) + o[8] + 1873313359) << 6 | e >>> 26) + t | 0) | ~n)) + o[15] - 30611744) << 10 | r >>> 22) + e | 0) ^ ((n = ((n += (e ^ (r | ~t)) + o[6] - 1560198380) << 15 | n >>> 17) + r | 0) | ~e)) + o[13] + 1309151649) << 21 | t >>> 11) + n | 0, t = ((t += ((r = ((r += (t ^ ((e = ((e += (n ^ (t | ~r)) + o[4] - 145523070) << 6 | e >>> 26) + t | 0) | ~n)) + o[11] - 1120210379) << 10 | r >>> 22) + e | 0) ^ ((n = ((n += (e ^ (r | ~t)) + o[2] + 718787259) << 15 | n >>> 17) + r | 0) | ~e)) + o[9] - 343485551) << 21 | t >>> 11) + n | 0, this.first ? (this.h0 = e + 1732584193 | 0, this.h1 = t - 271733879 | 0, this.h2 = n - 1732584194 | 0, this.h3 = r + 271733878 | 0, this.first = !1) : (this.h0 = this.h0 + e | 0, this.h1 = this.h1 + t | 0, this.h2 = this.h2 + n | 0, this.h3 = this.h3 + r | 0) }, Md5.prototype.hex = function () { this.finalize(); var e = this.h0, t = this.h1, n = this.h2, r = this.h3; return HEX_CHARS[e >> 4 & 15] + HEX_CHARS[15 & e] + HEX_CHARS[e >> 12 & 15] + HEX_CHARS[e >> 8 & 15] + HEX_CHARS[e >> 20 & 15] + HEX_CHARS[e >> 16 & 15] + HEX_CHARS[e >> 28 & 15] + HEX_CHARS[e >> 24 & 15] + HEX_CHARS[t >> 4 & 15] + HEX_CHARS[15 & t] + HEX_CHARS[t >> 12 & 15] + HEX_CHARS[t >> 8 & 15] + HEX_CHARS[t >> 20 & 15] + HEX_CHARS[t >> 16 & 15] + HEX_CHARS[t >> 28 & 15] + HEX_CHARS[t >> 24 & 15] + HEX_CHARS[n >> 4 & 15] + HEX_CHARS[15 & n] + HEX_CHARS[n >> 12 & 15] + HEX_CHARS[n >> 8 & 15] + HEX_CHARS[n >> 20 & 15] + HEX_CHARS[n >> 16 & 15] + HEX_CHARS[n >> 28 & 15] + HEX_CHARS[n >> 24 & 15] + HEX_CHARS[r >> 4 & 15] + HEX_CHARS[15 & r] + HEX_CHARS[r >> 12 & 15] + HEX_CHARS[r >> 8 & 15] + HEX_CHARS[r >> 20 & 15] + HEX_CHARS[r >> 16 & 15] + HEX_CHARS[r >> 28 & 15] + HEX_CHARS[r >> 24 & 15] }, Md5.prototype.toString = Md5.prototype.hex, Md5.prototype.digest = function () { this.finalize(); var e = this.h0, t = this.h1, n = this.h2, r = this.h3; return [255 & e, e >> 8 & 255, e >> 16 & 255, e >> 24 & 255, 255 & t, t >> 8 & 255, t >> 16 & 255, t >> 24 & 255, 255 & n, n >> 8 & 255, n >> 16 & 255, n >> 24 & 255, 255 & r, r >> 8 & 255, r >> 16 & 255, r >> 24 & 255] }, Md5.prototype.array = Md5.prototype.digest, Md5.prototype.arrayBuffer = function () { this.finalize(); var e = new ArrayBuffer(16), t = new Uint32Array(e); return t[0] = this.h0, t[1] = this.h1, t[2] = this.h2, t[3] = this.h3, e }, Md5.prototype.buffer = Md5.prototype.arrayBuffer, Md5.prototype.base64 = function () { for (var e, t, n, r = "", i = this.array(), s = 0; s < 15;)e = i[s++], t = i[s++], n = i[s++], r += BASE64_ENCODE_CHAR[e >>> 2] + BASE64_ENCODE_CHAR[63 & (e << 4 | t >>> 4)] + BASE64_ENCODE_CHAR[63 & (t << 2 | n >>> 6)] + BASE64_ENCODE_CHAR[63 & n]; return e = i[s], r += BASE64_ENCODE_CHAR[e >>> 2] + BASE64_ENCODE_CHAR[e << 4 & 63] + "==" }; var exports = createMethod(); COMMON_JS ? module.exports = exports : (root.md5 = exports, AMD && (__WEBPACK_AMD_DEFINE_RESULT__ = function () { return exports }.call(exports, __webpack_require__, exports, module), void 0 === __WEBPACK_AMD_DEFINE_RESULT__ || (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))) })() }).call(this, __webpack_require__(41), __webpack_require__(9)) }, function (e, t) { var n, r, i = e.exports = {}; function s() { throw new Error("setTimeout has not been defined") } function o() { throw new Error("clearTimeout has not been defined") } function a(e) { if (n === setTimeout) return setTimeout(e, 0); if ((n === s || !n) && setTimeout) return n = setTimeout, setTimeout(e, 0); try { return n(e, 0) } catch (t) { try { return n.call(null, e, 0) } catch (t) { return n.call(this, e, 0) } } } !function () { try { n = "function" == typeof setTimeout ? setTimeout : s } catch (e) { n = s } try { r = "function" == typeof clearTimeout ? clearTimeout : o } catch (e) { r = o } }(); var l, c = [], u = !1, d = -1; function h() { u && l && (u = !1, l.length ? c = l.concat(c) : d = -1, c.length && p()) } function p() { if (!u) { var e = a(h); u = !0; for (var t = c.length; t;) { for (l = c, c = []; ++d < t;)l && l[d].run(); d = -1, t = c.length } l = null, u = !1, function (e) { if (r === clearTimeout) return clearTimeout(e); if ((r === o || !r) && clearTimeout) return r = clearTimeout, clearTimeout(e); try { return r(e) } catch (t) { try { return r.call(null, e) } catch (t) { return r.call(this, e) } } }(e) } } function m(e, t) { this.fun = e, this.array = t } function f() { } i.nextTick = function (e) { var t = new Array(arguments.length - 1); if (arguments.length > 1) for (var n = 1; n < arguments.length; n++)t[n - 1] = arguments[n]; c.push(new m(e, t)), 1 !== c.length || u || a(p) }, m.prototype.run = function () { this.fun.apply(null, this.array) }, i.title = "browser", i.browser = !0, i.env = {}, i.argv = [], i.version = "", i.versions = {}, i.on = f, i.addListener = f, i.once = f, i.off = f, i.removeListener = f, i.removeAllListeners = f, i.emit = f, i.prependListener = f, i.prependOnceListener = f, i.listeners = function (e) { return [] }, i.binding = function (e) { throw new Error("process.binding is not supported") }, i.cwd = function () { return "/" }, i.chdir = function (e) { throw new Error("process.chdir is not supported") }, i.umask = function () { return 0 } }, function (e, t) { e.exports = { SPRITE: "sprite", STAGE: "stage" } }, function (e, t, n) { const r = n(14); e.exports = class { constructor(e) { this._maxTokens = e, this._refillInterval = 1e3 / e, this._count = this._maxTokens, this._timer = new r, this._timer.start(), this._lastUpdateTime = this._timer.timeElapsed() } okayToSend() { const e = this._timer.timeElapsed(), t = e - this._lastUpdateTime, n = Math.floor(t / this._refillInterval); return n > 0 && (this._lastUpdateTime = e), this._count = Math.min(this._maxTokens, this._count + n), this._count > 0 && (this._count--, !0) } } }, function (e, t, n) { (function (t) { let n = t.fetch; e.exports = { fetchWithTimeout: (e, t, r) => { let i = null; const s = window.AbortController ? new window.AbortController : null, o = s ? s.signal : null; return Promise.race([n(e, Object.assign({ signal: o }, t)).then((e => (clearTimeout(i), e)), (e => { throw clearTimeout(i), e })), new Promise(((e, t) => { i = setTimeout((() => { s && s.abort(), t(new Error("Fetch timed out after ".concat(r, " ms"))) }), r) }))]) }, setFetch: e => { n = e } } }).call(this, n(9)) }, function (e, t, n) { function r(e, t) { var n = Object.keys(e); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(e); t && (r = r.filter((function (t) { return Object.getOwnPropertyDescriptor(e, t).enumerable }))), n.push.apply(n, r) } return n } function i(e, t, n) { return (t = function (e) { var t = function (e, t) { if ("object" != typeof e || !e) return e; var n = e[Symbol.toPrimitive]; if (void 0 !== n) { var r = n.call(e, t || "default"); if ("object" != typeof r) return r; throw new TypeError("@@toPrimitive must return a primitive value.") } return ("string" === t ? String : Number)(e) }(e, "string"); return "symbol" == typeof t ? t : t + "" }(t)) in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e } const s = n(19), { OrderedMap: o } = n(24), a = n(73), l = n(416), c = n(4), u = n(16), d = n(77), h = n(3), p = n(206), m = n(207), f = n(50), g = n(49), y = n(213), b = n(42), v = n(25), S = n(1), w = n(67), k = n(13), T = n(10), x = n(33), E = n(214), A = n(215), C = n(44), I = n(217), O = n(218), M = n(219), N = n(220), R = n(221), D = n(222), P = n(223), L = n(81), B = n(7), z = n(8), U = { scratch3_control: n(224), scratch3_event: n(225), scratch3_looks: n(226), scratch3_motion: n(227), scratch3_operators: n(228), scratch3_sound: n(229), scratch3_sensing: n(230), scratch3_data: n(231), scratch3_procedures: n(232) }, j = n(233), F = n(234), W = ["#0FBD8C", "#0DA57A", "#0B8E69"], V = " // _twconfig_", G = (() => { const e = {}; return e[c.ANGLE] = { shadow: { type: "math_angle", fieldName: "NUM" } }, e[c.COLOR] = { shadow: { type: "colour_picker", fieldName: "COLOUR" } }, e[c.NUMBER] = { shadow: { type: "math_number", fieldName: "NUM" } }, e[c.STRING] = { shadow: { type: "text", fieldName: "TEXT" } }, e[c.BOOLEAN] = { check: "Boolean" }, e[c.MATRIX] = { shadow: { type: "matrix", fieldName: "MATRIX" } }, e[c.NOTE] = { shadow: { type: "note", fieldName: "NOTE" } }, e[c.IMAGE] = { fieldType: "field_image" }, e[c.COSTUME] = { shadow: { type: "looks_costume", fieldName: "COSTUME" } }, e[c.SOUND] = { shadow: { type: "sound_sounds_menu", fieldName: "SOUND_MENU" } }, e })(), q = e => { let t = 0; return { canAddCloudVariable: () => t < e.limit, addCloudVariable: () => { t++ }, removeCloudVariable: () => { t-- }, hasCloudVariables: () => t > 0, getNumberOfCloudVariables: () => t } }; let Y = -1, H = -1, _ = -1; class K extends s { constructor() { super(), this.targets = [], this.executableTargets = [], this.threads = [], this.threadMap = new Map, this.sequencer = new m(this), this.flyoutBlocks = new u(this, !0), this.monitorBlocks = new u(this, !0), this._editingTarget = null, this._primitives = {}, this._blockInfo = [], this._hats = {}, this._flowing = {}, this._scriptGlowsPreviousFrame = [], this._nonMonitorThreadCount = 0, this._lastStepDoneThreads = null, this._cloneCounter = 0, this._refreshTargets = !1, this.monitorBlockInfo = {}, this._monitorState = o({}), this._prevMonitorState = o({}), this.turboMode = !1, this.frameLoop = new F(this), this.currentStepTime = 1e3 / 30, this.updateCurrentMSecs(), this.redrawRequested = !1, this._registerBlockPackages(), this.ioDevices = { clock: new O(this), cloud: new M(this), keyboard: new N(this), mouse: new R(this), mouseWheel: new D(this), userData: new P, video: new L(this) }, this.peripheralExtensions = {}, this.profiler = null, this.cloudOptions = { limit: 10 }; const e = q(this.cloudOptions); this.hasCloudData = e.hasCloudVariables, this.canAddCloudVariable = e.canAddCloudVariable, this.getNumberOfCloudVariables = e.getNumberOfCloudVariables, this.addCloudVariable = this._initializeAddCloudVariable(e), this.removeCloudVariable = this._initializeRemoveCloudVariable(e), this.origin = null, this.platform = Object.assign({}, I), this._initScratchLink(), this.resetRunId(), this._stageTarget = null, this.addonBlocks = {}, this.stageWidth = K.STAGE_WIDTH, this.stageHeight = K.STAGE_HEIGHT, this.runtimeOptions = { maxClones: K.MAX_CLONES, miscLimits: !0, fencing: !0 }, this.compilerOptions = { enabled: !0, warpTimer: !1 }, this.debug = !1, this._lastStepTime = Date.now(), this.interpolationEnabled = !1, this._defaultStoredSettings = this._generateAllProjectOptions(), this.isPackaged = !1, this.externalCommunicationMethods = { cloudVariables: !1, customExtensions: !1 }, this.on(K.HAS_CLOUD_DATA_UPDATE, (e => { this.setExternalCommunicationMethod("cloudVariables", e) })), this.enforcePrivacy = !0, this.extensionButtons = new Map, this.fontManager = new A(this), this.extensionStorage = {}, this.totalAssetRequests = 0, this.finishedAssetRequests = 0 } static get STAGE_WIDTH() { return 480 } static get STAGE_HEIGHT() { return 360 } static get SCRIPT_GLOW_ON() { return "SCRIPT_GLOW_ON" } static get SCRIPT_GLOW_OFF() { return "SCRIPT_GLOW_OFF" } static get BLOCK_GLOW_ON() { return "BLOCK_GLOW_ON" } static get BLOCK_GLOW_OFF() { return "BLOCK_GLOW_OFF" } static get HAS_CLOUD_DATA_UPDATE() { return "HAS_CLOUD_DATA_UPDATE" } static get TURBO_MODE_ON() { return "TURBO_MODE_ON" } static get TURBO_MODE_OFF() { return "TURBO_MODE_OFF" } static get RUNTIME_OPTIONS_CHANGED() { return "RUNTIME_OPTIONS_CHANGED" } static get COMPILER_OPTIONS_CHANGED() { return "COMPILER_OPTIONS_CHANGED" } static get FRAMERATE_CHANGED() { return "FRAMERATE_CHANGED" } static get INTERPOLATION_CHANGED() { return "INTERPOLATION_CHANGED" } static get STAGE_SIZE_CHANGED() { return "STAGE_SIZE_CHANGED" } static get COMPILE_ERROR() { return "COMPILE_ERROR" } static get BEFORE_EXECUTE() { return "BEFORE_EXECUTE" } static get AFTER_EXECUTE() { return "AFTER_EXECUTE" } static get ASSET_PROGRESS() { return "ASSET_PROGRESS" } static get PROJECT_START() { return "PROJECT_START" } static get PROJECT_RUN_START() { return "PROJECT_RUN_START" } static get PROJECT_RUN_STOP() { return "PROJECT_RUN_STOP" } static get PROJECT_STOP_ALL() { return "PROJECT_STOP_ALL" } static get STOP_FOR_TARGET() { return "STOP_FOR_TARGET" } static get VISUAL_REPORT() { return "VISUAL_REPORT" } static get PROJECT_LOADED() { return "PROJECT_LOADED" } static get PROJECT_CHANGED() { return "PROJECT_CHANGED" } static get TOOLBOX_EXTENSIONS_NEED_UPDATE() { return "TOOLBOX_EXTENSIONS_NEED_UPDATE" } static get TARGETS_UPDATE() { return "TARGETS_UPDATE" } static get MONITORS_UPDATE() { return "MONITORS_UPDATE" } static get BLOCK_DRAG_UPDATE() { return "BLOCK_DRAG_UPDATE" } static get BLOCK_DRAG_END() { return "BLOCK_DRAG_END" } static get EXTENSION_ADDED() { return "EXTENSION_ADDED" } static get EXTENSION_FIELD_ADDED() { return "EXTENSION_FIELD_ADDED" } static get PERIPHERAL_LIST_UPDATE() { return "PERIPHERAL_LIST_UPDATE" } static get USER_PICKED_PERIPHERAL() { return "USER_PICKED_PERIPHERAL" } static get PERIPHERAL_CONNECTED() { return "PERIPHERAL_CONNECTED" } static get PERIPHERAL_DISCONNECTED() { return "PERIPHERAL_DISCONNECTED" } static get PERIPHERAL_REQUEST_ERROR() { return "PERIPHERAL_REQUEST_ERROR" } static get PERIPHERAL_CONNECTION_LOST_ERROR() { return "PERIPHERAL_CONNECTION_LOST_ERROR" } static get PERIPHERAL_SCAN_TIMEOUT() { return "PERIPHERAL_SCAN_TIMEOUT" } static get MIC_LISTENING() { return "MIC_LISTENING" } static get BLOCKSINFO_UPDATE() { return "BLOCKSINFO_UPDATE" } static get RUNTIME_STARTED() { return "RUNTIME_STARTED" } static get RUNTIME_STOPPED() { return "RUNTIME_STOPPED" } static get RUNTIME_DISPOSED() { return "RUNTIME_DISPOSED" } static get BLOCKS_NEED_UPDATE() { return "BLOCKS_NEED_UPDATE" } static get PLATFORM_MISMATCH() { return "PLATFORM_MISMATCH" } static get THREAD_STEP_INTERVAL() { return 1e3 / 60 } static get THREAD_STEP_INTERVAL_COMPATIBILITY() { return 1e3 / 30 } static get MAX_CLONES() { return 300 } _initializeAddCloudVariable(e) { return () => { const t = this.hasCloudData(); e.addCloudVariable(), !t && this.hasCloudData() && this.emit(K.HAS_CLOUD_DATA_UPDATE, !0) } } _initializeRemoveCloudVariable(e) { return () => { const t = this.hasCloudData(); e.removeCloudVariable(), t && !this.hasCloudData() && this.emit(K.HAS_CLOUD_DATA_UPDATE, !1) } } _registerBlockPackages() { for (const e in U) if (Object.prototype.hasOwnProperty.call(U, e)) { const t = new U[e](this); if (t.getPrimitives) { const e = t.getPrimitives(); for (const n in e) Object.prototype.hasOwnProperty.call(e, n) && (this._primitives[n] = e[n].bind(t)) } if (t.getHats) { const e = t.getHats(); for (const t in e) Object.prototype.hasOwnProperty.call(e, t) && (this._hats[t] = e[t]) } t.getMonitored && (this.monitorBlockInfo = Object.assign({}, this.monitorBlockInfo, t.getMonitored())), this.compilerRegisterExtension(e, t) } } compilerRegisterExtension(e, t) { this["ext_".concat(e)] = t } getMonitorState() { return this._monitorState } _makeExtensionMenuId(e, t) { return "".concat(t, "_menu_").concat(e) } makeMessageContextForTarget(e) { const t = {}; (e = e || this.getEditingTarget() || this.getTargetForStage()) && (t.targetType = e.isStage ? b.STAGE : b.SPRITE) } _registerExtensionPrimitives(e) { const t = { id: e.id, name: w(e.name), showStatusButton: e.showStatusButton, blockIconURI: e.blockIconURI, menuIconURI: e.menuIconURI }; e.color1 ? (t.color1 = e.color1, t.color2 = e.color2, t.color3 = e.color3) : (t.color1 = W[0], t.color2 = W[1], t.color3 = W[2]), this._blockInfo.push(t), this._fillExtensionCategory(t, e); for (const n in t.customFieldTypes) if (Object.prototype.hasOwnProperty.call(e.customFieldTypes, n)) { const e = t.customFieldTypes[n]; this.emit(K.EXTENSION_FIELD_ADDED, { name: "field_".concat(e.extendedName), implementation: e.fieldImplementation }) } this.emit(K.EXTENSION_ADDED, t) } _refreshExtensionPrimitives(e) { const t = this._blockInfo.find((t => t.id === e.id)); t && (t.name = w(e.name), this._fillExtensionCategory(t, e), this.emit(K.BLOCKSINFO_UPDATE, t)) } _fillExtensionCategory(e, t) { e.blocks = [], e.customFieldTypes = {}, e.menus = [], e.menuInfo = {}; for (const n in t.menus) if (Object.prototype.hasOwnProperty.call(t.menus, n)) { const r = t.menus[n], i = this._buildMenuForScratchBlocks(n, r, e); e.menus.push(i), e.menuInfo[n] = r } for (const n in t.customFieldTypes) if (Object.prototype.hasOwnProperty.call(t.customFieldTypes, n)) { const r = t.customFieldTypes[n], i = this._buildCustomFieldInfo(n, r, t.id, e); e.customFieldTypes[n] = i } if (t.docsURI) { const n = { info: {}, xml: "') }; e.blocks.push(n) } for (const n of t.blocks) try { const t = this._convertForScratchBlocks(n, e); if (e.blocks.push(t), t.json) { const e = t.json.type; n.blockType !== h.EVENT && (this._primitives[e] = t.info.func), n.blockType === h.EVENT || n.blockType === h.HAT ? this._hats[e] = { edgeActivated: n.isEdgeActivated, restartExistingThreads: n.shouldRestartExistingThreads } : n.blockType === h.CONDITIONAL ? this._flowing[e] = { conditional: !0, loop: !1 } : n.blockType === h.LOOP && (this._flowing[e] = { conditional: !1, loop: !0 }) } } catch (e) { S.error("Error parsing block: ", { block: n, error: e }) } } _convertMenuItems(e) { if ("function" != typeof e) { const t = this.makeMessageContextForTarget(); return e.map((e => { const n = w(e, t); switch (typeof n) { case "string": return [n, n]; case "object": return [w(e.text, t), e.value]; default: throw new Error("Can't interpret menu item: ".concat(JSON.stringify(e))) } })) } return e } _buildMenuForScratchBlocks(e, t, n) { const r = this._makeExtensionMenuId(e, n.id), i = this._convertMenuItems(t.items); return { json: { message0: "%1", type: r, inputsInline: !0, output: "String", colour: n.color1, colourSecondary: n.color2, colourTertiary: n.color3, outputShape: t.acceptReporters ? y.OUTPUT_SHAPE_ROUND : y.OUTPUT_SHAPE_SQUARE, args0: [{ type: "field_dropdown", name: e, options: i }] } } } _buildCustomFieldInfo(e, t, n, r) { const i = "".concat(n, "_").concat(e); return { fieldName: e, extendedName: i, argumentTypeInfo: { shadow: { type: i, fieldName: "field_".concat(i) } }, scratchBlocksDefinition: this._buildCustomFieldTypeForScratchBlocks(i, t.output, t.outputShape, r), fieldImplementation: t.implementation } } _buildCustomFieldTypeForScratchBlocks(e, t, n, r) { return { json: { type: e, message0: "%1", inputsInline: !0, output: t, colour: r.color1, colourSecondary: r.color2, colourTertiary: r.color3, outputShape: n, args0: [{ name: "field_".concat(e), type: "field_".concat(e) }] } } } _convertForScratchBlocks(e, t) { return "---" === e ? this._convertSeparatorForScratchBlocks(e) : e.blockType === h.LABEL ? this._convertLabelForScratchBlocks(e) : e.blockType === h.BUTTON ? this._convertButtonForScratchBlocks(e, t) : e.blockType === h.XML ? this._convertXmlForScratchBlocks(e) : this._convertBlockForScratchBlocks(e, t) } _convertBlockForScratchBlocks(e, t) { var n, r, i; const s = "".concat(t.id, "_").concat(e.opcode), o = { type: s, inputsInline: !0, category: t.name, extensions: [], colour: null !== (n = e.color1) && void 0 !== n ? n : t.color1, colourSecondary: null !== (r = e.color2) && void 0 !== r ? r : t.color2, colourTertiary: null !== (i = e.color3) && void 0 !== i ? i : t.color3 }, a = { argsMap: {}, blockJSON: o, categoryInfo: t, blockInfo: e, inputList: [] }, l = e.blockIconURI || t.blockIconURI; if (o.extensions.push("from_extension"), o.colour === W[0] && o.colourSecondary === W[1] && o.colourTertiary === W[2] && o.extensions.push("default_extension_colors"), l) { o.extensions.push("scratch_extension"), o.message0 = "%1 %2"; const e = { type: "field_image", src: l, width: 40, height: 40 }, t = { type: "field_vertical_separator" }; o.args0 = [e, t] } switch (e.blockType) { case h.COMMAND: o.outputShape = y.OUTPUT_SHAPE_SQUARE, o.previousStatement = null, e.isTerminal || (o.nextStatement = null); break; case h.REPORTER: o.output = e.allowDropAnywhere ? null : "String", o.outputShape = y.OUTPUT_SHAPE_ROUND; break; case h.BOOLEAN: o.output = "Boolean", o.outputShape = y.OUTPUT_SHAPE_HEXAGONAL; break; case h.HAT: case h.EVENT: Object.prototype.hasOwnProperty.call(e, "isEdgeActivated") || (e.isEdgeActivated = !0), o.outputShape = y.OUTPUT_SHAPE_SQUARE, o.nextStatement = null; break; case h.CONDITIONAL: case h.LOOP: e.branchCount = e.branchCount || 1, o.outputShape = y.OUTPUT_SHAPE_SQUARE, o.previousStatement = null, e.isTerminal || (o.nextStatement = null) }const c = Array.isArray(e.text) ? e.text : [e.text]; let u = 0, d = 0, p = 0; const m = this._convertPlaceholders.bind(this, a), f = this.makeMessageContextForTarget(); for (; u < c.length || d < e.branchCount;) { if (u < c.length) { a.outLineNum = p; const e = w(c[u], f).replace(/\[(.+?)]/g, m); o["message".concat(p)] ? o["message".concat(p)] += e : o["message".concat(p)] = e, ++u, ++p } d < e.branchCount && (o["message".concat(p)] = "%1", o["args".concat(p)] = [{ type: "input_statement", name: "SUBSTACK".concat(d > 0 ? d + 1 : "") }], ++d, ++p) } if (e.blockType === h.REPORTER || e.blockType === h.BOOLEAN) e.disableMonitor || 0 !== a.inputList.length || (o.checkboxInFlyout = !0); else if (e.branchIconURI || e.blockType === h.LOOP && !Object.prototype.hasOwnProperty.call(e, "branchIconURI")) { var g; o["lastDummyAlign".concat(p)] = "RIGHT", o["message".concat(p)] = "%1", o["args".concat(p)] = [{ type: "field_image", src: null !== (g = e.branchIconURI) && void 0 !== g ? g : "media://repeat.svg", width: 24, height: 24, alt: "*", flip_rtl: !0 }], ++p } const b = e.isDynamic ? '') : "", v = a.inputList.join(""), S = '').concat(b).concat(v, ""); if (e.extensions) for (const t of e.extensions) o.extensions.includes(t) || o.extensions.push(t); return { info: a.blockInfo, json: a.blockJSON, xml: S } } _convertSeparatorForScratchBlocks(e) { return { info: e, xml: '' } } _convertLabelForScratchBlocks(e) { return { info: e, xml: '') } } _convertButtonForScratchBlocks(e, t) { const n = this.makeMessageContextForTarget(), r = w(e.text, n); if (["MAKE_A_LIST", "MAKE_A_PROCEDURE", "MAKE_A_VARIABLE"].includes(e.func)) return { info: e, xml: '') }; const i = "".concat(t.id, "_").concat(e.func); return this.extensionButtons.set(i, e.callFunc), { info: e, xml: '') } } _convertXmlForScratchBlocks(e) { return { info: e, xml: e.xml } } handleExtensionButtonPress(e) { this.extensionButtons.get(e)() } _constructInlineImageJson(e) { return e.dataURI || S.warn("Missing data URI in extension block with argument type IMAGE"), { type: "field_image", src: e.dataURI || "", width: 24, height: 24, flip_rtl: e.flipRTL || !1 } } _convertPlaceholders(e, t, n) { const r = e.blockInfo.arguments[n] || {}; let i, s = G[r.type] || {}; if (!G[r.type] && e.categoryInfo.customFieldTypes[r.type] && (s = e.categoryInfo.customFieldTypes[r.type].argumentTypeInfo), "field_image" === s.fieldType) i = this._constructInlineImageJson(r); else { i = { type: "input_value", name: n }; const t = void 0 === r.defaultValue ? null : w(r.defaultValue, this.makeMessageContextForTarget()).toString(); let o, a, l; if (s.check && (i.check = s.check), r.menu) { const t = e.categoryInfo.menuInfo[r.menu]; t.acceptReporters ? (o = n, a = this._makeExtensionMenuId(r.menu, e.categoryInfo.id), l = r.menu) : (i.type = "field_dropdown", i.options = this._convertMenuItems(t.items), o = null, a = null, l = n) } else o = n, a = s.shadow && s.shadow.type || null, l = s.shadow && s.shadow.fieldName || null; o && e.inputList.push('')), a && e.inputList.push('')), null !== t && l && e.inputList.push('').concat(x(t), "")), a && e.inputList.push(""), o && e.inputList.push("") } const o = "args".concat(e.outLineNum), a = e.blockJSON[o] = e.blockJSON[o] || []; i && a.push(i); const l = a.length; return e.argsMap[n] = l, "%".concat(l) } getBlocksXML(e) { return this._blockInfo.map((t => { const { name: n, color1: r, color2: i } = t, s = t.blocks.filter((t => { let n = !0; return e && t.info.filter && (n = t.info.filter.includes(e.isStage ? b.STAGE : b.SPRITE)), n && !t.info.hideFromPalette })), o = 'colour="'.concat(x(r), '" secondaryColour="').concat(x(i), '"'); let a = ""; t.menuIconURI ? a = t.menuIconURI : t.blockIconURI && (a = t.blockIconURI); const l = a ? 'iconURI="'.concat(x(a), '"') : ""; let c = ""; t.showStatusButton && (c = 'showStatusButton="true"'); let u = '"), u += s.map((e => e.xml)).join(""), u += "", { id: t.id, xml: u } })) } getBlocksJSON() { return this._blockInfo.reduce(((e, t) => e.concat(t.blocks.map((e => e.json)))), []) } _initScratchLink() { if ("undefined" != typeof self && "undefined" != typeof document && document.getElementById && self.origin && "null" !== self.origin && self.navigator && self.navigator.userAgent && !self.navigator.userAgent.includes("Node.js") && !self.navigator.userAgent.includes("jsdom")) { if (!document.getElementById("scratch-link-extension-script")) { const e = document.createElement("script"); e.id = "scratch-link-extension-script", document.body.appendChild(e), self.postMessage("inject-scratch-link-script", self.origin) } } } getScratchLinkSocket(e) { return (this._linkSocketFactory || this._defaultScratchLinkSocketFactory)(e) } configureScratchLinkSocketFactory(e) { this._linkSocketFactory = e } _defaultScratchLinkSocketFactory(e) { const t = self.Scratch, n = t && t.ScratchLinkSafariSocket; return n && n.isSafariHelperCompatible() ? new n(e) : new E(e) } registerPeripheralExtension(e, t) { this.peripheralExtensions[e] = t } scanForPeripheral(e) { this.peripheralExtensions[e] && this.peripheralExtensions[e].scan() } connectPeripheral(e, t) { this.peripheralExtensions[e] && this.peripheralExtensions[e].connect(t) } disconnectPeripheral(e) { this.peripheralExtensions[e] && this.peripheralExtensions[e].disconnect() } getPeripheralIsConnected(e) { let t = !1; return this.peripheralExtensions[e] && (t = this.peripheralExtensions[e].isConnected()), t } emitMicListening(e) { this.emit(K.MIC_LISTENING, e) } getOpcodeFunction(e) { return this._primitives[e] } getIsHat(e) { return Object.prototype.hasOwnProperty.call(this._hats, e) } getIsEdgeActivatedHat(e) { return Object.prototype.hasOwnProperty.call(this._hats, e) && this._hats[e].edgeActivated } attachAudioEngine(e) { this.audioEngine = e } attachRenderer(e) { this.renderer = e, this.renderer.setLayerGroupOrdering(k.LAYER_GROUPS), this.renderer.offscreenTouching = !this.runtimeOptions.fencing, this.updatePrivacy() } attachV2BitmapAdapter(e) { this.v2BitmapAdapter = e } attachStorage(e) { if (this.storage = e, this.isPackaged) { const t = e.createAsset; let n = 0; e.createAsset = function (e, r, i, s, o) { return s || (s = (++n).toString()), t.call(this, e, r, i, s, !1) } } C.setFetch(e.scratchFetch.scratchFetch), this.resetRunId() } _pushThread(e, t, n) { const r = new v(e); return r.target = t, r.stackClick = Boolean(n && n.stackClick), r.updateMonitor = Boolean(n && n.updateMonitor), r.blockContainer = r.updateMonitor ? this.monitorBlocks : t.blocks, r.pushStack(e), this.threads.push(r), r.stackClick || r.updateMonitor || this.threadMap.set(r.getId(), r), n && n.updateMonitor || !this.compilerOptions.enabled || r.tryCompile(), r } _stopThread(e) { e.isKilled = !0, this.sequencer.retireThread(e) } _restartThread(e) { const t = new v(e.topBlock); t.target = e.target, t.stackClick = e.stackClick, t.updateMonitor = e.updateMonitor, t.blockContainer = e.blockContainer, t.pushStack(e.topBlock), e.triedToCompile && this.compilerOptions.enabled && t.tryCompile(), t.stackClick || t.updateMonitor || this.threadMap.set(t.getId(), t); const n = this.threads.indexOf(e); return n > -1 ? (this.threads[n] = t, t) : (this.threads.push(e), e) } emitCompileError(e, t) { this.emit(K.COMPILE_ERROR, e, t) } isActiveThread(e) { return e.stack.length > 0 && e.status !== v.STATUS_DONE && this.threads.indexOf(e) > -1 } isWaitingThread(e) { return e.status === v.STATUS_PROMISE_WAIT || e.status === v.STATUS_YIELD_TICK || !this.isActiveThread(e) } toggleScript(e, t) { t = Object.assign({ target: this._editingTarget, stackClick: !1 }, t); for (let n = 0; n < this.threads.length; n++)if (this.threads[n].topBlock === e && this.threads[n].status !== v.STATUS_DONE) { const r = t.target.blocks, i = r.getOpcode(r.getBlock(e)); if (this.getIsEdgeActivatedHat(i) && this.threads[n].stackClick !== t.stackClick) continue; return void this._stopThread(this.threads[n]) } this._pushThread(e, t.target, t) } addMonitorScript(e, t) { t || (t = this._editingTarget); for (let t = 0; t < this.threads.length; t++)if (this.threads[t].topBlock === e && this.threads[t].status !== v.STATUS_DONE && this.threads[t].updateMonitor) return; this._pushThread(e, t, { updateMonitor: !0 }) } allScriptsDo(e, t) { let n = this.executableTargets; t && (n = [t]); for (let t = n.length - 1; t >= 0; t--) { const r = n[t], i = r.blocks.getScripts(); for (let t = 0; t < i.length; t++) { e(i[t], r) } } } allScriptsByOpcodeDo(e, t, n) { let r = this.executableTargets; n && (r = [n]); for (let n = r.length - 1; n >= 0; n--) { const i = r[n], s = d.getScripts(i.blocks, e); for (let e = 0; e < s.length; e++)t(s[e], i) } } startHats(e, t, n) { if (!Object.prototype.hasOwnProperty.call(this._hats, e)) return; const r = [], i = this._hats[e]; for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && (t[e] = t[e].toUpperCase()); const s = this.threads.length; return this.allScriptsByOpcodeDo(e, ((e, n) => { const { blockId: o, fieldsOfInputs: a } = e; for (const e in t) if (a[e].value !== t[e]) return; if (i.restartExistingThreads) { const e = this.threadMap.get(v.getIdFromTargetAndBlock(n, o)); if (e) return void r.push(this._restartThread(e)) } else for (let e = 0; e < s; e++)if (this.threads[e].target === n && this.threads[e].topBlock === o && !this.threads[e].stackClick && this.threads[e].status !== v.STATUS_DONE) return; r.push(this._pushThread(o, n)) }), n), r.forEach((e => { e.isCompiled ? e.executableHat && (g.saveGlobalState(), g(e), g.restoreGlobalState()) : (f(this.sequencer, e), e.goToNextBlock()) })), r } dispose() { this.stopAll(), this.targets.forEach((e => { e.isOriginal && e.deleteMonitors() })), this.targets.map(this.disposeTarget, this), this.extensionStorage = {}; const e = o({}); e.equals(this._monitorState) || (this._monitorState = e, this.emit(K.MONITORS_UPDATE, this._monitorState)), this.emit(K.RUNTIME_DISPOSED), this.ioDevices.clock.resetProjectTimer(), this.fontManager.clear(), this.hasCloudData() && this.emit(K.HAS_CLOUD_DATA_UPDATE, !1), this.ioDevices.cloud.clear(); const t = q(this.cloudOptions); this.hasCloudData = t.hasCloudVariables, this.canAddCloudVariable = t.canAddCloudVariable, this.getNumberOfCloudVariables = t.getNumberOfCloudVariables, this.addCloudVariable = this._initializeAddCloudVariable(t), this.removeCloudVariable = this._initializeRemoveCloudVariable(t), this.resetProgress() } addTarget(e) { this.targets.push(e), this.executableTargets.push(e), e.isStage && !this._stageTarget && (this._stageTarget = e) } moveExecutable(e, t) { const n = this.executableTargets.indexOf(e); this.executableTargets.splice(n, 1); let r = n + t; return r > this.executableTargets.length && (r = this.executableTargets.length), r <= 0 && (r = this.executableTargets.length > 0 && this.executableTargets[0].isStage ? 1 : 0), this.executableTargets.splice(r, 0, e), r } setExecutablePosition(e, t) { const n = this.executableTargets.indexOf(e); return this.moveExecutable(e, t - n) } removeExecutable(e) { const t = this.executableTargets.indexOf(e); t > -1 && this.executableTargets.splice(t, 1) } disposeTarget(e) { this.targets = this.targets.filter((t => e !== t || (t.dispose(), !1))), this._stageTarget === e && (this._stageTarget = null) } stopForTarget(e, t) { this.emit(K.STOP_FOR_TARGET, e, t); for (let n = 0; n < this.threads.length; n++)this.threads[n] !== t && this.threads[n].target === e && this._stopThread(this.threads[n]) } resetRunId() { if (!this.storage) return; const e = l.v1(); this.storage.scratchFetch.setMetadata(this.storage.scratchFetch.RequestMetadata.RunId, e) } greenFlag() { this.stopAll(), this.emit(K.PROJECT_START), this.updateCurrentMSecs(), this.ioDevices.clock.resetProjectTimer(), this.targets.forEach((e => e.clearEdgeActivatedValues())); for (let e = 0; e < this.targets.length; e++)this.targets[e].onGreenFlag(); this.startHats("event_whenflagclicked") } stopAll() { this.emit(K.PROJECT_STOP_ALL); const e = []; for (let t = 0; t < this.targets.length; t++)this.targets[t].onStopAll(), Object.prototype.hasOwnProperty.call(this.targets[t], "isOriginal") && !this.targets[t].isOriginal ? this.targets[t].dispose() : e.push(this.targets[t]); this.targets = e, null !== this.sequencer.activeThread && this._stopThread(this.sequencer.activeThread), this.threads = [], this.threadMap.clear(), this.resetRunId() } _renderInterpolatedPositions() { const e = this._lastStepTime, t = Date.now() - e, n = Math.min(1, Math.max(0, t / this.currentStepTime)); j.interpolate(this, n), this.renderer && this.renderer.draw() } updateThreadMap() { this.threadMap.clear(); for (const e of this.threads) e.stackClick || e.updateMonitor || this.threadMap.set(e.getId(), e) } _step() { this.interpolationEnabled && j.setupInitialState(this), null !== this.profiler && (-1 === Y && (Y = this.profiler.idByName("Runtime._step")), this.profiler.start(Y)), this.threads = this.threads.filter((e => !e.isKilled)), this.updateThreadMap(); for (const e in this._hats) { if (!Object.prototype.hasOwnProperty.call(this._hats, e)) continue; this._hats[e].edgeActivated && this.startHats(e) } this.redrawRequested = !1, this._pushMonitors(), null !== this.profiler && (-1 === H && (H = this.profiler.idByName("Sequencer.stepThreads")), this.profiler.start(H)), this.emit(K.BEFORE_EXECUTE); const e = this.sequencer.stepThreads(); null !== this.profiler && this.profiler.stop(), this.emit(K.AFTER_EXECUTE), this._updateGlows(e), this._emitProjectRunStatus(this.threads.length + e.length - this._getMonitorThreadCount([...this.threads, ...e])), this._lastStepDoneThreads = e, this.renderer && (null !== this.profiler && (-1 === _ && (_ = this.profiler.idByName("RenderWebGL.draw")), this.profiler.start(_)), document.hidden || this.frameLoop._interpolationAnimation || this.renderer.draw(), null !== this.profiler && this.profiler.stop()), this._refreshTargets && (this.emit(K.TARGETS_UPDATE, !1), this._refreshTargets = !1), this._prevMonitorState.equals(this._monitorState) || (this.emit(K.MONITORS_UPDATE, this._monitorState), this._prevMonitorState = this._monitorState), null !== this.profiler && (this.profiler.stop(), this.profiler.reportFrames()), this.interpolationEnabled && (this._lastStepTime = Date.now()) } _getMonitorThreadCount(e) { let t = 0; return e.forEach((e => { e.updateMonitor && t++ })), t } _pushMonitors() { this.monitorBlocks.runAllMonitored(this) } setEditingTarget(e) { const t = this._editingTarget; this._editingTarget = e, this._scriptGlowsPreviousFrame = [], this._updateGlows(), t !== this._editingTarget && this.requestToolboxExtensionsUpdate() } setCompatibilityMode(e) { e ? this.setFramerate(30) : this.setFramerate(60) } setFramerate(e) { e > 250 && (e = 250), e < 0 && (e = 1), this.frameLoop.setFramerate(e), this.emit(K.FRAMERATE_CHANGED, e) } setInterpolation(e) { this.interpolationEnabled = e, this.frameLoop.setInterpolation(this.interpolationEnabled), this.emit(K.INTERPOLATION_CHANGED, e) } setRuntimeOptions(e) { this.runtimeOptions = Object.assign({}, this.runtimeOptions, e), this.emit(K.RUNTIME_OPTIONS_CHANGED, this.runtimeOptions), this.renderer && (this.renderer.offscreenTouching = !this.runtimeOptions.fencing) } setCompilerOptions(e) { this.compilerOptions = Object.assign({}, this.compilerOptions, e), this.resetAllCaches(), this.emit(K.COMPILER_OPTIONS_CHANGED, this.compilerOptions) } setStageSize(e, t) { if (e = Math.round(Math.max(1, e)), t = Math.round(Math.max(1, t)), this.stageWidth !== e || this.stageHeight !== t) { const n = e - this.stageWidth, r = t - this.stageHeight; if (this._monitorState.size > 0) { const e = n / 2, t = r / 2; for (const n of this._monitorState.valueSeq()) { const r = n.set("x", n.get("x") + e).set("y", n.get("y") + t); this.requestUpdateMonitor(r) } this.emit(K.MONITORS_UPDATE, this._monitorState) } this.stageWidth = e, this.stageHeight = t, this.renderer && this.renderer.setStageSize(-e / 2, e / 2, -t / 2, t / 2), this.emit(K.STAGE_SIZE_CHANGED, e, t) } } setInEditor(e) { } convertToPackagedRuntime() { if (this.storage) throw new Error("convertToPackagedRuntime must be called before attachStorage"); this.isPackaged = !0 } resetAllCaches() { for (const e of this.targets) e.isOriginal && e.blocks.resetCache(); this.flyoutBlocks.resetCache(), this.monitorBlocks.resetCache() } addAddonBlock(e) { const t = e.procedureCode, n = e.arguments || [], s = n, o = n.map(((e, t) => "arg".concat(t))), a = n.map((() => "")); if (this.addonBlocks[t] = function (e) { for (var t = 1; t < arguments.length; t++) { var n = null != arguments[t] ? arguments[t] : {}; t % 2 ? r(Object(n), !0).forEach((function (t) { i(e, t, n[t]) })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : r(Object(n)).forEach((function (t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)) })) } return e }({ namesIdsDefaults: [s, o, a] }, e), !e.hidden) { const n = "a-b"; let r = this._blockInfo.find((e => e.id === n)); if (!r) { const e = ''; r = { id: n, name: w({ id: "tw.blocks.addons", default: "Addons", description: "Name of the addon block category in the extension list" }), color1: "#29beb8", color2: "#3aa8a4", color3: "#3aa8a4", menuIconURI: "data:image/svg+xml;,".concat(encodeURIComponent(e)), blocks: [], customFieldTypes: {}, menus: [] }, this._blockInfo.unshift(r) } r.blocks.push({ info: {}, xml: '" }) } this.resetAllCaches() } getAddonBlock(e) { return Object.prototype.hasOwnProperty.call(this.addonBlocks, e) ? this.addonBlocks[e] : null } findProjectOptionsComment() { const e = this.getTargetForStage().comments; for (const t of Object.values(e)) if (t.text.includes(V)) return t; return null } parseProjectOptions() { const e = this.findProjectOptionsComment(); if (!e) return; const t = e.text.split("\n").find((e => e.endsWith(V))); if (!t) return void S.warn("Config comment does not contain valid line"); const n = t.substr(0, t.length - 14); let r; try { if (r = a.parse(n), !r || "object" != typeof r) throw new Error("Invalid object") } catch (e) { return void S.warn("Config comment has invalid JSON", e) } "number" == typeof r.framerate && this.setFramerate(r.framerate), r.turbo && (this.turboMode = !0, this.emit(K.TURBO_MODE_ON)), r.interpolation && this.setInterpolation(!0), r.runtimeOptions && this.setRuntimeOptions(r.runtimeOptions), r.hq && this.renderer && this.renderer.setUseHighQualityRender(!0); const i = +r.width || this.stageWidth, s = +r.height || this.stageHeight; i === this.stageWidth && s === this.stageHeight || this.setStageSize(i, s) } _generateAllProjectOptions() { return { framerate: this.frameLoop.framerate, runtimeOptions: this.runtimeOptions, interpolation: this.interpolationEnabled, turbo: this.turboMode, hq: !!this.renderer && this.renderer.useHighQualityRender, width: this.stageWidth, height: this.stageHeight } } generateDifferingProjectOptions() { const e = (t, n) => { const r = {}; for (const i of Object.keys(n)) { const s = n[i], o = t[i]; if ("object" == typeof s && s) { const t = e(o, s); Object.keys(t).length > 0 && (r[i] = t) } else s !== o && (r[i] = s) } return r }; return e(this._defaultStoredSettings, this._generateAllProjectOptions()) } storeProjectOptions() { const e = this.generateDifferingProjectOptions(), t = "Configuration for https://turbowarp.org/\nYou can move, resize, and minimize this comment, but don't edit it by hand. This comment can be deleted to remove the stored settings.\n".concat(a.stringify(e)).concat(V), n = this.findProjectOptionsComment(); if (n) n.text = t; else { this.getTargetForStage().createComment(z(), null, t, 50, 50, 350, 170, !1) } this.emitProjectChanged() } precompile() { this.allScriptsDo(((e, t) => { const n = t.blocks.getBlock(e); if (this.getIsHat(n.opcode)) { const n = new v(e); n.target = t, n.blockContainer = t.blocks, n.tryCompile() } })) } enableDebug() { this.resetAllCaches(), this.debug = !0 } _updateGlows(e) { const t = []; t.push(...this.threads), e && t.push(...e); const n = [], r = []; for (let e = 0; e < t.length; e++) { const r = t[e], i = r.target; if (i === this._editingTarget) { const e = r.blockGlowInFrame; if (r.requestScriptGlowInFrame || r.stackClick) { let t = i.blocks.getTopLevelScript(e); t || (t = this.flyoutBlocks.getTopLevelScript(e)), t && n.push(t) } } } for (let e = 0; e < this._scriptGlowsPreviousFrame.length; e++) { const t = this._scriptGlowsPreviousFrame[e]; n.indexOf(t) < 0 ? this.glowScript(t, !1) : r.push(t) } for (let e = 0; e < n.length; e++) { const t = n[e]; this._scriptGlowsPreviousFrame.indexOf(t) < 0 && (this.glowScript(t, !0), r.push(t)) } this._scriptGlowsPreviousFrame = r } _emitProjectRunStatus(e) { 0 === this._nonMonitorThreadCount && e > 0 && this.emit(K.PROJECT_RUN_START), this._nonMonitorThreadCount > 0 && 0 === e && this.emit(K.PROJECT_RUN_STOP), this._nonMonitorThreadCount = e } quietGlow(e) { const t = this._scriptGlowsPreviousFrame.indexOf(e); t > -1 && this._scriptGlowsPreviousFrame.splice(t, 1) } glowBlock(e, t) { t ? this.emit(K.BLOCK_GLOW_ON, { id: e }) : this.emit(K.BLOCK_GLOW_OFF, { id: e }) } glowScript(e, t) { t ? this.emit(K.SCRIPT_GLOW_ON, { id: e }) : this.emit(K.SCRIPT_GLOW_OFF, { id: e }) } emitBlockDragUpdate(e) { this.emit(K.BLOCK_DRAG_UPDATE, e) } emitBlockEndDrag(e, t) { this.emit(K.BLOCK_DRAG_END, e, t) } visualReport(e, t) { this.emit(K.VISUAL_REPORT, { id: e, value: String(t) }) } requestAddMonitor(e) { const t = e.get("id"); this.requestUpdateMonitor(e) || (this._monitorState = this._monitorState.set(t, e)) } requestUpdateMonitor(e) { const t = e.get("id"); return !!this._monitorState.has(t) && (this._monitorState = this._monitorState.set(t, this._monitorState.get(t).mergeWith(((e, t) => null == t ? e : t), e)), !0) } requestRemoveMonitor(e) { this._monitorState = this._monitorState.delete(e) } requestHideMonitor(e) { return this.requestUpdateMonitor(new Map([["id", e], ["visible", !1]])) } requestShowMonitor(e) { return this.requestUpdateMonitor(new Map([["id", e], ["visible", !0]])) } requestRemoveMonitorByTargetId(e) { this._monitorState = this._monitorState.filterNot((t => t.targetId === e)) } getTargetById(e) { for (let t = 0; t < this.targets.length; t++) { const n = this.targets[t]; if (n.id === e) return n } } getSpriteTargetByName(e) { for (let t = 0; t < this.targets.length; t++) { const n = this.targets[t]; if (!n.isStage && (n.sprite && n.sprite.name === e)) return n } } getTargetByDrawableId(e) { for (let t = 0; t < this.targets.length; t++) { const n = this.targets[t]; if (n.drawableID === e) return n } } changeCloneCounter(e) { this._cloneCounter += e } clonesAvailable() { return this._cloneCounter < this.runtimeOptions.maxClones } handleProjectLoaded() { this.emit(K.PROJECT_LOADED), this.resetRunId() } emitProjectChanged() { this.emit(K.PROJECT_CHANGED) } fireTargetWasCreated(e, t) { this.emit("targetWasCreated", e, t) } fireTargetWasRemoved(e) { this.emit("targetWasRemoved", e) } getTargetForStage() { if (this._stageTarget) return this._stageTarget; for (let e = 0; e < this.targets.length; e++) { const t = this.targets[e]; if (t.isStage) return this._stageTarget = t, t } } getEditingTarget() { return this._editingTarget } getAllVarNamesOfType(e) { let t = []; for (const n of this.targets) { const r = n.getAllVariableNamesInScopeByType(e, !0); t = t.concat(r) } return t } getLabelForOpcode(e) { const [t, n] = B.splitFirst(e, "_"); if (!t || !n) return; const r = this._blockInfo.find((e => e.id === t)); if (!r) return; const i = r.blocks.find((e => e.info.opcode === n)); return i ? { category: "extension", label: "".concat(r.name, ": ").concat(i.info.text) } : void 0 } createNewGlobalVariable(e, t, n) { const r = "string" == typeof n ? n : T.SCALAR_TYPE, i = this.getAllVarNamesOfType(r), s = B.unusedName(e, i), o = new T(t || z(), s, r); return this.getTargetForStage().variables[o.id] = o, o } requestRedraw() { this.redrawRequested = !0 } requestTargetsUpdate(e) { e.isOriginal && (this._refreshTargets = !0) } requestBlocksUpdate() { this.emit(K.BLOCKS_NEED_UPDATE) } requestToolboxExtensionsUpdate() { this.emit(K.TOOLBOX_EXTENSIONS_NEED_UPDATE) } start() { this.frameLoop.running || (this.frameLoop.start(), this.emit(K.RUNTIME_STARTED)) } stop() { this.quit() } quit() { this.frameLoop.running && (this.frameLoop.stop(), this.emit(K.RUNTIME_STOPPED)) } enableProfiling(e) { p.available() && (this.profiler = new p(e)) } disableProfiling() { this.profiler = null } updateCurrentMSecs() { this.currentMSecs = Date.now() } updatePrivacy() { const e = this.enforcePrivacy && Object.values(this.externalCommunicationMethods).some((e => e)); this.renderer && this.renderer.setPrivateSkinAccess && this.renderer.setPrivateSkinAccess(!e) } setEnforcePrivacy(e) { this.enforcePrivacy = e, this.updatePrivacy() } setExternalCommunicationMethod(e, t) { if (!Object.prototype.hasOwnProperty.call(this.externalCommunicationMethods, e)) throw new Error("Unknown method: ".concat(e)); this.externalCommunicationMethods[e] = t, this.updatePrivacy() } emitAssetProgress() { this.emit(K.ASSET_PROGRESS, this.finishedAssetRequests, this.totalAssetRequests) } resetProgress() { this.finishedAssetRequests = 0, this.totalAssetRequests = 0, this.emitAssetProgress() } wrapAssetRequest(e) { this.totalAssetRequests++, this.emitAssetProgress(); return e().then((e => (this.finishedAssetRequests++, this.emitAssetProgress(), e)), (e => { throw this.finishedAssetRequests++, this.emitAssetProgress(), e })) } } e.exports = K }, function (e, t, n) { const { Record: r } = n(24), i = r({ id: null, spriteName: null, targetId: null, opcode: null, value: null, params: null, mode: "default", sliderMin: 0, sliderMax: 100, isDiscrete: !0, x: null, y: null, width: 0, height: 0, visible: !0 }); e.exports = i }, function (e, t) { e.exports = function (e, t) { let n = ""; for (const e in t) { let r = t[e].value; "CURRENTMENU" === e && (r = r.toLowerCase()), n += "_".concat(r) } return "".concat(e).concat(n) } }, function (e, t, n) { const r = n(2), i = n(7), s = n(3), o = n(10), a = n(1), { IntermediateScript: l, IntermediateRepresentation: c } = n(78), u = n(209), d = "", h = "list", p = (e, t) => ({ scope: e, id: t.id, name: t.name, isCloud: t.isCloud }), m = e => e.substring(1); class f { constructor(e) { this.thread = e, this.target = e.target, this.blocks = e.blockContainer, this.runtime = this.target.runtime, this.stage = this.runtime.getTargetForStage(), this.script = new l, this.script.warpTimer = this.target.runtime.compilerOptions.warpTimer, this.variableCache = {}, this.usesTimer = !1 } setProcedureVariant(e) { const t = m(e); this.script.procedureVariant = e, this.script.procedureCode = t, this.script.isProcedure = !0, this.script.yields = !1; const n = this.blocks.getProcedureParamNamesIdsAndDefaults(t); if (null === n) throw new Error("IR: cannot find procedure: ".concat(e)); const [r, i, s] = n; this.script.arguments = r } enableWarp() { this.script.isWarp = !0 } getBlockById(e) { return this.blocks.getBlock(e) || this.blocks.runtime.flyoutBlocks.getBlock(e) } getBlockInfo(e) { const [t, n] = i.splitFirst(e, "_"); if (!t || !n) return null; const r = this.runtime._blockInfo.find((e => e.id === t)); if (!r) return null; const s = r.blocks.find((e => e.info.opcode === n)); return s || null } descendInputOfBlock(e, t) { const n = e.inputs[t]; if (!n) return a.warn("IR: ".concat(e.opcode, ": missing input ").concat(t), e), { kind: "constant", value: 0 }; const r = n.block, i = this.getBlockById(r); return i ? this.descendInput(i) : (a.warn("IR: ".concat(e.opcode, ": could not find input ").concat(t, " with ID ").concat(r)), { kind: "constant", value: 0 }) } descendInput(e) { switch (e.opcode) { case "colour_picker": return { kind: "constant", value: e.fields.COLOUR.value }; case "math_angle": case "math_integer": case "math_number": case "math_positive_number": case "math_whole_number": return { kind: "constant", value: e.fields.NUM.value }; case "text": return { kind: "constant", value: e.fields.TEXT.value }; case "argument_reporter_string_number": { const t = e.fields.VALUE.value, n = this.script.arguments.lastIndexOf(t); return -1 === n && "last key pressed" === t.toLowerCase() ? { kind: "tw.lastKeyPressed" } : -1 === n ? { kind: "constant", value: 0 } : { kind: "procedures.argument", index: n } } case "argument_reporter_boolean": { const t = e.fields.VALUE.value, n = this.script.arguments.lastIndexOf(t); return -1 === n ? "is compiled?" === t.toLowerCase() || "is turbowarp?" === t.toLowerCase() ? { kind: "constant", value: !0 } : { kind: "constant", value: 0 } : { kind: "procedures.argument", index: n } } case "control_get_counter": return { kind: "counter.get" }; case "data_variable": return { kind: "var.get", variable: this.descendVariable(e, "VARIABLE", d) }; case "data_itemoflist": return { kind: "list.get", list: this.descendVariable(e, "LIST", h), index: this.descendInputOfBlock(e, "INDEX") }; case "data_lengthoflist": return { kind: "list.length", list: this.descendVariable(e, "LIST", h) }; case "data_listcontainsitem": return { kind: "list.contains", list: this.descendVariable(e, "LIST", h), item: this.descendInputOfBlock(e, "ITEM") }; case "data_itemnumoflist": return { kind: "list.indexOf", list: this.descendVariable(e, "LIST", h), item: this.descendInputOfBlock(e, "ITEM") }; case "data_listcontents": return { kind: "list.contents", list: this.descendVariable(e, "LIST", h) }; case "event_broadcast_menu": { const t = e.fields.BROADCAST_OPTION, n = this.target.lookupBroadcastMsg(t.id, t.value); return { kind: "constant", value: n ? n.name : "" } } case "looks_backdropnumbername": return "number" === e.fields.NUMBER_NAME.value ? { kind: "looks.backdropNumber" } : { kind: "looks.backdropName" }; case "looks_costumenumbername": return "number" === e.fields.NUMBER_NAME.value ? { kind: "looks.costumeNumber" } : { kind: "looks.costumeName" }; case "looks_size": return { kind: "looks.size" }; case "motion_direction": return { kind: "motion.direction" }; case "motion_xposition": return { kind: "motion.x" }; case "motion_yposition": return { kind: "motion.y" }; case "operator_add": return { kind: "op.add", left: this.descendInputOfBlock(e, "NUM1"), right: this.descendInputOfBlock(e, "NUM2") }; case "operator_and": return { kind: "op.and", left: this.descendInputOfBlock(e, "OPERAND1"), right: this.descendInputOfBlock(e, "OPERAND2") }; case "operator_contains": return { kind: "op.contains", string: this.descendInputOfBlock(e, "STRING1"), contains: this.descendInputOfBlock(e, "STRING2") }; case "operator_divide": return { kind: "op.divide", left: this.descendInputOfBlock(e, "NUM1"), right: this.descendInputOfBlock(e, "NUM2") }; case "operator_equals": return { kind: "op.equals", left: this.descendInputOfBlock(e, "OPERAND1"), right: this.descendInputOfBlock(e, "OPERAND2") }; case "operator_gt": return { kind: "op.greater", left: this.descendInputOfBlock(e, "OPERAND1"), right: this.descendInputOfBlock(e, "OPERAND2") }; case "operator_join": return { kind: "op.join", left: this.descendInputOfBlock(e, "STRING1"), right: this.descendInputOfBlock(e, "STRING2") }; case "operator_length": return { kind: "op.length", string: this.descendInputOfBlock(e, "STRING") }; case "operator_letter_of": return { kind: "op.letterOf", letter: this.descendInputOfBlock(e, "LETTER"), string: this.descendInputOfBlock(e, "STRING") }; case "operator_lt": return { kind: "op.less", left: this.descendInputOfBlock(e, "OPERAND1"), right: this.descendInputOfBlock(e, "OPERAND2") }; case "operator_mathop": { const t = this.descendInputOfBlock(e, "NUM"); switch (e.fields.OPERATOR.value.toLowerCase()) { case "abs": return { kind: "op.abs", value: t }; case "floor": return { kind: "op.floor", value: t }; case "ceiling": return { kind: "op.ceiling", value: t }; case "sqrt": return { kind: "op.sqrt", value: t }; case "sin": return { kind: "op.sin", value: t }; case "cos": return { kind: "op.cos", value: t }; case "tan": return { kind: "op.tan", value: t }; case "asin": return { kind: "op.asin", value: t }; case "acos": return { kind: "op.acos", value: t }; case "atan": return { kind: "op.atan", value: t }; case "ln": return { kind: "op.ln", value: t }; case "log": return { kind: "op.log", value: t }; case "e ^": return { kind: "op.e^", value: t }; case "10 ^": return { kind: "op.10^", value: t }; default: return { kind: "constant", value: 0 } } } case "operator_mod": return { kind: "op.mod", left: this.descendInputOfBlock(e, "NUM1"), right: this.descendInputOfBlock(e, "NUM2") }; case "operator_multiply": return { kind: "op.multiply", left: this.descendInputOfBlock(e, "NUM1"), right: this.descendInputOfBlock(e, "NUM2") }; case "operator_not": return { kind: "op.not", operand: this.descendInputOfBlock(e, "OPERAND") }; case "operator_or": return { kind: "op.or", left: this.descendInputOfBlock(e, "OPERAND1"), right: this.descendInputOfBlock(e, "OPERAND2") }; case "operator_random": { const t = this.descendInputOfBlock(e, "FROM"), n = this.descendInputOfBlock(e, "TO"); if ("constant" === t.kind && "constant" === n.kind) { const e = t.value, i = n.value, s = r.toNumber(e), o = r.toNumber(i); return s === o ? { kind: "constant", value: s } : r.isInt(e) && r.isInt(i) ? { kind: "op.random", low: s <= o ? t : n, high: s <= o ? n : t, useInts: !0, useFloats: !1 } : { kind: "op.random", low: s <= o ? t : n, high: s <= o ? n : t, useInts: !1, useFloats: !0 } } if ("constant" === t.kind) { if (!r.isInt(r.toNumber(t.value))) return { kind: "op.random", low: t, high: n, useInts: !1, useFloats: !0 } } else if ("constant" === n.kind && !r.isInt(r.toNumber(n.value))) return { kind: "op.random", low: t, high: n, useInts: !1, useFloats: !0 }; return { kind: "op.random", low: t, high: n, useInts: !1, useFloats: !1 } } case "operator_round": return { kind: "op.round", value: this.descendInputOfBlock(e, "NUM") }; case "operator_subtract": return { kind: "op.subtract", left: this.descendInputOfBlock(e, "NUM1"), right: this.descendInputOfBlock(e, "NUM2") }; case "procedures_call": return this.descendProcedure(e); case "sensing_answer": return { kind: "sensing.answer" }; case "sensing_coloristouchingcolor": return { kind: "sensing.colorTouchingColor", target: this.descendInputOfBlock(e, "COLOR2"), mask: this.descendInputOfBlock(e, "COLOR") }; case "sensing_current": switch (e.fields.CURRENTMENU.value.toLowerCase()) { case "year": return { kind: "sensing.year" }; case "month": return { kind: "sensing.month" }; case "date": return { kind: "sensing.date" }; case "dayofweek": return { kind: "sensing.dayofweek" }; case "hour": return { kind: "sensing.hour" }; case "minute": return { kind: "sensing.minute" }; case "second": return { kind: "sensing.second" } }return { kind: "constant", value: 0 }; case "sensing_dayssince2000": return { kind: "sensing.daysSince2000" }; case "sensing_distanceto": return { kind: "sensing.distance", target: this.descendInputOfBlock(e, "DISTANCETOMENU") }; case "sensing_keypressed": return { kind: "keyboard.pressed", key: this.descendInputOfBlock(e, "KEY_OPTION") }; case "sensing_mousedown": return { kind: "mouse.down" }; case "sensing_mousex": return { kind: "mouse.x" }; case "sensing_mousey": return { kind: "mouse.y" }; case "sensing_of": return { kind: "sensing.of", property: e.fields.PROPERTY.value, object: this.descendInputOfBlock(e, "OBJECT") }; case "sensing_timer": return this.usesTimer = !0, { kind: "timer.get" }; case "sensing_touchingcolor": return { kind: "sensing.touchingColor", color: this.descendInputOfBlock(e, "COLOR") }; case "sensing_touchingobject": return { kind: "sensing.touching", object: this.descendInputOfBlock(e, "TOUCHINGOBJECTMENU") }; case "sensing_username": return { kind: "sensing.username" }; case "sound_sounds_menu": return { kind: "constant", value: e.fields.SOUND_MENU.value }; case "tw_getLastKeyPressed": return { kind: "tw.lastKeyPressed" }; default: { if (this.runtime.getOpcodeFunction(e.opcode)) { if (u.inputs.includes(e.opcode)) return this.descendCompatLayer(e); const t = this.getBlockInfo(e.opcode); if (t) { const n = t.info.blockType; if (n === s.REPORTER || n === s.BOOLEAN) return this.descendCompatLayer(e) } } const t = Object.keys(e.inputs), n = Object.keys(e.fields); if (0 === t.length && 1 === n.length) return { kind: "constant", value: e.fields[n[0]].value }; throw a.warn("IR: Unknown input: ".concat(e.opcode), e), new Error("IR: Unknown input: ".concat(e.opcode)) } } } descendStackedBlock(e) { switch (e.opcode) { case "control_all_at_once": return { kind: "control.if", condition: { kind: "constant", value: !0 }, whenTrue: this.descendSubstack(e, "SUBSTACK"), whenFalse: [] }; case "control_clear_counter": return { kind: "counter.clear" }; case "control_create_clone_of": return { kind: "control.createClone", target: this.descendInputOfBlock(e, "CLONE_OPTION") }; case "control_delete_this_clone": return this.script.yields = !0, { kind: "control.deleteClone" }; case "control_forever": return this.analyzeLoop(), { kind: "control.while", condition: { kind: "constant", value: !0 }, do: this.descendSubstack(e, "SUBSTACK") }; case "control_for_each": return this.analyzeLoop(), { kind: "control.for", variable: this.descendVariable(e, "VARIABLE", d), count: this.descendInputOfBlock(e, "VALUE"), do: this.descendSubstack(e, "SUBSTACK") }; case "control_if": return { kind: "control.if", condition: this.descendInputOfBlock(e, "CONDITION"), whenTrue: this.descendSubstack(e, "SUBSTACK"), whenFalse: [] }; case "control_if_else": return { kind: "control.if", condition: this.descendInputOfBlock(e, "CONDITION"), whenTrue: this.descendSubstack(e, "SUBSTACK"), whenFalse: this.descendSubstack(e, "SUBSTACK2") }; case "control_incr_counter": return { kind: "counter.increment" }; case "control_repeat": return this.analyzeLoop(), { kind: "control.repeat", times: this.descendInputOfBlock(e, "TIMES"), do: this.descendSubstack(e, "SUBSTACK") }; case "control_repeat_until": { this.analyzeLoop(), this.usesTimer = !1; const t = this.descendInputOfBlock(e, "CONDITION"), n = this.usesTimer; return n && (this.script.yields = !0), { kind: "control.while", condition: { kind: "op.not", operand: t }, do: this.descendSubstack(e, "SUBSTACK"), warpTimer: n } } case "control_stop": { const t = e.fields.STOP_OPTION.value; return "all" === t ? (this.script.yields = !0, { kind: "control.stopAll" }) : "other scripts in sprite" === t || "other scripts in stage" === t ? { kind: "control.stopOthers" } : "this script" === t ? { kind: "control.stopScript" } : { kind: "noop" } } case "control_wait": return this.script.yields = !0, { kind: "control.wait", seconds: this.descendInputOfBlock(e, "DURATION") }; case "control_wait_until": return this.script.yields = !0, { kind: "control.waitUntil", condition: this.descendInputOfBlock(e, "CONDITION") }; case "control_while": return this.analyzeLoop(), { kind: "control.while", condition: this.descendInputOfBlock(e, "CONDITION"), do: this.descendSubstack(e, "SUBSTACK"), warpTimer: !1 }; case "data_addtolist": return { kind: "list.add", list: this.descendVariable(e, "LIST", h), item: this.descendInputOfBlock(e, "ITEM") }; case "data_changevariableby": { const t = this.descendVariable(e, "VARIABLE", d); return { kind: "var.set", variable: t, value: { kind: "op.add", left: { kind: "var.get", variable: t }, right: this.descendInputOfBlock(e, "VALUE") } } } case "data_deletealloflist": return { kind: "list.deleteAll", list: this.descendVariable(e, "LIST", h) }; case "data_deleteoflist": { const t = this.descendInputOfBlock(e, "INDEX"); return "constant" === t.kind && "all" === t.value ? { kind: "list.deleteAll", list: this.descendVariable(e, "LIST", h) } : { kind: "list.delete", list: this.descendVariable(e, "LIST", h), index: t } } case "data_hidelist": return { kind: "list.hide", list: this.descendVariable(e, "LIST", h) }; case "data_hidevariable": return { kind: "var.hide", variable: this.descendVariable(e, "VARIABLE", d) }; case "data_insertatlist": return { kind: "list.insert", list: this.descendVariable(e, "LIST", h), index: this.descendInputOfBlock(e, "INDEX"), item: this.descendInputOfBlock(e, "ITEM") }; case "data_replaceitemoflist": return { kind: "list.replace", list: this.descendVariable(e, "LIST", h), index: this.descendInputOfBlock(e, "INDEX"), item: this.descendInputOfBlock(e, "ITEM") }; case "data_setvariableto": return { kind: "var.set", variable: this.descendVariable(e, "VARIABLE", d), value: this.descendInputOfBlock(e, "VALUE") }; case "data_showlist": return { kind: "list.show", list: this.descendVariable(e, "LIST", h) }; case "data_showvariable": return { kind: "var.show", variable: this.descendVariable(e, "VARIABLE", d) }; case "event_broadcast": return { kind: "event.broadcast", broadcast: this.descendInputOfBlock(e, "BROADCAST_INPUT") }; case "event_broadcastandwait": return this.script.yields = !0, { kind: "event.broadcastAndWait", broadcast: this.descendInputOfBlock(e, "BROADCAST_INPUT") }; case "looks_changeeffectby": return { kind: "looks.changeEffect", effect: e.fields.EFFECT.value.toLowerCase(), value: this.descendInputOfBlock(e, "CHANGE") }; case "looks_changesizeby": return { kind: "looks.changeSize", size: this.descendInputOfBlock(e, "CHANGE") }; case "looks_cleargraphiceffects": return { kind: "looks.clearEffects" }; case "looks_goforwardbackwardlayers": return "forward" === e.fields.FORWARD_BACKWARD.value ? { kind: "looks.forwardLayers", layers: this.descendInputOfBlock(e, "NUM") } : { kind: "looks.backwardLayers", layers: this.descendInputOfBlock(e, "NUM") }; case "looks_gotofrontback": return "front" === e.fields.FRONT_BACK.value ? { kind: "looks.goToFront" } : { kind: "looks.goToBack" }; case "looks_hide": return { kind: "looks.hide" }; case "looks_nextbackdrop": return { kind: "looks.nextBackdrop" }; case "looks_nextcostume": return { kind: "looks.nextCostume" }; case "looks_seteffectto": return { kind: "looks.setEffect", effect: e.fields.EFFECT.value.toLowerCase(), value: this.descendInputOfBlock(e, "VALUE") }; case "looks_setsizeto": return { kind: "looks.setSize", size: this.descendInputOfBlock(e, "SIZE") }; case "looks_show": return { kind: "looks.show" }; case "looks_switchbackdropto": return { kind: "looks.switchBackdrop", backdrop: this.descendInputOfBlock(e, "BACKDROP") }; case "looks_switchcostumeto": return { kind: "looks.switchCostume", costume: this.descendInputOfBlock(e, "COSTUME") }; case "motion_changexby": return { kind: "motion.changeX", dx: this.descendInputOfBlock(e, "DX") }; case "motion_changeyby": return { kind: "motion.changeY", dy: this.descendInputOfBlock(e, "DY") }; case "motion_gotoxy": return { kind: "motion.setXY", x: this.descendInputOfBlock(e, "X"), y: this.descendInputOfBlock(e, "Y") }; case "motion_ifonedgebounce": return { kind: "motion.ifOnEdgeBounce" }; case "motion_movesteps": return { kind: "motion.step", steps: this.descendInputOfBlock(e, "STEPS") }; case "motion_pointindirection": return { kind: "motion.setDirection", direction: this.descendInputOfBlock(e, "DIRECTION") }; case "motion_setrotationstyle": return { kind: "motion.setRotationStyle", style: e.fields.STYLE.value }; case "motion_setx": return { kind: "motion.setX", x: this.descendInputOfBlock(e, "X") }; case "motion_sety": return { kind: "motion.setY", y: this.descendInputOfBlock(e, "Y") }; case "motion_turnleft": return { kind: "motion.setDirection", direction: { kind: "op.subtract", left: { kind: "motion.direction" }, right: this.descendInputOfBlock(e, "DEGREES") } }; case "motion_turnright": return { kind: "motion.setDirection", direction: { kind: "op.add", left: { kind: "motion.direction" }, right: this.descendInputOfBlock(e, "DEGREES") } }; case "pen_clear": return { kind: "pen.clear" }; case "pen_changePenColorParamBy": return { kind: "pen.changeParam", param: this.descendInputOfBlock(e, "COLOR_PARAM"), value: this.descendInputOfBlock(e, "VALUE") }; case "pen_changePenHueBy": return { kind: "pen.legacyChangeHue", hue: this.descendInputOfBlock(e, "HUE") }; case "pen_changePenShadeBy": return { kind: "pen.legacyChangeShade", shade: this.descendInputOfBlock(e, "SHADE") }; case "pen_penDown": return { kind: "pen.down" }; case "pen_penUp": return { kind: "pen.up" }; case "pen_setPenColorParamTo": return { kind: "pen.setParam", param: this.descendInputOfBlock(e, "COLOR_PARAM"), value: this.descendInputOfBlock(e, "VALUE") }; case "pen_setPenColorToColor": return { kind: "pen.setColor", color: this.descendInputOfBlock(e, "COLOR") }; case "pen_setPenHueToNumber": return { kind: "pen.legacySetHue", hue: this.descendInputOfBlock(e, "HUE") }; case "pen_setPenShadeToNumber": return { kind: "pen.legacySetShade", shade: this.descendInputOfBlock(e, "SHADE") }; case "pen_setPenSizeTo": return { kind: "pen.setSize", size: this.descendInputOfBlock(e, "SIZE") }; case "pen_changePenSizeBy": return { kind: "pen.changeSize", size: this.descendInputOfBlock(e, "SIZE") }; case "pen_stamp": return { kind: "pen.stamp" }; case "procedures_call": { const t = e.mutation.proccode; if (e.mutation.return) { const t = this.descendVisualReport(e); if (t) return t } return "tw:debugger;" === t ? { kind: "tw.debugger" } : this.descendProcedure(e) } case "procedures_return": return { kind: "procedures.return", value: this.descendInputOfBlock(e, "VALUE") }; case "sensing_resettimer": return { kind: "timer.reset" }; default: { if (this.runtime.getOpcodeFunction(e.opcode)) { if (u.stacked.includes(e.opcode)) return this.descendCompatLayer(e); const t = this.getBlockInfo(e.opcode); if (t) { const n = t.info.blockType; if (n === s.COMMAND || n === s.CONDITIONAL || n === s.LOOP) return this.descendCompatLayer(e) } } const t = this.descendVisualReport(e); if (t) return t; throw a.warn("IR: Unknown stacked block: ".concat(e.opcode), e), new Error("IR: Unknown stacked block: ".concat(e.opcode)) } } } descendSubstack(e, t) { const n = e.inputs[t]; if (!n) return []; const r = n.block; return this.walkStack(r) } walkStack(e) { const t = []; let n = e; for (; null !== n;) { const e = this.getBlockById(n); if (!e) break; const r = this.descendStackedBlock(e); t.push(r), n = e.next } return t } descendVariable(e, t, n) { const r = e.fields[t], i = r.id; if (Object.prototype.hasOwnProperty.call(this.variableCache, i)) return this.variableCache[i]; const s = this._descendVariable(i, r.value, n); return this.variableCache[i] = s, s } _descendVariable(e, t, n) { const r = this.target, i = this.stage; if (Object.prototype.hasOwnProperty.call(r.variables, e)) return p("target", r.variables[e]); if (!r.isStage && i && Object.prototype.hasOwnProperty.call(i.variables, e)) return p("stage", i.variables[e]); for (const e in r.variables) if (Object.prototype.hasOwnProperty.call(r.variables, e)) { const i = r.variables[e]; if (i.name === t && i.type === n) return p("target", i) } if (!r.isStage && i) for (const e in i.variables) if (Object.prototype.hasOwnProperty.call(i.variables, e)) { const r = i.variables[e]; if (r.name === t && r.type === n) return p("stage", r) } const s = new o(e, t, n, !1); if (r.variables[e] = s, r.sprite) for (const i of r.sprite.clones) Object.prototype.hasOwnProperty.call(i.variables, e) || (i.variables[e] = new o(e, t, n, !1)); return p("target", s) } descendProcedure(e) { const t = e.mutation.proccode, n = this.blocks.getProcedureParamNamesIdsAndDefaults(t); if (null === n) return { kind: "noop" }; const [r, i, s] = n; if (this.runtime.getAddonBlock(t)) { this.script.yields = !0; const n = {}; for (let t = 0; t < i.length; t++) { let o; o = e.inputs[i[t]] && e.inputs[i[t]].block ? this.descendInputOfBlock(e, i[t]) : { kind: "constant", value: s[t] }, n[r[t]] = o } return { kind: "addons.call", code: t, arguments: n, blockId: e.id } } const o = this.blocks.getProcedureDefinition(t), a = this.blocks.getBlock(o); if (!a) return { kind: "noop" }; const l = this.blocks.getBlock(a.inputs.custom_block.block); let c = this.script.isWarp; if (!c && l && l.mutation) { const e = l.mutation.warp; "boolean" == typeof e ? c = e : "string" == typeof e && (c = JSON.parse(e)) } const u = (d = t, c ? "W".concat(d) : "Z".concat(d)); var d; this.script.dependedProcedures.includes(u) || this.script.dependedProcedures.push(u), this.script.isWarp || t === this.script.procedureCode && (this.script.yields = !0); const h = []; for (let t = 0; t < i.length; t++) { let n; n = e.inputs[i[t]] && e.inputs[i[t]].block ? this.descendInputOfBlock(e, i[t]) : { kind: "constant", value: s[t] }, h.push(n) } return { kind: "procedures.call", code: t, variant: u, arguments: h } } descendCompatLayer(e) { this.script.yields = !0; const t = {}; for (const n of Object.keys(e.inputs)) n.startsWith("SUBSTACK") || (t[n] = this.descendInputOfBlock(e, n)); const n = {}; for (const t of Object.keys(e.fields)) n[t] = e.fields[t].value; const r = this.getBlockInfo(e.opcode), i = r && r.info && r.info.blockType || s.COMMAND, o = {}; if (i === s.CONDITIONAL || i === s.LOOP) for (const t in e.inputs) { if (!t.startsWith("SUBSTACK")) continue; const n = "SUBSTACK" === t ? 1 : +t.substring(8); isNaN(n) || (o[n] = this.descendSubstack(e, t)) } return { kind: "compat", id: e.id, opcode: e.opcode, blockType: i, inputs: t, fields: n, substacks: o } } analyzeLoop() { this.script.isWarp && !this.script.warpTimer || (this.script.yields = !0) } readTopBlockComment(e) { const t = this.target.comments[e]; if (!t) return; const n = t.text; for (const e of n.split("\n")) { if (!/^tw\b/.test(e)) continue; const t = e.split(" "); for (const e of t) switch (e) { case "nocompile": throw new Error("Script explicitly disables compilation"); case "stuck": this.script.warpTimer = !0 }break } } descendVisualReport(e) { if (!this.thread.stackClick || e.next) return null; try { return { kind: "visualReport", input: this.descendInput(e) } } catch (e) { return null } } walkHat(e) { const t = e.next, n = e.opcode, r = this.runtime._hats[n]; if (this.thread.stackClick) { return this.runtime.getOpcodeFunction(n) ? [this.descendCompatLayer(e), ...this.walkStack(t)] : this.walkStack(t) } if (r.edgeActivated) return this.script.yields = !0, this.script.executableHat = !0, [{ kind: "hat.edge", id: e.id, condition: this.descendCompatLayer(e) }, ...this.walkStack(t)]; return this.runtime.getOpcodeFunction(n) ? (this.script.yields = !0, this.script.executableHat = !0, [{ kind: "hat.predicate", condition: this.descendCompatLayer(e) }, ...this.walkStack(t)]) : this.walkStack(t) } generate(e) { this.blocks.populateProcedureCache(), this.script.topBlockId = e; const t = this.getBlockById(e); if (!t) { if (this.script.isProcedure) return this.script; throw new Error("Cannot find top block") } t.comment && this.readTopBlockComment(t.comment); if (!!this.runtime._hats[t.opcode]) this.script.stack = this.walkHat(t); else { let n; n = "procedures_definition" === t.opcode ? t.next : e, n && (this.script.stack = this.walkStack(n)) } return this.script } } e.exports = { ScriptTreeGenerator: f, IRGenerator: class { constructor(e) { this.thread = e, this.blocks = e.blockContainer, this.proceduresToCompile = new Map, this.compilingProcedures = new Map, this.procedures = {}, this.analyzedProcedures = [] } addProcedureDependencies(e) { for (const t of e) { if (Object.prototype.hasOwnProperty.call(this.procedures, t)) continue; if (this.compilingProcedures.has(t)) continue; if (this.proceduresToCompile.has(t)) continue; const e = m(t), n = this.blocks.getProcedureDefinition(e); this.proceduresToCompile.set(t, n) } } generateScriptTree(e, t) { const n = e.generate(t); return this.addProcedureDependencies(n.dependedProcedures), n } analyzeScript(e) { let t = !1; for (const n of e.dependedProcedures) { const r = this.procedures[n]; this.analyzedProcedures.includes(n) || (this.analyzedProcedures.push(n), this.analyzeScript(r) && (t = !0), this.analyzedProcedures.pop()), r.yields && !e.yields && (e.yields = !0, t = !0) } return t } generate() { const e = this.generateScriptTree(new f(this.thread), this.thread.topBlock), t = this.blocks._cache.compiledProcedures; for (; this.proceduresToCompile.size > 0;) { this.compilingProcedures = this.proceduresToCompile, this.proceduresToCompile = new Map; for (const [e, n] of this.compilingProcedures.entries()) if (t[e]) { const n = t[e]; this.procedures[e] = n, this.addProcedureDependencies(n.dependedProcedures) } else { const r = "W" === e.charAt(0), i = new f(this.thread); i.setProcedureVariant(e), r && i.enableWarp(); const s = this.generateScriptTree(i, n); this.procedures[e] = s, t[e] = s } } for (; this.analyzeScript(e);); const n = new c; return n.entry = e, n.procedures = this.procedures, n } } } }, function (e, t, n) { const r = { Timer: n(14), Cast: n(2), log: n(1), blockUtility: n(211), thread: null }; let i = ""; const s = {}; i += "let stuckCounter = 0;\nconst isStuck = () => {\n // The real time is not checked on every call for performance.\n stuckCounter++;\n if (stuckCounter === 100) {\n stuckCounter = 0;\n return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n }\n return false;\n};", s.startHats = "const startHats = (requestedHat, optMatchFields) => {\n const thread = globalState.thread;\n const threads = thread.target.runtime.startHats(requestedHat, optMatchFields);\n return threads;\n}", s.waitThreads = "const waitThreads = function*(threads) {\n const thread = globalState.thread;\n const runtime = thread.target.runtime;\n\n while (true) {\n // determine whether any threads are running\n let anyRunning = false;\n for (let i = 0; i < threads.length; i++) {\n if (runtime.threads.indexOf(threads[i]) !== -1) {\n anyRunning = true;\n break;\n }\n }\n if (!anyRunning) {\n // all threads are finished, can resume\n return;\n }\n\n let allWaiting = true;\n for (let i = 0; i < threads.length; i++) {\n if (!runtime.isWaitingThread(threads[i])) {\n allWaiting = false;\n break;\n }\n }\n if (allWaiting) {\n thread.status = 3; // STATUS_YIELD_TICK\n }\n\n yield;\n }\n}", s.executeInCompatibilityLayer = "let hasResumedFromPromise = false;\nconst waitPromise = function*(promise) {\n const thread = globalState.thread;\n let returnValue;\n\n // enter STATUS_PROMISE_WAIT and yield\n // this will stop script execution until the promise handlers reset the thread status\n // because promise handlers might execute immediately, configure thread.status here\n thread.status = 1; // STATUS_PROMISE_WAIT\n\n promise\n .then(value => {\n returnValue = value;\n thread.status = 0; // STATUS_RUNNING\n }, error => {\n globalState.log.warn('Promise rejected in compiled script:', error);\n returnValue = '' + error;\n thread.status = 0; // STATUS_RUNNING\n });\n\n yield;\n\n return returnValue;\n};\nconst isPromise = value => (\n // see engine/execute.js\n value !== null &&\n typeof value === 'object' &&\n typeof value.then === 'function'\n);\nconst executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags, blockId, branchInfo) {\n const thread = globalState.thread;\n const blockUtility = globalState.blockUtility;\n const stackFrame = branchInfo ? branchInfo.stackFrame : {};\n\n const finish = (returnValue) => {\n if (branchInfo) {\n if (typeof returnValue === 'undefined' && blockUtility._startedBranch) {\n branchInfo.isLoop = blockUtility._startedBranch[1];\n return blockUtility._startedBranch[0];\n }\n branchInfo.isLoop = branchInfo.defaultIsLoop;\n return returnValue;\n }\n return returnValue;\n };\n\n const executeBlock = () => {\n blockUtility.init(thread, blockId, stackFrame);\n return blockFunction(inputs, blockUtility);\n };\n\n let returnValue = executeBlock();\n if (isPromise(returnValue)) {\n returnValue = finish(yield* waitPromise(returnValue));\n if (useFlags) hasResumedFromPromise = true;\n return returnValue;\n }\n\n if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n // Something external is forcing us to stop\n yield;\n // Make up a return value because whatever is forcing us to stop can't specify one\n return '';\n }\n\n while (thread.status === 2 /* STATUS_YIELD */ || thread.status === 3 /* STATUS_YIELD_TICK */) {\n // Yielded threads will run next iteration.\n if (thread.status === 2 /* STATUS_YIELD */) {\n thread.status = 0; // STATUS_RUNNING\n // Yield back to the event loop when stuck or not in warp mode.\n if (!isWarp || isStuck()) {\n yield;\n }\n } else {\n // status is STATUS_YIELD_TICK, always yield to the event loop\n yield;\n }\n\n returnValue = executeBlock();\n if (isPromise(returnValue)) {\n returnValue = finish(yield* waitPromise(returnValue));\n if (useFlags) hasResumedFromPromise = true;\n return returnValue;\n }\n\n if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n yield;\n return finish('');\n }\n }\n\n return finish(returnValue);\n}", s.createBranchInfo = "const createBranchInfo = (isLoop) => ({\n defaultIsLoop: isLoop,\n isLoop: false,\n branch: 0,\n stackFrame: {}\n});", s.retire = "const retire = () => {\n const thread = globalState.thread;\n thread.target.runtime.sequencer.retireThread(thread);\n}", s.toBoolean = "const toBoolean = value => {\n if (typeof value === 'boolean') {\n return value;\n }\n if (typeof value === 'string') {\n if (value === '' || value === '0' || value.toLowerCase() === 'false') {\n return false;\n }\n return true;\n }\n return !!value;\n}", s.limitPrecision = "const limitPrecision = value => {\n const rounded = Math.round(value);\n const delta = value - rounded;\n return (Math.abs(delta) < 1e-9) ? rounded : value;\n}", i += "const isNotActuallyZero = val => {\n if (typeof val !== 'string') return false;\n for (let i = 0; i < val.length; i++) {\n const code = val.charCodeAt(i);\n if (code === 48 || code === 9) {\n return false;\n }\n }\n return true;\n};", i += "const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);", s.compareGreaterThan = "const compareGreaterThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isNotActuallyZero(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isNotActuallyZero(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || isNaN(n2)) {\n const s1 = ('' + v1).toLowerCase();\n const s2 = ('' + v2).toLowerCase();\n return s1 > s2;\n }\n return n1 > n2;\n};\nconst compareGreaterThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) ? v1 > v2 : compareGreaterThanSlow(v1, v2)", s.compareLessThan = "const compareLessThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isNotActuallyZero(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isNotActuallyZero(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || isNaN(n2)) {\n const s1 = ('' + v1).toLowerCase();\n const s2 = ('' + v2).toLowerCase();\n return s1 < s2;\n }\n return n1 < n2;\n};\nconst compareLessThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v2) ? v1 < v2 : compareLessThanSlow(v1, v2)", s.randomInt = "const randomInt = (low, high) => low + Math.floor(Math.random() * ((high + 1) - low))", s.randomFloat = "const randomFloat = (low, high) => (Math.random() * (high - low)) + low", s.timer = "const timer = () => {\n const t = new globalState.Timer({\n now: () => globalState.thread.target.runtime.currentMSecs\n });\n t.start();\n return t;\n}", s.daysSince2000 = "const daysSince2000 = () => (Date.now() - 946684800000) / (24 * 60 * 60 * 1000)", s.distance = "const distance = menu => {\n const thread = globalState.thread;\n if (thread.target.isStage) return 10000;\n\n let targetX = 0;\n let targetY = 0;\n if (menu === '_mouse_') {\n targetX = thread.target.runtime.ioDevices.mouse.getScratchX();\n targetY = thread.target.runtime.ioDevices.mouse.getScratchY();\n } else {\n const distTarget = thread.target.runtime.getSpriteTargetByName(menu);\n if (!distTarget) return 10000;\n targetX = distTarget.x;\n targetY = distTarget.y;\n }\n\n const dx = thread.target.x - targetX;\n const dy = thread.target.y - targetY;\n return Math.sqrt((dx * dx) + (dy * dy));\n}", i += "const listIndexSlow = (index, length) => {\n if (index === 'last') {\n return length - 1;\n } else if (index === 'random' || index === 'any') {\n if (length > 0) {\n return (Math.random() * length) | 0;\n }\n return -1;\n }\n index = (+index || 0) | 0;\n if (index < 1 || index > length) {\n return -1;\n }\n return index - 1;\n};\nconst listIndex = (index, length) => {\n if (typeof index !== 'number') {\n return listIndexSlow(index, length);\n }\n index = index | 0;\n return index < 1 || index > length ? -1 : index - 1;\n};", s.listGet = "const listGet = (list, idx) => {\n const index = listIndex(idx, list.length);\n if (index === -1) {\n return '';\n }\n return list[index];\n}", s.listReplace = "const listReplace = (list, idx, value) => {\n const index = listIndex(idx, list.value.length);\n if (index === -1) {\n return;\n }\n list.value[index] = value;\n list._monitorUpToDate = false;\n}", s.listInsert = "const listInsert = (list, idx, value) => {\n const index = listIndex(idx, list.value.length + 1);\n if (index === -1) {\n return;\n }\n list.value.splice(index, 0, value);\n list._monitorUpToDate = false;\n}", s.listDelete = "const listDelete = (list, idx) => {\n if (idx === 'all') {\n list.value = [];\n return;\n }\n const index = listIndex(idx, list.value.length);\n if (index === -1) {\n return;\n }\n list.value.splice(index, 1);\n list._monitorUpToDate = false;\n}", s.listContains = "const listContains = (list, item) => {\n // TODO: evaluate whether indexOf is worthwhile here\n if (list.value.indexOf(item) !== -1) {\n return true;\n }\n for (let i = 0; i < list.value.length; i++) {\n if (compareEqual(list.value[i], item)) {\n return true;\n }\n }\n return false;\n}", s.listIndexOf = "const listIndexOf = (list, item) => {\n for (let i = 0; i < list.value.length; i++) {\n if (compareEqual(list.value[i], item)) {\n return i + 1;\n }\n }\n return 0;\n}", s.listContents = "const listContents = list => {\n for (let i = 0; i < list.value.length; i++) {\n const listItem = list.value[i];\n // this is an intentional break from what scratch 3 does to address our automatic string -> number conversions\n // it fixes more than it breaks\n if ((listItem + '').length !== 1) {\n return list.value.join(' ');\n }\n }\n return list.value.join('');\n}", s.colorToList = "const colorToList = color => globalState.Cast.toRgbColorList(color)", s.mod = "const mod = (n, modulus) => {\n let result = n % modulus;\n if (result / modulus < 0) result += modulus;\n return result;\n}", s.tan = "const tan = (angle) => {\n switch (angle % 360) {\n case -270: case 90: return Infinity;\n case -90: case 270: return -Infinity;\n }\n return Math.round(Math.tan((Math.PI * angle) / 180) * 1e10) / 1e10;\n}", s.yieldThenCall = "const yieldThenCall = function* (callback, ...args) {\n yield;\n return callback(...args);\n}", s.yieldThenCallGenerator = "const yieldThenCallGenerator = function* (callback, ...args) {\n yield;\n return yield* callback(...args);\n}"; const o = e => { r.thread = e, e.generator.next() }, a = []; o.scopedEval = e => { const t = (e => { let t = "let stuckCounter = 0;\nconst isStuck = () => {\n // The real time is not checked on every call for performance.\n stuckCounter++;\n if (stuckCounter === 100) {\n stuckCounter = 0;\n return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n }\n return false;\n};const isNotActuallyZero = val => {\n if (typeof val !== 'string') return false;\n for (let i = 0; i < val.length; i++) {\n const code = val.charCodeAt(i);\n if (code === 48 || code === 9) {\n return false;\n }\n }\n return true;\n};const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);const listIndexSlow = (index, length) => {\n if (index === 'last') {\n return length - 1;\n } else if (index === 'random' || index === 'any') {\n if (length > 0) {\n return (Math.random() * length) | 0;\n }\n return -1;\n }\n index = (+index || 0) | 0;\n if (index < 1 || index > length) {\n return -1;\n }\n return index - 1;\n};\nconst listIndex = (index, length) => {\n if (typeof index !== 'number') {\n return listIndexSlow(index, length);\n }\n index = index | 0;\n return index < 1 || index > length ? -1 : index - 1;\n};"; for (const n of Object.keys(s)) e.includes(n) && (t += "".concat(s[n], ";")); return t += "return ".concat(e), t })(e); try { return new Function("globalState", t)(r) } catch (e) { throw r.log.error("was unable to compile script", t), e } }, o.runtimeFunctions = s, o.saveGlobalState = () => { a.push(r.thread) }, o.restoreGlobalState = () => { r.thread = a.pop() }, e.exports = o }, function (e, t, n) { const r = n(80), i = n(76), s = n(1), o = n(25), { Map: a } = n(24), l = n(2), c = new r; let u = -1; const d = function (e, t, n, r, i) { const s = r.id, c = r.opcode, u = r._isHat, d = r._isConditional, h = r._isLoop; if (n.pushReportedValue(e), u) if (n.stackClick) n.status = o.STATUS_RUNNING; else if (t.runtime.getIsEdgeActivatedHat(c)) { const r = n.target.hasEdgeActivatedValue(s), i = n.target.updateEdgeActivatedValue(s, e); (r ? !i && e : e) ? n.status = o.STATUS_RUNNING : t.retireThread(n) } else e ? n.status = o.STATUS_RUNNING : t.retireThread(n); else if ((d || h) && void 0 !== e) t.stepToBranch(n, l.toNumber(e), h); else { if (i && void 0 !== e && n.atStackTop() && (n.stackClick && t.runtime.visualReport(s, e), n.updateMonitor)) { const n = t.runtime.monitorBlocks.getBlock(s).targetId; if (n && !t.runtime.getTargetById(n)) return; t.runtime.requestUpdateMonitor(a({ id: s, spriteName: n ? t.runtime.getTargetById(n).getName() : null, value: e })) } n.status = o.STATUS_RUNNING } }, h = (e, t, n, r, i) => { if (d(e, t, n, r, i), i && (!r._isHat || n.stackClick)) { let e, t; do { const r = n.popStack(); if (null === r) return; if (t = n.target.blocks.getNextBlock(r), null !== t) break; e = n.peekStackFrame() } while (null !== e && !e.isLoop); n.pushStack(t) } }, p = (e, t, n, r, i) => { n.status === o.STATUS_RUNNING && (n.status = o.STATUS_PROMISE_WAIT), e.then((e => { h(e, t, n, r, i) }), (e => { s.warn("Primitive rejected promise: ", e), h("".concat(e), t, n, r, i) })) }; class m { constructor(e, t) { this.id = t.id, this.opcode = t.opcode, this.fields = t.fields, this.inputs = t.inputs, this.mutation = t.mutation, this._profiler = null, this._profilerFrame = null, this._isHat = !1, this._blockFunction = null, this._definedBlockFunction = !1, this._isShadowBlock = !1, this._shadowValue = null, this._fields = Object.assign({}, this.fields), this._inputs = Object.assign({}, this.inputs), this._argValues = { mutation: this.mutation }, this._parentKey = null, this._parentValues = null, this._ops = []; const { runtime: n } = c.sequencer, { opcode: r, fields: s, inputs: o } = this; this._isHat = n.getIsHat(r), this._blockFunction = n.getOpcodeFunction(r), this._definedBlockFunction = void 0 !== this._blockFunction; const a = n._flowing[r]; this._isConditional = !(!a || !a.conditional), this._isLoop = !(!a || !a.loop); const l = Object.keys(s); this._isShadowBlock = !this._definedBlockFunction && 1 === l.length && 0 === Object.keys(o).length, this._shadowValue = this._isShadowBlock && s[l[0]].value; for (const e in s) this._argValues[e] = "VARIABLE" === e || "LIST" === e || "BROADCAST_OPTION" === e ? { id: s[e].id, name: s[e].value } : s[e].value; if (delete this._inputs.custom_block, "BROADCAST_INPUT" in this._inputs) { this._argValues.BROADCAST_OPTION = { id: null, name: null }; const t = this._inputs.BROADCAST_INPUT; if (t.block === t.shadow) { const n = e.getBlock(t.shadow).fields.BROADCAST_OPTION; this._argValues.BROADCAST_OPTION.id = n.id, this._argValues.BROADCAST_OPTION.name = n.value, delete this._inputs.BROADCAST_INPUT } } for (const t in this._inputs) { const n = this._inputs[t]; if (n.block) { const r = i.getCached(e, n.block, m); if (r._isHat) continue; this._ops.push(...r._ops), r._parentKey = t, r._parentValues = this._argValues, r._isShadowBlock && (this._argValues[t] = r._shadowValue) } } this._definedBlockFunction && this._ops.push(this) } } e.exports = function (e, t) { const n = e.runtime; c.sequencer = e, c.thread = t; const r = t.peekStack(), s = t.peekStackFrame(); let a = t.blockContainer, h = i.getCached(a, r, m); if (null === h && (a = n.flyoutBlocks, h = i.getCached(a, r, m), null === h)) return void e.retireThread(t); const f = h._ops, g = f.length; let y = 0; if (null !== s.reported) { const e = s.reported; for (; y < e.length; y++) { const { opCached: t, inputValue: n } = e[y], r = f.find((e => e.id === t)); if (r) { const e = r._parentKey, t = r._parentValues; "BROADCAST_INPUT" === e ? (t.BROADCAST_OPTION.id = null, t.BROADCAST_OPTION.name = l.toString(n)) : t[e] = n } } if (e.length > 0) { const t = e.reverse().find((e => f.find((t => t.id === e.opCached)))); y = t ? f.findIndex((e => e.id === t.opCached)) + 1 : 0 } if (null !== t.justReported && f[y] && f[y].id === s.reporting) { const e = f[y], n = t.justReported; t.justReported = null; const r = e._parentKey, i = e._parentValues; "BROADCAST_INPUT" === r ? (i.BROADCAST_OPTION.id = null, i.BROADCAST_OPTION.name = l.toString(n)) : i[r] = n, y += 1 } s.reporting = null, s.reported = null, s.waitingReporter = !1 } const b = y; for (; y < g; y++) { const n = y === g - 1, r = f[y]; s.op = r; const i = r._blockFunction, u = r._argValues; a.forceNoGlow || (t.requestScriptGlowInFrame = !0); const h = i(u, c), m = null !== (v = h) && "object" == typeof v && "function" == typeof v.then; if (m || s.waitingReporter) { m && p(h, e, t, r, n), t.justReported = null, s.reporting = f[y].id, s.reported = f.slice(0, y).map((e => { const t = e._parentKey, n = e._parentValues; return "BROADCAST_INPUT" === t ? { opCached: e.id, inputValue: n[t].BROADCAST_OPTION.name } : { opCached: e.id, inputValue: n[t] } })); break } if (t.status === o.STATUS_RUNNING) if (n) d(h, e, t, r, n); else { const e = r._parentKey, t = r._parentValues; "BROADCAST_INPUT" === e ? (t.BROADCAST_OPTION.id = null, t.BROADCAST_OPTION.name = l.toString(h)) : t[e] = h } else if (t.status === o.STATUS_DONE) break } var v; if (null !== n.profiler) { h._profiler !== n.profiler && function (e, t) { t._profiler = e, -1 === u && (u = e.idByName("blockFunction")); const n = t._ops; for (let t = 0; t < n.length; t++)n[t]._profilerFrame = e.frame(u, n[t].opcode) }(n.profiler, h); const e = Math.min(y + 1, g); for (let t = b; t < e; t++)f[t]._profilerFrame.count += 1 } } }, function (e, t, n) { const r = n(5), i = n(7), s = n(2), o = n(12), a = n(252), l = n(13); class c extends a { constructor(e, t) { super(t, e.blocks), this.sprite = e, this.renderer = null, this.runtime && (this.renderer = this.runtime.renderer), this.drawableID = null, this.dragging = !1, this.effects = { color: 0, fisheye: 0, whirl: 0, pixelate: 0, mosaic: 0, brightness: 0, ghost: 0 }, this.isOriginal = !0, this.isStage = !1, this.x = 0, this.y = 0, this.direction = 90, this.draggable = !1, this.visible = !0, this.size = 100, this.currentCostume = 0, this.rotationStyle = c.ROTATION_STYLE_ALL_AROUND, this.volume = 100, this.tempo = 60, this.videoTransparency = 50, this.videoState = c.VIDEO_STATE.ON, this.textToSpeechLanguage = null, this.onTargetMoved = null, this.onTargetVisualChange = null, this.interpolationData = null } initDrawable(e) { this.renderer && (this.drawableID = this.renderer.createDrawable(e)), this.isOriginal || this.runtime.startHats("control_start_as_clone", null, this) } get audioPlayer() { console.warn("get audioPlayer deprecated, please update to use .sprite.soundBank methods"), console.warn(new Error("stack for debug").stack); const e = this.sprite.soundBank, t = { playSound: t => e.play(this, t) }; return Object.defineProperty(this, "audioPlayer", { configurable: !1, enumerable: !0, writable: !1, value: t }), t } initAudio() { } static get ROTATION_STYLE_ALL_AROUND() { return "all around" } static get ROTATION_STYLE_LEFT_RIGHT() { return "left-right" } static get ROTATION_STYLE_NONE() { return "don't rotate" } static get VIDEO_STATE() { return { OFF: "off", ON: "on", ON_FLIPPED: "on-flipped" } } emitVisualChange() { this.onTargetVisualChange && this.onTargetVisualChange(this) } setXY(e, t, n) { if (this.isStage) return; if (this.dragging && !n) return; const r = this.x, i = this.y; if (this.renderer) { const n = this.runtime.runtimeOptions.fencing ? this.renderer.getFencedPositionOfDrawable(this.drawableID, [e, t]) : [e, t]; this.x = n[0], this.y = n[1], this.renderer.updateDrawablePosition(this.drawableID, n), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()) } else this.x = e, this.y = t; this.onTargetMoved && this.onTargetMoved(this, r, i, n), this.runtime.requestTargetsUpdate(this) } _getRenderedDirectionAndScale() { let e = this.direction, t = [this.size, this.size]; if (this.rotationStyle === c.ROTATION_STYLE_NONE) e = 90; else if (this.rotationStyle === c.ROTATION_STYLE_LEFT_RIGHT) { e = 90; t = [(this.direction < 0 ? -1 : 1) * this.size, this.size] } return { direction: e, scale: t } } setDirection(e) { if (!this.isStage && isFinite(e)) { if (this.direction = r.wrapClamp(e, -179, 180), this.renderer) { const { direction: e, scale: t } = this._getRenderedDirectionAndScale(); this.renderer.updateDrawableDirectionScale(this.drawableID, e, t), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()) } this.runtime.requestTargetsUpdate(this) } } setDraggable(e) { this.isStage || (this.draggable = !!e, this.runtime.requestTargetsUpdate(this)) } setVisible(e) { this.isStage || (this.visible = !!e, this.renderer && (this.renderer.updateDrawableVisible(this.drawableID, this.visible), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw())), this.runtime.requestTargetsUpdate(this)) } setSize(e) { if (!this.isStage) { if (this.renderer) { const t = this.renderer.getCurrentSkinSize(this.drawableID), n = t[0], i = t[1], s = this.runtime.runtimeOptions.fencing, o = s ? Math.min(1, Math.max(5 / n, 5 / i)) : 0, a = s ? Math.min(1.5 * this.runtime.stageWidth / n, 1.5 * this.runtime.stageHeight / i) : 1 / 0; this.size = 100 * r.clamp(e / 100, o, a); const { direction: l, scale: c } = this._getRenderedDirectionAndScale(); this.renderer.updateDrawableDirectionScale(this.drawableID, l, c), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()) } else this.size = e; this.runtime.requestTargetsUpdate(this) } } setEffect(e, t) { Object.prototype.hasOwnProperty.call(this.effects, e) && (this.effects[e] = t, this.renderer && (this.renderer.updateDrawableEffect(this.drawableID, e, t), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()))) } clearEffects() { for (const e in this.effects) Object.prototype.hasOwnProperty.call(this.effects, e) && (this.effects[e] = 0); if (this.renderer) { for (const e in this.effects) Object.prototype.hasOwnProperty.call(this.effects, e) && this.renderer.updateDrawableEffect(this.drawableID, e, 0); this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()) } } setCostume(e) { if ((e = Math.round(e)) !== 1 / 0 && e !== -1 / 0 && e || (e = 0), this.currentCostume = r.wrapClamp(e, 0, this.sprite.costumes.length - 1), this.renderer) { const e = this.sprite.costumes[this.currentCostume]; this.renderer.updateDrawableSkinId(this.drawableID, e.skinId), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()) } this.runtime.requestTargetsUpdate(this) } addCostume(e, t) { "number" != typeof t || isNaN(t) ? this.sprite.addCostumeAt(e, this.sprite.costumes.length) : this.sprite.addCostumeAt(e, t) } renameCostume(e, t) { const n = this.sprite.costumes.filter(((t, n) => e !== n)).map((e => e.name)), r = this.getCostumes()[e].name, s = i.unusedName(t, n); if (this.getCostumes()[e].name = s, this.isStage) { const e = this.runtime.targets; for (let t = 0; t < e.length; t++) { e[t].blocks.updateAssetName(r, s, "backdrop") } } else this.blocks.updateAssetName(r, s, "costume") } deleteCostume(e) { const t = this.sprite.costumes.length; if (1 === t) return null; if (e < 0 || e >= t) return null; const n = this.sprite.deleteCostumeAt(e); return e === this.currentCostume && e === t - 1 ? this.setCostume(e - 1) : e < this.currentCostume ? this.setCostume(this.currentCostume - 1) : this.setCostume(this.currentCostume), this.runtime.requestTargetsUpdate(this), n } addSound(e, t) { const n = this.sprite.sounds.map((e => e.name)); e.name = i.unusedName(e.name, n), "number" != typeof t || isNaN(t) ? this.sprite.sounds.push(e) : this.sprite.sounds.splice(t, 0, e) } renameSound(e, t) { const n = this.sprite.sounds.filter(((t, n) => e !== n)).map((e => e.name)), r = this.sprite.sounds[e].name, s = i.unusedName(t, n); this.sprite.sounds[e].name = s, this.blocks.updateAssetName(r, s, "sound") } deleteSound(e) { if (e < 0 || e >= this.sprite.sounds.length) return null; const t = this.sprite.sounds.splice(e, 1)[0]; return this.runtime.requestTargetsUpdate(this), t } setRotationStyle(e) { if (e === c.ROTATION_STYLE_NONE ? this.rotationStyle = c.ROTATION_STYLE_NONE : e === c.ROTATION_STYLE_ALL_AROUND ? this.rotationStyle = c.ROTATION_STYLE_ALL_AROUND : e === c.ROTATION_STYLE_LEFT_RIGHT && (this.rotationStyle = c.ROTATION_STYLE_LEFT_RIGHT), this.renderer) { const { direction: e, scale: t } = this._getRenderedDirectionAndScale(); this.renderer.updateDrawableDirectionScale(this.drawableID, e, t), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()) } this.runtime.requestTargetsUpdate(this) } getCostumeIndexByName(e) { const t = this.getCostumes(); for (let n = 0; n < t.length; n++)if (t[n].name === e) return n; return -1 } getCurrentCostume() { return this.getCostumes()[this.currentCostume] } getCostumes() { return this.sprite.costumes } reorderCostume(e, t) { if ((t = r.clamp(t, 0, this.sprite.costumes.length - 1)) === (e = r.clamp(e, 0, this.sprite.costumes.length - 1))) return !1; const n = this.getCurrentCostume(), i = this.sprite.costumes[e]; return this.sprite.deleteCostumeAt(e), this.addCostume(i, t), this.currentCostume = this.getCostumeIndexByName(n.name), !0 } reorderSound(e, t) { if ((t = r.clamp(t, 0, this.sprite.sounds.length - 1)) === (e = r.clamp(e, 0, this.sprite.sounds.length - 1))) return !1; const n = this.sprite.sounds[e]; return this.deleteSound(e), this.addSound(n, t), !0 } getSounds() { return this.sprite.sounds } updateAllDrawableProperties() { if (this.renderer) { const { direction: e, scale: t } = this._getRenderedDirectionAndScale(); this.renderer.updateDrawablePosition(this.drawableID, [this.x, this.y]), this.renderer.updateDrawableDirectionScale(this.drawableID, e, t), this.renderer.updateDrawableVisible(this.drawableID, this.visible); const n = this.getCostumes()[this.currentCostume]; this.renderer.updateDrawableSkinId(this.drawableID, n.skinId); for (const e in this.effects) Object.prototype.hasOwnProperty.call(this.effects, e) && this.renderer.updateDrawableEffect(this.drawableID, e, this.effects[e]); this.visible && (this.emitVisualChange(), this.runtime.requestRedraw()) } this.runtime.requestTargetsUpdate(this) } getName() { return this.sprite.name } isSprite() { return !this.isStage && this.isOriginal } getBounds() { return this.renderer ? this.runtime.renderer.getBounds(this.drawableID) : null } getBoundsForBubble() { return this.renderer ? this.runtime.renderer.getBoundsForBubble(this.drawableID) : null } isTouchingObject(e) { if ("_mouse_" === e) { if (!this.runtime.ioDevices.mouse) return !1; const e = this.runtime.ioDevices.mouse.getClientX(), t = this.runtime.ioDevices.mouse.getClientY(); return this.isTouchingPoint(e, t) } return "_edge_" === e ? this.isTouchingEdge() : this.isTouchingSprite(e) } isTouchingPoint(e, t) { return !!this.renderer && this.renderer.drawableTouching(this.drawableID, e, t) } isTouchingEdge() { if (this.renderer) { const e = this.runtime.stageWidth, t = this.runtime.stageHeight, n = this.getBounds(); if (n.left < -e / 2 || n.right > e / 2 || n.top > t / 2 || n.bottom < -t / 2) return !0 } return !1 } isTouchingSprite(e) { e = s.toString(e); const t = this.runtime.getSpriteTargetByName(e); if (!t || !this.renderer) return !1; const n = t.sprite.clones.filter((e => !e.dragging)).map((e => e.drawableID)); return this.renderer.isTouchingDrawables(this.drawableID, n) } isTouchingColor(e) { return !!this.renderer && this.renderer.isTouchingColor(this.drawableID, e) } colorIsTouchingColor(e, t) { return !!this.renderer && this.renderer.isTouchingColor(this.drawableID, e, t) } getLayerOrder() { return this.renderer ? this.renderer.getDrawableOrder(this.drawableID) : null } goToFront() { this.renderer && this.renderer.setDrawableOrder(this.drawableID, 1 / 0, l.SPRITE_LAYER), this.runtime.setExecutablePosition(this, 1 / 0) } goToBack() { this.renderer && this.renderer.setDrawableOrder(this.drawableID, -1 / 0, l.SPRITE_LAYER, !1), this.runtime.setExecutablePosition(this, -1 / 0) } goForwardLayers(e) { this.renderer && this.renderer.setDrawableOrder(this.drawableID, e, l.SPRITE_LAYER, !0), this.runtime.moveExecutable(this, e) } goBackwardLayers(e) { this.renderer && this.renderer.setDrawableOrder(this.drawableID, -e, l.SPRITE_LAYER, !0), this.runtime.moveExecutable(this, -e) } goBehindOther(e) { if (this.renderer) { const t = this.renderer.setDrawableOrder(e.drawableID, 0, l.SPRITE_LAYER, !0); this.renderer.setDrawableOrder(this.drawableID, t, l.SPRITE_LAYER) } const t = this.runtime.executableTargets.indexOf(e); this.runtime.setExecutablePosition(this, t) } keepInFence(e, t, n) { let r = n; r || (r = { left: -this.runtime.stageWidth / 2, right: this.runtime.stageWidth / 2, top: this.runtime.stageHeight / 2, bottom: -this.runtime.stageHeight / 2 }); const i = this.getBounds(); if (!i) return; i.left += e - this.x, i.right += e - this.x, i.top += t - this.y, i.bottom += t - this.y; let s = 0, o = 0; return i.left < r.left && (s += r.left - i.left), i.right > r.right && (s += r.right - i.right), i.top > r.top && (o += r.top - i.top), i.bottom < r.bottom && (o += r.bottom - i.bottom), [e + s, t + o] } makeClone() { if (!this.runtime.clonesAvailable() || this.isStage) return null; this.runtime.changeCloneCounter(1); const e = this.sprite.createClone(); return e.x = this.x, e.y = this.y, e.direction = this.direction, e.draggable = this.draggable, e.visible = this.visible, e.size = this.size, e.currentCostume = this.currentCostume, e.rotationStyle = this.rotationStyle, e.effects = o.simple(this.effects), e.variables = this.duplicateVariables(), e._edgeActivatedHatValues = o.simple(this._edgeActivatedHatValues), e.initDrawable(l.SPRITE_LAYER), e.updateAllDrawableProperties(), e } duplicate() { return this.sprite.duplicate().then((e => { const t = e.createClone(); return t.x = 400 * (Math.random() - .5) / 2, t.y = 300 * (Math.random() - .5) / 2, t.direction = this.direction, t.draggable = this.draggable, t.visible = this.visible, t.size = this.size, t.currentCostume = this.currentCostume, t.rotationStyle = this.rotationStyle, t.effects = JSON.parse(JSON.stringify(this.effects)), t.variables = this.duplicateVariables(t.blocks), t.updateAllDrawableProperties(), t })) } onGreenFlag() { this.clearEffects() } onStopAll() { this.clearEffects() } postSpriteInfo(e) { const t = Object.prototype.hasOwnProperty.call(e, "force") ? e.force : null, n = Object.prototype.hasOwnProperty.call(e, "x"), r = Object.prototype.hasOwnProperty.call(e, "y"); (n || r) && this.setXY(n ? e.x : this.x, r ? e.y : this.y, t), Object.prototype.hasOwnProperty.call(e, "direction") && this.setDirection(e.direction), Object.prototype.hasOwnProperty.call(e, "draggable") && this.setDraggable(e.draggable), Object.prototype.hasOwnProperty.call(e, "rotationStyle") && this.setRotationStyle(e.rotationStyle), Object.prototype.hasOwnProperty.call(e, "visible") && this.setVisible(e.visible), Object.prototype.hasOwnProperty.call(e, "size") && this.setSize(e.size) } startDrag() { this.dragging = !0 } stopDrag() { this.dragging = !1 } toJSON() { const e = this.getCostumes(); return { id: this.id, name: this.getName(), isStage: this.isStage, x: this.x, y: this.y, size: this.size, direction: this.direction, draggable: this.draggable, currentCostume: this.currentCostume, costume: e[this.currentCostume], costumeCount: e.length, visible: this.visible, rotationStyle: this.rotationStyle, comments: this.comments, blocks: this.blocks._blocks, variables: this.variables, costumes: e, sounds: this.getSounds(), textToSpeechLanguage: this.textToSpeechLanguage, tempo: this.tempo, volume: this.volume, videoTransparency: this.videoTransparency, videoState: this.videoState } } dispose() { this.isOriginal || this.runtime.changeCloneCounter(-1), this.runtime.stopForTarget(this), this.runtime.removeExecutable(this), this.sprite.removeClone(this), this.renderer && null !== this.drawableID && (this.renderer.destroyDrawable(this.drawableID, this.isStage ? l.BACKGROUND_LAYER : l.SPRITE_LAYER), this.visible && (this.emitVisualChange(), this.runtime.requestRedraw())) } } e.exports = c }, function (e, t, n) { const r = n(8), i = n(33); class s { constructor(e, t, n, i, o, a, l) { this.id = e || r(), this.text = t, this.x = n, this.y = i, this.width = Math.max(Number(o), s.MIN_WIDTH), this.height = Math.max(Number(a), s.MIN_HEIGHT), this.minimized = l || !1, this.blockId = null } toXML() { return '').concat(i(this.text), "") } static get MIN_WIDTH() { return 20 } static get MIN_HEIGHT() { return 20 } static get DEFAULT_WIDTH() { return 100 } static get DEFAULT_HEIGHT() { return 100 } } e.exports = s }, function (e, t, n) { const r = n(51), i = n(16), { loadSoundFromAsset: s } = n(34), { loadCostumeFromAsset: o } = n(35), a = n(102), l = n(7), c = n(13); class u { constructor(e, t) { this.runtime = t, e || (e = new i(t)), this.blocks = e, this.name = "", this.costumes_ = [], this.sounds = [], this.clones = [], this.soundBank = null, this.runtime && this.runtime.audioEngine && (this.soundBank = this.runtime.audioEngine.createBank()) } set costumes(e) { this.costumes_ = []; for (const t of e) this.addCostumeAt(t, this.costumes_.length) } get costumes() { return this.costumes_ } addCostumeAt(e, t) { e.name || (e.name = ""); const n = this.costumes_.map((e => e.name)); e.name = l.unusedName(e.name, n), this.costumes_.splice(t, 0, e) } deleteCostumeAt(e) { return this.costumes.splice(e, 1)[0] } createClone(e) { const t = new r(this, this.runtime); if (t.isOriginal = 0 === this.clones.length, this.clones.push(t), t.initAudio(), t.isOriginal) { const n = "string" == typeof e ? e : c.SPRITE_LAYER; t.initDrawable(n), this.runtime.fireTargetWasCreated(t) } else this.runtime.fireTargetWasCreated(t, this.clones[0]); return t } removeClone(e) { this.runtime.fireTargetWasRemoved(e); const t = this.clones.indexOf(e); t >= 0 && this.clones.splice(t, 1) } duplicate() { const e = new u(null, this.runtime), t = this.blocks._blocks, n = Object.keys(t).map((e => t[e])), r = JSON.parse(JSON.stringify(n)); a(r), r.forEach((t => { e.blocks.createBlock(t) })); const i = this.runtime.targets.map((e => e.sprite.name)); e.name = l.unusedName(this.name, i); const c = []; return e.costumes = this.costumes_.map((e => { const t = Object.assign({}, e); return c.push(o(t, this.runtime)), t })), e.sounds = this.sounds.map((t => { const n = Object.assign({}, t), r = t.asset; return c.push(s(n, r, this.runtime, e.soundBank)), n })), Promise.all(c).then((() => e)) } dispose() { this.soundBank && this.soundBank.dispose() } } e.exports = u }, function (e, t, n) { e.exports = function () { "use strict"; function e(t) { return e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, e(t) } function t(e, n) { return t = Object.setPrototypeOf || function (e, t) { return e.__proto__ = t, e }, t(e, n) } function n() { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function () { }))), !0 } catch (e) { return !1 } } function r(e, i, s) { return r = n() ? Reflect.construct : function (e, n, r) { var i = [null]; i.push.apply(i, n); var s = new (Function.bind.apply(e, i)); return r && t(s, r.prototype), s }, r.apply(null, arguments) } function i(e) { return s(e) || o(e) || a(e) || c() } function s(e) { if (Array.isArray(e)) return l(e) } function o(e) { if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e) } function a(e, t) { if (e) { if ("string" == typeof e) return l(e, t); var n = Object.prototype.toString.call(e).slice(8, -1); return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? l(e, t) : void 0 } } function l(e, t) { (null == t || t > e.length) && (t = e.length); for (var n = 0, r = new Array(t); n < t; n++)r[n] = e[n]; return r } function c() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") } var u = Object.hasOwnProperty, d = Object.setPrototypeOf, h = Object.isFrozen, p = Object.getPrototypeOf, m = Object.getOwnPropertyDescriptor, f = Object.freeze, g = Object.seal, y = Object.create, b = "undefined" != typeof Reflect && Reflect, v = b.apply, S = b.construct; v || (v = function (e, t, n) { return e.apply(t, n) }), f || (f = function (e) { return e }), g || (g = function (e) { return e }), S || (S = function (e, t) { return r(e, i(t)) }); var w = R(Array.prototype.forEach), k = R(Array.prototype.pop), T = R(Array.prototype.push), x = R(String.prototype.toLowerCase), E = R(String.prototype.toString), A = R(String.prototype.match), C = R(String.prototype.replace), I = R(String.prototype.indexOf), O = R(String.prototype.trim), M = R(RegExp.prototype.test), N = D(TypeError); function R(e) { return function (t) { for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++)r[i - 1] = arguments[i]; return v(e, t, r) } } function D(e) { return function () { for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++)n[r] = arguments[r]; return S(e, n) } } function P(e, t, n) { var r; n = null !== (r = n) && void 0 !== r ? r : x, d && d(e, null); for (var i = t.length; i--;) { var s = t[i]; if ("string" == typeof s) { var o = n(s); o !== s && (h(t) || (t[i] = o), s = o) } e[s] = !0 } return e } function L(e) { var t, n = y(null); for (t in e) !0 === v(u, e, [t]) && (n[t] = e[t]); return n } function B(e, t) { for (; null !== e;) { var n = m(e, t); if (n) { if (n.get) return R(n.get); if ("function" == typeof n.value) return R(n.value) } e = p(e) } function r(e) { return console.warn("fallback value for", e), null } return r } var z = f(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), U = f(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), j = f(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), F = f(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), W = f(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), V = f(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), G = f(["#text"]), q = f(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), Y = f(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), H = f(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), _ = f(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), K = g(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Q = g(/<%[\w\W]*|[\w\W]*%>/gm), X = g(/\${[\w\W]*}/gm), Z = g(/^data-[\-\w.\u00B7-\uFFFF]/), J = g(/^aria-[\-\w]+$/), $ = g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), ee = g(/^(?:\w+script|data):/i), te = g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), ne = g(/^html$/i), re = g(/^[a-z][.\w]*(-[.\w]+)+$/i), ie = function () { return "undefined" == typeof window ? null : window }, se = function (t, n) { if ("object" !== e(t) || "function" != typeof t.createPolicy) return null; var r = null, i = "data-tt-policy-suffix"; n.currentScript && n.currentScript.hasAttribute(i) && (r = n.currentScript.getAttribute(i)); var s = "dompurify" + (r ? "#" + r : ""); try { return t.createPolicy(s, { createHTML: function (e) { return e }, createScriptURL: function (e) { return e } }) } catch (e) { return console.warn("TrustedTypes policy " + s + " could not be created."), null } }; function oe() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ie(), n = function (e) { return oe(e) }; if (n.version = "2.5.6", n.removed = [], !t || !t.document || 9 !== t.document.nodeType) return n.isSupported = !1, n; var r = t.document, s = t.document, o = t.DocumentFragment, a = t.HTMLTemplateElement, l = t.Node, c = t.Element, u = t.NodeFilter, d = t.NamedNodeMap, h = void 0 === d ? t.NamedNodeMap || t.MozNamedAttrMap : d, p = t.HTMLFormElement, m = t.DOMParser, g = t.trustedTypes, y = c.prototype, b = B(y, "cloneNode"), v = B(y, "nextSibling"), S = B(y, "childNodes"), R = B(y, "parentNode"); if ("function" == typeof a) { var D = s.createElement("template"); D.content && D.content.ownerDocument && (s = D.content.ownerDocument) } var ae = se(g, r), le = ae ? ae.createHTML("") : "", ce = s, ue = ce.implementation, de = ce.createNodeIterator, he = ce.createDocumentFragment, pe = ce.getElementsByTagName, me = r.importNode, fe = {}; try { fe = L(s).documentMode ? s.documentMode : {} } catch (e) { } var ge = {}; n.isSupported = "function" == typeof R && ue && void 0 !== ue.createHTMLDocument && 9 !== fe; var ye, be, ve = K, Se = Q, we = X, ke = Z, Te = J, xe = ee, Ee = te, Ae = re, Ce = $, Ie = null, Oe = P({}, [].concat(i(z), i(U), i(j), i(W), i(G))), Me = null, Ne = P({}, [].concat(i(q), i(Y), i(H), i(_))), Re = Object.seal(Object.create(null, { tagNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, attributeNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, allowCustomizedBuiltInElements: { writable: !0, configurable: !1, enumerable: !0, value: !1 } })), De = null, Pe = null, Le = !0, Be = !0, ze = !1, Ue = !0, je = !1, Fe = !0, We = !1, Ve = !1, Ge = !1, qe = !1, Ye = !1, He = !1, _e = !0, Ke = !1, Qe = "user-content-", Xe = !0, Ze = !1, Je = {}, $e = null, et = P({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), tt = null, nt = P({}, ["audio", "video", "img", "source", "image", "track"]), rt = null, it = P({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), st = "http://www.w3.org/1998/Math/MathML", ot = "http://www.w3.org/2000/svg", at = "http://www.w3.org/1999/xhtml", lt = at, ct = !1, ut = null, dt = P({}, [st, ot, at], E), ht = ["application/xhtml+xml", "text/html"], pt = "text/html", mt = null, ft = s.createElement("form"), gt = function (e) { return e instanceof RegExp || e instanceof Function }, yt = function (t) { mt && mt === t || (t && "object" === e(t) || (t = {}), t = L(t), ye = ye = -1 === ht.indexOf(t.PARSER_MEDIA_TYPE) ? pt : t.PARSER_MEDIA_TYPE, be = "application/xhtml+xml" === ye ? E : x, Ie = "ALLOWED_TAGS" in t ? P({}, t.ALLOWED_TAGS, be) : Oe, Me = "ALLOWED_ATTR" in t ? P({}, t.ALLOWED_ATTR, be) : Ne, ut = "ALLOWED_NAMESPACES" in t ? P({}, t.ALLOWED_NAMESPACES, E) : dt, rt = "ADD_URI_SAFE_ATTR" in t ? P(L(it), t.ADD_URI_SAFE_ATTR, be) : it, tt = "ADD_DATA_URI_TAGS" in t ? P(L(nt), t.ADD_DATA_URI_TAGS, be) : nt, $e = "FORBID_CONTENTS" in t ? P({}, t.FORBID_CONTENTS, be) : et, De = "FORBID_TAGS" in t ? P({}, t.FORBID_TAGS, be) : {}, Pe = "FORBID_ATTR" in t ? P({}, t.FORBID_ATTR, be) : {}, Je = "USE_PROFILES" in t && t.USE_PROFILES, Le = !1 !== t.ALLOW_ARIA_ATTR, Be = !1 !== t.ALLOW_DATA_ATTR, ze = t.ALLOW_UNKNOWN_PROTOCOLS || !1, Ue = !1 !== t.ALLOW_SELF_CLOSE_IN_ATTR, je = t.SAFE_FOR_TEMPLATES || !1, Fe = !1 !== t.SAFE_FOR_XML, We = t.WHOLE_DOCUMENT || !1, qe = t.RETURN_DOM || !1, Ye = t.RETURN_DOM_FRAGMENT || !1, He = t.RETURN_TRUSTED_TYPE || !1, Ge = t.FORCE_BODY || !1, _e = !1 !== t.SANITIZE_DOM, Ke = t.SANITIZE_NAMED_PROPS || !1, Xe = !1 !== t.KEEP_CONTENT, Ze = t.IN_PLACE || !1, Ce = t.ALLOWED_URI_REGEXP || Ce, lt = t.NAMESPACE || at, Re = t.CUSTOM_ELEMENT_HANDLING || {}, t.CUSTOM_ELEMENT_HANDLING && gt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Re.tagNameCheck = t.CUSTOM_ELEMENT_HANDLING.tagNameCheck), t.CUSTOM_ELEMENT_HANDLING && gt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Re.attributeNameCheck = t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), t.CUSTOM_ELEMENT_HANDLING && "boolean" == typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (Re.allowCustomizedBuiltInElements = t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), je && (Be = !1), Ye && (qe = !0), Je && (Ie = P({}, i(G)), Me = [], !0 === Je.html && (P(Ie, z), P(Me, q)), !0 === Je.svg && (P(Ie, U), P(Me, Y), P(Me, _)), !0 === Je.svgFilters && (P(Ie, j), P(Me, Y), P(Me, _)), !0 === Je.mathMl && (P(Ie, W), P(Me, H), P(Me, _))), t.ADD_TAGS && (Ie === Oe && (Ie = L(Ie)), P(Ie, t.ADD_TAGS, be)), t.ADD_ATTR && (Me === Ne && (Me = L(Me)), P(Me, t.ADD_ATTR, be)), t.ADD_URI_SAFE_ATTR && P(rt, t.ADD_URI_SAFE_ATTR, be), t.FORBID_CONTENTS && ($e === et && ($e = L($e)), P($e, t.FORBID_CONTENTS, be)), Xe && (Ie["#text"] = !0), We && P(Ie, ["html", "head", "body"]), Ie.table && (P(Ie, ["tbody"]), delete De.tbody), f && f(t), mt = t) }, bt = P({}, ["mi", "mo", "mn", "ms", "mtext"]), vt = P({}, ["foreignobject", "annotation-xml"]), St = P({}, ["title", "style", "font", "a", "script"]), wt = P({}, U); P(wt, j), P(wt, F); var kt = P({}, W); P(kt, V); var Tt = function (e) { var t = R(e); t && t.tagName || (t = { namespaceURI: lt, tagName: "template" }); var n = x(e.tagName), r = x(t.tagName); return !!ut[e.namespaceURI] && (e.namespaceURI === ot ? t.namespaceURI === at ? "svg" === n : t.namespaceURI === st ? "svg" === n && ("annotation-xml" === r || bt[r]) : Boolean(wt[n]) : e.namespaceURI === st ? t.namespaceURI === at ? "math" === n : t.namespaceURI === ot ? "math" === n && vt[r] : Boolean(kt[n]) : e.namespaceURI === at ? !(t.namespaceURI === ot && !vt[r]) && !(t.namespaceURI === st && !bt[r]) && !kt[n] && (St[n] || !wt[n]) : !("application/xhtml+xml" !== ye || !ut[e.namespaceURI])) }, xt = function (e) { T(n.removed, { element: e }); try { e.parentNode.removeChild(e) } catch (t) { try { e.outerHTML = le } catch (t) { e.remove() } } }, Et = function (e, t) { try { T(n.removed, { attribute: t.getAttributeNode(e), from: t }) } catch (e) { T(n.removed, { attribute: null, from: t }) } if (t.removeAttribute(e), "is" === e && !Me[e]) if (qe || Ye) try { xt(t) } catch (e) { } else try { t.setAttribute(e, "") } catch (e) { } }, At = function (e) { var t, n; if (Ge) e = "" + e; else { var r = A(e, /^[\r\n\t ]+/); n = r && r[0] } "application/xhtml+xml" === ye && lt === at && (e = '' + e + ""); var i = ae ? ae.createHTML(e) : e; if (lt === at) try { t = (new m).parseFromString(i, ye) } catch (e) { } if (!t || !t.documentElement) { t = ue.createDocument(lt, "template", null); try { t.documentElement.innerHTML = ct ? le : i } catch (e) { } } var o = t.body || t.documentElement; return e && n && o.insertBefore(s.createTextNode(n), o.childNodes[0] || null), lt === at ? pe.call(t, We ? "html" : "body")[0] : We ? t.documentElement : o }, Ct = function (e) { return de.call(e.ownerDocument || e, e, u.SHOW_ELEMENT | u.SHOW_COMMENT | u.SHOW_TEXT | u.SHOW_PROCESSING_INSTRUCTION | u.SHOW_CDATA_SECTION, null, !1) }, It = function (e) { return e instanceof p && ("string" != typeof e.nodeName || "string" != typeof e.textContent || "function" != typeof e.removeChild || !(e.attributes instanceof h) || "function" != typeof e.removeAttribute || "function" != typeof e.setAttribute || "string" != typeof e.namespaceURI || "function" != typeof e.insertBefore || "function" != typeof e.hasChildNodes) }, Ot = function (t) { return "object" === e(l) ? t instanceof l : t && "object" === e(t) && "number" == typeof t.nodeType && "string" == typeof t.nodeName }, Mt = function (e, t, r) { ge[e] && w(ge[e], (function (e) { e.call(n, t, r, mt) })) }, Nt = function (e) { var t; if (Mt("beforeSanitizeElements", e, null), It(e)) return xt(e), !0; if (M(/[\u0080-\uFFFF]/, e.nodeName)) return xt(e), !0; var r = be(e.nodeName); if (Mt("uponSanitizeElement", e, { tagName: r, allowedTags: Ie }), e.hasChildNodes() && !Ot(e.firstElementChild) && (!Ot(e.content) || !Ot(e.content.firstElementChild)) && M(/<[/\w]/g, e.innerHTML) && M(/<[/\w]/g, e.textContent)) return xt(e), !0; if ("select" === r && M(/