1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[229],{76931:(e,r,t)=>{Promise.resolve().then(t.bind(t,47132)),Promise.resolve().then(t.bind(t,31256))},47132:(e,r,t)=>{"use strict";t.d(r,{default:()=>d});var n=t(1570),u=t(40564),l=t(47149),a=t(63446),i=t(32513);let c="shibuya-admin-return";function o(e){return e&&/^\/admin(?:\/[a-z0-9-]+)*$/.test(e)?e:null}function s(){try{return o(sessionStorage.getItem(c))}catch(e){return null}}function f(e){try{e?sessionStorage.setItem(c,e):sessionStorage.removeItem(c)}catch(e){}}function d(e){let{children:r}=e,{ready:t,authenticated:c,user:d,getAccessToken:h}=(0,n.F)(),v=(0,l.usePathname)(),m=(0,l.useRouter)(),p=!!o(v),g=c?null==d?void 0:d.id:void 0,[w,y]=(0,a.useState)(null),_=(0,a.useRef)(null),b=(0,a.useRef)(!1),E=(0,a.useRef)(!1),{login:k}=(0,u.u)({onError:e=>{"exited_auth_flow"===e&&(_.current=null,f(null))}});return((0,a.useEffect)(()=>{var e,r;if(!t)return;let n=!1,u=E.current&&!c;if(E.current=c,!c){if(y(null),u){_.current=null,f(null),b.current=!1,p&&m.replace("/");return}p?(_.current=v,f(v),b.current=!1,m.replace("/")):"/"===v&&!b.current&&(null!==(e=_.current)&&void 0!==e||(_.current=s()),_.current&&(b.current=!0,k()));return}if(!g)return;let l=p?v:"/"===v?null!==(r=_.current)&&void 0!==r?r:s():null;if(l)return y(null),(async()=>{try{let e=await h();if(n)return;if(!e)throw Error("Missing access token");let r=await fetch("/api/live/admin/me",{headers:{Authorization:"Bearer ".concat(e)},cache:"no-store"});if(!r.ok)throw Error("Unable to verify admin access");let t=await r.json();if(n)return;_.current=null,f(null),!0===t.admin?(y({actor:g,path:l}),p||m.replace(l)):p&&m.replace("/")}catch(e){if(n)return;_.current=null,f(null),i.toast.error("Could not verify admin access. Please try again."),p&&m.replace("/")}})(),()=>{n=!0}},[t,c,g,v,p,h,k,m]),!p||t&&c&&g&&(null==w?void 0:w.actor)===g&&w.path===v)?r:null}},40564:(e,r,t)=>{"use strict";t.d(r,{u:()=>a});var n=t(63446),u=t(1570),l=t(56316);function a(e){let{login:r}=(0,n.useContext)(u.P);return(0,u.b)("login",e),{login:r}}(0,l.v)(()=>({isModalOpen:!1,resolvers:null})),(0,l.v)(()=>({}))}},e=>{var r=r=>e(e.s=r);e.O(0,[3623,2315,3431,7021,2266,9944,7656,521,9255,2513,2625,3105,7270,1900,6460,382,451,7358],()=>r(76931)),_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.