zipy-for-rd
Version:
SDK for zipy
2 lines • 99.6 kB
JavaScript
var e=require("zipy-rrweb"),t=require("uuid"),n=require("fflate");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o,i,s,a=/*#__PURE__*/r(require("lz-string"));!function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.ReplayerEvent=11]="ReplayerEvent",e[e.ConsoleInfo=50]="ConsoleInfo",e[e.ConsoleError=51]="ConsoleError",e[e.ConsoleWarning=52]="ConsoleWarning",e[e.ConsoleDebug=53]="ConsoleDebug",e[e.Error=70]="Error",e[e.RangeError=71]="RangeError",e[e.ReferenceError=72]="ReferenceError",e[e.TypeError=73]="TypeError",e[e.SyntaxError=74]="SyntaxError",e[e.URIError=75]="URIError",e[e.EvalError=76]="EvalError",e[e.UnhandledRejection=77]="UnhandledRejection",e[e.BROWSERDATA=100]="BROWSERDATA",e[e.NAVIGATION=101]="NAVIGATION",e[e.Online=102]="Online",e[e.Offline=103]="Offline",e[e.XHR=104]="XHR",e[e.WSOPEN=105]="WSOPEN",e[e.WSCLOSE=106]="WSCLOSE",e[e.WSMESSAGE=107]="WSMESSAGE",e[e.WSERROR=108]="WSERROR",e[e.Fonts=109]="Fonts",e[e.Link=110]="Link",e[e.Css=111]="Css",e[e.Image=112]="Image",e[e.Js=113]="Js",e[e.Media=114]="Media",e[e.ZipyLogMessage=115]="ZipyLogMessage",e[e.ZipyLogException=116]="ZipyLogException",e[e.ZipyLogFrontendError=117]="ZipyLogFrontendError",e[e.ZipyLogNetworkError=118]="ZipyLogNetworkError",e[e.Performance=119]="Performance",e[e.PerfNavigation=120]="PerfNavigation",e[e.OtherNetworkCall=121]="OtherNetworkCall",e[e.WebVitals=122]="WebVitals",e[e.NavigationStart=123]="NavigationStart",e[e.DEBUG_INFO=124]="DEBUG_INFO",e[e.CustomEvent=125]="CustomEvent"}(o||(o={})),function(e){e[e.MESSAGESEND=0]="MESSAGESEND",e[e.MESSAGERECEIVED=1]="MESSAGERECEIVED",e[e.SOCKETCLOSE=2]="SOCKETCLOSE",e[e.SOCKETERROR=3]="SOCKETERROR",e[e.SOCKETOPEN=4]="SOCKETOPEN"}(i||(i={})),function(e){e[e.ELEMENT=0]="ELEMENT",e[e.EVENT=1]="EVENT",e[e.FIRST_INPUT=2]="FIRST_INPUT",e[e.LARGEST_CONTENTFUL_PAINT=3]="LARGEST_CONTENTFUL_PAINT",e[e.LAYOUT_SHIFT=4]="LAYOUT_SHIFT",e[e.LONGTASK=5]="LONGTASK",e[e.MARK=6]="MARK",e[e.MEASURE=7]="MEASURE",e[e.NAVIGATION=8]="NAVIGATION",e[e.PAINT=9]="PAINT",e[e.RESOURCE=10]="RESOURCE"}(s||(s={}));var c,u,d,l="zipy",f="rrweb";!function(e){e[e.POSTENDUSERINFOANDGETUSERCONFIG=0]="POSTENDUSERINFOANDGETUSERCONFIG",e[e.POSTENDUSERINFO=1]="POSTENDUSERINFO",e[e.GETUSERCONFIG=2]="GETUSERCONFIG"}(c||(c={})),function(e){e[e.ANONYMS=0]="ANONYMS",e[e.IDENTIFIED=1]="IDENTIFIED"}(u||(u={})),function(e){e[e.NORECORDING=0]="NORECORDING",e[e.RECORDINGPENDING=1]="RECORDINGPENDING",e[e.RECORDINGSUCCESSFUL=2]="RECORDINGSUCCESSFUL"}(d||(d={}));var p,v,g,m,y="logEvent",w="exceptionEvent",h="errorEvent",E=1024,S="startIframeRecording",I="stopIframeRecording",z="iframeContentLoaded";(m=p||(p={})).DEBUG="1",m.WARNING="2",m.ERROR="3",m.LOG="4",function(e){e[e.BLOCKING=0]="BLOCKING",e[e.NON_BLOCKING=1]="NON_BLOCKING"}(v||(v={})),function(e){e.session_data="_zsession-data",e.total_data_sent="_ztotal-data-sent",e.enduser_last_activity_time="_zenduser-last-activity-time",e.last_activity_time="_zlast-activity-time",e.utms="_utms"}(g||(g={}));var C,T=/^(?!-)[A-Za-z0-9-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,6}$/,k=/^(https?|ftp):\/\/(([a-z\d]([a-z\d-]*[a-z\d])?\.)+[a-z]{2,}|localhost)(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?$/i,b=499;!function(e){e[e.FCP=0]="FCP",e[e.FP=1]="FP",e[e.FID=2]="FID",e[e.CLS=3]="CLS",e[e.LCP=4]="LCP"}(C||(C={}));var N,R,O,P={"Content-Type":"application/json","Content-Encoding":"gzip"};!function(e){e.INIT="init",e.REINIT="reinit",e.PAGE_OUT="pageout"}(N||(N={})),function(e){e.PAGELOAD="pageload",e.VISIBLE="visibility visible",e.HIDDEN="visibility hidden",e.IDENTIFY="identify",e.ANONYMIZE="anonymize",e.STREAMDATARECORDINGPAUSE="streamdata recording paused",e.STREAMDATAEXPIRE="streamdata session expired",e.NA=""}(R||(R={})),function(e){e[e.IDLE=0]="IDLE",e[e.PENDING=1]="PENDING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED"}(O||(O={}));var D,U=["utm_source","utm_medium","utm_term","utm_content","utm_campaign"];!function(e){e[e.STOP=0]="STOP",e[e.START=1]="START"}(D||(D={}));var x={streamMgrUrl:"https://services.zipy.ai/sdk-session-manager/v2/enduser-info",registerSessionUrl:"https://services.zipy.ai/sdk-session-manager/v1/register-sdk-session",sdkVersion:"1.0.37",errorUrl:"divolte.collector",streamMgrRetryCount:5,zipyDeploymentEnviornment:"Production",sdkLoopTime:1e3,perfLoopTime:5e3,ignoreEmptyErros:!0,ignoreLargeResponse:!0,debugLogs:!1,sessionLinkUrl:"https://app.zipy.ai",isNPM:!0,streamMgrRetryDelay:5e3},L=!1;function A(e){L&&console.info(l,e)}function F(e){L&&console.debug(l,e)}function _(e){L&&console.log(l,e)}function M(e){L&&console.error(l,e)}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return q(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J.apply(null,arguments)}function B(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(B=function(){return!!e})()}function Z(e,t){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Z(e,t)}var j=new Map;function W(e){try{var t=window.localStorage.getItem(e);return A("inside zLocalStorageGetItem for key :"+e+" and value :"+t),!t&&(A("fetched value from hashmap :"+(t=j.get(e))),t)?(A("Going to update local storage:"),function(){try{A("inside localStorageUpdate function");for(var e,t=G(j.entries());!(e=t()).done;){var n=e.value;window.localStorage.getItem(n[0])||(A("Going inside localStorageUpdate-2 for key :"+n[0]+" and value :"+n[1]),H(n[0],n[1]))}}catch(e){M("inside updateLocalStorage catch block ${e.message}")}}(),t):t}catch(e){return void M("inside zLocalStorageGetItem catch block ${e.message}")}}function H(e,t){try{A("inside zLocalStorageSetItem for key :"+e+" and value :"+t),j.set(e,t),window.localStorage.setItem(e,t)}catch(e){M("inside zLocalStorageSetItem catch block ${e.message}")}}function V(e){try{A("inside zLocalStorageRemoveItem for key :"+e),j.delete(e),window.localStorage.removeItem(e)}catch(e){M("inside zLocalStorageSetItem catch block ${e.message}")}}var K=/*#__PURE__*/function(){function e(){this.sessionId="",this.isSessionExpired=!1,this.lastActivityTime=void 0,this.enduserLastActivityTime=void 0,this.sessionBlockInfo={isBlocked:!1,blockedEndTime:0,apiKey:""},this.apiKey="",this.isNewSession=!1,this.isCheckoutFlowTriggered=!1}return e.getInstance=function(){return this.instance||(this.instance=new e),this.instance},e}();function X(){var e=W("zsdk-config");if(e)try{return JSON.parse(e)}catch(e){return void M("Failed to parse sdk Config Data")}}function Y(e){if(e)try{A("Updating zsession-blocked-info"+JSON.stringify(e)),H("zsession-blocked-info",JSON.stringify(e))}catch(e){M("Failed to stringify zsession-blocked-info ")}}function $(e){var t=K.getInstance(),n={isBlocked:!1,blockedEndTime:0,apiKey:e};try{t.sessionBlockInfo=n,A("Updating zsession-blocked-info"+JSON.stringify(n)),H("zsession-blocked-info",JSON.stringify(n))}catch(e){M("Failed to stringify zsession-blocked-info ")}}function Q(){var e=W("zsession-blocked-info"),t=K.getInstance();if(e)try{var n=JSON.parse(e);return t.sessionBlockInfo=n,n}catch(e){return void M("Failed to parse zsession-blocked-info")}}function ee(){var e=W("zId");return e||(H("zId",e=_e()),e)}function te(){var e=W("zenduser-info");if(e)try{return JSON.parse(e)}catch(e){return void M("Failed to parse end user Info data")}}function ne(){var e=W("zenduser-info-temp");if(e)try{return JSON.parse(e)}catch(e){return void M("Failed to parse end user Info data")}}function re(e){ee(),te()||A("Creating new enduser-info"+JSON.stringify(e));try{A("Updating enduser-info"+JSON.stringify(e)),H("zenduser-info",JSON.stringify(e))}catch(e){M("Failed to stringify enduser-info ")}}function oe(e){ee(),te()||A("Creating new enduser-info-temp"+JSON.stringify(e));try{A("Updating enduser-info-temp"+JSON.stringify(e)),H("zenduser-info-temp",JSON.stringify(e))}catch(e){M("Failed to stringify enduser-info-temp ")}}function ie(){ne()?(A("Removing zenduser-info-temp"),V("zenduser-info-temp")):A("zenduser temp Data dosen't exists")}function se(){var e=te();return e?e.userType===u.IDENTIFIED:(A("zenduser-info doesn't exists"),!1)}function ae(e,t){e.euId=0,e.euZName="",e.isBlocked=!1,e.zAnonymsUserInfo={euId:0,euZName:"",zId:null!=t?t:""}}function ce(e,t){var n,r,o=ee();(null==e||null==(n=e.zAnonymsUserInfo)?void 0:n.zId)===o?(A("ZId match"),e.euId=e.zAnonymsUserInfo.euId,e.euZName=e.zAnonymsUserInfo.euZName):(A("ZId dosen't match Zid : "+o+" and Anonyms user Zid: "+(null==e||null==(r=e.zAnonymsUserInfo)?void 0:r.zId)),ae(e,o)),t?oe(e):re(e)}function ue(){if(ne())return A("Temp storage has some pending data to post"),!0;var e=te();if(!e)return A("zenduser Data dosen't exists"),!0;if(0===e.euId)return A("Euid value is 0, required to fetch data again"),!0;if(e.userType===u.ANONYMS){var t,n;if(null==e||null==(t=e.zExternalUserInfo)?void 0:t.externalId)return A("External User details exists, and userType is ANONYMS need to post data"),!0;var r=ee();if((null==(n=e.zAnonymsUserInfo)?void 0:n.zId)!==r)return A("ZId dosen't match Zid : "+r+" and Anonyms user Zid: "+e.zAnonymsUserInfo.zId),ae(e,r),re(e),!0;A("ZId match No need to update for anonyms user")}return!1}K.instance=void 0;var de=/*#__PURE__*/function(){function e(){this.rootDomain="",this.releaseVer="",this.recordOnlyIframe=!1,this.proxyURL="",this.rootDomain="",this.releaseVer="",this.recordOnlyIframe=!1,this.proxyURL=""}var t=e.prototype;return t.saveOptions=function(e){this.releaseVer=e.releaseVer?e.releaseVer:this.releaseVer,this.rootDomain=this.isValidRootDomain(e.rootDomain)?e.rootDomain:this.rootDomain,this.recordOnlyIframe="boolean"==typeof e.recordOnlyIframe?e.recordOnlyIframe:this.recordOnlyIframe,this.proxyURL=this.isValidProxyURL(e.proxyURL)?e.proxyURL:this.proxyURL},t.isValidRootDomain=function(e){return!(!e||!new RegExp(T).test(e))},t.isValidProxyURL=function(e){return!(!e||!new RegExp(k).test(e))},e.getInstance=function(){return this.instance||(this.instance=new e),this.instance},e}();function le(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}de.instance=void 0;var fe=function e(t,n,r){try{return Promise.resolve(le(function(){var o=je(),i=de.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:qe(o.customEventUrl,i.proxyURL,P),body:JSON.stringify(n)})).then(function(o){return o.ok?(F("Response status = "+o.status),!0):(F("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(M("Not able to send data after all retries"),!1))})},function(e){return M("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},pe=function e(t,n,r,o,i){void 0===n&&(n=5),void 0===i&&(i={});try{return Promise.resolve(le(function(){var s=de.getInstance(),a=new URL(t),c=new URL((s.proxyURL?s.proxyURL:a.origin)+a.pathname);return null!=r&&Object.keys(r).forEach(function(e){return c.searchParams.append(e,r[e])}),Promise.resolve(fetch(c.href,{method:"POST",headers:qe(a.origin,s.proxyURL,{"Content-Type":"application/json"}),body:JSON.stringify(o)})).then(function(s){return s.ok?(F("postDataOnServer :: Response status = "+s.status),Promise.resolve(s.json()).then(function(e){return F("postDataOnServer :: Response JSON = "+e),e})):404==s.status?(H("is-api-key-valid","false"),Se(!1),!1):(F("Error :: Response status = "+s.status),n>0?void setTimeout(function(){return he+=x.streamMgrRetryDelay,e(t,n-1,r,o,i)},he):(M("Not able to post enduser config after multiple retries"),!1))})},function(e){return M("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},ve=function e(t,n,r){try{return Promise.resolve(le(function(){var o=je(),i=de.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:qe(o.pagePerfUrl,i.proxyURL,P),body:JSON.stringify(n)})).then(function(o){return o.ok?(F("Response status = "+o.status),!0):(F("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(M("Not able to send data after all retries"),!1))})},function(e){return M("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},ge=function e(t,n,r){try{return Promise.resolve(le(function(){var o=je(),i=de.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:qe(o.heatMapUrl,i.proxyURL,P),body:JSON.stringify(n)})).then(function(o){return o.ok?(F("Response status = "+o.status),!0):(F("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(M("Not able to send data after all retries"),!1))})},function(e){return M("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},me=function e(t,n,r){try{return Promise.resolve(le(function(){var o=je(),i=de.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:qe(o.perfUrl,i.proxyURL,P),body:JSON.stringify(n)})).then(function(o){return o.ok?(F("Response status = "+o.status),!0):(F("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(M("Not able to send data after all retries"),!1))})},function(e){return M("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},ye=function t(n){var r=n.divolteUrl,o=n.divolteJson,i=n.failureRetryCount;try{return Promise.resolve(le(function(){var n=JSON.stringify(o),s=je(),a=de.getInstance();return Promise.resolve(fetch(r,{method:"POST",headers:qe(s.streamUrl,a.proxyURL,P),body:n})).then(function(s){return je()&&je().splitSessionSize>0&&(_("Request size "+(new TextEncoder).encode(n).byteLength),function(t){try{var n=JSON.parse(t).events,r=Ot(n),o=K.getInstance(),i=W("ztotal-data-sent")?W("ztotal-data-sent"):"0",s=parseInt(i)+r;_("Current data size "+i),_("Merged data size "+s);var a=!0;o.isCheckoutFlowTriggered?a=!function(e){for(var t,n=K.getInstance(),r=0,o=e.length-1;r<o;){if(!0===e[r].isCheckout){t=r,n.isCheckoutFlowTriggered=!1;break}if(!0===e[o].isCheckout){t=o,n.isCheckoutFlowTriggered=!1;break}r++,o--}return t>=0&&(H("ztotal-data-sent",Ot(e.slice(t,e.length)).toString()),!0)}(n):s>je().splitSessionSize&&!o.isCheckoutFlowTriggered&&function(){try{_("Trigger checkout flow triggered"),e.record.takeFullSnapshot(!0)}catch(e){M("Error in checking full snapshot. Error is - "+e.message)}}(),a&&H("ztotal-data-sent",JSON.stringify(s))}catch(e){M("Error in checking data size. Error is - "+e.message)}}(o.parameters.eventData)),s.ok?(F("Response status = "+s.status),!0):(F("Error :: Response status = "+s.status),i>0?t({divolteUrl:r,divolteJson:o,failureRetryCount:i-1}):(M("Not able to send data after all retries"),!1))})},function(e){return M("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},we=!0,he=x.streamMgrRetryDelay;function Ee(){return we}function Se(e){we=e}function Ie(){var e=W("session-data");if(e)try{return JSON.parse(e)}catch(e){return void M("Failed to parse session data")}}function ze(e){var t=K.getInstance();if(t.isSessionExpired)return F("Session is already expired"),!0;var n=(Ie()||{}).sessionId,r=Number(W("last-activity-time"));return!n||r+e.sessionTimeout<=Date.now()?(A("Session is expired"),t.isSessionExpired=!0,!0):!function(e){var t=Ce();return!(!t||t+e.sessionTimeout<=Date.now())}(e)&&(t.isSessionExpired=!0,!0)}function Ce(){try{var e=K.getInstance().enduserLastActivityTime;if(!e){if(!(e=Number(W("zenduser-last-activity-time"))))return 0;e=Number(e)}return e}catch(e){return M("inside getZendUserActivityTime catch block"),0}}function Te(){var e=W("pack");if(!e){var t=je();H("pack",e=t.pack?t.pack.toString():(!1).toString())}return"true"===e}function ke(e){$(e),H("ztotal-data-sent","0"),V("zUTMParams"),V("session-data"),De(e+g.utms)}function be(e){var t=K.getInstance(),n=W("zId");n||H("zId",n=_e());var r=_e(),o="0:"+_e().replace("-",":");ke(e);var i={sessionId:r,dSession:o,isNewSession:!0,sdkKey:e};H("is-api-key-valid","true"),Se(!0);try{A("Created new Session"+JSON.stringify(i)),t.sessionId=i.sessionId,t.apiKey=i.sdkKey,t.isNewSession=i.isNewSession,t.isSessionExpired=!1,t.lastActivityTime=Date.now(),t.enduserLastActivityTime=Date.now(),t.isCheckoutFlowTriggered=!1,window.buffered=!1,H("last-activity-time",t.lastActivityTime.toString()),H("zenduser-last-activity-time",t.enduserLastActivityTime.toString()),H("session-data",JSON.stringify(i))}catch(e){M("Failed to stringify session data")}}function Ne(e){var t=Ie();return!!t&&e!==(null==t?void 0:t.sdkKey)&&(A("Sdk key is chnaged going to create session data"),!0)}function Re(){window.zEventsPerfData=[],window.zClickEventsData=[],window.zFetchTempData=[],window.zEventsData=[],window.zCustomEventData=[],window.zPagePerfData=[]}var Oe=function(e){try{var t,n,r=document.cookie,o=null==r?void 0:r.split(";"),i=!1;return o.forEach(function(r){var o=r.split("=");if(o[0].trim()===e){var s=o[1].split(",");s.length>1?(n=Ue(s),i=!0):t=o[1]?o[1]:""}}),i?n:t}catch(e){return void M("inside zGetCookie catch block")}},Pe=function(e,t){var n=de.getInstance(),r=new Date((new Date).valueOf()+216e5).toUTCString();document.cookie=e+"="+t+"; path=/; domain="+n.rootDomain+"; expires="+r+";"},De=function(e){var t=de.getInstance(),n=new Date((new Date).valueOf()-1e3).toUTCString();document.cookie=e+'=""; path=/; domain='+t.rootDomain+"; expires="+n+";"},Ue=function(e){var t={};return e.forEach(function(e){var n=e.split("#");t[n[0]]=n[1]?n[1]:""}),t||{}},xe=function(e){var t=Oe(e+g.enduser_last_activity_time),n=Oe(e+g.total_data_sent)?Oe(e+g.total_data_sent):"0",r=Oe(e+g.session_data),o=Oe(e+g.last_activity_time),i=K.getInstance();try{if(o){(t||r||o)&&(i.isSessionExpired=!1);var s="0:"+_e().replace("-",":");H("ztotal-data-sent",n),H("last-activity-time",o),H("zenduser-last-activity-time",t),i.enduserLastActivityTime=t,i.lastActivityTime=o;var a=te()||{},c=Q()||{},u=Ie()||{};a.isBlocked="true"===(null==r?void 0:r.isBlocked),a.euId=Number(null==r?void 0:r.euId),a.zAnonymsUserInfo.zId=(null==r?void 0:r.zId)||"",se()||(a.zExternalUserInfo.externalId=(null==r?void 0:r.externalId)||""),c.isBlocked="true"===(null==r?void 0:r.isBlocked),u.dSession=s,u.sessionId=(null==r?void 0:r.sessionId)||"",u.sdkKey=(null==r?void 0:r.sdkKey)||"",H("zId",(null==r?void 0:r.zId)||""),Y(c),H("zenduser-info",JSON.stringify(a)),H("zenduser-info-temp",JSON.stringify(a)),H("session-data",JSON.stringify(u))}}catch(e){return void M("inside zSetLocalStorageDataFromCookie catch block")}},Le=function(e){var t=function(){try{var e=te(),t=Q(),n=Ie()||{},r=W("zId"),o=W("last-activity-time"),i=W("ztotal-data-sent")?W("ztotal-data-sent"):"0",s=W("zenduser-last-activity-time");return{sessionId:null==n?void 0:n.sessionId,zId:r,euId:null==e?void 0:e.euId,isBlocked:null==t?void 0:t.isBlocked,sdkKey:null==n?void 0:n.sdkKey,lastActivityTime:o,totalDataSent:i,endUserLastActivityTime:s,externalId:(null==e?void 0:e.zExternalUserInfo.externalId)||""}}catch(e){return void M("inside zGetCookieDatafromLocalStorage catch block")}}();try{var n="sessionId#"+t.sessionId+",isBlocked#"+t.isBlocked+",sdkKey#"+e+",zId#"+t.zId+",euId#"+Number(t.euId)+",externalId#"+t.externalId;Pe(e+g.session_data,n),Pe(e+g.last_activity_time,t.lastActivityTime),Pe(e+g.enduser_last_activity_time,t.endUserLastActivityTime),Pe(e+g.total_data_sent,t.totalDataSent)}catch(e){return void M("inside zSetCookieDataFromLocalStorage catch block")}};function Ae(){return Date.now()}function Fe(e,t,n){var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}function _e(){var e=Math.floor(Date.now()/1e3);return t.v4()+"-"+e}function Me(e){var t={externalId:"enduser_external_id",firstName:"eu_first_name",lastName:"eu_last_name",email:"eu_email",age:"eu_age",customerName:"eu_customer_name",avatar:"eu_avatar",phone:"eu_phone"};return e in t?t[e]:e}function qe(e,t,n){var r=e.split("//")[1];return t&&(n["X-host"]=r),n}var Ge,Je={attributes:!0,childList:!0,characterData:!0,subtree:!0};!function(e){e[e.Progress=0]="Progress",e[e.Completed=1]="Completed",e[e.Failed=2]="Failed"}(Ge||(Ge={}));var Be={domCapture:!0,consoleCapture:!0,networkCapture:!0,stackTraceCapture:!0,webSocketsCapture:!1,ipCapture:!0,inputMasking:!0,textMasking:!1,paid:!1,apiKey:"",streamUrl:"https://collector.zipy.ai",perfUrl:"https://perfcollector.zipy.ai",heatMapUrl:"https://heatmapcollector.zipy.ai",pagePerfUrl:"https://pageperfcollector.zipy.ai",customEventUrl:"https://customeventcollector.zipy.ai",maxBufferSize:5e6,compression:!0,compressionType:"gzip",timeFrequency:1e3,perfTimeFrequency:5e3,clickTimeFrequency:1e3,encodingType:"",sessionTimeout:18e5,failureRetryCount:5,bufferSizeFrequency:1048576,perfBufferSizeFrequency:1024,clickBufferSizeFrequency:1024,ignoreUrl:["google.com","zipy.ai","mixpanel","extreme-ip-lookup.com","hotjar","smartlook.com","newrelic.com","bugsnag","fullstory","sentry.io","google-analytics.com","bam.nr-data.net","wistia.com","amplitude.com","segment.io","pendo.io","raygun","smartlook.cloud","segment.com","visualstudio.com","stats.g.doubleclick.net","pagead2.googlesyndication.com","r.lr-in.com","clarity.ms","appcues.net","datadoghq.com"],ignoreError:["rrweb","zipy","Script error","pagead2.googlesyndication.com","adsbygoogle"],ignoreConsole:["{}"],isIgnoreUrlError:["google.com","zipy.ai","mixpanel","extreme-ip-lookup.com","hotjar","smartlook.com","newrelic.com","bugsnag","fullstory","sentry.io","google-analytics.com","bam.nr-data.net","wistia.com","amplitude.com","segment.io","pendo.io","raygun","smartlook.cloud","segment.com","visualstudio.com","stats.g.doubleclick.net","pagead2.googlesyndication.com","r.lr-in.com","clarity.ms","appcues.net","datadoghq.com"],isIgnoreConsoleError:["{}"],ip:"",pack:!0,blockClasses:"zipy-block",xhrReqPayloadCapture:!1,xhrRespPayloadCapture:!1,canvasCapture:!1,scrubbingKey:["password","secret","passwd","api_key","apikey","access_token","auth","credentials","mysql_pwd","stripetoken","cardnumber"],requestCapSize:1e6,responseCapSize:1e6,sizeExceededMessage:{message:"size too large",source:"zipy"},eventCountCapInSingleChunk:0,captureCustomZipyLogMessage:!1,captureCustomZipyLogError:!1,captureCustomZipyLogException:!1,startCaptureWithoutUserActivity:!1,consoleLogLevel:"3",recordCrossOriginIframes:!0,splitSessionSize:0,capturePerformance:!1,capturePagePerf:!1,captureClickEvents:!1,captureCustomEvents:!1,isApiIdentifierEnable:!1,apiUniqueIdentifier:[],ignoreUrlErrorCodes:{},ignoreUrlCodes:{},sessionStitching:!1,captureCancelledRequest:!1,clsEventCount:5,clsTimeout:3e4,xhrEventsTimeout:3e4,blockSelector:"",maxCustomEventProperties:10,maxCustomEventPayloadSize:524288,sanitizePayloadResponse:!0,captureUTM:!1};function Ze(e){return J({},e,{timestamp:Ae()})}function je(){try{return window.sdkConfig?window.sdkConfig:Be}catch(e){return M("Failed to parse end user Info data"),Be}}function We(e){try{var t=je();return t&&t.hasOwnProperty&&t.hasOwnProperty(e)?t[e]:null}catch(e){return M(e.message?JSON.stringify(e):e),null}}var He=function(e,t,n){return e&&e.constructor===String&&n.indexOf(e)===t},Ve=function(e){return e&&e.constructor===String&&e.trim()};function Ke(){var e=We("headersToSanitize");return e&&e.length?e.split(","):[]}function Xe(e){if(!Array.isArray(e))return[];for(var t,n=[],r=G(e);!(t=r()).done;){var o=t.value;try{o&&"object"==typeof o&&JSON.stringify(o)?o.constructor.name.toLowerCase().includes("error")?n.push({message:o.message,name:o.name,stack:o.stack}):n.push(o):n.push(String(o))}catch(e){n.push("[console log value cannot be serialized]")}}return n}var Ye=[];try{Ye=We("scrubbingKey")||[]}catch(e){M("Error in obtaining scrubbing keys"),Ye=Be.scrubbingKey}function $e(e){try{var t=new URL(e);if(e){var n=new URLSearchParams(new URL(e).search);n.forEach(function(e,t){Ye.includes(t.toLowerCase())&&n.set(t,"xxx")}),t.search=n.toString()}return t.toString()}catch(t){return M("updateQueryStringFromRequestUrl: ERROR WHILE HIDING QUERY PARAM VALUE: "+t),e}}function Qe(e,t,n){n++;try{e&&"object"==typeof e&&n<=2&&Object.keys(e).forEach(function(r){Ye.includes(r.toLowerCase())&&(e[r]="xxx"),t.push(r);var o=e[r];"object"==typeof o&&Qe(o,t,n)})}catch(e){M("error while hiding the sensitive information: "+e)}return JSON.stringify(e)}function et(e,t,n,r){var o=r?e.request:e.response,i=We(r?"xhrReqPayloadCapture":"xhrRespPayloadCapture"),s=function(t){try{r?(e.request=t,""!=e.request&&(e.requestByteSize=n)):(e.response=t,""!=e.response&&(e.responseByteSize=n))}catch(e){M("error while converting xhr data to string"+e)}};if(i){var a=We("responseCapSize")||1e6,c=We("requestCapSize")||1e6,u=r?c:a,d=We("sizeExceededMessage"),l=We("sanitizePayloadResponse");"string"==typeof o&&o.length>0?(n=n||o.length)<=u?l&&function(){try{s(Qe(JSON.parse(o),[],t))}catch(t){var e=Ye.some(function(e){return o.indexOf(e)>=0});s(o=r?e?"No request payload captured for this request as you may have some sensitive information in the payload.":o:e?"No response captured for this request as you may have some sensitive information in the payload.":o)}}():n>0&&s(JSON.stringify(d)):"object"==typeof o?(n=n||JSON.stringify(o,null,4).length)<=u?l&&s(Qe(o,[],t)):n>0&&s(d):o&&o.length>0&&((n=n||o.length)<=u?l&&s(Qe(o,[],t)):n>0&&s(JSON.stringify(d)))}else r?e.request="":e.response="";return e}function tt(e){if(!e)return!1;var t=e.toLowerCase(),n=We("ignoreError")||[];try{if(n.some(function(e){return t.includes(e.toLowerCase())}))return F("Ignoring error for data: "+e),!0}catch(e){M("Error in ignore errors. Error - "+e.message)}return!1}function nt(){try{return window.self!==window.top}catch(e){return!0}}function rt(e,t){if(e&&null!=e)try{var n="";n="string"!=typeof e?JSON.stringify(e):e;for(var r=o.RangeError;r<=o.EvalError;r++)if(-1!=n.search(o[r]))return r}catch(e){M(e)}return t}function ot(e){switch(e){case"link":case"css":return o.Link;case"img":case"image":return o.Image;case"script":return o.Js;case"fetch":case"beacon":case"xmlhttprequest":return o.XHR;case"other":return o.OtherNetworkCall;default:return 0}}var it=["img","script","css","link","image","script"];function st(e,t,n){try{var r=We("isIgnoreUrlError"),o=We("ignoreUrl"),i=We("ignoreUrlErrorCodes"),s=We("ignoreUrlCodes"),a=[],c={};n?(a=r,c=i||{}):(a=o,c=s||{});var u=function(e,n){return!!e.includes(n.toLowerCase())&&function(e){return!c.hasOwnProperty(e)||c[e].includes(t)}(n)},d=e.toLowerCase(),l=ct(d),f=d.indexOf("?"),p=d,v=l;return f>0&&(p=p.substring(0,f),v=ct(p)),a.some(function(e){return e.includes("?")?e.includes("{id}")?u(l,e):u(d,e):e.includes("{id}")?u(v,e):u(p,e)})}catch(t){M("Error in url decoding for url : "+e+" Error is - "+t)}return!1}function at(e){return{initiatorType:e.initiatorType,nextHopProtocol:e.nextHopProtocol,workerStart:e.workerStart,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,connectEnd:e.connectEnd,secureConnectionStart:e.secureConnectionStart,requestStart:e.requestStart,responseStart:e.responseStart,responseEnd:e.responseEnd,transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,responseStatus:e.responseStatus,renderBlockingStatus:e.renderBlockingStatus,duration:e.duration,entryType:e.entryType,name:e.name,startTime:e.startTime}}function ct(e){try{var t=e.match(/\/\d+\//g);if(t)for(var n,r=G(t);!(n=r()).done;)e=e.replace(n.value,"/{id}/")}catch(e){M("Error while masking numeric value.")}return e}function ut(e,t){if(!(e.indexOf("http://")>-1||e.indexOf("https://")>-1)){var n=new URL(t);return n.pathname+n.search===e}return!1}function dt(){var e=window.navigator.userAgent;return/Mobi|Android/i.test(e)?"Mobile":/Tablet|iPad/i.test(e)?"Tablet":"Web"}function lt(e){if("online"!=(navigator.onLine?"online":"offline")){if(!window.iszInternetDisconnected)return window.iszInternetDisconnected=!0,F("handleConnectionChange :: send internet disconnected"),e(Ze({eventType:o.Offline,data:{status:"Offline",type:""},isError:!1}))}else var t=setInterval(function(){fetch("//google.com",{mode:"no-cors"}).then(function(){return window.iszInternetDisconnected&&(window.iszInternetDisconnected=!1,F("handleConnectionChange :: send internet connected"),e(Ze({eventType:o.Online,data:{status:"Online",type:""},isError:!1}))),clearInterval(t)}).catch(function(){window.iszInternetDisconnected||(window.iszInternetDisconnected=!0,F("handleConnectionChange :: send internet disconnected"),e(Ze({eventType:o.Offline,data:{status:"Offline",type:""},isError:!1})))})},5e3)}var ft,pt=function(e){try{var t,n=function(n,r){try{var o="string"==typeof e.data.response?(t=1,e):"xmlHttpClient"===e.data.sourceLibrary&&"Blob"===(null==(i=e.data.response)||null==(i=i.constructor)?void 0:i.name)?Promise.resolve(new Response(e.data.response).text()).then(function(t){e.data.response=t}):function(){if("fetch"===e.data.sourceLibrary&&e.data.response instanceof Promise)return Promise.resolve(e.data.response).then(function(t){e.data.response=t});throw new Error("Unsupported response type: "+typeof e.data.response)}()}catch(e){return r(e)}var i;return o&&o.then?o.then(void 0,r):o}(0,function(t){M("Error in resolving response. Error is - "+t.message),e.data.response=""});return Promise.resolve(n&&n.then?n.then(function(n){return t?n:e}):t?n:e)}catch(e){return Promise.reject(e)}};function vt(e){try{return window.sessionStorage.getItem(e)||""}catch(e){return M("inside zSessionStorageGetItem catch block "+e.message),""}}function gt(e,t){try{window.sessionStorage.setItem(e,t)}catch(e){console.error("inside zSessionStorageSetItem catch block "+e.message)}}var mt=/*#__PURE__*/function(){function e(){this.dataSync=void 0,this.sdkTimer=void 0,this.dataSync=O.IDLE,this.sdkTimer=D.START}return e.prototype.isDataProcessingDone=function(){var e=this;return new Promise(function(t,n){var r=setInterval(function(){e.dataSync!==O.PENDING&&(t(!0),clearInterval(r))},1)})},e.getInstance=function(){return this.instance||(this.instance=new e),this.instance},e}();mt.instance=void 0;var yt=function(e,t,n){void 0===t&&(t=0);try{var r={v:x.sdkVersion,e:"Production",o:t,ns:n};if(t==c.POSTENDUSERINFOANDGETUSERCONFIG||t==c.GETUSERCONFIG){var o=X();window.sdkConfig=o||Be}var i=Q(),s=K.getInstance();if(i&&i.isBlocked)return A("Not going to call post end user info as session is already blocked"),Promise.resolve(window.sdkConfig);window.iszHandshakeDone=!1,window.zpendingOp=t,F("config.sdkversion"+x.sdkVersion);var a=ne()||{zAnonymsUserInfo:{}},d={},l=u.ANONYMS;if(a){var f,p=a.zExternalUserInfo||{};for(var v in p)d[Me(v)]=p[v]?p[v]:"";d.enduser_zipy_id=null==(f=a.zAnonymsUserInfo)?void 0:f.zId,p.externalId&&(A("Get User info for user Type Identified "+p.externalId),l=u.IDENTIFIED)}return window.ztryForHandshake=!1,Promise.resolve(pe(x.streamMgrUrl+"/"+e,x.streamMgrRetryCount,r,d)).then(function(n){if(n)if((null==n?void 0:n.api_key)==e){var r=Q(),o=Ie()||{},i=!(null==n||!n.is_blocked)&&(null==n?void 0:n.is_blocked);if(s.sessionId=o.sessionId,s.apiKey=o.sdkKey,s.isNewSession=o.isNewSession,s.isSessionExpired=!1,s.lastActivityTime=Date.now(),s.enduserLastActivityTime=Date.now(),s.sessionBlockInfo=r,r&&(r.isBlocked||function(e,t){var n,r=(null==e?void 0:e.blocked_till)>0?null==e?void 0:e.blocked_till:0,o=r>0?Ae()+r:0,i=!(null==e||!e.is_blocked)&&(null==e?void 0:e.is_blocked);K.getInstance().sessionBlockInfo=n={isBlocked:i,apiKey:t,blockedEndTime:o},Y(n)}(n,e)),i)return window.sdkConfig;if(t==c.POSTENDUSERINFOANDGETUSERCONFIG||t==c.GETUSERCONFIG){var d=bt(n);window.iszHandshakeDone=!0,A("sdkConfigResp"+JSON.stringify(d)),d&&(window.sdkConfig=d)}if(t==c.POSTENDUSERINFOANDGETUSERCONFIG||t==c.POSTENDUSERINFO){var f=n.enduser_info||{};A("Response object received for End User from stream manager: "+JSON.stringify(f)),f&&(A("Going to add enduser info after data parsing"),a.userType=l,a.euId=f.id?f.id:0,a.euZName=f.zipy_eu_name?f.zipy_eu_name:"",a.isBlocked=!!f.is_blocked&&f.is_blocked,l==u.ANONYMS&&(a.zAnonymsUserInfo.euId=a.euId,a.zAnonymsUserInfo.euZName=a.euZName,a.zExternalUserInfo={}),re(a),ie())}}else M("Not able to get response from stream manager for sdk Key: "+e);else M("Not able to get response from stream manager ");return window.sdkConfig})}catch(e){return Promise.reject(e)}},wt=function(e){try{var t,n=je(),r=window.zCustomEventData||[],i=de.getInstance(),s="";try{s=JSON.stringify(r)}catch(e){M("Failed to stringify zEvents")}var a=r.length,c=function(){if(2*s.length>=n.bufferSizeFrequency||window.customEventLastSynctime+n.timeFrequency<=Date.now()&&a>0){var c=r.slice(0,a),u=Ie()||{},d={key:e,s_id:u.sessionId,events:c,eventType:o.CustomEvent},l=(i.proxyURL?i.proxyURL:n.customEventUrl)+"/customevent";return Ee()?(window.isDataSyncInProgress=!0,Promise.resolve(fe(l,d,n.failureRetryCount)).then(function(e){if(e)return window.customEventLastSynctime=Date.now(),function(e){window.zCustomEventData&&Array.isArray(window.zCustomEventData)?window.zCustomEventData.splice(0,e):window.zCustomEventData=[]}(a),window.isDataSyncInProgress=!1,t=!0;window.isDataSyncInProgress=!1})):(t=1,!1)}}();return Promise.resolve(c&&c.then?c.then(function(e){return!t||e}):!t||c)}catch(e){return Promise.reject(e)}},ht=function(e){try{var t,n=je(),r=window.zPagePerfData||[],i="",s=de.getInstance();try{i=JSON.stringify(r)}catch(e){M("Failed to stringify zEvents")}var a=r.length,c=function(){if(2*i.length>=n.perfBufferSizeFrequency||window.pagePerfLastSynctime+n.perfTimeFrequency<=Date.now()&&a>0){var c,u,d=r.slice(0,a),l=Ie()||{},f=te()||{},p=W("zId"),v=null!=(c=f.zExternalUserInfo)&&c.externalId?null==(u=f.zExternalUserInfo)?void 0:u.externalId:"",g=/\((.*)\)/.exec((new Date).toString())[1],m=Te(),y={key:e,sdk_ver:x.sdkVersion,src:"Frontend",s_id:l.sessionId,euz_id:p,eue_id:v,events:d,eu_info_id:f.euId,rel_ver:window.zRelVer,handshake_status:window.iszHandshakeDone,ip:n.ip,deviceName:dt()||"",userAgent:window.navigator.userAgent,timeZone:g,eventType:o.WebVitals,pack:m},w=(s.proxyURL?s.proxyURL:n.pagePerfUrl)+"/pageperf";return Ee()?(window.isDataSyncInProgress=!0,Promise.resolve(ve(w,y,n.failureRetryCount)).then(function(e){if(e)return window.pagePerfLastSynctime=Date.now(),function(e){window.zPagePerfData&&Array.isArray(window.zPagePerfData)?window.zPagePerfData.splice(0,e):window.zPagePerfData=[]}(a),window.isDataSyncInProgress=!1,t=!0;window.isDataSyncInProgress=!1})):(t=1,!1)}}();return Promise.resolve(c&&c.then?c.then(function(e){return!t||e}):!t||c)}catch(e){return Promise.reject(e)}},Et=function(t){try{var n,r=je(),o=window.zClickEventsData||[],i=de.getInstance(),s="";try{s=JSON.stringify(o)}catch(e){M("Failed to stringify zEvents")}var a=o.length,c=function(){if(2*s.length>=r.bufferSizeFrequency||window.clickLastSyncTime+r.timeFrequency<=Date.now()&&a>0){var c,u,d=o.slice(0,a),l=Ie()||{},f=te()||{},p=W("zId"),v=null!=(c=f.zExternalUserInfo)&&c.externalId?null==(u=f.zExternalUserInfo)?void 0:u.externalId:"",g=/\((.*)\)/.exec((new Date).toString())[1],m=Te(),y={key:t,sdk_ver:x.sdkVersion,src:"Frontend",s_id:l.sessionId,euz_id:p,eue_id:v,events:d,eu_info_id:f.euId,rel_ver:i.releaseVer,handshake_status:window.iszHandshakeDone,ip:r.ip,deviceName:dt()||"",userAgent:window.navigator.userAgent,timeZone:g,eventType:e.MouseInteractions.Click,pack:m},w=(i.proxyURL?i.proxyURL:r.heatMapUrl)+"/heatmap";return Ee()?(window.isDataSyncInProgress=!0,Promise.resolve(ge(w,y,r.failureRetryCount)).then(function(e){if(e)return window.clickLastSyncTime=Date.now(),function(e){window.zClickEventsData&&Array.isArray(window.zClickEventsData)?window.zClickEventsData.splice(0,e):window.zClickEventsData=[]}(a),window.isDataSyncInProgress=!1,n=!0;window.isDataSyncInProgress=!1})):(n=1,!1)}}();return Promise.resolve(c&&c.then?c.then(function(e){return!n||e}):!n||c)}catch(e){return Promise.reject(e)}},St=function(e){try{var t,n=je(),r=de.getInstance();F("Data Length for direct streaming ");var o=window.zEventsPerfData||[],i=o.length,s=function(){if(2*o.length>=n.perfBufferSizeFrequency||window.perfLastSyncTime+n.perfTimeFrequency<=Date.now()&&i>0){var s,a,c=o.slice(0,i),u=Ie()||{},d=te()||{},l=W("zId"),f=null!=(s=d.zExternalUserInfo)&&s.externalId?null==(a=d.zExternalUserInfo)?void 0:a.externalId:"",p=/\((.*)\)/.exec((new Date).toString())[1],v={key:e,sdk_ver:x.sdkVersion,isNPM:x.isNPM,src:"Frontend",s_id:u.sessionId,euz_id:l,eue_id:f,events:c,eu_info_id:d.euId,rel_ver:r.releaseVer,handshake_status:window.iszHandshakeDone,ip:n.ip,deviceName:"",screenWidth:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,screenHeight:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,userAgent:window.navigator.userAgent,timeZone:p},g=(r.proxyURL?r.proxyURL:n.perfUrl)+"/perf";return Ee()?(window.isDataSyncInProgress=!0,Promise.resolve(me(g,v,n.failureRetryCount)).then(function(e){if(e)return window.perfLastSyncTime=Date.now(),n=i,window.zEventsPerfData&&Array.isArray(window.zEventsPerfData)?window.zEventsPerfData.splice(0,n):window.zEventsPerfData=[],window.isDataSyncInProgress=!1,t=!0;var n;window.isDataSyncInProgress=!1})):(t=1,!1)}}();return Promise.resolve(s&&s.then?s.then(function(e){return!t||e}):!t||s)}catch(e){return Promise.reject(e)}},It=function(e){try{var t=je(),n=window.zEventsData||[],r=de.getInstance(),o=K.getInstance(),i=mt.getInstance();F("Data Length for direct streaming ");var s="";try{s=JSON.stringify(n)}catch(e){M("Failed to stringify zEvents")}var a=null!=t&&t.eventCountCapInSingleChunk?t.eventCountCapInSingleChunk:0,c=a>0&&n.length>a?a:n.length;if(window.lastSyncDataLength=c,A("Going to send data with chunk "+c+" total events count "+n.length+" chunk size "+a),2*s.length>=t.bufferSizeFrequency||window.lastSyncTime+t.timeFrequency<=Date.now()&&c>0){var u,d,l=n.slice(0,c),f=Ie()||{},p=te()||{},v=W("zId"),g=null!=(u=p.zExternalUserInfo)&&u.externalId?null==(d=p.zExternalUserInfo)?void 0:d.externalId:"",m=/\((.*)\)/.exec((new Date).toString())[1],y=Te(),w={key:e,sdk_ver:x.sdkVersion,isNPM:x.isNPM,src:"Frontend",s_id:f.sessionId,euz_id:v,eue_id:g,events:l,eu_info_id:p.euId,rel_ver:r.releaseVer,handshake_status:window.iszHandshakeDone,ip:t.ip,deviceName:"",screenWidth:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,screenHeight:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,userAgent:window.navigator.userAgent,timeZone:m,pack:y},h="";try{h=JSON.stringify(w)}catch(e){M("Failed to stringify zipyDataJson")}var E={eventData:h};if(Nt())return function(){for(;window.zEventsData.length;)window.zEventsData.pop();window.zEventsData=[]}(),Promise.resolve(!0);var S={session_id:f.dSession,event_id:"AruZ~Em0WNlAnbyzVmwM~GR0cMb6Xl9r",is_new_party:f.isNewSession,is_new_session:f.isNewSession,client_timestamp_iso:(new Date).toISOString(),event_type:"MyEventRecord",parameters:E},I=(r.proxyURL?r.proxyURL:t.streamUrl)+"?p="+f.sessionId;return Ee()?(window.isDataSyncInProgress=!0,i.dataSync=O.PENDING,Promise.resolve(ye({divolteUrl:I,divolteJson:S,failureRetryCount:t.failureRetryCount})).then(function(e){if(e){if(window.lastSyncTime=Date.now(),function(e){window.zEventsData&&Array.isArray(window.zEventsData)?window.zEventsData.splice(0,e):window.zEventsData=[]}(c),window.isDataSyncInProgress=!1,i.dataSync=O.SUCCESS,H("last-activity-time",o.lastActivityTime.toString()),H("zenduser-last-activity-time",o.enduserLastActivityTime.toString()),f.isNewSession){var t=Ie();if(t){t.isNewSession=!1,o.isNewSession=!1;try{H("session-data",JSON.stringify(t))}catch(e){M("Failed to set session-data in localstorage")}}}return!0}return window.isDataSyncInProgress=!1,i.dataSync=O.FAILED,!1})):(H("last-activity-time",o.lastActivityTime.toString()),H("zenduser-last-activity-time",o.enduserLastActivityTime.toString()),i.dataSync=O.FAILED,Promise.resolve(!1))}return Promise.resolve(!1)}catch(e){return Promise.reject(e)}};function zt(t,r){void 0===t&&(t=Be.inputMasking);var i=de.getInstance(),s=K.getInstance();F("Going to init rrweb Recorder"),window.zrrwebRecorderStatus=d.RECORDINGPENDING;var a,c=function(){};try{var u=je();c=e.record({emit:function(t,r){if(!nt()||i.recordOnlyIframe){var a=-1;t.type!=e.EventType.IncrementalSnapshot?a=o.ReplayerEvent:(a=t.data.source?t.data.source:o.ReplayerEvent,(u.startCaptureWithoutUserActivity||a>=o.MouseInteraction&&a<=o.MediaInteraction)&&(window.zrrwebRecorderStatus=d.RECORDINGSUCCESSFUL,s.enduserLastActivityTime=Date.now()));try{var c=!1;window.reinitializationInProgress||(c=Te());var l={data:c?e.pack(t):JSON.stringify(t),time:t.timestamp,type:a,rrwebEvent:null==t?void 0:t.type,isError:!1,navigatedUrl:window.location.origin+window.location.pathname};if(r&&t.type==e.EventType.Meta?(s.isCheckoutFlowTriggered=!0,_("Checkout flow is triggered. Meta event expected type - "+e.EventType.Meta+" actual event "+t.type),l.isCheckout=r):r&&_("Full snapshot event. Expected event type - "+e.EventType.FullSnapshot+" Event type "+t.type),Tt(l),e.EventType.IncrementalSnapshot&&a===o.MouseInteraction&&u.captureClickEvents){var f=t.data;if(f.type&&f.type===e.MouseInteractions.Click){var p=function(e){A("Heatmap: Pack event");try{var t=JSON.stringify(e),r=n.strToU8(t),o=n.zlibSync(r);return n.strFromU8(o,!0)}catch(e){return A("Heatmap: Unable to pack the data"),""}}(f);!function(e){var t=je();window.zrecordingPaused||Nt()&&!ze(t)||Ee()&&t.captureClickEvents&&window.zClickEventsData.push(e)}({data:p,time:t.timestamp,type:f.type,isError:!1})}}}catch(e){M("Failed to store rrweb recorder events")}}},recordCanvas:We("canvasCapture"),blockClass:(a=We("blockClasses"),a&&"string"==typeof a?new RegExp(a):a instanceof RegExp?a:/zipy-block/),blockSelector:We("blockSelector"),ignoreClass:"zipy-ignore",maskAllInputs:t,sampling:{mousemove:150,scroll:150,mouseInteraction:{MouseUp:!0,MouseDown:!0,Click:!0,ContextMenu:!1,DblClick:!0,Focus:!1,Blur:!1,TouchStart:!0,TouchEnd:!0}},userTriggeredOnInput:!0,recordCrossOriginIframes:!i.recordOnlyIframe,captureClickEvents:u.captureClickEvents||!1,maskAllText:u.textMasking})}catch(e){M(e)}return c}function Ct(e){var t=K.getInstance();return F("Going to init zipy Recorder"),function(e){void 0===e&&(e={});var t=e.emit;if(!t)return M("emit function is required to record data from zipy-event-recorder"),function(){};ft=function(e){t(e)};try{var n=[],r=je();return n.push(r.capturePagePerf?function(e){var t="",n=window.history.pushState,r=window.history.replaceState;if(window.history.pushState=function(){n.apply(window.history,arguments),window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange"))},window.history.replaceState=function(){r.apply(window.history,arguments),window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange"))},window.PerformanceObserver&&"function"==typeof window.PerformanceObserver){var i=function(n){var r=n.loadTime,o=n.navigationType,i=n.isRouteChange,s=n.navigationUrl,a=void 0===s?"":s,c=n.eventType;try{var u={navigatedUrl:a||window.location.href,loadTime:r,navigationType:o,isRouteChange:i};t!==a&&(e(Ze({eventType:c,data:u,isError:!1})),u.loadTime>-1&&(t=u.navigatedUrl))}catch(e){M("not able to capture the navigation url")}},s=function(){i({loadTime:-1,navigationType:"navigate",isRouteChange:!0,navigationUrl:window.location.href,eventType:o.NavigationStart});var e=0,t=0,n=null,r=1,s=window.location.href,a=new PerformanceObserver(function(e){e.getEntries().filter(function(e){return"fetch"!==e.initiatorType&&"xmlhttprequest"!==e.initiatorType}).forEach(function(e){t=performance.now()})}),c=new MutationObserver(function(){try{return t=performance.now(),Promise.resolve()}catch(e){return Promise.reject(e)}});e=performance.now(),t=performance.now(),a.observe({entryTypes:["resource"]}),c.observe(document,Je),r>0&&(r=0,n=setInterval(function(){performance.now()-t>100&&(clearInterval(n),function(){a.disconnect(),c.disconnect(),n&&clearInterval(n);var u=t-e;F("Page Performance Observer: Page Load Time:"),i({loadTime:u,navigationType:"navigate",isRouteChange:!0,navigationUrl:s,eventType:o.NAVIGATION}),e=0,t=0,n=null,r=1}())},1e3))};window.buffered||i({loadTime:-1,navigationType:"current",isRouteChange:!1,navigationUrl:window.location.href,eventType:o.NAVIGATION});var a=new PerformanceObserver(function(e){var t=e.getEntries().find(function(e){return"navigation"===e.entryType});if(t){var n=t.name,r=t.loadEventEnd-t.startTime;r>0&&(F("Page Performance: Initial Page Load Time:"),i({loadTime:r,navigationType:t.type,isRouteChange:!1,navigationUrl:n,eventType:o.NAVIGATION}))}});return a.observe({type:"navigation",buffered:window.buffered}),window.addEventListener("locationchange",s,!1),window.addEventListener("popstate",s),window.addEventListener("hashchange",s),function(){history.pushState=n,history.replaceState=r,window.removeEventListener("locationchange",s),window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s),a.disconnect()}}return function(){}}(ft):function(e){var t=location.href,n=performance.getEntriesByType("navigation")[0],r={navigatedUrl:window.location.href,loadTime:-1,navigationType:window.location.href===(null==n?void 0:n.name)?"reload":"navigate",isRouteChange:!1};e(Ze({eventType:o.NAVIGATION,data:r,isError:!1}));var i=window.history.pushState,s=window.history.replaceState;function a(){try{var r={navigatedUrl:window.location.href,loadTime:-1,navigationType:window.location.href===(null==n?void 0:n.name)?"reload":"navigate",isRouteChange:!0};t!=r.navigatedUrl&&(e(Ze({eventType:o.NAVIGATION,data:r,isError:!1})),t=r.navigatedUrl)}catch(e){M("not able to capture the navigation url")}}return window.history.pushState=function(){i.apply(window.history,arguments),window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange"))},window.history.replaceState=function(){s.apply(window.history,arguments),window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange"))},window.addEventListener("locationchange",a,!1),window.addEventListener("popstate",a),window.addEventListener("hashchange",a),function(){history.pushState=i,history.replaceState=s,window.removeEventListener("locationchange",a),window.removeEventListener("popstate",a),window.removeEventListener("hashchange",a)}}(ft)),A("In zipy-event-record "+JSON.stringify(r)),r.consoleCapture&&n.push(function(e){function t(e){var t="";if("string"!=typeof e)try{t=JSON.stringify(e)}catch(e){}else t=e;try{if(-1!=t.search(l)||-1!=t.search(f))return!0}catch(e){return!0}return!1}function n(t,n){try{var r;r=function(e){if(!Array.isArray(e))return"";for(var t,n=[],r=G(e);!(t=r()).done;){var o=t.value;try{o&&"object"==typeof o&&o instanceof Error?n.push(String(o)):n.push(new Error(JSON.stringify(o)))}catch(e){n.push("[console log value cannot be serialized]")}}return n.join(" ")}(Array.from(n));var i=t==o.ConsoleError,s=i?function(e){if(!Array.isArray(e))return{hasErrorObj:!1};for(var t,n=G(e);!(t=n()).done;){var r=t.value;try{if(r&&"object"==typeof r&&(r.constructor.name.toLowerCase().includes("error")||(null==r?void 0:r.name).toLowerCase().includes("error")))return{hasErrorObj:!0,errObj:r}}catch(e){M("Error in checking error argument. Error is - "+e.message)}}return{hasErrorObj:!1}}(Array.from(n)):{hasErrorObj:!1};if(function(e,t,n){if(null==e)return!1;var r,o=e.toLowerCase(),i=je();if(n[0]instanceof Error&&tt(o))return!0;try{r=t?i.isIgnoreConsoleError:i.ignoreConsole}catch(e){M(e)}try{if(r.some(function(e){return o.includes(e.toLowerCase())&&function(e){try{var t=JSON.parse(e.split("error:")[1]);return Object.keys(t).length<1||"{}"===t}catch(e){return!0}}(o)}))return!0}catch(e){return!1}return!1}(r,i,n))return;if(i&&s.hasErrorObj){var a={message:r,error:s.errObj.stack,filename:"",colno:0,lineno:0};e(Ze({eventType:rt(r,o.Error),data:a,isError:!0}))}else e(Ze({eventType:t,data:{arguments:r,argumentsObj:Xe(Array.from(n))},isError:i}))}catch(e){return void M("Error in parsing console log. Error is: "+e.message)}}try{var r,i,s,a,c;c=je().consoleLogLevel.split(",");try{c.includes(p.ERROR)&&(r=console.error.bind(console),console.error=function(){t(arguments[0])||n(o.ConsoleError,arguments),r.apply(console,arguments)})}catch(e){M("Error in parsing console error. Error is: "+e.message)}try{c.includes(p.LOG)&&(i=console.log.bind(console),console.log=function(){t(arguments[0])||n(o.ConsoleInfo,arguments),i.apply(console,arguments)})}catch(e){M("Error in parsing console log. Error is: "+e.message)}try{c.includes(p.WARNING)&&(s=console.warn.bind(console),console.warn=function(){t(arguments[0])||n(o.ConsoleWarning,arguments),s.apply(console,arguments)})}catch(e){M("Error in parsing console warning. Error is: "+e.message)}try{c.includes(p.DEBUG)&&(a=console.debug.bind(console),console.debug=function(){t(arguments[0])||n(o.ConsoleDebug,arguments),a.apply(console,arguments)})}catch(e){M("Error in parsing console debug. Error is: "+e.message)}return function(){r&&(console.error=r),i&&(console.log=i),s&&(console.warn=s),a&&(console.debug=a)}}catch(e){return M("Error while getting console log level from sdk config. Error is: "+e.message),function(){}}}(ft)),r.stackTraceCapture&&n.push(function(e){var t=[Fe("error",function(t){!function(e,t){var n=e.message,r=e.filename,i=e.lineno,s=e.colno;if(tt(n)||tt(r))F("Ignoring error from error callback "+n);else if(e.error){var a,c,u;if(tt(null==(a=e.error)?void 0:a.stack))return void F("Ignoring error from error callback "+(null==(u=e.error)?void 0:u.stack));var d,l=null==(c=e.error)?void 0:c.stack;try{d="string"!=typeof l?JSON.stringify(l):l}catch(e){M("Failed to stringfy errorMsg inside error callback with exception"+e)}var f={message:n,filename:r,lineno:i,colno:s,error:d};t(Ze({eventType:rt(n,o.Error),data:f,isError:!0}))}else{if((null==n||""==n)&&x.ignoreEmptyErros)return void F("Ignored empty error");var p={message:n,filename:r,lineno:i,colno:s,error:""};t(Ze({eventType:rt(n,o.Error),data:p,isError:!0}))}}(t,e)},window)];return t.push(Fe("unhandledrejection",function(t){var n,r="reason"in t?null==t?void 0:t.reason:t,i=null!=t&&t.reason.stack?t.reason.stack:t;try{n="string"!=typeof i?JSON.stringify(i):i}catch(t){M("Failed to stringfy errorMsg inside unhandledrejection callback with exception"+t)}var s={message:""+r,error:n,filename:"",colno:0,lineno:0};if(null!=r&&""!=r||""!=s.error&&null!=s.error||!x.ignoreEmptyErros){var a="";try{a=JSON.stringify(s.error)}catch(t){M("Failed to stringfy exception")}tt(s.message)||tt(a)?F("Ignoring error from unhandled "+r):e(Ze({eventType:rt(r,o.UnhandledRejection),data:s,isError:!0}))}else F("Ignoring empty errors")},window)),function(){t.forEach(function(e){return e()})}}(ft)),r.networkCapture&&(n.push(function(e){var t=0;function n(e,n){if(We("networkCapture")&&!window.stopRecording&&!st(n.requestUrl,n.status,n.status>=400)){n.requestUrl=$e(n.requestUrl);var r=je();if(r&&r.isApiIdentifierEnable&&r.apiUniqueIdentifier.length>0){var o=r.apiUniqueIdentifier.filter(function(e){return e.apiUrl===n.requestUrl});o.length>0&&(n.apiIdentifier=function(e,t){try{var n=JSON.parse(e);if(n&&"object"==typeof n)for(var r=Object.keys(n),o=0,i=r;o<i.length;o++){var s=i[o];if(s===t)return"string"==typeof n[s]?n[s]:""}}catch(e){M("error while parsing api payload: "+e)}return""}(n.request,o[0].identifierName))}A("Pushing fetch Data when performance is enabled "+(n=et(n,t,n.requestByteSize||0,!0)).requestUrl),window.zFetchTempData.push({eventType:e,data:n,isError:n.status>=400})}}function r(e,t){if("GET"==t||"get"==t)try{var n=e.split("/"),r=n[n.length-1];if(""==r&&n.length>=2&&(r=n[n.length-2]),-1!=r.indexOf(".js")&&!r.indexOf(".json")||-1!=r.indexOf(".map")||-1!=r.indexOf(".html")||-1!=r.indexOf(".css"))return A("Going to ignore response text for url "+e),!0}catch(e){return!1}return!1}if(null!=window.zxhrInit||1==window.zxhrInit)return A("Network in already initialized"),function(){};var i=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(){var e="";null!=arguments[1]&&null!=arguments[1]&&("string"==typeof arguments[1]?e=arguments[1]:arguments[1]instanceof URL&&(e=arguments[1].href));var t,s,u={request:"",requestMethod:arguments[0]?arguments[0]:"",requestUrl:e,sourceLibrary:"xmlHttpClient",headers:{},response:"",responseHeaders:{},status:400,requestStartTime:0,duration:0,requestByteSize:0,responseByteSize:0},d=this.send;this.send=function(){u.requestStartTime=Date.now(),u.request=arguments[0]?arguments[0]:"",u=et(u,0,0,!0),d.apply(this,arguments)};var l=this.setRequestHeader;this.setRequestHeader=function(){var e,t;2!==arguments.length||(e=arguments[0],(t=Ke()).length>0&&t.indexOf(e)>-1)||(u.headers[arguments[0]]=arguments[1]),l.apply(this,arguments)},this.addEventListener("load",function(){try{var i=this;if(t=Date.now(),!r(e,u.requestMethod))try{var a,d=c(i),l=d["content-length"]?d["content-length"]:0;u.responseHeaders=d,"blob"===(null==i?void 0:i.responseType)?(l=l||(null==i||null==(a=i.response)?void 0:a.size),s=null==i?void 0:i.response):(s=null!=i&&i.responseText?i.responseText:"",l=l||s.length),u.responseByteSize=l,u.response=s}catch(e){F("Error while capturing response text")}return u.status=i.status,u.duration=t-u.requestStartTime,n(o.XHR,u),Promise.resolve()}catch(e){return Promise.reject(e)}}),this.addEventListener("error",function(){if(t=Date.now(),!r(e,u.requestMethod))try{var i,a=c(this),d=a["content-length"]?a["content-length"]:0;u.responseHeaders=a,"blob"===(null==this?void 0:this.responseType)?(d=d||(null==this||null==(i=this.response)?void 0:i.size),s=null==this?void 0:this.response):(s=null!=this&&this.responseText?this.responseText:"",d=d||s.length),u.responseByteSize=d,u.response=s}catch(e){F("Error while capturing response text")}u.status=this.status?this.status:404,u.duration=t-u.requestStartTime,n(o.XHR,u)}),this.addEventListener("abort",function(){A("Request got aborted in fetch"),a(u,e,this)}),this.addEventListener("timeout",function(){A("Request got timeout"),a(u,e,this)}),i.apply(this,arguments)};var s=window.fetch;return window.fetch=function(){var e,t,i,a,c="",u={sourceLibrary:"fetch",requestUrl:"",requestMethod:"",headers:"",request:"",response:"",responseHeaders:{},status:400,requestStartTime:0,duration:0,requestByteSize:0,responseByteSize:0};u.requestStartTime=Date.now(),null!=arguments[0]&&null!=arguments[0]&&(c="string"==typeof(e=arguments[0])?e:e?e instanceof URL?e.href:e instanceof Request?e.url:"":"");try{if(null!=arguments[1]&&null!=arguments[1]){var d=arguments[1].body;d&&(u.requestByteSize=JSON.stringify(d,null,4).length)}}catch(e){M("error while capturing data length")}try{arguments[1]&&arguments[1].headers&&(t=J({},arguments[1].headers))}catch(e){M("header is not present in the call")}u=et(u={sourceLibrary:"fetch",requestUrl:c||"",requestMethod:arguments[1]&&arguments[1].method?arguments[1].method:"GET",headers:t?(i=t,a=Ke(),a.length>0?(a.forEach(function(e){return delete i[e]}),i):i):"",request:arguments[1]&&arguments[1].body?arguments[1].body:"",response:"",responseHeaders:{},status:400,duration:0,requestByteSize:0,responseByteSize:0,requestStartTime:u.requestStartTime},0,0,!0);var l=s.apply(window,arguments);return new Promise(function(e,t){var i={status:400},s=0;l.then(function(t){i={status:t.status};for(var a,d=G(t.headers);!(a=d()).done;){var l=a.value;l&&(u.responseHeaders[l[0]]=l[1],!s&&l[0]&&"content-length"==l[0].toLowerCase()&&(s=l[1]))}var f=Date.now(),p=We("xhrRespPayloadCapture");if(!r(c,u.requestMethod)&&i.status>=400||p){var v=t.clone(),g=null;try{if(window.TextDecoder&&v&&v.body){var m=v.body.getReader(),y=new TextDecoder("utf-8"),w="";g=m.read().then(function e(t){var n=t.done,r=t.value,o=r?y.decode(r,{stream:!0}):"";return w+=o,n?w:m.read().then(e)})}else g=v.text()}catch(e){M("Not able to extract fetch response: "+e.message)}u.response=g,u.responseByteSize=s}u.duration=f-u.requestStartTime,u.status=i.status,n(o.XHR,u),e(t.clone())}).catch(function(r){var i=je();if("AbortError"===r.name&&i.captureCancelledRequest){var s=Date.now();u.status=b,u.duration=s-u.requestStartTime,n(o.XHR,u),e(r)}M("Error in fetch response: "+r.message),t(r)})})},window.zxhrInit=!0,function(){};function a(e,t,i){var s,a;if(je().captureCancelledRequest){if(!r(t,e.requestMethod))try{s=Date.now();var u,d=c(i),l=d["content-length"]?d["content-length"]:0;e.responseHeaders=d,"blob"===(null==i?void 0:i.responseType)?(l=l||(null==i||null==(u=i.response)?void 0:u.size),a=null==i?void 0:i.response):(a=null!=i&&i.responseText?i.responseText:"",l=l||a.length),e.responseByteSize=l,e.response=a}catch(e){F("Error while capturing response text")}e.duration=s-e.requestStartTime,e.status=null!=i&&i.status?null==i?void 0:i.status:b,n(o.XHR,e)}}function c(e){var t=e.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};return t&&t.length&&t.forEach(function(e){try{if(""!==e){var t=null==e?void 0:e.split(": "),r=null==t?void 0:t.shift(),o=null==t?void 0:t.join(": ");n[r]=o||""}}catch(e){M("Error in extracting response headers: "+e.message)}}),n}}()),n.push(function(e){var t=[Fe("online",function(t){lt(e)},window)];return t.push(Fe("offline",function(t){lt(e)},window)),function(){t.forEach(function(e){return e()})}}(ft))),n.push(function(e){var t=[];return t.push(Fe(y,function(t){try{var n=null==t?void 0:t.detail,r=n.message,i=n.options,s=void 0===i?{}:i;F("Capturing log message for message : "+r+" options: "+JSON.stringify(s)),r&&s&&s.constructor===Object?e(Ze({eventType:o.ZipyLogMessage,data:{message:r.length<E?r:r.substring(0,E),options:s},isError:!1})):A("Didn't capture log message for message : "+r+" options: "+JSON.stringify(s))}catch(e){M("Error in capturing log message. Error is - "+e.message)}},window)),t.push(Fe(w,function(t){try{var n,r=(null==(n=t.detail)?void 0:n.error)||{},i=r.message,s=r.name,a=void 0===s?"":s,c=r.filename,u=void 0===c?"":c,d=r.lineno,l=void 0===d?0:d,f=r.colno,p=void 0===f?0:f,v=r.cause,g=void 0===v?"":v,m=r.stack,y=void 0===m?"":m;if(g=g?String(g):"",F("Capturing exception message for message : "+i+" name: "+a+" stack: "+y),tt(i)||tt(a))return void F("Ignoring exception logs for message: "+i);i?e(Ze({eventType:o.ZipyLogException,data:{message:i,name:a,filename:u,lineno:l,colno:p,cause:g,stack:y},isError:!0})):A("Didn't capture exception message for message : "+i+" name: "+a)}catch(e){M("Error in capturing log message. Error is - "+e.message)}},window)),t.push(Fe(h,function(t){try{var n=null==t?void 0:t.detail,r=n.name,i=n.message,s=void 0===i?"":i,a=n.category,c=void 0===a?"FE":a,u=n.options,d=void 0===u?{}:u;if(F("Capturing exception message for message : "+s+" name: "+r),tt(s)||tt(r))return void F("Ignoring error logs for message: "+s);s&&r&&d&&d.constructor===Object?e(Ze({eventType:"NE"===c?o.ZipyLogNetworkError:o.ZipyLogFrontendError,data:{message:s.length<E?s:s.substring(0,E),name:r,category:c,options:d},isError:!0})):A("Didn't capture error message for message : "+s+" name: "+r+" category:"+c+" options: "+JSON.stringify(d))}catch(e){M("Error in capturing log message. Error is - "+e.message)}},window)),function(){t.forEach(function(e){return e()})}}(ft)),n.push(function(e){if(window.PerformanceObserver&&"function"==typeof window.PerformanceObserver){var t=new PerformanceObserver(function(t){var n=t.getEntries();A("perf event size is - "+n.length),M("Perf entires"),M(n.filter(function(e){return"fetch"==e.initiatorType||"xmlhttprequest"==e.initiatorType}));for(var r,i=G(n);!(r=i()).done;){var s=r.value;try{var a=ot(s.initiatorType);if(a===o.XHR&&window.zFetchTempData&&window.zFetchTempData.length>0)for(var c=[].concat(window.zFetchTempData)||[],u=function(t){var n;M("Compare tempData[j].data?.requestUrl {} and entries[i].name"),A("Merging XHR calls");var r=(null==(n=c[t].data)?void 0:n.requestUrl)||"",i=$e(s.name)||"";if(i&&r&&decodeURIComponent(r)===decodeURIComponent(i)||ut(r,i)){var a,u,d,l;A("INSIDE :: Compare xhrUrl "+r+" and perfURL "+i);var f=at(s);f.responseStatus=s.responseStatus?s.responseStatus:null==(a=c[t].data)?void 0:a.status,f.transferSize=s.transferSize?s.transferSize:null==(u=c[t].data)?void 0:u.responseByteSize,f.apiIdentifier=(null==(d=c[t].data)?void 0:d.apiIdentifier)||"",f.name=i,r.indexOf("http://")>-1||r.indexOf("https://")>-1||(c[t].data.requestUrl=i);var p=J({},c[t].data,f);return c[t]=J({},c[t],{data:p}),A("Merged XHR calls is "+c[t]),e(Ze({eventType:o.Performance,data:J({},f,{method:null==(l=c[t].data)?void 0:l.requestMethod}),isError:f.responseStatus>=400})),pt(c[t]).then(function(t){t.data=et(t.data,0,t.data.responseByteSize||0,!1),e(Ze(t))}).catch(function(e){M("Error in capturing perf data. Error is - "+e.message)}),A("Old temp XHR data calls length "+window.zFetchTempData.length),window.zFetchTempData=window.zFetchTempData.filter(function(e,n){return n!=t}),A("New temp XHR data calls length "+window.zFetchTempData.length),1}},d=0;d<c.length&&!u(d);d++);else if(a&&a!=o.XHR){var l=at(s),f=l.responseStatus>=400;st(s.name,s.responseStatus,f)||e(Ze({eventType:o.Performance,data:J({},l,{method:"GET"}),isError:f}))}else M("XHR request but zFetchTempData is empty. API: "+s.name+", Event type: "+a+". Initiator type - "+s.initiatorType)}catch(e){M("Error in capturing perf data. Error is - "+e.message)}}var p=[].concat(window.zFetchTempData)||[];if(p.length>0)for(var v=function(t){var n=p[t].data,r=n.requestStartTime,o=n.duration,i=We("xhrEventsTimeout");Date.now()-(r+o)>i&&pt(p[t]).then(function(n){n.data=et(n.data,0,n.data.responseByteSize||0,!1),e(Ze(n)),window.zFetchTempData=window.zFetchTempData.filter(function(e,n){return n!=t})}).catch(function(e){M("Error in capturing perf data. Error is - "+e.message)})},g=0;g<p.length;g++)v(g)});return t.observe({entryTypes:["resource"]}),function(){return t.disconnect()}}return function(){}}(ft)),n.push(function(e){if(window.buffered){var t=performance.getEntriesByType("resource").filter(function(e){return it.indexOf(e.initiatorType)>-1});F("Inside initial perf event function. Size of data is - "+t.length);for(var n,r=G(t);!(n=r()).done;){var i=n.value;if(!st(i.name,i.responseStatus,i.responseStatus>=400)){var s=at(i);e(Ze({eventType:o.Performance,data:J({},s,{method:"GET"}),isError:(null==s?void 0:s.responseStatus)>=400}))}}}return function(){}}(ft)),r.capturePagePerf&&n.push(function(e){if(window.PerformanceObserver&&"function"==typeof window.PerformanceObserver){F("Page Performance: PerfObserver is supported");var t=new PerformanceObserver(function(t){var n=t.getEntries(),r=window.location.href,i=n.find(function(e){return"first-contentful-paint"===e.name});if(i){var s=window.performance.timeOrigin+i.startTime,a={data:{name:"FCP",type:C.FCP,value:i.startTime,navigationUrl:r},type:o.WebVitals,time:s};F("Page Performance: FCP entries present",JSON.stringify(a)),kt(a),e(Ze({eventType:o.WebVitals,data:a,isError:!1}))}var c=n.find(function(e){return"first-paint"===e.name});if(c){var u=window.performance.timeOrigin+c.startTime,d={data:{name:"FP",type:C.FP,value:c.startTime,navigationUrl:r},type:o.WebVitals,time:u};F("Page Performance: FP entries present",JSON.stringify(d)),kt(d),e(Ze({eventType:o.WebVitals,data:d,isError:!1}))}});t.observe({type:"paint",buffered:window.buffered});var n=new PerformanceObserver(function(t){var n=t.getEntries(),r=window.location.href,i=n.find(function(e){return"largest-contentful-paint"===e.entryType});if(i){var s=window.performance.timeOrigin+i.startTime,a={data:{name:"LCP",type:C.LCP,value:i.startTime,navigationUrl:r},type:o.WebVitals,time:s};F("Page Performance: LCP entries present",JSON.stringify(a)),kt(a),e(Ze({eventType:o.WebVitals,data:a,isError:!1}))}});n.observe({type:"largest-contentful-paint",buffered:window.buffered});var r,i=0,s=new PerformanceObserver(function(t){var n=t.getEntries(),s=window.location.href,a=n.find(function(e){return"layout-shift"===e.entryType}),c=je();if(a){var u=window.performance.timeOrigin+a.startTime,d={data:{name:"CLS",type:C.CLS,value:a.value,navigationUrl:s},type:o.WebVitals,time:u};F("Page Performance: CLS entries present",JSON.stringify(d)),i<c.clsEventCount&&(F("Page Performance: CLS within the threshold",JSON.stringify(d)),kt(d),e(Ze({eventType:o.WebVitals,data:d,isError:!1})),i++),r||(r=setTimeout(function(){i=0,r=null},c.clsTimeout))}});s.observe({type:"layout-shift",buffered:window.buffered});var a=new PerformanceObserver(function(t){var n=t.getEntries(),r=window.location.href,i=n.find(function(e){return"first-input"===e.entryType});if(i){var s=window.performance.timeOrigin+i.startTime,a={data:{name:"FID",type:C.FID,value:i.processingStart-i.startTime,navigationUrl:r},type:o.WebVitals,time:s};F("Page Performance: FID entries present",JSON.stringify(a)),kt(a),e(Ze({eventType:o.WebVitals,data:a,isError:!1}))}});return a.observe({type:"first-input",buffered:window.buffered}),function(){t.disconnect(),n.disconnect(),s.disconnect(),a.disconnect(),r&&(clearTimeout(r),r=null)}}return function(){}}(ft)),r.webSocketsCapture&&(_("Going to init websockets",window),window.sdkInit!==Ge.Completed?function(e){function t(t,n){window.stopRecording||e(Ze({eventType:t,data:n,isError:t==o.WSERROR}))}function n(e){_("onmessage: ");var n={data:e.data,type:e.type,wsTimestamp:e.timeStamp},r={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:i.MESSAGERECEIVED};r.responseData=n,t(o.WSMESSAGE,r)}function r(e){_("onclose: ");var n=window._websockets.indexOf(this.ws);n>-1&&window._websockets.splice(n,1);var r={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:i.SOCKETCLOSE};r.responseData={code:e.code,reason:e.reason,type:e.type,wsTimestamp:e.timeStamp},t(o.WSCLOSE,r)}function s(e){_("onopen: ");var n={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:i.SOCKETERROR};t(o.WSOPEN,n)}function a(e){_("onerror: ");var n={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:i.SOCKETERROR};n.responseData={code:e.code,reason:e.reason,type:e.type,wsTimestamp:e.timeStamp},t(o.WSERROR,n)}_("Inside captureWebSocketRequest"),_("Going to call WebSocket connection");var c=new Proxy(window.WebSocket,{construct:function(e,c){_("WebSocket connection");var u=function(e,t,n){if(B())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Z(o,n.prototype),o}(e,c),d=n,l=r,f=s,p=a,v=u.send;return u.zRecordStatus="initiated",u.zRecordStart=function(){"started"!==u.zRecordStatus&&(function(e){var n=e.send;e.send=function(e){_("onsend");var r={requestUrl:this.url?this.url:"",status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,requestData:arguments[0]?arguments[0]:"",timestamp:Date.now(),wsMsgType:i.MESSAGESEND};n.apply(this,[e]),t(o.WSMESSAGE,r)}}(u),u.addEventListener("message",d),u.addEventListener("open",f),u.addEventListener("error",p),u.addEventListener("close",l),u.zRecordStatus="started")},u.zRecordStop=function(){"stopped"!==u.zRecordStatus&&(u.send=v,u.removeEventListener("message",d),u.removeEventListener("open",f),u.removeEventListener("error",p),u.removeEventListener("close",l),u.zRecordStatus="stopped")},window._websockets=window._websockets||[],window._websockets.push(u),window.stopRecording||u.zRecordStart(),u}});_("Going to set WebSocket connection"),window.WebSocket=c}(ft):function(){if(_("Start recording"),window._websockets&&window._websockets.length)for(var e=0;e<window._websockets.length;e++)window._websockets[e]&&window._websockets[e].zRecordStart&&"function"==typeof window._websockets[e].zRecordStart&&(window._websockets[e].zRecordStart(),_("Zipy Recording Status:"))}()),function(){n.forEach(function(e){return e()}),function(){if(_("Stop recording"),window._websockets&&window._websockets.length)for(var e=0;e<window._websockets.length;e++)window._websockets[e]&&window._websockets[e].zRecordStop&&"function"==typeof window._websockets[e].zRecordStop&&(window._websockets[e].zRecordStop(),_("Zipy Recording Status:"))}()}}catch(e){return M(e),function(){}}}({emit:function(e){try{var n=je();if(e.eventType!=o.Online||window.iszHandshakeDone||(window.ztryForHandshake=!0),t.isSessionExpired)return void F("Don't store zipy events if session is expired");(n.startCaptureWithoutUserActivity||e.eventType>=o.Error&&e.eventType<=o.UnhandledRejection)&&(window.zrrwebRecorderStatus=d.RECORDINGSUCCESSFUL);var r,i={data:JSON.stringify(e.data),time:e.timestamp,type:e.eventType===o.Performance?ot(e.data.initiatorType):e.eventType,isError:e.isError,navigatedUrl:window.location.origin+window.location.pathname};i.type===o.XHR&&e.eventType==o.Performance||Tt(i),n.capturePerformance&&o.Performance===e.eventType&&function(e){var t=je();window.zrecordingPaused||Nt()&&!ze(t)||Ee()&&window.zEventsPerfData.push(e)}({data:e.data,type:null==(r=e.data)?void 0:r.initiatorType,time:e.timestamp})}catch(e){M("Failed to store events")}}})}function Tt(e){var t=je(),n=K.getInstance();window.zrecordingPaused||Nt()&&!ze(t)||Ee()&&window.zEventsData.push(e),n.lastActivityTime=Date.now()}function kt(e){var t=je();window.zrecordingPaused||Nt()&&!ze(t)||Ee()&&window.zPagePerfData.push(e)}var bt=function(e){var t,n,r=de.getInstance(),o={domCapture:"boolean"==typeof(null==e?void 0:e.dom_capture)?null==e?void 0:e.dom_capture:Be.domCapture,consoleCapture:"boolean"==typeof(null==e?void 0:e.console_capture)?null==e?void 0:e.console_capture:Be.consoleCapture,networkCapture:"boolean"==typeof(null==e?void 0:e.network_capture)?null==e?void 0:e.network_capture:Be.networkCapture,stackTraceCapture:"boolean"==typeof(null==e?void 0:e.stack_trace_capture)?null==e?void 0:e.stack_trace_capture:Be.stackTraceCapture,webSocketsCapture:"boolean"==typeof(null==e?void 0:e.web_sockets_capture)?null==e?void 0:e.web_sockets_capture:Be.webSocketsCapture,ipCapture:"boolean"==typeof(null==e?void 0:e.ip_capture)?null==e?void 0:e.ip_capture:Be.ipCapture,inputMasking:"boolean"==typeof(null==e?void 0:e.input_masking)?null==e?void 0:e.input_masking:Be.inputMasking,textMasking:"boolean"==typeof(null==e?void 0:e.text_masking)?null==e?void 0:e.text_masking:Be.textMasking,paid:"boolean"==typeof(null==e?void 0:e.paid)?null==e?void 0:e.paid:Be.paid,apiKey:null==e?void 0:e.api_key,streamUrl:null!=e&&e.stream_url?null==e?void 0:e.stream_url:Be.streamUrl,maxBufferSize:null!=e&&e.max_buffer_size?1024*(null==e?void 0:e.max_buffer_size):Be.maxBufferSize,compression:"boolean"==typeof(null==e?void 0:e.compression)?null==e?void 0:e.compression:Be.compression,compressionType:null!=e&&e.compression_type?null==e?void 0:e.compression_type:Be.compressionType,timeFrequency:null!=e&&e.time_frequency?1e3*(null==e?void 0:e.time_frequency):Be.timeFrequency,encodingType:null==e?void 0:e.encoding_type,sessionTimeout:null!=e&&e.session_timeout?1e3*(null==e?void 0:e.session_timeout):Be.sessionTimeout,failureRetryCount:null!=e&&e.failure_retry_count?null==e?void 0:e.failure_retry_count:Be.failureRetryCount,bufferSizeFrequency:null!=e&&e.buffer_size_frequency?1024*(null==e?void 0:e.buffer_size_frequency):Be.bufferSizeFrequency,ignoreUrl:null!=e&&e.ignoreUrl?null==e?void 0:e.ignoreUrl:Be.ignoreUrl,ignoreError:null!=e&&e.ignoreError?null==e?void 0:e.ignoreError:Be.ignoreError,ignoreConsole:null!=e&&e.ignoreConsole?null==e?void 0:e.ignoreConsole:Be.ignoreConsole,isIgnoreUrlError:null!=e&&e.isIgnoreUrlError?null==e?void 0:e.isIgnoreUrlError:Be.isIgnoreUrlError,isIgnoreConsoleError:null!=e&&e.isIgnoreConsoleError?null==e?void 0:e.isIgnoreConsoleError:Be.isIgnoreConsoleError,ip:null!=e&&e.ip?null==e?void 0:e.ip:"",pack:!(null==e||!e.pack||!e.pack),blockClasses:(t=null!=e&&e.blockClasses?null==e?void 0:e.blockClasses:Be.blockClasses,n="zipy-block",t=(t=t&&t.length?t+(n?","+n:""):n).split(",").filter(He).map(Ve).join("|"),new RegExp(t)),customerId:null==e?void 0:e.cId,headersToSanitize:null!=e&&e.headersToSanitize?e.headersToSanitize:"",xhrReqPayloadCapture:"boolean"==typeof(null==e?void 0:e.xhrReqPayloadCap)?null==e?void 0:e.xhrReqPayloadCap:Be.xhrReqPayloadCapture,xhrRespPayloadCapture:"boolean"==typeof(null==e?void 0:e.xhrRespPayloadCap)?null==e?void 0:e.xhrRespPayloadCap:Be.xhrRespPayloadCapture,canvasCapture:"boolean"==typeof(null==e?void 0:e.canvasCapture)?null==e?void 0:e.canvasCapture:Be.canvasCapture,requestCapSize:null!=e&&e.requestCapSize?null==e?void 0:e.requestCapSize:Be.requestCapSize,responseCapSize:null!=e&&e.responseCapSize?null==e?void 0:e.responseCapSize:Be.responseCapSize,sizeExceededMessage:null!=e&&e.sizeExceededMessage?null==e?void 0:e.sizeExceededMessage:Be.sizeExceededMessage,eventCountCapInSingleChunk:"number"==typeof(null==e?void 0:e.eventCountCapInSingleChunk)?e.eventCountCapInSingleChunk:Be.eventCountCapInSingleChunk,captureCustomZipyLogMessage:"boolean"==typeof(null==e?void 0:e.captureCustomZipyLogMessage)?e.captureCustomZipyLogMessage:Be.captureCustomZipyLogMessage,captureCustomZipyLogError:"boolean"==typeof(null==e?void 0:e.captureCustomZipyLogError)?e.captureCustomZipyLogError:Be.captureCustomZipyLogError,captureCustomZipyLogException:"boolean"==typeof(null==e?void 0:e.captureCustomZipyLogException)?e.captureCustomZipyLogException:Be.captureCustomZipyLogException,startCaptureWithoutUserActivity:"boolean"==typeof(null==e?void 0:e.startCaptureWithoutUserActivity)?e.startCaptureWithoutUserActivity:Be.startCaptureWithoutUserActivity,consoleLogLevel:null!=e&&e.consoleLogLevel?e.consoleLogLevel:Be.consoleLogLevel,recordCrossOriginIframes:!r.recordOnlyIframe,splitSessionSize:"number"==typeof(null==e?void 0:e.splitSessionSize)?e.splitSessionSize:Be.splitSessionSize,capturePerformance:"boolean"==typeof(null==e?void 0:e.capturePerformance)?e.capturePerformance:Be.capturePerformance,perfUrl:null!=e&&e.perfUrl?null==e?void 0:e.perfUrl:Be.perfUrl,perfTimeFrequency:"number"==typeof(null==e?void 0:e.perfTimeFrequency)?e.perfTimeFrequency:Be.perfTimeFrequency,perfBufferSizeFrequency:"number"==typeof(null==e?void 0:e.perfBufferSizeFrequency)?e.perfBufferSizeFrequency:Be.perfBufferSizeFrequency,clickTimeFrequency:"number"==typeof(null==e?void 0:e.clickTimeFrequency)?e.clickTimeFrequency:Be.clickTimeFrequency,clickBufferSizeFrequency:"number"==typeof(null==e?void 0:e.clickBufferSizeFrequency)?e.clickBufferSizeFrequency:Be.clickBufferSizeFrequency,isApiIdentifierEnable:"boolean"==typeof(null==e?void 0:e.isApiIdentifierEnable)?e.isApiIdentifierEnable:Be.isApiIdentifierEnable,apiUniqueIdentifier:null!=e&&e.apiUniqueIdentifier&&Array.isArray(e.apiUniqueIdentifier)?e.apiUniqueIdentifier:Be.apiUniqueIdentifier,ignoreUrlErrorCodes:null!=e&&e.ignoreUrlErrorCodes?e.ignoreUrlErrorCodes:Be.ignoreUrlErrorCodes,ignoreUrlCodes:null!=e&&e.ignoreUrlCodes?e.ignoreUrlCodes:Be.ignoreUrlCodes,heatMapUrl:null!=e&&e.heatMapUrl?e.heatMapUrl:Be.heatMapUrl,captureClickEvents:"boolean"==typeof(null==e?void 0:e.captureClickEvents)?e.captureClickEvents:Be.captureClickEvents,sessionStitching:null!=e&&e.sessionStitching?e.sessionStitching:Be.sessionStitching,captureCancelledRequest:"boolean"==typeof(null==e?void 0:e.captureCancelledRequest)?e.captureCancelledRequest:Be.captureCancelledRequest,capturePagePerf:null!=e&&e.capturePagePerf?e.capturePagePerf:Be.capturePagePerf,clsEventCount:null!=e&&e.clsEventCount?e.clsEventCount:Be.clsEventCount,clsTimeout:null!=e&&e.clsTimeout?e.clsTimeout:Be.clsTimeout,pagePerfUrl:null!=e&&e.pagePerfUrl?e.pagePerfUrl:Be.pagePerfUrl,xhrEventsTimeout:null!=e&&e.xhrEventsTimeout?e.xhrEventsTimeout:Be.xhrEventsTimeout,blockSelector:null!=e&&e.blockSelector?null==e?void 0:e.blockSelector:Be.blockSelector,captureCustomEvents:"boolean"==typeof(null==e?void 0:e.captureCustomEvents)?null==e?void 0:e.captureCustomEvents:null==Be?void 0:Be.captureCustomEvents,customEventUrl:null!=e&&e.customEventUrl?null==e?void 0:e.customEventUrl:Be.customEventUrl,maxCustomEventProperties:null!=e&&e.maxCustomEventProperties?null==e?void 0:e.maxCustomEventProperties:Be.maxCustomEventProperties,maxCustomEventPayloadSize:null!=e&&e.maxCustomEventPayloadSize?null==e?void 0:e.maxCustomEventPayloadSize:Be.maxCustomEventPayloadSize,sanitizePayloadResponse:"boolean"==typeof(null==e?void 0:e.sanitizePayloadResponse)?null==e?void 0:e.sanitizePayloadResponse:Be.sanitizePayloadResponse,captureUTM:"boolean"==typeof(null==e?void 0:e.captureUTM)?null==e?void 0:e.captureUTM:Be.captureUTM};return o.ignoreUrl.push(o.streamUrl.substring(o.streamUrl.indexOf("://")+3)),o.ignoreUrl.push(o.streamUrl.substring(o.perfUrl.indexOf("://")+3)),o.ignoreUrl.push(o.streamUrl.substring(o.heatMapUrl.indexOf("://")+3)),o.ignoreUrl.push(x.streamMgrUrl.substring(x.streamMgrUrl.indexOf("://")+3)),o.ignoreUrl.push("google.com"),o.isIgnoreUrlError.push(o.streamUrl.substring(o.streamUrl.indexOf("://")+3)),o.isIgnoreUrlError.push(x.streamMgrUrl.substring(x.streamMgrUrl.indexOf("://")+3)),o.isIgnoreUrlError.push("google.com"),function(e){if(e)try{var t;A("Updating zsdk-config"+JSON.stringify(e)),e.blockClasses=null==(t=e.blockClasses)?void 0:t.source,H("zsdk-config",JSON.stringify(e))}catch(e){M("Failed to stringify zsdk-config ")}}(o),o};function Nt(){var e=K.getInstance().sessionBlockInfo;return!(null==e||!e.isBlocked)&&e.isBlocked}var Rt=function(e,t){var n={},r=K.getInstance();e===N.PAGE_OUT?n.type="visibility hidden":(e===N.INIT||N.REINIT)&&(n.type=e,n.newSession=r.isNewSession,n.initiator=t),n.tabId=vt("zTId"),Tt({data:JSON.stringify(n),time:Date.now(),type:o.DEBUG_INFO,isError:!1,navigatedUrl:window.location.origin+window.location.pathname,rrwebEvent:0})};function Ot(e){var t=new TextEncoder,n=JSON.stringify(e);return t.encode(n).byteLength}function Pt(e,t){try{for(var n,r=G(window.document.querySelectorAll("iframe"));!(n=r()).done;){var o=n.value;try{var i=new URL(o.src);if(t){if(i.origin!==window.document.location.origin&&o.contentWindow===(null==t?void 0:t.source))return F("sending message to iframe to start recording"),void o.contentWindow.postMessage({action:S,config:e},"*");continue}i.origin!==window.document.location.origin&&(F("sending message to iframe to start recording"),o.contentWindow.postMessage({action:S,config:e},"*"))}catch(e){M("failed to start recording for iframe:")}}}catch(e){M("failed to start recording")}}function Dt(){try{var e=window.document.querySelectorAll("iframe");F("going to stop iframe");for(var t,n=G(e);!(t=n()).done;){var r=t.value;try{new URL(r.src).origin!==window.document.location.origin&&(F("sending message to iframe to stop recording"),r.contentWindow.postMessage({action:I},"*"))}catch(e){M("failed to stop recording for iframe:")}}}catch(e){M("failed to stop recording")}}var Ut=/*#__PURE__*/function(){function e(){this.zipySessionData=void 0,this.zipyStates=void 0,this.zipySessionData=K.getInstance(),this.zipyStates=mt.getInstance()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.stopHandlers=function(){var e=this,t=mt.getInstance();this.zipyStates.isDataProcessingDone().then(function(n){if(n){t.sdkTimer=D.STOP,window.zrrwebRecorderStatus=d.RECORDINGPENDING,window.sdkInit=Ge.Failed;var r=window.zStop;r&&r(),Re(),ke(e.zipySessionData.apiKey)}})},t.stop=function(){this.stopHandlers()},e}();function xt(e,t,n){if(!e.s){if(n instanceof At){if(!n.s)return void(n.o=xt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(xt.bind(null,e,t),xt.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}Ut.instance=void 0;var Lt=function(e){try{var t,n=function(n){if(t)return n;function o(){function t(t){function n(){function t(t){function n(t){function n(t){function n(t){t&&F("Successfully sent custom event data to server via session storage"),Bt(x.sdkLoopTime,e)}t&&F("Successfully sent page perf data to server via session storage");var r=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!==d.RECORDINGPENDING;return r?Promise.resolve(wt(e)).then(n):n(r)}t&&F("Successfully sent click data to server via session storage");var r=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=d.RECORDINGPENDING;return r?Promise.resolve(ht(e)).then(n):n(r)}t&&F("Successfully sent pref data to server via session storage");var o=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=d.RECORDINGPENDING&&r.captureClickEvents;return o?Promise.resolve(Et(e)).then(n):n(o)}var n=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=d.RECORDINGPENDING&&r.capturePerformance;return n?Promise.resolve(St(e)).then(t):t(n)}var o=function(){if(t){var n=function(){F("Successfully send data to server via session storage")},o=function(){if(window.zrecordingPaused){window.zrecordingPaused=!1,window.reinitializationInProgress=!0;var t=c.GETUSERCONFIG;return ue()&&(t=c.POSTENDUSERINFOANDGETUSERCONFIG),Promise.resolve(yt(e,t,!1)).then(function(e){r=e,window.zStop=Jt(),Rt(N.REINIT,R.STREAMDATARECORDINGPAUSE)})}}();return o&&o.then?o.then(n):n()}var i=window.zEventsData||[],s="";try{s=JSON.stringify(i)}catch(e){M("Failed stringify events while stream data server")}0!=r.maxBufferSize&&2*s.length>r.maxBufferSize&&!window.zrecordingPaused&&(window.zrecordingPaused=!0,A("Max Buffer size is reached going to pause recording"))}();return o&&o.then?o.then(n):n()}var n=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=d.RECORDINGPENDING;return n?Promise.resolve(It(e)).then(t):t(n)}var i=function(){if(window.ztryForHandshake)return Promise.resolve(yt(e,window.zpendingOp,!1)).then(function(e){r=e})}();return i&&i.then?i.then(o):o()};if(window.sdkInit!==Ge.Completed)return A("Sdk is not initialized yet"),Bt(x.sdkLoopTime,e),Promise.resolve();if(window.isDataSyncInProgress)return F("Data sync in in progress"),Bt(x.sdkLoopTime,e),Promise.resolve();if(window.reinitializationInProgress)return F("Reinit is in progress"),Bt(x.sdkLoopTime,e),Promise.resolve();var r=je(),o=function(){if(ze(r)&&window.zEventsData&&window.zEventsData.length>0&&!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=d.RECORDINGPENDING){A("Session is expired Going to recreate session"),window.reinitializationInProgress=!0,be(e);var n=c.GETUSERCONFIG;return ue()&&(n=c.POSTENDUSERINFOANDGETUSERCONFIG),Promise.resolve(yt(e,n,!0)).then(function(n){r=n,window.zrecordingPaused=!1,window.zStop=Jt(),Rt(N.REINIT,R.STREAMDATAEXPIRE),Bt(x.sdkLoopTime,e),t=1})}}();return Promise.resolve(o&&o.then?o.then(n):n(o))}catch(e){return Promise.reject(e)}},At=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{xt(r,1,i(this.v))}catch(e){xt(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?xt(r,1,t?t(o):o):n?xt(r,1,n(o)):xt(r,2,o)}catch(e){xt(r,2,e)}},r},e}();function Ft(e){return e instanceof At&&1&e.s}var _t=5,Mt=function(e,t){void 0===t&&(t={releaseVer:"",rootDomain:""});try{try{if(void 0!==window.sdkInit&&window.sdkInit!==Ge.Failed)return Promise.resolve();var n=de.getInstance();if(window.sdkInit=Ge.Progress,n.saveOptions(t),L=x.debugLogs,nt()){if(function(){try{return window.top.window.zipy?(F("Zipy is present in parent"),!0):(F("Zipy is not present in parent"),!1)}catch(e){return M("Error in is same origin method. Error - "+(e?e.message:e)),!1}}())return A("Not initializing sdk as function is called inside iframe."),Promise.resolve();if(!function(e){var t=null;try{var n,r,o=null==e||null==(n=e.window)||null==(n=n.top)?void 0:n.document;t=null==o||null==(r=o.body)?void 0:r.innerHTML}catch(e){F("iframe is cross-domain")}return null!==t}(window.self)&&Be&&!n.recordOnlyIframe){window.recordingStatus||(window.recordingStatus=!1);try{window.onload=function(){F("Iframe content loaded!"),window.parent.postMessage({action:z},"*")}}catch(e){M("not able to notify about iframe content loaded event:")}var r=e;try{A("init: We will start recording cross-origin iframe now!"),function(e,t){window.addEventListener("message",function(n){try{var r,o;(null==n||null==(r=n.data)?void 0:r.action)===S&&(null==n||null==(o=n.data)||null==(o=o.config)?void 0:o.apiKey)==e&&!0!==window.recordingStatus&&(F("going to init iframe recording"),t.push(zt(n.data.config.inputMasking)),window.sdkConfig=n.data.config,window.recordingStatus=!0)}catch(e){M("cannot start recording for iframe:")}try{var i;(null==n||null==(i=n.data)?void 0:i.action)==I&&!1!==window.recordingStatus&&(F("going to stop recording for iframe"),window.stopRecording=!0,t.forEach(function(e){return e()}),window.recordingStatus=!1)}catch(e){M("failed to stop iframe recording:")}})}(r,[])}catch(e){M(e.message)}return Promise.resolve()}}var o=new RegExp(/^[a-zA-Z0-9]{8}$/);if(!e||!o.test(e))return M("Not able to process as sdk api key null or invalid."),Promise.resolve();window.zRelVer=t.releaseVer,window.zsdkKey=e,function(){try{for(var e=Object.keys(localStorage),t=0;t<e.length;t++)["zsession-blocked-info","session-data","zId","zenduser-info-temp","zenduser-info","last-activity-time","pack","zsdk-config","is-api-key-valid","zenduser-last-activity-time","ztotal-data-sent"].includes(e[t])&&(j.set(e[t],localStorage.getItem(e[t])),A("updated value in map is :"+j.get(e[t])))}catch(e){M("inside zLocalStorgeMapUpdate catch block ${e.message}")}}(),function(e){var t=[];try{var n=K.getInstance();window.isDataSyncInProgress=!1,window.iszInternetDisconnected=!1,n.lastActivityTime=Date.now(),window.buffered=!0,Re(),n.enduserLastActivityTime=Ce(),n.enduserLastActivityTime||(n.enduserLastActivityTime=Date.now()),window.zrecordingPaused=!1,window.ztryForHandshake=!1,n.isSessionExpired=!1,window.zrrwebRecorderStatus=d.NORECORDING;var r=de.getInstance();mt.getInstance().sdkTimer=D.START,vt("zTId")||gt("zTId",Math.floor(1e4*Math.random()).toString());var o=X()||{},i=vt("pending-zEvents");if(i&&!ze(o))try{var s;s=a.default.decompressFromUTF16(i),window.zEventsData=JSON.parse(s)}catch(e){M("Failed to parse pendingEvents")}finally{!function(e){try{window.sessionStorage.removeItem("pending-zEvents")}catch(e){console.error("inside zSessionStorageRemoveItem catch block "+e.message)}}()}var l=Q();l&&l.apiKey==e||$(e),F("Zipy Recorder init"),Ne(e)&&(te()?(A("Removing enduser-info"),V("zenduser-info")):A("zenduser Data dosen't exists"),ie());var f=c.GETUSERCONFIG;if(!te()&&!ne()){f=c.POSTENDUSERINFOANDGETUSERCONFIG;var p=ee(),v={euId:0,euZName:"",userType:u.ANONYMS,isBlocked:!1,zExternalUserInfo:{},zAnonymsUserInfo:{zId:p,euId:0,euZName:""}};oe(v),re(v)}ue()&&(f=c.POSTENDUSERINFOANDGETUSERCONFIG);var m=!1;r.rootDomain&&xe(e),(ze(o)||Ne(e))&&(be(e),m=!0),Rt(N.INIT,R.PAGELOAD),yt(e,f,m).then(function(n){if(window.lastSyncTime=0,window.perfLastSyncTime=0,window.clickLastSyncTime=0,window.pagePerfLastSynctime=0,window.customEventLastSynctime=0,null!=n&&n.captureUTM&&function(e){try{var t=K.getInstance(),n=new URL(e),r=je();if(c=n.searchParams,U.some(function(e){return c.has(e)})){var o=[];if(r.sessionStitching){var i=Oe(t.apiKey+g.utms);i&&"undefined"!==i&&(o=JSON.parse(decodeURIComponent(i)))}else{var s=W("zUTMParams");s&&"undefined"!==s&&(o=JSON.parse(s))}o.find(function(e){return e===n.searchParams.toString()})||o.push(n.searchParams.toString());var a=JSON.stringify(o);H("zUTMParams",a),r.sessionStitching&&Pe(t.apiKey+g.utms,encodeURIComponent(a))}}catch(e){M("Error in handling UTM")}var c}(window.location.href),n.domCapture){var r=zt(n.inputMasking);t.push(r)}t.push(Ct());try{window.addEventListener("message",function(e){var t;(null==e||null==(t=e.data)?void 0:t.action)===z&&!0!==window.stopRecording&&Pt(n,e)})}catch(e){M("failed to start recording for iframe content loaded event")}Pt(n),window.zStop=function(){try{window.stopRecording=!0,t.forEach(function(e){return e()}),_("Calling zipy Stop Recorder"),Dt()}catch(e){M("Failed to stop recording")}},window.sdkInit=Ge.Completed,Bt(x.sdkLoopTime,e),function(e){var t=de.getInstance();document.addEventListener("visibilitychange",function(n){try{var r=je();if(t.rootDomain&&r.sessionStitching)try{document.hidden?Le(e):xe(e)}catch(e){M("Failed to set CookieData on tab visibility. Error - "+e.message)}var o=function(){if("visible"===document.visibilityState)try{if(window.zrecordingPaused=!1,ze(e)){var t=window.zStop;t&&t(),window.stopRecording=!1;var n=je();window.zStop=zt(n.inputMasking)}else window.reinitializationInProgress=!0,window.buffered=!1,window.zStop=Jt(),Rt(N.REINIT,R.VISIBLE),A("reinitializing the session on tabActive event")}catch(e){M("Failed to reinit on tab visibility. Error - "+e.message)}else{Rt(N.PAGE_OUT,R.NA);var r=mt.getInstance(),o=je(),i=window.zStop;i&&i();var s=function(t,n){try{var i=function(){function t(){window.zEventsData=[]}var n=r.dataSync!==O.PENDING&&!ze(o)&&!window.iszInternetDisconnected&&window.zEventsData&&window.zEventsData.length>0&&window.zrrwebRecorderStatus!==d.RECORDINGPENDING,i=function(){if(n){var t,r=0,o=function(e,t,n){for(var r;;){var o=e();if(Ft(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!Ft(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!Ft(s)){r=2;break}}}var a=new At,c=xt.bind(null,a,2);return(0===r?o.then(d):1===r?i.then(u):s.then(l)).then(void 0,c),a;function u(r){i=r;do{if(t&&(s=t())&&s.then&&!Ft(s))return void s.then(l).then(void 0,c);if(!(o=e())||Ft(o)&&!o.v)return void xt(a,1,i);if(o.then)return void o.then(d).then(void 0,c);Ft(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,c)}function d(e){e?(i=n())&&i.then?i.then(u).then(void 0,c):u(i):xt(a,1,i)}function l(){(o=e())?o.then?o.then(d).then(void 0,c):d(o):xt(a,1,i)}}(function(){return!t&&r<5},void 0,function(){return Promise.resolve(It(e)).then(function(e){e&&0!==window.zEventsData.length?r++:t=1})});if(o&&o.then)return o.then(function(){})}}();return i&&i.then?i.then(t):t()}()}catch(e){return n(e)}return i&&i.then?i.then(void 0,n):i}(0,function(e){M("Failed to send the pending rrweb events. Error - "+e.message)});if(s&&s.then)return s.then(function(){})}}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})}(e),function(e){var t=de.getInstance();window.addEventListener("beforeunload",function(n){var r=je();try{if(window.zEventsData&&window.zEventsData.length&&window.zrrwebRecorderStatus!==d.RECORDINGPENDING){var o=JSON.stringify(window.zEventsData);gt("pending-zEvents",a.default.compressToUTF16(o))}}catch(e){M("Failed to set data in session storage on tab beforeunload. Error - "+e.message)}try{t.rootDomain&&r.sessionStitching&&Le(e)}catch(e){M("Failed to set CookieData on tab beforeunload. Error - "+e.message)}})}(e),window.addEventListener("storage",function(e){var t=K.getInstance();if("session-data"===e.key){var n=JSON.parse(e.newValue),r=JSON.parse(e.oldValue);if(n.sessionId!==r.sessionId&&""!==n.sessionId){var o=parseInt(W("last-activity-time")),i=parseInt(W("zenduser-last-activity-time")),s=JSON.parse(W("zsession-blocked-info")),a=JSON.parse(W("session-data"));t.apiKey=a.sdkKey,t.isNewSession=a.isNewSession,t.sessionId=a.sessionId,t.enduserLastActivityTime=i,t.isSessionExpired=!1,t.lastActivityTime=o,t.sessionBlockInfo=s}}})}).catch(function(e){window.sdkInit=Ge.Failed,M("Failed to get get sdk config from server: ")})}catch(e){M(e)}}(e)}catch(e){M("Not able to init SDK: "+e.message)}return Promise.resolve()}catch(e){return Promise.reject(e)}},qt=function(e,t){void 0===t&&(t={});try{if(!de.getInstance().recordOnlyIframe&&window.self!==window.parent)return}catch(e){M(e.message?e.message:e)}try{if(window.sdkInit!==Ge.Completed)return M("Identify: SDK not initialized"),void setTimeout(function(){A("Calling identify again after 10 seconds"),function(e,t,n){void 0===t&&(t={}),(_t-=1)>0?qt(e,t):M("Identify session retries count exceeded")}(e,t)},1e4);if(!e||"string"!=typeof e||e.length<=0||e.trim().length<=0)return void M("Got wrong external UUID, Please validate: "+e);A("identify :: externalUUId - "+e);var n=te(),r=Ie()||{},o=c.POSTENDUSERINFO,i=t;i.externalId=e;var s=!1;if(n){var a;n.userType==u.ANONYMS||(f=null==(a=n)?void 0:a.zExternalUserInfo,p=i,A("NewEndUserInfo :: "+JSON.stringify(p)),A("PrevEndUserInfo :: "+JSON.stringify(f)),(null==f?void 0:f.externalId)===(null==p?void 0:p.externalId)?o=c.POSTENDUSERINFOANDGETUSERCONFIG:(n.euId=0,n.euZName="",n.userType=u.ANONYMS,n.isBlocked=!1,s=!0,o=c.POSTENDUSERINFOANDGETUSERCONFIG,be(r.sdkKey),window.reinitializationInProgress=!0))}else{var d=ee();n={euId:0,euZName:"",userType:u.ANONYMS,isBlocked:!1,zExternalUserInfo:{},zAnonymsUserInfo:{zId:d,euId:0,euZName:""}}}window.iszHandshakeDone||(o=c.POSTENDUSERINFOANDGETUSERCONFIG),n.zExternalUserInfo=i,oe(n);var l=Q();l&&r?!s&&l.isBlocked?A("No need to do backend call if session is blocked"):yt(r.sdkKey,o,s).then(function(e){s&&(window.zStop=Jt(),Rt(N.REINIT,R.IDENTIFY))}).catch(function(e){M("Failed to post/get sdk config from server: ")}):M("Value doesn't exists in sessionBlockInfo or sessionData : ")}catch(e){M("Not able to identify SDK: "+e.message)}var f,p},Gt=function(){try{if(!de.getInstance().recordOnlyIframe&&window.self!==window.parent)return}catch(e){M(e.message?e.message:e)}if(window.sdkInit===Ge.Completed){A("Going to anonymize end user");var e,t=!1;(se()||((e=ne())?e.userType===u.IDENTIFIED:(A("zenduser-info doesn't exists"),0)))&&(t=!0);var n=function(){var e=te();return e?(e.zExternalUserInfo={},e.userType=u.ANONYMS,ce(e,!1),e):(A("zenduser Data dosen't exists"),function(){var e=ne();if(e)return e.zExternalUserInfo={},e.userType=u.ANONYMS,ce(e,!0),e;A("zenduser Data dosen't exists in temp storage")}())}()||{},r=c.GETUSERCONFIG;0===n.euId?(r=c.POSTENDUSERINFOANDGETUSERCONFIG,oe(n),re(n)):(re(n),ie());var o=Ie();o&&t?(window.reinitializationInProgress=!0,be(null==o?void 0:o.sdkKey),yt(null==o?void 0:o.sdkKey,r,!0).then(function(e){window.zStop=Jt(),Rt(N.REINIT,R.ANONYMIZE)}).catch(function(e){M("Failed to post/get sdk config from server: ")})):A("Identified user doesn't exists in system No need to break session")}else M("Anonymize: SDK not initialized")};function Jt(e){var t=[];try{if(F("Zipy Recorder Reinit"),window.sdkConfig=X(),window.isDataSyncInProgress=!1,!window.stopRecording){A("Going to stop recording ");var n=window.zStop;n&&n()}window.iszInternetDisconnected=!1,Re(),window.stopRecording=!1,window.zrecordingPaused=!1;var r=je();if(r.domCapture){var o=zt(r.inputMasking);t.push(o)}return t.push(Ct()),Pt(r),window.reinitializationInProgress=!1,function(){try{window.stopRecording=!0,_("Calling zipy Stop Recorder"),t.forEach(function(e){return e()}),Dt()}catch(e){M("Failed to stop recording")}}}catch(e){M(e)}return function(){}}function Bt(e,t){mt.getInstance().sdkTimer===D.START&&setTimeout(Lt,e,t)}var Zt=function(){try{if(!de.getInstance().recordOnlyIframe&&window.self!==window.parent)return""}catch(e){M(e.message?e.message:e)}try{var e=je(),t=W("zsession-blocked-info"),n=JSON.parse(t);if(window.sdkInit!==Ge.Completed||n.is_blocked)return M("SessionLink: SDK not initialized"),"";var r=Ie()||{},o=W("zId");return e.customerId?x.sessionLinkUrl+"/"+r.sdkKey+"/"+e.customerId+"?is_error=false&id="+o+"&euid="+r.sessionId:(M("SessionLink: Could not find customer id"),"")}catch(e){return M("Error in generating session url. Error is - "+e.message),""}},jt=function(e,t){try{var n=je();if(!n||n&&!n.captureCustomZipyLogMessage)return void A("Custom Zipy Message not enabled.");if(e&&"string"==typeof e){var r=new CustomEvent(y,{detail:{message:e,options:t}});window.dispatchEvent(r)}else F("Mandatory params missing for zipy logs")}catch(e){F("Error in capturing zipy logs. Error - "+e.message)}},Wt=function(e){try{var t=je();if(!t||t&&!t.captureCustomZipyLogMessage)return void A("Custom Zipy Exception not enabled.");if(e){var n=new CustomEvent(w,{detail:{error:e instanceof Error?e:{message:String(e)}}});window.dispatchEvent(n)}else F("Mandatory params missing for zipy exception missing")}catch(e){F("Error in capturing zipy exception event. Error - "+e.message)}},Ht=function(e,t,n,r){try{var o=je();if(!o||o&&!o.captureCustomZipyLogError)return void A("Custom Zipy Error not enabled.");if(e&&t&&"string"==typeof e&&"string"==typeof t){var i=new CustomEvent(h,{detail:{name:e,message:t,category:n,options:r}});window.dispatchEvent(i)}else F("Mandatory params missing for zipy error logs")}catch(e){M("Error in capturing zipy error event. Error - "+e.message)}},Vt=function(){try{if(!de.getInstance().recordOnlyIframe&&window.self!==window.parent)return[]}catch(e){M(e.message?e.message:e)}try{var e=je(),t=K.getInstance(),n=[];if(null!=e&&e.captureUTM)if(e.sessionStitching){var r=Oe(t.apiKey+g.utms);r&&"undefined"!==r&&(n=JSON.parse(decodeURIComponent(r)))}else{var o=W("zUTMParams");o&&(n=JSON.parse(o))}return n}catch(e){return M("Error in getting utm params. Error is - "+e.message),[]}},Kt={stop:Ut.getInstance().stop.bind(Ut.getInstance())},Xt=function(e,t){void 0===t&&(t={});try{if(window.sdkInit!==Ge.Completed)throw new Error("SDK is not initialized");var n=je();if(!n.captureCustomEvents)return;var r=function(e){var t=e.eventName,n=e.properties,r=e.maxLength,i=e.maxPayloadSize;if(!t.trim()||t.length>255)throw new Error("Event name doesn't meet the requirement.");for(var s={},a=0,c=Object.entries(n);a<c.length;a++){var u=c[a],d=u[0],l=u[1];if(("number"==typeof l||"boolean"==typeof l||"string"==typeof l&&l.trim().length<255||Array.isArray(l)&&l.length>0&&l.length<r)&&(s[d]=l,Object.keys(s).length>=r))break}if(2*JSON.stringify(s).length>i)throw new Error("Max Payload limit exceeded.");return{data:{eventName:t,properties:s},type:o.CustomEvent,time:Date.now()}}({eventName:e,properties:t,maxLength:n.maxCustomEventProperties,maxPayloadSize:n.maxCustomEventPayloadSize});i=r,s=je(),window.zrecordingPaused||Nt()&&!ze(s)||Ee()&&window.zCustomEventData.push(i),Tt({data:JSON.stringify(r.data),type:o.CustomEvent,time:r.time,isError:!1,navigatedUrl:window.location.origin+window.location.pathname})}catch(e){M("Custom Events: Failed to send custom event. Error - "+e.message)}var i,s},Yt={init:Mt,identify:qt,anonymize:Gt,getCurrentSessionURL:Zt,logError:Ht,logException:Wt,logMessage:jt,logEvent:Xt,extractUTMParameters:Vt,record:Kt};exports.anonymize=Gt,exports.default=Yt,exports.extractUTMParameters=Vt,exports.getCurrentSessionURL=Zt,exports.identify=qt,exports.init=Mt,exports.logError=Ht,exports.logEvent=Xt,exports.logException=Wt,exports.logMessage=jt,exports.record=Kt;