@tempots/beatui 1.0.1 → 1.1.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 (49) hide show
  1. package/dist/auth/index.cjs.js +1 -1
  2. package/dist/auth/index.es.js +1 -1
  3. package/dist/{auth-divider-MMhfmLBu.cjs → auth-divider-3t_-R0sL.cjs} +1 -1
  4. package/dist/{auth-divider-CbME_yVQ.js → auth-divider-Cp3xGpHr.js} +2 -2
  5. package/dist/beatui.css +32 -7
  6. package/dist/beatui.tailwind.css +32 -7
  7. package/dist/better-auth/index.cjs.js +1 -1
  8. package/dist/better-auth/index.es.js +3 -3
  9. package/dist/{deep-merge-EkjEgK0N.cjs → deep-merge-Bz9HHpRt.cjs} +1 -1
  10. package/dist/{deep-merge-BzIheQtH.js → deep-merge-Da602mAN.js} +1 -1
  11. package/dist/{duration-input-DGzmIImj.js → duration-input-HM1i6RRY.js} +2 -2
  12. package/dist/{duration-input-ClgYjeBa.cjs → duration-input-g-cQ3cs1.cjs} +1 -1
  13. package/dist/index.cjs.js +4 -4
  14. package/dist/index.es.js +5394 -5251
  15. package/dist/json-schema/index.cjs.js +1 -1
  16. package/dist/json-schema/index.es.js +5 -5
  17. package/dist/json-structure/index.cjs.js +1 -1
  18. package/dist/json-structure/index.es.js +3 -3
  19. package/dist/notice-BNghd0oS.cjs +1 -0
  20. package/dist/notice-Dtz7ADVH.js +211 -0
  21. package/dist/prosemirror/index.cjs.js +1 -1
  22. package/dist/prosemirror/index.es.js +1 -1
  23. package/dist/text-input-DL9FvpTZ.cjs +1 -0
  24. package/dist/text-input-dDUEUmlC.js +57 -0
  25. package/dist/types/components/data/data-table-context.d.ts +4 -3
  26. package/dist/types/components/data/data-table-types.d.ts +31 -17
  27. package/dist/types/components/data/data-table.d.ts +3 -3
  28. package/dist/types/components/data/sortable-header.d.ts +4 -2
  29. package/dist/types/components/form/input/color-input.d.ts +3 -1
  30. package/dist/types/components/form/input/input-options.d.ts +3 -1
  31. package/dist/types/components/form/input/nullable-plain-date-input.d.ts +1 -0
  32. package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +1 -0
  33. package/dist/types/components/form/input/nullable-plain-time-input.d.ts +1 -0
  34. package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +1 -0
  35. package/dist/types/components/form/input/plain-date-input.d.ts +1 -0
  36. package/dist/types/components/form/input/plain-date-time-input.d.ts +1 -0
  37. package/dist/types/components/form/input/plain-time-input.d.ts +1 -0
  38. package/dist/types/components/form/input/plain-year-month-input.d.ts +1 -0
  39. package/dist/types/components/form/input/slider-input.d.ts +24 -6
  40. package/dist/types/components/form/input/switch.d.ts +3 -1
  41. package/dist/types/components/overlay/dialogs.d.ts +10 -2
  42. package/dist/widget-customization-DOWmUuPU.cjs +1 -0
  43. package/dist/{widget-customization-DEiQ_31d.js → widget-customization-YhVcA-KM.js} +210 -207
  44. package/package.json +1 -1
  45. package/dist/notice-B5wTXoTq.cjs +0 -1
  46. package/dist/notice-BKcyJD5w.js +0 -209
  47. package/dist/text-input-DfqXolVe.js +0 -55
  48. package/dist/text-input-X_q01NsY.cjs +0 -1
  49. package/dist/widget-customization-B49MeU4E.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../auth-divider-MMhfmLBu.cjs");exports.AmazonLoginButton=o.AmazonLoginButton;exports.AppleLoginButton=o.AppleLoginButton;exports.AuthContainer=o.AuthContainer;exports.AuthDivider=o.AuthDivider;exports.AuthModal=o.AuthModal;exports.DiscordLoginButton=o.DiscordLoginButton;exports.EpicLoginButton=o.EpicLoginButton;exports.FacebookLoginButton=o.FacebookLoginButton;exports.GitHubLoginButton=o.GitHubLoginButton;exports.GoogleLoginButton=o.GoogleLoginButton;exports.InstagramLoginButton=o.InstagramLoginButton;exports.LinkedInLoginButton=o.LinkedInLoginButton;exports.MicrosoftLoginButton=o.MicrosoftLoginButton;exports.PasswordStrengthBar=o.PasswordStrengthBar;exports.PasswordStrengthIndicator=o.PasswordStrengthIndicator;exports.PasswordStrengthText=o.PasswordStrengthText;exports.PayPalLoginButton=o.PayPalLoginButton;exports.PinterestLoginButton=o.PinterestLoginButton;exports.PlayStationLoginButton=o.PlayStationLoginButton;exports.RedditLoginButton=o.RedditLoginButton;exports.ResetPasswordForm=o.ResetPasswordForm;exports.SignInForm=o.SignInForm;exports.SignUpForm=o.SignUpForm;exports.SnapchatLoginButton=o.SnapchatLoginButton;exports.SocialLoginButton=o.SocialLoginButton;exports.SocialLoginButtons=o.SocialLoginButtons;exports.SocialProviders=o.SocialProviders;exports.SteamLoginButton=o.SteamLoginButton;exports.TiktokLoginButton=o.TiktokLoginButton;exports.TwitchLoginButton=o.TwitchLoginButton;exports.TwitterLoginButton=o.TwitterLoginButton;exports.WeChatLoginButton=o.WeChatLoginButton;exports.WhatsAppLoginButton=o.WhatsAppLoginButton;exports.XLoginButtin=o.XLoginButtin;exports.XboxLoginButton=o.XboxLoginButton;exports.YahooLoginButton=o.YahooLoginButton;exports.authSchemas=o.authSchemas;exports.calculatePasswordStrength=o.calculatePasswordStrength;exports.createEmailSchema=o.createEmailSchema;exports.createPasswordSchema=o.createPasswordSchema;exports.createSignInSchema=o.createSignInSchema;exports.createSignUpSchema=o.createSignUpSchema;exports.createSocialLoginUrl=o.createSocialLoginUrl;exports.defaultPasswordRules=o.defaultPasswordRules;exports.defaultSignInSchema=o.defaultSignInSchema;exports.defaultSignUpSchema=o.defaultSignUpSchema;exports.emailSchema=o.emailSchema;exports.formatAuthError=o.formatAuthError;exports.formatProviderName=o.formatProviderName;exports.formatSocialLoginText=o.formatSocialLoginText;exports.generateRandomString=o.generateRandomString;exports.getProviderColor=o.getProviderColor;exports.getProviderIcon=o.getProviderIcon;exports.isBrowser=o.isBrowser;exports.isValidEmail=o.isValidEmail;exports.openSocialLoginPopup=o.openSocialLoginPopup;exports.providerInfo=o.providerInfo;exports.requestToControllerValidation=o.requestToControllerValidation;exports.resetPasswordSchema=o.resetPasswordSchema;exports.socialProviderInfo=o.socialProviderInfo;exports.useAuthEmailProp=o.useAuthEmailProp;exports.validateEmail=o.validateEmail;exports.validatePassword=o.validatePassword;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../auth-divider-3t_-R0sL.cjs");exports.AmazonLoginButton=o.AmazonLoginButton;exports.AppleLoginButton=o.AppleLoginButton;exports.AuthContainer=o.AuthContainer;exports.AuthDivider=o.AuthDivider;exports.AuthModal=o.AuthModal;exports.DiscordLoginButton=o.DiscordLoginButton;exports.EpicLoginButton=o.EpicLoginButton;exports.FacebookLoginButton=o.FacebookLoginButton;exports.GitHubLoginButton=o.GitHubLoginButton;exports.GoogleLoginButton=o.GoogleLoginButton;exports.InstagramLoginButton=o.InstagramLoginButton;exports.LinkedInLoginButton=o.LinkedInLoginButton;exports.MicrosoftLoginButton=o.MicrosoftLoginButton;exports.PasswordStrengthBar=o.PasswordStrengthBar;exports.PasswordStrengthIndicator=o.PasswordStrengthIndicator;exports.PasswordStrengthText=o.PasswordStrengthText;exports.PayPalLoginButton=o.PayPalLoginButton;exports.PinterestLoginButton=o.PinterestLoginButton;exports.PlayStationLoginButton=o.PlayStationLoginButton;exports.RedditLoginButton=o.RedditLoginButton;exports.ResetPasswordForm=o.ResetPasswordForm;exports.SignInForm=o.SignInForm;exports.SignUpForm=o.SignUpForm;exports.SnapchatLoginButton=o.SnapchatLoginButton;exports.SocialLoginButton=o.SocialLoginButton;exports.SocialLoginButtons=o.SocialLoginButtons;exports.SocialProviders=o.SocialProviders;exports.SteamLoginButton=o.SteamLoginButton;exports.TiktokLoginButton=o.TiktokLoginButton;exports.TwitchLoginButton=o.TwitchLoginButton;exports.TwitterLoginButton=o.TwitterLoginButton;exports.WeChatLoginButton=o.WeChatLoginButton;exports.WhatsAppLoginButton=o.WhatsAppLoginButton;exports.XLoginButtin=o.XLoginButtin;exports.XboxLoginButton=o.XboxLoginButton;exports.YahooLoginButton=o.YahooLoginButton;exports.authSchemas=o.authSchemas;exports.calculatePasswordStrength=o.calculatePasswordStrength;exports.createEmailSchema=o.createEmailSchema;exports.createPasswordSchema=o.createPasswordSchema;exports.createSignInSchema=o.createSignInSchema;exports.createSignUpSchema=o.createSignUpSchema;exports.createSocialLoginUrl=o.createSocialLoginUrl;exports.defaultPasswordRules=o.defaultPasswordRules;exports.defaultSignInSchema=o.defaultSignInSchema;exports.defaultSignUpSchema=o.defaultSignUpSchema;exports.emailSchema=o.emailSchema;exports.formatAuthError=o.formatAuthError;exports.formatProviderName=o.formatProviderName;exports.formatSocialLoginText=o.formatSocialLoginText;exports.generateRandomString=o.generateRandomString;exports.getProviderColor=o.getProviderColor;exports.getProviderIcon=o.getProviderIcon;exports.isBrowser=o.isBrowser;exports.isValidEmail=o.isValidEmail;exports.openSocialLoginPopup=o.openSocialLoginPopup;exports.providerInfo=o.providerInfo;exports.requestToControllerValidation=o.requestToControllerValidation;exports.resetPasswordSchema=o.resetPasswordSchema;exports.socialProviderInfo=o.socialProviderInfo;exports.useAuthEmailProp=o.useAuthEmailProp;exports.validateEmail=o.validateEmail;exports.validatePassword=o.validatePassword;
@@ -1,4 +1,4 @@
1
- import { A as t, a as s, b as n, c as i, d as e, D as r, E as g, F as u, G as c, e as l, I as d, L, M as S, P as B, f as m, g as h, h as P, i as p, j as w, R as f, k as v, S as I, l as A, m as E, n as T, o as k, p as x, q as C, T as F, r as R, s as U, W as b, t as y, X as D, u as G, Y as M, v as V, w as W, x as X, y as q, z, B as H, C as N, H as Y, J as j, K as J, N as K, O, Q, U as Z, V as _, Z as $, _ as aa, $ as oa, a0 as ta, a1 as sa, a2 as na, a3 as ia, a4 as ea, a5 as ra, a6 as ga, a7 as ua, a8 as ca } from "../auth-divider-CbME_yVQ.js";
1
+ import { A as t, a as s, b as n, c as i, d as e, D as r, E as g, F as u, G as c, e as l, I as d, L, M as S, P as B, f as m, g as h, h as P, i as p, j as w, R as f, k as v, S as I, l as A, m as E, n as T, o as k, p as x, q as C, T as F, r as R, s as U, W as b, t as y, X as D, u as G, Y as M, v as V, w as W, x as X, y as q, z, B as H, C as N, H as Y, J as j, K as J, N as K, O, Q, U as Z, V as _, Z as $, _ as aa, $ as oa, a0 as ta, a1 as sa, a2 as na, a3 as ia, a4 as ea, a5 as ra, a6 as ga, a7 as ua, a8 as ca } from "../auth-divider-Cp3xGpHr.js";
2
2
  export {
3
3
  t as AmazonLoginButton,
4
4
  s as AppleLoginButton,
@@ -1 +1 @@
1
- "use strict";const e=require("@tempots/dom"),q=require("./stack-dwLevGa2.cjs"),L=require("./use-form-CaW192gw.cjs"),f=require("./modal-BT0jjDqX.cjs"),G=require("@tempots/std"),m=require("./translations-C81buKAw.cjs"),P=require("./notice-B5wTXoTq.cjs"),C=require("./input-container-Di1YvVB_.cjs"),ee=require("./text-input-X_q01NsY.cjs"),te=require("./translations-Dbx7L7Q1.cjs"),oe=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 j(t){return T[t]?.name||t}function ae(t){return T[t]?.icon||"mdi:account"}function ne(t){return T[t]?.color||"#666"}function re(t,o="Continue with {provider}"){return o.replace("{provider}",j(t))}const y={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function se(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function H(t=32){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let a=0;a<t;a++)n+=o.charAt(Math.floor(Math.random()*o.length));return n}function ie(t,o,n,a=[],c={}){const s={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"},u={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"]},r=s[t];if(!r)throw new Error(`Unsupported provider: ${t}`);const l=a.length>0?a:u[t],i=H(),h=new URLSearchParams({client_id:o,redirect_uri:n,scope:l.join(" "),state:i,response_type:"code",...c});return`${r}?${h.toString()}`}function ce(t,o,n,a){const c=window.open(t,`${o}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){a?.(new Error("Failed to open popup window"));return}const s=setInterval(()=>{c.closed&&(clearInterval(s),a?.(new Error("Login cancelled")))},1e3),u=r=>{r.origin===window.location.origin&&(r.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(s),c.close(),window.removeEventListener("message",u),n?.(r.data.result)):r.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(s),c.close(),window.removeEventListener("message",u),a?.(new Error(r.data.error))))};window.addEventListener("message",u)}function le(t){return t instanceof Error?t.message:typeof t=="string"?t:t&&typeof t=="object"&&"message"in t?String(t.message):"An unexpected error occurred"}function ue(){return typeof window<"u"&&typeof document<"u"}function $({task:t,message:o,onStart:n,onEnd:a}){return async c=>{n?.();const s=await L.taskToValidation({task:t!=null?()=>t(c):async()=>null,errorMessage:o,errorPath:["root"],validation:u=>u!=null?G.Validation.invalid({message:u}):G.Validation.valid});return a?.(),s}}function E(t=y,o){const n=o??m.defaultMessages;let a=f.string();return t.minLength&&(a=a.min(t.minLength,(n.passwordMinLength??m.defaultMessages.passwordMinLength)(t.minLength))),t.requireUppercase&&(a=a.regex(/[A-Z]/,n.passwordRequireUppercase??m.defaultMessages.passwordRequireUppercase)),t.requireLowercase&&(a=a.regex(/[a-z]/,n.passwordRequireLowercase??m.defaultMessages.passwordRequireLowercase)),t.requireNumbers&&(a=a.regex(/[0-9]/,n.passwordRequireNumber??m.defaultMessages.passwordRequireNumber)),t.requireSymbols&&(a=a.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,n.passwordRequireSpecialChar??m.defaultMessages.passwordRequireSpecialChar)),t.customValidation&&(a=a.refine(c=>t.customValidation(c))),a}function A(t){const o=t??m.defaultMessages;return f.string().min(1,o.emailRequired??m.defaultMessages.emailRequired).email(o.invalidEmail??m.defaultMessages.invalidEmail)}const V=A();function M(t,o){const n=o??m.defaultMessages,a=t?E(t,o):f.string().refine(c=>c.length>0?null:n.passwordRequired??m.defaultMessages.passwordRequired);return f.object({email:A(o),password:a,rememberMe:f.boolean().default(!1)}).schema()}function z(t=y,o,n){const a=n??m.defaultMessages,c=E(t,n),s=o?.showNameField!==!1,u=o?.showConfirmPassword!==!1,r=o?.showAcceptTermsAndConditions!==!1,l={name:s?f.string().min(1,a.nameRequired??m.defaultMessages.nameRequired).optional():f.string().optional(),email:A(n),password:c,confirmPassword:u?f.string().min(1,a.confirmPasswordRequired??m.defaultMessages.confirmPasswordRequired):f.string(),acceptTerms:r?f.boolean().refine(h=>h===!0,a.acceptTermsRequired??m.defaultMessages.acceptTermsRequired):f.boolean().default(!0)},i=f.object(l);return u?i.refine(h=>h.password===h.confirmPassword?null:a.passwordsDoNotMatch??m.defaultMessages.passwordsDoNotMatch,{path:["confirmPassword"]}).schema():i.schema()}const N=f.object({email:V}).schema(),me=M(),de=z(),pe={signIn:M,signUp:z,resetPassword:()=>N};function he(t,o){const n=o??m.defaultMessages,c=(o?A(o):V).validate(t);return c.success?null:c.errors[0]?.message||(n.invalidEmailAddress??m.defaultMessages.invalidEmailAddress)}function ge(t,o=y,n){const a=n??m.defaultMessages,s=E(o,n).validate(t);return s.success?null:s.errors[0]?.message||(a.invalidPassword??m.defaultMessages.invalidPassword)}function R(t,o=y){const n={length:t.length>=(o.minLength||8),uppercase:/[A-Z]/.test(t),lowercase:/[a-z]/.test(t),numbers:/[0-9]/.test(t),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(t),custom:o.customValidation?o.customValidation(t)===null:t.length>0},a=[!0,o.requireUppercase,o.requireLowercase,o.requireNumbers,o.requireSymbols,!!o.customValidation].filter(Boolean).length,c=[n.length,o.requireUppercase?n.uppercase:null,o.requireLowercase?n.lowercase:null,o.requireNumbers?n.numbers:null,o.requireSymbols?n.symbols:null,o.customValidation?n.custom:null].filter(r=>r===!0).length,s=a>0?Math.round(c/a*100):0;let u;return s<40?u="weak":s<60?u="fair":s<80?u="good":u="strong",{strength:u,score:s,checks:n}}const D=()=>e.localStorageProp({key:"bui_auth_email",defaultValue:null});function X({onSignIn:t,passwordRules:o,labels:n,showRememberMe:a}){const c=e.prop(!1),s=D(),u=M(o),r=L.useForm({schema:u,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{c.set(!0),r.controller.disable()},onEnd:()=>{c.set(!1),r.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:l,submit:i}=r;c.on(l.setDisabled);const h=l.field("email"),w=l.field("password");return s.on(b=>{b!=null&&h.change(b)}),h.signal.on(b=>{s.value!=null&&(s.value=b)}),e.Use(m.AuthI18n,b=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(i),q.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(l.error,_=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(_))),L.Control(P.EmailInput,{controller:h,label:e.coalesce(n?.emailLabel,b.$.emailLabel)}),L.Control(P.PasswordInput,{controller:w,label:e.coalesce(n?.passwordLabel,b.$.passwordLabel)}),e.When(a??!0,()=>e.html.div(e.attr.class("bc-auth-form__remember-me"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:s.map(_=>_!=null),after:e.html.span(e.coalesce(n?.rememberMeLabel,b.$.rememberMeLabel)),onChange:_=>{_?s.value=h.signal.value??"":s.value=null}}))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:l.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(n?.signInButton,b.$.signInButton))))}function Y({password:t,rules:o=y,showLabel:n=!0,className:a}){const c=e.computedOf(t)(i=>!i||i.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:R(i,o)),s=c.map(i=>i.strength),u=c.map(i=>i.score),r=c.map(i=>i.checks),l=e.computedOf(s,a)((i,h)=>["bc-password-strength",`bc-password-strength--${i}`,h].filter(Boolean).join(" "));return e.html.div(e.attr.class(l),e.html.div(e.attr.class("bc-password-strength__bar"),e.html.div(e.attr.class("bc-password-strength__fill"),e.attr.style(u.map(i=>`width: ${i}%`)))),e.When(n,()=>e.Use(m.AuthI18n,i=>e.html.div(e.attr.class("bc-password-strength__label"),e.computedOf(s,i)((h,w)=>{switch(h){case"weak":return w.passwordStrengthWeak;case"fair":return w.passwordStrengthFair;case"good":return w.passwordStrengthGood;case"strong":return w.passwordStrengthStrong;default:return w.passwordStrengthWeak}})))),e.html.div(e.attr.class("bc-password-strength__requirements"),e.When(o.minLength!==void 0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.length?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.length?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),`At least ${o.minLength} characters`))),e.When(o.requireUppercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.uppercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.uppercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),e.When(o.requireLowercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.lowercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.lowercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),e.When(o.requireNumbers===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.numbers?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.numbers?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One number"))),e.When(o.requireSymbols===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.symbols?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.symbols?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function fe({password:t,rules:o=y,className:n}){const a=e.computedOf(t)(r=>!r||r.length===0?{strength:"weak",score:0}:R(r,o)),c=a.map(r=>r.strength),s=a.map(r=>r.score),u=e.computedOf(c,n)((r,l)=>["bc-password-strength-bar",`bc-password-strength-bar--${r}`,l].filter(Boolean).join(" "));return e.html.div(e.attr.class(u),e.html.div(e.attr.class("bc-password-strength-bar__fill"),e.attr.style(s.map(r=>`width: ${r}%`))))}function we({password:t,rules:o=y,className:n}){const a=e.computedOf(t)(s=>!s||s.length===0?"weak":R(s,o).strength),c=e.computedOf(a,n)((s,u)=>["bc-password-strength-text",`bc-password-strength-text--${s}`,u].filter(Boolean).join(" "));return e.Use(m.AuthI18n,s=>e.html.span(e.attr.class(c),e.computedOf(a,s)((u,r)=>{switch(u){case"weak":return r.passwordStrengthWeak;case"fair":return r.passwordStrengthFair;case"good":return r.passwordStrengthGood;case"strong":return r.passwordStrengthStrong;default:return r.passwordStrengthWeak}})))}function Z({passwordRules:t,labels:o,initialEmail:n,initialName:a,showPasswordStrength:c,onSignUp:s,showNameField:u,showConfirmPassword:r,showAcceptTermsAndConditions:l,termsAndConditions:i}){const h=e.prop(!1),w=t||y,b=z(w,{showNameField:u!==!1,showConfirmPassword:r!==!1,showAcceptTermsAndConditions:l!==!1}),_=L.useForm({schema:b,onSubmit:$({task:s!=null?g=>s({email:g.email,password:g.password,name:g.name,acceptTerms:g.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{h.set(!0),_.controller.disable()},onEnd:()=>{h.set(!1),_.controller.enable()}}),initialValue:{name:a??"",email:n??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:v,submit:U}=_;h.on(v.setDisabled);const B=v.field("name"),S=v.field("email"),x=v.field("password"),O=v.field("confirmPassword"),I=v.field("acceptTerms");return e.Use(m.AuthI18n,g=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(U),q.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(v.error,k=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(k))),e.When(u!==!1,()=>L.Control(ee.TextInput,{controller:B.transform(k=>k??"",k=>k===""?void 0:k),label:e.coalesce(o?.nameLabel,g.$.nameLabel)})),L.Control(P.EmailInput,{controller:S,label:e.coalesce(o?.emailLabel,g.$.emailLabel)}),L.Control(P.PasswordInput,{controller:x,label:e.coalesce(o?.passwordLabel,g.$.passwordLabel)}),e.When(c??!1,()=>Y({password:x.signal,rules:w,showLabel:!0})),e.When(r??!1,()=>L.Control(P.PasswordInput,{controller:O,label:e.coalesce(o?.confirmPasswordLabel,g.$.confirmPasswordLabel)})),e.When(l??!1,()=>e.html.div(e.attr.class("bc-auth-form__terms"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:I.signal.map(k=>k??!1),onChange:k=>I.change(k)}),e.html.span(i||e.coalesce(o?.acceptTermsLabel,g.$.acceptTermsLabel))),e.When(I.errorVisible,()=>e.html.div(e.attr.class("bc-auth-form__field-error"),I.error.map(k=>k||"")))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:h,disabled:v.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.signUpButton,g.$.signUpButton))))}function J({onResetPassword:t,labels:o={}}){const n=D(),a=e.prop(!1),c=L.useForm({schema:N,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{a.set(!0),c.controller.disable()},onEnd:()=>{a.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:s,submit:u}=c;a.on(s.setDisabled);const r=s.field("email");return n.on(l=>{l!=null&&r.change(l)}),e.Use(m.AuthI18n,l=>e.html.form(e.attr.class("bc-auth-form__form"),e.Ensure(s.error,i=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(i))),e.html.p(e.attr.class("bc-auth-form__description"),e.coalesce(o?.resetPasswordDescription,l.$.resetPasswordDescription)),e.on.submit(u),q.Stack(e.attr.class("bc-auth-form__fields"),L.Control(P.EmailInput,{controller:r,label:e.coalesce(o?.emailLabel,l.$.emailLabel)})),C.Button({loading:a,type:"submit",variant:"filled",color:"primary",disabled:s.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.resetPasswordButton,l.$.resetPasswordButton))))}function p({provider:t,onClick:o,size:n="md",name:a,icon:c,color:s,flow:u,labels:r}){const l=async()=>{if(o)try{u==="popup"?await o():await o()}catch(i){console.error(`Social login error for ${t} (${u||"redirect"} flow):`,i)}};return C.Button({type:"button",variant:"filled",size:n,color:s,onClick:l,roundedness:"full"},e.attr.class("bc-social-login-button"),e.attr.class(e.computedOf(t)(i=>`bc-social-login-button--${i}`)),e.html.span(e.attr.class("bc-social-login-button__inner"),e.html.span(e.attr.class("bc-social-login-button__icon"),te.Icon({icon:c,size:n},e.attr.class("bc-social-login-button__icon-inner"))),e.Use(m.AuthI18n,i=>e.html.span(e.attr.class("bc-social-login-button__label"),e.bind(e.coalesce(r?.continueWithProvider,i.$.continueWithProvider))(a)))))}function K({providers:t,onProviderClick:o,size:n="md",className:a}){return q.Stack(e.attr.class("bc-social-login-buttons"),e.attr.class(a),e.ForEach(t,c=>p({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:s})=>d[s].color),name:c.map(({provider:s})=>d[s].name),icon:c.map(({provider:s})=>d[s].icon),onClick:async()=>{o&&await o(c.$.provider.value)},size:n})))}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:"simple-icons:snapchat",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:"simple-icons:epicgames",color:"neutral"},playstation:{name:"PlayStation",icon:"simple-icons:playstation",color:"violet"},xbox:{name:"Xbox",icon:"simple-icons:xbox",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"simple-icons:wechat",color:"lime"},amazon:{name:"Amazon",icon:"simple-icons:amazon",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},be=t=>p({...t,...d.google,provider:"google"}),Le=t=>p({...t,...d.github,provider:"github"}),_e=t=>p({...t,...d.apple,provider:"apple"}),ke=t=>p({...t,...d.facebook,provider:"facebook"}),ve=t=>p({...t,...d.x,provider:"x"}),Se=t=>p({...t,...d.twitter,provider:"twitter"}),Pe=t=>p({...t,...d.microsoft,provider:"microsoft"}),ye=t=>p({...t,...d.discord,provider:"discord"}),Be=t=>p({...t,...d.linkedin,provider:"linkedin"}),qe=t=>p({...t,...d.instagram,provider:"instagram"}),Ie=t=>p({...t,...d.tiktok,provider:"tiktok"}),xe=t=>p({...t,...d.snapchat,provider:"snapchat"}),Ae=t=>p({...t,...d.reddit,provider:"reddit"}),Ce=t=>p({...t,...d.pinterest,provider:"pinterest"}),Te=t=>p({...t,...d.twitch,provider:"twitch"}),$e=t=>p({...t,...d.steam,provider:"steam"}),Ee=t=>p({...t,...d.epic,provider:"epic"}),Me=t=>p({...t,...d.playstation,provider:"playstation"}),ze=t=>p({...t,...d.xbox,provider:"xbox"}),Re=t=>p({...t,...d.whatsapp,provider:"whatsapp"}),Ue=t=>p({...t,...d.wechat,provider:"wechat"}),Oe=t=>p({...t,...d.amazon,provider:"amazon"}),We=t=>p({...t,...d.yahoo,provider:"yahoo"}),Fe=t=>p({...t,...d.paypal,provider:"paypal"});function W({providers:t,onSocialLogin:o}){return q.Stack(K({providers:t,onProviderClick:o}))}function Q({mode:t,socialProviders:o,initialName:n,initialEmail:a,passwordRules:c,showRememberMe:s,showSocialDivider:u,showPasswordStrength:r,labels:l,onSignIn:i,onSignUp:h,onResetPassword:w,onModeChange:b,onSocialLogin:_,showContainer:v},...U){const B=t!=null?e.Value.deriveProp(t):e.prop("signin");return B.on(S=>b?.(S)),e.Use(m.AuthI18n,S=>{function x(){const g=e.coalesce(l?.hasAccountLink,S.$.hasAccountLink);return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>B.set("signin")),g)}function O(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>B.set("signup")),e.coalesce(l?.noAccountLink,S.$.noAccountLink))}function I(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>B.set("reset-password")),e.coalesce(l?.forgotPasswordLink,S.$.forgotPasswordLink))}return e.html.div(oe.classes({"bc-auth-container":!0,"bc-auth-container--styled":e.Value.map(v??!0,g=>g)}),e.attr.class(B.map(g=>`bc-auth-container--${g}`)),e.attr.class("bc-auth-form"),e.OneOfValue(B,{signin:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signInTitle,S.$.signInTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,X({onSignIn:i,showRememberMe:s,passwordRules:c,labels:{emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,rememberMeLabel:l?.rememberMeLabel,signInButton:l?.signInButton,forgotPasswordLink:l?.forgotPasswordLink,noAccountLink:l?.noAccountLink}}),q.Stack(e.attr.class("bc-auth-form__footer"),O(),I())),signup:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signUpTitle,S.$.signUpTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,Z({labels:{nameLabel:l?.nameLabel,emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,confirmPasswordLabel:l?.confirmPasswordLabel,acceptTermsLabel:l?.acceptTermsLabel,signUpButton:l?.signUpButton,hasAccountLink:l?.hasAccountLink},initialEmail:a,initialName:n,onSignUp:h,passwordRules:c,showPasswordStrength:r}),q.Stack(e.attr.class("bc-auth-form__footer"),x())),"reset-password":()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.resetPasswordTitle,S.$.resetPasswordTitle)),J({labels:{backToSignInLink:l?.backToSignInLink,emailLabel:l?.emailLabel,resetPasswordButton:l?.resetPasswordButton,resetPasswordDescription:l?.resetPasswordDescription},onResetPassword:w}),q.Stack(e.attr.class("bc-auth-form__footer"),x()))}),...U)})}function Ve(t){return f.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(o,n)=>t(a=>o({body:Q({showContainer:!1,...a}),header:e.Use(m.AuthI18n,c=>e.coalesce(a.modalTitle,c.$.authenticationTitle))})))}function F({labels:t,className:o}={}){return e.html.div(e.attr.class("bc-auth-divider"),e.attr.class(o),e.html.div(e.attr.class("bc-auth-divider__line")),e.Use(m.AuthI18n,n=>e.html.span(e.attr.class("bc-auth-divider__text"),e.coalesce(t?.text,n.$.orDivider))),e.html.div(e.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=Oe;exports.AppleLoginButton=_e;exports.AuthContainer=Q;exports.AuthDivider=F;exports.AuthModal=Ve;exports.DiscordLoginButton=ye;exports.EpicLoginButton=Ee;exports.FacebookLoginButton=ke;exports.GitHubLoginButton=Le;exports.GoogleLoginButton=be;exports.InstagramLoginButton=qe;exports.LinkedInLoginButton=Be;exports.MicrosoftLoginButton=Pe;exports.PasswordStrengthBar=fe;exports.PasswordStrengthIndicator=Y;exports.PasswordStrengthText=we;exports.PayPalLoginButton=Fe;exports.PinterestLoginButton=Ce;exports.PlayStationLoginButton=Me;exports.RedditLoginButton=Ae;exports.ResetPasswordForm=J;exports.SignInForm=X;exports.SignUpForm=Z;exports.SnapchatLoginButton=xe;exports.SocialLoginButton=p;exports.SocialLoginButtons=K;exports.SocialProviders=W;exports.SteamLoginButton=$e;exports.TiktokLoginButton=Ie;exports.TwitchLoginButton=Te;exports.TwitterLoginButton=Se;exports.WeChatLoginButton=Ue;exports.WhatsAppLoginButton=Re;exports.XLoginButtin=ve;exports.XboxLoginButton=ze;exports.YahooLoginButton=We;exports.authSchemas=pe;exports.calculatePasswordStrength=R;exports.createEmailSchema=A;exports.createPasswordSchema=E;exports.createSignInSchema=M;exports.createSignUpSchema=z;exports.createSocialLoginUrl=ie;exports.defaultPasswordRules=y;exports.defaultSignInSchema=me;exports.defaultSignUpSchema=de;exports.emailSchema=V;exports.formatAuthError=le;exports.formatProviderName=j;exports.formatSocialLoginText=re;exports.generateRandomString=H;exports.getProviderColor=ne;exports.getProviderIcon=ae;exports.isBrowser=ue;exports.isValidEmail=se;exports.openSocialLoginPopup=ce;exports.providerInfo=T;exports.requestToControllerValidation=$;exports.resetPasswordSchema=N;exports.socialProviderInfo=d;exports.useAuthEmailProp=D;exports.validateEmail=he;exports.validatePassword=ge;
1
+ "use strict";const e=require("@tempots/dom"),q=require("./stack-dwLevGa2.cjs"),L=require("./use-form-CaW192gw.cjs"),f=require("./modal-BT0jjDqX.cjs"),G=require("@tempots/std"),m=require("./translations-C81buKAw.cjs"),P=require("./notice-BNghd0oS.cjs"),C=require("./input-container-Di1YvVB_.cjs"),ee=require("./text-input-DL9FvpTZ.cjs"),te=require("./translations-Dbx7L7Q1.cjs"),oe=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 j(t){return T[t]?.name||t}function ae(t){return T[t]?.icon||"mdi:account"}function ne(t){return T[t]?.color||"#666"}function re(t,o="Continue with {provider}"){return o.replace("{provider}",j(t))}const y={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function se(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function H(t=32){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let a=0;a<t;a++)n+=o.charAt(Math.floor(Math.random()*o.length));return n}function ie(t,o,n,a=[],c={}){const s={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"},u={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"]},r=s[t];if(!r)throw new Error(`Unsupported provider: ${t}`);const l=a.length>0?a:u[t],i=H(),h=new URLSearchParams({client_id:o,redirect_uri:n,scope:l.join(" "),state:i,response_type:"code",...c});return`${r}?${h.toString()}`}function ce(t,o,n,a){const c=window.open(t,`${o}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){a?.(new Error("Failed to open popup window"));return}const s=setInterval(()=>{c.closed&&(clearInterval(s),a?.(new Error("Login cancelled")))},1e3),u=r=>{r.origin===window.location.origin&&(r.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(s),c.close(),window.removeEventListener("message",u),n?.(r.data.result)):r.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(s),c.close(),window.removeEventListener("message",u),a?.(new Error(r.data.error))))};window.addEventListener("message",u)}function le(t){return t instanceof Error?t.message:typeof t=="string"?t:t&&typeof t=="object"&&"message"in t?String(t.message):"An unexpected error occurred"}function ue(){return typeof window<"u"&&typeof document<"u"}function $({task:t,message:o,onStart:n,onEnd:a}){return async c=>{n?.();const s=await L.taskToValidation({task:t!=null?()=>t(c):async()=>null,errorMessage:o,errorPath:["root"],validation:u=>u!=null?G.Validation.invalid({message:u}):G.Validation.valid});return a?.(),s}}function E(t=y,o){const n=o??m.defaultMessages;let a=f.string();return t.minLength&&(a=a.min(t.minLength,(n.passwordMinLength??m.defaultMessages.passwordMinLength)(t.minLength))),t.requireUppercase&&(a=a.regex(/[A-Z]/,n.passwordRequireUppercase??m.defaultMessages.passwordRequireUppercase)),t.requireLowercase&&(a=a.regex(/[a-z]/,n.passwordRequireLowercase??m.defaultMessages.passwordRequireLowercase)),t.requireNumbers&&(a=a.regex(/[0-9]/,n.passwordRequireNumber??m.defaultMessages.passwordRequireNumber)),t.requireSymbols&&(a=a.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,n.passwordRequireSpecialChar??m.defaultMessages.passwordRequireSpecialChar)),t.customValidation&&(a=a.refine(c=>t.customValidation(c))),a}function A(t){const o=t??m.defaultMessages;return f.string().min(1,o.emailRequired??m.defaultMessages.emailRequired).email(o.invalidEmail??m.defaultMessages.invalidEmail)}const V=A();function M(t,o){const n=o??m.defaultMessages,a=t?E(t,o):f.string().refine(c=>c.length>0?null:n.passwordRequired??m.defaultMessages.passwordRequired);return f.object({email:A(o),password:a,rememberMe:f.boolean().default(!1)}).schema()}function z(t=y,o,n){const a=n??m.defaultMessages,c=E(t,n),s=o?.showNameField!==!1,u=o?.showConfirmPassword!==!1,r=o?.showAcceptTermsAndConditions!==!1,l={name:s?f.string().min(1,a.nameRequired??m.defaultMessages.nameRequired).optional():f.string().optional(),email:A(n),password:c,confirmPassword:u?f.string().min(1,a.confirmPasswordRequired??m.defaultMessages.confirmPasswordRequired):f.string(),acceptTerms:r?f.boolean().refine(h=>h===!0,a.acceptTermsRequired??m.defaultMessages.acceptTermsRequired):f.boolean().default(!0)},i=f.object(l);return u?i.refine(h=>h.password===h.confirmPassword?null:a.passwordsDoNotMatch??m.defaultMessages.passwordsDoNotMatch,{path:["confirmPassword"]}).schema():i.schema()}const N=f.object({email:V}).schema(),me=M(),de=z(),pe={signIn:M,signUp:z,resetPassword:()=>N};function he(t,o){const n=o??m.defaultMessages,c=(o?A(o):V).validate(t);return c.success?null:c.errors[0]?.message||(n.invalidEmailAddress??m.defaultMessages.invalidEmailAddress)}function ge(t,o=y,n){const a=n??m.defaultMessages,s=E(o,n).validate(t);return s.success?null:s.errors[0]?.message||(a.invalidPassword??m.defaultMessages.invalidPassword)}function R(t,o=y){const n={length:t.length>=(o.minLength||8),uppercase:/[A-Z]/.test(t),lowercase:/[a-z]/.test(t),numbers:/[0-9]/.test(t),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(t),custom:o.customValidation?o.customValidation(t)===null:t.length>0},a=[!0,o.requireUppercase,o.requireLowercase,o.requireNumbers,o.requireSymbols,!!o.customValidation].filter(Boolean).length,c=[n.length,o.requireUppercase?n.uppercase:null,o.requireLowercase?n.lowercase:null,o.requireNumbers?n.numbers:null,o.requireSymbols?n.symbols:null,o.customValidation?n.custom:null].filter(r=>r===!0).length,s=a>0?Math.round(c/a*100):0;let u;return s<40?u="weak":s<60?u="fair":s<80?u="good":u="strong",{strength:u,score:s,checks:n}}const D=()=>e.localStorageProp({key:"bui_auth_email",defaultValue:null});function X({onSignIn:t,passwordRules:o,labels:n,showRememberMe:a}){const c=e.prop(!1),s=D(),u=M(o),r=L.useForm({schema:u,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{c.set(!0),r.controller.disable()},onEnd:()=>{c.set(!1),r.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:l,submit:i}=r;c.on(l.setDisabled);const h=l.field("email"),w=l.field("password");return s.on(b=>{b!=null&&h.change(b)}),h.signal.on(b=>{s.value!=null&&(s.value=b)}),e.Use(m.AuthI18n,b=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(i),q.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(l.error,_=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(_))),L.Control(P.EmailInput,{controller:h,label:e.coalesce(n?.emailLabel,b.$.emailLabel)}),L.Control(P.PasswordInput,{controller:w,label:e.coalesce(n?.passwordLabel,b.$.passwordLabel)}),e.When(a??!0,()=>e.html.div(e.attr.class("bc-auth-form__remember-me"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:s.map(_=>_!=null),after:e.html.span(e.coalesce(n?.rememberMeLabel,b.$.rememberMeLabel)),onChange:_=>{_?s.value=h.signal.value??"":s.value=null}}))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:l.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(n?.signInButton,b.$.signInButton))))}function Y({password:t,rules:o=y,showLabel:n=!0,className:a}){const c=e.computedOf(t)(i=>!i||i.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:R(i,o)),s=c.map(i=>i.strength),u=c.map(i=>i.score),r=c.map(i=>i.checks),l=e.computedOf(s,a)((i,h)=>["bc-password-strength",`bc-password-strength--${i}`,h].filter(Boolean).join(" "));return e.html.div(e.attr.class(l),e.html.div(e.attr.class("bc-password-strength__bar"),e.html.div(e.attr.class("bc-password-strength__fill"),e.attr.style(u.map(i=>`width: ${i}%`)))),e.When(n,()=>e.Use(m.AuthI18n,i=>e.html.div(e.attr.class("bc-password-strength__label"),e.computedOf(s,i)((h,w)=>{switch(h){case"weak":return w.passwordStrengthWeak;case"fair":return w.passwordStrengthFair;case"good":return w.passwordStrengthGood;case"strong":return w.passwordStrengthStrong;default:return w.passwordStrengthWeak}})))),e.html.div(e.attr.class("bc-password-strength__requirements"),e.When(o.minLength!==void 0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.length?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.length?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),`At least ${o.minLength} characters`))),e.When(o.requireUppercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.uppercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.uppercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),e.When(o.requireLowercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.lowercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.lowercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),e.When(o.requireNumbers===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.numbers?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.numbers?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One number"))),e.When(o.requireSymbols===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.symbols?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.symbols?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function fe({password:t,rules:o=y,className:n}){const a=e.computedOf(t)(r=>!r||r.length===0?{strength:"weak",score:0}:R(r,o)),c=a.map(r=>r.strength),s=a.map(r=>r.score),u=e.computedOf(c,n)((r,l)=>["bc-password-strength-bar",`bc-password-strength-bar--${r}`,l].filter(Boolean).join(" "));return e.html.div(e.attr.class(u),e.html.div(e.attr.class("bc-password-strength-bar__fill"),e.attr.style(s.map(r=>`width: ${r}%`))))}function we({password:t,rules:o=y,className:n}){const a=e.computedOf(t)(s=>!s||s.length===0?"weak":R(s,o).strength),c=e.computedOf(a,n)((s,u)=>["bc-password-strength-text",`bc-password-strength-text--${s}`,u].filter(Boolean).join(" "));return e.Use(m.AuthI18n,s=>e.html.span(e.attr.class(c),e.computedOf(a,s)((u,r)=>{switch(u){case"weak":return r.passwordStrengthWeak;case"fair":return r.passwordStrengthFair;case"good":return r.passwordStrengthGood;case"strong":return r.passwordStrengthStrong;default:return r.passwordStrengthWeak}})))}function Z({passwordRules:t,labels:o,initialEmail:n,initialName:a,showPasswordStrength:c,onSignUp:s,showNameField:u,showConfirmPassword:r,showAcceptTermsAndConditions:l,termsAndConditions:i}){const h=e.prop(!1),w=t||y,b=z(w,{showNameField:u!==!1,showConfirmPassword:r!==!1,showAcceptTermsAndConditions:l!==!1}),_=L.useForm({schema:b,onSubmit:$({task:s!=null?g=>s({email:g.email,password:g.password,name:g.name,acceptTerms:g.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{h.set(!0),_.controller.disable()},onEnd:()=>{h.set(!1),_.controller.enable()}}),initialValue:{name:a??"",email:n??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:v,submit:U}=_;h.on(v.setDisabled);const B=v.field("name"),S=v.field("email"),x=v.field("password"),O=v.field("confirmPassword"),I=v.field("acceptTerms");return e.Use(m.AuthI18n,g=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(U),q.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(v.error,k=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(k))),e.When(u!==!1,()=>L.Control(ee.TextInput,{controller:B.transform(k=>k??"",k=>k===""?void 0:k),label:e.coalesce(o?.nameLabel,g.$.nameLabel)})),L.Control(P.EmailInput,{controller:S,label:e.coalesce(o?.emailLabel,g.$.emailLabel)}),L.Control(P.PasswordInput,{controller:x,label:e.coalesce(o?.passwordLabel,g.$.passwordLabel)}),e.When(c??!1,()=>Y({password:x.signal,rules:w,showLabel:!0})),e.When(r??!1,()=>L.Control(P.PasswordInput,{controller:O,label:e.coalesce(o?.confirmPasswordLabel,g.$.confirmPasswordLabel)})),e.When(l??!1,()=>e.html.div(e.attr.class("bc-auth-form__terms"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:I.signal.map(k=>k??!1),onChange:k=>I.change(k)}),e.html.span(i||e.coalesce(o?.acceptTermsLabel,g.$.acceptTermsLabel))),e.When(I.errorVisible,()=>e.html.div(e.attr.class("bc-auth-form__field-error"),I.error.map(k=>k||"")))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:h,disabled:v.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.signUpButton,g.$.signUpButton))))}function J({onResetPassword:t,labels:o={}}){const n=D(),a=e.prop(!1),c=L.useForm({schema:N,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{a.set(!0),c.controller.disable()},onEnd:()=>{a.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:s,submit:u}=c;a.on(s.setDisabled);const r=s.field("email");return n.on(l=>{l!=null&&r.change(l)}),e.Use(m.AuthI18n,l=>e.html.form(e.attr.class("bc-auth-form__form"),e.Ensure(s.error,i=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(i))),e.html.p(e.attr.class("bc-auth-form__description"),e.coalesce(o?.resetPasswordDescription,l.$.resetPasswordDescription)),e.on.submit(u),q.Stack(e.attr.class("bc-auth-form__fields"),L.Control(P.EmailInput,{controller:r,label:e.coalesce(o?.emailLabel,l.$.emailLabel)})),C.Button({loading:a,type:"submit",variant:"filled",color:"primary",disabled:s.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.resetPasswordButton,l.$.resetPasswordButton))))}function p({provider:t,onClick:o,size:n="md",name:a,icon:c,color:s,flow:u,labels:r}){const l=async()=>{if(o)try{u==="popup"?await o():await o()}catch(i){console.error(`Social login error for ${t} (${u||"redirect"} flow):`,i)}};return C.Button({type:"button",variant:"filled",size:n,color:s,onClick:l,roundedness:"full"},e.attr.class("bc-social-login-button"),e.attr.class(e.computedOf(t)(i=>`bc-social-login-button--${i}`)),e.html.span(e.attr.class("bc-social-login-button__inner"),e.html.span(e.attr.class("bc-social-login-button__icon"),te.Icon({icon:c,size:n},e.attr.class("bc-social-login-button__icon-inner"))),e.Use(m.AuthI18n,i=>e.html.span(e.attr.class("bc-social-login-button__label"),e.bind(e.coalesce(r?.continueWithProvider,i.$.continueWithProvider))(a)))))}function K({providers:t,onProviderClick:o,size:n="md",className:a}){return q.Stack(e.attr.class("bc-social-login-buttons"),e.attr.class(a),e.ForEach(t,c=>p({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:s})=>d[s].color),name:c.map(({provider:s})=>d[s].name),icon:c.map(({provider:s})=>d[s].icon),onClick:async()=>{o&&await o(c.$.provider.value)},size:n})))}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:"simple-icons:snapchat",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:"simple-icons:epicgames",color:"neutral"},playstation:{name:"PlayStation",icon:"simple-icons:playstation",color:"violet"},xbox:{name:"Xbox",icon:"simple-icons:xbox",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"simple-icons:wechat",color:"lime"},amazon:{name:"Amazon",icon:"simple-icons:amazon",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},be=t=>p({...t,...d.google,provider:"google"}),Le=t=>p({...t,...d.github,provider:"github"}),_e=t=>p({...t,...d.apple,provider:"apple"}),ke=t=>p({...t,...d.facebook,provider:"facebook"}),ve=t=>p({...t,...d.x,provider:"x"}),Se=t=>p({...t,...d.twitter,provider:"twitter"}),Pe=t=>p({...t,...d.microsoft,provider:"microsoft"}),ye=t=>p({...t,...d.discord,provider:"discord"}),Be=t=>p({...t,...d.linkedin,provider:"linkedin"}),qe=t=>p({...t,...d.instagram,provider:"instagram"}),Ie=t=>p({...t,...d.tiktok,provider:"tiktok"}),xe=t=>p({...t,...d.snapchat,provider:"snapchat"}),Ae=t=>p({...t,...d.reddit,provider:"reddit"}),Ce=t=>p({...t,...d.pinterest,provider:"pinterest"}),Te=t=>p({...t,...d.twitch,provider:"twitch"}),$e=t=>p({...t,...d.steam,provider:"steam"}),Ee=t=>p({...t,...d.epic,provider:"epic"}),Me=t=>p({...t,...d.playstation,provider:"playstation"}),ze=t=>p({...t,...d.xbox,provider:"xbox"}),Re=t=>p({...t,...d.whatsapp,provider:"whatsapp"}),Ue=t=>p({...t,...d.wechat,provider:"wechat"}),Oe=t=>p({...t,...d.amazon,provider:"amazon"}),We=t=>p({...t,...d.yahoo,provider:"yahoo"}),Fe=t=>p({...t,...d.paypal,provider:"paypal"});function W({providers:t,onSocialLogin:o}){return q.Stack(K({providers:t,onProviderClick:o}))}function Q({mode:t,socialProviders:o,initialName:n,initialEmail:a,passwordRules:c,showRememberMe:s,showSocialDivider:u,showPasswordStrength:r,labels:l,onSignIn:i,onSignUp:h,onResetPassword:w,onModeChange:b,onSocialLogin:_,showContainer:v},...U){const B=t!=null?e.Value.deriveProp(t):e.prop("signin");return B.on(S=>b?.(S)),e.Use(m.AuthI18n,S=>{function x(){const g=e.coalesce(l?.hasAccountLink,S.$.hasAccountLink);return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>B.set("signin")),g)}function O(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>B.set("signup")),e.coalesce(l?.noAccountLink,S.$.noAccountLink))}function I(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>B.set("reset-password")),e.coalesce(l?.forgotPasswordLink,S.$.forgotPasswordLink))}return e.html.div(oe.classes({"bc-auth-container":!0,"bc-auth-container--styled":e.Value.map(v??!0,g=>g)}),e.attr.class(B.map(g=>`bc-auth-container--${g}`)),e.attr.class("bc-auth-form"),e.OneOfValue(B,{signin:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signInTitle,S.$.signInTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,X({onSignIn:i,showRememberMe:s,passwordRules:c,labels:{emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,rememberMeLabel:l?.rememberMeLabel,signInButton:l?.signInButton,forgotPasswordLink:l?.forgotPasswordLink,noAccountLink:l?.noAccountLink}}),q.Stack(e.attr.class("bc-auth-form__footer"),O(),I())),signup:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signUpTitle,S.$.signUpTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,Z({labels:{nameLabel:l?.nameLabel,emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,confirmPasswordLabel:l?.confirmPasswordLabel,acceptTermsLabel:l?.acceptTermsLabel,signUpButton:l?.signUpButton,hasAccountLink:l?.hasAccountLink},initialEmail:a,initialName:n,onSignUp:h,passwordRules:c,showPasswordStrength:r}),q.Stack(e.attr.class("bc-auth-form__footer"),x())),"reset-password":()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.resetPasswordTitle,S.$.resetPasswordTitle)),J({labels:{backToSignInLink:l?.backToSignInLink,emailLabel:l?.emailLabel,resetPasswordButton:l?.resetPasswordButton,resetPasswordDescription:l?.resetPasswordDescription},onResetPassword:w}),q.Stack(e.attr.class("bc-auth-form__footer"),x()))}),...U)})}function Ve(t){return f.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(o,n)=>t(a=>o({body:Q({showContainer:!1,...a}),header:e.Use(m.AuthI18n,c=>e.coalesce(a.modalTitle,c.$.authenticationTitle))})))}function F({labels:t,className:o}={}){return e.html.div(e.attr.class("bc-auth-divider"),e.attr.class(o),e.html.div(e.attr.class("bc-auth-divider__line")),e.Use(m.AuthI18n,n=>e.html.span(e.attr.class("bc-auth-divider__text"),e.coalesce(t?.text,n.$.orDivider))),e.html.div(e.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=Oe;exports.AppleLoginButton=_e;exports.AuthContainer=Q;exports.AuthDivider=F;exports.AuthModal=Ve;exports.DiscordLoginButton=ye;exports.EpicLoginButton=Ee;exports.FacebookLoginButton=ke;exports.GitHubLoginButton=Le;exports.GoogleLoginButton=be;exports.InstagramLoginButton=qe;exports.LinkedInLoginButton=Be;exports.MicrosoftLoginButton=Pe;exports.PasswordStrengthBar=fe;exports.PasswordStrengthIndicator=Y;exports.PasswordStrengthText=we;exports.PayPalLoginButton=Fe;exports.PinterestLoginButton=Ce;exports.PlayStationLoginButton=Me;exports.RedditLoginButton=Ae;exports.ResetPasswordForm=J;exports.SignInForm=X;exports.SignUpForm=Z;exports.SnapchatLoginButton=xe;exports.SocialLoginButton=p;exports.SocialLoginButtons=K;exports.SocialProviders=W;exports.SteamLoginButton=$e;exports.TiktokLoginButton=Ie;exports.TwitchLoginButton=Te;exports.TwitterLoginButton=Se;exports.WeChatLoginButton=Ue;exports.WhatsAppLoginButton=Re;exports.XLoginButtin=ve;exports.XboxLoginButton=ze;exports.YahooLoginButton=We;exports.authSchemas=pe;exports.calculatePasswordStrength=R;exports.createEmailSchema=A;exports.createPasswordSchema=E;exports.createSignInSchema=M;exports.createSignUpSchema=z;exports.createSocialLoginUrl=ie;exports.defaultPasswordRules=y;exports.defaultSignInSchema=me;exports.defaultSignUpSchema=de;exports.emailSchema=V;exports.formatAuthError=le;exports.formatProviderName=j;exports.formatSocialLoginText=re;exports.generateRandomString=H;exports.getProviderColor=ne;exports.getProviderIcon=ae;exports.isBrowser=ue;exports.isValidEmail=se;exports.openSocialLoginPopup=ce;exports.providerInfo=T;exports.requestToControllerValidation=$;exports.resetPasswordSchema=N;exports.socialProviderInfo=d;exports.useAuthEmailProp=D;exports.validateEmail=he;exports.validatePassword=ge;
@@ -4,9 +4,9 @@ import { t as de, u as G, a as ne, b as A } from "./use-form-Dn6v2tEh.js";
4
4
  import { o as H, b as F, s as C, M as he } from "./modal-DBguyX-b.js";
5
5
  import { Validation as te } from "@tempots/std";
6
6
  import { d as f, A as x } from "./translations-A4kR7CW8.js";
7
- import { P as O, E as j, N as X } from "./notice-BKcyJD5w.js";
7
+ import { P as O, E as j, N as X } from "./notice-Dtz7ADVH.js";
8
8
  import { B as M } from "./input-container-BvEcp7FU.js";
9
- import { T as ge } from "./text-input-DfqXolVe.js";
9
+ import { T as ge } from "./text-input-dDUEUmlC.js";
10
10
  import { I as fe } from "./translations-B1_yyDUK.js";
11
11
  import { classes as be } from "@tempots/ui";
12
12
  const Y = {
package/dist/beatui.css CHANGED
@@ -3375,15 +3375,27 @@ a:focus-visible {
3375
3375
  }
3376
3376
 
3377
3377
  .bc-input-container .bc-color-input__swatch {
3378
+ position: relative;
3378
3379
  width: calc(var(--spacing-base) * 7.2);
3379
3380
  height: calc(var(--spacing-base) * 7.2);
3380
3381
  cursor: pointer;
3381
3382
  border: var(--border-width-thin) solid var(--color-neutral-300);
3382
3383
  border-radius: 100%;
3384
+ overflow: hidden;
3383
3385
  }
3384
3386
 
3385
- .bc-input-container .bc-color-input__swatch input {
3387
+ .bc-color-input__swatch-native {
3388
+ position: absolute;
3389
+ inset: 0;
3390
+ width: 100%;
3391
+ height: 100%;
3392
+ border: 0;
3393
+ padding: 0;
3394
+ margin: 0;
3386
3395
  opacity: 0;
3396
+ cursor: pointer;
3397
+ -webkit-appearance: none;
3398
+ appearance: none;
3387
3399
  }
3388
3400
 
3389
3401
  .bc-color-swatch-input__control--alpha {
@@ -3475,7 +3487,6 @@ a:focus-visible {
3475
3487
  outline: var(--outline-width-focus) solid var(--color-danger-400);
3476
3488
  }
3477
3489
 
3478
-
3479
3490
  .bc-command-palette {
3480
3491
  display: flex;
3481
3492
  flex-direction: column;
@@ -11112,22 +11123,31 @@ export type OverlayMode = 'capturing' | 'non-capturing' */
11112
11123
  .bc-scrollable-panel--header-shadow > div,
11113
11124
  .bc-scrollable-panel--footer-shadow > div {
11114
11125
  width: 100%;
11115
- height: var(--spacing-lgh);
11126
+ height: 0;
11116
11127
  position: absolute;
11128
+ left: 0;
11117
11129
  opacity: 0;
11118
11130
  transition: opacity
11119
11131
  var(--motion-transition-fast, var(--motion-duration-fast, 0.2s))
11120
11132
  var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1));
11133
+ background: linear-gradient(
11134
+ var(--gradient-direction, to bottom),
11135
+ rgb(0 0 0 / 0.04),
11136
+ transparent
11137
+ );
11138
+ pointer-events: none;
11121
11139
  }
11122
11140
 
11123
11141
  .bc-scrollable-panel--header-shadow > div {
11124
- bottom: 0;
11125
- box-shadow: var(--shadow-surface-elevated, var(--shadow-md));
11142
+ --gradient-direction: to bottom;
11143
+ top: 0;
11144
+ height: 6px;
11126
11145
  }
11127
11146
 
11128
11147
  .bc-scrollable-panel--footer-shadow > div {
11129
- top: 0;
11130
- box-shadow: var(--shadow-top-md, 0 -2px 6px rgba(0, 0, 0, 0.08));
11148
+ --gradient-direction: to top;
11149
+ bottom: 0;
11150
+ height: 6px;
11131
11151
  }
11132
11152
 
11133
11153
  /* Show header shadow when scrolled down */
@@ -16861,6 +16881,11 @@ span.bc-sidebar-link {
16861
16881
  }
16862
16882
 
16863
16883
  /* Column Reorder Drag */
16884
+ th[draggable='true'] {
16885
+ background-color: var(--bg-surface);
16886
+ cursor: grab;
16887
+ }
16888
+
16864
16889
  th.bc-data-table__header--dragging {
16865
16890
  opacity: 0.5;
16866
16891
  }
@@ -3041,15 +3041,27 @@ a:focus-visible {
3041
3041
  }
3042
3042
 
3043
3043
  .bc-input-container .bc-color-input__swatch {
3044
+ position: relative;
3044
3045
  width: calc(var(--spacing-base) * 7.2);
3045
3046
  height: calc(var(--spacing-base) * 7.2);
3046
3047
  cursor: pointer;
3047
3048
  border: var(--border-width-thin) solid var(--color-neutral-300);
3048
3049
  border-radius: 100%;
3050
+ overflow: hidden;
3049
3051
  }
3050
3052
 
3051
- .bc-input-container .bc-color-input__swatch input {
3053
+ .bc-color-input__swatch-native {
3054
+ position: absolute;
3055
+ inset: 0;
3056
+ width: 100%;
3057
+ height: 100%;
3058
+ border: 0;
3059
+ padding: 0;
3060
+ margin: 0;
3052
3061
  opacity: 0;
3062
+ cursor: pointer;
3063
+ -webkit-appearance: none;
3064
+ appearance: none;
3053
3065
  }
3054
3066
 
3055
3067
  .bc-color-swatch-input__control--alpha {
@@ -3141,7 +3153,6 @@ a:focus-visible {
3141
3153
  outline: var(--outline-width-focus) solid var(--color-danger-400);
3142
3154
  }
3143
3155
 
3144
-
3145
3156
  .bc-command-palette {
3146
3157
  display: flex;
3147
3158
  flex-direction: column;
@@ -10778,22 +10789,31 @@ export type OverlayMode = 'capturing' | 'non-capturing' */
10778
10789
  .bc-scrollable-panel--header-shadow > div,
10779
10790
  .bc-scrollable-panel--footer-shadow > div {
10780
10791
  width: 100%;
10781
- height: var(--spacing-lgh);
10792
+ height: 0;
10782
10793
  position: absolute;
10794
+ left: 0;
10783
10795
  opacity: 0;
10784
10796
  transition: opacity
10785
10797
  var(--motion-transition-fast, var(--motion-duration-fast, 0.2s))
10786
10798
  var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1));
10799
+ background: linear-gradient(
10800
+ var(--gradient-direction, to bottom),
10801
+ rgb(0 0 0 / 0.04),
10802
+ transparent
10803
+ );
10804
+ pointer-events: none;
10787
10805
  }
10788
10806
 
10789
10807
  .bc-scrollable-panel--header-shadow > div {
10790
- bottom: 0;
10791
- box-shadow: var(--shadow-surface-elevated, var(--shadow-md));
10808
+ --gradient-direction: to bottom;
10809
+ top: 0;
10810
+ height: 6px;
10792
10811
  }
10793
10812
 
10794
10813
  .bc-scrollable-panel--footer-shadow > div {
10795
- top: 0;
10796
- box-shadow: var(--shadow-top-md, 0 -2px 6px rgba(0, 0, 0, 0.08));
10814
+ --gradient-direction: to top;
10815
+ bottom: 0;
10816
+ height: 6px;
10797
10817
  }
10798
10818
 
10799
10819
  /* Show header shadow when scrolled down */
@@ -16527,6 +16547,11 @@ span.bc-sidebar-link {
16527
16547
  }
16528
16548
 
16529
16549
  /* Column Reorder Drag */
16550
+ th[draggable='true'] {
16551
+ background-color: var(--bg-surface);
16552
+ cursor: grab;
16553
+ }
16554
+
16530
16555
  th.bc-data-table__header--dragging {
16531
16556
  opacity: 0.5;
16532
16557
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),L=require("../auth-divider-MMhfmLBu.cjs"),I=require("../translations-Dbx7L7Q1.cjs"),w=require("../notice-B5wTXoTq.cjs"),y=require("../stack-dwLevGa2.cjs"),b=require("../input-container-Di1YvVB_.cjs"),v=require("../text-input-X_q01NsY.cjs");function g(a,t){return a.error?(t.onError?.({message:a.error.message,status:a.error.status}),a.error.message):null}function F(a,t,s){return async n=>{const i=await a.signIn.email({email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function A(a,t,s){return async n=>{const i=await a.signUp.email({name:n.name,email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function U(a,t){return async s=>{const n=await a.requestPasswordReset({email:s.email,redirectTo:t.callbackURL});return g(n,t)}}function $(a,t){return async s=>{const n=await a.signIn.social({provider:s,callbackURL:t.callbackURL,errorCallbackURL:t.errorCallbackURL});g(n,t)}}function P(a,t={}){const s=e.prop(null),n=e.prop(!0),i=e.computedOf(s)(h=>h?.user??null),o=e.computedOf(s)(h=>h!=null);let u;async function d(){try{const h=await a.getSession();h.error||!h.data?s.set(null):s.set({user:h.data.user,session:h.data.session})}catch{s.set(null)}finally{n.set(!1)}}t.onSessionChange&&s.on(t.onSessionChange),d(),t.refreshInterval&&t.refreshInterval>0&&(u=setInterval(d,t.refreshInterval));function p(){u!=null&&(clearInterval(u),u=void 0),s.dispose(),n.dispose(),i.dispose(),o.dispose()}return{session:s,isPending:n,user:i,isAuthenticated:o,refresh:d,dispose:p}}function _(a){return a.map(t=>({provider:t}))}function C(a,t={}){const s=P(a,{refreshInterval:t.refreshInterval,onSessionChange:t.onSessionChange}),n=()=>s.refresh(),i=F(a,t,n),o=A(a,t,n),u=U(a,t),d=$(a,t),p=t.socialProviders?_(t.socialProviders):[],h={onSignIn:i,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,labels:t.labels?{emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,rememberMeLabel:t.labels.rememberMeLabel,signInButton:t.labels.signInButton,forgotPasswordLink:t.labels.forgotPasswordLink,noAccountLink:t.labels.noAccountLink}:void 0},c={onSignUp:o,passwordRules:t.passwordRules,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels?{nameLabel:t.labels.nameLabel,emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,confirmPasswordLabel:t.labels.confirmPasswordLabel,acceptTermsLabel:t.labels.acceptTermsLabel,signUpButton:t.labels.signUpButton,hasAccountLink:t.labels.hasAccountLink}:void 0},m={onResetPassword:u,labels:t.labels?{resetPasswordButton:t.labels.resetPasswordButton,resetPasswordDescription:t.labels.resetPasswordDescription,emailLabel:t.labels.emailLabel,backToSignInLink:t.labels.backToSignInLink}:void 0},l={onSignIn:i,onSignUp:o,onResetPassword:u,onSocialLogin:d,socialProviders:p.length>0?p:void 0,showSocialDivider:p.length>0,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels};async function r(){await a.signOut(),await n()}function f(){s.dispose()}return{session:s.session,isPending:s.isPending,user:s.user,isAuthenticated:s.isAuthenticated,containerOptions:l,signInOptions:h,signUpOptions:c,resetOptions:m,socialProviders:p,signOut:r,refreshSession:n,dispose:f}}const R={mark:e.makeProviderMark("BetterAuth"),create:a=>{if(!a)throw new Error("BetterAuth provider requires a client option");const t=C(a.client,a);return{value:t,dispose:()=>t.dispose()}}};function E(a,t,...s){return L.AuthContainer({...a.containerOptions,...t},...s)}function O(a,t){return L.AuthModal(s=>t(n=>s({...a.containerOptions,...n})))}function M(a,t){return e.When(a.isAuthenticated,t)}function D(a,t){return e.Unless(a.isAuthenticated,t)}const T={twoFactorSetupDescription:"Enter your password to enable two-factor authentication.",twoFactorEnableButton:"Enable 2FA",twoFactorVerifyButton:"Verify",twoFactorScanDescription:"Scan the code below with your authenticator app, then enter the verification code.",twoFactorBackupCodesDescription:"Save these backup codes in a safe place. You can use them to sign in if you lose access to your authenticator.",twoFactorCodePlaceholder:"Enter 6-digit code",twoFactorBackupCodePlaceholder:"Enter backup code",twoFactorEnabled:"Two-factor authentication has been enabled.",twoFactorTotpDescription:"Enter the code from your authenticator app.",twoFactorOtpDescription:"Enter the one-time code sent to you.",twoFactorBackupDescription:"Enter one of your backup codes.",twoFactorSendOtpButton:"Send Code",twoFactorMethodLabel:a=>{switch(a){case"totp":return"Authenticator";case"otp":return"Email/SMS";case"backup":return"Backup Code";default:return a}},passwordPlaceholder:"Enter your password",magicLinkDescription:"Enter your email to receive a sign-in link.",magicLinkSendButton:"Send Magic Link",magicLinkSent:"A sign-in link has been sent to your email.",passkeySignInButton:"Sign in with Passkey",passkeyAddButton:"Add Passkey",passkeyDeleteButton:"Delete",passkeyRenameButton:"Rename",passkeySaveButton:"Save",passkeyCancelButton:"Cancel",passkeyNamePlaceholder:"Passkey name (optional)",passkeyUnnamed:"Unnamed passkey"},B=T,S="en",N=Object.assign({}),k=I.makeI18nProvider({defaultLocale:S,defaultMessages:B,localeLoader:async a=>{if(a===S)return B;const t=N[`./locales/${a}.ts`];return t?await t():B},providerName:"BetterAuthI18n"});function q({twoFactor:a,issuer:t,onComplete:s}){const n=e.prop(""),i=e.prop(null),o=e.prop([]),u=e.prop(""),d=e.prop(null),p=e.prop(!1),h=e.prop("password");async function c(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.enable({password:n.value,issuer:t});if(p.set(!1),r.error){d.set(r.error.message);return}r.data&&(i.set(r.data.totpURI),o.set(r.data.backupCodes),h.set("verify"))}async function m(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.verifyTotp({code:u.value});if(p.set(!1),r.error){d.set(r.error.message);return}h.set("complete"),s?.()}return e.Use(k,l=>e.html.div(e.attr.class("bc-two-factor"),e.Ensure(d,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.OneOfValue(h,{password:()=>e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(c),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),l.$.twoFactorSetupDescription),w.PasswordInput({value:n,onChange:r=>n.set(r),placeholder:l.$.passwordPlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorEnableButton))),verify:()=>e.Fragment(e.Ensure(i,r=>e.html.div(e.attr.class("bc-two-factor__totp-uri"),e.html.p(l.$.twoFactorScanDescription),e.html.code(e.attr.class("bc-two-factor__code-display"),r))),e.NotEmpty(o,()=>e.html.div(e.attr.class("bc-two-factor__backup-codes"),e.html.p(l.$.twoFactorBackupCodesDescription),e.html.ul(e.ForEach(o,r=>e.html.li(r))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(m),y.Stack(v.TextInput({value:u,onChange:r=>u.set(r),placeholder:l.$.twoFactorCodePlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorVerifyButton)))),complete:()=>e.html.div(e.attr.class("bc-two-factor__complete"),w.Notice({variant:"success",tone:"prominent"},e.html.div(l.$.twoFactorEnabled)))})))}function x({twoFactor:a,methods:t=["totp","backup"],trustDevice:s,onVerified:n}){const i=e.prop(""),o=e.prop(null),u=e.prop(!1),d=e.prop(t[0]??"totp");async function p(c){c.preventDefault(),u.set(!0),o.set(null);const m=d.value;let l;if(m==="totp")l=await a.verifyTotp({code:i.value,trustDevice:s});else if(m==="otp"&&a.verifyOtp)l=await a.verifyOtp({code:i.value,trustDevice:s});else if(m==="backup")l=await a.verifyBackupCode({code:i.value});else{o.set("Unsupported verification method"),u.set(!1);return}if(u.set(!1),l.error){o.set(l.error.message);return}n?.()}async function h(){if(!a.sendOtp)return;u.set(!0),o.set(null);const c=await a.sendOtp({trustDevice:s});u.set(!1),c.error&&o.set(c.error.message)}return e.Use(k,c=>{const m=e.computedOf(d,c)((r,f)=>r==="totp"?f.twoFactorTotpDescription:r==="otp"?f.twoFactorOtpDescription:f.twoFactorBackupDescription),l=e.computedOf(d,c)((r,f)=>r==="backup"?f.twoFactorBackupCodePlaceholder:f.twoFactorCodePlaceholder);return e.html.div(e.attr.class("bc-two-factor"),e.Ensure(o,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.When(t.length>1,()=>e.html.div(e.attr.class("bc-two-factor__methods"),...t.map(r=>e.html.button(e.attr.type("button"),e.attr.class("bc-two-factor__method-button"),e.attr.class(d.map(f=>f===r?"bc-two-factor__method-button--active":"")),e.on.click(()=>{d.set(r),i.set(""),o.set(null)}),c.$.twoFactorMethodLabel.map(f=>f(r)))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(p),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),m),e.When(d.map(r=>r==="otp"&&a.sendOtp!=null),()=>b.Button({type:"button",variant:"outline",color:"primary",onClick:h,loading:u},c.$.twoFactorSendOtpButton)),v.TextInput({value:i,onChange:r=>i.set(r),placeholder:l}),b.Button({type:"submit",variant:"filled",color:"primary",loading:u},e.attr.class("bc-auth-form__submit"),c.$.twoFactorVerifyButton))))})}function V({client:a,callbackURL:t}){const s=e.prop(""),n=e.prop(null),i=e.prop(!1),o=e.prop(!1);async function u(d){if(d.preventDefault(),!a.signIn.magicLink){n.set("Magic link sign-in is not configured");return}i.set(!0),n.set(null);const p=await a.signIn.magicLink({email:s.value,callbackURL:t});if(i.set(!1),p.error){n.set(p.error.message);return}o.set(!0)}return e.Use(k,d=>e.html.div(e.attr.class("bc-auth-form"),e.Ensure(n,p=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(p))),e.Unless(o,()=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(u),y.Stack(e.attr.class("bc-auth-form__fields"),e.html.p(e.attr.class("bc-auth-form__description"),d.$.magicLinkDescription),w.EmailInput({value:s,onChange:p=>s.set(p)}),b.Button({type:"submit",variant:"filled",color:"primary",loading:i},e.attr.class("bc-auth-form__submit"),d.$.magicLinkSendButton)))),e.When(o,()=>w.Notice({variant:"success",tone:"prominent"},e.html.div(d.$.magicLinkSent)))))}function W({client:a,autoFill:t,onSuccess:s,onError:n}){const i=e.prop(!1);async function o(){if(!a.signIn.passkey)return;i.set(!0);const u=await a.signIn.passkey({autoFill:t});if(i.set(!1),u.error){n?.({message:u.error.message,status:u.error.status});return}s?.()}return e.Use(k,u=>b.Button({type:"button",variant:"outline",color:"primary",onClick:o,loading:i},e.attr.class("bc-passkey-signin"),u.$.passkeySignInButton))}function z({passkey:a}){const t=e.prop([]),s=e.prop(null),n=e.prop(!1),i=e.prop("");async function o(c,m){n.set(!0),s.set(null);const l=await c();if(n.set(!1),l.error){s.set(l.error.message);return}await m?.(l.data)}async function u(){await o(()=>a.listUserPasskeys(),c=>t.set(c??[]))}async function d(){const c=i.value||void 0;await o(()=>a.addPasskey({name:c}),async()=>{i.set(""),await u()})}async function p(c){await o(()=>a.deletePasskey({id:c}),()=>u())}async function h(c,m){await o(()=>a.updatePasskey({id:c,name:m}),()=>u())}return u(),e.Use(k,c=>e.html.div(e.attr.class("bc-passkey-management"),e.Ensure(s,m=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(m))),e.html.div(e.attr.class("bc-passkey-list"),e.ForEach(t,m=>{const l=e.prop(!1),r=e.prop(m.$.name?.value??"");return e.html.div(e.attr.class("bc-passkey-item"),e.Unless(l,()=>e.html.div(e.attr.class("bc-passkey-item__info"),e.html.span(e.attr.class("bc-passkey-item__name"),m.$.name?.map(f=>f??c.$.passkeyUnnamed.value)??c.$.passkeyUnnamed),e.html.span(e.attr.class("bc-passkey-item__date"),m.$.createdAt))),e.When(l,()=>e.html.div(e.attr.class("bc-passkey-item__edit"),v.TextInput({value:r,onChange:f=>r.set(f)}))),e.html.div(e.attr.class("bc-passkey-item__actions"),e.Unless(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:()=>{r.set(m.$.name?.value??""),l.set(!0)}},c.$.passkeyRenameButton),b.Button({type:"button",variant:"text",size:"sm",color:"danger",onClick:()=>p(m.$.id.value)},c.$.passkeyDeleteButton))),e.When(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:async()=>{await h(m.$.id.value,r.value),l.set(!1)}},c.$.passkeySaveButton),b.Button({type:"button",variant:"text",size:"sm",onClick:()=>l.set(!1)},c.$.passkeyCancelButton)))))})),e.html.div(e.attr.class("bc-passkey-add"),y.Stack(v.TextInput({value:i,onChange:m=>i.set(m),placeholder:c.$.passkeyNamePlaceholder}),b.Button({type:"button",variant:"filled",color:"primary",onClick:d,loading:n},c.$.passkeyAddButton)))))}exports.Authenticated=M;exports.BetterAuth=R;exports.BetterAuthContainer=E;exports.BetterAuthI18n=k;exports.BetterAuthModal=O;exports.MagicLinkForm=V;exports.PasskeyManagement=z;exports.PasskeySignIn=W;exports.TwoFactorSetup=q;exports.TwoFactorVerify=x;exports.Unauthenticated=D;exports.createBetterAuthBridge=C;exports.createSessionManager=P;exports.mapSocialProviders=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),L=require("../auth-divider-3t_-R0sL.cjs"),I=require("../translations-Dbx7L7Q1.cjs"),w=require("../notice-BNghd0oS.cjs"),y=require("../stack-dwLevGa2.cjs"),b=require("../input-container-Di1YvVB_.cjs"),v=require("../text-input-DL9FvpTZ.cjs");function g(a,t){return a.error?(t.onError?.({message:a.error.message,status:a.error.status}),a.error.message):null}function F(a,t,s){return async n=>{const i=await a.signIn.email({email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function A(a,t,s){return async n=>{const i=await a.signUp.email({name:n.name,email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function U(a,t){return async s=>{const n=await a.requestPasswordReset({email:s.email,redirectTo:t.callbackURL});return g(n,t)}}function $(a,t){return async s=>{const n=await a.signIn.social({provider:s,callbackURL:t.callbackURL,errorCallbackURL:t.errorCallbackURL});g(n,t)}}function P(a,t={}){const s=e.prop(null),n=e.prop(!0),i=e.computedOf(s)(h=>h?.user??null),o=e.computedOf(s)(h=>h!=null);let u;async function d(){try{const h=await a.getSession();h.error||!h.data?s.set(null):s.set({user:h.data.user,session:h.data.session})}catch{s.set(null)}finally{n.set(!1)}}t.onSessionChange&&s.on(t.onSessionChange),d(),t.refreshInterval&&t.refreshInterval>0&&(u=setInterval(d,t.refreshInterval));function p(){u!=null&&(clearInterval(u),u=void 0),s.dispose(),n.dispose(),i.dispose(),o.dispose()}return{session:s,isPending:n,user:i,isAuthenticated:o,refresh:d,dispose:p}}function _(a){return a.map(t=>({provider:t}))}function C(a,t={}){const s=P(a,{refreshInterval:t.refreshInterval,onSessionChange:t.onSessionChange}),n=()=>s.refresh(),i=F(a,t,n),o=A(a,t,n),u=U(a,t),d=$(a,t),p=t.socialProviders?_(t.socialProviders):[],h={onSignIn:i,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,labels:t.labels?{emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,rememberMeLabel:t.labels.rememberMeLabel,signInButton:t.labels.signInButton,forgotPasswordLink:t.labels.forgotPasswordLink,noAccountLink:t.labels.noAccountLink}:void 0},c={onSignUp:o,passwordRules:t.passwordRules,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels?{nameLabel:t.labels.nameLabel,emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,confirmPasswordLabel:t.labels.confirmPasswordLabel,acceptTermsLabel:t.labels.acceptTermsLabel,signUpButton:t.labels.signUpButton,hasAccountLink:t.labels.hasAccountLink}:void 0},m={onResetPassword:u,labels:t.labels?{resetPasswordButton:t.labels.resetPasswordButton,resetPasswordDescription:t.labels.resetPasswordDescription,emailLabel:t.labels.emailLabel,backToSignInLink:t.labels.backToSignInLink}:void 0},l={onSignIn:i,onSignUp:o,onResetPassword:u,onSocialLogin:d,socialProviders:p.length>0?p:void 0,showSocialDivider:p.length>0,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels};async function r(){await a.signOut(),await n()}function f(){s.dispose()}return{session:s.session,isPending:s.isPending,user:s.user,isAuthenticated:s.isAuthenticated,containerOptions:l,signInOptions:h,signUpOptions:c,resetOptions:m,socialProviders:p,signOut:r,refreshSession:n,dispose:f}}const R={mark:e.makeProviderMark("BetterAuth"),create:a=>{if(!a)throw new Error("BetterAuth provider requires a client option");const t=C(a.client,a);return{value:t,dispose:()=>t.dispose()}}};function E(a,t,...s){return L.AuthContainer({...a.containerOptions,...t},...s)}function O(a,t){return L.AuthModal(s=>t(n=>s({...a.containerOptions,...n})))}function M(a,t){return e.When(a.isAuthenticated,t)}function D(a,t){return e.Unless(a.isAuthenticated,t)}const T={twoFactorSetupDescription:"Enter your password to enable two-factor authentication.",twoFactorEnableButton:"Enable 2FA",twoFactorVerifyButton:"Verify",twoFactorScanDescription:"Scan the code below with your authenticator app, then enter the verification code.",twoFactorBackupCodesDescription:"Save these backup codes in a safe place. You can use them to sign in if you lose access to your authenticator.",twoFactorCodePlaceholder:"Enter 6-digit code",twoFactorBackupCodePlaceholder:"Enter backup code",twoFactorEnabled:"Two-factor authentication has been enabled.",twoFactorTotpDescription:"Enter the code from your authenticator app.",twoFactorOtpDescription:"Enter the one-time code sent to you.",twoFactorBackupDescription:"Enter one of your backup codes.",twoFactorSendOtpButton:"Send Code",twoFactorMethodLabel:a=>{switch(a){case"totp":return"Authenticator";case"otp":return"Email/SMS";case"backup":return"Backup Code";default:return a}},passwordPlaceholder:"Enter your password",magicLinkDescription:"Enter your email to receive a sign-in link.",magicLinkSendButton:"Send Magic Link",magicLinkSent:"A sign-in link has been sent to your email.",passkeySignInButton:"Sign in with Passkey",passkeyAddButton:"Add Passkey",passkeyDeleteButton:"Delete",passkeyRenameButton:"Rename",passkeySaveButton:"Save",passkeyCancelButton:"Cancel",passkeyNamePlaceholder:"Passkey name (optional)",passkeyUnnamed:"Unnamed passkey"},B=T,S="en",N=Object.assign({}),k=I.makeI18nProvider({defaultLocale:S,defaultMessages:B,localeLoader:async a=>{if(a===S)return B;const t=N[`./locales/${a}.ts`];return t?await t():B},providerName:"BetterAuthI18n"});function q({twoFactor:a,issuer:t,onComplete:s}){const n=e.prop(""),i=e.prop(null),o=e.prop([]),u=e.prop(""),d=e.prop(null),p=e.prop(!1),h=e.prop("password");async function c(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.enable({password:n.value,issuer:t});if(p.set(!1),r.error){d.set(r.error.message);return}r.data&&(i.set(r.data.totpURI),o.set(r.data.backupCodes),h.set("verify"))}async function m(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.verifyTotp({code:u.value});if(p.set(!1),r.error){d.set(r.error.message);return}h.set("complete"),s?.()}return e.Use(k,l=>e.html.div(e.attr.class("bc-two-factor"),e.Ensure(d,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.OneOfValue(h,{password:()=>e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(c),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),l.$.twoFactorSetupDescription),w.PasswordInput({value:n,onChange:r=>n.set(r),placeholder:l.$.passwordPlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorEnableButton))),verify:()=>e.Fragment(e.Ensure(i,r=>e.html.div(e.attr.class("bc-two-factor__totp-uri"),e.html.p(l.$.twoFactorScanDescription),e.html.code(e.attr.class("bc-two-factor__code-display"),r))),e.NotEmpty(o,()=>e.html.div(e.attr.class("bc-two-factor__backup-codes"),e.html.p(l.$.twoFactorBackupCodesDescription),e.html.ul(e.ForEach(o,r=>e.html.li(r))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(m),y.Stack(v.TextInput({value:u,onChange:r=>u.set(r),placeholder:l.$.twoFactorCodePlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorVerifyButton)))),complete:()=>e.html.div(e.attr.class("bc-two-factor__complete"),w.Notice({variant:"success",tone:"prominent"},e.html.div(l.$.twoFactorEnabled)))})))}function x({twoFactor:a,methods:t=["totp","backup"],trustDevice:s,onVerified:n}){const i=e.prop(""),o=e.prop(null),u=e.prop(!1),d=e.prop(t[0]??"totp");async function p(c){c.preventDefault(),u.set(!0),o.set(null);const m=d.value;let l;if(m==="totp")l=await a.verifyTotp({code:i.value,trustDevice:s});else if(m==="otp"&&a.verifyOtp)l=await a.verifyOtp({code:i.value,trustDevice:s});else if(m==="backup")l=await a.verifyBackupCode({code:i.value});else{o.set("Unsupported verification method"),u.set(!1);return}if(u.set(!1),l.error){o.set(l.error.message);return}n?.()}async function h(){if(!a.sendOtp)return;u.set(!0),o.set(null);const c=await a.sendOtp({trustDevice:s});u.set(!1),c.error&&o.set(c.error.message)}return e.Use(k,c=>{const m=e.computedOf(d,c)((r,f)=>r==="totp"?f.twoFactorTotpDescription:r==="otp"?f.twoFactorOtpDescription:f.twoFactorBackupDescription),l=e.computedOf(d,c)((r,f)=>r==="backup"?f.twoFactorBackupCodePlaceholder:f.twoFactorCodePlaceholder);return e.html.div(e.attr.class("bc-two-factor"),e.Ensure(o,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.When(t.length>1,()=>e.html.div(e.attr.class("bc-two-factor__methods"),...t.map(r=>e.html.button(e.attr.type("button"),e.attr.class("bc-two-factor__method-button"),e.attr.class(d.map(f=>f===r?"bc-two-factor__method-button--active":"")),e.on.click(()=>{d.set(r),i.set(""),o.set(null)}),c.$.twoFactorMethodLabel.map(f=>f(r)))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(p),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),m),e.When(d.map(r=>r==="otp"&&a.sendOtp!=null),()=>b.Button({type:"button",variant:"outline",color:"primary",onClick:h,loading:u},c.$.twoFactorSendOtpButton)),v.TextInput({value:i,onChange:r=>i.set(r),placeholder:l}),b.Button({type:"submit",variant:"filled",color:"primary",loading:u},e.attr.class("bc-auth-form__submit"),c.$.twoFactorVerifyButton))))})}function V({client:a,callbackURL:t}){const s=e.prop(""),n=e.prop(null),i=e.prop(!1),o=e.prop(!1);async function u(d){if(d.preventDefault(),!a.signIn.magicLink){n.set("Magic link sign-in is not configured");return}i.set(!0),n.set(null);const p=await a.signIn.magicLink({email:s.value,callbackURL:t});if(i.set(!1),p.error){n.set(p.error.message);return}o.set(!0)}return e.Use(k,d=>e.html.div(e.attr.class("bc-auth-form"),e.Ensure(n,p=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(p))),e.Unless(o,()=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(u),y.Stack(e.attr.class("bc-auth-form__fields"),e.html.p(e.attr.class("bc-auth-form__description"),d.$.magicLinkDescription),w.EmailInput({value:s,onChange:p=>s.set(p)}),b.Button({type:"submit",variant:"filled",color:"primary",loading:i},e.attr.class("bc-auth-form__submit"),d.$.magicLinkSendButton)))),e.When(o,()=>w.Notice({variant:"success",tone:"prominent"},e.html.div(d.$.magicLinkSent)))))}function W({client:a,autoFill:t,onSuccess:s,onError:n}){const i=e.prop(!1);async function o(){if(!a.signIn.passkey)return;i.set(!0);const u=await a.signIn.passkey({autoFill:t});if(i.set(!1),u.error){n?.({message:u.error.message,status:u.error.status});return}s?.()}return e.Use(k,u=>b.Button({type:"button",variant:"outline",color:"primary",onClick:o,loading:i},e.attr.class("bc-passkey-signin"),u.$.passkeySignInButton))}function z({passkey:a}){const t=e.prop([]),s=e.prop(null),n=e.prop(!1),i=e.prop("");async function o(c,m){n.set(!0),s.set(null);const l=await c();if(n.set(!1),l.error){s.set(l.error.message);return}await m?.(l.data)}async function u(){await o(()=>a.listUserPasskeys(),c=>t.set(c??[]))}async function d(){const c=i.value||void 0;await o(()=>a.addPasskey({name:c}),async()=>{i.set(""),await u()})}async function p(c){await o(()=>a.deletePasskey({id:c}),()=>u())}async function h(c,m){await o(()=>a.updatePasskey({id:c,name:m}),()=>u())}return u(),e.Use(k,c=>e.html.div(e.attr.class("bc-passkey-management"),e.Ensure(s,m=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(m))),e.html.div(e.attr.class("bc-passkey-list"),e.ForEach(t,m=>{const l=e.prop(!1),r=e.prop(m.$.name?.value??"");return e.html.div(e.attr.class("bc-passkey-item"),e.Unless(l,()=>e.html.div(e.attr.class("bc-passkey-item__info"),e.html.span(e.attr.class("bc-passkey-item__name"),m.$.name?.map(f=>f??c.$.passkeyUnnamed.value)??c.$.passkeyUnnamed),e.html.span(e.attr.class("bc-passkey-item__date"),m.$.createdAt))),e.When(l,()=>e.html.div(e.attr.class("bc-passkey-item__edit"),v.TextInput({value:r,onChange:f=>r.set(f)}))),e.html.div(e.attr.class("bc-passkey-item__actions"),e.Unless(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:()=>{r.set(m.$.name?.value??""),l.set(!0)}},c.$.passkeyRenameButton),b.Button({type:"button",variant:"text",size:"sm",color:"danger",onClick:()=>p(m.$.id.value)},c.$.passkeyDeleteButton))),e.When(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:async()=>{await h(m.$.id.value,r.value),l.set(!1)}},c.$.passkeySaveButton),b.Button({type:"button",variant:"text",size:"sm",onClick:()=>l.set(!1)},c.$.passkeyCancelButton)))))})),e.html.div(e.attr.class("bc-passkey-add"),y.Stack(v.TextInput({value:i,onChange:m=>i.set(m),placeholder:c.$.passkeyNamePlaceholder}),b.Button({type:"button",variant:"filled",color:"primary",onClick:d,loading:n},c.$.passkeyAddButton)))))}exports.Authenticated=M;exports.BetterAuth=R;exports.BetterAuthContainer=E;exports.BetterAuthI18n=k;exports.BetterAuthModal=O;exports.MagicLinkForm=V;exports.PasskeyManagement=z;exports.PasskeySignIn=W;exports.TwoFactorSetup=q;exports.TwoFactorVerify=x;exports.Unauthenticated=D;exports.createBetterAuthBridge=C;exports.createSessionManager=P;exports.mapSocialProviders=_;
@@ -1,10 +1,10 @@
1
1
  import { prop as b, computedOf as B, makeProviderMark as U, When as y, Unless as C, Use as S, html as r, attr as l, Ensure as g, OneOfValue as D, Fragment as E, NotEmpty as O, ForEach as A, on as L } from "@tempots/dom";
2
- import { b as M, d as T } from "../auth-divider-CbME_yVQ.js";
2
+ import { b as M, d as T } from "../auth-divider-Cp3xGpHr.js";
3
3
  import { m as N } from "../translations-B1_yyDUK.js";
4
- import { N as v, P as V, E as x } from "../notice-BKcyJD5w.js";
4
+ import { N as v, P as V, E as x } from "../notice-Dtz7ADVH.js";
5
5
  import { S as P } from "../stack-BLMteGTn.js";
6
6
  import { B as k } from "../input-container-BvEcp7FU.js";
7
- import { T as I } from "../text-input-DfqXolVe.js";
7
+ import { T as I } from "../text-input-dDUEUmlC.js";
8
8
  function F(t, e) {
9
9
  return t.error ? (e.onError?.({
10
10
  message: t.error.message,
@@ -1 +1 @@
1
- "use strict";const t=require("@tempots/dom"),B=require("./input-container-Di1YvVB_.cjs"),A=require("./text-input-X_q01NsY.cjs"),O=require("./use-form-CaW192gw.cjs"),C=require("./translations-Dbx7L7Q1.cjs"),ut=require("./stack-dwLevGa2.cjs"),L=require("@tempots/std"),Vt=require("@tempots/ui");let G=null;async function H(){const n=globalThis;return n.Temporal?n.Temporal:(G||(G=Promise.resolve().then(()=>require("./index.esm-C6lZ02yY.cjs")).then(e=>{const l=e.Temporal;return n.Temporal||(n.Temporal=l),l})),G)}const ct=(n,e)=>e?t.Task(H,{then:n,pending:e.pending,error:e.error}):t.Task(H,n);function Z({onChange:n,value:e,accept:l="*/*",enableClick:r=!0,content:o,disabled:h=!1,allowMultiple:s}){return t.Use(C.BeatUII18n,f=>{const m=t.Value.deriveProp(e??[]),x=t.prop(!1),p=u=>{u.preventDefault(),u.stopPropagation(),x.value=!0},d=u=>{u.preventDefault(),u.stopPropagation(),(!u.currentTarget||!u.currentTarget.contains(u.relatedTarget))&&(x.value=!1)},b=u=>{u.preventDefault(),u.stopPropagation(),x.value=!1;const g=Array.from(u.dataTransfer?.files||[]);g.length>0&&(m.value=g,n(g,"dragdrop"))},a=u=>{t.Value.get(r)&&u.currentTarget.querySelector('input[type="file"]')?.click()};let c=null;const V=()=>{if(c==null)return;const u=Array.from(c.files??[]);u.length>0&&(m.value=u,n(u,"click")),c.value=""},k=u=>{t.Value.get(r)&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(u))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(r,u=>u?0:-1)),t.attr.style("position: relative;"),t.on.dragover(p),t.on.dragleave(d),t.on.drop(b),t.on.click(a),t.on.keydown(k),t.html.input(t.attr.type("file"),t.attr.disabled(h),t.attr.accept(l),t.attr.multiple(s),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(V),t.WithElement(u=>(c=u,m.on(g=>{const _=globalThis.DataTransfer;if(_!=null){const w=new _;g.forEach(M=>w.items.add(M)),u.files=w.files}}),t.Empty))),t.aria.label(t.bind(f.$.dropZoneInstructions)(r)),o({files:m,clear:()=>m.value=[],change:u=>m.set(u)}))})}const K="$$tts-exp-",pt=(n,e)=>t.WithElement(l=>{const r=`${K}${n}`;return t.OnDispose(t.Value.on(e,o=>Reflect.set(l,r,o)))}),wt=(n,e)=>{const l=`${K}${n}`;return r=>{e(Reflect.get(r.target,l))}},X=(n,e)=>{const l=`${K}${n}`;return r=>{const o=r.target,h=o.selectedIndex,s=o.options[h];e(Reflect.get(s,l))}},ft=(n,e,l)=>t.Ensure(n,r=>t.OneOfType(r,{value:o=>{const h=t.computedOf(o,l)((s,f)=>e(s.value,f));return t.html.option(t.attr.selected(h),pt("value",o.$.value),o.$.label)},group:o=>t.html.optgroup(t.attr.label(o.$.group),t.ForEach(o.$.options,h=>ft(h,e,l))),break:()=>t.html.hr()})),dt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,options:h,unselectedLabel:s,equality:f=(p,d)=>p===d,after:m}=n;let x;return B.InputContainer({...n,after:t.Fragment(B.InputIcon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),m),input:t.html.select(t.WithElement(p=>{x=p;const d=new MutationObserver(b=>{const{removedNodes:a}=b[0];a.length>0&&(x.selectedIndex=0)});return d.observe(p,{childList:!0}),t.OnDispose(()=>d.disconnect())}),A.CommonInputAttributes(n),t.attr.class("bc-native-select bc-input"),t.Use(C.BeatUII18n,p=>t.html.option(t.attr.hidden("hidden"),t.coalesce(s,p.$.selectOne))),t.ForEach(h,p=>ft(p,f,e)),l!=null?t.on.blur(l):t.Empty,r!=null?t.on.change(X("value",p=>r(p))):t.Empty,o!=null?t.on.input(X("value",p=>o(p))):t.Empty)},t.on.click(()=>{if(x?.focus(),typeof x?.showPicker=="function")try{x.showPicker()}catch{}}))};function mt(n){const{controller:e,onChange:l,onBlur:r,...o}=n;return dt({...o,value:e.signal,onChange:O.makeOnChangeHandler(e,l),onBlur:O.makeOnBlurHandler(e,r)})}function Ct(n){return O.InputWrapper({...n,content:mt(n)})}function tt(n,e,l){const r=t.Value.map(n,s=>s!=null),o=t.computedOf(r,e??!1)((s,f)=>!s||f),h=C.defaultMessages.clearValue;return t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(h),t.attr.title(h),t.attr.disabled(o),C.Icon({icon:"mdi:close",size:"sm"}),t.on.click(s=>{s.stopPropagation(),l?.(null)}))}function Q(...n){return t.html.div(t.attr.class("bc-group"),...n)}function _t(n){const e=String(n),l=e.indexOf(".");return l===-1?0:e.length-l-1}function N(n,e){const l=_t(e);if(l===0)return Math.round(n);const r=Math.pow(10,l);return Math.round(n*r)/r}const kt=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:s,onInput:f,after:m}=n,x=b=>{const a=r!=null?t.Value.get(r):void 0,c=o!=null?t.Value.get(o):void 0;return a!=null&&b<a?a:c!=null&&b>c?c:b},p=l!=null?t.Use(C.BeatUII18n,b=>{const a=t.computedOf(e,r)((u,g)=>g==null?!0:(u??0)>g),c=t.computedOf(e,o)((u,g)=>g==null?!0:(u??0)<g),V=u=>{const g=t.Value.get(e)??0,_=t.Value.get(l),w=u?.shiftKey?10:1,M=N(g-_*w,_),I=r!=null?t.Value.get(r):void 0;if(I!=null&&M<I)return;const i=x(M);i!==g&&(s?.(i),f?.(i))},k=u=>{const g=t.Value.get(e)??0,_=t.Value.get(l),w=u?.shiftKey?10:1,M=N(g+_*w,_),I=o!=null?t.Value.get(o):void 0;if(I!=null&&M>I)return;const i=x(M);i!==g&&(s?.(i),f?.(i))};return ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(c,n.disabled??!1)((u,g)=>!u||g)),t.on.click(u=>k(u)),t.aria.label(b.$.incrementValue),C.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(a,n.disabled??!1)((u,g)=>!u||g)),t.on.click(u=>V(u)),t.aria.label(b.$.decrementValue),C.Icon({icon:"line-md:minus",size:"xs"})))}):null,d=m!=null&&p!=null?t.Fragment(p,m):m??p;return B.InputContainer({...n,input:t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,A.CommonInputAttributes(n),t.attr.valueAsNumber(e),t.attr.step(l),t.attr.class("bc-input bc-number-input"),h!=null?t.on.blur(t.emitValue(h)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,f!=null?t.on.input(t.emitValueAsNumber(f)):t.Empty,l!=null?t.on.wheel(b=>{b.preventDefault();const a=t.Value.get(e)??0,c=t.Value.get(l),V=b.shiftKey?10:1,k=b.deltaY<0?c*V:-c*V,u=x(N(a+k,c));u!==a&&(s?.(u),f?.(u))}):t.Empty),after:d})};function Et(n,e){return n.length===e.length&&n.every((l,r)=>l===e[r])}function Dt(n,e,l){const r=["bc-segmented-input",`bc-segmented-input--size-${n}`];return l==="squared"&&r.push("bc-segmented-input--squared"),e&&r.push("bc-segmented-input--disabled"),r.join(" ")}function Ut(n){if(n==null)return"";const e=new Map,l=C.backgroundValue(n,"solid","light"),r=C.backgroundValue(n,"solid","dark");return e.set("--si-indicator-bg",l.backgroundColor),e.set("--si-active-text",l.textColor),e.set("--si-indicator-bg-dark",r.backgroundColor),e.set("--si-active-text-dark",r.textColor),Array.from(e.entries()).map(([o,h])=>`${o}: ${h}`).join("; ")}function Mt({options:n,value:e,onChange:l,size:r="md",disabled:o=!1,variant:h="pill",color:s},...f){const m=L.objectEntries(n).map(([x,p])=>({key:x,label:p}));return t.WithElement(()=>{const x=Object.fromEntries(m.map((d,b)=>[d.key,b])),p=t.prop(m.map(()=>({left:0,width:0})),Et);return t.html.div(t.attr.class(t.computedOf(r,o,h)((d,b,a)=>Dt(d??"md",b??!1,a??"pill"))),t.attr.style(s!=null?t.Value.map(s,d=>Ut(d)):""),t.html.div(t.attr.class("bc-segmented-input__container"),t.html.div(t.attr.class("bc-segmented-input__indicator"),t.style.width(t.computedOf(e,p)((d,b)=>{const{width:a}=b[x[d]??0];return`${a}px`})),t.style.left(t.computedOf(e,p)((d,b)=>{const{left:a}=b[x[d]??0];return`${a}px`}))),m.map(({label:d,key:b},a)=>t.html.button(t.attr.type("button"),t.on.click(c=>{c.preventDefault(),t.Value.get(o)||l?.(b)}),t.attr.disabled(o),t.attr.class("bc-segmented-input__segment"),t.attr.class(t.Value.map(e,c=>c===b?"bc-segmented-input__segment--active":"bc-segmented-input__segment--inactive")),Vt.ElementRect(c=>{function V(){p.update(u=>{const g=[...u];return g[a]={width:c.value.width,left:c.value.localLeft},g})}const k=L.delayedAnimationFrame(V);return t.OnDispose(k,c.on(V))}),d))),...f)})}function $t(n){const e=n.type.toLowerCase();return e.startsWith("image/")&&(e.includes("jpeg")||e.includes("jpg")||e.includes("png")||e.includes("gif")||e.includes("webp")||e.includes("svg"))}function Ot(n){const e=n.type.toLowerCase();return e.startsWith("image/")?"vscode-icons:file-type-image":e.startsWith("video/")?"vscode-icons:file-type-video":e.startsWith("audio/")?"vscode-icons:file-type-audio":e.includes("pdf")?"vscode-icons:file-type-pdf2":e.includes("word")||e.includes("document")?"vscode-icons:file-type-word":e.includes("excel")||e.includes("spreadsheet")?"vscode-icons:file-type-excel":e.includes("powerpoint")||e.includes("presentation")?"vscode-icons:file-type-powerpoint":e.includes("zip")||e.includes("archive")?"vscode-icons:file-type-zip":e.includes("text")?"vscode-icons:file-type-text":e.includes("json")?"vscode-icons:file-type-json-official":e.includes("csv")?"vscode-icons:file-type-csv":e.includes("xml")?"vscode-icons:file-type-xml":e.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function J(n){return t.When(n.map($t),()=>{const e=t.prop(null);return n.on(l=>{e.value&&URL.revokeObjectURL(e.value);const r=URL.createObjectURL(l);e.value=r}),t.html.div(t.OnDispose(()=>{e.value&&URL.revokeObjectURL(e.value)}),t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(e),t.attr.alt(n.map(l=>l.name)),t.attr.class("bc-file-input__thumbnail")))},()=>C.Icon({icon:n.map(Ot)}))}const Bt=(n,...e)=>{const{value:l=t.prop([]),accept:r="*/*",maxFiles:o,maxFileSize:h,onChange:s,onBlur:f,disabled:m,hasError:x,mode:p="default",showFileList:d=!0,...b}=n,a=l,c=t.Value.map(p,I=>I==="input"),V=t.Value.map(p,I=>I==="compact"),k=I=>{let i=I;if(o!=null){const v=t.Value.get(o);i=i.slice(0,v)}if(h){const v=t.Value.get(h);i=i.filter(E=>E.size<=v)}s?.(i)},u=I=>{const v=a.value.filter((E,D)=>D!==I);s?.(v)},g=()=>{s?.([])},_=({files:I,clear:i,change:v})=>t.Use(C.BeatUII18n,E=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),C.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(E.$.filesInputInstructions)(o,h,E.$.fileSizeUnits.value))))),w=({files:I})=>t.Use(C.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-drop-zone"),t.When(I.map(v=>v.length>0),()=>t.html.div(t.attr.class("bc-file-input__compact-file-list"),t.ForEach(I,(v,E)=>{const D=E.index;return t.html.div(t.attr.class("bc-file-input__compact-file-item"),t.html.div(t.attr.class("bc-file-input__compact-file-icon"),J(v)),t.html.div(t.attr.class("bc-file-input__compact-file-info"),t.html.div(t.attr.class("bc-file-input__compact-file-name"),t.attr.title(v.$.name),v.$.name),t.html.div(t.attr.class("bc-file-input__compact-file-meta"),t.computedOf(v.$.size,i.$.fileSizeUnits)((y,U)=>C.formatFileSize(y,{units:U}))," • ",t.computedOf(v.$.type,i.$.unknownType)((y,U)=>y||U))),O.CloseButton({size:"sm",label:i.$.removeFile,disabled:m,onClick:()=>u(D)},t.attr.class("bc-file-input__compact-remove-button")))})),()=>t.html.div(t.attr.class("bc-file-input__compact-placeholder"),C.Icon({icon:"mdi:cloud-upload-outline",size:"lg"}),t.html.div(t.attr.class("bc-file-input__compact-placeholder-text"),t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))))),M=({files:I})=>t.Use(C.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(I.map(v=>v.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(I,v=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),J(v),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),v.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),C.Icon({icon:"mdi:cloud-upload-outline",size:"md"})," ",t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))));return t.Use(C.BeatUII18n,I=>B.InputContainer({baseContainer:t.Value.map(c,i=>!i),disabled:m,hasError:x,after:t.When(c,()=>t.When(a.map(({length:i})=>i>0),()=>O.CloseButton({size:"sm",label:I.$.clearAllFiles,disabled:m,onClick:g},t.attr.class("bc-file-input__compact-clear")))),...b,input:t.When(c,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--input"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:M})),()=>t.When(V,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:w})),()=>t.html.div(t.attr.class("bc-file-input"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:_}),t.When(d,()=>t.NotEmpty(a,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(a,(i,v)=>{const E=v.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),J(i)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(i.$.name),i.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(i.$.size,I.$.fileSizeUnits)((D,y)=>C.formatFileSize(D,{units:y}))," • ",t.computedOf(i.$.type,I.$.unknownType)((D,y)=>D||y))),O.CloseButton({size:"sm",label:I.$.removeFile,disabled:m,onClick:()=>u(E)},t.attr.class("bc-file-input__remove-button")))})),t.When(a.map(({length:i})=>i>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(m),I.$.clearAllFiles,t.on.click(i=>{i.preventDefault(),i.stopPropagation(),g()}))))))))))},...e))};function ht(n,e,l){const r=n.length.map(o=>o);return t.Repeat(r,o=>{const h=n.item(o.index),s=[];return t.Fragment(t.OnDispose(()=>{s.forEach(f=>f())}),e({list:n,item:h,position:o,remove:()=>n.removeAt(o.index),move:f=>{switch(f){case"up":if(o.index===0)return;n.move(o.index,o.index-1);break;case"down":if(o.index===n.length.value-1)return;n.move(o.index,o.index+1);break;case"first":n.move(o.index,0);break;case"last":n.move(o.index,n.length.value-1)}},canMove:f=>{const m=(()=>{switch(f){case"up":return t.signal(o.index>0);case"down":return n.length.map(x=>o.index<x-1)}})();return s.push(()=>m.dispose()),m},cannotMove:f=>{const m=(()=>{switch(f){case"up":return t.signal(o.index===0);case"down":return n.length.map(x=>o.index===x-1)}})();return s.push(()=>m.dispose()),m}}))},l)}const rt={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:n=>n.toUpperCase()},"*":{pattern:/^.$/}},St=n=>n instanceof RegExp;function bt(n,e,l){if(n==null)return[];const r=l?{...rt,...e}:e??rt,o=(s,f)=>{const m=r[f];m?s.push({type:"pattern",name:f,...m}):s.push({type:"literal",char:f})},h=[];if(typeof n=="string"){for(const s of n)o(h,s);return h}for(const s of n)if(typeof s=="string")if(s.length<=1)o(h,s);else for(const f of s)o(h,f);else St(s)?h.push({type:"pattern",pattern:s}):typeof s=="object"&&s&&h.push(s);return h}function Tt(n,e){return l=>{switch(n){case"digits":return/[0-9]/.test(l);case"letters":return/[A-Za-z]/.test(l);case"alphanumeric":return/[A-Za-z0-9]/.test(l);case"custom":return e?.(l)??!0;default:return!0}}}function ot(n,e,l,r,o,h){const s={raw:n,previousConformed:e,cursor:o??n.length,completed:!1},f=r.definitions??{},m=typeof l=="function"?l(n,s):l,x=bt(m,f,r.useDefaultDefinitions??!0),p=Tt(r.allowMode,r.allow),d=new Set;for(const y of x)y.type==="literal"&&d.add(y.char);if(r.prefix)for(const y of r.prefix)d.add(y);if(r.suffix)for(const y of r.suffix)d.add(y);const b=Array.from(n).filter(y=>p(y)&&!d.has(y));if(b.length===0)return{value:"",cursor:0,completed:!1};const a=[],c=[];let V=0,k=0,u=0,g=-1;for(const y of x){if(y.type==="literal"){a.push(y.char),c.push({kind:"literal",filled:!0});continue}k+=y.optional?0:1;const U=b[V];if(U==null)break;if(y.type==="any"){u++,a.push(y.transform?y.transform(U):U),c.push({kind:"slot",filled:!0}),g=c.length-1,V++;continue}if(y.type==="pattern")if(y.pattern.test(U)){u++;const S=y.transform?y.transform(U):U;a.push(S),c.push({kind:"slot",filled:!0}),g=c.length-1,V++}else{V++;continue}}const _=a.join(""),w=(r.prefix??"")+_+(r.suffix??"");let I=(r.prefix??"").length;if(g>=0){let y=g+1;if((h?.policy??"smart")!=="sticky")for(;y<c.length&&c[y].kind==="literal";)y++;I+=y}const i=r.completion?.mode==="min"?(r.completion.minChars??0)<=u:r.completion?.mode==="custom"?!!r.completion.isComplete?.(w):k>0&&u>=k,v=r.pipe?.(w,{...s,completed:i});let E,D=I;return v===!1?(E=e,D=e.length):typeof v=="string"?(E=v,D=v.length):typeof v=="object"&&v?(E=v.value,D=v.cursor??v.value.length):E=w,{value:E,cursor:D,completed:i}}function At(n,e){const l=e?.strategy??"none";return l==="custom"&&e?.unmask?e.unmask(n):l==="strip"?n.replace(/[^A-Za-z0-9]/g,""):n}const et=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,onAccept:h,onComplete:s,mask:f,definitions:m,useDefaultDefinitions:x,extraLiterals:p,prefix:d,suffix:b,autofix:a,pipe:c,completion:V,unmask:k,allowMode:u,allow:g,placeholder:_,placeholderOptions:w}=n,M=t.computedOf(e,f,m,x,p,d,b,a,V,k,u,_,w)((i,v,E,D,y,U,S,R,P,W,F,j,T)=>v?ot(i??"","",v,{definitions:E??{},useDefaultDefinitions:D??!0,extraLiterals:y??[],autofix:R??"none",completion:P??{mode:"mask"},pipe:c??($=>$),unmask:W??{strategy:"none"},allowMode:F??"all",allow:g,prefix:U,suffix:S}).value:i??""),I=(i,v)=>{const E=i.value??"",D=t.Value.get(e)??"",y=f!=null?t.Value.get(f):null,U=m!=null?t.Value.get(m):void 0,S=x!=null?t.Value.get(x):void 0,R=p!=null?t.Value.get(p):void 0,P=a!=null?t.Value.get(a):void 0,W=V!=null?t.Value.get(V):void 0,F=k!=null?t.Value.get(k):void 0,j=u!=null?t.Value.get(u):void 0,T=d!=null?t.Value.get(d):void 0,$=b!=null?t.Value.get(b):void 0,{value:z,cursor:Y,completed:nt}=y?ot(E,D,y,{definitions:U??{},useDefaultDefinitions:S??!0,extraLiterals:R??[],autofix:P??"none",completion:W??{mode:"mask"},pipe:c??(It=>It),unmask:F??{strategy:"none"},allowMode:j??"all",allow:g,prefix:T,suffix:$},i.selectionStart??E.length,n.cursor?t.Value.get(n.cursor):void 0):{value:E,cursor:E.length,completed:!0};if(z!==E){i.value=z;try{i.setSelectionRange(Y,Y)}catch{}}const lt=At(z,F);h?.({raw:lt,conformed:z,completed:nt,cursor:Y}),v==="input"?o?.(z):(r?.(z),nt&&s?.({raw:lt,conformed:z}))};return B.InputContainer({...n,input:t.input.text(A.CommonInputAttributes(n),t.attr.value(M),t.attr.class("bc-input"),l!=null?t.on.blur(l):t.Empty,t.WithElement(i=>i instanceof HTMLInputElement?t.Fragment(t.on.input(()=>I(i,"input")),t.on.change(()=>I(i,"change")),t.on.keydown(v=>{if(v.key!=="Backspace"||!(n.cursor?t.Value.get(n.cursor)?.backspaceRubberBand??!0:!0))return;const D=i.selectionStart??0,y=i.selectionEnd??D;if(D!==y||D<=0)return;const U=i.value??"",S=f!=null?t.Value.get(f):null;if(!S)return;const R=m!=null?t.Value.get(m):void 0,P=x!=null?t.Value.get(x):!0,W=d!=null?t.Value.get(d):void 0,F=b!=null?t.Value.get(b):void 0,j=bt(typeof S=="function"?S(U,{raw:U,previousConformed:U,cursor:D,completed:!1}):S,R??{},P??!0),T=new Set;for(const $ of j)$.type==="literal"&&T.add($.char);if(W)for(const $ of W)T.add($);if(F)for(const $ of F)T.add($);if(T.has(U[D-1])){let $=D-1;for(;$>=0&&T.has(U[$]);)$--;$>=0&&(v.preventDefault(),v.stopPropagation(),i.value=U.slice(0,$)+U.slice($+1),I(i,"input"))}})):t.Empty))})},Ft=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,rows:h}=n;return B.InputContainer({...n,input:t.html.textarea(A.CommonInputAttributes(n),t.attr.rows(h??3),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})},at=n=>{if(n==null||n==="")return null;const e=Number(n);return Number.isNaN(e)?null:e},zt=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:s,onInput:f,after:m}=n,x=a=>{const c=r!=null?t.Value.get(r):void 0,V=o!=null?t.Value.get(o):void 0;return c!=null&&a<c?c:V!=null&&a>V?V:a},p=(()=>{if(l==null)return null;const a=t.computedOf(e,r)((g,_)=>{const w=g??0;return _==null?!0:w>_}),c=t.computedOf(e,o)((g,_)=>{const w=g??0;return _==null?!0:w<_}),V=g=>{const _=t.Value.get(e)??0,w=t.Value.get(l),M=g?.shiftKey?10:1,I=N(_-w*M,w),i=r!=null?t.Value.get(r):void 0;if(i!=null&&I<i)return;const v=x(I);v!==_&&(s?.(v),f?.(v))},k=g=>{const _=t.Value.get(e)??0,w=t.Value.get(l),M=g?.shiftKey?10:1,I=N(_+w*M,w),i=o!=null?t.Value.get(o):void 0;if(i!=null&&I>i)return;const v=x(I);v!==_&&(s?.(v),f?.(v))};return((g,_)=>ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(c,n.disabled??!1)((w,M)=>!w||M)),t.on.click(w=>k(w)),t.aria.label(g),C.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(a,n.disabled??!1)((w,M)=>!w||M)),t.on.click(w=>V(w)),t.aria.label(_),C.Icon({icon:"line-md:minus",size:"xs"}))))(C.defaultMessages.incrementValue,C.defaultMessages.decrementValue)})(),d=tt(e,n.disabled,s??f),b=m!=null&&p!=null?t.Fragment(p,d,m):m!=null?t.Fragment(d,m):p!=null?t.Fragment(p,d):d;return B.InputContainer({...n,input:t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,A.CommonInputAttributes(n),t.attr.value(t.Value.map(e,a=>a==null?"":String(a))),t.attr.step(l),t.attr.class("bc-input bc-number-input"),h!=null?t.on.blur(t.emitValue(h)):t.Empty,s!=null?t.on.change(t.emitValue(a=>{const c=at(a);s(c)})):t.Empty,f!=null?t.on.input(t.emitValue(a=>{const c=at(a);f(c)})):t.Empty,l!=null?t.on.wheel(a=>{a.preventDefault();const c=t.Value.get(e)??0,V=t.Value.get(l),k=a.shiftKey?10:1,u=a.deltaY<0?V*k:-V*k,g=x(N(c+u,V));g!==c&&(s?.(g),f?.(g))}):t.Empty),after:b})},Lt=n=>{const e={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:r=>r.toLowerCase()};return et({...n,mask:[e,e,e,e,e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,e,e,e,e,e,e,e,e],placeholder:n.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Nt=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,Wt=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function gt(n){return{mask:null,allowMode:"custom",allow:e=>/[0-9ptwdhms]/i.test(e),pipe:e=>{const l=e.toUpperCase();return l.length===0?l:!l.startsWith("P")||!Nt.test(l)?!1:l},completion:{mode:"custom",isComplete:e=>{const l=e.toUpperCase();if(!Wt.test(l))return!1;try{return n(l),!0}catch{return!1}}}}}const st=(n,e)=>{if(n==null)return null;try{return n.Duration.from(e)}catch{return null}},Rt=n=>{const{value:e,onChange:l,onInput:r,after:o,disabled:h,onBlur:s}=n,f=()=>{const p=tt(e,h,l??r);return o!=null?t.Fragment(p,o):p},m=n.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return ct(p=>{const d=A.mapInputOptions(n,b=>b?.toString()??"",b=>b===""?null:p.Duration.from(b));return et({...d,onInput:void 0,...gt(p.Duration.from),placeholder:"P0DT0H0M0S",after:f()})},{pending:()=>{const p=d=>b=>{const c=b.currentTarget?.value??"";if(c===""){d(null);return}const V=globalThis.Temporal,k=st(V,c);if(k!=null){d(k);return}H().then(u=>{const g=st(u,c);g!=null&&d(g)}).catch(()=>{})};return B.InputContainer({...n,input:t.input.text(A.CommonInputAttributes(n),t.attr.value(t.Value.map(e,d=>d?.toString()??"")),t.attr.class("bc-input"),m,s!=null?t.on.blur(()=>s()):t.Empty,l!=null?t.on.change(p(l)):t.Empty,r!=null?t.on.input(p(r)):t.Empty),after:f()})}})},Pt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o}=n;return B.InputContainer({...n,input:t.input.url(A.CommonInputAttributes(n),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})};function vt(n,e){const{onMove:l,cannotMoveUp:r,cannotMoveDown:o,onRemove:h,showMove:s=!0,showRemove:f=!0,removeDisabled:m,showMoveButtons:x=!0,layout:p="aside"}=n,d=t.Value.toSignal(p).map(c=>c==="aside"),b=t.When(s,()=>t.html.div(t.attr.class("bc-list-item-controls__move"),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("up"),disabled:r},t.Use(C.BeatUII18n,c=>C.Icon({size:"xs",icon:"line-md:arrow-up",title:c.$.incrementValue}))),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("down"),disabled:o},t.Use(C.BeatUII18n,c=>C.Icon({size:"xs",icon:"line-md:arrow-down",title:c.$.decrementValue}))))),a=t.When(f,()=>t.Use(C.BeatUII18n,c=>O.CloseButton({size:"xs",label:t.Value.map(c.$.removeItem,V=>V.toLowerCase()),color:"danger",disabled:m,onClick:h})));return t.When(d,()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--aside"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(x,()=>b),a)),()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--below"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(x,()=>b,()=>t.html.div()),a)))}const xt=n=>{const{controller:e,element:l,separator:r,showMove:o=!0,showRemove:h=!0,showAdd:s=!0,createItem:f,addLabel:m,controlsLayout:x="aside",removeDisabled:p,addDisabled:d}=n,b=t.When(t.computedOf(s,f)((a,c)=>a&&c!=null),()=>Q(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),B.Button({size:"sm",variant:"filled",onClick:()=>e.push(f()),disabled:t.computedOf(e.disabled,d??!1)((a,c)=>a||c)},t.Use(C.BeatUII18n,a=>Q(t.attr.class("bc-group--gap-2"),C.Icon({icon:"line-md:plus"}),m??a.$.addLabel)))));return t.Fragment(ht(e,a=>vt({onMove:a.move,cannotMoveUp:a.cannotMove("up"),cannotMoveDown:a.cannotMove("down"),onRemove:a.remove,showMove:o,showRemove:h,removeDisabled:p,showMoveButtons:e.signal.map(c=>c.length>1),layout:x},l(a)),r),b)},jt=(n,...e)=>{const{controller:l,element:r,separator:o,showMove:h,showRemove:s,showAdd:f,createItem:m,addLabel:x,controlsLayout:p,removeDisabled:d,addDisabled:b,...a}=n;return O.InputWrapper({...a,content:xt({controller:l,element:r,separator:o,showMove:h,showRemove:s,showAdd:f,createItem:m,addLabel:x,controlsLayout:p,removeDisabled:d,addDisabled:b})},...e)};class qt extends O.Controller{branches;activeBranch;#e;#t=new Map;constructor(e,l,r,o,h,s,f=L.strictEqual){super(e,l,r,o,h,f),this.branches=s;const m=p=>{for(const d of s)if(d.detect(p))return d.key;return s[0]?.key??"unknown"};this.activeBranch=r.map(m,L.strictEqual);const x=p=>{if(this.#t.has(p))return this.#t.get(p);const d=s.find(a=>a.key===p);if(!d)throw new Error(`Unknown branch: ${p}`);const b=new O.Controller([...e,p],a=>{this.change(a)},this.signal.map(a=>d.detect(a)?a:d.defaultValue(),f),o.map(O.makeMapValidation([p])),{disabled:this.disabled,validationMode:this.parent.validationMode},f);return this.#t.set(p,b),b};this.#e=this.activeBranch.map(p=>x(p),L.strictEqual),this.onDispose(()=>{for(const p of this.#t.values())p.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(e){const l=this.branches.find(o=>o.key===e);if(!l)throw new Error(`Unknown branch: ${e}`);if(this.#t.has(e))return this.#t.get(e);const r=new O.Controller([...this.path,e],o=>{this.change(o)},this.signal.map(o=>l.detect(o)?o:l.defaultValue(),L.strictEqual),this.status.map(O.makeMapValidation([e])),{disabled:this.disabled,validationMode:this.parent.validationMode},L.strictEqual);return this.#t.set(e,r),r}switchToBranch(e,l=!1){const r=this.branches.find(s=>s.key===e);if(!r)throw new Error(`Unknown branch: ${e}`);const o=t.Value.get(this.signal);if(r.detect(o))return!0;if(r.convert){const s=r.convert(o);if(s.ok)return this.change(s.value),!0}if(l&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm(C.defaultMessages.changeTypeConfirmation))return!1;const h=r.defaultValue();return this.change(h),!0}get activeBranchDefinition(){const e=t.Value.get(this.activeBranch);return this.branches.find(l=>l.key===e)}}function Zt(n){return n.transform(e=>e??null,e=>e??void 0)}function Ht(n){return n.transform(e=>e??"",e=>e===""?void 0:e)}function Yt(n){return n.transform(e=>e??void 0,e=>e??null)}function q(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)&&Object.prototype.toString.call(n)==="[object Object]"}function yt(n,e){if(e==null)return it(n);if(n==null)return e;if(q(n)&&q(e)){const l={...e};for(const r of Object.keys(n))l[r]===void 0?l[r]=it(n[r]):q(n[r])&&q(l[r])&&(l[r]=yt(n[r],l[r]));return l}return e}function it(n){return typeof structuredClone=="function"?structuredClone(n):JSON.parse(JSON.stringify(n))}exports.BaseListControl=xt;exports.BaseNativeSelectControl=mt;exports.Expando=pt;exports.FilesInput=Bt;exports.Group=Q;exports.ListControl=jt;exports.ListInput=ht;exports.ListItemControls=vt;exports.MaskInput=et;exports.NativeSelect=dt;exports.NativeSelectControl=Ct;exports.NullableDurationInput=Rt;exports.NullableNumberInput=zt;exports.NullableResetAfter=tt;exports.NumberInput=kt;exports.SegmentedInput=Mt;exports.TextArea=Ft;exports.UnionController=qt;exports.UnstyledDropZone=Z;exports.UrlInput=Pt;exports.UuidInput=Lt;exports.WithTemporal=ct;exports.deepMergeDefaults=yt;exports.durationMaskConfig=gt;exports.emitExpando=wt;exports.emitOptionExpando=X;exports.ensureTemporal=H;exports.roundToStep=N;exports.transformEmptyStringToUndefined=Ht;exports.transformNullToUndefined=Zt;exports.transformUndefinedToNull=Yt;
1
+ "use strict";const t=require("@tempots/dom"),B=require("./input-container-Di1YvVB_.cjs"),A=require("./text-input-DL9FvpTZ.cjs"),O=require("./use-form-CaW192gw.cjs"),C=require("./translations-Dbx7L7Q1.cjs"),ut=require("./stack-dwLevGa2.cjs"),L=require("@tempots/std"),Vt=require("@tempots/ui");let G=null;async function H(){const n=globalThis;return n.Temporal?n.Temporal:(G||(G=Promise.resolve().then(()=>require("./index.esm-C6lZ02yY.cjs")).then(e=>{const l=e.Temporal;return n.Temporal||(n.Temporal=l),l})),G)}const ct=(n,e)=>e?t.Task(H,{then:n,pending:e.pending,error:e.error}):t.Task(H,n);function Z({onChange:n,value:e,accept:l="*/*",enableClick:r=!0,content:o,disabled:h=!1,allowMultiple:s}){return t.Use(C.BeatUII18n,f=>{const m=t.Value.deriveProp(e??[]),x=t.prop(!1),p=u=>{u.preventDefault(),u.stopPropagation(),x.value=!0},d=u=>{u.preventDefault(),u.stopPropagation(),(!u.currentTarget||!u.currentTarget.contains(u.relatedTarget))&&(x.value=!1)},b=u=>{u.preventDefault(),u.stopPropagation(),x.value=!1;const g=Array.from(u.dataTransfer?.files||[]);g.length>0&&(m.value=g,n(g,"dragdrop"))},a=u=>{t.Value.get(r)&&u.currentTarget.querySelector('input[type="file"]')?.click()};let c=null;const V=()=>{if(c==null)return;const u=Array.from(c.files??[]);u.length>0&&(m.value=u,n(u,"click")),c.value=""},k=u=>{t.Value.get(r)&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(u))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(r,u=>u?0:-1)),t.attr.style("position: relative;"),t.on.dragover(p),t.on.dragleave(d),t.on.drop(b),t.on.click(a),t.on.keydown(k),t.html.input(t.attr.type("file"),t.attr.disabled(h),t.attr.accept(l),t.attr.multiple(s),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(V),t.WithElement(u=>(c=u,m.on(g=>{const _=globalThis.DataTransfer;if(_!=null){const w=new _;g.forEach(M=>w.items.add(M)),u.files=w.files}}),t.Empty))),t.aria.label(t.bind(f.$.dropZoneInstructions)(r)),o({files:m,clear:()=>m.value=[],change:u=>m.set(u)}))})}const K="$$tts-exp-",pt=(n,e)=>t.WithElement(l=>{const r=`${K}${n}`;return t.OnDispose(t.Value.on(e,o=>Reflect.set(l,r,o)))}),wt=(n,e)=>{const l=`${K}${n}`;return r=>{e(Reflect.get(r.target,l))}},X=(n,e)=>{const l=`${K}${n}`;return r=>{const o=r.target,h=o.selectedIndex,s=o.options[h];e(Reflect.get(s,l))}},ft=(n,e,l)=>t.Ensure(n,r=>t.OneOfType(r,{value:o=>{const h=t.computedOf(o,l)((s,f)=>e(s.value,f));return t.html.option(t.attr.selected(h),pt("value",o.$.value),o.$.label)},group:o=>t.html.optgroup(t.attr.label(o.$.group),t.ForEach(o.$.options,h=>ft(h,e,l))),break:()=>t.html.hr()})),dt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,options:h,unselectedLabel:s,equality:f=(p,d)=>p===d,after:m}=n;let x;return B.InputContainer({...n,after:t.Fragment(B.InputIcon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),m),input:t.html.select(t.WithElement(p=>{x=p;const d=new MutationObserver(b=>{const{removedNodes:a}=b[0];a.length>0&&(x.selectedIndex=0)});return d.observe(p,{childList:!0}),t.OnDispose(()=>d.disconnect())}),A.CommonInputAttributes(n),t.attr.class("bc-native-select bc-input"),t.Use(C.BeatUII18n,p=>t.html.option(t.attr.hidden("hidden"),t.coalesce(s,p.$.selectOne))),t.ForEach(h,p=>ft(p,f,e)),l!=null?t.on.blur(l):t.Empty,r!=null?t.on.change(X("value",p=>r(p))):t.Empty,o!=null?t.on.input(X("value",p=>o(p))):t.Empty)},t.on.click(()=>{if(x?.focus(),typeof x?.showPicker=="function")try{x.showPicker()}catch{}}))};function mt(n){const{controller:e,onChange:l,onBlur:r,...o}=n;return dt({...o,value:e.signal,onChange:O.makeOnChangeHandler(e,l),onBlur:O.makeOnBlurHandler(e,r)})}function Ct(n){return O.InputWrapper({...n,content:mt(n)})}function tt(n,e,l){const r=t.Value.map(n,s=>s!=null),o=t.computedOf(r,e??!1)((s,f)=>!s||f),h=C.defaultMessages.clearValue;return t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(h),t.attr.title(h),t.attr.disabled(o),C.Icon({icon:"mdi:close",size:"sm"}),t.on.click(s=>{s.stopPropagation(),l?.(null)}))}function Q(...n){return t.html.div(t.attr.class("bc-group"),...n)}function _t(n){const e=String(n),l=e.indexOf(".");return l===-1?0:e.length-l-1}function N(n,e){const l=_t(e);if(l===0)return Math.round(n);const r=Math.pow(10,l);return Math.round(n*r)/r}const kt=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:s,onInput:f,after:m}=n,x=b=>{const a=r!=null?t.Value.get(r):void 0,c=o!=null?t.Value.get(o):void 0;return a!=null&&b<a?a:c!=null&&b>c?c:b},p=l!=null?t.Use(C.BeatUII18n,b=>{const a=t.computedOf(e,r)((u,g)=>g==null?!0:(u??0)>g),c=t.computedOf(e,o)((u,g)=>g==null?!0:(u??0)<g),V=u=>{const g=t.Value.get(e)??0,_=t.Value.get(l),w=u?.shiftKey?10:1,M=N(g-_*w,_),I=r!=null?t.Value.get(r):void 0;if(I!=null&&M<I)return;const i=x(M);i!==g&&(s?.(i),f?.(i))},k=u=>{const g=t.Value.get(e)??0,_=t.Value.get(l),w=u?.shiftKey?10:1,M=N(g+_*w,_),I=o!=null?t.Value.get(o):void 0;if(I!=null&&M>I)return;const i=x(M);i!==g&&(s?.(i),f?.(i))};return ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(c,n.disabled??!1)((u,g)=>!u||g)),t.on.click(u=>k(u)),t.aria.label(b.$.incrementValue),C.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(a,n.disabled??!1)((u,g)=>!u||g)),t.on.click(u=>V(u)),t.aria.label(b.$.decrementValue),C.Icon({icon:"line-md:minus",size:"xs"})))}):null,d=m!=null&&p!=null?t.Fragment(p,m):m??p;return B.InputContainer({...n,input:t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,A.CommonInputAttributes(n),t.attr.valueAsNumber(e),t.attr.step(l),t.attr.class("bc-input bc-number-input"),h!=null?t.on.blur(t.emitValue(h)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,f!=null?t.on.input(t.emitValueAsNumber(f)):t.Empty,l!=null?t.on.wheel(b=>{b.preventDefault();const a=t.Value.get(e)??0,c=t.Value.get(l),V=b.shiftKey?10:1,k=b.deltaY<0?c*V:-c*V,u=x(N(a+k,c));u!==a&&(s?.(u),f?.(u))}):t.Empty),after:d})};function Et(n,e){return n.length===e.length&&n.every((l,r)=>l===e[r])}function Dt(n,e,l){const r=["bc-segmented-input",`bc-segmented-input--size-${n}`];return l==="squared"&&r.push("bc-segmented-input--squared"),e&&r.push("bc-segmented-input--disabled"),r.join(" ")}function Ut(n){if(n==null)return"";const e=new Map,l=C.backgroundValue(n,"solid","light"),r=C.backgroundValue(n,"solid","dark");return e.set("--si-indicator-bg",l.backgroundColor),e.set("--si-active-text",l.textColor),e.set("--si-indicator-bg-dark",r.backgroundColor),e.set("--si-active-text-dark",r.textColor),Array.from(e.entries()).map(([o,h])=>`${o}: ${h}`).join("; ")}function Mt({options:n,value:e,onChange:l,size:r="md",disabled:o=!1,variant:h="pill",color:s},...f){const m=L.objectEntries(n).map(([x,p])=>({key:x,label:p}));return t.WithElement(()=>{const x=Object.fromEntries(m.map((d,b)=>[d.key,b])),p=t.prop(m.map(()=>({left:0,width:0})),Et);return t.html.div(t.attr.class(t.computedOf(r,o,h)((d,b,a)=>Dt(d??"md",b??!1,a??"pill"))),t.attr.style(s!=null?t.Value.map(s,d=>Ut(d)):""),t.html.div(t.attr.class("bc-segmented-input__container"),t.html.div(t.attr.class("bc-segmented-input__indicator"),t.style.width(t.computedOf(e,p)((d,b)=>{const{width:a}=b[x[d]??0];return`${a}px`})),t.style.left(t.computedOf(e,p)((d,b)=>{const{left:a}=b[x[d]??0];return`${a}px`}))),m.map(({label:d,key:b},a)=>t.html.button(t.attr.type("button"),t.on.click(c=>{c.preventDefault(),t.Value.get(o)||l?.(b)}),t.attr.disabled(o),t.attr.class("bc-segmented-input__segment"),t.attr.class(t.Value.map(e,c=>c===b?"bc-segmented-input__segment--active":"bc-segmented-input__segment--inactive")),Vt.ElementRect(c=>{function V(){p.update(u=>{const g=[...u];return g[a]={width:c.value.width,left:c.value.localLeft},g})}const k=L.delayedAnimationFrame(V);return t.OnDispose(k,c.on(V))}),d))),...f)})}function $t(n){const e=n.type.toLowerCase();return e.startsWith("image/")&&(e.includes("jpeg")||e.includes("jpg")||e.includes("png")||e.includes("gif")||e.includes("webp")||e.includes("svg"))}function Ot(n){const e=n.type.toLowerCase();return e.startsWith("image/")?"vscode-icons:file-type-image":e.startsWith("video/")?"vscode-icons:file-type-video":e.startsWith("audio/")?"vscode-icons:file-type-audio":e.includes("pdf")?"vscode-icons:file-type-pdf2":e.includes("word")||e.includes("document")?"vscode-icons:file-type-word":e.includes("excel")||e.includes("spreadsheet")?"vscode-icons:file-type-excel":e.includes("powerpoint")||e.includes("presentation")?"vscode-icons:file-type-powerpoint":e.includes("zip")||e.includes("archive")?"vscode-icons:file-type-zip":e.includes("text")?"vscode-icons:file-type-text":e.includes("json")?"vscode-icons:file-type-json-official":e.includes("csv")?"vscode-icons:file-type-csv":e.includes("xml")?"vscode-icons:file-type-xml":e.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function J(n){return t.When(n.map($t),()=>{const e=t.prop(null);return n.on(l=>{e.value&&URL.revokeObjectURL(e.value);const r=URL.createObjectURL(l);e.value=r}),t.html.div(t.OnDispose(()=>{e.value&&URL.revokeObjectURL(e.value)}),t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(e),t.attr.alt(n.map(l=>l.name)),t.attr.class("bc-file-input__thumbnail")))},()=>C.Icon({icon:n.map(Ot)}))}const Bt=(n,...e)=>{const{value:l=t.prop([]),accept:r="*/*",maxFiles:o,maxFileSize:h,onChange:s,onBlur:f,disabled:m,hasError:x,mode:p="default",showFileList:d=!0,...b}=n,a=l,c=t.Value.map(p,I=>I==="input"),V=t.Value.map(p,I=>I==="compact"),k=I=>{let i=I;if(o!=null){const v=t.Value.get(o);i=i.slice(0,v)}if(h){const v=t.Value.get(h);i=i.filter(E=>E.size<=v)}s?.(i)},u=I=>{const v=a.value.filter((E,D)=>D!==I);s?.(v)},g=()=>{s?.([])},_=({files:I,clear:i,change:v})=>t.Use(C.BeatUII18n,E=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),C.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(E.$.filesInputInstructions)(o,h,E.$.fileSizeUnits.value))))),w=({files:I})=>t.Use(C.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-drop-zone"),t.When(I.map(v=>v.length>0),()=>t.html.div(t.attr.class("bc-file-input__compact-file-list"),t.ForEach(I,(v,E)=>{const D=E.index;return t.html.div(t.attr.class("bc-file-input__compact-file-item"),t.html.div(t.attr.class("bc-file-input__compact-file-icon"),J(v)),t.html.div(t.attr.class("bc-file-input__compact-file-info"),t.html.div(t.attr.class("bc-file-input__compact-file-name"),t.attr.title(v.$.name),v.$.name),t.html.div(t.attr.class("bc-file-input__compact-file-meta"),t.computedOf(v.$.size,i.$.fileSizeUnits)((y,U)=>C.formatFileSize(y,{units:U}))," • ",t.computedOf(v.$.type,i.$.unknownType)((y,U)=>y||U))),O.CloseButton({size:"sm",label:i.$.removeFile,disabled:m,onClick:()=>u(D)},t.attr.class("bc-file-input__compact-remove-button")))})),()=>t.html.div(t.attr.class("bc-file-input__compact-placeholder"),C.Icon({icon:"mdi:cloud-upload-outline",size:"lg"}),t.html.div(t.attr.class("bc-file-input__compact-placeholder-text"),t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))))),M=({files:I})=>t.Use(C.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(I.map(v=>v.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(I,v=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),J(v),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),v.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),C.Icon({icon:"mdi:cloud-upload-outline",size:"md"})," ",t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))));return t.Use(C.BeatUII18n,I=>B.InputContainer({baseContainer:t.Value.map(c,i=>!i),disabled:m,hasError:x,after:t.When(c,()=>t.When(a.map(({length:i})=>i>0),()=>O.CloseButton({size:"sm",label:I.$.clearAllFiles,disabled:m,onClick:g},t.attr.class("bc-file-input__compact-clear")))),...b,input:t.When(c,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--input"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:M})),()=>t.When(V,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:w})),()=>t.html.div(t.attr.class("bc-file-input"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:_}),t.When(d,()=>t.NotEmpty(a,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(a,(i,v)=>{const E=v.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),J(i)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(i.$.name),i.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(i.$.size,I.$.fileSizeUnits)((D,y)=>C.formatFileSize(D,{units:y}))," • ",t.computedOf(i.$.type,I.$.unknownType)((D,y)=>D||y))),O.CloseButton({size:"sm",label:I.$.removeFile,disabled:m,onClick:()=>u(E)},t.attr.class("bc-file-input__remove-button")))})),t.When(a.map(({length:i})=>i>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(m),I.$.clearAllFiles,t.on.click(i=>{i.preventDefault(),i.stopPropagation(),g()}))))))))))},...e))};function ht(n,e,l){const r=n.length.map(o=>o);return t.Repeat(r,o=>{const h=n.item(o.index),s=[];return t.Fragment(t.OnDispose(()=>{s.forEach(f=>f())}),e({list:n,item:h,position:o,remove:()=>n.removeAt(o.index),move:f=>{switch(f){case"up":if(o.index===0)return;n.move(o.index,o.index-1);break;case"down":if(o.index===n.length.value-1)return;n.move(o.index,o.index+1);break;case"first":n.move(o.index,0);break;case"last":n.move(o.index,n.length.value-1)}},canMove:f=>{const m=(()=>{switch(f){case"up":return t.signal(o.index>0);case"down":return n.length.map(x=>o.index<x-1)}})();return s.push(()=>m.dispose()),m},cannotMove:f=>{const m=(()=>{switch(f){case"up":return t.signal(o.index===0);case"down":return n.length.map(x=>o.index===x-1)}})();return s.push(()=>m.dispose()),m}}))},l)}const rt={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:n=>n.toUpperCase()},"*":{pattern:/^.$/}},St=n=>n instanceof RegExp;function bt(n,e,l){if(n==null)return[];const r=l?{...rt,...e}:e??rt,o=(s,f)=>{const m=r[f];m?s.push({type:"pattern",name:f,...m}):s.push({type:"literal",char:f})},h=[];if(typeof n=="string"){for(const s of n)o(h,s);return h}for(const s of n)if(typeof s=="string")if(s.length<=1)o(h,s);else for(const f of s)o(h,f);else St(s)?h.push({type:"pattern",pattern:s}):typeof s=="object"&&s&&h.push(s);return h}function Tt(n,e){return l=>{switch(n){case"digits":return/[0-9]/.test(l);case"letters":return/[A-Za-z]/.test(l);case"alphanumeric":return/[A-Za-z0-9]/.test(l);case"custom":return e?.(l)??!0;default:return!0}}}function ot(n,e,l,r,o,h){const s={raw:n,previousConformed:e,cursor:o??n.length,completed:!1},f=r.definitions??{},m=typeof l=="function"?l(n,s):l,x=bt(m,f,r.useDefaultDefinitions??!0),p=Tt(r.allowMode,r.allow),d=new Set;for(const y of x)y.type==="literal"&&d.add(y.char);if(r.prefix)for(const y of r.prefix)d.add(y);if(r.suffix)for(const y of r.suffix)d.add(y);const b=Array.from(n).filter(y=>p(y)&&!d.has(y));if(b.length===0)return{value:"",cursor:0,completed:!1};const a=[],c=[];let V=0,k=0,u=0,g=-1;for(const y of x){if(y.type==="literal"){a.push(y.char),c.push({kind:"literal",filled:!0});continue}k+=y.optional?0:1;const U=b[V];if(U==null)break;if(y.type==="any"){u++,a.push(y.transform?y.transform(U):U),c.push({kind:"slot",filled:!0}),g=c.length-1,V++;continue}if(y.type==="pattern")if(y.pattern.test(U)){u++;const S=y.transform?y.transform(U):U;a.push(S),c.push({kind:"slot",filled:!0}),g=c.length-1,V++}else{V++;continue}}const _=a.join(""),w=(r.prefix??"")+_+(r.suffix??"");let I=(r.prefix??"").length;if(g>=0){let y=g+1;if((h?.policy??"smart")!=="sticky")for(;y<c.length&&c[y].kind==="literal";)y++;I+=y}const i=r.completion?.mode==="min"?(r.completion.minChars??0)<=u:r.completion?.mode==="custom"?!!r.completion.isComplete?.(w):k>0&&u>=k,v=r.pipe?.(w,{...s,completed:i});let E,D=I;return v===!1?(E=e,D=e.length):typeof v=="string"?(E=v,D=v.length):typeof v=="object"&&v?(E=v.value,D=v.cursor??v.value.length):E=w,{value:E,cursor:D,completed:i}}function At(n,e){const l=e?.strategy??"none";return l==="custom"&&e?.unmask?e.unmask(n):l==="strip"?n.replace(/[^A-Za-z0-9]/g,""):n}const et=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,onAccept:h,onComplete:s,mask:f,definitions:m,useDefaultDefinitions:x,extraLiterals:p,prefix:d,suffix:b,autofix:a,pipe:c,completion:V,unmask:k,allowMode:u,allow:g,placeholder:_,placeholderOptions:w}=n,M=t.computedOf(e,f,m,x,p,d,b,a,V,k,u,_,w)((i,v,E,D,y,U,S,R,P,W,F,j,T)=>v?ot(i??"","",v,{definitions:E??{},useDefaultDefinitions:D??!0,extraLiterals:y??[],autofix:R??"none",completion:P??{mode:"mask"},pipe:c??($=>$),unmask:W??{strategy:"none"},allowMode:F??"all",allow:g,prefix:U,suffix:S}).value:i??""),I=(i,v)=>{const E=i.value??"",D=t.Value.get(e)??"",y=f!=null?t.Value.get(f):null,U=m!=null?t.Value.get(m):void 0,S=x!=null?t.Value.get(x):void 0,R=p!=null?t.Value.get(p):void 0,P=a!=null?t.Value.get(a):void 0,W=V!=null?t.Value.get(V):void 0,F=k!=null?t.Value.get(k):void 0,j=u!=null?t.Value.get(u):void 0,T=d!=null?t.Value.get(d):void 0,$=b!=null?t.Value.get(b):void 0,{value:z,cursor:Y,completed:nt}=y?ot(E,D,y,{definitions:U??{},useDefaultDefinitions:S??!0,extraLiterals:R??[],autofix:P??"none",completion:W??{mode:"mask"},pipe:c??(It=>It),unmask:F??{strategy:"none"},allowMode:j??"all",allow:g,prefix:T,suffix:$},i.selectionStart??E.length,n.cursor?t.Value.get(n.cursor):void 0):{value:E,cursor:E.length,completed:!0};if(z!==E){i.value=z;try{i.setSelectionRange(Y,Y)}catch{}}const lt=At(z,F);h?.({raw:lt,conformed:z,completed:nt,cursor:Y}),v==="input"?o?.(z):(r?.(z),nt&&s?.({raw:lt,conformed:z}))};return B.InputContainer({...n,input:t.input.text(A.CommonInputAttributes(n),t.attr.value(M),t.attr.class("bc-input"),l!=null?t.on.blur(l):t.Empty,t.WithElement(i=>i instanceof HTMLInputElement?t.Fragment(t.on.input(()=>I(i,"input")),t.on.change(()=>I(i,"change")),t.on.keydown(v=>{if(v.key!=="Backspace"||!(n.cursor?t.Value.get(n.cursor)?.backspaceRubberBand??!0:!0))return;const D=i.selectionStart??0,y=i.selectionEnd??D;if(D!==y||D<=0)return;const U=i.value??"",S=f!=null?t.Value.get(f):null;if(!S)return;const R=m!=null?t.Value.get(m):void 0,P=x!=null?t.Value.get(x):!0,W=d!=null?t.Value.get(d):void 0,F=b!=null?t.Value.get(b):void 0,j=bt(typeof S=="function"?S(U,{raw:U,previousConformed:U,cursor:D,completed:!1}):S,R??{},P??!0),T=new Set;for(const $ of j)$.type==="literal"&&T.add($.char);if(W)for(const $ of W)T.add($);if(F)for(const $ of F)T.add($);if(T.has(U[D-1])){let $=D-1;for(;$>=0&&T.has(U[$]);)$--;$>=0&&(v.preventDefault(),v.stopPropagation(),i.value=U.slice(0,$)+U.slice($+1),I(i,"input"))}})):t.Empty))})},Ft=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,rows:h}=n;return B.InputContainer({...n,input:t.html.textarea(A.CommonInputAttributes(n),t.attr.rows(h??3),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})},at=n=>{if(n==null||n==="")return null;const e=Number(n);return Number.isNaN(e)?null:e},zt=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:s,onInput:f,after:m}=n,x=a=>{const c=r!=null?t.Value.get(r):void 0,V=o!=null?t.Value.get(o):void 0;return c!=null&&a<c?c:V!=null&&a>V?V:a},p=(()=>{if(l==null)return null;const a=t.computedOf(e,r)((g,_)=>{const w=g??0;return _==null?!0:w>_}),c=t.computedOf(e,o)((g,_)=>{const w=g??0;return _==null?!0:w<_}),V=g=>{const _=t.Value.get(e)??0,w=t.Value.get(l),M=g?.shiftKey?10:1,I=N(_-w*M,w),i=r!=null?t.Value.get(r):void 0;if(i!=null&&I<i)return;const v=x(I);v!==_&&(s?.(v),f?.(v))},k=g=>{const _=t.Value.get(e)??0,w=t.Value.get(l),M=g?.shiftKey?10:1,I=N(_+w*M,w),i=o!=null?t.Value.get(o):void 0;if(i!=null&&I>i)return;const v=x(I);v!==_&&(s?.(v),f?.(v))};return((g,_)=>ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(c,n.disabled??!1)((w,M)=>!w||M)),t.on.click(w=>k(w)),t.aria.label(g),C.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(a,n.disabled??!1)((w,M)=>!w||M)),t.on.click(w=>V(w)),t.aria.label(_),C.Icon({icon:"line-md:minus",size:"xs"}))))(C.defaultMessages.incrementValue,C.defaultMessages.decrementValue)})(),d=tt(e,n.disabled,s??f),b=m!=null&&p!=null?t.Fragment(p,d,m):m!=null?t.Fragment(d,m):p!=null?t.Fragment(p,d):d;return B.InputContainer({...n,input:t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,A.CommonInputAttributes(n),t.attr.value(t.Value.map(e,a=>a==null?"":String(a))),t.attr.step(l),t.attr.class("bc-input bc-number-input"),h!=null?t.on.blur(t.emitValue(h)):t.Empty,s!=null?t.on.change(t.emitValue(a=>{const c=at(a);s(c)})):t.Empty,f!=null?t.on.input(t.emitValue(a=>{const c=at(a);f(c)})):t.Empty,l!=null?t.on.wheel(a=>{a.preventDefault();const c=t.Value.get(e)??0,V=t.Value.get(l),k=a.shiftKey?10:1,u=a.deltaY<0?V*k:-V*k,g=x(N(c+u,V));g!==c&&(s?.(g),f?.(g))}):t.Empty),after:b})},Lt=n=>{const e={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:r=>r.toLowerCase()};return et({...n,mask:[e,e,e,e,e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,e,e,e,e,e,e,e,e],placeholder:n.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Nt=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,Wt=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function gt(n){return{mask:null,allowMode:"custom",allow:e=>/[0-9ptwdhms]/i.test(e),pipe:e=>{const l=e.toUpperCase();return l.length===0?l:!l.startsWith("P")||!Nt.test(l)?!1:l},completion:{mode:"custom",isComplete:e=>{const l=e.toUpperCase();if(!Wt.test(l))return!1;try{return n(l),!0}catch{return!1}}}}}const st=(n,e)=>{if(n==null)return null;try{return n.Duration.from(e)}catch{return null}},Rt=n=>{const{value:e,onChange:l,onInput:r,after:o,disabled:h,onBlur:s}=n,f=()=>{const p=tt(e,h,l??r);return o!=null?t.Fragment(p,o):p},m=n.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return ct(p=>{const d=A.mapInputOptions(n,b=>b?.toString()??"",b=>b===""?null:p.Duration.from(b));return et({...d,onInput:void 0,...gt(p.Duration.from),placeholder:"P0DT0H0M0S",after:f()})},{pending:()=>{const p=d=>b=>{const c=b.currentTarget?.value??"";if(c===""){d(null);return}const V=globalThis.Temporal,k=st(V,c);if(k!=null){d(k);return}H().then(u=>{const g=st(u,c);g!=null&&d(g)}).catch(()=>{})};return B.InputContainer({...n,input:t.input.text(A.CommonInputAttributes(n),t.attr.value(t.Value.map(e,d=>d?.toString()??"")),t.attr.class("bc-input"),m,s!=null?t.on.blur(()=>s()):t.Empty,l!=null?t.on.change(p(l)):t.Empty,r!=null?t.on.input(p(r)):t.Empty),after:f()})}})},Pt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o}=n;return B.InputContainer({...n,input:t.input.url(A.CommonInputAttributes(n),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})};function vt(n,e){const{onMove:l,cannotMoveUp:r,cannotMoveDown:o,onRemove:h,showMove:s=!0,showRemove:f=!0,removeDisabled:m,showMoveButtons:x=!0,layout:p="aside"}=n,d=t.Value.toSignal(p).map(c=>c==="aside"),b=t.When(s,()=>t.html.div(t.attr.class("bc-list-item-controls__move"),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("up"),disabled:r},t.Use(C.BeatUII18n,c=>C.Icon({size:"xs",icon:"line-md:arrow-up",title:c.$.incrementValue}))),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("down"),disabled:o},t.Use(C.BeatUII18n,c=>C.Icon({size:"xs",icon:"line-md:arrow-down",title:c.$.decrementValue}))))),a=t.When(f,()=>t.Use(C.BeatUII18n,c=>O.CloseButton({size:"xs",label:t.Value.map(c.$.removeItem,V=>V.toLowerCase()),color:"danger",disabled:m,onClick:h})));return t.When(d,()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--aside"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(x,()=>b),a)),()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--below"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(x,()=>b,()=>t.html.div()),a)))}const xt=n=>{const{controller:e,element:l,separator:r,showMove:o=!0,showRemove:h=!0,showAdd:s=!0,createItem:f,addLabel:m,controlsLayout:x="aside",removeDisabled:p,addDisabled:d}=n,b=t.When(t.computedOf(s,f)((a,c)=>a&&c!=null),()=>Q(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),B.Button({size:"sm",variant:"filled",onClick:()=>e.push(f()),disabled:t.computedOf(e.disabled,d??!1)((a,c)=>a||c)},t.Use(C.BeatUII18n,a=>Q(t.attr.class("bc-group--gap-2"),C.Icon({icon:"line-md:plus"}),m??a.$.addLabel)))));return t.Fragment(ht(e,a=>vt({onMove:a.move,cannotMoveUp:a.cannotMove("up"),cannotMoveDown:a.cannotMove("down"),onRemove:a.remove,showMove:o,showRemove:h,removeDisabled:p,showMoveButtons:e.signal.map(c=>c.length>1),layout:x},l(a)),r),b)},jt=(n,...e)=>{const{controller:l,element:r,separator:o,showMove:h,showRemove:s,showAdd:f,createItem:m,addLabel:x,controlsLayout:p,removeDisabled:d,addDisabled:b,...a}=n;return O.InputWrapper({...a,content:xt({controller:l,element:r,separator:o,showMove:h,showRemove:s,showAdd:f,createItem:m,addLabel:x,controlsLayout:p,removeDisabled:d,addDisabled:b})},...e)};class qt extends O.Controller{branches;activeBranch;#e;#t=new Map;constructor(e,l,r,o,h,s,f=L.strictEqual){super(e,l,r,o,h,f),this.branches=s;const m=p=>{for(const d of s)if(d.detect(p))return d.key;return s[0]?.key??"unknown"};this.activeBranch=r.map(m,L.strictEqual);const x=p=>{if(this.#t.has(p))return this.#t.get(p);const d=s.find(a=>a.key===p);if(!d)throw new Error(`Unknown branch: ${p}`);const b=new O.Controller([...e,p],a=>{this.change(a)},this.signal.map(a=>d.detect(a)?a:d.defaultValue(),f),o.map(O.makeMapValidation([p])),{disabled:this.disabled,validationMode:this.parent.validationMode},f);return this.#t.set(p,b),b};this.#e=this.activeBranch.map(p=>x(p),L.strictEqual),this.onDispose(()=>{for(const p of this.#t.values())p.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(e){const l=this.branches.find(o=>o.key===e);if(!l)throw new Error(`Unknown branch: ${e}`);if(this.#t.has(e))return this.#t.get(e);const r=new O.Controller([...this.path,e],o=>{this.change(o)},this.signal.map(o=>l.detect(o)?o:l.defaultValue(),L.strictEqual),this.status.map(O.makeMapValidation([e])),{disabled:this.disabled,validationMode:this.parent.validationMode},L.strictEqual);return this.#t.set(e,r),r}switchToBranch(e,l=!1){const r=this.branches.find(s=>s.key===e);if(!r)throw new Error(`Unknown branch: ${e}`);const o=t.Value.get(this.signal);if(r.detect(o))return!0;if(r.convert){const s=r.convert(o);if(s.ok)return this.change(s.value),!0}if(l&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm(C.defaultMessages.changeTypeConfirmation))return!1;const h=r.defaultValue();return this.change(h),!0}get activeBranchDefinition(){const e=t.Value.get(this.activeBranch);return this.branches.find(l=>l.key===e)}}function Zt(n){return n.transform(e=>e??null,e=>e??void 0)}function Ht(n){return n.transform(e=>e??"",e=>e===""?void 0:e)}function Yt(n){return n.transform(e=>e??void 0,e=>e??null)}function q(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)&&Object.prototype.toString.call(n)==="[object Object]"}function yt(n,e){if(e==null)return it(n);if(n==null)return e;if(q(n)&&q(e)){const l={...e};for(const r of Object.keys(n))l[r]===void 0?l[r]=it(n[r]):q(n[r])&&q(l[r])&&(l[r]=yt(n[r],l[r]));return l}return e}function it(n){return typeof structuredClone=="function"?structuredClone(n):JSON.parse(JSON.stringify(n))}exports.BaseListControl=xt;exports.BaseNativeSelectControl=mt;exports.Expando=pt;exports.FilesInput=Bt;exports.Group=Q;exports.ListControl=jt;exports.ListInput=ht;exports.ListItemControls=vt;exports.MaskInput=et;exports.NativeSelect=dt;exports.NativeSelectControl=Ct;exports.NullableDurationInput=Rt;exports.NullableNumberInput=zt;exports.NullableResetAfter=tt;exports.NumberInput=kt;exports.SegmentedInput=Mt;exports.TextArea=Ft;exports.UnionController=qt;exports.UnstyledDropZone=Z;exports.UrlInput=Pt;exports.UuidInput=Lt;exports.WithTemporal=ct;exports.deepMergeDefaults=yt;exports.durationMaskConfig=gt;exports.emitExpando=wt;exports.emitOptionExpando=X;exports.ensureTemporal=H;exports.roundToStep=N;exports.transformEmptyStringToUndefined=Ht;exports.transformNullToUndefined=Zt;exports.transformUndefinedToNull=Yt;
@@ -1,6 +1,6 @@
1
1
  import { Task as ye, Use as O, Value as f, prop as ae, html as g, attr as l, on as C, WithElement as te, Empty as M, aria as J, bind as ie, OnDispose as ne, coalesce as Ne, ForEach as ee, Fragment as N, Ensure as Pe, OneOfType as je, computedOf as A, input as se, emitValue as P, emitValueAsNumber as we, style as _e, When as U, NotEmpty as We, Repeat as Ze, signal as ke } from "@tempots/dom";
2
2
  import { I as W, a as He, B as be } from "./input-container-BvEcp7FU.js";
3
- import { C as q, m as qe } from "./text-input-DfqXolVe.js";
3
+ import { C as q, m as qe } from "./text-input-dDUEUmlC.js";
4
4
  import { I as Ae, m as Ye, c as Ge, C as oe, d as pe, e as Ce } from "./use-form-Dn6v2tEh.js";
5
5
  import { B as F, d as ce, I as E, b as De, f as Ie } from "./translations-B1_yyDUK.js";
6
6
  import { S as Le } from "./stack-BLMteGTn.js";