1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1051],{1051:function(e,t,n){n.r(t),n.d(t,{default:function(){return tP}});var i,r,a,o,l,s,c,d,m=n(5893),u=n(9156),g=n(1163),p=n.n(g),h=n(1892),x=n(7294);(i=l||(l={})).SetSelectedOffice="SET_SELECTED_OFFICE",i.SetHero="SET_HERO",i.SetCurrentStep="SET_CURRENT_STEP",i.SetCurrentWeekIndex="SET_CURRENT_WEEK_INDEX",i.SetProximityOffices="SET_PROXIMITY_OFFICES",i.SetBookingInfo="SET_BOOKING_INFO",i.SetTimeSlotsState="SET_TIME_SLOTS_STATE",i.SetMeetingState="SET_MEETING_STATE",i.SetErrorBookingModal="SET_ERROR_BOOKING_MODAL",i.SetFormInfo="SET_FORM_INFO",i.SetAllowedSteps="SET_ALLOWED_STEPS",i.SetBookingDraftPendingSigning="SET_BOOKING_DRAFT_PENDING_SIGNING",i.SetCustomBookingFlow="SET_CUSTOM_BOOKING_FLOW";let f=(e,t)=>{switch(t.type){case"SET_SELECTED_OFFICE":return{...e,selectedOffice:t.payload};case"SET_HERO":return{...e,heroProps:t.payload};case"SET_CURRENT_STEP":return{...e,currentStep:t.payload};case"SET_CURRENT_WEEK_INDEX":return{...e,currentWeekIndex:t.payload};case"SET_PROXIMITY_OFFICES":return{...e,proximityOffices:t.payload};case"SET_BOOKING_INFO":return{...e,bookingInfo:t.payload};case"SET_TIME_SLOTS_STATE":return{...e,timeSlotsState:t.payload};case"SET_MEETING_STATE":return{...e,meetingState:t.payload};case"SET_ERROR_BOOKING_MODAL":return{...e,errorBookingModal:t.payload};case"SET_FORM_INFO":return{...e,formInfo:t.payload};case"SET_ALLOWED_STEPS":return{...e,allowedSteps:t.payload};case"SET_BOOKING_DRAFT_PENDING_SIGNING":return{...e,bookingDraftPendingSigning:t.payload};case"SET_CUSTOM_BOOKING_FLOW":return{...e,customBookingFlow:t.payload};default:return console.error("Error: Faulty reducer type, double check the names of your reducer type throughout the application."),e}};var S=n(1541);let y="1999621",b="https://".concat(S.m.BOOK_ONLINE_ACCOUNT,".blob.core.windows.net/").concat(S.m.BOOK_ONLINE_IMAGE_CONTAINER);(r=s||(s={})).StepOne="STEP_ONE",r.StepTwo="STEP_TWO",r.StepThree="STEP_THREE",r.Signing="SIGNING",r.StepFour="STEP_FOUR";let j=["STEP_ONE","STEP_TWO","STEP_THREE","SIGNING","STEP_FOUR"];(a=c||(c={})).Office="Office",a.Video="Teams",a.Phone="Phone";let T={weekday:"long",year:"numeric",month:"long",day:"numeric"},v="F\xe4ltet \xe4r obligatoriskt.",k={name:{placeholder:"F\xf6rnamn och efternamn",validation:"".concat(v," Fyll i fullst\xe4ndigt namn.")},ssn:{placeholder:"Personnummer",validation:"Ange personnumret som \xe5\xe5\xe5\xe5mmdd-xxxx."},phone:{placeholder:"Telefonnummer",validation:"".concat(v," Fyll i ett korrekt telefonnummer.")},verifiedPhone:{placeholder:"Telefonnummer",validation:"".concat(v," Verifiera att samma nummer har angetts.")},email:{placeholder:"E-postadress",validation:"".concat(v," Fyll i en korrekt e-postadress.")},deceasedName:{placeholder:"F\xf6rnamn och efternamn",validation:"".concat(v," Fyll i den avlidnas fullst\xe4ndiga namn.")},deceasedSsn:{placeholder:"Personnummer",validation:"Ange personnumret som \xe5\xe5\xe5\xe5mmdd-xxxx."},notes:{placeholder:""}};var w=n(7067);let _=()=>{var e;window.scrollTo(0,0),null===(e=document.getElementById("content"))||void 0===e||e.focus()}
1,O=(e,t)=>{let n=[],i=e.filter(e=>e.officeIsOpen);for(let e=0;e<i.length;e+=t)n.push(i.slice(e,e+t));return n},E=e=>e.slice(0,7).filter(e=>e.officeIsOpen).length,I=e=>{e({type:l.SetBookingInfo,payload:{}}),e({type:l.SetCurrentWeekIndex,payload:0})},C=async(e,t,n,i)=>{if(!t||!e)return;let r=t.find(t=>t.tellusId.toString()===e);n(r?{type:l.SetSelectedOffice,payload:r}:{type:l.SetErrorBookingModal,payload:{title:i.officeMismatchErrorHeading,description:i.officeMismatchErrorText,buttonText:i.officeMismatchButtonText,returnStep:i.officeMismatchReturnStep,isOpen:!0}})},N=async(e,t,n,i,r,a,o,s)=>{if(!e)return;s(!0);let c="/api/book-meeting/step-2/?officeId=".concat(e,"&caseId=").concat(r,"&meetingType=").concat(t,"&pages=").concat(n,"&hoursSafetyRange=").concat(i);try{let e=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("Network response was not ok");let{proximityOffices:t,timeSlots:n}=await e.json();if(t||n){a({type:l.SetProximityOffices,payload:t});let e=E(n);o(e);let i=O(n,e);a({type:l.SetTimeSlotsState,payload:{timeSlotsData:n,timeSlotsWeekData:i}})}}catch(e){console.error("Error fetching meeting data:",e)}s(!1)};var P=e=>{let t=j[e-1];if(!t)throw Error("Ogiltigt stegindex: ".concat(e));return t},D=(e,t,n)=>{let i=P(e);t({type:l.SetCurrentStep,payload:i});let r=1===e,a={...p().query};delete a.office,n&&!r?a.begravningsbyra=n:delete a.begravningsbyra,e>1?a.steg=e.toString():delete a.steg;let o=p().asPath.split("?")[0],s={...a};delete s.slug,"".concat(o,"?").concat(new URLSearchParams(s).toString())!==p().asPath&&p().push({pathname:p().pathname,query:a},void 0,{shallow:!0})},F=(e,t)=>2==e||t>=e;let M=(0,x.createContext)(void 0),B=()=>{let e=(0,x.useContext)(M);if(!e)throw Error("useBookOnline must be used within a BookOnlineProvider");return e},R={selectedOffice:{},heroProps:{},currentStep:{},currentWeekIndex:0,proximityOffices:[],bookingInfo:{},timeSlotsState:{timeSlotsData:[],timeSlotsWeekData:[[]]},meetingState:{activeMeetingType:c.Office,meetingTypeDescription:"",meetingTypeName:""},errorBookingModal:{},formInfo:{},allowedSteps:1,bookingDraftPendingSigning:{},customBookingFlow:{}},L=e=>{var t;let{children:n,tellusOfficeId:i,queryStep:r,selectOfficeProps:a,selectTimeProps:o,formProps:d,signingProps:u,confirmationProps:g,errorMessagesProps:p}=e,[h,b]=(0,x.useState)(!1),j=S.m.IS_MOMENTO,T=o.tellusOffices,[v,k]=(0,x.useState)(i===y),O=o.stepTwoBookingTabs.find(e=>e.meetingType===c.Video),E=null===(t=o.stepTwoBookingTabs)||void 0===t?void 0:t.find(e=>e.meetingType===c.Office),[P,B]=(0,x.useState)(7),[L,W]=(0,x.useReducer)(f,R),{selectedOffice:A,currentStep:Z,meetingState:z,allowedSteps:U}=L,G=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{E&&W({type:l.SetMeetingState,payload:{activeMeetingType:E.meetingType,meetingTypeDescription:E.text,meetingTypeName:E.name}})},[o,E]),(0,x.useEffect)(()=>{Z===s.StepOne&&(G.current=!1,(0,w.Z)({action:"1. Vart vill ni tr\xe4ffa oss?"})),Z===s.StepTwo&&(i||W({type:l.SetErrorBookingModal,payload:{title:p.officeMismatchErrorHeading,description:p.officeMismatchErrorText,buttonText:p.officeMismatchButtonText,returnStep:p.officeMismatchReturnStep,isOpen:!0}}),G.current&&(N(A.id,z.activeMeetingType,o.pages,o.hoursSafetyRange,o.caseId,W,B,b),G.current=!1)),Z===s.StepThree&&(G.current=!0,(0,w.Z)({action:"3. Fyll i kontaktuppgifter"})),_()},[Z]),(0,x.useEffect)(()=>{A.id&&(I(W),k((null==A?void 0:A.tellusId.toString())===y),N(A.id,z.activeMeetingType,o.pages,o.hoursSafetyRange,o.caseId,W,B,b))},[A,z.activeMeetingType,o]),(0,x.useEffect)(()=>{if(i||j){C(i,T,W,p);let e=r||2;F(e,U)?D(e,W,i):D(2,W,i)}else D(1,W,i)},[i,r]),(0,x.useEffect)(()=>{v&&O&&z.activeMeetingType===(null==E?void 0:E.meetingType)&&W({type:l.SetMeetingState,payload:{activeMeetingType:null==O?void 0:O.meetingType,meetingTypeDescription:null==O?void 0:O.text,meetingTypeName:null==O?void 0:O.name}})},[v]),(0,m.jsx)(M.Provider,{value:{isLoading:h,selectOfficeProps:a,selectTimeProps:o,formProps:d,signingProps:u,confirmationProps:g,errorMessagesProps:p,state:L,modifyState:W,tellusOfficeId:i,isOnlineOffice:v,officeOpenDaysAmount:P},children:n})};var W=n(5482),A=n(4614),Z=n(9642),z=n(7391),U=n(8329),G=n(92),H=n(10),K=n(8488),J=e=>{let t=j.indexOf(e);if(-1===t)throw Error("Ok\xe4nt StepId: ".concat(e));return t+1},q=()=>{let{state:{errorBookingModal:e,currentStep:t},modifyState:n,tellusOfficeId:i}
1=B(),{title:r,description:a,buttonText:o,isOpen:s,returnStep:c}=e,d=!o||!c;(0,x.useEffect)(()=>{s&&(0,w.Z)({action:"".concat(J(t),". Errormodal aktiverad"),label:r})},[s]);let u=()=>{n({type:l.SetErrorBookingModal,payload:{...e,isOpen:!1}}),J(t)!==c&&g()},g=()=>{c&&D(c,n,i)};if(s)return(0,m.jsxs)(W.u_,{isCentered:!0,size:{base:"sm",md:"lg",lg:"xl"},isOpen:s,onClose:u,closeOnOverlayClick:d,children:[(0,m.jsx)(A.Z,{}),(0,m.jsxs)(Z.h,{gap:4,children:[(0,m.jsxs)(z.x,{as:U.k,direction:"column",gap:2,children:[(0,m.jsx)(G.x,{as:"h1",textStyle:"heading.xl",children:r}),(0,m.jsx)(G.x,{children:a})]}),(0,m.jsx)(H.f,{children:o&&(0,m.jsx)(K.z,{variant:"primary",onClick:u,children:o})})]})]})},V=n(5367),Y=(e,t)=>{let[n,i=""]=e.split("?");if(!i)return null;let r=(0,V.m)(n),a=new URL("".concat(r,"?").concat(i),S.m.HOST),o=a.searchParams;for(let e of o.keys())o.delete(e);return t&&(o.delete("begravningsbyra"),o.delete("steg"),o.set("begravningsbyra",t),o.set("steg","2")),a.href},Q=n(1312),X=n(8029),$=()=>{let{selectOfficeProps:{offices:e,stepOneMediumHeading:t,stepOnePreambleText:n,stepOneSmallHeading:i,stepOneDropdownLabel:r,stepOneMobileDrawerMapTitle:a,stepOneButtonTextNextStep:o,zoom:s},modifyState:c,state:{customBookingFlow:d}}=B(),[u,g]=(0,x.useState)(!1),[p,h]=(0,x.useState)(null);return(0,x.useEffect)(()=>{c({type:l.SetCustomBookingFlow,payload:{...d,flow_map_interaction:u,flow_cta_interaction:p}})},[u,p]),(0,m.jsx)(X.x,{bg:"bookOnline.secondaryCard",pb:24,pt:8,children:(0,m.jsx)(Q.Z,{offices:e,includeSearchBox:!1,enableMapIntegrationWithDropdown:!0,header:t,preamble:n,smallHeading:i,dropDownLabel:r,nextStepButtonText:o,zoom:s,setCtaInteraction:h,setMapInteraction:g,mapInteraction:u,mobileDrawerMapTitle:a})})},ee=n(4270),et=e=>{let{children:t,bg:n,heading:i,description:r,label:a,isLoading:o,headingLevel:l="h2",...s}=e,c="h3"===l;return o?(0,m.jsx)(ee.O,{w:{base:"100%",lg:"50%"},p:{base:5,md:8},minH:"200px",startColor:"card.quaternary",endColor:n}):(0,m.jsxs)(X.x,{w:{base:"100%",lg:"50%"},p:{base:5,md:8},bg:n,...s,children:[(0,m.jsxs)(U.k,{flexDir:"column",gap:4,children:[i&&(0,m.jsx)(G.x,{as:l,textStyle:c?"heading.sm":"heading.md",children:i}),r&&(0,m.jsx)(G.x,{children:r}),a&&(0,m.jsx)(G.x,{fontWeight:700,fontSize:"body.md","aria-live":"polite",children:a})]}),t]})},en=n(1816),ei=n(5478),er=n(9860),ea=n(3712),eo=n(2291),el=n(8424),es=n(3229),ec=n(8387),ed=n(1742),em=n(1502),eu=n(5133),eg=n(8645),ep=n(3321),eh=e=>{let{bestCaseWorkerId:t,bestCaseWorkerName:n,bestCaseWorkerEmail:i,bestCaseWorkerPhone:r,bestRoomId:a,slot:o,day:s,shortDate:c,dateTimeForScreenReaders:d,isCalender:u,buttonBackground:g="bookOnline.primary"}=e,{startTime:p,endTime:h,startTimeStamp:x,dateStamp:f}=o,{selectTimeProps:{stepTwoCalenderRadioButtonText:S,stepTwoListRadioButtonText:y},state:{bookingInfo:b,customBookingFlow:j},modifyState:T}=B(),v=u?S:y,k={startTime:p,shortTime:x,endTime:h,caseWorkerId:t,caseWorkerName:n,caseWorkerEmail:i,caseWorkerPhone:r,roomId:a,dateStamp:f,shortDate:c,day:s},_=JSON.stringify(b)===JSON.stringify(k),O=()=>{T({type:l.SetBookingInfo,payload:_?{}:k}),_||(T({type:l.SetCustomBookingFlow,payload:{...j,flow_calender:v}}),(0,w.Z)({action:"2.1. Tid vald"}))};return(0,m.jsx)(K.z,{variant:_?"selectedTable":"table",bg:_?"brand.primary":g,"aria-pressed":_,"aria-label":_?"Vald tid klockan: ".concat(x," ").concat(d):"".concat(x),onClick:()=>O(),children:x})};let ex=e=>new Date().toLocaleDateString("sv-SE")===e.split("T")[0];var ef=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return({Mån:t?"M\xe5n":"M\xe5ndag",Tis:t?"Tis":"Tisdag",Ons:t?"Ons":"Onsdag",Tors:t?"Tors":"Torsdag",Fre:t?"Fre":"Fredag",Lör:t?"L\xf6r":"L\xf6rdag",Sön:t?"S\xf6n":"S\xf6ndag"})[e]||e},eS=e=>{let{date:t,day:n,dateTimeOffset:i,timeSlots:r}=e;if(!r.length)return null;let a=!r.length,o=ex(i),l=ef(n,!1),s=new Date(i).toLocaleDateString("sv-SE",T);return(0,m.jsx)(em.Q,{border:"none",isDisabled:a,children:e=>{let{isExpanded:i}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(eu.K,{py:5,px:8,"aria-label":s,bg:i?"card.primary":"bookOnline.secondaryCard",_hover:{bg:"card.primary"},children:(0,m.jsxs)(G.x,{display:"flex",textAlign:"left",gap:5,alignItems:"center",fontSize:{base:"body.sm",md:"body.md"},fontWeight:o?700:400,children:[i?(0,m.jsx)(ed.ve,{transform:"rotateZ(180deg)",transition:"transform 0.5s",fontSize:"small",color:"brand.primary"}):(0,m.jsx)(ed.ve,{color:"brand.primary",fontSize:"small",transition:"transform 0.5s"}),"".concat(l," ").concat(t)]})}),i&&(0,m.jsx)(eg.H,{px:8,pt:1,as:ep.M,columns:{base:4,sm:6,md:8},spacingX:2,spacingY:2,bg:i?"card.primary":"bookOnline.secondaryCard",children:null==r?void 0:r.map((e,i)=>(0,x.createElement)(eh,{...e,shortDate:t,day:n,key:i,dateTimeForScreenReaders:s}))})]})}})},ey=n(8899),eb=n(6561);let ej=e=>e.some(e=>e.timeSlots.length>0);var eT=n(5275),ev=e=>{let{content:t,buttonText:n,skipToNextAvailableTime:i,nextAvailableTime:r,...a}=e;return(0,m.jsx)(U.k,{w:"100%",justifyContent:"center",bg:"bookOnline.secondaryCard",...a,children:(0,m.jsxs)(X.x,{maxW:"400px",textAlign:"center",py:{base:6,md:12},px:{base:4,md:0},children:[(0,m.jsx)(eT.r_,{content:t,overrides:{p:{mb:2,mt:0}}}),r&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(G.x,{children:"N\xe4sta lediga tid \xe4r: ".concat(r)}),n&&(0,m.jsx)(K.z,{onClick:i,mt:4,children:n})]})]})})},ek=()=>{let{selectTimeProps:{stepTwoNoTimeSlotsText:e}
1,state:{timeSlotsState:{timeSlotsData:t}},isLoading:n}=B(),i=ej(t);return n?(0,m.jsx)(U.k,{justifyContent:"center",children:(0,m.jsx)(ey.$,{})}):(0,m.jsx)(m.Fragment,{children:i?(0,m.jsx)(eb.U,{allowMultiple:!0,defaultIndex:[0],display:"flex",flexDir:"column",gap:2,children:null==t?void 0:t.map((e,t)=>(0,x.createElement)(eS,{...e,key:t}))}):(0,m.jsx)(ev,{content:e})})},ew=n(4703),e_=n(1901),eO=n(7167),eE=n(4476),eI=n(6007),eC=n(3416);let eN=e=>{let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let n=new Date(Date.UTC(t.getUTCFullYear(),0,4));return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()||7)+1),Math.floor((t.getTime()-n.getTime())/864e5/7)+1},eP=e=>eN(eD(new Date,7*e)),eD=(e,t)=>{let n=new Date(e);return n.setDate(n.getDate()+t),n},eF=e=>{let t=new Date;return t.setHours(0,0,0,0),new Date(e)<t};var eM=n(7898),eB=n(3216),eR=e=>{let{direction:t,toggleWeekClick:n,isMobile:i=!1}=e;if(!t)return;let r="next"===t,a=i&&!r,o=i&&r;return(0,m.jsxs)(K.z,{display:"flex",gap:1,variant:"icon",w:"fit-content",h:"fit-content",pl:a?0:"none",pr:o?0:"none",onClick:()=>n(t),fontSize:{base:"body.xs",md:"body.sm"},children:[!r&&(0,m.jsx)(ed.Y4,{fontSize:"xs"}),r?"Se senare":"Se tidigare",r&&(0,m.jsx)(ed.LZ,{fontSize:"xs"})]})},eL=()=>{let{state:{timeSlotsState:{timeSlotsWeekData:e,timeSlotsData:t},currentWeekIndex:n},modifyState:i}=B(),r=ej(t),a=0!==n,o=n!==e.length-1&&r,s=eP(n),c="".concat("Vecka"," ").concat(s),d=e=>{"next"===e?(i({type:l.SetCurrentWeekIndex,payload:n+1}),(0,w.Z)({action:"2.2. Senare datum"})):"prev"===e&&(i({type:l.SetCurrentWeekIndex,payload:n-1}),(0,w.Z)({action:"2.2. Tidigare datum"}))};return(0,m.jsxs)(U.k,{bg:"bookOnline.secondaryCard",p:4,flexDir:{base:"column",lg:"row"},children:[a&&(0,m.jsx)(eM.d,{above:"lg",children:(0,m.jsx)(U.k,{position:"absolute",left:0,width:{base:"100%",lg:"auto"},justifyContent:"flex-start",children:(0,m.jsx)(eR,{direction:"prev",toggleWeekClick:d})})}),c&&(0,m.jsx)(U.k,{w:"100%",justifyContent:"center",textAlign:"center",children:(0,m.jsx)(G.x,{fontSize:"body.xl",children:c})}),o&&(0,m.jsx)(eM.d,{above:"lg",children:(0,m.jsx)(U.k,{position:"absolute",right:0,justifyContent:"flex-start",children:(0,m.jsx)(eR,{direction:"next",toggleWeekClick:d})})}),(0,m.jsx)(eB.c,{above:"lg",children:(0,m.jsxs)(U.k,{width:"100%",justifyContent:a?"space-between":"flex-end",children:[a&&(0,m.jsx)(eR,{direction:"prev",toggleWeekClick:d,isMobile:!0}),o&&(0,m.jsx)(eR,{direction:"next",toggleWeekClick:d,isMobile:!0})]})})]})};let eW=e=>{let t=e.find(e=>e.timeSlots&&e.timeSlots.length>0);return t?"".concat(ef(t.day)," ").concat(t.date):null},eA=e=>{for(let t=0;t<e.length;t++)for(let n of e[t])if(n.timeSlots&&n.timeSlots.length>0)return t;return null};var eZ=()=>{var e;let{selectTimeProps:{stepTwoNoTimeSlotsText:t,stepTwoNoTimeSlotsThisWeekText:n,stepTwoNoTimeSlotsThisWeekButton:i},state:{currentWeekIndex:r,timeSlotsState:{timeSlotsData:a,timeSlotsWeekData:o},meetingState:{meetingTypeName:s},selectedOffice:{name:c}},modifyState:d,isLoading:u,officeOpenDaysAmount:g}=B(),p=(0,en.S)({base:!0,md:!1}),h=(0,en.S)({base:!0,md:!1}),f=eW(a),S=eA(o),y=ej(a),b=ej(o[r]),j=eP(r),v="";return(y||b?y&&!b&&(v=n):v=t,u)?(0,m.jsx)(U.k,{justifyContent:"center",children:(0,m.jsx)(ey.$,{})}):(0,m.jsxs)(X.x,{position:"relative",w:p?"100vw":"100%",marginLeft:p?"calc(-50vw + 50%)":0,children:[(0,m.jsx)(eL,{}),(0,m.jsxs)(ew.i,{variant:"unstyled",role:"grid",children:[(0,m.jsx)(eo.T,{as:"caption",children:b?"V\xe4lj en tillg\xe4nglig tid f\xf6r ditt ".concat(s,", nu visas lediga tider f\xf6r vecka ").concat(j):y?"Det finns inga tillg\xe4ngliga tider f\xf6r ".concat(s," vecka ").concat(j," f\xf6r ").concat(c):"Det finns inga lediga tider f\xf6r ".concat(s," f\xf6r ").concat(c)}),(0,m.jsxs)(U.k,{flexDir:"column",children:[(0,m.jsx)(e_.h,{top:{base:eT.M4,xl:eT.mV},children:(0,m.jsx)(eO.Tr,{gridTemplateColumns:"repeat(".concat(g,", 1fr)"),gap:{base:g>5?"1px":"4px",md:"4px"},children:o[r].map((e,t)=>{if(t>=g)return;let{date:n,day:i,dateTimeOffset:r}=e,a=ef(i,null!=h&&h),o=ex(r),l=eF(r),s=new Date(r).toLocaleDateString("sv-SE",T);return(0,m.jsxs)(eE.Th,{scope:"col",fontWeight:o?"700":"400",children:[(0,m.jsx)(eo.T,{as:"time",dateTime:r,children:s}),(0,m.jsx)(G.x,{"aria-hidden":"true",fontSize:{base:"body.sm",md:"body.md"},textColor:l?"gray.700":"global.text.color",children:a}),(0,m.jsx)(G.x,{"aria-hidden":"true",fontSize:{base:"body.xs",md:"body.sm"},textColor:l?"gray.700":"global.text.color",pt:3,pb:2,children:n})]},t)})})}),(0,m.jsxs)(eI.p,{children:[(0,m.jsx)(eO.Tr,{gridTemplateColumns:"repeat(".concat(g,", 1fr)"),gap:{base:g>5?"1px":"4px",md:"4px"},children:null===(e=o[r])||void 0===e?void 0:e.map((e,t)=>{var n;if(t>=g)return;
1let{date:i,day:r,dateTimeOffset:a}=e,o=new Date(a).toLocaleDateString("sv-SE",T);return(0,m.jsxs)(eC.Td,{children:[e.timeSlots.length>0?(0,m.jsx)(eo.T,{children:"Det finns ".concat(e.timeSlots.length," tillg\xe4ngliga tider ").concat(o)}):(0,m.jsx)(eo.T,{children:"Inga lediga tider ".concat(o)}),!!(null==e?void 0:null===(n=e.timeSlots)||void 0===n?void 0:n.length)&&e.timeSlots.map((e,n)=>(0,x.createElement)(eh,{...e,shortDate:i,day:r,dateTimeForScreenReaders:o,isCalender:!0,buttonBackground:t%2?"bookOnline.light":"bookOnline.primary",key:"".concat(t,"-").concat(n)}))]},t)})}),(!y||!b)&&(0,m.jsx)(ev,{content:v,buttonText:i,skipToNextAvailableTime:()=>{"number"==typeof S&&((0,w.Z)({action:"2.6. Visa n\xe4sta lediga tid"}),d({type:l.SetCurrentWeekIndex,payload:S}))},nextAvailableTime:f})]})]})]})]})},ez=e=>{var t,n;let{heading:i,radioButtonTabs:r}=e,a=null!==(t=(0,en.S)({base:!0,md:!1}))&&void 0!==t&&t,o=null!==(n=(0,en.S)({base:!0,minBreakpointForCalendar:!1}))&&void 0!==n&&n,[l,s]=(0,x.useState)(0);return(0,x.useEffect)(()=>{s(a||o?1:0)},[a,o]),(0,m.jsxs)(X.x,{w:"100%",children:[i&&(0,m.jsx)(G.x,{as:"h2",textStyle:"heading.lg",mb:4,children:i}),(0,m.jsxs)(ei.m,{index:l,onChange:e=>s(e),children:[!o&&(0,m.jsx)(er.E,{value:String(l),onChange:e=>{s(Number(e))},mb:5,children:(0,m.jsxs)(ea.K,{direction:{base:"column-reverse",md:"row"},spacing:5,as:"fieldset",children:[(0,m.jsx)(eo.T,{as:"legend",children:"V\xe4lj vy f\xf6r att visa lediga tider"}),(null==r?void 0:r.calender)&&(0,m.jsx)(el.Y,{value:"0",isDisabled:o,children:r.calender}),(null==r?void 0:r.list)&&(0,m.jsx)(el.Y,{value:"1",children:r.list})]})}),(0,m.jsxs)(es.n,{children:[(0,m.jsx)(ec.x,{p:0,children:(0,m.jsx)(eZ,{})}),(0,m.jsx)(ec.x,{p:0,children:(0,m.jsx)(ek,{})})]})]})]})},eU=n(2553),eG=e=>{let{children:t,isReverseMobileDir:n=!1,...i}=e;return(0,m.jsx)(U.k,{gap:5,flexDir:{base:n?"column-reverse":"column",lg:"row"},...i,children:t})};let eH={Office:ed.tB,Teams:ed.Od,Phone:ed.qW};var eK=e=>{let{heading:t,meetingTypes:n}=e,{state:{meetingState:i},isOnlineOffice:r,modifyState:a}
1=B(),{activeMeetingType:o,meetingTypeDescription:s}=i;(0,x.useEffect)(()=>{(0,w.Z)({action:"2. Vilken typ av m\xf6te vill ni boka?",label:o})},[o]);let d=e=>{let t=n.find(t=>t.meetingType===e);if(t&&o!==(null==t?void 0:t.meetingType)){var i,r,s;a({type:l.SetMeetingState,payload:{activeMeetingType:null!==(i=null==t?void 0:t.meetingType)&&void 0!==i?i:"",meetingTypeDescription:null!==(r=null==t?void 0:t.text)&&void 0!==r?r:"",meetingTypeName:null!==(s=null==t?void 0:t.name)&&void 0!==s?s:""}})}};return(0,m.jsxs)(X.x,{children:[t&&(0,m.jsx)(G.x,{as:"h2",textStyle:"heading.lg",mb:4,children:t}),(0,m.jsxs)(er.E,{w:"100%",onChange:e=>d(e),value:o,children:[(0,m.jsxs)(eG,{as:"fieldset",children:[(0,m.jsx)(eo.T,{as:"legend",children:"V\xe4lj m\xf6testyp"}),null==n?void 0:n.map(e=>{let t=e.meetingType===c.Office;return(0,m.jsxs)(el.Y,{value:e.meetingType,isDisabled:t&&r,gap:2,spacing:0,w:"100%",variant:"bookOnlineButton","aria-describedby":e.meetingType,children:[(0,m.jsx)(eU.J,{as:eH[e.meetingType]}),e.name]},e.meetingType)})]}),(0,m.jsx)(eM.d,{below:"lg",children:s&&(0,m.jsx)(X.x,{pt:5,id:o,children:(0,m.jsx)(eT.r_,{content:s,overrides:{p:{my:"0",textStyle:"preamble"}}})})})]}),(0,m.jsx)(eB.c,{below:"lg",children:s&&(0,m.jsx)(X.x,{mt:4,id:o,children:(0,m.jsx)(eT.r_,{content:s,overrides:{p:{textStyle:"preamble"}}})})})]})},eJ=n(6254),eq=e=>{let{children:t}=e;return(0,m.jsx)(eJ.W,{maxW:"container.page",display:"flex",flexDir:"column",gap:12,mb:20,children:t})};let eV=(e,t)=>new Date().getTime()<new Date(e).getTime()-36e5*t;var eY=e=>{let{nextButtonText:t,prevButtonText:n,isSigningStepEnabled:i,isSubmit:r=!1,isSubmitting:a=!1,hidePrevButton:o,nextFunc:s,onSubmitClick:c}=e,{selectTimeProps:{hoursSafetyRange:d},errorMessagesProps:{bookingExpiredHeading:u,bookingExpiredText:g,bookingExpiredButtonText:p},state:{currentStep:h,bookingInfo:x},modifyState:f,tellusOfficeId:S}=B(),y=J(h),b=i?ed.tL:r?eT.nQ:eT.LZ,j=o?"flex-end":(null==t?void 0:t.length)===0?"flex-start":"space-between",T=e=>{let t="next"===e?y+1:y-1;"next"===e?(s&&s(),eV(x.startTime,d)?(f({type:l.SetAllowedSteps,payload:y+1}),D(t,f,S)):f({type:l.SetErrorBookingModal,payload:{title:u,description:g,buttonText:p,isOpen:!0}})):"prev"===e&&D(t,f,S)};return y?(0,m.jsxs)(U.k,{justifyContent:j,flexDir:{base:"column-reverse",md:"row"},gap:{base:6,lg:0},children:[n&&!o&&(0,m.jsx)(eT.zx,{variant:"secondary",onClick:()=>T("prev"),leftIcon:(0,m.jsx)(eT.Y4,{width:"24px",height:"24px"}),children:n}),t&&(0,m.jsx)(eT.zx,{isDisabled:!x.startTime,onClick:()=>{r?c&&c():T("next")},type:r?"submit":"button",isLoading:a,rightIcon:a?void 0:(0,m.jsx)(eU.J,{as:b,width:"24px",height:"24px",ml:"4px"}),children:(0,m.jsx)(U.k,{visibility:a?"hidden":"visible",children:t})})]}):null},eQ=e=>{let{placeholder:t,hasNearbyOffices:n,label:i,identifier:r}
1=e,{state:{proximityOffices:a,meetingState:{activeMeetingType:o},customBookingFlow:s},selectTimeProps:{tellusOffices:d,stepTwoBookingTabs:u},selectOfficeProps:{offices:g},modifyState:p}=B(),h=o!==c.Office,x=null==u?void 0:u.find(e=>e.meetingType===c.Office),f=null==a?void 0:a.filter(e=>h||e.tellusId.toString()!==y);h&&f.sort((e,t)=>e.tellusId.toString()===y?-1:t.tellusId.toString()===y?1:0);let S=e=>{if(!d)return;let t=null;if(t=n?d.find(t=>t.id===e):d.find(t=>t.tellusId===parseInt(e))){if(D(2,p,t.tellusId.toString()),p({type:l.SetSelectedOffice,payload:t}),t.tellusId.toString()!==y){if(!x)return;p({type:l.SetMeetingState,payload:{activeMeetingType:null==x?void 0:x.meetingType,meetingTypeDescription:null==x?void 0:x.text,meetingTypeName:null==x?void 0:x.name}})}p({type:l.SetCustomBookingFlow,payload:{...s,flow_office_change:!0}}),(0,w.Z)({action:"2.3. Annat kontor"})}},b=n?f.map((e,t)=>({value:e.id,title:e.name,key:"proximity-office-".concat(t)})):g.map((e,t)=>({value:e.officeProps.officeId,title:e.name,key:"all-offices-".concat(t)}));return(0,m.jsx)(U.k,{flexDir:"column",gap:1,mt:5,maxW:"100%",children:(0,m.jsx)(eT.vb,{label:null!=i?i:"",identifier:r,isSearchable:!0,options:b,placeholder:t,onChange:e=>S(e[0]),hideSelectedFilters:!0})})},eX=n(141),e$=n(9497),e0=e=>{var t,n;let{selectedOffice:i,helpText:r,gtmAction:a,...o}=e,l="".concat(null!==(t=i.street)&&void 0!==t?t:"",", ").concat(null!==(n=i.city)&&void 0!==n?n:"");return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(U.k,{flexDir:"column",wordBreak:"break-word",...o,children:[(0,m.jsx)(eX.Z,{href:"tel:".concat((0,e$.J)(i.phoneNumber)),icon:ed.qW,"aria-label":"Ring ".concat(i.name," p\xe5 telefonnummer: ").concat(i.phoneNumber),gtmAction:a,children:i.phoneNumber}),(0,m.jsxs)(G.x,{children:[(0,m.jsx)(eU.J,{as:ed.b8,color:"brand.primary",mr:2,mb:"0.2rem"}),l]})]}),r&&(0,m.jsx)(eT.r_,{content:r,overrides:{p:{mt:5}}})]})},e1=()=>{let{selectTimeProps:{stepTwoMeetingTypeHeader:e,stepTwoBookingTabs:t,stepTwoSelectedOfficeLabel:n,stepTwoNearbyOfficesLabel:i,stepTwoHasNoNearbyOfficesLabel:r,stepTwoNearbyOfficesText:a,stepTwoHasNoNearbyOfficesText:o,stepTwoHasNoNearbyOfficesDropdownPlaceholder:l,stepTwoDropdownPlaceholder:s,stepTwoButtonTextNextStep:d,stepTwoButtonTextPrevStep:u,stepTwoTimeAndDayHeader:g,stepTwoCallUsTinyText:p,stepTwoListRadioButtonText:h,stepTwoCalenderRadioButtonText:x},state:{selectedOffice:f,proximityOffices:b,meetingState:{activeMeetingType:j},customBookingFlow:T},isLoading:v}=B(),k=S.m.IS_MOMENTO,_=j!==c.Office,O=e=>e.tellusId.toString()===y,E=b.some(e=>!O(e)),I=!!(null==b?void 0:b.length)&&(_||E),C=!k||k&&I,N=I?i:r,P=I?a:o,D=I?s:l,F=I?"N\xe4rligande kontor":"Alla kontor",M=I?"Omr\xe5de":"Ort",R=()=>{var e;(0,w.Z)({action:"2.4. Datum, tid och kontor bekr\xe4ftat"}),(0,w.Z)({flow_step:2,flow_office:f.name,flow_cta_interaction:T.flow_cta_interaction,flow_map_interaction:T.flow_map_interaction,flow_meeting_type:j,flow_office_change:null!==(e=T.flow_office_change)&&void 0!==e&&e,flow_calender:T.flow_calender})};return(0,m.jsxs)(eq,{children:[(0,m.jsxs)(eG,{children:[f.tellusId&&(0,m.jsx)(et,{bg:"bookOnline.primaryCard",heading:n,label:f.name,headingLevel:"h2",children:(0,m.jsx)(e0,{selectedOffice:f,gtmAction:"2.5. Telefonnummer",helpText:p,gap:2,pt:5})}),C&&(0,m.jsx)(et,{bg:"bookOnline.secondaryCard",heading:N,description:P,isLoading:v,headingLevel:"h2",children:(0,m.jsx)(eQ,{placeholder:D,hasNearbyOffices:I,identifier:F,label:M})})]}),(0,m.jsx)(eK,{meetingTypes:t,heading:e}),(0,m.jsx)(ez,{heading:g,radioButtonTabs:{list:h,calender:x}}),(0,m.jsx)(eY,{nextButtonText:d,prevButtonText:u,hidePrevButton:k,nextFunc:()=>R()})]})},e2=n(512),e4=e=>{let{heading:t,preamble:n,isLoading:i=!1,children:r,as:a,...o}=e;return(0,m.jsxs)(U.k,{...o,as:a,p:{base:5,md:8},children:["fieldset"===a&&t&&(0,m.jsx)(eo.T,{as:"legend",children:t}),(0,m.jsxs)(U.k,{w:{base:"100%",lg:"60%"},direction:{base:"column",md:"row"},flexDirection:"column",gap:4,children:[t&&(0,m.jsx)(G.x,{as:"h3",textStyle:"heading.md",children:t}),n&&(0,m.jsx)(eT.r_,{overrides:{p:{margin:0}},content:n}),i&&(0,m.jsx)(ey.$,{}),r]})]})};let e5=(e,t,n,i)=>{t({type:l.SetBookingDraftPendingSigning,payload:e}),t({type:l.SetAllowedSteps,payload:n+1}),D(n+1,t,i)},e8=e=>{let t=new Date,n=new Date(e);return Math.abs(Math.round((t.getTime()-n.getTime())/864e5))},e7=(e,t,n)=>{let{timeSlotTakenErrorHeading:i,serverErrorHeading:r,timeSlotTakenErrorText:a,serverErrorText:o,timeSlotTakenButtonText:s,serverErrorButtonText:c,timeSlotTakenReturnStep:d,serverErrorReturnStep:m}=t,u=422===n;e({type:l.SetErrorBookingModal,payload:{title:u?i:r,description:u?a:o,buttonText:u?s:c,returnStep:u?d:m,isOpen:!0}})},e3=e=>{var t;let{modifyState:n,isSigningStepEnabled:i,currentStepIndex:r,selectedOfficeName:a,activeMeetingType:
1o,customBookingFlow:s,tellusOfficeId:c,daysBetween:d}=e,m=r+(i?1:2);n({type:l.SetAllowedSteps,payload:m}),(0,w.Z)({flow_step:3,flow_office:a,flow_cta_interaction:s.flow_cta_interaction,flow_map_interaction:s.flow_map_interaction,flow_meeting_type:o,flow_office_change:null!==(t=s.flow_office_change)&&void 0!==t&&t,flow_calender:s.flow_calender,flow_days_ahead:d}),D(m,n,c)},e6=(e,t)=>{let{bookingExpiredHeading:n,bookingExpiredText:i,bookingExpiredButtonText:r,bookingExpiredReturnStep:a}=t;e({type:l.SetErrorBookingModal,payload:{title:n,description:i,buttonText:r,returnStep:a,isOpen:!0}})},e9=(e,t)=>{let n={};return e.customerName||t||(n.customerName=k.name.validation),e.customerNoSocialSecurityNumber||t||(0,eT.IC)(e.customerSocialSecurityNumber)||(n.customerSocialSecurityNumber=k.ssn.validation),(0,eT.yf)(e.customerPhone)||(n.customerPhone=k.phone.validation),e.verifiedCustomerPhone&&e.verifiedCustomerPhone===e.customerPhone||(n.verifiedCustomerPhone=k.verifiedPhone.validation),(0,eT.vV)(e.customerEmail)||(n.customerEmail=k.email.validation),e.deceasedName||(n.deceasedName=k.deceasedName.validation),e.deceasedSocialSecurityNumber&&!(0,eT.IC)(e.deceasedSocialSecurityNumber)&&(n.deceasedSocialSecurityNumber=k.deceasedSsn.validation),n},te=async e=>fetch("/api/book-meeting/createBooking/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),tt=async e=>{let{bookingObj:t,modifyState:n,isSigningStepEnabled:i=!1,errorMessagesProps:r,currentStepIndex:a,selectedOfficeName:o,activeMeetingType:l,customBookingFlow:s,daysBetween:c,tellusOfficeId:d}=e;try{let e=await te(t);if(!e.ok){let{status:t,error:i}=await e.json();if(i){e7(n,r,t);return}}e.ok&&e3({modifyState:n,isSigningStepEnabled:i,currentStepIndex:a,selectedOfficeName:o,activeMeetingType:l,customBookingFlow:s,tellusOfficeId:d,daysBetween:c})}catch(e){console.error("Error creating booking:",e)}},tn=()=>{let{formProps:{stepThreeButtonTextNextStep:e,stepThreeButtonTextPrevStep:t,stepThreeContactHeading:n,stepThreeDeceasedHeading:i,stepThreeNotesHeading:r,stepThreeNotesDescription:a,stepThreePrivacyPolicyText:o,stepThreeNameLabel:s,stepThreeSsnLabel:c,stepThreeNoSsnCheckboxLabel:d,stepThreePhoneLabel:u,stepThreeVerifiedPhoneLabel:g,stepThreeEmailLabel:p,stepThreeDeceasedNameLabel:h,stepThreeDeceasedSsnLabel:f,stepThreeNotesLabel:S},signingProps:{isSigningStepEnabled:y},state:{formInfo:b},modifyState:j}=B(),{values:T,isSubmitting:v,errors:_,touched:O,setTouched:E,validateForm:I}=(0,e2.u6)(),[C,N]=(0,x.useState)({}),P=a?a.replace("<p",'<p id="notes-preamble"'):a,D=async()=>{let e={customerName:!0,customerSocialSecurityNumber:!0,customerNoSocialSecurityNumber:!0,customerPhone:!0,verifiedCustomerPhone:!0,customerEmail:!0,deceasedName:!0,deceasedSocialSecurityNumber:!0,notes:!0};await E(e),N(Object.fromEntries(Object.entries(await I()).filter(t=>{let[n]=t;return e[n]})))};return(0,x.useEffect)(()=>{j({type:l.SetFormInfo,payload:T})},[T,b]),(0,x.useEffect)(()=>{let e=Object.keys(_).reduce((e,t)=>(O[t]&&(e[t]=_[t]),e),{});Object.keys(e).length>0&&(0,w.Z)({action:"3.1. Felmeddelande",label:Object.keys(e)})},[_,O]),(0,m.jsxs)(e2.l0,{children:[(0,m.jsxs)(ea.K,{gap:5,mt:5,children:[Object.entries(C).length>0&&(0,m.jsx)(eT.nj,{errors:C}),(0,m.jsxs)(e4,{heading:n,bg:"bookOnline.secondaryCard",as:"fieldset",children:[!y&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(eT.Wi,{name:"customerName",label:s,inputPlaceholder:k.name.placeholder,autocomplete:"name",isRequired:!0,type:"text"}),(0,m.jsx)(eT.Wi,{name:"customerSocialSecurityNumber",label:c,inputPlaceholder:k.ssn.placeholder,checkboxControlName:"customerNoSocialSecurityNumber",checkboxControlLabel:d,isRequired:!T.customerNoSocialSecurityNumber,type:"switchableText"})]}),(0,m.jsx)(eT.Wi,{name:"customerPhone",label:u,inputPlaceholder:k.phone.placeholder,autocomplete:"tel",type:"phone",isRequired:!0}),(0,m.jsx)(eT.Wi,{name:"verifiedCustomerPhone",label:g,inputPlaceholder:k.verifiedPhone.placeholder,autocomplete:"tel",type:"phone",isRequired:!0}),(0,m.jsx)(eT.Wi,{name:"customerEmail",label:p,inputPlaceholder:k.email.placeholder,autocomplete:"email",type:"email",isRequired:!0})]}),(0,m.jsxs)(e4,{heading:i,bg:"bookOnline.secondaryCard",as:"fieldset",children:[(0,m.jsx)(eT.Wi,{name:"deceasedName",label:h,inputPlaceholder:k.deceasedName.placeholder,type:"name",isRequired:!0}),(0,m.jsx)(eT.Wi,{name:"deceasedSocialSecurityNumber",label:f,inputPlaceholder:k.deceasedSsn.placeholder,type:"text"})]}),(0,m.jsx)(e4,{heading:r,preamble:P,bg:"bookOnline.secondaryCard",as:"fieldset",children:(0,m.jsx)(eT.Wi,{name:"notes",label:S,inputPlaceholder:k.notes.placeholder,fieldVariant:"textArea",maxCharacters:240,descriptionId:"notes-preamble",type:"textarea"})})]}),(0,m.jsx)(X.x,{maxW:"container.sm",children:(0,m.jsx)(eT.r_,{overrides:{p:{mt:5,mb:{base:8,lg:12},fontSize:"body.xs"}}
1,content:o})}),(0,m.jsx)(eY,{nextButtonText:e,prevButtonText:t,isSigningStepEnabled:y,isSubmit:!0,isSubmitting:v,onSubmitClick:async()=>{await D()}})]})};var ti=()=>{let{selectTimeProps:{hoursSafetyRange:e,caseId:t},signingProps:{isSigningStepEnabled:n},errorMessagesProps:i,state:{formInfo:r,bookingInfo:a,currentStep:o,selectedOffice:l,meetingState:{activeMeetingType:s},customBookingFlow:c},modifyState:d,tellusOfficeId:u}=B(),g=async(r,m)=>{if(!eV(a.startTime,e)){e6(d,i),m.setSubmitting(!1);return}let g={caseId:t,officeId:l.id,caseWorkerId:a.caseWorkerId,start:a.startTime,end:a.endTime,notes:r.notes,meetingType:s,roomId:a.roomId,customerName:r.customerName,customerEmail:r.customerEmail,customerPhone:r.customerPhone,deceasedName:r.deceasedName,deceasedSocialSecurityNumber:r.deceasedSocialSecurityNumber,customerSocialSecurityNumber:r.customerSocialSecurityNumber,customerNoSocialSecurityNumber:r.customerNoSocialSecurityNumber},p=e8(a.dateStamp);if(n){var h;e5(g,d,J(o),u),(0,w.Z)({flow_step:2.5,flow_office:l.name,flow_cta_interaction:c.flow_cta_interaction,flow_map_interaction:c.flow_map_interaction,flow_meeting_type:s,flow_office_change:null!==(h=c.flow_office_change)&&void 0!==h&&h,flow_calender:c.flow_calender,flow_days_ahead:p})}else await tt({bookingObj:g,modifyState:d,errorMessagesProps:i,currentStepIndex:J(o),tellusOfficeId:u,selectedOfficeName:l.name,activeMeetingType:s,customBookingFlow:c,daysBetween:p});m.setSubmitting(!1)};return(0,m.jsx)(e2.J9,{initialValues:r,validate:e=>e9(e,n),onSubmit:g,enableReinitialize:!1,children:(0,m.jsx)(tn,{})})},tr=()=>{let{formProps:{stepThreeFormHeading:e,stepThreeFormPreamble:t}}=B();return(0,m.jsxs)(X.x,{children:[(0,m.jsxs)(U.k,{flexDir:"column",maxW:"container.sm",children:[(0,m.jsx)(G.x,{as:"h2",textStyle:"heading.lg",children:e}),(0,m.jsx)(eT.r_,{content:t,overrides:{p:{mb:0}}})]}),(0,m.jsx)(ti,{})]})},ta=()=>{let{state:{bookingInfo:e,selectedOffice:t,meetingState:{meetingTypeName:n,activeMeetingType:i}},formProps:{stepThreeSelectedOfficeLabel:r,stepThreeSelectedMeetingLabel:a}}=B(),o="".concat(ef(e.day)," ").concat(e.shortDate," klockan ").concat(e.shortTime);return(0,m.jsxs)(eq,{children:[(0,m.jsxs)(eG,{children:[(0,m.jsx)(et,{bg:"bookOnline.primaryCard",heading:r,label:t.name,headingLevel:"h2",children:(0,m.jsx)(e0,{selectedOffice:t,gtmAction:"3.2. Telefonnummer",gap:2,pt:5})}),(0,m.jsx)(et,{bg:"bookOnline.primaryCard",heading:a,headingLevel:"h2",children:(0,m.jsxs)(ea.K,{gap:2,pt:5,children:[(0,m.jsxs)(G.x,{children:[(0,m.jsx)(eU.J,{as:eH[i],color:"brand.primary",mr:2,mb:"0.2rem"}),n]}),(0,m.jsxs)(G.x,{children:[(0,m.jsx)(eU.J,{as:ed.T3,color:"brand.primary",mr:2,mb:"0.2rem"}),o]})]})})]}),(0,m.jsx)(tr,{})]})},to=e=>{let{isMobileDevice:t=!1,isLoading:n=!1,signingAnotherDeviceBtnLabel:i,signingCurrentDeviceBtnLabel:r,onAnotherDeviceSigning:a,onCurrentDeviceSigning:o}=e;return(0,m.jsxs)(U.k,{gap:4,flexDir:t?"column-reverse":"column",children:[(0,m.jsx)(eT.zx,{variant:t?"secondary":"primary",onClick:a,isLoading:n,children:(0,m.jsx)(X.x,{visibility:n?"hidden":"visible",children:i})}),(0,m.jsx)(eT.zx,{variant:t?"primary":"secondary",onClick:o,isLoading:n,children:(0,m.jsx)(X.x,{visibility:n?"hidden":"visible",children:r})})]})},tl=n(9678),ts=n(5675),tc=n.n(ts),td=e=>{let{qrCode:t,onCancel:n,isLoading:i,cancelButtonLabel:r,altTextQRCode:a}=e;return(0,m.jsxs)(U.k,{flexDir:"column",alignItems:"center",gap:2,children:[i&&(0,m.jsx)(ey.$,{color:"brand.blue"}),t&&!i&&(0,m.jsx)(tl.o,{w:"14rem",h:"14rem",mt:-4,children:(0,m.jsx)(tc(),{src:t,fill:!0,style:{objectFit:"cover"},alt:a})}),r&&(0,m.jsx)(eT.zx,{variant:"secondary",maxW:"17rem",width:"100%",paddingX:16,onClick:n,children:r})]})};(o=d||(d={})).startAuthenticate="startAuthenticate",o.outstandingTransaction="outstandingTransaction",o.userSign="userSign",o.userCancel="userCancel",o.startFailed="startFailed",o.bankIdOnFileReminder="bankIdOnFileReminder",o.signingInLoading="signingInLoading";let tm=async(e,t)=>{let n={"Content-Type":"application/json",ThisDeviceFlag:String(e),MobileBankIdFlag:String(!e||t),DesktopBankIdFlag:String(e&&!t)},i=await fetch("/api/bankid/handleAuthenticate/",{method:"POST",headers:n}),{sessionData:r}=await i.json();if(!i.ok)throw Error("Failed to initialize BankID (".concat(i.status,")"));if(!(null==r?void 0:r.sessionId)||!(null==r?void 0:r.autoStartToken)||!(null==r?void 0:r.QRCode))throw Error("Invalid BankID response structure");return{sessionId:r.sessionId,autoStartToken:r.autoStartToken,qrCode:r.QRCode}}
1,tu=async e=>{if(!e)return null;let t=await fetch("/api/bankid/pollBankIdStatus/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})}),{sessionObjectData:n}=await t.json();if(!t.ok)throw Error("Failed to initialize BankID (".concat(t.status,")"));if(!n)throw Error("missing sessionObjectData");return n},tg=async e=>{if(!e)return!1;let t=await fetch("/api/bankid/cancelBankIdSession/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})}),{data:n}=await t.json();return!!n};var tp=n(9742);let th=e=>{try{let t=null==e?void 0:e.replace("data:image/svg;base64,",""),n=(0,tp.b$)(t),i=new Uint8Array(n.length);i.set(n);let r=new Blob([i],{type:"image/svg+xml"});return URL.createObjectURL(r)}catch(e){return console.log('Something went wrong in the "encodeBase64String" function:',e),null}},tx=(e,t,n,i)=>{let{signingInitalHeading:r,signingInitialDescription:a,signingInitiatedHeading:o,signingOutstandingTransactionDescription:l,signingUserSignDescription:s,signingUserCancelHeading:c,signingUserCancelDescription:m,signingStartFailedHeading:u,signingStartFailedDescription:g,signingBankIdOnFileReminderDescription:p}=t;switch(e){case d.startAuthenticate:n(e=>({...e,isSigningFlowStarted:!1,heading:r,description:a}));break;case d.outstandingTransaction:n(e=>({...e,isLoading:!1,heading:o,description:l}));break;case d.userSign:n(e=>({...e,isLoading:!0,heading:o,description:s}));break;case d.userCancel:i(),n(e=>({...e,isLoading:!1,isSigningFailed:!0,heading:c,description:m}));break;case d.startFailed:i(),n(e=>({...e,isLoading:!1,isSigningFailed:!0,heading:u,description:g}));break;case d.bankIdOnFileReminder:n(e=>({...e,description:p}));break;case d.signingInLoading:n(e=>({...e,isLoading:!0,description:"Bokning signeras..."}))}},tf=(e,t,n)=>{let i=null;return!n||n&&e!==d.outstandingTransaction?i=e:n&&t>=10&&e===d.outstandingTransaction&&(i=d.bankIdOnFileReminder),i},tS=(0,x.createContext)(void 0),ty=()=>{let e=(0,x.useContext)(tS);if(!e)throw Error("useSigning must be used within a SigningProvider");return e},tb=e=>{let{children:t,signingProps:n,currentStep:i,modifyState:r,formInfo:a,errorMessagesProps:o,bookingDraftPendingSigning:s,selectedOfficeName:c,activeMeetingType:u,customBookingFlow:g,daysBetween:p,tellusOfficeId:h}=e,{signingInitalHeading:f,signingInitialDescription:S,isSigningStepEnabled:y}=n,[b,j]=(0,x.useState)({isLoading:!1,isSigningFlowStarted:!1,isSigningFailed:!1,heading:f,description:S}),T=(0,x.useRef)(!1),v=(0,x.useRef)(null),[k,w]=(0,x.useState)(null),[_,O]=(0,x.useState)(null),[E,I]=(0,x.useState)(!1),[C,N]=(0,x.useState)(null);(0,x.useEffect)(()=>{C&&tx(C,n,j,B)},[C]),(0,x.useEffect)(()=>{_&&P()},[_]);let P=async()=>{let e=await D(_);if(e.userAttributes){B();let{username:t,userAttributes:{name:n}}=e,d={...s,customerName:n,userName:t};r({type:l.SetFormInfo,payload:{...a,customerName:n}}),await tt({bookingObj:d,modifyState:r,isSigningStepEnabled:y,errorMessagesProps:o,currentStepIndex:J(i),tellusOfficeId:h,selectedOfficeName:c,activeMeetingType:u,customBookingFlow:g,daysBetween:p}),j(e=>({...e,isLoading:!1}))}},D=e=>new Promise((t,n)=>{T.current=!1;let i=0,r=async()=>{if(!T.current){if(i>20)B(),n({error:!0});else{i++;try{let n=await tu(e);if(T.current)return;n&&F(n,i,t)}catch(e){B()}T.current||(v.current=setTimeout(r,1500))}}};r()}),F=async(e,t,n)=>{e&&e.grandidObject&&await M(e.grandidObject,t),e.userAttributes&&(N(d.signingInLoading),n(e))},M=async(e,t)=>{try{let{QRCode:n,message:{hintCode:i}}=e;if(!E){let e=await th(n);w(e)}let r=await tf(i,t,E);r&&N(r)}catch(e){console.error("handleGrandIdObject failed",e)}},B=()=>{T.current=!0,R(),v.current&&(tg(_),clearTimeout(v.current),v.current=null)},R=()=>{w(null),O(null)};return(0,m.jsx)(tS.Provider,{value:{startSigningFlow:(e,t)=>{let n=async()=>await tm(e,t).then(t=>{let{sessionId:n,qrCode:i,autoStartToken:r}=t;I(e),O(n),e?window.open("bankid:///?autostarttoken=".concat(r,"&redirect=null"),"_self"):(w(th(i)),N(d.outstandingTransaction))});j(t=>({...t,isSigningFlowStarted:!0,isSigningFailed:!1,isLoading:!0,description:e?"\xd6ppnar BankID...":"H\xe4mtar QR-kod..."})),R(),n()},cancelSigningFlow:()=>{N(d.startAuthenticate),B()},qrCode:k,signingStatus:b},children:t})};var tj=e=>{let{}=e,{signingProps:{signingAnotherDeviceBtnLabel:t,signingCurrentDeviceBtnLabel:n,signingCancelBtnLabel:i}}=B(),{startSigningFlow:r,cancelSigningFlow:a,qrCode:o,signingStatus:{isSigningFlowStarted:l,isSigningFailed:s,isLoading:c,heading:d,description:u}}=ty(),g=(0,en.S)({base:!0,lg:!1});return(0,m.jsx)(U.k,{bg:"card.primary",justifyContent:"center",p:{base:5,md:12},children:(0,m.jsxs)(U.k,{flexDir:"column",alignItems:"center",gap:7,maxW:"420p
1x",children:[(0,m.jsxs)(U.k,{flexDir:"column",gap:4,textAlign:"center",alignItems:"center",maxW:"container.sm",children:[(0,m.jsx)(ed.lZ,{fontSize:16}),(0,m.jsx)(G.x,{as:"h2",textStyle:"heading.md",children:d}),(0,m.jsx)(G.x,{children:u})]}),l&&(0,m.jsx)(td,{qrCode:o,onCancel:a,isLoading:c,cancelButtonLabel:s?"F\xf6rs\xf6k igen":i,altTextQRCode:"QR-kod f\xf6r inloggning, bild"}),!l&&(0,m.jsx)(to,{isMobileDevice:g,isLoading:c,signingAnotherDeviceBtnLabel:t,signingCurrentDeviceBtnLabel:n,onAnotherDeviceSigning:()=>r(!1,!!g),onCurrentDeviceSigning:()=>r(!0,!!g)})]})})},tT=()=>{let{state:{bookingDraftPendingSigning:e,currentStep:t,formInfo:n,selectedOffice:i,meetingState:r,customBookingFlow:a,bookingInfo:o},modifyState:l,tellusOfficeId:s,signingProps:c,errorMessagesProps:d}=B(),{isSigningStepEnabled:u,signingButtonTextPrevStep:g,signingTitleLevelTwo:p}=c;if(!u||!e)return;let h=e8(o.dateStamp);return(0,m.jsx)(tb,{signingProps:c,currentStep:t,modifyState:l,formInfo:n,bookingDraftPendingSigning:e,errorMessagesProps:d,selectedOfficeName:i.name,activeMeetingType:r.activeMeetingType,customBookingFlow:a,daysBetween:h,tellusOfficeId:s,children:(0,m.jsxs)(eq,{children:[p&&(0,m.jsx)(G.x,{as:"h2",textStyle:"heading.lg",children:p}),(0,m.jsx)(tj,{}),(0,m.jsx)(eY,{prevButtonText:g})]})})},tv=e=>{let{headingOne:t,headingTwo:n,headingThere:i,headingFour:r,...a}=e,{state:{formInfo:{customerName:o,customerPhone:l,customerEmail:s,customerSocialSecurityNumber:c,customerNoSocialSecurityNumber:d,deceasedName:u,deceasedSocialSecurityNumber:g,notes:p}}}=B();return(0,m.jsxs)(U.k,{p:{base:5,lg:8},...a,w:{base:"100%",lg:"65%"},flexDir:{base:"column",lg:"row"},gap:{base:8,lg:0},children:[(0,m.jsxs)(ea.K,{flex:1,gap:{base:8,lg:12},children:[t&&(0,m.jsxs)(X.x,{children:[(0,m.jsx)(G.x,{as:"h3",textStyle:"heading.sm",mb:4,children:t}),(0,m.jsx)(G.x,{children:o}),!d&&(0,m.jsx)(G.x,{children:c}),(0,m.jsx)(G.x,{children:l}),(0,m.jsx)(G.x,{children:s})]}),n&&(0,m.jsx)(X.x,{children:(0,m.jsx)(G.x,{as:"h3",textStyle:"heading.sm",mb:4,children:n})})]}),(0,m.jsxs)(ea.K,{flex:1,gap:{base:8,lg:12},children:[i&&(0,m.jsxs)(X.x,{children:[(0,m.jsx)(G.x,{as:"h3",textStyle:"heading.sm",mb:4,children:i}),(0,m.jsx)(G.x,{children:u}),g&&(0,m.jsx)(G.x,{children:g})]}),r&&p&&(0,m.jsxs)(X.x,{children:[(0,m.jsx)(G.x,{as:"h3",textStyle:"heading.sm",mb:4,children:r}),(0,m.jsx)(G.x,{children:p})]})]})]})},tk=e=>{let{links:t,...n}=e;if(t)return(0,m.jsx)(U.k,{flexDir:"column",wordBreak:"break-word",...n,children:t.map((e,t)=>{var n,i;if(e)return(0,m.jsx)(eX.Z,{href:e.href,icon:e.icon,"aria-label":e.ariaLabel,iconSize:null!==(n=e.iconSize)&&void 0!==n?n:void 0,openInNewWindow:e.openInNewWindow,gtmAction:null!==(i=e.gtmAction)&&void 0!==i?i:void 0,children:e.name},t)})})},tw=e=>{let{heading:t,...n}=e,{state:{selectedOffice:{phoneNumber:i,email:r},bookingInfo:{caseWorkerName:a}}}=B(),[o,l]=(0,x.useState)(!1),s="".concat(b,"/").concat(r,".jpg"),c=[];return i&&c.push({name:i,href:"tel:".concat((0,e$.J)(i)),icon:ed.qW,ariaLabel:"Ring ".concat(a," p\xe5 telefonnummer: ").concat(i)}),r&&c.push({name:r,href:"mailto:".concat(r),icon:ed._M,iconSize:5,ariaLabel:"Maila ".concat(a," till: ").concat(r)}),(0,m.jsxs)(U.k,{w:{base:"100%",lg:"35%"},p:{base:5,lg:8},direction:"column",align:"center",position:"relative",bg:"bookOnline.primaryCase",...n,children:[(0,m.jsx)(X.x,{bg:"bookOnline.secondaryCase",position:"absolute",top:"0",width:"100%",height:o?"32px":"110px"}),s&&(0,m.jsx)(tl.o,{boxSize:"8.75rem",alignSelf:"start",ratio:1,display:o?"none":"",children:(0,m.jsx)(X.x,{borderRadius:"full",overflow:"hidden",children:(0,m.jsx)(tc(),{alt:"",src:s,fill:!0,style:{objectFit:"cover"},onError:()=>l(!0)})})}),(0,m.jsxs)(U.k,{direction:"column",gap:5,pt:8,alignSelf:"start",children:[t&&(0,m.jsx)(G.x,{as:"h3",textStyle:"heading.sm",children:t}),(0,m.jsxs)(X.x,{children:[a&&(0,m.jsx)(G.x,{fontWeight:700,fontSize:"body.md",pb:2,children:a}),!!c.length&&(0,m.jsx)(tk,{links:c,gap:2})]})]})]})},t_=n(2757),tO=n(1955),tE=n(9303);let tI=tE.Ryn({meetingTypeName:tE.Z_8(),event:tE.Z_8(),formInfo:tE.Ryn({customerEmail:tE.Dom().optional(),customerPhone:tE.Z_8().optional()})});var tC=e=>{var t,n,i,r,a,o,l,s,c,d;let m=tI.parse(e),u=null===(t=window.Cookiebot)||void 0===t?void 0:t.consent,g=S.m.GOOGLE_ANALYTICS_ID,p=null!==(n=null==u?void 0:u.marketing)&&void 0!==n&&n,h=null!==(i=null==u?void 0:u.statistics)&&void 0!==i&&i;try{let e={event:m.event,form_subject:m.meetingTypeName,email:p?m.formInfo.customerEmail:null,phone:p?m.formInfo.customerPhone:null,client_id:null!==(o=null===(r=tO.Z.get("_ga"))||void 0===r?void 0:r.split(".").slice(-2).join("."))&&void 0!==o?o:null,session_id:null!==(l=null===(a=tO.Z.get("_ga_".concat(g)))||void 0===a?void 0:a.split(".")[2].split("$")[0])&&void 0!==l?l:null,consent_marketing:p,consent_analytics:h,gclid:null!==(s=sessionStorage.getItem("gclid")||new URLSearchParams(window.location.search).get("gclid"))&&void 0!==s?s:null,_fbc:null!==(c=tO.Z.get("_fbc"))&&void 0!==c?c:null,_fbp:null!==(d=tO.Z.get("_fbp"))&&void 0!==d?d:null};fetch("/api/tracking",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}catch(e){console.error("Error tracking confirmation step:",e)}},tN=()=>{let{state:{bookingInfo:e,selectedOffice:t,meetingState:{meetingTypeName:n,activeMeetingType:i},formInfo:r},confirmationProps:{stepFourYourBookingTitle:a,stepFourSelectedOfficeLabel:o,stepFourSelectedMeetingLabel:l,stepFourContactPersonTitle:s,stepFourMeetingParticipantsTitle:c,stepFourDeceasedInfoTitle:d,stepFourNotesTitle:u,stepFourCaseWorkerTitle:g,stepFourBlockArea:p}}=B();(0,x.useEffect)(()=>{(0,w.Z)({event:"booking_confirmation",category:"boka_online",action:"confirmation_step",label:n,email:(null==r?void 0:r.customerEmail)||null,phone:(null==r?void 0:r.customerPhone)||null}),tC({meetingTypeName:n,event:"booking_confirmation",formInfo:{customerEmail:null==r?void 0:r.customerEmail,customerPhone:null==r?void 0:r.customerPhone}})},[]);let h="".concat(ef(e.day)," ").concat(e.shortDate," klockan ").concat(e.shortTime);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(eJ.W,{maxW:"container.page",children:(0,m.jsxs)(U.k,{flexDir:"column",gap:5,as:"section",children:[(0,m.jsx)(G.x,{as:"h2",textStyle:"heding.lg",children:a}),(0,m.jsxs)(eG,{children:[(0,m.jsx)(et,{bg:"bookOnline.primaryCard",heading:o,label:t.name,headingLevel:"h3",children:(0,m.jsx)(e0,{selectedOffice:t,gap:2,pt:5})}),(0,m.jsx)(et,{bg:"bookOnline.primaryCard",heading:l,headingLevel:"h3",children:(0,m.jsxs)(ea.K,{gap:2,pt:5,children:[(0,m.jsxs)(G.x,{children:[(0,m.jsx)(eU.J,{as:eH[i],color:"brand.primary",mr:2,mb:"0.2rem"}),n]}),(0,m.jsxs)(G.x,{children:[(0,m.jsx)(eU.J,{as:ed.T3,color:"brand.primary",mr:2,mb:"0.2rem"}),h]})]})})]}),(0,m.jsxs)(eG,{children:[(0,m.jsx)(tv,{headingOne:s,headingTwo:c,headingThere:d,headingFour:u,bg:"bookOnline.primaryCard"}),(0,m.jsx)(tw,{heading:g})]})]})}),(0,m.jsx)(t_.Z,{blockArea:p})]})},tP=e=>{let{query:{begravningsbyra:t,office:n,steg:i},asPath:r}=(0,g.useRouter)(),a=Array.isArray(t)?t[0]:t,o=Array.isArray(n)?n[0]:n,l=a||o,s=Array.isArray(i)?i[0]:i,c=Y(r,l);return(0,m.jsx)(L,{tellusOfficeId:l,queryStep:Number(s),selectOfficeProps:e.selectOfficeProps,selectTimeProps:e.selectTimeProps,signingProps:e.signingProps,formProps:e.formProps,confirmationProps:e.confirmationProps,errorMessagesPro
1ps:e.errorMessagesProps,children:(0,m.jsx)(tD,{...e,bookingStepCanonicalUrl:c})})};let tD=e=>{let{metaData:t,breadcrumbs:n,hero:i,bookingStepCanonicalUrl:r}=e,{state:{currentStep:a}}=B(),o={[s.StepOne]:{heading:i.stepOneHeroTitle,preamble:i.stepOneHeroPreamble},[s.StepTwo]:{heading:i.stepTwoHeroTitle,preamble:i.stepTwoHeroPreamble},[s.StepThree]:{heading:i.stepThreeHeroTitle,preamble:i.stepThreeHeroPreamble},[s.Signing]:{heading:i.signingHeroTitle,preamble:i.signingHeroPreamble},[s.StepFour]:{heading:i.stepFourHeroTitle,preamble:i.stepFourHeroPreamble}}[a];return(0,m.jsxs)(u.Z,{metadata:t,breadcrumbs:n,disableFooterMargin:a!==s.StepFour,clientCanonicalUrl:r,breadCrumbBackgroundColor:"transparent",children:[o&&(0,m.jsx)(h.Z,{...o,showPreambleAsEditorContent:!0,backgroundColor:"white"}),(0,m.jsx)(q,{}),a===s.StepOne&&(0,m.jsx)($,{}),a===s.StepTwo&&(0,m.jsx)(e1,{}),a===s.StepThree&&(0,m.jsx)(ta,{}),a===s.Signing&&(0,m.jsx)(tT,{}),a===s.StepFour&&(0,m.jsx)(tN,{})]})}},2757:function(e,t,n){n.d(t,{Z:function(){return c}});var i=n(5893),r=n(9101);n(7294);var a=n(8329),o=e=>{let{children:t,...n}=e;return(0,i.jsx)(a.k,{gap:{base:8,lg:12},mt:{base:8,lg:12},flexDir:"column",...n,children:t})},l=n(4630),s=n(2725),c=e=>{let{blockArea:t,blockStack:n=!0}=e;if(!(null==t?void 0:t.length))return console.warn("No block area found"),null;let r=t.map((e,t)=>{let n=d(e.contentType);return n?(0,i.jsx)(s.Z,{fallback:(0,i.jsxs)(l.Z,{children:["No block found for type: ",e.contentType]}),children:(0,i.jsx)(n,{...e})},t):(0,i.jsxs)(l.Z,{children:["No block found for type: ",e.contentType]},t)});return n?(0,i.jsx)(o,{children:r}):(0,i.jsx)(i.Fragment,{children:r})};let d=e=>e?r.v[e]||(console.warn("No component found for type: ".concat(e)),null):(console.warn("No content type found for block"),null)},5367:function(e,t,n){n.d(t,{m:function(){return i}});let i=e=>e.endsWith("/")?e:e+"/"},9497:function(e,t,n){n.d(t,{J:function(){return i}});let i=e=>e?((e=e.replace(/[\s\(\)-]/g,"")).startsWith("0")&&(e="+46"+e.slice(1)),e):null}}]);
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.