UNPKG

orange-orm

Version:

Object Relational Mapper

1,507 lines 910 kB
//#region \0rolldown/runtime.js 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 __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports); var __exportAll = (all, no_symbols) => { let target = {}; for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" }); return target; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); //#endregion //#region node_modules/fast-json-patch/module/helpers.mjs /*! * https://github.com/Starcounter-Jack/JSON-Patch * (c) 2017-2022 Joachim Wester * MIT licensed */ var __extends = (function() { var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { d.__proto__ = b; } || function(d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _hasOwnProperty = Object.prototype.hasOwnProperty; function hasOwnProperty$1(obj, key) { return _hasOwnProperty.call(obj, key); } function _objectKeys(obj) { if (Array.isArray(obj)) { var keys_1 = new Array(obj.length); for (var k = 0; k < keys_1.length; k++) keys_1[k] = "" + k; return keys_1; } if (Object.keys) return Object.keys(obj); var keys = []; for (var i in obj) if (hasOwnProperty$1(obj, i)) keys.push(i); return keys; } /** * Deeply clone the object. * https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy) * @param {any} obj value to clone * @return {any} cloned obj */ function _deepClone(obj) { switch (typeof obj) { case "object": return JSON.parse(JSON.stringify(obj)); case "undefined": return null; default: return obj; } } function isInteger(str) { var i = 0; var len = str.length; var charCode; while (i < len) { charCode = str.charCodeAt(i); if (charCode >= 48 && charCode <= 57) { i++; continue; } return false; } return true; } /** * Escapes a json pointer path * @param path The raw pointer * @return the Escaped path */ function escapePathComponent(path) { if (path.indexOf("/") === -1 && path.indexOf("~") === -1) return path; return path.replace(/~/g, "~0").replace(/\//g, "~1"); } /** * Unescapes a json pointer path * @param path The escaped pointer * @return The unescaped path */ function unescapePathComponent(path) { return path.replace(/~1/g, "/").replace(/~0/g, "~"); } /** * Recursively checks whether an object has any undefined values inside. */ function hasUndefined(obj) { if (obj === void 0) return true; if (obj) { if (Array.isArray(obj)) { for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) if (hasUndefined(obj[i_1])) return true; } else if (typeof obj === "object") { var objKeys = _objectKeys(obj); var objKeysLength = objKeys.length; for (var i = 0; i < objKeysLength; i++) if (hasUndefined(obj[objKeys[i]])) return true; } } return false; } function patchErrorMessageFormatter(message, args) { var messageParts = [message]; for (var key in args) { var value = typeof args[key] === "object" ? JSON.stringify(args[key], null, 2) : args[key]; if (typeof value !== "undefined") messageParts.push(key + ": " + value); } return messageParts.join("\n"); } var PatchError = function(_super) { __extends(PatchError, _super); function PatchError(message, name, index, operation, tree) { var _newTarget = this.constructor; var _this = _super.call(this, patchErrorMessageFormatter(message, { name, index, operation, tree })) || this; _this.name = name; _this.index = index; _this.operation = operation; _this.tree = tree; Object.setPrototypeOf(_this, _newTarget.prototype); _this.message = patchErrorMessageFormatter(message, { name, index, operation, tree }); return _this; } return PatchError; }(Error); //#endregion //#region node_modules/fast-json-patch/module/core.mjs var core_exports = /* @__PURE__ */ __exportAll({ JsonPatchError: () => JsonPatchError, _areEquals: () => _areEquals, applyOperation: () => applyOperation, applyPatch: () => applyPatch, applyReducer: () => applyReducer, deepClone: () => deepClone, getValueByPointer: () => getValueByPointer, validate: () => validate, validator: () => validator }); var JsonPatchError = PatchError; var deepClone = _deepClone; var objOps = { add: function(obj, key, document) { obj[key] = this.value; return { newDocument: document }; }, remove: function(obj, key, document) { var removed = obj[key]; delete obj[key]; return { newDocument: document, removed }; }, replace: function(obj, key, document) { var removed = obj[key]; obj[key] = this.value; return { newDocument: document, removed }; }, move: function(obj, key, document) { var removed = getValueByPointer(document, this.path); if (removed) removed = _deepClone(removed); var originalValue = applyOperation(document, { op: "remove", path: this.from }).removed; applyOperation(document, { op: "add", path: this.path, value: originalValue }); return { newDocument: document, removed }; }, copy: function(obj, key, document) { var valueToCopy = getValueByPointer(document, this.from); applyOperation(document, { op: "add", path: this.path, value: _deepClone(valueToCopy) }); return { newDocument: document }; }, test: function(obj, key, document) { return { newDocument: document, test: _areEquals(obj[key], this.value) }; }, _get: function(obj, key, document) { this.value = obj[key]; return { newDocument: document }; } }; var arrOps = { add: function(arr, i, document) { if (isInteger(i)) arr.splice(i, 0, this.value); else arr[i] = this.value; return { newDocument: document, index: i }; }, remove: function(arr, i, document) { return { newDocument: document, removed: arr.splice(i, 1)[0] }; }, replace: function(arr, i, document) { var removed = arr[i]; arr[i] = this.value; return { newDocument: document, removed }; }, move: objOps.move, copy: objOps.copy, test: objOps.test, _get: objOps._get }; /** * Retrieves a value from a JSON document by a JSON pointer. * Returns the value. * * @param document The document to get the value from * @param pointer an escaped JSON pointer * @return The retrieved value */ function getValueByPointer(document, pointer) { if (pointer == "") return document; var getOriginalDestination = { op: "_get", path: pointer }; applyOperation(document, getOriginalDestination); return getOriginalDestination.value; } /** * Apply a single JSON Patch Operation on a JSON document. * Returns the {newDocument, result} of the operation. * It modifies the `document` and `operation` objects - it gets the values by reference. * If you would like to avoid touching your values, clone them: * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`. * * @param document The document to patch * @param operation The operation to apply * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation. * @param mutateDocument Whether to mutate the original document or clone it before applying * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`. * @return `{newDocument, result}` after the operation */ function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) { if (validateOperation === void 0) validateOperation = false; if (mutateDocument === void 0) mutateDocument = true; if (banPrototypeModifications === void 0) banPrototypeModifications = true; if (index === void 0) index = 0; if (validateOperation) if (typeof validateOperation == "function") validateOperation(operation, 0, document, operation.path); else validator(operation, 0); if (operation.path === "") { var returnValue = { newDocument: document }; if (operation.op === "add") { returnValue.newDocument = operation.value; return returnValue; } else if (operation.op === "replace") { returnValue.newDocument = operation.value; returnValue.removed = document; return returnValue; } else if (operation.op === "move" || operation.op === "copy") { returnValue.newDocument = getValueByPointer(document, operation.from); if (operation.op === "move") returnValue.removed = document; return returnValue; } else if (operation.op === "test") { returnValue.test = _areEquals(document, operation.value); if (returnValue.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document); returnValue.newDocument = document; return returnValue; } else if (operation.op === "remove") { returnValue.removed = document; returnValue.newDocument = null; return returnValue; } else if (operation.op === "_get") { operation.value = document; return returnValue; } else if (validateOperation) throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document); else return returnValue; } else { if (!mutateDocument) document = _deepClone(document); var keys = (operation.path || "").split("/"); var obj = document; var t = 1; var len = keys.length; var existingPathFragment = void 0; var key = void 0; var validateFunction = void 0; if (typeof validateOperation == "function") validateFunction = validateOperation; else validateFunction = validator; while (true) { key = keys[t]; if (key && key.indexOf("~") != -1) key = unescapePathComponent(key); if (banPrototypeModifications && (key == "__proto__" || key == "prototype" && t > 0 && keys[t - 1] == "constructor")) throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README"); if (validateOperation) { if (existingPathFragment === void 0) { if (obj[key] === void 0) existingPathFragment = keys.slice(0, t).join("/"); else if (t == len - 1) existingPathFragment = operation.path; if (existingPathFragment !== void 0) validateFunction(operation, 0, document, existingPathFragment); } } t++; if (Array.isArray(obj)) { if (key === "-") key = obj.length; else if (validateOperation && !isInteger(key)) throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document); else if (isInteger(key)) key = ~~key; if (t >= len) { if (validateOperation && operation.op === "add" && key > obj.length) throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document); var returnValue = arrOps[operation.op].call(operation, obj, key, document); if (returnValue.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document); return returnValue; } } else if (t >= len) { var returnValue = objOps[operation.op].call(operation, obj, key, document); if (returnValue.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document); return returnValue; } obj = obj[key]; if (validateOperation && t < len && (!obj || typeof obj !== "object")) throw new JsonPatchError("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", index, operation, document); } } } /** * Apply a full JSON Patch array on a JSON document. * Returns the {newDocument, result} of the patch. * It modifies the `document` object and `patch` - it gets the values by reference. * If you would like to avoid touching your values, clone them: * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`. * * @param document The document to patch * @param patch The patch to apply * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation. * @param mutateDocument Whether to mutate the original document or clone it before applying * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`. * @return An array of `{newDocument, result}` after the patch */ function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) { if (mutateDocument === void 0) mutateDocument = true; if (banPrototypeModifications === void 0) banPrototypeModifications = true; if (validateOperation) { if (!Array.isArray(patch)) throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY"); } if (!mutateDocument) document = _deepClone(document); var results = new Array(patch.length); for (var i = 0, length_1 = patch.length; i < length_1; i++) { results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i); document = results[i].newDocument; } results.newDocument = document; return results; } /** * Apply a single JSON Patch Operation on a JSON document. * Returns the updated document. * Suitable as a reducer. * * @param document The document to patch * @param operation The operation to apply * @return The updated document */ function applyReducer(document, operation, index) { var operationResult = applyOperation(document, operation); if (operationResult.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document); return operationResult.newDocument; } /** * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error. * @param {object} operation - operation object (patch) * @param {number} index - index of operation in the sequence * @param {object} [document] - object where the operation is supposed to be applied * @param {string} [existingPathFragment] - comes along with `document` */ function validator(operation, index, document, existingPathFragment) { if (typeof operation !== "object" || operation === null || Array.isArray(operation)) throw new JsonPatchError("Operation is not an object", "OPERATION_NOT_AN_OBJECT", index, operation, document); else if (!objOps[operation.op]) throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document); else if (typeof operation.path !== "string") throw new JsonPatchError("Operation `path` property is not a string", "OPERATION_PATH_INVALID", index, operation, document); else if (operation.path.indexOf("/") !== 0 && operation.path.length > 0) throw new JsonPatchError("Operation `path` property must start with \"/\"", "OPERATION_PATH_INVALID", index, operation, document); else if ((operation.op === "move" || operation.op === "copy") && typeof operation.from !== "string") throw new JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", index, operation, document); else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && operation.value === void 0) throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", index, operation, document); else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && hasUndefined(operation.value)) throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", index, operation, document); else if (document) { if (operation.op == "add") { var pathLen = operation.path.split("/").length; var existingPathLen = existingPathFragment.split("/").length; if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) throw new JsonPatchError("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", index, operation, document); } else if (operation.op === "replace" || operation.op === "remove" || operation.op === "_get") { if (operation.path !== existingPathFragment) throw new JsonPatchError("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", index, operation, document); } else if (operation.op === "move" || operation.op === "copy") { var error = validate([{ op: "_get", path: operation.from, value: void 0 }], document); if (error && error.name === "OPERATION_PATH_UNRESOLVABLE") throw new JsonPatchError("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", index, operation, document); } } } /** * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document. * If error is encountered, returns a JsonPatchError object * @param sequence * @param document * @returns {JsonPatchError|undefined} */ function validate(sequence, document, externalValidator) { try { if (!Array.isArray(sequence)) throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY"); if (document) applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true); else { externalValidator = externalValidator || validator; for (var i = 0; i < sequence.length; i++) externalValidator(sequence[i], i, document, void 0); } } catch (e) { if (e instanceof JsonPatchError) return e; else throw e; } } function _areEquals(a, b) { if (a === b) return true; if (a && b && typeof a == "object" && typeof b == "object") { var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key; if (arrA && arrB) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!_areEquals(a[i], b[i])) return false; return true; } if (arrA != arrB) return false; var keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!b.hasOwnProperty(keys[i])) return false; for (i = length; i-- !== 0;) { key = keys[i]; if (!_areEquals(a[key], b[key])) return false; } return true; } return a !== a && b !== b; } //#endregion //#region node_modules/fast-json-patch/module/duplex.mjs /*! * https://github.com/Starcounter-Jack/JSON-Patch * (c) 2017-2021 Joachim Wester * MIT license */ var duplex_exports = /* @__PURE__ */ __exportAll({ compare: () => compare, generate: () => generate, observe: () => observe, unobserve: () => unobserve }); var beforeDict = /* @__PURE__ */ new WeakMap(); var Mirror = function() { function Mirror(obj) { this.observers = /* @__PURE__ */ new Map(); this.obj = obj; } return Mirror; }(); var ObserverInfo = function() { function ObserverInfo(callback, observer) { this.callback = callback; this.observer = observer; } return ObserverInfo; }(); function getMirror(obj) { return beforeDict.get(obj); } function getObserverFromMirror(mirror, callback) { return mirror.observers.get(callback); } function removeObserverFromMirror(mirror, observer) { mirror.observers.delete(observer.callback); } /** * Detach an observer from an object */ function unobserve(root, observer) { observer.unobserve(); } /** * Observes changes made to an object, which can then be retrieved using generate */ function observe(obj, callback) { var patches = []; var observer; var mirror = getMirror(obj); if (!mirror) { mirror = new Mirror(obj); beforeDict.set(obj, mirror); } else { var observerInfo = getObserverFromMirror(mirror, callback); observer = observerInfo && observerInfo.observer; } if (observer) return observer; observer = {}; mirror.value = _deepClone(obj); if (callback) { observer.callback = callback; observer.next = null; var dirtyCheck = function() { generate(observer); }; var fastCheck = function() { clearTimeout(observer.next); observer.next = setTimeout(dirtyCheck); }; if (typeof window !== "undefined") { window.addEventListener("mouseup", fastCheck); window.addEventListener("keyup", fastCheck); window.addEventListener("mousedown", fastCheck); window.addEventListener("keydown", fastCheck); window.addEventListener("change", fastCheck); } } observer.patches = patches; observer.object = obj; observer.unobserve = function() { generate(observer); clearTimeout(observer.next); removeObserverFromMirror(mirror, observer); if (typeof window !== "undefined") { window.removeEventListener("mouseup", fastCheck); window.removeEventListener("keyup", fastCheck); window.removeEventListener("mousedown", fastCheck); window.removeEventListener("keydown", fastCheck); window.removeEventListener("change", fastCheck); } }; mirror.observers.set(callback, new ObserverInfo(callback, observer)); return observer; } /** * Generate an array of patches from an observer */ function generate(observer, invertible) { if (invertible === void 0) invertible = false; var mirror = beforeDict.get(observer.object); _generate(mirror.value, observer.object, observer.patches, "", invertible); if (observer.patches.length) applyPatch(mirror.value, observer.patches); var temp = observer.patches; if (temp.length > 0) { observer.patches = []; if (observer.callback) observer.callback(temp); } return temp; } function _generate(mirror, obj, patches, path, invertible) { if (obj === mirror) return; if (typeof obj.toJSON === "function") obj = obj.toJSON(); var newKeys = _objectKeys(obj); var oldKeys = _objectKeys(mirror); var deleted = false; for (var t = oldKeys.length - 1; t >= 0; t--) { var key = oldKeys[t]; var oldVal = mirror[key]; if (hasOwnProperty$1(obj, key) && !(obj[key] === void 0 && oldVal !== void 0 && Array.isArray(obj) === false)) { var newVal = obj[key]; if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) _generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key), invertible); else if (oldVal !== newVal) { if (invertible) patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) }); patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: _deepClone(newVal) }); } } else if (Array.isArray(mirror) === Array.isArray(obj)) { if (invertible) patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) }); patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) }); deleted = true; } else { if (invertible) patches.push({ op: "test", path, value: mirror }); patches.push({ op: "replace", path, value: obj }); } } if (!deleted && newKeys.length == oldKeys.length) return; for (var t = 0; t < newKeys.length; t++) { var key = newKeys[t]; if (!hasOwnProperty$1(mirror, key) && obj[key] !== void 0) patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: _deepClone(obj[key]) }); } } /** * Create an array of patches from the differences in two objects */ function compare(tree1, tree2, invertible) { if (invertible === void 0) invertible = false; var patches = []; _generate(tree1, tree2, patches, "", invertible); return patches; } //#endregion //#region node_modules/fast-json-patch/index.mjs /** * Default export for backwards compat */ var fast_json_patch_exports = /* @__PURE__ */ __exportAll({ JsonPatchError: () => PatchError, _areEquals: () => _areEquals, applyOperation: () => applyOperation, applyPatch: () => applyPatch, applyReducer: () => applyReducer, compare: () => compare, deepClone: () => _deepClone, default: () => fast_json_patch_default, escapePathComponent: () => escapePathComponent, generate: () => generate, getValueByPointer: () => getValueByPointer, observe: () => observe, unescapePathComponent: () => unescapePathComponent, unobserve: () => unobserve, validate: () => validate, validator: () => validator }); var fast_json_patch_default = Object.assign({}, core_exports, duplex_exports, { JsonPatchError: PatchError, deepClone: _deepClone, escapePathComponent, unescapePathComponent }); //#endregion //#region node_modules/axios/lib/helpers/bind.js /** * Create a bound version of a function with a specified `this` context * * @param {Function} fn - The function to bind * @param {*} thisArg - The value to be passed as the `this` parameter * @returns {Function} A new function that will call the original function with the specified `this` context */ function bind(fn, thisArg) { return function wrap() { return fn.apply(thisArg, arguments); }; } //#endregion //#region node_modules/axios/lib/utils.js var { toString: toString$1 } = Object.prototype; var { getPrototypeOf } = Object; var { iterator, toStringTag } = Symbol; var kindOf = ((cache) => (thing) => { const str = toString$1.call(thing); return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); })(Object.create(null)); var kindOfTest = (type) => { type = type.toLowerCase(); return (thing) => kindOf(thing) === type; }; var typeOfTest = (type) => (thing) => typeof thing === type; /** * Determine if a value is a non-null object * * @param {Object} val The value to test * * @returns {boolean} True if value is an Array, otherwise false */ var { isArray } = Array; /** * Determine if a value is undefined * * @param {*} val The value to test * * @returns {boolean} True if the value is undefined, otherwise false */ var isUndefined = typeOfTest("undefined"); /** * Determine if a value is a Buffer * * @param {*} val The value to test * * @returns {boolean} True if value is a Buffer, otherwise false */ function isBuffer(val) { return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val); } /** * Determine if a value is an ArrayBuffer * * @param {*} val The value to test * * @returns {boolean} True if value is an ArrayBuffer, otherwise false */ var isArrayBuffer = kindOfTest("ArrayBuffer"); /** * Determine if a value is a view on an ArrayBuffer * * @param {*} val The value to test * * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false */ function isArrayBufferView(val) { let result; if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) result = ArrayBuffer.isView(val); else result = val && val.buffer && isArrayBuffer(val.buffer); return result; } /** * Determine if a value is a String * * @param {*} val The value to test * * @returns {boolean} True if value is a String, otherwise false */ var isString = typeOfTest("string"); /** * Determine if a value is a Function * * @param {*} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ var isFunction$1 = typeOfTest("function"); /** * Determine if a value is a Number * * @param {*} val The value to test * * @returns {boolean} True if value is a Number, otherwise false */ var isNumber = typeOfTest("number"); /** * Determine if a value is an Object * * @param {*} thing The value to test * * @returns {boolean} True if value is an Object, otherwise false */ var isObject$1 = (thing) => thing !== null && typeof thing === "object"; /** * Determine if a value is a Boolean * * @param {*} thing The value to test * @returns {boolean} True if value is a Boolean, otherwise false */ var isBoolean = (thing) => thing === true || thing === false; /** * Determine if a value is a plain Object * * @param {*} val The value to test * * @returns {boolean} True if value is a plain Object, otherwise false */ var isPlainObject = (val) => { if (kindOf(val) !== "object") return false; const prototype = getPrototypeOf(val); return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val); }; /** * Determine if a value is an empty object (safely handles Buffers) * * @param {*} val The value to test * * @returns {boolean} True if value is an empty object, otherwise false */ var isEmptyObject = (val) => { if (!isObject$1(val) || isBuffer(val)) return false; try { return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype; } catch (e) { return false; } }; /** * Determine if a value is a Date * * @param {*} val The value to test * * @returns {boolean} True if value is a Date, otherwise false */ var isDate = kindOfTest("Date"); /** * Determine if a value is a File * * @param {*} val The value to test * * @returns {boolean} True if value is a File, otherwise false */ var isFile = kindOfTest("File"); /** * Determine if a value is a React Native Blob * React Native "blob": an object with a `uri` attribute. Optionally, it can * also have a `name` and `type` attribute to specify filename and content type * * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71 * * @param {*} value The value to test * * @returns {boolean} True if value is a React Native Blob, otherwise false */ var isReactNativeBlob = (value) => { return !!(value && typeof value.uri !== "undefined"); }; /** * Determine if environment is React Native * ReactNative `FormData` has a non-standard `getParts()` method * * @param {*} formData The formData to test * * @returns {boolean} True if environment is React Native, otherwise false */ var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined"; /** * Determine if a value is a Blob * * @param {*} val The value to test * * @returns {boolean} True if value is a Blob, otherwise false */ var isBlob = kindOfTest("Blob"); /** * Determine if a value is a FileList * * @param {*} val The value to test * * @returns {boolean} True if value is a FileList, otherwise false */ var isFileList = kindOfTest("FileList"); /** * Determine if a value is a Stream * * @param {*} val The value to test * * @returns {boolean} True if value is a Stream, otherwise false */ var isStream = (val) => isObject$1(val) && isFunction$1(val.pipe); /** * Determine if a value is a FormData * * @param {*} thing The value to test * * @returns {boolean} True if value is an FormData, otherwise false */ function getGlobal() { if (typeof globalThis !== "undefined") return globalThis; if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; return {}; } var G = getGlobal(); var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0; var isFormData = (thing) => { if (!thing) return false; if (FormDataCtor && thing instanceof FormDataCtor) return true; const proto = getPrototypeOf(thing); if (!proto || proto === Object.prototype) return false; if (!isFunction$1(thing.append)) return false; const kind = kindOf(thing); return kind === "formdata" || kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"; }; /** * Determine if a value is a URLSearchParams object * * @param {*} val The value to test * * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ var isURLSearchParams = kindOfTest("URLSearchParams"); var [isReadableStream, isRequest, isResponse, isHeaders] = [ "ReadableStream", "Request", "Response", "Headers" ].map(kindOfTest); /** * Trim excess whitespace off the beginning and end of a string * * @param {String} str The String to trim * * @returns {String} The String freed of excess whitespace */ var trim = (str) => { return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); }; /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array<unknown>} obj The object to iterate * @param {Function} fn The callback to invoke for each item * * @param {Object} [options] * @param {Boolean} [options.allOwnKeys = false] * @returns {any} */ function forEach(obj, fn, { allOwnKeys = false } = {}) { if (obj === null || typeof obj === "undefined") return; let i; let l; if (typeof obj !== "object") obj = [obj]; if (isArray(obj)) for (i = 0, l = obj.length; i < l; i++) fn.call(null, obj[i], i, obj); else { if (isBuffer(obj)) return; const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); const len = keys.length; let key; for (i = 0; i < len; i++) { key = keys[i]; fn.call(null, obj[key], key, obj); } } } /** * Finds a key in an object, case-insensitive, returning the actual key name. * Returns null if the object is a Buffer or if no match is found. * * @param {Object} obj - The object to search. * @param {string} key - The key to find (case-insensitive). * @returns {?string} The actual key name if found, otherwise null. */ function findKey(obj, key) { if (isBuffer(obj)) return null; key = key.toLowerCase(); const keys = Object.keys(obj); let i = keys.length; let _key; while (i-- > 0) { _key = keys[i]; if (key === _key.toLowerCase()) return _key; } return null; } var _global = (() => { if (typeof globalThis !== "undefined") return globalThis; return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global; })(); var isContextDefined = (context) => !isUndefined(context) && context !== _global; /** * Accepts varargs expecting each argument to be an object, then * immutably merges the properties of each object and returns result. * * When multiple objects contain the same key the later object in * the arguments list will take precedence. * * Example: * * ```js * const result = merge({foo: 123}, {foo: 456}); * console.log(result.foo); // outputs 456 * ``` * * @param {Object} obj1 Object to merge * * @returns {Object} Result of all merge properties */ function merge(...objs) { const { caseless, skipUndefined } = isContextDefined(this) && this || {}; const result = {}; const assignValue = (val, key) => { if (key === "__proto__" || key === "constructor" || key === "prototype") return; const targetKey = caseless && typeof key === "string" && findKey(result, key) || key; const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0; if (isPlainObject(existing) && isPlainObject(val)) result[targetKey] = merge(existing, val); else if (isPlainObject(val)) result[targetKey] = merge({}, val); else if (isArray(val)) result[targetKey] = val.slice(); else if (!skipUndefined || !isUndefined(val)) result[targetKey] = val; }; for (let i = 0, l = objs.length; i < l; i++) { const source = objs[i]; if (!source || isBuffer(source)) continue; forEach(source, assignValue); if (typeof source !== "object" || isArray(source)) continue; const symbols = Object.getOwnPropertySymbols(source); for (let j = 0; j < symbols.length; j++) { const symbol = symbols[j]; if (propertyIsEnumerable.call(source, symbol)) assignValue(source[symbol], symbol); } } return result; } /** * Extends object a by mutably adding to it the properties of object b. * * @param {Object} a The object to be extended * @param {Object} b The object to copy properties from * @param {Object} thisArg The object to bind function to * * @param {Object} [options] * @param {Boolean} [options.allOwnKeys] * @returns {Object} The resulting value of object a */ var extend = (a, b, thisArg, { allOwnKeys } = {}) => { forEach(b, (val, key) => { if (thisArg && isFunction$1(val)) Object.defineProperty(a, key, { __proto__: null, value: bind(val, thisArg), writable: true, enumerable: true, configurable: true }); else Object.defineProperty(a, key, { __proto__: null, value: val, writable: true, enumerable: true, configurable: true }); }, { allOwnKeys }); return a; }; /** * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) * * @param {string} content with BOM * * @returns {string} content value without BOM */ var stripBOM = (content) => { if (content.charCodeAt(0) === 65279) content = content.slice(1); return content; }; /** * Inherit the prototype methods from one constructor into another * @param {function} constructor * @param {function} superConstructor * @param {object} [props] * @param {object} [descriptors] * * @returns {void} */ var inherits = (constructor, superConstructor, props, descriptors) => { constructor.prototype = Object.create(superConstructor.prototype, descriptors); Object.defineProperty(constructor.prototype, "constructor", { __proto__: null, value: constructor, writable: true, enumerable: false, configurable: true }); Object.defineProperty(constructor, "super", { __proto__: null, value: superConstructor.prototype }); props && Object.assign(constructor.prototype, props); }; /** * Resolve object with deep prototype chain to a flat object * @param {Object} sourceObj source object * @param {Object} [destObj] * @param {Function|Boolean} [filter] * @param {Function} [propFilter] * * @returns {Object} */ var toFlatObject = (sourceObj, destObj, filter, propFilter) => { let props; let i; let prop; const merged = {}; destObj = destObj || {}; if (sourceObj == null) return destObj; do { props = Object.getOwnPropertyNames(sourceObj); i = props.length; while (i-- > 0) { prop = props[i]; if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { destObj[prop] = sourceObj[prop]; merged[prop] = true; } } sourceObj = filter !== false && getPrototypeOf(sourceObj); } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); return destObj; }; /** * Determines whether a string ends with the characters of a specified string * * @param {String} str * @param {String} searchString * @param {Number} [position= 0] * * @returns {boolean} */ var endsWith$1 = (str, searchString, position) => { str = String(str); if (position === void 0 || position > str.length) position = str.length; position -= searchString.length; const lastIndex = str.indexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; }; /** * Returns new array from array like object or null if failed * * @param {*} [thing] * * @returns {?Array} */ var toArray = (thing) => { if (!thing) return null; if (isArray(thing)) return thing; let i = thing.length; if (!isNumber(i)) return null; const arr = new Array(i); while (i-- > 0) arr[i] = thing[i]; return arr; }; /** * Checking if the Uint8Array exists and if it does, it returns a function that checks if the * thing passed in is an instance of Uint8Array * * @param {TypedArray} * * @returns {Array} */ var isTypedArray = ((TypedArray) => { return (thing) => { return TypedArray && thing instanceof TypedArray; }; })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array)); /** * For each entry in the object, call the function with the key and value. * * @param {Object<any, any>} obj - The object to iterate over. * @param {Function} fn - The function to call for each entry. * * @returns {void} */ var forEachEntry = (obj, fn) => { const _iterator = (obj && obj[iterator]).call(obj); let result; while ((result = _iterator.next()) && !result.done) { const pair = result.value; fn.call(obj, pair[0], pair[1]); } }; /** * It takes a regular expression and a string, and returns an array of all the matches * * @param {string} regExp - The regular expression to match against. * @param {string} str - The string to search. * * @returns {Array<boolean>} */ var matchAll = (regExp, str) => { let matches; const arr = []; while ((matches = regExp.exec(str)) !== null) arr.push(matches); return arr; }; var isHTMLForm = kindOfTest("HTMLFormElement"); var toCamelCase = (str) => { return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) { return p1.toUpperCase() + p2; }); }; var hasOwnProperty = (({ hasOwnProperty }) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); var { propertyIsEnumerable } = Object.prototype; /** * Determine if a value is a RegExp object * * @param {*} val The value to test * * @returns {boolean} True if value is a RegExp object, otherwise false */ var isRegExp = kindOfTest("RegExp"); var reduceDescriptors = (obj, reducer) => { const descriptors = Object.getOwnPropertyDescriptors(obj); const reducedDescriptors = {}; forEach(descriptors, (descriptor, name) => { let ret; if ((ret = reducer(descriptor, name, obj)) !== false) reducedDescriptors[name] = ret || descriptor; }); Object.defineProperties(obj, reducedDescriptors); }; /** * Makes all methods read-only * @param {Object} obj */ var freezeMethods = (obj) => { reduceDescriptors(obj, (descriptor, name) => { if (isFunction$1(obj) && [ "arguments", "caller", "callee" ].includes(name)) return false; const value = obj[name]; if (!isFunction$1(value)) return; descriptor.enumerable = false; if ("writable" in descriptor) { descriptor.writable = false; return; } if (!descriptor.set) descriptor.set = () => { throw Error("Can not rewrite read-only method '" + name + "'"); }; }); }; /** * Converts an array or a delimited string into an object set with values as keys and true as values. * Useful for fast membership checks. * * @param {Array|string} arrayOrString - The array or string to convert. * @param {string} delimiter - The delimiter to use if input is a string. * @returns {Object} An object with keys from the array or string, values set to true. */ var toObjectSet = (arrayOrString, delimiter) => { const obj = {}; const define = (arr) => { arr.forEach((value) => { obj[value] = true; }); }; isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); return obj; }; var noop = () => {}; var toFiniteNumber = (value, defaultValue) => { return value != null && Number.isFinite(value = +value) ? value : defaultValue; }; /** * If the thing is a FormData object, return true, otherwise return false. * * @param {unknown} thing - The thing to check. * * @returns {boolean} */ function isSpecCompliantForm(thing) { return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]); } /** * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers. * * @param {Object} obj - The object to convert. * @returns {Object} The JSON-compatible object. */ var toJSONObject = (obj) => { const visited = /* @__PURE__ */ new WeakSet(); const visit = (source) => { if (isObject$1(source)) { if (visited.has(source)) return; if (isBuffer(source)) return source; if (!("toJSON" in source)) { visited.add(source); const target = isArray(source) ? [] : {}; forEach(source, (value, key) => { const reducedValue = visit(value); !isUndefined(reducedValue) && (target[key] = reducedValue); }); visited.delete(source); return target; } } return source; }; return visit(obj); }; /** * Determines if a value is an async function. * * @param {*} thing - The value to test. * @returns {boolean} True if value is an async function, otherwise false. */ var isAsyncFn = kindOfTest("AsyncFunction"); /** * Determines if a value is thenable (has then and catch methods). * * @param {*} thing - The value to test. * @returns {boolean} True if value is thenable, otherwise false. */ var isThenable = (thing) => thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch); /** * Provides a cross-platform setImmediate implementation. * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout. * * @param {boolean} setImmediateSupported - Whether setImmediate is supported. * @param {boolean} postMessageSupported - Whether postMessage is supported. * @returns {Function} A function to schedule a callback asynchronously. */ var _setImmediate = ((setImmediateSupported, postMessageSupported) => { if (setImmediateSupported) return setImmediate; return postMessageSupported ? ((token, callbacks) => { _global.addEventListener("message", ({ source, data }) => { if (source === _global && data === token) callbacks.length && callbacks.shift()(); }, false); return (cb) => { callbacks.push(cb); _global.postMessage(token, "*"); }; })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb); })(typeof setImmediate === "function", isFunction$1(_global.postMessage)); /** * Schedules a microtask or asynchronous callback as soon as possible. * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate. * * @type {Function} */ var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate; var isIterable = (thing) => thing != null && isFunction$1(thing[iterator]); var utils_default = { isArray, isArrayBuffer, isBuffer, isFormData, isArrayBufferView, isString, isNumber, isBoolean, isObject: isObject$1, isPlainObject, isEmptyObject, isReadableStream, isRequest, isResponse, isHeaders, isUndefined, isDate, isFile, isReactNativeBlob, isReactNative, isBlob, isRegExp, isFunction: isFunction$1, isStream, isURLSearchParams, isTypedArray, isFileList, forEach, merge, extend, trim, stripBOM, inherits, toFlatObject, kindOf, kindOfTest, endsWith: endsWith$1, toArray, forEachEntry, matchAll, isHTMLForm, hasOwnProperty, hasOwnProp: hasOwnProperty, reduceDescriptors, freezeMethods, toObjectSet, toCamelCase, noop, toFiniteNumber, findKey, global: _global, isContextDefined, isSpecCompliantForm, toJSONObject, isAsyncFn, isThenable, setImmediate: _setImmediate, asap, isIterable }; //#endregion //#region node_modules/axios/lib/helpers/parseHeaders.js var ignoreDuplicateOf = utils_default.toObjectSet([ "age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent" ]); /** * Parse headers into an object * * ``` * Date: Wed, 27 Aug 2014 08:58:49 GMT * Content-Type: application/json * Connection: keep-alive * Transfer-Encoding: chunked * ``` * * @param {String} rawHeaders Headers needing to be parsed * * @returns {Object} Headers parsed into an object */ var parseHeaders_default = (rawHeaders) => { const parsed = {}; let key; let val; let i; rawHeaders && rawHeaders.split("\n").forEach(function parser(line) { i = line.indexOf(":"); key = line.substring(0, i).trim().toLowerCase(); val = line.substring(i + 1).trim(); if (!key || parsed[key] && ignoreDuplicateOf[key]) return; if (key === "set-cookie") if (parsed[key]) parsed[key].push(val); else parsed[key] = [val]; else parsed[key] = parsed[key] ? parsed[key] + ", " + val : val; }); return parsed; }; //#endregion //#region node_modules/axios/lib/helpers/sanitizeHeaderValue.js function trimSPorHTAB(str) { let start = 0; let end = str.length; while (start < end) { const code = str.charCodeAt(start); if (code !== 9 && code !== 32) break; start += 1; } while (end > start) { const code = str.charCodeAt(end - 1); if (code !== 9 && code !== 32) break; end -= 1; } return start === 0 && end === str.length ? str : str.slice(start, end); } var INVALID_UNICODE_HEADER_VALUE_CHARS = /* @__PURE__ */ new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g"); var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = /* @__PURE__ */ new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g"); function sanitizeValue(value, invalidChars) { if (utils_default.isArray(value)) return value.map((item) => sanitizeValue(item, invalidChars)); return trimSPorHTAB(String(value).replace(invalidChars, "")); } var sanitizeHeaderValue = (value) => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS); var sanitizeByteStringHeaderValue = (value) => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS); function toByteStringHeaderObject(headers) { const byteStringHeaders =