@amplitude/plugin-network-capture-browser 1.5.4 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.5.4";
1
+ export declare const VERSION = "1.5.5";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.5.4';
4
+ exports.VERSION = '1.5.5';
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.5.4';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.5.5';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.5.4";
1
+ export declare const VERSION = "1.5.5";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '1.5.4';
1
+ export var VERSION = '1.5.5';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.5.4';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.5.5';\n"]}
@@ -1,2 +1,2 @@
1
- var amplitudeNetworkCapturePlugin=function(e){"use strict";var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function o(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))}function i(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(a){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function a(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var c=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],l=["authorization","cookie","set-cookie"],d=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},f=a([],u(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),h=function(e){var t,r=d();if(!(null===(t=null==r?void 0:r.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,h)}(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,a([],u(n.entries()),!1).map((function(e){var t=u(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(f[n]):f[n]})).join("")};function p(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function v(e,t,r){e&&y({json:e,allowlist:t.map(b),excludelist:r.map(b),ancestors:[]})}function y(e){var t,r,n=e.json,o=e.targetObject,i=e.allowlist,c=e.excludelist,l=e.ancestors,d=e.parentObject,f=e.targetKey;o||(o=n);var h=Object.keys(o);try{for(var v=s(h),b=v.next();!b.done;b=v.next()){var m=b.value,w=a(a([],u(l),!1),[m],!1);p(o[m])?g(w,i)&&!g(w,c)||delete o[m]:y({json:n,targetObject:o[m],allowlist:i,excludelist:c,ancestors:w,parentObject:o,targetKey:m})}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=v.return)&&r.call(v)}finally{if(t)throw t.error}}0===Object.keys(o).length&&d&&f&&delete d[f]}function b(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map((function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")}))}function m(e,t,r,n){if(void 0===r&&(r=0),void 0===n&&(n=0),n===t.length)return r===e.length;if(r===e.length){for(;n<t.length&&"**"===t[n];)n++;return n===t.length}var o=t[n];if("**"===o){if(n+1===t.length)return!0;for(var i=r;i<=e.length;i++)if(m(e,t,i,n+1))return!0;return!1}return("*"===o||o===e[r])&&m(e,t,r+1,n+1)}function g(e,t){return t.some((function(t){return m(e,t)}))}var w=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,r;void 0===e&&(e=[]);var n=this.request.headers,o={};if(Array.isArray(n))n.forEach((function(e){var t=u(e,2),r=t[0],n=t[1];o[r]=n}));else if(n instanceof Headers)n.forEach((function(e,t){o[t]=e}));else if("object"==typeof n&&null!==n)try{for(var i=s(Object.entries(n)),a=i.next();!a.done;a=i.next()){var c=u(a.value,2),l=c[0],d=c[1];o[l]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return k(o,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=d();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=x(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){return 0===e.length?[2,null]:[2,O(this.body,e,t)]}))}))},e}(),_=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),k(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return x(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){return 0===e.length?[2,null]:[2,O(this.body,e,t)]}))}))},e}();function x(e,t){var r,n,o,i=d(),a=null==i?void 0:i.TextEncoder;if(a){var c;if("string"==typeof e)c=e,o=(new a).encode(c).length;else if(e instanceof Blob)o=(c=e).size;else if(e instanceof URLSearchParams)c=e,o=(new a).encode(c.toString()).length;else if(ArrayBuffer.isView(e))o=(c=e).byteLength;else if(e instanceof ArrayBuffer)o=(c=e).byteLength;else if(e instanceof FormData){var l=e,f=0,h=0;try{for(var p=s(l.entries()),v=p.next();!v.done;v=p.next()){var y=u(v.value,2),b=y[0],m=y[1];if(f+=b.length,"string"==typeof m)f+=(new a).encode(m).length;else{if(!(m instanceof Blob))return;f+=m.size}if(++h>=t)return}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}o=f}else if(e instanceof ReadableStream)return void(c=e);return o}}var S,A=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var r=this.response.headers,n={};return null===(t=null==r?void 0:r.forEach)||void 0===t||t.call(r,(function(e,t){n[t]=e})),k(n,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var r=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return o(this,void 0,void 0,(function(){var e,t;return i(this,(function(r){switch(r.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),r.label=1;case 1:return r.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([e,t])];case 2:return[2,r.sent()];case 3:return r.sent(),[2,null];case 4:return[2]}}))}))},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,O(r.sent(),e,t)]}}))}))},e}(),E=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,r;if(void 0===e&&(e=[]),!this.headersString)return{};var n={},o=this.headersString.split("\r\n");try{for(var i=s(o),a=i.next();!a.done;a=i.next()){var c=u(a.value.split(": "),2),l=c[0],d=c[1];l&&d&&(n[l]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return k(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){var r;return i(this,(function(n){return 0===e.length?[2,null]:(r=this.getJson())?(v(r,e,t),[2,r]):[2,null]}))}))},e}();function O(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return v(n,t,r),n}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(S||(S={}));var q="[REDACTED]",k=function(e,t){var r,n,o=t.allow,i=void 0===o?[]:o,c=t.strategy,d=void 0===c?S.REMOVE:c,f=a([],u(l),!1),h={},p=function(t){var r=t.toLowerCase();f.find((function(e){return e.toLowerCase()===r}))?d===S.REDACT&&(h[t]=q):i.find((function(e){return e.toLowerCase()===r}))?h[t]=e[t]:d===S.REDACT&&(h[t]=q)};try{for(var v=s(Object.keys(e)),y=v.next();!y.done;y=v.next()){p(y.value)}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}return h},T=function(){function e(e,t,r,n,o,i,s,u,a,c,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=o,this.requestWrapper=i,this.status=s,this.duration=u,this.responseWrapper=a,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,r,n,o={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(a([],u(c),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(r=this.responseWrapper)||void 0===r?void 0:r.headers(a([],u(c),!1)),responseBodySize:null===(n=this.responseWrapper)||void 0===n?void 0:n.bodySize};return Object.fromEntries(Object.entries(o).filter((function(e){var t=u(e,2);return t[0],void 0!==t[1]})))},e}();var j=function(e,t){void 0===t&&(t=h()),this.callback=e,this.id=t},R=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=d();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=d();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,o,i,s,u,a,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(o=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.XMLHttpRequest)||void 0===n?void 0:n.prototype)||void 0===o?void 0:o.open,h=null===(u=null===(s=null===(i=this.globalScope)||void 0===i?void 0:i.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===u?void 0:u.send,p=null===(l=null===(c=null===(a=this.globalScope)||void 0===a?void 0:a.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&h&&p&&this.observeXhr(f,h,p);var v=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;v&&this.observeFetch(v),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach((function(r){var n;try{r.callback(e)}catch(e){null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,r,n,o,i,s){var u;if(void 0!==i&&void 0!==s){var a,c,l,d="GET";!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?a=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(a=t.url,d=t.method),d=(null==r?void 0:r.method)||d,n&&(c=n.status),o&&(l={name:o.name||"UnknownError",message:o.message||"An unknown error occurred"},c=0);var f=Math.floor(performance.now()-s),h=Math.floor(i+f),p=new T(e,d,i,i,a,r,c,f,n,l,h);this.triggerEventCallbacks(p)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,n){return o(t,void 0,void 0,(function(){var t,o,s,u,a,c;return i(this,(function(i){switch(i.label){case 0:try{t=this.getTimestamps()}catch(e){null===(a=this.logger)||void 0===a||a.debug("an unexpected error occurred while retrieving timestamps",e)}i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e(r,n)];case 2:return o=i.sent(),[3,4];case 3:return u=i.sent(),s=u,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new w(n):void 0,o?new A(o):void 0,s,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while handling fetch",e)}if(o)return[2,o];throw s}}))}))})},e.createXhrJsonParser=function(e,t){return function(){var r,n;try{if("json"===e.responseType){if(null===(r=t.globalScope)||void 0===r?void 0:r.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(r){return r instanceof Error&&"InvalidStateError"===r.name&&(null===(n=t.logger)||void 0===n||n.error("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))),null}return null}},e.prototype.observeXhr=function(t,r,o){if(this.globalScope&&t&&r){var i=this.globalScope.XMLHttpRequest.prototype,s=this;i.open=function(){for(var e,r,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var a=u(o,2),c=a[0],l=a[1];try{this.$$AmplitudeAnalyticsEvent=n({method:c,url:null===(e=null==l?void 0:l.toString)||void 0===e?void 0:e.call(l),headers:{}},s.getTimestamps())}catch(e){null===(r=s.logger)||void 0===r||r.error("an unexpected error occurred while calling xhr open",e)}return t.apply(this,o)},i.send=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=this,i=e.createXhrJsonParser(this,s),u=t[0],a=o.$$AmplitudeAnalyticsEvent;return o.addEventListener("loadend",(function(){var e;try{var t=o.getAllResponseHeaders(),r=o.getResponseHeader("content-length"),n=new E(o.status,t,r?parseInt(r,10):void 0,i),c=o.$$AmplitudeAnalyticsEvent.headers,l=new _(u,c);a.status=o.status,s.handleNetworkRequestEvent("xhr",{url:a.url,method:a.method},l,n,void 0,a.startTime,a.durationStart)}catch(t){null===(e=s.logger)||void 0===e||e.error("an unexpected error occurred while handling xhr send",t)}})),r.apply(o,t)},i.setRequestHeader=function(e,t){var r;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null===(r=s.logger)||void 0===r||r.error("an unexpected error occurred while calling xhr setRequestHeader",e)}o.apply(this,[e,t])}}},e}(),C=new R,P="[Amplitude] Network Request";function z(e){return"function"==typeof e}function I(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var F=I((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function B(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var H=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var c=s(i),l=c.next();!l.done;l=c.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else i.remove(this);var d=this.initialTeardown;if(z(d))try{d()}catch(e){o=e instanceof F?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var h=s(f),p=h.next();!p.done;p=h.next()){var v=p.value;try{L(v)}catch(e){o=null!=o?o:[],e instanceof F?o=a(a([],u(o)),u(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(o)throw new F(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)L(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&B(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&B(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),W=H.EMPTY;function M(e){return e instanceof H||e&&"closed"in e&&z(e.remove)&&z(e.add)&&z(e.unsubscribe)}function L(e){z(e)?e():e.unsubscribe()}var N={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},D=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,a([e,t],u(r)))};function U(){}function J(e){e()}var V=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,M(t)&&t.add(r)):r.destination=K,r}return r(t,e),t.create=function(e,t,r){return new Q(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(H),$=Function.prototype.bind;function X(e,t){return $.call(e,t)}var Y=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){G(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){G(e)}else G(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){G(e)}},e}(),Q=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;z(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&N.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&X(t.next,i),error:t.error&&X(t.error,i),complete:t.complete&&X(t.complete,i)}):o=t;return s.destination=new Y(o),s}return r(t,e),t}(V);function G(e){var t;t=e,D((function(){throw t}))}var K={closed:!0,next:U,error:function(e){throw e},complete:U},Z="function"==typeof Symbol&&Symbol.observable||"@@observable";function ee(e){return e}var te=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof V||function(e){return e&&z(e.next)&&z(e.error)&&z(e.complete)}(n)&&M(n)?e:new Q(e,t,r);return J((function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=re(t))((function(t,n){var o=new Q({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Z]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=re(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function re(e){var t;return null!==(t=null!=e?e:N.Promise)&&void 0!==t?t:Promise}function ne(e){return z(null==e?void 0:e.lift)}function oe(e){return function(t){if(ne(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function ie(e,t,r,n,o){return new se(e,t,r,n,o)}var se=function(e){function t(t,r,n,o,i,s){var u=e.call(this,t)||this;return u.onFinalize=i,u.shouldUnsubscribe=s,u._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return r(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(V);!function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,ne(t)&&(n.lift=t.lift),n}r(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new H;var r=this.getSubject();t.add(this.source.subscribe(ie(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=H.EMPTY)}return t},t.prototype.refCount=function(){return oe((function(e,t){var r=null;e._refCount++;var n=ie(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,o=r;r=null,!n||o&&n!==o||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))(this)}}(te);var ue,ae={now:function(){return(ae.delegate||performance).now()},delegate:void 0},ce={schedule:function(e){var t=requestAnimationFrame,r=cancelAnimationFrame,n=t((function(t){r=void 0,e(t)}));return new H((function(){return null==r?void 0:r(n)}))},requestAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ce.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,a([],u(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,a([],u(e)))},delegate:void 0};new te((function(e){var t=ue||ae,r=t.now(),n=0,o=function(){e.closed||(n=ce.requestAnimationFrame((function(i){n=0;var s=t.now();e.next({timestamp:ue?s:i,elapsed:s-r}),o()})))};return o(),function(){n&&ce.cancelAnimationFrame(n)}}));var le=I((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),de=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r(t,e),t.prototype.lift=function(e){var t=new fe(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new le},t.prototype.next=function(e){var t=this;J((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=s(t.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(e)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;J((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;J((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?W:(this.currentObservers=null,i.push(e),new H((function(){t.currentObservers=null,B(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new te;return e.source=this,e},t.create=function(e,t){return new fe(e,t)},t}(te),fe=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return r(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:W},t}(de);!function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}r(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(de);var he={now:function(){return(he.delegate||Date).now()},delegate:void 0};!function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=he);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=r,o._timestampProvider=n,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,r),o}r(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,s=r._timestampProvider,u=r._windowTime;n||(o.push(t),!i&&o.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),o=0;o<n.length&&!e.closed;o+=r?1:2)e.next(n[o]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,o=e._infiniteTimeWindow,i=(o?1:2)*t;if(t<1/0&&i<n.length&&n.splice(0,n.length-i),!o){for(var s=r.now(),u=0,a=1;a<n.length&&n[a]<=s;a+=2)u=a;u&&n.splice(0,u+1)}}}(de),function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}r(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,o=t._value,i=t.thrownError,s=t.isStopped,u=t._isComplete;r?e.error(i):(s||u)&&(n&&e.next(o),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))}}(de);var pe,ve=function(e){function t(t,r){return e.call(this)||this}return r(t,e),t.prototype.schedule=function(e,t){return this},t}(H),ye=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,a([e,t],u(r)))},be=function(e){return clearInterval(e)},me=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return r(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),ye(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&be(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,B(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ve),ge=1,we={};function _e(e){return e in we&&(delete we[e],!0)}var xe=function(e){var t=ge++;return we[t]=!0,pe||(pe=Promise.resolve()),pe.then((function(){return _e(t)&&e()})),t},Se=function(e){_e(e)},Ae={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Ae.delegate;return((null==r?void 0:r.setImmediate)||xe).apply(void 0,a([],u(e)))},clearImmediate:function(e){return Se(e)},delegate:void 0},Ee=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=Ae.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){var o;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var i=t.actions;null!=r&&(null===(o=i[i.length-1])||void 0===o?void 0:o.id)!==r&&(Ae.clearImmediate(r),t._scheduled===r&&(t._scheduled=void 0))},t}(me),Oe=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=he.now,e}(),qe=function(e){function t(t,r){void 0===r&&(r=Oe.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return r(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(Oe),ke=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(qe);new ke(Ee),new qe(me);var Te=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.flush(this),0)},t}(me),je=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(qe);new je(Te);var Re=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=ce.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){var o;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var i=t.actions;null!=r&&r===t._scheduled&&(null===(o=i[i.length-1])||void 0===o?void 0:o.id)!==r&&(ce.cancelAnimationFrame(r),t._scheduled=void 0)},t}(me),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.flush=function(e){var t;this._active=!0,e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(qe);new Ce(Re),function(e){function t(t,r){void 0===t&&(t=ze),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}r(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10}(qe);var Pe,ze=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var o=e.call(this,t,r)||this;return o.scheduler=t,o.work=r,o.index=n,o.active=!0,o.index=t.index=n,o}return r(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var o=new t(this.scheduler,this.work);return this.add(o),o.schedule(r,n)}return H.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var o=e.actions;return o.push(this),o.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,r){},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(me);new te((function(e){return e.complete()})),function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Pe||(Pe={})),I((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),I((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),I((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),I((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}})),I((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),new te(U);var Ie,Fe="500-599";function Be(e,t){var r="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(e)}function He(e,t){var r,n,o=t.split(",");try{for(var i=s(o),a=i.next();!a.done;a=i.next()){var c=u(a.value.split("-").map(Number),2),l=c[0],d=c[1];if(e===l&&void 0===d)return!0;if(e>=l&&e<=d)return!0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1}function We(e){var t;if(e)try{var r=null===(t=d())||void 0===t?void 0:t.location.href,n=new URL(e,r),o=n.searchParams.toString(),i=n.hash.replace("#",""),s=n.href,u=n.host;return n.hash="",n.search="",{query:o,fragment:i,href:s,hrefWithoutQueryOrHash:n.href,host:u}}catch(e){return}}function Me(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return a([],u(c),!1);if(void 0===e){return}}}function Le(e){var t,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(r=null==e?void 0:e.blocklist)||void 0===r?void 0:r.length)}function Ne(e,t){var r;void 0===t&&(t={});var n=We(e.url);if(!n)return!1;var o,i=n.host;if(!1!==t.ignoreAmplitudeRequests&&(Be(i,"*.amplitude.com")||Be(i,"amplitude.com")))return!1;if(null===(r=t.ignoreHosts)||void 0===r?void 0:r.find((function(e){return Be(i,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!He(e.status,Fe))return!1;if(t.captureRules&&(a([],u(t.captureRules),!1).reverse().find((function(t){if(o=function(e,t,r,n,o){if((!e.hosts||e.hosts.find((function(e){return Be(t,e)})))&&(!n||!e.urls||function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(n,e.urls))&&(!o||!e.methods||e.methods.find((function(e){return o.toLowerCase()===e.toLowerCase()||"*"===e}))))return!((r||0===r)&&!He(r,e.statusCodeRange||Fe))}(t,i,e.status,e.url,e.method),o){var r=Me(t.responseHeaders);if(e.responseWrapper&&r){var n=e.responseWrapper.headers(r);n&&(e.responseHeaders=n)}var s=Me(t.requestHeaders);if(e.requestWrapper&&s){var u=e.requestWrapper.headers(s);u&&(e.requestHeaders=u)}e.responseWrapper&&t.responseBody&&!Le(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!Le(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==o})),!o))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find((function(e){return e.event_type===P})))return!0}catch(e){}return!1}(i,e.requestWrapper)}function De(e){var t,r,n=e.allObservables,s=e.networkTrackingOptions,a=e.amplitude;return n.networkObservable.pipe((t=function(e){return Ne(e.event,s)},oe((function(e,n){var o=0;e.subscribe(ie(n,(function(e){return t.call(r,e,o++)&&n.next(e)})))})))).subscribe((function(e){var t,r,n,s=e.event,c=We(s.url);if(c){var l=null===(r=s.responseWrapper)||void 0===r?void 0:r.bodySize,d=null===(n=s.requestWrapper)||void 0===n?void 0:n.bodySize;!function(e,t,r){o(this,void 0,void 0,(function(){var n,o,s;return i(this,(function(i){switch(i.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:n=u.apply(void 0,[i.sent(),2]),o=n[0],s=n[1],o&&(e["[Amplitude] Request Body"]=o),s&&(e["[Amplitude] Response Body"]=s),i.label=2;case 2:return null==r||r.track(P,e),[2]}}))}))}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=s.method,t["[Amplitude] Status Code"]=s.status,t["[Amplitude] Start Time"]=s.startTime,t["[Amplitude] Completion Time"]=s.endTime,t["[Amplitude] Duration"]=s.duration,t["[Amplitude] Request Body Size"]=d,t["[Amplitude] Response Body Size"]=l,t["[Amplitude] Request Type"]=s.type,t["[Amplitude] Request Headers"]=s.requestHeaders,t["[Amplitude] Response Headers"]=s.responseHeaders,t),s,a)}}))}!function(e){e.NetworkObservable="networkObservable"}(Ie||(Ie={}));var Ue=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=[],u=function(){var e,r=new te((function(e){var r=new j((function(t){var r=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(r)}));return C.subscribe(r,t),function(){C.unsubscribe(r)}}));return(e={})[Ie.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(s,a){return o(void 0,void 0,void 0,(function(){var o,c;return i(this,(function(i){return"undefined"==typeof document||(o=u(),c=De({allObservables:o,networkTrackingOptions:e,amplitude:a}),n.push(c),null==(t=null==s?void 0:s.loggerProvider)||t.log("".concat(r," has been successfully added."))),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return i(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){var e,t,r,o;return i(this,(function(i){try{for(e=s(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(r)throw r.error}}return[2]}))}))}}};return e.networkCapturePlugin=Ue,e.plugin=Ue,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
1
+ var amplitudeNetworkCapturePlugin=function(e){"use strict";var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function o(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))}function i(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(a){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function a(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var c=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],l=["authorization","cookie","set-cookie"],d=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},h=a([],u(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),f=function(e){var t,r=d();if(!(null===(t=null==r?void 0:r.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,f)}(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,a([],u(n.entries()),!1).map((function(e){var t=u(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(h[n]):h[n]})).join("")};function p(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function v(e,t,r){e&&y({json:e,allowlist:t.map(b),excludelist:r.map(b),ancestors:[]})}function y(e){var t,r,n=e.json,o=e.targetObject,i=e.allowlist,c=e.excludelist,l=e.ancestors,d=e.parentObject,h=e.targetKey;o||(o=n);var f=Object.keys(o);try{for(var v=s(f),b=v.next();!b.done;b=v.next()){var m=b.value,w=a(a([],u(l),!1),[m],!1);p(o[m])?g(w,i)&&!g(w,c)||delete o[m]:y({json:n,targetObject:o[m],allowlist:i,excludelist:c,ancestors:w,parentObject:o,targetKey:m})}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=v.return)&&r.call(v)}finally{if(t)throw t.error}}0===Object.keys(o).length&&d&&h&&delete d[h]}function b(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map((function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")}))}function m(e,t,r,n){if(void 0===r&&(r=0),void 0===n&&(n=0),n===t.length)return r===e.length;if(r===e.length){for(;n<t.length&&"**"===t[n];)n++;return n===t.length}var o=t[n];if("**"===o){if(n+1===t.length)return!0;for(var i=r;i<=e.length;i++)if(m(e,t,i,n+1))return!0;return!1}return("*"===o||o===e[r])&&m(e,t,r+1,n+1)}function g(e,t){return t.some((function(t){return m(e,t)}))}var w=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,r;void 0===e&&(e=[]);var n=this.request.headers,o={};if(Array.isArray(n))n.forEach((function(e){var t=u(e,2),r=t[0],n=t[1];o[r]=n}));else if(n instanceof Headers)n.forEach((function(e,t){o[t]=e}));else if("object"==typeof n&&null!==n)try{for(var i=s(Object.entries(n)),a=i.next();!a.done;a=i.next()){var c=u(a.value,2),l=c[0],d=c[1];o[l]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return k(o,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=d();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=x(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){return 0===e.length?[2,null]:[2,O(this.body,e,t)]}))}))},e}(),_=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),k(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return x(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){return 0===e.length?[2,null]:[2,O(this.body,e,t)]}))}))},e}();function x(e,t){var r,n,o,i=d(),a=null==i?void 0:i.TextEncoder;if(a){var c;if("string"==typeof e)c=e,o=(new a).encode(c).length;else if(e instanceof Blob)o=(c=e).size;else if(e instanceof URLSearchParams)c=e,o=(new a).encode(c.toString()).length;else if(ArrayBuffer.isView(e))o=(c=e).byteLength;else if(e instanceof ArrayBuffer)o=(c=e).byteLength;else if(e instanceof FormData){var l=e,h=0,f=0;try{for(var p=s(l.entries()),v=p.next();!v.done;v=p.next()){var y=u(v.value,2),b=y[0],m=y[1];if(h+=b.length,"string"==typeof m)h+=(new a).encode(m).length;else{if(!(m instanceof Blob))return;h+=m.size}if(++f>=t)return}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}o=h}else if(e instanceof ReadableStream)return void(c=e);return o}}var S,A=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var r=this.response.headers,n={};return null===(t=null==r?void 0:r.forEach)||void 0===t||t.call(r,(function(e,t){n[t]=e})),k(n,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var r=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return o(this,void 0,void 0,(function(){var e,t;return i(this,(function(r){switch(r.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),r.label=1;case 1:return r.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([e,t])];case 2:return[2,r.sent()];case 3:return r.sent(),[2,null];case 4:return[2]}}))}))},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,O(r.sent(),e,t)]}}))}))},e}(),E=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,r;if(void 0===e&&(e=[]),!this.headersString)return{};var n={},o=this.headersString.split("\r\n");try{for(var i=s(o),a=i.next();!a.done;a=i.next()){var c=u(a.value.split(": "),2),l=c[0],d=c[1];l&&d&&(n[l]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return k(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){var r;return i(this,(function(n){return 0===e.length?[2,null]:(r=this.getJson())?(v(r,e,t),[2,r]):[2,null]}))}))},e}();function O(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return v(n,t,r),n}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(S||(S={}));var q="[REDACTED]",k=function(e,t){var r,n,o=t.allow,i=void 0===o?[]:o,c=t.strategy,d=void 0===c?S.REMOVE:c,h=a([],u(l),!1),f={},p=function(t){var r=t.toLowerCase();h.find((function(e){return e.toLowerCase()===r}))?d===S.REDACT&&(f[t]=q):i.find((function(e){return e.toLowerCase()===r}))?f[t]=e[t]:d===S.REDACT&&(f[t]=q)};try{for(var v=s(Object.keys(e)),y=v.next();!y.done;y=v.next()){p(y.value)}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}return f},T=function(){function e(e,t,r,n,o,i,s,u,a,c,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=o,this.requestWrapper=i,this.status=s,this.duration=u,this.responseWrapper=a,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,r,n,o={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(a([],u(c),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(r=this.responseWrapper)||void 0===r?void 0:r.headers(a([],u(c),!1)),responseBodySize:null===(n=this.responseWrapper)||void 0===n?void 0:n.bodySize};return Object.fromEntries(Object.entries(o).filter((function(e){var t=u(e,2);return t[0],void 0!==t[1]})))},e}();var j=function(e,t){void 0===t&&(t=f()),this.callback=e,this.id=t},R=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=d();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=d();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,o,i,s,u,a,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var h=null===(o=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.XMLHttpRequest)||void 0===n?void 0:n.prototype)||void 0===o?void 0:o.open,f=null===(u=null===(s=null===(i=this.globalScope)||void 0===i?void 0:i.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===u?void 0:u.send,p=null===(l=null===(c=null===(a=this.globalScope)||void 0===a?void 0:a.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;h&&f&&p&&this.observeXhr(h,f,p);var v=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;v&&this.observeFetch(v),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach((function(r){var n;try{r.callback(e)}catch(e){null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,r,n,o,i,s){var u,a;if(void 0!==i&&void 0!==s){var c,l,d,h="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?c=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(c=t.url,h=t.method),c)try{var f=new URL(c);c="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){null===(a=this.logger)||void 0===a||a.error("an unexpected error occurred while parsing the URL",e)}h=(null==r?void 0:r.method)||h,n&&(l=n.status),o&&(d={name:o.name||"UnknownError",message:o.message||"An unknown error occurred"},l=0);var p=Math.floor(performance.now()-s),v=Math.floor(i+p),y=new T(e,h,i,i,c,r,l,p,n,d,v);this.triggerEventCallbacks(y)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,n){return o(t,void 0,void 0,(function(){var t,o,s,u,a,c;return i(this,(function(i){switch(i.label){case 0:try{t=this.getTimestamps()}catch(e){null===(a=this.logger)||void 0===a||a.debug("an unexpected error occurred while retrieving timestamps",e)}i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e(r,n)];case 2:return o=i.sent(),[3,4];case 3:return u=i.sent(),s=u,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new w(n):void 0,o?new A(o):void 0,s,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while handling fetch",e)}if(o)return[2,o];throw s}}))}))})},e.createXhrJsonParser=function(e,t){return function(){var r,n;try{if("json"===e.responseType){if(null===(r=t.globalScope)||void 0===r?void 0:r.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(r){return r instanceof Error&&"InvalidStateError"===r.name&&(null===(n=t.logger)||void 0===n||n.error("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))),null}return null}},e.prototype.observeXhr=function(t,r,o){if(this.globalScope&&t&&r){var i=this.globalScope.XMLHttpRequest.prototype,s=this;i.open=function(){for(var e,r,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var a=u(o,2),c=a[0],l=a[1];try{this.$$AmplitudeAnalyticsEvent=n({method:c,url:null===(e=null==l?void 0:l.toString)||void 0===e?void 0:e.call(l),headers:{}},s.getTimestamps())}catch(e){null===(r=s.logger)||void 0===r||r.error("an unexpected error occurred while calling xhr open",e)}return t.apply(this,o)},i.send=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=this,i=e.createXhrJsonParser(this,s),u=t[0],a=o.$$AmplitudeAnalyticsEvent;return o.addEventListener("loadend",(function(){var e;try{var t=o.getAllResponseHeaders(),r=o.getResponseHeader("content-length"),n=new E(o.status,t,r?parseInt(r,10):void 0,i),c=o.$$AmplitudeAnalyticsEvent.headers,l=new _(u,c);a.status=o.status,s.handleNetworkRequestEvent("xhr",{url:a.url,method:a.method},l,n,void 0,a.startTime,a.durationStart)}catch(t){null===(e=s.logger)||void 0===e||e.error("an unexpected error occurred while handling xhr send",t)}})),r.apply(o,t)},i.setRequestHeader=function(e,t){var r;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null===(r=s.logger)||void 0===r||r.error("an unexpected error occurred while calling xhr setRequestHeader",e)}o.apply(this,[e,t])}}},e}(),C=new R,P="[Amplitude] Network Request";function z(e){return"function"==typeof e}function I(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var F=I((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function B(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var H=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var c=s(i),l=c.next();!l.done;l=c.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else i.remove(this);var d=this.initialTeardown;if(z(d))try{d()}catch(e){o=e instanceof F?e.errors:[e]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var f=s(h),p=f.next();!p.done;p=f.next()){var v=p.value;try{M(v)}catch(e){o=null!=o?o:[],e instanceof F?o=a(a([],u(o)),u(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}}if(o)throw new F(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)M(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&B(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&B(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),W=H.EMPTY;function L(e){return e instanceof H||e&&"closed"in e&&z(e.remove)&&z(e.add)&&z(e.unsubscribe)}function M(e){z(e)?e():e.unsubscribe()}var N={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},U=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,a([e,t],u(r)))};function D(){}function J(e){e()}var V=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,L(t)&&t.add(r)):r.destination=K,r}return r(t,e),t.create=function(e,t,r){return new Q(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(H),$=Function.prototype.bind;function X(e,t){return $.call(e,t)}var Y=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){G(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){G(e)}else G(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){G(e)}},e}(),Q=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;z(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&N.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&X(t.next,i),error:t.error&&X(t.error,i),complete:t.complete&&X(t.complete,i)}):o=t;return s.destination=new Y(o),s}return r(t,e),t}(V);function G(e){var t;t=e,U((function(){throw t}))}var K={closed:!0,next:D,error:function(e){throw e},complete:D},Z="function"==typeof Symbol&&Symbol.observable||"@@observable";function ee(e){return e}var te=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof V||function(e){return e&&z(e.next)&&z(e.error)&&z(e.complete)}(n)&&L(n)?e:new Q(e,t,r);return J((function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=re(t))((function(t,n){var o=new Q({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Z]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=re(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function re(e){var t;return null!==(t=null!=e?e:N.Promise)&&void 0!==t?t:Promise}function ne(e){return z(null==e?void 0:e.lift)}function oe(e){return function(t){if(ne(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function ie(e,t,r,n,o){return new se(e,t,r,n,o)}var se=function(e){function t(t,r,n,o,i,s){var u=e.call(this,t)||this;return u.onFinalize=i,u.shouldUnsubscribe=s,u._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return r(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(V);!function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,ne(t)&&(n.lift=t.lift),n}r(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new H;var r=this.getSubject();t.add(this.source.subscribe(ie(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=H.EMPTY)}return t},t.prototype.refCount=function(){return oe((function(e,t){var r=null;e._refCount++;var n=ie(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,o=r;r=null,!n||o&&n!==o||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))(this)}}(te);var ue,ae={now:function(){return(ae.delegate||performance).now()},delegate:void 0},ce={schedule:function(e){var t=requestAnimationFrame,r=cancelAnimationFrame,n=t((function(t){r=void 0,e(t)}));return new H((function(){return null==r?void 0:r(n)}))},requestAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ce.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,a([],u(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,a([],u(e)))},delegate:void 0};new te((function(e){var t=ue||ae,r=t.now(),n=0,o=function(){e.closed||(n=ce.requestAnimationFrame((function(i){n=0;var s=t.now();e.next({timestamp:ue?s:i,elapsed:s-r}),o()})))};return o(),function(){n&&ce.cancelAnimationFrame(n)}}));var le=I((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),de=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r(t,e),t.prototype.lift=function(e){var t=new he(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new le},t.prototype.next=function(e){var t=this;J((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=s(t.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(e)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;J((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;J((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?W:(this.currentObservers=null,i.push(e),new H((function(){t.currentObservers=null,B(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new te;return e.source=this,e},t.create=function(e,t){return new he(e,t)},t}(te),he=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return r(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:W},t}(de);!function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}r(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(de);var fe={now:function(){return(fe.delegate||Date).now()},delegate:void 0};!function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=fe);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=r,o._timestampProvider=n,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,r),o}r(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,s=r._timestampProvider,u=r._windowTime;n||(o.push(t),!i&&o.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),o=0;o<n.length&&!e.closed;o+=r?1:2)e.next(n[o]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,o=e._infiniteTimeWindow,i=(o?1:2)*t;if(t<1/0&&i<n.length&&n.splice(0,n.length-i),!o){for(var s=r.now(),u=0,a=1;a<n.length&&n[a]<=s;a+=2)u=a;u&&n.splice(0,u+1)}}}(de),function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}r(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,o=t._value,i=t.thrownError,s=t.isStopped,u=t._isComplete;r?e.error(i):(s||u)&&(n&&e.next(o),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))}}(de);var pe,ve=function(e){function t(t,r){return e.call(this)||this}return r(t,e),t.prototype.schedule=function(e,t){return this},t}(H),ye=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,a([e,t],u(r)))},be=function(e){return clearInterval(e)},me=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return r(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),ye(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&be(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,B(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ve),ge=1,we={};function _e(e){return e in we&&(delete we[e],!0)}var xe=function(e){var t=ge++;return we[t]=!0,pe||(pe=Promise.resolve()),pe.then((function(){return _e(t)&&e()})),t},Se=function(e){_e(e)},Ae={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Ae.delegate;return((null==r?void 0:r.setImmediate)||xe).apply(void 0,a([],u(e)))},clearImmediate:function(e){return Se(e)},delegate:void 0},Ee=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=Ae.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){var o;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var i=t.actions;null!=r&&(null===(o=i[i.length-1])||void 0===o?void 0:o.id)!==r&&(Ae.clearImmediate(r),t._scheduled===r&&(t._scheduled=void 0))},t}(me),Oe=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=fe.now,e}(),qe=function(e){function t(t,r){void 0===r&&(r=Oe.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return r(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(Oe),ke=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(qe);new ke(Ee),new qe(me);var Te=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.flush(this),0)},t}(me),je=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(qe);new je(Te);var Re=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=ce.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){var o;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var i=t.actions;null!=r&&r===t._scheduled&&(null===(o=i[i.length-1])||void 0===o?void 0:o.id)!==r&&(ce.cancelAnimationFrame(r),t._scheduled=void 0)},t}(me),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.flush=function(e){var t;this._active=!0,e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(qe);new Ce(Re),function(e){function t(t,r){void 0===t&&(t=ze),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}r(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10}(qe);var Pe,ze=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var o=e.call(this,t,r)||this;return o.scheduler=t,o.work=r,o.index=n,o.active=!0,o.index=t.index=n,o}return r(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var o=new t(this.scheduler,this.work);return this.add(o),o.schedule(r,n)}return H.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var o=e.actions;return o.push(this),o.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,r){},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(me);new te((function(e){return e.complete()})),function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Pe||(Pe={})),I((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),I((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),I((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),I((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}})),I((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),new te(D);var Ie,Fe="500-599";function Be(e,t){var r="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(e)}function He(e,t){var r,n,o=t.split(",");try{for(var i=s(o),a=i.next();!a.done;a=i.next()){var c=u(a.value.split("-").map(Number),2),l=c[0],d=c[1];if(e===l&&void 0===d)return!0;if(e>=l&&e<=d)return!0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1}function We(e){var t;if(e)try{var r=null===(t=d())||void 0===t?void 0:t.location.href,n=new URL(e,r),o=n.searchParams.toString(),i=n.hash.replace("#",""),s=n.href,u=n.host;return n.hash="",n.search="",{query:o,fragment:i,href:s,hrefWithoutQueryOrHash:n.href,host:u}}catch(e){return}}function Le(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return a([],u(c),!1);if(void 0===e){return}}}function Me(e){var t,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(r=null==e?void 0:e.blocklist)||void 0===r?void 0:r.length)}function Ne(e,t){var r;void 0===t&&(t={});var n=We(e.url);if(!n)return!1;var o,i=n.host;if(!1!==t.ignoreAmplitudeRequests&&(Be(i,"*.amplitude.com")||Be(i,"amplitude.com")))return!1;if(null===(r=t.ignoreHosts)||void 0===r?void 0:r.find((function(e){return Be(i,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!He(e.status,Fe))return!1;if(t.captureRules&&(a([],u(t.captureRules),!1).reverse().find((function(t){if(o=function(e,t,r,n,o){if((!e.hosts||e.hosts.find((function(e){return Be(t,e)})))&&(!n||!e.urls||function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(n,e.urls))&&(!o||!e.methods||e.methods.find((function(e){return o.toLowerCase()===e.toLowerCase()||"*"===e}))))return!((r||0===r)&&!He(r,e.statusCodeRange||Fe))}(t,i,e.status,e.url,e.method),o){var r=Le(t.responseHeaders);if(e.responseWrapper&&r){var n=e.responseWrapper.headers(r);n&&(e.responseHeaders=n)}var s=Le(t.requestHeaders);if(e.requestWrapper&&s){var u=e.requestWrapper.headers(s);u&&(e.requestHeaders=u)}e.responseWrapper&&t.responseBody&&!Me(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!Me(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==o})),!o))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find((function(e){return e.event_type===P})))return!0}catch(e){}return!1}(i,e.requestWrapper)}function Ue(e){var t,r,n=e.allObservables,s=e.networkTrackingOptions,a=e.amplitude;return n.networkObservable.pipe((t=function(e){return Ne(e.event,s)},oe((function(e,n){var o=0;e.subscribe(ie(n,(function(e){return t.call(r,e,o++)&&n.next(e)})))})))).subscribe((function(e){var t,r,n,s=e.event,c=We(s.url);if(c){var l=null===(r=s.responseWrapper)||void 0===r?void 0:r.bodySize,d=null===(n=s.requestWrapper)||void 0===n?void 0:n.bodySize;!function(e,t,r){o(this,void 0,void 0,(function(){var n,o,s;return i(this,(function(i){switch(i.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:n=u.apply(void 0,[i.sent(),2]),o=n[0],s=n[1],o&&(e["[Amplitude] Request Body"]=o),s&&(e["[Amplitude] Response Body"]=s),i.label=2;case 2:return null==r||r.track(P,e),[2]}}))}))}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=s.method,t["[Amplitude] Status Code"]=s.status,t["[Amplitude] Start Time"]=s.startTime,t["[Amplitude] Completion Time"]=s.endTime,t["[Amplitude] Duration"]=s.duration,t["[Amplitude] Request Body Size"]=d,t["[Amplitude] Response Body Size"]=l,t["[Amplitude] Request Type"]=s.type,t["[Amplitude] Request Headers"]=s.requestHeaders,t["[Amplitude] Response Headers"]=s.responseHeaders,t),s,a)}}))}!function(e){e.NetworkObservable="networkObservable"}(Ie||(Ie={}));var De=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=[],u=function(){var e,r=new te((function(e){var r=new j((function(t){var r=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(r)}));return C.subscribe(r,t),function(){C.unsubscribe(r)}}));return(e={})[Ie.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(s,a){return o(void 0,void 0,void 0,(function(){var o,c;return i(this,(function(i){return"undefined"==typeof document||(o=u(),c=Ue({allObservables:o,networkTrackingOptions:e,amplitude:a}),n.push(c),null==(t=null==s?void 0:s.loggerProvider)||t.log("".concat(r," has been successfully added."))),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return i(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){var e,t,r,o;return i(this,(function(i){try{for(e=s(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(r)throw r.error}}return[2]}))}))}}};return e.networkCapturePlugin=De,e.plugin=De,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
2
2
  //# sourceMappingURL=amplitude-min.js.map
Binary file