(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[84350],{91750:function(e,s,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/getting-started/providers/slack",function(){return i(86548)}])},84765:function(e,s,i){"use strict";i.d(s,{E:function(){return k}});var t=i(651),n=i(27966),r=i(83119),a=i(6774),l=i(77914),d=i(92379);let h="authjs.codeTab.framework";k.Next=x,k.NextClient=p,k.Svelte=E,k.Express=g,k.Qwik=j;let c={[x.name]:"Next.js",[j.name]:"Qwik",[E.name]:"SvelteKit",[g.name]:"Express"},o={[x.name]:"Next.js",[p.name]:"Next.js (Client)",[j.name]:"Qwik",[E.name]:"SvelteKit",[g.name]:"Express"},u=e=>{let s=e.toLowerCase().replaceAll(/[^a-zA-z]+/g,"-");return s.endsWith("-")?s.slice(0,-1):s};function k(e){let{children:s}=e,i=(0,r.useRouter)(),k=(0,n.useSearchParams)(),x=d.Children.toArray(s),{project:E}=(0,a.LU)(),g=x.some(e=>e&&e.type.name===p.name)?o:c,j=e=>{let s=new URLSearchParams(null==k?void 0:k.toString());s.set("framework",e),i.push("".concat(i.pathname,"?").concat(s.toString()))};return(0,d.useEffect)(()=>{let e=Object.keys(g).length,s=window.localStorage.getItem(h),i=parseInt(null!=s?s:"0")%e;s||window.localStorage.setItem(h,"0"),j(u(Object.values(g)[i]))},[i.pathname,g]),(0,t.jsx)("div",{className:"[&_div[role='tablist']]:!pb-0",onClick:e=>{if(!(e.target instanceof HTMLButtonElement))return;let{textContent:s}=e.target;j(u(s))},children:(0,t.jsx)(l.m,{storageKey:h,items:Object.values(g),children:Object.keys(g).map(e=>{var s;let n=x.find(s=>{var i;return(null==s?void 0:null===(i=s.type)||void 0===i?void 0:i.name)===e});return Object.keys(null!==(s=null==n?void 0:n.props)&&void 0!==s?s:{}).length?n:(0,t.jsx)(l.m.Tab,{children:(0,t.jsxs)("p",{className:"rounded-lg bg-slate-100 p-6 font-semibold dark:bg-neutral-950",children:[g[e]," not documented yet. Help us by contributing"," ",(0,t.jsx)("a",{className:"underline",target:"_blank",href:"".concat(E.link,"/edit/main/docs/pages").concat(i.pathname,".mdx"),rel:"noreferrer",children:"here"}),"."]})},e)})})})}function p(e){let{children:s}=e;return(0,t.jsx)(l.m.Tab,{children:s})}function x(e){let{children:s}=e;return(0,t.jsx)(l.m.Tab,{children:s})}function E(e){let{children:s}=e;return(0,t.jsx)(l.m.Tab,{children:s})}function g(e){let{children:s}=e;return(0,t.jsx)(l.m.Tab,{children:s})}function j(e){let{children:s}=e;return(0,t.jsx)(l.m.Tab,{children:s})}},86548:function(e,s,i){"use strict";i.r(s),i.d(s,{useTOC:function(){return h}});var t=i(651),n=i(74139),r=i(21461),a=i(46062),l=i(84765),d=i(85131);function h(e){return[{value:"Resources",id:"resources",depth:2},{value:"Setup",id:"setup",depth:2},{value:"Callback URL",id:"callback-url",depth:3},{value:"Environment Variables",id:"environment-variables",depth:3},{value:"Configuration",id:"configuration",depth:3},{value:"Notes",id:"notes",depth:3}]}function c(e,s){throw Error("Expected "+(s?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}s.default=(0,n.c)(function(e){let{toc:s=h(e)}=e,i={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",pre:"pre",span:"span",ul:"ul",...(0,a.a)(),...e.components};return l.E||c("Code",!1),l.E.Express||c("Code.Express",!0),l.E.Next||c("Code.Next",!0),l.E.Qwik||c("Code.Qwik",!0),l.E.Svelte||c("Code.Svelte",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("img",{align:"right",src:"/img/providers/slack.svg",height:"64",width:"64"}),"\n",(0,t.jsx)(i.h1,{children:"Slack Provider"}),"\n",(0,t.jsx)(i.h2,{id:s[0].id,children:s[0].value}),"\n",(0,t.jsxs)(i.ul,{children:["\n",(0,t.jsx)(i.li,{children:(0,t.jsx)(i.a,{href:"https://api.slack.com/authentication",children:"Slack Authentication documentation"})}),"\n",(0,t.jsx)(i.li,{children:(0,t.jsx)(i.a,{href:"https://api.slack.com/docs/sign-in-with-slack",children:"Sign-in with Slack"})}),"\n",(0,t.jsx)(i.li,{children:(0,t.jsx)(i.a,{href:"https://api.slack.com/apps",children:"Slack app console"})}),"\n"]}),"\n",(0,t.jsx)(i.h2,{id:s[1].id,children:s[1].value}),"\n",(0,t.jsx)(i.h3,{id:s[2].id,children:s[2].value}),"\n",(0,t.jsxs)(l.E,{children:[(0,t.jsx)(l.E.Next,{children:(0,t.jsx)(i.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,t.jsx)(i.code,{children:(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"https://example.com/api/auth/callback/slack"})})})})}),(0,t.jsx)(l.E.Qwik,{children:(0,t.jsx)(i.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,t.jsx)(i.code,{children:(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"https://example.com/auth/callback/slack"})})})})}),(0,t.jsx)(l.E.Svelte,{children:(0,t.jsx)(i.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,t.jsx)(i.code,{children:(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"https://example.com/auth/callback/slack"})})})})})]}),"\n",(0,t.jsx)(i.h3,{id:s[3].id,children:s[3].value}),"\n",(0,t.jsx)(i.pre,{tabIndex:"0","data-language":"plaintext","data-word-wrap":"","data-copy":"",children:(0,t.jsxs)(i.code,{children:[(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{children:"AUTH_SLACK_ID"})}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{children:"AUTH_SLACK_SECRET"})})]})}),"\n",(0,t.jsx)(i.h3,{id:s[4].id,children:s[4].value}),"\n",(0,t.jsxs)(l.E,{children:[(0,t.jsx)(l.E.Next,{children:(0,t.jsx)(i.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/auth.ts","data-copy":"",children:(0,t.jsxs)(i.code,{children:[(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" NextAuth "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "next-auth"'})]}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "next-auth/providers/slack"'})]}),"\n",(0,t.jsx)(i.span,{children:" "}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handlers"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"auth"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" NextAuth"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  providers: [Slack],"})}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})})}),(0,t.jsx)(l.E.Qwik,{children:(0,t.jsx)(i.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/src/routes/plugin@auth.ts","data-copy":"",children:(0,t.jsxs)(i.code,{children:[(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { QwikAuth$ } "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/qwik"'})]}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/qwik/providers/slack"'})]}),"\n",(0,t.jsx)(i.span,{children:" "}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"onRequest"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSession"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSignIn"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSignOut"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" QwikAuth$"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("})]}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  () "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"=>"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" ({"})]}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    providers: [Slack],"})}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  })"})}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:")"})})]})})}),(0,t.jsx)(l.E.Svelte,{children:(0,t.jsx)(i.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/src/auth.ts","data-copy":"",children:(0,t.jsxs)(i.code,{children:[(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { SvelteKitAuth } "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/sveltekit"'})]}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/sveltekit/providers/slack"'})]}),"\n",(0,t.jsx)(i.span,{children:" "}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handle"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" SvelteKitAuth"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  providers: [Slack],"})}),"\n",(0,t.jsx)(i.span,{children:(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})})}),(0,t.jsx)(l.E.Express,{children:(0,t.jsx)(i.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/src/app.ts","data-copy":"",children:(0,t.jsxs)(i.code,{children:[(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { ExpressAuth } "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/express"'})]}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/express/providers/slack"'})]}),"\n",(0,t.jsx)(i.span,{children:" "}),"\n",(0,t.jsxs)(i.span,{children:[(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"app."}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"use"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:'"/auth/*"'}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"ExpressAuth"}),(0,t.jsx)(i.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({ providers: [Slack] }))"})]})]})})})]}),"\n",(0,t.jsx)(i.h3,{id:s[5].id,children:s[5].value}),"\n",(0,t.jsxs)(i.ul,{children:["\n",(0,t.jsxs)(i.li,{children:["Slack requires that the redirect URL of your app uses https, even for local development. An easy workaround for this is using a service like ",(0,t.jsx)(i.a,{href:"https://ngrok.com/",children:"ngrok"})," that creates a secure tunnel to your app, using https. Remember to set the url as ",(0,t.jsx)(i.code,{children:"AUTH_URL"})," as well."]}),"\n"]})]})},"/getting-started/providers/slack",{filePath:"pages/getting-started/providers/slack.mdx",timestamp:1729368829e3,pageMap:r.v,frontMatter:{},title:"Slack Provider"},"undefined"==typeof RemoteContent?h:RemoteContent.useTOC)},77914:function(e,s,i){"use strict";let t,n,r;i.d(s,{m:function(){return G}});var a=i(651),l=i(24667),d=i(89448),h=i(92379),c=i(68245),o=i(93721),u=i(64290),k=i(97616),p=i(53664),x=i(52466),E=i(88279);function g({onFocus:e}){let s;let[i,t]=(0,h.useState)(!0),n=(s=(0,h.useRef)(!1),(0,u.e)(()=>(s.current=!0,()=>{s.current=!1}),[]),s);return i?h.createElement(E._,{as:"button",type:"button",features:E.x.Focusable,onFocus:s=>{s.preventDefault();let i,r=50;i=requestAnimationFrame(function s(){if(r--<=0){i&&cancelAnimationFrame(i);return}if(e()){if(cancelAnimationFrame(i),!n.current)return;t(!1);return}i=requestAnimationFrame(s)})}}):null}var j=i(92717),f=i(46289),y=i(72613),b=i(38483),m=i(24933);let v=h.createContext(null);function F({children:e}){let s=h.useRef({groups:new Map,get(e,s){var i;let t=this.groups.get(e);t||(t=new Map,this.groups.set(e,t));let n=null!=(i=t.get(s))?i:0;return t.set(s,n+1),[Array.from(t.keys()).indexOf(s),function(){let e=t.get(s);e>1?t.set(s,e-1):t.delete(s)}]}});return h.createElement(v.Provider,{value:s},e)}function w(e){let s=h.useContext(v);if(!s)throw Error("You must wrap your component in a <StableCollection>");let i=h.useId(),[t,n]=s.current.get(e,i);return h.useEffect(()=>n,[]),t}var C=i(88363),A=((t=A||{})[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t),T=((n=T||{})[n.Less=-1]="Less",n[n.Equal=0]="Equal",n[n.Greater=1]="Greater",n),S=((r=S||{})[r.SetSelectedIndex=0]="SetSelectedIndex",r[r.RegisterTab=1]="RegisterTab",r[r.UnregisterTab=2]="UnregisterTab",r[r.RegisterPanel=3]="RegisterPanel",r[r.UnregisterPanel=4]="UnregisterPanel",r);let _={0(e,s){var i;let t=(0,j.z2)(e.tabs,e=>e.current),n=(0,j.z2)(e.panels,e=>e.current),r=t.filter(e=>{var s;return!(null!=(s=e.current)&&s.hasAttribute("disabled"))}),a={...e,tabs:t,panels:n};if(s.index<0||s.index>t.length-1){let i=(0,f.E)(Math.sign(s.index-e.selectedIndex),{[-1]:()=>1,0:()=>(0,f.E)(Math.sign(s.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(0===r.length)return a;let n=(0,f.E)(i,{0:()=>t.indexOf(r[0]),1:()=>t.indexOf(r[r.length-1])});return{...a,selectedIndex:-1===n?e.selectedIndex:n}}let l=t.slice(0,s.index),d=[...t.slice(s.index),...l].find(e=>r.includes(e));if(!d)return a;let h=null!=(i=t.indexOf(d))?i:e.selectedIndex;return -1===h&&(h=e.selectedIndex),{...a,selectedIndex:h}},1(e,s){if(e.tabs.includes(s.tab))return e;let i=e.tabs[e.selectedIndex],t=(0,j.z2)([...e.tabs,s.tab],e=>e.current),n=e.selectedIndex;return e.info.current.isControlled||-1===(n=t.indexOf(i))&&(n=e.selectedIndex),{...e,tabs:t,selectedIndex:n}},2:(e,s)=>({...e,tabs:e.tabs.filter(e=>e!==s.tab)}),3:(e,s)=>e.panels.includes(s.panel)?e:{...e,panels:(0,j.z2)([...e.panels,s.panel],e=>e.current)},4:(e,s)=>({...e,panels:e.panels.filter(e=>e!==s.panel)})},I=(0,h.createContext)(null);function P(e){let s=(0,h.useContext)(I);if(null===s){let s=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,P),s}return s}I.displayName="TabsDataContext";let D=(0,h.createContext)(null);function N(e){let s=(0,h.useContext)(D);if(null===s){let s=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,N),s}return s}function R(e,s){return(0,f.E)(s.type,_,e,s)}D.displayName="TabsActionsContext";let B=m.VN.RenderStrategy|m.VN.Static,O=(0,m.yV)(function(e,s){var i,t;let n=(0,h.useId)(),{id:r=`headlessui-tabs-tab-${n}`,disabled:a=!1,autoFocus:k=!1,...E}=e,{orientation:g,activation:v,selectedIndex:F,tabs:A,panels:T}=P("Tab"),S=N("Tab"),_=P("Tab"),[I,D]=(0,h.useState)(null),R=(0,h.useRef)(null),B=(0,x.T)(R,s,D);(0,u.e)(()=>S.registerTab(R),[S,R]);let O=w("tabs"),L=A.indexOf(R);-1===L&&(L=O);let z=L===F,M=(0,o.z)(e=>{var s;let i=e();if(i===j.fE.Success&&"auto"===v){let e=null==(s=(0,b.r)(R))?void 0:s.activeElement,i=_.tabs.findIndex(s=>s.current===e);-1!==i&&S.change(i)}return i}),U=(0,o.z)(e=>{let s=A.map(e=>e.current).filter(Boolean);if(e.key===C.R.Space||e.key===C.R.Enter){e.preventDefault(),e.stopPropagation(),S.change(L);return}switch(e.key){case C.R.Home:case C.R.PageUp:return e.preventDefault(),e.stopPropagation(),M(()=>(0,j.jA)(s,j.TO.First));case C.R.End:case C.R.PageDown:return e.preventDefault(),e.stopPropagation(),M(()=>(0,j.jA)(s,j.TO.Last))}if(M(()=>(0,f.E)(g,{vertical:()=>e.key===C.R.ArrowUp?(0,j.jA)(s,j.TO.Previous|j.TO.WrapAround):e.key===C.R.ArrowDown?(0,j.jA)(s,j.TO.Next|j.TO.WrapAround):j.fE.Error,horizontal:()=>e.key===C.R.ArrowLeft?(0,j.jA)(s,j.TO.Previous|j.TO.WrapAround):e.key===C.R.ArrowRight?(0,j.jA)(s,j.TO.Next|j.TO.WrapAround):j.fE.Error}))===j.fE.Success)return e.preventDefault()}),K=(0,h.useRef)(!1),V=(0,o.z)(()=>{var e;K.current||(K.current=!0,null==(e=R.current)||e.focus({preventScroll:!0}),S.change(L),(0,y.Y)(()=>{K.current=!1}))}),Q=(0,o.z)(e=>{e.preventDefault()}),{isFocusVisible:q,focusProps:G}=(0,l.F)({autoFocus:k}),{isHovered:H,hoverProps:$}=(0,d.X)({isDisabled:a}),{pressed:W,pressProps:X}=(0,c.x)({disabled:a}),Z=(0,h.useMemo)(()=>({selected:z,hover:H,active:W,focus:q,autofocus:k,disabled:a}),[z,H,q,W,k,a]),Y=(0,m.dG)({ref:B,onKeyDown:U,onMouseDown:Q,onClick:V,id:r,role:"tab",type:(0,p.f)(e,I),"aria-controls":null==(t=null==(i=T[L])?void 0:i.current)?void 0:t.id,"aria-selected":z,tabIndex:z?0:-1,disabled:a||void 0,autoFocus:k},G,$,X);return(0,m.L6)()({ourProps:Y,theirProps:E,slot:Z,defaultTag:"button",name:"Tabs.Tab"})}),L=(0,m.yV)(function(e,s){let{defaultIndex:i=0,vertical:t=!1,manual:n=!1,onChange:r,selectedIndex:a=null,...l}=e,d=t?"vertical":"horizontal",c=n?"manual":"auto",p=null!==a,E=(0,k.E)({isControlled:p}),f=(0,x.T)(s),[y,b]=(0,h.useReducer)(R,{info:E,selectedIndex:null!=a?a:i,tabs:[],panels:[]}),v=(0,h.useMemo)(()=>({selectedIndex:y.selectedIndex}),[y.selectedIndex]),w=(0,k.E)(r||(()=>{})),C=(0,k.E)(y.tabs),A=(0,h.useMemo)(()=>({orientation:d,activation:c,...y}),[d,c,y]),T=(0,o.z)(e=>(b({type:1,tab:e}),()=>b({type:2,tab:e}))),S=(0,o.z)(e=>(b({type:3,panel:e}),()=>b({type:4,panel:e}))),_=(0,o.z)(e=>{P.current!==e&&w.current(e),p||b({type:0,index:e})}),P=(0,k.E)(p?e.selectedIndex:y.selectedIndex),N=(0,h.useMemo)(()=>({registerTab:T,registerPanel:S,change:_}),[]);(0,u.e)(()=>{b({type:0,index:null!=a?a:i})},[a]),(0,u.e)(()=>{if(void 0===P.current||y.tabs.length<=0)return;let e=(0,j.z2)(y.tabs,e=>e.current);e.some((e,s)=>y.tabs[s]!==e)&&_(e.indexOf(y.tabs[P.current]))});let B=(0,m.L6)();return h.createElement(F,null,h.createElement(D.Provider,{value:N},h.createElement(I.Provider,{value:A},A.tabs.length<=0&&h.createElement(g,{onFocus:()=>{var e,s;for(let i of C.current)if((null==(e=i.current)?void 0:e.tabIndex)===0)return null==(s=i.current)||s.focus(),!0;return!1}}),B({ourProps:{ref:f},theirProps:l,slot:v,defaultTag:"div",name:"Tabs"}))))}),z=(0,m.yV)(function(e,s){let{orientation:i,selectedIndex:t}=P("Tab.List"),n=(0,x.T)(s),r=(0,h.useMemo)(()=>({selectedIndex:t}),[t]);return(0,m.L6)()({ourProps:{ref:n,role:"tablist","aria-orientation":i},theirProps:e,slot:r,defaultTag:"div",name:"Tabs.List"})}),M=(0,m.yV)(function(e,s){let{selectedIndex:i}=P("Tab.Panels"),t=(0,x.T)(s),n=(0,h.useMemo)(()=>({selectedIndex:i}),[i]);return(0,m.L6)()({ourProps:{ref:t},theirProps:e,slot:n,defaultTag:"div",name:"Tabs.Panels"})}),U=(0,m.yV)(function(e,s){var i,t,n,r;let a=(0,h.useId)(),{id:d=`headlessui-tabs-panel-${a}`,tabIndex:c=0,...o}=e,{selectedIndex:k,tabs:p,panels:g}=P("Tab.Panel"),j=N("Tab.Panel"),f=(0,h.useRef)(null),y=(0,x.T)(f,s);(0,u.e)(()=>j.registerPanel(f),[j,f]);let b=w("panels"),v=g.indexOf(f);-1===v&&(v=b);let F=v===k,{isFocusVisible:C,focusProps:A}=(0,l.F)(),T=(0,h.useMemo)(()=>({selected:F,focus:C}),[F,C]),S=(0,m.dG)({ref:y,id:d,role:"tabpanel","aria-labelledby":null==(t=null==(i=p[v])?void 0:i.current)?void 0:t.id,tabIndex:F?c:-1},A),_=(0,m.L6)();return F||null!=(n=o.unmount)&&!n||null!=(r=o.static)&&r?_({ourProps:S,theirProps:o,slot:T,defaultTag:"div",features:B,visible:F,name:"Tabs.Panel"}):h.createElement(E._,{"aria-hidden":"true",...S})}),K=Object.assign(O,{Group:L,List:z,Panels:M,Panel:U});var V=i(69577);function Q(e){return!!e&&"object"==typeof e&&"label"in e}function q({items:e,selectedIndex:s,defaultIndex:i=0,onChange:t,children:n,storageKey:r}){let[l,d]=(0,h.useState)(i);(0,h.useEffect)(()=>{void 0!==s&&d(s)},[s]),(0,h.useEffect)(()=>{if(!r)return;function e(e){e.key===r&&d(Number(e.newValue))}let s=Number(localStorage.getItem(r));return d(Number.isNaN(s)?0:s),window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[]);let c=(0,h.useCallback)(e=>{if(r){let s=String(e);localStorage.setItem(r,s),window.dispatchEvent(new StorageEvent("storage",{key:r,newValue:s}));return}d(e),t?.(e)},[]);return(0,a.jsxs)(L,{selectedIndex:l,defaultIndex:i,onChange:c,tabIndex:-1,children:[(0,a.jsx)(z,{className:(0,V.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","nextra-focus"),children:e.map((e,s)=>(0,a.jsx)(K,{disabled:Q(e)&&e.disabled,className:({selected:e,disabled:s,hover:i,focus:t})=>(0,V.Z)(t&&"nextra-focusable _ring-inset",e&&"_outline-none","_whitespace-nowrap","_rounded-t _p-2 _font-medium _leading-5 _transition-colors","_-mb-0.5 _select-none _border-b-2",e?"_border-current":i?"_border-gray-200 dark:_border-neutral-800":"_border-transparent",e?"_text-primary-600":s?"_text-gray-400 dark:_text-neutral-600 _pointer-events-none":i?"_text-black dark:_text-white":"_text-gray-600 dark:_text-gray-200"),children:Q(e)?e.label:e},s))}),(0,a.jsx)(M,{children:n})]})}let G=Object.assign(e=>(0,a.jsx)(q,{...e}),{Tab:function({children:e,unmount:s=!1,...i}){return(0,a.jsx)(U,{...i,unmount:s,className:({focus:e})=>(0,V.Z)("_rounded _mt-6",e&&"nextra-focusable"),children:e})}})}},function(e){e.O(0,[74139,21461,92888,49774,40179],function(){return e(e.s=91750)}),_N_E=e.O()}]);