obi-sdk 0.18.32 → 0.18.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/obi-sdk.standalone.iife.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -122,4 +122,4 @@ or you can use record.mirror to access the mirror instance during recording.`,tB
|
|
|
122
122
|
`).replace(/\r/g,`
|
|
123
123
|
`);var e="",t,r,i=0,A;for(t=r=0,i=n.length,A=0;A<i;A++){var s=n.charCodeAt(A),o=null;s<128?r++:s>127&&s<2048?o=String.fromCharCode(s>>6|192,s&63|128):o=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),o!==null&&(r>t&&(e+=n.substring(t,r)),e+=o,t=r=A+1)}return r>t&&(e+=n.substring(t,n.length)),e},m.UUID=function(){try{return V.crypto.randomUUID()}catch{for(var n=new Array(36),e=0;e<36;e++)n[e]=Math.floor(Math.random()*16);return n[14]=4,n[19]=n[19]&=-5,n[19]=n[19]|=8,n[8]=n[13]=n[18]=n[23]="-",m.map(n,function(t){return t.toString(16)}).join("")}};var GB=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<GB.length;e++)if(n.indexOf(GB[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var t,r,i=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(A,s){t=encodeURIComponent(A.toString()),r=encodeURIComponent(s),i[i.length]=r+"="+t}),i.join(e)},m.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var t="[\\?&]"+e+"=([^&#]*)",r=new RegExp(t),i=r.exec(n);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var A=i[1];try{A=decodeURIComponent(A)}catch{we.error("Skipping decoding for malformed query param: "+A)}return A.replace(/\+/g," ")},m.cookie={get:function(n){for(var e=n+"=",t=ye.cookie.split(";"),r=0;r<t.length;r++){for(var i=t[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}return null},parse:function(n){var e;try{e=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,t,r,i,A,s){var o="",a="",c="";if(s)o="; domain="+s;else if(r){var u=qB(ye.location.hostname);o=u?"; domain=."+u:""}if(t){var l=new Date;l.setTime(l.getTime()+t*1e3),a="; expires="+l.toGMTString()}A&&(i=!0,c="; SameSite=None"),i&&(c+="; secure"),ye.cookie=n+"="+encodeURIComponent(e)+a+"; path=/"+o+c},set:function(n,e,t,r,i,A,s){var o="",a="",c="";if(s)o="; domain="+s;else if(r){var u=qB(ye.location.hostname);o=u?"; domain=."+u:""}if(t){var l=new Date;l.setTime(l.getTime()+t*24*60*60*1e3),a="; expires="+l.toGMTString()}A&&(i=!0,c="; SameSite=None"),i&&(c+="; secure");var d=n+"="+encodeURIComponent(e)+a+"; path=/"+o+c;return ye.cookie=d,d},remove:function(n,e,t){m.cookie.set(n,"",-1,e,!1,!1,t)}};var jB=function(n){var e=!0;try{var t="__mplss_"+Ap(8),r="xyz";n.setItem(t,r),n.getItem(t)!==r&&(e=!1),n.removeItem(t)}catch{e=!1}return e},rp=null,Cs=function(n,e){return rp!==null&&!e?rp:rp=jB(n||V.localStorage)},ip=null,zL=function(n,e){return ip!==null&&!e?ip:ip=jB(n||V.sessionStorage)};function WB(n,e,t){var r=function(i){we.error(e+" error: "+i)};return{is_supported:function(i){var A=t(n,i);return A||we.error(e+" unsupported"),A},error:r,get:function(i){try{return n.getItem(i)}catch(A){r(A)}return null},parse:function(i){try{return m.JSONDecode(n.getItem(i))||{}}catch{}return null},set:function(i,A){try{n.setItem(i,A)}catch(s){r(s)}},remove:function(i){try{n.removeItem(i)}catch(A){r(A)}}}}m.localStorage=WB(V.localStorage,"localStorage",Cs),m.sessionStorage=WB(V.sessionStorage,"sessionStorage",zL),m.register_event=function(){var n=function(r,i,A,s,o){if(!r){we.error("No valid element provided to register_event");return}if(r.addEventListener&&!s)r.addEventListener(i,A,!!o);else{var a="on"+i,c=r[a];r[a]=e(r,A,c)}};function e(r,i,A){var s=function(o){if(o=o||t(V.event),!!o){var a=!0,c,u;return m.isFunction(A)&&(c=A(o)),u=i.call(r,o),(c===!1||u===!1)&&(a=!1),a}};return s}function t(r){return r&&(r.preventDefault=t.preventDefault,r.stopPropagation=t.stopPropagation),r}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},n}();var XL=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(i){return i.all?i.all:i.getElementsByTagName("*")}var e=/[\t\r\n]/g;function t(i,A){var s=" "+A+" ";return(" "+i.className+" ").replace(e," ").indexOf(s)>=0}function r(i){if(!ye.getElementsByTagName)return[];var A=i.split(" "),s,o,a,c,u,l,d,h,f,p,g=[ye];for(l=0;l<A.length;l++){if(s=A[l].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){o=s.split("#"),a=o[0];var v=o[1],y=ye.getElementById(v);if(!y||a&&y.nodeName.toLowerCase()!=a)return[];g=[y];continue}if(s.indexOf(".")>-1){o=s.split("."),a=o[0];var B=o[1];for(a||(a="*"),c=[],u=0,d=0;d<g.length;d++)for(a=="*"?f=n(g[d]):f=g[d].getElementsByTagName(a),h=0;h<f.length;h++)c[u++]=f[h];for(g=[],p=0,d=0;d<c.length;d++)c[d].className&&m.isString(c[d].className)&&t(c[d],B)&&(g[p++]=c[d]);continue}var b=s.match(XL);if(b){a=b[1];var w=b[2],_=b[3],k=b[4];for(a||(a="*"),c=[],u=0,d=0;d<g.length;d++)for(a=="*"?f=n(g[d]):f=g[d].getElementsByTagName(a),h=0;h<f.length;h++)c[u++]=f[h];g=[],p=0;var F;switch(_){case"=":F=function(x){return x.getAttribute(w)==k};break;case"~":F=function(x){return x.getAttribute(w).match(new RegExp("\\b"+k+"\\b"))};break;case"|":F=function(x){return x.getAttribute(w).match(new RegExp("^"+k+"-?"))};break;case"^":F=function(x){return x.getAttribute(w).indexOf(k)===0};break;case"$":F=function(x){return x.getAttribute(w).lastIndexOf(k)==x.getAttribute(w).length-k.length};break;case"*":F=function(x){return x.getAttribute(w).indexOf(k)>-1};break;default:F=function(x){return x.getAttribute(w)}}for(g=[],p=0,d=0;d<c.length;d++)F(c[d])&&(g[p++]=c[d]);continue}for(a=s,c=[],u=0,d=0;d<g.length;d++)for(f=g[d].getElementsByTagName(a),h=0;h<f.length;h++)c[u++]=f[h];g=c}return g}return function(i){return m.isElement(i)?[i]:m.isObject(i)&&!m.isUndefined(i.length)?i:r.call(this,i)}}();var YL=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],ZL=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",t={};return m.each(YL,function(r){e=m.getQueryParam(ye.URL,r),e.length?t[r]=e:n!==void 0&&(t[r]=n)}),t},clickParams:function(){var n="",e={};return m.each(ZL,function(t){n=m.getQueryParam(ye.URL,t),n.length&&(e[t]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=m.info.searchEngine(n),t=e!="yahoo"?"q":"p",r={};if(e!==null){r.$search_engine=e;var i=m.getQueryParam(n,t);i.length&&(r.mp_keyword=i)}return r},browser:function(n,e,t){return e=e||"",t||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Whale/")?"Whale Browser":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,t){var r=m.info.browser(n,e,t),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/},A=i[r];if(A===void 0)return null;var s=n.match(A);return s?parseFloat(s[s.length-2]):null},os:function(){var n=qn;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return V.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(qn,Ur.vendor,Tc),$referrer:ye.referrer,$referring_domain:m.info.referringDomain(ye.referrer),$device:m.info.device(qn)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(qn,Ur.vendor,Tc),$screen_height:DB.height,$screen_width:DB.width,mp_lib:"web",$lib_version:gn.LIB_VERSION,$insert_id:Ap(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(qn,Ur.vendor,Tc)}),{$browser_version:m.info.browserVersion(qn,Ur.vendor,Tc)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:ye.title,current_domain:V.location.hostname,current_url_path:V.location.pathname,current_url_protocol:V.location.protocol,current_url_search:V.location.search})}};var $L=function(n,e){var t=null,r=[];return function(i){var A=this;return r.push(i),t||(t=new be(function(s){setTimeout(function(){var o=n.apply(A,[r]);t=null,r=[],s(o)},e)})),t}},Ap=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},eD=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,tD=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,qB=function(n){var e=tD,t=n.split("."),r=t[t.length-1];(r.length>4||r==="com"||r==="org")&&(e=eD);var i=n.match(e);return i?i[0]:""},nD=function(){var n=V.navigator.onLine;return m.isUndefined(n)||n},Tr=function(){},tA=null,Ic=null;typeof JSON<"u"&&(tA=JSON.stringify,Ic=JSON.parse),tA=tA||m.JSONEncode,Ic=Ic||m.JSONDecode,m.info=m.info,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.device=m.info.device,m.info.properties=m.info.properties,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.isObject=m.isObject,m.JSONDecode=m.JSONDecode,m.JSONEncode=m.JSONEncode,m.toArray=m.toArray,m.NPO=Er;var rD="mixpanelBrowserDb",JB="mixpanelRecordingEvents",sp="mixpanelRecordingRegistry",iD=1,AD=[JB,sp],In=function(n){this.dbPromise=null,this.storeName=n};In.prototype._openDb=function(){return new be(function(n,e){var t=V.indexedDB.open(rD,iD);t.onerror=function(){e(t.error)},t.onsuccess=function(){n(t.result)},t.onupgradeneeded=function(r){var i=r.target.result;AD.forEach(function(A){i.createObjectStore(A)})}})},In.prototype.init=function(){return V.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(n){return n instanceof V.IDBDatabase?be.resolve():be.reject(n)})):be.reject("indexedDB is not supported in this browser")},In.prototype.makeTransaction=function(n,e){var t=this.storeName,r=function(i){return new be(function(A,s){var o=i.transaction(t,n);o.oncomplete=function(){A(o)},o.onabort=o.onerror=function(){s(o.error)},e(o.objectStore(t))})};return this.dbPromise.then(r).catch((function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(r)):be.reject(i)}).bind(this))},In.prototype.setItem=function(n,e){return this.makeTransaction("readwrite",function(t){t.put(e,n)})},In.prototype.getItem=function(n){var e;return this.makeTransaction("readonly",function(t){e=t.get(n)}).then(function(){return e.result})},In.prototype.removeItem=function(n){return this.makeTransaction("readwrite",function(e){e.delete(n)})},In.prototype.getAll=function(){var n;return this.makeTransaction("readonly",function(e){n=e.getAll()}).then(function(){return n.result})};var sD="__mp_opt_in_out_";function oD(n,e){YB(!0,n,e)}function aD(n,e){YB(!1,n,e)}function cD(n,e){return XB(n,e)==="1"}function zB(n,e){if(lD(e))return we.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var t=XB(n,e)==="0";return t&&we.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),t}function Ir(n){return cp(n,function(e){return this.get_config(e)})}function Fr(n){return cp(n,function(e){return this._get_config(e)})}function nA(n){return cp(n,function(e){return this._get_config(e)})}function uD(n,e){e=e||{},op(e).remove(ap(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function op(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function ap(n,e){return e=e||{},(e.persistencePrefix||sD)+n}function XB(n,e){return op(e).get(ap(n,e))}function lD(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||V,t=e.navigator||{},r=!1;return m.each([t.doNotTrack,t.msDoNotTrack,e.doNotTrack],function(i){m.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function YB(n,e,t){if(!m.isString(e)||!e.length){we.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}t=t||{},op(t).set(ap(e,t),n?1:0,m.isNumber(t.cookieExpiration)?t.cookieExpiration:null,!!t.crossSubdomainCookie,!!t.secureCookie,!!t.crossSiteCookie,t.cookieDomain),t.track&&n&&t.track(t.trackEventName||"$opt_in",t.trackProperties,{send_immediately:!0})}function cp(n,e){return function(){var t=!1;try{var r=e.call(this,"token"),i=e.call(this,"ignore_dnt"),A=e.call(this,"opt_out_tracking_persistence_type"),s=e.call(this,"opt_out_tracking_cookie_prefix"),o=e.call(this,"window");r&&(t=zB(r,{ignoreDnt:i,persistenceType:A,persistencePrefix:s,window:o}))}catch(c){we.error("Unexpected error when checking tracking opt-out status: "+c)}if(!t)return n.apply(this,arguments);var a=arguments[arguments.length-1];typeof a=="function"&&a(0)}}var dD=ri("lock"),ZB=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||V.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3,this.promiseImpl=e.promiseImpl||be};ZB.prototype.withLock=function(n,e){var t=this.promiseImpl;return new t(m.bind(function(r,i){var A=e||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),o=this.storageKey,a=this.pollIntervalMS,c=this.timeoutMS,u=this.storage,l=o+":X",d=o+":Y",h=o+":Z",f=function(B){if(new Date().getTime()-s>c){dD.error("Timeout waiting for mutex on "+o+"; clearing lock. ["+A+"]"),u.removeItem(h),u.removeItem(d),v();return}setTimeout(function(){try{B()}catch(b){i(b)}},a*(Math.random()+.1))},p=function(B,b){B()?b():f(function(){p(B,b)})},g=function(){var B=u.getItem(d);return B&&B!==A?!1:(u.setItem(d,A),u.getItem(d)===A?!0:(Cs(u,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},v=function(){u.setItem(l,A),p(g,function(){if(u.getItem(l)===A){y();return}f(function(){if(u.getItem(d)!==A){v();return}p(function(){return!u.getItem(h)},y)})})},y=function(){u.setItem(h,"1");var B=function(){u.removeItem(h),u.getItem(d)===A&&u.removeItem(d),u.getItem(l)===A&&u.removeItem(l)};n().then(function(b){B(),r(b)}).catch(function(b){B(),i(b)})};try{if(Cs(u,!0))v();else throw new Error("localStorage support check failed")}catch(B){i(B)}},this))};var _s=function(n){this.storage=n||V.localStorage};_s.prototype.init=function(){return be.resolve()},_s.prototype.setItem=function(n,e){return new be(m.bind(function(t,r){try{this.storage.setItem(n,tA(e))}catch(i){r(i)}t()},this))},_s.prototype.getItem=function(n){return new be(m.bind(function(e,t){var r;try{r=Ic(this.storage.getItem(n))}catch(i){t(i)}e(r)},this))},_s.prototype.removeItem=function(n){return new be(m.bind(function(e,t){try{this.storage.removeItem(n)}catch(r){t(r)}e()},this))};var $B=ri("batch"),Fn=function(n,e){e=e||{},this.storageKey=n,this.usePersistence=e.usePersistence,this.usePersistence&&(this.queueStorage=e.queueStorage||new _s,this.lock=new ZB(n,{storage:e.sharedLockStorage||V.localStorage,timeoutMS:e.sharedLockTimeoutMS})),this.reportError=e.errorReporter||m.bind($B.error,$B),this.pid=e.pid||null,this.memQueue=[],this.initialized=!1,e.enqueueThrottleMs?this.enqueuePersisted=$L(m.bind(this._enqueuePersisted,this),e.enqueueThrottleMs):this.enqueuePersisted=m.bind(function(t){return this._enqueuePersisted([t])},this)};Fn.prototype.ensureInit=function(){return this.initialized?be.resolve():this.queueStorage.init().then(m.bind(function(){this.initialized=!0},this)).catch(m.bind(function(n){this.reportError("Error initializing queue persistence. Disabling persistence",n),this.initialized=!0,this.usePersistence=!1},this))},Fn.prototype.enqueue=function(n,e){var t={id:Ap(),flushAfter:new Date().getTime()+e*2,payload:n};return this.usePersistence?this.enqueuePersisted(t):(this.memQueue.push(t),be.resolve(!0))},Fn.prototype._enqueuePersisted=function(n){var e=m.bind(function(){return this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(t){return this.saveToStorage(t.concat(n))},this)).then(m.bind(function(t){return t&&(this.memQueue=this.memQueue.concat(n)),t},this)).catch(m.bind(function(t){return this.reportError("Error enqueueing items",t,n),!1},this))},this);return this.lock.withLock(e,this.pid).catch(m.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this))},Fn.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);return this.usePersistence&&e.length<n?this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(t){if(t.length){var r={};m.each(e,function(s){r[s.id]=!0});for(var i=0;i<t.length;i++){var A=t[i];if(new Date().getTime()>A.flushAfter&&!r[A.id]&&(A.orphaned=!0,e.push(A),e.length>=n))break}}return e},this)):be.resolve(e)};var eC=function(n,e){var t=[];return m.each(n,function(r){r.id&&!e[r.id]&&t.push(r)}),t};Fn.prototype.removeItemsByID=function(n){var e={};if(m.each(n,function(r){e[r]=!0}),this.memQueue=eC(this.memQueue,e),this.usePersistence){var t=m.bind(function(){return this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(r){return r=eC(r,e),this.saveToStorage(r)},this)).then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(r){for(var i=0;i<r.length;i++){var A=r[i];if(A.id&&e[A.id])throw new Error("Item not removed from storage")}return!0},this)).catch(m.bind(function(r){return this.reportError("Error removing items",r,n),!1},this))},this);return this.lock.withLock(t,this.pid).catch(m.bind(function(r){return this.reportError("Error acquiring storage lock",r),Cs(this.lock.storage,!0)?!1:t().then(m.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(m.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return be.resolve(!0)};var tC=function(n,e){var t=[];return m.each(n,function(r){var i=r.id;if(i in e){var A=e[i];A!==null&&(r.payload=A,t.push(r))}else t.push(r)}),t};Fn.prototype.updatePayloads=function(n){return this.memQueue=tC(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){return this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(e){return e=tC(e,n),this.saveToStorage(e)},this)).catch(m.bind(function(e){return this.reportError("Error updating items",n,e),!1},this))},this),this.pid).catch(m.bind(function(e){return this.reportError("Error acquiring storage lock",e),!1},this)):be.resolve(!0)},Fn.prototype.readFromStorage=function(){return this.ensureInit().then(m.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(m.bind(function(n){return n&&(m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null)),n||[]},this)).catch(m.bind(function(n){return this.reportError("Error retrieving queue",n),[]},this))},Fn.prototype.saveToStorage=function(n){return this.ensureInit().then(m.bind(function(){return this.queueStorage.setItem(this.storageKey,n)},this)).then(function(){return!0}).catch(m.bind(function(e){return this.reportError("Error saving queue",e),!1},this))},Fn.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(m.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):be.resolve()};var hD=10*60*1e3,Ss=ri("batch"),$t=function(n,e){this.errorReporter=e.errorReporter,this.queue=new Fn(n,{errorReporter:m.bind(this.reportError,this),queueStorage:e.queueStorage,sharedLockStorage:e.sharedLockStorage,sharedLockTimeoutMS:e.sharedLockTimeoutMS,usePersistence:e.usePersistence,enqueueThrottleMs:e.enqueueThrottleMs}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1,this._flushPromise=null};$t.prototype.enqueue=function(n){return this.queue.enqueue(n,this.flushInterval)},$t.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},$t.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},$t.prototype.clear=function(){return this.queue.clear()},$t.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},$t.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},$t.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},$t.prototype.sendRequestPromise=function(n,e){return new be(m.bind(function(t){this.sendRequest(n,e,t)},this))},$t.prototype.flush=function(n){if(this.requestInProgress)return Ss.log("Flush: Request already in progress"),be.resolve();this.requestInProgress=!0,n=n||{};var e=this.libConfig.batch_request_timeout_ms,t=new Date().getTime(),r=this.batchSize;return this.queue.fillBatch(r).then(m.bind(function(i){var A=i.length===r,s=[],o={};if(m.each(i,function(l){var d=l.payload;if(this.beforeSendHook&&!l.orphaned&&(d=this.beforeSendHook(d)),d){d.event&&d.properties&&(d.properties=m.extend({},d.properties,{mp_sent_by_lib_version:gn.LIB_VERSION}));var h=!0,f=l.id;f?(this.itemIdsSentSuccessfully[f]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:l,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[f]}),h=!1):this.reportError("[dupe] found item with no ID",{item:l}),h&&s.push(d)}o[l.id]=d},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),be.resolve();var a=m.bind(function(){return this.queue.removeItemsByID(m.map(i,function(l){return l.id})).then(m.bind(function(l){return m.each(i,m.bind(function(d){var h=d.id;h?(this.itemIdsSentSuccessfully[h]=this.itemIdsSentSuccessfully[h]||0,this.itemIdsSentSuccessfully[h]++,this.itemIdsSentSuccessfully[h]>5&&this.reportError("[dupe] item ID sent too many times",{item:d,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[h]})):this.reportError("[dupe] found item with no ID while removing",{item:d})},this)),l?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!A?(this.resetFlush(),be.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),be.resolve())},this))},this),c=m.bind(function(l){this.requestInProgress=!1;try{if(n.unloading)return this.queue.updatePayloads(o);if(m.isObject(l)&&l.error==="timeout"&&new Date().getTime()-t>=e)return this.reportError("Network timeout; retrying"),this.flush();if(m.isObject(l)&&(l.httpStatusCode>=500||l.httpStatusCode===429||l.httpStatusCode<=0&&!nD()||l.error==="timeout")){var d=this.flushInterval*2;return l.retryAfter&&(d=parseInt(l.retryAfter,10)*1e3||d),d=Math.min(hD,d),this.reportError("Error; retry in "+d+" ms"),this.scheduleFlush(d),be.resolve()}else if(m.isObject(l)&&l.httpStatusCode===413)if(i.length>1){var h=Math.max(1,Math.floor(r/2));return this.batchSize=Math.min(this.batchSize,h,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),be.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),a();else return a()}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}},this),u={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};return n.unloading&&(u.transport="sendBeacon"),Ss.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,u).then(c)},this)).catch(m.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},$t.prototype.reportError=function(n,e){if(Ss.error.apply(Ss.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(t){Ss.error(t)}};var up=function(n){var e=Date.now();return!n||e>n.maxExpires||e>n.idleExpires},pD=250,rA=ri("recorder"),nC=V.CompressionStream,fD={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},gD=new Set([z.MouseMove,z.MouseInteraction,z.Scroll,z.ViewportResize,z.Input,z.TouchMove,z.MediaInteraction,z.Drag,z.Selection]);function mD(n){return n.type===le.IncrementalSnapshot&&gD.has(n.data.source)}var Bt=function(n){this._mixpanel=n.mixpanelInstance,this._onIdleTimeout=n.onIdleTimeout||Tr,this._onMaxLengthReached=n.onMaxLengthReached||Tr,this._onBatchSent=n.onBatchSent||Tr,this._rrwebRecord=n.rrwebRecord||null,this._stopRecording=null,this.replayId=n.replayId,this.batchStartUrl=n.batchStartUrl||null,this.replayStartUrl=n.replayStartUrl||null,this.idleExpires=n.idleExpires||null,this.maxExpires=n.maxExpires||null,this.replayStartTime=n.replayStartTime||null,this.seqNo=n.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=bs,this.recordMinMs=0;var e=Cs(n.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new In(JB),this.batcher=new $t(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:fD,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:n.sharedLockStorage,usePersistence:e,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:pD,sharedLockTimeoutMS:10*1e3})};Bt.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var n={distinct_id:String(this._mixpanel.get_distinct_id())},e=this._mixpanel.get_property("$device_id");e&&(n.$device_id=e);var t=this._mixpanel.get_property("$user_id");return t&&(n.$user_id=t),n},Bt.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},Bt.prototype.getConfig=function(n){return this._mixpanel.get_config(n)},Bt.prototype.get_config=function(n){return this.getConfig(n)},Bt.prototype.startRecording=function(n){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){rA.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>bs&&(this.recordMaxMs=bs,rA.critical("record_max_ms cannot be greater than "+bs+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Zh&&(this.recordMinMs=Zh,rA.critical("record_min_ms cannot be greater than "+Zh+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=m.info.currentUrl(),this.replayStartUrl=m.info.currentUrl()),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=(function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}).bind(this);e();var t=this.getConfig("record_block_selector");(t===""||t===null)&&(t=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(i){if(this.idleExpires&&this.idleExpires<i.timestamp){this._onIdleTimeout();return}mD(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e()),this.__enqueuePromise=this.batcher.enqueue(i)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:t,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(i){this.reportError("Unexpected error when starting rrweb recording.",i)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var r=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),r)},Bt.prototype.stopRecording=function(n){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(t){this.reportError("Error with rrweb stopRecording",t)}this._stopRecording=null}var e;return this.batcher.stopped?e=this.batcher.clear():n||(e=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),e},Bt.prototype.isRrwebStopped=function(){return this._stopRecording===null},Bt.prototype.flushEventsWithOptOut=function(n,e,t){var r=(function(i){i===0&&(this.stopRecording(),t({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(n,e,t,r)},Bt.prototype.serialize=function(){var n;try{n=this._mixpanel.get_tab_id()}catch(e){this.reportError("Error getting tab ID for serialization ",e),n=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:n}},Bt.deserialize=function(n,e){var t=new Bt(m.extend({},e,{replayId:n.replayId,batchStartUrl:n.batchStartUrl,replayStartUrl:n.replayStartUrl,idleExpires:n.idleExpires,maxExpires:n.maxExpires,replayStartTime:n.replayStartTime,seqNo:n.seqNo,sharedLockStorage:e.sharedLockStorage}));return t},Bt.prototype._sendRequest=function(n,e,t,r){var i=(function(s,o){s.status===200&&this.replayId===n&&(this.seqNo++,this.batchStartUrl=m.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:s.status,responseBody:o,retryAfter:s.headers.get("Retry-After")})}).bind(this),A=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");V.fetch(A+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:t}).then(function(s){s.json().then(function(o){i(s,o)}).catch(function(o){r({error:o})})}).catch(function(s){r({error:s,httpStatusCode:0})})},Bt.prototype._flushEvents=Ir(function(n,e,t){var r=n.length;if(r>0){for(var i=this.replayId,A=1/0,s=-1/0,o=!1,a=0;a<r;a++)A=Math.min(A,n[a].timestamp),s=Math.max(s,n[a].timestamp),n[a].type===le.FullSnapshot&&(o=!0);if(this.seqNo===0){if(!o){t({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=A}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=A);var c=s-this.replayStartTime,u={$current_url:this.batchStartUrl,$lib_version:gn.LIB_VERSION,batch_start_time:A/1e3,mp_lib:"web",replay_id:i,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},l=JSON.stringify(n);if(Object.assign(u,this.getUserIdInfo()),nC){var d=new Blob([l],{type:"application/json"}).stream(),h=d.pipeThrough(new nC("gzip"));new Response(h).blob().then((function(f){u.format="gzip",this._sendRequest(i,u,f,t)}).bind(this))}else u.format="body",this._sendRequest(i,u,l,t)}}),Bt.prototype.reportError=function(n,e){rA.error.apply(rA.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.getConfig("error_reporter")(n,e)}catch(t){rA.error(t)}};var iA=function(n){this.idb=new In(sp),this.errorReporter=n.errorReporter,this.mixpanelInstance=n.mixpanelInstance,this.sharedLockStorage=n.sharedLockStorage};iA.prototype.handleError=function(n){this.errorReporter("IndexedDB error: ",n)},iA.prototype.setActiveRecording=function(n){var e=n.tabId;return e?this.idb.init().then((function(){return this.idb.setItem(e,n)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),be.resolve())},iA.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(n){return up(n)?null:n}).bind(this)).catch(this.handleError.bind(this))},iA.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(n){if(n)return n.maxExpires=0,this.setActiveRecording(n)}).bind(this)).catch(this.handleError.bind(this))},iA.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(n){var e=n.filter(function(t){return up(t)}).map((function(t){var r=Bt.deserialize(t,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return r.unloadPersistedData().then((function(){return this.idb.removeItem(t.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return be.all(e)}).bind(this)).catch(this.handleError.bind(this))};var ks=ri("recorder"),Jn=function(n,e,t){this.mixpanelInstance=n,this.rrwebRecord=e||Sr,this.sharedLockStorage=t,this.recordingRegistry=new iA({mixpanelInstance:this.mixpanelInstance,errorReporter:ks.error,sharedLockStorage:t}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};Jn.prototype.startRecording=function(n){if(n=n||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){ks.log("Recording already in progress, skipping startRecording.");return}var e=(function(){ks.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),t=(function(){ks.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),r=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:r,onIdleTimeout:e,onMaxLengthReached:t,replayId:m.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return n.activeSerializedRecording?this.activeRecording=Bt.deserialize(n.activeSerializedRecording,i):this.activeRecording=new Bt(i),this.activeRecording.startRecording(n.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},Jn.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then((function(){return this.recordingRegistry.clearActiveRecording()}).bind(this)).then((function(){this.stopRecordingInProgress=!1}).bind(this))},Jn.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},Jn.prototype._stopCurrentRecording=function(n,e){if(this.activeRecording){var t=this.activeRecording.stopRecording(n);return e&&(this.activeRecording=null),t}return be.resolve()},Jn.prototype.resumeRecording=function(n){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),be.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(e){return e&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:e}):n?this.startRecording({shouldStopBatcher:!1}):(ks.log("No resumable recording found."),null)}).bind(this))},Jn.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},Jn.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(Jn.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),V.__mp_recorder=Jn;var Fc="change",ii="click",rC="hashchange",AA="mp_locationchange",iC="popstate",AC="scrollend",lp="submit",vD=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],sC=["mp-include"],dp=["mp-no-track"],oC=dp.concat(["mp-sensitive"]),yD=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],xt=ri("autocapture");function hp(n){for(var e={},t=aC(n).split(" "),r=0;r<t.length;r++){var i=t[r];i&&(e[i]=!0)}return e}function aC(n){switch(typeof n.className){case"string":return n.className;case"object":return n.className.baseVal||n.getAttribute("class")||"";default:return""}}function wD(n){if(n.previousElementSibling)return n.previousElementSibling;do n=n.previousSibling;while(n&&!lC(n));return n}function cC(n,e,t,r,i,A){var s={$classes:aC(n).split(" "),$tag_name:n.tagName.toLowerCase()},o=n.id;o&&(s.$id=o),gp(n,e,i,A)&&m.each(yD.concat(r),function(l){if(n.hasAttribute(l)&&!t[l]){var d=n.getAttribute(l);xc(d)&&(s["$attr-"+l]=d)}});for(var a=1,c=1,u=n;u=wD(u);)a++,u.tagName===n.tagName&&c++;return s.$nth_child=a,s.$nth_of_type=c,s}function bD(n,e){var t=e.allowElementCallback,r=e.allowSelectors||[],i=e.blockAttrs||[],A=e.blockElementCallback,s=e.blockSelectors||[],o=e.captureTextContent||!1,a=e.captureExtraAttrs||[],c=e.capturedForHeatMap||!1,u={};m.each(i,function(w){u[w]=!0});var l=null,d=typeof n.target>"u"?n.srcElement:n.target;if(dC(d)&&(d=d.parentNode),_D(d,n)&&pp(d,n,t,r)&&!fp(d,n,A,s)){for(var h=[d],f=d;f.parentNode&&!xn(f,"body");)h.push(f.parentNode),f=f.parentNode;var p=[],g,v=!1;if(m.each(h,function(w){var _=gp(w,n,t,r);!u.href&&w.tagName.toLowerCase()==="a"&&(g=w.getAttribute("href"),g=_&&xc(g)&&g),fp(w,n,A,s)&&(v=!0),p.push(cC(w,n,u,a,t,r))},this),!v){var y=ye.documentElement;if(l={$event_type:n.type,$host:V.location.host,$pathname:V.location.pathname,$elements:p,$el_attr__href:g,$viewportHeight:Math.max(y.clientHeight,V.innerHeight||0),$viewportWidth:Math.max(y.clientWidth,V.innerWidth||0),$pageHeight:ye.body.offsetHeight||0,$pageWidth:ye.body.offsetWidth||0},m.each(a,function(w){if(!u[w]&&d.hasAttribute(w)){var _=d.getAttribute(w);xc(_)&&(l["$el_attr__"+w]=_)}}),o&&(B=uC(d,n,t,r),B&&B.length&&(l.$el_text=B)),n.type===ii&&(m.each(vD,function(w){w in n&&(l["$"+w]=n[w])}),c&&(l.$captured_for_heatmap=!0),d=BD(n)),o){var B=uC(d,n,t,r);B&&B.length&&(l.$el_text=B)}if(d){if(!pp(d,n,t,r)||fp(d,n,A,s))return null;var b=cC(d,n,u,a,t,r);l.$target=b,l.$el_classes=b.$classes,m.extend(l,m.strip_empty_properties({$el_id:b.$id,$el_tag_name:b.$tag_name}))}}}return l}function uC(n,e,t,r){var i="";return gp(n,e,t,r)&&n.childNodes&&n.childNodes.length&&m.each(n.childNodes,function(A){dC(A)&&A.textContent&&(i+=m.trim(A.textContent).split(/(\s+)/).filter(xc).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),m.trim(i)}function BD(n){for(var e=n.target,t=n.composedPath(),r=0;r<t.length;r++){var i=t[r];if(xn(i,"a")||xn(i,"button")||xn(i,"input")||xn(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){e=i;break}if(i===e)break}return e}function pp(n,e,t,r){if(t)try{if(!t(n,e))return!1}catch(s){return xt.critical("Error while checking element in allowElementCallback",s),!1}if(!r.length)return!0;for(var i=0;i<r.length;i++){var A=r[i];try{if(n.matches(A))return!0}catch(s){xt.critical("Error while checking selector: "+A,s)}}return!1}function fp(n,e,t,r){var i;if(t)try{if(t(n,e))return!0}catch(o){return xt.critical("Error while checking element in blockElementCallback",o),!0}if(r&&r.length)for(i=0;i<r.length;i++){var A=r[i];try{if(n.matches(A))return!0}catch(o){xt.critical("Error while checking selector: "+A,o)}}var s=hp(n);for(i=0;i<dp.length;i++)if(s[dp[i]])return!0;return!1}function lC(n){return n&&n.nodeType===1}function xn(n,e){return n&&n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function dC(n){return n&&n.nodeType===3}function CD(){try{var n=ye.createElement("div");return!!n.matches}catch{return!1}}function _D(n,e){if(!n||xn(n,"html")||!lC(n))return!1;var t=n.tagName.toLowerCase();switch(t){case"form":return e.type===lp;case"input":return["button","submit"].indexOf(n.getAttribute("type"))===-1?e.type===Fc:e.type===ii;case"select":case"textarea":return e.type===Fc;default:return e.type===ii}}function gp(n,e,t,r){var i;if(!pp(n,e,t,r))return!1;for(var A=n;A.parentNode&&!xn(A,"body");A=A.parentNode){var s=hp(A);for(i=0;i<oC.length;i++)if(s[oC[i]])return!1}var o=hp(n);for(i=0;i<sC.length;i++)if(o[sC[i]])return!0;if(xn(n,"input")||xn(n,"select")||xn(n,"textarea")||n.getAttribute("contenteditable")==="true")return!1;var a=n.type||"";if(typeof a=="string")switch(a.toLowerCase()){case"hidden":return!1;case"password":return!1}var c=n.name||n.id||"";if(typeof c=="string"){var u=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(u.test(c.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function xc(n){if(n===null||m.isUndefined(n))return!1;if(typeof n=="string"){n=m.trim(n);var e=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(e.test((n||"").replace(/[- ]/g,"")))return!1;var t=/(^\d{3}-?\d{2}-?\d{4}$)/;if(t.test(n))return!1}return!0}var SD=30,kD=1e3,ED=4;function hC(){this.clicks=[]}hC.prototype.isRageClick=function(n,e,t){t=t||{};var r=t.threshold_px||SD,i=t.timeout_ms||kD,A=t.click_count||ED,s=Date.now(),o=this.clicks[this.clicks.length-1];if(o&&s-o.timestamp<i&&Math.sqrt(Math.pow(n-o.x,2)+Math.pow(e-o.y,2))<r){if(this.clicks.push({x:n,y:e,timestamp:s}),this.clicks.length>=A)return this.clicks=[],!0}else this.clicks=[{x:n,y:e,timestamp:s}];return!1};var pC="autocapture",UD="track_pageview",fC="full-url",TD="url-with-path-and-query-string",ID="url-with-path",FD="allow_element_callback",gC="allow_selectors",mC="allow_url_regexes",vC="block_attrs",yC="block_element_callback",wC="block_selectors",bC="block_url_regexes",BC="capture_extra_attrs",CC="capture_text_content",_C="scroll_capture_all",SC="scroll_depth_percent_checkpoints",Qc="click",mp="input",kC="pageview",EC="rage_click",vp="scroll",yp="submit",gt={};gt[gC]=[],gt[mC]=[],gt[vC]=[],gt[yC]=null,gt[wC]=[],gt[bC]=[],gt[BC]=[],gt[CC]=!1,gt[_C]=!1,gt[SC]=[25,50,75,100],gt[Qc]=!0,gt[mp]=!0,gt[kC]=fC,gt[EC]=!0,gt[vp]=!0,gt[yp]=!0;var Rc={$mp_autocapture:!0},UC="$mp_click",xD="$mp_input_change",TC="$mp_rage_click",QD="$mp_scroll",RD="$mp_submit",Qt=function(n){this.mp=n};Qt.prototype.init=function(){if(!CD()){xt.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking()},Qt.prototype.getFullConfig=function(){var n=this.mp.get_config(pC);return n?m.isObject(n)?m.extend({},gt,n):gt:{}},Qt.prototype.getConfig=function(n){return this.getFullConfig()[n]},Qt.prototype.currentUrlBlocked=function(){var n,e=m.info.currentUrl(),t=this.getConfig(mC)||[];if(t.length){var r=!1;for(n=0;n<t.length;n++){var i=t[n];try{if(e.match(i)){r=!0;break}}catch(s){return xt.critical("Error while checking block URL regex: "+i,s),!0}}if(!r)return!0}var A=this.getConfig(bC)||[];if(!A||!A.length)return!1;for(n=0;n<A.length;n++)try{if(e.match(A[n]))return!0}catch(s){return xt.critical("Error while checking block URL regex: "+A[n],s),!0}return!1},Qt.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(pC)?this.getConfig(kC):this.mp.get_config(UD)},Qt.prototype.trackDomEvent=function(n,e){if(!this.currentUrlBlocked()){var t=this.mp.is_recording_heatmap_data()&&(e===UC&&!this.getConfig(Qc)||e===TC&&!this._getRageClickConfig()),r=bD(n,{allowElementCallback:this.getConfig(FD),allowSelectors:this.getConfig(gC),blockAttrs:this.getConfig(vC),blockElementCallback:this.getConfig(yC),blockSelectors:this.getConfig(wC),captureExtraAttrs:this.getConfig(BC),captureTextContent:this.getConfig(CC),capturedForHeatMap:t});r&&(m.extend(r,Rc),this.mp.track(e,r))}},Qt.prototype._getRageClickConfig=function(){var n=this.getConfig(EC);return n?n===!0?{}:typeof n=="object"?n:{}:null},Qt.prototype.initClickTracking=function(){V.removeEventListener(ii,this.listenerClick),!(!this.getConfig(Qc)&&!this.mp.get_config("record_heatmap_data"))&&(xt.log("Initializing click tracking"),this.listenerClick=V.addEventListener(ii,(function(n){!this.getConfig(Qc)&&!this.mp.is_recording_heatmap_data()||this.trackDomEvent(n,UC)}).bind(this)))},Qt.prototype.initInputTracking=function(){V.removeEventListener(Fc,this.listenerChange),this.getConfig(mp)&&(xt.log("Initializing input tracking"),this.listenerChange=V.addEventListener(Fc,(function(n){this.getConfig(mp)&&this.trackDomEvent(n,xD)}).bind(this)))},Qt.prototype.initPageviewTracking=function(){if(V.removeEventListener(iC,this.listenerPopstate),V.removeEventListener(rC,this.listenerHashchange),V.removeEventListener(AA,this.listenerLocationchange),!!this.pageviewTrackingConfig()){xt.log("Initializing pageview tracking");var n="",e=!1;this.currentUrlBlocked()||(e=this.mp.track_pageview(Rc)),e&&(n=m.info.currentUrl()),this.listenerPopstate=V.addEventListener(iC,function(){V.dispatchEvent(new Event(AA))}),this.listenerHashchange=V.addEventListener(rC,function(){V.dispatchEvent(new Event(AA))});var t=V.history.pushState;typeof t=="function"&&(V.history.pushState=function(i,A,s){t.call(V.history,i,A,s),V.dispatchEvent(new Event(AA))});var r=V.history.replaceState;typeof r=="function"&&(V.history.replaceState=function(i,A,s){r.call(V.history,i,A,s),V.dispatchEvent(new Event(AA))}),this.listenerLocationchange=V.addEventListener(AA,np((function(){if(!this.currentUrlBlocked()){var i=m.info.currentUrl(),A=!1,s=i.split("#")[0].split("?")[0]!==n.split("#")[0].split("?")[0],o=this.pageviewTrackingConfig();if(o===fC?A=i!==n:o===TD?A=i.split("#")[0]!==n.split("#")[0]:o===ID&&(A=s),A){var a=this.mp.track_pageview(Rc);a&&(n=i),s&&(this.lastScrollCheckpoint=0,xt.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},Qt.prototype.initRageClickTracking=function(){V.removeEventListener(ii,this.listenerRageClick);var n=this._getRageClickConfig();!n&&!this.mp.get_config("record_heatmap_data")||(xt.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new hC),this.listenerRageClick=(function(e){var t=this._getRageClickConfig();!t&&!this.mp.is_recording_heatmap_data()||this.currentUrlBlocked()||this._rageClickTracker.isRageClick(e.pageX,e.pageY,t)&&this.trackDomEvent(e,TC)}).bind(this),V.addEventListener(ii,this.listenerRageClick))},Qt.prototype.initScrollTracking=function(){V.removeEventListener(AC,this.listenerScroll),this.getConfig(vp)&&(xt.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=V.addEventListener(AC,np((function(){if(this.getConfig(vp)&&!this.currentUrlBlocked()){var n=this.getConfig(_C),e=(this.getConfig(SC)||[]).slice().sort(function(a,c){return a-c}),t=V.scrollY,r=m.extend({$scroll_top:t},Rc);try{var i=ye.body.scrollHeight,A=Math.round(t/(i-V.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=A,A>this.lastScrollCheckpoint)for(var s=0;s<e.length;s++){var o=e[s];A>=o&&this.lastScrollCheckpoint<o&&(r.$scroll_checkpoint=o,this.lastScrollCheckpoint=o,n=!0)}}catch(a){xt.critical("Error while calculating scroll percentage",a)}n&&this.mp.track(QD,r)}}).bind(this))))},Qt.prototype.initSubmitTracking=function(){V.removeEventListener(lp,this.listenerSubmit),this.getConfig(yp)&&(xt.log("Initializing submit tracking"),this.listenerSubmit=V.addEventListener(lp,(function(n){this.getConfig(yp)&&this.trackDomEvent(n,RD)}).bind(this)))},VB(Qt);var PD=V.fetch,Rt=ri("flags"),Pc="flags",Oc="context",wp={};wp[Oc]={};var ae=function(n){this.getFullApiRoute=n.getFullApiRoute,this.getMpConfig=n.getConfigFunc,this.setMpConfig=n.setConfigFunc,this.getMpProperty=n.getPropertyFunc,this.track=n.trackingFunc};ae.prototype.init=function(){if(!OD()){Rt.critical("Feature Flags unavailable: missing minimum required APIs");return}this.flags=null,this.fetchFlags(),this.trackedFeatures=new Set},ae.prototype.getFullConfig=function(){var n=this.getMpConfig(Pc);return n?m.isObject(n)?m.extend({},wp,n):wp:{}},ae.prototype.getConfig=function(n){return this.getFullConfig()[n]},ae.prototype.isSystemEnabled=function(){return!!this.getMpConfig(Pc)},ae.prototype.updateContext=function(n,e){if(!this.isSystemEnabled())return Rt.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var t=this.getMpConfig(Pc);m.isObject(t)||(t={});var r=e&&e.replace?{}:this.getConfig(Oc);return t[Oc]=m.extend({},r,n),this.setMpConfig(Pc,t),this.fetchFlags()},ae.prototype.areFlagsReady=function(){return this.isSystemEnabled()||Rt.error("Feature Flags not enabled"),!!this.flags},ae.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var n=this.getMpProperty("distinct_id"),e=this.getMpProperty("$device_id");Rt.log("Fetching flags for distinct ID: "+n);var t={context:m.extend({distinct_id:n,device_id:e},this.getConfig(Oc))};return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=V.fetch(this.getFullApiRoute(),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),"Content-Type":"application/octet-stream"},body:JSON.stringify(t)}).then((function(r){return this.markFetchComplete(),r.json().then((function(i){var A=i.flags;if(!A)throw new Error("No flags in API response");var s=new Map;m.each(A,function(o,a){s.set(a,{key:o.variant_key,value:o.variant_value})}),this.flags=s}).bind(this)).catch((function(i){this.markFetchComplete(),Rt.error(i)}).bind(this))}).bind(this)).catch((function(r){this.markFetchComplete(),Rt.error(r)}).bind(this)),this.fetchPromise},ae.prototype.markFetchComplete=function(){if(!this._fetchInProgressStartTime){Rt.error("Fetch in progress started time not set, cannot mark fetch complete");return}this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null},ae.prototype.getVariant=function(n,e){return this.fetchPromise?this.fetchPromise.then((function(){return this.getVariantSync(n,e)}).bind(this)).catch(function(t){return Rt.error(t),e}):new Promise(function(t){Rt.critical("Feature Flags not initialized"),t(e)})},ae.prototype.getVariantSync=function(n,e){if(!this.areFlagsReady())return Rt.log("Flags not loaded yet"),e;var t=this.flags.get(n);return t?(this.trackFeatureCheck(n,t),t):(Rt.log('No flag found: "'+n+'"'),e)},ae.prototype.getVariantValue=function(n,e){return this.getVariant(n,{value:e}).then(function(t){return t.value}).catch(function(t){return Rt.error(t),e})},ae.prototype.getFeatureData=function(n,e){return Rt.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(n,e)},ae.prototype.getVariantValueSync=function(n,e){return this.getVariantSync(n,{value:e}).value},ae.prototype.isEnabled=function(n,e){return this.getVariantValue(n).then((function(){return this.isEnabledSync(n,e)}).bind(this)).catch(function(t){return Rt.error(t),e})},ae.prototype.isEnabledSync=function(n,e){e=e||!1;var t=this.getVariantValueSync(n,e);return t!==!0&&t!==!1&&(Rt.error('Feature flag "'+n+'" value: '+t+" is not a boolean; returning fallback value: "+e),t=e),t},ae.prototype.trackFeatureCheck=function(n,e){this.trackedFeatures.has(n)||(this.trackedFeatures.add(n),this.track("$experiment_started",{"Experiment name":n,"Variant name":e.key,$experiment_type:"feature_flag","Variant fetch start time":new Date(this._fetchStartTime).toISOString(),"Variant fetch complete time":new Date(this._fetchCompleteTime).toISOString(),"Variant fetch latency (ms)":this._fetchLatency}))};function OD(){return!!PD&&typeof Promise<"u"&&typeof Map<"u"&&typeof Set<"u"}VB(ae),ae.prototype.are_flags_ready=ae.prototype.areFlagsReady,ae.prototype.get_variant=ae.prototype.getVariant,ae.prototype.get_variant_sync=ae.prototype.getVariantSync,ae.prototype.get_variant_value=ae.prototype.getVariantValue,ae.prototype.get_variant_value_sync=ae.prototype.getVariantValueSync,ae.prototype.is_enabled=ae.prototype.isEnabled,ae.prototype.is_enabled_sync=ae.prototype.isEnabledSync,ae.prototype.update_context=ae.prototype.updateContext,ae.prototype.get_feature_data=ae.prototype.getFeatureData;var zn=function(){};zn.prototype.create_properties=function(){},zn.prototype.event_handler=function(){},zn.prototype.after_track_handler=function(){},zn.prototype.init=function(n){return this.mp=n,this},zn.prototype.track=function(n,e,t,r){var i=this,A=m.dom_query(n);if(A.length===0){we.error("The DOM query ("+n+") returned 0 elements");return}return m.each(A,function(s){m.register_event(s,this.override_event,function(o){var a={},c=i.create_properties(t,this),u=i.mp.get_config("track_links_timeout");i.event_handler(o,this,a),window.setTimeout(i.track_callback(r,c,a,!0),u),i.mp.track(e,c,i.track_callback(r,c,a))})},this),!0},zn.prototype.track_callback=function(n,e,t,r){r=r||!1;var i=this;return function(){t.callback_fired||(t.callback_fired=!0,!(n&&n(r,e)===!1)&&i.after_track_handler(e,t,r))}},zn.prototype.create_properties=function(n,e){var t;return typeof n=="function"?t=n(e):t=m.extend({},n),t};var sA=function(){this.override_event="click"};m.inherit(sA,zn),sA.prototype.create_properties=function(n,e){var t=sA.superclass.create_properties.apply(this,arguments);return e.href&&(t.url=e.href),t},sA.prototype.event_handler=function(n,e,t){t.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",t.href=e.href,t.new_tab||n.preventDefault()},sA.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Mc=function(){this.override_event="submit"};m.inherit(Mc,zn),Mc.prototype.event_handler=function(n,e,t){t.element=e,n.preventDefault()},Mc.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var xr="$set",oA="$set_once",mn="$unset",Ai="$add",Qn="$append",si="$union",Xn="$remove",MD="$delete",IC={set_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[xr]=r,t},unset_action:function(n){var e={},t=[];return m.isArray(n)||(n=[n]),m.each(n,function(r){this._is_reserved_property(r)||t.push(r)},this),e[mn]=t,e},set_once_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[oA]=r,t},union_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=m.isArray(i)?i:[i])},this):r[n]=m.isArray(e)?e:[e],t[si]=r,t},append_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[Qn]=r,t},remove_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[Xn]=r,t},delete_action:function(){var n={};return n[MD]="",n}},De=function(){};m.extend(De.prototype,IC),De.prototype._init=function(n,e,t){this._mixpanel=n,this._group_key=e,this._group_id=t},De.prototype.set=nA(function(n,e,t){var r=this.set_action(n,e);return m.isObject(n)&&(t=e),this._send_request(r,t)}),De.prototype.set_once=nA(function(n,e,t){var r=this.set_once_action(n,e);return m.isObject(n)&&(t=e),this._send_request(r,t)}),De.prototype.unset=nA(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),De.prototype.union=nA(function(n,e,t){m.isObject(n)&&(t=e);var r=this.union_action(n,e);return this._send_request(r,t)}),De.prototype.delete=nA(function(n){var e=this.delete_action();return this._send_request(e,n)}),De.prototype.remove=nA(function(n,e,t){var r=this.remove_action(n,e);return this._send_request(r,t)}),De.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var t=m.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:t,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},De.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},De.prototype._get_config=function(n){return this._mixpanel.get_config(n)},De.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},De.prototype.remove=De.prototype.remove,De.prototype.set=De.prototype.set,De.prototype.set_once=De.prototype.set_once,De.prototype.union=De.prototype.union,De.prototype.unset=De.prototype.unset,De.prototype.toString=De.prototype.toString;var $=function(){};m.extend($.prototype,IC),$.prototype._init=function(n){this._mixpanel=n},$.prototype.set=Fr(function(n,e,t){var r=this.set_action(n,e);return m.isObject(n)&&(t=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[xr]=m.extend({},m.info.people_properties(),r[xr]),this._send_request(r,t)}),$.prototype.set_once=Fr(function(n,e,t){var r=this.set_once_action(n,e);return m.isObject(n)&&(t=e),this._send_request(r,t)}),$.prototype.unset=Fr(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),$.prototype.increment=Fr(function(n,e,t){var r={},i={};return m.isObject(n)?(m.each(n,function(A,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(A))){we.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[s]=A},this),t=e):(m.isUndefined(e)&&(e=1),i[n]=e),r[Ai]=i,this._send_request(r,t)}),$.prototype.append=Fr(function(n,e,t){m.isObject(n)&&(t=e);var r=this.append_action(n,e);return this._send_request(r,t)}),$.prototype.remove=Fr(function(n,e,t){m.isObject(n)&&(t=e);var r=this.remove_action(n,e);return this._send_request(r,t)}),$.prototype.union=Fr(function(n,e,t){m.isObject(n)&&(t=e);var r=this.union_action(n,e);return this._send_request(r,t)}),$.prototype.track_charge=Fr(function(){we.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")}),$.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},$.prototype.delete_user=function(){if(!this._identify_called()){we.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},$.prototype.toString=function(){return this._mixpanel.toString()+".people"},$.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var t=this._mixpanel.get_property("$device_id"),r=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");t&&(n.$device_id=t),r&&(n.$user_id=r),i&&(n.$had_persisted_distinct_id=i);var A=m.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:A,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(A,255))},$.prototype._get_config=function(n){return this._mixpanel.get_config(n)},$.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},$.prototype._enqueue=function(n){xr in n?this._mixpanel.persistence._add_to_people_queue(xr,n):oA in n?this._mixpanel.persistence._add_to_people_queue(oA,n):mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):Ai in n?this._mixpanel.persistence._add_to_people_queue(Ai,n):Qn in n?this._mixpanel.persistence._add_to_people_queue(Qn,n):Xn in n?this._mixpanel.persistence._add_to_people_queue(Xn,n):si in n?this._mixpanel.persistence._add_to_people_queue(si,n):we.error("Invalid call to _enqueue():",n)},$.prototype._flush_one_queue=function(n,e,t,r){var i=this,A=m.extend({},this._mixpanel.persistence.load_queue(n)),s=A;!m.isUndefined(A)&&m.isObject(A)&&!m.isEmptyObject(A)&&(i._mixpanel.persistence._pop_from_people_queue(n,A),i._mixpanel.persistence.save(),r&&(s=r(A)),e.call(i,s,function(o,a){o===0&&i._mixpanel.persistence._add_to_people_queue(n,A),m.isUndefined(t)||t(o,a)}))},$.prototype._flush=function(n,e,t,r,i,A,s){var o=this;this._flush_one_queue(xr,this.set,n),this._flush_one_queue(oA,this.set_once,r),this._flush_one_queue(mn,this.unset,A,function(g){return m.keys(g)}),this._flush_one_queue(Ai,this.increment,e),this._flush_one_queue(si,this.union,i);var a=this._mixpanel.persistence.load_queue(Qn);if(!m.isUndefined(a)&&m.isArray(a)&&a.length)for(var c,u=function(g,v){g===0&&o._mixpanel.persistence._add_to_people_queue(Qn,c),m.isUndefined(t)||t(g,v)},l=a.length-1;l>=0;l--)a=this._mixpanel.persistence.load_queue(Qn),c=a.pop(),o._mixpanel.persistence.save(),m.isEmptyObject(c)||o.append(c,u);var d=this._mixpanel.persistence.load_queue(Xn);if(!m.isUndefined(d)&&m.isArray(d)&&d.length)for(var h,f=function(g,v){g===0&&o._mixpanel.persistence._add_to_people_queue(Xn,h),m.isUndefined(s)||s(g,v)},p=d.length-1;p>=0;p--)d=this._mixpanel.persistence.load_queue(Xn),h=d.pop(),o._mixpanel.persistence.save(),m.isEmptyObject(h)||o.remove(h,f)},$.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},$.prototype.set=$.prototype.set,$.prototype.set_once=$.prototype.set_once,$.prototype.unset=$.prototype.unset,$.prototype.increment=$.prototype.increment,$.prototype.append=$.prototype.append,$.prototype.remove=$.prototype.remove,$.prototype.union=$.prototype.union,$.prototype.track_charge=$.prototype.track_charge,$.prototype.clear_charges=$.prototype.clear_charges,$.prototype.delete_user=$.prototype.delete_user,$.prototype.toString=$.prototype.toString;var bp="__mps",Bp="__mpso",Cp="__mpus",_p="__mpa",Sp="__mpap",kp="__mpr",Ep="__mpu",FC="$people_distinct_id",Lc="__alias",Es="__timers",LD=[bp,Bp,Cp,_p,Sp,kp,Ep,FC,Lc,Es],re=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(we.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};re.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,t){m.include(LD,t)||(n[t]=e)}),n},re.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},re.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},re.prototype.save=function(){this.disabled||this.storage.set(this.name,tA(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},re.prototype.load_prop=function(n){return this.load(),this.props[n]},re.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},re.prototype.clear=function(){this.remove(),this.props={}},re.prototype.register_once=function(n,e,t){return m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),m.each(n,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===e)&&(this.props[i]=r)},this),this.save(),!0):!1},re.prototype.register=function(n,e){return m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.extend(this.props,n),this.save(),!0):!1},re.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},re.prototype.update_search_keyword=function(n){this.register(m.info.searchInfo(n))},re.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},re.prototype.get_referrer_info=function(){return m.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},re.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},re.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},re.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},re.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},re.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},re.prototype.get_cross_subdomain=function(){return this.cross_subdomain},re.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},re.prototype._add_to_people_queue=function(n,e){var t=this._get_queue_key(n),r=e[n],i=this._get_or_create_queue(xr),A=this._get_or_create_queue(oA),s=this._get_or_create_queue(mn),o=this._get_or_create_queue(Ai),a=this._get_or_create_queue(si),c=this._get_or_create_queue(Xn,[]),u=this._get_or_create_queue(Qn,[]);t===bp?(m.extend(i,r),this._pop_from_people_queue(Ai,r),this._pop_from_people_queue(si,r),this._pop_from_people_queue(mn,r)):t===Bp?(m.each(r,function(l,d){d in A||(A[d]=l)}),this._pop_from_people_queue(mn,r)):t===Cp?m.each(r,function(l){m.each([i,A,o,a],function(d){l in d&&delete d[l]}),m.each(u,function(d){l in d&&delete d[l]}),s[l]=!0}):t===_p?(m.each(r,function(l,d){d in i?i[d]+=l:(d in o||(o[d]=0),o[d]+=l)},this),this._pop_from_people_queue(mn,r)):t===Ep?(m.each(r,function(l,d){m.isArray(l)&&(d in a||(a[d]=[]),m.each(l,function(h){m.include(a[d],h)||a[d].push(h)}))}),this._pop_from_people_queue(mn,r)):t===kp?(c.push(r),this._pop_from_people_queue(Qn,r)):t===Sp&&(u.push(r),this._pop_from_people_queue(mn,r)),we.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),we.log(e),this.save()},re.prototype._pop_from_people_queue=function(n,e){var t=this.props[this._get_queue_key(n)];m.isUndefined(t)||m.each(e,function(r,i){n===Qn||n===Xn?m.each(t,function(A){A[i]===r&&delete A[i]}):delete t[i]},this)},re.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},re.prototype._get_queue_key=function(n){if(n===xr)return bp;if(n===oA)return Bp;if(n===mn)return Cp;if(n===Ai)return _p;if(n===Qn)return Sp;if(n===Xn)return kp;if(n===si)return Ep;we.error("Invalid queue:",n)},re.prototype._get_or_create_queue=function(n,e){var t=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[t]||(this.props[t]=e)},re.prototype.set_event_timer=function(n,e){var t=this.load_prop(Es)||{};t[n]=e,this.props[Es]=t,this.save()},re.prototype.remove_event_timer=function(n){var e=this.load_prop(Es)||{},t=e[n];return m.isUndefined(t)||(delete this.props[Es][n],this.save()),t};var Up,xC=function(n,e){throw new Error(n+" not available in this build.")},Ut,QC=0,DD=1,ND=function(n){return n},en="mixpanel",RC="base64",HD="json",Tp="$device:",aA=V.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,PC=!aA&&qn.indexOf("MSIE")===-1&&qn.indexOf("Mozilla")===-1,Dc=null;Ur.sendBeacon&&(Dc=function(){return Ur.sendBeacon.apply(Ur,arguments)});var OC={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/"},MC={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:OC,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:RC,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:Tr,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:Tr,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_heatmap_data:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:bs,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},LC=!1,U=function(){},Ip=function(n,e,t){var r,i=t===en?Ut:Ut[t];if(i&&Up===QC)r=i;else{if(i&&!m.isArray(i)){we.error("You have already initialized "+t);return}r=new U}if(r._cached_groups={},r._init(n,e,t),r.people=new $,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var A=m.info.campaignParams(null),s={},o=!1;m.each(A,function(a,c){s["initial_"+c]=a,a&&(o=!0)}),o&&r.people.set_once(s)}return gn.DEBUG=gn.DEBUG||r.get_config("debug"),!m.isUndefined(i)&&m.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};U.prototype.init=function(n,e,t){if(m.isUndefined(t)){this.report_error("You must name your new library: init(token, config, name)");return}if(t===en){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=Ip(n,e,t);return Ut[t]=r,r._loaded(),r},U.prototype._init=function(n,e,t){e=e||{},this.__loaded=!0,this.config={};var r={};if(!("api_payload_format"in e)){var i=e.api_host||MC.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=HD)}if(this.set_config(m.extend({},MC,r,e,{name:t,token:n,callback_fn:(t===en?t:en+"."+t)+"._jsc"})),this._jsc=Tr,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!m.localStorage.is_supported(!0)||!aA)this._batch_requests=!1,we.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(o){we.log("Clearing batch queue "+o.queue_key),m.localStorage.remove(o.queue_key)});else if(this.init_batchers(),Dc&&V.addEventListener){var A=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);V.addEventListener("pagehide",function(o){o.persisted&&A()}),V.addEventListener("visibilitychange",function(){ye.visibilityState==="hidden"&&A()})}}this.persistence=this.cookie=new re(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:Tp+s,$device_id:s},""),this.flags=new ae({getFullApiRoute:m.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:m.bind(this.get_config,this),setConfigFunc:m.bind(this.set_config,this),getPropertyFunc:m.bind(this.get_property,this),trackingFunc:m.bind(this.track,this)}),this.flags.init(),this.flags=this.flags,this.autocapture=new Qt(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},U.prototype._init_tab_id=function(){if(m.sessionStorage.is_supported())try{var n=this.get_config("name")+"_"+this.get_config("token"),e="mp_tab_id_"+n,t="mp_gen_new_tab_id_"+n;(m.sessionStorage.get(t)||!m.sessionStorage.get(e))&&m.sessionStorage.set(e,"$tab-"+m.UUID()),m.sessionStorage.set(t,"1"),this.tab_id=m.sessionStorage.get(e),V.addEventListener("beforeunload",function(){m.sessionStorage.remove(t)})}catch(r){this.report_error("Error initializing tab id",r)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},U.prototype.get_tab_id=function(){return this.tab_id||null},U.prototype._should_load_recorder=function(){var n=new In(sp),e=this.get_tab_id();return n.init().then(function(){return n.getAll()}).then(function(t){for(var r=0;r<t.length;r++)if(up(t[r])||t[r].tabId===e)return!0;return!1}).catch(m.bind(function(t){this.report_error("Error checking recording registry",t)},this))},U.prototype._check_and_start_session_recording=Ir(function(n){if(!V.MutationObserver){we.critical("Browser does not support MutationObserver; skipping session recording");return}var e=m.bind(function(r){var i=m.bind(function(){this._recorder=this._recorder||new V.__mp_recorder(this),this._recorder.resumeRecording(r)},this);m.isUndefined(V.__mp_recorder)?xC(this.get_config("recorder_src"),i):i()},this),t=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");n||t?e(!0):this._should_load_recorder().then(function(r){r&&e(!1)})}),U.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},U.prototype.stop_session_recording=function(){return this._recorder?this._recorder.stopRecording():Promise.resolve()},U.prototype.pause_session_recording=function(){return this._recorder?this._recorder.pauseRecording():Promise.resolve()},U.prototype.resume_session_recording=function(){return this._recorder?this._recorder.resumeRecording():Promise.resolve()},U.prototype.is_recording_heatmap_data=function(){return this._get_session_replay_id()&&this.get_config("record_heatmap_data")},U.prototype.get_session_recording_properties=function(){var n={},e=this._get_session_replay_id();return e&&(n.$mp_replay_id=e),n},U.prototype.get_session_replay_url=function(){var n=null,e=this._get_session_replay_id();if(e){var t=m.HTTPBuildQuery({replay_id:e,distinct_id:this.get_distinct_id(),token:this.get_config("token")});n="https://mixpanel.com/projects/replay-redirect?"+t}return n},U.prototype._get_session_replay_id=function(){var n=null;return this._recorder&&(n=this._recorder.replayId),n||null},U.prototype.__get_recorder=function(){return this._recorder},U.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=m.info.campaignParams(null);m.each(n,(function(e,t){this.unregister(t)}).bind(this))}},U.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(ye.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(ye.referrer)},U.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},U.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!LC)return this.__dom_loaded_queue.push([n,e]),!1;var t=new n().init(this);return t.track.apply(t,e)},U.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(aA){var t=function(s){n(s,e)};return t}else{var r=this._jsc,i=""+Math.floor(Math.random()*1e8),A=this.get_config("callback_fn")+"["+i+"]";return r[i]=function(s){delete r[i],n(s,e)},A}},U.prototype._send_request=function(n,e,t,r){var i=!0;if(PC)return this.__request_queue.push(arguments),i;var A={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},s=null;!r&&(m.isFunction(t)||typeof t=="string")&&(r=t,t=null),t=m.extend(A,t||{}),aA||(t.method="GET");var o=t.method==="POST",a=Dc&&o&&t.transport.toLowerCase()==="sendbeacon",c=t.verbose;e.verbose&&(c=!0),this.get_config("test")&&(e.test=1),c&&(e.verbose=1),this.get_config("img")&&(e.img=1),aA||(r?e.callback=r:(c||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),o&&(s="data="+encodeURIComponent(e.data),delete e.data),m.extend(e,this.get_config("api_extra_query_params")),n+="?"+m.HTTPBuildQuery(e);var u=this;if("img"in e){var l=ye.createElement("img");l.src=n,ye.body.appendChild(l)}else if(a){try{i=Dc(n,s)}catch(v){u.report_error(v),i=!1}try{r&&r(i?1:0)}catch(v){u.report_error(v)}}else if(aA)try{var d=new XMLHttpRequest;d.open(t.method,n,!0);var h=this.get_config("xhr_headers");if(o&&(h["Content-Type"]="application/x-www-form-urlencoded"),m.each(h,function(v,y){d.setRequestHeader(y,v)}),t.timeout_ms&&typeof d.timeout<"u"){d.timeout=t.timeout_ms;var f=new Date().getTime()}d.withCredentials=!0,d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200){if(r)if(c){var v;try{v=m.JSONDecode(d.responseText)}catch(b){if(u.report_error(b),t.ignore_json_errors)v=d.responseText;else return}r(v)}else r(Number(d.responseText))}else{var y;if(d.timeout&&!d.status&&new Date().getTime()-f>=d.timeout?y="timeout":y="Bad HTTP status: "+d.status+" "+d.statusText,u.report_error(y),r)if(c){var B=d.responseHeaders||{};r({status:0,httpStatusCode:d.status,error:y,retryAfter:B["Retry-After"]})}else r(0)}},d.send(s)}catch(v){u.report_error(v),i=!1}else{var p=ye.createElement("script");p.type="text/javascript",p.async=!0,p.defer=!0,p.src=n;var g=ye.getElementsByTagName("script")[0];g.parentNode.insertBefore(p,g)}return i},U.prototype._execute_array=function(n){var e,t=[],r=[],i=[];m.each(n,function(s){s&&(e=s[0],m.isArray(e)?i.push(s):typeof s=="function"?s.call(this):m.isArray(s)&&e==="alias"?t.push(s):m.isArray(s)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?i.push(s):r.push(s))},this);var A=function(s,o){m.each(s,function(a){if(m.isArray(a[0])){var c=o;m.each(a,function(u){c=c[u[0]].apply(c,u.slice(1))})}else this[a[0]].apply(this,a.slice(1))},o)};A(t,this),A(r,this),A(i,this)},U.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},U.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:n+"_ev"},people:{type:"people",api_name:"engage",queue_key:n+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:n+"_gr"}},this._batcher_configs},U.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=m.bind(function(t){return new $t(t.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.bind(function(r,i,A){var s=this.get_config("api_routes");this._send_request(this.get_api_host(t.api_name)+"/"+s[t.api_name],this._encode_data_for_request(r),i,this._prepare_callback(A,r))},this),beforeSendHook:m.bind(function(r){return this._run_hook("before_send_"+t.type,r)},this),stopAllBatchingFunc:m.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},U.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,m.each(this.request_batchers,function(n){n.start()}))},U.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.each(this.request_batchers,function(n){n.stop(),n.clear()})},U.prototype.push=function(n){this._execute_array([n])},U.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},U.prototype._encode_data_for_request=function(n){var e=tA(n);return this.get_config("api_payload_format")===RC&&(e=m.base64Encode(e)),{data:e}},U.prototype._track_or_batch=function(n,e){var t=m.truncate(n.data,255),r=n.endpoint,i=n.batcher,A=n.should_send_immediately,s=n.send_request_options||{};e=e||Tr;var o=!0,a=m.bind(function(){return s.skip_hooks||(t=this._run_hook("before_send_"+n.type,t)),t?(we.log("MIXPANEL REQUEST:"),we.log(t),this._send_request(r,this._encode_data_for_request(t),s,this._prepare_callback(e,t))):null},this);return this._batch_requests&&!A?i.enqueue(t).then(function(c){c?e(1,t):a()}):o=a(),o&&t},U.prototype.track=Ir(function(n,e,t,r){!r&&typeof t=="function"&&(r=t,t=null),t=t||{};var i=t.transport;i&&(t.transport=i);var A=t.send_immediately;if(typeof r!="function"&&(r=Tr),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){r(0);return}e=m.extend({},e),e.token=this.get_config("token");var s=this.persistence.remove_event_timer(n);if(!m.isUndefined(s)){var o=new Date().getTime()-s;e.$duration=parseFloat((o/1e3).toFixed(3))}this._set_default_superprops();var a=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),a,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var c=this.get_config("property_blacklist");m.isArray(c)?m.each(c,function(d){delete e[d]}):this.report_error("Invalid value for property_blacklist config: "+c);var u={event:n,properties:e},l=this._track_or_batch({type:"events",data:u,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:A,send_request_options:t},r);return l}),U.prototype.set_group=Ir(function(n,e,t){m.isArray(e)||(e=[e]);var r={};return r[n]=e,this.register(r),this.people.set(n,e,t)}),U.prototype.add_group=Ir(function(n,e,t){var r=this.get_property(n),i={};return r===void 0?(i[n]=[e],this.register(i)):r.indexOf(e)===-1&&(r.push(e),i[n]=r,this.register(i)),this.people.union(n,e,t)}),U.prototype.remove_group=Ir(function(n,e,t){var r=this.get_property(n);if(r!==void 0){var i=r.indexOf(e);i>-1&&(r.splice(i,1),this.register({group_key:r})),r.length===0&&this.unregister(n)}return this.people.remove(n,e,t)}),U.prototype.track_with_groups=Ir(function(n,e,t,r){var i=m.extend({},e||{});return m.each(t,function(A,s){A!=null&&(i[s]=A)}),this.track(n,i,r)}),U.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},U.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},U.prototype.get_group=function(n,e){var t=this._create_map_key(n,e),r=this._cached_groups[t];return(r===void 0||r._group_key!==n||r._group_id!==e)&&(r=new De,r._init(this,n,e),this._cached_groups[t]=r),r},U.prototype.track_pageview=Ir(function(n,e){typeof n!="object"&&(n={}),e=e||{};var t=e.event_name||"$mp_web_page_view",r=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),i=m.extend({},r,n);return this.track(t,i)}),U.prototype.track_links=function(){return this._track_dom.call(this,sA,arguments)},U.prototype.track_forms=function(){return this._track_dom.call(this,Mc,arguments)},U.prototype.time_event=function(n){if(m.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var KD={persistent:!0},Fp=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},KD,e)};U.prototype.register=function(n,e){var t=Fp(e);t.persistent?this.persistence.register(n,t.days):m.extend(this.unpersisted_superprops,n)},U.prototype.register_once=function(n,e,t){var r=Fp(t);r.persistent?this.persistence.register_once(n,e,r.days):(typeof e>"u"&&(e="None"),m.each(n,function(i,A){(!this.unpersisted_superprops.hasOwnProperty(A)||this.unpersisted_superprops[A]===e)&&(this.unpersisted_superprops[A]=i)},this))},U.prototype.unregister=function(n,e){e=Fp(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},U.prototype._register_single=function(n,e){var t={};t[n]=e,this.register(t)},U.prototype.identify=function(n,e,t,r,i,A,s,o){var a=this.get_distinct_id();if(n&&a!==n){if(typeof n=="string"&&n.indexOf(Tp)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var c=a;this.register_once({$had_persisted_distinct_id:!0,$device_id:c},"")}n!==a&&n!==this.get_property(Lc)&&(this.unregister(Lc),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,t,r,i,A,s,o),n!==a&&this.track("$identify",{distinct_id:n,$anon_distinct_id:a},{skip_hooks:!0}),n!==a&&this.flags.fetchFlags()},U.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:Tp+n,$device_id:n},""),this._check_and_start_session_recording()},U.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},U.prototype.alias=function(n,e){if(n===this.get_property(FC))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var t=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Lc,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){t.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},U.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},U.prototype.set_config=function(n){if(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.each(this.request_batchers,function(t){t.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),gn.DEBUG=gn.DEBUG||this.get_config("debug"),("autocapture"in n||"record_heatmap_data"in n)&&this.autocapture&&this.autocapture.init()}},U.prototype.get_config=function(n){return this.config[n]},U.prototype._run_hook=function(n){var e=(this.config.hooks[n]||ND).apply(this,ni.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},U.prototype.get_property=function(n){return this.persistence.load_prop([n])},U.prototype.get_api_host=function(n){return this.get_config("api_hosts")[n]||this.get_config("api_host")},U.prototype.toString=function(){var n=this.get_config("name");return n!==en&&(n=en+"."+n),n},U.prototype._event_is_disabled=function(n){return m.isBlockedUA(qn)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},U.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||m.cookie.get("mp_optout"))&&(m.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},U.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},U.prototype._gdpr_call_func=function(n,e){return e=m.extend({track:m.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),m.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},U.prototype.opt_in_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(oD,n),this._gdpr_update_persistence(n)},U.prototype.opt_out_tracking=function(n){n=m.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(aD,n),this._gdpr_update_persistence(n)},U.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(cD,n)},U.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(zB,n)},U.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(uD,n),this._gdpr_update_persistence(n)},U.prototype.report_error=function(n,e){we.error.apply(we.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){we.error(t)}},U.prototype.init=U.prototype.init,U.prototype.reset=U.prototype.reset,U.prototype.disable=U.prototype.disable,U.prototype.time_event=U.prototype.time_event,U.prototype.track=U.prototype.track,U.prototype.track_links=U.prototype.track_links,U.prototype.track_forms=U.prototype.track_forms,U.prototype.track_pageview=U.prototype.track_pageview,U.prototype.register=U.prototype.register,U.prototype.register_once=U.prototype.register_once,U.prototype.unregister=U.prototype.unregister,U.prototype.identify=U.prototype.identify,U.prototype.alias=U.prototype.alias,U.prototype.name_tag=U.prototype.name_tag,U.prototype.set_config=U.prototype.set_config,U.prototype.get_config=U.prototype.get_config,U.prototype.get_api_host=U.prototype.get_api_host,U.prototype.get_property=U.prototype.get_property,U.prototype.get_distinct_id=U.prototype.get_distinct_id,U.prototype.toString=U.prototype.toString,U.prototype.opt_out_tracking=U.prototype.opt_out_tracking,U.prototype.opt_in_tracking=U.prototype.opt_in_tracking,U.prototype.has_opted_out_tracking=U.prototype.has_opted_out_tracking,U.prototype.has_opted_in_tracking=U.prototype.has_opted_in_tracking,U.prototype.clear_opt_in_out_tracking=U.prototype.clear_opt_in_out_tracking,U.prototype.get_group=U.prototype.get_group,U.prototype.set_group=U.prototype.set_group,U.prototype.add_group=U.prototype.add_group,U.prototype.remove_group=U.prototype.remove_group,U.prototype.track_with_groups=U.prototype.track_with_groups,U.prototype.start_batch_senders=U.prototype.start_batch_senders,U.prototype.stop_batch_senders=U.prototype.stop_batch_senders,U.prototype.start_session_recording=U.prototype.start_session_recording,U.prototype.stop_session_recording=U.prototype.stop_session_recording,U.prototype.pause_session_recording=U.prototype.pause_session_recording,U.prototype.resume_session_recording=U.prototype.resume_session_recording,U.prototype.get_session_recording_properties=U.prototype.get_session_recording_properties,U.prototype.get_session_replay_url=U.prototype.get_session_replay_url,U.prototype.get_tab_id=U.prototype.get_tab_id,U.prototype.DEFAULT_API_ROUTES=OC,U.prototype.__get_recorder=U.prototype.__get_recorder,re.prototype.properties=re.prototype.properties,re.prototype.update_search_keyword=re.prototype.update_search_keyword,re.prototype.update_referrer_info=re.prototype.update_referrer_info,re.prototype.get_cross_subdomain=re.prototype.get_cross_subdomain,re.prototype.clear=re.prototype.clear;var cA={},VD=function(){m.each(cA,function(n,e){e!==en&&(Ut[e]=n)}),Ut._=m},GD=function(){Ut.init=function(n,e,t){if(t)return Ut[t]||(Ut[t]=cA[t]=Ip(n,e,t),Ut[t]._loaded()),Ut[t];var r=Ut;cA[en]?r=cA[en]:n&&(r=Ip(n,e,en),r._loaded(),cA[en]=r),Ut=r,Up===DD&&(V[en]=Ut),VD()}},jD=function(){function n(){n.done||(n.done=!0,LC=!0,PC=!1,m.each(cA,function(r){r._dom_loaded()}))}function e(){try{ye.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(ye.addEventListener)ye.readyState==="complete"?n():ye.addEventListener("DOMContentLoaded",n,!1);else if(ye.attachEvent){ye.attachEvent("onreadystatechange",n);var t=!1;try{t=V.frameElement===null}catch{}ye.documentElement.doScroll&&t&&e()}m.register_event(V,"load",n,!0)};function WD(n){return xC=n,Up=QC,Ut=new U,GD(),Ut.init(),jD(),Ut}function qD(n,e){e()}var Nc=WD(qD);iy({identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}});function JD(n,e={}){const t=e.instanceName||`obi_${Math.random().toString(36).slice(2)}`;Nc.init(n,{debug:e.debug===!0,track_pageview:!1,persistence:"localStorage",...e.config||{}},t);const r=Nc.get_instance?Nc.get_instance(t):Nc[t];return{identify:(i,A)=>{var s;try{r.identify(i),A&&((s=r==null?void 0:r.people)!=null&&s.set)&&r.people.set(A)}catch{}},track:(i,A)=>{try{r.track(i,A||{})}catch{}},page:(i,A)=>{try{r.track("Page Viewed",{name:i,...A||{}})}catch{}},reset:()=>{try{r.reset()}catch{}}}}let xp=null;function Se(){return xp||(xp=JD("d37cde23ca4b5d8c7ed30653f07f9e47"),xp)}const zD=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,DC="9.23.0",uA=globalThis;function XD(n,e,t=uA){const r=t.__SENTRY__=t.__SENTRY__||{},i=r[DC]=r[DC]||{};return i[n]||(i[n]=e())}const YD="Sentry Logger ",NC=["debug","info","warn","error","log","assert","trace"],HC={};function ZD(n){if(!("console"in uA))return n();const e=uA.console,t={},r=Object.keys(HC);r.forEach(i=>{const A=HC[i];t[i]=e[i],e[i]=A});try{return n()}finally{r.forEach(i=>{e[i]=t[i]})}}function $D(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return zD?NC.forEach(t=>{e[t]=(...r)=>{n&&ZD(()=>{uA.console[t](`${YD}[${t}]:`,...r)})}}):NC.forEach(t=>{e[t]=()=>{}}),e}XD("logger",$D);const KC=1e3;function e4(){return Date.now()/KC}function t4(){const{performance:n}=uA;if(!(n!=null&&n.now))return e4;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/KC}t4();const VC=50,lA="?",GC=/\(error: (.*)\)/,jC=/captureMessage|captureException/;function n4(...n){const e=n.sort((t,r)=>t[0]-r[0]).map(t=>t[1]);return(t,r=0,i=0)=>{const A=[],s=t.split(`
|
|
124
124
|
`);for(let o=r;o<s.length;o++){const a=s[o];if(a.length>1024)continue;const c=GC.test(a)?a.replace(GC,"$1"):a;if(!c.match(/\S*Error: /)){for(const u of e){const l=u(c);if(l){A.push(l);break}}if(A.length>=VC+i)break}}return r4(A.slice(i))}}function r4(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(Hc(e).function||"")&&e.pop(),e.reverse(),jC.test(Hc(e).function||"")&&(e.pop(),jC.test(Hc(e).function||"")&&e.pop()),e.slice(0,VC).map(t=>({...t,filename:t.filename||Hc(e).filename,function:t.function||lA}))}function Hc(n){return n[n.length-1]||{}}var WC;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(WC||(WC={})),uA._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const i4=30,A4=50;function Qp(n,e,t,r){const i={filename:n,function:e==="<anonymous>"?lA:e,in_app:!0};return t!==void 0&&(i.lineno=t),r!==void 0&&(i.colno=r),i}const s4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,o4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a4=/\((\S*)(?::(\d+))(?::(\d+))\)/,c4=n=>{const e=s4.exec(n);if(e){const[,r,i,A]=e;return Qp(r,lA,+i,+A)}const t=o4.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const A=a4.exec(t[2]);A&&(t[2]=A[1],t[3]=A[2],t[4]=A[3])}const[r,i]=qC(t[1]||lA,t[2]);return Qp(i,r,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},u4=[i4,c4],l4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,d4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;n4(...[u4,[A4,n=>{const e=l4.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=d4.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let t=e[3],r=e[1]||lA;return[r,t]=qC(r,t),Qp(t,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const qC=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,r=n.indexOf("safari-web-extension")!==-1;return t||r?[n.indexOf("@")!==-1?n.split("@")[0]:lA,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const h4=`:root,:host{--obi-modal-padding: 48px 48px 32px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 12px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 545px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:100%}.tour-content .title{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:700;font-size:32px;line-height:90%;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0}.tour-content .subtitle{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{width:480px;height:240px;margin-top:24px;border-radius:12px;display:flex;align-items:center;justify-content:center;position:relative}.tour-content .description{width:100%;min-height:48px;margin:24px 0 0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b}.tour-content .button-container{display:flex;margin-top:24px;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;min-width:200px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{flex:1;display:flex;flex-direction:column}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transform:translateY(0);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out;width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-message{display:inline-flex;align-items:center;justify-content:center;min-width:140px;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:6px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:2px 0;height:6px;flex:1;min-width:0}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-course-progress-container{display:none;width:100%;max-height:0;opacity:0;transform:translateY(-10px);overflow:hidden;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel:hover .obi-course-progress-container{display:block;max-width:22 0px;animation:expand-course-progress .3s ease-in-out forwards}.obi-widget-panel:hover .obi-course-progress-container.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:4px}.obi-widget-out-of-plan .text{font-size:16px;color:#fff;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
|
|
125
|
-
`;function p4(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function f4(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(r=>{try{const i=p4(r);return i.test(t)||i.test(n)}catch(i){return console.warn(`Invalid URL pattern: ${r}`,i),!1}})}function Rp(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return f4(e,n)}function g4(n){var b,w,_,k,F,x;const[e,t]=ge(!1),[r,i]=ge(!1),[A,s]=ge(null),o=m4(n.sdk,a,n.shadowHost,s);function a(E){var T;(T=o.client)!=null&&T.session||(t(E),E&&Se().track("course-list-opened"))}if(!o.client)return null;const c=v4((b=o.client.product)==null?void 0:b.widget_url_blacklist);let u=o.isActive;((_=(w=o.client)==null?void 0:w.product)==null?void 0:_.name)==="Canibuild"&&(u=!0);const l=o.client.session,d=!!l,h=d&&!e;let f;switch(l==null?void 0:l.speakingState){case"listening":f="user-speaking";break;case"speaking":f="agent-speaking";break;case"thinking":f="thinking";break;case"busy":f="busy";break}const p=l==null?void 0:l.isPaused,g=d||o.client.state==="ready"&&u&&!c&&(o.client.selectedPlan||!((k=o.client.product)!=null&&k.widget_link_only_access)),v=h?100:62,y=()=>{var E,T,Q,M,X,H;return{name:(E=o.client.selectedPlan)==null?void 0:E.name,description:(T=o.client.selectedPlan)==null?void 0:T.description,appName:(Q=o.client.product)==null?void 0:Q.name,appLogoUrl:((M=o.client.product)==null?void 0:M.logo_url)||"",url:(X=o.client.product)==null?void 0:X.url,agentName:((H=o.client.product)==null?void 0:H.agent_name)||"Obi"}},B=((F=o.client.product)==null?void 0:F.widget_position)==="bottom-right"?{position:"fixed",top:`calc(100vh - ${v}px)`,right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",top:`calc(100vh - ${v}px)`,left:"50%",transform:"translateX(-50%)",width:"max-content"};return C("div",{children:[e&&C(hR,{open:e,courses:o.client.plans.map(E=>({id:E.uuid,name:E.name,description:E.description||"",duration:E.duration||0})),loading:!1,agentName:((x=o.client.product)==null?void 0:x.agent_name)||"Obi",onCourseHighlight:E=>{E&&Se().track("course-selected",{courseName:E.name,courseUuid:E.id})},onCourseSelect:E=>{const T=o.client.plans.find(Q=>Q.uuid===E.id)||null;T&&(T==null?void 0:T.uuid)!==o.client.selectedPlanUuid&&(o.client.selectPlan(T),t(!1),i(!0),Se().track("course-get-started",{courseName:E.name,courseUuid:E.id}))},onClose:E=>{E==="user-initiated"&&o.client.selectPlan(null),t(!1)}}),g&&C(St,{children:[C("div",{style:B,children:C(JQ,{inPlan:d,isActive:r?!1:void 0,defaultIsActive:!0,isPaused:p,messaging:(l==null?void 0:l.isMicShared)===!1?!0:void 0,speakingStatus:f,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,courseProgress:A,onOpen:()=>{t(!0),Se().track("course-list-opened")},onCancelClick:()=>{Se().track("close-button-clicked")},onCancelAbort:()=>{Se().track("close-confirmation-no")},onCancel:()=>{var E;(E=o.client.session)==null||E.stop(),Se().track("close-confirmation-yes")},onCancelReason:(E,T)=>{Se().track("close-survey-answered",{reason:E,reasonText:T})},onPause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.pause)==null||T.call(E),Se().track("pause-button-clicked")},onUnpause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.unpause)==null||T.call(E),Se().track("play-button-clicked")},onMessagingChange:E=>{var T,Q,M,X;E?((Q=(T=o.client.session)==null?void 0:T.muteMicrophone)==null||Q.call(T),Se().track("switch-to-chat-clicked")):((X=(M=o.client.session)==null?void 0:M.unmuteMicrophone)==null||X.call(M),Se().track("switch-to-voice-clicked"))},onMessageChange:E=>{Se().track("chat-input-provided",{message:E,length:E.length})},onMessage:E=>{o.say(E),Se().track("chat-message-sent")},onHover:E=>{E&&!d&&Se().track("widget-hover-on")},onOneClickAction:E=>{Se().track("one-click-action-clicked",{action:E})},onMinimize:()=>{Se().track("minimise-button-clicked",{inSession:d})}})}),!!o.client.selectedPlan&&C(fR,{open:!0,session:y(),sessionState:(l==null?void 0:l.state)||null,speakingState:(l==null?void 0:l.speakingState)||null,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,onModalChange:E=>{E==="session-start"?Se().track("course-screen-opened"):E==="voice-guidance"?Se().track("can-you-hear-opened"):E==="overview"?Se().track("welcome-tour-opened"):E==="share-mic"&&Se().track("connect-mic-opened")},onClose:(E,T)=>{var Q,M;E==="user-initiated"&&(T==="session-start"?Se().track("course-screen-closed"):T==="voice-guidance"?Se().track("can-you-hear-closed"):T==="overview"?Se().track("welcome-tour-closed"):T==="share-mic"&&Se().track("connect-mic-closed"),((Q=o.client.session)==null?void 0:Q.state)==="mic-share"?(M=o.client.session)==null||M.shareMicrophoneFailed():o.client.stopSession()),i(!1)},onStart:()=>{o.client.selectedPlanUuid&&(Se().track("course-screen-continue"),o.startSession())},onContinue:()=>{l==null||l.continue(),Se().track("can-you-hear-continue")},onShareMicrophone:()=>{l==null||l.shareMicrophone(),Se().track("connect-mic-continue")}})]})]})}function m4(n,e,t,r){const[i,A]=ge(0),[s,o]=ge(null);return Kt(()=>{n.on("showMenu",a=>{e(a)}),n.on("configUpdated",()=>{A(a=>a+1)})},[n]),Kt(()=>{n.client&&(n.client.session&&o(n.client.session),n.client.on("sessionStarted",a=>{o(a),A(c=>c+1)}),n.client.on("sessionStopped",()=>{o(null),A(a=>a+1)}),n.client.on("sessionShutdown",()=>{A(a=>a+1)}),n.client.on("sessionResumed",()=>{A(a=>a+1)}),n.client.on("stateChanged",()=>{var a;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((a=n.client.product)==null?void 0:a.primary_color)||"#9500FF"),A(c=>c+1)}),n.client.on("planSelected",()=>{A(a=>a+1)}))},[n,n.client]),Kt(()=>{if(!s)return;s.on("stateChanged",()=>{A(c=>c+1)}),s.on("speakingStateChanged",()=>{A(c=>c+1)}),s.on("paused",()=>{A(c=>c+1)}),s.on("unpaused",()=>{A(c=>c+1)});const a=c=>{r(c)};return s.on&&s.on("courseProgress",a),()=>{s.off&&s.off("courseProgress",a)}},[s]),n}function v4(n){const[e,t]=ge(()=>Rp(n));return Kt(()=>{t(Rp(n))},[n]),Kt(()=>{y4();const r=()=>{t(Rp(n))};return window.addEventListener("locationchange",r),window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{window.removeEventListener("locationchange",r),window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}},[n]),e}function y4(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,r=i=>function(...A){const s=i.apply(this,A);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=r(e),window.history.replaceState=r(t),n.__obi_history_patched=!0}function w4(n){if(document.querySelector("obi-widget"))return;b4();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),r=document.createElement("div");r.id="obi-container",t.appendChild(r);const i=new CSSStyleSheet;i.replaceSync(h4),t.adoptedStyleSheets=[i],gQ(C(g4,{sdk:n,shadowHost:e}),r),console.log("[obi-sdk] widget mounted")}function b4(){JC("https://fonts.cdnfonts.com/css/satoshi"),JC("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function JC(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const zC="49206C6F7665204F6269_session",XC="obi-url-params";class B4 extends Gc{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,r)=>{var i,A,s,o,a;switch(t){case"update":this.updateConfig(r);break;case"startSession":if(!(r!=null&&r.planUuid)){console.warn("[obi] startSession command requires a planUuid",r);return}const c=(((i=this.client)==null?void 0:i.plans)||[]).find(u=>u.uuid===r.planUuid)||null;if(!c){console.warn("[obi] startSession command requires a valid planUuid",r);return}this.updateActive(!0),(s=(A=this.client)==null?void 0:A.selectPlan)==null||s.call(A,c);break;case"stopSession":(a=(o=this.client)==null?void 0:o.stopSession)==null||a.call(o);break;case"say":this.say(r);break;default:console.warn("[obi] unknown command",{commandType:t,args:r})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const r=this.load();if(r)try{t=fa.deserialise(r,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(i){console.error("[obi] error loading cached client",i)}t||(t=new fa(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",i=>{var A,s,o;i==="ready"&&this.updateConfig({isActive:(A=this.client)==null?void 0:A.showWidget,primaryColour:((o=(s=this.client)==null?void 0:s.product)==null?void 0:o.primary_color)||"#9500FF"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",i=>{i==="invalid-room"&&localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(i,A)=>{Se().track(i,A)}),this.client.session&&this.client.resumeSession(i=>{i.on("stateChanged",A=>{A!=="disconnecting"&&A!=="disconnected"&&A!=="error"&&A!=="connecting"&&this.save()}),i.on("paused",()=>{this.save()}),i.on("unpaused",()=>{this.save()})})}async initialise(e={}){this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(t=>{console.error("[obi] error initialising client",t),this.emit("error",t)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(r=>{console.error("[obi] error initialising client",r),this.emit("error",r)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}async updateIdentity(e){var r;if(e===void 0||e==((r=this.client)==null?void 0:r.identity))return;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}),e!=null&&e.email&&Se().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,r,i;await((i=(r=(t=this.client)==null?void 0:t.session)==null?void 0:r.say)==null?void 0:i.call(r,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(r){console.error("[obi] error dispatching command",r)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(XC)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((A,s)=>{e[s]=A});const t=e[zC];if(!t)return null;const r=new URL(window.location.href);r.searchParams.delete(zC),window.history.replaceState({},"",r.toString()),r.toString(),localStorage.removeItem(XC),this.passivePlanUuid=t}mountWidget(){w4(this)}async captureScreen(){return(await BT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}save(){var e;localStorage.setItem("obi-client",((e=this.client)==null?void 0:e.serialise())||"")}load(){return localStorage.getItem("obi-client")}}async function YC(n){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return C4({appToken:n,window:e})}async function C4({appToken:n,window:e}){var i,A;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}n||(n=(i=e==null?void 0:e.obiWidgetConfig)==null?void 0:i.apiKey);let t;try{t=((A=e.ObiSDK)==null?void 0:A.q)||[]}catch{t=[]}const r=new B4(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:t}),e.obi=r,r.mountWidget(),r}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{YC()}):YC()})();
|
|
125
|
+
`;function p4(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function f4(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(r=>{try{const i=p4(r);return i.test(t)||i.test(n)}catch(i){return console.warn(`Invalid URL pattern: ${r}`,i),!1}})}function Rp(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return f4(e,n)}function g4(n){var b,w,_,k,F,x;const[e,t]=ge(!1),[r,i]=ge(!1),[A,s]=ge(null),o=m4(n.sdk,a,n.shadowHost,s);function a(E){var T;(T=o.client)!=null&&T.session||(t(E),E&&Se().track("course-list-opened"))}if(!o.client)return null;const c=v4((b=o.client.product)==null?void 0:b.widget_url_blacklist);let u=o.isActive;((_=(w=o.client)==null?void 0:w.product)==null?void 0:_.name)==="Canibuild"&&(u=!0);const l=o.client.session,d=!!l,h=d&&!e;let f;switch(l==null?void 0:l.speakingState){case"listening":f="user-speaking";break;case"speaking":f="agent-speaking";break;case"thinking":f="thinking";break;case"busy":f="busy";break}const p=l==null?void 0:l.isPaused,g=d||o.client.state==="ready"&&u&&!c&&(o.client.selectedPlan||!((k=o.client.product)!=null&&k.widget_link_only_access)),v=h?100:62,y=()=>{var E,T,Q,M,X,H;return{name:(E=o.client.selectedPlan)==null?void 0:E.name,description:(T=o.client.selectedPlan)==null?void 0:T.description,appName:(Q=o.client.product)==null?void 0:Q.name,appLogoUrl:((M=o.client.product)==null?void 0:M.logo_url)||"",url:(X=o.client.product)==null?void 0:X.url,agentName:((H=o.client.product)==null?void 0:H.agent_name)||"Obi"}},B=((F=o.client.product)==null?void 0:F.widget_position)==="bottom-right"?{position:"fixed",top:`calc(100vh - ${v}px)`,right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",top:`calc(100vh - ${v}px)`,left:"50%",transform:"translateX(-50%)",width:"max-content"};return C("div",{children:[e&&C(hR,{open:e,courses:o.client.plans.map(E=>({id:E.uuid,name:E.name,description:E.description||"",duration:E.duration||0})),loading:!1,agentName:((x=o.client.product)==null?void 0:x.agent_name)||"Obi",onCourseHighlight:E=>{E&&Se().track("course-selected",{courseName:E.name,courseUuid:E.id})},onCourseSelect:E=>{const T=o.client.plans.find(Q=>Q.uuid===E.id)||null;T&&(T==null?void 0:T.uuid)!==o.client.selectedPlanUuid&&(o.client.selectPlan(T),t(!1),i(!0),Se().track("course-get-started",{courseName:E.name,courseUuid:E.id}))},onClose:E=>{E==="user-initiated"&&o.client.selectPlan(null),t(!1)}}),g&&C(St,{children:[C("div",{style:B,children:C(JQ,{inPlan:d,isActive:r?!1:void 0,defaultIsActive:!0,isPaused:p,messaging:(l==null?void 0:l.isMicShared)===!1?!0:void 0,speakingStatus:f,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,courseProgress:A,onOpen:()=>{t(!0),Se().track("course-list-opened")},onCancelClick:()=>{Se().track("close-button-clicked")},onCancelAbort:()=>{Se().track("close-confirmation-no")},onCancel:()=>{var E;(E=o.client.session)==null||E.stop(),Se().track("close-confirmation-yes")},onCancelReason:(E,T)=>{Se().track("close-survey-answered",{reason:E,reasonText:T})},onPause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.pause)==null||T.call(E),Se().track("pause-button-clicked")},onUnpause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.unpause)==null||T.call(E),Se().track("play-button-clicked")},onMessagingChange:E=>{var T,Q,M,X;E?((Q=(T=o.client.session)==null?void 0:T.muteMicrophone)==null||Q.call(T),Se().track("switch-to-chat-clicked")):((X=(M=o.client.session)==null?void 0:M.unmuteMicrophone)==null||X.call(M),Se().track("switch-to-voice-clicked"))},onMessageChange:E=>{Se().track("chat-input-provided",{message:E,length:E.length})},onMessage:E=>{o.say(E),Se().track("chat-message-sent",{message:E,length:E.length})},onHover:E=>{E&&!d&&Se().track("widget-hover-on")},onOneClickAction:E=>{Se().track("one-click-action-clicked",{action:E})},onMinimize:()=>{Se().track("minimise-button-clicked",{inSession:d})}})}),!!o.client.selectedPlan&&C(fR,{open:!0,session:y(),sessionState:(l==null?void 0:l.state)||null,speakingState:(l==null?void 0:l.speakingState)||null,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,onModalChange:E=>{E==="session-start"?Se().track("course-screen-opened"):E==="voice-guidance"?Se().track("can-you-hear-opened"):E==="overview"?Se().track("welcome-tour-opened"):E==="share-mic"&&Se().track("connect-mic-opened")},onClose:(E,T)=>{var Q,M;E==="user-initiated"&&(T==="session-start"?Se().track("course-screen-closed"):T==="voice-guidance"?Se().track("can-you-hear-closed"):T==="overview"?Se().track("welcome-tour-closed"):T==="share-mic"&&Se().track("connect-mic-closed"),((Q=o.client.session)==null?void 0:Q.state)==="mic-share"?(M=o.client.session)==null||M.shareMicrophoneFailed():o.client.stopSession()),i(!1)},onStart:()=>{o.client.selectedPlanUuid&&(Se().track("course-screen-continue"),o.startSession())},onContinue:()=>{l==null||l.continue(),Se().track("can-you-hear-continue")},onShareMicrophone:()=>{l==null||l.shareMicrophone(),Se().track("connect-mic-continue")}})]})]})}function m4(n,e,t,r){const[i,A]=ge(0),[s,o]=ge(null);return Kt(()=>{n.on("showMenu",a=>{e(a)}),n.on("configUpdated",()=>{A(a=>a+1)})},[n]),Kt(()=>{n.client&&(n.client.session&&o(n.client.session),n.client.on("sessionStarted",a=>{o(a),A(c=>c+1)}),n.client.on("sessionStopped",()=>{o(null),A(a=>a+1)}),n.client.on("sessionShutdown",()=>{A(a=>a+1)}),n.client.on("sessionResumed",()=>{A(a=>a+1)}),n.client.on("stateChanged",()=>{var a;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((a=n.client.product)==null?void 0:a.primary_color)||"#9500FF"),A(c=>c+1)}),n.client.on("planSelected",()=>{A(a=>a+1)}))},[n,n.client]),Kt(()=>{if(!s)return;s.on("stateChanged",()=>{A(c=>c+1)}),s.on("speakingStateChanged",()=>{A(c=>c+1)}),s.on("paused",()=>{A(c=>c+1)}),s.on("unpaused",()=>{A(c=>c+1)});const a=c=>{r(c)};return s.on&&s.on("courseProgress",a),()=>{s.off&&s.off("courseProgress",a)}},[s]),n}function v4(n){const[e,t]=ge(()=>Rp(n));return Kt(()=>{t(Rp(n))},[n]),Kt(()=>{y4();const r=()=>{t(Rp(n))};return window.addEventListener("locationchange",r),window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{window.removeEventListener("locationchange",r),window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}},[n]),e}function y4(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,r=i=>function(...A){const s=i.apply(this,A);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=r(e),window.history.replaceState=r(t),n.__obi_history_patched=!0}function w4(n){if(document.querySelector("obi-widget"))return;b4();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),r=document.createElement("div");r.id="obi-container",t.appendChild(r);const i=new CSSStyleSheet;i.replaceSync(h4),t.adoptedStyleSheets=[i],gQ(C(g4,{sdk:n,shadowHost:e}),r),console.log("[obi-sdk] widget mounted")}function b4(){JC("https://fonts.cdnfonts.com/css/satoshi"),JC("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function JC(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const zC="49206C6F7665204F6269_session",XC="obi-url-params";class B4 extends Gc{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,r)=>{var i,A,s,o,a;switch(t){case"update":this.updateConfig(r);break;case"startSession":if(!(r!=null&&r.planUuid)){console.warn("[obi] startSession command requires a planUuid",r);return}const c=(((i=this.client)==null?void 0:i.plans)||[]).find(u=>u.uuid===r.planUuid)||null;if(!c){console.warn("[obi] startSession command requires a valid planUuid",r);return}this.updateActive(!0),(s=(A=this.client)==null?void 0:A.selectPlan)==null||s.call(A,c);break;case"stopSession":(a=(o=this.client)==null?void 0:o.stopSession)==null||a.call(o);break;case"say":this.say(r);break;default:console.warn("[obi] unknown command",{commandType:t,args:r})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const r=this.load();if(r)try{t=fa.deserialise(r,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(i){console.error("[obi] error loading cached client",i)}t||(t=new fa(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",i=>{var A,s,o;i==="ready"&&this.updateConfig({isActive:(A=this.client)==null?void 0:A.showWidget,primaryColour:((o=(s=this.client)==null?void 0:s.product)==null?void 0:o.primary_color)||"#9500FF"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",i=>{i==="invalid-room"&&localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(i,A)=>{Se().track(i,A)}),this.client.session&&this.client.resumeSession(i=>{i.on("stateChanged",A=>{A!=="disconnecting"&&A!=="disconnected"&&A!=="error"&&A!=="connecting"&&this.save()}),i.on("paused",()=>{this.save()}),i.on("unpaused",()=>{this.save()})})}async initialise(e={}){this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(t=>{console.error("[obi] error initialising client",t),this.emit("error",t)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(r=>{console.error("[obi] error initialising client",r),this.emit("error",r)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}async updateIdentity(e){var r;if(e===void 0||e==((r=this.client)==null?void 0:r.identity))return;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}),e!=null&&e.email&&Se().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,r,i;await((i=(r=(t=this.client)==null?void 0:t.session)==null?void 0:r.say)==null?void 0:i.call(r,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(r){console.error("[obi] error dispatching command",r)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(XC)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((A,s)=>{e[s]=A});const t=e[zC];if(!t)return null;const r=new URL(window.location.href);r.searchParams.delete(zC),window.history.replaceState({},"",r.toString()),r.toString(),localStorage.removeItem(XC),this.passivePlanUuid=t}mountWidget(){w4(this)}async captureScreen(){return(await BT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}save(){var e;localStorage.setItem("obi-client",((e=this.client)==null?void 0:e.serialise())||"")}load(){return localStorage.getItem("obi-client")}}async function YC(n){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return C4({appToken:n,window:e})}async function C4({appToken:n,window:e}){var i,A;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}n||(n=(i=e==null?void 0:e.obiWidgetConfig)==null?void 0:i.apiKey);let t;try{t=((A=e.ObiSDK)==null?void 0:A.q)||[]}catch{t=[]}const r=new B4(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:t}),e.obi=r,r.mountWidget(),r}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{YC()}):YC()})();
|
|
@@ -122,4 +122,4 @@ or you can use record.mirror to access the mirror instance during recording.`,tB
|
|
|
122
122
|
`).replace(/\r/g,`
|
|
123
123
|
`);var e="",t,r,i=0,A;for(t=r=0,i=n.length,A=0;A<i;A++){var s=n.charCodeAt(A),o=null;s<128?r++:s>127&&s<2048?o=String.fromCharCode(s>>6|192,s&63|128):o=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),o!==null&&(r>t&&(e+=n.substring(t,r)),e+=o,t=r=A+1)}return r>t&&(e+=n.substring(t,n.length)),e},m.UUID=function(){try{return V.crypto.randomUUID()}catch{for(var n=new Array(36),e=0;e<36;e++)n[e]=Math.floor(Math.random()*16);return n[14]=4,n[19]=n[19]&=-5,n[19]=n[19]|=8,n[8]=n[13]=n[18]=n[23]="-",m.map(n,function(t){return t.toString(16)}).join("")}};var GB=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<GB.length;e++)if(n.indexOf(GB[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var t,r,i=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(A,s){t=encodeURIComponent(A.toString()),r=encodeURIComponent(s),i[i.length]=r+"="+t}),i.join(e)},m.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var t="[\\?&]"+e+"=([^&#]*)",r=new RegExp(t),i=r.exec(n);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var A=i[1];try{A=decodeURIComponent(A)}catch{we.error("Skipping decoding for malformed query param: "+A)}return A.replace(/\+/g," ")},m.cookie={get:function(n){for(var e=n+"=",t=ye.cookie.split(";"),r=0;r<t.length;r++){for(var i=t[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}return null},parse:function(n){var e;try{e=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,t,r,i,A,s){var o="",a="",c="";if(s)o="; domain="+s;else if(r){var u=qB(ye.location.hostname);o=u?"; domain=."+u:""}if(t){var l=new Date;l.setTime(l.getTime()+t*1e3),a="; expires="+l.toGMTString()}A&&(i=!0,c="; SameSite=None"),i&&(c+="; secure"),ye.cookie=n+"="+encodeURIComponent(e)+a+"; path=/"+o+c},set:function(n,e,t,r,i,A,s){var o="",a="",c="";if(s)o="; domain="+s;else if(r){var u=qB(ye.location.hostname);o=u?"; domain=."+u:""}if(t){var l=new Date;l.setTime(l.getTime()+t*24*60*60*1e3),a="; expires="+l.toGMTString()}A&&(i=!0,c="; SameSite=None"),i&&(c+="; secure");var d=n+"="+encodeURIComponent(e)+a+"; path=/"+o+c;return ye.cookie=d,d},remove:function(n,e,t){m.cookie.set(n,"",-1,e,!1,!1,t)}};var jB=function(n){var e=!0;try{var t="__mplss_"+Ap(8),r="xyz";n.setItem(t,r),n.getItem(t)!==r&&(e=!1),n.removeItem(t)}catch{e=!1}return e},rp=null,Cs=function(n,e){return rp!==null&&!e?rp:rp=jB(n||V.localStorage)},ip=null,zL=function(n,e){return ip!==null&&!e?ip:ip=jB(n||V.sessionStorage)};function WB(n,e,t){var r=function(i){we.error(e+" error: "+i)};return{is_supported:function(i){var A=t(n,i);return A||we.error(e+" unsupported"),A},error:r,get:function(i){try{return n.getItem(i)}catch(A){r(A)}return null},parse:function(i){try{return m.JSONDecode(n.getItem(i))||{}}catch{}return null},set:function(i,A){try{n.setItem(i,A)}catch(s){r(s)}},remove:function(i){try{n.removeItem(i)}catch(A){r(A)}}}}m.localStorage=WB(V.localStorage,"localStorage",Cs),m.sessionStorage=WB(V.sessionStorage,"sessionStorage",zL),m.register_event=function(){var n=function(r,i,A,s,o){if(!r){we.error("No valid element provided to register_event");return}if(r.addEventListener&&!s)r.addEventListener(i,A,!!o);else{var a="on"+i,c=r[a];r[a]=e(r,A,c)}};function e(r,i,A){var s=function(o){if(o=o||t(V.event),!!o){var a=!0,c,u;return m.isFunction(A)&&(c=A(o)),u=i.call(r,o),(c===!1||u===!1)&&(a=!1),a}};return s}function t(r){return r&&(r.preventDefault=t.preventDefault,r.stopPropagation=t.stopPropagation),r}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},n}();var XL=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(i){return i.all?i.all:i.getElementsByTagName("*")}var e=/[\t\r\n]/g;function t(i,A){var s=" "+A+" ";return(" "+i.className+" ").replace(e," ").indexOf(s)>=0}function r(i){if(!ye.getElementsByTagName)return[];var A=i.split(" "),s,o,a,c,u,l,d,h,f,p,g=[ye];for(l=0;l<A.length;l++){if(s=A[l].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){o=s.split("#"),a=o[0];var v=o[1],y=ye.getElementById(v);if(!y||a&&y.nodeName.toLowerCase()!=a)return[];g=[y];continue}if(s.indexOf(".")>-1){o=s.split("."),a=o[0];var B=o[1];for(a||(a="*"),c=[],u=0,d=0;d<g.length;d++)for(a=="*"?f=n(g[d]):f=g[d].getElementsByTagName(a),h=0;h<f.length;h++)c[u++]=f[h];for(g=[],p=0,d=0;d<c.length;d++)c[d].className&&m.isString(c[d].className)&&t(c[d],B)&&(g[p++]=c[d]);continue}var b=s.match(XL);if(b){a=b[1];var w=b[2],_=b[3],k=b[4];for(a||(a="*"),c=[],u=0,d=0;d<g.length;d++)for(a=="*"?f=n(g[d]):f=g[d].getElementsByTagName(a),h=0;h<f.length;h++)c[u++]=f[h];g=[],p=0;var F;switch(_){case"=":F=function(x){return x.getAttribute(w)==k};break;case"~":F=function(x){return x.getAttribute(w).match(new RegExp("\\b"+k+"\\b"))};break;case"|":F=function(x){return x.getAttribute(w).match(new RegExp("^"+k+"-?"))};break;case"^":F=function(x){return x.getAttribute(w).indexOf(k)===0};break;case"$":F=function(x){return x.getAttribute(w).lastIndexOf(k)==x.getAttribute(w).length-k.length};break;case"*":F=function(x){return x.getAttribute(w).indexOf(k)>-1};break;default:F=function(x){return x.getAttribute(w)}}for(g=[],p=0,d=0;d<c.length;d++)F(c[d])&&(g[p++]=c[d]);continue}for(a=s,c=[],u=0,d=0;d<g.length;d++)for(f=g[d].getElementsByTagName(a),h=0;h<f.length;h++)c[u++]=f[h];g=c}return g}return function(i){return m.isElement(i)?[i]:m.isObject(i)&&!m.isUndefined(i.length)?i:r.call(this,i)}}();var YL=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],ZL=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",t={};return m.each(YL,function(r){e=m.getQueryParam(ye.URL,r),e.length?t[r]=e:n!==void 0&&(t[r]=n)}),t},clickParams:function(){var n="",e={};return m.each(ZL,function(t){n=m.getQueryParam(ye.URL,t),n.length&&(e[t]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=m.info.searchEngine(n),t=e!="yahoo"?"q":"p",r={};if(e!==null){r.$search_engine=e;var i=m.getQueryParam(n,t);i.length&&(r.mp_keyword=i)}return r},browser:function(n,e,t){return e=e||"",t||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Whale/")?"Whale Browser":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,t){var r=m.info.browser(n,e,t),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/},A=i[r];if(A===void 0)return null;var s=n.match(A);return s?parseFloat(s[s.length-2]):null},os:function(){var n=qn;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return V.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(qn,Ur.vendor,Tc),$referrer:ye.referrer,$referring_domain:m.info.referringDomain(ye.referrer),$device:m.info.device(qn)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(qn,Ur.vendor,Tc),$screen_height:DB.height,$screen_width:DB.width,mp_lib:"web",$lib_version:gn.LIB_VERSION,$insert_id:Ap(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(qn,Ur.vendor,Tc)}),{$browser_version:m.info.browserVersion(qn,Ur.vendor,Tc)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:ye.title,current_domain:V.location.hostname,current_url_path:V.location.pathname,current_url_protocol:V.location.protocol,current_url_search:V.location.search})}};var $L=function(n,e){var t=null,r=[];return function(i){var A=this;return r.push(i),t||(t=new be(function(s){setTimeout(function(){var o=n.apply(A,[r]);t=null,r=[],s(o)},e)})),t}},Ap=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},eD=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,tD=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,qB=function(n){var e=tD,t=n.split("."),r=t[t.length-1];(r.length>4||r==="com"||r==="org")&&(e=eD);var i=n.match(e);return i?i[0]:""},nD=function(){var n=V.navigator.onLine;return m.isUndefined(n)||n},Tr=function(){},tA=null,Ic=null;typeof JSON<"u"&&(tA=JSON.stringify,Ic=JSON.parse),tA=tA||m.JSONEncode,Ic=Ic||m.JSONDecode,m.info=m.info,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.device=m.info.device,m.info.properties=m.info.properties,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.isObject=m.isObject,m.JSONDecode=m.JSONDecode,m.JSONEncode=m.JSONEncode,m.toArray=m.toArray,m.NPO=Er;var rD="mixpanelBrowserDb",JB="mixpanelRecordingEvents",sp="mixpanelRecordingRegistry",iD=1,AD=[JB,sp],In=function(n){this.dbPromise=null,this.storeName=n};In.prototype._openDb=function(){return new be(function(n,e){var t=V.indexedDB.open(rD,iD);t.onerror=function(){e(t.error)},t.onsuccess=function(){n(t.result)},t.onupgradeneeded=function(r){var i=r.target.result;AD.forEach(function(A){i.createObjectStore(A)})}})},In.prototype.init=function(){return V.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(n){return n instanceof V.IDBDatabase?be.resolve():be.reject(n)})):be.reject("indexedDB is not supported in this browser")},In.prototype.makeTransaction=function(n,e){var t=this.storeName,r=function(i){return new be(function(A,s){var o=i.transaction(t,n);o.oncomplete=function(){A(o)},o.onabort=o.onerror=function(){s(o.error)},e(o.objectStore(t))})};return this.dbPromise.then(r).catch((function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(r)):be.reject(i)}).bind(this))},In.prototype.setItem=function(n,e){return this.makeTransaction("readwrite",function(t){t.put(e,n)})},In.prototype.getItem=function(n){var e;return this.makeTransaction("readonly",function(t){e=t.get(n)}).then(function(){return e.result})},In.prototype.removeItem=function(n){return this.makeTransaction("readwrite",function(e){e.delete(n)})},In.prototype.getAll=function(){var n;return this.makeTransaction("readonly",function(e){n=e.getAll()}).then(function(){return n.result})};var sD="__mp_opt_in_out_";function oD(n,e){YB(!0,n,e)}function aD(n,e){YB(!1,n,e)}function cD(n,e){return XB(n,e)==="1"}function zB(n,e){if(lD(e))return we.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var t=XB(n,e)==="0";return t&&we.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),t}function Ir(n){return cp(n,function(e){return this.get_config(e)})}function Fr(n){return cp(n,function(e){return this._get_config(e)})}function nA(n){return cp(n,function(e){return this._get_config(e)})}function uD(n,e){e=e||{},op(e).remove(ap(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function op(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function ap(n,e){return e=e||{},(e.persistencePrefix||sD)+n}function XB(n,e){return op(e).get(ap(n,e))}function lD(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||V,t=e.navigator||{},r=!1;return m.each([t.doNotTrack,t.msDoNotTrack,e.doNotTrack],function(i){m.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function YB(n,e,t){if(!m.isString(e)||!e.length){we.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}t=t||{},op(t).set(ap(e,t),n?1:0,m.isNumber(t.cookieExpiration)?t.cookieExpiration:null,!!t.crossSubdomainCookie,!!t.secureCookie,!!t.crossSiteCookie,t.cookieDomain),t.track&&n&&t.track(t.trackEventName||"$opt_in",t.trackProperties,{send_immediately:!0})}function cp(n,e){return function(){var t=!1;try{var r=e.call(this,"token"),i=e.call(this,"ignore_dnt"),A=e.call(this,"opt_out_tracking_persistence_type"),s=e.call(this,"opt_out_tracking_cookie_prefix"),o=e.call(this,"window");r&&(t=zB(r,{ignoreDnt:i,persistenceType:A,persistencePrefix:s,window:o}))}catch(c){we.error("Unexpected error when checking tracking opt-out status: "+c)}if(!t)return n.apply(this,arguments);var a=arguments[arguments.length-1];typeof a=="function"&&a(0)}}var dD=ri("lock"),ZB=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||V.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3,this.promiseImpl=e.promiseImpl||be};ZB.prototype.withLock=function(n,e){var t=this.promiseImpl;return new t(m.bind(function(r,i){var A=e||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),o=this.storageKey,a=this.pollIntervalMS,c=this.timeoutMS,u=this.storage,l=o+":X",d=o+":Y",h=o+":Z",f=function(B){if(new Date().getTime()-s>c){dD.error("Timeout waiting for mutex on "+o+"; clearing lock. ["+A+"]"),u.removeItem(h),u.removeItem(d),v();return}setTimeout(function(){try{B()}catch(b){i(b)}},a*(Math.random()+.1))},p=function(B,b){B()?b():f(function(){p(B,b)})},g=function(){var B=u.getItem(d);return B&&B!==A?!1:(u.setItem(d,A),u.getItem(d)===A?!0:(Cs(u,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},v=function(){u.setItem(l,A),p(g,function(){if(u.getItem(l)===A){y();return}f(function(){if(u.getItem(d)!==A){v();return}p(function(){return!u.getItem(h)},y)})})},y=function(){u.setItem(h,"1");var B=function(){u.removeItem(h),u.getItem(d)===A&&u.removeItem(d),u.getItem(l)===A&&u.removeItem(l)};n().then(function(b){B(),r(b)}).catch(function(b){B(),i(b)})};try{if(Cs(u,!0))v();else throw new Error("localStorage support check failed")}catch(B){i(B)}},this))};var _s=function(n){this.storage=n||V.localStorage};_s.prototype.init=function(){return be.resolve()},_s.prototype.setItem=function(n,e){return new be(m.bind(function(t,r){try{this.storage.setItem(n,tA(e))}catch(i){r(i)}t()},this))},_s.prototype.getItem=function(n){return new be(m.bind(function(e,t){var r;try{r=Ic(this.storage.getItem(n))}catch(i){t(i)}e(r)},this))},_s.prototype.removeItem=function(n){return new be(m.bind(function(e,t){try{this.storage.removeItem(n)}catch(r){t(r)}e()},this))};var $B=ri("batch"),Fn=function(n,e){e=e||{},this.storageKey=n,this.usePersistence=e.usePersistence,this.usePersistence&&(this.queueStorage=e.queueStorage||new _s,this.lock=new ZB(n,{storage:e.sharedLockStorage||V.localStorage,timeoutMS:e.sharedLockTimeoutMS})),this.reportError=e.errorReporter||m.bind($B.error,$B),this.pid=e.pid||null,this.memQueue=[],this.initialized=!1,e.enqueueThrottleMs?this.enqueuePersisted=$L(m.bind(this._enqueuePersisted,this),e.enqueueThrottleMs):this.enqueuePersisted=m.bind(function(t){return this._enqueuePersisted([t])},this)};Fn.prototype.ensureInit=function(){return this.initialized?be.resolve():this.queueStorage.init().then(m.bind(function(){this.initialized=!0},this)).catch(m.bind(function(n){this.reportError("Error initializing queue persistence. Disabling persistence",n),this.initialized=!0,this.usePersistence=!1},this))},Fn.prototype.enqueue=function(n,e){var t={id:Ap(),flushAfter:new Date().getTime()+e*2,payload:n};return this.usePersistence?this.enqueuePersisted(t):(this.memQueue.push(t),be.resolve(!0))},Fn.prototype._enqueuePersisted=function(n){var e=m.bind(function(){return this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(t){return this.saveToStorage(t.concat(n))},this)).then(m.bind(function(t){return t&&(this.memQueue=this.memQueue.concat(n)),t},this)).catch(m.bind(function(t){return this.reportError("Error enqueueing items",t,n),!1},this))},this);return this.lock.withLock(e,this.pid).catch(m.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this))},Fn.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);return this.usePersistence&&e.length<n?this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(t){if(t.length){var r={};m.each(e,function(s){r[s.id]=!0});for(var i=0;i<t.length;i++){var A=t[i];if(new Date().getTime()>A.flushAfter&&!r[A.id]&&(A.orphaned=!0,e.push(A),e.length>=n))break}}return e},this)):be.resolve(e)};var eC=function(n,e){var t=[];return m.each(n,function(r){r.id&&!e[r.id]&&t.push(r)}),t};Fn.prototype.removeItemsByID=function(n){var e={};if(m.each(n,function(r){e[r]=!0}),this.memQueue=eC(this.memQueue,e),this.usePersistence){var t=m.bind(function(){return this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(r){return r=eC(r,e),this.saveToStorage(r)},this)).then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(r){for(var i=0;i<r.length;i++){var A=r[i];if(A.id&&e[A.id])throw new Error("Item not removed from storage")}return!0},this)).catch(m.bind(function(r){return this.reportError("Error removing items",r,n),!1},this))},this);return this.lock.withLock(t,this.pid).catch(m.bind(function(r){return this.reportError("Error acquiring storage lock",r),Cs(this.lock.storage,!0)?!1:t().then(m.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(m.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return be.resolve(!0)};var tC=function(n,e){var t=[];return m.each(n,function(r){var i=r.id;if(i in e){var A=e[i];A!==null&&(r.payload=A,t.push(r))}else t.push(r)}),t};Fn.prototype.updatePayloads=function(n){return this.memQueue=tC(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){return this.ensureInit().then(m.bind(function(){return this.readFromStorage()},this)).then(m.bind(function(e){return e=tC(e,n),this.saveToStorage(e)},this)).catch(m.bind(function(e){return this.reportError("Error updating items",n,e),!1},this))},this),this.pid).catch(m.bind(function(e){return this.reportError("Error acquiring storage lock",e),!1},this)):be.resolve(!0)},Fn.prototype.readFromStorage=function(){return this.ensureInit().then(m.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(m.bind(function(n){return n&&(m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null)),n||[]},this)).catch(m.bind(function(n){return this.reportError("Error retrieving queue",n),[]},this))},Fn.prototype.saveToStorage=function(n){return this.ensureInit().then(m.bind(function(){return this.queueStorage.setItem(this.storageKey,n)},this)).then(function(){return!0}).catch(m.bind(function(e){return this.reportError("Error saving queue",e),!1},this))},Fn.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(m.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):be.resolve()};var hD=10*60*1e3,Ss=ri("batch"),$t=function(n,e){this.errorReporter=e.errorReporter,this.queue=new Fn(n,{errorReporter:m.bind(this.reportError,this),queueStorage:e.queueStorage,sharedLockStorage:e.sharedLockStorage,sharedLockTimeoutMS:e.sharedLockTimeoutMS,usePersistence:e.usePersistence,enqueueThrottleMs:e.enqueueThrottleMs}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1,this._flushPromise=null};$t.prototype.enqueue=function(n){return this.queue.enqueue(n,this.flushInterval)},$t.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},$t.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},$t.prototype.clear=function(){return this.queue.clear()},$t.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},$t.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},$t.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},$t.prototype.sendRequestPromise=function(n,e){return new be(m.bind(function(t){this.sendRequest(n,e,t)},this))},$t.prototype.flush=function(n){if(this.requestInProgress)return Ss.log("Flush: Request already in progress"),be.resolve();this.requestInProgress=!0,n=n||{};var e=this.libConfig.batch_request_timeout_ms,t=new Date().getTime(),r=this.batchSize;return this.queue.fillBatch(r).then(m.bind(function(i){var A=i.length===r,s=[],o={};if(m.each(i,function(l){var d=l.payload;if(this.beforeSendHook&&!l.orphaned&&(d=this.beforeSendHook(d)),d){d.event&&d.properties&&(d.properties=m.extend({},d.properties,{mp_sent_by_lib_version:gn.LIB_VERSION}));var h=!0,f=l.id;f?(this.itemIdsSentSuccessfully[f]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:l,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[f]}),h=!1):this.reportError("[dupe] found item with no ID",{item:l}),h&&s.push(d)}o[l.id]=d},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),be.resolve();var a=m.bind(function(){return this.queue.removeItemsByID(m.map(i,function(l){return l.id})).then(m.bind(function(l){return m.each(i,m.bind(function(d){var h=d.id;h?(this.itemIdsSentSuccessfully[h]=this.itemIdsSentSuccessfully[h]||0,this.itemIdsSentSuccessfully[h]++,this.itemIdsSentSuccessfully[h]>5&&this.reportError("[dupe] item ID sent too many times",{item:d,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[h]})):this.reportError("[dupe] found item with no ID while removing",{item:d})},this)),l?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!A?(this.resetFlush(),be.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),be.resolve())},this))},this),c=m.bind(function(l){this.requestInProgress=!1;try{if(n.unloading)return this.queue.updatePayloads(o);if(m.isObject(l)&&l.error==="timeout"&&new Date().getTime()-t>=e)return this.reportError("Network timeout; retrying"),this.flush();if(m.isObject(l)&&(l.httpStatusCode>=500||l.httpStatusCode===429||l.httpStatusCode<=0&&!nD()||l.error==="timeout")){var d=this.flushInterval*2;return l.retryAfter&&(d=parseInt(l.retryAfter,10)*1e3||d),d=Math.min(hD,d),this.reportError("Error; retry in "+d+" ms"),this.scheduleFlush(d),be.resolve()}else if(m.isObject(l)&&l.httpStatusCode===413)if(i.length>1){var h=Math.max(1,Math.floor(r/2));return this.batchSize=Math.min(this.batchSize,h,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),be.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),a();else return a()}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}},this),u={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};return n.unloading&&(u.transport="sendBeacon"),Ss.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,u).then(c)},this)).catch(m.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},$t.prototype.reportError=function(n,e){if(Ss.error.apply(Ss.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(t){Ss.error(t)}};var up=function(n){var e=Date.now();return!n||e>n.maxExpires||e>n.idleExpires},pD=250,rA=ri("recorder"),nC=V.CompressionStream,fD={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},gD=new Set([z.MouseMove,z.MouseInteraction,z.Scroll,z.ViewportResize,z.Input,z.TouchMove,z.MediaInteraction,z.Drag,z.Selection]);function mD(n){return n.type===le.IncrementalSnapshot&&gD.has(n.data.source)}var Bt=function(n){this._mixpanel=n.mixpanelInstance,this._onIdleTimeout=n.onIdleTimeout||Tr,this._onMaxLengthReached=n.onMaxLengthReached||Tr,this._onBatchSent=n.onBatchSent||Tr,this._rrwebRecord=n.rrwebRecord||null,this._stopRecording=null,this.replayId=n.replayId,this.batchStartUrl=n.batchStartUrl||null,this.replayStartUrl=n.replayStartUrl||null,this.idleExpires=n.idleExpires||null,this.maxExpires=n.maxExpires||null,this.replayStartTime=n.replayStartTime||null,this.seqNo=n.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=bs,this.recordMinMs=0;var e=Cs(n.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new In(JB),this.batcher=new $t(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:fD,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:n.sharedLockStorage,usePersistence:e,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:pD,sharedLockTimeoutMS:10*1e3})};Bt.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var n={distinct_id:String(this._mixpanel.get_distinct_id())},e=this._mixpanel.get_property("$device_id");e&&(n.$device_id=e);var t=this._mixpanel.get_property("$user_id");return t&&(n.$user_id=t),n},Bt.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},Bt.prototype.getConfig=function(n){return this._mixpanel.get_config(n)},Bt.prototype.get_config=function(n){return this.getConfig(n)},Bt.prototype.startRecording=function(n){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){rA.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>bs&&(this.recordMaxMs=bs,rA.critical("record_max_ms cannot be greater than "+bs+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Zh&&(this.recordMinMs=Zh,rA.critical("record_min_ms cannot be greater than "+Zh+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=m.info.currentUrl(),this.replayStartUrl=m.info.currentUrl()),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=(function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}).bind(this);e();var t=this.getConfig("record_block_selector");(t===""||t===null)&&(t=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(i){if(this.idleExpires&&this.idleExpires<i.timestamp){this._onIdleTimeout();return}mD(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e()),this.__enqueuePromise=this.batcher.enqueue(i)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:t,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(i){this.reportError("Unexpected error when starting rrweb recording.",i)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var r=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),r)},Bt.prototype.stopRecording=function(n){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(t){this.reportError("Error with rrweb stopRecording",t)}this._stopRecording=null}var e;return this.batcher.stopped?e=this.batcher.clear():n||(e=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),e},Bt.prototype.isRrwebStopped=function(){return this._stopRecording===null},Bt.prototype.flushEventsWithOptOut=function(n,e,t){var r=(function(i){i===0&&(this.stopRecording(),t({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(n,e,t,r)},Bt.prototype.serialize=function(){var n;try{n=this._mixpanel.get_tab_id()}catch(e){this.reportError("Error getting tab ID for serialization ",e),n=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:n}},Bt.deserialize=function(n,e){var t=new Bt(m.extend({},e,{replayId:n.replayId,batchStartUrl:n.batchStartUrl,replayStartUrl:n.replayStartUrl,idleExpires:n.idleExpires,maxExpires:n.maxExpires,replayStartTime:n.replayStartTime,seqNo:n.seqNo,sharedLockStorage:e.sharedLockStorage}));return t},Bt.prototype._sendRequest=function(n,e,t,r){var i=(function(s,o){s.status===200&&this.replayId===n&&(this.seqNo++,this.batchStartUrl=m.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:s.status,responseBody:o,retryAfter:s.headers.get("Retry-After")})}).bind(this),A=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");V.fetch(A+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:t}).then(function(s){s.json().then(function(o){i(s,o)}).catch(function(o){r({error:o})})}).catch(function(s){r({error:s,httpStatusCode:0})})},Bt.prototype._flushEvents=Ir(function(n,e,t){var r=n.length;if(r>0){for(var i=this.replayId,A=1/0,s=-1/0,o=!1,a=0;a<r;a++)A=Math.min(A,n[a].timestamp),s=Math.max(s,n[a].timestamp),n[a].type===le.FullSnapshot&&(o=!0);if(this.seqNo===0){if(!o){t({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=A}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=A);var c=s-this.replayStartTime,u={$current_url:this.batchStartUrl,$lib_version:gn.LIB_VERSION,batch_start_time:A/1e3,mp_lib:"web",replay_id:i,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},l=JSON.stringify(n);if(Object.assign(u,this.getUserIdInfo()),nC){var d=new Blob([l],{type:"application/json"}).stream(),h=d.pipeThrough(new nC("gzip"));new Response(h).blob().then((function(f){u.format="gzip",this._sendRequest(i,u,f,t)}).bind(this))}else u.format="body",this._sendRequest(i,u,l,t)}}),Bt.prototype.reportError=function(n,e){rA.error.apply(rA.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.getConfig("error_reporter")(n,e)}catch(t){rA.error(t)}};var iA=function(n){this.idb=new In(sp),this.errorReporter=n.errorReporter,this.mixpanelInstance=n.mixpanelInstance,this.sharedLockStorage=n.sharedLockStorage};iA.prototype.handleError=function(n){this.errorReporter("IndexedDB error: ",n)},iA.prototype.setActiveRecording=function(n){var e=n.tabId;return e?this.idb.init().then((function(){return this.idb.setItem(e,n)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),be.resolve())},iA.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(n){return up(n)?null:n}).bind(this)).catch(this.handleError.bind(this))},iA.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(n){if(n)return n.maxExpires=0,this.setActiveRecording(n)}).bind(this)).catch(this.handleError.bind(this))},iA.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(n){var e=n.filter(function(t){return up(t)}).map((function(t){var r=Bt.deserialize(t,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return r.unloadPersistedData().then((function(){return this.idb.removeItem(t.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return be.all(e)}).bind(this)).catch(this.handleError.bind(this))};var ks=ri("recorder"),Jn=function(n,e,t){this.mixpanelInstance=n,this.rrwebRecord=e||Sr,this.sharedLockStorage=t,this.recordingRegistry=new iA({mixpanelInstance:this.mixpanelInstance,errorReporter:ks.error,sharedLockStorage:t}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};Jn.prototype.startRecording=function(n){if(n=n||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){ks.log("Recording already in progress, skipping startRecording.");return}var e=(function(){ks.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),t=(function(){ks.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),r=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:r,onIdleTimeout:e,onMaxLengthReached:t,replayId:m.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return n.activeSerializedRecording?this.activeRecording=Bt.deserialize(n.activeSerializedRecording,i):this.activeRecording=new Bt(i),this.activeRecording.startRecording(n.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},Jn.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then((function(){return this.recordingRegistry.clearActiveRecording()}).bind(this)).then((function(){this.stopRecordingInProgress=!1}).bind(this))},Jn.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},Jn.prototype._stopCurrentRecording=function(n,e){if(this.activeRecording){var t=this.activeRecording.stopRecording(n);return e&&(this.activeRecording=null),t}return be.resolve()},Jn.prototype.resumeRecording=function(n){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),be.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(e){return e&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:e}):n?this.startRecording({shouldStopBatcher:!1}):(ks.log("No resumable recording found."),null)}).bind(this))},Jn.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},Jn.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(Jn.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),V.__mp_recorder=Jn;var Fc="change",ii="click",rC="hashchange",AA="mp_locationchange",iC="popstate",AC="scrollend",lp="submit",vD=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],sC=["mp-include"],dp=["mp-no-track"],oC=dp.concat(["mp-sensitive"]),yD=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],xt=ri("autocapture");function hp(n){for(var e={},t=aC(n).split(" "),r=0;r<t.length;r++){var i=t[r];i&&(e[i]=!0)}return e}function aC(n){switch(typeof n.className){case"string":return n.className;case"object":return n.className.baseVal||n.getAttribute("class")||"";default:return""}}function wD(n){if(n.previousElementSibling)return n.previousElementSibling;do n=n.previousSibling;while(n&&!lC(n));return n}function cC(n,e,t,r,i,A){var s={$classes:aC(n).split(" "),$tag_name:n.tagName.toLowerCase()},o=n.id;o&&(s.$id=o),gp(n,e,i,A)&&m.each(yD.concat(r),function(l){if(n.hasAttribute(l)&&!t[l]){var d=n.getAttribute(l);xc(d)&&(s["$attr-"+l]=d)}});for(var a=1,c=1,u=n;u=wD(u);)a++,u.tagName===n.tagName&&c++;return s.$nth_child=a,s.$nth_of_type=c,s}function bD(n,e){var t=e.allowElementCallback,r=e.allowSelectors||[],i=e.blockAttrs||[],A=e.blockElementCallback,s=e.blockSelectors||[],o=e.captureTextContent||!1,a=e.captureExtraAttrs||[],c=e.capturedForHeatMap||!1,u={};m.each(i,function(w){u[w]=!0});var l=null,d=typeof n.target>"u"?n.srcElement:n.target;if(dC(d)&&(d=d.parentNode),_D(d,n)&&pp(d,n,t,r)&&!fp(d,n,A,s)){for(var h=[d],f=d;f.parentNode&&!xn(f,"body");)h.push(f.parentNode),f=f.parentNode;var p=[],g,v=!1;if(m.each(h,function(w){var _=gp(w,n,t,r);!u.href&&w.tagName.toLowerCase()==="a"&&(g=w.getAttribute("href"),g=_&&xc(g)&&g),fp(w,n,A,s)&&(v=!0),p.push(cC(w,n,u,a,t,r))},this),!v){var y=ye.documentElement;if(l={$event_type:n.type,$host:V.location.host,$pathname:V.location.pathname,$elements:p,$el_attr__href:g,$viewportHeight:Math.max(y.clientHeight,V.innerHeight||0),$viewportWidth:Math.max(y.clientWidth,V.innerWidth||0),$pageHeight:ye.body.offsetHeight||0,$pageWidth:ye.body.offsetWidth||0},m.each(a,function(w){if(!u[w]&&d.hasAttribute(w)){var _=d.getAttribute(w);xc(_)&&(l["$el_attr__"+w]=_)}}),o&&(B=uC(d,n,t,r),B&&B.length&&(l.$el_text=B)),n.type===ii&&(m.each(vD,function(w){w in n&&(l["$"+w]=n[w])}),c&&(l.$captured_for_heatmap=!0),d=BD(n)),o){var B=uC(d,n,t,r);B&&B.length&&(l.$el_text=B)}if(d){if(!pp(d,n,t,r)||fp(d,n,A,s))return null;var b=cC(d,n,u,a,t,r);l.$target=b,l.$el_classes=b.$classes,m.extend(l,m.strip_empty_properties({$el_id:b.$id,$el_tag_name:b.$tag_name}))}}}return l}function uC(n,e,t,r){var i="";return gp(n,e,t,r)&&n.childNodes&&n.childNodes.length&&m.each(n.childNodes,function(A){dC(A)&&A.textContent&&(i+=m.trim(A.textContent).split(/(\s+)/).filter(xc).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),m.trim(i)}function BD(n){for(var e=n.target,t=n.composedPath(),r=0;r<t.length;r++){var i=t[r];if(xn(i,"a")||xn(i,"button")||xn(i,"input")||xn(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){e=i;break}if(i===e)break}return e}function pp(n,e,t,r){if(t)try{if(!t(n,e))return!1}catch(s){return xt.critical("Error while checking element in allowElementCallback",s),!1}if(!r.length)return!0;for(var i=0;i<r.length;i++){var A=r[i];try{if(n.matches(A))return!0}catch(s){xt.critical("Error while checking selector: "+A,s)}}return!1}function fp(n,e,t,r){var i;if(t)try{if(t(n,e))return!0}catch(o){return xt.critical("Error while checking element in blockElementCallback",o),!0}if(r&&r.length)for(i=0;i<r.length;i++){var A=r[i];try{if(n.matches(A))return!0}catch(o){xt.critical("Error while checking selector: "+A,o)}}var s=hp(n);for(i=0;i<dp.length;i++)if(s[dp[i]])return!0;return!1}function lC(n){return n&&n.nodeType===1}function xn(n,e){return n&&n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function dC(n){return n&&n.nodeType===3}function CD(){try{var n=ye.createElement("div");return!!n.matches}catch{return!1}}function _D(n,e){if(!n||xn(n,"html")||!lC(n))return!1;var t=n.tagName.toLowerCase();switch(t){case"form":return e.type===lp;case"input":return["button","submit"].indexOf(n.getAttribute("type"))===-1?e.type===Fc:e.type===ii;case"select":case"textarea":return e.type===Fc;default:return e.type===ii}}function gp(n,e,t,r){var i;if(!pp(n,e,t,r))return!1;for(var A=n;A.parentNode&&!xn(A,"body");A=A.parentNode){var s=hp(A);for(i=0;i<oC.length;i++)if(s[oC[i]])return!1}var o=hp(n);for(i=0;i<sC.length;i++)if(o[sC[i]])return!0;if(xn(n,"input")||xn(n,"select")||xn(n,"textarea")||n.getAttribute("contenteditable")==="true")return!1;var a=n.type||"";if(typeof a=="string")switch(a.toLowerCase()){case"hidden":return!1;case"password":return!1}var c=n.name||n.id||"";if(typeof c=="string"){var u=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(u.test(c.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function xc(n){if(n===null||m.isUndefined(n))return!1;if(typeof n=="string"){n=m.trim(n);var e=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(e.test((n||"").replace(/[- ]/g,"")))return!1;var t=/(^\d{3}-?\d{2}-?\d{4}$)/;if(t.test(n))return!1}return!0}var SD=30,kD=1e3,ED=4;function hC(){this.clicks=[]}hC.prototype.isRageClick=function(n,e,t){t=t||{};var r=t.threshold_px||SD,i=t.timeout_ms||kD,A=t.click_count||ED,s=Date.now(),o=this.clicks[this.clicks.length-1];if(o&&s-o.timestamp<i&&Math.sqrt(Math.pow(n-o.x,2)+Math.pow(e-o.y,2))<r){if(this.clicks.push({x:n,y:e,timestamp:s}),this.clicks.length>=A)return this.clicks=[],!0}else this.clicks=[{x:n,y:e,timestamp:s}];return!1};var pC="autocapture",UD="track_pageview",fC="full-url",TD="url-with-path-and-query-string",ID="url-with-path",FD="allow_element_callback",gC="allow_selectors",mC="allow_url_regexes",vC="block_attrs",yC="block_element_callback",wC="block_selectors",bC="block_url_regexes",BC="capture_extra_attrs",CC="capture_text_content",_C="scroll_capture_all",SC="scroll_depth_percent_checkpoints",Qc="click",mp="input",kC="pageview",EC="rage_click",vp="scroll",yp="submit",gt={};gt[gC]=[],gt[mC]=[],gt[vC]=[],gt[yC]=null,gt[wC]=[],gt[bC]=[],gt[BC]=[],gt[CC]=!1,gt[_C]=!1,gt[SC]=[25,50,75,100],gt[Qc]=!0,gt[mp]=!0,gt[kC]=fC,gt[EC]=!0,gt[vp]=!0,gt[yp]=!0;var Rc={$mp_autocapture:!0},UC="$mp_click",xD="$mp_input_change",TC="$mp_rage_click",QD="$mp_scroll",RD="$mp_submit",Qt=function(n){this.mp=n};Qt.prototype.init=function(){if(!CD()){xt.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking()},Qt.prototype.getFullConfig=function(){var n=this.mp.get_config(pC);return n?m.isObject(n)?m.extend({},gt,n):gt:{}},Qt.prototype.getConfig=function(n){return this.getFullConfig()[n]},Qt.prototype.currentUrlBlocked=function(){var n,e=m.info.currentUrl(),t=this.getConfig(mC)||[];if(t.length){var r=!1;for(n=0;n<t.length;n++){var i=t[n];try{if(e.match(i)){r=!0;break}}catch(s){return xt.critical("Error while checking block URL regex: "+i,s),!0}}if(!r)return!0}var A=this.getConfig(bC)||[];if(!A||!A.length)return!1;for(n=0;n<A.length;n++)try{if(e.match(A[n]))return!0}catch(s){return xt.critical("Error while checking block URL regex: "+A[n],s),!0}return!1},Qt.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(pC)?this.getConfig(kC):this.mp.get_config(UD)},Qt.prototype.trackDomEvent=function(n,e){if(!this.currentUrlBlocked()){var t=this.mp.is_recording_heatmap_data()&&(e===UC&&!this.getConfig(Qc)||e===TC&&!this._getRageClickConfig()),r=bD(n,{allowElementCallback:this.getConfig(FD),allowSelectors:this.getConfig(gC),blockAttrs:this.getConfig(vC),blockElementCallback:this.getConfig(yC),blockSelectors:this.getConfig(wC),captureExtraAttrs:this.getConfig(BC),captureTextContent:this.getConfig(CC),capturedForHeatMap:t});r&&(m.extend(r,Rc),this.mp.track(e,r))}},Qt.prototype._getRageClickConfig=function(){var n=this.getConfig(EC);return n?n===!0?{}:typeof n=="object"?n:{}:null},Qt.prototype.initClickTracking=function(){V.removeEventListener(ii,this.listenerClick),!(!this.getConfig(Qc)&&!this.mp.get_config("record_heatmap_data"))&&(xt.log("Initializing click tracking"),this.listenerClick=V.addEventListener(ii,(function(n){!this.getConfig(Qc)&&!this.mp.is_recording_heatmap_data()||this.trackDomEvent(n,UC)}).bind(this)))},Qt.prototype.initInputTracking=function(){V.removeEventListener(Fc,this.listenerChange),this.getConfig(mp)&&(xt.log("Initializing input tracking"),this.listenerChange=V.addEventListener(Fc,(function(n){this.getConfig(mp)&&this.trackDomEvent(n,xD)}).bind(this)))},Qt.prototype.initPageviewTracking=function(){if(V.removeEventListener(iC,this.listenerPopstate),V.removeEventListener(rC,this.listenerHashchange),V.removeEventListener(AA,this.listenerLocationchange),!!this.pageviewTrackingConfig()){xt.log("Initializing pageview tracking");var n="",e=!1;this.currentUrlBlocked()||(e=this.mp.track_pageview(Rc)),e&&(n=m.info.currentUrl()),this.listenerPopstate=V.addEventListener(iC,function(){V.dispatchEvent(new Event(AA))}),this.listenerHashchange=V.addEventListener(rC,function(){V.dispatchEvent(new Event(AA))});var t=V.history.pushState;typeof t=="function"&&(V.history.pushState=function(i,A,s){t.call(V.history,i,A,s),V.dispatchEvent(new Event(AA))});var r=V.history.replaceState;typeof r=="function"&&(V.history.replaceState=function(i,A,s){r.call(V.history,i,A,s),V.dispatchEvent(new Event(AA))}),this.listenerLocationchange=V.addEventListener(AA,np((function(){if(!this.currentUrlBlocked()){var i=m.info.currentUrl(),A=!1,s=i.split("#")[0].split("?")[0]!==n.split("#")[0].split("?")[0],o=this.pageviewTrackingConfig();if(o===fC?A=i!==n:o===TD?A=i.split("#")[0]!==n.split("#")[0]:o===ID&&(A=s),A){var a=this.mp.track_pageview(Rc);a&&(n=i),s&&(this.lastScrollCheckpoint=0,xt.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},Qt.prototype.initRageClickTracking=function(){V.removeEventListener(ii,this.listenerRageClick);var n=this._getRageClickConfig();!n&&!this.mp.get_config("record_heatmap_data")||(xt.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new hC),this.listenerRageClick=(function(e){var t=this._getRageClickConfig();!t&&!this.mp.is_recording_heatmap_data()||this.currentUrlBlocked()||this._rageClickTracker.isRageClick(e.pageX,e.pageY,t)&&this.trackDomEvent(e,TC)}).bind(this),V.addEventListener(ii,this.listenerRageClick))},Qt.prototype.initScrollTracking=function(){V.removeEventListener(AC,this.listenerScroll),this.getConfig(vp)&&(xt.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=V.addEventListener(AC,np((function(){if(this.getConfig(vp)&&!this.currentUrlBlocked()){var n=this.getConfig(_C),e=(this.getConfig(SC)||[]).slice().sort(function(a,c){return a-c}),t=V.scrollY,r=m.extend({$scroll_top:t},Rc);try{var i=ye.body.scrollHeight,A=Math.round(t/(i-V.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=A,A>this.lastScrollCheckpoint)for(var s=0;s<e.length;s++){var o=e[s];A>=o&&this.lastScrollCheckpoint<o&&(r.$scroll_checkpoint=o,this.lastScrollCheckpoint=o,n=!0)}}catch(a){xt.critical("Error while calculating scroll percentage",a)}n&&this.mp.track(QD,r)}}).bind(this))))},Qt.prototype.initSubmitTracking=function(){V.removeEventListener(lp,this.listenerSubmit),this.getConfig(yp)&&(xt.log("Initializing submit tracking"),this.listenerSubmit=V.addEventListener(lp,(function(n){this.getConfig(yp)&&this.trackDomEvent(n,RD)}).bind(this)))},VB(Qt);var PD=V.fetch,Rt=ri("flags"),Pc="flags",Oc="context",wp={};wp[Oc]={};var ae=function(n){this.getFullApiRoute=n.getFullApiRoute,this.getMpConfig=n.getConfigFunc,this.setMpConfig=n.setConfigFunc,this.getMpProperty=n.getPropertyFunc,this.track=n.trackingFunc};ae.prototype.init=function(){if(!OD()){Rt.critical("Feature Flags unavailable: missing minimum required APIs");return}this.flags=null,this.fetchFlags(),this.trackedFeatures=new Set},ae.prototype.getFullConfig=function(){var n=this.getMpConfig(Pc);return n?m.isObject(n)?m.extend({},wp,n):wp:{}},ae.prototype.getConfig=function(n){return this.getFullConfig()[n]},ae.prototype.isSystemEnabled=function(){return!!this.getMpConfig(Pc)},ae.prototype.updateContext=function(n,e){if(!this.isSystemEnabled())return Rt.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var t=this.getMpConfig(Pc);m.isObject(t)||(t={});var r=e&&e.replace?{}:this.getConfig(Oc);return t[Oc]=m.extend({},r,n),this.setMpConfig(Pc,t),this.fetchFlags()},ae.prototype.areFlagsReady=function(){return this.isSystemEnabled()||Rt.error("Feature Flags not enabled"),!!this.flags},ae.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var n=this.getMpProperty("distinct_id"),e=this.getMpProperty("$device_id");Rt.log("Fetching flags for distinct ID: "+n);var t={context:m.extend({distinct_id:n,device_id:e},this.getConfig(Oc))};return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=V.fetch(this.getFullApiRoute(),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),"Content-Type":"application/octet-stream"},body:JSON.stringify(t)}).then((function(r){return this.markFetchComplete(),r.json().then((function(i){var A=i.flags;if(!A)throw new Error("No flags in API response");var s=new Map;m.each(A,function(o,a){s.set(a,{key:o.variant_key,value:o.variant_value})}),this.flags=s}).bind(this)).catch((function(i){this.markFetchComplete(),Rt.error(i)}).bind(this))}).bind(this)).catch((function(r){this.markFetchComplete(),Rt.error(r)}).bind(this)),this.fetchPromise},ae.prototype.markFetchComplete=function(){if(!this._fetchInProgressStartTime){Rt.error("Fetch in progress started time not set, cannot mark fetch complete");return}this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null},ae.prototype.getVariant=function(n,e){return this.fetchPromise?this.fetchPromise.then((function(){return this.getVariantSync(n,e)}).bind(this)).catch(function(t){return Rt.error(t),e}):new Promise(function(t){Rt.critical("Feature Flags not initialized"),t(e)})},ae.prototype.getVariantSync=function(n,e){if(!this.areFlagsReady())return Rt.log("Flags not loaded yet"),e;var t=this.flags.get(n);return t?(this.trackFeatureCheck(n,t),t):(Rt.log('No flag found: "'+n+'"'),e)},ae.prototype.getVariantValue=function(n,e){return this.getVariant(n,{value:e}).then(function(t){return t.value}).catch(function(t){return Rt.error(t),e})},ae.prototype.getFeatureData=function(n,e){return Rt.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(n,e)},ae.prototype.getVariantValueSync=function(n,e){return this.getVariantSync(n,{value:e}).value},ae.prototype.isEnabled=function(n,e){return this.getVariantValue(n).then((function(){return this.isEnabledSync(n,e)}).bind(this)).catch(function(t){return Rt.error(t),e})},ae.prototype.isEnabledSync=function(n,e){e=e||!1;var t=this.getVariantValueSync(n,e);return t!==!0&&t!==!1&&(Rt.error('Feature flag "'+n+'" value: '+t+" is not a boolean; returning fallback value: "+e),t=e),t},ae.prototype.trackFeatureCheck=function(n,e){this.trackedFeatures.has(n)||(this.trackedFeatures.add(n),this.track("$experiment_started",{"Experiment name":n,"Variant name":e.key,$experiment_type:"feature_flag","Variant fetch start time":new Date(this._fetchStartTime).toISOString(),"Variant fetch complete time":new Date(this._fetchCompleteTime).toISOString(),"Variant fetch latency (ms)":this._fetchLatency}))};function OD(){return!!PD&&typeof Promise<"u"&&typeof Map<"u"&&typeof Set<"u"}VB(ae),ae.prototype.are_flags_ready=ae.prototype.areFlagsReady,ae.prototype.get_variant=ae.prototype.getVariant,ae.prototype.get_variant_sync=ae.prototype.getVariantSync,ae.prototype.get_variant_value=ae.prototype.getVariantValue,ae.prototype.get_variant_value_sync=ae.prototype.getVariantValueSync,ae.prototype.is_enabled=ae.prototype.isEnabled,ae.prototype.is_enabled_sync=ae.prototype.isEnabledSync,ae.prototype.update_context=ae.prototype.updateContext,ae.prototype.get_feature_data=ae.prototype.getFeatureData;var zn=function(){};zn.prototype.create_properties=function(){},zn.prototype.event_handler=function(){},zn.prototype.after_track_handler=function(){},zn.prototype.init=function(n){return this.mp=n,this},zn.prototype.track=function(n,e,t,r){var i=this,A=m.dom_query(n);if(A.length===0){we.error("The DOM query ("+n+") returned 0 elements");return}return m.each(A,function(s){m.register_event(s,this.override_event,function(o){var a={},c=i.create_properties(t,this),u=i.mp.get_config("track_links_timeout");i.event_handler(o,this,a),window.setTimeout(i.track_callback(r,c,a,!0),u),i.mp.track(e,c,i.track_callback(r,c,a))})},this),!0},zn.prototype.track_callback=function(n,e,t,r){r=r||!1;var i=this;return function(){t.callback_fired||(t.callback_fired=!0,!(n&&n(r,e)===!1)&&i.after_track_handler(e,t,r))}},zn.prototype.create_properties=function(n,e){var t;return typeof n=="function"?t=n(e):t=m.extend({},n),t};var sA=function(){this.override_event="click"};m.inherit(sA,zn),sA.prototype.create_properties=function(n,e){var t=sA.superclass.create_properties.apply(this,arguments);return e.href&&(t.url=e.href),t},sA.prototype.event_handler=function(n,e,t){t.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",t.href=e.href,t.new_tab||n.preventDefault()},sA.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Mc=function(){this.override_event="submit"};m.inherit(Mc,zn),Mc.prototype.event_handler=function(n,e,t){t.element=e,n.preventDefault()},Mc.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var xr="$set",oA="$set_once",mn="$unset",Ai="$add",Qn="$append",si="$union",Xn="$remove",MD="$delete",IC={set_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[xr]=r,t},unset_action:function(n){var e={},t=[];return m.isArray(n)||(n=[n]),m.each(n,function(r){this._is_reserved_property(r)||t.push(r)},this),e[mn]=t,e},set_once_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[oA]=r,t},union_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=m.isArray(i)?i:[i])},this):r[n]=m.isArray(e)?e:[e],t[si]=r,t},append_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[Qn]=r,t},remove_action:function(n,e){var t={},r={};return m.isObject(n)?m.each(n,function(i,A){this._is_reserved_property(A)||(r[A]=i)},this):r[n]=e,t[Xn]=r,t},delete_action:function(){var n={};return n[MD]="",n}},De=function(){};m.extend(De.prototype,IC),De.prototype._init=function(n,e,t){this._mixpanel=n,this._group_key=e,this._group_id=t},De.prototype.set=nA(function(n,e,t){var r=this.set_action(n,e);return m.isObject(n)&&(t=e),this._send_request(r,t)}),De.prototype.set_once=nA(function(n,e,t){var r=this.set_once_action(n,e);return m.isObject(n)&&(t=e),this._send_request(r,t)}),De.prototype.unset=nA(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),De.prototype.union=nA(function(n,e,t){m.isObject(n)&&(t=e);var r=this.union_action(n,e);return this._send_request(r,t)}),De.prototype.delete=nA(function(n){var e=this.delete_action();return this._send_request(e,n)}),De.prototype.remove=nA(function(n,e,t){var r=this.remove_action(n,e);return this._send_request(r,t)}),De.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var t=m.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:t,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},De.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},De.prototype._get_config=function(n){return this._mixpanel.get_config(n)},De.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},De.prototype.remove=De.prototype.remove,De.prototype.set=De.prototype.set,De.prototype.set_once=De.prototype.set_once,De.prototype.union=De.prototype.union,De.prototype.unset=De.prototype.unset,De.prototype.toString=De.prototype.toString;var $=function(){};m.extend($.prototype,IC),$.prototype._init=function(n){this._mixpanel=n},$.prototype.set=Fr(function(n,e,t){var r=this.set_action(n,e);return m.isObject(n)&&(t=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[xr]=m.extend({},m.info.people_properties(),r[xr]),this._send_request(r,t)}),$.prototype.set_once=Fr(function(n,e,t){var r=this.set_once_action(n,e);return m.isObject(n)&&(t=e),this._send_request(r,t)}),$.prototype.unset=Fr(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),$.prototype.increment=Fr(function(n,e,t){var r={},i={};return m.isObject(n)?(m.each(n,function(A,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(A))){we.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[s]=A},this),t=e):(m.isUndefined(e)&&(e=1),i[n]=e),r[Ai]=i,this._send_request(r,t)}),$.prototype.append=Fr(function(n,e,t){m.isObject(n)&&(t=e);var r=this.append_action(n,e);return this._send_request(r,t)}),$.prototype.remove=Fr(function(n,e,t){m.isObject(n)&&(t=e);var r=this.remove_action(n,e);return this._send_request(r,t)}),$.prototype.union=Fr(function(n,e,t){m.isObject(n)&&(t=e);var r=this.union_action(n,e);return this._send_request(r,t)}),$.prototype.track_charge=Fr(function(){we.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")}),$.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},$.prototype.delete_user=function(){if(!this._identify_called()){we.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},$.prototype.toString=function(){return this._mixpanel.toString()+".people"},$.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var t=this._mixpanel.get_property("$device_id"),r=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");t&&(n.$device_id=t),r&&(n.$user_id=r),i&&(n.$had_persisted_distinct_id=i);var A=m.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:A,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(A,255))},$.prototype._get_config=function(n){return this._mixpanel.get_config(n)},$.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},$.prototype._enqueue=function(n){xr in n?this._mixpanel.persistence._add_to_people_queue(xr,n):oA in n?this._mixpanel.persistence._add_to_people_queue(oA,n):mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):Ai in n?this._mixpanel.persistence._add_to_people_queue(Ai,n):Qn in n?this._mixpanel.persistence._add_to_people_queue(Qn,n):Xn in n?this._mixpanel.persistence._add_to_people_queue(Xn,n):si in n?this._mixpanel.persistence._add_to_people_queue(si,n):we.error("Invalid call to _enqueue():",n)},$.prototype._flush_one_queue=function(n,e,t,r){var i=this,A=m.extend({},this._mixpanel.persistence.load_queue(n)),s=A;!m.isUndefined(A)&&m.isObject(A)&&!m.isEmptyObject(A)&&(i._mixpanel.persistence._pop_from_people_queue(n,A),i._mixpanel.persistence.save(),r&&(s=r(A)),e.call(i,s,function(o,a){o===0&&i._mixpanel.persistence._add_to_people_queue(n,A),m.isUndefined(t)||t(o,a)}))},$.prototype._flush=function(n,e,t,r,i,A,s){var o=this;this._flush_one_queue(xr,this.set,n),this._flush_one_queue(oA,this.set_once,r),this._flush_one_queue(mn,this.unset,A,function(g){return m.keys(g)}),this._flush_one_queue(Ai,this.increment,e),this._flush_one_queue(si,this.union,i);var a=this._mixpanel.persistence.load_queue(Qn);if(!m.isUndefined(a)&&m.isArray(a)&&a.length)for(var c,u=function(g,v){g===0&&o._mixpanel.persistence._add_to_people_queue(Qn,c),m.isUndefined(t)||t(g,v)},l=a.length-1;l>=0;l--)a=this._mixpanel.persistence.load_queue(Qn),c=a.pop(),o._mixpanel.persistence.save(),m.isEmptyObject(c)||o.append(c,u);var d=this._mixpanel.persistence.load_queue(Xn);if(!m.isUndefined(d)&&m.isArray(d)&&d.length)for(var h,f=function(g,v){g===0&&o._mixpanel.persistence._add_to_people_queue(Xn,h),m.isUndefined(s)||s(g,v)},p=d.length-1;p>=0;p--)d=this._mixpanel.persistence.load_queue(Xn),h=d.pop(),o._mixpanel.persistence.save(),m.isEmptyObject(h)||o.remove(h,f)},$.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},$.prototype.set=$.prototype.set,$.prototype.set_once=$.prototype.set_once,$.prototype.unset=$.prototype.unset,$.prototype.increment=$.prototype.increment,$.prototype.append=$.prototype.append,$.prototype.remove=$.prototype.remove,$.prototype.union=$.prototype.union,$.prototype.track_charge=$.prototype.track_charge,$.prototype.clear_charges=$.prototype.clear_charges,$.prototype.delete_user=$.prototype.delete_user,$.prototype.toString=$.prototype.toString;var bp="__mps",Bp="__mpso",Cp="__mpus",_p="__mpa",Sp="__mpap",kp="__mpr",Ep="__mpu",FC="$people_distinct_id",Lc="__alias",Es="__timers",LD=[bp,Bp,Cp,_p,Sp,kp,Ep,FC,Lc,Es],re=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(we.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};re.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,t){m.include(LD,t)||(n[t]=e)}),n},re.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},re.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},re.prototype.save=function(){this.disabled||this.storage.set(this.name,tA(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},re.prototype.load_prop=function(n){return this.load(),this.props[n]},re.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},re.prototype.clear=function(){this.remove(),this.props={}},re.prototype.register_once=function(n,e,t){return m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),m.each(n,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===e)&&(this.props[i]=r)},this),this.save(),!0):!1},re.prototype.register=function(n,e){return m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.extend(this.props,n),this.save(),!0):!1},re.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},re.prototype.update_search_keyword=function(n){this.register(m.info.searchInfo(n))},re.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},re.prototype.get_referrer_info=function(){return m.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},re.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},re.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},re.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},re.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},re.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},re.prototype.get_cross_subdomain=function(){return this.cross_subdomain},re.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},re.prototype._add_to_people_queue=function(n,e){var t=this._get_queue_key(n),r=e[n],i=this._get_or_create_queue(xr),A=this._get_or_create_queue(oA),s=this._get_or_create_queue(mn),o=this._get_or_create_queue(Ai),a=this._get_or_create_queue(si),c=this._get_or_create_queue(Xn,[]),u=this._get_or_create_queue(Qn,[]);t===bp?(m.extend(i,r),this._pop_from_people_queue(Ai,r),this._pop_from_people_queue(si,r),this._pop_from_people_queue(mn,r)):t===Bp?(m.each(r,function(l,d){d in A||(A[d]=l)}),this._pop_from_people_queue(mn,r)):t===Cp?m.each(r,function(l){m.each([i,A,o,a],function(d){l in d&&delete d[l]}),m.each(u,function(d){l in d&&delete d[l]}),s[l]=!0}):t===_p?(m.each(r,function(l,d){d in i?i[d]+=l:(d in o||(o[d]=0),o[d]+=l)},this),this._pop_from_people_queue(mn,r)):t===Ep?(m.each(r,function(l,d){m.isArray(l)&&(d in a||(a[d]=[]),m.each(l,function(h){m.include(a[d],h)||a[d].push(h)}))}),this._pop_from_people_queue(mn,r)):t===kp?(c.push(r),this._pop_from_people_queue(Qn,r)):t===Sp&&(u.push(r),this._pop_from_people_queue(mn,r)),we.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),we.log(e),this.save()},re.prototype._pop_from_people_queue=function(n,e){var t=this.props[this._get_queue_key(n)];m.isUndefined(t)||m.each(e,function(r,i){n===Qn||n===Xn?m.each(t,function(A){A[i]===r&&delete A[i]}):delete t[i]},this)},re.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},re.prototype._get_queue_key=function(n){if(n===xr)return bp;if(n===oA)return Bp;if(n===mn)return Cp;if(n===Ai)return _p;if(n===Qn)return Sp;if(n===Xn)return kp;if(n===si)return Ep;we.error("Invalid queue:",n)},re.prototype._get_or_create_queue=function(n,e){var t=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[t]||(this.props[t]=e)},re.prototype.set_event_timer=function(n,e){var t=this.load_prop(Es)||{};t[n]=e,this.props[Es]=t,this.save()},re.prototype.remove_event_timer=function(n){var e=this.load_prop(Es)||{},t=e[n];return m.isUndefined(t)||(delete this.props[Es][n],this.save()),t};var Up,xC=function(n,e){throw new Error(n+" not available in this build.")},Ut,QC=0,DD=1,ND=function(n){return n},en="mixpanel",RC="base64",HD="json",Tp="$device:",aA=V.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,PC=!aA&&qn.indexOf("MSIE")===-1&&qn.indexOf("Mozilla")===-1,Dc=null;Ur.sendBeacon&&(Dc=function(){return Ur.sendBeacon.apply(Ur,arguments)});var OC={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/"},MC={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:OC,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:RC,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:Tr,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:Tr,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_heatmap_data:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:bs,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},LC=!1,U=function(){},Ip=function(n,e,t){var r,i=t===en?Ut:Ut[t];if(i&&Up===QC)r=i;else{if(i&&!m.isArray(i)){we.error("You have already initialized "+t);return}r=new U}if(r._cached_groups={},r._init(n,e,t),r.people=new $,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var A=m.info.campaignParams(null),s={},o=!1;m.each(A,function(a,c){s["initial_"+c]=a,a&&(o=!0)}),o&&r.people.set_once(s)}return gn.DEBUG=gn.DEBUG||r.get_config("debug"),!m.isUndefined(i)&&m.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};U.prototype.init=function(n,e,t){if(m.isUndefined(t)){this.report_error("You must name your new library: init(token, config, name)");return}if(t===en){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=Ip(n,e,t);return Ut[t]=r,r._loaded(),r},U.prototype._init=function(n,e,t){e=e||{},this.__loaded=!0,this.config={};var r={};if(!("api_payload_format"in e)){var i=e.api_host||MC.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=HD)}if(this.set_config(m.extend({},MC,r,e,{name:t,token:n,callback_fn:(t===en?t:en+"."+t)+"._jsc"})),this._jsc=Tr,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!m.localStorage.is_supported(!0)||!aA)this._batch_requests=!1,we.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(o){we.log("Clearing batch queue "+o.queue_key),m.localStorage.remove(o.queue_key)});else if(this.init_batchers(),Dc&&V.addEventListener){var A=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);V.addEventListener("pagehide",function(o){o.persisted&&A()}),V.addEventListener("visibilitychange",function(){ye.visibilityState==="hidden"&&A()})}}this.persistence=this.cookie=new re(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:Tp+s,$device_id:s},""),this.flags=new ae({getFullApiRoute:m.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:m.bind(this.get_config,this),setConfigFunc:m.bind(this.set_config,this),getPropertyFunc:m.bind(this.get_property,this),trackingFunc:m.bind(this.track,this)}),this.flags.init(),this.flags=this.flags,this.autocapture=new Qt(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},U.prototype._init_tab_id=function(){if(m.sessionStorage.is_supported())try{var n=this.get_config("name")+"_"+this.get_config("token"),e="mp_tab_id_"+n,t="mp_gen_new_tab_id_"+n;(m.sessionStorage.get(t)||!m.sessionStorage.get(e))&&m.sessionStorage.set(e,"$tab-"+m.UUID()),m.sessionStorage.set(t,"1"),this.tab_id=m.sessionStorage.get(e),V.addEventListener("beforeunload",function(){m.sessionStorage.remove(t)})}catch(r){this.report_error("Error initializing tab id",r)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},U.prototype.get_tab_id=function(){return this.tab_id||null},U.prototype._should_load_recorder=function(){var n=new In(sp),e=this.get_tab_id();return n.init().then(function(){return n.getAll()}).then(function(t){for(var r=0;r<t.length;r++)if(up(t[r])||t[r].tabId===e)return!0;return!1}).catch(m.bind(function(t){this.report_error("Error checking recording registry",t)},this))},U.prototype._check_and_start_session_recording=Ir(function(n){if(!V.MutationObserver){we.critical("Browser does not support MutationObserver; skipping session recording");return}var e=m.bind(function(r){var i=m.bind(function(){this._recorder=this._recorder||new V.__mp_recorder(this),this._recorder.resumeRecording(r)},this);m.isUndefined(V.__mp_recorder)?xC(this.get_config("recorder_src"),i):i()},this),t=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");n||t?e(!0):this._should_load_recorder().then(function(r){r&&e(!1)})}),U.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},U.prototype.stop_session_recording=function(){return this._recorder?this._recorder.stopRecording():Promise.resolve()},U.prototype.pause_session_recording=function(){return this._recorder?this._recorder.pauseRecording():Promise.resolve()},U.prototype.resume_session_recording=function(){return this._recorder?this._recorder.resumeRecording():Promise.resolve()},U.prototype.is_recording_heatmap_data=function(){return this._get_session_replay_id()&&this.get_config("record_heatmap_data")},U.prototype.get_session_recording_properties=function(){var n={},e=this._get_session_replay_id();return e&&(n.$mp_replay_id=e),n},U.prototype.get_session_replay_url=function(){var n=null,e=this._get_session_replay_id();if(e){var t=m.HTTPBuildQuery({replay_id:e,distinct_id:this.get_distinct_id(),token:this.get_config("token")});n="https://mixpanel.com/projects/replay-redirect?"+t}return n},U.prototype._get_session_replay_id=function(){var n=null;return this._recorder&&(n=this._recorder.replayId),n||null},U.prototype.__get_recorder=function(){return this._recorder},U.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=m.info.campaignParams(null);m.each(n,(function(e,t){this.unregister(t)}).bind(this))}},U.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(ye.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(ye.referrer)},U.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},U.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!LC)return this.__dom_loaded_queue.push([n,e]),!1;var t=new n().init(this);return t.track.apply(t,e)},U.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(aA){var t=function(s){n(s,e)};return t}else{var r=this._jsc,i=""+Math.floor(Math.random()*1e8),A=this.get_config("callback_fn")+"["+i+"]";return r[i]=function(s){delete r[i],n(s,e)},A}},U.prototype._send_request=function(n,e,t,r){var i=!0;if(PC)return this.__request_queue.push(arguments),i;var A={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},s=null;!r&&(m.isFunction(t)||typeof t=="string")&&(r=t,t=null),t=m.extend(A,t||{}),aA||(t.method="GET");var o=t.method==="POST",a=Dc&&o&&t.transport.toLowerCase()==="sendbeacon",c=t.verbose;e.verbose&&(c=!0),this.get_config("test")&&(e.test=1),c&&(e.verbose=1),this.get_config("img")&&(e.img=1),aA||(r?e.callback=r:(c||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),o&&(s="data="+encodeURIComponent(e.data),delete e.data),m.extend(e,this.get_config("api_extra_query_params")),n+="?"+m.HTTPBuildQuery(e);var u=this;if("img"in e){var l=ye.createElement("img");l.src=n,ye.body.appendChild(l)}else if(a){try{i=Dc(n,s)}catch(v){u.report_error(v),i=!1}try{r&&r(i?1:0)}catch(v){u.report_error(v)}}else if(aA)try{var d=new XMLHttpRequest;d.open(t.method,n,!0);var h=this.get_config("xhr_headers");if(o&&(h["Content-Type"]="application/x-www-form-urlencoded"),m.each(h,function(v,y){d.setRequestHeader(y,v)}),t.timeout_ms&&typeof d.timeout<"u"){d.timeout=t.timeout_ms;var f=new Date().getTime()}d.withCredentials=!0,d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200){if(r)if(c){var v;try{v=m.JSONDecode(d.responseText)}catch(b){if(u.report_error(b),t.ignore_json_errors)v=d.responseText;else return}r(v)}else r(Number(d.responseText))}else{var y;if(d.timeout&&!d.status&&new Date().getTime()-f>=d.timeout?y="timeout":y="Bad HTTP status: "+d.status+" "+d.statusText,u.report_error(y),r)if(c){var B=d.responseHeaders||{};r({status:0,httpStatusCode:d.status,error:y,retryAfter:B["Retry-After"]})}else r(0)}},d.send(s)}catch(v){u.report_error(v),i=!1}else{var p=ye.createElement("script");p.type="text/javascript",p.async=!0,p.defer=!0,p.src=n;var g=ye.getElementsByTagName("script")[0];g.parentNode.insertBefore(p,g)}return i},U.prototype._execute_array=function(n){var e,t=[],r=[],i=[];m.each(n,function(s){s&&(e=s[0],m.isArray(e)?i.push(s):typeof s=="function"?s.call(this):m.isArray(s)&&e==="alias"?t.push(s):m.isArray(s)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?i.push(s):r.push(s))},this);var A=function(s,o){m.each(s,function(a){if(m.isArray(a[0])){var c=o;m.each(a,function(u){c=c[u[0]].apply(c,u.slice(1))})}else this[a[0]].apply(this,a.slice(1))},o)};A(t,this),A(r,this),A(i,this)},U.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},U.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:n+"_ev"},people:{type:"people",api_name:"engage",queue_key:n+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:n+"_gr"}},this._batcher_configs},U.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=m.bind(function(t){return new $t(t.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.bind(function(r,i,A){var s=this.get_config("api_routes");this._send_request(this.get_api_host(t.api_name)+"/"+s[t.api_name],this._encode_data_for_request(r),i,this._prepare_callback(A,r))},this),beforeSendHook:m.bind(function(r){return this._run_hook("before_send_"+t.type,r)},this),stopAllBatchingFunc:m.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},U.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,m.each(this.request_batchers,function(n){n.start()}))},U.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.each(this.request_batchers,function(n){n.stop(),n.clear()})},U.prototype.push=function(n){this._execute_array([n])},U.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},U.prototype._encode_data_for_request=function(n){var e=tA(n);return this.get_config("api_payload_format")===RC&&(e=m.base64Encode(e)),{data:e}},U.prototype._track_or_batch=function(n,e){var t=m.truncate(n.data,255),r=n.endpoint,i=n.batcher,A=n.should_send_immediately,s=n.send_request_options||{};e=e||Tr;var o=!0,a=m.bind(function(){return s.skip_hooks||(t=this._run_hook("before_send_"+n.type,t)),t?(we.log("MIXPANEL REQUEST:"),we.log(t),this._send_request(r,this._encode_data_for_request(t),s,this._prepare_callback(e,t))):null},this);return this._batch_requests&&!A?i.enqueue(t).then(function(c){c?e(1,t):a()}):o=a(),o&&t},U.prototype.track=Ir(function(n,e,t,r){!r&&typeof t=="function"&&(r=t,t=null),t=t||{};var i=t.transport;i&&(t.transport=i);var A=t.send_immediately;if(typeof r!="function"&&(r=Tr),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){r(0);return}e=m.extend({},e),e.token=this.get_config("token");var s=this.persistence.remove_event_timer(n);if(!m.isUndefined(s)){var o=new Date().getTime()-s;e.$duration=parseFloat((o/1e3).toFixed(3))}this._set_default_superprops();var a=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),a,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var c=this.get_config("property_blacklist");m.isArray(c)?m.each(c,function(d){delete e[d]}):this.report_error("Invalid value for property_blacklist config: "+c);var u={event:n,properties:e},l=this._track_or_batch({type:"events",data:u,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:A,send_request_options:t},r);return l}),U.prototype.set_group=Ir(function(n,e,t){m.isArray(e)||(e=[e]);var r={};return r[n]=e,this.register(r),this.people.set(n,e,t)}),U.prototype.add_group=Ir(function(n,e,t){var r=this.get_property(n),i={};return r===void 0?(i[n]=[e],this.register(i)):r.indexOf(e)===-1&&(r.push(e),i[n]=r,this.register(i)),this.people.union(n,e,t)}),U.prototype.remove_group=Ir(function(n,e,t){var r=this.get_property(n);if(r!==void 0){var i=r.indexOf(e);i>-1&&(r.splice(i,1),this.register({group_key:r})),r.length===0&&this.unregister(n)}return this.people.remove(n,e,t)}),U.prototype.track_with_groups=Ir(function(n,e,t,r){var i=m.extend({},e||{});return m.each(t,function(A,s){A!=null&&(i[s]=A)}),this.track(n,i,r)}),U.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},U.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},U.prototype.get_group=function(n,e){var t=this._create_map_key(n,e),r=this._cached_groups[t];return(r===void 0||r._group_key!==n||r._group_id!==e)&&(r=new De,r._init(this,n,e),this._cached_groups[t]=r),r},U.prototype.track_pageview=Ir(function(n,e){typeof n!="object"&&(n={}),e=e||{};var t=e.event_name||"$mp_web_page_view",r=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),i=m.extend({},r,n);return this.track(t,i)}),U.prototype.track_links=function(){return this._track_dom.call(this,sA,arguments)},U.prototype.track_forms=function(){return this._track_dom.call(this,Mc,arguments)},U.prototype.time_event=function(n){if(m.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var KD={persistent:!0},Fp=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},KD,e)};U.prototype.register=function(n,e){var t=Fp(e);t.persistent?this.persistence.register(n,t.days):m.extend(this.unpersisted_superprops,n)},U.prototype.register_once=function(n,e,t){var r=Fp(t);r.persistent?this.persistence.register_once(n,e,r.days):(typeof e>"u"&&(e="None"),m.each(n,function(i,A){(!this.unpersisted_superprops.hasOwnProperty(A)||this.unpersisted_superprops[A]===e)&&(this.unpersisted_superprops[A]=i)},this))},U.prototype.unregister=function(n,e){e=Fp(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},U.prototype._register_single=function(n,e){var t={};t[n]=e,this.register(t)},U.prototype.identify=function(n,e,t,r,i,A,s,o){var a=this.get_distinct_id();if(n&&a!==n){if(typeof n=="string"&&n.indexOf(Tp)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var c=a;this.register_once({$had_persisted_distinct_id:!0,$device_id:c},"")}n!==a&&n!==this.get_property(Lc)&&(this.unregister(Lc),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,t,r,i,A,s,o),n!==a&&this.track("$identify",{distinct_id:n,$anon_distinct_id:a},{skip_hooks:!0}),n!==a&&this.flags.fetchFlags()},U.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:Tp+n,$device_id:n},""),this._check_and_start_session_recording()},U.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},U.prototype.alias=function(n,e){if(n===this.get_property(FC))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var t=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Lc,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){t.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},U.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},U.prototype.set_config=function(n){if(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.each(this.request_batchers,function(t){t.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),gn.DEBUG=gn.DEBUG||this.get_config("debug"),("autocapture"in n||"record_heatmap_data"in n)&&this.autocapture&&this.autocapture.init()}},U.prototype.get_config=function(n){return this.config[n]},U.prototype._run_hook=function(n){var e=(this.config.hooks[n]||ND).apply(this,ni.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},U.prototype.get_property=function(n){return this.persistence.load_prop([n])},U.prototype.get_api_host=function(n){return this.get_config("api_hosts")[n]||this.get_config("api_host")},U.prototype.toString=function(){var n=this.get_config("name");return n!==en&&(n=en+"."+n),n},U.prototype._event_is_disabled=function(n){return m.isBlockedUA(qn)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},U.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||m.cookie.get("mp_optout"))&&(m.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},U.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},U.prototype._gdpr_call_func=function(n,e){return e=m.extend({track:m.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),m.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},U.prototype.opt_in_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(oD,n),this._gdpr_update_persistence(n)},U.prototype.opt_out_tracking=function(n){n=m.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(aD,n),this._gdpr_update_persistence(n)},U.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(cD,n)},U.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(zB,n)},U.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(uD,n),this._gdpr_update_persistence(n)},U.prototype.report_error=function(n,e){we.error.apply(we.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){we.error(t)}},U.prototype.init=U.prototype.init,U.prototype.reset=U.prototype.reset,U.prototype.disable=U.prototype.disable,U.prototype.time_event=U.prototype.time_event,U.prototype.track=U.prototype.track,U.prototype.track_links=U.prototype.track_links,U.prototype.track_forms=U.prototype.track_forms,U.prototype.track_pageview=U.prototype.track_pageview,U.prototype.register=U.prototype.register,U.prototype.register_once=U.prototype.register_once,U.prototype.unregister=U.prototype.unregister,U.prototype.identify=U.prototype.identify,U.prototype.alias=U.prototype.alias,U.prototype.name_tag=U.prototype.name_tag,U.prototype.set_config=U.prototype.set_config,U.prototype.get_config=U.prototype.get_config,U.prototype.get_api_host=U.prototype.get_api_host,U.prototype.get_property=U.prototype.get_property,U.prototype.get_distinct_id=U.prototype.get_distinct_id,U.prototype.toString=U.prototype.toString,U.prototype.opt_out_tracking=U.prototype.opt_out_tracking,U.prototype.opt_in_tracking=U.prototype.opt_in_tracking,U.prototype.has_opted_out_tracking=U.prototype.has_opted_out_tracking,U.prototype.has_opted_in_tracking=U.prototype.has_opted_in_tracking,U.prototype.clear_opt_in_out_tracking=U.prototype.clear_opt_in_out_tracking,U.prototype.get_group=U.prototype.get_group,U.prototype.set_group=U.prototype.set_group,U.prototype.add_group=U.prototype.add_group,U.prototype.remove_group=U.prototype.remove_group,U.prototype.track_with_groups=U.prototype.track_with_groups,U.prototype.start_batch_senders=U.prototype.start_batch_senders,U.prototype.stop_batch_senders=U.prototype.stop_batch_senders,U.prototype.start_session_recording=U.prototype.start_session_recording,U.prototype.stop_session_recording=U.prototype.stop_session_recording,U.prototype.pause_session_recording=U.prototype.pause_session_recording,U.prototype.resume_session_recording=U.prototype.resume_session_recording,U.prototype.get_session_recording_properties=U.prototype.get_session_recording_properties,U.prototype.get_session_replay_url=U.prototype.get_session_replay_url,U.prototype.get_tab_id=U.prototype.get_tab_id,U.prototype.DEFAULT_API_ROUTES=OC,U.prototype.__get_recorder=U.prototype.__get_recorder,re.prototype.properties=re.prototype.properties,re.prototype.update_search_keyword=re.prototype.update_search_keyword,re.prototype.update_referrer_info=re.prototype.update_referrer_info,re.prototype.get_cross_subdomain=re.prototype.get_cross_subdomain,re.prototype.clear=re.prototype.clear;var cA={},VD=function(){m.each(cA,function(n,e){e!==en&&(Ut[e]=n)}),Ut._=m},GD=function(){Ut.init=function(n,e,t){if(t)return Ut[t]||(Ut[t]=cA[t]=Ip(n,e,t),Ut[t]._loaded()),Ut[t];var r=Ut;cA[en]?r=cA[en]:n&&(r=Ip(n,e,en),r._loaded(),cA[en]=r),Ut=r,Up===DD&&(V[en]=Ut),VD()}},jD=function(){function n(){n.done||(n.done=!0,LC=!0,PC=!1,m.each(cA,function(r){r._dom_loaded()}))}function e(){try{ye.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(ye.addEventListener)ye.readyState==="complete"?n():ye.addEventListener("DOMContentLoaded",n,!1);else if(ye.attachEvent){ye.attachEvent("onreadystatechange",n);var t=!1;try{t=V.frameElement===null}catch{}ye.documentElement.doScroll&&t&&e()}m.register_event(V,"load",n,!0)};function WD(n){return xC=n,Up=QC,Ut=new U,GD(),Ut.init(),jD(),Ut}function qD(n,e){e()}var Nc=WD(qD);iy({identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}});function JD(n,e={}){const t=e.instanceName||`obi_${Math.random().toString(36).slice(2)}`;Nc.init(n,{debug:e.debug===!0,track_pageview:!1,persistence:"localStorage",...e.config||{}},t);const r=Nc.get_instance?Nc.get_instance(t):Nc[t];return{identify:(i,A)=>{var s;try{r.identify(i),A&&((s=r==null?void 0:r.people)!=null&&s.set)&&r.people.set(A)}catch{}},track:(i,A)=>{try{r.track(i,A||{})}catch{}},page:(i,A)=>{try{r.track("Page Viewed",{name:i,...A||{}})}catch{}},reset:()=>{try{r.reset()}catch{}}}}let xp=null;function Se(){return xp||(xp=JD("d37cde23ca4b5d8c7ed30653f07f9e47"),xp)}const zD=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,DC="9.23.0",uA=globalThis;function XD(n,e,t=uA){const r=t.__SENTRY__=t.__SENTRY__||{},i=r[DC]=r[DC]||{};return i[n]||(i[n]=e())}const YD="Sentry Logger ",NC=["debug","info","warn","error","log","assert","trace"],HC={};function ZD(n){if(!("console"in uA))return n();const e=uA.console,t={},r=Object.keys(HC);r.forEach(i=>{const A=HC[i];t[i]=e[i],e[i]=A});try{return n()}finally{r.forEach(i=>{e[i]=t[i]})}}function $D(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return zD?NC.forEach(t=>{e[t]=(...r)=>{n&&ZD(()=>{uA.console[t](`${YD}[${t}]:`,...r)})}}):NC.forEach(t=>{e[t]=()=>{}}),e}XD("logger",$D);const KC=1e3;function e4(){return Date.now()/KC}function t4(){const{performance:n}=uA;if(!(n!=null&&n.now))return e4;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/KC}t4();const VC=50,lA="?",GC=/\(error: (.*)\)/,jC=/captureMessage|captureException/;function n4(...n){const e=n.sort((t,r)=>t[0]-r[0]).map(t=>t[1]);return(t,r=0,i=0)=>{const A=[],s=t.split(`
|
|
124
124
|
`);for(let o=r;o<s.length;o++){const a=s[o];if(a.length>1024)continue;const c=GC.test(a)?a.replace(GC,"$1"):a;if(!c.match(/\S*Error: /)){for(const u of e){const l=u(c);if(l){A.push(l);break}}if(A.length>=VC+i)break}}return r4(A.slice(i))}}function r4(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(Hc(e).function||"")&&e.pop(),e.reverse(),jC.test(Hc(e).function||"")&&(e.pop(),jC.test(Hc(e).function||"")&&e.pop()),e.slice(0,VC).map(t=>({...t,filename:t.filename||Hc(e).filename,function:t.function||lA}))}function Hc(n){return n[n.length-1]||{}}var WC;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(WC||(WC={})),uA._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const i4=30,A4=50;function Qp(n,e,t,r){const i={filename:n,function:e==="<anonymous>"?lA:e,in_app:!0};return t!==void 0&&(i.lineno=t),r!==void 0&&(i.colno=r),i}const s4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,o4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a4=/\((\S*)(?::(\d+))(?::(\d+))\)/,c4=n=>{const e=s4.exec(n);if(e){const[,r,i,A]=e;return Qp(r,lA,+i,+A)}const t=o4.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const A=a4.exec(t[2]);A&&(t[2]=A[1],t[3]=A[2],t[4]=A[3])}const[r,i]=qC(t[1]||lA,t[2]);return Qp(i,r,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},u4=[i4,c4],l4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,d4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;n4(...[u4,[A4,n=>{const e=l4.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=d4.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let t=e[3],r=e[1]||lA;return[r,t]=qC(r,t),Qp(t,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const qC=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,r=n.indexOf("safari-web-extension")!==-1;return t||r?[n.indexOf("@")!==-1?n.split("@")[0]:lA,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const h4=`:root,:host{--obi-modal-padding: 48px 48px 32px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 12px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 545px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:100%}.tour-content .title{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:700;font-size:32px;line-height:90%;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0}.tour-content .subtitle{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{width:480px;height:240px;margin-top:24px;border-radius:12px;display:flex;align-items:center;justify-content:center;position:relative}.tour-content .description{width:100%;min-height:48px;margin:24px 0 0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b}.tour-content .button-container{display:flex;margin-top:24px;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;min-width:200px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{flex:1;display:flex;flex-direction:column}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transform:translateY(0);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out;width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-message{display:inline-flex;align-items:center;justify-content:center;min-width:140px;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:6px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:2px 0;height:6px;flex:1;min-width:0}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-course-progress-container{display:none;width:100%;max-height:0;opacity:0;transform:translateY(-10px);overflow:hidden;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel:hover .obi-course-progress-container{display:block;max-width:22 0px;animation:expand-course-progress .3s ease-in-out forwards}.obi-widget-panel:hover .obi-course-progress-container.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:4px}.obi-widget-out-of-plan .text{font-size:16px;color:#fff;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
|
|
125
|
-
`;function p4(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function f4(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(r=>{try{const i=p4(r);return i.test(t)||i.test(n)}catch(i){return console.warn(`Invalid URL pattern: ${r}`,i),!1}})}function Rp(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return f4(e,n)}function g4(n){var b,w,_,k,F,x;const[e,t]=ge(!1),[r,i]=ge(!1),[A,s]=ge(null),o=m4(n.sdk,a,n.shadowHost,s);function a(E){var T;(T=o.client)!=null&&T.session||(t(E),E&&Se().track("course-list-opened"))}if(!o.client)return null;const c=v4((b=o.client.product)==null?void 0:b.widget_url_blacklist);let u=o.isActive;((_=(w=o.client)==null?void 0:w.product)==null?void 0:_.name)==="Canibuild"&&(u=!0);const l=o.client.session,d=!!l,h=d&&!e;let f;switch(l==null?void 0:l.speakingState){case"listening":f="user-speaking";break;case"speaking":f="agent-speaking";break;case"thinking":f="thinking";break;case"busy":f="busy";break}const p=l==null?void 0:l.isPaused,g=d||o.client.state==="ready"&&u&&!c&&(o.client.selectedPlan||!((k=o.client.product)!=null&&k.widget_link_only_access)),v=h?100:62,y=()=>{var E,T,Q,M,X,H;return{name:(E=o.client.selectedPlan)==null?void 0:E.name,description:(T=o.client.selectedPlan)==null?void 0:T.description,appName:(Q=o.client.product)==null?void 0:Q.name,appLogoUrl:((M=o.client.product)==null?void 0:M.logo_url)||"",url:(X=o.client.product)==null?void 0:X.url,agentName:((H=o.client.product)==null?void 0:H.agent_name)||"Obi"}},B=((F=o.client.product)==null?void 0:F.widget_position)==="bottom-right"?{position:"fixed",top:`calc(100vh - ${v}px)`,right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",top:`calc(100vh - ${v}px)`,left:"50%",transform:"translateX(-50%)",width:"max-content"};return C("div",{children:[e&&C(hR,{open:e,courses:o.client.plans.map(E=>({id:E.uuid,name:E.name,description:E.description||"",duration:E.duration||0})),loading:!1,agentName:((x=o.client.product)==null?void 0:x.agent_name)||"Obi",onCourseHighlight:E=>{E&&Se().track("course-selected",{courseName:E.name,courseUuid:E.id})},onCourseSelect:E=>{const T=o.client.plans.find(Q=>Q.uuid===E.id)||null;T&&(T==null?void 0:T.uuid)!==o.client.selectedPlanUuid&&(o.client.selectPlan(T),t(!1),i(!0),Se().track("course-get-started",{courseName:E.name,courseUuid:E.id}))},onClose:E=>{E==="user-initiated"&&o.client.selectPlan(null),t(!1)}}),g&&C(St,{children:[C("div",{style:B,children:C(JQ,{inPlan:d,isActive:r?!1:void 0,defaultIsActive:!0,isPaused:p,messaging:(l==null?void 0:l.isMicShared)===!1?!0:void 0,speakingStatus:f,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,courseProgress:A,onOpen:()=>{t(!0),Se().track("course-list-opened")},onCancelClick:()=>{Se().track("close-button-clicked")},onCancelAbort:()=>{Se().track("close-confirmation-no")},onCancel:()=>{var E;(E=o.client.session)==null||E.stop(),Se().track("close-confirmation-yes")},onCancelReason:(E,T)=>{Se().track("close-survey-answered",{reason:E,reasonText:T})},onPause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.pause)==null||T.call(E),Se().track("pause-button-clicked")},onUnpause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.unpause)==null||T.call(E),Se().track("play-button-clicked")},onMessagingChange:E=>{var T,Q,M,X;E?((Q=(T=o.client.session)==null?void 0:T.muteMicrophone)==null||Q.call(T),Se().track("switch-to-chat-clicked")):((X=(M=o.client.session)==null?void 0:M.unmuteMicrophone)==null||X.call(M),Se().track("switch-to-voice-clicked"))},onMessageChange:E=>{Se().track("chat-input-provided",{message:E,length:E.length})},onMessage:E=>{o.say(E),Se().track("chat-message-sent")},onHover:E=>{E&&!d&&Se().track("widget-hover-on")},onOneClickAction:E=>{Se().track("one-click-action-clicked",{action:E})},onMinimize:()=>{Se().track("minimise-button-clicked",{inSession:d})}})}),!!o.client.selectedPlan&&C(fR,{open:!0,session:y(),sessionState:(l==null?void 0:l.state)||null,speakingState:(l==null?void 0:l.speakingState)||null,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,onModalChange:E=>{E==="session-start"?Se().track("course-screen-opened"):E==="voice-guidance"?Se().track("can-you-hear-opened"):E==="overview"?Se().track("welcome-tour-opened"):E==="share-mic"&&Se().track("connect-mic-opened")},onClose:(E,T)=>{var Q,M;E==="user-initiated"&&(T==="session-start"?Se().track("course-screen-closed"):T==="voice-guidance"?Se().track("can-you-hear-closed"):T==="overview"?Se().track("welcome-tour-closed"):T==="share-mic"&&Se().track("connect-mic-closed"),((Q=o.client.session)==null?void 0:Q.state)==="mic-share"?(M=o.client.session)==null||M.shareMicrophoneFailed():o.client.stopSession()),i(!1)},onStart:()=>{o.client.selectedPlanUuid&&(Se().track("course-screen-continue"),o.startSession())},onContinue:()=>{l==null||l.continue(),Se().track("can-you-hear-continue")},onShareMicrophone:()=>{l==null||l.shareMicrophone(),Se().track("connect-mic-continue")}})]})]})}function m4(n,e,t,r){const[i,A]=ge(0),[s,o]=ge(null);return Kt(()=>{n.on("showMenu",a=>{e(a)}),n.on("configUpdated",()=>{A(a=>a+1)})},[n]),Kt(()=>{n.client&&(n.client.session&&o(n.client.session),n.client.on("sessionStarted",a=>{o(a),A(c=>c+1)}),n.client.on("sessionStopped",()=>{o(null),A(a=>a+1)}),n.client.on("sessionShutdown",()=>{A(a=>a+1)}),n.client.on("sessionResumed",()=>{A(a=>a+1)}),n.client.on("stateChanged",()=>{var a;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((a=n.client.product)==null?void 0:a.primary_color)||"#9500FF"),A(c=>c+1)}),n.client.on("planSelected",()=>{A(a=>a+1)}))},[n,n.client]),Kt(()=>{if(!s)return;s.on("stateChanged",()=>{A(c=>c+1)}),s.on("speakingStateChanged",()=>{A(c=>c+1)}),s.on("paused",()=>{A(c=>c+1)}),s.on("unpaused",()=>{A(c=>c+1)});const a=c=>{r(c)};return s.on&&s.on("courseProgress",a),()=>{s.off&&s.off("courseProgress",a)}},[s]),n}function v4(n){const[e,t]=ge(()=>Rp(n));return Kt(()=>{t(Rp(n))},[n]),Kt(()=>{y4();const r=()=>{t(Rp(n))};return window.addEventListener("locationchange",r),window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{window.removeEventListener("locationchange",r),window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}},[n]),e}function y4(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,r=i=>function(...A){const s=i.apply(this,A);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=r(e),window.history.replaceState=r(t),n.__obi_history_patched=!0}function w4(n){if(document.querySelector("obi-widget"))return;b4();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),r=document.createElement("div");r.id="obi-container",t.appendChild(r);const i=new CSSStyleSheet;i.replaceSync(h4),t.adoptedStyleSheets=[i],gQ(C(g4,{sdk:n,shadowHost:e}),r),console.log("[obi-sdk] widget mounted")}function b4(){JC("https://fonts.cdnfonts.com/css/satoshi"),JC("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function JC(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const zC="49206C6F7665204F6269_session",XC="obi-url-params";class B4 extends Gc{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,r)=>{var i,A,s,o,a;switch(t){case"update":this.updateConfig(r);break;case"startSession":if(!(r!=null&&r.planUuid)){console.warn("[obi] startSession command requires a planUuid",r);return}const c=(((i=this.client)==null?void 0:i.plans)||[]).find(u=>u.uuid===r.planUuid)||null;if(!c){console.warn("[obi] startSession command requires a valid planUuid",r);return}this.updateActive(!0),(s=(A=this.client)==null?void 0:A.selectPlan)==null||s.call(A,c);break;case"stopSession":(a=(o=this.client)==null?void 0:o.stopSession)==null||a.call(o);break;case"say":this.say(r);break;default:console.warn("[obi] unknown command",{commandType:t,args:r})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const r=this.load();if(r)try{t=fa.deserialise(r,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(i){console.error("[obi] error loading cached client",i)}t||(t=new fa(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",i=>{var A,s,o;i==="ready"&&this.updateConfig({isActive:(A=this.client)==null?void 0:A.showWidget,primaryColour:((o=(s=this.client)==null?void 0:s.product)==null?void 0:o.primary_color)||"#9500FF"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",i=>{i==="invalid-room"&&localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(i,A)=>{Se().track(i,A)}),this.client.session&&this.client.resumeSession(i=>{i.on("stateChanged",A=>{A!=="disconnecting"&&A!=="disconnected"&&A!=="error"&&A!=="connecting"&&this.save()}),i.on("paused",()=>{this.save()}),i.on("unpaused",()=>{this.save()})})}async initialise(e={}){this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(t=>{console.error("[obi] error initialising client",t),this.emit("error",t)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(r=>{console.error("[obi] error initialising client",r),this.emit("error",r)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}async updateIdentity(e){var r;if(e===void 0||e==((r=this.client)==null?void 0:r.identity))return;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}),e!=null&&e.email&&Se().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,r,i;await((i=(r=(t=this.client)==null?void 0:t.session)==null?void 0:r.say)==null?void 0:i.call(r,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(r){console.error("[obi] error dispatching command",r)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(XC)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((A,s)=>{e[s]=A});const t=e[zC];if(!t)return null;const r=new URL(window.location.href);r.searchParams.delete(zC),window.history.replaceState({},"",r.toString()),r.toString(),localStorage.removeItem(XC),this.passivePlanUuid=t}mountWidget(){w4(this)}async captureScreen(){return(await BT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}save(){var e;localStorage.setItem("obi-client",((e=this.client)==null?void 0:e.serialise())||"")}load(){return localStorage.getItem("obi-client")}}async function YC(n){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return C4({appToken:n,window:e})}async function C4({appToken:n,window:e}){var i,A;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}n||(n=(i=e==null?void 0:e.obiWidgetConfig)==null?void 0:i.apiKey);let t;try{t=((A=e.ObiSDK)==null?void 0:A.q)||[]}catch{t=[]}const r=new B4(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:t}),e.obi=r,r.mountWidget(),r}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{YC()}):YC()})();
|
|
125
|
+
`;function p4(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function f4(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(r=>{try{const i=p4(r);return i.test(t)||i.test(n)}catch(i){return console.warn(`Invalid URL pattern: ${r}`,i),!1}})}function Rp(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return f4(e,n)}function g4(n){var b,w,_,k,F,x;const[e,t]=ge(!1),[r,i]=ge(!1),[A,s]=ge(null),o=m4(n.sdk,a,n.shadowHost,s);function a(E){var T;(T=o.client)!=null&&T.session||(t(E),E&&Se().track("course-list-opened"))}if(!o.client)return null;const c=v4((b=o.client.product)==null?void 0:b.widget_url_blacklist);let u=o.isActive;((_=(w=o.client)==null?void 0:w.product)==null?void 0:_.name)==="Canibuild"&&(u=!0);const l=o.client.session,d=!!l,h=d&&!e;let f;switch(l==null?void 0:l.speakingState){case"listening":f="user-speaking";break;case"speaking":f="agent-speaking";break;case"thinking":f="thinking";break;case"busy":f="busy";break}const p=l==null?void 0:l.isPaused,g=d||o.client.state==="ready"&&u&&!c&&(o.client.selectedPlan||!((k=o.client.product)!=null&&k.widget_link_only_access)),v=h?100:62,y=()=>{var E,T,Q,M,X,H;return{name:(E=o.client.selectedPlan)==null?void 0:E.name,description:(T=o.client.selectedPlan)==null?void 0:T.description,appName:(Q=o.client.product)==null?void 0:Q.name,appLogoUrl:((M=o.client.product)==null?void 0:M.logo_url)||"",url:(X=o.client.product)==null?void 0:X.url,agentName:((H=o.client.product)==null?void 0:H.agent_name)||"Obi"}},B=((F=o.client.product)==null?void 0:F.widget_position)==="bottom-right"?{position:"fixed",top:`calc(100vh - ${v}px)`,right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",top:`calc(100vh - ${v}px)`,left:"50%",transform:"translateX(-50%)",width:"max-content"};return C("div",{children:[e&&C(hR,{open:e,courses:o.client.plans.map(E=>({id:E.uuid,name:E.name,description:E.description||"",duration:E.duration||0})),loading:!1,agentName:((x=o.client.product)==null?void 0:x.agent_name)||"Obi",onCourseHighlight:E=>{E&&Se().track("course-selected",{courseName:E.name,courseUuid:E.id})},onCourseSelect:E=>{const T=o.client.plans.find(Q=>Q.uuid===E.id)||null;T&&(T==null?void 0:T.uuid)!==o.client.selectedPlanUuid&&(o.client.selectPlan(T),t(!1),i(!0),Se().track("course-get-started",{courseName:E.name,courseUuid:E.id}))},onClose:E=>{E==="user-initiated"&&o.client.selectPlan(null),t(!1)}}),g&&C(St,{children:[C("div",{style:B,children:C(JQ,{inPlan:d,isActive:r?!1:void 0,defaultIsActive:!0,isPaused:p,messaging:(l==null?void 0:l.isMicShared)===!1?!0:void 0,speakingStatus:f,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,courseProgress:A,onOpen:()=>{t(!0),Se().track("course-list-opened")},onCancelClick:()=>{Se().track("close-button-clicked")},onCancelAbort:()=>{Se().track("close-confirmation-no")},onCancel:()=>{var E;(E=o.client.session)==null||E.stop(),Se().track("close-confirmation-yes")},onCancelReason:(E,T)=>{Se().track("close-survey-answered",{reason:E,reasonText:T})},onPause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.pause)==null||T.call(E),Se().track("pause-button-clicked")},onUnpause:()=>{var E,T;(T=(E=o.client.session)==null?void 0:E.unpause)==null||T.call(E),Se().track("play-button-clicked")},onMessagingChange:E=>{var T,Q,M,X;E?((Q=(T=o.client.session)==null?void 0:T.muteMicrophone)==null||Q.call(T),Se().track("switch-to-chat-clicked")):((X=(M=o.client.session)==null?void 0:M.unmuteMicrophone)==null||X.call(M),Se().track("switch-to-voice-clicked"))},onMessageChange:E=>{Se().track("chat-input-provided",{message:E,length:E.length})},onMessage:E=>{o.say(E),Se().track("chat-message-sent",{message:E,length:E.length})},onHover:E=>{E&&!d&&Se().track("widget-hover-on")},onOneClickAction:E=>{Se().track("one-click-action-clicked",{action:E})},onMinimize:()=>{Se().track("minimise-button-clicked",{inSession:d})}})}),!!o.client.selectedPlan&&C(fR,{open:!0,session:y(),sessionState:(l==null?void 0:l.state)||null,speakingState:(l==null?void 0:l.speakingState)||null,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,onModalChange:E=>{E==="session-start"?Se().track("course-screen-opened"):E==="voice-guidance"?Se().track("can-you-hear-opened"):E==="overview"?Se().track("welcome-tour-opened"):E==="share-mic"&&Se().track("connect-mic-opened")},onClose:(E,T)=>{var Q,M;E==="user-initiated"&&(T==="session-start"?Se().track("course-screen-closed"):T==="voice-guidance"?Se().track("can-you-hear-closed"):T==="overview"?Se().track("welcome-tour-closed"):T==="share-mic"&&Se().track("connect-mic-closed"),((Q=o.client.session)==null?void 0:Q.state)==="mic-share"?(M=o.client.session)==null||M.shareMicrophoneFailed():o.client.stopSession()),i(!1)},onStart:()=>{o.client.selectedPlanUuid&&(Se().track("course-screen-continue"),o.startSession())},onContinue:()=>{l==null||l.continue(),Se().track("can-you-hear-continue")},onShareMicrophone:()=>{l==null||l.shareMicrophone(),Se().track("connect-mic-continue")}})]})]})}function m4(n,e,t,r){const[i,A]=ge(0),[s,o]=ge(null);return Kt(()=>{n.on("showMenu",a=>{e(a)}),n.on("configUpdated",()=>{A(a=>a+1)})},[n]),Kt(()=>{n.client&&(n.client.session&&o(n.client.session),n.client.on("sessionStarted",a=>{o(a),A(c=>c+1)}),n.client.on("sessionStopped",()=>{o(null),A(a=>a+1)}),n.client.on("sessionShutdown",()=>{A(a=>a+1)}),n.client.on("sessionResumed",()=>{A(a=>a+1)}),n.client.on("stateChanged",()=>{var a;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((a=n.client.product)==null?void 0:a.primary_color)||"#9500FF"),A(c=>c+1)}),n.client.on("planSelected",()=>{A(a=>a+1)}))},[n,n.client]),Kt(()=>{if(!s)return;s.on("stateChanged",()=>{A(c=>c+1)}),s.on("speakingStateChanged",()=>{A(c=>c+1)}),s.on("paused",()=>{A(c=>c+1)}),s.on("unpaused",()=>{A(c=>c+1)});const a=c=>{r(c)};return s.on&&s.on("courseProgress",a),()=>{s.off&&s.off("courseProgress",a)}},[s]),n}function v4(n){const[e,t]=ge(()=>Rp(n));return Kt(()=>{t(Rp(n))},[n]),Kt(()=>{y4();const r=()=>{t(Rp(n))};return window.addEventListener("locationchange",r),window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{window.removeEventListener("locationchange",r),window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}},[n]),e}function y4(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,r=i=>function(...A){const s=i.apply(this,A);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=r(e),window.history.replaceState=r(t),n.__obi_history_patched=!0}function w4(n){if(document.querySelector("obi-widget"))return;b4();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),r=document.createElement("div");r.id="obi-container",t.appendChild(r);const i=new CSSStyleSheet;i.replaceSync(h4),t.adoptedStyleSheets=[i],gQ(C(g4,{sdk:n,shadowHost:e}),r),console.log("[obi-sdk] widget mounted")}function b4(){JC("https://fonts.cdnfonts.com/css/satoshi"),JC("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function JC(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const zC="49206C6F7665204F6269_session",XC="obi-url-params";class B4 extends Gc{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,r)=>{var i,A,s,o,a;switch(t){case"update":this.updateConfig(r);break;case"startSession":if(!(r!=null&&r.planUuid)){console.warn("[obi] startSession command requires a planUuid",r);return}const c=(((i=this.client)==null?void 0:i.plans)||[]).find(u=>u.uuid===r.planUuid)||null;if(!c){console.warn("[obi] startSession command requires a valid planUuid",r);return}this.updateActive(!0),(s=(A=this.client)==null?void 0:A.selectPlan)==null||s.call(A,c);break;case"stopSession":(a=(o=this.client)==null?void 0:o.stopSession)==null||a.call(o);break;case"say":this.say(r);break;default:console.warn("[obi] unknown command",{commandType:t,args:r})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const r=this.load();if(r)try{t=fa.deserialise(r,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(i){console.error("[obi] error loading cached client",i)}t||(t=new fa(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",i=>{var A,s,o;i==="ready"&&this.updateConfig({isActive:(A=this.client)==null?void 0:A.showWidget,primaryColour:((o=(s=this.client)==null?void 0:s.product)==null?void 0:o.primary_color)||"#9500FF"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",i=>{i==="invalid-room"&&localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(i,A)=>{Se().track(i,A)}),this.client.session&&this.client.resumeSession(i=>{i.on("stateChanged",A=>{A!=="disconnecting"&&A!=="disconnected"&&A!=="error"&&A!=="connecting"&&this.save()}),i.on("paused",()=>{this.save()}),i.on("unpaused",()=>{this.save()})})}async initialise(e={}){this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(t=>{console.error("[obi] error initialising client",t),this.emit("error",t)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(r=>{console.error("[obi] error initialising client",r),this.emit("error",r)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}async updateIdentity(e){var r;if(e===void 0||e==((r=this.client)==null?void 0:r.identity))return;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}),e!=null&&e.email&&Se().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,r,i;await((i=(r=(t=this.client)==null?void 0:t.session)==null?void 0:r.say)==null?void 0:i.call(r,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(r){console.error("[obi] error dispatching command",r)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(XC)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((A,s)=>{e[s]=A});const t=e[zC];if(!t)return null;const r=new URL(window.location.href);r.searchParams.delete(zC),window.history.replaceState({},"",r.toString()),r.toString(),localStorage.removeItem(XC),this.passivePlanUuid=t}mountWidget(){w4(this)}async captureScreen(){return(await BT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}save(){var e;localStorage.setItem("obi-client",((e=this.client)==null?void 0:e.serialise())||"")}load(){return localStorage.getItem("obi-client")}}async function YC(n){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return C4({appToken:n,window:e})}async function C4({appToken:n,window:e}){var i,A;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}n||(n=(i=e==null?void 0:e.obiWidgetConfig)==null?void 0:i.apiKey);let t;try{t=((A=e.ObiSDK)==null?void 0:A.q)||[]}catch{t=[]}const r=new B4(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:t}),e.obi=r,r.mountWidget(),r}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{YC()}):YC()})();
|