var evrythng=function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=32)}([function(t,r){function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(r)}t.exports=e},function(t,r){t.exports=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}},function(t,r){function e(t,r){for(var e=0;e=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(i[e]=t[e])}return i}},function(t,r){!function(t){!function(r){var e="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,c="ArrayBuffer"in t;if(c)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var r={next:function(){var r=t.shift();return{done:void 0===r,value:r}}};return n&&(r[Symbol.iterator]=function(){return r}),r}function p(t){this.map={},t instanceof p?t.forEach((function(t,r){this.append(r,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(r){this.append(r,t[r])}),this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(t){return new Promise((function(r,e){t.onload=function(){r(t.result)},t.onerror=function(){e(t.error)}}))}function v(t){var r=new FileReader,e=y(r);return r.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var r=new Uint8Array(t.byteLength);return r.set(new Uint8Array(t)),r.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var r;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():c&&o&&((r=t)&&DataView.prototype.isPrototypeOf(r))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var t,r,e,n=h(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=new FileReader,e=y(r),r.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var r=new Uint8Array(t),e=new Array(r.length),n=0;n-1?n:e),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(t){var r=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),n=e.shift().replace(/\+/g," "),o=e.join("=").replace(/\+/g," ");r.append(decodeURIComponent(n),decodeURIComponent(o))}})),r}function R(t,r){r||(r={}),this.type="default",this.status=void 0===r.status?200:r.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in r?r.statusText:"OK",this.headers=new p(r.headers),this.url=r.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},R.error=function(){var t=new R(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];R.redirect=function(t,r){if(-1===x.indexOf(r))throw new RangeError("Invalid status code");return new R(null,{status:r,headers:{location:t}})},r.DOMException=t.DOMException;try{new r.DOMException}catch(t){r.DOMException=function(t,r){this.message=t,this.name=r;var e=Error(t);this.stack=e.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function k(t,e){return new Promise((function(n,i){var c=new b(t,e);if(c.signal&&c.signal.aborted)return i(new r.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,r,e={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",r=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),n=e.shift().trim();if(n){var o=e.join(":").trim();r.append(n,o)}})),r)};e.url="responseURL"in u?u.responseURL:e.headers.get("X-Request-URL");var o="response"in u?u.response:u.responseText;n(new R(o,e))},u.onerror=function(){i(new TypeError("Network request failed"))},u.ontimeout=function(){i(new TypeError("Network request failed"))},u.onabort=function(){i(new r.DOMException("Aborted","AbortError"))},u.open(c.method,c.url,!0),"include"===c.credentials?u.withCredentials=!0:"omit"===c.credentials&&(u.withCredentials=!1),"responseType"in u&&o&&(u.responseType="blob"),c.headers.forEach((function(t,r){u.setRequestHeader(r,t)})),c.signal&&(c.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&c.signal.removeEventListener("abort",a)}),u.send(void 0===c._bodyInit?null:c._bodyInit)}))}k.polyfill=!0,t.fetch||(t.fetch=k,t.Headers=p,t.Request=b,t.Response=R),r.Headers=p,r.Request=b,r.Response=R,r.fetch=k}({})}("undefined"!=typeof self?self:this)},function(t,r,e){var n=function(t){"use strict";var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,r,e,n){var o=r&&r.prototype instanceof f?r:f,i=Object.create(o.prototype),c=new x(n||[]);return i._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(e.method=o,e.arg=i;;){var c=e.delegate;if(c){var u=b(c,e);if(u){if(u===s)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var f=a(t,r,e);if("normal"===f.type){if(n=e.done?"completed":"suspendedYield",f.arg===s)continue;return{value:f.arg,done:e.done}}"throw"===f.type&&(n="completed",e.method="throw",e.arg=f.arg)}}}(t,e,c),i}function a(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var s={};function f(){}function l(){}function p(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(k([])));v&&v!==r&&e.call(v,o)&&(h=v);var d=p.prototype=f.prototype=Object.create(h);function m(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function g(t){var r;this._invoke=function(n,o){function i(){return new Promise((function(r,i){!function r(n,o,i,c){var u=a(t[n],t,o);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&e.call(f,"__await")?Promise.resolve(f.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):Promise.resolve(f).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,c)}))}c(u.arg)}(n,o,r,i)}))}return r=r?r.then(i,i):i()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return s;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=a(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,s;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,s):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,s)}function w(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function R(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function k(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=e.call(i,"catchLoc"),a=e.call(i,"finallyLoc");if(u&&a){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),R(e),s}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;R(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,r){t.exports=function(t,r){var e=[],n=!0,o=!1,i=void 0;try{for(var c,u=t[Symbol.iterator]();!(n=(c=u.next()).done)&&(e.push(c.value),!r||e.length!==r);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return e}},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r){function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},e(r,n)}t.exports=e},function(t,r,e){var n=e(0);t.exports=function(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=n(t)););return t}},function(t,r,e){var n=e(17);function o(t){var r,e;function o(r,e){try{var c=t[r](e),u=c.value,a=u instanceof n;Promise.resolve(a?u.wrapped:u).then((function(t){a?o("next",t):i(c.done?"return":"normal",t)}),(function(t){o("throw",t)}))}catch(t){i("throw",t)}}function i(t,n){switch(t){case"return":r.resolve({value:n,done:!0});break;case"throw":r.reject(n);break;default:r.resolve({value:n,done:!1})}(r=r.next)?o(r.key,r.arg):e=null}this._invoke=function(t,n){return new Promise((function(i,c){var u={key:t,arg:n,resolve:i,reject:c,next:null};e?e=e.next=u:(r=e=u,o(t,n))}))},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(o.prototype[Symbol.asyncIterator]=function(){return this}),o.prototype.next=function(t){return this._invoke("next",t)},o.prototype.throw=function(t){return this._invoke("throw",t)},o.prototype.return=function(t){return this._invoke("return",t)},t.exports=o},function(t,r){t.exports=function(t){if(Array.isArray(t)){for(var r=0,e=new Array(t.length);r=0||(o[e]=t[e]);return o}},function(t,r,e){"use strict";e.r(r),e.d(r,"settings",(function(){return n})),e.d(r,"setup",(function(){return u})),e.d(r,"api",(function(){return G})),e.d(r,"alias",(function(){return Vr})),e.d(r,"use",(function(){return Xr})),e.d(r,"AccessToken",(function(){return $r})),e.d(r,"Operator",(function(){return Kr})),e.d(r,"ActionApp",(function(){return Zr})),e.d(r,"Application",(function(){return Gr})),e.d(r,"TrustedApplication",(function(){return zr})),e.d(r,"User",(function(){return Br})),e.d(r,"Device",(function(){return Jr})),e.d(r,"Entity",(function(){return te})),e.d(r,"Symbol",(function(){return ht})),e.d(r,"_Resource",(function(){return wt})),e.d(r,"_Entity",(function(){return Rt})),e.d(r,"_Scope",(function(){return yt}));e(22);var n=Object.assign({},{apiUrl:"https://api.evrythng.io/v2",apiKey:"",fullResponse:!1,geolocation:!0,timeout:0,headers:{"content-type":"application/json"},interceptors:[],defaultShortDomain:"tn.gg",apiVersion:2,region:"us"}),o=[1,2],i=["us","eu"],c={2:{us:"https://api.evrythng.io/v2",eu:"https://api.eu.evrythng.io/v2"},1:{us:"https://api.evrythng.com",eu:"https://api-eu.evrythng.com"}};function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.apiUrl,e=t.apiVersion,u=void 0===e?2:e,a=t.region,s=void 0===a?"us":a;if(!o.includes(u))throw new Error("Invalid apiVersion: ".concat(u,". Choose from ").concat(o.join(", ")));if(!i.includes(s))throw new Error("Invalid region: ".concat(s,". Choose from ").concat(i.join(", ")));return t.apiUrl=r||c[u][s],t.apiVersion=u,t.region=s,Object.assign(n,t)}var a=e(5),s=e.n(a),f=e(11),l=e.n(f),p=e(6),h=e.n(p),y=e(19),v="object"==typeof self&&self&&self.Object===Object&&self,d=(y.a||v||Function("return this")()).Symbol,m=Object.prototype,g=m.hasOwnProperty,b=m.toString,w=d?d.toStringTag:void 0;var R=function(t){var r=g.call(t,w),e=t[w];try{t[w]=void 0;var n=!0}catch(t){}var o=b.call(t);return n&&(r?t[w]=e:delete t[w]),o},x=Object.prototype.toString;var k=function(t){return x.call(t)},P=d?d.toStringTag:void 0;var j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":P&&P in Object(t)?R(t):k(t)};var O=function(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)};var S=function(t){if(!O(t))return!1;var r=j(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r},A=e(10),D=e.n(A);var E=function(t,r){return function(e){return t(r(e))}}(Object.getPrototypeOf,Object);var _=function(t){return null!=t&&"object"==typeof t},F=Function.prototype,T=Object.prototype,U=F.toString,I=T.hasOwnProperty,L=U.call(Object);var K=function(t){if(!_(t)||"[object Object]"!=j(t))return!1;var r=E(t);if(null===r)return!0;var e=I.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&U.call(e)==L},B=new RegExp("[".concat(["&","|","!",">","<","=","~","(",")",","].join("\\"),"]"),"g");function C(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return K(t)?Object.entries(t).map(q(r)).join("&"):t}function q(t){var r=function(t){return function(r){return t?encodeURIComponent(r):function(t){return t.replace(B,"\\$&")}(r)}}(t);return function(t){var e=D()(t,2),n=e[0],o=e[1];return"".concat(r(n),"=").concat(r(C(o)))}}function N(t){return function(r){return t&&t(null,r),r}}function M(t){return function(r){if(t&&t(r),!r)throw new Error("No error message available, err was: ".concat(JSON.stringify(r)));if(r.name&&r.name.includes("Error"))throw r;if(void 0!==r.ok&&!r.ok)return r.text().then((function(t){return Promise.reject(t)}));if("string"==typeof r)try{r=JSON.parse(r)}catch(t){}throw new Error(r.message||JSON.stringify(r))}}function G(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,e=z(t);return H(e).then((function(t){return V(t).then(J(t)).then($(t))})).then(N(r)).catch(M(r))}function z(t){var r=Object.assign({method:"get",url:""},n,t,{headers:Object.assign({},n.headers,t.headers)});return!r.headers.authorization&&r.apiKey&&(r.headers.authorization=r.apiKey),r.data&&(r.body=JSON.stringify(r.data),Reflect.deleteProperty(r,"data")),r}function H(t){var r=!1;function e(){r=!0}var n=Promise.resolve(t);return Array.isArray(t.interceptors)&&t.interceptors.filter((function(t){return S(t.request)})).forEach((function(t){n=n.then((function(n){return r?n:t.request(n,e)||n}))})),n.then((function(t){return r?Promise.reject({errors:["Request cancelled on request interceptors"],cancelled:!0}):t}))}function V(t){var r=fetch(function(t){var r="".concat(t.apiUrl).concat(t.url);return t.params&&(r+="?".concat(C(t.params))),r}(t),t);return t.timeout?Promise.race([r,new Promise((function(r,e){setTimeout((function(){return e("Request timeout")}),t.timeout)}))]):r}function J(t){return function(){var r=h()(s.a.mark((function r(e){var n,o;return s.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=t.fullResponse?Promise.resolve(e):204===e.status||"delete"===t.method.toLowerCase()?Promise.resolve():e.json(),o="",r.prev=2,r.next=5,n;case 5:o=r.sent,r.next=10;break;case 8:r.prev=8,r.t0=r.catch(2);case 10:if(e.ok){r.next=19;break}if("object"!==l()(o)){r.next=15;break}r.t1=o,r.next=18;break;case 15:return r.next=17,e.json();case 17:r.t1=r.sent;case 18:throw r.t1;case 19:return r.abrupt("return",o);case 20:case"end":return r.stop()}}),r,null,[[2,8]])})));return function(t){return r.apply(this,arguments)}}()}function $(t){return function(r){var e=Promise.resolve(r);return Array.isArray(t.interceptors)&&t.interceptors.filter((function(t){return S(t.response)})).forEach((function(t){e=e.then(t.response)})),e}}var W=e(12),X=e.n(W),Y=e(1),Q=e.n(Y),Z=e(2),tt=e.n(Z),rt=e(8),et=e.n(rt),nt=e(3),ot=e.n(nt),it=e(4),ct=e.n(it),ut=e(9),at=e.n(ut),st=e(0),ft=e.n(st),lt=Array.isArray;var pt=function(t){return"string"==typeof t||!lt(t)&&_(t)&&"[object String]"==j(t)},ht={init:Symbol("init"),path:Symbol("path"),resource:Symbol("resource")},yt=function(){function t(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Q()(this,t),!pt(r))throw new Error("Scope constructor should be called with an API Key");this.apiKey=r,Object.assign(this,e)}return tt()(t,[{key:"readAccess",value:function(){return G({url:"/access",apiKey:this.apiKey})}},{key:"read",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=Object.assign(t,{method:"get",url:this[ht.path],apiKey:this.apiKey});return this._request(r)}},{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=Object.assign(r,{method:"put",url:this[ht.path],apiKey:this.apiKey,data:t});return this._request(e)}},{key:"_request",value:function(t){var r=this;return G(t).then((function(t){return Object.assign(r,t)}))}}]),t}(),vt=e(14),dt=e.n(vt),mt=e(20),gt=e.n(mt);function bt(t){var r={};if(t&&t.length)for(var e=t.split(","),n=0;n/,"$1").trim();r[o[1].replace(/rel="(.*)"/,"$1").trim()]=i}return r}var wt=function(){function t(r,e,n,o,i){if(Q()(this,t),!(r&&r instanceof yt))throw new TypeError("Scope should inherit from Scope (e.g. EVT.Application).");if(!pt(e))throw new TypeError("Resource must have a String path.");this.scope=r,this.path="".concat("/"!==e[0]?"/":"").concat(e),this.preParams={},this.id=o,this.typeName=i,n&&(n===Rt||n.prototype instanceof Rt)&&(this.type=n)}var r,e,n,o,i,c,u;return tt()(t,null,[{key:"factoryFor",value:function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;if(!r)throw new Error("Entity type is necessary for resource factory.");return function(i){var c,u,a;if(this instanceof yt?(u=this,c=""):this instanceof t?(u=this.scope,c=this.path):this instanceof Rt&&(u=this[ht.resource].scope,c=this[ht.resource].path),a=c+e,i){if(!pt(i))throw new TypeError("ID must be a string.");a+="/".concat(encodeURIComponent(i))}return new(n?n(t):t)(u,a,r,i,o)}}}]),tt()(t,[{key:"serialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.type&&t instanceof this.type?t.json():t}},{key:"deserialize",value:function(r){var e=this;if(r&&this.type){if(Array.isArray(r))return"object"===l()(r[0])?r.map(this.deserialize.bind(this)):r;if(!r.body){var n=this.path;r.id&&-1===n.indexOf(r.id)&&(n+="/".concat(r.id));var o=new t(this.scope,n,this.type);return new(0,this.type)(o,r)}r.deserialize=function(){return r.json().then(e.deserialize.bind(e))}}return r}},{key:"setWithScopes",value:function(){return this.preParams.withScopes=!0,this}},{key:"setContext",value:function(){return this.preParams.context=!0,this}},{key:"setPerPage",value:function(t){return this.preParams.perPage=t,this}},{key:"setProject",value:function(t){return this.preParams.project=t,this}},{key:"setFilter",value:function(t){return this.preParams.filter=t,this}},{key:"setIds",value:function(t){return this.preParams.ids=t,this}},{key:"create",value:function(t,r,e){if(!t||S(t))throw new TypeError("Create method must have payload.");var n={url:r&&r.url?r.url:this.path,data:t,method:"post"};return this._request(n,r,e)}},{key:"read",value:function(t,r){return this._request({url:this.path,method:"get"},t,r)}},{key:"update",value:function(t,r,e){if(!t||S(t))throw new TypeError("Update method must have payload.");return this._request({url:this.path,data:t,method:"put"},r,e)}},{key:"delete",value:function(t,r){return this._request({url:this.path,method:"delete"},t,r)}},{key:"pages",value:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return gt()(s.a.mark((function e(){var n,o;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.fullResponse,e.next=3,dt()(t._linkRequest({url:t.path},n,r));case 3:return o=e.sent,e.next=6,o.result;case 6:if(!o.next){e.next=14;break}return e.next=9,dt()(t._linkRequest({apiUrl:o.next},n));case 9:return o=e.sent,e.next=12,o.result;case 12:e.next=6;break;case 14:case"end":return e.stop()}}),e)})))()}},{key:"rescope",value:(u=h()(s.a.mark((function t(r,e){var n,o,i;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}throw new Error("An array of project IDs to be scoped to must be provided");case 2:return n={withScopes:!0},t.next=5,this.read({params:n});case 5:return o=t.sent,(i=o.scopes).projects=r,Array.isArray(e)&&(i.users=e),t.abrupt("return",this.update({scopes:i}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,r){return u.apply(this,arguments)})},{key:"upsert",value:(c=h()(s.a.mark((function t(r,e,n){var o,i,c,u,a;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e&&("string"==typeof e||"object"===l()(e))){t.next=2;break}throw new Error("updateKey must be a 'name' string or an object, eg: { shortId: 'a7ysf8hd' }");case 2:return o={filter:"name=".concat(e)},"object"===l()(e)&&(i=D()(Object.entries(e)[0],2),c=i[0],u=i[1],o.filter="identifiers.".concat(c,"=").concat(u)),t.next=6,this.read({params:o});case 6:if(!((a=t.sent).length>1)){t.next=10;break}if(n){t.next=10;break}throw new Error("More than one resource was found. Set 'allowPlural' to 'true' as third parameter to update the first returned.");case 10:if(!a.length){t.next=12;break}return t.abrupt("return",a[0].update(r));case 12:return t.abrupt("return",this.create(r));case 13:case"end":return t.stop()}}),t,this)}))),function(t,r,e){return c.apply(this,arguments)})},{key:"find",value:(i=h()(s.a.mark((function t(r){var e,n,o,i,c;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e={filter:"name=".concat(r)},"object"!==l()(r)){t.next=7;break}if(!((n=Object.entries(r)).length>1)){t.next=5;break}throw new Error("Only one key-value pair may be specified for find()");case 5:o=D()(n[0],2),i=o[0],c=o[1],e.filter="identifiers.".concat(i,"=").concat(c);case 7:return t.abrupt("return",this.read({params:e}));case 8:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"stream",value:(o=h()(s.a.mark((function t(r){var e,n,o,i,c;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.pages(),n=0;case 2:return t.next=4,e.next();case 4:if((o=t.sent).done){t.next=18;break}c=0;case 6:if(!(c1&&void 0!==u[1]?u[1]:{},n=u.length>2?u[2]:void 0,S(e)&&(n=e),!(o=Object.assign({},e,r,{apiKey:this.scope.apiKey})).body){t.next=8;break}return t.next=7,this.serialize(o.body);case 7:o.body=t.sent;case 8:return Object.keys(this.preParams).length&&(Object.assign(o,{params:this.preParams}),this.preParams={}),t.prev=9,t.next=12,G(o);case 12:return i=t.sent,t.next=15,this.deserialize(i);case 15:return c=t.sent,t.abrupt("return",N(n)(c));case 19:throw t.prev=19,t.t0=t.catch(9),M(n)(t.t0);case 22:case"end":return t.stop()}}),t,this,[[9,19]])}))),function(t){return e.apply(this,arguments)})},{key:"_linkRequest",value:(r=h()(s.a.mark((function t(r,e){var n,o,i,c,u,a,f=arguments;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>2&&void 0!==f[2]?f[2]:{},o=Object.assign({fullResponse:!0},r),t.next=4,this._request(o,n);case 4:return i=t.sent,c=bt(i.headers.get("link")),u=c.next&&decodeURIComponent(c.next),t.next=9,e?i:i.json();case 9:return a=t.sent,t.abrupt("return",{result:a,next:u});case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})}]),t}(),Rt=function(){function t(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Q()(this,t),!(r&&r instanceof wt))throw new Error("Resource must be a Resource.");this[ht.resource]=r,Object.assign(this,e)}return tt()(t,[{key:"json",value:function(){return Object.entries(this).reduce((function(t,r){var e=D()(r,2),n=e[0],o=e[1];return Object.assign(t,X()({},n,o))}),{})}},{key:"update",value:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.json(),e=arguments.length>1?arguments[1]:void 0;return this[ht.resource].update(r,e).then((function(r){return Object.assign(t,r),r}))}},{key:"delete",value:function(t){return this[ht.resource].delete(t)}}]),t}();var xt=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{access:function(t){if(this instanceof yt)throw new Error("Access is not a top-level resource.");return wt.factoryFor(e,"/accesses").call(this,t)}}}}]),e}(Rt);var kt=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{domain:function(){if(pt(arguments[0]))throw new TypeError("There is no single resource for Domains");if(this instanceof yt)throw new Error("Domain is not a top-level resource.");return wt.factoryFor(e,"/domains").call(this)}}}}]),e}(Rt);var Pt=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{operatorAccess:function(t){return wt.factoryFor(e,"/operatorAccess").call(this,t)}}}}]),e}(Rt);var jt=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{shortDomain:function(){if(pt(arguments[0]))throw new TypeError("There is no single resource for ShortDomains");if(this instanceof yt)throw new Error("ShortDomain is not a top-level resource.");return wt.factoryFor(e,"/shortDomains").call(this)}}}}]),e}(Rt),Ot=e(7),St=e.n(Ot);function At(t){var r=t.map((function(t){return t.resourceFactory()})),e=Object.assign.apply(Object,[{}].concat(St()(r)));return function(t){return Dt(e)(function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return e}(t))}}function Dt(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function(e){var n=!0,o=!1,i=void 0;try{for(var c,u=Reflect.ownKeys(t)[Symbol.iterator]();!(n=(c=u.next()).done);n=!0){var a=c.value;Object.defineProperty(r?e.prototype:e,a,{value:t[a]})}}catch(t){o=!0,i=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return e}}var Et=At([kt,jt,xt,Pt]),_t=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{sharedAccount:wt.factoryFor(e,"/accounts",Et)}}}]),e}(Et(Rt));var Ft=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{event:wt.factoryFor(e,"/events")}}}]),e}(Rt);var Tt=At([Ft]),Ut=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{adiOrder:wt.factoryFor(e,"/adis/orders",Tt)}}}]),e}(Tt(Rt));var It=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{property:function(t){var r=this instanceof yt?this[ht.path]:"";return Object.assign(wt.factoryFor(e,r+"/properties").call(this,t),{create:function(){var t;return(t=wt.prototype.create).call.apply(t,[this].concat(St()(Lt.apply(void 0,arguments))))},update:function(){var t;return(t=wt.prototype.update).call.apply(t,[this].concat(St()(Lt.apply(void 0,arguments))))}})}}}}]),e}(Rt);function Lt(t){pt(t)||"number"==typeof t||"boolean"==typeof t?t=[{value:t}]:K(t)&&(t=t.hasOwnProperty("value")?[t]:Object.entries(t).map((function(t){return{key:t[0],value:t[1]}})));for(var r=arguments.length,e=new Array(r>1?r-1:0),n=1;n2?e-2:0),o=2;o0&&void 0!==arguments[0]?arguments[0]:n.defaultShortDomain;if(this instanceof yt)throw new Error("Redirection is not a top-level resource.");var r=this,e=function(){var e=h()(s.a.mark((function e(n){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",wt.prototype._request.call(r,Object.assign({apiUrl:"https://".concat(t),url:"/redirections",headers:{Accept:"application/json"}},n)));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return{create:function(t){return h()(s.a.mark((function n(){return s.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.evrythngId=r.id,t.type=r.typeName,n.abrupt("return",e({method:"post",body:JSON.stringify(t)}));case 3:case"end":return n.stop()}}),n)})))()},read:function(){return h()(s.a.mark((function t(){var n,o,i;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({params:{evrythngId:r.id}});case 2:return n=t.sent,o=D()(n,1),i=o[0],t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})))()},update:function(t){var r=this;return h()(s.a.mark((function n(){var o;return s.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.read();case 2:if(o=n.sent){n.next=5;break}return n.abrupt("return",r.create(t));case 5:return n.abrupt("return",e({url:"/redirections/".concat(o.shortId),method:"put",body:JSON.stringify(t)}));case 6:case"end":return n.stop()}}),n)})))()},delete:function(){var t=this;return h()(s.a.mark((function r(){var n;return s.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.read();case 2:if(n=r.sent){r.next=5;break}return r.abrupt("return",Promise.resolve());case 5:return r.abrupt("return",e({url:"/redirections/".concat(n.shortId),method:"delete"}));case 6:case"end":return r.stop()}}),r)})))()}}}}}}]),e}(Rt);var $t=At([It,Nt,Jt]),Wt=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{product:wt.factoryFor(e,"/products",$t,"product")}}}]),e}($t(Rt));var Xt=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{commissionState:function(){if(pt(arguments[0]))throw new TypeError("There is no single resource for CommissionState");var t=this instanceof yt?this[ht.path]:"";return wt.factoryFor(e,t+"/commissionState").call(this)}}}}]),e}(Rt);var Yt=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{locations:function(){if(pt(arguments[0]))throw new TypeError("There is no single resource for Locations");var t=this instanceof yt?this[ht.path]:"";return Object.assign(wt.factoryFor(e,t+"/location").call(this),{update:function(){for(var t=arguments.length,r=new Array(t),e=0;e1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:{},e=Array.isArray(t)?t:[t];return r.url="".concat(this.path,"/bulk"),wt.prototype.create.call(this,e,r)}var yr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{redirector:wt.factoryFor(e,"/redirector")}}}]),e}(Rt);var vr=At([fr,lr,pr,yr,function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{secretKey:function(){if(pt(arguments[0]))throw new TypeError("There is no single resource for SecretKey");return wt.factoryFor(e,"/secretKey").call(this)}}}}]),e}(Rt)]),dr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{application:function(t){if(this instanceof yt)throw new Error("Application is not a top-level resource.");return wt.factoryFor(e,"/applications",vr).call(this,t)}}}}]),e}(vr(Rt));var mr=At([dr]),gr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{project:wt.factoryFor(e,"/projects",mr)}}}]),e}(mr(Rt));var br=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{purchaseOrder:wt.factoryFor(e,"/purchaseOrders")}}}]),e}(Rt);var wr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{permission:function(t){if(this instanceof yt)throw new Error("Permission is not a top-level resource.");return wt.factoryFor(e,"/permissions").call(this,t)}}}}]),e}(Rt);var Rr=At([wr]),xr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{role:wt.factoryFor(e,"/roles",Rr)}}}]),e}(Rr(Rt));var kr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(){return Q()(this,e),r.apply(this,arguments)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{rule:function(t){if(!pt(t))throw new TypeError("Rule name must be a string");return Object.assign(wt.factoryFor(e,"/rules").call(this,t),{run:function(){for(var t,r=arguments.length,e=new Array(r),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return Q()(this,e),(o=r.call(this,t,i)).initPromise=at()((n=et()(o),ft()(e.prototype)),"readAccess",n).call(n).then((function(t){o.id=t.actor.id,o[ht.path]=o._getPath()})).then((function(){return o.read()})),o}return tt()(e,[{key:"init",value:function(){return this.initPromise}},{key:"update",value:function(t){var r={method:"put",url:"/operators/".concat(this.id),apiKey:this.apiKey,data:t};return this._request(r)}},{key:"_getPath",value:function(){return"/operators/".concat(this.id)}}]),e}(At([Ur,Ir,_t,Nt,cr,Ut,Dr,ir,_r,Lr,Er,Wt,gr,br,pr,yr,xr,kr,jr,nr,Or])(yt));var Br=function(t){ot()(n,t);var r,e=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(n);function n(t){var r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Q()(this,n),(o=e.call(this,t,i)).initPromise=at()((r=et()(o),ft()(n.prototype)),"readAccess",r).call(r).then((function(t){o.id=t.actor.id,o[ht.path]=o._getPath()})).then((function(){return o.read()})),o}return tt()(n,[{key:"init",value:function(){return this.initPromise}},{key:"logout",value:(r=h()(s.a.mark((function t(r){var e;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this._invalidateUser();case 3:return e=t.sent,r&&r(e),t.abrupt("return",e);case 8:throw t.prev=8,t.t0=t.catch(0),r&&r(t.t0),t.t0;case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(t){return r.apply(this,arguments)})},{key:"_getPath",value:function(){return"/users/".concat(this.id)}},{key:"_invalidateUser",value:function(){return G({url:"/auth/all/logout",method:"post",apiKey:this.apiKey})}}]),n}(At([Wt,nr,ir,Nt,cr,br,xr,kr,Er,_r])(yt));var Cr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Q()(this,e);var o=Object.assign({},n);return o.evrythngUser&&(o.id=o.evrythngUser,Reflect.deleteProperty(o,"evrythngUser")),r.call(this,t,o)}return tt()(e,null,[{key:"resourceFactory",value:function(){return{appUser:function(t){return Object.assign(wt.factoryFor(e,"/auth/evrythng/users").call(this,t),{create:function(){for(var t=arguments.length,r=new Array(t),e=0;e1&&void 0!==arguments[1]?arguments[1]:{};return Q()(this,n),(o=e.call(this,t,i)).initPromise=at()((r=et()(o),ft()(n.prototype)),"readAccess",r).call(r).then((function(t){o.id=t.actor.id,o.project=t.project,o[ht.path]=o._getPath()})).then((function(){return o.read()})),o}return tt()(n,[{key:"init",value:function(){return this.initPromise}},{key:"login",value:(r=h()(s.a.mark((function t(r,e){var n,o;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this._authenticateUser(r);case 3:return n=t.sent,o=new Br(n.access.apiKey,n),t.next=7,o.init();case 7:return e&&e(null,o),t.abrupt("return",o);case 11:throw t.prev=11,t.t0=t.catch(0),e&&e(t.t0),t.t0;case 15:case"end":return t.stop()}}),t,this,[[0,11]])}))),function(t,e){return r.apply(this,arguments)})},{key:"_getPath",value:function(){return"/applications/me"}},{key:"_authenticateUser",value:function(t){if(!t||!K(t))throw new TypeError("Credentials are missing.");return G({url:"/users/login",method:"post",data:t,apiKey:this.apiKey})}}]),n}(At([Wt,Nt,Cr,Er])(yt));var zr=function(t){ot()(n,t);var r,e=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(n);function n(t){var r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Q()(this,n),(o=e.call(this,t,i)).initPromise=at()((r=et()(o),ft()(n.prototype)),"readAccess",r).call(r).then((function(t){o.id=t.actor.id,o.project=t.project,o.app=t.actor.id,o[ht.path]=o._getPath()})).then((function(){return o.read()})),o}return tt()(n,[{key:"init",value:function(){return this.initPromise}},{key:"login",value:(r=h()(s.a.mark((function t(r,e){var n,o;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this._authenticateUser(r);case 3:return n=t.sent,o=new Or(n.access.apiKey,n),t.next=7,o.init();case 7:return e&&e(null,o),t.abrupt("return",o);case 11:throw t.prev=11,t.t0=t.catch(0),e&&e(t.t0),t.t0;case 15:case"end":return t.stop()}}),t,this,[[0,11]])}))),function(t,e){return r.apply(this,arguments)})},{key:"_getPath",value:function(){return"/applications/me"}},{key:"_authenticateUser",value:function(t){if(!t||!K(t))throw new TypeError("Credentials are missing.");return G({url:"/users/login",method:"post",data:t,apiKey:this.apiKey})}}]),n}(At([nr,ir,cr,Or,br,lr,pr])(Gr)),Hr={Operator:Kr,Application:Gr,TrustedApplication:zr,User:Br};function Vr(t,r){var e=Object.keys(Hr);if(!e.includes(r))throw new Error("Invalid target. Choose from ".concat(e.join(", ")));var n=Hr[r];for(var o in t){if(!n.prototype[o])throw new Error("".concat(o," does not exist for ").concat(r));Object.assign(n.prototype,X()({},t[o],n.prototype[o]))}}var Jr=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(t){var n,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Q()(this,e),(o=r.call(this,t,i)).initPromise=at()((n=et()(o),ft()(e.prototype)),"readAccess",n).call(n).then((function(t){o.id=t.actor.id,o[ht.path]=o._getPath()})).then((function(){return o.read()})),o}return tt()(e,[{key:"init",value:function(){return this.initPromise}},{key:"_getPath",value:function(){return"/thngs/".concat(this.id)}}]),e}(At([It,Nt,Yt])(yt));var $r=function(t){ot()(e,t);var r=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(e);function e(t){var n,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Q()(this,e),(o=r.call(this,t,i)).initPromise=at()((n=et()(o),ft()(e.prototype)),"readAccess",n).call(n),o}return tt()(e,[{key:"init",value:function(){return this.initPromise}}]),e}(At([Ur,Ir,_t,Nt,cr,Ut,ir,_r,Lr,Er,Wt,gr,br,yr,jr,nr])(yt)),Wr={scopes:{AccessToken:$r,Operator:Kr,Application:Gr,TrustedApplication:zr,User:Br,Device:Jr},entities:{Access:xt,AccessPolicy:Ur,AccessTokens:Ir,Account:_t,Action:Nt,ActionType:cr,ADIOrder:Ut,ADIOrderEvent:Ft,Application:dr,AppUser:Cr,Batch:Dr,Collection:ir,CommissionState:Xt,Domain:kt,Entity:Rt,File:_r,Location:Yt,Me:Lr,OperatorAccess:Pt,Permission:wr,Place:Er,Product:Wt,Project:gr,Property:It,PurchaseOrder:br,ReactorLog:pr,ReactorSchedule:lr,ReactorScript:fr,Redirection:Jt,Redirector:yr,Role:xr,ShipmentNotice:jr,ShortDomain:jt,Thng:nr,User:Or},resources:{Resource:wt}};function Xr(t){if(!t.install||"function"!=typeof t.install)throw new Error("Plugin must implement an 'install()' method");try{t.install(Wr)}catch(t){console.log("Failed to install plugin"),console.log(t)}}var Yr=e(21),Qr=e.n(Yr);var Zr=function(t){ot()(u,t);var r,e,n,o,i,c=function(t){function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var e,n=ft()(t);if(r()){var o=ft()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return ct()(this,e)}}(u);function u(t){var r,e;return Q()(this,u),(e=c.call(this,t)).initPromise=at()((r=et()(e),ft()(u.prototype)),"readAccess",r).call(r).then((function(t){e.id=t.actor.id,e.project=t.project,e[ht.path]=e._getPath()})).then((function(){return e.read()})).then((function(){return e._getAnonUser()})).then((function(t){e.anonUser=t})),e}return tt()(u,[{key:"init",value:function(){return this.initPromise}},{key:"pageVisited",value:(i=h()(s.a.mark((function t(){return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createAction("_PageVisited",{url:window.location.href}));case 1:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"createAction",value:(o=h()(s.a.mark((function t(r){var e,n,o,i,c,u=arguments;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=u.length>1&&void 0!==u[1]?u[1]:{},this.anonUser){t.next=3;break}throw new Error("Anonymous user not yet prepared. Use actionApp.init() to wait for this.");case 3:if(!r.startsWith("_")){t.next=13;break}return t.prev=4,t.next=7,this.anonUser.actionType(r).read();case 7:t.next=13;break;case 9:throw t.prev=9,t.t0=t.catch(4),console.error(t.t0),new Error("The action type was not found. Is it in project scope?");case 13:if(n=e.thng,o=e.product,i=Qr()(e,["thng","product"]),!n||!o){t.next=16;break}throw new Error("Either thng or product can be specified as target, not both");case 16:return c={type:r,customFields:i},n&&(c.thng=n),o&&(c.product=o),t.abrupt("return",this.anonUser.action(r).create(c));case 20:case"end":return t.stop()}}),t,this,[[4,9]])}))),function(t){return o.apply(this,arguments)})},{key:"getAnonymousUser",value:(n=h()(s.a.mark((function t(){return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.anonUser){t.next=2;break}throw new Error("Anonymous user not yet prepared. Use actionApp.init() to wait for this.");case 2:return t.abrupt("return",this.anonUser);case 3:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"_getPath",value:function(){return"/applications/me"}},{key:"_getStorageKey",value:function(){return"action-app-user-".concat(this.id)}},{key:"_createAnonUser",value:(e=h()(s.a.mark((function t(){var r;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.appUser().create({anonymous:!0});case 2:return r=t.sent,localStorage.setItem(this._getStorageKey(),r.evrythngApiKey),t.abrupt("return",r);case 5:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"_getAnonUser",value:(r=h()(s.a.mark((function t(){var r,e;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=localStorage.getItem(this._getStorageKey())){t.next=3;break}return t.abrupt("return",this._createAnonUser());case 3:return e=new Br(r),t.abrupt("return",e.init());case 5:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})}]),u}(At([Cr])(yt)),te={Access:xt,AccessPolicy:Ur,AccessTokens:Ir,Account:_t,Action:Nt,ActionType:cr,ADIOrder:Ut,ADIOrderEvent:Ft,Application:dr,Batch:Dr,Collection:ir,CommissionState:Xt,Domain:kt,File:_r,Location:Yt,Me:Lr,OperatorAccess:Pt,Permission:wr,Place:Er,Product:Wt,Project:gr,Property:It,PurchaseOrder:br,Role:xr,ReactorLog:pr,ReactorSchedule:lr,ReactorScript:fr,Redirection:Jt,Redirector:yr,ShipmentNotice:jr,ShortDomain:jt,Task:Sr,Thng:nr,User:Or}}]);(()=>{var si=Object.create;var Jt=Object.defineProperty;var ui=Object.getOwnPropertyDescriptor;var ci=Object.getOwnPropertyNames;var fi=Object.getPrototypeOf,pi=Object.prototype.hasOwnProperty;var yr=e=>Jt(e,"__esModule",{value:!0});var li=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),br=(e,t)=>{yr(e);for(var r in t)Jt(e,r,{get:t[r],enumerable:!0})},di=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ci(t))!pi.call(e,n)&&n!=="default"&&Jt(e,n,{get:()=>t[n],enumerable:!(r=ui(t,n))||r.enumerable});return e},mi=e=>di(yr(Jt(e!=null?si(fi(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var Br=li((ea,Zt)=>{var Er,Sr,xr,Tr,wr,Or,Ir,Rr,kr,Qt,Ce,Cr,Nr,xt,Ar,Mr,Dr,Pr,jr,Fr,Ur,Hr,Lr;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){e(r(t,r(n)))}):typeof Zt=="object"&&typeof Zt.exports=="object"?e(r(t,r(Zt.exports))):e(r(t));function r(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(o,a){return n[o]=i?i(o,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])};Er=function(r,n){t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Sr=Object.assign||function(r){for(var n,i=1,o=arguments.length;i=0;c--)(u=r[c])&&(s=(a<3?u(s):a>3?u(n,i,s):u(n,i))||s);return a>3&&s&&Object.defineProperty(n,i,s),s},wr=function(r,n){return function(i,o){n(i,o,r)}},Or=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Ir=function(r,n,i,o){function a(s){return s instanceof i?s:new i(function(u){u(s)})}return new(i||(i=Promise))(function(s,u){function c(m){try{l(o.next(m))}catch(h){u(h)}}function p(m){try{l(o.throw(m))}catch(h){u(h)}}function l(m){m.done?s(m.value):a(m.value).then(c,p)}l((o=o.apply(r,n||[])).next())})},Rr=function(r,n){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o,a,s,u;return u={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(l){return function(m){return p([l,m])}}function p(l){if(o)throw new TypeError("Generator is already executing.");for(;i;)try{if(o=1,a&&(s=l[0]&2?a.return:l[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,l[1])).done)return s;switch(a=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,a=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(s=i.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},Ce=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var o=i.call(r),a,s=[],u;try{for(;(n===void 0||n-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(c){u={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(u)throw u.error}}return s},Cr=function(){for(var r=[],n=0;n1||c(v,y)})})}function c(v,y){try{p(o[v](y))}catch(E){h(s[0][3],E)}}function p(v){v.value instanceof xt?Promise.resolve(v.value.v).then(l,m):h(s[0][2],v)}function l(v){c("next",v)}function m(v){c("throw",v)}function h(v,y){v(y),s.shift(),s.length&&c(s[0][0],s[0][1])}},Mr=function(r){var n,i;return n={},o("next"),o("throw",function(a){throw a}),o("return"),n[Symbol.iterator]=function(){return this},n;function o(a,s){n[a]=r[a]?function(u){return(i=!i)?{value:xt(r[a](u)),done:a==="return"}:s?s(u):u}:s}},Dr=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof Qt=="function"?Qt(r):r[Symbol.iterator](),i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i);function o(s){i[s]=r[s]&&function(u){return new Promise(function(c,p){u=r[s](u),a(c,p,u.done,u.value)})}}function a(s,u,c,p){Promise.resolve(p).then(function(l){s({value:l,done:c})},u)}},Pr=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r},jr=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)Object.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return n.default=r,n},Fr=function(r){return r&&r.__esModule?r:{default:r}},Ur=function(r,n){if(!n.has(r))throw new TypeError("attempted to get private field on non-instance");return n.get(r)},Hr=function(r,n,i){if(!n.has(r))throw new TypeError("attempted to set private field on non-instance");return n.set(r,i),i},e("__extends",Er),e("__assign",Sr),e("__rest",xr),e("__decorate",Tr),e("__param",wr),e("__metadata",Or),e("__awaiter",Ir),e("__generator",Rr),e("__exportStar",kr),e("__createBinding",Lr),e("__values",Qt),e("__read",Ce),e("__spread",Cr),e("__spreadArrays",Nr),e("__await",xt),e("__asyncGenerator",Ar),e("__asyncDelegator",Mr),e("__asyncValues",Dr),e("__makeTemplateObject",Pr),e("__importStar",jr),e("__importDefault",Fr),e("__classPrivateFieldGet",Ur),e("__classPrivateFieldSet",Hr)})});var qr=mi(Br()),{__extends:A,__assign:f,__rest:te,__decorate:ra,__param:na,__metadata:ia,__awaiter:oa,__generator:aa,__exportStar:sa,__createBinding:ua,__values:H,__read:ee,__spread:g,__spreadArrays:ca,__await:fa,__asyncGenerator:pa,__asyncDelegator:la,__asyncValues:da,__makeTemplateObject:ma,__importStar:ha,__importDefault:va,__classPrivateFieldGet:ga,__classPrivateFieldSet:_a}=qr.default;var F;(function(e){e.Ok="ok",e.Exited="exited",e.Crashed="crashed",e.Abnormal="abnormal"})(F||(F={}));var Ne;(function(e){e.Ok="ok",e.Errored="errored",e.Crashed="crashed"})(Ne||(Ne={}));var M;(function(e){e.Fatal="fatal",e.Error="error",e.Warning="warning",e.Log="log",e.Info="info",e.Debug="debug",e.Critical="critical"})(M||(M={}));(function(e){function t(r){switch(r){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}}e.fromString=t})(M||(M={}));var Y;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.Invalid="invalid",e.Failed="failed"})(Y||(Y={}));(function(e){function t(r){return r>=200&&r<300?e.Success:r===429?e.RateLimit:r>=400&&r<500?e.Invalid:r>=500?e.Failed:e.Unknown}e.fromHttpCode=t})(Y||(Y={}));var it;(function(e){e.Explicit="explicitly_set",e.Sampler="client_sampler",e.Rate="client_rate",e.Inheritance="inheritance"})(it||(it={}));function re(e){switch(Object.prototype.toString.call(e)){case"[object Error]":return!0;case"[object Exception]":return!0;case"[object DOMException]":return!0;default:return D(e,Error)}}function ne(e){return Object.prototype.toString.call(e)==="[object ErrorEvent]"}function Ae(e){return Object.prototype.toString.call(e)==="[object DOMError]"}function Gr(e){return Object.prototype.toString.call(e)==="[object DOMException]"}function z(e){return Object.prototype.toString.call(e)==="[object String]"}function lt(e){return e===null||typeof e!="object"&&typeof e!="function"}function K(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tt(e){return typeof Event!="undefined"&&D(e,Event)}function Me(e){return typeof Element!="undefined"&&D(e,Element)}function Vr(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function $(e){return Boolean(e&&e.then&&typeof e.then=="function")}function Wr(e){return K(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function D(e,t){try{return e instanceof t}catch(r){return!1}}function Z(e,t){try{for(var r=e,n=5,i=80,o=[],a=0,s=0,u=" > ",c=u.length,p=void 0;r&&a++1&&s+o.length*c+p.length>=i));)o.push(p),s+=p.length,r=r.parentNode;return o.reverse().join(u)}catch(l){return""}}function hi(e,t){var r,n,i=e,o=[],a,s,u,c,p;if(!i||!i.tagName)return"";o.push(i.tagName.toLowerCase());var l=((r=t)===null||r===void 0?void 0:r.length)?t.filter(function(h){return i.getAttribute(h)}).map(function(h){return[h,i.getAttribute(h)]}):null;if((n=l)===null||n===void 0?void 0:n.length)l.forEach(function(h){o.push("["+h[0]+'="'+h[1]+'"]')});else if(i.id&&o.push("#"+i.id),a=i.className,a&&z(a))for(s=a.split(/\s+/),p=0;p1&&(m=v.slice(0,-1).join("/"),h=v.pop()),h){var y=h.match(/^\d+/);y&&(h=y[0])}this._fromComponents({host:u,pass:s,path:m,projectId:h,port:p,protocol:i,publicKey:o})},e.prototype._fromComponents=function(t){"user"in t&&!("publicKey"in t)&&(t.publicKey=t.user),this.user=t.publicKey||"",this.protocol=t.protocol,this.publicKey=t.publicKey||"",this.pass=t.pass||"",this.host=t.host,this.port=t.port||"",this.path=t.path||"",this.projectId=t.projectId},e.prototype._validate=function(){var t=this;if(["protocol","publicKey","host","projectId"].forEach(function(r){if(!t[r])throw new T(Pt+": "+r+" missing")}),!this.projectId.match(/^\d+$/))throw new T(Pt+": Invalid projectId "+this.projectId);if(this.protocol!=="http"&&this.protocol!=="https")throw new T(Pt+": Invalid protocol "+this.protocol);if(this.port&&isNaN(parseInt(this.port,10)))throw new T(Pt+": Invalid port "+this.port)},e}();function X(){return Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]"}function J(e,t){return e.require(t)}function ot(e){var t;try{t=J(module,e)}catch(n){}try{var r=J(module,"process").cwd;t=J(module,r()+"/node_modules/"+e)}catch(n){}return t}function dt(e,t){return t===void 0&&(t=0),typeof e!="string"||t===0||e.length<=t?e:e.substr(0,t)+"..."}function De(e,t){if(!Array.isArray(e))return"";for(var r=[],n=0;n"}return e.event_id||""}function wt(e){var t=_(),r=["debug","info","warn","error","log","assert"];if(!("console"in t))return e();var n=t.console,i={};r.forEach(function(a){a in t.console&&n[a].__sentry_original__&&(i[a]=n[a],n[a]=n[a].__sentry_original__)});var o=e();return Object.keys(i).forEach(function(a){n[a]=i[a]}),o}function jt(e,t,r){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||r||"Error"}function et(e,t){t===void 0&&(t={});try{e.exception.values[0].mechanism=e.exception.values[0].mechanism||{},Object.keys(t).forEach(function(r){e.exception.values[0].mechanism[r]=t[r]})}catch(r){}}function zr(){try{return document.location.href}catch(e){return""}}var Kr=60*1e3;function $r(e,t){if(!t)return Kr;var r=parseInt(""+t,10);if(!isNaN(r))return r*1e3;var n=Date.parse(""+t);return isNaN(n)?Kr:n-e}var ht=_(),Pe="Sentry Logger ",bi=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 t=[],r=0;r"}try{o.currentTarget=Me(i.currentTarget)?Z(i.currentTarget):Object.prototype.toString.call(i.currentTarget)}catch(s){o.currentTarget=""}typeof CustomEvent!="undefined"&&D(e,CustomEvent)&&(o.detail=i.detail);for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(o[a]=i[a]);return o}return e}function Ei(e){return~-encodeURI(e).split(/%..|./).length}function Si(e){return Ei(JSON.stringify(e))}function Fe(e,t,r){t===void 0&&(t=3),r===void 0&&(r=100*1024);var n=vt(e,t);return Si(n)>r?Fe(e,t-1,r):n}function xi(e){var t=Object.prototype.toString.call(e);if(typeof e=="string")return e;if(t==="[object Object]")return"[Object]";if(t==="[object Array]")return"[Array]";var r=Zr(e);return lt(r)?r:t}function Zr(e,t){return t==="domain"&&e&&typeof e=="object"&&e._events?"[Domain]":t==="domainEmitter"?"[DomainEmitter]":typeof global!="undefined"&&e===global?"[Global]":typeof window!="undefined"&&e===window?"[Window]":typeof document!="undefined"&&e===document?"[Document]":Wr(e)?"[SyntheticEvent]":typeof e=="number"&&e!==e?"[NaN]":e===void 0?"[undefined]":typeof e=="function"?"[Function: "+L(e)+"]":typeof e=="symbol"?"["+String(e)+"]":typeof e=="bigint"?"[BigInt: "+String(e)+"]":e}function tn(e,t,r,n){if(r===void 0&&(r=1/0),n===void 0&&(n=new Xr),r===0)return xi(t);if(t!=null&&typeof t.toJSON=="function")return t.toJSON();var i=Zr(t,e);if(lt(i))return i;var o=Qr(t),a=Array.isArray(t)?[]:{};if(n.memoize(t))return"[Circular ~]";for(var s in o)!Object.prototype.hasOwnProperty.call(o,s)||(a[s]=tn(s,o[s],r-1,n));return n.unmemoize(t),a}function vt(e,t){try{return JSON.parse(JSON.stringify(e,function(r,n){return tn(r,n,t)}))}catch(r){return"**non-serializable**"}}function en(e,t){t===void 0&&(t=40);var r=Object.keys(Qr(e));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=t)return dt(r[0],t);for(var n=r.length;n>0;n--){var i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length?i:dt(i,t)}return""}function B(e){var t,r;if(K(e)){var n=e,i={};try{for(var o=H(Object.keys(n)),a=o.next();!a.done;a=o.next()){var s=a.value;typeof n[s]!="undefined"&&(i[s]=B(n[s]))}}catch(u){t={error:u}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return i}return Array.isArray(e)?e.map(B):e}function ae(){if(!("fetch"in _()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function se(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function rn(){if(!ae())return!1;var e=_();if(se(e.fetch))return!0;var t=!1,r=e.document;if(r&&typeof r.createElement=="function")try{var n=r.createElement("iframe");n.hidden=!0,r.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=se(n.contentWindow.fetch)),r.head.removeChild(n)}catch(i){d.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return t}function nn(){if(!ae())return!1;try{return new Request("_",{referrerPolicy:"origin"}),!0}catch(e){return!1}}function on(){var e=_(),t=e.chrome,r=t&&t.app&&t.app.runtime,n="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!r&&n}var x=_(),Ft={},an={};function Ti(e){if(!an[e])switch(an[e]=!0,e){case"console":wi();break;case"dom":Di();break;case"xhr":ki();break;case"fetch":Oi();break;case"history":Ci();break;case"error":Pi();break;case"unhandledrejection":ji();break;default:d.warn("unknown instrumentation type:",e)}}function R(e){!e||typeof e.type!="string"||typeof e.callback!="function"||(Ft[e.type]=Ft[e.type]||[],Ft[e.type].push(e.callback),Ti(e.type))}function q(e,t){var r,n;if(!(!e||!Ft[e]))try{for(var i=H(Ft[e]||[]),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(t)}catch(s){d.error(`Error while triggering instrumentation handler. Type: `+e+` Name: `+L(a)+` Error: `+s)}}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function wi(){"console"in x&&["debug","info","warn","error","log","assert"].forEach(function(e){e in x.console&&S(x.console,e,function(t){return function(){for(var r=[],n=0;n2?n[2]:void 0;if(o){var a=ue,s=String(o);ue=s,q("history",{from:a,to:s})}return r.apply(this,n)}}S(x.history,"pushState",t),S(x.history,"replaceState",t)}var Ni=1e3,ce,fe;function Ai(e,t){if(!e||e.type!==t.type)return!0;try{if(e.target!==t.target)return!0}catch(r){}return!1}function Mi(e){if(e.type!=="keypress")return!1;try{var t=e.target;if(!t||!t.tagName)return!0;if(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)return!1}catch(r){}return!0}function sn(e,t){return t===void 0&&(t=!1),function(r){if(!(!r||fe===r)&&!Mi(r)){var n=r.type==="keypress"?"input":r.type;ce===void 0?(e({event:r,name:n,global:t}),fe=r):Ai(fe,r)&&(e({event:r,name:n,global:t}),fe=r),clearTimeout(ce),ce=x.setTimeout(function(){ce=void 0},Ni)}}}function Di(){if("document"in x){var e=q.bind(null,"dom"),t=sn(e,!0);x.document.addEventListener("click",t,!1),x.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(function(r){var n=x[r]&&x[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(S(n,"addEventListener",function(i){return function(o,a,s){if(o==="click"||o=="keypress")try{var u=this,c=u.__sentry_instrumentation_handlers__=u.__sentry_instrumentation_handlers__||{},p=c[o]=c[o]||{refCount:0};if(!p.handler){var l=sn(e);p.handler=l,i.call(this,o,l,s)}p.refCount+=1}catch(m){}return i.call(this,o,a,s)}}),S(n,"removeEventListener",function(i){return function(o,a,s){if(o==="click"||o=="keypress")try{var u=this,c=u.__sentry_instrumentation_handlers__||{},p=c[o];p&&(p.refCount-=1,p.refCount<=0&&(i.call(this,o,p.handler,s),p.handler=void 0,delete c[o]),Object.keys(c).length===0&&delete u.__sentry_instrumentation_handlers__)}catch(l){}return i.call(this,o,a,s)}}))})}}var Ue=null;function Pi(){Ue=x.onerror,x.onerror=function(e,t,r,n,i){return q("error",{column:n,error:i,line:r,msg:e,url:t}),Ue?Ue.apply(this,arguments):!1}}var He=null;function ji(){He=x.onunhandledrejection,x.onunhandledrejection=function(e){return q("unhandledrejection",e),He?He.apply(this,arguments):!0}}var rt;(function(e){e.PENDING="PENDING",e.RESOLVED="RESOLVED",e.REJECTED="REJECTED"})(rt||(rt={}));var w=function(){function e(t){var r=this;this._state=rt.PENDING,this._handlers=[],this._resolve=function(n){r._setResult(rt.RESOLVED,n)},this._reject=function(n){r._setResult(rt.REJECTED,n)},this._setResult=function(n,i){if(r._state===rt.PENDING){if($(i)){i.then(r._resolve,r._reject);return}r._state=n,r._value=i,r._executeHandlers()}},this._attachHandler=function(n){r._handlers=r._handlers.concat(n),r._executeHandlers()},this._executeHandlers=function(){if(r._state!==rt.PENDING){var n=r._handlers.slice();r._handlers=[],n.forEach(function(i){i.done||(r._state===rt.RESOLVED&&i.onfulfilled&&i.onfulfilled(r._value),r._state===rt.REJECTED&&i.onrejected&&i.onrejected(r._value),i.done=!0)})}};try{t(this._resolve,this._reject)}catch(n){this._reject(n)}}return e.resolve=function(t){return new e(function(r){r(t)})},e.reject=function(t){return new e(function(r,n){n(t)})},e.all=function(t){return new e(function(r,n){if(!Array.isArray(t)){n(new TypeError("Promise.all requires an array as input."));return}if(t.length===0){r([]);return}var i=t.length,o=[];t.forEach(function(a,s){e.resolve(a).then(function(u){o[s]=u,i-=1,i===0&&r(o)}).then(null,n)})})},e.prototype.then=function(t,r){var n=this;return new e(function(i,o){n._attachHandler({done:!1,onfulfilled:function(a){if(!t){i(a);return}try{i(t(a));return}catch(s){o(s);return}},onrejected:function(a){if(!r){o(a);return}try{i(r(a));return}catch(s){o(s);return}}})})},e.prototype.catch=function(t){return this.then(function(r){return r},t)},e.prototype.finally=function(t){var r=this;return new e(function(n,i){var o,a;return r.then(function(s){a=!1,o=s,t&&t()},function(s){a=!0,o=s,t&&t()}).then(function(){if(a){i(o);return}n(o)})})},e.prototype.toString=function(){return"[object SyncPromise]"},e}();var un=function(){function e(t){this._limit=t,this._buffer=[]}return e.prototype.isReady=function(){return this._limit===void 0||this.length()0&&n(!1)},t);w.all(r._buffer).then(function(){clearTimeout(i),n(!0)}).then(null,function(){n(!0)})})},e}();var Le={nowSeconds:function(){return Date.now()/1e3}};function Fi(){var e=_().performance;if(!(!e||!e.now)){var t=Date.now()-e.now();return{now:function(){return e.now()},timeOrigin:t}}}function Ui(){try{var e=J(module,"perf_hooks");return e.performance}catch(t){return}}var Be=X()?Ui():Fi(),cn=Be===void 0?Le:{nowSeconds:function(){return(Be.timeOrigin+Be.now())/1e3}},Ot=Le.nowSeconds.bind(Le),pe=cn.nowSeconds.bind(cn),gt=pe;var le,It=function(){var e=_().performance;if(!e||!e.now){le="none";return}var t=3600*1e3,r=e.now(),n=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,o=i0?t.breadcrumbs:void 0,this._notifyEventProcessors(g(pn(),this._eventProcessors),t,r)},e.prototype._notifyEventProcessors=function(t,r,n,i){var o=this;return i===void 0&&(i=0),new w(function(a,s){var u=t[i];if(r===null||typeof u!="function")a(r);else{var c=u(f({},r),n);$(c)?c.then(function(p){return o._notifyEventProcessors(t,p,n,i+1).then(a)}).then(null,s):o._notifyEventProcessors(t,c,n,i+1).then(a).then(null,s)}})},e.prototype._notifyScopeListeners=function(){var t=this;this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(function(r){r(t)}),this._notifyingListeners=!1)},e.prototype._applyFingerprint=function(t){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],this._fingerprint&&(t.fingerprint=t.fingerprint.concat(this._fingerprint)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint},e}();function pn(){var e=_();return e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.globalEventProcessors=e.__SENTRY__.globalEventProcessors||[],e.__SENTRY__.globalEventProcessors}function G(e){pn().push(e)}var ln=function(){function e(t){this.errors=0,this.sid=U(),this.duration=0,this.status=F.Ok,this.init=!0,this.ignoreDuration=!1;var r=pe();this.timestamp=r,this.started=r,t&&this.update(t)}return e.prototype.update=function(t){if(t===void 0&&(t={}),t.user&&(!this.ipAddress&&t.user.ip_address&&(this.ipAddress=t.user.ip_address),!this.did&&!t.did&&(this.did=t.user.id||t.user.email||t.user.username)),this.timestamp=t.timestamp||pe(),t.ignoreDuration&&(this.ignoreDuration=t.ignoreDuration),t.sid&&(this.sid=t.sid.length===32?t.sid:U()),t.init!==void 0&&(this.init=t.init),!this.did&&t.did&&(this.did=""+t.did),typeof t.started=="number"&&(this.started=t.started),this.ignoreDuration)this.duration=void 0;else if(typeof t.duration=="number")this.duration=t.duration;else{var r=this.timestamp-this.started;this.duration=r>=0?r:0}t.release&&(this.release=t.release),t.environment&&(this.environment=t.environment),!this.ipAddress&&t.ipAddress&&(this.ipAddress=t.ipAddress),!this.userAgent&&t.userAgent&&(this.userAgent=t.userAgent),typeof t.errors=="number"&&(this.errors=t.errors),t.status&&(this.status=t.status)},e.prototype.close=function(t){t?this.update({status:t}):this.status===F.Ok?this.update({status:F.Exited}):this.update()},e.prototype.toJSON=function(){return B({sid:""+this.sid,init:this.init,started:new Date(this.started*1e3).toISOString(),timestamp:new Date(this.timestamp*1e3).toISOString(),status:this.status,errors:this.errors,did:typeof this.did=="number"||typeof this.did=="string"?""+this.did:void 0,duration:this.duration,attrs:B({release:this.release,environment:this.environment,ip_address:this.ipAddress,user_agent:this.userAgent})})},e}();var qe=4,Hi=100,at=function(){function e(t,r,n){r===void 0&&(r=new nt),n===void 0&&(n=qe),this._version=n,this._stack=[{}],this.getStackTop().scope=r,t&&this.bindClient(t)}return e.prototype.isOlderThan=function(t){return this._version=t&&(clearInterval(a),n(!1)))},o)})},e.prototype._getBackend=function(){return this._backend},e.prototype._isEnabled=function(){return this.getOptions().enabled!==!1&&this._dsn!==void 0},e.prototype._prepareEvent=function(t,r,n){var i=this,o=this.getOptions().normalizeDepth,a=o===void 0?3:o,s=f(f({},t),{event_id:t.event_id||(n&&n.event_id?n.event_id:U()),timestamp:t.timestamp||Ot()});this._applyClientOptions(s),this._applyIntegrationsMetadata(s);var u=r;n&&n.captureContext&&(u=nt.clone(u).update(n.captureContext));var c=w.resolve(s);return u&&(c=u.applyToEvent(s,n)),c.then(function(p){return typeof a=="number"&&a>0?i._normalizeEvent(p,a):p})},e.prototype._normalizeEvent=function(t,r){if(!t)return null;var n=f(f(f(f(f({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(function(a){return f(f({},a),a.data&&{data:vt(a.data,r)})})}),t.user&&{user:vt(t.user,r)}),t.contexts&&{contexts:vt(t.contexts,r)}),t.extra&&{extra:vt(t.extra,r)});t.contexts&&t.contexts.trace&&(n.contexts.trace=t.contexts.trace);var i=this.getOptions()._experiments,o=i===void 0?{}:i;return o.ensureNoCircularStructures?vt(n):n},e.prototype._applyClientOptions=function(t){var r=this.getOptions(),n=r.environment,i=r.release,o=r.dist,a=r.maxValueLength,s=a===void 0?250:a;"environment"in t||(t.environment="environment"in r?n:"production"),t.release===void 0&&i!==void 0&&(t.release=i),t.dist===void 0&&o!==void 0&&(t.dist=o),t.message&&(t.message=dt(t.message,s));var u=t.exception&&t.exception.values&&t.exception.values[0];u&&u.value&&(u.value=dt(u.value,s));var c=t.request;c&&c.url&&(c.url=dt(c.url,s))},e.prototype._applyIntegrationsMetadata=function(t){var r=Object.keys(this._integrations);r.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=g(t.sdk.integrations||[],r))},e.prototype._sendEvent=function(t){this._getBackend().sendEvent(t)},e.prototype._captureEvent=function(t,r,n){return this._processEvent(t,r,n).then(function(i){return i.event_id},function(i){d.error(i)})},e.prototype._processEvent=function(t,r,n){var i=this,o=this.getOptions(),a=o.beforeSend,s=o.sampleRate;if(!this._isEnabled())return w.reject(new T("SDK not enabled, will not capture event."));var u=t.type==="transaction";return!u&&typeof s=="number"&&Math.random()>s?w.reject(new T("Discarding event because it's not included in the random sample (sampling rate = "+s+")")):this._prepareEvent(t,n,r).then(function(c){if(c===null)throw new T("An event processor returned null, will not send event.");var p=r&&r.data&&r.data.__sentry__===!0;if(p||u||!a)return c;var l=a(c,r);return i._ensureBeforeSendRv(l)}).then(function(c){if(c===null)throw new T("`beforeSend` returned `null`, will not send event.");var p=n&&n.getSession&&n.getSession();return!u&&p&&i._updateSessionFromEvent(p,c),i._sendEvent(c),c}).then(null,function(c){throw c instanceof T?c:(i.captureException(c,{data:{__sentry__:!0},originalException:c}),new T(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. Reason: `+c))})},e.prototype._process=function(t){var r=this;this._numProcessing+=1,t.then(function(n){return r._numProcessing-=1,n},function(n){return r._numProcessing-=1,n})},e.prototype._ensureBeforeSendRv=function(t){var r="`beforeSend` method has to return `null` or a valid event.";if($(t))return t.then(function(n){if(!(K(n)||n===null))throw new T(r);return n},function(n){throw new T("beforeSend rejected with "+n)});if(!(K(t)||t===null))throw new T(r);return t},e}();var _n=function(){function e(){}return e.prototype.sendEvent=function(t){return w.resolve({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:Y.Skipped})},e.prototype.close=function(t){return w.resolve(!0)},e}();var We=function(){function e(t){this._options=t,this._options.dsn||d.warn("No DSN provided, backend will not do anything."),this._transport=this._setupTransport()}return e.prototype.eventFromException=function(t,r){throw new T("Backend has to implement `eventFromException` method")},e.prototype.eventFromMessage=function(t,r,n){throw new T("Backend has to implement `eventFromMessage` method")},e.prototype.sendEvent=function(t){this._transport.sendEvent(t).then(null,function(r){d.error("Error while sending event: "+r)})},e.prototype.sendSession=function(t){if(!this._transport.sendSession){d.warn("Dropping session because custom transport doesn't implement sendSession");return}this._transport.sendSession(t).then(null,function(r){d.error("Error while sending session: "+r)})},e.prototype.getTransport=function(){return this._transport},e.prototype._setupTransport=function(){return new _n},e}();function yn(e){if(!(!e.metadata||!e.metadata.sdk)){var t=e.metadata.sdk,r=t.name,n=t.version;return{name:r,version:n}}}function Gi(e,t){return t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=g(e.sdk.integrations||[],t.integrations||[]),e.sdk.packages=g(e.sdk.packages||[],t.packages||[])),e}function Lt(e,t){var r=yn(t),n=JSON.stringify(f(f({sent_at:new Date().toISOString()},r&&{sdk:r}),t.forceEnvelope()&&{dsn:t.getDsn().toString()})),i="aggregates"in e?"sessions":"session",o=JSON.stringify({type:i});return{body:n+` `+o+` `+JSON.stringify(e),type:i,url:t.getEnvelopeEndpointWithUrlEncodedAuth()}}function Bt(e,t){var r=yn(t),n=e.type||"event",i=n==="transaction"||t.forceEnvelope(),o=e.debug_meta||{},a=o.transactionSampling,s=te(o,["transactionSampling"]),u=a||{},c=u.method,p=u.rate;Object.keys(s).length===0?delete e.debug_meta:e.debug_meta=s;var l={body:JSON.stringify(r?Gi(e,t.metadata.sdk):e),type:n,url:i?t.getEnvelopeEndpointWithUrlEncodedAuth():t.getStoreEndpointWithUrlEncodedAuth()};if(i){var m=JSON.stringify(f(f({event_id:e.event_id,sent_at:new Date().toISOString()},r&&{sdk:r}),t.forceEnvelope()&&{dsn:t.getDsn().toString()})),h=JSON.stringify({type:n,sample_rates:[{id:c,rate:p}]}),v=m+` `+h+` `+l.body;l.body=v}return l}function Ye(e,t){var r;t.debug===!0&&d.enable();var n=b();(r=n.getScope())===null||r===void 0||r.update(t.initialScope);var i=new e(t);n.bindClient(i)}var qt="6.12.0";var Gt={};br(Gt,{FunctionToString:()=>En,InboundFilters:()=>Sn});var bn,En=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(){bn=Function.prototype.toString,Function.prototype.toString=function(){for(var t=[],r=0;r=0;i--){var o=t[i];if(((r=o)===null||r===void 0?void 0:r.filename)!==""&&((n=o)===null||n===void 0?void 0:n.filename)!=="[native code]")return o.filename||null}return null},e.prototype._getEventFilterUrl=function(t){try{if(t.stacktrace){var r=t.stacktrace.frames;return this._getLastValidUrl(r)}if(t.exception){var n=t.exception.values&&t.exception.values[0].stacktrace&&t.exception.values[0].stacktrace.frames;return this._getLastValidUrl(n)}return null}catch(i){return d.error("Cannot extract url for event "+tt(t)),null}},e.id="InboundFilters",e}();var Rt="?",eo=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ro=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,no=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,io=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,oo=/\((\S*)(?::(\d+))(?::(\d+))\)/,ao=/Minified React error #\d+;/i;function ut(e){var t=null,r=0;e&&(typeof e.framesToPop=="number"?r=e.framesToPop:ao.test(e.message)&&(r=1));try{if(t=uo(e),t)return xn(t,r)}catch(n){}try{if(t=so(e),t)return xn(t,r)}catch(n){}return{message:ze(e),name:e&&e.name,stack:[],failed:!0}}function so(e){if(!e||!e.stack)return null;for(var t=[],r=e.stack.split(` `),n,i,o,a,s=0;s eval")>-1,n&&(i=io.exec(o[3]))?(o[1]=o[1]||"eval",o[3]=i[1],o[4]=i[2],o[5]=""):s===0&&!o[5]&&e.columnNumber!==void 0&&(t[0].column=e.columnNumber+1),a={url:o[3],func:o[1]||Rt,args:o[2]?o[2].split(","):[],line:o[4]?+o[4]:null,column:o[5]?+o[5]:null};else continue;!a.func&&a.line&&(a.func=Rt),t.push(a)}return t.length?{message:ze(e),name:e.name,stack:t}:null}function uo(e){if(!e||!e.stacktrace)return null;for(var t=e.stacktrace,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,n=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i,i=t.split(` `),o=[],a,s=0;snew Date(Date.now())},e.prototype._handleRateLimit=function(t){var r,n,i,o,a=Date.now(),s=t["x-sentry-rate-limits"],u=t["retry-after"];if(s){try{for(var c=H(s.trim().split(",")),p=c.next();!p.done;p=c.next()){var l=p.value,m=l.split(":",2),h=parseInt(m[0],10),v=(isNaN(h)?60:h)*1e3;try{for(var y=(i=void 0,H(m[1].split(";"))),E=y.next();!E.done;E=y.next()){var C=E.value;this._rateLimits[C||"all"]=new Date(a+v)}}catch(I){i={error:I}}finally{try{E&&!E.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}}}catch(I){r={error:I}}finally{try{p&&!p.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return!0}else if(u)return this._rateLimits.all=new Date(a+$r(a,u)),!0;return!1},e}();function po(){var e,t,r=_();if(se(r.fetch))return r.fetch.bind(r);var n=r.document,i=r.fetch;if(typeof((e=n)===null||e===void 0?void 0:e.createElement)=="function")try{var o=n.createElement("iframe");o.hidden=!0,n.head.appendChild(o),((t=o.contentWindow)===null||t===void 0?void 0:t.fetch)&&(i=o.contentWindow.fetch),n.head.removeChild(o)}catch(a){d.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",a)}return i.bind(r)}var Je=function(e){A(t,e);function t(r,n){n===void 0&&(n=po());var i=e.call(this,r)||this;return i._fetch=n,i}return t.prototype.sendEvent=function(r){return this._sendRequest(Bt(r,this._api),r)},t.prototype.sendSession=function(r){return this._sendRequest(Lt(r,this._api),r)},t.prototype._sendRequest=function(r,n){var i=this;if(this._isRateLimited(r.type))return Promise.reject({event:n,type:r.type,reason:"Transport for "+r.type+" requests locked till "+this._disabledUntil(r.type)+" due to too many requests.",status:429});var o={body:r.body,method:"POST",referrerPolicy:nn()?"origin":""};return this.options.fetchParameters!==void 0&&Object.assign(o,this.options.fetchParameters),this.options.headers!==void 0&&(o.headers=this.options.headers),this._buffer.add(function(){return new w(function(a,s){i._fetch(r.url,o).then(function(u){var c={"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")};i._handleResponse({requestType:r.type,response:u,headers:c,resolve:a,reject:s})}).catch(s)})})},t}(_e);var Qe=function(e){A(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.sendEvent=function(r){return this._sendRequest(Bt(r,this._api),r)},t.prototype.sendSession=function(r){return this._sendRequest(Lt(r,this._api),r)},t.prototype._sendRequest=function(r,n){var i=this;return this._isRateLimited(r.type)?Promise.reject({event:n,type:r.type,reason:"Transport for "+r.type+" requests locked till "+this._disabledUntil(r.type)+" due to too many requests.",status:429}):this._buffer.add(function(){return new w(function(o,a){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(s.readyState===4){var c={"x-sentry-rate-limits":s.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":s.getResponseHeader("Retry-After")};i._handleResponse({requestType:r.type,response:s,headers:c,resolve:o,reject:a})}},s.open("POST",r.url);for(var u in i.options.headers)i.options.headers.hasOwnProperty(u)&&s.setRequestHeader(u,i.options.headers[u]);s.send(r.body)})})},t}(_e);var In=function(e){A(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.eventFromException=function(r,n){return wn(this._options,r,n)},t.prototype.eventFromMessage=function(r,n,i){return n===void 0&&(n=M.Info),On(this._options,r,n,i)},t.prototype._setupTransport=function(){if(!this._options.dsn)return e.prototype._setupTransport.call(this);var r=f(f({},this._options.transportOptions),{dsn:this._options.dsn,tunnel:this._options.tunnel,_metadata:this._options._metadata});return this._options.transport?new this._options.transport(r):ae()?new Je(r):new Qe(r)},t}(We);var Ze=0;function tr(){return Ze>0}function lo(){Ze+=1,setTimeout(function(){Ze-=1})}function yt(e,t,r){if(t===void 0&&(t={}),typeof e!="function")return e;try{if(e.__sentry__)return e;if(e.__sentry_wrapped__)return e.__sentry_wrapped__}catch(a){return e}var n=function(){var a=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);var s=a.map(function(u){return yt(u,t)});return e.handleEvent?e.handleEvent.apply(this,s):e.apply(this,s)}catch(u){throw lo(),me(function(c){c.addEventProcessor(function(p){var l=f({},p);return t.mechanism&&(jt(l,void 0,void 0),et(l,t.mechanism)),l.extra=f(f({},l.extra),{arguments:a}),l}),_t(u)}),u}};try{for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}catch(a){}e.prototype=e.prototype||{},n.prototype=e.prototype,Object.defineProperty(e,"__sentry_wrapped__",{enumerable:!1,value:n}),Object.defineProperties(n,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:e}});try{var o=Object.getOwnPropertyDescriptor(n,"name");o.configurable&&Object.defineProperty(n,"name",{get:function(){return e.name}})}catch(a){}return n}function Rn(e){if(e===void 0&&(e={}),!e.eventId){d.error("Missing eventId option in showReportDialog call");return}if(!e.dsn){d.error("Missing dsn option in showReportDialog call");return}var t=document.createElement("script");t.async=!0,t.src=new Ht(e.dsn).getReportDialogEndpoint(e),e.onLoad&&(t.onload=e.onLoad),(document.head||document.body).appendChild(t)}var er=function(){function e(t){this.name=e.id,this._onErrorHandlerInstalled=!1,this._onUnhandledRejectionHandlerInstalled=!1,this._options=f({onerror:!0,onunhandledrejection:!0},t)}return e.prototype.setupOnce=function(){Error.stackTraceLimit=50,this._options.onerror&&(d.log("Global Handler attached: onerror"),this._installGlobalOnErrorHandler()),this._options.onunhandledrejection&&(d.log("Global Handler attached: onunhandledrejection"),this._installGlobalOnUnhandledRejectionHandler())},e.prototype._installGlobalOnErrorHandler=function(){var t=this;this._onErrorHandlerInstalled||(R({callback:function(r){var n=r.error,i=b(),o=i.getIntegration(e),a=n&&n.__sentry_own_request__===!0;if(!(!o||tr()||a)){var s=i.getClient(),u=n===void 0&&z(r.msg)?t._eventFromIncompleteOnError(r.msg,r.url,r.line,r.column):t._enhanceEventWithInitialFrame(ge(n||r.msg,void 0,{attachStacktrace:s&&s.getOptions().attachStacktrace,rejection:!1}),r.url,r.line,r.column);et(u,{handled:!1,type:"onerror"}),i.captureEvent(u,{originalException:n})}},type:"error"}),this._onErrorHandlerInstalled=!0)},e.prototype._installGlobalOnUnhandledRejectionHandler=function(){var t=this;this._onUnhandledRejectionHandlerInstalled||(R({callback:function(r){var n=r;try{"reason"in r?n=r.reason:"detail"in r&&"reason"in r.detail&&(n=r.detail.reason)}catch(c){}var i=b(),o=i.getIntegration(e),a=n&&n.__sentry_own_request__===!0;if(!o||tr()||a)return!0;var s=i.getClient(),u=lt(n)?t._eventFromRejectionWithPrimitive(n):ge(n,void 0,{attachStacktrace:s&&s.getOptions().attachStacktrace,rejection:!0});u.level=M.Error,et(u,{handled:!1,type:"onunhandledrejection"}),i.captureEvent(u,{originalException:n})},type:"unhandledrejection"}),this._onUnhandledRejectionHandlerInstalled=!0)},e.prototype._eventFromIncompleteOnError=function(t,r,n,i){var o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,a=ne(t)?t.message:t,s,u=a.match(o);u&&(s=u[1],a=u[2]);var c={exception:{values:[{type:s||"Error",value:a}]}};return this._enhanceEventWithInitialFrame(c,r,n,i)},e.prototype._eventFromRejectionWithPrimitive=function(t){return{exception:{values:[{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(t)}]}}},e.prototype._enhanceEventWithInitialFrame=function(t,r,n,i){t.exception=t.exception||{},t.exception.values=t.exception.values||[],t.exception.values[0]=t.exception.values[0]||{},t.exception.values[0].stacktrace=t.exception.values[0].stacktrace||{},t.exception.values[0].stacktrace.frames=t.exception.values[0].stacktrace.frames||[];var o=isNaN(parseInt(i,10))?void 0:i,a=isNaN(parseInt(n,10))?void 0:n,s=z(r)&&r.length>0?r:zr();return t.exception.values[0].stacktrace.frames.length===0&&t.exception.values[0].stacktrace.frames.push({colno:o,filename:s,function:"?",in_app:!0,lineno:a}),t},e.id="GlobalHandlers",e}();var mo=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],rr=function(){function e(t){this.name=e.id,this._options=f({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t)}return e.prototype.setupOnce=function(){var t=_();if(this._options.setTimeout&&S(t,"setTimeout",this._wrapTimeFunction.bind(this)),this._options.setInterval&&S(t,"setInterval",this._wrapTimeFunction.bind(this)),this._options.requestAnimationFrame&&S(t,"requestAnimationFrame",this._wrapRAF.bind(this)),this._options.XMLHttpRequest&&"XMLHttpRequest"in t&&S(XMLHttpRequest.prototype,"send",this._wrapXHR.bind(this)),this._options.eventTarget){var r=Array.isArray(this._options.eventTarget)?this._options.eventTarget:mo;r.forEach(this._wrapEventTarget.bind(this))}},e.prototype._wrapTimeFunction=function(t){return function(){for(var r=[],n=0;n"}r.length!==0&&b().addBreadcrumb({category:"ui."+t.name,message:r},{event:t.event,name:t.name,global:t.global})},e.prototype._xhrBreadcrumb=function(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;var r=t.xhr.__sentry_xhr__||{},n=r.method,i=r.url,o=r.status_code,a=r.body;b().addBreadcrumb({category:"xhr",data:{method:n,url:i,status_code:o},type:"http"},{xhr:t.xhr,input:a});return}},e.prototype._fetchBreadcrumb=function(t){!t.endTimestamp||t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"||(t.error?b().addBreadcrumb({category:"fetch",data:t.fetchData,level:M.Error,type:"http"},{data:t.error,input:t.args}):b().addBreadcrumb({category:"fetch",data:f(f({},t.fetchData),{status_code:t.response.status}),type:"http"},{input:t.args,response:t.response}))},e.prototype._historyBreadcrumb=function(t){var r=_(),n=t.from,i=t.to,o=oe(r.location.href),a=oe(n),s=oe(i);a.path||(a=o),o.protocol===s.protocol&&o.host===s.host&&(i=s.relative),o.protocol===a.protocol&&o.host===a.host&&(n=a.relative),b().addBreadcrumb({category:"navigation",data:{from:n,to:i}})},e.id="Breadcrumbs",e}();var ho="cause",vo=5,nr=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._key=t.key||ho,this._limit=t.limit||vo}return e.prototype.setupOnce=function(){G(function(t,r){var n=b().getIntegration(e);if(n){var i=n._handler&&n._handler.bind(n);return typeof i=="function"?i(t,r):t}return t})},e.prototype._handler=function(t,r){if(!t.exception||!t.exception.values||!r||!D(r.originalException,Error))return t;var n=this._walkErrorTree(r.originalException,this._key);return t.exception.values=g(n,t.exception.values),t},e.prototype._walkErrorTree=function(t,r,n){if(n===void 0&&(n=[]),!D(t[r],Error)||n.length+1>=this._limit)return n;var i=ut(t[r]),o=Ke(i);return this._walkErrorTree(t[r],r,g([o],n))},e.id="LinkedErrors",e}();var kt=_(),ir=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(){G(function(t){var r,n,i;if(b().getIntegration(e)){if(!kt.navigator&&!kt.location&&!kt.document)return t;var o=((r=t.request)===null||r===void 0?void 0:r.url)||((n=kt.location)===null||n===void 0?void 0:n.href),a=(kt.document||{}).referrer,s=(kt.navigator||{}).userAgent,u=f(f(f({},(i=t.request)===null||i===void 0?void 0:i.headers),a&&{Referer:a}),s&&{"User-Agent":s}),c=f(f({},o&&{url:o}),{headers:u});return f(f({},t),{request:c})}return t})},e.id="UserAgent",e}();var or=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(t,r){t(function(n){var i=r().getIntegration(e);if(i){try{if(i._shouldDropEvent(n,i._previousEvent))return d.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(o){return i._previousEvent=n}return i._previousEvent=n}return n})},e.prototype._shouldDropEvent=function(t,r){return r?!!(this._isSameMessageEvent(t,r)||this._isSameExceptionEvent(t,r)):!1},e.prototype._isSameMessageEvent=function(t,r){var n=t.message,i=r.message;return!(!n&&!i||n&&!i||!n&&i||n!==i||!this._isSameFingerprint(t,r)||!this._isSameStacktrace(t,r))},e.prototype._getFramesFromEvent=function(t){var r=t.exception;if(r)try{return r.values[0].stacktrace.frames}catch(n){return}else if(t.stacktrace)return t.stacktrace.frames},e.prototype._isSameStacktrace=function(t,r){var n=this._getFramesFromEvent(t),i=this._getFramesFromEvent(r);if(!n&&!i)return!0;if(n&&!i||!n&&i||(n=n,i=i,i.length!==n.length))return!1;for(var o=0;o=400&&r<500)switch(r){case 401:return e.Unauthenticated;case 403:return e.PermissionDenied;case 404:return e.NotFound;case 409:return e.AlreadyExists;case 413:return e.FailedPrecondition;case 429:return e.ResourceExhausted;default:return e.InvalidArgument}if(r>=500&&r<600)switch(r){case 501:return e.Unimplemented;case 503:return e.Unavailable;case 504:return e.DeadlineExceeded;default:return e.InternalError}return e.UnknownError}e.fromHttpCode=t})(O||(O={}));var _o=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Wt(e){e===void 0&&(e=(t=b().getClient())===null||t===void 0?void 0:t.getOptions());var t;return e?"tracesSampleRate"in e||"tracesSampler"in e:!1}function Nn(e){var t=e.match(_o);if(t){var r=void 0;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}}function bt(e){e===void 0&&(e=b());var t,r;return(r=(t=e)===null||t===void 0?void 0:t.getScope())===null||r===void 0?void 0:r.getTransaction()}function k(e){return e/1e3}function An(e){return e*1e3}function Mn(){R({callback:Dn,type:"error"}),R({callback:Dn,type:"unhandledrejection"})}function Dn(){var e=bt();e&&(d.log("[Tracing] Transaction: "+O.InternalError+" -> Global error occured"),e.setStatus(O.InternalError))}var ye=function(){function e(t){t===void 0&&(t=1e3),this.spans=[],this._maxlen=t}return e.prototype.add=function(t){this.spans.length>this._maxlen?t.spanRecorder=void 0:this.spans.push(t)},e}();var Pn=function(){function e(t){if(this.traceId=U(),this.spanId=U().substring(16),this.startTimestamp=gt(),this.tags={},this.data={},!t)return this;t.traceId&&(this.traceId=t.traceId),t.spanId&&(this.spanId=t.spanId),t.parentSpanId&&(this.parentSpanId=t.parentSpanId),"sampled"in t&&(this.sampled=t.sampled),t.op&&(this.op=t.op),t.description&&(this.description=t.description),t.data&&(this.data=t.data),t.tags&&(this.tags=t.tags),t.status&&(this.status=t.status),t.startTimestamp&&(this.startTimestamp=t.startTimestamp),t.endTimestamp&&(this.endTimestamp=t.endTimestamp)}return e.prototype.child=function(t){return this.startChild(t)},e.prototype.startChild=function(t){var r=new e(f(f({},t),{parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId}));return r.spanRecorder=this.spanRecorder,r.spanRecorder&&r.spanRecorder.add(r),r.transaction=this.transaction,r},e.prototype.setTag=function(t,r){var n;return this.tags=f(f({},this.tags),(n={},n[t]=r,n)),this},e.prototype.setData=function(t,r){var n;return this.data=f(f({},this.data),(n={},n[t]=r,n)),this},e.prototype.setStatus=function(t){return this.status=t,this},e.prototype.setHttpStatus=function(t){this.setTag("http.status_code",String(t));var r=O.fromHttpCode(t);return r!==O.UnknownError&&this.setStatus(r),this},e.prototype.isSuccess=function(){return this.status===O.Ok},e.prototype.finish=function(t){this.endTimestamp=typeof t=="number"?t:gt()},e.prototype.toTraceparent=function(){var t="";return this.sampled!==void 0&&(t=this.sampled?"-1":"-0"),this.traceId+"-"+this.spanId+t},e.prototype.toContext=function(){return B({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})},e.prototype.updateWithContext=function(t){var r,n,i,o,a;return this.data=(r=t.data,r!=null?r:{}),this.description=t.description,this.endTimestamp=t.endTimestamp,this.op=t.op,this.parentSpanId=t.parentSpanId,this.sampled=t.sampled,this.spanId=(n=t.spanId,n!=null?n:this.spanId),this.startTimestamp=(i=t.startTimestamp,i!=null?i:this.startTimestamp),this.status=t.status,this.tags=(o=t.tags,o!=null?o:{}),this.traceId=(a=t.traceId,a!=null?a:this.traceId),this},e.prototype.getTraceContext=function(){return B({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})},e.prototype.toJSON=function(){return B({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})},e}();var be=function(e){A(t,e);function t(r,n){var i=e.call(this,r)||this;return i._measurements={},i._hub=b(),D(n,at)&&(i._hub=n),i.name=r.name||"",i.metadata=r.metadata||{},i._trimEnd=r.trimEnd,i.transaction=i,i}return t.prototype.setName=function(r){this.name=r},t.prototype.initSpanRecorder=function(r){r===void 0&&(r=1e3),this.spanRecorder||(this.spanRecorder=new ye(r)),this.spanRecorder.add(this)},t.prototype.setMeasurements=function(r){this._measurements=f({},r)},t.prototype.setMetadata=function(r){this.metadata=f(f({},this.metadata),r)},t.prototype.finish=function(r){var n=this;if(this.endTimestamp===void 0){if(this.name||(d.warn("Transaction has no name, falling back to ``."),this.name=""),e.prototype.finish.call(this,r),this.sampled!==!0){d.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled.");return}var i=this.spanRecorder?this.spanRecorder.spans.filter(function(s){return s!==n&&s.endTimestamp}):[];this._trimEnd&&i.length>0&&(this.endTimestamp=i.reduce(function(s,u){return s.endTimestamp&&u.endTimestamp?s.endTimestamp>u.endTimestamp?s:u:s}).endTimestamp);var o={contexts:{trace:this.getTraceContext()},spans:i,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",debug_meta:this.metadata},a=Object.keys(this._measurements).length>0;return a&&(d.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),o.measurements=this._measurements),d.log("[Tracing] Finishing "+this.op+" transaction: "+this.name+"."),this._hub.captureEvent(o)}},t.prototype.toContext=function(){var r=e.prototype.toContext.call(this);return B(f(f({},r),{name:this.name,trimEnd:this._trimEnd}))},t.prototype.updateWithContext=function(r){var n;return e.prototype.updateWithContext.call(this,r),this.name=(n=r.name,n!=null?n:""),this._trimEnd=r.trimEnd,this},t}(Pn);var sr=1e3,yo=function(e){A(t,e);function t(r,n,i,o){i===void 0&&(i="");var a=e.call(this,o)||this;return a._pushActivity=r,a._popActivity=n,a.transactionSpanId=i,a}return t.prototype.add=function(r){var n=this;r.spanId!==this.transactionSpanId&&(r.finish=function(i){r.endTimestamp=typeof i=="number"?i:gt(),n._popActivity(r.spanId)},r.endTimestamp===void 0&&this._pushActivity(r.spanId)),e.prototype.add.call(this,r)},t}(ye);var jn=function(e){A(t,e);function t(r,n,i,o){i===void 0&&(i=sr),o===void 0&&(o=!1);var a=e.call(this,r,n)||this;return a._idleHub=n,a._idleTimeout=i,a._onScope=o,a.activities={},a._heartbeatTimer=0,a._heartbeatCounter=0,a._finished=!1,a._beforeFinishCallbacks=[],n&&o&&(Fn(n),d.log("Setting idle transaction on scope. Span ID: "+a.spanId),n.configureScope(function(s){return s.setSpan(a)})),a._initTimeout=setTimeout(function(){a._finished||a.finish()},a._idleTimeout),a}return t.prototype.finish=function(r){var n,i,o=this;if(r===void 0&&(r=gt()),this._finished=!0,this.activities={},this.spanRecorder){d.log("[Tracing] finishing IdleTransaction",new Date(r*1e3).toISOString(),this.op);try{for(var a=H(this._beforeFinishCallbacks),s=a.next();!s.done;s=a.next()){var u=s.value;u(this,r)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}this.spanRecorder.spans=this.spanRecorder.spans.filter(function(c){if(c.spanId===o.spanId)return!0;c.endTimestamp||(c.endTimestamp=r,c.setStatus(O.Cancelled),d.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(c,void 0,2)));var p=c.startTimestamp=3?(d.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus(O.DeadlineExceeded),this.setTag("heartbeat","failed"),this.finish()):this._pingHeartbeat()}},t.prototype._pingHeartbeat=function(){var r=this;d.log("pinging Heartbeat -> current counter: "+this._heartbeatCounter),this._heartbeatTimer=setTimeout(function(){r._beat()},5e3)},t}(be);function Fn(e){if(e){var t=e.getScope();if(t){var r=t.getTransaction();r&&t.setSpan(void 0)}}}function bo(){var e=this.getScope();if(e){var t=e.getSpan();if(t)return{"sentry-trace":t.toTraceparent()}}return{}}function Un(e,t,r){if(!Wt())return e.sampled=!1,e;if(e.sampled!==void 0)return e.setMetadata({transactionSampling:{method:it.Explicit}}),e;var n;return typeof t.tracesSampler=="function"?(n=t.tracesSampler(r),e.setMetadata({transactionSampling:{method:it.Sampler,rate:Number(n)}})):r.parentSampled!==void 0?(n=r.parentSampled,e.setMetadata({transactionSampling:{method:it.Inheritance}})):(n=t.tracesSampleRate,e.setMetadata({transactionSampling:{method:it.Rate,rate:Number(n)}})),Eo(n)?n?(e.sampled=Math.random()1?(d.warn("[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got "+e+"."),!1):!0}function So(e,t){var r,n,i=((r=this.getClient())===null||r===void 0?void 0:r.getOptions())||{},o=new be(e,this);return o=Un(o,i,f({parentSampled:e.parentSampled,transactionContext:e},t)),o.sampled&&o.initSpanRecorder((n=i._experiments)===null||n===void 0?void 0:n.maxSpans),o}function Hn(e,t,r,n,i){var o,a,s=((o=e.getClient())===null||o===void 0?void 0:o.getOptions())||{},u=new jn(t,e,r,n);return u=Un(u,s,f({parentSampled:t.parentSampled,transactionContext:t},i)),u.sampled&&u.initSpanRecorder((a=s._experiments)===null||a===void 0?void 0:a.maxSpans),u}function xo(){var e=st();!e.__SENTRY__||(e.__SENTRY__.extensions=e.__SENTRY__.extensions||{},e.__SENTRY__.extensions.startTransaction||(e.__SENTRY__.extensions.startTransaction=So),e.__SENTRY__.extensions.traceHeaders||(e.__SENTRY__.extensions.traceHeaders=bo))}function To(){var e=st();if(!!e.__SENTRY__){var t={mongodb:function(){var n=J(module,"./integrations/mongo");return new n.Mongo},mongoose:function(){var n=J(module,"./integrations/mongo");return new n.Mongo({mongoose:!0})},mysql:function(){var n=J(module,"./integrations/mysql");return new n.Mysql},pg:function(){var n=J(module,"./integrations/postgres");return new n.Postgres}},r=Object.keys(t).filter(function(n){return!!ot(n)}).map(function(n){try{return t[n]()}catch(i){return}}).filter(function(n){return n});r.length>0&&(e.__SENTRY__.integrations=g(e.__SENTRY__.integrations||[],r))}}function Ln(){xo(),X()&&To(),Mn()}var Ee=_();function Bn(){Ee&&Ee.document?Ee.document.addEventListener("visibilitychange",function(){var e=bt();Ee.document.hidden&&e&&(d.log("[Tracing] Transaction: "+O.Cancelled+" -> since tab moved to the background, op: "+e.op),e.status||e.setStatus(O.Cancelled),e.setTag("visibilitychange","document.hidden"),e.finish())}):d.warn("[Tracing] Could not set up background tab detection due to lack of global document")}var Ct=function(e,t,r){var n;return function(i){t.value>=0&&(i||r)&&(t.delta=t.value-(n||0),(t.delta||n===void 0)&&(n=t.value,e(t)))}};var qn=function(){return"v2-"+Date.now()+"-"+(Math.floor(Math.random()*(9e12-1))+1e12)};var Nt=function(e,t){return{name:e,value:t!=null?t:-1,delta:0,entries:[],id:qn()}};var At=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if(e==="first-input"&&!("PerformanceEventTiming"in self))return;var r=new PerformanceObserver(function(n){return n.getEntries().map(t)});return r.observe({type:e,buffered:!0}),r}}catch(n){}};var ct=function(e,t){var r=function(n){(n.type==="pagehide"||document.visibilityState==="hidden")&&(e(n),t&&(removeEventListener("visibilitychange",r,!0),removeEventListener("pagehide",r,!0)))};addEventListener("visibilitychange",r,!0),addEventListener("pagehide",r,!0)};var Gn=function(e,t){var r=Nt("CLS",0),n,i=0,o=[],a=function(u){if(u&&!u.hadRecentInput){var c=o[0],p=o[o.length-1];i&&o.length!==0&&u.startTime-p.startTime<1e3&&u.startTime-c.startTime<5e3?(i+=u.value,o.push(u)):(i=u.value,o=[u]),i>r.value&&(r.value=i,r.entries=o,n&&n())}},s=At("layout-shift",a);s&&(n=Ct(e,r,t),ct(function(){s.takeRecords().map(a),n(!0)}))};var Se=-1,wo=function(){return document.visibilityState==="hidden"?0:1/0},Oo=function(){ct(function(e){var t=e.timeStamp;Se=t},!0)},Mt=function(){return Se<0&&(Se=wo(),Oo()),{get firstHiddenTime(){return Se}}};var Vn=function(e,t){var r=Mt(),n=Nt("FID"),i,o=function(s){i&&s.startTime-1&&(a=I);break}default:}}),a!==void 0&&s!==void 0&&Et(t,{description:"evaluation",endTimestamp:s,op:"script",startTimestamp:a}),this._performanceCursor=Math.max(performance.getEntries().length-1,0),this._trackNavigator(t),t.op==="pageload"){var p=k(It);typeof u=="number"&&(d.log("[Measurements] Adding TTFB"),this._measurements.ttfb={value:(u-t.startTimestamp)*1e3},typeof c=="number"&&c<=u&&(this._measurements["ttfb.requestTime"]={value:(u-c)*1e3})),["fcp","fp","lcp"].forEach(function(l){if(!(!r._measurements[l]||p>=t.startTimestamp)){var m=r._measurements[l].value,h=p+k(m),v=Math.abs((h-t.startTimestamp)*1e3),y=v-m;d.log("[Measurements] Normalized "+l+" from "+m+" to "+v+" ("+y+")"),r._measurements[l].value=v}}),this._measurements["mark.fid"]&&this._measurements.fid&&Et(t,{description:"first input delay",endTimestamp:this._measurements["mark.fid"].value+k(this._measurements.fid.value),op:"web.vitals",startTimestamp:this._measurements["mark.fid"].value}),"fcp"in this._measurements||delete this._measurements.cls,t.setMeasurements(this._measurements),this._tagMetricInfo(t)}}},e.prototype._tagMetricInfo=function(t){this._lcpEntry&&(d.log("[Measurements] Adding LCP Data"),this._lcpEntry.element&&t.setTag("lcp.element",Z(this._lcpEntry.element)),this._lcpEntry.id&&t.setTag("lcp.id",this._lcpEntry.id),this._lcpEntry.url&&t.setTag("lcp.url",this._lcpEntry.url.trim().slice(0,200)),t.setTag("lcp.size",this._lcpEntry.size)),this._clsEntry&&this._clsEntry.sources&&(d.log("[Measurements] Adding CLS Data"),this._clsEntry.sources.forEach(function(r,n){return t.setTag("cls.source."+(n+1),Z(r.node))}))},e.prototype._trackCLS=function(){var t=this;Gn(function(r){var n=r.entries.pop();!n||(d.log("[Measurements] Adding CLS"),t._measurements.cls={value:r.value},t._clsEntry=n)})},e.prototype._trackNavigator=function(t){var r=P.navigator;if(!!r){var n=r.connection;n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),xe(n.rtt)&&(this._measurements["connection.rtt"]={value:n.rtt}),xe(n.downlink)&&(this._measurements["connection.downlink"]={value:n.downlink})),xe(r.deviceMemory)&&t.setTag("deviceMemory",String(r.deviceMemory)),xe(r.hardwareConcurrency)&&t.setTag("hardwareConcurrency",String(r.hardwareConcurrency))}},e.prototype._trackLCP=function(){var t=this;Yn(function(r){var n=r.entries.pop();if(!!n){var i=k(It),o=k(n.startTime);d.log("[Measurements] Adding LCP"),t._measurements.lcp={value:r.value},t._measurements["mark.lcp"]={value:i+o},t._lcpEntry=n}})},e.prototype._trackFID=function(){var t=this;Vn(function(r){var n=r.entries.pop();if(!!n){var i=k(It),o=k(n.startTime);d.log("[Measurements] Adding FID"),t._measurements.fid={value:r.value},t._measurements["mark.fid"]={value:i+o}}})},e}();function Io(e,t,r){ft({transaction:e,entry:t,event:"unloadEvent",timeOrigin:r}),ft({transaction:e,entry:t,event:"redirect",timeOrigin:r}),ft({transaction:e,entry:t,event:"domContentLoadedEvent",timeOrigin:r}),ft({transaction:e,entry:t,event:"loadEvent",timeOrigin:r}),ft({transaction:e,entry:t,event:"connect",timeOrigin:r}),ft({transaction:e,entry:t,event:"secureConnection",timeOrigin:r,eventEnd:"connectEnd",description:"TLS/SSL"}),ft({transaction:e,entry:t,event:"fetch",timeOrigin:r,eventEnd:"domainLookupStart",description:"cache"}),ft({transaction:e,entry:t,event:"domainLookup",timeOrigin:r,description:"DNS"}),Co(e,t,r)}function Ro(e,t,r,n,i){var o=i+r,a=o+n;return Et(e,{description:t.name,endTimestamp:a,op:t.entryType,startTimestamp:o}),o}function ko(e,t,r,n,i,o){if(!(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")){var a={};"transferSize"in t&&(a["Transfer Size"]=t.transferSize),"encodedBodySize"in t&&(a["Encoded Body Size"]=t.encodedBodySize),"decodedBodySize"in t&&(a["Decoded Body Size"]=t.decodedBodySize);var s=o+n,u=s+i;return Et(e,{description:r,endTimestamp:u,op:t.initiatorType?"resource."+t.initiatorType:"resource",startTimestamp:s,data:a}),u}}function ft(e){var t=e.transaction,r=e.entry,n=e.event,i=e.timeOrigin,o=e.eventEnd,a=e.description,s=o?r[o]:r[n+"End"],u=r[n+"Start"];!u||!s||Et(t,{op:"browser",description:a!=null?a:n,startTimestamp:i+k(u),endTimestamp:i+k(s)})}function Co(e,t,r){Et(e,{op:"browser",description:"request",startTimestamp:r+k(t.requestStart),endTimestamp:r+k(t.responseEnd)}),Et(e,{op:"browser",description:"response",startTimestamp:r+k(t.responseStart),endTimestamp:r+k(t.responseEnd)})}function Et(e,t){var r=t.startTimestamp,n=te(t,["startTimestamp"]);return r&&e.startTimestamp>r&&(e.startTimestamp=r),e.startChild(f({startTimestamp:r},n))}function xe(e){return typeof e=="number"&&isFinite(e)}var No=["localhost",/^\//],Yt={traceFetch:!0,traceXHR:!0,tracingOrigins:No};function Kn(e){var t=f(f({},Yt),e),r=t.traceFetch,n=t.traceXHR,i=t.tracingOrigins,o=t.shouldCreateSpanForRequest,a={},s=function(p){if(a[p])return a[p];var l=i;return a[p]=l.some(function(m){return mt(p,m)})&&!mt(p,"sentry_key"),a[p]},u=s;typeof o=="function"&&(u=function(p){return s(p)&&o(p)});var c={};r&&R({callback:function(p){Ao(p,u,c)},type:"fetch"}),n&&R({callback:function(p){Mo(p,u,c)},type:"xhr"})}function Ao(e,t,r){if(!(!Wt()||!(e.fetchData&&t(e.fetchData.url)))){if(e.endTimestamp&&e.fetchData.__span){var n=r[e.fetchData.__span];n&&(e.response?n.setHttpStatus(e.response.status):e.error&&n.setStatus(O.InternalError),n.finish(),delete r[e.fetchData.__span]);return}var i=bt();if(i){var n=i.startChild({data:f(f({},e.fetchData),{type:"fetch"}),description:e.fetchData.method+" "+e.fetchData.url,op:"http.client"});e.fetchData.__span=n.spanId,r[n.spanId]=n;var o=e.args[0]=e.args[0],a=e.args[1]=e.args[1]||{},s=a.headers;D(o,Request)&&(s=o.headers),s?typeof s.append=="function"?s.append("sentry-trace",n.toTraceparent()):Array.isArray(s)?s=g(s,[["sentry-trace",n.toTraceparent()]]):s=f(f({},s),{"sentry-trace":n.toTraceparent()}):s={"sentry-trace":n.toTraceparent()},a.headers=s}}}function Mo(e,t,r){var n,i;if(!(!Wt()||((n=e.xhr)===null||n===void 0?void 0:n.__sentry_own_request__)||!(((i=e.xhr)===null||i===void 0?void 0:i.__sentry_xhr__)&&t(e.xhr.__sentry_xhr__.url)))){var o=e.xhr.__sentry_xhr__;if(e.endTimestamp&&e.xhr.__sentry_xhr_span_id__){var a=r[e.xhr.__sentry_xhr_span_id__];a&&(a.setHttpStatus(o.status_code),a.finish(),delete r[e.xhr.__sentry_xhr_span_id__]);return}var s=bt();if(s){var a=s.startChild({data:f(f({},o.data),{type:"xhr",method:o.method,url:o.url}),description:o.method+" "+o.url,op:"http.client"});if(e.xhr.__sentry_xhr_span_id__=a.spanId,r[e.xhr.__sentry_xhr_span_id__]=a,e.xhr.setRequestHeader)try{e.xhr.setRequestHeader("sentry-trace",a.toTraceparent())}catch(c){}}}}var zt=_();function $n(e,t,r){if(t===void 0&&(t=!0),r===void 0&&(r=!0),!zt||!zt.location){d.warn("Could not initialize routing instrumentation due to invalid location");return}var n=zt.location.href,i;t&&(i=e({name:zt.location.pathname,op:"pageload"})),r&&R({callback:function(o){var a=o.to,s=o.from;if(s===void 0&&n&&n.indexOf(a)!==-1){n=void 0;return}s!==a&&(n=void 0,i&&(d.log("[Tracing] Finishing current transaction with op: "+i.op),i.finish()),i=e({name:zt.location.pathname,op:"navigation"}))},type:"history"})}var Do=600,Po=f({idleTimeout:sr,markBackgroundTransactions:!0,maxTransactionDuration:Do,routingInstrumentation:$n,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0},Yt),ur=function(){function e(t){this.name=e.id,this._metrics=new zn,this._emitOptionsWarning=!1;var r=Yt.tracingOrigins;t&&t.tracingOrigins&&Array.isArray(t.tracingOrigins)&&t.tracingOrigins.length!==0?r=t.tracingOrigins:this._emitOptionsWarning=!0,this.options=f(f(f({},Po),t),{tracingOrigins:r})}return e.prototype.setupOnce=function(t,r){var n=this;this._getCurrentHub=r,this._emitOptionsWarning&&(d.warn("[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),d.warn("[Tracing] We added a reasonable default for you: "+Yt.tracingOrigins));var i=this.options,o=i.routingInstrumentation,a=i.startTransactionOnLocationChange,s=i.startTransactionOnPageLoad,u=i.markBackgroundTransactions,c=i.traceFetch,p=i.traceXHR,l=i.tracingOrigins,m=i.shouldCreateSpanForRequest;o(function(h){return n._createRouteTransaction(h)},s,a),u&&Bn(),Kn({traceFetch:c,traceXHR:p,tracingOrigins:l,shouldCreateSpanForRequest:m})},e.prototype._createRouteTransaction=function(t){var r=this;if(!this._getCurrentHub){d.warn("[Tracing] Did not create "+t.op+" transaction because _getCurrentHub is invalid.");return}var n=this.options,i=n.beforeNavigate,o=n.idleTimeout,a=n.maxTransactionDuration,s=t.op==="pageload"?jo():void 0,u=f(f(f({},t),s),{trimEnd:!0}),c=typeof i=="function"?i(u):u,p=c===void 0?f(f({},u),{sampled:!1}):c;p.sampled===!1&&d.log("[Tracing] Will not send "+p.op+" transaction because of beforeNavigate."),d.log("[Tracing] Starting "+p.op+" transaction on scope");var l=this._getCurrentHub(),m=_().location,h=Hn(l,p,o,!0,{location:m});return h.registerBeforeFinishCallback(function(v,y){r._metrics.addPerformanceEntries(v),Uo(An(a),v,y)}),h},e.id="BrowserTracing",e}();function jo(){var e=Fo("sentry-trace");if(e)return Nn(e)}function Fo(e){var t=document.querySelector("meta[name="+e+"]");return t?t.getAttribute("content"):null}function Uo(e,t,r){var n=r-t.startTimestamp,i=r&&(n>e||n<0);i&&(t.setStatus(O.DeadlineExceeded),t.setTag("maxTransactionDurationExceeded","true"))}var cr={};br(cr,{Express:()=>Xn,Mongo:()=>ti,Mysql:()=>Zn,Postgres:()=>Qn});var Xn=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._router=t.router||t.app,this._methods=(Array.isArray(t.methods)?t.methods:[]).concat("use")}return e.prototype.setupOnce=function(){if(!this._router){d.error("ExpressIntegration is missing an Express instance");return}Bo(this._router,this._methods)},e.id="Express",e}();function Jn(e,t){var r=e.length;switch(r){case 2:return function(n,i){var o=i.__sentry_transaction;if(o){var a=o.startChild({description:e.name,op:"middleware."+t});i.once("finish",function(){a.finish()})}return e.call(this,n,i)};case 3:return function(n,i,o){var a,s=i.__sentry_transaction,u=(a=s)===null||a===void 0?void 0:a.startChild({description:e.name,op:"middleware."+t});e.call(this,n,i,function(){for(var c=[],p=0;p",i[a[1]]=typeof p=="string"?p:p.name||""}else for(var l=0;l1&&arguments[1]!==void 0?arguments[1]:0,r=(N[e[t+0]]+N[e[t+1]]+N[e[t+2]]+N[e[t+3]]+"-"+N[e[t+4]]+N[e[t+5]]+"-"+N[e[t+6]]+N[e[t+7]]+"-"+N[e[t+8]]+N[e[t+9]]+"-"+N[e[t+10]]+N[e[t+11]]+N[e[t+12]]+N[e[t+13]]+N[e[t+14]]+N[e[t+15]]).toLowerCase();if(!ii(r))throw TypeError("Stringified UUID is invalid");return r}var oi=Yo;function zo(e,t,r){e=e||{};var n=e.random||(e.rng||fr)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return oi(n)}var pr=zo;var St={IMPLICIT_SCAN_ID:"EVT_IMPLICIT_SCAN_ID",CONSUMER_ID:"EVT_CONSUMER_ID"},pt={ACCESS_TOKEN:"evt_token",IMPLICIT_SCAN_ID:"evt_implicit_scan_id",PRODUCT_ID:"evt_product_id",THNG_ID:"evt_thng_id",SCAN_CREATED:"evt_scan_created"},Oe={ARE_COOKIES_BLOCKED:"GTM_EVT_ARE_COOKIES_BLOCKED",ACCESS_TOKEN:"GTM_EVT_TOKEN",REGION:"GTM_EVT_REGION"},Q={SCRIPT_VERSION:`${W}: v${Kt}`,MISSING_PRODUCT:`${W}: QR code scan not performed due to missing '${pt.PRODUCT_ID}'`,COOKIES_ARE_BLOCKED:`${W}: QR code scan not performed due to blocked cookies.`,REDUNDANT_SCAN:`${W}: Consumer "completed" scan was already created for this "implicit" scan. Exiting.`,REFERRAL_ACTION:`${W}: Visiting from a shared link, creating referral Action.`,SCAN_COMPLETED:`${W}: QR code scan complete.`,SCAN_ERROR:`${W}: Error completing QR code scan:`,REDIRECTING:`${W}: Redirecting to URL:`};function Xt(e){let t=window[e];if(!["undefined",void 0].includes(t))return["true","false"].includes(t)?JSON.parse(t):t}var Ko=e=>e.length===24;function Dt(e,t={}){var a;let{isEvtId:r,isRequired:n}=t,o=(a=new URLSearchParams(window.location.search).get(e))!=null?a:void 0;if(n&&!o)throw new Error(`URL param value for ${e} is required. Received '${o}'.`);if(r&&o&&!Ko(o))throw new Error(`URL param value for ${e} is invalid EVRYTHNG id. Received '${o}'.`);return o}function ai(e,t){let r=new URL(window.location);r.searchParams.set(e,t),window.history.replaceState({},"",r)}function Ie(e){for(var t=1;tQo(i,...o),createAction:(...o)=>Zo(i,...o)}}async function Qo(e,t){let r=$t.startChild({data:{parentActionId:t},op:"http",description:"getting child scans"}),n=await e.action("scans").read({params:{filter:`tags=from:${t}`}});return r.finish(),n.length>0}async function Zo(e,t){let r=$t.startChild({data:t,op:"http",description:"creating action"}),{actionType:n,consumerId:i,parentActionId:o,product:a,thng:s}=t,u=await e.product(a).action(n).create({type:n,consumerId:i,...o&&{customFields:{parentAction:o},tags:[`from:${o}`],identifiers:{scanId:`from:${o}`}},product:a,...s&&{thng:s}});return r.finish(),u}async function gr(){var C,I;let e=Dt(pt.PRODUCT_ID,{isEvtId:!0});if(!e){console.log(Q.MISSING_PRODUCT);return}if(Xt(Oe.ARE_COOKIES_BLOCKED)){hr(St.IMPLICIT_SCAN_ID),hr(St.CONSUMER_ID),console.log(Q.COOKIES_ARE_BLOCKED);return}let r=Dt(pt.IMPLICIT_SCAN_ID,{isEvtId:!0}),n=dr(St.IMPLICIT_SCAN_ID);if(r&&n&&r===n){console.log(Q.REDUNDANT_SCAN);return}let o=dr(St.CONSUMER_ID),a=mr(St.CONSUMER_ID,o!=null?o:pr()),s=(C=Xt(Oe.ACCESS_TOKEN))!=null?C:Dt(pt.ACCESS_TOKEN,{isRequired:!0}),u=Xt(Oe.REGION),c=Dt(pt.THNG_ID,{isEvtId:!0}),{createAction:p}=vr(s,u),m=!!Dt(pt.SCAN_CREATED)?"referrals":"scans",h=await p({actionType:m,consumerId:a,parentActionId:r,product:e,thng:c});ai(pt.SCAN_CREATED,Date.now()),r&&mr(St.IMPLICIT_SCAN_ID,r),console.log(m==="referrals"?Q.REFERRAL_ACTION:Q.SCAN_COMPLETED),$t.finish();let{redirectUrl:v,redirectionContext:y}=((I=h==null?void 0:h.reactions)==null?void 0:I[0])||{},{contextScriptRedirection:E}=(y==null?void 0:y.constants)||{};v&&E&&(console.log(`${Q.REDIRECTING} ${v}`),window.location.replace(v))}function _r(e){try{return JSON.parse(e==null?void 0:e.message).errors[0]}catch(t){return(e==null?void 0:e.message)||(e==null?void 0:e.toString())||"Unknown error"}}console.log(Q.SCRIPT_VERSION);gr().catch(async e=>{let t=e instanceof Promise?await(e==null?void 0:e.catch(n=>n)):e,r=_r(t);console.error(`${Q.SCAN_ERROR}: ${r}`),_t(t)});})(); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /*! js-cookie v3.0.1 | MIT */ //# sourceMappingURL=context-script.js.map