UNPKG

@vladmandic/face-api

Version:

FaceAPI: AI-powered Face Detection & Rotation Tracking, Face Description & Recognition, Age & Gender & Emotion Prediction for Browser and NodeJS using TensorFlow/JS

1,718 lines (1,702 loc) 2.36 MB
/* Face-API homepage: <https://github.com/vladmandic/face-api> author: <https://github.com/vladmandic>' */ var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); var __require = (x) => { if (typeof require !== "undefined") return require(x); throw new Error('Dynamic require of "' + x + '" is not supported'); }; var __commonJS = (cb, mod4) => function __require2() { return mod4 || (0, cb[Object.keys(cb)[0]])((mod4 = { exports: {} }).exports, mod4), mod4.exports; }; var __export = (target, all5) => { __markAsModule(target); for (var name in all5) __defProp(target, name, { get: all5[name], enumerable: true }); }; var __reExport = (target, module, desc) => { if (module && typeof module === "object" || typeof module === "function") { for (let key of __getOwnPropNames(module)) if (!__hasOwnProp.call(target, key) && key !== "default") __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable }); } return target; }; var __toModule = (module) => { return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module); }; // node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js var require_long = __commonJS({ "node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js"(exports, module) { module.exports = Long2; var wasm = null; try { wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 ])), {}).exports; } catch (e) { } function Long2(low, high, unsigned) { this.low = low | 0; this.high = high | 0; this.unsigned = !!unsigned; } Long2.prototype.__isLong__; Object.defineProperty(Long2.prototype, "__isLong__", { value: true }); function isLong(obj) { return (obj && obj["__isLong__"]) === true; } Long2.isLong = isLong; var INT_CACHE = {}; var UINT_CACHE = {}; function fromInt(value, unsigned) { var obj, cachedObj, cache; if (unsigned) { value >>>= 0; if (cache = 0 <= value && value < 256) { cachedObj = UINT_CACHE[value]; if (cachedObj) return cachedObj; } obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true); if (cache) UINT_CACHE[value] = obj; return obj; } else { value |= 0; if (cache = -128 <= value && value < 128) { cachedObj = INT_CACHE[value]; if (cachedObj) return cachedObj; } obj = fromBits(value, value < 0 ? -1 : 0, false); if (cache) INT_CACHE[value] = obj; return obj; } } Long2.fromInt = fromInt; function fromNumber(value, unsigned) { if (isNaN(value)) return unsigned ? UZERO : ZERO; if (unsigned) { if (value < 0) return UZERO; if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE; } else { if (value <= -TWO_PWR_63_DBL) return MIN_VALUE; if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE; } if (value < 0) return fromNumber(-value, unsigned).neg(); return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned); } Long2.fromNumber = fromNumber; function fromBits(lowBits, highBits, unsigned) { return new Long2(lowBits, highBits, unsigned); } Long2.fromBits = fromBits; var pow_dbl = Math.pow; function fromString(str, unsigned, radix) { if (str.length === 0) throw Error("empty string"); if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return ZERO; if (typeof unsigned === "number") { radix = unsigned, unsigned = false; } else { unsigned = !!unsigned; } radix = radix || 10; if (radix < 2 || 36 < radix) throw RangeError("radix"); var p2; if ((p2 = str.indexOf("-")) > 0) throw Error("interior hyphen"); else if (p2 === 0) { return fromString(str.substring(1), unsigned, radix).neg(); } var radixToPower = fromNumber(pow_dbl(radix, 8)); var result = ZERO; for (var i = 0; i < str.length; i += 8) { var size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix); if (size < 8) { var power = fromNumber(pow_dbl(radix, size)); result = result.mul(power).add(fromNumber(value)); } else { result = result.mul(radixToPower); result = result.add(fromNumber(value)); } } result.unsigned = unsigned; return result; } Long2.fromString = fromString; function fromValue(val, unsigned) { if (typeof val === "number") return fromNumber(val, unsigned); if (typeof val === "string") return fromString(val, unsigned); return fromBits(val.low, val.high, typeof unsigned === "boolean" ? unsigned : val.unsigned); } Long2.fromValue = fromValue; var TWO_PWR_16_DBL = 1 << 16; var TWO_PWR_24_DBL = 1 << 24; var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL); var ZERO = fromInt(0); Long2.ZERO = ZERO; var UZERO = fromInt(0, true); Long2.UZERO = UZERO; var ONE = fromInt(1); Long2.ONE = ONE; var UONE = fromInt(1, true); Long2.UONE = UONE; var NEG_ONE = fromInt(-1); Long2.NEG_ONE = NEG_ONE; var MAX_VALUE = fromBits(4294967295 | 0, 2147483647 | 0, false); Long2.MAX_VALUE = MAX_VALUE; var MAX_UNSIGNED_VALUE = fromBits(4294967295 | 0, 4294967295 | 0, true); Long2.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE; var MIN_VALUE = fromBits(0, 2147483648 | 0, false); Long2.MIN_VALUE = MIN_VALUE; var LongPrototype = Long2.prototype; LongPrototype.toInt = function toInt() { return this.unsigned ? this.low >>> 0 : this.low; }; LongPrototype.toNumber = function toNumber() { if (this.unsigned) return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0); return this.high * TWO_PWR_32_DBL + (this.low >>> 0); }; LongPrototype.toString = function toString(radix) { radix = radix || 10; if (radix < 2 || 36 < radix) throw RangeError("radix"); if (this.isZero()) return "0"; if (this.isNegative()) { if (this.eq(MIN_VALUE)) { var radixLong = fromNumber(radix), div3 = this.div(radixLong), rem1 = div3.mul(radixLong).sub(this); return div3.toString(radix) + rem1.toInt().toString(radix); } else return "-" + this.neg().toString(radix); } var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this; var result = ""; while (true) { var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix); rem = remDiv; if (rem.isZero()) return digits + result; else { while (digits.length < 6) digits = "0" + digits; result = "" + digits + result; } } }; LongPrototype.getHighBits = function getHighBits() { return this.high; }; LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() { return this.high >>> 0; }; LongPrototype.getLowBits = function getLowBits() { return this.low; }; LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() { return this.low >>> 0; }; LongPrototype.getNumBitsAbs = function getNumBitsAbs() { if (this.isNegative()) return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs(); var val = this.high != 0 ? this.high : this.low; for (var bit = 31; bit > 0; bit--) if ((val & 1 << bit) != 0) break; return this.high != 0 ? bit + 33 : bit + 1; }; LongPrototype.isZero = function isZero() { return this.high === 0 && this.low === 0; }; LongPrototype.eqz = LongPrototype.isZero; LongPrototype.isNegative = function isNegative() { return !this.unsigned && this.high < 0; }; LongPrototype.isPositive = function isPositive() { return this.unsigned || this.high >= 0; }; LongPrototype.isOdd = function isOdd() { return (this.low & 1) === 1; }; LongPrototype.isEven = function isEven2() { return (this.low & 1) === 0; }; LongPrototype.equals = function equals(other) { if (!isLong(other)) other = fromValue(other); if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1) return false; return this.high === other.high && this.low === other.low; }; LongPrototype.eq = LongPrototype.equals; LongPrototype.notEquals = function notEquals(other) { return !this.eq(other); }; LongPrototype.neq = LongPrototype.notEquals; LongPrototype.ne = LongPrototype.notEquals; LongPrototype.lessThan = function lessThan(other) { return this.comp(other) < 0; }; LongPrototype.lt = LongPrototype.lessThan; LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { return this.comp(other) <= 0; }; LongPrototype.lte = LongPrototype.lessThanOrEqual; LongPrototype.le = LongPrototype.lessThanOrEqual; LongPrototype.greaterThan = function greaterThan(other) { return this.comp(other) > 0; }; LongPrototype.gt = LongPrototype.greaterThan; LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { return this.comp(other) >= 0; }; LongPrototype.gte = LongPrototype.greaterThanOrEqual; LongPrototype.ge = LongPrototype.greaterThanOrEqual; LongPrototype.compare = function compare(other) { if (!isLong(other)) other = fromValue(other); if (this.eq(other)) return 0; var thisNeg = this.isNegative(), otherNeg = other.isNegative(); if (thisNeg && !otherNeg) return -1; if (!thisNeg && otherNeg) return 1; if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1; return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1; }; LongPrototype.comp = LongPrototype.compare; LongPrototype.negate = function negate() { if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE; return this.not().add(ONE); }; LongPrototype.neg = LongPrototype.negate; LongPrototype.add = function add5(addend) { if (!isLong(addend)) addend = fromValue(addend); var a48 = this.high >>> 16; var a32 = this.high & 65535; var a16 = this.low >>> 16; var a00 = this.low & 65535; var b48 = addend.high >>> 16; var b32 = addend.high & 65535; var b16 = addend.low >>> 16; var b00 = addend.low & 65535; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 + b00; c16 += c00 >>> 16; c00 &= 65535; c16 += a16 + b16; c32 += c16 >>> 16; c16 &= 65535; c32 += a32 + b32; c48 += c32 >>> 16; c32 &= 65535; c48 += a48 + b48; c48 &= 65535; return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned); }; LongPrototype.subtract = function subtract(subtrahend) { if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend); return this.add(subtrahend.neg()); }; LongPrototype.sub = LongPrototype.subtract; LongPrototype.multiply = function multiply4(multiplier) { if (this.isZero()) return ZERO; if (!isLong(multiplier)) multiplier = fromValue(multiplier); if (wasm) { var low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high); return fromBits(low, wasm.get_high(), this.unsigned); } if (multiplier.isZero()) return ZERO; if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO; if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO; if (this.isNegative()) { if (multiplier.isNegative()) return this.neg().mul(multiplier.neg()); else return this.neg().mul(multiplier).neg(); } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg(); if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); var a48 = this.high >>> 16; var a32 = this.high & 65535; var a16 = this.low >>> 16; var a00 = this.low & 65535; var b48 = multiplier.high >>> 16; var b32 = multiplier.high & 65535; var b16 = multiplier.low >>> 16; var b00 = multiplier.low & 65535; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 * b00; c16 += c00 >>> 16; c00 &= 65535; c16 += a16 * b00; c32 += c16 >>> 16; c16 &= 65535; c16 += a00 * b16; c32 += c16 >>> 16; c16 &= 65535; c32 += a32 * b00; c48 += c32 >>> 16; c32 &= 65535; c32 += a16 * b16; c48 += c32 >>> 16; c32 &= 65535; c32 += a00 * b32; c48 += c32 >>> 16; c32 &= 65535; c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; c48 &= 65535; return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned); }; LongPrototype.mul = LongPrototype.multiply; LongPrototype.divide = function divide(divisor) { if (!isLong(divisor)) divisor = fromValue(divisor); if (divisor.isZero()) throw Error("division by zero"); if (wasm) { if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) { return this; } var low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high); return fromBits(low, wasm.get_high(), this.unsigned); } if (this.isZero()) return this.unsigned ? UZERO : ZERO; var approx, rem, res; if (!this.unsigned) { if (this.eq(MIN_VALUE)) { if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) return MIN_VALUE; else if (divisor.eq(MIN_VALUE)) return ONE; else { var halfThis = this.shr(1); approx = halfThis.div(divisor).shl(1); if (approx.eq(ZERO)) { return divisor.isNegative() ? ONE : NEG_ONE; } else { rem = this.sub(divisor.mul(approx)); res = approx.add(rem.div(divisor)); return res; } } } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO; if (this.isNegative()) { if (divisor.isNegative()) return this.neg().div(divisor.neg()); return this.neg().div(divisor).neg(); } else if (divisor.isNegative()) return this.div(divisor.neg()).neg(); res = ZERO; } else { if (!divisor.unsigned) divisor = divisor.toUnsigned(); if (divisor.gt(this)) return UZERO; if (divisor.gt(this.shru(1))) return UONE; res = UZERO; } rem = this; while (rem.gte(divisor)) { approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); var log22 = Math.ceil(Math.log(approx) / Math.LN2), delta = log22 <= 48 ? 1 : pow_dbl(2, log22 - 48), approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor); while (approxRem.isNegative() || approxRem.gt(rem)) { approx -= delta; approxRes = fromNumber(approx, this.unsigned); approxRem = approxRes.mul(divisor); } if (approxRes.isZero()) approxRes = ONE; res = res.add(approxRes); rem = rem.sub(approxRem); } return res; }; LongPrototype.div = LongPrototype.divide; LongPrototype.modulo = function modulo(divisor) { if (!isLong(divisor)) divisor = fromValue(divisor); if (wasm) { var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high); return fromBits(low, wasm.get_high(), this.unsigned); } return this.sub(this.div(divisor).mul(divisor)); }; LongPrototype.mod = LongPrototype.modulo; LongPrototype.rem = LongPrototype.modulo; LongPrototype.not = function not() { return fromBits(~this.low, ~this.high, this.unsigned); }; LongPrototype.and = function and(other) { if (!isLong(other)) other = fromValue(other); return fromBits(this.low & other.low, this.high & other.high, this.unsigned); }; LongPrototype.or = function or(other) { if (!isLong(other)) other = fromValue(other); return fromBits(this.low | other.low, this.high | other.high, this.unsigned); }; LongPrototype.xor = function xor(other) { if (!isLong(other)) other = fromValue(other); return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned); }; LongPrototype.shiftLeft = function shiftLeft(numBits) { if (isLong(numBits)) numBits = numBits.toInt(); if ((numBits &= 63) === 0) return this; else if (numBits < 32) return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned); else return fromBits(0, this.low << numBits - 32, this.unsigned); }; LongPrototype.shl = LongPrototype.shiftLeft; LongPrototype.shiftRight = function shiftRight(numBits) { if (isLong(numBits)) numBits = numBits.toInt(); if ((numBits &= 63) === 0) return this; else if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned); else return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned); }; LongPrototype.shr = LongPrototype.shiftRight; LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) { if (isLong(numBits)) numBits = numBits.toInt(); numBits &= 63; if (numBits === 0) return this; else { var high = this.high; if (numBits < 32) { var low = this.low; return fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits, this.unsigned); } else if (numBits === 32) return fromBits(high, 0, this.unsigned); else return fromBits(high >>> numBits - 32, 0, this.unsigned); } }; LongPrototype.shru = LongPrototype.shiftRightUnsigned; LongPrototype.shr_u = LongPrototype.shiftRightUnsigned; LongPrototype.toSigned = function toSigned() { if (!this.unsigned) return this; return fromBits(this.low, this.high, false); }; LongPrototype.toUnsigned = function toUnsigned() { if (this.unsigned) return this; return fromBits(this.low, this.high, true); }; LongPrototype.toBytes = function toBytes(le) { return le ? this.toBytesLE() : this.toBytesBE(); }; LongPrototype.toBytesLE = function toBytesLE() { var hi = this.high, lo = this.low; return [ lo & 255, lo >>> 8 & 255, lo >>> 16 & 255, lo >>> 24, hi & 255, hi >>> 8 & 255, hi >>> 16 & 255, hi >>> 24 ]; }; LongPrototype.toBytesBE = function toBytesBE() { var hi = this.high, lo = this.low; return [ hi >>> 24, hi >>> 16 & 255, hi >>> 8 & 255, hi & 255, lo >>> 24, lo >>> 16 & 255, lo >>> 8 & 255, lo & 255 ]; }; Long2.fromBytes = function fromBytes(bytes, unsigned, le) { return le ? Long2.fromBytesLE(bytes, unsigned) : Long2.fromBytesBE(bytes, unsigned); }; Long2.fromBytesLE = function fromBytesLE(bytes, unsigned) { return new Long2(bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24, bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24, unsigned); }; Long2.fromBytesBE = function fromBytesBE(bytes, unsigned) { return new Long2(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned); }; } }); // (disabled):node_modules/.pnpm/node-fetch@2.6.1/node_modules/node-fetch/browser.js var require_browser = __commonJS({ "(disabled):node_modules/.pnpm/node-fetch@2.6.1/node_modules/node-fetch/browser.js"() { } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/alea.js var require_alea = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/alea.js"(exports, module) { (function(global2, module2, define2) { function Alea(seed) { var me = this, mash = Mash(); me.next = function() { var t = 2091639 * me.s0 + me.c * 23283064365386963e-26; me.s0 = me.s1; me.s1 = me.s2; return me.s2 = t - (me.c = t | 0); }; me.c = 1; me.s0 = mash(" "); me.s1 = mash(" "); me.s2 = mash(" "); me.s0 -= mash(seed); if (me.s0 < 0) { me.s0 += 1; } me.s1 -= mash(seed); if (me.s1 < 0) { me.s1 += 1; } me.s2 -= mash(seed); if (me.s2 < 0) { me.s2 += 1; } mash = null; } function copy(f, t) { t.c = f.c; t.s0 = f.s0; t.s1 = f.s1; t.s2 = f.s2; return t; } function impl(seed, opts) { var xg = new Alea(seed), state = opts && opts.state, prng = xg.next; prng.int32 = function() { return xg.next() * 4294967296 | 0; }; prng.double = function() { return prng() + (prng() * 2097152 | 0) * 11102230246251565e-32; }; prng.quick = prng; if (state) { if (typeof state == "object") copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } function Mash() { var n = 4022871197; var mash = function(data) { data = data.toString(); for (var i = 0; i < data.length; i++) { n += data.charCodeAt(i); var h = 0.02519603282416938 * n; n = h >>> 0; h -= n; h *= n; n = h >>> 0; h -= n; n += h * 4294967296; } return (n >>> 0) * 23283064365386963e-26; }; return mash; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.alea = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor128.js var require_xor128 = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor128.js"(exports, module) { (function(global2, module2, define2) { function XorGen(seed) { var me = this, strseed = ""; me.x = 0; me.y = 0; me.z = 0; me.w = 0; me.next = function() { var t = me.x ^ me.x << 11; me.x = me.y; me.y = me.z; me.z = me.w; return me.w ^= me.w >>> 19 ^ t ^ t >>> 8; }; if (seed === (seed | 0)) { me.x = seed; } else { strseed += seed; } for (var k = 0; k < strseed.length + 64; k++) { me.x ^= strseed.charCodeAt(k) | 0; me.next(); } } function copy(f, t) { t.x = f.x; t.y = f.y; t.z = f.z; t.w = f.w; return t; } function impl(seed, opts) { var xg = new XorGen(seed), state = opts && opts.state, prng = function() { return (xg.next() >>> 0) / 4294967296; }; prng.double = function() { do { var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21); } while (result === 0); return result; }; prng.int32 = xg.next; prng.quick = prng; if (state) { if (typeof state == "object") copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.xor128 = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorwow.js var require_xorwow = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorwow.js"(exports, module) { (function(global2, module2, define2) { function XorGen(seed) { var me = this, strseed = ""; me.next = function() { var t = me.x ^ me.x >>> 2; me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v; return (me.d = me.d + 362437 | 0) + (me.v = me.v ^ me.v << 4 ^ (t ^ t << 1)) | 0; }; me.x = 0; me.y = 0; me.z = 0; me.w = 0; me.v = 0; if (seed === (seed | 0)) { me.x = seed; } else { strseed += seed; } for (var k = 0; k < strseed.length + 64; k++) { me.x ^= strseed.charCodeAt(k) | 0; if (k == strseed.length) { me.d = me.x << 10 ^ me.x >>> 4; } me.next(); } } function copy(f, t) { t.x = f.x; t.y = f.y; t.z = f.z; t.w = f.w; t.v = f.v; t.d = f.d; return t; } function impl(seed, opts) { var xg = new XorGen(seed), state = opts && opts.state, prng = function() { return (xg.next() >>> 0) / 4294967296; }; prng.double = function() { do { var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21); } while (result === 0); return result; }; prng.int32 = xg.next; prng.quick = prng; if (state) { if (typeof state == "object") copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.xorwow = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorshift7.js var require_xorshift7 = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorshift7.js"(exports, module) { (function(global2, module2, define2) { function XorGen(seed) { var me = this; me.next = function() { var X = me.x, i = me.i, t, v, w; t = X[i]; t ^= t >>> 7; v = t ^ t << 24; t = X[i + 1 & 7]; v ^= t ^ t >>> 10; t = X[i + 3 & 7]; v ^= t ^ t >>> 3; t = X[i + 4 & 7]; v ^= t ^ t << 7; t = X[i + 7 & 7]; t = t ^ t << 13; v ^= t ^ t << 9; X[i] = v; me.i = i + 1 & 7; return v; }; function init2(me2, seed2) { var j, w, X = []; if (seed2 === (seed2 | 0)) { w = X[0] = seed2; } else { seed2 = "" + seed2; for (j = 0; j < seed2.length; ++j) { X[j & 7] = X[j & 7] << 15 ^ seed2.charCodeAt(j) + X[j + 1 & 7] << 13; } } while (X.length < 8) X.push(0); for (j = 0; j < 8 && X[j] === 0; ++j) ; if (j == 8) w = X[7] = -1; else w = X[j]; me2.x = X; me2.i = 0; for (j = 256; j > 0; --j) { me2.next(); } } init2(me, seed); } function copy(f, t) { t.x = f.x.slice(); t.i = f.i; return t; } function impl(seed, opts) { if (seed == null) seed = +new Date(); var xg = new XorGen(seed), state = opts && opts.state, prng = function() { return (xg.next() >>> 0) / 4294967296; }; prng.double = function() { do { var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21); } while (result === 0); return result; }; prng.int32 = xg.next; prng.quick = prng; if (state) { if (state.x) copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.xorshift7 = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor4096.js var require_xor4096 = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor4096.js"(exports, module) { (function(global2, module2, define2) { function XorGen(seed) { var me = this; me.next = function() { var w = me.w, X = me.X, i = me.i, t, v; me.w = w = w + 1640531527 | 0; v = X[i + 34 & 127]; t = X[i = i + 1 & 127]; v ^= v << 13; t ^= t << 17; v ^= v >>> 15; t ^= t >>> 12; v = X[i] = v ^ t; me.i = i; return v + (w ^ w >>> 16) | 0; }; function init2(me2, seed2) { var t, v, i, j, w, X = [], limit = 128; if (seed2 === (seed2 | 0)) { v = seed2; seed2 = null; } else { seed2 = seed2 + "\0"; v = 0; limit = Math.max(limit, seed2.length); } for (i = 0, j = -32; j < limit; ++j) { if (seed2) v ^= seed2.charCodeAt((j + 32) % seed2.length); if (j === 0) w = v; v ^= v << 10; v ^= v >>> 15; v ^= v << 4; v ^= v >>> 13; if (j >= 0) { w = w + 1640531527 | 0; t = X[j & 127] ^= v + w; i = t == 0 ? i + 1 : 0; } } if (i >= 128) { X[(seed2 && seed2.length || 0) & 127] = -1; } i = 127; for (j = 4 * 128; j > 0; --j) { v = X[i + 34 & 127]; t = X[i = i + 1 & 127]; v ^= v << 13; t ^= t << 17; v ^= v >>> 15; t ^= t >>> 12; X[i] = v ^ t; } me2.w = w; me2.X = X; me2.i = i; } init2(me, seed); } function copy(f, t) { t.i = f.i; t.w = f.w; t.X = f.X.slice(); return t; } ; function impl(seed, opts) { if (seed == null) seed = +new Date(); var xg = new XorGen(seed), state = opts && opts.state, prng = function() { return (xg.next() >>> 0) / 4294967296; }; prng.double = function() { do { var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21); } while (result === 0); return result; }; prng.int32 = xg.next; prng.quick = prng; if (state) { if (state.X) copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.xor4096 = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/tychei.js var require_tychei = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/tychei.js"(exports, module) { (function(global2, module2, define2) { function XorGen(seed) { var me = this, strseed = ""; me.next = function() { var b = me.b, c = me.c, d = me.d, a = me.a; b = b << 25 ^ b >>> 7 ^ c; c = c - d | 0; d = d << 24 ^ d >>> 8 ^ a; a = a - b | 0; me.b = b = b << 20 ^ b >>> 12 ^ c; me.c = c = c - d | 0; me.d = d << 16 ^ c >>> 16 ^ a; return me.a = a - b | 0; }; me.a = 0; me.b = 0; me.c = 2654435769 | 0; me.d = 1367130551; if (seed === Math.floor(seed)) { me.a = seed / 4294967296 | 0; me.b = seed | 0; } else { strseed += seed; } for (var k = 0; k < strseed.length + 20; k++) { me.b ^= strseed.charCodeAt(k) | 0; me.next(); } } function copy(f, t) { t.a = f.a; t.b = f.b; t.c = f.c; t.d = f.d; return t; } ; function impl(seed, opts) { var xg = new XorGen(seed), state = opts && opts.state, prng = function() { return (xg.next() >>> 0) / 4294967296; }; prng.double = function() { do { var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21); } while (result === 0); return result; }; prng.int32 = xg.next; prng.quick = prng; if (state) { if (typeof state == "object") copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.tychei = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // (disabled):crypto var require_crypto = __commonJS({ "(disabled):crypto"() { } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/seedrandom.js var require_seedrandom = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/seedrandom.js"(exports, module) { (function(pool3, math) { var global2 = this, width = 256, chunks = 6, digits = 52, rngname = "random", startdenom = math.pow(width, chunks), significance = math.pow(2, digits), overflow = significance * 2, mask = width - 1, nodecrypto; function seedrandom5(seed, options, callback) { var key = []; options = options == true ? { entropy: true } : options || {}; var shortseed = mixkey(flatten4(options.entropy ? [seed, tostring(pool3)] : seed == null ? autoseed() : seed, 3), key); var arc4 = new ARC4(key); var prng = function() { var n = arc4.g(chunks), d = startdenom, x = 0; while (n < significance) { n = (n + x) * width; d *= width; x = arc4.g(1); } while (n >= overflow) { n /= 2; d /= 2; x >>>= 1; } return (n + x) / d; }; prng.int32 = function() { return arc4.g(4) | 0; }; prng.quick = function() { return arc4.g(4) / 4294967296; }; prng.double = prng; mixkey(tostring(arc4.S), pool3); return (options.pass || callback || function(prng2, seed2, is_math_call, state) { if (state) { if (state.S) { copy(state, arc4); } prng2.state = function() { return copy(arc4, {}); }; } if (is_math_call) { math[rngname] = prng2; return seed2; } else return prng2; })(prng, shortseed, "global" in options ? options.global : this == math, options.state); } math["seed" + rngname] = seedrandom5; function ARC4(key) { var t, keylen = key.length, me = this, i = 0, j = me.i = me.j = 0, s = me.S = []; if (!keylen) { key = [keylen++]; } while (i < width) { s[i] = i++; } for (i = 0; i < width; i++) { s[i] = s[j = mask & j + key[i % keylen] + (t = s[i])]; s[j] = t; } (me.g = function(count2) { var t2, r = 0, i2 = me.i, j2 = me.j, s2 = me.S; while (count2--) { t2 = s2[i2 = mask & i2 + 1]; r = r * width + s2[mask & (s2[i2] = s2[j2 = mask & j2 + t2]) + (s2[j2] = t2)]; } me.i = i2; me.j = j2; return r; })(width); } function copy(f, t) { t.i = f.i; t.j = f.j; t.S = f.S.slice(); return t; } ; function flatten4(obj, depth) { var result = [], typ = typeof obj, prop; if (depth && typ == "object") { for (prop in obj) { try { result.push(flatten4(obj[prop], depth - 1)); } catch (e) { } } } return result.length ? result : typ == "string" ? obj : obj + "\0"; } function mixkey(seed, key) { var stringseed = seed + "", smear, j = 0; while (j < stringseed.length) { key[mask & j] = mask & (smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++); } return tostring(key); } function autoseed() { try { var out; if (nodecrypto && (out = nodecrypto.randomBytes)) { out = out(width); } else { out = new Uint8Array(width); (global2.crypto || global2.msCrypto).getRandomValues(out); } return tostring(out); } catch (e) { var browser = global2.navigator, plugins = browser && browser.plugins; return [+new Date(), global2, plugins, global2.screen, tostring(pool3)]; } } function tostring(a) { return String.fromCharCode.apply(0, a); } mixkey(math.random(), pool3); if (typeof module == "object" && module.exports) { module.exports = seedrandom5; try { nodecrypto = require_crypto(); } catch (ex) { } } else if (typeof define == "function" && define.amd) { define(function() { return seedrandom5; }); } })([], Math); } }); // node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/index.js var require_seedrandom2 = __commonJS({ "node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/index.js"(exports, module) { var alea5 = require_alea(); var xor128 = require_xor128(); var xorwow = require_xorwow(); var xorshift7 = require_xorshift7(); var xor4096 = require_xor4096(); var tychei = require_tychei(); var sr = require_seedrandom(); sr.alea = alea5; sr.xor128 = xor128; sr.xorwow = xorwow; sr.xorshift7 = xorshift7; sr.xor4096 = xor4096; sr.tychei = tychei; module.exports = sr; } }); // node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/alea.js var require_alea2 = __commonJS({ "node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/alea.js"(exports, module) { (function(global2, module2, define2) { function Alea(seed) { var me = this, mash = Mash(); me.next = function() { var t = 2091639 * me.s0 + me.c * 23283064365386963e-26; me.s0 = me.s1; me.s1 = me.s2; return me.s2 = t - (me.c = t | 0); }; me.c = 1; me.s0 = mash(" "); me.s1 = mash(" "); me.s2 = mash(" "); me.s0 -= mash(seed); if (me.s0 < 0) { me.s0 += 1; } me.s1 -= mash(seed); if (me.s1 < 0) { me.s1 += 1; } me.s2 -= mash(seed); if (me.s2 < 0) { me.s2 += 1; } mash = null; } function copy(f, t) { t.c = f.c; t.s0 = f.s0; t.s1 = f.s1; t.s2 = f.s2; return t; } function impl(seed, opts) { var xg = new Alea(seed), state = opts && opts.state, prng = xg.next; prng.int32 = function() { return xg.next() * 4294967296 | 0; }; prng.double = function() { return prng() + (prng() * 2097152 | 0) * 11102230246251565e-32; }; prng.quick = prng; if (state) { if (typeof state == "object") copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } function Mash() { var n = 4022871197; var mash = function(data) { data = String(data); for (var i = 0; i < data.length; i++) { n += data.charCodeAt(i); var h = 0.02519603282416938 * n; n = h >>> 0; h -= n; h *= n; n = h >>> 0; h -= n; n += h * 4294967296; } return (n >>> 0) * 23283064365386963e-26; }; return mash; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.alea = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor128.js var require_xor1282 = __commonJS({ "node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor128.js"(exports, module) { (function(global2, module2, define2) { function XorGen(seed) { var me = this, strseed = ""; me.x = 0; me.y = 0; me.z = 0; me.w = 0; me.next = function() { var t = me.x ^ me.x << 11; me.x = me.y; me.y = me.z; me.z = me.w; return me.w ^= me.w >>> 19 ^ t ^ t >>> 8; }; if (seed === (seed | 0)) { me.x = seed; } else { strseed += seed; } for (var k = 0; k < strseed.length + 64; k++) { me.x ^= strseed.charCodeAt(k) | 0; me.next(); } } function copy(f, t) { t.x = f.x; t.y = f.y; t.z = f.z; t.w = f.w; return t; } function impl(seed, opts) { var xg = new XorGen(seed), state = opts && opts.state, prng = function() { return (xg.next() >>> 0) / 4294967296; }; prng.double = function() { do { var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21); } while (result === 0); return result; }; prng.int32 = xg.next; prng.quick = prng; if (state) { if (typeof state == "object") copy(state, xg); prng.state = function() { return copy(xg, {}); }; } return prng; } if (module2 && module2.exports) { module2.exports = impl; } else if (define2 && define2.amd) { define2(function() { return impl; }); } else { this.xor128 = impl; } })(exports, typeof module == "object" && module, typeof define == "function" && define); } }); // node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorwow.js var require_xorwow2 = __commonJS({ "node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorwow.js"(exports, module) { (function(global2, module2, define2) { function XorGen(seed) { var me = this, strseed = ""; me.next = function() { var t = me.x ^ me.x >>> 2; me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v; return (me.d = me.d + 362437 | 0) + (me.v = me.v ^ me.v << 4 ^ (t ^ t << 1)) | 0; }; me.x = 0; me.y = 0; me.z = 0; me.w = 0; me.v = 0; if (seed === (seed | 0)) { me.x = seed; } else { strseed += seed; } for (var k = 0; k < strseed.length + 64; k++) { me.x ^= strseed.charCodeAt(k) | 0; if (k == strseed.length) { me.d = me.x << 10 ^ me.x >>> 4; } me.next(); } } function copy(f, t) { t.x = f.x; t.y = f.y; t.z