chordia-ui 3.3.8 → 3.3.9

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.
Files changed (159) hide show
  1. package/dist/AgentLiftCard.cjs.js.map +1 -1
  2. package/dist/AgentLiftCard.es.js +5 -3
  3. package/dist/AgentLiftCard.es.js.map +1 -1
  4. package/dist/CustomFilterChips.cjs.js.map +1 -1
  5. package/dist/CustomFilterChips.es.js +2 -1
  6. package/dist/CustomFilterChips.es.js.map +1 -1
  7. package/dist/FileUploadingState.cjs.js.map +1 -1
  8. package/dist/FileUploadingState.es.js +16 -10
  9. package/dist/FileUploadingState.es.js.map +1 -1
  10. package/dist/IntegrationCard.cjs.js.map +1 -1
  11. package/dist/IntegrationCard.es.js +3 -3
  12. package/dist/IntegrationCard.es.js.map +1 -1
  13. package/dist/SectionLabel.cjs.js.map +1 -1
  14. package/dist/SectionLabel.es.js.map +1 -1
  15. package/dist/SmallButton.cjs.js.map +1 -1
  16. package/dist/SmallButton.es.js +16 -16
  17. package/dist/SmallButton.es.js.map +1 -1
  18. package/dist/SummarySection.cjs.js.map +1 -1
  19. package/dist/SummarySection.es.js +11 -9
  20. package/dist/SummarySection.es.js.map +1 -1
  21. package/dist/TextInput.cjs.js.map +1 -1
  22. package/dist/TextInput.es.js.map +1 -1
  23. package/dist/Timeline.cjs.js.map +1 -1
  24. package/dist/Timeline.es.js +14 -8
  25. package/dist/Timeline.es.js.map +1 -1
  26. package/dist/Tooltip.cjs.js +1 -1
  27. package/dist/Tooltip.cjs.js.map +1 -1
  28. package/dist/Tooltip.es.js +31 -20
  29. package/dist/Tooltip.es.js.map +1 -1
  30. package/dist/TourGuideTooltip.cjs.js.map +1 -1
  31. package/dist/TourGuideTooltip.es.js +2 -1
  32. package/dist/TourGuideTooltip.es.js.map +1 -1
  33. package/dist/UpdatedInteractionRecording.cjs.js +1 -1
  34. package/dist/UpdatedInteractionRecording.cjs.js.map +1 -1
  35. package/dist/UpdatedInteractionRecording.es.js +79 -97
  36. package/dist/UpdatedInteractionRecording.es.js.map +1 -1
  37. package/dist/UploadInteraction.cjs.js.map +1 -1
  38. package/dist/UploadInteraction.es.js.map +1 -1
  39. package/dist/colors.cjs.js +2 -0
  40. package/dist/colors.cjs.js.map +1 -0
  41. package/dist/colors.es.js +2 -0
  42. package/dist/colors.es.js.map +1 -0
  43. package/dist/components/UpdatedInteractionDetails.cjs.js +10 -1
  44. package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
  45. package/dist/components/UpdatedInteractionDetails.es.js +1531 -9
  46. package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
  47. package/dist/components/chat.cjs.js +30 -1
  48. package/dist/components/chat.cjs.js.map +1 -1
  49. package/dist/components/chat.es.js +2222 -7
  50. package/dist/components/chat.es.js.map +1 -1
  51. package/dist/components/common.cjs.js +1 -1
  52. package/dist/components/common.es.js +32 -25
  53. package/dist/components/common.es.js.map +1 -1
  54. package/dist/components/data.cjs.js +1 -1
  55. package/dist/components/data.cjs.js.map +1 -1
  56. package/dist/components/data.es.js +1033 -4
  57. package/dist/components/data.es.js.map +1 -1
  58. package/dist/components/layout.cjs.js +3 -1
  59. package/dist/components/layout.cjs.js.map +1 -1
  60. package/dist/components/layout.es.js +1533 -8
  61. package/dist/components/layout.es.js.map +1 -1
  62. package/dist/components/login.cjs.js +1 -1
  63. package/dist/components/login.es.js +6 -2
  64. package/dist/components/login.es.js.map +1 -1
  65. package/dist/components/media.cjs.js +1 -1
  66. package/dist/components/media.cjs.js.map +1 -1
  67. package/dist/components/media.es.js +220 -6
  68. package/dist/components/media.es.js.map +1 -1
  69. package/dist/components/models.cjs.js +1 -1
  70. package/dist/components/models.cjs.js.map +1 -1
  71. package/dist/components/models.es.js +91 -2
  72. package/dist/components/models.es.js.map +1 -1
  73. package/dist/components/navigation.cjs.js +1 -1
  74. package/dist/components/navigation.cjs.js.map +1 -1
  75. package/dist/components/navigation.es.js +766 -7
  76. package/dist/components/navigation.es.js.map +1 -1
  77. package/dist/components/notifications.cjs.js +1 -1
  78. package/dist/components/notifications.cjs.js.map +1 -1
  79. package/dist/components/notifications.es.js +368 -3
  80. package/dist/components/notifications.es.js.map +1 -1
  81. package/dist/components/onboarding.cjs.js +1 -1
  82. package/dist/components/onboarding.cjs.js.map +1 -1
  83. package/dist/components/onboarding.es.js +985 -7
  84. package/dist/components/onboarding.es.js.map +1 -1
  85. package/dist/components/primitives.cjs.js +1 -1
  86. package/dist/components/primitives.cjs.js.map +1 -1
  87. package/dist/components/primitives.es.js +635 -25
  88. package/dist/components/primitives.es.js.map +1 -1
  89. package/dist/debugger-wc.cjs.js +4 -4
  90. package/dist/debugger-wc.cjs.js.map +1 -1
  91. package/dist/debugger-wc.es.js +15 -11
  92. package/dist/debugger-wc.es.js.map +1 -1
  93. package/dist/index.cjs.js +1 -1
  94. package/dist/index.cjs2.js +2 -49
  95. package/dist/index.cjs2.js.map +1 -1
  96. package/dist/index.cjs3.js +50 -0
  97. package/dist/index.cjs3.js.map +1 -0
  98. package/dist/index.es.js +104 -99
  99. package/dist/index.es.js.map +1 -1
  100. package/dist/index.es2.js +2632 -1776
  101. package/dist/index.es2.js.map +1 -1
  102. package/dist/index.es3.js +1944 -0
  103. package/dist/index.es3.js.map +1 -0
  104. package/dist/pages/interactionDetails.cjs.js +1 -1
  105. package/dist/pages/interactionDetails.cjs.js.map +1 -1
  106. package/dist/pages/interactionDetails.es.js +70 -47
  107. package/dist/pages/interactionDetails.es.js.map +1 -1
  108. package/dist/sortable.esm.cjs.js +1 -1
  109. package/dist/sortable.esm.cjs.js.map +1 -1
  110. package/dist/sortable.esm.es.js +55 -53
  111. package/dist/sortable.esm.es.js.map +1 -1
  112. package/dist/{chordia-ui.css → style.css} +1 -1
  113. package/package.json +1 -1
  114. package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +318 -77
  115. package/src/components/UpdatedInteractionDetails/UpdatedInteractionRecording.jsx +7 -17
  116. package/dist/ChartRenderer.cjs.js +0 -31
  117. package/dist/ChartRenderer.cjs.js.map +0 -1
  118. package/dist/ChartRenderer.es.js +0 -2210
  119. package/dist/ChartRenderer.es.js.map +0 -1
  120. package/dist/GettingStarted.cjs.js +0 -2
  121. package/dist/GettingStarted.cjs.js.map +0 -1
  122. package/dist/GettingStarted.es.js +0 -983
  123. package/dist/GettingStarted.es.js.map +0 -1
  124. package/dist/InlineConfirm.cjs.js +0 -2
  125. package/dist/InlineConfirm.cjs.js.map +0 -1
  126. package/dist/InlineConfirm.es.js +0 -618
  127. package/dist/InlineConfirm.es.js.map +0 -1
  128. package/dist/InteractionSummaryCard.cjs.js +0 -2
  129. package/dist/InteractionSummaryCard.cjs.js.map +0 -1
  130. package/dist/InteractionSummaryCard.es.js +0 -216
  131. package/dist/InteractionSummaryCard.es.js.map +0 -1
  132. package/dist/LoginPage.cjs.js +0 -3
  133. package/dist/LoginPage.cjs.js.map +0 -1
  134. package/dist/LoginPage.es.js +0 -2618
  135. package/dist/LoginPage.es.js.map +0 -1
  136. package/dist/NavigationBar.cjs.js +0 -2
  137. package/dist/NavigationBar.cjs.js.map +0 -1
  138. package/dist/NavigationBar.es.js +0 -762
  139. package/dist/NavigationBar.es.js.map +0 -1
  140. package/dist/NotificationPanel.cjs.js +0 -2
  141. package/dist/NotificationPanel.cjs.js.map +0 -1
  142. package/dist/NotificationPanel.es.js +0 -371
  143. package/dist/NotificationPanel.es.js.map +0 -1
  144. package/dist/OverlayPanel.cjs.js +0 -2
  145. package/dist/OverlayPanel.cjs.js.map +0 -1
  146. package/dist/OverlayPanel.es.js +0 -93
  147. package/dist/OverlayPanel.es.js.map +0 -1
  148. package/dist/SplitPane.cjs.js +0 -4
  149. package/dist/SplitPane.cjs.js.map +0 -1
  150. package/dist/SplitPane.es.js +0 -1531
  151. package/dist/SplitPane.es.js.map +0 -1
  152. package/dist/SummaryStatsPanel.cjs.js +0 -2
  153. package/dist/SummaryStatsPanel.cjs.js.map +0 -1
  154. package/dist/SummaryStatsPanel.es.js +0 -1027
  155. package/dist/SummaryStatsPanel.es.js.map +0 -1
  156. package/dist/UpdatedInteractionDetails.cjs.js +0 -11
  157. package/dist/UpdatedInteractionDetails.cjs.js.map +0 -1
  158. package/dist/UpdatedInteractionDetails.es.js +0 -1310
  159. package/dist/UpdatedInteractionDetails.es.js.map +0 -1
@@ -1,50 +1,3 @@
1
- "use strict";const r=require("./LoginPage.cjs.js"),De=typeof localStorage<"u",Wt="J151000",Vi="J151001",ft="E103205",qi="E102004",Bi="E103202",Ki=De&&localStorage.getItem("base.content.url")||"",Hi="https://static.descope.com/pages",Ji="v2-beta",zi="v2-alpha",Yi="config.json",mt="base.ui.components.url";De&&localStorage.getItem(mt),De&&localStorage.getItem(mt);const Ze="descope-login-flow",et="t",tt="code",Nt="redirect_mode",Dt="err",Qi="ra-challenge",Xi="ra-callback",Zi="ra-backup-callback",es="ra-initiator",ts="data-descope-",it="data-exclude-field",_t="data-exclude-next",Vt="dls_last_auth",qt="state_id",Bt="saml_idp_state_id",Kt="saml_idp_username",Ht="descope_idp_initiated",Jt="sso_app_id",zt="third_party_app_id",Yt="third_party_app_state_id",Qt="oidc_login_hint",Xt="oidc_prompt",Zt="oidc_resource",ei="oidc_error_redirect_uri",ti="application_scopes",Me="data-type",is="sdkScriptsResults",W={redirect:"redirect",poll:"poll",webauthnCreate:"webauthnCreate",webauthnGet:"webauthnGet",nativeBridge:"nativeBridge",loadForm:"loadForm"},ce={submit:"submit",polling:"polling"},ss="data-has-dynamic-attr-values",rs=["descope-multi-select-combo-box","descope-text-area"],ii=5e3,os=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts"];var Ge;(function(i){i.backward="backward",i.forward="forward"})(Ge||(Ge={}));const ns=["descope-enriched-text"];function as(i,e,t){return(...s)=>r.__awaiter(this,void 0,void 0,(function*(){let o;const n=t+1;for(let a=0;a<n;a++)try{return yield i(...s)}catch(l){o=l,a<t&&(yield new Promise((d=>{setTimeout(d,e*Math.pow(2,a+1))})))}throw o}))}function P(i){return new URLSearchParams(window.location.search).get(i)}function A(i){if(window.history.replaceState&&P(i)){const e=new URL(window.location.href),t=new URLSearchParams(e.search);t.delete(i),e.search=t.toString(),window.history.replaceState({},"",e.toString())}}function ls(i,e){return r.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(i,{cache:"default"});if(!t.ok)throw Error(`Error fetching URL ${i} [${t.status}]`);return{body:yield t[e](),headers:Object.fromEntries(t.headers.entries())}}))}function cs({projectId:i,filename:e,assetsFolder:t=Ji,baseUrl:s}){const o=new URL(Ki||s||Hi);return o.pathname=((...n)=>n.join("/").replace(/\/+/g,"/"))(o.pathname,i,t,e),o.toString()}function ds(i,e){if(!e)return;const t=+i,s=+e;return Number.isNaN(t)||Number.isNaN(s)?void 0:t>s?Ge.forward:t<s?Ge.backward:void 0}const si=i=>{let[e="",t=""]=(P(Ze)||"").split("_");const s=(o=>{var n;return((n=/(.*)\|#\|.*/.exec(o))===null||n===void 0?void 0:n[1])||""})(e);return(!i||s&&s!==i)&&(e="",t=""),{executionId:e,stepId:t,executionFlowId:s}};function us(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function ri(){A(Ze)}function hs(){return P(et)||void 0}function ps(){A(et)}function gs(){return P(tt)||void 0}function vs(){return P(Nt)==="popup"}function fs(){return P(Dt)||void 0}function ms(){A(tt)}function _s(){A(Nt)}function bs(){A(Dt)}function ws(){return{redirectAuthCodeChallenge:P(Qi),redirectAuthCallbackUrl:P(Xi),redirectAuthBackupCallbackUri:P(Zi),redirectAuthInitiator:P(es)}}function ys(){return P(qt)}function Ss(){A(qt)}function Cs(){return P(Bt)}function Ps(){A(Bt)}function Fs(){return P(Kt)}function ks(){A(Kt)}function As(){return P(Ht)}function Es(){A(Ht)}function xs(){return P(Jt)}function Is(){return P(zt)}function $s(){A(Jt)}function Gs(){A(zt)}function Os(){return P(Yt)}function Ms(){A(Yt)}function Us(){return P(ti)}function Rs(){A(ti)}function js(){return P(Qt)}function Ts(){A(Qt)}function Ls(){return P(Xt)}function Ws(){A(Xt)}function Ns(){return P(ei)}function Ds(){A(ei)}function Vs(){return P(Zt)}function qs(){A(Zt)}const oi=i=>i.replace(/-./g,(e=>e[1].toUpperCase())),Bs=(i,e)=>t=>i[t]!==e[t],Ks=i=>Array.from((i==null?void 0:i.attributes)||[]).reduce(((e,t)=>{var s;const o=(s=new RegExp(`^${ts}(\\S+)$`).exec(t.name))===null||s===void 0?void 0:s[1];return o?Object.assign(e,{[o]:t.value}):e}),{}),Hs=(i,e)=>{const{executionId:t,stepId:s,executionFlowId:o}=si(i);if(o&&i!==o)return e.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(t||s)&&ri();const n=hs();n&&ps();const a=gs();a&&ms();const l=vs();l&&_s();const d=fs();d&&bs();const{redirectAuthCodeChallenge:u,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:h,redirectAuthInitiator:p}=ws(),v=ys();v&&Ss();const f=Cs();f&&Ps();const S=Fs();f&&ks();const w=As();w&&Es();const g=xs();g&&$s();const m=Is();m&&Gs();const _=Os();_&&Ms();const y=Us();y&&Rs();const $=js();$&&Ts();const G=Ls();G&&Ws();const M=Ns();M&&Ds();const R=Vs();return R&&qs(),{executionId:t,stepId:s,token:n,code:a,isPopup:l,exchangeError:d,redirectAuthCodeChallenge:u,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:h,redirectAuthInitiator:p,ssoQueryParams:{oidcIdpStateId:v,samlIdpStateId:f,samlIdpUsername:S,descopeIdpInitiated:w==="true",ssoAppId:g,oidcLoginHint:$,oidcPrompt:G,oidcErrorRedirectUri:M,oidcResource:R,thirdPartyAppId:m,thirdPartyAppStateId:_,applicationScopes:y}}},ni=i=>{let e,t;return Object.assign(((...s)=>{return e&&(n=s,(o=e).length===n.length&&o.every(((a,l)=>a===n[l])))||(e=s,t=i(...s)),t;var o,n}),{reset:()=>{e=void 0,t=void 0}})},Js='*[name]:not([auto-focus="false"]):not([aria-hidden="true"])',ai=(i,e,t)=>{if(e===!0||e==="skipFirstScreen"&&!t){const s=i.querySelector(Js);setTimeout((()=>{s==null||s.focus()}))}},zs=i=>{i.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const s=()=>{var a;const l=e.focus;e.focus=()=>{},(a=e.reportValidity)===null||a===void 0||a.call(e),setTimeout((()=>{e.focus=l}))};if(e.getAttribute("invalid")==="true"||!((t=e.value)===null||t===void 0)&&t.length)return void s();const o={timer:void 0},n=a=>{a.target.getAttribute("formnovalidate")==="true"&&(clearTimeout(o.timer),o.timer=void 0)};o.timer=setTimeout((()=>{i.removeEventListener("click",n),s(),o.timer=void 0}),150),i.addEventListener("click",n,{once:!0})}))}))};function st(i,e,t){return new Promise(((s,o)=>{let n=!1;const a=setTimeout((()=>{n=!0,t!==void 0?s(t):o(new Error(`Promise timed out after ${i} ms`))}),i);e.then((l=>{n||(clearTimeout(a),s(l))})).catch((l=>{n||(clearTimeout(a),o(l))}))}))}const Ys=()=>{var i;const e=(i=navigator==null?void 0:navigator.userAgentData)===null||i===void 0?void 0:i.brands,t=e==null?void 0:e.find((({brand:s,version:o})=>s==="Chromium"&&parseFloat(o)));return t?t.version:0},bt=(i,{oidcIdpStateId:e,samlIdpStateId:t,samlIdpUsername:s,ssoAppId:o,oidcLoginHint:n,oidcPrompt:a,oidcErrorRedirectUri:l,oidcResource:d,thirdPartyAppId:u,thirdPartyAppStateId:c,applicationScopes:h})=>!(!i||e||t||s||o||n||a||l||d||u||c||h),Qs=(i,e,t,s)=>{const o=document.createElement("form");o.method="POST",o.action=i,o.innerHTML=`
2
- <input type="hidden" role="saml-response" name="SAMLResponse" value="${e}" />
3
- <input type="hidden" role="saml-relay-state" name="RelayState" value="${t}" />
4
- <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />
5
- `,document.body.appendChild(o),s(o)},Xs=i=>i==null?void 0:i.submit(),wt=(i,e)=>{const t=e.find((s=>i[s]));return t?i[t]:null},Zs=(i,e=100)=>{let t;return function(...s){t||i.apply(this,s),clearTimeout(t),t=setTimeout((()=>{t=null}),e)}};function Le(i){if(i)return{locale:i.toLowerCase(),fallback:i.toLowerCase()};const e=navigator.language;return e?e.includes("-")?{locale:e.toLowerCase(),fallback:e.split("-")[0].toLowerCase()}:{locale:e.toLowerCase(),fallback:e.toLowerCase()}:{locale:"",fallback:""}}const er=()=>{document.querySelectorAll('[data-hidden-input="true"]').forEach((i=>i.remove()))},tr=i=>ns.includes(i),ir=i=>{var e,t,s;const o=(n=i.screenState,a=(u,c)=>os.includes(c)||c.startsWith("_"),Object.fromEntries(Object.entries(n).filter((([u,c])=>!a(c,u)))));var n,a;const{screenState:{errorText:l,errorType:d}}=i;return(l||d)&&(o.error={text:l,type:d}),i.action&&(o.action=i.action),!((s=(t=(e=i.screenState)===null||e===void 0?void 0:e.componentsConfig)===null||t===void 0?void 0:t.thirdPartyAppApproveScopes)===null||s===void 0)&&s.data&&(o.inboundAppApproveScopes=i.screenState.componentsConfig.thirdPartyAppApproveScopes.data),o},yt=i=>{const e=Object.assign({},i);return i.inboundAppApproveScopes&&(e.thirdPartyAppApproveScopes=i.inboundAppApproveScopes),e};function sr(i,e){return`${is}.${e?`${i}_${e}`:i}`}const rr=(i,e,t,s)=>{const o=window.screenLeft!==void 0?window.screenLeft:window.screen.left,n=window.screenTop!==void 0?window.screenTop:window.screen.top,a=((window.innerWidth||document.documentElement.clientWidth||window.screen.width)-t)/2+o,l=((window.innerHeight||document.documentElement.clientHeight||window.screen.height)-s)/2+n,d=(function(){const c=navigator.userAgent||"",h=/\b(iPhone)\b/.test(c),p=/Safari/.test(c)&&!/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(c);return h&&p})()?"about:blank":"",u=window.open(d,e,`width=${t},height=${s},top=${l},left=${a},scrollbars=yes,resizable=yes`);return u.location.href=i,u.focus(),u};var N,X,ie,de;function li(i,e){const t=Object.getOwnPropertyNames(i),s=Object.getOwnPropertyNames(e);if(t.length!==s.length)return!1;for(let o=0;o<t.length;o+=1){const n=t[o],a=i[n],l=e[n];if(a===null||l===null){if(a!==l)return!1}else if(typeof a=="object"&&typeof l=="object"){if(!li(a,l))return!1}else if(a!==l)return!1}return!0}let ne=class{constructor(e={},{forceUpdate:t=!1}={}){N.set(this,void 0),X.set(this,{}),ie.set(this,0),de.set(this,!0),this.update=s=>{const o=typeof s=="function"?s(r.__classPrivateFieldGet(this,N,"f")):s,n=Object.assign(Object.assign({},r.__classPrivateFieldGet(this,N,"f")),o),a=r.__classPrivateFieldGet(this,N,"f");r.__classPrivateFieldSet(this,N,n,"f"),Object.freeze(r.__classPrivateFieldGet(this,N,"f")),setTimeout((()=>{Object.values(r.__classPrivateFieldGet(this,X,"f")).forEach((({cb:l,selector:d,forceUpdate:u})=>{const c=d(a),h=d(n);(r.__classPrivateFieldGet(this,de,"f")||u||((function(p){if(typeof p!="object"||p===null)return!1;const v=Object.getPrototypeOf(p);return v===Object.prototype||v===null})(h)?!li(c,h):c!==h))&&l(h,c,Bs(h,c))}))}),0)},r.__classPrivateFieldSet(this,N,e,"f"),r.__classPrivateFieldSet(this,de,t,"f")}get current(){return Object.assign({},r.__classPrivateFieldGet(this,N,"f"))}set forceUpdate(e){r.__classPrivateFieldSet(this,de,e,"f")}subscribe(e,t=o=>o,{forceUpdate:s=!1}={}){return r.__classPrivateFieldSet(this,ie,r.__classPrivateFieldGet(this,ie,"f")+1,"f"),r.__classPrivateFieldGet(this,X,"f")[r.__classPrivateFieldGet(this,ie,"f")]={cb:e,selector:t,forceUpdate:s},r.__classPrivateFieldGet(this,ie,"f").toString()}unsubscribe(e){const t=!!r.__classPrivateFieldGet(this,X,"f")[e];return t&&delete r.__classPrivateFieldGet(this,X,"f")[e],t}unsubscribeAll(){return r.__classPrivateFieldSet(this,X,{},"f"),!0}};N=new WeakMap,X=new WeakMap,ie=new WeakMap,de=new WeakMap;const or=["*","#","/","(",")","[","]","_","<",">","`"],nr=i=>{const e=or.map((t=>`${i}${t}`)).join("|");return new RegExp(`(${e})`,"g")},ar=i=>typeof i!="string"?i:i.replace(nr("\\"),"\\$1"),lr=["disabled"],cr=(i,e,t="")=>{i.querySelectorAll(`[${Me}="${e}"]`).forEach((s=>{s.textContent=t,s.classList[t?"remove":"add"]("hide")}))},St=(i,e)=>{Object.entries(e||{}).forEach((([t,s])=>{Array.from(i.querySelectorAll(`*[name="${t}"]:not([${it}])`)).forEach((o=>{o.value=s}))}))},Ct=(i,e)=>e.split(".").reduce(((t,s)=>(t==null?void 0:t[s])||""),i),We=(i,e,t)=>i.replace(/{{(.+?)}}/g,((s,o)=>t?ar(Ct(e,o)):Ct(e,o))),Pt=(i,e,t)=>{i.querySelectorAll(`[${Me}="${e}"]`).forEach((s=>{s.setAttribute("href",t)}))},dr=(i,e,t,s)=>{t&&Object.keys(t).forEach((o=>{if(!e.querySelector(o))return void s.debug(`Skipping css vars for component "${o}"`,`Got css vars for component ${o} but Could not find it on next page`);const n=customElements.get(o);n?Object.keys(t[o]).forEach((a=>{var l;const d=t[o],u=(l=n==null?void 0:n.cssVarList)===null||l===void 0?void 0:l[a];if(!u)return void s.info(`Could not find css variable name for ${a} in ${o}`,"Check if the css variable is defined in the component");const c=d[a];i.style.setProperty(u,c)})):s.debug(`Could not find component class for ${o}`,"Check if the component is registered")}))},ci=(i,e,t)=>{var s,o;const n=(s=customElements.get(e))===null||s===void 0?void 0:s.cssVarList.url;t&&n&&((o=i==null?void 0:i.style)===null||o===void 0||o.setProperty(n,`url(data:image/jpg;base64,${t})`))},ur=(i,e,t,s)=>{var o,n;Pt(i,"totp-link",(o=e==null?void 0:e.totp)===null||o===void 0?void 0:o.provisionUrl),Pt(i,"notp-link",(n=e==null?void 0:e.notp)===null||n===void 0?void 0:n.redirectUrl),((a,l)=>{a.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((d=>{const u=tr(d.localName);d.textContent=We(d.textContent,l,u);const c=d.getAttribute("href");c&&d.setAttribute("href",We(c,l))}))})(i,e),((a,l,d)=>{if(!l)return;const{componentsDynamicAttrs:u}=l,c=r.__rest(l,["componentsDynamicAttrs"]),h=Object.keys(c).reduce(((p,v)=>(p[`[name=${v}]`]=c[v],p)),{});u&&Object.keys(u).forEach((p=>{const v=u[p];if(v){const{attributes:f}=v;f&&Object.keys(f).length&&(h[p]=f)}})),Object.keys(h).forEach((p=>{a.querySelectorAll(p).forEach((v=>{const f=h[p];Object.keys(f).forEach((S=>{let w=f[S];if(typeof w!="string")try{w=JSON.stringify(w)}catch(g){d.error(`Could not stringify value "${w}" for "${S}"`,g.message),w=""}v.setAttribute(S,w)}))}))}))})(i,e==null?void 0:e.componentsConfig,s),((a,l)=>{a.querySelectorAll(`[${ss}]`).forEach((d=>{Array.from(d.attributes).forEach((u=>{u.value=We(u.value,l)}))}))})(i,e),((a,l)=>{Object.entries(l).forEach((([d,u])=>{a.querySelectorAll(`[name="${d}"]`).forEach((c=>{Object.entries(u).forEach((([h,p])=>{lr.includes(h)&&c.setAttribute(h,p)}))}))}))})(i,t),((a,l={},d)=>{Object.entries(l).forEach((([u,c])=>{a.querySelectorAll(`[id="${CSS.escape(u)}"]`).forEach((h=>{switch(c){case"disable":h.setAttribute("disabled","true");break;case"hide":h.classList.add("hidden");break;default:d==null||d.error(`Unknown component state "${c}" for component with id "${u}"`,'Valid states are "disable" and "hide"')}}))}))})(i,e==null?void 0:e.componentsState,s)},hr=(i,e)=>{St(i,e==null?void 0:e.inputs),St(i,e==null?void 0:e.form)},pr=(i,e)=>{ci(i,"descope-totp-image",e)},gr=(i,e)=>{ci(i,"descope-notp-image",e)},vr=(i,e)=>{Array.from(i.querySelectorAll('[default-code="autoDetect"]')).forEach((t=>{t.setAttribute("default-code",e)}))},fr=i=>{i.querySelectorAll(`descope-button[${Me}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))},mr=ni((()=>r.__awaiter(void 0,void 0,void 0,(function*(){var i,e;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const t=Promise.all([(i=window.PublicKeyCredential)===null||i===void 0?void 0:i.isConditionalMediationAvailable(),(e=window.PublicKeyCredential)===null||e===void 0?void 0:e.isUserVerifyingPlatformAuthenticatorAvailable()]).then((o=>o.every((n=>!!n)))),s=Ys()>=108;return yield st(100,t,s)}catch(t){return console.error("Conditional login check failed",t),!1}}))));let fe;const di=(i,e)=>{fe?fe.setItem(i,e):(window==null?void 0:window.localStorage)!==void 0&&window.localStorage.setItem(i,e)},ui=i=>fe?fe.getItem(i):(window==null?void 0:window.localStorage)!==void 0?window.localStorage.getItem(i):null,_r=i=>{fe=i},Ft="dls_ab_testing_id",br=()=>{const i=ui(Ft);if(!i){const e=Math.floor(100*Math.random()+1);return di(Ft,e.toString()),e}return Number(i)},hi={"lastAuth.loginId":{"not-empty":i=>{var e;return!!i.loginId||!!(!((e=i.lastAuth)===null||e===void 0)&&e.loginId)},empty:i=>{var e;return!i.loginId&&!(!((e=i.lastAuth)===null||e===void 0)&&e.loginId)}},idpInitiated:{"is-true":i=>!!i.code,"is-false":i=>!i.code},externalToken:{"is-true":i=>!!i.token,"is-false":i=>!i.token},abTestingKey:{"greater-than":(i,e)=>(i.abTestingKey||0)>e,"less-than":(i,e)=>(i.abTestingKey||0)<e,"greater-than-or-equal":(i,e)=>(i.abTestingKey||0)>=e,"less-than-or-equal":(i,e)=>(i.abTestingKey||0)<=e,"in-range":(i,e)=>{const[t,s]=e?e.split(",").map(Number):[void 0,void 0];return(i.abTestingKey||0)>=(t??0)&&(i.abTestingKey||0)<=(s??0)},"not-in-range":(i,e)=>{const[t,s]=e?e.split(",").map(Number):[void 0,void 0];return!(t!==void 0&&s!==void 0&&!Number.isNaN(t)&&!Number.isNaN(s))||(i.abTestingKey||0)<t||(i.abTestingKey||0)>s},"devised-by":(i,e)=>{const t=Number(e);return!Number.isNaN(t)&&(i.abTestingKey||0)%t==0}}},wr=(i,e)=>{var t;const s=(t=hi[i==null?void 0:i.key])===null||t===void 0?void 0:t[i.operator];if(!s)return{};const o=s(e,i.predicate)?i.met:i.unmet;return{startScreenId:o==null?void 0:o.screenId,startScreenName:o==null?void 0:o.screenName,conditionInteractionId:o==null?void 0:o.interactionId}},yr=(i,e)=>{const t=e==null?void 0:e.find((({key:s,operator:o,predicate:n})=>{var a;if(s==="ELSE")return!0;const l=(a=hi[s])===null||a===void 0?void 0:a[o];return!!(l!=null&&l(i,n))}));return t?{startScreenId:t.met.screenId,startScreenName:t.met.screenName,conditionInteractionId:t.met.interactionId,clientScripts:t.met.clientScripts,componentsConfig:t.met.componentsConfig}:{}};function Ce(i){const e={};try{Object.assign(e,JSON.parse(ui(Vt)))}catch{}return e!=null&&e.loginId||i?e:{}}function kt(i,e){i!=null&&i.authMethod&&(e&&!(i!=null&&i.loginId)||di(Vt,JSON.stringify(i)))}const Sr=["error","warn","info","debug"],At={error:console.error.bind(console,"[Descope]"),warn:console.warn.bind(console,"[Descope]"),info:console.info.bind(console,"[Descope]"),debug:console.debug.bind(console,"[Descope]")},me=r.h(i=>{var e,t,s,o;return o=class extends i{constructor(){super(...arguments),e.add(this),t.set(this,r.__classPrivateFieldGet(this,e,"m",s).call(this,At))}set logger(a){r.__classPrivateFieldSet(this,t,r.__classPrivateFieldGet(this,e,"m",s).call(this,a||At),"f")}get logger(){return r.__classPrivateFieldGet(this,t,"f")}onLogEvent(a,l){}},t=new WeakMap,e=new WeakSet,s=function(a){return Sr.reduce((l,d)=>(l[d]=(...u)=>{var c;this.onLogEvent(d,u),(c=a[d])===null||c===void 0||c.call(a,...u)},l),{})},o}),pi=typeof localStorage<"u",Cr="base.content.url",Fe="https://static.descope.com/pages",Et="https://static2.descope.com/pages",Pr=pi&&localStorage.getItem(Cr)||"",Fr="v2-beta",rt=(i,e)=>!e&&`${i} cannot be empty, please make sure to set this attribute`,_e=r.h(i=>{var e,t;return t=class extends i{constructor(){super(...arguments),e.set(this,!0)}connectedCallback(){var o,n;(o=super.connectedCallback)===null||o===void 0||o.call(this),!((n=this.shadowRoot)===null||n===void 0)&&n.isConnected&&r.__classPrivateFieldGet(this,e,"f")&&(r.__classPrivateFieldSet(this,e,!1,"f"),this.init())}async init(){}},e=new WeakMap,t}),kr=(i,e)=>{Array.from(i.attributes).forEach(s=>e(s.name)),new MutationObserver(s=>{s.forEach(o=>{o.type==="attributes"&&e(o.attributeName)})}).observe(i,{attributes:!0})},ot=r.h(i=>{var e,t;const s=r.r(me,_e)(i);return t=class extends s{constructor(){super(...arguments),e.set(this,{})}async init(){var n;await((n=super.init)===null||n===void 0?void 0:n.call(this)),kr(this,a=>{var l;(l=r.__classPrivateFieldGet(this,e,"f")[a])===null||l===void 0||l.forEach(d=>{d(a,this.getAttribute(a))})})}observeAttribute(n,a){r.__classPrivateFieldGet(this,e,"f")[n]||(r.__classPrivateFieldGet(this,e,"f")[n]=[]);const l=r.__classPrivateFieldGet(this,e,"f")[n].push(a);return()=>r.__classPrivateFieldGet(this,e,"f")[n].splice(l,1)}observeAttributes(n,a){const l=n.reduce((d,u)=>(d.push(this.observeAttribute(u,a)),d),[]);return()=>l.forEach(d=>d())}},e=new WeakMap,t}),Ue=i=>e=>{var t,s,o;const n=r.r(me,_e,ot)(e),a=Object.keys(i);return o=class extends n{constructor(...d){super(...d),t.add(this),this.observeAttributes(a,r.__classPrivateFieldGet(this,t,"m",s).bind(this))}async init(){var d;a.forEach(u=>r.__classPrivateFieldGet(this,t,"m",s).call(this,u,this.getAttribute(u))),await((d=super.init)===null||d===void 0?void 0:d.call(this))}},t=new WeakSet,s=function(d,u){const c=i[d],h=typeof c=="function"?c(d,u):c;h&&this.logger.error(h)},o};Ue.missingAttrValidator=rt;const Ar=r.h(i=>{const e=r.r(Ue({"project-id":rt}))(i);return class extends e{get projectId(){return this.getAttribute("project-id")}}}),Er=r.h(i=>class extends i{get baseUrl(){return this.getAttribute("base-url")||""}}),xt="Trying the next fallback URL...",xr=async(i,e,{logger:t}={})=>{try{return await fetch(i,e)}catch(s){return t==null||t.debug(`Network error fetching URL ${i} [${s.message}], retrying...`),fetch(i,e)}},Ir=async(i,e,{logger:t,onSuccess:s}={})=>{const o=Array.isArray(i)?i:[i];for(let n=0;n<o.length;n++){const a=o[n],l=n===o.length-1;try{const d=await xr(a.toString(),e,{logger:t});if(d.ok)return s==null||s(n),t==null||t.debug(`Successfully fetched URL ${a}`),d;const u=`Error fetching URL ${a} [${d.status}]`;if(l)throw new Error(u);t==null||t.debug(`${u}. ${xt}`)}catch(d){const u=`Error fetching URL ${a} [${d.message}]`;if(l)throw new Error(u);t==null||t.debug(`${u}. ${xt}`)}}};function $r({projectId:i,filename:e,assetsFolder:t=Fr,baseUrl:s=Fe}){const o=new URL(s);return o.pathname=r.s(o.pathname,i,t,e),o.baseUrl=s,o}const nt=r.h(i=>{var e,t,s,o,n,a,l;const d=r.r(me,Ar,Er)(i);return l=class extends d{constructor(){super(...arguments),e.add(this),t.set(this,void 0),s.set(this,void 0),o.set(this,new Set)}async fetchStaticResource(c,h){const p=r.__classPrivateFieldGet(this,e,"m",n).call(this,c),v=Array.isArray(p)?f=>{const{baseUrl:S}=p[f];r.__classPrivateFieldSet(this,s,S,"f");for(let w=0;w<f;w++){const g=p[w].baseUrl;r.__classPrivateFieldGet(this,o,"f").add(g)}}:null;try{const f=await Ir(p,{cache:"default"},{logger:this.logger,onSuccess:v});return{body:await f[h](),headers:Object.fromEntries(f.headers.entries())}}catch(f){this.logger.error(f.message)}}get baseStaticUrl(){return this.getAttribute("base-static-url")||""}},t=new WeakMap,s=new WeakMap,o=new WeakMap,e=new WeakSet,n=function(c){const h=Pr||this.baseStaticUrl;if(h)return r.__classPrivateFieldGet(this,e,"m",a).call(this,c,h);r.__classPrivateFieldGet(this,t,"f")!==this.baseUrl&&(r.__classPrivateFieldSet(this,t,this.baseUrl,"f"),r.__classPrivateFieldSet(this,s,void 0,"f"),r.__classPrivateFieldGet(this,o,"f").clear());const p=[];if(r.__classPrivateFieldGet(this,s,"f"))p.push(r.__classPrivateFieldGet(this,e,"m",a).call(this,c,r.__classPrivateFieldGet(this,s,"f"))),r.__classPrivateFieldGet(this,s,"f")===Fe&&p.push(r.__classPrivateFieldGet(this,e,"m",a).call(this,c,Et));else{const v=this.baseUrl+"/pages";this.baseUrl&&!r.__classPrivateFieldGet(this,o,"f").has(v)&&p.push(r.__classPrivateFieldGet(this,e,"m",a).call(this,c,v)),r.__classPrivateFieldGet(this,o,"f").has(Fe)||p.push(r.__classPrivateFieldGet(this,e,"m",a).call(this,c,Fe)),p.push(r.__classPrivateFieldGet(this,e,"m",a).call(this,c,Et))}return p.length===1?p[0]:p},a=function(c,h){return $r({projectId:this.projectId,filename:c,baseUrl:h})},l}),Gr="config.json",Or=r.h(i=>{var e,t;const s=r.r(Ue({"project-id":rt}))(i);return t=class extends s{constructor(){super(...arguments),e.set(this,new Map)}onReset(n,a){if(r.__classPrivateFieldGet(this,e,"f").has(n))throw new Error(`Callback for sectionId ${n} already exists`);return r.__classPrivateFieldGet(this,e,"f").set(n,a),()=>{r.__classPrivateFieldGet(this,e,"f").delete(n)}}async reset(...n){n.length===0?await Promise.all(Array.from(r.__classPrivateFieldGet(this,e,"f").values()).map(a=>a())):await Promise.all(n.map(a=>{var l;if(!r.__classPrivateFieldGet(this,e,"f").has(a))throw new Error(`Callback for sectionId ${a} does not exist`);return(l=r.__classPrivateFieldGet(this,e,"f").get(a))===null||l===void 0?void 0:l()}))}},e=new WeakMap,t}),gi=r.h(i=>{var e,t,s,o,n;const a=r.r(nt,Or,_e)(i);return n=class extends a{constructor(){super(...arguments),e.add(this),s.set(this,void 0),o.set(this,async()=>{try{const{body:d,headers:u}=await this.fetchStaticResource(Gr,"json");return{projectConfig:d,executionContext:{geo:u["x-geo"]}}}catch{this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}})}async init(){await super.init(),this.onReset("config",r.__classPrivateFieldGet(this,e,"m",t).bind(this))}get config(){return r.__classPrivateFieldGet(this,s,"f")||r.__classPrivateFieldSet(this,s,r.__classPrivateFieldGet(this,o,"f").call(this),"f"),r.__classPrivateFieldGet(this,s,"f")}},s=new WeakMap,o=new WeakMap,e=new WeakSet,t=function(){r.__classPrivateFieldSet(this,s,void 0,"f")},n}),Mr=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],Ur=i=>document.querySelector(`script#${i}`),Rr=i=>i.getAttribute("status")==="loaded",jr=i=>i.getAttribute("status")==="error",Tr=i=>{let e=0;const t=i.toString();for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);e=(e<<5)-e+o,e=e&e}return`${Math.abs(e).toString()}`},Lr=(i,e)=>{const t=document.createElement("script");return t.id=i,e&&(t.integrity=e,t.crossOrigin="anonymous"),window.DESCOPE_NONCE&&t.setAttribute("nonce",window.DESCOPE_NONCE),t},Wr=(i,e,t)=>new Promise((s,o)=>{const n=Lr(i,t);n.onerror=a=>{n.setAttribute("status","error"),o(a)},n.onload=()=>{n.setAttribute("status","loaded"),s(n)},n.src=e.toString(),document.body.appendChild(n)}),Nr=(i,e)=>{if(e){const t=i.integrity;if(t!==e)return Promise.reject(new Error(`Integrity mismatch: expected ${e}, found ${t}`))}return Rr(i)?Promise.resolve(i):jr(i)?Promise.reject():new Promise((t,s)=>{i.addEventListener("load",()=>{t(i)}),i.addEventListener("error",o=>{s(o)})})},Dr=async(i,e)=>{for(const t of i){const{id:s,url:o,integrity:n}=t,a=Ur(s);if(a)try{return await Nr(a,n),t}catch{e(t,!0)}else try{return await Wr(s,o,n),t}catch{e(t,!1)}}throw new Error("All scripts failed to load")},Vr=(i,e,t,s="",o)=>i.reduce((n,a)=>{const l=a;if(!l)return n;let d;try{d=new URL(l)}catch{throw new Error(`Invalid URL: ${l}`)}d.pathname!=="/"||(d.pathname=`/npm/${e}@${t}/${s}`);const c={url:d,id:`npmlib-${e.replaceAll("@","").replaceAll("/","_")}-${Tr(d)}`};return o&&(c.integrity=o),[...n,c]},[]),qr=r.h(i=>{const e=r.r(me)(i);return class extends e{get baseCdnUrl(){return this.getAttribute("base-cdn-url")||""}injectNpmLib(s,o,n="",a=[],l){return this.logger.debug(`Injecting npm lib: "${s}" with version: "${o}"${l?" with SRI integrity check":""}`),Dr(Vr([...a,this.baseCdnUrl,...Mr],s,o,n,l),(d,u)=>{if(u){this.logger.error(`Existing script cannot be loaded: "${d.url}"`);return}this.logger.error(`Cannot load script from URL, Make sure this URL is valid and return the correct script: "${d.url}"`)})}}}),Br=i=>[...Array.from(i.content.querySelectorAll("*")).reduce((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e,new Set)],at="base.ui.components.url",Kr=pi&&localStorage.getItem(at),Hr="dist/umd/index.js",Jr="@descope/web-components-ui",zr=r.h(i=>{var e,t,s,o,n,a,l;const d=r.r(me,gi,qr)(i);return l=class extends d{constructor(){super(...arguments),e.add(this),o.set(this,void 0)}get descopeUi(){return r.__classPrivateFieldGet(this,o,"f")||r.__classPrivateFieldSet(this,o,r.__classPrivateFieldGet(this,e,"m",a).call(this),"f"),r.__classPrivateFieldGet(this,o,"f")}async loadDescopeUiComponents(c){const h=Array.isArray(c)?c:Br(c);return Promise.all(h.map(p=>r.__classPrivateFieldGet(this,e,"m",n).call(this,p)))}},o=new WeakMap,e=new WeakSet,t=async function(){var c;const h=await this.config,p=(c=h==null?void 0:h.projectConfig)===null||c===void 0?void 0:c.componentsVersion;return p?this.logger.debug(`Got component version "${p}"`):this.logger.error("Could not get components version"),p},s=async function(){var c;const h=await this.config,p=(c=h==null?void 0:h.projectConfig)===null||c===void 0?void 0:c.componentsVersionSri;return p&&this.logger.debug("SRI hash available for components"),p},n=async function(c){if(!!customElements.get(c)){this.logger.debug(`Loading component "${c}" is skipped as it is already defined`);return}const p=await this.descopeUi;if(!p[c]){this.logger.error(`Cannot load UI component "${c}"`,`Descope UI does not have a component named "${c}", available components are: "${Object.keys(p).join(", ")}"`);return}try{return await p[c]()}catch(v){if(v.name==="NotSupportedError")console.debug(`Encountered an error while attempting to define the "${c}" component, it is likely that this component is already defined`);else throw v}},a=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{const c=await r.__classPrivateFieldGet(this,e,"m",t).call(this),h=await r.__classPrivateFieldGet(this,e,"m",s).call(this);return await this.injectNpmLib(Jr,c,Hr,[Kr],h),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(c){throw this.logger.error(c),new Error("DescopeUI was not loaded")}},l}),Yr=r.h(i=>{var e,t,s;const o=r.r(_e,ot)(i);return s=class extends o{constructor(){super(...arguments),e.add(this)}get nonce(){return this.getAttribute("nonce")||""}async init(){var a;await((a=super.init)===null||a===void 0?void 0:a.call(this)),this.observeAttribute("nonce",r.__classPrivateFieldGet(this,e,"m",t).bind(this)),r.__classPrivateFieldGet(this,e,"m",t).call(this)}},e=new WeakSet,t=function(){this.nonce&&(window.DESCOPE_NONCE=this.nonce)},s});class Qr{constructor(e,t,{prepend:s=!1}={}){this.styleEle=document.createElement("style"),this.styleEle.setAttribute("nonce",t),this.ref=e,this.ref&&(s?this.ref.prepend(this.styleEle):this.ref.append(this.styleEle))}replaceSync(e){this.styleEle.textContent=e}get cssRules(){var e;return(e=this.styleEle.sheet)===null||e===void 0?void 0:e.cssRules}}const Re=r.h(i=>{const e=r.r(Yr)(i);return class extends e{injectStyle(s,{prepend:o=!1}={}){let n;try{n=new CSSStyleSheet}catch{n=new Qr(this.shadowRoot,this.nonce,{prepend:o})}if(s&&n.replaceSync(s),n instanceof CSSStyleSheet){const a=this.shadowRoot;if(a&&"adoptedStyleSheets"in a){const l=[...a.adoptedStyleSheets||[]];l[o?"unshift":"push"](n),a.adoptedStyleSheets=l}}return n}}}),Ne="content-root",Pe="root",Xr=r.h(i=>{const e=r.r(Re)(i);return class extends e{constructor(...s){var o,n;super(...s),this.attachShadow({mode:"open"}).innerHTML=`
6
- <div id="${Pe}">
7
- <div id="${Ne}"></div>
8
- </div>
9
- `,this.injectStyle(`
10
- #${Pe}, #${Ne} {
11
- height: 100%;
12
- }
13
- #${Pe} {
14
- position: relative;
15
- height: fit-content;
16
- }
17
- `),this.contentRootElement=(o=this.shadowRoot)===null||o===void 0?void 0:o.getElementById(Ne),this.rootElement=(n=this.shadowRoot)===null||n===void 0?void 0:n.getElementById(Pe)}}}),Zr="theme",eo=i=>{const e=document.createElement("link");e.href=i,e.rel="stylesheet",document.head.appendChild(e)},to=async()=>{const i=localStorage.getItem(at),e=i==null?void 0:i.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",e);const t=document.createElement("script");if(t.src=e,document.body.appendChild(t),await new Promise((s,o)=>{t.onload=s,t.onerror=o}),globalThis.DescopeDev){const{themeToStyle:s,defaultTheme:o,darkTheme:n}=globalThis.DescopeDev;return{light:s(o),dark:s(n)}}},io=(i,e)=>(e||!1)&&e!=="light"&&e!=="dark"&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',so=r.h(i=>{var e,t,s,o,n,a,l,d,u,c,h,p,v,f;const S=r.r(Ue({theme:io}),nt,_e,zr,gi,Xr,ot,Re)(i);return f=class extends S{constructor(){super(...arguments),e.add(this),t.set(this,void 0),s.set(this,void 0),h.set(this,()=>{r.__classPrivateFieldGet(this,e,"m",p).call(this),r.__classPrivateFieldGet(this,v,"f").call(this,this.getAttribute("theme")==="os")}),v.set(this,g=>{var m,_,y;const $=g?"addEventListener":"removeEventListener";(y=(_=(m=window.matchMedia)===null||m===void 0?void 0:m.call(window,"(prefers-color-scheme: dark)"))===null||_===void 0?void 0:_[$])===null||y===void 0||y.call(_,"change",()=>r.__classPrivateFieldGet(this,e,"m",p).call(this))})}get theme(){var g,m;const _=this.getAttribute("theme");return _==="os"?window.matchMedia&&((m=(g=window.matchMedia)===null||g===void 0?void 0:g.call(window,"(prefers-color-scheme: dark)"))===null||m===void 0?void 0:m.matches)?"dark":"light":_||"light"}get styleId(){return this.getAttribute("style-id")||Zr}async init(){var g;await((g=super.init)===null||g===void 0?void 0:g.call(this)),r.__classPrivateFieldGet(this,h,"f").call(this),await Promise.all([r.__classPrivateFieldGet(this,e,"m",a).call(this),r.__classPrivateFieldGet(this,e,"m",l).call(this)]),this.observeAttributes(["theme"],r.__classPrivateFieldGet(this,h,"f")),this.observeAttributes(["style-id"],()=>{r.__classPrivateFieldSet(this,s,null,"f"),r.__classPrivateFieldGet(this,e,"m",u).call(this),r.__classPrivateFieldGet(this,e,"m",a).call(this),r.__classPrivateFieldGet(this,e,"m",l).call(this)})}},t=new WeakMap,s=new WeakMap,h=new WeakMap,v=new WeakMap,e=new WeakSet,o=async function(){try{const{body:g}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if(process.env.NODE_ENV==="development"&&localStorage!=null&&localStorage.getItem(at))try{this.logger.warn(`You are in DEV mode, and UI components override URL was found
18
- trying to merge project theme with the default theme of the UI components`);const m=await to();m&&(g.light.components=Object.assign(Object.assign({},g.light.components),m.light.components),g.dark.components=Object.assign(Object.assign({},g.dark.components),m.dark.components),this.logger.warn("Theme was merged successfully"),console.log(`%cNOTICE! This is not the theme that will be used in production!
19
-
20
- Make sure to test it without the override UI components URL!`,"color: black; background-color:yellow; font-size: x-large"))}catch(m){this.logger.error(`Failed to merge UI components theme
21
- `,m)}return g}catch{this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},n=function(){return r.__classPrivateFieldGet(this,s,"f")||(r.__classPrivateFieldSet(this,s,r.__classPrivateFieldGet(this,e,"m",o).call(this),"f"),r.__classPrivateFieldGet(this,s,"f").then(g=>this.logger.debug("Fetched theme",g))),r.__classPrivateFieldGet(this,s,"f")},a=async function(){var g,m;const _=await r.__classPrivateFieldGet(this,e,"a",n);_&&(r.__classPrivateFieldGet(this,t,"f")||r.__classPrivateFieldSet(this,t,this.injectStyle(""),"f"),r.__classPrivateFieldGet(this,t,"f").replaceSync((((g=_==null?void 0:_.light)===null||g===void 0?void 0:g.globals)||"")+(((m=_==null?void 0:_.dark)===null||m===void 0?void 0:m.globals)||"")))},l=async function(){var g,m;const _=await r.__classPrivateFieldGet(this,e,"a",n);if(!_)return;const y=await this.descopeUi;y!=null&&y.componentsThemeManager&&(y.componentsThemeManager.themes={light:(g=_==null?void 0:_.light)===null||g===void 0?void 0:g.components,dark:(m=_==null?void 0:_.dark)===null||m===void 0?void 0:m.components})},d=async function(){var g,m;const{projectConfig:_}=await this.config||{},y=(g=_==null?void 0:_.styles)===null||g===void 0?void 0:g[this.styleId],$=_==null?void 0:_.cssTemplate,G=y||$;return(m=G==null?void 0:G[this.theme])===null||m===void 0?void 0:m.fonts},u=async function(){const g=await r.__classPrivateFieldGet(this,e,"m",d).call(this);g?Object.values(g).forEach(m=>{m.url&&(this.logger.debug(`Loading font from URL "${m.url}"`),eo(m.url))}):this.logger.debug("No fonts to load")},c=async function(){this.rootElement.setAttribute("data-theme",this.theme);const g=await this.descopeUi;g!=null&&g.componentsThemeManager&&(g.componentsThemeManager.currentThemeName=this.theme)},p=function(){r.__classPrivateFieldGet(this,e,"m",u).call(this),r.__classPrivateFieldGet(this,e,"m",c).call(this)},f}),Ve=(i,e="")=>Object.keys(i).reduce(((t,s)=>{var o;if(Array.isArray(i[s]))return Object.assign(Object.assign({},t),{[s]:{value:i[s].map((l=>typeof l=="object"&&l!==null?Ve(l):l))}});if(typeof i[s]=="object"&&i[s]!==null&&!(!((o=i[s])===null||o===void 0)&&o.value))return Object.assign(Object.assign({},t),Ve(i[s],`${e+s}.`));const n=typeof i[s]=="object"?i[s]:{value:i[s]},a=Object.assign(Object.assign({},t),{[e+s]:n,[`form.${e}${s}`]:n});return s==="displayName"?Object.assign(Object.assign({},a),{[`${e}fullName`]:n,[`form.${e}fullName`]:n}):a}),[]),ro=i=>{try{return Ve(JSON.parse(i))}catch{return{}}},oo=(i,e)=>Object.fromEntries(Object.entries(i).map((([t,s])=>[t,s[e]]))),no=r.h((i=>{var e,t,s,o;return o=class extends i{constructor(){super(...arguments),e.add(this)}connectedCallback(){var n;r.__classPrivateFieldGet(this,e,"m",t).call(this)&&r.__classPrivateFieldGet(this,e,"m",s).call(this),(n=super.connectedCallback)===null||n===void 0||n.call(this)}},e=new WeakSet,t=function(){return!this.shadowRoot.host.closest("form")&&us()},s=function(){const n=this.shadowRoot.host,a=document.createElement("form");a.style.width="100%",a.style.height="100%",n.parentElement.appendChild(a),a.appendChild(n)},o}));var x,ke,Ae,ae,Z,se,ge,J,re,Oe,It,vi,qe,fi,$t,mi,_i,Gt,bi,Be,wi,yi;const ao=r.r(so,nt,no,Re)(HTMLElement);class ve extends ao{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","style-id"]}constructor(e){super(),x.add(this),Ae.set(this,!1),ae.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(t,s="")=>{this.logger.error(t,s,new Error),r.__classPrivateFieldGet(this,x,"m",yi).call(this,t,s)},warn:(t,s="")=>{this.logger.warn(t,s)},info:(t,s="",o={})=>{this.logger.info(t,s,o)},debug:(t,s="")=>{this.logger.debug(t,s)}},Z.set(this,new ne),se.set(this,new ne),ge.set(this,{}),this.getComponentsContext=()=>r.__classPrivateFieldGet(this,ge,"f"),this.nextRequestStatus=new ne({isLoading:!1}),J.set(this,void 0),re.set(this,{popstate:r.__classPrivateFieldGet(this,x,"m",fi).bind(this),componentsContext:r.__classPrivateFieldGet(this,x,"m",bi).bind(this)}),Oe.set(this,void 0),this.getConfig=()=>r.__awaiter(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),r.__classPrivateFieldSet(this,Oe,e,"f"),r.__classPrivateFieldGet(this,x,"m",vi).call(this)}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch{return{}}}get tenantId(){return this.getAttribute("tenant")||void 0}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return this.getAttribute("debug")==="true"}get locale(){return this.getAttribute("locale")||void 0}get autoFocus(){var e;const t=(e=this.getAttribute("auto-focus"))!==null&&e!==void 0?e:"true";return t==="skipFirstScreen"?t:t==="true"}get validateOnBlur(){return this.getAttribute("validate-on-blur")==="true"}get storeLastAuthenticatedUser(){var e;return((e=this.getAttribute("store-last-authenticated-user"))!==null&&e!==void 0?e:"true")==="true"}get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}get keepLastAuthenticatedUserAfterLogout(){return this.getAttribute("keep-last-authenticated-user-after-logout")==="true"}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return ro(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return oo(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{return JSON.parse(this.getAttribute("outbound-app-scopes"))||null}catch{return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return r.__classPrivateFieldGet(this,ae,"f")}set customStorage(e){if(e&&typeof e.getItem!="function")throw new Error("Custom storage must have a getItem method");if(e&&typeof e.setItem!="function")throw new Error("Custom storage must have a setItem method");if(e&&typeof e.removeItem!="function")throw new Error("Custom storage must have a removeItem method");r.__classPrivateFieldSet(this,ae,e,"f"),_r(e)}get isRestartOnError(){return this.getAttribute("restart-on-error")==="true"}getExecutionContext(){return r.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return r.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return r.__awaiter(this,void 0,void 0,(function*(){var e,t;const s=yield this.getProjectConfig(),o=((e=s==null?void 0:s.flows)===null||e===void 0?void 0:e[this.flowId])||{};return(t=o.version)!==null&&t!==void 0||(o.version=0),o}))}getTargetLocales(){return r.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((e==null?void 0:e.targetLocales)||[]).map((t=>t.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,s,o;const n=!!(!((t=this.shadowRoot.activeElement)===null||t===void 0)&&t.getAttribute("href")),a=rs.includes((o=(s=this.shadowRoot.activeElement)===null||s===void 0?void 0:s.localName)!==null&&o!==void 0?o:"");if(e.key!=="Enter"||n||a)return;e.preventDefault();const l=this.rootElement.querySelectorAll("descope-button");if(l.length===1&&l[0].getAttribute("auto-submit")!=="false")return void l[0].click();const d=Array.from(l).filter((c=>c.getAttribute("auto-submit")==="true"));if(d.length===1)return void d[0].click();const u=Array.from(l).filter((c=>c.getAttribute("data-type")==="button"));if(u.length===1)u[0].getAttribute("auto-submit")!=="false"&&u[0].click();else if(u.length===0){const c=Array.from(l).filter((h=>h.getAttribute("data-type")==="sso"));c.length===1&&c[0].getAttribute("auto-submit")!=="false"&&c[0].click()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return r.__awaiter(this,void 0,void 0,(function*(){var e;const t=yield this.getConfig();return("projectConfig"in t?(e=t.projectConfig)===null||e===void 0?void 0:e.componentsVersion:{})||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r.__awaiter(this,void 0,void 0,(function*(){var t;if(this.flowStatus="loading",["ready","error","success"].forEach((S=>this.addEventListener(S,(()=>{this.flowStatus=S})))),yield(t=e.init)===null||t===void 0?void 0:t.call(this),r.__classPrivateFieldGet(this,se,"f").subscribe(r.__classPrivateFieldGet(this,x,"m",wi).bind(this)),r.__classPrivateFieldGet(this,se,"f").update({isDebug:this.debug}),r.__classPrivateFieldGet(this,x,"m",qe).call(this),yield r.__classPrivateFieldGet(this,x,"m",_i).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const s=yield this.getConfig();if("isMissingConfig"in s&&s.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:o,stepId:n,token:a,code:l,isPopup:d,exchangeError:u,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:p,redirectAuthInitiator:v,ssoQueryParams:f}=Hs(this.flowId,this.loggerWrapper);window.addEventListener("popstate",r.__classPrivateFieldGet(this,re,"f").popstate),window.addEventListener("components-context",r.__classPrivateFieldGet(this,re,"f").componentsContext),r.__classPrivateFieldGet(this,Z,"f").subscribe(r.__classPrivateFieldGet(this,x,"m",mi).bind(this)),r.__classPrivateFieldGet(this,Z,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:n,executionId:o,token:a,code:l,isPopup:d,exchangeError:u,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:p,redirectAuthInitiator:v},f)),r.__classPrivateFieldSet(this,Ae,!0,"f")}))}disconnectedCallback(){r.__classPrivateFieldGet(this,Z,"f").unsubscribeAll(),r.__classPrivateFieldGet(this,se,"f").unsubscribeAll(),r.__classPrivateFieldGet(this,x,"m",Be).call(this),window.removeEventListener("popstate",r.__classPrivateFieldGet(this,re,"f").popstate),window.removeEventListener("components-context",r.__classPrivateFieldGet(this,re,"f").componentsContext)}attributeChangedCallback(e,t,s){if(this.shadowRoot.isConnected&&r.__classPrivateFieldGet(this,Ae,"f")&&t!==s&&ke.observedAttributes.includes(e)){r.__classPrivateFieldGet(this,x,"m",qe).call(this);const o=t===null;r.__classPrivateFieldGet(this,Z,"f").update((({stepId:n,executionId:a})=>{let l=n,d=a;return o||(d=null,l=null,ri()),{[oi(e)]:s,stepId:l,executionId:d}})),r.__classPrivateFieldGet(this,se,"f").update({isDebug:this.debug})}}}ke=ve,Ae=new WeakMap,ae=new WeakMap,Z=new WeakMap,se=new WeakMap,ge=new WeakMap,J=new WeakMap,re=new WeakMap,Oe=new WeakMap,x=new WeakSet,It=function(){this.injectStyle(`
22
- :host {
23
- width: 100%;
24
- display: block;
25
- }
26
-
27
- #root {
28
- height: 100%;
29
- display: flex;
30
- flex-direction: column;
31
- }
32
-
33
- #content-root {
34
- all: initial;
35
- transition: opacity 200ms ease-in-out;
36
- }
37
-
38
- #root[data-theme] {
39
- background-color: transparent;
40
- }
41
-
42
- .fade-out {
43
- opacity: 0.1!important;
44
- }
45
-
46
- .hidden {
47
- display: none;
48
- }
49
- `)},vi=function(){r.__classPrivateFieldGet(this,x,"m",It).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},qe=function(){const i=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","style-id","outbound-app-id","outbound-app-scopes"];ke.observedAttributes.forEach((e=>{if(!i.includes(e)&&!this[oi(e)])throw Error(`${e} cannot be empty`)}))},fi=function(){const{stepId:i,executionId:e}=si(this.flowId);r.__classPrivateFieldGet(this,Z,"f").update({stepId:i,executionId:e})},$t=function(i,e){r.$e&&typeof r.$e=="function"||this.logger.error("SDK was not loaded properly",r.$e,JSON.stringify(r.$e));const t=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},ke.sdkConfigOverrides),{projectId:i,baseUrl:e});r.__classPrivateFieldGet(this,ae,"f")&&(t.customStorage=r.__classPrivateFieldGet(this,ae,"f")),this.sdk=r.$e(t),["start","next"].forEach((s=>{const o=this.sdk.flow[s],n=as(o,1e3,3);this.sdk.flow[s]=(...a)=>r.__awaiter(this,void 0,void 0,(function*(){try{return yield n(...a)}catch(l){return this.logger.error(`Error in sdk flow ${s} function`,l),{error:{errorCode:Wt,errorDescription:l.toString()}}}}))}))},mi=function(i,e,t){return r.__awaiter(this,void 0,void 0,(function*(){const{projectId:s,baseUrl:o}=i;if(t("projectId")||t("baseUrl")){if(!s)return;r.__classPrivateFieldGet(this,x,"m",$t).call(this,s,o)}r.__classPrivateFieldGet(this,Oe,"f").call(this,i)}))},_i=function(){return r.__awaiter(this,void 0,void 0,(function*(){const i=yield this.getConfig();return"isMissingConfig"in i&&i.isMissingConfig&&(yield r.__classPrivateFieldGet(this,x,"m",Gt).call(this))}))},Gt=function(){return r.__awaiter(this,void 0,void 0,(function*(){const i=cs({projectId:this.projectId,filename:Yi,assetsFolder:zi,baseUrl:this.baseStaticUrl});try{return yield ls(i,"json"),!0}catch{return!1}}))},bi=function(i){r.__classPrivateFieldSet(this,ge,Object.assign(Object.assign({},r.__classPrivateFieldGet(this,ge,"f")),i.detail),"f")},Be=function(){var i;(i=r.__classPrivateFieldGet(this,J,"f"))===null||i===void 0||i.remove(),r.__classPrivateFieldSet(this,J,null,"f")},wi=function(i){return r.__awaiter(this,arguments,void 0,(function*({isDebug:e}){e?(r.__classPrivateFieldSet(this,J,document.createElement("descope-debugger"),"f"),Object.assign(r.__classPrivateFieldGet(this,J,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then(()=>require("./debugger-wc.cjs.js")),document.body.appendChild(r.__classPrivateFieldGet(this,J,"f"))):r.__classPrivateFieldGet(this,x,"m",Be).call(this)}))},yi=function(i,e){var t;i&&this.debug&&((t=r.__classPrivateFieldGet(this,J,"f"))===null||t===void 0||t.updateData({title:i,description:e}))},ve.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.56.0"}};var b,ue,V,le,Ee,Si,Ot,Mt,xe,Ut,Ke,Rt,Ci,Ie,Pi,He,Je,oe,he,ze,D,Ye,jt,Fi,Qe,ki,Ai,pe,Ei,xi,Ii,Tt,$e,Xe,Lt,$i,q,Gi;class Oi extends ve{static set sdkConfigOverrides(e){ve.sdkConfigOverrides=e}static get sdkConfigOverrides(){return ve.sdkConfigOverrides}constructor(){const e=new ne({deferredRedirect:!1,deferredPolling:!1});super(e.update.bind(e)),b.add(this),this.stepState=new ne({}),ue.set(this,void 0),V.set(this,null),le.set(this,null),Ee.set(this,{visibilitychange:r.__classPrivateFieldGet(this,b,"m",Si).bind(this)}),this.bridgeVersion=2,this.nativeCallbacks={},Ie.set(this,!1),this.handleRedirect=t=>{window.location.assign(t)},He.set(this,(t=>{const s=()=>{this.contentRootElement.classList.toggle("hidden",t),this.slotElement.classList.toggle("hidden",!t),t&&(this.contentRootElement.innerHTML="")};t&&this.contentRootElement.hasChildNodes()?r.__classPrivateFieldGet(this,b,"m",Je).call(this,s):s()})),oe.set(this,((t,s,o,n,a=!1)=>{const l=[ft,Bi];if(this.flowState.current.action===W.poll){if(r.__classPrivateFieldGet(this,ze,"f").call(this)&&document.hidden)return this.logger.debug("polling - Deferring polling until in foreground"),void this.flowState.update({deferredPolling:!0});this.logger.debug("polling - Scheduling polling request");const d=Date.now(),u=a?500:2e3;r.__classPrivateFieldSet(this,ue,setTimeout((()=>r.__awaiter(this,void 0,void 0,(function*(){var c,h;this.logger.debug("polling - Calling next");const p=this.sdk.flow.next(t,s,ce.polling,o,n,{}),v=document.hidden&&!a&&Date.now()-d>u+500;let f;v&&this.logger.debug("polling - The polling seems to be throttled");try{f=yield st(v?1e3:6e3,p)}catch{return this.logger.warn(`polling - The ${v?"throttled fetch":"fetch"} call timed out or was aborted`),void r.__classPrivateFieldGet(this,oe,"f").call(this,t,s,o,n,v)}if(((c=f==null?void 0:f.error)===null||c===void 0?void 0:c.errorCode)===Wt)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void r.__classPrivateFieldGet(this,oe,"f").call(this,t,s,o,n);this.logger.debug("polling - Got a response"),f!=null&&f.error&&this.logger.debug("polling - Response has an error",JSON.stringify(f.error,null,4)),!((h=f==null?void 0:f.error)===null||h===void 0)&&h.errorCode&&l.includes(f.error.errorCode)?this.logger.debug("polling - Stopping polling due to error"):r.__classPrivateFieldGet(this,oe,"f").call(this,t,s,o,n),r.__classPrivateFieldGet(this,D,"f").call(this,f)}))),u),"f")}})),he.set(this,(()=>{clearTimeout(r.__classPrivateFieldGet(this,ue,"f")),r.__classPrivateFieldSet(this,ue,null,"f")})),ze.set(this,(()=>!!window.descopeBridge||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))),D.set(this,(t=>{var s,o,n,a,l,d,u,c,h,p,v,f,S;if(!(t!=null&&t.ok)){const L=(s=t==null?void 0:t.response)===null||s===void 0?void 0:s.url,z=`${(o=t==null?void 0:t.response)===null||o===void 0?void 0:o.status} - ${(n=t==null?void 0:t.response)===null||n===void 0?void 0:n.statusText}`;r.__classPrivateFieldGet(this,b,"m",q).call(this,"error",(t==null?void 0:t.error)||{errorCode:Vi,errorDescription:z,errorMessage:L}),this.loggerWrapper.error(((a=t==null?void 0:t.error)===null||a===void 0?void 0:a.errorDescription)||L,((l=t==null?void 0:t.error)===null||l===void 0?void 0:l.errorMessage)||z);const I=(d=t==null?void 0:t.error)===null||d===void 0?void 0:d.errorCode;return void(I!==qi&&I!==ft||!this.isRestartOnError||r.__classPrivateFieldGet(this,b,"m",Ci).call(this))}(c=(u=t.data)===null||u===void 0?void 0:u.runnerLogs)===null||c===void 0||c.forEach((L=>{const{level:z,title:I,log:U}=L;z&&this.loggerWrapper[z]?this.loggerWrapper[z](I,U):this.loggerWrapper.info(I,U)}));const w=(v=(p=(h=t.data)===null||h===void 0?void 0:h.screen)===null||p===void 0?void 0:p.state)===null||v===void 0?void 0:v.errorText;!((f=t.data)===null||f===void 0)&&f.error?this.loggerWrapper.error(`[${t.data.error.code}]: ${t.data.error.description}`,`${w?`${w} - `:""}${t.data.error.message}`):w&&this.loggerWrapper.error(w);const{status:g,authInfo:m,lastAuth:_,action:y,openInNewTabUrl:$}=t.data;if(y!==W.poll&&r.__classPrivateFieldGet(this,he,"f").call(this),g==="completed"){this.storeLastAuthenticatedUser&&kt(_);const L=Object.assign({},m);return t.data.output&&Object.keys(t.data.output).length>0&&(L.flowOutput=t.data.output),void r.__classPrivateFieldGet(this,b,"m",q).call(this,"success",L)}this.storeLastAuthenticatedUser&&kt(_,!0),$&&window.open($,"_blank");const{executionId:G,stepId:M,stepName:R,screen:j,redirect:ee,webauthn:B,error:be,samlIdpResponse:T,nativeResponse:te}=t.data,we=Date.now();y!==W.poll?(this.loggerWrapper.info(`Step "${R||`#${M}`}" is ${g}`,"",{screen:j,status:g,stepId:M,stepName:R,action:y,error:be}),!((S=j.state)===null||S===void 0)&&S.clientScripts&&r.__classPrivateFieldSet(this,le,this.loadSdkScripts(j.state.clientScripts),"f"),this.flowState.update({stepId:M,stepName:R,executionId:G,action:y,redirectTo:ee==null?void 0:ee.url,redirectIsPopup:ee==null?void 0:ee.isPopup,screenId:j==null?void 0:j.id,screenState:j==null?void 0:j.state,webauthnTransactionId:B==null?void 0:B.transactionId,webauthnOptions:B==null?void 0:B.options,samlIdpResponseUrl:T==null?void 0:T.url,samlIdpResponseSamlResponse:T==null?void 0:T.samlResponse,samlIdpResponseRelayState:T==null?void 0:T.relayState,nativeResponseType:te==null?void 0:te.type,nativePayload:te==null?void 0:te.payload,reqTimestamp:we})):this.flowState.update({action:y,reqTimestamp:we})})),Ye.set(this,ni((()=>r.__awaiter(this,void 0,void 0,(function*(){var t;try{const s=yield this.sdk.webauthn.signIn.start("",window.location.origin);return s.ok||this.loggerWrapper.warn("Webauthn start failed",(t=s==null?void 0:s.error)===null||t===void 0?void 0:t.errorMessage),s.data}catch(s){this.loggerWrapper.warn("Webauthn start failed",s.message)}}))))),pe.set(this,null),$e.set(this,Zs(((t,s)=>r.__awaiter(this,void 0,void 0,(function*(){var o;if(t.getAttribute("formnovalidate")==="true"||r.__classPrivateFieldGet(this,b,"m",ki).call(this)){const n=t==null?void 0:t.getAttribute("id");r.__classPrivateFieldGet(this,b,"m",Ei).call(this,t);const a=yield r.__classPrivateFieldGet(this,b,"m",Ai).call(this),l=Ks(t);this.nextRequestStatus.update({isLoading:!0});const d=Object.assign(Object.assign(Object.assign({},l),a),{origin:((o=this.nativeOptions)===null||o===void 0?void 0:o.origin)||window.location.origin});yield s(n,d),this.nextRequestStatus.update({isLoading:!1}),r.__classPrivateFieldGet(this,b,"m",xi).call(this,a)}}))))),this.flowState=e}nativeResume(e,t){var s,o,n,a,l;const d=JSON.parse(t);if(e==="oauthWeb"||e==="sso"){let{exchangeCode:u}=d;u||(u=(s=new URL(d.url).searchParams)===null||s===void 0?void 0:s.get(tt)),(n=(o=this.nativeCallbacks).complete)===null||n===void 0||n.call(o,{exchangeCode:u,idpInitiated:!0})}else if(e==="magicLink"){const u=new URL(d.url),c=u.searchParams.get(et),h=u.searchParams.get(Ze).split("_").pop();r.__classPrivateFieldGet(this,he,"f").call(this),this.flowState.update({token:c,stepId:h,action:void 0})}else if(e==="beforeScreen"){const{screenResolve:u}=this.nativeCallbacks;this.nativeCallbacks.screenResolve=null;const{override:c}=d;c||(this.nativeCallbacks.screenNext=null),u==null||u(c)}else if(e==="resumeScreen"){const{interactionId:u,form:c}=d,{screenNext:h}=this.nativeCallbacks;this.nativeCallbacks.screenNext=null,h==null||h(u,c)}else(l=(a=this.nativeCallbacks).complete)===null||l===void 0||l.call(a,d)}loadSdkScriptsModules(){const e=this.shadowRoot.querySelectorAll("div[data-script-id]");return Array.from(e).map((t=>t.moduleRes)).filter((t=>!!t))}loadSdkScripts(e){if(!(e!=null&&e.length))return null;const t=(n,a)=>l=>{this.dispatchEvent(new CustomEvent("components-context",{detail:{[sr(n.id,n.resultKey)]:l},bubbles:!0,composed:!0})),a(n.id)};this.loggerWrapper.debug(`Preparing to load scripts: ${e.map((n=>n.id)).join(", ")}`);const s=Promise.all(e==null?void 0:e.map((n=>r.__awaiter(this,void 0,void 0,(function*(){var a,l;const d=this.shadowRoot.querySelector(`[data-script-id="${n.id}"]`);if(d){this.loggerWrapper.debug("Script already loaded",n.id);const{moduleRes:c}=d;return(a=c==null?void 0:c.start)===null||a===void 0||a.call(c),c}yield this.injectNpmLib("@descope/flow-scripts","1.0.13",`dist/${n.id}.js`);const u=(l=globalThis.descope)===null||l===void 0?void 0:l[n.id];return new Promise(((c,h)=>{try{const p=u(n.initArgs,{baseUrl:this.baseUrl,ref:this},t(n,c),this.loggerWrapper);if(p){const v=document.createElement("div");v.setAttribute("data-script-id",n.id),v.moduleRes=p,this.shadowRoot.appendChild(v),this.nextRequestStatus.subscribe((()=>{var f;this.loggerWrapper.debug("Unloading script",n.id),(f=p.stop)===null||f===void 0||f.call(p)}))}}catch(p){h(p)}}))}))))),o=new Promise((n=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),n(!0)}),ii)}));return Promise.race([s,o])}get isDismissScreenErrorOnInput(){return this.getAttribute("dismiss-screen-error-on-input")==="true"}init(){if(!window.descopeBridge)return this._init();this.lazyInit=this._init}_init(){const e=Object.create(null,{init:{get:()=>super.init}});return r.__awaiter(this,void 0,void 0,(function*(){var t,s;this.shadowRoot.isConnected&&((t=this.flowState)===null||t===void 0||t.subscribe(this.onFlowChange.bind(this)),r.__classPrivateFieldGet(this,b,"m",Ke).call(this),window.addEventListener("visibilitychange",r.__classPrivateFieldGet(this,Ee,"f").visibilitychange)),yield(s=e.init)===null||s===void 0?void 0:s.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),r.__classPrivateFieldGet(this,he,"f").call(this),(e=r.__classPrivateFieldGet(this,V,"f"))===null||e===void 0||e.abort(),r.__classPrivateFieldSet(this,V,null,"f"),window.removeEventListener("visibilitychange",r.__classPrivateFieldGet(this,Ee,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return r.__awaiter(this,void 0,void 0,(function*(){let s;const o=Le(e),n=yield this.getTargetLocales();return n.includes(o.locale)?s=`${t}-${o.locale}.html`:n.includes(o.fallback)&&(s=`${t}-${o.fallback}.html`),s}))}getPageContent(e,t){return r.__awaiter(this,void 0,void 0,(function*(){if(t)try{const{body:s}=yield this.fetchStaticResource(t,"text");return s}catch(s){this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`,s)}try{const{body:s}=yield this.fetchStaticResource(e,"text");return s}catch(s){this.loggerWrapper.error("Failed to fetch flow page",s.message)}return null}))}onFlowChange(e,t,s){return r.__awaiter(this,void 0,void 0,(function*(){var o,n;const{projectId:a,flowId:l,tenant:d,stepId:u,executionId:c,action:h,screenId:p,screenState:v,redirectTo:f,redirectIsPopup:S,redirectUrl:w,token:g,code:m,isPopup:_,exchangeError:y,webauthnTransactionId:$,webauthnOptions:G,redirectAuthCodeChallenge:M,redirectAuthCallbackUrl:R,redirectAuthBackupCallbackUri:j,redirectAuthInitiator:ee,locale:B,samlIdpResponseUrl:be,samlIdpResponseSamlResponse:T,samlIdpResponseRelayState:te,nativeResponseType:we,nativePayload:L,reqTimestamp:z}=e,I=r.__rest(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectIsPopup","redirectUrl","token","code","isPopup","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","nativeResponseType","nativePayload","reqTimestamp"]);let U,je,ye;const Se=br(),{outboundAppId:lt}=this,{outboundAppScopes:ct}=this,K=this.sdk.getLastUserLoginId(),k=yield this.getFlowConfig(),H=yield this.getProjectConfig(),dt=Object.entries(H.flows||{}).reduce(((F,[C,O])=>(F[C]=O.version,F)),{}),ut=R&&M?{callbackUrl:R,codeChallenge:M,backupCallbackUri:j}:void 0,ht=this.nativeOptions?{platform:this.nativeOptions.platform,bridgeVersion:this.nativeOptions.bridgeVersion,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect}:void 0;let pt={};if(!c){const F=[...k.clientScripts||[],...k.sdkScripts||[]];if(k.conditions){let C=[];({startScreenId:U,conditionInteractionId:ye,startScreenName:je,clientScripts:C,componentsConfig:pt}=yr({loginId:K,code:m,token:g,abTestingKey:Se,lastAuth:Ce(K)},k.conditions)),F.push(...C||[])}else k.condition?{startScreenId:U,conditionInteractionId:ye}=wr(k.condition,{loginId:K,code:m,token:g,abTestingKey:Se,lastAuth:Ce(K)}):(je=k.startScreenName,U=k.startScreenId);if(r.__classPrivateFieldSet(this,le,this.loadSdkScripts(F),"f"),k.fingerprintEnabled&&k.fingerprintKey?yield r.W(k.fingerprintKey,this.baseUrl):r.X(),!bt(U,I)){const C=yield this.sdk.flow.start(l,Object.assign(Object.assign(Object.assign(Object.assign({tenant:d,redirectAuth:ut},I),{client:this.client}),w&&{redirectUrl:w}),{lastAuth:Ce(K),abTestingKey:Se,locale:Le(B).locale,nativeOptions:ht,outboundAppId:lt,outboundAppScopes:ct}),ye,"",H.componentsVersion,dt,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),m?{exchangeCode:m,idpInitiated:!0}:{}),I.descopeIdpInitiated&&{idpInitiated:!0}),g?{token:g}:{}),I.oidcLoginHint?{externalId:I.oidcLoginHint}:{}));return r.__classPrivateFieldGet(this,D,"f").call(this,C),void(((o=C==null?void 0:C.data)===null||o===void 0?void 0:o.status)!=="completed"&&this.flowState.update({code:void 0,token:void 0}))}}if(this.loggerWrapper.debug("Before popup postmessage send",JSON.stringify({isPopup:_,code:m,exchangeError:y,isCodeChanged:s("code"),isExchangeErrorChanged:s("exchangeError")})),_&&(s("code")&&m||s("exchangeError")&&y))return void r.__classPrivateFieldGet(this,b,"m",Gi).call(this,c,m,y);if(c&&(s("token")&&g||s("code")&&m||s("exchangeError")&&y)){const F=yield this.sdk.flow.next(c,u,ce.submit,k.version,H.componentsVersion,{token:g,exchangeCode:m,exchangeError:y});return r.__classPrivateFieldGet(this,D,"f").call(this,F),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(h===W.loadForm&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((F=>s(F)))){if(!be||!T)return void this.loggerWrapper.error("Did not get saml idp params data to load");Qs(be,T,te||"",Xs)}if(h===W.redirect&&(s("redirectTo")||s("deferredRedirect"))){if(!f)return void this.loggerWrapper.error("Did not get redirect url");if(f==="no-op")return;if(ee==="android"&&document.hidden)return void this.flowState.update({deferredRedirect:!0});if(this.loggerWrapper.debug(`Redirect is popup ${S}`),S){this.loggerWrapper.debug("Opening redirect in popup");const F=rr(f,"?",598,700),C=this.shouldUsePopupPostMessage();C&&(F.name=`descope-wc|${window.location.origin}`),this.loggerWrapper.debug("Popup communication method: "+(C?"postMessage":"BroadcastChannel"));const O=Q=>{this.loggerWrapper.debug("Received popup message",JSON.stringify(Q.data));const gt=C?this.popupOrigin:window.location.origin;if(Q.origin!==gt)return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${Q.origin}", expected: "${gt}"`);const{action:Di,data:vt}=Q.data||{};Di==="code"&&this.flowState.update({code:vt.code,exchangeError:vt.exchangeError})};let E;this.loggerWrapper.debug("Starting popup closed detection");const Ni=setInterval((()=>{F.closed&&(this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"),clearInterval(Ni),r.__classPrivateFieldGet(this,b,"m",q).call(this,"popupclosed",{}),this.loggerWrapper.debug("Cleaning up popup listeners"),E==null||E())}),1e3);if(C)window.addEventListener("message",O),E=()=>{this.loggerWrapper.debug("Cleaning up popup postMessage listener"),window.removeEventListener("message",O)};else{this.loggerWrapper.debug("Creating broadcast channel");const Q=new BroadcastChannel(c);Q.onmessage=O,E=()=>{this.loggerWrapper.debug("Closing channel"),Q.close()}}}else this.handleRedirect(f),this.flowState.update({redirectTo:"no-op"}),r.__classPrivateFieldGet(this,b,"m",q).call(this,"popupclosed",{});return}if(h===W.webauthnCreate||h===W.webauthnGet){if(!$||!G)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let F,C;(n=r.__classPrivateFieldGet(this,V,"f"))===null||n===void 0||n.abort(),r.__classPrivateFieldSet(this,V,null,"f");try{F=h===W.webauthnCreate?yield this.sdk.webauthn.helpers.create(G):yield this.sdk.webauthn.helpers.get(G)}catch(E){E.name==="InvalidStateError"?this.loggerWrapper.warn("WebAuthn operation failed",E.message):E.name!=="NotAllowedError"&&this.loggerWrapper.error(E.message),C=E.name}const O=yield this.sdk.flow.next(c,u,ce.submit,k.version,H.componentsVersion,{transactionId:$,response:F,failure:C});r.__classPrivateFieldGet(this,D,"f").call(this,O)}if(h===W.nativeBridge)return this.nativeCallbacks.complete=F=>r.__awaiter(this,void 0,void 0,(function*(){const C=yield this.sdk.flow.next(c,u,ce.submit,k.version,H.componentsVersion,F);r.__classPrivateFieldGet(this,D,"f").call(this,C)})),r.__classPrivateFieldGet(this,b,"m",xe).call(this,we,L),void setTimeout((()=>{this.dispatchEvent(new Event("popupclosed"))}),500);if((s("action")||s("deferredPolling"))&&r.__classPrivateFieldGet(this,oe,"f").call(this,c,u,k.version,H.componentsVersion),!p&&!U)return void this.loggerWrapper.warn("No screen was found to show");const Te=U||p,Mi=yield this.getHtmlFilenameWithLocale(B,Te),{oidcLoginHint:Ui,oidcPrompt:Ri,oidcErrorRedirectUri:ji,oidcResource:Ti,samlIdpUsername:Li}=I,Y={direction:ds(u,t.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),v==null?void 0:v.form),lastAuth:{loginId:K,name:this.sdk.getLastUserDisplayName()||K},componentsConfig:Object.assign(Object.assign(Object.assign({},k.componentsConfig),pt),v==null?void 0:v.componentsConfig)}),htmlFilename:`${Te}.html`,htmlLocaleFilename:Mi,screenId:Te,stepName:e.stepName||je,samlIdpUsername:Li,oidcLoginHint:Ui,oidcPrompt:Ri,oidcErrorRedirectUri:ji,oidcResource:Ti,action:h},Wi=Ce(K);bt(U,I)?Y.next=(F,C)=>r.__awaiter(this,void 0,void 0,(function*(){const O=(k==null?void 0:k.clientScripts)||[];yield r.__classPrivateFieldGet(this,b,"m",Xe).call(this,O);const E=yield this.sdk.flow.start(l,Object.assign(Object.assign(Object.assign(Object.assign({tenant:d,redirectAuth:ut},I),{lastAuth:Wi,preview:this.preview,abTestingKey:Se,client:this.client}),w&&{redirectUrl:w}),{locale:Le(B).locale,nativeOptions:ht,outboundAppId:lt,outboundAppScopes:ct}),ye,F,H.componentsVersion,dt,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),this.getComponentsContext()),yt(C)),m&&{exchangeCode:m,idpInitiated:!0}),I.descopeIdpInitiated&&{idpInitiated:!0}),g&&{token:g}),Y.next.isCustomScreen);return r.__classPrivateFieldGet(this,D,"f").call(this,E),E})):(s("projectId")||s("baseUrl")||s("executionId")||s("stepId"))&&(Y.next=(F,C)=>r.__awaiter(this,void 0,void 0,(function*(){const O=(v==null?void 0:v.clientScripts)||[];yield r.__classPrivateFieldGet(this,b,"m",Xe).call(this,O);const E=yield this.sdk.flow.next(c,u,F,k.version,H.componentsVersion,Object.assign(Object.assign({},this.getComponentsContext()),yt(C)),Y.next.isCustomScreen);return r.__classPrivateFieldGet(this,D,"f").call(this,E),E}))),this.loggerWrapper.debug("Got a screen with id",Y.screenId),yield r.__classPrivateFieldGet(this,b,"m",Pi).call(this,Y),this.stepState.update(Y)}))}onStepChange(e,t){return r.__awaiter(this,void 0,void 0,(function*(){var s,o;const{htmlFilename:n,htmlLocaleFilename:a,direction:l,next:d,screenState:u}=e;this.loggerWrapper.debug("Rendering a flow screen");const c=document.createElement("template");c.innerHTML=yield this.getPageContent(n,a);const h=c.content.cloneNode(!0),p=this.loadDescopeUiComponents(c);this.sdk.webauthn.helpers.isSupported()?yield r.__classPrivateFieldGet(this,b,"m",Fi).call(this,h,d):fr(h),!e.samlIdpUsername||!((s=u.form)===null||s===void 0)&&s.loginId||!((o=u.form)===null||o===void 0)&&o.email||(u.form||(u.form={}),u.form.loginId=e.samlIdpUsername,u.form.email=e.samlIdpUsername),ur(h,u,this.formConfig,this.loggerWrapper);const{geo:v}=yield this.getExecutionContext();vr(h,v);const f=()=>r.__awaiter(this,void 0,void 0,(function*(){var S,w;yield p;const g=this.contentRootElement;pr(g,(S=u==null?void 0:u.totp)===null||S===void 0?void 0:S.image),gr(g,(w=u==null?void 0:u.notp)===null||w===void 0?void 0:w.image),dr(g,h,u.cssVars,this.loggerWrapper),g.replaceChildren(h);const m=!t.htmlFilename;setTimeout((()=>{r.__classPrivateFieldGet(this,b,"m",Ii).call(this),this.validateOnBlur&&zs(g),hr(g,u),r.__classPrivateFieldGet(this,b,"m",Qe).call(this,{isFirstScreen:m,isCustomScreen:!1,stepName:e.stepName}),ai(g,this.autoFocus,m)})),r.__classPrivateFieldGet(this,b,"m",$i).call(this,d),g.querySelector(`[${Me}="polling"]`)&&d(ce.polling,{})}));l?r.__classPrivateFieldGet(this,b,"m",Je).call(this,f):f()}))}getInputs(){return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${it}])`))}shouldUsePopupPostMessage(){if(!this.popupOrigin)return!1;try{new URL(this.popupOrigin)}catch{return!1}return!0}}ue=new WeakMap,V=new WeakMap,le=new WeakMap,Ee=new WeakMap,Ie=new WeakMap,He=new WeakMap,oe=new WeakMap,he=new WeakMap,ze=new WeakMap,D=new WeakMap,Ye=new WeakMap,pe=new WeakMap,$e=new WeakMap,b=new WeakSet,Si=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1,deferredPolling:!1})}),300)},Ot=function(i,e,t){return r.__awaiter(this,void 0,void 0,(function*(){var s;return((s=this.nativeOptions)===null||s===void 0?void 0:s.bridgeVersion)>=2&&new Promise((o=>{this.nativeCallbacks.screenNext=t,this.nativeCallbacks.screenResolve=o,r.__classPrivateFieldGet(this,b,"m",xe).call(this,"beforeScreen",{screen:i,context:e})}))}))},Mt=function(i){var e;((e=this.nativeOptions)===null||e===void 0?void 0:e.bridgeVersion)>=2&&r.__classPrivateFieldGet(this,b,"m",xe).call(this,"afterScreen",{screen:i})},xe=function(i,e){r.__classPrivateFieldGet(this,b,"m",q).call(this,"bridge",{type:i,payload:e})},Ut=function({errorText:i,errorType:e}){const t=()=>{var s;let o=i;try{o=((s=this.errorTransformer)===null||s===void 0?void 0:s.call(this,{text:i,type:e}))||i}catch(n){this.loggerWrapper.error("Error transforming error message",n.message)}cr(this.contentRootElement,"error-message",o)};this.addEventListener("screen-updated",t,{once:!0}),t()},Ke=function(){var i,e,t;(i=this.stepState)===null||i===void 0||i.subscribe(this.onStepChange.bind(this),(s=>{var o=s.screenState,n=r.__rest(o===void 0?{}:o,["errorText","errorType"]),a=r.__rest(s,["screenState"]);return Object.assign(Object.assign({},a),{screenState:n})})),(e=this.stepState)===null||e===void 0||e.subscribe(r.__classPrivateFieldGet(this,b,"m",Ut).bind(this),(s=>{var o,n;return{errorText:(o=s==null?void 0:s.screenState)===null||o===void 0?void 0:o.errorText,errorType:(n=s==null?void 0:s.screenState)===null||n===void 0?void 0:n.errorType}}),{forceUpdate:!0}),(t=this.stepState)===null||t===void 0||t.subscribe(r.__classPrivateFieldGet(this,b,"m",Rt).bind(this),(s=>{var o,n;return{errorText:(o=s==null?void 0:s.screenState)===null||o===void 0?void 0:o.errorText,errorType:(n=s==null?void 0:s.screenState)===null||n===void 0?void 0:n.errorType}}),{forceUpdate:!0})},Rt=function({errorText:i,errorType:e}){(e||i)&&(this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((t=>{t.shadowRoot.querySelectorAll("descope-text-field[data-id]").forEach((s=>{s.value=""}))})),ai(this.contentRootElement,this.autoFocus,!1))},Ci=function(){return r.__awaiter(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Trying to restart the flow");const i=yield this.getComponentsVersion();this.reset(),i===(yield this.getComponentsVersion())?(this.loggerWrapper.debug("Components version was not changed, restarting flow"),this.flowState.update({stepId:null,executionId:null})):this.loggerWrapper.error("Components version mismatch, please reload the page")}))},Pi=function(i){return r.__awaiter(this,void 0,void 0,(function*(){var e;const t=Object.assign(Object.assign({},this.stepState.current),i),{next:s,stepName:o}=t,n=r.__rest(t,["next","stepName"]),a=ir(n);let l=yield r.__classPrivateFieldGet(this,b,"m",Ot).call(this,o,a,s);l||(l=!!(yield(e=this.onScreenUpdate)===null||e===void 0?void 0:e.call(this,o,a,s,this)));const d=!this.stepState.current.htmlFilename;if(r.__classPrivateFieldGet(this,He,"f").call(this,l),s&&(s.isCustomScreen=l),r.__classPrivateFieldGet(this,Ie,"f")!==l){const[u,c]=["flow","custom"].sort((()=>l?-1:1));this.loggerWrapper.debug(`Switching from ${c} screen to ${u} screen`),r.__classPrivateFieldSet(this,Ie,l,"f"),l?this.stepState.unsubscribeAll():r.__classPrivateFieldGet(this,b,"m",Ke).call(this)}l?(this.loggerWrapper.debug("Showing a custom screen"),r.__classPrivateFieldGet(this,b,"m",Qe).call(this,{isFirstScreen:d,isCustomScreen:l,stepName:i.stepName}),this.disableKeyPressHandler()):this.handleKeyPress(),this.stepState.forceUpdate=l}))},Je=function(i){this.contentRootElement.addEventListener("transitionend",(()=>{this.loggerWrapper.debug("page switch transition end"),this.contentRootElement.classList.remove("fade-out"),i()}),{once:!0}),this.loggerWrapper.debug("page switch transition start"),this.contentRootElement.classList.add("fade-out")},jt=function(i){const e=i.getAttribute("name");if(!["email"].includes(e)){const t=`user-${e}`;i.setAttribute("name",t),i.addEventListener("input",(()=>{i.setAttribute("name",i.value?e:t)}))}},Fi=function(i,e){return r.__awaiter(this,void 0,void 0,(function*(){var t;(t=r.__classPrivateFieldGet(this,V,"f"))===null||t===void 0||t.abort();const s=i.querySelector('*[autocomplete="webauthn"]');if(s&&(yield mr())){const{options:o,transactionId:n}=(yield r.__classPrivateFieldGet(this,Ye,"f").call(this))||{};o&&n&&(r.__classPrivateFieldGet(this,b,"m",jt).call(this,s),r.__classPrivateFieldSet(this,V,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(o,r.__classPrivateFieldGet(this,V,"f")).then((a=>r.__awaiter(this,void 0,void 0,(function*(){e(s.id,{transactionId:n,response:a})})))).catch((a=>{a.name!=="AbortError"&&this.loggerWrapper.error("Conditional login failed",a.message)})))}}))},Qe=function({isFirstScreen:i,isCustomScreen:e,stepName:t}){i&&r.__classPrivateFieldGet(this,b,"m",q).call(this,"ready",{}),e||r.__classPrivateFieldGet(this,b,"m",Mt).call(this,t),r.__classPrivateFieldGet(this,b,"m",q).call(this,"page-updated",{screenName:t}),r.__classPrivateFieldGet(this,b,"m",q).call(this,"screen-updated",{screenName:t})},ki=function(){let i=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((e=>{var t,s;e.localName==="slot"||e.classList.contains("hidden")||((t=e.reportValidity)===null||t===void 0||t.call(e),i&&(i=(s=e.checkValidity)===null||s===void 0?void 0:s.call(e)))})),i},Ai=function(){return r.__awaiter(this,void 0,void 0,(function*(){const i=this.getInputs();return(yield Promise.all(i.map((e=>r.__awaiter(this,void 0,void 0,(function*(){return{name:e.getAttribute("name"),value:e.value}})))))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:t.value})),{})}))},Ei=function(i){const e=Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter((n=>n!==i)),t=()=>r.__awaiter(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Restoring components state"),this.removeEventListener("popupclosed",t),i.removeAttribute("loading"),e.forEach((l=>{l.removeAttribute("disabled")}));const n=yield this.getFlowConfig(),a=[...n.clientScripts||[],...n.sdkScripts||[]];this.loadSdkScripts(a)})),s=()=>{var n;window.removeEventListener("pageshow",r.__classPrivateFieldGet(this,pe,"f")),r.__classPrivateFieldSet(this,pe,(l=>{l.persisted&&(this.logger.debug("Page was loaded from cache, restoring components state"),t())}),"f"),window.addEventListener("pageshow",r.__classPrivateFieldGet(this,pe,"f"),{once:!0});const a=(n=this.stepState)===null||n===void 0?void 0:n.subscribe(((l,d)=>{l===d&&t(),this.removeEventListener("popupclosed",t),this.stepState.unsubscribe(a)}),(l=>l.screenId),{forceUpdate:!0})},o=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?(this.addEventListener("popupclosed",t,{once:!0}),i.setAttribute("loading","true"),e.forEach((a=>a.setAttribute("disabled","true")))):(this.nextRequestStatus.unsubscribe(o),s())}))},xi=function(i={}){var e,t;const s=wt(i,["externalId","email","phone"]),o=wt(i,["newPassword","password"]);if(s&&o)try{if(!globalThis.PasswordCredential)return;const n=new globalThis.PasswordCredential({id:s,password:o});(t=(e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.store)===null||t===void 0||t.call(e,n)}catch(n){this.loggerWrapper.error("Could not store credentials",n.message)}},Ii=function(){er(),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((i=>r.__classPrivateFieldGet(this,b,"m",Tt).call(this,i)))},Tt=function(i){i&&i.querySelectorAll("input").forEach((e=>{const t=e.getAttribute("slot"),s=`input-${i.id}-${t}`,o=document.createElement("slot");o.setAttribute("name",s),o.setAttribute("slot",t),i.appendChild(o),e.setAttribute("slot",s),this.appendChild(e)}))},Xe=function(i){return r.__awaiter(this,void 0,void 0,(function*(){if(r.__classPrivateFieldGet(this,le,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const o=Date.now();yield r.__classPrivateFieldGet(this,le,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-o).toString())}const e=this.loadSdkScriptsModules(),t=i.map((o=>o.id));for(const o of e)if(t.includes(o.id))try{typeof o.present=="function"&&((yield o.present())||this.loggerWrapper.debug(`Sdk script ${o.id} was cancelled`))}catch(n){this.loggerWrapper.error(`Failed to present ${o.id} script module`,n.message)}const s=[];for(const o of e)typeof o.refresh=="function"&&s.push(o.refresh());if(s.length>0)try{yield st(ii,Promise.all(s),null)}catch(o){this.loggerWrapper.error("Failed to refresh script module",o.message)}}))},Lt=function(i){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((e=>{e.addEventListener("input",(()=>{var t;!((t=e.checkValidity)===null||t===void 0)&&t.call(e)&&r.__classPrivateFieldGet(this,$e,"f").call(this,e,i)}))}))},$i=function(i){this.contentRootElement.querySelectorAll(`descope-button:not([${_t}]), [data-type="button"]:not([${_t}]`).forEach((e=>{e.onclick=()=>{r.__classPrivateFieldGet(this,$e,"f").call(this,e,i)}})),r.__classPrivateFieldGet(this,b,"m",Lt).call(this,i),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${it}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((t=>Object.assign(Object.assign({},t),{screenState:Object.assign(Object.assign({},t.screenState),{errorText:"",errorType:""})})))}))}))},q=function(i,e){this.dispatchEvent(new CustomEvent(i,{detail:e}))},Gi=function(i,e,t){var s;const[o,n]=((s=window.name)===null||s===void 0?void 0:s.split("|"))||[],a={data:{code:e,exchangeError:t},action:"code"};if(o==="descope-wc"&&n){this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin",n);try{window.opener.postMessage(a,n)}catch(l){this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)",l==null?void 0:l.message)}}else{this.loggerWrapper.debug("Creating popup channel",i);const l=new BroadcastChannel(i);l.postMessage(a),l.close()}try{window.close()}catch{}};customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",Oi);const lo=Object.freeze(Object.defineProperty({__proto__:null,default:Oi},Symbol.toStringTag,{value:"Module"}));exports.c=ne;exports.index=lo;exports.injectStyleMixin=Re;
1
+ "use strict";const s=require("react/jsx-runtime"),g=require("react"),Ce=require("lucide-react");require("./colors.cjs.js");const Qn=g.createContext(void 0),Cn=e=>(...t)=>{if(!e)throw Error("You can only use this function after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component");return e(...t)},er=()=>typeof window<"u"&&!!window.descopeBridge,ot={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.27.1"},On=typeof window<"u";var rt=function(){return rt=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},rt.apply(this,arguments)};function q(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n}function tr(e,t,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function c(u){try{d(o.next(u))}catch(p){a(p)}}function l(u){try{d(o.throw(u))}catch(p){a(p)}}function d(u){u.done?i(u.value):r(u.value).then(c,l)}d((o=o.apply(e,t||[])).next())})}function nr(e,t,n){if(n||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}function or(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:t.get(e)}function rr(e,t,n,o,r){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n}class Me extends Error{}Me.prototype.name="InvalidTokenError";function ir(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function sr(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ir(t)}catch{return atob(t)}}function Jt(e,t){if(typeof e!="string")throw new Me("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Me(`Invalid token specified: missing part #${n+1}`);let r;try{r=sr(o)}catch(i){throw new Me(`Invalid token specified: invalid base64 for part #${n+1} (${i.message})`)}try{return JSON.parse(r)}catch(i){throw new Me(`Invalid token specified: invalid json for part #${n+1} (${i.message})`)}}var w={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const Gn="<region>",ar=`https://api.${Gn}descope.com`,An=1e3,Un=6e5,Zn="dct",En=()=>{const e={};return{headers(t){const n=typeof t.entries=="function"?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap(t=>e[t]?[`${t!=="Title"?`${t}: `:""}${e[t]}`]:[]).join(`
2
+ `)}},lr=[503,521,522,524,530],Tn=[100,5e3,5e3],cr=e=>new Promise(t=>setTimeout(t,e)),Dn=e=>async(...t)=>{let n=await e(...t),o=0;for(;lr.includes(n.status)&&o<Tn.length;)await cr(Tn[o]),n=await e(...t),o++;o>0&&(n.retries=o);const r=await n.text();return n.text=()=>Promise.resolve(r),n.json=()=>Promise.resolve(JSON.parse(r)),n.clone=()=>n,n},dr=(e,t)=>{const n=t||fetch;return n||e==null||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...o)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((i=>En().title("Request").url(i[0]).method(i[1].method).headers(i[1].headers).body(i[1].body).build())(o));const r=await Dn(n)(...o);return e[r.ok?"log":"error"](await(async i=>{const a=await i.text();return En().title("Response").url(i.url.toString()).status(`${i.status} ${i.statusText}`).headers(i.headers).body(a).retries(i.retries).build()})(r)),r}:Dn(n)};let Ge;const ur=()=>{if(Ge)return Ge;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return Ge=`${t}-${n}`,Ge};var Se;(function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"})(Se||(Se={}));const Pn=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(Gn,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${e==null?void 0:e.replace(/^\//,"")}`:t;if(n){const a=Object.keys(n);a.forEach((c,l)=>{i=`${i}${l===0?"?":""}${c}=${encodeURIComponent(n[c])}${l===a.length-1?"":"&"}`})}return i},pr=(...e)=>new Headers(e.reduce((t,n)=>((o=>Array.isArray(o)?o:o instanceof Headers?Array.from(o.entries()):o?Object.entries(o):[])(n).forEach(([o,r])=>{t[o]=typeof r=="function"?r():r}),t),{})),gr={"Content-Type":"application/json"},hr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},fr=(e,t)=>{const n={"x-descope-sdk-session-id":ur(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.58.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},vr=e=>{try{e=JSON.parse(e)}catch{return!1}return typeof e=="object"&&e!==null};var mr=(e=>t=>{var n;return e(Object.assign(Object.assign({},t),{hooks:{beforeRequest:o=>{var r;const i=[].concat(((r=t.hooks)===null||r===void 0?void 0:r.beforeRequest)||[]);return i==null?void 0:i.reduce((a,c)=>c(a),o)},afterRequest:async(o,r)=>{var i;const a=[].concat(((i=t.hooks)===null||i===void 0?void 0:i.afterRequest)||[]);a.length!=0&&(await Promise.allSettled(a==null?void 0:a.map(c=>c(o,r==null?void 0:r.clone())))).forEach(c=>{var l;return c.status==="rejected"&&((l=t.logger)===null||l===void 0?void 0:l.error(c.reason))})},transformResponse:(n=t.hooks)===null||n===void 0?void 0:n.transformResponse}}))})(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:o,logger:r,hooks:i,cookiePolicy:a,fetch:c})=>{const l=e||ar,d=dr(r,c),u=async p=>{var v;const k=i!=null&&i.beforeRequest?i.beforeRequest(p):p,{path:h,body:y,headers:x,queryParams:U,method:A,token:R}=k,T=(z=>z===void 0?void 0:JSON.stringify(z))(y),m={headers:pr(hr(t,R),fr(t,o),(n==null?void 0:n.baseHeaders)||{},vr(T)?gr:{},x),method:A,body:T};a!==null&&(m.credentials=a||"include");const C=await d(Pn({path:h,baseUrl:l,queryParams:U,projectId:t}),m);if(i!=null&&i.afterRequest&&await i.afterRequest(p,C==null?void 0:C.clone()),i==null?void 0:i.transformResponse){const z=await C.json(),K=(((v=C.headers)===null||v===void 0?void 0:v.get("set-cookie"))||"").split(";").reduce((Z,B)=>{const[V,Y]=B.split("=");return Object.assign(Object.assign({},Z),{[V.trim()]:Y})},{}),G=Object.assign(Object.assign({},C),{json:()=>Promise.resolve(z),cookies:K});return G.clone=()=>G,i.transformResponse(G)}return C};return{get:(p,{headers:v,queryParams:k,token:h}={})=>u({path:p,headers:v,queryParams:k,body:void 0,method:Se.get,token:h}),post:(p,v,{headers:k,queryParams:h,token:y}={})=>u({path:p,headers:k,queryParams:h,body:v,method:Se.post,token:y}),patch:(p,v,{headers:k,queryParams:h,token:y}={})=>u({path:p,headers:k,queryParams:h,body:v,method:Se.patch,token:y}),put:(p,v,{headers:k,queryParams:h,token:y}={})=>u({path:p,headers:k,queryParams:h,body:v,method:Se.put,token:y}),delete:(p,{headers:v,queryParams:k,token:h}={})=>u({path:p,headers:v,queryParams:k,body:void 0,method:Se.delete,token:h}),hooks:i,buildUrl:(p,v)=>Pn({projectId:t,baseUrl:l,path:p,queryParams:v})}}),yr={TOO_MANY_REQUESTS:429};function _n(e,t,n){var o;let r=at(e);if(t){if(!(r!=null&&r.tenants)&&(r==null?void 0:r[Zn])===t)return(r==null?void 0:r[n])||[];r=(o=r==null?void 0:r.tenants)===null||o===void 0?void 0:o[t]}const i=r==null?void 0:r[n];return Array.isArray(i)?i:[]}function at(e){if(typeof e!="string"||!e)throw new Error("Invalid token provided");return Jt(e)}function xr(e){const{exp:t}=at(e);return new Date().getTime()/1e3>t}function wr(e){let t=at(e);const n=Object.keys(t==null?void 0:t.tenants);return Array.isArray(n)?n:[]}function br(e,t){return _n(e,t,"permissions")}function kr(e,t){return _n(e,t,"roles")}const se=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function b(e,t){var n;const o=await e,r={code:o.status,ok:o.ok,response:o},i=await o.clone().json();return o.ok?r.data=t?t(i):i:(r.error=i,o.status===yr.TOO_MANY_REQUESTS&&Object.assign(r.error,{retryAfter:Number.parseInt((n=o.headers)===null||n===void 0?void 0:n.get("retry-after"))||0})),r}function Ir(e){var t;return((t=at(e))===null||t===void 0?void 0:t[Zn])||""}const be=(e,t)=>(n=t)=>o=>!e(o)&&n.replace("{val}",o),eo=(e,t)=>(n=t)=>o=>{const r=e.filter(i=>i(o));return!(r.length<e.length)&&(n?n.replace("{val}",o):r.join(" OR "))},to=(...e)=>({validate:t=>(e.forEach(n=>{const o=n(t);if(o)throw new Error(o)}),!0)}),no=e=>t=>e.test(t),jr=no(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Sr=no(/^\+[1-9]{1}[0-9]{3,14}$/),Cr=(e,t)=>n=>to(...t).validate(((o,r,i)=>{const a=(Array.isArray(r)?r.join("."):String(r)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,(u,p,v)=>"."+v).split("."),c=a.length;let l=0,d=o===Object(o)?o:void 0;for(;d!=null&&l<c;)d=d[a[l++]];return l&&l===c&&d!==void 0?d:i})(n,e)),Or=be(jr,'"{val}" is not a valid email'),Ar=be(Sr,'"{val}" is not a valid phone number'),Ur=be((Rn=1,e=>e.length>=Rn),"Minimum length is 1");var Rn;const Re=be(e=>typeof e=="string","Input is not a string"),Er=be(e=>Array.isArray(e),"Input is not an array"),Tr=be(e=>typeof e=="boolean","Input is not a boolean"),Dr=be(e=>e===void 0,"Input is defined"),Dt=eo([Re(),Dr()],"Input is not a string or undefined"),Pr=eo([Er(),Tr()],"Input is not an array or boolean"),E=(...e)=>t=>(...n)=>(e.forEach((o,r)=>to(...o).validate(n[r])),t(...n)),oo=e=>[Re(`"${e}" must be a string`)],ro=e=>[Dt(`"${e}" must be string or undefined`)],N=e=>[Re(`"${e}" must be a string`),Ur(`"${e}" must not be empty`)],Mt=e=>[Re(`"${e}" must be a string`),Or()],io=e=>[Re(`"${e}" must be a string`),Ar()],Rr=E(N("accessKey")),Nr=e=>({exchange:Rr((t,n)=>b(e.post(w.accessKey.exchange,{loginOptions:n},{token:t})))}),Be=(e,t,n)=>(t.forEach(o=>{const r=o.split(".");let i=r.shift(),a=e;for(;r.length>0;){if(a=a[i],!i||!a)throw Error(`Invalid path "${o}", "${i}" is missing or has no value`);i=r.shift()}if(typeof a[i]!="function")throw Error(`"${o}" is not a function`);const c=a[i];a[i]=n(c)}),e),so=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||An,An),timeoutMs:Math.min(t||Un,Un)});var we,Pt;(function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"})(we||(we={})),function(e){e.email="email"}(Pt||(Pt={}));const he=Object.assign(Object.assign({},we),Pt);var Nn;(function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"})(Nn||(Nn={}));const ao=N("loginId"),Fr=E(N("token")),bt=E(ao),Lr=E(N("pendingRef")),zr=E(ao,Mt("email")),Br=e=>({verify:Fr(t=>b(e.post(w.enchantedLink.verify,{token:t}))),signIn:bt((t,n,o={},r)=>{var{providerId:i}=o,a=q(o,["providerId"]);return b(e.post(se(w.enchantedLink.signIn,he.email),{loginId:t,URI:n,loginOptions:a,providerId:i},{token:r}))}),signUpOrIn:bt((t,n,o={})=>{var{providerId:r}=o,i=q(o,["providerId"]);return b(e.post(se(w.enchantedLink.signUpOrIn,he.email),{loginId:t,URI:n,loginOptions:i,providerId:r}))}),signUp:bt((t,n,o,r={})=>{var{providerId:i}=r,a=q(r,["providerId"]);return b(e.post(se(w.enchantedLink.signUp,he.email),{loginId:t,URI:n,user:o,loginOptions:a,providerId:i}))}),waitForSession:Lr((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=so(n);let a;const c=setInterval(async()=>{const l=await e.post(w.enchantedLink.session,{pendingRef:t});l.ok&&(clearInterval(c),a&&clearTimeout(a),o(b(Promise.resolve(l))))},r);a=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)})),update:{email:zr((t,n,o,r,i)=>b(e.post(w.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))}}),qr=E(N("flowId")),Hr=E(N("executionId"),N("stepId"),N("interactionId")),Jr=e=>({start:qr((t,n,o,r,i,a,c,l=!1)=>b(e.post(w.flow.start,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,componentsVersion:i,flowVersions:a,input:c,isCustomScreen:l}))),next:Hr((t,n,o,r,i,a,c=!1)=>b(e.post(w.flow.next,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:a,isCustomScreen:c})))}),Wt=N("loginId"),Mr=E(N("token")),kt=E(Wt),Wr=E(Wt,io("phone")),Kr=E(Wt,Mt("email")),It=Object.keys(he).filter(e=>e!==we.voice&&e!==we.im),Vr=e=>({verify:Mr(t=>b(e.post(w.magicLink.verify,{token:t}))),signIn:It.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:kt((o,r,i={},a)=>{var{providerId:c}=i,l=q(i,["providerId"]);return b(e.post(se(w.magicLink.signIn,n),{loginId:o,URI:r,loginOptions:l,providerId:c},{token:a}))})}),{}),signUp:It.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:kt((o,r,i,a={})=>{var{providerId:c}=a,l=q(a,["providerId"]);return b(e.post(se(w.magicLink.signUp,n),{loginId:o,URI:r,user:i,loginOptions:l,providerId:c}))})}),{}),signUpOrIn:It.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:kt((o,r,i={})=>{var{providerId:a}=i,c=q(i,["providerId"]);return b(e.post(se(w.magicLink.signUpOrIn,n),{loginId:o,URI:r,loginOptions:c,providerId:a}))})}),{}),update:{email:Kr((t,n,o,r,i)=>b(e.post(w.magicLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))),phone:Object.keys(we).filter(t=>t!==we.voice).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:Wr((o,r,i,a,c)=>b(e.post(se(w.magicLink.update.phone,n),Object.assign({loginId:o,phone:r,URI:i},c),{token:a})))}),{})}});var Rt;(function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple",e.discord="discord",e.linkedin="linkedin",e.slack="slack"})(Rt||(Rt={}));const $r=E(N("code")),Yr=e=>({start:Object.assign((t,n,o,r,i)=>b(e.post(w.oauth.start,o||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),i&&{loginHint:i}),token:r})),Object.keys(Rt).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:(o,r,i,a)=>b(e.post(w.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:n},o&&{redirectURL:o}),a&&{loginHint:a}),token:i}))}),{})),exchange:$r(t=>b(e.post(w.oauth.exchange,{code:t}))),startNative:(t,n,o)=>b(e.post(w.oauth.startNative,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>b(e.post(w.oauth.finishNative,{provider:t,stateId:n,user:o,code:r,idToken:i})),getOneTapClientId:t=>b(e.get(w.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,o,r)=>b(e.post(w.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r})),exchangeOneTapIDToken:(t,n,o,r)=>b(e.post(w.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r}))}),Xr=N("appId"),Qr=E(Xr),Gr=e=>({connect:Qr((t,n,o)=>{const r=n==null?void 0:n.tenantId,i=n==null?void 0:n.tenantLevel;return n==null||delete n.tenantId,n==null||delete n.tenantLevel,b(e.post(w.outbound.connect,{appId:t,tenantId:r,tenantLevel:i,options:n},{token:o}))})}),lt=N("loginId"),Zr=E(lt,N("code")),jt=E(lt),_r=E(lt,io("phone")),ei=E(lt,Mt("email")),ti=e=>({verify:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:Zr((o,r)=>b(e.post(se(w.otp.verify,n),{code:r,loginId:o})))}),{}),signIn:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:jt((o,r={},i)=>{var{providerId:a}=r,c=q(r,["providerId"]);return b(e.post(se(w.otp.signIn,n),{loginId:o,loginOptions:c,providerId:a},{token:i}))})}),{}),signUp:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:jt((o,r,i={})=>{var{providerId:a}=i,c=q(i,["providerId"]);return b(e.post(se(w.otp.signUp,n),{loginId:o,user:r,loginOptions:c,providerId:a}))})}),{}),signUpOrIn:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:jt((o,r={})=>{var{providerId:i}=r,a=q(r,["providerId"]);return b(e.post(se(w.otp.signUpOrIn,n),{loginId:o,loginOptions:a,providerId:i}))})}),{}),update:{email:ei((t,n,o,r)=>b(e.post(w.otp.update.email,Object.assign({loginId:t,email:n},r),{token:o}))),phone:Object.keys(we).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:_r((o,r,i,a)=>b(e.post(se(w.otp.update.phone,n),Object.assign({loginId:o,phone:r},a),{token:i})))}),{})}}),ni=E(N("tenant")),oi=E(N("code")),ri=e=>({start:ni((t,n,o,r,i,a,c,l)=>b(e.post(w.saml.start,o||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),i&&{ssoId:i}),a&&{forceAuthn:"true"}),c&&{loginHint:c}),l&&{initiatedEmail:t})},r&&{token:r})))),exchange:oi(t=>b(e.post(w.saml.exchange,{code:t})))}),Kt=N("loginId"),ii=E(Kt,N("code")),si=E(Kt),ai=E(Kt),li=e=>({signUp:si((t,n)=>b(e.post(w.totp.signUp,{loginId:t,user:n}))),verify:ii((t,n,o,r)=>b(e.post(w.totp.verify,{loginId:t,code:n,loginOptions:o},{token:r}))),update:ai((t,n)=>b(e.post(w.totp.update,{loginId:t},{token:n})))}),ct=N("loginId"),lo=N("newPassword"),Fn=E(ct,N("password")),ci=E(ct),di=E(ct,lo),ui=E(ct,N("oldPassword"),lo),pi=e=>({signUp:Fn((t,n,o,r={})=>{var{providerId:i}=r,a=q(r,["providerId"]);return b(e.post(w.password.signUp,{loginId:t,password:n,user:o,loginOptions:a,providerId:i}))}),signIn:Fn((t,n,o={})=>{var{providerId:r}=o,i=q(o,["providerId"]);return b(e.post(w.password.signIn,{loginId:t,password:n,loginOptions:i,providerId:r}))}),sendReset:ci((t,n,o)=>b(e.post(w.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:o}))),update:di((t,n,o)=>b(e.post(w.password.update,{loginId:t,newPassword:n},{token:o}))),replace:ui((t,n,o)=>b(e.post(w.password.replace,{loginId:t,oldPassword:n,newPassword:o}))),policy:()=>b(e.get(w.password.policy))}),gi=oo("loginId"),Vt=N("loginId"),dt=N("origin"),hi=E(Vt,dt,N("name")),fi=E(Vt,dt),vi=E(gi,dt),mi=E(Vt,dt,ro("token")),St=E(N("transactionId"),N("response")),yi=e=>({signUp:{start:hi((t,n,o,r)=>b(e.post(w.webauthn.signUp.start,{user:{loginId:t,name:o},origin:n,passkeyOptions:r}))),finish:St((t,n)=>b(e.post(w.webauthn.signUp.finish,{transactionId:t,response:n})))},signIn:{start:vi((t,n,o,r,i)=>b(e.post(w.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:o,passkeyOptions:i},{token:r}))),finish:St((t,n)=>b(e.post(w.webauthn.signIn.finish,{transactionId:t,response:n})))},signUpOrIn:{start:fi((t,n,o)=>b(e.post(w.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:o})))},update:{start:mi((t,n,o,r)=>b(e.post(w.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:o}))),finish:St((t,n)=>b(e.post(w.webauthn.update.finish,{transactionId:t,response:n})))}}),xi=oo("loginId"),Ct=E(xi),wi=E(N("pendingRef")),bi=e=>({signUpOrIn:Ct((t,n={})=>{var{providerId:o}=n,r=q(n,["providerId"]);return b(e.post(w.notp.signUpOrIn,{loginId:t,loginOptions:r,providerId:o}))}),signUp:Ct((t,n,o={})=>{var{providerId:r}=o,i=q(o,["providerId"]);return b(e.post(w.notp.signUp,{loginId:t,user:n,providerId:r,loginOptions:i}))}),signIn:Ct((t,n={},o)=>{var{providerId:r}=n,i=q(n,["providerId"]);return b(e.post(w.notp.signIn,{loginId:t,loginOptions:i,providerId:r},{token:o}))}),waitForSession:wi((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=so(n);let a;const c=setInterval(async()=>{const l=await e.post(w.notp.session,{pendingRef:t});l.ok&&(clearInterval(c),a&&clearTimeout(a),o(b(Promise.resolve(l))))},r);a=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)}))}),qe=E(N("token")),He=E(ro("token"));var Ln,zn,ki=E([(Ln="projectId",zn=N("projectId"),be(Cr(Ln,zn))())])(e=>{const{projectId:t,logger:n,baseUrl:o,cookiePolicy:r,baseHeaders:i={},refreshCookieName:a,fetch:c}=e;return l=mr({baseUrl:o,projectId:t,logger:n,hooks:{get beforeRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.beforeRequest},get afterRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.afterRequest},get transformResponse(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:i},refreshCookieName:a,fetch:c}),{accessKey:Nr(l),otp:ti(l),magicLink:Vr(l),enchantedLink:Br(l),oauth:Yr(l),outbound:Gr(l),saml:ri(l),totp:li(l),notp:bi(l),webauthn:yi(l),password:pi(l),flow:Jr(l),refresh:He((d,u,p,v)=>{const k={};p&&(k.externalToken=p);const h=v?w.tryRefresh:w.refresh;return b(l.post(h,k,{token:d,queryParams:u}))}),selectTenant:E([Re("tenantId")],[Dt('"token" must be string or undefined')])((d,u)=>b(l.post(w.selectTenant,{tenant:d},{token:u}))),logout:He(d=>b(l.post(w.logout,{},{token:d}))),logoutAll:He(d=>b(l.post(w.logoutAll,{},{token:d}))),me:He(d=>b(l.get(w.me,{token:d}))),myTenants:E([Pr('"tenants" must a string array or a boolean')],[Dt('"token" must be string or undefined')])((d,u)=>{const p={};return typeof d=="boolean"?p.dct=d:p.ids=d,b(l.post(w.myTenants,p,{token:u}))}),history:He(d=>b(l.get(w.history,{token:d}))),isJwtExpired:qe(xr),getTenants:qe(wr),getJwtPermissions:qe(br),getJwtRoles:qe(kr),getCurrentTenant:qe(Ir),httpClient:l};var l}),Ii=Object.assign(ki,{DeliveryMethods:he});/*! js-cookie v3.0.5 | MIT */function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var ji={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Nt(e,t){function n(r,i,a){if(!(typeof document>"u")){a=Ze({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var l in a)a[l]&&(c+="; "+l,a[l]!==!0&&(c+="="+a[l].split(";")[0]));return document.cookie=r+"="+e.write(i,r)+c}}function o(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var i=document.cookie?document.cookie.split("; "):[],a={},c=0;c<i.length;c++){var l=i[c].split("="),d=l.slice(1).join("=");try{var u=decodeURIComponent(l[0]);if(a[u]=e.read(d,u),r===u)break}catch{}}return r?a[r]:a}}return Object.create({set:n,get:o,remove:function(r,i){n(r,"",Ze({},i,{expires:-1}))},withAttributes:function(r){return Nt(this.converter,Ze({},this.attributes,r))},withConverter:function(r){return Nt(Ze({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Pe=Nt(ji,{path:"/"});function Si(e,t){return function(n,o){return Object.prototype.hasOwnProperty.call(n,o)}(e,t)?e[t]:void 0}function Ci(e,t,n,o){var r,i=document,a="securitypolicyviolation",c=function(d){var u=new URL(e,location.href),p=d.blockedURI;p!==u.href&&p!==u.protocol.slice(0,-1)&&p!==u.origin||(r=d,l())};i.addEventListener(a,c);var l=function(){return i.removeEventListener(a,c)};return o==null||o.then(l,l),Promise.resolve().then(t).then(function(d){return l(),d},function(d){return new Promise(function(u){var p=new MessageChannel;p.port1.onmessage=function(){return u()},p.port2.postMessage(null)}).then(function(){if(l(),r)return n(r);throw d})})}var Oi={default:"endpoint"},co="Blocked by CSP",uo="The endpoint parameter is not a valid URL",Ai="API key required",Ui="3.11.6",$t="Failed to load the JS script of the agent",Yt="9319";function Ei(e,t){var n,o,r,i,a,c,l,d=[],u=(n=function(h){var y=nr([],h,!0);return{current:function(){return y[0]},postpone:function(){var x=y.shift();x!==void 0&&y.push(x)},exclude:function(){y.shift()}}}(e),i=100,a=3e3,c=0,o=function(){return Math.random()*Math.min(a,i*Math.pow(2,c++))},r=new Set,[n.current(),function(h,y){var x,U=y instanceof Error?y.message:"";if(U===co||U===uo)n.exclude(),x=0;else if(U===Yt)n.exclude();else if(U===$t){var A=Date.now()-h.getTime()<50,R=n.current();R&&A&&!r.has(R)&&(r.add(R),x=0),n.postpone()}else n.postpone();var T=n.current();return T===void 0?void 0:[T,x??h.getTime()+o()-Date.now()]}]),p=u[0],v=u[1];if(p===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var k=function(h){var y=new Date,x=function(A){return d.push({url:h,startedAt:y,finishedAt:new Date,error:A})},U=t(h);return U.then(function(){return x()},x),U.catch(function(A){if(l!=null||(l=A),d.length>=5)throw l;var R=v(y,A);if(!R)throw l;var T,m=R[0],C=R[1];return(T=C,new Promise(function(z){return setTimeout(z,T)})).then(function(){return k(m)})})};return k(p).then(function(h){return[h,d]})}var po="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Ti=po;function Di(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=o===void 0?n:o,i=q(e,["scriptUrlPattern","token","apiKey"]),a=(t=Si(e,"scriptUrlPattern"))!==null&&t!==void 0?t:po,c=function(){var u=[],p=function(){u.push({time:new Date,state:document.visibilityState})},v=function(k,h,y,x){return k.addEventListener(h,y,x),function(){return k.removeEventListener(h,y,x)}}(document,"visibilitychange",p);return p(),[u,v]}(),l=c[0],d=c[1];return Promise.resolve().then(function(){if(!r||typeof r!="string")throw new Error(Ai);var u=function(p,v){return(Array.isArray(p)?p:[p]).map(function(k){return function(h,y){var x=encodeURIComponent;return h.replace(/<[^<>]+>/g,function(U){return U==="<version>"?"3":U==="<apiKey>"?x(y):U==="<loaderVersion>"?x(Ui):U})}(String(k),v)})}(a,r);return Ei(u,Pi)}).catch(function(u){throw d(),function(p){return p instanceof Error&&p.message===Yt?new Error($t):p}(u)}).then(function(u){var p=u[0],v=u[1];return d(),p.load(rt(rt({},i),{ldi:{attempts:v,visibilityStates:l}}))})}function Pi(e){return Ci(e,function(){return function(t){return new Promise(function(n,o){if(function(c){if(URL.prototype)try{return new URL(c,location.href),!1}catch(l){if(l instanceof Error&&l.name==="TypeError")return!0;throw l}}(t))throw new Error(uo);var r=document.createElement("script"),i=function(){var c;return(c=r.parentNode)===null||c===void 0?void 0:c.removeChild(r)},a=document.head||document.getElementsByTagName("head")[0];r.onload=function(){i(),n()},r.onerror=function(){i(),o(new Error($t))},r.async=!0,r.src=t,a.appendChild(r)})}(e)},function(){throw new Error(co)}).then(Ri)}function Ri(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(o,r){var i,a=(i=Object.getOwnPropertyDescriptor)===null||i===void 0?void 0:i.call(Object,o,r);a!=null&&a.configurable?delete o[r]:a&&!a.writable||(o[r]=void 0)}(e,t),typeof(n==null?void 0:n.load)!="function")throw new Error(Yt);return n}const go="3.2.0",ee=typeof window<"u",Ot=Math.pow(2,31)-1,Ni=`https://descopecdn.com/npm/oidc-client-ts@${go}/dist/browser/oidc-client-ts.min.js`,Fi=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${go}/dist/browser/oidc-client-ts.min.js`,Li=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let ue;const ho=e=>{try{return Jt(e).exp}catch{return null}},zi=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:ho(n)},Bi=e=>{const{expires_in:t,expires_at:n,access_token:o}=e;return n||(t?Math.floor(Date.now()/1e3)+t:o?ho(o):void 0)},fo=e=>{const{access_token:t,id_token:n,refresh_token:o,refresh_expire_in:r}=e,i=q(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||o,sessionExpiration:e.sessionExpiration||Bi(e),cookieExpiration:e.cookieExpiration||zi(e)},i)},Ue=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce((o,r)=>{var i;return o[r]=[].concat(((i=e.hooks)===null||i===void 0?void 0:i[r])||[]).concat((t==null?void 0:t[r])||[]),o},(n=e.hooks)!==null&&n!==void 0?n:e.hooks={}),e},_e=async e=>{if(!(e!=null&&e.ok))return{};const t=await(e==null?void 0:e.clone().json()),n=(t==null?void 0:t.authInfo)||t||{};return fo(n)},Ft=()=>ee&&!!window.descopeBridge,At=(e,t)=>{if(!((t==null?void 0:t.status)>=400&&(t==null?void 0:t.status)<500))return!1;const n=(e==null?void 0:e.path)||"";return Li.includes(n)},qi=ue!==void 0||ee&&window.localStorage!==void 0,de=(e,t)=>{var n,o;return(o=(n=ue||ee&&window.localStorage)===null||n===void 0?void 0:n.setItem)===null||o===void 0?void 0:o.call(n,e,t)},le=e=>{var t,n;return(n=(t=ue||ee&&window.localStorage)===null||t===void 0?void 0:t.getItem)===null||n===void 0?void 0:n.call(t,e)},oe=e=>{var t,n;return(n=(t=ue||ee&&window.localStorage)===null||t===void 0?void 0:t.removeItem)===null||n===void 0?void 0:n.call(t,e)},Hi=e=>{var t,n,o,r,i;return(i=(n=(t=ue==null?void 0:ue.key)===null||t===void 0?void 0:t.call(ue,e))!==null&&n!==void 0?n:ee&&((r=(o=window.localStorage)===null||o===void 0?void 0:o.key)===null||r===void 0?void 0:r.call(o,e)))!==null&&i!==void 0?i:null},J=(...e)=>{console.debug(...e)},et=(...e)=>{console.warn(...e)},Ji=(e,t)=>{let n;var o;return t>0?(n=1e3*t,J(`Using provided nextRefreshSeconds: ${t}s`)):n=((o=e)?o.getTime()-new Date().getTime():0)-2e4,n>Ot&&(J(`Timeout is too large (${n}ms), setting it to ${Ot}ms`),n=Ot),n},ut="DS",Ve="DSR",Xt="DSI",it="DSRCN";function Bn(e,t,n){if(t){const{cookieDomain:o,cookiePath:r,cookieSameSite:i,cookieExpiration:a,cookieSecure:c}=n,l=new Date(1e3*a),d=Lt(o);Pe.set(e,t,{path:r,domain:d?o:void 0,expires:l,sameSite:i,secure:c})}}function Lt(e){const t=window.location.hostname.split("."),n=e==null?void 0:e.split(".");return t.slice(-(n==null?void 0:n.length)).join(".")===e}const Qt=e=>(e==null?void 0:e.cookieName)||ut,st=e=>(e==null?void 0:e.cookieName)||Ve;function Te(e="",t){return Pe.get(st(t))||le(`${e}${Ve}`)||""}function qn(e="",t){return Pe.get(Qt(t))||le(`${e}${ut}`)||""}function vo(e=""){return le(`${e}${Xt}`)||""}function mo(e="",t,n,o){oe(`${e}${Ve}`),oe(`${e}${ut}`),oe(`${e}${Xt}`),oe(`${e}${it}`);const r=Qt(t);Pe.remove(r,o==null?void 0:o.session);const i=st(n);Pe.remove(i,o==null?void 0:o.refresh)}const Mi=(e,t,n)=>o=>{const r=Object.assign(o,{token:o.token||Te(e,t)});if(!n){const a=function(c=""){return le(`${c}${it}`)}(e);a&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-refresh-cookie-name":a}))}const i=function(a=""){return le(`${a}DTD`)||""}(e);return i&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-trusted-device-token":i})),r},Wi=ee&&(localStorage==null?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Ki="vsid",Vi="vrid",Gt="fp",yo=(e=!1)=>{const t=le(Gt);if(!t)return null;const n=JSON.parse(t);return new Date().getTime()>n.expiry&&!e?null:n.value},xo=async(e,t=Wi)=>{try{if(yo())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",a=Di({apiKey:e,endpoint:[o.toString(),Oi],scriptUrlPattern:[i,Ti]}),c=await a,{requestId:l}=await c.get({linkedId:n}),d=((u,p)=>({[Ki]:u,[Vi]:p}))(n,l);(u=>{const p={value:u,expiry:new Date().getTime()+864e5};de(Gt,JSON.stringify(p))})(d)}catch(n){console.warn("Could not load fingerprint",n)}},$i=()=>{oe(Gt)},Yi=e=>{const t=yo(!0);return t&&e.body&&(e.body.fpData=t),e},De="descopeFlowNonce",Hn="X-Descope-Flow-Nonce",Jn="/v1/flow/start",zt="/v1/flow/next",Bt=(e,t=De)=>`${t}${e}`,Xi=(e,t=De)=>{try{const n=Bt(e,t);oe(n)}catch(n){console.error("Error removing flow nonce:",n)}},wo=e=>{var t;return((t=/.*\|#\|(.*)/.exec(e))===null||t===void 0?void 0:t[1])||null},Mn=e=>{var t;return e.path===zt&&(!((t=e.body)===null||t===void 0)&&t.executionId)?wo(e.body.executionId):null},Zt="dls_last_user_login_id",_t="dls_last_user_display_name",Wn=e=>de(Zt,e),qt=()=>le(Zt),Ht=()=>le(_t),Qi=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=qt(),i=Ht();return r&&((n=o.lastAuth)!==null&&n!==void 0||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},Gi=e=>t=>async(...n)=>{const o=await t(...n);return e||(oe(Zt),oe(_t)),o};function tt(){const e=[];return{pub:t=>{e.forEach(n=>n(t))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const Zi=(e,t,n,o)=>r=>async(...i)=>{const a=await r(...i);return mo(e,t,n,o==null?void 0:o()),a};async function nt(e){const t=function(r){var i;const a=JSON.parse(r);return a.publicKey.challenge=Ke(a.publicKey.challenge),a.publicKey.user.id=Ke(a.publicKey.user.id),(i=a.publicKey.excludeCredentials)===null||i===void 0||i.forEach(c=>{c.id=Ke(c.id)}),a}(e);return o=await navigator.credentials.create(t),JSON.stringify({id:o.id,rawId:xe(o.rawId),type:o.type,response:{attestationObject:xe(o.response.attestationObject),clientDataJSON:xe(o.response.clientDataJSON)}});var o}async function Ut(e){const t=ko(e);return Io(await navigator.credentials.get(t))}async function _i(e,t){const n=ko(e);return n.signal=t.signal,n.mediation="conditional",Io(await navigator.credentials.get(n))}async function bo(e=!1){var t,n;if(!ee)return Promise.resolve(!1);if(Ft()){const r=(n=(t=window.descopeBridge)===null||t===void 0?void 0:t.hostInfo)===null||n===void 0?void 0:n.webauthn;if(typeof r=="boolean")return r}const o=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return o&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():o}function ko(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Ke(n.publicKey.challenge),(t=n.publicKey.allowCredentials)===null||t===void 0||t.forEach(o=>{o.id=Ke(o.id)}),n}function Io(e){return JSON.stringify({id:e.id,rawId:xe(e.rawId),type:e.type,response:{authenticatorData:xe(e.response.authenticatorData),clientDataJSON:xe(e.response.clientDataJSON),signature:xe(e.response.signature),userHandle:e.response.userHandle?xe(e.response.userHandle):void 0}})}function Ke(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),n=>n.charCodeAt(0)).buffer}function xe(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Kn,es=(Kn=e=>({async signUp(t,n,o){const r=await e.webauthn.signUp.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await nt(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)},async signIn(t,n){const o=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!o.ok)return o;const r=await Ut(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,r)},async signUpOrIn(t,n){var o;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(!((o=r.data)===null||o===void 0)&&o.create){const i=await nt(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)}{const i=await Ut(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,i)}},async update(t,n,o){const r=await e.webauthn.update.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await nt(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,i)},helpers:{create:nt,get:Ut,isSupported:bo,conditional:_i}}),(...e)=>{const t=Kn(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const Vn={config:"/fedcm/config"},ts=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).substring(2)};async function $n(e,t){var n;try{await jo(e,t)}catch(o){(n=t==null?void 0:t.onFailed)===null||n===void 0||n.call(t,o)}}async function jo(e,t){var n,o;const r=await async function(i,a="google",c,l,d){const u=ts(),p=await async function(){return new Promise((h,y)=>{if(window.google)return void h(window.google.accounts.id);let x=document.getElementById("google-gsi-client-script");x||(x=document.createElement("script"),document.head.appendChild(x),x.async=!0,x.defer=!0,x.id="google-gsi-client-script",x.src="https://accounts.google.com/gsi/client"),x.onload=function(){window.google?h(window.google.accounts.id):y("Failed to load Google GSI client script - not loaded properly")},x.onerror=function(){y("Failed to load Google GSI client script - failed to load")}})}(),v=await i.oauth.getOneTapClientId(a);if(!v.ok)throw new Error("Failed to get OneTap client ID for provider "+a);const k=v.data.clientId;return new Promise(h=>{var y,x;const U=A=>{h({provider:a,nonce:u,credential:A==null?void 0:A.credential})};p.initialize(Object.assign(Object.assign({},c),{itp_support:(y=c==null?void 0:c.itp_support)===null||y===void 0||y,use_fedcm_for_prompt:(x=c==null?void 0:c.use_fedcm_for_prompt)===null||x===void 0||x,client_id:k,callback:U,nonce:u})),p.prompt(A=>{var R,T;if(d&&(A!=null&&A.isDismissedMoment())){const m=(R=A.getDismissedReason)===null||R===void 0?void 0:R.call(A);return d==null||d(m),void U()}if(l&&(A!=null&&A.isSkippedMoment())){const m=(T=A.getSkippedReason)===null||T===void 0?void 0:T.call(A);return l==null||l(m),void U()}})})}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(t!=null&&t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);(n=t==null?void 0:t.onCodeReceived)===null||n===void 0||n.call(t,i.data.code)}else{const i=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);(o=t==null?void 0:t.onAuthenticated)===null||o===void 0||o.call(t,i.data)}}var ns=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await bo(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const os=()=>window.location.search.includes("code")&&window.location.search.includes("state");let Et;const So=(e,t)=>new Promise((n,o)=>{if(!e.length)return o(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);const i=e.shift(),a=document.createElement("script");a.src=i,a.id=(c=>{let l=0;for(let d=0;d<c.length;d++)l=(l<<5)-l+c.charCodeAt(d),l|=0;return Math.abs(l).toString(16)})(i),a.onload=()=>{const c=t();if(c)return n(c);throw new Error("Could not get entry after loading script from URL")},a.addEventListener("error",()=>{So(e,t),a.setAttribute("data-error","true")}),document.body.appendChild(a)}),rs=async(e,t,n)=>{Et||(Et=(async()=>{try{return require("oidc-client-ts")}catch{return So([Ni,Fi],()=>window.oidc)}})());const{OidcClient:o,WebStorageStateStore:r}=await Et;if(!o)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const i=(n==null?void 0:n.redirectUri)||window.location.href;let a,c,l,d;if(n!=null&&n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");a=n.issuer,c=n.clientId,l=`${c}_user`,d="openid"}else n!=null&&n.applicationId?(a=e.httpClient.buildUrl(t),a=`${a}/${n.applicationId}`,c=t,l=`${c}_user`,d="openid email roles descope.custom_claims offline_access"):(a=e.httpClient.buildUrl(t),c=t,l=`${c}_user`,d="openid email roles descope.custom_claims offline_access");const u={authority:a,client_id:c,redirect_uri:i,response_type:"code",scope:(n==null?void 0:n.scope)||d,stateStore:new r({store:window.localStorage,prefix:c}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return n!=null&&n.redirectUri&&(u.redirect_uri=n.redirectUri),{client:new o(u),stateUserKey:l}},is=(e,t,n)=>{const o=async()=>{let i,a;return i&&a||({client:i,stateUserKey:a}=await rs(e,t,n)),{client:i,stateUserKey:a}},r=async(i="")=>{var a;const{client:c,stateUserKey:l}=await o(),d=await c.processSigninResponse(i||window.location.href);var u;return await((a=e.httpClient.hooks)===null||a===void 0?void 0:a.afterRequest({},new Response(JSON.stringify(d)))),de(l,JSON.stringify({id_token:(u=d).id_token,session_state:u.session_state,profile:u.profile})),(()=>{const p=new URL(window.location.href);p.searchParams.delete("code"),p.searchParams.delete("state"),window.history.replaceState({},document.title,p.toString())})(),d};return{loginWithRedirect:async(i={},a=!1)=>{const{client:c}=await o(),l=await c.createSigninRequest(i),{url:d}=l;return a||(window.location.href=d),{ok:!0,data:l}},finishLogin:r,finishLoginIfNeed:async(i="")=>{if(os())return await r(i)},refreshToken:async i=>{var a;const{client:c,stateUserKey:l}=await o(),d=(v=>{const k=le(v);return k?JSON.parse(k):null})(l);if(!d)throw new Error("User not found in storage to refresh token");let u=i;if(!u){const v={};e.httpClient.hooks.beforeRequest(v),u=v.token}const p=await c.useRefreshToken({state:{refresh_token:u,session_state:d.session_state,profile:d.profile}});return await((a=e.httpClient.hooks)===null||a===void 0?void 0:a.afterRequest({},new Response(JSON.stringify(p)))),p},logout:async(i,a=!1)=>{const{client:c,stateUserKey:l}=await o();i||(i={}),i.id_token_hint=i.id_token_hint||vo(),i.post_logout_redirect_uri=i.post_logout_redirect_uri||window.location.href;const d=await c.createSignoutRequest(i),{url:u}=d;return oe(l),a||window.location.replace(u),d}}},Co=function(...e){return t=>e.reduce((n,o)=>o(n),t)}(e=>t=>{var n;return n=t.customStorage,ue=n,e(t)},e=>t=>{var{fpKey:n,fpLoad:o}=t,r=q(t,["fpKey","fpLoad"]);return ee?(n&&o&&xo(n).catch(()=>null),e(Ue(r,{beforeRequest:Yi}))):e(r)},e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.47.0"},t.baseHeaders)})),e=>t=>{const n=tt(),o=tt(),r=tt(),i=tt(),a=e(Ue(t,{afterRequest:async(l,d)=>{if(At(l,d))J("Session invalidated, notifying subscribers with empty values"),o.pub(null),r.pub(null),n.pub(null),i.pub(null);else{const u=await(async h=>{const y=await _e(h);return(y==null?void 0:y.user)||(y!=null&&y.hasOwnProperty("userId")?y:void 0)})(d);u&&r.pub(u);const{sessionJwt:p,sessionExpiration:v,claims:k}=await _e(d);p&&o.pub(p),k&&i.pub(k),(v||p)&&n.pub(v||42)}}})),c=Be(a,["logout","logoutAll","oidc.logout"],l=>async(...d)=>{const u=await l(...d);return o.pub(null),r.pub(null),n.pub(null),i.pub(null),u});return Object.assign(c,{onSessionTokenChange:o.sub,onUserChange:r.sub,onClaimsChange:i.sub,onIsAuthenticatedChange:l=>n.sub(d=>{l(!!d)})})},e=>t=>{const{enableFlowNonce:n=!0,nonceStoragePrefix:o=De}=t,r=q(t,["enableFlowNonce","nonceStoragePrefix"]);return n?(((i=De)=>{try{if(!qi)return;for(let d=0;d<(a=void 0,c=void 0,l=void 0,(l=(a=ue==null?void 0:ue.length)!==null&&a!==void 0?a:ee&&((c=window.localStorage)===null||c===void 0?void 0:c.length))!==null&&l!==void 0?l:0);d++){const u=Hi(d);if(u&&u.startsWith(i)){const p=le(u);if(p)try{JSON.parse(p).expiry<Date.now()&&oe(u)}catch{oe(u)}}}}catch(d){console.error("Error cleaning up expired nonces:",d)}var a,c,l})(o),e(Ue(r,{afterRequest:async(i,a)=>{if(i.path!==Jn&&i.path!==zt)return;const{nonce:c,executionId:l}=await(async(d,u)=>{try{const p=u.headers.get(Hn);let v=await u.clone().json().then(k=>(k==null?void 0:k.executionId)||null).catch(()=>null);return v||(v=Mn(d)),{nonce:p,executionId:wo(v)}}catch{return{nonce:null,executionId:null}}})(i,a);c&&l&&((d,u,p,v=De)=>{try{const k=Bt(d,v),h=p?172800:10800,y={value:u,expiry:Date.now()+1e3*h,isStart:p};de(k,JSON.stringify(y))}catch(k){console.error("Error setting flow nonce:",k)}})(l,c,i.path===Jn,o)},beforeRequest:i=>{if(i.path===zt){const a=Mn(i);if(a){const c=((l,d=De)=>{try{const u=Bt(l,d),p=le(u);if(!p)return null;const v=JSON.parse(p);return v.expiry<Date.now()?(Xi(l,d),null):v.value}catch(u){return console.error("Error getting flow nonce:",u),null}})(a,o);c&&(i.headers=i.headers||{},i.headers[Hn]=c)}}return i}}))):e(r)},e=>t=>{var{autoRefresh:n}=t,o=q(t,["autoRefresh"]);const r=!!n,i=typeof n=="object"&&(n==null?void 0:n.customActivityTracking);if(!r||Ft())return Object.assign(e(o),{markUserActive:()=>{et("markUserActive() called but has no effect")}});const{clearAllTimers:a,setTimer:c}=(()=>{const h=[];return{clearAllTimers:()=>{for(;h.length;)clearTimeout(h.pop())},setTimer:(y,x)=>{h.push(setTimeout(y,x))}}})();let l,d,u=null,p=!1,v=!1;i&&(J("Activity-based refresh enabled"),u=(()=>{let h=!0;return{hadActivity:()=>h,reset:()=>{h=!1},markActive:()=>{h=!0}}})()),ee&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&l&&new Date>l&&(J("Expiration time passed, refreshing session"),k.refresh(Te()||d))});const k=e(Ue(o,{afterRequest:async(h,y)=>{const{sessionJwt:x,refreshJwt:U,sessionExpiration:A,nextRefreshSeconds:R}=await _e(y);if(At(h,y))J("Session invalidated, canceling all timers"),a();else if(x||A){if(l=((C,z)=>{if(z)return new Date(1e3*z);J("Could not extract expiration time from session token, trying to decode the token");try{const K=Jt(C);if(K.exp)return new Date(1e3*K.exp)}catch{return null}})(x,A),!l)return void J("Could not extract expiration time from session token");d=U,p=R>0;const T=Ji(l,R);if(a(),T<=2e4)return void J("Session is too close to expiration, not setting refresh timer");const m=new Date(Date.now()+T).toLocaleTimeString("en-US",{hour12:!1});J(`Setting refresh timer for ${m}. (${T}ms)`),u&&(u.reset(),v=!1),c(()=>{if(ee&&document.visibilityState==="hidden")J("Skipping refresh due to timer - document is hidden");else{if(u&&p&&!u.hadActivity())return J("Skipping refresh due to timer - user is idle"),void(v=!0);J("Refreshing session due to timer"),k.refresh(Te()||U)}},T)}}}));return Object.assign(Be(k,["logout","logoutAll","oidc.logout"],h=>async(...y)=>{const x=await h(...y);return J("Clearing all timers"),a(),x}),{markUserActive:u?()=>{J("markUserActive() called"),p||J("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),v&&(J("User became active after skipped refresh, triggering refresh"),v=!1,a(),k.refresh(Te()||d))}:()=>{et("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})},e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=q(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:qt,getLastUserDisplayName:Ht});const i=e(Ue(r,{afterRequest:async(c,l)=>{var d;const{userInfo:u,lastAuth:p}=await(async h=>{if(!(h!=null&&h.ok))return{userInfo:void 0,lastAuth:void 0};const y=await(h==null?void 0:h.clone().json()),x=fo((y==null?void 0:y.authInfo)||y||{});return{userInfo:(x==null?void 0:x.user)||(x!=null&&x.hasOwnProperty("userId")?x:void 0),lastAuth:y.lastAuth}})(l),v=(d=u==null?void 0:u.loginIds)===null||d===void 0?void 0:d[0],k=u==null?void 0:u.name;v?(Wn(v),(h=>{de(_t,h)})(k)):p!=null&&p.loginId&&Wn(p.loginId)}}));let a=Be(i,["flow.start"],Qi);return a=Be(a,["logout","logoutAll"],Gi(o)),Object.assign(a,{getLastUserLoginId:qt,getLastUserDisplayName:Ht})},e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,refreshTokenViaCookie:r,storagePrefix:i,refreshCookieName:a}=t,c=q(t,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!n||!ee)return e(Object.assign({refreshCookieName:a},c));let l;const d=e(Ue(Object.assign({refreshCookieName:a},c),{beforeRequest:Mi(i,r,a),afterRequest:async(p,v)=>{if(At(p,v))J("Session invalidated, clearing persisted tokens"),mo(i,o,r,l);else{const k=await _e(v);k.cookieName?de(`${i||""}${it}`,k.cookieName):k.refreshJwt&&oe(`${i||""}${it}`);const h=((y={},x=!1,U="",A=!1)=>{var R,T,m,C;const{sessionJwt:z,refreshJwt:K,trustedDeviceJwt:G}=y;let Z;if(K)if(A){oe(`${U}${Ve}`);const B=A.sameSite||"Strict",V=(R=A.secure)===null||R===void 0||R,Y=(T=A.domain)!==null&&T!==void 0?T:y.cookieDomain,ce=st(A);V&&window.location.protocol!=="https:"&&et("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const L=Object.assign(Object.assign({},y),{cookieSameSite:B,cookieSecure:V,cookieDomain:Y});Bn(ce,K,L);const te=Lt(Y);Z=Object.assign(Object.assign({},Z),{refresh:{path:L.cookiePath,domain:te?Y:void 0}})}else{const B=st(A);Pe.remove(B),de(`${U}${Ve}`,K)}if(z)if(x){const B=x.sameSite||"Strict",V=(m=x.secure)===null||m===void 0||m,Y=(C=x.domain)!==null&&C!==void 0?C:y.cookieDomain,ce=Qt(x);V&&window.location.protocol!=="https:"&&et("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const L=Object.assign(Object.assign({},y),{cookieSameSite:B,cookieSecure:V,cookieDomain:Y});Bn(ce,z,L);const te=Lt(Y);Z=Object.assign(Object.assign({},Z),{session:{path:L.cookiePath,domain:te?Y:void 0}})}else de(`${U}${ut}`,z);return y.idToken&&de(`${U}${Xt}`,y.idToken),G&&de(`${U}DTD`,G),Z})(k,o,i,r);h&&(l=h)}}})),u=Be(d,["logout","logoutAll","oidc.logout"],Zi(i,o,r,()=>l));return Object.assign(u,{getRefreshToken:()=>Te(i,r),getSessionToken:()=>qn(i,o),getIdToken:()=>vo(i)})})(e=>{const t=Ii(e),n=is(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,a)=>{var c;if(Ft())return J(`Refresh called in native flow: ${new Error().stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(p){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:p.toString()}})}const l=qn(),d=Te();let u="";if(e.getExternalToken)try{u=await((c=e.getExternalToken)===null||c===void 0?void 0:c.call(e))}catch(p){J("Error getting external token while refreshing",p)}return t.refresh(i,{dcs:l?"t":"f",dcr:d?"t":"f"},u,a)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(a){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:a.toString()}})}return t.logout(i)},flow:ns(t),webauthn:es(t),fedcm:(o=t,r=e.projectId,{onetap:{requestExchangeCode(i){$n(o,i)},requestAuthentication(i){$n(o,i)}},async oneTap(i,a,c,l,d){await jo(o,{provider:i,oneTapConfig:a,loginOptions:c,onSkipped:l,onDismissed:d})},async launch(i){var a;const c={identity:{context:i||"signin",providers:[{configURL:o.httpClient.buildUrl(r+Vn.config),clientId:r}]}},l=await((a=navigator.credentials)===null||a===void 0?void 0:a.get(c));return o.refresh(l.token)},isSupported:()=>ee&&"IdentityCredential"in window,async isLoggedIn(i){var a;const c=o.httpClient.buildUrl(r+Vn.config);try{const l={identity:{context:i||"signin",providers:[{configURL:c,clientId:r}]}},d=await((a=navigator.credentials)===null||a===void 0?void 0:a.get(l));return!!d&&!!d.token}catch{return!1}}}),oidc:n});var o,r});let en;const Oo=e=>{const t=Co(Object.assign({persistTokens:On,autoRefresh:On},e));return en=t,t},ss=()=>Oo({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});en=ss();const as=()=>en;var ls=({projectId:e,baseUrl:t,persistTokens:n,autoRefresh:o,sessionTokenViaCookie:r,refreshTokenViaCookie:i,refreshCookieName:a,oidcConfig:c,storeLastAuthenticatedUser:l,keepLastAuthenticatedUserAfterLogout:d,getExternalToken:u,hooks:p,customStorage:v})=>g.useMemo(()=>{if(e)return Oo({projectId:e,baseUrl:t,sessionTokenViaCookie:r,refreshTokenViaCookie:i,baseHeaders:ot,persistTokens:n,autoRefresh:o,refreshCookieName:a,oidcConfig:c,storeLastAuthenticatedUser:l,keepLastAuthenticatedUserAfterLogout:d,hooks:p,getExternalToken:u,customStorage:v})},[e,t,JSON.stringify(r),JSON.stringify(i),u,v]);const cs=({projectId:e,baseUrl:t="",baseStaticUrl:n="",baseCdnUrl:o="",sessionTokenViaCookie:r=!1,refreshTokenViaCookie:i=!1,hooks:a,persistTokens:c=!0,autoRefresh:l=!0,oidcConfig:d,storeLastAuthenticatedUser:u=!0,keepLastAuthenticatedUserAfterLogout:p=!1,refreshCookieName:v="",getExternalToken:k,customStorage:h,children:y})=>{const[x,U]=g.useState(),[A,R]=g.useState(),[T,m]=g.useState(),[C,z]=g.useState(!1),[K,G]=g.useState(!1),[Z,B]=g.useState(!1),[V,Y]=g.useState(!!d),ce=g.useRef(!1),L=ls({projectId:e,baseUrl:t,persistTokens:c,autoRefresh:l,sessionTokenViaCookie:r,refreshTokenViaCookie:i,hooks:a,oidcConfig:d,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:v,getExternalToken:k,customStorage:h});g.useEffect(()=>{if(L){const Oe=L.onSessionTokenChange(R),re=L.onUserChange(U),D=L.onIsAuthenticatedChange(z),Ne=L.onClaimsChange(m);return()=>{Oe(),re(),D(),Ne()}}},[L]);const te=g.useRef(!1),pe=g.useRef(!1);g.useEffect(()=>{L&&d&&!ce.current&&(ce.current=!0,L.oidc.finishLoginIfNeed().finally(()=>{Y(!1),te.current=!0}))},[]);const W=g.useCallback(()=>{er()||te.current||(te.current=!0,B(!0),Cn(L==null?void 0:L.refresh)(void 0,!0).then(()=>{B(!1)}))},[L]),M=g.useCallback(()=>{pe.current||(pe.current=!0,G(!0),Cn(L.me)().then(()=>{G(!1)}))},[L]),ne=g.useMemo(()=>({fetchUser:M,user:x,isUserLoading:K,isUserFetched:pe.current,fetchSession:W,session:A,isAuthenticated:C,isSessionLoading:Z,isOidcLoading:V,isSessionFetched:te.current,projectId:e,baseUrl:t,baseStaticUrl:n,baseCdnUrl:o,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:v,customStorage:h,setUser:U,setSession:R,setIsAuthenticated:z,claims:T,sdk:L}),[M,x,K,pe.current,W,A,C,Z,V,te.current,e,t,n,o,p,v,h,U,R,z,T,L]);return g.createElement(Qn.Provider,{value:ne},y)};function ds(...e){return t=>e.reduce((n,o)=>o(n),t)}const us=(...e)=>e.join("/").replace(/\/+/g,"/"),Yn=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),ps=e=>{const t=Symbol((n=>{const o=n.toString();let r=0;for(let i=0;i<o.length;i++)r=(r<<5)-r+o.charCodeAt(i),r&=r;return r.toString(16)})(e));return n=>{if(n[t])return n;const o=e(n);return o[t]=!0,o}},gs=e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}},hs=e=>typeof e=="string"||e==null?e:JSON.stringify(e),fs=e=>g.forwardRef((t,n)=>{const{prop:o,attr:r,rest:i}=g.useMemo(()=>Object.entries(t).reduce((l,[d,u])=>{const{trimmedKey:p,category:v}=gs(d);return v==="prop"?l.prop.push([p,u]):v==="attr"?l.attr.push([Yn(p),hs(u)]):Object.assign(l.rest,{[Yn(p)]:u}),l},{attr:[],prop:[],rest:{}}),[t]),a=g.useRef(null),c=g.useCallback(l=>{a.current=l,l&&(o.forEach(([d,u])=>{a.current[d]=u}),r.forEach(([d,u])=>{u==null?l.removeAttribute(d):l.setAttribute(d,u)}))},[o,r,a]);return g.useImperativeHandle(n,()=>a.current),g.createElement(e,Object.assign({ref:c},i))}),vs=g.lazy(async()=>(((customElements==null?void 0:customElements.get("descope-wc"))||await Promise.resolve().then(()=>require("./index.cjs3.js")).then(e=>e.index).then(e=>e.default)).sdkConfigOverrides={baseHeaders:ot,persistTokens:!1,hooks:{get beforeRequest(){return as().httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:fs(g.forwardRef((e,t)=>{var{"external-request-id":n}=e,o=q(e,["external-request-id"]);return g.useMemo(()=>{var r,i;r="x-external-rid",(i=n)?ot[r]=i:delete ot[r]},[n]),g.createElement("descope-wc",Object.assign({ref:t},o))}))})),ms=g.forwardRef(({flowId:e,onSuccess:t,onError:n,onReady:o,logger:r,tenant:i,theme:a,nonce:c,locale:l,debug:d,client:u,form:p,telemetryKey:v,redirectUrl:k,autoFocus:h,validateOnBlur:y,restartOnError:x,errorTransformer:U,styleId:A,onScreenUpdate:R,dismissScreenErrorOnInput:T,outboundAppId:m,outboundAppScopes:C,popupOrigin:z,children:K,externalRequestId:G},Z)=>{const[B,V]=g.useState(null);g.useImperativeHandle(Z,()=>B);const{projectId:Y,baseUrl:ce,baseStaticUrl:L,baseCdnUrl:te,storeLastAuthenticatedUser:pe,keepLastAuthenticatedUserAfterLogout:W,refreshCookieName:M,customStorage:ne,sdk:Oe}=g.useContext(Qn),re=g.useCallback(async D=>{await Oe.httpClient.hooks.afterRequest({},new Response(JSON.stringify(D.detail))),t&&t(D)},[t]);return g.useEffect(()=>{const D=B;return D==null||D.addEventListener("success",re),n&&(D==null||D.addEventListener("error",n)),o&&(D==null||D.addEventListener("ready",o)),()=>{n&&(D==null||D.removeEventListener("error",n)),o&&(D==null||D.removeEventListener("ready",o)),D==null||D.removeEventListener("success",re)}},[B,n,re]),g.useEffect(()=>{const D=B;return D==null||D.addEventListener("success",re),()=>{D==null||D.removeEventListener("success",re)}},[B,re]),g.useEffect(()=>{const D=B;return n&&(D==null||D.addEventListener("error",n)),()=>{n&&(D==null||D.removeEventListener("error",n))}},[B,n]),g.useEffect(()=>{const D=B;return o&&(D==null||D.addEventListener("ready",o)),()=>{o&&(D==null||D.removeEventListener("error",o))}},[B,o]),g.createElement("form",null,g.createElement(g.Suspense,{fallback:null},g.createElement(vs,{projectId:Y,flowId:e,baseUrl:ce,baseStaticUrl:L,baseCdnUrl:te,ref:V,telemetryKey:v,redirectUrl:k,autoFocus:h,styleId:A,validateOnBlur:y,restartOnError:x,keepLastAuthenticatedUserAfterLogout:W,tenant:i,externalRequestId:G,customStorage:ne,"theme.attr":a,"nonce.attr":c,"locale.attr":l,"form.attr":p,"client.attr":u,"debug.attr":d,"outbound-app-id.attr":m,"outbound-app-scopes.attr":C,"popup-origin.attr":z,"store-last-authenticated-user.attr":pe,"refreshCookieName.attr":M,"dismiss-screen-error-on-input.attr":T,"errorTransformer.prop":U,"logger.prop":r,"onScreenUpdate.prop":R,"customStorage.prop":ne},K)))}),ys="data:image/png;base64,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",We="var(--color-green)",S="var(--font-sans)",$={width:"100%",height:40,padding:"10px 14px",fontSize:16,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:"var(--color-text)",fontFamily:S,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},X=e=>{e.target.style.borderColor="var(--color-green)",e.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},Q=e=>{e.target.style.borderColor="var(--color-input-border)",e.target.style.boxShadow="none"},xs=[{value:"",label:"Select team size (optional)"},{value:"1-10",label:"1–10"},{value:"11-50",label:"11–50"},{value:"51-200",label:"51–200"},{value:"200+",label:"200+"}],ws=["Nextiva","Five9","Dialpad","RingCentral","NICE","Genesys","Talkdesk","Aircall","8x8","Vonage","Twilio","Other"],bs=["Teams","Zoom","Google Meet","Webex","Other"];function Ee({title:e,subtitle:t}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:600,fontSize:"36px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:e}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:t})]})}function me({onClick:e,disabled:t,children:n,type:o="button"}){const r=!t;return s.jsx("button",{type:o,onClick:e,disabled:t,style:{width:"100%",height:40,display:"flex",justifyContent:"center",alignItems:"center",padding:"10px",background:r?"var(--color-green)":"var(--color-green-disabled)",color:"white",border:"none",borderRadius:4,fontSize:16,fontWeight:600,lineHeight:"23px",fontFamily:S,cursor:r?"pointer":"not-allowed",transition:"background 0.15s",boxSizing:"border-box"},onMouseEnter:i=>{r&&(i.currentTarget.style.background="var(--color-green-hover)")},onMouseLeave:i=>{r&&(i.currentTarget.style.background=r?"var(--color-green)":"var(--color-green-disabled)")},children:n})}function H({label:e,gap:t=12,labelSize:n=16,labelStyle:o,children:r}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:t,width:"100%"},children:[s.jsx("label",{style:{fontSize:n,fontWeight:400,color:"var(--color-text)",fontFamily:S,lineHeight:"100%",...o},children:e}),r]})}function Tt({show:e,onToggle:t}){return s.jsx("button",{type:"button",tabIndex:-1,onClick:t,style:{position:"absolute",right:14,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--color-text-secondary)",display:"flex",alignItems:"center"},children:e?s.jsx(Ce.EyeOff,{size:16}):s.jsx(Ce.Eye,{size:16})})}function Je(){return s.jsx("hr",{style:{width:"100%",border:"none",borderTop:"1px solid var(--color-divider)",margin:0}})}function je({text:e,linkText:t,onClick:n}){return s.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:4,width:"100%"},children:[s.jsx("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:e}),s.jsx("button",{type:"button",onClick:n,style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"22px",color:We,cursor:"pointer",fontFamily:S,textDecoration:"underline"},children:t})]})}function ye({onTerms:e,onPrivacyPolicy:t,paddingTop:n}){return s.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",marginTop:"auto",paddingTop:n||40,flexShrink:0},children:s.jsxs("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S,textAlign:"center",whiteSpace:"nowrap"},children:["By continuing, you agree to our"," ",s.jsx("a",{href:"https://chordia.ai/legal/terms-of-use",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:S,textDecoration:"underline",textUnderlineOffset:2},children:"Terms"})," ","and"," ",s.jsx("a",{href:"https://chordia.ai/legal/privacy-notice",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:S,textDecoration:"underline",textUnderlineOffset:2},children:"Privacy Policy"}),"."]})})}function ks({projectId:e,onSuccess:t,onError:n}){return e?s.jsx(cs,{projectId:e,children:s.jsx(ms,{flowId:"sign-up-or-in-otp-or-social",onSuccess:t,onError:n})}):null}function Xn({options:e,value:t,onChange:n,otherValue:o,onOtherChange:r,placeholder:i,otherPlaceholder:a="Please specify",compact:c=!1}){const[l,d]=g.useState(!1),u=g.useRef(null);g.useEffect(()=>{const m=C=>{u.current&&!u.current.contains(C.target)&&d(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const p=m=>{t.includes(m)?(n(t.filter(C=>C!==m)),m==="Other"&&r("")):n([...t,m])},v=m=>{n(t.filter(C=>C!==m)),m==="Other"&&r("")},k="rgba(34, 197, 94, 0.14)",h=c?"6px 10px":"8px 12px",y=c?36:40,x=c?15:16,U=c?200:260,A=c?"6px 8px":"8px 10px",R=t.includes("Other"),T=()=>d(m=>!m);return s.jsx("div",{ref:u,style:{width:"100%"},children:s.jsxs("div",{style:{position:"relative",width:"100%"},children:[s.jsxs("div",{role:"combobox","aria-expanded":l,onClick:m=>{m.target instanceof HTMLInputElement||m.target instanceof HTMLElement&&m.target.closest("button")||T()},style:{width:"100%",minHeight:y,padding:h,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,textAlign:"left",fontSize:x,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:t.length?"var(--color-text)":"var(--color-text-secondary)",fontFamily:S,boxSizing:"border-box",cursor:"pointer"},children:[s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:6,minWidth:0,cursor:"text"},children:t.length===0?s.jsx("span",{style:{color:"var(--color-text-secondary)",cursor:"pointer"},onClick:m=>{m.stopPropagation(),T()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&T()},role:"button",tabIndex:0,children:i}):s.jsxs(s.Fragment,{children:[t.map(m=>s.jsxs("span",{onClick:C=>C.stopPropagation(),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:4,background:k,fontSize:13,fontWeight:500,color:"var(--color-text)",flexShrink:0},children:[m,s.jsx("span",{role:"button",tabIndex:0,onClick:C=>{C.stopPropagation(),v(m)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),C.stopPropagation(),v(m))},style:{cursor:"pointer",fontSize:14,lineHeight:1,opacity:.7},children:"×"})]},m)),R&&s.jsx("input",{type:"text",value:o,onChange:m=>r(m.target.value),placeholder:a,onMouseDown:m=>m.stopPropagation(),onClick:m=>m.stopPropagation(),onFocus:m=>{m.stopPropagation(),m.target.style.borderColor="var(--color-green)",m.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},onBlur:m=>{m.target.style.borderColor="#cfcece",m.target.style.boxShadow="none"},style:{flex:"1 1 120px",minWidth:80,maxWidth:"100%",minHeight:c?26:28,padding:"2px 8px",border:"1px solid #cfcece",borderRadius:4,outline:"none",background:"transparent",fontSize:x,fontFamily:S,color:"var(--color-text)",boxSizing:"border-box"}})]})}),s.jsx("button",{type:"button",tabIndex:-1,onClick:m=>{m.stopPropagation(),T()},style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,border:"none",background:"none",cursor:"pointer",color:"var(--color-text-secondary)"},"aria-label":l?"Close options":"Open options",children:s.jsx(Ce.ChevronDown,{size:c?16:18,style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})})]}),l&&s.jsx("div",{style:{position:"absolute",left:0,right:0,top:"100%",marginTop:4,padding:c?6:8,maxHeight:U,overflowY:"auto",background:"white",border:"1px solid var(--color-input-border)",borderRadius:4,boxShadow:"0 8px 24px rgba(0,0,0,0.08)",zIndex:50,boxSizing:"border-box"},children:e.map(m=>s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:A,borderRadius:4,cursor:"pointer",fontSize:c?14:15,fontFamily:S,color:"var(--color-text)"},children:[s.jsx("input",{type:"checkbox",checked:t.includes(m),onChange:()=>p(m),style:{width:16,height:16,accentColor:"var(--color-green)"}}),m]},m))})]})})}function Is({onLogin:e,onForgotPassword:t,onOneTimeCode:n,onVerifyCode:o,onResendCode:r,onSignUp:i,onJoinWaitlist:a,onWaitlistSubmit:c,onResetPassword:l,onTerms:d,onPrivacyPolicy:u,onDescopeSuccess:p,onDescopeError:v,descopeProjectId:k,onGoToLogin:h,loading:y,error:x,codeError:U,defaultView:A="signin",signupMode:R="signup"}){var jn,Sn;const[T,m]=g.useState(""),[C,z]=g.useState(""),[K,G]=g.useState(!1),[Z,B]=g.useState(!1),[V,Y]=g.useState(!1),[ce,L]=g.useState(!1),[te,pe]=g.useState(null),[W,M]=g.useState(A),[ne,Oe]=g.useState(""),[re,D]=g.useState(""),[Ne,tn]=g.useState(""),[ge,$e]=g.useState(["","","","","",""]),Fe=g.useRef([]),[pt,Ao]=g.useState(""),[gt,Uo]=g.useState(""),[Le,Eo]=g.useState(""),[Ye,To]=g.useState(""),[ht,Do]=g.useState(""),[ft,Po]=g.useState(!1),[vt,Ro]=g.useState(!1),[nn,Ae]=g.useState(""),[mt,No]=g.useState(""),[on,rn]=g.useState(0),sn=3,[an,Fo]=g.useState(""),[ln,Lo]=g.useState(""),[cn,zo]=g.useState(""),[dn,Bo]=g.useState(""),[yt,qo]=g.useState(""),[un,Ho]=g.useState([]),[pn,Jo]=g.useState([]),[xt,Mo]=g.useState(""),[wt,Wo]=g.useState(""),[gn,fe]=g.useState(""),[hn,fn]=g.useState(!1),[Ko,Vo]=g.useState(!1),[$o,Yo]=g.useState(1267),[ze,Xo]=g.useState("");g.useEffect(()=>{const f=setInterval(()=>rn(j=>(j+1)%sn),4e3);return()=>clearInterval(f)},[]);const ke=g.useRef(null),Ie=g.useRef(null);g.useEffect(()=>{const f=ie=>{if(!ie)return!1;try{return ie.matches(":-webkit-autofill, :autofill")}catch{return!1}},j=()=>{const ie=ke.current,Qe=Ie.current;ie&&ie.value&&m(ie.value),Qe&&Qe.value&&z(Qe.value),G(f(ie)),B(f(Qe))},O=[100,300,600,1e3,2e3].map(ie=>setTimeout(j,ie)),F=ie=>{(ie.animationName==="onAutoFillStart"||ie.target.matches(":-webkit-autofill"))&&setTimeout(j,50)},P=ke.current,I=Ie.current;P==null||P.addEventListener("animationstart",F),I==null||I.addEventListener("animationstart",F);const _=()=>setTimeout(j,0),ae=()=>setTimeout(j,0);return P==null||P.addEventListener("input",_),I==null||I.addEventListener("input",_),P==null||P.addEventListener("change",ae),I==null||I.addEventListener("change",ae),()=>{O.forEach(clearTimeout),P==null||P.removeEventListener("animationstart",F),I==null||I.removeEventListener("animationstart",F),P==null||P.removeEventListener("input",_),I==null||I.removeEventListener("input",_),P==null||P.removeEventListener("change",ae),I==null||I.removeEventListener("change",ae)}},[]),g.useEffect(()=>{const f=F=>{if(!F)return!1;try{return F.matches(":-webkit-autofill, :autofill")}catch{return!1}},j=()=>{var I,_;const F=((I=ke.current)==null?void 0:I.value)||"",P=((_=Ie.current)==null?void 0:_.value)||"";F&&F!==T&&m(F),P&&P!==C&&z(P),G(f(ke.current)),B(f(Ie.current))},O=setInterval(j,250);return window.addEventListener("focus",j),document.addEventListener("visibilitychange",j),()=>{clearInterval(O),window.removeEventListener("focus",j),document.removeEventListener("visibilitychange",j)}},[T,C]),g.useEffect(()=>{U&&W==="verifycode"&&($e(["","","","","",""]),M("getcodewithname"))},[U]);const vn=y??ce,ve=x??te,Qo=(T||((jn=ke.current)==null?void 0:jn.value)||"").trim(),Go=C||((Sn=Ie.current)==null?void 0:Sn.value)||"",mn=!!(!!(Qo||K)&&!!(Go||Z)&&!vn),Xe=W==="verifycode"||W==="getcodewithname"?ve:null,yn=f=>{f.target.style.borderColor=ve?"var(--color-text)":"var(--color-green)",f.target.style.boxShadow=ve?"none":"0 0 0 3px var(--color-green-ring)"},xn=f=>{f.target.style.borderColor=ve?"var(--color-text)":"var(--color-input-border)",f.target.style.boxShadow="none"},wn=(f,j)=>{var _;const O=(j||"").replace(/\D/g,"");if(!O)return;const F=[...ge];let P=f;for(let ae=0;ae<O.length&&f+ae<F.length;ae+=1)F[f+ae]=O[ae],P=f+ae;$e(F);const I=Math.min(P+1,F.length-1);(_=Fe.current[I])==null||_.focus()},bn=(f,j)=>{var I;const O=j.replace(/\D/g,"");if(O.length>1){wn(f,O);return}const F=O.slice(-1),P=[...ge];P[f]=F,$e(P),F&&f<5&&((I=Fe.current[f+1])==null||I.focus())},kn=(f,j)=>{var O;j.key==="Backspace"&&!ge[f]&&f>0&&((O=Fe.current[f-1])==null||O.focus())},In=(f,j)=>{var F;j.preventDefault();const O=((F=j.clipboardData)==null?void 0:F.getData("text"))||"";wn(f,O)},Zo=async f=>{var F,P;if(f.preventDefault(),!mn)return;const j=T||((F=ke.current)==null?void 0:F.value)||"",O=C||((P=Ie.current)==null?void 0:P.value)||"";if(!(!j||!O)){pe(null),L(!0);try{await(e==null?void 0:e(j,O))}catch(I){pe((I==null?void 0:I.message)||"Something went wrong. Please try again.")}finally{L(!1)}}},_o=async()=>{fe("");const f=an.trim(),j=ln.trim(),O=cn.trim();if(f.length<2){fe("Please enter your full name.");return}if(!j){fe("Please enter your work email.");return}if(O.length<2){fe("Please enter your company name (at least 2 characters).");return}const F=un.map(I=>I==="Other"&&xt.trim()?`Other: ${xt.trim()}`:I),P=pn.map(I=>I==="Other"&&wt.trim()?`Other: ${wt.trim()}`:I);fn(!0);try{const I=await(c==null?void 0:c({name:f,email:j,company_name:O,job_title:dn.trim()||void 0,team_size:yt||void 0,phone_systems:F,meeting_tools:P,source:"website"})),_=Number(I==null?void 0:I.position);Number.isFinite(_)&&_>0&&Yo(_),I!=null&&I.calendly_url&&Xo(String(I.calendly_url)),Vo(!0)}catch(I){fe((I==null?void 0:I.message)||"Unable to join waitlist right now. Please try again.")}finally{fn(!1)}};return s.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",overflow:"hidden",fontFamily:S,background:"white"},children:[s.jsxs("div",{style:{flex:"0 0 628px",width:628,minHeight:0,background:"var(--surface-dark)",display:"flex",flexDirection:"column",padding:"48px 0 40px 48px",position:"relative",overflow:"hidden"},children:[s.jsx("img",{src:ys,alt:"Chordia",style:{width:175,height:48,objectFit:"contain",marginBottom:100,flexShrink:0}}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:22},children:[s.jsx("h1",{style:{fontFamily:S,fontSize:"clamp(28px, 2.8vw, 28px)",fontWeight:800,color:"var(--color-text-inverse)",lineHeight:1.08,margin:0,letterSpacing:"-0.02em",paddingRight:48},children:"Three Solutions. One Platform."}),s.jsxs("div",{style:{position:"relative",width:412,height:320,overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)"},children:[s.jsx("div",{style:{display:"flex",gap:16,height:"100%",transform:`translateX(${-on*280}px)`,transition:"transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:[{Icon:Ce.CircleCheckBig,title:"Evaluation Quality Monitoring",info:"Stop sampling 2% of calls and hoping for the best. Chordia analyzes every conversation for quality, compliance, and coaching signals — with evidence, not opinions."},{Icon:Ce.ShieldCheck,title:"Compliance Monitoring",info:"Continuously monitor customer service conversations for missed disclosures, risky language, and compliance gaps."},{Icon:Ce.Radar,title:"Signal Intelligence",info:"Identify emerging themes, sentiment shifts, and customer issues hidden inside everyday service conversations."}].map(({Icon:f,title:j,info:O},F)=>s.jsxs("div",{style:{flexShrink:0,width:264,height:320,padding:32,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,borderRadius:16,border:"1px solid var(--surface-card-dark-border)",background:"var(--surface-card-dark)"},children:[s.jsx(f,{width:36,height:36,color:"var(--color-card-icon)",strokeWidth:2.5}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[s.jsx("span",{style:{fontFamily:S,fontSize:24,fontStyle:"normal",fontWeight:600,lineHeight:"28px",color:"var(--color-card-text)"},children:j}),s.jsx("span",{style:{fontFamily:S,fontSize:12,fontStyle:"normal",fontWeight:400,lineHeight:"normal",color:"rgba(255,255,255,0.65)"},children:O})]})]},F))}),s.jsx("div",{style:{position:"absolute",top:0,left:280,right:0,height:"100%",background:"linear-gradient(270deg, #1D1E20 0%, rgba(29,30,32,0.80) 100%)",pointerEvents:"none"}})]}),s.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,height:4,marginTop:"auto",flexShrink:0},children:Array.from({length:sn}).map((f,j)=>s.jsx("button",{onClick:()=>rn(j),style:{width:80,height:4,borderRadius:6,border:"none",padding:0,cursor:"pointer",background:j===on?"rgba(255,255,255,0.7)":"rgba(255,255,255,0.25)",transition:"background 0.3s ease"}},j))})]})]}),s.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:W==="waitlist"?"20px 48px":"32px 72px",position:"relative",background:"white",overflowY:"auto",minHeight:0},children:s.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",maxWidth:W==="waitlist"?430:360,gap:W==="waitlist"?22:28},children:W==="waitlist"?s.jsx(s.Fragment,{children:Ko?s.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",gap:24},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:700,fontSize:"32px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:"Chordia"}),s.jsx("h3",{style:{fontFamily:S,fontWeight:700,fontSize:"32px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"You're on the list!"}),s.jsxs("p",{style:{fontFamily:S,fontWeight:700,fontSize:"56px",lineHeight:"68px",color:"var(--color-green)",margin:0},children:["#",$o.toLocaleString()]}),s.jsx("p",{style:{fontFamily:S,fontWeight:400,fontSize:18,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0,maxWidth:470},children:"We’re working hard to increase capacity and will notify you very quickly. Check your email for confirmation."}),s.jsxs("div",{style:{width:"100%",borderRadius:12,border:"1px solid var(--color-input-border)",background:"white",boxShadow:"0 1px 6px rgba(0,0,0,0.06)",padding:"24px 20px",boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",gap:14},children:[s.jsx("p",{style:{margin:0,fontFamily:S,fontSize:"24px",lineHeight:"40px",fontWeight:700,color:"var(--color-text)"},children:"Want to skip the line?"}),s.jsx("p",{style:{margin:0,fontFamily:S,fontSize:"18px",lineHeight:"24px",fontWeight:400,color:"var(--color-text-secondary)"},children:"Schedule a demo with our CEO and get immediate access."}),s.jsx("button",{type:"button",onClick:()=>{ze&&window.open(ze,"_blank","noopener,noreferrer")},style:{minWidth:220,height:48,padding:"0 20px",borderRadius:8,border:"2px solid #111111",background:"white",color:"var(--color-text)",fontFamily:S,fontSize:20,fontWeight:700,lineHeight:"28px",cursor:ze?"pointer":"default",opacity:ze?1:.65},disabled:!ze,children:"Schedule a Demo"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Join the Waitlist",subtitle:"Get early access to Chordia. We onboard new companies every week."}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:12},children:[s.jsx(H,{label:"Full Name",gap:8,children:s.jsx("input",{type:"text",value:an,onChange:f=>{Fo(f.target.value),fe("")},placeholder:"Your full name",autoFocus:!0,autoComplete:"name",style:$,onFocus:X,onBlur:Q})}),s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Work Email",gap:8,children:s.jsx("input",{type:"email",value:ln,onChange:f=>{Lo(f.target.value),fe("")},placeholder:"workemail@example.com",autoComplete:"email",style:$,onFocus:X,onBlur:Q})})}),s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Company Name",gap:8,children:s.jsx("input",{type:"text",value:cn,onChange:f=>{zo(f.target.value),fe("")},placeholder:"Your Company",autoComplete:"organization",style:$,onFocus:X,onBlur:Q})})})]}),s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Job Title",gap:8,children:s.jsx("input",{type:"text",value:dn,onChange:f=>Bo(f.target.value),placeholder:"Optional",autoComplete:"organization-title",style:$,onFocus:X,onBlur:Q})})}),s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Team Size",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("select",{value:yt,onChange:f=>qo(f.target.value),style:{...$,appearance:"none",WebkitAppearance:"none",paddingRight:36,cursor:"pointer",fontSize:15,color:yt?"var(--color-text)":"var(--color-text-secondary)"},children:xs.map(f=>s.jsx("option",{value:f.value,children:f.label},f.value||"empty"))}),s.jsx(Ce.ChevronDown,{size:16,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:"var(--color-text-secondary)"}})]})})})]}),s.jsx(H,{label:"Phone systems",gap:8,children:s.jsx(Xn,{compact:!0,options:ws,value:un,onChange:Ho,otherValue:xt,onOtherChange:Mo,placeholder:"Select (optional)",otherPlaceholder:"Please specify your phone system"})}),s.jsx(H,{label:"Meeting tools",gap:8,children:s.jsx(Xn,{compact:!0,options:bs,value:pn,onChange:Jo,otherValue:wt,onOtherChange:Wo,placeholder:"Select (optional)",otherPlaceholder:"Please specify your meeting tool"})}),gn&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),gn]}),s.jsx(me,{type:"button",onClick:_o,disabled:hn,children:hn?"Joining...":"Join Waitlist"}),s.jsx(je,{text:"I am already a member",linkText:"Log In",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:16})]})]})}):W==="signup"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Sign Up",subtitle:"Please enter your basic details to continue"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx(H,{label:"First Name",gap:8,children:s.jsx("input",{type:"text",value:pt,onChange:f=>Ao(f.target.value),placeholder:"First name",autoFocus:!0,autoComplete:"given-name",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Last Name",gap:8,children:s.jsx("input",{type:"text",value:gt,onChange:f=>Uo(f.target.value),placeholder:"Last name",autoComplete:"family-name",style:$,onFocus:X,onBlur:Q})})]}),s.jsx(H,{label:"Email",gap:8,children:s.jsx("input",{type:"text",value:Le,onChange:f=>{Eo(f.target.value),Ae("")},placeholder:"workemail@example.com",autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Create Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:ft?"text":"password",value:Ye,onChange:f=>{To(f.target.value),Ae("")},placeholder:"Enter password",autoComplete:"new-password",style:{...$,padding:"10px 44px 10px 14px"},onFocus:X,onBlur:Q}),s.jsx(Tt,{show:ft,onToggle:()=>Po(!ft)})]})}),s.jsx(H,{label:"Confirm Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:vt?"text":"password",value:ht,onChange:f=>{Do(f.target.value),Ae("")},placeholder:"Enter password",autoComplete:"new-password",style:{...$,padding:"10px 44px 10px 14px"},onFocus:X,onBlur:Q}),s.jsx(Tt,{show:vt,onToggle:()=>Ro(!vt)})]})}),nn&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),nn]}),(()=>{const f=pt&&gt&&Le&&Ye&&ht;return s.jsx(me,{onClick:()=>{if(Ae(""),!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Le)){Ae("Please enter a valid email address.");return}if(Ye!==ht){Ae("Password and Confirm Password do not match!");return}i==null||i({firstName:pt,lastName:gt,email:Le,password:Ye}),M("verifyemail")},disabled:!f,children:"Create Account"})})(),s.jsx(je,{text:"I am already a member",linkText:"Sign In",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u})]})]}):W==="verifyemail"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Verify Email"}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:"Verify your email to continue the signup process."})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:24},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"We have sent a verification link to:"}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:600,lineHeight:"24px",color:"var(--color-text)",margin:0},children:Le||"youremail@workemail.com"})]}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"Click on the link to complete the verification process. You might need to check your Spam folder"}),s.jsx(me,{onClick:()=>{M("signin"),h==null||h()},children:"Go To Login"})]}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]}):W==="verifycode"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Sign In with code"}),s.jsxs("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:["We have sent a one-time code to your email:"," ",s.jsx("span",{style:{color:"var(--color-text)"},children:Ne||"workemail@example.com"})," ",s.jsx("button",{type:"button",onClick:()=>M("getcode"),style:{background:"none",border:"none",padding:0,fontSize:18,fontWeight:400,color:We,cursor:"pointer",fontFamily:S,textDecoration:"underline"},children:"Change email"})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Enter one-time code",gap:12,children:s.jsx("div",{style:{display:"flex",gap:8},children:ge.map((f,j)=>s.jsx("input",{ref:O=>{Fe.current[j]=O},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:O=>bn(j,O.target.value),onKeyDown:O=>kn(j,O),onPaste:O=>In(j,O),autoFocus:j===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:S,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:We},onFocus:X,onBlur:Q},j))})}),s.jsx(me,{onClick:()=>o==null?void 0:o(Ne,ge.join("")),disabled:ge.some(f=>!f),children:"Verify Code"}),Xe&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Xe]}),s.jsx(Je,{}),s.jsx(je,{text:"Not received yet?",linkText:"Resend",onClick:()=>r==null?void 0:r(Ne)}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:24})]})]}):W==="getcode"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Get code",subtitle:"We'll send a one time pass-code to your email"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:ne,onChange:f=>Oe(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(me,{onClick:()=>{tn(ne),$e(["","","","","",""]),M("verifycode"),n==null||n(ne)},disabled:!ne,children:"Send One-time Code"}),s.jsx(Je,{}),s.jsx(je,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):W==="getcodewithname"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Complete your sign in",subtitle:"We’ve sent a one-time code to your email. Please enter the code and your full name to sign in"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:ne,onChange:f=>Oe(f.target.value),placeholder:"workemail@example.com",autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Full Name",gap:12,children:s.jsx("input",{type:"text",value:re,onChange:f=>D(f.target.value),placeholder:"Enter your full name",autoComplete:"name",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Enter one-time code",gap:12,children:s.jsx("div",{style:{display:"flex",gap:8},children:ge.map((f,j)=>s.jsx("input",{ref:O=>{Fe.current[j]=O},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:O=>bn(j,O.target.value),onKeyDown:O=>kn(j,O),onPaste:O=>In(j,O),autoFocus:j===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:S,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:We},onFocus:X,onBlur:Q},j))})}),s.jsx(me,{onClick:()=>{tn(ne),n==null||n(ne,re,ge.join(""))},disabled:!ne||!re||ge.some(f=>!f),children:"Verify & Sign In"}),Xe&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Xe]}),s.jsx(Je,{}),s.jsx(je,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):W==="resetpassword"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Reset Password",subtitle:"We'll send an email to reset your password"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:mt,onChange:f=>No(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(me,{onClick:()=>l==null?void 0:l(mt),disabled:!mt,children:"Send Reset Link"}),s.jsx(Je,{}),s.jsx(je,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:48},children:[s.jsx(Ee,{title:"Sign in",subtitle:"Enter your email & password to continue"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:8},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:16},children:[s.jsxs("form",{onSubmit:Zo,style:{width:"100%",display:"flex",flexDirection:"column",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{ref:ke,type:"email",value:T,onChange:f=>m(f.target.value),placeholder:"workemail@example.com",required:!0,autoComplete:"email",style:{...$,border:`1px solid ${ve?"var(--color-text)":"var(--color-input-border)"}`},onFocus:yn,onBlur:xn})}),s.jsx(H,{label:"Password",gap:12,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{ref:Ie,type:V?"text":"password",value:C,onChange:f=>z(f.target.value),placeholder:"Enter password",required:!0,autoComplete:"current-password",style:{...$,padding:"10px 44px 10px 16px",border:`1px solid ${ve?"var(--color-text)":"var(--color-input-border)"}`},onFocus:yn,onBlur:xn}),s.jsx(Tt,{show:V,onToggle:()=>Y(!V)})]})}),s.jsx(me,{type:"submit",disabled:!mn,children:vn?"Signing in…":"Sign In"})]}),ve&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),ve]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[s.jsx("button",{type:"button",onClick:()=>{M("resetpassword"),t==null||t()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:400,lineHeight:"100%",color:"var(--color-text)",cursor:"pointer",fontFamily:S,textDecoration:"underline"},children:"Forgot Password?"}),s.jsx("button",{type:"button",onClick:()=>{M("getcode"),n==null||n()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"100%",color:We,cursor:"pointer",fontFamily:S,textDecoration:"underline solid",textUnderlineOffset:0,textDecorationSkipInk:"none"},children:"Sign in with one-time code"})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:2},children:[s.jsx(Je,{}),s.jsx(ks,{projectId:k,onSuccess:p,onError:v})]})]}),s.jsx(je,{text:R==="waitlist"?"Don't have an account yet?":"Not a member yet?",linkText:R==="waitlist"?"Join Waitlist":"Sign Up",onClick:()=>{if(R==="waitlist"){M("waitlist"),a==null||a();return}M("signup"),i==null||i()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:16})]})]})})})]})}exports.Ee=Co;exports.LoginPage=Is;exports.X=xo;exports.Z=$i;exports.__awaiter=tr;exports.__classPrivateFieldGet=or;exports.__classPrivateFieldSet=rr;exports.__rest=q;exports.h=ps;exports.r=ds;exports.s=us;
50
3
  //# sourceMappingURL=index.cjs2.js.map