UNPKG

chaite

Version:

core for chatgpt-plugin and karin-plugin-chatgpt

1,432 lines (1,422 loc) 160 kB
import { t as __commonJS } from "../../rolldown-runtime-DVriDoez.mjs"; //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/es5.js var require_es5 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/es5.js": ((exports, module) => { var isES5 = (function() { return this === void 0; })(); if (isES5) module.exports = { freeze: Object.freeze, defineProperty: Object.defineProperty, getDescriptor: Object.getOwnPropertyDescriptor, keys: Object.keys, names: Object.getOwnPropertyNames, getPrototypeOf: Object.getPrototypeOf, isArray: Array.isArray, isES5, propertyIsWritable: function(obj, prop) { var descriptor = Object.getOwnPropertyDescriptor(obj, prop); return !!(!descriptor || descriptor.writable || descriptor.set); } }; else { var has = {}.hasOwnProperty; var str = {}.toString; var proto = {}.constructor.prototype; var ObjectKeys = function(o) { var ret$1 = []; for (var key in o) if (has.call(o, key)) ret$1.push(key); return ret$1; }; var ObjectGetDescriptor = function(o, key) { return { value: o[key] }; }; var ObjectDefineProperty = function(o, key, desc) { o[key] = desc.value; return o; }; var ObjectFreeze = function(obj) { return obj; }; var ObjectGetPrototypeOf = function(obj) { try { return Object(obj).constructor.prototype; } catch (e) { return proto; } }; var ArrayIsArray = function(obj) { try { return str.call(obj) === "[object Array]"; } catch (e) { return false; } }; module.exports = { isArray: ArrayIsArray, keys: ObjectKeys, names: ObjectKeys, defineProperty: ObjectDefineProperty, getDescriptor: ObjectGetDescriptor, freeze: ObjectFreeze, getPrototypeOf: ObjectGetPrototypeOf, isES5, propertyIsWritable: function() { return true; } }; } }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/util.js var require_util = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/util.js": ((exports, module) => { var es5$2 = require_es5(); var canEvaluate = typeof navigator == "undefined"; var errorObj = { e: {} }; var tryCatchTarget; var globalObject = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : exports !== void 0 ? exports : null; function tryCatcher() { try { var target = tryCatchTarget; tryCatchTarget = null; return target.apply(this, arguments); } catch (e) { errorObj.e = e; return errorObj; } } function tryCatch(fn) { tryCatchTarget = fn; return tryCatcher; } var inherits$1 = function(Child, Parent) { var hasProp = {}.hasOwnProperty; function T() { this.constructor = Child; this.constructor$ = Parent; for (var propertyName in Parent.prototype) if (hasProp.call(Parent.prototype, propertyName) && propertyName.charAt(propertyName.length - 1) !== "$") this[propertyName + "$"] = Parent.prototype[propertyName]; } T.prototype = Parent.prototype; Child.prototype = new T(); return Child.prototype; }; function isPrimitive(val) { return val == null || val === true || val === false || typeof val === "string" || typeof val === "number"; } function isObject(value) { return typeof value === "function" || typeof value === "object" && value !== null; } function maybeWrapAsError$1(maybeError) { if (!isPrimitive(maybeError)) return maybeError; return new Error(safeToString(maybeError)); } function withAppended(target, appendee) { var len = target.length; var ret$1 = new Array(len + 1); var i$1; for (i$1 = 0; i$1 < len; ++i$1) ret$1[i$1] = target[i$1]; ret$1[i$1] = appendee; return ret$1; } function getDataPropertyOrDefault(obj, key, defaultValue) { if (es5$2.isES5) { var desc = Object.getOwnPropertyDescriptor(obj, key); if (desc != null) return desc.get == null && desc.set == null ? desc.value : defaultValue; } else return {}.hasOwnProperty.call(obj, key) ? obj[key] : void 0; } function notEnumerableProp$1(obj, name, value) { if (isPrimitive(obj)) return obj; var descriptor = { value, configurable: true, enumerable: false, writable: true }; es5$2.defineProperty(obj, name, descriptor); return obj; } function thrower(r) { throw r; } var inheritedDataKeys = (function() { var excludedPrototypes = [ Array.prototype, Object.prototype, Function.prototype ]; var isExcludedProto = function(val) { for (var i$1 = 0; i$1 < excludedPrototypes.length; ++i$1) if (excludedPrototypes[i$1] === val) return true; return false; }; if (es5$2.isES5) { var getKeys = Object.getOwnPropertyNames; return function(obj) { var ret$1 = []; var visitedKeys = Object.create(null); while (obj != null && !isExcludedProto(obj)) { var keys; try { keys = getKeys(obj); } catch (e) { return ret$1; } for (var i$1 = 0; i$1 < keys.length; ++i$1) { var key = keys[i$1]; if (visitedKeys[key]) continue; visitedKeys[key] = true; var desc = Object.getOwnPropertyDescriptor(obj, key); if (desc != null && desc.get == null && desc.set == null) ret$1.push(key); } obj = es5$2.getPrototypeOf(obj); } return ret$1; }; } else { var hasProp = {}.hasOwnProperty; return function(obj) { if (isExcludedProto(obj)) return []; var ret$1 = []; enumeration: for (var key in obj) if (hasProp.call(obj, key)) ret$1.push(key); else { for (var i$1 = 0; i$1 < excludedPrototypes.length; ++i$1) if (hasProp.call(excludedPrototypes[i$1], key)) continue enumeration; ret$1.push(key); } return ret$1; }; } })(); var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; function isClass(fn) { try { if (typeof fn === "function") { var keys = es5$2.names(fn.prototype); var hasMethods = es5$2.isES5 && keys.length > 1; var hasMethodsOtherThanConstructor = keys.length > 0 && !(keys.length === 1 && keys[0] === "constructor"); var hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5$2.names(fn).length > 0; if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) return true; } return false; } catch (e) { return false; } } function toFastProperties(obj) { function FakeConstructor() {} FakeConstructor.prototype = obj; var l = 8; while (l--) new FakeConstructor(); return obj; } var rident = /^[a-z$_][a-z$_0-9]*$/i; function isIdentifier(str$1) { return rident.test(str$1); } function filledRange(count, prefix, suffix) { var ret$1 = new Array(count); for (var i$1 = 0; i$1 < count; ++i$1) ret$1[i$1] = prefix + i$1 + suffix; return ret$1; } function safeToString(obj) { try { return obj + ""; } catch (e) { return "[no string representation]"; } } function isError(obj) { return obj !== null && typeof obj === "object" && typeof obj.message === "string" && typeof obj.name === "string"; } function markAsOriginatingFromRejection(e) { try { notEnumerableProp$1(e, "isOperational", true); } catch (ignore) {} } function originatesFromRejection(e) { if (e == null) return false; return e instanceof Error["__BluebirdErrorTypes__"].OperationalError || e["isOperational"] === true; } function canAttachTrace(obj) { return isError(obj) && es5$2.propertyIsWritable(obj, "stack"); } var ensureErrorObject = (function() { if (!("stack" in /* @__PURE__ */ new Error())) return function(value) { if (canAttachTrace(value)) return value; try { throw new Error(safeToString(value)); } catch (err) { return err; } }; else return function(value) { if (canAttachTrace(value)) return value; return new Error(safeToString(value)); }; })(); function classString(obj) { return {}.toString.call(obj); } function copyDescriptors(from, to, filter) { var keys = es5$2.names(from); for (var i$1 = 0; i$1 < keys.length; ++i$1) { var key = keys[i$1]; if (filter(key)) try { es5$2.defineProperty(to, key, es5$2.getDescriptor(from, key)); } catch (ignore) {} } } var asArray = function(v) { if (es5$2.isArray(v)) return v; return null; }; if (typeof Symbol !== "undefined" && Symbol.iterator) { var ArrayFrom = typeof Array.from === "function" ? function(v) { return Array.from(v); } : function(v) { var ret$1 = []; var it = v[Symbol.iterator](); var itResult; while (!(itResult = it.next()).done) ret$1.push(itResult.value); return ret$1; }; asArray = function(v) { if (es5$2.isArray(v)) return v; else if (v != null && typeof v[Symbol.iterator] === "function") return ArrayFrom(v); return null; }; } var isNode = typeof process !== "undefined" && classString(process).toLowerCase() === "[object process]"; var hasEnvVariables = typeof process !== "undefined" && typeof process.env !== "undefined"; function env(key) { return hasEnvVariables ? process.env[key] : void 0; } function getNativePromise() { if (typeof Promise === "function") try { var promise = new Promise(function() {}); if ({}.toString.call(promise) === "[object Promise]") return Promise; } catch (e) {} } function domainBind(self$1, cb) { return self$1.bind(cb); } var ret = { isClass, isIdentifier, inheritedDataKeys, getDataPropertyOrDefault, thrower, isArray: es5$2.isArray, asArray, notEnumerableProp: notEnumerableProp$1, isPrimitive, isObject, isError, canEvaluate, errorObj, tryCatch, inherits: inherits$1, withAppended, maybeWrapAsError: maybeWrapAsError$1, toFastProperties, filledRange, toString: safeToString, canAttachTrace, ensureErrorObject, originatesFromRejection, markAsOriginatingFromRejection, classString, copyDescriptors, hasDevTools: typeof chrome !== "undefined" && chrome && typeof chrome.loadTimes === "function", isNode, hasEnvVariables, env, global: globalObject, getNativePromise, domainBind }; ret.isRecentNode = ret.isNode && (function() { var version = process.versions.node.split(".").map(Number); return version[0] === 0 && version[1] > 10 || version[0] > 0; })(); if (ret.isNode) ret.toFastProperties(process); try { throw new Error(); } catch (e) { ret.lastLineError = e; } module.exports = ret; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/schedule.js var require_schedule = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/schedule.js": ((exports, module) => { var util$3 = require_util(); var schedule$1; var noAsyncScheduler = function() { throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n"); }; var NativePromise = util$3.getNativePromise(); if (util$3.isNode && typeof MutationObserver === "undefined") { var GlobalSetImmediate = global.setImmediate; var ProcessNextTick = process.nextTick; schedule$1 = util$3.isRecentNode ? function(fn) { GlobalSetImmediate.call(global, fn); } : function(fn) { ProcessNextTick.call(process, fn); }; } else if (typeof NativePromise === "function" && typeof NativePromise.resolve === "function") { var nativePromise = NativePromise.resolve(); schedule$1 = function(fn) { nativePromise.then(fn); }; } else if (typeof MutationObserver !== "undefined" && !(typeof window !== "undefined" && window.navigator && (window.navigator.standalone || window.cordova))) schedule$1 = (function() { var div = document.createElement("div"); var opts = { attributes: true }; var toggleScheduled = false; var div2 = document.createElement("div"); new MutationObserver(function() { div.classList.toggle("foo"); toggleScheduled = false; }).observe(div2, opts); var scheduleToggle = function() { if (toggleScheduled) return; toggleScheduled = true; div2.classList.toggle("foo"); }; return function schedule$2(fn) { var o = new MutationObserver(function() { o.disconnect(); fn(); }); o.observe(div, opts); scheduleToggle(); }; })(); else if (typeof setImmediate !== "undefined") schedule$1 = function(fn) { setImmediate(fn); }; else if (typeof setTimeout !== "undefined") schedule$1 = function(fn) { setTimeout(fn, 0); }; else schedule$1 = noAsyncScheduler; module.exports = schedule$1; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/queue.js var require_queue = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/queue.js": ((exports, module) => { function arrayMove(src, srcIndex, dst, dstIndex, len) { for (var j = 0; j < len; ++j) { dst[j + dstIndex] = src[j + srcIndex]; src[j + srcIndex] = void 0; } } function Queue$1(capacity) { this._capacity = capacity; this._length = 0; this._front = 0; } Queue$1.prototype._willBeOverCapacity = function(size) { return this._capacity < size; }; Queue$1.prototype._pushOne = function(arg) { var length = this.length(); this._checkCapacity(length + 1); var i$1 = this._front + length & this._capacity - 1; this[i$1] = arg; this._length = length + 1; }; Queue$1.prototype.push = function(fn, receiver, arg) { var length = this.length() + 3; if (this._willBeOverCapacity(length)) { this._pushOne(fn); this._pushOne(receiver); this._pushOne(arg); return; } var j = this._front + length - 3; this._checkCapacity(length); var wrapMask = this._capacity - 1; this[j + 0 & wrapMask] = fn; this[j + 1 & wrapMask] = receiver; this[j + 2 & wrapMask] = arg; this._length = length; }; Queue$1.prototype.shift = function() { var front = this._front, ret$1 = this[front]; this[front] = void 0; this._front = front + 1 & this._capacity - 1; this._length--; return ret$1; }; Queue$1.prototype.length = function() { return this._length; }; Queue$1.prototype._checkCapacity = function(size) { if (this._capacity < size) this._resizeTo(this._capacity << 1); }; Queue$1.prototype._resizeTo = function(capacity) { var oldCapacity = this._capacity; this._capacity = capacity; var moveItemsCount = this._front + this._length & oldCapacity - 1; arrayMove(this, 0, this, oldCapacity, moveItemsCount); }; module.exports = Queue$1; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/async.js var require_async = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/async.js": ((exports, module) => { var firstLineError; try { throw new Error(); } catch (e) { firstLineError = e; } var schedule = require_schedule(); var Queue = require_queue(); var util$2 = require_util(); function Async() { this._customScheduler = false; this._isTickUsed = false; this._lateQueue = new Queue(16); this._normalQueue = new Queue(16); this._haveDrainedQueues = false; this._trampolineEnabled = true; var self$1 = this; this.drainQueues = function() { self$1._drainQueues(); }; this._schedule = schedule; } Async.prototype.setScheduler = function(fn) { var prev = this._schedule; this._schedule = fn; this._customScheduler = true; return prev; }; Async.prototype.hasCustomScheduler = function() { return this._customScheduler; }; Async.prototype.enableTrampoline = function() { this._trampolineEnabled = true; }; Async.prototype.disableTrampolineIfNecessary = function() { if (util$2.hasDevTools) this._trampolineEnabled = false; }; Async.prototype.haveItemsQueued = function() { return this._isTickUsed || this._haveDrainedQueues; }; Async.prototype.fatalError = function(e, isNode$1) { if (isNode$1) { process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) + "\n"); process.exit(2); } else this.throwLater(e); }; Async.prototype.throwLater = function(fn, arg) { if (arguments.length === 1) { arg = fn; fn = function() { throw arg; }; } if (typeof setTimeout !== "undefined") setTimeout(function() { fn(arg); }, 0); else try { this._schedule(function() { fn(arg); }); } catch (e) { throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n"); } }; function AsyncInvokeLater(fn, receiver, arg) { this._lateQueue.push(fn, receiver, arg); this._queueTick(); } function AsyncInvoke(fn, receiver, arg) { this._normalQueue.push(fn, receiver, arg); this._queueTick(); } function AsyncSettlePromises(promise) { this._normalQueue._pushOne(promise); this._queueTick(); } if (!util$2.hasDevTools) { Async.prototype.invokeLater = AsyncInvokeLater; Async.prototype.invoke = AsyncInvoke; Async.prototype.settlePromises = AsyncSettlePromises; } else { Async.prototype.invokeLater = function(fn, receiver, arg) { if (this._trampolineEnabled) AsyncInvokeLater.call(this, fn, receiver, arg); else this._schedule(function() { setTimeout(function() { fn.call(receiver, arg); }, 100); }); }; Async.prototype.invoke = function(fn, receiver, arg) { if (this._trampolineEnabled) AsyncInvoke.call(this, fn, receiver, arg); else this._schedule(function() { fn.call(receiver, arg); }); }; Async.prototype.settlePromises = function(promise) { if (this._trampolineEnabled) AsyncSettlePromises.call(this, promise); else this._schedule(function() { promise._settlePromises(); }); }; } Async.prototype._drainQueue = function(queue) { while (queue.length() > 0) { var fn = queue.shift(); if (typeof fn !== "function") { fn._settlePromises(); continue; } var receiver = queue.shift(); var arg = queue.shift(); fn.call(receiver, arg); } }; Async.prototype._drainQueues = function() { this._drainQueue(this._normalQueue); this._reset(); this._haveDrainedQueues = true; this._drainQueue(this._lateQueue); }; Async.prototype._queueTick = function() { if (!this._isTickUsed) { this._isTickUsed = true; this._schedule(this.drainQueues); } }; Async.prototype._reset = function() { this._isTickUsed = false; }; module.exports = Async; module.exports.firstLineError = firstLineError; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/errors.js var require_errors = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/errors.js": ((exports, module) => { var es5$1 = require_es5(); var Objectfreeze = es5$1.freeze; var util$1 = require_util(); var inherits = util$1.inherits; var notEnumerableProp = util$1.notEnumerableProp; function subError(nameProperty, defaultMessage) { function SubError(message) { if (!(this instanceof SubError)) return new SubError(message); notEnumerableProp(this, "message", typeof message === "string" ? message : defaultMessage); notEnumerableProp(this, "name", nameProperty); if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor); else Error.call(this); } inherits(SubError, Error); return SubError; } var _TypeError, _RangeError; var Warning = subError("Warning", "warning"); var CancellationError = subError("CancellationError", "cancellation error"); var TimeoutError = subError("TimeoutError", "timeout error"); var AggregateError = subError("AggregateError", "aggregate error"); try { _TypeError = TypeError; _RangeError = RangeError; } catch (e) { _TypeError = subError("TypeError", "type error"); _RangeError = subError("RangeError", "range error"); } var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "); for (var i = 0; i < methods.length; ++i) if (typeof Array.prototype[methods[i]] === "function") AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; es5$1.defineProperty(AggregateError.prototype, "length", { value: 0, configurable: false, writable: true, enumerable: true }); AggregateError.prototype["isOperational"] = true; var level = 0; AggregateError.prototype.toString = function() { var indent = Array(level * 4 + 1).join(" "); var ret$1 = "\n" + indent + "AggregateError of:\n"; level++; indent = Array(level * 4 + 1).join(" "); for (var i$1 = 0; i$1 < this.length; ++i$1) { var str$1 = this[i$1] === this ? "[Circular AggregateError]" : this[i$1] + ""; var lines = str$1.split("\n"); for (var j = 0; j < lines.length; ++j) lines[j] = indent + lines[j]; str$1 = lines.join("\n"); ret$1 += str$1 + "\n"; } level--; return ret$1; }; function OperationalError$1(message) { if (!(this instanceof OperationalError$1)) return new OperationalError$1(message); notEnumerableProp(this, "name", "OperationalError"); notEnumerableProp(this, "message", message); this.cause = message; this["isOperational"] = true; if (message instanceof Error) { notEnumerableProp(this, "message", message.message); notEnumerableProp(this, "stack", message.stack); } else if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor); } inherits(OperationalError$1, Error); var errorTypes = Error["__BluebirdErrorTypes__"]; if (!errorTypes) { errorTypes = Objectfreeze({ CancellationError, TimeoutError, OperationalError: OperationalError$1, RejectionError: OperationalError$1, AggregateError }); es5$1.defineProperty(Error, "__BluebirdErrorTypes__", { value: errorTypes, writable: false, enumerable: false, configurable: false }); } module.exports = { Error, TypeError: _TypeError, RangeError: _RangeError, CancellationError: errorTypes.CancellationError, OperationalError: errorTypes.OperationalError, TimeoutError: errorTypes.TimeoutError, AggregateError: errorTypes.AggregateError, Warning }; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/thenables.js var require_thenables = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/thenables.js": ((exports, module) => { module.exports = function(Promise$1, INTERNAL) { var util$4 = require_util(); var errorObj$1 = util$4.errorObj; var isObject$1 = util$4.isObject; function tryConvertToPromise(obj, context) { if (isObject$1(obj)) { if (obj instanceof Promise$1) return obj; var then = getThen(obj); if (then === errorObj$1) { if (context) context._pushContext(); var ret$1 = Promise$1.reject(then.e); if (context) context._popContext(); return ret$1; } else if (typeof then === "function") { if (isAnyBluebirdPromise(obj)) { var ret$1 = new Promise$1(INTERNAL); obj._then(ret$1._fulfill, ret$1._reject, void 0, ret$1, null); return ret$1; } return doThenable(obj, then, context); } } return obj; } function doGetThen(obj) { return obj.then; } function getThen(obj) { try { return doGetThen(obj); } catch (e) { errorObj$1.e = e; return errorObj$1; } } var hasProp = {}.hasOwnProperty; function isAnyBluebirdPromise(obj) { try { return hasProp.call(obj, "_promise0"); } catch (e) { return false; } } function doThenable(x, then, context) { var promise = new Promise$1(INTERNAL); var ret$1 = promise; if (context) context._pushContext(); promise._captureStackTrace(); if (context) context._popContext(); var synchronous = true; var result = util$4.tryCatch(then).call(x, resolve, reject); synchronous = false; if (promise && result === errorObj$1) { promise._rejectCallback(result.e, true, true); promise = null; } function resolve(value) { if (!promise) return; promise._resolveCallback(value); promise = null; } function reject(reason) { if (!promise) return; promise._rejectCallback(reason, synchronous, true); promise = null; } return ret$1; } return tryConvertToPromise; }; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/promise_array.js var require_promise_array = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/promise_array.js": ((exports, module) => { module.exports = function(Promise$1, INTERNAL, tryConvertToPromise, apiRejection, Proxyable) { var util$4 = require_util(); util$4.isArray; function toResolutionValue(val) { switch (val) { case -2: return []; case -3: return {}; } } function PromiseArray(values) { var promise = this._promise = new Promise$1(INTERNAL); if (values instanceof Promise$1) promise._propagateFrom(values, 3); promise._setOnCancel(this); this._values = values; this._length = 0; this._totalResolved = 0; this._init(void 0, -2); } util$4.inherits(PromiseArray, Proxyable); PromiseArray.prototype.length = function() { return this._length; }; PromiseArray.prototype.promise = function() { return this._promise; }; PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { var values = tryConvertToPromise(this._values, this._promise); if (values instanceof Promise$1) { values = values._target(); var bitField = values._bitField; this._values = values; if ((bitField & 50397184) === 0) { this._promise._setAsyncGuaranteed(); return values._then(init, this._reject, void 0, this, resolveValueIfEmpty); } else if ((bitField & 33554432) !== 0) values = values._value(); else if ((bitField & 16777216) !== 0) return this._reject(values._reason()); else return this._cancel(); } values = util$4.asArray(values); if (values === null) { var err = apiRejection("expecting an array or an iterable object but got " + util$4.classString(values)).reason(); this._promise._rejectCallback(err, false); return; } if (values.length === 0) { if (resolveValueIfEmpty === -5) this._resolveEmptyArray(); else this._resolve(toResolutionValue(resolveValueIfEmpty)); return; } this._iterate(values); }; PromiseArray.prototype._iterate = function(values) { var len = this.getActualLength(values.length); this._length = len; this._values = this.shouldCopyValues() ? new Array(len) : this._values; var result = this._promise; var isResolved = false; var bitField = null; for (var i$1 = 0; i$1 < len; ++i$1) { var maybePromise = tryConvertToPromise(values[i$1], result); if (maybePromise instanceof Promise$1) { maybePromise = maybePromise._target(); bitField = maybePromise._bitField; } else bitField = null; if (isResolved) { if (bitField !== null) maybePromise.suppressUnhandledRejections(); } else if (bitField !== null) if ((bitField & 50397184) === 0) { maybePromise._proxy(this, i$1); this._values[i$1] = maybePromise; } else if ((bitField & 33554432) !== 0) isResolved = this._promiseFulfilled(maybePromise._value(), i$1); else if ((bitField & 16777216) !== 0) isResolved = this._promiseRejected(maybePromise._reason(), i$1); else isResolved = this._promiseCancelled(i$1); else isResolved = this._promiseFulfilled(maybePromise, i$1); } if (!isResolved) result._setAsyncGuaranteed(); }; PromiseArray.prototype._isResolved = function() { return this._values === null; }; PromiseArray.prototype._resolve = function(value) { this._values = null; this._promise._fulfill(value); }; PromiseArray.prototype._cancel = function() { if (this._isResolved() || !this._promise._isCancellable()) return; this._values = null; this._promise._cancel(); }; PromiseArray.prototype._reject = function(reason) { this._values = null; this._promise._rejectCallback(reason, false); }; PromiseArray.prototype._promiseFulfilled = function(value, index) { this._values[index] = value; if (++this._totalResolved >= this._length) { this._resolve(this._values); return true; } return false; }; PromiseArray.prototype._promiseCancelled = function() { this._cancel(); return true; }; PromiseArray.prototype._promiseRejected = function(reason) { this._totalResolved++; this._reject(reason); return true; }; PromiseArray.prototype._resultCancelled = function() { if (this._isResolved()) return; var values = this._values; this._cancel(); if (values instanceof Promise$1) values.cancel(); else for (var i$1 = 0; i$1 < values.length; ++i$1) if (values[i$1] instanceof Promise$1) values[i$1].cancel(); }; PromiseArray.prototype.shouldCopyValues = function() { return true; }; PromiseArray.prototype.getActualLength = function(len) { return len; }; return PromiseArray; }; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/context.js var require_context = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/context.js": ((exports, module) => { module.exports = function(Promise$1) { var longStackTraces = false; var contextStack = []; Promise$1.prototype._promiseCreated = function() {}; Promise$1.prototype._pushContext = function() {}; Promise$1.prototype._popContext = function() { return null; }; Promise$1._peekContext = Promise$1.prototype._peekContext = function() {}; function Context() { this._trace = new Context.CapturedTrace(peekContext()); } Context.prototype._pushContext = function() { if (this._trace !== void 0) { this._trace._promiseCreated = null; contextStack.push(this._trace); } }; Context.prototype._popContext = function() { if (this._trace !== void 0) { var trace = contextStack.pop(); var ret$1 = trace._promiseCreated; trace._promiseCreated = null; return ret$1; } return null; }; function createContext() { if (longStackTraces) return new Context(); } function peekContext() { var lastIndex = contextStack.length - 1; if (lastIndex >= 0) return contextStack[lastIndex]; } Context.CapturedTrace = null; Context.create = createContext; Context.deactivateLongStackTraces = function() {}; Context.activateLongStackTraces = function() { var Promise_pushContext = Promise$1.prototype._pushContext; var Promise_popContext = Promise$1.prototype._popContext; var Promise_PeekContext = Promise$1._peekContext; var Promise_peekContext = Promise$1.prototype._peekContext; var Promise_promiseCreated = Promise$1.prototype._promiseCreated; Context.deactivateLongStackTraces = function() { Promise$1.prototype._pushContext = Promise_pushContext; Promise$1.prototype._popContext = Promise_popContext; Promise$1._peekContext = Promise_PeekContext; Promise$1.prototype._peekContext = Promise_peekContext; Promise$1.prototype._promiseCreated = Promise_promiseCreated; longStackTraces = false; }; longStackTraces = true; Promise$1.prototype._pushContext = Context.prototype._pushContext; Promise$1.prototype._popContext = Context.prototype._popContext; Promise$1._peekContext = Promise$1.prototype._peekContext = peekContext; Promise$1.prototype._promiseCreated = function() { var ctx = this._peekContext(); if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; }; }; return Context; }; }) }); //#endregion //#region node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/debuggability.js var require_debuggability = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/debuggability.js": ((exports, module) => { module.exports = function(Promise$1, Context) { var getDomain = Promise$1._getDomain; var async = Promise$1._async; var Warning$1 = require_errors().Warning; var util$4 = require_util(); var canAttachTrace$1 = util$4.canAttachTrace; var unhandledRejectionHandled; var possiblyUnhandledRejection; var bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; var stackFramePattern = null; var formatStack = null; var indentStackFrames = false; var printWarning; var debugging = !!(util$4.env("BLUEBIRD_DEBUG") != 0 && (util$4.env("BLUEBIRD_DEBUG") || util$4.env("NODE_ENV") === "development")); var warnings = !!(util$4.env("BLUEBIRD_WARNINGS") != 0 && (debugging || util$4.env("BLUEBIRD_WARNINGS"))); var longStackTraces = !!(util$4.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && (debugging || util$4.env("BLUEBIRD_LONG_STACK_TRACES"))); var wForgottenReturn = util$4.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && (warnings || !!util$4.env("BLUEBIRD_W_FORGOTTEN_RETURN")); Promise$1.prototype.suppressUnhandledRejections = function() { var target = this._target(); target._bitField = target._bitField & -1048577 | 524288; }; Promise$1.prototype._ensurePossibleRejectionHandled = function() { if ((this._bitField & 524288) !== 0) return; this._setRejectionIsUnhandled(); async.invokeLater(this._notifyUnhandledRejection, this, void 0); }; Promise$1.prototype._notifyUnhandledRejectionIsHandled = function() { fireRejectionEvent("rejectionHandled", unhandledRejectionHandled, void 0, this); }; Promise$1.prototype._setReturnedNonUndefined = function() { this._bitField = this._bitField | 268435456; }; Promise$1.prototype._returnedNonUndefined = function() { return (this._bitField & 268435456) !== 0; }; Promise$1.prototype._notifyUnhandledRejection = function() { if (this._isRejectionUnhandled()) { var reason = this._settledValue(); this._setUnhandledRejectionIsNotified(); fireRejectionEvent("unhandledRejection", possiblyUnhandledRejection, reason, this); } }; Promise$1.prototype._setUnhandledRejectionIsNotified = function() { this._bitField = this._bitField | 262144; }; Promise$1.prototype._unsetUnhandledRejectionIsNotified = function() { this._bitField = this._bitField & -262145; }; Promise$1.prototype._isUnhandledRejectionNotified = function() { return (this._bitField & 262144) > 0; }; Promise$1.prototype._setRejectionIsUnhandled = function() { this._bitField = this._bitField | 1048576; }; Promise$1.prototype._unsetRejectionIsUnhandled = function() { this._bitField = this._bitField & -1048577; if (this._isUnhandledRejectionNotified()) { this._unsetUnhandledRejectionIsNotified(); this._notifyUnhandledRejectionIsHandled(); } }; Promise$1.prototype._isRejectionUnhandled = function() { return (this._bitField & 1048576) > 0; }; Promise$1.prototype._warn = function(message, shouldUseOwnTrace, promise) { return warn(message, shouldUseOwnTrace, promise || this); }; Promise$1.onPossiblyUnhandledRejection = function(fn) { var domain = getDomain(); possiblyUnhandledRejection = typeof fn === "function" ? domain === null ? fn : util$4.domainBind(domain, fn) : void 0; }; Promise$1.onUnhandledRejectionHandled = function(fn) { var domain = getDomain(); unhandledRejectionHandled = typeof fn === "function" ? domain === null ? fn : util$4.domainBind(domain, fn) : void 0; }; var disableLongStackTraces = function() {}; Promise$1.longStackTraces = function() { if (async.haveItemsQueued() && !config.longStackTraces) throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n"); if (!config.longStackTraces && longStackTracesIsSupported()) { var Promise_captureStackTrace = Promise$1.prototype._captureStackTrace; var Promise_attachExtraTrace = Promise$1.prototype._attachExtraTrace; config.longStackTraces = true; disableLongStackTraces = function() { if (async.haveItemsQueued() && !config.longStackTraces) throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n"); Promise$1.prototype._captureStackTrace = Promise_captureStackTrace; Promise$1.prototype._attachExtraTrace = Promise_attachExtraTrace; Context.deactivateLongStackTraces(); async.enableTrampoline(); config.longStackTraces = false; }; Promise$1.prototype._captureStackTrace = longStackTracesCaptureStackTrace; Promise$1.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; Context.activateLongStackTraces(); async.disableTrampolineIfNecessary(); } }; Promise$1.hasLongStackTraces = function() { return config.longStackTraces && longStackTracesIsSupported(); }; var fireDomEvent = (function() { try { if (typeof CustomEvent === "function") { var event = new CustomEvent("CustomEvent"); util$4.global.dispatchEvent(event); return function(name, event$1) { var domEvent = new CustomEvent(name.toLowerCase(), { detail: event$1, cancelable: true }); return !util$4.global.dispatchEvent(domEvent); }; } else if (typeof Event === "function") { var event = new Event("CustomEvent"); util$4.global.dispatchEvent(event); return function(name, event$1) { var domEvent = new Event(name.toLowerCase(), { cancelable: true }); domEvent.detail = event$1; return !util$4.global.dispatchEvent(domEvent); }; } else { var event = document.createEvent("CustomEvent"); event.initCustomEvent("testingtheevent", false, true, {}); util$4.global.dispatchEvent(event); return function(name, event$1) { var domEvent = document.createEvent("CustomEvent"); domEvent.initCustomEvent(name.toLowerCase(), false, true, event$1); return !util$4.global.dispatchEvent(domEvent); }; } } catch (e) {} return function() { return false; }; })(); var fireGlobalEvent = (function() { if (util$4.isNode) return function() { return process.emit.apply(process, arguments); }; else { if (!util$4.global) return function() { return false; }; return function(name) { var methodName = "on" + name.toLowerCase(); var method = util$4.global[methodName]; if (!method) return false; method.apply(util$4.global, [].slice.call(arguments, 1)); return true; }; } })(); function generatePromiseLifecycleEventObject(name, promise) { return { promise }; } var eventToObjectGenerator = { promiseCreated: generatePromiseLifecycleEventObject, promiseFulfilled: generatePromiseLifecycleEventObject, promiseRejected: generatePromiseLifecycleEventObject, promiseResolved: generatePromiseLifecycleEventObject, promiseCancelled: generatePromiseLifecycleEventObject, promiseChained: function(name, promise, child) { return { promise, child }; }, warning: function(name, warning) { return { warning }; }, unhandledRejection: function(name, reason, promise) { return { reason, promise }; }, rejectionHandled: generatePromiseLifecycleEventObject }; var activeFireEvent = function(name) { var globalEventFired = false; try { globalEventFired = fireGlobalEvent.apply(null, arguments); } catch (e) { async.throwLater(e); globalEventFired = true; } var domEventFired = false; try { domEventFired = fireDomEvent(name, eventToObjectGenerator[name].apply(null, arguments)); } catch (e) { async.throwLater(e); domEventFired = true; } return domEventFired || globalEventFired; }; Promise$1.config = function(opts) { opts = Object(opts); if ("longStackTraces" in opts) { if (opts.longStackTraces) Promise$1.longStackTraces(); else if (!opts.longStackTraces && Promise$1.hasLongStackTraces()) disableLongStackTraces(); } if ("warnings" in opts) { var warningsOption = opts.warnings; config.warnings = !!warningsOption; wForgottenReturn = config.warnings; if (util$4.isObject(warningsOption)) { if ("wForgottenReturn" in warningsOption) wForgottenReturn = !!warningsOption.wForgottenReturn; } } if ("cancellation" in opts && opts.cancellation && !config.cancellation) { if (async.haveItemsQueued()) throw new Error("cannot enable cancellation after promises are in use"); Promise$1.prototype._clearCancellationData = cancellationClearCancellationData; Promise$1.prototype._propagateFrom = cancellationPropagateFrom; Promise$1.prototype._onCancel = cancellationOnCancel; Promise$1.prototype._setOnCancel = cancellationSetOnCancel; Promise$1.prototype._attachCancellationCallback = cancellationAttachCancellationCallback; Promise$1.prototype._execute = cancellationExecute; propagateFromFunction = cancellationPropagateFrom; config.cancellation = true; } if ("monitoring" in opts) { if (opts.monitoring && !config.monitoring) { config.monitoring = true; Promise$1.prototype._fireEvent = activeFireEvent; } else if (!opts.monitoring && config.monitoring) { config.monitoring = false; Promise$1.prototype._fireEvent = defaultFireEvent; } } return Promise$1; }; function defaultFireEvent() { return false; } Promise$1.prototype._fireEvent = defaultFireEvent; Promise$1.prototype._execute = function(executor, resolve, reject) { try { executor(resolve, reject); } catch (e) { return e; } }; Promise$1.prototype._onCancel = function() {}; Promise$1.prototype._setOnCancel = function(handler) {}; Promise$1.prototype._attachCancellationCallback = function(onCancel) {}; Promise$1.prototype._captureStackTrace = function() {}; Promise$1.prototype._attachExtraTrace = function() {}; Promise$1.prototype._clearCancellationData = function() {}; Promise$1.prototype._propagateFrom = function(parent, flags) {}; function cancellationExecute(executor, resolve, reject) { var promise = this; try { executor(resolve, reject, function(onCancel) { if (typeof onCancel !== "function") throw new TypeError("onCancel must be a function, got: " + util$4.toString(onCancel)); promise._attachCancellationCallback(onCancel); }); } catch (e) { return e; } } function cancellationAttachCancellationCallback(onCancel) { if (!this._isCancellable()) return this; var previousOnCancel = this._onCancel(); if (previousOnCancel !== void 0) if (util$4.isArray(previousOnCancel)) previousOnCancel.push(onCancel); else this._setOnCancel([previousOnCancel, onCancel]); else this._setOnCancel(onCancel); } function cancellationOnCancel() { return this._onCancelField; } function cancellationSetOnCancel(onCancel) { this._onCancelField = onCancel; } function cancellationClearCancellationData() { this._cancellationParent = void 0; this._onCancelField = void 0; } function cancellationPropagateFrom(parent, flags) { if ((flags & 1) !== 0) { this._cancellationParent = parent; var branchesRemainingToCancel = parent._branchesRemainingToCancel; if (branchesRemainingToCancel === void 0) branchesRemainingToCancel = 0; parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; } if ((flags & 2) !== 0 && parent._isBound()) this._setBoundTo(parent._boundTo); } function bindingPropagateFrom(parent, flags) { if ((flags & 2) !== 0 && parent._isBound()) this._setBoundTo(parent._boundTo); } var propagateFromFunction = bindingPropagateFrom; function boundValueFunction() { var ret$1 = this._boundTo; if (ret$1 !== void 0) { if (ret$1 instanceof Promise$1) if (ret$1.isFulfilled()) return ret$1.value(); else return; } return ret$1; } function longStackTracesCaptureStackTrace() { this._trace = new CapturedTrace(this._peekContext()); } function longStackTracesAttachExtraTrace(error, ignoreSelf) { if (canAttachTrace$1(error)) { var trace = this._trace; if (trace !== void 0) { if (ignoreSelf) trace = trace._parent; } if (trace !== void 0) trace.attachExtraTrace(error); else if (!error.__stackCleaned__) { var parsed = parseStackAndMessage(error); util$4.notEnumerableProp(error, "stack", parsed.message + "\n" + parsed.stack.join("\n")); util$4.notEnumerableProp(error, "__stackCleaned__", true); } } } function checkForgottenReturns(returnValue, promiseCreated, name, promise, parent) { if (returnValue === void 0 && promiseCreated !== null && wForgottenReturn) { if (parent !== void 0 && parent._returnedNonUndefined()) return; if ((promise._bitField & 65535) === 0) return; if (name) name = name + " "; var handlerLine = ""; var creatorLine = ""; if (promiseCreated._trace) { var traceLines = promiseCreated._trace.stack.split("\n"); var stack = cleanStack(traceLines); for (var i$1 = stack.length - 1; i$1 >= 0; --i$1) { var line = stack[i$1]; if (!nodeFramePattern.test(line)) { var lineMatches = line.match(parseLinePattern); if (lineMatches) handlerLine = "at " + lineMatches[1] + ":" + lineMatches[2] + ":" + lineMatches[3] + " "; break; } } if (stack.length > 0) { var firstUserLine = stack[0]; for (var i$1 = 0; i$1 < traceLines.length; ++i$1) if (traceLines[i$1] === firstUserLine) { if (i$1 > 0) creatorLine = "\n" + traceLines[i$1 - 1]; break; } } } var msg = "a promise was created in a " + name + "handler " + handlerLine + "but was not returned from it, see http://goo.gl/rRqMUw" + creatorLine; promise._warn(msg, true, promiseCreated); } } function deprecated(name, replacement) { var message = name + " is deprecated and will be removed in a future version."; if (replacement) message += " Use " + replacement + " instead."; return warn(message); } function warn(message, shouldUseOwnTrace, promise) { if (!config.warnings) return; var warning = new Warning$1(message); var ctx; if (shouldUseOwnTrace) promise._attachExtraTrace(warning); else if (config.longStackTraces && (ctx = Promise$1._peekContext())) ctx.attachExtraTrace(warning); else { var parsed = parseStackAndMessage(warning); warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); } if (!activeFireEvent("warning", warning)) formatAndLogError(warning, "", true); } function reconstructStack(message, stacks) { for (var i$1 = 0; i$1 < stacks.length - 1; ++i$1) { stacks[i$1].push("From previous event:"); stacks[i$1] = stacks[i$1].join("\n"); } if (i$1 < stacks.length) stacks[i$1] = stacks[i$1].join("\n"); return message + "\n" + stacks.join("\n"); } function removeDuplicateOrEmptyJumps(stacks) { for (var i$1 = 0; i$1 < stacks.length; ++i$1) if (stacks[i$1].length === 0 || i$1 + 1 < stacks.length && stacks[i$1][0] === stacks[i$1 + 1][0]) { stacks.splice(i$1, 1); i$1--; } } function removeCommonRoots(stacks) { var current = stacks[0]; for (var i$1 = 1; i$1 < stacks.length; ++i$1) { var prev = stacks[i$1]; var currentLastIndex = current.length - 1; var currentLastLine = current[currentLastIndex]; var commonRootMeetPoint = -1; for (var j = prev.length - 1; j >= 0; --j) if (prev[j] === currentLastLine) { commonRootMeetPoint = j; break; } for (var j = commonRootMeetPoint; j >= 0; --j) { var line = prev[j]; if (current[currentLastIndex] === line) { current.pop(); currentLastIndex--; } else break; } current = prev; } } function cleanStack(stack) { var ret$1 = []; for (var i$1 = 0; i$1 < stack.length; ++i$1) { var line = stack[i$1]; var isTraceLine = " (No stack trace)" === line || stackFramePattern.test(line); var isInternalFrame = isTraceLine && shouldIgnore(line); if (isTraceLine && !isInternalFrame) { if (indentStackFrames && line.charAt(0) !== " ") line = " " + line; ret$1.push(line); } } return ret$1; } function stackFramesAsArray(error) { var stack = error.stack.replace(/\s+$/g, "").split("\n"); for (var i$1 = 0; i$1 < stack.length; ++i$1) { var line = stack[i$1]; if (" (No stack trace)" === line || stackFramePattern.test(line)) break; } if (i$1 > 0 && error.name != "SyntaxError") stack = stack.slice(i$1); return stack; } function parseStackAndMessage(error) { var stack = error.stack; var message = error.toString(); stack = typeof stack === "string" && stack.length > 0 ? stackFramesAsArray(error) : [" (No stack trace)"]; return { message, stack: error.name == "SyntaxError" ? stack : cleanStack(stack) }; } function formatAndLogError(error, title, isSoft) { if (typeof console !== "undefined") { var message; if (util$4.isObject(error)) { var stack = error.stack; message = title + formatStack(stack, error); } else message = title + String(error); if (typeof printWarning === "function") printWarning(message, isSoft); else if (typeof console.log === "function" || typeof console.log === "object") console.log(message); } } function fireRejectionEvent(name, localHandler, reason, promise) { var localEventFired = false; try { if (typeof localHandler === "function") { localEventFired = true; if (name === "rejectionHandled") localHandler(promise); else localHandler(reason, promise); } } catch (e) { async.throwLater(e); } if (name === "unhandledRejection") { if (!activeFireEvent(name, reason, promise) && !localEventFired) formatAndLogError(reason, "Unhandled rejection "); } else activeFireEvent(name, promise); } function formatNonError(obj) { var str$1; if (typeof obj === "function") str$1 = "[function " + (obj.name || "anonymous") + "]"; else { str$1 = obj && typeof obj.toString === "function" ? obj.toString() : util