userflow.js-self-hosted 0.1.1017209 → 0.1.1017252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ResourceCenterApp.js +3 -3
- package/ResourceCenterLauncherHandler.js +1 -1
- package/hash.txt +1 -1
- package/package.json +1 -1
- package/ui.js +1 -1
- package/userflow.js +3 -3
- package/vendor.core-js.js +1 -1
package/ResourceCenterApp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ResourceCenterAssistantChat.js","vendor.react.js","vendor.core-js.js","vendor.object-assign.js","userflow.js","vendor.phoenix.js","vendor.uuid.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.dompurify.js","vendor.marked.js","vendor.obj-str.js","use-selector-element-monitoring.js","flow-condition-types.js","vendor.date-fns.js","roots.js","stylesheets.js","vendor.fortawesome.pro-solid-svg-icons.js","vendor.react-dom.js","vendor.scheduler.js","flow-host.styl.js","Frame.js","use-window-resize.js","logomark.js","ChecklistUI.js","FlowChrome.js","vendor.canvas-confetti.js","vendor.memoize-one.js","vendor.bignumber.js.js","use-element-rect.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{z as
|
|
3
|
-
`+t.chatCode)()}catch(n){console.error(`Userflow.js: Showing custom chat provider failed. Code: ${t.chatCode}`,n)}},hide:()=>{}},[
|
|
4
|
-
`))&&(N+=" "),d=d||"growing-textarea",u=u||d+"__mirror";const[S,j]=l.useState(!1);return e.createElement("div",{className:D({[d]:!0,[`${d}__loading`]:b})},e.createElement("div",{className:u+" "+(p||"")},N),e.createElement("textarea",{ref:t,value:n,onChange:C=>r&&r(C.target.value),onBlur:s,onKeyDown:C=>{if(C.key==="Enter"&&S){C.preventDefault();return}o&&o(C)},onMouseDown:c,placeholder:i,disabled:a||b,readOnly:E,className:D({"growing-textarea__input":!0,[p||""]:!0,[`${d}__with-icon`]:!!h,[`${d}__loading-input`]:b}),onCompositionStart:()=>j(!0),onCompositionEnd:()=>j(!1)}),h&&!b&&e.createElement("div",{className:`${d}__icon`},e.createElement("button",{className:"btn btn--plain-blue btn--square btn--md32",onClick:w},e.createElement(A,{icon:h}))),b&&e.createElement("div",{className:`${d}__loader`},e.createElement(er,{indeterminate:!0,size:"xs",color:"purple"})),v)},nr=({textareaRef:t,value:n,onChange:r,onSubmit:s,placeholder:o,readOnly:c})=>{const i=()=>{s&&s()};return e.createElement("div",{className:"userflowjs-assistant-chat-input"},e.createElement(tr,{textareaRef:t,className:"userflowjs-growing-textarea",mirrorClassName:"userflowjs-growing-textarea__mirror",textareaClassName:"userflowjs-textarea userflowjs-assistant-chat-input__textarea",placeholder:o,readOnly:c,value:n||"",onChange:r,onKeyDown:a=>{!a.shiftKey&&a.key==="Enter"&&(a.preventDefault(),i())}}),e.createElement("button",{"data-testid":"assistant-chat-input-submit",className:"userflowjs-assistant-chat-input__submit",onClick:()=>i()},e.createElement(A,{icon:Ln})))};function rr(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Ot(t){return Re.linkUrlDecorator?Re.linkUrlDecorator(t):t}const Rt=5,sr=async()=>(await Nn(async()=>{const{ResourceCenterAssistantChat:t}=await import("./ResourceCenterAssistantChat.js");return{ResourceCenterAssistantChat:t}},__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,31,32]))).ResourceCenterAssistantChat,_t=({session:t,isOpen:n,flowSession:r,checklistSession:s,resourceCenterLauncherHidden:o})=>{const c=x(),{t:i}=ne(),{company:a}=t.flow,{version:E}=t,d=E.resourceCenter,u=ve(E.theme),p=t.locale?t.locale.standardLocaleId:t.version.theme.languageId;l.useEffect(()=>{be.changeLanguage(p)},[p]);const{loaded:h}=bt(window,Et,u),[w,b]=l.useState(!1),v=h&&w,[N,S]=l.useState(vt()),[j,C]=l.useState(gt()),M=l.useCallback(()=>{S(vt()),C(gt())},[]);Tn(M);const{zIndex:K,bringToFront:P}=jn(),[O,V]=l.useState(null),[W,Q]=l.useState(null),[J,ce]=l.useState(null),ae=l.useRef(null),[q,Xt]=l.useState(null),[Xe,Yt]=l.useState(null),[Ye,en]=l.useState(null),[tn,nn]=l.useState(0),[rn,sn]=l.useState(0),ke=l.useCallback(()=>{W&&nn(Math.round(W?.offsetWidth||0)),sn(Math.round((J?.offsetHeight||0)+(q?.offsetHeight||0)+(Xe?.offsetHeight||0)+(Ye?.offsetHeight||0)))},[W,J,q,Xe,Ye]);l.useLayoutEffect(()=>{if(!O||typeof xe!="function")return;const f=new xe(()=>{ke()});return f.observe(O,{childList:!0,attributes:!0,subtree:!0}),()=>{f.disconnect()}},[O,ke]),l.useLayoutEffect(()=>{ke()});const[et,tt]=l.useState(!1),Ne=l.useRef(),le=l.useCallback(()=>{tt(!0),window.clearTimeout(Ne.current),Ne.current=window.setTimeout(()=>{tt(!1)},u.resourceCenterTransitionDuration)},[u.resourceCenterTransitionDuration]);l.useEffect(()=>()=>{window.clearTimeout(Ne.current)},[]);const ie=l.useCallback(()=>{P(),le(),c.openResourceCenter()},[P,c,le]),je=l.useCallback(()=>{le(),c.closeResourceCenter()},[c,le]),[nt,X]=l.useState(!1);l.useEffect(()=>{if(nt){if(!rr())if(n){const f='button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), input, textarea';let k=q?.querySelector(".userflowjs-assistant-chat-input textarea")||q?.querySelector(f)||J?.querySelector(f);if(k){const T=k.closest&&k.closest(".userflowjs-resource-center-checklist")||null;T?_n(T):k.focus({preventScroll:!0})}}else W?.focus({preventScroll:!0});X(!1)}},[nt,n,q,J,W]),l.useEffect(()=>{const f=O?.ownerDocument.defaultView;if(!n||!f)return;const k=T=>{T.key==="Escape"&&(je(),X(!0))};return f.addEventListener("keydown",k),()=>f.removeEventListener("keydown",k)},[n,O,X,je]);const[g,ue]=l.useState(()=>xt(t,re.getItem(`resourceCenterRoute:v1:${t.id}`))),F=l.useCallback((f,k)=>{ue(f);const T=Vt(f);T?re.setItem(`resourceCenterRoute:v1:${t.id}`,T):re.removeItem(`resourceCenterRoute:v1:${t.id}`),k?.detail===0&&X(!0)},[t.id]);l.useEffect(()=>{const f=re.getItem(`resourceCenterRoute:v1:${t.id}`);ue(xt(t,f))},[t]),l.useEffect(()=>{if(!t.draftMode||!g||!("block"in g)||!g.block)return;const f=d.blocks.find(k=>k.cvid===g.block.cvid);f?JSON.stringify(f)!==JSON.stringify(g.block)&&ue({...g,block:f}):ue(null),g.block},[t.draftMode,d,g]);const de=l.useMemo(()=>d.blocks.filter(f=>!(f.type===y.CHECKLIST&&!s||f.type===y.DIVIDER&&u.resourceCenterAutoDividers||f.hiddenWhenFlowsActive&&f.hiddenWhenFlowsActive.some(k=>k===r?.flow.id||k===s?.flow.id))),[d,r,s,u.resourceCenterAutoDividers]),ye=l.useMemo(()=>Ht(de),[de]),Se=l.useMemo(()=>!s||!d.blocks.some(f=>f.type===y.CHECKLIST)?0:En(s),[d,s]),B=l.useMemo(()=>d.blocks.find(f=>f.type===y.CONTACT&&f.chatEnabled&&f.chatProvider),[d]),[on,rt]=l.useState(!1),me=l.useCallback(()=>{c.closeResourceCenter(),B&&B.chatProvider!==z.CUSTOM&&rt(!0)},[c,B]),fe=l.useCallback(()=>{rt(!1)},[]),st=l.useCallback(()=>{if(B)try{Le[B.chatProvider].hide({block:B}),fe()}catch(f){console.error(`Userflow.js: Error when hiding ${B.chatProvider}:`,f)}},[B,fe]);l.useEffect(()=>{if(!B)return;Re.autoHide3pDisabled=!0;const f=Le[B.chatProvider];try{const k=f.configure({block:B,onShow:me,onHide:fe});return()=>{k()}}catch(k){console.error(`Userflow.js: Error when configuring ${B.chatProvider}:`,k);return}},[B,me,fe]),l.useEffect(()=>{n&&st()},[st,n]);const I=Jt(t),he=l.useMemo(()=>{if(!I)return null;if(I.boosterAnnouncement){const f=I.boosterAnnouncement;if(!f.seen&&(f.level===L.TOAST||f.level===L.MODAL))return f}return I.popoutAnnouncement&&!I.popoutAnnouncement.seen?I.popoutAnnouncement:null},[I]),ot=ve(he?.theme||E.theme);bt(window,Et,o?ot:void 0);const we=l.useCallback((f,k,T,Y,pe)=>{const ut=()=>{Je(c,f)};return e.createElement(se.Provider,{value:{...T,data:f.data}},f.level===L.MODAL&&e.createElement(zt,{session:T,open:ie,navigate:F,block:k,announcement:f,onDismiss:ut}),(f.level===L.TOAST||f.level===L.POPOUT)&&e.createElement(Wt,{session:T,open:ie,navigate:F,block:k,announcement:f,onDismiss:ut,isStandalonePopout:pe?.isStandalonePopout,rcPlacement:Y.resourceCenterPlacement}))},[c,ie,F]),cn=(f,k,T)=>{const Y={..._e(T),zIndex:pt(Sn),position:"fixed",top:0,left:0,width:"100vw",height:"100vh",pointerEvents:f.level===L.MODAL?"auto":"none"},pe={...t,data:{...t.data,...f.data||{}}};return e.createElement(se.Provider,{value:pe},e.createElement("div",{className:"userflowjs-theme-root",style:Y,id:"userflowjs-announcement-app"},we(f,k,pe,T,{isStandalonePopout:f.level===L.POPOUT})))},an=!!g&&(g.kind==="search"||g.kind==="flows"||g.kind==="knowledgeBase"),ct=g?.kind==="assistant"||g?.kind==="announcementList"||g?.kind==="announcementShow",Ie=Math.min(ct?u.resourceCenterFullWidth:u.resourceCenterWidth,N-2*u.resourceCenterPaddingX),ln=540,un=720,dn={zIndex:u.resourceCenterZIndex!=null?u.resourceCenterZIndex:n?K:pt(yn),position:v?void 0:"absolute",visibility:v&&!on?void 0:"hidden"},mn={width:(n?Ie:tn)+"px",height:n?Math.min(an?ln:ct?un:rn,j-2*u.resourceCenterPaddingY,u.resourceCenterMaxHeight==null?Number.MAX_VALUE:u.resourceCenterMaxHeight)+"px":void 0,display:o&&!n?"none":void 0},[fn,at]=l.useState(!1),lt=()=>{ie(),X(!0)},it=u.resourceCenterDisplayChecklistProgress&&s&&Se>0?e.createElement("div",{"data-testid":"resource-center-launcher-badge",className:"userflowjs-resource-center-launcher-badge"},Se,e.createElement("div",{className:"userflowjs-a11y-only"},"uncompleted tasks")):null;let Ee="",Ae="";u.resourceCenterLauncherTextMode===dt.CHECKLIST_OVERRIDE&&s&&Se>0?Ee=s.version.checklist?.launcherText||"Get Started":u.resourceCenterLauncherTextMode!==dt.NONE&&(Ae=d.buttonText);const hn=t.version.resourceCenter?.launcherType,Te=he?.level,wn=Te===L.MODAL||Te===L.TOAST||Te===L.POPOUT&&hn!==pn.CUSTOM;return o&&!n&&he&&I&&wn?cn(he,I,ot):e.createElement(se.Provider,{value:t},e.createElement("div",{"data-testid":"resource-center-app",className:"userflowjs-resource-center-app userflowjs-theme-root",style:_e(u),dir:be.dir()},e.createElement("div",{className:D({"userflowjs-resource-center":!0,"userflowjs-resource-center--fixed":!0,[`userflowjs-resource-center--placement-${u.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0}),style:dn},e.createElement("div",{className:"userflowjs-resource-center-frame-wrapper",onMouseEnter:()=>at(!0),onMouseLeave:()=>at(!1)},e.createElement(Ke,{className:D({"userflowjs-resource-center-frame":!0,"userflowjs-resource-center-frame--animating":et,"userflowjs-resource-center-frame--open":n,"userflowjs-resource-center-frame--closed":!n}),style:mn,stylesheet:Ve,theme:u,onStylesheetsLoad:b,title:"Resource center"},v&&e.createElement(e.Fragment,null,e.createElement("div",{ref:V,className:D({"userflowjs-resource-center-frame-root":!0,[`userflowjs-resource-center-frame-root--placement-${u.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0,"userflowjs-resource-center-frame-root--animating":et,"userflowjs-resource-center-frame-root--open":n,"userflowjs-resource-center-frame-root--closed":!n}),role:n?"dialog":void 0,"aria-label":n?d.headerText:void 0},!o&&e.createElement("div",{className:"userflowjs-resource-center-launcher-container"},e.createElement("button",{ref:Q,className:D({"userflowjs-resource-center-launcher-button":!0,"userflowjs-resource-center-launcher-button--hover":fn}),onClick:lt,"aria-label":`Open ${d.headerText}`},it,Ee&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},Ee),(it||Ee)&&e.createElement("div",{className:"userflowjs-resource-center-launcher-divider"}),Ae&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},Ae),e.createElement("div",{className:"userflowjs-resource-center-launcher-icon"},u.resourceCenterLauncherIconType===mt.PLAINTEXT?"?":u.resourceCenterLauncherIconType===mt.DEFAULT?e.createElement(Jn,null):u.rcIconAsset&&u.rcIconAsset.assetUrl?e.createElement("img",{src:u.rcIconAsset.assetUrl,className:"company-icon",style:{height:`${u.rcIconSize}px`,width:`${u.rcIconSize}px`}}):e.createElement("span",null)))),e.createElement("div",{ref:ae,className:"userflowjs-resource-center-body",style:{width:Ie+"px"}},e.createElement("div",{ref:Xt,className:D({"userflowjs-resource-center-body-content":!0,"userflowjs-resource-center-body-content--padding":g?.kind!=="assistant","userflowjs-resource-center-body-content--same-background":u.sameBackground,"userflowjs-resource-center-body-content--with-made-with-userflow":a.resourceCenterBranding})},n&&e.createElement(e.Fragment,null,g?g.kind==="search"?e.createElement(or,{session:t,navigate:F}):g.kind==="email"?e.createElement(cr,{block:g.block,session:t}):g.kind==="phone"?e.createElement(ar,{block:g.block,session:t}):g.kind==="flows"?e.createElement(lr,{block:g.block,initialQ:g.initialQ,session:t,navigate:F}):g.kind==="knowledgeBase"?e.createElement(ir,{block:g.block,initialQ:g.initialQ,session:t,bodyRef:ae}):g.kind==="subpage"?e.createElement(ur,{block:g.block,session:t}):g.kind==="announcementList"||g.kind==="announcementShow"?e.createElement(dr,{bodyRef:ae,session:t,route:g,navigate:F}):g.kind==="assistant"?e.createElement(hr,{block:g.block,initialUserContent:g.initialUserContent,session:t,navigate:F,chatBlock:B,onChatShow:me}):null:e.createElement(e.Fragment,null,de.map((f,k)=>{const T=oe[f.type],Y=de[k+1];return T?e.createElement(e.Fragment,{key:f.id},e.createElement(T.View,{session:t,flowSession:r,checklistSession:s,block:f,navigate:F,onChatShow:me}),Y&&Hn(u,f.type,Y.type)&&e.createElement("div",{className:"userflowjs-resource-center-divider"})):null}))))),a.resourceCenterBranding&&e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow"},e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow-content",ref:Yt},e.createElement("a",{href:"https://userflow.com/?utm_source=made-with-userflow&utm_medium=link&utm_campaign=made-with-userflow-"+a.slug+"&utm_content=resource-center",target:"_blank",rel:"noopener noreferrer"},e.createElement(Rn,null),e.createElement("div",null,"Made with Userflow")))),t.draftMode&&e.createElement("div",{className:"userflowjs-resource-center-preview"},e.createElement("div",{ref:en,className:"userflowjs-resource-center-preview-content"},e.createElement("div",{className:"userflowjs-resource-center-preview-text"},"Preview"),e.createElement("button",{className:"userflowjs-resource-center-preview-button",onClick:()=>{c.endFlow(t,{endReason:bn.USER_CLOSED})}},e.createElement(A,{icon:Qe})))),e.createElement("div",{className:"userflowjs-resource-center-header",style:{width:Ie+"px"}},e.createElement("div",{ref:ce,className:"userflowjs-resource-center-header-content"},g==null?e.createElement("div",{className:"userflowjs-resource-center-header-text"},d.headerText):e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:f=>F(g?.kind==="announcementShow"?{kind:"announcementList",block:g.block}:null,f)},e.createElement("div",{className:"userflowjs-rtl-mirrored"},e.createElement(A,{icon:Mn})),e.createElement("div",{className:"userflowjs-resource-center-icon-button__text"},i("resource_center.back"))),e.createElement("div",{className:"flex-1"}),ye.length>0&&e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:()=>{let f={kind:"search"};if(ye.length===1){const k=ye[0],T=oe[k.type];T.routeTo&&(f=T.routeTo({block:k}))}g?.kind==="search"?F(null):(R(c,t,null,"Search icon"),F(f))},"aria-label":"Search"},e.createElement(A,{icon:Bn})),e.createElement("button",{className:"userflowjs-resource-center-icon-button userflowjs-resource-center-close-button",onClick:f=>{je(),f.detail===0&&X(!0)},"aria-label":`Close ${d.headerText}`},e.createElement(A,{icon:Dn}))))))),!n&&!r&&!o&&I&&I.unreadAnnouncementCount>0&&e.createElement($t,{theme:u,count:I.unreadAnnouncementCount,onClick:lt})),!n&&!r&&!o&&I?.popoutAnnouncement&&we(I.popoutAnnouncement,I,t,u),!n&&!r&&!o&&I?.boosterAnnouncement&&I.boosterAnnouncement.level===L.MODAL&&we(I.boosterAnnouncement,I,t,u),!n&&!r&&!o&&I?.boosterAnnouncement&&I.boosterAnnouncement.level===L.TOAST&&we(I.boosterAnnouncement,I,t,u))))},$t=({theme:t,count:n,onClick:r,style:s})=>{const[o,c]=l.useState(!1);return e.createElement(Ke,{className:D({"userflowjs-resource-center-launcher-unread-badge":!0}),noScroll:!0,style:{position:o?void 0:"absolute",visibility:o?void 0:"hidden",...s},stylesheet:Ve,theme:t,onStylesheetsLoad:c,title:"Resource center unread badge"},e.createElement(Ut,{count:n,onClick:r}))},Ut=({count:t,onClick:n})=>{let r=null;return t>9&&(t=9,r=e.createElement("span",{className:"userflowjs-unread-badge-plus"},"+")),e.createElement("div",{className:D({"userflowjs-unread-badge":!0,"userflowjs-unread-badge--clickable":!!n}),onClick:n},e.createElement("span",null,t),r)},Wt=({session:t,open:n,navigate:r,announcement:s,block:o,rcPlacement:c,onDismiss:i,isStandalonePopout:a})=>{const E=l.useRef(null),d=ve(s.theme),u=d.toastPlacement,p=!!o.boosterAnnouncement||a!==void 0&&s?.level===L.TOAST,h=u===c;let w=null,b=null;s&&(w=s.toastAutoDismiss??d.toastAutoDismiss,b=s.toastWidth?s.toastWidth:d.toastWidth);const v=x(),[N,S]=l.useState(!1),{height:j,setEl:C}=zn();l.useEffect(()=>{const Q=E.current;if(!Q||w===null)return;const J=Date.now(),ce=()=>{const q=1-(Date.now()-J)/(new Ft(w||0).toNumber()*1e3);q<=0?(Q.style.width="0%",s&&$(v,s)):(Q.style.width=`${q*100}%`,requestAnimationFrame(ce))};return requestAnimationFrame(ce),()=>{Q&&(Q.style.width="0%")}},[E.current,w,v,s,$]);const M=i||(()=>{s&&$(v,s)}),K=20,P=l.useMemo(()=>CSS.supports("height: 100dvh")?"dvh":"vh",[]),O=()=>{p&&s&&($(v,s),R(v,t,o,s.title),r({kind:"announcementShow",block:o,announcementId:s.id}),n())};if(!s)return null;const V=!!a&&!!c,W=(a!==void 0||!h)&&!!u&&p;return e.createElement("div",{className:D({"userflowjs-resource-center-popout":!p,"userflowjs-resource-center-toast":p,[`userflowjs-resource-center-popout-standalone--${c?.toLowerCase()?.replace(/_/g,"-")}`]:V,[`userflowjs-resource-center-toast--${u?.toLowerCase()?.replace(/_/g,"-")}`]:W}),style:_e(d)},e.createElement(Ke,{className:D({"userflowjs-resource-center-popout-frame":!0}),style:{height:`calc(min(${j}px, 100${P} - 2 * var(--userflow-resource-center-padding-y) - var(--userflow-resource-center-collapsed-height) - ${K}px)`,position:N?void 0:"absolute",visibility:N?void 0:"hidden",...b&&p?{width:b}:{}},stylesheet:Ve,theme:d,onStylesheetsLoad:S,title:"Resource center popout"},p&&e.createElement("div",{className:"userflowjs-bubble-progress--default"},e.createElement("div",{className:"userflowjs-bubble-progress__fill",ref:E})),e.createElement("div",{ref:C,className:"userflowjs-resource-center-popout-frame-root",style:{cursor:p?"pointer":"auto",padding:p&&d.toastPadding||void 0}},e.createElement("div",{onClick:O},e.createElement("h2",{className:"userflowjs-announcement-title"},e.createElement("span",{className:"userflowjs-unread-dot"}),e.createElement("span",null,s.title)),e.createElement("div",{className:"userflowjs-announcement-time"},e.createElement("div",{className:"userflowjs-announcement-time-text"},Ce(s.time))),e.createElement("div",{className:"userflowjs-announcement-content userflowjs-bubble-content"},e.createElement(H,{doc:s.content,buttons:s.buttons,lookupAttribute:_(s.data)})),!p&&e.createElement(e.Fragment,null,s.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:()=>{$(v,s),R(v,t,o,s.title),r({kind:"announcementShow",block:o,announcementId:s.id}),n()}},e.createElement("div",null,(s.moreEnabled?s.moreButtonText:null)||"Read more"),!p&&e.createElement("span",{className:"userflowjs-rtl-mirrored"},e.createElement(A,{icon:Dt})))))),p&&s.moreEnabled&&e.createElement("div",{onClick:O,className:"userflowjs-announcement-more--toast"},(s.moreEnabled?s.moreButtonText:null)||"Read more"),e.createElement("div",{className:"userflowjs-bubble-toolbar"},e.createElement("button",{className:"userflowjs-bubble-toolbar-button",onClick:M,"aria-label":"Dismiss announcement"},e.createElement(A,{icon:Qe}))))),!p&&!a&&e.createElement("div",{className:"userflowjs-resource-center-popout-notch"}))},zt=({session:t,open:n,navigate:r,announcement:s,block:o,onDismiss:c})=>{const i=x(),a=ve(s.theme),d=c||(()=>{$(i,s)});return e.createElement(Un,{company:t.flow.company,theme:a,position:"fixed",width:s.modalWidth,stepAppearance:vn.MODAL,zIndex:a.checklistZIndex,autoHide3pEnabled:!0,onModalBackdropClick:d,noIframe:!0,isModalAnnouncement:!0},e.createElement("div",{id:"userflowjs-bubble-content",className:"userflowjs-bubble-content"},e.createElement("h1",null,s.title),e.createElement(H,{doc:s.content,buttons:s.buttons,lookupAttribute:_(s.data)})),e.createElement("div",{className:"userflowjs-bubble-toolbar"},e.createElement("button",{className:"userflowjs-bubble-toolbar-button",onClick:d,"aria-label":"Dismiss announcement"},e.createElement(A,{icon:Qe}))),s.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more--modal"},e.createElement("button",{className:"userflowjs-bubble-button--primary",onClick:()=>{$(i,s),R(i,t,o,s.title),r({kind:"announcementShow",block:o,announcementId:s.id}),n()}},e.createElement("div",null,(s.moreEnabled?s.moreButtonText:null)||"Read more"))))};function Ht(t){return t.filter(n=>{const r=oe[n.type];return r.isSearchable?r.isSearchable(n):!!r.search})}const oe={[y.ACTION]:{View:t=>{const{block:n,session:r,flowSession:s,checklistSession:o}=t,c=x(),[i,a]=l.useState(!1),E=s?.id,d=o?.id;return l.useEffect(()=>{a(!1)},[E,d]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:i?void 0:()=>{R(c,r,n);const u=n.actions.find(p=>p.type===gn.START_FLOW);u?u.otherFlow?.id!==o?.flow.id&&a(!0):c.closeResourceCenter(),In(c,r,n.actions)},disabled:i},e.createElement(ee,{...t}),e.createElement(Z,{...t}),i&&e.createElement(U,null))}},[y.ANNOUNCEMENTS]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=x();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"announcementList",block:n},c)}},n.unreadAnnouncementCount>0?e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(Ut,{count:n.unreadAnnouncementCount})):e.createElement(ee,{...t}),e.createElement(Z,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:te})))}},[y.ASSISTANT]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=x(),[c,i]=l.useState("");return n.assistantAppearance===Cn.INPUT?e.createElement("div",{className:"userflowjs-resource-center-assistant-block"},e.createElement(nr,{value:c,onChange:i,placeholder:qe(n.name,{lookupAttribute:_(r.data)}),onSubmit:()=>{R(o,r,n),s({kind:"assistant",block:n,initialUserContent:c})}})):e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{R(o,r,n),s({kind:"assistant",block:n,initialUserContent:""})}},e.createElement(ee,{...t}),e.createElement(Z,{...t}))}},[y.CHECKLIST]:{View:({checklistSession:t})=>e.createElement("div",{"data-testid":"resource-center-checklist",className:"userflowjs-resource-center-checklist"},e.createElement(xn,{session:t}),e.createElement(Wn,{draftMode:t.draftMode?"CHECKLIST PREVIEW":!1}))},[y.CONTACT]:{View:t=>{const{block:n,session:r,navigate:s,onChatShow:o}=t,c=x(),i=[];return n.emailEnabled&&i.push({icon:Pn,label:"Email",isRoute:!0,onClick:a=>{R(c,r,n,"Email"),s({kind:"email",block:n},a)}}),n.phoneEnabled&&i.push({icon:On,label:"Phone",isRoute:!0,onClick:a=>{R(c,r,n,"Phone"),s({kind:"phone",block:n},a)}}),n.chatEnabled&&i.push({icon:$n,label:"Live-chat",isRoute:!1,onClick:()=>{R(c,r,n,"Chat"),Gt(r,n,o)}}),e.createElement("div",{className:D({"userflowjs-resource-center-block":!0,"userflowjs-resource-center-block--clickable":i.length===1}),onClick:i.length===1?i[0].onClick:void 0},i.length===1&&e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(A,{icon:i[0].icon})),e.createElement(Z,{...t}),i.length>1&&i.map(({icon:a,label:E,onClick:d},u)=>e.createElement("button",{key:u,className:"userflowjs-resource-center-icon-button",onClick:d,"aria-label":E},e.createElement(A,{icon:a}))),i.length===1&&i[0].isRoute&&e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:te})))}},[y.DIVIDER]:{View:()=>e.createElement("div",{className:"userflowjs-resource-center-divider"})},[y.FLOWS]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=x();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"flows",block:n},c)}},e.createElement(ee,{...t}),e.createElement(Z,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:te})))},routeTo:({block:t,initialQ:n})=>({kind:"flows",block:t,initialQ:n}),isSearchable:t=>!!t.searchEnabled,search:async({client:t,session:n,block:r,q:s})=>{const{flows:o}=await t.send({kind:"ListResourceCenterBlockFlows",sessionId:n.id,blockCvid:r.cvid},{handlesRejection:!0}),c=qt(o,s),i=c.slice(0,Rt);return{block:r,truncated:i.length===c.length,results:i.map(a=>({kind:"flow",flow:a}))}}},[y.KNOWLEDGE_BASE]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=x();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"knowledgeBase",block:n},c)}},e.createElement(ee,{...t}),e.createElement(Z,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:te})))},routeTo:({block:t,initialQ:n})=>({kind:"knowledgeBase",block:t,initialQ:n}),search:async({client:t,session:n,block:r,q:s})=>{const{truncated:o,articles:c}=await t.send({kind:"SearchKnowledgeBase",sessionId:n.id,blockCvid:r.cvid,q:s,offset:0,limit:Rt},{handlesRejection:!0});return{block:r,truncated:o,results:c.map(i=>({kind:"article",article:i}))}}},[y.MESSAGE]:{View:({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-block"},e.createElement("div",{className:"userflowjs-resource-center-block-text userflowjs-bubble-content"},e.createElement(H,{doc:t.content,lookupAttribute:_(n.data)})))},[y.SUBPAGE]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=x();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"subpage",block:n},c)}},e.createElement(ee,{...t}),e.createElement(Z,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:te})))}}},ee=({block:t})=>t.icon?e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(A,{icon:t.icon,size:16})):null,Z=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement(G,{doc:t.name,lookupAttribute:_(n.data)}));function Vt(t){if(!t)return null;let n;"block"in t&&t.block!=null&&(n=t.block.cvid);const r={kind:t.kind,blockCvid:n};switch(t.kind){case"announcementShow":r.announcementId=t.announcementId;break}return JSON.stringify(r)}function xt(t,n){if(!n)return null;const r=JSON.parse(n);let s;if(r.blockCvid&&(s=t.version.resourceCenter?.blocks.find(c=>c.cvid===r.blockCvid)),!s&&r.kind!=="search")return null;const o={kind:r.kind,block:s};switch(o.kind){case"announcementShow":o.announcementId=r.announcementId;break}return o}const or=({session:t,navigate:n})=>{const r=x(),s=t.version.resourceCenter.blocks,o=Ht(s),{t:c}=ne(),i=l.useRef(null),[a,E]=l.useState(""),[d,u]=Ge(a,E),[p,h]=l.useState(null);return l.useEffect(()=>{if(a.trim()===""){h(null);return}let w=!1;return(async()=>{h(null);const v=await Promise.all(s.map(async N=>{const{search:S}=oe[N.type];if(!S)return null;try{return await S({client:r,session:t,block:N,q:a})}catch(j){return console.error(`Userflow.js: Global search failed for ${N.type} block=`,N,"error=",j),null}}));w||h(v.filter(N=>N!=null&&N.results.length>0))})(),()=>{w=!0}},[r,t,s,a]),l.useEffect(()=>{i.current?.focus({preventScroll:!0})},[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:i,className:"userflowjs-text-input",type:"text",value:d,onChange:w=>u(w.target.value),placeholder:c("resource_center.search_placeholder")})),a.trim()===""?e.createElement("div",{"data-testid":"resource-center-empty-query",className:"userflowjs-resource-center-list-route-error"},c("resource_center.search_in")," ",o.map((w,b)=>e.createElement(e.Fragment,{key:w.cvid},b>0&&(b===o.length-1?` ${c("and")} `:", "),e.createElement("b",null,e.createElement(G,{doc:w.name,lookupAttribute:_(t.data)})))),"."):p?p.length===0?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},c("resource_center.no_results_found")):p.map(({block:w,truncated:b,results:v},N)=>{const S=oe[w.type],j=S.routeTo&&S.routeTo({block:w,initialQ:a});return e.createElement(e.Fragment,{key:w.cvid},N>0&&e.createElement("div",{className:"userflowjs-resource-center-divider"}),e.createElement("div",{className:"userflowjs-resource-center-label"},e.createElement(G,{doc:w.name,lookupAttribute:_(t.data)})),v.map((C,M)=>C.kind==="flow"?e.createElement(Kt,{key:C.flow.id,block:w,session:t,flow:C.flow,navigate:n}):C.kind==="article"?e.createElement(Qt,{key:M,block:w,session:t,article:C.article}):null),!b&&j&&e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:C=>{R(r,t,w),n(j,C)}},e.createElement("div",{className:"userflowjs-resource-center-block-text"},c("more"),":"," ",e.createElement(G,{doc:w.name,lookupAttribute:_(t.data)})),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:te}))))}):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(U,null)))},cr=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(H,{doc:t.emailContent,lookupAttribute:_(n.data)})),ar=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(H,{doc:t.phoneContent,lookupAttribute:_(n.data)})),lr=({block:t,initialQ:n,session:r,navigate:s})=>{const{t:o}=ne(),c=l.useRef(null),[i,a]=l.useState(n||""),[E,d]=Ge(i,a),{data:u,error:p}=ge({message:{kind:"ListResourceCenterBlockFlows",sessionId:r.id,blockCvid:t.cvid}}),h=u?.flows,w=l.useMemo(()=>h?qt(h,i):null,[h,i]);return l.useEffect(()=>{c.current?.focus({preventScroll:!0})},[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(G,{doc:t.name,lookupAttribute:_(r.data)}))),t.searchEnabled&&e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:E,onChange:b=>d(b.target.value),placeholder:o("resource_center.search_placeholder")})),p?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o("resource_center.generic_error")):w?w.length===0?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o("resource_center.no_results_found")):w.map(b=>e.createElement(Kt,{key:b.id,block:t,session:r,flow:b,navigate:s})):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(U,{fadeIn:!0})))};function qt(t,n){const r=n.toLowerCase().trim();return r===""?t:t.filter(s=>s.name.toLowerCase().includes(r))}const Kt=({block:t,session:n,flow:r,navigate:s})=>{const o=x(),[c,i]=l.useState(!1);return l.useEffect(()=>{if(!c||r.type!==ft.CHECKLIST)return;const a=()=>{o.checklistSession?.flow.id===r.id&&(E(),s(null))},E=()=>{o.off("checklistChanged",a)};return o.on("checklistChanged",a),E},[o,c,r.type,r.id,s]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{if(R(o,n,t,r.name),o.checklistSession?.flow.id===r.id){s(null);return}o.startFlow({flowId:r.id,startReason:n.draftMode?ht.DRAFT:ht.RESOURCE_CENTER,replaceCurrent:!0}),i(!0);const a=qe(r.url,{lookupAttribute:_(n.data)});a&&An(a)},disabled:c},r.iconSetting!==kn.HIDE&&e.createElement("div",{className:"userflowjs-resource-center-block-icon"},r.icon?e.createElement(A,{icon:r.icon,size:16}):e.createElement(A,{icon:r.type===ft.CHECKLIST?"regular/tasks":"regular/shoe-prints",size:16})),n.draftMode&&!r.published&&e.createElement("div",{className:"userflowjs-resource-center-code-block"},e.createElement("div",{title:"Unpublished. Preview only"},e.createElement("code",null,"P"))),e.createElement("div",{className:"userflowjs-resource-center-block-text"},r.name),c&&e.createElement(U,null))},ir=({block:t,initialQ:n,session:r,bodyRef:s})=>{const{t:o}=ne(),c=l.useRef(null),[i,a]=l.useState(n||""),[E,d]=Ge(i,a),{loading:u,loadingMore:p,data:h,messageForData:w,error:b,loadMore:v}=ge({message:{kind:"SearchKnowledgeBase",sessionId:r.id,blockCvid:t.cvid,q:i,offset:0}}),N=h?.truncated,S=l.useCallback(()=>{v((C,M)=>({...M,offset:C.articles.length}),(C,M)=>({...M,articles:[...C.articles,...M.articles]}))},[v]);Zt({bodyRef:s,loading:u,loadingMore:p,truncated:N,loadMoreHelper:S}),l.useEffect(()=>{c.current?.focus({preventScroll:!0})},[]);let j=t.knowledgeBaseUrl||"";return j.match(/^https?:\/\//)||(j=`http://${j}`),j=Ot(j),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(G,{doc:t.name,lookupAttribute:_(r.data)})),e.createElement("a",{className:"userflowjs-resource-center-icon-button",href:j,target:"_blank",rel:"noopener noreferrer"},e.createElement(A,{icon:Fn}))),e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:E,onChange:C=>d(C.target.value),placeholder:o("resource_center.search_placeholder")})),b?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},b.code==="quota_exceeded"?"Sorry, this company has reached its max number of searches. Consider asking Userflow to be moved to a dedicated search engine for a higher quota.":b.humanMessage||o("resource_center.generic_error")):u||!h?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(U,null)):h.articles.length===0?w?.q===""?null:e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o("resource_center.no_results_found")):e.createElement(e.Fragment,null,w?.q===""&&e.createElement("div",{className:"userflowjs-resource-center-label"},o("resource_center.suggested_articles")),h.articles.map((C,M)=>e.createElement(Qt,{key:M,block:t,session:r,article:C})),p&&e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(U,null))))},Qt=({block:t,article:n,session:r})=>{const s=x();return e.createElement("a",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{R(s,r,t,n.title)},href:Ot(n.url),target:"_blank",rel:"noopener noreferrer"},e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(A,{icon:"regular/file-alt",size:16})),e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement("span",{dangerouslySetInnerHTML:{__html:n.htmlTitle}}),e.createElement("div",{className:"userflowjs-resource-center-block-subtext",dangerouslySetInnerHTML:{__html:n.htmlSnippet}})))},ur=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(H,{doc:t.content,lookupAttribute:_(n.data)})),dr=({bodyRef:t,session:n,route:r,navigate:s})=>{const o=x(),c=ge({message:{kind:"ListAnnouncements",beforeAnnouncementId:null},skip:r?.kind!=="announcementList"}),{loading:i,loadingMore:a,data:E,loadMore:d}=c,u=E?.truncated,p=l.useCallback(()=>{d((b,v)=>b.announcements.length>0?{...v,beforeAnnouncementId:b.announcements[b.announcements.length-1].id}:v,(b,v)=>({...v,announcements:[...b.announcements,...v.announcements]}))},[d]);Zt({bodyRef:t,loading:i,loadingMore:a,truncated:u,loadMoreHelper:p});const[h,w]=l.useState(void 0);return l.useLayoutEffect(()=>{t.current&&h!=null&&r?.kind==="announcementList"&&(t.current.scrollTop=h)},[t,h,r?.kind]),r?.kind==="announcementList"?e.createElement(mr,{bodyRef:t,session:n,block:r.block,onMoreClick:b=>{w(t.current?.scrollTop),R(o,n,r.block,b.title),s({kind:"announcementShow",block:r.block,announcementId:b.id})},...c}):r?.kind==="announcementShow"?e.createElement(fr,{announcementId:r.announcementId}):null},mr=({bodyRef:t,block:n,session:r,onMoreClick:s,error:o,loading:c,loadingMore:i,data:a})=>{const{t:E}=ne(),[d,u]=l.useMemo(()=>{const h=[],w=[];if(a){let b=-1;for(const v of a.announcements)b++,b<a.pageSize&&!v.seen&&v.level!==L.SILENT?h.push(v):w.push(v)}return[h,w]},[a]),p=d.length;return e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(G,{doc:n.name,lookupAttribute:_(r.data)}))),o?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o.humanMessage||E("resource_center.generic_error")):c||!a?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(U,null)):a.announcements.length===0?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},be.exists("resource_center.no_announcements",{fallbackLng:[]})?E("resource_center.no_announcements"):E("resource_center.no_results_found")):e.createElement(e.Fragment,null,p>0&&e.createElement("div",{className:"userflowjs-announcement-unread-header"},E("resource_center.unread",{count:p})),d.map((h,w)=>e.createElement(Mt,{key:w,bodyRef:t,onMoreClick:()=>s(h),announcement:h})),d.length>0&&u.length>0&&e.createElement("div",{className:"userflowjs-announcement-seen-divider"}),u.map((h,w)=>e.createElement(Mt,{key:w,bodyRef:t,onMoreClick:()=>s(h),announcement:h})),i&&e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(U,null))))},Lt=new Set;function $(t,n){Lt.has(n.id)&&n.seen||(Lt.add(n.id),Je(t,n))}const Mt=({bodyRef:t,onMoreClick:n,announcement:r})=>{const s=x(),o=Bt(),c=l.useRef(null),i=l.useRef(!1);return l.useEffect(()=>{if(i.current||r.seen)return;const a=new IntersectionObserver(d=>{const u=d[0];u&&u.isIntersecting&&($(s,r),i.current=!0,E())},{root:t.current,threshold:1}),E=()=>{a.disconnect()};return a.observe(c.current),E},[t,s,r]),e.createElement("div",{className:"userflowjs-announcement-list-item"},e.createElement("div",{className:"userflowjs-announcement-time-divider"},e.createElement("div",{className:"userflowjs-announcement-time-divider-line"}),e.createElement("div",{className:"userflowjs-announcement-time-text"},Ce(r.time)),e.createElement("div",{className:"userflowjs-announcement-time-divider-line"})),e.createElement("h2",{ref:c,className:"userflowjs-announcement-title"},!r.seen&&r.level!==L.SILENT&&e.createElement("span",{className:"userflowjs-unread-dot"}),e.createElement("span",null,r.title)),e.createElement("div",{className:"userflowjs-announcement-content userflowjs-bubble-content"},e.createElement(se.Provider,{value:{...o,data:r.data}},e.createElement(H,{doc:r.content,buttons:r.buttons,lookupAttribute:_(r.data)}))),e.createElement("div",{className:"userflowjs-announcement-more"},r.moreEnabled&&e.createElement("button",{className:"userflowjs-tertiary-button",onClick:n},e.createElement("div",null,r.moreButtonText||"Read more"),e.createElement("span",{className:"userflowjs-rtl-mirrored"},e.createElement(A,{icon:Dt})))))},fr=({announcementId:t})=>{const n=x(),r=Bt(),{t:s}=ne(),{loading:o,data:c,error:i}=ge({message:{kind:"GetAnnouncement",announcementId:t}}),a=c?.announcement;return l.useEffect(()=>{!a||a.seen||$(n,a)},[n,a]),e.createElement(e.Fragment,null,i?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},i.humanMessage||s("resource_center.generic_error")):o||!a?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(U,null)):e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-announcement-show"},e.createElement("h2",{className:"userflowjs-announcement-title"},a?.title),e.createElement("div",{className:"userflowjs-announcement-time"},e.createElement("div",{className:"userflowjs-announcement-time-text"},Ce(a.time))),e.createElement("div",{className:"userflowjs-bubble-content"},e.createElement(se.Provider,{value:{...r,data:a.data}},e.createElement(H,{doc:a.content,buttons:a.buttons,lookupAttribute:_(a.data)}),a.moreEnabled&&e.createElement(H,{doc:a.moreContent,buttons:a.moreButtons,lookupAttribute:_(a.data)}))))))},hr=({block:t,initialUserContent:n,session:r,navigate:s,onChatShow:o})=>{const c=t.assistantFlowId,i=x(),[a,E]=l.useState(null),[d,u]=l.useState(null),[p,h]=l.useState(null),[w]=l.useState(n);l.useEffect(()=>{n&&s({kind:"assistant",block:t,initialUserContent:""})},[n,t,s]),l.useEffect(()=>{let v=!1;return(async()=>{try{const S=re.getItem("assistantConversationId:"+c),[j,C]=await Promise.all([sr(),i.send({kind:"GetAssistant",assistantFlowId:c,conversationId:S},{handlesRejection:!0,endBatch:!0})]);if(v)return;E(()=>j),u(C)}catch(S){console.error("Resource center assistant route failed to load:",S),h(S.humanMessage||"Sorry, something went wrong. Please try again or contact my human friends.")}})(),()=>{v=!0}},[i,c]);const b=l.useMemo(()=>{if(!t.assistantContactEnabled)return;const v=r.version.resourceCenter?.blocks.find(N=>N.type===y.CONTACT);if(v)return()=>{switch(R(i,r,t,t.assistantContactButtonText||void 0),t.assistantContactMethod){case wt.EMAIL:s({kind:"email",block:v});break;case wt.PHONE:s({kind:"phone",block:v});break;default:s(null),Gt(r,v,o);break}}},[i,r,t,o,s]);return p?e.createElement("div",{className:"userflowjs-assistant-chat"},e.createElement("div",{className:"userflowjs-assistant-chat__content"},e.createElement("div",{className:"userflowjs-assistant-chat__error"},p))):!a||!d?e.createElement(U,{center:!0,fadeIn:!0}):e.createElement(a,{block:t,session:r,assistantReply:d,initialUserContent:w,onContactClick:b,contactButtonText:t.assistantContactButtonText||void 0})};function R(t,n,r,s){t.send({kind:"ClickResourceCenter",sessionId:n.id,description:r?qe(r.name,{lookupAttribute:_(n.data)})+(s?` - ${s}`:""):s},{batch:!0})}function Zt({bodyRef:t,loading:n,loadingMore:r,truncated:s,loadMoreHelper:o}){l.useEffect(()=>{const c=t.current;if(!c||n||r||s)return;const i=()=>{c.scrollHeight-c.clientHeight-c.scrollTop>400||o()};return c.addEventListener("scroll",i),()=>{c.removeEventListener("scroll",i)}},[t,n,r,s,o])}function Gt(t,n,r){if(n.chatProvider){const s=Le[n.chatProvider];try{s.show({block:n})}catch(o){console.error(`Userflow.js: Error when showing ${n.chatProvider}:`,o)}r()}else t.draftMode&&window.alert("You have not selected a chat provider. Go to the resource center builder in Userflow. Click the Contact block. Pick a chat provider in the side panel.")}function Je(t,n){t.setResourceCenterSession(r=>r?{...r,version:{...r.version,resourceCenter:{...r.version.resourceCenter,blocks:r.version.resourceCenter.blocks.map(s=>s.type===y.ANNOUNCEMENTS?{...s,unreadAnnouncementCount:n.level===L.SILENT?s.unreadAnnouncementCount:s.unreadAnnouncementCount-1,popoutAnnouncement:s.popoutAnnouncement?.id===n.id?null:s.popoutAnnouncement,boosterAnnouncement:s.boosterAnnouncement?.id===n.id?null:s.boosterAnnouncement}:s)}}}:null),t.send({kind:"MarkAnnouncementSeen",announcementId:n.id,versionId:n.versionId}),t.toggleUI()}function Jt(t){return t?.version.resourceCenter?.blocks.find(n=>n.type===y.ANNOUNCEMENTS)||null}function Ce(t){const n=t?new Date(t):new Date;let r=new Intl.DateTimeFormat(be.language,{weekday:"long",day:"numeric",month:"short",year:n.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(n);return r.substring(0,1).toUpperCase()+r.substring(1)}const Br=Object.freeze(Object.defineProperty({__proto__:null,FloatingAnnouncements:Wt,LauncherUnreadBadge:$t,ModalAnnouncement:zt,ResourceCenterApp:_t,default:_t,formatAnnouncementTime:Ce,getAnnouncementsBlock:Jt,markAnnouncementSeen:$,serializeRoute:Vt,syncAnnouncementSeen:Je},Symbol.toStringTag,{value:"Module"}));export{nr as A,tr as G,$t as L,Br as R,Ot as d,Ce as f,$ as m,Vt as s};
|
|
2
|
+
import{z as S,D as W,G as xe,k as ve,C as se,x as bn,H as x,I as ht,J as wt,E as vn,r as gn,K as Cn,L as kn,a as Et,N as pt,O as Nn,Q as bt,_ as jn}from"./userflow.js";import{r as l,R as e}from"./vendor.react.js";import{u as L,i as ge}from"./client-context.js";import{f as vt,a as yn,w as gt,C as Sn,N as In}from"./flow-host.styl.js";import{S as oe,b as Qe,R as z,h as An,s as Ze,e as Z,n as Tn,f as Pt}from"./use-selector-element-monitoring.js";import{g as _}from"./flow-condition-types.js";import{D as A,u as Ce,a as Ct,g as Me}from"./stylesheets.js";import{F as Ge}from"./Frame.js";import{o as D}from"./vendor.obj-str.js";import{M as Be,e as kt,h as Nt}from"./roots.js";import{u as Rn}from"./use-window-resize.js";import{S as _n}from"./logomark.js";import"./vendor.core-js.js";import{f as Ln,C as xn}from"./ChecklistUI.js";import{K as Mn,C as Je,L as Bn,M as Dn,N as Fn,J as Ot,O as ee,z as Pn,P as On,Q as Un,R as $n}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{F as Hn,B as Wn}from"./FlowChrome.js";import{m as jt}from"./vendor.memoize-one.js";import{B as Ut}from"./vendor.bignumber.js.js";import{u as zn}from"./use-element-rect.js";import{u as te}from"./vendor.react-i18next.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="901e81de-d65d-4892-9954-2ba6f4fd9a06",t._sentryDebugIdIdentifier="sentry-dbid-901e81de-d65d-4892-9954-2ba6f4fd9a06")}catch{}})();function Vn(t,n,r){return t.resourceCenterAutoDividers?yt(n)||yt(r):!1}function yt(t){return t!==S.ACTION&&t!==S.ANNOUNCEMENTS&&t!==S.ASSISTANT&&t!==S.CONTACT&&t!==S.FLOWS&&t!==S.KNOWLEDGE_BASE&&t!==S.SUBPAGE}const f=window,De={[W.CRISP]:{configure:({onShow:t,onHide:n})=>{qn();let r=!1,s=!1;const o=()=>{r||s?(f.$crisp.push(["do","chat:show"]),t()):(f.$crisp.push(["do","chat:hide"]),n())},c=()=>{r=!0,o()};f.$crisp.push(["on","chat:opened",c]);const i=()=>{r=!1,o()};f.$crisp.push(["on","chat:closed",i]);const a=()=>{s=!0,o()};f.$crisp.push(["on","message:received",a]);const p=()=>{const E=document.getElementById("crisp-chatbox");if(!E||window.getComputedStyle(E).display!=="block")return!1;const m=E.querySelector('[data-id="new_messages"]');return!(!m||window.getComputedStyle(m).display!=="block")},d=()=>{const E=p();E!==s&&(s=E,o())},u=window.setInterval(d,200);return()=>{f.$crisp.push(["off","chat:opened",c]),f.$crisp.push(["off","chat:closed",i]),f.$crisp.push(["off","message:received",a]),window.clearInterval(u)}},show:()=>{f.$crisp.push(["do","chat:show"]),f.$crisp.push(["do","chat:open"])},hide:()=>{f.$crisp.push(["do","chat:hide"]),f.$crisp.push(["do","chat:close"])}},[W.CUSTOM]:{configure:()=>()=>{},show:({block:t})=>{try{new Function(`"use strict";
|
|
3
|
+
`+t.chatCode)()}catch(n){console.error(`Userflow.js: Showing custom chat provider failed. Code: ${t.chatCode}`,n)}},hide:()=>{}},[W.FRESHCHAT]:{configure:({onShow:t,onHide:n})=>{if(!f.fcWidget)throw new Error("Freshchat is not installed");let r=!1,s=!1;const o=()=>{r||s?t():n()},c=()=>{r=!0,o()};f.fcWidget.on("widget:opened",c);const i=()=>{r=!1,o()};f.fcWidget.on("widget:closed",i);const a=()=>{const d=!!document.querySelector("#fc_frame.h-open-notify");d!==s&&(s=d,o())},p=window.setInterval(a,200);return f.fcWidget.on("unreadCount:notify",a),()=>{f.fcWidget.off("widget:opened",c),f.fcWidget.off("widget:closed",i),f.fcWidget.off("unreadCount:notify",a),window.clearInterval(p)}},show:()=>{f.fcWidget.open()},hide:()=>{f.fcWidget.close()}},[W.HELPSCOUT]:{configure:({onShow:t,onHide:n})=>{if(!f.Beacon)throw new Error("Help Scout is not installed");Kn();let r=!1,s=!1;const o=()=>{r||s?(At(),t()):(Fe(),n())},c=()=>{r=!0,o()};f.Beacon("on","open",c),f.Beacon("info")?.status.isOpened&&c();const i=()=>{r=!1,o()};f.Beacon("on","close",i);const a=()=>{const d=!!document.querySelector(".BeaconNotificationsFrame");d!==s&&(s=d,o())},p=window.setInterval(a,200);return()=>{f.Beacon("off","open",c),f.Beacon("off","close",i),window.clearInterval(p)}},show:()=>{At(),f.Beacon("open")},hide:()=>{Fe(),f.Beacon("close")}},[W.HUBSPOT]:{configure:({onShow:t,onHide:n})=>{const r=()=>{const c=document.getElementById("hubspot-messages-iframe-container");if(!f.HubSpotConversations||!c)return;window.clearInterval(o),Qn();let i=!1,a=!1;const p=()=>{i||a?(Pe(),t()):(Oe(),n())},d=()=>{const m=!!document.querySelector("#hubspot-messages-iframe-container .hs-shadow-container.active");m!==i&&(i=m,p())},u=new Be(d);u.observe(c,{attributes:!0,subtree:!0,attributeFilter:["class"]}),d();const E=({unreadCount:m})=>{const w=m>0;w!==a&&(a=w,p())};f.HubSpotConversations.on("unreadConversationCountChanged",E),s=()=>{u.disconnect(),f.HubSpotConversations.off("unreadConversationCountChanged",E)}};let s=()=>{window.clearInterval(o)};const o=window.setInterval(r,100);return r(),()=>{s()}},show:()=>{Pe(),f.HubSpotConversations.widget.open()},hide:()=>{Oe(),f.HubSpotConversations.widget.close()}},[W.INTERCOM]:{configure:({onShow:t,onHide:n})=>{if(!f.Intercom)throw new Error("Intercom is not installed");return Zn(),Ue.add(t),$e.add(n),()=>{Ue.delete(t),$e.delete(n)}},show:()=>{$t(),f.Intercom("show")},hide:()=>{He(),f.Intercom("hide")}},[W.ZENDESK]:{configure:({onShow:t,onHide:n})=>{if(!f.zE)throw new Error("Zendesk is not installed");Gn();let r=!1,s=!1;const o=()=>{r||s?(f.zE("webWidget","show"),t()):(f.zE("webWidget","hide"),n())},c=()=>{r=!0,s=!1,o()};We.add(c);const i=()=>{r=!1,s=!1,o()};ze.add(i);const a=p=>{const d=p>0;d!==s&&(s=d,o())};return Ve.add(a),()=>{We.delete(c),ze.delete(i),Ve.delete(a)}},show:()=>{f.zE("webWidget","show"),f.zE("webWidget","open")},hide:()=>{f.zE("webWidget","hide"),f.zE("webWidget","close")}},[W.ZENDESK_MESSENGER]:{configure:({onShow:t,onHide:n})=>{if(!f.zE)throw new Error("Zendesk is not installed");const r=()=>{t()},s=()=>{n()};return qe.add(r),Ke.add(s),Jn(),()=>{qe.delete(r),Ke.delete(s)}},show:()=>{f.zE("messenger","open")},hide:()=>{f.zE("messenger","close")}}};let St=!1;function qn(){St||(St=!0,f.$crisp||(f.$crisp=[]),f.$crisp.push(["do","chat:hide"]))}let It=!1;function Kn(){It||(It=!0,Fe())}function At(){f.Beacon("config",{display:{style:"icon"}})}function Fe(){f.Beacon("config",{display:{style:"manual"}})}let Tt=!1,Xe=!1;function Qn(){Tt||(Tt=!0,Xe?Pe():Oe())}function Pe(){Xe=!0,document.getElementById("hubspot-messages-iframe-container")?.style.setProperty("visibility","visible","important")}function Oe(){Xe=!1,document.getElementById("hubspot-messages-iframe-container")?.style.setProperty("visibility","hidden","important")}let Rt=!1,Ue=new Set,$e=new Set;function Zn(){if(Rt)return;Rt=!0,He();let t=!1,n=!1;const r=()=>{$t();for(const i of Ue)i()},s=()=>{He();for(const i of $e)i()},o=()=>{t||n?r():s()};f.Intercom("onShow",()=>{t=!0,o()}),f.Intercom("onHide",()=>{t=!1,o()});const c=()=>{const i=!!document.querySelector('iframe[name="intercom-borderless-frame"], iframe[name="intercom-notifications-frame"]');n!==i&&(n=i,o())};f.Intercom("onUnreadCountChange",()=>{c()}),window.setInterval(c,200)}function $t(){f.Intercom("update",{hide_default_launcher:!1,vertical_padding:20})}function He(){f.Intercom("update",{hide_default_launcher:!0,vertical_padding:100})}let _t=!1,We=new Set,ze=new Set,Ve=new Set;function Gn(){_t||(_t=!0,f.zE("webWidget","hide"),f.zE("webWidget","close"),f.zE("webWidget:on","open",()=>{for(const t of We)t()}),f.zE("webWidget:on","close",()=>{for(const t of ze)t()}),f.zE("webWidget:on","chat:unreadMessages",t=>{for(const n of Ve)n(t)}))}let Lt=!1,qe=new Set,Ke=new Set;function Jn(){Lt||(Lt=!0,f.zE("messenger:on","open",function(){for(const t of qe)t()}),f.zE("messenger:on","close",function(){for(const t of Ke)t()}))}const Xn=t=>l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100"},t),l.createElement("path",{fill:"currentColor",d:"M24.049 79.74h36.003c8.185 0 15.985-6.621 17.43-14.814l6.091-34.556h3.997c8.149 0 13.645 6.63 12.2 14.815l-7.051 40C91.274 93.363 83.474 100 75.288 100h-40c-8.185 0-13.645-6.667-12.2-14.815l.96-5.444Z"}),l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.437 69.63h40c8.148 0 15.978-6.637 17.422-14.815l7.052-40C78.355 6.63 72.896 0 64.711 0h-40C16.533 0 8.726 6.63 7.281 14.815l-7.052 40C-1.215 62.963 4.252 69.63 12.437 69.63Zm33.628-33.798c3.756-2.064 8.725-4.795 9.907-11.844C57.385 15.458 50.065 8.983 42.168 9c-7.452 0-12.771 3.195-17.508 8.892-.858 1.034-.884 2.45-.053 3.212l3.472 3.196c.847.767 2.25.589 3.176-.406 2.842-3.068 4.869-4.83 8.51-4.83 2.864 0 6.077 1.934 5.59 4.847-.37 2.223-2.292 3.334-5.4 5.001l-.28.151c-3.582 1.92-8.134 4.362-9.124 10.247l-.16.956c-.055.28-.05.571.014.85.065.278.188.538.362.76.173.222.391.4.639.522.247.121.518.183.79.18h6.744a2.709 2.709 0 0 0 1.712-.688c.481-.426.81-1.01.934-1.657l.095-.556c.266-1.582 2.101-2.59 4.384-3.845ZM32.837 59c3.552 0 6.955-3.034 7.58-6.769.63-3.729-1.742-6.763-5.293-6.763-3.552 0-6.934 3.028-7.58 6.763C26.9 55.966 29.286 59 32.837 59Z"})),O=({center:t,fadeIn:n})=>e.createElement("div",{className:D({"userflowjs-spinner":!0,"userflowjs-spinner--center":!!t,"userflowjs-spinner--fade-in":!!n})},e.createElement("svg",{viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},e.createElement("circle",{className:"userflowjs-spinner__bg",fill:"none",cx:12,cy:12,r:10,style:{strokeWidth:"4px"}}),e.createElement("circle",{className:"userflowjs-spinner__fill",fill:"none",cx:12,cy:12,r:10,transform:"translate(12, 12) rotate(-90) translate(-12, -12)",style:{strokeWidth:"4px",strokeDasharray:10*2*Math.PI*.25+"px, 1000"}})));function ke({message:t,skip:n}){const r=L(),[s,o]=l.useState(!0),[c,i]=l.useState(!1),[a,p]=l.useState(null),[d,u]=l.useState(null),[E,m]=l.useState(null),w=l.useRef(0),b=l.useRef(null),v=l.useRef(()=>{});return l.useEffect(()=>{if(n)return;const N=JSON.stringify(t);if(N===b.current)return;b.current=N;const y=++w.current;let j,C;const M=async()=>{o(!0);try{C=t;const U=await r.send(t,{handlesRejection:!0});if(y!==w.current)return;j=U,p(j),u(t),m(null)}catch(U){if(y!==w.current)return;m(U)}finally{o(!1)}};let V=!1;v.current=async(U,G)=>{if(!V){V=!0,i(!0);try{const $=U(j,C);C=$;const H=await r.send($,{handlesRejection:!0});if(y!==w.current)return;j=G(j,H),p(j),m(null)}catch($){if(y!==w.current)return;m($)}finally{V=!1,i(!1)}}},M()},[n,r,t]),{loading:s,loadingMore:c,data:a,messageForData:d,error:E,loadMore:v.current}}const Yn=200;function Ye(t,n){const[r,s]=l.useState(t),o=l.useRef(void 0),c=l.useCallback(a=>{window.clearTimeout(o.current),s(a),n(a)},[n]),i=l.useCallback(a=>{window.clearTimeout(o.current),s(a),o.current=window.setTimeout(()=>{n(a)},Yn)},[n]);return l.useEffect(()=>()=>{window.clearTimeout(o.current)},[]),[r,i,c]}const er={xs:[16,3],sm:[24,4],md32:[32,4],md:[40,4],lg:[56,4]};class tr extends e.PureComponent{constructor(){super(...arguments),this.memoizedBgStyle=jt(n=>({strokeWidth:`${n}px`})),this.memoizedFillStyle=jt((n,r,s)=>({strokeWidth:`${n}px`,strokeDasharray:r*2*Math.PI*new Ut(s).toNumber()+"px, 1000"}))}render(){const{props:n}=this,{size:r,indeterminate:s,className:o,center:c,right:i,color:a}=this.props,p=["progress-spinner"];r&&p.push(`progress-spinner--${r}`),s&&p.push("progress-spinner--indeterminate"),o&&p.push(o);const d=s?.25:n.progress||0,[u,E]=er[r||"md"],m=u/2,w=(u-E)/2;let b=e.createElement("div",{className:p.join(" ")},e.createElement("svg",{viewBox:`0 0 ${u} ${u}`,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},e.createElement("circle",{className:"progress-spinner__bg",fill:"none",cx:m,cy:m,r:w,style:this.memoizedBgStyle(E)}),e.createElement("circle",{className:a==="purple"?"progress-spinner__fill-purple":"progress-spinner__fill",fill:"none",cx:m,cy:m,r:w,transform:`translate(${m}, ${m}) rotate(-90) translate(-${m}, -${m})`,style:this.memoizedFillStyle(E,w,d)})));return c?b=e.createElement("div",{className:"progress-spinner-center-aligner"},b):i&&(b=e.createElement("div",{className:"progress-spinner-right-aligner"},b)),b}}const nr=({textareaRef:t,value:n,onChange:r,onBlur:s,onKeyDown:o,onMouseDown:c,placeholder:i,disabled:a,readOnly:p,className:d,mirrorClassName:u,textareaClassName:E,icon:m,onIconClick:w,loading:b=!1,children:v})=>{let N=n||i||"";(N===""||N.endsWith(`
|
|
4
|
+
`))&&(N+=" "),d=d||"growing-textarea",u=u||d+"__mirror";const[y,j]=l.useState(!1);return e.createElement("div",{className:D({[d]:!0,[`${d}__loading`]:b})},e.createElement("div",{className:u+" "+(E||"")},N),e.createElement("textarea",{ref:t,value:n,onChange:C=>r&&r(C.target.value),onBlur:s,onKeyDown:C=>{if(C.key==="Enter"&&y){C.preventDefault();return}o&&o(C)},onMouseDown:c,placeholder:i,disabled:a||b,readOnly:p,className:D({"growing-textarea__input":!0,[E||""]:!0,[`${d}__with-icon`]:!!m,[`${d}__loading-input`]:b}),onCompositionStart:()=>j(!0),onCompositionEnd:()=>j(!1)}),m&&!b&&e.createElement("div",{className:`${d}__icon`},e.createElement("button",{className:"btn btn--plain-blue btn--square btn--md32",onClick:w},e.createElement(A,{icon:m}))),b&&e.createElement("div",{className:`${d}__loader`},e.createElement(tr,{indeterminate:!0,size:"xs",color:"purple"})),v)},rr=({textareaRef:t,value:n,onChange:r,onSubmit:s,placeholder:o,readOnly:c})=>{const i=()=>{s&&s()};return e.createElement("div",{className:"userflowjs-assistant-chat-input"},e.createElement(nr,{textareaRef:t,className:"userflowjs-growing-textarea",mirrorClassName:"userflowjs-growing-textarea__mirror",textareaClassName:"userflowjs-textarea userflowjs-assistant-chat-input__textarea",placeholder:o,readOnly:c,value:n||"",onChange:r,onKeyDown:a=>{!a.shiftKey&&a.key==="Enter"&&(a.preventDefault(),i())}}),e.createElement("button",{"data-testid":"assistant-chat-input-submit",className:"userflowjs-assistant-chat-input__submit",onClick:()=>i()},e.createElement(A,{icon:Mn})))};function sr(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Ht(t){return xe.linkUrlDecorator?xe.linkUrlDecorator(t):t}const xt=5,or=async()=>(await jn(async()=>{const{ResourceCenterAssistantChat:t}=await import("./ResourceCenterAssistantChat.js");return{ResourceCenterAssistantChat:t}},__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,31,32]))).ResourceCenterAssistantChat,Mt=({session:t,isOpen:n,flowSession:r,checklistSession:s,resourceCenterLauncherHidden:o})=>{const c=L(),{t:i}=te(),{company:a}=t.flow,{version:p}=t,d=p.resourceCenter,u=Ce(p.theme),E=d.launcherType??ve.DEFAULT,m=l.useMemo(()=>E===ve.CUSTOM?!1:o===!1?!0:o===!0?!1:E===ve.DEFAULT,[E,o]),w=t.locale?t.locale.standardLocaleId:t.version.theme.languageId;l.useEffect(()=>{ge.changeLanguage(w)},[w]);const{loaded:b}=Ct(window,vt,u),[v,N]=l.useState(!1),y=b&&v,[j,C]=l.useState(kt()),[M,V]=l.useState(Nt()),U=l.useCallback(()=>{C(kt()),V(Nt())},[]);Rn(U);const{zIndex:G,bringToFront:$}=yn(),[H,q]=l.useState(null),[K,ae]=l.useState(null),[ne,le]=l.useState(null),je=l.useRef(null),[re,tn]=l.useState(null),[tt,nn]=l.useState(null),[nt,rn]=l.useState(null),[sn,on]=l.useState(0),[cn,an]=l.useState(0),ye=l.useCallback(()=>{K&&on(Math.round(K?.offsetWidth||0)),an(Math.round((ne?.offsetHeight||0)+(re?.offsetHeight||0)+(tt?.offsetHeight||0)+(nt?.offsetHeight||0)))},[K,ne,re,tt,nt]);l.useLayoutEffect(()=>{if(!H||typeof Be!="function")return;const h=new Be(()=>{ye()});return h.observe(H,{childList:!0,attributes:!0,subtree:!0}),()=>{h.disconnect()}},[H,ye]),l.useLayoutEffect(()=>{ye()});const[rt,st]=l.useState(!1),Se=l.useRef(),ie=l.useCallback(()=>{st(!0),window.clearTimeout(Se.current),Se.current=window.setTimeout(()=>{st(!1)},u.resourceCenterTransitionDuration)},[u.resourceCenterTransitionDuration]);l.useEffect(()=>()=>{window.clearTimeout(Se.current)},[]);const ue=l.useCallback(()=>{$(),ie(),c.openResourceCenter()},[$,c,ie]),Ie=l.useCallback(()=>{ie(),c.closeResourceCenter()},[c,ie]),[ot,J]=l.useState(!1);l.useEffect(()=>{if(ot){if(!sr())if(n){const h='button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), input, textarea';let k=re?.querySelector(".userflowjs-assistant-chat-input textarea")||re?.querySelector(h)||ne?.querySelector(h);if(k){const T=k.closest&&k.closest(".userflowjs-resource-center-checklist")||null;T?Ln(T):k.focus({preventScroll:!0})}}else K?.focus({preventScroll:!0});J(!1)}},[ot,n,re,ne,K]),l.useEffect(()=>{const h=H?.ownerDocument.defaultView;if(!n||!h)return;const k=T=>{T.key==="Escape"&&(Ie(),J(!0))};return h.addEventListener("keydown",k),()=>h.removeEventListener("keydown",k)},[n,H,J,Ie]);const[g,de]=l.useState(()=>Bt(t,se.getItem(`resourceCenterRoute:v1:${t.id}`))),F=l.useCallback((h,k)=>{de(h);const T=Qt(h);T?se.setItem(`resourceCenterRoute:v1:${t.id}`,T):se.removeItem(`resourceCenterRoute:v1:${t.id}`),k?.detail===0&&J(!0)},[t.id]);l.useEffect(()=>{const h=se.getItem(`resourceCenterRoute:v1:${t.id}`);de(Bt(t,h))},[t]),l.useEffect(()=>{if(!t.draftMode||!g||!("block"in g)||!g.block)return;const h=d.blocks.find(k=>k.cvid===g.block.cvid);h?JSON.stringify(h)!==JSON.stringify(g.block)&&de({...g,block:h}):de(null),g.block},[t.draftMode,d,g]);const me=l.useMemo(()=>d.blocks.filter(h=>!(h.type===S.CHECKLIST&&!s||h.type===S.DIVIDER&&u.resourceCenterAutoDividers||h.hiddenWhenFlowsActive&&h.hiddenWhenFlowsActive.some(k=>k===r?.flow.id||k===s?.flow.id))),[d,r,s,u.resourceCenterAutoDividers]),Ae=l.useMemo(()=>Kt(me),[me]),Te=l.useMemo(()=>!s||!d.blocks.some(h=>h.type===S.CHECKLIST)?0:bn(s),[d,s]),B=l.useMemo(()=>d.blocks.find(h=>h.type===S.CONTACT&&h.chatEnabled&&h.chatProvider),[d]),[ln,ct]=l.useState(!1),fe=l.useCallback(()=>{c.closeResourceCenter(),B&&B.chatProvider!==W.CUSTOM&&ct(!0)},[c,B]),he=l.useCallback(()=>{ct(!1)},[]),at=l.useCallback(()=>{if(B)try{De[B.chatProvider].hide({block:B}),he()}catch(h){console.error(`Userflow.js: Error when hiding ${B.chatProvider}:`,h)}},[B,he]);l.useEffect(()=>{if(!B)return;xe.autoHide3pDisabled=!0;const h=De[B.chatProvider];try{const k=h.configure({block:B,onShow:fe,onHide:he});return()=>{k()}}catch(k){console.error(`Userflow.js: Error when configuring ${B.chatProvider}:`,k);return}},[B,fe,he]),l.useEffect(()=>{n&&at()},[at,n]);const I=en(t),we=l.useMemo(()=>{if(!I)return null;if(I.boosterAnnouncement){const h=I.boosterAnnouncement;if(!h.seen&&(h.level===x.TOAST||h.level===x.MODAL))return h}return I.popoutAnnouncement&&!I.popoutAnnouncement.seen?I.popoutAnnouncement:null},[I]),lt=Ce(we?.theme||p.theme);Ct(window,vt,m?void 0:lt);const Ee=l.useCallback((h,k,T,X,be)=>{const ft=()=>{et(c,h)};return e.createElement(oe.Provider,{value:{...T,data:h.data}},h.level===x.MODAL&&e.createElement(qt,{session:T,open:ue,navigate:F,block:k,announcement:h,onDismiss:ft}),(h.level===x.TOAST||h.level===x.POPOUT)&&e.createElement(Vt,{session:T,open:ue,navigate:F,block:k,announcement:h,onDismiss:ft,isStandalonePopout:be?.isStandalonePopout,rcPlacement:X.resourceCenterPlacement}))},[c,ue,F]),un=(h,k,T)=>{const X={...Me(T),zIndex:gt(In),position:"fixed",top:0,left:0,width:"100vw",height:"100vh",pointerEvents:h.level===x.MODAL?"auto":"none"},be={...t,data:{...t.data,...h.data||{}}};return e.createElement(oe.Provider,{value:be},e.createElement("div",{className:"userflowjs-theme-root",style:X,id:"userflowjs-announcement-app"},Ee(h,k,be,T,{isStandalonePopout:h.level===x.POPOUT})))},dn=!!g&&(g.kind==="search"||g.kind==="flows"||g.kind==="knowledgeBase"),it=g?.kind==="assistant"||g?.kind==="announcementList"||g?.kind==="announcementShow",Re=Math.min(it?u.resourceCenterFullWidth:u.resourceCenterWidth,j-2*u.resourceCenterPaddingX),mn=540,fn=720,hn={zIndex:u.resourceCenterZIndex!=null?u.resourceCenterZIndex:n?G:gt(Sn),position:y?void 0:"absolute",visibility:y&&!ln?void 0:"hidden"},wn={width:(n?Re:sn)+"px",height:n?Math.min(dn?mn:it?fn:cn,M-2*u.resourceCenterPaddingY,u.resourceCenterMaxHeight==null?Number.MAX_VALUE:u.resourceCenterMaxHeight)+"px":void 0,display:!m&&!n?"none":void 0},[En,ut]=l.useState(!1),dt=()=>{ue(),J(!0)},mt=u.resourceCenterDisplayChecklistProgress&&s&&Te>0?e.createElement("div",{"data-testid":"resource-center-launcher-badge",className:"userflowjs-resource-center-launcher-badge"},Te,e.createElement("div",{className:"userflowjs-a11y-only"},"uncompleted tasks")):null;let pe="",_e="";u.resourceCenterLauncherTextMode===ht.CHECKLIST_OVERRIDE&&s&&Te>0?pe=s.version.checklist?.launcherText||"Get Started":u.resourceCenterLauncherTextMode!==ht.NONE&&(_e=d.buttonText);const Le=we?.level,pn=Le===x.MODAL||Le===x.TOAST||Le===x.POPOUT&&(E!==ve.CUSTOM||o===!0);return!m&&!n&&we&&I&&pn?un(we,I,lt):e.createElement(oe.Provider,{value:t},e.createElement("div",{"data-testid":"resource-center-app",className:"userflowjs-resource-center-app userflowjs-theme-root",style:Me(u),dir:ge.dir()},e.createElement("div",{className:D({"userflowjs-resource-center":!0,"userflowjs-resource-center--fixed":!0,[`userflowjs-resource-center--placement-${u.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0}),style:hn},e.createElement("div",{className:"userflowjs-resource-center-frame-wrapper",onMouseEnter:()=>ut(!0),onMouseLeave:()=>ut(!1)},e.createElement(Ge,{className:D({"userflowjs-resource-center-frame":!0,"userflowjs-resource-center-frame--animating":rt,"userflowjs-resource-center-frame--open":n,"userflowjs-resource-center-frame--closed":!n}),style:wn,stylesheet:Qe,theme:u,onStylesheetsLoad:N,title:"Resource center"},y&&e.createElement(e.Fragment,null,e.createElement("div",{ref:q,className:D({"userflowjs-resource-center-frame-root":!0,[`userflowjs-resource-center-frame-root--placement-${u.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0,"userflowjs-resource-center-frame-root--animating":rt,"userflowjs-resource-center-frame-root--open":n,"userflowjs-resource-center-frame-root--closed":!n}),role:n?"dialog":void 0,"aria-label":n?d.headerText:void 0},m&&e.createElement("div",{className:"userflowjs-resource-center-launcher-container"},e.createElement("button",{ref:ae,className:D({"userflowjs-resource-center-launcher-button":!0,"userflowjs-resource-center-launcher-button--hover":En}),onClick:dt,"aria-label":`Open ${d.headerText}`},mt,pe&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},pe),(mt||pe)&&e.createElement("div",{className:"userflowjs-resource-center-launcher-divider"}),_e&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},_e),e.createElement("div",{className:"userflowjs-resource-center-launcher-icon"},u.resourceCenterLauncherIconType===wt.PLAINTEXT?"?":u.resourceCenterLauncherIconType===wt.DEFAULT?e.createElement(Xn,null):u.rcIconAsset&&u.rcIconAsset.assetUrl?e.createElement("img",{src:u.rcIconAsset.assetUrl,className:"company-icon",style:{height:`${u.rcIconSize}px`,width:`${u.rcIconSize}px`}}):e.createElement("span",null)))),e.createElement("div",{ref:je,className:"userflowjs-resource-center-body",style:{width:Re+"px"}},e.createElement("div",{ref:tn,className:D({"userflowjs-resource-center-body-content":!0,"userflowjs-resource-center-body-content--padding":g?.kind!=="assistant","userflowjs-resource-center-body-content--same-background":u.sameBackground,"userflowjs-resource-center-body-content--with-made-with-userflow":a.resourceCenterBranding})},n&&e.createElement(e.Fragment,null,g?g.kind==="search"?e.createElement(cr,{session:t,navigate:F}):g.kind==="email"?e.createElement(ar,{block:g.block,session:t}):g.kind==="phone"?e.createElement(lr,{block:g.block,session:t}):g.kind==="flows"?e.createElement(ir,{block:g.block,initialQ:g.initialQ,session:t,navigate:F}):g.kind==="knowledgeBase"?e.createElement(ur,{block:g.block,initialQ:g.initialQ,session:t,bodyRef:je}):g.kind==="subpage"?e.createElement(dr,{block:g.block,session:t}):g.kind==="announcementList"||g.kind==="announcementShow"?e.createElement(mr,{bodyRef:je,session:t,route:g,navigate:F}):g.kind==="assistant"?e.createElement(wr,{block:g.block,initialUserContent:g.initialUserContent,session:t,navigate:F,chatBlock:B,onChatShow:fe}):null:e.createElement(e.Fragment,null,me.map((h,k)=>{const T=ce[h.type],X=me[k+1];return T?e.createElement(e.Fragment,{key:h.id},e.createElement(T.View,{session:t,flowSession:r,checklistSession:s,block:h,navigate:F,onChatShow:fe}),X&&Vn(u,h.type,X.type)&&e.createElement("div",{className:"userflowjs-resource-center-divider"})):null}))))),a.resourceCenterBranding&&e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow"},e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow-content",ref:nn},e.createElement("a",{href:"https://userflow.com/?utm_source=made-with-userflow&utm_medium=link&utm_campaign=made-with-userflow-"+a.slug+"&utm_content=resource-center",target:"_blank",rel:"noopener noreferrer"},e.createElement(_n,null),e.createElement("div",null,"Made with Userflow")))),t.draftMode&&e.createElement("div",{className:"userflowjs-resource-center-preview"},e.createElement("div",{ref:rn,className:"userflowjs-resource-center-preview-content"},e.createElement("div",{className:"userflowjs-resource-center-preview-text"},"Preview"),e.createElement("button",{className:"userflowjs-resource-center-preview-button",onClick:()=>{c.endFlow(t,{endReason:vn.USER_CLOSED})}},e.createElement(A,{icon:Je})))),e.createElement("div",{className:"userflowjs-resource-center-header",style:{width:Re+"px"}},e.createElement("div",{ref:le,className:"userflowjs-resource-center-header-content"},g==null?e.createElement("div",{className:"userflowjs-resource-center-header-text"},d.headerText):e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:h=>F(g?.kind==="announcementShow"?{kind:"announcementList",block:g.block}:null,h)},e.createElement("div",{className:"userflowjs-rtl-mirrored"},e.createElement(A,{icon:Bn})),e.createElement("div",{className:"userflowjs-resource-center-icon-button__text"},i("resource_center.back"))),e.createElement("div",{className:"flex-1"}),Ae.length>0&&e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:()=>{let h={kind:"search"};if(Ae.length===1){const k=Ae[0],T=ce[k.type];T.routeTo&&(h=T.routeTo({block:k}))}g?.kind==="search"?F(null):(R(c,t,null,"Search icon"),F(h))},"aria-label":"Search"},e.createElement(A,{icon:Dn})),e.createElement("button",{className:"userflowjs-resource-center-icon-button userflowjs-resource-center-close-button",onClick:h=>{Ie(),h.detail===0&&J(!0)},"aria-label":`Close ${d.headerText}`},e.createElement(A,{icon:Fn}))))))),!n&&!r&&m&&I&&I.unreadAnnouncementCount>0&&e.createElement(Wt,{theme:u,count:I.unreadAnnouncementCount,onClick:dt})),!n&&!r&&m&&I?.popoutAnnouncement&&Ee(I.popoutAnnouncement,I,t,u),!n&&!r&&m&&I?.boosterAnnouncement&&I.boosterAnnouncement.level===x.MODAL&&Ee(I.boosterAnnouncement,I,t,u),!n&&!r&&m&&I?.boosterAnnouncement&&I.boosterAnnouncement.level===x.TOAST&&Ee(I.boosterAnnouncement,I,t,u))))},Wt=({theme:t,count:n,onClick:r,style:s})=>{const[o,c]=l.useState(!1);return e.createElement(Ge,{className:D({"userflowjs-resource-center-launcher-unread-badge":!0}),noScroll:!0,style:{position:o?void 0:"absolute",visibility:o?void 0:"hidden",...s},stylesheet:Qe,theme:t,onStylesheetsLoad:c,title:"Resource center unread badge"},e.createElement(zt,{count:n,onClick:r}))},zt=({count:t,onClick:n})=>{let r=null;return t>9&&(t=9,r=e.createElement("span",{className:"userflowjs-unread-badge-plus"},"+")),e.createElement("div",{className:D({"userflowjs-unread-badge":!0,"userflowjs-unread-badge--clickable":!!n}),onClick:n},e.createElement("span",null,t),r)},Vt=({session:t,open:n,navigate:r,announcement:s,block:o,rcPlacement:c,onDismiss:i,isStandalonePopout:a})=>{const p=l.useRef(null),d=Ce(s.theme),u=d.toastPlacement,E=!!o.boosterAnnouncement||a!==void 0&&s?.level===x.TOAST,m=u===c;let w=null,b=null;s&&(w=s.toastAutoDismiss??d.toastAutoDismiss,b=s.toastWidth?s.toastWidth:d.toastWidth);const v=L(),[N,y]=l.useState(!1),{height:j,setEl:C}=zn();l.useEffect(()=>{const q=p.current;if(!q||w===null)return;const K=Date.now(),ae=()=>{const le=1-(Date.now()-K)/(new Ut(w||0).toNumber()*1e3);le<=0?(q.style.width="0%",s&&P(v,s)):(q.style.width=`${le*100}%`,requestAnimationFrame(ae))};return requestAnimationFrame(ae),()=>{q&&(q.style.width="0%")}},[p.current,w,v,s,P]);const M=i||(()=>{s&&P(v,s)}),V=20,U=l.useMemo(()=>CSS.supports("height: 100dvh")?"dvh":"vh",[]),G=()=>{E&&s&&(P(v,s),R(v,t,o,s.title),r({kind:"announcementShow",block:o,announcementId:s.id}),n())};if(!s)return null;const $=!!a&&!!c,H=(a!==void 0||!m)&&!!u&&E;return e.createElement("div",{className:D({"userflowjs-resource-center-popout":!E,"userflowjs-resource-center-toast":E,[`userflowjs-resource-center-popout-standalone--${c?.toLowerCase()?.replace(/_/g,"-")}`]:$,[`userflowjs-resource-center-toast--${u?.toLowerCase()?.replace(/_/g,"-")}`]:H}),style:Me(d)},e.createElement(Ge,{className:D({"userflowjs-resource-center-popout-frame":!0}),style:{height:`calc(min(${j}px, 100${U} - 2 * var(--userflow-resource-center-padding-y) - var(--userflow-resource-center-collapsed-height) - ${V}px)`,position:N?void 0:"absolute",visibility:N?void 0:"hidden",...b&&E?{width:b}:{}},stylesheet:Qe,theme:d,onStylesheetsLoad:y,title:"Resource center popout"},E&&e.createElement("div",{className:"userflowjs-bubble-progress--default"},e.createElement("div",{className:"userflowjs-bubble-progress__fill",ref:p})),e.createElement("div",{ref:C,className:"userflowjs-resource-center-popout-frame-root",style:{cursor:E?"pointer":"auto",padding:E&&d.toastPadding||void 0}},e.createElement("div",{onClick:G},e.createElement("h2",{className:"userflowjs-announcement-title"},e.createElement("span",{className:"userflowjs-unread-dot"}),e.createElement("span",null,s.title)),e.createElement("div",{className:"userflowjs-announcement-time"},e.createElement("div",{className:"userflowjs-announcement-time-text"},Ne(s.time))),e.createElement("div",{className:"userflowjs-announcement-content userflowjs-bubble-content"},e.createElement(z,{doc:s.content,buttons:s.buttons,lookupAttribute:_(s.data)})),!E&&e.createElement(e.Fragment,null,s.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:()=>{P(v,s),R(v,t,o,s.title),r({kind:"announcementShow",block:o,announcementId:s.id}),n()}},e.createElement("div",null,(s.moreEnabled?s.moreButtonText:null)||"Read more"),!E&&e.createElement("span",{className:"userflowjs-rtl-mirrored"},e.createElement(A,{icon:Ot})))))),E&&s.moreEnabled&&e.createElement("div",{onClick:G,className:"userflowjs-announcement-more--toast"},(s.moreEnabled?s.moreButtonText:null)||"Read more"),e.createElement("div",{className:"userflowjs-bubble-toolbar"},e.createElement("button",{className:"userflowjs-bubble-toolbar-button",onClick:M,"aria-label":"Dismiss announcement"},e.createElement(A,{icon:Je}))))),!E&&!a&&e.createElement("div",{className:"userflowjs-resource-center-popout-notch"}))},qt=({session:t,open:n,navigate:r,announcement:s,block:o,onDismiss:c})=>{const i=L(),a=Ce(s.theme),d=c||(()=>{P(i,s)});return e.createElement(Hn,{company:t.flow.company,theme:a,position:"fixed",width:s.modalWidth,stepAppearance:gn.MODAL,zIndex:a.checklistZIndex,autoHide3pEnabled:!0,onModalBackdropClick:d,noIframe:!0,isModalAnnouncement:!0},e.createElement("div",{id:"userflowjs-bubble-content",className:"userflowjs-bubble-content"},e.createElement("h1",null,s.title),e.createElement(z,{doc:s.content,buttons:s.buttons,lookupAttribute:_(s.data)})),e.createElement("div",{className:"userflowjs-bubble-toolbar"},e.createElement("button",{className:"userflowjs-bubble-toolbar-button",onClick:d,"aria-label":"Dismiss announcement"},e.createElement(A,{icon:Je}))),s.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more--modal"},e.createElement("button",{className:"userflowjs-bubble-button--primary",onClick:()=>{P(i,s),R(i,t,o,s.title),r({kind:"announcementShow",block:o,announcementId:s.id}),n()}},e.createElement("div",null,(s.moreEnabled?s.moreButtonText:null)||"Read more"))))};function Kt(t){return t.filter(n=>{const r=ce[n.type];return r.isSearchable?r.isSearchable(n):!!r.search})}const ce={[S.ACTION]:{View:t=>{const{block:n,session:r,flowSession:s,checklistSession:o}=t,c=L(),[i,a]=l.useState(!1),p=s?.id,d=o?.id;return l.useEffect(()=>{a(!1)},[p,d]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:i?void 0:()=>{R(c,r,n);const u=n.actions.find(E=>E.type===Cn.START_FLOW);u?u.otherFlow?.id!==o?.flow.id&&a(!0):c.closeResourceCenter(),An(c,r,n.actions)},disabled:i},e.createElement(Y,{...t}),e.createElement(Q,{...t}),i&&e.createElement(O,null))}},[S.ANNOUNCEMENTS]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=L();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"announcementList",block:n},c)}},n.unreadAnnouncementCount>0?e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(zt,{count:n.unreadAnnouncementCount})):e.createElement(Y,{...t}),e.createElement(Q,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:ee})))}},[S.ASSISTANT]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=L(),[c,i]=l.useState("");return n.assistantAppearance===kn.INPUT?e.createElement("div",{className:"userflowjs-resource-center-assistant-block"},e.createElement(rr,{value:c,onChange:i,placeholder:Ze(n.name,{lookupAttribute:_(r.data)}),onSubmit:()=>{R(o,r,n),s({kind:"assistant",block:n,initialUserContent:c})}})):e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{R(o,r,n),s({kind:"assistant",block:n,initialUserContent:""})}},e.createElement(Y,{...t}),e.createElement(Q,{...t}))}},[S.CHECKLIST]:{View:({checklistSession:t})=>e.createElement("div",{"data-testid":"resource-center-checklist",className:"userflowjs-resource-center-checklist"},e.createElement(xn,{session:t}),e.createElement(Wn,{draftMode:t.draftMode?"CHECKLIST PREVIEW":!1}))},[S.CONTACT]:{View:t=>{const{block:n,session:r,navigate:s,onChatShow:o}=t,c=L(),i=[];return n.emailEnabled&&i.push({icon:On,label:"Email",isRoute:!0,onClick:a=>{R(c,r,n,"Email"),s({kind:"email",block:n},a)}}),n.phoneEnabled&&i.push({icon:Un,label:"Phone",isRoute:!0,onClick:a=>{R(c,r,n,"Phone"),s({kind:"phone",block:n},a)}}),n.chatEnabled&&i.push({icon:$n,label:"Live-chat",isRoute:!1,onClick:()=>{R(c,r,n,"Chat"),Yt(r,n,o)}}),e.createElement("div",{className:D({"userflowjs-resource-center-block":!0,"userflowjs-resource-center-block--clickable":i.length===1}),onClick:i.length===1?i[0].onClick:void 0},i.length===1&&e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(A,{icon:i[0].icon})),e.createElement(Q,{...t}),i.length>1&&i.map(({icon:a,label:p,onClick:d},u)=>e.createElement("button",{key:u,className:"userflowjs-resource-center-icon-button",onClick:d,"aria-label":p},e.createElement(A,{icon:a}))),i.length===1&&i[0].isRoute&&e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:ee})))}},[S.DIVIDER]:{View:()=>e.createElement("div",{className:"userflowjs-resource-center-divider"})},[S.FLOWS]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=L();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"flows",block:n},c)}},e.createElement(Y,{...t}),e.createElement(Q,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:ee})))},routeTo:({block:t,initialQ:n})=>({kind:"flows",block:t,initialQ:n}),isSearchable:t=>!!t.searchEnabled,search:async({client:t,session:n,block:r,q:s})=>{const{flows:o}=await t.send({kind:"ListResourceCenterBlockFlows",sessionId:n.id,blockCvid:r.cvid},{handlesRejection:!0}),c=Zt(o,s),i=c.slice(0,xt);return{block:r,truncated:i.length===c.length,results:i.map(a=>({kind:"flow",flow:a}))}}},[S.KNOWLEDGE_BASE]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=L();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"knowledgeBase",block:n},c)}},e.createElement(Y,{...t}),e.createElement(Q,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:ee})))},routeTo:({block:t,initialQ:n})=>({kind:"knowledgeBase",block:t,initialQ:n}),search:async({client:t,session:n,block:r,q:s})=>{const{truncated:o,articles:c}=await t.send({kind:"SearchKnowledgeBase",sessionId:n.id,blockCvid:r.cvid,q:s,offset:0,limit:xt},{handlesRejection:!0});return{block:r,truncated:o,results:c.map(i=>({kind:"article",article:i}))}}},[S.MESSAGE]:{View:({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-block"},e.createElement("div",{className:"userflowjs-resource-center-block-text userflowjs-bubble-content"},e.createElement(z,{doc:t.content,lookupAttribute:_(n.data)})))},[S.SUBPAGE]:{View:t=>{const{block:n,session:r,navigate:s}=t,o=L();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:c=>{R(o,r,n),s({kind:"subpage",block:n},c)}},e.createElement(Y,{...t}),e.createElement(Q,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:ee})))}}},Y=({block:t})=>t.icon?e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(A,{icon:t.icon,size:16})):null,Q=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement(Z,{doc:t.name,lookupAttribute:_(n.data)}));function Qt(t){if(!t)return null;let n;"block"in t&&t.block!=null&&(n=t.block.cvid);const r={kind:t.kind,blockCvid:n};switch(t.kind){case"announcementShow":r.announcementId=t.announcementId;break}return JSON.stringify(r)}function Bt(t,n){if(!n)return null;const r=JSON.parse(n);let s;if(r.blockCvid&&(s=t.version.resourceCenter?.blocks.find(c=>c.cvid===r.blockCvid)),!s&&r.kind!=="search")return null;const o={kind:r.kind,block:s};switch(o.kind){case"announcementShow":o.announcementId=r.announcementId;break}return o}const cr=({session:t,navigate:n})=>{const r=L(),s=t.version.resourceCenter.blocks,o=Kt(s),{t:c}=te(),i=l.useRef(null),[a,p]=l.useState(""),[d,u]=Ye(a,p),[E,m]=l.useState(null);return l.useEffect(()=>{if(a.trim()===""){m(null);return}let w=!1;return(async()=>{m(null);const v=await Promise.all(s.map(async N=>{const{search:y}=ce[N.type];if(!y)return null;try{return await y({client:r,session:t,block:N,q:a})}catch(j){return console.error(`Userflow.js: Global search failed for ${N.type} block=`,N,"error=",j),null}}));w||m(v.filter(N=>N!=null&&N.results.length>0))})(),()=>{w=!0}},[r,t,s,a]),l.useEffect(()=>{i.current?.focus({preventScroll:!0})},[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:i,className:"userflowjs-text-input",type:"text",value:d,onChange:w=>u(w.target.value),placeholder:c("resource_center.search_placeholder")})),a.trim()===""?e.createElement("div",{"data-testid":"resource-center-empty-query",className:"userflowjs-resource-center-list-route-error"},c("resource_center.search_in")," ",o.map((w,b)=>e.createElement(e.Fragment,{key:w.cvid},b>0&&(b===o.length-1?` ${c("and")} `:", "),e.createElement("b",null,e.createElement(Z,{doc:w.name,lookupAttribute:_(t.data)})))),"."):E?E.length===0?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},c("resource_center.no_results_found")):E.map(({block:w,truncated:b,results:v},N)=>{const y=ce[w.type],j=y.routeTo&&y.routeTo({block:w,initialQ:a});return e.createElement(e.Fragment,{key:w.cvid},N>0&&e.createElement("div",{className:"userflowjs-resource-center-divider"}),e.createElement("div",{className:"userflowjs-resource-center-label"},e.createElement(Z,{doc:w.name,lookupAttribute:_(t.data)})),v.map((C,M)=>C.kind==="flow"?e.createElement(Gt,{key:C.flow.id,block:w,session:t,flow:C.flow,navigate:n}):C.kind==="article"?e.createElement(Jt,{key:M,block:w,session:t,article:C.article}):null),!b&&j&&e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:C=>{R(r,t,w),n(j,C)}},e.createElement("div",{className:"userflowjs-resource-center-block-text"},c("more"),":"," ",e.createElement(Z,{doc:w.name,lookupAttribute:_(t.data)})),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(A,{icon:ee}))))}):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(O,null)))},ar=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(z,{doc:t.emailContent,lookupAttribute:_(n.data)})),lr=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(z,{doc:t.phoneContent,lookupAttribute:_(n.data)})),ir=({block:t,initialQ:n,session:r,navigate:s})=>{const{t:o}=te(),c=l.useRef(null),[i,a]=l.useState(n||""),[p,d]=Ye(i,a),{data:u,error:E}=ke({message:{kind:"ListResourceCenterBlockFlows",sessionId:r.id,blockCvid:t.cvid}}),m=u?.flows,w=l.useMemo(()=>m?Zt(m,i):null,[m,i]);return l.useEffect(()=>{c.current?.focus({preventScroll:!0})},[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(Z,{doc:t.name,lookupAttribute:_(r.data)}))),t.searchEnabled&&e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:p,onChange:b=>d(b.target.value),placeholder:o("resource_center.search_placeholder")})),E?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o("resource_center.generic_error")):w?w.length===0?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o("resource_center.no_results_found")):w.map(b=>e.createElement(Gt,{key:b.id,block:t,session:r,flow:b,navigate:s})):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(O,{fadeIn:!0})))};function Zt(t,n){const r=n.toLowerCase().trim();return r===""?t:t.filter(s=>s.name.toLowerCase().includes(r))}const Gt=({block:t,session:n,flow:r,navigate:s})=>{const o=L(),[c,i]=l.useState(!1);return l.useEffect(()=>{if(!c||r.type!==Et.CHECKLIST)return;const a=()=>{o.checklistSession?.flow.id===r.id&&(p(),s(null))},p=()=>{o.off("checklistChanged",a)};return o.on("checklistChanged",a),p},[o,c,r.type,r.id,s]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{if(R(o,n,t,r.name),o.checklistSession?.flow.id===r.id){s(null);return}o.startFlow({flowId:r.id,startReason:n.draftMode?pt.DRAFT:pt.RESOURCE_CENTER,replaceCurrent:!0}),i(!0);const a=Ze(r.url,{lookupAttribute:_(n.data)});a&&Tn(a)},disabled:c},r.iconSetting!==Nn.HIDE&&e.createElement("div",{className:"userflowjs-resource-center-block-icon"},r.icon?e.createElement(A,{icon:r.icon,size:16}):e.createElement(A,{icon:r.type===Et.CHECKLIST?"regular/tasks":"regular/shoe-prints",size:16})),n.draftMode&&!r.published&&e.createElement("div",{className:"userflowjs-resource-center-code-block"},e.createElement("div",{title:"Unpublished. Preview only"},e.createElement("code",null,"P"))),e.createElement("div",{className:"userflowjs-resource-center-block-text"},r.name),c&&e.createElement(O,null))},ur=({block:t,initialQ:n,session:r,bodyRef:s})=>{const{t:o}=te(),c=l.useRef(null),[i,a]=l.useState(n||""),[p,d]=Ye(i,a),{loading:u,loadingMore:E,data:m,messageForData:w,error:b,loadMore:v}=ke({message:{kind:"SearchKnowledgeBase",sessionId:r.id,blockCvid:t.cvid,q:i,offset:0}}),N=m?.truncated,y=l.useCallback(()=>{v((C,M)=>({...M,offset:C.articles.length}),(C,M)=>({...M,articles:[...C.articles,...M.articles]}))},[v]);Xt({bodyRef:s,loading:u,loadingMore:E,truncated:N,loadMoreHelper:y}),l.useEffect(()=>{c.current?.focus({preventScroll:!0})},[]);let j=t.knowledgeBaseUrl||"";return j.match(/^https?:\/\//)||(j=`http://${j}`),j=Ht(j),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(Z,{doc:t.name,lookupAttribute:_(r.data)})),e.createElement("a",{className:"userflowjs-resource-center-icon-button",href:j,target:"_blank",rel:"noopener noreferrer"},e.createElement(A,{icon:Pn}))),e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:p,onChange:C=>d(C.target.value),placeholder:o("resource_center.search_placeholder")})),b?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},b.code==="quota_exceeded"?"Sorry, this company has reached its max number of searches. Consider asking Userflow to be moved to a dedicated search engine for a higher quota.":b.humanMessage||o("resource_center.generic_error")):u||!m?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(O,null)):m.articles.length===0?w?.q===""?null:e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o("resource_center.no_results_found")):e.createElement(e.Fragment,null,w?.q===""&&e.createElement("div",{className:"userflowjs-resource-center-label"},o("resource_center.suggested_articles")),m.articles.map((C,M)=>e.createElement(Jt,{key:M,block:t,session:r,article:C})),E&&e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(O,null))))},Jt=({block:t,article:n,session:r})=>{const s=L();return e.createElement("a",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{R(s,r,t,n.title)},href:Ht(n.url),target:"_blank",rel:"noopener noreferrer"},e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(A,{icon:"regular/file-alt",size:16})),e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement("span",{dangerouslySetInnerHTML:{__html:n.htmlTitle}}),e.createElement("div",{className:"userflowjs-resource-center-block-subtext",dangerouslySetInnerHTML:{__html:n.htmlSnippet}})))},dr=({block:t,session:n})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(z,{doc:t.content,lookupAttribute:_(n.data)})),mr=({bodyRef:t,session:n,route:r,navigate:s})=>{const o=L(),c=ke({message:{kind:"ListAnnouncements",beforeAnnouncementId:null},skip:r?.kind!=="announcementList"}),{loading:i,loadingMore:a,data:p,loadMore:d}=c,u=p?.truncated,E=l.useCallback(()=>{d((b,v)=>b.announcements.length>0?{...v,beforeAnnouncementId:b.announcements[b.announcements.length-1].id}:v,(b,v)=>({...v,announcements:[...b.announcements,...v.announcements]}))},[d]);Xt({bodyRef:t,loading:i,loadingMore:a,truncated:u,loadMoreHelper:E});const[m,w]=l.useState(void 0);return l.useLayoutEffect(()=>{t.current&&m!=null&&r?.kind==="announcementList"&&(t.current.scrollTop=m)},[t,m,r?.kind]),r?.kind==="announcementList"?e.createElement(fr,{bodyRef:t,session:n,block:r.block,onMoreClick:b=>{w(t.current?.scrollTop),R(o,n,r.block,b.title),s({kind:"announcementShow",block:r.block,announcementId:b.id})},...c}):r?.kind==="announcementShow"?e.createElement(hr,{announcementId:r.announcementId}):null},fr=({bodyRef:t,block:n,session:r,onMoreClick:s,error:o,loading:c,loadingMore:i,data:a})=>{const{t:p}=te(),[d,u]=l.useMemo(()=>{const m=[],w=[];if(a){let b=-1;for(const v of a.announcements)b++,b<a.pageSize&&!v.seen&&v.level!==x.SILENT?m.push(v):w.push(v)}return[m,w]},[a]),E=d.length;return e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(Z,{doc:n.name,lookupAttribute:_(r.data)}))),o?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},o.humanMessage||p("resource_center.generic_error")):c||!a?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(O,null)):a.announcements.length===0?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},ge.exists("resource_center.no_announcements",{fallbackLng:[]})?p("resource_center.no_announcements"):p("resource_center.no_results_found")):e.createElement(e.Fragment,null,E>0&&e.createElement("div",{className:"userflowjs-announcement-unread-header"},p("resource_center.unread",{count:E})),d.map((m,w)=>e.createElement(Ft,{key:w,bodyRef:t,onMoreClick:()=>s(m),announcement:m})),d.length>0&&u.length>0&&e.createElement("div",{className:"userflowjs-announcement-seen-divider"}),u.map((m,w)=>e.createElement(Ft,{key:w,bodyRef:t,onMoreClick:()=>s(m),announcement:m})),i&&e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(O,null))))},Dt=new Set;function P(t,n){Dt.has(n.id)&&n.seen||(Dt.add(n.id),et(t,n))}const Ft=({bodyRef:t,onMoreClick:n,announcement:r})=>{const s=L(),o=Pt(),c=l.useRef(null),i=l.useRef(!1);return l.useEffect(()=>{if(i.current||r.seen)return;const a=new IntersectionObserver(d=>{const u=d[0];u&&u.isIntersecting&&(P(s,r),i.current=!0,p())},{root:t.current,threshold:1}),p=()=>{a.disconnect()};return a.observe(c.current),p},[t,s,r]),e.createElement("div",{className:"userflowjs-announcement-list-item"},e.createElement("div",{className:"userflowjs-announcement-time-divider"},e.createElement("div",{className:"userflowjs-announcement-time-divider-line"}),e.createElement("div",{className:"userflowjs-announcement-time-text"},Ne(r.time)),e.createElement("div",{className:"userflowjs-announcement-time-divider-line"})),e.createElement("h2",{ref:c,className:"userflowjs-announcement-title"},!r.seen&&r.level!==x.SILENT&&e.createElement("span",{className:"userflowjs-unread-dot"}),e.createElement("span",null,r.title)),e.createElement("div",{className:"userflowjs-announcement-content userflowjs-bubble-content"},e.createElement(oe.Provider,{value:{...o,data:r.data}},e.createElement(z,{doc:r.content,buttons:r.buttons,lookupAttribute:_(r.data)}))),e.createElement("div",{className:"userflowjs-announcement-more"},r.moreEnabled&&e.createElement("button",{className:"userflowjs-tertiary-button",onClick:n},e.createElement("div",null,r.moreButtonText||"Read more"),e.createElement("span",{className:"userflowjs-rtl-mirrored"},e.createElement(A,{icon:Ot})))))},hr=({announcementId:t})=>{const n=L(),r=Pt(),{t:s}=te(),{loading:o,data:c,error:i}=ke({message:{kind:"GetAnnouncement",announcementId:t}}),a=c?.announcement;return l.useEffect(()=>{!a||a.seen||P(n,a)},[n,a]),e.createElement(e.Fragment,null,i?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},i.humanMessage||s("resource_center.generic_error")):o||!a?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(O,null)):e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-announcement-show"},e.createElement("h2",{className:"userflowjs-announcement-title"},a?.title),e.createElement("div",{className:"userflowjs-announcement-time"},e.createElement("div",{className:"userflowjs-announcement-time-text"},Ne(a.time))),e.createElement("div",{className:"userflowjs-bubble-content"},e.createElement(oe.Provider,{value:{...r,data:a.data}},e.createElement(z,{doc:a.content,buttons:a.buttons,lookupAttribute:_(a.data)}),a.moreEnabled&&e.createElement(z,{doc:a.moreContent,buttons:a.moreButtons,lookupAttribute:_(a.data)}))))))},wr=({block:t,initialUserContent:n,session:r,navigate:s,onChatShow:o})=>{const c=t.assistantFlowId,i=L(),[a,p]=l.useState(null),[d,u]=l.useState(null),[E,m]=l.useState(null),[w]=l.useState(n);l.useEffect(()=>{n&&s({kind:"assistant",block:t,initialUserContent:""})},[n,t,s]),l.useEffect(()=>{let v=!1;return(async()=>{try{const y=se.getItem("assistantConversationId:"+c),[j,C]=await Promise.all([or(),i.send({kind:"GetAssistant",assistantFlowId:c,conversationId:y},{handlesRejection:!0,endBatch:!0})]);if(v)return;p(()=>j),u(C)}catch(y){console.error("Resource center assistant route failed to load:",y),m(y.humanMessage||"Sorry, something went wrong. Please try again or contact my human friends.")}})(),()=>{v=!0}},[i,c]);const b=l.useMemo(()=>{if(!t.assistantContactEnabled)return;const v=r.version.resourceCenter?.blocks.find(N=>N.type===S.CONTACT);if(v)return()=>{switch(R(i,r,t,t.assistantContactButtonText||void 0),t.assistantContactMethod){case bt.EMAIL:s({kind:"email",block:v});break;case bt.PHONE:s({kind:"phone",block:v});break;default:s(null),Yt(r,v,o);break}}},[i,r,t,o,s]);return E?e.createElement("div",{className:"userflowjs-assistant-chat"},e.createElement("div",{className:"userflowjs-assistant-chat__content"},e.createElement("div",{className:"userflowjs-assistant-chat__error"},E))):!a||!d?e.createElement(O,{center:!0,fadeIn:!0}):e.createElement(a,{block:t,session:r,assistantReply:d,initialUserContent:w,onContactClick:b,contactButtonText:t.assistantContactButtonText||void 0})};function R(t,n,r,s){t.send({kind:"ClickResourceCenter",sessionId:n.id,description:r?Ze(r.name,{lookupAttribute:_(n.data)})+(s?` - ${s}`:""):s},{batch:!0})}function Xt({bodyRef:t,loading:n,loadingMore:r,truncated:s,loadMoreHelper:o}){l.useEffect(()=>{const c=t.current;if(!c||n||r||s)return;const i=()=>{c.scrollHeight-c.clientHeight-c.scrollTop>400||o()};return c.addEventListener("scroll",i),()=>{c.removeEventListener("scroll",i)}},[t,n,r,s,o])}function Yt(t,n,r){if(n.chatProvider){const s=De[n.chatProvider];try{s.show({block:n})}catch(o){console.error(`Userflow.js: Error when showing ${n.chatProvider}:`,o)}r()}else t.draftMode&&window.alert("You have not selected a chat provider. Go to the resource center builder in Userflow. Click the Contact block. Pick a chat provider in the side panel.")}function et(t,n){t.setResourceCenterSession(r=>r?{...r,version:{...r.version,resourceCenter:{...r.version.resourceCenter,blocks:r.version.resourceCenter.blocks.map(s=>s.type===S.ANNOUNCEMENTS?{...s,unreadAnnouncementCount:n.level===x.SILENT?s.unreadAnnouncementCount:s.unreadAnnouncementCount-1,popoutAnnouncement:s.popoutAnnouncement?.id===n.id?null:s.popoutAnnouncement,boosterAnnouncement:s.boosterAnnouncement?.id===n.id?null:s.boosterAnnouncement}:s)}}}:null),t.send({kind:"MarkAnnouncementSeen",announcementId:n.id,versionId:n.versionId}),t.toggleUI()}function en(t){return t?.version.resourceCenter?.blocks.find(n=>n.type===S.ANNOUNCEMENTS)||null}function Ne(t){const n=t?new Date(t):new Date;let r=new Intl.DateTimeFormat(ge.language,{weekday:"long",day:"numeric",month:"short",year:n.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(n);return r.substring(0,1).toUpperCase()+r.substring(1)}const Dr=Object.freeze(Object.defineProperty({__proto__:null,FloatingAnnouncements:Vt,LauncherUnreadBadge:Wt,ModalAnnouncement:qt,ResourceCenterApp:Mt,default:Mt,formatAnnouncementTime:Ne,getAnnouncementsBlock:en,markAnnouncementSeen:P,serializeRoute:Qt,syncAnnouncementSeen:et},Symbol.toStringTag,{value:"Module"}));export{rr as A,nr as G,Wt as L,Dr as R,Ht as d,Ne as f,P as m,Qt as s};
|
|
5
5
|
//# sourceMappingURL=ResourceCenterApp.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
import{r as E,R as e}from"./vendor.react.js";import{k as N,z as g,r as R,C}from"./userflow.js";import{u as h}from"./client-context.js";import{u as S,S as k,R as I}from"./use-selector-element-monitoring.js";import{u as w,D as L}from"./stylesheets.js";import{L as x,m as b,f as M,s as j}from"./ResourceCenterApp.js";import{g as D}from"./flow-condition-types.js";import{J as P}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{F as O,B as U}from"./FlowChrome.js";import"./vendor.core-js.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./vendor.obj-str.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./roots.js";import"./flow-host.styl.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./use-window-resize.js";import"./logomark.js";import"./ChecklistUI.js";import"./vendor.memoize-one.js";import"./vendor.bignumber.js.js";import"./use-element-rect.js";import"./vendor.date-fns.js";import"./vendor.canvas-confetti.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="d7e6654e-c197-44df-a85f-ded4fc21c3a1",o._sentryDebugIdIdentifier="sentry-dbid-d7e6654e-c197-44df-a85f-ded4fc21c3a1")}catch{}})();const ge=({session:o,isOpen:t,flowSession:s,resourceCenterLauncherHidden:u})=>{const l=h(),n=o.version.resourceCenter,i=w(o.version.theme),[r,c]=E.useState(null),m=()=>{l.toggleResourceCenter()},v=f=>{c(f)},T=()=>{c(null)},p=n.launcherType===N.CUSTOM&&u!==!0;S({selector:p?n.launcherTargetSelector:null,targetMoved:v,targetLost:T,onTargetClick:m});const a=E.useMemo(()=>n.blocks.find(f=>f.type===g.ANNOUNCEMENTS),[n]),y=p&&!t&&!s&&a&&a.unreadAnnouncementCount>0&&r,d=E.useMemo(()=>a?.popoutAnnouncement,[a]),A=p&&!t&&!s&&d&&r;return e.createElement(k.Provider,{value:o},y&&e.createElement(x,{theme:i,count:a.unreadAnnouncementCount,onClick:m,style:{position:"fixed",top:`${r.targetRect.top}px`,left:`${r.targetRect.left}px`,transform:"translate(-50%, -50%)",zIndex:999999}}),A&&a&&e.createElement(_,{session:o,announcement:d,targetParams:r,onDismiss:()=>{b(l,d)},onOpen:m}))},B=320,_=({session:o,announcement:t,targetParams:s,onOpen:u})=>{const l=h(),n=w(t.theme),i=()=>{b(l,t)},r=()=>{i(),u();const c=j({kind:"announcementShow",block:o.version.resourceCenter.blocks.find(m=>m.type===g.ANNOUNCEMENTS),announcementId:t.id});c?C.setItem(`resourceCenterRoute:v1:${o.id}`,c):C.removeItem(`resourceCenterRoute:v1:${o.id}`)};return e.createElement(O,{company:o.flow.company,theme:n,position:"fixed",stepAppearance:R.TOOLTIP,width:B,tooltipSelector:s.targetEl,tooltipPlacement:null,isModalAnnouncement:!0},e.createElement(U,{close:i}),e.createElement("div",{className:"userflowjs-bubble-content"},e.createElement("div",null,e.createElement("h2",{className:"userflowjs-announcement-title"},e.createElement("span",{className:"userflowjs-unread-dot"}),e.createElement("span",null,t.title)),e.createElement("div",{className:"userflowjs-announcement-time"},e.createElement("div",{className:"userflowjs-announcement-time-text"},M(t.time))),e.createElement("div",{className:"userflowjs-announcement-content"},e.createElement(I,{doc:t.content,buttons:t.buttons,lookupAttribute:D(t.data)})),t.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:r},e.createElement("div",null,t.moreButtonText||"Read more"),e.createElement("span",{className:"userflowjs-rtl-mirrored"},e.createElement(L,{icon:P})))))))};export{ge as ResourceCenterLauncherHandler,ge as default};
|
|
2
2
|
//# sourceMappingURL=ResourceCenterLauncherHandler.js.map
|
package/hash.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
754db0a3c64bf5a49e348a327a043b6b7e06a69c
|
package/package.json
CHANGED
package/ui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ElementSelectionApp.js","vendor.react.js","vendor.core-js.js","vendor.object-assign.js","vendor.is-hotkey.js","vendor.obj-str.js","roots.js","userflow.js","vendor.phoenix.js","vendor.uuid.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","use-window-resize.js","BuilderBar.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","flow-condition-types.js","vendor.date-fns.js","logomark.js","vendor.fortawesome.pro-light-svg-icons.js","SmartFlowRecordingApp.js","FlowApp.js","vendor.lodash.js","FlowChrome.js","flow-host.styl.js","use-selector-element-monitoring.js","vendor.canvas-confetti.js","Trigger.js","ChecklistApp.js","ChecklistUI.js","EmbedApp.js","use-element-rect.js","ResourceCenterLauncherHandler.js","ResourceCenterApp.js","vendor.memoize-one.js","vendor.bignumber.js.js","LauncherApp.js","NotificationsApp.js","TrackerTestingApp.js","StartConditionTestingApp.js","Popover.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{R as e,r as s}from"./vendor.react.js";import{r as
|
|
2
|
+
import{R as e,r as s}from"./vendor.react.js";import{r as C}from"./vendor.react-dom.js";import{u as H,i as B,U as N}from"./client-context.js";import{_ as r,B as $,R as j,k as q,U as G}from"./userflow.js";import"./vendor.core-js.js";import{I as J}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.scheduler.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="ce5bc7ec-ec6c-4c10-b07a-1e2558d77444",t._sentryDebugIdIdentifier="sentry-dbid-ce5bc7ec-ec6c-4c10-b07a-1e2558d77444")}catch{}})();const K=e.lazy(()=>r(()=>import("./ElementSelectionApp.js"),__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]))),M=e.lazy(()=>r(()=>import("./SmartFlowRecordingApp.js"),__vite__mapDeps([26,1,2,3,5,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,25,14]))),Q=e.lazy(()=>r(()=>import("./FlowApp.js"),__vite__mapDeps([27,1,2,3,7,8,9,28,13,12,29,20,19,21,22,23,6,10,11,16,17,18,30,31,5,14,24,32,33]))),W=e.lazy(()=>r(()=>import("./ChecklistApp.js"),__vite__mapDeps([34,1,2,3,7,8,9,29,20,19,21,22,23,12,6,10,11,13,16,17,18,30,31,5,14,24,32,35]))),X=e.lazy($),Y=e.lazy(()=>r(()=>import("./EmbedApp.js"),__vite__mapDeps([36,1,2,3,7,8,9,10,11,12,13,5,19,20,21,22,23,6,31,30,17,18,16,37,14,35]))),Z=e.lazy(j),ee=e.lazy(()=>r(()=>import("./ResourceCenterLauncherHandler.js"),__vite__mapDeps([38,1,2,3,7,8,9,10,11,12,13,31,22,23,6,19,20,21,5,39,30,16,17,18,14,24,35,29,32,40,41,37]))),te=e.lazy(()=>r(()=>import("./LauncherApp.js"),__vite__mapDeps([42,1,2,3,7,8,9,31,22,23,12,6,19,20,21,10,11,13,5,30,29,16,17,18,14,24,32,33]))),ne=e.lazy(()=>r(()=>import("./NotificationsApp.js"),__vite__mapDeps([43,1,2,3,10,11,12,13,30,7,8,9,19,20,21,22,23,6]))),se=e.lazy(()=>r(()=>import("./TrackerTestingApp.js"),__vite__mapDeps([44,1,2,3,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,5,25,14]))),re=e.lazy(()=>r(()=>import("./StartConditionTestingApp.js"),__vite__mapDeps([45,1,2,3,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,5,25,14,46]))),oe=()=>{const t=H(),[n,m]=s.useState(t.getSessionStorageState()),[c,p]=s.useState(()=>d()?null:t.flowSession),[i,y]=s.useState(t.checklistSession),[E,v]=s.useState(t.checklistExpanded),[l,g]=s.useState(t.bannerSession),[a,A]=s.useState(t.resourceCenterSession),[S,w]=s.useState(t.resourceCenterOpen),[u,L]=s.useState(t.resourceCenterLauncherHidden),[h,R]=s.useState(t.resourceCenterEmbedsChecklist()),[I,T]=s.useState(t.embedChecklistSessions()),[D,O]=s.useState(t.launcherSessions),[F,P]=s.useState(t.activeLauncherFlowId),[f,z]=s.useState(t.notifications),[V,x]=s.useState(t.embedSessions);s.useEffect(()=>{const o=()=>{m(t.getSessionStorageState()),p(U=>d()&&t.flowSession?.id!==U?.id?null:t.flowSession),y(t.checklistSession),v(t.checklistExpanded),g(t.bannerSession),A(t.resourceCenterSession),w(t.resourceCenterOpen),L(t.resourceCenterLauncherHidden),R(t.resourceCenterEmbedsChecklist()),T(t.embedChecklistSessions()),O(t.launcherSessions),P(t.activeLauncherFlowId),z(t.notifications),x(t.embedSessions)};t.on("uistatechange",o);const k=()=>{d()||p(t.flowSession)};return document.addEventListener("visibilitychange",k),()=>{t.off("uistatechange",o),document.removeEventListener("visibilitychange",k)}},[t]);const _=!n.activeApp&&!!c,b=a?.version.resourceCenter?.launcherType;return s.useLayoutEffect(()=>{if(_)return t.emit("flowvisibilitychange",!0),()=>{t.emit("flowvisibilitychange",!1)}},[t,_]),n.activeApp==="elementSelection"&&n.elementSelection?e.createElement(e.Suspense,{fallback:null},e.createElement(K,{state:n.elementSelection})):n.activeApp==="trackerTesting"&&n.trackerTesting?e.createElement(e.Suspense,{fallback:null},e.createElement(se,{state:n.trackerTesting})):n.activeApp==="smartFlowRecording"&&n.smartFlowRecording?e.createElement(e.Suspense,{fallback:null},e.createElement(M,{state:n.smartFlowRecording})):e.createElement(e.Fragment,null,c&&e.createElement(e.Suspense,{fallback:null},e.createElement(Q,{key:c.id,session:c,checklistSession:i,resourceCenterEmbedsChecklist:h})),i&&!h&&!I&&(E||i.version.checklist?.launcherEnabled)&&e.createElement(e.Suspense,{fallback:null},e.createElement(W,{key:i.id,session:i,checklistExpanded:E})),l&&e.createElement(e.Suspense,{fallback:null},e.createElement(X,{key:l.id,session:l})),a&&e.createElement(e.Fragment,null,e.createElement(e.Suspense,{fallback:null},e.createElement(Z,{key:`${a.id}-${u}-${b}`,session:a,isOpen:S,flowSession:c,checklistSession:i,resourceCenterLauncherHidden:u})),b!==q.DEFAULT&&e.createElement(e.Suspense,{fallback:null},e.createElement(ee,{session:a,isOpen:S,flowSession:c,resourceCenterLauncherHidden:u}))),e.createElement(e.Suspense,{fallback:null},D.map(o=>e.createElement(te,{key:o.flow.id,session:o,active:o.flow.id===F}))),f.length>0&&e.createElement(e.Suspense,{fallback:null},e.createElement(ne,{notifications:f})),n.activeApp==="startConditionTesting"&&n.testStartConditionToken&&e.createElement(e.Suspense,{fallback:null},e.createElement(re,{token:n.testStartConditionToken})),V.map(o=>e.createElement(e.Suspense,{key:o.id,fallback:null},e.createElement(Y,{session:o,checklistSession:i,type:"embed"}))))};function d(){return document.visibilityState==="hidden"}const ie=({client:t})=>e.createElement(J,{i18n:B},e.createElement(N.Provider,{value:t},e.createElement(oe,null)));class be{constructor(n){this.client=n}mount(){if(this.container)throw new G("UI has already been mounted");this.container=document.createElement("div"),this.container.id="userflow-ui",document.body.appendChild(this.container),C.render(e.createElement(ie,{client:this.client}),this.container)}unmount(){this.container&&(C.unmountComponentAtNode(this.container),document.body.contains(this.container)&&document.body.removeChild(this.container),delete this.container)}}export{be as RealUI};
|
|
3
3
|
//# sourceMappingURL=ui.js.map
|
package/userflow.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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","use-selector-element-monitoring.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","Frame.js","vendor.react-dom.js","vendor.scheduler.js","use-window-resize.js","logomark.js","ChecklistUI.js","FlowChrome.js","vendor.canvas-confetti.js","vendor.memoize-one.js","vendor.bignumber.js.js","use-element-rect.js","BannerApp.js","vendor.phoenix.js","vendor.uuid.js","implicit-tracking.js","DebuggerUI.js","vendor.lodash.js","vendor.fortawesome.react-fontawesome.js","vendor.fortawesome.fontawesome-svg-core.js","Popover.js","vendor.react-day-picker.js","ui.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"./vendor.core-js.js";import{S as Y}from"./vendor.phoenix.js";import{v as R}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]="d6d8d090-c40a-4691-9284-4f4f0847a5a3",t._sentryDebugIdIdentifier="sentry-dbid-d6d8d090-c40a-4691-9284-4f4f0847a5a3")}catch{}})();const z="modulepreload",J=function(t){return new URL("./",import.meta.url).toString()+t},v={},g=function(e,s,i){let n=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");n=Promise.allSettled(s.map(c=>{if(c=J(c),c in v)return;v[c]=!0;const l=c.endsWith(".css"),T=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${T}`))return;const E=document.createElement("link");if(E.rel=l?"stylesheet":z,l||(E.as="script"),E.crossOrigin="",E.href=c,u&&E.setAttribute("nonce",u),document.head.appendChild(E),l)return new Promise(($,j)=>{E.addEventListener("load",$),E.addEventListener("error",()=>j(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 n.then(a=>{for(const u of a||[])u.status==="rejected"&&r(u.reason);return e().catch(r)})};class h extends Error{constructor(e,s,i){super(e),Object.setPrototypeOf(this,h.prototype),this.name="UserflowError",this.code=s,this.humanMessage=i}}class B{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 I=new B("localStorage"),f=new B("sessionStorage");function rt(t){window.location.href=t}function H(){return window.location.href}function L(t){window.postMessage(t,window.origin)}function x(t){const e=i=>{if(i.source!==window||i.origin!==window.origin)return;const n=i.data;!n||typeof n!="object"||typeof n.kind!="string"||!n.kind.startsWith("userflow:")||t(n)===!0&&s()};window.addEventListener("message",e);const s=()=>window.removeEventListener("message",e);return s}function Q(t){return new Promise(e=>{x(s=>{const i=t(s);return i?(e(i),!0):!1})})}const _=new Set;let O=!1;function X(t){return Z(),_.add(t),()=>{G(t)}}function G(t){_.delete(t)}function w(){_.forEach(t=>t())}function Z(){if(O)return;O=!0;const{history:t}=window,e=s=>{const i=t[s];t[s]=(...n)=>{const r=i.apply(t,n);return w(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{w()}),window.addEventListener("userflow:replacestate",()=>{w()})):(e("pushState"),e("replaceState")),window.addEventListener("popstate",()=>{w()})}class q{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){L({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:e})}onBuilderMessage(e){return this.unregisterOnMessage=x(e),!1}async captureScreenshot(e,s,i,n){return L({kind:"userflow:crxScreenshot",x:e,y:s,width:i,height:n,devicePixelRatio:window.devicePixelRatio}),(await Q(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var C=(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))(C||{}),ee=(t=>(t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t))(ee||{}),m=(t=>(t.ACTION="ACTION",t.DRAFT="DRAFT",t.LINK="LINK",t.LAUNCHER_SEEN="LAUNCHER_SEEN",t.RESOURCE_CENTER="RESOURCE_CENTER",t.USERFLOWJS="USERFLOWJS",t))(m||{}),te=(t=>(t.LIKE="LIKE",t.DISLIKE="DISLIKE",t))(te||{}),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||{}),k=(t=>(t.FLOW="FLOW",t.BANNER="BANNER",t.EMBED="EMBED",t.CHECKLIST="CHECKLIST",t.LAUNCHER="LAUNCHER",t.RESOURCE_CENTER="RESOURCE_CENTER",t))(k||{}),se=(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))(se||{}),ie=(t=>(t.AUTO="AUTO",t.MANUAL="MANUAL",t))(ie||{}),ne=(t=>(t.INPUT="INPUT",t))(ne||{}),re=(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))(re||{}),oe=(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))(oe||{}),ae=(t=>(t.END_USER="END_USER",t.GROUP="GROUP",t))(ae||{}),ce=(t=>(t.BETWEEN="BETWEEN",t.EQ="EQ",t.GTE="GTE",t.LTE="LTE",t))(ce||{}),le=(t=>(t.ANY="ANY",t.RELATIVE_BETWEEN="RELATIVE_BETWEEN",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t))(le||{}),ue=(t=>(t.CURRENT_USER="CURRENT_USER",t.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",t.CURRENT_GROUP="CURRENT_GROUP",t))(ue||{}),he=(t=>(t.ASSET="ASSET",t.CARTOON="CARTOON",t.NONE="NONE",t.URL="URL",t))(he||{}),de=(t=>(t.INSIDE="INSIDE",t.OUTSIDE="OUTSIDE",t))(de||{}),fe=(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))(fe||{}),Ee=(t=>(t.GOOGLE="GOOGLE",t.STANDARD="STANDARD",t))(Ee||{}),Se=(t=>(t.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",t.DISMISS="DISMISS",t))(Se||{}),Te=(t=>(t.DISMISS="DISMISS",t.NONE="NONE",t))(Te||{}),ge=(t=>(t.DEFAULT="DEFAULT",t.NARROW="NARROW",t.CHAINED_SQUARED="CHAINED_SQUARED",t.CHAINED_ROUNDED="CHAINED_ROUNDED",t.DOTTED="DOTTED",t.NUMBERED="NUMBERED",t))(ge||{}),Ie=(t=>(t.TOP="TOP",t.BOTTOM="BOTTOM",t))(Ie||{}),we=(t=>(t.DEFAULT="DEFAULT",t.PLAINTEXT="PLAINTEXT",t.CUSTOM="CUSTOM",t))(we||{}),Ce=(t=>(t.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",t.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",t.NONE="NONE",t))(Ce||{}),ke=(t=>(t.BUBBLE="BUBBLE",t.END="END",t.ERROR="ERROR",t.FLAG="FLAG",t))(ke||{}),me=(t=>(t.MANUAL="MANUAL",t.NONE="NONE",t.SYNTHETIC="SYNTHETIC",t))(me||{}),Ue=(t=>(t.BUBBLE="BUBBLE",t.HIDDEN="HIDDEN",t.MODAL="MODAL",t.TOOLTIP="TOOLTIP",t))(Ue||{}),pe=(t=>(t.ABOVE="ABOVE",t.BELOW="BELOW",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(pe||{}),Le=(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))(Le||{}),Ne=(t=>(t.NEW_TAB="NEW_TAB",t.SAME_TAB="SAME_TAB",t))(Ne||{}),_e=(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))(_e||{}),Ae=(t=>(t.MULTILINE_TEXT="MULTILINE_TEXT",t.MULTIPLE_CHOICE="MULTIPLE_CHOICE",t.NPS="NPS",t.SCALE="SCALE",t.STARS="STARS",t.TEXT="TEXT",t))(Ae||{}),N=(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))(N||{}),Re=(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))(Re||{}),ve=(t=>(t.BUTTON="BUTTON",t.INPUT="INPUT",t))(ve||{}),Oe=(t=>(t.EMAIL="EMAIL",t.PHONE="PHONE",t.CHAT="CHAT",t))(Oe||{}),be=(t=>(t.SILENT="SILENT",t.BADGE="BADGE",t.POPOUT="POPOUT",t.MODAL="MODAL",t.TOAST="TOAST",t))(be||{}),De=(t=>(t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.NONE="NONE",t))(De||{}),ye=(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))(ye||{}),W=(t=>(t.ACTIVATE="ACTIVATE",t.DEACTIVATE="DEACTIVATE",t.NEVER="NEVER",t))(W||{}),Me=(t=>(t.AUTO="AUTO",t.TOP="TOP",t.RIGHT="RIGHT",t.BOTTOM="BOTTOM",t.LEFT="LEFT",t))(Me||{}),Pe=(t=>(t.START="START",t.CENTER="CENTER",t.END="END",t))(Pe||{}),Be=(t=>(t.PERCENT="PERCENT",t.PX="PX",t))(Be||{}),He=(t=>(t.BEACON="BEACON",t.BUTTON="BUTTON",t.HIDDEN="HIDDEN",t.ICON="ICON",t))(He||{}),xe=(t=>(t.LAUNCHER="LAUNCHER",t.TARGET="TARGET",t))(xe||{}),Ge=(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))(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||{}),V=(t=>(t.CHECKLIST="CHECKLIST",t))(V||{}),Ve=(t=>(t.ALWAYS="ALWAYS",t.MULTIPLE="MULTIPLE",t.NEVER="NEVER",t.ONCE="ONCE",t.ONCE_PER_GROUP="ONCE_PER_GROUP",t))(Ve||{}),Fe=(t=>(t.NONE="NONE",t.PENDING_SCHEDULE="PENDING_SCHEDULE",t.SCHEDULED="SCHEDULED",t.FIRED="FIRED",t))(Fe||{}),Ke=(t=>(t.NONE="NONE",t.LIKE="LIKE",t.SCALE="SCALE",t))(Ke||{}),$e=(t=>(t.HIDE="HIDE",t.BLOCK="BLOCK",t.OTHERS="OTHERS",t))($e||{});function je(){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 d=je();function b(t){return Array.isArray(t)||(t=t?[t]:[]),t=t.map(e=>typeof e=="string"?new RegExp(e):e),t}function ot(t,e){return t.every(s=>typeof s=="function"?s(e):s instanceof RegExp?s.test(e):!0)}function Ye(){let t=H();if(d.urlFilter){if(t=d.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 Y}from"./vendor.phoenix.js";import{v as R}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]="58e23600-da4f-4d72-904f-6989c03e12c5",t._sentryDebugIdIdentifier="sentry-dbid-58e23600-da4f-4d72-904f-6989c03e12c5")}catch{}})();const z="modulepreload",J=function(t){return new URL("./",import.meta.url).toString()+t},v={},g=function(e,s,i){let n=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");n=Promise.allSettled(s.map(c=>{if(c=J(c),c in v)return;v[c]=!0;const l=c.endsWith(".css"),T=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${T}`))return;const E=document.createElement("link");if(E.rel=l?"stylesheet":z,l||(E.as="script"),E.crossOrigin="",E.href=c,u&&E.setAttribute("nonce",u),document.head.appendChild(E),l)return new Promise(($,j)=>{E.addEventListener("load",$),E.addEventListener("error",()=>j(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 n.then(a=>{for(const u of a||[])u.status==="rejected"&&r(u.reason);return e().catch(r)})};class h extends Error{constructor(e,s,i){super(e),Object.setPrototypeOf(this,h.prototype),this.name="UserflowError",this.code=s,this.humanMessage=i}}class B{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 I=new B("localStorage"),f=new B("sessionStorage");function rt(t){window.location.href=t}function H(){return window.location.href}function L(t){window.postMessage(t,window.origin)}function x(t){const e=i=>{if(i.source!==window||i.origin!==window.origin)return;const n=i.data;!n||typeof n!="object"||typeof n.kind!="string"||!n.kind.startsWith("userflow:")||t(n)===!0&&s()};window.addEventListener("message",e);const s=()=>window.removeEventListener("message",e);return s}function Q(t){return new Promise(e=>{x(s=>{const i=t(s);return i?(e(i),!0):!1})})}const _=new Set;let O=!1;function X(t){return Z(),_.add(t),()=>{G(t)}}function G(t){_.delete(t)}function w(){_.forEach(t=>t())}function Z(){if(O)return;O=!0;const{history:t}=window,e=s=>{const i=t[s];t[s]=(...n)=>{const r=i.apply(t,n);return w(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{w()}),window.addEventListener("userflow:replacestate",()=>{w()})):(e("pushState"),e("replaceState")),window.addEventListener("popstate",()=>{w()})}class q{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){L({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:e})}onBuilderMessage(e){return this.unregisterOnMessage=x(e),!1}async captureScreenshot(e,s,i,n){return L({kind:"userflow:crxScreenshot",x:e,y:s,width:i,height:n,devicePixelRatio:window.devicePixelRatio}),(await Q(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var C=(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))(C||{}),ee=(t=>(t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t))(ee||{}),m=(t=>(t.ACTION="ACTION",t.DRAFT="DRAFT",t.LINK="LINK",t.LAUNCHER_SEEN="LAUNCHER_SEEN",t.RESOURCE_CENTER="RESOURCE_CENTER",t.USERFLOWJS="USERFLOWJS",t))(m||{}),te=(t=>(t.LIKE="LIKE",t.DISLIKE="DISLIKE",t))(te||{}),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||{}),k=(t=>(t.FLOW="FLOW",t.BANNER="BANNER",t.EMBED="EMBED",t.CHECKLIST="CHECKLIST",t.LAUNCHER="LAUNCHER",t.RESOURCE_CENTER="RESOURCE_CENTER",t))(k||{}),se=(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))(se||{}),ie=(t=>(t.AUTO="AUTO",t.MANUAL="MANUAL",t))(ie||{}),ne=(t=>(t.INPUT="INPUT",t))(ne||{}),re=(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))(re||{}),oe=(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))(oe||{}),ae=(t=>(t.END_USER="END_USER",t.GROUP="GROUP",t))(ae||{}),ce=(t=>(t.BETWEEN="BETWEEN",t.EQ="EQ",t.GTE="GTE",t.LTE="LTE",t))(ce||{}),le=(t=>(t.ANY="ANY",t.RELATIVE_BETWEEN="RELATIVE_BETWEEN",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t))(le||{}),ue=(t=>(t.CURRENT_USER="CURRENT_USER",t.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",t.CURRENT_GROUP="CURRENT_GROUP",t))(ue||{}),he=(t=>(t.ASSET="ASSET",t.CARTOON="CARTOON",t.NONE="NONE",t.URL="URL",t))(he||{}),de=(t=>(t.INSIDE="INSIDE",t.OUTSIDE="OUTSIDE",t))(de||{}),fe=(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))(fe||{}),Ee=(t=>(t.GOOGLE="GOOGLE",t.STANDARD="STANDARD",t))(Ee||{}),Se=(t=>(t.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",t.DISMISS="DISMISS",t))(Se||{}),Te=(t=>(t.DISMISS="DISMISS",t.NONE="NONE",t))(Te||{}),ge=(t=>(t.DEFAULT="DEFAULT",t.NARROW="NARROW",t.CHAINED_SQUARED="CHAINED_SQUARED",t.CHAINED_ROUNDED="CHAINED_ROUNDED",t.DOTTED="DOTTED",t.NUMBERED="NUMBERED",t))(ge||{}),Ie=(t=>(t.TOP="TOP",t.BOTTOM="BOTTOM",t))(Ie||{}),we=(t=>(t.DEFAULT="DEFAULT",t.PLAINTEXT="PLAINTEXT",t.CUSTOM="CUSTOM",t))(we||{}),Ce=(t=>(t.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",t.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",t.NONE="NONE",t))(Ce||{}),ke=(t=>(t.BUBBLE="BUBBLE",t.END="END",t.ERROR="ERROR",t.FLAG="FLAG",t))(ke||{}),me=(t=>(t.MANUAL="MANUAL",t.NONE="NONE",t.SYNTHETIC="SYNTHETIC",t))(me||{}),Ue=(t=>(t.BUBBLE="BUBBLE",t.HIDDEN="HIDDEN",t.MODAL="MODAL",t.TOOLTIP="TOOLTIP",t))(Ue||{}),pe=(t=>(t.ABOVE="ABOVE",t.BELOW="BELOW",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(pe||{}),Le=(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))(Le||{}),Ne=(t=>(t.NEW_TAB="NEW_TAB",t.SAME_TAB="SAME_TAB",t))(Ne||{}),_e=(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))(_e||{}),Ae=(t=>(t.MULTILINE_TEXT="MULTILINE_TEXT",t.MULTIPLE_CHOICE="MULTIPLE_CHOICE",t.NPS="NPS",t.SCALE="SCALE",t.STARS="STARS",t.TEXT="TEXT",t))(Ae||{}),N=(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))(N||{}),Re=(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))(Re||{}),ve=(t=>(t.BUTTON="BUTTON",t.INPUT="INPUT",t))(ve||{}),Oe=(t=>(t.EMAIL="EMAIL",t.PHONE="PHONE",t.CHAT="CHAT",t))(Oe||{}),be=(t=>(t.SILENT="SILENT",t.BADGE="BADGE",t.POPOUT="POPOUT",t.MODAL="MODAL",t.TOAST="TOAST",t))(be||{}),De=(t=>(t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.NONE="NONE",t))(De||{}),ye=(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))(ye||{}),W=(t=>(t.ACTIVATE="ACTIVATE",t.DEACTIVATE="DEACTIVATE",t.NEVER="NEVER",t))(W||{}),Me=(t=>(t.AUTO="AUTO",t.TOP="TOP",t.RIGHT="RIGHT",t.BOTTOM="BOTTOM",t.LEFT="LEFT",t))(Me||{}),Pe=(t=>(t.START="START",t.CENTER="CENTER",t.END="END",t))(Pe||{}),Be=(t=>(t.PERCENT="PERCENT",t.PX="PX",t))(Be||{}),He=(t=>(t.BEACON="BEACON",t.BUTTON="BUTTON",t.HIDDEN="HIDDEN",t.ICON="ICON",t))(He||{}),xe=(t=>(t.LAUNCHER="LAUNCHER",t.TARGET="TARGET",t))(xe||{}),Ge=(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))(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||{}),V=(t=>(t.CHECKLIST="CHECKLIST",t))(V||{}),Ve=(t=>(t.ALWAYS="ALWAYS",t.MULTIPLE="MULTIPLE",t.NEVER="NEVER",t.ONCE="ONCE",t.ONCE_PER_GROUP="ONCE_PER_GROUP",t))(Ve||{}),Fe=(t=>(t.NONE="NONE",t.PENDING_SCHEDULE="PENDING_SCHEDULE",t.SCHEDULED="SCHEDULED",t.FIRED="FIRED",t))(Fe||{}),Ke=(t=>(t.NONE="NONE",t.LIKE="LIKE",t.SCALE="SCALE",t))(Ke||{}),$e=(t=>(t.HIDE="HIDE",t.BLOCK="BLOCK",t.OTHERS="OTHERS",t))($e||{});function je(){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 d=je();function b(t){return Array.isArray(t)||(t=t?[t]:[]),t=t.map(e=>typeof e=="string"?new RegExp(e):e),t}function ot(t,e){return t.every(s=>typeof s=="function"?s(e):s instanceof RegExp?s.test(e):!0)}function Ye(){let t=H();if(d.urlFilter){if(t=d.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 K=F.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=A("log");o.group=A("group");o.groupCollapsed=A("groupCollapsed");o.groupEnd=function(){K&&console.groupEnd()};let U;function A(t){return function(e,...s){if(K){const i=performance.now(),n=U?Math.round(i-U):0;U=i,console[t](`%cuserflow %c${e} %c+${n}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const ze=()=>g(()=>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]));function Je(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class D{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 y=["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"],Qe=()=>g(()=>import("./BannerApp.js"),__vite__mapDeps([28,1,2,3,4,5,6,7,16,13,14,15,10,11,12,9,8,18,19,17,27,20,29,30])),p="1017209",Xe=import.meta.url,M=50,Ze=5*60*1e3,P="userflowClientState";class qe{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=!1,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 i=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(n=>({...n,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),f.setItem("previewFlowId",e.flowId),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(n=>({...n,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const n=()=>{const r=this.resourceCenterSession;r&&r.draftMode&&r.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",n))};this.on("resourceCenterChanged",n),n()}});return}case"userflow:testTracker":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(n=>({...n,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(n=>({...n,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(n=>({...n,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(n=>({...n,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),M))},this.onUserActivity=()=>this.ensureConnected(),this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+p),X(this.onUrlChange),this.setTargetEnv(new q),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of y)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),G(this.onUrlChange),this.destroyTargetEnv();for(const e of y)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());f.setItem(P,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=f.getItem(P);if(s)try{e=JSON.parse(s)}catch(i){console.error("Userflow.js: Parse ElementSelectionState error:",i)}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(n=>({...n,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:i}=e;i&&(this.groupId=i.id,s.push(this.group(i.id,{name:i.name},{signature:i.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=d.serverEndpoint||e+"userflow.com";new URL(Xe).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const i="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new Y(i,{reconnectAfterMs:n=>[100,500,1e3,5e3][n-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(n=>{console.log("Userflow.js socket error",n),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",n=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(n.featureFlags),this.logrocketAppId=n.logrocketAppId,this.featureFlags=new Set(n.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",n=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(n.code)?(console.error(`Userflow.js resetting due to: [${n.code}] ${n.message}`),this.reset(),this.clientToken=null):n.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${n.code}] ${n.message}`),this.destroy()):console.log("Userflow.js channel join error",n)}),this.channel.on("server_message",n=>this.handleServerMessage(n)),this.channel.on("server_error",n=>{console.log(`Userflow.js server error (${n.code}): ${n.message}`+(n.details&&n.details.length>0?`
|
|
4
|
+
Error message: `+e.message)}}return t}let F="";try{F=localStorage.getItem("debug")||""}catch{}const K=F.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=A("log");o.group=A("group");o.groupCollapsed=A("groupCollapsed");o.groupEnd=function(){K&&console.groupEnd()};let U;function A(t){return function(e,...s){if(K){const i=performance.now(),n=U?Math.round(i-U):0;U=i,console[t](`%cuserflow %c${e} %c+${n}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const ze=()=>g(()=>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]));function Je(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class D{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 y=["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"],Qe=()=>g(()=>import("./BannerApp.js"),__vite__mapDeps([28,1,2,3,4,5,6,7,16,13,14,15,10,11,12,9,8,18,19,17,27,20,29,30])),p="1017252",Xe=import.meta.url,M=50,Ze=5*60*1e3,P="userflowClientState";class qe{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.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 i=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(n=>({...n,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),f.setItem("previewFlowId",e.flowId),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(n=>({...n,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const n=()=>{const r=this.resourceCenterSession;r&&r.draftMode&&r.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",n))};this.on("resourceCenterChanged",n),n()}});return}case"userflow:testTracker":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(n=>({...n,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(n=>({...n,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{i(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(n=>({...n,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(n=>({...n,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(n=>({...n,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),M))},this.onUserActivity=()=>this.ensureConnected(),this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+p),X(this.onUrlChange),this.setTargetEnv(new q),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of y)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),G(this.onUrlChange),this.destroyTargetEnv();for(const e of y)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());f.setItem(P,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=f.getItem(P);if(s)try{e=JSON.parse(s)}catch(i){console.error("Userflow.js: Parse ElementSelectionState error:",i)}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(n=>({...n,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:i}=e;i&&(this.groupId=i.id,s.push(this.group(i.id,{name:i.name},{signature:i.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=d.serverEndpoint||e+"userflow.com";new URL(Xe).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const i="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new Y(i,{reconnectAfterMs:n=>[100,500,1e3,5e3][n-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(n=>{console.log("Userflow.js socket error",n),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",n=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(n.featureFlags),this.logrocketAppId=n.logrocketAppId,this.featureFlags=new Set(n.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",n=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(n.code)?(console.error(`Userflow.js resetting due to: [${n.code}] ${n.message}`),this.reset(),this.clientToken=null):n.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${n.code}] ${n.message}`),this.destroy()):console.log("Userflow.js channel join error",n)}),this.channel.on("server_message",n=>this.handleServerMessage(n)),this.channel.on("server_error",n=>{console.log(`Userflow.js server error (${n.code}): ${n.message}`+(n.details&&n.details.length>0?`
|
|
5
5
|
Details:
|
|
6
6
|
`+n.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await g(()=>import("./implicit-tracking.js"),__vite__mapDeps([31,12,2,30,29])).then(e=>{this.implicitTracking=new e.ImplicitTracking(this),this.implicitTracking.start()}).catch(e=>o(`Implicit tracking failed to load ${e}`))}makeChannelJoinPayload(){const e=this.buildClientContext();this.clientContext=e;const s={protocolVersion:2,userflowClientBuild:p,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,launchers:this.launcherSessions.map(i=>({flowId:i.flow.id})),trackers:Array.from(this.trackers.values()).map(i=>({flowId:i.tracker.flowId})),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map(i=>({conditionId:i.condition.id,isTrue:i.isTrue})),previewFlowId:f.getItem("previewFlowId"),clientContext:e};return o("channel join payload",s),s}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()},Ze)}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:i,handlesRejection:n}={}){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),i?this.endBatch():this.endBatchTimeout=window.setTimeout(()=>{this.endBatch()},M)),this.sendRaw(e,{handlesRejection:n})}clearInitialMessagesQueue(e){if(this.initialMessagesQueue.length===0)return;const s=e.includes("cff_disable_page_views")===!0,i=e.includes("cff_implicit_events")===!1;for(const n of this.initialMessagesQueue){const{message:r,handlesRejection:a,resolve:u,reject:c}=n;if(i&&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((i,n)=>{this.initialMessagesQueue.push({message:e,resolve:i,reject:n,handlesRejection:s})}):new Promise((i,n)=>{this._sendToChannel(e,i,n,{handlesRejection:s})})}_sendToChannel(e,s,i,{handlesRejection:n}={}){if(!this.channel){const c=`Userflow.js: send() should not be called if channel is not set. Message kind=${e.kind}`;if(n)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,`
|
|
@@ -14,5 +14,5 @@ Error:`,c),n&&i(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:i,flowSessionClock:n,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,T=this.launcherSessions.findIndex(E=>E.flow.id===l.flow.id);T===-1?this.launcherSessions=[...this.launcherSessions,l]:this.launcherSessions=[...this.launcherSessions.slice(0,T),l,...this.launcherSessions.slice(T+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(n>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${n} > serverClock=${s}`);return}i?.id===e.sessionId&&this.emit("gotostep",{session:i,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":n<=s||i?.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=${n} > 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(n>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${n} > serverClock=${s}`);return}i?.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(T=>T.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}default:console.warn("Userflow.js: Received unknown message",e);return}}async identify(e,s={},{signature:i}={}){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=i||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(!I.isSupported())throw new h("userflow.identifyAnonymous() is not supported when localStorage access is denied.");const i="anonymousId";let n=I.getItem(i);n||(n="anon-"+R(),I.setItem(i,n)),await this.identify(n,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:i,membership:n}={}){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=i||null,await this.send({kind:"UpsertGroup",groupExternalId:e,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(s),membershipAttributes:this.normalizeAttributes(n)},{batch:!0})}async updateGroup(e={},s={}){o("updateGroup");const i=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:i,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 i in e){if(!e.hasOwnProperty(i))continue;if(i==="traits"){const r=e[i];Object.assign(s,this.extractLegacyTraits(r));continue}let n=e[i];if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n==null||Array.isArray(n))s[i]=this.normalizeAttributeLiteralOrList(i,n);else{if(typeof n!="object"||n==null)throw new h(`Userflow: Invalid value for '${i}' attribute.`);if("set"in n)s[i]={set:this.normalizeAttributeLiteralOrList(i,n.set),dataType:this.normalizeDataType(i,n.data_type||n.dataType)};else if("set_once"in n||"setOnce"in n)s[i]={setOnce:this.normalizeAttributeLiteralOrList(i,n.set_once??n.setOnce),dataType:this.normalizeDataType(i,n.data_type||n.dataType)};else if("add"in n){const r=n.add;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'add' value for '${i}' attribute. Must be a number or string.`);s[i]={add:r}}else if("subtract"in n){const r=n.subtract;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'subtract' value for '${i}' attribute. Must be a number or string.`);s[i]={subtract:r}}else if("append"in n)s[i]={append:this.normalizeAttributeLiteralOrList(i,n.append)};else if("prepend"in n)s[i]={prepend:this.normalizeAttributeLiteralOrList(i,n.prepend)};else if("remove"in n)s[i]={remove:this.normalizeAttributeLiteralOrList(i,n.remove)};else throw new h(`Userflow: Invalid value for '${i}' attribute.`)}}return s}normalizeAttributeLiteralOrList(e,s){return Array.isArray(s)?s.map(i=>this.normalizeAttributeLiteral(e,i)):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 i in e)e.hasOwnProperty(i)&&s.push({name:i,value:e[i]});e=s}return e.reduce((s,{name:i,value:n,dataType:r})=>{if(typeof i!="string"||i.length>100||!i.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:",i),s;if(typeof n!="string")if(typeof n=="boolean")r||(r="boolean"),n=n?"true":"false";else if(typeof n=="number")r||(r=Number.isInteger(n)?"integer":"decimal"),n=String(n);else return this.warn(`userflow.identify: The value of trait '${i}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,n),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 '${i}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,r),s}return s[i]={set:n,dataType:a},s},{})}async track(e,s={},{userOnly:i}={}){o(`track '${e}'`,s),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!i,name:e,attributes:this.normalizeEventAttributes(s)},{batch:!0})}async trackRawEvent(e){const{name:s,attributes:i}=e;o(`track raw event '${s}'`,i),this.ensureIdentified(),await this.send({kind:"TrackRawEvent",name:s,attributes:this.normalizeEventAttributes(i)})}normalizeEventAttributes(e){const s=this.normalizeAttributes(e);for(const i in s){if(!s.hasOwnProperty(i))continue;const n=s[i];if(!(n==null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||Array.isArray(n)||"set"in n))throw new h(`Userflow: Invalid value for '${i}' 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(H()),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:m.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:R(),page_title:document.title,...this.buildClientContext()}})}buildClientContext(){return{pageUrl:Ye(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}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 i=this.listeners.get(e);i||(i=new Set,this.listeners.set(e,i)),i.add(s)}off(e,s){const i=this.listeners.get(e);i&&i.delete(s)}emit(e,...s){const i=this.listeners.get(e);i&&Array.from(i).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.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,I.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:i,once:n,batch:r,replaceCurrent:a}){if(this.ensureIdentified(),a&&this.flowSession&&this.endFlow(this.flowSession,{endReason:C.REPLACED,batch:!0}),o(`startFlow ${e}`,{startReason:i}),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:i,once:!!n};await this.send(u,{batch:r})}async trackButtonEvent(e,s,i,n){const r={kind:"TrackButtonEvent",eventName:e,stepCvid:i,sessionId:n,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(),f.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(),f.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"),f.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"),f.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,i=this.resourceCenterSession.version.resourceCenter?.blocks.find(n=>n.type===N.ANNOUNCEMENTS);return{isOpen:this.resourceCenterOpen,hasChecklist:e,uncompletedChecklistTaskCount:e&&s?Je(s):0,unreadAnnouncementCount:i?.unreadAnnouncementCount||0}}resourceCenterEmbedsChecklist(){const e=this.resourceCenterSession;return!!e&&!!e.version.resourceCenter?.blocks.some(s=>s.type===N.CHECKLIST)}embedChecklistSessions(){return this.embedSessions.some(e=>!!e.version.embed?.blocks?.some(s=>s.type===V.CHECKLIST))}async endFlow(e,{endReason:s,batch:i}){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:n}=e,r={id:n.id,type:n.type.toLowerCase()};n.type===k.CHECKLIST?this.emit("checklistEnded",{checklist:r,endReason:s}):n.type===k.FLOW&&this.emit("flowEnded",{flow:r,endReason:s});const a={kind:"EndFlow",sessionId:e.id,endReason:s};await this.send(a,{batch:i})}async goToStep(e,s){o("goToStep",e.id,s.name||s.id),this.ensureIdentified();const i=this.send({kind:"GoToStep",sessionId:e.id,stepId:s.id});e.currentStep=s,this.emit("gotostep",{session:e,step:s}),await i}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===k.CHECKLIST&&this.endFlow(e,{endReason:C.USERFLOWJS})}setFlowSession(e,s=this.clientClock){const i=this.flowSession;this.flowSession=e,this.flowSessionClock=s,e&&!i&&(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 i=this.checklistSession;this.checklistSession=e,this.checklistSessionClock=s,e===null&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),e&&e.id!==i?.id&&(this.checklistExpanded=!!f.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&&f.removeItem(`resourceCenterOpen:${s.id}`),e&&e.id!==s?.id&&(this.resourceCenterOpen=!!f.getItem(`resourceCenterOpen:${e.id}`)),this.emit("resourceCenterChanged")}launcherSeen(e){this.send({kind:"StartFlow",flowId:e,startReason:m.LAUNCHER_SEEN,once:!1})}activateLauncher(e){const s=this.activeLauncherFlowId&&this.launcherSessions.find(i=>i.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===W.DEACTIVATE?this.dismissLauncher(e,{endReason:C.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(e,{endReason:s}){const i=e.flow.id;this.removeLauncher(i),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:i,endReason:s})}removeLauncher(e){const s=this.launcherSessions.findIndex(i=>i.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?!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 g(async()=>{const{DebuggerUI:s}=await import("./DebuggerUI.js");return{DebuggerUI:s}},__vite__mapDeps([32,1,2,3,18,19,4,5,6,7,17,13,14,15,10,11,12,21,16,33,34,35,36,37,25,29,30]));this.debuggerUI=new e(this,p),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=g(()=>import("./ui.js"),__vite__mapDeps([38,1,2,3,18,19,4,5,6,7,29,30]));this.bannerSession&&Qe(),this.resourceCenterSession&&ze();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 g(async()=>{const{conditionTypes:r}=await import("./flow-condition-types.js").then(a=>a.f);return{conditionTypes:r}},__vite__mapDeps([10,2,11,6,12])),i=s[e.type],n=this.clientConditions.get(e.id);n&&(n.untrack=i.track({sessionData:new D([]),condition:e,callback:r=>{n.isTrue!==r&&(o("client condition truthiness changed",r,n.condition),n.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:i}=await g(async()=>{const{conditionTypes:c}=await import("./flow-condition-types.js").then(l=>l.f);return{conditionTypes:c}},__vite__mapDeps([10,2,11,6,12])),n=this.trackers.get(e.flowId);if(!n)return;const{tracker:r}=n,{condition:a}=r,u=i[a.type];n.untrack&&n.untrack(),n.untrack=u.track({sessionData:new D(r.data),condition:a,flipBackEvents:!0,callback:c=>{const l=n.isTrue;n.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,i="[Userflow Preview] "+e.replace(/\[Userflow Preview\] /,"");e!==i&&(document.title=i)}reportCspIssue(){const e=this.getSessionStorageState();(this.testUserIdentified||e.activeApp)&&!this.cspIssueReported&&(this.cspIssueReported=!0,o("csp issue detected"),L({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 i=s.play();this.audioReady=!0,i&&i.catch(n=>{n.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,i){const r={id:++this.notificationIdCounter,label:e,message:s,type:i};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||{},et());window.userflow=t,window.studio1=t,tt()}function et(){const t=new qe;return{_stubbed:!1,init(e){t.init(e)},identify(e,s={},i={}){return t.identify(e,s,i)},identifyAnonymous(e={},s={}){return t.identifyAnonymous(e,s)},isIdentified(){return t.isIdentified()},updateUser(e,s={}){return t.updateUser(e,s)},group(e,s={},i={}){return t.group(e,s,i)},updateGroup(e,s={}){return t.updateGroup(e,s)},track(e,s={},i={}){return t.track(e,s,i)},start(e,{once:s}={}){return t.startFlow({flowId:e,startReason:m.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&&d.customInputs.push({cssSelector:e})},registerCustomInput(e,s){d.customInputs.push({cssSelector:e,getValue:s})},setCustomNavigate(e){d.customNavigate=e},setUrlFilter(e){d.urlFilter=e},setLinkUrlDecorator(e){d.linkUrlDecorator=e,t.emit("uistatechange")},setInferenceAttributeNames(e){d.inferenceAttributeNames=e},setInferenceAttributeFilter(e,s){d.inferenceAttributeFilters[e]=b(s)},setInferenceClassNameFilter(e){d.inferenceClassNameFilters=b(e)},setScrollPadding(e){d.scrollPadding=e},setCustomScrollIntoView(e){d.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){d.baseZIndex=e},setServerEndpoint(e){d.serverEndpoint=e},disableEvalJs(){d.evalJsDisabled=!0},_setTargetEnv(e){t.setTargetEnv(e)},debugger(){return t.mountDebugger()}}}function tt(){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,i,n]of e){if(typeof t[s]!="function"){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const r=t[s](...n);i&&r&&typeof r.then=="function"&&r.then(i.resolve,i.reject)}o("queue processed")}}var at=window.userflow;export{xe as $,S as A,Qe as B,f as C,Re as D,C as E,ie as F,d as G,be as H,Ce as I,we as J,Le as K,ve as L,Te as M,m as N,$e as O,ge as P,Oe as Q,ze as R,ae as S,ke as T,h as U,me as V,Fe as W,He as X,ye as Y,Me as Z,g as _,k as a,Pe as a0,Be as a1,pe as a2,de as a3,rt as a4,H as a5,Ne as a6,_e as a7,Ee as a8,Ye as a9,X as aa,G as ab,oe as ac,ot as ad,y as ae,Ke as af,te as ag,le as b,ce as c,o as d,at as default,ee as e,re as f,Ve as g,se as h,ue as i,D as j,De as k,Ge as l,ne as m,x as n,Q as o,I as p,Ie as q,Ue as r,Se as s,Ae as t,L as u,he as v,fe as w,Je as x,We as y,N 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:i,flowSessionClock:n,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,T=this.launcherSessions.findIndex(E=>E.flow.id===l.flow.id);T===-1?this.launcherSessions=[...this.launcherSessions,l]:this.launcherSessions=[...this.launcherSessions.slice(0,T),l,...this.launcherSessions.slice(T+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(n>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${n} > serverClock=${s}`);return}i?.id===e.sessionId&&this.emit("gotostep",{session:i,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":n<=s||i?.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=${n} > 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(n>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${n} > serverClock=${s}`);return}i?.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(T=>T.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}default:console.warn("Userflow.js: Received unknown message",e);return}}async identify(e,s={},{signature:i}={}){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=i||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(!I.isSupported())throw new h("userflow.identifyAnonymous() is not supported when localStorage access is denied.");const i="anonymousId";let n=I.getItem(i);n||(n="anon-"+R(),I.setItem(i,n)),await this.identify(n,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:i,membership:n}={}){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=i||null,await this.send({kind:"UpsertGroup",groupExternalId:e,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(s),membershipAttributes:this.normalizeAttributes(n)},{batch:!0})}async updateGroup(e={},s={}){o("updateGroup");const i=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:i,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 i in e){if(!e.hasOwnProperty(i))continue;if(i==="traits"){const r=e[i];Object.assign(s,this.extractLegacyTraits(r));continue}let n=e[i];if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n==null||Array.isArray(n))s[i]=this.normalizeAttributeLiteralOrList(i,n);else{if(typeof n!="object"||n==null)throw new h(`Userflow: Invalid value for '${i}' attribute.`);if("set"in n)s[i]={set:this.normalizeAttributeLiteralOrList(i,n.set),dataType:this.normalizeDataType(i,n.data_type||n.dataType)};else if("set_once"in n||"setOnce"in n)s[i]={setOnce:this.normalizeAttributeLiteralOrList(i,n.set_once??n.setOnce),dataType:this.normalizeDataType(i,n.data_type||n.dataType)};else if("add"in n){const r=n.add;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'add' value for '${i}' attribute. Must be a number or string.`);s[i]={add:r}}else if("subtract"in n){const r=n.subtract;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'subtract' value for '${i}' attribute. Must be a number or string.`);s[i]={subtract:r}}else if("append"in n)s[i]={append:this.normalizeAttributeLiteralOrList(i,n.append)};else if("prepend"in n)s[i]={prepend:this.normalizeAttributeLiteralOrList(i,n.prepend)};else if("remove"in n)s[i]={remove:this.normalizeAttributeLiteralOrList(i,n.remove)};else throw new h(`Userflow: Invalid value for '${i}' attribute.`)}}return s}normalizeAttributeLiteralOrList(e,s){return Array.isArray(s)?s.map(i=>this.normalizeAttributeLiteral(e,i)):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 i in e)e.hasOwnProperty(i)&&s.push({name:i,value:e[i]});e=s}return e.reduce((s,{name:i,value:n,dataType:r})=>{if(typeof i!="string"||i.length>100||!i.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:",i),s;if(typeof n!="string")if(typeof n=="boolean")r||(r="boolean"),n=n?"true":"false";else if(typeof n=="number")r||(r=Number.isInteger(n)?"integer":"decimal"),n=String(n);else return this.warn(`userflow.identify: The value of trait '${i}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,n),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 '${i}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,r),s}return s[i]={set:n,dataType:a},s},{})}async track(e,s={},{userOnly:i}={}){o(`track '${e}'`,s),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!i,name:e,attributes:this.normalizeEventAttributes(s)},{batch:!0})}async trackRawEvent(e){const{name:s,attributes:i}=e;o(`track raw event '${s}'`,i),this.ensureIdentified(),await this.send({kind:"TrackRawEvent",name:s,attributes:this.normalizeEventAttributes(i)})}normalizeEventAttributes(e){const s=this.normalizeAttributes(e);for(const i in s){if(!s.hasOwnProperty(i))continue;const n=s[i];if(!(n==null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||Array.isArray(n)||"set"in n))throw new h(`Userflow: Invalid value for '${i}' 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(H()),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:m.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:R(),page_title:document.title,...this.buildClientContext()}})}buildClientContext(){return{pageUrl:Ye(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}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 i=this.listeners.get(e);i||(i=new Set,this.listeners.set(e,i)),i.add(s)}off(e,s){const i=this.listeners.get(e);i&&i.delete(s)}emit(e,...s){const i=this.listeners.get(e);i&&Array.from(i).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,I.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:i,once:n,batch:r,replaceCurrent:a}){if(this.ensureIdentified(),a&&this.flowSession&&this.endFlow(this.flowSession,{endReason:C.REPLACED,batch:!0}),o(`startFlow ${e}`,{startReason:i}),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:i,once:!!n};await this.send(u,{batch:r})}async trackButtonEvent(e,s,i,n){const r={kind:"TrackButtonEvent",eventName:e,stepCvid:i,sessionId:n,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(),f.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(),f.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"),f.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"),f.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,i=this.resourceCenterSession.version.resourceCenter?.blocks.find(n=>n.type===N.ANNOUNCEMENTS);return{isOpen:this.resourceCenterOpen,hasChecklist:e,uncompletedChecklistTaskCount:e&&s?Je(s):0,unreadAnnouncementCount:i?.unreadAnnouncementCount||0}}resourceCenterEmbedsChecklist(){const e=this.resourceCenterSession;return!!e&&!!e.version.resourceCenter?.blocks.some(s=>s.type===N.CHECKLIST)}embedChecklistSessions(){return this.embedSessions.some(e=>!!e.version.embed?.blocks?.some(s=>s.type===V.CHECKLIST))}async endFlow(e,{endReason:s,batch:i}){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:n}=e,r={id:n.id,type:n.type.toLowerCase()};n.type===k.CHECKLIST?this.emit("checklistEnded",{checklist:r,endReason:s}):n.type===k.FLOW&&this.emit("flowEnded",{flow:r,endReason:s});const a={kind:"EndFlow",sessionId:e.id,endReason:s};await this.send(a,{batch:i})}async goToStep(e,s){o("goToStep",e.id,s.name||s.id),this.ensureIdentified();const i=this.send({kind:"GoToStep",sessionId:e.id,stepId:s.id});e.currentStep=s,this.emit("gotostep",{session:e,step:s}),await i}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===k.CHECKLIST&&this.endFlow(e,{endReason:C.USERFLOWJS})}setFlowSession(e,s=this.clientClock){const i=this.flowSession;this.flowSession=e,this.flowSessionClock=s,e&&!i&&(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 i=this.checklistSession;this.checklistSession=e,this.checklistSessionClock=s,e===null&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),e&&e.id!==i?.id&&(this.checklistExpanded=!!f.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&&f.removeItem(`resourceCenterOpen:${s.id}`),e&&e.id!==s?.id&&(this.resourceCenterOpen=!!f.getItem(`resourceCenterOpen:${e.id}`)),this.emit("resourceCenterChanged")}launcherSeen(e){this.send({kind:"StartFlow",flowId:e,startReason:m.LAUNCHER_SEEN,once:!1})}activateLauncher(e){const s=this.activeLauncherFlowId&&this.launcherSessions.find(i=>i.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===W.DEACTIVATE?this.dismissLauncher(e,{endReason:C.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(e,{endReason:s}){const i=e.flow.id;this.removeLauncher(i),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:i,endReason:s})}removeLauncher(e){const s=this.launcherSessions.findIndex(i=>i.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?!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 g(async()=>{const{DebuggerUI:s}=await import("./DebuggerUI.js");return{DebuggerUI:s}},__vite__mapDeps([32,1,2,3,18,19,4,5,6,7,17,13,14,15,10,11,12,21,16,33,34,35,36,37,25,29,30]));this.debuggerUI=new e(this,p),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=g(()=>import("./ui.js"),__vite__mapDeps([38,1,2,3,18,19,4,5,6,7,29,30]));this.bannerSession&&Qe(),this.resourceCenterSession&&ze();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 g(async()=>{const{conditionTypes:r}=await import("./flow-condition-types.js").then(a=>a.f);return{conditionTypes:r}},__vite__mapDeps([10,2,11,6,12])),i=s[e.type],n=this.clientConditions.get(e.id);n&&(n.untrack=i.track({sessionData:new D([]),condition:e,callback:r=>{n.isTrue!==r&&(o("client condition truthiness changed",r,n.condition),n.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:i}=await g(async()=>{const{conditionTypes:c}=await import("./flow-condition-types.js").then(l=>l.f);return{conditionTypes:c}},__vite__mapDeps([10,2,11,6,12])),n=this.trackers.get(e.flowId);if(!n)return;const{tracker:r}=n,{condition:a}=r,u=i[a.type];n.untrack&&n.untrack(),n.untrack=u.track({sessionData:new D(r.data),condition:a,flipBackEvents:!0,callback:c=>{const l=n.isTrue;n.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,i="[Userflow Preview] "+e.replace(/\[Userflow Preview\] /,"");e!==i&&(document.title=i)}reportCspIssue(){const e=this.getSessionStorageState();(this.testUserIdentified||e.activeApp)&&!this.cspIssueReported&&(this.cspIssueReported=!0,o("csp issue detected"),L({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 i=s.play();this.audioReady=!0,i&&i.catch(n=>{n.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,i){const r={id:++this.notificationIdCounter,label:e,message:s,type:i};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||{},et());window.userflow=t,window.studio1=t,tt()}function et(){const t=new qe;return{_stubbed:!1,init(e){t.init(e)},identify(e,s={},i={}){return t.identify(e,s,i)},identifyAnonymous(e={},s={}){return t.identifyAnonymous(e,s)},isIdentified(){return t.isIdentified()},updateUser(e,s={}){return t.updateUser(e,s)},group(e,s={},i={}){return t.group(e,s,i)},updateGroup(e,s={}){return t.updateGroup(e,s)},track(e,s={},i={}){return t.track(e,s,i)},start(e,{once:s}={}){return t.startFlow({flowId:e,startReason:m.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&&d.customInputs.push({cssSelector:e})},registerCustomInput(e,s){d.customInputs.push({cssSelector:e,getValue:s})},setCustomNavigate(e){d.customNavigate=e},setUrlFilter(e){d.urlFilter=e},setLinkUrlDecorator(e){d.linkUrlDecorator=e,t.emit("uistatechange")},setInferenceAttributeNames(e){d.inferenceAttributeNames=e},setInferenceAttributeFilter(e,s){d.inferenceAttributeFilters[e]=b(s)},setInferenceClassNameFilter(e){d.inferenceClassNameFilters=b(e)},setScrollPadding(e){d.scrollPadding=e},setCustomScrollIntoView(e){d.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){d.baseZIndex=e},setServerEndpoint(e){d.serverEndpoint=e},disableEvalJs(){d.evalJsDisabled=!0},_setTargetEnv(e){t.setTargetEnv(e)},debugger(){return t.mountDebugger()}}}function tt(){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,i,n]of e){if(typeof t[s]!="function"){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const r=t[s](...n);i&&r&&typeof r.then=="function"&&r.then(i.resolve,i.reject)}o("queue processed")}}var at=window.userflow;export{xe as $,S as A,Qe as B,f as C,Re as D,C as E,ie as F,d as G,be as H,Ce as I,we as J,Le as K,ve as L,Te as M,m as N,$e as O,ge as P,Oe as Q,ze as R,ae as S,ke as T,h as U,me as V,Fe as W,He as X,ye as Y,Me as Z,g as _,k as a,Pe as a0,Be as a1,pe as a2,de as a3,rt as a4,H as a5,Ne as a6,_e as a7,Ee as a8,Ye as a9,X as aa,G as ab,oe as ac,ot as ad,y as ae,Ke as af,te as ag,le as b,ce as c,o as d,at as default,ee as e,re as f,Ve as g,se as h,ue as i,D as j,De as k,Ge as l,ne as m,x as n,Q as o,I as p,Ie as q,Ue as r,Se as s,Ae as t,L as u,he as v,fe as w,Je as x,We as y,N 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]="a32f2ec7-973a-45ad-a0ad-7ec43bde0768",r._sentryDebugIdIdentifier="sentry-dbid-a32f2ec7-973a-45ad-a0ad-7ec43bde0768")}catch{}})();var Ze=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};Ze.SENTRY_RELEASE={id:"686be74eabe71d11b16d2c404a01d29d94e6ea74"};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]="7fdb4063-fb47-407a-9f81-c0cb28f12820",r._sentryDebugIdIdentifier="sentry-dbid-7fdb4063-fb47-407a-9f81-c0cb28f12820")}catch{}})();var Ze=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};Ze.SENTRY_RELEASE={id:"cae2038749c77b8be9f06c7be5f705078c125e2b"};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 $e=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}},de=Or,pe=Function.prototype,sr=pe.call,nt=de&&pe.bind.bind(sr,sr),b=de?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,$t=he,Er=function(r){return yt($t(r))},X=typeof document=="object"&&document.all,$=typeof X>"u"&&X!==void 0?function(r){return typeof r=="function"||r===X}:function(r){return typeof r=="function"},dt=$,_=function(r){return typeof r=="object"?r!==null:dt(r)},Z=f,pt=$,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,d,W;Br&&(d=Br.split("."),W=d[0]>0&&d[0]<4?1:+(d[0]+d[1]));!W&&Q&&(d=Q.match(/Edge\/(\d+)/),(!d||d[1]>=74)&&(d=Q.match(/Chrome\/(\d+)/),d&&(W=+d[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=$,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=$,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=$,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),$n=function(r){return yn?yr.createElement(r):{}},dn=g,pn=h,bn=$n,Ne=!dn&&!pn(function(){return Object.defineProperty(bn("div"),"a",{get:function(){return 7}}).a!==7}),hn=g,gn=O,On=fe,Sn=$e,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=$e,_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:{}},$r=g,Gn=S,Me=Function.prototype,xn=$r&&Object.getOwnPropertyDescriptor,Rr=Gn(Me,"name"),Kn=Rr&&function(){}.name==="something",Vn=Rr&&(!$r||$r&&xn(Me,"name").configurable),kn={EXISTS:Rr,PROPER:Kn,CONFIGURABLE:Vn},Wn=b,zn=$,dr=mr,Yn=Wn(Function.toString);zn(dr.inspectSource)||(dr.inspectSource=function(r){return Yn(r)});var Ae=dr.inspectSource,qn=f,Jn=$,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=$,U=S,br=g,fa=kn.CONFIGURABLE,sa=Ae,Le=ua,ya=Le.enforce,$a=Le.get,Zr=String,K=Object.defineProperty,da=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){da(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)&&$a(this).source||sa(this)},"toString");var Sa=De.exports,Ea=$,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=$,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=$,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,$i=Tr,di=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($i(r)+" is not iterable");if(di(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=$,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
|