userflow.js-self-hosted 0.1.1016424 → 0.1.1016426

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.
@@ -803,3 +803,125 @@ body {
803
803
  align-items: center;
804
804
  color: #fff;
805
805
  }
806
+ .userflowjs-smart-flow-layout {
807
+ display: flex;
808
+ align-items: center;
809
+ justify-content: space-between;
810
+ width: 100%;
811
+ }
812
+ .userflowjs-smart-flow-title {
813
+ display: flex;
814
+ align-items: center;
815
+ gap: 0.75rem;
816
+ color: #fff;
817
+ font-size: 14px;
818
+ font-weight: 500;
819
+ }
820
+ .userflowjs-smart-flow-status-container {
821
+ display: flex;
822
+ align-items: center;
823
+ justify-content: center;
824
+ min-width: 0;
825
+ flex: 1 1 0%;
826
+ }
827
+ .userflowjs-smart-flow-status {
828
+ background: #0a1a24;
829
+ border-radius: 48px;
830
+ padding: 0.5rem 0.75rem;
831
+ display: flex;
832
+ align-items: center;
833
+ gap: 0.5rem;
834
+ min-width: 480px;
835
+ justify-content: space-between;
836
+ }
837
+ .userflowjs-smart-flow-recording {
838
+ display: flex;
839
+ align-items: center;
840
+ gap: 0.5rem;
841
+ }
842
+ .userflowjs-smart-flow-pulse-dot {
843
+ width: 16px;
844
+ height: 16px;
845
+ background: #fe3960;
846
+ border-radius: 50%;
847
+ animation: userflowjs-pulse 2s infinite;
848
+ }
849
+ .userflowjs-smart-flow-text {
850
+ color: #fff;
851
+ font-size: 14px;
852
+ }
853
+ .userflowjs-smart-flow-text--bold {
854
+ color: #fff;
855
+ font-weight: 600;
856
+ }
857
+ .userflowjs-smart-flow-text--gray {
858
+ color: #5d7f92;
859
+ }
860
+ .userflowjs-smart-flow-start-over {
861
+ background: none;
862
+ border: none;
863
+ color: #2f69ee;
864
+ font-size: 14px;
865
+ cursor: pointer;
866
+ display: flex;
867
+ align-items: center;
868
+ gap: 0.25rem;
869
+ padding: 0;
870
+ transition: color 200ms cubic-bezier(0.25, 0.8, 0.5, 1);
871
+ }
872
+ .userflowjs-smart-flow-start-over:hover {
873
+ color: #1a57e6;
874
+ }
875
+ .userflowjs-smart-flow-placeholder-canvas {
876
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
877
+ color: #fff;
878
+ font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
879
+ text-align: center;
880
+ display: flex;
881
+ flex-direction: column;
882
+ align-items: center;
883
+ justify-content: center;
884
+ }
885
+ .userflowjs-smart-flow-recording-status {
886
+ display: flex;
887
+ align-items: center;
888
+ gap: 0.5rem;
889
+ }
890
+ .userflowjs-smart-flow-error-capture {
891
+ background: rgba(254,57,96,0.1);
892
+ border: 1px solid rgba(254,57,96,0.3);
893
+ border-radius: 0.25rem;
894
+ padding: 0.75rem;
895
+ }
896
+ @-moz-keyframes userflowjs-pulse {
897
+ 0%, 100% {
898
+ opacity: 1;
899
+ }
900
+ 50% {
901
+ opacity: 0.5;
902
+ }
903
+ }
904
+ @-webkit-keyframes userflowjs-pulse {
905
+ 0%, 100% {
906
+ opacity: 1;
907
+ }
908
+ 50% {
909
+ opacity: 0.5;
910
+ }
911
+ }
912
+ @-o-keyframes userflowjs-pulse {
913
+ 0%, 100% {
914
+ opacity: 1;
915
+ }
916
+ 50% {
917
+ opacity: 0.5;
918
+ }
919
+ }
920
+ @keyframes userflowjs-pulse {
921
+ 0%, 100% {
922
+ opacity: 1;
923
+ }
924
+ 50% {
925
+ opacity: 0.5;
926
+ }
927
+ }
@@ -1,2 +1,2 @@
1
- import{f as c,h as w,a5 as k,a6 as z,a7 as K,a8 as L}from"./userflow.js";import"./vendor.core-js.js";import{i as S,b as I,c as X,a as B,d as P,s as Y}from"./vendor.date-fns.js";import{M as Z,o as H,f as U,v as F,w as q}from"./roots.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e959b0b1-a229-4050-ad08-2e8cfe5b5e4c",e._sentryDebugIdIdentifier="sentry-dbid-e959b0b1-a229-4050-ad08-2e8cfe5b5e4c")}catch{}})();const Q=/(\\*)\{\{([a-zA-Z0-9_.\\/]+)\}\}/g;function J(e,t){return(e||"").replace(Q,(r,n,s)=>{const a=n.length;return a%2===0?"\\".repeat(a/2)+(t(s)||""):"\\".repeat((a-1)/2)+"{{"+s+"}}"})}function ee(e){let t=null;return r=>(t||(t=new Map,e.forEach(({name:n,value:s})=>t.set(n,Array.isArray(s)?s[0]:s))),t.get(r)||null)}function g(e,t){const r=ee(t);return J(e,n=>r(n))}function x(e,t){const r=M(e,t),n=e.nearSelector&&M(e.nearSelector,t);return e===r&&e.nearSelector===n?e:e.nearSelector===n?r:{...r,nearSelector:n}}function M(e,t){if(!e.text)return e;const r=g(e.text,t);return r===e.text?e:{...e,text:r}}function te(e,t){return e.includes.length===0&&e.excludes.length===0?!1:(e.includes.length===0||e.includes.some(r=>{const n=V(r);return n&&t.match(n)}))&&!e.excludes.some(r=>{const n=V(r);return n&&t.match(n)})}function re(e){const t=e.match(/^(([a-z\d]+):\/\/)?([^/?#]+)?(\/[^?#]*)?(\?([^#]*))?(#.*)?$/i);if(!t)return null;const[,,r,n,s,,a,i]=t;return{scheme:r||"",domain:n||"",path:s||"",query:a||"",fragment:i||""}}function V(e){const t=re(e);if(!t)return console.error("Userflow: Invalid URL pattern:",e),null;const{scheme:r,domain:n,path:s,query:a,fragment:i}=t;let l;r?l=O(r):l="[a-z\\d]+";let f;n?f=A(n,"[^/]","."):f="[^/]*";const o="(:\\d+)?";let p;s?p=A(s,"[^?#]","/"):p="/[^?#]*";let E;a?(E="",new URLSearchParams(a).forEach((d,T)=>{let b;d===""?b="=?":d==="*"?b="(=[^&#]*)?":(d=d.split(/\*/g).map($=>encodeURI($)).join("*"),b="="+A(d,"[^#]")),E+="(?=.*[?&]"+O(T)+b+"([&#]|$))"}),E+="\\?[^#]*"):E="(\\?[^#]*)?";let m;return i?m=A(i,".","/"):m="(#.*)?",new RegExp("^"+l+"://"+f+o+p+E+m+"$")}function A(e,t,r){return e=O(e),e=e.replace(/\\\*/g,t+"*"),r&&(e=e.replace(/:[a-zA-Z0-9_]+/g,"[^"+r+"]+")),e}function O(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}const y={[c.ABSOLUTE_EQ]:{compare:({condition:e,value:t})=>{const r=h(t),n=D(e.value,"00:00:00.000"),s=D(e.value,"23:59:59.999");return r!=null&&n!=null&&s!=null&&!S(r,n)&&!I(r,s)}},[c.ABSOLUTE_GT]:{compare:({condition:e,value:t})=>{const r=h(t),n=D(e.value,"23:59:59.999");return r!=null&&n!=null&&I(r,n)}},[c.ABSOLUTE_LT]:{compare:({condition:e,value:t})=>{const r=h(t),n=D(e.value,"00:00:00.000");return r!=null&&n!=null&&S(r,n)}},[c.AND]:{compare:()=>W("AND.compare")},[c.BETWEEN]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&!!e.value2&&parseFloat(v(t))>=parseFloat(e.value)&&parseFloat(v(t))<=parseFloat(e.value2)},[c.CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.EMPTY]:{compare:({value:e})=>e==null||e===""||Array.isArray(e)&&e.length===0},[c.ENDS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().endsWith(g(t.value||"",e).toLowerCase())},[c.EQ]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)===v(r)},[c.EXCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return!(e.values||[]).some(n=>r.has(n))}},[c.EXCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return!(e.values||[]).every(n=>r.has(n))}},[c.FALSE]:{compare:({value:e})=>v(e).toLowerCase()==="false"},[c.GT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>parseFloat(e.value)},[c.GTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>=parseFloat(e.value)},[c.INCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return(e.values||[]).every(n=>r.has(n))}},[c.INCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return(e.values||[]).some(n=>r.has(n))}},[c.LT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<parseFloat(e.value)},[c.LTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<=parseFloat(e.value)},[c.NE]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)!==v(r)},[c.NOT_CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!r||!v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.NOT_EMPTY]:{compare:({value:e})=>e!=null&&e!==""&&(!Array.isArray(e)||e.length>0)},[c.NOT_REGEX]:{compare:({condition:e,value:t})=>!j(e,t)},[c.OR]:{compare:()=>W("OR.compare")},[c.REGEX]:{compare:({condition:e,value:t})=>j(e,t)},[c.RELATIVE_EQ]:{compare:({condition:e,value:t})=>{const r=h(t),n=_(e.value);return r==null||n==null?!1:!S(r,n)&&S(r,X(n,1))}},[c.RELATIVE_GT]:{compare:({condition:e,value:t})=>{const r=h(t),n=_(e.value);return r==null||n==null?!1:I(r,n)}},[c.RELATIVE_LT]:{compare:({condition:e,value:t})=>{const r=h(t),n=_(e.value);return r==null||n==null?!1:S(r,n)}},[c.STARTS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().startsWith(g(t.value||"",e).toLowerCase())},[c.TRUE]:{compare:({value:e})=>v(e).toLowerCase()==="true"},[c.URL]:{compare:({condition:e,value:t})=>e.urlPattern&&t!=null?te(e.urlPattern,v(t)):!1}};function W(e){throw new Error(`conditionOperators.${e} is not supported`)}function h(e){if(Array.isArray(e)&&(e=e[0]),!e)return null;e.match(/(Z|((\+|-)\d\d:\d\d))$/i)||(e+="Z");const t=B(e);return P(t)?t:null}function D(e,t){if(!e)return null;e+="T"+t+"Z";const r=B(e);return P(r)?r:null}function _(e){if(!e)return null;const t=parseInt(e,10);return isNaN(t)?null:Y(Date.now(),t)}function j(e,t){return e.value?new RegExp(e.value).test(v(t)):!1}function v(e){return Array.isArray(e)?e[0]:e??""}function N(e){return Array.isArray(e)?e:e===""||e==null?[]:[e]}const ne=50,se=1e3;function R(e,t={}){let r,n;const s=()=>{n=void 0,e()},a=()=>{if(window.clearTimeout(r),n==null)n=Date.now();else if(Date.now()-n>se){s();return}r=window.setTimeout(s,ne)},i=o=>{const p=o.target;if(!p||!G(p))return;const E=document.getElementById("userflow-ui");E&&E.contains(p)||a()},l=new Z(o=>{ae(o)||a()}),f=H(o=>{l.observe(o,{attributes:!0,subtree:!0,childList:!0,characterData:!0}),o.addEventListener("animationend",i),o.addEventListener("transitionend",i),t.observeInput&&(o.addEventListener("input",a),o.addEventListener("keypress",a),o.addEventListener("change",a))},o=>{o.removeEventListener("animationend",i),o.removeEventListener("transitionend",i),t.observeInput&&(o.removeEventListener("input",a),o.removeEventListener("keypress",a),o.removeEventListener("change",a))});return{disconnect:()=>{window.clearTimeout(r),l.disconnect(),f()}}}function ae(e){const t=document.getElementById("userflow-ui");for(const r of e){const{target:n}=r;if(G(n)&&t&&t.contains(n))return!0}return!1}function G(e){return e.nodeType===Node.ELEMENT_NODE}const C={[w.ALWAYS_TRUE]:{track:({callback:e})=>(e(!0),()=>{})},[w.ATTRIBUTE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let a=!1;if(e&&t.operator){const i=e.value.find(o=>o.name===t.attributeName),l=i?i.value:null;a=y[t.operator].compare({sessionData:e.value,condition:t,value:l})}r(a)};n();const s=e.observe(n);return()=>{s()}}},[w.CLAUSE]:{isExpensive:e=>{for(const t of e.conditions){const r=C[t.type];if(r.isExpensive&&r.isExpensive(t))return!0}return!1},track:({sessionData:e,condition:t,flipBackEvents:r,callback:n,description:s})=>{let a,i,l=null;const f=t.conditions.map(m=>{const u=C[m.type];return{condition:m,typeDef:u,expensive:!!u.isExpensive&&u.isExpensive(m),active:!1,isTrue:null}}),o=m=>{for(const u of f){const d=!r||!u.expensive||m;d&&!u.active?(u.active=!0,u.isTrue=!1,u.untrack=u.typeDef.track({sessionData:e,condition:u.condition,flipBackEvents:r,callback:(T,b={})=>{u.isTrue=T,window.clearTimeout(a),b.immediate?p({immediate:!0}):a=window.setTimeout(p,0)},description:s})):!d&&u.active&&(u.untrack&&u.untrack(),u.active=!1,u.isTrue=null,u.untrack=void 0)}},p=(m={})=>{if(f.length===0){E(!1,m);return}let u,d;if(t.operator===c.AND){u=!0,d=!0;for(const T of f)T.isTrue===!1?(u=!1,T.expensive||(d=!1)):u!==!1&&T.isTrue===null&&(u=null)}else{u=!1,d=!0;for(const T of f)T.isTrue===!0?(u=!0,T.expensive||(d=!1)):u!==!0&&T.isTrue===null&&(u=null)}u!==null&&u!==l&&(l=u,E(u,m)),o(d)},E=(m,u)=>{if(!m||t.waitTime==null||t.waitTime=="0")window.clearTimeout(i),i=void 0,n(m,u);else if(!i){const d=parseFloat(t.waitTime)*1e3;i=window.setTimeout(()=>{n(!0,{})},d)}};return o(!1),p(),()=>{window.clearTimeout(a),window.clearTimeout(i);for(const m of f)m.untrack&&m.untrack()}}},[w.ELEMENT]:{isExpensive:()=>!0,track:e=>{const{elementState:t}=e.condition;if(!t)return()=>{};const r=oe(t);switch(r.kind){case"observer":return le(e,r.checkElement);case"event":return ue(e,r.eventName,r.valueWhenOccurred)}}},[w.FILLED_IN_INPUT]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{let n=null,s;const a=()=>{if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}const f=U(x(t.selector,e.value));let o=null;for(const p of f){const E=F(p);if(E){o=E;break}}o?o!=n&&(window.clearTimeout(s),s=window.setTimeout(()=>{r(!0)},1e3)):(r(!1),window.clearTimeout(s)),n=o};a();const i=e.observe(a),{disconnect:l}=R(a,{observeInput:!0});return()=>{i(),l(),window.clearTimeout(s)}}},[w.FLOW]:{track:()=>(console.warn("Userflow.js: Flow conditions do not work client-side"),()=>{})},[w.INPUT_VALUE]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{if(!t.operator){console.warn("Userflow.js: INPUT_VALUE condition missing operator",t);return}if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}let i=!1;const l=y[t.operator],f=U(x(t.selector,e.value));if(f.length>0)for(const o of f){const p=F(o);if(l.compare({sessionData:e.value,condition:t,value:p})){i=!0;break}}else l.compare({sessionData:e.value,condition:t,value:""})&&(i=!0);r(i)};n();const s=e.observe(n),{disconnect:a}=R(n,{observeInput:!0});return()=>{s(),a()}}},[w.PAGE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let l=!1;if(t.operator){const f=k();l=y[t.operator].compare({sessionData:e.value,condition:t,value:f})}r(l)};let s=k();const a=()=>{const l=k();l!==s&&(s=l,n())};z(a),n();const i=e.observe(n);return()=>{i(),K(a)}}},[w.SEGMENT]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Segment conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[w.CHECKLIST_TASK_CLICKED]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Checklist conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[w.EVENT]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Event conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[w.TIME]:{track:({condition:e,callback:t})=>{let r=null;const n=e.value?new Date(e.value):null,s=e.value2?new Date(e.value2):null,a=()=>{let l=!0;(n&&!isNaN(n.valueOf())&&Date.now()<n.valueOf()||s&&!isNaN(s.valueOf())&&Date.now()>=s.valueOf())&&(l=!1),l!==r&&(r=l,t(l))};a();const i=window.setInterval(a,10*1e3);return()=>{window.clearInterval(i)}}}};function oe(e){switch(e){case L.CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!0};case L.DISABLED:return{kind:"observer",checkElement:t=>!!t&&t.disabled};case L.MOUSEDOWN:return{kind:"event",eventName:"mousedown",valueWhenOccurred:!0};case L.NOT_CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!1};case L.NOT_DISABLED:return{kind:"observer",checkElement:t=>!!t&&!t.disabled};case L.NOT_PRESENT:return{kind:"observer",checkElement:t=>!t};case L.PRESENT:return{kind:"observer",checkElement:t=>!!t}}}function le({sessionData:e,condition:t,callback:r},n){const s=()=>{if(!t.elementState){console.warn("Userflow.js: ELEMENT_STATE condition missing elementState",t);return}if(!t.selector){console.warn("Userflow.js: ELEMENT_STATE condition missing selector",t);return}let l=!1;const f=U(x(t.selector,e.value));if(f.length>0){for(const o of f)if(n(o)){l=!0;break}}else n(null)&&(l=!0);r(l)};s();const a=e.observe(s),{disconnect:i}=R(s);return()=>{a(),i()}}function ue({condition:e,flipBackEvents:t,callback:r},n,s){const{selector:a}=e;if(!a)return()=>{};r(!s);const i=o=>{const p=o.target;p&&q(p,a)&&(t?(r(s,{immediate:!0}),r(!s,{immediate:!0})):r(s))},l={capture:!0},f=H(o=>o.addEventListener(n,i,l),o=>o.removeEventListener(n,i,l));return()=>{f()}}const me=Object.freeze(Object.defineProperty({__proto__:null,conditionTypes:C},Symbol.toStringTag,{value:"Module"}));export{g as a,J as b,C as c,me as f,ee as g,x as i,R as o};
1
+ import{f as c,h as w,a8 as k,a9 as z,aa as K,ab as L}from"./userflow.js";import"./vendor.core-js.js";import{i as S,b as I,c as X,a as B,d as P,s as Y}from"./vendor.date-fns.js";import{M as Z,o as H,f as x,w as F,x as q}from"./roots.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="36e51ade-f153-441e-9e5a-e54e9b398483",e._sentryDebugIdIdentifier="sentry-dbid-36e51ade-f153-441e-9e5a-e54e9b398483")}catch{}})();const Q=/(\\*)\{\{([a-zA-Z0-9_.\\/]+)\}\}/g;function J(e,t){return(e||"").replace(Q,(r,n,s)=>{const a=n.length;return a%2===0?"\\".repeat(a/2)+(t(s)||""):"\\".repeat((a-1)/2)+"{{"+s+"}}"})}function ee(e){let t=null;return r=>(t||(t=new Map,e.forEach(({name:n,value:s})=>t.set(n,Array.isArray(s)?s[0]:s))),t.get(r)||null)}function g(e,t){const r=ee(t);return J(e,n=>r(n))}function U(e,t){const r=M(e,t),n=e.nearSelector&&M(e.nearSelector,t);return e===r&&e.nearSelector===n?e:e.nearSelector===n?r:{...r,nearSelector:n}}function M(e,t){if(!e.text)return e;const r=g(e.text,t);return r===e.text?e:{...e,text:r}}function te(e,t){return e.includes.length===0&&e.excludes.length===0?!1:(e.includes.length===0||e.includes.some(r=>{const n=V(r);return n&&t.match(n)}))&&!e.excludes.some(r=>{const n=V(r);return n&&t.match(n)})}function re(e){const t=e.match(/^(([a-z\d]+):\/\/)?([^/?#]+)?(\/[^?#]*)?(\?([^#]*))?(#.*)?$/i);if(!t)return null;const[,,r,n,s,,a,i]=t;return{scheme:r||"",domain:n||"",path:s||"",query:a||"",fragment:i||""}}function V(e){const t=re(e);if(!t)return console.error("Userflow: Invalid URL pattern:",e),null;const{scheme:r,domain:n,path:s,query:a,fragment:i}=t;let l;r?l=O(r):l="[a-z\\d]+";let f;n?f=A(n,"[^/]","."):f="[^/]*";const o="(:\\d+)?";let p;s?p=A(s,"[^?#]","/"):p="/[^?#]*";let E;a?(E="",new URLSearchParams(a).forEach((d,T)=>{let h;d===""?h="=?":d==="*"?h="(=[^&#]*)?":(d=d.split(/\*/g).map($=>encodeURI($)).join("*"),h="="+A(d,"[^#]")),E+="(?=.*[?&]"+O(T)+h+"([&#]|$))"}),E+="\\?[^#]*"):E="(\\?[^#]*)?";let m;return i?m=A(i,".","/"):m="(#.*)?",new RegExp("^"+l+"://"+f+o+p+E+m+"$")}function A(e,t,r){return e=O(e),e=e.replace(/\\\*/g,t+"*"),r&&(e=e.replace(/:[a-zA-Z0-9_]+/g,"[^"+r+"]+")),e}function O(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}const y={[c.ABSOLUTE_EQ]:{compare:({condition:e,value:t})=>{const r=b(t),n=D(e.value,"00:00:00.000"),s=D(e.value,"23:59:59.999");return r!=null&&n!=null&&s!=null&&!S(r,n)&&!I(r,s)}},[c.ABSOLUTE_GT]:{compare:({condition:e,value:t})=>{const r=b(t),n=D(e.value,"23:59:59.999");return r!=null&&n!=null&&I(r,n)}},[c.ABSOLUTE_LT]:{compare:({condition:e,value:t})=>{const r=b(t),n=D(e.value,"00:00:00.000");return r!=null&&n!=null&&S(r,n)}},[c.AND]:{compare:()=>W("AND.compare")},[c.BETWEEN]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&!!e.value2&&parseFloat(v(t))>=parseFloat(e.value)&&parseFloat(v(t))<=parseFloat(e.value2)},[c.CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.EMPTY]:{compare:({value:e})=>e==null||e===""||Array.isArray(e)&&e.length===0},[c.ENDS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().endsWith(g(t.value||"",e).toLowerCase())},[c.EQ]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)===v(r)},[c.EXCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return!(e.values||[]).some(n=>r.has(n))}},[c.EXCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return!(e.values||[]).every(n=>r.has(n))}},[c.FALSE]:{compare:({value:e})=>v(e).toLowerCase()==="false"},[c.GT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>parseFloat(e.value)},[c.GTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>=parseFloat(e.value)},[c.INCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return(e.values||[]).every(n=>r.has(n))}},[c.INCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(N(t));return(e.values||[]).some(n=>r.has(n))}},[c.LT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<parseFloat(e.value)},[c.LTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<=parseFloat(e.value)},[c.NE]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)!==v(r)},[c.NOT_CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!r||!v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.NOT_EMPTY]:{compare:({value:e})=>e!=null&&e!==""&&(!Array.isArray(e)||e.length>0)},[c.NOT_REGEX]:{compare:({condition:e,value:t})=>!j(e,t)},[c.OR]:{compare:()=>W("OR.compare")},[c.REGEX]:{compare:({condition:e,value:t})=>j(e,t)},[c.RELATIVE_EQ]:{compare:({condition:e,value:t})=>{const r=b(t),n=_(e.value);return r==null||n==null?!1:!S(r,n)&&S(r,X(n,1))}},[c.RELATIVE_GT]:{compare:({condition:e,value:t})=>{const r=b(t),n=_(e.value);return r==null||n==null?!1:I(r,n)}},[c.RELATIVE_LT]:{compare:({condition:e,value:t})=>{const r=b(t),n=_(e.value);return r==null||n==null?!1:S(r,n)}},[c.STARTS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().startsWith(g(t.value||"",e).toLowerCase())},[c.TRUE]:{compare:({value:e})=>v(e).toLowerCase()==="true"},[c.URL]:{compare:({condition:e,value:t})=>e.urlPattern&&t!=null?te(e.urlPattern,v(t)):!1}};function W(e){throw new Error(`conditionOperators.${e} is not supported`)}function b(e){if(Array.isArray(e)&&(e=e[0]),!e)return null;e.match(/(Z|((\+|-)\d\d:\d\d))$/i)||(e+="Z");const t=B(e);return P(t)?t:null}function D(e,t){if(!e)return null;e+="T"+t+"Z";const r=B(e);return P(r)?r:null}function _(e){if(!e)return null;const t=parseInt(e,10);return isNaN(t)?null:Y(Date.now(),t)}function j(e,t){return e.value?new RegExp(e.value).test(v(t)):!1}function v(e){return Array.isArray(e)?e[0]:e??""}function N(e){return Array.isArray(e)?e:e===""||e==null?[]:[e]}const ne=50,se=1e3;function R(e,t={}){let r,n;const s=()=>{n=void 0,e()},a=()=>{if(window.clearTimeout(r),n==null)n=Date.now();else if(Date.now()-n>se){s();return}r=window.setTimeout(s,ne)},i=o=>{const p=o.target;if(!p||!G(p))return;const E=document.getElementById("userflow-ui");E&&E.contains(p)||a()},l=new Z(o=>{ae(o)||a()}),f=H(o=>{l.observe(o,{attributes:!0,subtree:!0,childList:!0,characterData:!0}),o.addEventListener("animationend",i),o.addEventListener("transitionend",i),t.observeInput&&(o.addEventListener("input",a),o.addEventListener("keypress",a),o.addEventListener("change",a))},o=>{o.removeEventListener("animationend",i),o.removeEventListener("transitionend",i),t.observeInput&&(o.removeEventListener("input",a),o.removeEventListener("keypress",a),o.removeEventListener("change",a))});return{disconnect:()=>{window.clearTimeout(r),l.disconnect(),f()}}}function ae(e){const t=document.getElementById("userflow-ui");for(const r of e){const{target:n}=r;if(G(n)&&t&&t.contains(n))return!0}return!1}function G(e){return e.nodeType===Node.ELEMENT_NODE}const C={[w.ALWAYS_TRUE]:{track:({callback:e})=>(e(!0),()=>{})},[w.ATTRIBUTE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let a=!1;if(e&&t.operator){const i=e.value.find(o=>o.name===t.attributeName),l=i?i.value:null;a=y[t.operator].compare({sessionData:e.value,condition:t,value:l})}r(a)};n();const s=e.observe(n);return()=>{s()}}},[w.CLAUSE]:{isExpensive:e=>{for(const t of e.conditions){const r=C[t.type];if(r.isExpensive&&r.isExpensive(t))return!0}return!1},track:({sessionData:e,condition:t,flipBackEvents:r,callback:n,description:s})=>{let a,i,l=null;const f=t.conditions.map(m=>{const u=C[m.type];return{condition:m,typeDef:u,expensive:!!u.isExpensive&&u.isExpensive(m),active:!1,isTrue:null}}),o=m=>{for(const u of f){const d=!r||!u.expensive||m;d&&!u.active?(u.active=!0,u.isTrue=!1,u.untrack=u.typeDef.track({sessionData:e,condition:u.condition,flipBackEvents:r,callback:(T,h={})=>{u.isTrue=T,window.clearTimeout(a),h.immediate?p({immediate:!0}):a=window.setTimeout(p,0)},description:s})):!d&&u.active&&(u.untrack&&u.untrack(),u.active=!1,u.isTrue=null,u.untrack=void 0)}},p=(m={})=>{if(f.length===0){E(!1,m);return}let u,d;if(t.operator===c.AND){u=!0,d=!0;for(const T of f)T.isTrue===!1?(u=!1,T.expensive||(d=!1)):u!==!1&&T.isTrue===null&&(u=null)}else{u=!1,d=!0;for(const T of f)T.isTrue===!0?(u=!0,T.expensive||(d=!1)):u!==!0&&T.isTrue===null&&(u=null)}u!==null&&u!==l&&(l=u,E(u,m)),o(d)},E=(m,u)=>{if(!m||t.waitTime==null||t.waitTime=="0")window.clearTimeout(i),i=void 0,n(m,u);else if(!i){const d=parseFloat(t.waitTime)*1e3;i=window.setTimeout(()=>{n(!0,{})},d)}};return o(!1),p(),()=>{window.clearTimeout(a),window.clearTimeout(i);for(const m of f)m.untrack&&m.untrack()}}},[w.ELEMENT]:{isExpensive:()=>!0,track:e=>{const{elementState:t}=e.condition;if(!t)return()=>{};const r=oe(t);switch(r.kind){case"observer":return le(e,r.checkElement);case"event":return ue(e,r.eventName,r.valueWhenOccurred)}}},[w.FILLED_IN_INPUT]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{let n=null,s;const a=()=>{if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}const f=x(U(t.selector,e.value));let o=null;for(const p of f){const E=F(p);if(E){o=E;break}}o?o!=n&&(window.clearTimeout(s),s=window.setTimeout(()=>{r(!0)},1e3)):(r(!1),window.clearTimeout(s)),n=o};a();const i=e.observe(a),{disconnect:l}=R(a,{observeInput:!0});return()=>{i(),l(),window.clearTimeout(s)}}},[w.FLOW]:{track:()=>(console.warn("Userflow.js: Flow conditions do not work client-side"),()=>{})},[w.INPUT_VALUE]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{if(!t.operator){console.warn("Userflow.js: INPUT_VALUE condition missing operator",t);return}if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}let i=!1;const l=y[t.operator],f=x(U(t.selector,e.value));if(f.length>0)for(const o of f){const p=F(o);if(l.compare({sessionData:e.value,condition:t,value:p})){i=!0;break}}else l.compare({sessionData:e.value,condition:t,value:""})&&(i=!0);r(i)};n();const s=e.observe(n),{disconnect:a}=R(n,{observeInput:!0});return()=>{s(),a()}}},[w.PAGE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let l=!1;if(t.operator){const f=k();l=y[t.operator].compare({sessionData:e.value,condition:t,value:f})}r(l)};let s=k();const a=()=>{const l=k();l!==s&&(s=l,n())};z(a),n();const i=e.observe(n);return()=>{i(),K(a)}}},[w.SEGMENT]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Segment conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[w.CHECKLIST_TASK_CLICKED]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Checklist conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[w.EVENT]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Event conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[w.TIME]:{track:({condition:e,callback:t})=>{let r=null;const n=e.value?new Date(e.value):null,s=e.value2?new Date(e.value2):null,a=()=>{let l=!0;(n&&!isNaN(n.valueOf())&&Date.now()<n.valueOf()||s&&!isNaN(s.valueOf())&&Date.now()>=s.valueOf())&&(l=!1),l!==r&&(r=l,t(l))};a();const i=window.setInterval(a,10*1e3);return()=>{window.clearInterval(i)}}}};function oe(e){switch(e){case L.CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!0};case L.DISABLED:return{kind:"observer",checkElement:t=>!!t&&t.disabled};case L.MOUSEDOWN:return{kind:"event",eventName:"mousedown",valueWhenOccurred:!0};case L.NOT_CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!1};case L.NOT_DISABLED:return{kind:"observer",checkElement:t=>!!t&&!t.disabled};case L.NOT_PRESENT:return{kind:"observer",checkElement:t=>!t};case L.PRESENT:return{kind:"observer",checkElement:t=>!!t}}}function le({sessionData:e,condition:t,callback:r},n){const s=()=>{if(!t.elementState){console.warn("Userflow.js: ELEMENT_STATE condition missing elementState",t);return}if(!t.selector){console.warn("Userflow.js: ELEMENT_STATE condition missing selector",t);return}let l=!1;const f=x(U(t.selector,e.value));if(f.length>0){for(const o of f)if(n(o)){l=!0;break}}else n(null)&&(l=!0);r(l)};s();const a=e.observe(s),{disconnect:i}=R(s);return()=>{a(),i()}}function ue({condition:e,flipBackEvents:t,callback:r},n,s){const{selector:a}=e;if(!a)return()=>{};r(!s);const i=o=>{const p=o.target;p&&q(p,a)&&(t?(r(s,{immediate:!0}),r(!s,{immediate:!0})):r(s))},l={capture:!0},f=H(o=>o.addEventListener(n,i,l),o=>o.removeEventListener(n,i,l));return()=>{f()}}const me=Object.freeze(Object.defineProperty({__proto__:null,conditionTypes:C},Symbol.toStringTag,{value:"Module"}));export{g as a,J as b,C as c,me as f,ee as g,U as i,R as o};
2
2
  //# sourceMappingURL=flow-condition-types.js.map
package/hash.txt CHANGED
@@ -1 +1 @@
1
- 74181daf6e6565a86abc25c99195e26243b584bd
1
+ 72ac6316141225b36c1b57ae1d29bc1905fa08db
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "userflow.js-self-hosted",
3
- "version": "0.1.1016424",
3
+ "version": "0.1.1016426",
4
4
  "description": "Self-hosted version of Userflow.js",
5
5
  "main": "userflow.js"
6
6
  }
package/roots.js CHANGED
@@ -1,2 +1,2 @@
1
- import{d as l,l as v,a9 as ne,y as ae,F as z,aa as Ne}from"./userflow.js";import"./vendor.core-js.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3ca39edd-96f6-41a3-ae23-e0b0331ba116",e._sentryDebugIdIdentifier="sentry-dbid-3ca39edd-96f6-41a3-ae23-e0b0331ba116")}catch{}})();class Me extends Error{constructor(t,o){const n=`Unreachable case: ${t}`;o?o=`${o} (${n})`:o=n,super(o)}}function ht(e){return typeof e=="object"&&e!=null}let ue=window.MutationObserver;const L=window;if(L.Zone&&typeof L.Zone.__symbol__=="function"){const e=L.Zone.__symbol__("MutationObserver");e&&typeof e=="string"&&L.hasOwnProperty(e)&&typeof L[e]=="function"&&(ue=L[e])}function fe(e,t){const o=e.left,n=e.top,r=o+e.width,i=n+e.height,c=t.left,s=t.top,f=c+t.width,u=s+t.height;return Le(o,n,r,i,c,s,f,u)}function Le(e,t,o,n,r,i,c,s){const f=c<e,u=o<r,d=s<t,a=n<i;return a&&f?$(e,n,c,i):f&&d?$(e,t,c,s):d&&u?$(o,t,r,s):u&&a?$(o,n,r,i):f?e-c:u?r-o:d?t-s:a?i-n:0}function $(e,t,o,n){return Math.sqrt(Math.pow(o-e,2)+Math.pow(n-t,2))}function _(e){window.performance.mark&&window.performance.mark(e)}function X(e,t,o){window.performance.measure&&window.performance.measure(e,t,o)}function ve(){const e=window.getComputedStyle(window.document.body);if(e.zoom&&e.zoom!=="1"){const t=parseFloat(e.zoom);if(!isNaN(t))return t}return 1}function mt(e){return _e(),Re(e)}let V;function Re(e){return V==null&&(V=ve()),V==1?e:e/V}function _e(){V=null}function pt(){return(document.compatMode=="BackCompat"?document.body:document.documentElement).clientWidth||window.innerWidth}function De(){return(document.compatMode=="BackCompat"?document.body:document.documentElement).clientHeight||window.innerHeight}function wt(e){return e?parseFloat(e.replace(/px$/,"")):0}function gt(e){return e==null?void 0:e+"px"}function yt(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}const ke=50,Fe=100,oe=25,Ve=new Set(["left","start","justify","justify-all"]);class Oe{constructor(t){this.ctx=t,this.rectCache=new Map,this.isLabelLikeCache=new Map,this.hasPlaceholderCache=new Map}calcScore(t,o){const n=this.getRect(t),r=this.getRect(o),i=this.distBetween(t,o),c=K(o)?Fe:ke;if(i>c)return 0;const s=this.isLabelLike(t),f=this.isCloserToOtherInput(t,o),u=window.getComputedStyle(t).textAlign||"",d=n.top+n.height<=r.top,a=Math.abs(n.left-r.left)<oe&&(!u||Ve.has(u)),h=n.left+n.width<=r.left,T=Math.abs(n.top-r.top)<oe,E=d&&a||h&&T,y=n.height>=De()/2,b=be(o);if(b&&n.top>=r.top+r.height)return 0;let m=1;const S=t.htmlFor;return S&&S===o.id&&(m+=Math.pow(1e3,4)),b&&!y&&!f&&(s&&E?m+=Math.pow(1e3,3):o===t&&this.hasPlaceholder(o)?m+=Math.pow(1e3,2):!s&&E&&(m+=Math.pow(1e3,1))),m+=c-i,m}getRect(t){let o=this.rectCache.get(t);return o||(o=x(t),this.rectCache.set(t,o)),o}isLabelLike(t){let o=this.isLabelLikeCache.get(t);if(o===void 0){const n="a, button, h1, h2, h3, h4, h5, h6, input";o=!t.closest(n)&&!t.querySelector(n),this.isLabelLikeCache.set(t,o)}return o}hasPlaceholder(t){let o=this.hasPlaceholderCache.get(t);return o===void 0&&(o=!!O(t),this.hasPlaceholderCache.set(t,o)),o}getAllInputs(){return this.allInputs||(this.allInputs=Array.from(document.querySelectorAll(we())).filter(t=>ee(t,this.ctx))),this.allInputs}distBetween(t,o){return Math.round(fe(this.getRect(t),this.getRect(o)))}isCloserToOtherInput(t,o){let n=this.distBetween(t,o);for(let r of this.getAllInputs()){if(r===o)continue;if(this.distBetween(t,r)<n)return!0}return!1}}function Be(e,t={}){const o=performance.now();_("userflow:inferSelector:start"),l.groupCollapsed("inferSelector for",e,t);let n;try{n=$e(e,t)}catch(r){console.error("Userflow findElement error:",r),n=null}return l("time",performance.now()-o),l.groupEnd(),_("userflow:inferSelector:end"),X("userflow:inferSelector","userflow:inferSelector:start","userflow:inferSelector:end"),n}function de(e){const t=[],o=e.tagName.toLowerCase();return v.inferenceAttributeNames.forEach(n=>{const r=e.getAttribute(n);if(!r)return;const i=v.inferenceAttributeFilters[n];if(!(i&&!ne(i,r)))if(n==="id")t.push(`#${r}`);else{const c=n==="name"||n==="placeholder"?o:"";t.push(`${c}[${n}="${r}"]`)}}),e.classList.forEach(n=>{ne(v.inferenceClassNameFilters,n)&&(n=n.replace(/:/g,"\\:").trim(),t.push(`.${n}`))}),t}const Ue=window.userflow||{};Ue.__inferSelector=Be;function $e(e,{elementType:t}={}){const o={minorVersion:je};let n=be(e);const r=nt(e);if(t===ae.INPUT&&!n)if(r)e=r,n=!0,l("use custom input parent",r);else return l("not an input"),null;else r&&(e=r,n=!0);const i=Pe(e);let c=null;n||(c=pe(e),c&&c.length>250&&(c=null)),l("text is:"+c);let s=new Map,f=new Map;const u=new Map,d=new G(i,null,o),a=new G(i,c,o),h=(y,b,m,S,g)=>{if(S<0)return;let p=y.get(b);p||(p=[],y.set(b,p)),p.push({css:m,offset:S,complexity:g}),l(`use css=${m}, cardinality=${b}, offset=${S}`)},T=qe(e),E=[e.tagName.toLowerCase(),...de(e)];l("shadowRootSelectors:",i),l("ancestorCssSelectors:",T),l("ownCssSelectors:",E);for(const y of E)for(const b of T){const m=b?`${b} ${y}`:y,S=b?2:1,g=d.query(m),p=Array.from(g),w=p.length;if(w>100){l(`cardinality too high css=${m}, cardinality=${w}`);continue}u.set(m,w);const A=p.indexOf(e);if(h(s,w,m,A,S),c){const F=a.query(m),M=Array.from(F),Ce=M.indexOf(e),Ie=M.length;h(f,Ie,m,Ce,S)}}if(s.size>0||f.size>0){const y=S=>Array.from(S.entries()).map(([g,p])=>({cardinality:g,cssSelectors:p.sort((w,A)=>{const F=u.get(w.css),M=u.get(A.css);return F!==M?F?M?F-M:-1:1:w.complexity!==A.complexity?A.complexity-w.complexity:w.css.localeCompare(A.css)}).map(({css:w,offset:A})=>({css:w,offset:A}))})).sort((g,p)=>g.cardinality-p.cardinality),b={version:"v1",minorVersion:o.minorVersion,shadowRootSelectors:i,notextGroups:y(s),textGroups:y(f)},m={el:e,selector:{type:z.AUTO,autoData:JSON.stringify(b),text:c,elementType:t}};return l("inference result",m),m}return l("no selector inferred "),null}function Pe(e){let t=[],o=e;for(;o;){let n=o.getRootNode();if(k(n)){const{host:i}=n;t.unshift(i.tagName.toLowerCase()),o=i;continue}const r=q(o);if(r){let i=r.tagName.toLowerCase();const c=r.getAttribute("name");c?i+=`[name="${c}"]`:r.id&&!r.id.match(/\d$/)&&(i+="#"+r.id),t.unshift(i),o=r;continue}break}if(t.length!==0)return t}function qe(e){const t=new Map;t.set(null,0);let o=e.parentNode;for(;o&&!(o.tagName==="BODY"||k(o));){for(const r of de(o)){if(t.has(r))continue;const i=P(document.body,r);if(i){const c=i.length;t.set(r,c)}}o=o.parentNode}return Array.from(t.entries()).sort(([,r],[,i])=>r-i).slice(0,20).map(([r])=>r)}function Ye(e,t){const{text:o,excludeText:n,precision:r}=e,i={minorVersion:t.minorVersion||0},c=o!=null&&!n,s=c?t.textGroups:t.notextGroups,f=Math.max(1,Math.min(s.length,Math.ceil((1-parseFloat(r||"1"))*s.length))),u=new G(t.shadowRootSelectors,c&&o||null,i);l("findElementAutoV1",{text:o,excludeText:n,precision:r,groups:s,groupCount:f});for(let d=0;d<f;d++){const a=s[d];let h=new Map,T=0,E=null;l.group(`group cardinality=${a.cardinality}`,a);try{for(let y=0;y<a.cssSelectors.length;y++){const{css:b,offset:m}=a.cssSelectors[y];l(`css=${b}, offset=${m}`);let S=u.query(b),g=null;for(let w=0;w<=m;w++){const A=S.next();if(A.done)break;g=A.value}if(!g)continue;const p=(h.get(g)||0)+1;if(h.set(g,p),l(`el with frequency=${p}`+(p>T&&g!==E?" NEW BEST":""),g),p>T&&(T=p,E=g,p>=Math.ceil(a.cssSelectors.length/2)))return l("early winner",E),E}}finally{l.groupEnd()}if(E)return l("winner",E),E}return l("element not found"),null}class G{constructor(t,o,n){this.shadowRootSelectors=t,this.text=o,this.ctx=n,this.isVisibleCache=new Map,this.textCache=new Map}*query(t){const o=P(document.body,t,this.shadowRootSelectors);if(l("found",o),!o)return;const{text:n}=this;for(let r=0;r<o.length;r++){const i=o[r];if(n){let s=this.textCache.get(i);if(s==null&&(s=j(i,n),this.textCache.set(i,s)),!s){l("skip, text mismatch",i);continue}}let c=this.isVisibleCache.get(i);if(c==null&&(c=ee(i,this.ctx),this.isVisibleCache.set(i,c)),!c){l("skip, not visible",i);continue}l("yield",i),yield i}}}const je=5,B=window.userflow||{};function Z(e){const t=performance.now();_("userflow:findAllElements:start"),l.groupCollapsed("findAllElements",e);let o;try{if(e.type===z.MANUAL)o=Ge(e);else if(e.autoData){const n=JSON.parse(e.autoData);let r;if(n.version==="v1")r=Ye(e,n);else throw new Me(n.version,"Unknown autoData version: "+n.version);o=r?[r]:[]}else o=[]}catch(n){console.error("Userflow findElement error:",n),o=[]}return l("time",performance.now()-t),l.groupEnd(),_("userflow:findAllElements:end"),X("userflow:findAllElements","userflow:findAllElements:start","userflow:findAllElements:end"),o}function Ge(e){const t={minorVersion:e.minorVersion==null?1:e.minorVersion};let{css:o,text:n,elementType:r,offset:i}=e;n=n&&R(n);const c="nearSelector"in e?e.nearSelector:null;l("findAllElementsManual",e),i!=null&&c!=null&&console.warn("Userflow.js: Both selector.offset and selector.nearSelector was set; ignoring nearSelector.");let s;if(n&&!o){if(s=[],t.minorVersion>=2)for(const f of se())W(f,n,s);else W(document.body,n,s);l("els after traverseElementForText",s)}else if(o){if(t.minorVersion>=2){s=[];for(const f of se()){const u=P(f,o);u&&u.length>0&&s.push(...u)}}else s=Array.from(P(document.body,o)||[]);l("els after safeQueryAll",s),n&&(s=ze(s,n),l("els after filterElementsByText",s))}else console.warn("Userflow.js: findAllElements() requires least one of `css` and `text` to be set."),s=[];if(s.length>0&&(s=s.filter(f=>ee(f,t)),l("els after isVisible",s)),s.length>0&&r===ae.INPUT&&(s=et(s,t),l("els after mapElementsToInputs",s)),s.length>0&&(s.sort((f,u)=>{const d=x(f),a=x(u);return d.top<a.top?-1:d.top>a.top?1:d.left-a.left}),l("els after sort",s)),s.length>0){if(i!=null)s=s[i]?[s[i]]:[],l("els after offset",s);else if(c!=null){const f=Z(c);let u=null,d=0;for(const a of s)for(const h of f){const T=fe(x(a),x(h));(!u||T<d)&&(u=a,d=T)}s=u?[u]:[],l("els after nearSelector",s)}}return s}function he(e){return Z(e)[0]||null}function We(e,t){const o=performance.now();_("userflow:elementMatchesSelector:start"),l.groupCollapsed("elementMatchesSelector",e,t);let n;try{if(t.type===z.MANUAL)n=He(e,t);else{const r=he(t);n=r!=null&&r.contains(e)}}catch(r){console.error("Userflow findElement error:",r),n=!1}return l(n?"match":"not match"),l("time",performance.now()-o),l.groupEnd(),_("userflow:elementMatchesSelector:end"),X("userflow:elementMatchesSelector","userflow:elementMatchesSelector:start","userflow:elementMatchesSelector:end"),n}function He(e,t){t.offset!=null&&console.warn("Userflow.js: selector.offset is not supported for elementMatchesSelector yet"),"nearSelector"in t&&t.nearSelector!=null&&console.warn("Userflow.js: selector.nearSelector is not supported for elementMatchesSelector yet");let{css:o,text:n}=t;n=n&&R(n);let r=!1,i=e;for(;i&&i.tagName!=="BODY";){if((!o||i.matches(o))&&(!n||j(i,n))){r=!0;break}i=i.parentElement}return r}function W(e,t,o){if(D(e)){const{tagName:r}=e;if(r==="SCRIPT"||r==="STYLE")return!1}let n=!1;for(let r=0;r<e.children.length;r++)W(e.children[r],t,o)&&(n=!0);return!n&&D(e)&&j(e,t)&&(o.push(e),n=!0),n}function P(e,t,o){try{return o==null?e.querySelectorAll(t):me(t,o,0,e)}catch{return console.info("Userflow.js: Invalid CSS selector: ",t),null}}function me(e,t,o,n){if(o>=t.length)return Array.from(n.querySelectorAll(e));const r=t[o],i=n.querySelectorAll(r),c=[];return i.forEach(s=>{let f;if(s.shadowRoot)f=s.shadowRoot;else{if(!Se(s))return;let u=null;try{u=s.contentDocument}catch{}if(!u)return;f=u.body}c.push(...me(e,t,o+1,f))}),c}function ze(e,t){const o=[];for(let n=e.length-1;n>=0;n--){const r=e[n];o.some(i=>i.contains(r))||j(r,t)&&o.push(r)}return o.reverse()}const Xe={email:!0,number:!0,password:!0,search:!0,tel:!0,text:!0,url:!0},Ze={date:!0,"datetime-local":!0,month:!0,time:!0,week:!0},Qe={button:!0,email:!0,reset:!0,search:!0,submit:!0,tel:!0,text:!0,url:!0};function pe(e){let t=e.innerText;return t===void 0&&e.tagName!=="SELECT"&&(t=e.textContent),t=R(t),t||null}function O(e){if(ge(e)||Q(e)){const t=R(e.getAttribute("placeholder")),o=e.value||"";if(t&&!o)return t;const n=R(o);if(n&&ot(e))return n}if(J(e)&&e.selectedIndex>=0){const t=R(e.options[e.selectedIndex].text);if(t)return t}return pe(e)}function j(e,t){const o=O(e);return o?Je(t,o):!1}function Je(e,t){const o=e.toLowerCase();return t.toLowerCase()===o}function R(e){return!e||e.length>250?null:e.replace(/^[\s\uFEFF\xA0\u200B*]+|[\s\uFEFF\xA0\u200B*]+$/g,"").replace(/\s+/g," ")}function Ke(e){for(const{cssSelector:t,getValue:o}of v.customInputs)if(e.matches(t))if(o)try{return(o(e)||"").trim()}catch(n){return console.error(`Userflow.js: getValue function for custom input '${t}' failed:`,n),""}else return O(e)||"";return J(e)?e.selectedIndex==-1?"":e.options[e.selectedIndex].text:K(e)?O(e)||"":e.value}function we(){return"input, select, textarea, [contenteditable]"+v.customInputs.map(({cssSelector:e})=>`, ${e}`).join("")}function et(e,t){const o=new Set,n=new Oe(t),r=we();for(const i of e){if(i.matches(r)){o.add(i);continue}let c=null,s=null;n.getAllInputs().forEach(f=>{const u=n.calcScore(i,f);l("input",u,f),u!==0&&(c&&s&&u<=s||(l("input is best so far"),c=f,s=u))}),c&&(l("best input was",c),o.add(c))}return Array.from(o)}function ge(e){if(e.tagName!=="INPUT")return!1;const t=e.getAttribute("type");return t==null?!0:Xe[(t||"").toLowerCase()]===!0}function Q(e){return e.tagName==="TEXTAREA"}function tt(e){if(e.tagName!=="INPUT")return!1;const t=(e.getAttribute("type")||"").toLowerCase();return Ze[t]===!0}function J(e){return e.tagName==="SELECT"}function K(e){return"hasAttribute"in e&&e.hasAttribute("contenteditable")}function ye(e){return!!(K(e)||v.customInputs.some(({cssSelector:t})=>e.matches(t)))}function nt(e){let t=e.parentNode;for(;t&&!(t.tagName==="BODY"||k(t));){if(ye(t))return t;t=t.parentNode}return null}function be(e){return ge(e)||tt(e)||Q(e)||J(e)||ye(e)}function ot(e){if(Q(e))return!0;const t=(e.getAttribute("type")||"").toLowerCase();return Qe[t]}function ee(e,t){const o=x(e);let n=e,r=!0,i=!1,c=!1,s=!1,f=!1;for(;n;){const u=n===document.body,d=n.tagName==="BODY",a=window.getComputedStyle(n);let h=null;if(r){if(a.visibility&&a.visibility!=="visible")return l("not visible because visibility is",a.visibility,e,{cur:n}),!1;r=!1}if(a.display==="none")return l("not visible because display is",a.display,e,{cur:n}),!1;if(a.opacity!=null&&parseFloat(a.opacity)<.01)return l("not visible because opacity is",a.opacity,e,{cur:n}),!1;if(a.position==="absolute"?s=!0:(a.position==="relative"||a.position==="fixed"||a.position==="sticky")&&(s=!1),t.minorVersion>=4&&!i&&!d&&!(f&&a.position==="static")&&(I(a.overflowX)||I(a.overflowY))&&(h=h||x(n),h.width===0||h.height===0))return l("not visible because width/height (v1.4 check) is",h.width,h.height,e,{cur:n}),!1;if(!c&&Ee(a.display)&&(t.minorVersion<1||d||a.position!=="static")){const T=d||I(a.overflow),E=T||I(a.overflowX),y=T||I(a.overflowY),{scrollLeft:b,scrollTop:m}=d?n.ownerDocument.documentElement:n,S=!d&&!s;if(E){if(h=h||x(n),S&&h.width===0)return l("not visible because width is",h.width,e,{cur:n}),!1;const g=t.minorVersion>=5?o.width/2:0,p=Math.round(o.left+g),w=Math.round(h.left-b);if(p<w)return l("not visible because it's clipped left",e,{elX:p,curLeft:w,cur:n}),!1}if(y){if(h=h||x(n),S&&h.height===0)return l("not visible because height is",h.height,e,{cur:n}),!1;const g=t.minorVersion>=5?o.height/2:0,p=Math.round(o.top+g),w=Math.round(h.top-m);if(p<w)return l("not visible because it's clipped top",e,{elY:p,curTop:w,cur:n}),!1}(E||y)&&(c=!0)}if(a.position==="fixed"&&(i=!0,c=!0),t.minorVersion>=3&&(n.scrollTop>0||n.scrollLeft>0)&&(c=!0),u)break;d?(n=q(n),r=!0):n=n.parentElement,f=s}return!0}function I(e){return e==="hidden"||e==="clip"||e==="scroll"||e==="auto"}function Ee(e){return!e||!e.includes("inline")&&e!=="contents"}function bt(e){let t=e.parentNode,o=!1;for(;t&&t.tagName!=="BODY";){k(t)&&(t=t.host);const n=window.getComputedStyle(t);if(n.position==="absolute"?o=!0:(n.position==="relative"||n.position==="fixed"||n.position==="sticky")&&(o=!1),!o&&Ee(n.display)&&(I(n.overflow)||I(n.overflowY)))return t;if(n.position==="fixed")return e.ownerDocument.documentElement;t=t.parentNode}return e.ownerDocument.documentElement}function x(e){if(e.tagName==="HTML"){const n=q(e);if(n)return x(n)}let t=e.getBoundingClientRect(),o=e;for(;o&&(o=q(o),!!o);){const n=o.getBoundingClientRect();t={width:t.width,height:t.height,left:t.left+n.left,right:t.right+n.left,top:t.top+n.top,bottom:t.bottom+n.top}}return t}const re=new WeakSet;function q(e){const t=e.ownerDocument?.defaultView;if(!t||re.has(t))return null;{const o=t.frameElement;return o||re.add(t),o}}function k(e){return typeof e=="object"&&e!=null&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e&&"mode"in e}function D(e){return typeof e=="object"&&e!=null&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Se(e){return D(e)&&e.tagName==="IFRAME"}B.__findElement=he;B.__findAllElements=Z;B.__elementMatchesSelector=We;B.__getElementText=O;B.__getInputValue=Ke;const C=new Set,H=new Map,Y=new Set;function se(){return Te(),C}function Et(e,t){Te();for(const n of C)e(n);const o={setup:e,teardown:t};return Y.add(o),()=>{Y.delete(o);for(const n of C)t(n)}}let ie=!1,N=null;function Te(){if(le(),!ie){l("roots started"),ie=!0,N=document.body,U(N);for(const e of Ne)document.addEventListener(e,rt);window.setInterval(le,10*1e3)}}function rt(){N&&!document.contains(N)&&(l("roots detected new Turbo body"),te(N),N=document.body,U(N))}function le(){for(const e of C)k(e)&&(st(e)||(l("roots clean before removeRoot",e),te(e)));l("roots clean finished, remaining=",C.size)}function st(e){if(!e.ownerDocument.defaultView)return!1;let t=e.host;for(;t;){if(k(t)&&(t=t.host),D(t)&&t.tagName==="BODY")return!0;t=t.parentNode}return!1}function U(e){if(!C.has(e)){l("roots addRoot",e),C.add(e),it(e),Ae(e),at(e),ut(e);for(const{setup:t}of Y)t(e)}}function te(e){if(C.has(e)){l("roots removeRoot",e),H.get(e)?.disconnect(),H.delete(e),C.delete(e);for(const{teardown:t}of Y)t(e)}}function it(e){let t;const o=()=>{Ae(e)},n=new ue(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(o)});n.observe(e,{childList:!0,subtree:!0}),H.set(e,n)}function Ae(e){const t=D(e)?e.ownerDocument.getElementsByTagName("iframe"):e.querySelectorAll("iframe");for(const o of t)xe(o)}const ce=new WeakSet;function xe(e){if(ce.has(e)||e.closest("#userflow-ui"))return;e.addEventListener("load",lt);const t=e.contentWindow,o=e.contentDocument;if(!t||!o){ce.add(e);return}const n=o.body;n&&(t.addEventListener("pagehide",ct),l("roots setupFrame before addRoot",e,o,n),U(n))}function lt(e){const t=e.target;t&&Se(t)&&xe(t)}function ct(e){const t=e.currentTarget.document.body;l("roots onFrameUnload before removeRoot",t),te(t)}function at(e){const t=e.ownerDocument.defaultView;if(t.__userflowAttachShadowInstalled)return;t.__userflowAttachShadowInstalled=!0;const o=t.Element.prototype.attachShadow;o!=null&&(t.Element.prototype.attachShadow=function(n){const r=o.call(this,n);return this.shadowRoot&&(l("roots monitorShadowDom before addRoot",this,this.shadowRoot),U(this.shadowRoot)),r})}function ut(e){const t=o=>{o.childNodes.forEach(n=>{D(n)&&n.shadowRoot&&(l("roots queryShadowDom before addRoot",n,n.shadowRoot),U(n.shadowRoot)),t(n)})};t(e)}export{ue as M,Me as U,Be as a,be as b,ht as c,pt as d,De as e,Z as f,pe as g,gt as h,yt as i,Re as j,k,D as l,q as m,R as n,Et as o,_e as p,wt as q,x as r,Se as s,bt as t,he as u,Ke as v,We as w,mt as z};
1
+ import{d as l,l as v,ac as ne,y as ae,F as z,ad as Ie}from"./userflow.js";import"./vendor.core-js.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aae107b5-dcf6-4e13-add7-1ed965b6cd7c",e._sentryDebugIdIdentifier="sentry-dbid-aae107b5-dcf6-4e13-add7-1ed965b6cd7c")}catch{}})();class Me extends Error{constructor(t,o){const n=`Unreachable case: ${t}`;o?o=`${o} (${n})`:o=n,super(o)}}function mt(e){return typeof e=="object"&&e!=null}let ue=window.MutationObserver;const L=window;if(L.Zone&&typeof L.Zone.__symbol__=="function"){const e=L.Zone.__symbol__("MutationObserver");e&&typeof e=="string"&&L.hasOwnProperty(e)&&typeof L[e]=="function"&&(ue=L[e])}function fe(e,t){const o=e.left,n=e.top,r=o+e.width,i=n+e.height,c=t.left,s=t.top,f=c+t.width,u=s+t.height;return Le(o,n,r,i,c,s,f,u)}function Le(e,t,o,n,r,i,c,s){const f=c<e,u=o<r,d=s<t,a=n<i;return a&&f?U(e,n,c,i):f&&d?U(e,t,c,s):d&&u?U(o,t,r,s):u&&a?U(o,n,r,i):f?e-c:u?r-o:d?t-s:a?i-n:0}function U(e,t,o,n){return Math.sqrt(Math.pow(o-e,2)+Math.pow(n-t,2))}function _(e){window.performance.mark&&window.performance.mark(e)}function X(e,t,o){window.performance.measure&&window.performance.measure(e,t,o)}function ve(){const e=window.getComputedStyle(window.document.body);if(e.zoom&&e.zoom!=="1"){const t=parseFloat(e.zoom);if(!isNaN(t))return t}return 1}function pt(e){return _e(),Re(e)}let F;function Re(e){return F==null&&(F=ve()),F==1?e:e/F}function _e(){F=null}function wt(){return(document.compatMode=="BackCompat"?document.body:document.documentElement).clientWidth||window.innerWidth}function De(){return(document.compatMode=="BackCompat"?document.body:document.documentElement).clientHeight||window.innerHeight}function gt(e){return e?parseFloat(e.replace(/px$/,"")):0}function yt(e){return e==null?void 0:e+"px"}function bt(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}const Ve=50,ke=100,oe=25,Fe=new Set(["left","start","justify","justify-all"]);class Oe{constructor(t){this.ctx=t,this.rectCache=new Map,this.isLabelLikeCache=new Map,this.hasPlaceholderCache=new Map}calcScore(t,o){const n=this.getRect(t),r=this.getRect(o),i=this.distBetween(t,o),c=K(o)?ke:Ve;if(i>c)return 0;const s=this.isLabelLike(t),f=this.isCloserToOtherInput(t,o),u=window.getComputedStyle(t).textAlign||"",d=n.top+n.height<=r.top,a=Math.abs(n.left-r.left)<oe&&(!u||Fe.has(u)),h=n.left+n.width<=r.left,T=Math.abs(n.top-r.top)<oe,E=d&&a||h&&T,y=n.height>=De()/2,b=be(o);if(b&&n.top>=r.top+r.height)return 0;let m=1;const S=t.htmlFor;return S&&S===o.id&&(m+=Math.pow(1e3,4)),b&&!y&&!f&&(s&&E?m+=Math.pow(1e3,3):o===t&&this.hasPlaceholder(o)?m+=Math.pow(1e3,2):!s&&E&&(m+=Math.pow(1e3,1))),m+=c-i,m}getRect(t){let o=this.rectCache.get(t);return o||(o=A(t),this.rectCache.set(t,o)),o}isLabelLike(t){let o=this.isLabelLikeCache.get(t);if(o===void 0){const n="a, button, h1, h2, h3, h4, h5, h6, input";o=!t.closest(n)&&!t.querySelector(n),this.isLabelLikeCache.set(t,o)}return o}hasPlaceholder(t){let o=this.hasPlaceholderCache.get(t);return o===void 0&&(o=!!O(t),this.hasPlaceholderCache.set(t,o)),o}getAllInputs(){return this.allInputs||(this.allInputs=Array.from(document.querySelectorAll(we())).filter(t=>ee(t,this.ctx))),this.allInputs}distBetween(t,o){return Math.round(fe(this.getRect(t),this.getRect(o)))}isCloserToOtherInput(t,o){let n=this.distBetween(t,o);for(let r of this.getAllInputs()){if(r===o)continue;if(this.distBetween(t,r)<n)return!0}return!1}}function Be(e,t={}){const o=performance.now();_("userflow:inferSelector:start"),l.groupCollapsed("inferSelector for",e,t);let n;try{n=Ue(e,t)}catch(r){console.error("Userflow findElement error:",r),n=null}return l("time",performance.now()-o),l.groupEnd(),_("userflow:inferSelector:end"),X("userflow:inferSelector","userflow:inferSelector:start","userflow:inferSelector:end"),n}function de(e){const t=[],o=e.tagName.toLowerCase();return v.inferenceAttributeNames.forEach(n=>{const r=e.getAttribute(n);if(!r)return;const i=v.inferenceAttributeFilters[n];if(!(i&&!ne(i,r)))if(n==="id")t.push(`#${r}`);else{const c=n==="name"||n==="placeholder"?o:"";t.push(`${c}[${n}="${r}"]`)}}),e.classList.forEach(n=>{ne(v.inferenceClassNameFilters,n)&&(n=n.replace(/:/g,"\\:").trim(),t.push(`.${n}`))}),t}const $e=window.userflow||{};$e.__inferSelector=Be;function Ue(e,{elementType:t}={}){const o={minorVersion:Ye};let n=be(e);const r=nt(e);if(t===ae.INPUT&&!n)if(r)e=r,n=!0,l("use custom input parent",r);else return l("not an input"),null;else r&&(e=r,n=!0);const i=Pe(e);let c=null;n||(c=pe(e),c&&c.length>250&&(c=null)),l("text is:"+c);let s=new Map,f=new Map;const u=new Map,d=new G(i,null,o),a=new G(i,c,o),h=(y,b,m,S,g)=>{if(S<0)return;let p=y.get(b);p||(p=[],y.set(b,p)),p.push({css:m,offset:S,complexity:g}),l(`use css=${m}, cardinality=${b}, offset=${S}`)},T=qe(e),E=[e.tagName.toLowerCase(),...de(e)];l("shadowRootSelectors:",i),l("ancestorCssSelectors:",T),l("ownCssSelectors:",E);for(const y of E)for(const b of T){const m=b?`${b} ${y}`:y,S=b?2:1,g=d.query(m),p=Array.from(g),w=p.length;if(w>100){l(`cardinality too high css=${m}, cardinality=${w}`);continue}u.set(m,w);const x=p.indexOf(e);if(h(s,w,m,x,S),c){const k=a.query(m),M=Array.from(k),Ce=M.indexOf(e),Ne=M.length;h(f,Ne,m,Ce,S)}}if(s.size>0||f.size>0){const y=S=>Array.from(S.entries()).map(([g,p])=>({cardinality:g,cssSelectors:p.sort((w,x)=>{const k=u.get(w.css),M=u.get(x.css);return k!==M?k?M?k-M:-1:1:w.complexity!==x.complexity?x.complexity-w.complexity:w.css.localeCompare(x.css)}).map(({css:w,offset:x})=>({css:w,offset:x}))})).sort((g,p)=>g.cardinality-p.cardinality),b={version:"v1",minorVersion:o.minorVersion,shadowRootSelectors:i,notextGroups:y(s),textGroups:y(f)},m={el:e,selector:{type:z.AUTO,autoData:JSON.stringify(b),text:c,elementType:t}};return l("inference result",m),m}return l("no selector inferred "),null}function Pe(e){let t=[],o=e;for(;o;){let n=o.getRootNode();if(V(n)){const{host:i}=n;t.unshift(i.tagName.toLowerCase()),o=i;continue}const r=q(o);if(r){let i=r.tagName.toLowerCase();const c=r.getAttribute("name");c?i+=`[name="${c}"]`:r.id&&!r.id.match(/\d$/)&&(i+="#"+r.id),t.unshift(i),o=r;continue}break}if(t.length!==0)return t}function qe(e){const t=new Map;t.set(null,0);let o=e.parentNode;for(;o&&!(o.tagName==="BODY"||V(o));){for(const r of de(o)){if(t.has(r))continue;const i=P(document.body,r);if(i){const c=i.length;t.set(r,c)}}o=o.parentNode}return Array.from(t.entries()).sort(([,r],[,i])=>r-i).slice(0,20).map(([r])=>r)}function je(e,t){const{text:o,excludeText:n,precision:r}=e,i={minorVersion:t.minorVersion||0},c=o!=null&&!n,s=c?t.textGroups:t.notextGroups,f=Math.max(1,Math.min(s.length,Math.ceil((1-parseFloat(r||"1"))*s.length))),u=new G(t.shadowRootSelectors,c&&o||null,i);l("findElementAutoV1",{text:o,excludeText:n,precision:r,groups:s,groupCount:f});for(let d=0;d<f;d++){const a=s[d];let h=new Map,T=0,E=null;l.group(`group cardinality=${a.cardinality}`,a);try{for(let y=0;y<a.cssSelectors.length;y++){const{css:b,offset:m}=a.cssSelectors[y];l(`css=${b}, offset=${m}`);let S=u.query(b),g=null;for(let w=0;w<=m;w++){const x=S.next();if(x.done)break;g=x.value}if(!g)continue;const p=(h.get(g)||0)+1;if(h.set(g,p),l(`el with frequency=${p}`+(p>T&&g!==E?" NEW BEST":""),g),p>T&&(T=p,E=g,p>=Math.ceil(a.cssSelectors.length/2)))return l("early winner",E),E}}finally{l.groupEnd()}if(E)return l("winner",E),E}return l("element not found"),null}class G{constructor(t,o,n){this.shadowRootSelectors=t,this.text=o,this.ctx=n,this.isVisibleCache=new Map,this.textCache=new Map}*query(t){const o=P(document.body,t,this.shadowRootSelectors);if(l("found",o),!o)return;const{text:n}=this;for(let r=0;r<o.length;r++){const i=o[r];if(n){let s=this.textCache.get(i);if(s==null&&(s=Y(i,n),this.textCache.set(i,s)),!s){l("skip, text mismatch",i);continue}}let c=this.isVisibleCache.get(i);if(c==null&&(c=ee(i,this.ctx),this.isVisibleCache.set(i,c)),!c){l("skip, not visible",i);continue}l("yield",i),yield i}}}const Ye=5,B=window.userflow||{};function Z(e){const t=performance.now();_("userflow:findAllElements:start"),l.groupCollapsed("findAllElements",e);let o;try{if(e.type===z.MANUAL)o=Ge(e);else if(e.autoData){const n=JSON.parse(e.autoData);let r;if(n.version==="v1")r=je(e,n);else throw new Me(n.version,"Unknown autoData version: "+n.version);o=r?[r]:[]}else o=[]}catch(n){console.error("Userflow findElement error:",n),o=[]}return l("time",performance.now()-t),l.groupEnd(),_("userflow:findAllElements:end"),X("userflow:findAllElements","userflow:findAllElements:start","userflow:findAllElements:end"),o}function Ge(e){const t={minorVersion:e.minorVersion==null?1:e.minorVersion};let{css:o,text:n,elementType:r,offset:i}=e;n=n&&R(n);const c="nearSelector"in e?e.nearSelector:null;l("findAllElementsManual",e),i!=null&&c!=null&&console.warn("Userflow.js: Both selector.offset and selector.nearSelector was set; ignoring nearSelector.");let s;if(n&&!o){if(s=[],t.minorVersion>=2)for(const f of se())W(f,n,s);else W(document.body,n,s);l("els after traverseElementForText",s)}else if(o){if(t.minorVersion>=2){s=[];for(const f of se()){const u=P(f,o);u&&u.length>0&&s.push(...u)}}else s=Array.from(P(document.body,o)||[]);l("els after safeQueryAll",s),n&&(s=ze(s,n),l("els after filterElementsByText",s))}else console.warn("Userflow.js: findAllElements() requires least one of `css` and `text` to be set."),s=[];if(s.length>0&&(s=s.filter(f=>ee(f,t)),l("els after isVisible",s)),s.length>0&&r===ae.INPUT&&(s=et(s,t),l("els after mapElementsToInputs",s)),s.length>0&&(s.sort((f,u)=>{const d=A(f),a=A(u);return d.top<a.top?-1:d.top>a.top?1:d.left-a.left}),l("els after sort",s)),s.length>0){if(i!=null)s=s[i]?[s[i]]:[],l("els after offset",s);else if(c!=null){const f=Z(c);let u=null,d=0;for(const a of s)for(const h of f){const T=fe(A(a),A(h));(!u||T<d)&&(u=a,d=T)}s=u?[u]:[],l("els after nearSelector",s)}}return s}function he(e){return Z(e)[0]||null}function We(e,t){const o=performance.now();_("userflow:elementMatchesSelector:start"),l.groupCollapsed("elementMatchesSelector",e,t);let n;try{if(t.type===z.MANUAL)n=He(e,t);else{const r=he(t);n=r!=null&&r.contains(e)}}catch(r){console.error("Userflow findElement error:",r),n=!1}return l(n?"match":"not match"),l("time",performance.now()-o),l.groupEnd(),_("userflow:elementMatchesSelector:end"),X("userflow:elementMatchesSelector","userflow:elementMatchesSelector:start","userflow:elementMatchesSelector:end"),n}function He(e,t){t.offset!=null&&console.warn("Userflow.js: selector.offset is not supported for elementMatchesSelector yet"),"nearSelector"in t&&t.nearSelector!=null&&console.warn("Userflow.js: selector.nearSelector is not supported for elementMatchesSelector yet");let{css:o,text:n}=t;n=n&&R(n);let r=!1,i=e;for(;i&&i.tagName!=="BODY";){if((!o||i.matches(o))&&(!n||Y(i,n))){r=!0;break}i=i.parentElement}return r}function W(e,t,o){if(D(e)){const{tagName:r}=e;if(r==="SCRIPT"||r==="STYLE")return!1}let n=!1;for(let r=0;r<e.children.length;r++)W(e.children[r],t,o)&&(n=!0);return!n&&D(e)&&Y(e,t)&&(o.push(e),n=!0),n}function P(e,t,o){try{return o==null?e.querySelectorAll(t):me(t,o,0,e)}catch{return console.info("Userflow.js: Invalid CSS selector: ",t),null}}function me(e,t,o,n){if(o>=t.length)return Array.from(n.querySelectorAll(e));const r=t[o],i=n.querySelectorAll(r),c=[];return i.forEach(s=>{let f;if(s.shadowRoot)f=s.shadowRoot;else{if(!Se(s))return;let u=null;try{u=s.contentDocument}catch{}if(!u)return;f=u.body}c.push(...me(e,t,o+1,f))}),c}function ze(e,t){const o=[];for(let n=e.length-1;n>=0;n--){const r=e[n];o.some(i=>i.contains(r))||Y(r,t)&&o.push(r)}return o.reverse()}const Xe={email:!0,number:!0,password:!0,search:!0,tel:!0,text:!0,url:!0},Ze={date:!0,"datetime-local":!0,month:!0,time:!0,week:!0},Qe={button:!0,email:!0,reset:!0,search:!0,submit:!0,tel:!0,text:!0,url:!0};function pe(e){let t=e.innerText;return t===void 0&&e.tagName!=="SELECT"&&(t=e.textContent),t=R(t),t||null}function O(e){if(ge(e)||Q(e)){const t=R(e.getAttribute("placeholder")),o=e.value||"";if(t&&!o)return t;const n=R(o);if(n&&ot(e))return n}if(J(e)&&e.selectedIndex>=0){const t=R(e.options[e.selectedIndex].text);if(t)return t}return pe(e)}function Y(e,t){const o=O(e);return o?Je(t,o):!1}function Je(e,t){const o=e.toLowerCase();return t.toLowerCase()===o}function R(e){return!e||e.length>250?null:e.replace(/^[\s\uFEFF\xA0\u200B*]+|[\s\uFEFF\xA0\u200B*]+$/g,"").replace(/\s+/g," ")}function Ke(e){for(const{cssSelector:t,getValue:o}of v.customInputs)if(e.matches(t))if(o)try{return(o(e)||"").trim()}catch(n){return console.error(`Userflow.js: getValue function for custom input '${t}' failed:`,n),""}else return O(e)||"";return J(e)?e.selectedIndex==-1?"":e.options[e.selectedIndex].text:K(e)?O(e)||"":e.value}function we(){return"input, select, textarea, [contenteditable]"+v.customInputs.map(({cssSelector:e})=>`, ${e}`).join("")}function et(e,t){const o=new Set,n=new Oe(t),r=we();for(const i of e){if(i.matches(r)){o.add(i);continue}let c=null,s=null;n.getAllInputs().forEach(f=>{const u=n.calcScore(i,f);l("input",u,f),u!==0&&(c&&s&&u<=s||(l("input is best so far"),c=f,s=u))}),c&&(l("best input was",c),o.add(c))}return Array.from(o)}function ge(e){if(e.tagName!=="INPUT")return!1;const t=e.getAttribute("type");return t==null?!0:Xe[(t||"").toLowerCase()]===!0}function Q(e){return e.tagName==="TEXTAREA"}function tt(e){if(e.tagName!=="INPUT")return!1;const t=(e.getAttribute("type")||"").toLowerCase();return Ze[t]===!0}function J(e){return e.tagName==="SELECT"}function K(e){return"hasAttribute"in e&&e.hasAttribute("contenteditable")}function ye(e){return!!(K(e)||v.customInputs.some(({cssSelector:t})=>e.matches(t)))}function nt(e){let t=e.parentNode;for(;t&&!(t.tagName==="BODY"||V(t));){if(ye(t))return t;t=t.parentNode}return null}function be(e){return ge(e)||tt(e)||Q(e)||J(e)||ye(e)}function ot(e){if(Q(e))return!0;const t=(e.getAttribute("type")||"").toLowerCase();return Qe[t]}function ee(e,t){const o=A(e);let n=e,r=!0,i=!1,c=!1,s=!1,f=!1;for(;n;){const u=n===document.body,d=n.tagName==="BODY",a=window.getComputedStyle(n);let h=null;if(r){if(a.visibility&&a.visibility!=="visible")return l("not visible because visibility is",a.visibility,e,{cur:n}),!1;r=!1}if(a.display==="none")return l("not visible because display is",a.display,e,{cur:n}),!1;if(a.opacity!=null&&parseFloat(a.opacity)<.01)return l("not visible because opacity is",a.opacity,e,{cur:n}),!1;if(a.position==="absolute"?s=!0:(a.position==="relative"||a.position==="fixed"||a.position==="sticky")&&(s=!1),t.minorVersion>=4&&!i&&!d&&!(f&&a.position==="static")&&(N(a.overflowX)||N(a.overflowY))&&(h=h||A(n),h.width===0||h.height===0))return l("not visible because width/height (v1.4 check) is",h.width,h.height,e,{cur:n}),!1;if(!c&&Ee(a.display)&&(t.minorVersion<1||d||a.position!=="static")){const T=d||N(a.overflow),E=T||N(a.overflowX),y=T||N(a.overflowY),{scrollLeft:b,scrollTop:m}=d?n.ownerDocument.documentElement:n,S=!d&&!s;if(E){if(h=h||A(n),S&&h.width===0)return l("not visible because width is",h.width,e,{cur:n}),!1;const g=t.minorVersion>=5?o.width/2:0,p=Math.round(o.left+g),w=Math.round(h.left-b);if(p<w)return l("not visible because it's clipped left",e,{elX:p,curLeft:w,cur:n}),!1}if(y){if(h=h||A(n),S&&h.height===0)return l("not visible because height is",h.height,e,{cur:n}),!1;const g=t.minorVersion>=5?o.height/2:0,p=Math.round(o.top+g),w=Math.round(h.top-m);if(p<w)return l("not visible because it's clipped top",e,{elY:p,curTop:w,cur:n}),!1}(E||y)&&(c=!0)}if(a.position==="fixed"&&(i=!0,c=!0),t.minorVersion>=3&&(n.scrollTop>0||n.scrollLeft>0)&&(c=!0),u)break;d?(n=q(n),r=!0):n=n.parentElement,f=s}return!0}function N(e){return e==="hidden"||e==="clip"||e==="scroll"||e==="auto"}function Ee(e){return!e||!e.includes("inline")&&e!=="contents"}function Et(e){let t=e.parentNode,o=!1;for(;t&&t.tagName!=="BODY";){V(t)&&(t=t.host);const n=window.getComputedStyle(t);if(n.position==="absolute"?o=!0:(n.position==="relative"||n.position==="fixed"||n.position==="sticky")&&(o=!1),!o&&Ee(n.display)&&(N(n.overflow)||N(n.overflowY)))return t;if(n.position==="fixed")return e.ownerDocument.documentElement;t=t.parentNode}return e.ownerDocument.documentElement}function A(e){if(e.tagName==="HTML"){const n=q(e);if(n)return A(n)}let t=e.getBoundingClientRect(),o=e;for(;o&&(o=q(o),!!o);){const n=o.getBoundingClientRect();t={width:t.width,height:t.height,left:t.left+n.left,right:t.right+n.left,top:t.top+n.top,bottom:t.bottom+n.top}}return t}const re=new WeakSet;function q(e){const t=e.ownerDocument?.defaultView;if(!t||re.has(t))return null;{const o=t.frameElement;return o||re.add(t),o}}function V(e){return typeof e=="object"&&e!=null&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e&&"mode"in e}function D(e){return typeof e=="object"&&e!=null&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Se(e){return D(e)&&e.tagName==="IFRAME"}const rt=e=>{if(!e)return null;const t=e.className;if(t==null)return null;if(typeof t=="string")return t;if(typeof t=="object"&&"baseVal"in t)return t.baseVal||null;try{return String(t)}catch{return null}},St=e=>{const t=e.getBoundingClientRect();return`${e.tagName}-${e.id||""}-${rt(e)||""}-${Math.round(t.left)}-${Math.round(t.top)}`};B.__findElement=he;B.__findAllElements=Z;B.__elementMatchesSelector=We;B.__getElementText=O;B.__getInputValue=Ke;const C=new Set,H=new Map,j=new Set;function se(){return Te(),C}function Tt(e,t){Te();for(const n of C)e(n);const o={setup:e,teardown:t};return j.add(o),()=>{j.delete(o);for(const n of C)t(n)}}let ie=!1,I=null;function Te(){if(le(),!ie){l("roots started"),ie=!0,I=document.body,$(I);for(const e of Ie)document.addEventListener(e,st);window.setInterval(le,10*1e3)}}function st(){I&&!document.contains(I)&&(l("roots detected new Turbo body"),te(I),I=document.body,$(I))}function le(){for(const e of C)V(e)&&(it(e)||(l("roots clean before removeRoot",e),te(e)));l("roots clean finished, remaining=",C.size)}function it(e){if(!e.ownerDocument.defaultView)return!1;let t=e.host;for(;t;){if(V(t)&&(t=t.host),D(t)&&t.tagName==="BODY")return!0;t=t.parentNode}return!1}function $(e){if(!C.has(e)){l("roots addRoot",e),C.add(e),lt(e),xe(e),ut(e),ft(e);for(const{setup:t}of j)t(e)}}function te(e){if(C.has(e)){l("roots removeRoot",e),H.get(e)?.disconnect(),H.delete(e),C.delete(e);for(const{teardown:t}of j)t(e)}}function lt(e){let t;const o=()=>{xe(e)},n=new ue(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(o)});n.observe(e,{childList:!0,subtree:!0}),H.set(e,n)}function xe(e){const t=D(e)?e.ownerDocument.getElementsByTagName("iframe"):e.querySelectorAll("iframe");for(const o of t)Ae(o)}const ce=new WeakSet;function Ae(e){if(ce.has(e)||e.closest("#userflow-ui"))return;e.addEventListener("load",ct);const t=e.contentWindow,o=e.contentDocument;if(!t||!o){ce.add(e);return}const n=o.body;n&&(t.addEventListener("pagehide",at),l("roots setupFrame before addRoot",e,o,n),$(n))}function ct(e){const t=e.target;t&&Se(t)&&Ae(t)}function at(e){const t=e.currentTarget.document.body;l("roots onFrameUnload before removeRoot",t),te(t)}function ut(e){const t=e.ownerDocument.defaultView;if(t.__userflowAttachShadowInstalled)return;t.__userflowAttachShadowInstalled=!0;const o=t.Element.prototype.attachShadow;o!=null&&(t.Element.prototype.attachShadow=function(n){const r=o.call(this,n);return this.shadowRoot&&(l("roots monitorShadowDom before addRoot",this,this.shadowRoot),$(this.shadowRoot)),r})}function ft(e){const t=o=>{o.childNodes.forEach(n=>{D(n)&&n.shadowRoot&&(l("roots queryShadowDom before addRoot",n,n.shadowRoot),$(n.shadowRoot)),t(n)})};t(e)}export{ue as M,Me as U,Be as a,be as b,mt as c,wt as d,De as e,Z as f,pe as g,yt as h,bt as i,Re as j,V as k,D as l,q as m,R as n,Tt as o,_e as p,gt as q,A as r,St as s,Se as t,Et as u,he as v,Ke as w,We as x,pt as z};
2
2
  //# sourceMappingURL=roots.js.map
package/stylesheets.js CHANGED
@@ -1,2 +1,2 @@
1
- import{r as p,R as y}from"./vendor.react.js";import{V as $,W as R,R as P,P as D,X as z,z as U,Y as O,Z as q,x as _,_ as j,$ as N,a0 as K,Q as V,i as G,a1 as Y,a2 as Q,a3 as X,b as Z,a4 as J}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{e as oo,g as ro,h as to,i as no,j as eo,k as lo,l as ao,m as uo,n as co,o as io}from"./vendor.fortawesome.pro-solid-svg-icons.js";import"./vendor.core-js.js";import{j as so,$ as fo,I as go,a4 as H}from"./userflow.js";import{c as bo}from"./flow-condition-types.js";import{a as Co}from"./client-context.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]="1ac6b869-fa91-431a-8477-b8a59b1af335",o._sentryDebugIdIdentifier="sentry-dbid-1ac6b869-fa91-431a-8477-b8a59b1af335")}catch{}})();function Bo(o){const[t]=p.useState(()=>new so(o));return t.update(o),t}const $o=({icon:o,size:t,dataAttrs:n})=>{t=t||16;const e=typeof o=="string"&&A[o]?A[o]:o;if(typeof e=="string")return y.createElement("img",{...n,"aria-hidden":"true",src:e,width:t,height:t,style:{objectFit:"contain"}});{const l=e.icon[0],a=e.icon[1],c=e.icon[4];return y.createElement("svg",{"aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:`0 0 ${l} ${a}`,...n},y.createElement("path",{fill:"currentColor",d:String(c)}))}},A={"regular/calendar-day":$,"regular/comment-alt":R,"regular/comments-alt":P,"regular/envelope":D,"regular/exclamation-triangle":z,"regular/external-link":U,"regular/file-alt":O,"regular/graduation-cap":q,"regular/info-circle":_,"regular/lightbulb":j,"regular/megaphone":N,"regular/pencil":K,"regular/phone":V,"regular/play-circle":G,"regular/question-circle":Y,"regular/shoe-prints":Q,"solid/shoe-prints":oo,"solid/file-invoice":ro,"solid/receipt":to,"solid/university":no,"solid/users":eo,"solid/stars":lo,"regular/tasks":X,"regular/user":Z,"regular/users":J,"solid/exclamation-triangle":ao,"solid/info-circle":uo,"solid/play-circle":co,"solid/question-circle":io};function po(o,t,n){if(!o.document.fonts)return n(),()=>{};let e=!1;const l=()=>{const i=o.document.fonts.load(`100px ${t}`,"BESbswy");if(!i){c(),n();return}i.then(u=>{e||(u.length>=1?(c(),n()):window.setTimeout(l,25))},u=>{console.log("Userflow.js: observeFont error:"),console.log(u),n()})};l();const a=window.setTimeout(()=>{console.warn(`Userflow.js: Timed out waiting for font family ${t} to load. Will continue anyway.`),n()},2e3),c=()=>{e=!0,window.clearTimeout(a)};return c}function k(o){return o?o.match(/^#[0-9a-f]{6}$/i)?[parseInt(o.substring(1,3),16),parseInt(o.substring(3,5),16),parseInt(o.substring(5,7),16)]:o.match(/^#[0-9a-f]{3}$/i)?[parseInt(o.substring(1,2).repeat(2),16),parseInt(o.substring(2,3).repeat(2),16),parseInt(o.substring(3,4).repeat(2),16)]:[0,0,0]:[0,0,0]}function v([o,t,n]){return"#"+o.toString(16).padStart(2,"0")+t.toString(16).padStart(2,"0")+n.toString(16).padStart(2,"0")}function B(o){const t=k(o);return t?t.join(", "):"0, 0, 0"}function x(o){return v(k(o))}function ko([o,t,n]){return[Math.round(255-o),Math.round(255-t),Math.round(255-n)]}function F(o,t,n){return[Math.max(0,Math.min(255,Math.round(o[0]+(t[0]-o[0])*n))),Math.max(0,Math.min(255,Math.round(o[1]+(t[1]-o[1])*n))),Math.max(0,Math.min(255,Math.round(o[2]+(t[2]-o[2])*n)))]}function h(o,t,n){const e=k(o),l=k(t);return!e||!l?o:v(F(e,l,n))}function S([o,t,n]){o/=255,t/=255,n/=255;const e=Math.max(o,t,n),l=Math.min(o,t,n);let a,c,i=(e+l)/2;if(e==l)a=c=0;else{const u=e-l;switch(c=i>.5?u/(2-e-l):u/(e+l),e){case o:a=(t-n)/u+(t<n?6:0);break;case t:a=(n-o)/u+2;break;default:a=(o-t)/u+4;break}a/=6}return[a,c,i]}function m([o,t,n]){let e=o/255,l=t/255,a=n/255;function c(r){let s=0;return r<=.04045?s=r/12.92:s=Math.pow((r+.055)/1.055,2.4),s}let i=.2126*c(e)+.7152*c(l)+.0722*c(a);function u(r){let s=0;return r<=216/24389?s=r*(24389/27):s=Math.pow(r,1/3)*116-16,s}return Math.round(u(i)*10)/1e3}function L(o,t){const n=m(o),e=m(t),l=.05;let i=(1-(e-n))/2*(.18-l)+l,u=1-Math.abs(e-n),r=Math.pow((1-i)*u,4),s=i+r;return Math.round(s*1e3)/1e3}function w(o,t){const n=k(o),e=S(n);let l=null,a=null;for(const g of t){const d=k(g),f=S(d);let b=!1;!l||!a?b=!0:Math.abs(f[2]-e[2])>.3?f[1]>a[1]&&(b=!0):Math.abs(e[2]-f[2])>Math.abs(e[2]-a[2])&&(b=!0),b&&(l=d,a=f)}let c=l,i=l,u=L(c,n),r=u*2;const s=.2;return e[2]>s&&e[2]<1-s&&(i=ko(i),r=L(i,n)),[v(F(n,c,u)),v(F(n,i,r))]}function wo(o,t,n,e){const[l,a]=w(o,[t]);let c,i;if(o===n)c=l,i=a;else{const C=w(n,[o,t,e]);c=C[0],i=C[1]}const u=k(o),r=k(n),s=20;let g,d,f,b;if(Math.abs(u[0]-r[0])<s&&Math.abs(u[1]-r[1])<s&&Math.abs(u[2]-r[2])<s){g=t,d=o;const C=w(g,[d]);f=C[0],b=C[1]}else g=o,d=t,f=l,b=a;return[l,a,c,i,g,d,f,b]}function ho(o){const[t,n,e,l,a,c,i,u]=wo(o.brandBackgroundColor,o.brandForegroundColor,o.mainBackgroundColor,o.mainForegroundColor),r={...o,widgetBackgroundColor:a,widgetForegroundColor:c,widgetHoverBackgroundColor:i,widgetActiveBackgroundColor:u,sameBackground:x(o.mainBackgroundColor)==x(o.brandBackgroundColor)};r.brandHoverBackgroundColor&&(r.widgetHoverBackgroundColor=r.brandHoverBackgroundColor),r.brandActiveBackgroundColor&&(r.widgetActiveBackgroundColor=r.brandActiveBackgroundColor),r.brandHoverBackgroundColor||(r.brandHoverBackgroundColor=t),r.brandActiveBackgroundColor||(r.brandActiveBackgroundColor=n),r.mainHoverBackgroundColor||(r.mainHoverBackgroundColor=e),r.mainActiveBackgroundColor||(r.mainActiveBackgroundColor=l),r.bannerBackgroundColor||(r.bannerBackgroundColor=r.brandBackgroundColor),r.bannerForegroundColor||(r.bannerForegroundColor=r.brandForegroundColor);const[s,g]=w(r.bannerBackgroundColor,[r.bannerForegroundColor]);r.bannerHoverBackgroundColor=s,r.bannerActiveBackgroundColor=g;const[d,f]=w(r.bannerForegroundColor,[r.bannerBackgroundColor]);if(r.bannerHoverForegroundColor=d,r.bannerActiveForegroundColor=f,r.bubbleBorderColor||(r.bubbleBorderColor=r.mainForegroundColor),r.checklistLauncherActiveBackgroundColor||(r.checklistLauncherActiveBackgroundColor=r.brandActiveBackgroundColor),r.checklistLauncherBackgroundColor||(r.checklistLauncherBackgroundColor=r.brandBackgroundColor),r.checklistLauncherCounterBackgroundColor||(r.checklistLauncherCounterBackgroundColor=r.brandForegroundColor),r.checklistLauncherCounterFontColor||(r.checklistLauncherCounterFontColor=r.brandBackgroundColor),r.checklistLauncherFontColor||(r.checklistLauncherFontColor=r.brandForegroundColor),r.checklistLauncherHoverBackgroundColor||(r.checklistLauncherHoverBackgroundColor=r.brandHoverBackgroundColor),r.focusColor||(r.focusColor=r.mainActiveBackgroundColor),r.launcherIconActiveColor||(r.launcherIconActiveColor=r.brandActiveBackgroundColor),r.launcherIconColor||(r.launcherIconColor=r.brandBackgroundColor),r.launcherIconHoverColor||(r.launcherIconHoverColor=r.brandHoverBackgroundColor),r.linkColor||(r.linkColor=r.widgetBackgroundColor),r.progressBarColor||(r.progressBarColor=r.widgetBackgroundColor),r.questionColor||(r.questionColor=r.widgetBackgroundColor),r.toolbarForegroundColor||(r.toolbarForegroundColor=r.mainForegroundColor),r.primaryButtonBackgroundColor||(r.primaryButtonBackgroundColor=r.widgetBackgroundColor),r.primaryButtonFontColor||(r.primaryButtonFontColor=r.widgetForegroundColor),r.primaryButtonHoverFontColor||(r.primaryButtonHoverFontColor=r.primaryButtonFontColor),r.primaryButtonActiveFontColor||(r.primaryButtonActiveFontColor=r.primaryButtonFontColor),!r.primaryButtonHoverBackgroundColor||!r.primaryButtonActiveBackgroundColor){const[b,C]=w(r.primaryButtonBackgroundColor,[r.primaryButtonFontColor]);r.primaryButtonHoverBackgroundColor||(r.primaryButtonHoverBackgroundColor=b),r.primaryButtonActiveBackgroundColor||(r.primaryButtonActiveBackgroundColor=C)}if(r.primaryButtonBorderColor||(r.primaryButtonBorderColor=r.widgetBackgroundColor),r.primaryButtonHoverBorderColor||(r.primaryButtonHoverBorderColor=r.primaryButtonHoverBackgroundColor),r.primaryButtonActiveBorderColor||(r.primaryButtonActiveBorderColor=r.primaryButtonActiveBackgroundColor),r.defaultButtonBackgroundColor||(r.defaultButtonBackgroundColor=r.mainBackgroundColor),r.defaultButtonFontColor||(r.defaultButtonFontColor=a),r.defaultButtonHoverFontColor||(r.defaultButtonHoverFontColor=r.defaultButtonFontColor),r.defaultButtonActiveFontColor||(r.defaultButtonActiveFontColor=r.defaultButtonFontColor),!r.defaultButtonHoverBackgroundColor||!r.defaultButtonActiveBackgroundColor){const[b,C]=w(r.defaultButtonBackgroundColor,[r.defaultButtonFontColor]);r.defaultButtonHoverBackgroundColor||(r.defaultButtonHoverBackgroundColor=b),r.defaultButtonActiveBackgroundColor||(r.defaultButtonActiveBackgroundColor=C)}return r.defaultButtonBorderColor||(r.defaultButtonBorderColor=r.defaultButtonFontColor),r.defaultButtonHoverBorderColor||(r.defaultButtonHoverBorderColor=r.defaultButtonBorderColor),r.defaultButtonActiveBorderColor||(r.defaultButtonActiveBorderColor=r.defaultButtonBorderColor),r.launcherButtonBackgroundColor||(r.launcherButtonBackgroundColor=r.brandBackgroundColor),r.launcherButtonBorderColor||(r.launcherButtonBorderColor=r.brandBackgroundColor),r.launcherButtonFontColor||(r.launcherButtonFontColor=r.brandForegroundColor),r.launcherButtonHoverBackgroundColor||(r.launcherButtonHoverBackgroundColor=r.brandHoverBackgroundColor),r.launcherButtonHoverBorderColor||(r.launcherButtonHoverBorderColor=r.launcherButtonHoverBackgroundColor),r.launcherButtonHoverFontColor||(r.launcherButtonHoverFontColor=r.launcherButtonFontColor),r.launcherButtonActiveBackgroundColor||(r.launcherButtonActiveBackgroundColor=r.brandActiveBackgroundColor),r.launcherButtonActiveBorderColor||(r.launcherButtonActiveBorderColor=r.launcherButtonActiveBackgroundColor),r.launcherButtonActiveFontColor||(r.launcherButtonActiveFontColor=r.launcherButtonFontColor),r}function vo(o){const{questionColor:t}=o;return{"--userflow-backdrop-highlight-color-rgb":B(o.backdropHighlightColor),"--userflow-backdrop-highlight-inset":o.backdropHighlightType===fo.INSIDE?"inset":"","--userflow-backdrop-highlight-opacity":o.backdropHighlightOpacity,"--userflow-backdrop-highlight-radius":o.backdropHighlightRadius+"px","--userflow-backdrop-highlight-spread":o.backdropHighlightSpread+"px","--userflow-backdrop-opacity":o.backdropOpacity,"--userflow-banner-background-color":o.bannerBackgroundColor,"--userflow-banner-hover-background-color":o.bannerHoverBackgroundColor,"--userflow-banner-active-background-color":o.bannerActiveBackgroundColor,"--userflow-banner-foreground-color":o.bannerForegroundColor,"--userflow-banner-hover-foreground-color":o.bannerHoverForegroundColor,"--userflow-banner-active-foreground-color":o.bannerActiveForegroundColor,"--userflow-beacon-color":o.beaconColor,"--userflow-beacon-size":o.beaconSize+"px","--userflow-brand-active-background-color":o.brandActiveBackgroundColor,"--userflow-brand-background-color":o.brandBackgroundColor,"--userflow-brand-foreground-color":o.brandForegroundColor,"--userflow-brand-foreground-color-rgb":B(o.brandForegroundColor),"--userflow-brand-hover-background-color":o.brandHoverBackgroundColor,"--userflow-bubble-border-color":o.bubbleBorderColor,"--userflow-bubble-border-radius":o.bubbleBorderRadius+"px","--userflow-bubble-border-width":o.bubbleBorderWidth+"px","--userflow-button-border-radius":o.buttonBorderRadius+"px","--userflow-button-height":o.buttonHeight+"px","--userflow-button-min-width":o.buttonMinWidth+"px","--userflow-button-text-align":o.buttonMinWidth===0?"start":"center","--userflow-buttons-justify-content":o.buttonHorizontalAlign==="left"?"start":o.buttonHorizontalAlign==="right"?"end":"center","--userflow-buttons-bubble-justify-content":o.buttonHorizontalAlign==="left"?"start":o.buttonHorizontalAlign==="center"?"center":"end","--userflow-checklist-launcher-active-background-color":o.checklistLauncherActiveBackgroundColor,"--userflow-checklist-launcher-background-color":o.checklistLauncherBackgroundColor,"--userflow-checklist-launcher-border-radius":o.checklistLauncherBorderRadius+"px","--userflow-checklist-launcher-counter-background-color":o.checklistLauncherCounterBackgroundColor,"--userflow-checklist-launcher-counter-font-color":o.checklistLauncherCounterFontColor,"--userflow-checklist-launcher-font-color-rgb":B(o.checklistLauncherFontColor),"--userflow-checklist-launcher-font-color":o.checklistLauncherFontColor,"--userflow-checklist-launcher-font-weight":String(o.checklistLauncherFontWeight),"--userflow-checklist-launcher-height":o.checklistLauncherHeight+"px","--userflow-checklist-launcher-hover-background-color":o.checklistLauncherHoverBackgroundColor,"--userflow-checkmark-background-color":o.checkmarkBackgroundColor,"--userflow-completed-task-text-decoration":o.completedTaskTextDecoration,"--userflow-default-button-active-background-color":o.defaultButtonActiveBackgroundColor,"--userflow-default-button-active-border-color":o.defaultButtonActiveBorderColor,"--userflow-default-button-active-font-color":o.defaultButtonActiveFontColor,"--userflow-default-button-background-color":o.defaultButtonBackgroundColor,"--userflow-default-button-border-color":o.defaultButtonBorderColor,"--userflow-default-button-border-width":o.defaultButtonBorderWidth+"px","--userflow-default-button-font-color":o.defaultButtonFontColor,"--userflow-default-button-font-weight":String(o.defaultButtonFontWeight),"--userflow-default-button-hover-background-color":o.defaultButtonHoverBackgroundColor,"--userflow-default-button-hover-border-color":o.defaultButtonHoverBorderColor,"--userflow-default-button-hover-font-color":o.defaultButtonHoverFontColor,"--userflow-focus-color":`rgba(${B(o.focusColor)}, ${o.focusOpacity})`,"--userflow-font-family":o.builtinFontFamily?Fo(o.builtinFontFamily.name)+(o.builtinFontFamily.fallback?", "+o.builtinFontFamily.fallback:""):o.fontFamily?o.fontFamily:"sans-serif","--userflow-font-size":o.fontSize+"px","--userflow-font-weight-bold":String(o.fontWeightBold),"--userflow-font-weight-normal":String(o.fontWeightNormal),"--userflow-h1-font-size":o.h1FontSize+"px","--userflow-h2-font-size":o.h2FontSize+"px","--userflow-launcher-button-active-background-color":o.launcherButtonActiveBackgroundColor,"--userflow-launcher-button-active-border-color":o.launcherButtonActiveBorderColor,"--userflow-launcher-button-active-font-color":o.launcherButtonActiveFontColor,"--userflow-launcher-button-background-color":o.launcherButtonBackgroundColor,"--userflow-launcher-button-border-color":o.launcherButtonBorderColor,"--userflow-launcher-button-border-radius":o.launcherButtonBorderRadius+"px","--userflow-launcher-button-border-width":o.launcherButtonBorderWidth+"px","--userflow-launcher-button-font-color":o.launcherButtonFontColor,"--userflow-launcher-button-font-weight":String(o.launcherButtonFontWeight),"--userflow-launcher-button-height":o.launcherButtonHeight+"px","--userflow-launcher-button-horizontal-padding":o.launcherButtonHorizontalPadding+"px","--userflow-launcher-button-hover-background-color":o.launcherButtonHoverBackgroundColor,"--userflow-launcher-button-hover-border-color":o.launcherButtonHoverBorderColor,"--userflow-launcher-button-hover-font-color":o.launcherButtonHoverFontColor,"--userflow-launcher-button-width":o.launcherButtonWidth?o.launcherButtonWidth+"px":"auto","--userflow-launcher-icon-active-color":o.launcherIconActiveColor,"--userflow-launcher-icon-color":o.launcherIconColor,"--userflow-launcher-icon-hover-color":o.launcherIconHoverColor,"--userflow-launcher-icon-opacity":o.launcherIconOpacity,"--userflow-launcher-icon-size":o.launcherIconSize+"px","--userflow-line-height":o.lineHeight+"px","--userflow-link-color":o.linkColor,"--userflow-main-active-background-color":o.mainActiveBackgroundColor,"--userflow-main-background-color":o.mainBackgroundColor,"--userflow-main-background-color-rgb":B(o.mainBackgroundColor),"--userflow-main-foreground-color":o.mainForegroundColor,"--userflow-main-foreground-color-rgb":B(o.mainForegroundColor),"--userflow-main-hover-background-color":o.mainHoverBackgroundColor,"--userflow-modal-padding":o.modalPadding+"px","--userflow-modal-padding-top":(o.avatarType===go.NONE?o.modalPadding:o.modalPadding+Math.max((o.avatarSize-o.modalPadding)/2,0))+"px","--userflow-backdrop-color-rgb":B(o.backdropColor),"--userflow-notch-color":o.bubbleBorderWidth>0&&o.bubbleBorderColor||o.mainBackgroundColor,"--userflow-primary-button-active-background-color":o.primaryButtonActiveBackgroundColor,"--userflow-primary-button-active-border-color":o.primaryButtonActiveBorderColor,"--userflow-primary-button-active-font-color":o.primaryButtonActiveFontColor,"--userflow-primary-button-background-color":o.primaryButtonBackgroundColor,"--userflow-primary-button-border-color":o.primaryButtonBorderColor,"--userflow-primary-button-border-width":o.primaryButtonBorderWidth+"px","--userflow-primary-button-font-color":o.primaryButtonFontColor,"--userflow-primary-button-font-weight":String(o.primaryButtonFontWeight),"--userflow-primary-button-hover-background-color":o.primaryButtonHoverBackgroundColor,"--userflow-primary-button-hover-border-color":o.primaryButtonHoverBorderColor,"--userflow-primary-button-hover-font-color":o.primaryButtonHoverFontColor,"--userflow-progress-bar-color":o.progressBarColor,"--userflow-progress-bar-height":o.progressBarHeight+"px","--userflow-narrow-progress-bar-height":o.narrowBarHeight+"px","--userflow-squared-progress-bar-height":o.squaredBarHeight+"px","--userflow-rounded-progress-bar-height":o.roundedBarHeight+"px","--userflow-dotted-progress-bar-height":o.dottedBarHeight+"px","--userflow-numbered-progress-bar-height":o.numberedBarFontSize+"px","--userflow-resource-center-collapsed-height":o.resourceCenterCollapsedHeight+"px","--userflow-resource-center-launcher-icon-img-size":o.rcIconSize+"px","--userflow-resource-center-full-width":o.resourceCenterFullWidth+"px","--userflow-resource-center-launcher-border-radius":(o.resourceCenterLauncherBorderRadius!=null?Math.min(o.resourceCenterLauncherBorderRadius,o.resourceCenterCollapsedHeight/2):o.resourceCenterCollapsedHeight/2)+"px","--userflow-resource-center-padding-x":o.resourceCenterPaddingX+"px","--userflow-resource-center-padding-y":o.resourceCenterPaddingY+"px","--userflow-resource-center-transition-duration":o.resourceCenterTransitionDuration+"ms","--userflow-resource-center-width":o.resourceCenterWidth+"px","--userflow-question-color-light":h(t,o.mainBackgroundColor,.5),"--userflow-question-color-lighter":h(t,o.mainBackgroundColor,.75),"--userflow-question-color-lightest":h(t,o.mainBackgroundColor,.9),"--userflow-question-color-medium-light":h(t,o.mainBackgroundColor,.15),"--userflow-question-color":t,"--userflow-toast-padding":o.toastPadding+"px","--userflow-toast-auto-dismiss":o.toastAutoDismiss+"ms","--userflow-toast-placement":o.toastPlacement+"px","--userflow-toast-width":o.toastWidth+"px","--userflow-toolbar-foreground-color":o.toolbarForegroundColor,"--userflow-toolbar-foreground-color-rgb":B(o.toolbarForegroundColor),"--userflow-tooltip-notch-size":o.tooltipNotchSize+"px","--userflow-unread-badge-background-color":o.unreadBadgeBackgroundColor,"--userflow-unread-badge-foreground-color":o.unreadBadgeForegroundColor,"--userflow-widget-active-background-color":o.widgetActiveBackgroundColor,"--userflow-widget-background-color":o.widgetBackgroundColor,"--userflow-widget-foreground-color":o.widgetForegroundColor,"--userflow-widget-hover-background-color":o.widgetHoverBackgroundColor}}const yo=[];function Ro(o){let[t,n]=p.useState(o);const e=Bo(o.sessionData||yo);return p.useLayoutEffect(()=>{const{variations:l}=o;if(!l)return;const a=[],c=[],i=()=>{let u=o,r=!1;for(const[s,g]of l.entries())if(a[s]){r||(r=!0,u={...u});for(const d of g.overriddenKeys){const f=d,b=g[f];u[f]=b}}n(u)};for(const[u,r]of l.entries()){a[u]=!1;const{condition:s}=r;if(s&&r.overriddenKeys&&r.overriddenKeys.length>0){const d=bo[s.type].track({sessionData:e,condition:s,callback:f=>{a[u]=f,i()}});c[u]=d}else c[u]=()=>{}}return i(),()=>{for(const u of c)u()}},[o,e]),p.useMemo(()=>ho(t),[t])}function Po(o){return o?.cssVersion?`https://cdn.userflow.com/themes/${o.id}/stylesheets/${o.cssVersion}/custom.css`:null}function Fo(o){return`"${o.trim()}"`}const M=new Map;function W(o){let t=M.get(o);return t||(t={stylesheets:new Map},M.set(o,t)),t}function Do(o,t,n,{uninstallOnUnmount:e}={}){const l=Co(),[a,c]=p.useState(!t);return p.useLayoutEffect(()=>{if(!o||!t)return;let i=!1,u;const r=async d=>{await E(l,o,d),u&&T(o,u),u=d};(async()=>{let d=typeof t=="string"?t:t.get();if(Ho()&&n){let f=await Ao(d);if(i)return;f=xo(f,vo(n)),d="data:text/css;base64,"+btoa(f)}await r(d),!i&&c(!0)})();let g=null;return typeof t!="string"&&(g=t.onUpdate(async()=>{r(t.get())})),()=>{i=!0,g&&g(),e&&u&&T(o,u)}},[l,o,t,n,e]),{loaded:a}}function Ho(){return!!window.MSInputMethodContext&&!!document.documentMode}const I=new Map;function Ao(o){return new Promise((t,n)=>{let e=I.get(o);if(e){t(e);return}const l=new XMLHttpRequest;l.addEventListener("load",()=>{if(l.status!==200){n(new Error("Userflow.js could not fetch stylesheet: "+o));return}const a=l.responseText;I.set(o,a),t(a)}),l.addEventListener("error",()=>{n(new Error("Userflow.js could not fetch stylesheet: "+o))}),l.open("GET",o),l.send()})}function xo(o,t){for(const n in t)if(t.hasOwnProperty(n)){const e=t[n];e&&(o=o.replace(new RegExp(`var\\(${n}.*?\\)`,"g"),e))}return o=o.replace(/var\(--[a-z0-9-]+(,\s*(.*?))?\)/g,"$2"),o}function zo(o,t){const n=t&&So(t),e=n?.url,l=n?.fontFamily,[a,c]=p.useState(!e||!l);return p.useLayoutEffect(()=>{if(!o||!e||!l)return;let i=!1;return E(null,o,e),po(o,l,()=>{i||c(!0)}),()=>{i=!0}},[o,e,l]),{loaded:a}}function E(o,t,n){const e=W(t),l=e.stylesheets.get(n);if(l)return l.loadPromise;const a=t.document.createElement("link"),c=new Promise((i,u)=>{a.dataset.userflowStylesheet="true",a.rel="stylesheet",a.href=n,a.onload=()=>{i()},a.onerror=r=>{console.log(`Userflow.js: Error installing Stylesheet ${n}:`,r),o&&o.reportCspIssue(),u()},t.document.head.appendChild(a)});return e.stylesheets.set(n,{link:a,loadPromise:c}),c}function T(o,t){const n=W(o),e=n.stylesheets.get(t);e&&(o.document.head.removeChild(e.link),n.stylesheets.delete(t))}function So(o){if(o.builtinFontFamily)switch(o.builtinFontFamily.provider){case H.GOOGLE:{const t=Array.from(new Set(["0,400","1,400",`0,${o.fontWeightBold}`,`0,${o.fontWeightNormal}`,`0,${o.defaultButtonFontWeight}`,`0,${o.primaryButtonFontWeight}`,`0,${o.checklistLauncherFontWeight}`,`0,${o.launcherButtonFontWeight}`])).sort().join(";");return{url:`https://fonts.googleapis.com/css2?family=${encodeURIComponent(o.builtinFontFamily.name)}:ital,wght@${t}`,fontFamily:o.builtinFontFamily.name}}case H.STANDARD:return null}else return o.fontCssUrl?{url:o.fontCssUrl,fontFamily:o.fontFamily}:null}export{$o as D,Do as a,zo as b,Bo as c,Po as d,vo as g,Ro as u};
1
+ import{r as p,R as y}from"./vendor.react.js";import{V as R,W as $,R as P,P as D,X as z,z as U,Y as O,Z as q,x as _,_ as j,$ as N,a0 as K,Q as V,i as G,a1 as Y,a2 as Q,a3 as X,b as Z,a4 as J}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{e as oo,g as ro,h as to,i as no,j as eo,k as lo,l as ao,m as uo,n as co,o as io}from"./vendor.fortawesome.pro-solid-svg-icons.js";import"./vendor.core-js.js";import{j as so,a2 as fo,L as go,a7 as H}from"./userflow.js";import{c as bo}from"./flow-condition-types.js";import{a as Co}from"./client-context.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]="682a7d0f-c511-456d-8b3f-b2f5cf6fd950",o._sentryDebugIdIdentifier="sentry-dbid-682a7d0f-c511-456d-8b3f-b2f5cf6fd950")}catch{}})();function Bo(o){const[t]=p.useState(()=>new so(o));return t.update(o),t}const Ro=({icon:o,size:t,dataAttrs:n})=>{t=t||16;const e=typeof o=="string"&&A[o]?A[o]:o;if(typeof e=="string")return y.createElement("img",{...n,"aria-hidden":"true",src:e,width:t,height:t,style:{objectFit:"contain"}});{const l=e.icon[0],a=e.icon[1],c=e.icon[4];return y.createElement("svg",{"aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:`0 0 ${l} ${a}`,...n},y.createElement("path",{fill:"currentColor",d:String(c)}))}},A={"regular/calendar-day":R,"regular/comment-alt":$,"regular/comments-alt":P,"regular/envelope":D,"regular/exclamation-triangle":z,"regular/external-link":U,"regular/file-alt":O,"regular/graduation-cap":q,"regular/info-circle":_,"regular/lightbulb":j,"regular/megaphone":N,"regular/pencil":K,"regular/phone":V,"regular/play-circle":G,"regular/question-circle":Y,"regular/shoe-prints":Q,"solid/shoe-prints":oo,"solid/file-invoice":ro,"solid/receipt":to,"solid/university":no,"solid/users":eo,"solid/stars":lo,"regular/tasks":X,"regular/user":Z,"regular/users":J,"solid/exclamation-triangle":ao,"solid/info-circle":uo,"solid/play-circle":co,"solid/question-circle":io};function po(o,t,n){if(!o.document.fonts)return n(),()=>{};let e=!1;const l=()=>{const i=o.document.fonts.load(`100px ${t}`,"BESbswy");if(!i){c(),n();return}i.then(u=>{e||(u.length>=1?(c(),n()):window.setTimeout(l,25))},u=>{console.log("Userflow.js: observeFont error:"),console.log(u),n()})};l();const a=window.setTimeout(()=>{console.warn(`Userflow.js: Timed out waiting for font family ${t} to load. Will continue anyway.`),n()},2e3),c=()=>{e=!0,window.clearTimeout(a)};return c}function k(o){return o?o.match(/^#[0-9a-f]{6}$/i)?[parseInt(o.substring(1,3),16),parseInt(o.substring(3,5),16),parseInt(o.substring(5,7),16)]:o.match(/^#[0-9a-f]{3}$/i)?[parseInt(o.substring(1,2).repeat(2),16),parseInt(o.substring(2,3).repeat(2),16),parseInt(o.substring(3,4).repeat(2),16)]:[0,0,0]:[0,0,0]}function v([o,t,n]){return"#"+o.toString(16).padStart(2,"0")+t.toString(16).padStart(2,"0")+n.toString(16).padStart(2,"0")}function B(o){const t=k(o);return t?t.join(", "):"0, 0, 0"}function x(o){return v(k(o))}function ko([o,t,n]){return[Math.round(255-o),Math.round(255-t),Math.round(255-n)]}function F(o,t,n){return[Math.max(0,Math.min(255,Math.round(o[0]+(t[0]-o[0])*n))),Math.max(0,Math.min(255,Math.round(o[1]+(t[1]-o[1])*n))),Math.max(0,Math.min(255,Math.round(o[2]+(t[2]-o[2])*n)))]}function h(o,t,n){const e=k(o),l=k(t);return!e||!l?o:v(F(e,l,n))}function S([o,t,n]){o/=255,t/=255,n/=255;const e=Math.max(o,t,n),l=Math.min(o,t,n);let a,c,i=(e+l)/2;if(e==l)a=c=0;else{const u=e-l;switch(c=i>.5?u/(2-e-l):u/(e+l),e){case o:a=(t-n)/u+(t<n?6:0);break;case t:a=(n-o)/u+2;break;default:a=(o-t)/u+4;break}a/=6}return[a,c,i]}function m([o,t,n]){let e=o/255,l=t/255,a=n/255;function c(r){let s=0;return r<=.04045?s=r/12.92:s=Math.pow((r+.055)/1.055,2.4),s}let i=.2126*c(e)+.7152*c(l)+.0722*c(a);function u(r){let s=0;return r<=216/24389?s=r*(24389/27):s=Math.pow(r,1/3)*116-16,s}return Math.round(u(i)*10)/1e3}function L(o,t){const n=m(o),e=m(t),l=.05;let i=(1-(e-n))/2*(.18-l)+l,u=1-Math.abs(e-n),r=Math.pow((1-i)*u,4),s=i+r;return Math.round(s*1e3)/1e3}function w(o,t){const n=k(o),e=S(n);let l=null,a=null;for(const g of t){const d=k(g),f=S(d);let b=!1;!l||!a?b=!0:Math.abs(f[2]-e[2])>.3?f[1]>a[1]&&(b=!0):Math.abs(e[2]-f[2])>Math.abs(e[2]-a[2])&&(b=!0),b&&(l=d,a=f)}let c=l,i=l,u=L(c,n),r=u*2;const s=.2;return e[2]>s&&e[2]<1-s&&(i=ko(i),r=L(i,n)),[v(F(n,c,u)),v(F(n,i,r))]}function wo(o,t,n,e){const[l,a]=w(o,[t]);let c,i;if(o===n)c=l,i=a;else{const C=w(n,[o,t,e]);c=C[0],i=C[1]}const u=k(o),r=k(n),s=20;let g,d,f,b;if(Math.abs(u[0]-r[0])<s&&Math.abs(u[1]-r[1])<s&&Math.abs(u[2]-r[2])<s){g=t,d=o;const C=w(g,[d]);f=C[0],b=C[1]}else g=o,d=t,f=l,b=a;return[l,a,c,i,g,d,f,b]}function ho(o){const[t,n,e,l,a,c,i,u]=wo(o.brandBackgroundColor,o.brandForegroundColor,o.mainBackgroundColor,o.mainForegroundColor),r={...o,widgetBackgroundColor:a,widgetForegroundColor:c,widgetHoverBackgroundColor:i,widgetActiveBackgroundColor:u,sameBackground:x(o.mainBackgroundColor)==x(o.brandBackgroundColor)};r.brandHoverBackgroundColor&&(r.widgetHoverBackgroundColor=r.brandHoverBackgroundColor),r.brandActiveBackgroundColor&&(r.widgetActiveBackgroundColor=r.brandActiveBackgroundColor),r.brandHoverBackgroundColor||(r.brandHoverBackgroundColor=t),r.brandActiveBackgroundColor||(r.brandActiveBackgroundColor=n),r.mainHoverBackgroundColor||(r.mainHoverBackgroundColor=e),r.mainActiveBackgroundColor||(r.mainActiveBackgroundColor=l),r.bannerBackgroundColor||(r.bannerBackgroundColor=r.brandBackgroundColor),r.bannerForegroundColor||(r.bannerForegroundColor=r.brandForegroundColor);const[s,g]=w(r.bannerBackgroundColor,[r.bannerForegroundColor]);r.bannerHoverBackgroundColor=s,r.bannerActiveBackgroundColor=g;const[d,f]=w(r.bannerForegroundColor,[r.bannerBackgroundColor]);if(r.bannerHoverForegroundColor=d,r.bannerActiveForegroundColor=f,r.bubbleBorderColor||(r.bubbleBorderColor=r.mainForegroundColor),r.checklistLauncherActiveBackgroundColor||(r.checklistLauncherActiveBackgroundColor=r.brandActiveBackgroundColor),r.checklistLauncherBackgroundColor||(r.checklistLauncherBackgroundColor=r.brandBackgroundColor),r.checklistLauncherCounterBackgroundColor||(r.checklistLauncherCounterBackgroundColor=r.brandForegroundColor),r.checklistLauncherCounterFontColor||(r.checklistLauncherCounterFontColor=r.brandBackgroundColor),r.checklistLauncherFontColor||(r.checklistLauncherFontColor=r.brandForegroundColor),r.checklistLauncherHoverBackgroundColor||(r.checklistLauncherHoverBackgroundColor=r.brandHoverBackgroundColor),r.focusColor||(r.focusColor=r.mainActiveBackgroundColor),r.launcherIconActiveColor||(r.launcherIconActiveColor=r.brandActiveBackgroundColor),r.launcherIconColor||(r.launcherIconColor=r.brandBackgroundColor),r.launcherIconHoverColor||(r.launcherIconHoverColor=r.brandHoverBackgroundColor),r.linkColor||(r.linkColor=r.widgetBackgroundColor),r.progressBarColor||(r.progressBarColor=r.widgetBackgroundColor),r.questionColor||(r.questionColor=r.widgetBackgroundColor),r.toolbarForegroundColor||(r.toolbarForegroundColor=r.mainForegroundColor),r.primaryButtonBackgroundColor||(r.primaryButtonBackgroundColor=r.widgetBackgroundColor),r.primaryButtonFontColor||(r.primaryButtonFontColor=r.widgetForegroundColor),r.primaryButtonHoverFontColor||(r.primaryButtonHoverFontColor=r.primaryButtonFontColor),r.primaryButtonActiveFontColor||(r.primaryButtonActiveFontColor=r.primaryButtonFontColor),!r.primaryButtonHoverBackgroundColor||!r.primaryButtonActiveBackgroundColor){const[b,C]=w(r.primaryButtonBackgroundColor,[r.primaryButtonFontColor]);r.primaryButtonHoverBackgroundColor||(r.primaryButtonHoverBackgroundColor=b),r.primaryButtonActiveBackgroundColor||(r.primaryButtonActiveBackgroundColor=C)}if(r.primaryButtonBorderColor||(r.primaryButtonBorderColor=r.widgetBackgroundColor),r.primaryButtonHoverBorderColor||(r.primaryButtonHoverBorderColor=r.primaryButtonHoverBackgroundColor),r.primaryButtonActiveBorderColor||(r.primaryButtonActiveBorderColor=r.primaryButtonActiveBackgroundColor),r.defaultButtonBackgroundColor||(r.defaultButtonBackgroundColor=r.mainBackgroundColor),r.defaultButtonFontColor||(r.defaultButtonFontColor=a),r.defaultButtonHoverFontColor||(r.defaultButtonHoverFontColor=r.defaultButtonFontColor),r.defaultButtonActiveFontColor||(r.defaultButtonActiveFontColor=r.defaultButtonFontColor),!r.defaultButtonHoverBackgroundColor||!r.defaultButtonActiveBackgroundColor){const[b,C]=w(r.defaultButtonBackgroundColor,[r.defaultButtonFontColor]);r.defaultButtonHoverBackgroundColor||(r.defaultButtonHoverBackgroundColor=b),r.defaultButtonActiveBackgroundColor||(r.defaultButtonActiveBackgroundColor=C)}return r.defaultButtonBorderColor||(r.defaultButtonBorderColor=r.defaultButtonFontColor),r.defaultButtonHoverBorderColor||(r.defaultButtonHoverBorderColor=r.defaultButtonBorderColor),r.defaultButtonActiveBorderColor||(r.defaultButtonActiveBorderColor=r.defaultButtonBorderColor),r.launcherButtonBackgroundColor||(r.launcherButtonBackgroundColor=r.brandBackgroundColor),r.launcherButtonBorderColor||(r.launcherButtonBorderColor=r.brandBackgroundColor),r.launcherButtonFontColor||(r.launcherButtonFontColor=r.brandForegroundColor),r.launcherButtonHoverBackgroundColor||(r.launcherButtonHoverBackgroundColor=r.brandHoverBackgroundColor),r.launcherButtonHoverBorderColor||(r.launcherButtonHoverBorderColor=r.launcherButtonHoverBackgroundColor),r.launcherButtonHoverFontColor||(r.launcherButtonHoverFontColor=r.launcherButtonFontColor),r.launcherButtonActiveBackgroundColor||(r.launcherButtonActiveBackgroundColor=r.brandActiveBackgroundColor),r.launcherButtonActiveBorderColor||(r.launcherButtonActiveBorderColor=r.launcherButtonActiveBackgroundColor),r.launcherButtonActiveFontColor||(r.launcherButtonActiveFontColor=r.launcherButtonFontColor),r}function vo(o){const{questionColor:t}=o;return{"--userflow-backdrop-highlight-color-rgb":B(o.backdropHighlightColor),"--userflow-backdrop-highlight-inset":o.backdropHighlightType===fo.INSIDE?"inset":"","--userflow-backdrop-highlight-opacity":o.backdropHighlightOpacity,"--userflow-backdrop-highlight-radius":o.backdropHighlightRadius+"px","--userflow-backdrop-highlight-spread":o.backdropHighlightSpread+"px","--userflow-backdrop-opacity":o.backdropOpacity,"--userflow-banner-background-color":o.bannerBackgroundColor,"--userflow-banner-hover-background-color":o.bannerHoverBackgroundColor,"--userflow-banner-active-background-color":o.bannerActiveBackgroundColor,"--userflow-banner-foreground-color":o.bannerForegroundColor,"--userflow-banner-hover-foreground-color":o.bannerHoverForegroundColor,"--userflow-banner-active-foreground-color":o.bannerActiveForegroundColor,"--userflow-beacon-color":o.beaconColor,"--userflow-beacon-size":o.beaconSize+"px","--userflow-brand-active-background-color":o.brandActiveBackgroundColor,"--userflow-brand-background-color":o.brandBackgroundColor,"--userflow-brand-foreground-color":o.brandForegroundColor,"--userflow-brand-foreground-color-rgb":B(o.brandForegroundColor),"--userflow-brand-hover-background-color":o.brandHoverBackgroundColor,"--userflow-bubble-border-color":o.bubbleBorderColor,"--userflow-bubble-border-radius":o.bubbleBorderRadius+"px","--userflow-bubble-border-width":o.bubbleBorderWidth+"px","--userflow-button-border-radius":o.buttonBorderRadius+"px","--userflow-button-height":o.buttonHeight+"px","--userflow-button-min-width":o.buttonMinWidth+"px","--userflow-button-text-align":o.buttonMinWidth===0?"start":"center","--userflow-buttons-justify-content":o.buttonHorizontalAlign==="left"?"start":o.buttonHorizontalAlign==="right"?"end":"center","--userflow-buttons-bubble-justify-content":o.buttonHorizontalAlign==="left"?"start":o.buttonHorizontalAlign==="center"?"center":"end","--userflow-checklist-launcher-active-background-color":o.checklistLauncherActiveBackgroundColor,"--userflow-checklist-launcher-background-color":o.checklistLauncherBackgroundColor,"--userflow-checklist-launcher-border-radius":o.checklistLauncherBorderRadius+"px","--userflow-checklist-launcher-counter-background-color":o.checklistLauncherCounterBackgroundColor,"--userflow-checklist-launcher-counter-font-color":o.checklistLauncherCounterFontColor,"--userflow-checklist-launcher-font-color-rgb":B(o.checklistLauncherFontColor),"--userflow-checklist-launcher-font-color":o.checklistLauncherFontColor,"--userflow-checklist-launcher-font-weight":String(o.checklistLauncherFontWeight),"--userflow-checklist-launcher-height":o.checklistLauncherHeight+"px","--userflow-checklist-launcher-hover-background-color":o.checklistLauncherHoverBackgroundColor,"--userflow-checkmark-background-color":o.checkmarkBackgroundColor,"--userflow-completed-task-text-decoration":o.completedTaskTextDecoration,"--userflow-default-button-active-background-color":o.defaultButtonActiveBackgroundColor,"--userflow-default-button-active-border-color":o.defaultButtonActiveBorderColor,"--userflow-default-button-active-font-color":o.defaultButtonActiveFontColor,"--userflow-default-button-background-color":o.defaultButtonBackgroundColor,"--userflow-default-button-border-color":o.defaultButtonBorderColor,"--userflow-default-button-border-width":o.defaultButtonBorderWidth+"px","--userflow-default-button-font-color":o.defaultButtonFontColor,"--userflow-default-button-font-weight":String(o.defaultButtonFontWeight),"--userflow-default-button-hover-background-color":o.defaultButtonHoverBackgroundColor,"--userflow-default-button-hover-border-color":o.defaultButtonHoverBorderColor,"--userflow-default-button-hover-font-color":o.defaultButtonHoverFontColor,"--userflow-focus-color":`rgba(${B(o.focusColor)}, ${o.focusOpacity})`,"--userflow-font-family":o.builtinFontFamily?Fo(o.builtinFontFamily.name)+(o.builtinFontFamily.fallback?", "+o.builtinFontFamily.fallback:""):o.fontFamily?o.fontFamily:"sans-serif","--userflow-font-size":o.fontSize+"px","--userflow-font-weight-bold":String(o.fontWeightBold),"--userflow-font-weight-normal":String(o.fontWeightNormal),"--userflow-h1-font-size":o.h1FontSize+"px","--userflow-h2-font-size":o.h2FontSize+"px","--userflow-launcher-button-active-background-color":o.launcherButtonActiveBackgroundColor,"--userflow-launcher-button-active-border-color":o.launcherButtonActiveBorderColor,"--userflow-launcher-button-active-font-color":o.launcherButtonActiveFontColor,"--userflow-launcher-button-background-color":o.launcherButtonBackgroundColor,"--userflow-launcher-button-border-color":o.launcherButtonBorderColor,"--userflow-launcher-button-border-radius":o.launcherButtonBorderRadius+"px","--userflow-launcher-button-border-width":o.launcherButtonBorderWidth+"px","--userflow-launcher-button-font-color":o.launcherButtonFontColor,"--userflow-launcher-button-font-weight":String(o.launcherButtonFontWeight),"--userflow-launcher-button-height":o.launcherButtonHeight+"px","--userflow-launcher-button-horizontal-padding":o.launcherButtonHorizontalPadding+"px","--userflow-launcher-button-hover-background-color":o.launcherButtonHoverBackgroundColor,"--userflow-launcher-button-hover-border-color":o.launcherButtonHoverBorderColor,"--userflow-launcher-button-hover-font-color":o.launcherButtonHoverFontColor,"--userflow-launcher-button-width":o.launcherButtonWidth?o.launcherButtonWidth+"px":"auto","--userflow-launcher-icon-active-color":o.launcherIconActiveColor,"--userflow-launcher-icon-color":o.launcherIconColor,"--userflow-launcher-icon-hover-color":o.launcherIconHoverColor,"--userflow-launcher-icon-opacity":o.launcherIconOpacity,"--userflow-launcher-icon-size":o.launcherIconSize+"px","--userflow-line-height":o.lineHeight+"px","--userflow-link-color":o.linkColor,"--userflow-main-active-background-color":o.mainActiveBackgroundColor,"--userflow-main-background-color":o.mainBackgroundColor,"--userflow-main-background-color-rgb":B(o.mainBackgroundColor),"--userflow-main-foreground-color":o.mainForegroundColor,"--userflow-main-foreground-color-rgb":B(o.mainForegroundColor),"--userflow-main-hover-background-color":o.mainHoverBackgroundColor,"--userflow-modal-padding":o.modalPadding+"px","--userflow-modal-padding-top":(o.avatarType===go.NONE?o.modalPadding:o.modalPadding+Math.max((o.avatarSize-o.modalPadding)/2,0))+"px","--userflow-backdrop-color-rgb":B(o.backdropColor),"--userflow-notch-color":o.bubbleBorderWidth>0&&o.bubbleBorderColor||o.mainBackgroundColor,"--userflow-primary-button-active-background-color":o.primaryButtonActiveBackgroundColor,"--userflow-primary-button-active-border-color":o.primaryButtonActiveBorderColor,"--userflow-primary-button-active-font-color":o.primaryButtonActiveFontColor,"--userflow-primary-button-background-color":o.primaryButtonBackgroundColor,"--userflow-primary-button-border-color":o.primaryButtonBorderColor,"--userflow-primary-button-border-width":o.primaryButtonBorderWidth+"px","--userflow-primary-button-font-color":o.primaryButtonFontColor,"--userflow-primary-button-font-weight":String(o.primaryButtonFontWeight),"--userflow-primary-button-hover-background-color":o.primaryButtonHoverBackgroundColor,"--userflow-primary-button-hover-border-color":o.primaryButtonHoverBorderColor,"--userflow-primary-button-hover-font-color":o.primaryButtonHoverFontColor,"--userflow-progress-bar-color":o.progressBarColor,"--userflow-progress-bar-height":o.progressBarHeight+"px","--userflow-narrow-progress-bar-height":o.narrowBarHeight+"px","--userflow-squared-progress-bar-height":o.squaredBarHeight+"px","--userflow-rounded-progress-bar-height":o.roundedBarHeight+"px","--userflow-dotted-progress-bar-height":o.dottedBarHeight+"px","--userflow-numbered-progress-bar-height":o.numberedBarFontSize+"px","--userflow-resource-center-collapsed-height":o.resourceCenterCollapsedHeight+"px","--userflow-resource-center-launcher-icon-img-size":o.rcIconSize+"px","--userflow-resource-center-full-width":o.resourceCenterFullWidth+"px","--userflow-resource-center-launcher-border-radius":(o.resourceCenterLauncherBorderRadius!=null?Math.min(o.resourceCenterLauncherBorderRadius,o.resourceCenterCollapsedHeight/2):o.resourceCenterCollapsedHeight/2)+"px","--userflow-resource-center-padding-x":o.resourceCenterPaddingX+"px","--userflow-resource-center-padding-y":o.resourceCenterPaddingY+"px","--userflow-resource-center-transition-duration":o.resourceCenterTransitionDuration+"ms","--userflow-resource-center-width":o.resourceCenterWidth+"px","--userflow-question-color-light":h(t,o.mainBackgroundColor,.5),"--userflow-question-color-lighter":h(t,o.mainBackgroundColor,.75),"--userflow-question-color-lightest":h(t,o.mainBackgroundColor,.9),"--userflow-question-color-medium-light":h(t,o.mainBackgroundColor,.15),"--userflow-question-color":t,"--userflow-toast-padding":o.toastPadding+"px","--userflow-toast-auto-dismiss":o.toastAutoDismiss+"ms","--userflow-toast-placement":o.toastPlacement+"px","--userflow-toast-width":o.toastWidth+"px","--userflow-toolbar-foreground-color":o.toolbarForegroundColor,"--userflow-toolbar-foreground-color-rgb":B(o.toolbarForegroundColor),"--userflow-tooltip-notch-size":o.tooltipNotchSize+"px","--userflow-unread-badge-background-color":o.unreadBadgeBackgroundColor,"--userflow-unread-badge-foreground-color":o.unreadBadgeForegroundColor,"--userflow-widget-active-background-color":o.widgetActiveBackgroundColor,"--userflow-widget-background-color":o.widgetBackgroundColor,"--userflow-widget-foreground-color":o.widgetForegroundColor,"--userflow-widget-hover-background-color":o.widgetHoverBackgroundColor}}const yo=[];function $o(o){let[t,n]=p.useState(o);const e=Bo(o.sessionData||yo);return p.useLayoutEffect(()=>{const{variations:l}=o;if(!l)return;const a=[],c=[],i=()=>{let u=o,r=!1;for(const[s,g]of l.entries())if(a[s]){r||(r=!0,u={...u});for(const d of g.overriddenKeys){const f=d,b=g[f];u[f]=b}}n(u)};for(const[u,r]of l.entries()){a[u]=!1;const{condition:s}=r;if(s&&r.overriddenKeys&&r.overriddenKeys.length>0){const d=bo[s.type].track({sessionData:e,condition:s,callback:f=>{a[u]=f,i()}});c[u]=d}else c[u]=()=>{}}return i(),()=>{for(const u of c)u()}},[o,e]),p.useMemo(()=>ho(t),[t])}function Po(o){return o?.cssVersion?`https://cdn.userflow.com/themes/${o.id}/stylesheets/${o.cssVersion}/custom.css`:null}function Fo(o){return`"${o.trim()}"`}const M=new Map;function W(o){let t=M.get(o);return t||(t={stylesheets:new Map},M.set(o,t)),t}function Do(o,t,n,{uninstallOnUnmount:e}={}){const l=Co(),[a,c]=p.useState(!t);return p.useLayoutEffect(()=>{if(!o||!t)return;let i=!1,u;const r=async d=>{await E(l,o,d),u&&T(o,u),u=d};(async()=>{let d=typeof t=="string"?t:t.get();if(Ho()&&n){let f=await Ao(d);if(i)return;f=xo(f,vo(n)),d="data:text/css;base64,"+btoa(f)}await r(d),!i&&c(!0)})();let g=null;return typeof t!="string"&&(g=t.onUpdate(async()=>{r(t.get())})),()=>{i=!0,g&&g(),e&&u&&T(o,u)}},[l,o,t,n,e]),{loaded:a}}function Ho(){return!!window.MSInputMethodContext&&!!document.documentMode}const I=new Map;function Ao(o){return new Promise((t,n)=>{let e=I.get(o);if(e){t(e);return}const l=new XMLHttpRequest;l.addEventListener("load",()=>{if(l.status!==200){n(new Error("Userflow.js could not fetch stylesheet: "+o));return}const a=l.responseText;I.set(o,a),t(a)}),l.addEventListener("error",()=>{n(new Error("Userflow.js could not fetch stylesheet: "+o))}),l.open("GET",o),l.send()})}function xo(o,t){for(const n in t)if(t.hasOwnProperty(n)){const e=t[n];e&&(o=o.replace(new RegExp(`var\\(${n}.*?\\)`,"g"),e))}return o=o.replace(/var\(--[a-z0-9-]+(,\s*(.*?))?\)/g,"$2"),o}function zo(o,t){const n=t&&So(t),e=n?.url,l=n?.fontFamily,[a,c]=p.useState(!e||!l);return p.useLayoutEffect(()=>{if(!o||!e||!l)return;let i=!1;return E(null,o,e),po(o,l,()=>{i||c(!0)}),()=>{i=!0}},[o,e,l]),{loaded:a}}function E(o,t,n){const e=W(t),l=e.stylesheets.get(n);if(l)return l.loadPromise;const a=t.document.createElement("link"),c=new Promise((i,u)=>{a.dataset.userflowStylesheet="true",a.rel="stylesheet",a.href=n,a.onload=()=>{i()},a.onerror=r=>{console.log(`Userflow.js: Error installing Stylesheet ${n}:`,r),o&&o.reportCspIssue(),u()},t.document.head.appendChild(a)});return e.stylesheets.set(n,{link:a,loadPromise:c}),c}function T(o,t){const n=W(o),e=n.stylesheets.get(t);e&&(o.document.head.removeChild(e.link),n.stylesheets.delete(t))}function So(o){if(o.builtinFontFamily)switch(o.builtinFontFamily.provider){case H.GOOGLE:{const t=Array.from(new Set(["0,400","1,400",`0,${o.fontWeightBold}`,`0,${o.fontWeightNormal}`,`0,${o.defaultButtonFontWeight}`,`0,${o.primaryButtonFontWeight}`,`0,${o.checklistLauncherFontWeight}`,`0,${o.launcherButtonFontWeight}`])).sort().join(";");return{url:`https://fonts.googleapis.com/css2?family=${encodeURIComponent(o.builtinFontFamily.name)}:ital,wght@${t}`,fontFamily:o.builtinFontFamily.name}}case H.STANDARD:return null}else return o.fontCssUrl?{url:o.fontCssUrl,fontFamily:o.fontFamily}:null}export{Ro as D,Do as a,zo as b,Bo as c,Po as d,vo as g,$o as u};
2
2
  //# sourceMappingURL=stylesheets.js.map
package/ui.js CHANGED
@@ -1,3 +1,3 @@
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","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","LauncherApp.js","NotificationsApp.js","TrackerTestingApp.js","StartConditionTestingApp.js","Popover.js"])))=>i.map(i=>d[i]);
2
- import{R as e,r as n}from"./vendor.react.js";import{r as _}from"./vendor.react-dom.js";import{u as F,i as H,U as B}from"./client-context.js";import{_ as o,B as N,R as j,U as q}from"./userflow.js";import"./vendor.core-js.js";import{I as G}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:{},s=new Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="52957221-3c0d-46ae-9503-23a0f71d4556",t._sentryDebugIdIdentifier="sentry-dbid-52957221-3c0d-46ae-9503-23a0f71d4556")}catch{}})();const J=e.lazy(()=>o(()=>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]))),K=e.lazy(()=>o(()=>import("./FlowApp.js"),__vite__mapDeps([26,1,2,3,7,8,9,27,13,12,28,20,19,21,22,23,6,10,11,16,17,18,29,30,5,14,24,31,32]))),M=e.lazy(()=>o(()=>import("./ChecklistApp.js"),__vite__mapDeps([33,1,2,3,7,8,9,28,20,19,21,22,23,12,6,10,11,13,16,17,18,29,30,5,14,24,31,34]))),Q=e.lazy(N),W=e.lazy(()=>o(()=>import("./EmbedApp.js"),__vite__mapDeps([35,1,2,3,7,8,9,10,11,12,13,5,19,20,21,22,23,6,30,29,17,18,16,36,14,34]))),X=e.lazy(j),Y=e.lazy(()=>o(()=>import("./LauncherApp.js"),__vite__mapDeps([37,1,2,3,7,8,9,30,22,23,12,6,19,20,21,10,11,13,5,29,28,16,17,18,14,24,31,32]))),Z=e.lazy(()=>o(()=>import("./NotificationsApp.js"),__vite__mapDeps([38,1,2,3,10,11,12,13,29,7,8,9,19,20,21,22,23,6]))),$=e.lazy(()=>o(()=>import("./TrackerTestingApp.js"),__vite__mapDeps([39,1,2,3,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,5,25,14]))),ee=e.lazy(()=>o(()=>import("./StartConditionTestingApp.js"),__vite__mapDeps([40,1,2,3,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,5,25,14,41]))),te=()=>{const t=F(),[s,d]=n.useState(t.getSessionStorageState()),[c,m]=n.useState(()=>u()?null:t.flowSession),[r,k]=n.useState(t.checklistSession),[p,C]=n.useState(t.checklistExpanded),[a,y]=n.useState(t.bannerSession),[l,v]=n.useState(t.resourceCenterSession),[S,g]=n.useState(t.resourceCenterOpen),[A,w]=n.useState(t.resourceCenterLauncherHidden),[E,I]=n.useState(t.resourceCenterEmbedsChecklist()),[L,R]=n.useState(t.embedChecklistSessions()),[T,D]=n.useState(t.launcherSessions),[O,P]=n.useState(t.activeLauncherFlowId),[f,z]=n.useState(t.notifications),[V,x]=n.useState(t.embedSessions);n.useEffect(()=>{const i=()=>{d(t.getSessionStorageState()),m(U=>u()&&t.flowSession?.id!==U?.id?null:t.flowSession),k(t.checklistSession),C(t.checklistExpanded),y(t.bannerSession),v(t.resourceCenterSession),g(t.resourceCenterOpen),w(t.resourceCenterLauncherHidden),I(t.resourceCenterEmbedsChecklist()),R(t.embedChecklistSessions()),D(t.launcherSessions),P(t.activeLauncherFlowId),z(t.notifications),x(t.embedSessions)};t.on("uistatechange",i);const b=()=>{u()||m(t.flowSession)};return document.addEventListener("visibilitychange",b),()=>{t.off("uistatechange",i),document.removeEventListener("visibilitychange",b)}},[t]);const h=!s.activeApp&&!!c;return n.useLayoutEffect(()=>{if(h)return t.emit("flowvisibilitychange",!0),()=>{t.emit("flowvisibilitychange",!1)}},[t,h]),s.activeApp==="elementSelection"&&s.elementSelection?e.createElement(e.Suspense,{fallback:null},e.createElement(J,{state:s.elementSelection})):s.activeApp==="trackerTesting"&&s.trackerTesting?e.createElement(e.Suspense,{fallback:null},e.createElement($,{state:s.trackerTesting})):e.createElement(e.Fragment,null,c&&e.createElement(e.Suspense,{fallback:null},e.createElement(K,{key:c.id,session:c,checklistSession:r,resourceCenterEmbedsChecklist:E})),r&&!E&&!L&&(p||r.version.checklist?.launcherEnabled)&&e.createElement(e.Suspense,{fallback:null},e.createElement(M,{key:r.id,session:r,checklistExpanded:p})),a&&e.createElement(e.Suspense,{fallback:null},e.createElement(Q,{key:a.id,session:a})),l&&(S||!A)&&e.createElement(e.Suspense,{fallback:null},e.createElement(X,{key:l.id,session:l,isOpen:S,flowSession:c,checklistSession:r})),e.createElement(e.Suspense,{fallback:null},T.map(i=>e.createElement(Y,{key:i.flow.id,session:i,active:i.flow.id===O}))),f.length>0&&e.createElement(e.Suspense,{fallback:null},e.createElement(Z,{notifications:f})),s.activeApp==="startConditionTesting"&&s.testStartConditionToken&&e.createElement(e.Suspense,{fallback:null},e.createElement(ee,{token:s.testStartConditionToken})),V.map(i=>e.createElement(e.Suspense,{key:i.id,fallback:null},e.createElement(W,{session:i,checklistSession:r,type:"embed"}))))};function u(){return document.visibilityState==="hidden"}const ne=({client:t})=>e.createElement(G,{i18n:H},e.createElement(B.Provider,{value:t},e.createElement(te,null)));class Ee{constructor(s){this.client=s}mount(){if(this.container)throw new q("UI has already been mounted");this.container=document.createElement("div"),this.container.id="userflow-ui",document.body.appendChild(this.container),_.render(e.createElement(ne,{client:this.client}),this.container)}unmount(){this.container&&(_.unmountComponentAtNode(this.container),document.body.contains(this.container)&&document.body.removeChild(this.container),delete this.container)}}export{Ee as RealUI};
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","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 _}from"./vendor.react-dom.js";import{u as U,i as H,U as B}from"./client-context.js";import{_ as o,B as N,R as j,U as q}from"./userflow.js";import"./vendor.core-js.js";import{I as G}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]="0520bb67-0673-400e-826b-bd359911e74f",t._sentryDebugIdIdentifier="sentry-dbid-0520bb67-0673-400e-826b-bd359911e74f")}catch{}})();const J=e.lazy(()=>o(()=>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]))),K=e.lazy(()=>o(()=>import("./SmartFlowRecordingApp.js"),__vite__mapDeps([26,1,2,3,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,5,25,14]))),M=e.lazy(()=>o(()=>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]))),Q=e.lazy(()=>o(()=>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]))),W=e.lazy(N),X=e.lazy(()=>o(()=>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]))),Y=e.lazy(j),Z=e.lazy(()=>o(()=>import("./LauncherApp.js"),__vite__mapDeps([38,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]))),$=e.lazy(()=>o(()=>import("./NotificationsApp.js"),__vite__mapDeps([39,1,2,3,10,11,12,13,30,7,8,9,19,20,21,22,23,6]))),ee=e.lazy(()=>o(()=>import("./TrackerTestingApp.js"),__vite__mapDeps([40,1,2,3,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,5,25,14]))),te=e.lazy(()=>o(()=>import("./StartConditionTestingApp.js"),__vite__mapDeps([41,1,2,3,10,11,12,13,15,16,17,18,19,20,21,7,8,9,22,23,6,24,5,25,14,42]))),ne=()=>{const t=U(),[n,d]=s.useState(t.getSessionStorageState()),[c,m]=s.useState(()=>u()?null:t.flowSession),[r,k]=s.useState(t.checklistSession),[p,C]=s.useState(t.checklistExpanded),[a,y]=s.useState(t.bannerSession),[l,v]=s.useState(t.resourceCenterSession),[S,g]=s.useState(t.resourceCenterOpen),[w,A]=s.useState(t.resourceCenterLauncherHidden),[E,I]=s.useState(t.resourceCenterEmbedsChecklist()),[L,R]=s.useState(t.embedChecklistSessions()),[T,D]=s.useState(t.launcherSessions),[O,P]=s.useState(t.activeLauncherFlowId),[f,z]=s.useState(t.notifications),[F,V]=s.useState(t.embedSessions);s.useEffect(()=>{const i=()=>{d(t.getSessionStorageState()),m(x=>u()&&t.flowSession?.id!==x?.id?null:t.flowSession),k(t.checklistSession),C(t.checklistExpanded),y(t.bannerSession),v(t.resourceCenterSession),g(t.resourceCenterOpen),A(t.resourceCenterLauncherHidden),I(t.resourceCenterEmbedsChecklist()),R(t.embedChecklistSessions()),D(t.launcherSessions),P(t.activeLauncherFlowId),z(t.notifications),V(t.embedSessions)};t.on("uistatechange",i);const b=()=>{u()||m(t.flowSession)};return document.addEventListener("visibilitychange",b),()=>{t.off("uistatechange",i),document.removeEventListener("visibilitychange",b)}},[t]);const h=!n.activeApp&&!!c;return s.useLayoutEffect(()=>{if(h)return t.emit("flowvisibilitychange",!0),()=>{t.emit("flowvisibilitychange",!1)}},[t,h]),n.activeApp==="elementSelection"&&n.elementSelection?e.createElement(e.Suspense,{fallback:null},e.createElement(J,{state:n.elementSelection})):n.activeApp==="trackerTesting"&&n.trackerTesting?e.createElement(e.Suspense,{fallback:null},e.createElement(ee,{state:n.trackerTesting})):n.activeApp==="smartFlowRecording"&&n.smartFlowRecording?e.createElement(e.Suspense,{fallback:null},e.createElement(K,{state:n.smartFlowRecording})):e.createElement(e.Fragment,null,c&&e.createElement(e.Suspense,{fallback:null},e.createElement(M,{key:c.id,session:c,checklistSession:r,resourceCenterEmbedsChecklist:E})),r&&!E&&!L&&(p||r.version.checklist?.launcherEnabled)&&e.createElement(e.Suspense,{fallback:null},e.createElement(Q,{key:r.id,session:r,checklistExpanded:p})),a&&e.createElement(e.Suspense,{fallback:null},e.createElement(W,{key:a.id,session:a})),l&&(S||!w)&&e.createElement(e.Suspense,{fallback:null},e.createElement(Y,{key:l.id,session:l,isOpen:S,flowSession:c,checklistSession:r})),e.createElement(e.Suspense,{fallback:null},T.map(i=>e.createElement(Z,{key:i.flow.id,session:i,active:i.flow.id===O}))),f.length>0&&e.createElement(e.Suspense,{fallback:null},e.createElement($,{notifications:f})),n.activeApp==="startConditionTesting"&&n.testStartConditionToken&&e.createElement(e.Suspense,{fallback:null},e.createElement(te,{token:n.testStartConditionToken})),F.map(i=>e.createElement(e.Suspense,{key:i.id,fallback:null},e.createElement(X,{session:i,checklistSession:r,type:"embed"}))))};function u(){return document.visibilityState==="hidden"}const se=({client:t})=>e.createElement(G,{i18n:H},e.createElement(B.Provider,{value:t},e.createElement(ne,null)));class fe{constructor(n){this.client=n}mount(){if(this.container)throw new q("UI has already been mounted");this.container=document.createElement("div"),this.container.id="userflow-ui",document.body.appendChild(this.container),_.render(e.createElement(se,{client:this.client}),this.container)}unmount(){this.container&&(_.unmountComponentAtNode(this.container),document.body.contains(this.container)&&document.body.removeChild(this.container),delete this.container)}}export{fe as RealUI};
3
3
  //# sourceMappingURL=ui.js.map