"use strict";exports.id=370,exports.ids=[370],exports.modules={18425:(a,b,c)=>{c.d(b,{z:()=>e});var d=c(96330);let e=globalThis.prisma??new d.PrismaClient({log:["error"]})},35320:(a,b,c)=>{c.d(b,{BE:()=>g,Er:()=>f,iu:()=>h});var d=c(87082),e=c.n(d);function f(a){return e().hash(a,10)}function g(a,b){return e().compare(a,b)}function h(){let a="abcdefghijkmnpqrstuvwxyz",b="23456789",c=a=>a[Math.floor(Math.random()*a.length)];return c("ABCDEFGHJKLMNPQRSTUVWXYZ")+c(a)+c(a)+c(b)+c(b)+c(b)+c(b)+c("!@#$%*")}},38370:(a,b,c)=>{c.d(b,{j2:()=>m,Y9:()=>l});var d=c(27620),e=c(14838),f=c(2995),g=c(18425),h=c(35320);let i={tentativesEchouees:0,verrouilleJusqua:null};var j=c(90462);let k=f.Ik({email:f.Yj().email(),password:f.Yj().min(1)}),{handlers:l,auth:m,signIn:n,signOut:o}=(0,d.Ay)({session:{strategy:"jwt"},trustHost:!0,providers:[(0,e.A)({credentials:{email:{},password:{}},authorize:async a=>{let b=k.safeParse(a);if(!b.success)return null;let{email:c,password:d}=b.data,e=await g.z.user.findUnique({where:{email:c},include:{tenants:{select:{tenantId:!0}}}});return!e||!e.actif||function(a,b=new Date){return!!a.verrouilleJusqua&&a.verrouilleJusqua>b}(e)?null:await (0,h.BE)(d,e.passwordHash)?((e.tentativesEchouees>0||e.verrouilleJusqua)&&await g.z.user.update({where:{id:e.id},data:{...i}}),{id:e.id,email:e.email,name:(0,j.Dc)(e),role:e.role,tenantIds:e.tenants.map(a=>a.tenantId)}):(await g.z.user.update({where:{id:e.id},data:function(a,b=new Date){let c=a+1;return{tentativesEchouees:c,verrouilleJusqua:c>=5?new Date(b.getTime()+9e5):null}}(e.tentativesEchouees)}),null)}})],callbacks:{jwt:async({token:a,user:b,trigger:c})=>{if(b&&(a.uid=b.id,a.role=b.role,a.tenantIds=b.tenantIds),"update"===c&&a.uid){let b=await g.z.userTenant.findMany({where:{userId:a.uid},select:{tenantId:!0}});a.tenantIds=b.map(a=>a.tenantId)}return a},session:({session:a,token:b})=>(a.user.id=b.uid,a.user.role=b.role,a.user.tenantIds=b.tenantIds??[],a)},pages:{signIn:"/login"}})},90462:(a,b,c)=>{c.d(b,{BC:()=>q,Dc:()=>f,ES:()=>m,Ey:()=>i,I2:()=>u,JP:()=>k,Ox:()=>r,Pz:()=>n,Zj:()=>h,bx:()=>t,fJ:()=>j,fn:()=>g,gg:()=>d,r2:()=>l,xN:()=>e,yQ:()=>s,zk:()=>p});let d=["admin","manager","superviseur","technicien","client"],e=["admin","manager","superviseur","technicien"];function f(a){return[a.prenom,a.nom].filter(Boolean).join(" ")}let g={admin:"Administrateur (exploitant)",manager:"Manager",superviseur:"Superviseur (lecture seule)",technicien:"Technicien",client:"Client"},h=5,i=["standard","prioritaire","critique_24_7"],j={standard:"Standard",prioritaire:"Prioritaire",critique_24_7:"Critique 24/7"},k={standard:240,prioritaire:60,critique_24_7:30},l={préventive:"Pr\xe9ventive",corrective:"Corrective",curative:"Curative",mise_en_service:"Mise en service",décommissionnement:"D\xe9commissionnement",upgrade:"Upgrade / \xe9volution"},m=["nouveau","planifi\xe9","en_cours","en_attente","termin\xe9","cl\xf4tur\xe9","annul\xe9"],n={nouveau:"Nouveau",planifié:"Planifi\xe9",en_cours:"En cours",en_attente:"En attente",terminé:"Termin\xe9",clôturé:"Cl\xf4tur\xe9",annulé:"Annul\xe9"},o={nouveau:["planifi\xe9","en_cours","annul\xe9"],planifié:["en_cours","en_attente","annul\xe9"],en_cours:["en_attente","termin\xe9","annul\xe9"],en_attente:["en_cours","annul\xe9"],terminé:["cl\xf4tur\xe9","en_cours"],clôturé:[],annulé:[]};function p(a,b){return o[a]?.includes(b)??!1}let q=["a_faire","en_cours","termin\xe9"],r=["termin\xe9e","r\xe9solue","en_attente_piece","a_replanifier","escalad\xe9e"],s=["photo","rapport_mesure","plan","pv","autre"],t=["conforme","anomalie","na","non_verifie"],u={optique:{perteConnecteurNorme_dB:.75,perteConnecteurObjectifInterne_dB:.35,perteEpissureNorme_dB:.3,perteEpissureObjectifInterne_dB:.1,returnLossUPC_dB:50,returnLossAPC_dB:60,returnLossEpissureMonomode_dB:26,attenuationOS2_dBparKm:1,attenuationMultimode850_dBparKm:3.5,attenuationMultimode1300_dBparKm:1.5},cuivre:{detoronnageCat6A_mm:13},electriqueThermique:{chargePDU_pourcentMax:80,tempEntreeAirMin_C:18,tempEntreeAirMax_C:27}}}};