@molin.ai/shop-ai 0.4.10 → 0.4.11
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.
|
@@ -410,8 +410,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
410
410
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,a=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{a||r.return==null||r.return()}finally{if(o)throw s}}}}var Tt={DEBUG:!1,LIB_VERSION:"1.81.2"},Lp=Array.prototype,Bp=Object.prototype,Rl=Bp.toString,Ig=Bp.hasOwnProperty,q=typeof window<"u"?window:{},Kr=q.navigator||{userAgent:""},Me=q.document||{},Lt=Kr.userAgent,Mg=["localhost","127.0.0.1"],op=Lp.forEach,lp=Lp.indexOf,Dg=Array.isArray,Ll={},me={log:function(){if(Tt.DEBUG&&!Ct(window.console)&&window.console){for(var t=("__rrweb_original__"in window.console.log)?window.console.log.__rrweb_original__:window.console.log,e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];try{t.apply(window.console,r)}catch{nr(r,function(s){t(s)})}}},error:function(){if(Tt.DEBUG&&!Ct(window.console)&&window.console){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=["PostHog error:"].concat(e),n="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{n.apply(window.console,i)}catch{nr(i,function(a){n(a)})}}},critical:function(){if(!Ct(window.console)&&window.console){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=["PostHog error:"].concat(e),n="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{n.apply(window.console,i)}catch{nr(i,function(a){n(a)})}}},unintializedWarning:function(t){Tt.DEBUG&&!Ct(window.console)&&window.console&&me.error("[PostHog] You must initialize PostHog before calling ".concat(t))}},wl=function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function nr(t,e,r){if(Array.isArray(t)){if(op&&t.forEach===op)t.forEach(e,r);else if("length"in t&&t.length===+t.length){for(var i=0,n=t.length;i<n;i++)if(i in t&&e.call(r,t[i],i)===Ll)return}}}function Ee(t,e,r){if(t!=null){if(Array.isArray(t))return nr(t,e,r);for(var i in t)if(Ig.call(t,i)&&e.call(r,t[i],i)===Ll)return}}var Xe=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return nr(r,function(n){for(var s in n)n[s]!==void 0&&(t[s]=n[s])}),t},ir=Dg||function(t){return Rl.call(t)==="[object Array]"},Vp=function(t){try{return/^\s*\bfunction\b/.test(t)}catch{return!1}};function Se(t,e){return t.indexOf(e)!==-1}var xl=function(t){return t===Object(t)&&!ir(t)},Ct=function(t){return t===void 0},Np=function(t){return Rl.call(t)=="[object String]"},Fg=function(t){return Rl.call(t)=="[object Number]"},zp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},jp=function(t){return function(){try{for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return t.apply(this,r)}catch(n){me.critical("Implementation error. Please turn on debug and contact support@posthog.com."),me.critical(n)}}},Sl=function(t){var e={};return Ee(t,function(r,i){Np(r)&&r.length>0&&(e[i]=r)}),e},Og=["$performance_raw"];function $g(t,e){return r=t,i=function(s,a){return a&&Og.indexOf(a)>-1?s:typeof s=="string"&&e!==null?s.slice(0,e):s},n=new Set,function s(a,o){return a!==Object(a)?i?i(a,o):a:n.has(a)?void 0:(n.add(a),ir(a)?(l=[],nr(a,function(h){l.push(s(h))})):(l={},Ee(a,function(h,c){n.has(h)||(l[c]=s(h,c))})),l);var l}(r);var r,i,n}function Bl(t){var e,r,i,n,s,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,l=0,h="",c=[];if(!t)return t;t=Rg(t);do e=(s=t.charCodeAt(o++)<<16|t.charCodeAt(o++)<<8|t.charCodeAt(o++))>>18&63,r=s>>12&63,i=s>>6&63,n=63&s,c[l++]=a.charAt(e)+a.charAt(r)+a.charAt(i)+a.charAt(n);while(o<t.length);switch(h=c.join(""),t.length%3){case 1:h=h.slice(0,-2)+"==";break;case 2:h=h.slice(0,-1)+"="}return h}var Rg=function(t){var e,r,i,n,s="";for(e=r=0,i=(t=(t+"").replace(/\r\n/g,`
|
|
411
411
|
`).replace(/\r/g,`
|
|
412
412
|
`)).length,n=0;n<i;n++){var a=t.charCodeAt(n),o=null;a<128?r++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),o!==null&&(r>e&&(s+=t.substring(e,r)),s+=o,e=r=n+1)}return r>e&&(s+=t.substring(e,t.length)),s},Lg=["ahrefsbot","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","duckduckbot","facebookexternal","facebookcatalog","gptbot","hubspot","linkedinbot","mj12bot","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","twitterbot","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"],Bg=function(t,e){return Lg.concat(e).some(function(r){return t.includes?t.includes(r):t.indexOf(r)!==-1})},hp=function(t,e){var r=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]"),i=new RegExp("[\\?&]"+r+"=([^&#]*)").exec(t);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var n=i[1];try{n=decodeURIComponent(n)}catch{me.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")},cp=function(t,e){var r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},Dn=function(){function t(e){return e&&(e.preventDefault=t.preventDefault,e.stopPropagation=t.stopPropagation),e}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},function(e,r,i,n,s){if(e)if(e.addEventListener&&!n)e.addEventListener(r,i,!!s);else{var a="on"+r,o=e[a];e[a]=function(l,h,c){return function(u){if(u=u||t(window.event)){var f,p=!0;Vp(c)&&(f=c(u));var m=h.call(l,u);return f!==!1&&m!==!1||(p=!1),p}}}(e,i,o)}else me.error("No valid element provided to register_event")}}();function ma(t,e){var r=function(){var i=Me.createElement("script");i.type="text/javascript",i.src=t,i.onload=function(a){return e(void 0,a)},i.onerror=function(a){return e(a)};var n,s=Me.querySelectorAll("body > script");s.length>0?(n=s[0].parentNode)===null||n===void 0||n.insertBefore(i,s[0]):Me.body.appendChild(i)};Me.body?r():Me.addEventListener("DOMContentLoaded",r)}var Ge={campaignParams:function(t){var e=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","fbclid","msclkid"].concat(t||[]),r={};return Ee(e,function(i){var n=hp(Me.URL,i);n.length&&(r[i]=n)}),r},searchEngine:function(){var t=Me.referrer;return t?t.search("https?://(.*)google.([^/?]*)")===0?"google":t.search("https?://(.*)bing.com")===0?"bing":t.search("https?://(.*)yahoo.com")===0?"yahoo":t.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null},searchInfo:function(){var t=Ge.searchEngine(),e=t!="yahoo"?"q":"p",r={};if(t!==null){r.$search_engine=t;var i=hp(Me.referrer,e);i.length&&(r.ph_keyword=i)}return r},browser:function(t,e,r){return e=e||"",r||Se(t," OPR/")?Se(t,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":Se(t,"IEMobile")||Se(t,"WPDesktop")?"Internet Explorer Mobile":Se(t,"SamsungBrowser/")?"Samsung Internet":Se(t,"Edge")||Se(t,"Edg/")?"Microsoft Edge":Se(t,"FBIOS")?"Facebook Mobile":Se(t,"Chrome")?"Chrome":Se(t,"CriOS")?"Chrome iOS":Se(t,"UCWEB")||Se(t,"UCBrowser")?"UC Browser":Se(t,"FxiOS")?"Firefox iOS":Se(e,"Apple")?Se(t,"Mobile")?"Mobile Safari":"Safari":Se(t,"Android")?"Android Mobile":Se(t,"Konqueror")?"Konqueror":Se(t,"Firefox")?"Firefox":Se(t,"MSIE")||Se(t,"Trident/")?"Internet Explorer":Se(t,"Gecko")?"Mozilla":""},browserVersion:function(t,e,r){var 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+)?)/}[Ge.browser(t,e,r)];if(i===void 0)return null;var n=t.match(i);return n?parseFloat(n[n.length-2]):null},browserLanguage:function(){return Kr.language||Kr.userLanguage},os:function(t){if(/Windows/i.test(t)){if(/Phone/.test(t)||/WPDesktop/.test(t))return{os_name:"Windows Phone",os_version:""};var e=/Windows NT ([0-9.]+)/i.exec(t);return e&&e[1]?{os_name:"Windows",os_version:e[1]}:{os_name:"Windows",os_version:""}}if(/(iPhone|iPad|iPod)/.test(t)){var r=/OS (\d+)_(\d+)_?(\d+)?/i.exec(t);return r&&r[1]?{os_name:"iOS",os_version:[r[1],r[2],r[3]||"0"].join(".")}:{os_name:"iOS",os_version:""}}if(/Android/.test(t)){var i=/Android (\d+)\.(\d+)\.?(\d+)?/i.exec(t);return i&&i[1]?{os_name:"Android",os_version:[i[1],i[2],i[3]||"0"].join(".")}:{os_name:"Android",os_version:""}}if(/(BlackBerry|PlayBook|BB10)/i.test(t))return{os_name:"BlackBerry",os_version:""};if(/Mac/i.test(t)){var n=/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i.exec(t);return n&&n[1]?{os_name:"Mac OS X",os_version:[n[1],n[2],n[3]||"0"].join(".")}:{os_name:"Mac OS X",os_version:""}}return/Linux/.test(t)?{os_name:"Linux",os_version:""}:/CrOS/.test(t)?{os_name:"Chrome OS",os_version:""}:{os_name:"",os_version:""}},device:function(t){return/Windows Phone/i.test(t)||/WPDesktop/.test(t)?"Windows Phone":/iPad/.test(t)?"iPad":/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":/Android/.test(t)&&!/Mobile/.test(t)?"Android Tablet":/Android/.test(t)?"Android":""},deviceType:function(t){var e=this.device(t);return e==="iPad"||e==="Android Tablet"?"Tablet":e?"Mobile":"Desktop"},referrer:function(){return Me.referrer||"$direct"},referringDomain:function(){if(!Me.referrer)return"$direct";var t=Me.createElement("a");return t.href=Me.referrer,t.host},properties:function(){var t=Ge.os(Lt),e=t.os_name,r=t.os_version;return Xe(Sl({$os:e,$os_version:r,$browser:Ge.browser(Lt,Kr.vendor,q.opera),$device:Ge.device(Lt),$device_type:Ge.deviceType(Lt)}),{$current_url:q?.location.href,$host:q?.location.host,$pathname:q?.location.pathname,$browser_version:Ge.browserVersion(Lt,Kr.vendor,q.opera),$browser_language:Ge.browserLanguage(),$screen_height:q?.screen.height,$screen_width:q?.screen.width,$viewport_height:q?.innerHeight,$viewport_width:q?.innerWidth,$lib:"web",$lib_version:Tt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:zp()/1e3})},people_properties:function(){var t=Ge.os(Lt),e=t.os_name,r=t.os_version;return Xe(Sl({$os:e,$os_version:r,$browser:Ge.browser(Lt,Kr.vendor,q.opera)}),{$browser_version:Ge.browserVersion(Lt,Kr.vendor,q.opera)})}};function ga(t){switch(xr(t.className)){case"string":return t.className;case"object":return("baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";default:return""}}function ya(t){var e="";return la(t)&&!Gp(t)&&t.childNodes&&t.childNodes.length&&Ee(t.childNodes,function(r){Hp(r)&&r.textContent&&(e+=wl(r.textContent).split(/(\s+)/).filter(ji).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),wl(e)}function up(t){return!!t&&t.nodeType===1}function ti(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Hp(t){return!!t&&t.nodeType===3}function pp(t){return!!t&&t.nodeType===11}var cl=["a","button","form","input","select","textarea","label"];function la(t){for(var e=t;e.parentNode&&!ti(e,"body");e=e.parentNode){var r=ga(e).split(" ");if(Se(r,"ph-sensitive")||Se(r,"ph-no-capture"))return!1}if(Se(ga(t).split(" "),"ph-include"))return!0;var i=t.type||"";if(typeof i=="string")switch(i.toLowerCase()){case"hidden":case"password":return!1}var n=t.name||t.id||"";return!(typeof n=="string"&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))}function Gp(t){return!!(ti(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ti(t,"select")||ti(t,"textarea")||t.getAttribute("contenteditable")==="true")}function ji(t){return!(t===null||Ct(t)||typeof t=="string"&&(t=wl(t),/^(?:(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}))$/.test((t||"").replace(/[- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(t)))}function dp(t){var e=ya(t);return ji(e="".concat(e," ").concat(qp(t)).trim())?e:""}function qp(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Ee(t.childNodes,function(r){var i;if(r&&((i=r.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{var n=ya(r);e="".concat(e," ").concat(n).trim(),r.childNodes&&r.childNodes.length&&(e="".concat(e," ").concat(qp(r)).trim())}catch(s){console.error(s)}}),e}var Vg=function(){function t(e){De(this,t),this.clicks=[],this.enabled=e}return Fe(t,[{key:"isRageClick",value:function(e,r,i){if(!this.enabled)return!1;var n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(r-n.y)<30&&i-n.timestamp<1e3){if(this.clicks.push({x:e,y:r,timestamp:i}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:r,timestamp:i}];return!1}}]),t}(),Up="$people_distinct_id",ha="__alias",Mn="__timers",fp="$autocapture_disabled_server_side",El="$session_recording_enabled_server_side",mp="$console_log_recording_enabled_server_side",gp="$session_recording_recorder_version_server_side",va="$sesid",Hi="$enabled_feature_flags",kl="$early_access_features",Gi="$stored_person_properties",_r="$stored_group_properties",Pl="$surveys",ba="$flag_call_reported",Al="$user_state",Cl="$posthog_quota_limited",Ng=[Up,ha,"__cmpns",Mn,El,va,Hi,Al,Cl,kl,_r,Gi,Pl,ba];function ul(t,e){return e.length>t?e.slice(0,t)+"...":e}var wr={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(t){var e,r=this._isDisabledServerSide===null?!((e=t.persistence)===null||e===void 0||!e.props[fp]):this._isDisabledServerSide,i=!!t.config.autocapture;this._isAutocaptureEnabled=i&&!r},_previousElementSibling:function(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!up(e));return e},_getAugmentPropertiesFromElement:function(t){if(!la(t))return{};var e={};return Ee(t.attributes,function(r){if(r.name.indexOf("data-ph-capture-attribute")===0){var i=r.name.replace("data-ph-capture-attribute-",""),n=r.value;i&&n&&ji(n)&&(e[i]=n)}}),e},_getPropertiesFromElement:function(t,e,r){var i,n=t.tagName.toLowerCase(),s={tag_name:n};cl.indexOf(n)>-1&&!r&&(n.toLowerCase()==="a"||n.toLowerCase()==="button"?s.$el_text=ul(1024,dp(t)):s.$el_text=ul(1024,ya(t)));var a=ga(t);a.length>0&&(s.classes=a.split(" ").filter(function(u){return u!==""}));var o=(i=this.config)===null||i===void 0?void 0:i.element_attribute_ignorelist;Ee(t.attributes,function(u){var f;Gp(t)&&["name","id","class"].indexOf(u.name)===-1||o!=null&&o.includes(u.name)||!e&&ji(u.value)&&(typeof(f=u.name)!="string"||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")&&(s["attr__"+u.name]=ul(1024,u.value))});for(var l=1,h=1,c=t;c=this._previousElementSibling(c);)l++,c.tagName===t.tagName&&h++;return s.nth_child=l,s.nth_of_type=h,s},_getDefaultProperties:function(t){return{$event_type:t,$ce_version:1}},_extractCustomPropertyValue:function(t){var e=[];return Ee(document.querySelectorAll(t.css_selector),function(r){var i;["input","select"].indexOf(r.tagName.toLowerCase())>-1?i=r.value:r.textContent&&(i=r.textContent),ji(i)&&e.push(i)}),e.join(", ")},_getCustomProperties:function(t){var e=this,r={};return Ee(this._customProperties,function(i){Ee(i.event_selectors,function(n){Ee(document.querySelectorAll(n),function(s){Se(t,s)&&la(s)&&(r[i.name]=e._extractCustomPropertyValue(i))})})}),r},_getEventTarget:function(t){return t.target===void 0?t.srcElement||null:(e=t.target)!==null&&e!==void 0&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e},_captureEvent:function(t,e){var r,i=this,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"$autocapture",s=this._getEventTarget(t);if(Hp(s)&&(s=s.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,e,"$rageclick"),s&&function(g,d){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!g||ti(g,"html")||!up(g))return!1;if(y!=null&&y.url_allowlist){var v=window.location.href,b=y.url_allowlist;if(b&&!b.some(function(k){return v.match(k)}))return!1}if(y!=null&&y.dom_event_allowlist){var _=y.dom_event_allowlist;if(_&&!_.some(function(k){return d.type===k}))return!1}if(y!=null&&y.element_allowlist){var x=y.element_allowlist;if(x&&!x.some(function(k){return g.tagName.toLowerCase()===k}))return!1}if(y!=null&&y.css_selector_allowlist){var T=y.css_selector_allowlist;if(T&&!T.some(function(k){return g.matches(k)}))return!1}for(var S=!1,w=[g],M=!0,E=g;E.parentNode&&!ti(E,"body");)if(pp(E.parentNode))w.push(E.parentNode.host),E=E.parentNode.host;else{if(!(M=E.parentNode||!1))break;if(cl.indexOf(M.tagName.toLowerCase())>-1)S=!0;else{var I=window.getComputedStyle(M);I&&I.getPropertyValue("cursor")==="pointer"&&(S=!0)}w.push(M),E=M}var P=window.getComputedStyle(g);if(P&&P.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0;var A=g.tagName.toLowerCase();switch(A){case"html":return!1;case"form":return d.type==="submit";case"input":case"select":case"textarea":return d.type==="change"||d.type==="click";default:return S?d.type==="click":d.type==="click"&&(cl.indexOf(A)>-1||g.getAttribute("contenteditable")==="true")}}(s,t,this.config)){for(var a,o,l=[s],h=s;h.parentNode&&!ti(h,"body");)pp(h.parentNode)?(l.push(h.parentNode.host),h=h.parentNode.host):(l.push(h.parentNode),h=h.parentNode);var c,u=[],f={},p=!1;if(Ee(l,function(g){var d=la(g);g.tagName.toLowerCase()==="a"&&(c=g.getAttribute("href"),c=d&&ji(c)&&c),Se(ga(g).split(" "),"ph-no-capture")&&(p=!0),u.push(i._getPropertiesFromElement(g,e.config.mask_all_element_attributes,e.config.mask_all_text));var y=i._getAugmentPropertiesFromElement(g);Xe(f,y)}),e.config.mask_all_text||(s.tagName.toLowerCase()==="a"||s.tagName.toLowerCase()==="button"?u[0].$el_text=dp(s):u[0].$el_text=ya(s)),c&&(u[0].attr__href=c),p)return!1;var m=Xe(this._getDefaultProperties(t.type),{$elements:u},(a=u[0])!==null&&a!==void 0&&a.$el_text?{$el_text:(o=u[0])===null||o===void 0?void 0:o.$el_text}:{},this._getCustomProperties(l),f);return e.capture(n,m),!0}},_navigate:function(t){window.location.href=t},_addDomEventHandlers:function(t){var e=this,r=function(i){i=i||window.event,e._captureEvent(i,t)};Dn(document,"submit",r,!1,!0),Dn(document,"change",r,!1,!0),Dn(document,"click",r,!1,!0)},_customProperties:[],rageclicks:null,config:void 0,init:function(t){var e;typeof t.__autocapture!="boolean"&&(this.config=t.__autocapture),(e=this.config)!==null&&e!==void 0&&e.url_allowlist&&(this.config.url_allowlist=this.config.url_allowlist.map(function(r){return new RegExp(r)})),this.rageclicks=new Vg(t.config.rageclick)},afterDecideResponse:function(t,e){var r=e.config.token;this._initializedTokens.indexOf(r)>-1?me.log('autocapture already initialized for token "'+r+'"'):(e.persistence&&e.persistence.register(Y({},fp,!!t.autocapture_opt_out)),this._isDisabledServerSide=!!t.autocapture_opt_out,this._setIsAutocaptureEnabled(e),this._initializedTokens.push(r),t&&t.config&&t.config.enable_collect_everything&&this._isAutocaptureEnabled?(t.custom_properties&&(this._customProperties=t.custom_properties),this._addDomEventHandlers(e)):e.__autocapture=!1)},enabledForProject:function(t,e,r){if(!t)return!0;e=Ct(e)?10:e,r=Ct(r)?10:r;for(var i=0,n=0;n<t.length;n++)i+=t.charCodeAt(n);return i%e<r},isBrowserSupported:function(){return Vp(document.querySelectorAll)}};(function(t){for(var e in t)typeof t[e]=="function"&&(t[e]=t[e].bind(t))})(wr),function(t){for(var e in t)typeof t[e]=="function"&&(t[e]=jp(t[e]))}(wr);var pl="$active_feature_flags",ia="$override_feature_flags",yp="$feature_flag_payloads",vp=function(t){var e,r={},i=or(function(o){for(var l=Object.keys(o),h=l.length,c=new Array(h);h--;)c[h]=[l[h],o[l[h]]];return c}(t||{}));try{for(i.s();!(e=i.n()).done;){var n=ar(e.value,2),s=n[0],a=n[1];a&&(r[s]=a)}}catch(o){i.e(o)}finally{i.f()}return r},zg=function(){function t(e){De(this,t),this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return Fe(t,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(Hi),r=this.instance.get_property(ia);if(!r)return e||{};for(var i=Xe({},e),n=Object.keys(r),s=0;s<n.length;s++)r[n[s]]===!1?delete i[n[s]]:i[n[s]]=r[n[s]];return this._override_warning||(console.warn("[PostHog] Overriding feature flags!",{enabledFlags:e,overriddenFlags:r,finalFlags:i}),this._override_warning=!0),i}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(yp)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.reloadFeatureFlagsInAction=e}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var e=this;this.setReloadingPaused(!0);var r=this.instance.config.token,i=this.instance.get_property(Gi),n=this.instance.get_property(_r),s=Bl(JSON.stringify({token:r,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i,group_properties:n,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0}));this.instance._send_request(this.instance.config.api_host+"/decide/?v=3",{data:s},{method:"POST"},this.instance._prepare_callback(function(a){e.$anon_distinct_id=void 0,e.receivedFeatureFlags(a),e.setReloadingPaused(!1),e._startReloadTimer()}))}},{key:"getFeatureFlag",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var i,n=this.getFlagVariants()[e],s="".concat(n),a=this.instance.get_property(ba)||{};return(r.send_event||!("send_event"in r))&&(!(e in a)||!a[e].includes(s))&&(Array.isArray(a[e])?a[e].push(s):a[e]=[s],(i=this.instance.persistence)===null||i===void 0||i.register(Y({},ba,a)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:n})),n}console.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}},{key:"getFeatureFlagPayload",value:function(e){return this.getFlagPayloads()[e]}},{key:"isFeatureEnabled",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,r);console.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(r){return r!==e})}},{key:"receivedFeatureFlags",value:function(e){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads();(function(n,s){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=n.featureFlags,h=n.featureFlagPayloads;if(l)if(Array.isArray(l)){var c,u={};if(l)for(var f=0;f<l.length;f++)u[l[f]]=!0;s&&s.register((Y(c={},pl,l),Y(c,Hi,u),c))}else{var p,m=l,g=h;n.errorsWhileComputingFlags&&(m=ie(ie({},a),m),g=ie(ie({},o),g)),s&&s.register((Y(p={},pl,Object.keys(vp(m))),Y(p,Hi,m||{}),Y(p,yp,g||{}),p))}})(e,this.instance.persistence,r,i),this._fireFeatureFlagsCallbacks()}}},{key:"override",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return me.unintializedWarning("posthog.feature_flags.override");if(this._override_warning=!1,e===!1)this.instance.persistence.unregister(ia);else if(Array.isArray(e)){for(var r={},i=0;i<e.length;i++)r[e[i]]=!0;this.instance.persistence.register(Y({},ia,r))}else this.instance.persistence.register(Y({},ia,e))}},{key:"onFeatureFlags",value:function(e){var r=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var i=this._prepareFeatureFlagsForCallbacks(),n=i.flags,s=i.flagVariants;e(n,s)}return function(){return r.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,r){var i,n,s=Y({},"$feature_enrollment/".concat(e),r);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:r,$set:s}),this.setPersonPropertiesForFlags(s,!1);var a=ie(ie({},this.getFlagVariants()),{},Y({},e,r));(i=this.instance.persistence)===null||i===void 0||i.register((Y(n={},pl,Object.keys(vp(a))),Y(n,Hi,a),n)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var r=this,i=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=this.instance.get_property(kl);if(n&&!i)return e(n);this.instance._send_request("".concat(this.instance.config.api_host,"/api/early_access_features/?token=").concat(this.instance.config.token),{},{method:"GET"},function(s){var a,o=s.earlyAccessFeatures;return(a=r.instance.persistence)===null||a===void 0||a.register(Y({},kl,o)),e(o)})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var e=this.getFlags(),r=this.getFlagVariants();return{flags:e.filter(function(i){return r[i]}),flagVariants:Object.keys(r).filter(function(i){return r[i]}).reduce(function(i,n){return i[n]=r[n],i},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(){var e=this._prepareFeatureFlagsForCallbacks(),r=e.flags,i=e.flagVariants;this.featureFlagEventHandlers.forEach(function(n){return n(r,i)})}},{key:"setPersonPropertiesForFlags",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],i=this.instance.get_property(Gi)||{};this.instance.register(Y({},Gi,ie(ie({},i),e))),r&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Gi)}},{key:"setGroupPropertiesForFlags",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],i=this.instance.get_property(_r)||{};Object.keys(i).length!==0&&Object.keys(i).forEach(function(n){i[n]=ie(ie({},i[n]),e[n]),delete e[n]}),this.instance.register(Y({},_r,ie(ie({},i),e))),r&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var r=this.instance.get_property(_r)||{};this.instance.register(Y({},_r,ie(ie({},r),{},Y({},e,{}))))}else this.instance.unregister(_r)}}]),t}(),jg=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,sr={is_supported:function(){return!0},error:function(t){me.error("cookieStore error: "+t)},get:function(t){try{for(var e=t+"=",r=document.cookie.split(";").filter(function(s){return s.length}),i=0;i<r.length;i++){for(var n=r[i];n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(e)===0)return decodeURIComponent(n.substring(e.length,n.length))}}catch{}return null},parse:function(t){var e;try{e=JSON.parse(sr.get(t))||{}}catch{}return e},set:function(t,e,r,i,n){try{var s="",a="",o="";if(i){var l=document.location.hostname.match(jg),h=l?l[0]:"";s=h?"; domain=."+h:""}if(r){var c=new Date;c.setTime(c.getTime()+24*r*60*60*1e3),a="; expires="+c.toUTCString()}n&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+a+"; SameSite=Lax; path=/"+s+o;return document.cookie=u,u}catch{return}},remove:function(t,e){try{sr.set(t,"",-1,e)}catch{return}}},dl=null,Oe={is_supported:function(){if(dl!==null)return dl;var t=!0;if(typeof window<"u")try{var e="__mplssupport__";Oe.set(e,"xyz"),Oe.get(e)!=='"xyz"'&&(t=!1),Oe.remove(e)}catch{t=!1}else t=!1;return t||me.error("localStorage unsupported; falling back to cookie store"),dl=t,t},error:function(t){me.error("localStorage error: "+t)},get:function(t){try{return window.localStorage.getItem(t)}catch(e){Oe.error(e)}return null},parse:function(t){try{return JSON.parse(Oe.get(t))||{}}catch{}return null},set:function(t,e){try{window.localStorage.setItem(t,JSON.stringify(e))}catch(r){Oe.error(r)}},remove:function(t){try{window.localStorage.removeItem(t)}catch(e){Oe.error(e)}}},Hg=["distinct_id",va],Tl=ie(ie({},Oe),{},{parse:function(t){try{var e={};try{e=sr.parse(t)||{}}catch{}var r=Xe(e,JSON.parse(Oe.get(t)||"{}"));return Oe.set(t,r),r}catch{}return null},set:function(t,e,r,i,n){try{Oe.set(t,e);var s={};Hg.forEach(function(a){e[a]&&(s[a]=e[a])}),Object.keys(s).length&&sr.set(t,s,r,i,n)}catch(a){Oe.error(a)}},remove:function(t,e){try{window.localStorage.removeItem(t),sr.remove(t,e)}catch(r){Oe.error(r)}}}),na={},Gg={is_supported:function(){return!0},error:function(t){me.error("memoryStorage error: "+t)},get:function(t){return na[t]||null},parse:function(t){return na[t]||null},set:function(t,e){na[t]=e},remove:function(t){delete na[t]}},Xr=null,Ue={is_supported:function(){if(Xr!==null)return Xr;if(Xr=!0,typeof window<"u")try{var t="__support__";Ue.set(t,"xyz"),Ue.get(t)!=='"xyz"'&&(Xr=!1),Ue.remove(t)}catch{Xr=!1}else Xr=!1;return Xr},error:function(t){Tt.DEBUG&&me.error("sessionStorage error: ",t)},get:function(t){try{return window.sessionStorage.getItem(t)}catch(e){Ue.error(e)}return null},parse:function(t){try{return JSON.parse(Ue.get(t))||null}catch{}return null},set:function(t,e){try{window.sessionStorage.setItem(t,JSON.stringify(e))}catch(r){Ue.error(r)}},remove:function(t){try{window.sessionStorage.removeItem(t)}catch(e){Ue.error(e)}}},qg=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],bp=function(){function t(e){De(this,t);var r="";e.token&&(r=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,this.custom_campaign_params=e.custom_campaign_params||[],e.persistence_name?this.name="ph_"+e.persistence_name:this.name="ph_"+r+"_posthog",qg.indexOf(e.persistence.toLowerCase())===-1&&(me.critical("Unknown persistence type "+e.persistence+"; falling back to cookie"),e.persistence="cookie");var i=e.persistence.toLowerCase();i==="localstorage"&&Oe.is_supported()?this.storage=Oe:i==="localstorage+cookie"&&Tl.is_supported()?this.storage=Tl:i==="sessionstorage"&&Ue.is_supported()?this.storage=Ue:this.storage=i==="memory"?Gg:sr,this.user_state="anonymous",this.load(),this.update_config(e),this.save()}return Fe(t,[{key:"properties",value:function(){var e={};return Ee(this.props,function(r,i){if(i===Hi&&xr(r)==="object")for(var n=Object.keys(r),s=0;s<n.length;s++)e["$feature/".concat(n[s])]=r[n[s]];else o=i,l=!1,((a=Ng)===null?l:lp&&a.indexOf===lp?a.indexOf(o)!=-1:(Ee(a,function(h){if(l||(l=h===o))return Ll}),l))||(e[i]=r);var a,o,l}),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Xe({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,r,i){var n=this;if(xl(e)){r===void 0&&(r="None"),this.expire_days=i===void 0?this.default_expiry:i;var s=!1;if(Ee(e,function(a,o){n.props.hasOwnProperty(o)&&n.props[o]!==r||(n.props[o]=a,s=!0)}),s)return this.save(),!0}return!1}},{key:"register",value:function(e,r){var i=this;if(xl(e)){this.expire_days=r===void 0?this.default_expiry:r;var n=!1;if(Ee(e,function(s,a){e.hasOwnProperty(a)&&i.props[a]!==s&&(i.props[a]=s,n=!0)}),n)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(Ge.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(Ge.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||Ge.referrer(),$referring_domain:this.props.$referring_domain||Ge.referringDomain()})}},{key:"get_referrer_info",value:function(){return Sl({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return Ee(this.props,function(r,i){i in e||(e[i]=r)}),e}},{key:"update_config",value:function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,r){var i=this.props[Mn]||{};i[e]=r,this.props[Mn]=i,this.save()}},{key:"remove_event_timer",value:function(e){var r=(this.props[Mn]||{})[e];return Ct(r)||(delete this.props[Mn][e],this.save()),r}},{key:"get_user_state",value:function(){return this.props[Al]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[Al]=e,this.save()}},{key:"get_quota_limits",value:function(){return this.props[Cl]||{}}},{key:"set_quota_limits",value:function(e){this.props[Cl]=e,this.save()}}]),t}(),Ug="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==",_p=2,Wg=4,Wp=3,Zg=6,Yg=0,Jg=5e6,Xg="rrweb/console@1",Gt,Kg=Fe(function t(e){var r,i,n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};De(this,t),Y(this,"bucketSize",100),Y(this,"refillRate",10),Y(this,"mutationBuckets",{}),Y(this,"loggedTracker",{}),Y(this,"refillBuckets",function(){Object.keys(n.mutationBuckets).forEach(function(a){n.mutationBuckets[a]=n.mutationBuckets[a]+n.refillRate,n.mutationBuckets[a]>=n.bucketSize&&delete n.mutationBuckets[a]})}),Y(this,"getNodeOrRelevantParent",function(a){var o=n.rrweb.mirror.getNode(a);if(o?.nodeName!=="svg"&&o instanceof Element){var l=o.closest("svg");if(l)return[n.rrweb.mirror.getId(l),l]}return[a,o]}),Y(this,"numberOfChanges",function(a){var o,l,h,c,u,f,p,m;return((o=(l=a.removes)===null||l===void 0?void 0:l.length)!==null&&o!==void 0?o:0)+((h=(c=a.attributes)===null||c===void 0?void 0:c.length)!==null&&h!==void 0?h:0)+((u=(f=a.texts)===null||f===void 0?void 0:f.length)!==null&&u!==void 0?u:0)+((p=(m=a.adds)===null||m===void 0?void 0:m.length)!==null&&p!==void 0?p:0)}),Y(this,"throttleMutations",function(a){if(a.type!==Wp||a.data.source!==Yg)return a;var o=a.data,l=n.numberOfChanges(o);o.attributes&&(o.attributes=o.attributes.filter(function(c){var u,f,p,m=ar(n.getNodeOrRelevantParent(c.id),2),g=m[0],d=m[1];return n.mutationBuckets[g]===0?!1:(n.mutationBuckets[g]=(u=n.mutationBuckets[g])!==null&&u!==void 0?u:n.bucketSize,n.mutationBuckets[g]=Math.max(n.mutationBuckets[g]-1,0),n.mutationBuckets[g]===0&&(n.loggedTracker[g]||(n.loggedTracker[g]=!0,(f=(p=n.options).onBlockedNode)===null||f===void 0||f.call(p,g,d))),c)}));var h=n.numberOfChanges(o);return h!==0||l===h?a:void 0}),this.rrweb=e,this.options=s,this.refillRate=(r=this.options.refillRate)!==null&&r!==void 0?r:this.refillRate,this.bucketSize=(i=this.options.bucketSize)!==null&&i!==void 0?i:this.bucketSize,setInterval(function(){n.refillBuckets()},1e3)}),Zp=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}(Zp||{}),Qg="/s/";(function(t){t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet"})(Gt||(Gt={}));var e0=[Gt.MouseMove,Gt.MouseInteraction,Gt.Scroll,Gt.ViewportResize,Gt.Input,Gt.TouchMove,Gt.MediaInteraction,Gt.Drag],t0=function(){function t(e){var r=this;De(this,t),Y(this,"lastActivityTimestamp",Date.now()),Y(this,"isIdle",!1),this.instance=e,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=Qg,this.stopRrweb=void 0,this.windowId=null,this.sessionId=null,this.receivedDecide=!1,window.addEventListener("beforeunload",function(){r._flushBuffer()})}return Fe(t,[{key:"getSessionManager",value:function(){if(this.instance.sessionManager)return this.instance.sessionManager;me.error("Session recording started without valid sessionManager")}},{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled()?this.startCaptureAndTrySendingQueuedSnapshots():this.stopRecording()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this.captureStarted=!1)}},{key:"isRecordingEnabled",value:function(){var e=!!this.instance.get_property(El),r=!this.instance.config.disable_session_recording;return e&&r}},{key:"isConsoleLogCaptureEnabled",value:function(){var e=!!this.instance.get_property(mp),r=this.instance.config.enable_recording_console_log;return r??e}},{key:"getRecordingVersion",value:function(){var e,r=this.instance.get_property(gp);return((e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recorderVersion)||r||"v1"}},{key:"afterDecideResponse",value:function(e){var r,i,n,s,a,o;this.receivedDecide=!0,this.instance.persistence&&this.instance.persistence.register((Y(a={},El,!!e.sessionRecording),Y(a,mp,(n=e.sessionRecording)===null||n===void 0?void 0:n.consoleLogRecordingEnabled),Y(a,gp,(s=e.sessionRecording)===null||s===void 0?void 0:s.recorderVersion),a)),(r=e.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this.endpoint=(o=e.sessionRecording)===null||o===void 0?void 0:o.endpoint),(i=e.sessionRecording)!==null&&i!==void 0&&i.recorderVersion&&(this.recorderVersion=e.sessionRecording.recorderVersion),this.startRecordingIfEnabled()}},{key:"log",value:function(e){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(r=this.instance.sessionRecording)===null||r===void 0||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(e)]}},timestamp:zp()})}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){var e=this;this.receivedDecide&&(this.emit=!0,this.snapshots.forEach(function(r){return e._captureSnapshotBuffered(r)})),this._startCapture()}},{key:"_startCapture",value:function(){var e=this,r=this.getSessionManager();if(r&&Object.assign!==void 0&&!this.captureStarted&&!this.instance.config.disable_session_recording){this.captureStarted=!0,r.checkAndGetSessionAndWindowId();var i=this.getRecordingVersion()==="v2"?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.getRecordingVersion()?ma(this.instance.config.api_host+"/static/".concat(i,"?v=").concat(Tt.LIB_VERSION),function(n){if(n)return me.error("Could not load ".concat(i),n);e._onScriptLoaded()}):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var r;return e.type===Wp&&e0.indexOf((r=e.data)===null||r===void 0?void 0:r.source)!==-1}},{key:"_updateWindowAndSessionIds",value:function(e){var r=this.getSessionManager();if(r){var i=this._isInteractiveEvent(e);if(i||this.isIdle||e.timestamp-this.lastActivityTimestamp>3e5&&(this.isIdle=!0),i&&(this.lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryTakeFullSnapshot())),!this.isIdle){var n=r.checkAndGetSessionAndWindowId(!i,e.timestamp),s=n.windowId,a=n.sessionId;[_p,Wg].indexOf(e.type)!==-1||this.windowId===s&&this.sessionId===a||this._tryTakeFullSnapshot(),this.windowId=s,this.sessionId=a}}}},{key:"_tryTakeFullSnapshot",value:function(){if(!this.captureStarted)return!1;try{var e;return(e=this.rrwebRecord)===null||e===void 0||e.takeFullSnapshot(),!0}catch(r){return me.error("Error taking full snapshot.",r),!1}}},{key:"_onScriptLoaded",value:function(){var e,r=this,i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1};this.rrwebRecord=window.rrweb?window.rrweb.record:window.rrwebRecord;for(var n=this.instance.config.session_recording,s=0,a=Object.entries(n||{});s<a.length;s++){var o=ar(a[s],2),l=o[0],h=o[1];l in i&&(i[l]=h)}this.rrwebRecord?(this.mutationRateLimiter=(e=this.mutationRateLimiter)!==null&&e!==void 0?e:new Kg(this.rrwebRecord,{onBlockedNode:function(c,u){var f="Too many mutations on node '".concat(c,"'. Rate limiting. This could be due to SVG animations or something similar");me.log(f,{node:u}),r.log("[PostHog Recorder] "+f,"warn")}}),this.stopRrweb=this.rrwebRecord(ie({emit:function(c){r.onRRwebEmit(c)},plugins:window.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled()?[window.rrwebConsoleRecord.getRecordConsolePlugin()]:[]},i)),this.instance._addCaptureHook(function(c){try{if(c==="$pageview"){var u,f=r._maskUrl(window.location.href);if(!f)return;(u=r.rrwebRecord)===null||u===void 0||u.addCustomEvent("$pageview",{href:f})}}catch(p){me.error("Could not add $pageview to rrweb session",p)}}),this.lastActivityTimestamp=Date.now(),this.isIdle=!1):me.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"onRRwebEmit",value:function(e){if(e&&xr(e)==="object"){if(e.type===Zp.Meta){var r=this._maskUrl(e.data.href);if(!r)return;e.data.href=r}var i=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(i){var n=function(l){var h=JSON.stringify(l);if(h.length>Jg){var c,u=or(h.matchAll(/data:([\w/\-.]+);(\w+),([^)"]*)/gim));try{for(u.s();!(c=u.n()).done;){var f=c.value;h=f[1].toLocaleLowerCase().slice(0,6)==="image/"?h.replace(f[0],Ug):h.replace(f[0],"")}}catch(p){u.e(p)}finally{u.f()}}return{event:JSON.parse(h),size:h.length}}(function(l){var h=l;if(h&&xr(h)==="object"&&h.type===Zg&&xr(h.data)==="object"&&h.data.plugin===Xg){h.data.payload.payload.length>10&&(h.data.payload.payload=h.data.payload.payload.slice(0,10),h.data.payload.payload.push("...[truncated]"));for(var c=[],u=0;u<h.data.payload.payload.length;u++)h.data.payload.payload[u]&&h.data.payload.payload[u].length>2e3?c.push(h.data.payload.payload[u].slice(0,2e3)+"...[truncated]"):c.push(h.data.payload.payload[u]);return h.data.payload.payload=c,l}return l}(i)),s=n.event,a=n.size;if(this._updateWindowAndSessionIds(s),!this.isIdle){var o={$snapshot_bytes:a,$snapshot_data:s,$session_id:this.sessionId,$window_id:this.windowId};this.emit?this._captureSnapshotBuffered(o):this.snapshots.push(o)}}}}},{key:"_maskUrl",value:function(e){var r=this.instance.config.session_recording;if(r.maskNetworkRequestFn){var i,n={url:e};return(i=n=r.maskNetworkRequestFn(n))===null||i===void 0?void 0:i.url}return e}},{key:"_flushBuffer",value:function(){return this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0),this.buffer&&this.buffer.data.length!==0&&this._captureSnapshot({$snapshot_bytes:this.buffer.size,$snapshot_data:this.buffer.data,$session_id:this.buffer.sessionId,$window_id:this.buffer.windowId}),this.buffer=void 0,{size:0,data:[],sessionId:this.sessionId,windowId:this.windowId}}},{key:"_captureSnapshotBuffered",value:function(e){var r,i=this,n=2+(((r=this.buffer)===null||r===void 0?void 0:r.data.length)||0);(!this.buffer||this.buffer.size+e.$snapshot_bytes+n>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){i._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_noTruncate:!0,_batchKey:"recordings",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===_p}})}}]),t}(),Ht={entryType:0,timeOrigin:1,name:2,startTime:3,redirectStart:4,redirectEnd:5,workerStart:6,fetchStart:7,domainLookupStart:8,domainLookupEnd:9,connectStart:10,secureConnectionStart:11,connectEnd:12,requestStart:13,responseStart:14,responseEnd:15,decodedBodySize:16,encodedBodySize:17,initiatorType:18,nextHopProtocol:19,renderBlockingStatus:20,responseStatus:21,transferSize:22,element:23,renderTime:24,loadTime:25,size:26,id:27,url:28,domComplete:29,domContentLoadedEvent:30,domInteractive:31,loadEventEnd:32,loadEventStart:33,redirectCount:34,navigationType:35,unloadEventEnd:36,unloadEventStart:37,duration:39,timestamp:40},r0=["first-input","navigation","paint","resource"],i0=["/s/","/e/"],n0=function(){function t(e){De(this,t),Y(this,"_forceAllowLocalhost",!1),this.instance=e}return Fe(t,[{key:"startObservingIfEnabled",value:function(){this.isEnabled()?this.startObserving():this.stopObserving()}},{key:"startObserving",value:function(){var e,r,i=this;if(!this.observer)if(((e=window)===null||e===void 0||(r=e.PerformanceObserver)===null||r===void 0?void 0:r.supportedEntryTypes)!==void 0)if(!Mg.includes(location.hostname)||this._forceAllowLocalhost)try{this.observer=new PerformanceObserver(function(s){s.getEntries().forEach(function(a){i._capturePerformanceEvent(a)})});var n=PerformanceObserver.supportedEntryTypes.filter(function(s){return r0.includes(s)});n.forEach(function(s){var a;(a=i.observer)===null||a===void 0||a.observe({type:s,buffered:!0})})}catch(s){console.error("PostHog failed to start performance observer",s),this.stopObserving()}else me.log("PostHog Peformance observer not started because we are on localhost.");else me.log("PostHog Performance observer not started because PerformanceObserver is not supported by this browser.")}},{key:"stopObserving",value:function(){this.observer&&(this.observer.disconnect(),this.observer=void 0)}},{key:"isObserving",value:function(){return!!this.observer}},{key:"isEnabled",value:function(){var e,r;return(e=(r=this.instance.config.capture_performance)!==null&&r!==void 0?r:this.remoteEnabled)!==null&&e!==void 0&&e}},{key:"afterDecideResponse",value:function(e){this.remoteEnabled=e.capturePerformance||!1,this.isEnabled()&&this.startObserving()}},{key:"_capturePerformanceEvent",value:function(e){if(e.name.indexOf(this.instance.config.api_host)===0){var r=e.name.replace(this.instance.config.api_host,"");if(i0.find(function(p){return r.indexOf(p)===0}))return}var i={url:e.name},n=this.instance.config.session_recording;if(n.maskNetworkRequestFn&&(i=n.maskNetworkRequestFn(i)),i){var s=e.toJSON();s.name=i.url;var a={},o=Math.floor(Date.now()-performance.now());for(var l in a[Ht.timeOrigin]=o,a[Ht.timestamp]=Math.floor(o+e.startTime),Ht)s[l]!==void 0&&(a[Ht[l]]=s[l]);if(this.capturePerformanceEvent(a),s0(e)){var h,c=or(e.serverTiming||[]);try{for(c.s();!(h=c.n()).done;){var u,f=h.value;this.capturePerformanceEvent((Y(u={},Ht.timeOrigin,o),Y(u,Ht.timestamp,Math.floor(o+e.startTime)),Y(u,Ht.name,f.name),Y(u,Ht.duration,f.duration),Y(u,Ht.entryType,"serverTiming"),u))}}catch(p){c.e(p)}finally{c.f()}}}}},{key:"capturePerformanceEvent",value:function(e){var r,i=e[Ht.timestamp];(r=this.instance.sessionRecording)===null||r===void 0||r.onRRwebEmit({type:6,data:{plugin:"posthog/network@1",payload:e},timestamp:i})}}]),t}(),s0=function(t){return t.entryType==="navigation"||t.entryType==="resource"},a0=function(){function t(e){De(this,t),this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return Fe(t,[{key:"call",value:function(){var e=this,r=Bl(JSON.stringify({token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Gi),group_properties:this.instance.get_property(_r),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0}));this.instance._send_request("".concat(this.instance.config.api_host,"/decide/?v=3"),{data:r,verbose:!0},{method:"POST"},function(i){return e.parseDecideResponse(i)})}},{key:"parseDecideResponse",value:function(e){var r,i,n,s,a=this;if(this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer(),e?.status!==0){if(!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){a.parseDecideResponse(e)},500);if(this.instance.toolbar.afterDecideResponse(e),(r=this.instance.sessionRecording)===null||r===void 0||r.afterDecideResponse(e),wr.afterDecideResponse(e,this.instance),(i=this.instance.webPerformance)===null||i===void 0||i.afterDecideResponse(e),(n=this.instance.exceptionAutocapture)===null||n===void 0||n.afterDecideResponse(e),this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.featureFlags.receivedFeatureFlags(e),this.instance.compression={},e.supportedCompression&&!this.instance.config.disable_compression){var o,l={},h=or(e.supportedCompression);try{for(h.s();!(o=h.n()).done;)l[o.value]=!0}catch(g){h.e(g)}finally{h.f()}this.instance.compression=l}var c=(s=window)===null||s===void 0?void 0:s.extendPostHogWithSurveys;if(e.surveys&&!c&&ma(this.instance.config.api_host+"/static/surveys.js",function(g){if(g)return console.error("Could not load surveys script",g);window.extendPostHogWithSurveys(a.instance)}),e.siteApps)if(this.instance.config.opt_in_site_apps){var u,f=this.instance.config.api_host,p=or(e.siteApps);try{var m=function(){var g=u.value,d=g.id,y=g.url,v=[f,f[f.length-1]==="/"&&y[0]==="/"?y.substring(1):y].join("");window["__$$ph_site_app_".concat(d)]=a.instance,ma(v,function(b){b&&console.error("Error while initializing PostHog app with config id ".concat(d),b)})};for(p.s();!(u=p.n()).done;)m()}catch(g){p.e(g)}finally{p.f()}}else e.siteApps.length>0&&console.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else console.error("Failed to fetch feature flags from PostHog.")}}]),t}(),o0=["https://app.posthog.com","https://eu.posthog.com"],l0=["source"],h0=function(){function t(e){De(this,t),this.instance=e}return Fe(t,[{key:"afterDecideResponse",value:function(e){var r=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&r.toolbarVersion&&r.toolbarVersion.indexOf("toolbar")===0&&this.loadToolbar(ie({},r))}},{key:"maybeLoadToolbar",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.location,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:window.history;try{if(!r){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch{return!1}r=window.localStorage}var n,s=cp(e.hash,"__posthog")||cp(e.hash,"state"),a=s?JSON.parse(decodeURIComponent(s)):null;return a&&a.action==="ph_authorize"?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState("",document.title,e.pathname+e.search):e.hash="")):((n=JSON.parse(r.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token)&&(this.loadToolbar(n),!0)}catch{return!1}}},{key:"loadToolbar",value:function(e){var r=this;if(window._postHogToolbarLoaded)return!1;window._postHogToolbarLoaded=!0;var i=this.instance.config.api_host,n=3e5,s=Math.floor(Date.now()/n)*n,a="".concat(i).concat(i.endsWith("/")?"":"/","static/toolbar.js?t=").concat(s),o=!o0.includes(this.instance.config.api_host)&&this.instance.config.advanced_disable_toolbar_metrics,l=ie(ie({token:this.instance.config.token},e),{},{apiURL:i},o?{instrument:!1}:{});l.source;var h=Cg(l,l0);return window.localStorage.setItem("_postHogToolbarParams",JSON.stringify(h)),ma(a,function(c){c?me.error("Failed to load toolbar",c):(window.ph_load_toolbar||window.ph_load_editor)(l,r.instance)}),Dn(window,"turbolinks:load",function(){window._postHogToolbarLoaded=!1,r.loadToolbar(l)}),!0}},{key:"_loadEditor",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.location,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:window.history;return this.maybeLoadToolbar(e,r,i)}}]),t}(),c0="__ph_opt_in_out_";function u0(t,e){Jp(!0,t,e)}function p0(t,e){Jp(!1,t,e)}function d0(t,e){return Yp(t,e)==="1"}function wp(t,e){return!!function(r){if(r&&r.respectDnt){var i=r&&r.window||q,n=i.navigator||{},s=!1;return Ee([n.doNotTrack,n.msDoNotTrack,i.doNotTrack],function(a){Se([!0,1,"1","yes"],a)&&(s=!0)}),s}return!1}(e)||Yp(t,e)==="0"}function f0(t,e){Vl(e=e||{}).remove(Nl(t,e),!!e.crossSubdomainCookie)}function Vl(t){return(t=t||{}).persistenceType==="localStorage"?Oe:t.persistenceType==="localStorage+cookie"?Tl:sr}function Nl(t,e){return((e=e||{}).persistencePrefix||c0)+t}function Yp(t,e){return Vl(e).get(Nl(t,e))}function Jp(t,e,r){Np(e)&&e.length?(Vl(r=r||{}).set(Nl(e,r),t?1:0,Fg(r.cookieExpiration)?r.cookieExpiration:null,r.crossSubdomainCookie,r.secureCookie),r.capture&&t&&r.capture(r.captureEventName||"$opt_in",r.captureProperties||{},{send_instantly:!0})):console.error("gdpr."+(t?"optIn":"optOut")+" called with an invalid token")}var Xp=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:3e3;De(this,t),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=e}return Fe(t,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return new Date().getTime()}}]),t}(),m0=function(t){$p(r,Xp);var e=Rp(r);function r(i){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e3;return De(this,r),(n=e.call(this,s)).handlePollRequest=i,n}return Fe(r,[{key:"enqueue",value:function(i,n,s){this._event_queue.push({url:i,data:n,options:s}),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var i=this;clearTimeout(this._poller),this._poller=setTimeout(function(){if(i._event_queue.length>0){var n=i.formatQueue(),s=function(o){var l=n[o],h=l.url,c=l.data,u=l.options;Ee(c,function(f,p){c[p].offset=Math.abs(c[p].timestamp-i.getTime()),delete c[p].timestamp}),i.handlePollRequest(h,c,u)};for(var a in n)s(a);i._event_queue.length=0,i._empty_queue_count=0}else i._empty_queue_count++;i._empty_queue_count>4&&(i.isPolling=!1,i._empty_queue_count=0),i.isPolling&&i.poll()},this._pollInterval)}},{key:"unload",value:function(){var i=this;clearTimeout(this._poller);var n=this._event_queue.length>0?this.formatQueue():{};this._event_queue.length=0;var s=Object.values(n);[].concat(bl(s.filter(function(a){return a.url.indexOf("/e")===0})),bl(s.filter(function(a){return a.url.indexOf("/e")!==0}))).map(function(a){var o=a.url,l=a.data,h=a.options;i.handlePollRequest(o,l,ie(ie({},h),{},{transport:"sendBeacon"}))})}},{key:"formatQueue",value:function(){var i={};return Ee(this._event_queue,function(n){var s=n.url,a=n.data,o=n.options,l=(o?o._batchKey:null)||s;i[l]===void 0&&(i[l]={data:[],url:s,options:o}),o&&i[l].options&&i[l].options._metrics&&!i[l].options._metrics.rrweb_full_snapshot&&(i[l].options._metrics.rrweb_full_snapshot=o._metrics.rrweb_full_snapshot),i[l].data.push(a)}),i}}]),r}(),vt=Uint8Array,rt=Uint16Array,qi=Uint32Array,zl=new vt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),jl=new vt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),xp=new vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kp=function(t,e){for(var r=new rt(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];var n=new qi(r[30]);for(i=1;i<30;++i)for(var s=r[i];s<r[i+1];++s)n[s]=s-r[i]<<5|i;return[r,n]},Qp=Kp(zl,2),g0=Qp[0],Il=Qp[1];g0[28]=258,Il[258]=28;for(Ml=Kp(jl,0)[1],_a=new rt(32768),Pe=0;Pe<32768;++Pe)vr=(43690&Pe)>>>1|(21845&Pe)<<1,vr=(61680&(vr=(52428&vr)>>>2|(13107&vr)<<2))>>>4|(3855&vr)<<4,_a[Pe]=((65280&vr)>>>8|(255&vr)<<8)>>>1;var vr,Ml,_a,Pe,Fn=function(t,e,r){for(var i=t.length,n=0,s=new rt(e);n<i;++n)++s[t[n]-1];var a,o=new rt(e);for(n=0;n<e;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new rt(1<<e);var l=15-e;for(n=0;n<i;++n)if(t[n])for(var h=n<<4|t[n],c=e-t[n],u=o[t[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[_a[u]>>>l]=h}else for(a=new rt(i),n=0;n<i;++n)a[n]=_a[o[t[n]-1]++]>>>15-t[n];return a},ri=new vt(288);for(Pe=0;Pe<144;++Pe)ri[Pe]=8;for(Pe=144;Pe<256;++Pe)ri[Pe]=9;for(Pe=256;Pe<280;++Pe)ri[Pe]=7;for(Pe=280;Pe<288;++Pe)ri[Pe]=8;var wa=new vt(32);for(Pe=0;Pe<32;++Pe)wa[Pe]=5;var Qr,y0=Fn(ri,9,0),v0=Fn(wa,5,0),ed=function(t){return(t/8>>0)+(7&t&&1)},td=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var i=new(t instanceof rt?rt:t instanceof qi?qi:vt)(r-e);return i.set(t.subarray(e,r)),i},rr=function(t,e,r){r<<=7&e;var i=e/8>>0;t[i]|=r,t[i+1]|=r>>>8},Tn=function(t,e,r){r<<=7&e;var i=e/8>>0;t[i]|=r,t[i+1]|=r>>>8,t[i+2]|=r>>>16},fl=function(t,e){for(var r=[],i=0;i<t.length;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new vt(0),0];if(n==1){var a=new vt(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(x,T){return x.f-T.f}),r.push({s:-1,f:25001});var o=r[0],l=r[1],h=0,c=1,u=2;for(r[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=n-1;)o=r[r[h].f<r[u].f?h++:u++],l=r[h!=c&&r[h].f<r[u].f?h++:u++],r[c++]={s:-1,f:o.f+l.f,l:o,r:l};var f=s[0].s;for(i=1;i<n;++i)s[i].s>f&&(f=s[i].s);var p=new rt(f+1),m=b0(r[c-1],p,0);if(m>e){i=0;var g=0,d=m-e,y=1<<d;for(s.sort(function(x,T){return p[T.s]-p[x.s]||x.f-T.f});i<n;++i){var v=s[i].s;if(!(p[v]>e))break;g+=y-(1<<m-p[v]),p[v]=e}for(g>>>=d;g>0;){var b=s[i].s;p[b]<e?g-=1<<e-p[b]++-1:++i}for(;i>=0&&g;--i){var _=s[i].s;p[_]==e&&(--p[_],++g)}m=e}return[new vt(p),m]},b0=function t(e,r,i){return e.s==-1?Math.max(t(e.l,r,i+1),t(e.r,r,i+1)):r[e.s]=i},Sp=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new rt(++e),i=0,n=t[0],s=1,a=function(l){r[i++]=l},o=1;o<=e;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},In=function(t,e){for(var r=0,i=0;i<e.length;++i)r+=t[i]*e[i];return r},ca=function(t,e,r){var i=r.length,n=ed(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;s<i;++s)t[n+s+4]=r[s];return 8*(n+4+i)},Ep=function(t,e,r,i,n,s,a,o,l,h,c){rr(e,c++,r),++n[256];for(var u=fl(n,15),f=u[0],p=u[1],m=fl(s,15),g=m[0],d=m[1],y=Sp(f),v=y[0],b=y[1],_=Sp(g),x=_[0],T=_[1],S=new rt(19),w=0;w<v.length;++w)S[31&v[w]]++;for(w=0;w<x.length;++w)S[31&x[w]]++;for(var M=fl(S,7),E=M[0],I=M[1],P=19;P>4&&!E[xp[P-1]];--P);var A,k,F,O,D=h+5<<3,C=In(n,ri)+In(s,wa)+a,$=In(n,f)+In(s,g)+a+14+3*P+In(S,E)+(2*S[16]+3*S[17]+7*S[18]);if(D<=C&&D<=$)return ca(e,c,t.subarray(l,l+h));if(rr(e,c,1+($<C)),c+=2,$<C){A=Fn(f,p,0),k=f,F=Fn(g,d,0),O=g;var R=Fn(E,I,0);for(rr(e,c,b-257),rr(e,c+5,T-1),rr(e,c+10,P-4),c+=14,w=0;w<P;++w)rr(e,c+3*w,E[xp[w]]);c+=3*P;for(var G=[v,x],U=0;U<2;++U){var Z=G[U];for(w=0;w<Z.length;++w){var j=31&Z[w];rr(e,c,R[j]),c+=E[j],j>15&&(rr(e,c,Z[w]>>>5&127),c+=Z[w]>>>12)}}}else A=y0,k=ri,F=v0,O=wa;for(w=0;w<o;++w)if(i[w]>255){j=i[w]>>>18&31,Tn(e,c,A[j+257]),c+=k[j+257],j>7&&(rr(e,c,i[w]>>>23&31),c+=zl[j]);var ee=31&i[w];Tn(e,c,F[ee]),c+=O[ee],ee>3&&(Tn(e,c,i[w]>>>5&8191),c+=jl[ee])}else Tn(e,c,A[i[w]]),c+=k[i[w]];return Tn(e,c,A[256]),c+k[256]},_0=new qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),w0=new vt(0),x0=function(){for(var t=new qi(256),e=0;e<256;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),S0=function(){var t=4294967295;return{p:function(e){for(var r=t,i=0;i<e.length;++i)r=x0[255&r^e[i]]^r>>>8;t=r},d:function(){return 4294967295^t}}},E0=function(t,e,r,i,n){return function(s,a,o,l,h,c){var u=s.length,f=new vt(l+u+5*(1+Math.floor(u/7e3))+h),p=f.subarray(l,f.length-h),m=0;if(!a||u<8)for(var g=0;g<=u;g+=65535){var d=g+65535;d<u?m=ca(p,m,s.subarray(g,d)):(p[g]=c,m=ca(p,m,s.subarray(g,u)))}else{for(var y=_0[a-1],v=y>>>13,b=8191&y,_=(1<<o)-1,x=new rt(32768),T=new rt(_+1),S=Math.ceil(o/3),w=2*S,M=function(it){return(s[it]^s[it+1]<<S^s[it+2]<<w)&_},E=new qi(25e3),I=new rt(288),P=new rt(32),A=0,k=0,F=(g=0,0),O=0,D=0;g<u;++g){var C=M(g),$=32767&g,R=T[C];if(x[$]=R,T[C]=$,O<=g){var G=u-g;if((A>7e3||F>24576)&&G>423){m=Ep(s,p,0,E,I,P,k,F,D,g-D,m),F=A=k=0,D=g;for(var U=0;U<286;++U)I[U]=0;for(U=0;U<30;++U)P[U]=0}var Z=2,j=0,ee=b,ne=$-R&32767;if(G>2&&C==M(g-ne))for(var te=Math.min(v,G)-1,K=Math.min(32767,g),be=Math.min(258,G);ne<=K&&--ee&&$!=R;){if(s[g+Z]==s[g+Z-ne]){for(var he=0;he<be&&s[g+he]==s[g+he-ne];++he);if(he>Z){if(Z=he,j=ne,he>te)break;var Ae=Math.min(ne,he-2),_e=0;for(U=0;U<Ae;++U){var W=g-ne+U+32768&32767,He=W-x[W]+32768&32767;He>_e&&(_e=He,R=W)}}}ne+=($=R)-(R=x[$])+32768&32767}if(j){E[F++]=268435456|Il[Z]<<18|Ml[j];var _t=31&Il[Z],wt=31&Ml[j];k+=zl[_t]+jl[wt],++I[257+_t],++P[wt],O=g+Z,++A}else E[F++]=s[g],++I[s[g]]}}m=Ep(s,p,c,E,I,P,k,F,D,g-D,m),c||(m=ca(p,m,w0))}return td(f,0,l+ed(m)+h)}(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i,!n)},Dl=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},k0=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&Dl(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;i<=r.length;++i)t[i+10]=r.charCodeAt(i)}},P0=function(t){return 10+(t.filename&&t.filename.length+1||0)};function A0(t,e){e===void 0&&(e={});var r=S0(),i=t.length;r.p(t);var n=E0(t,e,P0(e),8),s=n.length;return k0(n,e),Dl(n,s-8,r.d()),Dl(n,s-4,i),n}function C0(t,e){var r=t.length;if(!e&&typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var i=new vt(t.length+(t.length>>>1)),n=0,s=function(h){i[n++]=h},a=0;a<r;++a){if(n+5>i.length){var o=new vt(n+8+(r-a<<1));o.set(i),i=o}var l=t.charCodeAt(a);l<128||e?s(l):l<2048?(s(192|l>>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++a))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return td(i,0,n)}(function(t){t.GZipJS="gzip-js",t.Base64="base64"})(Qr||(Qr={}));var T0=function(t,e,r){var i=e||{};i.ip=r.ip?1:0,i._=new Date().getTime().toString(),i.ver=Tt.LIB_VERSION;var n=t.split("?");if(n.length>1){var s,a=or(n[1].split("&"));try{for(a.s();!(s=a.n()).done;){var o=s.value.split("=")[0];i[o]&&delete i[o]}}catch(h){a.e(h)}finally{a.f()}}var l=t.indexOf("?")>-1?"&":"?";return t+l+function(h){var c,u,f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",p=[];return Ee(h,function(m,g){c=encodeURIComponent(m.toString()),u=encodeURIComponent(g),p[p.length]=u+"="+c}),p.join(f)}(i)},Hl=function t(e,r){if(r.blob&&e.buffer)return new Blob([e.buffer],{type:"text/plain"});if(r.sendBeacon||r.blob){var i=t(e,{method:"POST"});return new Blob([i],{type:"application/x-www-form-urlencoded"})}if(r.method!=="POST")return null;var n,s;return n=Array.isArray(e)||(s=e,Object.prototype.toString.call(s)==="[object Uint8Array]")?"data="+encodeURIComponent(e):"data="+encodeURIComponent(e.data),"compression"in e&&e.compression&&(n+="&compression="+e.compression),n},rd=function(t){var e=t.url,r=t.data,i=t.headers,n=t.options,s=t.callback,a=t.retriesPerformedSoFar,o=t.retryQueue,l=t.onXHRError,h=t.timeout,c=h===void 0?6e4:h,u=t.onResponse,f=new XMLHttpRequest;f.open(n.method||"GET",e,!0);var p=Hl(r,n);Ee(i,function(m,g){f.setRequestHeader(g,m)}),n.method!=="POST"||n.blob||f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.timeout=c,f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(u?.(f),f.status===200){if(s){var m;try{m=JSON.parse(f.responseText)}catch(g){return void me.error(g)}s(m)}}else typeof l=="function"&&l(f),(f.status<400||f.status>500)&&o.enqueue({url:e,data:r,options:n,headers:i,retriesPerformedSoFar:(a||0)+1,callback:s}),s?.({status:0})},f.send(p)},I0=18e5,M0=function(t){$p(r,Xp);var e=Rp(r);function r(i,n){var s;return De(this,r),(s=e.call(this)).isPolling=!1,s.queue=[],s.areWeOnline=!0,s.onXHRError=i,s.rateLimiter=n,typeof window<"u"&&"onLine"in window.navigator&&(s.areWeOnline=window.navigator.onLine,window.addEventListener("online",function(){s._handleWeAreNowOnline()}),window.addEventListener("offline",function(){s.areWeOnline=!1})),s}return Fe(r,[{key:"enqueue",value:function(i){var n=i.retriesPerformedSoFar||0;if(!(n>=10)){var s=function(o){var l=3e3*Math.pow(2,o),h=l/2,c=Math.min(I0,l),u=(Math.random()-.5)*(c-h);return Math.ceil(c+u)}(n),a=new Date(Date.now()+s);this.queue.push({retryAt:a,requestData:i}),console.warn("Enqueued failed request for retry in ".concat(s)),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var i=this;this._poller&&clearTimeout(this._poller),this._poller=setTimeout(function(){i.areWeOnline&&i.queue.length>0&&i.flush(),i.poll()},this._pollInterval)}},{key:"flush",value:function(){var i=new Date(Date.now()),n=this.queue.filter(function(l){return l.retryAt<i});if(n.length>0){this.queue=this.queue.filter(function(l){return l.retryAt>=i});var s,a=or(n);try{for(a.s();!(s=a.n()).done;){var o=s.value.requestData;this._executeXhrRequest(o)}}catch(l){a.e(l)}finally{a.f()}}}},{key:"unload",value:function(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);var i,n=or(this.queue);try{for(n.s();!(i=n.n()).done;){var s=i.value.requestData,a=s.url,o=s.data,l=s.options;if(this.rateLimiter.isRateLimited(l._batchKey))Tt.DEBUG&&console.warn("[PostHog RetryQueue] is quota limited. Dropping request.");else try{window.navigator.sendBeacon(a,Hl(o,ie(ie({},l),{},{sendBeacon:!0})))}catch(h){Tt.DEBUG&&console.error(h)}}}catch(h){n.e(h)}finally{n.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(i){var n=i.url,s=i.data,a=i.options,o=i.headers,l=i.callback,h=i.retriesPerformedSoFar;this.rateLimiter.isRateLimited(a._batchKey)||rd({url:n,data:s||{},options:a||{},headers:o||{},retriesPerformedSoFar:h||0,callback:l,retryQueue:this,onXHRError:this.onXHRError,onResponse:this.rateLimiter.checkForLimiting})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),r}();Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t});var kp="0123456789abcdef",D0=function(){function t(e){if(De(this,t),this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}return Fe(t,[{key:"toString",value:function(){for(var e="",r=0;r<this.bytes.length;r++)e=e+kp.charAt(this.bytes[r]>>>4)+kp.charAt(15&this.bytes[r]),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}},{key:"clone",value:function(){return new t(this.bytes.slice(0))}},{key:"equals",value:function(e){return this.compareTo(e)===0}},{key:"compareTo",value:function(e){for(var r=0;r<16;r++){var i=this.bytes[r]-e.bytes[r];if(i!==0)return Math.sign(i)}return 0}}],[{key:"fromFieldsV7",value:function(e,r,i,n){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||e<0||r<0||i<0||n<0||e>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|r>>>8,s[7]=r,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=n>>>24,s[13]=n>>>16,s[14]=n>>>8,s[15]=n,new t(s)}}]),t}(),F0=function(){function t(){De(this,t),Y(this,"timestamp",0),Y(this,"counter",0),Y(this,"random",new O0)}return Fe(t,[{key:"generate",value:function(){var e=this.generateOrAbort();if(e!==void 0)return e;this.timestamp=0;var r=this.generateOrAbort();if(r===void 0)throw new Error("Could not generate UUID after timestamp reset");return r}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return D0.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),t}(),id=function(t){if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};typeof crypto<"u"&&crypto.getRandomValues&&(id=function(t){return crypto.getRandomValues(t)});var Pp,O0=function(){function t(){De(this,t),Y(this,"buffer",new Uint32Array(8)),Y(this,"cursor",1/0)}return Fe(t,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(id(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),t}(),ei=function(){return $0().toString()},$0=function(){return(Pp||(Pp=new F0)).generate()},sa=1800,Ap=60,R0=864e5,L0=function(){function t(e,r){De(this,t),Y(this,"_sessionIdChangedHandlers",[]),this.config=e,this.persistence=r,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null;var i=e.persistence_name||e.token,n=e.session_idle_timeout_seconds||sa;if(typeof n!="number"?(console.warn("[PostHog] session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),n=sa):n>sa?console.warn("[PostHog] session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):n<Ap&&console.warn("[PostHog] session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."),this._sessionTimeoutMs=1e3*Math.min(Math.max(n,Ap),sa),this._window_id_storage_key="ph_"+i+"_window_id",this._primary_window_exists_storage_key="ph_"+i+"_primary_window_exists",this._canUseSessionStorage()){var s=Ue.parse(this._window_id_storage_key),a=Ue.parse(this._primary_window_exists_storage_key);s&&!a?this._windowId=s:Ue.remove(this._window_id_storage_key),Ue.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return Fe(t,[{key:"onSessionId",value:function(e){var r=this;return this._sessionIdChangedHandlers===void 0&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),function(){r._sessionIdChangedHandlers=r._sessionIdChangedHandlers.filter(function(i){return i!==e})}}},{key:"_canUseSessionStorage",value:function(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&Ue.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ue.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ue.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(e,r,i){e===this._sessionId&&r===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=r,this._sessionId=e,this.persistence.register(Y({},va,[r,e,i])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[va];return Array.isArray(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var e=this;window.addEventListener("beforeunload",function(){e._canUseSessionStorage()&&Ue.remove(e._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),i=ar(this._getSessionId(),3),n=i[0],s=i[1],a=i[2],o=this._getWindowId(),l=a&&a>0&&Math.abs(r-a)>R0,h=!1;!s||!e&&Math.abs(r-n)>this._sessionTimeoutMs||l?(s=ei(),o=ei(),a=r,h=!0):o||(o=ei(),h=!0);var c=n===0||!e||l?r:n,u=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(s,c,u),h&&this._sessionIdChangedHandlers.forEach(function(f){return f(s,o)}),{sessionId:s,windowId:o,sessionStartTimestamp:u}}}]),t}(),B0=Fe(function t(e,r,i,n){De(this,t),this.name="posthog-js",this.setupOnce=function(s){s(function(a){var o,l,h,c,u;if(a.level!=="error"||!e.__loaded)return a;a.tags||(a.tags={});var f=e.config.ui_host||e.config.api_host;a.tags["PostHog Person URL"]=f+"/person/"+e.get_distinct_id(),e.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=((o=a.exception)===null||o===void 0?void 0:o.values)||[],m={$exception_message:(l=p[0])===null||l===void 0?void 0:l.value,$exception_type:(h=p[0])===null||h===void 0?void 0:h.type,$exception_personURL:f+"/person/"+e.get_distinct_id(),$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:(c=p[0])===null||c===void 0?void 0:c.value,$sentry_exception_type:(u=p[0])===null||u===void 0?void 0:u.type,$sentry_tags:a.tags};return r&&i&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+i+"&query="+a.event_id),e.capture("$exception",m),a})}}),V0=function(t){Promise&&Promise.resolve||console.warn("This browser does not have Promise support, and can not use the segment integration");var e=function(r,i){r.event.userId||r.event.anonymousId===t.get_distinct_id()||t.reset(),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(t.register({distinct_id:r.event.userId}),t.reloadFeatureFlags());var n=t._calculate_event_properties(i,r.event.properties);return r.event.properties=Object.assign({},n,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(r){return e(r,r.event.event)},page:function(r){return e(r,"$pageview")},identify:function(r){return e(r,"$identify")},screen:function(r){return e(r,"$screen")}}},N0=function(){function t(){var e=this;De(this,t),Y(this,"_hasSeenPageView",!1),Y(this,"_updateScrollData",function(){var r,i,n,s;e._pageViewData||(e._pageViewData=e._createPageViewData());var a=e._pageViewData,o=e._scrollY(),l=e._scrollHeight(),h=e._contentY(),c=e._contentHeight();a.lastScrollY=o,a.maxScrollY=Math.max(o,(r=a.maxScrollY)!==null&&r!==void 0?r:0),a.maxScrollHeight=Math.max(l,(i=a.maxScrollHeight)!==null&&i!==void 0?i:0),a.lastContentY=h,a.maxContentY=Math.max(h,(n=a.maxContentY)!==null&&n!==void 0?n:0),a.maxContentHeight=Math.max(c,(s=a.maxContentHeight)!==null&&s!==void 0?s:0)})}return Fe(t,[{key:"_createPageViewData",value:function(){return{pathname:q.location.pathname}}},{key:"doPageView",value:function(){var e,r;return this._hasSeenPageView?(r=this._pageViewData,this._pageViewData=this._createPageViewData()):(this._hasSeenPageView=!0,r=void 0,this._pageViewData||(this._pageViewData=this._createPageViewData())),setTimeout(this._updateScrollData,0),ie({$prev_pageview_pathname:(e=r)===null||e===void 0?void 0:e.pathname},this._calculatePrevPageScrollProperties(r))}},{key:"doPageLeave",value:function(){var e=this._pageViewData;return ie({$prev_pageview_pathname:e?.pathname},this._calculatePrevPageScrollProperties(e))}},{key:"_calculatePrevPageScrollProperties",value:function(e){if(!e||e.maxScrollHeight==null||e.lastScrollY==null||e.maxScrollY==null||e.maxContentHeight==null||e.lastContentY==null||e.maxContentY==null)return{};var r=e.maxScrollHeight,i=e.lastScrollY,n=e.maxScrollY,s=e.maxContentHeight,a=e.lastContentY,o=e.maxContentY;return r=Math.ceil(r),i=Math.ceil(i),n=Math.ceil(n),s=Math.ceil(s),a=Math.ceil(a),o=Math.ceil(o),{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:r<=1?1:aa(i/r,0,1),$prev_pageview_max_scroll:n,$prev_pageview_max_scroll_percentage:r<=1?1:aa(n/r,0,1),$prev_pageview_last_content:a,$prev_pageview_last_content_percentage:s<=1?1:aa(a/s,0,1),$prev_pageview_max_content:o,$prev_pageview_max_content_percentage:s<=1?1:aa(o/s,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){q.addEventListener("scroll",this._updateScrollData),q.addEventListener("scrollend",this._updateScrollData),q.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){q.removeEventListener("scroll",this._updateScrollData),q.removeEventListener("scrollend",this._updateScrollData),q.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollHeight",value:function(){return Math.max(0,q.document.documentElement.scrollHeight-q.document.documentElement.clientHeight)}},{key:"_scrollY",value:function(){return q.scrollY||q.pageYOffset||q.document.documentElement.scrollTop||0}},{key:"_contentHeight",value:function(){return q.document.documentElement.scrollHeight||0}},{key:"_contentY",value:function(){var e=q.document.documentElement.clientHeight||0;return this._scrollY()+e}}]),t}();function aa(t,e,r){return Math.max(e,Math.min(t,r))}function Cp(t){return typeof Event<"u"&&nd(t,Event)}function nd(t,e){try{return t instanceof e}catch{return!1}}function Tp(t){return t===null||xr(t)!=="object"&&typeof t!="function"}function ua(t,e){return Object.prototype.toString.call(t)==="[object ".concat(e,"]")}function ml(t){return ua(t,"DOMError")}var Ip=/\(error: (.*)\)/,Mp=50,pa="?";function gl(t,e,r,i){var n={filename:t,function:e,in_app:!0};return r!==void 0&&(n.lineno=r),i!==void 0&&(n.colno=i),n}var z0=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,j0=/\((\S*)(?::(\d+))(?::(\d+))\)/,H0=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,G0=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,q0=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,U0=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=e.sort(function(n,s){return n[0]-s[0]}).map(function(n){return n[1]});return function(n){for(var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=n.split(`
|
|
413
|
-
`),l=s;l<o.length;l++){var h=o[l];if(!(h.length>1024)){var c=Ip.test(h)?h.replace(Ip,"$1"):h;if(!c.match(/\S*Error: /)){var u,f=or(i);try{for(f.s();!(u=f.n()).done;){var p=(0,u.value)(c);if(p){a.push(p);break}}}catch(m){f.e(m)}finally{f.f()}if(a.length>=Mp)break}}}return function(m){if(!m.length)return[];var g=m.slice(0,Mp);return g.reverse(),g.map(function(d){return ie(ie({},d),{},{filename:d.filename||g[g.length-1].filename,function:d.function||"?"})})}(a)}}.apply(void 0,[[30,function(t){var e=z0.exec(t);if(e){if(e[2]&&e[2].indexOf("eval")===0){var r=j0.exec(e[2]);r&&(e[2]=r[1],e[3]=r[2],e[4]=r[3])}var i=ar(Dp(e[1]||pa,e[2]),2),n=i[0];return gl(i[1],n,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}}],[50,function(t){var e=H0.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=G0.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var i=e[3],n=e[1]||pa,s=ar(Dp(n,i),2);return n=s[0],gl(i=s[1],n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}],[40,function(t){var e=q0.exec(t);return e?gl(e[2],e[1]||pa,+e[3],e[4]?+e[4]:void 0):void 0}]]),Dp=function(t,e){var r=t.indexOf("safari-extension")!==-1,i=t.indexOf("safari-web-extension")!==-1;return r||i?[t.indexOf("@")!==-1?t.split("@")[0]:pa,r?"safari-extension:".concat(e):"safari-web-extension:".concat(e)]:[t,e]},W0=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Z0=/Minified React error #\d+;/i;function Y0(t){var e=t.stacktrace||t.stack||"",r=function(i){if(i){if(typeof i.framesToPop=="number")return i.framesToPop;if(Z0.test(i.message))return 1}return 0}(t);try{return U0(e,r)}catch{}return[]}function yl(t){var e=Y0(t);return{$exception_type:t.name,$exception_message:t.message,$exception_stack_trace_raw:JSON.stringify(e)}}function J0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(!(n.length>e))return i===r.length||n.length<=e?n:"".concat(n.slice(0,e),"...")}return""}function Fp(t){var e=ar(t,5),r=e[0],i=e[1],n=e[2],s=e[3],a=e[4],o={};if(a===void 0&&typeof r=="string"){var l="Error",h=r,c=r.match(W0);c&&(l=c[1],h=c[2]),o={$exception_type:l,$exception_message:h}}var u=a||r;if(ml(u)||function(g){return ua(g,"DOMException")}(u)){var f=u;if(function(g){return"stack"in g}(u))o=yl(u);else{var p=f.name||(ml(f)?"DOMError":"DOMException"),m=f.message?"".concat(p,": ").concat(f.message):p;o=function(g){return{$exception_type:"Error",$exception_message:g}}(m),o.$exception_type=ml(f)?"DOMError":"DOMException",o.$exception_message=o.$exception_message||m}"code"in f&&(o.$exception_DOMException_code="".concat(f.code))}else(function(g){return ua(g,"ErrorEvent")})(u)&&u.error?o=yl(u.error):function(g){switch(Object.prototype.toString.call(g)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return nd(g,Error)}}(u)?o=yl(u):function(g){return ua(g,"Object")}(u)||Cp(u)?(o=function(g){return{$exception_type:Cp(g)?g.constructor.name:"Error",$exception_message:"Non-Error ".concat("exception"," captured with keys: ",J0(g))}}(u),o.$exception_is_synthetic=!0):(o.$exception_type=o.$exception_type||"Error",o.$exception_message=o.$exception_message||u,o.$exception_is_synthetic=!0);return ie(ie(ie(ie({},o),{},{$exception_type:o.$exception_type||"UnknownErrorType",$exception_message:o.$exception_message||""},i?{$exception_source:i}:{}),n?{$exception_lineno:n}:{}),s?{$exception_colno:s}:{})}var On,Gl,qe,X0=function(){function t(e){De(this,t),Y(this,"originalOnErrorHandler",void 0),Y(this,"originalOnUnhandledRejectionHandler",void 0),Y(this,"errorsToIgnore",[]),this.instance=e}return Fe(t,[{key:"debugLog",value:function(){if(this.instance.config.debug){for(var e,r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];(e=console).log.apply(e,["PostHog.js [PostHog.ExceptionObserver]"].concat(i))}}},{key:"startCapturing",value:function(){var e;if(this.isEnabled()&&((e=q.onerror)===null||e===void 0||!e.__POSTHOG_INSTRUMENTED__))try{this.originalOnErrorHandler=q.onerror,q.onerror=function(){for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];return this.captureException(i),!!this.originalOnErrorHandler&&this.originalOnErrorHandler.apply(this,i)}.bind(this),q.onerror.__POSTHOG_INSTRUMENTED__=!0,this.originalOnUnhandledRejectionHandler=q.onunhandledrejection,q.onunhandledrejection=function(){for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];var s=function(a){var o=ar(a,1)[0],l=o;try{"reason"in o?l=o.reason:"detail"in o&&"reason"in o.detail&&(l=o.detail.reason)}catch{}var h={};return(h=Tp(l)?{$exception_message:"Non-Error promise rejection captured with value: ".concat(String(l))}:Fp([l])).$exception_handled=!1,ie(ie({},h),{},{$exception_type:h.$exception_type="UnhandledRejection",$exception_message:h.$exception_message=h.$exception_message||o.reason||String(l)})}(i);return this.sendExceptionEvent(s),!this.originalOnUnhandledRejectionHandler||this.originalOnUnhandledRejectionHandler.apply(q,i)}.bind(this),q.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0}catch(r){console.error("PostHog failed to start exception autocapture",r),this.stopCapturing()}}},{key:"stopCapturing",value:function(){var e,r;this.originalOnErrorHandler!==void 0&&(q.onerror=this.originalOnErrorHandler,this.originalOnErrorHandler=null),(e=q.onerror)===null||e===void 0||delete e.__POSTHOG_INSTRUMENTED__,this.originalOnUnhandledRejectionHandler!==void 0&&(q.onunhandledrejection=this.originalOnUnhandledRejectionHandler,this.originalOnUnhandledRejectionHandler=null),(r=q.onunhandledrejection)===null||r===void 0||delete r.__POSTHOG_INSTRUMENTED__}},{key:"isCapturing",value:function(){var e;return!((e=q.onerror)===null||e===void 0||!e.__POSTHOG_INSTRUMENTED__)}},{key:"isEnabled",value:function(){var e;return(e=this.remoteEnabled)!==null&&e!==void 0&&e}},{key:"afterDecideResponse",value:function(e){var r=e.autocaptureExceptions;if(this.remoteEnabled=!!r||!1,!Tp(r)&&"errors_to_ignore"in r&&Array.isArray(r.errors_to_ignore)){var i=r.errors_to_ignore;this.errorsToIgnore=i.map(function(n){return new RegExp(n)})}this.isEnabled()?(this.startCapturing(),this.debugLog("Remote config for exception autocapture is enabled, starting",r)):this.debugLog("Remote config for exception autocapture is disabled, not starting",r)}},{key:"captureException",value:function(e,r){var i=Fp(e);if(this.errorsToIgnore.some(function(a){return a.test(i.$exception_message||"")}))this.debugLog("Ignoring exception based on remote config",i);else{var n=ie(ie({},r),i),s=this.instance.config.ui_host||this.instance.config.api_host;i.$exception_personURL=s+"/person/"+this.instance.get_distinct_id(),this.sendExceptionEvent(n)}}},{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{transport:"XHR",method:"POST",endpoint:"/e/",_noTruncate:!0,_batchKey:"exceptionEvent"})}}]),t}(),K0=function(){function t(e){De(this,t),this.instance=e}return Fe(t,[{key:"getSurveys",value:function(e){var r=this,i=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=this.instance.get_property(Pl);if(n&&!i)return e(n);this.instance._send_request("".concat(this.instance.config.api_host,"/api/surveys/?token=").concat(this.instance.config.token),{},{method:"GET"},function(s){var a,o=s.surveys;return(a=r.instance.persistence)===null||a===void 0||a.register(Y({},Pl,o)),e(o)})}},{key:"getActiveMatchingSurveys",value:function(e){var r=this,i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(n){var s=n.filter(function(a){return!(!a.start_date||a.end_date)}).filter(function(a){var o,l;if(!a.conditions)return!0;var h=(o=a.conditions)===null||o===void 0||!o.url||window.location.href.indexOf(a.conditions.url)>-1,c=(l=a.conditions)===null||l===void 0||!l.selector||document.querySelector(a.conditions.selector);return h&&c}).filter(function(a){if(!a.linked_flag_key&&!a.targeting_flag_key)return!0;var o=!a.linked_flag_key||r.instance.featureFlags.isFeatureEnabled(a.linked_flag_key),l=!a.targeting_flag_key||r.instance.featureFlags.isFeatureEnabled(a.targeting_flag_key);return o&&l});return e(s)},i)}}]),t}(),Q0=6e4,ey=function(){function t(){var e=this;De(this,t),Y(this,"limits",{}),Y(this,"checkForLimiting",function(r){try{(JSON.parse(r.responseText).quota_limited||[]).forEach(function(i){me.log("[PostHog RateLimiter] ".concat(i||"events"," is quota limited.")),e.limits[i]=new Date().getTime()+Q0})}catch(i){return void me.error(i)}})}return Fe(t,[{key:"isRateLimited",value:function(e){var r=this.limits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}}]),t}();(function(t){t[t.INIT_MODULE=0]="INIT_MODULE",t[t.INIT_SNIPPET=1]="INIT_SNIPPET"})(On||(On={}));var Fl=function(){},oa={},lt="posthog",da=q.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,sd=!da&&Lt.indexOf("MSIE")===-1&&Lt.indexOf("Mozilla")===-1,Op=function(){var t,e,r;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(Me==null||(t=Me.location)===null||t===void 0||(e=t.hostname)===null||e===void 0?void 0:e.indexOf("herokuapp.com"))===-1,persistence:"cookie",persistence_name:"",cookie_name:"",loaded:Fl,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:!0,debug:!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:void 0,secure_cookie:(q==null||(r=q.location)===null||r===void 0?void 0:r.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,on_xhr_error:function(i){var n="Bad HTTP status: "+i.status+" "+i.statusText;console.error(n)},get_device_id:function(i){return i},_onCapture:Fl,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},Ol=function(t,e,r,i){var n,s=r!==lt&&qe?r?qe[r]:void 0:qe,a={initComplete:!1,syncCode:!1},o=function(l){return function(h){a[l]||(a[l]=!0,a.initComplete&&a.syncCode&&i?.(h))}};if(s&&Gl===On.INIT_MODULE)n=s;else{if(s&&!ir(s))return void console.error("You have already initialized "+r);n=new ql}return n._init(t,e,r,o("initComplete")),n.toolbar.maybeLoadToolbar(),n.sessionRecording=new t0(n),n.sessionRecording.startRecordingIfEnabled(),n.webPerformance=new n0(n),n.webPerformance.startObservingIfEnabled(),n.config.__preview_measure_pageview_stats&&n.pageViewManager.startMeasuringScrollPosition(),n.exceptionAutocapture=new X0(n),n.__autocapture=n.config.autocapture,wr._setIsAutocaptureEnabled(n),wr._isAutocaptureEnabled&&(n.__autocapture=n.config.autocapture,wr.enabledForProject(n.config.token,100,100)?wr.isBrowserSupported()?wr.init(n):(n.__autocapture=!1,me.log("Disabling Automatic Event Collection because this browser is not supported")):(n.__autocapture=!1,me.log("Not in active bucket: disabling Automatic Event Collection."))),Tt.DEBUG=Tt.DEBUG||n.config.debug,s!==void 0&&ir(s)&&(n._execute_array.call(n.people,s.people),n._execute_array(s)),o("syncCode")(n),n},ql=function(){function t(){var e=this;De(this,t),this.config=Op(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=B0,this.segmentIntegration=function(){return V0(e)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.featureFlags=new zg(this),this.toolbar=new h0(this),this.pageViewManager=new N0,this.surveys=new K0(this),this.rateLimiter=new ey,this.people={set:function(r,i,n){var s=typeof r=="string"?Y({},r,i):r;e.setPersonProperties(s),n?.({})},set_once:function(r,i,n){var s=typeof r=="string"?Y({},r,i):r;e.setPersonProperties(void 0,s),n?.({})}}}return Fe(t,[{key:"init",value:function(e,r,i){if(Ct(i))console.error("You must name your new library: init(token, config, name)");else{if(i!==lt){var n=Ol(e,r,i,function(s){qe[i]=s,s._loaded()});return qe[i]=n,n}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var r,i,n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var l,h={segmentRegister:!1,syncCode:!1},c=function(_){return function(){h[_]||(h[_]=!0,h.segmentRegister&&h.syncCode&&o?.(n))}};if(this.set_config(Xe({},Op(),s,{name:a,token:e,callback_fn:(a===lt?a:lt+"."+a)+"._jsc"})),this._jsc=function(){},(q!=null&&(r=q.rrweb)!==null&&r!==void 0&&r.record||q!=null&&q.rrwebRecord)&&(this.__loaded_recorder_version=q==null||(l=q.rrweb)===null||l===void 0?void 0:l.version),this.persistence=new bp(this.config),this._requestQueue=new m0(this._handle_queued_event.bind(this)),this._retryQueue=new M0(this.config.on_xhr_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new L0(this.config,this.persistence),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bp(ie(ie({},this.config),{},{persistence:"sessionStorage"})),this._gdpr_init(),s.segment?(this.config.get_device_id=function(){return s.segment.user().anonymousId()},s.segment.user().id()&&(this.register({distinct_id:s.segment.user().id()}),this.persistence.set_user_state("identified")),s.segment.register(this.segmentIntegration()).then(c("segmentRegister"))):c("segmentRegister")(),((i=s.bootstrap)===null||i===void 0?void 0:i.distinctID)!==void 0){var u,f,p=this.config.get_device_id(ei()),m=(u=s.bootstrap)!==null&&u!==void 0&&u.isIdentifiedID?p:s.bootstrap.distinctID;this.persistence.set_user_state((f=s.bootstrap)!==null&&f!==void 0&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.bootstrap.distinctID,$device_id:m})}if(this._hasBootstrappedFeatureFlags()){var g,d,y=Object.keys(((g=s.bootstrap)===null||g===void 0?void 0:g.featureFlags)||{}).filter(function(_){var x,T;return!((x=s.bootstrap)===null||x===void 0||(T=x.featureFlags)===null||T===void 0||!T[_])}).reduce(function(_,x){var T,S;return _[x]=((T=s.bootstrap)===null||T===void 0||(S=T.featureFlags)===null||S===void 0?void 0:S[x])||!1,_},{}),v=Object.keys(((d=s.bootstrap)===null||d===void 0?void 0:d.featureFlagPayloads)||{}).filter(function(_){return y[_]}).reduce(function(_,x){var T,S,w,M;return(T=s.bootstrap)!==null&&T!==void 0&&(S=T.featureFlagPayloads)!==null&&S!==void 0&&S[x]&&(_[x]=(w=s.bootstrap)===null||w===void 0||(M=w.featureFlagPayloads)===null||M===void 0?void 0:M[x]),_},{});this.featureFlags.receivedFeatureFlags({featureFlags:y,featureFlagPayloads:v})}if(!this.get_distinct_id()){var b=this.config.get_device_id(ei());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_user_state("anonymous")}q.addEventListener&&q.addEventListener("onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),c("syncCode")()}},{key:"_loaded",value:function(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(r){console.error("`loaded` function failed",r)}this._start_queue_if_opted_in(),this.config.capture_pageview&&this.capture("$pageview",{title:Me.title},{send_instantly:!0}),e||(new a0(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.poll())}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||nr(this.__request_queue,function(r){e._send_request.apply(e,bl(r))}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,r){if(Ct(e))return null;if(da)return function(a){e(a,r)};var i=this._jsc,n=""+Math.floor(1e8*Math.random()),s=this.config.callback_fn+"["+n+"]";return i[n]=function(a){delete i[n],e(a,r)},s}},{key:"_handle_unload",value:function(){var e,r;this.config.request_batching?(this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(r=this._retryQueue)===null||r===void 0||r.unload()):this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_handle_queued_event",value:function(e,r,i){var n=JSON.stringify(r);this.__compress_and_send_json_request(e,n,i||oa,Fl)}},{key:"__compress_and_send_json_request",value:function(e,r,i,n){var s=function(h,c,u){return h===Qr.GZipJS?[A0(C0(c),{mtime:0}),ie(ie({},u),{},{blob:!0,urlQueryArgs:{compression:Qr.GZipJS}})]:[{data:Bl(c)},u]}(this.compression[Qr.GZipJS]?Qr.GZipJS:Qr.Base64,r,i),a=ar(s,2),o=a[0],l=a[1];this._send_request(e,o,l,n)}},{key:"_send_request",value:function(e,r,i,n){if(this.__loaded&&this._retryQueue&&!this.rateLimiter.isRateLimited(i._batchKey))if(sd)this.__request_queue.push([e,r,i,n]);else{var s={method:this.config.api_method,transport:this.config.api_transport,verbose:this.config.verbose};i=Xe(s,i||{}),da||(i.method="GET");var a="sendBeacon"in q.navigator&&i.transport==="sendBeacon";if(e=T0(e,i.urlQueryArgs||{},{ip:this.config.ip}),a)try{q.navigator.sendBeacon(e,Hl(r,ie(ie({},i),{},{sendBeacon:!0})))}catch{}else if(da)try{rd({url:e,data:r,headers:this.config.xhr_headers,options:i,callback:n,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.config.on_xhr_error,onResponse:this.rateLimiter.checkForLimiting})}catch(c){console.error(c)}else{var o,l=Me.createElement("script");l.type="text/javascript",l.async=!0,l.defer=!0,l.src=e;var h=Me.getElementsByTagName("script")[0];(o=h.parentNode)===null||o===void 0||o.insertBefore(l,h)}}}},{key:"_execute_array",value:function(e){var r,i=this,n=[],s=[],a=[];nr(e,function(l){l&&(r=l[0],ir(r)?a.push(l):typeof l=="function"?l.call(i):ir(l)&&r==="alias"?n.push(l):ir(l)&&r.indexOf("capture")!==-1&&typeof i[r]=="function"?a.push(l):s.push(l))});var o=function(l,h){nr(l,function(c){if(ir(c[0])){var u=h;Ee(c,function(f){u=u[f[0]].apply(u,f.slice(1))})}else this[c[0]].apply(this,c.slice(1))},h)};o(n,this),o(s,this),o(a,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,r;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((r=this.config.bootstrap)===null||r===void 0?void 0:r.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"captureException",value:function(e,r){var i;(i=this.exceptionAutocapture)===null||i===void 0||i.captureException([e.name,void 0,void 0,void 0,e],r)}},{key:"capture",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oa;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return me.unintializedWarning("posthog.capture");if(!function(h,c){var u=!1;try{var f=h.config.token,p=h.config.respect_dnt,m=h.config.opt_out_capturing_persistence_type,g=h.config.opt_out_capturing_cookie_prefix||void 0,d=h.config.window;f&&(u=wp(f,{respectDnt:p,persistenceType:m,persistencePrefix:g,window:d}))}catch(y){c||console.error("Unexpected error when checking capturing opt-out status: "+y)}return u}(this,!1)){var n=(i=i||oa).transport;if(n&&(i.transport=n),Ct(e)||typeof e!="string")console.error("No event name provided to posthog.capture");else if(!Bg(Lt,this.config.custom_blocked_useragents)){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info();var s={uuid:ei(),event:e,properties:this._calculate_event_properties(e,r||{})};e==="$identify"&&(s.$set=i.$set,s.$set_once=i.$set_once),(s=$g(s,i._noTruncate?null:this.config.properties_string_max_length)).timestamp=i.timestamp||new Date,this.config.debug&&me.log("PostHog.js send",s);var a=JSON.stringify(s),o=this.config.api_host+(i.endpoint||"/e/"),l=i!==oa;return!this.config.request_batching||l&&!i._batchKey||i.send_instantly?this.__compress_and_send_json_request(o,a,i):this._requestQueue.enqueue(o,s,i),this._invokeCaptureHooks(e,s),s}}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,r){this.config._onCapture(e,r),Ee(this.__captureHooks,function(i){return i(e)})}},{key:"_calculate_event_properties",value:function(e,r){if(!this.persistence||!this.sessionPersistence)return r;var i=this.persistence.remove_event_timer(e),n=ie({},r);if(n.token=this.config.token,e==="$snapshot"){var s=ie(ie({},this.persistence.properties()),this.sessionPersistence.properties());return n.distinct_id=s.distinct_id,n}var a=Ge.properties();if(this.sessionManager){var o=this.sessionManager.checkAndGetSessionAndWindowId(),l=o.sessionId,h=o.windowId;n.$session_id=l,n.$window_id=h}if(this.config.__preview_measure_pageview_stats){var c={};e==="$pageview"?c=this.pageViewManager.doPageView():e==="$pageleave"&&(c=this.pageViewManager.doPageLeave()),n=Xe(n,c)}if(e==="$pageview"&&(n.title=Me.title),e==="$performance_event"){var u=this.persistence.properties();return n.distinct_id=u.distinct_id,n.$current_url=a.$current_url,n}if(i!==void 0){var f=new Date().getTime()-i;n.$duration=parseFloat((f/1e3).toFixed(3))}n=Xe({},Ge.properties(),this.persistence.properties(),this.sessionPersistence.properties(),n);var p=this.config.property_blacklist;ir(p)?Ee(p,function(g){delete n[g]}):console.error("Invalid value for property_blacklist config: "+p);var m=this.config.sanitize_properties;return m&&(n=m(n,e)),n}},{key:"register",value:function(e,r){var i;(i=this.persistence)===null||i===void 0||i.register(e,r)}},{key:"register_once",value:function(e,r,i){var n;(n=this.persistence)===null||n===void 0||n.register_once(e,r,i)}},{key:"register_for_session",value:function(e){var r;(r=this.sessionPersistence)===null||r===void 0||r.register(e)}},{key:"unregister",value:function(e){var r;(r=this.persistence)===null||r===void 0||r.unregister(e)}},{key:"unregister_for_session",value:function(e){var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(e)}},{key:"_register_single",value:function(e,r){this.register(Y({},e,r))}},{key:"getFeatureFlag",value:function(e,r){return this.featureFlags.getFeatureFlag(e,r)}},{key:"getFeatureFlagPayload",value:function(e){var r=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(r)}catch{return r}}},{key:"isFeatureEnabled",value:function(e,r){return this.featureFlags.isFeatureEnabled(e,r)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,r)}},{key:"getEarlyAccessFeatures",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,r)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"onSessionId",value:function(e){var r,i;return(r=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(e))!==null&&r!==void 0?r:function(){}}},{key:"getSurveys",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,r)}},{key:"getActiveMatchingSurveys",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,r)}},{key:"identify",value:function(e,r,i){if(!this.__loaded||!this.persistence)return me.unintializedWarning("posthog.identify");if(e){var n=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=n;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==n&&e!==this.get_property(ha)&&(this.unregister(ha),this.register({distinct_id:e}));var a=this.persistence.get_user_state()==="anonymous";e!==n&&a?(this.persistence.set_user_state("identified"),this.setPersonPropertiesForFlags(r||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:n},{$set:r||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(n)):(r||i)&&this.setPersonProperties(r,i),e!==n&&(this.reloadFeatureFlags(),this.unregister(ba))}else console.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,r){(e||r)&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:r||{}}))}},{key:"group",value:function(e,r,i){if(e&&r){var n=this.getGroups();n[e]!==r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ie(ie({},n),{},Y({},e,r))}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:r,$group_set:i}),this.setGroupPropertiesForFlags(Y({},e,i))),n[e]===r||i||this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,r)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,r)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var r,i,n,s;if(!this.__loaded)return me.unintializedWarning("posthog.reset");var a=this.get_property("$device_id");(r=this.persistence)===null||r===void 0||r.clear(),(i=this.sessionPersistence)===null||i===void 0||i.clear(),(n=this.persistence)===null||n===void 0||n.set_user_state("anonymous"),(s=this.sessionManager)===null||s===void 0||s.resetSessionId();var o=this.config.get_device_id(ei());this.register_once({distinct_id:o,$device_id:e?o:a},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var e,r;return(e=(r=this.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";var r=this.config.ui_host||this.config.api_host,i=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=i.sessionId,s=i.sessionStartTimestamp,a=r+"/replay/"+n;if(e!=null&&e.withTimestamp&&s){var o,l=(o=e.timestampLookBack)!==null&&o!==void 0?o:10;if(!s)return a;var h=Math.max(Math.floor((new Date().getTime()-s)/1e3)-l,0);a+="?t=".concat(h)}return a}},{key:"alias",value:function(e,r){return e===this.get_property(Up)?(me.critical("Attempting to create alias for existing People user - aborting."),-2):(Ct(r)&&(r=this.get_distinct_id()),e!==r?(this._register_single(ha,e),this.capture("$create_alias",{alias:e,distinct_id:r})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var r,i,n=ie({},this.config);xl(e)&&(Xe(this.config,e),this.config.persistence_name||(this.config.persistence_name=this.config.cookie_name),this.config.disable_persistence||(this.config.disable_persistence=this.config.disable_cookie),(r=this.persistence)===null||r===void 0||r.update_config(this.config),(i=this.sessionPersistence)===null||i===void 0||i.update_config(this.config),Oe.is_supported()&&Oe.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Tt.DEBUG=!0),this.sessionRecording&&e.disable_session_recording!==void 0&&n.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))}},{key:"startSessionRecording",value:function(){this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started())}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_property",value:function(e){var r;return(r=this.persistence)===null||r===void 0?void 0:r.props[e]}},{key:"getSessionProperty",value:function(e){var r;return(r=this.sessionPersistence)===null||r===void 0?void 0:r.props[e]}},{key:"toString",value:function(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:lt;return r!==lt&&(r=lt+"."+r),r}},{key:"_gdpr_init",value:function(){this.config.opt_out_capturing_persistence_type==="localStorage"&&Oe.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.config.opt_out_capturing_by_default&&!sr.get("ph_optout")||(sr.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.config.opt_out_persistence_by_default}))}},{key:"_gdpr_update_persistence",value:function(e){var r,i,n,s,a;if(e&&e.clear_persistence)n=!0;else{if(!e||!e.enable_persistence)return;n=!1}this.config.disable_persistence||((r=this.persistence)===null||r===void 0?void 0:r.disabled)===n||(s=this.persistence)===null||s===void 0||s.set_disabled(n),this.config.disable_persistence||((i=this.sessionPersistence)===null||i===void 0?void 0:i.disabled)===n||(a=this.sessionPersistence)===null||a===void 0||a.set_disabled(n)}},{key:"_gdpr_call_func",value:function(e,r){return r=Xe({capture:this.capture.bind(this),persistence_type:this.config.opt_out_capturing_persistence_type,cookie_prefix:this.config.opt_out_capturing_cookie_prefix,cookie_expiration:this.config.cookie_expiration,cross_subdomain_cookie:this.config.cross_subdomain_cookie,secure_cookie:this.config.secure_cookie},r||{}),Oe.is_supported()||r.persistence_type!=="localStorage"||(r.persistence_type="cookie"),e(this.config.token,{capture:r.capture,captureEventName:r.capture_event_name,captureProperties:r.capture_properties,persistenceType:r.persistence_type,persistencePrefix:r.cookie_prefix,cookieExpiration:r.cookie_expiration,crossSubdomainCookie:r.cross_subdomain_cookie,secureCookie:r.secure_cookie})}},{key:"opt_in_capturing",value:function(e){e=Xe({enable_persistence:!0},e||{}),this._gdpr_call_func(u0,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var r=Xe({clear_persistence:!0},e||{});this._gdpr_call_func(p0,r),this._gdpr_update_persistence(r)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(d0,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(wp,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var r=Xe({enable_persistence:!0},e??{});this._gdpr_call_func(f0,r),this._gdpr_update_persistence(r)}},{key:"debug",value:function(e){e===!1?(q.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(q.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),t}();(function(t,e){for(var r=0;r<e.length;r++)t.prototype[e[r]]=jp(t.prototype[e[r]])})(ql,["identify"]);var br={},ty=function(){qe.init=function(t,e,r){if(r)return qe[r]||(qe[r]=br[r]=Ol(t||"",e||{},r,function(n){qe[r]=br[r]=n,n._loaded()})),qe[r];var i=qe;return br[lt]?i=br[lt]:t&&(i=Ol(t,e||{},lt,function(n){br[lt]=n,n._loaded()}),br[lt]=i),qe=i,Gl===On.INIT_SNIPPET&&(q[lt]=qe),Ee(br,function(n,s){s!==lt&&(qe[s]=n)}),i}},ry=function(){function t(){t.done||(t.done=!0,sd=!1,Ee(br,function(e){e._dom_loaded()}))}Me.addEventListener&&(Me.readyState==="complete"?t():Me.addEventListener("DOMContentLoaded",t,!1)),Dn(q,"load",t,!0)},ad=(Gl=On.INIT_MODULE,qe=new ql,ty(),qe.init(),ry(),qe);var od=ad.init("phc_OTZ3wJ6VemgVupCRKS5Sbqb9Ks0JYe0hMYZPtLwl0nu",{api_host:"https://ph-eu.molin.ai",ui_host:"https://eu.posthog.com",secure_cookie:document.location.protocol==="https:",persistence:"cookie",autocapture:!1,rageclick:!1,capture_pageview:!0,disable_session_recording:!0},"MolinShopAI");function bt(t,e){if(!od)throw new Error("Failed to initialize PostHog");od.capture(t,e)}var Ui,Sa,It,We,Ea,ld,ka,hd,Pa,cd,Aa,ud,Ca,pd,Ta,dd,Ia,fd,xa=class extends Ve(Ce){constructor(){super();se(this,Ui);se(this,Ea);se(this,ka);se(this,Pa);se(this,Aa);se(this,Ca);se(this,Ta);se(this,Ia);se(this,It,new ta(this,{url:(r,{resume:i}={})=>{let n=new URL(this.config.wsApiUrl);return n.searchParams.set("widgetId",this.widgetId),n.searchParams.set("resume",i?"1":""),n.searchParams.set("conversationId",r),n},onReconnect:()=>{},onError:r=>{console.error("ws error",r),bt("ShopAssistant: error",{widgetId:this.widgetId,error:"websocket onError"})},onClose:()=>{},onNewMessage:r=>{r.role==="assistant"&&bt("ShopAssistant: user received bot message (streaming started)",{widgetId:this.widgetId,message:r})},onUpdateMessage:r=>{},onMessageDone:r=>{let i={...N(this,It)?.messages.find(n=>n.id===r.message?.id)};Object.assign(i,r.message),i.role==="assistant"&&bt("ShopAssistant: user received bot message (streaming ended)",{widgetId:this.widgetId,text:i.content??"",message:i,usage_TOKENS_COMPLETION:r.message.usage.TOKENS_COMPLETION})},onMessageError:r=>{console.error("ws message error",r),r.message&&N(this,We)&&alert(r.message),bt("ShopAssistant: error",{widgetId:this.widgetId,error:"websocket ERROR message type: "+r.message})},persistConversationState:(r,i)=>{let n={conversationId:r,messages:i};localStorage.setItem(N(this,Ui,Sa),JSON.stringify(n))},restoreConversationState:()=>{try{let r=JSON.parse(localStorage.getItem(N(this,Ui,Sa))||"{}");return!(typeof r.conversationId=="string"&&r.conversationId)||!(Array.isArray(r.messages)&&r.messages.every(i=>typeof i=="object"&&i))?void 0:{conversationId:r.conversationId,messages:r.messages}}catch(r){console.error(r)}},onReset:()=>{localStorage.removeItem(N(this,Ui,Sa))}}));se(this,We,!1);this.widgetId="",this.config}render(){console.assert(this.widgetId,"widget id is required"),console.assert(this.config,"config is required");let r=Object.entries(this.config.bubble.position).filter(([s,a])=>a).map(([s,a])=>`${s}-[${a}]`).reduce((s,a)=>(s[a]=!0,s),{}),i={bottom:"72px"},n=Object.entries(this.config.bubble.position).filter(([s,a])=>a).map(([s,a])=>`sm:${s}-[calc(${[i[s],a].filter(o=>!!o).join("+")})]`).reduce((s,a)=>(s[a]=!0,s),{});return pe`
|
|
414
|
-
<mw-bubble class="${ip(r)} fixed z-
|
|
413
|
+
`),l=s;l<o.length;l++){var h=o[l];if(!(h.length>1024)){var c=Ip.test(h)?h.replace(Ip,"$1"):h;if(!c.match(/\S*Error: /)){var u,f=or(i);try{for(f.s();!(u=f.n()).done;){var p=(0,u.value)(c);if(p){a.push(p);break}}}catch(m){f.e(m)}finally{f.f()}if(a.length>=Mp)break}}}return function(m){if(!m.length)return[];var g=m.slice(0,Mp);return g.reverse(),g.map(function(d){return ie(ie({},d),{},{filename:d.filename||g[g.length-1].filename,function:d.function||"?"})})}(a)}}.apply(void 0,[[30,function(t){var e=z0.exec(t);if(e){if(e[2]&&e[2].indexOf("eval")===0){var r=j0.exec(e[2]);r&&(e[2]=r[1],e[3]=r[2],e[4]=r[3])}var i=ar(Dp(e[1]||pa,e[2]),2),n=i[0];return gl(i[1],n,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}}],[50,function(t){var e=H0.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=G0.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var i=e[3],n=e[1]||pa,s=ar(Dp(n,i),2);return n=s[0],gl(i=s[1],n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}],[40,function(t){var e=q0.exec(t);return e?gl(e[2],e[1]||pa,+e[3],e[4]?+e[4]:void 0):void 0}]]),Dp=function(t,e){var r=t.indexOf("safari-extension")!==-1,i=t.indexOf("safari-web-extension")!==-1;return r||i?[t.indexOf("@")!==-1?t.split("@")[0]:pa,r?"safari-extension:".concat(e):"safari-web-extension:".concat(e)]:[t,e]},W0=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Z0=/Minified React error #\d+;/i;function Y0(t){var e=t.stacktrace||t.stack||"",r=function(i){if(i){if(typeof i.framesToPop=="number")return i.framesToPop;if(Z0.test(i.message))return 1}return 0}(t);try{return U0(e,r)}catch{}return[]}function yl(t){var e=Y0(t);return{$exception_type:t.name,$exception_message:t.message,$exception_stack_trace_raw:JSON.stringify(e)}}function J0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(!(n.length>e))return i===r.length||n.length<=e?n:"".concat(n.slice(0,e),"...")}return""}function Fp(t){var e=ar(t,5),r=e[0],i=e[1],n=e[2],s=e[3],a=e[4],o={};if(a===void 0&&typeof r=="string"){var l="Error",h=r,c=r.match(W0);c&&(l=c[1],h=c[2]),o={$exception_type:l,$exception_message:h}}var u=a||r;if(ml(u)||function(g){return ua(g,"DOMException")}(u)){var f=u;if(function(g){return"stack"in g}(u))o=yl(u);else{var p=f.name||(ml(f)?"DOMError":"DOMException"),m=f.message?"".concat(p,": ").concat(f.message):p;o=function(g){return{$exception_type:"Error",$exception_message:g}}(m),o.$exception_type=ml(f)?"DOMError":"DOMException",o.$exception_message=o.$exception_message||m}"code"in f&&(o.$exception_DOMException_code="".concat(f.code))}else(function(g){return ua(g,"ErrorEvent")})(u)&&u.error?o=yl(u.error):function(g){switch(Object.prototype.toString.call(g)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return nd(g,Error)}}(u)?o=yl(u):function(g){return ua(g,"Object")}(u)||Cp(u)?(o=function(g){return{$exception_type:Cp(g)?g.constructor.name:"Error",$exception_message:"Non-Error ".concat("exception"," captured with keys: ",J0(g))}}(u),o.$exception_is_synthetic=!0):(o.$exception_type=o.$exception_type||"Error",o.$exception_message=o.$exception_message||u,o.$exception_is_synthetic=!0);return ie(ie(ie(ie({},o),{},{$exception_type:o.$exception_type||"UnknownErrorType",$exception_message:o.$exception_message||""},i?{$exception_source:i}:{}),n?{$exception_lineno:n}:{}),s?{$exception_colno:s}:{})}var On,Gl,qe,X0=function(){function t(e){De(this,t),Y(this,"originalOnErrorHandler",void 0),Y(this,"originalOnUnhandledRejectionHandler",void 0),Y(this,"errorsToIgnore",[]),this.instance=e}return Fe(t,[{key:"debugLog",value:function(){if(this.instance.config.debug){for(var e,r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];(e=console).log.apply(e,["PostHog.js [PostHog.ExceptionObserver]"].concat(i))}}},{key:"startCapturing",value:function(){var e;if(this.isEnabled()&&((e=q.onerror)===null||e===void 0||!e.__POSTHOG_INSTRUMENTED__))try{this.originalOnErrorHandler=q.onerror,q.onerror=function(){for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];return this.captureException(i),!!this.originalOnErrorHandler&&this.originalOnErrorHandler.apply(this,i)}.bind(this),q.onerror.__POSTHOG_INSTRUMENTED__=!0,this.originalOnUnhandledRejectionHandler=q.onunhandledrejection,q.onunhandledrejection=function(){for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];var s=function(a){var o=ar(a,1)[0],l=o;try{"reason"in o?l=o.reason:"detail"in o&&"reason"in o.detail&&(l=o.detail.reason)}catch{}var h={};return(h=Tp(l)?{$exception_message:"Non-Error promise rejection captured with value: ".concat(String(l))}:Fp([l])).$exception_handled=!1,ie(ie({},h),{},{$exception_type:h.$exception_type="UnhandledRejection",$exception_message:h.$exception_message=h.$exception_message||o.reason||String(l)})}(i);return this.sendExceptionEvent(s),!this.originalOnUnhandledRejectionHandler||this.originalOnUnhandledRejectionHandler.apply(q,i)}.bind(this),q.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0}catch(r){console.error("PostHog failed to start exception autocapture",r),this.stopCapturing()}}},{key:"stopCapturing",value:function(){var e,r;this.originalOnErrorHandler!==void 0&&(q.onerror=this.originalOnErrorHandler,this.originalOnErrorHandler=null),(e=q.onerror)===null||e===void 0||delete e.__POSTHOG_INSTRUMENTED__,this.originalOnUnhandledRejectionHandler!==void 0&&(q.onunhandledrejection=this.originalOnUnhandledRejectionHandler,this.originalOnUnhandledRejectionHandler=null),(r=q.onunhandledrejection)===null||r===void 0||delete r.__POSTHOG_INSTRUMENTED__}},{key:"isCapturing",value:function(){var e;return!((e=q.onerror)===null||e===void 0||!e.__POSTHOG_INSTRUMENTED__)}},{key:"isEnabled",value:function(){var e;return(e=this.remoteEnabled)!==null&&e!==void 0&&e}},{key:"afterDecideResponse",value:function(e){var r=e.autocaptureExceptions;if(this.remoteEnabled=!!r||!1,!Tp(r)&&"errors_to_ignore"in r&&Array.isArray(r.errors_to_ignore)){var i=r.errors_to_ignore;this.errorsToIgnore=i.map(function(n){return new RegExp(n)})}this.isEnabled()?(this.startCapturing(),this.debugLog("Remote config for exception autocapture is enabled, starting",r)):this.debugLog("Remote config for exception autocapture is disabled, not starting",r)}},{key:"captureException",value:function(e,r){var i=Fp(e);if(this.errorsToIgnore.some(function(a){return a.test(i.$exception_message||"")}))this.debugLog("Ignoring exception based on remote config",i);else{var n=ie(ie({},r),i),s=this.instance.config.ui_host||this.instance.config.api_host;i.$exception_personURL=s+"/person/"+this.instance.get_distinct_id(),this.sendExceptionEvent(n)}}},{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{transport:"XHR",method:"POST",endpoint:"/e/",_noTruncate:!0,_batchKey:"exceptionEvent"})}}]),t}(),K0=function(){function t(e){De(this,t),this.instance=e}return Fe(t,[{key:"getSurveys",value:function(e){var r=this,i=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=this.instance.get_property(Pl);if(n&&!i)return e(n);this.instance._send_request("".concat(this.instance.config.api_host,"/api/surveys/?token=").concat(this.instance.config.token),{},{method:"GET"},function(s){var a,o=s.surveys;return(a=r.instance.persistence)===null||a===void 0||a.register(Y({},Pl,o)),e(o)})}},{key:"getActiveMatchingSurveys",value:function(e){var r=this,i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(n){var s=n.filter(function(a){return!(!a.start_date||a.end_date)}).filter(function(a){var o,l;if(!a.conditions)return!0;var h=(o=a.conditions)===null||o===void 0||!o.url||window.location.href.indexOf(a.conditions.url)>-1,c=(l=a.conditions)===null||l===void 0||!l.selector||document.querySelector(a.conditions.selector);return h&&c}).filter(function(a){if(!a.linked_flag_key&&!a.targeting_flag_key)return!0;var o=!a.linked_flag_key||r.instance.featureFlags.isFeatureEnabled(a.linked_flag_key),l=!a.targeting_flag_key||r.instance.featureFlags.isFeatureEnabled(a.targeting_flag_key);return o&&l});return e(s)},i)}}]),t}(),Q0=6e4,ey=function(){function t(){var e=this;De(this,t),Y(this,"limits",{}),Y(this,"checkForLimiting",function(r){try{(JSON.parse(r.responseText).quota_limited||[]).forEach(function(i){me.log("[PostHog RateLimiter] ".concat(i||"events"," is quota limited.")),e.limits[i]=new Date().getTime()+Q0})}catch(i){return void me.error(i)}})}return Fe(t,[{key:"isRateLimited",value:function(e){var r=this.limits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}}]),t}();(function(t){t[t.INIT_MODULE=0]="INIT_MODULE",t[t.INIT_SNIPPET=1]="INIT_SNIPPET"})(On||(On={}));var Fl=function(){},oa={},lt="posthog",da=q.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,sd=!da&&Lt.indexOf("MSIE")===-1&&Lt.indexOf("Mozilla")===-1,Op=function(){var t,e,r;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(Me==null||(t=Me.location)===null||t===void 0||(e=t.hostname)===null||e===void 0?void 0:e.indexOf("herokuapp.com"))===-1,persistence:"cookie",persistence_name:"",cookie_name:"",loaded:Fl,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:!0,debug:!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:void 0,secure_cookie:(q==null||(r=q.location)===null||r===void 0?void 0:r.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,on_xhr_error:function(i){var n="Bad HTTP status: "+i.status+" "+i.statusText;console.error(n)},get_device_id:function(i){return i},_onCapture:Fl,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},Ol=function(t,e,r,i){var n,s=r!==lt&&qe?r?qe[r]:void 0:qe,a={initComplete:!1,syncCode:!1},o=function(l){return function(h){a[l]||(a[l]=!0,a.initComplete&&a.syncCode&&i?.(h))}};if(s&&Gl===On.INIT_MODULE)n=s;else{if(s&&!ir(s))return void console.error("You have already initialized "+r);n=new ql}return n._init(t,e,r,o("initComplete")),n.toolbar.maybeLoadToolbar(),n.sessionRecording=new t0(n),n.sessionRecording.startRecordingIfEnabled(),n.webPerformance=new n0(n),n.webPerformance.startObservingIfEnabled(),n.config.__preview_measure_pageview_stats&&n.pageViewManager.startMeasuringScrollPosition(),n.exceptionAutocapture=new X0(n),n.__autocapture=n.config.autocapture,wr._setIsAutocaptureEnabled(n),wr._isAutocaptureEnabled&&(n.__autocapture=n.config.autocapture,wr.enabledForProject(n.config.token,100,100)?wr.isBrowserSupported()?wr.init(n):(n.__autocapture=!1,me.log("Disabling Automatic Event Collection because this browser is not supported")):(n.__autocapture=!1,me.log("Not in active bucket: disabling Automatic Event Collection."))),Tt.DEBUG=Tt.DEBUG||n.config.debug,s!==void 0&&ir(s)&&(n._execute_array.call(n.people,s.people),n._execute_array(s)),o("syncCode")(n),n},ql=function(){function t(){var e=this;De(this,t),this.config=Op(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=B0,this.segmentIntegration=function(){return V0(e)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.featureFlags=new zg(this),this.toolbar=new h0(this),this.pageViewManager=new N0,this.surveys=new K0(this),this.rateLimiter=new ey,this.people={set:function(r,i,n){var s=typeof r=="string"?Y({},r,i):r;e.setPersonProperties(s),n?.({})},set_once:function(r,i,n){var s=typeof r=="string"?Y({},r,i):r;e.setPersonProperties(void 0,s),n?.({})}}}return Fe(t,[{key:"init",value:function(e,r,i){if(Ct(i))console.error("You must name your new library: init(token, config, name)");else{if(i!==lt){var n=Ol(e,r,i,function(s){qe[i]=s,s._loaded()});return qe[i]=n,n}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var r,i,n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var l,h={segmentRegister:!1,syncCode:!1},c=function(_){return function(){h[_]||(h[_]=!0,h.segmentRegister&&h.syncCode&&o?.(n))}};if(this.set_config(Xe({},Op(),s,{name:a,token:e,callback_fn:(a===lt?a:lt+"."+a)+"._jsc"})),this._jsc=function(){},(q!=null&&(r=q.rrweb)!==null&&r!==void 0&&r.record||q!=null&&q.rrwebRecord)&&(this.__loaded_recorder_version=q==null||(l=q.rrweb)===null||l===void 0?void 0:l.version),this.persistence=new bp(this.config),this._requestQueue=new m0(this._handle_queued_event.bind(this)),this._retryQueue=new M0(this.config.on_xhr_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new L0(this.config,this.persistence),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bp(ie(ie({},this.config),{},{persistence:"sessionStorage"})),this._gdpr_init(),s.segment?(this.config.get_device_id=function(){return s.segment.user().anonymousId()},s.segment.user().id()&&(this.register({distinct_id:s.segment.user().id()}),this.persistence.set_user_state("identified")),s.segment.register(this.segmentIntegration()).then(c("segmentRegister"))):c("segmentRegister")(),((i=s.bootstrap)===null||i===void 0?void 0:i.distinctID)!==void 0){var u,f,p=this.config.get_device_id(ei()),m=(u=s.bootstrap)!==null&&u!==void 0&&u.isIdentifiedID?p:s.bootstrap.distinctID;this.persistence.set_user_state((f=s.bootstrap)!==null&&f!==void 0&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.bootstrap.distinctID,$device_id:m})}if(this._hasBootstrappedFeatureFlags()){var g,d,y=Object.keys(((g=s.bootstrap)===null||g===void 0?void 0:g.featureFlags)||{}).filter(function(_){var x,T;return!((x=s.bootstrap)===null||x===void 0||(T=x.featureFlags)===null||T===void 0||!T[_])}).reduce(function(_,x){var T,S;return _[x]=((T=s.bootstrap)===null||T===void 0||(S=T.featureFlags)===null||S===void 0?void 0:S[x])||!1,_},{}),v=Object.keys(((d=s.bootstrap)===null||d===void 0?void 0:d.featureFlagPayloads)||{}).filter(function(_){return y[_]}).reduce(function(_,x){var T,S,w,M;return(T=s.bootstrap)!==null&&T!==void 0&&(S=T.featureFlagPayloads)!==null&&S!==void 0&&S[x]&&(_[x]=(w=s.bootstrap)===null||w===void 0||(M=w.featureFlagPayloads)===null||M===void 0?void 0:M[x]),_},{});this.featureFlags.receivedFeatureFlags({featureFlags:y,featureFlagPayloads:v})}if(!this.get_distinct_id()){var b=this.config.get_device_id(ei());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_user_state("anonymous")}q.addEventListener&&q.addEventListener("onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),c("syncCode")()}},{key:"_loaded",value:function(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(r){console.error("`loaded` function failed",r)}this._start_queue_if_opted_in(),this.config.capture_pageview&&this.capture("$pageview",{title:Me.title},{send_instantly:!0}),e||(new a0(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.poll())}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||nr(this.__request_queue,function(r){e._send_request.apply(e,bl(r))}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,r){if(Ct(e))return null;if(da)return function(a){e(a,r)};var i=this._jsc,n=""+Math.floor(1e8*Math.random()),s=this.config.callback_fn+"["+n+"]";return i[n]=function(a){delete i[n],e(a,r)},s}},{key:"_handle_unload",value:function(){var e,r;this.config.request_batching?(this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(r=this._retryQueue)===null||r===void 0||r.unload()):this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_handle_queued_event",value:function(e,r,i){var n=JSON.stringify(r);this.__compress_and_send_json_request(e,n,i||oa,Fl)}},{key:"__compress_and_send_json_request",value:function(e,r,i,n){var s=function(h,c,u){return h===Qr.GZipJS?[A0(C0(c),{mtime:0}),ie(ie({},u),{},{blob:!0,urlQueryArgs:{compression:Qr.GZipJS}})]:[{data:Bl(c)},u]}(this.compression[Qr.GZipJS]?Qr.GZipJS:Qr.Base64,r,i),a=ar(s,2),o=a[0],l=a[1];this._send_request(e,o,l,n)}},{key:"_send_request",value:function(e,r,i,n){if(this.__loaded&&this._retryQueue&&!this.rateLimiter.isRateLimited(i._batchKey))if(sd)this.__request_queue.push([e,r,i,n]);else{var s={method:this.config.api_method,transport:this.config.api_transport,verbose:this.config.verbose};i=Xe(s,i||{}),da||(i.method="GET");var a="sendBeacon"in q.navigator&&i.transport==="sendBeacon";if(e=T0(e,i.urlQueryArgs||{},{ip:this.config.ip}),a)try{q.navigator.sendBeacon(e,Hl(r,ie(ie({},i),{},{sendBeacon:!0})))}catch{}else if(da)try{rd({url:e,data:r,headers:this.config.xhr_headers,options:i,callback:n,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.config.on_xhr_error,onResponse:this.rateLimiter.checkForLimiting})}catch(c){console.error(c)}else{var o,l=Me.createElement("script");l.type="text/javascript",l.async=!0,l.defer=!0,l.src=e;var h=Me.getElementsByTagName("script")[0];(o=h.parentNode)===null||o===void 0||o.insertBefore(l,h)}}}},{key:"_execute_array",value:function(e){var r,i=this,n=[],s=[],a=[];nr(e,function(l){l&&(r=l[0],ir(r)?a.push(l):typeof l=="function"?l.call(i):ir(l)&&r==="alias"?n.push(l):ir(l)&&r.indexOf("capture")!==-1&&typeof i[r]=="function"?a.push(l):s.push(l))});var o=function(l,h){nr(l,function(c){if(ir(c[0])){var u=h;Ee(c,function(f){u=u[f[0]].apply(u,f.slice(1))})}else this[c[0]].apply(this,c.slice(1))},h)};o(n,this),o(s,this),o(a,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,r;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((r=this.config.bootstrap)===null||r===void 0?void 0:r.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"captureException",value:function(e,r){var i;(i=this.exceptionAutocapture)===null||i===void 0||i.captureException([e.name,void 0,void 0,void 0,e],r)}},{key:"capture",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oa;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return me.unintializedWarning("posthog.capture");if(!function(h,c){var u=!1;try{var f=h.config.token,p=h.config.respect_dnt,m=h.config.opt_out_capturing_persistence_type,g=h.config.opt_out_capturing_cookie_prefix||void 0,d=h.config.window;f&&(u=wp(f,{respectDnt:p,persistenceType:m,persistencePrefix:g,window:d}))}catch(y){c||console.error("Unexpected error when checking capturing opt-out status: "+y)}return u}(this,!1)){var n=(i=i||oa).transport;if(n&&(i.transport=n),Ct(e)||typeof e!="string")console.error("No event name provided to posthog.capture");else if(!Bg(Lt,this.config.custom_blocked_useragents)){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info();var s={uuid:ei(),event:e,properties:this._calculate_event_properties(e,r||{})};e==="$identify"&&(s.$set=i.$set,s.$set_once=i.$set_once),(s=$g(s,i._noTruncate?null:this.config.properties_string_max_length)).timestamp=i.timestamp||new Date,this.config.debug&&me.log("PostHog.js send",s);var a=JSON.stringify(s),o=this.config.api_host+(i.endpoint||"/e/"),l=i!==oa;return!this.config.request_batching||l&&!i._batchKey||i.send_instantly?this.__compress_and_send_json_request(o,a,i):this._requestQueue.enqueue(o,s,i),this._invokeCaptureHooks(e,s),s}}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,r){this.config._onCapture(e,r),Ee(this.__captureHooks,function(i){return i(e)})}},{key:"_calculate_event_properties",value:function(e,r){if(!this.persistence||!this.sessionPersistence)return r;var i=this.persistence.remove_event_timer(e),n=ie({},r);if(n.token=this.config.token,e==="$snapshot"){var s=ie(ie({},this.persistence.properties()),this.sessionPersistence.properties());return n.distinct_id=s.distinct_id,n}var a=Ge.properties();if(this.sessionManager){var o=this.sessionManager.checkAndGetSessionAndWindowId(),l=o.sessionId,h=o.windowId;n.$session_id=l,n.$window_id=h}if(this.config.__preview_measure_pageview_stats){var c={};e==="$pageview"?c=this.pageViewManager.doPageView():e==="$pageleave"&&(c=this.pageViewManager.doPageLeave()),n=Xe(n,c)}if(e==="$pageview"&&(n.title=Me.title),e==="$performance_event"){var u=this.persistence.properties();return n.distinct_id=u.distinct_id,n.$current_url=a.$current_url,n}if(i!==void 0){var f=new Date().getTime()-i;n.$duration=parseFloat((f/1e3).toFixed(3))}n=Xe({},Ge.properties(),this.persistence.properties(),this.sessionPersistence.properties(),n);var p=this.config.property_blacklist;ir(p)?Ee(p,function(g){delete n[g]}):console.error("Invalid value for property_blacklist config: "+p);var m=this.config.sanitize_properties;return m&&(n=m(n,e)),n}},{key:"register",value:function(e,r){var i;(i=this.persistence)===null||i===void 0||i.register(e,r)}},{key:"register_once",value:function(e,r,i){var n;(n=this.persistence)===null||n===void 0||n.register_once(e,r,i)}},{key:"register_for_session",value:function(e){var r;(r=this.sessionPersistence)===null||r===void 0||r.register(e)}},{key:"unregister",value:function(e){var r;(r=this.persistence)===null||r===void 0||r.unregister(e)}},{key:"unregister_for_session",value:function(e){var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(e)}},{key:"_register_single",value:function(e,r){this.register(Y({},e,r))}},{key:"getFeatureFlag",value:function(e,r){return this.featureFlags.getFeatureFlag(e,r)}},{key:"getFeatureFlagPayload",value:function(e){var r=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(r)}catch{return r}}},{key:"isFeatureEnabled",value:function(e,r){return this.featureFlags.isFeatureEnabled(e,r)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,r)}},{key:"getEarlyAccessFeatures",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,r)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"onSessionId",value:function(e){var r,i;return(r=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(e))!==null&&r!==void 0?r:function(){}}},{key:"getSurveys",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,r)}},{key:"getActiveMatchingSurveys",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,r)}},{key:"identify",value:function(e,r,i){if(!this.__loaded||!this.persistence)return me.unintializedWarning("posthog.identify");if(e){var n=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=n;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==n&&e!==this.get_property(ha)&&(this.unregister(ha),this.register({distinct_id:e}));var a=this.persistence.get_user_state()==="anonymous";e!==n&&a?(this.persistence.set_user_state("identified"),this.setPersonPropertiesForFlags(r||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:n},{$set:r||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(n)):(r||i)&&this.setPersonProperties(r,i),e!==n&&(this.reloadFeatureFlags(),this.unregister(ba))}else console.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,r){(e||r)&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:r||{}}))}},{key:"group",value:function(e,r,i){if(e&&r){var n=this.getGroups();n[e]!==r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ie(ie({},n),{},Y({},e,r))}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:r,$group_set:i}),this.setGroupPropertiesForFlags(Y({},e,i))),n[e]===r||i||this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,r)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,r)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var r,i,n,s;if(!this.__loaded)return me.unintializedWarning("posthog.reset");var a=this.get_property("$device_id");(r=this.persistence)===null||r===void 0||r.clear(),(i=this.sessionPersistence)===null||i===void 0||i.clear(),(n=this.persistence)===null||n===void 0||n.set_user_state("anonymous"),(s=this.sessionManager)===null||s===void 0||s.resetSessionId();var o=this.config.get_device_id(ei());this.register_once({distinct_id:o,$device_id:e?o:a},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var e,r;return(e=(r=this.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";var r=this.config.ui_host||this.config.api_host,i=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=i.sessionId,s=i.sessionStartTimestamp,a=r+"/replay/"+n;if(e!=null&&e.withTimestamp&&s){var o,l=(o=e.timestampLookBack)!==null&&o!==void 0?o:10;if(!s)return a;var h=Math.max(Math.floor((new Date().getTime()-s)/1e3)-l,0);a+="?t=".concat(h)}return a}},{key:"alias",value:function(e,r){return e===this.get_property(Up)?(me.critical("Attempting to create alias for existing People user - aborting."),-2):(Ct(r)&&(r=this.get_distinct_id()),e!==r?(this._register_single(ha,e),this.capture("$create_alias",{alias:e,distinct_id:r})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var r,i,n=ie({},this.config);xl(e)&&(Xe(this.config,e),this.config.persistence_name||(this.config.persistence_name=this.config.cookie_name),this.config.disable_persistence||(this.config.disable_persistence=this.config.disable_cookie),(r=this.persistence)===null||r===void 0||r.update_config(this.config),(i=this.sessionPersistence)===null||i===void 0||i.update_config(this.config),Oe.is_supported()&&Oe.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Tt.DEBUG=!0),this.sessionRecording&&e.disable_session_recording!==void 0&&n.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))}},{key:"startSessionRecording",value:function(){this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started())}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_property",value:function(e){var r;return(r=this.persistence)===null||r===void 0?void 0:r.props[e]}},{key:"getSessionProperty",value:function(e){var r;return(r=this.sessionPersistence)===null||r===void 0?void 0:r.props[e]}},{key:"toString",value:function(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:lt;return r!==lt&&(r=lt+"."+r),r}},{key:"_gdpr_init",value:function(){this.config.opt_out_capturing_persistence_type==="localStorage"&&Oe.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.config.opt_out_capturing_by_default&&!sr.get("ph_optout")||(sr.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.config.opt_out_persistence_by_default}))}},{key:"_gdpr_update_persistence",value:function(e){var r,i,n,s,a;if(e&&e.clear_persistence)n=!0;else{if(!e||!e.enable_persistence)return;n=!1}this.config.disable_persistence||((r=this.persistence)===null||r===void 0?void 0:r.disabled)===n||(s=this.persistence)===null||s===void 0||s.set_disabled(n),this.config.disable_persistence||((i=this.sessionPersistence)===null||i===void 0?void 0:i.disabled)===n||(a=this.sessionPersistence)===null||a===void 0||a.set_disabled(n)}},{key:"_gdpr_call_func",value:function(e,r){return r=Xe({capture:this.capture.bind(this),persistence_type:this.config.opt_out_capturing_persistence_type,cookie_prefix:this.config.opt_out_capturing_cookie_prefix,cookie_expiration:this.config.cookie_expiration,cross_subdomain_cookie:this.config.cross_subdomain_cookie,secure_cookie:this.config.secure_cookie},r||{}),Oe.is_supported()||r.persistence_type!=="localStorage"||(r.persistence_type="cookie"),e(this.config.token,{capture:r.capture,captureEventName:r.capture_event_name,captureProperties:r.capture_properties,persistenceType:r.persistence_type,persistencePrefix:r.cookie_prefix,cookieExpiration:r.cookie_expiration,crossSubdomainCookie:r.cross_subdomain_cookie,secureCookie:r.secure_cookie})}},{key:"opt_in_capturing",value:function(e){e=Xe({enable_persistence:!0},e||{}),this._gdpr_call_func(u0,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var r=Xe({clear_persistence:!0},e||{});this._gdpr_call_func(p0,r),this._gdpr_update_persistence(r)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(d0,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(wp,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var r=Xe({enable_persistence:!0},e??{});this._gdpr_call_func(f0,r),this._gdpr_update_persistence(r)}},{key:"debug",value:function(e){e===!1?(q.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(q.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),t}();(function(t,e){for(var r=0;r<e.length;r++)t.prototype[e[r]]=jp(t.prototype[e[r]])})(ql,["identify"]);var br={},ty=function(){qe.init=function(t,e,r){if(r)return qe[r]||(qe[r]=br[r]=Ol(t||"",e||{},r,function(n){qe[r]=br[r]=n,n._loaded()})),qe[r];var i=qe;return br[lt]?i=br[lt]:t&&(i=Ol(t,e||{},lt,function(n){br[lt]=n,n._loaded()}),br[lt]=i),qe=i,Gl===On.INIT_SNIPPET&&(q[lt]=qe),Ee(br,function(n,s){s!==lt&&(qe[s]=n)}),i}},ry=function(){function t(){t.done||(t.done=!0,sd=!1,Ee(br,function(e){e._dom_loaded()}))}Me.addEventListener&&(Me.readyState==="complete"?t():Me.addEventListener("DOMContentLoaded",t,!1)),Dn(q,"load",t,!0)},ad=(Gl=On.INIT_MODULE,qe=new ql,ty(),qe.init(),ry(),qe);var od=ad.init("phc_OTZ3wJ6VemgVupCRKS5Sbqb9Ks0JYe0hMYZPtLwl0nu",{api_host:"https://ph-eu.molin.ai",ui_host:"https://eu.posthog.com",secure_cookie:document.location.protocol==="https:",persistence:"cookie",autocapture:!1,rageclick:!1,capture_pageview:!0,disable_session_recording:!0},"MolinShopAI");function bt(t,e){if(!od)throw new Error("Failed to initialize PostHog");od.capture(t,e)}var Ui,Sa,It,We,Ea,ld,ka,hd,Pa,cd,Aa,ud,Ca,pd,Ta,dd,Ia,fd,xa=class extends Ve(Ce){constructor(){super();se(this,Ui);se(this,Ea);se(this,ka);se(this,Pa);se(this,Aa);se(this,Ca);se(this,Ta);se(this,Ia);se(this,It,new ta(this,{url:(r,{resume:i}={})=>{let n=new URL(this.config.wsApiUrl);return n.searchParams.set("widgetId",this.widgetId),n.searchParams.set("resume",i?"1":""),n.searchParams.set("conversationId",r),n.searchParams.set("pageUrl",window.location.href),n},onReconnect:()=>{},onError:r=>{console.error("ws error",r),bt("ShopAssistant: error",{widgetId:this.widgetId,error:"websocket onError"})},onClose:()=>{},onNewMessage:r=>{r.role==="assistant"&&bt("ShopAssistant: user received bot message (streaming started)",{widgetId:this.widgetId,message:r})},onUpdateMessage:r=>{},onMessageDone:r=>{let i={...N(this,It)?.messages.find(n=>n.id===r.message?.id)};Object.assign(i,r.message),i.role==="assistant"&&bt("ShopAssistant: user received bot message (streaming ended)",{widgetId:this.widgetId,text:i.content??"",message:i,usage_TOKENS_COMPLETION:r.message.usage.TOKENS_COMPLETION})},onMessageError:r=>{console.error("ws message error",r),r.message&&N(this,We)&&alert(r.message),bt("ShopAssistant: error",{widgetId:this.widgetId,error:"websocket ERROR message type: "+r.message})},persistConversationState:(r,i)=>{let n={conversationId:r,messages:i};localStorage.setItem(N(this,Ui,Sa),JSON.stringify(n))},restoreConversationState:()=>{try{let r=JSON.parse(localStorage.getItem(N(this,Ui,Sa))||"{}");return!(typeof r.conversationId=="string"&&r.conversationId)||!(Array.isArray(r.messages)&&r.messages.every(i=>typeof i=="object"&&i))?void 0:{conversationId:r.conversationId,messages:r.messages}}catch(r){console.error(r)}},onReset:()=>{localStorage.removeItem(N(this,Ui,Sa))}}));se(this,We,!1);this.widgetId="",this.config}render(){console.assert(this.widgetId,"widget id is required"),console.assert(this.config,"config is required");let r=Object.entries(this.config.bubble.position).filter(([s,a])=>a).map(([s,a])=>`${s}-[${a}]`).reduce((s,a)=>(s[a]=!0,s),{}),i={bottom:"72px"},n=Object.entries(this.config.bubble.position).filter(([s,a])=>a).map(([s,a])=>`sm:${s}-[calc(${[i[s],a].filter(o=>!!o).join("+")})]`).reduce((s,a)=>(s[a]=!0,s),{});return pe`
|
|
414
|
+
<mw-bubble class="${ip(r)} fixed z-[99999999]" @click=${ue(this,Pa,cd)} ?dialog-shown="${N(this,We)}" bubble-image-url="${this.config.bubble?.imageUrl||""}"></mw-bubble>
|
|
415
415
|
|
|
416
416
|
<div id="dialog" class="${N(this,We)?"visible opacity-100 translate-y-0":"invisible opacity-0 translate-y-3"} ${Object.keys(n).join(" ")} fixed bottom-0 left-0 right-0 top-0 z-[99999999] overflow-hidden bg-white font-sans text-[16px] leading-normal text-gray-800 subpixel-antialiased shadow-2xl transition-all sm:left-auto sm:top-auto sm:h-4/5 sm:max-h-[800px] sm:w-5/6 sm:max-w-[420px] sm:rounded-2xl">
|
|
417
417
|
<div class="mx-auto flex h-full w-full max-w-4xl flex-col">
|