@askdialog/dialog-vue 1.0.23 → 1.0.24-beta.2

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.
@@ -1,7 +1,7 @@
1
- (function(Pe,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],S):(Pe=typeof globalThis<"u"?globalThis:Pe||self,S(Pe["dialog-vue"]={},Pe.Vue))})(this,function(Pe,S){"use strict";var xr;(function(r){r.OPEN_ASSISTANT="open_assistant",r.CLOSE_ASSISTANT="close_assistant",r.SEND_MESSAGE="PRODUCT_QUESTION",r.SEND_GENERIC_QUESTION="GENERIC_QUESTION"})(xr||(xr={}));var Cr;(function(r){r.USER_OPENED_ASSISTANT="userOpenedAssistant",r.USER_CLOSED_ASSISTANT="userClosedAssistant",r.USER_SENT_MESSAGE="userSentMessage",r.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",r.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",r.USER_ADDED_TO_CART="userAddedToCart",r.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",r.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(Cr||(Cr={}));var _e,p=typeof window<"u"?window:void 0,te=typeof globalThis<"u"?globalThis:p,Ir=Array.prototype,Pr=Ir.forEach,Tr=Ir.indexOf,se=te==null?void 0:te.navigator,E=te==null?void 0:te.document,ie=te==null?void 0:te.location,hi=te==null?void 0:te.fetch,pi=te!=null&&te.XMLHttpRequest&&"withCredentials"in new te.XMLHttpRequest?te.XMLHttpRequest:void 0,Fr=te==null?void 0:te.AbortController,G=se==null?void 0:se.userAgent,P=p??{},be={DEBUG:!1,LIB_VERSION:"1.236.4"},gi="$copy_autocapture",po=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(r){r.GZipJS="gzip-js",r.Base64="base64"})(_e||(_e={}));var go=["fatal","error","warning","log","info","debug"];function F(r,e){return r.indexOf(e)!==-1}var Ot=function(r){return r.trim()},vi=function(r){return r.replace(/^\$/,"")},vo=Array.isArray,Rr=Object.prototype,$r=Rr.hasOwnProperty,At=Rr.toString,N=vo||function(r){return At.call(r)==="[object Array]"},oe=r=>typeof r=="function",q=r=>r===Object(r)&&!N(r),Xe=r=>{if(q(r)){for(var e in r)if($r.call(r,e))return!1;return!0}return!1},k=r=>r===void 0,j=r=>At.call(r)=="[object String]",fi=r=>j(r)&&r.trim().length===0,Te=r=>r===null,$=r=>k(r)||Te(r),K=r=>At.call(r)=="[object Number]",we=r=>At.call(r)==="[object Boolean]",fo=r=>r instanceof FormData,mo=r=>F(po,r),Or=r=>{var e={_log:function(t){if(p&&(be.DEBUG||P.POSTHOG_DEBUG)&&!k(p.console)&&p.console){for(var i=("__rrweb_original__"in p.console[t])?p.console[t].__rrweb_original__:p.console[t],s=arguments.length,n=new Array(s>1?s-1:0),o=1;o<s;o++)n[o-1]=arguments[o];i(r,...n)}},info:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e._log("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e._log("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e._log("error",...i)},critical:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];console.error(r,...i)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling ".concat(t))},createLogger:t=>Or("".concat(r," ").concat(t))};return e},C=Or("[PostHog.js]"),J=C.createLogger,yo=J("[ExternalScriptsLoader]"),Ar=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return yo.warn("".concat(e," was requested but loading of external scripts is disabled.")),t("Loading of external scripts is disabled");var i=E==null?void 0:E.querySelectorAll("script");if(i){for(var s=0;s<i.length;s++)if(i[s].src===e)return t()}var n=()=>{if(!E)return t("document not found");var o=E.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=e,o.onload=c=>t(void 0,c),o.onerror=c=>t(c),r.config.prepare_external_dependency_script&&(o=r.config.prepare_external_dependency_script(o)),!o)return t("prepare_external_dependency_script returned null");var a,l=E.querySelectorAll("body > script");l.length>0?(a=l[0].parentNode)===null||a===void 0||a.insertBefore(o,l[0]):E.body.appendChild(o)};E!=null&&E.body?n():E==null||E.addEventListener("DOMContentLoaded",n)};function Lr(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,i)}return t}function f(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lr(Object(t),!0).forEach(function(i){w(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Lr(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function w(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mr(r,e){if(r==null)return{};var t,i,s=function(o,a){if(o==null)return{};var l,c,d={},u=Object.keys(o);for(c=0;c<u.length;c++)l=u[c],a.indexOf(l)>=0||(d[l]=o[l]);return d}(r,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);for(i=0;i<n.length;i++)t=n[i],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(r,t)&&(s[t]=r[t])}return s}P.__PosthogExtensions__=P.__PosthogExtensions__||{},P.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/".concat(e,".js")+"?v=".concat(r.version);if(e==="remote-config"&&(i="/array/".concat(r.config.token,"/config.js")),e==="toolbar"){var s=3e5,n=Math.floor(Date.now()/s)*s;i="".concat(i,"&t=").concat(n)}var o=r.requestRouter.endpointFor("assets",i);Ar(r,o,t)},P.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);Ar(r,i,t)};var Lt={};function Fe(r,e,t){if(N(r)){if(Pr&&r.forEach===Pr)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Lt)return}}}function O(r,e,t){if(!$(r)){if(N(r))return Fe(r,e,t);if(fo(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Lt)return}else for(var s in r)if($r.call(r,s)&&e.call(t,r[s],s)===Lt)return}}var H=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Fe(t,function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])}),r},Mt=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Fe(t,function(s){Fe(s,function(n){r.push(n)})}),r};function Dt(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var Dr=function(r){try{return r()}catch{return}},bo=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){C.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),C.critical(s)}}},Nt=function(r){var e={};return O(r,function(t,i){(j(t)&&t.length>0||K(t))&&(e[i]=t)}),e};function wo(r,e){return t=r,i=n=>j(n)&&!Te(e)?n.slice(0,e):n,s=new Set,function n(o,a){return o!==Object(o)?i?i(o,a):o:s.has(o)?void 0:(s.add(o),N(o)?(l=[],Fe(o,c=>{l.push(n(c))})):(l={},O(o,(c,d)=>{s.has(c)||(l[d]=n(c,d))})),l);var l}(t);var t,i,s}var So=["herokuapp.com","vercel.app","netlify.app"];function ko(r){var e=r==null?void 0:r.hostname;if(!j(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of So)if(t===i)return!1;return!0}function Nr(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function B(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r==null||r.addEventListener(e,t,{capture:s,passive:n})}var qr="$people_distinct_id",gt="__alias",vt="__timers",Br="$autocapture_disabled_server_side",mi="$heatmaps_enabled_server_side",Ur="$exception_capture_enabled_server_side",jr="$web_vitals_enabled_server_side",Hr="$dead_clicks_enabled_server_side",zr="$web_vitals_allowed_metrics",yi="$session_recording_enabled_server_side",Vr="$console_log_recording_enabled_server_side",Wr="$session_recording_network_payload_capture",Gr="$session_recording_masking",Kr="$session_recording_canvas_recording",Jr="$replay_sample_rate",Yr="$replay_minimum_duration",Qr="$replay_script_config",qt="$sesid",ft="$session_is_sampled",bi="$session_recording_url_trigger_activated_session",wi="$session_recording_event_trigger_activated_session",Ze="$enabled_feature_flags",Bt="$early_access_features",Si="$feature_flag_details",mt="$stored_person_properties",Ue="$stored_group_properties",ki="$surveys",Ut="$surveys_activated",jt="$flag_call_reported",Se="$user_state",Ei="$client_session_props",xi="$capture_rate_limit",Ci="$initial_campaign_params",Ii="$initial_referrer_info",Pi="$initial_person_info",Ht="$epp",Xr="__POSTHOG_TOOLBAR__",Zr="$posthog_cookieless",Eo=[qr,gt,"__cmpns",vt,yi,mi,qt,Ze,Se,Bt,Si,Ue,mt,ki,jt,Ei,xi,Ci,Ii,Ht];function es(r){var e;return r instanceof Element&&(r.id===Xr||!((e=r.closest)===null||e===void 0||!e.call(r,".toolbar-global-fade-container")))}function zt(r){return!!r&&r.nodeType===1}function Re(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function ts(r){return!!r&&r.nodeType===3}function is(r){return!!r&&r.nodeType===11}function Ti(r){return r?Ot(r).split(/\s+/):[]}function rs(r){var e=p==null?void 0:p.location.href;return!!(e&&r&&r.some(t=>e.match(t)))}function Vt(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return Ti(e)}function ss(r){return $(r)?null:Ot(r).split(/(\s+)/).filter(e=>et(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Wt(r){var e="";return Ri(r)&&!as(r)&&r.childNodes&&r.childNodes.length&&O(r.childNodes,function(t){var i;ts(t)&&t.textContent&&(e+=(i=ss(t.textContent))!==null&&i!==void 0?i:"")}),Ot(e)}function ns(r){return k(r.target)?r.srcElement||null:(e=r.target)!==null&&e!==void 0&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Fi=["a","button","form","input","select","textarea","label"];function os(r){var e=r.parentNode;return!(!e||!zt(e))&&e}function xo(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!p||!r||Re(r,"html")||!zt(r)||t!=null&&t.url_allowlist&&!rs(t.url_allowlist)||t!=null&&t.url_ignorelist&&rs(t.url_ignorelist))return!1;if(t!=null&&t.dom_event_allowlist){var n=t.dom_event_allowlist;if(n&&!n.some(_=>e.type===_))return!1}for(var o=!1,a=[r],l=!0,c=r;c.parentNode&&!Re(c,"body");)if(is(c.parentNode))a.push(c.parentNode.host),c=c.parentNode.host;else{if(!(l=os(c)))break;if(i||Fi.indexOf(l.tagName.toLowerCase())>-1)o=!0;else{var d=p.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(o=!0)}a.push(l),c=l}if(!function(_,g){var v=g==null?void 0:g.element_allowlist;if(k(v))return!0;var b=function(x){if(v.some(I=>x.tagName.toLowerCase()===I))return{v:!0}};for(var y of _){var m=b(y);if(typeof m=="object")return m.v}return!1}(a,t)||!function(_,g){var v=g==null?void 0:g.css_selector_allowlist;if(k(v))return!0;var b=function(x){if(v.some(I=>x.matches(I)))return{v:!0}};for(var y of _){var m=b(y);if(typeof m=="object")return m.v}return!1}(a,t))return!1;var u=p.getComputedStyle(r);if(u&&u.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var h=r.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return o?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Fi.indexOf(h)>-1||r.getAttribute("contenteditable")==="true")}}function Ri(r){for(var e=r;e.parentNode&&!Re(e,"body");e=e.parentNode){var t=Vt(e);if(F(t,"ph-sensitive")||F(t,"ph-no-capture"))return!1}if(F(Vt(r),"ph-include"))return!0;var i=r.type||"";if(j(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(j(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function as(r){return!!(Re(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Re(r,"select")||Re(r,"textarea")||r.getAttribute("contenteditable")==="true")}var ls="(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})",Co=new RegExp("^(?:".concat(ls,")$")),Io=new RegExp(ls),us="\\d{3}-?\\d{2}-?\\d{4}",Po=new RegExp("^(".concat(us,")$")),To=new RegExp("(".concat(us,")"));function et(r){var e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!($(r)||j(r)&&(r=Ot(r),(e?Co:Io).test((r||"").replace(/[- ]/g,""))||(e?Po:To).test(r)))}function cs(r){var e=Wt(r);return et(e="".concat(e," ").concat(ds(r)).trim())?e:""}function ds(r){var e="";return r&&r.childNodes&&r.childNodes.length&&O(r.childNodes,function(t){var i;if(t&&((i=t.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{var s=Wt(t);e="".concat(e," ").concat(s).trim(),t.childNodes&&t.childNodes.length&&(e="".concat(e," ").concat(ds(t)).trim())}catch(n){C.error("[AutoCapture]",n)}}),e}function Fo(r){return function(e){var t=e.map(i=>{var s,n,o="";if(i.tag_name&&(o+=i.tag_name),i.attr_class)for(var a of(i.attr_class.sort(),i.attr_class))o+=".".concat(a.replace(/"/g,""));var l=f(f(f(f({},i.text?{text:i.text}:{}),{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{}),i.attr_id?{attr_id:i.attr_id}:{}),i.attributes),c={};return Dt(l).sort((d,u)=>{var[h]=d,[_]=u;return h.localeCompare(_)}).forEach(d=>{var[u,h]=d;return c[_s(u.toString())]=_s(h.toString())}),o+=":",o+=Dt(l).map(d=>{var[u,h]=d;return"".concat(u,'="').concat(h,'"')}).join("")});return t.join(";")}(function(e){return e.map(t=>{var i,s,n={text:(i=t.$el_text)===null||i===void 0?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)===null||s===void 0?void 0:s.slice(0,2048),attr_class:Ro(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dt(t).filter(o=>{var[a]=o;return a.indexOf("attr__")===0}).forEach(o=>{var[a,l]=o;return n.attributes[a]=l}),n})}(r))}function _s(r){return r.replace(/"|\\"/g,'\\"')}function Ro(r){var e=r.attr__class;return e?N(e)?e:Ti(e):void 0}class hs{constructor(){this.clicks=[]}isRageClick(e,t,i){var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<30&&i-s.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var $o=["localhost","127.0.0.1"],tt=r=>{var e=E==null?void 0:E.createElement("a");return k(e)?null:(e.href=r,e)},Oo=function(r){var e,t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",s=[];return O(r,function(n,o){k(n)||k(o)||o==="undefined"||(e=encodeURIComponent((a=>a instanceof File)(n)?n.name:n.toString()),t=encodeURIComponent(o),s[s.length]=t+"="+e)}),s.join(i)},Gt=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!N(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{C.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},$i=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),d=[],u=0;u<c.length;u++){var h=c[u].split("=");N(h)&&(e.includes(h[0])?d.push(h[0]+"="+t):d.push(c[u]))}var _=l;return a!=null&&(_+="?"+d.join("&")),n!=null&&(_+="#"+n),_},Kt=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ps=J("[AutoCapture]");function Oi(r,e){return e.length>r?e.slice(0,r)+"...":e}function Ao(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!zt(e));return e}function Lo(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};Fi.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=Oi(1024,cs(r)):n.$el_text=Oi(1024,Wt(r)));var o=Vt(r);o.length>0&&(n.classes=o.filter(function(d){return d!==""})),O(r.attributes,function(d){var u;if((!as(r)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(i==null||!i.includes(d.name))&&!e&&et(d.value)&&(u=d.name,!j(u)||u.substring(0,10)!=="_ngcontent"&&u.substring(0,7)!=="_nghost")){var h=d.value;d.name==="class"&&(h=Ti(h).join(" ")),n["attr__"+d.name]=Oi(1024,h)}});for(var a=1,l=1,c=r;c=Ao(c);)a++,c.tagName===r.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Mo(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],d=r;d.parentNode&&!Re(d,"body");)is(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var u,h=[],_={},g=!1,v=!1;if(O(c,I=>{var R=Ri(I);I.tagName.toLowerCase()==="a"&&(g=I.getAttribute("href"),g=R&&g&&et(g)&&g),F(Vt(I),"ph-no-capture")&&(v=!0),h.push(Lo(I,n,o,a));var A=function(L){if(!Ri(L))return{};var T={};return O(L.attributes,function(D){if(D.name&&D.name.indexOf("data-ph-capture-attribute")===0){var V=D.name.replace("data-ph-capture-attribute-",""),pe=D.value;V&&pe&&et(pe)&&(T[V]=pe)}}),T}(I);H(_,A)}),v)return{props:{},explicitNoCapture:v};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=cs(r):h[0].$el_text=Wt(r)),g){var b,y;h[0].attr__href=g;var m=(b=tt(g))===null||b===void 0?void 0:b.host,x=p==null||(y=p.location)===null||y===void 0?void 0:y.host;m&&x&&m!==x&&(u=g)}return{props:H({$event_type:s.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:Fo(h)},(t=h[0])!==null&&t!==void 0&&t.$el_text?{$el_text:(i=h[0])===null||i===void 0?void 0:i.$el_text}:{},u&&s.type==="click"?{$external_click_url:u}:{},_)}}class Do{constructor(e){w(this,"_initialized",!1),w(this,"_isDisabledServerSide",null),w(this,"rageclicks",new hs),w(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get _config(){var e,t,i=q(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)===null||e===void 0?void 0:e.map(s=>new RegExp(s)),i.url_ignorelist=(t=i.url_ignorelist)===null||t===void 0?void 0:t.map(s=>new RegExp(s)),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(p&&E){var e=i=>{i=i||(p==null?void 0:p.event);try{this._captureEvent(i)}catch(s){ps.error("Failed to capture event",s)}};if(B(E,"submit",e,{capture:!0}),B(E,"change",e,{capture:!0}),B(E,"click",e,{capture:!0}),this._config.capture_copied_text){var t=i=>{i=i||(p==null?void 0:p.event),this._captureEvent(i,gi)};B(E,"copy",t,{capture:!0}),B(E,"cut",t,{capture:!0})}}}else ps.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Br]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return(t=this._elementSelectors)===null||t===void 0||t.forEach(s=>{var n=E==null?void 0:E.querySelectorAll(s);n==null||n.forEach(o=>{e===o&&i.push(s)})}),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)===null||e===void 0?void 0:e.props[Br],s=this._isDisabledServerSide;if(Te(s)&&!we(i)&&!this.instance.config.advanced_disable_decide)return!1;var n=(t=this._isDisabledServerSide)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}_captureEvent(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var i,s=ns(e);ts(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!==null&&i!==void 0&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._captureEvent(e,"$rageclick");var n=t===gi;if(s&&xo(s,e,this._config,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Mo(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),t===gi){var c,d=ss(p==null||(c=p.getSelection())===null||c===void 0?void 0:c.toString()),u=e.type||"clipboard";if(!d)return!1;o.$selected_content=d,o.$copy_type=u}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return oe(E==null?void 0:E.querySelectorAll)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return K(r)&&isFinite(r)&&Math.floor(r)===r});var gs="0123456789abcdef";class Jt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Jt(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+gs.charAt(this.bytes[t]>>>4)+gs.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Jt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class No{constructor(){w(this,"_timestamp",0),w(this,"_counter",0),w(this,"_random",new qo)}generate(){var e=this.generateOrAbort();if(k(e)){this._timestamp=0;var t=this.generateOrAbort();if(k(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){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 Jt.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var vs,fs=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};p&&!k(p.crypto)&&crypto.getRandomValues&&(fs=r=>crypto.getRandomValues(r));class qo{constructor(){w(this,"_buffer",new Uint32Array(8)),w(this,"_cursor",1/0)}nextUint32(){return this._cursor>=this._buffer.length&&(fs(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var $e=()=>Bo().toString(),Bo=()=>(vs||(vs=new No)).generate(),Uo="Thu, 01 Jan 1970 00:00:00 GMT",yt="",jo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ho(r,e){if(e){var t=function(s){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:E;if(yt)return yt;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var o=s.split("."),a=Math.min(o.length,8),l="dmn_chk_"+$e(),c=new RegExp("(^|;)\\s*"+l+"=1");!yt&&a--;){var d=o.slice(a).join("."),u=l+"=1;domain=."+d;n.cookie=u,c.test(n.cookie)&&(n.cookie=u+";expires="+Uo,yt=d)}return yt}(r);if(!t){var i=(s=>{var n=s.match(jo);return n?n[0]:""})(r);i!==t&&C.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var Oe,ke={is_supported:()=>!!E,error:function(r){C.error("cookieStore error: "+r)},get:function(r){if(E){try{for(var e=r+"=",t=E.cookie.split(";").filter(n=>n.length),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},parse:function(r){var e;try{e=JSON.parse(ke.get(r))||{}}catch{}return e},set:function(r,e,t,i,s){if(E)try{var n="",o="",a=Ho(E.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&C.warn("cookieStore warning: large cookie, len="+c.length),E.cookie=c,c}catch{return}},remove:function(r,e){try{ke.set(r,"",-1,e)}catch{return}}},Ai=null,z={is_supported:function(){if(!Te(Ai))return Ai;var r=!0;if(k(p))r=!1;else try{var e="__mplssupport__";z.set(e,"xyz"),z.get(e)!=='"xyz"'&&(r=!1),z.remove(e)}catch{r=!1}return r||C.error("localStorage unsupported; falling back to cookie store"),Ai=r,r},error:function(r){C.error("localStorage error: "+r)},get:function(r){try{return p==null?void 0:p.localStorage.getItem(r)}catch(e){z.error(e)}return null},parse:function(r){try{return JSON.parse(z.get(r))||{}}catch{}return null},set:function(r,e){try{p==null||p.localStorage.setItem(r,JSON.stringify(e))}catch(t){z.error(t)}},remove:function(r){try{p==null||p.localStorage.removeItem(r)}catch(e){z.error(e)}}},zo=["distinct_id",qt,ft,Ht,Pi],Yt=f(f({},z),{},{parse:function(r){try{var e={};try{e=ke.parse(r)||{}}catch{}var t=H(e,JSON.parse(z.get(r)||"{}"));return z.set(r,t),t}catch{}return null},set:function(r,e,t,i,s,n){try{z.set(r,e,void 0,void 0,n);var o={};zo.forEach(a=>{e[a]&&(o[a]=e[a])}),Object.keys(o).length&&ke.set(r,o,t,i,s,n)}catch(a){z.error(a)}},remove:function(r,e){try{p==null||p.localStorage.removeItem(r),ke.remove(r,e)}catch(t){z.error(t)}}}),Qt={},Vo={is_supported:function(){return!0},error:function(r){C.error("memoryStorage error: "+r)},get:function(r){return Qt[r]||null},parse:function(r){return Qt[r]||null},set:function(r,e){Qt[r]=e},remove:function(r){delete Qt[r]}},je=null,W={is_supported:function(){if(!Te(je))return je;if(je=!0,k(p))je=!1;else try{var r="__support__";W.set(r,"xyz"),W.get(r)!=='"xyz"'&&(je=!1),W.remove(r)}catch{je=!1}return je},error:function(r){C.error("sessionStorage error: ",r)},get:function(r){try{return p==null?void 0:p.sessionStorage.getItem(r)}catch(e){W.error(e)}return null},parse:function(r){try{return JSON.parse(W.get(r))||null}catch{}return null},set:function(r,e){try{p==null||p.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){W.error(t)}},remove:function(r){try{p==null||p.sessionStorage.removeItem(r)}catch(e){W.error(e)}}};(function(r){r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED"})(Oe||(Oe={}));class Wo{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?Oe.DENIED:this._storedConsent}isOptedOut(){return this.consent===Oe.DENIED||this.consent===Oe.PENDING&&this._config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this._storage.set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage.remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t}=this._instance.config;return(t||"__ph_opt_in_out_")+e}get _storedConsent(){var e=this._storage.get(this._storageKey);return e==="1"?Oe.GRANTED:e==="0"?Oe.DENIED:Oe.PENDING}get _storage(){if(!this._persistentStore){var e=this._config.opt_out_capturing_persistence_type;this._persistentStore=e==="localStorage"?z:ke;var t=e==="localStorage"?ke:z;t.get(this._storageKey)&&(this._persistentStore.get(this._storageKey)||this.optInOut(t.get(this._storageKey)==="1"),t.remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&!!Nr([se==null?void 0:se.doNotTrack,se==null?void 0:se.msDoNotTrack,P.doNotTrack],e=>F([!0,1,"1","yes"],e))}}var Xt=J("[Dead Clicks]"),Go=()=>!0,Ko=r=>{var e,t=!((e=r.instance.persistence)===null||e===void 0||!e.get_property(Hr)),i=r.instance.config.capture_dead_clicks;return we(i)?i:t};class ms{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Hr]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this._loadScript(()=>{this._start()})}_loadScript(e){var t,i,s;(t=P.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture&&e(),(i=P.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",n=>{n?Xt.error("failed to load script",n):e()})}_start(){var e;if(E){if(!this._lazyLoadedDeadClicksAutocapture&&(e=P.__PosthogExtensions__)!==null&&e!==void 0&&e.initDeadClicksAutocapture){var t=q(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=P.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(E),Xt.info("starting...")}}else Xt.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Xt.info("stopping..."))}}var Li=J("[ExceptionAutocapture]");class Jo{constructor(e){var t;w(this,"_startCapturing",()=>{var i;if(p&&this.isEnabled&&(i=P.__PosthogExtensions__)!==null&&i!==void 0&&i.errorWrappingFunctions){var s=P.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=P.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=P.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this.config.capture_unhandled_errors&&(this._unwrapOnError=s(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=n(this.captureException.bind(this))),!this._unwrapConsoleError&&this.config.capture_console_errors&&(this._unwrapConsoleError=o(this.captureException.bind(this)))}catch(a){Li.error("failed to start",a),this._stopCapturing()}}}),this.instance=e,this.remoteEnabled=!((t=this.instance.persistence)===null||t===void 0||!t.props[Ur]),this.config=this._requiredConfig(),this.startIfEnabled()}_requiredConfig(){var e=this.instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return q(e)?t=f(f({},t),e):(k(e)?this.remoteEnabled:e)&&(t=f(f({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Li.info("enabled"),this._loadScript(this._startCapturing))}_loadScript(e){var t,i,s;(t=P.__PosthogExtensions__)!==null&&t!==void 0&&t.errorWrappingFunctions&&e(),(i=P.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"exception-autocapture",n=>{if(n)return Li.error("failed to load script",n);e()})}_stopCapturing(){var e,t,i;(e=this._unwrapOnError)===null||e===void 0||e.call(this),this._unwrapOnError=void 0,(t=this._unwrapUnhandledRejection)===null||t===void 0||t.call(this),this._unwrapUnhandledRejection=void 0,(i=this._unwrapConsoleError)===null||i===void 0||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.config=this._requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[Ur]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}}function ys(r){return!k(Event)&&bs(r,Event)}function bs(r,e){try{return r instanceof e}catch{return!1}}function ws(r){switch(Object.prototype.toString.call(r)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return bs(r,Error)}}function Zt(r,e){return Object.prototype.toString.call(r)==="[object ".concat(e,"]")}function Mi(r){return Zt(r,"DOMError")}var Ss=/\(error: (.*)\)/,ks=50,it="?";function Di(r,e,t,i){var s={platform:"web:javascript",filename:r,function:e==="<anonymous>"?it:e,in_app:!0};return k(t)||(s.lineno=t),k(i)||(s.colno=i),s}var Yo=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Qo=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Xo=/\((\S*)(?::(\d+))(?::(\d+))\)/,Zo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ea=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ta=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var i=e.sort((s,n)=>s[0]-n[0]).map(s=>s[1]);return function(s){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=[],a=s.split(`
2
- `),l=n;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var d=Ss.test(c)?c.replace(Ss,"$1"):c;if(!d.match(/\S*Error: /)){for(var u of i){var h=u(d);if(h){o.push(h);break}}if(o.length>=ks)break}}}return function(_){if(!_.length)return[];var g=Array.from(_);return g.reverse(),g.slice(0,ks).map(v=>f(f({},v),{},{filename:v.filename||ia(g).filename,function:v.function||it}))}(o)}}([30,r=>{var e=Yo.exec(r);if(e){var[,t,i,s]=e;return Di(t,it,+i,+s)}var n=Qo.exec(r);if(n){if(n[2]&&n[2].indexOf("eval")===0){var o=Xo.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}var[a,l]=xs(n[1]||it,n[2]);return Di(l,a,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,r=>{var e=Zo.exec(r);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=ea.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}var i=e[3],s=e[1]||it;return[s,i]=xs(s,i),Di(i,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]);function ia(r){return r[r.length-1]||{}}var ei,Es,Ni,xs=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:it,t?"safari-extension:".concat(e):"safari-web-extension:".concat(e)]:[r,e]},ra=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function qi(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=r.stacktrace||r.stack||"",i=function(o){return o&&sa.test(o.message)?1:0}(r);try{var s=ta,n=function(o,a){var l=function(c){var d=globalThis._posthogChunkIds;if(!d)return{};var u=Object.keys(d);return Ni&&u.length===Es||(Es=u.length,Ni=u.reduce((h,_)=>{ei||(ei={});var g=ei[_];if(g)h[g[0]]=g[1];else for(var v=c(_),b=v.length-1;b>=0;b--){var y=v[b],m=y==null?void 0:y.filename,x=d[_];if(m&&x){h[m]=x,ei[_]=[m,x];break}}return h},{})),Ni}(a);return o.forEach(c=>{c.filename&&(c.chunk_id=l[c.filename])}),o}(s(t,i),s);return n.slice(0,n.length-e)}catch{}return[]}var sa=/Minified React error #\d+;/i;function na(r,e){var t,i,s=qi(r),n=(t=e==null?void 0:e.handled)===null||t===void 0||t,o=(i=e==null?void 0:e.synthetic)!==null&&i!==void 0&&i;return{type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:r.name,value:function(a){var l=a.message;return l.error&&typeof l.error.message=="string"?String(l.error.message):String(l)}(r),stacktrace:{frames:s,type:"raw"},mechanism:{handled:n,synthetic:o}}}function Cs(r,e){var t=na(r,e);return r.cause&&ws(r.cause)&&r.cause!==r?[t,...Cs(r.cause,{handled:e==null?void 0:e.handled,synthetic:e==null?void 0:e.synthetic})]:[t]}function Bi(r,e){return{$exception_list:Cs(r,e),$exception_level:"error"}}function Ui(r,e){var t,i,s,n=(t=e==null?void 0:e.handled)===null||t===void 0||t,o=(i=e==null?void 0:e.synthetic)===null||i===void 0||i,a={type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:(s=e==null?void 0:e.defaultExceptionType)!==null&&s!==void 0?s:"Error",value:r||(e==null?void 0:e.defaultExceptionMessage),mechanism:{handled:n,synthetic:o}};if(e!=null&&e.syntheticException){var l=qi(e.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function oa(r){return j(r)&&!fi(r)&&go.indexOf(r)>=0}function aa(r,e){var t,i,s=(t=e==null?void 0:e.handled)===null||t===void 0||t,n=(i=e==null?void 0:e.synthetic)===null||i===void 0||i,o=e!=null&&e.overrideExceptionType?e.overrideExceptionType:ys(r)?r.constructor.name:"Error",a="Non-Error 'exception' captured with keys: ".concat(function(d){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,h=Object.keys(d);if(h.sort(),!h.length)return"[object has no keys]";for(var _=h.length;_>0;_--){var g=h.slice(0,_).join(", ");if(!(g.length>u))return _===h.length||g.length<=u?g:"".concat(g.slice(0,u),"...")}return""}(r)),l={type:o,value:a,mechanism:{handled:s,synthetic:n}};if(e!=null&&e.syntheticException){var c=qi(e==null?void 0:e.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:oa(r.level)?r.level:"error"}}function la(r,e){var{error:t,event:i}=r,s={$exception_list:[]},n=t||i;if(Mi(n)||function(_){return Zt(_,"DOMException")}(n)){var o=n;if(function(_){return"stack"in _}(n))s=Bi(n,e);else{var a=o.name||(Mi(o)?"DOMError":"DOMException"),l=o.message?"".concat(a,": ").concat(o.message):a,c=Mi(o)?"DOMError":"DOMException";s=Ui(l,f(f({},e),{},{overrideExceptionType:c,defaultExceptionMessage:l}))}return"code"in o&&(s.$exception_DOMException_code="".concat(o.code)),s}if(function(_){return Zt(_,"ErrorEvent")}(n)&&n.error)return Bi(n.error,e);if(ws(n))return Bi(n,e);if(function(_){return Zt(_,"Object")}(n)||ys(n))return aa(n,e);if(k(t)&&j(i)){var d="Error",u=i,h=i.match(ra);return h&&(d=h[1],u=h[2]),Ui(u,f(f({},e),{},{overrideExceptionType:d,defaultExceptionMessage:u}))}return Ui(n,e)}function ti(r){var e,t;return((e=JSON.stringify(r,(t=[],function(i,s){if(q(s)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(s)?"[Circular]":(t.push(s),s)}return s})))===null||e===void 0?void 0:e.length)||0}function ji(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(r.size>=e&&r.data.length>1){var t=Math.floor(r.data.length/2),i=r.data.slice(0,t),s=r.data.slice(t);return[ji({size:ti(i),data:i,sessionId:r.sessionId,windowId:r.windowId}),ji({size:ti(s),data:s,sessionId:r.sessionId,windowId:r.windowId})].flatMap(n=>n)}return[r]}var Ee=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(Ee||{}),he=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(he||{}),Hi="[SessionRecording]",zi="redacted",ii={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:r=>r,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},ua=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ca=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],da=["/s/","/e/","/i/"];function Is(r,e,t,i){if($(r))return r;var s=(e==null?void 0:e["content-length"])||function(n){return new Blob([n]).size}(r);return j(s)&&(s=parseInt(s)),s>t?Hi+" ".concat(i," body too large to record (").concat(s," bytes)"):r}function Ps(r,e){if($(r))return r;var t=r;return et(t,!1)||(t=Hi+" "+e+" body "+zi),O(ca,i=>{var s,n;(s=t)!==null&&s!==void 0&&s.length&&((n=t)===null||n===void 0?void 0:n.indexOf(i))!==-1&&(t=Hi+" "+e+" body "+zi+" as might contain: "+i)}),t}var _a=(r,e)=>{var t,i,s,n={payloadSizeLimitBytes:ii.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ii.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ii.payloadHostDenyList]},o=r.session_recording.recordHeaders!==!1&&e.recordHeaders,a=r.session_recording.recordBody!==!1&&e.recordBody,l=r.capture_performance!==!1&&e.recordPerformance,c=(t=n,s=Math.min(1e6,(i=t.payloadSizeLimitBytes)!==null&&i!==void 0?i:1e6),h=>(h!=null&&h.requestBody&&(h.requestBody=Is(h.requestBody,h.requestHeaders,s,"Request")),h!=null&&h.responseBody&&(h.responseBody=Is(h.responseBody,h.responseHeaders,s,"Response")),h)),d=h=>{return c(((v,b)=>{var y,m=tt(v.name),x=b.indexOf("http")===0?(y=tt(b))===null||y===void 0?void 0:y.pathname:b;x==="/"&&(x="");var I=m==null?void 0:m.pathname.replace(x||"","");if(!(m&&I&&da.some(R=>I.indexOf(R)===0)))return v})((g=(_=h).requestHeaders,$(g)||O(Object.keys(g??{}),v=>{ua.includes(v.toLowerCase())&&(g[v]=zi)}),_),r.api_host));var _,g},u=oe(r.session_recording.maskNetworkRequestFn);return u&&oe(r.session_recording.maskCapturedNetworkRequestFn)&&C.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(r.session_recording.maskCapturedNetworkRequestFn=h=>{var _=r.session_recording.maskNetworkRequestFn({url:h.name});return f(f({},h),{},{name:_==null?void 0:_.url})}),n.maskRequestFn=oe(r.session_recording.maskCapturedNetworkRequestFn)?h=>{var _,g,v,b=d(h);return b&&(_=(g=(v=r.session_recording).maskCapturedNetworkRequestFn)===null||g===void 0?void 0:g.call(v,b))!==null&&_!==void 0?_:void 0}:h=>function(_){if(!k(_))return _.requestBody=Ps(_.requestBody,"Request"),_.responseBody=Ps(_.responseBody,"Response"),_}(d(h)),f(f(f({},ii),n),{},{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};function ae(r,e,t,i,s){return e>t&&(C.warn("min cannot be greater than max."),e=t),K(r)?r>t?(i&&C.warn(i+" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i&&C.warn(i+" cannot be less than min: "+e+". Using min value instead."),e):r:(i&&C.warn(i+" must be a number. using max or fallback. max: "+t+", fallback: "+s),ae(s||t,e,t,i))}class ha{constructor(e){var t,i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w(this,"_bucketSize",100),w(this,"_refillRate",10),w(this,"_mutationBuckets",{}),w(this,"_loggedTracker",{}),w(this,"_refillBuckets",()=>{Object.keys(this._mutationBuckets).forEach(n=>{this._mutationBuckets[n]=this._mutationBuckets[n]+this._refillRate,this._mutationBuckets[n]>=this._bucketSize&&delete this._mutationBuckets[n]})}),w(this,"_getNodeOrRelevantParent",n=>{var o=this._rrweb.mirror.getNode(n);if((o==null?void 0:o.nodeName)!=="svg"&&o instanceof Element){var a=o.closest("svg");if(a)return[this._rrweb.mirror.getId(a),a]}return[n,o]}),w(this,"_numberOfChanges",n=>{var o,a,l,c,d,u,h,_;return((o=(a=n.removes)===null||a===void 0?void 0:a.length)!==null&&o!==void 0?o:0)+((l=(c=n.attributes)===null||c===void 0?void 0:c.length)!==null&&l!==void 0?l:0)+((d=(u=n.texts)===null||u===void 0?void 0:u.length)!==null&&d!==void 0?d:0)+((h=(_=n.adds)===null||_===void 0?void 0:_.length)!==null&&h!==void 0?h:0)}),w(this,"throttleMutations",n=>{if(n.type!==3||n.data.source!==0)return n;var o=n.data,a=this._numberOfChanges(o);o.attributes&&(o.attributes=o.attributes.filter(c=>{var d,u,h,[_,g]=this._getNodeOrRelevantParent(c.id);return this._mutationBuckets[_]===0?!1:(this._mutationBuckets[_]=(d=this._mutationBuckets[_])!==null&&d!==void 0?d:this._bucketSize,this._mutationBuckets[_]=Math.max(this._mutationBuckets[_]-1,0),this._mutationBuckets[_]===0&&(this._loggedTracker[_]||(this._loggedTracker[_]=!0,(u=(h=this._options).onBlockedNode)===null||u===void 0||u.call(h,_,g))),c)}));var l=this._numberOfChanges(o);return l!==0||a===l?n:void 0}),this._rrweb=e,this._options=s,this._refillRate=ae((t=this._options.refillRate)!==null&&t!==void 0?t:this._refillRate,0,100,"mutation throttling refill rate"),this._bucketSize=ae((i=this._options.bucketSize)!==null&&i!==void 0?i:this._bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this._refillBuckets()},1e3)}}var le=Uint8Array,re=Uint16Array,rt=Uint32Array,Vi=new le([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]),Wi=new le([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]),Ts=new le([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fs=function(r,e){for(var t=new re(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new rt(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},Rs=Fs(Vi,2),pa=Rs[0],Gi=Rs[1];pa[28]=258,Gi[258]=28;for(var $s=Fs(Wi,0)[1],Os=new re(32768),M=0;M<32768;++M){var He=(43690&M)>>>1|(21845&M)<<1;He=(61680&(He=(52428&He)>>>2|(13107&He)<<2))>>>4|(3855&He)<<4,Os[M]=((65280&He)>>>8|(255&He)<<8)>>>1}var bt=function(r,e,t){for(var i=r.length,s=0,n=new re(e);s<i;++s)++n[r[s]-1];var o,a=new re(e);for(s=0;s<e;++s)a[s]=a[s-1]+n[s-1]<<1;for(o=new re(i),s=0;s<i;++s)o[s]=Os[a[r[s]-1]++]>>>15-r[s];return o},ze=new le(288);for(M=0;M<144;++M)ze[M]=8;for(M=144;M<256;++M)ze[M]=9;for(M=256;M<280;++M)ze[M]=7;for(M=280;M<288;++M)ze[M]=8;var ri=new le(32);for(M=0;M<32;++M)ri[M]=5;var ga=bt(ze,9),va=bt(ri,5),As=function(r){return(r/8>>0)+(7&r&&1)},Ls=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof re?re:r instanceof rt?rt:le)(t-e);return i.set(r.subarray(e,t)),i},xe=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},wt=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},Ki=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new le(0),0];if(s==1){var o=new le(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort(function(R,A){return R.f-A.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,d=1,u=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=s-1;)a=t[t[c].f<t[u].f?c++:u++],l=t[c!=d&&t[c].f<t[u].f?c++:u++],t[d++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(i=1;i<s;++i)n[i].s>h&&(h=n[i].s);var _=new re(h+1),g=Ji(t[d-1],_,0);if(g>e){i=0;var v=0,b=g-e,y=1<<b;for(n.sort(function(R,A){return _[A.s]-_[R.s]||R.f-A.f});i<s;++i){var m=n[i].s;if(!(_[m]>e))break;v+=y-(1<<g-_[m]),_[m]=e}for(v>>>=b;v>0;){var x=n[i].s;_[x]<e?v-=1<<e-_[x]++-1:++i}for(;i>=0&&v;--i){var I=n[i].s;_[I]==e&&(--_[I],++v)}g=e}return[new le(_),g]},Ji=function(r,e,t){return r.s==-1?Math.max(Ji(r.l,e,t+1),Ji(r.r,e,t+1)):e[r.s]=t},Ms=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new re(++e),i=0,s=r[0],n=1,o=function(l){t[i++]=l},a=1;a<=e;++a)if(r[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=r[a]}return[t.subarray(0,i),e]},St=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},Yi=function(r,e,t){var i=t.length,s=As(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},Ds=function(r,e,t,i,s,n,o,a,l,c,d){xe(e,d++,t),++s[256];for(var u=Ki(s,15),h=u[0],_=u[1],g=Ki(n,15),v=g[0],b=g[1],y=Ms(h),m=y[0],x=y[1],I=Ms(v),R=I[0],A=I[1],L=new re(19),T=0;T<m.length;++T)L[31&m[T]]++;for(T=0;T<R.length;++T)L[31&R[T]]++;for(var D=Ki(L,7),V=D[0],pe=D[1],ce=19;ce>4&&!V[Ts[ce-1]];--ce);var Ie,fe,me,_t,De=c+5<<3,Qe=St(s,ze)+St(n,ri)+o,ye=St(s,h)+St(n,v)+o+14+3*ce+St(L,V)+(2*L[16]+3*L[17]+7*L[18]);if(De<=Qe&&De<=ye)return Yi(e,d,r.subarray(l,l+c));if(xe(e,d,1+(ye<Qe)),d+=2,ye<Qe){Ie=bt(h,_),fe=h,me=bt(v,b),_t=v;var Ne=bt(V,pe);for(xe(e,d,x-257),xe(e,d+5,A-1),xe(e,d+10,ce-4),d+=14,T=0;T<ce;++T)xe(e,d+3*T,V[Ts[T]]);d+=3*ce;for(var ht=[m,R],ee=0;ee<2;++ee){var de=ht[ee];for(T=0;T<de.length;++T){var ne=31&de[T];xe(e,d,Ne[ne]),d+=V[ne],ne>15&&(xe(e,d,de[T]>>>5&127),d+=de[T]>>>12)}}}else Ie=ga,fe=ze,me=va,_t=ri;for(T=0;T<a;++T)if(i[T]>255){ne=i[T]>>>18&31,wt(e,d,Ie[ne+257]),d+=fe[ne+257],ne>7&&(xe(e,d,i[T]>>>23&31),d+=Vi[ne]);var pt=31&i[T];wt(e,d,me[pt]),d+=_t[pt],pt>3&&(wt(e,d,i[T]>>>5&8191),d+=Wi[pt])}else wt(e,d,Ie[i[T]]),d+=fe[i[T]];return wt(e,d,Ie[256]),d+fe[256]},fa=new rt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ma=function(){for(var r=new rt(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r}(),ya=function(){var r=4294967295;return{p:function(e){for(var t=r,i=0;i<e.length;++i)t=ma[255&t^e[i]]^t>>>8;r=t},d:function(){return 4294967295^r}}},ba=function(r,e,t,i,s){return function(n,o,a,l,c,d){var u=n.length,h=new le(l+u+5*(1+Math.floor(u/7e3))+c),_=h.subarray(l,h.length-c),g=0;if(!o||u<8)for(var v=0;v<=u;v+=65535){var b=v+65535;b<u?g=Yi(_,g,n.subarray(v,b)):(_[v]=d,g=Yi(_,g,n.subarray(v,u)))}else{for(var y=fa[o-1],m=y>>>13,x=8191&y,I=(1<<a)-1,R=new re(32768),A=new re(I+1),L=Math.ceil(a/3),T=2*L,D=function(Er){return(n[Er]^n[Er+1]<<L^n[Er+2]<<T)&I},V=new rt(25e3),pe=new re(288),ce=new re(32),Ie=0,fe=0,me=(v=0,0),_t=0,De=0;v<u;++v){var Qe=D(v),ye=32767&v,Ne=A[Qe];if(R[ye]=Ne,A[Qe]=ye,_t<=v){var ht=u-v;if((Ie>7e3||me>24576)&&ht>423){g=Ds(n,_,0,V,pe,ce,fe,me,De,v-De,g),me=Ie=fe=0,De=v;for(var ee=0;ee<286;++ee)pe[ee]=0;for(ee=0;ee<30;++ee)ce[ee]=0}var de=2,ne=0,pt=x,qe=ye-Ne&32767;if(ht>2&&Qe==D(v-qe))for(var Xl=Math.min(m,ht)-1,Zl=Math.min(32767,v),eu=Math.min(258,ht);qe<=Zl&&--pt&&ye!=Ne;){if(n[v+de]==n[v+de-qe]){for(var Be=0;Be<eu&&n[v+Be]==n[v+Be-qe];++Be);if(Be>de){if(de=Be,ne=qe,Be>Xl)break;var tu=Math.min(qe,Be-2),uo=0;for(ee=0;ee<tu;++ee){var kr=v-qe+ee+32768&32767,co=kr-R[kr]+32768&32767;co>uo&&(uo=co,Ne=kr)}}}qe+=(ye=Ne)-(Ne=R[ye])+32768&32767}if(ne){V[me++]=268435456|Gi[de]<<18|$s[ne];var _o=31&Gi[de],ho=31&$s[ne];fe+=Vi[_o]+Wi[ho],++pe[257+_o],++ce[ho],_t=v+de,++Ie}else V[me++]=n[v],++pe[n[v]]}}g=Ds(n,_,d,V,pe,ce,fe,me,De,v-De,g)}return Ls(h,0,l+As(g)+c)}(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},Qi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8},wa=function(r,e){var t=e.filename;if(r[0]=31,r[1]=139,r[2]=8,r[8]=e.level<2?4:e.level==9?2:0,r[9]=3,e.mtime!=0&&Qi(r,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){r[3]=8;for(var i=0;i<=t.length;++i)r[i+10]=t.charCodeAt(i)}},Sa=function(r){return 10+(r.filename&&r.filename.length+1||0)};function Ns(r,e){e===void 0&&(e={});var t=ya(),i=r.length;t.p(r);var s=ba(r,e,Sa(e),8),n=s.length;return wa(s,e),Qi(s,n-8,t.d()),Qi(s,n-4,i),s}function qs(r,e){var t=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var i=new le(r.length+(r.length>>>1)),s=0,n=function(c){i[s++]=c},o=0;o<t;++o){if(s+5>i.length){var a=new le(s+8+(t-o<<1));a.set(i),i=a}var l=r.charCodeAt(o);l<128||e?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&r.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Ls(i,0,s)}function ka(r,e){return function(t){for(var i=0,s=0;s<t.length;s++)i=(i<<5)-i+t.charCodeAt(s),i|=0;return Math.abs(i)}(r)%100<ae(100*e,0,100)}var kt="[SessionRecording]",Y=J(kt);function si(){var r,e;return P==null||(r=P.__PosthogExtensions__)===null||r===void 0||(e=r.rrweb)===null||e===void 0?void 0:e.record}var Ea=3e5,xa=[he.MouseMove,he.MouseInteraction,he.Scroll,he.ViewportResize,he.Input,he.TouchMove,he.MediaInteraction,he.Drag],Bs=r=>({rrwebMethod:r,enqueuedAt:Date.now(),attempt:1});function Ve(r){return function(e,t){for(var i="",s=0;s<e.length;){var n=e[s++];i+=String.fromCharCode(n)}return i}(Ns(qs(JSON.stringify(r))))}function Us(r){return r.type===Ee.Custom&&r.data.tag==="sessionIdle"}function js(r,e){return e.some(t=>t.matching==="regex"&&new RegExp(t.url).test(r))}class Ca{get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(kt+" must be started with a valid sessionManager.");return this._instance.sessionManager}get _fullSnapshotIntervalMillis(){var e,t;return this._triggerStatus==="trigger_pending"?6e4:(e=(t=this._instance.config.session_recording)===null||t===void 0?void 0:t.full_snapshot_interval_millis)!==null&&e!==void 0?e:Ea}get _isSampled(){var e=this._instance.get_property(ft);return we(e)?e:null}get _sessionDuration(){var e,t,i=(e=this._buffer)===null||e===void 0?void 0:e.data[((t=this._buffer)===null||t===void 0?void 0:t.data.length)-1],{sessionStartTimestamp:s}=this._sessionManager.checkAndGetSessionAndWindowId(!0);return i?i.timestamp-s:null}get _isRecordingEnabled(){var e=!!this._instance.get_property(yi),t=!this._instance.config.disable_session_recording;return p&&e&&t}get _isConsoleLogCaptureEnabled(){var e=!!this._instance.get_property(Vr),t=this._instance.config.enable_recording_console_log;return t??e}get _canvasRecording(){var e,t,i,s,n,o,a=this._instance.config.session_recording.captureCanvas,l=this._instance.get_property(Kr),c=(e=(t=a==null?void 0:a.recordCanvas)!==null&&t!==void 0?t:l==null?void 0:l.enabled)!==null&&e!==void 0&&e,d=(i=(s=a==null?void 0:a.canvasFps)!==null&&s!==void 0?s:l==null?void 0:l.fps)!==null&&i!==void 0?i:4,u=(n=(o=a==null?void 0:a.canvasQuality)!==null&&o!==void 0?o:l==null?void 0:l.quality)!==null&&n!==void 0?n:.4;if(typeof u=="string"){var h=parseFloat(u);u=isNaN(h)?.4:h}return{enabled:c,fps:ae(d,0,12,"canvas recording fps",4),quality:ae(u,0,1,"canvas recording quality",.4)}}get _networkPayloadCapture(){var e,t,i=this._instance.get_property(Wr),s={recordHeaders:(e=this._instance.config.session_recording)===null||e===void 0?void 0:e.recordHeaders,recordBody:(t=this._instance.config.session_recording)===null||t===void 0?void 0:t.recordBody},n=(s==null?void 0:s.recordHeaders)||(i==null?void 0:i.recordHeaders),o=(s==null?void 0:s.recordBody)||(i==null?void 0:i.recordBody),a=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,l=!!(we(a)?a:i!=null&&i.capturePerformance);return n||o||l?{recordHeaders:n,recordBody:o,recordPerformance:l}:void 0}get _masking(){var e,t,i,s,n,o,a=this._instance.get_property(Gr),l={maskAllInputs:(e=this._instance.config.session_recording)===null||e===void 0?void 0:e.maskAllInputs,maskTextSelector:(t=this._instance.config.session_recording)===null||t===void 0?void 0:t.maskTextSelector,blockSelector:(i=this._instance.config.session_recording)===null||i===void 0?void 0:i.blockSelector},c=(s=l==null?void 0:l.maskAllInputs)!==null&&s!==void 0?s:a==null?void 0:a.maskAllInputs,d=(n=l==null?void 0:l.maskTextSelector)!==null&&n!==void 0?n:a==null?void 0:a.maskTextSelector,u=(o=l==null?void 0:l.blockSelector)!==null&&o!==void 0?o:a==null?void 0:a.blockSelector;return k(c)&&k(d)&&k(u)?void 0:{maskAllInputs:c==null||c,maskTextSelector:d,blockSelector:u}}get _sampleRate(){var e=this._instance.get_property(Jr);return K(e)?e:null}get _minimumDuration(){var e=this._instance.get_property(Yr);return K(e)?e:null}get status(){return this._receivedDecide?this._isRecordingEnabled?this._isSampled===!1?"disabled":this._urlBlocked?"paused":$(this._linkedFlag)||this._linkedFlagSeen?this._triggerStatus==="trigger_pending"?"buffering":we(this._isSampled)?this._isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get _urlTriggerStatus(){var e;return this._urlTriggers.length===0?"trigger_disabled":((e=this._instance)===null||e===void 0?void 0:e.get_property(bi))===this._sessionId?"trigger_activated":"trigger_pending"}get _eventTriggerStatus(){var e;return this._eventTriggers.length===0?"trigger_disabled":((e=this._instance)===null||e===void 0?void 0:e.get_property(wi))===this._sessionId?"trigger_activated":"trigger_pending"}get _triggerStatus(){var e=this._eventTriggerStatus==="trigger_activated"||this._urlTriggerStatus==="trigger_activated",t=this._eventTriggerStatus==="trigger_pending"||this._urlTriggerStatus==="trigger_pending";return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(w(this,"_queuedRRWebEvents",[]),w(this,"_isIdle","unknown"),w(this,"_linkedFlagSeen",!1),w(this,"_lastActivityTimestamp",Date.now()),w(this,"_linkedFlag",null),w(this,"_removePageViewCaptureHook",void 0),w(this,"_onSessionIdListener",void 0),w(this,"_persistDecideOnSessionListener",void 0),w(this,"_samplingSessionListener",void 0),w(this,"_urlTriggers",[]),w(this,"_urlBlocklist",[]),w(this,"_urlBlocked",!1),w(this,"_eventTriggers",[]),w(this,"_removeEventTriggerCaptureHook",void 0),w(this,"_forceAllowLocalhostNetworkCapture",!1),w(this,"_onBeforeUnload",()=>{this._flushBuffer()}),w(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),w(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),w(this,"_onVisibilityChange",()=>{if(E!=null&&E.visibilityState){var s="window "+E.visibilityState;this._tryAddCustomEvent(s,{})}}),this._instance=e,this._captureStarted=!1,this._endpoint="/s/",this._stopRrweb=void 0,this._receivedDecide=!1,!this._instance.sessionManager)throw Y.error("started without valid sessionManager"),new Error(kt+" started without valid sessionManager. This is a bug.");if(this._instance.config.__preview_experimental_cookieless_mode)throw new Error(kt+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:t,windowId:i}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=t,this._windowId=i,this._buffer=this._clearBuffer(),this._sessionIdleThresholdMilliseconds>=this._sessionManager.sessionTimeoutMs&&Y.warn("session_idle_threshold_ms (".concat(this._sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this._sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(e){this._isRecordingEnabled?(this._startCapture(e),B(p,"beforeunload",this._onBeforeUnload),B(p,"offline",this._onOffline),B(p,"online",this._onOnline),B(p,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),$(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",t=>{try{if(t.event==="$pageview"){var i=t!=null&&t.properties.$current_url?this._maskUrl(t==null?void 0:t.properties.$current_url):"";if(!i)return;this._tryAddCustomEvent("$pageview",{href:i})}}catch(s){Y.error("Could not add $pageview to rrweb session",s)}})),this._onSessionIdListener||(this._onSessionIdListener=this._sessionManager.onSessionId((t,i,s)=>{var n,o,a,l;s&&(this._tryAddCustomEvent("$session_id_change",{sessionId:t,windowId:i,changeReason:s}),(n=this._instance)===null||n===void 0||(o=n.persistence)===null||o===void 0||o.unregister(wi),(a=this._instance)===null||a===void 0||(l=a.persistence)===null||l===void 0||l.unregister(bi))}))):this.stopRecording()}stopRecording(){var e,t,i,s;this._captureStarted&&this._stopRrweb&&(this._stopRrweb(),this._stopRrweb=void 0,this._captureStarted=!1,p==null||p.removeEventListener("beforeunload",this._onBeforeUnload),p==null||p.removeEventListener("offline",this._onOffline),p==null||p.removeEventListener("online",this._onOnline),p==null||p.removeEventListener("visibilitychange",this._onVisibilityChange),this._clearBuffer(),clearInterval(this._fullSnapshotTimer),(e=this._removePageViewCaptureHook)===null||e===void 0||e.call(this),this._removePageViewCaptureHook=void 0,(t=this._removeEventTriggerCaptureHook)===null||t===void 0||t.call(this),this._removeEventTriggerCaptureHook=void 0,(i=this._onSessionIdListener)===null||i===void 0||i.call(this),this._onSessionIdListener=void 0,(s=this._samplingSessionListener)===null||s===void 0||s.call(this),this._samplingSessionListener=void 0,Y.info("stopped"))}_resetSampling(){var e;(e=this._instance.persistence)===null||e===void 0||e.unregister(ft)}_makeSamplingDecision(e){var t,i=this._sessionId!==e,s=this._sampleRate;if(K(s)){var n=this._isSampled,o=i||!we(n),a=o?ka(e,s):n;o&&(a?this._reportStarted("sampled"):Y.warn("Sample rate (".concat(s,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:s,isSampled:a})),(t=this._instance.persistence)===null||t===void 0||t.register({[ft]:a})}else this._resetSampling()}onRemoteConfig(e){var t,i,s,n,o,a;if(this._tryAddCustomEvent("$remote_config_received",e),this._persistRemoteConfig(e),this._linkedFlag=((t=e.sessionRecording)===null||t===void 0?void 0:t.linkedFlag)||null,(i=e.sessionRecording)!==null&&i!==void 0&&i.endpoint&&(this._endpoint=(a=e.sessionRecording)===null||a===void 0?void 0:a.endpoint),this._setupSampling(),!$(this._linkedFlag)&&!this._linkedFlagSeen){var l=j(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,c=j(this._linkedFlag)?null:this._linkedFlag.variant;this._instance.onFeatureFlags((d,u)=>{var h=q(u)&&l in u,_=c?u[l]===c:h;_&&this._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:c}),this._linkedFlagSeen=_})}(s=e.sessionRecording)!==null&&s!==void 0&&s.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),(n=e.sessionRecording)!==null&&n!==void 0&&n.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),(o=e.sessionRecording)!==null&&o!==void 0&&o.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this._receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){K(this._sampleRate)&&$(this._samplingSessionListener)&&(this._samplingSessionListener=this._sessionManager.onSessionId(e=>{this._makeSamplingDecision(e)}))}_persistRemoteConfig(e){if(this._instance.persistence){var t,i=this._instance.persistence,s=()=>{var n,o,a,l,c,d,u,h,_,g=(n=e.sessionRecording)===null||n===void 0?void 0:n.sampleRate,v=$(g)?null:parseFloat(g);$(v)&&this._resetSampling();var b=(o=e.sessionRecording)===null||o===void 0?void 0:o.minimumDurationMilliseconds;i.register({[yi]:!!e.sessionRecording,[Vr]:(a=e.sessionRecording)===null||a===void 0?void 0:a.consoleLogRecordingEnabled,[Wr]:f({capturePerformance:e.capturePerformance},(l=e.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[Gr]:(c=e.sessionRecording)===null||c===void 0?void 0:c.masking,[Kr]:{enabled:(d=e.sessionRecording)===null||d===void 0?void 0:d.recordCanvas,fps:(u=e.sessionRecording)===null||u===void 0?void 0:u.canvasFps,quality:(h=e.sessionRecording)===null||h===void 0?void 0:h.canvasQuality},[Jr]:v,[Yr]:k(b)?null:b,[Qr]:(_=e.sessionRecording)===null||_===void 0?void 0:_.scriptConfig})};s(),(t=this._persistDecideOnSessionListener)===null||t===void 0||t.call(this),this._persistDecideOnSessionListener=this._sessionManager.onSessionId(s)}}log(e){var t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(t=this._instance.sessionRecording)===null||t===void 0||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!k(Object.assign)&&!k(Array.from)&&!(this._captureStarted||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var t,i;this._captureStarted=!0,this._sessionManager.checkAndGetSessionAndWindowId(),si()?this._onScriptLoaded():(t=P.__PosthogExtensions__)===null||t===void 0||(i=t.loadExternalDependency)===null||i===void 0||i.call(t,this._instance,this._scriptName,s=>{if(s)return Y.error("could not load recorder",s);this._onScriptLoaded()}),Y.info("starting"),this.status==="active"&&this._reportStarted(e||"recording_initialized")}}get _scriptName(){var e,t,i;return((e=this._instance)===null||e===void 0||(t=e.persistence)===null||t===void 0||(i=t.get_property(Qr))===null||i===void 0?void 0:i.script)||"recorder"}_isInteractiveEvent(e){var t;return e.type===3&&xa.indexOf((t=e.data)===null||t===void 0?void 0:t.source)!==-1}_updateWindowAndSessionIds(e){var t=this._isInteractiveEvent(e);t||this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size}),this._flushBuffer());var i=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){var s=this._isIdle==="unknown";this._isIdle=!1,s||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)}if(!this._isIdle){var{windowId:n,sessionId:o}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),a=this._sessionId!==o,l=this._windowId!==n;this._windowId=n,this._sessionId=o,a||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this._queuedRRWebEvents.length<10?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):Y.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Bs(()=>si().addCustomEvent(e,t)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Bs(()=>si().takeFullSnapshot()))}_onScriptLoaded(){var e,t,i,s,n={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},o=this._instance.config.session_recording;for(var[a,l]of Object.entries(o||{}))a in n&&(a==="maskInputOptions"?n.maskInputOptions=f({password:!0},l):n[a]=l);this._canvasRecording&&this._canvasRecording.enabled&&(n.recordCanvas=!0,n.sampling={canvas:this._canvasRecording.fps},n.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality}),this._masking&&(n.maskAllInputs=(t=this._masking.maskAllInputs)===null||t===void 0||t,n.maskTextSelector=(i=this._masking.maskTextSelector)!==null&&i!==void 0?i:void 0,n.blockSelector=(s=this._masking.blockSelector)!==null&&s!==void 0?s:void 0);var c=si();if(c){this._mutationRateLimiter=(e=this._mutationRateLimiter)!==null&&e!==void 0?e:new ha(c,{refillRate:this._instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this._instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(u,h)=>{var _="Too many mutations on node '".concat(u,"'. Rate limiting. This could be due to SVG animations or something similar");Y.info(_,{node:h}),this.log(kt+" "+_,"warn")}});var d=this._gatherRRWebPlugins();this._stopRrweb=c(f({emit:u=>{this.onRRwebEmit(u)},plugins:d},n)),this._lastActivityTimestamp=Date.now(),this._isIdle=we(this._isIdle)?this._isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:n,activePlugins:d.map(u=>u==null?void 0:u.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else Y.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this._isIdle!==!0){var e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}}_gatherRRWebPlugins(){var e,t,i,s,n=[],o=(e=P.__PosthogExtensions__)===null||e===void 0||(t=e.rrwebPlugins)===null||t===void 0?void 0:t.getRecordConsolePlugin;o&&this._isConsoleLogCaptureEnabled&&n.push(o());var a=(i=P.__PosthogExtensions__)===null||i===void 0||(s=i.rrwebPlugins)===null||s===void 0?void 0:s.getRecordNetworkPlugin;return this._networkPayloadCapture&&oe(a)&&(!$o.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(a(_a(this._instance.config,this._networkPayloadCapture))):Y.info("NetworkCapture not started because we are on localhost.")),n}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&q(e)){if(e.type===Ee.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(u){return u.type===Ee.Custom&&u.data.tag==="recording paused"}(e)){e.type===Ee.FullSnapshot&&this._scheduleFullSnapshot(),e.type===Ee.FullSnapshot&&this._triggerStatus==="trigger_pending"&&this._clearBuffer();var s=this._mutationRateLimiter?this._mutationRateLimiter.throttleMutations(e):e;if(s){var n=function(u){var h=u;if(h&&q(h)&&h.type===6&&q(h.data)&&h.data.plugin==="rrweb/console@1"){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 _=[],g=0;g<h.data.payload.payload.length;g++)h.data.payload.payload[g]&&h.data.payload.payload[g].length>2e3?_.push(h.data.payload.payload[g].slice(0,2e3)+"...[truncated]"):_.push(h.data.payload.payload[g]);return h.data.payload.payload=_,u}return u}(s);if(this._updateWindowAndSessionIds(n),this._isIdle!==!0||Us(n)){if(Us(n)){var o=n.data.payload;if(o){var a=o.lastActivityTimestamp,l=o.threshold;n.timestamp=a+l}}var c=(t=this._instance.config.session_recording.compress_events)===null||t===void 0||t?function(u){if(ti(u)<1024)return u;try{if(u.type===Ee.FullSnapshot)return f(f({},u),{},{data:Ve(u.data),cv:"2024-10"});if(u.type===Ee.IncrementalSnapshot&&u.data.source===he.Mutation)return f(f({},u),{},{cv:"2024-10",data:f(f({},u.data),{},{texts:Ve(u.data.texts),attributes:Ve(u.data.attributes),removes:Ve(u.data.removes),adds:Ve(u.data.adds)})});if(u.type===Ee.IncrementalSnapshot&&u.data.source===he.StyleSheetRule)return f(f({},u),{},{cv:"2024-10",data:f(f({},u.data),{},{adds:u.data.adds?Ve(u.data.adds):void 0,removes:u.data.removes?Ve(u.data.removes):void 0})})}catch(h){Y.error("could not compress event - will use uncompressed event",h)}return u}(n):n,d={$snapshot_bytes:ti(c),$snapshot_data:c,$session_id:this._sessionId,$window_id:this._windowId};this.status!=="disabled"?this._captureSnapshotBuffered(d):this._clearBuffer()}}}}}_pageViewFallBack(){if(!this._instance.config.capture_pageview&&p){var e=this._maskUrl(p.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){var e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(t=>{Date.now()-t.enqueuedAt<=2e3&&this._tryRRWebMethod(t)})}}_maskUrl(e){var t=this._instance.config.session_recording;if(t.maskNetworkRequestFn){var i,s={url:e};return(i=s=t.maskNetworkRequestFn(s))===null||i===void 0?void 0:i.url}return e}_clearBuffer(){return this._buffer={size:0,data:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_flushBuffer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0);var e=this._minimumDuration,t=this._sessionDuration,i=K(t)&&t>=0,s=K(e)&&i&&t<e;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||s?(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this._buffer):(this._buffer.data.length>0&&ji(this._buffer).forEach(n=>{this._captureSnapshot({$snapshot_bytes:n.size,$snapshot_data:n.data,$session_id:n.sessionId,$window_id:n.windowId,$lib:"web",$lib_version:be.LIB_VERSION})}),this._clearBuffer())}_captureSnapshotBuffered(e){var t,i=2+(((t=this._buffer)===null||t===void 0?void 0:t.data.length)||0);!this._isIdle&&(this._buffer.size+e.$snapshot_bytes+i>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._isIdle||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(p!==void 0&&p.location.href){var e=p.location.href,t=this._urlBlocked,i=js(e,this._urlBlocklist);i&&!t?this._pauseRecording():!i&&t&&this._resumeRecording(),js(e,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,i;this._triggerStatus==="trigger_pending"&&((t=this._instance)===null||t===void 0||(i=t.persistence)===null||i===void 0||i.register({[e==="url"?bi:wi]:this._sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),Y.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Y.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&$(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this._instance.on("eventCaptured",e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(t){Y.error("Could not activate event trigger",t)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;(e=this._instance.persistence)===null||e===void 0||e.register({[ft]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this._instance.register_for_session({$session_recording_start_reason:e}),Y.info(e.replace("_"," "),t),F(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}get sdkDebugProperties(){var{sessionStartTimestamp:e}=this._sessionManager.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:e}}}var Xi=J("[SegmentIntegration]");function Ia(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var o=l=>{var c=()=>l.anonymousId()||$e();i.config.get_device_id=c,l.id()&&(i.register({distinct_id:l.id(),$device_id:c()}),i.persistence.set_property(Se,"identified")),s()},a=n.user();"then"in a&&oe(a.then)?a.then(l=>o(l)):o(a)})(r,()=>{t.register((i=>{Promise&&Promise.resolve||Xi.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,o)=>{var a;if(!o)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||(Xi.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(Xi.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var l=i._calculate_event_properties(o,(a=n.event.properties)!==null&&a!==void 0?a:{},new Date);return n.event.properties=Object.assign({},l,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then(()=>{e()})})}var Hs="posthog-js";function zs(r){var{organization:e,projectId:t,prefix:i,severityAllowList:s=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n=>{var o,a,l,c,d;if(!(s==="*"||s.includes(n.level))||!r.__loaded)return n;n.tags||(n.tags={});var u=r.requestRouter.endpointFor("ui","/project/".concat(r.config.token,"/person/").concat(r.get_distinct_id()));n.tags["PostHog Person URL"]=u,r.sessionRecordingStarted()&&(n.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var h=((o=n.exception)===null||o===void 0?void 0:o.values)||[],_=h.map(v=>f(f({},v),{},{stacktrace:v.stacktrace?f(f({},v.stacktrace),{},{type:"raw",frames:(v.stacktrace.frames||[]).map(b=>f(f({},b),{},{platform:"web:javascript"}))}):void 0})),g={$exception_message:((a=h[0])===null||a===void 0?void 0:a.value)||n.message,$exception_type:(l=h[0])===null||l===void 0?void 0:l.type,$exception_personURL:u,$exception_level:n.level,$exception_list:_,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:((c=h[0])===null||c===void 0?void 0:c.value)||n.message,$sentry_exception_type:(d=h[0])===null||d===void 0?void 0:d.type,$sentry_tags:n.tags};return e&&t&&(g.$sentry_url=(i||"https://sentry.io/organizations/")+e+"/issues/?project="+t+"&query="+n.event_id),r.exceptions.sendExceptionEvent(g),n}}class Pa{constructor(e,t,i,s,n){this.name=Hs,this.setupOnce=function(o){o(zs(e,{organization:t,projectId:i,prefix:s,severityAllowList:n}))}}}var Ce,Ta=p!=null&&p.location?Kt(p.location.hash,"__posthog")||Kt(location.hash,"state"):null,Vs="_postHogToolbarParams",Ws=J("[Toolbar]");(function(r){r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED"})(Ce||(Ce={}));class Fa{constructor(e){this.instance=e}_setToolbarState(e){P.ph_toolbar_state=e}_getToolbarState(){var e;return(e=P.ph_toolbar_state)!==null&&e!==void 0?e:Ce.UNINITIALIZED}maybeLoadToolbar(){var e,t,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!p||!E)return!1;i=(e=i)!==null&&e!==void 0?e:p.location,n=(t=n)!==null&&t!==void 0?t:p.history;try{if(!s){try{p.localStorage.setItem("test","test"),p.localStorage.removeItem("test")}catch{return!1}s=p==null?void 0:p.localStorage}var o,a=Ta||Kt(i.hash,"__posthog")||Kt(i.hash,"state"),l=a?Dr(()=>JSON.parse(atob(decodeURIComponent(a))))||Dr(()=>JSON.parse(decodeURIComponent(a))):null;return l&&l.action==="ph_authorize"?((o=l).source="url",o&&Object.keys(o).length>0&&(l.desiredHash?i.hash=l.desiredHash:n?n.replaceState(n.state,"",i.pathname+i.search):i.hash="")):((o=JSON.parse(s.getItem(Vs)||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch{return!1}}_callLoadToolbar(e){var t=P.ph_load_toolbar||P.ph_load_editor;!$(t)&&oe(t)?t(e,this.instance):Ws.warn("No toolbar load function found")}loadToolbar(e){var t=!(E==null||!E.getElementById(Xr));if(!p||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=f(f({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(p.localStorage.setItem(Vs,JSON.stringify(f(f({},s),{},{source:void 0}))),this._getToolbarState()===Ce.LOADED)this._callLoadToolbar(s);else if(this._getToolbarState()===Ce.UNINITIALIZED){var n,o;this._setToolbarState(Ce.LOADING),(n=P.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this.instance,"toolbar",a=>{if(a)return Ws.error("[Toolbar] Failed to load",a),void this._setToolbarState(Ce.UNINITIALIZED);this._setToolbarState(Ce.LOADED),this._callLoadToolbar(s)}),B(p,"turbolinks:load",()=>{this._setToolbarState(Ce.UNINITIALIZED),this.loadToolbar(s)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,i)}}var Ra=J("[TracingHeaders]");class $a{constructor(e){w(this,"_restoreXHRPatch",void 0),w(this,"_restoreFetchPatch",void 0),w(this,"_startCapturing",()=>{var t,i,s,n;k(this._restoreXHRPatch)&&((t=P.__PosthogExtensions__)===null||t===void 0||(i=t.tracingHeadersPatchFns)===null||i===void 0||i._patchXHR(this._instance.sessionManager)),k(this._restoreFetchPatch)&&((s=P.__PosthogExtensions__)===null||s===void 0||(n=s.tracingHeadersPatchFns)===null||n===void 0||n._patchFetch(this._instance.sessionManager))}),this._instance=e}_loadScript(e){var t,i,s;(t=P.__PosthogExtensions__)!==null&&t!==void 0&&t.tracingHeadersPatchFns&&e(),(i=P.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",n=>{if(n)return Ra.error("failed to load script",n);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((e=this._restoreXHRPatch)===null||e===void 0||e.call(this),(t=this._restoreFetchPatch)===null||t===void 0||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Ae=J("[Web Vitals]"),Gs=9e5;class Oa{constructor(e){var t;w(this,"_enabledServerSide",!1),w(this,"_initialized",!1),w(this,"_buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),w(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this._buffer.metrics.length!==0&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce((i,s)=>f(f({},i),{},{["$web_vitals_".concat(s.name,"_event")]:f({},s),["$web_vitals_".concat(s.name,"_value")]:s.value}),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),w(this,"_addToBuffer",i=>{var s,n=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0);if(k(n))Ae.error("Could not read session ID. Dropping metrics!");else{this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this._currentURL();k(o)||($(i==null?void 0:i.name)||$(i==null?void 0:i.value)?Ae.error("Invalid metric received",i):this._maxAllowedValue&&i.value>=this._maxAllowedValue?Ae.error("Ignoring metric with value >= "+this._maxAllowedValue,i):(this._buffer.url!==o&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),k(this._buffer.url)&&(this._buffer.url=o),this._buffer.firstMetricTimestamp=k(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this._buffer.metrics.push(f(f({},i),{},{$current_url:o,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),w(this,"_startCapturing",()=>{var i,s,n,o,a=P.__PosthogExtensions__;k(a)||k(a.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:o}=a.postHogWebVitalsCallbacks),i&&s&&n&&o?(this.allowedMetrics.indexOf("LCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this._addToBuffer.bind(this)),this._initialized=!0):Ae.error("web vitals callbacks not loaded - not starting")}),this._instance=e,this._enabledServerSide=!((t=this._instance.persistence)===null||t===void 0||!t.props[jr]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=q(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return k(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props[zr])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=q(this._instance.config.capture_performance)&&K(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Gs;return 0<e&&e<=6e4?Gs:e}get isEnabled(){var e=ie==null?void 0:ie.protocol;if(e!=="http:"&&e!=="https:")return Ae.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:we(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return we(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Ae.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){var t=q(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=q(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[jr]:t}),this._instance.persistence.register({[zr]:i})),this._enabledServerSide=t,this.startIfEnabled()}_loadScript(e){var t,i,s;(t=P.__PosthogExtensions__)!==null&&t!==void 0&&t.postHogWebVitalsCallbacks&&e(),(i=P.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"web-vitals",n=>{n?Ae.error("failed to load script",n):e()})}_currentURL(){var e=p?p.location.href:void 0;return e||Ae.error("Could not determine current URL"),e}}var Aa=J("[Heatmaps]");function Ks(r){return q(r)&&"clientX"in r&&"clientY"in r&&K(r.clientX)&&K(r.clientY)}class La{constructor(e){var t;w(this,"rageclicks",new hs),w(this,"_enabledServerSide",!1),w(this,"_initialized",!1),w(this,"_flushInterval",null),this.instance=e,this._enabledServerSide=!((t=this.instance.persistence)===null||t===void 0||!t.props[mi])}get flushIntervalMilliseconds(){var e=5e3;return q(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return k(this.instance.config.capture_heatmaps)?k(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Aa.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this._flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this._flushInterval)!==null&&e!==void 0?e:void 0),(t=this._deadClicksCapture)===null||t===void 0||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[mi]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){p&&E&&(B(p,"beforeunload",this._flush.bind(this)),B(E,"click",e=>this._onClick(e||(p==null?void 0:p.event)),{capture:!0}),B(E,"mousemove",e=>this._onMouseMove(e||(p==null?void 0:p.event)),{capture:!0}),this._deadClicksCapture=new ms(this.instance,Go,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(a,l,c){for(var d=a;d&&zt(d)&&!Re(d,"body");){if(d===c)return!1;if(F(l,p==null?void 0:p.getComputedStyle(d).position))return!0;d=os(d)}return!1}(ns(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:i),target_fixed:o,type:t}}_onClick(e){var t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!es(e.target)&&Ks(e)){var s=this._getProperties(e,i);(t=this.rageclicks)!==null&&t!==void 0&&t.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._capture(f(f({},s),{},{type:"rageclick"})),this._capture(s)}}_onMouseMove(e){!es(e.target)&&Ks(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(p){var t=p.location.href;this._buffer=this._buffer||{},this._buffer[t]||(this._buffer[t]=[]),this._buffer[t].push(e)}}_flush(){this._buffer&&!Xe(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Ma{constructor(e){this._instance=e}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:(i=p==null?void 0:p.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this._currentPageview)===null||e===void 0?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:d,maxContentY:u}=n;if(!(k(o)||k(a)||k(l)||k(c)||k(d)||k(u))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d),u=Math.ceil(u);var h=o<=1?1:ae(a/o,0,1),_=o<=1?1:ae(l/o,0,1),g=c<=1?1:ae(d/c,0,1),v=c<=1?1:ae(u/c,0,1);s=H(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}class Da{constructor(e){this._instance=e}sendExceptionEvent(e){this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var ue="Mobile",ni="iOS",ge="Android",Et="Tablet",Js=ge+" "+Et,Ys="iPad",Qs="Apple",Xs=Qs+" Watch",xt="Safari",st="BlackBerry",Zs="Samsung",en=Zs+"Browser",tn=Zs+" Internet",We="Chrome",Na=We+" OS",rn=We+" "+ni,Zi="Internet Explorer",sn=Zi+" "+ue,er="Opera",qa=er+" Mini",tr="Edge",nn="Microsoft "+tr,nt="Firefox",on=nt+" "+ni,Ct="Nintendo",It="PlayStation",ot="Xbox",an=ge+" "+ue,ln=ue+" "+xt,Pt="Windows",ir=Pt+" Phone",un="Nokia",rr="Ouya",cn="Generic",Ba=cn+" "+ue.toLowerCase(),dn=cn+" "+Et.toLowerCase(),sr="Konqueror",X="(\\d+(\\.\\d+)?)",nr=new RegExp("Version/"+X),Ua=new RegExp(ot,"i"),ja=new RegExp(It+" \\w+","i"),Ha=new RegExp(Ct+" \\w+","i"),or=new RegExp(st+"|PlayBook|BB10","i"),za={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Va=(r,e)=>e&&F(e,Qs)||function(t){return F(t,xt)&&!F(t,We)&&!F(t,ge)}(r),_n=function(r,e){return e=e||"",F(r," OPR/")&&F(r,"Mini")?qa:F(r," OPR/")?er:or.test(r)?st:F(r,"IE"+ue)||F(r,"WPDesktop")?sn:F(r,en)?tn:F(r,tr)||F(r,"Edg/")?nn:F(r,"FBIOS")?"Facebook "+ue:F(r,"UCWEB")||F(r,"UCBrowser")?"UC Browser":F(r,"CriOS")?rn:F(r,"CrMo")||F(r,We)?We:F(r,ge)&&F(r,xt)?an:F(r,"FxiOS")?on:F(r.toLowerCase(),sr.toLowerCase())?sr:Va(r,e)?F(r,ue)?ln:xt:F(r,nt)?nt:F(r,"MSIE")||F(r,"Trident/")?Zi:F(r,"Gecko")?nt:""},Wa={[sn]:[new RegExp("rv:"+X)],[nn]:[new RegExp(tr+"?\\/"+X)],[We]:[new RegExp("("+We+"|CrMo)\\/"+X)],[rn]:[new RegExp("CriOS\\/"+X)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+X)],[xt]:[nr],[ln]:[nr],[er]:[new RegExp("(Opera|OPR)\\/"+X)],[nt]:[new RegExp(nt+"\\/"+X)],[on]:[new RegExp("FxiOS\\/"+X)],[sr]:[new RegExp("Konqueror[:/]?"+X,"i")],[st]:[new RegExp(st+" "+X),nr],[an]:[new RegExp("android\\s"+X,"i")],[tn]:[new RegExp(en+"\\/"+X)],[Zi]:[new RegExp("(rv:|MSIE )"+X)],Mozilla:[new RegExp("rv:"+X)]},Ga=function(r,e){var t=_n(r,e),i=Wa[t];if(k(i))return null;for(var s=0;s<i.length;s++){var n=i[s],o=r.match(n);if(o)return parseFloat(o[o.length-2])}return null},hn=[[new RegExp(ot+"; "+ot+" (.*?)[);]","i"),r=>[ot,r&&r[1]||""]],[new RegExp(Ct,"i"),[Ct,""]],[new RegExp(It,"i"),[It,""]],[or,[st,""]],[new RegExp(Pt,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ir,""];if(new RegExp(ue).test(e)&&!/IEMobile\b/.test(e))return[Pt+" "+ue,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=za[i]||"";return/arm/i.test(e)&&(s="RT"),[Pt,s]}return[Pt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[ni,e.join(".")]}return[ni,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=k(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+ge+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ge+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[ge,e.join(".")]}return[ge,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Na,""]],[/Linux|debian/i,["Linux",""]]],pn=function(r){return Ha.test(r)?Ct:ja.test(r)?It:Ua.test(r)?ot:new RegExp(rr,"i").test(r)?rr:new RegExp("("+ir+"|WPDesktop)","i").test(r)?ir:/iPad/.test(r)?Ys:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?Xs:or.test(r)?st:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(un,"i").test(r)?un:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?!new RegExp(ue).test(r)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)?/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?ge:Js:ge:new RegExp("(pda|"+ue+")","i").test(r)?Ba:new RegExp(Et,"i").test(r)&&!new RegExp(Et+" pc","i").test(r)?dn:""},gn=function(r){var e=pn(r);return e===Ys||e===Js||e==="Kobo"||e==="Kindle Fire"||e===dn?Et:e===Ct||e===ot||e===It||e===rr?"Console":e===Xs?"Wearable":e?ue:"Desktop"},oi="https?://(.*)",ai=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ka=Mt(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ai),ar="<masked>";function vn(r,e,t){if(!E)return{};var i=e?Mt([],ai,t||[]):[];return fn($i(E.URL,i,ar),r)}function fn(r,e){var t=Ka.concat(e||[]),i={};return O(t,function(s){var n=Gt(r,s);i[s]=n||null}),i}function mn(r){var e=function(n){return n?n.search(oi+"google.([^/?]*)")===0?"google":n.search(oi+"bing.com")===0?"bing":n.search(oi+"yahoo.com")===0?"yahoo":n.search(oi+"duckduckgo.com")===0?"duckduckgo":null:null}(r),t=e!="yahoo"?"q":"p",i={};if(!Te(e)){i.$search_engine=e;var s=E?Gt(E.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function yn(){return navigator.language||navigator.userLanguage}function bn(){return(E==null?void 0:E.referrer)||"$direct"}function wn(r,e){var t=r?Mt([],ai,e||[]):[],i=ie==null?void 0:ie.href.substring(0,1e3);return{r:bn().substring(0,1e3),u:i?$i(i,t,ar):void 0}}function Sn(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=tt(t))===null||e===void 0?void 0:e.host};if(i){s.$current_url=i;var n=tt(i);s.$host=n==null?void 0:n.host,s.$pathname=n==null?void 0:n.pathname;var o=fn(i);H(s,o)}if(t){var a=mn(t);H(s,a)}return s}function kn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ja(){try{return new Date().getTimezoneOffset()}catch{return}}function Ya(r,e){if(!G)return{};var t,i=r?Mt([],ai,e||[]):[],[s,n]=function(o){for(var a=0;a<hn.length;a++){var[l,c]=hn[a],d=l.exec(o),u=d&&(oe(c)?c(d,o):c);if(u)return u}return["",""]}(G);return H(Nt({$os:s,$os_version:n,$browser:_n(G,navigator.vendor),$device:pn(G),$device_type:gn(G),$timezone:kn(),$timezone_offset:Ja()}),{$current_url:$i(ie==null?void 0:ie.href,i,ar),$host:ie==null?void 0:ie.host,$pathname:ie==null?void 0:ie.pathname,$raw_user_agent:G.length>1e3?G.substring(0,997)+"...":G,$browser_version:Ga(G,navigator.vendor),$browser_language:yn(),$browser_language_prefix:(t=yn(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:p==null?void 0:p.screen.height,$screen_width:p==null?void 0:p.screen.width,$viewport_height:p==null?void 0:p.innerHeight,$viewport_width:p==null?void 0:p.innerWidth,$lib:"web",$lib_version:be.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var lr,ve=J("[FeatureFlags]"),ur="$active_feature_flags",at="$override_feature_flags",En="$feature_flag_payloads",Tt="$override_feature_flag_payloads",xn="$feature_flag_request_id",Cn=r=>{var e={};for(var[t,i]of Dt(r||{}))i&&(e[t]=i);return e},Qa=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]})),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return(i=e[t].metadata)===null||i===void 0?void 0:i.payload}).map(t=>{var i;return[t,(i=e[t].metadata)===null||i===void 0?void 0:i.payload]}))):ve.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r};(function(r){r.FeatureFlags="feature_flags",r.Recordings="recordings"})(lr||(lr={}));class Xa{constructor(e){w(this,"_override_warning",!1),w(this,"_hasLoadedFlags",!1),w(this,"_requestInFlight",!1),w(this,"_reloadingDisabled",!1),w(this,"_additionalReloadRequested",!1),w(this,"_decideCalled",!1),w(this,"_flagsLoadedFromRemote",!1),this._instance=e,this.featureFlagEventHandlers=[]}decide(){if(this._instance.config.__preview_remote_config)this._decideCalled=!0;else{var e=!this._reloadDebouncer&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:e})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Si),t=this._instance.get_property(at),i=this._instance.get_property(Tt);if(!i&&!t)return e||{};var s=H({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var o of n){var a,l,c=s[o],d=t==null?void 0:t[o],u=k(d)?(a=c==null?void 0:c.enabled)!==null&&a!==void 0&&a:!!d,h=k(d)?c.variant:typeof d=="string"?d:void 0,_=i==null?void 0:i[o],g=f(f({},c),{},{enabled:u,variant:u?h??(c==null?void 0:c.variant):void 0});u!==(c==null?void 0:c.enabled)&&(g.original_enabled=c==null?void 0:c.enabled),h!==(c==null?void 0:c.variant)&&(g.original_variant=c==null?void 0:c.variant),_&&(g.metadata=f(f({},c==null?void 0:c.metadata),{},{payload:_,original_payload:c==null||(l=c.metadata)===null||l===void 0?void 0:l.payload})),s[o]=g}return this._override_warning||(ve.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this._override_warning=!0),s}getFlagVariants(){var e=this._instance.get_property(Ze),t=this._instance.get_property(at);if(!t)return e||{};for(var i=H({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this._override_warning||(ve.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._instance.get_property(En),t=this._instance.get_property(Tt);if(!t)return e||{};for(var i=H({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this._override_warning||(ve.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callDecideEndpoint(e){var t;if(this._clearDebouncer(),!this._instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:f(f({},((t=this._instance.persistence)===null||t===void 0?void 0:t.get_initial_props())||{}),this._instance.get_property(mt)||{}),group_properties:this._instance.get_property(Ue)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0);var s=this._instance.config.__preview_flags_v2&&this._instance.config.__preview_remote_config;s&&(i.timezone=kn()),this._requestInFlight=!0,this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("api",s?"/flags/?v=2":"/decide/?v=4"),data:i,compression:this._instance.config.disable_compression?void 0:_e.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var o,a,l,c=!0;n.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),c=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this._instance._onRemoteConfig((l=n.json)!==null&&l!==void 0?l:{})),i.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!c,n.json&&(o=n.json.quotaLimited)!==null&&o!==void 0&&o.includes(lr.FeatureFlags)?ve.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags((a=n.json)!==null&&a!==void 0?a:{},c),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],s="".concat(i),n=this._instance.get_property(xn)||void 0,o=this._instance.get_property(jt)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(s))){var a,l,c,d,u,h,_,g,v,b,y;N(o[e])?o[e].push(s):o[e]=[s],(a=this._instance.persistence)===null||a===void 0||a.register({[jt]:o});var m=this.getFeatureFlagDetails(e),x={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:n,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)===null||l===void 0||(c=l.featureFlags)===null||c===void 0?void 0:c[e])||null,$feature_flag_bootstrapped_payload:((d=this._instance.config.bootstrap)===null||d===void 0||(u=d.featureFlagPayloads)===null||u===void 0?void 0:u[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};k(m==null||(h=m.metadata)===null||h===void 0?void 0:h.version)||(x.$feature_flag_version=m.metadata.version);var I,R=(_=m==null||(g=m.reason)===null||g===void 0?void 0:g.description)!==null&&_!==void 0?_:m==null||(v=m.reason)===null||v===void 0?void 0:v.code;R&&(x.$feature_flag_reason=R),m!=null&&(b=m.metadata)!==null&&b!==void 0&&b.id&&(x.$feature_flag_id=m.metadata.id),k(m==null?void 0:m.original_variant)&&k(m==null?void 0:m.original_enabled)||(x.$feature_flag_original_response=k(m.original_variant)?m.original_enabled:m.original_variant),m!=null&&(y=m.metadata)!==null&&y!==void 0&&y.original_payload&&(x.$feature_flag_original_payload=m==null||(I=m.metadata)===null||I===void 0?void 0:I.original_payload),this._instance.capture("$feature_flag_called",x)}return i}ve.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token;this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this._instance.get_distinct_id(),token:i},compression:this._instance.config.disable_compression?void 0:_e.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var n,o=(n=s.json)===null||n===void 0?void 0:n.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);ve.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this._hasLoadedFlags=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},u=Qa(o),h=u.flags,_=u.featureFlags,g=u.featureFlagPayloads;if(_){var v=o.requestId;if(N(_)){ve.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(_)for(var y=0;y<_.length;y++)b[_[y]]=!0;a&&a.register({[ur]:_,[Ze]:b})}else{var m=_,x=g,I=h;o.errorsWhileComputingFlags&&(m=f(f({},l),m),x=f(f({},c),x),I=f(f({},d),I)),a&&a.register(f({[ur]:Object.keys(Cn(m)),[Ze]:m||{},[En]:x||{},[Si]:I||{}},v?{[xn]:v}:{}))}}})(e,this._instance.persistence,i,s,n),this._fireFeatureFlagsCallbacks(t)}}override(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];ve.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ve.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(at),this._instance.persistence.unregister(Tt),void this._fireFeatureFlagsCallbacks();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this._override_warning=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(at);else if(i.flags)if(N(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[at]:s})}else this._instance.persistence.register({[at]:i.flags})}return"payloads"in i&&(i.payloads===!1?this._instance.persistence.unregister(Tt):i.payloads&&this._instance.persistence.register({[Tt]:i.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var i,s=(this._instance.get_property(Bt)||[]).find(l=>l.flagKey===e),n={["$feature_enrollment/".concat(e)]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=f(f({},this.getFlagVariants()),{},{[e]:t});(i=this._instance.persistence)===null||i===void 0||i.register({[ur]:Object.keys(Cn(a)),[Ze]:a}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],i=arguments.length>2?arguments[2]:void 0,s=this._instance.get_property(Bt),n=i?"&".concat(i.map(o=>"stage=".concat(o)).join("&")):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this._instance.config.token).concat(n)),method:"GET",callback:o=>{var a;if(o.json){var l=o.json.earlyAccessFeatures;return(a=this._instance.persistence)===null||a===void 0||a.register({[Bt]:l}),e(l)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],i=this._instance.get_property(mt)||{};this._instance.register({[mt]:f(f({},i),e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(mt)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],i=this._instance.get_property(Ue)||{};Object.keys(i).length!==0&&Object.keys(i).forEach(s=>{i[s]=f(f({},i[s]),e[s]),delete e[s]}),this._instance.register({[Ue]:f(f({},i),e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Ue)||{};this._instance.register({[Ue]:f(f({},t),{},{[e]:{}})})}else this._instance.unregister(Ue)}}var Za=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class cr{constructor(e){this._config=e,this.props={},this.campaign_params_saved=!1,this.name=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(e),this.storage=this._buildStorage(e),this.load(),e.debug&&C.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e),this.save()}_buildStorage(e){Za.indexOf(e.persistence.toLowerCase())===-1&&(C.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&z.is_supported()?z:t==="localstorage+cookie"&&Yt.is_supported()?Yt:t==="sessionstorage"&&W.is_supported()?W:t==="memory"?Vo:t==="cookie"?ke:Yt.is_supported()?Yt:ke}properties(){var e={};return O(this.props,function(t,i){if(i===Ze&&q(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/".concat(s[n])]=t[s[n]];else a=i,l=!1,(Te(o=Eo)?l:Tr&&o.indexOf===Tr?o.indexOf(a)!=-1:(O(o,function(c){if(l||(l=c===a))return Lt}),l))||(e[i]=t);var o,a,l}),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=H({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this._config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(q(e)){k(t)&&(t="None"),this.expire_days=k(i)?this.default_expiry:i;var s=!1;if(O(e,(n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=n,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(q(e)){this.expire_days=k(t)?this.default_expiry:t;var i=!1;if(O(e,(s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=vn(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Xe(Nt(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=E==null?void 0:E.referrer)?mn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:bn(),$referring_domain:E!=null&&E.referrer&&((e=tt(E.referrer))===null||e===void 0?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ci]||this.props[Ii]||this.register_once({[Pi]:wn(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_referrer_info(){return Nt({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};O([Ii,Ci],o=>{var a=this.props[o];a&&O(a,function(l,c){e["$initial_"+vi(c)]=l})});var t,i,s=this.props[Pi];if(s){var n=(t=Sn(s),i={},O(t,function(o,a){i["$initial_".concat(vi(a))]=o}),i);H(e,n)}return e}safe_merge(e){return O(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t){if(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),e.persistence!==t.persistence){var i=this._buildStorage(e),s=this.props;this.clear(),this.storage=i,this.props=s,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[vt]||{};i[e]=t,this.props[vt]=i,this.save()}remove_event_timer(e){var t=(this.props[vt]||{})[e];return k(t)||(delete this.props[vt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var In,U,Pn,Ge,Tn,Fn,dr,Rn,$n,_r,On,An,Ln,Mn,hr={},Dn=[],el=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,pr=Array.isArray;function Le(r,e){for(var t in e)r[t]=e[t];return r}function Nn(r){var e=r.parentNode;e&&e.removeChild(r)}function gr(r,e,t,i,s){var n={type:r,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:s??++Pn,__i:-1,__u:0};return s==null&&U.vnode!=null&&U.vnode(n),n}function vr(r){return r.children}function li(r,e){this.props=r,this.context=e}function lt(r,e){if(e==null)return r.__?lt(r.__,r.__i+1):null;for(var t;e<r.__k.length;e++)if((t=r.__k[e])!=null&&t.__e!=null)return t.__e;return typeof r.type=="function"?lt(r):null}function qn(r){var e,t;if((r=r.__)!=null&&r.__c!=null){for(r.__e=r.__c.base=null,e=0;e<r.__k.length;e++)if((t=r.__k[e])!=null&&t.__e!=null){r.__e=r.__c.base=t.__e;break}return qn(r)}}function fr(r){(!r.__d&&(r.__d=!0)&&Ge.push(r)&&!ui.__r++||Tn!==U.debounceRendering)&&((Tn=U.debounceRendering)||Fn)(ui)}function ui(){var r,e,t,i,s,n,o,a,l;for(Ge.sort(dr);r=Ge.shift();)r.__d&&(e=Ge.length,i=void 0,n=(s=(t=r).__v).__e,a=[],l=[],(o=t.__P)&&((i=Le({},s)).__v=s.__v+1,U.vnode&&U.vnode(i),Vn(o,i,s,t.__n,o.ownerSVGElement!==void 0,32&s.__u?[n]:null,a,n??lt(s),!!(32&s.__u),l),i.__.__k[i.__i]=i,rl(a,i,l),i.__e!=n&&qn(i)),Ge.length>e&&Ge.sort(dr));ui.__r=0}function Bn(r,e,t,i,s,n,o,a,l,c,d){var u,h,_,g,v,b=i&&i.__k||Dn,y=e.length;for(t.__d=l,tl(t,e,b),l=t.__d,u=0;u<y;u++)(_=t.__k[u])!=null&&typeof _!="boolean"&&typeof _!="function"&&(h=_.__i===-1?hr:b[_.__i]||hr,_.__i=u,Vn(r,_,h,s,n,o,a,l,c,d),g=_.__e,_.ref&&h.ref!=_.ref&&(h.ref&&mr(h.ref,null,_),d.push(_.ref,_.__c||g,_)),v==null&&g!=null&&(v=g),65536&_.__u||h.__k===_.__k?l=Un(_,l,r):typeof _.type=="function"&&_.__d!==void 0?l=_.__d:g&&(l=g.nextSibling),_.__d=void 0,_.__u&=-196609);t.__d=l,t.__e=v}function tl(r,e,t){var i,s,n,o,a,l=e.length,c=t.length,d=c,u=0;for(r.__k=[],i=0;i<l;i++)(s=r.__k[i]=(s=e[i])==null||typeof s=="boolean"||typeof s=="function"?null:typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?gr(null,s,null,null,s):pr(s)?gr(vr,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?gr(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)!=null?(s.__=r,s.__b=r.__b+1,a=il(s,t,o=i+u,d),s.__i=a,n=null,a!==-1&&(d--,(n=t[a])&&(n.__u|=131072)),n==null||n.__v===null?(a==-1&&u--,typeof s.type!="function"&&(s.__u|=65536)):a!==o&&(a===o+1?u++:a>o?d>l-o?u+=a-o:u--:u=a<o&&a==o-1?a-o:0,a!==i+u&&(s.__u|=65536))):(n=t[i])&&n.key==null&&n.__e&&(n.__e==r.__d&&(r.__d=lt(n)),yr(n,n,!1),t[i]=null,d--);if(d)for(i=0;i<c;i++)(n=t[i])!=null&&(131072&n.__u)==0&&(n.__e==r.__d&&(r.__d=lt(n)),yr(n,n))}function Un(r,e,t){var i,s;if(typeof r.type=="function"){for(i=r.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=r,e=Un(i[s],e,t));return e}return r.__e!=e&&(t.insertBefore(r.__e,e||null),e=r.__e),e&&e.nextSibling}function il(r,e,t,i){var s=r.key,n=r.type,o=t-1,a=t+1,l=e[t];if(l===null||l&&s==l.key&&n===l.type)return t;if(i>(l!=null&&(131072&l.__u)==0?1:0))for(;o>=0||a<e.length;){if(o>=0){if((l=e[o])&&(131072&l.__u)==0&&s==l.key&&n===l.type)return o;o--}if(a<e.length){if((l=e[a])&&(131072&l.__u)==0&&s==l.key&&n===l.type)return a;a++}}return-1}function jn(r,e,t){e[0]==="-"?r.setProperty(e,t??""):r[e]=t==null?"":typeof t!="number"||el.test(e)?t:t+"px"}function ci(r,e,t,i,s){var n;e:if(e==="style")if(typeof t=="string")r.style.cssText=t;else{if(typeof i=="string"&&(r.style.cssText=i=""),i)for(e in i)t&&e in t||jn(r.style,e,"");if(t)for(e in t)i&&t[e]===i[e]||jn(r.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")n=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in r?e.toLowerCase().slice(2):e.slice(2),r.l||(r.l={}),r.l[e+n]=t,t?i?t.u=i.u:(t.u=Date.now(),r.addEventListener(e,n?zn:Hn,n)):r.removeEventListener(e,n?zn:Hn,n);else{if(s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in r)try{r[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?r.removeAttribute(e):r.setAttribute(e,t))}}function Hn(r){var e=this.l[r.type+!1];if(r.t){if(r.t<=e.u)return}else r.t=Date.now();return e(U.event?U.event(r):r)}function zn(r){return this.l[r.type+!0](U.event?U.event(r):r)}function Vn(r,e,t,i,s,n,o,a,l,c){var d,u,h,_,g,v,b,y,m,x,I,R,A,L,T,D=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(d=U.__b)&&d(e);e:if(typeof D=="function")try{if(y=e.props,m=(d=D.contextType)&&i[d.__c],x=d?m?m.props.value:d.__:i,t.__c?b=(u=e.__c=t.__c).__=u.__E:("prototype"in D&&D.prototype.render?e.__c=u=new D(y,x):(e.__c=u=new li(y,x),u.constructor=D,u.render=nl),m&&m.sub(u),u.props=y,u.state||(u.state={}),u.context=x,u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),u.__s==null&&(u.__s=u.state),D.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Le({},u.__s)),Le(u.__s,D.getDerivedStateFromProps(y,u.__s))),_=u.props,g=u.state,u.__v=e,h)D.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(D.getDerivedStateFromProps==null&&y!==_&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(y,x),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(y,u.__s,x)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(u.props=y,u.state=u.__s,u.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(V){V&&(V.__=e)}),I=0;I<u._sb.length;I++)u.__h.push(u._sb[I]);u._sb=[],u.__h.length&&o.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(y,u.__s,x),u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(_,g,v)})}if(u.context=x,u.props=y,u.__P=r,u.__e=!1,R=U.__r,A=0,"prototype"in D&&D.prototype.render){for(u.state=u.__s,u.__d=!1,R&&R(e),d=u.render(u.props,u.state,u.context),L=0;L<u._sb.length;L++)u.__h.push(u._sb[L]);u._sb=[]}else do u.__d=!1,R&&R(e),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++A<25);u.state=u.__s,u.getChildContext!=null&&(i=Le(Le({},i),u.getChildContext())),h||u.getSnapshotBeforeUpdate==null||(v=u.getSnapshotBeforeUpdate(_,g)),Bn(r,pr(T=d!=null&&d.type===vr&&d.key==null?d.props.children:d)?T:[T],e,t,i,s,n,o,a,l,c),u.base=e.__e,e.__u&=-161,u.__h.length&&o.push(u),b&&(u.__E=u.__=null)}catch(V){e.__v=null,l||n!=null?(e.__e=a,e.__u|=l?160:32,n[n.indexOf(a)]=null):(e.__e=t.__e,e.__k=t.__k),U.__e(V,e,t)}else n==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=sl(t.__e,e,t,i,s,n,o,l,c);(d=U.diffed)&&d(e)}function rl(r,e,t){e.__d=void 0;for(var i=0;i<t.length;i++)mr(t[i],t[++i],t[++i]);U.__c&&U.__c(e,r),r.some(function(s){try{r=s.__h,s.__h=[],r.some(function(n){n.call(s)})}catch(n){U.__e(n,s.__v)}})}function sl(r,e,t,i,s,n,o,a,l){var c,d,u,h,_,g,v,b=t.props,y=e.props,m=e.type;if(m==="svg"&&(s=!0),n!=null){for(c=0;c<n.length;c++)if((_=n[c])&&"setAttribute"in _==!!m&&(m?_.localName===m:_.nodeType===3)){r=_,n[c]=null;break}}if(r==null){if(m===null)return document.createTextNode(y);r=s?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,y.is&&y),n=null,a=!1}if(m===null)b===y||a&&r.data===y||(r.data=y);else{if(n=n&&In.call(r.childNodes),b=t.props||hr,!a&&n!=null)for(b={},c=0;c<r.attributes.length;c++)b[(_=r.attributes[c]).name]=_.value;for(c in b)_=b[c],c=="children"||(c=="dangerouslySetInnerHTML"?u=_:c==="key"||c in y||ci(r,c,null,_,s));for(c in y)_=y[c],c=="children"?h=_:c=="dangerouslySetInnerHTML"?d=_:c=="value"?g=_:c=="checked"?v=_:c==="key"||a&&typeof _!="function"||b[c]===_||ci(r,c,_,b[c],s);if(d)a||u&&(d.__html===u.__html||d.__html===r.innerHTML)||(r.innerHTML=d.__html),e.__k=[];else if(u&&(r.innerHTML=""),Bn(r,pr(h)?h:[h],e,t,i,s&&m!=="foreignObject",n,o,n?n[0]:t.__k&&lt(t,0),a,l),n!=null)for(c=n.length;c--;)n[c]!=null&&Nn(n[c]);a||(c="value",g!==void 0&&(g!==r[c]||m==="progress"&&!g||m==="option"&&g!==b[c])&&ci(r,c,g,b[c],!1),c="checked",v!==void 0&&v!==r[c]&&ci(r,c,v,b[c],!1))}return r}function mr(r,e,t){try{typeof r=="function"?r(e):r.current=e}catch(i){U.__e(i,t)}}function yr(r,e,t){var i,s;if(U.unmount&&U.unmount(r),(i=r.ref)&&(i.current&&i.current!==r.__e||mr(i,null,e)),(i=r.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){U.__e(n,e)}i.base=i.__P=null,r.__c=void 0}if(i=r.__k)for(s=0;s<i.length;s++)i[s]&&yr(i[s],e,t||typeof r.type!="function");t||r.__e==null||Nn(r.__e),r.__=r.__e=r.__d=void 0}function nl(r,e,t){return this.constructor(r,t)}In=Dn.slice,U={__e:function(r,e,t,i){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(r)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(r,i||{}),o=s.__d),o)return s.__E=s}catch(a){r=a}throw r}},Pn=0,li.prototype.setState=function(r,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Le({},this.state),typeof r=="function"&&(r=r(Le({},t),this.props)),r&&Le(t,r),r!=null&&this.__v&&(e&&this._sb.push(e),fr(this))},li.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),fr(this))},li.prototype.render=vr,Ge=[],Fn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,dr=function(r,e){return r.__v.__b-e.__v.__b},ui.__r=0,Rn=0,function(r){r.Button="button",r.Tab="tab",r.Selector="selector"}($n||($n={})),function(r){r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger"}(_r||(_r={})),function(r){r.Popover="popover",r.API="api",r.Widget="widget"}(On||(On={})),function(r){r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link"}(An||(An={})),function(r){r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question"}(Ln||(Ln={})),function(r){r.Once="once",r.Recurring="recurring",r.Always="always"}(Mn||(Mn={}));var ut=function(r,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}},Z=J("[Surveys]"),Wn={icontains:(r,e)=>r.some(t=>e.toLowerCase().includes(t.toLowerCase())),not_icontains:(r,e)=>r.every(t=>!e.toLowerCase().includes(t.toLowerCase())),regex:(r,e)=>r.some(t=>ut(e,t)),not_regex:(r,e)=>r.every(t=>!ut(e,t)),exact:(r,e)=>r.some(t=>e===t),is_not:(r,e)=>r.every(t=>e!==t)};function Gn(r){return r??"icontains"}_r.Right,function(r,e){var t={__c:e="__cC"+Rn++,__:r,Consumer:function(i,s){return i.children(s)},Provider:function(i){var s,n;return this.getChildContext||(s=[],(n={})[e]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(o){this.props.value!==o.value&&s.some(function(a){a.__e=!0,fr(a)})},this.sub=function(o){s.push(o);var a=o.componentWillUnmount;o.componentWillUnmount=function(){s.splice(s.indexOf(o),1),a&&a.call(o)}}),i.children}};t.Provider.__=t.Consumer.contextType=t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});class Kn{constructor(){w(this,"_events",{}),this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(i=>i!==t)}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}class Ke{constructor(e){w(this,"_debugEventEmitter",new Kn),w(this,"_checkStep",(t,i)=>this._checkStepEvent(t,i)&&this._checkStepUrl(t,i)&&this._checkStepElement(t,i)),w(this,"_checkStepEvent",(t,i)=>i==null||!i.event||(t==null?void 0:t.event)===(i==null?void 0:i.event)),this._instance=e,this._actionEvents=new Set,this._actionRegistry=new Set}init(){var e;if(!k((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)){var t;(t=this._instance)===null||t===void 0||t._addCaptureHook((i,s)=>{this.on(i,s)})}}register(e){var t,i;if(!k((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(o=>{var a,l;(a=this._actionRegistry)===null||a===void 0||a.add(o),(l=o.steps)===null||l===void 0||l.forEach(c=>{var d;(d=this._actionEvents)===null||d===void 0||d.add((c==null?void 0:c.event)||"")})}),(i=this._instance)!==null&&i!==void 0&&i.autocapture)){var s,n=new Set;e.forEach(o=>{var a;(a=o.steps)===null||a===void 0||a.forEach(l=>{l!=null&&l.selector&&n.add(l==null?void 0:l.selector)})}),(s=this._instance)===null||s===void 0||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this._actionEvents.has(e)||this._actionEvents.has(t==null?void 0:t.event))&&this._actionRegistry&&((i=this._actionRegistry)===null||i===void 0?void 0:i.size)>0&&this._actionRegistry.forEach(s=>{this._checkAction(t,s)&&this._debugEventEmitter.emit("actionCaptured",s.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!s||typeof s!="string"||!Ke._matchString(s,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static _matchString(e,t,i){switch(i){case"regex":return!!p&&ut(e,t);case"exact":return t===e;case"contains":var s=Ke._escapeStringRegexp(t).replace(/_/g,".").replace(/%/g,".*");return ut(e,s);default:return!1}}static _escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}_checkStepElement(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this._getElementsList(e).some(n=>!(t!=null&&t.href&&!Ke._matchString(n.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||n.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!Ke._matchString(n.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!Ke._matchString(n.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var i,s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(!s||!s.includes(t==null?void 0:t.selector))return!1}return!0}_getElementsList(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}class ol{constructor(e){this._instance=e,this._eventToSurveys=new Map,this._actionToSurveys=new Map}register(e){var t;k((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)||(this._setupEventBasedSurveys(e),this._setupActionBasedSurveys(e))}_setupActionBasedSurveys(e){var t=e.filter(i=>{var s,n,o,a;return((s=i.conditions)===null||s===void 0?void 0:s.actions)&&((n=i.conditions)===null||n===void 0||(o=n.actions)===null||o===void 0||(a=o.values)===null||a===void 0?void 0:a.length)>0});t.length!==0&&(this._actionMatcher==null&&(this._actionMatcher=new Ke(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(i=>{this.onAction(i)})),t.forEach(i=>{var s,n,o,a,l,c,d,u,h,_;i.conditions&&(s=i.conditions)!==null&&s!==void 0&&s.actions&&(n=i.conditions)!==null&&n!==void 0&&(o=n.actions)!==null&&o!==void 0&&o.values&&((a=i.conditions)===null||a===void 0||(l=a.actions)===null||l===void 0||(c=l.values)===null||c===void 0?void 0:c.length)>0&&((d=this._actionMatcher)===null||d===void 0||d.register(i.conditions.actions.values),(u=i.conditions)===null||u===void 0||(h=u.actions)===null||h===void 0||(_=h.values)===null||_===void 0||_.forEach(g=>{if(g&&g.name){var v=this._actionToSurveys.get(g.name);v&&v.push(i.id),this._actionToSurveys.set(g.name,v||[i.id])}}))}))}_setupEventBasedSurveys(e){var t;e.filter(i=>{var s,n,o,a;return((s=i.conditions)===null||s===void 0?void 0:s.events)&&((n=i.conditions)===null||n===void 0||(o=n.events)===null||o===void 0||(a=o.values)===null||a===void 0?void 0:a.length)>0}).length!==0&&((t=this._instance)===null||t===void 0||t._addCaptureHook((i,s)=>{this.onEvent(i,s)}),e.forEach(i=>{var s,n,o;(s=i.conditions)===null||s===void 0||(n=s.events)===null||n===void 0||(o=n.values)===null||o===void 0||o.forEach(a=>{if(a&&a.name){var l=this._eventToSurveys.get(a.name);l&&l.push(i.id),this._eventToSurveys.set(a.name,l||[i.id])}})}))}onEvent(e,t){var i,s,n=((i=this._instance)===null||i===void 0||(s=i.persistence)===null||s===void 0?void 0:s.props[Ut])||[];if(e==="survey shown"&&t&&n.length>0){var o,a=t==null||(o=t.properties)===null||o===void 0?void 0:o.$survey_id;if(a){var l=n.indexOf(a);l>=0&&(n.splice(l,1),this._updateActivatedSurveys(n))}}else this._eventToSurveys.has(e)&&this._updateActivatedSurveys(n.concat(this._eventToSurveys.get(e)||[]))}onAction(e){var t,i,s=((t=this._instance)===null||t===void 0||(i=t.persistence)===null||i===void 0?void 0:i.props[Ut])||[];this._actionToSurveys.has(e)&&this._updateActivatedSurveys(s.concat(this._actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,i;(t=this._instance)===null||t===void 0||(i=t.persistence)===null||i===void 0||i.register({[Ut]:[...new Set(e)]})}getSurveys(){var e,t,i=(e=this._instance)===null||e===void 0||(t=e.persistence)===null||t===void 0?void 0:t.props[Ut];return i||[]}getEventToSurveys(){return this._eventToSurveys}_getActionMatcher(){return this._actionMatcher}}class al{constructor(e){w(this,"_isFetchingSurveys",!1),w(this,"_isInitializingSurveys",!1),w(this,"_surveyCallbacks",[]),this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if($(t))return Z.warn("Decide not loaded yet. Not loading surveys.");var i=N(t);this._hasSurveys=i?t.length>0:t,Z.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var t=[],i=0;i<localStorage.length;i++){var s=localStorage.key(i);s!=null&&s.startsWith("seenSurvey_")&&t.push(s)}return t})();e.forEach(t=>localStorage.removeItem(t))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)Z.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Z.info("Disabled. Not loading surveys.");else if(this._hasSurveys){var e=P==null?void 0:P.__PosthogExtensions__;if(e){this._isInitializingSurveys=!0;try{var t=e.generateSurveys;if(t)return void this._completeSurveyInitialization(t);var i=e.loadExternalDependency;if(!i)return void this._handleSurveyLoadError("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",s=>{s||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",s):this._completeSurveyInitialization(e.generateSurveys)})}catch(s){throw this._handleSurveyLoadError("Error initializing surveys",s),s}finally{this._isInitializingSurveys=!1}}else Z.error("PostHog Extensions not found.")}else Z.info("No surveys to load.")}_completeSurveyInitialization(e){this._surveyManager=e(this._instance),this._surveyEventReceiver=new ol(this._instance),Z.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){Z.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this._instance.config.disable_surveys)return Z.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(ki);if(i&&!t)return e(i,{isLoaded:!0});if(this._isFetchingSurveys)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this._instance.config.token)),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var n;this._isFetchingSurveys=!1;var o=s.statusCode;if(o!==200||!s.json){var a="Surveys API could not be loaded, status: ".concat(o);return Z.error(a),e([],{isLoaded:!1,error:a})}var l,c=s.json.surveys||[],d=c.filter(u=>{var h,_,g,v,b,y,m,x,I,R,A,L;return((h=u.conditions)===null||h===void 0?void 0:h.events)&&((_=u.conditions)===null||_===void 0||(g=_.events)===null||g===void 0?void 0:g.values)&&((v=u.conditions)===null||v===void 0||(b=v.events)===null||b===void 0||(y=b.values)===null||y===void 0?void 0:y.length)>0||((m=u.conditions)===null||m===void 0?void 0:m.actions)&&((x=u.conditions)===null||x===void 0||(I=x.actions)===null||I===void 0?void 0:I.values)&&((R=u.conditions)===null||R===void 0||(A=R.actions)===null||A===void 0||(L=A.values)===null||L===void 0?void 0:L.length)>0});return d.length>0&&((l=this._surveyEventReceiver)===null||l===void 0||l.register(d)),(n=this._instance.persistence)===null||n===void 0||n.register({[ki]:c}),e(c,{isLoaded:!0})}})}catch(s){throw this._isFetchingSurveys=!1,s}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(i){Z.error("Error in survey callback",i)}}_isSurveyFeatureFlagEnabled(e){return!e||this._instance.featureFlags.isFeatureEnabled(e)}getActiveMatchingSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(i=>{var s,n=i.filter(l=>!(!l.start_date||l.end_date)).filter(l=>{var c;if(!l.conditions)return!0;var d=function(_){var g,v,b;if((g=_.conditions)===null||g===void 0||!g.url)return!0;var y=p==null||(v=p.location)===null||v===void 0?void 0:v.href;if(!y)return!1;var m=[_.conditions.url];return Wn[Gn((b=_.conditions)===null||b===void 0?void 0:b.urlMatchType)](m,y)}(l),u=(c=l.conditions)===null||c===void 0||!c.selector||(E==null?void 0:E.querySelector(l.conditions.selector)),h=function(_){var g,v,b;if((g=_.conditions)===null||g===void 0||!g.deviceTypes||((v=_.conditions)===null||v===void 0?void 0:v.deviceTypes.length)===0)return!0;if(!G)return!1;var y=gn(G);return Wn[Gn((b=_.conditions)===null||b===void 0?void 0:b.deviceTypesMatchType)](_.conditions.deviceTypes,y)}(l);return d&&u&&h}),o=(s=this._surveyEventReceiver)===null||s===void 0?void 0:s.getSurveys(),a=n.filter(l=>{var c,d,u,h,_,g,v,b,y;if(!(l.linked_flag_key||l.targeting_flag_key||l.internal_targeting_flag_key||(c=l.feature_flag_keys)!==null&&c!==void 0&&c.length))return!0;var m=this._isSurveyFeatureFlagEnabled(l.linked_flag_key),x=this._isSurveyFeatureFlagEnabled(l.targeting_flag_key),I=((d=(u=l.conditions)===null||u===void 0||(h=u.events)===null||h===void 0||(_=h.values)===null||_===void 0?void 0:_.length)!==null&&d!==void 0?d:0)>0,R=((g=(v=l.conditions)===null||v===void 0||(b=v.actions)===null||b===void 0||(y=b.values)===null||y===void 0?void 0:y.length)!==null&&g!==void 0?g:0)>0,A=!I&&!R||(o==null?void 0:o.includes(l.id)),L=this._canActivateRepeatedly(l)||this._isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),T=this.checkFlags(l);return m&&x&&L&&A&&T});return e(a)},t)}checkFlags(e){var t;return(t=e.feature_flag_keys)===null||t===void 0||!t.length||e.feature_flag_keys.every(i=>{var{key:s,value:n}=i;return!s||!n||this._instance.featureFlags.isFeatureEnabled(n)})}_canActivateRepeatedly(e){var t;return $((t=P.__PosthogExtensions__)===null||t===void 0?void 0:t.canActivateRepeatedly)?(Z.warn("init was not called"),!1):P.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){if($(this._surveyManager))return Z.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=null;return this.getSurveys(i=>{var s=i.filter(n=>n.id===e)[0];t=s?f({},this._surveyManager.canRenderSurvey(s)):{visible:!1,disabledReason:"Survey not found"}}),t}canRenderSurveyAsync(e,t){return $(this._surveyManager)?(Z.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(s=>{var n=s.filter(o=>o.id===e)[0];i(n?f({},this._surveyManager.canRenderSurvey(n)):{visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){$(this._surveyManager)?Z.warn("init was not called"):this.getSurveys(i=>{var s=i.filter(n=>n.id===e)[0];this._surveyManager.renderSurvey(s,E==null?void 0:E.querySelector(t))})}}var Jn=J("[RateLimiter]");class ll{constructor(e){var t,i;w(this,"serverLimits",{}),w(this,"lastEventRateLimited",!1),w(this,"checkForLimiting",s=>{var n=s.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach(o=>{Jn.info("".concat(o||"events"," is quota limited.")),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void Jn.warn('could not rate limit - continuing. Error: "'.concat(o==null?void 0:o.message,'"'),{text:n})}}),this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)===null||t===void 0?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)===null||i===void 0?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,i,s=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=new Date().getTime(),o=(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_property(xi))!==null&&e!==void 0?e:{tokens:this.captureEventsBurstLimit,last:n};o.tokens+=(n-o.last)/1e3*this.captureEventsPerSecond,o.last=n,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||s||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||s||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(i=this.instance.persistence)===null||i===void 0||i.set_property(xi,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var Je=J("[RemoteConfig]");class ul{constructor(e){this._instance=e}get remoteConfig(){var e,t;return(e=P._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(t=e[this._instance.config.token])===null||t===void 0?void 0:t.config}_loadRemoteConfigJs(e){var t,i,s;(t=P.__PosthogExtensions__)!==null&&t!==void 0&&t.loadExternalDependency?(i=P.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):(Je.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/".concat(this._instance.config.token,"/config")),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Je.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance.config.advanced_disable_decide)return void Je.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Je.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(t=>{this._onRemoteConfig(t)});this._onRemoteConfig(e)})}catch(e){Je.error("Error loading remote config",e)}}_onRemoteConfig(e){e?this._instance.config.__preview_remote_config?(this._instance._onRemoteConfig(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Je.info("__preview_remote_config is disabled. Logging config instead",e):Je.error("Failed to fetch remote config from PostHog.")}}var cl=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
1
+ (function(Ee,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],v):(Ee=typeof globalThis<"u"?globalThis:Ee||self,v(Ee["dialog-vue"]={},Ee.Vue))})(this,function(Ee,v){"use strict";var rr;(function(r){r.OPEN_ASSISTANT="open_assistant",r.CLOSE_ASSISTANT="close_assistant",r.SEND_MESSAGE="PRODUCT_QUESTION",r.SEND_GENERIC_QUESTION="GENERIC_QUESTION"})(rr||(rr={}));var sr;(function(r){r.USER_OPENED_ASSISTANT="userOpenedAssistant",r.USER_CLOSED_ASSISTANT="userClosedAssistant",r.USER_SENT_MESSAGE="userSentMessage",r.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",r.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",r.USER_ADDED_TO_CART="userAddedToCart",r.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",r.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(sr||(sr={}));var h=typeof window<"u"?window:void 0,W=typeof globalThis<"u"?globalThis:h,nr=Array.prototype,ar=nr.forEach,or=nr.indexOf,K=W==null?void 0:W.navigator,y=W==null?void 0:W.document,z=W==null?void 0:W.location,ri=W==null?void 0:W.fetch,si=W!=null&&W.XMLHttpRequest&&"withCredentials"in new W.XMLHttpRequest?W.XMLHttpRequest:void 0,lr=W==null?void 0:W.AbortController,Y=K==null?void 0:K.userAgent,x=h??{},ge={DEBUG:!1,LIB_VERSION:"1.293.0"};function cr(r,e,t,i,s,n,a){try{var o=r[n](a),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(i,s)}function ur(r){return function(){var e=this,t=arguments;return new Promise(function(i,s){var n=r.apply(e,t);function a(l){cr(n,i,s,a,o,"next",l)}function o(l){cr(n,i,s,a,o,"throw",l)}a(void 0)})}}function E(){return E=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},E.apply(null,arguments)}function dr(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}var mn=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],hr=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return mn.concat(e).some(i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1})},yn=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function C(r,e){return r.indexOf(e)!==-1}var It=function(r){return r.trim()},ni=function(r){return r.replace(/^\$/,"")},bn=Array.isArray,pr=Object.prototype,fr=pr.hasOwnProperty,Tt=pr.toString,F=bn||function(r){return Tt.call(r)==="[object Array]"},ke=r=>typeof r=="function",q=r=>r===Object(r)&&!F(r),Ve=r=>{if(q(r)){for(var e in r)if(fr.call(r,e))return!1;return!0}return!1},m=r=>r===void 0,B=r=>Tt.call(r)=="[object String]",ai=r=>B(r)&&r.trim().length===0,_e=r=>r===null,R=r=>m(r)||_e(r),oe=r=>Tt.call(r)=="[object Number]",xe=r=>Tt.call(r)==="[object Boolean]",wn=r=>r instanceof FormData,En=r=>C(yn,r);function oi(r){return r===null||typeof r!="object"}function Ft(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function gr(r){return!m(Event)&&function(e,t){try{return e instanceof t}catch{return!1}}(r,Event)}var kn=[!0,"true",1,"1","yes"],li=r=>C(kn,r),xn=[!1,"false",0,"0","no"];function le(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),oe(r)?r>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),le(s||t,e,t,i))}class Sn{constructor(e){this.t={},this.i=e.i,this.o=le(e.bucketSize,0,100,e.h),this.m=le(e.refillRate,0,this.o,e.h),this.$=le(e.refillInterval,0,864e5,e.h)}S(e,t){var i=t-e.lastAccess,s=Math.floor(i/this.$);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var t,i=Date.now(),s=String(e),n=this.t[s];return n?this.S(n,i):(n={tokens:this.o,lastAccess:i},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}}var Ot,_r,ci,Cn=r=>r instanceof Error;function Pn(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ci&&t.length===_r||(_r=t.length,ci=t.reduce((i,s)=>{Ot||(Ot={});var n=Ot[s];if(n)i[n[0]]=n[1];else for(var a=r(s),o=a.length-1;o>=0;o--){var l=a[o],u=l==null?void 0:l.filename,c=e[s];if(u&&c){i[u]=c,Ot[s]=[u,c];break}}return i},{})),ci}}var He="?";function ui(r,e,t,i){var s={platform:"web:javascript",filename:r,function:e==="<anonymous>"?He:e,in_app:!0};return m(t)||(s.lineno=t),m(i)||(s.colno=i),s}var vr=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:He,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},$n=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,In=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Tn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Fn=r=>{var e=$n.exec(r);if(e){var[,t,i,s]=e;return ui(t,He,+i,+s)}var n=In.exec(r);if(n){if(n[2]&&n[2].indexOf("eval")===0){var a=Tn.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}var[o,l]=vr(n[1]||He,n[2]);return ui(l,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},On=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Dn=r=>{var e=On.exec(r);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=Rn.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}var i=e[3],s=e[1]||He;return[s,i]=vr(s,i),ui(i,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},mr=/\(error: (.*)\)/,yr=50;function Mn(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(i,s){s===void 0&&(s=0);for(var n=[],a=i.split(`
2
+ `),o=s;o<a.length;o++){var l=a[o];if(!(l.length>1024)){var u=mr.test(l)?l.replace(mr,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of e){var d=c(u);if(d){n.push(d);break}}if(n.length>=yr)break}}}return function(f){if(!f.length)return[];var p=Array.from(f);return p.reverse(),p.slice(0,yr).map(g=>{return E({},g,{filename:g.filename||(_=p,_[_.length-1]||{}).filename,function:g.function||He});var _})}(n)}}class An{constructor(e,t,i){e===void 0&&(e=[]),t===void 0&&(t=[]),i===void 0&&(i=[]),this.coercers=e,this.modifiers=i,this.stackParser=Mn(...t)}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(),a=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(a,i),$exception_level:"error"}}modifyFrames(e){var t=this;return ur(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&F(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),E({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ur(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,n,a={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,E({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:Pn(this.stackParser)}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var s=(n,a)=>{if(a<=4){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return E({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}}class Nn{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=B(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Ft(e,"DOMException")}isDOMError(e){return Ft(e,"DOMError")}}class Ln{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class Bn{constructor(){}match(e){return Ft(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var Un=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class qn{match(e){return typeof e=="string"}coerce(e,t){var i,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(Un);return s&&(t=s[1],i=s[2]),[t,i]}}var jn=["fatal","error","warning","log","info","debug"];function br(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class Vn{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return gr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+br(e)}isSeverityLevel(e){return B(e)&&!ai(e)&&jn.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Cn(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class Hn{match(e){return gr(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+br(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Gn{match(e){return oi(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Wn{match(e){return Ft(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return oi(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(oi(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var wr=r=>{var e={k:function(t){if(h&&(ge.DEBUG||x.POSTHOG_DEBUG)&&!m(h.console)&&h.console){for(var i=("__rrweb_original__"in h.console[t])?h.console[t].__rrweb_original__:h.console[t],s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];i(r,...n)}},info:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e.k("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e.k("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e.k("error",...i)},critical:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];console.error(r,...i)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>wr(r+" "+t)};return e},b=wr("[PostHog.js]"),U=b.createLogger,zn=U("[ExternalScriptsLoader]"),Er=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return zn.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=y==null?void 0:y.querySelectorAll("script");if(i){for(var s,n=function(){if(i[a].src===e){var l=i[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)}),l.onerror=u=>t(u),{v:void 0})}},a=0;a<i.length;a++)if(s=n())return s.v}var o=()=>{if(!y)return t("document not found");var l=y.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=d=>{l.__posthog_loading_callback_fired=!0,t(void 0,d)},l.onerror=d=>t(d),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");var u,c=y.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):y.body.appendChild(l)};y!=null&&y.body?o():y==null||y.addEventListener("DOMContentLoaded",o)};x.__PosthogExtensions__=x.__PosthogExtensions__||{},x.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);Er(r,n,t)},x.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);Er(r,i,t)};var Rt={};function Se(r,e,t){if(F(r)){if(ar&&r.forEach===ar)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Rt)return}}}function O(r,e,t){if(!R(r)){if(F(r))return Se(r,e,t);if(wn(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Rt)return}else for(var s in r)if(fr.call(r,s)&&e.call(t,r[s],s)===Rt)return}}var A=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Se(t,function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])}),r},Ge=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Se(t,function(s){Se(s,function(n){r.push(n)})}),r};function Dt(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var kr=function(r){try{return r()}catch{return}},Yn=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){b.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),b.critical(s)}}},di=function(r){var e={};return O(r,function(t,i){(B(t)&&t.length>0||oe(t))&&(e[i]=t)}),e};function Xn(r,e){return t=r,i=n=>B(n)&&!_e(e)?n.slice(0,e):n,s=new Set,function n(a,o){return a!==Object(a)?i?i(a,o):a:s.has(a)?void 0:(s.add(a),F(a)?(l=[],Se(a,u=>{l.push(n(u))})):(l={},O(a,(u,c)=>{s.has(u)||(l[c]=n(u,c))})),l);var l}(t);var t,i,s}var Kn=["herokuapp.com","vercel.app","netlify.app"];function Jn(r){var e=r==null?void 0:r.hostname;if(!B(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Kn)if(t===i)return!1;return!0}function xr(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function L(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r==null||r.addEventListener(e,t,{capture:s,passive:n})}var Sr="$people_distinct_id",nt="__alias",at="__timers",Cr="$autocapture_disabled_server_side",hi="$heatmaps_enabled_server_side",Pr="$exception_capture_enabled_server_side",pi="$error_tracking_suppression_rules",$r="$error_tracking_capture_extension_exceptions",Ir="$web_vitals_enabled_server_side",Tr="$dead_clicks_enabled_server_side",Fr="$web_vitals_allowed_metrics",fi="$session_recording_remote_config",Mt="$sesid",Or="$session_is_sampled",We="$enabled_feature_flags",ot="$early_access_features",gi="$feature_flag_details",lt="$stored_person_properties",Me="$stored_group_properties",_i="$surveys",At="$surveys_activated",Nt="$flag_call_reported",ve="$user_state",vi="$client_session_props",mi="$capture_rate_limit",yi="$initial_campaign_params",bi="$initial_referrer_info",Lt="$initial_person_info",Bt="$epp",Rr="__POSTHOG_TOOLBAR__",ct="$posthog_cookieless",Zn=[Sr,nt,"__cmpns",at,"$session_recording_enabled_server_side",hi,Mt,We,pi,ve,ot,gi,Me,lt,_i,Nt,vi,mi,yi,bi,Bt,Lt];function Dr(r){return r instanceof Element&&(r.id===Rr||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Ut(r){return!!r&&r.nodeType===1}function Ce(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function Mr(r){return!!r&&r.nodeType===3}function Ar(r){return!!r&&r.nodeType===11}function wi(r){return r?It(r).split(/\s+/):[]}function Nr(r){var e=h==null?void 0:h.location.href;return!!(e&&r&&r.some(t=>e.match(t)))}function qt(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return wi(e)}function Lr(r){return R(r)?null:It(r).split(/(\s+)/).filter(e=>dt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ut(r){var e="";return xi(r)&&!Gr(r)&&r.childNodes&&r.childNodes.length&&O(r.childNodes,function(t){var i;Mr(t)&&t.textContent&&(e+=(i=Lr(t.textContent))!==null&&i!==void 0?i:"")}),It(e)}function Br(r){return m(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Ei=["a","button","form","input","select","textarea","label"];function Ur(r,e){if(m(e))return!0;var t,i=function(n){if(e.some(a=>n.matches(a)))return{v:!0}};for(var s of r)if(t=i(s))return t.v;return!1}function qr(r){var e=r.parentNode;return!(!e||!Ut(e))&&e}var Qn=["next","previous","prev",">","<"],jr=10,Vr=[".ph-no-rageclick",".ph-no-capture"];function ea(r,e){if(!h||ki(r))return!1;var t,i,s;if(xe(e)?(t=!!e&&Vr,i=void 0):(t=(s=e==null?void 0:e.css_selector_ignorelist)!==null&&s!==void 0?s:Vr,i=e==null?void 0:e.content_ignorelist),t===!1)return!1;var{targetElementList:n}=Hr(r,!1);return!function(a,o){if(a===!1||m(a))return!1;var l;if(a===!0)l=Qn;else{if(!F(a))return!1;if(a.length>jr)return b.error("[PostHog] content_ignorelist array cannot exceed "+jr+" items. Use css_selector_ignorelist for more complex matching."),!1;l=a.map(u=>u.toLowerCase())}return o.some(u=>{var{safeText:c,ariaLabel:d}=u;return l.some(f=>c.includes(f)||d.includes(f))})}(i,n.map(a=>{var o;return{safeText:ut(a).toLowerCase(),ariaLabel:((o=a.getAttribute("aria-label"))==null?void 0:o.toLowerCase().trim())||""}}))&&!Ur(n,t)}var ki=r=>!r||Ce(r,"html")||!Ut(r),Hr=(r,e)=>{if(!h||ki(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!Ce(s,"body");)if(Ar(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=qr(s);if(!n)break;if(e||Ei.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var a=h.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:i}};function ta(r,e,t,i,s){var n,a,o,l;if(t===void 0&&(t=void 0),!h||ki(r)||(n=t)!=null&&n.url_allowlist&&!Nr(t.url_allowlist)||(a=t)!=null&&a.url_ignorelist&&Nr(t.url_ignorelist))return!1;if((o=t)!=null&&o.dom_event_allowlist){var u=t.dom_event_allowlist;if(u&&!u.some(g=>e.type===g))return!1}var{parentIsUsefulElement:c,targetElementList:d}=Hr(r,i);if(!function(g,_){var w=_==null?void 0:_.element_allowlist;if(m(w))return!0;var k,S=function(P){if(w.some(N=>P.tagName.toLowerCase()===N))return{v:!0}};for(var I of g)if(k=S(I))return k.v;return!1}(d,t)||!Ur(d,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var f=h.getComputedStyle(r);if(f&&f.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var p=r.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Ei.indexOf(p)>-1||r.getAttribute("contenteditable")==="true")}}function xi(r){for(var e=r;e.parentNode&&!Ce(e,"body");e=e.parentNode){var t=qt(e);if(C(t,"ph-sensitive")||C(t,"ph-no-capture"))return!1}if(C(qt(r),"ph-include"))return!0;var i=r.type||"";if(B(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(B(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Gr(r){return!!(Ce(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Ce(r,"select")||Ce(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Wr="(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})",ia=new RegExp("^(?:"+Wr+")$"),ra=new RegExp(Wr),zr="\\d{3}-?\\d{2}-?\\d{4}",sa=new RegExp("^("+zr+")$"),na=new RegExp("("+zr+")");function dt(r,e){return e===void 0&&(e=!0),!(R(r)||B(r)&&(r=It(r),(e?ia:ra).test((r||"").replace(/[- ]/g,""))||(e?sa:na).test(r)))}function Yr(r){var e=ut(r);return dt(e=(e+" "+Xr(r)).trim())?e:""}function Xr(r){var e="";return r&&r.childNodes&&r.childNodes.length&&O(r.childNodes,function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=ut(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Xr(t)).trim())}catch(n){b.error("[AutoCapture]",n)}}),e}function aa(r){return function(e){var t=e.map(i=>{var s,n,a="";if(i.tag_name&&(a+=i.tag_name),i.attr_class)for(var o of(i.attr_class.sort(),i.attr_class))a+="."+o.replace(/"/g,"");var l=E({},i.text?{text:i.text}:{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),u={};return Dt(l).sort((c,d)=>{var[f]=c,[p]=d;return f.localeCompare(p)}).forEach(c=>{var[d,f]=c;return u[Kr(d.toString())]=Kr(f.toString())}),a+=":",a+=Dt(u).map(c=>{var[d,f]=c;return d+'="'+f+'"'}).join("")});return t.join(";")}(function(e){return e.map(t=>{var i,s,n={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:oa(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dt(t).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return n.attributes[o]=l}),n})}(r))}function Kr(r){return r.replace(/"|\\"/g,'\\"')}function oa(r){var e=r.attr__class;return e?F(e)?e:wi(e):void 0}class Jr{constructor(e){this.disabled=e===!1;var t=q(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&i-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Si="$copy_autocapture",me=function(r){return r.GZipJS="gzip-js",r.Base64="base64",r}({}),jt=r=>{var e=y==null?void 0:y.createElement("a");return m(e)?null:(e.href=r,e)},la=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return O(r,function(n,a){m(n)||m(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(n)?n.name:n.toString()),i=encodeURIComponent(a),s[s.length]=i+"="+t)}),s.join(e)},Vt=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!F(t)||t.length<2)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{b.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},ht=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],a=s.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),c=[],d=0;d<u.length;d++){var f=u[d].split("=");F(f)&&(e.includes(f[0])?c.push(f[0]+"="+t):c.push(u[d]))}var p=l;return o!=null&&(p+="?"+c.join("&")),n!=null&&(p+="#"+n),p},Ht=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Zr=U("[AutoCapture]");function Ci(r,e){return e.length>r?e.slice(0,r)+"...":e}function ca(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Ut(e));return e}function ua(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};Ei.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=Ci(1024,Yr(r)):n.$el_text=Ci(1024,ut(r)));var a=qt(r);a.length>0&&(n.classes=a.filter(function(c){return c!==""})),O(r.attributes,function(c){var d;if((!Gr(r)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(i==null||!i.includes(c.name))&&!e&&dt(c.value)&&(d=c.name,!B(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var f=c.value;c.name==="class"&&(f=wi(f).join(" ")),n["attr__"+c.name]=Ci(1024,f)}});for(var o=1,l=1,u=r;u=ca(u);)o++,u.tagName===r.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}function da(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=e,u=[r],c=r;c.parentNode&&!Ce(c,"body");)Ar(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var d,f=[],p={},g=!1,_=!1;if(O(u,P=>{var N=xi(P);P.tagName.toLowerCase()==="a"&&(g=P.getAttribute("href"),g=N&&g&&dt(g)&&g),C(qt(P),"ph-no-capture")&&(_=!0),f.push(ua(P,n,a,o));var ne=function(J){if(!xi(J))return{};var $={};return O(J.attributes,function(de){if(de.name&&de.name.indexOf("data-ph-capture-attribute")===0){var Z=de.name.replace("data-ph-capture-attribute-",""),ae=de.value;Z&&ae&&dt(ae)&&($[Z]=ae)}}),$}(P);A(p,ne)}),_)return{props:{},explicitNoCapture:_};if(a||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?f[0].$el_text=Yr(r):f[0].$el_text=ut(r)),g){var w,k;f[0].attr__href=g;var S=(w=jt(g))==null?void 0:w.host,I=h==null||(k=h.location)==null?void 0:k.host;S&&I&&S!==I&&(d=g)}return{props:A({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:aa(f)},(t=f[0])!=null&&t.$el_text?{$el_text:(i=f[0])==null?void 0:i.$el_text}:{},d&&s.type==="click"?{$external_click_url:d}:{},p)}}class ha{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Jr(e.config.rageclick),this.R=null}get C(){var e,t,i=q(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map(s=>new RegExp(s)),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map(s=>new RegExp(s)),i}O(){if(this.isBrowserSupported()){if(h&&y){var e=i=>{i=i||(h==null?void 0:h.event);try{this.F(i)}catch(s){Zr.error("Failed to capture event",s)}};if(L(y,"submit",e,{capture:!0}),L(y,"change",e,{capture:!0}),L(y,"click",e,{capture:!0}),this.C.capture_copied_text){var t=i=>{i=i||(h==null?void 0:h.event),this.F(i,Si)};L(y,"copy",t,{capture:!0}),L(y,"cut",t,{capture:!0})}}}else Zr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.O(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Cr]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.R=e}getElementSelectors(e){var t,i=[];return(t=this.R)==null||t.forEach(s=>{var n=y==null?void 0:y.querySelectorAll(s);n==null||n.forEach(a=>{e===a&&i.push(s)})}),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[Cr],s=this.T;if(_e(s)&&!xe(i)&&!this.instance.M())return!1;var n=(t=this.T)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}F(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=Br(e);Mr(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&ea(s,this.instance.config.rageclick)&&this.F(e,"$rageclick");var n=t===Si;if(s&&ta(s,e,this.C,n,n?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=da(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.C.element_attribute_ignorelist,elementsChainAsString:this.I});if(o)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(a.$element_selectors=l),t===Si){var u,c=Lr(h==null||(u=h.getSelection())==null?void 0:u.toString()),d=e.type||"clipboard";if(!c)return!1;a.$selected_content=c,a.$copy_type=d}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return ke(y==null?void 0:y.querySelectorAll)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return oe(r)&&isFinite(r)&&Math.floor(r)===r});var Qr="0123456789abcdef";class Gt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Gt(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Qr.charAt(this.bytes[t]>>>4)+Qr.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Gt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class pa{constructor(){this.A=0,this.D=0,this.j=new fa}generate(){var e=this.generateOrAbort();if(m(e)){this.A=0;var t=this.generateOrAbort();if(m(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return Gt.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var es,ts=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};h&&!m(h.crypto)&&crypto.getRandomValues&&(ts=r=>crypto.getRandomValues(r));class fa{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(ts(this.N),this.U=0),this.N[this.U++]}}var Pe=()=>ga().toString(),ga=()=>(es||(es=new pa)).generate(),pt="",_a=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function va(r,e){if(e){var t=function(s,n){if(n===void 0&&(n=y),pt)return pt;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Pe();!pt&&o--;){var u=a.slice(o).join("."),c=l+"=1;domain=."+u+";path=/";n.cookie=c+";max-age=3",n.cookie.includes(l)&&(n.cookie=c+";max-age=0",pt=u)}return pt}(r);if(!t){var i=(s=>{var n=s.match(_a);return n?n[0]:""})(r);i!==t&&b.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var ce={H:()=>!!y,B:function(r){b.error("cookieStore error: "+r)},q:function(r){if(y){try{for(var e=r+"=",t=y.cookie.split(";").filter(n=>n.length),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},W:function(r){var e;try{e=JSON.parse(ce.q(r))||{}}catch{}return e},G:function(r,e,t,i,s){if(y)try{var n="",a="",o=va(y.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(a="; secure");var u=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&b.warn("cookieStore warning: large cookie, len="+u.length),y.cookie=u,u}catch{return}},V:function(r,e){if(y!=null&&y.cookie)try{ce.G(r,"",-1,e)}catch{return}}},Pi=null,M={H:function(){if(!_e(Pi))return Pi;var r=!0;if(m(h))r=!1;else try{var e="__mplssupport__";M.G(e,"xyz"),M.q(e)!=='"xyz"'&&(r=!1),M.V(e)}catch{r=!1}return r||b.error("localStorage unsupported; falling back to cookie store"),Pi=r,r},B:function(r){b.error("localStorage error: "+r)},q:function(r){try{return h==null?void 0:h.localStorage.getItem(r)}catch(e){M.B(e)}return null},W:function(r){try{return JSON.parse(M.q(r))||{}}catch{}return null},G:function(r,e){try{h==null||h.localStorage.setItem(r,JSON.stringify(e))}catch(t){M.B(t)}},V:function(r){try{h==null||h.localStorage.removeItem(r)}catch(e){M.B(e)}}},ma=["distinct_id",Mt,Or,Bt,Lt],Wt=E({},M,{W:function(r){try{var e={};try{e=ce.W(r)||{}}catch{}var t=A(e,JSON.parse(M.q(r)||"{}"));return M.G(r,t),t}catch{}return null},G:function(r,e,t,i,s,n){try{M.G(r,e,void 0,void 0,n);var a={};ma.forEach(o=>{e[o]&&(a[o]=e[o])}),Object.keys(a).length&&ce.G(r,a,t,i,s,n)}catch(o){M.B(o)}},V:function(r,e){try{h==null||h.localStorage.removeItem(r),ce.V(r,e)}catch(t){M.B(t)}}}),zt={},ya={H:function(){return!0},B:function(r){b.error("memoryStorage error: "+r)},q:function(r){return zt[r]||null},W:function(r){return zt[r]||null},G:function(r,e){zt[r]=e},V:function(r){delete zt[r]}},Ae=null,j={H:function(){if(!_e(Ae))return Ae;if(Ae=!0,m(h))Ae=!1;else try{var r="__support__";j.G(r,"xyz"),j.q(r)!=='"xyz"'&&(Ae=!1),j.V(r)}catch{Ae=!1}return Ae},B:function(r){b.error("sessionStorage error: ",r)},q:function(r){try{return h==null?void 0:h.sessionStorage.getItem(r)}catch(e){j.B(e)}return null},W:function(r){try{return JSON.parse(j.q(r))||null}catch{}return null},G:function(r,e){try{h==null||h.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){j.B(t)}},V:function(r){try{h==null||h.sessionStorage.removeItem(r)}catch(e){j.B(e)}}},ye=function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r}({});class ba{constructor(e){this._instance=e}get C(){return this._instance.config}get consent(){return this.J()?ye.DENIED:this.K}isOptedOut(){return this.C.cookieless_mode==="always"||this.consent===ye.DENIED||this.consent===ye.PENDING&&(this.C.opt_out_capturing_by_default||this.C.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===ye.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.C.cookie_expiration,this.C.cross_subdomain_cookie,this.C.secure_cookie)}reset(){this.Y.V(this.X,this.C.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return li(e)?ye.GRANTED:C(xn,e)?ye.DENIED:ye.PENDING}get Y(){if(!this.Z){var e=this.C.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?M:ce;var t=e==="localStorage"?ce:M;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(li(t.q(this.X))),t.V(this.X,this.C.cross_subdomain_cookie))}return this.Z}J(){return!!this.C.respect_dnt&&!!xr([K==null?void 0:K.doNotTrack,K==null?void 0:K.msDoNotTrack,x.doNotTrack],e=>li(e))}}var Yt=U("[Dead Clicks]"),wa=()=>!0,Ea=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(Tr)),i=r.instance.config.capture_dead_clicks;return xe(i)?i:t};class is{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Tr]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?Yt.error("failed to load script",s):e()})}et(){var e;if(y){if(!this.tt&&(e=x.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=q(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=x.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(y),Yt.info("starting...")}}else Yt.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Yt.info("stopping..."))}}var ft=U("[ExceptionAutocapture]");class ka{constructor(e){var t,i,s;this.rt=()=>{var n;if(h&&this.isEnabled&&(n=x.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var a=x.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=x.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=x.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.C.capture_unhandled_errors&&(this.st=a(this.captureException.bind(this))),!this.nt&&this.C.capture_unhandled_rejections&&(this.nt=o(this.captureException.bind(this))),!this.ot&&this.C.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(u){ft.error("failed to start",u),this.lt()}}},this._instance=e,this.ut=!((t=this._instance.persistence)==null||!t.props[Pr]),this.C=this.ht(),this.dt=new Sn({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:ft}),this.startIfEnabled()}ht(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return q(e)?t=E({},t,e):(m(e)?this.ut:e)&&(t=E({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.C.capture_console_errors||this.C.capture_unhandled_errors||this.C.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(ft.info("enabled"),this.it(this.rt))}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",s=>{if(s)return ft.error("failed to load script",s);e()})}lt(){var e,t,i;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(i=this.ot)==null||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ut=!!t||!1,this.C=this.ht(),this._instance.persistence&&this._instance.persistence.register({[Pr]:this.ut}),this.startIfEnabled()}captureException(e){var t,i,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(s)?ft.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}}function rs(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return ke(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}class xa{constructor(e){var t;this._instance=e,this.vt=(h==null||(t=h.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(b.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,b.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(h&&h.history){var i=this;(e=h.history.pushState)!=null&&e.__posthog_wrapped__||rs(h.history,"pushState",s=>function(n,a,o){s.call(this,n,a,o),i.ft("pushState")}),(t=h.history.replaceState)!=null&&t.__posthog_wrapped__||rs(h.history,"replaceState",s=>function(n,a,o){s.call(this,n,a,o),i.ft("replaceState")}),this.gt()}}ft(e){try{var t,i=h==null||(t=h.location)==null?void 0:t.pathname;if(!i)return;i!==this.vt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.vt=i}catch(s){b.error("Error capturing "+e+" pageview",s)}}gt(){if(!this.ct){var e=()=>{this.ft("popstate")};L(h,"popstate",e),this.ct=()=>{h&&h.removeEventListener("popstate",e)}}}}var $i=U("[SegmentIntegration]");function Sa(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var a=l=>{var u=()=>l.anonymousId()||Pe();i.config.get_device_id=u,l.id()&&(i.register({distinct_id:l.id(),$device_id:u()}),i.persistence.set_property(ve,"identified")),s()},o=n.user();"then"in o&&ke(o.then)?o.then(l=>a(l)):a(o)})(r,()=>{t.register((i=>{Promise&&Promise.resolve||$i.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,a)=>{if(!a)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||($i.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&($i.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var o=i.calculateEventProperties(a,n.event.properties);return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then(()=>{e()})})}var ss="posthog-js";function ns(r,e){var{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,u,c,d,f;if(!(n==="*"||n.includes(o.level))||!r.__loaded)return o;o.tags||(o.tags={});var p=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());o.tags["PostHog Person URL"]=p,r.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var g=((l=o.exception)==null?void 0:l.values)||[],_=g.map(k=>E({},k,{stacktrace:k.stacktrace?E({},k.stacktrace,{type:"raw",frames:(k.stacktrace.frames||[]).map(S=>E({},S,{platform:"web:javascript"}))}):void 0})),w={$exception_message:((u=g[0])==null?void 0:u.value)||o.message,$exception_type:(c=g[0])==null?void 0:c.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((d=g[0])==null?void 0:d.value)||o.message,$sentry_exception_type:(f=g[0])==null?void 0:f.type,$sentry_tags:o.tags};return t&&i&&(w.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),a&&r.exceptions.sendExceptionEvent(w),o}}class Ca{constructor(e,t,i,s,n,a){this.name=ss,this.setupOnce=function(o){o(ns(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}var Pa=h!=null&&h.location?Ht(h.location.hash,"__posthog")||Ht(location.hash,"state"):null,as="_postHogToolbarParams",os=U("[Toolbar]"),$e=function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r}($e||{});class $a{constructor(e){this.instance=e}_t(e){x.ph_toolbar_state=e}yt(){var e;return(e=x.ph_toolbar_state)!==null&&e!==void 0?e:$e.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),!h||!y)return!1;e=e??h.location,i=i??h.history;try{if(!t){try{h.localStorage.setItem("test","test"),h.localStorage.removeItem("test")}catch{return!1}t=h==null?void 0:h.localStorage}var s,n=Pa||Ht(e.hash,"__posthog")||Ht(e.hash,"state"),a=n?kr(()=>JSON.parse(atob(decodeURIComponent(n))))||kr(()=>JSON.parse(decodeURIComponent(n))):null;return a&&a.action==="ph_authorize"?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(as)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}bt(e){var t=x.ph_load_toolbar||x.ph_load_editor;!R(t)&&ke(t)?t(e,this.instance):os.warn("No toolbar load function found")}loadToolbar(e){var t=!(y==null||!y.getElementById(Rr));if(!h||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=E({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(h.localStorage.setItem(as,JSON.stringify(E({},s,{source:void 0}))),this.yt()===$e.LOADED)this.bt(s);else if(this.yt()===$e.UNINITIALIZED){var n;this._t($e.LOADING),(n=x.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",a=>{if(a)return os.error("[Toolbar] Failed to load",a),void this._t($e.UNINITIALIZED);this._t($e.LOADED),this.bt(s)}),L(h,"turbolinks:load",()=>{this._t($e.UNINITIALIZED),this.loadToolbar(s)})}return!0}wt(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Ia=U("[TracingHeaders]");class Ta{constructor(e){this.xt=void 0,this.$t=void 0,this.rt=()=>{var t,i;m(this.xt)&&((t=x.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),m(this.$t)&&((i=x.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",s=>{if(s)return Ia.error("failed to load script",s);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.xt)==null||e.call(this),(t=this.$t)==null||t.call(this),this.xt=void 0,this.$t=void 0)}}var ee="Mobile",Xt="iOS",ue="Android",gt="Tablet",ls=ue+" "+gt,cs="iPad",us="Apple",ds=us+" Watch",_t="Safari",ze="BlackBerry",hs="Samsung",ps=hs+"Browser",fs=hs+" Internet",Ne="Chrome",Fa=Ne+" OS",gs=Ne+" "+Xt,Ii="Internet Explorer",_s=Ii+" "+ee,Ti="Opera",Oa=Ti+" Mini",Fi="Edge",vs="Microsoft "+Fi,Ye="Firefox",ms=Ye+" "+Xt,vt="Nintendo",mt="PlayStation",Xe="Xbox",ys=ue+" "+ee,bs=ee+" "+_t,yt="Windows",Oi=yt+" Phone",ws="Nokia",Ri="Ouya",Es="Generic",Ra=Es+" "+ee.toLowerCase(),ks=Es+" "+gt.toLowerCase(),Di="Konqueror",H="(\\d+(\\.\\d+)?)",Mi=new RegExp("Version/"+H),Da=new RegExp(Xe,"i"),Ma=new RegExp(mt+" \\w+","i"),Aa=new RegExp(vt+" \\w+","i"),Ai=new RegExp(ze+"|PlayBook|BB10","i"),Na={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},La=(r,e)=>e&&C(e,us)||function(t){return C(t,_t)&&!C(t,Ne)&&!C(t,ue)}(r),xs=function(r,e){return e=e||"",C(r," OPR/")&&C(r,"Mini")?Oa:C(r," OPR/")?Ti:Ai.test(r)?ze:C(r,"IE"+ee)||C(r,"WPDesktop")?_s:C(r,ps)?fs:C(r,Fi)||C(r,"Edg/")?vs:C(r,"FBIOS")?"Facebook "+ee:C(r,"UCWEB")||C(r,"UCBrowser")?"UC Browser":C(r,"CriOS")?gs:C(r,"CrMo")||C(r,Ne)?Ne:C(r,ue)&&C(r,_t)?ys:C(r,"FxiOS")?ms:C(r.toLowerCase(),Di.toLowerCase())?Di:La(r,e)?C(r,ee)?bs:_t:C(r,Ye)?Ye:C(r,"MSIE")||C(r,"Trident/")?Ii:C(r,"Gecko")?Ye:""},Ba={[_s]:[new RegExp("rv:"+H)],[vs]:[new RegExp(Fi+"?\\/"+H)],[Ne]:[new RegExp("("+Ne+"|CrMo)\\/"+H)],[gs]:[new RegExp("CriOS\\/"+H)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+H)],[_t]:[Mi],[bs]:[Mi],[Ti]:[new RegExp("(Opera|OPR)\\/"+H)],[Ye]:[new RegExp(Ye+"\\/"+H)],[ms]:[new RegExp("FxiOS\\/"+H)],[Di]:[new RegExp("Konqueror[:/]?"+H,"i")],[ze]:[new RegExp(ze+" "+H),Mi],[ys]:[new RegExp("android\\s"+H,"i")],[fs]:[new RegExp(ps+"\\/"+H)],[Ii]:[new RegExp("(rv:|MSIE )"+H)],Mozilla:[new RegExp("rv:"+H)]},Ua=function(r,e){var t=xs(r,e),i=Ba[t];if(m(i))return null;for(var s=0;s<i.length;s++){var n=i[s],a=r.match(n);if(a)return parseFloat(a[a.length-2])}return null},Ss=[[new RegExp(Xe+"; "+Xe+" (.*?)[);]","i"),r=>[Xe,r&&r[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(mt,"i"),[mt,""]],[Ai,[ze,""]],[new RegExp(yt,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Oi,""];if(new RegExp(ee).test(e)&&!/IEMobile\b/.test(e))return[yt+" "+ee,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=Na[i]||"";return/arm/i.test(e)&&(s="RT"),[yt,s]}return[yt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Xt,e.join(".")]}return[Xt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=m(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+ue+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ue+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[ue,e.join(".")]}return[ue,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Fa,""]],[/Linux|debian/i,["Linux",""]]],Cs=function(r){return Aa.test(r)?vt:Ma.test(r)?mt:Da.test(r)?Xe:new RegExp(Ri,"i").test(r)?Ri:new RegExp("("+Oi+"|WPDesktop)","i").test(r)?Oi:/iPad/.test(r)?cs:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?ds:Ai.test(r)?ze:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(ws,"i").test(r)?ws:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?!new RegExp(ee).test(r)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)?/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?ue:ls:ue:new RegExp("(pda|"+ee+")","i").test(r)?Ra:new RegExp(gt,"i").test(r)&&!new RegExp(gt+" pc","i").test(r)?ks:""},Kt="https?://(.*)",Ke=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],qa=Ge(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ke),bt="<masked>",ja=["li_fat_id"];function Ps(r,e,t){if(!y)return{};var i,s=e?Ge([],Ke,t||[]):[],n=$s(ht(y.URL,s,bt),r),a=(i={},O(ja,function(o){var l=ce.q(o);i[o]=l||null}),i);return A(a,n)}function $s(r,e){var t=qa.concat(e||[]),i={};return O(t,function(s){var n=Vt(r,s);i[s]=n||null}),i}function Is(r){var e=function(n){return n?n.search(Kt+"google.([^/?]*)")===0?"google":n.search(Kt+"bing.com")===0?"bing":n.search(Kt+"yahoo.com")===0?"yahoo":n.search(Kt+"duckduckgo.com")===0?"duckduckgo":null:null}(r),t=e!="yahoo"?"q":"p",i={};if(!_e(e)){i.$search_engine=e;var s=y?Vt(y.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Ts(){return navigator.language||navigator.userLanguage}function Fs(){return(y==null?void 0:y.referrer)||"$direct"}function Os(r,e){var t=r?Ge([],Ke,e||[]):[],i=z==null?void 0:z.href.substring(0,1e3);return{r:Fs().substring(0,1e3),u:i?ht(i,t,bt):void 0}}function Rs(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=jt(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=jt(i);s.$host=n==null?void 0:n.host,s.$pathname=n==null?void 0:n.pathname;var a=$s(i);A(s,a)}if(t){var o=Is(t);A(s,o)}return s}function Ds(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Va(){try{return new Date().getTimezoneOffset()}catch{return}}function Ha(r,e){if(!Y)return{};var t,i,s,n=r?Ge([],Ke,e||[]):[],[a,o]=function(l){for(var u=0;u<Ss.length;u++){var[c,d]=Ss[u],f=c.exec(l),p=f&&(ke(d)?d(f,l):d);if(p)return p}return["",""]}(Y);return A(di({$os:a,$os_version:o,$browser:xs(Y,navigator.vendor),$device:Cs(Y),$device_type:(i=Y,s=Cs(i),s===cs||s===ls||s==="Kobo"||s==="Kindle Fire"||s===ks?gt:s===vt||s===Xe||s===mt||s===Ri?"Console":s===ds?"Wearable":s?ee:"Desktop"),$timezone:Ds(),$timezone_offset:Va()}),{$current_url:ht(z==null?void 0:z.href,n,bt),$host:z==null?void 0:z.host,$pathname:z==null?void 0:z.pathname,$raw_user_agent:Y.length>1e3?Y.substring(0,997)+"...":Y,$browser_version:Ua(Y,navigator.vendor),$browser_language:Ts(),$browser_language_prefix:(t=Ts(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:h==null?void 0:h.screen.height,$screen_width:h==null?void 0:h.screen.width,$viewport_height:h==null?void 0:h.innerHeight,$viewport_width:h==null?void 0:h.innerWidth,$lib:"web",$lib_version:ge.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Ie=U("[Web Vitals]"),Ms=9e5;class Ga{constructor(e){var t;this.St=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Et=()=>{clearTimeout(this.kt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((i,s)=>E({},i,{["$web_vitals_"+s.name+"_event"]:E({},s),["$web_vitals_"+s.name+"_value"]:s.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=i=>{var s,n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(m(n))Ie.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.Tt();m(a)||(R(i==null?void 0:i.name)||R(i==null?void 0:i.value)?Ie.error("Invalid metric received",i):this.It&&i.value>=this.It?Ie.error("Ignoring metric with value >= "+this.It,i):(this.N.url!==a&&(this.Et(),this.kt=setTimeout(this.Et,this.flushToCaptureTimeoutMs)),m(this.N.url)&&(this.N.url=a),this.N.firstMetricTimestamp=m(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.N.metrics.push(E({},i,{$current_url:a,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Et()))}},this.rt=()=>{var i,s,n,a,o=x.__PosthogExtensions__;m(o)||m(o.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:a}=o.postHogWebVitalsCallbacks),i&&s&&n&&a?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.Pt.bind(this)),this.P=!0):Ie.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.St=!((t=this._instance.persistence)==null||!t.props[Ir]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=q(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return m(i)?((t=this._instance.persistence)==null?void 0:t.props[Fr])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get It(){var e=q(this._instance.config.capture_performance)&&oe(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Ms;return 0<e&&e<=6e4?Ms:e}get isEnabled(){var e=z==null?void 0:z.protocol;if(e!=="http:"&&e!=="https:")return Ie.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:xe(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return xe(t)?t:this.St}startIfEnabled(){this.isEnabled&&!this.P&&(Ie.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=q(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=q(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ir]:t}),this._instance.persistence.register({[Fr]:i})),this.St=t,this.startIfEnabled()}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"web-vitals",s=>{s?Ie.error("failed to load script",s):e()})}Tt(){var e=h?h.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?Ge([],Ke,i||[]):[];return ht(e,s,bt)}Ie.error("Could not determine current URL")}}var Wa=U("[Heatmaps]");function As(r){return q(r)&&"clientX"in r&&"clientY"in r&&oe(r.clientX)&&oe(r.clientY)}class za{constructor(e){var t;this.St=!1,this.P=!1,this.Rt=null,this.instance=e,this.St=!((t=this.instance.persistence)==null||!t.props[hi]),this.rageclicks=new Jr(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return q(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return m(this.instance.config.capture_heatmaps)?m(this.instance.config.enable_heatmaps)?this.St:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;Wa.info("starting..."),this.Ct(),this.Ot()}else{var e;clearInterval((e=this.Rt)!==null&&e!==void 0?e:void 0),this.Ft(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[hi]:t}),this.St=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Mt(e){this.At(e.originalEvent,"deadclick")}Ot(){this.Rt&&clearInterval(this.Rt),this.Rt=function(e){return(e==null?void 0:e.visibilityState)==="visible"}(y)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ct(){h&&y&&(this.jt=this.Dt.bind(this),L(h,"beforeunload",this.jt),this.Lt=e=>this.At(e||(h==null?void 0:h.event)),L(y,"click",this.Lt,{capture:!0}),this.Nt=e=>this.Ut(e||(h==null?void 0:h.event)),L(y,"mousemove",this.Nt,{capture:!0}),this.zt=new is(this.instance,wa,this.Mt.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ot.bind(this),L(y,"visibilitychange",this.Ht),this.P=!0)}Ft(){var e;h&&y&&(this.jt&&h.removeEventListener("beforeunload",this.jt),this.Lt&&y.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&y.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&y.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),(e=this.zt)==null||e.stop(),this.P=!1)}qt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=function(o,l,u){for(var c=o;c&&Ut(c)&&!Ce(c,"body");){if(c===u)return!1;if(C(l,h==null?void 0:h.getComputedStyle(c).position))return!0;c=qr(c)}return!1}(Br(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:s),y:e.clientY+(a?0:i),target_fixed:a,type:t}}At(e,t){var i;if(t===void 0&&(t="click"),!Dr(e.target)&&As(e)){var s=this.qt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Wt(E({},s,{type:"rageclick"})),this.Wt(s)}}Ut(e){!Dr(e.target)&&As(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout(()=>{this.Wt(this.qt(e,"mousemove"))},500))}Wt(e){if(h){var t=h.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?Ge([],Ke,s||[]):[],a=ht(t,n,bt);this.N=this.N||{},this.N[a]||(this.N[a]=[]),this.N[a].push(e)}}Dt(){this.N&&!Ve(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Ya{constructor(e){this._instance=e}doPageView(e,t){var i,s=this.Gt(e,t);return this.Vt={pathname:(i=h==null?void 0:h.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Gt(e,(t=this.Vt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vt)==null?void 0:e.pageViewId}}Gt(e,t){var i=this.Vt;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:d}=n;if(!(m(a)||m(o)||m(l)||m(u)||m(c)||m(d))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),d=Math.ceil(d);var f=a<=1?1:le(o/a,0,1,b),p=a<=1?1:le(l/a,0,1,b),g=u<=1?1:le(c/u,0,1,b),_=u<=1?1:le(d/u,0,1,b);s=A(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var te=Uint8Array,X=Uint16Array,Je=Uint32Array,Ni=new te([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]),Li=new te([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]),Ns=new te([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ls=function(r,e){for(var t=new X(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new Je(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},Bs=Ls(Ni,2),Xa=Bs[0],Bi=Bs[1];Xa[28]=258,Bi[258]=28;for(var Us=Ls(Li,0)[1],qs=new X(32768),D=0;D<32768;++D){var Le=(43690&D)>>>1|(21845&D)<<1;Le=(61680&(Le=(52428&Le)>>>2|(13107&Le)<<2))>>>4|(3855&Le)<<4,qs[D]=((65280&Le)>>>8|(255&Le)<<8)>>>1}var wt=function(r,e,t){for(var i=r.length,s=0,n=new X(e);s<i;++s)++n[r[s]-1];var a,o=new X(e);for(s=0;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;for(a=new X(i),s=0;s<i;++s)a[s]=qs[o[r[s]-1]++]>>>15-r[s];return a},Be=new te(288);for(D=0;D<144;++D)Be[D]=8;for(D=144;D<256;++D)Be[D]=9;for(D=256;D<280;++D)Be[D]=7;for(D=280;D<288;++D)Be[D]=8;var Jt=new te(32);for(D=0;D<32;++D)Jt[D]=5;var Ka=wt(Be,9),Ja=wt(Jt,5),js=function(r){return(r/8>>0)+(7&r&&1)},Vs=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof X?X:r instanceof Je?Je:te)(t-e);return i.set(r.subarray(e,t)),i},be=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},Et=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},Ui=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new te(0),0];if(s==1){var a=new te(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort(function(N,ne){return N.f-ne.f}),t.push({s:-1,f:25001});var o=t[0],l=t[1],u=0,c=1,d=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=s-1;)o=t[t[u].f<t[d].f?u++:d++],l=t[u!=c&&t[u].f<t[d].f?u++:d++],t[c++]={s:-1,f:o.f+l.f,l:o,r:l};var f=n[0].s;for(i=1;i<s;++i)n[i].s>f&&(f=n[i].s);var p=new X(f+1),g=qi(t[c-1],p,0);if(g>e){i=0;var _=0,w=g-e,k=1<<w;for(n.sort(function(N,ne){return p[ne.s]-p[N.s]||N.f-ne.f});i<s;++i){var S=n[i].s;if(!(p[S]>e))break;_+=k-(1<<g-p[S]),p[S]=e}for(_>>>=w;_>0;){var I=n[i].s;p[I]<e?_-=1<<e-p[I]++-1:++i}for(;i>=0&&_;--i){var P=n[i].s;p[P]==e&&(--p[P],++_)}g=e}return[new te(p),g]},qi=function(r,e,t){return r.s==-1?Math.max(qi(r.l,e,t+1),qi(r.r,e,t+1)):e[r.s]=t},Hs=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new X(++e),i=0,s=r[0],n=1,a=function(l){t[i++]=l},o=1;o<=e;++o)if(r[o]==s&&o!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=r[o]}return[t.subarray(0,i),e]},kt=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},ji=function(r,e,t){var i=t.length,s=js(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},Gs=function(r,e,t,i,s,n,a,o,l,u,c){be(e,c++,t),++s[256];for(var d=Ui(s,15),f=d[0],p=d[1],g=Ui(n,15),_=g[0],w=g[1],k=Hs(f),S=k[0],I=k[1],P=Hs(_),N=P[0],ne=P[1],J=new X(19),$=0;$<S.length;++$)J[31&S[$]]++;for($=0;$<N.length;++$)J[31&N[$]]++;for(var de=Ui(J,7),Z=de[0],ae=de[1],ie=19;ie>4&&!Z[Ns[ie-1]];--ie);var we,he,pe,it,Fe=u+5<<3,je=kt(s,Be)+kt(n,Jt)+a,fe=kt(s,f)+kt(n,_)+a+14+3*ie+kt(J,Z)+(2*J[16]+3*J[17]+7*J[18]);if(Fe<=je&&Fe<=fe)return ji(e,c,r.subarray(l,l+u));if(be(e,c,1+(fe<je)),c+=2,fe<je){we=wt(f,p),he=f,pe=wt(_,w),it=_;var Oe=wt(Z,ae);for(be(e,c,I-257),be(e,c+5,ne-1),be(e,c+10,ie-4),c+=14,$=0;$<ie;++$)be(e,c+3*$,Z[Ns[$]]);c+=3*ie;for(var rt=[S,N],G=0;G<2;++G){var re=rt[G];for($=0;$<re.length;++$){var Q=31&re[$];be(e,c,Oe[Q]),c+=Z[Q],Q>15&&(be(e,c,re[$]>>>5&127),c+=re[$]>>>12)}}}else we=Ka,he=Be,pe=Ja,it=Jt;for($=0;$<o;++$)if(i[$]>255){Q=i[$]>>>18&31,Et(e,c,we[Q+257]),c+=he[Q+257],Q>7&&(be(e,c,i[$]>>>23&31),c+=Ni[Q]);var st=31&i[$];Et(e,c,pe[st]),c+=it[st],st>3&&(Et(e,c,i[$]>>>5&8191),c+=Li[st])}else Et(e,c,we[i[$]]),c+=he[i[$]];return Et(e,c,we[256]),c+he[256]},Za=new Je([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qa=function(){for(var r=new Je(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r}(),eo=function(r,e,t,i,s){return function(n,a,o,l,u,c){var d=n.length,f=new te(l+d+5*(1+Math.floor(d/7e3))+u),p=f.subarray(l,f.length-u),g=0;if(!a||d<8)for(var _=0;_<=d;_+=65535){var w=_+65535;w<d?g=ji(p,g,n.subarray(_,w)):(p[_]=c,g=ji(p,g,n.subarray(_,d)))}else{for(var k=Za[a-1],S=k>>>13,I=8191&k,P=(1<<o)-1,N=new X(32768),ne=new X(P+1),J=Math.ceil(o/3),$=2*J,de=function(ir){return(n[ir]^n[ir+1]<<J^n[ir+2]<<$)&P},Z=new Je(25e3),ae=new X(288),ie=new X(32),we=0,he=0,pe=(_=0,0),it=0,Fe=0;_<d;++_){var je=de(_),fe=32767&_,Oe=ne[je];if(N[fe]=Oe,ne[je]=fe,it<=_){var rt=d-_;if((we>7e3||pe>24576)&&rt>423){g=Gs(n,p,0,Z,ae,ie,he,pe,Fe,_-Fe,g),pe=we=he=0,Fe=_;for(var G=0;G<286;++G)ae[G]=0;for(G=0;G<30;++G)ie[G]=0}var re=2,Q=0,st=I,Re=fe-Oe&32767;if(rt>2&&je==de(_-Re))for(var il=Math.min(S,rt)-1,rl=Math.min(32767,_),sl=Math.min(258,rt);Re<=rl&&--st&&fe!=Oe;){if(n[_+re]==n[_+re-Re]){for(var De=0;De<sl&&n[_+De]==n[_+De-Re];++De);if(De>re){if(re=De,Q=Re,De>il)break;var nl=Math.min(Re,De-2),fn=0;for(G=0;G<nl;++G){var tr=_-Re+G+32768&32767,gn=tr-N[tr]+32768&32767;gn>fn&&(fn=gn,Oe=tr)}}}Re+=(fe=Oe)-(Oe=N[fe])+32768&32767}if(Q){Z[pe++]=268435456|Bi[re]<<18|Us[Q];var _n=31&Bi[re],vn=31&Us[Q];he+=Ni[_n]+Li[vn],++ae[257+_n],++ie[vn],it=_+re,++we}else Z[pe++]=n[_],++ae[n[_]]}}g=Gs(n,p,c,Z,ae,ie,he,pe,Fe,_-Fe,g)}return Vs(f,0,l+js(g)+u)}(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},Vi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function to(r,e){e===void 0&&(e={});var t=function(){var o=4294967295;return{p:function(l){for(var u=o,c=0;c<l.length;++c)u=Qa[255&u^l[c]]^u>>>8;o=u},d:function(){return 4294967295^o}}}(),i=r.length;t.p(r);var s,n=eo(r,e,10+((s=e).filename&&s.filename.length+1||0),8),a=n.length;return function(o,l){var u=l.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=l.level<2?4:l.level==9?2:0,o[9]=3,l.mtime!=0&&Vi(o,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),u){o[3]=8;for(var c=0;c<=u.length;++c)o[c+10]=u.charCodeAt(c)}}(n,e),Vi(n,a-8,t.d()),Vi(n,a-4,i),n}var io=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
3
3
  `).replace(/\r/g,`
4
- `)).length,s=0;s<i;s++){var o=r.charCodeAt(s),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Te(a)||(t>e&&(n+=r.substring(e,t)),n+=a,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},dl=!!pi||!!hi,Yn="text/plain",di=(r,e)=>{var[t,i]=r.split("?"),s=f({},e);i==null||i.split("&").forEach(o=>{var[a]=o.split("=");delete s[a]});var n=Oo(s);return n=n?(i?i+"&":"")+n:i,"".concat(t,"?").concat(n)},Ft=(r,e)=>JSON.stringify(r,(t,i)=>typeof i=="bigint"?i.toString():i,e),br=r=>{var{data:e,compression:t}=r;if(e){if(t===_e.GZipJS){var i=Ns(qs(Ft(e)),{mtime:0}),s=new Blob([i],{type:Yn});return{contentType:Yn,body:s,estimatedSize:s.size}}if(t===_e.Base64){var n=function(l){var c,d,u,h,_,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,b=0,y="",m=[];if(!l)return l;l=cl(l);do c=(_=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,d=_>>12&63,u=_>>6&63,h=63&_,m[b++]=g.charAt(c)+g.charAt(d)+g.charAt(u)+g.charAt(h);while(v<l.length);switch(y=m.join(""),l.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y}(Ft(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Ft(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Ft(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Rt=[];hi&&Rt.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=br(r))!==null&&e!==void 0?e:{},o=new Headers;O(r.headers,function(d,u){o.append(u,d)}),i&&o.append("Content-Type",i);var a=r.url,l=null;if(Fr){var c=new Fr;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),r.timeout)}}hi(a,f({method:(r==null?void 0:r.method)||"GET",headers:o,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)===null||t===void 0?void 0:t.signal},r.fetchOptions)).then(d=>d.text().then(u=>{var h,_={statusCode:d.status,text:u};if(d.status===200)try{_.json=JSON.parse(u)}catch(g){C.error(g)}(h=r.callback)===null||h===void 0||h.call(r,_)})).catch(d=>{var u;C.error(d),(u=r.callback)===null||u===void 0||u.call(r,{statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),pi&&Rt.push({transport:"XHR",method:r=>{var e,t=new pi;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=br(r))!==null&&e!==void 0?e:{};O(r.headers,function(n,o){t.setRequestHeader(o,n)}),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var n,o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}(n=r.callback)===null||n===void 0||n.call(r,o)}},t.send(s)}}),se!=null&&se.sendBeacon&&Rt.push({transport:"sendBeacon",method:r=>{var e=di(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=br(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;se.sendBeacon(e,n)}catch{}}});var wr=3e3;class _l{constructor(e,t){w(this,"_isPaused",!0),w(this,"_queue",[]),this._flushTimeoutMs=ae((t==null?void 0:t.flush_interval_ms)||wr,250,5e3,"flush interval",wr),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e),i=[...t.filter(s=>s.url.indexOf("/e")===0),...t.filter(s=>s.url.indexOf("/e")!==0)];i.map(s=>{this._sendRequest(f(f({},s),{},{transport:"sendBeacon"}))})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(n){var o=t[n],a=new Date().getTime();o.data&&N(o.data)&&O(o.data,l=>{l.offset=Math.abs(l.timestamp-a),delete l.timestamp}),e._sendRequest(o)};for(var s in t)i(s)}},this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return O(this._queue,t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;k(e[n])&&(e[n]=f(f({},s),{},{data:[]})),(i=e[n].data)===null||i===void 0||i.push(s.data)}),this._queue=[],e}}var hl=["retriesPerformedSoFar"];class pl{constructor(e){w(this,"_isPolling",!1),w(this,"_pollIntervalMs",3e3),w(this,"_queue",[]),this._instance=e,this._queue=[],this._areWeOnline=!0,!k(p)&&"onLine"in p.navigator&&(this._areWeOnline=p.navigator.onLine,B(p,"online",()=>{this._areWeOnline=!0,this._flush()}),B(p,"offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=Mr(e,hl);K(t)&&t>0&&(i.url=di(i.url,{retry_count:t})),this._instance._send_request(f(f({},i),{},{callback:s=>{var n;s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this._enqueue(f({retriesPerformedSoFar:t},i)):(n=i.callback)===null||n===void 0||n.call(i,s)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),d=(Math.random()-.5)*(c-l);return Math.ceil(c+d)}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in ".concat(i);navigator.onLine||(n+=" (Browser is offline)"),C.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){this._poller&&clearTimeout(this._poller),this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter(n=>n.retryAt<e||(t.push(n),!1));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._queue))try{this._instance._send_request(f(f({},e),{},{transport:"sendBeacon"}))}catch(t){C.error(t)}this._queue=[]}}class gl{constructor(e){w(this,"_updateScrollData",()=>{var t,i,s,n;this._context||(this._context={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+((o==null?void 0:o.clientHeight)||0),d=(o==null?void 0:o.scrollHeight)||0;this._context.lastScrollY=Math.ceil(a),this._context.maxScrollY=Math.max(a,(t=this._context.maxScrollY)!==null&&t!==void 0?t:0),this._context.maxScrollHeight=Math.max(l,(i=this._context.maxScrollHeight)!==null&&i!==void 0?i:0),this._context.lastContentY=c,this._context.maxContentY=Math.max(c,(s=this._context.maxContentY)!==null&&s!==void 0?s:0),this._context.maxContentHeight=Math.max(d,(n=this._context.maxContentHeight)!==null&&n!==void 0?n:0)}),this._instance=e}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){B(p,"scroll",this._updateScrollData,{capture:!0}),B(p,"scrollend",this._updateScrollData,{capture:!0}),B(p,"resize",this._updateScrollData)}scrollElement(){if(!this._instance.config.scroll_root_selector)return p==null?void 0:p.document.documentElement;var e=N(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=p==null?void 0:p.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return p&&(p.scrollY||p.pageYOffset||p.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return p&&(p.scrollX||p.pageXOffset||p.document.documentElement.scrollLeft)||0}}var vl=r=>wn(r==null?void 0:r.config.mask_personal_data_properties,r==null?void 0:r.config.custom_personal_data_properties);class fl{constructor(e,t,i,s){w(this,"_onSessionIdCallback",n=>{var o=this._getStored();if(!o||o.sessionId!==n){var a={sessionId:n,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Ei]:a})}}),this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||vl,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Ei]}getSetOnceProps(){var e,t=(e=this._getStored())===null||e===void 0?void 0:e.props;return t?"r"in t?Sn(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return O(Nt(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_".concat(vi(i))]=t}),e}}var Qn=J("[SessionId]");class ml{constructor(e,t,i){var s;if(w(this,"_sessionIdChangedHandlers",[]),!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||$e,this._windowIdGenerator=i||$e;var n=this._config.persistence_name||this._config.token,o=this._config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ae(o,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var a=W.parse(this._window_id_storage_key),l=W.parse(this._primary_window_exists_storage_key);a&&!l?this._windowId=a:W.remove(this._window_id_storage_key),W.set(this._primary_window_exists_storage_key,!0)}if((s=this._config.bootstrap)!==null&&s!==void 0&&s.sessionID)try{var c=(d=>{var u=d.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})(this._config.bootstrap.sessionID);this._setSessionId(this._config.bootstrap.sessionID,new Date().getTime(),c)}catch(d){Qn.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return k(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return this._config.persistence!=="memory"&&!this._persistence.disabled&&W.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&W.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?W.parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this._persistence.register({[qt]:[t,e,i]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this._persistence.props[qt];return N(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){B(p,"beforeunload",()=>{this._canUseSessionStorage()&&W.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this._config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var i=t||new Date().getTime(),[s,n,o]=this._getSessionId(),a=this._getWindowId(),l=K(o)&&o>0&&Math.abs(i-o)>864e5,c=!1,d=!n,u=!e&&Math.abs(i-s)>this.sessionTimeoutMs;d||u||l?(n=this._sessionIdGenerator(),a=this._windowIdGenerator(),Qn.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:d,activityTimeout:u,sessionPastMaximumLength:l}}),o=i,c=!0):a||(a=this._windowIdGenerator(),c=!0);var h=s===0||!e||l?i:s,_=o===0?new Date().getTime():o;return this._setWindowId(a),this._setSessionId(n,h,_),e||this._resetIdleTimer(),c&&this._sessionIdChangedHandlers.forEach(g=>g(n,a,c?{noSessionId:d,activityTimeout:u,sessionPastMaximumLength:l}:void 0)),{sessionId:n,windowId:a,sessionStartTimestamp:_,changeReason:c?{noSessionId:d,activityTimeout:u,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var yl=["$set_once","$set"],Me=J("[SiteApps]");class bl{constructor(e){this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e,t;return(e=P._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(t=e[this._instance.config.token])===null||t===void 0?void 0:t.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,s,n,o,a,l;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,_]of Object.entries(u))c[h]={id:d[h],type:h,properties:_};var{$set_once:g,$set:v}=e;return{event:f(f({},Mr(e,yl)),{},{properties:f(f(f({},e.properties),v?{$set:f(f({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),v)}:{}),g?{$set_once:f(f({},(s=(n=e.properties)===null||n===void 0?void 0:n.$set_once)!==null&&s!==void 0?s:{}),g)}:{}),elements_chain:(o=(a=e.properties)===null||a===void 0?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)===null||l===void 0?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var a;!t.errored&&this._bufferedInvocations.length&&(Me.info("Processing ".concat(this._bufferedInvocations.length," events for site app with id ").concat(e.id)),this._bufferedInvocations.forEach(l=>{var c;return(c=t.processEvent)===null||c===void 0?void 0:c.call(t,l)}),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((a=this._stopBuffering)===null||a===void 0||a.call(this))},s=!1,n=a=>{t.errored=!a,t.loaded=!0,Me.info("Site app with id ".concat(e.id," ").concat(a?"loaded":"errored")),s&&i()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{n(a)}});o&&(t.processEvent=o),s=!0}catch(a){Me.error("Error while initializing PostHog app with config id ".concat(e.id),a),n(!1)}if(s&&t.loaded)try{i()}catch(a){Me.error("Error while processing buffered events PostHog app with config id ".concat(e.id),a),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}_onCapturedEvent(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{var s;(s=i.processEvent)===null||s===void 0||s.call(i,t)}catch(n){Me.error("Error while processing event ".concat(e.event," for site app ").concat(i.id),n)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!==null&&t!==void 0&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",c=>this._onCapturedEvent(c))):void Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this._stopBuffering)===null||i===void 0||i.call(this),(s=e.siteApps)!==null&&s!==void 0&&s.length)if(this.isEnabled){var o=function(c,d){var u,h;P["__$$ph_site_app_".concat(c)]=n._instance,(u=P.__PosthogExtensions__)===null||u===void 0||(h=u.loadSiteApp)===null||h===void 0||h.call(u,n._instance,d,_=>{if(_)return Me.error("Error while initializing PostHog app with config id ".concat(c),_)})};for(var{id:a,url:l}of e.siteApps)o(a,l)}else Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Ye,wl=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","bytespider"],Xn=function(r,e){if(!r)return!1;var t=r.toLowerCase();return wl.concat(e||[]).some(i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1})},Zn=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&Xn(t,e))return!0;try{var i=r==null?void 0:r.userAgentData;if(i!=null&&i.brands&&i.brands.some(s=>Xn(s==null?void 0:s.brand,e)))return!0}catch{}return!!r.webdriver};function eo(r,e,t){return Ft({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}(function(r){r.US="us",r.EU="eu",r.CUSTOM="custom"})(Ye||(Ye={}));var to="i.posthog.com";class Sl{constructor(e){w(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(to),".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Ye.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Ye.EU:this._regionCache[this.apiHost]=Ye.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(t&&(t=t[0]==="/"?t:"/".concat(t)),e==="ui")return this.uiHost+t;if(this.region===Ye.CUSTOM)return this.apiHost+t;var i=to+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(i);case"api":return"https://".concat(this.region,".").concat(i)}}}var kl={icontains:(r,e)=>!!p&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!p&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!p&&ut(e.href,r),not_regex:(r,e)=>!!p&&!ut(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class Q{constructor(e){var t=this;w(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var i=arguments.length>0&&arguments[0]!==void 0&&arguments[0];t.getWebExperiments(s=>{Q._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,s.forEach(n=>{if(n.feature_flag_key){var o;t._flagToExperiments&&(Q._logInfo("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t._flagToExperiments)===null||o===void 0||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);j(a)&&n.variants[a]&&t._applyTransforms(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];Q._matchesTestVariant(c)&&t._applyTransforms(n.name,l,c.transforms)}})},i)}),this._instance=e,this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}onFeatureFlags(e){if(this._is_bot())Q._logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if($(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Q._logInfo("applying feature flags",e),e.forEach(t=>{var i;if(this._flagToExperiments&&(i=this._flagToExperiments)!==null&&i!==void 0&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),o=(s=this._flagToExperiments)===null||s===void 0?void 0:s.get(t);n&&o!=null&&o.variants[n]&&this._applyTransforms(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){var e=Q.getWindowLocation();if(e!=null&&e.search){var t=Gt(e==null?void 0:e.search,"__experiment_id"),i=Gt(e==null?void 0:e.search,"__experiment_variant");t&&i&&(Q._logInfo("previewing web experiments ".concat(t," && ").concat(i)),this.getWebExperiments(s=>{this._showPreviewWebExperiment(parseInt(t),i,s)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this._instance.config.token)),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var o=n.json.experiments||[];return e(o)}})}_showPreviewWebExperiment(e,t,i){var s=i.filter(n=>n.id===e);s&&s.length>0&&(Q._logInfo("Previewing web experiment [".concat(s[0].name,"] with variant [").concat(t,"]")),this._applyTransforms(s[0].name,t,s[0].variants[t].transforms))}static _matchesTestVariant(e){return!$(e.conditions)&&Q._matchUrlConditions(e)&&Q._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if($(e.conditions)||$((t=e.conditions)===null||t===void 0?void 0:t.url))return!0;var i,s,n,o=Q.getWindowLocation();return!!o&&((i=e.conditions)===null||i===void 0||!i.url||kl[(s=(n=e.conditions)===null||n===void 0?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return p==null?void 0:p.location}static _matchUTMConditions(e){var t;if($(e.conditions)||$((t=e.conditions)===null||t===void 0?void 0:t.utm))return!0;var i=vn();if(i.utm_source){var s,n,o,a,l,c,d,u,h,_,g,v,b,y,m,x,I=(s=e.conditions)===null||s===void 0||(n=s.utm)===null||n===void 0||!n.utm_campaign||((o=e.conditions)===null||o===void 0||(a=o.utm)===null||a===void 0?void 0:a.utm_campaign)==i.utm_campaign,R=(l=e.conditions)===null||l===void 0||(c=l.utm)===null||c===void 0||!c.utm_source||((d=e.conditions)===null||d===void 0||(u=d.utm)===null||u===void 0?void 0:u.utm_source)==i.utm_source,A=(h=e.conditions)===null||h===void 0||(_=h.utm)===null||_===void 0||!_.utm_medium||((g=e.conditions)===null||g===void 0||(v=g.utm)===null||v===void 0?void 0:v.utm_medium)==i.utm_medium,L=(b=e.conditions)===null||b===void 0||(y=b.utm)===null||y===void 0||!y.utm_term||((m=e.conditions)===null||m===void 0||(x=m.utm)===null||x===void 0?void 0:x.utm_term)==i.utm_term;return I&&A&&L&&R}return!1}static _logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];C.info("[WebExperiments] ".concat(e),i)}_applyTransforms(e,t,i){this._is_bot()?Q._logInfo("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach(s=>{if(s.selector){var n;Q._logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),s);var o=(n=document)===null||n===void 0?void 0:n.querySelectorAll(s.selector);o==null||o.forEach(a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)})}}):Q._logInfo("Control variants leave the page unmodified.")}_is_bot(){return se&&this._instance?Zn(se,this._instance.config.custom_blocked_useragents):void 0}}function io(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return oe(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}class El{constructor(e){var t;this._instance=e,this._lastPathname=(p==null||(t=p.location)===null||t===void 0?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(C.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,C.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(p&&p.history){var i=this;(e=p.history.pushState)!==null&&e!==void 0&&e.__posthog_wrapped__||io(p.history,"pushState",s=>function(n,o,a){s.call(this,n,o,a),i._capturePageview("pushState")}),(t=p.history.replaceState)!==null&&t!==void 0&&t.__posthog_wrapped__||io(p.history,"replaceState",s=>function(n,o,a){s.call(this,n,o,a),i._capturePageview("replaceState")}),this._setupPopstateListener()}}_capturePageview(e){try{var t,i=p==null||(t=p.location)===null||t===void 0?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._lastPathname=i}catch(s){C.error("Error capturing ".concat(e," pageview"),s)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};B(p,"popstate",e),this._popstateListener=()=>{p&&p.removeEventListener("popstate",e)}}}}var $t={},Sr=()=>{},ct="posthog",ro=!dl&&(G==null?void 0:G.indexOf("MSIE"))===-1&&(G==null?void 0:G.indexOf("Mozilla"))===-1,so=()=>{var r;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:ko(E==null?void 0:E.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Sr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:ie&&j(ie==null?void 0:ie.search)&&ie.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(p==null||(r=p.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_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;C.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:wr},_onCapture:Sr}},no=r=>{var e={};k(r.process_person)||(e.person_profiles=r.process_person),k(r.xhr_headers)||(e.request_headers=r.xhr_headers),k(r.cookie_name)||(e.persistence_name=r.cookie_name),k(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),k(r.store_google)||(e.save_campaign_params=r.store_google),k(r.verbose)||(e.debug=r.verbose);var t=H({},e,r);return N(r.property_blacklist)&&(k(r.property_denylist)?t.property_denylist=r.property_blacklist:N(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:C.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class xl{constructor(){w(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){C.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class _i{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)===null||t===void 0?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){w(this,"webPerformance",new xl),w(this,"_personProcessingSetOncePropertiesSent",!1),w(this,"version",be.LIB_VERSION),w(this,"_internalEventEmitter",new Kn),this.config=so(),this.SentryIntegration=Pa,this.sentryIntegration=e=>function(t,i){var s=zs(t,i);return{name:Hs,processEvent:n=>s(n)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new Xa(this),this.toolbar=new Fa(this),this.scrollManager=new gl(this),this.pageViewManager=new Ma(this),this.surveys=new al(this),this.experiments=new Q(this),this.exceptions=new Da(this),this.rateLimiter=new ll(this),this.requestRouter=new Sl(this),this.consent=new Wo(this),this.people={set:(e,t,i)=>{var s=j(e)?{[e]:t}:e;this.setPersonProperties(s),i==null||i({})},set_once:(e,t,i)=>{var s=j(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i==null||i({})}},this.on("eventCaptured",e=>C.info('send "'.concat(e==null?void 0:e.event,'"'),e))}init(e,t,i){if(i&&i!==ct){var s,n=(s=$t[i])!==null&&s!==void 0?s:new _i;return n._init(e,t,i),$t[i]=n,$t[ct][i]=n,n}return this._init(e,t,i)}_init(e){var t,i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(k(e)||fi(e))return C.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return C.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],s.person_profiles&&(this._initialPersonProfilesConfig=s.person_profiles),this.set_config(H({},so(),no(s),{name:n,token:e})),this.config.on_xhr_error&&C.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:_e.GZipJS,this.persistence=new cr(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cr(f(f({},this.config),{},{persistence:"sessionStorage"}));var o=f({},this.persistence.props),a=f({},this.sessionPersistence.props);if(this._requestQueue=new _l(y=>this._send_retriable_request(y),this.config.request_queue_config),this._retryQueue=new pl(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new ml(this),this.sessionPropsManager=new fl(this,this.sessionManager,this.persistence)),new $a(this).startIfEnabledOrStop(),this.siteApps=new bl(this),(t=this.siteApps)===null||t===void 0||t.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new Ca(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Do(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new La(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Oa(this),this.exceptionObserver=new Jo(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new ms(this,Ko),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new El(this),this.historyAutocapture.startIfEnabled(),be.DEBUG=be.DEBUG||this.config.debug,be.DEBUG&&C.info("Starting in debug mode",{this:this,config:s,thisC:f({},this.config),p:o,s:a}),this._sync_opt_out_with_persistence(),((i=s.bootstrap)===null||i===void 0?void 0:i.distinctID)!==void 0){var l,c,d=this.config.get_device_id($e()),u=(l=s.bootstrap)!==null&&l!==void 0&&l.isIdentifiedID?d:s.bootstrap.distinctID;this.persistence.set_property(Se,(c=s.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.bootstrap.distinctID,$device_id:u})}if(this._hasBootstrappedFeatureFlags()){var h,_,g=Object.keys(((h=s.bootstrap)===null||h===void 0?void 0:h.featureFlags)||{}).filter(y=>{var m,x;return!((m=s.bootstrap)===null||m===void 0||(x=m.featureFlags)===null||x===void 0||!x[y])}).reduce((y,m)=>{var x,I;return y[m]=((x=s.bootstrap)===null||x===void 0||(I=x.featureFlags)===null||I===void 0?void 0:I[m])||!1,y},{}),v=Object.keys(((_=s.bootstrap)===null||_===void 0?void 0:_.featureFlagPayloads)||{}).filter(y=>g[y]).reduce((y,m)=>{var x,I,R,A;return(x=s.bootstrap)!==null&&x!==void 0&&(I=x.featureFlagPayloads)!==null&&I!==void 0&&I[m]&&(y[m]=(R=s.bootstrap)===null||R===void 0||(A=R.featureFlagPayloads)===null||A===void 0?void 0:A[m]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:v})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:Zr,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id($e());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(Se,"anonymous")}return B(p,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),s.segment?Ia(this,()=>this._loaded()):this._loaded(),oe(this.config._onCapture)&&this.config._onCapture!==Sr&&(C.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this}_onRemoteConfig(e){var t,i,s,n,o,a,l,c;if(!E||!E.body)return C.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=F(e.supportedCompression,_e.GZipJS)?_e.GZipJS:F(e.supportedCompression,_e.Base64)?_e.Base64:void 0),(t=e.analytics)!==null&&t!==void 0&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(i=this.siteApps)===null||i===void 0||i.onRemoteConfig(e),(s=this.sessionRecording)===null||s===void 0||s.onRemoteConfig(e),(n=this.autocapture)===null||n===void 0||n.onRemoteConfig(e),(o=this.heatmaps)===null||o===void 0||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)===null||a===void 0||a.onRemoteConfig(e),(l=this.exceptionObserver)===null||l===void 0||l.onRemoteConfig(e),(c=this.deadClicksAutocapture)===null||c===void 0||c.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){C.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new ul(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||Fe(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(t=this._retryQueue)===null||t===void 0||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ro?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=di(e.url,{ip:this.config.ip?1:0}),e.headers=f({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,s,n,o=f({},t);o.timeout=o.timeout||6e4,o.url=di(o.url,{_:new Date().getTime().toString(),ver:be.LIB_VERSION,compression:o.compression});var a=(i=o.transport)!==null&&i!==void 0?i:"fetch",l=(s=(n=Nr(Rt,c=>c.transport===a))===null||n===void 0?void 0:n.method)!==null&&s!==void 0?s:Rt[0].method;if(!l)throw new Error("No available transport method");l(o)})(f(f({},e),{},{callback:t=>{var i,s,n;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((s=(n=this.config).on_request_error)===null||s===void 0||s.call(n,t)),(i=e.callback)===null||i===void 0||i.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],s=[],n=[];Fe(e,a=>{a&&(t=a[0],N(t)?n.push(a):oe(a)?a.call(this):N(a)&&t==="alias"?i.push(a):N(a)&&t.indexOf("capture")!==-1&&oe(this[t])?n.push(a):s.push(a))});var o=function(a,l){Fe(a,function(c){if(N(c[0])){var d=l;O(c,function(u){d=d[u[0]].apply(d,u.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};o(i,this),o(s,this),o(n,this)}_hasBootstrappedFeatureFlags(){var e,t;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!k(e)&&j(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var n=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(n==null||!n.isRateLimited){t!=null&&t.$current_url&&!j(t==null?void 0:t.$current_url)&&(C.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(i==null?void 0:i.timestamp)||o,l=$e(),c={uuid:l,event:e,properties:this._calculate_event_properties(e,t||{},a,l)};n&&(c.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),i!=null&&i.$set&&(c.$set=i==null?void 0:i.$set);var d=this._calculate_set_once_properties(i==null?void 0:i.$set_once);d&&(c.$set_once=d),(c=wo(c,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,k(i==null?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o);var u=f(f({},c.properties.$set),c.$set);if(Xe(u)||this.setPersonPropertiesForFlags(u),!$(this.config.before_send)){var h=this._runBeforeSend(c);if(!h)return;c=h}this._internalEventEmitter.emit("eventCaptured",c);var _={method:"POST",url:(s=i==null?void 0:i._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this._send_retriable_request(_):this._requestQueue.enqueue(_),c}C.critical("This capture call is ignored due to client rate limiting.")}}else C.error("No event name provided to posthog.capture")}else C.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}_calculate_event_properties(e,t,i,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=this.persistence.remove_event_timer(e),o=f({},t);if(o.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(o.$cookieless_mode=!0),e==="$snapshot"){var a=f(f({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!j(o.distinct_id)&&!K(o.distinct_id)||fi(o.distinct_id))&&C.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,c=Ya(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:u}=this.sessionManager.checkAndGetSessionAndWindowId();o.$session_id=d,o.$window_id=u}this.sessionPropsManager&&H(o,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&H(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(h=this._retryQueue)===null||h===void 0?void 0:h.length}catch(b){o.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===Ye.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),l=e==="$pageview"?this.pageViewManager.doPageView(i,s):e==="$pageleave"?this.pageViewManager.doPageLeave(i):this.pageViewManager.doEvent(),o=H(o,l),e==="$pageview"&&E&&(o.title=E.title),!k(n)){var _=i.getTime()-n;o.$duration=parseFloat((_/1e3).toFixed(3))}G&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=H({},c,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),N(this.config.property_denylist)?O(this.config.property_denylist,function(b){delete o[b]}):C.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(C.error("sanitize_properties is deprecated. Use before_send instead"),o=g(o,e));var v=this._hasPersonProcessing();return o.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),o}_calculate_set_once_properties(e){var t;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return e;var i=this.persistence.get_initial_props(),s=(t=this.sessionPropsManager)===null||t===void 0?void 0:t.getSetOnceProps(),n=H({},i,s||{},e||{}),o=this.config.sanitize_properties;return o&&(C.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,Xe(n)?void 0:n}register(e,t){var i;(i=this.persistence)===null||i===void 0||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)===null||s===void 0||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)===null||t===void 0||t.register(e)}unregister(e){var t;(t=this.persistence)===null||t===void 0||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)===null||t===void 0||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],i=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return C.uninitializedWarning("posthog.identify");if(K(e)&&(e=e.toString(),C.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))C.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(gt)&&(this.unregister(gt),this.register({distinct_id:e}));var o=(this.persistence.get_property(Se)||"anonymous")==="anonymous";e!==s&&o?(this.persistence.set_property(Se,"identified"),this.setPersonPropertiesForFlags(f(f({},i||{}),t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=eo(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(jt))}}else C.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=eo(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags(f(f({},t||{}),e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):C.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:f(f({},s),{},{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}}else C.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(C.info("reset"),!this.__loaded)return C.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)===null||t===void 0||t.clear(),(i=this.sessionPersistence)===null||i===void 0||i.clear(),this.surveys.reset(),(s=this.persistence)===null||s===void 0||s.set_property(Se,"anonymous"),(n=this.sessionManager)===null||n===void 0||n.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:Zr,$device_id:null},"");else{var a=this.config.get_device_id($e());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)===null||t===void 0?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(e!=null&&e.withTimestamp&&i){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;var a=Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0);s+="?t=".concat(a)}return s}alias(e,t){return e===this.get_property(qr)?(C.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(k(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(gt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(C.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,i,s,n,o=f({},this.config);q(e)&&(H(this.config,no(e)),(t=this.persistence)===null||t===void 0||t.update_config(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cr(f(f({},this.config),{},{persistence:"sessionStorage"})),z.is_supported()&&z.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(be.DEBUG=!0,C.info("set_config",JSON.stringify({config:e,oldConfig:o,newConfig:f({},this.config)},null,2))),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),(s=this.autocapture)===null||s===void 0||s.startIfEnabled(),(n=this.heatmaps)===null||n===void 0||n.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,o,a,l;(s=this.sessionManager)===null||s===void 0||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)===null||n===void 0||n.overrideSampling()),i.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(f(f({},la((s=>s instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:i})),t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)===null||t===void 0?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)===null||t===void 0?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:ct;return t!==ct&&(t=ct+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)===null||e===void 0?void 0:e.get_property(Se))==="identified"||((t=this.sessionPersistence)===null||t===void 0?void 0:t.get_property(Se))==="identified"}_hasPersonProcessing(){var e,t,i,s;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Xe(this.getGroups())&&((e=this.persistence)===null||e===void 0||(t=e.props)===null||t===void 0||!t[gt])&&((i=this.persistence)===null||i===void 0||(s=i.props)===null||s===void 0||!s[Ht]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return this.config.person_profiles==="never"?(C.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Ht,!0),!0)}_sync_opt_out_with_persistence(){var e,t,i,s,n=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,a=this.config.disable_persistence||n&&!!o;((e=this.persistence)===null||e===void 0?void 0:e.disabled)!==a&&((i=this.persistence)===null||i===void 0||i.set_disabled(a)),((t=this.sessionPersistence)===null||t===void 0?void 0:t.disabled)!==a&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(a))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(k(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e==null?void 0:e.captureEventName)!==null&&t!==void 0?t:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return se?Zn(se,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){E&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:E.title},{send_instantly:!0}))}debug(e){e===!1?(p==null||p.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(p==null||p.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}))}_runBeforeSend(e){if($(this.config.before_send))return e;var t=N(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),$(i)){var n="Event '".concat(e.event,"' was rejected in beforeSend function");return mo(e.event)?C.warn("".concat(n,". This can cause unexpected behavior.")):C.info(n),null}i.properties&&!Xe(i.properties)||C.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return i}getPageViewId(){var e;return(e=this.pageViewManager._currentPageview)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}}(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=bo(r.prototype[e[t]])})(_i,["identify"]);var oo;oo=$t[ct]=new _i,function(){function r(){r.done||(r.done=!0,ro=!1,O($t,function(e){e._dom_loaded()}))}E!=null&&E.addEventListener?E.readyState==="complete"?r():B(E,"DOMContentLoaded",r,{capture:!1}):p&&C.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}();var ao;(function(r){r.USER_ADDED_TO_CART="user_added_to_cart",r.USER_SUBMITTED_CHECKOUT="user_submitted_checkout"})(ao||(ao={}));const Cl={class:"dialog-block-header-container"},Il={class:"dialog-block-title"},Pl={class:"dialog-block-description"},Tl=S.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(r){const e=r;return(t,i)=>(S.openBlock(),S.createElementBlock("div",Cl,[S.createElementVNode("div",Il,S.toDisplayString(e.title??"Your expert"),1),S.createElementVNode("div",Pl,S.toDisplayString(e.description??"A question about this product?"),1)]))}}),dt=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},Fl=dt(Tl,[["__scopeId","data-v-6abd4066"]]),Rl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},$l={"clip-path":"url(#clip0_466_934)"},Ol=["stroke"],Al=["stroke"],Ll=S.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(r){const e=r;return(t,i)=>(S.openBlock(),S.createElementBlock("svg",Rl,[S.createElementVNode("g",$l,[S.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
4
+ `)).length,s=0;s<i;s++){var a=r.charCodeAt(s),o=null;a<128?t++: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),_e(o)||(t>e&&(n+=r.substring(e,t)),n+=o,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},ro=!!si||!!ri,Ws="text/plain",Zt=function(r,e,t){var i;t===void 0&&(t=!0);var[s,n]=r.split("?"),a=E({},e),o=(i=n==null?void 0:n.split("&").map(u=>{var c,[d,f]=u.split("="),p=t&&(c=a[d])!==null&&c!==void 0?c:f;return delete a[d],d+"="+p}))!==null&&i!==void 0?i:[],l=la(a);return l&&o.push(l),s+"?"+o.join("&")},xt=(r,e)=>JSON.stringify(r,(t,i)=>typeof i=="bigint"?i.toString():i,e),Hi=r=>{var{data:e,compression:t}=r;if(e){if(t===me.GZipJS){var i=to(function(l,u){var c=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var d=new te(l.length+(l.length>>>1)),f=0,p=function(k){d[f++]=k},g=0;g<c;++g){if(f+5>d.length){var _=new te(f+8+(c-g<<1));_.set(d),d=_}var w=l.charCodeAt(g);w<128||u?p(w):w<2048?(p(192|w>>>6),p(128|63&w)):w>55295&&w<57344?(p(240|(w=65536+(1047552&w)|1023&l.charCodeAt(++g))>>>18),p(128|w>>>12&63),p(128|w>>>6&63),p(128|63&w)):(p(224|w>>>12),p(128|w>>>6&63),p(128|63&w))}return Vs(d,0,f)}(xt(e)),{mtime:0}),s=new Blob([i],{type:Ws});return{contentType:Ws,body:s,estimatedSize:s.size}}if(t===me.Base64){var n=function(l){var u,c,d,f,p,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_=0,w=0,k="",S=[];if(!l)return l;l=io(l);do u=(p=l.charCodeAt(_++)<<16|l.charCodeAt(_++)<<8|l.charCodeAt(_++))>>18&63,c=p>>12&63,d=p>>6&63,f=63&p,S[w++]=g.charAt(u)+g.charAt(c)+g.charAt(d)+g.charAt(f);while(_<l.length);switch(k=S.join(""),l.length%3){case 1:k=k.slice(0,-2)+"==";break;case 2:k=k.slice(0,-1)+"="}return k}(xt(e)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:xt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=xt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Qt=[];ri&&Qt.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=Hi(r))!==null&&e!==void 0?e:{},a=new Headers;O(r.headers,function(c,d){a.append(d,c)}),i&&a.append("Content-Type",i);var o=r.url,l=null;if(lr){var u=new lr;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),r.timeout)}}ri(o,E({method:(r==null?void 0:r.method)||"GET",headers:a,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then(c=>c.text().then(d=>{var f={statusCode:c.status,text:d};if(c.status===200)try{f.json=JSON.parse(d)}catch(p){b.error(p)}r.callback==null||r.callback(f)})).catch(c=>{b.error(c),r.callback==null||r.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),si&&Qt.push({transport:"XHR",method:r=>{var e,t=new si;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=Hi(r))!==null&&e!==void 0?e:{};O(r.headers,function(n,a){t.setRequestHeader(a,n)}),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(n)}},t.send(s)}}),K!=null&&K.sendBeacon&&Qt.push({transport:"sendBeacon",method:r=>{var e=Zt(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=Hi(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;K.sendBeacon(e,n)}catch{}}});var Ze=function(r,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function zs(r,e,t){return xt({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Ys={exact:(r,e)=>e.some(t=>r.some(i=>t===i)),is_not:(r,e)=>e.every(t=>r.every(i=>t!==i)),regex:(r,e)=>e.some(t=>r.some(i=>Ze(t,i))),not_regex:(r,e)=>e.every(t=>r.every(i=>!Ze(t,i))),icontains:(r,e)=>e.map(ei).some(t=>r.map(ei).some(i=>t.includes(i))),not_icontains:(r,e)=>e.map(ei).every(t=>r.map(ei).every(i=>!t.includes(i)))},ei=r=>r.toLowerCase(),Gi=U("[Error tracking]");class so{constructor(e){var t,i;this.Jt=[],this.Kt=new An([new Nn,new Wn,new Bn,new Ln,new Hn,new Vn,new qn,new Gn],[Fn,Dn]),this._instance=e,this.Jt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(pi))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,s,n=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],a=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Jt=n,this._instance.persistence&&this._instance.persistence.register({[pi]:this.Jt,[$r]:a})}get Yt(){var e,t=!!this._instance.get_property($r),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Kt.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Xt(t)){if(this.Qt(t))return void Gi.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(t))return void Gi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(t))return void Gi.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(e){if(e.length===0)return!1;var t=e.reduce((i,s)=>{var{type:n,value:a}=s;return B(n)&&n.length>0&&i.$exception_types.push(n),B(a)&&a.length>0&&i.$exception_values.push(a),i},{$exception_types:[],$exception_values:[]});return this.Jt.some(i=>{var s=i.values.map(n=>{var a,o=Ys[n.operator],l=F(n.value)?n.value:[n.value],u=(a=t[n.key])!==null&&a!==void 0?a:[];return l.length>0&&o(l,u)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}Zt(e){return e.flatMap(t=>{var i,s;return(i=(s=t.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]}).some(t=>t.filename&&t.filename.startsWith("chrome-extension://"))}ti(e){if(e.length>0){var t,i,s,n,a=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],o=a[a.length-1];return(s=o==null||(n=o.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Xt(e){return!R(e)&&F(e)}}var se=U("[FeatureFlags]"),Wi="$active_feature_flags",Qe="$override_feature_flags",Xs="$feature_flag_payloads",St="$override_feature_flag_payloads",Ks="$feature_flag_request_id",Js=r=>{var e={};for(var[t,i]of Dt(r||{}))i&&(e[t]=i);return e},no=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]})),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload}).map(t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]}))):se.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},ao=function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r}({});class oo{constructor(e){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=e,this.featureFlagEventHandlers=[]}li(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(t=>{var i=t&&typeof t=="string"&&t.trim().length>0;return i||se.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i}):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var e=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:e})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(gi),t=this._instance.get_property(Qe),i=this._instance.get_property(St);if(!i&&!t)return e||{};var s=A({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var a of n){var o,l,u=s[a],c=t==null?void 0:t[a],d=m(c)?(o=u==null?void 0:u.enabled)!==null&&o!==void 0&&o:!!c,f=m(c)?u.variant:typeof c=="string"?c:void 0,p=i==null?void 0:i[a],g=E({},u,{enabled:d,variant:d?f??(u==null?void 0:u.variant):void 0});d!==(u==null?void 0:u.enabled)&&(g.original_enabled=u==null?void 0:u.enabled),f!==(u==null?void 0:u.variant)&&(g.original_variant=u==null?void 0:u.variant),p&&(g.metadata=E({},u==null?void 0:u.metadata,{payload:p,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),s[a]=g}return this.ii||(se.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.ii=!0),s}getFlagVariants(){var e=this._instance.get_property(We),t=this._instance.get_property(Qe);if(!t)return e||{};for(var i=A({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.ii||(se.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ii=!0),i}getFlagPayloads(){var e=this._instance.get_property(Xs),t=this._instance.get_property(St);if(!t)return e||{};for(var i=A({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.ii||(se.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ii=!0),i}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout(()=>{this.di()},5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.si=e}di(e){var t;if(this.vi(),!this._instance.M())if(this.ri)this.ni=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:E({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(lt)||{}),group_properties:this._instance.get_property(Me)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.ui()&&(i.evaluation_environments=this.li());var s=this._instance.config.__preview_remote_config,n=s?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags",n+a);s&&(i.timezone=Ds()),this.ri=!0,this._instance.ci({method:"POST",url:o,data:i,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,c,d=!0;if(l.statusCode===200&&(this.ni||(this.$anon_distinct_id=void 0),d=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi((c=l.json)!==null&&c!==void 0?c:{})),!i.disable_flags||this.ni)if(this.ai=!d,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(ao.FeatureFlags))se.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var f;i.disable_flags||this.receivedFeatureFlags((f=l.json)!==null&&f!==void 0?f:{},d),this.ni&&(this.ni=!1,this.di())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],s=""+i,n=this._instance.get_property(Ks)||void 0,a=this._instance.get_property(Nt)||{};if((t.send_event||!("send_event"in t))&&(!(e in a)||!a[e].includes(s))){var o,l,u,c,d,f,p,g,_;F(a[e])?a[e].push(s):a[e]=[s],(o=this._instance.persistence)==null||o.register({[Nt]:a});var w=this.getFeatureFlagDetails(e),k={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:n,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.ai};m(w==null||(c=w.metadata)==null?void 0:c.version)||(k.$feature_flag_version=w.metadata.version);var S,I=(d=w==null||(f=w.reason)==null?void 0:f.description)!==null&&d!==void 0?d:w==null||(p=w.reason)==null?void 0:p.code;I&&(k.$feature_flag_reason=I),w!=null&&(g=w.metadata)!=null&&g.id&&(k.$feature_flag_id=w.metadata.id),m(w==null?void 0:w.original_variant)&&m(w==null?void 0:w.original_enabled)||(k.$feature_flag_original_response=m(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(_=w.metadata)!=null&&_.original_payload&&(k.$feature_flag_original_payload=w==null||(S=w.metadata)==null?void 0:S.original_payload),this._instance.capture("$feature_flag_called",k)}return i}se.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.ui()&&(s.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return m(i)?void 0:!!i}se.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ei=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var d=no(a),f=d.flags,p=d.featureFlags,g=d.featureFlagPayloads;if(p){var _=a.requestId;if(F(p)){se.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(p)for(var k=0;k<p.length;k++)w[p[k]]=!0;o&&o.register({[Wi]:p,[We]:w})}else{var S=p,I=g,P=f;a.errorsWhileComputingFlags&&(S=E({},l,S),I=E({},u,I),P=E({},c,P)),o&&o.register(E({[Wi]:Object.keys(Js(S)),[We]:S||{},[Xs]:I||{},[gi]:P||{}},_?{[Ks]:_}:{}))}}})(e,this._instance.persistence,i,s,n),this.pi(t)}}override(e,t){t===void 0&&(t=!1),se.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return se.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Qe),this._instance.persistence.unregister(St),void this.pi();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.ii=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(Qe);else if(i.flags)if(F(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[Qe]:s})}else this._instance.persistence.register({[Qe]:i.flags})}return"payloads"in i&&(i.payloads===!1?this._instance.persistence.unregister(St):i.payloads&&this._instance.persistence.register({[St]:i.payloads})),void this.pi()}this.pi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ei){var{flags:t,flagVariants:i}=this.gi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(ot)||[]).find(u=>u.flagKey===e),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var l=E({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[Wi]:Object.keys(Js(l)),[We]:l}),this.pi()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(ot),n=i?"&"+i.map(a=>"stage="+a).join("&"):"";if(s&&!t)return e(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:a=>{var o,l;if(a.json){var u=a.json.earlyAccessFeatures;return(o=this._instance.persistence)==null||o.unregister(ot),(l=this._instance.persistence)==null||l.register({[ot]:u}),e(u)}}})}gi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}pi(e){var{flags:t,flagVariants:i}=this.gi();this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(lt)||{};this._instance.register({[lt]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(lt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(Me)||{};Object.keys(i).length!==0&&Object.keys(i).forEach(s=>{i[s]=E({},i[s],e[s]),delete e[s]}),this._instance.register({[Me]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Me)||{};this._instance.register({[Me]:E({},t,{[e]:{}})})}else this._instance.unregister(Me)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}}var lo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class zi{constructor(e,t){this.C=e,this.props={},this.mi=!1,this.yi=(i=>{var s="";return i.token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.bi(e),this.load(),e.debug&&b.info("Persistence loaded",e.persistence,E({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.wi}bi(e){lo.indexOf(e.persistence.toLowerCase())===-1&&(b.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&M.H()?M:t==="localstorage+cookie"&&Wt.H()?Wt:t==="sessionstorage"&&j.H()?j:t==="memory"?ya:t==="cookie"?ce:Wt.H()?Wt:ce}properties(){var e={};return O(this.props,function(t,i){if(i===We&&q(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]];else o=i,l=!1,(_e(a=Zn)?l:or&&a.indexOf===or?a.indexOf(o)!=-1:(O(a,function(u){if(l||(l=u===o))return Rt}),l))||(e[i]=t);var a,o,l}),e}load(){if(!this.wi){var e=this.Y.W(this.yi);e&&(this.props=A({},e))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.$i,this.Si,this.C.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(q(e)){m(t)&&(t="None"),this.xi=m(i)?this.Ei:i;var s=!1;if(O(e,(n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.props[a]=n,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(q(e)){this.xi=m(t)?this.Ei:t;var i=!1;if(O(e,(s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.mi){var e=Ps(this.C.custom_campaign_params,this.C.mask_personal_data_properties,this.C.custom_personal_data_properties);Ve(di(e))||this.register(e),this.mi=!0}}update_search_keyword(){var e;this.register((e=y==null?void 0:y.referrer)?Is(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Fs(),$referring_domain:y!=null&&y.referrer&&((e=jt(y.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[yi]||this.props[bi]||this.register_once({[Lt]:Os(this.C.mask_personal_data_properties,this.C.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};O([bi,yi],a=>{var o=this.props[a];o&&O(o,function(l,u){e["$initial_"+ni(u)]=l})});var t,i,s=this.props[Lt];if(s){var n=(t=Rs(s),i={},O(t,function(a,o){i["$initial_"+ni(o)]=a}),i);A(e,n)}return e}safe_merge(e){return O(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ei=this.xi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var s=this.bi(e),n=this.props;this.clear(),this.Y=s,this.props=n,this.save()}}set_disabled(e){this.wi=e,this.wi?this.remove():this.save()}set_cross_subdomain(e){e!==this.$i&&(this.$i=e,this.remove(),this.save())}set_secure(e){e!==this.Si&&(this.Si=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[at]||{};i[e]=t,this.props[at]=i,this.save()}remove_event_timer(e){var t=(this.props[at]||{})[e];return m(t)||(delete this.props[at][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r}({});var Yi=function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r}({});(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r}({}),function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r}({});var ti=function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r}({}),Zs=function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r}({}),Qs=function(r){return r.Popover="popover",r.Inline="inline",r}({});class Xi{constructor(){this.ki={},this.ki={}}on(e,t){return this.ki[e]||(this.ki[e]=[]),this.ki[e].push(t),()=>{this.ki[e]=this.ki[e].filter(i=>i!==t)}}emit(e,t){for(var i of this.ki[e]||[])i(t);for(var s of this.ki["*"]||[])s(e,t)}}class Ue{constructor(e){this.Pi=new Xi,this.Ti=(t,i)=>this.Ii(t,i)&&this.Ri(t,i)&&this.Ci(t,i),this.Ii=(t,i)=>i==null||!i.event||(t==null?void 0:t.event)===(i==null?void 0:i.event),this._instance=e,this.Oi=new Set,this.Fi=new Set}init(){var e;if(!m((e=this._instance)==null?void 0:e.Mi)){var t;(t=this._instance)==null||t.Mi((i,s)=>{this.on(i,s)})}}register(e){var t,i;if(!m((t=this._instance)==null?void 0:t.Mi)&&(e.forEach(a=>{var o,l;(o=this.Fi)==null||o.add(a),(l=a.steps)==null||l.forEach(u=>{var c;(c=this.Oi)==null||c.add((u==null?void 0:u.event)||"")})}),(i=this._instance)!=null&&i.autocapture)){var s,n=new Set;e.forEach(a=>{var o;(o=a.steps)==null||o.forEach(l=>{l!=null&&l.selector&&n.add(l==null?void 0:l.selector)})}),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Oi.has(e)||this.Oi.has(t==null?void 0:t.event))&&this.Fi&&((i=this.Fi)==null?void 0:i.size)>0&&this.Fi.forEach(s=>{this.Ai(t,s)&&this.Pi.emit("actionCaptured",s.name)})}Di(e){this.onAction("actionCaptured",t=>e(t))}Ai(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var i of t.steps)if(this.Ti(e,i))return!0;return!1}onAction(e,t){return this.Pi.on(e,t)}Ri(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!s||typeof s!="string"||!Ue.ji(s,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static ji(e,t,i){switch(i){case"regex":return!!h&&Ze(e,t);case"exact":return t===e;case"contains":var s=Ue.Li(t).replace(/_/g,".").replace(/%/g,".*");return Ze(e,s);default:return!1}}static Li(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ci(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.Ni(e).some(n=>!(t!=null&&t.href&&!Ue.ji(n.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||n.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!Ue.ji(n.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!Ue.ji(n.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var i,s=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(!s||!s.includes(t==null?void 0:t.selector))return!1}return!0}Ni(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var T=U("[Surveys]"),Ki="seenSurvey_",co=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},en=r=>{var e=""+Ki+r.id;return r.current_iteration&&r.current_iteration>0&&(e=""+Ki+r.id+"_"+r.current_iteration),e},uo=[Yi.Popover,Yi.Widget,Yi.API],ho={ignoreConditions:!1,ignoreDelay:!1,displayType:Qs.Popover};class po{constructor(e){this._instance=e,this.Ui=new Map,this.zi=new Map}register(e){var t;m((t=this._instance)==null?void 0:t.Mi)||(this.Hi(e),this.Bi(e))}Bi(e){var t=e.filter(i=>{var s,n;return((s=i.conditions)==null?void 0:s.actions)&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0});t.length!==0&&(this.qi==null&&(this.qi=new Ue(this._instance),this.qi.init(),this.qi.Di(i=>{this.onAction(i)})),t.forEach(i=>{var s,n,a,o,l;i.conditions&&(s=i.conditions)!=null&&s.actions&&(n=i.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=i.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.qi)==null||o.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var c=this.zi.get(u.name);c&&c.push(i.id),this.zi.set(u.name,c||[i.id])}}))}))}Hi(e){var t;e.filter(i=>{var s,n;return((s=i.conditions)==null?void 0:s.events)&&((n=i.conditions)==null||(n=n.events)==null||(n=n.values)==null?void 0:n.length)>0}).length!==0&&((t=this._instance)==null||t.Mi((i,s)=>{this.onEvent(i,s)}),e.forEach(i=>{var s;(s=i.conditions)==null||(s=s.events)==null||(s=s.values)==null||s.forEach(n=>{if(n&&n.name){var a=this.Ui.get(n.name);a&&a.push(i.id),this.Ui.set(n.name,a||[i.id])}})}))}onEvent(e,t){var i,s,n=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[At])||[];if(ti.SHOWN===e&&t&&n.length>0){var a;T.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:n});var o=t==null||(a=t.properties)==null?void 0:a.$survey_id;if(o){var l=n.indexOf(o);l>=0&&(n.splice(l,1),this.Wi(n))}}else if(this.Ui.has(e)){T.info("survey event name matched",{event:e,eventPayload:t,surveys:this.Ui.get(e)});var u=[];(s=this._instance)==null||s.getSurveys(d=>{u=d.filter(f=>{var p;return(p=this.Ui.get(e))==null?void 0:p.includes(f.id)})});var c=u.filter(d=>{var f,p=(f=d.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.find(g=>g.name===e);return!!p&&(!p.propertyFilters||Object.entries(p.propertyFilters).every(g=>{var _,[w,k]=g,S=t==null||(_=t.properties)==null?void 0:_[w];if(m(S)||_e(S))return!1;var I=[String(S)],P=Ys[k.operator];return P?P(k.values,I):(T.warn("Unknown property comparison operator: "+k.operator),!1)}))});this.Wi(n.concat(c.map(d=>d.id)||[]))}}onAction(e){var t,i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[At])||[];this.zi.has(e)&&this.Wi(i.concat(this.zi.get(e)||[]))}Wi(e){var t;T.info("updating activated surveys",{activatedSurveys:e}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[At]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[At];return t||[]}getEventToSurveys(){return this.Ui}Gi(){return this.qi}}class fo{constructor(e){this.Vi=void 0,this._surveyManager=null,this.Ji=!1,this.Ki=!1,this.Yi=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(R(t))return T.warn("Flags not loaded yet. Not loading surveys.");var i=F(t);this.Vi=i?t.length>0:t,T.info("flags response received, isSurveysEnabled: "+this.Vi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(Ki)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(s=>localStorage.removeItem(s))}loadIfEnabled(){if(!this._surveyManager)if(this.Ki)T.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)T.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())T.info("Not loading surveys in cookieless mode without consent.");else{var e=x==null?void 0:x.__PosthogExtensions__;if(e){if(!m(this.Vi)||this._instance.config.advanced_enable_surveys){var t=this.Vi||this._instance.config.advanced_enable_surveys;this.Ki=!0;try{var i=e.generateSurveys;if(i)return void this.Xi(i,t);var s=e.loadExternalDependency;if(!s)return void this.Qi("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",n=>{n||!e.generateSurveys?this.Qi("Could not load surveys script",n):this.Xi(e.generateSurveys,t)})}catch(n){throw this.Qi("Error initializing surveys",n),n}finally{this.Ki=!1}}}else T.error("PostHog Extensions not found.")}}Xi(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new po(this._instance),T.info("Surveys loaded successfully"),this.Zi({isLoaded:!0})}Qi(e,t){T.error(e,t),this.Zi({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Yi.push(e),this._surveyManager&&this.Zi({isLoaded:!0}),()=>{this.Yi=this.Yi.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return T.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(_i);if(i&&!t)return e(i,{isLoaded:!0});if(this.Ji)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.Ji=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var n;this.Ji=!1;var a=s.statusCode;if(a!==200||!s.json){var o="Surveys API could not be loaded, status: "+a;return T.error(o),e([],{isLoaded:!1,error:o})}var l,u=s.json.surveys||[],c=u.filter(d=>function(f){return!(!f.start_date||f.end_date)}(d)&&(function(f){var p;return!((p=f.conditions)==null||(p=p.events)==null||(p=p.values)==null||!p.length)}(d)||function(f){var p;return!((p=f.conditions)==null||(p=p.actions)==null||(p=p.values)==null||!p.length)}(d)));return c.length>0&&((l=this._surveyEventReceiver)==null||l.register(c)),(n=this._instance.persistence)==null||n.register({[_i]:u}),e(u,{isLoaded:!0})}})}catch(s){throw this.Ji=!1,s}}Zi(e){for(var t of this.Yi)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){T.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!R(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);T.warn("init was not called")}te(e){var t=null;return this.getSurveys(i=>{var s;t=(s=i.find(n=>n.id===e))!==null&&s!==void 0?s:null}),t}ie(e){if(R(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.te(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(R(this._surveyManager))return T.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ie(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return R(this._surveyManager)?(T.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(s=>{var n,a=(n=s.find(l=>l.id===e))!==null&&n!==void 0?n:null;if(a){var o=this.ie(a);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){var i;if(R(this._surveyManager))T.warn("init was not called");else{var s=typeof e=="string"?this.te(e):e;if(s!=null&&s.id)if(uo.includes(s.type)){var n=y==null?void 0:y.querySelector(t);if(n)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(T.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var a,o;T.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(s,n),T.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n);T.warn("Survey element not found")}else T.warn("Surveys of type "+s.type+" cannot be rendered in the app");else T.warn("Survey not found")}}displaySurvey(e,t){var i;if(R(this._surveyManager))T.warn("init was not called");else{var s=this.te(e);if(s){var n=s;if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=E({},s,{appearance:E({},s.appearance,{surveyPopupDelaySeconds:0})})),t.ignoreConditions===!1){var a=this.canRenderSurvey(s);if(!a.visible)return void T.warn("Survey is not eligible to be displayed: ",a.disabledReason)}t.displayType!==Qs.Inline?this._surveyManager.handlePopoverSurvey(n):this.renderSurvey(n,t.selector)}else T.warn("Survey not found")}}}var tn=U("[RateLimiter]");class go{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var n=s.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach(a=>{tn.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void tn.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:n})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)==null?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,s;e===void 0&&(e=!1);var n=new Date().getTime(),a=(t=(i=this.instance.persistence)==null?void 0:i.get_property(mi))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:n};a.tokens+=(n-a.last)/1e3*this.captureEventsPerSecond,a.last=n,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var o=a.tokens<1;return o||e||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(s=this.instance.persistence)==null||s.set_property(mi,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var qe=U("[RemoteConfig]");class _o{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}ee(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(qe.error("PostHog Extensions not found. Cannot load remote config."),e())}re(e){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return qe.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.M())return void qe.warn("Remote config is disabled. Falling back to local config.");this.ee(e=>{if(!e)return qe.info("No config found after loading remote JS config. Falling back to JSON."),void this.re(t=>{this.fi(t)});this.fi(e)})}catch(e){qe.error("Error loading remote config",e)}}fi(e){e?this._instance.config.__preview_remote_config?(this._instance.fi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):qe.info("__preview_remote_config is disabled. Logging config instead",e):qe.error("Failed to fetch remote config from PostHog.")}}var Ji=3e3;class vo{constructor(e,t){this.se=!0,this.ne=[],this.oe=le((t==null?void 0:t.flush_interval_ms)||Ji,250,5e3,b.createLogger("flush interval"),Ji),this.ae=e}enqueue(e){this.ne.push(e),this.le||this.ue()}unload(){this.he();var e=this.ne.length>0?this.de():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.ae(E({},i,{transport:"sendBeacon"}))})}enable(){this.se=!1,this.ue()}ue(){var e=this;this.se||(this.le=setTimeout(()=>{if(this.he(),this.ne.length>0){var t=this.de(),i=function(){var n=t[s],a=new Date().getTime();n.data&&F(n.data)&&O(n.data,o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp}),e.ae(n)};for(var s in t)i()}},this.oe))}he(){clearTimeout(this.le),this.le=void 0}de(){var e={};return O(this.ne,t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;m(e[n])&&(e[n]=E({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)}),this.ne=[],e}}var mo=["retriesPerformedSoFar"];class yo{constructor(e){this.ve=!1,this.ce=3e3,this.ne=[],this._instance=e,this.ne=[],this.fe=!0,!m(h)&&"onLine"in h.navigator&&(this.fe=h.navigator.onLine,this.pe=()=>{this.fe=!0,this.Dt()},this.ge=()=>{this.fe=!1},L(h,"online",this.pe),L(h,"offline",this.ge))}get length(){return this.ne.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=dr(e,mo);oe(t)&&t>0&&(i.url=Zt(i.url,{retry_count:t})),this._instance.ci(E({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this._e(E({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}_e(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)}(t),s=Date.now()+i;this.ne.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),b.warn(n),this.ve||(this.ve=!0,this.me())}me(){if(this.ye&&clearTimeout(this.ye),this.ne.length===0)return this.ve=!1,void(this.ye=void 0);this.ye=setTimeout(()=>{this.fe&&this.ne.length>0&&this.Dt(),this.me()},this.ce)}Dt(){var e=Date.now(),t=[],i=this.ne.filter(n=>n.retryAt<e||(t.push(n),!1));if(this.ne=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.ye&&(clearTimeout(this.ye),this.ye=void 0),this.ve=!1,m(h)||(this.pe&&(h.removeEventListener("online",this.pe),this.pe=void 0),this.ge&&(h.removeEventListener("offline",this.ge),this.ge=void 0)),this.ne))try{this._instance.ci(E({},e,{transport:"sendBeacon"}))}catch(t){b.error(t)}this.ne=[]}}class bo{constructor(e){this.be=()=>{var t,i,s,n;this.we||(this.we={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+((a==null?void 0:a.clientHeight)||0),c=(a==null?void 0:a.scrollHeight)||0;this.we.lastScrollY=Math.ceil(o),this.we.maxScrollY=Math.max(o,(t=this.we.maxScrollY)!==null&&t!==void 0?t:0),this.we.maxScrollHeight=Math.max(l,(i=this.we.maxScrollHeight)!==null&&i!==void 0?i:0),this.we.lastContentY=u,this.we.maxContentY=Math.max(u,(s=this.we.maxContentY)!==null&&s!==void 0?s:0),this.we.maxContentHeight=Math.max(c,(n=this.we.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.we}resetContext(){var e=this.we;return setTimeout(this.be,0),e}startMeasuringScrollPosition(){L(h,"scroll",this.be,{capture:!0}),L(h,"scrollend",this.be,{capture:!0}),L(h,"resize",this.be)}scrollElement(){if(!this._instance.config.scroll_root_selector)return h==null?void 0:h.document.documentElement;var e=F(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=h==null?void 0:h.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return h&&(h.scrollY||h.pageYOffset||h.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return h&&(h.scrollX||h.pageXOffset||h.document.documentElement.scrollLeft)||0}}var wo=r=>Os(r==null?void 0:r.config.mask_personal_data_properties,r==null?void 0:r.config.custom_personal_data_properties);class rn{constructor(e,t,i,s){this.xe=n=>{var a=this.$e();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.Se(this._instance)};this.Ee.register({[vi]:o})}},this._instance=e,this.ke=t,this.Ee=i,this.Se=s||wo,this.ke.onSessionId(this.xe)}$e(){return this.Ee.props[vi]}getSetOnceProps(){var e,t=(e=this.$e())==null?void 0:e.props;return t?"r"in t?Rs(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return O(di(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+ni(i)]=t}),e}}var Zi=U("[SessionId]");class sn{on(e,t){return this.Pe.on(e,t)}constructor(e,t,i){var s;if(this.Te=[],this.Ie=void 0,this.Pe=new Xi,this.Re=(c,d)=>Math.abs(c-d)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.C=e.config,this.Ee=e.persistence,this.Ce=void 0,this.Oe=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Fe=t||Pe,this.Me=i||Pe;var n=this.C.persistence_name||this.C.token,a=this.C.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*le(a,60,36e3,Zi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ae(),this.De="ph_"+n+"_window_id",this.je="ph_"+n+"_primary_window_exists",this.Le()){var o=j.W(this.De),l=j.W(this.je);o&&!l?this.Ce=o:j.V(this.De),j.G(this.je,!0)}if((s=this.C.bootstrap)!=null&&s.sessionID)try{var u=(c=>{var d=c.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.C.bootstrap.sessionID);this.Ne(this.C.bootstrap.sessionID,new Date().getTime(),u)}catch(c){Zi.error("Invalid sessionID in bootstrap",c)}this.Ue()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return m(this.Te)&&(this.Te=[]),this.Te.push(e),this.Oe&&e(this.Oe,this.Ce),()=>{this.Te=this.Te.filter(t=>t!==e)}}Le(){return this.C.persistence!=="memory"&&!this.Ee.wi&&j.H()}ze(e){e!==this.Ce&&(this.Ce=e,this.Le()&&j.G(this.De,e))}He(){return this.Ce?this.Ce:this.Le()?j.W(this.De):null}Ne(e,t,i){e===this.Oe&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Oe=e,this.Ee.register({[Mt]:[t,e,i]}))}Be(){if(this.Oe&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Oe,this._sessionStartTimestamp];var e=this.Ee.props[Mt];return F(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ne(null,null,null)}destroy(){clearTimeout(this.qe),this.qe=void 0,this.Ie&&h&&(h.removeEventListener("beforeunload",this.Ie,{capture:!1}),this.Ie=void 0),this.Te=[]}Ue(){this.Ie=()=>{this.Le()&&j.V(this.je)},L(h,"beforeunload",this.Ie,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.C.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[s,n,a]=this.Be(),o=this.He(),l=oe(a)&&a>0&&Math.abs(i-a)>864e5,u=!1,c=!n,d=!c&&!e&&this.Re(i,s);c||d||l?(n=this.Fe(),o=this.Me(),Zi.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:l}}),a=i,u=!0):o||(o=this.Me(),u=!0);var f=s===0||!e||l?i:s,p=a===0?new Date().getTime():a;return this.ze(o),this.Ne(n,f,p),e||this.Ae(),u&&this.Te.forEach(g=>g(n,o,u?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:n,windowId:o,sessionStartTimestamp:p,changeReason:u?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}Ae(){clearTimeout(this.qe),this.qe=setTimeout(()=>{var[e]=this.Be();if(this.Re(new Date().getTime(),e)){var t=this.Oe;this.resetSessionId(),this.Pe.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var Eo=["$set_once","$set"],Te=U("[SiteApps]");class ko{constructor(e){this._instance=e,this.We=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ge(e,t){if(t){var i=this.globalsForEvent(t);this.We.push(i),this.We.length>1e3&&(this.We=this.We.slice(10))}}get siteAppLoaders(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Mi(this.Ge.bind(this));this.Ve=()=>{e(),this.We=[],this.Ve=void 0}}}globalsForEvent(e){var t,i,s,n,a,o,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[f,p]of Object.entries(d))u[f]={id:c[f],type:f,properties:p};var{$set_once:g,$set:_}=e;return{event:E({},dr(e,Eo),{properties:E({},e.properties,_?{$set:E({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},_)}:{},g?{$set_once:E({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},g)}:{}),elements_chain:(a=(o=e.properties)==null?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var o;!t.errored&&this.We.length&&(Te.info("Processing "+this.We.length+" events for site app with id "+e.id),this.We.forEach(l=>t.processEvent==null?void 0:t.processEvent(l)),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((o=this.Ve)==null||o.call(this))},s=!1,n=o=>{t.errored=!o,t.loaded=!0,Te.info("Site app with id "+e.id+" "+(o?"loaded":"errored")),s&&i()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:o=>{n(o)}});a&&(t.processEvent=a),s=!0}catch(o){Te.error("Error while initializing PostHog app with config id "+e.id,o),n(!1)}if(s&&t.loaded)try{i()}catch(o){Te.error("Error while processing buffered events PostHog app with config id "+e.id,o),t.errored=!0}}Je(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Ke(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(s){Te.error("Error while processing event "+e.event+" for site app "+i.id,s)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Je(),void this._instance.on("eventCaptured",u=>this.Ke(u))):void Te.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Ve)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(u){var c;x["__$$ph_site_app_"+u]=n._instance,(c=x.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(n._instance,l,d=>{if(d)return Te.error("Error while initializing PostHog app with config id "+u,d)})};for(var{id:o,url:l}of e.siteApps)a(o)}else Te.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var nn=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&hr(t,e))return!0;try{var i=r==null?void 0:r.userAgentData;if(i!=null&&i.brands&&i.brands.some(s=>hr(s==null?void 0:s.brand,e)))return!0}catch{}return!!r.webdriver},Ct=function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r}({}),an="i.posthog.com";class xo{constructor(e){this.Ye={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+an,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Ye[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=Ct.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=Ct.EU:this.Ye[this.apiHost]=Ct.CUSTOM),this.Ye[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===Ct.CUSTOM)return this.apiHost+t;var i=an+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var So={icontains:(r,e)=>!!h&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!h&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!h&&Ze(e.href,r),not_regex:(r,e)=>!!h&&!Ze(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class V{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments(s=>{V.Xe("retrieved web experiments from the server"),t.Qe=new Map,s.forEach(n=>{if(n.feature_flag_key){var a;t.Qe&&(V.Xe("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.Qe)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);B(o)&&n.variants[o]&&t.Ze(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];V.tr(u)&&t.Ze(n.name,l,u.transforms)}})},i)},this._instance=e,this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}onFeatureFlags(e){if(this._is_bot())V.Xe("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(R(this.Qe))return this.Qe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();V.Xe("applying feature flags",e),e.forEach(t=>{var i;if(this.Qe&&(i=this.Qe)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),a=(s=this.Qe)==null?void 0:s.get(t);n&&a!=null&&a.variants[n]&&this.Ze(a.name,n,a.variants[n].transforms)}})}}previewWebExperiment(){var e=V.getWindowLocation();if(e!=null&&e.search){var t=Vt(e==null?void 0:e.search,"__experiment_id"),i=Vt(e==null?void 0:e.search,"__experiment_variant");t&&i&&(V.Xe("previewing web experiments "+t+" && "+i),this.getWebExperiments(s=>{this.ir(parseInt(t),i,s)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var a=n.json.experiments||[];return e(a)}})}ir(e,t,i){var s=i.filter(n=>n.id===e);s&&s.length>0&&(V.Xe("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ze(s[0].name,t,s[0].variants[t].transforms))}static tr(e){return!R(e.conditions)&&V.er(e)&&V.rr(e)}static er(e){var t;if(R(e.conditions)||R((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,a=V.getWindowLocation();return!!a&&((i=e.conditions)==null||!i.url||So[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,a))}static getWindowLocation(){return h==null?void 0:h.location}static rr(e){var t;if(R(e.conditions)||R((t=e.conditions)==null?void 0:t.utm))return!0;var i=Ps();if(i.utm_source){var s,n,a,o,l,u,c,d,f=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,p=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==i.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==i.utm_medium,_=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==i.utm_term;return f&&g&&_&&p}return!1}static Xe(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];b.info("[WebExperiments] "+e,i)}Ze(e,t,i){this._is_bot()?V.Xe("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach(s=>{if(s.selector){var n;V.Xe("applying transform of variant "+t+" for experiment "+e+" ",s);var a=(n=document)==null?void 0:n.querySelectorAll(s.selector);a==null||a.forEach(o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)})}}):V.Xe("Control variants leave the page unmodified.")}_is_bot(){return K&&this._instance?nn(K,this._instance.config.custom_blocked_useragents):void 0}}var Co=U("[PostHog ExternalIntegrations]"),Po={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class $o{constructor(e){this._instance=e}it(e,t){var i;(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,s=>{if(s)return Co.error("failed to load script",s);t()})}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,u;!s||(o=x.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.it(Po[a],()=>{var c;(c=x.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.start(e._instance)}),!s&&(l=x.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((u=x.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.stop())};for(var[i,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(i)}}}var Qi="[SessionRecording]",Pt=U(Qi);class on{get started(){var e;return!((e=this.sr)==null||!e.isStarted)}get status(){return this.sr?this.sr.status:this.nr&&!this.ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.nr=!1,this.lr=void 0,this._instance=e,!this._instance.sessionManager)throw Pt.error("started without valid sessionManager"),new Error(Qi+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Qi+' cannot be used with cookieless_mode="always"')}get ar(){var e,t=!((e=this._instance.get_property(fi))==null||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return h&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.ar||(t=this.sr)==null||!t.isStarted){var i=!m(Object.assign)&&!m(Array.from);this.ar&&i?(this.ur(e),Pt.info("starting")):this.stopRecording()}}ur(e){var t,i,s;this.ar&&(x!=null&&(t=x.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=x.__PosthogExtensions__)!=null&&i.initSessionRecording?this.hr(e):(s=x.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.dr,n=>{if(n)return Pt.error("could not load recorder",n);this.hr(e)}))}stopRecording(){var e,t;(e=this.lr)==null||e.call(this),this.lr=void 0,(t=this.sr)==null||t.stop()}vr(){var e;(e=this._instance.persistence)==null||e.unregister(Or)}cr(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,n=()=>{var a=e.sessionRecording===!1?void 0:e.sessionRecording,o=a==null?void 0:a.sampleRate,l=R(o)?null:parseFloat(o);R(l)&&this.vr();var u=a==null?void 0:a.minimumDurationMilliseconds;s.register({[fi]:E({enabled:!!a},a,{networkPayloadCapture:E({capturePerformance:e.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:l,minimumDurationMilliseconds:m(u)?null:u,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers})})};n(),(t=this.lr)==null||t.call(this),this.lr=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.cr(e),this.nr=!0,this.startIfEnabledOrStop()):this.nr=!0:Pt.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.sr)!=null&&i.log?this.sr.log(e,t):Pt.warn("log called before recorder was ready")}get dr(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(fi);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}hr(e){var t,i;if((t=x.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.sr||(this.sr=(i=x.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.sr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.sr.start(e)}onRRwebEmit(e){var t;(t=this.sr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.sr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.sr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.sr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.sr)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.sr||(i=this._instance.persistence)==null||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.sr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.sr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.sr)==null||!i.tryAddCustomEvent(e,t))}}var $t={},er=()=>{},et="posthog",ln=!ro&&(Y==null?void 0:Y.indexOf("MSIE"))===-1&&(Y==null?void 0:Y.indexOf("Mozilla"))===-1,cn=r=>{var e;return E({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Jn(y==null?void 0:y.location),persistence:"localStorage+cookie",persistence_name:"",loaded:er,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:z&&B(z==null?void 0:z.search)&&z.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(h==null||(e=h.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;b.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Ji},error_tracking:{},_onCapture:er,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(r))},un=r=>{var e={};m(r.process_person)||(e.person_profiles=r.process_person),m(r.xhr_headers)||(e.request_headers=r.xhr_headers),m(r.cookie_name)||(e.persistence_name=r.cookie_name),m(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),m(r.store_google)||(e.save_campaign_params=r.store_google),m(r.verbose)||(e.debug=r.verbose);var t=A({},e,r);return F(r.property_blacklist)&&(m(r.property_denylist)?t.property_denylist=r.property_blacklist:F(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:b.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class Io{constructor(){this.__forceAllowLocalhost=!1}get pr(){return this.__forceAllowLocalhost}set pr(e){b.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ii{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Io,this.gr=!1,this.version=ge.LIB_VERSION,this._r=new Xi,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=cn(),this.SentryIntegration=Ca,this.sentryIntegration=e=>function(t,i){var s=ns(t,i);return{name:ss,processEvent:n=>s(n)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.mr=!1,this.yr=null,this.br=null,this.wr=null,this.featureFlags=new oo(this),this.toolbar=new $a(this),this.scrollManager=new bo(this),this.pageViewManager=new Ya(this),this.surveys=new fo(this),this.experiments=new V(this),this.exceptions=new so(this),this.rateLimiter=new go(this),this.requestRouter=new xo(this),this.consent=new ba(this),this.externalIntegrations=new $o(this),this.people={set:(e,t,i)=>{var s=B(e)?{[e]:t}:e;this.setPersonProperties(s),i==null||i({})},set_once:(e,t,i)=>{var s=B(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i==null||i({})}},this.on("eventCaptured",e=>b.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==et){var s,n=(s=$t[i])!==null&&s!==void 0?s:new ii;return n._init(e,t,i),$t[i]=n,$t[et][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s;if(t===void 0&&(t={}),m(e)||ai(e))return b.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.$r(t.debug),this.Sr=t,this.Er=[],t.person_profiles&&(this.br=t.person_profiles),this.set_config(A({},cn(t.defaults),un(t),{name:i,token:e})),this.config.on_xhr_error&&b.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:me.GZipJS;var n=this.kr();this.persistence=new zi(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new zi(E({},this.config,{persistence:"sessionStorage"}),n);var a=E({},this.persistence.props),o=E({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Pr=new vo(S=>this.Tr(S),this.config.request_queue_config),this.Ir=new yo(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new sn(this),this.sessionPropsManager=new rn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(b.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Rr(l)},0)):(b.info("Initializing extensions synchronously"),this.Rr(l)),ge.DEBUG=ge.DEBUG||this.config.debug,ge.DEBUG&&b.info("Starting in debug mode",{this:this,config:t,thisC:E({},this.config),p:a,s:o}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,c,d=this.config.get_device_id(Pe()),f=(u=t.bootstrap)!=null&&u.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(ve,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.Cr()){var p,g,_=Object.keys(((p=t.bootstrap)==null?void 0:p.featureFlags)||{}).filter(S=>{var I;return!((I=t.bootstrap)==null||(I=I.featureFlags)==null||!I[S])}).reduce((S,I)=>{var P;return S[I]=((P=t.bootstrap)==null||(P=P.featureFlags)==null?void 0:P[I])||!1,S},{}),w=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter(S=>_[S]).reduce((S,I)=>{var P,N;return(P=t.bootstrap)!=null&&(P=P.featureFlagPayloads)!=null&&P[I]&&(S[I]=(N=t.bootstrap)==null||(N=N.featureFlagPayloads)==null?void 0:N[I]),S},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:w})}if(l)this.register_once({distinct_id:ct,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(Pe());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(ve,"anonymous")}return L(h,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?Sa(this,()=>this.Or()):this.Or(),ke(this.config._onCapture)&&this.config._onCapture!==er&&(b.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",S=>this.config._onCapture(S.event,S))),this.config.ip&&b.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Rr(e){var t=performance.now();this.historyAutocapture=new xa(this),this.historyAutocapture.startIfEnabled();var i=[];i.push(()=>{new Ta(this).startIfEnabledOrStop()}),i.push(()=>{var s;this.siteApps=new ko(this),(s=this.siteApps)==null||s.init()}),e||i.push(()=>{this.sessionRecording=new on(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.push(()=>{this.autocapture=new ha(this),this.autocapture.startIfEnabled()}),i.push(()=>{this.surveys.loadIfEnabled()}),i.push(()=>{this.heatmaps=new za(this),this.heatmaps.startIfEnabled()}),i.push(()=>{this.webVitalsAutocapture=new Ga(this)}),i.push(()=>{this.exceptionObserver=new ka(this),this.exceptionObserver.startIfEnabled()}),i.push(()=>{this.deadClicksAutocapture=new is(this,Ea),this.deadClicksAutocapture.startIfEnabled()}),i.push(()=>{if(this.Fr){var s=this.Fr;this.Fr=void 0,this.fi(s)}}),this.Mr(i,t)}Mr(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Mr(e,t)},0);var i=e.shift();if(i)try{i()}catch(n){b.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&b.info("PostHog extensions initialized ("+s+"ms)")}fi(e){var t,i,s,n,a,o,l,u;if(!y||!y.body)return b.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.fi(e)},500);this.config.__preview_deferred_init_extensions&&(this.Fr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=C(e.supportedCompression,me.GZipJS)?me.GZipJS:C(e.supportedCompression,me.Base64)?me.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.br?this.br:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(o=this.webVitalsAutocapture)==null||o.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Or(){try{this.config.loaded(this)}catch(e){b.critical("`loaded` function failed",e)}this.Ar(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Dr()},1),new _o(this).load(),this.featureFlags.flags()}Ar(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Pr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Se(this.__request_queue,e=>this.Tr(e)),this.__request_queue=[],this.Ar()}_handle_unload(){var e,t;this.config.request_batching?(this.jr()&&this.capture("$pageleave"),(e=this.Pr)==null||e.unload(),(t=this.Ir)==null||t.unload()):this.jr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(e){this.__loaded&&(ln?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Zt(e.url,{ip:this.config.ip?1:0}),e.headers=E({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,s,n,a=E({},t);a.timeout=a.timeout||6e4,a.url=Zt(a.url,{_:new Date().getTime().toString(),ver:ge.LIB_VERSION,compression:a.compression});var o=(i=a.transport)!==null&&i!==void 0?i:"fetch",l=Qt.filter(c=>!a.disableTransport||!c.transport||!a.disableTransport.includes(c.transport)),u=(s=(n=xr(l,c=>c.transport===o))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");u(a)})(E({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(s=this.config).on_request_error)==null||i.call(s,t)),e.callback==null||e.callback(t)}}))))}Tr(e){this.Ir?this.Ir.retriableRequest(e):this.ci(e)}_execute_array(e){var t,i=[],s=[],n=[];Se(e,o=>{o&&(t=o[0],F(t)?n.push(o):ke(o)?o.call(this):F(o)&&t==="alias"?i.push(o):F(o)&&t.indexOf("capture")!==-1&&ke(this[t])?n.push(o):s.push(o))});var a=function(o,l){Se(o,function(u){if(F(u[0])){var c=l;O(u,function(d){c=c[d[0]].apply(c,d.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};a(i,this),a(s,this),a(n,this)}Cr(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pr){if(this.is_capturing())if(!m(e)&&B(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var a=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!B(t==null?void 0:t.$current_url)&&(b.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,l=(i==null?void 0:i.timestamp)||o,u=Pe(),c={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},l,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),a&&(c.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),i!=null&&i.$set&&(c.$set=i==null?void 0:i.$set);var d,f=this.Lr(i==null?void 0:i.$set_once);if(f&&(c.$set_once=f),(c=Xn(c,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,m(i==null?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===ti.DISMISSED||e===ti.SENT){var p=t==null?void 0:t[Zs.SURVEY_ID],g=t==null?void 0:t[Zs.SURVEY_ITERATION];d={id:p,current_iteration:g},localStorage.getItem(en(d))||localStorage.setItem(en(d),"true"),c.$set=E({},c.$set,{[co({id:p,current_iteration:g},e===ti.SENT?"responded":"dismissed")]:!0})}var _=E({},c.properties.$set,c.$set);if(Ve(_)||this.setPersonPropertiesForFlags(_),!R(this.config.before_send)){var w=this.Nr(c);if(!w)return;c=w}this._r.emit("eventCaptured",c);var k={method:"POST",url:(s=i==null?void 0:i._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Tr(k):this.Pr.enqueue(k),c}b.critical("This capture call is ignored due to client rate limiting.")}}else b.error("No event name provided to posthog.capture")}else b.uninitializedWarning("posthog.capture")}Mi(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=E({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=E({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!B(o.distinct_id)&&!oe(o.distinct_id)||ai(o.distinct_id))&&b.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,c=Ha(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());o.$session_id=d,o.$window_id=f}this.sessionPropsManager&&A(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&A(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.Ir)==null?void 0:p.length}catch(k){o.$sdk_debug_error_capturing_properties=String(k)}if(this.requestRouter.region===Ct.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=A(o,u),e==="$pageview"&&y&&(o.title=y.title),!m(a)){var g=i.getTime()-a;o.$duration=parseFloat((g/1e3).toFixed(3))}Y&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=A({},c,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?O(this.config.property_denylist,function(k){delete o[k]}):b.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(b.error("sanitize_properties is deprecated. Use before_send instead"),o=_(o,e));var w=this.Ur();return o.$process_person_profile=w,w&&!n&&this.zr("_calculate_event_properties"),o}Lr(e){var t;if(!this.persistence||!this.Ur()||this.gr)return e;var i=this.persistence.get_initial_props(),s=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),n=A({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(b.error("sanitize_properties is deprecated. Use before_send instead"),n=a(n,"$set_once")),this.gr=!0,Ve(n)?void 0:n}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)==null||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Hr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._r.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=ho),this.surveys.displaySurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return b.uninitializedWarning("posthog.identify");if(oe(e)&&(e=e.toString(),b.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))b.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==ct){if(this.zr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(nt)&&(this.unregister(nt),this.register({distinct_id:e}));var a=(this.persistence.get_property(ve)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(ve,"identified"),this.setPersonPropertiesForFlags(E({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.wr=zs(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(Nt))}}else b.critical('The string "'+ct+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else b.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.zr("posthog.setPersonProperties")){var i=zs(this.get_distinct_id(),e,t);this.wr!==i?(this.setPersonPropertiesForFlags(E({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.wr=i):b.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.zr("posthog.group")){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:E({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}}else b.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.zr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(b.info("reset"),!this.__loaded)return b.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(ve,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.wr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ct,$device_id:null},"");else{var o=this.config.get_device_id(Pe());this.register_once({distinct_id:o,$device_id:e?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return s}alias(e,t){return e===this.get_property(Sr)?(b.critical("Attempting to create alias for existing People user - aborting."),-2):this.zr("posthog.alias")?(m(t)&&(t=this.get_distinct_id()),e!==t?(this.Hr(nt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(b.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=E({},this.config);if(q(e)){var i,s,n,a,o;A(this.config,un(e));var l=this.kr();(i=this.persistence)==null||i.update_config(this.config,t,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new zi(E({},this.config,{persistence:"sessionStorage"}),l);var u=this.$r(this.config.debug);xe(u)&&(this.config.debug=u),xe(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,M.H()&&M.G("ph_debug","true"),b.info("set_config",{config:e,oldConfig:t,newConfig:E({},this.config)})):(ge.DEBUG=!1,M.H()&&M.V("ph_debug"))),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(n=this.autocapture)==null||n.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Br(),(o=this.externalIntegrations)==null||o.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,a,o,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),i.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),i.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(E({},s,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:et;return t!==et&&(t=et+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(ve))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(ve))==="identified"}Ur(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ve(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[nt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Bt]))}jr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Ur()||this.zr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}zr(e){return this.config.person_profiles==="never"?(b.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Hr(Bt,!0),!0)}kr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}Br(){var e,t,i,s,n=this.kr();return((e=this.persistence)==null?void 0:e.wi)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.wi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var t,i;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(t=this.sessionManager)==null||t.destroy(),this.sessionManager=new sn(this),this.persistence&&(this.sessionPropsManager=new rn(this,this.sessionManager,this.persistence)),this.sessionRecording=new on(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Br(),this.Ar(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(m(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((i=e==null?void 0:e.captureEventName)!==null&&i!==void 0?i:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Dr()}else b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Br(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ct,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,this.Dr())):b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===ye.GRANTED?"granted":e===ye.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Br()}_is_bot(){return K?nn(K,this.config.custom_blocked_useragents):void 0}Dr(){y&&(y.visibilityState==="visible"?this.mr||(this.mr=!0,this.capture("$pageview",{title:y.title},{send_instantly:!0}),this.yr&&(y.removeEventListener("visibilitychange",this.yr),this.yr=null)):this.yr||(this.yr=this.Dr.bind(this),L(y,"visibilitychange",this.yr)))}debug(e){e===!1?(h==null||h.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(h==null||h.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)`."),this.set_config({debug:!0}))}M(){var e,t,i,s,n,a,o,l=this.Sr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(b.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=!1,n=b,a=(t="advanced_disable_flags")in(e=l)&&!m(e[t]),o=i in e&&!m(e[i]),a?e[t]:o?(n&&n.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):s)}Nr(e){if(R(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),R(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return En(e.event)?b.warn(n+". This can cause unexpected behavior."):b.info(n),null}i.properties&&!Ve(i.properties)||b.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.Vt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}$r(e){var t=xe(e)&&!e,i=M.H()&&M.q("ph_debug")==="true";return!t&&(!!i||e)}}(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=Yn(r.prototype[e[t]])})(ii,["identify"]);var dn;dn=$t[et]=new ii,function(){function r(){r.done||(r.done=!0,ln=!1,O($t,function(e){e._dom_loaded()}))}y!=null&&y.addEventListener?y.readyState==="complete"?r():L(y,"DOMContentLoaded",r,{capture:!1}):h&&b.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}();var hn;(function(r){r.USER_ADDED_TO_CART="user_added_to_cart",r.USER_SUBMITTED_CHECKOUT="user_submitted_checkout"})(hn||(hn={}));const To={class:"dialog-block-header-container"},Fo={class:"dialog-block-title"},Oo={class:"dialog-block-description"},Ro=v.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(r){const e=r;return(t,i)=>(v.openBlock(),v.createElementBlock("div",To,[v.createElementVNode("div",Fo,v.toDisplayString(e.title??"Your expert"),1),v.createElementVNode("div",Oo,v.toDisplayString(e.description??"A question about this product?"),1)]))}}),tt=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},Do=tt(Ro,[["__scopeId","data-v-6abd4066"]]),Mo={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ao={"clip-path":"url(#clip0_466_934)"},No=["stroke"],Lo=["stroke"],Bo=v.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(r){const e=r;return(t,i)=>(v.openBlock(),v.createElementBlock("svg",Mo,[v.createElementVNode("g",Ao,[v.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
5
5
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
6
6
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
7
7
  15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232
@@ -10,7 +10,7 @@
10
10
  15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418
11
11
  13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225
12
12
  13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675
13
- 10.8333Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ol),S.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
13
+ 10.8333Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,No),v.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
14
14
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
15
15
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
16
16
  8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348
@@ -19,4 +19,4 @@
19
19
  9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043
20
20
  6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207
21
21
  5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001
22
- 1.66666Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Al)]),i[0]||(i[0]=S.createElementVNode("defs",null,[S.createElementVNode("clipPath",{id:"clip0_466_934"},[S.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),Ml=["onClick"],Dl={class:"dialog-block-suggestions-item-label"},Nl=dt(S.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(r){const e=r,t=i=>{e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:i,fromQuestionSuggestion:!0})};return(i,s)=>(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(e.questions,n=>(S.openBlock(),S.createElementBlock("button",{key:n.question,class:"dialog-block-suggestions-item",onClick:o=>t(n.question)},[S.createVNode(Ll,{class:"dialog-block-suggestions-item-icon",color:e.client.theme.primaryColor},null,8,["color"]),S.createElementVNode("span",Dl,S.toDisplayString(n.question),1)],8,Ml))),128))}}),[["__scopeId","data-v-7a20db67"]]),ql={};function Bl(r,e){return S.openBlock(),S.createElementBlock(S.Fragment,null,[e[0]||(e[0]=S.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[1]||(e[1]=S.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[2]||(e[2]=S.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const Ul=dt(ql,[["render",Bl],["__scopeId","data-v-26a64b58"]]),jl={class:"dialog-block-suggestions-container"},Hl=dt(S.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(r){const e=r;return(t,i)=>(S.openBlock(),S.createElementBlock("div",jl,[e.isLoading||!e.questions?(S.openBlock(),S.createBlock(Ul,{key:0})):(S.openBlock(),S.createBlock(Nl,{key:1,client:e.client,questions:e.questions,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-4509a683"]]),zl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Vl=["stroke"],Wl=S.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(r){const e=r;return(t,i)=>(S.openBlock(),S.createElementBlock("svg",zl,[S.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:e.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Vl)]))}}),Gl=["placeholder"],Kl=["disabled"],lo=dt(S.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(r){const e=r,t=S.ref(),i=S.ref(""),s=()=>{var o;(o=t.value)==null||o.focus()},n=()=>{const o=i.value;o.trim()&&(e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:o,fromQuestionSuggestion:!0}),i.value="")};return(o,a)=>(S.openBlock(),S.createElementBlock("div",{class:"dialog-input-wrapper",onClick:s},[S.withDirectives(S.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:t,"onUpdate:modelValue":a[0]||(a[0]=l=>i.value=l),class:"dialog-ask-anything-input-ai-input",placeholder:e.placeholder??"Ask anything...",onKeydown:S.withKeys(n,["enter"])},null,40,Gl),[[S.vModelText,i.value]]),S.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!i.value.trim(),onClick:n},[S.createVNode(Wl,{color:e.client.theme.ctaTextColor},null,8,["color"])],8,Kl)]))}}),[["__scopeId","data-v-c5beb945"]]),Jl=S.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(r){const e=r,t=document.body,i=n=>n.replace(/([A-Z])/g,"-$1").toLowerCase(),s=n=>{n&&Object.keys(n).forEach(o=>{const a=o,l=i(o);if(n[a]!==void 0){if(typeof n[a]=="object"){Object.keys(n[a]).forEach(c=>{var u;const d=c;if(d!==void 0){const h=i(c),_=n[a];t.style.setProperty(`--dialog-theme-${l}-${h}`,(u=_[d])==null?void 0:u.toString())}});return}if(a==="ctaBorderType"){const c=n[a]==="rounded"?"24px":"0";t.style.setProperty(`--dialog-theme-${l}`,c);return}t.style.setProperty(`--dialog-theme-${l}`,n[a].toString())}})};return S.onMounted(()=>{e.theme&&s(e.theme)}),S.watch(()=>e.theme,n=>{n&&s(n)},{deep:!0}),(n,o)=>S.renderSlot(n.$slots,"default")}}),Yl={id:"dialog-instant",class:"dialog-block-container"},Ql=dt(S.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!0}},setup(r){const e=r,t=S.ref(!0),i=S.ref(void 0),s=S.computed(()=>{var l;return(l=i.value)==null?void 0:l.assistantName}),n=S.computed(()=>{var l;return(l=i.value)==null?void 0:l.description}),o=S.computed(()=>{var l;return(l=i.value)==null?void 0:l.inputPlaceholder}),a=async()=>{try{const l=await e.client.getSuggestions(e.productId);i.value=l,t.value=!1}catch(l){console.error("error",l)}};return S.onMounted(async()=>{await a()}),(l,c)=>(S.openBlock(),S.createBlock(Jl,{theme:e.client.theme},{default:S.withCtx(()=>{var d;return[S.createElementVNode("div",Yl,[S.createVNode(Fl,{title:s.value,description:n.value},null,8,["title","description"]),S.createVNode(Hl,{client:e.client,questions:(d=i.value)==null?void 0:d.questions,"is-loading":t.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),e.enableInput?(S.openBlock(),S.createBlock(lo,{key:0,client:e.client,placeholder:o.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):S.createCommentVNode("",!0)])]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-d0700691"]]);Pe.DialogInput=lo,Pe.DialogProductBlock=Ql,Object.defineProperty(Pe,Symbol.toStringTag,{value:"Module"})});
22
+ 1.66666Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Lo)]),i[0]||(i[0]=v.createElementVNode("defs",null,[v.createElementVNode("clipPath",{id:"clip0_466_934"},[v.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),Uo=["onClick"],qo={class:"dialog-block-suggestions-item-label"},jo=tt(v.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(r){const e=r,t=i=>{e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:i,fromQuestionSuggestion:!0})};return(i,s)=>(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(e.questions,n=>(v.openBlock(),v.createElementBlock("button",{key:n.question,class:"dialog-block-suggestions-item",onClick:a=>t(n.question)},[v.createVNode(Bo,{class:"dialog-block-suggestions-item-icon",color:e.client.theme.primaryColor},null,8,["color"]),v.createElementVNode("span",qo,v.toDisplayString(n.question),1)],8,Uo))),128))}}),[["__scopeId","data-v-7a20db67"]]),Vo={};function Ho(r,e){return v.openBlock(),v.createElementBlock(v.Fragment,null,[e[0]||(e[0]=v.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[1]||(e[1]=v.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[2]||(e[2]=v.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const Go=tt(Vo,[["render",Ho],["__scopeId","data-v-26a64b58"]]),Wo={class:"dialog-block-suggestions-container"},zo=tt(v.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(r){const e=r;return(t,i)=>(v.openBlock(),v.createElementBlock("div",Wo,[e.isLoading||!e.questions?(v.openBlock(),v.createBlock(Go,{key:0})):(v.openBlock(),v.createBlock(jo,{key:1,client:e.client,questions:e.questions,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-4509a683"]]),Yo={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Xo=["stroke"],Ko=v.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(r){const e=r;return(t,i)=>(v.openBlock(),v.createElementBlock("svg",Yo,[v.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:e.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Xo)]))}}),Jo=["placeholder"],Zo=["disabled"],pn=tt(v.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(r){const e=r,t=v.ref(),i=v.ref(""),s=()=>{var a;(a=t.value)==null||a.focus()},n=()=>{const a=i.value;a.trim()&&(e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:a,fromQuestionSuggestion:!0}),i.value="")};return(a,o)=>(v.openBlock(),v.createElementBlock("div",{class:"dialog-input-wrapper",onClick:s},[v.withDirectives(v.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:t,"onUpdate:modelValue":o[0]||(o[0]=l=>i.value=l),class:"dialog-ask-anything-input-ai-input",placeholder:e.placeholder??"Ask anything...",onKeydown:v.withKeys(n,["enter"])},null,40,Jo),[[v.vModelText,i.value]]),v.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!i.value.trim(),onClick:n},[v.createVNode(Ko,{color:e.client.theme.ctaTextColor},null,8,["color"])],8,Zo)]))}}),[["__scopeId","data-v-c5beb945"]]),Qo=v.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(r){const e=r,t=document.body,i=n=>n.replace(/([A-Z])/g,"-$1").toLowerCase(),s=n=>{n&&Object.keys(n).forEach(a=>{const o=a,l=i(a);if(n[o]!==void 0){if(typeof n[o]=="object"){Object.keys(n[o]).forEach(u=>{var d;const c=u;if(c!==void 0){const f=i(u),p=n[o];t.style.setProperty(`--dialog-theme-${l}-${f}`,(d=p[c])==null?void 0:d.toString())}});return}if(o==="ctaBorderType"){const u=n[o]==="rounded"?"24px":"0";t.style.setProperty(`--dialog-theme-${l}`,u);return}t.style.setProperty(`--dialog-theme-${l}`,n[o].toString())}})};return v.onMounted(()=>{e.theme&&s(e.theme)}),v.watch(()=>e.theme,n=>{n&&s(n)},{deep:!0}),(n,a)=>v.renderSlot(n.$slots,"default")}}),el={id:"dialog-instant",class:"dialog-block-container"},tl=tt(v.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!0}},setup(r){const e=r,t=v.ref(!0),i=v.ref(void 0),s=v.computed(()=>{var l;return(l=i.value)==null?void 0:l.assistantName}),n=v.computed(()=>{var l;return(l=i.value)==null?void 0:l.description}),a=v.computed(()=>{var l;return(l=i.value)==null?void 0:l.inputPlaceholder}),o=async()=>{try{const l=await e.client.getSuggestions(e.productId);i.value=l,t.value=!1}catch(l){console.error("error",l)}};return v.onMounted(async()=>{await o()}),(l,u)=>(v.openBlock(),v.createBlock(Qo,{theme:e.client.theme},{default:v.withCtx(()=>{var c;return[v.createElementVNode("div",el,[v.createVNode(Do,{title:s.value,description:n.value},null,8,["title","description"]),v.createVNode(zo,{client:e.client,questions:(c=i.value)==null?void 0:c.questions,"is-loading":t.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),e.enableInput?(v.openBlock(),v.createBlock(pn,{key:0,client:e.client,placeholder:a.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):v.createCommentVNode("",!0)])]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-d0700691"]]);Ee.DialogInput=pn,Ee.DialogProductBlock=tl,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})});