(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44864],{65535:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/reference/core/providers/passkey",function(){return r(86412)}])},86412:function(e,t,r){"use strict";r.r(t),r.d(t,{useTOC:function(){return c}});var s=r(651),n=r(64211),i=r(1089),a=r(15593),l=r(63195),d=r(74481),o=r(21769);function c(e){return[{value:"default()",id:"default",depth:2},{value:"Setup",id:"setup",depth:3},{value:"Configuration",id:"configuration",depth:4},{value:"Resources",id:"resources",depth:3},{value:"Notes",id:"notes",depth:3},{value:"Parameters",id:"parameters",depth:3},{value:"Returns",id:"returns",depth:3}]}function h(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}t.default=(0,n.c)(function(e){let{toc:t=c(e)}=e,r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",span:"span",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,a.a)(),...e.components};return l.m||h("$Tabs",!1),l.m.Tab||h("$Tabs.Tab",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.h1,{children:"providers/passkey"}),"\n",(0,s.jsxs)("div",{style:{backgroundColor:"#24292f",display:"flex",justifyContent:"space-between",color:"#fff",padding:16},children:[(0,s.jsxs)("span",{children:["Built-in ",(0,s.jsx)("b",{children:"Passkey"})," integration."]}),(0,s.jsx)("a",{href:"https://passkeys.dev",children:(0,s.jsx)("img",{style:{display:"block"},src:"https://authjs.dev/img/providers/passkey.svg",height:"48",width:"48"})})]}),"\n",(0,s.jsx)(r.h2,{id:t[0].id,children:t[0].value}),"\n",(0,s.jsx)(r.pre,{icon:o.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-copy":"",children:(0,s.jsx)(r.code,{children:(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"default"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(config): WebAuthnConfig"})]})})}),"\n",(0,s.jsx)(r.p,{children:"Add Passkey login to your page."}),"\n",(0,s.jsx)(r.h3,{id:t[1].id,children:t[1].value}),"\n",(0,s.jsx)(r.p,{children:"Install the required peer dependency."}),"\n",(0,s.jsxs)(l.m,{items:["npm","pnpm","yarn","bun"],storageKey:"selectedPackageManager",children:[(0,s.jsx)(l.m.Tab,{children:(0,s.jsx)(r.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,s.jsx)(r.code,{children:(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"npm"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" install"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @simplewebauthn/browser@9.0.1"})]})})})}),(0,s.jsx)(l.m.Tab,{children:(0,s.jsx)(r.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,s.jsx)(r.code,{children:(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"pnpm"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @simplewebauthn/browser@9.0.1"})]})})})}),(0,s.jsx)(l.m.Tab,{children:(0,s.jsx)(r.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,s.jsx)(r.code,{children:(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"yarn"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @simplewebauthn/browser@9.0.1"})]})})})}),(0,s.jsx)(l.m.Tab,{children:(0,s.jsx)(r.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,s.jsx)(r.code,{children:(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"bun"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @simplewebauthn/browser@9.0.1"})]})})})})]}),"\n",(0,s.jsx)(r.h4,{id:t[2].id,children:t[2].value}),"\n",(0,s.jsx)(r.pre,{icon:o.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-copy":"",children:(0,s.jsxs)(r.code,{children:[(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { Auth } "}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/core"'})]}),"\n",(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Passkey "}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/core/providers/passkey"'})]}),"\n",(0,s.jsx)(r.span,{children:" "}),"\n",(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"const"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" request"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" new"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" Request"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(origin)"})]}),"\n",(0,s.jsxs)(r.span,{children:[(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"const"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" response"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" await"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" Auth"}),(0,s.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(request, {"})]}),"\n",(0,s.jsx)(r.span,{children:(0,s.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  providers: [Passkey],"})}),"\n",(0,s.jsx)(r.span,{children:(0,s.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})}),"\n",(0,s.jsx)(r.h3,{id:t[3].id,children:t[3].value}),"\n",(0,s.jsxs)(r.ul,{children:["\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"https://simplewebauthn.dev/docs/packages/server",children:"SimpleWebAuthn - Server side"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"https://simplewebauthn.dev/docs/packages/client",children:"SimpleWebAuthn - Client side"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"https://passkeys.dev/docs/intro/what-are-passkeys/",children:"Passkeys.dev - Intro"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"https://passkeys.dev/docs/reference/specs/",children:"Passkeys.dev - Specifications"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/passkey.ts",children:"Source code"})}),"\n"]}),"\n",(0,s.jsx)(r.h3,{id:t[4].id,children:t[4].value}),"\n",(0,s.jsx)(r.p,{children:"This provider is an extension of the WebAuthn provider that defines some default values\nassociated with Passkey support. You may override these, but be aware that authenticators\nmay not recognize your credentials as Passkey credentials if you do."}),"\n",(0,s.jsx)(d.U,{type:"default",children:(0,s.jsxs)(r.p,{children:["The Passkey provider comes with a ",(0,s.jsx)(r.a,{href:"https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/passkey.ts",children:"default configuration"}),".\nTo override the defaults for your use case, check out ",(0,s.jsx)(r.a,{href:"https://authjs.dev/guides/configuring-oauth-providers",children:"customizing a built-in WebAuthn provider"}),"."]})}),"\n",(0,s.jsxs)(d.U,{type:"info",children:[(0,s.jsxs)(r.p,{children:[(0,s.jsx)(r.strong,{children:(0,s.jsx)(r.strong,{children:"Disclaimer"})})," If you think you found a bug in the default configuration, you can ",(0,s.jsx)(r.a,{href:"https://authjs.dev/new/provider-issue",children:"open an issue"}),"."]}),(0,s.jsxs)(r.p,{children:["Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from\nthe spec by the provider. You can open an issue, but if the problem is non-compliance with the spec,\nwe might not pursue a resolution. You can ask for more help in ",(0,s.jsx)(r.a,{href:"https://authjs.dev/new/github-discussions",children:"Discussions"}),"."]})]}),"\n",(0,s.jsx)(r.h3,{id:t[5].id,children:t[5].value}),"\n",(0,s.jsxs)(r.table,{children:[(0,s.jsx)(r.thead,{children:(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.th,{style:{textAlign:"left"},children:"Parameter"}),(0,s.jsx)(r.th,{style:{textAlign:"left"},children:"Type"})]})}),(0,s.jsx)(r.tbody,{children:(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{style:{textAlign:"left"},children:(0,s.jsx)(r.code,{children:"config"})}),(0,s.jsxs)(r.td,{style:{textAlign:"left"},children:[(0,s.jsx)(r.a,{href:"https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype",children:(0,s.jsx)(r.code,{children:"Partial"})}),"<",(0,s.jsx)(r.a,{href:"webauthn#webauthnconfig",children:(0,s.jsx)(r.code,{children:"WebAuthnConfig"})}),">"]})]})})]}),"\n",(0,s.jsx)(r.h3,{id:t[6].id,children:t[6].value}),"\n",(0,s.jsx)(r.p,{children:(0,s.jsx)(r.a,{href:"webauthn#webauthnconfig",children:(0,s.jsx)(r.code,{children:"WebAuthnConfig"})})})]})},"/reference/core/providers/passkey",{filePath:"pages/reference/core/providers/passkey.mdx",pageMap:i.v,frontMatter:{},title:"providers/passkey"},"undefined"==typeof RemoteContent?c:RemoteContent.useTOC)},74481:function(e,t,r){"use strict";r.d(t,{U:function(){return d}});var s=r(651),n=r(69577),i=r(21769);let a={default:"\uD83D\uDCA1",error:"\uD83D\uDEAB",info:(0,s.jsx)(i.AV,{className:"_mt-1"}),warning:"⚠️"},l={default:(0,n.Z)("_border-orange-100 _bg-orange-50 _text-orange-800 dark:_border-orange-400/30 dark:_bg-orange-400/20 dark:_text-orange-300"),error:(0,n.Z)("_border-red-200 _bg-red-100 _text-red-900 dark:_border-red-200/30 dark:_bg-red-900/30 dark:_text-red-200"),info:(0,n.Z)("_border-blue-200 _bg-blue-100 _text-blue-900 dark:_border-blue-200/30 dark:_bg-blue-900/30 dark:_text-blue-200"),warning:(0,n.Z)("_border-yellow-100 _bg-yellow-50 _text-yellow-900 dark:_border-yellow-200/30 dark:_bg-yellow-700/30 dark:_text-yellow-200")};function d({children:e,type:t="default",emoji:r=a[t]}){return(0,s.jsxs)("div",{className:(0,n.Z)("nextra-callout _overflow-x-auto _mt-6 _flex _rounded-lg _border _py-2 ltr:_pr-4 rtl:_pl-4","contrast-more:_border-current contrast-more:dark:_border-current",l[t]),children:[(0,s.jsx)("div",{className:"_select-none _text-xl ltr:_pl-3 ltr:_pr-2 rtl:_pr-3 rtl:_pl-2",style:{fontFamily:'"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},children:r}),(0,s.jsx)("div",{className:"_w-full _min-w-0 _leading-7",children:e})]})}},63195:function(e,t,r){"use strict";let s,n,i;r.d(t,{m:function(){return q}});var a=r(651),l=r(11263),d=r(68662),o=r(92379),c=r(71452),h=r(45542),u=r(76192),p=r(72099),x=r(70207),b=r(50827),f=r(87327);function g({onFocus:e}){let t;let[r,s]=(0,o.useState)(!0),n=(t=(0,o.useRef)(!1),(0,u.e)(()=>(t.current=!0,()=>{t.current=!1}),[]),t);return r?o.createElement(f._,{as:"button",type:"button",features:f.x.Focusable,onFocus:t=>{t.preventDefault();let r,i=50;r=requestAnimationFrame(function t(){if(i--<=0){r&&cancelAnimationFrame(r);return}if(e()){if(cancelAnimationFrame(r),!n.current)return;s(!1);return}r=requestAnimationFrame(t)})}}):null}var k=r(35873),y=r(20237),j=r(76939),m=r(46751),v=r(10138);let _=o.createContext(null);function w({children:e}){let t=o.useRef({groups:new Map,get(e,t){var r;let s=this.groups.get(e);s||(s=new Map,this.groups.set(e,s));let n=null!=(r=s.get(t))?r:0;return s.set(t,n+1),[Array.from(s.keys()).indexOf(t),function(){let e=s.get(t);e>1?s.set(t,e-1):s.delete(t)}]}});return o.createElement(_.Provider,{value:t},e)}function E(e){let t=o.useContext(_);if(!t)throw Error("You must wrap your component in a <StableCollection>");let r=o.useId(),[s,n]=t.current.get(e,r);return o.useEffect(()=>n,[]),s}var F=r(80579),T=((s=T||{})[s.Forwards=0]="Forwards",s[s.Backwards=1]="Backwards",s),P=((n=P||{})[n.Less=-1]="Less",n[n.Equal=0]="Equal",n[n.Greater=1]="Greater",n),A=((i=A||{})[i.SetSelectedIndex=0]="SetSelectedIndex",i[i.RegisterTab=1]="RegisterTab",i[i.UnregisterTab=2]="UnregisterTab",i[i.RegisterPanel=3]="RegisterPanel",i[i.UnregisterPanel=4]="UnregisterPanel",i);let C={0(e,t){var r;let s=(0,k.z2)(e.tabs,e=>e.current),n=(0,k.z2)(e.panels,e=>e.current),i=s.filter(e=>{var t;return!(null!=(t=e.current)&&t.hasAttribute("disabled"))}),a={...e,tabs:s,panels:n};if(t.index<0||t.index>s.length-1){let r=(0,y.E)(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>(0,y.E)(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(0===i.length)return a;let n=(0,y.E)(r,{0:()=>s.indexOf(i[0]),1:()=>s.indexOf(i[i.length-1])});return{...a,selectedIndex:-1===n?e.selectedIndex:n}}let l=s.slice(0,t.index),d=[...s.slice(t.index),...l].find(e=>i.includes(e));if(!d)return a;let o=null!=(r=s.indexOf(d))?r:e.selectedIndex;return -1===o&&(o=e.selectedIndex),{...a,selectedIndex:o}},1(e,t){if(e.tabs.includes(t.tab))return e;let r=e.tabs[e.selectedIndex],s=(0,k.z2)([...e.tabs,t.tab],e=>e.current),n=e.selectedIndex;return e.info.current.isControlled||-1===(n=s.indexOf(r))&&(n=e.selectedIndex),{...e,tabs:s,selectedIndex:n}},2:(e,t)=>({...e,tabs:e.tabs.filter(e=>e!==t.tab)}),3:(e,t)=>e.panels.includes(t.panel)?e:{...e,panels:(0,k.z2)([...e.panels,t.panel],e=>e.current)},4:(e,t)=>({...e,panels:e.panels.filter(e=>e!==t.panel)})},I=(0,o.createContext)(null);function S(e){let t=(0,o.useContext)(I);if(null===t){let t=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,S),t}return t}I.displayName="TabsDataContext";let R=(0,o.createContext)(null);function D(e){let t=(0,o.useContext)(R);if(null===t){let t=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,D),t}return t}function N(e,t){return(0,y.E)(t.type,C,e,t)}R.displayName="TabsActionsContext";let O=v.VN.RenderStrategy|v.VN.Static,B=(0,v.yV)(function(e,t){var r,s;let n=(0,o.useId)(),{id:i=`headlessui-tabs-tab-${n}`,disabled:a=!1,autoFocus:p=!1,...f}=e,{orientation:g,activation:_,selectedIndex:w,tabs:T,panels:P}=S("Tab"),A=D("Tab"),C=S("Tab"),[I,R]=(0,o.useState)(null),N=(0,o.useRef)(null),O=(0,b.T)(N,t,R);(0,u.e)(()=>A.registerTab(N),[A,N]);let B=E("tabs"),z=T.indexOf(N);-1===z&&(z=B);let M=z===w,U=(0,h.z)(e=>{var t;let r=e();if(r===k.fE.Success&&"auto"===_){let e=null==(t=(0,m.r)(N))?void 0:t.activeElement,r=C.tabs.findIndex(t=>t.current===e);-1!==r&&A.change(r)}return r}),V=(0,h.z)(e=>{let t=T.map(e=>e.current).filter(Boolean);if(e.key===F.R.Space||e.key===F.R.Enter){e.preventDefault(),e.stopPropagation(),A.change(z);return}switch(e.key){case F.R.Home:case F.R.PageUp:return e.preventDefault(),e.stopPropagation(),U(()=>(0,k.jA)(t,k.TO.First));case F.R.End:case F.R.PageDown:return e.preventDefault(),e.stopPropagation(),U(()=>(0,k.jA)(t,k.TO.Last))}if(U(()=>(0,y.E)(g,{vertical:()=>e.key===F.R.ArrowUp?(0,k.jA)(t,k.TO.Previous|k.TO.WrapAround):e.key===F.R.ArrowDown?(0,k.jA)(t,k.TO.Next|k.TO.WrapAround):k.fE.Error,horizontal:()=>e.key===F.R.ArrowLeft?(0,k.jA)(t,k.TO.Previous|k.TO.WrapAround):e.key===F.R.ArrowRight?(0,k.jA)(t,k.TO.Next|k.TO.WrapAround):k.fE.Error}))===k.fE.Success)return e.preventDefault()}),W=(0,o.useRef)(!1),Y=(0,h.z)(()=>{var e;W.current||(W.current=!0,null==(e=N.current)||e.focus({preventScroll:!0}),A.change(z),(0,j.Y)(()=>{W.current=!1}))}),L=(0,h.z)(e=>{e.preventDefault()}),{isFocusVisible:q,focusProps:G}=(0,l.F)({autoFocus:p}),{isHovered:Z,hoverProps:$}=(0,d.X)({isDisabled:a}),{pressed:K,pressProps:X}=(0,c.x)({disabled:a}),H=(0,o.useMemo)(()=>({selected:M,hover:Z,active:K,focus:q,autofocus:p,disabled:a}),[M,Z,q,K,p,a]),J=(0,v.dG)({ref:O,onKeyDown:V,onMouseDown:L,onClick:Y,id:i,role:"tab",type:(0,x.f)(e,I),"aria-controls":null==(s=null==(r=P[z])?void 0:r.current)?void 0:s.id,"aria-selected":M,tabIndex:M?0:-1,disabled:a||void 0,autoFocus:p},G,$,X);return(0,v.sY)({ourProps:J,theirProps:f,slot:H,defaultTag:"button",name:"Tabs.Tab"})}),z=(0,v.yV)(function(e,t){let{defaultIndex:r=0,vertical:s=!1,manual:n=!1,onChange:i,selectedIndex:a=null,...l}=e,d=s?"vertical":"horizontal",c=n?"manual":"auto",x=null!==a,f=(0,p.E)({isControlled:x}),y=(0,b.T)(t),[j,m]=(0,o.useReducer)(N,{info:f,selectedIndex:null!=a?a:r,tabs:[],panels:[]}),_=(0,o.useMemo)(()=>({selectedIndex:j.selectedIndex}),[j.selectedIndex]),E=(0,p.E)(i||(()=>{})),F=(0,p.E)(j.tabs),T=(0,o.useMemo)(()=>({orientation:d,activation:c,...j}),[d,c,j]),P=(0,h.z)(e=>(m({type:1,tab:e}),()=>m({type:2,tab:e}))),A=(0,h.z)(e=>(m({type:3,panel:e}),()=>m({type:4,panel:e}))),C=(0,h.z)(e=>{S.current!==e&&E.current(e),x||m({type:0,index:e})}),S=(0,p.E)(x?e.selectedIndex:j.selectedIndex),D=(0,o.useMemo)(()=>({registerTab:P,registerPanel:A,change:C}),[]);return(0,u.e)(()=>{m({type:0,index:null!=a?a:r})},[a]),(0,u.e)(()=>{if(void 0===S.current||j.tabs.length<=0)return;let e=(0,k.z2)(j.tabs,e=>e.current);e.some((e,t)=>j.tabs[t]!==e)&&C(e.indexOf(j.tabs[S.current]))}),o.createElement(w,null,o.createElement(R.Provider,{value:D},o.createElement(I.Provider,{value:T},T.tabs.length<=0&&o.createElement(g,{onFocus:()=>{var e,t;for(let r of F.current)if((null==(e=r.current)?void 0:e.tabIndex)===0)return null==(t=r.current)||t.focus(),!0;return!1}}),(0,v.sY)({ourProps:{ref:y},theirProps:l,slot:_,defaultTag:"div",name:"Tabs"}))))}),M=(0,v.yV)(function(e,t){let{orientation:r,selectedIndex:s}=S("Tab.List"),n=(0,b.T)(t),i=(0,o.useMemo)(()=>({selectedIndex:s}),[s]);return(0,v.sY)({ourProps:{ref:n,role:"tablist","aria-orientation":r},theirProps:e,slot:i,defaultTag:"div",name:"Tabs.List"})}),U=(0,v.yV)(function(e,t){let{selectedIndex:r}=S("Tab.Panels"),s=(0,b.T)(t),n=(0,o.useMemo)(()=>({selectedIndex:r}),[r]);return(0,v.sY)({ourProps:{ref:s},theirProps:e,slot:n,defaultTag:"div",name:"Tabs.Panels"})}),V=(0,v.yV)(function(e,t){var r,s,n,i;let a=(0,o.useId)(),{id:d=`headlessui-tabs-panel-${a}`,tabIndex:c=0,...h}=e,{selectedIndex:p,tabs:x,panels:g}=S("Tab.Panel"),k=D("Tab.Panel"),y=(0,o.useRef)(null),j=(0,b.T)(y,t);(0,u.e)(()=>k.registerPanel(y),[k,y]);let m=E("panels"),_=g.indexOf(y);-1===_&&(_=m);let w=_===p,{isFocusVisible:F,focusProps:T}=(0,l.F)(),P=(0,o.useMemo)(()=>({selected:w,focus:F}),[w,F]),A=(0,v.dG)({ref:j,id:d,role:"tabpanel","aria-labelledby":null==(s=null==(r=x[_])?void 0:r.current)?void 0:s.id,tabIndex:w?c:-1},T);return w||null!=(n=h.unmount)&&!n||null!=(i=h.static)&&i?(0,v.sY)({ourProps:A,theirProps:h,slot:P,defaultTag:"div",features:O,visible:w,name:"Tabs.Panel"}):o.createElement(f._,{"aria-hidden":"true",...A})}),W=Object.assign(B,{Group:z,List:M,Panels:U,Panel:V});var Y=r(69577);function L(e){return!!e&&"object"==typeof e&&"label"in e}let q=Object.assign(function({items:e,selectedIndex:t,defaultIndex:r=0,onChange:s,children:n,storageKey:i}){let[l,d]=(0,o.useState)(r);(0,o.useEffect)(()=>{void 0!==t&&d(t)},[t]),(0,o.useEffect)(()=>{if(!i)return;function e(e){e.key===i&&d(Number(e.newValue))}let t=Number(localStorage.getItem(i));return d(Number.isNaN(t)?0:t),window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[]);let c=(0,o.useCallback)(e=>{if(i){let t=String(e);localStorage.setItem(i,t),window.dispatchEvent(new StorageEvent("storage",{key:i,newValue:t}));return}d(e),s?.(e)},[]);return(0,a.jsxs)(z,{selectedIndex:l,defaultIndex:r,onChange:c,tabIndex:-1,children:[(0,a.jsx)(M,{className:(0,Y.Z)("nextra-scrollbar _overflow-x-auto _overscroll-x-contain _overflow-y-hidden","_mt-4 _flex _w-full _gap-2 _border-b _border-gray-200 _pb-px dark:_border-neutral-800"),children:e.map((e,t)=>(0,a.jsx)(W,{disabled:L(e)&&e.disabled,className:(0,Y.Z)("_ring-inset","_rounded-t _p-2 _font-medium _leading-5 _transition-colors","_-mb-0.5 _select-none _border-b-2","data-[selected]:!_border-current data-[selected]:!_text-primary-600","_border-transparent _text-gray-600 hover:_border-gray-200 hover:_text-black dark:_text-gray-200 dark:hover:_border-neutral-800 dark:hover:_text-white","disabled:_pointer-events-none disabled:_text-gray-400 disabled:dark:_text-neutral-600"),children:L(e)?e.label:e},t))}),(0,a.jsx)(U,{children:n})]})},{displayName:"Tabs",Tab:function({children:e,unmount:t=!1,...r}){return(0,a.jsx)(V,{...r,unmount:t,className:"_rounded _mt-6",children:e})}})}},function(e){e.O(0,[64211,1089,92888,49774,40179],function(){return e(e.s=65535)}),_N_E=e.O()}]);