userflow.js-self-hosted 0.1.1019820 → 0.1.1019826

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,5 +1,5 @@
1
- import{r as u,R as s}from"./vendor.react.js";import{af as _,ag as D,C as q,N as Q}from"./userflow.js";import{u as ke}from"./client-context.js";import{a2 as Se,b as Ie,a5 as V,a6 as X,a7 as Ce,a8 as W,a9 as B,aa as Z,ab as ee,ac as te}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{p as je}from"./vendor.dompurify.js";import{m as Me}from"./vendor.marked.js";import{o as H}from"./vendor.obj-str.js";import{A as Ne,d as Re,G as ve}from"./ResourceCenterApp.js";import{r as oe,R as le}from"./TreeDoc.js";import{D as L}from"./stylesheets.js";import{U as ce}from"./roots.js";import{r as se}from"./vendor.react-dom.js";import{S as Fe}from"./use-client-query.js";import"./vendor.core-js.js";import{g as Ae}from"./flow-condition-types.js";import{u as xe}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./flow-host.styl.js";import"./use-selector-element-monitoring.js";import"./Frame.js";import"./iframe-reset.styl.js";import"./use-window-resize.js";import"./logomark.js";import"./ChecklistUI.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./FlowChrome.js";import"./vendor.canvas-confetti.js";import"./vendor.memoize-one.js";import"./vendor.bignumber.js.js";import"./use-element-rect.js";import"./vendor.scheduler.js";import"./vendor.date-fns.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="a0b94cd8-b92e-4db7-ac78-0d703b4228d4",t._sentryDebugIdIdentifier="sentry-dbid-a0b94cd8-b92e-4db7-ac78-0d703b4228d4")}catch{}})();function Le(t){const e=Intl.Segmenter;return e?/(\p{Emoji_Presentation}|\p{Extended_Pictographic})(\p{Emoji_Modifier_Base}?\p{Emoji_Modifier}?|\uFE0F\u200D(\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?\uFE0F\u200D)*\p{Emoji_Presentation}|\uFE0F\u200D\p{Extended_Pictographic})/u.test(t)&&[...new e().segment(t)].length===1:!1}const ne=[];function ye({assistant:t,lookupAttribute:e,initialConversationId:a,initialHistory:c,initialUserContent:h,onConversationIdChange:f,submitMessage:m,submitRating:l,submitFeedback:p,InsideMessage:o,onContactClick:g,contactButtonText:i,onFlowSuggestionClick:r}){const[d,w]=u.useState(null),[S,M]=u.useState(()=>c?c.map(n=>({...n,assistantHtml:x(O(n.assistantContent),!1)})):ne),[N,R]=u.useState(""),I=u.useRef(null),E=u.useRef(null),k=u.useRef(!0),F=u.useRef(a||null),[fe,de]=u.useState(F.current),K=u.useCallback(n=>{F.current=n,de(n),f&&f(n)},[f]),P=u.useCallback(()=>{d?.focus({preventScroll:!0})},[d]);u.useEffect(()=>{P()},[P]),u.useLayoutEffect(()=>{const n=E.current;n&&(n.scrollTop=Math.ceil(n.scrollHeight-n.clientHeight))},[]);const $=u.useCallback(()=>{const n=E.current;n&&(k.current=!0,typeof n.scrollTo=="function"&&n.scrollTo({top:Math.ceil(n.scrollHeight-n.clientHeight),behavior:"smooth"}))},[]),G=u.useRef(0);u.useLayoutEffect(()=>{const n=E.current;n&&n.scrollHeight!==G.current&&(G.current=n.scrollHeight,k.current&&$())},[S,$]);const A=u.useCallback(()=>{I.current&&I.current()},[]);u.useEffect(()=>()=>{A()},[A]);const U=(n,v)=>{M(C=>C.map(j=>{if(n===j.id){const b=v(j);return{...j,...b}}else return j}))},y=n=>{M(v=>v.map((C,j)=>{if(j===v.length-1){const b=n(C);return{...C,...b}}else return C}))},z=u.useCallback(async n=>{if(n=n.trim(),n==="")return;A(),M(b=>[...b,{id:null,userContent:n,assistantContent:"",assistantFallbackContent:null,assistantHtml:x("","enter"),enterAnimation:!0,sources:[],flowSuggestions:[],completed:!1,rating:null,scaleRating:null,scaleMax:null,feedbackSubmitted:!1}]),R(""),$();let v=!1;const C=()=>{v=!0,I.current=null},j=m({conversationId:F.current,userContent:n,callback:b=>{if(v){console.log("Userflow.js AssistantChat got message after being done",b);return}switch(b.kind){case"conversation_created":K(b.conversationId);break;case"message_created":y(()=>({id:b.messageId,warning:b.warning}));break;case"assistant_content_delta":y(T=>{const Ee=b.delta,Y=T.assistantContent+Ee,_e=O(Y),we=x(_e);return{assistantContent:Y,assistantHtml:we}});break;case"done":C(),y(T=>({assistantHtml:x(T.assistantContent,"exit"),assistantFallbackContent:b.fallbackContent,flowSuggestions:b.flowSuggestions,completed:!0,sources:b.sources}));break;case"error":C(),y(T=>({failed:!0,error:b.message,assistantHtml:x(O(T.assistantContent),!1)}));break;default:console.log("Userflow.js AssistantChat got unknown message",b)}}});I.current=()=>{C(),j.abort(),y(b=>({assistantHtml:x(O(b.assistantContent),!1)}))}},[A,$,m,K]),J=u.useRef(!1);u.useEffect(()=>{J.current||(J.current=!0,h&&z(h))},[z,h]);const me=u.useCallback(()=>{A(),K(null),M(ne),P()},[A,P,K]),[ge,he]=u.useState(!0),pe=u.useCallback(()=>{const n=E.current;n&&he(n.scrollTop===0)},[]),be=u.useCallback(()=>{const n=E.current;n&&(k.current=Math.ceil(n.scrollHeight-n.clientHeight)==Math.ceil(n.scrollTop))},[]);return{assistant:t,lookupAttribute:e,history:S,setInput:w,contentElRef:E,scrolledToTop:ge,userContent:N,setUserContent:R,onSubmitMessage:z,supportsFeedback:!!l&&!!p,onSubmitRating:n=>{if(l){switch(n.ratingMode){case _.LIKE:U(n.messageId,()=>({rating:n.rating}));break;case _.SCALE:U(n.messageId,()=>({scaleRating:n.scaleRating,scaleMax:n.scaleMax}));break;default:throw new ce(n)}l(n)}},onSubmitFeedback:n=>{p&&(U(n.messageId,()=>({feedbackSubmitted:!0})),p(n))},onFlowSuggestionClick:r,InsideMessage:o,onContactClick:g,contactButtonText:i,reset:me,onContentScroll:pe,onContentWheel:be,conversationId:fe}}const Te=({assistant:t,lookupAttribute:e,history:a,setInput:c,contentElRef:h,scrolledToTop:f,userContent:m,setUserContent:l,onSubmitMessage:p,supportsFeedback:o,onSubmitRating:g,onSubmitFeedback:i,onFlowSuggestionClick:r,InsideMessage:d,onContactClick:w,contactButtonText:S,reset:M,onContentScroll:N,onContentWheel:R,conversationId:I})=>{const E=a.some(k=>k.completed||k.failed);return s.createElement("div",{className:"userflowjs-assistant-chat"},s.createElement("div",{className:H({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!f})}),s.createElement("div",{className:H({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!f})},s.createElement(s.Fragment,null,s.createElement("h2",{className:"userflowjs-assistant-chat__title"},t.title),s.createElement("button",{className:"userflowjs-bubble-button userflowjs-bubble-button--default",onClick:M},t.resetText))),s.createElement("div",{ref:h,className:"userflowjs-assistant-chat__content",onScroll:N,onWheel:R},!oe(t.intro)&&s.createElement("div",{className:"userflowjs-assistant-chat__intro"},s.createElement(le,{doc:t.intro,lookupAttribute:e})),a.map((k,F)=>s.createElement(De,{key:F,assistant:t,message:k,supportsFeedback:o,onSubmitRating:g,onSubmitFeedback:i,InsideMessage:d,conversationId:I,isLast:F===a.length-1,onFlowSuggestionClick:r}))),s.createElement("div",{className:"userflowjs-assistant-chat__prompt"},s.createElement(Ne,{textareaRef:c,placeholder:(a.length===0?t.promptEmptyPlaceholder:t.promptNonemptyPlaceholder)||"",value:m,onChange:l,onSubmit:()=>p(m)})),E&&w&&s.createElement("div",{className:"userflowjs-assistant-chat__contact"},s.createElement("button",{className:"userflowjs-tertiary-button",onClick:()=>w()},S)))},De=({assistant:t,message:e,supportsFeedback:a,onSubmitRating:c,onSubmitFeedback:h,onFlowSuggestionClick:f,InsideMessage:m,conversationId:l,isLast:p})=>{const o=!oe(e.assistantFallbackContent),g=e.flowSuggestions[0],[i,r]=u.useState(!1),d=async()=>{try{r(!0),await f({messageId:e.id,flowSuggestion:g})}finally{r(!1)}};return s.createElement("div",{className:"userflowjs-assistant-chat__message"},m&&s.createElement(m,{message:e}),s.createElement("div",{className:H({"userflowjs-assistant-chat__user-content":!0,"userflowjs-assistant-chat__user-content--enter":!!e.enterAnimation}),"data-assistant-conversation-id":l,"data-assistant-message-id":e.id},s.createElement("div",{style:{whiteSpace:"pre-wrap"}},e.userContent)),e.warning&&s.createElement("div",{className:"userflowjs-assistant-chat__error"},"Warning: ",e.warning),s.createElement("div",{className:"userflowjs-assistant-chat__assistant-content"},o&&s.createElement("div",null,s.createElement(le,{doc:e.assistantFallbackContent})),!o&&s.createElement("div",null,s.createElement(Ke,{html:e.assistantHtml})),e.error&&s.createElement("div",{className:"userflowjs-assistant-chat__error"},e.error)),e.id&&g&&s.createElement("button",{className:"userflowjs-bubble-button userflowjs-bubble-button--default userflowjs-assistant-chat__flow-suggestion",onClick:d},s.createElement("span",{className:"userflowjs-assistant-chat__flow-suggestion-content"},!i&&s.createElement(L,{icon:Se,size:20}),i&&s.createElement(Fe,null),s.createElement("span",{className:"userflowjs-assistant-chat__flow-suggestion-title"},g.name)),s.createElement(L,{icon:Ie})),e.sources&&e.sources.length>0&&s.createElement("div",{className:"userflowjs-assistant-chat__sources"},s.createElement("div",{className:"userflowjs-assistant-chat__sources-title"},t.sourcesText),e.sources.map((w,S)=>s.createElement("a",{key:S,className:"userflowjs-assistant-chat__source",href:Re(w.url),target:"_blank",rel:"noreferrer noopener"},w.title))),a&&e.completed&&e.id&&(t.ratingMode===_.LIKE||t.ratingMode===_.SCALE&&p)&&s.createElement(He,{assistant:t,message:e,onSubmitRating:c,onSubmitFeedback:h}))},He=({assistant:t,message:e,onSubmitRating:a,onSubmitFeedback:c})=>{const h=u.useRef(null),[f,m]=u.useState(""),l=i=>{const r=e.id;r&&(se.flushSync(()=>{a({ratingMode:_.LIKE,messageId:r,rating:i})}),h.current?.focus({preventScroll:!0}))},p=i=>{const r=e.id;r&&(se.flushSync(()=>{a({ratingMode:_.SCALE,messageId:r,scaleRating:i,scaleMax:t.scaleMax})}),h.current?.focus({preventScroll:!0}))},o=()=>{e.id&&(c({messageId:e.id,feedback:f.trim()}),m(""))},g=t.ratingMode===_.LIKE?s.createElement("button",{className:"userflowjs-assistant-chat__rating-option",disabled:!0},s.createElement(L,{icon:e.rating==D.DISLIKE?V:X})):e.scaleRating&&e.scaleMax&&s.createElement("button",{className:H({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--scale":!0}),disabled:!0},ue(t,e.scaleRating,e.scaleMax));return s.createElement("div",{className:`userflowjs-assistant-chat__rating userflowjs-assistant-chat__rating--${t.ratingMode}`},t.ratingMode===_.SCALE&&s.createElement("div",{className:"userflowjs-assistant-chat__rating-question"},t.scaleQuestion),e.feedbackSubmitted?s.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks"},g,s.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks-message"},t.feedbackThanksText)):(t.ratingMode===_.LIKE?e.rating:e.scaleRating)?s.createElement(ve,{textareaRef:h,className:"userflowjs-growing-textarea userflowjs-assistant-chat__feedback-textarea",mirrorClassName:"userflowjs-growing-textarea__mirror",textareaClassName:"userflowjs-textarea",placeholder:(t.ratingMode===_.LIKE?e.rating===D.LIKE?t.feedbackLikePlaceholder:t.feedbackDislikePlaceholder:t.scaleFeedbackPlaceholder)||"",value:f,onChange:m,onKeyDown:i=>{!i.shiftKey&&i.key==="Enter"&&(i.preventDefault(),o())}},g,s.createElement("button",{className:"userflowjs-assistant-chat__feedback-submit",onClick:()=>o()},s.createElement(L,{icon:Ce}))):s.createElement("div",{className:"userflowjs-assistant-chat__rating-options"},t.ratingMode===_.LIKE?[D.LIKE,D.DISLIKE].map(i=>(!e.rating||e.rating===i)&&s.createElement("button",{key:i,className:"userflowjs-assistant-chat__rating-option",onClick:e.rating?void 0:()=>l(i),disabled:!!e.rating,"data-testid":`assistant-chat-rating-${i}`},s.createElement(L,{icon:i==D.DISLIKE?V:X}))):Pe(t).map(({value:i,label:r})=>s.createElement("button",{key:i,className:H({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--large-scale":Le(r||"")}),onClick:e.scaleRating?void 0:()=>p(i),disabled:!!e.scaleRating,"data-testid":`assistant-chat-rating-${i}`},r))))};function O(t){let e=t;const a=f=>(f=f.replace(/\s*[*_`]*$/,""),f=f.replace(/(^|\n)\s*(\d+\.?|-|=)$/,""),f);e=a(e),e=e.replace(/\[([^\]\n]*)(\](\([^)\n]*)?)?$/,"$1"),e=a(e);const c=Array.from(e.matchAll(/\n( *)```/g));if(c.length%2===1){const f=c[c.length-1][1];e+=`
2
- `+f+"```"}else{let f=0;for(let o=e.length-1;o>=0;o--)if(e[o]===`
1
+ import{r as f,R as s}from"./vendor.react.js";import{af as Se,ag as _,ah as T,C as q,N as Q}from"./userflow.js";import{u as Ie}from"./client-context.js";import{a2 as Ce,b as je,a5 as V,a6 as X,a7 as Me,a8 as W,a9 as B,aa as Z,ab as ee,ac as te}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{p as Ne}from"./vendor.dompurify.js";import{m as Re}from"./vendor.marked.js";import{o as H}from"./vendor.obj-str.js";import{A as ve,d as Fe,G as Ae}from"./ResourceCenterApp.js";import{r as le,R as ce,s as xe,n as ye}from"./TreeDoc.js";import{D as F}from"./stylesheets.js";import{U as ie}from"./roots.js";import{r as se}from"./vendor.react-dom.js";import{S as Le}from"./use-client-query.js";import"./vendor.core-js.js";import{g as ne}from"./flow-condition-types.js";import{u as De}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./flow-host.styl.js";import"./use-selector-element-monitoring.js";import"./Frame.js";import"./iframe-reset.styl.js";import"./use-window-resize.js";import"./logomark.js";import"./ChecklistUI.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./FlowChrome.js";import"./vendor.canvas-confetti.js";import"./vendor.memoize-one.js";import"./vendor.bignumber.js.js";import"./use-element-rect.js";import"./vendor.scheduler.js";import"./vendor.date-fns.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8447e274-8593-4e63-9f61-a9707facbbd6",t._sentryDebugIdIdentifier="sentry-dbid-8447e274-8593-4e63-9f61-a9707facbbd6")}catch{}})();function Te(t){const e=Intl.Segmenter;return e?/(\p{Emoji_Presentation}|\p{Extended_Pictographic})(\p{Emoji_Modifier_Base}?\p{Emoji_Modifier}?|\uFE0F\u200D(\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?\uFE0F\u200D)*\p{Emoji_Presentation}|\uFE0F\u200D\p{Extended_Pictographic})/u.test(t)&&[...new e().segment(t)].length===1:!1}const ae=[];function He({assistant:t,lookupAttribute:e,initialConversationId:a,initialHistory:c,initialUserContent:h,onConversationIdChange:d,submitMessage:g,submitRating:l,submitFeedback:p,InsideMessage:o,onContactClick:m,contactButtonText:i,onFlowSuggestionClick:r}){const[u,w]=f.useState(null),[S,M]=f.useState(()=>c?c.map(n=>({...n,assistantHtml:y(O(n.assistantContent),!1)})):ae),[N,R]=f.useState(""),I=f.useRef(null),E=f.useRef(null),k=f.useRef(!0),A=f.useRef(a||null),[de,me]=f.useState(A.current),K=f.useCallback(n=>{A.current=n,me(n),d&&d(n)},[d]),P=f.useCallback(()=>{u?.focus({preventScroll:!0})},[u]);f.useEffect(()=>{P()},[P]),f.useLayoutEffect(()=>{const n=E.current;n&&(n.scrollTop=Math.ceil(n.scrollHeight-n.clientHeight))},[]);const $=f.useCallback(()=>{const n=E.current;n&&(k.current=!0,typeof n.scrollTo=="function"&&n.scrollTo({top:Math.ceil(n.scrollHeight-n.clientHeight),behavior:"smooth"}))},[]),G=f.useRef(0);f.useLayoutEffect(()=>{const n=E.current;n&&n.scrollHeight!==G.current&&(G.current=n.scrollHeight,k.current&&$())},[S,$]);const x=f.useCallback(()=>{I.current&&I.current()},[]);f.useEffect(()=>()=>{x()},[x]);const U=(n,v)=>{M(C=>C.map(j=>{if(n===j.id){const b=v(j);return{...j,...b}}else return j}))},L=n=>{M(v=>v.map((C,j)=>{if(j===v.length-1){const b=n(C);return{...C,...b}}else return C}))},z=f.useCallback(async n=>{if(n=n.trim(),n==="")return;x(),M(b=>[...b,{id:null,userContent:n,assistantContent:"",assistantFallbackContent:null,assistantHtml:y("","enter"),enterAnimation:!0,sources:[],flowSuggestions:[],completed:!1,rating:null,scaleRating:null,scaleMax:null,feedbackSubmitted:!1}]),R(""),$();let v=!1;const C=()=>{v=!0,I.current=null},j=g({conversationId:A.current,userContent:n,callback:b=>{if(v){console.log("Userflow.js AssistantChat got message after being done",b);return}switch(b.kind){case"conversation_created":K(b.conversationId);break;case"message_created":L(()=>({id:b.messageId,warning:b.warning}));break;case"assistant_content_delta":L(D=>{const _e=b.delta,Y=D.assistantContent+_e,we=O(Y),ke=y(we);return{assistantContent:Y,assistantHtml:ke}});break;case"done":C(),L(D=>({assistantHtml:y(D.assistantContent,"exit"),assistantFallbackContent:b.fallbackContent,flowSuggestions:b.flowSuggestions,completed:!0,sources:b.sources}));break;case"error":C(),L(D=>({failed:!0,error:b.message,assistantHtml:y(O(D.assistantContent),!1)}));break;default:console.log("Userflow.js AssistantChat got unknown message",b)}}});I.current=()=>{C(),j.abort(),L(b=>({assistantHtml:y(O(b.assistantContent),!1)}))}},[x,$,g,K]),J=f.useRef(!1);f.useEffect(()=>{J.current||(J.current=!0,h&&z(h))},[z,h]);const ge=f.useCallback(()=>{x(),K(null),M(ae),P()},[x,P,K]),[he,pe]=f.useState(!0),be=f.useCallback(()=>{const n=E.current;n&&pe(n.scrollTop===0)},[]),Ee=f.useCallback(()=>{const n=E.current;n&&(k.current=Math.ceil(n.scrollHeight-n.clientHeight)==Math.ceil(n.scrollTop))},[]);return{assistant:t,lookupAttribute:e,history:S,setInput:w,contentElRef:E,scrolledToTop:he,userContent:N,setUserContent:R,onSubmitMessage:z,supportsFeedback:!!l&&!!p,onSubmitRating:n=>{if(l){switch(n.ratingMode){case _.LIKE:U(n.messageId,()=>({rating:n.rating}));break;case _.SCALE:U(n.messageId,()=>({scaleRating:n.scaleRating,scaleMax:n.scaleMax}));break;default:throw new ie(n)}l(n)}},onSubmitFeedback:n=>{p&&(U(n.messageId,()=>({feedbackSubmitted:!0})),p(n))},onFlowSuggestionClick:r,InsideMessage:o,onContactClick:m,contactButtonText:i,reset:ge,onContentScroll:be,onContentWheel:Ee,conversationId:de}}const Ke=({assistant:t,lookupAttribute:e,history:a,setInput:c,contentElRef:h,scrolledToTop:d,userContent:g,setUserContent:l,onSubmitMessage:p,supportsFeedback:o,onSubmitRating:m,onSubmitFeedback:i,onFlowSuggestionClick:r,InsideMessage:u,onContactClick:w,contactButtonText:S,reset:M,onContentScroll:N,onContentWheel:R,conversationId:I})=>{const E=a.some(k=>k.completed||k.failed);return s.createElement("div",{className:"userflowjs-assistant-chat"},s.createElement("div",{className:H({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!d})}),s.createElement("div",{className:H({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!d})},s.createElement(s.Fragment,null,s.createElement("h2",{className:"userflowjs-assistant-chat__title"},t.title),s.createElement("button",{className:"userflowjs-bubble-button userflowjs-bubble-button--default",onClick:M},t.resetText))),s.createElement("div",{ref:h,className:"userflowjs-assistant-chat__content",onScroll:N,onWheel:R},!le(t.intro)&&s.createElement("div",{className:"userflowjs-assistant-chat__intro"},s.createElement(ce,{doc:t.intro,lookupAttribute:e})),a.map((k,A)=>s.createElement(Pe,{key:A,assistant:t,message:k,supportsFeedback:o,onSubmitRating:m,onSubmitFeedback:i,InsideMessage:u,conversationId:I,isLast:A===a.length-1,onFlowSuggestionClick:r}))),s.createElement("div",{className:"userflowjs-assistant-chat__prompt"},s.createElement(ve,{textareaRef:c,placeholder:(a.length===0?t.promptEmptyPlaceholder:t.promptNonemptyPlaceholder)||"",value:g,onChange:l,onSubmit:()=>p(g)})),E&&w&&s.createElement("div",{className:"userflowjs-assistant-chat__contact"},s.createElement("button",{className:"userflowjs-tertiary-button",onClick:()=>w()},S)))},Pe=({assistant:t,message:e,supportsFeedback:a,onSubmitRating:c,onSubmitFeedback:h,onFlowSuggestionClick:d,InsideMessage:g,conversationId:l,isLast:p})=>{const o=!le(e.assistantFallbackContent),m=e.flowSuggestions[0],[i,r]=f.useState(!1),u=async()=>{try{r(!0),await d({messageId:e.id,flowSuggestion:m})}finally{r(!1)}};return s.createElement("div",{className:"userflowjs-assistant-chat__message"},g&&s.createElement(g,{message:e}),s.createElement("div",{className:H({"userflowjs-assistant-chat__user-content":!0,"userflowjs-assistant-chat__user-content--enter":!!e.enterAnimation}),"data-assistant-conversation-id":l,"data-assistant-message-id":e.id},s.createElement("div",{style:{whiteSpace:"pre-wrap"}},e.userContent)),e.warning&&s.createElement("div",{className:"userflowjs-assistant-chat__error"},"Warning: ",e.warning),s.createElement("div",{className:"userflowjs-assistant-chat__assistant-content"},o&&s.createElement("div",null,s.createElement(ce,{doc:e.assistantFallbackContent})),!o&&s.createElement("div",null,s.createElement(We,{html:e.assistantHtml})),e.error&&s.createElement("div",{className:"userflowjs-assistant-chat__error"},e.error)),e.id&&m&&s.createElement("button",{className:"userflowjs-bubble-button userflowjs-bubble-button--default userflowjs-assistant-chat__flow-suggestion",onClick:u},s.createElement("span",{className:"userflowjs-assistant-chat__flow-suggestion-content"},!i&&m.iconSetting!==Se.HIDE&&(m.icon?s.createElement(F,{icon:m.icon,size:20}):s.createElement(F,{icon:Ce,size:20})),i&&s.createElement(Le,null),s.createElement("span",{className:"userflowjs-assistant-chat__flow-suggestion-title"},m.name)),s.createElement(F,{icon:je})),e.sources&&e.sources.length>0&&s.createElement("div",{className:"userflowjs-assistant-chat__sources"},s.createElement("div",{className:"userflowjs-assistant-chat__sources-title"},t.sourcesText),e.sources.map((w,S)=>s.createElement("a",{key:S,className:"userflowjs-assistant-chat__source",href:Fe(w.url),target:"_blank",rel:"noreferrer noopener"},w.title))),a&&e.completed&&e.id&&(t.ratingMode===_.LIKE||t.ratingMode===_.SCALE&&p)&&s.createElement($e,{assistant:t,message:e,onSubmitRating:c,onSubmitFeedback:h}))},$e=({assistant:t,message:e,onSubmitRating:a,onSubmitFeedback:c})=>{const h=f.useRef(null),[d,g]=f.useState(""),l=i=>{const r=e.id;r&&(se.flushSync(()=>{a({ratingMode:_.LIKE,messageId:r,rating:i})}),h.current?.focus({preventScroll:!0}))},p=i=>{const r=e.id;r&&(se.flushSync(()=>{a({ratingMode:_.SCALE,messageId:r,scaleRating:i,scaleMax:t.scaleMax})}),h.current?.focus({preventScroll:!0}))},o=()=>{e.id&&(c({messageId:e.id,feedback:d.trim()}),g(""))},m=t.ratingMode===_.LIKE?s.createElement("button",{className:"userflowjs-assistant-chat__rating-option",disabled:!0},s.createElement(F,{icon:e.rating==T.DISLIKE?V:X})):e.scaleRating&&e.scaleMax&&s.createElement("button",{className:H({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--scale":!0}),disabled:!0},fe(t,e.scaleRating,e.scaleMax));return s.createElement("div",{className:`userflowjs-assistant-chat__rating userflowjs-assistant-chat__rating--${t.ratingMode}`},t.ratingMode===_.SCALE&&s.createElement("div",{className:"userflowjs-assistant-chat__rating-question"},t.scaleQuestion),e.feedbackSubmitted?s.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks"},m,s.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks-message"},t.feedbackThanksText)):(t.ratingMode===_.LIKE?e.rating:e.scaleRating)?s.createElement(Ae,{textareaRef:h,className:"userflowjs-growing-textarea userflowjs-assistant-chat__feedback-textarea",mirrorClassName:"userflowjs-growing-textarea__mirror",textareaClassName:"userflowjs-textarea",placeholder:(t.ratingMode===_.LIKE?e.rating===T.LIKE?t.feedbackLikePlaceholder:t.feedbackDislikePlaceholder:t.scaleFeedbackPlaceholder)||"",value:d,onChange:g,onKeyDown:i=>{!i.shiftKey&&i.key==="Enter"&&(i.preventDefault(),o())}},m,s.createElement("button",{className:"userflowjs-assistant-chat__feedback-submit",onClick:()=>o()},s.createElement(F,{icon:Me}))):s.createElement("div",{className:"userflowjs-assistant-chat__rating-options"},t.ratingMode===_.LIKE?[T.LIKE,T.DISLIKE].map(i=>(!e.rating||e.rating===i)&&s.createElement("button",{key:i,className:"userflowjs-assistant-chat__rating-option",onClick:e.rating?void 0:()=>l(i),disabled:!!e.rating,"data-testid":`assistant-chat-rating-${i}`},s.createElement(F,{icon:i==T.DISLIKE?V:X}))):Be(t).map(({value:i,label:r})=>s.createElement("button",{key:i,className:H({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--large-scale":Te(r||"")}),onClick:e.scaleRating?void 0:()=>p(i),disabled:!!e.scaleRating,"data-testid":`assistant-chat-rating-${i}`},r))))};function O(t){let e=t;const a=d=>(d=d.replace(/\s*[*_`]*$/,""),d=d.replace(/(^|\n)\s*(\d+\.?|-|=)$/,""),d);e=a(e),e=e.replace(/\[([^\]\n]*)(\](\([^)\n]*)?)?$/,"$1"),e=a(e);const c=Array.from(e.matchAll(/\n( *)```/g));if(c.length%2===1){const d=c[c.length-1][1];e+=`
2
+ `+d+"```"}else{let d=0;for(let o=e.length-1;o>=0;o--)if(e[o]===`
3
3
  `&&e[o-1]===`
4
- `){f=o;break}const m=[];let l=!1;const p=o=>o==null||o.match(/\W/);for(let o=f;o<e.length;o++){const g=e[o],i=g+e[o+1],r=i+e[o+2];let d=null;!l&&r==="***"||!l&&r==="___"&&(p(e[o-1])||p(e[o+3]))?d=r:!l&&i==="**"||!l&&i==="__"&&(p(e[o-1])||p(e[o+2]))?d=i:(!l&&g==="*"||!l&&g==="_"&&(p(e[o-1])||p(e[o+1]))||g==="`")&&(d=g),d!=null&&(e.slice(f,o+d.length).match(/\[[^\]\n]*\]\([^)\n]*$/)||(m[m.length-1]===d?(d==="`"&&(l=!1),m.pop()):(d==="`"&&(l=!0),m.push(d))),o+=d.length-1)}e+=m.reverse().join("")}return e}function x(t,e){t=t.trim(),e!==!1&&(t=t.replace(/(\n *```)?$/," {{USERFLOWCHATBRAIN}}$1"));let a=je.sanitize(Me.parse(t));if(e!==!1){let c="userflowjs-assistant-brain";e&&(c+=` userflowjs-assistant-brain--${e}`),a=a.replace("{{USERFLOWCHATBRAIN}}",`<span class="${c}"><span></span><span></span><span></span><span></span></span>`)}return a=a.replace(/<a href=/g,'<a target="_blank" rel="noopener noreferrer" href='),a}const Ke=({html:t})=>u.useMemo(()=>{if(!t)return null;const a=new DOMParser().parseFromString(t,"text/html");return ie(a.body)},[t]);function ie(t,e){if(t instanceof Element){if(t.tagName==="BODY")return s.createElement(s.Fragment,{key:e},ae(t));{if(["script","style"].includes(t.tagName))return null;const a={key:e};for(const c of t.attributes){let h=c.name;h.startsWith("on")||(h==="class"&&(h="className"),a[h]=c.value)}return s.createElement(t.tagName.toLowerCase(),a,ae(t))}}else return t instanceof Text?t.textContent:null}function ae(t){const e=[];let a=0;for(const c of t.childNodes)e.push(ie(c,a)),a++;return e}function Pe(t){let e=[];const a=t.scaleMax||5;for(let c=1;c<=a;c++)e.push({value:c,label:ue(t,c,a)});return e}function ue(t,e,a){if(t.scaleLabels)return t.scaleLabels[e-1]||e;{const c=re[a]&&re[a][e];return c?s.createElement(L,{icon:c,size:24}):e}}const re={2:{1:W,2:B},3:{1:W,2:Z,3:B},4:{1:ee,2:W,3:B,4:te},5:{1:ee,2:W,3:Z,4:B,5:te}},Ct=({block:t,session:e,assistantReply:a,initialUserContent:c,onContactClick:h,contactButtonText:f})=>{const m=t.assistantFlowId,l=ke(),{t:p}=xe(),o=p("assistant.generic_error"),g=p("assistant.disconnected_error"),i=ye(u.useMemo(()=>({assistant:a.assistant,lookupAttribute:Ae(e.data),initialConversationId:a.conversationId,initialHistory:a.history,initialUserContent:c,onConversationIdChange:r=>{const d="assistantConversationId:"+m;r?q.setItem(d,r):q.removeItem(d)},submitMessage:({conversationId:r,userContent:d,callback:w})=>{l.assistantMessageInProgress=!0;const S=l.nextRef();l.send({kind:"SubmitAssistantMessage",ref:S,assistantFlowId:m,conversationId:r,userContent:d},{handlesRejection:!0}).catch(E=>{w({kind:"error",message:E.humanMessage||o})});const N=()=>{l.assistantMessageInProgress=void 0,l.off("private:assistantMessageEvent",R),l.off("private:disconnect",I)},R=E=>{if(E.ref!==S)return;const{event:k}=E;w(k),(k.kind=="done"||k.kind=="error")&&N()},I=()=>{w({kind:"error",message:g}),N()};return l.on("private:assistantMessageEvent",R),l.on("private:disconnect",I),{abort:()=>{l.send({kind:"AbortAssistantMessage"}),N()}}},submitRating:r=>{switch(r.ratingMode){case _.LIKE:l.send({kind:"SubmitAssistantRating",messageId:r.messageId,rating:r.rating});break;case _.SCALE:l.send({kind:"SubmitAssistantScaleRating",messageId:r.messageId,scaleRating:r.scaleRating,scaleMax:r.scaleMax});break;default:throw new ce(r)}},submitFeedback:r=>{l.send({kind:"SubmitAssistantFeedback",messageId:r.messageId,feedback:r.feedback})},onContactClick:h,contactButtonText:f,onFlowSuggestionClick:async r=>{await l.send({kind:"ClickAssistantFlowSuggestion",messageId:r.messageId,flowSuggestionId:r.flowSuggestion.id}),await l.startFlow({flowId:r.flowSuggestion.flowId,startReason:e.draftMode?Q.DRAFT:Q.ASSISTANT,replaceCurrent:!0})}}),[a,m,l,c,e.data,h,f,o,g,e.draftMode]));return s.createElement(s.Fragment,null,s.createElement(Te,{...i}))};export{Ct as ResourceCenterAssistantChat};
4
+ `){d=o;break}const g=[];let l=!1;const p=o=>o==null||o.match(/\W/);for(let o=d;o<e.length;o++){const m=e[o],i=m+e[o+1],r=i+e[o+2];let u=null;!l&&r==="***"||!l&&r==="___"&&(p(e[o-1])||p(e[o+3]))?u=r:!l&&i==="**"||!l&&i==="__"&&(p(e[o-1])||p(e[o+2]))?u=i:(!l&&m==="*"||!l&&m==="_"&&(p(e[o-1])||p(e[o+1]))||m==="`")&&(u=m),u!=null&&(e.slice(d,o+u.length).match(/\[[^\]\n]*\]\([^)\n]*$/)||(g[g.length-1]===u?(u==="`"&&(l=!1),g.pop()):(u==="`"&&(l=!0),g.push(u))),o+=u.length-1)}e+=g.reverse().join("")}return e}function y(t,e){t=t.trim(),e!==!1&&(t=t.replace(/(\n *```)?$/," {{USERFLOWCHATBRAIN}}$1"));let a=Ne.sanitize(Re.parse(t));if(e!==!1){let c="userflowjs-assistant-brain";e&&(c+=` userflowjs-assistant-brain--${e}`),a=a.replace("{{USERFLOWCHATBRAIN}}",`<span class="${c}"><span></span><span></span><span></span><span></span></span>`)}return a=a.replace(/<a href=/g,'<a target="_blank" rel="noopener noreferrer" href='),a}const We=({html:t})=>f.useMemo(()=>{if(!t)return null;const a=new DOMParser().parseFromString(t,"text/html");return ue(a.body)},[t]);function ue(t,e){if(t instanceof Element){if(t.tagName==="BODY")return s.createElement(s.Fragment,{key:e},re(t));{if(["script","style"].includes(t.tagName))return null;const a={key:e};for(const c of t.attributes){let h=c.name;h.startsWith("on")||(h==="class"&&(h="className"),a[h]=c.value)}return s.createElement(t.tagName.toLowerCase(),a,re(t))}}else return t instanceof Text?t.textContent:null}function re(t){const e=[];let a=0;for(const c of t.childNodes)e.push(ue(c,a)),a++;return e}function Be(t){let e=[];const a=t.scaleMax||5;for(let c=1;c<=a;c++)e.push({value:c,label:fe(t,c,a)});return e}function fe(t,e,a){if(t.scaleLabels)return t.scaleLabels[e-1]||e;{const c=oe[a]&&oe[a][e];return c?s.createElement(F,{icon:c,size:24}):e}}const oe={2:{1:W,2:B},3:{1:W,2:Z,3:B},4:{1:ee,2:W,3:B,4:te},5:{1:ee,2:W,3:Z,4:B,5:te}},Nt=({block:t,session:e,assistantReply:a,initialUserContent:c,onContactClick:h,contactButtonText:d})=>{const g=t.assistantFlowId,l=Ie(),{t:p}=De(),o=p("assistant.generic_error"),m=p("assistant.disconnected_error"),i=He(f.useMemo(()=>({assistant:a.assistant,lookupAttribute:ne(e.data),initialConversationId:a.conversationId,initialHistory:a.history,initialUserContent:c,onConversationIdChange:r=>{const u="assistantConversationId:"+g;r?q.setItem(u,r):q.removeItem(u)},submitMessage:({conversationId:r,userContent:u,callback:w})=>{l.assistantMessageInProgress=!0;const S=l.nextRef();l.send({kind:"SubmitAssistantMessage",ref:S,assistantFlowId:g,conversationId:r,userContent:u},{handlesRejection:!0}).catch(E=>{w({kind:"error",message:E.humanMessage||o})});const N=()=>{l.assistantMessageInProgress=void 0,l.off("private:assistantMessageEvent",R),l.off("private:disconnect",I)},R=E=>{if(E.ref!==S)return;const{event:k}=E;w(k),(k.kind=="done"||k.kind=="error")&&N()},I=()=>{w({kind:"error",message:m}),N()};return l.on("private:assistantMessageEvent",R),l.on("private:disconnect",I),{abort:()=>{l.send({kind:"AbortAssistantMessage"}),N()}}},submitRating:r=>{switch(r.ratingMode){case _.LIKE:l.send({kind:"SubmitAssistantRating",messageId:r.messageId,rating:r.rating});break;case _.SCALE:l.send({kind:"SubmitAssistantScaleRating",messageId:r.messageId,scaleRating:r.scaleRating,scaleMax:r.scaleMax});break;default:throw new ie(r)}},submitFeedback:r=>{l.send({kind:"SubmitAssistantFeedback",messageId:r.messageId,feedback:r.feedback})},onContactClick:h,contactButtonText:d,onFlowSuggestionClick:async r=>{await l.send({kind:"ClickAssistantFlowSuggestion",messageId:r.messageId,flowSuggestionId:r.flowSuggestion.id}),await l.startFlow({flowId:r.flowSuggestion.flowId,startReason:e.draftMode?Q.DRAFT:Q.ASSISTANT,replaceCurrent:!0});const u=xe(r.flowSuggestion.url,{lookupAttribute:ne(e.data)});u&&ye(u)}}),[a,g,l,c,e.data,h,d,o,m,e.draftMode]));return s.createElement(s.Fragment,null,s.createElement(Ke,{...i}))};export{Nt as ResourceCenterAssistantChat};
5
5
  //# sourceMappingURL=ResourceCenterAssistantChat.js.map
package/SitePage.js CHANGED
@@ -1,2 +1,2 @@
1
- import{R as t,r as d}from"./vendor.react.js";import{U,u as H,i as C}from"./client-context.js";import{r as K}from"./vendor.react-dom.js";import{B as W,L as b}from"./vendor.react-router-dom.js";import{S as I,u as M}from"./use-client-query.js";import{D as w,u as v,a as j,g as O}from"./stylesheets.js";import{i as Y}from"./iframe-reset.styl.js";import{S as z,u as h,R}from"./TreeDoc.js";import{g as _}from"./flow-condition-types.js";import{f as q,a as G,b as Q,c as J}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{o as A}from"./vendor.obj-str.js";import{d as X}from"./userflow.js";import{P as Z}from"./Popover.js";import{m as ee}from"./vendor.memoize-one.js";import"./vendor.core-js.js";import{u as te}from"./react-hooks.js";import{S as ne,a as x,u as S,b as N,d as se,e as T}from"./vendor.react-router.js";import{u as oe}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.scheduler.js";import"./vendor.history.js";import"./vendor.resolve-pathname.js";import"./vendor.value-equal.js";import"./vendor.tiny-invariant.js";import"./vendor.prop-types.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./vendor.date-fns.js";import"./roots.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.lodash.js";import"./vendor.mini-create-react-context.js";import"./vendor.path-to-regexp.js";import"./vendor.react-is.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="7015e2e7-def6-4ab0-92f5-fcd58b3dc8d5",n._sentryDebugIdIdentifier="sentry-dbid-7015e2e7-def6-4ab0-92f5-fcd58b3dc8d5")}catch{}})();const re=new URL("popover.css",import.meta.url).href,ie=new URL("site.css",import.meta.url).href;class $ extends t.PureComponent{constructor(){super(...arguments),this.rootRef=t.createRef(),this.isScrollingIntoView=!1,this.state={highlightedIdx:this.props.disableAutoHighlight?-1:0},this.onKeyDown=e=>{const{highlightedIdx:s}=this.state,{items:r}=this.props,o=()=>{e.stopPropagation(),e.preventDefault()};switch(e.key){case"ArrowUp":o(),s>0?this.setHighlighted(s-1):s===-1&&this.setHighlighted(r.length-1);break;case"ArrowDown":o(),s<r.length-1?this.setHighlighted(s+1):s===-1&&this.setHighlighted(0);break;case"Enter":o(),this.selectItem(r[s]);break}},this.selectItem=e=>{this.props.onSelect(e)},this.onItemHover=e=>{this.isScrollingIntoView||(this.setState({highlightedIdx:e}),this.props.onItemHighlighted?.(this.props.items[e]))},this.onMouseLeave=()=>{const{clearHoverOnMouseLeave:e,selectedItem:s,items:r}=this.props;if(e)if(s){const o=r.findIndex(i=>i===s);this.setState({highlightedIdx:o})}else this.setState({highlightedIdx:-1})},this.memoizedStyle=ee(e=>e==null?{}:{maxHeight:e,overflowY:"auto"})}componentDidMount(){this.props.autoFocus&&this.rootRef.current.focus({preventScroll:!0}),this.props.forwardedRef&&this.rootRef.current&&(typeof this.props.forwardedRef=="function"?this.props.forwardedRef(this.rootRef.current):this.props.forwardedRef.current=this.rootRef.current)}render(){const e=this.state,{selectedItem:s,clearHoverOnMouseLeave:r}=this.props;return t.createElement("div",{ref:this.rootRef,className:"key-nav-list",style:this.memoizedStyle(this.props.maxHeight),onKeyDown:this.onKeyDown,onMouseLeave:r?this.onMouseLeave:void 0,tabIndex:0},this.props.items.map((o,i)=>t.createElement(le,{key:i,item:o,idx:i,className:A({"key-nav-list__item":!0,"key-nav-list__item--highlighted":i===e.highlightedIdx,"key-nav-list__item--selected":o===s}),renderContent:this.props.children,onClick:this.selectItem,onHover:this.onItemHover})))}scrollHighlightedItemIntoView(){const e=this.rootRef.current,s=e.querySelector(".key-nav-list__item--highlighted");if(s){this.isScrollingIntoView=!0,window.clearTimeout(this.isScrollingIntoViewTimeout),this.isScrollingIntoViewTimeout=window.setTimeout(()=>this.isScrollingIntoView=!1,250);const r=e.getBoundingClientRect(),o=s.getBoundingClientRect();o.top<r.top?e.scrollTop+=o.top-r.top:o.bottom>r.bottom&&(e.scrollTop+=o.bottom-r.bottom)}}setHighlighted(e){this.setState({highlightedIdx:e},this.scrollHighlightedItemIntoView),this.props.onItemHighlighted?.(this.props.items[e])}}class le extends t.PureComponent{constructor(){super(...arguments),this.onClick=()=>this.props.onClick(this.props.item),this.onHover=()=>this.props.onHover(this.props.idx)}render(){const{props:e}=this;return t.createElement("div",{className:e.className,onClick:this.onClick,onMouseMove:this.onHover},e.renderContent(e.item,e.idx))}}t.forwardRef((n,e)=>t.createElement($,{...n,forwardedRef:e}));function ae({testid:n,buttonText:e,value:s,onChange:r,options:o,renderOption:i,disabled:a,buttonStyle:m,htmlAttributes:l,comparator:c}){const f=d.useRef(null),[g,E]=d.useState(!1),y=()=>{E(!1),f.current&&f.current.focus()},F=({key:u})=>{if(u.length===1){u=u.toLowerCase();for(const k of o){const L=i(k);if(typeof L=="string"&&L.toLowerCase().startsWith(u)){r(k);return}}}};return t.createElement(t.Fragment,null,t.createElement("button",{ref:f,"data-testid":n,type:"button",className:`btn btn-dynamic-icon ${m||"btn--plain-blue"} btn--sm ${g&&!a?"btn--popover-open":""}`,onClick:()=>E(!g),disabled:a,onKeyDown:F,...l},e||i(s),t.createElement(w,{icon:q})),g&&!a&&f.current&&t.createElement(Z,{target:f.current,matchMinWidth:!0,onDismiss:y},t.createElement($,{items:o,onSelect:u=>{y(),r(u)},autoFocus:!0},u=>t.createElement("div",{className:"d-flex"},t.createElement("div",{className:"mr-8",style:(c?c(u,s):u===s)?void 0:{visibility:"hidden"}},t.createElement(w,{icon:G})),i(u)))))}function ce(n){const e=n?new Date(n):new Date;let s=new Intl.DateTimeFormat(void 0,{weekday:"long",day:"numeric",month:"short",year:e.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(e);return s.substring(0,1).toUpperCase()+s.substring(1)}class Xe{constructor(e,s){this.client=e,this.selector=s}mount(){if(this.container)throw new Error("SiteRoute has already been mounted");const e=document.querySelector(this.selector);if(!e)throw new Error(`SitePage: No element found for selector ${this.selector}`);this.container=e,K.render(t.createElement(W,null,t.createElement(U.Provider,{value:this.client},t.createElement(me,null))),this.container)}}const me=()=>{const n=H();v(window,Y),v(window,re);const{loaded:e}=v(window,ie),[s,r]=d.useState(null),o=s?.locale.standardLocaleId||s?.version.theme.languageId;return d.useEffect(()=>{o&&C.changeLanguage(o)},[o]),d.useEffect(()=>{const i=a=>{X("Received site session",a),n.featureFlagEnabled("cff_site")!==!1&&r(a)};return n.on("private:siteSession",i),()=>{n.off("private:siteSession",i)}},[n]),!s||!e?null:t.createElement(z.Provider,{value:s},t.createElement(ne,null,t.createElement(x,{exact:!0,path:"/:locale/:announcementId"},t.createElement(D,null,t.createElement(de,{key:s.locale.standardLocaleId}))),t.createElement(x,{path:"/:locale"},t.createElement(D,null,t.createElement(ue,{key:s.locale.standardLocaleId})))))},D=({children:n})=>{const e=h(),s=j(e.version.theme),r=e.version.theme.siteLogoAsset?.assetUrl,o=e.version.site,i=p();if(!o)return null;const{headerText:a,headerDescription:m,logoUrl:l}=o;return t.createElement("div",{style:O(s),className:"userflow-site__announcements"},i?t.createElement("div",{className:"text-bolder userflow-site-preview-banner"},"PREVIEW"):null,t.createElement(he,{headerText:a,headerDescription:m,companyLogoSrc:r,logoUrl:l,localeDropdown:t.createElement(fe,null)}),n)},ue=()=>{const{t:n}=oe(),e=h(),{data:s,loading:r,loadingMore:o,error:i}=pe();return i?t.createElement("div",{className:"userflow-site__announcement-content"},"Failed in loading announcements"):r?t.createElement("div",{className:"userflow-site__announcement-content"},t.createElement(I,{center:!0,fadeIn:!0})):t.createElement("div",{className:"userflow-site__announcement-content"},s?.announcements&&s?.announcements.length>0?t.createElement("div",{className:"userflow-site__announcement-list"},s.announcements.map(a=>t.createElement(P,{expanded:!1,key:a.id,announcement:a,enableTitleLinks:e.version.site?.enableTitleLinks})),o?t.createElement(I,{center:!0,fadeIn:!0}):null):null,s?.announcements&&s?.announcements.length===0?t.createElement("div",{className:"userflow-site-empty-state"},C.exists("resource_center.no_announcements",{fallbackLng:[]})?n("resource_center.no_announcements"):n("resource_center.no_results_found")):null)},P=({announcement:n,expanded:e=!1,enableTitleLinks:s})=>{const r=V(),o=H(),i=p(),a=d.useRef(null),m=s&&!!r,l=te(a,{once:!0,rootMargin:"100px",disabled:n.seen===!0||i}),c=B(`/${r}/${i?n.id:n.permalink}`);return d.useEffect(()=>{l&&n.seen===!1&&o.send({kind:"MarkAnnouncementSeen",announcementId:n.id,versionId:n.versionId},{batch:!0})},[l,n,o]),t.createElement("div",{ref:a,className:"userflow-site__card"},t.createElement("div",null,t.createElement("span",{className:"text-small text-secondary"},ce(n.time)),t.createElement("div",null,m?t.createElement(b,{to:c,className:"h2-like text-extra-bold"},n.title):t.createElement("h2",{className:"h2-like text-extra-bold"},n.title))),t.createElement(R,{doc:n.content,buttons:n.buttons,lookupAttribute:_(n.data)}),n.moreEnabled&&!e?t.createElement("div",{className:"userflow-site-button-wrapper"},t.createElement(b,{to:c,className:A({"userflow-site-link-button":!0,"userflow-site-link-button--primary":!0,"userflowjs-bubble-button userflowjs-bubble-button--primary":!0})},n.moreButtonText||"Read more",t.createElement(w,{icon:Q}))):null,n.moreEnabled&&e?t.createElement(R,{doc:n.moreContent,buttons:n.moreButtons,lookupAttribute:_(n.data)}):null)},de=()=>{const n=h(),{announcementId:e}=S(),s=p(),r=V(),o=B(r),{loading:i,data:a,error:m}=M({message:{kind:"GetAnnouncement",announcementId:e,permalink:!s},skip:!e});return m?t.createElement(N,{to:`/${o}`}):!i&&!a?.announcement?t.createElement(N,{to:`/${o}`}):t.createElement("div",{className:"userflow-site__announcement-content"},i?t.createElement(I,{center:!0,fadeIn:!0}):null,!i&&a?.announcement&&t.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},t.createElement(b,{to:`/${o}`,className:"userflow-site-link-button"},t.createElement(w,{icon:J}),n.version.site?.homeButtonText||"All Announcements"),t.createElement(P,{expanded:!0,announcement:a.announcement})))},fe=()=>{const n=se(),e=h(),s=p(),r=T(),{announcementId:o}=S();if(e?.kind!=="site"||s)return null;const i=e.locales.find(l=>l.code===e.locale.standardLocaleId);if(e.locales.length===1&&e.locales[0].code===e.locale.standardLocaleId||e.locales.length===0||!i)return null;const m=l=>{const c=o?`/${l.code}/${o}`:`/${l.code}`;n.push(s?`${c}${r.search}`:c)};return t.createElement(ae,{buttonStyle:"userflow-site-locale-dropdown",value:i,options:e.locales,onChange:m,comparator:(l,c)=>l.code===c.code,renderOption:l=>l.name})},he=({companyLogoSrc:n,headerText:e,headerDescription:s,logoUrl:r,localeDropdown:o})=>t.createElement(t.Fragment,null,t.createElement("div",{className:"userflow-site-header-wrapper"},t.createElement("div",{className:"d-flex justify-space-between align-items-center userflow-site-logo-wrapper"},t.createElement("div",null,n?t.createElement(t.Fragment,null,r?t.createElement("a",{href:r,target:"_blank",rel:"noopener noreferrer"},t.createElement("img",{src:n,className:"userflow-site-logo"})):t.createElement("img",{src:n,className:"userflow-site-logo"})):null),o),t.createElement("div",{className:"userflow-site__announcements-heading"},t.createElement("h1",{className:"text-bold"},e),t.createElement("p",null,s)))),pe=()=>{const n=M({message:{kind:"ListAnnouncements",beforeAnnouncementId:null}}),{data:e,loadMore:s,loading:r,loadingMore:o,error:i}=n,a=e?.truncated,m=d.useCallback(()=>{s((l,c)=>l.announcements.length>0?{...c,beforeAnnouncementId:l.announcements[l.announcements.length-1].id}:c,(l,c)=>({...c,announcements:[...l.announcements,...c.announcements]}))},[s]);return d.useEffect(()=>{if(r||o||a)return;const l=()=>{const c=window.scrollY,f=window.innerHeight;document.documentElement.scrollHeight-(c+f)<=400&&m()};return window.addEventListener("scroll",l),()=>window.removeEventListener("scroll",l)},[a,r,o,m]),{data:e,loading:r,loadingMore:o,error:i}},p=()=>h().draftMode,V=()=>{const n=h(),e=p(),{locale:s}=S();return e?s:s??n.locale.standardLocaleId},B=n=>{const e=p(),s=T();return e?`${n}${s.search}`:n};export{me as SiteAnnouncementsWrapper,D as SiteContentWrapper,he as SiteHeader,P as SiteListItem,Xe as SitePage};
1
+ import{R as t,r as d}from"./vendor.react.js";import{U,u as C,i as S}from"./client-context.js";import{r as K}from"./vendor.react-dom.js";import{B as W,L as b}from"./vendor.react-router-dom.js";import{S as I,u as M}from"./use-client-query.js";import{D as w,u as v,a as j,g as O}from"./stylesheets.js";import{i as Y}from"./iframe-reset.styl.js";import{S as z,u as h,R as _}from"./TreeDoc.js";import{g as x}from"./flow-condition-types.js";import{f as q,a as G,b as Q,c as J}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{o as A}from"./vendor.obj-str.js";import{d as X}from"./userflow.js";import{P as Z}from"./Popover.js";import{m as ee}from"./vendor.memoize-one.js";import"./vendor.core-js.js";import{u as te}from"./react-hooks.js";import{S as ne,a as N,u as y,b as D,d as se,e as T}from"./vendor.react-router.js";import{u as oe}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.scheduler.js";import"./vendor.history.js";import"./vendor.resolve-pathname.js";import"./vendor.value-equal.js";import"./vendor.tiny-invariant.js";import"./vendor.prop-types.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./vendor.date-fns.js";import"./roots.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.lodash.js";import"./vendor.mini-create-react-context.js";import"./vendor.path-to-regexp.js";import"./vendor.react-is.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="329aa854-81c1-46d5-8dee-bd0af4518294",n._sentryDebugIdIdentifier="sentry-dbid-329aa854-81c1-46d5-8dee-bd0af4518294")}catch{}})();const re=new URL("popover.css",import.meta.url).href,ie=new URL("site.css",import.meta.url).href;class $ extends t.PureComponent{constructor(){super(...arguments),this.rootRef=t.createRef(),this.isScrollingIntoView=!1,this.state={highlightedIdx:this.props.disableAutoHighlight?-1:0},this.onKeyDown=e=>{const{highlightedIdx:s}=this.state,{items:r}=this.props,o=()=>{e.stopPropagation(),e.preventDefault()};switch(e.key){case"ArrowUp":o(),s>0?this.setHighlighted(s-1):s===-1&&this.setHighlighted(r.length-1);break;case"ArrowDown":o(),s<r.length-1?this.setHighlighted(s+1):s===-1&&this.setHighlighted(0);break;case"Enter":o(),this.selectItem(r[s]);break}},this.selectItem=e=>{this.props.onSelect(e)},this.onItemHover=e=>{this.isScrollingIntoView||(this.setState({highlightedIdx:e}),this.props.onItemHighlighted?.(this.props.items[e]))},this.onMouseLeave=()=>{const{clearHoverOnMouseLeave:e,selectedItem:s,items:r}=this.props;if(e)if(s){const o=r.findIndex(i=>i===s);this.setState({highlightedIdx:o})}else this.setState({highlightedIdx:-1})},this.memoizedStyle=ee(e=>e==null?{}:{maxHeight:e,overflowY:"auto"})}componentDidMount(){this.props.autoFocus&&this.rootRef.current.focus({preventScroll:!0}),this.props.forwardedRef&&this.rootRef.current&&(typeof this.props.forwardedRef=="function"?this.props.forwardedRef(this.rootRef.current):this.props.forwardedRef.current=this.rootRef.current)}render(){const e=this.state,{selectedItem:s,clearHoverOnMouseLeave:r}=this.props;return t.createElement("div",{ref:this.rootRef,className:"key-nav-list",style:this.memoizedStyle(this.props.maxHeight),onKeyDown:this.onKeyDown,onMouseLeave:r?this.onMouseLeave:void 0,tabIndex:0},this.props.items.map((o,i)=>t.createElement(le,{key:i,item:o,idx:i,className:A({"key-nav-list__item":!0,"key-nav-list__item--highlighted":i===e.highlightedIdx,"key-nav-list__item--selected":o===s}),renderContent:this.props.children,onClick:this.selectItem,onHover:this.onItemHover})))}scrollHighlightedItemIntoView(){const e=this.rootRef.current,s=e.querySelector(".key-nav-list__item--highlighted");if(s){this.isScrollingIntoView=!0,window.clearTimeout(this.isScrollingIntoViewTimeout),this.isScrollingIntoViewTimeout=window.setTimeout(()=>this.isScrollingIntoView=!1,250);const r=e.getBoundingClientRect(),o=s.getBoundingClientRect();o.top<r.top?e.scrollTop+=o.top-r.top:o.bottom>r.bottom&&(e.scrollTop+=o.bottom-r.bottom)}}setHighlighted(e){this.setState({highlightedIdx:e},this.scrollHighlightedItemIntoView),this.props.onItemHighlighted?.(this.props.items[e])}}class le extends t.PureComponent{constructor(){super(...arguments),this.onClick=()=>this.props.onClick(this.props.item),this.onHover=()=>this.props.onHover(this.props.idx)}render(){const{props:e}=this;return t.createElement("div",{className:e.className,onClick:this.onClick,onMouseMove:this.onHover},e.renderContent(e.item,e.idx))}}t.forwardRef((n,e)=>t.createElement($,{...n,forwardedRef:e}));function ae({testid:n,buttonText:e,value:s,onChange:r,options:o,renderOption:i,disabled:a,buttonStyle:m,htmlAttributes:l,comparator:c}){const f=d.useRef(null),[g,E]=d.useState(!1),k=()=>{E(!1),f.current&&f.current.focus()},F=({key:u})=>{if(u.length===1){u=u.toLowerCase();for(const L of o){const R=i(L);if(typeof R=="string"&&R.toLowerCase().startsWith(u)){r(L);return}}}};return t.createElement(t.Fragment,null,t.createElement("button",{ref:f,"data-testid":n,type:"button",className:`btn btn-dynamic-icon ${m||"btn--plain-blue"} btn--sm ${g&&!a?"btn--popover-open":""}`,onClick:()=>E(!g),disabled:a,onKeyDown:F,...l},e||i(s),t.createElement(w,{icon:q})),g&&!a&&f.current&&t.createElement(Z,{target:f.current,matchMinWidth:!0,onDismiss:k},t.createElement($,{items:o,onSelect:u=>{k(),r(u)},autoFocus:!0},u=>t.createElement("div",{className:"d-flex"},t.createElement("div",{className:"mr-8",style:(c?c(u,s):u===s)?void 0:{visibility:"hidden"}},t.createElement(w,{icon:G})),i(u)))))}function ce(n){const e=n?new Date(n):new Date;let s=new Intl.DateTimeFormat(S.language,{weekday:"long",day:"numeric",month:"short",year:e.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(e);return s.substring(0,1).toUpperCase()+s.substring(1)}class Xe{constructor(e,s){this.client=e,this.selector=s}mount(){if(this.container)throw new Error("SiteRoute has already been mounted");const e=document.querySelector(this.selector);if(!e)throw new Error(`SitePage: No element found for selector ${this.selector}`);this.container=e,K.render(t.createElement(W,null,t.createElement(U.Provider,{value:this.client},t.createElement(me,null))),this.container)}}const me=()=>{const n=C();v(window,Y),v(window,re);const{loaded:e}=v(window,ie),[s,r]=d.useState(null),o=s?.locale.standardLocaleId||s?.version.theme.languageId;return d.useEffect(()=>{o&&S.changeLanguage(o)},[o]),d.useEffect(()=>{const i=a=>{X("Received site session",a),n.featureFlagEnabled("cff_site")!==!1&&r(a)};return n.on("private:siteSession",i),()=>{n.off("private:siteSession",i)}},[n]),!s||!e?null:t.createElement(z.Provider,{value:s},t.createElement(ne,null,t.createElement(N,{exact:!0,path:"/:locale/:announcementId"},t.createElement(H,null,t.createElement(de,{key:s.locale.standardLocaleId}))),t.createElement(N,{path:"/:locale"},t.createElement(H,null,t.createElement(ue,{key:s.locale.standardLocaleId})))))},H=({children:n})=>{const e=h(),s=j(e.version.theme),r=e.version.theme.siteLogoAsset?.assetUrl,o=e.version.site,i=p();if(!o)return null;const{headerText:a,headerDescription:m,logoUrl:l}=o;return t.createElement("div",{style:O(s),className:"userflow-site__announcements"},i?t.createElement("div",{className:"text-bolder userflow-site-preview-banner"},"PREVIEW"):null,t.createElement(he,{headerText:a,headerDescription:m,companyLogoSrc:r,logoUrl:l,localeDropdown:t.createElement(fe,null)}),n)},ue=()=>{const{t:n}=oe(),e=h(),{data:s,loading:r,loadingMore:o,error:i}=pe();return i?t.createElement("div",{className:"userflow-site__announcement-content"},"Failed in loading announcements"):r?t.createElement("div",{className:"userflow-site__announcement-content"},t.createElement(I,{center:!0,fadeIn:!0})):t.createElement("div",{className:"userflow-site__announcement-content"},s?.announcements&&s?.announcements.length>0?t.createElement("div",{className:"userflow-site__announcement-list"},s.announcements.map(a=>t.createElement(P,{expanded:!1,key:a.id,announcement:a,enableTitleLinks:e.version.site?.enableTitleLinks})),o?t.createElement(I,{center:!0,fadeIn:!0}):null):null,s?.announcements&&s?.announcements.length===0?t.createElement("div",{className:"userflow-site-empty-state"},S.exists("resource_center.no_announcements",{fallbackLng:[]})?n("resource_center.no_announcements"):n("resource_center.no_results_found")):null)},P=({announcement:n,expanded:e=!1,enableTitleLinks:s})=>{const r=V(),o=C(),i=p(),a=d.useRef(null),m=s&&!!r,l=te(a,{once:!0,rootMargin:"100px",disabled:n.seen===!0||i}),c=B(`/${r}/${i?n.id:n.permalink}`);return d.useEffect(()=>{l&&n.seen===!1&&o.send({kind:"MarkAnnouncementSeen",announcementId:n.id,versionId:n.versionId},{batch:!0})},[l,n,o]),t.createElement("div",{ref:a,className:"userflow-site__card"},t.createElement("div",null,t.createElement("span",{className:"text-small text-secondary"},ce(n.time)),t.createElement("div",null,m?t.createElement(b,{to:c,className:"h2-like text-extra-bold"},n.title):t.createElement("h2",{className:"h2-like text-extra-bold"},n.title))),t.createElement(_,{doc:n.content,buttons:n.buttons,lookupAttribute:x(n.data)}),n.moreEnabled&&!e?t.createElement("div",{className:"userflow-site-button-wrapper"},t.createElement(b,{to:c,className:A({"userflow-site-link-button":!0,"userflow-site-link-button--primary":!0,"userflowjs-bubble-button userflowjs-bubble-button--primary":!0})},n.moreButtonText||"Read more",t.createElement(w,{icon:Q}))):null,n.moreEnabled&&e?t.createElement(_,{doc:n.moreContent,buttons:n.moreButtons,lookupAttribute:x(n.data)}):null)},de=()=>{const n=h(),{announcementId:e}=y(),s=p(),r=V(),o=B(r),{loading:i,data:a,error:m}=M({message:{kind:"GetAnnouncement",announcementId:e,permalink:!s},skip:!e});return m?t.createElement(D,{to:`/${o}`}):!i&&!a?.announcement?t.createElement(D,{to:`/${o}`}):t.createElement("div",{className:"userflow-site__announcement-content"},i?t.createElement(I,{center:!0,fadeIn:!0}):null,!i&&a?.announcement&&t.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},t.createElement(b,{to:`/${o}`,className:"userflow-site-link-button"},t.createElement(w,{icon:J}),n.version.site?.homeButtonText||"All Announcements"),t.createElement(P,{expanded:!0,announcement:a.announcement})))},fe=()=>{const n=se(),e=h(),s=p(),r=T(),{announcementId:o}=y();if(e?.kind!=="site"||s)return null;const i=e.locales.find(l=>l.code===e.locale.standardLocaleId);if(e.locales.length===1&&e.locales[0].code===e.locale.standardLocaleId||e.locales.length===0||!i)return null;const m=l=>{const c=o?`/${l.code}/${o}`:`/${l.code}`;n.push(s?`${c}${r.search}`:c)};return t.createElement(ae,{buttonStyle:"userflow-site-locale-dropdown",value:i,options:e.locales,onChange:m,comparator:(l,c)=>l.code===c.code,renderOption:l=>l.name})},he=({companyLogoSrc:n,headerText:e,headerDescription:s,logoUrl:r,localeDropdown:o})=>t.createElement(t.Fragment,null,t.createElement("div",{className:"userflow-site-header-wrapper"},t.createElement("div",{className:"d-flex justify-space-between align-items-center userflow-site-logo-wrapper"},t.createElement("div",null,n?t.createElement(t.Fragment,null,r?t.createElement("a",{href:r,target:"_blank",rel:"noopener noreferrer"},t.createElement("img",{src:n,className:"userflow-site-logo"})):t.createElement("img",{src:n,className:"userflow-site-logo"})):null),o),t.createElement("div",{className:"userflow-site__announcements-heading"},t.createElement("h1",{className:"text-bold"},e),t.createElement("p",null,s)))),pe=()=>{const n=M({message:{kind:"ListAnnouncements",beforeAnnouncementId:null}}),{data:e,loadMore:s,loading:r,loadingMore:o,error:i}=n,a=e?.truncated,m=d.useCallback(()=>{s((l,c)=>l.announcements.length>0?{...c,beforeAnnouncementId:l.announcements[l.announcements.length-1].id}:c,(l,c)=>({...c,announcements:[...l.announcements,...c.announcements]}))},[s]);return d.useEffect(()=>{if(r||o||a)return;const l=()=>{const c=window.scrollY,f=window.innerHeight;document.documentElement.scrollHeight-(c+f)<=400&&m()};return window.addEventListener("scroll",l),()=>window.removeEventListener("scroll",l)},[a,r,o,m]),{data:e,loading:r,loadingMore:o,error:i}},p=()=>h().draftMode,V=()=>{const n=h(),e=p(),{locale:s}=y();return e?s:s??n.locale.standardLocaleId},B=n=>{const e=p(),s=T();return e?`${n}${s.search}`:n};export{me as SiteAnnouncementsWrapper,H as SiteContentWrapper,he as SiteHeader,P as SiteListItem,Xe as SitePage};
2
2
  //# sourceMappingURL=SitePage.js.map
package/hash.txt CHANGED
@@ -1 +1 @@
1
- b957e87f8ad768b633f537f0c83717c14b58b741
1
+ 80c544eb1060ff39fa95d17758bc938129ef7334
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "userflow.js-self-hosted",
3
- "version": "0.1.1019820",
3
+ "version": "0.1.1019826",
4
4
  "description": "Self-hosted version of Userflow.js",
5
5
  "main": "userflow.js"
6
6
  }
package/site.css CHANGED
@@ -4239,10 +4239,20 @@ body {
4239
4239
  padding-bottom: 4rem;
4240
4240
  color: var(--userflow-site-hero-foreground-color);
4241
4241
  }
4242
+ @media (max-width: 1023px) {
4243
+ .userflow-site__announcements-heading {
4244
+ width: 80%;
4245
+ }
4246
+ }
4242
4247
  .userflow-site__announcement-content {
4243
4248
  width: 600px;
4244
4249
  margin: auto;
4245
4250
  }
4251
+ @media (max-width: 1023px) {
4252
+ .userflow-site__announcement-content {
4253
+ width: 80%;
4254
+ }
4255
+ }
4246
4256
  .userflow-site__announcement-list {
4247
4257
  margin-top: -2rem;
4248
4258
  display: flex;
@@ -4274,7 +4284,6 @@ body {
4274
4284
  align-items: center;
4275
4285
  gap: 0.5rem;
4276
4286
  width: fit-content;
4277
- color: var(--userflow-site-content-foreground-color);
4278
4287
  border: none;
4279
4288
  text-decoration: none;
4280
4289
  }
@@ -4284,6 +4293,9 @@ body {
4284
4293
  .userflow-site-link-button:hover {
4285
4294
  text-decoration: none;
4286
4295
  }
4296
+ .userflow-site-home-back-button {
4297
+ color: var(--userflow-site-content-foreground-color);
4298
+ }
4287
4299
  .userflow-site-logo-wrapper {
4288
4300
  height: 60px;
4289
4301
  }
package/userflow.js CHANGED
@@ -1,9 +1,9 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ResourceCenterApp.js","vendor.react.js","vendor.core-js.js","vendor.object-assign.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","flow-host.styl.js","TreeDoc.js","flow-condition-types.js","vendor.date-fns.js","roots.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","vendor.obj-str.js","use-selector-element-monitoring.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","iframe-reset.styl.js","use-window-resize.js","logomark.js","ChecklistUI.js","FlowChrome.js","vendor.canvas-confetti.js","use-client-query.js","vendor.memoize-one.js","vendor.bignumber.js.js","use-element-rect.js","BannerApp.js","vendor.phoenix.js","vendor.uuid.js","SitePage.js","vendor.react-router-dom.js","vendor.react-router.js","vendor.prop-types.js","vendor.history.js","vendor.resolve-pathname.js","vendor.value-equal.js","vendor.tiny-invariant.js","vendor.mini-create-react-context.js","vendor.path-to-regexp.js","vendor.react-is.js","Popover.js","react-hooks.js","vendor.lodash.js","implicit-tracking.js","DebuggerUI.js","vendor.fortawesome.react-fontawesome.js","vendor.fortawesome.fontawesome-svg-core.js","vendor.react-day-picker.js","ui.js"])))=>i.map(i=>d[i]);
2
- import"./vendor.core-js.js";import{S as z}from"./vendor.phoenix.js";import{v as O}from"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="5f564547-1ad5-4caa-8e0a-fc7dfad056e1",t._sentryDebugIdIdentifier="sentry-dbid-5f564547-1ad5-4caa-8e0a-fc7dfad056e1")}catch{}})();const J="modulepreload",Q=function(t){return new URL("./",import.meta.url).toString()+t},b={},T=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");i=Promise.allSettled(s.map(c=>{if(c=Q(c),c in b)return;b[c]=!0;const l=c.endsWith(".css"),g=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const E=document.createElement("link");if(E.rel=l?"stylesheet":J,l||(E.as="script"),E.crossOrigin="",E.href=c,u&&E.setAttribute("nonce",u),document.head.appendChild(E),l)return new Promise((j,Y)=>{E.addEventListener("load",j),E.addEventListener("error",()=>Y(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return i.then(a=>{for(const u of a||[])u.status==="rejected"&&r(u.reason);return e().catch(r)})};class h extends Error{constructor(e,s,n){super(e),Object.setPrototypeOf(this,h.prototype),this.name="UserflowError",this.code=s,this.humanMessage=n}}class x{constructor(e){this.type=e,this.testState={}}formatKey(e){return`userflow:${e}`}isSupported(){if(typeof window>"u")return!1;try{return window[this.type]!=null}catch{return!1}}getItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].getItem(e):null}setItem(e,s){e=this.formatKey(e);{if(!this.isSupported())return;window[this.type].setItem(e,s)}}removeItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].removeItem(e):void 0}clear(){return this.isSupported()?window[this.type].clear():void 0}}const w=new x("localStorage"),d=new x("sessionStorage");function ot(t){window.location.href=t}function m(){return window.location.href}function N(t){window.postMessage(t,window.origin)}function G(t){const e=n=>{if(n.source!==window||n.origin!==window.origin)return;const i=n.data;!i||typeof i!="object"||typeof i.kind!="string"||!i.kind.startsWith("userflow:")||t(i)===!0&&s()};window.addEventListener("message",e);const s=()=>window.removeEventListener("message",e);return s}function X(t){return new Promise(e=>{G(s=>{const n=t(s);return n?(e(n),!0):!1})})}const R=new Set;let D=!1;function Z(t){return q(),R.add(t),()=>{W(t)}}function W(t){R.delete(t)}function C(){R.forEach(t=>t())}function q(){if(D)return;D=!0;const{history:t}=window,e=s=>{const n=t[s];t[s]=(...i)=>{const r=n.apply(t,i);return C(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{C()}),window.addEventListener("userflow:replacestate",()=>{C()})):(e("pushState"),e("replaceState")),window.addEventListener("popstate",()=>{C()})}class ee{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){N({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:e})}onBuilderMessage(e){return this.unregisterOnMessage=G(e),!1}async captureScreenshot(e,s,n,i){return N({kind:"userflow:crxScreenshot",x:e,y:s,width:n,height:i,devicePixelRatio:window.devicePixelRatio}),(await X(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var k=(t=>(t.ACTION="ACTION",t.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",t.REPLACED="REPLACED",t.SNOOZED="SNOOZED",t.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",t.USERFLOWJS="USERFLOWJS",t.USER_CLOSED="USER_CLOSED",t))(k||{}),te=(t=>(t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t))(te||{}),p=(t=>(t.ACTION="ACTION",t.DRAFT="DRAFT",t.LINK="LINK",t.LAUNCHER_SEEN="LAUNCHER_SEEN",t.RESOURCE_CENTER="RESOURCE_CENTER",t.USERFLOWJS="USERFLOWJS",t.ASSISTANT="ASSISTANT",t))(p||{}),se=(t=>(t.LIKE="LIKE",t.DISLIKE="DISLIKE",t))(se||{}),S=(t=>(t.STRING="STRING",t.BOOLEAN="BOOLEAN",t.NUMBER="NUMBER",t.DATETIME="DATETIME",t.LIST="LIST",t.RANDOM_AB="RANDOM_AB",t.RANDOM_NUMBER="RANDOM_NUMBER",t.CHECKLIST_TASK="CHECKLIST_TASK",t.FLOW="FLOW",t.FLOW_SESSION="FLOW_SESSION",t.FLOW_STEP="FLOW_STEP",t.FLOW_VERSION="FLOW_VERSION",t))(S||{}),U=(t=>(t.FLOW="FLOW",t.BANNER="BANNER",t.EMBED="EMBED",t.CHECKLIST="CHECKLIST",t.LAUNCHER="LAUNCHER",t.RESOURCE_CENTER="RESOURCE_CENTER",t.SITE="SITE",t))(U||{}),ie=(t=>(t.ALWAYS_TRUE="ALWAYS_TRUE",t.ATTRIBUTE="ATTRIBUTE",t.CHECKLIST_TASK_CLICKED="CHECKLIST_TASK_CLICKED",t.CLAUSE="CLAUSE",t.ELEMENT="ELEMENT",t.EVENT="EVENT",t.FILLED_IN_INPUT="FILLED_IN_INPUT",t.FLOW="FLOW",t.INPUT_VALUE="INPUT_VALUE",t.PAGE="PAGE",t.SEGMENT="SEGMENT",t.TIME="TIME",t))(ie||{}),ne=(t=>(t.AUTO="AUTO",t.MANUAL="MANUAL",t))(ne||{}),re=(t=>(t.INPUT="INPUT",t))(re||{}),oe=(t=>(t.ABSOLUTE_EQ="ABSOLUTE_EQ",t.ABSOLUTE_GT="ABSOLUTE_GT",t.ABSOLUTE_LT="ABSOLUTE_LT",t.AND="AND",t.BETWEEN="BETWEEN",t.CONTAINS="CONTAINS",t.EMPTY="EMPTY",t.ENDS_WITH="ENDS_WITH",t.EQ="EQ",t.EXCLUDES_ALL="EXCLUDES_ALL",t.EXCLUDES_ANY="EXCLUDES_ANY",t.FALSE="FALSE",t.GT="GT",t.GTE="GTE",t.INCLUDES_ALL="INCLUDES_ALL",t.INCLUDES_ANY="INCLUDES_ANY",t.LT="LT",t.LTE="LTE",t.NE="NE",t.NOT_CONTAINS="NOT_CONTAINS",t.NOT_EMPTY="NOT_EMPTY",t.NOT_REGEX="NOT_REGEX",t.OR="OR",t.REGEX="REGEX",t.RELATIVE_EQ="RELATIVE_EQ",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t.STARTS_WITH="STARTS_WITH",t.TRUE="TRUE",t.URL="URL",t))(oe||{}),ae=(t=>(t.CLICK="CLICK",t.DISABLED="DISABLED",t.MOUSEDOWN="MOUSEDOWN",t.NOT_CLICK="NOT_CLICK",t.NOT_DISABLED="NOT_DISABLED",t.NOT_PRESENT="NOT_PRESENT",t.PRESENT="PRESENT",t))(ae||{}),ce=(t=>(t.END_USER="END_USER",t.GROUP="GROUP",t))(ce||{}),le=(t=>(t.BETWEEN="BETWEEN",t.EQ="EQ",t.GTE="GTE",t.LTE="LTE",t))(le||{}),ue=(t=>(t.ANY="ANY",t.RELATIVE_BETWEEN="RELATIVE_BETWEEN",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t))(ue||{}),he=(t=>(t.CURRENT_USER="CURRENT_USER",t.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",t.CURRENT_GROUP="CURRENT_GROUP",t))(he||{}),de=(t=>(t.ASSET="ASSET",t.CARTOON="CARTOON",t.NONE="NONE",t.URL="URL",t))(de||{}),fe=(t=>(t.INSIDE="INSIDE",t.OUTSIDE="OUTSIDE",t))(fe||{}),Ee=(t=>(t.TOP_LEFT="TOP_LEFT",t.TOP_CENTER="TOP_CENTER",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_RIGHT="BOTTOM_RIGHT",t.BOTTOM_CENTER="BOTTOM_CENTER",t.BOTTOM_LEFT="BOTTOM_LEFT",t.CENTER="CENTER",t))(Ee||{}),Se=(t=>(t.GOOGLE="GOOGLE",t.STANDARD="STANDARD",t))(Se||{}),Te=(t=>(t.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",t.DISMISS="DISMISS",t))(Te||{}),ge=(t=>(t.DISMISS="DISMISS",t.NONE="NONE",t))(ge||{}),Ie=(t=>(t.DEFAULT="DEFAULT",t.NARROW="NARROW",t.CHAINED_SQUARED="CHAINED_SQUARED",t.CHAINED_ROUNDED="CHAINED_ROUNDED",t.DOTTED="DOTTED",t.NUMBERED="NUMBERED",t))(Ie||{}),we=(t=>(t.TOP="TOP",t.BOTTOM="BOTTOM",t))(we||{}),Ce=(t=>(t.DEFAULT="DEFAULT",t.PLAINTEXT="PLAINTEXT",t.CUSTOM="CUSTOM",t))(Ce||{}),me=(t=>(t.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",t.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",t.NONE="NONE",t))(me||{}),ke=(t=>(t.BUBBLE="BUBBLE",t.END="END",t.ERROR="ERROR",t.FLAG="FLAG",t))(ke||{}),Ue=(t=>(t.MANUAL="MANUAL",t.NONE="NONE",t.SYNTHETIC="SYNTHETIC",t))(Ue||{}),pe=(t=>(t.BUBBLE="BUBBLE",t.HIDDEN="HIDDEN",t.MODAL="MODAL",t.TOOLTIP="TOOLTIP",t))(pe||{}),Le=(t=>(t.ABOVE="ABOVE",t.BELOW="BELOW",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(Le||{}),_e=(t=>(t.CLOSE_FLOW="CLOSE_FLOW",t.EVAL_JS="EVAL_JS",t.GO_TO_STEP="GO_TO_STEP",t.NAVIGATE="NAVIGATE",t.SET_ATTRIBUTE="SET_ATTRIBUTE",t.SNOOZE="SNOOZE",t.START_FLOW="START_FLOW",t.TRACK_BUTTON_EVENT="TRACK_BUTTON_EVENT",t))(_e||{}),Ne=(t=>(t.NEW_TAB="NEW_TAB",t.SAME_TAB="SAME_TAB",t))(Ne||{}),Ae=(t=>(t.SET="SET",t.SET_DATETIME="SET_DATETIME",t.SET_DATETIME_ONCE="SET_DATETIME_ONCE",t.SET_ONCE="SET_ONCE",t.ADD="ADD",t.SUBTRACT="SUBTRACT",t.APPEND="APPEND",t.PREPEND="PREPEND",t.REMOVE="REMOVE",t.UNSET="UNSET",t))(Ae||{}),Re=(t=>(t.MULTILINE_TEXT="MULTILINE_TEXT",t.MULTIPLE_CHOICE="MULTIPLE_CHOICE",t.NPS="NPS",t.SCALE="SCALE",t.STARS="STARS",t.TEXT="TEXT",t))(Re||{}),A=(t=>(t.ACTION="ACTION",t.ANNOUNCEMENTS="ANNOUNCEMENTS",t.ASSISTANT="ASSISTANT",t.CHECKLIST="CHECKLIST",t.CONTACT="CONTACT",t.DIVIDER="DIVIDER",t.FLOWS="FLOWS",t.KNOWLEDGE_BASE="KNOWLEDGE_BASE",t.MESSAGE="MESSAGE",t.SUBPAGE="SUBPAGE",t))(A||{}),ve=(t=>(t.CRISP="CRISP",t.CUSTOM="CUSTOM",t.FRESHCHAT="FRESHCHAT",t.HELPSCOUT="HELPSCOUT",t.HUBSPOT="HUBSPOT",t.INTERCOM="INTERCOM",t.ZENDESK="ZENDESK",t.ZENDESK_MESSENGER="ZENDESK_MESSENGER",t))(ve||{}),Oe=(t=>(t.BUTTON="BUTTON",t.INPUT="INPUT",t))(Oe||{}),be=(t=>(t.EMAIL="EMAIL",t.PHONE="PHONE",t.CHAT="CHAT",t))(be||{}),De=(t=>(t.SILENT="SILENT",t.BADGE="BADGE",t.POPOUT="POPOUT",t.MODAL="MODAL",t.TOAST="TOAST",t))(De||{}),ye=(t=>(t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.NONE="NONE",t))(ye||{}),Me=(t=>(t.LAUNCHER_CLICK="LAUNCHER_CLICK",t.LAUNCHER_HOVER="LAUNCHER_HOVER",t.TARGET_CLICK="TARGET_CLICK",t.TARGET_HOVER="TARGET_HOVER",t.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",t.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",t))(Me||{}),V=(t=>(t.ACTIVATE="ACTIVATE",t.DEACTIVATE="DEACTIVATE",t.NEVER="NEVER",t))(V||{}),Pe=(t=>(t.AUTO="AUTO",t.TOP="TOP",t.RIGHT="RIGHT",t.BOTTOM="BOTTOM",t.LEFT="LEFT",t))(Pe||{}),Be=(t=>(t.START="START",t.CENTER="CENTER",t.END="END",t))(Be||{}),He=(t=>(t.PERCENT="PERCENT",t.PX="PX",t))(He||{}),xe=(t=>(t.BEACON="BEACON",t.BUTTON="BUTTON",t.HIDDEN="HIDDEN",t.ICON="ICON",t))(xe||{}),Ge=(t=>(t.LAUNCHER="LAUNCHER",t.TARGET="TARGET",t))(Ge||{}),We=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(We||{}),Ve=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(Ve||{}),K=(t=>(t.CHECKLIST="CHECKLIST",t))(K||{}),Ke=(t=>(t.ALWAYS="ALWAYS",t.MULTIPLE="MULTIPLE",t.NEVER="NEVER",t.ONCE="ONCE",t.ONCE_PER_GROUP="ONCE_PER_GROUP",t))(Ke||{}),Fe=(t=>(t.NONE="NONE",t.PENDING_SCHEDULE="PENDING_SCHEDULE",t.SCHEDULED="SCHEDULED",t.FIRED="FIRED",t))(Fe||{}),$e=(t=>(t.NONE="NONE",t.LIKE="LIKE",t.SCALE="SCALE",t))($e||{}),je=(t=>(t.HIDE="HIDE",t.BLOCK="BLOCK",t.OTHERS="OTHERS",t))(je||{});function Ye(){return{customInputs:[],customNavigate:null,urlFilter:null,linkUrlDecorator:null,customScrollIntoView:null,scrollPadding:null,inferenceAttributeNames:["data-for","data-id","data-testid","data-test-id","for","id","name","placeholder","role"],inferenceAttributeFilters:{id:[t=>!t.match(/\d$/)],"data-id":[t=>!t.match(/\d$/)]},inferenceClassNameFilters:[t=>!t.startsWith("css-")],baseZIndex:1234500,evalJsDisabled:!1}}const f=Ye();function y(t){return Array.isArray(t)||(t=t?[t]:[]),t=t.map(e=>typeof e=="string"?new RegExp(e):e),t}function at(t,e){return t.every(s=>typeof s=="function"?s(e):s instanceof RegExp?s.test(e):!0)}function ze(){let t=m();if(f.urlFilter){if(t=f.urlFilter(t),typeof t!="string")throw new h("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(t)}catch(e){throw new h(`Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.
2
+ import"./vendor.core-js.js";import{S as z}from"./vendor.phoenix.js";import{v as O}from"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="b752bdd3-7516-4b14-8c81-a8fca678d186",t._sentryDebugIdIdentifier="sentry-dbid-b752bdd3-7516-4b14-8c81-a8fca678d186")}catch{}})();const J="modulepreload",Q=function(t){return new URL("./",import.meta.url).toString()+t},b={},T=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");i=Promise.allSettled(s.map(c=>{if(c=Q(c),c in b)return;b[c]=!0;const l=c.endsWith(".css"),g=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const E=document.createElement("link");if(E.rel=l?"stylesheet":J,l||(E.as="script"),E.crossOrigin="",E.href=c,u&&E.setAttribute("nonce",u),document.head.appendChild(E),l)return new Promise((j,Y)=>{E.addEventListener("load",j),E.addEventListener("error",()=>Y(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return i.then(a=>{for(const u of a||[])u.status==="rejected"&&r(u.reason);return e().catch(r)})};class h extends Error{constructor(e,s,n){super(e),Object.setPrototypeOf(this,h.prototype),this.name="UserflowError",this.code=s,this.humanMessage=n}}class x{constructor(e){this.type=e,this.testState={}}formatKey(e){return`userflow:${e}`}isSupported(){if(typeof window>"u")return!1;try{return window[this.type]!=null}catch{return!1}}getItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].getItem(e):null}setItem(e,s){e=this.formatKey(e);{if(!this.isSupported())return;window[this.type].setItem(e,s)}}removeItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].removeItem(e):void 0}clear(){return this.isSupported()?window[this.type].clear():void 0}}const w=new x("localStorage"),d=new x("sessionStorage");function at(t){window.location.href=t}function m(){return window.location.href}function N(t){window.postMessage(t,window.origin)}function G(t){const e=n=>{if(n.source!==window||n.origin!==window.origin)return;const i=n.data;!i||typeof i!="object"||typeof i.kind!="string"||!i.kind.startsWith("userflow:")||t(i)===!0&&s()};window.addEventListener("message",e);const s=()=>window.removeEventListener("message",e);return s}function X(t){return new Promise(e=>{G(s=>{const n=t(s);return n?(e(n),!0):!1})})}const R=new Set;let D=!1;function Z(t){return q(),R.add(t),()=>{W(t)}}function W(t){R.delete(t)}function C(){R.forEach(t=>t())}function q(){if(D)return;D=!0;const{history:t}=window,e=s=>{const n=t[s];t[s]=(...i)=>{const r=n.apply(t,i);return C(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{C()}),window.addEventListener("userflow:replacestate",()=>{C()})):(e("pushState"),e("replaceState")),window.addEventListener("popstate",()=>{C()})}class ee{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){N({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:e})}onBuilderMessage(e){return this.unregisterOnMessage=G(e),!1}async captureScreenshot(e,s,n,i){return N({kind:"userflow:crxScreenshot",x:e,y:s,width:n,height:i,devicePixelRatio:window.devicePixelRatio}),(await X(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var k=(t=>(t.ACTION="ACTION",t.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",t.REPLACED="REPLACED",t.SNOOZED="SNOOZED",t.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",t.USERFLOWJS="USERFLOWJS",t.USER_CLOSED="USER_CLOSED",t))(k||{}),te=(t=>(t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t))(te||{}),p=(t=>(t.ACTION="ACTION",t.DRAFT="DRAFT",t.LINK="LINK",t.LAUNCHER_SEEN="LAUNCHER_SEEN",t.RESOURCE_CENTER="RESOURCE_CENTER",t.USERFLOWJS="USERFLOWJS",t.ASSISTANT="ASSISTANT",t))(p||{}),se=(t=>(t.LIKE="LIKE",t.DISLIKE="DISLIKE",t))(se||{}),S=(t=>(t.STRING="STRING",t.BOOLEAN="BOOLEAN",t.NUMBER="NUMBER",t.DATETIME="DATETIME",t.LIST="LIST",t.RANDOM_AB="RANDOM_AB",t.RANDOM_NUMBER="RANDOM_NUMBER",t.CHECKLIST_TASK="CHECKLIST_TASK",t.FLOW="FLOW",t.FLOW_SESSION="FLOW_SESSION",t.FLOW_STEP="FLOW_STEP",t.FLOW_VERSION="FLOW_VERSION",t))(S||{}),U=(t=>(t.FLOW="FLOW",t.BANNER="BANNER",t.EMBED="EMBED",t.CHECKLIST="CHECKLIST",t.LAUNCHER="LAUNCHER",t.RESOURCE_CENTER="RESOURCE_CENTER",t.SITE="SITE",t))(U||{}),ie=(t=>(t.ALWAYS_TRUE="ALWAYS_TRUE",t.ATTRIBUTE="ATTRIBUTE",t.CHECKLIST_TASK_CLICKED="CHECKLIST_TASK_CLICKED",t.CLAUSE="CLAUSE",t.ELEMENT="ELEMENT",t.EVENT="EVENT",t.FILLED_IN_INPUT="FILLED_IN_INPUT",t.FLOW="FLOW",t.INPUT_VALUE="INPUT_VALUE",t.PAGE="PAGE",t.SEGMENT="SEGMENT",t.TIME="TIME",t))(ie||{}),ne=(t=>(t.AUTO="AUTO",t.MANUAL="MANUAL",t))(ne||{}),re=(t=>(t.INPUT="INPUT",t))(re||{}),oe=(t=>(t.ABSOLUTE_EQ="ABSOLUTE_EQ",t.ABSOLUTE_GT="ABSOLUTE_GT",t.ABSOLUTE_LT="ABSOLUTE_LT",t.AND="AND",t.BETWEEN="BETWEEN",t.CONTAINS="CONTAINS",t.EMPTY="EMPTY",t.ENDS_WITH="ENDS_WITH",t.EQ="EQ",t.EXCLUDES_ALL="EXCLUDES_ALL",t.EXCLUDES_ANY="EXCLUDES_ANY",t.FALSE="FALSE",t.GT="GT",t.GTE="GTE",t.INCLUDES_ALL="INCLUDES_ALL",t.INCLUDES_ANY="INCLUDES_ANY",t.LT="LT",t.LTE="LTE",t.NE="NE",t.NOT_CONTAINS="NOT_CONTAINS",t.NOT_EMPTY="NOT_EMPTY",t.NOT_REGEX="NOT_REGEX",t.OR="OR",t.REGEX="REGEX",t.RELATIVE_EQ="RELATIVE_EQ",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t.STARTS_WITH="STARTS_WITH",t.TRUE="TRUE",t.URL="URL",t))(oe||{}),ae=(t=>(t.CLICK="CLICK",t.DISABLED="DISABLED",t.MOUSEDOWN="MOUSEDOWN",t.NOT_CLICK="NOT_CLICK",t.NOT_DISABLED="NOT_DISABLED",t.NOT_PRESENT="NOT_PRESENT",t.PRESENT="PRESENT",t))(ae||{}),ce=(t=>(t.END_USER="END_USER",t.GROUP="GROUP",t))(ce||{}),le=(t=>(t.BETWEEN="BETWEEN",t.EQ="EQ",t.GTE="GTE",t.LTE="LTE",t))(le||{}),ue=(t=>(t.ANY="ANY",t.RELATIVE_BETWEEN="RELATIVE_BETWEEN",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t))(ue||{}),he=(t=>(t.CURRENT_USER="CURRENT_USER",t.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",t.CURRENT_GROUP="CURRENT_GROUP",t))(he||{}),de=(t=>(t.ASSET="ASSET",t.CARTOON="CARTOON",t.NONE="NONE",t.URL="URL",t))(de||{}),fe=(t=>(t.INSIDE="INSIDE",t.OUTSIDE="OUTSIDE",t))(fe||{}),Ee=(t=>(t.TOP_LEFT="TOP_LEFT",t.TOP_CENTER="TOP_CENTER",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_RIGHT="BOTTOM_RIGHT",t.BOTTOM_CENTER="BOTTOM_CENTER",t.BOTTOM_LEFT="BOTTOM_LEFT",t.CENTER="CENTER",t))(Ee||{}),Se=(t=>(t.GOOGLE="GOOGLE",t.STANDARD="STANDARD",t))(Se||{}),Te=(t=>(t.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",t.DISMISS="DISMISS",t))(Te||{}),ge=(t=>(t.DISMISS="DISMISS",t.NONE="NONE",t))(ge||{}),Ie=(t=>(t.DEFAULT="DEFAULT",t.NARROW="NARROW",t.CHAINED_SQUARED="CHAINED_SQUARED",t.CHAINED_ROUNDED="CHAINED_ROUNDED",t.DOTTED="DOTTED",t.NUMBERED="NUMBERED",t))(Ie||{}),we=(t=>(t.TOP="TOP",t.BOTTOM="BOTTOM",t))(we||{}),Ce=(t=>(t.DEFAULT="DEFAULT",t.PLAINTEXT="PLAINTEXT",t.CUSTOM="CUSTOM",t))(Ce||{}),me=(t=>(t.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",t.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",t.NONE="NONE",t))(me||{}),ke=(t=>(t.BUBBLE="BUBBLE",t.END="END",t.ERROR="ERROR",t.FLAG="FLAG",t))(ke||{}),Ue=(t=>(t.MANUAL="MANUAL",t.NONE="NONE",t.SYNTHETIC="SYNTHETIC",t))(Ue||{}),pe=(t=>(t.BUBBLE="BUBBLE",t.HIDDEN="HIDDEN",t.MODAL="MODAL",t.TOOLTIP="TOOLTIP",t))(pe||{}),Le=(t=>(t.ABOVE="ABOVE",t.BELOW="BELOW",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(Le||{}),_e=(t=>(t.CLOSE_FLOW="CLOSE_FLOW",t.EVAL_JS="EVAL_JS",t.GO_TO_STEP="GO_TO_STEP",t.NAVIGATE="NAVIGATE",t.SET_ATTRIBUTE="SET_ATTRIBUTE",t.SNOOZE="SNOOZE",t.START_FLOW="START_FLOW",t.TRACK_BUTTON_EVENT="TRACK_BUTTON_EVENT",t))(_e||{}),Ne=(t=>(t.NEW_TAB="NEW_TAB",t.SAME_TAB="SAME_TAB",t))(Ne||{}),Ae=(t=>(t.SET="SET",t.SET_DATETIME="SET_DATETIME",t.SET_DATETIME_ONCE="SET_DATETIME_ONCE",t.SET_ONCE="SET_ONCE",t.ADD="ADD",t.SUBTRACT="SUBTRACT",t.APPEND="APPEND",t.PREPEND="PREPEND",t.REMOVE="REMOVE",t.UNSET="UNSET",t))(Ae||{}),Re=(t=>(t.MULTILINE_TEXT="MULTILINE_TEXT",t.MULTIPLE_CHOICE="MULTIPLE_CHOICE",t.NPS="NPS",t.SCALE="SCALE",t.STARS="STARS",t.TEXT="TEXT",t))(Re||{}),A=(t=>(t.ACTION="ACTION",t.ANNOUNCEMENTS="ANNOUNCEMENTS",t.ASSISTANT="ASSISTANT",t.CHECKLIST="CHECKLIST",t.CONTACT="CONTACT",t.DIVIDER="DIVIDER",t.FLOWS="FLOWS",t.KNOWLEDGE_BASE="KNOWLEDGE_BASE",t.MESSAGE="MESSAGE",t.SUBPAGE="SUBPAGE",t))(A||{}),ve=(t=>(t.CRISP="CRISP",t.CUSTOM="CUSTOM",t.FRESHCHAT="FRESHCHAT",t.HELPSCOUT="HELPSCOUT",t.HUBSPOT="HUBSPOT",t.INTERCOM="INTERCOM",t.ZENDESK="ZENDESK",t.ZENDESK_MESSENGER="ZENDESK_MESSENGER",t))(ve||{}),Oe=(t=>(t.BUTTON="BUTTON",t.INPUT="INPUT",t))(Oe||{}),be=(t=>(t.EMAIL="EMAIL",t.PHONE="PHONE",t.CHAT="CHAT",t))(be||{}),De=(t=>(t.SILENT="SILENT",t.BADGE="BADGE",t.POPOUT="POPOUT",t.MODAL="MODAL",t.TOAST="TOAST",t))(De||{}),ye=(t=>(t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.NONE="NONE",t))(ye||{}),Me=(t=>(t.LAUNCHER_CLICK="LAUNCHER_CLICK",t.LAUNCHER_HOVER="LAUNCHER_HOVER",t.TARGET_CLICK="TARGET_CLICK",t.TARGET_HOVER="TARGET_HOVER",t.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",t.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",t))(Me||{}),V=(t=>(t.ACTIVATE="ACTIVATE",t.DEACTIVATE="DEACTIVATE",t.NEVER="NEVER",t))(V||{}),Pe=(t=>(t.AUTO="AUTO",t.TOP="TOP",t.RIGHT="RIGHT",t.BOTTOM="BOTTOM",t.LEFT="LEFT",t))(Pe||{}),Be=(t=>(t.START="START",t.CENTER="CENTER",t.END="END",t))(Be||{}),He=(t=>(t.PERCENT="PERCENT",t.PX="PX",t))(He||{}),xe=(t=>(t.BEACON="BEACON",t.BUTTON="BUTTON",t.HIDDEN="HIDDEN",t.ICON="ICON",t))(xe||{}),Ge=(t=>(t.LAUNCHER="LAUNCHER",t.TARGET="TARGET",t))(Ge||{}),We=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(We||{}),Ve=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(Ve||{}),K=(t=>(t.CHECKLIST="CHECKLIST",t))(K||{}),Ke=(t=>(t.HIDE="HIDE",t.OTHERS="OTHERS",t))(Ke||{}),Fe=(t=>(t.ALWAYS="ALWAYS",t.MULTIPLE="MULTIPLE",t.NEVER="NEVER",t.ONCE="ONCE",t.ONCE_PER_GROUP="ONCE_PER_GROUP",t))(Fe||{}),$e=(t=>(t.NONE="NONE",t.PENDING_SCHEDULE="PENDING_SCHEDULE",t.SCHEDULED="SCHEDULED",t.FIRED="FIRED",t))($e||{}),je=(t=>(t.NONE="NONE",t.LIKE="LIKE",t.SCALE="SCALE",t))(je||{}),Ye=(t=>(t.HIDE="HIDE",t.BLOCK="BLOCK",t.OTHERS="OTHERS",t))(Ye||{});function ze(){return{customInputs:[],customNavigate:null,urlFilter:null,linkUrlDecorator:null,customScrollIntoView:null,scrollPadding:null,inferenceAttributeNames:["data-for","data-id","data-testid","data-test-id","for","id","name","placeholder","role"],inferenceAttributeFilters:{id:[t=>!t.match(/\d$/)],"data-id":[t=>!t.match(/\d$/)]},inferenceClassNameFilters:[t=>!t.startsWith("css-")],baseZIndex:1234500,evalJsDisabled:!1}}const f=ze();function y(t){return Array.isArray(t)||(t=t?[t]:[]),t=t.map(e=>typeof e=="string"?new RegExp(e):e),t}function ct(t,e){return t.every(s=>typeof s=="function"?s(e):s instanceof RegExp?s.test(e):!0)}function Je(){let t=m();if(f.urlFilter){if(t=f.urlFilter(t),typeof t!="string")throw new h("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(t)}catch(e){throw new h(`Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.
3
3
  Returned URL: `+t+`
4
- Error message: `+e.message)}}return t}let F="";try{F=localStorage.getItem("debug")||""}catch{}const $=F.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=v("log");o.group=v("group");o.groupCollapsed=v("groupCollapsed");o.groupEnd=function(){$&&console.groupEnd()};let L;function v(t){return function(e,...s){if($){const n=performance.now(),i=L?Math.round(n-L):0;L=n,console[t](`%cuserflow %c${e} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const Je=()=>T(()=>import("./ResourceCenterApp.js").then(t=>t.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]));function Qe(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class M{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const s of this.observers)s()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const P=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],Xe=()=>T(()=>import("./BannerApp.js"),__vite__mapDeps([31,1,2,3,4,5,6,7,16,13,14,15,10,11,12,9,8,17,19,20,18,21,30,22,32,33])),_="1019820",Ze=import.meta.url,B=50,qe=5*60*1e3,H="userflowClientState",I="userflowClientSiteId";class et{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{o(`builder ${e.kind} message received`,e);const s="idempotencyKey"in e&&typeof e.idempotencyKey=="string"?e.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),d.setItem("previewFlowId",e.flowId),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(i=>({...i,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const i=()=>{const r=this.resourceCenterSession;r&&r.draftMode&&r.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",i))};this.on("resourceCenterChanged",i),i()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),B))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(e,s)=>{d.setItem(I,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await T(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([34,1,2,3,4,5,6,7,19,20,35,36,37,38,39,40,41,42,43,44,27,16,13,14,15,10,11,12,21,9,45,28,46,47,32,33]));new n(this,e).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+_),Z(this.onUrlChange),this.setTargetEnv(new ee),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of P)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),W(this.onUrlChange),this.destroyTargetEnv();for(const e of P)document.removeEventListener(e,this.remountIfNecessary)}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new h("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const s=e(this.getSessionStorageState());d.setItem(H,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=d.getItem(H);if(s)try{e=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=e}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState(i=>({...i,testUser:e})),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const s=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:n}=e;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(e=>({...e,testUser:null}))}init(e){if(o("init",e),!e)throw new h("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==e){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=e,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new h("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new h("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new h("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const e=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||e+"userflow.com";new URL(Ze).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new z(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
4
+ Error message: `+e.message)}}return t}let F="";try{F=localStorage.getItem("debug")||""}catch{}const $=F.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=v("log");o.group=v("group");o.groupCollapsed=v("groupCollapsed");o.groupEnd=function(){$&&console.groupEnd()};let L;function v(t){return function(e,...s){if($){const n=performance.now(),i=L?Math.round(n-L):0;L=n,console[t](`%cuserflow %c${e} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const Qe=()=>T(()=>import("./ResourceCenterApp.js").then(t=>t.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]));function Xe(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class M{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const s of this.observers)s()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const P=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],Ze=()=>T(()=>import("./BannerApp.js"),__vite__mapDeps([31,1,2,3,4,5,6,7,16,13,14,15,10,11,12,9,8,17,19,20,18,21,30,22,32,33])),_="1019826",qe=import.meta.url,B=50,et=5*60*1e3,H="userflowClientState",I="userflowClientSiteId";class tt{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{o(`builder ${e.kind} message received`,e);const s="idempotencyKey"in e&&typeof e.idempotencyKey=="string"?e.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),d.setItem("previewFlowId",e.flowId),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(i=>({...i,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const i=()=>{const r=this.resourceCenterSession;r&&r.draftMode&&r.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",i))};this.on("resourceCenterChanged",i),i()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),B))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(e,s)=>{d.setItem(I,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await T(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([34,1,2,3,4,5,6,7,19,20,35,36,37,38,39,40,41,42,43,44,27,16,13,14,15,10,11,12,21,9,45,28,46,47,32,33]));new n(this,e).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+_),Z(this.onUrlChange),this.setTargetEnv(new ee),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of P)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),W(this.onUrlChange),this.destroyTargetEnv();for(const e of P)document.removeEventListener(e,this.remountIfNecessary)}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new h("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const s=e(this.getSessionStorageState());d.setItem(H,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=d.getItem(H);if(s)try{e=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=e}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState(i=>({...i,testUser:e})),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const s=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:n}=e;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(e=>({...e,testUser:null}))}init(e){if(o("init",e),!e)throw new h("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==e){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=e,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new h("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new h("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new h("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const e=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||e+"userflow.com";new URL(qe).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new z(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
5
5
  Details:
6
- `+i.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await T(()=>import("./implicit-tracking.js"),__vite__mapDeps([48,12,2,33,32])).then(e=>{this.implicitTracking=new e.ImplicitTracking(this),this.implicitTracking.start()}).catch(e=>o(`Implicit tracking failed to load ${e}`))}makeChannelJoinPayload(){let e;d.getItem(I)&&(e=new URL(m()).searchParams.get("announcement_id")||void 0);const n=this.buildClientContext();this.clientContext=n;const i={protocolVersion:2,userflowClientBuild:_,signature:this.signature,groupExternalId:this.groupId,groupSignature:this.groupSignature,flowSessionId:this.flowSession?.id||null,checklistSessionId:this.checklistSession?.id||null,bannerSessionId:this.bannerSession?.id||null,resourceCenterSessionId:this.resourceCenterSession?.id||null,siteSessionId:this.siteSession?.id||null,launchers:this.launcherSessions.map(r=>({flowId:r.flow.id})),trackers:Array.from(this.trackers.values()).map(r=>({flowId:r.tracker.flowId})),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map(r=>({conditionId:r.condition.id,isTrue:r.isTrue})),previewFlowId:d.getItem("previewFlowId"),announcementPreviewId:e,clientContext:n};return o("channel join payload",i),i}disconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.socket&&this.socket.disconnect(),this._socketStatus="disconnected",this.socket=null,this.channel=null}debounceInactiveDisconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.debounceInactiveDisconnectTimeout=window.setTimeout(()=>{if(this.hasDraftSession()||this.assistantMessageInProgress){this.debounceInactiveDisconnect();return}o("disconnecting from socket due to inactivity"),this.disconnect()},qe)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.bannerSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some(e=>e.draftMode)}async send(e,{batch:s,endBatch:n,handlesRejection:i}={}){return(!this.inBatch||!["ToggleClientCondition","UpdateClientContext"].includes(e.kind))&&this.checkPushRateLimit(),this.ensureConnected(),s&&!this.inBatch&&(this.inBatch=!0,this.sendRaw({kind:"BeginBatch"})),this.inBatch&&(window.clearTimeout(this.endBatchTimeout),n?this.endBatch():this.endBatchTimeout=window.setTimeout(()=>{this.endBatch()},B)),this.sendRaw(e,{handlesRejection:i})}clearInitialMessagesQueue(e){if(this.initialMessagesQueue.length===0)return;const s=e.includes("cff_disable_page_views")===!0,n=e.includes("cff_implicit_events")===!1;for(const i of this.initialMessagesQueue){const{message:r,handlesRejection:a,resolve:u,reject:c}=i;if(n&&r.kind==="TrackRawEvent"){u("skipped due to disabled implicit events");continue}if(s&&(r.kind==="TrackEvent"&&r.name==="page_viewed"||r.kind==="TrackRawEvent"&&r.name==="page_viewed")){u("skipped due to disabled page views tracking");continue}this._sendToChannel(r,u,c,{handlesRejection:a})}this.initialMessagesQueue=[]}async sendRaw(e,{handlesRejection:s}={}){return typeof this.featureFlags>"u"?new Promise((n,i)=>{this.initialMessagesQueue.push({message:e,resolve:n,reject:i,handlesRejection:s})}):new Promise((n,i)=>{this._sendToChannel(e,n,i,{handlesRejection:s})})}_sendToChannel(e,s,n,{handlesRejection:i}={}){if(!this.channel){const c=`Userflow.js: send() should not be called if channel is not set. Message kind=${e.kind}`;if(i)throw Error(c);console.log(c,`
6
+ `+i.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await T(()=>import("./implicit-tracking.js"),__vite__mapDeps([48,12,2,33,32])).then(e=>{this.implicitTracking=new e.ImplicitTracking(this),this.implicitTracking.start()}).catch(e=>o(`Implicit tracking failed to load ${e}`))}makeChannelJoinPayload(){let e;d.getItem(I)&&(e=new URL(m()).searchParams.get("announcement_id")||void 0);const n=this.buildClientContext();this.clientContext=n;const i={protocolVersion:2,userflowClientBuild:_,signature:this.signature,groupExternalId:this.groupId,groupSignature:this.groupSignature,flowSessionId:this.flowSession?.id||null,checklistSessionId:this.checklistSession?.id||null,bannerSessionId:this.bannerSession?.id||null,resourceCenterSessionId:this.resourceCenterSession?.id||null,siteSessionId:this.siteSession?.id||null,launchers:this.launcherSessions.map(r=>({flowId:r.flow.id})),trackers:Array.from(this.trackers.values()).map(r=>({flowId:r.tracker.flowId})),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map(r=>({conditionId:r.condition.id,isTrue:r.isTrue})),previewFlowId:d.getItem("previewFlowId"),announcementPreviewId:e,clientContext:n};return o("channel join payload",i),i}disconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.socket&&this.socket.disconnect(),this._socketStatus="disconnected",this.socket=null,this.channel=null}debounceInactiveDisconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.debounceInactiveDisconnectTimeout=window.setTimeout(()=>{if(this.hasDraftSession()||this.assistantMessageInProgress){this.debounceInactiveDisconnect();return}o("disconnecting from socket due to inactivity"),this.disconnect()},et)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.bannerSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some(e=>e.draftMode)}async send(e,{batch:s,endBatch:n,handlesRejection:i}={}){return(!this.inBatch||!["ToggleClientCondition","UpdateClientContext"].includes(e.kind))&&this.checkPushRateLimit(),this.ensureConnected(),s&&!this.inBatch&&(this.inBatch=!0,this.sendRaw({kind:"BeginBatch"})),this.inBatch&&(window.clearTimeout(this.endBatchTimeout),n?this.endBatch():this.endBatchTimeout=window.setTimeout(()=>{this.endBatch()},B)),this.sendRaw(e,{handlesRejection:i})}clearInitialMessagesQueue(e){if(this.initialMessagesQueue.length===0)return;const s=e.includes("cff_disable_page_views")===!0,n=e.includes("cff_implicit_events")===!1;for(const i of this.initialMessagesQueue){const{message:r,handlesRejection:a,resolve:u,reject:c}=i;if(n&&r.kind==="TrackRawEvent"){u("skipped due to disabled implicit events");continue}if(s&&(r.kind==="TrackEvent"&&r.name==="page_viewed"||r.kind==="TrackRawEvent"&&r.name==="page_viewed")){u("skipped due to disabled page views tracking");continue}this._sendToChannel(r,u,c,{handlesRejection:a})}this.initialMessagesQueue=[]}async sendRaw(e,{handlesRejection:s}={}){return typeof this.featureFlags>"u"?new Promise((n,i)=>{this.initialMessagesQueue.push({message:e,resolve:n,reject:i,handlesRejection:s})}):new Promise((n,i)=>{this._sendToChannel(e,n,i,{handlesRejection:s})})}_sendToChannel(e,s,n,{handlesRejection:i}={}){if(!this.channel){const c=`Userflow.js: send() should not be called if channel is not set. Message kind=${e.kind}`;if(i)throw Error(c);console.log(c,`
7
7
  Client message:`,e);return}o(`push ${e.kind} message`,e);const r=this.clientClock,a=()=>{this.serverClock=r,this.channel?.off("phx_error",u)},u=this.channel.on("phx_error",c=>{a();const l=`Userflow.js send ${e.kind} got phx_error`;this._socketStatus==="connected"&&console.log(l,`
8
8
  Client message:`,e,`
9
9
  Error:`,c),i&&n(new h(l))});this.channel.push("client_message",e).receive("ok",c=>{a(),s(c)}).receive("error",c=>{a();const l=`Userflow.js error reply (${c.code}): ${c.message}`;console.log(l,`
@@ -14,5 +14,5 @@ Error:`,c),i&&n(new h(l,c.code,c.message))})}endBatch(){this.inBatch=!1,this.sen
14
14
  - The URL changing too frequently. Look into https://userflow.com/docs/userflow-js#seturlfilter and filter out the changing part of the URL.
15
15
  - The user legitimately being very active, in which case you can just ignore this error.
16
16
 
17
- If in doubt, reach out to us at support@userflow.com.`);this.pushRateLimitMinute++}handleServerMessage(e){o(`received ${e.kind} message`,e);const{serverClock:s,flowSession:n,flowSessionClock:i,checklistSession:r,checklistSessionClock:a,bannerSession:u,resourceCenterSession:c}=this;switch(e.kind){case"CheckSessionsAck":this.emit("private:checkSessionsAck");return;case"ServerDebug":return;case"AddLauncher":{const{session:l}=e,g=this.launcherSessions.findIndex(E=>E.flow.id===l.flow.id);g===-1?this.launcherSessions=[...this.launcherSessions,l]:this.launcherSessions=[...this.launcherSessions.slice(0,g),l,...this.launcherSessions.slice(g+1)],this.toggleUI();return}case"AddTracker":{this.addTracker(e.tracker);return}case"AssistantMessageEventWrapper":{this.emit("private:assistantMessageEvent",e);return}case"CancelConditionWaitTimer":window.clearTimeout(this.conditionWaitTimers.get(e.conditionId)),this.conditionWaitTimers.delete(e.conditionId);return;case"ChecklistTaskCompleted":this.unackedTasks.add(e.taskCvid);return;case"ForceGoToStep":if(i>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===e.sessionId&&this.emit("gotostep",{session:n,step:{id:e.stepId}});return;case"RemoveLauncher":this.removeLauncher(e.flowId)&&this.toggleUI();return;case"RemoveTracker":{this.removeTracker(e.flowId);return}case"SetBannerSession":this.setBannerSession(e.session),this.toggleUI();return;case"SetChecklistSession":a<=s||r?.id===e.session.id?(this.setChecklistSession(e.session,s),this.toggleUI()):o(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return;case"SetFlowSession":i<=s||n?.id===e.session.id?(this.setFlowSession(e.session,s),this.emit("private:setFlowSession",e.session.version.id),this.toggleUI()):o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return;case"SetResourceCenterSession":this.setResourceCenterSession(e.session),this.toggleUI();return;case"StartConditionWaitTimer":{if(!this.conditionWaitTimers.has(e.conditionId)){const l=window.setTimeout(()=>{this.conditionWaitTimers.delete(e.conditionId),this.send({kind:"FireConditionWaitTimer",conditionId:e.conditionId},{batch:!0})},parseFloat(e.waitTime)*1e3);this.conditionWaitTimers.set(e.conditionId,l)}return}case"TestStartConditionSuccess":this.emit("private:testStartConditionSuccess");return;case"TrackClientCondition":this.trackClientCondition(e.condition);return;case"UnsetBannerSession":u?.id===e.sessionId&&(this.setBannerSession(null),this.toggleUI());return;case"UnsetChecklistSession":if(a>s){o(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return}r?.id===e.sessionId&&(this.setChecklistSession(null,s),this.toggleUI());return;case"UnsetFlowSession":if(i>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===e.sessionId&&(this.setFlowSession(null,s),this.toggleUI());return;case"UnsetResourceCenterSession":c?.id===e.sessionId&&(this.setResourceCenterSession(null),this.toggleUI());return;case"UntrackClientCondition":this.untrackClientCondition(e.conditionId);return;case"AddEmbed":{const l=this.embedSessions?.findIndex(g=>g.flow.id===e.session.flow.id);l!==void 0&&l>=0?this.embedSessions=[...this.embedSessions?.slice(0,l)||[],e.session,...this.embedSessions?.slice(l+1)||[]]:this.embedSessions=[...this.embedSessions||[],e.session],this.emit("uistatechange");break}case"RemoveEmbed":{this.embedSessions=(this.embedSessions||[]).filter(l=>l.flow.id!==e.flowId),this.emit("uistatechange");break}case"SetSiteSession":{this.siteSession=e.session,this.emit("private:siteSession",e.session);break}case"UnsetSiteSession":{this.siteSession=null,d.removeItem(I),this.emit("private:unsetSiteSession");break}default:console.warn("Userflow.js: Received unknown message",e);return}}async identify(e,s={},{signature:n}={}){if(o("identify",e),this.ensureInit(),this.testUserIdentified&&e!==this.externalId){o("identify() ignored since a test user has been identified");return}if(typeof e=="number")e=String(e);else if(!e||typeof e!="string")throw new h(`userflow.identify: First argument must be a non-empty string representing the user's ID in your database. Value received: ${JSON.stringify(e)}`);this.externalId&&e!==this.externalId&&(o("identify resetting due to new externalId"),this.reset()),this.externalId=e,this.signature=n||null,this.observeUserActivity(),await Promise.all([this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(s)},{batch:!0}),this.onFirstIdentify()]),this.emit("private:identified")}async identifyAnonymous(e={},s={}){if(!w.isSupported())throw new h("userflow.identifyAnonymous() is not supported when localStorage access is denied.");const n="anonymousId";let i=w.getItem(n);i||(i="anon-"+O(),w.setItem(n,i)),await this.identify(i,e,s)}getInitToken(){return this.clientToken}getIdentifiedUser(){return{externalId:this.externalId}}async updateUser(e={},s={}){o("updateUser"),this.ensureIdentified(),await this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(e)},{batch:!0})}async group(e,s={},{signature:n,membership:i}={}){if(o("group",e),this.ensureIdentified(),this.testUserIdentified&&e!==this.groupId){o("group() ignored since a test user has been identified");return}if(typeof e=="number")e=String(e);else if(!e||typeof e!="string")throw new h(`userflow.group: First argument must be a non-empty string representing the group's ID in your database. Value received: ${JSON.stringify(e)}`);this.groupId=e,this.groupSignature=n||null,await this.send({kind:"UpsertGroup",groupExternalId:e,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(s),membershipAttributes:this.normalizeAttributes(i)},{batch:!0})}async updateGroup(e={},s={}){o("updateGroup");const n=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:n,groupSignature:this.groupSignature,membershipAttributes:this.normalizeAttributes(s.membership),groupAttributes:this.normalizeAttributes(e)},{batch:!0})}normalizeAttributes(e){if(e==null)return{};if(typeof e!="object")throw new h("Userflow: 'attributes' must be an object.");const s={};for(const n in e){if(!e.hasOwnProperty(n))continue;if(n==="traits"){const r=e[n];Object.assign(s,this.extractLegacyTraits(r));continue}let i=e[n];if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"||i==null||Array.isArray(i))s[n]=this.normalizeAttributeLiteralOrList(n,i);else{if(typeof i!="object"||i==null)throw new h(`Userflow: Invalid value for '${n}' attribute.`);if("set"in i)s[n]={set:this.normalizeAttributeLiteralOrList(n,i.set),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("set_once"in i||"setOnce"in i)s[n]={setOnce:this.normalizeAttributeLiteralOrList(n,i.set_once??i.setOnce),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("add"in i){const r=i.add;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'add' value for '${n}' attribute. Must be a number or string.`);s[n]={add:r}}else if("subtract"in i){const r=i.subtract;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'subtract' value for '${n}' attribute. Must be a number or string.`);s[n]={subtract:r}}else if("append"in i)s[n]={append:this.normalizeAttributeLiteralOrList(n,i.append)};else if("prepend"in i)s[n]={prepend:this.normalizeAttributeLiteralOrList(n,i.prepend)};else if("remove"in i)s[n]={remove:this.normalizeAttributeLiteralOrList(n,i.remove)};else throw new h(`Userflow: Invalid value for '${n}' attribute.`)}}return s}normalizeAttributeLiteralOrList(e,s){return Array.isArray(s)?s.map(n=>this.normalizeAttributeLiteral(e,n)):this.normalizeAttributeLiteral(e,s)}normalizeAttributeLiteral(e,s){if(s==null)return null;if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")return s;throw new h(`Userflow: Invalid value for '${e}' attribute.`)}normalizeDataType(e,s){if(!s)return null;switch(s){case"string":return S.STRING;case"number":return S.NUMBER;case"boolean":return S.BOOLEAN;case"datetime":return S.DATETIME}throw new h(`Userflow: Invalid data_type for '${e}' attribute.`)}extractLegacyTraits(e){if(!e)return{};if(!Array.isArray(e)){const s=[];for(const n in e)e.hasOwnProperty(n)&&s.push({name:n,value:e[n]});e=s}return e.reduce((s,{name:n,value:i,dataType:r})=>{if(typeof n!="string"||n.length>100||!n.match(/^[a-z0-9_]+$/))return this.warn("Userflow.identify: Invalid trait name (must be string, no more than 100 characters, and only consist of a-z, 0-9 and underscores). The trait will be ignored. Name was:",n),s;if(typeof i!="string")if(typeof i=="boolean")r||(r="boolean"),i=i?"true":"false";else if(typeof i=="number")r||(r=Number.isInteger(i)?"integer":"decimal"),i=String(i);else return this.warn(`userflow.identify: The value of trait '${n}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,i),s;let a=null;if(r)switch(r){case"string":a=S.STRING;break;case"boolean":a=S.BOOLEAN;break;case"integer":a=S.NUMBER;break;case"decimal":a=S.NUMBER;break;case"datetime":a=S.DATETIME;break;default:return this.warn(`userflow.identify: The data type of trait '${n}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,r),s}return s[n]={set:i,dataType:a},s},{})}async track(e,s={},{userOnly:n}={}){o(`track '${e}'`,s),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!n,name:e,attributes:this.normalizeEventAttributes(s)},{batch:!0})}async trackRawEvent(e){const{name:s,attributes:n}=e;o(`track raw event '${s}'`,n),this.ensureIdentified(),await this.send({kind:"TrackRawEvent",name:s,attributes:this.normalizeEventAttributes(n)})}normalizeEventAttributes(e){const s=this.normalizeAttributes(e);for(const n in s){if(!s.hasOwnProperty(n))continue;const i=s[n];if(!(i==null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||Array.isArray(i)||"set"in i))throw new h(`Userflow: Invalid value for '${n}' attribute. Event attributes only support literal values, list values and 'set' changes.`)}return s}onFirstIdentify(){this.onFirstIdentifyRun||(this.onFirstIdentifyRun=!0,this.onFirstIdentifyTimeout=window.setTimeout(()=>{this.trackPageViewed(),this.firstIdentifyCallback?(this.firstIdentifyCallback(),this.firstIdentifyCallback=null):this.checkUrlForStartFlow()},0))}onceIdentified(e){this.isIdentified()?e():this.firstIdentifyCallback=e}checkUrlForStartFlow(){const e=new URL(m()),s=e.searchParams.get("userflow")||e.searchParams.get("studio1_flow")||e.searchParams.get("studio1_walkthrough");s&&(o(`url contained flow ${s}`),this.startFlow({flowId:s,startReason:p.LINK,batch:!0}),e.searchParams.delete("userflow"),e.searchParams.delete("studio1_flow"),e.searchParams.delete("studio1_walkthrough"),window.history.replaceState({},"",e.toString()),this.clientContext=this.buildClientContext(),this.pushUpdateClientContext())}flushUrlChange(){const e=this.buildClientContext();(!this.clientContext||e.pageUrl!==this.clientContext.pageUrl)&&(this.clientContext=e,this.pushUpdateClientContext(),this.trackPageViewed(),this.checkUrlForStartFlow())}async trackPageViewed(){this.featureFlags&&this.featureFlagEnabled("cff_disable_page_views")===!0||(this.pageTrackingDisabled||this.track("page_viewed",{}),this.trackRawPageViewed())}async trackRawPageViewed(){this.featureFlags&&(this.featureFlagEnabled("cff_implicit_events")===!1||this.featureFlagEnabled("cff_disable_page_views")===!0)||this.trackRawEvent({name:"page_viewed",attributes:{id:O(),page_title:document.title,...this.buildClientContext()}})}buildClientContext(){let e=null;const s=d.getItem(I);if(s){const i=new URL(m()).pathname.match(/^\/([^/]+)\/?(?:\/([^/]+)\/?)?$/);i&&(e=i[1])}return{pageUrl:ze(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,...s&&{siteId:s},...e&&{localeCode:e}}}pushUpdateClientContext(){this.send({kind:"UpdateClientContext",clientContext:this.clientContext},{batch:!0})}ackCompletedTask(e){this.unackedTasks.delete(e)}taskIsUnacked(e){return this.unackedTasks.has(e)}isIdentified(){return this.externalId!=null}on(e,s){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(s)}off(e,s){const n=this.listeners.get(e);n&&n.delete(s)}emit(e,...s){const n=this.listeners.get(e);n&&Array.from(n).forEach(r=>r(...s))}observeUserActivity(){document.addEventListener("mouseover",this.onUserActivity),document.addEventListener("pointerdown",this.onUserActivity),document.addEventListener("keydown",this.onUserActivity)}unobserveUserActivity(){document.removeEventListener("mouseover",this.onUserActivity),document.removeEventListener("pointerdown",this.onUserActivity),document.removeEventListener("keydown",this.onUserActivity)}reset(){o("reset"),this.externalId=null,this.groupId=null,this.sessionStorageState=null,this.setFlowSession(null,0),this.setChecklistSession(null,0),this.setBannerSession(null),this.setResourceCenterSession(null),this.resourceCenterLauncherHidden=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.unackedTasks=new Set,this.onFirstIdentifyRun=!1,window.clearTimeout(this.onFirstIdentifyTimeout),this.onFirstIdentifyTimeout=void 0,this.clientContext=null,this.unobserveUserActivity(),window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=void 0,this.clientConditions.forEach((e,s)=>{this.untrackClientCondition(s)}),this.firstIdentifyCallback=null,this.testUserIdentified=!1,w.removeItem("anonymousId"),this.unmountUI(),this.disconnect(),this.inBatch=!1,window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=void 0,this.clientClock=1,this.serverClock=1,this.titleMonitored=void 0,this.titleObserver&&(this.titleObserver.disconnect(),this.titleObserver=void 0)}async startFlow({flowId:e,stepCvid:s,startReason:n,once:i,batch:r,replaceCurrent:a}){if(this.ensureIdentified(),a&&this.flowSession&&this.endFlow(this.flowSession,{endReason:k.REPLACED,batch:!0}),o(`startFlow ${e}`,{startReason:n}),this.checklistSession?.flow.id===e){o("startFlow matches current checklist, so showing it instead"),this.showChecklist();return}const u={kind:"StartFlow",flowId:e,stepCvid:s,startReason:n,once:!!i};await this.send(u,{batch:r})}async trackButtonEvent(e,s,n,i){const r={kind:"TrackButtonEvent",eventName:e,stepCvid:n,sessionId:i,token:s};await this.send(r,{batch:!0})}async startFlowWithToken(e){this.ensureIdentified(),o("startFlowWithToken",{token:e}),await this.send({kind:"StartFlowWithToken",token:e},{batch:!0})}optimisticClockUIUpdate(e){this.clientClock++,e(),this.toggleUI()}async showChecklist(){if(this.resourceCenterEmbedsChecklist()&&!this.embedChecklistSessions()){this.openResourceCenter();return}this.embedChecklistSessions()||(this.unmarkExpandPending(),!(!this.checklistSession||this.checklistExpanded)&&(this.ensureIdentified(),this.checklistExpanded=!0,this.toggleUI(),d.setItem(`checklistExpanded:${this.checklistSession.id}`,"1"),await this.send({kind:"ShowChecklist",sessionId:this.checklistSession.id},{batch:!0})))}async hideChecklist(){if(this.resourceCenterEmbedsChecklist()){this.closeResourceCenter();return}!this.checklistSession||!this.checklistExpanded||(this.ensureIdentified(),this.checklistExpanded=!1,this.toggleUI(),d.removeItem(`checklistExpanded:${this.checklistSession.id}`),await this.send({kind:"HideChecklist",sessionId:this.checklistSession.id},{batch:!0}))}async unmarkExpandPending(){!this.checklistSession||!this.checklistExpandPending||(this.checklistExpandPending=!1,await this.send({kind:"UnmarkExpandPending",sessionId:this.checklistSession.id},{batch:!0}))}async openResourceCenter(){this.resourceCenterEmbedsChecklist()&&this.unmarkExpandPending(),!(!this.resourceCenterSession||this.resourceCenterOpen)&&(this.ensureIdentified(),this.resourceCenterOpen=!0,this.toggleUI(),this.emit("resourceCenterChanged"),d.setItem(`resourceCenterOpen:${this.resourceCenterSession.id}`,"1"),await this.send({kind:"OpenResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}async closeResourceCenter(){!this.resourceCenterSession||!this.resourceCenterOpen||(this.ensureIdentified(),this.resourceCenterOpen=!1,this.toggleUI(),this.emit("resourceCenterChanged"),d.removeItem(`resourceCenterOpen:${this.resourceCenterSession.id}`),await this.send({kind:"CloseResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}toggleResourceCenter(){this.resourceCenterOpen?this.closeResourceCenter():this.openResourceCenter()}setResourceCenterLauncherHidden(e){this.resourceCenterLauncherHidden=e,this.toggleUI()}getResourceCenterState(){if(!this.resourceCenterSession)return null;const e=this.resourceCenterEmbedsChecklist(),{checklistSession:s}=this,n=this.resourceCenterSession.version.resourceCenter?.blocks.find(i=>i.type===A.ANNOUNCEMENTS);return{isOpen:this.resourceCenterOpen,hasChecklist:e,uncompletedChecklistTaskCount:e&&s?Qe(s):0,unreadAnnouncementCount:n?.unreadAnnouncementCount||0}}resourceCenterEmbedsChecklist(){const e=this.resourceCenterSession;return!!e&&!!e.version.resourceCenter?.blocks.some(s=>s.type===A.CHECKLIST)}embedChecklistSessions(){return this.embedSessions.some(e=>!!e.version.embed?.blocks?.some(s=>s.type===K.CHECKLIST))}async endFlow(e,{endReason:s,batch:n}){this.ensureIdentified(),this.optimisticClockUIUpdate(()=>{const{clientClock:u}=this;this.flowSession?.id===e.id&&this.setFlowSession(null,u),this.checklistSession?.id===e.id&&this.setChecklistSession(null,u),this.bannerSession?.id===e.id&&this.setBannerSession(null),this.resourceCenterSession?.id===e.id&&this.setResourceCenterSession(null)});const{flow:i}=e,r={id:i.id,type:i.type.toLowerCase()};i.type===U.CHECKLIST?this.emit("checklistEnded",{checklist:r,endReason:s}):i.type===U.FLOW&&this.emit("flowEnded",{flow:r,endReason:s});const a={kind:"EndFlow",sessionId:e.id,endReason:s};await this.send(a,{batch:n})}async goToStep(e,s){o("goToStep",e.id,s.name||s.id),this.ensureIdentified();const n=this.send({kind:"GoToStep",sessionId:e.id,stepId:s.id});e.currentStep=s,this.emit("gotostep",{session:e,step:s}),await n}async endAllFlows(){o("endAllFlows"),this.optimisticClockUIUpdate(()=>{const{clientClock:e}=this;this.setFlowSession(null,e),this.setChecklistSession(null,e)}),await this.send({kind:"EndAllFlows"})}async endChecklist(){o("endChecklist");const e=this.checklistSession||this.flowSession;e?.flow.type===U.CHECKLIST&&this.endFlow(e,{endReason:k.USERFLOWJS})}setFlowSession(e,s=this.clientClock){const n=this.flowSession;this.flowSession=e,this.flowSessionClock=s,e&&!n&&(this.hideChecklist(),this.closeResourceCenter()),e==null&&this.originalActiveElement&&(typeof this.originalActiveElement.focus=="function"&&this.originalActiveElement.focus(),this.originalActiveElement=void 0)}setChecklistSession(e,s=this.clientClock){const n=this.checklistSession;this.checklistSession=e,this.checklistSessionClock=s,e===null&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),e&&e.id!==n?.id&&(this.checklistExpanded=!!d.getItem(`checklistExpanded:${e.id}`),e.expandPending&&(this.checklistExpandPending=!0)),this.emit("checklistChanged"),this.emit("resourceCenterChanged")}setBannerSession(e){this.bannerSession=e}setResourceCenterSession(e){const s=this.resourceCenterSession;e=typeof e=="function"?e(this.resourceCenterSession):e,this.resourceCenterSession=e,e===null&&(this.resourceCenterOpen=!1),s&&s.id!==e?.id&&d.removeItem(`resourceCenterOpen:${s.id}`),e&&e.id!==s?.id&&(this.resourceCenterOpen=!!d.getItem(`resourceCenterOpen:${e.id}`)),this.emit("resourceCenterChanged")}launcherSeen(e){this.send({kind:"StartFlow",flowId:e,startReason:p.LAUNCHER_SEEN,once:!1})}activateLauncher(e){const s=this.activeLauncherFlowId&&this.launcherSessions.find(n=>n.flow.id===this.activeLauncherFlowId);s&&this.deactivateLauncher(s),this.activeLauncherFlowId=e.flow.id,this.toggleUI(),this.send({kind:"ActivateLauncher",flowId:e.flow.id})}deactivateLauncher(e){const{launcher:s}=e.version;e.flow.id===this.activeLauncherFlowId&&(s?.dismissOn===V.DEACTIVATE?this.dismissLauncher(e,{endReason:k.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(e,{endReason:s}){const n=e.flow.id;this.removeLauncher(n),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:n,endReason:s})}removeLauncher(e){const s=this.launcherSessions.findIndex(n=>n.flow.id===e);return s===-1?!1:(this.launcherSessions=[...this.launcherSessions.slice(0,s),...this.launcherSessions.slice(s+1)],e===this.activeLauncherFlowId&&(this.activeLauncherFlowId=null),!0)}async toggleUI(){const e=this.getSessionStorageState();!this.flowSession&&(this.checklistExpandPending||this.checklistSession?.version.checklist?.tasks.some(s=>this.taskIsUnacked(s.cvid)))&&this.showChecklist(),e.isTargetTab&&this.monitorTitle(),this.emit("uistatechange"),this.shouldBeMounted()?await this.mountUI():this.unmountUI()}shouldBeMounted(){return this.uiDisabled||this.siteSession?.id||d.getItem(I)?!1:!!this.getSessionStorageState().activeApp||!!this.flowSession||!!this.checklistSession&&(this.checklistExpanded||!!this.checklistSession?.version.checklist?.launcherEnabled)||!!this.bannerSession||!!this.resourceCenterSession||this.launcherSessions.length>0||this.notifications.length>0}async mountUI(){if(!this.ui){const e=await this.createUI();this.shouldBeMounted()&&!this.ui&&(o("mount UI"),this.ui=e,this.ui.mount())}}unmountUI(){this.ui&&(o("unmount UI"),this.ui.unmount(),this.ui=null)}checkDebuggerSession(){if(this.debuggerUI)return;const e=this.sessionStorageState?.debuggerApp;e&&e?.x&&e?.y&&this.mountDebugger()}async mountDebugger(){if(!this.debuggerMountInProgress){if(this.debuggerUI){this.debuggerUI.unmount();return}this.debuggerMountInProgress=!0;try{const{DebuggerUI:e}=await T(async()=>{const{DebuggerUI:s}=await import("./DebuggerUI.js");return{DebuggerUI:s}},__vite__mapDeps([49,1,2,3,19,20,4,5,6,7,18,13,14,15,10,11,12,21,23,16,47,50,51,45,52,46,28,32,33]));this.debuggerUI=new e(this,_),this.debuggerUI.mount()}catch(e){console.error("Userflow: Failed to mount debugger UI",e)}finally{this.debuggerMountInProgress=!1}}}unMountDebugger(){this.debuggerUI=null}remount(){this.unmountUI(),this.toggleUI()}async createUI(){try{const e=T(()=>import("./ui.js"),__vite__mapDeps([53,1,2,3,19,20,4,5,6,7,32,33]));this.bannerSession&&Xe(),this.resourceCenterSession&&Je();const{RealUI:s}=await e;return new s(this)}catch(e){throw this.reportCspIssue(),e}}async trackClientCondition(e){if(this.clientConditions.has(e.id))return;o("track client condition",e),this.clientConditions.set(e.id,{condition:e,isTrue:null});const{conditionTypes:s}=await T(async()=>{const{conditionTypes:r}=await import("./flow-condition-types.js").then(a=>a.f);return{conditionTypes:r}},__vite__mapDeps([10,2,11,6,12])),n=s[e.type],i=this.clientConditions.get(e.id);i&&(i.untrack=n.track({sessionData:new M([]),condition:e,callback:r=>{i.isTrue!==r&&(o("client condition truthiness changed",r,i.condition),i.isTrue=r,this.send({kind:"ToggleClientCondition",conditionId:e.id,isTrue:r},{batch:!0}))}}))}untrackClientCondition(e){const s=this.clientConditions.get(e);s&&(o("untrack client condition",s.condition),s.untrack&&s.untrack(),this.clientConditions.delete(e))}async addTracker(e){let s=this.trackers.get(e.flowId);s?s.tracker=e:this.trackers.set(e.flowId,{tracker:e,isTrue:!1});const{conditionTypes:n}=await T(async()=>{const{conditionTypes:c}=await import("./flow-condition-types.js").then(l=>l.f);return{conditionTypes:c}},__vite__mapDeps([10,2,11,6,12])),i=this.trackers.get(e.flowId);if(!i)return;const{tracker:r}=i,{condition:a}=r,u=n[a.type];i.untrack&&i.untrack(),i.untrack=u.track({sessionData:new M(r.data),condition:a,flipBackEvents:!0,callback:c=>{const l=i.isTrue;i.isTrue=c,!l&&c&&this.send({kind:"TrackTrackerEvent",token:r.token},{batch:!0})},description:`event tracker ${r.flowId}`}),this.emit("private:trackerStarted")}removeTracker(e){const s=this.trackers.get(e);s&&(s.untrack&&s.untrack(),this.trackers.delete(e),this.emit("private:trackerStopped"))}monitorTitle(){if(this.titleMonitored)return;this.titleMonitored=!0,this.fixTitle();const e=document.querySelector("title");if(e){const s=new MutationObserver(()=>{this.fixTitle()});s.observe(e,{childList:!0}),this.titleObserver=s}}fixTitle(){const e=document.title,n="[Userflow Preview] "+e.replace(/\[Userflow Preview\]\s*/g,"");e!==n&&(document.title=n)}reportCspIssue(){const e=this.getSessionStorageState();(this.testUserIdentified||e.activeApp)&&!this.cspIssueReported&&(this.cspIssueReported=!0,o("csp issue detected"),N({kind:"userflow:crxCspIssueDetected"}))}getAudio(){return this.audio||(this.audio=new Audio),this.audio}playAudio(e){if(document.hidden)return;const s=this.getAudio();e&&(s.src=e);const n=s.play();this.audioReady=!0,n&&n.catch(i=>{i.name})}pauseAudio(){const e=this.audio;e&&!e.paused&&e.pause()}async getStepSpeech(e,s){return(await this.send({kind:"GetStepSpeechV2",syntheticVoice:e,text:s})).url}featureFlagEnabled(e){return this.featureFlags?this.featureFlags.has(e):!1}showNotification(e,s,n){const r={id:++this.notificationIdCounter,label:e,message:s,type:n};this.notifications=[...this.notifications,r],this.toggleUI()}dismissNotification(e){this.notifications=this.notifications.filter(s=>s.id!==e),this.toggleUI()}warn(...e){console.warn(...e)}nextRef(){return this.refCounter++}}if(typeof window.userflow>"u"||window.userflow._stubbed){const t=Object.assign(window.userflow||{},tt());window.userflow=t,window.studio1=t,st()}function tt(){const t=new et;return{_stubbed:!1,init(e){t.init(e)},identify(e,s={},n={}){return t.identify(e,s,n)},identifyAnonymous(e={},s={}){return t.identifyAnonymous(e,s)},isIdentified(){return t.isIdentified()},updateUser(e,s={}){return t.updateUser(e,s)},group(e,s={},n={}){return t.group(e,s,n)},updateGroup(e,s={}){return t.updateGroup(e,s)},track(e,s={},n={}){return t.track(e,s,n)},start(e,{once:s}={}){return t.startFlow({flowId:e,startReason:p.USERFLOWJS,once:s})},startFlow(e){return console.warn("Userflow.js: userflow.startFlow() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)},startWalk(e){return console.warn("Userflow.js: userflow.startWalk() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)},endAll(){return t.endAllFlows()},endChecklist(){return t.endChecklist()},endAllFlows(){"Userflow.js: userflow.endAllFlows() has been deprecated. Use userflow.endAll() instead.";return window.userflow.endAll()},async endFlow(){console.warn("Userflow.js: userflow.endFlow() has been deprecated and no longer has any effect.")},async endWalk(){console.warn("Userflow.js: userflow.endWalk() has been deprecated and no longer has any effect.")},openResourceCenter(){t.openResourceCenter()},closeResourceCenter(){t.closeResourceCenter()},toggleResourceCenter(){t.toggleResourceCenter()},setResourceCenterLauncherHidden(e){t.setResourceCenterLauncherHidden(e)},getResourceCenterState(){return t.getResourceCenterState()},setWalkPosition(){console.warn("Userflow.js: userflow.setWalkPosition() has been deprecated and no longer has any effect.")},reset(){t.reset()},remount(){t.remount()},on(e,s){t.on(e,s)},off(e,s){t.off(e,s)},setCustomInputSelector(e){console.warn("Userflow.js: userflow.setCustomInputSelector() has been deprecated. Use userflow.registerCustomInput() instead. See docs: https://userflow.com/docs/userflow-js"),e&&f.customInputs.push({cssSelector:e})},registerCustomInput(e,s){f.customInputs.push({cssSelector:e,getValue:s})},setCustomNavigate(e){f.customNavigate=e},setUrlFilter(e){f.urlFilter=e},setLinkUrlDecorator(e){f.linkUrlDecorator=e,t.emit("uistatechange")},setInferenceAttributeNames(e){f.inferenceAttributeNames=e},setInferenceAttributeFilter(e,s){f.inferenceAttributeFilters[e]=y(s)},setInferenceClassNameFilter(e){f.inferenceClassNameFilters=y(e)},setScrollPadding(e){f.scrollPadding=e},setCustomScrollIntoView(e){f.customScrollIntoView=e},prepareAudio(){t.playAudio(null)},setShadowDomEnabled(e){console.warn("Userflow.js: userflow.setShadowDomEnabled() has been deprecated. Please remove this call from your Userflow.js snippet. Shadow DOM is supported by default now.")},setPageTrackingDisabled(e){t.pageTrackingDisabled=e},setBaseZIndex(e){f.baseZIndex=e},setServerEndpoint(e){f.serverEndpoint=e},disableEvalJs(){f.evalJsDisabled=!0},_setTargetEnv(e){t.setTargetEnv(e)},debugger(){return t.mountDebugger()},mountSitePage(e,s){return t.mountSitePage(e,s)}}}function st(){const t=window.userflow,e=window.USERFLOWJS_QUEUE;if(delete window.USERFLOWJS_QUEUE,!(!e||e.length===0)){o(`processing ${e.length} items in the queue`);for(const[s,n,i]of e){if(typeof t[s]!="function"){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const r=t[s](...i);n&&r&&typeof r.then=="function"&&r.then(n.resolve,n.reject)}o("queue processed")}}var ct=window.userflow;export{Ge as $,S as A,Xe as B,d as C,ve as D,k as E,ne as F,f as G,De as H,me as I,Ce as J,_e as K,Oe as L,ge as M,p as N,je as O,Ie as P,be as Q,Je as R,ce as S,ke as T,h as U,Ue as V,Fe as W,xe as X,Me as Y,Pe as Z,T as _,U as a,Be as a0,He as a1,Le as a2,fe as a3,ot as a4,m as a5,Ne as a6,Ae as a7,Se as a8,ze as a9,Z as aa,W as ab,ae as ac,at as ad,P as ae,$e as af,se as ag,ue as b,le as c,o as d,ct as default,te as e,oe as f,Ke as g,ie as h,he as i,M as j,ye as k,We as l,re as m,G as n,X as o,w as p,we as q,pe as r,Te as s,Re as t,N as u,de as v,Ee as w,Qe as x,Ve as y,A as z};
17
+ If in doubt, reach out to us at support@userflow.com.`);this.pushRateLimitMinute++}handleServerMessage(e){o(`received ${e.kind} message`,e);const{serverClock:s,flowSession:n,flowSessionClock:i,checklistSession:r,checklistSessionClock:a,bannerSession:u,resourceCenterSession:c}=this;switch(e.kind){case"CheckSessionsAck":this.emit("private:checkSessionsAck");return;case"ServerDebug":return;case"AddLauncher":{const{session:l}=e,g=this.launcherSessions.findIndex(E=>E.flow.id===l.flow.id);g===-1?this.launcherSessions=[...this.launcherSessions,l]:this.launcherSessions=[...this.launcherSessions.slice(0,g),l,...this.launcherSessions.slice(g+1)],this.toggleUI();return}case"AddTracker":{this.addTracker(e.tracker);return}case"AssistantMessageEventWrapper":{this.emit("private:assistantMessageEvent",e);return}case"CancelConditionWaitTimer":window.clearTimeout(this.conditionWaitTimers.get(e.conditionId)),this.conditionWaitTimers.delete(e.conditionId);return;case"ChecklistTaskCompleted":this.unackedTasks.add(e.taskCvid);return;case"ForceGoToStep":if(i>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===e.sessionId&&this.emit("gotostep",{session:n,step:{id:e.stepId}});return;case"RemoveLauncher":this.removeLauncher(e.flowId)&&this.toggleUI();return;case"RemoveTracker":{this.removeTracker(e.flowId);return}case"SetBannerSession":this.setBannerSession(e.session),this.toggleUI();return;case"SetChecklistSession":a<=s||r?.id===e.session.id?(this.setChecklistSession(e.session,s),this.toggleUI()):o(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return;case"SetFlowSession":i<=s||n?.id===e.session.id?(this.setFlowSession(e.session,s),this.emit("private:setFlowSession",e.session.version.id),this.toggleUI()):o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return;case"SetResourceCenterSession":this.setResourceCenterSession(e.session),this.toggleUI();return;case"StartConditionWaitTimer":{if(!this.conditionWaitTimers.has(e.conditionId)){const l=window.setTimeout(()=>{this.conditionWaitTimers.delete(e.conditionId),this.send({kind:"FireConditionWaitTimer",conditionId:e.conditionId},{batch:!0})},parseFloat(e.waitTime)*1e3);this.conditionWaitTimers.set(e.conditionId,l)}return}case"TestStartConditionSuccess":this.emit("private:testStartConditionSuccess");return;case"TrackClientCondition":this.trackClientCondition(e.condition);return;case"UnsetBannerSession":u?.id===e.sessionId&&(this.setBannerSession(null),this.toggleUI());return;case"UnsetChecklistSession":if(a>s){o(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return}r?.id===e.sessionId&&(this.setChecklistSession(null,s),this.toggleUI());return;case"UnsetFlowSession":if(i>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===e.sessionId&&(this.setFlowSession(null,s),this.toggleUI());return;case"UnsetResourceCenterSession":c?.id===e.sessionId&&(this.setResourceCenterSession(null),this.toggleUI());return;case"UntrackClientCondition":this.untrackClientCondition(e.conditionId);return;case"AddEmbed":{const l=this.embedSessions?.findIndex(g=>g.flow.id===e.session.flow.id);l!==void 0&&l>=0?this.embedSessions=[...this.embedSessions?.slice(0,l)||[],e.session,...this.embedSessions?.slice(l+1)||[]]:this.embedSessions=[...this.embedSessions||[],e.session],this.emit("uistatechange");break}case"RemoveEmbed":{this.embedSessions=(this.embedSessions||[]).filter(l=>l.flow.id!==e.flowId),this.emit("uistatechange");break}case"SetSiteSession":{this.siteSession=e.session,this.emit("private:siteSession",e.session);break}case"UnsetSiteSession":{this.siteSession=null,d.removeItem(I),this.emit("private:unsetSiteSession");break}default:console.warn("Userflow.js: Received unknown message",e);return}}async identify(e,s={},{signature:n}={}){if(o("identify",e),this.ensureInit(),this.testUserIdentified&&e!==this.externalId){o("identify() ignored since a test user has been identified");return}if(typeof e=="number")e=String(e);else if(!e||typeof e!="string")throw new h(`userflow.identify: First argument must be a non-empty string representing the user's ID in your database. Value received: ${JSON.stringify(e)}`);this.externalId&&e!==this.externalId&&(o("identify resetting due to new externalId"),this.reset()),this.externalId=e,this.signature=n||null,this.observeUserActivity(),await Promise.all([this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(s)},{batch:!0}),this.onFirstIdentify()]),this.emit("private:identified")}async identifyAnonymous(e={},s={}){if(!w.isSupported())throw new h("userflow.identifyAnonymous() is not supported when localStorage access is denied.");const n="anonymousId";let i=w.getItem(n);i||(i="anon-"+O(),w.setItem(n,i)),await this.identify(i,e,s)}getInitToken(){return this.clientToken}getIdentifiedUser(){return{externalId:this.externalId}}async updateUser(e={},s={}){o("updateUser"),this.ensureIdentified(),await this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(e)},{batch:!0})}async group(e,s={},{signature:n,membership:i}={}){if(o("group",e),this.ensureIdentified(),this.testUserIdentified&&e!==this.groupId){o("group() ignored since a test user has been identified");return}if(typeof e=="number")e=String(e);else if(!e||typeof e!="string")throw new h(`userflow.group: First argument must be a non-empty string representing the group's ID in your database. Value received: ${JSON.stringify(e)}`);this.groupId=e,this.groupSignature=n||null,await this.send({kind:"UpsertGroup",groupExternalId:e,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(s),membershipAttributes:this.normalizeAttributes(i)},{batch:!0})}async updateGroup(e={},s={}){o("updateGroup");const n=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:n,groupSignature:this.groupSignature,membershipAttributes:this.normalizeAttributes(s.membership),groupAttributes:this.normalizeAttributes(e)},{batch:!0})}normalizeAttributes(e){if(e==null)return{};if(typeof e!="object")throw new h("Userflow: 'attributes' must be an object.");const s={};for(const n in e){if(!e.hasOwnProperty(n))continue;if(n==="traits"){const r=e[n];Object.assign(s,this.extractLegacyTraits(r));continue}let i=e[n];if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"||i==null||Array.isArray(i))s[n]=this.normalizeAttributeLiteralOrList(n,i);else{if(typeof i!="object"||i==null)throw new h(`Userflow: Invalid value for '${n}' attribute.`);if("set"in i)s[n]={set:this.normalizeAttributeLiteralOrList(n,i.set),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("set_once"in i||"setOnce"in i)s[n]={setOnce:this.normalizeAttributeLiteralOrList(n,i.set_once??i.setOnce),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("add"in i){const r=i.add;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'add' value for '${n}' attribute. Must be a number or string.`);s[n]={add:r}}else if("subtract"in i){const r=i.subtract;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'subtract' value for '${n}' attribute. Must be a number or string.`);s[n]={subtract:r}}else if("append"in i)s[n]={append:this.normalizeAttributeLiteralOrList(n,i.append)};else if("prepend"in i)s[n]={prepend:this.normalizeAttributeLiteralOrList(n,i.prepend)};else if("remove"in i)s[n]={remove:this.normalizeAttributeLiteralOrList(n,i.remove)};else throw new h(`Userflow: Invalid value for '${n}' attribute.`)}}return s}normalizeAttributeLiteralOrList(e,s){return Array.isArray(s)?s.map(n=>this.normalizeAttributeLiteral(e,n)):this.normalizeAttributeLiteral(e,s)}normalizeAttributeLiteral(e,s){if(s==null)return null;if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")return s;throw new h(`Userflow: Invalid value for '${e}' attribute.`)}normalizeDataType(e,s){if(!s)return null;switch(s){case"string":return S.STRING;case"number":return S.NUMBER;case"boolean":return S.BOOLEAN;case"datetime":return S.DATETIME}throw new h(`Userflow: Invalid data_type for '${e}' attribute.`)}extractLegacyTraits(e){if(!e)return{};if(!Array.isArray(e)){const s=[];for(const n in e)e.hasOwnProperty(n)&&s.push({name:n,value:e[n]});e=s}return e.reduce((s,{name:n,value:i,dataType:r})=>{if(typeof n!="string"||n.length>100||!n.match(/^[a-z0-9_]+$/))return this.warn("Userflow.identify: Invalid trait name (must be string, no more than 100 characters, and only consist of a-z, 0-9 and underscores). The trait will be ignored. Name was:",n),s;if(typeof i!="string")if(typeof i=="boolean")r||(r="boolean"),i=i?"true":"false";else if(typeof i=="number")r||(r=Number.isInteger(i)?"integer":"decimal"),i=String(i);else return this.warn(`userflow.identify: The value of trait '${n}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,i),s;let a=null;if(r)switch(r){case"string":a=S.STRING;break;case"boolean":a=S.BOOLEAN;break;case"integer":a=S.NUMBER;break;case"decimal":a=S.NUMBER;break;case"datetime":a=S.DATETIME;break;default:return this.warn(`userflow.identify: The data type of trait '${n}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,r),s}return s[n]={set:i,dataType:a},s},{})}async track(e,s={},{userOnly:n}={}){o(`track '${e}'`,s),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!n,name:e,attributes:this.normalizeEventAttributes(s)},{batch:!0})}async trackRawEvent(e){const{name:s,attributes:n}=e;o(`track raw event '${s}'`,n),this.ensureIdentified(),await this.send({kind:"TrackRawEvent",name:s,attributes:this.normalizeEventAttributes(n)})}normalizeEventAttributes(e){const s=this.normalizeAttributes(e);for(const n in s){if(!s.hasOwnProperty(n))continue;const i=s[n];if(!(i==null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||Array.isArray(i)||"set"in i))throw new h(`Userflow: Invalid value for '${n}' attribute. Event attributes only support literal values, list values and 'set' changes.`)}return s}onFirstIdentify(){this.onFirstIdentifyRun||(this.onFirstIdentifyRun=!0,this.onFirstIdentifyTimeout=window.setTimeout(()=>{this.trackPageViewed(),this.firstIdentifyCallback?(this.firstIdentifyCallback(),this.firstIdentifyCallback=null):this.checkUrlForStartFlow()},0))}onceIdentified(e){this.isIdentified()?e():this.firstIdentifyCallback=e}checkUrlForStartFlow(){const e=new URL(m()),s=e.searchParams.get("userflow")||e.searchParams.get("studio1_flow")||e.searchParams.get("studio1_walkthrough");s&&(o(`url contained flow ${s}`),this.startFlow({flowId:s,startReason:p.LINK,batch:!0}),e.searchParams.delete("userflow"),e.searchParams.delete("studio1_flow"),e.searchParams.delete("studio1_walkthrough"),window.history.replaceState({},"",e.toString()),this.clientContext=this.buildClientContext(),this.pushUpdateClientContext())}flushUrlChange(){const e=this.buildClientContext();(!this.clientContext||e.pageUrl!==this.clientContext.pageUrl)&&(this.clientContext=e,this.pushUpdateClientContext(),this.trackPageViewed(),this.checkUrlForStartFlow())}async trackPageViewed(){this.featureFlags&&this.featureFlagEnabled("cff_disable_page_views")===!0||(this.pageTrackingDisabled||this.track("page_viewed",{}),this.trackRawPageViewed())}async trackRawPageViewed(){this.featureFlags&&(this.featureFlagEnabled("cff_implicit_events")===!1||this.featureFlagEnabled("cff_disable_page_views")===!0)||this.trackRawEvent({name:"page_viewed",attributes:{id:O(),page_title:document.title,...this.buildClientContext()}})}buildClientContext(){let e=null;const s=d.getItem(I);if(s){const i=new URL(m()).pathname.match(/^\/([^/]+)\/?(?:\/([^/]+)\/?)?$/);i&&(e=i[1])}return{pageUrl:Je(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,...s&&{siteId:s},...e&&{localeCode:e}}}pushUpdateClientContext(){this.send({kind:"UpdateClientContext",clientContext:this.clientContext},{batch:!0})}ackCompletedTask(e){this.unackedTasks.delete(e)}taskIsUnacked(e){return this.unackedTasks.has(e)}isIdentified(){return this.externalId!=null}on(e,s){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(s)}off(e,s){const n=this.listeners.get(e);n&&n.delete(s)}emit(e,...s){const n=this.listeners.get(e);n&&Array.from(n).forEach(r=>r(...s))}observeUserActivity(){document.addEventListener("mouseover",this.onUserActivity),document.addEventListener("pointerdown",this.onUserActivity),document.addEventListener("keydown",this.onUserActivity)}unobserveUserActivity(){document.removeEventListener("mouseover",this.onUserActivity),document.removeEventListener("pointerdown",this.onUserActivity),document.removeEventListener("keydown",this.onUserActivity)}reset(){o("reset"),this.externalId=null,this.groupId=null,this.sessionStorageState=null,this.setFlowSession(null,0),this.setChecklistSession(null,0),this.setBannerSession(null),this.setResourceCenterSession(null),this.resourceCenterLauncherHidden=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.unackedTasks=new Set,this.onFirstIdentifyRun=!1,window.clearTimeout(this.onFirstIdentifyTimeout),this.onFirstIdentifyTimeout=void 0,this.clientContext=null,this.unobserveUserActivity(),window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=void 0,this.clientConditions.forEach((e,s)=>{this.untrackClientCondition(s)}),this.firstIdentifyCallback=null,this.testUserIdentified=!1,w.removeItem("anonymousId"),this.unmountUI(),this.disconnect(),this.inBatch=!1,window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=void 0,this.clientClock=1,this.serverClock=1,this.titleMonitored=void 0,this.titleObserver&&(this.titleObserver.disconnect(),this.titleObserver=void 0)}async startFlow({flowId:e,stepCvid:s,startReason:n,once:i,batch:r,replaceCurrent:a}){if(this.ensureIdentified(),a&&this.flowSession&&this.endFlow(this.flowSession,{endReason:k.REPLACED,batch:!0}),o(`startFlow ${e}`,{startReason:n}),this.checklistSession?.flow.id===e){o("startFlow matches current checklist, so showing it instead"),this.showChecklist();return}const u={kind:"StartFlow",flowId:e,stepCvid:s,startReason:n,once:!!i};await this.send(u,{batch:r})}async trackButtonEvent(e,s,n,i){const r={kind:"TrackButtonEvent",eventName:e,stepCvid:n,sessionId:i,token:s};await this.send(r,{batch:!0})}async startFlowWithToken(e){this.ensureIdentified(),o("startFlowWithToken",{token:e}),await this.send({kind:"StartFlowWithToken",token:e},{batch:!0})}optimisticClockUIUpdate(e){this.clientClock++,e(),this.toggleUI()}async showChecklist(){if(this.resourceCenterEmbedsChecklist()&&!this.embedChecklistSessions()){this.openResourceCenter();return}this.embedChecklistSessions()||(this.unmarkExpandPending(),!(!this.checklistSession||this.checklistExpanded)&&(this.ensureIdentified(),this.checklistExpanded=!0,this.toggleUI(),d.setItem(`checklistExpanded:${this.checklistSession.id}`,"1"),await this.send({kind:"ShowChecklist",sessionId:this.checklistSession.id},{batch:!0})))}async hideChecklist(){if(this.resourceCenterEmbedsChecklist()){this.closeResourceCenter();return}!this.checklistSession||!this.checklistExpanded||(this.ensureIdentified(),this.checklistExpanded=!1,this.toggleUI(),d.removeItem(`checklistExpanded:${this.checklistSession.id}`),await this.send({kind:"HideChecklist",sessionId:this.checklistSession.id},{batch:!0}))}async unmarkExpandPending(){!this.checklistSession||!this.checklistExpandPending||(this.checklistExpandPending=!1,await this.send({kind:"UnmarkExpandPending",sessionId:this.checklistSession.id},{batch:!0}))}async openResourceCenter(){this.resourceCenterEmbedsChecklist()&&this.unmarkExpandPending(),!(!this.resourceCenterSession||this.resourceCenterOpen)&&(this.ensureIdentified(),this.resourceCenterOpen=!0,this.toggleUI(),this.emit("resourceCenterChanged"),d.setItem(`resourceCenterOpen:${this.resourceCenterSession.id}`,"1"),await this.send({kind:"OpenResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}async closeResourceCenter(){!this.resourceCenterSession||!this.resourceCenterOpen||(this.ensureIdentified(),this.resourceCenterOpen=!1,this.toggleUI(),this.emit("resourceCenterChanged"),d.removeItem(`resourceCenterOpen:${this.resourceCenterSession.id}`),await this.send({kind:"CloseResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}toggleResourceCenter(){this.resourceCenterOpen?this.closeResourceCenter():this.openResourceCenter()}setResourceCenterLauncherHidden(e){this.resourceCenterLauncherHidden=e,this.toggleUI()}getResourceCenterState(){if(!this.resourceCenterSession)return null;const e=this.resourceCenterEmbedsChecklist(),{checklistSession:s}=this,n=this.resourceCenterSession.version.resourceCenter?.blocks.find(i=>i.type===A.ANNOUNCEMENTS);return{isOpen:this.resourceCenterOpen,hasChecklist:e,uncompletedChecklistTaskCount:e&&s?Xe(s):0,unreadAnnouncementCount:n?.unreadAnnouncementCount||0}}resourceCenterEmbedsChecklist(){const e=this.resourceCenterSession;return!!e&&!!e.version.resourceCenter?.blocks.some(s=>s.type===A.CHECKLIST)}embedChecklistSessions(){return this.embedSessions.some(e=>!!e.version.embed?.blocks?.some(s=>s.type===K.CHECKLIST))}async endFlow(e,{endReason:s,batch:n}){this.ensureIdentified(),this.optimisticClockUIUpdate(()=>{const{clientClock:u}=this;this.flowSession?.id===e.id&&this.setFlowSession(null,u),this.checklistSession?.id===e.id&&this.setChecklistSession(null,u),this.bannerSession?.id===e.id&&this.setBannerSession(null),this.resourceCenterSession?.id===e.id&&this.setResourceCenterSession(null)});const{flow:i}=e,r={id:i.id,type:i.type.toLowerCase()};i.type===U.CHECKLIST?this.emit("checklistEnded",{checklist:r,endReason:s}):i.type===U.FLOW&&this.emit("flowEnded",{flow:r,endReason:s});const a={kind:"EndFlow",sessionId:e.id,endReason:s};await this.send(a,{batch:n})}async goToStep(e,s){o("goToStep",e.id,s.name||s.id),this.ensureIdentified();const n=this.send({kind:"GoToStep",sessionId:e.id,stepId:s.id});e.currentStep=s,this.emit("gotostep",{session:e,step:s}),await n}async endAllFlows(){o("endAllFlows"),this.optimisticClockUIUpdate(()=>{const{clientClock:e}=this;this.setFlowSession(null,e),this.setChecklistSession(null,e)}),await this.send({kind:"EndAllFlows"})}async endChecklist(){o("endChecklist");const e=this.checklistSession||this.flowSession;e?.flow.type===U.CHECKLIST&&this.endFlow(e,{endReason:k.USERFLOWJS})}setFlowSession(e,s=this.clientClock){const n=this.flowSession;this.flowSession=e,this.flowSessionClock=s,e&&!n&&(this.hideChecklist(),this.closeResourceCenter()),e==null&&this.originalActiveElement&&(typeof this.originalActiveElement.focus=="function"&&this.originalActiveElement.focus(),this.originalActiveElement=void 0)}setChecklistSession(e,s=this.clientClock){const n=this.checklistSession;this.checklistSession=e,this.checklistSessionClock=s,e===null&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),e&&e.id!==n?.id&&(this.checklistExpanded=!!d.getItem(`checklistExpanded:${e.id}`),e.expandPending&&(this.checklistExpandPending=!0)),this.emit("checklistChanged"),this.emit("resourceCenterChanged")}setBannerSession(e){this.bannerSession=e}setResourceCenterSession(e){const s=this.resourceCenterSession;e=typeof e=="function"?e(this.resourceCenterSession):e,this.resourceCenterSession=e,e===null&&(this.resourceCenterOpen=!1),s&&s.id!==e?.id&&d.removeItem(`resourceCenterOpen:${s.id}`),e&&e.id!==s?.id&&(this.resourceCenterOpen=!!d.getItem(`resourceCenterOpen:${e.id}`)),this.emit("resourceCenterChanged")}launcherSeen(e){this.send({kind:"StartFlow",flowId:e,startReason:p.LAUNCHER_SEEN,once:!1})}activateLauncher(e){const s=this.activeLauncherFlowId&&this.launcherSessions.find(n=>n.flow.id===this.activeLauncherFlowId);s&&this.deactivateLauncher(s),this.activeLauncherFlowId=e.flow.id,this.toggleUI(),this.send({kind:"ActivateLauncher",flowId:e.flow.id})}deactivateLauncher(e){const{launcher:s}=e.version;e.flow.id===this.activeLauncherFlowId&&(s?.dismissOn===V.DEACTIVATE?this.dismissLauncher(e,{endReason:k.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(e,{endReason:s}){const n=e.flow.id;this.removeLauncher(n),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:n,endReason:s})}removeLauncher(e){const s=this.launcherSessions.findIndex(n=>n.flow.id===e);return s===-1?!1:(this.launcherSessions=[...this.launcherSessions.slice(0,s),...this.launcherSessions.slice(s+1)],e===this.activeLauncherFlowId&&(this.activeLauncherFlowId=null),!0)}async toggleUI(){const e=this.getSessionStorageState();!this.flowSession&&(this.checklistExpandPending||this.checklistSession?.version.checklist?.tasks.some(s=>this.taskIsUnacked(s.cvid)))&&this.showChecklist(),e.isTargetTab&&this.monitorTitle(),this.emit("uistatechange"),this.shouldBeMounted()?await this.mountUI():this.unmountUI()}shouldBeMounted(){return this.uiDisabled||this.siteSession?.id||d.getItem(I)?!1:!!this.getSessionStorageState().activeApp||!!this.flowSession||!!this.checklistSession&&(this.checklistExpanded||!!this.checklistSession?.version.checklist?.launcherEnabled)||!!this.bannerSession||!!this.resourceCenterSession||this.launcherSessions.length>0||this.notifications.length>0}async mountUI(){if(!this.ui){const e=await this.createUI();this.shouldBeMounted()&&!this.ui&&(o("mount UI"),this.ui=e,this.ui.mount())}}unmountUI(){this.ui&&(o("unmount UI"),this.ui.unmount(),this.ui=null)}checkDebuggerSession(){if(this.debuggerUI)return;const e=this.sessionStorageState?.debuggerApp;e&&e?.x&&e?.y&&this.mountDebugger()}async mountDebugger(){if(!this.debuggerMountInProgress){if(this.debuggerUI){this.debuggerUI.unmount();return}this.debuggerMountInProgress=!0;try{const{DebuggerUI:e}=await T(async()=>{const{DebuggerUI:s}=await import("./DebuggerUI.js");return{DebuggerUI:s}},__vite__mapDeps([49,1,2,3,19,20,4,5,6,7,18,13,14,15,10,11,12,21,23,16,47,50,51,45,52,46,28,32,33]));this.debuggerUI=new e(this,_),this.debuggerUI.mount()}catch(e){console.error("Userflow: Failed to mount debugger UI",e)}finally{this.debuggerMountInProgress=!1}}}unMountDebugger(){this.debuggerUI=null}remount(){this.unmountUI(),this.toggleUI()}async createUI(){try{const e=T(()=>import("./ui.js"),__vite__mapDeps([53,1,2,3,19,20,4,5,6,7,32,33]));this.bannerSession&&Ze(),this.resourceCenterSession&&Qe();const{RealUI:s}=await e;return new s(this)}catch(e){throw this.reportCspIssue(),e}}async trackClientCondition(e){if(this.clientConditions.has(e.id))return;o("track client condition",e),this.clientConditions.set(e.id,{condition:e,isTrue:null});const{conditionTypes:s}=await T(async()=>{const{conditionTypes:r}=await import("./flow-condition-types.js").then(a=>a.f);return{conditionTypes:r}},__vite__mapDeps([10,2,11,6,12])),n=s[e.type],i=this.clientConditions.get(e.id);i&&(i.untrack=n.track({sessionData:new M([]),condition:e,callback:r=>{i.isTrue!==r&&(o("client condition truthiness changed",r,i.condition),i.isTrue=r,this.send({kind:"ToggleClientCondition",conditionId:e.id,isTrue:r},{batch:!0}))}}))}untrackClientCondition(e){const s=this.clientConditions.get(e);s&&(o("untrack client condition",s.condition),s.untrack&&s.untrack(),this.clientConditions.delete(e))}async addTracker(e){let s=this.trackers.get(e.flowId);s?s.tracker=e:this.trackers.set(e.flowId,{tracker:e,isTrue:!1});const{conditionTypes:n}=await T(async()=>{const{conditionTypes:c}=await import("./flow-condition-types.js").then(l=>l.f);return{conditionTypes:c}},__vite__mapDeps([10,2,11,6,12])),i=this.trackers.get(e.flowId);if(!i)return;const{tracker:r}=i,{condition:a}=r,u=n[a.type];i.untrack&&i.untrack(),i.untrack=u.track({sessionData:new M(r.data),condition:a,flipBackEvents:!0,callback:c=>{const l=i.isTrue;i.isTrue=c,!l&&c&&this.send({kind:"TrackTrackerEvent",token:r.token},{batch:!0})},description:`event tracker ${r.flowId}`}),this.emit("private:trackerStarted")}removeTracker(e){const s=this.trackers.get(e);s&&(s.untrack&&s.untrack(),this.trackers.delete(e),this.emit("private:trackerStopped"))}monitorTitle(){if(this.titleMonitored)return;this.titleMonitored=!0,this.fixTitle();const e=document.querySelector("title");if(e){const s=new MutationObserver(()=>{this.fixTitle()});s.observe(e,{childList:!0}),this.titleObserver=s}}fixTitle(){const e=document.title,n="[Userflow Preview] "+e.replace(/\[Userflow Preview\]\s*/g,"");e!==n&&(document.title=n)}reportCspIssue(){const e=this.getSessionStorageState();(this.testUserIdentified||e.activeApp)&&!this.cspIssueReported&&(this.cspIssueReported=!0,o("csp issue detected"),N({kind:"userflow:crxCspIssueDetected"}))}getAudio(){return this.audio||(this.audio=new Audio),this.audio}playAudio(e){if(document.hidden)return;const s=this.getAudio();e&&(s.src=e);const n=s.play();this.audioReady=!0,n&&n.catch(i=>{i.name})}pauseAudio(){const e=this.audio;e&&!e.paused&&e.pause()}async getStepSpeech(e,s){return(await this.send({kind:"GetStepSpeechV2",syntheticVoice:e,text:s})).url}featureFlagEnabled(e){return this.featureFlags?this.featureFlags.has(e):!1}showNotification(e,s,n){const r={id:++this.notificationIdCounter,label:e,message:s,type:n};this.notifications=[...this.notifications,r],this.toggleUI()}dismissNotification(e){this.notifications=this.notifications.filter(s=>s.id!==e),this.toggleUI()}warn(...e){console.warn(...e)}nextRef(){return this.refCounter++}}if(typeof window.userflow>"u"||window.userflow._stubbed){const t=Object.assign(window.userflow||{},st());window.userflow=t,window.studio1=t,it()}function st(){const t=new tt;return{_stubbed:!1,init(e){t.init(e)},identify(e,s={},n={}){return t.identify(e,s,n)},identifyAnonymous(e={},s={}){return t.identifyAnonymous(e,s)},isIdentified(){return t.isIdentified()},updateUser(e,s={}){return t.updateUser(e,s)},group(e,s={},n={}){return t.group(e,s,n)},updateGroup(e,s={}){return t.updateGroup(e,s)},track(e,s={},n={}){return t.track(e,s,n)},start(e,{once:s}={}){return t.startFlow({flowId:e,startReason:p.USERFLOWJS,once:s})},startFlow(e){return console.warn("Userflow.js: userflow.startFlow() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)},startWalk(e){return console.warn("Userflow.js: userflow.startWalk() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)},endAll(){return t.endAllFlows()},endChecklist(){return t.endChecklist()},endAllFlows(){"Userflow.js: userflow.endAllFlows() has been deprecated. Use userflow.endAll() instead.";return window.userflow.endAll()},async endFlow(){console.warn("Userflow.js: userflow.endFlow() has been deprecated and no longer has any effect.")},async endWalk(){console.warn("Userflow.js: userflow.endWalk() has been deprecated and no longer has any effect.")},openResourceCenter(){t.openResourceCenter()},closeResourceCenter(){t.closeResourceCenter()},toggleResourceCenter(){t.toggleResourceCenter()},setResourceCenterLauncherHidden(e){t.setResourceCenterLauncherHidden(e)},getResourceCenterState(){return t.getResourceCenterState()},setWalkPosition(){console.warn("Userflow.js: userflow.setWalkPosition() has been deprecated and no longer has any effect.")},reset(){t.reset()},remount(){t.remount()},on(e,s){t.on(e,s)},off(e,s){t.off(e,s)},setCustomInputSelector(e){console.warn("Userflow.js: userflow.setCustomInputSelector() has been deprecated. Use userflow.registerCustomInput() instead. See docs: https://userflow.com/docs/userflow-js"),e&&f.customInputs.push({cssSelector:e})},registerCustomInput(e,s){f.customInputs.push({cssSelector:e,getValue:s})},setCustomNavigate(e){f.customNavigate=e},setUrlFilter(e){f.urlFilter=e},setLinkUrlDecorator(e){f.linkUrlDecorator=e,t.emit("uistatechange")},setInferenceAttributeNames(e){f.inferenceAttributeNames=e},setInferenceAttributeFilter(e,s){f.inferenceAttributeFilters[e]=y(s)},setInferenceClassNameFilter(e){f.inferenceClassNameFilters=y(e)},setScrollPadding(e){f.scrollPadding=e},setCustomScrollIntoView(e){f.customScrollIntoView=e},prepareAudio(){t.playAudio(null)},setShadowDomEnabled(e){console.warn("Userflow.js: userflow.setShadowDomEnabled() has been deprecated. Please remove this call from your Userflow.js snippet. Shadow DOM is supported by default now.")},setPageTrackingDisabled(e){t.pageTrackingDisabled=e},setBaseZIndex(e){f.baseZIndex=e},setServerEndpoint(e){f.serverEndpoint=e},disableEvalJs(){f.evalJsDisabled=!0},_setTargetEnv(e){t.setTargetEnv(e)},debugger(){return t.mountDebugger()},mountSitePage(e,s){return t.mountSitePage(e,s)}}}function it(){const t=window.userflow,e=window.USERFLOWJS_QUEUE;if(delete window.USERFLOWJS_QUEUE,!(!e||e.length===0)){o(`processing ${e.length} items in the queue`);for(const[s,n,i]of e){if(typeof t[s]!="function"){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const r=t[s](...i);n&&r&&typeof r.then=="function"&&r.then(n.resolve,n.reject)}o("queue processed")}}var lt=window.userflow;export{Ge as $,S as A,Ze as B,d as C,ve as D,k as E,ne as F,f as G,De as H,me as I,Ce as J,_e as K,Oe as L,ge as M,p as N,Ye as O,Ie as P,be as Q,Qe as R,ce as S,ke as T,h as U,Ue as V,$e as W,xe as X,Me as Y,Pe as Z,T as _,U as a,Be as a0,He as a1,Le as a2,fe as a3,at as a4,m as a5,Ne as a6,Ae as a7,Se as a8,Je as a9,Z as aa,W as ab,ae as ac,ct as ad,P as ae,Ke as af,je as ag,se as ah,ue as b,le as c,o as d,lt as default,te as e,oe as f,Fe as g,ie as h,he as i,M as j,ye as k,We as l,re as m,G as n,X as o,w as p,we as q,pe as r,Te as s,Re as t,N as u,de as v,Ee as w,Xe as x,Ve as y,A as z};
18
18
  //# sourceMappingURL=userflow.js.map
package/vendor.core-js.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="c558c68e-cbe3-4fa8-a9b1-697795138a4e",r._sentryDebugIdIdentifier="sentry-dbid-c558c68e-cbe3-4fa8-a9b1-697795138a4e")}catch{}})();var Ze=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};Ze.SENTRY_RELEASE={id:"cfe68d3f1eef7b2de708132953df3784dc0e5677"};var F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var P=function(r){return r&&r.Math===Math&&r},f=P(typeof globalThis=="object"&&globalThis)||P(typeof window=="object"&&window)||P(typeof self=="object"&&self)||P(typeof F=="object"&&F)||P(typeof F=="object"&&F)||function(){return this}()||Function("return this")(),gr={},h=function(r){try{return!!r()}catch{return!0}},Qe=h,g=!Qe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),rt=h,Or=!rt(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),et=Or,B=Function.prototype.call,O=et?B.bind(B):function(){return B.apply(B,arguments)},fe={},se={}.propertyIsEnumerable,ye=Object.getOwnPropertyDescriptor,tt=ye&&!se.call({1:2},1);fe.f=tt?function(e){var t=ye(this,e);return!!t&&t.enumerable}:se;var de=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}},$e=Or,pe=Function.prototype,sr=pe.call,nt=$e&&pe.bind.bind(sr,sr),b=$e?nt:function(r){return function(){return sr.apply(r,arguments)}},be=b,at=be({}.toString),ot=be("".slice),q=function(r){return ot(at(r),8,-1)},it=b,vt=h,ut=q,H=Object,ct=it("".split),lt=vt(function(){return!H("z").propertyIsEnumerable(0)})?function(r){return ut(r)==="String"?ct(r,""):H(r)}:H,Sr=function(r){return r==null},ft=Sr,st=TypeError,he=function(r){if(ft(r))throw new st("Can't call method on "+r);return r},yt=lt,dt=he,Er=function(r){return yt(dt(r))},X=typeof document=="object"&&document.all,d=typeof X>"u"&&X!==void 0?function(r){return typeof r=="function"||r===X}:function(r){return typeof r=="function"},$t=d,_=function(r){return typeof r=="object"?r!==null:$t(r)},Z=f,pt=d,bt=function(r){return pt(r)?r:void 0},ge=function(r,e){return arguments.length<2?bt(Z[r]):Z[r]&&Z[r][e]},ht=b,Oe=ht({}.isPrototypeOf),gt=f,_r=gt.navigator,Dr=_r&&_r.userAgent,Se=Dr?String(Dr):"",Ee=f,Q=Se,Mr=Ee.process,Ar=Ee.Deno,Fr=Mr&&Mr.versions||Ar&&Ar.version,Br=Fr&&Fr.v8,$,W;Br&&($=Br.split("."),W=$[0]>0&&$[0]<4?1:+($[0]+$[1]));!W&&Q&&($=Q.match(/Edge\/(\d+)/),(!$||$[1]>=74)&&($=Q.match(/Chrome\/(\d+)/),$&&(W=+$[1])));var Te=W,Lr=Te,Ot=h,St=f,Et=St.String,we=!!Object.getOwnPropertySymbols&&!Ot(function(){var r=Symbol("symbol detection");return!Et(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Lr&&Lr<41}),Tt=we,Ie=Tt&&!Symbol.sham&&typeof Symbol.iterator=="symbol",wt=ge,It=d,mt=Oe,Rt=Ie,Pt=Object,me=Rt?function(r){return typeof r=="symbol"}:function(r){var e=wt("Symbol");return It(e)&&mt(e.prototype,Pt(r))},Ct=String,Tr=function(r){try{return Ct(r)}catch{return"Object"}},jt=d,Nt=Tr,_t=TypeError,D=function(r){if(jt(r))return r;throw new _t(Nt(r)+" is not a function")},Dt=D,Mt=Sr,wr=function(r,e){var t=r[e];return Mt(t)?void 0:Dt(t)},rr=O,er=d,tr=_,At=TypeError,Ft=function(r,e){var t,n;if(e==="string"&&er(t=r.toString)&&!tr(n=rr(t,r))||er(t=r.valueOf)&&!tr(n=rr(t,r))||e!=="string"&&er(t=r.toString)&&!tr(n=rr(t,r)))return n;throw new At("Can't convert object to primitive value")},Re={exports:{}},Ur=f,Bt=Object.defineProperty,Ir=function(r,e){try{Bt(Ur,r,{value:e,configurable:!0,writable:!0})}catch{Ur[r]=e}return e},Lt=f,Ut=Ir,Gr="__core-js_shared__",xr=Re.exports=Lt[Gr]||Ut(Gr,{});(xr.versions||(xr.versions=[])).push({version:"3.39.0",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"});var mr=Re.exports,Kr=mr,Pe=function(r,e){return Kr[r]||(Kr[r]=e||{})},Gt=he,xt=Object,Kt=function(r){return xt(Gt(r))},Vt=b,kt=Kt,Wt=Vt({}.hasOwnProperty),S=Object.hasOwn||function(e,t){return Wt(kt(e),t)},zt=b,Yt=0,qt=Math.random(),Jt=zt(1 .toString),Ce=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Jt(++Yt+qt,36)},Ht=f,Xt=Pe,Vr=S,Zt=Ce,Qt=we,rn=Ie,m=Ht.Symbol,nr=Xt("wks"),en=rn?m.for||m:m&&m.withoutSetter||Zt,E=function(r){return Vr(nr,r)||(nr[r]=Qt&&Vr(m,r)?m[r]:en("Symbol."+r)),nr[r]},tn=O,kr=_,Wr=me,nn=wr,an=Ft,on=E,vn=TypeError,un=on("toPrimitive"),cn=function(r,e){if(!kr(r)||Wr(r))return r;var t=nn(r,un),n;if(t){if(e===void 0&&(e="default"),n=tn(t,r,e),!kr(n)||Wr(n))return n;throw new vn("Can't convert object to primitive value")}return e===void 0&&(e="number"),an(r,e)},ln=cn,fn=me,je=function(r){var e=ln(r,"string");return fn(e)?e:e+""},sn=f,zr=_,yr=sn.document,yn=zr(yr)&&zr(yr.createElement),dn=function(r){return yn?yr.createElement(r):{}},$n=g,pn=h,bn=dn,Ne=!$n&&!pn(function(){return Object.defineProperty(bn("div"),"a",{get:function(){return 7}}).a!==7}),hn=g,gn=O,On=fe,Sn=de,En=Er,Tn=je,wn=S,In=Ne,Yr=Object.getOwnPropertyDescriptor;gr.f=hn?Yr:function(e,t){if(e=En(e),t=Tn(t),In)try{return Yr(e,t)}catch{}if(wn(e,t))return Sn(!gn(On.f,e,t),e[t])};var J={},mn=g,Rn=h,Pn=mn&&Rn(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Cn=_,jn=String,Nn=TypeError,M=function(r){if(Cn(r))return r;throw new Nn(jn(r)+" is not an object")},_n=g,Dn=Ne,Mn=Pn,L=M,qr=je,An=TypeError,ar=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,or="enumerable",ir="configurable",vr="writable";J.f=_n?Mn?function(e,t,n){if(L(e),t=qr(t),L(n),typeof e=="function"&&t==="prototype"&&"value"in n&&vr in n&&!n[vr]){var a=Fn(e,t);a&&a[vr]&&(e[t]=n.value,n={configurable:ir in n?n[ir]:a[ir],enumerable:or in n?n[or]:a[or],writable:!1})}return ar(e,t,n)}:ar:function(e,t,n){if(L(e),t=qr(t),L(n),Dn)try{return ar(e,t,n)}catch{}if("get"in n||"set"in n)throw new An("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Bn=g,Ln=J,Un=de,_e=Bn?function(r,e,t){return Ln.f(r,e,Un(1,t))}:function(r,e,t){return r[e]=t,r},De={exports:{}},dr=g,Gn=S,Me=Function.prototype,xn=dr&&Object.getOwnPropertyDescriptor,Rr=Gn(Me,"name"),Kn=Rr&&function(){}.name==="something",Vn=Rr&&(!dr||dr&&xn(Me,"name").configurable),kn={EXISTS:Rr,PROPER:Kn,CONFIGURABLE:Vn},Wn=b,zn=d,$r=mr,Yn=Wn(Function.toString);zn($r.inspectSource)||($r.inspectSource=function(r){return Yn(r)});var Ae=$r.inspectSource,qn=f,Jn=d,Jr=qn.WeakMap,Hn=Jn(Jr)&&/native code/.test(String(Jr)),Xn=Pe,Zn=Ce,Hr=Xn("keys"),Qn=function(r){return Hr[r]||(Hr[r]=Zn(r))},Fe={},ra=Hn,Be=f,ea=_,ta=_e,ur=S,cr=mr,na=Qn,aa=Fe,Xr="Object already initialized",pr=Be.TypeError,oa=Be.WeakMap,z,N,Y,ia=function(r){return Y(r)?N(r):z(r,{})},va=function(r){return function(e){var t;if(!ea(e)||(t=N(e)).type!==r)throw new pr("Incompatible receiver, "+r+" required");return t}};if(ra||cr.state){var p=cr.state||(cr.state=new oa);p.get=p.get,p.has=p.has,p.set=p.set,z=function(r,e){if(p.has(r))throw new pr(Xr);return e.facade=r,p.set(r,e),e},N=function(r){return p.get(r)||{}},Y=function(r){return p.has(r)}}else{var I=na("state");aa[I]=!0,z=function(r,e){if(ur(r,I))throw new pr(Xr);return e.facade=r,ta(r,I,e),e},N=function(r){return ur(r,I)?r[I]:{}},Y=function(r){return ur(r,I)}}var ua={set:z,get:N,has:Y,enforce:ia,getterFor:va},Pr=b,ca=h,la=d,U=S,br=g,fa=kn.CONFIGURABLE,sa=Ae,Le=ua,ya=Le.enforce,da=Le.get,Zr=String,K=Object.defineProperty,$a=Pr("".slice),pa=Pr("".replace),ba=Pr([].join),ha=br&&!ca(function(){return K(function(){},"length",{value:8}).length!==8}),ga=String(String).split("String"),Oa=De.exports=function(r,e,t){$a(Zr(e),0,7)==="Symbol("&&(e="["+pa(Zr(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!U(r,"name")||fa&&r.name!==e)&&(br?K(r,"name",{value:e,configurable:!0}):r.name=e),ha&&t&&U(t,"arity")&&r.length!==t.arity&&K(r,"length",{value:t.arity});try{t&&U(t,"constructor")&&t.constructor?br&&K(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var n=ya(r);return U(n,"source")||(n.source=ba(ga,typeof e=="string"?e:"")),r};Function.prototype.toString=Oa(function(){return la(this)&&da(this).source||sa(this)},"toString");var Sa=De.exports,Ea=d,Ta=J,wa=Sa,Ia=Ir,ma=function(r,e,t,n){n||(n={});var a=n.enumerable,o=n.name!==void 0?n.name:e;if(Ea(t)&&wa(t,o,n),n.global)a?r[e]=t:Ia(e,t);else{try{n.unsafe?r[e]&&(a=!0):delete r[e]}catch{}a?r[e]=t:Ta.f(r,e,{value:t,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r},Ue={},Ra=Math.ceil,Pa=Math.floor,Ca=Math.trunc||function(e){var t=+e;return(t>0?Pa:Ra)(t)},ja=Ca,Ge=function(r){var e=+r;return e!==e||e===0?0:ja(e)},Na=Ge,_a=Math.max,Da=Math.min,Ma=function(r,e){var t=Na(r);return t<0?_a(t+e,0):Da(t,e)},Aa=Ge,Fa=Math.min,Ba=function(r){var e=Aa(r);return e>0?Fa(e,9007199254740991):0},La=Ba,xe=function(r){return La(r.length)},Ua=Er,Ga=Ma,xa=xe,Qr=function(r){return function(e,t,n){var a=Ua(e),o=xa(a);if(o===0)return!r&&-1;var i=Ga(n,o),v;if(r&&t!==t){for(;o>i;)if(v=a[i++],v!==v)return!0}else for(;o>i;i++)if((r||i in a)&&a[i]===t)return r||i||0;return!r&&-1}},Ka={includes:Qr(!0),indexOf:Qr(!1)},Va=b,lr=S,ka=Er,Wa=Ka.indexOf,za=Fe,re=Va([].push),Ya=function(r,e){var t=ka(r),n=0,a=[],o;for(o in t)!lr(za,o)&&lr(t,o)&&re(a,o);for(;e.length>n;)lr(t,o=e[n++])&&(~Wa(a,o)||re(a,o));return a},qa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ja=Ya,Ha=qa,Xa=Ha.concat("length","prototype");Ue.f=Object.getOwnPropertyNames||function(e){return Ja(e,Xa)};var Ke={};Ke.f=Object.getOwnPropertySymbols;var Za=ge,Qa=b,ro=Ue,eo=Ke,to=M,no=Qa([].concat),ao=Za("Reflect","ownKeys")||function(e){var t=ro.f(to(e)),n=eo.f;return n?no(t,n(e)):t},ee=S,oo=ao,io=gr,vo=J,uo=function(r,e,t){for(var n=oo(e),a=vo.f,o=io.f,i=0;i<n.length;i++){var v=n[i];!ee(r,v)&&!(t&&ee(t,v))&&a(r,v,o(e,v))}},co=h,lo=d,fo=/#|\.prototype\./,A=function(r,e){var t=yo[so(r)];return t===po?!0:t===$o?!1:lo(e)?co(e):!!e},so=A.normalize=function(r){return String(r).replace(fo,".").toLowerCase()},yo=A.data={},$o=A.NATIVE="N",po=A.POLYFILL="P",Ve=A,G=f,bo=gr.f,ho=_e,go=ma,Oo=Ir,So=uo,Eo=Ve,To=function(r,e){var t=r.target,n=r.global,a=r.stat,o,i,v,u,c,s;if(n?i=G:a?i=G[t]||Oo(t,{}):i=G[t]&&G[t].prototype,i)for(v in e){if(c=e[v],r.dontCallGetSet?(s=bo(i,v),u=s&&s.value):u=i[v],o=Eo(n?v:t+(a?".":"#")+v,r.forced),!o&&u!==void 0){if(typeof c==typeof u)continue;So(c,u)}(r.sham||u&&u.sham)&&ho(c,"sham",!0),go(i,v,c,r)}},ke={},te=D,wo=TypeError,Io=function(r){var e,t;this.promise=new r(function(n,a){if(e!==void 0||t!==void 0)throw new wo("Bad Promise constructor");e=n,t=a}),this.resolve=te(e),this.reject=te(t)};ke.f=function(r){return new Io(r)};var mo=function(r){try{return{error:!1,value:r()}}catch(e){return{error:!0,value:e}}},Ro=q,Po=b,Co=function(r){if(Ro(r)==="Function")return Po(r)},ne=Co,jo=D,No=Or,_o=ne(ne.bind),Do=function(r,e){return jo(r),e===void 0?r:No?_o(r,e):function(){return r.apply(e,arguments)}},We={},Mo=E,Ao=We,Fo=Mo("iterator"),Bo=Array.prototype,Lo=function(r){return r!==void 0&&(Ao.Array===r||Bo[Fo]===r)},Uo=E,Go=Uo("toStringTag"),ze={};ze[Go]="z";var xo=String(ze)==="[object z]",Ko=xo,Vo=d,V=q,ko=E,Wo=ko("toStringTag"),zo=Object,Yo=V(function(){return arguments}())==="Arguments",qo=function(r,e){try{return r[e]}catch{}},Jo=Ko?V:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=qo(e=zo(r),Wo))=="string"?t:Yo?V(e):(n=V(e))==="Object"&&Vo(e.callee)?"Arguments":n},Ho=Jo,ae=wr,Xo=Sr,Zo=We,Qo=E,ri=Qo("iterator"),Ye=function(r){if(!Xo(r))return ae(r,ri)||ae(r,"@@iterator")||Zo[Ho(r)]},ei=O,ti=D,ni=M,ai=Tr,oi=Ye,ii=TypeError,vi=function(r,e){var t=arguments.length<2?oi(r):e;if(ti(t))return ni(ei(t,r));throw new ii(ai(r)+" is not iterable")},ui=O,oe=M,ci=wr,li=function(r,e,t){var n,a;oe(r);try{if(n=ci(r,"return"),!n){if(e==="throw")throw t;return t}n=ui(n,r)}catch(o){a=!0,n=o}if(e==="throw")throw t;if(a)throw n;return oe(n),t},fi=Do,si=O,yi=M,di=Tr,$i=Lo,pi=xe,ie=Oe,bi=vi,hi=Ye,ve=li,gi=TypeError,k=function(r,e){this.stopped=r,this.result=e},ue=k.prototype,Oi=function(r,e,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),v=!!(t&&t.INTERRUPTED),u=fi(e,n),c,s,T,R,l,w,Cr,jr=function(y){return c&&ve(c,"normal",y),new k(!0,y)},Nr=function(y){return a?(yi(y),v?u(y[0],y[1],jr):u(y[0],y[1])):v?u(y,jr):u(y)};if(o)c=r.iterator;else if(i)c=r;else{if(s=hi(r),!s)throw new gi(di(r)+" is not iterable");if($i(s)){for(T=0,R=pi(r);R>T;T++)if(l=Nr(r[T]),l&&ie(ue,l))return l;return new k(!1)}c=bi(r,s)}for(w=o?r.next:c.next;!(Cr=si(w,c)).done;){try{l=Nr(Cr.value)}catch(y){ve(c,"throw",y)}if(typeof l=="object"&&l&&ie(ue,l))return l}return new k(!1)},Si=f,qe=Si.Promise,Ei=E,Je=Ei("iterator"),He=!1;try{var Ti=0,ce={next:function(){return{done:!!Ti++}},return:function(){He=!0}};ce[Je]=function(){return this},Array.from(ce,function(){throw 2})}catch{}var wi=function(r,e){try{if(!e&&!He)return!1}catch{return!1}var t=!1;try{var n={};n[Je]=function(){return{next:function(){return{done:t=!0}}}},r(n)}catch{}return t},C=f,Ii=Se,mi=q,x=function(r){return Ii.slice(0,r.length)===r},Ri=function(){return x("Bun/")?"BUN":x("Cloudflare-Workers")?"CLOUDFLARE":x("Deno/")?"DENO":x("Node.js/")?"NODE":C.Bun&&typeof Bun.version=="string"?"BUN":C.Deno&&typeof Deno.version=="object"?"DENO":mi(C.process)==="process"?"NODE":C.window&&C.document?"BROWSER":"REST"}(),Pi=f,j=qe,Ci=d,ji=Ve,Ni=Ae,_i=E,le=Ri,fr=Te;j&&j.prototype;var Di=_i("species"),hr=!1,Xe=Ci(Pi.PromiseRejectionEvent),Mi=ji("Promise",function(){var r=Ni(j),e=r!==String(j);if(!e&&fr===66)return!0;if(!fr||fr<51||!/native code/.test(r)){var t=new j(function(o){o(1)}),n=function(o){o(function(){},function(){})},a=t.constructor={};if(a[Di]=n,hr=t.then(function(){})instanceof n,!hr)return!0}return!e&&(le==="BROWSER"||le==="DENO")&&!Xe}),Ai={CONSTRUCTOR:Mi,REJECTION_EVENT:Xe,SUBCLASSING:hr},Fi=qe,Bi=wi,Li=Ai.CONSTRUCTOR,Ui=Li||!Bi(function(r){Fi.all(r).then(void 0,function(){})}),Gi=To,xi=O,Ki=D,Vi=ke,ki=mo,Wi=Oi,zi=Ui;Gi({target:"Promise",stat:!0,forced:zi},{allSettled:function(e){var t=this,n=Vi.f(t),a=n.resolve,o=n.reject,i=ki(function(){var v=Ki(t.resolve),u=[],c=0,s=1;Wi(e,function(T){var R=c++,l=!1;s++,xi(v,t,T).then(function(w){l||(l=!0,u[R]={status:"fulfilled",value:w},--s||a(u))},function(w){l||(l=!0,u[R]={status:"rejected",reason:w},--s||a(u))})}),--s||a(u)});return i.error&&o(i.value),n.promise}});export{F as c,Yi as g};
1
+ (function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="a846632d-abef-4722-9876-d21331e482fc",r._sentryDebugIdIdentifier="sentry-dbid-a846632d-abef-4722-9876-d21331e482fc")}catch{}})();var Ze=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};Ze.SENTRY_RELEASE={id:"d16edc70fb3570038065cb2dddd8c672fc593063"};var F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var P=function(r){return r&&r.Math===Math&&r},f=P(typeof globalThis=="object"&&globalThis)||P(typeof window=="object"&&window)||P(typeof self=="object"&&self)||P(typeof F=="object"&&F)||P(typeof F=="object"&&F)||function(){return this}()||Function("return this")(),gr={},h=function(r){try{return!!r()}catch{return!0}},Qe=h,g=!Qe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),rt=h,Or=!rt(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),et=Or,B=Function.prototype.call,O=et?B.bind(B):function(){return B.apply(B,arguments)},fe={},se={}.propertyIsEnumerable,ye=Object.getOwnPropertyDescriptor,tt=ye&&!se.call({1:2},1);fe.f=tt?function(e){var t=ye(this,e);return!!t&&t.enumerable}:se;var de=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}},$e=Or,pe=Function.prototype,sr=pe.call,nt=$e&&pe.bind.bind(sr,sr),b=$e?nt:function(r){return function(){return sr.apply(r,arguments)}},be=b,at=be({}.toString),ot=be("".slice),q=function(r){return ot(at(r),8,-1)},it=b,vt=h,ut=q,H=Object,ct=it("".split),lt=vt(function(){return!H("z").propertyIsEnumerable(0)})?function(r){return ut(r)==="String"?ct(r,""):H(r)}:H,Sr=function(r){return r==null},ft=Sr,st=TypeError,he=function(r){if(ft(r))throw new st("Can't call method on "+r);return r},yt=lt,dt=he,Er=function(r){return yt(dt(r))},X=typeof document=="object"&&document.all,d=typeof X>"u"&&X!==void 0?function(r){return typeof r=="function"||r===X}:function(r){return typeof r=="function"},$t=d,_=function(r){return typeof r=="object"?r!==null:$t(r)},Z=f,pt=d,bt=function(r){return pt(r)?r:void 0},ge=function(r,e){return arguments.length<2?bt(Z[r]):Z[r]&&Z[r][e]},ht=b,Oe=ht({}.isPrototypeOf),gt=f,_r=gt.navigator,Dr=_r&&_r.userAgent,Se=Dr?String(Dr):"",Ee=f,Q=Se,Mr=Ee.process,Ar=Ee.Deno,Fr=Mr&&Mr.versions||Ar&&Ar.version,Br=Fr&&Fr.v8,$,W;Br&&($=Br.split("."),W=$[0]>0&&$[0]<4?1:+($[0]+$[1]));!W&&Q&&($=Q.match(/Edge\/(\d+)/),(!$||$[1]>=74)&&($=Q.match(/Chrome\/(\d+)/),$&&(W=+$[1])));var Te=W,Lr=Te,Ot=h,St=f,Et=St.String,we=!!Object.getOwnPropertySymbols&&!Ot(function(){var r=Symbol("symbol detection");return!Et(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Lr&&Lr<41}),Tt=we,Ie=Tt&&!Symbol.sham&&typeof Symbol.iterator=="symbol",wt=ge,It=d,mt=Oe,Rt=Ie,Pt=Object,me=Rt?function(r){return typeof r=="symbol"}:function(r){var e=wt("Symbol");return It(e)&&mt(e.prototype,Pt(r))},Ct=String,Tr=function(r){try{return Ct(r)}catch{return"Object"}},jt=d,Nt=Tr,_t=TypeError,D=function(r){if(jt(r))return r;throw new _t(Nt(r)+" is not a function")},Dt=D,Mt=Sr,wr=function(r,e){var t=r[e];return Mt(t)?void 0:Dt(t)},rr=O,er=d,tr=_,At=TypeError,Ft=function(r,e){var t,n;if(e==="string"&&er(t=r.toString)&&!tr(n=rr(t,r))||er(t=r.valueOf)&&!tr(n=rr(t,r))||e!=="string"&&er(t=r.toString)&&!tr(n=rr(t,r)))return n;throw new At("Can't convert object to primitive value")},Re={exports:{}},Ur=f,Bt=Object.defineProperty,Ir=function(r,e){try{Bt(Ur,r,{value:e,configurable:!0,writable:!0})}catch{Ur[r]=e}return e},Lt=f,Ut=Ir,Gr="__core-js_shared__",xr=Re.exports=Lt[Gr]||Ut(Gr,{});(xr.versions||(xr.versions=[])).push({version:"3.39.0",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"});var mr=Re.exports,Kr=mr,Pe=function(r,e){return Kr[r]||(Kr[r]=e||{})},Gt=he,xt=Object,Kt=function(r){return xt(Gt(r))},Vt=b,kt=Kt,Wt=Vt({}.hasOwnProperty),S=Object.hasOwn||function(e,t){return Wt(kt(e),t)},zt=b,Yt=0,qt=Math.random(),Jt=zt(1 .toString),Ce=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Jt(++Yt+qt,36)},Ht=f,Xt=Pe,Vr=S,Zt=Ce,Qt=we,rn=Ie,m=Ht.Symbol,nr=Xt("wks"),en=rn?m.for||m:m&&m.withoutSetter||Zt,E=function(r){return Vr(nr,r)||(nr[r]=Qt&&Vr(m,r)?m[r]:en("Symbol."+r)),nr[r]},tn=O,kr=_,Wr=me,nn=wr,an=Ft,on=E,vn=TypeError,un=on("toPrimitive"),cn=function(r,e){if(!kr(r)||Wr(r))return r;var t=nn(r,un),n;if(t){if(e===void 0&&(e="default"),n=tn(t,r,e),!kr(n)||Wr(n))return n;throw new vn("Can't convert object to primitive value")}return e===void 0&&(e="number"),an(r,e)},ln=cn,fn=me,je=function(r){var e=ln(r,"string");return fn(e)?e:e+""},sn=f,zr=_,yr=sn.document,yn=zr(yr)&&zr(yr.createElement),dn=function(r){return yn?yr.createElement(r):{}},$n=g,pn=h,bn=dn,Ne=!$n&&!pn(function(){return Object.defineProperty(bn("div"),"a",{get:function(){return 7}}).a!==7}),hn=g,gn=O,On=fe,Sn=de,En=Er,Tn=je,wn=S,In=Ne,Yr=Object.getOwnPropertyDescriptor;gr.f=hn?Yr:function(e,t){if(e=En(e),t=Tn(t),In)try{return Yr(e,t)}catch{}if(wn(e,t))return Sn(!gn(On.f,e,t),e[t])};var J={},mn=g,Rn=h,Pn=mn&&Rn(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Cn=_,jn=String,Nn=TypeError,M=function(r){if(Cn(r))return r;throw new Nn(jn(r)+" is not an object")},_n=g,Dn=Ne,Mn=Pn,L=M,qr=je,An=TypeError,ar=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,or="enumerable",ir="configurable",vr="writable";J.f=_n?Mn?function(e,t,n){if(L(e),t=qr(t),L(n),typeof e=="function"&&t==="prototype"&&"value"in n&&vr in n&&!n[vr]){var a=Fn(e,t);a&&a[vr]&&(e[t]=n.value,n={configurable:ir in n?n[ir]:a[ir],enumerable:or in n?n[or]:a[or],writable:!1})}return ar(e,t,n)}:ar:function(e,t,n){if(L(e),t=qr(t),L(n),Dn)try{return ar(e,t,n)}catch{}if("get"in n||"set"in n)throw new An("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Bn=g,Ln=J,Un=de,_e=Bn?function(r,e,t){return Ln.f(r,e,Un(1,t))}:function(r,e,t){return r[e]=t,r},De={exports:{}},dr=g,Gn=S,Me=Function.prototype,xn=dr&&Object.getOwnPropertyDescriptor,Rr=Gn(Me,"name"),Kn=Rr&&function(){}.name==="something",Vn=Rr&&(!dr||dr&&xn(Me,"name").configurable),kn={EXISTS:Rr,PROPER:Kn,CONFIGURABLE:Vn},Wn=b,zn=d,$r=mr,Yn=Wn(Function.toString);zn($r.inspectSource)||($r.inspectSource=function(r){return Yn(r)});var Ae=$r.inspectSource,qn=f,Jn=d,Jr=qn.WeakMap,Hn=Jn(Jr)&&/native code/.test(String(Jr)),Xn=Pe,Zn=Ce,Hr=Xn("keys"),Qn=function(r){return Hr[r]||(Hr[r]=Zn(r))},Fe={},ra=Hn,Be=f,ea=_,ta=_e,ur=S,cr=mr,na=Qn,aa=Fe,Xr="Object already initialized",pr=Be.TypeError,oa=Be.WeakMap,z,N,Y,ia=function(r){return Y(r)?N(r):z(r,{})},va=function(r){return function(e){var t;if(!ea(e)||(t=N(e)).type!==r)throw new pr("Incompatible receiver, "+r+" required");return t}};if(ra||cr.state){var p=cr.state||(cr.state=new oa);p.get=p.get,p.has=p.has,p.set=p.set,z=function(r,e){if(p.has(r))throw new pr(Xr);return e.facade=r,p.set(r,e),e},N=function(r){return p.get(r)||{}},Y=function(r){return p.has(r)}}else{var I=na("state");aa[I]=!0,z=function(r,e){if(ur(r,I))throw new pr(Xr);return e.facade=r,ta(r,I,e),e},N=function(r){return ur(r,I)?r[I]:{}},Y=function(r){return ur(r,I)}}var ua={set:z,get:N,has:Y,enforce:ia,getterFor:va},Pr=b,ca=h,la=d,U=S,br=g,fa=kn.CONFIGURABLE,sa=Ae,Le=ua,ya=Le.enforce,da=Le.get,Zr=String,K=Object.defineProperty,$a=Pr("".slice),pa=Pr("".replace),ba=Pr([].join),ha=br&&!ca(function(){return K(function(){},"length",{value:8}).length!==8}),ga=String(String).split("String"),Oa=De.exports=function(r,e,t){$a(Zr(e),0,7)==="Symbol("&&(e="["+pa(Zr(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!U(r,"name")||fa&&r.name!==e)&&(br?K(r,"name",{value:e,configurable:!0}):r.name=e),ha&&t&&U(t,"arity")&&r.length!==t.arity&&K(r,"length",{value:t.arity});try{t&&U(t,"constructor")&&t.constructor?br&&K(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var n=ya(r);return U(n,"source")||(n.source=ba(ga,typeof e=="string"?e:"")),r};Function.prototype.toString=Oa(function(){return la(this)&&da(this).source||sa(this)},"toString");var Sa=De.exports,Ea=d,Ta=J,wa=Sa,Ia=Ir,ma=function(r,e,t,n){n||(n={});var a=n.enumerable,o=n.name!==void 0?n.name:e;if(Ea(t)&&wa(t,o,n),n.global)a?r[e]=t:Ia(e,t);else{try{n.unsafe?r[e]&&(a=!0):delete r[e]}catch{}a?r[e]=t:Ta.f(r,e,{value:t,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r},Ue={},Ra=Math.ceil,Pa=Math.floor,Ca=Math.trunc||function(e){var t=+e;return(t>0?Pa:Ra)(t)},ja=Ca,Ge=function(r){var e=+r;return e!==e||e===0?0:ja(e)},Na=Ge,_a=Math.max,Da=Math.min,Ma=function(r,e){var t=Na(r);return t<0?_a(t+e,0):Da(t,e)},Aa=Ge,Fa=Math.min,Ba=function(r){var e=Aa(r);return e>0?Fa(e,9007199254740991):0},La=Ba,xe=function(r){return La(r.length)},Ua=Er,Ga=Ma,xa=xe,Qr=function(r){return function(e,t,n){var a=Ua(e),o=xa(a);if(o===0)return!r&&-1;var i=Ga(n,o),v;if(r&&t!==t){for(;o>i;)if(v=a[i++],v!==v)return!0}else for(;o>i;i++)if((r||i in a)&&a[i]===t)return r||i||0;return!r&&-1}},Ka={includes:Qr(!0),indexOf:Qr(!1)},Va=b,lr=S,ka=Er,Wa=Ka.indexOf,za=Fe,re=Va([].push),Ya=function(r,e){var t=ka(r),n=0,a=[],o;for(o in t)!lr(za,o)&&lr(t,o)&&re(a,o);for(;e.length>n;)lr(t,o=e[n++])&&(~Wa(a,o)||re(a,o));return a},qa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ja=Ya,Ha=qa,Xa=Ha.concat("length","prototype");Ue.f=Object.getOwnPropertyNames||function(e){return Ja(e,Xa)};var Ke={};Ke.f=Object.getOwnPropertySymbols;var Za=ge,Qa=b,ro=Ue,eo=Ke,to=M,no=Qa([].concat),ao=Za("Reflect","ownKeys")||function(e){var t=ro.f(to(e)),n=eo.f;return n?no(t,n(e)):t},ee=S,oo=ao,io=gr,vo=J,uo=function(r,e,t){for(var n=oo(e),a=vo.f,o=io.f,i=0;i<n.length;i++){var v=n[i];!ee(r,v)&&!(t&&ee(t,v))&&a(r,v,o(e,v))}},co=h,lo=d,fo=/#|\.prototype\./,A=function(r,e){var t=yo[so(r)];return t===po?!0:t===$o?!1:lo(e)?co(e):!!e},so=A.normalize=function(r){return String(r).replace(fo,".").toLowerCase()},yo=A.data={},$o=A.NATIVE="N",po=A.POLYFILL="P",Ve=A,G=f,bo=gr.f,ho=_e,go=ma,Oo=Ir,So=uo,Eo=Ve,To=function(r,e){var t=r.target,n=r.global,a=r.stat,o,i,v,u,c,s;if(n?i=G:a?i=G[t]||Oo(t,{}):i=G[t]&&G[t].prototype,i)for(v in e){if(c=e[v],r.dontCallGetSet?(s=bo(i,v),u=s&&s.value):u=i[v],o=Eo(n?v:t+(a?".":"#")+v,r.forced),!o&&u!==void 0){if(typeof c==typeof u)continue;So(c,u)}(r.sham||u&&u.sham)&&ho(c,"sham",!0),go(i,v,c,r)}},ke={},te=D,wo=TypeError,Io=function(r){var e,t;this.promise=new r(function(n,a){if(e!==void 0||t!==void 0)throw new wo("Bad Promise constructor");e=n,t=a}),this.resolve=te(e),this.reject=te(t)};ke.f=function(r){return new Io(r)};var mo=function(r){try{return{error:!1,value:r()}}catch(e){return{error:!0,value:e}}},Ro=q,Po=b,Co=function(r){if(Ro(r)==="Function")return Po(r)},ne=Co,jo=D,No=Or,_o=ne(ne.bind),Do=function(r,e){return jo(r),e===void 0?r:No?_o(r,e):function(){return r.apply(e,arguments)}},We={},Mo=E,Ao=We,Fo=Mo("iterator"),Bo=Array.prototype,Lo=function(r){return r!==void 0&&(Ao.Array===r||Bo[Fo]===r)},Uo=E,Go=Uo("toStringTag"),ze={};ze[Go]="z";var xo=String(ze)==="[object z]",Ko=xo,Vo=d,V=q,ko=E,Wo=ko("toStringTag"),zo=Object,Yo=V(function(){return arguments}())==="Arguments",qo=function(r,e){try{return r[e]}catch{}},Jo=Ko?V:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=qo(e=zo(r),Wo))=="string"?t:Yo?V(e):(n=V(e))==="Object"&&Vo(e.callee)?"Arguments":n},Ho=Jo,ae=wr,Xo=Sr,Zo=We,Qo=E,ri=Qo("iterator"),Ye=function(r){if(!Xo(r))return ae(r,ri)||ae(r,"@@iterator")||Zo[Ho(r)]},ei=O,ti=D,ni=M,ai=Tr,oi=Ye,ii=TypeError,vi=function(r,e){var t=arguments.length<2?oi(r):e;if(ti(t))return ni(ei(t,r));throw new ii(ai(r)+" is not iterable")},ui=O,oe=M,ci=wr,li=function(r,e,t){var n,a;oe(r);try{if(n=ci(r,"return"),!n){if(e==="throw")throw t;return t}n=ui(n,r)}catch(o){a=!0,n=o}if(e==="throw")throw t;if(a)throw n;return oe(n),t},fi=Do,si=O,yi=M,di=Tr,$i=Lo,pi=xe,ie=Oe,bi=vi,hi=Ye,ve=li,gi=TypeError,k=function(r,e){this.stopped=r,this.result=e},ue=k.prototype,Oi=function(r,e,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),v=!!(t&&t.INTERRUPTED),u=fi(e,n),c,s,T,R,l,w,Cr,jr=function(y){return c&&ve(c,"normal",y),new k(!0,y)},Nr=function(y){return a?(yi(y),v?u(y[0],y[1],jr):u(y[0],y[1])):v?u(y,jr):u(y)};if(o)c=r.iterator;else if(i)c=r;else{if(s=hi(r),!s)throw new gi(di(r)+" is not iterable");if($i(s)){for(T=0,R=pi(r);R>T;T++)if(l=Nr(r[T]),l&&ie(ue,l))return l;return new k(!1)}c=bi(r,s)}for(w=o?r.next:c.next;!(Cr=si(w,c)).done;){try{l=Nr(Cr.value)}catch(y){ve(c,"throw",y)}if(typeof l=="object"&&l&&ie(ue,l))return l}return new k(!1)},Si=f,qe=Si.Promise,Ei=E,Je=Ei("iterator"),He=!1;try{var Ti=0,ce={next:function(){return{done:!!Ti++}},return:function(){He=!0}};ce[Je]=function(){return this},Array.from(ce,function(){throw 2})}catch{}var wi=function(r,e){try{if(!e&&!He)return!1}catch{return!1}var t=!1;try{var n={};n[Je]=function(){return{next:function(){return{done:t=!0}}}},r(n)}catch{}return t},C=f,Ii=Se,mi=q,x=function(r){return Ii.slice(0,r.length)===r},Ri=function(){return x("Bun/")?"BUN":x("Cloudflare-Workers")?"CLOUDFLARE":x("Deno/")?"DENO":x("Node.js/")?"NODE":C.Bun&&typeof Bun.version=="string"?"BUN":C.Deno&&typeof Deno.version=="object"?"DENO":mi(C.process)==="process"?"NODE":C.window&&C.document?"BROWSER":"REST"}(),Pi=f,j=qe,Ci=d,ji=Ve,Ni=Ae,_i=E,le=Ri,fr=Te;j&&j.prototype;var Di=_i("species"),hr=!1,Xe=Ci(Pi.PromiseRejectionEvent),Mi=ji("Promise",function(){var r=Ni(j),e=r!==String(j);if(!e&&fr===66)return!0;if(!fr||fr<51||!/native code/.test(r)){var t=new j(function(o){o(1)}),n=function(o){o(function(){},function(){})},a=t.constructor={};if(a[Di]=n,hr=t.then(function(){})instanceof n,!hr)return!0}return!e&&(le==="BROWSER"||le==="DENO")&&!Xe}),Ai={CONSTRUCTOR:Mi,REJECTION_EVENT:Xe,SUBCLASSING:hr},Fi=qe,Bi=wi,Li=Ai.CONSTRUCTOR,Ui=Li||!Bi(function(r){Fi.all(r).then(void 0,function(){})}),Gi=To,xi=O,Ki=D,Vi=ke,ki=mo,Wi=Oi,zi=Ui;Gi({target:"Promise",stat:!0,forced:zi},{allSettled:function(e){var t=this,n=Vi.f(t),a=n.resolve,o=n.reject,i=ki(function(){var v=Ki(t.resolve),u=[],c=0,s=1;Wi(e,function(T){var R=c++,l=!1;s++,xi(v,t,T).then(function(w){l||(l=!0,u[R]={status:"fulfilled",value:w},--s||a(u))},function(w){l||(l=!0,u[R]={status:"rejected",reason:w},--s||a(u))})}),--s||a(u)});return i.error&&o(i.value),n.promise}});export{F as c,Yi as g};
2
2
  //# sourceMappingURL=vendor.core-js.js.map