module.exports=[193695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},650645,a=>{a.n(a.i(827572))},923576,a=>{a.n(a.i(104858))},517537,a=>{a.n(a.i(903363))},13718,a=>{a.n(a.i(685523))},118198,a=>{a.n(a.i(545518))},262212,a=>{a.n(a.i(866114))},438478,a=>{a.n(a.i(827478))},845662,a=>a.a(async(b,c)=>{try{var d=a.i(766518),e=b([d]);function f(){return d.prisma.sop.findMany({orderBy:{updatedAt:"desc"},include:{category:!0,author:{select:{id:!0,name:!0}},reviewer:{select:{id:!0,name:!0}},approver:{select:{id:!0,name:!0}}}})}function g(a){return d.prisma.sop.findUnique({where:{id:a},include:{category:!0,author:{select:{id:!0,name:!0}},reviewer:{select:{id:!0,name:!0}},approver:{select:{id:!0,name:!0}}}})}function h(){return d.prisma.user.findMany({where:{isActive:!0},select:{id:!0,name:!0,role:!0},orderBy:{name:"asc"}})}[d]=e.then?(await e)():e,a.s(["getSopById",()=>g,"getSops",()=>f,"getUsers",()=>h]),c()}catch(a){c(a)}},!1),809369,a=>a.a(async(b,c)=>{try{var d=a.i(766518),e=b([d]);function f(){return d.prisma.sopCategory.findMany({orderBy:{sortOrder:"asc"},include:{_count:{select:{sops:!0}}}})}[d]=e.then?(await e)():e,a.s(["getSopCategories",()=>f]),c()}catch(a){c(a)}},!1),455460,a=>{"use strict";a.s(["SopForm",()=>b]);let b=(0,a.i(211857).registerClientReference)(function(){throw Error("Attempted to call SopForm() from the server but SopForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/(sa-tools)/sa-tools/sops/_components/SopForm.tsx <module evaluation>","SopForm")},739917,a=>{"use strict";a.s(["SopForm",()=>b]);let b=(0,a.i(211857).registerClientReference)(function(){throw Error("Attempted to call SopForm() from the server but SopForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/(sa-tools)/sa-tools/sops/_components/SopForm.tsx","SopForm")},789023,a=>{"use strict";a.i(455460);var b=a.i(739917);a.n(b)},46080,a=>a.a(async(b,c)=>{try{var d=a.i(907997);a.i(570396);var e=a.i(673727),f=a.i(109307),g=a.i(451569),h=a.i(845662),i=a.i(809369),j=a.i(789023),k=b([f,h,i]);async function l({params:a}){let b=await (0,f.auth)();b?.user||(0,e.redirect)("/admin/login");let c=b.user.role;(0,g.hasPermission)(c,"sops.edit")||(0,e.redirect)("/sa-tools/sops");let{id:k}=await a,[l,m,n]=await Promise.all([(0,h.getSopById)(k),(0,i.getSopCategories)(),(0,h.getUsers)()]);l||(0,e.notFound)(),("APPROVED"===l.status||"SUPERSEDED"===l.status)&&(0,e.redirect)("/sa-tools/sops");let o={title:l.title,categoryId:l.categoryId,purpose:l.purpose,scope:l.scope,responsibilities:l.responsibilities,definitions:l.definitions??"",procedure:l.procedure,references:l.references??"",safetyNotes:l.safetyNotes??"",effectiveDate:l.effectiveDate?l.effectiveDate.toISOString().split("T")[0]:"",reviewDate:l.reviewDate?l.reviewDate.toISOString().split("T")[0]:"",reviewerId:l.reviewerId??""};return(0,d.jsx)(j.SopForm,{sopId:k,documentNumber:l.documentNumber,version:l.version,defaultValues:o,categories:m,users:n})}[f,h,i]=k.then?(await k)():k,a.s(["default",()=>l]),c()}catch(a){c(a)}},!1)];

//# sourceMappingURL=%5Broot-of-the-server%5D__727b1504._.js.map