1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3126],{53126:function(e,l,t){t.r(l),t.d(l,{SearchAvailableRoomForm:function(){return O}});var o=t(57437),r=t(13976),i=t(35633),a=t(56655),n=t(8878),s=t(93448),d=t(24589),u=t(81778),c=t(87446),m=t(68661),v=t(87578),h=t(98012),x=t(51570),p=t(88880),f=t(2265),g=t(29501),b=t(91990),y=t(72903),N=t(12871),j=t(16078),w=t(12108),_=t(99376),C=t(26332),k=t(9628),I=t(28140),E=t(61),S=t(81951),T=t(87918),M=t(9210),U=t(99245),B=t(42586);let L=()=>{let{Spinner:e}=N.iconList;return(0,o.jsx)(e,{className:"m-auto mt-5 h-10 w-10 animate-spin text-gray-200 dark:text-gray-600",fill:"var(--fill-gray-stronger)"})},O=e=>{var l,t,N,O;let{className:D,phone:z,timings:R,isTopPage:A=!1,hotelOrCity:P,hotelId:W,isHiddenMobile:X,promoCode:F,initial_adult_count:Z,forceLocaleSepcificData:$=!1,...V}=e,[K,H]=(0,f.useState)(!1),Q=(0,_.usePathname)(),Y=(0,_.useParams)(),{japanAreas:q,loading:J,allLocaleHotels:G,locale:ee,fetchAreas:el}=(0,d.Z)(),{configurations:et,configurationsLocale:eo,fetchConfigurationsData:er,setFilterRoomModalState:ei}=(0,u.Z)(),{oneTimeToken:ea}=(0,U.l)(),{configurations:en,rooms_configurations:es,booking:ed,ages_configurations:eu,tripla_section:ec}=(0,j.q5)(et,Y)||{},{checkin_label:em,checkout_label:ev,promo_code_label:eh,promo_code_placeholder:ex}=en??{},{adult_label:ep,children_label:ef,maximum_adults:eg,maximum_child_age:eb,maximum_children:ey,maximum_rooms:eN,single_room_label:ej,default_adult_count:ew}=es??{},{tripla_add_room_label:e_,tripla_age_label:eC,tripla_apply_label:ek,tripla_bed_label:eI,tripla_child_label:eE,tripla_room_adults_label:eS,tripla_room_children_label:eT,tripla_room_name_label:eM,tripla_with_bed_label:eU,tripla_without_bed_label:eB,tripla_age_placeholder:eL,tripla_invalid_age_error:eO}=ec??{},{booking_button_text:eD}=ed??{},{age_placeholder:ez}=eu??{},[eR,eA]=(0,f.useState)(!1),[eP,eW]=(0,f.useState)({from:new Date(r.hB),to:new Date(r.c1)}),[eX,eF]=(0,f.useState)(""),[eZ,e$]=(0,f.useState)({from:new Date(r.hB),to:new Date(r.c1)}),{setFormData:eV,formData:eK}=(0,u.Z)(),eH=(null===(l=(0,m.WO)(Q))||void 0===l?void 0:l.split("/"))||[],eQ=null==eH?void 0:eH[((null==eH?void 0:eH.length)??0)-1],eY=eg?Number(eg):C.FR.MAXIMUM_ADULTS_LIMIT,eq=ey?Number(ey):C.FR.MAXIMUM_CHILDREN_LIMIT,eJ=eN?Number(eN):C.FR.MAXIMUM_ROOMS_LIMIT,eG=(0,m.Uc)(Number(eb),eL||void 0)||r.WT,e0=f.useMemo(()=>(0,m.Yu)(q,G,void 0,"ã¨ãªã¢","ããã«"),[G,q]),e1=f.useMemo(()=>{if(!W)return P??null;for(let e of e0)if(e.options){let l=e.options.find(e=>e.value===W);if(l)return l}return P??null},[W,P,e0]),e3=f.useMemo(()=>{var e,l,t;let{checkIn:o,checkOut:i}=(0,m.Vp)(null==eK?void 0:eK.checkIn,r.hB,null==eK?void 0:eK.checkout,r.c1);return{hotelOrCity:(null==eK?void 0:eK.hotelOrCity)||e1,checkIn:(0,m.UX)(o,r.hB),checkout:(0,m.UX)(i,r.c1),adults:Number(Z)||Number(ew)||(null==eK?void 0:null===(l=eK.rooms)||void 0===l?void 0:null===(e=l[0])||void 0===e?void 0:e.adults)||r.Ky,promoCode:(null==eK?void 0:eK.promoCode)?null==eK?void 0:eK.promoCode:F||"",rooms:(null==eK?void 0:eK.rooms)&&(null==eK?void 0:null===(t=eK.rooms)||void 0===t?void 0:t.length)>0?eK.rooms:[{adults:Number(Z)||Number(ew)||Number(r.Ky),children:[]}]}},[A,eK,ew,Z,F]);(0,f.useEffect)(()=>{let{checkIn:e,checkOut:l}=(0,m.Vp)(null==eK?void 0:eK.checkIn,r.hB,null==eK?void 0:eK.checkout,r.c1);eW({from:(0,m.UX)(e,r.hB),to:(0,m.UX)(l,r.c1)})},[]);let e2=(0,g.cI)({defaultValues:e3,resolver:(0,v.Y)(y._2)}),{handleSubmit:e8,control:e5,formState:e9,watch:e6,setValue:e4,reset:e7,getValues:le}=e2,ll=e6("rooms"),lt=(0,B.useLocale)(),lo=f.useMemo(()=>$?[!1,lt]:[void 0,void 0],[$,lt]),lr=$?lt:n.ZW;(0,f.useEffect)(()=>{eo!==lr&&er(lr,...lo)},[eo,er,lo,lr]),(0,f.useEffect)(()=>{(ee!==lr||0===q.length)&&el(lr,!1,...lo)},[el,q.length,ee,lo,lr]);let li=(null==ll?void 0:null===(t=ll[0])||void 0===t?void 0:t.adults)||Number(Z)||Number(ew)||Number(r.Ky),la=(null==ll?void 0:null===(O=ll[0])||void 0===O?void 0:null===(N=O.children)||void 0===N?void 0:N.length)||0,{isOpen:ln,toggleModal:ls}=(0,a.d)(),ld=li<eY,lu=li>1,lc=la<eq,lm=la>0,lv=async e=>{try{var l,t,o,a,s,d,u;if(eA(!0),H(!1),!e.hotelOrCity){H(!0);return}if(eV(e),(null===(l=e.hotelOrCity)||void 0===l?void 0:l.type)==="city"){let l=(null===(o=q||[])||void 0===o?void 0:null===(t=o.find(l=>{var t,o;return(null==l?void 0:null===(t=l.area_name)||void 0===t?void 0:t.toLowerCase())===(null==e?void 0:null===(o=e.hotelOrCity)||void 0===o?void 0:o.label.toLowerCase())}))||void 0===t?void 0:t.slug_hotel)||"",r=`${globalThis.location.origin}/${lt}/${l}`;window.open(r,"_blank")}else{let l=await fetch("/api/tripla/access-token"),t=await (null==l?void 0:l.json())??{},o=(null==t?void 0:t.one_time_access_token)??"",v=(0,C.K8)(e,{type:c.uE.ROOMS,is_day_use:!1,order:c.nm.RECOMMENDED,is_including_occupied:!1,locale:n.b0[lt],coupon_code:(null==e?void 0:e.promoCode)||"",...o&&{one_time_access_token:o}}),h=(null===(a=e.hotelOrCity)||void 0===a?void 0:a.externalUrl)||(null===(s=e.hotelOrCity)||void 0===s?void 0:s.slug),x=null===(d=e.hotelOrCity)||void 0===d?void 0:d.useTripla,p=(null===i.di||void 0===i.di?void 0:i.di.length)&&(null==v?void 0:null===(u=v.code)||void 0===u?void 0:u.length);x&&p?(0,m.fO)({...v,checkin:(null==v?void 0:v.checkin)||r.hB,checkout:(null==v?void 0:v.checkout)||r.c1,children:null==v?void 0:v.children,kids_ages:null==v?void 0:v.kids_ages,locale:n.b0[lt]},!1):h&&window.open(h,"_blank")}}catch{console.log("error while searching available rooms")}finally{eA(!1)}};(0,f.useEffect)(()=>{let e=e0.find(e=>"ããã«"===e.label),l=null==e?void 0:e.options.find(e=>e.slug===eQ);l&&!A?e7({...e3,hotelOrCity:l}):e7({...e3,hotelOrCity:null})},[Q,q,e0]),f.useEffect(()=>{var e,l;let t=le("promoCode");e7({...e3,hotelOrCity:le("hotelOrCity"),promoCode:t??e3.promoCode});let{checkIn:o,checkOut:i}=(0,m.Vp)(null==eK?void 0:eK.checkIn,r.hB,null==eK?void 0:eK.checkout,r.c1);(null==eK?void 0:eK.checkIn)&&(null==eK?void 0:eK.checkout)&&(null==eP?void 0:eP.from)&&(null==eP?void 0:eP.to)&&((null===(e=eP.from)||void 0===e?void 0:e.getTime())!==o.getTime()||(null===(l=eP.to)||void 0===l?void 0:l.getTime())!==i.getTime())&&eW({from:(0,m.UX)(o,r.hB),to:(0,m.UX)(i,r.c1)})},[e3,e7]);let lh=null==ll?void 0:ll.some(e=>{var l;return null==e?void 0:null===(l=e.children)||void 0===l?void 0:l.some(e=>{var l;return(null==e?void 0:null===(l=e.age)||void 0===l?void 0:l.value)===-1})});return(0,o.jsxs)("div",{className:(0,s.cn)("relative w-[790px] rounded-lg p-6 py-[24px] shadow-[0px_3px_10px_rgba(0,0,0,0.161)] before:absolute before:inset-0 before:-z-10 before:rounded-lg before:bg-white before:opacity-50 before:transition-opacity hover:before:opacity-75",z&&"pb-3",D),...V,children:[(0,o.jsx)(g.RV,{...e2,children:(0,o.jsxs)("form",{className:"flex w-full gap-3",onSubmit:e8(lv),children:[(0,o.jsxs)("div",{className:"flex w-full flex-col gap-3",children:[(0,o.jsxs)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[(0,o.jsxs)("div",{className:"relative flex flex-col gap-1",children:[(0,o.jsx)("div",{className:"text-[13px] font-[var(--font-semibold)] text-[var(--text-base-primary)]",children:"ã¨ãªã¢åï¼ããã«å"}),(0,o.jsx)(g.Qr,{name:"hotelOrCity",control:e5,render:e=>{var l,t,i,a,n;let{field:s}=e;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(I.A,{value:s.value,options:e0,onChange:e=>{s.onChange(e),ei(u.y.SUBMITED),K&&H(!1);let l=!!(null==eK?void 0:eK.rooms)&&eK.rooms.length>0;
1if(l)e4("rooms",eK.rooms);else if((null==e?void 0:e.type)==="hotel"){let l=Number(null==e?void 0:e.initial_adult_count)||Number(Z)||Number(ew)||Number(r.Ky),t=(0,C.kP)([...ll]);t[0]&&(t[0]={...t[0],adults:l}),e4("rooms",t)}else if(!l&&(null==e?void 0:e.type)==="city"){let e=Number(ew)||Number(r.Ky),l=(0,C.kP)([...ll]);l[0]&&(l[0]={...l[0],adults:e}),e4("rooms",l)}},onFocus:()=>{K&&H(!1)},onInputChange:eF,inputValue:eX,showAllButton:(null==eX?void 0:eX.length)>0,onShowAll:()=>{eF("")},placeholder:"ã¨ãªã¢åï¼ããã«åãå
¥åãã¦ãã ãã",loadingMessage:L,isLoading:J,error:null===(t=e9.errors.hotelOrCity)||void 0===t?void 0:null===(l=t.value)||void 0===l?void 0:l.message,className:"w-full",size:"md",iconCustom:(0,o.jsx)(h.Z,{strokeWidth:1,width:18,height:18,className:"text-[#7F8498]"}),filterOption:(e,l)=>(0,m.xD)({label:e.label,data:e.data},l),styles:{control:e=>{var l,t;return{...e,paddingLeft:"12px",paddingRight:"12px",padding:"8px",fontSize:"13px",borderRadius:"var(--radius-input-md)",borderEndStartRadius:(null===(l=s.value)||void 0===l?void 0:l.type)==="hotel"?"0px":"var(--radius-input-md)",borderEndEndRadius:(null===(t=s.value)||void 0===t?void 0:t.type)==="hotel"?"0px":"var(--radius-input-md)",maxHeight:"43px",cursor:"text","&:hover":{borderColor:K&&!s.value?"var(--fill-red-solid-normal)":e.borderColor},borderColor:K&&!s.value?"var(--fill-red-solid-normal)":e.borderColor,borderWidth:K&&!s.value?"2px":"1px"}},placeholder:e=>({...e,fontSize:"12px",color:"var(--text-base-primary)",opacity:.6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),singleValue:e=>({...e,fontSize:"13px",color:"var(--text-gray-stronger)"}),option:e=>({...e,fontSize:"13px",color:"var(--text-gray-stronger)",cursor:"pointer"}),groupHeading:e=>({...e,fontSize:"14px",fontWeight:"bold",color:"var(--text-gray-stronger)",padding:"8px 12px"})}}),(null===(i=s.value)||void 0===i?void 0:i.type)==="hotel"&&(null===(a=s.value)||void 0===a?void 0:a.slug)!=eQ&&(0,o.jsx)("div",{className:"absolute -bottom-6 z-10 w-full rounded-b-md border border-gray-300 bg-white p-1.5 shadow-md",children:(0,o.jsx)(k.r,{href:`${globalThis.location.origin}/${lt}/${null===(n=q.flatMap(e=>e.hotels).find(e=>{var l;return(null==e?void 0:e.item_name)===(null===(l=s.value)||void 0===l?void 0:l.hotelItemName)}))||void 0===n?void 0:n.slug}`,target:"_blank",className:"flex items-center justify-center text-xs font-semibold text-[#FFB100] hover:underline",children:"ãã®ããã«ã®åçã»è©³ç´°ãè¦ã"})})]})}})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,o.jsxs)("div",{className:"text-[13px] font-[var(--font-semibold)] text-[var(--text-base-primary)]",children:[em," - ",ev]}),(0,o.jsx)(T.D,{range:eP,onChange:(e,l)=>{eP.from&&eP.to&&(e$({from:eP.from,to:eP.to}),eV({...eK,checkIn:(0,m.jU)(eP.from,r.hB),checkout:(0,m.jU)(eP.to,r.c1)})),e&&(eW(t=>t.from&&t.to?{from:l}:e),e.from&&e4("checkIn",e.from),e.to&&e4("checkout",e.to)),l||eW(e||{from:new Date(r.hB),to:new Date(r.c1)}),ei(u.y.SUBMITED)},onCancel:()=>{eW(eZ)},children:(0,o.jsxs)(E.zx,{hierarchy:"outline",variant:"neutral",type:"button",size:"xl",className:"flex max-h-[43px] w-full items-center justify-around rounded-md border border-gray-300 px-3 py-2 text-[13px] font-medium text-[var(--text-base-primary)]",children:[(0,o.jsx)("span",{children:(null==eP?void 0:eP.from)?(0,w.WU)(eP.from,r.sZ):""}),(0,o.jsx)("span",{className:"mx-2",children:"â"}),(0,o.jsx)("span",{children:(null==eP?void 0:eP.to)?(0,w.WU)(eP.to,r.sZ):""})]})})]})]}),(0,o.jsxs)("div",{className:"mt-3 grid grid-cols-1 gap-3 text-[var(--text-base-primary)] sm:grid-cols-2 md:grid-cols-5",children:[(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsx)("div",{className:"text-[13px] font-[var(--font-semibold)] text-[var(--text-base-primary)]",children:ep}),(0,o.jsxs)("div",{className:"mt-auto mb-1 flex items-center",children:[(0,o.jsx)(E.zx,{hierarchy:lu?"filled":"outline",type:"button",className:"flex h-9 w-9 items-center justify-center rounded-md border-none",onClick:()=>{if((null==ll?void 0:ll[0])&&lu){let e=(0,C.kP)([...ll]);e[0]&&(e[0].adults-=1,e[0]={adults:e[0].adults,children:e[0].children}),e4("rooms",e),eV({...eK,rooms:e}),ei(u.y.SUBMITED)}},children:(0,o.jsx)("span",{className:"text-xl",children:"-"})}),(0,o.jsx)("div",{className:"mx-2 w-5 text-center",children:li}),(0,o.jsx)(E.zx,{hierarchy:ld?"filled":"outline",type:"button",className:"flex h-9 w-9 items-center justify-center rounded-md border-none",onClick:()=>
1{if((null==ll?void 0:ll[0])&&ld){let e=(0,C.kP)([...ll]);e[0]||(e[0]={adults:0,children:[]}),e[0]={...e[0],adults:(e[0].adults||0)+1},e4("rooms",e),eV({...eK,rooms:e}),ei(u.y.SUBMITED)}},children:(0,o.jsx)("span",{className:"text-xl",children:"+"})})]})]}),(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsx)("div",{className:"text-[13px] font-[var(--font-semibold)] text-[var(--text-base-primary)]",children:ef}),(0,o.jsxs)("div",{className:"mt-auto mb-1 flex items-center",children:[(0,o.jsx)(E.zx,{hierarchy:lm?"filled":"outline",type:"button",className:"flex h-9 w-9 items-center justify-center rounded-md border-none",onClick:()=>{if((null==ll?void 0:ll[0])&&lm){let e=(0,C.kP)([...ll]),l=e[0];if((null==l?void 0:l.children)&&(null==l?void 0:l.children.length)>0){let e=[...l.children];e.pop(),l.children=e}e4("rooms",e),eV({...eK,rooms:e}),ei(u.y.SUBMITED)}},children:(0,o.jsx)("span",{className:"text-xl",children:"-"})}),(0,o.jsx)("div",{className:"mx-2 w-5 text-center",children:la}),(0,o.jsx)(E.zx,{hierarchy:lc?"filled":"outline",type:"button",className:"flex h-9 w-9 items-center justify-center rounded-md border-none",onClick:()=>{if((null==ll?void 0:ll[0])&&lc){let e=(0,C.kP)([...ll]),l=e[0];l||(l={adults:Number(r.Ky),children:[]},e[0]=l);let t=[...l.children||[]];t.push({age:eG[0],isBed:!1}),l.children=t,e4("rooms",e),eV({...eK,rooms:e}),ei(u.y.SUBMITED),ls()}},children:(0,o.jsx)("span",{className:"text-xl",children:"+"})})]})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,o.jsx)("div",{className:"text-[13px] font-[var(--font-semibold)] text-[var(--text-base-primary)]",children:ej}),(0,o.jsx)("div",{className:"mt-auto",children:(0,o.jsx)(g.Qr,{name:"rooms",control:e5,render:e=>{var l;let{field:t}=e,r=(null===(l=t.value)||void 0===l?void 0:l.length)||1;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(E.zx,{variant:"neutral",hierarchy:"outline",size:"xl",type:"button",className:"flex max-h-[43px] w-full items-center justify-between rounded-md border border-gray-300 px-3 py-2 text-[13px] text-[var(--text-base-primary)]",onClick:ls,children:`${r} ${ej||"é¨å±"}`}),(0,o.jsx)(S.u,{open:ln,toggleModal:ls,containerClassName:"rounded-2xl !max-w-[450px] gap-0",closeClassName:"bg-[var(--fill-base-main)] text-white rounded-full opacity-100 p-1.5",header:(0,o.jsx)("div",{className:"border-b border-b-[var(--stroke-gray-light)] px-4 pt-4 pb-3 text-left text-xl leading-8 font-[var(--font-semibold)] text-[var(--text-gray-stronger)]",children:"é¨å±é¸æ"}),footer:(0,o.jsx)("div",{className:"w-full border-t border-t-[var(--stroke-gray-light)] px-4 pt-3 pb-4",children:(0,o.jsx)(E.zx,{variant:"secondary",className:"flex w-full items-center justify-between",size:"lg",type:"button",onClick:ls,disabled:lh,children:(0,o.jsx)("span",{children:ek})})}),children:(0,o.jsx)("div",{className:"max-h-[500px] overflow-y-auto px-4 pt-3 pb-4",children:(0,o.jsx)(b.w,{roomConfiguration:{adultLabel:eS??void 0,childrenLabel:eT??void 0,addRoomButtonText:e_??void 0,maximumAdults:String(eY),maximumChildAge:eb??void 0,maximumChildren:String(eq),maximumRooms:String(eJ),singleRoomLabel:eM??void 0,bedLabel:eI??void 0,withBedLabel:eU??void 0,withoutBedLabel:eB??void 0,default_adult_count:String(li)},AgesConfigurations:{agesLabel:eC??void 0,agePlaceholder:ez??void 0,singleChildLabel:eE??void 0,ageValuePlaceholder:eL??void 0,invalidAgeError:eO??void 0}})})})]})}})})]}),(0,o.jsxs)("div",{className:"col-span-1 flex flex-col gap-1 md:col-span-2",children:[(0,o.jsx)("div",{className:"text-[13px] font-[var(--font-semibold)] text-[var(--text-base-primary)]",children:eh}),(0,o.jsx)(g.Qr,{name:"promoCode",control:e5,render:e=>{let{field:l}=e;return(0,o.jsx)(M.I,{className:"mt-auto max-h-[43px] w-full rounded-md border border-gray-300 bg-white py-[12px] text-[13px] text-[var(--text-base-primary)] placeholder:text-sm",value:l.value||"",size:"lg",onChange:e=>{l.onChange(e),ei(u.y.SUBMITED),eV({...eK,promoCode:e.target.value})},placeholder:ex||""})}})]})]})]}),(0,o.jsx)("div",{className:"mt-auto flex justify-end",children:(0,o.jsxs)(E.zx,{variant:"secondary",size:"xl",type:"submit",loading:eR,className:"flex h-[43px] items-center justify-between gap-3 px-6 text-[13px]",children:[(0,o.jsx)("span",{children:eD}),(0,o.jsx)(x.Z,{strokeWidth:"1px",width:18,height:18})]})})]})}),!X&&z&&(0,o.jsxs)("div",{className:"mt-2 flex items-center justify-center gap-1 text-[var(--text-base-primary)]",children:[(0,o.jsx)(p.Z,{className:"h-4 w-4"}),(0,o.jsx)(k.r,{href:`tel:${z}`,className:"text-inherit no-underline",children:(0,o.jsx)("span",{children:z})}),R&&(0,o.jsxs)("span",{children:["ï¼",R,"ï¼"]})]})]})}},8052:function(e,l,t){t.d(l,{W:function(){return a}});var o=t(47062),r=t(61103);let i=null,a=async()=>{let e=globalThis.location.pathname.split("/")[1]||"ja";return i??(i=await (0,o._A)({domain:(0,r.M)("NEXT_PUBLIC_CLIENT_DOMAIN")??"id.gotopass.jp",clientId:(0,r.M)("NEXT_PUBLIC_AUTH0_CLIENT_ID")??"",authorizationParams:{redirect_uri:void 0===globalThis.window?(0,r.M)("NEXT_PUBLIC_BASE_URL"):globalThis.location.origin,audience:(0,r.M)("NEXT_PUBLIC_AUDIENCE"),entity_type:"STORE_CODE",entity_code:(0,r.M)("NEXT_PUBLIC_ENTITY_CODE"),entity_s
1ource:"API",ui_locales:"en-us"===e?"en":"ja",acquisition_channel:"Mystays Website",screen_hint:"login",response_type:"code",scope:"openid profile email offline_access"},cacheLocation:"localstorage",useRefreshTokens:!0})),i}},98837:function(e,l,t){t.d(l,{aC:function(){return u}});var o=t(8052);let r=(0,t(97160).v)(e=>({user:null,token:null,setUser:l=>e(e=>{e.user=l}),setToken:l=>e(e=>{e.token=l}),clearAuth:()=>e(e=>{e.user=null,e.token=null})}),"auth_store");var i=t(47062),a=t(2265),n=t(61103);let s="gtp_token",d="gtp_user",u=()=>{let{user:e,token:l,setUser:t,setToken:u}=r(),[c,m]=(0,a.useState)(!0),[v,h]=(0,a.useState)();v===i.n5&&i.n5;let[x,p]=(0,a.useState)(),f=e=>{var l;let t=null==e?void 0:null===(l=e.split("."))||void 0===l?void 0:l[1];if(t){let e=JSON.parse(atob(t)),l=Math.floor(Date.now()/1e3);return e.exp<l}return!0},g=async(e,l)=>{try{localStorage.setItem(s,e),localStorage.setItem(d,JSON.stringify(l)),globalThis.dispatchEvent(new Event("gtp_user_changed")),m(!1)}catch(e){console.error("Error fetching rooms:",e)}},b=(0,a.useCallback)(async()=>{try{let e=localStorage.getItem(s)||"";if(!e||f(e)){let e=await (0,o.W)(),l=await (null==e?void 0:e.getUser()),r=await (null==e?void 0:e.getTokenSilently());return await g(r,l),h(l),p(r),u(r),l&&t(l),r}return e}catch(e){return console.error("Error when getting token:",e),null}},[h,p,t,u]);return(0,a.useEffect)(()=>{(async()=>{let e=await (0,o.W)();globalThis.location.search.includes("code=")&&globalThis.location.search.includes("state=")&&(await (null==e?void 0:e.handleRedirectCallback()),globalThis.history.replaceState({},document.title,globalThis.location.pathname)),await (null==e?void 0:e.isAuthenticated())&&await b(),m(!1)})()},[b]),{loading:c,login:async()=>{let e=await (0,o.W)();await (null==e?void 0:e.loginWithRedirect()),m(!1)},logout:async()=>{try{let e=await (0,o.W)();await (null==e?void 0:e.logout({logoutParams:{returnTo:(0,n.M)("NEXT_PUBLIC_BASE_URL")}})),localStorage.setItem(s,""),localStorage.setItem(d,""),u(""),t(null)}catch(e){console.error("Error Logout Goto Pass:",e)}},getToken:b,userStore:e,tokenStore:l}}},99245:function(e,l,t){t.d(l,{l:function(){return i}});var o=t(2265),r=t(98837);function i(){let[e,l]=(0,o.useState)(null),{userStore:t}=(0,r.aC)(),i=(0,o.useCallback)(async()=>t?"":null,[t]);return(0,o.useEffect)(()=>{(async()=>{if(t){let e=await i();e&&l(e)}})()},[t,l,i]),{oneTimeToken:e}}}}]); 2//# sourceMappingURL=3126-52f85f22bf8493ed.js.map
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.