@peculiar/fortify-webcomponents
Version:
Web-components for creating CSR or Certificate and viewing certificates list using Fortify
47 lines • 28.6 kB
JavaScript
/*!
* © Peculiar Ventures https://peculiarventures.com/ - BSD 3-Clause License
*/
import{h as t,r as e,c as r,H as o}from"./p-1b1223fb.js";import{bi as i,C as a}from"./p-4227eec7.js";import{T as s}from"./p-9932bc13.js";import{F as c,a as n,b as l,c as v,d as p,e as d,f as h,g as b,h as g,i as f,j as u}from"./p-6caa96bc.js";import{g as y,l as m}from"./p-3151627c.js";import"./p-435133f4.js";const x=e=>t("svg",Object.assign({},e,{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),t("path",{d:"M20.346 20.576a6.23 6.23 0 100-12.46 6.23 6.23 0 000 12.46z",stroke:"currentColor","stroke-miterlimit":"10"}),t("path",{d:"M20.346 23.692a9.346 9.346 0 100-18.692 9.346 9.346 0 000 18.692z",stroke:"currentColor","stroke-miterlimit":"10"}),t("path",{d:"M19.91 23.91L15.88 35l-1.702-2.939L11 33.224l4.03-11.09M20.772 23.91L24.812 35l1.692-2.939 3.188 1.163-4.04-11.09",stroke:"currentColor","stroke-miterlimit":"10"}));const w=e=>t("svg",Object.assign({},e,{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),t("path",{d:"M23.684 20.438a5.347 5.347 0 01-4.12 1.944 5.355 5.355 0 01-5.346-5.346c0-2.945 2.4-5.345 5.345-5.345.69 0 1.342.126 1.944.37V11.03a6.124 6.124 0 00-1.944-.311c-3.479 0-6.317 2.838-6.317 6.317 0 3.48 2.838 6.318 6.317 6.318a6.329 6.329 0 005.317-2.916h-1.196z",fill:"currentColor"}),t("path",{d:"M25.084 24.423a9.303 9.303 0 003.052-3.985h-1.05a8.251 8.251 0 01-7.523 4.86c-4.558 0-8.26-3.704-8.26-8.262s3.702-8.26 8.26-8.26c.671 0 1.322.077 1.944.232v-1a9.095 9.095 0 00-1.944-.205c-5.092 0-9.233 4.14-9.233 9.233 0 3.023 1.468 5.695 3.713 7.387L10 35.512l3.577-1.302 1.905 3.304 4.081-11.216 4.082 11.216 1.905-3.304 3.577 1.302-4.043-11.09zM15.287 35.22l-1.273-2.196-2.381.865 3.246-8.912a9.144 9.144 0 003.683 1.234l-3.275 9.01zm9.826-2.196L23.84 35.22l-3.276-9.01a9.144 9.144 0 003.684-1.233l3.246 8.912-2.381-.865z",fill:"currentColor"}),t("path",{"clip-rule":"evenodd",d:"M30.546 5.767A3.769 3.769 0 0026.78 2a3.769 3.769 0 00-3.766 3.767 3.76 3.76 0 002.354 3.482v7.338L26.779 18l1.413-1.413-1.173-1.172 1.173-1.173-1.173-1.173 1.173-1.172V9.249a3.768 3.768 0 002.354-3.482z",stroke:"currentColor","stroke-miterlimit":"10"}),t("path",{d:"M26.78 5.287a1.173 1.173 0 100-2.345 1.173 1.173 0 000 2.345z",fill:"currentColor"}))
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/;const _=e=>t("svg",Object.assign({},e,{viewBox:"0 0 24 24",width:"24px",height:"24px",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),t("path",{stroke:"currentColor","stroke-width":"1.5",d:"m14 18-6-6 6-6"}))
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/;const k=e=>t("svg",Object.assign({},e,{viewBox:"0 0 20 21",width:"20",height:"21",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),t("path",{fill:"currentColor",d:"M14.9 5.6c-1.225-1.313-2.975-2.1-4.9-2.1-3.85 0-7 3.15-7 7s3.15 7 7 7c3.238 0 5.95-2.275 6.738-5.25H14.9c-.7 2.012-2.625 3.5-4.9 3.5-2.888 0-5.25-2.363-5.25-5.25 0-2.888 2.362-5.25 5.25-5.25 1.488 0 2.713.612 3.675 1.575l-2.8 2.8H17V3.5l-2.1 2.1Z"}))
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/;const z=e=>{const{downloadAppLink:r}=e;return t(n,{title:y("unsupportedVersion.title"),description:y("unsupportedVersion.description")},t(c,{variant:"primary",href:r},y("actions.update")))};
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/const C=e=>{const{certificate:r,provider:o,isSelected:i,onClickDetails:a,onClick:n}=e;const l=t=>{t.stopPropagation();a(r.index)};const v=()=>{n(r.index)};const p=()=>{const{G:t,CN:e,SN:o,E:i}=r.subject;if(e){return e}if(t&&o){return`${t} ${o}`}if(i){return i}return r.subjectName};const d=p();const h=r.privateKeyId?w:x;return t("li",{role:"option",class:"certificates_list_item","aria-selected":String(i),onClick:v},t(h,{class:"certificates_list_item_icon"}),t("div",{class:"certificates_list_item_info"},t("div",null,t(s,{variant:"s2",color:"black"},d),t(s,{variant:"c1",color:"gray-9"},o===null||o===void 0?void 0:o.name)),t("table",{class:"certificates_list_item_table"},t("tbody",null,t("tr",null,t("td",null,t(s,{variant:"c2",color:"gray-9"},y("certificate.issuer"))),t("td",null,t(s,{variant:"c2",color:"gray-9"},r.issuer.CN))),t("tr",null,t("td",null,t(s,{variant:"c2",color:"gray-9"},y("certificate.valid"))),t("td",null,t(s,{variant:"c2",color:"gray-9"},new Date(r.notBefore).toLocaleDateString()," – ",new Date(r.notAfter).toLocaleDateString()))),t("tr",null,t("td",null,t(s,{variant:"c2",color:"gray-9"},y("certificate.serial"))),t("td",null,t(s,{variant:"c2",color:"gray-9"},r.serialNumber)))))),t(c,{class:"certificates_list_item_button",onClick:l},y("actions.details")))};
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/const j=e=>{const{onUpdate:r,onCancel:o,onContinue:i,onCertificate:a,onCertificateDetails:n,certificates:v=[],providers:p=[],helpPageLink:d,loading:h,allowContinue:b,certificateSelectedIndex:g}=e;const f=()=>[t(x,{class:"certificates_list_icon"}),t(s,{color:"gray-9",variant:"b3"},y("certificates.empty.title")),t(l,{href:d},y("actions.needHelp"))];const u=()=>t("peculiar-circular-progress",null);const m=()=>v.map((e=>t(C,{key:e.index,certificate:e,provider:p.find((t=>t.id===e.providerID)),isSelected:g===e.index,onClick:a,onClickDetails:n})));let w=null;switch(true){case h:w=t("div",{class:"certificates_list_content_center"},u());break;case v.length>0:w=t("ul",{role:"listbox"},m());break;default:w=t("div",{class:"certificates_list_content_center"},f())}return t("div",{class:"certificates_list"},t(s,{variant:"h5",color:"black"},y("certificates.title")),t("div",{class:"certificates_list_content"},w),t("div",{class:"certificates_list_actions container_actions"},t(c,{variant:"default",onClick:r,startIcon:t(k,null),disabled:h},y("actions.updateCertificates")),t("div",{class:"container_actions"},t(c,{onClick:o,disabled:h},y("actions.cancel")),t(c,{variant:"primary",disabled:h||!b,onClick:i},y("actions.continue")))))};const D="*{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none;-webkit-text-size-adjust:none;-webkit-tap-highlight-color:transparent;font-family:var(--pv-font-family, inherit)}.t-h1{font-weight:var(--pv-text-h1-weight);font-size:var(--pv-text-h1-size);line-height:var(--pv-text-h1-height);letter-spacing:var(--pv-text-h1-spacing)}.t-h2{font-weight:var(--pv-text-h2-weight);font-size:var(--pv-text-h2-size);line-height:var(--pv-text-h2-height);letter-spacing:var(--pv-text-h2-spacing)}.t-h3{font-weight:var(--pv-text-h3-weight);font-size:var(--pv-text-h3-size);line-height:var(--pv-text-h3-height);letter-spacing:var(--pv-text-h3-spacing)}.t-h4{font-weight:var(--pv-text-h4-weight);font-size:var(--pv-text-h4-size);line-height:var(--pv-text-h4-height);letter-spacing:var(--pv-text-h4-spacing)}.t-h5{font-weight:var(--pv-text-h5-weight);font-size:var(--pv-text-h5-size);line-height:var(--pv-text-h5-height);letter-spacing:var(--pv-text-h5-spacing)}.t-s1{font-weight:var(--pv-text-s1-weight);font-size:var(--pv-text-s1-size);line-height:var(--pv-text-s1-height);letter-spacing:var(--pv-text-s1-spacing)}.t-s2{font-weight:var(--pv-text-s2-weight);font-size:var(--pv-text-s2-size);line-height:var(--pv-text-s2-height);letter-spacing:var(--pv-text-s2-spacing)}.t-b1{font-weight:var(--pv-text-b1-weight);font-size:var(--pv-text-b1-size);line-height:var(--pv-text-b1-height);letter-spacing:var(--pv-text-b1-spacing)}.t-b2{font-weight:var(--pv-text-b2-weight);font-size:var(--pv-text-b2-size);line-height:var(--pv-text-b2-height);letter-spacing:var(--pv-text-b2-spacing)}.t-b3{font-weight:var(--pv-text-b3-weight);font-size:var(--pv-text-b3-size);line-height:var(--pv-text-b3-height);letter-spacing:var(--pv-text-b3-spacing)}.t-btn1{font-weight:var(--pv-text-btn1-weight);font-size:var(--pv-text-btn1-size);line-height:var(--pv-text-btn1-height);letter-spacing:var(--pv-text-btn1-spacing)}.t-btn2{font-weight:var(--pv-text-btn2-weight);font-size:var(--pv-text-btn2-size);line-height:var(--pv-text-btn2-height);letter-spacing:var(--pv-text-btn2-spacing)}.t-c1{font-weight:var(--pv-text-c1-weight);font-size:var(--pv-text-c1-size);line-height:var(--pv-text-c1-height);letter-spacing:var(--pv-text-c1-spacing)}.t-c2{font-weight:var(--pv-text-c2-weight);font-size:var(--pv-text-c2-size);line-height:var(--pv-text-c2-height);letter-spacing:var(--pv-text-c2-spacing)}.c-primary-tint-5{--pv-color-base:var(--pv-color-primary-tint-5)}.c-primary-tint-4{--pv-color-base:var(--pv-color-primary-tint-4)}.c-primary-tint-3{--pv-color-base:var(--pv-color-primary-tint-3)}.c-primary-tint-2{--pv-color-base:var(--pv-color-primary-tint-2)}.c-primary-tint-1{--pv-color-base:var(--pv-color-primary-tint-1)}.c-primary{--pv-color-base:var(--pv-color-primary)}.c-primary-shade-1{--pv-color-base:var(--pv-color-primary-shade-1)}.c-primary-shade-2{--pv-color-base:var(--pv-color-primary-shade-2)}.c-primary-shade-3{--pv-color-base:var(--pv-color-primary-shade-3)}.c-primary-shade-4{--pv-color-base:var(--pv-color-primary-shade-4)}.c-primary-shade-5{--pv-color-base:var(--pv-color-primary-shade-5)}.c-primary-contrast{--pv-color-base:var(--pv-color-primary-contrast)}.c-secondary-tint-5{--pv-color-base:var(--pv-color-secondary-tint-5)}.c-secondary-tint-4{--pv-color-base:var(--pv-color-secondary-tint-4)}.c-secondary-tint-3{--pv-color-base:var(--pv-color-secondary-tint-3)}.c-secondary-tint-2{--pv-color-base:var(--pv-color-secondary-tint-2)}.c-secondary-tint-1{--pv-color-base:var(--pv-color-secondary-tint-1)}.c-secondary{--pv-color-base:var(--pv-color-secondary)}.c-secondary-shade-1{--pv-color-base:var(--pv-color-secondary-shade-1)}.c-secondary-shade-2{--pv-color-base:var(--pv-color-secondary-shade-2)}.c-secondary-shade-3{--pv-color-base:var(--pv-color-secondary-shade-3)}.c-secondary-shade-4{--pv-color-base:var(--pv-color-secondary-shade-4)}.c-secondary-shade-5{--pv-color-base:var(--pv-color-secondary-shade-5)}.c-secondary-contrast{--pv-color-base:var(--pv-color-secondary-contrast)}.c-wrong-tint-5{--pv-color-base:var(--pv-color-wrong-tint-5)}.c-wrong-tint-4{--pv-color-base:var(--pv-color-wrong-tint-4)}.c-wrong-tint-3{--pv-color-base:var(--pv-color-wrong-tint-3)}.c-wrong-tint-2{--pv-color-base:var(--pv-color-wrong-tint-2)}.c-wrong-tint-1{--pv-color-base:var(--pv-color-wrong-tint-1)}.c-wrong{--pv-color-base:var(--pv-color-wrong)}.c-wrong-shade-1{--pv-color-base:var(--pv-color-wrong-shade-1)}.c-wrong-shade-2{--pv-color-base:var(--pv-color-wrong-shade-2)}.c-wrong-shade-3{--pv-color-base:var(--pv-color-wrong-shade-3)}.c-wrong-shade-4{--pv-color-base:var(--pv-color-wrong-shade-4)}.c-wrong-shade-5{--pv-color-base:var(--pv-color-wrong-shade-5)}.c-wrong-contrast{--pv-color-base:var(--pv-color-wrong-contrast)}.c-attention-tint-5{--pv-color-base:var(--pv-color-attention-tint-5)}.c-attention-tint-4{--pv-color-base:var(--pv-color-attention-tint-4)}.c-attention-tint-3{--pv-color-base:var(--pv-color-attention-tint-3)}.c-attention-tint-2{--pv-color-base:var(--pv-color-attention-tint-2)}.c-attention-tint-1{--pv-color-base:var(--pv-color-attention-tint-1)}.c-attention{--pv-color-base:var(--pv-color-attention)}.c-attention-shade-1{--pv-color-base:var(--pv-color-attention-shade-1)}.c-attention-shade-2{--pv-color-base:var(--pv-color-attention-shade-2)}.c-attention-shade-3{--pv-color-base:var(--pv-color-attention-shade-3)}.c-attention-shade-4{--pv-color-base:var(--pv-color-attention-shade-4)}.c-attention-shade-5{--pv-color-base:var(--pv-color-attention-shade-5)}.c-success-tint-5{--pv-color-base:var(--pv-color-success-tint-5)}.c-success-tint-4{--pv-color-base:var(--pv-color-success-tint-4)}.c-success-tint-3{--pv-color-base:var(--pv-color-success-tint-3)}.c-success-tint-2{--pv-color-base:var(--pv-color-success-tint-2)}.c-success-tint-1{--pv-color-base:var(--pv-color-success-tint-1)}.c-success{--pv-color-base:var(--pv-color-success)}.c-success-shade-1{--pv-color-base:var(--pv-color-success-shade-1)}.c-success-shade-2{--pv-color-base:var(--pv-color-success-shade-2)}.c-success-shade-3{--pv-color-base:var(--pv-color-success-shade-3)}.c-success-shade-4{--pv-color-base:var(--pv-color-success-shade-4)}.c-success-shade-5{--pv-color-base:var(--pv-color-success-shade-5)}.c-black{--pv-color-base:var(--pv-color-black)}.c-gray-10{--pv-color-base:var(--pv-color-gray-10)}.c-gray-9{--pv-color-base:var(--pv-color-gray-9)}.c-gray-8{--pv-color-base:var(--pv-color-gray-8)}.c-gray-7{--pv-color-base:var(--pv-color-gray-7)}.c-gray-6{--pv-color-base:var(--pv-color-gray-6)}.c-gray-5{--pv-color-base:var(--pv-color-gray-5)}.c-gray-4{--pv-color-base:var(--pv-color-gray-4)}.c-gray-3{--pv-color-base:var(--pv-color-gray-3)}.c-gray-2{--pv-color-base:var(--pv-color-gray-2)}.c-gray-1{--pv-color-base:var(--pv-color-gray-1)}.c-white{--pv-color-base:var(--pv-color-white)}.c-extra-1{--pv-color-base:var(--pv-color-extra-1)}.c-extra-2{--pv-color-base:var(--pv-color-extra-2)}.typography{color:var(--pv-color-base)}.button{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;background:transparent;border:1px solid transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;text-decoration:none;outline:none;font-family:inherit;border-radius:4px;height:var(--pv-size-base-7);min-width:var(--pv-size-base-7);padding:0 var(--pv-size-base-3);-webkit-transition:background-color 200ms ease 0s;transition:background-color 200ms ease 0s;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:var(--pv-size-base);font-size:0;-webkit-transition:background-color 200ms ease 0s, color 200ms ease 0s, border-color 200ms ease 0s, -webkit-box-shadow 200ms ease 0s;transition:background-color 200ms ease 0s, color 200ms ease 0s, border-color 200ms ease 0s, -webkit-box-shadow 200ms ease 0s;transition:background-color 200ms ease 0s, color 200ms ease 0s, box-shadow 200ms ease 0s, border-color 200ms ease 0s;transition:background-color 200ms ease 0s, color 200ms ease 0s, box-shadow 200ms ease 0s, border-color 200ms ease 0s, -webkit-box-shadow 200ms ease 0s}.button_child_text{color:inherit}.button:disabled{pointer-events:none;-webkit-box-shadow:none;box-shadow:none}.button_default{color:var(--pv-color-secondary)}.button_default:hover{background-color:var(--pv-color-secondary-tint-5)}.button_default:focus-visible{background-color:var(--pv-color-secondary-tint-4)}.button_default:active{background-color:var(--pv-color-secondary-tint-3)}.button_default:disabled{color:var(--pv-color-gray-7)}.button_secondary{border-color:var(--pv-color-gray-8);color:var(--pv-color-black)}.button_secondary:hover{background-color:var(--pv-color-gray-3)}.button_secondary:focus-visible{background-color:var(--pv-color-gray-4)}.button_secondary:active{background-color:var(--pv-color-gray-5)}.button_secondary:disabled{color:var(--pv-color-gray-7);border-color:var(--pv-color-gray-4)}.button_primary{background-color:var(--pv-color-primary);color:var(--pv-color-primary-contrast);-webkit-box-shadow:var(--pv-shadow-light-low);box-shadow:var(--pv-shadow-light-low)}.button_primary:hover{background-color:var(--pv-color-primary-tint-1)}.button_primary:focus-visible{background-color:var(--pv-color-primary-tint-2)}.button_primary:active{background-color:var(--pv-color-primary-tint-2);-webkit-box-shadow:var(--pv-shadow-light-medium);box-shadow:var(--pv-shadow-light-medium)}.button_primary:disabled{color:var(--pv-color-gray-8);background-color:var(--pv-color-gray-4)}.button_text{color:var(--pv-color-base);text-decoration:none;background:transparent;display:-ms-inline-flexbox;display:inline-flex;border:none;cursor:pointer;-webkit-transition:opacity 200ms ease 0s;transition:opacity 200ms ease 0s}.button_text:hover{opacity:0.7}.layout{height:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:var(--pv-color-white);border-radius:3px;overflow:hidden}.layout_main{-ms-flex:1 1 auto;flex:1 1 auto;overflow:auto;position:relative}.layout_footer{-ms-flex:0 0 auto;flex:0 0 auto;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;height:var(--pv-size-base-10);-ms-flex-align:center;align-items:center;padding:0px var(--pv-size-base-3);border-top:1px solid var(--pv-color-gray-5);gap:var(--pv-size-base-2);color:var(--pv-color-footer-text);background-color:var(--pv-color-footer)}.layout_footer_text{color:inherit}.mt_2{margin-top:var(--pv-size-base-2)}.mt_4{margin-top:var(--pv-size-base-4)}.mt_6{margin-top:var(--pv-size-base-6)}.container_status{height:100%;text-align:center;padding:var(--pv-size-base-12)}.container_status_logo{display:block;margin:0 auto var(--pv-size-base-6)}.container_status_illustration{margin-top:var(--pv-size-base-12);margin-bottom:var(--pv-size-base-10)}.container_status_actions{display:-ms-flexbox;display:flex;gap:var(--pv-size-base-2);-ms-flex-pack:center;justify-content:center}.container_status_authorization_number{height:var(--pv-size-base-8);width:var(--pv-size-base-6);border-radius:4px;border:1px solid var(--pv-color-gray-5);text-align:center;line-height:var(--pv-size-base-8)}.container_actions{display:-ms-flexbox;display:flex;gap:var(--pv-size-base-2)}[hidden]{display:none}:host{display:block;min-height:550px;height:550px}.certificates_list{padding:var(--pv-size-base-6);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--pv-size-base-4);height:100%}.certificates_list_content{border:1px solid var(--pv-color-gray-7);border-radius:4px;min-height:300px;overflow:auto;-ms-flex:1 1 auto;flex:1 1 auto}.certificates_list_content_center{height:100%;width:100%;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;display:-ms-flexbox;display:flex;padding:var(--pv-size-base-6);gap:var(--pv-size-base-2)}.certificates_list_icon{width:40px;color:var(--pv-color-gray-8);margin-bottom:var(--pv-size-base-2)}.certificates_list_actions{padding-top:var(--pv-size-base-2);-ms-flex-pack:justify;justify-content:space-between}.certificates_list_item{display:-ms-flexbox;display:flex;padding:var(--pv-size-base-3) var(--pv-size-base-4);gap:var(--pv-size-base-4);cursor:pointer;border-bottom:1px solid var(--pv-color-gray-4);-ms-flex-align:start;align-items:start;-webkit-transition:background-color 200ms ease 0s;transition:background-color 200ms ease 0s}.certificates_list_item_icon{width:40px;-ms-flex-negative:0;flex-shrink:0;color:var(--pv-color-gray-8);-webkit-transition:color 200ms ease 0s;transition:color 200ms ease 0s}.certificates_list_item_info{-ms-flex:1 1 auto;flex:1 1 auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--pv-size-base-2)}.certificates_list_item_button{-ms-flex-item-align:center;align-self:center;-ms-flex-negative:0;flex-shrink:0;visibility:hidden}.certificates_list_item_table{width:100%}.certificates_list_item_table td{vertical-align:top}.certificates_list_item_table td:first-child{width:50px}.certificates_list_item_table td:last-child{padding-left:var(--pv-size-base-2)}.certificates_list_item:hover{background-color:var(--pv-color-gray-1)}.certificates_list_item:hover .certificates_list_item_button{visibility:visible}.certificates_list_item[aria-selected=true]{background-color:var(--pv-color-gray-3)}.certificates_list_item[aria-selected=true] .certificates_list_item_icon{color:var(--pv-color-gray-9)}.certificate_details{position:absolute;width:100%;height:100%;z-index:1;top:0;left:0;overflow:hidden;background-color:var(--pv-color-white);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.certificate_details_header{border-bottom:1px solid var(--pv-color-gray-5);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:var(--pv-size-base-2) var(--pv-size-base-4);gap:var(--pv-size-base-4)}.certificate_details_content{-ms-flex:1 1 auto;flex:1 1 auto;overflow:auto}";const L=D;
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/var S=undefined&&undefined.__classPrivateFieldGet||function(t,e,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e==="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(t):o?o.value:e.get(t)};var A=undefined&&undefined.__classPrivateFieldSet||function(t,e,r,o,i){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e==="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r};var M;const P=class{constructor(t){e(this,t);this.selectionCancel=r(this,"selectionCancel",7);this.selectionSuccess=r(this,"selectionSuccess",7);M.set(this,void 0);this.debugEvents=[];this.handleDocumentKeydown=t=>{if(t.shiftKey&&t.code==="KeyR"){S(this,M,"f").options.filters={};this.tryGetData()}if(t.shiftKey&&t.code==="KeyD"){i(a.FromString(JSON.stringify(this.debugEvents,undefined,2)),`debug-fortify-wc.${Date.now()}`,"json","text/json")}};this.handleClickCancel=()=>{this.selectionCancel.emit()};this.handleClickContinue=()=>{const t=this.certificates.find((t=>t.index===this.certificateSelectedIndex));if(t){this.selectionSuccess.emit({certificateId:t.index,providerId:t.providerID,privateKeyId:t.privateKeyId,socketProvider:S(this,M,"f").server})}};this.handleClickUpdateCertificates=()=>{this.tryGetData()};this.handleClickTryAgain=async()=>{const t=await this.tryLogin();if(!t){return}await this.tryGetData()};this.handleClickCloseDetails=()=>{this.certificateBase64ForDetails=null};this.handleClickCertificate=t=>{this.certificateSelectedIndex=t};this.handleClickCertificateDetails=async t=>{const e=this.certificates.find((e=>e.index===t));if(e){this.certificateBase64ForDetails=a.ToBase64(e.raw)}};this.language=undefined;this.filters={};this.hideFooter=false;this.downloadAppLink="https://fortifyapp.com";this.helpPageLink="https://fortifyapp.com/help";this.certificateBase64ForDetails=undefined;this.providers=[];this.certificates=[];this.challenge=undefined;this.certificateSelectedIndex=undefined;this.isFetching={connectionDetect:"pending"}}componentWillLoad(){m.setLocale(this.language)}componentDidLoad(){A(this,M,new v({onDebug:t=>{this.debugEvents.push(t)},onClose:this.handleCloseConnection.bind(this),onProvidersAdded:this.tryGetData.bind(this),onProvidersRemoved:this.tryGetData.bind(this),filters:this.filters}),"f");this.start();document.addEventListener("keydown",this.handleDocumentKeydown)}disconnectedCallback(){S(this,M,"f").finish();document.removeEventListener("keydown",this.handleDocumentKeydown)}handleCloseConnection(){this.providers=[];this.certificates=[];this.certificateSelectedIndex=undefined;this.certificateBase64ForDetails=undefined;this.setFetching("connectionDetect","rejected")}async start(){this.setFetching("connectionDetect","pending");if(!S(this,M,"f").isConnectionSupported()){this.setFetching("connectionSupport","rejected");return}if(!await S(this,M,"f").isConnectionDetected()){this.setFetching("connectionDetect","rejected")}await S(this,M,"f").isConnectionDetectedAuto();this.setFetching("connectionDetect","pending");try{await S(this,M,"f").connect()}catch(t){console.error(t);if(t&&t.message){if(t.message.indexOf("update your client to the latest version")!==-1){this.setFetching("connectionClientUpdate","rejected")}}return}const t=await this.tryLogin();if(!t){return}await this.tryGetData()}async tryGetData(){this.setFetching("providers","pending");this.certificateSelectedIndex=undefined;this.providers=[];this.certificates=[];try{this.providers=await S(this,M,"f").getProviders();this.setFetching("providers","resolved")}catch(t){this.setFetching("providers","rejected");return}this.setFetching("certificates","pending");try{this.certificates=await S(this,M,"f").getCertificatesByProviders(this.providers);this.setFetching("certificates","resolved")}catch(t){this.setFetching("certificates","rejected")}}async tryLogin(){this.challenge=undefined;this.setFetching("connectionApprove","pending");try{const t=await S(this,M,"f").challenge();if(t){this.challenge=t;await S(this,M,"f").login()}this.setFetching("connectionApprove","resolved")}catch(t){this.setFetching("connectionApprove","rejected");return undefined}return true}setFetching(t,e){this.isFetching=Object.assign(Object.assign({},this.isFetching),{[t]:e})}static renderConnecting(){return t(d,null)}static renderFortifyAuthorization(e){return t(h,{pin:e})}renderFortifyNotDetected(){return t(b,{downloadAppLink:this.downloadAppLink})}renderFortifyClientUpdate(){return t(z,{downloadAppLink:this.downloadAppLink})}renderFortifyNotSupported(){return t(g,{onCancel:this.handleClickCancel})}renderChallengeNotApproved(){return t(f,{onCancel:this.handleClickCancel,onTryAgain:this.handleClickTryAgain})}renderCertificates(){return t(j,{certificates:this.certificates,providers:this.providers,certificateSelectedIndex:this.certificateSelectedIndex,onCertificate:this.handleClickCertificate,onCertificateDetails:this.handleClickCertificateDetails,onUpdate:this.handleClickUpdateCertificates,onCancel:this.handleClickCancel,onContinue:this.handleClickContinue,loading:this.isFetching.certificates==="pending"||this.isFetching.providers==="pending",allowContinue:!!this.certificateSelectedIndex,helpPageLink:this.helpPageLink})}renderProvidersEmpty(){return t(u,{onCancel:this.handleClickCancel,helpPageLink:this.helpPageLink})}static renderUnresolvedStatus(){return t(n,{title:"Someting went wrong for status",description:"ERROR"})}render(){let e=null;switch(true){case this.isFetching.connectionClientUpdate==="rejected":e=this.renderFortifyClientUpdate();break;case this.isFetching.connectionSupport==="rejected":e=this.renderFortifyNotSupported();break;case this.isFetching.connectionDetect==="rejected":e=this.renderFortifyNotDetected();break;case this.isFetching.connectionApprove==="rejected":e=this.renderChallengeNotApproved();break;case this.isFetching.connectionApprove==="pending"&&!!this.challenge:e=P.renderFortifyAuthorization(this.challenge);break;case this.isFetching.providers==="resolved"&&!this.providers.length:e=this.renderProvidersEmpty();break;case this.isFetching.providers==="pending"&&!!this.providers.length:e=this.renderCertificates();break;case!!this.isFetching.certificates:e=this.renderCertificates();break;case this.isFetching.connectionDetect==="pending":case this.isFetching.connectionSupport==="pending":case this.isFetching.connectionApprove==="pending":case this.isFetching.providers==="pending":e=P.renderConnecting();break;default:e=P.renderUnresolvedStatus()}return t(o,{key:"3562a8b6206f03166ac8a4b8f9b1f034b68f3863"},t(p,{key:"776e9f78f3861691119d8c3b71ef596812570858",hideFooter:this.hideFooter},this.certificateBase64ForDetails&&t("div",{key:"d9579600dbc7d634a0ed3b6043e76d5946186cea",class:"certificate_details",role:"presentation"},t("header",{key:"a431b3d5407e3dbbff8c96d2a5b2a1c71100da0f",class:"certificate_details_header"},t(c,{key:"864d6e0e26c5d85e6a9bd6d7220e4d65914f66ac",onClick:this.handleClickCloseDetails,startIcon:t(_,null)},y("actions.back")),t(s,{key:"96a161ca1a11ef5b31db2400c258f2f06c2ec634",variant:"h5",color:"black"},y("details.title"))),t("div",{key:"20d5b0b9ee8f9c5e77bfe74c076813bb1d955e08",class:"certificate_details_content"},t("peculiar-certificate-viewer",{key:"27f39275e41e94becdf8f4761c1e424219951061",certificate:this.certificateBase64ForDetails}))),e))}};M=new WeakMap;P.style=L;export{P as peculiar_fortify_certificates};
//# sourceMappingURL=p-0342cb89.entry.js.map