UNPKG

@nodecg/types

Version:

Dynamic broadcast graphics rendered in a browser

1,424 lines (1,403 loc) 1.51 MB
(function() { //#region rolldown:runtime 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 __commonJS = (cb, mod) => function() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (all$1, symbols) => { let target = {}; for (var name in all$1) { __defProp(target, name, { get: all$1[name], enumerable: true }); } if (symbols) { __defProp(target, Symbol.toStringTag, { value: "Module" }); } return target; }; var __copyProps = (to, from, except, desc$1) => { if (from && typeof from === "object" || typeof from === "function") { for (var keys$2 = __getOwnPropNames(from), i$1 = 0, n = keys$2.length, key; i$1 < n; i$1++) { key = keys$2[i$1]; if (!__hasOwnProp.call(to, key) && key !== except) { __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc$1 = __getOwnPropDesc(from, key)) || desc$1.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 \0@oxc-project+runtime@0.98.0/helpers/typeof.js function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) { return typeof o$1; } : function(o$1) { return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1; }, _typeof(o); } //#endregion //#region \0@oxc-project+runtime@0.98.0/helpers/toPrimitive.js function toPrimitive(t$1, r$2) { if ("object" != _typeof(t$1) || !t$1) return t$1; var e$1 = t$1[Symbol.toPrimitive]; if (void 0 !== e$1) { var i$1 = e$1.call(t$1, r$2 || "default"); if ("object" != _typeof(i$1)) return i$1; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r$2 ? String : Number)(t$1); } //#endregion //#region \0@oxc-project+runtime@0.98.0/helpers/toPropertyKey.js function toPropertyKey(t$1) { var i$1 = toPrimitive(t$1, "string"); return "symbol" == _typeof(i$1) ? i$1 : i$1 + ""; } //#endregion //#region \0@oxc-project+runtime@0.98.0/helpers/defineProperty.js function _defineProperty(e$1, r$2, t$1) { return (r$2 = toPropertyKey(r$2)) in e$1 ? Object.defineProperty(e$1, r$2, { value: t$1, enumerable: !0, configurable: !0, writable: !0 }) : e$1[r$2] = t$1, e$1; } //#endregion //#region ../../node_modules/events/events.js var require_events = /* @__PURE__ */ __commonJS({ "../../node_modules/events/events.js": ((exports, module) => { var R = typeof Reflect === "object" ? Reflect : null; var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply$1(target, receiver, args) { return Function.prototype.apply.call(target, receiver, args); }; var ReflectOwnKeys; if (R && typeof R.ownKeys === "function") ReflectOwnKeys = R.ownKeys; else if (Object.getOwnPropertySymbols) ReflectOwnKeys = function ReflectOwnKeys$1(target) { return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); }; else ReflectOwnKeys = function ReflectOwnKeys$1(target) { return Object.getOwnPropertyNames(target); }; function ProcessEmitWarning(warning) { if (console && console.warn) console.warn(warning); } var NumberIsNaN = Number.isNaN || function NumberIsNaN$1(value) { return value !== value; }; function EventEmitter$1() { EventEmitter$1.init.call(this); } module.exports = EventEmitter$1; module.exports.once = once; EventEmitter$1.EventEmitter = EventEmitter$1; EventEmitter$1.prototype._events = void 0; EventEmitter$1.prototype._eventsCount = 0; EventEmitter$1.prototype._maxListeners = void 0; var defaultMaxListeners = 10; function checkListener(listener) { if (typeof listener !== "function") throw new TypeError("The \"listener\" argument must be of type Function. Received type " + typeof listener); } Object.defineProperty(EventEmitter$1, "defaultMaxListeners", { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) throw new RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + arg + "."); defaultMaxListeners = arg; } }); EventEmitter$1.init = function() { if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { this._events = Object.create(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || void 0; }; EventEmitter$1.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) throw new RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + n + "."); this._maxListeners = n; return this; }; function _getMaxListeners(that) { if (that._maxListeners === void 0) return EventEmitter$1.defaultMaxListeners; return that._maxListeners; } EventEmitter$1.prototype.getMaxListeners = function getMaxListeners() { return _getMaxListeners(this); }; EventEmitter$1.prototype.emit = function emit(type) { var args = []; for (var i$1 = 1; i$1 < arguments.length; i$1++) args.push(arguments[i$1]); var doError = type === "error"; var events = this._events; if (events !== void 0) doError = doError && events.error === void 0; else if (!doError) return false; if (doError) { var er; if (args.length > 0) er = args[0]; if (er instanceof Error) throw er; var err = /* @__PURE__ */ new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); err.context = er; throw err; } var handler = events[type]; if (handler === void 0) return false; if (typeof handler === "function") ReflectApply(handler, this, args); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i$1 = 0; i$1 < len; ++i$1) ReflectApply(listeners[i$1], this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; checkListener(listener); events = target._events; if (events === void 0) { events = target._events = Object.create(null); target._eventsCount = 0; } else { if (events.newListener !== void 0) { target.emit("newListener", type, listener.listener ? listener.listener : listener); events = target._events; } existing = events[type]; } if (existing === void 0) { existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === "function") existing = events[type] = prepend ? [listener, existing] : [existing, listener]; else if (prepend) existing.unshift(listener); else existing.push(listener); m = _getMaxListeners(target); if (m > 0 && existing.length > m && !existing.warned) { existing.warned = true; var w = /* @__PURE__ */ new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); w.name = "MaxListenersExceededWarning"; w.emitter = target; w.type = type; w.count = existing.length; ProcessEmitWarning(w); } } return target; } EventEmitter$1.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter$1.prototype.on = EventEmitter$1.prototype.addListener; EventEmitter$1.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; if (arguments.length === 0) return this.listener.call(this.target); return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: void 0, target, type, listener }; var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter$1.prototype.once = function once$1(type, listener) { checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter$1.prototype.prependOnceListener = function prependOnceListener(type, listener) { checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; EventEmitter$1.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i$1, originalListener; checkListener(listener); events = this._events; if (events === void 0) return this; list = events[type]; if (list === void 0) return this; if (list === listener || list.listener === listener) if (--this._eventsCount === 0) this._events = Object.create(null); else { delete events[type]; if (events.removeListener) this.emit("removeListener", type, list.listener || listener); } else if (typeof list !== "function") { position = -1; for (i$1 = list.length - 1; i$1 >= 0; i$1--) if (list[i$1] === listener || list[i$1].listener === listener) { originalListener = list[i$1].listener; position = i$1; break; } if (position < 0) return this; if (position === 0) list.shift(); else spliceOne(list, position); if (list.length === 1) events[type] = list[0]; if (events.removeListener !== void 0) this.emit("removeListener", type, originalListener || listener); } return this; }; EventEmitter$1.prototype.off = EventEmitter$1.prototype.removeListener; EventEmitter$1.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events = this._events, i$1; if (events === void 0) return this; if (events.removeListener === void 0) { if (arguments.length === 0) { this._events = Object.create(null); this._eventsCount = 0; } else if (events[type] !== void 0) if (--this._eventsCount === 0) this._events = Object.create(null); else delete events[type]; return this; } if (arguments.length === 0) { var keys$2 = Object.keys(events); var key; for (i$1 = 0; i$1 < keys$2.length; ++i$1) { key = keys$2[i$1]; if (key === "removeListener") continue; this.removeAllListeners(key); } this.removeAllListeners("removeListener"); this._events = Object.create(null); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === "function") this.removeListener(type, listeners); else if (listeners !== void 0) for (i$1 = listeners.length - 1; i$1 >= 0; i$1--) this.removeListener(type, listeners[i$1]); return this; }; function _listeners(target, type, unwrap) { var events = target._events; if (events === void 0) return []; var evlistener = events[type]; if (evlistener === void 0) return []; if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter$1.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter$1.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter$1.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === "function") return emitter.listenerCount(type); else return listenerCount.call(emitter, type); }; EventEmitter$1.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events !== void 0) { var evlistener = events[type]; if (typeof evlistener === "function") return 1; else if (evlistener !== void 0) return evlistener.length; } return 0; } EventEmitter$1.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; function arrayClone(arr, n) { var copy = new Array(n); for (var i$1 = 0; i$1 < n; ++i$1) copy[i$1] = arr[i$1]; return copy; } function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; list.pop(); } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i$1 = 0; i$1 < ret.length; ++i$1) ret[i$1] = arr[i$1].listener || arr[i$1]; return ret; } function once(emitter, name) { return new Promise(function(resolve$3, reject) { function errorListener(err) { emitter.removeListener(name, resolver); reject(err); } function resolver() { if (typeof emitter.removeListener === "function") emitter.removeListener("error", errorListener); resolve$3([].slice.call(arguments)); } eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); if (name !== "error") addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); }); } function addErrorHandlerIfEventEmitter(emitter, handler, flags) { if (typeof emitter.on === "function") eventTargetAgnosticAddListener(emitter, "error", handler, flags); } function eventTargetAgnosticAddListener(emitter, name, listener, flags) { if (typeof emitter.on === "function") if (flags.once) emitter.once(name, listener); else emitter.on(name, listener); else if (typeof emitter.addEventListener === "function") emitter.addEventListener(name, function wrapListener(arg) { if (flags.once) emitter.removeEventListener(name, wrapListener); listener(arg); }); else throw new TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof emitter); } }) }); //#endregion //#region src/shared/typed-emitter.ts var import_events = require_events(); var TypedEmitter = class { constructor() { _defineProperty(this, "_emitter", new import_events.EventEmitter()); } addListener(eventName, fn) { this._emitter.addListener(eventName, fn); } on(eventName, fn) { this._emitter.on(eventName, fn); } off(eventName, fn) { this._emitter.off(eventName, fn); } removeListener(eventName, fn) { this._emitter.removeListener(eventName, fn); } emit(eventName, ...params) { this._emitter.emit(eventName, ...params); } once(eventName, fn) { this._emitter.once(eventName, fn); } setMaxListeners(max$2) { this._emitter.setMaxListeners(max$2); } listenerCount(eventName) { return this._emitter.listenerCount(eventName); } listeners(eventName) { return this._emitter.listeners(eventName); } }; //#endregion //#region package.json var require_package = /* @__PURE__ */ __commonJS({ "package.json": ((exports, module) => { module.exports = { "name": "nodecg", "version": "2.8.0", "description": "Dynamic broadcast graphics rendered in a browser", "keywords": [ "graphics", "nodecg", "node", "dynamic", "broadcast" ], "homepage": "https://nodecg.dev/", "bugs": "https://github.com/nodecg/nodecg/issues", "repository": { "type": "git", "url": "git+https://github.com/nodecg/nodecg.git", "directory": "workspaces/nodecg" }, "license": "MIT", "type": "commonjs", "exports": { ".": "./dist/server/bootstrap.js", "./types": { "types": "./types/index.d.ts" }, "./types/augment-window": { "types": "./types/augment-window.d.ts" } }, "main": "./dist/server/bootstrap.js", "bin": { "nodecg": "./cli.mjs" }, "files": [ "dist", "schemas", "src", "types", "cli.mjs", "index.js" ], "scripts": { "build": "tsdown", "start": "node index.js", "test": "vitest", "typetest": "cd typetest/fake-bundle && npm run build", "watch": "tsdown --watch" }, "dependencies": { "@effect/opentelemetry": "^0.59.1", "@effect/platform": "^0.93.1", "@effect/platform-node": "^0.100.0", "@nodecg/cli": "2.8.0", "@nodecg/database-adapter-sqlite-legacy": "2.7.2", "@nodecg/database-adapter-types": "2.7.0", "@nodecg/internal-util": "2.7.2", "@nodecg/json-schema-defaults": "^1.0.4", "@nodecg/json-schema-lib": "0.1.0", "@open-iframe-resizer/core": "^1.6.0", "@opentelemetry/sdk-logs": "^0.203.0", "@opentelemetry/sdk-metrics": "^2.2.0", "@opentelemetry/sdk-trace-node": "^2.2.0", "@polymer/app-layout": "^3.1.0", "@polymer/app-route": "^3.0.2", "@polymer/iron-collapse": "^3.0.1", "@polymer/iron-flex-layout": "^3.0.1", "@polymer/iron-icons": "^3.0.1", "@polymer/iron-image": "^3.0.2", "@polymer/iron-localstorage": "^3.0.1", "@polymer/iron-pages": "^3.0.1", "@polymer/iron-selector": "^3.0.1", "@polymer/paper-button": "^3.0.1", "@polymer/paper-card": "^3.0.1", "@polymer/paper-dialog": "^3.0.1", "@polymer/paper-dialog-behavior": "^3.0.1", "@polymer/paper-dialog-scrollable": "^3.0.1", "@polymer/paper-icon-button": "^3.0.2", "@polymer/paper-item": "^3.0.1", "@polymer/paper-slider": "^3.0.1", "@polymer/paper-spinner": "^3.0.2", "@polymer/paper-styles": "^3.0.1", "@polymer/paper-tabs": "^3.1.0", "@polymer/paper-toast": "^3.0.1", "@polymer/paper-toolbar": "^3.0.1", "@polymer/polymer": "^3.5.1", "@sentry/browser": "^7.91.0", "@sentry/node": "^7.91.0", "@types/cookie-parser": "^1.4.6", "@types/express-session": "^1.17.10", "@types/multer": "^1.4.11", "@types/node": "^20.19.0", "@types/passport": "^1.0.16", "@types/soundjs": "^0.6.31", "@vaadin/vaadin-upload": "^4.4.3", "@webcomponents/webcomponentsjs": "^2.8.0", "ajv": "^8.17.1", "ajv-draft-04": "^1.0.0", "ajv-formats": "^2.1.1", "body-parser": "^1.20.2", "cheerio": "1.0.0-rc.12", "chokidar": "^4.0.3", "clipboard": "^2.0.11", "compression": "^1.7.4", "cookie-parser": "^1.4.6", "cookies-js": "^1.2.3", "cosmiconfig": "^8.3.6", "draggabilly": "^2.4.1", "effect": "^3.19.3", "events": "^3.3.0", "express": "^4.18.2", "express-session": "^1.17.3", "express-transform-bare-module-specifiers": "^1.0.4", "extend": "^3.0.2", "fast-equals": "^5.0.1", "fast-memoize": "^2.5.2", "fp-ts": "^2.16.9", "git-rev-sync": "^3.0.2", "hasha": "^5.2.2", "httpolyglot": "^0.1.2", "is-error": "^2.2.2", "isomorphic-git": "^1.35.1", "json-ptr": "^3.1.1", "klona": "^2.0.6", "lodash": "^4.17.21", "multer": "^1.4.5-lts.1", "nano-spawn": "^0.2.0", "object-path": "^0.11.8", "packery": "^3.0.0", "passport": "^0.6.0", "passport-discord": "^0.1.4", "passport-local": "^1.0.0", "passport-steam": "^1.0.18", "passport-twitch-helix": "^1.1.0", "process": "^0.11.10", "semver": "^7.6.3", "serialize-error": "^8.1.0", "socket.io": "^4.8.1", "socket.io-client": "^4.8.1", "soundjs": "^1.0.1", "ts-essentials": "^9.4.1", "type-fest": "^5.2.0", "util": "^0.12.5", "winston": "^3.11.0", "yargs": "^15.4.1", "zod": "^3.22.4" }, "devDependencies": { "@types/compression": "^1.7.5", "@types/express": "^4.17.21", "@types/extend": "^3.0.4", "@types/git-rev-sync": "^2.0.2", "@types/is-ci": "^3.0.4", "@types/lodash": "^4.17.13", "@types/object-path": "^0.11.4", "@types/passport-discord": "^0.1.14", "@types/passport-local": "^1.0.38", "@types/passport-steam": "^1.0.5", "@types/semver": "^7.5.8", "@types/yargs": "^15.0.19", "is-ci": "^3.0.1", "npm-run-all2": "^7.0.2", "onchange": "^7.1.0", "puppeteer": "^25.1.0", "tinyglobby": "^0.2.15", "tsdown": "^0.16.6", "tsx": "^4.19.2", "typescript": "~5.9.3", "vitest-mock-express": "^2.2.0" }, "publishConfig": { "access": "public", "provenance": true, "registry": "https://registry.npmjs.org" } }; }) }); //#endregion //#region src/shared/api.base.ts const { version } = require_package(); var NodeCGAPIBase = class extends TypedEmitter { /** * Lets you easily wait for a group of Replicants to finish declaring. * * Returns a promise which is resolved once all provided Replicants * have emitted a `change` event, which is indicates that they must * have finished declaring. * * This method is only useful in client-side code. * Server-side code never has to wait for Replicants. * * @param replicants {Replicant} * @returns {Promise<any>} * * @example <caption>From a graphic or dashboard panel:</caption> * const rep1 = nodecg.Replicant('rep1'); * const rep2 = nodecg.Replicant('rep2'); * * // You can provide as many Replicant arguments as you want, * // this example just uses two Replicants. * NodeCG.waitForReplicants(rep1, rep2).then(() => { * console.log('rep1 and rep2 are fully declared and ready to use!'); * }); */ static async waitForReplicants(...replicants) { return new Promise((resolve$3) => { const numReplicants = replicants.length; let declaredReplicants$1 = 0; replicants.forEach((replicant) => { replicant.once("change", () => { declaredReplicants$1++; if (declaredReplicants$1 >= numReplicants) resolve$3(); }); }); }); } constructor(bundle) { super(); _defineProperty(this, "bundleName", void 0); _defineProperty(this, "bundleConfig", void 0); _defineProperty(this, "bundleVersion", void 0); _defineProperty(this, "bundleGit", void 0); _defineProperty(this, "_messageHandlers", []); this.bundleName = bundle.name; this.bundleConfig = bundle.config; this.bundleVersion = bundle.version; this.bundleGit = bundle.git; } listenFor(messageName, bundleNameOrHandlerFunc, handlerFunc) { let bundleName; if (typeof bundleNameOrHandlerFunc === "string") bundleName = bundleNameOrHandlerFunc; else { bundleName = this.bundleName; handlerFunc = bundleNameOrHandlerFunc; } if (typeof handlerFunc !== "function") throw new Error(`argument "handler" must be a function, but you provided a(n) ${typeof handlerFunc}`); this.log.trace("Listening for %s from bundle %s", messageName, bundleNameOrHandlerFunc); this._messageHandlers.push({ messageName, bundleName, func: handlerFunc }); } unlisten(messageName, bundleNameOrHandler, maybeHandler) { let { bundleName } = this; let handlerFunc = maybeHandler; if (typeof bundleNameOrHandler === "string") bundleName = bundleNameOrHandler; else handlerFunc = bundleNameOrHandler; if (typeof handlerFunc !== "function") throw new Error(`argument "handler" must be a function, but you provided a(n) ${typeof handlerFunc}`); this.log.trace("[%s] Removing listener for %s from bundle %s", this.bundleName, messageName, bundleName); const index = this._messageHandlers.findIndex((handler) => handler.messageName === messageName && handler.bundleName === bundleName && handler.func === handlerFunc); if (index >= 0) { this._messageHandlers.splice(index, 1); return true; } return false; } Replicant(name, namespaceOrOpts, opts) { let namespace; if (typeof namespaceOrOpts === "string") namespace = namespaceOrOpts; else namespace = this.bundleName; if (typeof namespaceOrOpts !== "string") opts = namespaceOrOpts; opts = opts ?? {}; return this._replicantFactory(name, namespace, opts); } }; _defineProperty(NodeCGAPIBase, "version", version); _defineProperty(NodeCGAPIBase, "declaredReplicants", void 0); //#endregion //#region src/client/api/config.ts const filteredConfig = globalThis.ncgConfig; //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/is.js const objectToString$4 = Object.prototype.toString; /** * Checks whether given value's type is one of a few Error or Error-like * {@link isError}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isError$4(wat) { switch (objectToString$4.call(wat)) { case "[object Error]": case "[object Exception]": case "[object DOMException]": return true; default: return isInstanceOf$3(wat, Error); } } /** * Checks whether given value is an instance of the given built-in class. * * @param wat The value to be checked * @param className * @returns A boolean representing the result. */ function isBuiltin$3(wat, className) { return objectToString$4.call(wat) === `[object ${className}]`; } /** * Checks whether given value's type is ErrorEvent * {@link isErrorEvent}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isErrorEvent$1(wat) { return isBuiltin$3(wat, "ErrorEvent"); } /** * Checks whether given value's type is DOMError * {@link isDOMError}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isDOMError(wat) { return isBuiltin$3(wat, "DOMError"); } /** * Checks whether given value's type is DOMException * {@link isDOMException}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isDOMException(wat) { return isBuiltin$3(wat, "DOMException"); } /** * Checks whether given value's type is a string * {@link isString}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isString$4(wat) { return isBuiltin$3(wat, "String"); } /** * Checks whether given string is parameterized * {@link isParameterizedString}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isParameterizedString(wat) { return typeof wat === "object" && wat !== null && "__sentry_template_string__" in wat && "__sentry_template_values__" in wat; } /** * Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol) * {@link isPrimitive}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isPrimitive$4(wat) { return wat === null || isParameterizedString(wat) || typeof wat !== "object" && typeof wat !== "function"; } /** * Checks whether given value's type is an object literal, or a class instance. * {@link isPlainObject}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isPlainObject$3(wat) { return isBuiltin$3(wat, "Object"); } /** * Checks whether given value's type is an Event instance * {@link isEvent}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isEvent$3(wat) { return typeof Event !== "undefined" && isInstanceOf$3(wat, Event); } /** * Checks whether given value's type is an Element instance * {@link isElement}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isElement$4(wat) { return typeof Element !== "undefined" && isInstanceOf$3(wat, Element); } /** * Checks whether given value's type is an regexp * {@link isRegExp}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isRegExp$3(wat) { return isBuiltin$3(wat, "RegExp"); } /** * Checks whether given value has a then function. * @param wat A value to be checked. */ function isThenable$3(wat) { return Boolean(wat && wat.then && typeof wat.then === "function"); } /** * Checks whether given value's type is a SyntheticEvent * {@link isSyntheticEvent}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isSyntheticEvent$3(wat) { return isPlainObject$3(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat; } /** * Checks whether given value is NaN * {@link isNaN}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isNaN$4(wat) { return typeof wat === "number" && wat !== wat; } /** * Checks whether given value's type is an instance of provided constructor. * {@link isInstanceOf}. * * @param wat A value to be checked. * @param base A constructor to be used in a check. * @returns A boolean representing the result. */ function isInstanceOf$3(wat, base) { try { return wat instanceof base; } catch (_e) { return false; } } /** * Checks whether given value's type is a Vue ViewModel. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isVueViewModel$3(wat) { return !!(typeof wat === "object" && wat !== null && (wat.__isVue || wat._isVue)); } //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/string.js /** * Truncates given string to the maximum characters count * * @param str An object that contains serializable values * @param max Maximum number of characters in truncated string (0 = unlimited) * @returns string Encoded */ function truncate$2(str$1, max$2 = 0) { if (typeof str$1 !== "string" || max$2 === 0) return str$1; return str$1.length <= max$2 ? str$1 : `${str$1.slice(0, max$2)}...`; } /** * Join values in array * @param input array of values to be joined together * @param delimiter string to be placed in-between values * @returns Joined values */ function safeJoin$1(input, delimiter) { if (!Array.isArray(input)) return ""; const output = []; for (let i$1 = 0; i$1 < input.length; i$1++) { const value = input[i$1]; try { if (isVueViewModel$3(value)) output.push("[VueViewModel]"); else output.push(String(value)); } catch (e$1) { output.push("[value cannot be serialized]"); } } return output.join(delimiter); } /** * Checks if the given value matches a regex or string * * @param value The string to test * @param pattern Either a regex or a string against which `value` will be matched * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match * `pattern` if it contains `pattern`. Only applies to string-type patterns. */ function isMatchingPattern$1(value, pattern, requireExactStringMatch = false) { if (!isString$4(value)) return false; if (isRegExp$3(pattern)) return pattern.test(value); if (isString$4(pattern)) return requireExactStringMatch ? value === pattern : value.includes(pattern); return false; } /** * Test the given string against an array of strings and regexes. By default, string matching is done on a * substring-inclusion basis rather than a strict equality basis * * @param testString The string to test * @param patterns The patterns against which to test the string * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to * count. If false, `testString` will match a string pattern if it contains that pattern. * @returns */ function stringMatchesSomePattern$1(testString, patterns = [], requireExactStringMatch = false) { return patterns.some((pattern) => isMatchingPattern$1(testString, pattern, requireExactStringMatch)); } //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/aggregate-errors.js /** * Creates exceptions inside `event.exception.values` for errors that are nested on properties based on the `key` parameter. */ function applyAggregateErrorsToEvent(exceptionFromErrorImplementation, parser, maxValueLimit = 250, key, limit, event, hint) { if (!event.exception || !event.exception.values || !hint || !isInstanceOf$3(hint.originalException, Error)) return; const originalException = event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : void 0; if (originalException) event.exception.values = truncateAggregateExceptions(aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, hint.originalException, key, event.exception.values, originalException, 0), maxValueLimit); } function aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error$1, key, prevExceptions, exception, exceptionId) { if (prevExceptions.length >= limit + 1) return prevExceptions; let newExceptions = [...prevExceptions]; if (isInstanceOf$3(error$1[key], Error)) { applyExceptionGroupFieldsForParentException(exception, exceptionId); const newException = exceptionFromErrorImplementation(parser, error$1[key]); const newExceptionId = newExceptions.length; applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId); newExceptions = aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error$1[key], key, [newException, ...newExceptions], newException, newExceptionId); } if (Array.isArray(error$1.errors)) error$1.errors.forEach((childError, i$1) => { if (isInstanceOf$3(childError, Error)) { applyExceptionGroupFieldsForParentException(exception, exceptionId); const newException = exceptionFromErrorImplementation(parser, childError); const newExceptionId = newExceptions.length; applyExceptionGroupFieldsForChildException(newException, `errors[${i$1}]`, newExceptionId, exceptionId); newExceptions = aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, childError, key, [newException, ...newExceptions], newException, newExceptionId); } }); return newExceptions; } function applyExceptionGroupFieldsForParentException(exception, exceptionId) { exception.mechanism = exception.mechanism || { type: "generic", handled: true }; exception.mechanism = { ...exception.mechanism, ...exception.type === "AggregateError" && { is_exception_group: true }, exception_id: exceptionId }; } function applyExceptionGroupFieldsForChildException(exception, source, exceptionId, parentId) { exception.mechanism = exception.mechanism || { type: "generic", handled: true }; exception.mechanism = { ...exception.mechanism, type: "chained", source, exception_id: exceptionId, parent_id: parentId }; } /** * Truncate the message (exception.value) of all exceptions in the event. * Because this event processor is ran after `applyClientOptions`, * we need to truncate the message of the added exceptions here. */ function truncateAggregateExceptions(exceptions, maxValueLength) { return exceptions.map((exception) => { if (exception.value) exception.value = truncate$2(exception.value, maxValueLength); return exception; }); } //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/worldwide.js /** Internal global with common properties and Sentry extensions */ /** Returns 'obj' if it's the global object, otherwise returns undefined */ function isGlobalObj$3(obj) { return obj && obj.Math == Math ? obj : void 0; } /** Get's the global object for the current JavaScript runtime */ const GLOBAL_OBJ = typeof globalThis == "object" && isGlobalObj$3(globalThis) || typeof window == "object" && isGlobalObj$3(window) || typeof self == "object" && isGlobalObj$3(self) || typeof global == "object" && isGlobalObj$3(global) || (function() { return this; })() || {}; /** * @deprecated Use GLOBAL_OBJ instead or WINDOW from @sentry/browser. This will be removed in v8 */ function getGlobalObject$3() { return GLOBAL_OBJ; } /** * Returns a global singleton contained in the global `__SENTRY__` object. * * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory * function and added to the `__SENTRY__` object. * * @param name name of the global singleton on __SENTRY__ * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__` * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value * @returns the singleton */ function getGlobalSingleton$3(name, creator, obj) { const gbl = obj || GLOBAL_OBJ; const __SENTRY__ = gbl.__SENTRY__ = gbl.__SENTRY__ || {}; return __SENTRY__[name] || (__SENTRY__[name] = creator()); } //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/browser.js const WINDOW$22 = getGlobalObject$3(); const DEFAULT_MAX_STRING_LENGTH$3 = 80; /** * Given a child DOM element, returns a query-selector statement describing that * and its ancestors * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz] * @returns generated DOM path */ function htmlTreeAsString$3(elem, options$1 = {}) { if (!elem) return "<unknown>"; try { let currentElem = elem; const MAX_TRAVERSE_HEIGHT = 5; const out = []; let height = 0; let len = 0; const separator = " > "; const sepLength = 3; let nextStr; const keyAttrs = Array.isArray(options$1) ? options$1 : options$1.keyAttrs; const maxStringLength = !Array.isArray(options$1) && options$1.maxStringLength || DEFAULT_MAX_STRING_LENGTH$3; while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) { nextStr = _htmlElementAsString$3(currentElem, keyAttrs); if (nextStr === "html" || height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength) break; out.push(nextStr); len += nextStr.length; currentElem = currentElem.parentNode; } return out.reverse().join(separator); } catch (_oO) { return "<unknown>"; } } /** * Returns a simple, query-selector representation of a DOM element * e.g. [HTMLElement] => input#foo.btn[name=baz] * @returns generated DOM path */ function _htmlElementAsString$3(el, keyAttrs) { const elem = el; const out = []; let className; let classes; let key; let attr; let i$1; if (!elem || !elem.tagName) return ""; if (WINDOW$22.HTMLElement) { if (elem instanceof HTMLElement && elem.dataset && elem.dataset["sentryComponent"]) return elem.dataset["sentryComponent"]; } out.push(elem.tagName.toLowerCase()); const keyAttrPairs = keyAttrs && keyAttrs.length ? keyAttrs.filter((keyAttr) => elem.getAttribute(keyAttr)).map((keyAttr) => [keyAttr, elem.getAttribute(keyAttr)]) : null; if (keyAttrPairs && keyAttrPairs.length) keyAttrPairs.forEach((keyAttrPair) => { out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`); }); else { if (elem.id) out.push(`#${elem.id}`); className = elem.className; if (className && isString$4(className)) { classes = className.split(/\s+/); for (i$1 = 0; i$1 < classes.length; i$1++) out.push(`.${classes[i$1]}`); } } const allowedAttrs = [ "aria-label", "type", "name", "title", "alt" ]; for (i$1 = 0; i$1 < allowedAttrs.length; i$1++) { key = allowedAttrs[i$1]; attr = elem.getAttribute(key); if (attr) out.push(`[${key}="${attr}"]`); } return out.join(""); } /** * A safe form of location.href */ function getLocationHref$1() { try { return WINDOW$22.document.location.href; } catch (oO) { return ""; } } /** * Gets a DOM element by using document.querySelector. * * This wrapper will first check for the existance of the function before * actually calling it so that we don't have to take care of this check, * every time we want to access the DOM. * * Reason: DOM/querySelector is not available in all environments. * * We have to cast to any because utils can be consumed by a variety of environments, * and we don't want to break TS users. If you know what element will be selected by * `document.querySelector`, specify it as part of the generic call. For example, * `const element = getDomElement<Element>('selector');` * * @param selector the selector string passed on to document.querySelector */ function getDomElement(selector) { if (WINDOW$22.document && WINDOW$22.document.querySelector) return WINDOW$22.document.querySelector(selector); return null; } /** * Given a DOM element, traverses up the tree until it finds the first ancestor node * that has the `data-sentry-component` attribute. This attribute is added at build-time * by projects that have the component name annotation plugin installed. * * @returns a string representation of the component for the provided DOM element, or `null` if not found */ function getComponentName(elem) { if (!WINDOW$22.HTMLElement) return null; let currentElem = elem; const MAX_TRAVERSE_HEIGHT = 5; for (let i$1 = 0; i$1 < MAX_TRAVERSE_HEIGHT; i$1++) { if (!currentElem) return null; if (currentElem instanceof HTMLElement && currentElem.dataset["sentryComponent"]) return currentElem.dataset["sentryComponent"]; currentElem = currentElem.parentNode; } return null; } //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/debug-build.js /** * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code. * * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking. */ const DEBUG_BUILD$13 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/logger.js /** Prefix for logging strings */ const PREFIX$3 = "Sentry Logger "; const CONSOLE_LEVELS$3 = [ "debug", "info", "warn", "error", "log", "assert", "trace" ]; /** This may be mutated by the console instrumentation. */ const originalConsoleMethods$3 = {}; /** JSDoc */ /** * Temporarily disable sentry console instrumentations. * * @param callback The function to run against the original `console` messages * @returns The results of the callback */ function consoleSandbox$3(callback) { if (!("console" in GLOBAL_OBJ)) return callback(); const console$1 = GLOBAL_OBJ.console; const wrappedFuncs = {}; const wrappedLevels = Object.keys(originalConsoleMethods$3); wrappedLevels.forEach((level) => { const originalConsoleMethod = originalConsoleMethods$3[level]; wrappedFuncs[level] = console$1[level]; console$1[level] = originalConsoleMethod; }); try { return callback(); } finally { wrappedLevels.forEach((level) => { console$1[level] = wrappedFuncs[level]; }); } } function makeLogger$3() { let enabled = false; const logger$4 = { enable: () => { enabled = true; }, disable: () => { enabled = false; }, isEnabled: () => enabled }; if (DEBUG_BUILD$13) CONSOLE_LEVELS$3.forEach((name) => { logger$4[name] = (...args) => { if (enabled) consoleSandbox$3(() => { GLOBAL_OBJ.console[name](`${PREFIX$3}[${name}]:`, ...args); }); }; }); else CONSOLE_LEVELS$3.forEach((name) => { logger$4[name] = () => void 0; }); return logger$4; } const logger = makeLogger$3(); //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/dsn.js /** Regular expression used to parse a Dsn. */ const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/; function isValidProtocol(protocol) { return protocol === "http" || protocol === "https"; } /** * Renders the string representation of this Dsn. * * By default, this will render the public representation without the password * component. To get the deprecated private representation, set `withPassword` * to true. * * @param withPassword When set to true, the password will be included. */ function dsnToString$2(dsn, withPassword = false) { const { host, path, pass, port, projectId, protocol, publicKey } = dsn; return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${path ? `${path}/` : path}${projectId}`; } /** * Parses a Dsn from a given string. * * @param str A Dsn as string * @returns Dsn as DsnComponents or undefined if @param str is not a valid DSN string */ function dsnFromString(str$1) { const match = DSN_REGEX.exec(str$1); if (!match) { consoleSandbox$3(() => { console.error(`Invalid Sentry Dsn: ${str$1}`); }); return; } const [protocol, publicKey, pass = "", host, port = "", lastPath] = match.slice(1); let path = ""; let projectId = lastPath; const split = projectId.split("/"); if (split.length > 1) { path = split.slice(0, -1).join("/"); projectId = split.pop(); } if (projectId) { const projectMatch = projectId.match(/^\d+/); if (projectMatch) projectId = projectMatch[0]; } return dsnFromComponents({ host, pass, path, projectId, port, protocol, publicKey }); } function dsnFromComponents(components) { return { protocol: components.protocol, publicKey: components.publicKey || "", pass: components.pass || "", host: components.host, port: components.port || "", path: components.path || "", projectId: components.projectId }; } function validateDsn(dsn) { if (!DEBUG_BUILD$13) return true; const { port, projectId, protocol } = dsn; if ([ "protocol", "publicKey", "host", "projectId" ].find((component) => { if (!dsn[component]) { logger.error(`Invalid Sentry Dsn: ${component} missing`); return true; } return false; })) return false; if (!projectId.match(/^\d+$/)) { logger.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`); return false; } if (!isValidProtocol(protocol)) { logger.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`); return false; } if (port && isNaN(parseInt(port, 10))) { logger.error(`Invalid Sentry Dsn: Invalid port ${port}`); return false; } return true; } /** * Creates a valid Sentry Dsn object, identifying a Sentry instance and project. * @returns a valid DsnComponents object or `undefined` if @param from is an invalid DSN source */ function makeDsn(from) { const components = typeof from === "string" ? dsnFromString(from) : dsnFromComponents(from); if (!components || !validateDsn(components)) return; return components; } //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/error.js /** An error emitted by Sentry SDKs and related utilities. */ var SentryError = class extends Error { /** Display name of this error instance. */ constructor(message, logLevel = "warn") { super(message); this.message = message; this.name = new.target.prototype.constructor.name; Object.setPrototypeOf(this, new.target.prototype); this.logLevel = logLevel; } }; //#endregion //#region ../../node_modules/@sentry/browser/node_modules/@sentry/utils/esm/object.js /** * Replace a method in an object with a wrapped version of itself. * * @param source An object that contains a method to be wrapped. * @param name The name of the method to be wrapped. * @param replacementFactory A higher-order function that takes the original version of the given method and returns a * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, <other * args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`. * @returns void */ function fill$2(source, name, replacementFactory) { if (!(name in source)) return; const original = source[name]; const wrapped = replacementFactory(original); if (typeof wrapped === "function") markFunctionWrapped$2(wrapped, original); source[name] = wrapped; } /** * Defines a non-enumerable property on the given object. * * @param obj The object on which to set the property * @param name The name of the property to be set * @param value The value to which to set the property */ function addNonEnumerableProperty$2(obj, name, value) { try { Object.defineProperty(obj, name, { value, writable: true, configurable: true }); } catch (o_O) { DEBUG_BUILD$13 && logger.log(`Failed to add non-enumerable property "${name}" to object`, obj); } } /** * Remembers the original function on the wrapped function and * patches up the prototype. * * @param wrapped the wrapper function * @param original the original function that gets wrapped */ function markFunctionWrapped$2(wrapped, original) { try { wrapped.prototype = original.prototype = original.prototype || {}; addNonEnumerableProperty$2(wrapped, "__sentry_original__", original); } catch (o_O) {} } /** * This extracts the original function if available. See * `markFunctionWrapped` for more information. * * @param func the function to unwrap * @returns the unwrapped version of the function if available. */ function getOriginalFunction(func) { return func.__sentry_original__; } /** * Encodes given object into url-friendly format * * @param object An object that contains serializable values * @returns string Encoded */ function urlEncode(object) { return Object.keys(object).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`).join("&"); } /** * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their * non-enumerable properties attached. * * @param value Initial source that we have to transform in order for it to be usable by the serializ