1import{bf as I,B as K,R as p,J as k,aW as O,A as $,e as U,f as J,g as B,p as E,E as A,a4 as P,aa as V}from"./index-CPXi7tQh.js";import{aq as G,a as M}from"./main-DyYoFkp9.js";import{_ as z}from"./CompanyLayout.vue_vue_type_script_setup_true_lang-DJH8IfCZ.js";import{f as H}from"./general-functions-gMqkeI7q.js";import{s as L}from"./@formkit-pro-gPB7B6Jc.js";import{d as T,r as f,u as x,v as C,T as u,x as m,A as d,k as w,S as _,l as Q,e as W,K as X,P as Y}from"./@chart-BXmWMIfR.js";import"./@ace-BEIQESsW.js";import"./@libsodium-BNugX1YT.js";import"./@moment-BLMuvzoS.js";import"./@jimber-shared-components-BR90iqQf.js";import"./multiple-logo-bg-C312Ls0j.js";function D(a){return Z(a)}function Z(a,e){return a==null?a:{id:a.id,name:a.name,content:a.content,createdAt:new Date(a.createdAt),companyId:a.companyId,company:a.company==null?void 0:I(a.company)}}function j(a){return ee(a)}function ee(a,e){return a==null?a:{securityAssessments:a.securityAssessments.map(D),size:a.size}}class se extends K{async createSecurityAssessmentRequestOpts(e){if(e.companyName==null)throw new p("companyName",'Required parameter "companyName" was null or undefined when calling createSecurityAssessment().');const s={},n={};this.configuration&&this.configuration.apiKey&&(n["x-pat"]=await this.configuration.apiKey("x-pat"));let t="/api/v1/companies/{companyName}/security-assessments";return t=t.replace("{companyName}",encodeURIComponent(String(e.companyName))),{path:t,method:"POST",headers:n,query:s}}async createSecurityAssessmentRaw(e,s){const n=await this.createSecurityAssessmentRequestOpts(e),t=await this.request(n,s);return new k(t,c=>D(c))}async createSecurityAssessment(e,s){return await(await this.createSecurityAssessmentRaw(e,s)).value()}async deleteSecurityAssessmentRequestOpts(e){if(e.id==null)throw new p("id",'Required parameter "id" was null or undefined when calling deleteSecurityAssessment().');if(e.companyName==null)throw new p("companyName",'Required parameter "companyName" was null or undefined when calling deleteSecurityAssessment().');const s={},n={};this.configuration&&this.configuration.apiKey&&(n["x-pat"]=await this.configuration.apiKey("x-pat"));let t="/api/v1/companies/{companyName}/security-assessments/{id}";return t=t.replace("{id}",encodeURIComponent(String(e.id))),t=t.replace("{companyName}",encodeURIComponent(String(e.companyName))),{path:t,method:"DELETE",headers:n,query:s}}async deleteSecurityAssessmentRaw(e,s){const n=await this.deleteSecurityAssessmentRequestOpts(e),t=await this.request(n,s);return new k(t,c=>D(c))}async deleteSecurityAssessment(e,s){return await(await this.deleteSecurityAssessmentRaw(e,s)).value()}async downloadSecurityAssessmentJsonRequestOpts(e){if(e.id==null)throw new p("id",'Required parameter "id" was null or undefined when calling downloadSecurityAssessmentJson().');if(e.companyName==null)throw new p("companyName",'Required parameter "companyName" was null or undefined when calling downloadSecurityAssessmentJson().');const s={},n={};this.configuration&&this.configuration.apiKey&&(n["x-pat"]=await this.configuration.apiKey("x-pat"));let t="/api/v1/companies/{companyName}/security-assessments/{id}/json";return t=t.replace("{id}",encodeURIComponent(String(e.id))),t=t.replace("{companyName}",encodeURIComponent(String(e.companyName))),{path:t,method:"GET",headers:n,query:s}}async downloadSecurityAssessmentJsonRaw(e,s){const n=await this.downloadSecurityAssessmentJsonRequestOpts(e),t=await this.request(n,s);return new O(t)}async downloadSecurityAssessmentJson(e,s){return await(await this.downloadSecurityAssessmentJsonRaw(e,s)).value()}async downloadSecurityAssessmentPDFRequestOpts(e){if(e.id==null)throw new p("id",'Required parameter "id" was null or undefined when calling downloadSecurityAssessmentPDF().');if(e.companyName==null)throw new p("companyName",'Required parameter "companyName" was null or undefined when calling downloadSecurityAssessmentPDF().');const s={},n={};this.configuration&&this.configuration.apiKey&&(n["x-pat"]=await this.configuration.apiKey("x-pat"));let t="/api/v1/companies/{companyName}/security-assessments/{id}/pdf";return t=t.replace("{id}",encodeURIComponent(String(e.id))),t=t.replace("{companyName}",encodeURIComponent(String(e.companyName))),{path:t,method:"GET",headers:n,query:s}}async downloadSecurityAssessmentPDFRaw(e,s){const n=await this.downloadSecurityAssessmentPDFRequestOpts(e),t=await this.request(n,s);return new O(t)}async downloadSecurityAssessmentPDF(e,s){return await(await this.downloadSecurityAssessmentPDFRaw(e,s)).value(
1)}async getSecurityAssessmentsRequestOpts(e){if(e.companyName==null)throw new p("companyName",'Required parameter "companyName" was null or undefined when calling getSecurityAssessments().');const s={};e.skip!=null&&(s.skip=e.skip),e.take!=null&&(s.take=e.take),e.fields!=null&&(s.fields=e.fields),e.search!=null&&(s.search=e.search),e.orderBy!=null&&(s.orderBy=e.orderBy),e.count!=null&&(s.count=e.count),e.filters!=null&&(s.filters=e.filters);const n={};this.configuration&&this.configuration.apiKey&&(n["x-pat"]=await this.configuration.apiKey("x-pat"));let t="/api/v1/companies/{companyName}/security-assessments";return t=t.replace("{companyName}",encodeURIComponent(String(e.companyName))),{path:t,method:"GET",headers:n,query:s}}async getSecurityAssessmentsRaw(e,s){const n=await this.getSecurityAssessmentsRequestOpts(e),t=await this.request(n,s);return new k(t,c=>j(c))}async getSecurityAssessments(e,s){return await(await this.getSecurityAssessmentsRaw(e,s)).value()}}function v(){const a=$.createApiClient(se);async function e(l){return a.getSecurityAssessments(l)}async function s(l){return a.downloadSecurityAssessmentPDF(l)}async function n(l){return a.downloadSecurityAssessmentJson(l)}async function t(l){return a.deleteSecurityAssessment(l)}async function c(l){return a.createSecurityAssessment(l)}return{getSecurityAssessments:e,downloadSecurityAssessmentPDF:s,downloadSecurityAssessmentJson:n,deleteSecurityAssessment:t,createSecurityAssessment:c}}const te=[{key:"name",displayName:"Report Name",enableSorting:!0},{key:"createdAt",displayName:"Creation Date",enableSorting:!0,formatter:a=>H(a.createdAt)}],ne={class:"flex flex-col gap-3 p-5"},ae=T({__name:"SecurityAssessmentDownloadModal",props:{companyName:{},securityAssessmentId:{},securityAssessmentName:{}},emits:["open"],setup(a,{expose:e,emit:s}){const n=f(!1),t=f(!1),c=f("pdf"),l=[{label:"PDF",value:"pdf"},{label:"JSON",value:"json"}],y=a,R=s,b=async()=>{n.value=!0,R("open")},S=async()=>{const{downloadSecurityAssessmentJson:g,downloadSecurityAssessmentPDF:i}=v();try{t.value=!0;let r;c.value==="pdf"?r=await i({companyName:y.companyName,id:y.securityAssessmentId}):r=await g({companyName:y.companyName,id:y.securityAssessmentId});const o=document.createElement("a");document.body.appendChild(o);const h=new Blob([r],{type:"octet/stream"}),N=window.URL.createObjectURL(h);o.href=N,o.download=`${y.securityAssessmentName}.${c.value}`,o.click(),document.body.removeChild(o),A({type:"success",text:"Security assessment downloaded successfully"})}catch(r){console.log(r),A({type:"error",text:"Couldn't download security assessment"})}finally{t.value=!1,n.value=!1}};return e({openModal:b}),(g,i)=>{const r=Q("FormKit");return C(),x(u(U),{show:n.value,onClose:i[3]||(i[3]=o=>n.value=!1)},{header:m(()=>[d(u(E),{type:"download"}),i[4]||(i[4]=w(" Download Security Assessment ",-1))]),content:m(()=>[d(r,{id:"downloadSecurityAssessmentForm",type:"form",actions:!1,onSubmit:S},{default:m(()=>[_("div",ne,[i[5]||(i[5]=_("div",{class:"text-gray-700 dark:text-gray-300"}," Please select the format to download this report. ",-1)),d(r,{modelValue:c.value,"onUpdate:modelValue":i[0]||(i[0]=o=>c.value=o),type:"dropdown",options:l,validation:"required",label:"Format",popover:"",deselect:!1},null,8,["modelValue"])])]),_:1})]),actions:m(()=>[d(u(J),{disabled:t.value,onClick:i[1]||(i[1]=o=>u(L)("downloadSecurityAssessmentForm"))},{default:m(()=>[...i[6]||(i[6]=[w("Download",-1)])]),_:1},8,["disabled"]),d(u(B),{class:"mr-2",onClick:i[2]||(i[2]=o=>n.value=!1)},{default:m(()=>[...i[7]||(i[7]=[w("Cancel",-1)])]),_:1})]),_:1},8,["show"])}}}),we=T({__name:"SecurityAssessment",props:{companyName:{}},setup(a){const e=f({enableSearch:!0,options:["all"]}),s=f(null),n=f(null),t=!(window.location.origin.includes("sase.jimber.io")||window.location.origin.includes("signal.jimber.io")),c=a,l=W(()=>({displayName:"Security Assessment",displayKey:"name",actions:{delete:{mode:"confirm",submitHandler:async r=>{const{deleteSecurityAssessment:o}=v();return o({companyName:c.companyName,id:r.id})}}}})),y=[{label:"Name",value:"name",type:"string"},{label:"Created At",value:"createdAt",type:"date"}],R={getEntities:async({pagination:r,filters:o,orderBy:h,advancedFilters:N})=>{const{getSecurityAssessments:q}=v();try{const F=await q({companyName:c.companyName,skip:r?.skip,take:r?.take,search:o?.searchString,orderBy:h,filters:N});return{size:F.size,entities:F.securityAssessments}}catch{A({type:"error",text:"Couldn't fetch security assessments"})}return{size:0,entities:[]}}},b=async()=>{const{createSecurityAssessment:r}=v();try{await r({companyName:c.companyName}),A({type:"success",text:"Security assessment generation started successfully"}),g()}catch{A({type:"error",text:"Couldn't start security assessment generation"})}},S=f(),g=()=>{S.value?.doReload()},i=r=>{n.value=r,setTimeout(()=>{s.value?.openModal()}
1,0)};return(r,o)=>(C(),x(z,null,{sectionTitle:m(()=>[...o[0]||(o[0]=[w(" Reports ",-1)])]),pageTitle:m(()=>[...o[1]||(o[1]=[w(" Security Assessment ",-1)])]),default:m(()=>[d(u(V),{ref_key:"crudTable",ref:S,headers:u(te),"entity-provider":R,"entity-options":l.value,"search-options":e.value,"show-reload-button":!1,"empty-message":"No security assessments found","backend-pagination-sorting":!0,pagination:{itemsPerPage:50},"show-get-started-component-if-empty":!1,"show-advanced-filter":!0,"advanced-filter-fields":y},Y({actions:m(({row:h})=>[d(u(P),{class:"text-primary-500 hover:text-primary-600 dark:text-tertiary-700 dark:hover:text-tertiary-600 hover:cursor-pointer",title:"Download",onClick:N=>i(h)},{default:m(()=>[d(u(M),{class:"h-6 w-6","aria-hidden":"true"})]),_:1},8,["onClick"])]),_:2},[t?{name:"header",fn:m(()=>[d(u(J),{"bg-color":"bg-pink-400",bgColorHover:"hover:bg-pink-300",class:"hover:cursor-pointer",onClick:b},{default:m(()=>[d(u(G),{class:"h-6 w-6 stroke-2 pr-2"}),o[2]||(o[2]=w(" Generate ",-1))]),_:1})]),key:"0"}:void 0]),1032,["headers","entity-options","search-options"]),n.value?(C(),x(ae,{key:0,ref_key:"downloadModal",ref:s,"company-name":c.companyName,"security-assessment-id":n.value.id,"security-assessment-name":n.value.name},null,8,["company-name","security-assessment-id","security-assessment-name"])):X("",!0)]),_:1}))}});export{we as default};
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.