@tempots/beatui 1.5.0 → 1.6.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 (184) hide show
  1. package/dist/ar-Wr6gMs-M.cjs +1 -0
  2. package/dist/{ar-C-kUt6f9.js → ar-fdUqbCvM.js} +154 -1
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +1 -1
  5. package/dist/auth-divider-DewHpITQ.cjs +1 -0
  6. package/dist/{auth-divider-BIATan1F.js → auth-divider-qnJuYK-x.js} +7 -7
  7. package/dist/beatui.css +1711 -132
  8. package/dist/beatui.tailwind.css +1711 -132
  9. package/dist/better-auth/index.cjs.js +1 -1
  10. package/dist/better-auth/index.es.js +5 -5
  11. package/dist/{modal-BHlp4QeT.js → custom-validation-BetUqAEz.js} +186 -186
  12. package/dist/custom-validation-CLscGHY4.cjs +1 -0
  13. package/dist/{de-CP0kbElb.js → de-C5-k5Eov.js} +156 -3
  14. package/dist/de-DZqdSEta.cjs +1 -0
  15. package/dist/deep-merge-D90SW1Ci.cjs +1 -0
  16. package/dist/deep-merge-ZVigk5Qf.js +1765 -0
  17. package/dist/{duration-input-C5il_E0F.cjs → duration-input-4AQnQpyo.cjs} +1 -1
  18. package/dist/{duration-input-DoCCrqOG.js → duration-input-GMBmT1BE.js} +4 -4
  19. package/dist/{editor-toolbar-group-QVdBUbB8.cjs → editor-toolbar-group-C_ft_T8D.cjs} +1 -1
  20. package/dist/{editor-toolbar-group-DWUWUO-B.js → editor-toolbar-group-FpOHrmtx.js} +2 -2
  21. package/dist/es-CJgYfRap.cjs +1 -0
  22. package/dist/{es-BtIkcnsw.js → es-h6jmoF4X.js} +156 -3
  23. package/dist/fa-BQ5PzwNY.cjs +1 -0
  24. package/dist/{fa-11-rZmQ-.js → fa-BuxK837l.js} +154 -1
  25. package/dist/fr-Bv3TG44U.cjs +1 -0
  26. package/dist/{fr-C-L2F8w2.js → fr-BwILQ9G2.js} +165 -12
  27. package/dist/he-5LbvgMCC.cjs +1 -0
  28. package/dist/{he-Bu1xGoQ9.js → he-yC9Sc7JD.js} +154 -1
  29. package/dist/{hi-CewH-MAH.js → hi-Da7rcCpP.js} +154 -1
  30. package/dist/hi-YWhWcG_L.cjs +1 -0
  31. package/dist/{index-BGKz2Nol.js → index-DI8bf9oC.js} +175 -172
  32. package/dist/index-DeUj-5ph.cjs +1 -0
  33. package/dist/index.cjs.js +4 -4
  34. package/dist/index.es.js +11548 -8326
  35. package/dist/{input-container-CO3DNqpp.js → input-container-8JFB11xN.js} +1 -1
  36. package/dist/{input-container-BkPcNDaZ.cjs → input-container-CyOgiiQD.cjs} +1 -1
  37. package/dist/it-BxOIJE45.cjs +1 -0
  38. package/dist/{it-5hiKQO_p.js → it-Yeklau78.js} +156 -3
  39. package/dist/ja-CNhjK06P.cjs +1 -0
  40. package/dist/{ja-CGfEmZrm.js → ja-Dxj9Q5Yd.js} +155 -2
  41. package/dist/json-schema/index.cjs.js +1 -1
  42. package/dist/json-schema/index.es.js +10 -10
  43. package/dist/json-schema-display/index.cjs.js +1 -1
  44. package/dist/json-schema-display/index.es.js +1 -1
  45. package/dist/json-structure/index.cjs.js +1 -1
  46. package/dist/json-structure/index.es.js +5 -5
  47. package/dist/ko-DgkqcXTs.cjs +1 -0
  48. package/dist/{ko-DZthvREd.js → ko-gn_MsegK.js} +154 -1
  49. package/dist/lexical/index.cjs.js +1 -1
  50. package/dist/lexical/index.es.js +4 -4
  51. package/dist/nl-Dy9lmbBO.cjs +1 -0
  52. package/dist/{nl-CcKyHlQ7.js → nl-vHNFtXXb.js} +162 -9
  53. package/dist/{notice-BXKtBEiC.js → notice-B6ojfenv.js} +4 -4
  54. package/dist/{notice-BBnSXYUc.cjs → notice-p2IqXS5-.cjs} +1 -1
  55. package/dist/{oneof-branch-detection-DSzC0PkO.js → oneof-branch-detection-Q_jxvJIA.js} +1 -1
  56. package/dist/{oneof-branch-detection-BEkAezNi.cjs → oneof-branch-detection-xDDDdYRk.cjs} +1 -1
  57. package/dist/pl-BtYbtsmG.cjs +1 -0
  58. package/dist/{pl-Mwtjp4MV.js → pl-C0UdHla0.js} +184 -31
  59. package/dist/prosemirror/index.cjs.js +1 -1
  60. package/dist/prosemirror/index.es.js +4 -4
  61. package/dist/pt-CtNmqQ1X.cjs +1 -0
  62. package/dist/{pt-BaTsY-8f.js → pt-DGKtfN0d.js} +156 -3
  63. package/dist/ru-BaL_NPRU.cjs +1 -0
  64. package/dist/{ru-CvbGmz5s.js → ru-CpXYLt-v.js} +154 -1
  65. package/dist/tailwind/preset.cjs.js +1 -1
  66. package/dist/tailwind/preset.es.js +1 -1
  67. package/dist/tailwind/vite-plugin.cjs.js +1 -1
  68. package/dist/tailwind/vite-plugin.es.js +1 -1
  69. package/dist/{text-input-D_IxFd0M.cjs → text-input-DS5zlXb2.cjs} +1 -1
  70. package/dist/{text-input-BAn02BzO.js → text-input-NJypZSnE.js} +1 -1
  71. package/dist/{toolbar-CnecqhaU.cjs → toolbar-BBwfe8U9.cjs} +1 -1
  72. package/dist/{toolbar-BKan3NHw.js → toolbar-BF2L6WKC.js} +1 -1
  73. package/dist/{tr-YFqQdZjM.js → tr-DIFZDFW_.js} +156 -3
  74. package/dist/tr-DwOd87oB.cjs +1 -0
  75. package/dist/{translations-CxDUnbXn.js → translations-5cXBrENb.js} +1 -1
  76. package/dist/{translations-DT5QQ4WO.js → translations-BCMP-h52.js} +269 -115
  77. package/dist/{translations-C_-cObaF.cjs → translations-BqWc0ZHz.cjs} +1 -1
  78. package/dist/translations-EwEmHe3v.cjs +1 -0
  79. package/dist/types/beatui-i18n/default.d.ts +109 -0
  80. package/dist/types/beatui-i18n/locales/en.d.ts +109 -0
  81. package/dist/types/beatui-i18n/translations.d.ts +109 -0
  82. package/dist/types/components/button/copy-button.d.ts +42 -0
  83. package/dist/types/components/button/index.d.ts +1 -0
  84. package/dist/types/components/button/toggle-button-group.d.ts +2 -2
  85. package/dist/types/components/button/toggle-button.d.ts +2 -2
  86. package/dist/types/components/data/date-picker-shared.d.ts +2 -5
  87. package/dist/types/components/data/date-picker.d.ts +1 -1
  88. package/dist/types/components/data/date-range-picker.d.ts +1 -1
  89. package/dist/types/components/data/index.d.ts +3 -0
  90. package/dist/types/components/data/stat-card.d.ts +108 -0
  91. package/dist/types/components/data/time-picker.d.ts +54 -0
  92. package/dist/types/components/data/virtual-scrolling/index.d.ts +1 -0
  93. package/dist/types/components/data/virtual-scrolling/virtual-list.d.ts +91 -0
  94. package/dist/types/components/form/input/checkbox-input.d.ts +1 -1
  95. package/dist/types/components/form/input/color-input.d.ts +1 -1
  96. package/dist/types/components/form/input/color-picker/canvas-draw.d.ts +12 -0
  97. package/dist/types/components/form/input/color-picker/channel-picker.d.ts +71 -0
  98. package/dist/types/components/form/input/color-picker/hex-color-picker.d.ts +20 -0
  99. package/dist/types/components/form/input/color-picker/hsl-color-picker.d.ts +14 -0
  100. package/dist/types/components/form/input/color-picker/hwb-color-picker.d.ts +15 -0
  101. package/dist/types/components/form/input/color-picker/index.d.ts +7 -0
  102. package/dist/types/components/form/input/color-picker/oklch-color-picker.d.ts +15 -0
  103. package/dist/types/components/form/input/color-picker/rgb-color-picker.d.ts +17 -0
  104. package/dist/types/components/form/input/color-swatch-input.d.ts +1 -1
  105. package/dist/types/components/form/input/combobox-input.d.ts +1 -1
  106. package/dist/types/components/form/input/date-input.d.ts +1 -1
  107. package/dist/types/components/form/input/date-range-select-base.d.ts +23 -0
  108. package/dist/types/components/form/input/date-range-select.d.ts +64 -0
  109. package/dist/types/components/form/input/date-select.d.ts +52 -0
  110. package/dist/types/components/form/input/date-time-input.d.ts +1 -1
  111. package/dist/types/components/form/input/date-time-select-base.d.ts +23 -0
  112. package/dist/types/components/form/input/date-time-select.d.ts +66 -0
  113. package/dist/types/components/form/input/dropdown-input.d.ts +1 -1
  114. package/dist/types/components/form/input/email-input.d.ts +1 -1
  115. package/dist/types/components/form/input/index.d.ts +17 -0
  116. package/dist/types/components/form/input/nullable-date-select.d.ts +55 -0
  117. package/dist/types/components/form/input/nullable-date-time-select.d.ts +68 -0
  118. package/dist/types/components/form/input/nullable-time-select.d.ts +64 -0
  119. package/dist/types/components/form/input/number-input.d.ts +5 -40
  120. package/dist/types/components/form/input/number-stepper.d.ts +53 -0
  121. package/dist/types/components/form/input/open-date-range-select.d.ts +75 -0
  122. package/dist/types/components/form/input/otp-input.d.ts +2 -2
  123. package/dist/types/components/form/input/password-input.d.ts +1 -1
  124. package/dist/types/components/form/input/radio-group.d.ts +1 -1
  125. package/dist/types/components/form/input/range-slider.d.ts +4 -4
  126. package/dist/types/components/form/input/rating-input.d.ts +1 -1
  127. package/dist/types/components/form/input/segmented-input.d.ts +6 -2
  128. package/dist/types/components/form/input/segmented-select.d.ts +84 -0
  129. package/dist/types/components/form/input/slider-input.d.ts +2 -2
  130. package/dist/types/components/form/input/sortable-list.d.ts +68 -0
  131. package/dist/types/components/form/input/switch.d.ts +1 -1
  132. package/dist/types/components/form/input/text-area.d.ts +1 -1
  133. package/dist/types/components/form/input/text-input.d.ts +1 -1
  134. package/dist/types/components/form/input/time-format.d.ts +31 -0
  135. package/dist/types/components/form/input/time-select-base.d.ts +23 -0
  136. package/dist/types/components/form/input/time-select.d.ts +61 -0
  137. package/dist/types/components/form/input/transfer-list.d.ts +56 -0
  138. package/dist/types/components/form/input/tri-state-checkbox-input.d.ts +1 -1
  139. package/dist/types/components/form/input/url-input.d.ts +1 -1
  140. package/dist/types/components/layout/nine-slice-scroll-view.d.ts +1 -1
  141. package/dist/types/components/navigation/index.d.ts +1 -0
  142. package/dist/types/components/navigation/stepper.d.ts +102 -0
  143. package/dist/types/components/overlay/index.d.ts +1 -1
  144. package/dist/types/components/overlay/spotlight.d.ts +62 -0
  145. package/dist/types/utils/index.d.ts +0 -1
  146. package/dist/ur-D9nLchps.cjs +1 -0
  147. package/dist/{ur-CdnwwnG_.js → ur-DBst-TXc.js} +154 -1
  148. package/dist/{use-form-CP6nftVl.cjs → use-form-Dcra7GeE.cjs} +1 -1
  149. package/dist/{use-form-CmQdxpOi.js → use-form-NfobsGNl.js} +2 -2
  150. package/dist/{vi-Bwvz1d_n.js → vi-DQOJp32U.js} +183 -30
  151. package/dist/vi-Dg1aiMr5.cjs +1 -0
  152. package/dist/widget-customization-BtkexHgm.js +1458 -0
  153. package/dist/widget-customization-pqmtsraC.cjs +1 -0
  154. package/dist/{zh-hy7Uw6c5.js → zh-DPK4HXl2.js} +154 -1
  155. package/dist/zh-tbwSTbmn.cjs +1 -0
  156. package/package.json +9 -9
  157. package/dist/ar-Dc56zcjW.cjs +0 -1
  158. package/dist/auth-divider-CVKfA8Cp.cjs +0 -1
  159. package/dist/de-DboQlEC4.cjs +0 -1
  160. package/dist/deep-merge-B33Qtlmw.cjs +0 -1
  161. package/dist/deep-merge-BUsrE2v4.js +0 -1704
  162. package/dist/es-CAmE_0Ph.cjs +0 -1
  163. package/dist/fa-D9LrFZdW.cjs +0 -1
  164. package/dist/fr-DKogQyss.cjs +0 -1
  165. package/dist/he-CVx91Jdr.cjs +0 -1
  166. package/dist/hi-BgrHV72l.cjs +0 -1
  167. package/dist/index-DFF7Uahh.cjs +0 -1
  168. package/dist/it-B1rA1F9l.cjs +0 -1
  169. package/dist/ja-DZnjjqoi.cjs +0 -1
  170. package/dist/ko-CDnYKYWU.cjs +0 -1
  171. package/dist/modal-BmpfNL48.cjs +0 -1
  172. package/dist/nl-Bj8QnDEY.cjs +0 -1
  173. package/dist/pl-BmuuxxVd.cjs +0 -1
  174. package/dist/pt-RiC0yeVA.cjs +0 -1
  175. package/dist/ru-pRqtOQHF.cjs +0 -1
  176. package/dist/tr-B9JhBJeL.cjs +0 -1
  177. package/dist/translations-qefRsdGi.cjs +0 -1
  178. package/dist/types/components/overlay/command-palette.d.ts +0 -17
  179. package/dist/types/utils/color.d.ts +0 -346
  180. package/dist/ur-BZakU0iv.cjs +0 -1
  181. package/dist/vi-D1nly0nb.cjs +0 -1
  182. package/dist/widget-customization-B0y-eesp.cjs +0 -1
  183. package/dist/widget-customization-CKbR4Dsg.js +0 -1066
  184. package/dist/zh-DBk7sSD9.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),C=require("../auth-divider-CVKfA8Cp.cjs"),A=require("../translations-qefRsdGi.cjs"),w=require("../notice-BBnSXYUc.cjs"),y=require("../stack-dwLevGa2.cjs"),b=require("../input-container-BkPcNDaZ.cjs"),v=require("../text-input-D_IxFd0M.cjs");function g(a,t){return a.error?(t.onError?.({message:a.error.message,status:a.error.status}),a.error.message):null}function I(a,t,s){return async n=>{const l=await a.signIn.email({email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(l,t);return o||(await s(),null)}}function F(a,t,s){return async n=>{const l=await a.signUp.email({name:n.name,email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(l,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 L(a,t={}){const s=e.prop(null),n=e.prop(!0),l=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(),l.dispose(),o.dispose()}return{session:s,isPending:n,user:l,isAuthenticated:o,refresh:d,dispose:p}}function P(a){return a.map(t=>({provider:t}))}function _(a,t={}){const s=L(a,{refreshInterval:t.refreshInterval,onSessionChange:t.onSessionChange}),n=()=>s.refresh(),l=I(a,t,n),o=F(a,t,n),u=U(a,t),d=$(a,t),p=t.socialProviders?P(t.socialProviders):[],h={onSignIn:l,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},i={onSignUp:o,passwordRules:t.passwordRules,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,showAcceptTermsAndConditions:t.showAcceptTermsAndConditions,termsAndConditions:t.termsAndConditions,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},c={onSignIn:l,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,showAcceptTermsAndConditions:t.showAcceptTermsAndConditions,termsAndConditions:t.termsAndConditions,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:c,signInOptions:h,signUpOptions:i,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=_(a.client,a);return{value:t,dispose:()=>t.dispose()}}};function E(a,t,...s){return C.AuthContainer({...a.containerOptions,...t},...s)}function O(a,t){return C.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=A.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(""),l=e.prop(null),o=e.prop([]),u=e.prop(""),d=e.prop(null),p=e.prop(!1),h=e.prop("password");async function i(c){c.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&&(l.set(r.data.totpURI),o.set(r.data.backupCodes),h.set("verify"))}async function m(c){c.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,c=>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(i),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),c.$.twoFactorSetupDescription),w.PasswordInput({value:n,onChange:r=>n.set(r),placeholder:c.$.passwordPlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),c.$.twoFactorEnableButton))),verify:()=>e.Fragment(e.Ensure(l,r=>e.html.div(e.attr.class("bc-two-factor__totp-uri"),e.html.p(c.$.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(c.$.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:c.$.twoFactorCodePlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),c.$.twoFactorVerifyButton)))),complete:()=>e.html.div(e.attr.class("bc-two-factor__complete"),w.Notice({variant:"success",tone:"prominent"},e.html.div(c.$.twoFactorEnabled)))})))}function x({twoFactor:a,methods:t=["totp","backup"],trustDevice:s,onVerified:n}){const l=e.prop(""),o=e.prop(null),u=e.prop(!1),d=e.prop(t[0]??"totp");async function p(i){i.preventDefault(),u.set(!0),o.set(null);const m=d.value;let c;if(m==="totp")c=await a.verifyTotp({code:l.value,trustDevice:s});else if(m==="otp"&&a.verifyOtp)c=await a.verifyOtp({code:l.value,trustDevice:s});else if(m==="backup")c=await a.verifyBackupCode({code:l.value});else{o.set("Unsupported verification method"),u.set(!1);return}if(u.set(!1),c.error){o.set(c.error.message);return}n?.()}async function h(){if(!a.sendOtp)return;u.set(!0),o.set(null);const i=await a.sendOtp({trustDevice:s});u.set(!1),i.error&&o.set(i.error.message)}return e.Use(k,i=>{const m=e.computedOf(d,i)((r,f)=>r==="totp"?f.twoFactorTotpDescription:r==="otp"?f.twoFactorOtpDescription:f.twoFactorBackupDescription),c=e.computedOf(d,i)((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),l.set(""),o.set(null)}),i.$.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},i.$.twoFactorSendOtpButton)),v.TextInput({value:l,onChange:r=>l.set(r),placeholder:c}),b.Button({type:"submit",variant:"filled",color:"primary",loading:u},e.attr.class("bc-auth-form__submit"),i.$.twoFactorVerifyButton))))})}function V({client:a,callbackURL:t}){const s=e.prop(""),n=e.prop(null),l=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}l.set(!0),n.set(null);const p=await a.signIn.magicLink({email:s.value,callbackURL:t});if(l.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:l},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 l=e.prop(!1);async function o(){if(!a.signIn.passkey)return;l.set(!0);const u=await a.signIn.passkey({autoFill:t});if(l.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:l},e.attr.class("bc-passkey-signin"),u.$.passkeySignInButton))}function z({passkey:a}){const t=e.prop([]),s=e.prop(null),n=e.prop(!1),l=e.prop("");async function o(i,m){n.set(!0),s.set(null);const c=await i();if(n.set(!1),c.error){s.set(c.error.message);return}await m?.(c.data)}async function u(){await o(()=>a.listUserPasskeys(),i=>t.set(i??[]))}async function d(){const i=l.value||void 0;await o(()=>a.addPasskey({name:i}),async()=>{l.set(""),await u()})}async function p(i){await o(()=>a.deletePasskey({id:i}),()=>u())}async function h(i,m){await o(()=>a.updatePasskey({id:i,name:m}),()=>u())}return u(),e.Use(k,i=>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 c=e.prop(!1),r=e.prop(m.$.name?.value??"");return e.html.div(e.attr.class("bc-passkey-item"),e.Unless(c,()=>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??i.$.passkeyUnnamed.value)??i.$.passkeyUnnamed),e.html.span(e.attr.class("bc-passkey-item__date"),m.$.createdAt))),e.When(c,()=>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(c,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:()=>{r.set(m.$.name?.value??""),c.set(!0)}},i.$.passkeyRenameButton),b.Button({type:"button",variant:"text",size:"sm",color:"danger",onClick:()=>p(m.$.id.value)},i.$.passkeyDeleteButton))),e.When(c,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:async()=>{await h(m.$.id.value,r.value),c.set(!1)}},i.$.passkeySaveButton),b.Button({type:"button",variant:"text",size:"sm",onClick:()=>c.set(!1)},i.$.passkeyCancelButton)))))})),e.html.div(e.attr.class("bc-passkey-add"),y.Stack(v.TextInput({value:l,onChange:m=>l.set(m),placeholder:i.$.passkeyNamePlaceholder}),b.Button({type:"button",variant:"filled",color:"primary",onClick:d,loading:n},i.$.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=_;exports.createSessionManager=L;exports.mapSocialProviders=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),C=require("../auth-divider-DewHpITQ.cjs"),A=require("../translations-EwEmHe3v.cjs"),w=require("../notice-p2IqXS5-.cjs"),y=require("../stack-dwLevGa2.cjs"),b=require("../input-container-CyOgiiQD.cjs"),v=require("../text-input-DS5zlXb2.cjs");function g(a,t){return a.error?(t.onError?.({message:a.error.message,status:a.error.status}),a.error.message):null}function I(a,t,s){return async n=>{const l=await a.signIn.email({email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(l,t);return o||(await s(),null)}}function F(a,t,s){return async n=>{const l=await a.signUp.email({name:n.name,email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(l,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 L(a,t={}){const s=e.prop(null),n=e.prop(!0),l=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(),l.dispose(),o.dispose()}return{session:s,isPending:n,user:l,isAuthenticated:o,refresh:d,dispose:p}}function P(a){return a.map(t=>({provider:t}))}function _(a,t={}){const s=L(a,{refreshInterval:t.refreshInterval,onSessionChange:t.onSessionChange}),n=()=>s.refresh(),l=I(a,t,n),o=F(a,t,n),u=U(a,t),d=$(a,t),p=t.socialProviders?P(t.socialProviders):[],h={onSignIn:l,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},i={onSignUp:o,passwordRules:t.passwordRules,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,showAcceptTermsAndConditions:t.showAcceptTermsAndConditions,termsAndConditions:t.termsAndConditions,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},c={onSignIn:l,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,showAcceptTermsAndConditions:t.showAcceptTermsAndConditions,termsAndConditions:t.termsAndConditions,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:c,signInOptions:h,signUpOptions:i,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=_(a.client,a);return{value:t,dispose:()=>t.dispose()}}};function E(a,t,...s){return C.AuthContainer({...a.containerOptions,...t},...s)}function O(a,t){return C.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=A.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(""),l=e.prop(null),o=e.prop([]),u=e.prop(""),d=e.prop(null),p=e.prop(!1),h=e.prop("password");async function i(c){c.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&&(l.set(r.data.totpURI),o.set(r.data.backupCodes),h.set("verify"))}async function m(c){c.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,c=>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(i),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),c.$.twoFactorSetupDescription),w.PasswordInput({value:n,onChange:r=>n.set(r),placeholder:c.$.passwordPlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),c.$.twoFactorEnableButton))),verify:()=>e.Fragment(e.Ensure(l,r=>e.html.div(e.attr.class("bc-two-factor__totp-uri"),e.html.p(c.$.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(c.$.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:c.$.twoFactorCodePlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),c.$.twoFactorVerifyButton)))),complete:()=>e.html.div(e.attr.class("bc-two-factor__complete"),w.Notice({variant:"success",tone:"prominent"},e.html.div(c.$.twoFactorEnabled)))})))}function x({twoFactor:a,methods:t=["totp","backup"],trustDevice:s,onVerified:n}){const l=e.prop(""),o=e.prop(null),u=e.prop(!1),d=e.prop(t[0]??"totp");async function p(i){i.preventDefault(),u.set(!0),o.set(null);const m=d.value;let c;if(m==="totp")c=await a.verifyTotp({code:l.value,trustDevice:s});else if(m==="otp"&&a.verifyOtp)c=await a.verifyOtp({code:l.value,trustDevice:s});else if(m==="backup")c=await a.verifyBackupCode({code:l.value});else{o.set("Unsupported verification method"),u.set(!1);return}if(u.set(!1),c.error){o.set(c.error.message);return}n?.()}async function h(){if(!a.sendOtp)return;u.set(!0),o.set(null);const i=await a.sendOtp({trustDevice:s});u.set(!1),i.error&&o.set(i.error.message)}return e.Use(k,i=>{const m=e.computedOf(d,i)((r,f)=>r==="totp"?f.twoFactorTotpDescription:r==="otp"?f.twoFactorOtpDescription:f.twoFactorBackupDescription),c=e.computedOf(d,i)((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),l.set(""),o.set(null)}),i.$.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},i.$.twoFactorSendOtpButton)),v.TextInput({value:l,onChange:r=>l.set(r),placeholder:c}),b.Button({type:"submit",variant:"filled",color:"primary",loading:u},e.attr.class("bc-auth-form__submit"),i.$.twoFactorVerifyButton))))})}function V({client:a,callbackURL:t}){const s=e.prop(""),n=e.prop(null),l=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}l.set(!0),n.set(null);const p=await a.signIn.magicLink({email:s.value,callbackURL:t});if(l.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:l},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 l=e.prop(!1);async function o(){if(!a.signIn.passkey)return;l.set(!0);const u=await a.signIn.passkey({autoFill:t});if(l.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:l},e.attr.class("bc-passkey-signin"),u.$.passkeySignInButton))}function z({passkey:a}){const t=e.prop([]),s=e.prop(null),n=e.prop(!1),l=e.prop("");async function o(i,m){n.set(!0),s.set(null);const c=await i();if(n.set(!1),c.error){s.set(c.error.message);return}await m?.(c.data)}async function u(){await o(()=>a.listUserPasskeys(),i=>t.set(i??[]))}async function d(){const i=l.value||void 0;await o(()=>a.addPasskey({name:i}),async()=>{l.set(""),await u()})}async function p(i){await o(()=>a.deletePasskey({id:i}),()=>u())}async function h(i,m){await o(()=>a.updatePasskey({id:i,name:m}),()=>u())}return u(),e.Use(k,i=>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 c=e.prop(!1),r=e.prop(m.$.name?.value??"");return e.html.div(e.attr.class("bc-passkey-item"),e.Unless(c,()=>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??i.$.passkeyUnnamed.value)??i.$.passkeyUnnamed),e.html.span(e.attr.class("bc-passkey-item__date"),m.$.createdAt))),e.When(c,()=>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(c,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:()=>{r.set(m.$.name?.value??""),c.set(!0)}},i.$.passkeyRenameButton),b.Button({type:"button",variant:"text",size:"sm",color:"danger",onClick:()=>p(m.$.id.value)},i.$.passkeyDeleteButton))),e.When(c,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:async()=>{await h(m.$.id.value,r.value),c.set(!1)}},i.$.passkeySaveButton),b.Button({type:"button",variant:"text",size:"sm",onClick:()=>c.set(!1)},i.$.passkeyCancelButton)))))})),e.html.div(e.attr.class("bc-passkey-add"),y.Stack(v.TextInput({value:l,onChange:m=>l.set(m),placeholder:i.$.passkeyNamePlaceholder}),b.Button({type:"button",variant:"filled",color:"primary",onClick:d,loading:n},i.$.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=_;exports.createSessionManager=L;exports.mapSocialProviders=P;
@@ -1,10 +1,10 @@
1
1
  import { prop as b, computedOf as _, makeProviderMark as U, When as y, Unless as B, Use as P, html as r, attr as l, Ensure as g, OneOfValue as D, Fragment as E, NotEmpty as O, ForEach as R, on as C } from "@tempots/dom";
2
- import { b as M, d as T } from "../auth-divider-BIATan1F.js";
3
- import { m as N } from "../translations-DT5QQ4WO.js";
4
- import { N as v, P as V, E as x } from "../notice-BXKtBEiC.js";
2
+ import { b as M, d as T } from "../auth-divider-qnJuYK-x.js";
3
+ import { m as N } from "../translations-BCMP-h52.js";
4
+ import { N as v, P as V, E as x } from "../notice-B6ojfenv.js";
5
5
  import { S as L } from "../stack-BLMteGTn.js";
6
- import { B as k } from "../input-container-CO3DNqpp.js";
7
- import { T as A } from "../text-input-BAn02BzO.js";
6
+ import { B as k } from "../input-container-8JFB11xN.js";
7
+ import { T as A } from "../text-input-NJypZSnE.js";
8
8
  function I(t, e) {
9
9
  return t.error ? (e.onError?.({
10
10
  message: t.error.message,
@@ -2,9 +2,9 @@ import { WithElement as q, OnDispose as W, WithBrowserCtx as z, Value as j, rend
2
2
  import { u as G } from "./use-animated-toggle-C3asw_Sg.js";
3
3
  import { delayedAnimationFrame as J } from "@tempots/std";
4
4
  import { s as N } from "./session-id-3KiilioY.js";
5
- import { B as P } from "./translations-DT5QQ4WO.js";
6
- import { C as Q } from "./use-form-CmQdxpOi.js";
7
- import { B as D } from "./input-container-CO3DNqpp.js";
5
+ import { B as P } from "./translations-BCMP-h52.js";
6
+ import { C as Q } from "./use-form-NfobsGNl.js";
7
+ import { B as D } from "./input-container-8JFB11xN.js";
8
8
  const X = [
9
9
  "a[href]",
10
10
  "button:not([disabled])",
@@ -90,178 +90,6 @@ function de(c = {}) {
90
90
  };
91
91
  }
92
92
  function Z(c) {
93
- return {
94
- "~standard": {
95
- version: 1,
96
- vendor: "beatui-custom",
97
- validate: (s) => {
98
- const t = c.validate(s);
99
- return t.success ? { value: t.data } : {
100
- issues: t.errors.map((n) => ({
101
- message: n.message,
102
- path: n.path
103
- }))
104
- };
105
- },
106
- types: void 0
107
- },
108
- safeParse: (s) => {
109
- const t = c.validate(s);
110
- return t.success ? { success: !0, data: t.data } : {
111
- success: !1,
112
- error: {
113
- errors: t.errors.map((n) => ({
114
- message: n.message,
115
- path: n.path?.map(
116
- (r) => typeof r == "object" && "key" in r ? r.key.toString() : r.toString()
117
- ) || []
118
- }))
119
- }
120
- };
121
- }
122
- };
123
- }
124
- class T {
125
- optional() {
126
- return new ee(this);
127
- }
128
- default(e) {
129
- return new te(this, e);
130
- }
131
- schema() {
132
- return Z(this);
133
- }
134
- }
135
- class C extends T {
136
- minLength;
137
- maxLength;
138
- pattern;
139
- customValidations = [];
140
- validate(e) {
141
- if (typeof e != "string")
142
- return { success: !1, errors: [{ message: "Expected string" }] };
143
- const s = [];
144
- this.minLength !== void 0 && e.length < this.minLength && s.push({ message: `Must be at least ${this.minLength} characters` }), this.maxLength !== void 0 && e.length > this.maxLength && s.push({ message: `Must be at most ${this.maxLength} characters` }), this.pattern && !this.pattern.test(e) && s.push({ message: "Invalid format" });
145
- for (const t of this.customValidations) {
146
- const n = t(e);
147
- n && s.push({ message: n });
148
- }
149
- return s.length > 0 ? { success: !1, errors: s } : { success: !0, data: e };
150
- }
151
- min(e, s) {
152
- const t = new C();
153
- return t.minLength = e, t.maxLength = this.maxLength, t.pattern = this.pattern, t.customValidations = [...this.customValidations], s && t.customValidations.push(
154
- (n) => n.length < e ? s : null
155
- ), t;
156
- }
157
- max(e, s) {
158
- const t = new C();
159
- return t.minLength = this.minLength, t.maxLength = e, t.pattern = this.pattern, t.customValidations = [...this.customValidations], s && t.customValidations.push(
160
- (n) => n.length > e ? s : null
161
- ), t;
162
- }
163
- regex(e, s) {
164
- const t = new C();
165
- return t.minLength = this.minLength, t.maxLength = this.maxLength, t.pattern = e, t.customValidations = [...this.customValidations], s && t.customValidations.push(
166
- (n) => e.test(n) ? null : s
167
- ), t;
168
- }
169
- email(e = "Please enter a valid email address") {
170
- const s = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, t = new C();
171
- return t.minLength = this.minLength, t.maxLength = this.maxLength, t.pattern = this.pattern, t.customValidations = [
172
- ...this.customValidations,
173
- (n) => s.test(n) ? null : e
174
- ], t;
175
- }
176
- refine(e) {
177
- const s = new C();
178
- return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations, e], s;
179
- }
180
- }
181
- class V extends T {
182
- mustBeTrue = !1;
183
- trueMessage;
184
- validate(e) {
185
- return typeof e != "boolean" ? { success: !1, errors: [{ message: "Expected boolean" }] } : this.mustBeTrue && e !== !0 ? {
186
- success: !1,
187
- errors: [{ message: this.trueMessage || "Must be true" }]
188
- } : { success: !0, data: e };
189
- }
190
- refine(e, s) {
191
- const t = new V();
192
- t.mustBeTrue = this.mustBeTrue, t.trueMessage = this.trueMessage;
193
- const n = t.validate.bind(t);
194
- return t.validate = (r) => {
195
- const l = n(r);
196
- return l.success ? e(l.data) ? l : { success: !1, errors: [{ message: s }] } : l;
197
- }, t;
198
- }
199
- literal(e, s) {
200
- const t = new V();
201
- return t.mustBeTrue = !0, t.trueMessage = s, t;
202
- }
203
- }
204
- class ee extends T {
205
- constructor(e) {
206
- super(), this.inner = e;
207
- }
208
- validate(e) {
209
- if (e === void 0)
210
- return { success: !0, data: void 0 };
211
- const s = this.inner.validate(e);
212
- return s.success ? { success: !0, data: s.data } : { success: !1, errors: s.errors };
213
- }
214
- }
215
- class te extends T {
216
- constructor(e, s) {
217
- super(), this.inner = e, this.defaultValue = s;
218
- }
219
- validate(e) {
220
- return e === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(e);
221
- }
222
- }
223
- class I extends T {
224
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
225
- constructor(e) {
226
- super(), this.shape = e;
227
- }
228
- validate(e) {
229
- if (typeof e != "object" || e === null || Array.isArray(e))
230
- return { success: !1, errors: [{ message: "Expected object" }] };
231
- const s = e, t = {}, n = [];
232
- for (const [r, l] of Object.entries(this.shape)) {
233
- const u = l.validate(s[r]);
234
- if (u.success)
235
- t[r] = u.data;
236
- else
237
- for (const g of u.errors)
238
- n.push({
239
- message: g.message,
240
- path: [r, ...g.path || []]
241
- });
242
- }
243
- return n.length > 0 ? { success: !1, errors: n } : { success: !0, data: t };
244
- }
245
- refine(e, s) {
246
- const t = new I(this.shape), n = t.validate.bind(t);
247
- return t.validate = (r) => {
248
- const l = n(r);
249
- if (!l.success) return l;
250
- const u = e(l.data);
251
- return u ? {
252
- success: !1,
253
- errors: [
254
- {
255
- message: u,
256
- path: s?.path
257
- }
258
- ]
259
- } : { success: !0, data: l.data };
260
- }, t;
261
- }
262
- }
263
- const me = () => new C(), fe = () => new V(), he = (c) => new I(c);
264
- function se(c) {
265
93
  return z((e) => {
266
94
  const s = [], t = () => s.forEach((r) => r());
267
95
  return c(({
@@ -325,7 +153,7 @@ function se(c) {
325
153
  }, t);
326
154
  });
327
155
  }
328
- function ne(c, e) {
156
+ function ee(c, e) {
329
157
  const {
330
158
  size: s = "md",
331
159
  dismissable: t = !0,
@@ -335,7 +163,7 @@ function ne(c, e) {
335
163
  container: u = "body",
336
164
  position: g = "center"
337
165
  } = c;
338
- return se((h, m) => {
166
+ return Z((h, m) => {
339
167
  let i = () => {
340
168
  };
341
169
  return e((d) => {
@@ -436,11 +264,11 @@ function ne(c, e) {
436
264
  });
437
265
  });
438
266
  }
439
- function pe(c, e) {
267
+ function me(c, e) {
440
268
  const { confirmText: s, cancelText: t, onConfirm: n, onCancel: r, ...l } = c;
441
269
  return _(
442
270
  P,
443
- (u) => ne({ showCloseButton: !1, ...l }, (g, h) => {
271
+ (u) => ee({ showCloseButton: !1, ...l }, (g, h) => {
444
272
  const m = () => {
445
273
  n?.(), h();
446
274
  }, i = () => {
@@ -472,17 +300,189 @@ function pe(c, e) {
472
300
  })
473
301
  );
474
302
  }
303
+ function te(c) {
304
+ return {
305
+ "~standard": {
306
+ version: 1,
307
+ vendor: "beatui-custom",
308
+ validate: (s) => {
309
+ const t = c.validate(s);
310
+ return t.success ? { value: t.data } : {
311
+ issues: t.errors.map((n) => ({
312
+ message: n.message,
313
+ path: n.path
314
+ }))
315
+ };
316
+ },
317
+ types: void 0
318
+ },
319
+ safeParse: (s) => {
320
+ const t = c.validate(s);
321
+ return t.success ? { success: !0, data: t.data } : {
322
+ success: !1,
323
+ error: {
324
+ errors: t.errors.map((n) => ({
325
+ message: n.message,
326
+ path: n.path?.map(
327
+ (r) => typeof r == "object" && "key" in r ? r.key.toString() : r.toString()
328
+ ) || []
329
+ }))
330
+ }
331
+ };
332
+ }
333
+ };
334
+ }
335
+ class T {
336
+ optional() {
337
+ return new se(this);
338
+ }
339
+ default(e) {
340
+ return new ne(this, e);
341
+ }
342
+ schema() {
343
+ return te(this);
344
+ }
345
+ }
346
+ class C extends T {
347
+ minLength;
348
+ maxLength;
349
+ pattern;
350
+ customValidations = [];
351
+ validate(e) {
352
+ if (typeof e != "string")
353
+ return { success: !1, errors: [{ message: "Expected string" }] };
354
+ const s = [];
355
+ this.minLength !== void 0 && e.length < this.minLength && s.push({ message: `Must be at least ${this.minLength} characters` }), this.maxLength !== void 0 && e.length > this.maxLength && s.push({ message: `Must be at most ${this.maxLength} characters` }), this.pattern && !this.pattern.test(e) && s.push({ message: "Invalid format" });
356
+ for (const t of this.customValidations) {
357
+ const n = t(e);
358
+ n && s.push({ message: n });
359
+ }
360
+ return s.length > 0 ? { success: !1, errors: s } : { success: !0, data: e };
361
+ }
362
+ min(e, s) {
363
+ const t = new C();
364
+ return t.minLength = e, t.maxLength = this.maxLength, t.pattern = this.pattern, t.customValidations = [...this.customValidations], s && t.customValidations.push(
365
+ (n) => n.length < e ? s : null
366
+ ), t;
367
+ }
368
+ max(e, s) {
369
+ const t = new C();
370
+ return t.minLength = this.minLength, t.maxLength = e, t.pattern = this.pattern, t.customValidations = [...this.customValidations], s && t.customValidations.push(
371
+ (n) => n.length > e ? s : null
372
+ ), t;
373
+ }
374
+ regex(e, s) {
375
+ const t = new C();
376
+ return t.minLength = this.minLength, t.maxLength = this.maxLength, t.pattern = e, t.customValidations = [...this.customValidations], s && t.customValidations.push(
377
+ (n) => e.test(n) ? null : s
378
+ ), t;
379
+ }
380
+ email(e = "Please enter a valid email address") {
381
+ const s = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, t = new C();
382
+ return t.minLength = this.minLength, t.maxLength = this.maxLength, t.pattern = this.pattern, t.customValidations = [
383
+ ...this.customValidations,
384
+ (n) => s.test(n) ? null : e
385
+ ], t;
386
+ }
387
+ refine(e) {
388
+ const s = new C();
389
+ return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations, e], s;
390
+ }
391
+ }
392
+ class V extends T {
393
+ mustBeTrue = !1;
394
+ trueMessage;
395
+ validate(e) {
396
+ return typeof e != "boolean" ? { success: !1, errors: [{ message: "Expected boolean" }] } : this.mustBeTrue && e !== !0 ? {
397
+ success: !1,
398
+ errors: [{ message: this.trueMessage || "Must be true" }]
399
+ } : { success: !0, data: e };
400
+ }
401
+ refine(e, s) {
402
+ const t = new V();
403
+ t.mustBeTrue = this.mustBeTrue, t.trueMessage = this.trueMessage;
404
+ const n = t.validate.bind(t);
405
+ return t.validate = (r) => {
406
+ const l = n(r);
407
+ return l.success ? e(l.data) ? l : { success: !1, errors: [{ message: s }] } : l;
408
+ }, t;
409
+ }
410
+ literal(e, s) {
411
+ const t = new V();
412
+ return t.mustBeTrue = !0, t.trueMessage = s, t;
413
+ }
414
+ }
415
+ class se extends T {
416
+ constructor(e) {
417
+ super(), this.inner = e;
418
+ }
419
+ validate(e) {
420
+ if (e === void 0)
421
+ return { success: !0, data: void 0 };
422
+ const s = this.inner.validate(e);
423
+ return s.success ? { success: !0, data: s.data } : { success: !1, errors: s.errors };
424
+ }
425
+ }
426
+ class ne extends T {
427
+ constructor(e, s) {
428
+ super(), this.inner = e, this.defaultValue = s;
429
+ }
430
+ validate(e) {
431
+ return e === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(e);
432
+ }
433
+ }
434
+ class I extends T {
435
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
436
+ constructor(e) {
437
+ super(), this.shape = e;
438
+ }
439
+ validate(e) {
440
+ if (typeof e != "object" || e === null || Array.isArray(e))
441
+ return { success: !1, errors: [{ message: "Expected object" }] };
442
+ const s = e, t = {}, n = [];
443
+ for (const [r, l] of Object.entries(this.shape)) {
444
+ const u = l.validate(s[r]);
445
+ if (u.success)
446
+ t[r] = u.data;
447
+ else
448
+ for (const g of u.errors)
449
+ n.push({
450
+ message: g.message,
451
+ path: [r, ...g.path || []]
452
+ });
453
+ }
454
+ return n.length > 0 ? { success: !1, errors: n } : { success: !0, data: t };
455
+ }
456
+ refine(e, s) {
457
+ const t = new I(this.shape), n = t.validate.bind(t);
458
+ return t.validate = (r) => {
459
+ const l = n(r);
460
+ if (!l.success) return l;
461
+ const u = e(l.data);
462
+ return u ? {
463
+ success: !1,
464
+ errors: [
465
+ {
466
+ message: u,
467
+ path: s?.path
468
+ }
469
+ ]
470
+ } : { success: !0, data: l.data };
471
+ }, t;
472
+ }
473
+ }
474
+ const fe = () => new C(), he = () => new V(), pe = (c) => new I(c);
475
475
  export {
476
476
  V as B,
477
- pe as C,
477
+ me as C,
478
478
  $ as F,
479
- ne as M,
480
- se as O,
479
+ ee as M,
480
+ Z as O,
481
481
  C as S,
482
482
  I as a,
483
- fe as b,
484
- Z as c,
485
- he as o,
486
- me as s,
483
+ he as b,
484
+ te as c,
485
+ pe as o,
486
+ fe as s,
487
487
  de as u
488
488
  };
@@ -0,0 +1 @@
1
+ "use strict";const n=require("@tempots/dom"),M=require("./use-animated-toggle-cKcuItmz.cjs"),S=require("@tempots/std"),D=require("./session-id-B5lJMzbB.cjs"),q=require("./translations-EwEmHe3v.cjs"),j=require("./use-form-Dcra7GeE.cjs"),B=require("./input-container-CyOgiiQD.cjs"),W=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function _(u){return Array.from(u.querySelectorAll(W)).filter(e=>{const s=e;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(u={}){const{active:e=!0,escapeDeactivates:s=!0,onEscape:t,initialFocus:a,returnFocus:i,clickOutsideDeactivates:c=!1,onClickOutside:d}=u;return n.WithElement(g=>{let h=e,f=null,l=[],b=null,p=null,m=null;typeof document<"u"&&(f=document.activeElement);const y=()=>{l=_(g)},C=r=>{if(h){if(s&&r.key==="Escape"){r.preventDefault(),t?.();return}if(r.key==="Tab"){if(y(),l.length===0){r.preventDefault();return}const o=l.indexOf(document.activeElement);r.shiftKey?o<=0&&(r.preventDefault(),l[l.length-1]?.focus()):o>=l.length-1&&(r.preventDefault(),l[0]?.focus())}}},v=r=>{if(!h||!c)return;const o=r.target;g.contains(o)||d?.()},x=()=>{if(!h)return;y();let r=null;typeof a=="function"?r=a():a?r=a:l.length>0&&(r=l[0]),r&&(p=setTimeout(()=>{p=null,r?.focus()},50)),document.addEventListener("keydown",C,!0),c&&document.addEventListener("click",v,!0)},w=()=>{h=!1,document.removeEventListener("keydown",C,!0),document.removeEventListener("click",v,!0);let r=null;typeof i=="function"?r=i():i?r=i:f&&(r=f),r&&document.body.contains(r)&&(m=setTimeout(()=>{m=null,r?.focus()},0))};return b=setTimeout(()=>{b=null,x()},0),n.OnDispose(()=>{b!=null&&clearTimeout(b),p!=null&&clearTimeout(p),m!=null&&clearTimeout(m),w()})})}function P(u={}){return{activate:()=>V({...u,active:!0}),deactivate:()=>V({...u,active:!1})}}function I(u){return n.WithBrowserCtx(e=>{const s=[],t=()=>s.forEach(i=>i());return u(({effect:i="opaque",mode:c="capturing",onClickOutside:d,onEscape:g,content:h,container:f="body"})=>{f==="body"&&(e=e.makePortal("body"));const l=M.useAnimatedElementToggle();l.listenOnClosed(t);let b=()=>{},p=()=>{};const m=r=>{r.key==="Escape"&&(g?.(),l.close())},y=()=>{d?.(),l.close()},C=r=>{b(),p(),r==="capturing"?(document.addEventListener("keydown",m),b=()=>document.removeEventListener("keydown",m),e.element.addEventListener("mousedown",y),p=()=>e.element.removeEventListener("mousedown",y)):(b=()=>{},p=()=>{})},v=n.Value.on(c,C);s.push(v),s.push(()=>{l.dispose(),b(),p()});const x=()=>{const r=new Set;for(const o of e.element.querySelectorAll(":scope > :not([data-overlay])"))o.hasAttribute("inert")?r.add(o):o.setAttribute("inert","");return s.push(()=>{for(const o of e.element.querySelectorAll(":scope > :not([data-overlay])"))r.has(o)||o.removeAttribute("inert");r.clear()}),document.activeElement?.blur?.(),n.html.div(n.WithElement(o=>l.setElement(o)),n.dataAttr("status",l.status.map(String)),n.dataAttr("overlay","true"),n.attr.class(n.computedOf(i??"opaque",c)((o,L)=>`bc-overlay bc-overlay--container-${f} bc-overlay--effect-${o} bc-overlay--mode-${L}`)),h)},w=n.render(x(),e.element,{disposeWithParent:!0,clear:!1,providers:e.providers});s.push(w),S.delayedAnimationFrame(()=>l.open())},t)})}function O(u,e){const{size:s="md",dismissable:t=!0,showCloseButton:a=!0,onClose:i,overlayEffect:c="opaque",container:d="body",position:g="center"}=u;return I((h,f)=>{let l=()=>{};return e(m=>{l=f;const y=n.prop("capturing");n.Value.on(t,o=>{y.set(o?"capturing":"non-capturing")});const C=n.computedOf(m.header!=null,a)((o,L)=>o||L),v=D.sessionId("modal"),x=`${v}-header`,w=`${v}-body`,r=n.html.div(n.attr.class(n.computedOf(s,g)((o,L)=>`bc-modal bc-modal--size-${o} bc-modal--container-${d} bc-modal--position-${L}`)),n.attr.role("dialog"),n.aria.modal(!0),...m.header?[n.aria.labelledby(x)]:[],n.aria.describedby(w),n.attr.tabindex(-1),n.attr.id(v),n.dataAttr("focus-trap","true"),n.on.mousedown(o=>o.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const o=document.getElementById(v);if(!o)return null;const L=o.querySelector('[aria-label="Close modal"]');if(L)return L;const A=o.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return A||o}}),n.html.div(n.attr.class("bc-modal__content"),n.When(C,()=>n.html.div(n.attr.class("bc-modal__header"),n.html.div(n.attr.class("bc-modal__title"),...m.header?[n.attr.id(x)]:[],m.header),n.When(a,()=>n.Use(q.BeatUII18n,o=>j.CloseButton({size:"sm",label:o.$.closeModal,onClick:()=>{l(),f()}}))))),n.html.div(n.attr.class("bc-modal__body"),n.attr.id(w),m.body),m.footer&&n.html.div(n.attr.class("bc-modal__footer"),m.footer)));h({mode:y,effect:c??"opaque",container:d,content:r,onClickOutside:()=>{i?.(),f()},onEscape:()=>{i?.(),f()}})},()=>{l(),f()})})}function U(u,e){const{confirmText:s,cancelText:t,onConfirm:a,onCancel:i,...c}=u;return n.Use(q.BeatUII18n,d=>O({showCloseButton:!1,...c},(g,h)=>{const f=()=>{a?.(),h()},l=()=>{i?.(),h()};return e(p=>{g({body:p,footer:n.Fragment(n.attr.class("bc-modal__actions"),B.Button({variant:"outline",onClick:l},n.coalesce(t,d.$.cancel)),B.Button({color:"primary",variant:"filled",onClick:f},n.coalesce(s,d.$.confirm)))})},h)}))}function $(u){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const t=u.validate(s);return t.success?{value:t.data}:{issues:t.errors.map(a=>({message:a.message,path:a.path}))}},types:void 0},safeParse:s=>{const t=u.validate(s);return t.success?{success:!0,data:t.data}:{success:!1,error:{errors:t.errors.map(a=>({message:a.message,path:a.path?.map(i=>typeof i=="object"&&"key"in i?i.key.toString():i.toString())||[]}))}}}}}class k{optional(){return new z(this)}default(e){return new R(this,e)}schema(){return $(this)}}class E extends k{minLength;maxLength;pattern;customValidations=[];validate(e){if(typeof e!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&e.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&e.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(e)&&s.push({message:"Invalid format"});for(const t of this.customValidations){const a=t(e);a&&s.push({message:a})}return s.length>0?{success:!1,errors:s}:{success:!0,data:e}}min(e,s){const t=new E;return t.minLength=e,t.maxLength=this.maxLength,t.pattern=this.pattern,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>a.length<e?s:null),t}max(e,s){const t=new E;return t.minLength=this.minLength,t.maxLength=e,t.pattern=this.pattern,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>a.length>e?s:null),t}regex(e,s){const t=new E;return t.minLength=this.minLength,t.maxLength=this.maxLength,t.pattern=e,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>e.test(a)?null:s),t}email(e="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,t=new E;return t.minLength=this.minLength,t.maxLength=this.maxLength,t.pattern=this.pattern,t.customValidations=[...this.customValidations,a=>s.test(a)?null:e],t}refine(e){const s=new E;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,e],s}}class T extends k{mustBeTrue=!1;trueMessage;validate(e){return typeof e!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&e!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:e}}refine(e,s){const t=new T;t.mustBeTrue=this.mustBeTrue,t.trueMessage=this.trueMessage;const a=t.validate.bind(t);return t.validate=i=>{const c=a(i);return c.success?e(c.data)?c:{success:!1,errors:[{message:s}]}:c},t}literal(e,s){const t=new T;return t.mustBeTrue=!0,t.trueMessage=s,t}}class z extends k{constructor(e){super(),this.inner=e}validate(e){if(e===void 0)return{success:!0,data:void 0};const s=this.inner.validate(e);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class R extends k{constructor(e,s){super(),this.inner=e,this.defaultValue=s}validate(e){return e===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(e)}}class F extends k{constructor(e){super(),this.shape=e}validate(e){if(typeof e!="object"||e===null||Array.isArray(e))return{success:!1,errors:[{message:"Expected object"}]};const s=e,t={},a=[];for(const[i,c]of Object.entries(this.shape)){const d=c.validate(s[i]);if(d.success)t[i]=d.data;else for(const g of d.errors)a.push({message:g.message,path:[i,...g.path||[]]})}return a.length>0?{success:!1,errors:a}:{success:!0,data:t}}refine(e,s){const t=new F(this.shape),a=t.validate.bind(t);return t.validate=i=>{const c=a(i);if(!c.success)return c;const d=e(c.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:c.data}},t}}const H=()=>new E,K=()=>new T,G=u=>new F(u);exports.BooleanValidator=T;exports.ConfirmModal=U;exports.FocusTrap=V;exports.Modal=O;exports.ObjectValidator=F;exports.Overlay=I;exports.StringValidator=E;exports.boolean=K;exports.createStandardSchema=$;exports.object=G;exports.string=H;exports.useFocusTrap=P;