c1031ce2f6e20f00f53de0f4113c5a339db6ef6a1b5c97b3a38dc672d2e8357a

Source Code:

window.Hawkeye=function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,n){var r=n(4).default,o=n(3).default,i=new WeakMap;function a(){o.setPrivate(i,this,new r)}var s=new(Object.defineProperty(a.prototype,"configure",{get:function(){return o.getPrivate(i,this).configure},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"reconfigure",{get:function(){return o.getPrivate(i,this).reconfigure},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"trackEnd",{get:function(){return o.getPrivate(i,this).trackEnd},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"trackStart",{get:function(){return o.getPrivate(i,this).trackStart},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"log",{get:function(){return o.getPrivate(i,this).log},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"logAPI",{get:function(){return o.getPrivate(i,this).logAPI},enumerable:!0,configurable:!0}),a);e.exports=s},function(e,t){void 0!==window.requestIdleCallback&&(window.requestIdleCallback=function(e){return setTimeout(e,0)})},function(e,t){var n;window.requestIdleCallback=window.requestIdleCallback||function(e){return setTimeout(e,0)},window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)},"localStorage"in window||Object.defineProperty(window,"localStorage",{value:(n={},{getItem:function(e){return n[e]},setItem:function(e,t){n[e]=t}})})},function(e,t,n){"use strict";n.r(t);var r={setPrivate:function(e,t,n){e.set(t,n)},getPrivate:function(e,t){return e.get(t)}};t.default=r},function(e,t,n){"use strict";n.r(t);var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function i(i,a,s,u){return new(s=s||Promise)(function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(n,r)}o((u=u.apply(i,a||[])).next())})}function l(n,r){var o,i,a,e,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(a=2&t[0]?i.return:t[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,t[1])).done)return a;switch(i=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,i=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(n,s)}catch(e){t=[6,e],i=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function a(e){var t={};try{t=e&&JSON.parse(e)}catch(e){console.log("Error in store:",e)}return t||{}}function s(e){return!Object.keys(e).length}var f=function(e){return e?"object"==typeof e?JSON.stringify(e):e.toString():""},u="jsError",g="apiError",d="apiLog",p="localError",h="loadMetrics",v="pageNavigationTime",m="unhandledPromiseRejection",y="pageNavigationStart",b="pageNavigationEnd",w="pending",P={STAGING:"staging",PRODUCTION:"production",DEVELOPMENT:"development"},L="JSON",T="noJson",k="__hawkeye",S="events",I=function(e,t){try{var n=a(localStorage.getItem(k));n[e]=t,localStorage.setItem(k,f(n))}catch(e){console.warn("Not able to set items in localStorage",e)}},O=function(e){return a(localStorage.getItem(k))[e]},E=function(n){return"object"==typeof n&&n&&s(n)?null:(Object.keys(n).forEach(function(e){if(e){var t=e;"object"==typeof n[t]?n[t]?(E(n[t]),s(n[t])&&delete n[t]):delete n[t]:function(t){return[null,void 0,""].some(function(e){return t===e})}(n[t])&&delete n[t]}}),n)},j=function(){return window.location.href},C=function(){return(new Date).toISOString()},M=window,A={options:[],header:[navigator.platform,navigator.userAgent,navigator.appVersion,navigator.vendor,M.opera],dataos:[{name:"Windows Phone",value:"Windows Phone",version:"OS"},{name:"Windows",value:"Win",version:"NT"},{name:"iPhone",value:"iPhone",version:"OS"},{name:"iPad",value:"iPad",version:"OS"},{name:"Kindle",value:"Silk",version:"Silk"},{name:"Android",value:"Android",version:"Android"},{name:"PlayBook",value:"PlayBook",version:"OS"},{name:"BlackBerry",value:"BlackBerry",version:"/"},{name:"Macintosh",value:"Mac",version:"OS X"},{name:"Linux",value:"Linux",version:"rv"},{name:"Palm",value:"Palm",version:"PalmOS"}],databrowser:[{name:"Chrome",value:"Chrome",version:"Chrome"},{name:"Firefox",value:"Firefox",version:"Firefox"},{name:"Safari",value:"Safari",version:"Version"},{name:"Internet Explorer",value:"MSIE",version:"MSIE"},{name:"Opera",value:"Opera",version:"Opera"},{name:"BlackBerry",value:"CLDC",version:"CLDC"},{name:"Mozilla",value:"Mozilla",version:"Mozilla"}],init:function(){var e=this.header.join(" ");return{os:this.matchItem(e,this.dataos),browser:this.matchItem(e,this.databrowser)}},matchItem:function(e,t){var n,r,o,i=0,a=0;for(i=0;i<t.length;i+=1)if(new RegExp(t[i].value,"i").test(e)){if(n=new RegExp(t[i].version+"[- /:;]([\\d._]+)","i"),o="",(r=e.match(n))&&r[1]&&(r=r[1]),r){var s=r.split(/[._]+/);for(a=0;a<s.length;a+=1)o+=s[a],s[a+1]&&(o+=".")}else o="0";return{name:t[i].name,version:o}}return{name:"unknown",version:0}}}.init(),q={osType:A.os.name,osVersion:A.os.version,deviceName:A.browser.name,browserVersion:A.browser.version},_=function(){var e=navigator;return"object"==typeof e.connection?e.connection.downlink:""},R={enableHighAccuracy:!0,timeout:5e3,maximumAge:0},N=function(){return new Promise(function(o){navigator.permissions&&navigator.permissions.query?navigator.permissions.query({name:"geolocation"}).then(function(e){"granted"===e.state&&navigator.geolocation&&navigator.geolocation.getCurrentPosition?navigator.geolocation.getCurrentPosition(function(e){var t=e.coords,n=t.latitude,r=t.longitude;o({lat:n,lon:r})},function(){return o({})},R):o({})}):o({})})},H=function(){return i(void 0,void 0,void 0,function(){var t;return l(this,function(e){return"function"==typeof(t=navigator).getBattery?[2,t.getBattery().then(function(e){return Math.round(100*e.level)})]:[2,-1]})})},x=function(){var e=navigator;return"object"==typeof e.connection?e.connection.effectiveType:""},D=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)?"mweb":"web",U=function(){return i(void 0,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t={},[4,N()];case 1:return t.location=e.sent(),[4,H()];case 2:return[2,c.apply(void 0,[c.apply(void 0,[(t.batteryPercentage=e.sent(),t.networkSpeed=_(),t.networkType=x(),t.pageURL=j(),t),q]),{timestamp:C(),deviceType:D}])]}})})},F={apiInProgress:0},B={navigationStartTime:0,referrer:""},z=B;function V(e){var r=this;this.saveLogs=function(e){var t=E(e);t&&(t.id=Math.random().toString(36).slice(2)||null);var n=O(S)||[];n.length<50||n.shift(),n.push(t),I(S,n),r.config.enableConsoleLogging&&console.log("%cHawkeye Event%O","color:white;  background: #012b72",t),z.navigationStartTime=0,z.referrer=""},this.config=e}var J=(V.prototype.setConfig=function(e){this.config=e},V.prototype.addLog=function(n){return i(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,function(n,r){return i(void 0,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,U()];case 1:return t=e.sent(),[2,{appVersion:"1.1.2",appVersionCode:r.appVersionCode||"",batteryPercentage:t.batteryPercentage,errorCode:n.meta.errorCode||"",eventType:n.type,errorMsg:n.meta.errorMsg||"",flowName:r.logsMeta.flowName,mid:r.mid||"",transactionId:r.transactionId||"",location:{lat:t.location.lat||"",lon:t.location.lon||""},webData:{browserName:t.deviceName,browserVersion:t.browserVersion,redirectionTime:n.meta.redirectionTime,dnsLookupTime:n.meta.dnsLookupTime,tcpHandshakeTime:n.meta.tcpHandshakeTime,timeToFirstByte:n.meta.timeToFirstByte,firstPaintTime:n.meta.firstPaintTime,pageLoadTime:n.meta.pageLoadTime,url:n.meta.webUrl||t.pageURL,referrer:n.meta.referrer,navigationTime:n.meta.navigationTime},id:"",status:"",metricConnectionTime:"",metricDomainlookupTime:"",metricRequestTime:"",metricResponseTime:"",metricSecureConnectionTime:"",metricTotalTime:"",networkType:t.networkType,networkSpeed:t.networkSpeed,requestSize:n.meta.requestLength||"",requestMethod:n.meta.requestMethod||"",responseCode:void 0!==n.meta.status?n.meta.status:"",responseSize:n.meta.responseSize,responseTime:n.meta.responseTime||"",responseType:n.meta.responseType||"",screenName:r.logsMeta.screenName,storageFreePercentage:"",timestamp:t.timestamp,uri:n.meta.url||"",userFacing:!0,verticalName:r.logsMeta.verticalName||"",customMessage:n.meta.message}]}})})}(n,this.config)];case 1:return t=e.sent(),(!this.config.shouldSendCallback||"function"==typeof this.config.shouldSendCallback&&this.config.shouldSendCallback(t))&&this.saveLogs(t),[2]}})})},V);function X(e,t){void 0===t&&(t={}),this.type=e,this.meta=t}function G(e){return f(e).substring(0,1024)}function W(r,o){return i(void 0,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,U()];case 1:return t=e.sent(),(n=JSON.parse(JSON.stringify(r))).forEach(function(e){delete e.id,delete e.status}),[2,{clientId:"webapp",osType:t.osType,osVersion:t.osVersion,userId:o.userId||"",deviceType:t.deviceType,events:n}]}})})}var Q=(X.prototype.add=function(e,t){this.meta[e]=t},X);function Y(a,s,u){return i(this,void 0,void 0,function(){var t,n,r,o,i;return l(this,function(e){switch(e.label){case 0:return[4,W(s,u)];case 1:return t=e.sent(),n=u.loggingUrl?u.loggingUrl:a,r={"Content-Type":"application/json",authorization:function(e){switch(e){case P.PRODUCTION:return"Basic d2ViLXByb2Q6UFZlOGtmVVNpRG81SUJuTW9DdlFaRHdjaDd4MGhxYmY=";case P.STAGING:default:return"Basic aW9zLXByb2Q6OUpSM0hiMnQ4UDllWHJiRlAwM05FOHBmUEo3WDh0dEw="}}(u.env)},o=u.customHeader?c(c({},r),u.customHeader):r,i={method:"POST",headers:o,body:JSON.stringify(t),avoidFlag:!0},window.fetch(n,i).then(function(e){if(200<=e.status&&e.status<=305){var t=O(S).filter(function(t){return!s.some(function(e){return e.id===t.id})});I(S,t)}}).catch(function(){var t=[],e=O(S),n=e.filter(function(t){return!s.some(function(e){return e.id===t.id})});e.filter(function(t){return s.some(function(e){return e.id===t.id})}).forEach(function(e){e.status===w&&(delete e.status,t.push(e))}),I(S,function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}(t,n))}),[2]}})})}function K(e){if(e.env!==P.DEVELOPMENT){var t=O(S)||[],n=[],r=function(e){var n=Date.now();return e.some(function(e){var t=new Date(new Date(e.timestamp));return 36e5<n-t.getTime()})}(t);if(t.forEach(function(e){e.status!==w&&(e.status=w,n.push(e))}),$.apiInProgress<3&&n&&(3<n.length||r)){var o=function(e){return{userId:e.user?e.user.id:"",email:e.user?e.user.email:"",name:e.user?e.user.name:"",loggingUrl:e.loggingUrl?e.loggingUrl:"",customHeader:e.headers?e.headers:{},env:e.env}}(e);I(S,t),Y(function(e){return e===P.PRODUCTION?"https://accounts-analyticsapp.paytm.com/appdebuganalytics/triggers/save":"https://hawkeye-staging.paytm.com/appdebuganalytics/triggers/save"}(e.env),n,o)}}}var Z,$=F;function ee(){var t=null!==Z&&Z.apply(this,arguments)||this;return t.initializeErrorEvent=function(){window.addEventListener("error",t.onError)},t.onError=function(e){window.requestIdleCallback(function(){t.config.logJSError&&t.handleError({errorMsg:G(e.message),message:G(e.error&&e.error.stack)})})},t}function te(e){return/\.(css(\.map)?|js(\.map)?|jpg|jpeg|png|gif)(\?.*)?$/i.test(e)}var ne,re=(o(ee,Z=J),ee.prototype.handleError=function(n){return i(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=new Q(u,n),[4,this.addLog(t)];case 1:return e.sent(),this.sync(),[2]}})})},ee.prototype.start=function(){this.initializeErrorEvent()},ee.prototype.sync=function(){K(this.config)},ee),oe=function(e){return 200<=e&&e<=305},ie=function(e){var t={};if(e instanceof Headers)for(var n=e.keys(),r=n.next();r.value;)t[r.value]=e.get(r.value),r=n.next();else"object"==typeof e&&(t=e);return t},ae={trackStart:function(){return window.performance.now()},trackEnd:function(e){return Math.round(window.performance.now()-e)}},se=F;function ue(){var a=null!==ne&&ne.apply(this,arguments)||this;return a.getXHRRequestData=function(e){var t={};return t.url=e.url,t.method=e.requestMethod,t.status=e.status,t.json=e.responseBody,t.headers=e.resHeaders,t.responseTime=ae.trackEnd(e.startTime),t.responseType=-1<e.resHeaders.toLowerCase().indexOf("content-type: application/json")?L:T,t.requestLength=f(e.reqHeaders).length+f(e.body).length,t},a.handleXMLHttp=function(e,t){var n=e.currentTarget;if((!oe(n.status)||a.config.logApiRequests)&&(oe(n.status)||a.config.logApiErrors)){se.apiInProgress-=1;var r=a.getXHRRequestData({url:t.__url,requestMethod:t.__requestMethod,responseBody:n.response,startTime:t.__startTime,reqHeaders:t.__headers,resHeaders:n.getAllResponseHeaders(),status:n.status,body:t.__body}),o=a.getAPILogData(r);a.sync(),te(t.__url)||a.handleLogs(o,o.type)}},a.logAPIResponse=function(e,t,n,r){var o=!0;e.responseTime=ae.trackEnd(t);var i=a.getAPILogData(e);se.apiInProgress-=1,n(e),(oe(e.status)&&!a.config.logApiRequests||!oe(e.status)&&!a.config.logApiErrors)&&(o=!1),o&&e.url&&!te(e.url)&&!r&&a.handleLogs(i,i.type)},a.handleAPIResponse=function(s,u){return i(a,void 0,void 0,function(){var r,o,a;return l(this,function(e){switch(e.label){case 0:return r=u.avoidFlag,o=u.url,a=this,se.apiInProgress+=1,[4,new Promise(function(t){var n=ae.trackStart(),i={url:o,requestLength:0};s.then(function(e){var t=e.clone();i.status=t.status;var n,r=f(u.headers).length,o=f(u.body).length;i.requestLength+=r+o,i.headers=ie(t.headers),i.method=u.method,i.responseType=i.headers["content-type"].startsWith("application/json")?L:T;try{n=t.json()}catch(e){n=t.text()}return n}).then(function(e){i.json=e,a.logAPIResponse(i,n,t,r)}).catch(function(e){i.json=e,a.logAPIResponse(i,n,t,r)})})];case 1:return e.sent(),[2]}})})},a.getAPILogData=function(e){var t=c({},e);return t.status&&oe(t.status)?t.type=d:(t.type=g,t.errorCode=t.status,t.errorMsg=f(e.json)),t.responseSize=f(t.json).length+f(t.headers).length,t.responseCode=e.status,t.requestMethod=e.method||"GET",t},a.validateAPILog=function(e){var t={valid:!0,errors:[]};return e.trackId||(t.valid=!1,t.errors.push("trackId is missing")),e.request&&e.request.url||(t.valid=!1,t.errors.push("url is missing")),e.response&&e.response.statusCode||(t.valid=!1,t.errors.push("statusCode is missing")),t},a.formatLogData=function(e){var t,n=e.trackId,r=e.response,o=e.request;return{url:o.url,method:o.method,status:r.statusCode,json:r.body,responseTime:n?ae.trackEnd(n):0,headers:ie(r.headers),requestLength:f(o.headers).length+f(o.body).length,responseType:(t=r.headers,void 0===t&&(t={}),(t["content-type"]||t["Content-Type"]||"").toLowerCase().startsWith("application/json")?L:T)}},a}var ce,le=(o(ue,ne=J),ue.prototype.initializeXMLHttpRequestInterceptor=function(){var r=window.XMLHttpRequest.prototype.open,n=window.XMLHttpRequest.prototype.setRequestHeader,t=window.XMLHttpRequest.prototype.send,o=this;window.XMLHttpRequest.prototype.setRequestHeader=function(e,t){this.__headers||(this.__headers={}),this.__headers[e]=t,n.apply(this,arguments)},window.XMLHttpRequest.prototype.send=function(e){se.apiInProgress+=1,this.__body=e,t.apply(this,arguments)},window.XMLHttpRequest.prototype.open=function(e,t){var n=this;this.__url=t,this.__requestMethod=e,this.__startTime=ae.trackStart(),this.addEventListener("error",function(e){o.handleXMLHttp(e,n)}),this.addEventListener("load",function(e){o.handleXMLHttp(e,n)}),r.apply(this,arguments)}},ue.prototype.initializeFetchInterceptor=function(){var n=window.fetch,r=this;window.fetch=function(){var e=n.apply(null,arguments),t={url:arguments[0],method:arguments[1]&&arguments[1].method,avoidFlag:arguments[1]&&arguments[1].avoidFlag};return r.handleAPIResponse(e,t),e}},ue.prototype.handleLogs=function(n,r){var e=this;window.requestIdleCallback(function(){return i(e,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=new Q(r,n),[4,this.addLog(t)];case 1:return e.sent(),this.sync(),[2]}})})})},ue.prototype.start=function(){this.initializeXMLHttpRequestInterceptor(),this.initializeFetchInterceptor()},ue.prototype.logAPI=function(e){var t=this.validateAPILog(e);if(t.valid){var n=this.formatLogData(e),r=this.getAPILogData(n);return this.handleLogs(r,r.type),{success:!0}}return t},ue.prototype.sync=function(){K(this.config)},ue);function fe(){var o=null!==ce&&ce.apply(this,arguments)||this;return o.initializeListener=function(){window.addEventListener("unhandledrejection",function(r){window.requestIdleCallback(function(){if(o.config.logJSError){var e=r.reason,t=void 0,n=e;"object"==typeof e&&(n=e.stack?(t=e.stack,e.message):JSON.stringify(e)),o.handleError({errorMsg:G(n),message:G(t)})}})})},o}var ge,de=(o(fe,ce=J),fe.prototype.handleError=function(n){return i(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=new Q(m,n),[4,this.addLog(t)];case 1:return e.sent(),this.sync(),[2]}})})},fe.prototype.start=function(){this.initializeListener()},fe.prototype.sync=function(){K(this.config)},fe),pe=function(e,t){return void 0===t&&(t=0),Number(e.toFixed(t))};function he(){var l=null!==ge&&ge.apply(this,arguments)||this;return l.initializeLogsEvent=function(){window.addEventListener("load",function(){window.performance?window.requestIdleCallback(function(){var e=window.performance,t=e.getEntriesByType("navigation"),n=e.getEntriesByType("paint"),r=t[0];if(l.config.logPerformance&&r&&n[0]){var o=pe(r.redirectEnd),i=pe(r.domainLookupEnd),a=pe(r.connectEnd),s=pe(r.responseStart),u=pe(r.domComplete),c=pe(n[0].startTime);l.handleError({redirectionTime:o,dnsLookupTime:i,tcpHandshakeTime:a,timeToFirstByte:s,firstPaintTime:c,pageLoadTime:u})}}):console.log("Performance timing isn't supported.")})},l}var ve=(o(he,ge=J),he.prototype.handleError=function(n){return i(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=new Q(h,n),[4,this.addLog(t)];case 1:return e.sent(),this.sync(),[2]}})})},he.prototype.start=function(){this.initializeLogsEvent()},he.prototype.sync=function(){K(this.config)},he);function me(e){this.config=c(c({},me.DEFAULT_CONFIG),e||{})}var ye,be=(Object.defineProperty(me.prototype,"env",{get:function(){return this.config.env},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"appVersion",{get:function(){return this.config.appVersion},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"appVersionCode",{get:function(){return this.config.appVersionCode},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"mid",{get:function(){return this.config.mid},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"transactionId",{get:function(){return this.config.transactionId},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"headers",{get:function(){return this.config.headers},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"logJSError",{get:function(){return this.config.logJSError},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"logAPIs",{get:function(){return this.config.logAPIs},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"logApiRequests",{get:function(){return this.config.logApiRequests},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"logPerformance",{get:function(){return this.config.logPerformance},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"logApiErrors",{get:function(){return this.config.logApiErrors},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"loggingUrl",{get:function(){return this.config.loggingUrl},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"logsMeta",{get:function(){return this.config.logsMeta||{}},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"shouldSendCallback",{get:function(){return this.config.shouldSendCallback},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"user",{get:function(){return this.config.user},enumerable:!0,configurable:!0}),me.prototype.getConfig=function(){return c({},this.config)},Object.defineProperty(me.prototype,"enableConsoleLogging",{get:function(){return this.config.enableConsoleLogging},enumerable:!0,configurable:!0}),me.DEFAULT_CONFIG={logJSError:!0,logAPIs:!0,logApiRequests:!0,logPerformance:!0,logApiErrors:!0,logNetworkError:!0,enableConsoleLogging:!1,env:P.PRODUCTION},me),we=(n(1),n(2),B);function Pe(){var e=null!==ye&&ye.apply(this,arguments)||this;return e.validatePayload=function(e,t){var n={valid:!0,errors:[]};switch(e){case p:t.errorMsg||t.customMessage||(n.valid=!1,n.errors.push("Please send either errorMsg or customMessage"));break;case y:break;case b:0===we.navigationStartTime&&(n.valid=!1,n.errors.push("Please log pageNavigationStart before logging pageNavigationEnd"));break;default:n.valid=!1,n.errors.push("Invalid Log Type")}return n},e.updatePayload=function(e,t){switch(e){case y:t.navigationStartTime=ae.trackStart(),we.navigationStartTime=t.navigationStartTime,t.referrer=t.url||window.location.href;break;case b:t.url=t.url||window.location.href,t.navigationEndTime=ae.trackEnd(we.navigationStartTime)}},e}function Le(){var o=this;this.logAPI=ke,this.log=ke,this.init=function(){o.APILogger=new le(o.config),o.JSLogger=new re(o.config),o.UnhandledPromiseRejectionLogger=new de(o.config),o.PerformanceLogger=new ve(o.config),o.customLogger=new Te(o.config),o.logAPI=o.APILogger.logAPI.bind(o.APILogger),o.log=o.customLogger.log.bind(o.customLogger),o.APILogger.sync(),o.config.logAPIs&&o.APILogger.start(),o.config.logJSError&&(o.JSLogger.start(),o.UnhandledPromiseRejectionLogger.start()),o.config.logPerformance&&o.PerformanceLogger.start()},this.reinit=function(){o.APILogger.setConfig(o.config),o.JSLogger.setConfig(o.config),o.UnhandledPromiseRejectionLogger.setConfig(o.config),o.PerformanceLogger.setConfig(o.config)},this.configure=function(e,t){var n=new be(e),r=o.validateConfig(n);if(!r.valid)throw new Error("Invalid Hawkeye Config: "+r.errors.join());o.setConfig(n),t?o.reinit():o.init()},this.reconfigure=function(e){if(o.config){var t=e(o.config.getConfig());o.configure(t,!0)}},this.validateConfig=function(t){var e={valid:!0,errors:[]};return Object.values(P).some(function(e){return e===t.env})||(e.valid=!1,e.errors.push("env not provided with acceptable value - Acceptable values: "+Object.values(P).join())),t.shouldSendCallback&&"function"!=typeof t.shouldSendCallback&&(e.valid=!1,e.errors.push("shouldSendCallback should be a function")),e},this.setConfig=function(e){o.config=e},Object.assign(this,ae)}var Te=(o(Pe,ye=J),Pe.prototype.handleLog=function(r,o){return i(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:if(t={},!(n=this.validatePayload(r,o)).valid)return[3,3];switch(r){case p:t=new Q(p,{errorMsg:G(o.errorMsg),message:G(o.customMessage)});break;case y:we.referrer=o.referrer;break;case b:t=new Q(v,{navigationTime:o.navigationEndTime,webUrl:o.url,referrer:we.referrer,flowName:o.flowName||""})}return 0<Object.keys(t).length?[4,this.addLog(t)]:[3,2];case 1:e.sent(),K(this.config),e.label=2;case 2:return[3,4];case 3:return[2,n.errors];case 4:return[2,null]}})})},Pe.prototype.log=function(t,n){var e=this;void 0===n&&(n={}),this.updatePayload(t,n),window.requestIdleCallback(function(){return i(e,void 0,void 0,function(){return l(this,function(e){return this.handleLog(t,n),[2]})})})},Pe),ke=Function.prototype;t.default=Le}]);