1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3018],{13891:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>o});var i=t(37876),s=t(14232),r=t(68451),c=t(89099);function o(){let{isLoaded:e,userId:n,isSignedIn:t}=(0,r.d)(),[o,a]=(0,s.useState)("initializing"),l=(0,c.useRouter)();return(0,s.useEffect)(()=>{(async function(){if(e)try{if(!t){a("redirecting-to-signin"),l.push("/");return}a("generating-token");let e=await fetch("/api/auth/extension-token",{method:"POST",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("Failed to generate token");let{token:n}=await e.json();a("sending-token"),window.postMessage({type:"BRANCHPROMPT_AUTH_TOKEN",token:n},"*"),a("success"),setTimeout(()=>{window.close()},2e3)}catch(e){console.error("Auth error:",e),a("error")}})()},[e,t,n,l]),(0,i.jsx)("div",{className:"min-h-screen bg-zinc-50 flex items-center justify-center",children:(0,i.jsxs)("div",{className:"max-w-md w-full p-8 bg-white rounded-lg shadow-sm",children:[(0,i.jsx)("h1",{className:"text-2xl font-semibold text-zinc-900 mb-4",children:"BranchPrompt Extension Auth"}),"initializing"===o&&(0,i.jsx)("p",{className:"text-zinc-600",children:"Initializing authentication..."}),"redirecting-to-signin"===o&&(0,i.jsx)("p",{className:"text-zinc-600",children:"Redirecting to sign in..."}),"generating-token"===o&&(0,i.jsx)("p",{className:"text-zinc-600",children:"Generating secure token..."}),"sending-token"===o&&(0,i.jsx)("p",{className:"text-zinc-600",children:"Connecting to extension..."}),"success"===o&&(0,i.jsxs)("div",{className:"text-emerald-600",children:[(0,i.jsx)("p",{children:"â Successfully connected!"}),(0,i.jsx)("p",{className:"text-sm mt-2",children:"This window will close automatically."})]}),"error"===o&&(0,i.jsxs)("div",{className:"text-red-600",children:[(0,i.jsx)("p",{children:"Failed to connect extension."}),(0,i.jsx)("button",{onClick:()=>window.location.reload(),className:"mt-4 px-4 py-2 bg-zinc-900 text-white rounded-md hover:bg-zinc-800",children:"Try Again"})]}),(0,i.jsx)("div",{className:"mt-6 h-2 bg-zinc-100 rounded-full overflow-hidden",children:(0,i.jsx)("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:"success"===o?"100%":"error"===o?"100%":"sending-token"===o?"75%":"generating-token"===o?"50%":"redirecting-to-signin"===o?"25%":"10%"}})})]})})}},31372:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/extension-auth",function(){return t(13891)}])},68451:(e,n,t)=>{"use strict";t.d(n,{d:()=>a});var i=t(79984),s=t(70925),r=t(34824),c=t(14232);let o=c.createContext(null);function a(e={}){let n=(0,r.useRouter)(),t=c.useContext(o),l=t;return(t&&"then"in t&&(l=c.use(t)),"undefined"!=typeof window)?(0,i.As)({...l,...e}):n?(0,i.As)(e):(0,s.hP)({...l,...e})}}},e=>{var n=n=>e(e.s=n);e.O(0,[636,6593,8792],()=>n(31372)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.