highlight.run
Advanced tools
Comparing version 8.1.0 to 8.2.0
# highlight.run | ||
## 8.2.0 | ||
### Minor Changes | ||
- 8142463b5: ensure highlight script tag is only inserted once to optimize for browser performance by reducing unused javascript in next.js environments | ||
## 8.1.0 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
declare const _default: "8.1.0"; | ||
declare const _default: "8.2.0"; | ||
export default _default; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).H={})}(this,(function(e){"use strict";var t=Object.defineProperty,n=Object.defineProperties,o=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,l=(e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,a=(e,t)=>{for(var n in t||(t={}))i.call(t,n)&&l(e,n,t[n]);if(r)for(var n of r(t))s.call(t,n)&&l(e,n,t[n]);return e},c=(e,t)=>n(e,o(t)),d=(e,t)=>{var n={};for(var o in e)i.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&r)for(var o of r(e))t.indexOf(o)<0&&s.call(e,o)&&(n[o]=e[o]);return n},u=(e,t,n)=>(l(e,"symbol"!=typeof t?t+"":t,n),n),h=(e,t,n)=>new Promise(((o,r)=>{var i=e=>{try{l(n.next(e))}catch(t){r(t)}},s=e=>{try{l(n.throw(e))}catch(t){r(t)}},l=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,s);l((n=n.apply(e,t)).next())}));const p=({apiKey:e})=>{!function(t,n){var o=t.amplitude||{_q:[],_iq:{}},r=n.createElement("script");r.type="text/javascript",r.integrity="sha384-+EO59vL/X7v6VE2s6/F4HxfHlK0nDUVWKVg8K9oUlvffAeeaShVBmbORTC2D3UF+",r.crossOrigin="anonymous",r.async=!0,r.src="https://cdn.amplitude.com/libs/amplitude-8.17.0-min.gz.js",r.onload=function(){t.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK"),amplitude.getInstance().init(e)};var i=n.getElementsByTagName("script")[0];function s(e,t){e.prototype[t]=function(){return this._q.push([t].concat(Array.prototype.slice.call(arguments,0))),this}}i.parentNode.insertBefore(r,i);for(var l=function(){return this._q=[],this},a=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove"],c=0;c<a.length;c++)s(l,a[c]);o.Identify=l;for(var d=function(){return this._q=[],this},u=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"],h=0;h<u.length;h++)s(d,u[h]);o.Revenue=d;var p=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","enableTracking","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","groupIdentify","onInit","logEventWithTimestamp","logEventWithGroups","setSessionId","resetSessionId"];function g(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)))}}for(var n=0;n<p.length;n++)t(p[n])}g(o),o.getInstance=function(e){return e=(e&&0!==e.length?e:"$default_instance").toLowerCase(),Object.prototype.hasOwnProperty.call(o._iq,e)||(o._iq[e]={_q:[]},g(o._iq[e])),o._iq[e]},t.amplitude=o}(window,document)};var g=(e=>(e.RECORDING_START_TIME="highlightRecordingStartTime",e.SEGMENT_LAST_SENT_HASH_KEY="HIGHLIGHT_SEGMENT_LAST_SENT_HASH_KEY",e.SESSION_DATA="sessionData",e.SESSION_SECURE_ID="sessionSecureID",e.USER_IDENTIFIER="highlightIdentifier",e.USER_OBJECT="highlightUserObject",e.PAYLOAD_ID="payloadId",e))(g||{});const f="https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";function w(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();let o=e.parentElement,r=[];if(o.children&&o.children.length>0)for(let e=0;e<o.children.length;e++){let t=o.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&r.push(t)}r.length>1&&(n+=":eq("+r.indexOf(e)+")"),t=n+(t?">"+t:""),e=o}return t}function m(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e,t){if(0===t)return!0;const n=Object.keys(e);for(const o of n)if(m(e[o])&&v(e[o],t-1))return!0;return!1}function y(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const o=[],r=[];return JSON.stringify(e,(function(e,t){if(o.length>0){const n=o.indexOf(this);~n?o.splice(n+1):o.push(this),~n?r.splice(n,1/0,e):r.push(e),~o.indexOf(t)&&(t=o[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,o.indexOf(t)).join(".")+"]")}else o.push(t);if(null==t)return t;if(function(e){if(m(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(e instanceof Event&&!1===e.isTrusted){return 1===Object.keys(e).length}if(m(e)&&v(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if(t instanceof Event){const e={};for(const n in t){const o=t[n];Array.isArray(o)?e[n]=w(o.length?o[0]:null):e[n]=o}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.name+": "+t.message:t}))}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k,R,S,E,N,O={exports:{}},C={exports:{}};function _(){return k||(k=1,C.exports=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function n(e){return function(){return this[e]}}var o=["isConstructor","isEval","isNative","isToplevel"],r=["columnNumber","lineNumber"],i=["fileName","functionName","source"],s=["args"],l=["evalOrigin"],a=o.concat(r,i,s,l);function c(e){if(e)for(var n=0;n<a.length;n++)void 0!==e[a[n]]&&this["set"+t(a[n])](e[a[n]])}c.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof c)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new c(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",n=this.getColumnNumber()||"",o=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+n+")":"[eval]:"+t+":"+n:o?o+" ("+e+":"+t+":"+n+")":e+":"+t+":"+n}},c.fromString=function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),o=e.substring(0,t),r=e.substring(t+1,n).split(","),i=e.substring(n+1);if(0===i.indexOf("@"))var s=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),l=s[1],a=s[2],d=s[3];return new c({functionName:o,args:r||void 0,fileName:l,lineNumber:a||void 0,columnNumber:d||void 0})};for(var d=0;d<o.length;d++)c.prototype["get"+t(o[d])]=n(o[d]),c.prototype["set"+t(o[d])]=function(e){return function(t){this[e]=Boolean(t)}}(o[d]);for(var u=0;u<r.length;u++)c.prototype["get"+t(r[u])]=n(r[u]),c.prototype["set"+t(r[u])]=function(t){return function(n){if(!e(n))throw new TypeError(t+" must be a Number");this[t]=Number(n)}}(r[u]);for(var h=0;h<i.length;h++)c.prototype["get"+t(i[h])]=n(i[h]),c.prototype["set"+t(i[h])]=function(e){return function(t){this[e]=String(t)}}(i[h]);return c}()),C.exports}O.exports=(R=_(),S=/(^|@)\S+:\d+/,E=/^\s*at .*(\S+:\d+|\(native\))/m,N=/^(eval@)?(\[native code])?$/,{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(E))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(E)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),o=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:o.pop()),i=o.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new R({functionName:i,fileName:s,lineNumber:r[1],columnNumber:r[2],source:e})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(N)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new R({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),o=n&&n[1]?n[1]:void 0,r=this.extractLocation(e.replace(t,""));return new R({functionName:o,fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),o=[],r=2,i=n.length;r<i;r+=2){var s=t.exec(n[r]);s&&o.push(new R({fileName:s[2],lineNumber:s[1],source:n[r]}))}return o},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),o=[],r=0,i=n.length;r<i;r+=2){var s=t.exec(n[r]);s&&o.push(new R({functionName:s[3]||void 0,fileName:s[2],lineNumber:s[1],source:n[r]}))}return o},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(S)&&!e.match(/^Error created at/)}),this).map((function(e){var t,n=e.split("@"),o=this.extractLocation(n.pop()),r=n.shift()||"",i=r.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;r.match(/\(([^)]*)\)/)&&(t=r.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var s=void 0===t||"[arguments not available]"===t?void 0:t.split(",");return new R({functionName:i,args:s,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:e})}),this)}});const T=b(O.exports);function L(e,t){const n=t.logger;if(!n)return()=>{};let o;o="string"==typeof n?window[n]:n;const r=[];if(t.level.includes("error")&&window){const n=n=>{const{message:o,error:r}=n;let i=[];r&&(i=T.parse(r));const s=[y(o,t.stringifyOptions)];e({type:"Error",trace:i,time:Date.now(),value:s})};window.addEventListener("error",n),r.push((()=>{window&&window.removeEventListener("error",n)}))}for(const s of t.level)r.push(i(o,s));return()=>{r.forEach((e=>e()))};function i(n,o){return n[o]?function(e,t,n){try{if(!(t in e))return()=>{};const o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,()=>{e[t]=o}}catch(o){return()=>{}}}(n,o,(n=>(...r)=>{n.apply(this,r);try{const n=T.parse(new Error),i=r.map((e=>y(e,t.stringifyOptions)));e({type:o,trace:n.slice(1),value:i,time:Date.now()})}catch(i){n("highlight logger error:",i,...r)}})):()=>{}}}var x={exports:{}};!function(e,t){function n(e,t){var n=[],o=[];return null==t&&(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}}(e.exports=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)}).getSerialize=n}(x);const I=b(x.exports);function H(e,t,n,o){var r,i,s,l;const a=T.parse(o);t instanceof Error&&(t=t.message);const c=q(a);e({event:I(t),type:"window.onerror",url:window.location.href,source:null!=n?n:"",lineNumber:(null==(r=c[0])?void 0:r.lineNumber)?null==(i=c[0])?void 0:i.lineNumber:0,columnNumber:(null==(s=c[0])?void 0:s.columnNumber)?null==(l=c[0])?void 0:l.columnNumber:0,stackTrace:c,timestamp:(new Date).toISOString()})}const j=e=>{if("undefined"==typeof window)return()=>{};const t=window.onerror=(t,n,o,r,i)=>{H(e,t,n,null!=i?i:Error())},n=window.onunhandledrejection=t=>{var n;if(t.reason){const o=t.promise;o.getStack?H(e,t.reason,t.type,null!=(n=o.getStack())?n:Error()):H(e,t.reason,t.type,Error())}},o=window.Promise.constructor;return window.Promise.constructor=function(e){this.promiseCreationError=new Error,o(e)},window.Promise.prototype.getStack=function(){return this.promiseCreationError},()=>{window.Promise.constructor=o,window.onunhandledrejection=n,window.onerror=t}},q=e=>{var t;if(0===e.length)return e;const n=e[0];return"console.error"===n.functionName&&(null==(t=n.fileName)?void 0:t.includes("highlight.run"))||"new HighlightPromise"===n.functionName?e.slice(1):e},D=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],B=['["\\"Script error.\\""]','"Script error."','["\\"Load failed.\\""]','"Load failed."','["\\"Network request failed.\\""]','"Network request failed."','["\\"Document is not focused.\\""]','"Document is not focused."','["\\"Failed to fetch\\""]','"Failed to fetch"','[{"isTrusted":true}]','{"isTrusted":true}','["{}"]','"{}"','[""]','""','["\\"\\""]','""'],P=["websocket error",'\\"ResizeObserver loop'],A=(e,t,n)=>{const o=U(t,e.headers,n);return c(a({},e),{headers:o})},U=(e,t,n)=>{var o,r;const i=a({},t);return n?(null==(o=Object.keys(i))||o.forEach((e=>{[...n].includes(null==e?void 0:e.toLowerCase())||(i[e]="[REDACTED]")})),i):(null==(r=Object.keys(i))||r.forEach((t=>{[...K,...e].includes(null==t?void 0:t.toLowerCase())&&(i[t]="[REDACTED]")})),i)},K=["authorization","cookie","proxy-authorization","token"],W=["https://www.googleapis.com/identitytoolkit","https://securetoken.googleapis.com"],z="X-Highlight-Request",F=e=>{let t=e;return e.startsWith("https://")||e.startsWith("http://")||(t=`${window.location.origin}${t}`),t.replace(/\/+$/,"")},M=(e,t,n,o)=>{e.sort(((e,t)=>e.responseEnd-t.responseEnd));const r=e.reduce(((e,t)=>{const o=F(t.name);return t.initiatorType===n?e[n][o]=[...e[n][o]||[],t]:e.others[o]=[...e.others[o]||[],t],e}),{xmlhttprequest:{},others:{},fetch:{}});let i={};i=t.reduce(((e,t)=>{const n=F(t.request.url);return e[n]=[...e[n]||[],t],e}),i);for(let l in r[n]){const e=r[n][l],t=i[l];if(!t)continue;const o=Math.max(e.length-t.length,0);for(let n=o;n<e.length;n++)e[n]&&(e[n].requestResponsePair=t[n-o])}let s=[];for(let l in r)for(let e in r[l])s=s.concat(r[l][e]);return s.sort(((e,t)=>e.fetchStart-t.fetchStart)).reduce(((e,t)=>{let n=t.requestResponsePair;return n&&(n=((e,{headersToRedact:t,headersToRecord:n,requestResponseSanitizer:o})=>{let r=e;if(o){try{r=o(r)}catch(u){}if(!r)return null}const i=r,{request:s,response:l}=i,c=d(i,["request","response"]);return a({request:A(s,t,n),response:A(l,t,n)},c)})(t.requestResponsePair,o),!n)||(t.toJSON=function(){return{initiatorType:this.initiatorType,startTime:this.startTime,responseEnd:this.responseEnd,startTimeAbs:window.performance.timeOrigin+this.startTime,responseEndAbs:window.performance.timeOrigin+this.responseEnd,name:this.name,transferSize:this.transferSize,encodedBodySize:this.encodedBodySize,requestResponsePairs:n}},e.push(t)),e}),[])},V=(e,t,n)=>{return r=t,!((o=e).toLocaleLowerCase().includes("https://pub.highlight.run")||o.toLocaleLowerCase().includes("highlight.run")||o.toLocaleLowerCase().includes(r))||$(e,n);var o,r},$=(e,t)=>{var n;let o=[];!0===t?(o=["localhost",/^\//],(null==(n=null==window?void 0:window.location)?void 0:n.host)&&o.push(window.location.host)):t instanceof Array&&(o=t);let r=!1;return o.forEach((t=>{e.match(t)&&(r=!0)})),r};const J=()=>function(e){for(var t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=n.length,r=0;r<e;r++)t+=n.charAt(Math.floor(Math.random()*o));return t}(10),G=(e,t)=>e+"/"+t,X=(e,t,n,o,r,i,s)=>{const l=XMLHttpRequest.prototype,a=l.open,c=l.send,d=l.setRequestHeader;return l.open=function(e,t){return this._method=e,this._url=t,this._requestHeaders={},this._shouldRecordHeaderAndBody=!o.some((e=>t.toLowerCase().includes(e))),a.apply(this,arguments)},l.setRequestHeader=function(e,t){return this._requestHeaders[e]=t,d.apply(this,arguments)},l.send=function(o){if(!V(this._url,t,n))return c.apply(this,arguments);const l=J();$(this._url,n)&&this.setRequestHeader(z,G(r,l));const a=this._shouldRecordHeaderAndBody,d={id:l,url:this._url,verb:this._method,headers:a?this._requestHeaders:{},body:void 0};if(a&&o){const e=Y(o,d.url);e&&(d.body=Z(e,i,s,d.headers))}return this.addEventListener("load",(function(){return h(this,null,(function*(){const t={status:this.status,headers:{},body:void 0};if(a){const e=this.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};if(e.forEach((function(e){const t=e.split(": "),n=t.shift();r[n]=t.join(": ")})),t.headers=r,o){const e=Y(o,d.url);e&&(d.body=Z(e,i,s,t.headers))}if(""===this.responseType||"text"===this.responseType)t.body=Z(this.responseText,i,s,t.headers),t.size=8*this.responseText.length;else if("blob"===this.responseType){if(this.response instanceof Blob)try{const e=yield this.response.text();t.body=Z(e,i,s,t.headers),t.size=this.response.size}catch(n){}}else try{t.body=Z(this.response,i,s,t.headers)}catch(n){}}e({request:d,response:t,urlBlocked:!a})}))})),this.addEventListener("error",(function(){return h(this,null,(function*(){const t={status:this.status,headers:void 0,body:void 0};e({request:d,response:t,urlBlocked:!1})}))})),c.apply(this,arguments)},()=>{l.open=a,l.send=c,l.setRequestHeader=d}},Y=(e,t)=>{if("string"==typeof e){if(!(null==t?void 0:t.includes("localhost"))&&!(null==t?void 0:t.includes("highlight.run"))||!e.includes("pushPayload"))return e}else if("object"==typeof e||"number"==typeof e||"boolean"==typeof e)return e.toString();return null},Q={"application/json":67108864,"text/plain":67108864},Z=(e,t,n,o)=>{var r,i,s;let l=65536;if(o){let e="";e="function"==typeof o.get?null!=(r=o.get("content-type"))?r:"":null!=(i=o["content-type"])?i:"";try{e=e.split(";")[0]}catch(a){}l=null!=(s=Q[e])?s:65536}if(e){if(t)try{const n=JSON.parse(e);Object.keys(n).forEach((e=>{t.includes(e.toLocaleLowerCase())&&(n[e]="[REDACTED]")})),e=JSON.stringify(n)}catch(a){}if(n)try{const t=JSON.parse(e);Object.keys(t).forEach((e=>{n.includes(e.toLocaleLowerCase())||(t[e]="[REDACTED]")})),e=JSON.stringify(t)}catch(a){}}try{e=e.slice(0,l)}catch(a){}return e},ee=(e,t,n,o,r,i,s)=>{const l=window._fetchProxy;return window._fetchProxy=function(a,c){const{method:d,url:u}=te(a,c);if(!V(u,t,n))return l.call(this,a,c);const h=J();if($(u,n)){c=c||{};let e=new Headers(c.headers);a instanceof Request&&[...a.headers].forEach((([t,n])=>e.set(t,n))),e.set(z,G(r,h)),c.headers=Object.fromEntries(e.entries())}const p={id:h,headers:{},body:void 0,url:u,verb:d},g=!o.some((e=>u.toLowerCase().includes(e)));g&&(p.headers=Object.fromEntries(new Headers(null==c?void 0:c.headers).entries()),p.body=Z(null==c?void 0:c.body,i,s,null==c?void 0:c.headers));let f=l.call(this,a,c);return ne(f,p,e,g,i,s),f},()=>{window._fetchProxy=l}},te=(e,t)=>{const n=t&&t.method||"object"==typeof e&&"method"in e&&e.method||"GET";let o;return o="object"==typeof e?"url"in e&&e.url?e.url:e.toString():e,{method:n,url:o}},ne=(e,t,n,o,r,i)=>{e.then((e=>h(this,null,(function*(){let s={body:void 0,headers:void 0,status:0,size:0},l=!1;if("stack"in e||e instanceof Error)s=c(a({},s),{body:e.message,status:0,size:void 0}),l=!0;else if("status"in e){if(s=c(a({},s),{status:e.status}),o){let t;try{const n=e.clone().body;if(n){let o,s=n.getReader(),l=new TextDecoder,a="";for(;!(o=yield s.read()).done;){let e=o.value;a+=l.decode(e)}t=a,t=Z(t,r,i,e.headers)}else t=""}catch(d){t=`Unable to clone response: ${d}`}s.body=t,s.headers=Object.fromEntries(e.headers.entries()),s.size=8*t.length}l=!0}if(l){n({request:t,response:s,urlBlocked:!o})}})))).catch((()=>{}))},oe=({xhrCallback:e,fetchCallback:t,webSocketRequestCallback:n,webSocketEventCallback:o,disableWebSocketRecording:r,bodyKeysToRedact:i,backendUrl:s,tracingOrigins:l,urlBlocklist:a,sessionSecureID:c,bodyKeysToRecord:u})=>{const h=X(e,s,l,a,c,i,u),p=ee(t,s,l,a,c,i,u),g=r?()=>{}:((e,t,n)=>{const o=window._highlightWebSocketRequestCallback;window._highlightWebSocketRequestCallback=e;const r=window._highlightWebSocketEventCallback;return window._highlightWebSocketEventCallback=e=>{const o=e,{message:r,size:i}=o,s=d(o,["message","size"]),l=n.some((t=>e.name.toLowerCase().includes(t)));t(l?s:e)},()=>{window._highlightWebSocketRequestCallback=o,window._highlightWebSocketEventCallback=r}})(n,o,a);return()=>{h(),p(),g()}};class re{constructor(e){var t;u(this,"disableConsoleRecording"),u(this,"reportConsoleErrors"),u(this,"consoleMethodsToRecord"),u(this,"listeners"),u(this,"errors"),u(this,"messages"),u(this,"options"),u(this,"hasNetworkRecording",!0),u(this,"_backendUrl"),u(this,"disableNetworkRecording"),u(this,"enableRecordingNetworkContents"),u(this,"xhrNetworkContents"),u(this,"fetchNetworkContents"),u(this,"disableRecordingWebSocketContents"),u(this,"webSocketNetworkContents"),u(this,"webSocketEventContents"),u(this,"tracingOrigins"),u(this,"networkHeadersToRedact"),u(this,"networkBodyKeysToRedact"),u(this,"networkBodyKeysToRecord"),u(this,"networkHeaderKeysToRecord"),u(this,"urlBlocklist"),u(this,"requestResponseSanitizer"),this.options=e,this.disableConsoleRecording=!!e.disableConsoleRecording,this.reportConsoleErrors=null!=(t=e.reportConsoleErrors)&&t,this.consoleMethodsToRecord=e.consoleMethodsToRecord||[...D],this.listeners=[],this.errors=[],this.messages=[]}isListening(){return this.listeners.length>0}startListening(){if(this.isListening())return;const e=this;this.disableConsoleRecording||this.listeners.push(L((t=>{var n,o,r;if(this.reportConsoleErrors&&("Error"===t.type||"error"===t.type)&&t.value&&t.trace){const i=I(t.value);if(B.includes(i)||P.some((e=>i.includes(e))))return;e.errors.push({event:i,type:"console.error",url:window.location.href,source:(null==(n=t.trace[0])?void 0:n.fileName)?t.trace[0].fileName:"",lineNumber:(null==(o=t.trace[0])?void 0:o.lineNumber)?t.trace[0].lineNumber:0,columnNumber:(null==(r=t.trace[0])?void 0:r.columnNumber)?t.trace[0].columnNumber:0,stackTrace:t.trace,timestamp:(new Date).toISOString()})}e.messages.push(t)}),{level:this.consoleMethodsToRecord,logger:"console",stringifyOptions:{depthOfLimit:10,numOfKeysLimit:100,stringLengthLimit:1e3}})),this.listeners.push(j((t=>{B.includes(t.event)||P.some((e=>t.event.includes(e)))||e.errors.push(t)}))),re.setupNetworkListener(this,this.options)}stopListening(){this.listeners.forEach((e=>e())),this.listeners=[]}static setupNetworkListener(e,t){var n,o,r,i,s,l,a,c,d,u,h,p;e._backendUrl=(null==t?void 0:t.backendUrl)||"https://pub.highlight.run",e.xhrNetworkContents=[],e.fetchNetworkContents=[],e.webSocketNetworkContents=[],e.webSocketEventContents=[],e.networkHeadersToRedact=[],e.urlBlocklist=[],e.tracingOrigins=t.tracingOrigins||[],void 0!==(null==t?void 0:t.disableNetworkRecording)?(e.disableNetworkRecording=null==t?void 0:t.disableNetworkRecording,e.enableRecordingNetworkContents=!1,e.disableRecordingWebSocketContents=!0,e.networkHeadersToRedact=[],e.networkBodyKeysToRedact=[],e.urlBlocklist=[],e.networkBodyKeysToRecord=[],e.networkBodyKeysToRecord=[]):"boolean"==typeof(null==t?void 0:t.networkRecording)?(e.disableNetworkRecording=!t.networkRecording,e.enableRecordingNetworkContents=!1,e.disableRecordingWebSocketContents=!0,e.networkHeadersToRedact=[],e.networkBodyKeysToRedact=[],e.urlBlocklist=[]):(void 0!==(null==(n=t.networkRecording)?void 0:n.enabled)?e.disableNetworkRecording=!t.networkRecording.enabled:e.disableNetworkRecording=!1,e.enableRecordingNetworkContents=(null==(o=t.networkRecording)?void 0:o.recordHeadersAndBody)||!1,e.disableRecordingWebSocketContents=(null==(r=t.networkRecording)?void 0:r.disableWebSocketEventRecordings)||!1,e.networkHeadersToRedact=(null==(s=null==(i=t.networkRecording)?void 0:i.networkHeadersToRedact)?void 0:s.map((e=>e.toLowerCase())))||[],e.networkBodyKeysToRedact=(null==(a=null==(l=t.networkRecording)?void 0:l.networkBodyKeysToRedact)?void 0:a.map((e=>e.toLowerCase())))||[],e.urlBlocklist=(null==(d=null==(c=t.networkRecording)?void 0:c.urlBlocklist)?void 0:d.map((e=>e.toLowerCase())))||[],e.urlBlocklist=[...e.urlBlocklist,...W],e.requestResponseSanitizer=null==(u=t.networkRecording)?void 0:u.requestResponseSanitizer,e.networkHeaderKeysToRecord=null==(h=t.networkRecording)?void 0:h.headerKeysToRecord,e.networkHeaderKeysToRecord&&(e.networkHeadersToRedact=[],e.networkHeaderKeysToRecord=e.networkHeaderKeysToRecord.map((e=>e.toLocaleLowerCase()))),e.networkBodyKeysToRecord=null==(p=t.networkRecording)?void 0:p.bodyKeysToRecord,e.networkBodyKeysToRecord&&(e.networkBodyKeysToRedact=[],e.networkBodyKeysToRecord=e.networkBodyKeysToRecord.map((e=>e.toLocaleLowerCase())))),!e.disableNetworkRecording&&e.enableRecordingNetworkContents&&e.listeners.push(oe({xhrCallback:t=>{e.xhrNetworkContents.push(t)},fetchCallback:t=>{e.fetchNetworkContents.push(t)},webSocketRequestCallback:t=>{e.webSocketNetworkContents&&e.webSocketNetworkContents.push(t)},webSocketEventCallback:t=>{e.webSocketEventContents.push(t)},disableWebSocketRecording:e.disableRecordingWebSocketContents,bodyKeysToRedact:e.networkBodyKeysToRedact,backendUrl:e._backendUrl,tracingOrigins:e.tracingOrigins,urlBlocklist:e.urlBlocklist,sessionSecureID:t.sessionSecureID,bodyKeysToRecord:e.networkBodyKeysToRecord}))}static getRecordedNetworkResources(e,t){var n;let o=[],r=[];if(!e.disableNetworkRecording){const r=(null==(n=null==window?void 0:window.performance)?void 0:n.timeOrigin)||0;o=performance.getEntriesByType("resource");const i=2*(t-r);if(o=o.filter((t=>V(t.name,e._backendUrl,e.tracingOrigins))).map((e=>c(a({},e.toJSON()),{offsetStartTime:e.startTime-i,offsetResponseEnd:e.responseEnd-i,offsetFetchStart:e.fetchStart-i}))),e.enableRecordingNetworkContents){const t={headersToRedact:e.networkHeadersToRedact,headersToRecord:e.networkHeaderKeysToRecord,requestResponseSanitizer:e.requestResponseSanitizer};o=M(o,e.xhrNetworkContents,"xmlhttprequest",t),o=M(o,e.fetchNetworkContents,"fetch",t)}}return e.disableRecordingWebSocketContents||(r=e.webSocketNetworkContents||[]),[...o,...r]}static getRecordedWebSocketEvents(e){let t=[];return e.disableNetworkRecording||e.disableRecordingWebSocketContents||(t=e.webSocketEventContents),t}static clearRecordedNetworkResources(e){e.disableNetworkRecording||(e.xhrNetworkContents=[],e.fetchNetworkContents=[],e.webSocketNetworkContents=[],e.webSocketEventContents=[],performance.clearResourceTimings())}}const ie="8.1.0",se=()=>null;var le=(e=>(e.Device="Device",e.WebVital="WebVital",e.Frontend="Frontend",e.Backend="Backend",e))(le||{});const ae=(e,t)=>{console.warn(`highlight.run warning: (${e}): `,t)};let ce,de,ue,he,pe=[],ge=!1;const fe={options:void 0,init:(e,t)=>{var n,o,r,i,s,l,d,u;try{if(fe.options=t,"undefined"==typeof window||"undefined"==typeof document)return;if(!e)return void console.info("Highlight is not initializing because projectID was passed undefined.");let w=(()=>{let e=JSON.parse(window.sessionStorage.getItem(g.SESSION_DATA)||"{}");if(e&&e.lastPushTime&&Date.now()-e.lastPushTime<55e3)return e})(),m=(()=>{var e;const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";var n="";const o="undefined"!=typeof window&&(null==(e=window.crypto)?void 0:e.getRandomValues),r=new Uint32Array(28);o&&window.crypto.getRandomValues(r);for(let i=0;i<28;i++)n+=t.charAt(o?r[i]%t.length:Math.floor(Math.random()*t.length));return n})();if(null==w?void 0:w.sessionSecureID)m=w.sessionSecureID;else{const t=c(a({},w),{projectID:+e,sessionSecureID:m});window.sessionStorage.setItem(g.SESSION_DATA,JSON.stringify(t))}if(ge)return{sessionSecureID:m};ge=!0,de=document.createElement("script");var h=(null==t?void 0:t.scriptUrl)?t.scriptUrl:"https://static.highlight.io/v8.1.0/index.js";de.setAttribute("src",h),de.setAttribute("type","text/javascript"),document.getElementsByTagName("head")[0].appendChild(de);const v={organizationID:e,debug:null==t?void 0:t.debug,backendUrl:null==t?void 0:t.backendUrl,tracingOrigins:null==t?void 0:t.tracingOrigins,disableNetworkRecording:null==t?void 0:t.disableNetworkRecording,networkRecording:null==t?void 0:t.networkRecording,disableBackgroundRecording:null==t?void 0:t.disableBackgroundRecording,disableConsoleRecording:null==t?void 0:t.disableConsoleRecording,disableSessionRecording:null==t?void 0:t.disableSessionRecording,reportConsoleErrors:null==t?void 0:t.reportConsoleErrors,consoleMethodsToRecord:null==t?void 0:t.consoleMethodsToRecord,enableSegmentIntegration:null==t?void 0:t.enableSegmentIntegration,privacySetting:null==t?void 0:t.privacySetting,enableCanvasRecording:null==t?void 0:t.enableCanvasRecording,enablePerformanceRecording:null==t?void 0:t.enablePerformanceRecording,samplingStrategy:null==t?void 0:t.samplingStrategy,inlineImages:null==t?void 0:t.inlineImages,inlineStylesheet:null==t?void 0:t.inlineStylesheet,recordCrossOriginIframe:null==t?void 0:t.recordCrossOriginIframe,firstloadVersion:ie,environment:(null==t?void 0:t.environment)||"production",appVersion:null==t?void 0:t.version,serviceName:null==t?void 0:t.serviceName,sessionShortcut:null==t?void 0:t.sessionShortcut,sessionSecureID:m,storageMode:null==t?void 0:t.storageMode};return he=new re(v),(null==t?void 0:t.manualStart)||he.startListening(),de.addEventListener("load",(()=>{const e=()=>{ue=new window.HighlightIO(v,he),(null==t?void 0:t.manualStart)||ue.initialize()};if("HighlightIO"in window)e();else{const t=setInterval((()=>{"HighlightIO"in window&&(e(),clearInterval(t))}),100)}})),!(null==(o=null==(n=null==t?void 0:t.integrations)?void 0:n.mixpanel)?void 0:o.disabled)&&(null==(i=null==(r=null==t?void 0:t.integrations)?void 0:r.mixpanel)?void 0:i.projectToken)&&(({projectToken:e})=>{if(window.mixpanel)return;var t,n,o;document,(t=window.mixpanel||[]).__SV||(window.mixpanel=t,t._i=[],t.init=function(e,r,i){function s(e,t){var n=t.split(".");2==n.length&&(e=e[n[0]],t=n[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var l=t;for(void 0!==i?l=t[i]=[]:i="mixpanel",l.people=l.people||[],l.toString=function(e){var t="mixpanel";return"mixpanel"!==i&&(t+="."+i),e||(t+=" (stub)"),t},l.people.toString=function(){return l.toString(1)+".people (stub)"},n="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" "),o=0;o<n.length;o++)s(l,n[o]);var a="set set_once union unset remove delete".split(" ");l.get_group=function(){function e(e){t[e]=function(){call2_args=arguments,call2=[e].concat(Array.prototype.slice.call(call2_args,0)),l.push([n,call2])}}for(var t={},n=["get_group"].concat(Array.prototype.slice.call(arguments,0)),o=0;o<a.length;o++)e(a[o]);return t},t._i.push([e,r,i])},t.__SV=1.2);const r=document.createElement("script");r.src=f,document.head.appendChild(r),r.addEventListener("load",(()=>{var t;null==(t=window.mixpanel)||t.init(e)}))})(t.integrations.mixpanel),!(null==(l=null==(s=null==t?void 0:t.integrations)?void 0:s.amplitude)?void 0:l.disabled)&&(null==(u=null==(d=null==t?void 0:t.integrations)?void 0:d.amplitude)?void 0:u.apiKey)&&p(t.integrations.amplitude),{sessionSecureID:m}}catch(w){ae("init",w)}},snapshot:e=>h(this,null,(function*(){try{if(ue&&ue.ready)return yield ue.snapshot(e)}catch(t){ae("snapshot",t)}})),addSessionFeedback:({verbatim:e,userName:t,userEmail:n,timestampOverride:o})=>{try{fe.onHighlightReady((()=>ue.addSessionFeedback({verbatim:e,timestamp:o||(new Date).toISOString(),user_email:n,user_name:t})))}catch(r){ae("error",r)}},consumeError:(e,t,n)=>{try{fe.onHighlightReady((()=>ue.consumeCustomError(e,t,JSON.stringify(n))))}catch(o){ae("error",o)}},error:(e,t)=>{try{fe.onHighlightReady((()=>ue.pushCustomError(e,JSON.stringify(t))))}catch(n){ae("error",n)}},track:(e,t={})=>{var n,o,r,i,s,l,d,u,h,p,g;try{fe.onHighlightReady((()=>ue.addProperties(c(a({},t),{event:e}))));const f=null==ue?void 0:ue.getCurrentSessionURL();(null==(r=null==(o=null==(n=fe.options)?void 0:n.integrations)?void 0:o.mixpanel)?void 0:r.disabled)||(null==(i=window.mixpanel)?void 0:i.track)&&window.mixpanel.track(e,c(a({},t),{highlightSessionURL:f})),(null==(d=null==(l=null==(s=fe.options)?void 0:s.integrations)?void 0:l.amplitude)?void 0:d.disabled)||(null==(u=window.amplitude)?void 0:u.getInstance)&&window.amplitude.getInstance().logEvent(e,c(a({},t),{highlightSessionURL:f})),(null==(g=null==(p=null==(h=fe.options)?void 0:h.integrations)?void 0:p.intercom)?void 0:g.disabled)||window.Intercom&&window.Intercom("trackEvent",e,t)}catch(f){ae("track",f)}},start:e=>{"Recording"===(null==ue?void 0:ue.state)?(null==e?void 0:e.silent)||console.warn("Highlight is already recording. Please `H.stop()` the current session before starting a new one."):(he.startListening(),fe.onHighlightReady((()=>h(this,null,(function*(){yield ue.initialize(e)}))),{waitForReady:!1}))},stop:e=>{"Recording"!==(null==ue?void 0:ue.state)?(null==e?void 0:e.silent)||console.warn("Highlight is already stopped. Please call `H.start()`."):fe.onHighlightReady((()=>ue.stopRecording(!0)))},identify:(e,t={})=>{var n,o,r,i,s,l,a,c;try{fe.onHighlightReady((()=>ue.identify(e,t)))}catch(d){ae("identify",d)}if((null==(r=null==(o=null==(n=fe.options)?void 0:n.integrations)?void 0:o.mixpanel)?void 0:r.disabled)||(null==(i=window.mixpanel)?void 0:i.identify)&&(window.mixpanel.identify("string"==typeof(null==t?void 0:t.email)?null==t?void 0:t.email:e),t&&(window.mixpanel.track("identify",t),window.mixpanel.people.set(t))),!(null==(a=null==(l=null==(s=fe.options)?void 0:s.integrations)?void 0:l.amplitude)?void 0:a.disabled)&&(null==(c=window.amplitude)?void 0:c.getInstance)&&(window.amplitude.getInstance().setUserId(e),Object.keys(t).length>0)){const e=Object.keys(t).reduce(((e,n)=>(e.set(n,t[n]),e)),new window.amplitude.Identify);window.amplitude.getInstance().identify(e)}},metrics:e=>{try{fe.onHighlightReady((()=>ue.recordMetric(e.map((e=>c(a({},e),{category:"Frontend"}))))))}catch(t){ae("metrics",t)}},getSessionURL:()=>new Promise(((e,t)=>{fe.onHighlightReady((()=>{const n=ue.getCurrentSessionURL();n?e(n):t(new Error("Unable to get session URL"))}))})),getSessionDetails:()=>new Promise(((e,t)=>{fe.onHighlightReady((()=>{const n=ue.getCurrentSessionURL();if(n){const t=ue.getCurrentSessionTimestamp(),o=(new Date).getTime(),r=new URL(n),i=new URL(n);i.searchParams.set("ts",((o-t)/1e3).toString()),e({url:r.toString(),urlWithTimestamp:i.toString()})}else t(new Error("Could not get session URL"))}))})),onHighlightReady:(e,t)=>h(this,null,(function*(){try{ue&&(!1===(null==t?void 0:t.waitForReady)||ue.ready)?yield e():(pe.push({options:t,func:e}),void 0===ce&&(ce=setInterval((()=>h(this,null,(function*(){var e;const t=[];for(const n of pe)ue&&(!1===(null==(e=n.options)?void 0:e.waitForReady)||ue.ready)?yield n.func():t.push(n);pe=t,0==pe.length&&(clearInterval(ce),ce=void 0)}))),100)))}catch(n){ae("onHighlightReady",n)}}))};var we,me;"undefined"!=typeof window&&(window.H=fe),"undefined"!=typeof chrome&&(null==(we=null==chrome?void 0:chrome.runtime)?void 0:we.onMessage)&&(null==(me=null==chrome?void 0:chrome.runtime)||me.onMessage.addListener(((e,t,n)=>{const o=e.action;switch(console.log(`[highlight] received '${o}' event from extension.`),o){case"init":{const e="http://localhost:8080/dist/index.js";console.log("url",e),fe.init(1,{debug:!0,scriptUrl:e}),fe.getSessionURL().then((e=>{n({url:e})}));break}case"stop":fe.stop(),n({success:!0})}return!0}))),(()=>{if("undefined"!=typeof window){if(void 0!==window._highlightFetchPatch)return;window._originalFetch=window.fetch,window._fetchProxy=(e,t)=>window._originalFetch(e,t),window._highlightFetchPatch=(e,t)=>window._fetchProxy.call(window||global,e,t),window.fetch=window._highlightFetchPatch}})(),(()=>{if("undefined"!=typeof window){if(void 0!==window._highlightWebSocketRequestCallback)return;window._highlightWebSocketRequestCallback=se,window._highlightWebSocketEventCallback=se;const e=new Proxy(window.WebSocket,{construct(e,t){const n=J(),o=new e(...t),r=e=>{window._highlightWebSocketRequestCallback({socketId:n,initiatorType:"websocket",type:"open",name:o.url,startTime:e.timeStamp})},i=e=>{window._highlightWebSocketRequestCallback({socketId:n,initiatorType:"websocket",type:"close",name:o.url,requestEnd:e.timeStamp}),o.removeEventListener("open",r),o.removeEventListener("error",l),o.removeEventListener("message",s),o.removeEventListener("close",i)},s=e=>{const{data:t}=e,r="string"==typeof t?e.data:void 0;let i;i="string"==typeof t?t.length:t instanceof Blob?t.size:t.byteLength||0,window._highlightWebSocketEventCallback({socketId:n,type:"received",name:o.url,timeStamp:e.timeStamp,size:i,message:r})},l=e=>{window._highlightWebSocketEventCallback({socketId:n,type:"error",name:o.url,timeStamp:e.timeStamp,size:0})};o.addEventListener("open",r),o.addEventListener("error",l),o.addEventListener("message",s),o.addEventListener("close",i);const a=new Proxy(o.send,{apply:function(e,t,r){const i=r[0],s="string"==typeof i?i:void 0;let l;l="string"==typeof i?i.length:i instanceof Blob?i.size:i.byteLength||0,window._highlightWebSocketEventCallback({socketId:n,type:"sent",name:o.url,timeStamp:performance.now(),size:l,message:s}),e.apply(t,r)}});return o.send=a,o}});window.WebSocket=e}})(),e.H=fe,e.HighlightSegmentMiddleware=({next:e,payload:t})=>{if("undefined"!=typeof window&&"undefined"!=typeof document&&"H"in window)if("track"===t.obj.type){const e=t.obj.event,n=t.obj.properties;window.H.track(e,n)}else if("identify"===t.obj.type){const e=t.obj.userId;if(null==e?void 0:e.length){const n=t.obj.traits;window.H.identify(e,n)}}e(t)},e.MetricCategory=le,e.configureElectronHighlight=function(e){var t;e.on&&(null==(t=e.webContents)?void 0:t.send)&&(e.on("focus",(()=>{e.webContents.send("highlight.run",{visible:!0})})),e.on("blur",(()=>{e.webContents.send("highlight.run",{visible:!1})})),e.on("close",(()=>{e.webContents.send("highlight.run",{visible:!1})})))},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).H={})}(this,(function(e){"use strict";var t=Object.defineProperty,n=Object.defineProperties,o=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,l=(e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,a=(e,t)=>{for(var n in t||(t={}))i.call(t,n)&&l(e,n,t[n]);if(r)for(var n of r(t))s.call(t,n)&&l(e,n,t[n]);return e},c=(e,t)=>n(e,o(t)),d=(e,t)=>{var n={};for(var o in e)i.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&r)for(var o of r(e))t.indexOf(o)<0&&s.call(e,o)&&(n[o]=e[o]);return n},u=(e,t,n)=>(l(e,"symbol"!=typeof t?t+"":t,n),n),h=(e,t,n)=>new Promise(((o,r)=>{var i=e=>{try{l(n.next(e))}catch(t){r(t)}},s=e=>{try{l(n.throw(e))}catch(t){r(t)}},l=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,s);l((n=n.apply(e,t)).next())}));const p=({apiKey:e})=>{!function(t,n){var o=t.amplitude||{_q:[],_iq:{}},r=n.createElement("script");r.type="text/javascript",r.integrity="sha384-+EO59vL/X7v6VE2s6/F4HxfHlK0nDUVWKVg8K9oUlvffAeeaShVBmbORTC2D3UF+",r.crossOrigin="anonymous",r.async=!0,r.src="https://cdn.amplitude.com/libs/amplitude-8.17.0-min.gz.js",r.onload=function(){t.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK"),amplitude.getInstance().init(e)};var i=n.getElementsByTagName("script")[0];function s(e,t){e.prototype[t]=function(){return this._q.push([t].concat(Array.prototype.slice.call(arguments,0))),this}}i.parentNode.insertBefore(r,i);for(var l=function(){return this._q=[],this},a=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove"],c=0;c<a.length;c++)s(l,a[c]);o.Identify=l;for(var d=function(){return this._q=[],this},u=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"],h=0;h<u.length;h++)s(d,u[h]);o.Revenue=d;var p=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","enableTracking","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","groupIdentify","onInit","logEventWithTimestamp","logEventWithGroups","setSessionId","resetSessionId"];function g(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)))}}for(var n=0;n<p.length;n++)t(p[n])}g(o),o.getInstance=function(e){return e=(e&&0!==e.length?e:"$default_instance").toLowerCase(),Object.prototype.hasOwnProperty.call(o._iq,e)||(o._iq[e]={_q:[]},g(o._iq[e])),o._iq[e]},t.amplitude=o}(window,document)};var g=(e=>(e.RECORDING_START_TIME="highlightRecordingStartTime",e.SEGMENT_LAST_SENT_HASH_KEY="HIGHLIGHT_SEGMENT_LAST_SENT_HASH_KEY",e.SESSION_DATA="sessionData",e.SESSION_SECURE_ID="sessionSecureID",e.USER_IDENTIFIER="highlightIdentifier",e.USER_OBJECT="highlightUserObject",e.PAYLOAD_ID="payloadId",e))(g||{});const f="https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";function w(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();let o=e.parentElement,r=[];if(o.children&&o.children.length>0)for(let e=0;e<o.children.length;e++){let t=o.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&r.push(t)}r.length>1&&(n+=":eq("+r.indexOf(e)+")"),t=n+(t?">"+t:""),e=o}return t}function m(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e,t){if(0===t)return!0;const n=Object.keys(e);for(const o of n)if(m(e[o])&&v(e[o],t-1))return!0;return!1}function y(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const o=[],r=[];return JSON.stringify(e,(function(e,t){if(o.length>0){const n=o.indexOf(this);~n?o.splice(n+1):o.push(this),~n?r.splice(n,1/0,e):r.push(e),~o.indexOf(t)&&(t=o[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,o.indexOf(t)).join(".")+"]")}else o.push(t);if(null==t)return t;if(function(e){if(m(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(e instanceof Event&&!1===e.isTrusted){return 1===Object.keys(e).length}if(m(e)&&v(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if(t instanceof Event){const e={};for(const n in t){const o=t[n];Array.isArray(o)?e[n]=w(o.length?o[0]:null):e[n]=o}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.name+": "+t.message:t}))}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k,R,S,E,N,O={exports:{}},C={exports:{}};function _(){return k||(k=1,C.exports=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function n(e){return function(){return this[e]}}var o=["isConstructor","isEval","isNative","isToplevel"],r=["columnNumber","lineNumber"],i=["fileName","functionName","source"],s=["args"],l=["evalOrigin"],a=o.concat(r,i,s,l);function c(e){if(e)for(var n=0;n<a.length;n++)void 0!==e[a[n]]&&this["set"+t(a[n])](e[a[n]])}c.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof c)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new c(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",n=this.getColumnNumber()||"",o=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+n+")":"[eval]:"+t+":"+n:o?o+" ("+e+":"+t+":"+n+")":e+":"+t+":"+n}},c.fromString=function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),o=e.substring(0,t),r=e.substring(t+1,n).split(","),i=e.substring(n+1);if(0===i.indexOf("@"))var s=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),l=s[1],a=s[2],d=s[3];return new c({functionName:o,args:r||void 0,fileName:l,lineNumber:a||void 0,columnNumber:d||void 0})};for(var d=0;d<o.length;d++)c.prototype["get"+t(o[d])]=n(o[d]),c.prototype["set"+t(o[d])]=function(e){return function(t){this[e]=Boolean(t)}}(o[d]);for(var u=0;u<r.length;u++)c.prototype["get"+t(r[u])]=n(r[u]),c.prototype["set"+t(r[u])]=function(t){return function(n){if(!e(n))throw new TypeError(t+" must be a Number");this[t]=Number(n)}}(r[u]);for(var h=0;h<i.length;h++)c.prototype["get"+t(i[h])]=n(i[h]),c.prototype["set"+t(i[h])]=function(e){return function(t){this[e]=String(t)}}(i[h]);return c}()),C.exports}O.exports=(R=_(),S=/(^|@)\S+:\d+/,E=/^\s*at .*(\S+:\d+|\(native\))/m,N=/^(eval@)?(\[native code])?$/,{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(E))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(E)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),o=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:o.pop()),i=o.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new R({functionName:i,fileName:s,lineNumber:r[1],columnNumber:r[2],source:e})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(N)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new R({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),o=n&&n[1]?n[1]:void 0,r=this.extractLocation(e.replace(t,""));return new R({functionName:o,fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),o=[],r=2,i=n.length;r<i;r+=2){var s=t.exec(n[r]);s&&o.push(new R({fileName:s[2],lineNumber:s[1],source:n[r]}))}return o},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),o=[],r=0,i=n.length;r<i;r+=2){var s=t.exec(n[r]);s&&o.push(new R({functionName:s[3]||void 0,fileName:s[2],lineNumber:s[1],source:n[r]}))}return o},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(S)&&!e.match(/^Error created at/)}),this).map((function(e){var t,n=e.split("@"),o=this.extractLocation(n.pop()),r=n.shift()||"",i=r.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;r.match(/\(([^)]*)\)/)&&(t=r.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var s=void 0===t||"[arguments not available]"===t?void 0:t.split(",");return new R({functionName:i,args:s,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:e})}),this)}});const T=b(O.exports);function L(e,t){const n=t.logger;if(!n)return()=>{};let o;o="string"==typeof n?window[n]:n;const r=[];if(t.level.includes("error")&&window){const n=n=>{const{message:o,error:r}=n;let i=[];r&&(i=T.parse(r));const s=[y(o,t.stringifyOptions)];e({type:"Error",trace:i,time:Date.now(),value:s})};window.addEventListener("error",n),r.push((()=>{window&&window.removeEventListener("error",n)}))}for(const s of t.level)r.push(i(o,s));return()=>{r.forEach((e=>e()))};function i(n,o){return n[o]?function(e,t,n){try{if(!(t in e))return()=>{};const o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,()=>{e[t]=o}}catch(o){return()=>{}}}(n,o,(n=>(...r)=>{n.apply(this,r);try{const n=T.parse(new Error),i=r.map((e=>y(e,t.stringifyOptions)));e({type:o,trace:n.slice(1),value:i,time:Date.now()})}catch(i){n("highlight logger error:",i,...r)}})):()=>{}}}var x={exports:{}};!function(e,t){function n(e,t){var n=[],o=[];return null==t&&(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}}(e.exports=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)}).getSerialize=n}(x);const I=b(x.exports);function H(e,t,n,o){var r,i,s,l;const a=T.parse(o);t instanceof Error&&(t=t.message);const c=q(a);e({event:I(t),type:"window.onerror",url:window.location.href,source:null!=n?n:"",lineNumber:(null==(r=c[0])?void 0:r.lineNumber)?null==(i=c[0])?void 0:i.lineNumber:0,columnNumber:(null==(s=c[0])?void 0:s.columnNumber)?null==(l=c[0])?void 0:l.columnNumber:0,stackTrace:c,timestamp:(new Date).toISOString()})}const j=e=>{if("undefined"==typeof window)return()=>{};const t=window.onerror=(t,n,o,r,i)=>{H(e,t,n,null!=i?i:Error())},n=window.onunhandledrejection=t=>{var n;if(t.reason){const o=t.promise;o.getStack?H(e,t.reason,t.type,null!=(n=o.getStack())?n:Error()):H(e,t.reason,t.type,Error())}},o=window.Promise.constructor;return window.Promise.constructor=function(e){this.promiseCreationError=new Error,o(e)},window.Promise.prototype.getStack=function(){return this.promiseCreationError},()=>{window.Promise.constructor=o,window.onunhandledrejection=n,window.onerror=t}},q=e=>{var t;if(0===e.length)return e;const n=e[0];return"console.error"===n.functionName&&(null==(t=n.fileName)?void 0:t.includes("highlight.run"))||"new HighlightPromise"===n.functionName?e.slice(1):e},D=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],B=['["\\"Script error.\\""]','"Script error."','["\\"Load failed.\\""]','"Load failed."','["\\"Network request failed.\\""]','"Network request failed."','["\\"Document is not focused.\\""]','"Document is not focused."','["\\"Failed to fetch\\""]','"Failed to fetch"','[{"isTrusted":true}]','{"isTrusted":true}','["{}"]','"{}"','[""]','""','["\\"\\""]','""'],P=["websocket error",'\\"ResizeObserver loop'],A=(e,t,n)=>{const o=U(t,e.headers,n);return c(a({},e),{headers:o})},U=(e,t,n)=>{var o,r;const i=a({},t);return n?(null==(o=Object.keys(i))||o.forEach((e=>{[...n].includes(null==e?void 0:e.toLowerCase())||(i[e]="[REDACTED]")})),i):(null==(r=Object.keys(i))||r.forEach((t=>{[...K,...e].includes(null==t?void 0:t.toLowerCase())&&(i[t]="[REDACTED]")})),i)},K=["authorization","cookie","proxy-authorization","token"],W=["https://www.googleapis.com/identitytoolkit","https://securetoken.googleapis.com"],z="X-Highlight-Request",F=e=>{let t=e;return e.startsWith("https://")||e.startsWith("http://")||(t=`${window.location.origin}${t}`),t.replace(/\/+$/,"")},M=(e,t,n,o)=>{e.sort(((e,t)=>e.responseEnd-t.responseEnd));const r=e.reduce(((e,t)=>{const o=F(t.name);return t.initiatorType===n?e[n][o]=[...e[n][o]||[],t]:e.others[o]=[...e.others[o]||[],t],e}),{xmlhttprequest:{},others:{},fetch:{}});let i={};i=t.reduce(((e,t)=>{const n=F(t.request.url);return e[n]=[...e[n]||[],t],e}),i);for(let l in r[n]){const e=r[n][l],t=i[l];if(!t)continue;const o=Math.max(e.length-t.length,0);for(let n=o;n<e.length;n++)e[n]&&(e[n].requestResponsePair=t[n-o])}let s=[];for(let l in r)for(let e in r[l])s=s.concat(r[l][e]);return s.sort(((e,t)=>e.fetchStart-t.fetchStart)).reduce(((e,t)=>{let n=t.requestResponsePair;return n&&(n=((e,{headersToRedact:t,headersToRecord:n,requestResponseSanitizer:o})=>{let r=e;if(o){try{r=o(r)}catch(u){}if(!r)return null}const i=r,{request:s,response:l}=i,c=d(i,["request","response"]);return a({request:A(s,t,n),response:A(l,t,n)},c)})(t.requestResponsePair,o),!n)||(t.toJSON=function(){return{initiatorType:this.initiatorType,startTime:this.startTime,responseEnd:this.responseEnd,startTimeAbs:window.performance.timeOrigin+this.startTime,responseEndAbs:window.performance.timeOrigin+this.responseEnd,name:this.name,transferSize:this.transferSize,encodedBodySize:this.encodedBodySize,requestResponsePairs:n}},e.push(t)),e}),[])},V=(e,t,n)=>{return r=t,!((o=e).toLocaleLowerCase().includes("https://pub.highlight.run")||o.toLocaleLowerCase().includes("highlight.run")||o.toLocaleLowerCase().includes(r))||$(e,n);var o,r},$=(e,t)=>{var n;let o=[];!0===t?(o=["localhost",/^\//],(null==(n=null==window?void 0:window.location)?void 0:n.host)&&o.push(window.location.host)):t instanceof Array&&(o=t);let r=!1;return o.forEach((t=>{e.match(t)&&(r=!0)})),r};const J=()=>function(e){for(var t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=n.length,r=0;r<e;r++)t+=n.charAt(Math.floor(Math.random()*o));return t}(10),G=(e,t)=>e+"/"+t,X=(e,t,n,o,r,i,s)=>{const l=XMLHttpRequest.prototype,a=l.open,c=l.send,d=l.setRequestHeader;return l.open=function(e,t){return this._method=e,this._url=t,this._requestHeaders={},this._shouldRecordHeaderAndBody=!o.some((e=>t.toLowerCase().includes(e))),a.apply(this,arguments)},l.setRequestHeader=function(e,t){return this._requestHeaders[e]=t,d.apply(this,arguments)},l.send=function(o){if(!V(this._url,t,n))return c.apply(this,arguments);const l=J();$(this._url,n)&&this.setRequestHeader(z,G(r,l));const a=this._shouldRecordHeaderAndBody,d={id:l,url:this._url,verb:this._method,headers:a?this._requestHeaders:{},body:void 0};if(a&&o){const e=Y(o,d.url);e&&(d.body=Z(e,i,s,d.headers))}return this.addEventListener("load",(function(){return h(this,null,(function*(){const t={status:this.status,headers:{},body:void 0};if(a){const e=this.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};if(e.forEach((function(e){const t=e.split(": "),n=t.shift();r[n]=t.join(": ")})),t.headers=r,o){const e=Y(o,d.url);e&&(d.body=Z(e,i,s,t.headers))}if(""===this.responseType||"text"===this.responseType)t.body=Z(this.responseText,i,s,t.headers),t.size=8*this.responseText.length;else if("blob"===this.responseType){if(this.response instanceof Blob)try{const e=yield this.response.text();t.body=Z(e,i,s,t.headers),t.size=this.response.size}catch(n){}}else try{t.body=Z(this.response,i,s,t.headers)}catch(n){}}e({request:d,response:t,urlBlocked:!a})}))})),this.addEventListener("error",(function(){return h(this,null,(function*(){const t={status:this.status,headers:void 0,body:void 0};e({request:d,response:t,urlBlocked:!1})}))})),c.apply(this,arguments)},()=>{l.open=a,l.send=c,l.setRequestHeader=d}},Y=(e,t)=>{if("string"==typeof e){if(!(null==t?void 0:t.includes("localhost"))&&!(null==t?void 0:t.includes("highlight.run"))||!e.includes("pushPayload"))return e}else if("object"==typeof e||"number"==typeof e||"boolean"==typeof e)return e.toString();return null},Q={"application/json":67108864,"text/plain":67108864},Z=(e,t,n,o)=>{var r,i,s;let l=65536;if(o){let e="";e="function"==typeof o.get?null!=(r=o.get("content-type"))?r:"":null!=(i=o["content-type"])?i:"";try{e=e.split(";")[0]}catch(a){}l=null!=(s=Q[e])?s:65536}if(e){if(t)try{const n=JSON.parse(e);Object.keys(n).forEach((e=>{t.includes(e.toLocaleLowerCase())&&(n[e]="[REDACTED]")})),e=JSON.stringify(n)}catch(a){}if(n)try{const t=JSON.parse(e);Object.keys(t).forEach((e=>{n.includes(e.toLocaleLowerCase())||(t[e]="[REDACTED]")})),e=JSON.stringify(t)}catch(a){}}try{e=e.slice(0,l)}catch(a){}return e},ee=(e,t,n,o,r,i,s)=>{const l=window._fetchProxy;return window._fetchProxy=function(a,c){const{method:d,url:u}=te(a,c);if(!V(u,t,n))return l.call(this,a,c);const h=J();if($(u,n)){c=c||{};let e=new Headers(c.headers);a instanceof Request&&[...a.headers].forEach((([t,n])=>e.set(t,n))),e.set(z,G(r,h)),c.headers=Object.fromEntries(e.entries())}const p={id:h,headers:{},body:void 0,url:u,verb:d},g=!o.some((e=>u.toLowerCase().includes(e)));g&&(p.headers=Object.fromEntries(new Headers(null==c?void 0:c.headers).entries()),p.body=Z(null==c?void 0:c.body,i,s,null==c?void 0:c.headers));let f=l.call(this,a,c);return ne(f,p,e,g,i,s),f},()=>{window._fetchProxy=l}},te=(e,t)=>{const n=t&&t.method||"object"==typeof e&&"method"in e&&e.method||"GET";let o;return o="object"==typeof e?"url"in e&&e.url?e.url:e.toString():e,{method:n,url:o}},ne=(e,t,n,o,r,i)=>{e.then((e=>h(this,null,(function*(){let s={body:void 0,headers:void 0,status:0,size:0},l=!1;if("stack"in e||e instanceof Error)s=c(a({},s),{body:e.message,status:0,size:void 0}),l=!0;else if("status"in e){if(s=c(a({},s),{status:e.status}),o){let t;try{const n=e.clone().body;if(n){let o,s=n.getReader(),l=new TextDecoder,a="";for(;!(o=yield s.read()).done;){let e=o.value;a+=l.decode(e)}t=a,t=Z(t,r,i,e.headers)}else t=""}catch(d){t=`Unable to clone response: ${d}`}s.body=t,s.headers=Object.fromEntries(e.headers.entries()),s.size=8*t.length}l=!0}if(l){n({request:t,response:s,urlBlocked:!o})}})))).catch((()=>{}))},oe=({xhrCallback:e,fetchCallback:t,webSocketRequestCallback:n,webSocketEventCallback:o,disableWebSocketRecording:r,bodyKeysToRedact:i,backendUrl:s,tracingOrigins:l,urlBlocklist:a,sessionSecureID:c,bodyKeysToRecord:u})=>{const h=X(e,s,l,a,c,i,u),p=ee(t,s,l,a,c,i,u),g=r?()=>{}:((e,t,n)=>{const o=window._highlightWebSocketRequestCallback;window._highlightWebSocketRequestCallback=e;const r=window._highlightWebSocketEventCallback;return window._highlightWebSocketEventCallback=e=>{const o=e,{message:r,size:i}=o,s=d(o,["message","size"]),l=n.some((t=>e.name.toLowerCase().includes(t)));t(l?s:e)},()=>{window._highlightWebSocketRequestCallback=o,window._highlightWebSocketEventCallback=r}})(n,o,a);return()=>{h(),p(),g()}};class re{constructor(e){var t;u(this,"disableConsoleRecording"),u(this,"reportConsoleErrors"),u(this,"consoleMethodsToRecord"),u(this,"listeners"),u(this,"errors"),u(this,"messages"),u(this,"options"),u(this,"hasNetworkRecording",!0),u(this,"_backendUrl"),u(this,"disableNetworkRecording"),u(this,"enableRecordingNetworkContents"),u(this,"xhrNetworkContents"),u(this,"fetchNetworkContents"),u(this,"disableRecordingWebSocketContents"),u(this,"webSocketNetworkContents"),u(this,"webSocketEventContents"),u(this,"tracingOrigins"),u(this,"networkHeadersToRedact"),u(this,"networkBodyKeysToRedact"),u(this,"networkBodyKeysToRecord"),u(this,"networkHeaderKeysToRecord"),u(this,"urlBlocklist"),u(this,"requestResponseSanitizer"),this.options=e,this.disableConsoleRecording=!!e.disableConsoleRecording,this.reportConsoleErrors=null!=(t=e.reportConsoleErrors)&&t,this.consoleMethodsToRecord=e.consoleMethodsToRecord||[...D],this.listeners=[],this.errors=[],this.messages=[]}isListening(){return this.listeners.length>0}startListening(){if(this.isListening())return;const e=this;this.disableConsoleRecording||this.listeners.push(L((t=>{var n,o,r;if(this.reportConsoleErrors&&("Error"===t.type||"error"===t.type)&&t.value&&t.trace){const i=I(t.value);if(B.includes(i)||P.some((e=>i.includes(e))))return;e.errors.push({event:i,type:"console.error",url:window.location.href,source:(null==(n=t.trace[0])?void 0:n.fileName)?t.trace[0].fileName:"",lineNumber:(null==(o=t.trace[0])?void 0:o.lineNumber)?t.trace[0].lineNumber:0,columnNumber:(null==(r=t.trace[0])?void 0:r.columnNumber)?t.trace[0].columnNumber:0,stackTrace:t.trace,timestamp:(new Date).toISOString()})}e.messages.push(t)}),{level:this.consoleMethodsToRecord,logger:"console",stringifyOptions:{depthOfLimit:10,numOfKeysLimit:100,stringLengthLimit:1e3}})),this.listeners.push(j((t=>{B.includes(t.event)||P.some((e=>t.event.includes(e)))||e.errors.push(t)}))),re.setupNetworkListener(this,this.options)}stopListening(){this.listeners.forEach((e=>e())),this.listeners=[]}static setupNetworkListener(e,t){var n,o,r,i,s,l,a,c,d,u,h,p;e._backendUrl=(null==t?void 0:t.backendUrl)||"https://pub.highlight.run",e.xhrNetworkContents=[],e.fetchNetworkContents=[],e.webSocketNetworkContents=[],e.webSocketEventContents=[],e.networkHeadersToRedact=[],e.urlBlocklist=[],e.tracingOrigins=t.tracingOrigins||[],void 0!==(null==t?void 0:t.disableNetworkRecording)?(e.disableNetworkRecording=null==t?void 0:t.disableNetworkRecording,e.enableRecordingNetworkContents=!1,e.disableRecordingWebSocketContents=!0,e.networkHeadersToRedact=[],e.networkBodyKeysToRedact=[],e.urlBlocklist=[],e.networkBodyKeysToRecord=[],e.networkBodyKeysToRecord=[]):"boolean"==typeof(null==t?void 0:t.networkRecording)?(e.disableNetworkRecording=!t.networkRecording,e.enableRecordingNetworkContents=!1,e.disableRecordingWebSocketContents=!0,e.networkHeadersToRedact=[],e.networkBodyKeysToRedact=[],e.urlBlocklist=[]):(void 0!==(null==(n=t.networkRecording)?void 0:n.enabled)?e.disableNetworkRecording=!t.networkRecording.enabled:e.disableNetworkRecording=!1,e.enableRecordingNetworkContents=(null==(o=t.networkRecording)?void 0:o.recordHeadersAndBody)||!1,e.disableRecordingWebSocketContents=(null==(r=t.networkRecording)?void 0:r.disableWebSocketEventRecordings)||!1,e.networkHeadersToRedact=(null==(s=null==(i=t.networkRecording)?void 0:i.networkHeadersToRedact)?void 0:s.map((e=>e.toLowerCase())))||[],e.networkBodyKeysToRedact=(null==(a=null==(l=t.networkRecording)?void 0:l.networkBodyKeysToRedact)?void 0:a.map((e=>e.toLowerCase())))||[],e.urlBlocklist=(null==(d=null==(c=t.networkRecording)?void 0:c.urlBlocklist)?void 0:d.map((e=>e.toLowerCase())))||[],e.urlBlocklist=[...e.urlBlocklist,...W],e.requestResponseSanitizer=null==(u=t.networkRecording)?void 0:u.requestResponseSanitizer,e.networkHeaderKeysToRecord=null==(h=t.networkRecording)?void 0:h.headerKeysToRecord,e.networkHeaderKeysToRecord&&(e.networkHeadersToRedact=[],e.networkHeaderKeysToRecord=e.networkHeaderKeysToRecord.map((e=>e.toLocaleLowerCase()))),e.networkBodyKeysToRecord=null==(p=t.networkRecording)?void 0:p.bodyKeysToRecord,e.networkBodyKeysToRecord&&(e.networkBodyKeysToRedact=[],e.networkBodyKeysToRecord=e.networkBodyKeysToRecord.map((e=>e.toLocaleLowerCase())))),!e.disableNetworkRecording&&e.enableRecordingNetworkContents&&e.listeners.push(oe({xhrCallback:t=>{e.xhrNetworkContents.push(t)},fetchCallback:t=>{e.fetchNetworkContents.push(t)},webSocketRequestCallback:t=>{e.webSocketNetworkContents&&e.webSocketNetworkContents.push(t)},webSocketEventCallback:t=>{e.webSocketEventContents.push(t)},disableWebSocketRecording:e.disableRecordingWebSocketContents,bodyKeysToRedact:e.networkBodyKeysToRedact,backendUrl:e._backendUrl,tracingOrigins:e.tracingOrigins,urlBlocklist:e.urlBlocklist,sessionSecureID:t.sessionSecureID,bodyKeysToRecord:e.networkBodyKeysToRecord}))}static getRecordedNetworkResources(e,t){var n;let o=[],r=[];if(!e.disableNetworkRecording){const r=(null==(n=null==window?void 0:window.performance)?void 0:n.timeOrigin)||0;o=performance.getEntriesByType("resource");const i=2*(t-r);if(o=o.filter((t=>V(t.name,e._backendUrl,e.tracingOrigins))).map((e=>c(a({},e.toJSON()),{offsetStartTime:e.startTime-i,offsetResponseEnd:e.responseEnd-i,offsetFetchStart:e.fetchStart-i}))),e.enableRecordingNetworkContents){const t={headersToRedact:e.networkHeadersToRedact,headersToRecord:e.networkHeaderKeysToRecord,requestResponseSanitizer:e.requestResponseSanitizer};o=M(o,e.xhrNetworkContents,"xmlhttprequest",t),o=M(o,e.fetchNetworkContents,"fetch",t)}}return e.disableRecordingWebSocketContents||(r=e.webSocketNetworkContents||[]),[...o,...r]}static getRecordedWebSocketEvents(e){let t=[];return e.disableNetworkRecording||e.disableRecordingWebSocketContents||(t=e.webSocketEventContents),t}static clearRecordedNetworkResources(e){e.disableNetworkRecording||(e.xhrNetworkContents=[],e.fetchNetworkContents=[],e.webSocketNetworkContents=[],e.webSocketEventContents=[],performance.clearResourceTimings())}}const ie="8.2.0",se=()=>null;var le=(e=>(e.Device="Device",e.WebVital="WebVital",e.Frontend="Frontend",e.Backend="Backend",e))(le||{});const ae=(e,t)=>{console.warn(`highlight.run warning: (${e}): `,t)};let ce,de,ue,he=[],pe=!1;const ge={options:void 0,init:(e,t)=>{var n,o,r,i,s,l,d,u;try{if(ge.options=t,"undefined"==typeof window||"undefined"==typeof document)return;if(!e)return void console.info("Highlight is not initializing because projectID was passed undefined.");let w=(()=>{let e=JSON.parse(window.sessionStorage.getItem(g.SESSION_DATA)||"{}");if(e&&e.lastPushTime&&Date.now()-e.lastPushTime<55e3)return e})(),m=(()=>{var e;const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";var n="";const o="undefined"!=typeof window&&(null==(e=window.crypto)?void 0:e.getRandomValues),r=new Uint32Array(28);o&&window.crypto.getRandomValues(r);for(let i=0;i<28;i++)n+=t.charAt(o?r[i]%t.length:Math.floor(Math.random()*t.length));return n})();if(null==w?void 0:w.sessionSecureID)m=w.sessionSecureID;else{const t=c(a({},w),{projectID:+e,sessionSecureID:m});window.sessionStorage.setItem(g.SESSION_DATA,JSON.stringify(t))}if(pe)return{sessionSecureID:m};pe=!0;const v=(null==t?void 0:t.scriptUrl)?t.scriptUrl:"https://static.highlight.io/v8.2.0/index.js";let y=document.getElementById(v);if(y)return;const b={organizationID:e,debug:null==t?void 0:t.debug,backendUrl:null==t?void 0:t.backendUrl,tracingOrigins:null==t?void 0:t.tracingOrigins,disableNetworkRecording:null==t?void 0:t.disableNetworkRecording,networkRecording:null==t?void 0:t.networkRecording,disableBackgroundRecording:null==t?void 0:t.disableBackgroundRecording,disableConsoleRecording:null==t?void 0:t.disableConsoleRecording,disableSessionRecording:null==t?void 0:t.disableSessionRecording,reportConsoleErrors:null==t?void 0:t.reportConsoleErrors,consoleMethodsToRecord:null==t?void 0:t.consoleMethodsToRecord,enableSegmentIntegration:null==t?void 0:t.enableSegmentIntegration,privacySetting:null==t?void 0:t.privacySetting,enableCanvasRecording:null==t?void 0:t.enableCanvasRecording,enablePerformanceRecording:null==t?void 0:t.enablePerformanceRecording,samplingStrategy:null==t?void 0:t.samplingStrategy,inlineImages:null==t?void 0:t.inlineImages,inlineStylesheet:null==t?void 0:t.inlineStylesheet,recordCrossOriginIframe:null==t?void 0:t.recordCrossOriginIframe,firstloadVersion:ie,environment:(null==t?void 0:t.environment)||"production",appVersion:null==t?void 0:t.version,serviceName:null==t?void 0:t.serviceName,sessionShortcut:null==t?void 0:t.sessionShortcut,sessionSecureID:m,storageMode:null==t?void 0:t.storageMode};return ue=new re(b),(null==t?void 0:t.manualStart)||ue.startListening(),y=document.createElement("script"),y.id=v,y.type="text/javascript",y.defer=!0,document.getElementsByTagName("head")[0].appendChild(y),y.onload=()=>h(this,null,(function*(){de=new window.HighlightIO(b,ue),(null==t?void 0:t.manualStart)||(yield de.initialize())})),y.src=v,!(null==(o=null==(n=null==t?void 0:t.integrations)?void 0:n.mixpanel)?void 0:o.disabled)&&(null==(i=null==(r=null==t?void 0:t.integrations)?void 0:r.mixpanel)?void 0:i.projectToken)&&(({projectToken:e})=>{if(window.mixpanel)return;var t,n,o;document,(t=window.mixpanel||[]).__SV||(window.mixpanel=t,t._i=[],t.init=function(e,r,i){function s(e,t){var n=t.split(".");2==n.length&&(e=e[n[0]],t=n[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var l=t;for(void 0!==i?l=t[i]=[]:i="mixpanel",l.people=l.people||[],l.toString=function(e){var t="mixpanel";return"mixpanel"!==i&&(t+="."+i),e||(t+=" (stub)"),t},l.people.toString=function(){return l.toString(1)+".people (stub)"},n="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" "),o=0;o<n.length;o++)s(l,n[o]);var a="set set_once union unset remove delete".split(" ");l.get_group=function(){function e(e){t[e]=function(){call2_args=arguments,call2=[e].concat(Array.prototype.slice.call(call2_args,0)),l.push([n,call2])}}for(var t={},n=["get_group"].concat(Array.prototype.slice.call(arguments,0)),o=0;o<a.length;o++)e(a[o]);return t},t._i.push([e,r,i])},t.__SV=1.2);const r=document.createElement("script");r.src=f,document.head.appendChild(r),r.addEventListener("load",(()=>{var t;null==(t=window.mixpanel)||t.init(e)}))})(t.integrations.mixpanel),!(null==(l=null==(s=null==t?void 0:t.integrations)?void 0:s.amplitude)?void 0:l.disabled)&&(null==(u=null==(d=null==t?void 0:t.integrations)?void 0:d.amplitude)?void 0:u.apiKey)&&p(t.integrations.amplitude),{sessionSecureID:m}}catch(w){ae("init",w)}},snapshot:e=>h(this,null,(function*(){try{if(de&&de.ready)return yield de.snapshot(e)}catch(t){ae("snapshot",t)}})),addSessionFeedback:({verbatim:e,userName:t,userEmail:n,timestampOverride:o})=>{try{ge.onHighlightReady((()=>de.addSessionFeedback({verbatim:e,timestamp:o||(new Date).toISOString(),user_email:n,user_name:t})))}catch(r){ae("error",r)}},consumeError:(e,t,n)=>{try{ge.onHighlightReady((()=>de.consumeCustomError(e,t,JSON.stringify(n))))}catch(o){ae("error",o)}},error:(e,t)=>{try{ge.onHighlightReady((()=>de.pushCustomError(e,JSON.stringify(t))))}catch(n){ae("error",n)}},track:(e,t={})=>{var n,o,r,i,s,l,d,u,h,p,g;try{ge.onHighlightReady((()=>de.addProperties(c(a({},t),{event:e}))));const f=null==de?void 0:de.getCurrentSessionURL();(null==(r=null==(o=null==(n=ge.options)?void 0:n.integrations)?void 0:o.mixpanel)?void 0:r.disabled)||(null==(i=window.mixpanel)?void 0:i.track)&&window.mixpanel.track(e,c(a({},t),{highlightSessionURL:f})),(null==(d=null==(l=null==(s=ge.options)?void 0:s.integrations)?void 0:l.amplitude)?void 0:d.disabled)||(null==(u=window.amplitude)?void 0:u.getInstance)&&window.amplitude.getInstance().logEvent(e,c(a({},t),{highlightSessionURL:f})),(null==(g=null==(p=null==(h=ge.options)?void 0:h.integrations)?void 0:p.intercom)?void 0:g.disabled)||window.Intercom&&window.Intercom("trackEvent",e,t)}catch(f){ae("track",f)}},start:e=>{"Recording"===(null==de?void 0:de.state)?(null==e?void 0:e.silent)||console.warn("Highlight is already recording. Please `H.stop()` the current session before starting a new one."):(ue.startListening(),ge.onHighlightReady((()=>h(this,null,(function*(){yield de.initialize(e)}))),{waitForReady:!1}))},stop:e=>{"Recording"!==(null==de?void 0:de.state)?(null==e?void 0:e.silent)||console.warn("Highlight is already stopped. Please call `H.start()`."):ge.onHighlightReady((()=>de.stopRecording(!0)))},identify:(e,t={})=>{var n,o,r,i,s,l,a,c;try{ge.onHighlightReady((()=>de.identify(e,t)))}catch(d){ae("identify",d)}if((null==(r=null==(o=null==(n=ge.options)?void 0:n.integrations)?void 0:o.mixpanel)?void 0:r.disabled)||(null==(i=window.mixpanel)?void 0:i.identify)&&(window.mixpanel.identify("string"==typeof(null==t?void 0:t.email)?null==t?void 0:t.email:e),t&&(window.mixpanel.track("identify",t),window.mixpanel.people.set(t))),!(null==(a=null==(l=null==(s=ge.options)?void 0:s.integrations)?void 0:l.amplitude)?void 0:a.disabled)&&(null==(c=window.amplitude)?void 0:c.getInstance)&&(window.amplitude.getInstance().setUserId(e),Object.keys(t).length>0)){const e=Object.keys(t).reduce(((e,n)=>(e.set(n,t[n]),e)),new window.amplitude.Identify);window.amplitude.getInstance().identify(e)}},metrics:e=>{try{ge.onHighlightReady((()=>de.recordMetric(e.map((e=>c(a({},e),{category:"Frontend"}))))))}catch(t){ae("metrics",t)}},getSessionURL:()=>new Promise(((e,t)=>{ge.onHighlightReady((()=>{const n=de.getCurrentSessionURL();n?e(n):t(new Error("Unable to get session URL"))}))})),getSessionDetails:()=>new Promise(((e,t)=>{ge.onHighlightReady((()=>{const n=de.getCurrentSessionURL();if(n){const t=de.getCurrentSessionTimestamp(),o=(new Date).getTime(),r=new URL(n),i=new URL(n);i.searchParams.set("ts",((o-t)/1e3).toString()),e({url:r.toString(),urlWithTimestamp:i.toString()})}else t(new Error("Could not get session URL"))}))})),onHighlightReady:(e,t)=>h(this,null,(function*(){try{de&&(!1===(null==t?void 0:t.waitForReady)||de.ready)?yield e():(he.push({options:t,func:e}),void 0===ce&&(ce=setInterval((()=>h(this,null,(function*(){var e;const t=[];for(const n of he)de&&(!1===(null==(e=n.options)?void 0:e.waitForReady)||de.ready)?yield n.func():t.push(n);he=t,0==he.length&&(clearInterval(ce),ce=void 0)}))),.03)))}catch(n){ae("onHighlightReady",n)}}))};var fe,we;"undefined"!=typeof window&&(window.H=ge),"undefined"!=typeof chrome&&(null==(fe=null==chrome?void 0:chrome.runtime)?void 0:fe.onMessage)&&(null==(we=null==chrome?void 0:chrome.runtime)||we.onMessage.addListener(((e,t,n)=>{const o=e.action;switch(console.log(`[highlight] received '${o}' event from extension.`),o){case"init":{const e="http://localhost:8080/dist/index.js";console.log("url",e),ge.init(1,{debug:!0,scriptUrl:e}),ge.getSessionURL().then((e=>{n({url:e})}));break}case"stop":ge.stop(),n({success:!0})}return!0}))),(()=>{if("undefined"!=typeof window){if(void 0!==window._highlightFetchPatch)return;window._originalFetch=window.fetch,window._fetchProxy=(e,t)=>window._originalFetch(e,t),window._highlightFetchPatch=(e,t)=>window._fetchProxy.call(window||global,e,t),window.fetch=window._highlightFetchPatch}})(),(()=>{if("undefined"!=typeof window){if(void 0!==window._highlightWebSocketRequestCallback)return;window._highlightWebSocketRequestCallback=se,window._highlightWebSocketEventCallback=se;const e=new Proxy(window.WebSocket,{construct(e,t){const n=J(),o=new e(...t),r=e=>{window._highlightWebSocketRequestCallback({socketId:n,initiatorType:"websocket",type:"open",name:o.url,startTime:e.timeStamp})},i=e=>{window._highlightWebSocketRequestCallback({socketId:n,initiatorType:"websocket",type:"close",name:o.url,requestEnd:e.timeStamp}),o.removeEventListener("open",r),o.removeEventListener("error",l),o.removeEventListener("message",s),o.removeEventListener("close",i)},s=e=>{const{data:t}=e,r="string"==typeof t?e.data:void 0;let i;i="string"==typeof t?t.length:t instanceof Blob?t.size:t.byteLength||0,window._highlightWebSocketEventCallback({socketId:n,type:"received",name:o.url,timeStamp:e.timeStamp,size:i,message:r})},l=e=>{window._highlightWebSocketEventCallback({socketId:n,type:"error",name:o.url,timeStamp:e.timeStamp,size:0})};o.addEventListener("open",r),o.addEventListener("error",l),o.addEventListener("message",s),o.addEventListener("close",i);const a=new Proxy(o.send,{apply:function(e,t,r){const i=r[0],s="string"==typeof i?i:void 0;let l;l="string"==typeof i?i.length:i instanceof Blob?i.size:i.byteLength||0,window._highlightWebSocketEventCallback({socketId:n,type:"sent",name:o.url,timeStamp:performance.now(),size:l,message:s}),e.apply(t,r)}});return o.send=a,o}});window.WebSocket=e}})(),e.H=ge,e.HighlightSegmentMiddleware=({next:e,payload:t})=>{if("undefined"!=typeof window&&"undefined"!=typeof document&&"H"in window)if("track"===t.obj.type){const e=t.obj.event,n=t.obj.properties;window.H.track(e,n)}else if("identify"===t.obj.type){const e=t.obj.userId;if(null==e?void 0:e.length){const n=t.obj.traits;window.H.identify(e,n)}}e(t)},e.MetricCategory=le,e.configureElectronHighlight=function(e){var t;e.on&&(null==(t=e.webContents)?void 0:t.send)&&(e.on("focus",(()=>{e.webContents.send("highlight.run",{visible:!0})})),e.on("blur",(()=>{e.webContents.send("highlight.run",{visible:!1})})),e.on("close",(()=>{e.webContents.send("highlight.run",{visible:!1})})))},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})); |
{ | ||
"name": "highlight.run", | ||
"version": "8.1.0", | ||
"version": "8.2.0", | ||
"description": "Open source, fullstack monitoring. Capture frontend errors, record server side logs, and visualize what broke with session replay.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
268007
4304