(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{34772:function(e,t,r){Promise.resolve().then(r.bind(r,66995)),Promise.resolve().then(r.t.bind(r,2778,23)),Promise.resolve().then(r.bind(r,48128)),Promise.resolve().then(r.bind(r,22388)),Promise.resolve().then(r.bind(r,55881)),Promise.resolve().then(r.bind(r,52552)),Promise.resolve().then(r.bind(r,5942))},66995:function(e,t,r){"use strict";r.d(t,{default:function(){return O}});var n=r(81595),o=r(2265),i=r(99376),a=r(31691),s=r(70899),l=r(71495),c=r(71004),u=r(2069),d=r(59832),p=r(61910),h=r(33145),f=r(83064),m=r(64131),g=e=>{let{onMenuClick:t}=e,r=(0,a.Z)(),i=(0,s.Z)(r.breakpoints.down("sm")),[g,x]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{x(!!m.Z.get("auth_token"));let e=()=>{x(!!m.Z.get("auth_token"))};window.addEventListener("storage",e);let t=setInterval(e,1e3);return()=>{window.removeEventListener("storage",e),clearInterval(t)}},[]),(0,n.tZ)(l.Z,{position:"fixed",sx:{zIndex:r.zIndex.drawer+1},children:(0,n.tZ)(c.Z,{sx:{justifyContent:"space-between"},children:(0,n.BX)(u.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,n.tZ)(u.Z,{sx:{position:"relative",width:i?40:50,height:i?30:40},children:(0,n.tZ)(h.default,{src:f.Z,alt:"Logo",fill:!0,style:{objectFit:"contain"},priority:!0})}),g&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(u.Z,{sx:{mx:1,height:i?24:32,borderLeft:"1px solid ".concat(r.palette.divider)}}),(0,n.tZ)(d.Z,{color:"inherit","aria-label":"toggle drawer",onClick:t,children:(0,n.tZ)(p.Z,{})})]})]})})})},x=r(15273),Z=r(73261),A=r(11741),w=r(67051),P=r(46387),_=r(92253),v=r(52552),S=r(45008),I=r(3146),b=r(47080);function y(){let e=(0,S._)(["\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(100%);\n }\n"]);return y=function(){return e},e}let B=(0,I.F4)(y());var E=e=>{let{itemCount:t}=e,r=(0,a.Z)();return(0,n.tZ)(u.Z,{sx:{width:"100%",p:2},children:[...Array(t)].map((e,t)=>(0,n.BX)(u.Z,{sx:{position:"relative",overflow:"hidden",mb:1,borderRadius:1},children:[(0,n.tZ)(b.Z,{variant:"rectangular",width:"100%",height:48,sx:{backgroundColor:r.palette.action.hover,opacity:.7}}),(0,n.tZ)(u.Z,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,animation:"".concat(B," 2s infinite"),background:"linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent)"}})]},t))})},L=e=>{let{mobileOpen:t,handleDrawerToggle:r,isOpen:o,isMobile:a}=e,s=(0,i.useRouter)(),l=(0,i.usePathname)(),{userRole:d,logout:p,isLoading:h}=(0,v.a)(),f=[{text:"จัดการรหัสผู้ใช้งาน",path:"/admin/manageuser"},{text:"ข้อมูลบริษัทน้ำมัน",path:"/admin/company"},{text:"จัดการไฟล์บริษัท",path:"/admin/filecompany"},{text:"จัดการเรือประมง",path:"/admin/fishingboat"},{text:"ตรวจปล่อยเรือแม่",path:"/admin/uploadfile"},{text:"คำร้องอนุมัติแก้ไข",path:"/admin/requestapprove"},{text:"รายงานสรุปการ รับ-จ่าย",path:"/admin/summaryoil"},{text:"รายงานการแจ้งเตือนพฤติกรรมผิดปกติ",path:"/admin/notication"},{text:"เปลี่ยนรหัสผ่าน",path:"/admin/resetpassword"},{text:"ออกจากระบบ",path:"/logout",isLogout:!0}],m=[{text:"รายการจำหน่าย - รับ น้ำมันเขียว",path:"/user/registeroil"},{text:"จัดการเรือ",path:"/user/manageship"},{text:"จัดการไฟล์",path:"/user/uploadfile"},{text:"เปลี่ยนรหัสผ่าน",path:"/user/resetpassword"},{text:"ออกจากระบบ",path:"/logout",isLogout:!0}],g=[{text:"อัปโหลดไฟล์",path:"/uploadfile/upload"},{text:"เปลี่ยนรหัสผ่าน",path:"/uploadfile/resetpassword"},{text:"ออกจากระบบ",path:"/logout",isLogout:!0}],S=(()=>{switch(d){case"admin":return f;case"operator":return m;case"uploadfile":return g;default:return[]}})(),I=(0,n.BX)(u.Z,{sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"background.paper",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.1)",overflow:"hidden"},children:[(0,n.tZ)(c.Z,{sx:{px:3,py:2}}),h?(0,n.tZ)(E,{itemCount:S.length}):(0,n.tZ)(x.Z,{sx:{flexGrow:1,py:2},children:S.map(e=>{let t=l.startsWith(e.path)&&"/logout"!==e.path;return(0,n.tZ)(Z.ZP,{disablePadding:!0,sx:{mb:.5},children:(0,n.tZ)(A.Z,{onClick:()=>{e.isLogout?p():(s.push(e.path),a&&r())},selected:t,sx:{py:1,px:3,backgroundColor:t?"primary.light":"transparent",color:e.isLogout?"error.main":t?"primary.main":"text.primary","&:hover":{backgroundColor:e.isLogout?"error.light":t?"primary.light":"action.hover"},transition:"all 0.3s"},children:(0,n.tZ)(w.Z,{primary:(0,n.tZ)(P.Z,{variant:"body2",sx:{fontWeight:t||e.isLogout?600:400,color:e.isLogout?"error.main":"inherit"},children:e.text})})})},e.text)})})]});return(0,n.tZ)(n.HY,{children:a?(0,n.tZ)(_.ZP,{variant:"temporary",anchor:"left",open:t,onClose:r,ModalProps:{keepMounted:!0},sx:{"& .MuiDrawer-paper":{width:240,boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",height:"100%",mt:0,background:"linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%)",borderRadius:0,position:"fixed",top:0,left:0},zIndex:e=>e.zIndex.drawer+2},children:I}):(0,n.tZ)(_.ZP,{variant:"permanent",open:o,sx:{"& .MuiDrawer-paper":{width:240,boxShadow:3,borderRight:"none",transform:o?"none":"translateX(-100%)",transition:"transform 0.3s ease-in-out"}},children:I})})},R=e=>{let{isOpen:t,onClose:r,isMobile:o}=e;return(0,n.tZ)(u.Z,{component:"nav",sx:{position:o?"fixed":"relative",top:0,left:0,width:"100%",height:"100%",zIndex:e=>e.zIndex.drawer+2,pointerEvents:o&&!t?"none":"auto"},children:(0,n.tZ)(L,{mobileOpen:!!o&&t,handleDrawerToggle:r,isOpen:t,isMobile:o})})},U=r(35389),k=r(14474);let C=()=>{let e=(0,i.useRouter)(),t=(0,i.usePathname)(),[r,n]=(0,o.useState)(!0),[a,s]=(0,o.useState)(!1),l=["/admin"],c=["/user"],u=["/uploadfile"];return(0,o.useEffect)(()=>{(()=>{let r=m.Z.get("auth_token");if(!r){"/login"!==t&&e.replace("/login"),n(!1);return}try{let o=(0,k.o)(r);if("/"===t||"/login"===t){switch(o.role){case"admin":e.replace("/admin/manageuser");break;case"operator":e.replace("/user/registeroil");break;case"uploadfile":e.replace("/uploadfile/upload")}n(!1);return}if([...l,...c,...u].some(e=>t.startsWith(e))){let r=l.some(e=>t.startsWith(e)),i=c.some(e=>t.startsWith(e)),a=u.some(e=>t.startsWith(e));if("admin"===o.role&&(i||a))e.replace("/admin/manageuser");else if("operator"===o.role&&(r||a))e.replace("/user/registeroil");else if("uploadfile"===o.role&&(r||i))e.replace("/uploadfile/upload");else{n(!1);return}n(!1);return}n(!1)}catch(t){console.error("Error decoding token:",t),m.Z.remove("auth_token"),e.replace("/login"),n(!1)}})()},[t,e]),{isLoading:r,showChangePassword:a,setShowChangePassword:s}};var M=r(80080);function O(e){let{children:t}=e,r=(0,i.usePathname)(),l=(0,a.Z)(),c=(0,s.Z)(l.breakpoints.down("sm")),[d,p]=(0,o.useState)(!c),{isLoading:h,showChangePassword:f,setShowChangePassword:m}=C(),x=()=>{p(!d)};return h?(0,n.tZ)(u.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,n.tZ)(U.Z,{})}):"/login"===r?(0,n.BX)(n.HY,{children:[(0,n.BX)(u.Z,{sx:{width:"100%",height:"100vh",position:"relative",margin:0,padding:0,overflow:"hidden",bgcolor:"#fff"},children:[(0,n.tZ)(g,{onMenuClick:x,isMenuOpen:d}),(0,n.tZ)(u.Z,{sx:{width:"100%",height:"calc(100vh - 64px)",position:"absolute",top:64,left:0,bgcolor:"#fff"},children:t})]}),(0,n.tZ)(M.j,{open:f,onClose:()=>m(!1)})]}):"/not-found"!==r&&(r.startsWith("/admin")||r.startsWith("/user")||r.startsWith("/uploadfile"))?(0,n.BX)(n.HY,{children:[(0,n.BX)(u.Z,{sx:{display:"flex",minHeight:"100vh"},children:[(0,n.tZ)(g,{onMenuClick:x,isMenuOpen:d}),!c&&(0,n.tZ)(u.Z,{component:"nav",sx:{width:d?240:0,flexShrink:0,transition:"width 0.3s ease",zIndex:e=>e.zIndex.appBar-1},children:(0,n.tZ)(R,{isOpen:d,onClose:x,isMobile:c})}),(0,n.tZ)(u.Z,{component:"main",sx:{flexGrow:1,p:3,width:"100%",mt:"64px",mx:"auto",maxWidth:c?"100%":d?"calc(100% - 240px)":"100%",transition:"max-width 0.3s ease"},children:t}),c&&(0,n.tZ)(R,{isOpen:d,onClose:x,isMobile:c})]}),(0,n.tZ)(M.j,{open:f,onClose:()=>m(!1)})]}):(0,n.BX)(n.HY,{children:[(0,n.BX)(u.Z,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh"},children:[(0,n.tZ)(g,{onMenuClick:x,isMenuOpen:d}),(0,n.tZ)(u.Z,{component:"main",sx:{flexGrow:1,mt:"64px",mx:"auto",p:3,width:"100%",maxWidth:"1200px"},children:t})]}),(0,n.tZ)(M.j,{open:f,onClose:()=>m(!1)})]})}},66287:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return l}});var n=r(81595);r(2265);var o=r(31691),i=r(2069),a=r(35389),s=r(46387);function l(){let e=(0,o.Z)();return(0,n.BX)(i.Z,{sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255, 255, 255, 0.8)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",zIndex:9999},children:[(0,n.tZ)(i.Z,{sx:{position:"relative",width:100,height:100,animation:"pulse 1.5s infinite ease-in-out","@keyframes pulse":{"0%":{transform:"scale(0.95)"},"50%":{transform:"scale(1.05)"},"100%":{transform:"scale(0.95)"}}},children:(0,n.tZ)(a.Z,{size:100,thickness:4,sx:{color:e.palette.primary.main}})}),(0,n.tZ)(s.Z,{variant:"h6",sx:{color:e.palette.primary.main,marginTop:2,fontWeight:"bold"},children:"กำลังโหลด..."})]})}},48128:function(e,t,r){"use strict";r.d(t,{AuthWrapper:function(){return h}});var n=r(81595),o=r(2265),i=r(99376),a=r(2069),s=r(35389),l=r(64131),c=r(80080),u=r(14474);let d=["/admin"],p=["/user"];function h(e){let{children:t}=e,r=(0,i.useRouter)(),h=(0,i.usePathname)(),[f,m]=(0,o.useState)(!0),[g,x]=(0,o.useState)(!1);return((0,o.useEffect)(()=>{(()=>{let e=l.Z.get("auth_token"),t=l.Z.get("role");if("/"===h){e?"admin"===t?r.replace("/admin/manageuser"):"operator"===t&&r.replace("/user/registeroil"):r.replace("/login");return}if("/login"===h){e?"admin"===t?r.replace("/admin/manageuser"):"operator"===t&&r.replace("/user/registeroil"):m(!1);return}if([...d,...p].some(e=>h.startsWith(e))){if(!e){r.replace("/login");return}let n=d.some(e=>h.startsWith(e)),o=p.some(e=>h.startsWith(e));"admin"===t&&o?r.replace("/admin/manageuser"):"operator"===t&&n&&r.replace("/user/registeroil")}m(!1)})()},[h,r]),(0,o.useEffect)(()=>{let e=()=>{let e=l.Z.get("auth_token");if(e)try{let t=(0,u.o)(e);"0"===t.firsttime&&x(!0)}catch(e){console.error("Error decoding token:",e)}};e();let t=setInterval(e,100);return()=>clearInterval(t)},[h]),f)?(0,n.tZ)(a.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,n.tZ)(s.Z,{})}):(0,n.BX)(n.HY,{children:[t,(0,n.tZ)(c.j,{open:g,onClose:()=>x(!1)})]})}},80080:function(e,t,r){"use strict";r.d(t,{j:function(){return _}});var n=r(81595),o=r(2265),i=r(35791),a=r(79507),s=r(46387),l=r(77468),c=r(2069),u=r(12713),d=r(23996),p=r(59832),h=r(15735),f=r(9026),m=r(94013),g=r(14759),x=r(94395),Z=r(819),A=r(83464),w=r(70704),P=r(64131);let _=e=>{let{open:t}=e,[r,_]=(0,o.useState)({currentPassword:"",newPassword:"",confirmPassword:""}),[v,S]=(0,o.useState)({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[I,b]=(0,o.useState)({currentPassword:"",newPassword:"",confirmPassword:""}),[y,B]=(0,o.useState)(!1),[E,L]=(0,o.useState)(""),[R,U]=(0,o.useState)(!1),k=()=>{let e={currentPassword:"",newPassword:"",confirmPassword:""};return r.currentPassword||(e.currentPassword="กรุณากรอกรหัสผ่านปัจจุบัน"),r.newPassword&&r.newPassword.length<6&&(e.newPassword="รหัสผ่านต้องมีความยาวอย่างน้อย 6 ตัวอักษร"),r.newPassword!==r.confirmPassword&&(e.confirmPassword="รหัสผ่านไม่ตรงกัน"),b(e),!Object.values(e).some(e=>""!==e)},C=async()=>{if(k()){B(!0),L("");try{let e=P.Z.get("auth_token");await A.Z.post(w.t2,{current_password:r.currentPassword,new_password:r.newPassword},{headers:{Authorization:"Bearer ".concat(e)}}),U(!0),setTimeout(()=>{Object.keys(P.Z.get()).forEach(e=>{P.Z.remove(e)}),window.location.href="/login"},1500)}catch(r){if(A.Z.isAxiosError(r)){var e,t;console.error("Error changing password:",r),L((null===(t=r.response)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.message)||"เกิดข้อผิดพลาดในการเปลี่ยนรหัสผ่าน")}else console.error("Unexpected error:",r),L("เกิดข้อผิดพลาดที่ไม่คาดคิด")}finally{B(!1)}}};return(0,n.BX)(i.Z,{open:t,maxWidth:"sm",fullWidth:!0,PaperProps:{elevation:3,sx:{borderRadius:2,p:2}},children:[(0,n.BX)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1,color:"primary.main"},children:[(0,n.tZ)(Z.Z,{color:"primary"}),(0,n.tZ)(s.Z,{variant:"h6",component:"span",fontWeight:"600",children:"เปลี่ยนรหัสผ่านครั้งแรก"})]}),(0,n.tZ)(l.Z,{children:(0,n.BX)(c.Z,{sx:{my:2},children:[(0,n.tZ)(s.Z,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"กรุณาตั้งรหัสผ่านใหม่เพื่อความปลอดภัยของบัญชีผู้ใช้งาน"}),(0,n.tZ)(u.Z,{fullWidth:!0,placeholder:"รหัสผ่านปัจจุบัน",type:v.currentPassword?"text":"password",value:r.currentPassword,onChange:e=>_(t=>({...t,currentPassword:e.target.value})),error:!!I.currentPassword,helperText:I.currentPassword,sx:{mb:3},InputProps:{endAdornment:r.currentPassword&&(0,n.tZ)(d.Z,{position:"end",children:(0,n.tZ)(p.Z,{onClick:()=>S(e=>({...e,currentPassword:!e.currentPassword})),edge:"end",children:v.currentPassword?(0,n.tZ)(g.Z,{}):(0,n.tZ)(x.Z,{})})})}}),(0,n.tZ)(u.Z,{fullWidth:!0,placeholder:"รหัสผ่านใหม่",type:v.newPassword?"text":"password",value:r.newPassword,onChange:e=>_(t=>({...t,newPassword:e.target.value})),error:!!I.newPassword,helperText:r.newPassword&&r.newPassword.length<6?"รหัสผ่านต้องมีความยาวอย่างน้อย 6 ตัวอักษร":" ",InputProps:{endAdornment:r.newPassword&&(0,n.tZ)(d.Z,{position:"end",children:(0,n.tZ)(p.Z,{onClick:()=>S(e=>({...e,newPassword:!e.newPassword})),edge:"end",children:v.newPassword?(0,n.tZ)(g.Z,{}):(0,n.tZ)(x.Z,{})})})}}),(0,n.tZ)(u.Z,{fullWidth:!0,placeholder:"ยืนยันรหัสผ่านใหม่",type:v.confirmPassword?"text":"password",value:r.confirmPassword,onChange:e=>_(t=>({...t,confirmPassword:e.target.value})),error:!!I.confirmPassword,helperText:I.confirmPassword,sx:{mb:3},InputProps:{endAdornment:r.confirmPassword&&(0,n.tZ)(d.Z,{position:"end",children:(0,n.tZ)(p.Z,{onClick:()=>S(e=>({...e,confirmPassword:!e.confirmPassword})),edge:"end",children:v.confirmPassword?(0,n.tZ)(g.Z,{}):(0,n.tZ)(x.Z,{})})})}}),E&&(0,n.tZ)(h.Z,{severity:"error",sx:{mt:2,"& .MuiAlert-message":{fontWeight:500}},children:"รหัสผ่านปัจจุบันไม่ถูกต้อง"===E?"รหัสผ่านปัจจุบันไม่ถูกต้อง":"เกิดข้อผิดพลาดในการเปลี่ยนรหัสผ่าน"}),R&&(0,n.tZ)(h.Z,{severity:"success",sx:{mt:2,"& .MuiAlert-message":{fontWeight:500}},children:"เปลี่ยนรหัสผ่านสำเร็จ"})]})}),(0,n.tZ)(f.Z,{sx:{px:3,pb:2},children:(0,n.tZ)(m.Z,{variant:"contained",onClick:C,disabled:y,fullWidth:!0,children:y?"กำลังบันทึก...":"บันทึกรหัสผ่าน"})})]})}},22388:function(e,t,r){"use strict";r.d(t,{ClientCookiesProvider:function(){return i}});var n=r(81595),o=r(89087);function i(e){let{children:t}=e;return(0,n.tZ)(o.cY,{children:t})}},70704:function(e,t,r){"use strict";r.d(t,{IM:function(){return g},wp:function(){return B},UT:function(){return A},m6:function(){return h},m_:function(){return d},VG:function(){return N},op:function(){return Z},sM:function(){return E},Bv:function(){return w},g7:function(){return F},O4:function(){return j},Xb:function(){return s},u:function(){return S},nS:function(){return I},GN:function(){return _},sS:function(){return v},G4:function(){return i},XU:function(){return l},cm:function(){return U},S_:function(){return p},Nn:function(){return m},I:function(){return z},IV:function(){return X},gJ:function(){return c},dF:function(){return o},Oh:function(){return b},KE:function(){return u},WX:function(){return y},nT:function(){return C},rL:function(){return M},Kj:function(){return W},xF:function(){return O},nw:function(){return f},xK:function(){return R},t2:function(){return a},qj:function(){return D},dO:function(){return P},CB:function(){return k},Nf:function(){return x},z:function(){return H},k2:function(){return T},f0:function(){return L}});let n={API_BASE_URL:r(40257).env.NEXT_PUBLIC_API_BASE_URL||"https://mpmac.go.th/api"},o="".concat(n.API_BASE_URL,"/login"),i="".concat(n.API_BASE_URL,"/userinfo"),a="".concat(n.API_BASE_URL,"/resetpassword"),s="".concat(n.API_BASE_URL,"/companies"),l="".concat(n.API_BASE_URL,"/users"),c="".concat(n.API_BASE_URL,"/users"),u="".concat(n.API_BASE_URL,"/users"),d="".concat(n.API_BASE_URL,"/users"),p="".concat(n.API_BASE_URL,"/requests"),h="".concat(n.API_BASE_URL,"/requests/approve"),f="".concat(n.API_BASE_URL,"/requests/reject"),m="".concat(n.API_BASE_URL,"/companies/ship");n.API_BASE_URL;let g="".concat(n.API_BASE_URL,"/fishingboats"),x="".concat(n.API_BASE_URL,"/fishingboats"),Z="".concat(n.API_BASE_URL,"/fishingboats"),A="".concat(n.API_BASE_URL,"/fishingboats"),w="".concat(n.API_BASE_URL,"/record/files/company"),P="".concat(n.API_BASE_URL,"/oiltransactions/report"),_="".concat(n.API_BASE_URL,"/notificationlogs"),v="".concat(n.API_BASE_URL,"/notificationtypes"),S="".concat(n.API_BASE_URL,"/ships"),I="".concat(n.API_BASE_URL,"/ships/company"),b="".concat(n.API_BASE_URL,"/ships"),y="".concat(n.API_BASE_URL,"/ships"),B="".concat(n.API_BASE_URL,"/oiltransactions"),E="".concat(n.API_BASE_URL,"/oiltransactions"),L="".concat(n.API_BASE_URL,"/oiltransactions/detail"),R="".concat(n.API_BASE_URL,"/oiltransactions/request");n.API_BASE_URL;let U="".concat(n.API_BASE_URL,"/vessels/search"),k="".concat(n.API_BASE_URL,"/oiltransactions/summary"),C="".concat(n.API_BASE_URL,"/record/add"),M="".concat(n.API_BASE_URL,"/record/date"),O="".concat(n.API_BASE_URL,"/record/update");n.API_BASE_URL;let W="".concat(n.API_BASE_URL,"/record/file"),z="".concat(n.API_BASE_URL,"/otp/request"),X="".concat(n.API_BASE_URL,"/otp/verify"),T="".concat(n.API_BASE_URL,"/upload/files"),j="".concat(n.API_BASE_URL,"/upload/files/ship"),H="".concat(n.API_BASE_URL,"/upload/files/data"),F="".concat(n.API_BASE_URL,"/upload/files"),D="".concat(n.API_BASE_URL,"/upload/ships/search"),N="".concat(n.API_BASE_URL,"/upload/file")},55881:function(e,t,r){"use strict";r.d(t,{LoadingProvider:function(){return s}});var n=r(81595),o=r(2265),i=r(66287);let a=(0,o.createContext)(void 0),s=e=>{let{children:t}=e,[r,s]=(0,o.useState)(!1),l=(0,o.useCallback)(()=>s(!0),[]),c=(0,o.useCallback)(()=>s(!1),[]);return(0,n.BX)(a.Provider,{value:{isLoading:r,showLoading:l,hideLoading:c},children:[t,r&&(0,n.tZ)(i.default,{})]})}},52552:function(e,t,r){"use strict";r.d(t,{UserProvider:function(){return u},a:function(){return d}});var n=r(81595),o=r(2265),i=r(83464),a=r(64131),s=r(70704);let l={getToken:()=>a.Z.get("auth_token"),setRole:e=>a.Z.set("role",e,{path:"/",secure:!0,sameSite:"strict"}),setUserInfo:e=>a.Z.set("user_info",JSON.stringify(e),{path:"/",secure:!0,sameSite:"strict"}),clearAll:()=>{Object.keys(a.Z.get()).forEach(e=>{a.Z.remove(e,{path:"/"})}),a.Z.remove("auth_token",{path:"/"}),a.Z.remove("role",{path:"/"}),a.Z.remove("user_info",{path:"/"}),localStorage.clear(),sessionStorage.clear()}},c=(0,o.createContext)(void 0),u=e=>{let{children:t}=e,[r,a]=(0,o.useState)(null),[u,d]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{(async()=>{let e=l.getToken();if(e)try{var t;let r=await i.Z.get(s.G4,{headers:{Authorization:"Bearer ".concat(e)}});if(200===r.status&&(null===(t=r.data)||void 0===t?void 0:t.role)){let e=r.data.role;"admin"===e||"operator"===e||"uploadfile"===e?(a(e),l.setRole(e),l.setUserInfo(r.data)):(a(null),l.clearAll())}else a(null),l.clearAll()}catch(e){console.error("Failed to fetch user info:",e),a(null),l.clearAll()}else a(null),l.clearAll();d(!1)})()},[]),(0,n.tZ)(c.Provider,{value:{userRole:r,setUserRole:a,logout:()=>{a(null),l.clearAll(),window.location.href="/login"},isLoading:u},children:t})},d=()=>{let e=(0,o.useContext)(c);if(void 0===e)throw Error("useUser must be used within a UserProvider");return e}},5942:function(e,t,r){"use strict";r.d(t,{default:function(){return Z}});var n=r(81595),o=r(32029),i=r.n(o),a=r(93062),s=r(99163),l=r(99267),c=r(59619),u=r(2265),d=r(78242),p=r(34692),h=r(99376);function f(e){let{options:t,CacheProvider:r=p.C,children:o}=e,[{cache:i,flush:a}]=u.useState(()=>{let e=(0,d.Z)(t);e.compat=!0;let r=e.insert,n=[];return e.insert=function(){for(var t=arguments.length,o=Array(t),i=0;i{let e=n;return n=[],e}}});return(0,h.useServerInsertedHTML)(()=>{let e=a();if(0===e.length)return null;let t="";for(let r of e)t+=i.inserted[r];return(0,n.tZ)("style",{"data-emotion":"".concat(i.key," ").concat(e.join(" ")),dangerouslySetInnerHTML:{__html:t}},i.key)}),(0,n.tZ)(r,{value:i,children:o})}let m={typography:{fontFamily:i().style.fontFamily,h1:{fontSize:"2.5rem","@media (min-width:600px)":{fontSize:"3rem"}},h2:{fontSize:"2rem","@media (min-width:600px)":{fontSize:"2.5rem"}}},palette:{background:{default:"#f1f1f1"},primary:{main:"#0E4285",dark:"#0D315F"},secondary:{main:"#242A44"},text:{primary:"#000000"}},breakpoints:{values:{xs:0,sm:600,md:960,lg:1280,xl:1920}}},g=(0,s.Z)(m),x={MuiTextField:{styleOverrides:{root:{"& .MuiInputBase-root":{fontSize:"0.875rem",height:"40px",lineHeight:"40px",transition:"all 0.3s ease-in-out"},"& .MuiInputBase-input":{height:"40px",padding:"0 14px",textIndent:"4px",letterSpacing:"0.5px"},"& .MuiOutlinedInput-input::placeholder":{lineHeight:"1.5",overflow:"visible",textOverflow:"initial"},"& .MuiInputLabel-root":{fontSize:"0.875rem",transform:"translate(14px, 12px) scale(1)","&.MuiInputLabel-shrink":{transform:"translate(14px, -6px) scale(0.75)"}},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"8px",transition:"all 0.3s ease-in-out"},"&.MuiTextField-multiline":{"& .MuiInputBase-root":{height:"auto",minHeight:"40px"},"& .MuiOutlinedInput-input":{overflow:"auto",minHeight:"40px",lineHeight:"1.5",padding:"12px 14px"}}}}},MuiSelect:{styleOverrides:{select:{fontSize:"0.875rem",padding:"8px 14px"}}},MuiMenuItem:{styleOverrides:{root:{fontSize:"0.875rem",minHeight:"35px",padding:"6px 16px"}}},MuiList:{styleOverrides:{root:{padding:"4px 0"}}},MuiPopover:{styleOverrides:{paper:{marginTop:"4px"}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:(g=(0,l.Z)(g)).palette.background.default,boxShadow:g.shadows[3]}}},MuiAppBar:{styleOverrides:{root:{zIndex:g.zIndex.drawer+1}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:"8px",transition:"all 0.3s ease-in-out","&:hover":{"& .MuiOutlinedInput-notchedOutline":{borderColor:g.palette.primary.main,boxShadow:"0 0 3px ".concat(g.palette.primary.main,"33")}},"&.Mui-focused":{"& .MuiOutlinedInput-notchedOutline":{borderColor:g.palette.primary.main,borderWidth:"2px",boxShadow:"0 0 5px ".concat(g.palette.primary.main,"66, \n 0 0 8px ").concat(g.palette.primary.main,"33")}}}}},MuiIconButton:{styleOverrides:{root:{"& .MuiSvgIcon-root":{fontSize:"18px"}}}}};function Z(e){let{children:t}=e;return(0,n.tZ)(f,{options:{key:"mui"},children:(0,n.BX)(c.Z,{theme:g,children:[(0,n.tZ)(a.ZP,{}),t]})})}g.components=x},2778:function(){},83064:function(e,t){"use strict";t.Z={src:"/_next/static/media/logotmp.9fc1c6b6.png",height:2052,width:1994,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAdVBMVEVMaXEMF1k7OWL/bUddWW+/jlUlLWAZKFn//KYzNGO5uaKSkZOFe3VZTU1+cWhrJ0BYTU6Wl5pCNkU8O1//RR3/jDP/bCuIWFL/TR85LkVxNFJMT3ESJGiJZ2///5v/jVxbWX2JEzd9DzdPSW5wPClqOyyiLD7U7JERAAAAIHRSTlMA/O13vC79/Br7N9bZ/rnw/rL+0nkUXoh6/urL+oASWAe5yDYAAAAJcEhZcwAAITcAACE3ATNYn3oAAABFSURBVHicBcEFAoAgAACxQ0HA7g7A+P8T3RimLoq246T/ksTuPmb2ul2EjxmDfl4dLlQlilqvBsrbWtcAKncuSwGMlAZ+oRoD1hzOCcYAAAAASUVORK5CYII=",blurWidth:8,blurHeight:8}}},function(e){e.O(0,[9805,3951,1869,6246,4013,8796,8199,4560,7018,2640,1608,3464,110,1536,6782,2971,2117,1744],function(){return e(e.s=34772)}),_N_E=e.O()}]);