From 91eedf897967c99f9059d67c5792bc23d6d61e8b Mon Sep 17 00:00:00 2001 From: zhuzhuor Date: Fri, 1 Jul 2022 23:40:06 -0700 Subject: [PATCH] 1. Fianlly make the HTTP header modifying work (after fighting with an obscure undocumented API issue) 2. Add Sentry lib to capture potential crash reports (but can only used on options.html and popup.html) --- manifest.json | 4 +- src/background.mjs | 17 ------ src/modules/_header.mjs | 80 +++++++++++++++----------- src/modules/_proxy.mjs | 26 ++++++--- src/modules/_storage.mjs | 14 +++++ src/modules/crash_report.mjs | 17 ++++++ src/modules/settings.mjs | 50 ++++++++-------- src/options.html | 1 + src/options.mjs | 5 +- src/popup.html | 1 + src/popup.mjs | 3 +- src/service_worker.mjs | 36 ++++++++++++ src/third_party/js/README.md | 5 ++ src/third_party/js/checksum.sha256 | 3 + src/third_party/js/sentry-7.4.1.min.js | 3 + 15 files changed, 172 insertions(+), 93 deletions(-) delete mode 100644 src/background.mjs create mode 100644 src/modules/crash_report.mjs create mode 100644 src/service_worker.mjs create mode 100644 src/third_party/js/README.md create mode 100644 src/third_party/js/checksum.sha256 create mode 100644 src/third_party/js/sentry-7.4.1.min.js diff --git a/manifest.json b/manifest.json index e649908..b4c2c63 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Unblock Youku", "version": "4.0.0", "manifest_version": 3, - "minimum_chrome_version": "96.0", + "minimum_chrome_version": "103.0", "default_locale": "en", "description": "__MSG_description__", "icons": { @@ -20,7 +20,7 @@ "https://*/*" ], "background": { - "service_worker": "src/background.mjs", + "service_worker": "src/service_worker.mjs", "type": "module" }, "action": { diff --git a/src/background.mjs b/src/background.mjs deleted file mode 100644 index cd3a463..0000000 --- a/src/background.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import * as Settings from './modules/settings.mjs'; - - -chrome.runtime.onInstalled.addListener(function(details) { - if (details.reason === 'install') { - chrome.tabs.create({ - url: chrome.i18n.getMessage('donation_url'), - }); - } -}); - - -console.group('To intialize the extension...'); -Settings.loadCurrentSettings().then(() => { - console.log('Successfully initialized the chrome extension'); - console.groupEnd(); -}); diff --git a/src/modules/_header.mjs b/src/modules/_header.mjs index f869e15..bbf0f38 100644 --- a/src/modules/_header.mjs +++ b/src/modules/_header.mjs @@ -3,8 +3,10 @@ */ +import {HEADER_URLS} from '../configs/urls.mjs'; + + function newRandomIp() { - 'use strict'; let ipAddr = '220.181.111.'; // ipAddr += Math.floor(Math.random() * 255) + '.'; ipAddr += Math.floor(Math.random() * 254 + 1); // 1 ~ 254 @@ -12,46 +14,54 @@ function newRandomIp() { } const RANDOM_IP = newRandomIp(); -// TODO: Store in local storage, and change everytime the chrome is restarted. - -function headerModifier(details) { - console.log('modify headers of ' + details.url); - - details.requestHeaders.push({ - name: 'X-Forwarded-For', - value: RANDOM_IP, - }, { - name: 'Client-IP', - value: RANDOM_IP, - }); - return {requestHeaders: details.requestHeaders}; -} +// The header modifying rules may be applied to the following types of requests +const RESOURCE_TYPES = [ + 'main_frame', 'sub_frame', 'script', 'object', 'xmlhttprequest', 'media', 'websocket', 'other']; +export async function setHeaderModifier() { + // Alway clear the existing rules (if there are any) before apply new rules again. + // Otherwise the rule IDs may be duplicated and cause exceptions. + await clearHeaderModifier(); -export function setHeaderModifier() { - if (!chrome.webRequest.onBeforeSendHeaders.hasListener(headerModifier)) { - // TODO: Fix this - // chrome.webRequest.onBeforeSendHeaders.addListener( - // headerModifier, - // { - // urls: unblock_youku.header_urls, - // }, - // ['requestHeaders', 'blocking'], - // ); - console.log('header_modifier is successfully set'); - } else { - console.error('header modifer is already there! So didn\'t set it again.'); + const rules = []; + for (let i = 0; i < HEADER_URLS.length; i++) { + const url = HEADER_URLS[i]; + rules.push({ + 'id': i + 1, // id has to be larger than 0 and unique + 'priority': 10, + 'condition': { + urlFilter: url, + // Perhaps it is a bug in Chrome's declarativeNetRequest API: + // Although reousrceTypes is an optional parameter, without setting it, + // the rule will not be applied at all. + resourceTypes: RESOURCE_TYPES, + }, + 'action': { + type: 'modifyHeaders', + requestHeaders: [{ + header: 'X-Forwarded-For', + operation: 'set', + value: RANDOM_IP, + }], + }, + }); } + + await chrome.declarativeNetRequest.updateDynamicRules({ + addRules: rules, + }); + console.log('Successfully set header modifying rules'); } -export function clearHeaderModifier() { - if (chrome.webRequest.onBeforeSendHeaders.hasListener(headerModifier)) { - chrome.webRequest.onBeforeSendHeaders.removeListener(headerModifier); - console.log('header modifier is removed'); - } else { - console.error('header modifier is not there!'); - } +export async function clearHeaderModifier() { + const enabledRules = await chrome.declarativeNetRequest.getDynamicRules(); + const enabledRuleIds = enabledRules.map((rule) => rule.id); + console.log('Clearing header modifying rules with IDs: ' + enabledRuleIds); + await chrome.declarativeNetRequest.updateDynamicRules({ + removeRuleIds: enabledRuleIds, + }); + console.log('Successfully cleared header modifying rules'); } diff --git a/src/modules/_proxy.mjs b/src/modules/_proxy.mjs index 24a5eab..c5eecd3 100644 --- a/src/modules/_proxy.mjs +++ b/src/modules/_proxy.mjs @@ -12,16 +12,16 @@ import {urls2pac} from './_url_utils.mjs'; async function setPacScript( defaultProxyProtocol, defaultProxyAddress, backupProxyProtocol, backupProxyAddress) { - console.log('To set up proxy...'); + console.log('To generate and set the PAC script'); const pacScript = urls2pac( PROXY_BYPASS_URLS, PROXY_URLS, defaultProxyProtocol, defaultProxyAddress, backupProxyProtocol, backupProxyAddress); - console.groupCollapsed('Printing PAC script content...'); - console.log(pacScript); - console.groupEnd(); + // console.groupCollapsed('Printing PAC script content...'); + // console.log(pacScript); + // console.groupEnd(); await chrome.proxy.settings.set({ value: { @@ -33,7 +33,7 @@ async function setPacScript( scope: 'regular', }); console.log( - 'Successfully set the proxy server: ' + defaultProxyProtocol + ' ' + defaultProxyAddress); + 'Successfully set the PAC script with: ' + defaultProxyProtocol + ' ' + defaultProxyAddress); } @@ -63,7 +63,15 @@ export async function clearProxy() { } -chrome.proxy.onProxyError.addListener(function(details) { - console.error('Received errors from onProxyError:'); - console.error(details); -}); +function logProxyError(details) { + console.error('Received errors from onProxyError:\n' + JSON.stringify(details, null, 2)); +} + +console.log('Setting up proxy.onProxyError listener for debugging purposes'); +// NOTE: Need to first check if the listener is already set; otherwise +// service_worker.mjs, popup.mjs, and options.mjs may set it multiple times +if (chrome.proxy.onProxyError.hasListener(logProxyError)) { + console.log('The proxy.onProxyError listener is already set, so it won\'t be set again'); +} else { + chrome.proxy.onProxyError.addListener(logProxyError); +} diff --git a/src/modules/_storage.mjs b/src/modules/_storage.mjs index 9b8ff83..95d64f3 100644 --- a/src/modules/_storage.mjs +++ b/src/modules/_storage.mjs @@ -23,3 +23,17 @@ export function setItem(key, value) { export function removeItem(key) { return chrome.storage.sync.remove(key); } + + +function storageChangeMonitor(changes, area) { + console.log('Storage changed for the area "' + area + '": ' + JSON.stringify(changes)); +} + +console.log('Setting up storage.onChanged listener for debugging purposes'); +// NOTE: Need to first check if the listener is already set; otherwise +// service_worker.mjs, popup.mjs, and options.mjs may set it multiple times +if (chrome.storage.onChanged.hasListener(storageChangeMonitor)) { + console.log('The storage.onChanged listener is already set, so it won\'t be set again'); +} else { + chrome.storage.onChanged.addListener(storageChangeMonitor); +} diff --git a/src/modules/crash_report.mjs b/src/modules/crash_report.mjs new file mode 100644 index 0000000..67339a5 --- /dev/null +++ b/src/modules/crash_report.mjs @@ -0,0 +1,17 @@ +// IMPORTANT NOTE: +// To make it work, we need to add the following line first to the HTML file: +// +// So it do NOT work for the service_worker.mjs file. Currently it works only for the +// popup.html and options.html pages. + +const PRODUCTION_SAMPLE_RATE = 0.01; + +function isProductionExtension() { + return chrome.runtime.id === 'pdnfnkhpgegpcingjbfihlkjeighnddk'; +} + +Sentry.init({ + dsn: 'https://16d8948a57c442beaeaa7083a40dd8cf@o1818.ingest.sentry.io/6544429', + sampleRate: isProductionExtension() ? PRODUCTION_SAMPLE_RATE : 1.0, + release: chrome.runtime.getManifest().version, +}); diff --git a/src/modules/settings.mjs b/src/modules/settings.mjs index 39a18e9..0070581 100644 --- a/src/modules/settings.mjs +++ b/src/modules/settings.mjs @@ -1,6 +1,7 @@ import {Modes} from './modes.mjs'; import * as Storage from './_storage.mjs'; import * as Proxy from './_proxy.mjs'; +import * as Header from './_header.mjs'; import * as Icon from './_icon.mjs'; @@ -28,33 +29,32 @@ export function getCustomProxy() { } -// Clear all settings regardless of the current mode -// Note: Make sure a Promise is returned so that the caller can wait for it -function clearAllSettings() { - return Promise.all([ - Proxy.clearProxy(), - // Header.clearHeaderModifier(), - ]); -} - -// Apply the settings for the given mode -// Note: Make sure a Promise is returned so that the caller can wait for it +// Clear any previous settings and apply new settings for the given mode. +// Note: +// * The function should be idempotent so it can be called multiple times. +// * Make sure a Promise is returned so that the caller can wait for it. async function applyModeSettings(mode) { if (mode === Modes.OFF) { - Icon.setIcon(Modes.OFF); - return; // Do nothing else - } - - const customProxy = await getCustomProxy(); - if (typeof customProxy === 'undefined' || + return Promise.all([ + Proxy.clearProxy(), + Header.clearHeaderModifier(), + Icon.setIcon(Modes.OFF), + ]); + } else { + // 1. Set proxy + const customProxy = await getCustomProxy(); + if (typeof customProxy === 'undefined' || typeof customProxy.proc === 'undefined' || typeof customProxy.addr === 'undefined') { - await Proxy.setDefaultProxy(); - } else { - await Proxy.setCustomProxy(customProxy.proc, customProxy.addr); + await Proxy.setDefaultProxy(); + } else { + await Proxy.setCustomProxy(customProxy.proc, customProxy.addr); + } + // 2. Set header modifier + await Header.setHeaderModifier(); + // 3. Set icon + Icon.setIcon(Modes.NORMAL); } - // TODO: Set header modifier - Icon.setIcon(Modes.NORMAL); } @@ -74,12 +74,10 @@ export async function loadCurrentSettings() { // ================================================================ // Function called by popup.js: // * setNewMode() -// 1. Tear down the settings of the old mode -// 2. Set up the mode settings for the new mode -// 3. Save the new mode into storage +// 1. Set up the mode settings for the new mode +// 2. Save the new mode into storage export async function setNewMode(mode) { - await clearAllSettings(); await applyModeSettings(mode); await Storage.setItem(MODE_STORAGE_KEY, mode); diff --git a/src/options.html b/src/options.html index b6c2e26..2b64a1c 100644 --- a/src/options.html +++ b/src/options.html @@ -7,6 +7,7 @@ + diff --git a/src/options.mjs b/src/options.mjs index d11af11..f2a6c27 100644 --- a/src/options.mjs +++ b/src/options.mjs @@ -1,3 +1,5 @@ +import './modules/crash_report.mjs'; + import * as Settings from './modules/settings.mjs'; import {DEFAULT_PROXY_PROTOCOL, DEFAULT_PROXY_ADDRESS} from './configs/servers.mjs'; @@ -99,8 +101,6 @@ $('#custom_proxy_enable').click(function() { showProxyMessage( 'warning', 'Set the custom proxy server, and changed mode to use proxy'); - console.log('Successfully set the custom proxy server to ' + - customProxyProtocol + ' ' + customProxyAddress); console.groupEnd(); }); }); @@ -118,7 +118,6 @@ $('#custom_proxy_reset').click(function() { $('#custom_proxy_enable').attr('disabled', false); showProxyMessage('warning', 'Reset custom proxy server, and changed mode to use proxy'); - console.log('Successfully reset the custom proxy server'); console.groupEnd(); }); }); diff --git a/src/popup.html b/src/popup.html index c0940b8..3292f6d 100644 --- a/src/popup.html +++ b/src/popup.html @@ -9,6 +9,7 @@ + diff --git a/src/popup.mjs b/src/popup.mjs index 40be35c..667232e 100644 --- a/src/popup.mjs +++ b/src/popup.mjs @@ -1,3 +1,5 @@ +import './modules/crash_report.mjs'; + import {Modes} from './modules/modes.mjs'; import * as Settings from './modules/settings.mjs'; import * as Icon from './modules/_icon.mjs'; @@ -59,4 +61,3 @@ $('input#input_normal').change(function() { // Enable tooltip $('#tooltip').tooltip(); - diff --git a/src/service_worker.mjs b/src/service_worker.mjs new file mode 100644 index 0000000..a4d12e5 --- /dev/null +++ b/src/service_worker.mjs @@ -0,0 +1,36 @@ +// IMPORTANT NOTE: +// Any asynchronous operations not wrapped by an event listener here +// are not guaranteed to complete, or may not get executed at all. +// So please make sure all important logic is done via listeners. + + +import * as Settings from './modules/settings.mjs'; + + +function initializeExtension() { + console.group('To intialize the extension...'); + Settings.loadCurrentSettings().then(() => { + console.log('Successfully initialized the chrome extension'); + console.groupEnd(); + }); +} + + +// Triggered when the extension is first time installed +chrome.runtime.onInstalled.addListener(function(details) { + // Show the donation page when the extension is installed + if (details.reason === 'install') { + chrome.tabs.create({ + url: chrome.i18n.getMessage('donation_url'), + }); + } + + // Initialize the extension + initializeExtension(); +}); + + +// Triggered when the Chrome browser itself is just opened +chrome.runtime.onStartup.addListener(function() { + initializeExtension(); +}); diff --git a/src/third_party/js/README.md b/src/third_party/js/README.md new file mode 100644 index 0000000..853ff12 --- /dev/null +++ b/src/third_party/js/README.md @@ -0,0 +1,5 @@ +Run the following command to validate the integrity of the third-party JavaScript libs: + +``` + sha256sum --check checksum.sha256 +``` \ No newline at end of file diff --git a/src/third_party/js/checksum.sha256 b/src/third_party/js/checksum.sha256 new file mode 100644 index 0000000..d2683c7 --- /dev/null +++ b/src/third_party/js/checksum.sha256 @@ -0,0 +1,3 @@ +4a4de7903ea62d330e17410ea4db6c22bcbeb350ac6aa402d6b54b4c0cbed327 bootstrap-3.3.5.min.js +f16ab224bb962910558715c82f58c10c3ed20f153ddfaa199029f141b5b0255c jquery-2.1.4.min.js +ca19d635167de42633b7c4acda11365444ebafe4093f9f241963b48cd57093b6 sentry-7.4.1.min.js diff --git a/src/third_party/js/sentry-7.4.1.min.js b/src/third_party/js/sentry-7.4.1.min.js new file mode 100644 index 0000000..243de35 --- /dev/null +++ b/src/third_party/js/sentry-7.4.1.min.js @@ -0,0 +1,3 @@ +/*! @sentry/browser 7.4.1 (3d8edc5) | https://github.com/getsentry/sentry-javascript */ +var Sentry=function(t){var n={};function e(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:n}function r(t,n,r){var i=r||e(),s=i.__SENTRY__=i.__SENTRY__||{};return s[t]||(s[t]=n())}var i=Object.prototype.toString;function s(t){switch(i.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return d(t,Error)}}function o(t,n){return i.call(t)===`[object ${n}]`}function u(t){return o(t,"ErrorEvent")}function a(t){return o(t,"DOMError")}function c(t){return o(t,"String")}function f(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function h(t){return o(t,"Object")}function l(t){return"undefined"!=typeof Event&&d(t,Event)}function v(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function d(t,n){try{return t instanceof n}catch(t){return!1}}function p(t,n){try{let i=t;var e=[];let s=0,o=0;var r=" > ".length;let u;for(;i&&s++<5&&(u=y(i,n),!("html"===u||s>1&&o+e.length*r+u.length>=80));)e.push(u),o+=u.length,i=i.parentNode;return e.reverse().join(" > ")}catch(t){return""}}function y(t,n){var e=t,r=[];let i,s,o,u,a;if(!e||!e.tagName)return"";r.push(e.tagName.toLowerCase());var f=n&&n.length?n.filter((t=>e.getAttribute(t))).map((t=>[t,e.getAttribute(t)])):null;if(f&&f.length)f.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else if(e.id&&r.push(`#${e.id}`),i=e.className,i&&c(i))for(s=i.split(/\s+/),a=0;a1&&(a=f.slice(0,-1).join("/"),c=f.pop()),c){var h=c.match(/^\d+/);h&&(c=h[0])}return _({host:s,pass:i,path:a,projectId:c,port:o,protocol:e,publicKey:r})}(t):_(t)}var x,E=["debug","info","warn","error","log","assert","trace"];function S(t,n=0){return"string"!=typeof t||0===n||t.length<=n?t:`${t.substr(0,n)}...`}function $(t,n){if(!Array.isArray(t))return"";var e=[];for(let n=0;n"}var n}function M(t){if("object"==typeof t&&null!==t){var n={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}return{}}function C(t,n=40){var e=Object.keys(R(t));if(e.sort(),!e.length)return"[object has no keys]";if(e[0].length>=n)return S(e[0],n);for(let t=e.length;t>0;t--){var r=e.slice(0,t).join(", ");if(!(r.length>n))return t===e.length?r:S(r,n)}return""}function N(t){return A(t,new Map)}function A(t,n){if(h(t)){if(void 0!==(i=n.get(t)))return i;var e={};for(var r of(n.set(t,e),Object.keys(t)))void 0!==t[r]&&(e[r]=A(t[r],n));return e}if(Array.isArray(t)){var i;if(void 0!==(i=n.get(t)))return i;e=[];return n.set(t,e),t.forEach((t=>{e.push(A(t,n))})),e}return t}x={enable:()=>{},disable:()=>{}},E.forEach((t=>{x[t]=()=>{}}));function L(...t){var n=t.sort(((t,n)=>t[0]-n[0])).map((t=>t[1]));return(t,e=0)=>{var r=[];for(var i of t.split("\n").slice(e))for(var s of n){var o=s(i);if(o){r.push(o);break}}return function(t){if(!t.length)return[];let n=t;var e=n[0].function||"",r=n[n.length-1].function||"";-1===e.indexOf("captureMessage")&&-1===e.indexOf("captureException")||(n=n.slice(1));-1!==r.indexOf("sentryWrapped")&&(n=n.slice(0,-1));return n.slice(0,50).map((t=>({...t,filename:t.filename||n[0].filename,function:t.function||"?"}))).reverse()}(r)}}var U="";function q(t){try{return t&&"function"==typeof t&&t.name||U}catch(t){return U}}function P(){if(!("fetch"in e()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(t){return!1}}function H(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}var F=e(),B={},X={};function z(t){if(!X[t])switch(X[t]=!0,t){case"console":!function(){if(!("console"in F))return;E.forEach((function(t){t in F.console&&O(F.console,t,(function(n){return function(...e){J("console",{args:e,level:t}),n&&n.apply(F.console,e)}}))}))}();break;case"dom":!function(){if(!("document"in F))return;var t=J.bind(null,"dom"),n=Z(t,!0);F.document.addEventListener("click",n,!1),F.document.addEventListener("keypress",n,!1),["EventTarget","Node"].forEach((n=>{var e=F[n]&&F[n].prototype;e&&e.hasOwnProperty&&e.hasOwnProperty("addEventListener")&&(O(e,"addEventListener",(function(n){return function(e,r,i){if("click"===e||"keypress"==e)try{var s=this,o=s.__sentry_instrumentation_handlers__=s.__sentry_instrumentation_handlers__||{},u=o[e]=o[e]||{refCount:0};if(!u.handler){var a=Z(t);u.handler=a,n.call(this,e,a,i)}u.refCount+=1}catch(t){}return n.call(this,e,r,i)}})),O(e,"removeEventListener",(function(t){return function(n,e,r){if("click"===n||"keypress"==n)try{var i=this,s=i.__sentry_instrumentation_handlers__||{},o=s[n];o&&(o.refCount-=1,o.refCount<=0&&(t.call(this,n,o.handler,r),o.handler=void 0,delete s[n]),0===Object.keys(s).length&&delete i.__sentry_instrumentation_handlers__)}catch(t){}return t.call(this,n,e,r)}})))}))}();break;case"xhr":!function(){if(!("XMLHttpRequest"in F))return;var t=XMLHttpRequest.prototype;O(t,"open",(function(t){return function(...n){var e=this,r=n[1],i=e.__sentry_xhr__={method:c(n[0])?n[0].toUpperCase():n[0],url:n[1]};c(r)&&"POST"===i.method&&r.match(/sentry_key/)&&(e.__sentry_own_request__=!0);var s=function(){if(4===e.readyState){try{i.status_code=e.status}catch(t){}J("xhr",{args:n,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:e})}};return"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?O(e,"onreadystatechange",(function(t){return function(...n){return s(),t.apply(e,n)}})):e.addEventListener("readystatechange",s),t.apply(e,n)}})),O(t,"send",(function(t){return function(...n){return this.__sentry_xhr__&&void 0!==n[0]&&(this.__sentry_xhr__.body=n[0]),J("xhr",{args:n,startTimestamp:Date.now(),xhr:this}),t.apply(this,n)}}))}();break;case"fetch":!function(){if(!function(){if(!P())return!1;var t=e();if(H(t.fetch))return!0;let n=!1;var r=t.document;if(r&&"function"==typeof r.createElement)try{var i=r.createElement("iframe");i.hidden=!0,r.head.appendChild(i),i.contentWindow&&i.contentWindow.fetch&&(n=H(i.contentWindow.fetch)),r.head.removeChild(i)}catch(t){}return n}())return;O(F,"fetch",(function(t){return function(...n){var e={args:n,fetchData:{method:K(n),url:G(n)},startTimestamp:Date.now()};return J("fetch",{...e}),t.apply(F,n).then((t=>(J("fetch",{...e,endTimestamp:Date.now(),response:t}),t)),(t=>{throw J("fetch",{...e,endTimestamp:Date.now(),error:t}),t}))}}))}();break;case"history":!function(){if(!function(){var t=e(),n=t.chrome,r=n&&n.app&&n.app.runtime,i="history"in t&&!!t.history.pushState&&!!t.history.replaceState;return!r&&i}())return;var t=F.onpopstate;function n(t){return function(...n){var e=n.length>2?n[2]:void 0;if(e){var r=V,i=String(e);V=i,J("history",{from:r,to:i})}return t.apply(this,n)}}F.onpopstate=function(...n){var e=F.location.href,r=V;if(V=e,J("history",{from:r,to:e}),t)try{return t.apply(this,n)}catch(t){}},O(F.history,"pushState",n),O(F.history,"replaceState",n)}();break;case"error":tt=F.onerror,F.onerror=function(t,n,e,r,i){return J("error",{column:r,error:i,line:e,msg:t,url:n}),!!tt&&tt.apply(this,arguments)};break;case"unhandledrejection":nt=F.onunhandledrejection,F.onunhandledrejection=function(t){return J("unhandledrejection",t),!nt||nt.apply(this,arguments)};break;default:return}}function W(t,n){B[t]=B[t]||[],B[t].push(n),z(t)}function J(t,n){if(t&&B[t])for(var e of B[t]||[])try{e(n)}catch(t){}}function K(t=[]){return"Request"in F&&d(t[0],Request)&&t[0].method?String(t[0].method).toUpperCase():t[1]&&t[1].method?String(t[1].method).toUpperCase():"GET"}function G(t=[]){return"string"==typeof t[0]?t[0]:"Request"in F&&d(t[0],Request)?t[0].url:String(t[0])}let V;let Q,Y;function Z(t,n=!1){return e=>{if(e&&Y!==e&&!function(t){if("keypress"!==t.type)return!1;try{var n=t.target;if(!n||!n.tagName)return!0;if("INPUT"===n.tagName||"TEXTAREA"===n.tagName||n.isContentEditable)return!1}catch(t){}return!0}(e)){var r="keypress"===e.type?"input":e.type;(void 0===Q||function(t,n){if(!t)return!0;if(t.type!==n.type)return!0;try{if(t.target!==n.target)return!0}catch(t){}return!1}(Y,e))&&(t({event:e,name:r,global:n}),Y=e),clearTimeout(Q),Q=F.setTimeout((()=>{Q=void 0}),1e3)}}}let tt=null;let nt=null;function et(){var t=e(),n=t.crypto||t.msCrypto;if(void 0!==n&&n.getRandomValues){var r=new Uint16Array(8);n.getRandomValues(r),r[3]=4095&r[3]|16384,r[4]=16383&r[4]|32768;var i=t=>{let n=t.toString(16);for(;n.length<4;)n=`0${n}`;return n};return i(r[0])+i(r[1])+i(r[2])+i(r[3])+i(r[4])+i(r[5])+i(r[6])+i(r[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(t=>{var n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)}))}function rt(t){if(!t)return{};var n=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!n)return{};var e=n[6]||"",r=n[8]||"";return{host:n[4],path:n[5],protocol:n[2],relative:n[5]+e+r}}function it(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function st(t){const{message:n,event_id:e}=t;if(n)return n;var r=it(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||e||"":e||""}function ot(t,n,e){var r=t.exception=t.exception||{},i=r.values=r.values||[],s=i[0]=i[0]||{};s.value||(s.value=n||""),s.type||(s.type=e||"Error")}function ut(t,n){var e=it(t);if(e){var r=e.mechanism;if(e.mechanism={type:"generic",handled:!0,...r,...n},n&&"data"in n){var i={...r&&r.data,...n.data};e.mechanism.data=i}}}function at(t){if(t&&t.__sentry_captured__)return!0;try{j(t,"__sentry_captured__",!0)}catch(t){}return!1}function ct(t,n=1/0,e=1/0){try{return ht("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function ft(t,n=3,e=102400){var r,i=ct(t,n);return r=i,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(r))>e?ft(t,n-1,e):i}function ht(t,n,e=1/0,r=1/0,i=function(){var t="function"==typeof WeakSet,n=t?new WeakSet:[];return[function(e){if(t)return!!n.has(e)||(n.add(e),!1);for(let t=0;t=r){f[d]="[MaxProperties ~]";break}var p=v[d];f[d]=ht(d,p,e-1,r,i),l+=1}return o(n),f}var lt;function vt(t){return new pt((n=>{n(t)}))}function dt(t){return new pt(((n,e)=>{e(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(lt||(lt={}));class pt{__init(){this.i=lt.PENDING}__init2(){this.o=[]}constructor(t){pt.prototype.__init.call(this),pt.prototype.__init2.call(this),pt.prototype.__init3.call(this),pt.prototype.__init4.call(this),pt.prototype.__init5.call(this),pt.prototype.__init6.call(this);try{t(this.u,this.h)}catch(t){this.h(t)}}then(t,n){return new pt(((e,r)=>{this.o.push([!1,n=>{if(t)try{e(t(n))}catch(t){r(t)}else e(n)},t=>{if(n)try{e(n(t))}catch(t){r(t)}else r(t)}]),this.l()}))}catch(t){return this.then((t=>t),t)}finally(t){return new pt(((n,e)=>{let r,i;return this.then((n=>{i=!1,r=n,t&&t()}),(n=>{i=!0,r=n,t&&t()})).then((()=>{i?e(r):n(r)}))}))}__init3(){this.u=t=>{this.v(lt.RESOLVED,t)}}__init4(){this.h=t=>{this.v(lt.REJECTED,t)}}__init5(){this.v=(t,n)=>{this.i===lt.PENDING&&(v(n)?n.then(this.u,this.h):(this.i=t,this.p=n,this.l()))}}__init6(){this.l=()=>{if(this.i!==lt.PENDING){var t=this.o.slice();this.o=[],t.forEach((t=>{t[0]||(this.i===lt.RESOLVED&&t[1](this.p),this.i===lt.REJECTED&&t[2](this.p),t[0]=!0)}))}}}}function yt(t){var n=[];function e(t){return n.splice(n.indexOf(t),1)[0]}return{$:n,add:function(r){if(!(void 0===t||n.lengthe(i))).then(null,(()=>e(i).then(null,(()=>{})))),i},drain:function(t){return new pt(((e,r)=>{let i=n.length;if(!i)return e(!0);var s=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{vt(t).then((()=>{--i||(clearTimeout(s),e(!0))}),r)}))}))}}}var mt=["fatal","error","warning","log","info","debug"];var gt={nowSeconds:()=>Date.now()/1e3};var bt=function(){const{performance:t}=e();if(t&&t.now)return{now:()=>t.now(),timeOrigin:Date.now()-t.now()}}(),_t=void 0===bt?gt:{nowSeconds:()=>(bt.timeOrigin+bt.now())/1e3},wt=gt.nowSeconds.bind(gt),xt=_t.nowSeconds.bind(_t);function Et(t,n=[]){return[t,n]}function St(t,n){const[e,r]=t;return[e,[...r,n]]}function $t(t,n){t[1].forEach((t=>{var e=t[0].type;n(t,e)}))}function kt(t,n){return(n||new TextEncoder).encode(t)}function Ot(t,n){const[e,r]=t;let i=JSON.stringify(e);function s(t){"string"==typeof i?i="string"==typeof t?i+t:[kt(i,n),t]:i.push("string"==typeof t?kt(t,n):t)}for(var o of r){const[t,n]=o;s(`\n${JSON.stringify(t)}\n`),s("string"==typeof n||n instanceof Uint8Array?n:JSON.stringify(n))}return"string"==typeof i?i:function(t){var n=t.reduce(((t,n)=>t+n.length),0),e=new Uint8Array(n);let r=0;for(var i of t)e.set(i,r),r+=i.length;return e}(i)}function jt(t,n){var e="string"==typeof t.data?kt(t.data,n):t.data;return[N({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}(()=>{const{performance:t}=e();if(t&&t.now){var n=36e5,r=t.now(),i=Date.now(),s=t.timeOrigin?Math.abs(t.timeOrigin+r-i):n,o=sfunction(t){return N({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(e)};return t&&Mt(e,t),e}function Mt(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),t.did||n.did||(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||xt(),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:et()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{var e=t.timestamp-t.started;t.duration=e>=0?e:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}class Ct{constructor(){this.m=!1,this.g=[],this._=[],this.S=[],this.k=[],this.O={},this.j={},this.T={},this.D={},this.R={}}static clone(t){var n=new Ct;return t&&(n.S=[...t.S],n.j={...t.j},n.T={...t.T},n.D={...t.D},n.O=t.O,n.I=t.I,n.M=t.M,n.C=t.C,n.N=t.N,n.A=t.A,n._=[...t._],n.L=t.L,n.k=[...t.k]),n}addScopeListener(t){this.g.push(t)}addEventProcessor(t){return this._.push(t),this}setUser(t){return this.O=t||{},this.C&&Mt(this.C,{user:t}),this.U(),this}getUser(){return this.O}getRequestSession(){return this.L}setRequestSession(t){return this.L=t,this}setTags(t){return this.j={...this.j,...t},this.U(),this}setTag(t,n){return this.j={...this.j,[t]:n},this.U(),this}setExtras(t){return this.T={...this.T,...t},this.U(),this}setExtra(t,n){return this.T={...this.T,[t]:n},this.U(),this}setFingerprint(t){return this.A=t,this.U(),this}setLevel(t){return this.I=t,this.U(),this}setTransactionName(t){return this.N=t,this.U(),this}setContext(t,n){return null===n?delete this.D[t]:this.D={...this.D,[t]:n},this.U(),this}setSpan(t){return this.M=t,this.U(),this}getSpan(){return this.M}getTransaction(){var t=this.getSpan();return t&&t.transaction}setSession(t){return t?this.C=t:delete this.C,this.U(),this}getSession(){return this.C}update(t){if(!t)return this;if("function"==typeof t){var n=t(this);return n instanceof Ct?n:this}return t instanceof Ct?(this.j={...this.j,...t.j},this.T={...this.T,...t.T},this.D={...this.D,...t.D},t.O&&Object.keys(t.O).length&&(this.O=t.O),t.I&&(this.I=t.I),t.A&&(this.A=t.A),t.L&&(this.L=t.L)):h(t)&&(t=t,this.j={...this.j,...t.tags},this.T={...this.T,...t.extra},this.D={...this.D,...t.contexts},t.user&&(this.O=t.user),t.level&&(this.I=t.level),t.fingerprint&&(this.A=t.fingerprint),t.requestSession&&(this.L=t.requestSession)),this}clear(){return this.S=[],this.j={},this.T={},this.O={},this.D={},this.I=void 0,this.N=void 0,this.A=void 0,this.L=void 0,this.M=void 0,this.C=void 0,this.U(),this.k=[],this}addBreadcrumb(t,n){var e="number"==typeof n?Math.min(n,100):100;if(e<=0)return this;var r={timestamp:wt(),...t};return this.S=[...this.S,r].slice(-e),this.U(),this}clearBreadcrumbs(){return this.S=[],this.U(),this}addAttachment(t){return this.k.push(t),this}getAttachments(){return this.k}clearAttachments(){return this.k=[],this}applyToEvent(t,n={}){if(this.T&&Object.keys(this.T).length&&(t.extra={...this.T,...t.extra}),this.j&&Object.keys(this.j).length&&(t.tags={...this.j,...t.tags}),this.O&&Object.keys(this.O).length&&(t.user={...this.O,...t.user}),this.D&&Object.keys(this.D).length&&(t.contexts={...this.D,...t.contexts}),this.I&&(t.level=this.I),this.N&&(t.transaction=this.N),this.M){t.contexts={trace:this.M.getTraceContext(),...t.contexts};var e=this.M.transaction&&this.M.transaction.name;e&&(t.tags={transaction:e,...t.tags})}return this.q(t),t.breadcrumbs=[...t.breadcrumbs||[],...this.S],t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...this.R},this.P([...Nt(),...this._],t,n)}setSDKProcessingMetadata(t){return this.R={...this.R,...t},this}P(t,n,e,r=0){return new pt(((i,s)=>{var o=t[r];if(null===n||"function"!=typeof o)i(n);else{var u=o({...n},e);v(u)?u.then((n=>this.P(t,n,e,r+1).then(i))).then(null,s):this.P(t,u,e,r+1).then(i).then(null,s)}}))}U(){this.m||(this.m=!0,this.g.forEach((t=>{t(this)})),this.m=!1)}q(t){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],this.A&&(t.fingerprint=t.fingerprint.concat(this.A)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}}function Nt(){return r("globalEventProcessors",(()=>[]))}function At(t){Nt().push(t)}var Lt=100;class Ut{__init(){this.H=[{}]}constructor(t,n=new Ct,e=4){this.F=e,Ut.prototype.__init.call(this),this.getStackTop().scope=n,t&&this.bindClient(t)}isOlderThan(t){return this.F{i.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},s)})),e}captureMessage(t,n,e){var r=this.B=e&&e.event_id?e.event_id:et(),i=new Error(t);return this.X(((s,o)=>{s.captureMessage(t,n,{originalException:t,syntheticException:i,...e,event_id:r},o)})),r}captureEvent(t,n){var e=n&&n.event_id?n.event_id:et();return"transaction"!==t.type&&(this.B=e),this.X(((r,i)=>{r.captureEvent(t,{...n,event_id:e},i)})),e}lastEventId(){return this.B}addBreadcrumb(t,n){const{scope:r,client:i}=this.getStackTop();if(!r||!i)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:o=Lt}=i.getOptions&&i.getOptions()||{};if(!(o<=0)){var u={timestamp:wt(),...t},a=s?function(t){var n=e();if(!("console"in n))return t();var r=n.console,i={};E.forEach((t=>{var e=r[t]&&r[t].__sentry_original__;t in n.console&&e&&(i[t]=r[t],r[t]=e)}));try{return t()}finally{Object.keys(i).forEach((t=>{r[t]=i[t]}))}}((()=>s(u,n))):u;null!==a&&r.addBreadcrumb(a,o)}}setUser(t){var n=this.getScope();n&&n.setUser(t)}setTags(t){var n=this.getScope();n&&n.setTags(t)}setExtras(t){var n=this.getScope();n&&n.setExtras(t)}setTag(t,n){var e=this.getScope();e&&e.setTag(t,n)}setExtra(t,n){var e=this.getScope();e&&e.setExtra(t,n)}setContext(t,n){var e=this.getScope();e&&e.setContext(t,n)}configureScope(t){const{scope:n,client:e}=this.getStackTop();n&&e&&t(n)}run(t){var n=Pt(this);try{t(this)}finally{Pt(n)}}getIntegration(t){var n=this.getClient();if(!n)return null;try{return n.getIntegration(t)}catch(t){return null}}startTransaction(t,n){return this.W("startTransaction",t,n)}traceHeaders(){return this.W("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this.J()}endSession(){var t=this.getStackTop(),n=t&&t.scope,e=n&&n.getSession();e&&function(t,n){let e={};n?e={status:n}:"ok"===t.status&&(e={status:"exited"}),Mt(t,e)}(e),this.J(),n&&n.setSession()}startSession(t){const{scope:n,client:r}=this.getStackTop(),{release:i,environment:s}=r&&r.getOptions()||{};var o=e();const{userAgent:u}=o.navigator||{};var a=It({release:i,environment:s,...n&&{user:n.getUser()},...u&&{userAgent:u},...t});if(n){var c=n.getSession&&n.getSession();c&&"ok"===c.status&&Mt(c,{status:"exited"}),this.endSession(),n.setSession(a)}return a}J(){const{scope:t,client:n}=this.getStackTop();if(t){var e=t.getSession();e&&n&&n.captureSession&&n.captureSession(e)}}X(t){const{scope:n,client:e}=this.getStackTop();e&&t(e,n)}W(t,...n){var e=qt().__SENTRY__;if(e&&e.extensions&&"function"==typeof e.extensions[t])return e.extensions[t].apply(this,n)}}function qt(){var t=e();return t.__SENTRY__=t.__SENTRY__||{extensions:{},hub:void 0},t}function Pt(t){var n=qt(),e=Ft(n);return Bt(n,t),e}function Ht(){var t,n=qt();return(t=n)&&t.__SENTRY__&&t.__SENTRY__.hub&&!Ft(n).isOlderThan(4)||Bt(n,new Ut),Ft(n)}function Ft(t){return r("hub",(()=>new Ut),t)}function Bt(t,n){return!!t&&((t.__SENTRY__=t.__SENTRY__||{}).hub=n,!0)}function captureException(t,n){return Ht().captureException(t,{captureContext:n})}function Xt(t){Ht().withScope(t)}function zt(t){var n=t.protocol?`${t.protocol}:`:"",e=t.port?`:${t.port}`:"";return`${n}//${t.host}${e}${t.path?`/${t.path}`:""}/api/`}function Wt(t){return n={sentry_key:t.publicKey,sentry_version:"7"},Object.keys(n).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(n[t])}`)).join("&");var n}function Jt(t,n){return n||`${function(t){return`${zt(t)}${t.projectId}/envelope/`}(t)}?${Wt(t)}`}function Kt(t){if(!t||!t.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}function Gt(t,n,e,r){var i=Kt(e),s=t.type||"event";const{transactionSampling:o}=t.sdkProcessingMetadata||{},{method:u,rate:a}=o||{};!function(t,n){n&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||n.name,t.sdk.version=t.sdk.version||n.version,t.sdk.integrations=[...t.sdk.integrations||[],...n.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...n.packages||[]])}(t,e&&e.sdk);var c=function(t,n,e,r){var i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.baggage,s=i&&function(t){return t[0]}(i);return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&{dsn:b(r)},..."transaction"===t.type&&s&&{trace:N({...s})}}}(t,i,r,n);return delete t.sdkProcessingMetadata,Et(c,[[{type:s,sample_rates:[{id:u,rate:a}]},t]])}var Vt=[];function Qt(t){return t.reduce(((t,n)=>(t.every((t=>n.name!==t.name))&&t.push(n),t)),[])}function Yt(t){var n=t.defaultIntegrations&&[...t.defaultIntegrations]||[],e=t.integrations;let r=[...Qt(n)];Array.isArray(e)?r=[...r.filter((t=>e.every((n=>n.name!==t.name)))),...Qt(e)]:"function"==typeof e&&(r=e(r),r=Array.isArray(r)?r:[r]);var i=r.map((t=>t.name)),s="Debug";return-1!==i.indexOf(s)&&r.push(...r.splice(i.indexOf(s),1)),r}class Zt{__init(){this.K={}}__init2(){this.G=!1}__init3(){this.V=0}__init4(){this.Y={}}constructor(t){if(Zt.prototype.__init.call(this),Zt.prototype.__init2.call(this),Zt.prototype.__init3.call(this),Zt.prototype.__init4.call(this),this.Z=t,t.dsn){this.tt=w(t.dsn);var n=Jt(this.tt,t.tunnel);this.nt=t.transport({recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:n})}}captureException(t,n,e){if(at(t))return;let r=n&&n.event_id;return this.et(this.eventFromException(t,n).then((t=>this.rt(t,n,e))).then((t=>{r=t}))),r}captureMessage(t,n,e,r){let i=e&&e.event_id;var s=f(t)?this.eventFromMessage(String(t),n,e):this.eventFromException(t,e);return this.et(s.then((t=>this.rt(t,e,r))).then((t=>{i=t}))),i}captureEvent(t,n,e){if(n&&n.originalException&&at(n.originalException))return;let r=n&&n.event_id;return this.et(this.rt(t,n,e).then((t=>{r=t}))),r}captureSession(t){this.it()&&("string"!=typeof t.release||(this.sendSession(t),Mt(t,{init:!1})))}getDsn(){return this.tt}getOptions(){return this.Z}getTransport(){return this.nt}flush(t){var n=this.nt;return n?this.st(t).then((e=>n.flush(t).then((t=>e&&t)))):vt(!0)}close(t){return this.flush(t).then((t=>(this.getOptions().enabled=!1,t)))}setupIntegrations(){var t,n;this.it()&&!this.G&&(this.K=(t=this.Z.integrations,n={},t.forEach((t=>{n[t.name]=t,-1===Vt.indexOf(t.name)&&(t.setupOnce(At,Ht),Vt.push(t.name))})),n),this.G=!0)}getIntegrationById(t){return this.K[t]}getIntegration(t){try{return this.K[t.id]||null}catch(t){return null}}sendEvent(t,n={}){if(this.tt){let r=Gt(t,this.tt,this.Z.ot,this.Z.tunnel);for(var e of n.attachments||[])r=St(r,jt(e,this.Z.transportOptions&&this.Z.transportOptions.textEncoder));this.ut(r)}}sendSession(t){if(this.tt){var n=function(t,n,e,r){var i=Kt(e);return Et({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&{dsn:b(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t]])}(t,this.tt,this.Z.ot,this.Z.tunnel);this.ut(n)}}recordDroppedEvent(t,n){if(this.Z.sendClientReports){var e=`${t}:${n}`;this.Y[e]=this.Y[e]+1||1}}at(t,n){let e=!1,r=!1;var i=n.exception&&n.exception.values;if(i)for(var s of(r=!0,i)){var o=s.mechanism;if(o&&!1===o.handled){e=!0;break}}var u="ok"===t.status;(u&&0===t.errors||u&&e)&&(Mt(t,{...e&&{status:"crashed"},errors:t.errors||Number(r||e)}),this.captureSession(t))}st(t){return new pt((n=>{let e=0;var r=setInterval((()=>{0==this.V?(clearInterval(r),n(!0)):(e+=1,t&&e>=t&&(clearInterval(r),n(!1)))}),1)}))}it(){return!1!==this.getOptions().enabled&&void 0!==this.tt}ct(t,n,e){const{normalizeDepth:r=3,normalizeMaxBreadth:i=1e3}=this.getOptions();var s={...t,event_id:t.event_id||n.event_id||et(),timestamp:t.timestamp||wt()};this.ft(s),this.ht(s);let o=e;n.captureContext&&(o=Ct.clone(o).update(n.captureContext));let u=vt(s);if(o){var a=[...n.attachments||[],...o.getAttachments()];a.length&&(n.attachments=a),u=o.applyToEvent(s,n)}return u.then((t=>"number"==typeof r&&r>0?this.lt(t,r,i):t))}lt(t,n,e){if(!t)return null;var r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map((t=>({...t,...t.data&&{data:ct(t.data,n,e)}})))},...t.user&&{user:ct(t.user,n,e)},...t.contexts&&{contexts:ct(t.contexts,n,e)},...t.extra&&{extra:ct(t.extra,n,e)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=ct(t.contexts.trace.data,n,e))),t.spans&&(r.spans=t.spans.map((t=>(t.data&&(t.data=ct(t.data,n,e)),t)))),r}ft(t){var n=this.getOptions();const{environment:e,release:r,dist:i,maxValueLength:s=250}=n;"environment"in t||(t.environment="environment"in n?e:"production"),void 0===t.release&&void 0!==r&&(t.release=r),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=S(t.message,s));var o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=S(o.value,s));var u=t.request;u&&u.url&&(u.url=S(u.url,s))}ht(t){var n=Object.keys(this.K);n.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...n])}rt(t,n={},e){return this.vt(t,n,e).then((t=>t.event_id),(t=>{}))}vt(t,n,e){const{beforeSend:r,sampleRate:i}=this.getOptions();if(!this.it())return dt(new m("SDK not enabled, will not capture event."));var s="transaction"===t.type;return!s&&"number"==typeof i&&Math.random()>i?(this.recordDroppedEvent("sample_rate","error"),dt(new m(`Discarding event because it's not included in the random sample (sampling rate = ${i})`))):this.ct(t,n,e).then((e=>{if(null===e)throw this.recordDroppedEvent("event_processor",t.type||"error"),new m("An event processor returned null, will not send event.");return n.data&&!0===n.data.__sentry__||s||!r?e:function(t){var n="`beforeSend` method has to return `null` or a valid event.";if(v(t))return t.then((t=>{if(!h(t)&&null!==t)throw new m(n);return t}),(t=>{throw new m(`beforeSend rejected with ${t}`)}));if(!h(t)&&null!==t)throw new m(n);return t}(r(e,n))})).then((r=>{if(null===r)throw this.recordDroppedEvent("before_send",t.type||"error"),new m("`beforeSend` returned `null`, will not send event.");var i=e&&e.getSession();return!s&&i&&this.at(i,r),this.sendEvent(r,n),r})).then(null,(t=>{if(t instanceof m)throw t;throw this.captureException(t,{data:{__sentry__:!0},originalException:t}),new m(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)}))}et(t){this.V+=1,t.then((t=>(this.V-=1,t)),(t=>(this.V-=1,t)))}ut(t){this.nt&&this.tt&&this.nt.send(t).then(null,(t=>{}))}dt(){var t=this.Y;return this.Y={},Object.keys(t).map((n=>{const[e,r]=n.split(":");return{reason:e,category:r,quantity:t[n]}}))}}function tn(t,n,e=yt(t.bufferSize||30)){let r={};return{send:function(i){var s=[];if($t(i,((n,e)=>{var i=Dt(e);!function(t,n,e=Date.now()){return function(t,n){return t[n]||t.all||0}(t,n)>e}(r,i)?s.push(n):t.recordDroppedEvent("ratelimit_backoff",i)})),0===s.length)return vt();var o=Et(i[0],s),u=n=>{$t(o,((e,r)=>{t.recordDroppedEvent(n,Dt(r))}))};return e.add((()=>n({body:Ot(o,t.textEncoder)}).then((t=>{r=Rt(r,t)}),(t=>{u("network_error")})))).then((t=>t),(t=>{if(t instanceof m)return u("queue_overflow"),vt();throw t}))},flush:t=>e.drain(t)}}var nn="7.4.1";let en;class rn{constructor(){rn.prototype.__init.call(this)}static __initStatic(){this.id="FunctionToString"}__init(){this.name=rn.id}setupOnce(){en=Function.prototype.toString,Function.prototype.toString=function(...t){var n=D(this)||this;return en.apply(n,t)}}}rn.__initStatic();var sn=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/];class on{static __initStatic(){this.id="InboundFilters"}__init(){this.name=on.id}constructor(t={}){this.Z=t,on.prototype.__init.call(this)}setupOnce(t,n){var e=t=>{var e=n();if(e){var r=e.getIntegration(on);if(r){var i=e.getClient(),s=i?i.getOptions():{},o=function(t={},n={}){return{allowUrls:[...t.allowUrls||[],...n.allowUrls||[]],denyUrls:[...t.denyUrls||[],...n.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...n.ignoreErrors||[],...sn],ignoreInternal:void 0===t.ignoreInternal||t.ignoreInternal}}(r.Z,s);return function(t,n){if(n.ignoreInternal&&function(t){try{return"SentryError"===t.exception.values[0].type}catch(t){}return!1}(t))return!0;if(function(t,n){if(!n||!n.length)return!1;return function(t){if(t.message)return[t.message];if(t.exception)try{const{type:n="",value:e=""}=t.exception.values&&t.exception.values[0]||{};return[`${e}`,`${n}: ${e}`]}catch(t){return[]}return[]}(t).some((t=>n.some((n=>k(t,n)))))}(t,n.ignoreErrors))return!0;if(function(t,n){if(!n||!n.length)return!1;var e=un(t);return!!e&&n.some((t=>k(e,t)))}(t,n.denyUrls))return!0;if(!function(t,n){if(!n||!n.length)return!0;var e=un(t);return!e||n.some((t=>k(e,t)))}(t,n.allowUrls))return!0;return!1}(t,o)?null:t}}return t};e.id=this.name,t(e)}}function un(t){try{let n;try{n=t.exception.values[0].stacktrace.frames}catch(t){}return n?function(t=[]){for(let e=t.length-1;e>=0;e--){var n=t[e];if(n&&""!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch(t){return null}}on.__initStatic();var an=Object.freeze({__proto__:null,FunctionToString:rn,InboundFilters:on});function cn(t,n){const e=hn(t,n),r={type:n&&n.name,value:vn(n)};return e.length&&(r.stacktrace={frames:e}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function fn(t,n){return{exception:{values:[cn(t,n)]}}}function hn(t,n){const e=n.stacktrace||n.stack||"",r=function(t){if(t){if("number"==typeof t.framesToPop)return t.framesToPop;if(ln.test(t.message))return 1}return 0}(n);try{return t(e,r)}catch(t){}return[]}const ln=/Minified React error #\d+;/i;function vn(t){const n=t&&t.message;return n?n.error&&"string"==typeof n.error.message?n.error.message:n:"No error message"}function dn(t,n,e,r,i){let c;if(u(n)&&n.error){return fn(t,n.error)}if(a(n)||o(n,"DOMException")){const i=n;if("stack"in n)c=fn(t,n);else{const n=i.name||(a(i)?"DOMError":"DOMException"),s=i.message?`${n}: ${i.message}`:n;c=pn(t,s,e,r),ot(c,s)}return"code"in i&&(c.tags={...c.tags,"DOMException.code":`${i.code}`}),c}if(s(n))return fn(t,n);if(h(n)||l(n)){return c=function(t,n,e,r){const i={exception:{values:[{type:l(n)?n.constructor.name:r?"UnhandledRejection":"Error",value:`Non-Error ${r?"promise rejection":"exception"} captured with keys: ${C(n)}`}]},extra:{__serialized__:ft(n)}};if(e){const n=hn(t,e);n.length&&(i.exception.values[0].stacktrace={frames:n})}return i}(t,n,e,i),ut(c,{synthetic:!0}),c}return c=pn(t,n,e,r),ot(c,`${n}`,void 0),ut(c,{synthetic:!0}),c}function pn(t,n,e,r){const i={message:n};if(r&&e){const r=hn(t,e);r.length&&(i.exception={values:[{value:n,stacktrace:{frames:r}}]})}return i}const yn="Breadcrumbs";class mn{static __initStatic(){this.id=yn}__init(){this.name=mn.id}constructor(t){mn.prototype.__init.call(this),this.options={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t}}setupOnce(){this.options.console&&W("console",gn),this.options.dom&&W("dom",function(t){function n(n){let e,r="object"==typeof t?t.serializeAttribute:void 0;"string"==typeof r&&(r=[r]);try{e=n.event.target?p(n.event.target,r):p(n.event,r)}catch(t){e=""}0!==e.length&&Ht().addBreadcrumb({category:`ui.${n.name}`,message:e},{event:n.event,name:n.name,global:n.global})}return n}(this.options.dom)),this.options.xhr&&W("xhr",bn),this.options.fetch&&W("fetch",_n),this.options.history&&W("history",wn)}}function gn(t){const n={category:"console",data:{arguments:t.args,logger:"console"},level:(e=t.level,"warn"===e?"warning":mt.includes(e)?e:"log"),message:$(t.args," ")};var e;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${$(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Ht().addBreadcrumb(n,{input:t.args,level:t.level})}function bn(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;const{method:n,url:e,status_code:r,body:i}=t.xhr.__sentry_xhr__||{};Ht().addBreadcrumb({category:"xhr",data:{method:n,url:e,status_code:r},type:"http"},{xhr:t.xhr,input:i})}else;}function _n(t){t.endTimestamp&&(t.fetchData.url.match(/sentry_key/)&&"POST"===t.fetchData.method||(t.error?Ht().addBreadcrumb({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args}):Ht().addBreadcrumb({category:"fetch",data:{...t.fetchData,status_code:t.response.status},type:"http"},{input:t.args,response:t.response})))}function wn(t){const n=e();let r=t.from,i=t.to;const s=rt(n.location.href);let o=rt(r);const u=rt(i);o.path||(o=s),s.protocol===u.protocol&&s.host===u.host&&(i=u.relative),s.protocol===o.protocol&&s.host===o.host&&(r=o.relative),Ht().addBreadcrumb({category:"navigation",data:{from:r,to:i}})}mn.__initStatic();const xn=e();let En;function Sn(){if(En)return En;if(H(xn.fetch))return En=xn.fetch.bind(xn);const t=xn.document;let n=xn.fetch;if(t&&"function"==typeof t.createElement)try{const e=t.createElement("iframe");e.hidden=!0,t.head.appendChild(e);const r=e.contentWindow;r&&r.fetch&&(n=r.fetch),t.head.removeChild(e)}catch(t){}return En=n.bind(xn)}const $n=e();class kn extends Zt{constructor(t){t.ot=t.ot||{},t.ot.sdk=t.ot.sdk||{name:"sentry.javascript.browser",packages:[{name:"npm:@sentry/browser",version:nn}],version:nn},super(t),t.sendClientReports&&$n.document&&$n.document.addEventListener("visibilitychange",(()=>{"hidden"===$n.document.visibilityState&&this.yt()}))}eventFromException(t,n){return function(t,n,e,r){const i=dn(t,n,e&&e.syntheticException||void 0,r);return ut(i),i.level="error",e&&e.event_id&&(i.event_id=e.event_id),vt(i)}(this.Z.stackParser,t,n,this.Z.attachStacktrace)}eventFromMessage(t,n="info",e){return function(t,n,e="info",r,i){const s=pn(t,n,r&&r.syntheticException||void 0,i);return s.level=e,r&&r.event_id&&(s.event_id=r.event_id),vt(s)}(this.Z.stackParser,t,n,e,this.Z.attachStacktrace)}sendEvent(t,n){const e=this.getIntegrationById(yn);e&&e.options&&e.options.sentry&&Ht().addBreadcrumb({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:st(t)},{event:t}),super.sendEvent(t,n)}ct(t,n,e){return t.platform=t.platform||"javascript",super.ct(t,n,e)}yt(){const t=this.dt();if(0===t.length)return;if(!this.tt)return;const n=Jt(this.tt,this.Z.tunnel),e=(r=t,Et((i=this.Z.tunnel&&b(this.tt))?{dsn:i}:{},[[{type:"client_report"},{timestamp:s||wt(),discarded_events:r}]]));var r,i,s;try{!function(t,n){"[object Navigator]"===Object.prototype.toString.call(xn&&xn.navigator)&&"function"==typeof xn.navigator.sendBeacon?xn.navigator.sendBeacon.bind(xn.navigator)(t,n):P()&&Sn()(t,{body:n,method:"POST",credentials:"omit",keepalive:!0}).then(null,(t=>{}))}(n,Ot(e))}catch(t){}}}function On(t,n=Sn()){return tn(t,(function(e){const r={body:e.body,method:"POST",referrerPolicy:"origin",headers:t.headers,...t.fetchOptions};return n(t.url,r).then((t=>({statusCode:t.status,headers:{"x-sentry-rate-limits":t.headers.get("X-Sentry-Rate-Limits"),"retry-after":t.headers.get("Retry-After")}})))}))}function jn(t){return tn(t,(function(n){return new pt(((e,r)=>{const i=new XMLHttpRequest;i.onerror=r,i.onreadystatechange=()=>{4===i.readyState&&e({statusCode:i.status,headers:{"x-sentry-rate-limits":i.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":i.getResponseHeader("Retry-After")}})},i.open("POST",t.url);for(const n in t.headers)Object.prototype.hasOwnProperty.call(t.headers,n)&&i.setRequestHeader(n,t.headers[n]);i.send(n.body)}))}))}const Tn="?";function Dn(t,n,e,r){const i={filename:t,function:n,in_app:!0};return void 0!==e&&(i.lineno=e),void 0!==r&&(i.colno=r),i}const Rn=/^\s*at (?:(.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,In=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mn=[30,t=>{const n=Rn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=In.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,e]=zn(n[1]||Tn,n[2]);return Dn(e,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],Cn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Nn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=[50,t=>{const n=Cn.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const t=Nn.exec(n[3]);t&&(n[1]=n[1]||"eval",n[3]=t[1],n[4]=t[2],n[5]="")}let t=n[3],e=n[1]||Tn;return[e,t]=zn(e,t),Dn(t,e,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}}],Ln=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Un=[40,t=>{const n=Ln.exec(t);return n?Dn(n[2],n[1]||Tn,+n[3],n[4]?+n[4]:void 0):void 0}],qn=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,Pn=[10,t=>{const n=qn.exec(t);return n?Dn(n[2],n[3]||Tn,+n[1]):void 0}],Hn=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,Fn=[20,t=>{const n=Hn.exec(t);return n?Dn(n[5],n[3]||n[4]||Tn,+n[1],+n[2]):void 0}],Bn=[Mn,An,Un],Xn=L(...Bn),zn=(t,n)=>{const e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Tn,e?`safari-extension:${n}`:`safari-web-extension:${n}`]:[t,n]};let Wn=0;function Jn(){return Wn>0}function Kn(){Wn+=1,setTimeout((()=>{Wn-=1}))}function Gn(t,n={},e){if("function"!=typeof t)return t;try{const n=t.__sentry_wrapped__;if(n)return n;if(D(t))return t}catch(n){return t}const sentryWrapped=function(){const r=Array.prototype.slice.call(arguments);try{e&&"function"==typeof e&&e.apply(this,arguments);const i=r.map((t=>Gn(t,n)));return t.apply(this,i)}catch(t){throw Kn(),Xt((e=>{e.addEventProcessor((t=>(n.mechanism&&(ot(t,void 0,void 0),ut(t,n.mechanism)),t.extra={...t.extra,arguments:r},t))),captureException(t)})),t}};try{for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(sentryWrapped[n]=t[n])}catch(t){}T(sentryWrapped,t),j(t,"__sentry_wrapped__",sentryWrapped);try{Object.getOwnPropertyDescriptor(sentryWrapped,"name").configurable&&Object.defineProperty(sentryWrapped,"name",{get:()=>t.name})}catch(t){}return sentryWrapped}class Vn{static __initStatic(){this.id="GlobalHandlers"}__init(){this.name=Vn.id}__init2(){this.gt={onerror:Qn,onunhandledrejection:Yn}}constructor(t){Vn.prototype.__init.call(this),Vn.prototype.__init2.call(this),this.Z={onerror:!0,onunhandledrejection:!0,...t}}setupOnce(){Error.stackTraceLimit=50;const t=this.Z;for(const n in t){const e=this.gt[n];e&&t[n]&&(e(),this.gt[n]=void 0)}}}function Qn(){W("error",(t=>{const[n,e,r]=ne();if(!n.getIntegration(Vn))return;const{msg:i,url:s,line:o,column:a,error:f}=t;if(Jn()||f&&f.__sentry_own_request__)return;const h=void 0===f&&c(i)?function(t,n,e,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let s=u(t)?t.message:t,o="Error";const a=s.match(i);a&&(o=a[1],s=a[2]);return Zn({exception:{values:[{type:o,value:s}]}},n,e,r)}(i,s,o,a):Zn(dn(e,f||i,void 0,r,!1),s,o,a);h.level="error",te(n,f,h,"onerror")}))}function Yn(){W("unhandledrejection",(t=>{const[n,e,r]=ne();if(!n.getIntegration(Vn))return;let i=t;try{"reason"in t?i=t.reason:"detail"in t&&"reason"in t.detail&&(i=t.detail.reason)}catch(t){}if(Jn()||i&&i.__sentry_own_request__)return!0;const s=f(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:dn(e,i,void 0,r,!0);s.level="error",te(n,i,s,"onunhandledrejection")}))}function Zn(t,n,r,i){const s=t.exception=t.exception||{},o=s.values=s.values||[],u=o[0]=o[0]||{},a=u.stacktrace=u.stacktrace||{},f=a.frames=a.frames||[],h=isNaN(parseInt(i,10))?void 0:i,l=isNaN(parseInt(r,10))?void 0:r,v=c(n)&&n.length>0?n:function(){var t=e();try{return t.document.location.href}catch(t){return""}}();return 0===f.length&&f.push({colno:h,filename:v,function:"?",in_app:!0,lineno:l}),t}function te(t,n,e,r){ut(e,{handled:!1,type:r}),t.captureEvent(e,{originalException:n})}function ne(){const t=Ht(),n=t.getClient(),e=n&&n.getOptions()||{stackParser:()=>[],attachStacktrace:!1};return[t,e.stackParser,e.attachStacktrace]}Vn.__initStatic();const ee=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];class re{static __initStatic(){this.id="TryCatch"}__init(){this.name=re.id}constructor(t){re.prototype.__init.call(this),this.Z={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t}}setupOnce(){const t=e();this.Z.setTimeout&&O(t,"setTimeout",ie),this.Z.setInterval&&O(t,"setInterval",ie),this.Z.requestAnimationFrame&&O(t,"requestAnimationFrame",se),this.Z.XMLHttpRequest&&"XMLHttpRequest"in t&&O(XMLHttpRequest.prototype,"send",oe);const n=this.Z.eventTarget;if(n){(Array.isArray(n)?n:ee).forEach(ue)}}}function ie(t){return function(...n){const e=n[0];return n[0]=Gn(e,{mechanism:{data:{function:q(t)},handled:!0,type:"instrument"}}),t.apply(this,n)}}function se(t){return function(n){return t.apply(this,[Gn(n,{mechanism:{data:{function:"requestAnimationFrame",handler:q(t)},handled:!0,type:"instrument"}})])}}function oe(t){return function(...n){const e=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((t=>{t in e&&"function"==typeof e[t]&&O(e,t,(function(n){const e={mechanism:{data:{function:t,handler:q(n)},handled:!0,type:"instrument"}},r=D(n);return r&&(e.mechanism.data.handler=q(r)),Gn(n,e)}))})),t.apply(this,n)}}function ue(t){const n=e(),r=n[t]&&n[t].prototype;r&&r.hasOwnProperty&&r.hasOwnProperty("addEventListener")&&(O(r,"addEventListener",(function(n){return function(e,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=Gn(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:q(r),target:t},handled:!0,type:"instrument"}}))}catch(t){}return n.apply(this,[e,Gn(r,{mechanism:{data:{function:"addEventListener",handler:q(r),target:t},handled:!0,type:"instrument"}}),i])}})),O(r,"removeEventListener",(function(t){return function(n,e,r){const i=e;try{const e=i&&i.__sentry_wrapped__;e&&t.call(this,n,e,r)}catch(t){}return t.call(this,n,i,r)}})))}re.__initStatic();class ae{static __initStatic(){this.id="LinkedErrors"}__init(){this.name=ae.id}constructor(t={}){ae.prototype.__init.call(this),this.bt=t.key||"cause",this._t=t.limit||5}setupOnce(){const t=Ht().getClient();t&&At(((n,e)=>{const r=Ht().getIntegration(ae);return r?function(t,n,e,r,i){if(!(r.exception&&r.exception.values&&i&&d(i.originalException,Error)))return r;const s=ce(t,e,i.originalException,n);return r.exception.values=[...s,...r.exception.values],r}(t.getOptions().stackParser,r.bt,r._t,n,e):n}))}}function ce(t,n,e,r,i=[]){if(!d(e[r],Error)||i.length+1>=n)return i;const s=cn(t,e[r]);return ce(t,n,e[r],r,[s,...i])}ae.__initStatic();const fe=e();class he{constructor(){he.prototype.__init.call(this)}static __initStatic(){this.id="HttpContext"}__init(){this.name=he.id}setupOnce(){At((t=>{if(Ht().getIntegration(he)){if(!fe.navigator&&!fe.location&&!fe.document)return t;const n=t.request&&t.request.url||fe.location&&fe.location.href,{referrer:e}=fe.document||{},{userAgent:r}=fe.navigator||{},i={...n&&{url:n},headers:{...t.request&&t.request.headers,...e&&{Referer:e},...r&&{"User-Agent":r}}};return{...t,request:i}}return t}))}}he.__initStatic();class le{constructor(){le.prototype.__init.call(this)}static __initStatic(){this.id="Dedupe"}__init(){this.name=le.id}setupOnce(t,n){const e=t=>{const e=n().getIntegration(le);if(e){try{if(function(t,n){if(!n)return!1;if(function(t,n){const e=t.message,r=n.message;if(!e&&!r)return!1;if(e&&!r||!e&&r)return!1;if(e!==r)return!1;if(!de(t,n))return!1;if(!ve(t,n))return!1;return!0}(t,n))return!0;if(function(t,n){const e=pe(n),r=pe(t);if(!e||!r)return!1;if(e.type!==r.type||e.value!==r.value)return!1;if(!de(t,n))return!1;if(!ve(t,n))return!1;return!0}(t,n))return!0;return!1}(t,e.wt))return null}catch(n){return e.wt=t}return e.wt=t}return t};e.id=this.name,t(e)}}function ve(t,n){let e=ye(t),r=ye(n);if(!e&&!r)return!0;if(e&&!r||!e&&r)return!1;if(e=e,r=r,r.length!==e.length)return!1;for(let t=0;t{void 0!==t&&t!==n&&be(Ht())}))}()},t.lastEventId=function(){return Ht().lastEventId()},t.makeFetchTransport=On,t.makeMain=Pt,t.makeXHRTransport=jn,t.onLoad=function(t){t()},t.opera10StackLineParser=Pn,t.opera11StackLineParser=Fn,t.setContext=function(t,n){Ht().setContext(t,n)},t.setExtra=function(t,n){Ht().setExtra(t,n)},t.setExtras=function(t){Ht().setExtras(t)},t.setTag=function(t,n){Ht().setTag(t,n)},t.setTags=function(t){Ht().setTags(t)},t.setUser=function(t){Ht().setUser(t)},t.showReportDialog=function(t={},n=Ht()){const r=e();if(!r.document)return;const{client:i,scope:s}=n.getStackTop(),o=t.dsn||i&&i.getDsn();if(!o)return;s&&(t.user={...s.getUser(),...t.user}),t.eventId||(t.eventId=n.lastEventId());const u=r.document.createElement("script");u.async=!0,u.src=function(t,n){var e=w(t),r=`${zt(e)}embed/error-page/`;let i=`dsn=${b(e)}`;for(var s in n)if("dsn"!==s)if("user"===s){var o=n.user;if(!o)continue;o.name&&(i+=`&name=${encodeURIComponent(o.name)}`),o.email&&(i+=`&email=${encodeURIComponent(o.email)}`)}else i+=`&${encodeURIComponent(s)}=${encodeURIComponent(n[s])}`;return`${r}?${i}`}(o,t),t.onLoad&&(u.onload=t.onLoad);const a=r.document.head||r.document.body;a&&a.appendChild(u)},t.startTransaction=function(t,n){return Ht().startTransaction({...t},n)},t.winjsStackLineParser=Un,t.withScope=Xt,t.wrap=function(t){return Gn(t)()},t}({}); +//# sourceMappingURL=bundle.min.js.map