PageSourceSearch

https://studycafe.se/_next/static/chunks/9417-fdd3d07d0db17400.js

js studycafe.se collected 2026-10-08 03:21:33 UTC 7,349 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9417],{47776:function(e,o,i){i.d(o,{M:function(){return n}});let n=e=>{var o,i,n,s,t,l,a,r;let d=((null==e?void 0:null===(o=e.remainingBookablePasses)||void 0===o?void 0:o.paidIndiviualPass)||0)+((null==e?void 0:null===(i=e.remainingBookablePasses)||void 0===i?void 0:i.bonusPass)||0)+((null==e?void 0:null===(n=e.remainingBookablePasses)||void 0===n?void 0:n.renewableOneOnOnePass)||0)+((null==e?void 0:null===(s=e.remainingBookablePasses)||void 0===s?void 0:s.renewableQueuePass)||0),u=((null==e?void 0:null===(t=e.remainingBookablePasses)||void 0===t?void 0:t.renewableQueuePass)||0)+((null==e?void 0:null===(l=e.remainingBookablePasses)||void 0===l?void 0:l.bonusPass)||0),c=((null==e?void 0:null===(a=e.remainingBookablePasses)||void 0===a?void 0:a.renewableOneOnOnePass)||0)+((null==e?void 0:null===(r=e.remainingBookablePasses)||void 0===r?void 0:r.paidIndiviualPass)||0);return{totalPasses:d,queuePassTickets:u,oneOnOneTickets:c}}},79417:function(e,o,i){i.d(o,{j:function(){return E}});var n=i(85893),s=i(55008),t=i(7631),l=i(19294),a=i(99226),r=i(15861),d=i(26447),u=i(48885),c=i(23795),m=i(46901),x=i(92401),p=i(78462),h=i(67720),v=i(63730),g=i(67294),f=i(25675),P=i.n(f),b=i(22120),j=i(33489),k=i(81010),Z=i(81134),w=i(86501),T=i(67218),B=i(50613),C=i(57409),y=i(11163),S=i.n(y),D=i(47776);let F={title:{fontSize:"20px",fontWeight:"500",lineHeight:"32px"},passTitle:{fontSize:"16px",fontWeight:"400",lineHeight:"24px",letterSpacing:"0em"},itemContainer:{paddingRight:"0px",paddingLeft:"0px"},itemTitle:{fontSize:"16px",fontWeight:"600",lineHeight:"24px"},description:{color:"#4B494FCC",fontSize:"12px",lineHeight:"14px"},itemIcon:{height:"40px",width:"40px",left:"0px",top:"0px",borderRadius:"5px",padding:"9px",backgroundColor:"#FFEDF0",textAlign:"center",verticalAlign:"middle"}},I=()=>(0,n.jsx)(P(),{src:C.Z,alt:"BookPass",width:24,height:24}),M={height:300},E=e=>{let{containerStyles:o=M,showTitle:i=!0,page:f,hidePassCount:P=!1}=e,{t:C}=(0,b.$G)(),y=()=>S().push("/book"),E=(0,t.m)(),{subscription:z}=(0,T.a)(),{totalPasses:H,queuePassTickets:O,oneOnOneTickets:R}=(0,D.M)(z),{bookedPasses:A,setBookedPasses:Q}=(0,j.b)(),{showConfirmation:W}=(0,Z.p)(),L=g.useMemo(()=>null==A?void 0:A.filter(e=>{let o=new Date,i=new Date(e.endTime);return i>o}),[A]),_=g.useMemo(()=>null==L?void 0:L.filter(e=>e.status===s.mZ.Approved),[L]),N=g.useMemo(()=>null==L?void 0:L.filter(e=>e.status===s.mZ.Pending),[L]),q=g.useMemo(()=>null==L?void 0:L.filter(e=>e.status===s.mZ.Denied),[L]),G=g.useMemo(()=>null==L?void 0:L.filter(e=>e.status===s.mZ.Waitlist),[L]),K=async()=>{let e=await E.bookedPass.getAll();if(e.error)throw console.error(e.error),Error(e.error);let o=e.data.sort((e,o)=>{let i=new Date(e.startTime),n=new Date(o.startTime);return i.getTime()-n.getTime()});Q(o)};g.useEffect(()=>{K()},[]);let $=async e=>{let o=await W({title:C("bookedPassComponent.cancelPassConfirmationTitle"),message:C("bookedPassComponent.cancelPassConfirmationDescription")});if(!o)return;let i=await E.bookedPass.delete(e);if(!i.ok){w.ZP.error(C("bookedPassComponent.cancelPassErrorMessage"),{duration:5e3});return}w.ZP.success(C("bookedPassComponent.cancelPassSuccessMessage"),{duration:5e3}),K()},J=async(e,o)=>{try{if(o===s.IF.QueuePass)throw Error("Cannot join room for QueuePass shifts");if(!e)throw Error("Room ID not found");let i=await E.room.get(e);if(i.error)throw Error(i.error.message);await S().push("/rooms/".concat(i.data.roomKey))}catch(e){var i;console.error(e),w.ZP.error((null===(i=e.error)||void 0===i?void 0:i.message)||"Failed to join room",{duration:5e3})}},U=(e,o)=>{var i,t,c,m,x;let p=(null===(i=e.shift)||void 0===i?void 0:i.type)===s.IF.QueuePass;return(0,n.jsxs)(l.ZP,{sx:{...F.itemContainer,display:"flex",width:"100%"},children:[(0,n.jsx)(a.Z,{sx:F.itemIcon,children:(0,n.jsx)(r.Z,{sx:{...F.itemTitle,fontSize:"24px"},children:null===(t=e.shift)||void 0===t?void 0:null===(c=t.name)||void 0===c?void 0:c.charAt(0)})}),(0,n.jsxs)(d.Z,{sx:{marginLeft:"12px",flex:1},children:[(0,n.jsx)(r.Z,{sx:F.itemTitle,children:null===(m=e.shift)||void 0===m?void 0:m.name}),(0,n.jsx)(r.Z,{sx:F.description,children:function(e){if(!e||!e.startTime||!e.endTime)return;let o=new Intl.DateTimeFormat("sv-SE",{month:"short",day:"numeric"}).format(new Date(e.startTime)),i=new Date(e.startTime).toLocaleTimeString("sv-se",{hour:"2-digit",minute:"2-digit"}),n=new Date(e.endTime).toLocaleTimeString("sv-se",{hour:"2-digit",minute:"2-digit"});return"".concat(o," | ").concat(i," - ").concat(n)}(e)})]}),(null===(x=e.shift)||void 0===x?void 0:x.roomId)&&(0,n.jsx)(u.Z,{sx:{minWidth:"auto",ml:"auto",cursor:p?"default":"pointer"},onClick:()=>
1{if(!p){var o,i;J(null===(o=e.shift)||void 0===o?void 0:o.roomId,null===(i=e.shift)||void 0===i?void 0:i.type)}},children:(0,n.jsx)(v.Z,{icon:"mdi:open-in-app",fontSize:20})}),(0,n.jsx)(k.Z,{iconProps:{fontSize:20},iconButtonProps:{size:"small"},menuProps:{sx:{"& .MuiMenuItem-root svg":{mr:2}}},options:[{text:C("components.bookedPasses.cancelBookingButtonText"),icon:(0,n.jsx)(v.Z,{icon:"mdi:trashcan-outline",fontSize:20,color:"red"}),menuItemProps:{onClick:o=>{$(e.id)}}}]})]},o)};return(0,n.jsxs)(a.Z,{sx:o,children:[!P&&(0,n.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,n.jsx)(B.Z,{label:C("components.bookedPasses.oneOnOnePassesRemaining",{count:R}),color:"info",sx:{color:"#000",fontFamily:"12px",borderRadius:"5px"}}),(0,n.jsx)(B.Z,{label:C("components.bookedPasses.queuePassesRemaining",{count:O}),color:"info",sx:{color:"#000",fontFamily:"12px",borderRadius:"5px"}})]}),(0,n.jsx)(a.Z,{sx:{display:"flex",justifyContent:"space-between"},children:i&&(0,n.jsx)(r.Z,{sx:F.title,children:C("bookedPassComponent.title")})}),!((null==A?void 0:A.length)>0||(null==G?void 0:G.length)>0||(null==N?void 0:N.length)>0||(null==q?void 0:q.length)>0)&&(0,n.jsx)(a.Z,{mt:4,sx:{display:"flex",flexDirection:"column",gap:2},children:(0,n.jsx)(a.Z,{children:(0,n.jsx)(c.Z,{onClick:"dashboard"===f?y:void 0,sx:{cursor:"dashboard"===f?"pointer":"default"},children:(0,n.jsxs)(m.Z,{icon:(0,n.jsx)(a.Z,{sx:{display:"flex",alignSelf:"center"},children:(0,n.jsx)(I,{})}),variant:"standard",color:"info",children:[(0,n.jsx)(x.Z,{children:C("components.bookedPasses.noBookedPassesTitle")}),"dashboard"===f&&C("components.bookedPasses.goToCalendarToBook")]})})})}),(0,n.jsx)(p.Z,{sx:{maxHeight:"95%",overflow:"auto"},children:null==_?void 0:_.map(U)}),(null==G?void 0:G.length)>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.Z,{sx:{marginTop:"12px",marginBottom:"12px"}}),(0,n.jsx)(r.Z,{sx:F.passTitle,children:C("components.bookedPasses.waitlist")}),(0,n.jsx)(p.Z,{sx:{maxHeight:"95%",overflow:"auto"},children:null==G?void 0:G.map(U)})]}),(null==N?void 0:N.length)>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.Z,{sx:{marginTop:"12px",marginBottom:"12px"}}),(0,n.jsx)(r.Z,{sx:F.passTitle,children:C("components.bookedPasses.unhandledBooking")}),(0,n.jsx)(p.Z,{sx:{maxHeight:"95%",overflow:"auto"},children:null==N?void 0:N.map(U)})]}),(null==q?void 0:q.length)>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.Z,{sx:{marginTop:"12px",marginBottom:"12px"}}),(0,n.jsx)(r.Z,{sx:F.passTitle,children:C("components.bookedPasses.rejectedBookings")}),(0,n.jsx)(p.Z,{sx:{maxHeight:"95%",overflow:"auto"},children:null==q?void 0:q.map(U)})]})]})}}}]);

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.