sentry-wechat-miniprogram
Version:
@sentry/browser 的微信小程序版本。
6 lines • 57.7 kB
JavaScript
/*!
* sentry-wechat-miniprogram v0.1.3
* (c) Jay Fong <fjc0kb@gmail.com> (https://github.com/fjc0k)
* Released under the MIT License.
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var LogLevel,__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Debug=2]="Debug",e[e.Verbose=3]="Verbose"}(LogLevel||(LogLevel={})),function(e){e.Fatal="fatal",e.Error="error",e.Warning="warning",e.Log="log",e.Info="info",e.Debug="debug",e.Critical="critical"}(exports.Severity||(exports.Severity={})),function(e){e.fromString=function(t){switch(t){case"debug":return e.Debug;case"info":return e.Info;case"warn":case"warning":return e.Warning;case"error":return e.Error;case"fatal":return e.Fatal;case"critical":return e.Critical;case"log":default:return e.Log}}}(exports.Severity||(exports.Severity={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.Invalid="invalid",e.Failed="failed"}(exports.Status||(exports.Status={})),function(e){e.fromHttpCode=function(t){return t>=200&&t<300?e.Success:429===t?e.RateLimit:t>=400&&t<500?e.Invalid:t>=500?e.Failed:e.Unknown}}(exports.Status||(exports.Status={}));var setPrototypeOf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?setProtoOf:mixinProperties);function setProtoOf(e,t){return e.__proto__=t,e}function mixinProperties(e,t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n]);return e}var SentryError=function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return r.message=t,r.name=n.prototype.constructor.name,setPrototypeOf(r,n.prototype),r}return __extends(t,e),t}(Error);function isError(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}}function isErrorEvent(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}function isString(e){return"[object String]"===Object.prototype.toString.call(e)}function isPrimitive(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function isThenable(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function isSyntheticEvent(e){return isPlainObject(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function dynamicRequire(e,t){return e.require(t)}function isNodeEnv(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)}var fallbackGlobalObject={};function getGlobalObject(){return isNodeEnv()?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:fallbackGlobalObject}function uuid4(){var e=getGlobalObject(),t=e.crypto||e.msCrypto;if(void 0!==t&&t.getRandomValues){var n=new Uint16Array(8);t.getRandomValues(n),n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768;var r=function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t};return r(n[0])+r(n[1])+r(n[2])+r(n[3])+r(n[4])+r(n[5])+r(n[6])+r(n[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function getEventDescription(e){if(e.message)return e.message;if(e.exception&&e.exception.values&&e.exception.values[0]){var t=e.exception.values[0];return t.type&&t.value?t.type+": "+t.value:t.type||t.value||e.event_id||"<unknown>"}return e.event_id||"<unknown>"}function consoleSandbox(e){var t=getGlobalObject();if(!("console"in t))return e();var n=t.console,r={};["debug","info","warn","error","log","assert"].forEach(function(e){e in t.console&&n[e].__sentry__&&(r[e]=n[e].__sentry_wrapped__,n[e]=n[e].__sentry_original__)});var o=e();return Object.keys(r).forEach(function(e){n[e]=r[e]}),o}function addExceptionTypeValue(e,t,n,r){void 0===r&&(r={handled:!0,type:"generic"}),e.exception=e.exception||{},e.exception.values=e.exception.values||[],e.exception.values[0]=e.exception.values[0]||{},e.exception.values[0].value=e.exception.values[0].value||t||"",e.exception.values[0].type=e.exception.values[0].type||n||"Error",e.exception.values[0].mechanism=e.exception.values[0].mechanism||r}var global$1=getGlobalObject(),PREFIX="Sentry Logger ",Logger=function(){function e(){this._enabled=!1}return e.prototype.disable=function(){this._enabled=!1},e.prototype.enable=function(){this._enabled=!0},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&consoleSandbox(function(){global$1.console.log(PREFIX+"[Log]: "+e.join(" "))})},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&consoleSandbox(function(){global$1.console.warn(PREFIX+"[Warn]: "+e.join(" "))})},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&consoleSandbox(function(){global$1.console.error(PREFIX+"[Error]: "+e.join(" "))})},e}();global$1.__SENTRY__=global$1.__SENTRY__||{};var logger=global$1.__SENTRY__.logger||(global$1.__SENTRY__.logger=new Logger),Memo=function(){function e(){this._hasWeakSet="function"==typeof WeakSet,this._inner=this._hasWeakSet?new WeakSet:[]}return e.prototype.memoize=function(e){if(this._hasWeakSet)return!!this._inner.has(e)||(this._inner.add(e),!1);for(var t=0;t<this._inner.length;t++){if(this._inner[t]===e)return!0}return this._inner.push(e),!1},e.prototype.unmemoize=function(e){if(this._hasWeakSet)this._inner.delete(e);else for(var t=0;t<this._inner.length;t++)if(this._inner[t]===e){this._inner.splice(t,1);break}},e}();function fill(e,t,n){if(t in e){var r=e[t],o=n(r);if("function"==typeof o)try{o.prototype=o.prototype||{},Object.defineProperties(o,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:r},__sentry_wrapped__:{enumerable:!1,value:o}})}catch(e){}e[t]=o}}function urlEncode(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")}function objectifyError(e){var t={message:e.message,name:e.name,stack:e.stack};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function utf8Length(e){return~-encodeURI(e).split(/%..|./).length}function jsonSize(e){return utf8Length(JSON.stringify(e))}function normalizeToSize(e,t,n){void 0===t&&(t=3),void 0===n&&(n=102400);var r=normalize(e,t);return jsonSize(r)>n?normalizeToSize(e,t-1,n):r}function serializeValue(e){var t=Object.prototype.toString.call(e);if("string"==typeof e)return e;if("[object Object]"===t)return"[Object]";if("[object Array]"===t)return"[Array]";var n=normalizeValue(e);return isPrimitive(n)?n:t}function normalizeValue(e,t){return"domain"===t&&"object"==typeof e&&e._events?"[Domain]":"domainEmitter"===t?"[DomainEmitter]":"undefined"!=typeof global&&e===global?"[Global]":"undefined"!=typeof window&&e===window?"[Window]":"undefined"!=typeof document&&e===document?"[Document]":"undefined"!=typeof Event&&e instanceof Event?Object.getPrototypeOf(e)?e.constructor.name:"Event":isSyntheticEvent(e)?"[SyntheticEvent]":Number.isNaN(e)?"[NaN]":void 0===e?"[undefined]":"function"==typeof e?"[Function: "+(e.name||"<unknown-function-name>")+"]":e}function walk(e,t,n,r){if(void 0===n&&(n=1/0),void 0===r&&(r=new Memo),0===n)return serializeValue(t);if(null!=t&&"function"==typeof t.toJSON)return t.toJSON();var o=normalizeValue(t,e);if(isPrimitive(o))return o;var i=isError(t)?objectifyError(t):t,s=Array.isArray(t)?[]:{};if(r.memoize(t))return"[Circular ~]";for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=walk(a,i[a],n-1,r));return r.unmemoize(t),s}function normalize(e,t){try{return JSON.parse(JSON.stringify(e,function(e,n){return walk(e,n,t)}))}catch(e){return"**non-serializable**"}}var States,PromiseBuffer=function(){function e(e){this._limit=e,this._buffer=[]}return e.prototype.isReady=function(){return void 0===this._limit||this.length()<this._limit},e.prototype.add=function(e){var t=this;return this.isReady()?(-1===this._buffer.indexOf(e)&&this._buffer.push(e),e.then(function(){return t.remove(e)}).catch(function(){return t.remove(e).catch(function(){})}),e):Promise.reject(new SentryError("Not adding Promise due to buffer limit reached."))},e.prototype.remove=function(e){return this._buffer.splice(this._buffer.indexOf(e),1)[0]},e.prototype.length=function(){return this._buffer.length},e.prototype.drain=function(e){var t=this;return new Promise(function(n){var r=setTimeout(function(){e&&e>0&&n(!1)},e);Promise.all(t._buffer).then(function(){clearTimeout(r),n(!0)}).catch(function(){n(!0)})})},e}();function truncate(e,t){return void 0===t&&(t=0),"string"!=typeof e||0===t?e:e.length<=t?e:e.substr(0,t)+"..."}function safeJoin(e,t){if(!Array.isArray(e))return"";for(var n=[],r=0;r<e.length;r++){var o=e[r];try{n.push(String(o))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function keysToEventMessage(e,t){if(void 0===t&&(t=40),!e.length)return"[object has no keys]";if(e[0].length>=t)return truncate(e[0],t);for(var n=e.length;n>0;n--){var r=e.slice(0,n).join(", ");if(!(r.length>t))return n===e.length?r:truncate(r,t)}return""}function isMatchingPattern(e,t){return isRegExp(t)?t.test(e):"string"==typeof t&&e.includes(t)}!function(e){e.PENDING="PENDING",e.RESOLVED="RESOLVED",e.REJECTED="REJECTED"}(States||(States={}));var SyncPromise=function(){function e(e){var t=this;this._state=States.PENDING,this._handlers=[],this._resolve=function(e){t._setResult(e,States.RESOLVED)},this._reject=function(e){t._setResult(e,States.REJECTED)},this._setResult=function(e,n){t._state===States.PENDING&&(isThenable(e)?e.then(t._resolve,t._reject):(t._value=e,t._state=n,t._executeHandlers()))},this._executeHandlers=function(){t._state!==States.PENDING&&(t._state===States.REJECTED?t._handlers.forEach(function(e){return e.onFail&&e.onFail(t._value)}):t._handlers.forEach(function(e){return e.onSuccess&&e.onSuccess(t._value)}),t._handlers=[])},this._attachHandler=function(e){t._handlers=t._handlers.concat(e),t._executeHandlers()};try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}return e.prototype.then=function(t,n){var r=this;return new e(function(e,o){r._attachHandler({onFail:function(t){if(n)try{return void e(n(t))}catch(e){return void o(e)}else o(t)},onSuccess:function(n){if(t)try{return void e(t(n))}catch(e){return void o(e)}else e(n)}})})},e.prototype.catch=function(e){return this.then(function(e){return e},e)},e.prototype.toString=function(){return"[object SyncPromise]"},e.resolve=function(t){return new e(function(e){e(t)})},e.reject=function(t){return new e(function(e,n){n(t)})},e}(),TRACEPARENT_REGEXP=/^[ \t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \t]*$/,Span=function(){function e(e,t,n,r){void 0===e&&(e=uuid4()),void 0===t&&(t=uuid4().substring(16)),this._traceId=e,this._spanId=t,this._sampled=n,this._parent=r}return e.prototype.setParent=function(e){return this._parent=e,this},e.prototype.setSampled=function(e){return this._sampled=e,this},e.fromTraceparent=function(t){var n=t.match(TRACEPARENT_REGEXP);if(n){var r=void 0;"1"===n[3]?r=!0:"0"===n[3]&&(r=!1);var o=new e(n[1],n[2],r);return new e(n[1],void 0,r,o)}},e.prototype.toTraceparent=function(){var e="";return!0===this._sampled?e="-1":!1===this._sampled&&(e="-0"),this._traceId+"-"+this._spanId+e},e.prototype.toJSON=function(){return{parent:this._parent&&this._parent.toJSON()||void 0,sampled:this._sampled,span_id:this._spanId,trace_id:this._traceId}},e}(),Scope=function(){function e(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._user={},this._tags={},this._extra={},this._context={}}return e.prototype.addScopeListener=function(e){this._scopeListeners.push(e)},e.prototype.addEventProcessor=function(e){return this._eventProcessors.push(e),this},e.prototype._notifyScopeListeners=function(){var e=this;this._notifyingListeners||(this._notifyingListeners=!0,setTimeout(function(){e._scopeListeners.forEach(function(t){t(e)}),e._notifyingListeners=!1}))},e.prototype._notifyEventProcessors=function(e,t,n,r){var o=this;return void 0===r&&(r=0),new SyncPromise(function(i,s){var a=e[r];if(null===t||"function"!=typeof a)i(t);else{var c=a(__assign({},t),n);isThenable(c)?c.then(function(t){return o._notifyEventProcessors(e,t,n,r+1).then(i)}).catch(s):o._notifyEventProcessors(e,c,n,r+1).then(i).catch(s)}})},e.prototype.setUser=function(e){return this._user=normalize(e),this._notifyScopeListeners(),this},e.prototype.setTags=function(e){return this._tags=__assign({},this._tags,normalize(e)),this._notifyScopeListeners(),this},e.prototype.setTag=function(e,t){var n;return this._tags=__assign({},this._tags,((n={})[e]=normalize(t),n)),this._notifyScopeListeners(),this},e.prototype.setExtras=function(e){return this._extra=__assign({},this._extra,normalize(e)),this._notifyScopeListeners(),this},e.prototype.setExtra=function(e,t){var n;return this._extra=__assign({},this._extra,((n={})[e]=normalize(t),n)),this._notifyScopeListeners(),this},e.prototype.setFingerprint=function(e){return this._fingerprint=normalize(e),this._notifyScopeListeners(),this},e.prototype.setLevel=function(e){return this._level=normalize(e),this._notifyScopeListeners(),this},e.prototype.setTransaction=function(e){return this._transaction=e,this._notifyScopeListeners(),this},e.prototype.setContext=function(e,t){return this._context[e]=t?normalize(t):void 0,this._notifyScopeListeners(),this},e.prototype.setSpan=function(e){return this._span=e,this._notifyScopeListeners(),this},e.prototype.startSpan=function(e){var t=new Span;return t.setParent(e),this.setSpan(t),t},e.prototype.getSpan=function(){return this._span},e.clone=function(t){var n=new e;return Object.assign(n,t,{_scopeListeners:[]}),t&&(n._breadcrumbs=__spread(t._breadcrumbs),n._tags=__assign({},t._tags),n._extra=__assign({},t._extra),n._context=__assign({},t._context),n._user=t._user,n._level=t._level,n._span=t._span,n._transaction=t._transaction,n._fingerprint=t._fingerprint,n._eventProcessors=__spread(t._eventProcessors)),n},e.prototype.clear=function(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._context={},this._level=void 0,this._transaction=void 0,this._fingerprint=void 0,this._span=void 0,this._notifyScopeListeners(),this},e.prototype.addBreadcrumb=function(e,t){var n=(new Date).getTime()/1e3,r=__assign({timestamp:n},e);return this._breadcrumbs=void 0!==t&&t>=0?__spread(this._breadcrumbs,[normalize(r)]).slice(-t):__spread(this._breadcrumbs,[normalize(r)]),this._notifyScopeListeners(),this},e.prototype.clearBreadcrumbs=function(){return this._breadcrumbs=[],this._notifyScopeListeners(),this},e.prototype._applyFingerprint=function(e){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],this._fingerprint&&(e.fingerprint=e.fingerprint.concat(this._fingerprint)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint},e.prototype.applyToEvent=function(e,t){return this._extra&&Object.keys(this._extra).length&&(e.extra=__assign({},this._extra,e.extra)),this._tags&&Object.keys(this._tags).length&&(e.tags=__assign({},this._tags,e.tags)),this._user&&Object.keys(this._user).length&&(e.user=__assign({},this._user,e.user)),this._context&&Object.keys(this._context).length&&(e.contexts=__assign({},this._context,e.contexts)),this._level&&(e.level=this._level),this._transaction&&(e.transaction=this._transaction),this._span&&(e.contexts=e.contexts||{},e.contexts.trace=this._span),this._applyFingerprint(e),e.breadcrumbs=__spread(e.breadcrumbs||[],this._breadcrumbs),e.breadcrumbs=e.breadcrumbs.length>0?e.breadcrumbs:void 0,this._notifyEventProcessors(__spread(getGlobalEventProcessors(),this._eventProcessors),e,t)},e}();function getGlobalEventProcessors(){var e=getGlobalObject();return e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.globalEventProcessors=e.__SENTRY__.globalEventProcessors||[],e.__SENTRY__.globalEventProcessors}function addGlobalEventProcessor(e){getGlobalEventProcessors().push(e)}var API_VERSION=3,DEFAULT_BREADCRUMBS=30,MAX_BREADCRUMBS=100,Hub=function(){function e(e,t,n){void 0===t&&(t=new Scope),void 0===n&&(n=API_VERSION),this._version=n,this._stack=[],this._stack.push({client:e,scope:t})}return e.prototype._invokeClient=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.getStackTop();o&&o.client&&o.client[e]&&(t=o.client)[e].apply(t,__spread(n,[o.scope]))},e.prototype.isOlderThan=function(e){return this._version<e},e.prototype.bindClient=function(e){this.getStackTop().client=e},e.prototype.pushScope=function(){var e=this.getStack(),t=e.length>0?e[e.length-1].scope:void 0,n=Scope.clone(t);return this.getStack().push({client:this.getClient(),scope:n}),n},e.prototype.popScope=function(){return void 0!==this.getStack().pop()},e.prototype.withScope=function(e){var t=this.pushScope();try{e(t)}finally{this.popScope()}},e.prototype.getClient=function(){return this.getStackTop().client},e.prototype.getScope=function(){return this.getStackTop().scope},e.prototype.getStack=function(){return this._stack},e.prototype.getStackTop=function(){return this._stack[this._stack.length-1]},e.prototype.captureException=function(e,t){var n=this._lastEventId=uuid4(),r=t;if(!t){var o=void 0;try{throw new Error("Sentry syntheticException")}catch(e){o=e}r={originalException:e,syntheticException:o}}return this._invokeClient("captureException",e,__assign({},r,{event_id:n})),n},e.prototype.captureMessage=function(e,t,n){var r=this._lastEventId=uuid4(),o=n;if(!n){var i=void 0;try{throw new Error(e)}catch(e){i=e}o={originalException:e,syntheticException:i}}return this._invokeClient("captureMessage",e,t,__assign({},o,{event_id:r})),r},e.prototype.captureEvent=function(e,t){var n=this._lastEventId=uuid4();return this._invokeClient("captureEvent",e,__assign({},t,{event_id:n})),n},e.prototype.lastEventId=function(){return this._lastEventId},e.prototype.addBreadcrumb=function(e,t){var n=this.getStackTop();if(n.scope&&n.client){var r=n.client.getOptions&&n.client.getOptions()||{},o=r.beforeBreadcrumb,i=void 0===o?null:o,s=r.maxBreadcrumbs,a=void 0===s?DEFAULT_BREADCRUMBS:s;if(!(a<=0)){var c=(new Date).getTime()/1e3,u=__assign({timestamp:c},e),l=i?consoleSandbox(function(){return i(u,t)}):u;null!==l&&n.scope.addBreadcrumb(l,Math.min(a,MAX_BREADCRUMBS))}}},e.prototype.setUser=function(e){var t=this.getStackTop();t.scope&&t.scope.setUser(e)},e.prototype.setTags=function(e){var t=this.getStackTop();t.scope&&t.scope.setTags(e)},e.prototype.setExtras=function(e){var t=this.getStackTop();t.scope&&t.scope.setExtras(e)},e.prototype.setTag=function(e,t){var n=this.getStackTop();n.scope&&n.scope.setTag(e,t)},e.prototype.setExtra=function(e,t){var n=this.getStackTop();n.scope&&n.scope.setExtra(e,t)},e.prototype.setContext=function(e,t){var n=this.getStackTop();n.scope&&n.scope.setContext(e,t)},e.prototype.configureScope=function(e){var t=this.getStackTop();t.scope&&t.client&&e(t.scope)},e.prototype.run=function(e){var t=makeMain(this);try{e(this)}finally{makeMain(t)}},e.prototype.getIntegration=function(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return logger.warn("Cannot retrieve integration "+e.id+" from the current Hub"),null}},e.prototype.traceHeaders=function(){var e=this.getStackTop();if(e.scope&&e.client){var t=e.scope.getSpan();if(t)return{"sentry-trace":t.toTraceparent()}}return{}},e}();function getMainCarrier(){var e=getGlobalObject();return e.__SENTRY__=e.__SENTRY__||{hub:void 0},e}function makeMain(e){var t=getMainCarrier(),n=getHubFromCarrier(t);return setHubOnCarrier(t,e),n}function getCurrentHub(){var e=getMainCarrier();hasHubOnCarrier(e)&&!getHubFromCarrier(e).isOlderThan(API_VERSION)||setHubOnCarrier(e,new Hub);try{var t=dynamicRequire(module,"domain").active;if(!t)return getHubFromCarrier(e);if(!hasHubOnCarrier(t)||getHubFromCarrier(t).isOlderThan(API_VERSION)){var n=getHubFromCarrier(e).getStackTop();setHubOnCarrier(t,new Hub(n.client,Scope.clone(n.scope)))}return getHubFromCarrier(t)}catch(t){return getHubFromCarrier(e)}}function hasHubOnCarrier(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function getHubFromCarrier(e){return e&&e.__SENTRY__&&e.__SENTRY__.hub?e.__SENTRY__.hub:(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=new Hub,e.__SENTRY__.hub)}function setHubOnCarrier(e,t){return!!e&&(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=t,!0)}function callOnHub(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=getCurrentHub();if(r&&r[e])return r[e].apply(r,__spread(t));throw new Error("No hub defined or "+e+" was not found on the hub, please open a bug report.")}function captureException(e){var t;try{throw new Error("Sentry syntheticException")}catch(e){t=e}return callOnHub("captureException",e,{originalException:e,syntheticException:t})}function captureMessage(e,t){var n;try{throw new Error(e)}catch(e){n=e}return callOnHub("captureMessage",e,t,{originalException:e,syntheticException:n})}function captureEvent(e){return callOnHub("captureEvent",e)}function configureScope(e){callOnHub("configureScope",e)}function addBreadcrumb(e){callOnHub("addBreadcrumb",e)}function setContext(e,t){callOnHub("setContext",e,t)}function setExtras(e){callOnHub("setExtras",e)}function setTags(e){callOnHub("setTags",e)}function setExtra(e,t){callOnHub("setExtra",e,t)}function setTag(e,t){callOnHub("setTag",e,t)}function setUser(e){callOnHub("setUser",e)}function withScope(e){callOnHub("withScope",e)}var DSN_REGEX=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/,ERROR_MESSAGE="Invalid Dsn",Dsn=function(){function e(e){"string"==typeof e?this._fromString(e):this._fromComponents(e),this._validate()}return e.prototype.toString=function(e){void 0===e&&(e=!1);var t=this,n=t.host,r=t.path,o=t.pass,i=t.port,s=t.projectId;return t.protocol+"://"+t.user+(e&&o?":"+o:"")+"@"+n+(i?":"+i:"")+"/"+(r?r+"/":r)+s},e.prototype._fromString=function(e){var t=DSN_REGEX.exec(e);if(!t)throw new SentryError(ERROR_MESSAGE);var n=__read(t.slice(1),6),r=n[0],o=n[1],i=n[2],s=void 0===i?"":i,a=n[3],c=n[4],u=void 0===c?"":c,l="",p=n[5],f=p.split("/");f.length>1&&(l=f.slice(0,-1).join("/"),p=f.pop()),Object.assign(this,{host:a,pass:s,path:l,projectId:p,port:u,protocol:r,user:o})},e.prototype._fromComponents=function(e){this.protocol=e.protocol,this.user=e.user,this.pass=e.pass||"",this.host=e.host,this.port=e.port||"",this.path=e.path||"",this.projectId=e.projectId},e.prototype._validate=function(){var e=this;if(["protocol","user","host","projectId"].forEach(function(t){if(!e[t])throw new SentryError(ERROR_MESSAGE)}),"http"!==this.protocol&&"https"!==this.protocol)throw new SentryError(ERROR_MESSAGE);if(this.port&&Number.isNaN(parseInt(this.port,10)))throw new SentryError(ERROR_MESSAGE)},e}(),SENTRY_API_VERSION="7",API=function(){function e(e){this.dsn=e,this._dsnObject=new Dsn(e)}return e.prototype.getDsn=function(){return this._dsnObject},e.prototype.getStoreEndpoint=function(){return""+this._getBaseUrl()+this.getStoreEndpointPath()},e.prototype.getStoreEndpointWithUrlEncodedAuth=function(){var e={sentry_key:this._dsnObject.user,sentry_version:SENTRY_API_VERSION};return this.getStoreEndpoint()+"?"+urlEncode(e)},e.prototype._getBaseUrl=function(){var e=this._dsnObject,t=e.protocol?e.protocol+":":"",n=e.port?":"+e.port:"";return t+"//"+e.host+n},e.prototype.getStoreEndpointPath=function(){var e=this._dsnObject;return(e.path?"/"+e.path:"")+"/api/"+e.projectId+"/store/"},e.prototype.getRequestHeaders=function(e,t){var n=this._dsnObject,r=["Sentry sentry_version="+SENTRY_API_VERSION];return r.push("sentry_timestamp="+(new Date).getTime()),r.push("sentry_client="+e+"/"+t),r.push("sentry_key="+n.user),n.pass&&r.push("sentry_secret="+n.pass),{"Content-Type":"application/json","X-Sentry-Auth":r.join(", ")}},e.prototype.getReportDialogEndpoint=function(e){void 0===e&&(e={});var t=this._dsnObject,n=this._getBaseUrl()+(t.path?"/"+t.path:"")+"/api/embed/error-page/",r=[];for(var o in r.push("dsn="+t.toString()),e)if("user"===o){if(!e.user)continue;e.user.name&&r.push("name="+encodeURIComponent(e.user.name)),e.user.email&&r.push("email="+encodeURIComponent(e.user.email))}else r.push(encodeURIComponent(o)+"="+encodeURIComponent(e[o]));return r.length?n+"?"+r.join("&"):n},e}(),installedIntegrations=[];function getIntegrationsToSetup(e){var t=e.defaultIntegrations&&__spread(e.defaultIntegrations)||[],n=e.integrations,r=[];if(Array.isArray(n)){var o=n.map(function(e){return e.name}),i=[];t.forEach(function(e){-1===o.indexOf(e.name)&&-1===i.indexOf(e.name)&&(r.push(e),i.push(e.name))}),n.forEach(function(e){-1===i.indexOf(e.name)&&(r.push(e),i.push(e.name))})}else{if("function"!=typeof n)return __spread(t);r=n(t),r=Array.isArray(r)?r:[r]}return r}function setupIntegration(e){-1===installedIntegrations.indexOf(e.name)&&(e.setupOnce(addGlobalEventProcessor,getCurrentHub),installedIntegrations.push(e.name),logger.log("Integration installed: "+e.name))}function setupIntegrations(e){var t={};return getIntegrationsToSetup(e).forEach(function(e){t[e.name]=e,setupIntegration(e)}),t}var originalFunctionToString,BaseClient=function(){function e(e,t){this._processing=!1,this._backend=new e(t),this._options=t,t.dsn&&(this._dsn=new Dsn(t.dsn)),this._integrations=setupIntegrations(this._options)}return e.prototype.captureException=function(e,t,n){var r=this,o=t&&t.event_id;return this._processing=!0,this._getBackend().eventFromException(e,t).then(function(e){return r._processEvent(e,t,n)}).then(function(e){o=e&&e.event_id,r._processing=!1}).catch(function(e){logger.error(e),r._processing=!1}),o},e.prototype.captureMessage=function(e,t,n,r){var o=this,i=n&&n.event_id;return this._processing=!0,(isPrimitive(e)?this._getBackend().eventFromMessage(""+e,t,n):this._getBackend().eventFromException(e,n)).then(function(e){return o._processEvent(e,n,r)}).then(function(e){i=e&&e.event_id,o._processing=!1}).catch(function(e){logger.error(e),o._processing=!1}),i},e.prototype.captureEvent=function(e,t,n){var r=this,o=t&&t.event_id;return this._processing=!0,this._processEvent(e,t,n).then(function(e){o=e&&e.event_id,r._processing=!1}).catch(function(e){logger.error(e),r._processing=!1}),o},e.prototype.getDsn=function(){return this._dsn},e.prototype.getOptions=function(){return this._options},e.prototype.flush=function(e){var t=this;return this._isClientProcessing(e).then(function(n){return clearInterval(n.interval),t._getBackend().getTransport().close(e).then(function(e){return n.ready&&e})})},e.prototype.close=function(e){var t=this;return this.flush(e).then(function(e){return t.getOptions().enabled=!1,e})},e.prototype.getIntegrations=function(){return this._integrations||{}},e.prototype.getIntegration=function(e){try{return this._integrations[e.id]||null}catch(t){return logger.warn("Cannot retrieve integration "+e.id+" from the current Client"),null}},e.prototype._isClientProcessing=function(e){var t=this;return new Promise(function(n){var r=0,o=0;clearInterval(o),o=setInterval(function(){t._processing?(r+=1,e&&r>=e&&n({interval:o,ready:!1})):n({interval:o,ready:!0})},1)})},e.prototype._getBackend=function(){return this._backend},e.prototype._isEnabled=function(){return!1!==this.getOptions().enabled&&void 0!==this._dsn},e.prototype._prepareEvent=function(e,t,n){var r=this.getOptions(),o=r.environment,i=r.release,s=r.dist,a=r.maxValueLength,c=void 0===a?250:a,u=__assign({},e);void 0===u.environment&&void 0!==o&&(u.environment=o),void 0===u.release&&void 0!==i&&(u.release=i),void 0===u.dist&&void 0!==s&&(u.dist=s),u.message&&(u.message=truncate(u.message,c));var l=u.exception&&u.exception.values&&u.exception.values[0];l&&l.value&&(l.value=truncate(l.value,c));var p=u.request;p&&p.url&&(p.url=truncate(p.url,c)),void 0===u.event_id&&(u.event_id=uuid4()),this._addIntegrations(u.sdk);var f=SyncPromise.resolve(u);return t&&(f=t.applyToEvent(u,n)),f},e.prototype._addIntegrations=function(e){var t=Object.keys(this._integrations);e&&t.length>0&&(e.integrations=t)},e.prototype._processEvent=function(e,t,n){var r=this,o=this.getOptions(),i=o.beforeSend,s=o.sampleRate;return this._isEnabled()?"number"==typeof s&&Math.random()>s?SyncPromise.reject("This event has been sampled, will not send event."):new SyncPromise(function(o,s){r._prepareEvent(e,n,t).then(function(e){if(null!==e){var n=e;try{if(t&&t.data&&!0===t.data.__sentry__||!i)return r._getBackend().sendEvent(n),void o(n);var a=i(e,t);if(void 0===a)logger.error("`beforeSend` method has to return `null` or a valid event.");else if(isThenable(a))r._handleAsyncBeforeSend(a,o,s);else{if(null===(n=a))return logger.log("`beforeSend` returned `null`, will not send event."),void o(null);r._getBackend().sendEvent(n),o(n)}}catch(e){r.captureException(e,{data:{__sentry__:!0},originalException:e}),s("`beforeSend` throw an error, will not send event.")}}else s("An event processor returned null, will not send event.")})}):SyncPromise.reject("SDK not enabled, will not send event.")},e.prototype._handleAsyncBeforeSend=function(e,t,n){var r=this;e.then(function(e){null!==e?(r._getBackend().sendEvent(e),t(e)):n("`beforeSend` returned `null`, will not send event.")}).catch(function(e){n("beforeSend rejected with "+e)})},e}(),NoopTransport=function(){function e(){}return e.prototype.sendEvent=function(e){return Promise.resolve({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:exports.Status.Skipped})},e.prototype.close=function(e){return Promise.resolve(!0)},e}(),BaseBackend=function(){function e(e){this._options=e,this._options.dsn||logger.warn("No DSN provided, backend will not do anything."),this._transport=this._setupTransport()}return e.prototype._setupTransport=function(){return new NoopTransport},e.prototype.eventFromException=function(e,t){throw new SentryError("Backend has to implement `eventFromException` method")},e.prototype.eventFromMessage=function(e,t,n){throw new SentryError("Backend has to implement `eventFromMessage` method")},e.prototype.sendEvent=function(e){this._transport.sendEvent(e).catch(function(e){logger.error("Error while sending event: "+e)})},e.prototype.getTransport=function(){return this._transport},e}();function initAndBind(e,t){!0===t.debug&&logger.enable(),getCurrentHub().bindClient(new e(t))}var FunctionToString=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(){originalFunctionToString=Function.prototype.toString,Function.prototype.toString=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.__sentry__?this.__sentry_original__:this;return originalFunctionToString.apply(n,e)}},e.id="FunctionToString",e}(),DEFAULT_IGNORE_ERRORS=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],InboundFilters=function(){function e(t){void 0===t&&(t={}),this._options=t,this.name=e.id}return e.prototype.setupOnce=function(){addGlobalEventProcessor(function(t){var n=getCurrentHub();if(!n)return t;var r=n.getIntegration(e);if(r){var o=n.getClient(),i=o?o.getOptions():{},s=r._mergeOptions(i);if(r._shouldDropEvent(t,s))return null}return t})},e.prototype._shouldDropEvent=function(e,t){return this._isSentryError(e,t)?(logger.warn("Event dropped due to being internal Sentry Error.\nEvent: "+getEventDescription(e)),!0):this._isIgnoredError(e,t)?(logger.warn("Event dropped due to being matched by `ignoreErrors` option.\nEvent: "+getEventDescription(e)),!0):this._isBlacklistedUrl(e,t)?(logger.warn("Event dropped due to being matched by `blacklistUrls` option.\nEvent: "+getEventDescription(e)+".\nUrl: "+this._getEventFilterUrl(e)),!0):!this._isWhitelistedUrl(e,t)&&(logger.warn("Event dropped due to not being matched by `whitelistUrls` option.\nEvent: "+getEventDescription(e)+".\nUrl: "+this._getEventFilterUrl(e)),!0)},e.prototype._isSentryError=function(e,t){if(void 0===t&&(t={}),!t.ignoreInternal)return!1;try{return"SentryError"===e.exception.values[0].type}catch(e){return!1}},e.prototype._isIgnoredError=function(e,t){return void 0===t&&(t={}),!(!t.ignoreErrors||!t.ignoreErrors.length)&&this._getPossibleEventMessages(e).some(function(e){return t.ignoreErrors.some(function(t){return isMatchingPattern(e,t)})})},e.prototype._isBlacklistedUrl=function(e,t){if(void 0===t&&(t={}),!t.blacklistUrls||!t.blacklistUrls.length)return!1;var n=this._getEventFilterUrl(e);return!!n&&t.blacklistUrls.some(function(e){return isMatchingPattern(n,e)})},e.prototype._isWhitelistedUrl=function(e,t){if(void 0===t&&(t={}),!t.whitelistUrls||!t.whitelistUrls.length)return!0;var n=this._getEventFilterUrl(e);return!n||t.whitelistUrls.some(function(e){return isMatchingPattern(n,e)})},e.prototype._mergeOptions=function(e){return void 0===e&&(e={}),{blacklistUrls:__spread(this._options.blacklistUrls||[],e.blacklistUrls||[]),ignoreErrors:__spread(this._options.ignoreErrors||[],e.ignoreErrors||[],DEFAULT_IGNORE_ERRORS),ignoreInternal:void 0===this._options.ignoreInternal||this._options.ignoreInternal,whitelistUrls:__spread(this._options.whitelistUrls||[],e.whitelistUrls||[])}},e.prototype._getPossibleEventMessages=function(e){if(e.message)return[e.message];if(e.exception)try{var t=e.exception.values[0],n=t.type,r=t.value;return[""+r,n+": "+r]}catch(t){return logger.error("Cannot extract message for event "+getEventDescription(e)),[]}return[]},e.prototype._getEventFilterUrl=function(e){try{if(e.stacktrace){var t=e.stacktrace.frames;return t[t.length-1].filename}if(e.exception){var n=e.exception.values[0].stacktrace.frames;return n[n.length-1].filename}return null}catch(t){return logger.error("Cannot extract url for event "+getEventDescription(e)),null}},e.id="InboundFilters",e}(),CoreIntegrations=Object.freeze({FunctionToString:FunctionToString,InboundFilters:InboundFilters}),SDK_NAME="sentry.javascript.wechat-miniprogram",SDK_VERSION='"0.1.3"',window$1=getGlobalObject(),TraceKit={_report:!1,_collectWindowErrors:!1,_computeStackTrace:!1,_linesOfContext:!1},UNKNOWN_FUNCTION="?",ERROR_TYPES_RE=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function _has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function getLocationHref(){return"undefined"==typeof document||null==document.location?"":document.location.href}TraceKit._report=function(){var e,t,n=[],r=null,o=null;function i(e,t,r){var o=null;if(!t||TraceKit._collectWindowErrors){for(var i in n)if(_has(n,i))try{n[i](e,t,r)}catch(e){o=e}if(o)throw o}}function s(t,n,r,s,a){var u=null;if(a=isErrorEvent(a)?a.error:a,t=isErrorEvent(t)?t.message:t,o)TraceKit._computeStackTrace._augmentStackTraceWithInitialElement(o,n,r,t),c();else if(a&&isError(a))(u=TraceKit._computeStackTrace(a)).mechanism="onerror",i(u,!0,a);else{var l,p={url:n,line:r,column:s},f=t;if("[object String]"==={}.toString.call(t)){var _=t.match(ERROR_TYPES_RE);_&&(l=_[1],f=_[2])}p.func=UNKNOWN_FUNCTION,p.context=null,i(u={name:l,message:f,mode:"onerror",mechanism:"onerror",stack:[__assign({},p,{url:p.url||getLocationHref()})]},!0,null)}return!!e&&e.apply(this,arguments)}function a(e){var t=e&&(e.detail?e.detail.reason:e.reason)||e,n=TraceKit._computeStackTrace(t);n.mechanism="onunhandledrejection",n.message||(n.message=JSON.stringify(normalize(t))),i(n,!0,t)}function c(){var e=o,t=r;o=null,r=null,i(e,!1,t)}function u(e){if(o){if(r===e)return;c()}var t=TraceKit._computeStackTrace(e);throw o=t,r=e,setTimeout(function(){r===e&&c()},t.incomplete?2e3:0),e}return u._subscribe=function(e){n.push(e)},u._installGlobalHandler=function(){!0!==t&&(e=window$1.onerror,window$1.onerror=s,t=!0)},u._installGlobalUnhandledRejectionHandler=function(){window$1.onunhandledrejection=a},u}(),TraceKit._computeStackTrace=function(){function e(e){if(!e||!e.stack)return null;for(var t,n,r,o=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,i=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,a=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,u=e.stack.split("\n"),l=[],p=/^(.*) is undefined$/.exec(e.message),f=0,_=u.length;f<_;++f){if(n=o.exec(u[f])){var d=n[2]&&0===n[2].indexOf("native");n[2]&&0===n[2].indexOf("eval")&&(t=c.exec(n[2]))&&(n[2]=t[1],n[3]=t[2],n[4]=t[3]),r={url:n[2],func:n[1]||UNKNOWN_FUNCTION,args:d?[n[2]]:[],line:n[3]?+n[3]:null,column:n[4]?+n[4]:null}}else if(n=s.exec(u[f]))r={url:n[2],func:n[1]||UNKNOWN_FUNCTION,args:[],line:+n[3],column:n[4]?+n[4]:null};else{if(!(n=i.exec(u[f])))continue;n[3]&&n[3].indexOf(" > eval")>-1&&(t=a.exec(n[3]))?(n[1]=n[1]||"eval",n[3]=t[1],n[4]=t[2],n[5]=""):0!==f||n[5]||void 0===e.columnNumber||(l[0].column=e.columnNumber+1),r={url:n[3],func:n[1]||UNKNOWN_FUNCTION,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}!r.func&&r.line&&(r.func=UNKNOWN_FUNCTION),r.context=null,l.push(r)}return l.length?(l[0]&&l[0].line&&!l[0].column&&p&&(l[0].column=null),{mode:"stack",name:e.name,message:e.message,stack:l}):null}function t(e,t,n,r){var o={url:t,line:n};if(o.url&&o.line){if(e.incomplete=!1,o.func||(o.func=UNKNOWN_FUNCTION),o.context||(o.context=null),/ '([^']+)' /.exec(r)&&(o.column=null),e.stack.length>0&&e.stack[0].url===o.url){if(e.stack[0].line===o.line)return!1;if(!e.stack[0].line&&e.stack[0].func===o.func)return e.stack[0].line=o.line,e.stack[0].context=o.context,!1}return e.stack.unshift(o),e.partial=!0,!0}return e.incomplete=!0,!1}function n(e,r){for(var o,i,s=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,a=[],c={},u=!1,l=n.caller;l&&!u;l=l.caller)if(l!==_computeStackTrace&&l!==TraceKit._report){if(i={url:null,func:UNKNOWN_FUNCTION,args:[],line:null,column:null},l.name?i.func=l.name:(o=s.exec(l.toString()))&&(i.func=o[1]),void 0===i.func)try{i.func=o.input.substring(0,o.input.indexOf("{"))}catch(e){}c[""+l]?u=!0:c[""+l]=!0,a.push(i)}r&&a.splice(0,r);var p={mode:"callers",name:e.name,message:e.message,stack:a};return t(p,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),p}function r(t,r){var o=null;r=null==r?0:+r;try{if(o=function(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i,i=t.split("\n"),s=[],a=0;a<i.length;a+=2){var c=null;(n=r.exec(i[a]))?c={url:n[2],line:+n[1],column:null,func:n[3],args:[]}:(n=o.exec(i[a]))&&(c={url:n[6],line:+n[1],column:+n[2],func:n[3]||n[4],args:n[5]?n[5].split(","):[]}),c&&(!c.func&&c.line&&(c.func=UNKNOWN_FUNCTION),c.line&&(c.context=null),c.context||(c.context=[i[a+1]]),s.push(c))}return s.length?{mode:"stacktrace",name:e.name,message:e.message,stack:s}:null}}(t))return o}catch(e){}try{if(o=e(t))return o}catch(e){}try{if(o=function(e){var t=e.message.split("\n");if(t.length<4)return null;var n,r=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of function script\s*$/i,s=[],a=window$1&&window$1.document&&window$1.document.getElementsByTagName("script"),c=[];for(var u in a)_has(a,u)&&!a[u].src&&c.push(a[u]);for(var l=2;l<t.length;l+=2){var p=null;(n=r.exec(t[l]))?p={url:n[2],func:n[3],args:[],line:+n[1],column:null}:(n=o.exec(t[l]))?p={url:n[3],func:n[4],args:[],line:+n[1],column:null}:(n=i.exec(t[l]))&&(p={url:getLocationHref().replace(/#.*$/,""),func:"",args:[],line:n[1],column:null}),p&&(p.func||(p.func=UNKNOWN_FUNCTION),p.context=[t[l+1]],s.push(p))}return s.length?{mode:"multiline",name:e.name,message:t[0],stack:s}:null}(t))return o}catch(e){}try{if(o=n(t,r+1))return o}catch(e){}return{original:t,name:t.name,message:t.message,mode:"failed"}}return r._augmentStackTraceWithInitialElement=t,r._computeStackTraceFromStackProp=e,r}(),TraceKit._collectWindowErrors=!0,TraceKit._linesOfContext=11;var _subscribe=TraceKit._report._subscribe,_installGlobalHandler=TraceKit._report._installGlobalHandler,_installGlobalUnhandledRejectionHandler=TraceKit._report._installGlobalUnhandledRejectionHandler,_computeStackTrace=TraceKit._computeStackTrace,STACKTRACE_LIMIT=50;function exceptionFromStacktrace(e){var t=prepareFramesForEvent(e.stack),n={type:e.name,value:e.message};return t&&t.length&&(n.stacktrace={frames:t}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function eventFromPlainObject(e,t){var n=Object.keys(e).sort(),r={extra:{__serialized__:normalizeToSize(e)},message:"Non-Error exception captured with keys: "+keysToEventMessage(n)};if(t){var o=prepareFramesForEvent(_computeStackTrace(t).stack);r.stacktrace={frames:o}}return r}function eventFromStacktrace(e){return{exception:{values:[exceptionFromStacktrace(e)]}}}function prepareFramesForEvent(e){if(!e||!e.length)return[];var t=e,n=t[0].func||"",r=t[t.length-1].func||"";return(n.includes("captureMessage")||n.includes("captureException"))&&(t=t.slice(1)),r.includes("sentryWrapped")&&(t=t.slice(0,-1)),t.map(function(e){return{colno:e.column,filename:e.url||t[0].url,function:e.func||"?",in_app:!0,lineno:e.line}}).slice(0,STACKTRACE_LIMIT).reverse()}var BaseTransport=function(){function e(e){this.options=e,this._buffer=new PromiseBuffer(30),this.url=new API(this.options.dsn).getStoreEndpointWithUrlEncodedAuth()}return e.prototype.sendEvent=function(e){throw new SentryError("Transport Class has to implement `sendEvent` method")},e.prototype.close=function(e){return this._buffer.drain(e)},e}(),RequestTransport=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.sendEvent=function(e){var t=this;return this._buffer.add(new Promise(function(n,r){wx.request({url:t.url,method:"POST",data:e,success:function(e){200===e.statusCode?n({status:exports.Status.fromHttpCode(e.statusCode)}):r(e)},fail:function(e){r(e)}})}))},t}(BaseTransport),index=Object.freeze({BaseTransport:BaseTransport,RequestTransport:RequestTransport}),WechatMiniprogramBackend=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype._setupTransport=function(){if(!this._options.dsn)return e.prototype._setupTransport.call(this);var t=__assign({},this._options.transportOptions,{dsn:this._options.dsn});return this._options.transport?new this._options.transport(t):new RequestTransport(t)},t.prototype.eventFromException=function(e,t){var n,r=this;if(isErrorEvent(e)&&e.error)return e=e.error,n=eventFromStacktrace(_computeStackTrace(e)),SyncPromise.resolve(this._buildEvent(n,t));if(isError(e))return n=eventFromStacktrace(_computeStackTrace(e)),SyncPromise.resolve(this._buildEvent(n,t));if(isPlainObject(e)&&t&&t.syntheticException)return addExceptionTypeValue(n=eventFromPlainObject(e,t.syntheticException),"Custom Object",void 0,{handled:!0,synthetic:!0,type:"generic"}),n.level=exports.Severity.Error,SyncPromise.resolve(this._buildEvent(n,t));var o=e;return this.eventFromMessage(o,void 0,t).then(function(e){return addExceptionTypeValue(e,""+o,void 0,{handled:!0,synthetic:!0,type:"generic"}),e.level=exports.Severity.Error,SyncPromise.resolve(r._buildEvent(e,t))})},t.prototype._buildEvent=function(e,t){return __assign({},e,{event_id:t&&t.event_id})},t.prototype.eventFromMessage=function(e,t,n){void 0===t&&(t=exports.Severity.Info);var r={event_id:n&&n.event_id,level:t,message:e};if(this._options.attachStacktrace&&n&&n.syntheticException){var o=prepareFramesForEvent(_computeStackTrace(n.syntheticException).stack);r.stacktrace={frames:o}}return SyncPromise.resolve(r)},t}(BaseBackend),WechatMiniprogramClient=function(e){function t(t){return void 0===t&&(t={}),e.call(this,WechatMiniprogramBackend,t)||this}return __extends(t,e),t.prototype._prepareEvent=function(t,n,r){return t.platform=t.platform||"javascript",t.sdk=__assign({},t.sdk,{name:SDK_NAME,packages:(t.sdk&&t.sdk.packages||[]).concat([{name:"npm:sentry-wechat-miniprogram",version:SDK_VERSION}]),version:SDK_VERSION}),e.prototype._prepareEvent.call(this,t,n,r)},t.prototype.showReportDialog=function(e){void 0===e&&(e={})},t}(BaseClient),ignoreOnError=0;function shouldIgnoreOnError(){return ignoreOnError>0}function ignoreNextOnError(){ignoreOnError+=1,setTimeout(function(){ignoreOnError-=1})}function wrap(e,t,n){if(void 0===t&&(t={}),"function"!=typeof e)return e;try{if(e.__sentry__)return e;if(e.__sentry_wrapped__)return e.__sentry_wrapped__}catch(t){return e}var r=function(){n&&"function"==typeof n&&n.apply(this,arguments);var r=Array.prototype.slice.call(arguments);try{var o=r.map(function(e){return wrap(e,t)});return e.handleEvent?e.handleEvent.apply(this,o):e.apply(this,o)}catch(e){throw ignoreNextOnError(),withScope(function(n){n.addEventProcessor(function(e){var n=__assign({},e);return t.mechanism&&addExceptionTypeValue(n,void 0,void 0,t.mechanism),n.extra=__assign({},n.extra,{arguments:normalize(r,3)}),n}),captureException(e)}),e}};try{for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}catch(e){}e.prototype=e.prototype||{},r.prototype=e.prototype,Object.defineProperty(e,"__sentry_wrapped__",{enumerable:!1,value:r}),Object.defineProperties(r,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:e}});try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:function(){return e.name}})}catch(e){}return r}function getCurrentPage(){if("function"==typeof getCurrentPages){var e=getCurrentPages();return 0===e.length?"unknown":e[e.length-1].route}return"unknown"}function getPrevPage(e){if("function"==typeof getCurrentPages){var t=getCurrentPages();if(0===t.length)return"unknown";if(e||(e=1),t[t.length-1-e])return t[t.length-1-e].route}return"unknown"}function globalErrorFingerprint(e){try{return isError(e)&&(e=e.message),e.split("\n").slice(0,2)}catch(e){return null}}function fill$1(e,t,n){var r;try{if(!(t in e)||e[t].__sentry__)return;var o=e[t],i=n(o);if(i.__sentry__=!0,i.__sentry_original__=o,i.__sentry_wrapped__=i,Object.defineProperties&&Object.getOwnPropertyDescriptor){var s=Object.getOwnPropertyDescriptor(e,t);if(!s||!s.configurable)throw new Error("unable to config");Object.defineProperties(e,((r={})[t]={value:i},r))}else e[t]=i}catch(e){logger.warn("fail to reset property "+t)}}var GlobalHandlers=function(){function e(t){this.name=e.id,this._options=__assign({onerror:!0,onpagenotfound:!0},t)}return e.prototype.setupOnce=function(){Error.stackTraceLimit=50,_subscribe(function(t,n,r){if(!shouldIgnoreOnError()){var o=getCurrentHub().getIntegration(e);o&&getCurrentHub().captureEvent(o._eventFromGlobalHandler(t),{data:{stack:t},originalException:r})}}),this._options.onerror&&(logger.log("Global Handler attached: onerror"),this._installGlobalErrorHandler()),this._options.onpagenotfound&&(logger.log("Global Handler attached: onpagenotfound"),this._installGlobalPageNotFoundHandler())},e.prototype._installGlobalErrorHandler=function(){wx.onError(function(e){withScope(function(t){var n,r=globalErrorFingerprint(e);if(r&&t.setFingerprint(r),isError(e))n=e;else if(r){var o=r[0]||"UnknownAppError",i=r[1]||o;(n=new Error(i)).name=o,n.stack=e}else(n=new Error("UnknownAppError")).stack=e;captureException(n)})})},e.prototype._installGlobalPageNotFoundHandler=function(){wx.onPageNotFound(function(e){captureEvent({message:"page not found",extra:e})})},e.prototype._eventFromGlobalHandler=function(e){if(!isString(e.message)&&"onunhandledrejection"!==e.mechanism){var t=e.message;e.message=t.error&&isString(t.error.message)?t.error.message:"No error message"}var n=eventFromStacktrace(e),r={mode:e.mode};e.message&&(r.message=e.message),e.name&&(r.name=e.name);var o=getCurrentHub().getClient(),i=o&&o.getOptions().maxValueLength||250;return addExceptionTypeValue(n,e.original?truncate(JSON.stringify(normalize(e.original)),i):"","onunhandledrejection"===e.mechanism?"UnhandledRejection":"Error",{data:r,handled:!1,type:e.mechanism}),n},e.id="GlobalHandlers",e}(),TryCatch=function(){function e(){this._ignoreOnError=0,this.name=e.id}return e.prototype._wrapTimeFunction=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0];return t[0]=wrap(r,{mechanism:{data:{function:getFunctionName(e)},handled:!0,type:"instrument"}}),e.apply(this,t)}},e.prototype._wrapRAF=function(e){return function(t){return e(wrap(t,{mechanism:{data:{function:"requestAnimationFrame",handler:getFunctionName(e)},handled:!0,type:"instrument"}}))}},e.prototype._wrapEventTarget=function(e){var t=getGlobalObject(),n=t[e]&&t[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(fill(n,"addEventListener",function(t){return function(n,r,o){try{"function"==typeof r.handleEvent&&(r.handleEvent=wrap(r.handleEvent.bind(r),{mechanism:{data:{function:"handleEvent",handler:getFunctionName(r),target:e