@tempots/beatui 0.68.0 → 0.71.0

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 (98) hide show
  1. package/dist/{ar-aMLQTGVh.js → ar-BbgpGwJp.js} +1 -1
  2. package/dist/auth/index.cjs.js +1 -1
  3. package/dist/auth/index.es.js +106 -105
  4. package/dist/beatui.css +401 -0
  5. package/dist/beatui.tailwind.css +401 -0
  6. package/dist/{de-DBFOC44R.js → de-R7lPfyZ4.js} +1 -1
  7. package/dist/deep-merge-CQQCMLwG.js +1636 -0
  8. package/dist/deep-merge-DZxfgKqX.cjs +1 -0
  9. package/dist/duration-input-D-SIoDoo.cjs +1 -0
  10. package/dist/duration-input-DKxZ6OCa.js +277 -0
  11. package/dist/{es-C4xOThaT.js → es-DV0Jr_BZ.js} +1 -1
  12. package/dist/{fa-B7X_xydY.js → fa-DXvHejs9.js} +1 -1
  13. package/dist/{fr-AmjzbxN_.js → fr-D8FOMX0o.js} +1 -1
  14. package/dist/{he-DY-9yiOC.js → he-B19Qsx-u.js} +1 -1
  15. package/dist/{hi-Clkyp5Fu.js → hi-DozFnE3b.js} +1 -1
  16. package/dist/{index-GLoRnI6r.js → index-CYb1YxDX.js} +1 -1
  17. package/dist/{index-CzuXAuLZ.js → index-DdpYvBeh.js} +3 -3
  18. package/dist/index.cjs.js +4 -4
  19. package/dist/index.es.js +2830 -3079
  20. package/dist/{it-BC32WmGF.js → it-But8uzNi.js} +1 -1
  21. package/dist/{ja-JNSZS_Hv.js → ja-DkwTnFdU.js} +1 -1
  22. package/dist/json-schema/index.cjs.js +6 -6
  23. package/dist/json-schema/index.es.js +3459 -3333
  24. package/dist/json-structure/index.cjs.js +1 -0
  25. package/dist/json-structure/index.es.js +3157 -0
  26. package/dist/{ko-B8l0TJp0.js → ko-Cqv-IjhX.js} +1 -1
  27. package/dist/modal-5P9mU_a4.cjs +1 -0
  28. package/dist/{modal-DJWj5M5e.js → modal-MofsfmAe.js} +2 -2
  29. package/dist/{nl-BpYESHP8.js → nl-YSiU3rFI.js} +1 -1
  30. package/dist/notice-Cqq8g17n.js +209 -0
  31. package/dist/notice-DP209Ed8.cjs +1 -0
  32. package/dist/{pl-_sWhGdrs.js → pl-DXmHc2Nh.js} +1 -1
  33. package/dist/prosemirror/index.es.js +1 -1
  34. package/dist/{pt-BmiQvHUz.js → pt-Bf3z_-26.js} +1 -1
  35. package/dist/{ru-DacnqexG.js → ru-Sy00qUeG.js} +1 -1
  36. package/dist/tailwind/vite-plugin.es.js +1 -0
  37. package/dist/{toolbar-Bk5-22ln.js → toolbar-C_Ec0_XC.js} +1 -1
  38. package/dist/{tr-BSS5b_v6.js → tr-BDxG3qd6.js} +1 -1
  39. package/dist/{translations-zGwuSQWQ.js → translations-BmsRhth7.js} +1 -1
  40. package/dist/{translations-BUTBIDsS.js → translations-DQxouiBG.js} +24 -24
  41. package/dist/types/components/form/index.d.ts +1 -0
  42. package/dist/types/components/form/utils/deep-merge.d.ts +27 -0
  43. package/dist/types/components/form/utils/index.d.ts +1 -0
  44. package/dist/types/components/json-schema/controls/generic-control.d.ts +2 -1
  45. package/dist/types/components/json-schema/controls/shared-utils.d.ts +17 -1
  46. package/dist/types/components/json-schema/index.d.ts +2 -0
  47. package/dist/types/components/json-schema/json-schema-form.d.ts +25 -3
  48. package/dist/types/components/json-schema/schema-context.d.ts +3 -0
  49. package/dist/types/components/json-schema/schema-defaults.d.ts +39 -0
  50. package/dist/types/components/json-schema/widgets/widget-customization.d.ts +55 -0
  51. package/dist/types/components/json-structure/controls/any-control.d.ts +15 -0
  52. package/dist/types/components/json-structure/controls/array-control.d.ts +15 -0
  53. package/dist/types/components/json-structure/controls/binary-control.d.ts +15 -0
  54. package/dist/types/components/json-structure/controls/boolean-control.d.ts +15 -0
  55. package/dist/types/components/json-structure/controls/choice-control.d.ts +19 -0
  56. package/dist/types/components/json-structure/controls/decimal-control.d.ts +17 -0
  57. package/dist/types/components/json-structure/controls/deprecation-utils.d.ts +14 -0
  58. package/dist/types/components/json-structure/controls/enum-const-controls.d.ts +22 -0
  59. package/dist/types/components/json-structure/controls/generic-control.d.ts +31 -0
  60. package/dist/types/components/json-structure/controls/index.d.ts +21 -0
  61. package/dist/types/components/json-structure/controls/integer-control.d.ts +18 -0
  62. package/dist/types/components/json-structure/controls/map-control.d.ts +17 -0
  63. package/dist/types/components/json-structure/controls/object-control.d.ts +17 -0
  64. package/dist/types/components/json-structure/controls/set-control.d.ts +15 -0
  65. package/dist/types/components/json-structure/controls/string-control.d.ts +15 -0
  66. package/dist/types/components/json-structure/controls/temporal-control.d.ts +18 -0
  67. package/dist/types/components/json-structure/controls/tuple-control.d.ts +19 -0
  68. package/dist/types/components/json-structure/controls/union-control.d.ts +15 -0
  69. package/dist/types/components/json-structure/controls/uri-control.d.ts +15 -0
  70. package/dist/types/components/json-structure/controls/uuid-control.d.ts +15 -0
  71. package/dist/types/components/json-structure/extends-utils.d.ts +36 -0
  72. package/dist/types/components/json-structure/index.d.ts +25 -0
  73. package/dist/types/components/json-structure/json-structure-form.d.ts +96 -0
  74. package/dist/types/components/json-structure/ref-utils.d.ts +55 -0
  75. package/dist/types/components/json-structure/structure-context.d.ts +176 -0
  76. package/dist/types/components/json-structure/structure-defaults.d.ts +46 -0
  77. package/dist/types/components/json-structure/structure-types.d.ts +173 -0
  78. package/dist/types/components/json-structure/validation/error-transform.d.ts +56 -0
  79. package/dist/types/components/json-structure/validation/index.d.ts +5 -0
  80. package/dist/types/components/json-structure/validation/sdk-validator.d.ts +46 -0
  81. package/dist/types/components/json-structure/widgets/default-widgets.d.ts +27 -0
  82. package/dist/types/components/json-structure/widgets/index.d.ts +6 -0
  83. package/dist/types/components/json-structure/widgets/widget-registry.d.ts +143 -0
  84. package/dist/types/components/json-structure/widgets/widget-utils.d.ts +79 -0
  85. package/dist/types/index.d.ts +1 -0
  86. package/dist/types/json-structure/index.d.ts +9 -0
  87. package/dist/{ur-C6Ky6OCl.js → ur-55zdT2TQ.js} +1 -1
  88. package/dist/{notice-Um1LwKBF.js → use-form-B7A865EM.js} +329 -532
  89. package/dist/use-form-DVJXMMoN.cjs +2 -0
  90. package/dist/{vi-Bx2gx2S0.js → vi-C7K7W0hM.js} +1 -1
  91. package/dist/widget-customization-29Hl2gKT.js +1171 -0
  92. package/dist/widget-customization-BXiewbt-.cjs +1 -0
  93. package/dist/{zh-eixtg-Ce.js → zh-DvJBV9D8.js} +1 -1
  94. package/package.json +10 -2
  95. package/dist/modal-D_paG9Sr.cjs +0 -1
  96. package/dist/notice-CgT9ma2m.cjs +0 -2
  97. package/dist/utils-7JQljUYX.js +0 -2554
  98. package/dist/utils-CPtkOy9f.cjs +0 -1
@@ -1,4 +1,4 @@
1
- import { f as a } from "./translations-BUTBIDsS.js";
1
+ import { f as a } from "./translations-DQxouiBG.js";
2
2
  const d = {
3
3
  loadingExtended: "جاري التحميل، يرجى الانتظار",
4
4
  loadingShort: "جاري التحميل...",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@tempots/dom"),u=require("../notice-CgT9ma2m.cjs"),g=require("../modal-D_paG9Sr.cjs"),P=require("../translations-C7HVMcOQ.cjs"),I=require("../translations-hMQlZmD4.cjs"),Z=require("@tempots/ui"),C={google:{name:"Google",icon:"logos:google-icon",color:"#4285f4"},github:{name:"GitHub",icon:"logos:github-icon",color:"#333"},apple:{name:"Apple",icon:"logos:apple",color:"#000"},facebook:{name:"Facebook",icon:"logos:facebook",color:"#1877f2"},twitter:{name:"Twitter",icon:"logos:twitter",color:"#1da1f2"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"#00a4ef"},discord:{name:"Discord",icon:"logos:discord-icon",color:"#5865f2"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"#0077b5"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"#e4405f"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"#000"},snapchat:{name:"Snapchat",icon:"logos:snapchat-icon",color:"#fffc00"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"#ff4500"},pinterest:{name:"Pinterest",icon:"logos:pinterest-icon",color:"#bd081c"},twitch:{name:"Twitch",icon:"logos:twitch",color:"#9146ff"},steam:{name:"Steam",icon:"logos:steam-icon",color:"#000"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"#313131"},playstation:{name:"PlayStation",icon:"logos:playstation-icon",color:"#003791"},xbox:{name:"Xbox",icon:"logos:xbox-icon",color:"#107c10"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"#25d366"},wechat:{name:"WeChat",icon:"logos:wechat-icon",color:"#1aad19"},amazon:{name:"Amazon",icon:"logos:amazon-icon",color:"#ff9900"},yahoo:{name:"Yahoo",icon:"logos:yahoo-icon",color:"#720e9e"},paypal:{name:"PayPal",icon:"logos:paypal",color:"#0070ba"},x:{name:"X",icon:"simple-icons:x",color:"#000"}};function M(o){return C[o]?.name||o}function J(o){return C[o]?.icon||"mdi:account"}function K(o){return C[o]?.color||"#666"}function Q(o,e="Continue with {provider}"){return e.replace("{provider}",M(o))}const y={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function tt(o){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)}function N(o=32){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let l=0;l<o;l++)i+=e.charAt(Math.floor(Math.random()*e.length));return i}function ot(o,e,i,l=[],c={}){const n={google:"https://accounts.google.com/oauth/authorize",github:"https://github.com/login/oauth/authorize",apple:"https://appleid.apple.com/auth/authorize",facebook:"https://www.facebook.com/v18.0/dialog/oauth",twitter:"https://twitter.com/i/oauth2/authorize",microsoft:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",discord:"https://discord.com/api/oauth2/authorize",linkedin:"https://www.linkedin.com/oauth/v2/authorization",instagram:"https://api.instagram.com/oauth/authorize",tiktok:"https://www.tiktok.com/v2/auth/authorize",snapchat:"https://accounts.snapchat.com/accounts/oauth2/authorize",reddit:"https://www.reddit.com/api/v1/authorize",pinterest:"https://api.pinterest.com/oauth/",twitch:"https://id.twitch.tv/oauth2/authorize",steam:"https://steamcommunity.com/oauth/authorize",epic:"https://auth.epicgames.com/authorize",playstation:"https://auth.api.sonyentertainmentnetwork.com/oauth/authorize",xbox:"https://login.live.com/oauth20_authorize.srf",whatsapp:"https://web.whatsapp.com/oauth/authorize",wechat:"https://open.weixin.qq.com/connect/qrconnect",amazon:"https://www.amazon.com/ap/oa",yahoo:"https://api.login.yahoo.com/oauth2/request_auth",paypal:"https://www.paypal.com/signin/authorize",x:"https://api.twitter.com/oauth2/authorize"},m={google:["openid","email","profile"],github:["user:email"],apple:["email","name"],facebook:["email"],twitter:["users.read"],microsoft:["openid","email","profile"],discord:["identify","email"],linkedin:["r_liteprofile","r_emailaddress"],instagram:["user_profile","user_media"],tiktok:["user.info.basic","user.external.id"],snapchat:["user.info.basic","user.external.id"],reddit:["identity","email"],pinterest:["read_public","read_relationships"],twitch:["openid","email","profile"],steam:["openid","email","profile"],epic:["openid","email","profile"],playstation:["openid","email","profile"],xbox:["openid","email","profile"],whatsapp:["openid","email","profile"],wechat:["openid","email","profile"],amazon:["openid","email","profile"],yahoo:["openid","email","profile"],paypal:["openid","email","profile"],x:["openid","email","profile"]},a=n[o];if(!a)throw new Error(`Unsupported provider: ${o}`);const r=l.length>0?l:m[o],s=N(),h=new URLSearchParams({client_id:e,redirect_uri:i,scope:r.join(" "),state:s,response_type:"code",...c});return`${a}?${h.toString()}`}function et(o,e,i,l){const c=window.open(o,`${e}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){l?.(new Error("Failed to open popup window"));return}const n=setInterval(()=>{c.closed&&(clearInterval(n),l?.(new Error("Login cancelled")))},1e3),m=a=>{a.origin===window.location.origin&&(a.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(n),c.close(),window.removeEventListener("message",m),i?.(a.data.result)):a.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(n),c.close(),window.removeEventListener("message",m),l?.(new Error(a.data.error))))};window.addEventListener("message",m)}function at(o){return o instanceof Error?o.message:typeof o=="string"?o:o&&typeof o=="object"&&"message"in o?String(o.message):"An unexpected error occurred"}function nt(){return typeof window<"u"&&typeof document<"u"}function T({task:o,message:e,onStart:i,onEnd:l}){return async c=>{i?.();const n=await u.taskToValidation({task:o!=null?()=>o(c):async()=>null,errorMessage:e,errorPath:["root"],validation:m=>m!=null?u.a.invalid({message:m}):u.a.valid});return l?.(),n}}function $(o=y){let e=g.string();return o.minLength&&(e=e.min(o.minLength,`Password must be at least ${o.minLength} characters`)),o.requireUppercase&&(e=e.regex(/[A-Z]/,"Password must contain at least one uppercase letter")),o.requireLowercase&&(e=e.regex(/[a-z]/,"Password must contain at least one lowercase letter")),o.requireNumbers&&(e=e.regex(/[0-9]/,"Password must contain at least one number")),o.requireSymbols&&(e=e.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,"Password must contain at least one special character")),o.customValidation&&(e=e.refine(i=>o.customValidation(i))),e}const x=g.string().min(1,"Email is required").email("Please enter a valid email address");function z(o){const e=o?$(o):g.string().refine(i=>i.length>0?null:"Password is required");return g.object({email:x,password:e,rememberMe:g.boolean().default(!1)}).schema()}function E(o=y,e){const i=$(o),l=e?.showNameField!==!1,c=e?.showConfirmPassword!==!1,n=e?.showAcceptTermsAndConditions!==!1,m={name:l?g.string().min(1,"Name is required").optional():g.string().optional(),email:x,password:i,confirmPassword:c?g.string().min(1,"Please confirm your password"):g.string(),acceptTerms:n?g.boolean().refine(r=>r===!0,"You must accept the terms and conditions"):g.boolean().default(!0)},a=g.object(m);return c?a.refine(r=>r.password===r.confirmPassword?null:"Passwords don't match",{path:["confirmPassword"]}).schema():a.schema()}const V=g.object({email:x}).schema(),rt=z(),st=E(),it={signIn:z,signUp:E,resetPassword:()=>V};function ct(o){const e=x.validate(o);return e.success?null:e.errors[0]?.message||"Invalid email"}function lt(o,e=y){const l=$(e).validate(o);return l.success?null:l.errors[0]?.message||"Invalid password"}function O(o,e=y){const i={length:o.length>=(e.minLength||8),uppercase:/[A-Z]/.test(o),lowercase:/[a-z]/.test(o),numbers:/[0-9]/.test(o),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(o),custom:e.customValidation?e.customValidation(o)===null:o.length>0},l=[!0,e.requireUppercase,e.requireLowercase,e.requireNumbers,e.requireSymbols,!!e.customValidation].filter(Boolean).length,c=[i.length,e.requireUppercase?i.uppercase:null,e.requireLowercase?i.lowercase:null,e.requireNumbers?i.numbers:null,e.requireSymbols?i.symbols:null,e.customValidation?i.custom:null].filter(a=>a===!0).length,n=l>0?Math.round(c/l*100):0;let m;return n<40?m="weak":n<60?m="fair":n<80?m="good":m="strong",{strength:m,score:n,checks:i}}const R=()=>t.localStorageProp({key:"bui_auth_email",defaultValue:null});function D({onSignIn:o,passwordRules:e,labels:i,showRememberMe:l}){const c=t.prop(!1),n=R(),m=z(e),a=u.useForm({schema:m,onSubmit:T({task:o,message:"Reset password failed",onStart:()=>{c.set(!0),a.controller.disable()},onEnd:()=>{c.set(!1),a.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:r,submit:s}=a;c.on(r.setDisabled);const h=r.field("email"),f=r.field("password");return n.on(b=>{b!=null&&h.change(b)}),h.signal.on(b=>{n.value!=null&&(n.value=b)}),t.Use(P.AuthI18n,b=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(s),u.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(r.error,L=>u.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(L))),u.Control(u.EmailInput,{controller:h,label:t.coalesce(i?.emailLabel,b.$.emailLabel)}),u.Control(u.PasswordInput,{controller:f,label:t.coalesce(i?.passwordLabel,b.$.passwordLabel)}),t.When(l??!0,()=>t.html.div(t.attr.class("bc-auth-form__remember-me"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),u.CheckboxInput({value:n.map(L=>L!=null),after:t.html.span(t.coalesce(i?.rememberMeLabel,b.$.rememberMeLabel)),onChange:L=>{L?n.value=h.signal.value??"":n.value=null}}))))),I.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:r.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(i?.signInButton,b.$.signInButton))))}function G({password:o,rules:e=y,showLabel:i=!0,className:l}){const c=t.computedOf(o)(s=>!s||s.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:O(s,e)),n=c.map(s=>s.strength),m=c.map(s=>s.score),a=c.map(s=>s.checks),r=t.computedOf(n,l)((s,h)=>["bc-password-strength",`bc-password-strength--${s}`,h].filter(Boolean).join(" "));return t.html.div(t.attr.class(r),t.html.div(t.attr.class("bc-password-strength__bar"),t.html.div(t.attr.class("bc-password-strength__fill"),t.attr.style(m.map(s=>`width: ${s}%`)))),t.When(i,()=>t.Use(P.AuthI18n,s=>t.html.div(t.attr.class("bc-password-strength__label"),t.computedOf(n,s)((h,f)=>{switch(h){case"weak":return f.passwordStrengthWeak;case"fair":return f.passwordStrengthFair;case"good":return f.passwordStrengthGood;case"strong":return f.passwordStrengthStrong;default:return f.passwordStrengthWeak}})))),t.html.div(t.attr.class("bc-password-strength__requirements"),t.When(e.minLength!==void 0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.length?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.length?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),`At least ${e.minLength} characters`))),t.When(e.requireUppercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.uppercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.uppercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),t.When(e.requireLowercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.lowercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.lowercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),t.When(e.requireNumbers===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.numbers?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.numbers?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One number"))),t.When(e.requireSymbols===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.symbols?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.symbols?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function mt({password:o,rules:e=y,className:i}){const l=t.computedOf(o)(a=>!a||a.length===0?{strength:"weak",score:0}:O(a,e)),c=l.map(a=>a.strength),n=l.map(a=>a.score),m=t.computedOf(c,i)((a,r)=>["bc-password-strength-bar",`bc-password-strength-bar--${a}`,r].filter(Boolean).join(" "));return t.html.div(t.attr.class(m),t.html.div(t.attr.class("bc-password-strength-bar__fill"),t.attr.style(n.map(a=>`width: ${a}%`))))}function ut({password:o,rules:e=y,className:i}){const l=t.computedOf(o)(n=>!n||n.length===0?"weak":O(n,e).strength),c=t.computedOf(l,i)((n,m)=>["bc-password-strength-text",`bc-password-strength-text--${n}`,m].filter(Boolean).join(" "));return t.Fragment(t.Use(P.AuthI18n,n=>t.html.span(t.attr.class(c),t.computedOf(l,n)((m,a)=>{switch(m){case"weak":return a.passwordStrengthWeak;case"fair":return a.passwordStrengthFair;case"good":return a.passwordStrengthGood;case"strong":return a.passwordStrengthStrong;default:return a.passwordStrengthWeak}}))))}function j({passwordRules:o,labels:e,initialEmail:i,initialName:l,showPasswordStrength:c,onSignUp:n,showNameField:m,showConfirmPassword:a,showAcceptTermsAndConditions:r,termsAndConditions:s}){const h=t.prop(!1),f=o||y,b=E(f,{showNameField:m!==!1,showConfirmPassword:a!==!1,showAcceptTermsAndConditions:r!==!1}),L=u.useForm({schema:b,onSubmit:T({task:n!=null?_=>n({email:_.email,password:_.password,name:_.name,acceptTerms:_.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{h.set(!0),L.controller.disable()},onEnd:()=>{h.set(!1),L.controller.enable()}}),initialValue:{name:l??"",email:i??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:k,submit:B}=L;h.on(k.setDisabled);const v=k.field("name"),q=k.field("email"),A=k.field("password"),U=k.field("confirmPassword"),S=k.field("acceptTerms");return t.Use(P.AuthI18n,_=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(B),u.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(k.error,w=>u.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(w))),t.When(m!==!1,()=>u.Control(I.TextInput,{controller:v.transform(w=>w??"",w=>w===""?void 0:w),label:t.coalesce(e?.nameLabel,_.$.nameLabel)})),u.Control(u.EmailInput,{controller:q,label:t.coalesce(e?.emailLabel,_.$.emailLabel)}),u.Control(u.PasswordInput,{controller:A,label:t.coalesce(e?.passwordLabel,_.$.passwordLabel)}),t.When(c??!1,()=>G({password:A.signal,rules:f,showLabel:!0})),t.When(a??!1,()=>u.Control(u.PasswordInput,{controller:U,label:t.coalesce(e?.confirmPasswordLabel,_.$.confirmPasswordLabel)})),t.When(r??!1,()=>t.html.div(t.attr.class("bc-auth-form__terms"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),u.CheckboxInput({value:S.signal.map(w=>w??!1),onChange:w=>S.change(w)}),t.html.span(s||t.coalesce(e?.acceptTermsLabel,_.$.acceptTermsLabel))),t.When(S.errorVisible,()=>t.html.div(t.attr.class("bc-auth-form__field-error"),S.error.map(w=>w||"")))))),I.Button({type:"submit",variant:"filled",color:"primary",loading:h,disabled:k.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(e?.signUpButton,_.$.signUpButton))))}function H({onResetPassword:o,labels:e={}}){const i=R(),l=t.prop(!1),c=u.useForm({schema:V,onSubmit:T({task:o,message:"Reset password failed",onStart:()=>{l.set(!0),c.controller.disable()},onEnd:()=>{l.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:n,submit:m}=c;l.on(n.setDisabled);const a=n.field("email");return i.on(r=>{r!=null&&a.change(r)}),t.Use(P.AuthI18n,r=>t.html.form(t.attr.class("bc-auth-form__form"),t.Ensure(n.error,s=>u.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(s))),t.html.p(t.attr.class("bc-auth-form__description"),t.coalesce(e?.resetPasswordDescription,r.$.resetPasswordDescription)),t.on.submit(m),u.Stack(t.attr.class("bc-auth-form__fields"),u.Control(u.EmailInput,{controller:a,label:t.coalesce(e?.emailLabel,r.$.emailLabel)})),I.Button({loading:l,type:"submit",variant:"filled",color:"primary",disabled:n.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(e?.resetPasswordButton,r.$.resetPasswordButton))))}function p({provider:o,onClick:e,size:i="md",name:l,icon:c,color:n,flow:m,labels:a}){const r=async()=>{if(e)try{m==="popup"?await e():await e()}catch(s){console.error(`Social login error for ${o} (${m||"redirect"} flow):`,s)}};return I.Button({type:"button",variant:"filled",size:i,color:n,onClick:r,roundedness:"full"},t.attr.class("bc-social-login-button"),t.attr.class(t.computedOf(o)(s=>`bc-social-login-button--${s}`)),t.html.span(t.attr.class("bc-social-login-button__inner"),t.html.span(t.attr.class("bc-social-login-button__icon"),I.Icon({icon:c,size:i},t.attr.class("bc-social-login-button__icon-inner"))),t.Use(P.AuthI18n,s=>t.html.span(t.attr.class("bc-social-login-button__label"),t.bind(t.coalesce(a?.continueWithProvider,s.$.continueWithProvider))(l)))))}function X({providers:o,onProviderClick:e,size:i="md",className:l}){return u.Stack(t.attr.class("bc-social-login-buttons"),t.attr.class(l),t.ForEach(o,c=>p({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:n})=>d[n].color),name:c.map(({provider:n})=>d[n].name),icon:c.map(({provider:n})=>d[n].icon),onClick:async()=>{e&&await e(c.$.provider.value)},size:i})))}const d={google:{name:"Google",icon:"logos:google-icon",color:"red"},github:{name:"GitHub",icon:"logos:github-icon",color:"black"},apple:{name:"Apple",icon:"logos:apple",color:"stone"},facebook:{name:"Facebook",icon:"logos:facebook",color:"blue"},twitter:{name:"Twitter",icon:"logos:twitter",color:"sky"},x:{name:"X",icon:"logos:x",color:"zinc"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"amber"},discord:{name:"Discord",icon:"logos:discord-icon",color:"indigo"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"cyan"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"fuchsia"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"teal"},snapchat:{name:"Snapchat",icon:"streamline-logos:snapchat-logo-solid",color:"yellow"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"orange"},pinterest:{name:"Pinterest",icon:"logos:pinterest",color:"rose"},twitch:{name:"Twitch",icon:"logos:twitch",color:"purple"},steam:{name:"Steam",icon:"logos:steam",color:"slate"},epic:{name:"Epic Games",icon:"streamline-logos:epic-games-logo-solid",color:"neutral"},playstation:{name:"PlayStation",icon:"streamline-logos:playstation-logo-solid",color:"violet"},xbox:{name:"Xbox",icon:"streamline-logos:xbox-live-logo-solid",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"streamline-logos:wechat-logo",color:"lime"},amazon:{name:"Amazon",icon:"streamline-logos:amazon-logo-solid",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},dt=o=>p({...o,...d.google,provider:"google"}),pt=o=>p({...o,...d.github,provider:"github"}),ht=o=>p({...o,...d.apple,provider:"apple"}),gt=o=>p({...o,...d.facebook,provider:"facebook"}),ft=o=>p({...o,...d.x,provider:"x"}),bt=o=>p({...o,...d.twitter,provider:"twitter"}),wt=o=>p({...o,...d.microsoft,provider:"microsoft"}),Lt=o=>p({...o,...d.discord,provider:"discord"}),_t=o=>p({...o,...d.linkedin,provider:"linkedin"}),kt=o=>p({...o,...d.instagram,provider:"instagram"}),vt=o=>p({...o,...d.tiktok,provider:"tiktok"}),St=o=>p({...o,...d.snapchat,provider:"snapchat"}),Pt=o=>p({...o,...d.reddit,provider:"reddit"}),yt=o=>p({...o,...d.pinterest,provider:"pinterest"}),Bt=o=>p({...o,...d.twitch,provider:"twitch"}),It=o=>p({...o,...d.steam,provider:"steam"}),xt=o=>p({...o,...d.epic,provider:"epic"}),qt=o=>p({...o,...d.playstation,provider:"playstation"}),At=o=>p({...o,...d.xbox,provider:"xbox"}),Ct=o=>p({...o,...d.whatsapp,provider:"whatsapp"}),Tt=o=>p({...o,...d.wechat,provider:"wechat"}),$t=o=>p({...o,...d.amazon,provider:"amazon"}),zt=o=>p({...o,...d.yahoo,provider:"yahoo"}),Et=o=>p({...o,...d.paypal,provider:"paypal"});function W({providers:o}){return u.Stack(X({providers:o}))}function Y({mode:o,socialProviders:e,initialName:i,initialEmail:l,passwordRules:c,showRememberMe:n,showSocialDivider:m,showPasswordStrength:a,labels:r,onSignIn:s,onSignUp:h,onResetPassword:f,onModeChange:b,showContainer:L},...k){const B=o!=null?t.Value.deriveProp(o):t.prop("signin");return B.on(v=>b?.(v)),t.Use(P.AuthI18n,v=>{function q(){const S=t.coalesce(r?.hasAccountLink,v.$.hasAccountLink);return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>B.set("signin")),S)}function A(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>B.set("signup")),t.coalesce(r?.noAccountLink,v.$.noAccountLink))}function U(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>B.set("reset-password")),t.coalesce(r?.forgotPasswordLink,v.$.forgotPasswordLink))}return t.html.div(Z.classes({"bc-auth-container":!0,"bc-auth-container--styled":t.Value.map(L??!0,S=>S)}),t.attr.class(B.map(S=>`bc-auth-container--${S}`)),t.attr.class("bc-auth-form"),t.OneOfValue(B,{signin:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signInTitle,v.$.signInTitle)),e!=null?t.Fragment(W({providers:e}),t.When(m??!1,F)):null,D({onSignIn:s,showRememberMe:n,passwordRules:c,labels:{emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,rememberMeLabel:r?.rememberMeLabel,signInButton:r?.signInButton,forgotPasswordLink:r?.forgotPasswordLink,noAccountLink:r?.noAccountLink}}),u.Stack(t.attr.class("bc-auth-form__footer"),A(),U())),signup:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signUpTitle,v.$.signUpTitle)),e!=null?t.Fragment(W({providers:e}),t.When(m??!1,F)):null,j({labels:{nameLabel:r?.nameLabel,emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,confirmPasswordLabel:r?.confirmPasswordLabel,acceptTermsLabel:r?.acceptTermsLabel,signUpButton:r?.signUpButton,hasAccountLink:r?.hasAccountLink},initialEmail:l,initialName:i,onSignUp:h,passwordRules:c,showPasswordStrength:a}),u.Stack(t.attr.class("bc-auth-form__footer"),q())),"reset-password":()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.resetPasswordTitle,v.$.resetPasswordTitle)),H({labels:{backToSignInLink:r?.backToSignInLink,emailLabel:r?.emailLabel,resetPasswordButton:r?.resetPasswordButton,resetPasswordDescription:r?.resetPasswordDescription},onResetPassword:f}),u.Stack(t.attr.class("bc-auth-form__footer"),q()))}),...k)})}function Ot(o){return g.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(e,i)=>o(l=>e({body:Y({showContainer:!1,...l}),header:t.Use(P.AuthI18n,c=>t.coalesce(l.modalTitle,c.$.authenticationTitle))})))}function F({labels:o,className:e}={}){return t.html.div(t.attr.class("bc-auth-divider"),t.attr.class(e),t.html.div(t.attr.class("bc-auth-divider__line")),t.Use(P.AuthI18n,i=>t.html.span(t.attr.class("bc-auth-divider__text"),t.coalesce(o?.text,i.$.orDivider))),t.html.div(t.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=$t;exports.AppleLoginButton=ht;exports.AuthContainer=Y;exports.AuthDivider=F;exports.AuthModal=Ot;exports.DiscordLoginButton=Lt;exports.EpicLoginButton=xt;exports.FacebookLoginButton=gt;exports.GitHubLoginButton=pt;exports.GoogleLoginButton=dt;exports.InstagramLoginButton=kt;exports.LinkedInLoginButton=_t;exports.MicrosoftLoginButton=wt;exports.PasswordStrengthBar=mt;exports.PasswordStrengthIndicator=G;exports.PasswordStrengthText=ut;exports.PayPalLoginButton=Et;exports.PinterestLoginButton=yt;exports.PlayStationLoginButton=qt;exports.RedditLoginButton=Pt;exports.ResetPasswordForm=H;exports.SignInForm=D;exports.SignUpForm=j;exports.SnapchatLoginButton=St;exports.SocialLoginButton=p;exports.SocialLoginButtons=X;exports.SocialProviders=W;exports.SteamLoginButton=It;exports.TiktokLoginButton=vt;exports.TwitchLoginButton=Bt;exports.TwitterLoginButton=bt;exports.WeChatLoginButton=Tt;exports.WhatsAppLoginButton=Ct;exports.XLoginButtin=ft;exports.XboxLoginButton=At;exports.YahooLoginButton=zt;exports.authSchemas=it;exports.calculatePasswordStrength=O;exports.createPasswordSchema=$;exports.createSignInSchema=z;exports.createSignUpSchema=E;exports.createSocialLoginUrl=ot;exports.defaultPasswordRules=y;exports.defaultSignInSchema=rt;exports.defaultSignUpSchema=st;exports.emailSchema=x;exports.formatAuthError=at;exports.formatProviderName=M;exports.formatSocialLoginText=Q;exports.generateRandomString=N;exports.getProviderColor=K;exports.getProviderIcon=J;exports.isBrowser=nt;exports.isValidEmail=tt;exports.openSocialLoginPopup=et;exports.providerInfo=C;exports.requestToControllerValidation=T;exports.resetPasswordSchema=V;exports.socialProviderInfo=d;exports.useAuthEmailProp=R;exports.validateEmail=ct;exports.validatePassword=lt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@tempots/dom"),p=require("../use-form-DVJXMMoN.cjs"),g=require("../modal-5P9mU_a4.cjs"),y=require("../translations-C7HVMcOQ.cjs"),P=require("../notice-DP209Ed8.cjs"),q=require("../translations-hMQlZmD4.cjs"),J=require("@tempots/ui"),T={google:{name:"Google",icon:"logos:google-icon",color:"#4285f4"},github:{name:"GitHub",icon:"logos:github-icon",color:"#333"},apple:{name:"Apple",icon:"logos:apple",color:"#000"},facebook:{name:"Facebook",icon:"logos:facebook",color:"#1877f2"},twitter:{name:"Twitter",icon:"logos:twitter",color:"#1da1f2"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"#00a4ef"},discord:{name:"Discord",icon:"logos:discord-icon",color:"#5865f2"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"#0077b5"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"#e4405f"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"#000"},snapchat:{name:"Snapchat",icon:"logos:snapchat-icon",color:"#fffc00"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"#ff4500"},pinterest:{name:"Pinterest",icon:"logos:pinterest-icon",color:"#bd081c"},twitch:{name:"Twitch",icon:"logos:twitch",color:"#9146ff"},steam:{name:"Steam",icon:"logos:steam-icon",color:"#000"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"#313131"},playstation:{name:"PlayStation",icon:"logos:playstation-icon",color:"#003791"},xbox:{name:"Xbox",icon:"logos:xbox-icon",color:"#107c10"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"#25d366"},wechat:{name:"WeChat",icon:"logos:wechat-icon",color:"#1aad19"},amazon:{name:"Amazon",icon:"logos:amazon-icon",color:"#ff9900"},yahoo:{name:"Yahoo",icon:"logos:yahoo-icon",color:"#720e9e"},paypal:{name:"PayPal",icon:"logos:paypal",color:"#0070ba"},x:{name:"X",icon:"simple-icons:x",color:"#000"}};function N(o){return T[o]?.name||o}function K(o){return T[o]?.icon||"mdi:account"}function Q(o){return T[o]?.color||"#666"}function tt(o,e="Continue with {provider}"){return e.replace("{provider}",N(o))}const B={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function ot(o){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)}function D(o=32){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let l=0;l<o;l++)i+=e.charAt(Math.floor(Math.random()*e.length));return i}function et(o,e,i,l=[],c={}){const n={google:"https://accounts.google.com/oauth/authorize",github:"https://github.com/login/oauth/authorize",apple:"https://appleid.apple.com/auth/authorize",facebook:"https://www.facebook.com/v18.0/dialog/oauth",twitter:"https://twitter.com/i/oauth2/authorize",microsoft:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",discord:"https://discord.com/api/oauth2/authorize",linkedin:"https://www.linkedin.com/oauth/v2/authorization",instagram:"https://api.instagram.com/oauth/authorize",tiktok:"https://www.tiktok.com/v2/auth/authorize",snapchat:"https://accounts.snapchat.com/accounts/oauth2/authorize",reddit:"https://www.reddit.com/api/v1/authorize",pinterest:"https://api.pinterest.com/oauth/",twitch:"https://id.twitch.tv/oauth2/authorize",steam:"https://steamcommunity.com/oauth/authorize",epic:"https://auth.epicgames.com/authorize",playstation:"https://auth.api.sonyentertainmentnetwork.com/oauth/authorize",xbox:"https://login.live.com/oauth20_authorize.srf",whatsapp:"https://web.whatsapp.com/oauth/authorize",wechat:"https://open.weixin.qq.com/connect/qrconnect",amazon:"https://www.amazon.com/ap/oa",yahoo:"https://api.login.yahoo.com/oauth2/request_auth",paypal:"https://www.paypal.com/signin/authorize",x:"https://api.twitter.com/oauth2/authorize"},m={google:["openid","email","profile"],github:["user:email"],apple:["email","name"],facebook:["email"],twitter:["users.read"],microsoft:["openid","email","profile"],discord:["identify","email"],linkedin:["r_liteprofile","r_emailaddress"],instagram:["user_profile","user_media"],tiktok:["user.info.basic","user.external.id"],snapchat:["user.info.basic","user.external.id"],reddit:["identity","email"],pinterest:["read_public","read_relationships"],twitch:["openid","email","profile"],steam:["openid","email","profile"],epic:["openid","email","profile"],playstation:["openid","email","profile"],xbox:["openid","email","profile"],whatsapp:["openid","email","profile"],wechat:["openid","email","profile"],amazon:["openid","email","profile"],yahoo:["openid","email","profile"],paypal:["openid","email","profile"],x:["openid","email","profile"]},a=n[o];if(!a)throw new Error(`Unsupported provider: ${o}`);const r=l.length>0?l:m[o],s=D(),h=new URLSearchParams({client_id:e,redirect_uri:i,scope:r.join(" "),state:s,response_type:"code",...c});return`${a}?${h.toString()}`}function at(o,e,i,l){const c=window.open(o,`${e}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){l?.(new Error("Failed to open popup window"));return}const n=setInterval(()=>{c.closed&&(clearInterval(n),l?.(new Error("Login cancelled")))},1e3),m=a=>{a.origin===window.location.origin&&(a.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(n),c.close(),window.removeEventListener("message",m),i?.(a.data.result)):a.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(n),c.close(),window.removeEventListener("message",m),l?.(new Error(a.data.error))))};window.addEventListener("message",m)}function nt(o){return o instanceof Error?o.message:typeof o=="string"?o:o&&typeof o=="object"&&"message"in o?String(o.message):"An unexpected error occurred"}function rt(){return typeof window<"u"&&typeof document<"u"}function $({task:o,message:e,onStart:i,onEnd:l}){return async c=>{i?.();const n=await p.taskToValidation({task:o!=null?()=>o(c):async()=>null,errorMessage:e,errorPath:["root"],validation:m=>m!=null?p.a.invalid({message:m}):p.a.valid});return l?.(),n}}function z(o=B){let e=g.string();return o.minLength&&(e=e.min(o.minLength,`Password must be at least ${o.minLength} characters`)),o.requireUppercase&&(e=e.regex(/[A-Z]/,"Password must contain at least one uppercase letter")),o.requireLowercase&&(e=e.regex(/[a-z]/,"Password must contain at least one lowercase letter")),o.requireNumbers&&(e=e.regex(/[0-9]/,"Password must contain at least one number")),o.requireSymbols&&(e=e.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,"Password must contain at least one special character")),o.customValidation&&(e=e.refine(i=>o.customValidation(i))),e}const x=g.string().min(1,"Email is required").email("Please enter a valid email address");function E(o){const e=o?z(o):g.string().refine(i=>i.length>0?null:"Password is required");return g.object({email:x,password:e,rememberMe:g.boolean().default(!1)}).schema()}function O(o=B,e){const i=z(o),l=e?.showNameField!==!1,c=e?.showConfirmPassword!==!1,n=e?.showAcceptTermsAndConditions!==!1,m={name:l?g.string().min(1,"Name is required").optional():g.string().optional(),email:x,password:i,confirmPassword:c?g.string().min(1,"Please confirm your password"):g.string(),acceptTerms:n?g.boolean().refine(r=>r===!0,"You must accept the terms and conditions"):g.boolean().default(!0)},a=g.object(m);return c?a.refine(r=>r.password===r.confirmPassword?null:"Passwords don't match",{path:["confirmPassword"]}).schema():a.schema()}const R=g.object({email:x}).schema(),st=E(),it=O(),ct={signIn:E,signUp:O,resetPassword:()=>R};function lt(o){const e=x.validate(o);return e.success?null:e.errors[0]?.message||"Invalid email"}function mt(o,e=B){const l=z(e).validate(o);return l.success?null:l.errors[0]?.message||"Invalid password"}function U(o,e=B){const i={length:o.length>=(e.minLength||8),uppercase:/[A-Z]/.test(o),lowercase:/[a-z]/.test(o),numbers:/[0-9]/.test(o),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(o),custom:e.customValidation?e.customValidation(o)===null:o.length>0},l=[!0,e.requireUppercase,e.requireLowercase,e.requireNumbers,e.requireSymbols,!!e.customValidation].filter(Boolean).length,c=[i.length,e.requireUppercase?i.uppercase:null,e.requireLowercase?i.lowercase:null,e.requireNumbers?i.numbers:null,e.requireSymbols?i.symbols:null,e.customValidation?i.custom:null].filter(a=>a===!0).length,n=l>0?Math.round(c/l*100):0;let m;return n<40?m="weak":n<60?m="fair":n<80?m="good":m="strong",{strength:m,score:n,checks:i}}const M=()=>t.localStorageProp({key:"bui_auth_email",defaultValue:null});function G({onSignIn:o,passwordRules:e,labels:i,showRememberMe:l}){const c=t.prop(!1),n=M(),m=E(e),a=p.useForm({schema:m,onSubmit:$({task:o,message:"Reset password failed",onStart:()=>{c.set(!0),a.controller.disable()},onEnd:()=>{c.set(!1),a.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:r,submit:s}=a;c.on(r.setDisabled);const h=r.field("email"),f=r.field("password");return n.on(b=>{b!=null&&h.change(b)}),h.signal.on(b=>{n.value!=null&&(n.value=b)}),t.Use(y.AuthI18n,b=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(s),p.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(r.error,L=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(L))),p.Control(P.EmailInput,{controller:h,label:t.coalesce(i?.emailLabel,b.$.emailLabel)}),p.Control(P.PasswordInput,{controller:f,label:t.coalesce(i?.passwordLabel,b.$.passwordLabel)}),t.When(l??!0,()=>t.html.div(t.attr.class("bc-auth-form__remember-me"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),p.CheckboxInput({value:n.map(L=>L!=null),after:t.html.span(t.coalesce(i?.rememberMeLabel,b.$.rememberMeLabel)),onChange:L=>{L?n.value=h.signal.value??"":n.value=null}}))))),q.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:r.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(i?.signInButton,b.$.signInButton))))}function j({password:o,rules:e=B,showLabel:i=!0,className:l}){const c=t.computedOf(o)(s=>!s||s.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:U(s,e)),n=c.map(s=>s.strength),m=c.map(s=>s.score),a=c.map(s=>s.checks),r=t.computedOf(n,l)((s,h)=>["bc-password-strength",`bc-password-strength--${s}`,h].filter(Boolean).join(" "));return t.html.div(t.attr.class(r),t.html.div(t.attr.class("bc-password-strength__bar"),t.html.div(t.attr.class("bc-password-strength__fill"),t.attr.style(m.map(s=>`width: ${s}%`)))),t.When(i,()=>t.Use(y.AuthI18n,s=>t.html.div(t.attr.class("bc-password-strength__label"),t.computedOf(n,s)((h,f)=>{switch(h){case"weak":return f.passwordStrengthWeak;case"fair":return f.passwordStrengthFair;case"good":return f.passwordStrengthGood;case"strong":return f.passwordStrengthStrong;default:return f.passwordStrengthWeak}})))),t.html.div(t.attr.class("bc-password-strength__requirements"),t.When(e.minLength!==void 0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.length?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.length?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),`At least ${e.minLength} characters`))),t.When(e.requireUppercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.uppercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.uppercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),t.When(e.requireLowercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.lowercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.lowercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),t.When(e.requireNumbers===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.numbers?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.numbers?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One number"))),t.When(e.requireSymbols===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.symbols?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.symbols?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function ut({password:o,rules:e=B,className:i}){const l=t.computedOf(o)(a=>!a||a.length===0?{strength:"weak",score:0}:U(a,e)),c=l.map(a=>a.strength),n=l.map(a=>a.score),m=t.computedOf(c,i)((a,r)=>["bc-password-strength-bar",`bc-password-strength-bar--${a}`,r].filter(Boolean).join(" "));return t.html.div(t.attr.class(m),t.html.div(t.attr.class("bc-password-strength-bar__fill"),t.attr.style(n.map(a=>`width: ${a}%`))))}function dt({password:o,rules:e=B,className:i}){const l=t.computedOf(o)(n=>!n||n.length===0?"weak":U(n,e).strength),c=t.computedOf(l,i)((n,m)=>["bc-password-strength-text",`bc-password-strength-text--${n}`,m].filter(Boolean).join(" "));return t.Fragment(t.Use(y.AuthI18n,n=>t.html.span(t.attr.class(c),t.computedOf(l,n)((m,a)=>{switch(m){case"weak":return a.passwordStrengthWeak;case"fair":return a.passwordStrengthFair;case"good":return a.passwordStrengthGood;case"strong":return a.passwordStrengthStrong;default:return a.passwordStrengthWeak}}))))}function H({passwordRules:o,labels:e,initialEmail:i,initialName:l,showPasswordStrength:c,onSignUp:n,showNameField:m,showConfirmPassword:a,showAcceptTermsAndConditions:r,termsAndConditions:s}){const h=t.prop(!1),f=o||B,b=O(f,{showNameField:m!==!1,showConfirmPassword:a!==!1,showAcceptTermsAndConditions:r!==!1}),L=p.useForm({schema:b,onSubmit:$({task:n!=null?_=>n({email:_.email,password:_.password,name:_.name,acceptTerms:_.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{h.set(!0),L.controller.disable()},onEnd:()=>{h.set(!1),L.controller.enable()}}),initialValue:{name:l??"",email:i??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:k,submit:I}=L;h.on(k.setDisabled);const v=k.field("name"),A=k.field("email"),C=k.field("password"),W=k.field("confirmPassword"),S=k.field("acceptTerms");return t.Use(y.AuthI18n,_=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(I),p.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(k.error,w=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(w))),t.When(m!==!1,()=>p.Control(q.TextInput,{controller:v.transform(w=>w??"",w=>w===""?void 0:w),label:t.coalesce(e?.nameLabel,_.$.nameLabel)})),p.Control(P.EmailInput,{controller:A,label:t.coalesce(e?.emailLabel,_.$.emailLabel)}),p.Control(P.PasswordInput,{controller:C,label:t.coalesce(e?.passwordLabel,_.$.passwordLabel)}),t.When(c??!1,()=>j({password:C.signal,rules:f,showLabel:!0})),t.When(a??!1,()=>p.Control(P.PasswordInput,{controller:W,label:t.coalesce(e?.confirmPasswordLabel,_.$.confirmPasswordLabel)})),t.When(r??!1,()=>t.html.div(t.attr.class("bc-auth-form__terms"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),p.CheckboxInput({value:S.signal.map(w=>w??!1),onChange:w=>S.change(w)}),t.html.span(s||t.coalesce(e?.acceptTermsLabel,_.$.acceptTermsLabel))),t.When(S.errorVisible,()=>t.html.div(t.attr.class("bc-auth-form__field-error"),S.error.map(w=>w||"")))))),q.Button({type:"submit",variant:"filled",color:"primary",loading:h,disabled:k.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(e?.signUpButton,_.$.signUpButton))))}function X({onResetPassword:o,labels:e={}}){const i=M(),l=t.prop(!1),c=p.useForm({schema:R,onSubmit:$({task:o,message:"Reset password failed",onStart:()=>{l.set(!0),c.controller.disable()},onEnd:()=>{l.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:n,submit:m}=c;l.on(n.setDisabled);const a=n.field("email");return i.on(r=>{r!=null&&a.change(r)}),t.Use(y.AuthI18n,r=>t.html.form(t.attr.class("bc-auth-form__form"),t.Ensure(n.error,s=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(s))),t.html.p(t.attr.class("bc-auth-form__description"),t.coalesce(e?.resetPasswordDescription,r.$.resetPasswordDescription)),t.on.submit(m),p.Stack(t.attr.class("bc-auth-form__fields"),p.Control(P.EmailInput,{controller:a,label:t.coalesce(e?.emailLabel,r.$.emailLabel)})),q.Button({loading:l,type:"submit",variant:"filled",color:"primary",disabled:n.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(e?.resetPasswordButton,r.$.resetPasswordButton))))}function d({provider:o,onClick:e,size:i="md",name:l,icon:c,color:n,flow:m,labels:a}){const r=async()=>{if(e)try{m==="popup"?await e():await e()}catch(s){console.error(`Social login error for ${o} (${m||"redirect"} flow):`,s)}};return q.Button({type:"button",variant:"filled",size:i,color:n,onClick:r,roundedness:"full"},t.attr.class("bc-social-login-button"),t.attr.class(t.computedOf(o)(s=>`bc-social-login-button--${s}`)),t.html.span(t.attr.class("bc-social-login-button__inner"),t.html.span(t.attr.class("bc-social-login-button__icon"),q.Icon({icon:c,size:i},t.attr.class("bc-social-login-button__icon-inner"))),t.Use(y.AuthI18n,s=>t.html.span(t.attr.class("bc-social-login-button__label"),t.bind(t.coalesce(a?.continueWithProvider,s.$.continueWithProvider))(l)))))}function Y({providers:o,onProviderClick:e,size:i="md",className:l}){return p.Stack(t.attr.class("bc-social-login-buttons"),t.attr.class(l),t.ForEach(o,c=>d({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:n})=>u[n].color),name:c.map(({provider:n})=>u[n].name),icon:c.map(({provider:n})=>u[n].icon),onClick:async()=>{e&&await e(c.$.provider.value)},size:i})))}const u={google:{name:"Google",icon:"logos:google-icon",color:"red"},github:{name:"GitHub",icon:"logos:github-icon",color:"black"},apple:{name:"Apple",icon:"logos:apple",color:"stone"},facebook:{name:"Facebook",icon:"logos:facebook",color:"blue"},twitter:{name:"Twitter",icon:"logos:twitter",color:"sky"},x:{name:"X",icon:"logos:x",color:"zinc"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"amber"},discord:{name:"Discord",icon:"logos:discord-icon",color:"indigo"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"cyan"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"fuchsia"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"teal"},snapchat:{name:"Snapchat",icon:"streamline-logos:snapchat-logo-solid",color:"yellow"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"orange"},pinterest:{name:"Pinterest",icon:"logos:pinterest",color:"rose"},twitch:{name:"Twitch",icon:"logos:twitch",color:"purple"},steam:{name:"Steam",icon:"logos:steam",color:"slate"},epic:{name:"Epic Games",icon:"streamline-logos:epic-games-logo-solid",color:"neutral"},playstation:{name:"PlayStation",icon:"streamline-logos:playstation-logo-solid",color:"violet"},xbox:{name:"Xbox",icon:"streamline-logos:xbox-live-logo-solid",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"streamline-logos:wechat-logo",color:"lime"},amazon:{name:"Amazon",icon:"streamline-logos:amazon-logo-solid",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},pt=o=>d({...o,...u.google,provider:"google"}),ht=o=>d({...o,...u.github,provider:"github"}),gt=o=>d({...o,...u.apple,provider:"apple"}),ft=o=>d({...o,...u.facebook,provider:"facebook"}),bt=o=>d({...o,...u.x,provider:"x"}),wt=o=>d({...o,...u.twitter,provider:"twitter"}),Lt=o=>d({...o,...u.microsoft,provider:"microsoft"}),_t=o=>d({...o,...u.discord,provider:"discord"}),kt=o=>d({...o,...u.linkedin,provider:"linkedin"}),vt=o=>d({...o,...u.instagram,provider:"instagram"}),St=o=>d({...o,...u.tiktok,provider:"tiktok"}),Pt=o=>d({...o,...u.snapchat,provider:"snapchat"}),yt=o=>d({...o,...u.reddit,provider:"reddit"}),Bt=o=>d({...o,...u.pinterest,provider:"pinterest"}),It=o=>d({...o,...u.twitch,provider:"twitch"}),qt=o=>d({...o,...u.steam,provider:"steam"}),xt=o=>d({...o,...u.epic,provider:"epic"}),At=o=>d({...o,...u.playstation,provider:"playstation"}),Ct=o=>d({...o,...u.xbox,provider:"xbox"}),Tt=o=>d({...o,...u.whatsapp,provider:"whatsapp"}),$t=o=>d({...o,...u.wechat,provider:"wechat"}),zt=o=>d({...o,...u.amazon,provider:"amazon"}),Et=o=>d({...o,...u.yahoo,provider:"yahoo"}),Ot=o=>d({...o,...u.paypal,provider:"paypal"});function F({providers:o}){return p.Stack(Y({providers:o}))}function Z({mode:o,socialProviders:e,initialName:i,initialEmail:l,passwordRules:c,showRememberMe:n,showSocialDivider:m,showPasswordStrength:a,labels:r,onSignIn:s,onSignUp:h,onResetPassword:f,onModeChange:b,showContainer:L},...k){const I=o!=null?t.Value.deriveProp(o):t.prop("signin");return I.on(v=>b?.(v)),t.Use(y.AuthI18n,v=>{function A(){const S=t.coalesce(r?.hasAccountLink,v.$.hasAccountLink);return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>I.set("signin")),S)}function C(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>I.set("signup")),t.coalesce(r?.noAccountLink,v.$.noAccountLink))}function W(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>I.set("reset-password")),t.coalesce(r?.forgotPasswordLink,v.$.forgotPasswordLink))}return t.html.div(J.classes({"bc-auth-container":!0,"bc-auth-container--styled":t.Value.map(L??!0,S=>S)}),t.attr.class(I.map(S=>`bc-auth-container--${S}`)),t.attr.class("bc-auth-form"),t.OneOfValue(I,{signin:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signInTitle,v.$.signInTitle)),e!=null?t.Fragment(F({providers:e}),t.When(m??!1,V)):null,G({onSignIn:s,showRememberMe:n,passwordRules:c,labels:{emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,rememberMeLabel:r?.rememberMeLabel,signInButton:r?.signInButton,forgotPasswordLink:r?.forgotPasswordLink,noAccountLink:r?.noAccountLink}}),p.Stack(t.attr.class("bc-auth-form__footer"),C(),W())),signup:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signUpTitle,v.$.signUpTitle)),e!=null?t.Fragment(F({providers:e}),t.When(m??!1,V)):null,H({labels:{nameLabel:r?.nameLabel,emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,confirmPasswordLabel:r?.confirmPasswordLabel,acceptTermsLabel:r?.acceptTermsLabel,signUpButton:r?.signUpButton,hasAccountLink:r?.hasAccountLink},initialEmail:l,initialName:i,onSignUp:h,passwordRules:c,showPasswordStrength:a}),p.Stack(t.attr.class("bc-auth-form__footer"),A())),"reset-password":()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.resetPasswordTitle,v.$.resetPasswordTitle)),X({labels:{backToSignInLink:r?.backToSignInLink,emailLabel:r?.emailLabel,resetPasswordButton:r?.resetPasswordButton,resetPasswordDescription:r?.resetPasswordDescription},onResetPassword:f}),p.Stack(t.attr.class("bc-auth-form__footer"),A()))}),...k)})}function Ut(o){return g.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(e,i)=>o(l=>e({body:Z({showContainer:!1,...l}),header:t.Use(y.AuthI18n,c=>t.coalesce(l.modalTitle,c.$.authenticationTitle))})))}function V({labels:o,className:e}={}){return t.html.div(t.attr.class("bc-auth-divider"),t.attr.class(e),t.html.div(t.attr.class("bc-auth-divider__line")),t.Use(y.AuthI18n,i=>t.html.span(t.attr.class("bc-auth-divider__text"),t.coalesce(o?.text,i.$.orDivider))),t.html.div(t.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=zt;exports.AppleLoginButton=gt;exports.AuthContainer=Z;exports.AuthDivider=V;exports.AuthModal=Ut;exports.DiscordLoginButton=_t;exports.EpicLoginButton=xt;exports.FacebookLoginButton=ft;exports.GitHubLoginButton=ht;exports.GoogleLoginButton=pt;exports.InstagramLoginButton=vt;exports.LinkedInLoginButton=kt;exports.MicrosoftLoginButton=Lt;exports.PasswordStrengthBar=ut;exports.PasswordStrengthIndicator=j;exports.PasswordStrengthText=dt;exports.PayPalLoginButton=Ot;exports.PinterestLoginButton=Bt;exports.PlayStationLoginButton=At;exports.RedditLoginButton=yt;exports.ResetPasswordForm=X;exports.SignInForm=G;exports.SignUpForm=H;exports.SnapchatLoginButton=Pt;exports.SocialLoginButton=d;exports.SocialLoginButtons=Y;exports.SocialProviders=F;exports.SteamLoginButton=qt;exports.TiktokLoginButton=St;exports.TwitchLoginButton=It;exports.TwitterLoginButton=wt;exports.WeChatLoginButton=$t;exports.WhatsAppLoginButton=Tt;exports.XLoginButtin=bt;exports.XboxLoginButton=Ct;exports.YahooLoginButton=Et;exports.authSchemas=ct;exports.calculatePasswordStrength=U;exports.createPasswordSchema=z;exports.createSignInSchema=E;exports.createSignUpSchema=O;exports.createSocialLoginUrl=et;exports.defaultPasswordRules=B;exports.defaultSignInSchema=st;exports.defaultSignUpSchema=it;exports.emailSchema=x;exports.formatAuthError=nt;exports.formatProviderName=N;exports.formatSocialLoginText=tt;exports.generateRandomString=D;exports.getProviderColor=Q;exports.getProviderIcon=K;exports.isBrowser=rt;exports.isValidEmail=ot;exports.openSocialLoginPopup=at;exports.providerInfo=T;exports.requestToControllerValidation=$;exports.resetPasswordSchema=R;exports.socialProviderInfo=u;exports.useAuthEmailProp=M;exports.validateEmail=lt;exports.validatePassword=mt;
@@ -1,8 +1,9 @@
1
1
  import { localStorageProp as ie, prop as V, Use as x, html as i, attr as t, on as z, When as b, coalesce as h, Ensure as D, computedOf as g, Fragment as C, bind as ce, ForEach as le, Value as ee, OneOfValue as me } from "@tempots/dom";
2
- import { t as ue, a as oe, u as W, S as $, b as se, c as T, P as N, E as G, N as H } from "../notice-Um1LwKBF.js";
3
- import { s as A, o as j, b as R, M as de } from "../modal-DJWj5M5e.js";
4
- import { AuthI18n as q } from "../translations-zGwuSQWQ.js";
5
- import { B as F, T as pe, I as he } from "../translations-BUTBIDsS.js";
2
+ import { t as ue, a as oe, u as W, S as $, b as se, c as I } from "../use-form-B7A865EM.js";
3
+ import { s as A, o as G, b as N, M as de } from "../modal-MofsfmAe.js";
4
+ import { AuthI18n as q } from "../translations-BmsRhth7.js";
5
+ import { P as R, E as H, N as j } from "../notice-Cqq8g17n.js";
6
+ import { B as F, T as pe, c as he } from "../translations-DQxouiBG.js";
6
7
  import { classes as ge } from "@tempots/ui";
7
8
  const X = {
8
9
  google: { name: "Google", icon: "logos:google-icon", color: "#4285f4" },
@@ -56,20 +57,20 @@ function fe(e) {
56
57
  function Ie(e) {
57
58
  return X[e]?.icon || "mdi:account";
58
59
  }
59
- function Te(e) {
60
+ function Ae(e) {
60
61
  return X[e]?.color || "#666";
61
62
  }
62
- function Ae(e, o = "Continue with {provider}") {
63
+ function Ce(e, o = "Continue with {provider}") {
63
64
  return o.replace("{provider}", fe(e));
64
65
  }
65
- const I = {
66
+ const T = {
66
67
  minLength: 8,
67
68
  requireUppercase: !0,
68
69
  requireLowercase: !0,
69
70
  requireNumbers: !0,
70
71
  requireSymbols: !1
71
72
  };
72
- function Ce(e) {
73
+ function ze(e) {
73
74
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
74
75
  }
75
76
  function be(e = 32) {
@@ -79,7 +80,7 @@ function be(e = 32) {
79
80
  c += o.charAt(Math.floor(Math.random() * o.length));
80
81
  return c;
81
82
  }
82
- function ze(e, o, c, m = [], l = {}) {
83
+ function Ee(e, o, c, m = [], l = {}) {
83
84
  const s = {
84
85
  google: "https://accounts.google.com/oauth/authorize",
85
86
  github: "https://github.com/login/oauth/authorize",
@@ -143,7 +144,7 @@ function ze(e, o, c, m = [], l = {}) {
143
144
  });
144
145
  return `${n}?${f.toString()}`;
145
146
  }
146
- function Ee(e, o, c, m) {
147
+ function Ue(e, o, c, m) {
147
148
  const l = window.open(
148
149
  e,
149
150
  `${o}_login`,
@@ -160,10 +161,10 @@ function Ee(e, o, c, m) {
160
161
  };
161
162
  window.addEventListener("message", u);
162
163
  }
163
- function Ue(e) {
164
+ function Ve(e) {
164
165
  return e instanceof Error ? e.message : typeof e == "string" ? e : e && typeof e == "object" && "message" in e ? String(e.message) : "An unexpected error occurred";
165
166
  }
166
- function Ve() {
167
+ function Fe() {
167
168
  return typeof window < "u" && typeof document < "u";
168
169
  }
169
170
  function Y({
@@ -183,7 +184,7 @@ function Y({
183
184
  return m?.(), s;
184
185
  };
185
186
  }
186
- function Z(e = I) {
187
+ function Z(e = T) {
187
188
  let o = A();
188
189
  return e.minLength && (o = o.min(
189
190
  e.minLength,
@@ -207,13 +208,13 @@ function J(e) {
207
208
  const o = e ? Z(e) : A().refine(
208
209
  (c) => c.length > 0 ? null : "Password is required"
209
210
  );
210
- return j({
211
+ return G({
211
212
  email: M,
212
213
  password: o,
213
- rememberMe: R().default(!1)
214
+ rememberMe: N().default(!1)
214
215
  }).schema();
215
216
  }
216
- function K(e = I, o) {
217
+ function K(e = T, o) {
217
218
  const c = Z(e), m = o?.showNameField !== !1, l = o?.showConfirmPassword !== !1, s = o?.showAcceptTermsAndConditions !== !1, u = {
218
219
  name: m ? A().min(1, "Name is required").optional() : A().optional(),
219
220
  email: M,
@@ -222,33 +223,33 @@ function K(e = I, o) {
222
223
  // When not shown, it should accept any value (including empty string)
223
224
  confirmPassword: l ? A().min(1, "Please confirm your password") : A(),
224
225
  // Accept any string value when not shown
225
- acceptTerms: s ? R().refine(
226
+ acceptTerms: s ? N().refine(
226
227
  (r) => r === !0,
227
228
  "You must accept the terms and conditions"
228
- ) : R().default(!0)
229
+ ) : N().default(!0)
229
230
  // Default to true when not shown
230
- }, n = j(u);
231
+ }, n = G(u);
231
232
  return l ? n.refine(
232
233
  (r) => r.password === r.confirmPassword ? null : "Passwords don't match",
233
234
  { path: ["confirmPassword"] }
234
235
  ).schema() : n.schema();
235
236
  }
236
- const ae = j({
237
+ const ae = G({
237
238
  email: M
238
- }).schema(), Fe = J(), Me = K(), Oe = {
239
+ }).schema(), Me = J(), Oe = K(), Ne = {
239
240
  signIn: J,
240
241
  signUp: K,
241
242
  resetPassword: () => ae
242
243
  };
243
- function Ne(e) {
244
+ function Re(e) {
244
245
  const o = M.validate(e);
245
246
  return o.success ? null : o.errors[0]?.message || "Invalid email";
246
247
  }
247
- function Re(e, o = I) {
248
+ function De(e, o = T) {
248
249
  const m = Z(o).validate(e);
249
250
  return m.success ? null : m.errors[0]?.message || "Invalid password";
250
251
  }
251
- function Q(e, o = I) {
252
+ function Q(e, o = T) {
252
253
  const c = {
253
254
  length: e.length >= (o.minLength || 8),
254
255
  uppercase: /[A-Z]/.test(e),
@@ -320,18 +321,18 @@ function we({
320
321
  t.class("bc-auth-form__fields"),
321
322
  D(
322
323
  r.error,
323
- (k) => H(
324
+ (k) => j(
324
325
  { variant: "danger", tone: "prominent", role: "alert" },
325
326
  i.div(k)
326
327
  )
327
328
  ),
328
329
  // Email field
329
- T(G, {
330
+ I(H, {
330
331
  controller: f,
331
332
  label: h(c?.emailLabel, _.$.emailLabel)
332
333
  }),
333
334
  // Password field
334
- T(N, {
335
+ I(R, {
335
336
  controller: w,
336
337
  label: h(c?.passwordLabel, _.$.passwordLabel)
337
338
  }),
@@ -373,7 +374,7 @@ function we({
373
374
  }
374
375
  function _e({
375
376
  password: e,
376
- rules: o = I,
377
+ rules: o = T,
377
378
  showLabel: c = !0,
378
379
  className: m
379
380
  }) {
@@ -539,9 +540,9 @@ function _e({
539
540
  )
540
541
  );
541
542
  }
542
- function De({
543
+ function We({
543
544
  password: e,
544
- rules: o = I,
545
+ rules: o = T,
545
546
  className: c
546
547
  }) {
547
548
  const m = g(e)((n) => !n || n.length === 0 ? { strength: "weak", score: 0 } : Q(n, o)), l = m.map((n) => n.strength), s = m.map((n) => n.score), u = g(
@@ -560,9 +561,9 @@ function De({
560
561
  )
561
562
  );
562
563
  }
563
- function We({
564
+ function Ge({
564
565
  password: e,
565
- rules: o = I,
566
+ rules: o = T,
566
567
  className: c
567
568
  }) {
568
569
  const m = g(e)((s) => !s || s.length === 0 ? "weak" : Q(s, o).strength), l = g(
@@ -611,7 +612,7 @@ function Le({
611
612
  showAcceptTermsAndConditions: r,
612
613
  termsAndConditions: a
613
614
  }) {
614
- const f = V(!1), w = e || I, _ = K(w, {
615
+ const f = V(!1), w = e || T, _ = K(w, {
615
616
  showNameField: u !== !1,
616
617
  showConfirmPassword: n !== !1,
617
618
  showAcceptTermsAndConditions: r !== !1
@@ -653,7 +654,7 @@ function Le({
653
654
  t.class("bc-auth-form__fields"),
654
655
  D(
655
656
  y.error,
656
- (L) => H(
657
+ (L) => j(
657
658
  { variant: "danger", tone: "prominent", role: "alert" },
658
659
  i.div(L)
659
660
  )
@@ -661,7 +662,7 @@ function Le({
661
662
  // Name field (optional)
662
663
  b(
663
664
  u !== !1,
664
- () => T(pe, {
665
+ () => I(pe, {
665
666
  controller: S.transform(
666
667
  (L) => L ?? "",
667
668
  (L) => L === "" ? void 0 : L
@@ -670,12 +671,12 @@ function Le({
670
671
  })
671
672
  ),
672
673
  // Email field
673
- T(G, {
674
+ I(H, {
674
675
  controller: E,
675
676
  label: h(o?.emailLabel, v.$.emailLabel)
676
677
  }),
677
678
  // Password field
678
- T(N, {
679
+ I(R, {
679
680
  controller: U,
680
681
  label: h(o?.passwordLabel, v.$.passwordLabel)
681
682
  }),
@@ -691,7 +692,7 @@ function Le({
691
692
  // Confirm password field
692
693
  b(
693
694
  n ?? !1,
694
- () => T(N, {
695
+ () => I(R, {
695
696
  controller: O,
696
697
  label: h(
697
698
  o?.confirmPasswordLabel,
@@ -772,7 +773,7 @@ function ke({
772
773
  t.class("bc-auth-form__form"),
773
774
  D(
774
775
  s.error,
775
- (a) => H(
776
+ (a) => j(
776
777
  { variant: "danger", tone: "prominent", role: "alert" },
777
778
  i.div(a)
778
779
  )
@@ -786,7 +787,7 @@ function ke({
786
787
  $(
787
788
  t.class("bc-auth-form__fields"),
788
789
  // Email field
789
- T(G, {
790
+ I(H, {
790
791
  controller: n,
791
792
  label: h(o?.emailLabel, r.$.emailLabel)
792
793
  })
@@ -1016,99 +1017,99 @@ const d = {
1016
1017
  color: "blue"
1017
1018
  // distinct deep blue tone (not Facebook’s exact blue)
1018
1019
  }
1019
- }, Ge = (e) => p({
1020
+ }, He = (e) => p({
1020
1021
  ...e,
1021
1022
  ...d.google,
1022
1023
  provider: "google"
1023
- }), He = (e) => p({
1024
+ }), je = (e) => p({
1024
1025
  ...e,
1025
1026
  ...d.github,
1026
1027
  provider: "github"
1027
- }), je = (e) => p({
1028
+ }), Xe = (e) => p({
1028
1029
  ...e,
1029
1030
  ...d.apple,
1030
1031
  provider: "apple"
1031
- }), Xe = (e) => p({
1032
+ }), Ye = (e) => p({
1032
1033
  ...e,
1033
1034
  ...d.facebook,
1034
1035
  provider: "facebook"
1035
- }), Ye = (e) => p({
1036
+ }), Ze = (e) => p({
1036
1037
  ...e,
1037
1038
  ...d.x,
1038
1039
  provider: "x"
1039
- }), Ze = (e) => p({
1040
+ }), Je = (e) => p({
1040
1041
  ...e,
1041
1042
  ...d.twitter,
1042
1043
  provider: "twitter"
1043
- }), Je = (e) => p({
1044
+ }), Ke = (e) => p({
1044
1045
  ...e,
1045
1046
  ...d.microsoft,
1046
1047
  provider: "microsoft"
1047
- }), Ke = (e) => p({
1048
+ }), Qe = (e) => p({
1048
1049
  ...e,
1049
1050
  ...d.discord,
1050
1051
  provider: "discord"
1051
- }), Qe = (e) => p({
1052
+ }), eo = (e) => p({
1052
1053
  ...e,
1053
1054
  ...d.linkedin,
1054
1055
  provider: "linkedin"
1055
- }), eo = (e) => p({
1056
+ }), oo = (e) => p({
1056
1057
  ...e,
1057
1058
  ...d.instagram,
1058
1059
  provider: "instagram"
1059
- }), oo = (e) => p({
1060
+ }), to = (e) => p({
1060
1061
  ...e,
1061
1062
  ...d.tiktok,
1062
1063
  provider: "tiktok"
1063
- }), to = (e) => p({
1064
+ }), no = (e) => p({
1064
1065
  ...e,
1065
1066
  ...d.snapchat,
1066
1067
  provider: "snapchat"
1067
- }), no = (e) => p({
1068
+ }), so = (e) => p({
1068
1069
  ...e,
1069
1070
  ...d.reddit,
1070
1071
  provider: "reddit"
1071
- }), so = (e) => p({
1072
+ }), ao = (e) => p({
1072
1073
  ...e,
1073
1074
  ...d.pinterest,
1074
1075
  provider: "pinterest"
1075
- }), ao = (e) => p({
1076
+ }), ro = (e) => p({
1076
1077
  ...e,
1077
1078
  ...d.twitch,
1078
1079
  provider: "twitch"
1079
- }), ro = (e) => p({
1080
+ }), io = (e) => p({
1080
1081
  ...e,
1081
1082
  ...d.steam,
1082
1083
  provider: "steam"
1083
- }), io = (e) => p({
1084
+ }), co = (e) => p({
1084
1085
  ...e,
1085
1086
  ...d.epic,
1086
1087
  provider: "epic"
1087
- }), co = (e) => p({
1088
+ }), lo = (e) => p({
1088
1089
  ...e,
1089
1090
  ...d.playstation,
1090
1091
  provider: "playstation"
1091
- }), lo = (e) => p({
1092
+ }), mo = (e) => p({
1092
1093
  ...e,
1093
1094
  ...d.xbox,
1094
1095
  provider: "xbox"
1095
- }), mo = (e) => p({
1096
+ }), uo = (e) => p({
1096
1097
  ...e,
1097
1098
  ...d.whatsapp,
1098
1099
  provider: "whatsapp"
1099
- }), uo = (e) => p({
1100
+ }), po = (e) => p({
1100
1101
  ...e,
1101
1102
  ...d.wechat,
1102
1103
  provider: "wechat"
1103
- }), po = (e) => p({
1104
+ }), ho = (e) => p({
1104
1105
  ...e,
1105
1106
  ...d.amazon,
1106
1107
  provider: "amazon"
1107
- }), ho = (e) => p({
1108
+ }), go = (e) => p({
1108
1109
  ...e,
1109
1110
  ...d.yahoo,
1110
1111
  provider: "yahoo"
1111
- }), go = (e) => p({
1112
+ }), fo = (e) => p({
1112
1113
  ...e,
1113
1114
  ...d.paypal,
1114
1115
  provider: "paypal"
@@ -1248,7 +1249,7 @@ function ye({
1248
1249
  );
1249
1250
  });
1250
1251
  }
1251
- function fo(e) {
1252
+ function bo(e) {
1252
1253
  return de(
1253
1254
  {
1254
1255
  size: "sm",
@@ -1285,66 +1286,66 @@ function ne({
1285
1286
  );
1286
1287
  }
1287
1288
  export {
1288
- po as AmazonLoginButton,
1289
- je as AppleLoginButton,
1289
+ ho as AmazonLoginButton,
1290
+ Xe as AppleLoginButton,
1290
1291
  ye as AuthContainer,
1291
1292
  ne as AuthDivider,
1292
- fo as AuthModal,
1293
- Ke as DiscordLoginButton,
1294
- io as EpicLoginButton,
1295
- Xe as FacebookLoginButton,
1296
- He as GitHubLoginButton,
1297
- Ge as GoogleLoginButton,
1298
- eo as InstagramLoginButton,
1299
- Qe as LinkedInLoginButton,
1300
- Je as MicrosoftLoginButton,
1301
- De as PasswordStrengthBar,
1293
+ bo as AuthModal,
1294
+ Qe as DiscordLoginButton,
1295
+ co as EpicLoginButton,
1296
+ Ye as FacebookLoginButton,
1297
+ je as GitHubLoginButton,
1298
+ He as GoogleLoginButton,
1299
+ oo as InstagramLoginButton,
1300
+ eo as LinkedInLoginButton,
1301
+ Ke as MicrosoftLoginButton,
1302
+ We as PasswordStrengthBar,
1302
1303
  _e as PasswordStrengthIndicator,
1303
- We as PasswordStrengthText,
1304
- go as PayPalLoginButton,
1305
- so as PinterestLoginButton,
1306
- co as PlayStationLoginButton,
1307
- no as RedditLoginButton,
1304
+ Ge as PasswordStrengthText,
1305
+ fo as PayPalLoginButton,
1306
+ ao as PinterestLoginButton,
1307
+ lo as PlayStationLoginButton,
1308
+ so as RedditLoginButton,
1308
1309
  ke as ResetPasswordForm,
1309
1310
  we as SignInForm,
1310
1311
  Le as SignUpForm,
1311
- to as SnapchatLoginButton,
1312
+ no as SnapchatLoginButton,
1312
1313
  p as SocialLoginButton,
1313
1314
  ve as SocialLoginButtons,
1314
1315
  te as SocialProviders,
1315
- ro as SteamLoginButton,
1316
- oo as TiktokLoginButton,
1317
- ao as TwitchLoginButton,
1318
- Ze as TwitterLoginButton,
1319
- uo as WeChatLoginButton,
1320
- mo as WhatsAppLoginButton,
1321
- Ye as XLoginButtin,
1322
- lo as XboxLoginButton,
1323
- ho as YahooLoginButton,
1324
- Oe as authSchemas,
1316
+ io as SteamLoginButton,
1317
+ to as TiktokLoginButton,
1318
+ ro as TwitchLoginButton,
1319
+ Je as TwitterLoginButton,
1320
+ po as WeChatLoginButton,
1321
+ uo as WhatsAppLoginButton,
1322
+ Ze as XLoginButtin,
1323
+ mo as XboxLoginButton,
1324
+ go as YahooLoginButton,
1325
+ Ne as authSchemas,
1325
1326
  Q as calculatePasswordStrength,
1326
1327
  Z as createPasswordSchema,
1327
1328
  J as createSignInSchema,
1328
1329
  K as createSignUpSchema,
1329
- ze as createSocialLoginUrl,
1330
- I as defaultPasswordRules,
1331
- Fe as defaultSignInSchema,
1332
- Me as defaultSignUpSchema,
1330
+ Ee as createSocialLoginUrl,
1331
+ T as defaultPasswordRules,
1332
+ Me as defaultSignInSchema,
1333
+ Oe as defaultSignUpSchema,
1333
1334
  M as emailSchema,
1334
- Ue as formatAuthError,
1335
+ Ve as formatAuthError,
1335
1336
  fe as formatProviderName,
1336
- Ae as formatSocialLoginText,
1337
+ Ce as formatSocialLoginText,
1337
1338
  be as generateRandomString,
1338
- Te as getProviderColor,
1339
+ Ae as getProviderColor,
1339
1340
  Ie as getProviderIcon,
1340
- Ve as isBrowser,
1341
- Ce as isValidEmail,
1342
- Ee as openSocialLoginPopup,
1341
+ Fe as isBrowser,
1342
+ ze as isValidEmail,
1343
+ Ue as openSocialLoginPopup,
1343
1344
  X as providerInfo,
1344
1345
  Y as requestToControllerValidation,
1345
1346
  ae as resetPasswordSchema,
1346
1347
  d as socialProviderInfo,
1347
1348
  re as useAuthEmailProp,
1348
- Ne as validateEmail,
1349
- Re as validatePassword
1349
+ Re as validateEmail,
1350
+ De as validatePassword
1350
1351
  };