@atproto/oauth-provider-ui 0.1.1 → 0.1.2

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.
@@ -4,10 +4,10 @@
4
4
  "mime": "text/css",
5
5
  "sha256": "iAJZXZO/QO20kLkdjTqtwoYVwSJJSxWEzFnPya2RNM8="
6
6
  },
7
- "authorization-page-Cms-rcBA.js": {
7
+ "authorization-page-Dhx8lvtZ.js": {
8
8
  "type": "chunk",
9
9
  "mime": "application/javascript",
10
- "sha256": "ngbQdihaREG1ilw81P7PqlsB0C4Zw/60TTP5WEQfdxE=",
10
+ "sha256": "D1C5urifFyjPjN1a1FKbze5r90eWaMa0v9V6LS+c/nA=",
11
11
  "dynamicImports": [
12
12
  "index-CHPoD7Rp.js"
13
13
  ],
@@ -432,190 +432,190 @@
432
432
  "isImplicitEntry": false,
433
433
  "name": "index"
434
434
  },
435
- "messages-oRd-J5--.js.map": {
435
+ "error-page-DC6Vc-cv.js.map": {
436
436
  "type": "asset",
437
437
  "mime": "application/json",
438
- "sha256": "pd0M39qXatViPLjowUnT+RY7H21S7IDinMPP3KmXdDo="
438
+ "sha256": "JbjkO2Pwrv5xmFSeg3hRKbi5WIeRlKeRVzbbDi9c/Yw="
439
439
  },
440
- "messages-mgE_5UEw.js.map": {
440
+ "messages-B0mgsxS-.js.map": {
441
441
  "type": "asset",
442
442
  "mime": "application/json",
443
- "sha256": "PycE//VgESc76NJ0xj4GV4fedu6O5XcbHii2ncXcYKs="
443
+ "sha256": "RytBi0D7AJeCl5VdnMYUMxkraDVh4rwo9OxOhN2VGxw="
444
444
  },
445
- "messages-B0mgsxS-.js.map": {
445
+ "messages-D2MnAxYY.js.map": {
446
446
  "type": "asset",
447
447
  "mime": "application/json",
448
- "sha256": "RytBi0D7AJeCl5VdnMYUMxkraDVh4rwo9OxOhN2VGxw="
448
+ "sha256": "OCRON7t+L6Q14dz5WuZjWB9kTzFeIcPVM3duq0F1R5w="
449
449
  },
450
- "messages-BjxAnLDp.js.map": {
450
+ "messages-LnzLtU0L.js.map": {
451
451
  "type": "asset",
452
452
  "mime": "application/json",
453
- "sha256": "e3wDKr55Bz+H6VvyVDVAkwVELdNuWyIJKD5lyab7T+E="
453
+ "sha256": "DkqKz0YTd67SuuLu+ps5VSfvNoqihmKs2RyuDAHAldI="
454
454
  },
455
- "messages-ipc0L8yF.js.map": {
455
+ "messages-B5g8Fkio.js.map": {
456
456
  "type": "asset",
457
457
  "mime": "application/json",
458
- "sha256": "VnAlNsvtBZpiua7t6pmMEn1UYAW5ELOsldaIIsWbKbM="
458
+ "sha256": "I3GgNjnf2Ll/q0VU02MDxfh4RoPSixLQZZztbPn2o2w="
459
459
  },
460
- "messages-CAvN5UoW.js.map": {
460
+ "messages-CRmpdijj.js.map": {
461
461
  "type": "asset",
462
462
  "mime": "application/json",
463
- "sha256": "IcUOqz23T/7bCem8dWh2buvLxlvwhK8eoUrK4B6PuAU="
463
+ "sha256": "jh+Z64ZyjrtwwCtzjL12EA3xPrvgeeWKL6844goB/hU="
464
464
  },
465
- "messages-DEK3zybC.js.map": {
465
+ "messages-ipc0L8yF.js.map": {
466
466
  "type": "asset",
467
467
  "mime": "application/json",
468
- "sha256": "j/d6zYUe5Sjn+Pjw/80pvKYXcKDZGfoQExy/cm2fzAY="
468
+ "sha256": "VnAlNsvtBZpiua7t6pmMEn1UYAW5ELOsldaIIsWbKbM="
469
469
  },
470
- "messages-CqiEX6JJ.js.map": {
470
+ "messages-Bz6JOhJf.js.map": {
471
471
  "type": "asset",
472
472
  "mime": "application/json",
473
- "sha256": "4MTAVufdznALfrQdFg58MpAmkM2JFjEQFMFvJFFpW9Y="
473
+ "sha256": "g6yClriKVtF353HVhAuxbkjytzLZeEqdMFlBcaD8V7I="
474
474
  },
475
- "messages-LnzLtU0L.js.map": {
475
+ "messages-CHYqz0q6.js.map": {
476
476
  "type": "asset",
477
477
  "mime": "application/json",
478
- "sha256": "DkqKz0YTd67SuuLu+ps5VSfvNoqihmKs2RyuDAHAldI="
478
+ "sha256": "oDGXcnBG46re2rVQKuj8kZFRy8nE3ZJzB1L7lTjadlU="
479
479
  },
480
- "messages-Bjysz3rI.js.map": {
480
+ "messages-CqiEX6JJ.js.map": {
481
481
  "type": "asset",
482
482
  "mime": "application/json",
483
- "sha256": "qwQ+ZgtSnIVJZDhkTw3tUj7iXxOVdxBmekmaXTcMSd4="
483
+ "sha256": "4MTAVufdznALfrQdFg58MpAmkM2JFjEQFMFvJFFpW9Y="
484
484
  },
485
- "messages-D0-cWoJ9.js.map": {
485
+ "messages-D5TZVsui.js.map": {
486
486
  "type": "asset",
487
487
  "mime": "application/json",
488
- "sha256": "2yacye3+5dsrEycWaFEbYYMqgXoEZCkwpTbYRyLbH40="
488
+ "sha256": "IVXSvV6GkwR2DnIb2QfvrrDGGaGGU+hkXx1qnxOzgs4="
489
489
  },
490
- "messages-BGUrKgyK.js.map": {
490
+ "messages-DEK3zybC.js.map": {
491
491
  "type": "asset",
492
492
  "mime": "application/json",
493
- "sha256": "IJjvKNF86BLkFa06Gl/YJcxG/d/4hzEEwVvEPwT5SvQ="
493
+ "sha256": "j/d6zYUe5Sjn+Pjw/80pvKYXcKDZGfoQExy/cm2fzAY="
494
494
  },
495
- "error-page-DC6Vc-cv.js.map": {
495
+ "messages-BCMss-Kt.js.map": {
496
496
  "type": "asset",
497
497
  "mime": "application/json",
498
- "sha256": "JbjkO2Pwrv5xmFSeg3hRKbi5WIeRlKeRVzbbDi9c/Yw="
498
+ "sha256": "qtN7/5wdKW6lWYYrovgWur1t0x06Qi4PqorQeNQsqic="
499
499
  },
500
- "messages-DGSM5jkd.js.map": {
500
+ "messages-ChkJ_0WT.js.map": {
501
501
  "type": "asset",
502
502
  "mime": "application/json",
503
- "sha256": "ZB6hfH9wwtbkGZQkATUbwp6PA/Wdc+rwhEJckFRyMVo="
503
+ "sha256": "h1cJXN1vBnAf94CHYMfRv2lsNwTrafL/h9BGG2sryhA="
504
504
  },
505
- "messages-DT6xRw0m.js.map": {
505
+ "messages-eHH6nZyF.js.map": {
506
506
  "type": "asset",
507
507
  "mime": "application/json",
508
- "sha256": "jSjSOGY46GFvD5Zye3F3UNJMch78Vk6/32vMbt+GRFY="
508
+ "sha256": "UO9UGvrLJVfS85qWMPYCOuJc+gerL0McnoKmfbvjoUc="
509
509
  },
510
- "messages-DRp7qc3j.js.map": {
510
+ "messages-DT6xRw0m.js.map": {
511
511
  "type": "asset",
512
512
  "mime": "application/json",
513
- "sha256": "sgorgzMU/KNLuWeOXq8LiiILcronIwNTrf0QrdF0SS8="
513
+ "sha256": "jSjSOGY46GFvD5Zye3F3UNJMch78Vk6/32vMbt+GRFY="
514
514
  },
515
- "messages-DJgAnSTQ.js.map": {
515
+ "messages-BvvEr3UX.js.map": {
516
516
  "type": "asset",
517
517
  "mime": "application/json",
518
- "sha256": "GpB/nmrWY0utKUr/+7gDH+HNrd6euAh7IwodrgSfcvY="
518
+ "sha256": "qESIx/NUeXdO3iPGQMQvk8lCS4tr2kFDgP4Ddw0K7CE="
519
519
  },
520
- "messages-Cdb79R6S.js.map": {
520
+ "messages-Bjysz3rI.js.map": {
521
521
  "type": "asset",
522
522
  "mime": "application/json",
523
- "sha256": "UsGqFeI9ZBdeIqYtK9TgNBKqCPlwTwXt8Gd2rKe0a4s="
523
+ "sha256": "qwQ+ZgtSnIVJZDhkTw3tUj7iXxOVdxBmekmaXTcMSd4="
524
524
  },
525
- "messages-DBdV4-iw.js.map": {
525
+ "messages-CEmswT1Q.js.map": {
526
526
  "type": "asset",
527
527
  "mime": "application/json",
528
- "sha256": "bIPDIl6+vPloy1TZpbld+Ukc7URHf7gfRAOgOI2Exr8="
528
+ "sha256": "Cfzpwbgp1M38qdweZIyq1JehWADd2PJuw4ksgkPBWyQ="
529
529
  },
530
- "messages-BvvEr3UX.js.map": {
530
+ "messages-mgE_5UEw.js.map": {
531
531
  "type": "asset",
532
532
  "mime": "application/json",
533
- "sha256": "qESIx/NUeXdO3iPGQMQvk8lCS4tr2kFDgP4Ddw0K7CE="
533
+ "sha256": "PycE//VgESc76NJ0xj4GV4fedu6O5XcbHii2ncXcYKs="
534
534
  },
535
- "messages-_Nk2qNGw.js.map": {
535
+ "messages-CxkHjJSR.js.map": {
536
536
  "type": "asset",
537
537
  "mime": "application/json",
538
- "sha256": "Sz7mpE5YBtER8VGqedTUQXWix9gYM2uh/9AM3phBi/U="
538
+ "sha256": "cczon+hEDe0+M4B30siByHyS6gE3oeXbPLHedzV0QZA="
539
539
  },
540
- "messages-CRmpdijj.js.map": {
540
+ "messages-BjxAnLDp.js.map": {
541
541
  "type": "asset",
542
542
  "mime": "application/json",
543
- "sha256": "jh+Z64ZyjrtwwCtzjL12EA3xPrvgeeWKL6844goB/hU="
543
+ "sha256": "e3wDKr55Bz+H6VvyVDVAkwVELdNuWyIJKD5lyab7T+E="
544
544
  },
545
- "messages-eHH6nZyF.js.map": {
545
+ "messages-_Nk2qNGw.js.map": {
546
546
  "type": "asset",
547
547
  "mime": "application/json",
548
- "sha256": "UO9UGvrLJVfS85qWMPYCOuJc+gerL0McnoKmfbvjoUc="
548
+ "sha256": "Sz7mpE5YBtER8VGqedTUQXWix9gYM2uh/9AM3phBi/U="
549
549
  },
550
- "messages-B5g8Fkio.js.map": {
550
+ "messages-iNw8zY2C.js.map": {
551
551
  "type": "asset",
552
552
  "mime": "application/json",
553
- "sha256": "I3GgNjnf2Ll/q0VU02MDxfh4RoPSixLQZZztbPn2o2w="
553
+ "sha256": "fkcamS+BSWlXfjPC2wFchzn096rXLzi4p8f6kcejEFc="
554
554
  },
555
555
  "messages-j7LsWm2F.js.map": {
556
556
  "type": "asset",
557
557
  "mime": "application/json",
558
558
  "sha256": "TiUnPB5bg3OTUPmW/FpW8Vtju3KoW0SZ/RZZRzpEhII="
559
559
  },
560
- "messages-DK7O7sb_.js.map": {
560
+ "messages-CAvN5UoW.js.map": {
561
561
  "type": "asset",
562
562
  "mime": "application/json",
563
- "sha256": "bFpeUB0Lg7wxBXiWKCScj0XeY/6c/Q01OGQ7TEysl7w="
563
+ "sha256": "IcUOqz23T/7bCem8dWh2buvLxlvwhK8eoUrK4B6PuAU="
564
564
  },
565
- "messages-CxkHjJSR.js.map": {
565
+ "messages-DRp7qc3j.js.map": {
566
566
  "type": "asset",
567
567
  "mime": "application/json",
568
- "sha256": "cczon+hEDe0+M4B30siByHyS6gE3oeXbPLHedzV0QZA="
568
+ "sha256": "sgorgzMU/KNLuWeOXq8LiiILcronIwNTrf0QrdF0SS8="
569
569
  },
570
570
  "messages-BzL3D1EU.js.map": {
571
571
  "type": "asset",
572
572
  "mime": "application/json",
573
573
  "sha256": "FxHF7NJHwCWw8EmUKchrFvTr6S+334E+7e3wPXYvYs8="
574
574
  },
575
- "messages-CHYqz0q6.js.map": {
575
+ "messages-BGUrKgyK.js.map": {
576
576
  "type": "asset",
577
577
  "mime": "application/json",
578
- "sha256": "oDGXcnBG46re2rVQKuj8kZFRy8nE3ZJzB1L7lTjadlU="
578
+ "sha256": "IJjvKNF86BLkFa06Gl/YJcxG/d/4hzEEwVvEPwT5SvQ="
579
579
  },
580
- "messages-iNw8zY2C.js.map": {
580
+ "messages-DBdV4-iw.js.map": {
581
581
  "type": "asset",
582
582
  "mime": "application/json",
583
- "sha256": "fkcamS+BSWlXfjPC2wFchzn096rXLzi4p8f6kcejEFc="
583
+ "sha256": "bIPDIl6+vPloy1TZpbld+Ukc7URHf7gfRAOgOI2Exr8="
584
584
  },
585
- "messages-D5TZVsui.js.map": {
585
+ "messages-D0-cWoJ9.js.map": {
586
586
  "type": "asset",
587
587
  "mime": "application/json",
588
- "sha256": "IVXSvV6GkwR2DnIb2QfvrrDGGaGGU+hkXx1qnxOzgs4="
588
+ "sha256": "2yacye3+5dsrEycWaFEbYYMqgXoEZCkwpTbYRyLbH40="
589
589
  },
590
- "messages-ChkJ_0WT.js.map": {
590
+ "messages-Cdb79R6S.js.map": {
591
591
  "type": "asset",
592
592
  "mime": "application/json",
593
- "sha256": "h1cJXN1vBnAf94CHYMfRv2lsNwTrafL/h9BGG2sryhA="
593
+ "sha256": "UsGqFeI9ZBdeIqYtK9TgNBKqCPlwTwXt8Gd2rKe0a4s="
594
594
  },
595
- "messages-Bz6JOhJf.js.map": {
595
+ "authorization-page-Dhx8lvtZ.js.map": {
596
596
  "type": "asset",
597
597
  "mime": "application/json",
598
- "sha256": "g6yClriKVtF353HVhAuxbkjytzLZeEqdMFlBcaD8V7I="
598
+ "sha256": "/DNgbcUNOJbhZpvr8uwTJB72svyrgixPw1/GPwV85YI="
599
599
  },
600
- "messages-CEmswT1Q.js.map": {
600
+ "messages-DGSM5jkd.js.map": {
601
601
  "type": "asset",
602
602
  "mime": "application/json",
603
- "sha256": "Cfzpwbgp1M38qdweZIyq1JehWADd2PJuw4ksgkPBWyQ="
603
+ "sha256": "ZB6hfH9wwtbkGZQkATUbwp6PA/Wdc+rwhEJckFRyMVo="
604
604
  },
605
- "messages-D2MnAxYY.js.map": {
605
+ "messages-oRd-J5--.js.map": {
606
606
  "type": "asset",
607
607
  "mime": "application/json",
608
- "sha256": "OCRON7t+L6Q14dz5WuZjWB9kTzFeIcPVM3duq0F1R5w="
608
+ "sha256": "pd0M39qXatViPLjowUnT+RY7H21S7IDinMPP3KmXdDo="
609
609
  },
610
- "messages-BCMss-Kt.js.map": {
610
+ "messages-DJgAnSTQ.js.map": {
611
611
  "type": "asset",
612
612
  "mime": "application/json",
613
- "sha256": "qtN7/5wdKW6lWYYrovgWur1t0x06Qi4PqorQeNQsqic="
613
+ "sha256": "GpB/nmrWY0utKUr/+7gDH+HNrd6euAh7IwodrgSfcvY="
614
614
  },
615
- "authorization-page-Cms-rcBA.js.map": {
615
+ "messages-DK7O7sb_.js.map": {
616
616
  "type": "asset",
617
617
  "mime": "application/json",
618
- "sha256": "mF1cGZaARuhTNG/LZOmGmWOlrigjHZpMhZggrduIrbU="
618
+ "sha256": "bFpeUB0Lg7wxBXiWKCScj0XeY/6c/Q01OGQ7TEysl7w="
619
619
  },
620
620
  "index-CHPoD7Rp.js.map": {
621
621
  "type": "asset",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/oauth-provider-ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "MIT",
5
5
  "description": "Sign-in & Sign-up UI for the @atproto/oauth-provider",
6
6
  "homepage": "https://atproto.com",
@@ -26,7 +26,7 @@
26
26
  "hydration-data.d.ts"
27
27
  ],
28
28
  "optionalDependencies": {
29
- "@atproto/oauth-provider-api": "0.1.0"
29
+ "@atproto/oauth-provider-api": "0.1.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@hcaptcha/react-hcaptcha": "^1.11.2",
@@ -49,8 +49,8 @@
49
49
  "vite": "^6.2.0",
50
50
  "@atproto-labs/fetch": "0.2.2",
51
51
  "@atproto-labs/rollup-plugin-bundle-manifest": "0.2.0",
52
- "@atproto/oauth-types": "0.2.5",
53
- "@atproto/oauth-provider-api": "0.1.0"
52
+ "@atproto/oauth-provider-api": "0.1.1",
53
+ "@atproto/oauth-types": "0.2.6"
54
54
  },
55
55
  "scripts": {
56
56
  "i18n:extract": "lingui extract --clean",
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["index-CHPoD7Rp.js","error-view-MVy7C9l0.js","error-view-CRGNTAn2.css"])))=>i.map(i=>d[i]);
2
- import{r as l,j as e,c as I,L as Ce,A as Ee,u as R,U as Re,T as m,M as Le,a as ae,E as Ie,b as Pe,d as Ae,e as Te,f as pe,g as ie,h as le,S as $e,I as He,i as Ve,C as xe,k as fe,l as Fe,X as Ue,_ as Oe,m as Be,n as qe,o as Me,p as Xe}from"./error-view-MVy7C9l0.js";const ge=l.createContext(null),ce={didCatch:!1,error:null};class Ke extends l.Component{constructor(s){super(s),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=ce}static getDerivedStateFromError(s){return{didCatch:!0,error:s}}resetErrorBoundary(){const{error:s}=this.state;if(s!==null){for(var n,a,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];(n=(a=this.props).onReset)===null||n===void 0||n.call(a,{args:i,reason:"imperative-api"}),this.setState(ce)}}componentDidCatch(s,n){var a,r;(a=(r=this.props).onError)===null||a===void 0||a.call(r,s,n)}componentDidUpdate(s,n){const{didCatch:a}=this.state,{resetKeys:r}=this.props;if(a&&n.error!==null&&De(s.resetKeys,r)){var i,o;(i=(o=this.props).onReset)===null||i===void 0||i.call(o,{next:r,prev:s.resetKeys,reason:"keys"}),this.setState(ce)}}render(){const{children:s,fallbackRender:n,FallbackComponent:a,fallback:r}=this.props,{didCatch:i,error:o}=this.state;let d=s;if(i){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")d=n(c);else if(a)d=l.createElement(a,c);else if(r!==void 0)d=r;else throw o}return l.createElement(ge.Provider,{value:{didCatch:i,error:o,resetErrorBoundary:this.resetErrorBoundary}},d)}}function De(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==s.length||t.some((n,a)=>!Object.is(n,s[a]))}function Ge(t){if(t==null||typeof t.didCatch!="boolean"||typeof t.resetErrorBoundary!="function")throw new Error("ErrorBoundaryContext not found")}function Ze(){const t=l.useContext(ge);Ge(t);const[s,n]=l.useState({error:null,hasError:!1}),a=l.useMemo(()=>({resetBoundary:()=>{t.resetErrorBoundary(),n({error:null,hasError:!1})},showBoundary:r=>n({error:r,hasError:!0})}),[t.resetErrorBoundary]);if(s.hasError)throw s.error;return a}function T({children:t,title:s,subtitle:n,className:a,...r}){return e.jsxs("div",{...r,className:I(a,"flex flex-col items-center","md:flex md:flex-row md:items-center md:justify-stretch","min-w-screen min-h-screen","bg-white text-slate-900","dark:bg-slate-900 dark:text-slate-100"),children:[s&&e.jsx("title",{children:s}),e.jsxs("div",{className:I("px-6 pt-4","w-full","md:max-w-lg","flex flex-row items-start","md:flex-col md:items-end","md:self-stretch","md:max-w-fix md:w-1/2 md:p-4","md:text-right","md:dark:border-r md:dark:border-slate-700","md:bg-slate-100 md:dark:bg-slate-800"),children:[e.jsxs("div",{className:"grid grow content-center md:justify-items-end",children:[s&&e.jsx("h1",{className:"text-primary text-xl font-semibold md:my-4 md:text-2xl lg:text-5xl",children:s},"title"),n&&e.jsx("p",{className:"hidden max-w-xs text-slate-600 md:block dark:text-slate-400",children:n},"subtitle")]}),e.jsx(Ce,{className:"m-1 md:m-2"},"localeSelector")]}),e.jsx("main",{className:"w-full p-6 md:max-w-3xl md:px-12",children:t})]})}function ze(t,s,n){if(!t)return[s];const a=t.findIndex(n);return a===-1?[...t,s]:[...t.slice(0,a),s,...t.slice(a+1)]}function q(t,s){const{showBoundary:n}=Ze();return l.useCallback(async(...a)=>{try{return await t(...a)}catch(r){throw r instanceof Re&&n(r),r}},s.concat(n))}function We({sessions:t=[],onRedirected:s}){const[n]=l.useState(()=>new Ee),[a,r]=l.useState(t),{i18n:i,_:o}=R(),{locale:d}=i,c=l.useCallback(b=>{r(p=>{var y;return b===(((y=p.find(k=>k.selected))==null?void 0:y.account.sub)||null)?p:p.map(k=>({...k,selected:k.account.sub===b}))})},[r]),x=l.useCallback(({account:b,ephemeralToken:p,consentRequired:y=!0,selected:k=!0,loginRequired:N=!1})=>{const C={account:b,ephemeralToken:p,selected:k,loginRequired:N,consentRequired:y};r(P=>ze(P,C,L=>L.account.sub===b.sub).map(L=>!k||L===C||!L.selected?L:{...L,selected:!1}))},[r]),u=l.useCallback(b=>{window.location.href=String(b),s&&setTimeout(s)},[s]),j=q(async(b,p)=>{const y=await n.fetch("POST","/sign-in",{...b,locale:d},{signal:p});x(y)},[n,d,x]),f=q(async(b,p)=>{await n.fetch("POST","/reset-password-request",{...b,locale:d},{signal:p})},[n,d]),h=q(async(b,p)=>{await n.fetch("POST","/reset-password-confirm",b,{signal:p})},[n]),w=q(async(b,p)=>{await n.fetch("POST","/verify-handle-availability",b,{signal:p})},[n]),_=q(async(b,p)=>{const y=await n.fetch("POST","/sign-up",{...b,locale:d},{signal:p});x(y)},[n,d,x]),g=q(async b=>{var k;const p=(k=a.find(N=>N.account.sub===b))==null?void 0:k.ephemeralToken,{url:y}=await n.fetch("POST","/accept",{sub:b},{bearer:p});u(y)},[n,a,u]),v=q(async()=>{const{url:b}=await n.fetch("POST","/reject",{});u(b)},[n,u]);return{sessions:a,selectSub:c,doSignIn:j,doInitiatePasswordReset:f,doConfirmResetPassword:h,doValidateNewHandle:w,doSignUp:_,doAccept:g,doReject:v}}function D(t,s){return l.useCallback(()=>t(s),[t,s])}function A({color:t="grey",transparent:s=!1,loading:n=void 0,square:a=!1,children:r,className:i,type:o="button",role:d="Button",disabled:c=!1,...x}){return e.jsx("button",{role:d,type:o,disabled:c||n===!0,...x,className:I("cursor-pointer touch-manipulation overflow-hidden truncate rounded-md tracking-wide",a?"p-2":"px-6 py-2",t==="primary"?I("accent-slate-100",s?"text-primary bg-transparent":"bg-primary text-primary-contrast"):t==="grey"?I("accent-primary","text-slate-600 dark:text-slate-300","hover:bg-gray-200 dark:hover:bg-gray-700",s?"bg-transparent":"bg-gray-100 dark:bg-gray-800"):void 0,"disabled:opacity-50",i),children:r})}function ue({actions:t,cancel:s,append:n,children:a,prepend:r,disabled:i,inert:o=i,...d}){return e.jsxs("form",{...d,inert:o,className:"flex flex-col space-y-4",children:[r&&e.jsx("div",{children:r},"prepend"),e.jsx("div",{className:"space-y-4",children:a},"children"),n&&e.jsx("div",{children:n},"append"),(t||s)&&e.jsxs("div",{className:"flex flex-row-reverse flex-wrap items-center justify-end space-x-2 space-x-reverse",children:[t,e.jsx("div",{className:"flex-auto"}),s]},"buttons")]})}function Ye({account:t,...s}){return e.jsx("b",{...s,children:t.preferred_username||t.email||t.sub})}function Je({url:t,proto:s=!1,host:n=!0,path:a=!1,query:r=!1,hash:i=!1,as:o="span",...d}){const c=l.useMemo(()=>t instanceof URL?t:new URL(t),[t]);return e.jsxs(o,{...d,children:[s&&e.jsx(z,{value:`${c.protocol}//`,...s===!0?null:s}),n&&e.jsx(z,{value:c.host,...n===!0?{faded:!1,bold:!0}:n}),a&&e.jsx(z,{value:c.pathname,...a===!0?null:a}),r&&e.jsx(z,{value:c.search,...r===!0?null:r}),i&&e.jsx(z,{value:c.hash,...i===!0?null:i})]})}function z({value:t,faded:s=!0,bold:n=!1}){const a=n?"b":"span";return e.jsx(a,{className:s?"opacity-50":"",children:t})}function Qe({clientId:t,clientMetadata:s,clientTrusted:n,...a}){const r=l.useMemo(()=>{try{return new URL(t)}catch{return null}},[t]);if(n&&s.client_name)return e.jsx("span",{...a,children:s.client_name});if((r==null?void 0:r.protocol)==="http:")return e.jsx("span",{...a,children:e.jsx(m,{id:"eYNzrj"})});if((r==null?void 0:r.protocol)==="https:"){const i=r.protocol==="https:"&&r.pathname==="/oauth-client-metadata.json"&&!r.port&&!r.search;return e.jsx(Je,{...a,url:r,proto:!i,host:!0,path:!i,query:!i,hash:!1})}return e.jsx("span",{...a,children:t})}function et({clientId:t,clientMetadata:s,clientTrusted:n,account:a,scopeDetails:r,onAccept:i,onReject:o,onBack:d,...c}){const{i18n:x,_:u}=R();return e.jsxs(ue,{...c,onSubmit:j=>{j.preventDefault(),i()},cancel:d&&e.jsx(A,{onClick:d,children:"Back"}),actions:e.jsxs(e.Fragment,{children:[e.jsx(A,{type:"submit",color:"primary",children:e.jsx(m,{id:"yIVrHZ"})}),e.jsx(A,{onClick:o,children:e.jsx(m,{id:"54JiGG"})})]}),children:[n&&s.logo_uri&&e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("img",{crossOrigin:"anonymous",src:s.logo_uri,alt:s.client_name,className:"h-16 w-16 rounded-full"})},"logo"),e.jsx("p",{children:e.jsx(m,{id:"BVbdlE",components:{0:e.jsx(Qe,{clientId:t,clientMetadata:s,clientTrusted:n}),1:e.jsx(Ye,{account:a})}})}),e.jsx("p",{children:e.jsx(m,{id:"/aj5l4",components:{0:e.jsx("b",{}),1:e.jsx("a",{role:"link",href:s.tos_uri,rel:"nofollow noopener",target:"_blank",className:"text-primary underline"}),2:e.jsx("a",{role:"link",href:s.policy_uri,rel:"nofollow noopener",target:"_blank",className:"text-primary underline"})}})}),r!=null&&r.length?e.jsx("ul",{className:"list-inside list-disc","aria-label":x._({id:"c7cY3z"}),children:r.map(({scope:j,description:f})=>e.jsx("li",{children:f?e.jsx(Le,{value:f}):e.jsx(tt,{scope:j})},j))},"scopes"):null]})}function tt({scope:t}){switch(t){case"atproto":return e.jsx(m,{id:"BWM1dL"});case"transition:generic":return e.jsx(m,{id:"myiH7A"});case"transition:chat.bsky":return e.jsx(m,{id:"kJrqQq"});default:return t}}function st({clientId:t,clientMetadata:s,clientTrusted:n,account:a,scopeDetails:r,onAccept:i,onReject:o,onBack:d,title:c,subtitle:x=e.jsx(m,{id:"QdVx1C",values:{0:a.preferred_username||a.email||a.sub},components:{0:e.jsx("b",{className:"text-slate-800 dark:text-slate-200"})}}),...u}){const{i18n:j,_:f}=R();return e.jsx(T,{...u,title:c??j._({id:"yIVrHZ"}),subtitle:x,children:e.jsx(et,{clientId:t,clientMetadata:s,clientTrusted:n,account:a,scopeDetails:r,onBack:d,onAccept:i,onReject:o})})}const oe=l.createContext({disabled:!1});oe.displayName="FieldsetContext";function U({label:t,children:s,disabled:n,...a}){const r=ae({prefix:"fieldset-"}),i=l.useMemo(()=>({disabled:n??!1,labelId:t?r:void 0}),[n,t,r]);return e.jsxs("fieldset",{...a,"aria-labelledby":r,disabled:n,children:[t&&e.jsx("legend",{id:r,className:"mb-1 text-sm font-medium text-slate-600 dark:text-slate-400",children:t},"title"),e.jsx("div",{className:"flex flex-col space-y-4",children:e.jsx(oe,{value:i,children:s})})]})}function nt(t,{ref:s,onLoading:n,onError:a}={}){const[r,i]=l.useState(!1),[o,d]=l.useState(),c=l.useCallback(h=>{d(h),a==null||a(h)},[a]),x=l.useCallback(h=>{i(h),n==null||n(h)},[n]),u=l.useRef(null),j=l.useRef(null);l.useEffect(()=>(j.current=()=>{var h;(h=u.current)==null||h.abort(),u.current=null,c(void 0),x(!1)},()=>{j.current=null}),[c,x]),l.useImperativeHandle(s,()=>({reset:()=>{var h;return(h=j.current)==null?void 0:h.call(j)}}),[]),l.useEffect(()=>()=>{var h;(h=u.current)==null||h.abort(),u.current=null},[]);const f=l.useCallback(async()=>{var _;(_=u.current)==null||_.abort(),x(!0),c(void 0);const h=new AbortController,{signal:w}=h;u.current=h;try{await t(w)}catch(g){h===u.current?c(g instanceof Error?g:new Error(String(g))):rt(w,g)||console.warn("Async action error after abort",g)}finally{h===u.current&&(u.current=null,x(!1)),h.abort()}},[t,x,c]);return{loading:r,error:o,run:f}}function rt(t,s){return t.aborted&&(t.reason===s||t.reason===(s==null?void 0:s.cause)||s instanceof DOMException&&s.name==="AbortError")}const at=({error:t})=>e.jsx(Ie,{error:t});function G({invalid:t,disabled:s,onSubmit:n,submitLabel:a,onCancel:r=void 0,cancelLabel:i,errorRender:o=at,ref:d,onLoading:c,onError:x,children:u,...j}){const{run:f,loading:h,error:w}=nt(n,{ref:d,onError:x,onLoading:c}),_=l.useCallback(g=>{g.preventDefault(),g.currentTarget.reportValidity()&&!s&&!t&&f()},[s,t,f]);return e.jsx(ue,{...j,onSubmit:_,disabled:s||h,prepend:w!=null?o({error:w}):void 0,cancel:r&&e.jsx(A,{onClick:r,children:i||e.jsx(m,{id:"dEgA5A"})}),actions:e.jsx(A,{color:"primary",type:"submit",loading:h,disabled:s,children:a||e.jsx(m,{id:"hQRttt"})}),children:u})}const V=8,it=/(\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/,J=/[A-Z]/,Q=/[a-z]/,ee=/[0-9]/,te=/[^a-zA-Z0-9]/;var K=function(t){return t[t.weak=1]="weak",t[t.moderate=2]="moderate",t[t.strong=3]="strong",t[t.extra=4]="extra",t}({});function ye(t){return t.length<V?1:t.length>=V+12?4:t.length>=V+8?H(t,[te])||H(t,[J,Q,ee],2)?4:3:t.length>=V&&H(t,[it])?3:t.length>=V+6?H(t,[te])||H(t,[J,Q,ee],2)?3:2:t.length>=V+4?H(t,[te])||H(t,[J,Q,ee],2)?2:1:t.length>=V&&(H(t,[te])||H(t,[J,Q,ee]))?2:1}function H(t,s,n=s.length){if(n<1||n>s.length)throw new TypeError("Invalid regexpsCountToMatch");for(const a of s)if(a.test(t)&&(n--,n===0))return!0;return!1}function lt({password:t,...s}){const{i18n:n,_:a}=R(),r=ye(t);return e.jsx("span",{...s,"aria-label":n._({id:"osAB4a"}),children:r===K.extra?e.jsx(m,{id:"/Ltc/k"}):r===K.strong?e.jsx(m,{id:"LLx/nr"}):r===K.moderate?e.jsx(m,{id:"dvYuhh"}):t?e.jsx(m,{id:"9ls/Vs"}):e.jsx(m,{id:"VU3Nrn"})})}function ot({password:t,className:s,...n}){const{i18n:a,_:r}=R(),i=t?ye(t):0,o="bg-gray-300 dark:bg-slate-500",d=i===K.extra||i===K.strong?"bg-success":i===K.moderate?"bg-warning":"bg-error";return e.jsx("div",{...n,className:I("flex h-1 w-full space-x-2",s),role:"meter","aria-label":a._({id:"xfNKwI"}),"aria-valuemin":0,"aria-valuemax":K.extra,"aria-valuenow":i,children:Array.from({length:4},(c,x)=>e.jsx("div",{className:`h-1 w-1/4 rounded-sm ${i>x?d:o}`},x))})}function ct(t,s){typeof t=="function"?t(s):t&&(t.current=s)}function B(t){return s=>{for(const n of t)n&&ct(n,s)}}function dt({visible:t,toggleVisible:s,onClick:n,...a}){const{i18n:r,_:i}=R();return e.jsx(A,{...a,square:!0,onClick:o=>{n==null||n(o),o.defaultPrevented||s()},"aria-label":t?r._({id:"vLyv1R"}):r._({id:"huXYDE"}),children:t?e.jsx(Pe,{className:"w-5","aria-hidden":!0}):e.jsx(Ae,{className:"w-5","aria-hidden":!0})})}function ne({icon:t,append:s,bellow:n,className:a,children:r,onFocus:i,onBlur:o,...d}){const[c,x]=l.useState(!1);return e.jsxs("div",{...d,onFocus:u=>{i==null||i(u),u.defaultPrevented||x(!0)},onBlur:u=>{o==null||o(u),u.defaultPrevented||x(!1)},className:I("min-h-12","max-w-full","overflow-hidden","rounded-lg",a),children:[e.jsxs("div",{className:I("px-1","min-h-12 w-full","flex items-center justify-stretch","rounded-lg",n?"rounded-bl-none rounded-br-none":void 0,"outline-hidden","border-2 border-solid border-transparent","focus:border-primary has-focus:border-primary","hover:border-gray-400 hover:focus:border-gray-400","dark:hover:border-gray-500 dark:hover:focus:border-gray-500","has-focus:bg-slate-200 bg-gray-100 focus:bg-slate-200","dark:has-focus:bg-slate-700 dark:bg-slate-800 dark:focus:bg-slate-700","text-slate-600 dark:text-slate-300","accent-primary"),children:[t&&e.jsx("div",{className:I("shrink-0 grow-0","mx-1",c?"text-primary":"text-slate-500"),children:t}),r,e.jsx("div",{className:"ml-1 flex shrink-0 grow-0 items-center",children:s})]}),n&&e.jsx("div",{className:I("space-x-2 px-3 py-2","flex flex-row items-center gap-1","rounded-br-2 rounded-bl-2","bg-gray-200 dark:bg-slate-700","text-gray-700 dark:text-gray-300","text-sm italic"),children:n})]})}function Z({icon:t,append:s,bellow:n,className:a,onFocus:r,onBlur:i,ref:o,disabled:d,title:c,"aria-label":x=c,"aria-labelledby":u,placeholder:j=x,...f}){const h=l.useContext(oe),w=l.useRef(null),_=l.useRef(!1);return e.jsx(ne,{icon:t,append:s,bellow:n,className:I("cursor-text",a),tabIndex:-1,onClick:g=>{var v;w.current!==g.target&&(g.preventDefault(),g.stopPropagation(),(v=w.current)==null||v.focus())},onMouseDown:g=>{_.current&&g.target!==w.current&&(g.preventDefault(),g.stopPropagation())},children:e.jsx("input",{...f,disabled:d??h.disabled,title:c,placeholder:j,"aria-label":x,"aria-labelledby":u??h.labelId,ref:B([o,w]),className:"outline-hidden w-full text-ellipsis bg-transparent bg-clip-padding text-base text-inherit dark:placeholder-gray-500",onFocus:g=>{r==null||r(g),g.defaultPrevented||(_.current=!0)},onBlur:g=>{i==null||i(g),g.defaultPrevented||(_.current=!1)}})})}function _e({autoHide:t=!0,onBlur:s,onChange:n,append:a,autoComplete:r="current-password",icon:i=e.jsx(Te,{className:"w-5"}),value:o,defaultValue:d=o,ref:c,title:x,dir:u="auto",autoCapitalize:j="none",autoCorrect:f="off",spellCheck:h="false",...w}){const{i18n:_,_:g}=R(),v=l.useRef(null),[b,p]=l.useState(!1),[y,k]=l.useState(typeof d=="string"?d:""),N=l.useCallback(C=>{n==null||n(C),k(C.target.value)},[n]);return e.jsx(Z,{...w,title:x??_._({id:"8ZsakT"}),ref:B([c,v]),dir:u,autoCapitalize:j,autoCorrect:f,spellCheck:h,icon:i,onBlur:t?C=>{s==null||s(C),C.defaultPrevented||p(!1)}:s,value:y,onChange:N,type:b?"text":"password",autoComplete:r,append:e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"m-1",visible:b,toggleVisible:()=>{var C;p(P=>!P),(C=v.current)==null||C.focus()}}),a]})})}function we({password:t="",onPassword:s,onChange:n,autoComplete:a="new-password",minLength:r=V,...i}){const{i18n:o,_:d}=R(),[c,x]=l.useState(t),u=l.useCallback(j=>{const{value:f}=j.target;n==null||n(j),!j.defaultPrevented&&(x(f),s==null||s(j.target.validity.valid?f:void 0))},[n,s]);return e.jsx(_e,{...i,placeholder:o._({id:"3tOlz6"}),"aria-label":o._({id:"0StR7t"}),title:o._({id:"5CqSPX",values:{MIN_PASSWORD_LENGTH:V}}),minLength:r,onChange:u,value:c,autoComplete:a,bellow:e.jsxs(e.Fragment,{children:[e.jsx(ot,{password:c}),e.jsx(lt,{className:"grow-1 min-w-max text-xs text-gray-500 dark:text-gray-400",password:c})]})})}const ut="XXXXX-XXXXX";function ve({example:t=ut,onToken:s,icon:n=e.jsx(pe,{className:"w-5"}),title:a=t,onChange:r,value:i,defaultValue:o=i,...d}){const{i18n:c,_:x}=R(),[u,j]=l.useState(typeof o=="string"?o:"");return e.jsx(Z,{...d,type:"text",autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:"false",minLength:11,maxLength:11,dir:"auto",icon:n,pattern:"^[A-Z2-7]{5}-[A-Z2-7]{5}$",placeholder:c._({id:"0hTJM+",values:{example:t}}),title:a,value:u,onChange:f=>{const{value:h,selectionEnd:w,selectionStart:_}=f.currentTarget,g=me(h);f.currentTarget.value=g;const v=w??_;if(v!=null){const b=me(h.slice(0,v));f.currentTarget.selectionStart=f.currentTarget.selectionEnd=b.length}j(g),r==null||r(f),f.isDefaultPrevented()||s==null||s(g.length===11?g:null)}})}function me(t){const s=t.toUpperCase().replaceAll(/[^A-Z2-7]/g,"");return s.length<=5?s:`${s.slice(0,5)}-${s.slice(5,10)}`}function xt({onSubmit:t,invalid:s,...n}){const a=ae({prefix:"reset-pwd-email-"}),r=l.useRef(null),[i,o]=l.useState(null),[d,c]=l.useState(void 0);return e.jsxs(G,{...n,onSubmit:x=>{if(i&&d)return t({token:i,password:d},x)},invalid:s||!i||!d,children:[e.jsx(ie,{role:"info",children:e.jsx("p",{id:a,className:"text-md",children:e.jsx(m,{id:"imRJNy"})})}),e.jsx(U,{label:e.jsx(m,{id:"vJgYMA"}),children:e.jsx(ve,{name:"code","aria-labelledby":a,enterKeyHint:"next",required:!0,autoFocus:!0,onToken:x=>{var u;o(x),x&&((u=r.current)==null||u.focus())}})}),e.jsx(U,{label:e.jsx(m,{id:"/nT6AE"}),children:e.jsx(we,{ref:r,name:"password",enterKeyHint:"done",required:!0,password:d,onPassword:c})})]})}function ke({onEmail:t,autoCapitalize:s="none",autoComplete:n="email",autoCorrect:a="off",dir:r="auto",icon:i=e.jsx(le,{className:"w-5"}),onBlur:o,onChange:d,pattern:c="^[^@]+@[^@]+\\.[^@]+$",spellCheck:x="false",value:u,defaultValue:j=u,title:f,...h}){const{i18n:w,_}=R(),[g,v]=l.useState(typeof j=="string"?j:""),b=l.useCallback(p=>{const y=p.target.value.toLowerCase();v(y),d==null||d(p),t==null||t(p.target.validity.valid?y:void 0)},[d,t]);return e.jsx(Z,{...h,title:f??w._({id:"ATGYL1"}),type:"email",autoCapitalize:s,autoCorrect:a,dir:r,spellCheck:x,icon:i,pattern:c,autoComplete:n,value:g,onChange:b,onBlur:o})}function ft({emailDefault:t,onSubmit:s,invalid:n,ref:a,...r}){const{i18n:i,_:o}=R(),d=ae({prefix:"reset-pwd-email-"}),[c,x]=l.useState(t),u=l.useRef(null),j=l.useCallback(f=>{if(c)return s({email:c},f)},[c,s]);return e.jsx(G,{...r,ref:B([a,u]),invalid:n||!c,onSubmit:j,children:e.jsxs(U,{label:e.jsx(m,{id:"ATGYL1"}),children:[e.jsx(ke,{name:"email",placeholder:i._({id:"xRPn3U"}),"aria-labelledby":d,title:i._({id:"ATGYL1"}),required:!0,autoFocus:!0,value:c,onEmail:f=>{var h;(h=u.current)==null||h.reset(),x(f)}}),e.jsx(ie,{role:"info",children:e.jsx("p",{id:d,className:"",children:e.jsx(m,{id:"cHrOqs"})})})]})})}function mt({emailDefault:t,onresetPasswordRequest:s,onResetPasswordConfirm:n,onBack:a,...r}){const{i18n:i,_:o}=R(),[d,c]=l.useState(0);if(d===0)return e.jsxs(T,{...r,title:r.title||i._({id:"dn8X5t"}),subtitle:r.subtitle||e.jsx(m,{id:"Esfg1M"}),children:[e.jsx(ft,{emailDefault:t,submitLabel:e.jsx(m,{id:"hXzOVo"}),onSubmit:async(x,u)=>{await s(x,u),u.aborted||c(1)},cancelLabel:e.jsx(m,{id:"iH8pgl"}),onCancel:a}),e.jsx("hr",{className:"my-5 border-gray-300 dark:border-gray-700"}),e.jsx("center",{children:e.jsx(A,{transparent:!0,onClick:()=>c(1),children:e.jsx(m,{id:"FTT4a4"})})})]});if(d===1)return e.jsx(T,{...r,title:r.title||i._({id:"KbS2K9"}),subtitle:r.subtitle||e.jsx(m,{id:"xg/UcZ"}),children:e.jsx(xt,{submitLabel:e.jsx(m,{id:"hXzOVo"}),onSubmit:async(x,u)=>{await n(x,u),u.aborted||c(2)},cancelLabel:e.jsx(m,{id:"iH8pgl"}),onCancel:a})});if(d===2)return e.jsx(T,{...r,title:r.title||i._({id:"fSy6T1"}),subtitle:r.subtitle||e.jsx(m,{id:"+qGdcW"}),children:e.jsxs("center",{children:[e.jsx("h2",{className:"pb-2 text-xl font-bold",children:e.jsx(m,{id:"DKeVgZ"})}),e.jsx("p",{className:"pb-4",children:e.jsx(m,{id:"67nRLM"})}),e.jsx(A,{color:"primary",onClick:a,children:e.jsx(m,{id:"UaXeX3"})})]})});throw new Error(`Invalid view: ${d}`)}function ht({className:t,children:s,id:n,ref:a,disabled:r,title:i,"aria-label":o=i,"aria-labelledby":d,...c}){const x=ae("input-checkbox-"),u=l.useRef(null),j=l.useRef(null),f=l.useContext(oe),h=n??x;return e.jsx(ne,{className:I("cursor-pointer",t),icon:e.jsx("input",{...c,disabled:r??f.disabled,title:i,"aria-label":o,"aria-labelledby":s?void 0:d??f.labelId,ref:B([a,j]),id:h,className:"accent-primary outline-hidden",type:"checkbox"}),tabIndex:-1,onClick:({target:w})=>{var _;w!==u.current&&w!==j.current&&((_=j.current)==null||_.click())},children:s&&e.jsx("label",{ref:u,htmlFor:h,className:"block w-full cursor-pointer select-none leading-[1.6]",children:s})})}function se({usernameDefault:t="",usernameReadonly:s=!1,rememberDefault:n=!1,onSubmit:a,onBack:r,onForgotPassword:i,ref:o,invalid:d,children:c,...x}){const{i18n:u,_:j}=R(),[f,h]=l.useState(t),[w,_]=l.useState(""),[g,v]=l.useState(n),[b,p]=l.useState(null),[y,k]=l.useState(null),[N,C]=l.useState(!1),P=l.useRef(null),L=l.useCallback(()=>{p(null),k(null)},[p,k]),O=l.useCallback(()=>{var E;L(),(E=P.current)==null||E.reset()},[L,P]),S=l.useCallback(async E=>{try{await a({username:f,password:w,remember:g,...y?{[y.type]:b}:{}},E)}catch($){if(E.aborted)return;if($ instanceof $e){k($);return}throw $ instanceof He&&L(),$}},[f,w,g,y,b,a]);return e.jsxs(G,{...x,ref:B([o,P]),onLoading:C,onCancel:r,cancelLabel:u._({id:"iH8pgl"}),append:c,invalid:d||!f||!w||y!=null&&!b,submitLabel:y?u._({id:"7VpPHA"}):u._({id:"5lWFkC"}),onSubmit:S,children:[e.jsx(U,{disabled:N,label:e.jsx(m,{id:"sJGljQ"}),children:e.jsx(Z,{icon:e.jsx(le,{className:"w-5"}),name:"username",type:"text",title:u._({id:"nZx9mr"}),autoCapitalize:"none",autoCorrect:"off",autoComplete:"username",spellCheck:"false",dir:"auto",enterKeyHint:"next",required:!0,readOnly:s,disabled:s,autoFocus:!0,value:f,onChange:E=>{O(),h(E.target.value)}})}),e.jsx(U,{disabled:N,label:e.jsx(m,{id:"8ZsakT"}),children:e.jsx(_e,{name:"password",onChange:E=>{O(),_(E.target.value)},append:i&&e.jsx(A,{className:"text-sm",type:"button",onClick:()=>{i(f!=null&&f.includes("@")?f:void 0)},"aria-label":u._({id:"slOprG"}),children:e.jsx(m,{id:"F4OP4y"})}),enterKeyHint:y?"next":"done",disabled:N,required:!0})}),e.jsxs(ie,{role:"status",children:[e.jsx("p",{className:"text-md text-primary pb-1 font-bold",children:e.jsx(m,{id:"r6y+jM"})}),e.jsx("p",{className:"text-sm",children:e.jsx(m,{id:"+Z2ZNt"})})]}),e.jsx(ht,{name:"remember",title:u._({id:"1TxdLU"}),enterKeyHint:y?"next":"done",checked:g,onChange:E=>v(E.target.checked),children:e.jsx(m,{id:"1TxdLU"})}),y&&e.jsx(U,{disabled:N,label:e.jsx(m,{id:"4blS0m"}),children:e.jsxs("div",{children:[e.jsx(ve,{title:u._({id:"ioZOzk"}),enterKeyHint:"done",required:!0,autoFocus:!0,value:b??"",onToken:p}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:e.jsx(m,{id:"B+Yy3b",values:{0:y.hint}})})]})},"2fa")]})}function jt({src:t,alt:s}){const[n,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[t]),t&&!n?e.jsx("img",{"aria-hidden":!0,crossOrigin:"anonymous",src:t,alt:s,className:"-ml-1 h-6 w-6 rounded-full",onError:()=>a(!0)}):e.jsx("div",{"aria-hidden":!0,className:"bg-primary border-primary h-6 w-6 overflow-hidden rounded-full border-2 border-solid text-white",children:e.jsx(Ve,{className:"-mx-1 -mb-1"})})}function bt({accounts:t,onAccount:s,onOther:n=void 0,onBack:a,children:r,...i}){const{i18n:o,_:d}=R();return e.jsxs(ue,{...i,append:r,actions:null,cancel:a&&e.jsx(A,{onClick:a,children:e.jsx(m,{id:"iH8pgl"})}),children:[e.jsx("p",{className:"text-sm font-medium text-slate-600 dark:text-slate-400",children:e.jsx(m,{id:"FT1MVS"})}),t.map(c=>{const[x,u]=[c.name,c.preferred_username,c.email,c.sub].filter(Boolean);return e.jsx(ne,{tabIndex:0,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&s(c)},onClick:()=>s(c),role:"button","aria-label":o._({id:"N9o7n5",values:{0:c.name}}),icon:e.jsx(jt,{src:c.picture,alt:x}),append:e.jsx(xe,{"aria-hidden":!0,className:"h-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center",children:[e.jsx("span",{className:"mr-2 truncate font-medium","arial-label":o._({id:"6YtxFj"}),children:x}),u&&e.jsx("span",{className:"truncate text-sm text-neutral-500 dark:text-neutral-400","arial-label":o._({id:"sJGljQ"}),children:u})]})},c.sub)}),n&&e.jsx(ne,{tabIndex:0,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&n()},onClick:n,"aria-label":o._({id:"cR9UpQ"}),role:"button",append:e.jsx(xe,{"aria-hidden":!0,className:"h-4"}),icon:e.jsx(le,{"aria-hidden":!0,className:"h-4"}),children:e.jsx("span",{className:"truncate text-slate-700 dark:text-slate-400",children:e.jsx(m,{id:"+TaG50"})})},"other")]})}function pt({loginHint:t,sessions:s,selectSub:n,onSignIn:a,onForgotPassword:r,onBack:i,title:o,subtitle:d,...c}){const{i18n:x,_:u}=R(),j=l.useMemo(()=>s.find(g=>g.selected),[s]),f=l.useCallback(()=>n(null),[n]),h=l.useMemo(()=>s.map(g=>g.account),[s]),[w,_]=l.useState(s.length===0);return o??(o=x._({id:"5lWFkC"})),l.useEffect(()=>{j&&_(!1)},[j]),j?j.loginRequired?e.jsx(T,{...c,title:o,subtitle:d??e.jsx(m,{id:"HaGV2g"}),children:e.jsx(se,{onSubmit:a,onForgotPassword:r,onBack:f,usernameDefault:j.account.preferred_username||j.account.sub,usernameReadonly:!0,rememberDefault:!0})}):null:t?e.jsx(T,{...c,title:o,subtitle:d??e.jsx(m,{id:"NgaR6B"}),children:e.jsx(se,{onSubmit:a,onForgotPassword:r,onBack:i,usernameDefault:t,usernameReadonly:!0})}):s.length===0?e.jsx(T,{...c,title:o,subtitle:d??e.jsx(m,{id:"T0KLp4"}),children:e.jsx(se,{onSubmit:a,onForgotPassword:r,onBack:i})}):w?e.jsx(T,{...c,title:o,subtitle:d??e.jsx(m,{id:"T0KLp4"}),children:e.jsx(se,{onSubmit:a,onForgotPassword:r,onBack:()=>_(!1)})}):e.jsx(T,{...c,title:o,subtitle:d??e.jsx(m,{id:"o3dwub"}),children:e.jsx(bt,{accounts:h,onAccount:g=>n(g.sub),onOther:()=>_(!0),onBack:i})})}const F=t=>t!=null&&t!==!1,gt=t=>F(t)&&t.invalid===!0,yt=t=>!F(t)||t.invalid===!1;function _t(t){const s=t.findIndex(F),n=t.findLastIndex(F),a=t.findIndex(gt),[r,i]=l.useState(s),o=l.useCallback(p=>p!==-1&&t[p]?(i(p),!0):!1,[t.map(F).join()]),d=t.findLastIndex((p,y)=>F(p)&&y<r),c=t.findIndex((p,y)=>F(p)&&y>r),x=l.useCallback(()=>o(s),[o,s]),u=l.useCallback(()=>o(n),[o,n]),j=l.useCallback(()=>o(d),[o,d]),f=l.useCallback(()=>o(c),[o,c]),h=l.useCallback(()=>o(a),[o,a]),w=r+1+t.reduce((p,y,k)=>k>=r||F(y)?p:p-1,0),_=t.filter(F).length,g=t.every(yt),v=r===-1||!t[r]?void 0:t[r],b=r===-1;return l.useEffect(()=>{b&&x()},[b]),{current:v,currentPosition:w,count:_,completed:g,atFirst:w===1,atLast:w===_,toFirst:x,toLast:u,toPrev:j,toNext:f,toRequired:h}}function wt({prevLabel:t,nextLabel:s,onBack:n,backLabel:a,onDone:r,doneLabel:i,steps:o,className:d,...c}){var N,C;const{atFirst:x,atLast:u,count:j,current:f,currentPosition:h,completed:w,toNext:_,toPrev:g,toRequired:v}=_t(o),b=l.useCallback(()=>{_()||v()},[_,v]),p={current:!0,invalid:f?f.invalid:!1,prevLabel:x&&a||t||e.jsx(m,{id:"iH8pgl"}),prev:x?n:g,nextLabel:u&&i||s||e.jsx(m,{id:"hXzOVo"}),next:u&&w?r:b},y=(N=f==null?void 0:f.titleRender)==null?void 0:N.call(f,p),k=(C=f==null?void 0:f.contentRender)==null?void 0:C.call(f,p);return e.jsxs("div",{className:I(d,"flex flex-col"),...c,children:[e.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:e.jsx(m,{id:"BEx8rG",values:{currentPosition:h,count:j}})}),y&&e.jsx("h2",{className:"mb-4 text-xl font-medium",children:y}),k]})}function vt({links:t,className:s,...n}){const a=t==null?void 0:t.find(r=>r.rel==="help");return a?e.jsx("p",{...n,className:I("rounded-md bg-slate-100 p-3 text-sm text-slate-800 dark:bg-slate-800 dark:text-slate-400",s),children:e.jsx(m,{id:"87VTIH",components:{0:e.jsx("a",{role:"link",href:a.href,rel:a.rel,target:"_blank",className:"text-primary"})}})}):null}function kt({inviteCodeRequired:t=!0,credentials:s,onCredentials:n,onNext:a,nextLabel:r,onPrev:i,prevLabel:o,children:d,ref:c,invalid:x,...u}){const{i18n:j,_:f}=R(),[h,w]=l.useState(s==null?void 0:s.email),[_,g]=l.useState(s==null?void 0:s.password),[v,b]=l.useState(s==null?void 0:s.inviteCode),p=l.useRef(null),y=()=>{var N;return(N=p.current)==null?void 0:N.reset()},k=l.useMemo(()=>h&&_&&(!t||v)?{email:h,password:_,inviteCode:t?v:void 0}:void 0,[h,_,v,t]);return l.useEffect(()=>{n==null||n(k)},[k,n]),e.jsxs(G,{...u,ref:B([c,p]),invalid:x||!k,onCancel:i,cancelLabel:o,onSubmit:a,submitLabel:r,append:d,children:[t&&e.jsx(U,{label:e.jsx(m,{id:"6KlkHI"}),children:e.jsx(Z,{icon:e.jsx(pe,{className:"w-5"}),autoFocus:!0,name:"inviteCode",title:j._({id:"6KlkHI"}),placeholder:j._({id:"jxqcgY"}),required:!0,value:v||"",onChange:N=>{b(N.target.value||void 0),y()},enterKeyHint:"next"})}),e.jsx(U,{label:e.jsx(m,{id:"O3oNi5"}),children:e.jsx(ke,{autoFocus:!t,name:"email",enterKeyHint:"next",required:!0,defaultValue:h,onEmail:N=>{w(N),y()}})}),e.jsx(U,{label:e.jsx(m,{id:"8ZsakT"}),children:e.jsx(we,{name:"password",enterKeyHint:"next",required:!0,password:_,onPassword:N=>{g(N),y()}})})]})}function de({links:t,className:s,...n}){const a=t==null?void 0:t.find(i=>i.rel==="terms-of-service"),r=t==null?void 0:t.find(i=>i.rel==="privacy-policy");return e.jsx("p",{className:I("text-sm text-slate-500 dark:text-slate-400",s),...n,children:e.jsx(m,{id:"mBUXx0",values:{0:a?e.jsx(fe,{className:"text-primary underline",link:a,children:e.jsx(m,{id:"xowcRf"})}):e.jsx(m,{id:"xowcRf"}),1:r?e.jsx(fe,{className:"text-primary underline",link:r,children:e.jsx(m,{id:"LcET2C"})}):e.jsx(m,{id:"LcET2C"})}})})}const St=18,Se=3,Ne=30,Nt=t=>Se+t.length<=Ne&&t.startsWith(".")&&!t.endsWith(".");function Ct(t){const s=Se,n=Math.min(St,Ne-t.length),a=l.useCallback(r=>{const i=r.length>=s&&r.length<=n,o=/^[a-z0-9][a-z0-9-]+[a-z0-9]$/g.test(r);return{validLength:i,validCharset:o,valid:i&&o}},[n,s]);return{minLength:s,maxLength:n,validateSegment:a}}function Et({domains:t,onNext:s,nextLabel:n,onPrev:a,prevLabel:r,handle:i,onHandle:o,invalid:d,children:c,ref:x,...u}){const{i18n:j,_:f}=R(),h=t.filter(Nt),w=l.useRef(null),[_,g]=l.useState(()=>{const S=h.findIndex(E=>i==null?void 0:i.endsWith(E));return S===-1?0:S}),[v,b]=l.useState(()=>(i==null?void 0:i.split(".")[0])||"");l.useEffect(()=>{g(S=>Math.min(S,h.length-1))},[h.length]);const p=h[_]||h[0]||null,{minLength:y,maxLength:k,validateSegment:N}=Ct(p),C=N(v),P=p&&C.valid?`${v}${p}`:void 0;l.useEffect(()=>{var S;(S=w.current)==null||S.reset(),o==null||o(P)},[o,P]);const L=l.useRef(null),O=`@${v}${p}`;return e.jsxs(G,{...u,ref:B([x,w]),onCancel:a,cancelLabel:r,onSubmit:s,submitLabel:n,invalid:d||!P,append:c,children:[e.jsxs("div",{children:[e.jsx(he,{hasValue:!!v,valid:C.validLength,children:e.jsx(m,{id:"4Rgp24",values:{minLength:y,maxLength:k}})}),e.jsx(he,{hasValue:!!v,valid:C.validCharset,children:e.jsx(m,{id:"yDlXDJ"})})]}),e.jsx(Z,{ref:L,icon:e.jsx(le,{className:"w-5"}),name:"handle",type:"text",title:j._({id:"LX2sHe"}),pattern:"[a-z0-9][a-z0-9\\-]+[a-z0-9]",minLength:y,maxLength:k,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",dir:"auto",enterKeyHint:"done",autoFocus:!0,required:!0,value:v,onChange:S=>{const E=S.target.value.toLowerCase(),$=S.target.selectionStart,W=S.target.selectionEnd;S.target.value=E,S.target.setSelectionRange($,W),b(E)},append:h.length>1&&e.jsx("select",{onClick:S=>S.stopPropagation(),onMouseDown:S=>S.stopPropagation(),value:_,"aria-label":j._({id:"HB+TbB"}),onChange:S=>{var E;g(Number(S.target.value)),(E=L.current)==null||E.focus()},className:I("block w-full","text-sm","rounded-lg p-2","bg-white dark:bg-slate-600"),children:h.map((S,E)=>e.jsx("option",{value:E,children:S},S))}),bellow:e.jsx(m,{id:"r/b/p8",values:{0:v.length?e.jsx("strong",{className:"text-gray-800 dark:text-gray-200",children:O}):e.jsx("span",{"aria-hidden":!0,className:"w-24 rounded-md bg-gray-300 p-2 dark:bg-slate-600"})}})}),e.jsx(ie,{role:"status",children:e.jsx("p",{className:"text-md",children:e.jsx(m,{id:"B9VwbO"})})})]})}function he({valid:t,hasValue:s,children:n,className:a,...r}){const{i18n:i,_:o}=R();return e.jsxs("div",{...r,className:I("flex flex-row items-center gap-2",a),children:[s?e.jsx(e.Fragment,{children:t?e.jsx(Fe,{className:"text-success inline-block h-4 w-4",title:i._({id:"nfagfM"})}):e.jsx(Ue,{className:"text-error inline-block h-4 w-4",title:i._({id:"JHB/Ky"})})}):e.jsx("div",{"aria-hidden":!0,className:"flex h-4 w-4 items-center justify-center",children:e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-300 dark:bg-slate-600"})}),e.jsx("div",{className:"text-sm",children:n})]})}const M=typeof window>"u"?null:window.matchMedia("(prefers-color-scheme: dark)");function Rt(){const[t,s]=l.useState(M!=null&&M.matches?"dark":"light");return l.useEffect(()=>{if(!M)return;const n=()=>{s(M.matches?"dark":"light")};return M.addEventListener("change",n),()=>{M.removeEventListener("change",n)}},[]),t}const Lt=l.lazy(()=>Oe(()=>import("./index-CHPoD7Rp.js"),__vite__mapDeps([0,1,2])));function It({siteKey:t,token:s,onToken:n,prevLabel:a,onPrev:r,nextLabel:i,onNext:o,ref:d,invalid:c,children:x,...u}){const j=l.useRef(null),f=Rt(),[h,w]=l.useState(s),_=l.useCallback(()=>{var b;(b=j.current)==null||b.execute()},[]),g=l.useCallback((b,p)=>{w(b),n(b,p)},[n]),v=l.useCallback(b=>{if(h)return o(b);if(j.current)j.current.execute();else throw new Error("Unable to load hCaptcha")},[h,o]);return e.jsx(G,{...u,cancelLabel:a,onCancel:r,submitLabel:i,onSubmit:v,append:x,invalid:c||!h,children:e.jsx(Lt,{theme:f,sitekey:t,onLoad:_,onVerify:g,ref:B([d,j])})})}function Pt({customizationData:{availableUserDomains:t=[],hcaptchaSiteKey:s=void 0,inviteCodeRequired:n=!0,links:a}={},onValidateNewHandle:r,onDone:i,onBack:o,...d}){const{i18n:c,_:x}=R(),[u,j]=l.useState(void 0),[f,h]=l.useState(void 0),[w,_]=l.useState(void 0),g=s==null?void 0:w||!1,v=l.useCallback(b=>{if(u&&f&&g!==!1)return i({...u,handle:f,hcaptchaToken:g},b)},[u,f,g,i]);return e.jsxs(T,{...d,title:d.title??c._({id:"IS0nrP"}),subtitle:d.subtitle??e.jsx(m,{id:"qjBGxf"}),children:[e.jsx(wt,{doneLabel:e.jsx(m,{id:"e+RpCP"}),onBack:o,onDone:v,steps:[{invalid:!f,titleRender:()=>e.jsx(m,{id:"khEQ02"}),contentRender:({prev:b,prevLabel:p,next:y,nextLabel:k,invalid:N})=>e.jsx(Et,{className:"grow",invalid:N,domains:t,handle:f,onHandle:h,prevLabel:p,onPrev:b,nextLabel:k,onNext:async C=>{if(f&&await r({handle:f},C),!C.aborted)return y(C)},children:e.jsx(de,{links:a})})},{invalid:!u,titleRender:()=>e.jsx(m,{id:"gdRnT7"}),contentRender:({prev:b,prevLabel:p,next:y,nextLabel:k,invalid:N})=>e.jsx(kt,{className:"grow",invalid:N,prevLabel:p,onPrev:b,nextLabel:k,onNext:y,inviteCodeRequired:n,credentials:u,onCredentials:j,children:e.jsx(de,{links:a})})},s!=null&&{invalid:g===!1,titleRender:()=>e.jsx(m,{id:"aIar4b"}),contentRender:({prev:b,prevLabel:p,next:y,nextLabel:k,invalid:N})=>e.jsx(It,{className:"grow",invalid:N,siteKey:s,token:w,onToken:_,prevLabel:p,onPrev:b,nextLabel:k,onNext:y,children:e.jsx(de,{links:a})})}]}),e.jsx(vt,{className:"mt-4",links:a})]})}function At({onSignUp:t,onSignIn:s,onCancel:n,...a}){const{i18n:r,_:i}=R();return e.jsxs(Be,{...a,title:a.title??r._({id:"OX6vme"}),children:[t&&e.jsx(A,{className:"m-1 w-60 min-w-min max-w-full",color:s?"primary":void 0,onClick:t,children:e.jsx(m,{id:"mpt9T+"})}),s&&e.jsx(A,{className:"m-1 w-60 min-w-min max-w-full",color:t?void 0:"primary",onClick:s,children:e.jsx(m,{id:"5lWFkC"})}),n&&e.jsx(A,{className:"m-1 w-60 min-w-min max-w-full",onClick:n,children:e.jsx(m,{id:"dEgA5A"})})]})}function Tt({authorizeData:t,sessions:s,customizationData:n,...a}){var W;const{i18n:r,_:i}=R(),o=(t==null?void 0:t.loginHint)!=null,d=o?2:0,[c,x]=l.useState(d),u=D(x,5),j=D(x,2),f=D(x,3),h=D(x,1),w=D(x,4),_=D(x,0),[g,v]=l.useState(void 0),{sessions:b,selectSub:p,doValidateNewHandle:y,doSignUp:k,doSignIn:N,doInitiatePasswordReset:C,doConfirmResetPassword:P,doAccept:L,doReject:O}=We({sessions:s,onRedirected:u}),S=b.find(Y=>Y.selected&&!Y.loginRequired);l.useEffect(()=>{S&&(S.consentRequired?w():L(S.account.sub))},[S,L,w]);const E=!!((W=n==null?void 0:n.availableUserDomains)!=null&&W.length)&&!t.loginHint,$=c===1&&!E||c===4&&!S;if(l.useEffect(()=>{$&&_()},[$,_]),c===0)return e.jsx(At,{...a,customizationData:n,onSignIn:j,onSignUp:E?h:void 0,onCancel:()=>O()});if(c===1)return e.jsx(Pt,{...a,customizationData:n,onValidateNewHandle:y,onBack:_,onDone:k});if(c===3)return e.jsx(mt,{...a,emailDefault:g,onresetPasswordRequest:C,onResetPasswordConfirm:P,onBack:o?j:_});if(c===2)return e.jsx(pt,{...a,loginHint:t.loginHint,sessions:b,selectSub:p,onSignIn:N,onBack:o?()=>O():_,onForgotPassword:Y=>{f(),v(Y)}});if(c===4)return S?e.jsx(st,{...a,clientId:t.clientId,clientMetadata:t.clientMetadata,clientTrusted:t.clientTrusted,account:S.account,scopeDetails:t.scopeDetails,onAccept:()=>L(S.account.sub),onReject:()=>O(),onBack:o?void 0:()=>{p(null),x(b.length?2:0)}}):null;if(c===5)return e.jsx(T,{...a,title:a.title??r._({id:"UCOd1e"}),children:e.jsx(m,{id:"qq6QQ5"})});throw new Error("Unexpected application state")}const{__authorizeData:re,__sessions:$t,__customizationData:je}=window,X=new URL(window.location.href);X.pathname==="/oauth/authorize"&&!X.searchParams.has("request_uri")&&(X.search="",X.searchParams.set("client_id",re.clientId),X.searchParams.set("request_uri",re.requestUri),window.history.replaceState(history.state,"",X.pathname+X.search));const Ht=document.getElementById("root");var be;qe.createRoot(Ht).render(e.jsx(l.StrictMode,{children:e.jsx(Me,{userLocales:(be=re.uiLocales)==null?void 0:be.split(" "),children:e.jsx(Ke,{fallbackRender:({error:t})=>e.jsx(Xe,{error:t,customizationData:je}),children:e.jsx(Tt,{customizationData:je,authorizeData:re,sessions:$t})})})}));
3
- //# sourceMappingURL=authorization-page-Cms-rcBA.js.map