passbolt-styleguide 5.18.2 → 5.19.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/RELEASE_NOTES.md +7 -2
  2. package/build/css/themes/default/api_authentication.min.css +4 -4
  3. package/build/css/themes/default/api_main.min.css +4 -4
  4. package/build/css/themes/default/ext_app.min.css +4 -4
  5. package/build/css/themes/default/ext_authentication.min.css +4 -4
  6. package/build/css/themes/default/ext_external.min.css +2 -2
  7. package/build/css/themes/default/ext_in_form_cta.min.css +4 -4
  8. package/build/css/themes/default/ext_in_form_menu.min.css +4 -4
  9. package/build/css/themes/default/ext_quickaccess.min.css +4 -4
  10. package/build/css/themes/layette/api_authentication.min.css +4 -4
  11. package/build/css/themes/layette/api_main.min.css +4 -4
  12. package/build/css/themes/layette/ext_app.min.css +4 -4
  13. package/build/css/themes/layette/ext_authentication.min.css +4 -4
  14. package/build/css/themes/layette/ext_in_form_cta.min.css +4 -4
  15. package/build/css/themes/layette/ext_in_form_menu.min.css +4 -4
  16. package/build/css/themes/layette/ext_quickaccess.min.css +4 -4
  17. package/build/css/themes/midgar/api_authentication.min.css +4 -4
  18. package/build/css/themes/midgar/api_main.min.css +4 -4
  19. package/build/css/themes/midgar/ext_app.min.css +4 -4
  20. package/build/css/themes/midgar/ext_authentication.min.css +4 -4
  21. package/build/css/themes/midgar/ext_in_form_cta.min.css +4 -4
  22. package/build/css/themes/midgar/ext_in_form_menu.min.css +4 -4
  23. package/build/css/themes/midgar/ext_quickaccess.min.css +4 -4
  24. package/build/css/themes/sakura/api_authentication.min.css +4 -4
  25. package/build/css/themes/sakura/api_main.min.css +4 -4
  26. package/build/css/themes/sakura/ext_app.min.css +4 -4
  27. package/build/css/themes/sakura/ext_authentication.min.css +4 -4
  28. package/build/css/themes/sakura/ext_in_form_cta.min.css +4 -4
  29. package/build/css/themes/sakura/ext_in_form_menu.min.css +4 -4
  30. package/build/css/themes/sakura/ext_quickaccess.min.css +4 -4
  31. package/build/css/themes/solarized_dark/api_authentication.min.css +4 -4
  32. package/build/css/themes/solarized_dark/api_main.min.css +4 -4
  33. package/build/css/themes/solarized_dark/ext_app.min.css +4 -4
  34. package/build/css/themes/solarized_dark/ext_authentication.min.css +4 -4
  35. package/build/css/themes/solarized_dark/ext_in_form_cta.min.css +4 -4
  36. package/build/css/themes/solarized_dark/ext_in_form_menu.min.css +4 -4
  37. package/build/css/themes/solarized_dark/ext_quickaccess.min.css +4 -4
  38. package/build/css/themes/solarized_light/api_authentication.min.css +4 -4
  39. package/build/css/themes/solarized_light/api_main.min.css +4 -4
  40. package/build/css/themes/solarized_light/ext_app.min.css +4 -4
  41. package/build/css/themes/solarized_light/ext_authentication.min.css +4 -4
  42. package/build/css/themes/solarized_light/ext_in_form_cta.min.css +4 -4
  43. package/build/css/themes/solarized_light/ext_in_form_menu.min.css +4 -4
  44. package/build/css/themes/solarized_light/ext_quickaccess.min.css +4 -4
  45. package/build/css/themes/themes.json +1 -0
  46. package/build/js/dist/api-account-recovery.js +1 -1
  47. package/build/js/dist/api-app.js +1 -1
  48. package/build/js/dist/api-feedback.js +1 -1
  49. package/build/js/dist/api-mfa-verify-delegated.js +1 -1
  50. package/build/js/dist/api-mfa-verify.js +1 -1
  51. package/build/js/dist/api-recover.js +1 -1
  52. package/build/js/dist/api-setup.js +1 -1
  53. package/build/js/dist/api-triage.js +1 -1
  54. package/build/locales/cs-CZ/common.json +167 -13
  55. package/build/locales/de-DE/common.json +165 -13
  56. package/build/locales/es-ES/common.json +165 -13
  57. package/build/locales/fr-FR/common.json +165 -13
  58. package/build/locales/it-IT/common.json +165 -13
  59. package/build/locales/ja-JP/common.json +164 -13
  60. package/build/locales/ko-KR/common.json +164 -13
  61. package/build/locales/lt-LT/common.json +167 -13
  62. package/build/locales/nl-NL/common.json +165 -13
  63. package/build/locales/pl-PL/common.json +167 -13
  64. package/build/locales/pt-BR/common.json +165 -13
  65. package/build/locales/ro-RO/common.json +166 -13
  66. package/build/locales/ru-RU/common.json +167 -13
  67. package/build/locales/sl-SI/common.json +167 -13
  68. package/build/locales/sv-SE/common.json +165 -13
  69. package/build/locales/uk-UA/common.json +167 -13
  70. package/package.json +2 -2
  71. package/src/img/svg/logo.svg +2 -2
  72. package/src/locales/cs-CZ/common.json +167 -13
  73. package/src/locales/de-DE/common.json +165 -13
  74. package/src/locales/es-ES/common.json +165 -13
  75. package/src/locales/fr-FR/common.json +165 -13
  76. package/src/locales/it-IT/common.json +165 -13
  77. package/src/locales/ja-JP/common.json +164 -13
  78. package/src/locales/ko-KR/common.json +164 -13
  79. package/src/locales/lt-LT/common.json +167 -13
  80. package/src/locales/nl-NL/common.json +165 -13
  81. package/src/locales/pl-PL/common.json +167 -13
  82. package/src/locales/pt-BR/common.json +165 -13
  83. package/src/locales/ro-RO/common.json +166 -13
  84. package/src/locales/ru-RU/common.json +167 -13
  85. package/src/locales/sl-SI/common.json +167 -13
  86. package/src/locales/sv-SE/common.json +165 -13
  87. package/src/locales/uk-UA/common.json +167 -13
  88. package/src/react-extension/ExtAuthenticationLogin.js +1 -0
  89. package/src/react-extension/components/Administration/DisplayHealthcheckAdministration/DisplayHealthcheckAdministration.js +14 -23
  90. package/src/react-extension/components/UserSetting/DisplayUserTheme/DisplayUserTheme.js +2 -1
  91. package/src/react-extension/components/UserSetting/DisplayUserTheme/DisplayUserTheme.test.data.js +5 -0
  92. package/src/react-extension/components/UserSetting/DisplayUserTheme/DisplayUserTheme.test.js +13 -1
  93. package/src/react-extension/contexts/ResourceWorkspaceContext.js +3 -1
  94. package/src/react-extension/contexts/ResourceWorkspaceContext.test.js +8 -0
  95. package/src/react-web-integration/lib/Dom/DomUtils.js +1 -1
  96. package/src/react-web-integration/lib/Dom/DomUtils.test.js +19 -0
  97. package/src/react-web-integration/lib/InForm/InFormCallToActionField.js +5 -1
  98. package/src/react-web-integration/lib/InForm/InFormCallToActionField.test.js +39 -0
  99. package/src/react-web-integration/lib/InForm/InFormManager.js +36 -13
  100. package/src/react-web-integration/lib/InForm/InformManager.test.js +255 -6
  101. package/src/react-web-integration/lib/InForm/InformManager.test.page.js +7 -7
  102. package/src/react-web-integration/lib/InForm/ScrapingDictionary.js +1 -1
  103. package/src/react-web-integration/services/Scraping/FieldScraperService.js +7 -4
  104. package/src/react-web-integration/services/Scraping/LabelIndex.js +86 -0
  105. package/src/react-web-integration/services/Scraping/LabelIndex.test.js +111 -0
  106. package/src/react-web-integration/services/Scraping/LabelScraperService.js +18 -14
  107. package/src/react-web-integration/services/Scraping/LabelScraperService.test.js +5 -5
  108. package/src/react-web-integration/services/Scraping/PageScraperHelpers.js +21 -5
  109. package/src/react-web-integration/services/Scraping/PageScraperHelpers.test.js +116 -0
  110. package/src/react-web-integration/services/Scraping/PageScraperService.js +6 -3
  111. package/src/react-web-integration/services/classification/FieldClassificationService.js +46 -40
  112. package/src/react-web-integration/services/classification/FieldClassificationService.test.data.js +3 -2
  113. package/src/react-web-integration/services/classification/FieldClassificationService.test.js +72 -0
  114. package/src/react-web-integration/services/classification/FieldFeatureService.js +12 -14
  115. package/src/react-web-integration/services/classification/FieldFeatureService.test.js +25 -11
  116. package/src/react-web-integration/services/classification/FieldsRationalizationService.js +1 -1
  117. package/src/react-web-integration/services/classification/KeywordMatchingService.js +18 -4
  118. package/src/react-web-integration/services/classification/KeywordMatchingService.test.js +35 -0
  119. package/src/react-web-integration/services/classification/KeywordsDictionary.js +21 -1
  120. package/src/react-web-integration/services/classification/PasswordRoleResolutionService.js +2 -2
  121. package/src/react-web-integration/services/classification/SegmentedOtpResolutionService.js +2 -2
  122. package/src/shared/utils/filterUtils.js +3 -2
  123. package/src/shared/utils/filterUtils.test.js +15 -0
  124. package/build/css/help.min.css +0 -9
  125. package/build/css/public.min.css +0 -8
  126. package/build/css/themes/default/api_cloud.min.css +0 -8
  127. package/build/css/themes/default/api_reports.min.css +0 -9
  128. package/build/css/themes/default/api_webinstaller.min.css +0 -9
  129. package/build/css/themes/layette/api_reports.min.css +0 -9
  130. package/build/css/themes/midgar/api_reports.min.css +0 -9
  131. package/build/css/themes/sakura/api_reports.min.css +0 -9
  132. package/build/css/themes/solarized_dark/api_reports.min.css +0 -9
  133. package/build/css/themes/solarized_light/api_reports.min.css +0 -9
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see api-triage.js.LICENSE.txt */
2
- (()=>{"use strict";var e={86954(e,t,s){var i=s(96540),n=s(5338);const r=i.createContext({user:null,users:null,roles:null,rememberMeOptions:{},resources:null,resource:null,shareResources:null,selectedResources:null,selectedUser:null,folders:null,resourceCommentId:null,mustRefreshComments:!1,siteSettings:null,userSettings:null,onCheckIsAuthenticatedRequested:null});function a(e){return class extends i.Component{render(){return i.createElement(r.Consumer,null,t=>i.createElement(e,{context:t,...this.props}))}}}const o=r;class l{setBaseUrl(e){if(!e)throw new TypeError("ApiClientOption baseUrl is required.");if("string"==typeof e)try{this.baseUrl=new URL(e)}catch(e){throw new TypeError("ApiClientOption baseUrl is invalid.",{cause:e})}else{if(!(e instanceof URL))throw new TypeError("ApiClientOptions baseurl should be a string or URL");this.baseUrl=e}return this}setResourceName(e){if(!e)throw new TypeError("ApiClientOptions.setResourceName resourceName is required.");if("string"!=typeof e)throw new TypeError("ApiClientOptions.setResourceName resourceName should be a valid string.");return this.resourceName=e,this}getBaseUrl(){return this.baseUrl}getResourceName(){return this.resourceName}async getHeaders(){const e=await this.getCsrfToken();if(e)return{"X-CSRF-Token":e}}async getCsrfToken(){if("undefined"==typeof browser||void 0===browser.cookies){const e=document?.cookie?.split("; ")?.find(e=>e.startsWith("csrfToken"))?.split("=");return e&&2===e.length?e[1]:null}const e=this.baseUrl.toString(),t="/"===e.slice(-1)?e:`${e}/`,s=await browser.cookies.get({name:"csrfToken",url:t});return s?.value||null}}var c=s(5556),d=s.n(c);class p extends Error{constructor(e,t){super(e),this.name="PassboltApiFetchError",this.data=t||{}}}const h=p;class u extends Error{constructor(){super("An internal error occurred. The server response could not be parsed. Please contact your administrator."),this.name="PassboltBadResponseError"}}const m=u;class g extends Error{constructor(e){super(e=e||"The service is unavailable"),this.name="PassboltServiceUnavailableError"}}const E=g,y=["GET","POST","PUT","DELETE"];class f{constructor(e){if(this.options=e,!this.options.getBaseUrl())throw new TypeError("ApiClient constructor error: baseUrl is required.");if(!this.options.getResourceName())throw new TypeError("ApiClient constructor error: resourceName is required.");try{let e=this.options.getBaseUrl().toString();e.endsWith("/")&&(e=e.slice(0,-1));let t=this.options.getResourceName();t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,-1)),this.baseUrl=`${e}/${t}`,this.baseUrl=new URL(this.baseUrl)}catch(e){throw new TypeError("ApiClient constructor error: b.",{cause:e})}this.apiVersion="api-version=v2"}setApiVersion(e){if("string"!=typeof e)throw new TypeError("ApiClient.setApiVersion error: apiVersion should be a string.");this.apiVersion=`api-version=${e}`}getDefaultHeaders(){return{Accept:"application/json","content-type":"application/json"}}async buildFetchOptions(){const e=await this.options.getHeaders();return{credentials:"include",headers:{...this.getDefaultHeaders(),...e}}}async get(e,t){this.assertValidId(e);const s=this.buildUrl(`${this.baseUrl}/${e}`,t||{});return this.fetchAndHandleResponse("GET",s)}async delete(e,t,s,i){let n;this.assertValidId(e),void 0===i&&(i=!1),n=i?this.buildUrl(`${this.baseUrl}/${e}/dry-run`,s||{}):this.buildUrl(`${this.baseUrl}/${e}`,s||{});let r=null;return t&&(r=this.buildBody(t)),this.fetchAndHandleResponse("DELETE",n,r)}async findAll(e){const t=this.buildUrl(this.baseUrl.toString(),e||{});return this.fetchAndHandleResponse("GET",t)}async create(e,t){const s=this.buildUrl(this.baseUrl.toString(),t||{}),i=this.buildBody(e);return this.fetchAndHandleResponse("POST",s,i)}async update(e,t,s,i){let n;this.assertValidId(e),void 0===i&&(i=!1),n=i?this.buildUrl(`${this.baseUrl}/${e}/dry-run`,s||{}):this.buildUrl(`${this.baseUrl}/${e}`,s||{});let r=null;return t&&(r=this.buildBody(t)),this.fetchAndHandleResponse("PUT",n,r)}async updateAll(e,t={}){const s=this.buildUrl(this.baseUrl.toString(),t),i=e?this.buildBody(e):null;return this.fetchAndHandleResponse("PUT",s,i)}assertValidId(e){if(!e)throw new TypeError("ApiClient.assertValidId error: id cannot be empty");if("string"!=typeof e)throw new TypeError("ApiClient.assertValidId error: id should be a string")}assertMethod(e){if("string"!=typeof e)throw new TypeError("ApiClient.assertValidMethod method should be a string.");if(y.indexOf(e.toUpperCase())<0)throw new TypeError(`ApiClient.assertValidMethod error: method ${e} is not supported.`)}assertUrl(e){if(!e)throw new TypeError("ApliClient.assertUrl error: url is required.");if(!(e instanceof URL))throw new TypeError("ApliClient.assertUrl error: url should be a valid URL object.");if("https:"!==e.protocol&&"http:"!==e.protocol)throw new TypeError("ApliClient.assertUrl error: url protocol should only be https or http.")}assertBody(e){if(!(e instanceof FormData)&&"string"!=typeof e)throw new TypeError("ApiClient.assertBody error: body should be a string or a FormData.")}buildBody(e){return JSON.stringify(e)}buildUrl(e,t){if("string"!=typeof e)throw new TypeError("ApiClient.buildUrl error: url should be a string.");const s=new URL(`${e}.json?${this.apiVersion}`);t=t||{};for(const[e,i]of Object.entries(t)){if("string"!=typeof e)throw new TypeError("ApiClient.buildUrl error: urlOptions key should be a string.");if("string"==typeof i)s.searchParams.append(e,i);else{if(!Array.isArray(i))throw new TypeError("ApiClient.buildUrl error: urlOptions value should be a string or array.");i.forEach(t=>{s.searchParams.append(e,t)})}}return s}async sendRequest(e,t,s,i){this.assertUrl(t),this.assertMethod(e),s&&this.assertBody(s);const n="undefined"!=typeof customApiClientFetch?customApiClientFetch:fetch,r={...await this.buildFetchOptions(),...i};r.method=e,s&&(r.body=s);try{return await n(t.toString(),r)}catch(e){throw console.error(e),navigator.onLine?new E("Unable to reach the server, an unexpected error occurred"):new E("Unable to reach the server, you are not connected to the network")}}async fetchAndHandleResponse(e,t,s,i){const n=await this.sendRequest(e,t,s,i);return this.parseResponseJson(n)}async parseResponseJson(e){let t;try{t=await e.json()}catch(t){throw console.debug(e.url.toString(),t),new m(t,e)}if(!e.ok){const s=t.header.message;throw new h(s,{header:t.header,code:e.status,body:t.body})}return t}}const b=class{constructor(e){this.apiClientOptions=e}async find(){this.initClient();const e=await this.apiClient.findAll(),t=e?.body;return t}async save(e){this.initClient(),await this.apiClient.create(e)}async delete(e){this.initClient(),await this.apiClient.delete(e)}async checkDomainAllowed(e){this.initClient("dry-run"),await this.apiClient.create(e)}initClient(e="settings"){this.apiClientOptions.setResourceName(`self-registration/${e}`),this.apiClient=new f(this.apiClientOptions)}},S=[{id:"azure",name:"Microsoft",icon:i.createElement("svg",{width:"65",height:"64",viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M31.3512 3.04762H3.92261V30.4762H31.3512V3.04762Z",fill:"#F25022"}),i.createElement("path",{d:"M31.3512 33.5238H3.92261V60.9524H31.3512V33.5238Z",fill:"#00A4EF"}),i.createElement("path",{d:"M61.8274 3.04762H34.3988V30.4762H61.8274V3.04762Z",fill:"#7FBA00"}),i.createElement("path",{d:"M61.8274 33.5238H34.3988V60.9524H61.8274V33.5238Z",fill:"#FFB900"})),defaultConfig:{url:"https://login.microsoftonline.com",client_id:"",client_secret:"",tenant_id:"",client_secret_expiry:"",prompt:"login",email_claim:"email",login_hint:!0}},{id:"google",name:"Google",icon:i.createElement("svg",{width:"65",height:"64",viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M63.9451 32.72C63.9451 30.6133 63.7584 28.6133 63.4384 26.6667H33.3051V38.6933H50.5584C49.7851 42.64 47.5184 45.9733 44.1584 48.24V56.24H54.4517C60.4784 50.6667 63.9451 42.4533 63.9451 32.72Z",fill:"#4285F4"}),i.createElement("path",{d:"M33.305 64C41.945 64 49.1717 61.12 54.4517 56.24L44.1583 48.24C41.2783 50.16 37.625 51.3333 33.305 51.3333C24.9583 51.3333 17.8917 45.7067 15.3583 38.1067H4.745V46.3467C9.99833 56.8 20.7983 64 33.305 64Z",fill:"#34A853"}),i.createElement("path",{d:"M15.3584 38.1067C14.6917 36.1867 14.3451 34.1333 14.3451 32C14.3451 29.8667 14.7184 27.8133 15.3584 25.8933V17.6533H4.74505C2.55838 21.9733 1.30505 26.8267 1.30505 32C1.30505 37.1733 2.55838 42.0267 4.74505 46.3467L15.3584 38.1067Z",fill:"#FBBC05"}),i.createElement("path",{d:"M33.305 12.6667C38.025 12.6667 42.2383 14.2933 45.5717 17.4667L54.6917 8.34667C49.1717 3.17334 41.945 0 33.305 0C20.7983 0 9.99833 7.20001 4.745 17.6533L15.3583 25.8933C17.8917 18.2933 24.9583 12.6667 33.305 12.6667Z",fill:"#EA4335"})),defaultConfig:{client_id:"",client_secret:""}},{id:"oauth2",name:"OpenID",hiddenIfDisabled:!0,icon:i.createElement("svg",{width:"65",height:"60",viewBox:"0 0 65 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M64.2468 34.9929L62.9089 21.0968L57.9256 23.9083C53.2914 21.0968 47.3581 19.1061 40.7332 18.3046V24.4577C44.5336 25.117 47.9462 26.3321 50.7513 27.9544L45.5031 30.9146L64.2533 34.9929H64.2468Z",fill:"#B3B3B3"}),i.createElement("path",{d:"M9.94184 38.8774C9.94184 32.0069 17.4264 26.2222 27.632 24.4577V18.2981C12.023 20.1854 0.246826 28.6783 0.246826 38.8774C0.246826 49.0766 12.8891 58.1769 29.3319 59.6312V53.5557C18.2666 52.166 9.94184 46.1228 9.94184 38.8774Z",fill:"#B3B3B3"}),i.createElement("path",{d:"M29.332 5.09999V59.6377L39.027 55.0746V0.362366L29.332 5.09999Z",fill:"#F8931E"})),defaultConfig:{url:"",openid_configuration_path:"",scope:"openid email profile",client_id:"",client_secret:""}},{id:"adfs",name:"AD FS",hiddenIfDisabled:!0,icon:i.createElement("svg",{width:"65",height:"64",viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M64.5443 48.7454V62.166C64.5443 63.7378 64.0607 64.0602 62.5695 63.8184C52.5746 62.3272 42.4587 60.957 32.3831 59.5464C30.5695 59.3046 29.9247 58.6597 29.9247 56.6849C30.0859 49.5514 30.0053 42.3776 29.9247 35.1635C29.9247 33.5917 30.4083 33.1081 31.9801 33.1081C42.2975 33.1887 52.4536 33.1887 62.5695 33.1887C64.2219 33.1887 64.6249 33.8335 64.6249 35.3247C64.4637 39.8386 64.5443 44.2718 64.5443 48.7454Z",fill:"#00AAF2"}),i.createElement("path",{d:"M47.416 30.6093C42.3379 30.6093 37.2598 30.5287 32.1817 30.6093C30.6099 30.6093 29.9651 30.2869 29.9651 28.4733C30.0457 21.1786 30.0457 14.0048 29.9651 6.79069C29.9651 5.38011 30.4487 4.89648 31.7787 4.65467C42.1767 3.16349 52.5747 1.7126 62.9726 0.140816C64.7862 -0.100997 64.4638 1.10807 64.4638 2.11563C64.4638 8.56399 64.5444 15.1333 64.4638 21.5816C64.4638 23.9595 64.3832 26.3373 64.4638 28.7151C64.5444 30.2063 63.9802 30.6093 62.5696 30.6093C57.5721 30.5287 52.4941 30.6093 47.416 30.6093Z",fill:"#00AAF2"}),i.createElement("path",{d:"M13.8038 33.3096H25.1691C26.3782 33.3096 26.9021 33.7126 26.9021 34.962V57.37C26.9021 58.6597 26.3378 58.7806 25.1691 58.6597C17.6326 57.5312 10.096 56.4431 2.59981 55.3952C1.10863 55.1534 0.625 54.6698 0.625 53.098C0.705605 47.1332 0.705605 41.1685 0.625 35.0829C0.625 33.5917 1.02802 33.1887 2.51921 33.1887C6.34792 33.3096 10.0154 33.3096 13.8038 33.3096Z",fill:"#00AAF2"}),i.createElement("path",{d:"M13.8038 30.6093H2.59977C1.18919 30.6093 0.705566 30.1257 0.705566 28.6345C0.786171 22.7504 0.786171 16.8663 0.705566 10.9418C0.705566 9.53126 1.10859 9.04763 2.59977 8.80582C10.1363 7.83856 17.6728 6.7504 25.169 5.54133C26.902 5.29952 27.0633 5.86375 27.0633 7.27433V28.7151C27.0633 30.2869 26.4184 30.5287 25.0078 30.5287C21.2597 30.5287 17.4713 30.6093 13.8038 30.6093Z",fill:"#00AAF2"})),defaultConfig:{url:"",openid_configuration_path:"",scope:"openid email profile",client_id:"",client_secret:""}},{id:"pingone",name:"PingOne",hiddenIfDisabled:!0,icon:i.createElement("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M0 0H64V64H0V0Z",fill:"#BB2631"}),i.createElement("path",{d:"M30.719 51.2024L31.6177 51.0748V57.6038H30.7179L30.719 51.2024ZM34.43 51.9678V56.1936C34.43 56.9602 34.5576 57.2154 35.2011 57.2154C35.4563 57.2154 35.3287 57.2154 35.5838 57.0878L35.7114 57.6038C35.4562 57.7313 35.3287 57.8589 34.946 57.8589C34.6851 57.8589 34.43 57.7313 34.1748 57.7313C33.7921 57.4762 33.6646 57.0878 33.6646 56.4499V51.9678H32.7647V51.2024H33.537V48.7717H34.43V51.2024H35.839L35.5838 51.9678H34.43ZM36.4837 33.7946C35.7125 33.7946 34.6863 34.3049 33.7933 35.2035V46.5916H29.9547V34.814C29.9547 33.4118 29.8271 32.1304 29.4387 30.9755L32.8946 29.9549C33.283 30.5927 33.4105 31.3593 33.4105 32.0029C34.0484 31.6201 34.4311 31.2317 35.0747 30.849C35.9123 30.4431 36.8287 30.2253 37.7594 30.2112C39.4235 30.2112 40.8325 31.1042 41.3439 32.512C41.6036 33.1499 41.6036 33.7946 41.6036 34.8151V46.5927H37.7594V36.0965C37.7594 34.3049 37.5042 33.7946 36.4837 33.7946ZM47.4901 35.7138C47.4901 34.1761 48.3831 33.2786 49.791 33.2786C51.3287 33.2786 52.0998 34.1773 52.0998 35.7138C52.0998 37.2504 51.2 38.0158 49.6646 38.0158C48.5164 38.0158 47.4901 37.378 47.4901 35.7138ZM51.3275 42.4979H49.2818C48.8991 42.4979 48.644 42.3703 48.644 42.1152C48.644 41.7279 49.1543 41.3441 50.1805 40.8338H50.8184C54.0191 40.8338 56.3211 38.7869 56.3211 35.969C56.3211 34.9427 56.0659 34.0497 55.4281 33.2786C55.6832 33.2786 56.0659 33.4118 56.4486 33.4118C57.4749 33.4118 58.3679 33.0234 59.139 32.258L57.476 29.5676C56.5762 30.4663 55.4281 30.9766 54.4018 30.9766C53.8915 30.9766 53.3767 30.849 52.6101 30.5939C51.5838 30.3387 50.8184 30.2112 49.9197 30.2112C46.0812 30.2112 43.6516 32.3856 43.6516 35.7127C43.6516 38.1434 44.6722 39.5524 46.8523 40.1902C44.417 40.8338 44.1619 41.8544 44.1619 42.8806C44.1619 44.0345 44.5446 44.6723 45.3157 45.0562C45.9536 45.3102 47.1074 45.571 48.8991 45.571H50.5621C52.0998 45.571 53.248 46.0813 53.248 47.4903C53.248 48.1282 52.8652 48.7717 52.3549 49.1556C51.7114 49.5383 50.946 49.6659 49.9197 49.6659C48.128 49.6659 47.1063 49.028 47.1063 47.619C47.1063 47.2363 47.1063 46.9755 47.235 46.5927H43.5229C43.3953 46.8467 43.1345 47.3627 43.1345 48.2557C43.1345 49.4107 43.5217 50.3037 44.4159 51.0748C45.6973 52.4838 47.8717 52.8665 50.0518 52.8665C52.3538 52.8665 54.6558 52.3562 55.9372 50.8197C56.7026 49.9199 57.0911 48.7729 57.0911 47.4914C57.0911 46.0825 56.7038 44.9286 55.8096 44.0345C54.7845 42.8806 53.6341 42.4979 51.3275 42.4979ZM41.9852 57.4762C41.6025 57.4762 41.3416 57.2142 41.3416 56.7051C41.3416 56.3224 41.6036 55.9396 41.9852 55.9396C42.3668 55.9396 42.623 56.1948 42.623 56.7051C42.623 57.0878 42.2403 57.4762 41.9852 57.4762ZM41.9852 55.6845C41.4749 55.6845 41.0865 56.0672 41.0865 56.5775C41.0865 57.0878 41.4738 57.4762 41.9852 57.4762C42.4966 57.4762 42.8782 57.0878 42.8782 56.5764C42.7518 56.1948 42.369 55.6845 41.9852 55.6845ZM41.73 56.5775V56.3224H41.8576C41.9852 56.3224 42.1128 56.3224 42.1128 56.4499C42.1128 56.5775 41.9852 56.5775 41.8576 56.5775H41.73ZM42.3679 56.4499C42.3679 56.1948 42.2415 56.1948 41.9863 56.1948H41.6025V57.2154H41.7312V56.7051H41.8588L42.1139 57.2154H42.2415L41.9863 56.7051C42.2403 56.7051 42.3679 56.7051 42.3679 56.4499ZM41.6025 51.2024L39.5499 57.8589C39.1672 59.1403 38.6569 60.0333 37.6307 60.2885L37.3755 59.6506C37.8858 59.3955 38.2754 59.1403 38.5294 58.4968C38.4018 57.8589 38.4018 57.7313 38.4018 57.7313C38.2742 57.3486 38.0145 56.0672 37.7582 55.4237L36.4825 51.33L37.3755 50.9473L38.5294 55.1685C38.6569 55.8121 38.9121 56.8327 38.9121 56.8327C38.9121 56.8327 39.1672 56.0672 39.2948 55.4237L40.4486 51.2024H41.6025ZM13.4387 55.9385C13.4387 55.9385 13.3112 56.1936 13.056 56.4488C12.6733 56.7039 12.4125 56.8315 11.9022 56.8315C11.3919 56.8315 11.0092 56.5764 10.7483 56.0661C10.5701 55.5297 10.4838 54.9671 10.4932 54.402C10.4932 53.5021 10.6208 52.993 10.8816 52.4827C11.1368 52.0943 11.5195 51.8391 11.9022 51.8391C12.5457 51.8391 13.056 52.0943 13.3112 52.4827L13.4387 55.9385ZM14.3374 48.7706H13.4387V51.9667C13.2651 51.7225 13.0339 51.525 12.7657 51.3915C12.4975 51.258 12.2005 51.1926 11.901 51.2013C11.5198 51.2013 11.1356 51.3288 10.7483 51.584C9.98291 52.2218 9.6002 53.247 9.6002 54.5295C9.6002 56.5764 10.4932 57.8578 11.9022 57.8578C12.5446 57.8585 13.0572 57.6015 13.4399 57.0867C13.4399 57.4739 13.5663 57.7302 13.5663 57.7302H14.4661C14.3374 57.3475 14.3374 56.7039 14.3374 55.6834V48.7706ZM28.2895 51.2013H29.826L29.4376 51.9667H28.1619V56.1925C28.1619 56.9591 28.2895 57.2142 28.9273 57.2142C29.1825 57.2142 29.0549 57.2142 29.31 57.0867L29.4376 57.6026C29.1825 57.7302 29.0549 57.8578 28.6722 57.8578C28.417 57.8578 28.1619 57.7302 27.9067 57.7302C27.5183 57.4751 27.3908 57.0867 27.3908 56.4488V51.9667H26.6253V51.2013H27.3908V48.7706H28.2895V51.2013ZM22.7856 30.7203L26.6242 30.0825V46.5905H22.7856V30.7203ZM22.3984 25.9819C22.3984 24.5729 23.5511 23.4248 24.8325 23.4248C26.1082 23.4248 27.1356 24.5729 27.1356 25.9819C27.1356 27.3909 26.1093 28.6723 24.7049 28.6723C23.4246 28.6723 22.3984 27.5185 22.3984 25.9819ZM25.5979 51.9667C25.7266 52.2218 25.7266 52.4827 25.7266 52.7378V57.6015H24.8336V53.2504C24.8336 52.6125 24.8336 52.3574 24.5785 52.2241C24.4011 52.0653 24.1729 51.9749 23.9349 51.969C23.4246 51.969 22.7868 52.3563 22.2708 52.8677V57.6049H21.3767V52.6125C21.3767 51.7127 21.1215 51.2036 21.1215 51.2036L22.0157 50.9484C22.0157 50.9484 22.2708 51.4587 22.2708 51.969C22.9144 51.3311 23.4246 50.9484 24.0625 50.9484C24.8336 51.076 25.3439 51.4587 25.5991 51.969M16.6394 53.7607C16.6394 52.485 17.1497 51.7138 17.9208 51.7138C18.3035 51.7138 18.8138 51.969 18.9414 52.2241C19.1966 52.7401 19.1965 53.1228 19.3298 53.7607H16.6394ZM18.0484 50.9473C17.4049 50.9473 16.767 51.2035 16.2567 51.8414C15.7407 52.485 15.6132 53.2504 15.6132 54.2767C15.6132 56.4511 16.6394 57.7325 18.176 57.7325C18.9414 57.7325 19.585 57.4773 20.0952 56.9614L19.7125 56.3235C19.3298 56.7062 18.8138 56.9614 18.3036 56.9614C17.6657 56.9614 17.1497 56.7062 16.8946 56.1959C16.6394 55.8132 16.6394 55.4248 16.6394 54.7869V54.6594H20.2228V54.5318C20.2228 52.9941 20.0953 52.3562 19.585 51.8414C19.1977 51.2035 18.6863 50.9484 18.0484 50.9484M7.42578 57.6049H8.31878V48.6453H7.42578V57.6049ZM16.2567 33.7957C15.7407 34.6887 15.2316 34.9438 13.5663 34.9438H11.3919V28.2873H13.949C15.6132 28.2873 16.6394 29.5687 16.6394 31.6213C16.767 32.6419 16.6394 33.2797 16.2567 33.7957ZM18.3036 25.7291C17.1497 25.0912 16.1291 24.7039 12.6733 24.7039H7.42578V46.7215H11.5195V38.6594H13.6939C15.874 38.6594 16.767 38.3985 17.6657 37.8882C19.8412 36.7344 21.1215 34.4324 21.1215 31.4869C21.2491 28.9298 20.2228 26.8829 18.3036 25.7291Z",fill:"white"})),defaultConfig:{url:"https://auth.pingone.com",environment_id:"",client_id:"",client_secret:"",email_claim:"email"}}],T=i.createContext({unexpectedError:null,state:null,isSsoRecoverEnabled:!1,getSsoProviderId:()=>{},onInitializeTriageRequested:()=>{},onTriageRequested:()=>{},onRegistrationRequested:()=>{},handleSwitchToSsoSignInState:()=>{},handleSwitchToUsernameState:()=>{},handleSwitchToEnterNameState:()=>{}});class w extends i.Component{constructor(e){super(e),this.state=Object.assign(this.defaultState,e.value)}get defaultState(){return this.findSsoProviderId=this.findSsoProviderId.bind(this),{unexpectedError:null,state:A.INITIAL_STATE,isSsoRecoverEnabled:!1,ssoProviderId:null,getSsoProviderId:this.getSsoProviderId.bind(this),onInitializeTriageRequested:this.onInitializeTriageRequested.bind(this),onTriageRequested:this.onTriageRequested.bind(this),onRegistrationRequested:this.onRegistrationRequested.bind(this),handleSwitchToSsoSignInState:this.handleSwitchToSsoSignInState.bind(this),handleSwitchToUsernameState:this.handleSwitchToUsernameState.bind(this),handleSwitchToEnterNameState:this.handleSwitchToEnterNameState.bind(this)}}async onInitializeTriageRequested(){const e=this.isSsoAvailable(),t=e?await this.findSsoProviderId():null,s=e&&Boolean(t);this.setState({ssoProviderId:t,isSsoRecoverEnabled:s,state:s?A.SSO_SIGN_IN_STATE:A.USERNAME_STATE})}isSsoAvailable(){return this.props.context.siteSettings.canIUse("ssoRecover")&&this.props.context.siteSettings.canIUse("sso")}getSsoProviderId(){return this.state.ssoProviderId}async findSsoProviderId(){const e=this.props.context.getApiClientOptions();e.setResourceName("sso/settings/current");const t=new f(e);let s=null;try{s=await t.findAll()}catch(e){return console.error(e),null}const i=s.body.provider;if(!i)return null;const n=S.find(e=>e.id===i);if(!n){const e=new Error("The given SSO provider id is not valid");return console.error(e),null}return n.disabledForRecover?(console.log("Recover processes with this SSO provider is not supported"),null):i}async onTriageRequested(e){const t={username:e},s=this.props.context.getApiClientOptions();s.setResourceName("users/recover");const i=new f(s);await i.create(t).then(this.handleTriageSuccess.bind(this)).catch(t=>this.handleTriageError(t,e))}async handleTriageSuccess(){return this.setState({state:A.CHECK_MAILBOX_STATE})}async handleTriageError(e,t){const s=e.data&&404===e.data.code;let i=A.USERNAME_NOT_FOUND_ERROR;if(s&&this.canIUseSelfRegistrationSettings)try{await this.isDomainAllowedToSelfRegister(t),i=A.NAME_STATE}catch(e){e.data&&(400===e.data.code||403===e.data.code)||(this.setState({unexpectedError:new E(e.message)}),i=A.UNEXPECTED_ERROR_STATE)}this.setState({username:t,state:i})}async onRegistrationRequested(e,t){const s={username:this.state.username,profile:{first_name:e,last_name:t}};this.register(s)}async handleRegistrationSuccess(){return this.setState({state:A.CHECK_MAILBOX_STATE})}async handleRegistrationError(){this.setState({state:A.UNEXPECTED_ERROR_STATE})}handleSwitchToSsoSignInState(){this.setState({state:A.SSO_SIGN_IN_STATE})}handleSwitchToUsernameState(){this.setState({state:A.USERNAME_STATE})}handleSwitchToEnterNameState(e){this.setState({username:e,state:A.NAME_STATE})}get canIUseSelfRegistrationSettings(){return this.props.context.siteSettings.canIUse("selfRegistration")}async isDomainAllowedToSelfRegister(e){const t=this.props.context.getApiClientOptions(),s=new b(t),i={email:e,provider:"email_domains"};await s.checkDomainAllowed(i)}async register(e){const t=this.props.context.getApiClientOptions().setResourceName("users/register"),s=new f(t);await s.create(e).then(this.handleRegistrationSuccess.bind(this)).catch(this.handleRegistrationError.bind(this))}render(){return i.createElement(T.Provider,{value:this.state},this.props.children)}}w.propTypes={context:d().any,value:d().any,children:d().any};const v=a(w);function C(e){return class extends i.Component{render(){return i.createElement(T.Consumer,null,t=>i.createElement(e,{apiTriageContext:t,...this.props}))}}}const A={INITIAL_STATE:"Initial State",USERNAME_STATE:"Enter username state",SSO_SIGN_IN_STATE:"SSO Sign in state",CHECK_MAILBOX_STATE:"Check mailbox state",NAME_STATE:"Enter name state",USERNAME_NOT_FOUND_ERROR:"Username not found error state",UNEXPECTED_ERROR_STATE:"Unexpected error state"};var R,x,_=s(91352),P=s(13279);function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},I.apply(null,arguments)}const N=function(e){return i.createElement("svg",I({width:18,height:18,fill:"none",className:"svg-icon spinner",viewBox:"0 0 18 18"},e),R||(R=i.createElement("circle",{id:"background",cx:8,cy:8,r:8,fill:"none",stroke:"var(--spinner-background)",strokeWidth:"var(--spinner-stroke-width)",transform:"translate(1 1)"})),x||(x=i.createElement("circle",{id:"loading",r:8,fill:"none",stroke:"var(--spinner-color)",strokeLinecap:"round",strokeWidth:"var(--spinner-stroke-width)",transform:"translate(9 9)"})))};class O extends i.Component{render(){return i.createElement("div",{className:"login-processing"},i.createElement("h1",null,this.props.title),i.createElement("div",{className:"processing-wrapper"},i.createElement(N,null)))}}O.propTypes={title:d().oneOfType([d().arrayOf(d().node),d().node,d().string])},O.defaultProps={title:i.createElement(_.x,null,"Please wait...")};const U=(0,P.C)("common")(O);class k extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.getClassName=this.getClassName.bind(this)}getClassName(){let e="button primary form";return this.props.warning?e+=" warning":this.props.attention&&(e+=" attention"),this.props.disabled&&(e+=" disabled"),this.props.processing&&(e+=" processing"),this.props.big&&(e+=" big"),this.props.medium&&(e+=" medium"),this.props.fullWidth&&(e+=" full-width"),e}render(){return i.createElement("button",{type:"submit",className:this.getClassName(),disabled:this.props.disabled},this.props.value||i.createElement(_.x,null,"Save"),this.props.processing&&i.createElement(N,null))}}k.defaultProps={warning:!1,attention:!1},k.propTypes={processing:d().bool,disabled:d().bool,value:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),warning:d().bool,attention:d().bool,big:d().bool,medium:d().bool,fullWidth:d().bool};const D=(0,P.C)("common")(k);var L=s(5648);class q extends Error{constructor(e="Collection validation error."){super(e),this.name="CollectionValidationError",this.errors=[]}addItemValidationError(e,t){if(!Number.isInteger(e))throw new TypeError('CollectionValidationError::addEntityValidationError expects "position" to be an integer.');if(!(t instanceof V||t instanceof q))throw new TypeError('CollectionValidationError::addEntityValidationError expects "entityValidationError" to be an instance of EntityValidationError or CollectionValidationError.');this.errors[e]=t}addCollectionValidationError(e,t){if("string"!=typeof e)throw new TypeError('CollectionValidationError::addCollectionValidationError expects "rule" to be a string.');if("string"!=typeof t)throw new TypeError('CollectionValidationError::addCollectionValidationError expects "error" to be a string.');this.errors[e]=t}hasErrors(){return this.errors.some(e=>Object.keys(e.details).length>0)}get details(){const e={};for(const t in this.errors)this.errors[t]instanceof V||this.errors[t]instanceof q?e[t]=this.errors[t].details:e[t]=this.errors[t];return e}}const G=q;class M extends Error{constructor(e="Entity validation error."){super(e),this.name="EntityValidationError",this.details={}}addError(e,t,s){if("string"!=typeof e)throw new TypeError("EntityValidationError addError property should be a string.");if("string"!=typeof t)throw new TypeError("EntityValidationError addError rule should be a string.");if("string"!=typeof s)throw new TypeError("EntityValidationError addError message should be a string.");Object.prototype.hasOwnProperty.call(this.details,e)||(this.details[e]={}),this.details[e][t]=s}addAssociationError(e,t){if("string"!=typeof e)throw new TypeError("EntityValidationError addAssociationError associationName should be a string.");if(!(t instanceof M||t instanceof G))throw new TypeError("EntityValidationError addAssociationError errorDetails should be an object.");this.details[e]=t}getError(e,t){if(!this.hasError(e,t))return null;const s=this.details[e];return t?s[t]:s}hasError(e,t){if("string"!=typeof e)throw new TypeError("EntityValidationError hasError property should be a string.");const s=this.details&&Object.prototype.hasOwnProperty.call(this.details,e);if(!s)return!1;if(!t)return s;if("string"!=typeof t)throw new TypeError("EntityValidationError hasError rule should be a string.");return Object.prototype.hasOwnProperty.call(this.details[e],t)}hasErrors(){return Object.keys(this.details).length>0}getFirstRuleErrorByField(e){if(!this.hasError(e))return null;const t=this.details[e];return t[Object.keys(t)[0]]}}const V=M;var $=s(57761),F=s.n($);class H{static validateSchema(e,t){if(!t)throw new TypeError(`Could not validate entity ${e}. No schema for entity ${e}.`);if(!t.type)throw new TypeError(`Could not validate entity ${e}. Type missing.`);if("array"!==t.type){if("object"===t.type){if(!t.required||!Array.isArray(t.required))throw new TypeError(`Could not validate entity ${e}. Schema error: no required properties.`);if(!t.properties||!Object.keys(t).length)throw new TypeError(`Could not validate entity ${e}. Schema error: no properties.`);const s=t.properties;for(const e in s){if(!Object.prototype.hasOwnProperty.call(s,e)||!s[e].type&&!s[e].anyOf)throw TypeError(`Invalid schema. Type missing for ${e}...`);if(s[e].anyOf&&(!Array.isArray(s[e].anyOf)||!s[e].anyOf.length))throw new TypeError(`Invalid schema, prop ${e} anyOf should be an array`)}}}else if(!t.items)throw new TypeError(`Could not validate entity ${e}. Schema error: missing item definition.`)}static validate(e,t,s){if(!e||!t||!s)throw new TypeError(`Could not validate entity ${e}. No data provided.`);switch(s.type){case"object":return H.validateObject(e,t,s);case"array":return H.validateArray(e,t,s);default:throw new TypeError(`Could not validate entity ${e}. Unsupported type.`)}}static validateArray(e,t,s){let i;const n=H.validateProp("items",t,s);if("number"==typeof s.minItems&&(H.isGreaterThanOrEqual(t.length,s.minItems)||(i=H.handleCollectionValidationError("minItems",`The items array should contain at least ${s.minItems} item(s).`,i))),"number"==typeof s.maxItems&&(H.isLessThanOrEqual(t.length,s.maxItems)||(i=H.handleCollectionValidationError("maxItems",`The items array should contain at maximum ${s.maxItems} item(s).`,i))),i)throw i;return n}static validateObject(e,t,s){const i=s.required,n=s.properties,r={};let a;for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s))if(null!==t?.[s]||!0!==n[s]?.nullable){if(i.includes(s)){if(!Object.prototype.hasOwnProperty.call(t,s)){a=H.getOrInitEntityValidationError(e,a),a.addError(s,"required",`The ${s} is required.`);continue}}else if(!Object.prototype.hasOwnProperty.call(t,s))continue;try{r[s]=H.validateProp(s,t[s],n[s])}catch(t){if(!(t instanceof V))throw t;a=H.getOrInitEntityValidationError(e,a),a.details[s]=t.details[s]}}else r[s]=null;if(a)throw a;return r}static getOrInitEntityValidationError(e,t){return t||new V(`Could not validate entity ${e}.`)}static validateProp(e,t,s){if(s.anyOf)return H.validateAnyOf(e,t,s.anyOf),t;if(!0===s.nullable&&null===t)return t;if(H.validatePropType(e,t,s),s.enum)return H.validatePropEnum(e,t,s),t;switch(s.type){case"string":H.validatePropTypeString(e,t,s);break;case"integer":case"number":H.validatePropTypeNumber(e,t,s);break;case"array":H.validatePropTypeArray(e,t,s);break;case"object":case"boolean":case"blob":case"null":break;case"x-custom":H.validatePropCustom(e,t,s);break;default:throw new TypeError(`Could not validate property ${e}. Unsupported prop type ${s.type}`)}return t}static validatePropType(e,t,s){if(!H.isValidPropType(t,s.type))throw H.handlePropertyValidationError(e,"type",`The ${e} is not a valid ${s.type}.`)}static validatePropCustom(e,t,s){try{s.validationCallback(t)}catch(t){throw H.handlePropertyValidationError(e,"custom",`The ${e} is not valid: ${t.message}`)}}static validatePropTypeString(e,t,s){let i;if(s.format&&(H.isValidStringFormat(t,s.format)||(i=H.handlePropertyValidationError(e,"format",`The ${e} is not a valid ${s.format}.`,i))),s.length&&(H.isValidStringLength(t,s.length,s.length)||(i=H.handlePropertyValidationError(e,"length",`The ${e} should be ${s.length} character in length.`,i))),s.minLength&&(H.isValidStringLength(t,s.minLength)||(i=H.handlePropertyValidationError(e,"minLength",`The ${e} should be ${s.minLength} character in length minimum.`,i))),s.maxLength&&(H.isValidStringLength(t,0,s.maxLength)||(i=H.handlePropertyValidationError(e,"maxLength",`The ${e} should be ${s.maxLength} character in length maximum.`,i))),s.pattern&&(F().matches(t,s.pattern)||(i=H.handlePropertyValidationError(e,"pattern",`The ${e} is not valid.`,i))),s.custom&&(s.custom(t)||(i=H.handlePropertyValidationError(e,"custom",`The ${e} is not valid.`,i))),i)throw i}static handlePropertyValidationError(e,t,s,i=null){return(i=i||new V(`Could not validate property ${e}.`)).addError(e,t,s),i}static handleCollectionValidationError(e,t,s=null){return(s=s||new G("Could not validate collection.")).addCollectionValidationError(e,t),s}static validatePropTypeNumber(e,t,s){let i;if("number"==typeof s.minimum&&(H.isGreaterThanOrEqual(t,s.minimum)||(i=H.handlePropertyValidationError(e,"minimum",`The ${e} should be greater or equal to ${s.minimum}.`,i))),"number"==typeof s.maximum&&(H.isLesserThanOrEqual(t,s.maximum)||(i=H.handlePropertyValidationError(e,"maximum",`The ${e} should be lesser or equal to ${s.maximum}.`,i))),i)throw i}static validatePropTypeArray(e,t,s){let i;if(s?.items&&"object"==typeof s.items){for(let n=0;n<t.length;n++){const r=`${e}.${n}`;try{this.validateProp(r,t[n],s.items)}catch(t){if(!(t instanceof V))throw t;{i=H.getOrInitEntityValidationError(e,i);const s=t.details[r];i.details[e]={...i.details[e],[n]:s}}}}if(i)throw i}}static validatePropEnum(e,t,s){if(!H.isPropInEnum(t,s.enum)){const t=new V(`Could not validate property ${e}.`);throw t.addError(e,"enum",`The ${e} value is not included in the supported list.`),t}}static validateAnyOf(e,t,s){for(let i=0;i<s.length;i++)try{return void H.validateProp(e,t,s[i])}catch{}const i=new V(`Could not validate property ${e}.`);throw i.addError(e,"type",`The ${e} does not match any of the supported types.`),i}static isValidPropType(e,t){if(Array.isArray(t))throw new TypeError("EntitySchema isValidPropType multiple types are not supported.");if("string"!=typeof t)throw new TypeError("EntitySchema isValidPropType type is invalid.");switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"string":return"string"==typeof e;case"integer":return Number.isInteger(e);case"number":return"number"==typeof e;case"object":return"object"==typeof e;case"array":return Array.isArray(e);case"blob":return e instanceof Blob;case"x-custom":return!0;default:throw new TypeError("EntitySchema validation type not supported.")}}static isValidStringFormat(e,t){if("string"!=typeof t)throw new TypeError("EntitySchema validPropFormat format is invalid.");switch(t){case"uuid":return F().isUUID(e);case"email":case"idn-email":return F().isEmail(e);case"date-time":return F().isISO8601(e);case"x-hex-color":return F().isHexColor(e);case"x-base64":return F().isBase64(e);default:throw new TypeError(`EntitySchema string validation format ${t} is not supported.`)}}static isValidStringLength(e,t,s){return t=t||0,F().isLength(e,t,s)}static isPropInEnum(e,t){if(!t||!Array.isArray(t)||!t.length)throw new TypeError("EntitySchema enum schema cannot be empty.");return t.includes(e)}static isGreaterThanOrEqual(e,t){return e>=t}static isLessThanOrEqual(e,t){return e<=t}static isLesserThanOrEqual(e,t){return e<=t}}const K=H;class B{constructor(e,t={}){(t?.clone??!0)&&(e=JSON.parse(JSON.stringify(e))),this._props=e}toDto(){return JSON.parse(JSON.stringify(this))}toJSON(){return this._props}_hasProp(e){if(!e.includes(".")){const t=B._normalizePropName(e);return Object.prototype.hasOwnProperty.call(this._props,t)}try{return this._getPropByPath(e),!0}catch(t){return console.error(`Failed to check if property "${e}" is set:`,t),!1}}_getPropByPath(e){return B._normalizePropName(e).split(".").reduce((e,t)=>{if(Object.prototype.hasOwnProperty.call(e,t))return e[t];throw new Error},this._props)}static _normalizePropName(e){return e.replace(/([A-Z])/g,(e,t)=>`_${t.toLowerCase()}`).replace(/\._/,".").replace(/^_/,"").replace(/^\./,"")}}const j=B,W=e=>e?.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());class Y extends Error{constructor(e,t,s){if(super(s=s||"Entity collection error."),"number"!=typeof e)throw new TypeError("EntityCollectionError requires a valid position");if(!t||"string"!=typeof t)throw new TypeError("EntityCollectionError requires a valid rule");if(!s||"string"!=typeof s)throw new TypeError("EntityCollectionError requires a valid message");this.position=e,this.rule=t}}const z=Y;class Z{constructor(e=[],t={}){const s=t?.clone??!0;this._items=[],s&&(e=JSON.parse(JSON.stringify(e))),this._props=e}toDto(){return JSON.parse(JSON.stringify(this._items))}toJSON(){return this.toDto()}get items(){return this._items}get length(){return this._items.length}[Symbol.iterator](){let e=0;return{next:()=>e<this._items.length?{value:this._items[e++],done:!1}:{done:!0}}}getAll(e,t){if("string"!=typeof e)throw new TypeError("EntityCollection excludeAll expects propName to be string.");if("string"!=typeof t)throw new TypeError("EntityCollection excludeAll expects search to be string.");return this._items.filter(s=>Object.prototype.hasOwnProperty.call(s._props,e)&&s._props[e]===t)}getFirst(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("EntityCollection getFirst by expect propName and search to be strings");const s=this.getAll(e,t);if(s&&s.length)return s[0]}extract(e){if("string"!=typeof e)throw new TypeError("EntityCollection extract expects propName to be a string.");return this._items.reduce((t,s)=>(void 0!==s._props[e]&&t.push(s._props[e]),t),[])}push(e){return this._items.push(e),this._items.length}unshift(e){return this._items.unshift(e),this._items.length}filterByPropertyValueIn(e,t,s=!0){if("string"!=typeof e)throw new TypeError("EntityCollection filterByPropertyValueIn expects propName to be a string.");if(!Array.isArray(t))throw new TypeError("EntityCollection filterByPropertyValueIn expects needles to be an array.");this.filterByCallback(i=>{const n=Object.prototype.hasOwnProperty.call(i._props,e);return!(s&&!n||n&&!t.includes(i._props[e]))})}filterByCallback(e){if("function"!=typeof e)throw new TypeError("EntityCollection filterByCallback expects callback to be a function.");for(let t=this._items.length-1;t>=0;t--)e(this._items[t])||this._items.splice(t,1)}assertUniqueByProperty(e,t){const s=`unique_${e}`,i=this.extract(e),n=new Set;t=t||`The collection should only contain items with unique values for the property: ${e}.`,i.forEach((e,i)=>{if(n.add(e),i!==n.size-1)throw new z(i,s,t)})}assertNotExist(e,t,s={}){if(void 0===t)return;let i=s?.haystackSet;if(!i){const t=this.extract(e);i=new Set(t)}if(i.has(t)){const t=new V,i=s?.message||`The collection already includes an element that has a property (${e}) with an identical value.`;throw t.addError(e,"unique",i),t}}}const J=Z,X=["string","number","integer","boolean"];class Q extends j{static _cachedSchema={};constructor(e={},t={}){const s=t?.validate??!0;super(e,t),this.marshall(),s&&this.validateSchema({schema:t?.schema,skipSchemaAssociationValidation:t?.skipSchemaAssociationValidation}),this.createAssociations(t),s&&this.validateBuildRules(t?.validateBuildRules)}marshall(){}validate(e={}){try{this.validateSchema({schema:e?.schema,skipSchemaAssociationValidation:e?.skipSchemaAssociationValidation}),this.validateBuildRules(e?.validateBuildRules),this.validateAssociations(e)}catch(e){if(!(e instanceof V))throw e;return e}return null}validateSchema(e=null){let t=e?.schema??this.cachedSchema;if(e?.skipSchemaAssociationValidation){t={...t};const e=Object.keys(this.constructor.associations),s=t.required.filter(t=>!e.includes(t));t.required=s}this._props=K.validate(this.constructor.name,this._props,t)}get cachedSchema(){return this.constructor._cachedSchema[this.constructor.name]||(this.constructor._cachedSchema[this.constructor.name]=this.constructor.getSchema()),this.constructor._cachedSchema[this.constructor.name]}static getSchema(){throw new Error("The entity class should declare its schema.")}validateBuildRules(e={}){}createAssociations(e={}){if(Object.keys(this.constructor.associations).length>0){const t=new V;for(const[s,i]of Object.entries(this.constructor.associations))try{this._props[s]&&(this[`_${W(s)}`]=new i(this._props[s],{...e,clone:!1}),delete this._props[s])}catch(e){if(!(e instanceof V))throw e;t.addAssociationError(s,e)}if(t.hasErrors())throw t}}static get associations(){return{}}get(e){(0,L.A)(e);const t=this.constructor.getSchema().properties[e];if(!t)throw new Error(`The property "${e}" has no schema definition.`);if(!X.includes(t?.type))throw new Error('The property "associated_entity" should reference scalar properties only.');return this._props[e]}set(e,t,s={}){(0,L.A)(e);const i=s?.validate??!0;if(this.isAssociation(e))this.setAssociation(e,t,s);else{const n=e.split(".")[0],r=this.constructor.getSchema().properties[n];if(!r)throw new Error(`The property "${n}" has no schema definition.`);if("array"===r?.type)this.setArrayProp(e,t,s);else{if(r?.type&&!X.includes(r?.type))throw new Error('The property "associated_entity" should reference scalar properties only.');if(r?.anyOf?.some(e=>!X.includes(e.type)))throw new Error('The property "associated_entity" should reference scalar properties only.');i&&K.validateProp(n,t,r),this._props[n]=t}}}setArrayProp(e,t,s){(0,L.A)(e);const i=e.split("."),n=i[0];let r=null;const a=this.constructor.getSchema().properties[n],o=s?.validate??!0;if(2!==i.length)throw new Error(`The property "${i[0]}" has no index passed.`);{const e=i[1].match(/^(\d+)$/);if(!e)throw new Error(`The property "${i[0]}" has an invalid index format. Expected format: digits.`);r=parseInt(e[1],10)}if(!X.includes(a.items.type))throw new Error('The property "associated_entity" with array type should reference scalar properties only.');o&&K.validateProp(n,t,a.items),this._props[n]||(this._props[n]=[]),null!=t?this._props[n][r]=t:this._props[n].splice(r,1)}setCollection(e,t,s){(0,L.A)(e);const i=e.split("."),n=i[0];let r=null;if(1===i.length)t instanceof this.constructor.associations[e]?this[`_${n}`]=t:this[`_${n}`]=new this.constructor.associations[e](t,s);else{if(!(i.length>1))throw new Error(`The property "${i[0]}" has no index passed.`);{const e=i[1].match(/^(\d+)$/);if(!e)throw new Error(`The property "${i[0]}" has an invalid index format. Expected format: digits.`);r=parseInt(e[1],10)}}if(!this[`_${n}`])throw new Error(`The collection "${i[0]}" has no item".`);if(null!=t)if(i.length>2){if(!this[`_${n}`]._items[r])throw new Error(`The collection "${i[0]}" has no item at the index "${i[1]}".`);const e=i.slice(2).join(".");this[`_${n}`]._items[r].set(e,t,s)}else this[`_${n}`].push(t,s,s);else this[`_${n}`].items.splice(r,1)}setAssociation(e,t,s={}){if((0,L.A)(e),this.isAssociation(e)){const i=e.split("."),n=W(i[0]);if(i.length>1)if(this[`_${n}`]||(this[`_${n}`]=new this.constructor.associations[i[0]]({},{validate:!1})),this[`_${n}`]instanceof J){const e=i.toSpliced(0,1,n).join(".");this.setCollection(e,t,s)}else{const e=i.slice(1).join(".");this[`_${n}`].set(e,t,s)}else t instanceof this.constructor.associations[e]?this[`_${n}`]=t:this[`_${n}`]=new this.constructor.associations[e](t,s)}}validateAssociations(e={}){const t=new V;if(Object.keys(this.constructor.associations).length>0&&Object.keys(this.constructor.associations).forEach(s=>{const i=W(s);if(this[`_${i}`]){const n=this[i].validate(e);n&&t.addAssociationError(s,n)}}),t.hasErrors())throw t}diffProps(e){if(!(e instanceof Q))throw new TypeError('The property "compareEntity" should be of "EntityV2" type.');const t={},s=this.constructor.getSchema(),i=Object.keys(s.properties).filter(e=>X.includes(s.properties[e].type));for(const s of i){const i=this.get(s),n=e.get(s);i!==n&&(t[s]=n)}return t}hasDiffProps(e){const t=this.diffProps(e);return Object.keys(t).length>0}isAssociation(e){const t=e.split(".")[0];return Boolean(this.constructor.associations?.[t])}}const ee=Q,te=(e,t)=>t.split(".").reduce((e,t)=>e?.[t],e);s.dn(te);const se=(e,t)=>{if(void 0===e||"string"!=typeof e||!e.length)return!1;if((t=t||{}).whiteListedProtocols&&!Array.isArray(t.whiteListedProtocols))throw new TypeError("The whiteListedProtocols should be an array of string.");if(t.defaultProtocol&&"string"!=typeof t.defaultProtocol)throw new TypeError("The defaultProtocol should be a string.");const s=t.whiteListedProtocols||[ie.HTTP,ie.HTTPS],i=[ie.JAVASCRIPT],n=t.defaultProtocol||"";!/^(?:(?!:\/\/).)*:\/\//.test(e)&&n&&(e=`${n}//${e}`);try{const t=new URL(e);return!i.includes(t.protocol)&&!!s.includes(t.protocol)&&t.href}catch(e){return console.error("Failed to sanitize URL:",e),!1}};s.dn(se);const ie={FTP:"http:",FTPS:"https:",HTTP:"http:",HTTPS:"https:",JAVASCRIPT:"javascript:",SSH:"ssh:"},ne="enabled",re="disabled",ae="not found";class oe extends ee{static getSchema(){return{type:"object",required:[],properties:{status:{type:"string",enum:[ne,re,ae]},app:{type:"object"},passbolt:{type:"object"},serverTimeDiff:{type:"integer",nullable:!0}}}}marshall(){void 0===this._props.status&&(this._props.status=ne),oe.sanitizeEmailValidateRegex(this._props)}static sanitizeEmailValidateRegex(e){const t=e?.passbolt?.email?.validate?.regex;t&&"string"==typeof t&&t.trim().length&&(e.passbolt.email.validate.regex=t.trim().replace(/^\/+/,"").replace(/\/+$/,""))}static get disabledSiteSettings(){return{status:re}}toDto(){return{...this._props}}toJSON(){return this.toDto()}canIUse(e){const t=this._props?.passbolt?.plugins?.[e];return!(!t||"object"!=typeof t||void 0!==t.enabled&&!0!==t.enabled&&"true"!==t.enabled)}isPluginEnabled(e){return this.canIUse(e)}isFeatureBeta(e){return(0,L.A)(e),te(this._props,`passbolt.plugins.${e}.isInBeta`)||!1}getPluginSettings(e){return te(this._props,`passbolt.plugins.${e}`)}getRememberMeOptions(){return(this.getPluginSettings("rememberMe")||{}).options||{}}get hasRememberMeUntilILogoutOption(){return void 0!==(this.getRememberMeOptions()||{})[-1]}get generatorConfiguration(){return te(this._props,"passbolt.plugins.generator.configuration")}get locale(){return te(this._props,"app.locale")||oe.DEFAULT_LOCALE.locale}async setLocale(e){this._props.app||(this._props.app={}),this._props.app.locale=e}get supportedLocales(){return te(this._props,"passbolt.plugins.locale.options")||oe.DEFAULT_SUPPORTED_LOCALES}getServerTimezone(){return te(this._props,"passbolt.app.server_timezone")}get termsLink(){const e=te(this._props,"passbolt.legal.terms.url");return!!e&&se(e)}get privacyLink(){const e=te(this._props,"passbolt.legal.privacy_policy.url");return!!e&&se(e)}get registrationPublic(){return!0===te(this._props,"passbolt.registration.public")}get debug(){return!0===te(this._props,"app.debug")}get url(){return te(this._props,"app.url")||""}get version(){return te(this._props,"app.version.number")}get isCommunityEdition(){return"ce"===te(this._props,"passbolt.edition")}get emailValidateRegex(){return te(this._props,"passbolt.email.validate.regex")||null}isServerInPast(){return(this._props.serverTimeDiff||0)<0}get serverTime(){const e=this._props.serverTimeDiff||0;return(new Date).getTime()+e}static get ENTITY_NAME(){return"SiteSettings"}static get ORGANIZATION_ENABLED(){return ne}static get ORGANIZATION_DISABLED(){return re}static get ORGANIZATION_NOT_FOUND(){return ae}static get DEFAULT_LOCALE(){return{locale:"en-UK",label:"English"}}static get DEFAULT_SUPPORTED_LOCALES(){return[oe.DEFAULT_LOCALE]}}const le=oe;var ce=s(53050),de=s.n(ce);class pe{static validate(e){return"string"==typeof e&&de()("^[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[_\\p{L}0-9][-_\\p{L}0-9]*\\.)*(?:[\\p{L}0-9][-\\p{L}0-9]{0,62})\\.(?:(?:[a-z]{2}\\.)?[a-z]{2,})$","i").test(e)}}class he{constructor(e){if("string"!=typeof e)throw Error("The regex should be a string.");this.regex=new(de())(e)}validate(e){return"string"==typeof e&&this.regex.test(e)}}class ue{static validate(e,t){return ue.getValidator(t).validate(e)}static getValidator(e){return e&&e instanceof le&&e.emailValidateRegex?new he(e.emailValidateRegex):pe}}class me extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.createInputRefs(),this.bindEventHandlers()}get defaultState(){return{loading:!0,processing:!1,username:"",usernameError:null,agreedTerms:!1,agreedTermsError:null,hasAlreadyBeenValidated:!1}}componentDidMount(){null!==this.props.context.siteSettings&&this.setState({loading:!1},()=>{this.focusUsernameElement()})}async componentDidUpdate(){this.state.loading&&null!==this.props.context.siteSettings&&this.setState({loading:!1},()=>{this.focusUsernameElement()})}focusUsernameElement(){this.isFocusOnBrowserExtension()||this.usernameRef.current.focus()}isFocusOnBrowserExtension(){const e=document.activeElement;return!!e&&"iframe"===e.tagName.toLowerCase()}bindEventHandlers(){this.handleInputChange=this.handleInputChange.bind(this),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleUsernameInputOnKeyUp=this.handleUsernameInputOnKeyUp.bind(this)}createInputRefs(){this.usernameRef=i.createRef()}async handleInputChange(e){const t=e.target,s="checkbox"===t.type?t.checked:t.value,i=t.name;this.setState({[i]:s},async()=>{this.state.hasAlreadyBeenValidated&&this.validate()})}handleUsernameInputOnKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateUsernameInput();this.setState(e)}}async handleFormSubmit(e){if(e.preventDefault(),this.state.processing)return;this.setState({hasAlreadyBeenValidated:!0,processing:!0});const t=this.validate();this.hasValidationError(t)?this.setState({processing:!1}):this.props.apiTriageContext.onTriageRequested(this.state.username.trim())}validate(){const e=this.validateUsernameInput(),t=this.validateAgreedTerms();return this.setState({usernameError:e,agreedTermsError:t}),{usernameError:e,agreedTermsError:t}}validateUsernameInput(){let e=null;const t=this.state.username.trim();return t.length?ue.validate(t,this.props.context.siteSettings)||(e=this.translate("Please enter a valid email address.")):e=this.translate("A username is required."),this.setState({username:t}),e}validateAgreedTerms(){let e=!1;const t=this.privacyLink||this.termsLink,s=this.state.agreedTerms;return t&&!s&&(e=!0),e}hasValidationError(e){return null!==e.usernameError||e.agreedTermsError}hasAllInputDisabled(){return this.state.processing||this.state.loading}get privacyLink(){return!!this.props.context.siteSettings&&this.props.context.siteSettings.privacyLink}get termsLink(){return!!this.props.context.siteSettings&&this.props.context.siteSettings.termsLink}get translate(){return this.props.t}render(){return i.createElement("div",{className:"enter-username"},i.createElement("h1",null,i.createElement(_.x,null,"Please enter your email to continue.")),i.createElement("form",{acceptCharset:"utf-8",onSubmit:this.handleFormSubmit,noValidate:!0},i.createElement("div",{className:`input text required ${this.state.usernameError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"username"},i.createElement(_.x,null,"Email")),i.createElement("input",{id:"username-input",type:"text",ref:this.usernameRef,name:"username",value:this.state.username,onKeyUp:this.handleUsernameInputOnKeyUp,onChange:this.handleInputChange,placeholder:this.translate("you@organization.com"),required:"required",disabled:this.hasAllInputDisabled()}),this.state.usernameError&&i.createElement("div",{className:"error-message"},this.state.usernameError)),(this.privacyLink||this.termsLink)&&i.createElement("div",{className:"input checkbox "+(this.state.agreedTermsError?"error":"")},i.createElement("input",{type:"checkbox",name:"agreedTerms",value:this.state.agreedTerms,onChange:this.handleInputChange,id:"checkbox-terms",disabled:this.hasAllInputDisabled()}),i.createElement("label",{htmlFor:"checkbox-terms"},(this.privacyLink||this.termsLink)&&i.createElement("span",null,this.termsLink&&!this.privacyLink&&i.createElement(_.x,null,"I accept the"," ",i.createElement("a",{href:this.termsLink,target:"_blank",rel:"noopener noreferrer"},"terms")),!this.termsLink&&this.privacyLink&&i.createElement(_.x,null,"I accept the"," ",i.createElement("a",{href:this.privacyLink,target:"_blank",rel:"noopener noreferrer"},"privacy policy")),this.termsLink&&this.privacyLink&&i.createElement(_.x,null,"I accept the"," ",i.createElement("a",{href:this.termsLink,target:"_blank",rel:"noopener noreferrer"},"terms")," ","and the"," ",i.createElement("a",{href:this.privacyLink,target:"_blank",rel:"noopener noreferrer"},"privacy policy"))))),i.createElement("div",{className:"form-actions"},i.createElement(D,{disabled:this.hasAllInputDisabled(),big:!0,processing:this.state.processing,fullWidth:!0,value:this.translate("Next")}),this.props.isSsoRecoverEnabled&&i.createElement("button",{className:"link",type:"button",onClick:this.props.onSecondaryActionClick},i.createElement(_.x,null,"Continue with SSO.")))))}}me.defaultProps={isSsoRecoverEnabled:!1},me.propTypes={apiTriageContext:d().object,context:d().any,isSsoRecoverEnabled:d().bool.isRequired,onSecondaryActionClick:d().func,t:d().func};const ge=a(C((0,P.C)("common")(me)));class Ee extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.createInputRefs(),this.bindEventHandlers()}componentDidMount(){this.setState({loading:!1},()=>{this.firstnameRef.current.focus()})}get defaultState(){return{loading:!0,processing:!1,firstname:"",firstnameError:null,lastname:"",lastnameError:null,hasAlreadyBeenValidated:!1}}bindEventHandlers(){this.handleInputChange=this.handleInputChange.bind(this),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleFirstnameInputOnKeyUp=this.handleFirstnameInputOnKeyUp.bind(this),this.handleLastnameInputOnKeyUp=this.handleLastnameInputOnKeyUp.bind(this)}createInputRefs(){this.firstnameRef=i.createRef(),this.lastnameRef=i.createRef()}handleInputChange(e){const t=e.target,s=t.value,i=t.name;this.setState({[i]:s})}handleFirstnameInputOnKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateFirstnameInput();this.setState(e)}}handleLastnameInputOnKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateLastnameInput();this.setState(e)}}async handleFormSubmit(e){if(e.preventDefault(),this.state.processing)return;this.setState({hasAlreadyBeenValidated:!0,processing:!0});const t=this.validate();if(this.hasValidationError(t))return this.setState({processing:!1}),void this.focusFirstFieldError(t);await this.props.apiTriageContext.onRegistrationRequested(this.state.firstname,this.state.lastname)}validate(){const e=this.validateFirstnameInput(),t=this.validateLastnameInput();return this.setState({firstnameError:e,lastnameError:t}),{firstnameError:e,lastnameError:t}}validateFirstnameInput(){let e=null;return this.state.firstname.trim().length||(e=this.translate("A first name is required.")),e}validateLastnameInput(){let e=null;return this.state.lastname.trim().length||(e=this.translate("A last name is required.")),e}focusFirstFieldError(e){e.firstnameError?this.firstnameRef.current.focus():e.lastnameError&&this.lastnameRef.current.focus()}hasValidationError(e){return null!==e.firstnameError||null!==e.lastnameError}hasAllInputDisabled(){return this.state.processing||this.state.loading}get translate(){return this.props.t}render(){return i.createElement("div",{className:"enter-name"},i.createElement("h1",null,i.createElement(_.x,null,"New here? Enter your name to get started.")),i.createElement("form",{acceptCharset:"utf-8",onSubmit:this.handleFormSubmit,noValidate:!0},i.createElement("div",{className:`input text required ${this.state.firstnameError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"firstname"},i.createElement(_.x,null,"First name")),i.createElement("input",{id:"firstname-input",type:"text",name:"firstname",ref:this.firstnameRef,value:this.state.firstname,onKeyUp:this.handleFirstnameInputOnKeyUp,onChange:this.handleInputChange,disabled:this.hasAllInputDisabled(),placeholder:this.translate("First name"),required:"required"}),this.state.firstnameError&&i.createElement("div",{className:"error-message"},this.state.firstnameError)),i.createElement("div",{className:`input text required ${this.state.lastnameError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"lastname"},i.createElement(_.x,null,"Last name")),i.createElement("input",{id:"lastname-input",type:"text",name:"lastname",ref:this.lastnameRef,value:this.state.lastname,onKeyUp:this.handleLastnameInputOnKeyUp,onChange:this.handleInputChange,disabled:this.hasAllInputDisabled(),placeholder:this.translate("Last name"),required:"required"}),this.state.lastnameError&&i.createElement("div",{className:"error-message"},this.state.lastnameError)),i.createElement("div",{className:"form-actions"},i.createElement(D,{disabled:this.hasAllInputDisabled(),big:!0,fullWidth:!0,processing:this.state.processing,value:this.translate("Sign up")}),i.createElement("a",{href:`${this.props.context.trustedDomain}/auth/login?locale=${this.props.context.locale}`,rel:"noopener noreferrer"},i.createElement(_.x,null,"I already have an account")))))}}Ee.propTypes={apiTriageContext:d().object,context:d().any,t:d().func};const ye=a(C((0,P.C)("common")(Ee)));class fe extends i.Component{render(){return i.createElement("div",{className:"email-sent-instructions"},i.createElement("div",{className:"email-sent-bg"}),i.createElement("h1",null,i.createElement(_.x,null,"Check your mailbox!")),i.createElement("p",null,i.createElement(_.x,null,"We sent you a link to verify your email."),i.createElement("br",null),i.createElement(_.x,null,"Check your spam folder if you do not hear from us after a while.")))}}fe.propTypes={};const be=(0,P.C)("common")(fe);class Se extends i.Component{render(){return i.createElement("div",{className:"setup-error"},i.createElement("h1",null,i.createElement(_.x,null,"Access to this service requires an invitation.")),i.createElement("p",null,i.createElement(_.x,null,"This email is not associated with any approved users on this domain.")," ",i.createElement(_.x,null,"Please contact your administrator to request an invitation link.")),i.createElement("div",{className:"form-actions"},i.createElement("a",{href:`${this.props.context.trustedDomain}/users/recover`,className:"button primary big full-width",role:"button",rel:"noopener noreferrer"},i.createElement(_.x,null,"Try with another email"))))}}Se.propTypes={context:d().any};const Te=a((0,P.C)("common")(Se));var we;function ve(){return ve=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ve.apply(null,arguments)}const Ce=function(e){return i.createElement("svg",ve({xmlns:"http://www.w3.org/2000/svg",width:10,height:8,fill:"none",viewBox:"0 0 10 8"},e),we||(we=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m1 2 4 4 4-4"})))};var Ae;function Re(){return Re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},Re.apply(null,arguments)}const xe=function(e){return i.createElement("svg",Re({xmlns:"http://www.w3.org/2000/svg",width:8,height:10,fill:"none",viewBox:"0 0 8 10"},e),Ae||(Ae=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m2 9 4-4-4-4"})))};class _e{static reload(){window.location.reload()}static assign(e){window.location.assign(e)}static getHostname(){return window.location.hostname}}class Pe extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindCallbacks()}get defaultState(){return{showErrorDetails:!1}}bindCallbacks(){this.handleErrorDetailsToggle=this.handleErrorDetailsToggle.bind(this)}onClick(){this.props.context.port?this.props.context.port.request("passbolt.tab.reload"):_e.reload()}handleErrorDetailsToggle(){this.setState({showErrorDetails:!this.state.showErrorDetails})}get hasErrorDetails(){const e=this.props?.error;return Boolean(e?.details)||Boolean(e?.data?.body)}formatErrors(){const e=this.props.error?.details||this.props.error?.data;return JSON.stringify(e,null,4)}render(){return i.createElement("div",{className:"setup-error"},i.createElement("h1",null,this.props.title),i.createElement("p",null,this.props.message),i.createElement("p",null,this.props.error&&this.props.error.message),this.hasErrorDetails&&i.createElement("div",{className:"accordion error-details"},i.createElement("div",{className:"accordion-header"},i.createElement("button",{className:"no-border",type:"button",onClick:this.handleErrorDetailsToggle},this.state.showErrorDetails?i.createElement(Ce,{className:"caret-down"}):i.createElement(xe,{className:"caret-right"}),i.createElement("span",null,i.createElement(_.x,null,"Error details")))),this.state.showErrorDetails&&i.createElement("div",{className:"accordion-content"},i.createElement("div",{className:"input text"},i.createElement("label",{htmlFor:"js_field_debug",className:"visuallyhidden"},i.createElement(_.x,null,"Error details")),i.createElement("textarea",{id:"js_field_debug",defaultValue:`${this.formatErrors()}`,readOnly:!0})))),i.createElement("div",{className:"form-actions"},i.createElement("button",{onClick:this.onClick.bind(this),className:"button primary big full-width",role:"button"},i.createElement(_.x,null,"Try again"))))}}Pe.defaultProps={title:i.createElement(_.x,null,"Something went wrong!"),message:i.createElement(_.x,null,"The operation failed with the following error:")},Pe.propTypes={context:d().any,title:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),message:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),error:d().any};const Ie=a((0,P.C)("common")(Pe));Error;const Ne=/^[a-f0-9]{8}-[a-f0-9]{4}-[0-5][a-f0-9]{3}-[089ab][a-f0-9]{3}-[a-f0-9]{12}$/i,Oe=Ne.source.slice(1,-1),Ue=new RegExp(`(?:^|/)setup/(?:recover|start)/${Oe}/${Oe}/?$`,"i"),ke=class{constructor(e,t){t.setResourceName("/sso/recover/start"),this.apiClient=new f(t),this.expectedUrl=new URL(e)}async getRecoverUrl(e){const t={token:e,case:"default"},s=await this.apiClient.create(t),i=new URL(s.body.url);if(i.origin!==this.expectedUrl.origin)throw new Error("The url should be from the same origin.");if(!Ue.test(i.pathname))throw new Error("The url should point to a valid recover or start page.");return i}},De=/^https:\/\/.+[^/]$/;class Le extends j{constructor(e,t={}){super(K.validate(Le.ENTITY_NAME,e,Le.getSchema()),t)}static getSchema(){return{type:"object",required:["url","openid_configuration_path","scope","client_id","client_secret"],properties:{url:{type:"string",pattern:De},openid_configuration_path:{type:"string",minLength:1},scope:{type:"string",minLength:1},client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1}}}}static validateUrl(e){if("string"!=typeof e)throw new TypeError("The url should be a string.");let t;try{t=new URL(e)}catch(e){throw new Error("The url should be a valid url.",{cause:e})}if("https:"!==t.protocol)throw new Error("The url protocol should be HTTPS.")}static get ENTITY_NAME(){return"ADFSSsoSettings"}static get PROVIDER_ID(){return"adfs"}}const qe=Le,Ge=["https://login.microsoftonline.com","https://login.microsoftonline.us","https://login.partner.microsoftonline.cn"];class Me extends j{constructor(e,t={}){const s=Me.sanitizeDto(e);super(K.validate(Me.ENTITY_NAME,s,Me.getSchema()),t)}static getSchema(){return{type:"object",required:["url","client_id","tenant_id","client_secret","client_secret_expiry"],properties:{url:{type:"string",enum:Ge},client_id:{type:"string",format:"uuid"},tenant_id:{type:"string",format:"uuid"},client_secret:{type:"string",minLength:1},client_secret_expiry:{type:"string",format:"date-time"},email_claim:{type:"string",enum:["email","preferred_username","upn"]},prompt:{type:"string",enum:["login","none"]},login_hint:{type:"boolean"}}}}static sanitizeDto(e){return e=Object.assign({},e),e?.email_claim||(e.email_claim="email"),e?.prompt||(e.prompt="login"),void 0===e.login_hint&&(e.login_hint=!0),e}static get ENTITY_NAME(){return"AzureSsoSettings"}static get PROVIDER_ID(){return"azure"}static get SUPPORTED_URLS(){return Ge}}const Ve=Me,$e=["https://accounts.google.com"];class Fe extends j{constructor(e,t={}){super(K.validate(Fe.ENTITY_NAME,e,Fe.getSchema()),t)}static getSchema(){return{type:"object",required:["client_id","client_secret"],properties:{client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1}}}}static get ENTITY_NAME(){return"GoogleSsoSettings"}static get PROVIDER_ID(){return"google"}static get SUPPORTED_URLS(){return $e}}const He=Fe,Ke=["https://auth.pingone.com","https://auth.pingone.eu","https://auth.pingone.ca","https://auth.pingone.asia","https://auth.pingone.com.au","https://auth.pingone.sg"],Be=class extends ee{static getSchema(){return{type:"object",required:["url","environment_id","client_id","client_secret","email_claim"],properties:{url:{type:"string",enum:Ke},environment_id:{type:"string",minLength:1},client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1},email_claim:{type:"string",minLength:1}}}}static get ENTITY_NAME(){return"PingOneSsoSettings"}static get PROVIDER_ID(){return"pingone"}static get SUPPORTED_URLS(){return Ke}},je=/^https:\/\/.+[^/]$/;class We extends j{constructor(e,t={}){super(K.validate(We.ENTITY_NAME,e,We.getSchema()),t)}static getSchema(){return{type:"object",required:["url","openid_configuration_path","scope","client_id","client_secret"],properties:{url:{type:"string",pattern:je},openid_configuration_path:{type:"string",minLength:1},scope:{type:"string",minLength:1},client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1}}}}static get ENTITY_NAME(){return"OAuth2SsoSettings"}static get PROVIDER_ID(){return"oauth2"}}const Ye=We,ze={[Ve.PROVIDER_ID]:Ve.SUPPORTED_URLS,[He.PROVIDER_ID]:He.SUPPORTED_URLS,[Be.PROVIDER_ID]:Be.SUPPORTED_URLS},Ze=[Ye.PROVIDER_ID,qe.PROVIDER_ID],Je=class{constructor(e){this.apiClientOptions=e}async getUrl(e){this.apiClientOptions.setResourceName(`/sso/recover/${e}`);const t=new f(this.apiClientOptions),s=await t.create(),i=new URL(s.body.url),n=ze[e];if(Ze.includes(e))return i;if(!n)throw new Error("The url should be part of the list of supported single sign-on urls.");if(!n.some(e=>e===i.origin))throw new Error("The url should be part of the list of supported single sign-on urls.");return i}},Xe="default",Qe="registration_required",et=class{constructor(e,t){this.popup=null,this.intervalCheck=null,this.expectedSuccessUrl=`${e}/sso/recover/${t}/success`,this.expectedErrorUrl=`${e}/sso/recover/error`,this.resolvePromise=null,this.rejectPromise=null,this.verifyPopup=this.verifyPopup.bind(this),this.handlePopupVerification=this.handlePopupVerification.bind(this),this.processSuccessUrl=this.processSuccessUrl.bind(this),this.processErrorUrl=this.processErrorUrl.bind(this)}getSsoTokenFromThirdParty(e){return this.popup=window.open(void 0,"__blank","popup,width=380,height=600"),this.popup.opener=null,this.popup.location.href=e.toString(),new Promise(this.handlePopupVerification)}handlePopupVerification(e,t){this.resolvePromise=e,this.rejectPromise=t,this.intervalCheck=setInterval(this.verifyPopup,200)}verifyPopup(){if(!this.popup||this.popup?.closed)return this.rejectPromise(new Error("The user navigated away from the tab where the SSO sign-in initiated")),void this.close();let e=null;try{e=this.popup.location.href}catch(e){return void console.error(e)}e.startsWith(this.expectedSuccessUrl)?this.processSuccessUrl(e):e.startsWith(this.expectedErrorUrl)&&this.processErrorUrl(e)}processSuccessUrl(e){const t=new URL(e).searchParams.get("token");var s;s=t,new(de())(Ne).test(s)&&(this.resolvePromise({case:Xe,token:t}),this.close())}processErrorUrl(e){const t=new URL(e).searchParams.get("email");var s;s=t,new(de())("^[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[_\\p{L}0-9][-_\\p{L}0-9]*\\.)*(?:[\\p{L}0-9][-\\p{L}0-9]{0,62})\\.(?:(?:[a-z]{2}\\.)?[a-z]{2,})$").test(s)&&(this.resolvePromise({case:Qe,email:t}),this.close())}close(){this.rejectPromise=null,this.resolvePromise=null,this.popup?.close(),this.popup=null,clearInterval(this.intervalCheck)}},tt=class{constructor(e,t,s,i){this.providerId=e,this.apiClientOptions=t.getApiClientOptions();const n=t.trustedDomain.replace(/\/$/,"");this.getUrlForSsoIdentificationService=new Je(t.getApiClientOptions()),this.getRecoverUrlService=new ke(n,t.getApiClientOptions()),this.ssoPopupHandler=new et(n,e),this.successCallback=s,this.registrationRequiredCallback=i}async exec(){const e=await this.getUrlForSsoIdentificationService.getUrl(this.providerId),t=await this.ssoPopupHandler.getSsoTokenFromThirdParty(e);if(t.case===Xe){const e=await this.getRecoverUrlService.getRecoverUrl(t.token);this.successCallback(e.toString())}else t.case===Qe&&this.registrationRequiredCallback(t.email)}stopProcess(){this.ssoPopupHandler.close()}};class st extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindEventHandlers(),this.identifyViaSsoService=new tt(this.props.ssoProvider.id,this.props.context,this.handleSsoAuthSuccess,this.handleSsoAuthSuccessForRegistration)}get defaultState(){return{processing:!1}}componentDidMount(){window.addEventListener("beforeunload",this.handleBeforeUnload)}componentWillUnmount(){this.handleBeforeUnload()}handleBeforeUnload(){this.identifyViaSsoService.stopProcess(),window.removeEventListener("beforeunload",this.handleBeforeUnload)}bindEventHandlers(){this.handleBeforeUnload=this.handleBeforeUnload.bind(this),this.handleSsoRecoverClick=this.handleSsoRecoverClick.bind(this),this.handleGoToEmailClick=this.handleGoToEmailClick.bind(this),this.handleSsoAuthSuccess=this.handleSsoAuthSuccess.bind(this),this.handleSsoAuthSuccessForRegistration=this.handleSsoAuthSuccessForRegistration.bind(this)}async handleSsoRecoverClick(){if(!this.state.processing){this.setState({processing:!0});try{await this.identifyViaSsoService.exec()}catch(e){console.error('Failed to identify via sso":',e)}finally{this.setState({processing:!1})}}}handleSsoAuthSuccess(e){const t=se(e);if(!t)throw new Error("The redirection URL is invalid. It must use a valid http or https protocol.");const s=new URL(window.location.href),i=new URL(t);if(s.origin!==i.origin)throw new Error("The redirection URL is invalid. It must happen within the same origin as the current window");window.location.href=i.toString()}handleSsoAuthSuccessForRegistration(e){this.props.onUserRegistrationRequired(e)}handleGoToEmailClick(){this.identifyViaSsoService.stopProcess(),this.props.onSecondaryActionClick()}isProcessing(){return this.state.processing}render(){const e=this.props.ssoProvider;if(!e)return null;const t=this.isProcessing(),s=t?"disabled":"";return i.createElement("div",{className:"enter-username"},i.createElement("h1",null,i.createElement(_.x,null,"Welcome back!")),i.createElement("p",null,i.createElement(_.x,null,"Your browser is not configured to work with this passbolt instance.")," ",i.createElement(_.x,null,"Please authenticate with the Single Sign-On provider to continue.")),i.createElement("div",{className:"sso-login-form form-actions"},i.createElement("button",{type:"button",className:`sso-login-button ${s} ${e.id}`,onClick:this.handleSsoRecoverClick,disabled:t},i.createElement("span",{className:"provider-logo"},e.icon),this.props.t("Sign in with {{providerName}}",{providerName:e.name})),i.createElement("button",{type:"button",className:"link",onClick:this.handleGoToEmailClick},i.createElement(_.x,null,"Continue with my email."))))}}st.propTypes={ssoProvider:d().object,onSecondaryActionClick:d().func,onUserRegistrationRequired:d().func,context:d().any,t:d().func};const it=a((0,P.C)("common")(st));class nt extends i.Component{componentDidMount(){this.initializeTriage(),this.getSsoProviderData=this.getSsoProviderData.bind(this)}initializeTriage(){setTimeout(this.props.apiTriageContext.onInitializeTriageRequested,1e3)}getSsoProviderData(){const e=this.props.apiTriageContext.getSsoProviderId();return S.find(t=>t.id===e)}render(){switch(this.props.apiTriageContext.state){case A.USERNAME_STATE:return i.createElement(ge,{isSsoRecoverEnabled:this.props.apiTriageContext.isSsoRecoverEnabled,onSecondaryActionClick:this.props.apiTriageContext.handleSwitchToSsoSignInState});case A.SSO_SIGN_IN_STATE:return i.createElement(it,{ssoProvider:this.getSsoProviderData(),onSecondaryActionClick:this.props.apiTriageContext.handleSwitchToUsernameState,onUserRegistrationRequired:this.props.apiTriageContext.handleSwitchToEnterNameState});case A.CHECK_MAILBOX_STATE:return i.createElement(be,null);case A.NAME_STATE:return i.createElement(ye,null);case A.USERNAME_NOT_FOUND_ERROR:return i.createElement(Te,null);case A.UNEXPECTED_ERROR_STATE:return i.createElement(Ie,{error:this.props.apiTriageContext.unexpectedError});default:return i.createElement(U,null)}}}nt.propTypes={apiTriageContext:d().object};const rt=C(nt);var at;function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ot.apply(null,arguments)}const lt=function(e){return i.createElement("svg",ot({xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),at||(at=i.createElement("g",{clipPath:"url(#heart_svg__clip0_93_734678)"},i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M13.497 9.333c.993-.973 2-2.14 2-3.666A3.667 3.667 0 0 0 11.83 2c-1.173 0-2 .333-3 1.333-1-1-1.827-1.333-3-1.333a3.667 3.667 0 0 0-3.667 3.667c0 1.533 1 2.7 2 3.666L8.83 14z"}))))};class ct extends i.Component{render(){return i.createElement("div",{className:"tooltip",tabIndex:"0"},this.props.children,i.createElement("span",{className:`tooltip-text ${this.props.direction}`},this.props.message))}}ct.defaultProps={direction:"right"},ct.propTypes={children:d().any,message:d().any.isRequired,direction:d().string};const dt=ct;var pt=s(28097),ht=s(44296);const ut=i.createContext({dialogs:[],open:()=>{},close:()=>{}});class mt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{dialogs:[],open:(e,t)=>{const s=(0,ht.A)();return this.setState(i=>({dialogs:[...i.dialogs,{key:s,Dialog:e,DialogProps:t}]})),s},close:e=>{this.setState(t=>({dialogs:t.dialogs.filter(t=>e!==t.key)}))},closeAll:()=>this.setState({dialogs:[]})}}render(){return i.createElement(ut.Provider,{value:this.state},this.props.children)}}function gt(e){return class extends i.Component{render(){return i.createElement(ut.Consumer,null,t=>i.createElement(e,{dialogContext:t,...this.props}))}}}mt.displayName="DialogContextProvider",mt.propTypes={children:d().any};var Et=s(75410);const yt=["/app/administration","/app/administration/mfa","/app/administration/mfa-policy","/app/administration/password-policies","/app/administration/secret-history","/app/administration/self-registration","/app/administration/users-directory","/app/administration/healthcheck","/app/administration/email-notification","/app/administration/smtp-settings","/app/administration/subscription","/app/administration/ce-downgrade","/app/administration/internationalization","/app/administration/account-recovery","/app/administration/sso","/app/administration/rbacs","/app/administration/content-types/metadata-getting-started","/app/administration/user-provisionning/scim","/app/administration/user-passphrase-policies","/app/administration/password-expiry","/app/administration/content-types/metadata","/app/administration/content-types/metadata-key","/app/administration/migrate-metadata","/app/administration/allow-content-types","/app/administration/subscription-teasing","/app/administration/password-policies-teasing","/app/administration/user-passphrase-policies-teasing","/app/administration/account-recovery-teasing","/app/administration/sso-teasing","/app/administration/mfa-policy-teasing","/app/administration/users-directory-teasing","/app/administration/scim-teasing","/app/administration/offline","/app/passwords","/app/users","/app/settings/profile","/app/settings/passphrase","/app/settings/security-token","/app/settings/theme","/app/settings/mfa","/app/settings/keys","/app/settings/mobile","/app/settings/desktop","/app/settings/account-recovery"],ft=i.createContext({onGoToAdministrationRequested:()=>{},onGoToAdministrationSelfRegistrationRequested:()=>{},onGoToAdministrationMfaRequested:()=>{},onGoToAdministrationUsersDirectoryRequested:()=>{},onGoToAdministrationEmailNotificationsRequested:()=>{},onGoToAdministrationSubscriptionRequested:()=>{},onGoToAdministrationDowngradeToCeRequested:()=>{},onGoToAdministrationInternationalizationRequested:()=>{},onGoToAdministrationAccountRecoveryRequested:()=>{},onGoToAdministrationSmtpSettingsRequested:()=>{},onGoToAdministrationSsoRequested:()=>{},onGoToAdministrationPasswordPoliciesRequested:()=>{},onGoToAdministrationSecretHistoryRequested:()=>{},onGoToAdministrationUserPassphrasePoliciesRequested:()=>{},onGoToAdministrationPasswordExpirySettingsRequested:()=>{},onGoToAdministrationHealthcheckRequested:()=>{},onGoToPasswordsRequested:()=>{},onGoToUsersRequested:()=>{},onGoToTermsRequested:()=>{},onGoToHelpRequested:()=>{},onGoToUserSettingsProfileRequested:()=>{},onGoToUserSettingsPassphraseRequested:()=>{},onGoToUserSettingsSecurityTokenRequested:()=>{},onGoToUserSettingsThemeRequested:()=>{},onGoToUserSettingsMfaRequested:()=>{},onGoToUserSettingsKeysRequested:()=>{},onGoToUserSettingsMobileRequested:()=>{},onGoToUserSettingsDesktopRequested:()=>{},onGoToUserSettingsAccountRecoveryRequested:()=>{},onGoToSubscriptionUpdateQuantityRequested:()=>{},onGoToSubscriptionRenewRequested:()=>{},onGoToAdministrationRbacsRequested:()=>{},onGoToAdministrationMigrateMetadataRequested:()=>{},onGoToAdministrationAllowContentTypesRequested:()=>{},onGoToAdministrationMetadataGettingStartedRequested:()=>{},onGoToAdministrationSubscriptionRequestedTeasing:()=>{},onGoToAdministrationPasswordPoliciesRequestedTeasing:()=>{},onGoToAdministrationUserPassphrasePoliciesRequestedTeasing:()=>{},onGoToAdministrationAccountRecoveryRequestedTeasing:()=>{},onGoToAdministrationSsoRequestedTeasing:()=>{},onGoToAdministrationMfaPolicyRequestedTeasing:()=>{},onGoToAdministrationUsersDirectoryRequestedTeasing:()=>{},onGoToAdministrationScimRequestedTeasing:()=>{},onGoToAdministrationScimRequested:()=>{},onGoToAdministrationOfflineRequested:()=>{}});class bt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{onGoToAdministrationRequested:this.onGoToAdministrationRequested.bind(this),onGoToAdministrationMfaRequested:this.onGoToAdministrationMfaRequested.bind(this),onGoToAdministrationUsersDirectoryRequested:this.onGoToAdministrationUsersDirectoryRequested.bind(this),onGoToAdministrationEmailNotificationsRequested:this.onGoToAdministrationEmailNotificationsRequested.bind(this),onGoToAdministrationSubscriptionRequested:this.onGoToAdministrationSubscriptionRequested.bind(this),onGoToAdministrationDowngradeToCeRequested:this.onGoToAdministrationDowngradeToCeRequested.bind(this),onGoToAdministrationInternationalizationRequested:this.onGoToAdministrationInternationalizationRequested.bind(this),onGoToAdministrationAccountRecoveryRequested:this.onGoToAdministrationAccountRecoveryRequested.bind(this),onGoToAdministrationSmtpSettingsRequested:this.onGoToAdministrationSmtpSettingsRequested.bind(this),onGoToAdministrationSelfRegistrationRequested:this.onGoToAdministrationSelfRegistrationRequested.bind(this),onGoToAdministrationSsoRequested:this.onGoToAdministrationSsoRequested.bind(this),onGoToAdministrationMfaPolicyRequested:this.onGoToAdministrationMfaPolicyRequested.bind(this),onGoToAdministrationPasswordPoliciesRequested:this.onGoToAdministrationPasswordPoliciesRequested.bind(this),onGoToAdministrationSecretHistoryRequested:this.onGoToAdministrationSecretHistoryRequested.bind(this),onGoToAdministrationUserPassphrasePoliciesRequested:this.onGoToAdministrationUserPassphrasePoliciesRequested.bind(this),onGoToAdministrationPasswordExpirySettingsRequested:this.onGoToAdministrationPasswordExpirySettingsRequested.bind(this),onGoToAdministrationHealthcheckRequested:this.onGoToAdministrationHealthcheckRequested.bind(this),onGoToAdministrationContentTypesEncryptedMetadataRequested:this.onGoToAdministrationContentTypesEncryptedMetadataRequested.bind(this),onGoToAdministrationContentTypesMetadataKeyRequested:this.onGoToAdministrationContentTypesMetadataKeyRequested.bind(this),onGoToAdministrationMigrateMetadataRequested:this.onGoToAdministrationMigrateMetadataRequested.bind(this),onGoToAdministrationAllowContentTypesRequested:this.onGoToAdministrationAllowContentTypesRequested.bind(this),onGoToPasswordsRequested:this.onGoToPasswordsRequested.bind(this),onGoToUsersRequested:this.onGoToUsersRequested.bind(this),onGoToHelpRequested:this.onGoToHelpRequested.bind(this),onGoToTermsRequested:this.onGoToTermsRequested.bind(this),onGoToUserSettingsProfileRequested:this.onGoToUserSettingsProfileRequested.bind(this),onGoToUserSettingsPassphraseRequested:this.onGoToUserSettingsPassphraseRequested.bind(this),onGoToUserSettingsSecurityTokenRequested:this.onGoToUserSettingsSecurityTokenRequested.bind(this),onGoToUserSettingsThemeRequested:this.onGoToUserSettingsThemeRequested.bind(this),onGoToUserSettingsMfaRequested:this.onGoToUserSettingsMfaRequested.bind(this),onGoToUserSettingsKeysRequested:this.onGoToUserSettingsKeysRequested.bind(this),onGoToUserSettingsMobileRequested:this.onGoToUserSettingsMobileRequested.bind(this),onGoToUserSettingsDesktopRequested:this.onGoToUserSettingsDesktopRequested.bind(this),onGoToUserSettingsAccountRecoveryRequested:this.onGoToUserSettingsAccountRecoveryRequested.bind(this),onGoToSubscriptionUpdateQuantityRequested:this.onGoToSubscriptionUpdateQuantityRequested.bind(this),onGoToSubscriptionRenewRequested:this.onGoToSubscriptionRenewRequested.bind(this),onGoToAdministrationRbacsRequested:this.onGoToAdministrationRbacsRequested.bind(this),onGoToAdministrationMetadataGettingStartedRequested:this.onGoToAdministrationMetadataGettingStartedRequested.bind(this),onGoToAdministrationSubscriptionRequestedTeasing:this.onGoToAdministrationSubscriptionRequestedTeasing.bind(this),onGoToAdministrationPasswordPoliciesRequestedTeasing:this.onGoToAdministrationPasswordPoliciesRequestedTeasing.bind(this),onGoToAdministrationUserPassphrasePoliciesRequestedTeasing:this.onGoToAdministrationUserPassphrasePoliciesRequestedTeasing.bind(this),onGoToAdministrationAccountRecoveryRequestedTeasing:this.onGoToAdministrationAccountRecoveryRequestedTeasing.bind(this),onGoToAdministrationSsoRequestedTeasing:this.onGoToAdministrationSsoRequestedTeasing.bind(this),onGoToAdministrationMfaPolicyRequestedTeasing:this.onGoToAdministrationMfaPolicyRequestedTeasing.bind(this),onGoToAdministrationUsersDirectoryRequestedTeasing:this.onGoToAdministrationUsersDirectoryRequestedTeasing.bind(this),onGoToAdministrationScimRequestedTeasing:this.onGoToAdministrationScimRequestedTeasing.bind(this),onGoToAdministrationScimRequested:this.onGoToAdministrationScimRequested.bind(this),onGoToAdministrationOfflineRequested:this.onGoToAdministrationOfflineRequested.bind(this)}}async goTo(e,t){if(!yt.includes(t))throw new Error("The pathname is not part of the allowed list of pathnames.");if(e===this.props.context.name)return void await this.props.history.push({pathname:t});if("api"===e)return void await this.props.context.port.request("passbolt.tabs.open-admin-page",t);const s=`${this.props.context.userSettings?this.props.context.userSettings.getTrustedDomain():this.props.context.trustedDomain}${t}`;window.open(s,"_parent","noopener,noreferrer")}async onGoToAdministrationRequested(){await this.goTo("browser-extension","/app/administration")}async onGoToAdministrationMfaRequested(){await this.goTo("api","/app/administration/mfa")}async onGoToAdministrationMfaPolicyRequested(){await this.goTo("api","/app/administration/mfa-policy")}async onGoToAdministrationPasswordPoliciesRequested(){await this.goTo("browser-extension","/app/administration/password-policies")}async onGoToAdministrationSecretHistoryRequested(){await this.goTo("browser-extension","/app/administration/secret-history")}async onGoToAdministrationOfflineRequested(){await this.goTo("browser-extension","/app/administration/offline")}async onGoToAdministrationSelfRegistrationRequested(){await this.goTo("api","/app/administration/self-registration")}async onGoToAdministrationUsersDirectoryRequested(){await this.goTo("api","/app/administration/users-directory")}async onGoToAdministrationHealthcheckRequested(){await this.goTo("api","/app/administration/healthcheck")}async onGoToAdministrationEmailNotificationsRequested(){await this.goTo("api","/app/administration/email-notification")}async onGoToAdministrationSmtpSettingsRequested(){await this.goTo("api","/app/administration/smtp-settings")}async onGoToAdministrationSubscriptionRequested(){await this.goTo("browser-extension","/app/administration/subscription")}async onGoToAdministrationDowngradeToCeRequested(){await this.goTo("browser-extension","/app/administration/ce-downgrade")}async onGoToAdministrationInternationalizationRequested(){await this.goTo("api","/app/administration/internationalization")}async onGoToAdministrationAccountRecoveryRequested(){await this.goTo("browser-extension","/app/administration/account-recovery")}async onGoToAdministrationSsoRequested(){await this.goTo("browser-extension","/app/administration/sso")}async onGoToAdministrationRbacsRequested(){await this.goTo("api","/app/administration/rbacs")}async onGoToAdministrationMetadataGettingStartedRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata-getting-started")}async onGoToAdministrationScimRequested(){await this.goTo("browser-extension","/app/administration/user-provisionning/scim")}async onGoToAdministrationUserPassphrasePoliciesRequested(){await this.goTo("browser-extension","/app/administration/user-passphrase-policies")}async onGoToAdministrationPasswordExpirySettingsRequested(){await this.goTo("browser-extension","/app/administration/password-expiry")}async onGoToAdministrationContentTypesEncryptedMetadataRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata")}async onGoToAdministrationContentTypesMetadataKeyRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata-key")}async onGoToAdministrationMigrateMetadataRequested(){await this.goTo("browser-extension","/app/administration/migrate-metadata")}async onGoToAdministrationAllowContentTypesRequested(){await this.goTo("browser-extension","/app/administration/allow-content-types")}async onGoToAdministrationSubscriptionRequestedTeasing(){await this.goTo("browser-extension","/app/administration/subscription-teasing")}async onGoToAdministrationPasswordPoliciesRequestedTeasing(){await this.goTo("browser-extension","/app/administration/password-policies-teasing")}async onGoToAdministrationUserPassphrasePoliciesRequestedTeasing(){await this.goTo("browser-extension","/app/administration/user-passphrase-policies-teasing")}async onGoToAdministrationAccountRecoveryRequestedTeasing(){await this.goTo("browser-extension","/app/administration/account-recovery-teasing")}async onGoToAdministrationSsoRequestedTeasing(){await this.goTo("browser-extension","/app/administration/sso-teasing")}async onGoToAdministrationMfaPolicyRequestedTeasing(){await this.goTo("browser-extension","/app/administration/mfa-policy-teasing")}async onGoToAdministrationUsersDirectoryRequestedTeasing(){await this.goTo("browser-extension","/app/administration/users-directory-teasing")}async onGoToAdministrationScimRequestedTeasing(){await this.goTo("browser-extension","/app/administration/scim-teasing")}get isMfaEnabled(){const e=this.props.context.siteSettings;return e&&e.canIUse("multiFactorAuthentication")}get isUserDirectoryEnabled(){const e=this.props.context.siteSettings;return e&&e.canIUse("directorySync")}get isSmtpSettingsEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("smtpSettings")}get isSelfRegistrationEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("selfRegistration")}get isPasswordPoliciesEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("passwordPoliciesUpdate")}get isUserPassphrasePoliciesEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("userPassphrasePolicies")}get isPasswordExpiryEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("passwordExpiry")}async onGoToPasswordsRequested(){await this.goTo("browser-extension","/app/passwords")}async onGoToUsersRequested(){await this.goTo("browser-extension","/app/users")}async onGoToHelpRequested(){window.open("https://www.passbolt.com/docs/","_blank","noopener,noreferrer")}async onGoToTermsRequested(){window.open("https://www.passbolt.com/terms","_blank","noopener,noreferrer")}async onGoToSubscriptionUpdateQuantityRequested(e,t){const s=`https://www.passbolt.com/subscription/ee/update/qty?subscription_id=${encodeURIComponent(e)}&customer_id=${encodeURIComponent(t)}`;window.open(s,"_blank","noopener,noreferrer")}async onGoToSubscriptionRenewRequested(e,t){const s=`https://www.passbolt.com/subscription/ee/update/renew?subscription_id=${encodeURIComponent(e)}&customer_id=${encodeURIComponent(t)}`;window.open(s,"_blank","noopener,noreferrer")}async onGoToUserSettingsProfileRequested(){await this.goTo("browser-extension","/app/settings/profile")}async onGoToUserSettingsPassphraseRequested(){await this.goTo("browser-extension","/app/settings/passphrase")}async onGoToUserSettingsSecurityTokenRequested(){await this.goTo("browser-extension","/app/settings/security-token")}async onGoToUserSettingsThemeRequested(){await this.goTo("browser-extension","/app/settings/theme")}async onGoToUserSettingsMfaRequested(){await this.goTo("browser-extension","/app/settings/mfa")}async onGoToUserSettingsKeysRequested(){await this.goTo("browser-extension","/app/settings/keys")}async onGoToUserSettingsMobileRequested(){await this.goTo("browser-extension","/app/settings/mobile")}async onGoToUserSettingsDesktopRequested(){await this.goTo("browser-extension","/app/settings/desktop")}async onGoToUserSettingsAccountRecoveryRequested(){await this.goTo("browser-extension","/app/settings/account-recovery")}render(){return i.createElement(ft.Provider,{value:this.state},this.props.children)}}bt.displayName="NavigationContextProvider",bt.propTypes={context:d().object,children:d().any,location:d().object,match:d().object,history:d().object},(0,Et.withRouter)(a(bt));const St=i.createContext({counter:[],add:()=>{},remove:()=>{}});class Tt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{counter:0,add:()=>{this.setState(e=>({counter:e.counter+1}))},remove:()=>{this.setState(e=>({counter:Math.min(e.counter-1,0)}))}}}render(){return i.createElement(St.Provider,{value:this.state},this.props.children)}}Tt.propTypes={children:d().any};class wt{}class vt extends wt{static execute(){return!0}}class Ct extends wt{static execute(){return!1}}const At="Folders.use",Rt="Administration.viewWorkspace",xt="GroupsAdd.addPost",_t="AccountRecoveryRequestsView.view",Pt="AccountRecoveryRequestsIndex.index",It="AccountRecoveryResponsesCreate.post",Nt="Allow",Ot="Deny",Ut="AllowIfGroupManagerInOneGroup",kt={[Nt]:vt,[Ot]:Ct,[Ut]:class extends wt{static execute(e){return e.groups_users.some(e=>e.is_admin)}}},Dt={[At]:kt[Nt]},Lt={[Rt]:kt[Ot],[xt]:kt[Ot],[_t]:kt[Ot],[Pt]:kt[Ot],[It]:kt[Ot]};class qt{static getByRbac(e){return kt[e.controlFunction]||(console.warn(`Could not find control function for the given rbac entity (${e.id})`),Ct)}static getDefaultForAdminAndAction(e){return Dt[e]||vt}static getDefaultForUserAndAction(e){return Lt[e]||vt}}class Gt extends ee{static getSchema(){return{type:"object",required:["name"],properties:{id:{type:"string",format:"uuid"},name:{type:"string",minLength:1,maxLength:50},description:{type:"string",maxLength:255,nullable:!0},created:{type:"string",format:"date-time"},modified:{type:"string",format:"date-time"}}}}validateBuildRules(){this.assertNoTrailingSpaces("name",this._props.name)}get id(){return this._props.id||null}get name(){return this._props.name}isAdmin(){return this.name.toLowerCase()===Gt.ROLE_ADMIN}isUser(){return this.name.toLowerCase()===Gt.ROLE_USER}isGuest(){return this.name.toLowerCase()===Gt.ROLE_GUEST}isAReservedRole(){return this.isAdmin()||this.isUser()||this.isGuest()}verifyHealth(){let e=null;return 50===this.name.length&&(e=new V,e.addError("name","maxLength","name reached maximum length limit")),e}assertNoTrailingSpaces(e,t){if(t.trim()!==t){const t=new V;throw t.addError(e,"trailing-spaces",`The property (${e}) contains forbidden trailing spaces.`),t}}static get ENTITY_NAME(){return"Role"}static get ROLE_ADMIN(){return"admin"}static get ROLE_USER(){return"user"}static get ROLE_GUEST(){return"guest"}static get ROLE_NAME_MAX_LENGTH(){return 50}toUpdateDto(){return{name:this.name}}}class Mt{static canRoleUseAction(e,t,s){if("undefined"!=typeof window&&window.chrome?.webview){const i=t.findRbacByActionName(s);if(i)return qt.getByRbac(i).execute(e)}const i=new Gt(e.role);if(i.isAdmin())return qt.getDefaultForAdminAndAction(s).execute();const n=t.findRbacByRoleAndActionName(i,s);return this.getByRbacOrDefault(n,s,e)}static getByRbacOrDefault(e,t,s){return e?qt.getByRbac(e).execute(s):qt.getDefaultForUserAndAction(t).execute()}}const Vt=i.createContext({canIUseAction:()=>{}});class $t extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{canIUseAction:this.canIUseAction.bind(this)}}canIUseAction(e){return Mt.canRoleUseAction(this.props.context.loggedInUser,this.props.context.rbacs,e)}render(){return i.createElement(Vt.Provider,{value:this.state},this.props.children)}}$t.propTypes={context:d().any,children:d().any},a($t);const Ft=i.createContext({selectedAdministration:null,can:{save:!1},must:{save:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1},administrationWorkspaceAction:null,setDisplayAdministrationWorkspaceAction:()=>{},resetDisplayAdministrationWorkspaceAction:()=>{},onUpdateSubscriptionKeyRequested:()=>{},onSaveEnabled:()=>{},onMustSaveSettings:()=>{},onMustEditSubscriptionKey:()=>{},onMustRefreshSubscriptionKey:()=>{},onResetActionsSettings:()=>{}});class Ht extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{selectedAdministration:jt.NONE,can:{save:!1},must:{save:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1},administrationWorkspaceAction:()=>i.createElement(i.Fragment,null),setDisplayAdministrationWorkspaceAction:this.setDisplayAdministrationWorkspaceAction.bind(this),resetDisplayAdministrationWorkspaceAction:this.resetDisplayAdministrationWorkspaceAction.bind(this),onSaveEnabled:this.handleSaveEnabled.bind(this),onMustSaveSettings:this.handleMustSaveSettings.bind(this),onMustEditSubscriptionKey:this.handleMustEditSubscriptionKey.bind(this),onMustRefreshSubscriptionKey:this.handleMustRefreshSubscriptionKey.bind(this),onResetActionsSettings:this.handleResetActionsSettings.bind(this)}}componentDidMount(){this.handleAdministrationMenuRouteChange()}componentDidUpdate(e){this.handleRouteChange(e.location)}handleSaveEnabled(){this.setState({can:{...this.state.can,save:!0}})}handleMustSaveSettings(){this.setState({must:{...this.state.must,save:!0}})}handleMustEditSubscriptionKey(){this.setState({must:{...this.state.must,editSubscriptionKey:!0}})}handleMustRefreshSubscriptionKey(){this.setState({must:{...this.state.must,refreshSubscriptionKey:!0}})}handleResetActionsSettings(){this.setState({must:{save:!1,test:!1,synchronize:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1}})}handleRouteChange(e){this.props.location.key!==e.key&&this.handleAdministrationMenuRouteChange()}handleAdministrationMenuRouteChange(){const e={can:{save:!1,test:!1,synchronize:!1},must:{save:!1,test:!1,synchronize:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1}};if(!this.props.rbacContext.canIUseAction(Rt))return e.selectedAdministration=jt.HTTP_403_ACCESS_DENIED,void this.setState(e);const t=this.props.location.pathname,s=Yt.homePage.test(t),i=Yt.mfa.test(t),n=Yt.mfaPolicy.test(t),r=Yt.passwordPolicies.test(t),a=Yt.usersDirectory.test(t),o=Yt.emailNotification.test(t),l=Yt.subscription.test(t),c=Yt.internationalization.test(t),d=Yt.accountRecovery.test(t),p=Yt.smtpSettings.test(t),h=Yt.selfRegistration.test(t),u=Yt.sso.test(t),m=Yt.rbac.test(t),g=Yt.userPassphrasePolicies.test(t),E=Yt.passwordExpirySettings.test(t),y=Yt.healthcheck.test(t),f=Yt.contentTypesEncryptedMetadata.test(t),b=Yt.contentTypesMetadataKey.test(t),S=Yt.migrateEncryptedMetadata.test(t),T=Yt.allowContentTypes.test(t),w=Yt.gettingStarted.test(t),v=Yt.scim.test(t),C=Yt.secretHistory.test(t),A=Yt.ceDowngrade.test(t),R=Yt.offline.test(t),x=Yt.mfaPolicyTeasing.test(t),_=Yt.passwordPoliciesTeasing.test(t),P=Yt.usersDirectoryTeasing.test(t),I=Yt.subscriptionTeasing.test(t),N=Yt.accountRecoveryTeasing.test(t),O=Yt.userPassphrasePoliciesTeasing.test(t),U=Yt.ssoTeasing.test(t),k=Yt.scimTeasing.test(t);let D;if(s?D=jt.HOME:n||x?D=jt.MFA_POLICY:r||_?D=jt.PASSWORD_POLICIES:i?D=jt.MFA:a||P?D=jt.USER_DIRECTORY:o?D=jt.EMAIL_NOTIFICATION:l||I?D=jt.SUBSCRIPTION:c?D=jt.INTERNATIONALIZATION:d||N?D=jt.ACCOUNT_RECOVERY:p?D=jt.SMTP_SETTINGS:h?D=jt.SELF_REGISTRATION:u||U?D=jt.SSO:m?D=jt.RBAC:g||O?D=jt.USER_PASSPHRASE_POLICIES:E?D=jt.PASSWORD_EXPIRY:y?D=jt.HEALTHCHECK:f?D=jt.CONTENT_TYPES_ENCRYPTED_METADATA:b?D=jt.CONTENT_TYPES_METADATA_KEY:S?D=jt.MIGRATE_METADATA:T?D=jt.ALLOW_CONTENT_TYPES:w?D=jt.METADATA_GETTING_STARTED:v||k?D=jt.SCIM:C?D=jt.SECRET_HISTORY:A?D=jt.CE_DOWNGRADE:R&&(D=jt.OFFLINE),!D)return e.selectedAdministration=jt.HTTP_404_NOT_FOUND,void this.setState(e);const L=Wt?.[D];e.selectedAdministration=L&&!(this.props.context.siteSettings.canIUse(L)||zt.includes(D)&&this.props.context.siteSettings.isCommunityEdition)?jt.HTTP_404_NOT_FOUND:D,this.setState(e)}setDisplayAdministrationWorkspaceAction(e){this.setState({administrationWorkspaceAction:e})}resetDisplayAdministrationWorkspaceAction(){this.setState({administrationWorkspaceAction:()=>i.createElement(i.Fragment,null)})}render(){return i.createElement(Ft.Provider,{value:this.state},this.props.children)}}var Kt;function Bt(e){return class extends i.Component{render(){return i.createElement(Ft.Consumer,null,t=>i.createElement(e,{administrationWorkspaceContext:t,...this.props}))}}}Ht.displayName="AdministrationWorkspaceContextProvider",Ht.propTypes={context:d().object,children:d().any,location:d().object,match:d().object,history:d().object,loadingContext:d().object,rbacContext:d().object},(0,Et.withRouter)(a(function(e){return class extends i.Component{render(){return i.createElement(Vt.Consumer,null,t=>i.createElement(e,{rbacContext:t,...this.props}))}}}((Kt=Ht,class extends i.Component{render(){return i.createElement(St.Consumer,null,e=>i.createElement(Kt,{loadingContext:e,...this.props}))}}))));const jt={NONE:"NONE",HOME:"HOME",MFA:"MFA",MFA_POLICY:"MFA-POLICY",PASSWORD_POLICIES:"PASSWORD-POLICIES",USER_DIRECTORY:"USER-DIRECTORY",EMAIL_NOTIFICATION:"EMAIL-NOTIFICATION",SUBSCRIPTION:"SUBSCRIPTION",INTERNATIONALIZATION:"INTERNATIONALIZATION",ACCOUNT_RECOVERY:"ACCOUNT-RECOVERY",SMTP_SETTINGS:"SMTP-SETTINGS",SELF_REGISTRATION:"SELF-REGISTRATION",SSO:"SSO",RBAC:"RBAC",USER_PASSPHRASE_POLICIES:"USER-PASSPHRASE-POLICIES",PASSWORD_EXPIRY:"PASSWORD-EXPIRY",HTTP_403_ACCESS_DENIED:"403-ACCESS-DENIED",HTTP_404_NOT_FOUND:"404-NOT-FOUND",HEALTHCHECK:"HEALTHCHECK",CONTENT_TYPES_ENCRYPTED_METADATA:"CONTENT_TYPES_ENCRYPTED_METADATA",CONTENT_TYPES_METADATA_KEY:"CONTENT_TYPES_METADATA_KEY",MIGRATE_METADATA:"MIGRATE_METADATA",ALLOW_CONTENT_TYPES:"ALLOW_CONTENT_TYPES",METADATA_GETTING_STARTED:"METADATA_GETTING_STARTED",SCIM:"SCIM",SECRET_HISTORY:"SECRET_HISTORY",CE_DOWNGRADE:"DOWNGRADE-TO-CE",OFFLINE:"OFFLINE"},Wt={[jt.MFA]:"multiFactorAuthentication",[jt.MFA_POLICY]:"mfaPolicies",[jt.PASSWORD_POLICIES]:"passwordPoliciesUpdate",[jt.USER_DIRECTORY]:"directorySync",[jt.SUBSCRIPTION]:"ee",[jt.INTERNATIONALIZATION]:"locale",[jt.ACCOUNT_RECOVERY]:"accountRecovery",[jt.SMTP_SETTINGS]:"smtpSettings",[jt.SELF_REGISTRATION]:"selfRegistration",[jt.SSO]:"sso",[jt.RBAC]:"rbacs",[jt.USER_PASSPHRASE_POLICIES]:"userPassphrasePolicies",[jt.PASSWORD_EXPIRY]:"passwordExpiry",[jt.HEALTHCHECK]:"healthcheckUi",[jt.CONTENT_TYPES_ENCRYPTED_METADATA]:"metadata",[jt.CONTENT_TYPES_METADATA_KEY]:"metadata",[jt.MIGRATE_METADATA]:"metadata",[jt.ALLOW_CONTENT_TYPES]:"metadata",[jt.METADATA_GETTING_STARTED]:"metadata",[jt.SCIM]:"scim",[jt.SECRET_HISTORY]:"secretRevisions",[jt.CE_DOWNGRADE]:"ee",[jt.OFFLINE]:"offlineMode"},Yt={homePage:/^\/app\/administration\/?$/,mfa:/^\/app\/administration\/mfa\/?$/,mfaPolicy:/^\/app\/administration\/mfa-policy\/?$/,mfaPolicyTeasing:/^\/app\/administration\/mfa-policy-teasing\/?$/,passwordPolicies:/^\/app\/administration\/password-policies\/?$/,passwordPoliciesTeasing:/^\/app\/administration\/password-policies-teasing\/?$/,usersDirectory:/^\/app\/administration\/users-directory\/?$/,usersDirectoryTeasing:/^\/app\/administration\/users-directory-teasing\/?$/,emailNotification:/^\/app\/administration\/email-notification\/?$/,subscription:/^\/app\/administration\/subscription\/?$/,subscriptionTeasing:/^\/app\/administration\/subscription-teasing\/?$/,internationalization:/^\/app\/administration\/internationalization\/?$/,accountRecovery:/^\/app\/administration\/account-recovery\/?$/,accountRecoveryTeasing:/^\/app\/administration\/account-recovery-teasing\/?$/,smtpSettings:/^\/app\/administration\/smtp-settings\/?$/,selfRegistration:/^\/app\/administration\/self-registration\/?$/,sso:/^\/app\/administration\/sso\/?$/,ssoTeasing:/^\/app\/administration\/sso-teasing\/?$/,rbac:/^\/app\/administration\/rbacs\/?$/,userPassphrasePolicies:/^\/app\/administration\/user-passphrase-policies\/?$/,userPassphrasePoliciesTeasing:/^\/app\/administration\/user-passphrase-policies-teasing\/?$/,passwordExpirySettings:/^\/app\/administration\/password-expiry\/?$/,healthcheck:/^\/app\/administration\/healthcheck\/?$/,contentTypesEncryptedMetadata:/^\/app\/administration\/content-types\/metadata\/?$/,contentTypesMetadataKey:/^\/app\/administration\/content-types\/metadata-key\/?$/,migrateEncryptedMetadata:/^\/app\/administration\/migrate-metadata\/?$/,allowContentTypes:/^\/app\/administration\/allow-content-types\/?$/,gettingStarted:/^\/app\/administration\/content-types\/metadata-getting-started\/?$/,scim:/^\/app\/administration\/user-provisionning\/scim\/?$/,scimTeasing:/^\/app\/administration\/scim-teasing\/?$/,secretHistory:/^\/app\/administration\/secret-history\/?$/,ceDowngrade:/^\/app\/administration\/ce-downgrade\/?$/,offline:/^\/app\/administration\/offline\/?$/},zt=[jt.SUBSCRIPTION,jt.PASSWORD_POLICIES,jt.USER_PASSPHRASE_POLICIES,jt.ACCOUNT_RECOVERY,jt.SSO,jt.MFA_POLICY,jt.USER_DIRECTORY,jt.SCIM],Zt=class{constructor(e){this.customerId=e?.customer_id||"",this.subscriptionId=e?"subscription_id"in e?e.subscription_id:"N/A":"",this.users=e?.users||null,this.email=e?"email"in e?e.email:"N/A":"",this.expiry=e?.expiry||null,this.created=e?.created||null,this.data=e?.data||null}},Jt=i.createContext({getSubscription:()=>{},findSubscriptionKey:()=>{},isProcessing:()=>{},setProcessing:()=>{},getActiveUsers:()=>{},clearContext:()=>{}});class Xt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{subscription:new Zt,processing:!1,getSubscription:this.getSubscription.bind(this),findSubscriptionKey:this.findSubscriptionKey.bind(this),isProcessing:this.isProcessing.bind(this),setProcessing:this.setProcessing.bind(this),getActiveUsers:this.getActiveUsers.bind(this),clearContext:this.clearContext.bind(this)}}async findSubscriptionKey(){this.setProcessing(!0);let e=new Zt;try{const t=await this.props.context.onGetSubscriptionKeyRequested();e=new Zt(t.toDto())}catch(t){"PassboltSubscriptionError"===t.name&&(e=new Zt(t.subscription))}finally{this.setState({subscription:e}),this.setProcessing(!1)}}async getActiveUsers(){return(await this.props.context.port.request("passbolt.users.get-all")).filter(e=>e.active).length}getSubscription(){return this.state.subscription}isProcessing(){return this.state.processing}setProcessing(e){this.setState({processing:e})}clearContext(){const{subscription:e,processing:t}=this.defaultState;this.setState({subscription:e,processing:t})}render(){return i.createElement(Jt.Provider,{value:this.state},this.props.children)}}function Qt(e){return class extends i.Component{render(){return i.createElement(Jt.Consumer,null,t=>i.createElement(e,{adminSubscriptionContext:t,...this.props}))}}}var es;function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ts.apply(null,arguments)}Xt.propTypes={context:d().any,children:d().any},a(Xt);const ss=function(e){return i.createElement("svg",ts({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),es||(es=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m12 4-8 8M4 4l8 8"})))};class is extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.handleCloseClick=this.handleCloseClick.bind(this)}handleCloseClick(){this.props.onClose()}render(){return i.createElement("button",{type:"button",disabled:this.props.disabled,className:"dialog-close button button-transparent",onClick:this.handleCloseClick},i.createElement(ss,{className:"svg-icon close"}),i.createElement("span",{className:"visually-hidden"},i.createElement(_.x,null,"Close")))}}is.propTypes={onClose:d().func,disabled:d().bool};const ns=(0,P.C)("common")(is);var rs;function as(){return as=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},as.apply(null,arguments)}const os=function(e){return i.createElement("svg",as({xmlns:"http://www.w3.org/2000/svg",width:17,height:18,fill:"none",viewBox:"0 0 17 18"},e),rs||(rs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8.5 16.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15M8.5 12V9M8.5 6h.008"})))};class ls extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.handleKeyDown=this.handleKeyDown.bind(this),this.handleClose=this.handleClose.bind(this)}handleKeyDown(e){27===e.keyCode&&this.handleClose()}handleClose(){this.props.disabled||this.props.onClose()}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown,{capture:!1})}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown,{capture:!1})}render(){return i.createElement("div",{className:`${this.props.className} dialog-wrapper`},i.createElement("div",{className:"dialog"},i.createElement("div",{className:"dialog-header"},i.createElement("div",{className:"dialog-title-wrapper"},i.createElement("h2",null,i.createElement("span",{className:"dialog-header-title"},this.props.title),this.props.subtitle&&i.createElement("span",{className:"dialog-header-subtitle"},this.props.subtitle)),this.props.tooltip&&""!==this.props.tooltip&&i.createElement(dt,{message:this.props.tooltip},i.createElement(os,null))),i.createElement(ns,{onClose:this.handleClose,disabled:this.props.disabled})),i.createElement("div",{className:"dialog-content"},this.props.children)))}}ls.propTypes={children:d().node,className:d().string,title:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),subtitle:d().string,tooltip:d().node,disabled:d().bool,onClose:d().func};const cs=ls,ds=i.createContext({feedbacks:[],displaySuccess:()=>{},displayWarning:()=>{},displayError:()=>{},remove:()=>{}});class ps extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{feedbacks:[],displaySuccess:this.displaySuccess.bind(this),displayWarning:this.displayWarning.bind(this),displayError:this.displayError.bind(this),remove:this.remove.bind(this)}}displaySuccess(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,ht.A)(),type:"success",message:e}]})}displayWarning(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,ht.A)(),type:"warning",message:e}]})}displayError(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,ht.A)(),type:"error",message:e}]})}remove(e){this.setState(t=>({feedbacks:t.feedbacks.filter(t=>e.id!==t.id)}))}render(){return i.createElement(ds.Provider,{value:this.state},this.props.children)}}ps.displayName="ActionFeedbackContextProvider",ps.propTypes={children:d().any};class hs extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindCallbacks()}get defaultState(){return{showErrorDetails:!1}}bindCallbacks(){this.handleKeyDown=this.handleKeyDown.bind(this),this.handleErrorDetailsToggle=this.handleErrorDetailsToggle.bind(this)}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown,{capture:!0})}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown,{capture:!0})}getTitle(){return this.props.title?this.props.title:this.props.t("There was an unexpected error...")}getMessage(){return this.props.error.message}handleKeyDown(e){27!==e.keyCode&&13!==e.keyCode||(e.stopPropagation(),this.props.onClose())}handleErrorDetailsToggle(){this.setState({showErrorDetails:!this.state.showErrorDetails})}get hasErrorDetails(){return Boolean(this.props.error.data?.body)||Boolean(this.props.error.details)}formatErrors(){const e=this.props.error?.details||this.props.error?.data;return JSON.stringify(e,null,4)}render(){return i.createElement(cs,{className:"dialog-wrapper error-dialog",onClose:this.props.onClose,title:this.getTitle()},i.createElement("div",{className:"form-content"},i.createElement("p",null,this.getMessage()),this.hasErrorDetails&&i.createElement("div",{className:"accordion error-details"},i.createElement("div",{className:"accordion-header"},i.createElement("button",{type:"button",className:"link no-border",onClick:this.handleErrorDetailsToggle},i.createElement("span",null,i.createElement(_.x,null,"Error details")),this.state.showErrorDetails?i.createElement(Ce,{className:"baseline svg-icon"}):i.createElement(xe,{className:"baseline svg-icon"}))),this.state.showErrorDetails&&i.createElement("div",{className:"accordion-content"},i.createElement("div",{className:"input text"},i.createElement("label",{htmlFor:"js_field_debug",className:"visuallyhidden"},i.createElement(_.x,null,"Error details")),i.createElement("textarea",{id:"js_field_debug",defaultValue:this.formatErrors(),readOnly:!0}))))),i.createElement("div",{className:"submit-wrapper clearfix"},i.createElement("button",{type:"button",className:"button primary warning",onClick:this.props.onClose},"Ok")))}}hs.propTypes={title:d().string,error:d().object.isRequired,onClose:d().func,t:d().func};const us=(0,P.C)("common")(hs);class ms extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.handleClick=this.handleClick.bind(this)}handleClick(){this.props.disabled||this.props.onClick()}render(){return i.createElement("button",{type:"button",disabled:this.props.disabled,className:"link cancel",onClick:this.handleClick},this.props.value)}}ms.defaultProps={value:i.createElement(_.x,null,"Cancel")},ms.propTypes={disabled:d().bool,onClick:d().func,value:d().oneOfType([d().arrayOf(d().node),d().node,d().string])};const gs=(0,P.C)("common")(ms),Es=class extends ee{static getSchema(){return{type:"object",required:["subscription_id","users","expiry","created","data"],properties:{customer_id:{type:"string"},subscription_id:{type:"string"},users:{type:"integer"},email:{type:"string",format:"email"},created:{type:"string",format:"date-time"},expiry:{type:"string",format:"date-time"},data:{type:"string"}}}}get expiry(){return this._props.expiry}toDto(){return Object.assign({},this._props)}toJSON(){return this.toDto()}static get ENTITY_NAME(){return"Subscription"}},ys=class{constructor(e){this.port=e}async createOrganizationSubscriptionKey(e){(0,L.A)(e);const t=await this.port.request("passbolt.subscription.create",{data:e});return new Es(t)}async findOrganizationSubscriptionKey(){const e=await this.port.request("passbolt.subscription.get");return new Es(e)}async updateOrganizationSubscriptionKey(e){(0,L.A)(e);const t=await this.port.request("passbolt.subscription.update",{data:e});return new Es(t)}async deleteOrganizationSubscriptionKey(){await this.port.request("passbolt.subscription.downgrade")}};class fs extends i.Component{constructor(e){super(e),this.state=this.getDefaultState(),this.initEventHandlers(),this.createInputRef(),this.subscriptionKeyService=new ys(e.context.port)}getDefaultState(){return{selectedFile:null,key:"",keyError:"",processing:!1,hasBeenValidated:!1}}initEventHandlers(){this.handleCloseClick=this.handleCloseClick.bind(this),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyInputKeyUp=this.handleKeyInputKeyUp.bind(this),this.handleSelectSubscriptionKeyFile=this.handleSelectSubscriptionKeyFile.bind(this),this.handleSelectFile=this.handleSelectFile.bind(this)}createInputRef(){this.keyInputRef=i.createRef(),this.fileUploaderRef=i.createRef()}componentDidMount(){this.setState({key:this.props.context.editSubscriptionKey?.key||""})}async handleFormSubmit(e){e.preventDefault(),this.state.processing||await this.save()}handleInputChange(e){const t=e.target,s=t.value,i=t.name;this.setState({[i]:s})}handleKeyInputKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateNameInput();this.setState(e)}}handleCloseClick(){this.props.context.setContext({editSubscriptionKey:null}),this.props.onClose()}handleSelectFile(){this.fileUploaderRef.current.click()}get selectedFilename(){return this.state.selectedFile?this.state.selectedFile.name:""}async handleSelectSubscriptionKeyFile(e){const[t]=e.target.files,s=await this.readSubscriptionKeyFile(t);this.setState({key:s,selectedFile:t}),this.state.hasBeenValidated&&await this.validate()}readSubscriptionKeyFile(e){const t=new FileReader;return new Promise((s,i)=>{t.onloadend=()=>{try{s(t.result)}catch(e){i(e)}},t.readAsText(e)})}async save(){if(!this.state.processing){if(this.setState({hasBeenValidated:!0,processing:!0}),!await this.validate())return this.handleValidateError(),void this.setState({processing:!1});try{this.props.onSave?await this.props.onSave(this.state.key):await this.subscriptionKeyService.updateOrganizationSubscriptionKey(this.state.key),await this.handleSaveSuccess(),await this.props.adminSubscriptionContext.findSubscriptionKey()}catch(e){this.setState({processing:!1}),this.handleSaveError(e),this.focusFieldError()}}}handleValidateError(){this.focusFieldError()}async handleSaveSuccess(){await this.props.actionFeedbackContext.displaySuccess(this.translate("The subscription key has been updated successfully.")),this.props.administrationWorkspaceContext.onMustRefreshSubscriptionKey(),this.props.context.setContext({editSubscriptionKey:null,refreshSubscriptionAnnouncement:!0}),this.props.onClose()}handleSaveError(e){if("PassboltSubscriptionError"===e.name)this.setState({keyError:e.message});else if("EntityValidationError"===e.name)this.setState({keyError:this.translate("The subscription key is invalid.")});else if("PassboltApiFetchError"===e.name&&e.data&&400===e.data.code)this.setState({keyError:e.message});else{console.error(e);const t={error:e};this.props.dialogContext.open(us,t)}}focusFieldError(){this.state.keyError&&this.keyInputRef.current.focus()}validateKeyInput(){const e=this.state.key.trim();let t="";return e.length||(t=this.translate("A subscription key is required.")),new Promise(e=>{this.setState({keyError:t},e)})}async validate(){return this.setState({keyError:""}),await this.validateKeyInput(),""===this.state.keyError}hasAllInputDisabled(){return this.state.processing}get translate(){return this.props.t}render(){return i.createElement(cs,{title:this.props.title??this.translate("Edit subscription key"),onClose:this.handleCloseClick,disabled:this.state.processing,className:"edit-subscription-dialog"},i.createElement("form",{onSubmit:this.handleFormSubmit,noValidate:!0},i.createElement("div",{className:"form-content"},i.createElement("div",{className:`input textarea required ${this.state.keyError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"edit-tag-form-name"},i.createElement(_.x,null,"Subscription key")),i.createElement("textarea",{id:"edit-subscription-form-key",name:"key",value:this.state.key,onKeyUp:this.handleKeyInputKeyUp,onChange:this.handleInputChange,disabled:this.hasAllInputDisabled(),ref:this.keyInputRef,className:"required full_report",required:"required",autoComplete:"off",autoFocus:!0})),i.createElement("div",{className:"input file "+(this.hasAllInputDisabled()?"disabled":"")},i.createElement("input",{type:"file",ref:this.fileUploaderRef,disabled:this.hasAllInputDisabled(),onChange:this.handleSelectSubscriptionKeyFile}),i.createElement("div",{className:"input-file-inline"},i.createElement("input",{type:"text",disabled:!0,placeholder:this.translate("No key file selected"),value:this.selectedFilename}),i.createElement("button",{type:"button",className:"button primary",onClick:this.handleSelectFile,disabled:this.hasAllInputDisabled()},i.createElement("span",null,i.createElement(_.x,null,"Choose a file")))),this.state.keyError&&i.createElement("div",{className:"key error-message"},this.state.keyError),this.props.warning&&i.createElement("p",null,this.props.warning))),i.createElement("div",{className:"submit-wrapper clearfix"},i.createElement(gs,{disabled:this.hasAllInputDisabled(),onClick:this.handleCloseClick}),i.createElement(D,{disabled:this.hasAllInputDisabled(),processing:this.state.processing,value:this.translate("Save")}))))}}fs.propTypes={context:d().any,onClose:d().func,actionFeedbackContext:d().any,adminSubscriptionContext:d().object,dialogContext:d().any,administrationWorkspaceContext:d().any,title:d().string,warning:d().string,onSave:d().func,t:d().func};const bs=a(Qt(Bt(function(e){return class extends i.Component{render(){return i.createElement(ds.Consumer,null,t=>i.createElement(e,{actionFeedbackContext:t,...this.props}))}}}(gt((0,P.C)("common")(fs))))));class Ss{constructor(e){this.context=e.context,this.dialogContext=e.dialogContext,this.subscriptionContext=e.adminSubscriptionContext}static getInstance(e){return this.instance||(this.instance=new Ss(e)),this.instance}static killInstance(){this.instance=null}editSubscription(){const e={key:this.subscriptionContext.getSubscription().data};this.context.setContext({editSubscriptionKey:e}),this.dialogContext.open(bs)}}const Ts=Ss;var ws=s(40961);var vs,Cs;function As(){return As=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},As.apply(null,arguments)}const Rs=function(e){return i.createElement("svg",As({xmlns:"http://www.w3.org/2000/svg",width:18,height:18,fill:"none",viewBox:"0 0 18 18"},e),vs||(vs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 3H3a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 3 15h12a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 15 3"})),Cs||(Cs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16.5 5.25 9.773 9.525a1.46 1.46 0 0 1-1.546 0L1.5 5.25"})))};var xs;function _s(){return _s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},_s.apply(null,arguments)}const Ps=function(e){return i.createElement("svg",_s({xmlns:"http://www.w3.org/2000/svg",width:18,height:18,fill:"none",viewBox:"0 0 18 18"},e),xs||(xs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m16.298 13.5-6-10.5a1.5 1.5 0 0 0-2.61 0l-6 10.5A1.5 1.5 0 0 0 3 15.75h12a1.5 1.5 0 0 0 1.297-2.25M9 6.75v3M9 12.75h.008"})))},Is="Pro Edition",Ns="Community Edition";class Os extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindCallbacks(),this.subscriptionActionService=Ts.getInstance(this.props),this.subscriptionKeyService=new ys(this.props.context.port)}get defaultState(){return{activeUsers:null}}async componentDidMount(){this.props.context.siteSettings.isCommunityEdition&&this.hasEditionPlugin()||this.props.adminSubscriptionContext.findSubscriptionKey();const e=await this.props.adminSubscriptionContext.getActiveUsers();this.setState({activeUsers:e})}componentWillUnmount(){this.props.adminSubscriptionContext.clearContext(),Ts.killInstance()}bindCallbacks(){this.handleRenewKey=this.handleRenewKey.bind(this),this.handleUpdateKey=this.handleUpdateKey.bind(this),this.handleDowngradeClick=this.handleDowngradeClick.bind(this),this.handleAddSubscriptionKey=this.handleAddSubscriptionKey.bind(this),this.handleSaveSubscriptionKey=this.handleSaveSubscriptionKey.bind(this)}handleSaveSubscriptionKey(e){return this.subscriptionKeyService.createOrganizationSubscriptionKey(e)}handleAddSubscriptionKey(){this.props.dialogContext.open(bs,{title:this.props.t("New subscription key"),onSave:this.handleSaveSubscriptionKey,warning:this.translate("You and your team will be disconnected at the end of the process.")})}handleDowngradeClick(){this.props.navigationContext.onGoToAdministrationDowngradeToCeRequested()}handleRenewKey(){const e=this.props.adminSubscriptionContext.getSubscription();this.hasLimitUsersExceeded()?this.props.navigationContext.onGoToSubscriptionUpdateQuantityRequested(e.subscriptionId,e.customerId):(this.hasSubscriptionKeyExpired()||this.hasSubscriptionKeyGoingToExpire())&&this.props.navigationContext.onGoToSubscriptionRenewRequested(e.subscriptionId,e.customerId)}handleUpdateKey(){this.subscriptionActionService.editSubscription()}hasEditionPlugin(){return this.props.context.siteSettings.canIUse("edition")}hasSubscriptionKeyExpired(){return pt.c9.fromISO(this.props.adminSubscriptionContext.getSubscription().expiry)<pt.c9.now()}hasSubscriptionKeyGoingToExpire(){return!this.hasSubscriptionKeyExpired()&&pt.c9.fromISO(this.props.adminSubscriptionContext.getSubscription().expiry)<pt.c9.now().plus({days:30})}shouldShowDowngradeSection(){return this.hasEditionPlugin()&&!this.props.context.siteSettings.isCommunityEdition&&(this.hasSubscriptionKeyExpired()||this.hasSubscriptionKeyGoingToExpire())}hasLimitUsersExceeded(){return this.props.adminSubscriptionContext.getSubscription().users<this.state.activeUsers}hasValidSubscription(){return!this.props.context.siteSettings.isCommunityEdition&&!this.hasLimitUsersExceeded()&&!this.hasSubscriptionKeyExpired()}hasInvalidSubscription(){return!this.props.context.siteSettings.isCommunityEdition&&!this.props.adminSubscriptionContext.getSubscription().data}formatDate(e){try{return pt.c9.fromISO(e).setLocale(this.props.context.locale).toLocaleString(pt.c9.DATE_SHORT)}catch(t){return console.error(`Failed to format date "${e}":`,t),""}}get translate(){return this.props.t}render(){const e=this.props.adminSubscriptionContext.getSubscription(),t=this.props.adminSubscriptionContext.isProcessing();return i.createElement("div",{className:"row"},!t&&i.createElement("div",{className:"subscription-key main-column"},i.createElement("div",{className:"main-content"},i.createElement("h1",null,i.createElement(_.x,null,"Subscription")),i.createElement("h3",null,i.createElement(_.x,null,"Details")),i.createElement("div",{className:"subscription-information"},i.createElement("div",{className:"information container"},i.createElement("div",{className:"information"},i.createElement("div",{className:"information-label"},i.createElement("span",{className:"edition label"},i.createElement(_.x,null,"Edition:")),i.createElement("span",{className:"server-version label"},i.createElement(_.x,null,"Server version:")),i.createElement("span",{className:"client-version label"},i.createElement(_.x,null,"Client version:")),!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"email label"},i.createElement(_.x,null,"Email:")),i.createElement("span",{className:"users label"},i.createElement(_.x,null,"Users limit:")))),i.createElement("div",{className:"information-value"},i.createElement("span",{className:"edition value"},!this.props.context.siteSettings.isCommunityEdition&&Is,this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,Ns,i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"(Free forever)")))),i.createElement("span",{className:"server-version value"},this.props.context.siteSettings.version),i.createElement("span",{className:"client-version value"},this.props.context.extensionVersion),!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"email value"},e.email),i.createElement("span",{className:"users value "+(this.hasLimitUsersExceeded()?"error":"")},e.users," ",i.createElement("span",{className:"secondary-information"},"(",i.createElement(_.x,null,"currently:")," ",this.state.activeUsers,")"))))),i.createElement("div",{className:"information"},i.createElement("div",{className:"information-label"},!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"customer-id label"},i.createElement(_.x,null,"Customer id:")),i.createElement("span",{className:"subscription-id label"},i.createElement(_.x,null,"Subscription id:")),i.createElement("span",{className:"created label"},i.createElement(_.x,null,"Valid from:")),i.createElement("span",{className:"expiry label"},i.createElement(_.x,null,"Expires on:")))),i.createElement("div",{className:"information-value"},!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"customer-id value"},e.customerId),i.createElement("span",{className:"subscription-id value"},e.subscriptionId),i.createElement("span",{className:"created value"},this.formatDate(e.created)),i.createElement("span",{className:`expiry value ${this.hasSubscriptionKeyExpired()?"error":""} ${this.hasSubscriptionKeyGoingToExpire()?"warning":""}`},this.formatDate(e.expiry)," ",i.createElement("span",{className:"secondary-information",title:e.expiry},"(",`${this.hasSubscriptionKeyExpired()?this.translate("expired "):""}${((e,t,s)=>{if(null===e)return"n/a";if("Infinity"===e)return t("Never");const i=pt.c9.fromISO(e),n=i.diffNow().toMillis();return n>-1e3&&n<0?t("Just now"):i.toRelative({locale:s})})(e.expiry,this.props.t,this.props.context.locale)}`,")"))))))),!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,!this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"subscription-actions"},this.hasSubscriptionKeyExpired()&&i.createElement("div",{className:"subscription-warning"},i.createElement(Ps,null),i.createElement(_.x,null,"Your subscription key is expired.")),this.hasLimitUsersExceeded()&&i.createElement("div",{className:"subscription-warning"},i.createElement(Ps,null),i.createElement(_.x,null,"Your users limit has been reached.")),this.hasInvalidSubscription()&&i.createElement("div",{className:"subscription-warning"},i.createElement(Ps,null),i.createElement(_.x,null,"Your subscription key is either missing or not valid.")))),i.createElement("div",{className:"subscription-actions"},!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,(this.shouldShowDowngradeSection()||this.hasLimitUsersExceeded())&&i.createElement("button",{className:"button",type:"button",onClick:this.handleRenewKey},i.createElement(_.x,null,"Renew subscription key")),i.createElement("button",{className:"button primary form",type:"button",onClick:this.handleUpdateKey},i.createElement(_.x,null,"Update subscription key"))),this.props.context.siteSettings.isCommunityEdition&&this.hasEditionPlugin()&&i.createElement(i.Fragment,null,i.createElement("button",{className:"button primary form",type:"button",onClick:this.handleAddSubscriptionKey},i.createElement(_.x,null,"Upload subscription key")))),i.createElement("h3",{className:"title"},i.createElement(_.x,null,"Plans")),i.createElement("div",{className:"subscription-editions"},i.createElement("div",{className:"edition "+(this.props.context.siteSettings.isCommunityEdition?"current-edition":"")},i.createElement("div",{className:"content"},i.createElement("div",{className:"title"},i.createElement("div",{className:"community-title"},i.createElement("h3",null,Ns),i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"(Free forever)"))),this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"current-edition-indicator-wrapper"},i.createElement("div",{className:"current-edition-indicator"},i.createElement(_.x,null,"Current plan")))),i.createElement("div",{className:"features"},i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"Features included:")),i.createElement("ul",null,i.createElement("li",null,i.createElement(_.x,null,"Open source under AGPLV3 license")),i.createElement("li",null,i.createElement(_.x,null,"Passwords management & sharing")),i.createElement("li",null,i.createElement(_.x,null,"Private and shared folders")),i.createElement("li",null,i.createElement(_.x,null,"Users and groups management")),i.createElement("li",null,i.createElement(_.x,null,"Secret key authentication (2FA)")),i.createElement("li",null,i.createElement(_.x,null,"Additional factor authentication (3-step verification)")),i.createElement("li",null,i.createElement(_.x,null,"Open API")),i.createElement("li",null,i.createElement(_.x,null,"Role Based Access Control")),i.createElement("li",null,i.createElement(_.x,null,"Password expiry")),i.createElement("li",null,i.createElement(_.x,null,"Secret history")),i.createElement("li",null,i.createElement(_.x,null,"Community support"))))),this.shouldShowDowngradeSection()&&i.createElement("div",{className:"subscription-actions"},i.createElement("button",{className:"button",type:"button",onClick:this.handleDowngradeClick},i.createElement(_.x,null,"Downgrade to ",{edition:"Community"})))),i.createElement("div",{className:"edition "+(this.props.context.siteSettings.isCommunityEdition?"":"current-edition")},i.createElement("div",{className:"content"},i.createElement("div",{className:"title"},i.createElement("h3",null,Is),!this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"current-edition-indicator-wrapper"},i.createElement("div",{className:"current-edition-indicator"},i.createElement(_.x,null,"Current plan")))),i.createElement("div",{className:"features"},i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"Features include everything in Community, plus:")),i.createElement("ul",null,i.createElement("li",null,i.createElement(_.x,null,"Account recovery (Escrow)")),i.createElement("li",null,i.createElement(_.x,null,"Users provisioning (AD / OpenLDAP / SCIM)")),i.createElement("li",null,i.createElement(_.x,null,"Single Sign On (SSO) with Microsoft, Google and more")),i.createElement("li",null,i.createElement(_.x,null,"Activity log (audit changes)")),i.createElement("li",null,i.createElement(_.x,null,"Additional policies")),i.createElement("li",null,i.createElement(_.x,null,"Tags management")),i.createElement("li",null,i.createElement(_.x,null,"VM appliance")),i.createElement("li",null,i.createElement(_.x,null,"Next business day support"))),i.createElement("div",null,i.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/pricing/pro?utm_campaign=21060976-CE%20to%20Pro&utm_source=product"},i.createElement(_.x,null,"See pricing page"))))),this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"subscription-actions"},i.createElement("a",{className:"button primary",target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/pricing/pro?utm_campaign=21060976-CE%20to%20Pro&utm_source=product"},i.createElement(_.x,null,"Buy now")),i.createElement("a",{className:"button",target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/contact/pro/free-trial?utm_campaign=21060976-CE%20to%20Pro&utm_source=product"},i.createElement(_.x,null,"Start a free trial"))))))),(s=i.createElement("div",{className:"sidebar-help-section"},i.createElement("h3",null,i.createElement(_.x,null,"Need help?")),i.createElement("p",null,i.createElement(_.x,null,"For any change or question related to your passbolt subscription, kindly contact our sales team.")),i.createElement("a",{className:"button",target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/contact"},i.createElement(Rs,null),i.createElement("span",null,i.createElement(_.x,null,"Contact Sales")))),n=document.getElementById("administration-help-panel"),i.createElement(i.Fragment,null,n&&(0,ws.createPortal)(s,n,void 0))));var s,n}}a(function(e){return class extends i.Component{render(){return i.createElement(ft.Consumer,null,t=>i.createElement(e,{navigationContext:t,...this.props}))}}}(Qt(Bt(gt((0,P.C)("common")(Os))))));class Us extends i.Component{get privacyUrl(){return this.props.context.siteSettings.privacyLink}get creditsUrl(){return"https://www.passbolt.com/terms"}get unsafeUrl(){return"https://www.passbolt.com/docs/hosting/faq/why-I-see-unsafe-mode-banner/"}get termsUrl(){return this.props.context.siteSettings.termsLink}get versions(){const e=this.props.context.extensionVersion,t=this.props.context.siteSettings.version;return i.createElement("div",null,e&&i.createElement("div",null,this.props.t("Client")," ",e),t&&i.createElement(i.Fragment,null,e&&i.createElement("hr",null),i.createElement("div",null,this.props.t("Server")," ",t)))}get isUnsafeMode(){if(!this.props.context.siteSettings)return!1;const e=this.props.context.siteSettings.debug,t=this.props.context.siteSettings.url.startsWith("http://");return e||t}get isCloud(){const e=new URL(this.props.context.siteSettings.url);return"https:"===e.protocol&&Boolean(e.hostname.match(/cloud.passbolt.com$/))}render(){return i.createElement("footer",{className:"footer"},i.createElement("ul",{className:"footer-links"},this.isUnsafeMode&&i.createElement("li",{className:"error-message"},i.createElement("a",{href:this.unsafeUrl,target:"_blank",rel:"noopener noreferrer"},i.createElement(_.x,null,"Unsafe mode"))),!this.isCloud&&i.createElement(i.Fragment,null,this.props.context.siteSettings.isCommunityEdition&&i.createElement("li",null,Ns,i.createElement("span",{className:"edition-suffix"},i.createElement(_.x,null," (free)"))),!this.props.context.siteSettings.isCommunityEdition&&i.createElement("li",null,Is)),this.isCloud&&i.createElement("li",null,"Cloud"),i.createElement("li",null,this.versions&&i.createElement(dt,{message:this.versions,direction:"top-left"},i.createElement("a",{className:"button button-transparent inline",href:this.creditsUrl,target:"_blank",rel:"noopener noreferrer"},i.createElement(lt,null))),!this.versions&&i.createElement("a",{className:"button button-transparent inline",href:this.creditsUrl,target:"_blank",rel:"noopener noreferrer"},i.createElement(lt,null)))))}}Us.propTypes={context:d().any,t:d().func};const ks=a((0,P.C)("common")(Us));var Ds=s(72635),Ls=s(51831),qs=s(32107);class Gs extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{ready:!1}}async componentDidMount(){await(0,Ds.Yx)(Ls.r).use(qs.A).init({lng:this.locale,load:"currentOnly",interpolation:{escapeValue:!1},react:{useSuspense:!1},backend:{loadPath:(e,t)=>this.getTranslationPath(e,t)},supportedLngs:this.supportedLocales,fallbackLng:!1,ns:["common"],defaultNS:"common",keySeparator:!1,nsSeparator:!1,debug:!1}),this.setState({ready:!0})}getTranslationPath(e,t){const s=e[0],i=t[0],n="en-GB"===s?"en-UK":s;return(this.props.loadingPath||"/locales/{{lng}}/{{ns}}.json").replace("{{lng}}",n).replace("{{ns}}",i)}get supportedLocales(){let e=[];return this.props.context.siteSettings?.supportedLocales?e=this.props.context.siteSettings?.supportedLocales.map(e=>e.locale):e.push(this.locale),e.includes("en-UK")&&e.push("en-GB"),e}get locale(){return this.props.context.locale}async componentDidUpdate(e){await this.handleLocaleChange(e.context.locale)}async handleLocaleChange(e){this.locale!==e&&await(0,Ds.v2)(this.locale)}get isReady(){return this.state.ready}render(){return i.createElement(i.Fragment,null,this.isReady&&this.props.children)}}Gs.propTypes={context:d().any,loadingPath:d().any,children:d().any};const Ms=a(Gs),Vs=new class{allPropTypes=(...e)=>(...t)=>{const s=e.map(e=>e(...t)).filter(Boolean);if(0===s.length)return;const i=s.map(e=>e.message).join("\n");return new Error(i)}};var $s;function Fs(){return Fs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},Fs.apply(null,arguments)}const Hs=function(e){return i.createElement("svg",Fs({width:25,height:24,fill:"none",viewBox:"0 0 25 24"},e),$s||($s=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M11.597 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16M21.597 21l-4.35-4.35"})))};class Ks extends i.Component{constructor(e){super(e),this.state=this.getDefaultState(e),this.bindCallback(),this.createRefs()}getDefaultState(e){return{selectedValue:e.value,search:"",open:!1,style:void 0}}get listItemsFiltered(){const e=this.props.items.filter(e=>e.value!==this.state.selectedValue);return this.props.search&&""!==this.state.search?this.getItemsMatch(e,this.state.search):e}get selectedItemLabel(){const e=this.props.items&&this.props.items.find(e=>e.value===this.state.selectedValue);return e&&e.label||i.createElement(i.Fragment,null," ")}static getDerivedStateFromProps(e,t){return void 0!==e.value&&e.value!==t.selectedValue?{selectedValue:e.value}:null}bindCallback(){this.handleDocumentClickEvent=this.handleDocumentClickEvent.bind(this),this.handleDocumentContextualMenuEvent=this.handleDocumentContextualMenuEvent.bind(this),this.handleDocumentDragStartEvent=this.handleDocumentDragStartEvent.bind(this),this.handleDocumentScrollEvent=this.handleDocumentScrollEvent.bind(this),this.handleSelectClick=this.handleSelectClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleSelectKeyDown=this.handleSelectKeyDown.bind(this),this.handleItemKeyDown=this.handleItemKeyDown.bind(this),this.handleBlur=this.handleBlur.bind(this)}createRefs(){this.selectedItemRef=i.createRef(),this.selectItemsRef=i.createRef(),this.itemsRef=i.createRef()}componentDidMount(){document.addEventListener("click",this.handleDocumentClickEvent,{capture:!0}),document.addEventListener("contextmenu",this.handleDocumentContextualMenuEvent,{capture:!0}),document.addEventListener("dragstart",this.handleDocumentDragStartEvent,{capture:!0}),document.addEventListener("scroll",this.handleDocumentScrollEvent,{capture:!0})}componentWillUnmount(){document.removeEventListener("click",this.handleDocumentClickEvent,{capture:!0}),document.removeEventListener("contextmenu",this.handleDocumentContextualMenuEvent,{capture:!0}),document.removeEventListener("dragstart",this.handleDocumentDragStartEvent,{capture:!0}),document.removeEventListener("scroll",this.handleDocumentScrollEvent,{capture:!0})}handleDocumentClickEvent(e){this.selectedItemRef.current.contains(e.target)||this.selectItemsRef.current.contains(e.target)||this.closeSelect()}handleDocumentContextualMenuEvent(e){this.selectedItemRef.current.contains(e.target)||this.selectItemsRef.current.contains(e.target)||this.closeSelect()}handleDocumentDragStartEvent(){this.closeSelect()}handleDocumentScrollEvent(e){this.itemsRef.current.contains(e.target)||this.selectItemsRef.current.contains(e.target)||this.closeSelect()}handleSelectClick(){if(this.props.disabled)this.closeSelect();else{const e=!this.state.open;e?this.forceVisibilitySelect():this.resetStyleSelect(),this.setState({open:e})}}getFirstParentWithTransform(){let e=this.selectedItemRef.current.parentElement;for(;null!==e&&""===e.style.getPropertyValue("transform");)e=e.parentElement;return e}forceVisibilitySelect(){const e=this.selectedItemRef.current.getBoundingClientRect(),{width:t,height:s}=e;let{top:i,left:n}=e;const r=this.getFirstParentWithTransform();if(r){const e=r.getBoundingClientRect();i-=e.top,n-=e.left}const a={position:"fixed",zIndex:1,width:t,height:s,top:i,left:n};this.setState({style:a})}handleBlur(e){e.currentTarget.contains(e.relatedTarget)||this.closeSelect()}closeSelect(){this.resetStyleSelect(),this.setState({open:!1})}resetStyleSelect(){this.setState({style:void 0})}handleInputChange(e){const t=e.target,s=t.value,i=t.name;this.setState({[i]:s})}handleItemClick(e){if(this.setState({selectedValue:e.value,open:!1}),"function"==typeof this.props.onChange){const t={target:{value:e.value,name:this.props.name}};this.props.onChange(t)}this.closeSelect()}getItemsMatch(e,t){const s=t&&t.split(/\s+/)||[""];return e.filter(e=>s.every(t=>((e,t)=>(e=>new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(e),"i"))(e).test(t))(t,e.label)))}handleSelectKeyDown(e){switch(e.keyCode){case 13:return e.stopPropagation(),void this.handleSelectClick();case 40:return e.preventDefault(),e.stopPropagation(),void(this.state.open?this.focusItem(0):this.handleSelectClick());case 38:return e.preventDefault(),e.stopPropagation(),void(this.state.open?this.focusItem(this.listItemsFiltered.length-1):this.handleSelectClick());case 27:return e.stopPropagation(),void this.closeSelect();default:return}}focusItem(e){this.itemsRef.current.childNodes[e]?.focus()}handleItemKeyDown(e,t){switch(e.keyCode){case 13:return e.stopPropagation(),void this.handleItemClick(t);case 40:return e.stopPropagation(),e.preventDefault(),void(e.target.nextSibling?e.target.nextSibling.focus():this.focusItem(0));case 38:return e.stopPropagation(),e.preventDefault(),void(e.target.previousSibling?e.target.previousSibling.focus():this.focusItem(this.listItemsFiltered.length-1));default:return}}hasFilteredItems(){return this.listItemsFiltered.length>0}render(){return i.createElement("div",{className:`select-container ${this.props.className}`,style:{width:this.state.style?.width,height:this.state.style?.height}},i.createElement("div",{onKeyDown:this.handleSelectKeyDown,onBlur:this.handleBlur,id:this.props.id,className:`select ${this.props.direction} ${this.state.open?"open":""}`,style:this.state.style},i.createElement("div",{ref:this.selectedItemRef,className:"selected-value "+(this.props.disabled?"disabled":""),tabIndex:this.props.disabled?-1:0,onClick:this.handleSelectClick},i.createElement("span",{className:"value"},this.selectedItemLabel),i.createElement(Ce,null)),i.createElement("div",{ref:this.selectItemsRef,className:"select-items "+(this.state.open?"visible":"")},this.props.search&&i.createElement(i.Fragment,null,i.createElement("input",{className:"search-input",name:"search",value:this.state.search,onChange:this.handleInputChange,type:"text"}),i.createElement(Hs,{className:"search"})),i.createElement("ul",{ref:this.itemsRef,className:"items"},this.hasFilteredItems()&&this.listItemsFiltered.map(e=>i.createElement("li",{tabIndex:e.disabled?-1:0,key:e.value,title:e.title,className:`option ${e.value}`,onKeyDown:t=>this.handleItemKeyDown(t,e),onClick:()=>this.handleItemClick(e)},e.label)),!this.hasFilteredItems()&&this.props.search&&i.createElement("li",{className:"option no-results"},i.createElement(_.x,null,"No results match")," ",i.createElement("span",null,this.state.search))))))}}Ks.defaultProps={id:"",name:"select",className:"",direction:"bottom"},Ks.propTypes={id:d().string,name:d().string,className:d().string,direction:d().oneOf(Object.values({top:"top",bottom:"bottom",left:"left",right:"right"})),search:d().bool,items:d().array,value:Vs.allPropTypes(d().oneOfType([d().string,d().number,d().bool]),(e,t,s)=>{const i=e[t],n=e.items;if(null!==i&&n.length>0&&n.every(e=>e.value!==i))return new Error(`Invalid prop ${t} passed to ${s}. Expected the value ${i} in items.`)}),disabled:d().bool,onChange:d().func};const Bs=(0,P.C)("common")(Ks);class js extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindHandlers()}componentDidMount(){this.initLocale()}componentDidUpdate(e){this.handleLocaleChange(e.context.locale)}handleLocaleChange(e){this.props.context.locale!==e&&this.setState({locale:this.props.context.locale})}get defaultState(){return{loading:!0,locale:null,processing:!1}}get areActionsAllowed(){return!this.state.processing}bindHandlers(){this.handleLocaleInputChange=this.handleLocaleInputChange.bind(this)}async handleLocaleInputChange(e){const t=e.target.value;this.updateLocale(t)}async updateLocale(e){this.setState({processing:!0}),await this.props.context.onUpdateLocaleRequested(e),this.setState({processing:!1})}initLocale(){this.setState({locale:this.props.context.locale,loading:!1})}isLoading(){return this.state.loading}get supportedLocales(){return this.props.context.siteSettings.supportedLocales?this.props.context.siteSettings.supportedLocales.map(e=>({value:e.locale,label:e.label})):[]}render(){return i.createElement(i.Fragment,null,!this.isLoading()&&i.createElement("div",{className:"select-wrapper input"},i.createElement(Bs,{id:"user-locale-input",className:"setup-extension",name:"locale",value:this.state.locale,disabled:!this.areActionsAllowed,items:this.supportedLocales,onChange:this.handleLocaleInputChange})))}}js.propTypes={context:d().any};const Ws=a(js);class Ys extends i.Component{get statesToHideLocaleSwitch(){return[A.INITIAL_STATE]}get mustDisplayLocaleSwitch(){return!this.statesToHideLocaleSwitch.includes(this.props.apiTriageContext.state)}render(){return i.createElement(i.Fragment,null,this.mustDisplayLocaleSwitch&&i.createElement(Ws,null))}}Ys.propTypes={apiTriageContext:d().any};const zs=C(Ys);var Zs,Js,Xs,Qs,ei;function ti(){return ti=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ti.apply(null,arguments)}const si=function(e){return i.createElement("svg",ti({xmlns:"http://www.w3.org/2000/svg",width:151,height:27,fill:"none","aria-labelledby":"logo-title logo-description",viewBox:"0 0 151 27"},e),Zs||(Zs=i.createElement("title",{id:"logo-title"},"Passbolt logo")),Js||(Js=i.createElement("desc",{id:"logo-description"},"This is the logo of passbolt.")),Xs||(Xs=i.createElement("path",{fill:"var(--icon-color)",d:"M4.648 9.234v8.607h2.48c1.646 0 2.786-.349 3.47-1.012.685-.664 1.013-1.823 1.013-3.395 0-1.52-.305-2.595-.938-3.218-.633-.673-1.695-.972-3.24-.972zM.597 5.963h7.797c2.357 0 4.178.676 5.496 2.048q1.976 2.058 1.974 5.689a8.6 8.6 0 0 1-.406 2.749 7.1 7.1 0 0 1-1.24 2.278 5.9 5.9 0 0 1-2.38 1.773c-.937.349-2.152.524-3.697.524H4.648V26.5H.597zM24.016 18.016h5.064v-3.119h-4.76c-.937 0-1.594.124-1.95.375-.357.25-.517.698-.517 1.321 0 .524.15.899.429 1.122.28.223.848.301 1.734.301M18.649 5.963h8.268c2.103 0 3.672.476 4.736 1.423 1.065.947 1.594 2.347 1.594 4.217v9.456H22.37c-1.52 0-2.708-.375-3.52-1.121-.81-.747-1.2-1.823-1.2-3.22 0-1.722.454-2.945 1.392-3.692s2.483-1.134 4.697-1.134h5.315v-.365c0-.898-.276-1.518-.809-1.896-.532-.377-1.47-.55-2.86-.55H18.65zM36.55 17.915h8.525c.76 0 1.318-.124 1.646-.35.183-.122.328-.29.423-.486.094-.197.134-.414.115-.63a1.2 1.2 0 0 0-.112-.632 1.24 1.24 0 0 0-.42-.492c-.355-.253-.91-.374-1.646-.374h-3.494c-2.067 0-3.467-.325-4.203-.947-.737-.623-1.088-1.747-1.088-3.32 0-1.62.431-2.82 1.318-3.592.886-.772 2.255-1.152 4.064-1.152h8.684v3.142h-7.134q-1.75 0-2.279.301c-.354.198-.532.547-.532 1.071-.017.193.016.387.096.564s.204.332.361.449c.302.223.809.324 1.468.324h3.676c1.672 0 2.961.397 3.824 1.172s1.315 1.871 1.315 3.32c0 1.397-.405 2.53-1.188 3.417-.37.427-.833.768-1.354.996-.522.23-1.09.34-1.661.325H36.549zM53.822 17.915h8.526c.76 0 1.318-.124 1.646-.35a1.23 1.23 0 0 0 .42-.487c.093-.196.132-.413.112-.629a1.2 1.2 0 0 0-.111-.632 1.24 1.24 0 0 0-.421-.492c-.354-.253-.91-.374-1.646-.374h-3.493c-2.067 0-3.467-.325-4.204-.947-.736-.623-1.088-1.752-1.088-3.324 0-1.62.432-2.82 1.318-3.593.886-.772 2.253-1.147 4.075-1.147h8.686v3.142h-7.141q-1.747 0-2.28.301c-.353.198-.531.547-.531 1.071-.017.193.016.387.096.564s.204.332.361.449c.302.223.809.324 1.468.324h3.671c1.672 0 2.963.397 3.824 1.172s1.315 1.871 1.315 3.32c0 1.397-.403 2.53-1.188 3.417-.37.427-.832.767-1.354.996a3.9 3.9 0 0 1-1.66.325H53.769v-3.106zM75.387.5v5.463h3.47c1.55 0 2.759.175 3.694.55.946.362 1.77.976 2.38 1.772a7.2 7.2 0 0 1 1.243 2.296c.281.888.417 1.814.403 2.744q0 3.63-1.974 5.689c-1.315 1.372-3.14 2.046-5.493 2.046h-7.8V.5zm2.462 8.734h-2.483v8.608h2.785c1.55 0 2.633-.324 3.243-.95s.935-1.721.935-3.268-.354-2.694-1.033-3.367c-.68-.673-1.832-1.023-3.447-1.023M92.3 13.525c0 1.445.328 2.532 1.013 3.367s1.62 1.198 2.86 1.198 2.152-.398 2.863-1.198 1.033-1.921 1.033-3.367-.356-2.547-1.033-3.344c-.677-.798-1.62-1.198-2.863-1.198a3.64 3.64 0 0 0-1.57.279 3.6 3.6 0 0 0-1.29.919c-.685.797-1.013 1.921-1.013 3.344m12.002 0q0 3.544-2.202 5.689c-1.47 1.397-3.42 2.121-5.901 2.121s-4.457-.699-5.924-2.121-2.202-3.292-2.202-5.664q0-3.558 2.202-5.69c1.467-1.424 3.444-2.145 5.919-2.145s4.431.724 5.901 2.144 2.207 3.294 2.207 5.666M110.935 21.06h-4.202V.5h4.202zM112.884 5.963h2.86V.5h4.052v5.463h4.278v3.02h-4.278v6.09c0 1.12.204 1.895.581 2.343.377.449 1.064.649 2.026.649h1.671v3.02h-3.72c-1.494 0-2.636-.4-3.444-1.223-.809-.823-1.189-1.995-1.189-3.519v-7.36h-2.863v-3.02z"})),Qs||(Qs=i.createElement("path",{fill:"#D40101",d:"m149.951 10.68-9.059-8.36a2.12 2.12 0 0 0-1.421-.543c-.526 0-1.033.194-1.421.544l-5.684 5.268c.745.271 1.414.71 1.952 1.282.539.572.933 1.26 1.149 2.01h7.673a.73.73 0 0 1 .504.204.69.69 0 0 1 .207.494v1.147a.68.68 0 0 1-.207.494.72.72 0 0 1-.504.204h-.886v1.623a.68.68 0 0 1-.205.494.72.72 0 0 1-.503.205h-1.945a.73.73 0 0 1-.503-.205.69.69 0 0 1-.205-.494v-1.623h-3.426a4.84 4.84 0 0 1-1.135 2.033 5 5 0 0 1-1.966 1.287l5.71 5.276c.388.349.895.543 1.421.543a2.12 2.12 0 0 0 1.421-.543l9.043-8.355a2.03 2.03 0 0 0-.01-2.985"})),ei||(ei=i.createElement("path",{fill:"#D40101",d:"M130.683 9.867a2.6 2.6 0 0 0-1.064.253c-.371.18-.686.455-.913.794a2.242 2.242 0 0 0-.113 2.305 2.3 2.3 0 0 0 .831.877 2.36 2.36 0 0 0 2.355.059c.362-.197.664-.484.875-.833a2.24 2.24 0 0 0 .324-1.153 2.21 2.21 0 0 0-.653-1.625 2.3 2.3 0 0 0-.751-.5 2.3 2.3 0 0 0-.891-.177"})))};class ii extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{siteSettings:null,trustedDomain:this.baseUrl,getApiClientOptions:this.getApiClientOptions.bind(this),locale:null,onUpdateLocaleRequested:this.onUpdateLocaleRequested.bind(this)}}async componentDidMount(){const e=await this.getSiteSettings();this.initLocale(e)}get baseUrl(){const e=document.getElementsByTagName("base")&&document.getElementsByTagName("base")[0];return e?e.attributes.href.value.replace(/\/*$/g,""):(console.error("Unable to retrieve the page base tag"),"")}getApiClientOptions(){return(new l).setBaseUrl(this.state.trustedDomain)}async getSiteSettings(){const e=this.getApiClientOptions().setResourceName("settings"),t=new f(e),{body:s}=await t.findAll(),i=new le(s);return this.setState({siteSettings:i}),i}initLocale(e){const t=this.getUrlLocale(e)||this.getBrowserLocale(e)||this.getBrowserSimilarLocale(e)||e.locale;this.setState({locale:t}),this.setUrlLocale(t)}getUrlLocale(e){const t=new URL(window.location.href).searchParams.get("locale");if(t){const s=e.supportedLocales.find(e=>t===e.locale);if(s)return s.locale}}getBrowserLocale(e){const t=e.supportedLocales.find(e=>navigator.language===e.locale);if(t)return t.locale}getBrowserSimilarLocale(e){const t=navigator.language.split("-")[0],s=e.supportedLocales.find(e=>t===e.locale.split("-")[0]);if(s)return s.locale}onUpdateLocaleRequested(e){this.setState({locale:e}),this.setUrlLocale(e)}setUrlLocale(e){const t=new URL(window.location.href);t.searchParams.set("locale",e),window.history.replaceState(null,null,t)}isReady(){return null!==this.state.siteSettings&&null!==this.state.locale}render(){return i.createElement(o.Provider,{value:this.state},this.isReady()&&i.createElement(Ms,{loadingPath:`${this.state.trustedDomain}/locales/{{lng}}/{{ns}}.json`},i.createElement(v,null,i.createElement("div",{id:"container",className:"container page login"},i.createElement("div",{className:"content"},i.createElement("div",{className:"header"},i.createElement("div",{className:"logo-svg"},i.createElement(si,{role:"img",width:"20rem",height:"3.5rem"}))),i.createElement("div",{className:"login-form"},i.createElement(rt,null)),i.createElement(zs,null)),i.createElement(ks,null)))))}}const ni=ii,ri=document.createElement("div");document.body.appendChild(ri),(0,n.H)(ri).render(i.createElement(ni,null))}};const t={};function s(i){const n=t[i];if(void 0!==n)return n.exports;const r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,s),r.exports}s.m=e,(()=>{const e=[];s.O=(t,i,n)=>{if(!i){for(var r=0;r<e.length;r++){let[i,n]=e[r],o=!0;for(var a=0;a<i.length;a++)s.O.j(i[a])?i.splice(a--,1):o=!1;if(o){e.splice(r--,1);const s=n();void 0!==s&&(t=s)}}return t}e.push([i,n])}})(),s.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.cw=e=>{var t;return()=>{if(e){var s=e;e=0,t={exports:{}},s.call(t.exports,t,t.exports)}return t.exports}},s.d=(e,t)=>{if(Array.isArray(t))for(var i=0;i<t.length;){var n=t[i++],r=t[i++],a=0===r?{enumerable:!0,value:t[i++]}:{enumerable:!0,get:r};s.o(e,n)||Object.defineProperty(e,n,a)}else for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.j=666,s.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={666:0};s.O.j=t=>0===e[t];const t=(t,i)=>{let[n,r,a]=i;var o,l,c=0;if(n.some(t=>0!==e[t])){for(o in r)s.o(r,o)&&(s.m[o]=r[o]);if(a)var d=a(s)}for(t&&t(i);c<n.length;c++)l=n[c],s.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return s.O(d)},i=self.webpackChunkpassbolt_styleguide=self.webpackChunkpassbolt_styleguide||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();let i=s.O(void 0,[3847],()=>s(86954));i=s.O(i)})();
2
+ (()=>{"use strict";var e={86954(e,t,s){var i=s(96540),n=s(5338);const r=i.createContext({user:null,users:null,roles:null,rememberMeOptions:{},resources:null,resource:null,shareResources:null,selectedResources:null,selectedUser:null,folders:null,resourceCommentId:null,mustRefreshComments:!1,siteSettings:null,userSettings:null,onCheckIsAuthenticatedRequested:null});function a(e){return class extends i.Component{render(){return i.createElement(r.Consumer,null,t=>i.createElement(e,{context:t,...this.props}))}}}const o=r;class l{setBaseUrl(e){if(!e)throw new TypeError("ApiClientOption baseUrl is required.");if("string"==typeof e)try{this.baseUrl=new URL(e)}catch(e){throw new TypeError("ApiClientOption baseUrl is invalid.",{cause:e})}else{if(!(e instanceof URL))throw new TypeError("ApiClientOptions baseurl should be a string or URL");this.baseUrl=e}return this}setResourceName(e){if(!e)throw new TypeError("ApiClientOptions.setResourceName resourceName is required.");if("string"!=typeof e)throw new TypeError("ApiClientOptions.setResourceName resourceName should be a valid string.");return this.resourceName=e,this}getBaseUrl(){return this.baseUrl}getResourceName(){return this.resourceName}async getHeaders(){const e=await this.getCsrfToken();if(e)return{"X-CSRF-Token":e}}async getCsrfToken(){if("undefined"==typeof browser||void 0===browser.cookies){const e=document?.cookie?.split("; ")?.find(e=>e.startsWith("csrfToken"))?.split("=");return e&&2===e.length?e[1]:null}const e=this.baseUrl.toString(),t="/"===e.slice(-1)?e:`${e}/`,s=await browser.cookies.get({name:"csrfToken",url:t});return s?.value||null}}var c=s(5556),d=s.n(c);class p extends Error{constructor(e,t){super(e),this.name="PassboltApiFetchError",this.data=t||{}}}const h=p;class u extends Error{constructor(){super("An internal error occurred. The server response could not be parsed. Please contact your administrator."),this.name="PassboltBadResponseError"}}const m=u;class g extends Error{constructor(e){super(e=e||"The service is unavailable"),this.name="PassboltServiceUnavailableError"}}const E=g,y=["GET","POST","PUT","DELETE"];class f{constructor(e){if(this.options=e,!this.options.getBaseUrl())throw new TypeError("ApiClient constructor error: baseUrl is required.");if(!this.options.getResourceName())throw new TypeError("ApiClient constructor error: resourceName is required.");try{let e=this.options.getBaseUrl().toString();e.endsWith("/")&&(e=e.slice(0,-1));let t=this.options.getResourceName();t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,-1)),this.baseUrl=`${e}/${t}`,this.baseUrl=new URL(this.baseUrl)}catch(e){throw new TypeError("ApiClient constructor error: b.",{cause:e})}this.apiVersion="api-version=v2"}setApiVersion(e){if("string"!=typeof e)throw new TypeError("ApiClient.setApiVersion error: apiVersion should be a string.");this.apiVersion=`api-version=${e}`}getDefaultHeaders(){return{Accept:"application/json","content-type":"application/json"}}async buildFetchOptions(){const e=await this.options.getHeaders();return{credentials:"include",headers:{...this.getDefaultHeaders(),...e}}}async get(e,t){this.assertValidId(e);const s=this.buildUrl(`${this.baseUrl}/${e}`,t||{});return this.fetchAndHandleResponse("GET",s)}async delete(e,t,s,i){let n;this.assertValidId(e),void 0===i&&(i=!1),n=i?this.buildUrl(`${this.baseUrl}/${e}/dry-run`,s||{}):this.buildUrl(`${this.baseUrl}/${e}`,s||{});let r=null;return t&&(r=this.buildBody(t)),this.fetchAndHandleResponse("DELETE",n,r)}async findAll(e){const t=this.buildUrl(this.baseUrl.toString(),e||{});return this.fetchAndHandleResponse("GET",t)}async create(e,t){const s=this.buildUrl(this.baseUrl.toString(),t||{}),i=this.buildBody(e);return this.fetchAndHandleResponse("POST",s,i)}async update(e,t,s,i){let n;this.assertValidId(e),void 0===i&&(i=!1),n=i?this.buildUrl(`${this.baseUrl}/${e}/dry-run`,s||{}):this.buildUrl(`${this.baseUrl}/${e}`,s||{});let r=null;return t&&(r=this.buildBody(t)),this.fetchAndHandleResponse("PUT",n,r)}async updateAll(e,t={}){const s=this.buildUrl(this.baseUrl.toString(),t),i=e?this.buildBody(e):null;return this.fetchAndHandleResponse("PUT",s,i)}assertValidId(e){if(!e)throw new TypeError("ApiClient.assertValidId error: id cannot be empty");if("string"!=typeof e)throw new TypeError("ApiClient.assertValidId error: id should be a string")}assertMethod(e){if("string"!=typeof e)throw new TypeError("ApiClient.assertValidMethod method should be a string.");if(y.indexOf(e.toUpperCase())<0)throw new TypeError(`ApiClient.assertValidMethod error: method ${e} is not supported.`)}assertUrl(e){if(!e)throw new TypeError("ApliClient.assertUrl error: url is required.");if(!(e instanceof URL))throw new TypeError("ApliClient.assertUrl error: url should be a valid URL object.");if("https:"!==e.protocol&&"http:"!==e.protocol)throw new TypeError("ApliClient.assertUrl error: url protocol should only be https or http.")}assertBody(e){if(!(e instanceof FormData)&&"string"!=typeof e)throw new TypeError("ApiClient.assertBody error: body should be a string or a FormData.")}buildBody(e){return JSON.stringify(e)}buildUrl(e,t){if("string"!=typeof e)throw new TypeError("ApiClient.buildUrl error: url should be a string.");const s=new URL(`${e}.json?${this.apiVersion}`);t=t||{};for(const[e,i]of Object.entries(t)){if("string"!=typeof e)throw new TypeError("ApiClient.buildUrl error: urlOptions key should be a string.");if("string"==typeof i)s.searchParams.append(e,i);else{if(!Array.isArray(i))throw new TypeError("ApiClient.buildUrl error: urlOptions value should be a string or array.");i.forEach(t=>{s.searchParams.append(e,t)})}}return s}async sendRequest(e,t,s,i){this.assertUrl(t),this.assertMethod(e),s&&this.assertBody(s);const n="undefined"!=typeof customApiClientFetch?customApiClientFetch:fetch,r={...await this.buildFetchOptions(),...i};r.method=e,s&&(r.body=s);try{return await n(t.toString(),r)}catch(e){throw console.error(e),navigator.onLine?new E("Unable to reach the server, an unexpected error occurred"):new E("Unable to reach the server, you are not connected to the network")}}async fetchAndHandleResponse(e,t,s,i){const n=await this.sendRequest(e,t,s,i);return this.parseResponseJson(n)}async parseResponseJson(e){let t;try{t=await e.json()}catch(t){throw console.debug(e.url.toString(),t),new m(t,e)}if(!e.ok){const s=t.header.message;throw new h(s,{header:t.header,code:e.status,body:t.body})}return t}}const b=class{constructor(e){this.apiClientOptions=e}async find(){this.initClient();const e=await this.apiClient.findAll(),t=e?.body;return t}async save(e){this.initClient(),await this.apiClient.create(e)}async delete(e){this.initClient(),await this.apiClient.delete(e)}async checkDomainAllowed(e){this.initClient("dry-run"),await this.apiClient.create(e)}initClient(e="settings"){this.apiClientOptions.setResourceName(`self-registration/${e}`),this.apiClient=new f(this.apiClientOptions)}},S=[{id:"azure",name:"Microsoft",icon:i.createElement("svg",{width:"65",height:"64",viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M31.3512 3.04762H3.92261V30.4762H31.3512V3.04762Z",fill:"#F25022"}),i.createElement("path",{d:"M31.3512 33.5238H3.92261V60.9524H31.3512V33.5238Z",fill:"#00A4EF"}),i.createElement("path",{d:"M61.8274 3.04762H34.3988V30.4762H61.8274V3.04762Z",fill:"#7FBA00"}),i.createElement("path",{d:"M61.8274 33.5238H34.3988V60.9524H61.8274V33.5238Z",fill:"#FFB900"})),defaultConfig:{url:"https://login.microsoftonline.com",client_id:"",client_secret:"",tenant_id:"",client_secret_expiry:"",prompt:"login",email_claim:"email",login_hint:!0}},{id:"google",name:"Google",icon:i.createElement("svg",{width:"65",height:"64",viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M63.9451 32.72C63.9451 30.6133 63.7584 28.6133 63.4384 26.6667H33.3051V38.6933H50.5584C49.7851 42.64 47.5184 45.9733 44.1584 48.24V56.24H54.4517C60.4784 50.6667 63.9451 42.4533 63.9451 32.72Z",fill:"#4285F4"}),i.createElement("path",{d:"M33.305 64C41.945 64 49.1717 61.12 54.4517 56.24L44.1583 48.24C41.2783 50.16 37.625 51.3333 33.305 51.3333C24.9583 51.3333 17.8917 45.7067 15.3583 38.1067H4.745V46.3467C9.99833 56.8 20.7983 64 33.305 64Z",fill:"#34A853"}),i.createElement("path",{d:"M15.3584 38.1067C14.6917 36.1867 14.3451 34.1333 14.3451 32C14.3451 29.8667 14.7184 27.8133 15.3584 25.8933V17.6533H4.74505C2.55838 21.9733 1.30505 26.8267 1.30505 32C1.30505 37.1733 2.55838 42.0267 4.74505 46.3467L15.3584 38.1067Z",fill:"#FBBC05"}),i.createElement("path",{d:"M33.305 12.6667C38.025 12.6667 42.2383 14.2933 45.5717 17.4667L54.6917 8.34667C49.1717 3.17334 41.945 0 33.305 0C20.7983 0 9.99833 7.20001 4.745 17.6533L15.3583 25.8933C17.8917 18.2933 24.9583 12.6667 33.305 12.6667Z",fill:"#EA4335"})),defaultConfig:{client_id:"",client_secret:""}},{id:"oauth2",name:"OpenID",hiddenIfDisabled:!0,icon:i.createElement("svg",{width:"65",height:"60",viewBox:"0 0 65 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M64.2468 34.9929L62.9089 21.0968L57.9256 23.9083C53.2914 21.0968 47.3581 19.1061 40.7332 18.3046V24.4577C44.5336 25.117 47.9462 26.3321 50.7513 27.9544L45.5031 30.9146L64.2533 34.9929H64.2468Z",fill:"#B3B3B3"}),i.createElement("path",{d:"M9.94184 38.8774C9.94184 32.0069 17.4264 26.2222 27.632 24.4577V18.2981C12.023 20.1854 0.246826 28.6783 0.246826 38.8774C0.246826 49.0766 12.8891 58.1769 29.3319 59.6312V53.5557C18.2666 52.166 9.94184 46.1228 9.94184 38.8774Z",fill:"#B3B3B3"}),i.createElement("path",{d:"M29.332 5.09999V59.6377L39.027 55.0746V0.362366L29.332 5.09999Z",fill:"#F8931E"})),defaultConfig:{url:"",openid_configuration_path:"",scope:"openid email profile",client_id:"",client_secret:""}},{id:"adfs",name:"AD FS",hiddenIfDisabled:!0,icon:i.createElement("svg",{width:"65",height:"64",viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M64.5443 48.7454V62.166C64.5443 63.7378 64.0607 64.0602 62.5695 63.8184C52.5746 62.3272 42.4587 60.957 32.3831 59.5464C30.5695 59.3046 29.9247 58.6597 29.9247 56.6849C30.0859 49.5514 30.0053 42.3776 29.9247 35.1635C29.9247 33.5917 30.4083 33.1081 31.9801 33.1081C42.2975 33.1887 52.4536 33.1887 62.5695 33.1887C64.2219 33.1887 64.6249 33.8335 64.6249 35.3247C64.4637 39.8386 64.5443 44.2718 64.5443 48.7454Z",fill:"#00AAF2"}),i.createElement("path",{d:"M47.416 30.6093C42.3379 30.6093 37.2598 30.5287 32.1817 30.6093C30.6099 30.6093 29.9651 30.2869 29.9651 28.4733C30.0457 21.1786 30.0457 14.0048 29.9651 6.79069C29.9651 5.38011 30.4487 4.89648 31.7787 4.65467C42.1767 3.16349 52.5747 1.7126 62.9726 0.140816C64.7862 -0.100997 64.4638 1.10807 64.4638 2.11563C64.4638 8.56399 64.5444 15.1333 64.4638 21.5816C64.4638 23.9595 64.3832 26.3373 64.4638 28.7151C64.5444 30.2063 63.9802 30.6093 62.5696 30.6093C57.5721 30.5287 52.4941 30.6093 47.416 30.6093Z",fill:"#00AAF2"}),i.createElement("path",{d:"M13.8038 33.3096H25.1691C26.3782 33.3096 26.9021 33.7126 26.9021 34.962V57.37C26.9021 58.6597 26.3378 58.7806 25.1691 58.6597C17.6326 57.5312 10.096 56.4431 2.59981 55.3952C1.10863 55.1534 0.625 54.6698 0.625 53.098C0.705605 47.1332 0.705605 41.1685 0.625 35.0829C0.625 33.5917 1.02802 33.1887 2.51921 33.1887C6.34792 33.3096 10.0154 33.3096 13.8038 33.3096Z",fill:"#00AAF2"}),i.createElement("path",{d:"M13.8038 30.6093H2.59977C1.18919 30.6093 0.705566 30.1257 0.705566 28.6345C0.786171 22.7504 0.786171 16.8663 0.705566 10.9418C0.705566 9.53126 1.10859 9.04763 2.59977 8.80582C10.1363 7.83856 17.6728 6.7504 25.169 5.54133C26.902 5.29952 27.0633 5.86375 27.0633 7.27433V28.7151C27.0633 30.2869 26.4184 30.5287 25.0078 30.5287C21.2597 30.5287 17.4713 30.6093 13.8038 30.6093Z",fill:"#00AAF2"})),defaultConfig:{url:"",openid_configuration_path:"",scope:"openid email profile",client_id:"",client_secret:""}},{id:"pingone",name:"PingOne",hiddenIfDisabled:!0,icon:i.createElement("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M0 0H64V64H0V0Z",fill:"#BB2631"}),i.createElement("path",{d:"M30.719 51.2024L31.6177 51.0748V57.6038H30.7179L30.719 51.2024ZM34.43 51.9678V56.1936C34.43 56.9602 34.5576 57.2154 35.2011 57.2154C35.4563 57.2154 35.3287 57.2154 35.5838 57.0878L35.7114 57.6038C35.4562 57.7313 35.3287 57.8589 34.946 57.8589C34.6851 57.8589 34.43 57.7313 34.1748 57.7313C33.7921 57.4762 33.6646 57.0878 33.6646 56.4499V51.9678H32.7647V51.2024H33.537V48.7717H34.43V51.2024H35.839L35.5838 51.9678H34.43ZM36.4837 33.7946C35.7125 33.7946 34.6863 34.3049 33.7933 35.2035V46.5916H29.9547V34.814C29.9547 33.4118 29.8271 32.1304 29.4387 30.9755L32.8946 29.9549C33.283 30.5927 33.4105 31.3593 33.4105 32.0029C34.0484 31.6201 34.4311 31.2317 35.0747 30.849C35.9123 30.4431 36.8287 30.2253 37.7594 30.2112C39.4235 30.2112 40.8325 31.1042 41.3439 32.512C41.6036 33.1499 41.6036 33.7946 41.6036 34.8151V46.5927H37.7594V36.0965C37.7594 34.3049 37.5042 33.7946 36.4837 33.7946ZM47.4901 35.7138C47.4901 34.1761 48.3831 33.2786 49.791 33.2786C51.3287 33.2786 52.0998 34.1773 52.0998 35.7138C52.0998 37.2504 51.2 38.0158 49.6646 38.0158C48.5164 38.0158 47.4901 37.378 47.4901 35.7138ZM51.3275 42.4979H49.2818C48.8991 42.4979 48.644 42.3703 48.644 42.1152C48.644 41.7279 49.1543 41.3441 50.1805 40.8338H50.8184C54.0191 40.8338 56.3211 38.7869 56.3211 35.969C56.3211 34.9427 56.0659 34.0497 55.4281 33.2786C55.6832 33.2786 56.0659 33.4118 56.4486 33.4118C57.4749 33.4118 58.3679 33.0234 59.139 32.258L57.476 29.5676C56.5762 30.4663 55.4281 30.9766 54.4018 30.9766C53.8915 30.9766 53.3767 30.849 52.6101 30.5939C51.5838 30.3387 50.8184 30.2112 49.9197 30.2112C46.0812 30.2112 43.6516 32.3856 43.6516 35.7127C43.6516 38.1434 44.6722 39.5524 46.8523 40.1902C44.417 40.8338 44.1619 41.8544 44.1619 42.8806C44.1619 44.0345 44.5446 44.6723 45.3157 45.0562C45.9536 45.3102 47.1074 45.571 48.8991 45.571H50.5621C52.0998 45.571 53.248 46.0813 53.248 47.4903C53.248 48.1282 52.8652 48.7717 52.3549 49.1556C51.7114 49.5383 50.946 49.6659 49.9197 49.6659C48.128 49.6659 47.1063 49.028 47.1063 47.619C47.1063 47.2363 47.1063 46.9755 47.235 46.5927H43.5229C43.3953 46.8467 43.1345 47.3627 43.1345 48.2557C43.1345 49.4107 43.5217 50.3037 44.4159 51.0748C45.6973 52.4838 47.8717 52.8665 50.0518 52.8665C52.3538 52.8665 54.6558 52.3562 55.9372 50.8197C56.7026 49.9199 57.0911 48.7729 57.0911 47.4914C57.0911 46.0825 56.7038 44.9286 55.8096 44.0345C54.7845 42.8806 53.6341 42.4979 51.3275 42.4979ZM41.9852 57.4762C41.6025 57.4762 41.3416 57.2142 41.3416 56.7051C41.3416 56.3224 41.6036 55.9396 41.9852 55.9396C42.3668 55.9396 42.623 56.1948 42.623 56.7051C42.623 57.0878 42.2403 57.4762 41.9852 57.4762ZM41.9852 55.6845C41.4749 55.6845 41.0865 56.0672 41.0865 56.5775C41.0865 57.0878 41.4738 57.4762 41.9852 57.4762C42.4966 57.4762 42.8782 57.0878 42.8782 56.5764C42.7518 56.1948 42.369 55.6845 41.9852 55.6845ZM41.73 56.5775V56.3224H41.8576C41.9852 56.3224 42.1128 56.3224 42.1128 56.4499C42.1128 56.5775 41.9852 56.5775 41.8576 56.5775H41.73ZM42.3679 56.4499C42.3679 56.1948 42.2415 56.1948 41.9863 56.1948H41.6025V57.2154H41.7312V56.7051H41.8588L42.1139 57.2154H42.2415L41.9863 56.7051C42.2403 56.7051 42.3679 56.7051 42.3679 56.4499ZM41.6025 51.2024L39.5499 57.8589C39.1672 59.1403 38.6569 60.0333 37.6307 60.2885L37.3755 59.6506C37.8858 59.3955 38.2754 59.1403 38.5294 58.4968C38.4018 57.8589 38.4018 57.7313 38.4018 57.7313C38.2742 57.3486 38.0145 56.0672 37.7582 55.4237L36.4825 51.33L37.3755 50.9473L38.5294 55.1685C38.6569 55.8121 38.9121 56.8327 38.9121 56.8327C38.9121 56.8327 39.1672 56.0672 39.2948 55.4237L40.4486 51.2024H41.6025ZM13.4387 55.9385C13.4387 55.9385 13.3112 56.1936 13.056 56.4488C12.6733 56.7039 12.4125 56.8315 11.9022 56.8315C11.3919 56.8315 11.0092 56.5764 10.7483 56.0661C10.5701 55.5297 10.4838 54.9671 10.4932 54.402C10.4932 53.5021 10.6208 52.993 10.8816 52.4827C11.1368 52.0943 11.5195 51.8391 11.9022 51.8391C12.5457 51.8391 13.056 52.0943 13.3112 52.4827L13.4387 55.9385ZM14.3374 48.7706H13.4387V51.9667C13.2651 51.7225 13.0339 51.525 12.7657 51.3915C12.4975 51.258 12.2005 51.1926 11.901 51.2013C11.5198 51.2013 11.1356 51.3288 10.7483 51.584C9.98291 52.2218 9.6002 53.247 9.6002 54.5295C9.6002 56.5764 10.4932 57.8578 11.9022 57.8578C12.5446 57.8585 13.0572 57.6015 13.4399 57.0867C13.4399 57.4739 13.5663 57.7302 13.5663 57.7302H14.4661C14.3374 57.3475 14.3374 56.7039 14.3374 55.6834V48.7706ZM28.2895 51.2013H29.826L29.4376 51.9667H28.1619V56.1925C28.1619 56.9591 28.2895 57.2142 28.9273 57.2142C29.1825 57.2142 29.0549 57.2142 29.31 57.0867L29.4376 57.6026C29.1825 57.7302 29.0549 57.8578 28.6722 57.8578C28.417 57.8578 28.1619 57.7302 27.9067 57.7302C27.5183 57.4751 27.3908 57.0867 27.3908 56.4488V51.9667H26.6253V51.2013H27.3908V48.7706H28.2895V51.2013ZM22.7856 30.7203L26.6242 30.0825V46.5905H22.7856V30.7203ZM22.3984 25.9819C22.3984 24.5729 23.5511 23.4248 24.8325 23.4248C26.1082 23.4248 27.1356 24.5729 27.1356 25.9819C27.1356 27.3909 26.1093 28.6723 24.7049 28.6723C23.4246 28.6723 22.3984 27.5185 22.3984 25.9819ZM25.5979 51.9667C25.7266 52.2218 25.7266 52.4827 25.7266 52.7378V57.6015H24.8336V53.2504C24.8336 52.6125 24.8336 52.3574 24.5785 52.2241C24.4011 52.0653 24.1729 51.9749 23.9349 51.969C23.4246 51.969 22.7868 52.3563 22.2708 52.8677V57.6049H21.3767V52.6125C21.3767 51.7127 21.1215 51.2036 21.1215 51.2036L22.0157 50.9484C22.0157 50.9484 22.2708 51.4587 22.2708 51.969C22.9144 51.3311 23.4246 50.9484 24.0625 50.9484C24.8336 51.076 25.3439 51.4587 25.5991 51.969M16.6394 53.7607C16.6394 52.485 17.1497 51.7138 17.9208 51.7138C18.3035 51.7138 18.8138 51.969 18.9414 52.2241C19.1966 52.7401 19.1965 53.1228 19.3298 53.7607H16.6394ZM18.0484 50.9473C17.4049 50.9473 16.767 51.2035 16.2567 51.8414C15.7407 52.485 15.6132 53.2504 15.6132 54.2767C15.6132 56.4511 16.6394 57.7325 18.176 57.7325C18.9414 57.7325 19.585 57.4773 20.0952 56.9614L19.7125 56.3235C19.3298 56.7062 18.8138 56.9614 18.3036 56.9614C17.6657 56.9614 17.1497 56.7062 16.8946 56.1959C16.6394 55.8132 16.6394 55.4248 16.6394 54.7869V54.6594H20.2228V54.5318C20.2228 52.9941 20.0953 52.3562 19.585 51.8414C19.1977 51.2035 18.6863 50.9484 18.0484 50.9484M7.42578 57.6049H8.31878V48.6453H7.42578V57.6049ZM16.2567 33.7957C15.7407 34.6887 15.2316 34.9438 13.5663 34.9438H11.3919V28.2873H13.949C15.6132 28.2873 16.6394 29.5687 16.6394 31.6213C16.767 32.6419 16.6394 33.2797 16.2567 33.7957ZM18.3036 25.7291C17.1497 25.0912 16.1291 24.7039 12.6733 24.7039H7.42578V46.7215H11.5195V38.6594H13.6939C15.874 38.6594 16.767 38.3985 17.6657 37.8882C19.8412 36.7344 21.1215 34.4324 21.1215 31.4869C21.2491 28.9298 20.2228 26.8829 18.3036 25.7291Z",fill:"white"})),defaultConfig:{url:"https://auth.pingone.com",environment_id:"",client_id:"",client_secret:"",email_claim:"email"}}],T=i.createContext({unexpectedError:null,state:null,isSsoRecoverEnabled:!1,getSsoProviderId:()=>{},onInitializeTriageRequested:()=>{},onTriageRequested:()=>{},onRegistrationRequested:()=>{},handleSwitchToSsoSignInState:()=>{},handleSwitchToUsernameState:()=>{},handleSwitchToEnterNameState:()=>{}});class w extends i.Component{constructor(e){super(e),this.state=Object.assign(this.defaultState,e.value)}get defaultState(){return this.findSsoProviderId=this.findSsoProviderId.bind(this),{unexpectedError:null,state:A.INITIAL_STATE,isSsoRecoverEnabled:!1,ssoProviderId:null,getSsoProviderId:this.getSsoProviderId.bind(this),onInitializeTriageRequested:this.onInitializeTriageRequested.bind(this),onTriageRequested:this.onTriageRequested.bind(this),onRegistrationRequested:this.onRegistrationRequested.bind(this),handleSwitchToSsoSignInState:this.handleSwitchToSsoSignInState.bind(this),handleSwitchToUsernameState:this.handleSwitchToUsernameState.bind(this),handleSwitchToEnterNameState:this.handleSwitchToEnterNameState.bind(this)}}async onInitializeTriageRequested(){const e=this.isSsoAvailable(),t=e?await this.findSsoProviderId():null,s=e&&Boolean(t);this.setState({ssoProviderId:t,isSsoRecoverEnabled:s,state:s?A.SSO_SIGN_IN_STATE:A.USERNAME_STATE})}isSsoAvailable(){return this.props.context.siteSettings.canIUse("ssoRecover")&&this.props.context.siteSettings.canIUse("sso")}getSsoProviderId(){return this.state.ssoProviderId}async findSsoProviderId(){const e=this.props.context.getApiClientOptions();e.setResourceName("sso/settings/current");const t=new f(e);let s=null;try{s=await t.findAll()}catch(e){return console.error(e),null}const i=s.body.provider;if(!i)return null;const n=S.find(e=>e.id===i);if(!n){const e=new Error("The given SSO provider id is not valid");return console.error(e),null}return n.disabledForRecover?(console.log("Recover processes with this SSO provider is not supported"),null):i}async onTriageRequested(e){const t={username:e},s=this.props.context.getApiClientOptions();s.setResourceName("users/recover");const i=new f(s);await i.create(t).then(this.handleTriageSuccess.bind(this)).catch(t=>this.handleTriageError(t,e))}async handleTriageSuccess(){return this.setState({state:A.CHECK_MAILBOX_STATE})}async handleTriageError(e,t){const s=e.data&&404===e.data.code;let i=A.USERNAME_NOT_FOUND_ERROR;if(s&&this.canIUseSelfRegistrationSettings)try{await this.isDomainAllowedToSelfRegister(t),i=A.NAME_STATE}catch(e){e.data&&(400===e.data.code||403===e.data.code)||(this.setState({unexpectedError:new E(e.message)}),i=A.UNEXPECTED_ERROR_STATE)}this.setState({username:t,state:i})}async onRegistrationRequested(e,t){const s={username:this.state.username,profile:{first_name:e,last_name:t}};this.register(s)}async handleRegistrationSuccess(){return this.setState({state:A.CHECK_MAILBOX_STATE})}async handleRegistrationError(){this.setState({state:A.UNEXPECTED_ERROR_STATE})}handleSwitchToSsoSignInState(){this.setState({state:A.SSO_SIGN_IN_STATE})}handleSwitchToUsernameState(){this.setState({state:A.USERNAME_STATE})}handleSwitchToEnterNameState(e){this.setState({username:e,state:A.NAME_STATE})}get canIUseSelfRegistrationSettings(){return this.props.context.siteSettings.canIUse("selfRegistration")}async isDomainAllowedToSelfRegister(e){const t=this.props.context.getApiClientOptions(),s=new b(t),i={email:e,provider:"email_domains"};await s.checkDomainAllowed(i)}async register(e){const t=this.props.context.getApiClientOptions().setResourceName("users/register"),s=new f(t);await s.create(e).then(this.handleRegistrationSuccess.bind(this)).catch(this.handleRegistrationError.bind(this))}render(){return i.createElement(T.Provider,{value:this.state},this.props.children)}}w.propTypes={context:d().any,value:d().any,children:d().any};const v=a(w);function C(e){return class extends i.Component{render(){return i.createElement(T.Consumer,null,t=>i.createElement(e,{apiTriageContext:t,...this.props}))}}}const A={INITIAL_STATE:"Initial State",USERNAME_STATE:"Enter username state",SSO_SIGN_IN_STATE:"SSO Sign in state",CHECK_MAILBOX_STATE:"Check mailbox state",NAME_STATE:"Enter name state",USERNAME_NOT_FOUND_ERROR:"Username not found error state",UNEXPECTED_ERROR_STATE:"Unexpected error state"};var R,x,_=s(91352),P=s(13279);function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},I.apply(null,arguments)}const N=function(e){return i.createElement("svg",I({width:18,height:18,fill:"none",className:"svg-icon spinner",viewBox:"0 0 18 18"},e),R||(R=i.createElement("circle",{id:"background",cx:8,cy:8,r:8,fill:"none",stroke:"var(--spinner-background)",strokeWidth:"var(--spinner-stroke-width)",transform:"translate(1 1)"})),x||(x=i.createElement("circle",{id:"loading",r:8,fill:"none",stroke:"var(--spinner-color)",strokeLinecap:"round",strokeWidth:"var(--spinner-stroke-width)",transform:"translate(9 9)"})))};class O extends i.Component{render(){return i.createElement("div",{className:"login-processing"},i.createElement("h1",null,this.props.title),i.createElement("div",{className:"processing-wrapper"},i.createElement(N,null)))}}O.propTypes={title:d().oneOfType([d().arrayOf(d().node),d().node,d().string])},O.defaultProps={title:i.createElement(_.x,null,"Please wait...")};const U=(0,P.C)("common")(O);class k extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.getClassName=this.getClassName.bind(this)}getClassName(){let e="button primary form";return this.props.warning?e+=" warning":this.props.attention&&(e+=" attention"),this.props.disabled&&(e+=" disabled"),this.props.processing&&(e+=" processing"),this.props.big&&(e+=" big"),this.props.medium&&(e+=" medium"),this.props.fullWidth&&(e+=" full-width"),e}render(){return i.createElement("button",{type:"submit",className:this.getClassName(),disabled:this.props.disabled},this.props.value||i.createElement(_.x,null,"Save"),this.props.processing&&i.createElement(N,null))}}k.defaultProps={warning:!1,attention:!1},k.propTypes={processing:d().bool,disabled:d().bool,value:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),warning:d().bool,attention:d().bool,big:d().bool,medium:d().bool,fullWidth:d().bool};const D=(0,P.C)("common")(k);var L=s(5648);class q extends Error{constructor(e="Collection validation error."){super(e),this.name="CollectionValidationError",this.errors=[]}addItemValidationError(e,t){if(!Number.isInteger(e))throw new TypeError('CollectionValidationError::addEntityValidationError expects "position" to be an integer.');if(!(t instanceof V||t instanceof q))throw new TypeError('CollectionValidationError::addEntityValidationError expects "entityValidationError" to be an instance of EntityValidationError or CollectionValidationError.');this.errors[e]=t}addCollectionValidationError(e,t){if("string"!=typeof e)throw new TypeError('CollectionValidationError::addCollectionValidationError expects "rule" to be a string.');if("string"!=typeof t)throw new TypeError('CollectionValidationError::addCollectionValidationError expects "error" to be a string.');this.errors[e]=t}hasErrors(){return this.errors.some(e=>Object.keys(e.details).length>0)}get details(){const e={};for(const t in this.errors)this.errors[t]instanceof V||this.errors[t]instanceof q?e[t]=this.errors[t].details:e[t]=this.errors[t];return e}}const G=q;class M extends Error{constructor(e="Entity validation error."){super(e),this.name="EntityValidationError",this.details={}}addError(e,t,s){if("string"!=typeof e)throw new TypeError("EntityValidationError addError property should be a string.");if("string"!=typeof t)throw new TypeError("EntityValidationError addError rule should be a string.");if("string"!=typeof s)throw new TypeError("EntityValidationError addError message should be a string.");Object.prototype.hasOwnProperty.call(this.details,e)||(this.details[e]={}),this.details[e][t]=s}addAssociationError(e,t){if("string"!=typeof e)throw new TypeError("EntityValidationError addAssociationError associationName should be a string.");if(!(t instanceof M||t instanceof G))throw new TypeError("EntityValidationError addAssociationError errorDetails should be an object.");this.details[e]=t}getError(e,t){if(!this.hasError(e,t))return null;const s=this.details[e];return t?s[t]:s}hasError(e,t){if("string"!=typeof e)throw new TypeError("EntityValidationError hasError property should be a string.");const s=this.details&&Object.prototype.hasOwnProperty.call(this.details,e);if(!s)return!1;if(!t)return s;if("string"!=typeof t)throw new TypeError("EntityValidationError hasError rule should be a string.");return Object.prototype.hasOwnProperty.call(this.details[e],t)}hasErrors(){return Object.keys(this.details).length>0}getFirstRuleErrorByField(e){if(!this.hasError(e))return null;const t=this.details[e];return t[Object.keys(t)[0]]}}const V=M;var $=s(57761),F=s.n($);class H{static validateSchema(e,t){if(!t)throw new TypeError(`Could not validate entity ${e}. No schema for entity ${e}.`);if(!t.type)throw new TypeError(`Could not validate entity ${e}. Type missing.`);if("array"!==t.type){if("object"===t.type){if(!t.required||!Array.isArray(t.required))throw new TypeError(`Could not validate entity ${e}. Schema error: no required properties.`);if(!t.properties||!Object.keys(t).length)throw new TypeError(`Could not validate entity ${e}. Schema error: no properties.`);const s=t.properties;for(const e in s){if(!Object.prototype.hasOwnProperty.call(s,e)||!s[e].type&&!s[e].anyOf)throw TypeError(`Invalid schema. Type missing for ${e}...`);if(s[e].anyOf&&(!Array.isArray(s[e].anyOf)||!s[e].anyOf.length))throw new TypeError(`Invalid schema, prop ${e} anyOf should be an array`)}}}else if(!t.items)throw new TypeError(`Could not validate entity ${e}. Schema error: missing item definition.`)}static validate(e,t,s){if(!e||!t||!s)throw new TypeError(`Could not validate entity ${e}. No data provided.`);switch(s.type){case"object":return H.validateObject(e,t,s);case"array":return H.validateArray(e,t,s);default:throw new TypeError(`Could not validate entity ${e}. Unsupported type.`)}}static validateArray(e,t,s){let i;const n=H.validateProp("items",t,s);if("number"==typeof s.minItems&&(H.isGreaterThanOrEqual(t.length,s.minItems)||(i=H.handleCollectionValidationError("minItems",`The items array should contain at least ${s.minItems} item(s).`,i))),"number"==typeof s.maxItems&&(H.isLessThanOrEqual(t.length,s.maxItems)||(i=H.handleCollectionValidationError("maxItems",`The items array should contain at maximum ${s.maxItems} item(s).`,i))),i)throw i;return n}static validateObject(e,t,s){const i=s.required,n=s.properties,r={};let a;for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s))if(null!==t?.[s]||!0!==n[s]?.nullable){if(i.includes(s)){if(!Object.prototype.hasOwnProperty.call(t,s)){a=H.getOrInitEntityValidationError(e,a),a.addError(s,"required",`The ${s} is required.`);continue}}else if(!Object.prototype.hasOwnProperty.call(t,s))continue;try{r[s]=H.validateProp(s,t[s],n[s])}catch(t){if(!(t instanceof V))throw t;a=H.getOrInitEntityValidationError(e,a),a.details[s]=t.details[s]}}else r[s]=null;if(a)throw a;return r}static getOrInitEntityValidationError(e,t){return t||new V(`Could not validate entity ${e}.`)}static validateProp(e,t,s){if(s.anyOf)return H.validateAnyOf(e,t,s.anyOf),t;if(!0===s.nullable&&null===t)return t;if(H.validatePropType(e,t,s),s.enum)return H.validatePropEnum(e,t,s),t;switch(s.type){case"string":H.validatePropTypeString(e,t,s);break;case"integer":case"number":H.validatePropTypeNumber(e,t,s);break;case"array":H.validatePropTypeArray(e,t,s);break;case"object":case"boolean":case"blob":case"null":break;case"x-custom":H.validatePropCustom(e,t,s);break;default:throw new TypeError(`Could not validate property ${e}. Unsupported prop type ${s.type}`)}return t}static validatePropType(e,t,s){if(!H.isValidPropType(t,s.type))throw H.handlePropertyValidationError(e,"type",`The ${e} is not a valid ${s.type}.`)}static validatePropCustom(e,t,s){try{s.validationCallback(t)}catch(t){throw H.handlePropertyValidationError(e,"custom",`The ${e} is not valid: ${t.message}`)}}static validatePropTypeString(e,t,s){let i;if(s.format&&(H.isValidStringFormat(t,s.format)||(i=H.handlePropertyValidationError(e,"format",`The ${e} is not a valid ${s.format}.`,i))),s.length&&(H.isValidStringLength(t,s.length,s.length)||(i=H.handlePropertyValidationError(e,"length",`The ${e} should be ${s.length} character in length.`,i))),s.minLength&&(H.isValidStringLength(t,s.minLength)||(i=H.handlePropertyValidationError(e,"minLength",`The ${e} should be ${s.minLength} character in length minimum.`,i))),s.maxLength&&(H.isValidStringLength(t,0,s.maxLength)||(i=H.handlePropertyValidationError(e,"maxLength",`The ${e} should be ${s.maxLength} character in length maximum.`,i))),s.pattern&&(F().matches(t,s.pattern)||(i=H.handlePropertyValidationError(e,"pattern",`The ${e} is not valid.`,i))),s.custom&&(s.custom(t)||(i=H.handlePropertyValidationError(e,"custom",`The ${e} is not valid.`,i))),i)throw i}static handlePropertyValidationError(e,t,s,i=null){return(i=i||new V(`Could not validate property ${e}.`)).addError(e,t,s),i}static handleCollectionValidationError(e,t,s=null){return(s=s||new G("Could not validate collection.")).addCollectionValidationError(e,t),s}static validatePropTypeNumber(e,t,s){let i;if("number"==typeof s.minimum&&(H.isGreaterThanOrEqual(t,s.minimum)||(i=H.handlePropertyValidationError(e,"minimum",`The ${e} should be greater or equal to ${s.minimum}.`,i))),"number"==typeof s.maximum&&(H.isLesserThanOrEqual(t,s.maximum)||(i=H.handlePropertyValidationError(e,"maximum",`The ${e} should be lesser or equal to ${s.maximum}.`,i))),i)throw i}static validatePropTypeArray(e,t,s){let i;if(s?.items&&"object"==typeof s.items){for(let n=0;n<t.length;n++){const r=`${e}.${n}`;try{this.validateProp(r,t[n],s.items)}catch(t){if(!(t instanceof V))throw t;{i=H.getOrInitEntityValidationError(e,i);const s=t.details[r];i.details[e]={...i.details[e],[n]:s}}}}if(i)throw i}}static validatePropEnum(e,t,s){if(!H.isPropInEnum(t,s.enum)){const t=new V(`Could not validate property ${e}.`);throw t.addError(e,"enum",`The ${e} value is not included in the supported list.`),t}}static validateAnyOf(e,t,s){for(let i=0;i<s.length;i++)try{return void H.validateProp(e,t,s[i])}catch{}const i=new V(`Could not validate property ${e}.`);throw i.addError(e,"type",`The ${e} does not match any of the supported types.`),i}static isValidPropType(e,t){if(Array.isArray(t))throw new TypeError("EntitySchema isValidPropType multiple types are not supported.");if("string"!=typeof t)throw new TypeError("EntitySchema isValidPropType type is invalid.");switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"string":return"string"==typeof e;case"integer":return Number.isInteger(e);case"number":return"number"==typeof e;case"object":return"object"==typeof e;case"array":return Array.isArray(e);case"blob":return e instanceof Blob;case"x-custom":return!0;default:throw new TypeError("EntitySchema validation type not supported.")}}static isValidStringFormat(e,t){if("string"!=typeof t)throw new TypeError("EntitySchema validPropFormat format is invalid.");switch(t){case"uuid":return F().isUUID(e);case"email":case"idn-email":return F().isEmail(e);case"date-time":return F().isISO8601(e);case"x-hex-color":return F().isHexColor(e);case"x-base64":return F().isBase64(e);default:throw new TypeError(`EntitySchema string validation format ${t} is not supported.`)}}static isValidStringLength(e,t,s){return t=t||0,F().isLength(e,t,s)}static isPropInEnum(e,t){if(!t||!Array.isArray(t)||!t.length)throw new TypeError("EntitySchema enum schema cannot be empty.");return t.includes(e)}static isGreaterThanOrEqual(e,t){return e>=t}static isLessThanOrEqual(e,t){return e<=t}static isLesserThanOrEqual(e,t){return e<=t}}const K=H;class B{constructor(e,t={}){(t?.clone??!0)&&(e=JSON.parse(JSON.stringify(e))),this._props=e}toDto(){return JSON.parse(JSON.stringify(this))}toJSON(){return this._props}_hasProp(e){if(!e.includes(".")){const t=B._normalizePropName(e);return Object.prototype.hasOwnProperty.call(this._props,t)}try{return this._getPropByPath(e),!0}catch(t){return console.error(`Failed to check if property "${e}" is set:`,t),!1}}_getPropByPath(e){return B._normalizePropName(e).split(".").reduce((e,t)=>{if(Object.prototype.hasOwnProperty.call(e,t))return e[t];throw new Error},this._props)}static _normalizePropName(e){return e.replace(/([A-Z])/g,(e,t)=>`_${t.toLowerCase()}`).replace(/\._/,".").replace(/^_/,"").replace(/^\./,"")}}const j=B,W=e=>e?.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());class Y extends Error{constructor(e,t,s){if(super(s=s||"Entity collection error."),"number"!=typeof e)throw new TypeError("EntityCollectionError requires a valid position");if(!t||"string"!=typeof t)throw new TypeError("EntityCollectionError requires a valid rule");if(!s||"string"!=typeof s)throw new TypeError("EntityCollectionError requires a valid message");this.position=e,this.rule=t}}const z=Y;class Z{constructor(e=[],t={}){const s=t?.clone??!0;this._items=[],s&&(e=JSON.parse(JSON.stringify(e))),this._props=e}toDto(){return JSON.parse(JSON.stringify(this._items))}toJSON(){return this.toDto()}get items(){return this._items}get length(){return this._items.length}[Symbol.iterator](){let e=0;return{next:()=>e<this._items.length?{value:this._items[e++],done:!1}:{done:!0}}}getAll(e,t){if("string"!=typeof e)throw new TypeError("EntityCollection excludeAll expects propName to be string.");if("string"!=typeof t)throw new TypeError("EntityCollection excludeAll expects search to be string.");return this._items.filter(s=>Object.prototype.hasOwnProperty.call(s._props,e)&&s._props[e]===t)}getFirst(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("EntityCollection getFirst by expect propName and search to be strings");const s=this.getAll(e,t);if(s&&s.length)return s[0]}extract(e){if("string"!=typeof e)throw new TypeError("EntityCollection extract expects propName to be a string.");return this._items.reduce((t,s)=>(void 0!==s._props[e]&&t.push(s._props[e]),t),[])}push(e){return this._items.push(e),this._items.length}unshift(e){return this._items.unshift(e),this._items.length}filterByPropertyValueIn(e,t,s=!0){if("string"!=typeof e)throw new TypeError("EntityCollection filterByPropertyValueIn expects propName to be a string.");if(!Array.isArray(t))throw new TypeError("EntityCollection filterByPropertyValueIn expects needles to be an array.");this.filterByCallback(i=>{const n=Object.prototype.hasOwnProperty.call(i._props,e);return!(s&&!n||n&&!t.includes(i._props[e]))})}filterByCallback(e){if("function"!=typeof e)throw new TypeError("EntityCollection filterByCallback expects callback to be a function.");for(let t=this._items.length-1;t>=0;t--)e(this._items[t])||this._items.splice(t,1)}assertUniqueByProperty(e,t){const s=`unique_${e}`,i=this.extract(e),n=new Set;t=t||`The collection should only contain items with unique values for the property: ${e}.`,i.forEach((e,i)=>{if(n.add(e),i!==n.size-1)throw new z(i,s,t)})}assertNotExist(e,t,s={}){if(void 0===t)return;let i=s?.haystackSet;if(!i){const t=this.extract(e);i=new Set(t)}if(i.has(t)){const t=new V,i=s?.message||`The collection already includes an element that has a property (${e}) with an identical value.`;throw t.addError(e,"unique",i),t}}}const J=Z,X=["string","number","integer","boolean"];class Q extends j{static _cachedSchema={};constructor(e={},t={}){const s=t?.validate??!0;super(e,t),this.marshall(),s&&this.validateSchema({schema:t?.schema,skipSchemaAssociationValidation:t?.skipSchemaAssociationValidation}),this.createAssociations(t),s&&this.validateBuildRules(t?.validateBuildRules)}marshall(){}validate(e={}){try{this.validateSchema({schema:e?.schema,skipSchemaAssociationValidation:e?.skipSchemaAssociationValidation}),this.validateBuildRules(e?.validateBuildRules),this.validateAssociations(e)}catch(e){if(!(e instanceof V))throw e;return e}return null}validateSchema(e=null){let t=e?.schema??this.cachedSchema;if(e?.skipSchemaAssociationValidation){t={...t};const e=Object.keys(this.constructor.associations),s=t.required.filter(t=>!e.includes(t));t.required=s}this._props=K.validate(this.constructor.name,this._props,t)}get cachedSchema(){return this.constructor._cachedSchema[this.constructor.name]||(this.constructor._cachedSchema[this.constructor.name]=this.constructor.getSchema()),this.constructor._cachedSchema[this.constructor.name]}static getSchema(){throw new Error("The entity class should declare its schema.")}validateBuildRules(e={}){}createAssociations(e={}){if(Object.keys(this.constructor.associations).length>0){const t=new V;for(const[s,i]of Object.entries(this.constructor.associations))try{this._props[s]&&(this[`_${W(s)}`]=new i(this._props[s],{...e,clone:!1}),delete this._props[s])}catch(e){if(!(e instanceof V))throw e;t.addAssociationError(s,e)}if(t.hasErrors())throw t}}static get associations(){return{}}get(e){(0,L.A)(e);const t=this.constructor.getSchema().properties[e];if(!t)throw new Error(`The property "${e}" has no schema definition.`);if(!X.includes(t?.type))throw new Error('The property "associated_entity" should reference scalar properties only.');return this._props[e]}set(e,t,s={}){(0,L.A)(e);const i=s?.validate??!0;if(this.isAssociation(e))this.setAssociation(e,t,s);else{const n=e.split(".")[0],r=this.constructor.getSchema().properties[n];if(!r)throw new Error(`The property "${n}" has no schema definition.`);if("array"===r?.type)this.setArrayProp(e,t,s);else{if(r?.type&&!X.includes(r?.type))throw new Error('The property "associated_entity" should reference scalar properties only.');if(r?.anyOf?.some(e=>!X.includes(e.type)))throw new Error('The property "associated_entity" should reference scalar properties only.');i&&K.validateProp(n,t,r),this._props[n]=t}}}setArrayProp(e,t,s){(0,L.A)(e);const i=e.split("."),n=i[0];let r=null;const a=this.constructor.getSchema().properties[n],o=s?.validate??!0;if(2!==i.length)throw new Error(`The property "${i[0]}" has no index passed.`);{const e=i[1].match(/^(\d+)$/);if(!e)throw new Error(`The property "${i[0]}" has an invalid index format. Expected format: digits.`);r=parseInt(e[1],10)}if(!X.includes(a.items.type))throw new Error('The property "associated_entity" with array type should reference scalar properties only.');o&&K.validateProp(n,t,a.items),this._props[n]||(this._props[n]=[]),null!=t?this._props[n][r]=t:this._props[n].splice(r,1)}setCollection(e,t,s){(0,L.A)(e);const i=e.split("."),n=i[0];let r=null;if(1===i.length)t instanceof this.constructor.associations[e]?this[`_${n}`]=t:this[`_${n}`]=new this.constructor.associations[e](t,s);else{if(!(i.length>1))throw new Error(`The property "${i[0]}" has no index passed.`);{const e=i[1].match(/^(\d+)$/);if(!e)throw new Error(`The property "${i[0]}" has an invalid index format. Expected format: digits.`);r=parseInt(e[1],10)}}if(!this[`_${n}`])throw new Error(`The collection "${i[0]}" has no item".`);if(null!=t)if(i.length>2){if(!this[`_${n}`]._items[r])throw new Error(`The collection "${i[0]}" has no item at the index "${i[1]}".`);const e=i.slice(2).join(".");this[`_${n}`]._items[r].set(e,t,s)}else this[`_${n}`].push(t,s,s);else this[`_${n}`].items.splice(r,1)}setAssociation(e,t,s={}){if((0,L.A)(e),this.isAssociation(e)){const i=e.split("."),n=W(i[0]);if(i.length>1)if(this[`_${n}`]||(this[`_${n}`]=new this.constructor.associations[i[0]]({},{validate:!1})),this[`_${n}`]instanceof J){const e=i.toSpliced(0,1,n).join(".");this.setCollection(e,t,s)}else{const e=i.slice(1).join(".");this[`_${n}`].set(e,t,s)}else t instanceof this.constructor.associations[e]?this[`_${n}`]=t:this[`_${n}`]=new this.constructor.associations[e](t,s)}}validateAssociations(e={}){const t=new V;if(Object.keys(this.constructor.associations).length>0&&Object.keys(this.constructor.associations).forEach(s=>{const i=W(s);if(this[`_${i}`]){const n=this[i].validate(e);n&&t.addAssociationError(s,n)}}),t.hasErrors())throw t}diffProps(e){if(!(e instanceof Q))throw new TypeError('The property "compareEntity" should be of "EntityV2" type.');const t={},s=this.constructor.getSchema(),i=Object.keys(s.properties).filter(e=>X.includes(s.properties[e].type));for(const s of i){const i=this.get(s),n=e.get(s);i!==n&&(t[s]=n)}return t}hasDiffProps(e){const t=this.diffProps(e);return Object.keys(t).length>0}isAssociation(e){const t=e.split(".")[0];return Boolean(this.constructor.associations?.[t])}}const ee=Q,te=(e,t)=>t.split(".").reduce((e,t)=>e?.[t],e);s.dn(te);const se=(e,t)=>{if(void 0===e||"string"!=typeof e||!e.length)return!1;if((t=t||{}).whiteListedProtocols&&!Array.isArray(t.whiteListedProtocols))throw new TypeError("The whiteListedProtocols should be an array of string.");if(t.defaultProtocol&&"string"!=typeof t.defaultProtocol)throw new TypeError("The defaultProtocol should be a string.");const s=t.whiteListedProtocols||[ie.HTTP,ie.HTTPS],i=[ie.JAVASCRIPT],n=t.defaultProtocol||"";!/^(?:(?!:\/\/).)*:\/\//.test(e)&&n&&(e=`${n}//${e}`);try{const t=new URL(e);return!i.includes(t.protocol)&&!!s.includes(t.protocol)&&t.href}catch(e){return console.error("Failed to sanitize URL:",e),!1}};s.dn(se);const ie={FTP:"http:",FTPS:"https:",HTTP:"http:",HTTPS:"https:",JAVASCRIPT:"javascript:",SSH:"ssh:"},ne="enabled",re="disabled",ae="not found";class oe extends ee{static getSchema(){return{type:"object",required:[],properties:{status:{type:"string",enum:[ne,re,ae]},app:{type:"object"},passbolt:{type:"object"},serverTimeDiff:{type:"integer",nullable:!0}}}}marshall(){void 0===this._props.status&&(this._props.status=ne),oe.sanitizeEmailValidateRegex(this._props)}static sanitizeEmailValidateRegex(e){const t=e?.passbolt?.email?.validate?.regex;t&&"string"==typeof t&&t.trim().length&&(e.passbolt.email.validate.regex=t.trim().replace(/^\/+/,"").replace(/\/+$/,""))}static get disabledSiteSettings(){return{status:re}}toDto(){return{...this._props}}toJSON(){return this.toDto()}canIUse(e){const t=this._props?.passbolt?.plugins?.[e];return!(!t||"object"!=typeof t||void 0!==t.enabled&&!0!==t.enabled&&"true"!==t.enabled)}isPluginEnabled(e){return this.canIUse(e)}isFeatureBeta(e){return(0,L.A)(e),te(this._props,`passbolt.plugins.${e}.isInBeta`)||!1}getPluginSettings(e){return te(this._props,`passbolt.plugins.${e}`)}getRememberMeOptions(){return(this.getPluginSettings("rememberMe")||{}).options||{}}get hasRememberMeUntilILogoutOption(){return void 0!==(this.getRememberMeOptions()||{})[-1]}get generatorConfiguration(){return te(this._props,"passbolt.plugins.generator.configuration")}get locale(){return te(this._props,"app.locale")||oe.DEFAULT_LOCALE.locale}async setLocale(e){this._props.app||(this._props.app={}),this._props.app.locale=e}get supportedLocales(){return te(this._props,"passbolt.plugins.locale.options")||oe.DEFAULT_SUPPORTED_LOCALES}getServerTimezone(){return te(this._props,"passbolt.app.server_timezone")}get termsLink(){const e=te(this._props,"passbolt.legal.terms.url");return!!e&&se(e)}get privacyLink(){const e=te(this._props,"passbolt.legal.privacy_policy.url");return!!e&&se(e)}get registrationPublic(){return!0===te(this._props,"passbolt.registration.public")}get debug(){return!0===te(this._props,"app.debug")}get url(){return te(this._props,"app.url")||""}get version(){return te(this._props,"app.version.number")}get isCommunityEdition(){return"ce"===te(this._props,"passbolt.edition")}get emailValidateRegex(){return te(this._props,"passbolt.email.validate.regex")||null}isServerInPast(){return(this._props.serverTimeDiff||0)<0}get serverTime(){const e=this._props.serverTimeDiff||0;return(new Date).getTime()+e}static get ENTITY_NAME(){return"SiteSettings"}static get ORGANIZATION_ENABLED(){return ne}static get ORGANIZATION_DISABLED(){return re}static get ORGANIZATION_NOT_FOUND(){return ae}static get DEFAULT_LOCALE(){return{locale:"en-UK",label:"English"}}static get DEFAULT_SUPPORTED_LOCALES(){return[oe.DEFAULT_LOCALE]}}const le=oe;var ce=s(53050),de=s.n(ce);class pe{static validate(e){return"string"==typeof e&&de()("^[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[_\\p{L}0-9][-_\\p{L}0-9]*\\.)*(?:[\\p{L}0-9][-\\p{L}0-9]{0,62})\\.(?:(?:[a-z]{2}\\.)?[a-z]{2,})$","i").test(e)}}class he{constructor(e){if("string"!=typeof e)throw Error("The regex should be a string.");this.regex=new(de())(e)}validate(e){return"string"==typeof e&&this.regex.test(e)}}class ue{static validate(e,t){return ue.getValidator(t).validate(e)}static getValidator(e){return e&&e instanceof le&&e.emailValidateRegex?new he(e.emailValidateRegex):pe}}class me extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.createInputRefs(),this.bindEventHandlers()}get defaultState(){return{loading:!0,processing:!1,username:"",usernameError:null,agreedTerms:!1,agreedTermsError:null,hasAlreadyBeenValidated:!1}}componentDidMount(){null!==this.props.context.siteSettings&&this.setState({loading:!1},()=>{this.focusUsernameElement()})}async componentDidUpdate(){this.state.loading&&null!==this.props.context.siteSettings&&this.setState({loading:!1},()=>{this.focusUsernameElement()})}focusUsernameElement(){this.isFocusOnBrowserExtension()||this.usernameRef.current.focus()}isFocusOnBrowserExtension(){const e=document.activeElement;return!!e&&"iframe"===e.tagName.toLowerCase()}bindEventHandlers(){this.handleInputChange=this.handleInputChange.bind(this),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleUsernameInputOnKeyUp=this.handleUsernameInputOnKeyUp.bind(this)}createInputRefs(){this.usernameRef=i.createRef()}async handleInputChange(e){const t=e.target,s="checkbox"===t.type?t.checked:t.value,i=t.name;this.setState({[i]:s},async()=>{this.state.hasAlreadyBeenValidated&&this.validate()})}handleUsernameInputOnKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateUsernameInput();this.setState(e)}}async handleFormSubmit(e){if(e.preventDefault(),this.state.processing)return;this.setState({hasAlreadyBeenValidated:!0,processing:!0});const t=this.validate();this.hasValidationError(t)?this.setState({processing:!1}):this.props.apiTriageContext.onTriageRequested(this.state.username.trim())}validate(){const e=this.validateUsernameInput(),t=this.validateAgreedTerms();return this.setState({usernameError:e,agreedTermsError:t}),{usernameError:e,agreedTermsError:t}}validateUsernameInput(){let e=null;const t=this.state.username.trim();return t.length?ue.validate(t,this.props.context.siteSettings)||(e=this.translate("Please enter a valid email address.")):e=this.translate("A username is required."),this.setState({username:t}),e}validateAgreedTerms(){let e=!1;const t=this.privacyLink||this.termsLink,s=this.state.agreedTerms;return t&&!s&&(e=!0),e}hasValidationError(e){return null!==e.usernameError||e.agreedTermsError}hasAllInputDisabled(){return this.state.processing||this.state.loading}get privacyLink(){return!!this.props.context.siteSettings&&this.props.context.siteSettings.privacyLink}get termsLink(){return!!this.props.context.siteSettings&&this.props.context.siteSettings.termsLink}get translate(){return this.props.t}render(){return i.createElement("div",{className:"enter-username"},i.createElement("h1",null,i.createElement(_.x,null,"Please enter your email to continue.")),i.createElement("form",{acceptCharset:"utf-8",onSubmit:this.handleFormSubmit,noValidate:!0},i.createElement("div",{className:`input text required ${this.state.usernameError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"username"},i.createElement(_.x,null,"Email")),i.createElement("input",{id:"username-input",type:"text",ref:this.usernameRef,name:"username",value:this.state.username,onKeyUp:this.handleUsernameInputOnKeyUp,onChange:this.handleInputChange,placeholder:this.translate("you@organization.com"),required:"required",disabled:this.hasAllInputDisabled()}),this.state.usernameError&&i.createElement("div",{className:"error-message"},this.state.usernameError)),(this.privacyLink||this.termsLink)&&i.createElement("div",{className:"input checkbox "+(this.state.agreedTermsError?"error":"")},i.createElement("input",{type:"checkbox",name:"agreedTerms",value:this.state.agreedTerms,onChange:this.handleInputChange,id:"checkbox-terms",disabled:this.hasAllInputDisabled()}),i.createElement("label",{htmlFor:"checkbox-terms"},(this.privacyLink||this.termsLink)&&i.createElement("span",null,this.termsLink&&!this.privacyLink&&i.createElement(_.x,null,"I accept the"," ",i.createElement("a",{href:this.termsLink,target:"_blank",rel:"noopener noreferrer"},"terms")),!this.termsLink&&this.privacyLink&&i.createElement(_.x,null,"I accept the"," ",i.createElement("a",{href:this.privacyLink,target:"_blank",rel:"noopener noreferrer"},"privacy policy")),this.termsLink&&this.privacyLink&&i.createElement(_.x,null,"I accept the"," ",i.createElement("a",{href:this.termsLink,target:"_blank",rel:"noopener noreferrer"},"terms")," ","and the"," ",i.createElement("a",{href:this.privacyLink,target:"_blank",rel:"noopener noreferrer"},"privacy policy"))))),i.createElement("div",{className:"form-actions"},i.createElement(D,{disabled:this.hasAllInputDisabled(),big:!0,processing:this.state.processing,fullWidth:!0,value:this.translate("Next")}),this.props.isSsoRecoverEnabled&&i.createElement("button",{className:"link",type:"button",onClick:this.props.onSecondaryActionClick},i.createElement(_.x,null,"Continue with SSO.")))))}}me.defaultProps={isSsoRecoverEnabled:!1},me.propTypes={apiTriageContext:d().object,context:d().any,isSsoRecoverEnabled:d().bool.isRequired,onSecondaryActionClick:d().func,t:d().func};const ge=a(C((0,P.C)("common")(me)));class Ee extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.createInputRefs(),this.bindEventHandlers()}componentDidMount(){this.setState({loading:!1},()=>{this.firstnameRef.current.focus()})}get defaultState(){return{loading:!0,processing:!1,firstname:"",firstnameError:null,lastname:"",lastnameError:null,hasAlreadyBeenValidated:!1}}bindEventHandlers(){this.handleInputChange=this.handleInputChange.bind(this),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleFirstnameInputOnKeyUp=this.handleFirstnameInputOnKeyUp.bind(this),this.handleLastnameInputOnKeyUp=this.handleLastnameInputOnKeyUp.bind(this)}createInputRefs(){this.firstnameRef=i.createRef(),this.lastnameRef=i.createRef()}handleInputChange(e){const t=e.target,s=t.value,i=t.name;this.setState({[i]:s})}handleFirstnameInputOnKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateFirstnameInput();this.setState(e)}}handleLastnameInputOnKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateLastnameInput();this.setState(e)}}async handleFormSubmit(e){if(e.preventDefault(),this.state.processing)return;this.setState({hasAlreadyBeenValidated:!0,processing:!0});const t=this.validate();if(this.hasValidationError(t))return this.setState({processing:!1}),void this.focusFirstFieldError(t);await this.props.apiTriageContext.onRegistrationRequested(this.state.firstname,this.state.lastname)}validate(){const e=this.validateFirstnameInput(),t=this.validateLastnameInput();return this.setState({firstnameError:e,lastnameError:t}),{firstnameError:e,lastnameError:t}}validateFirstnameInput(){let e=null;return this.state.firstname.trim().length||(e=this.translate("A first name is required.")),e}validateLastnameInput(){let e=null;return this.state.lastname.trim().length||(e=this.translate("A last name is required.")),e}focusFirstFieldError(e){e.firstnameError?this.firstnameRef.current.focus():e.lastnameError&&this.lastnameRef.current.focus()}hasValidationError(e){return null!==e.firstnameError||null!==e.lastnameError}hasAllInputDisabled(){return this.state.processing||this.state.loading}get translate(){return this.props.t}render(){return i.createElement("div",{className:"enter-name"},i.createElement("h1",null,i.createElement(_.x,null,"New here? Enter your name to get started.")),i.createElement("form",{acceptCharset:"utf-8",onSubmit:this.handleFormSubmit,noValidate:!0},i.createElement("div",{className:`input text required ${this.state.firstnameError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"firstname"},i.createElement(_.x,null,"First name")),i.createElement("input",{id:"firstname-input",type:"text",name:"firstname",ref:this.firstnameRef,value:this.state.firstname,onKeyUp:this.handleFirstnameInputOnKeyUp,onChange:this.handleInputChange,disabled:this.hasAllInputDisabled(),placeholder:this.translate("First name"),required:"required"}),this.state.firstnameError&&i.createElement("div",{className:"error-message"},this.state.firstnameError)),i.createElement("div",{className:`input text required ${this.state.lastnameError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"lastname"},i.createElement(_.x,null,"Last name")),i.createElement("input",{id:"lastname-input",type:"text",name:"lastname",ref:this.lastnameRef,value:this.state.lastname,onKeyUp:this.handleLastnameInputOnKeyUp,onChange:this.handleInputChange,disabled:this.hasAllInputDisabled(),placeholder:this.translate("Last name"),required:"required"}),this.state.lastnameError&&i.createElement("div",{className:"error-message"},this.state.lastnameError)),i.createElement("div",{className:"form-actions"},i.createElement(D,{disabled:this.hasAllInputDisabled(),big:!0,fullWidth:!0,processing:this.state.processing,value:this.translate("Sign up")}),i.createElement("a",{href:`${this.props.context.trustedDomain}/auth/login?locale=${this.props.context.locale}`,rel:"noopener noreferrer"},i.createElement(_.x,null,"I already have an account")))))}}Ee.propTypes={apiTriageContext:d().object,context:d().any,t:d().func};const ye=a(C((0,P.C)("common")(Ee)));class fe extends i.Component{render(){return i.createElement("div",{className:"email-sent-instructions"},i.createElement("div",{className:"email-sent-bg"}),i.createElement("h1",null,i.createElement(_.x,null,"Check your mailbox!")),i.createElement("p",null,i.createElement(_.x,null,"We sent you a link to verify your email."),i.createElement("br",null),i.createElement(_.x,null,"Check your spam folder if you do not hear from us after a while.")))}}fe.propTypes={};const be=(0,P.C)("common")(fe);class Se extends i.Component{render(){return i.createElement("div",{className:"setup-error"},i.createElement("h1",null,i.createElement(_.x,null,"Access to this service requires an invitation.")),i.createElement("p",null,i.createElement(_.x,null,"This email is not associated with any approved users on this domain.")," ",i.createElement(_.x,null,"Please contact your administrator to request an invitation link.")),i.createElement("div",{className:"form-actions"},i.createElement("a",{href:`${this.props.context.trustedDomain}/users/recover`,className:"button primary big full-width",role:"button",rel:"noopener noreferrer"},i.createElement(_.x,null,"Try with another email"))))}}Se.propTypes={context:d().any};const Te=a((0,P.C)("common")(Se));var we;function ve(){return ve=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ve.apply(null,arguments)}const Ce=function(e){return i.createElement("svg",ve({xmlns:"http://www.w3.org/2000/svg",width:10,height:8,fill:"none",viewBox:"0 0 10 8"},e),we||(we=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m1 2 4 4 4-4"})))};var Ae;function Re(){return Re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},Re.apply(null,arguments)}const xe=function(e){return i.createElement("svg",Re({xmlns:"http://www.w3.org/2000/svg",width:8,height:10,fill:"none",viewBox:"0 0 8 10"},e),Ae||(Ae=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m2 9 4-4-4-4"})))};class _e{static reload(){window.location.reload()}static assign(e){window.location.assign(e)}static getHostname(){return window.location.hostname}}class Pe extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindCallbacks()}get defaultState(){return{showErrorDetails:!1}}bindCallbacks(){this.handleErrorDetailsToggle=this.handleErrorDetailsToggle.bind(this)}onClick(){this.props.context.port?this.props.context.port.request("passbolt.tab.reload"):_e.reload()}handleErrorDetailsToggle(){this.setState({showErrorDetails:!this.state.showErrorDetails})}get hasErrorDetails(){const e=this.props?.error;return Boolean(e?.details)||Boolean(e?.data?.body)}formatErrors(){const e=this.props.error?.details||this.props.error?.data;return JSON.stringify(e,null,4)}render(){return i.createElement("div",{className:"setup-error"},i.createElement("h1",null,this.props.title),i.createElement("p",null,this.props.message),i.createElement("p",null,this.props.error&&this.props.error.message),this.hasErrorDetails&&i.createElement("div",{className:"accordion error-details"},i.createElement("div",{className:"accordion-header"},i.createElement("button",{className:"no-border",type:"button",onClick:this.handleErrorDetailsToggle},this.state.showErrorDetails?i.createElement(Ce,{className:"caret-down"}):i.createElement(xe,{className:"caret-right"}),i.createElement("span",null,i.createElement(_.x,null,"Error details")))),this.state.showErrorDetails&&i.createElement("div",{className:"accordion-content"},i.createElement("div",{className:"input text"},i.createElement("label",{htmlFor:"js_field_debug",className:"visuallyhidden"},i.createElement(_.x,null,"Error details")),i.createElement("textarea",{id:"js_field_debug",defaultValue:`${this.formatErrors()}`,readOnly:!0})))),i.createElement("div",{className:"form-actions"},i.createElement("button",{onClick:this.onClick.bind(this),className:"button primary big full-width",role:"button"},i.createElement(_.x,null,"Try again"))))}}Pe.defaultProps={title:i.createElement(_.x,null,"Something went wrong!"),message:i.createElement(_.x,null,"The operation failed with the following error:")},Pe.propTypes={context:d().any,title:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),message:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),error:d().any};const Ie=a((0,P.C)("common")(Pe));Error;const Ne=/^[a-f0-9]{8}-[a-f0-9]{4}-[0-5][a-f0-9]{3}-[089ab][a-f0-9]{3}-[a-f0-9]{12}$/i,Oe=Ne.source.slice(1,-1),Ue=new RegExp(`(?:^|/)setup/(?:recover|start)/${Oe}/${Oe}/?$`,"i"),ke=class{constructor(e,t){t.setResourceName("/sso/recover/start"),this.apiClient=new f(t),this.expectedUrl=new URL(e)}async getRecoverUrl(e){const t={token:e,case:"default"},s=await this.apiClient.create(t),i=new URL(s.body.url);if(i.origin!==this.expectedUrl.origin)throw new Error("The url should be from the same origin.");if(!Ue.test(i.pathname))throw new Error("The url should point to a valid recover or start page.");return i}},De=/^https:\/\/.+[^/]$/;class Le extends j{constructor(e,t={}){super(K.validate(Le.ENTITY_NAME,e,Le.getSchema()),t)}static getSchema(){return{type:"object",required:["url","openid_configuration_path","scope","client_id","client_secret"],properties:{url:{type:"string",pattern:De},openid_configuration_path:{type:"string",minLength:1},scope:{type:"string",minLength:1},client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1}}}}static validateUrl(e){if("string"!=typeof e)throw new TypeError("The url should be a string.");let t;try{t=new URL(e)}catch(e){throw new Error("The url should be a valid url.",{cause:e})}if("https:"!==t.protocol)throw new Error("The url protocol should be HTTPS.")}static get ENTITY_NAME(){return"ADFSSsoSettings"}static get PROVIDER_ID(){return"adfs"}}const qe=Le,Ge=["https://login.microsoftonline.com","https://login.microsoftonline.us","https://login.partner.microsoftonline.cn"];class Me extends j{constructor(e,t={}){const s=Me.sanitizeDto(e);super(K.validate(Me.ENTITY_NAME,s,Me.getSchema()),t)}static getSchema(){return{type:"object",required:["url","client_id","tenant_id","client_secret","client_secret_expiry"],properties:{url:{type:"string",enum:Ge},client_id:{type:"string",format:"uuid"},tenant_id:{type:"string",format:"uuid"},client_secret:{type:"string",minLength:1},client_secret_expiry:{type:"string",format:"date-time"},email_claim:{type:"string",enum:["email","preferred_username","upn"]},prompt:{type:"string",enum:["login","none"]},login_hint:{type:"boolean"}}}}static sanitizeDto(e){return e=Object.assign({},e),e?.email_claim||(e.email_claim="email"),e?.prompt||(e.prompt="login"),void 0===e.login_hint&&(e.login_hint=!0),e}static get ENTITY_NAME(){return"AzureSsoSettings"}static get PROVIDER_ID(){return"azure"}static get SUPPORTED_URLS(){return Ge}}const Ve=Me,$e=["https://accounts.google.com"];class Fe extends j{constructor(e,t={}){super(K.validate(Fe.ENTITY_NAME,e,Fe.getSchema()),t)}static getSchema(){return{type:"object",required:["client_id","client_secret"],properties:{client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1}}}}static get ENTITY_NAME(){return"GoogleSsoSettings"}static get PROVIDER_ID(){return"google"}static get SUPPORTED_URLS(){return $e}}const He=Fe,Ke=["https://auth.pingone.com","https://auth.pingone.eu","https://auth.pingone.ca","https://auth.pingone.asia","https://auth.pingone.com.au","https://auth.pingone.sg"],Be=class extends ee{static getSchema(){return{type:"object",required:["url","environment_id","client_id","client_secret","email_claim"],properties:{url:{type:"string",enum:Ke},environment_id:{type:"string",minLength:1},client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1},email_claim:{type:"string",minLength:1}}}}static get ENTITY_NAME(){return"PingOneSsoSettings"}static get PROVIDER_ID(){return"pingone"}static get SUPPORTED_URLS(){return Ke}},je=/^https:\/\/.+[^/]$/;class We extends j{constructor(e,t={}){super(K.validate(We.ENTITY_NAME,e,We.getSchema()),t)}static getSchema(){return{type:"object",required:["url","openid_configuration_path","scope","client_id","client_secret"],properties:{url:{type:"string",pattern:je},openid_configuration_path:{type:"string",minLength:1},scope:{type:"string",minLength:1},client_id:{type:"string",minLength:1},client_secret:{type:"string",minLength:1}}}}static get ENTITY_NAME(){return"OAuth2SsoSettings"}static get PROVIDER_ID(){return"oauth2"}}const Ye=We,ze={[Ve.PROVIDER_ID]:Ve.SUPPORTED_URLS,[He.PROVIDER_ID]:He.SUPPORTED_URLS,[Be.PROVIDER_ID]:Be.SUPPORTED_URLS},Ze=[Ye.PROVIDER_ID,qe.PROVIDER_ID],Je=class{constructor(e){this.apiClientOptions=e}async getUrl(e){this.apiClientOptions.setResourceName(`/sso/recover/${e}`);const t=new f(this.apiClientOptions),s=await t.create(),i=new URL(s.body.url),n=ze[e];if(Ze.includes(e))return i;if(!n)throw new Error("The url should be part of the list of supported single sign-on urls.");if(!n.some(e=>e===i.origin))throw new Error("The url should be part of the list of supported single sign-on urls.");return i}},Xe="default",Qe="registration_required",et=class{constructor(e,t){this.popup=null,this.intervalCheck=null,this.expectedSuccessUrl=`${e}/sso/recover/${t}/success`,this.expectedErrorUrl=`${e}/sso/recover/error`,this.resolvePromise=null,this.rejectPromise=null,this.verifyPopup=this.verifyPopup.bind(this),this.handlePopupVerification=this.handlePopupVerification.bind(this),this.processSuccessUrl=this.processSuccessUrl.bind(this),this.processErrorUrl=this.processErrorUrl.bind(this)}getSsoTokenFromThirdParty(e){return this.popup=window.open(void 0,"__blank","popup,width=380,height=600"),this.popup.opener=null,this.popup.location.href=e.toString(),new Promise(this.handlePopupVerification)}handlePopupVerification(e,t){this.resolvePromise=e,this.rejectPromise=t,this.intervalCheck=setInterval(this.verifyPopup,200)}verifyPopup(){if(!this.popup||this.popup?.closed)return this.rejectPromise(new Error("The user navigated away from the tab where the SSO sign-in initiated")),void this.close();let e=null;try{e=this.popup.location.href}catch(e){return void console.error(e)}e.startsWith(this.expectedSuccessUrl)?this.processSuccessUrl(e):e.startsWith(this.expectedErrorUrl)&&this.processErrorUrl(e)}processSuccessUrl(e){const t=new URL(e).searchParams.get("token");var s;s=t,new(de())(Ne).test(s)&&(this.resolvePromise({case:Xe,token:t}),this.close())}processErrorUrl(e){const t=new URL(e).searchParams.get("email");var s;s=t,new(de())("^[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\p{L}0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[_\\p{L}0-9][-_\\p{L}0-9]*\\.)*(?:[\\p{L}0-9][-\\p{L}0-9]{0,62})\\.(?:(?:[a-z]{2}\\.)?[a-z]{2,})$").test(s)&&(this.resolvePromise({case:Qe,email:t}),this.close())}close(){this.rejectPromise=null,this.resolvePromise=null,this.popup?.close(),this.popup=null,clearInterval(this.intervalCheck)}},tt=class{constructor(e,t,s,i){this.providerId=e,this.apiClientOptions=t.getApiClientOptions();const n=t.trustedDomain.replace(/\/$/,"");this.getUrlForSsoIdentificationService=new Je(t.getApiClientOptions()),this.getRecoverUrlService=new ke(n,t.getApiClientOptions()),this.ssoPopupHandler=new et(n,e),this.successCallback=s,this.registrationRequiredCallback=i}async exec(){const e=await this.getUrlForSsoIdentificationService.getUrl(this.providerId),t=await this.ssoPopupHandler.getSsoTokenFromThirdParty(e);if(t.case===Xe){const e=await this.getRecoverUrlService.getRecoverUrl(t.token);this.successCallback(e.toString())}else t.case===Qe&&this.registrationRequiredCallback(t.email)}stopProcess(){this.ssoPopupHandler.close()}};class st extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindEventHandlers(),this.identifyViaSsoService=new tt(this.props.ssoProvider.id,this.props.context,this.handleSsoAuthSuccess,this.handleSsoAuthSuccessForRegistration)}get defaultState(){return{processing:!1}}componentDidMount(){window.addEventListener("beforeunload",this.handleBeforeUnload)}componentWillUnmount(){this.handleBeforeUnload()}handleBeforeUnload(){this.identifyViaSsoService.stopProcess(),window.removeEventListener("beforeunload",this.handleBeforeUnload)}bindEventHandlers(){this.handleBeforeUnload=this.handleBeforeUnload.bind(this),this.handleSsoRecoverClick=this.handleSsoRecoverClick.bind(this),this.handleGoToEmailClick=this.handleGoToEmailClick.bind(this),this.handleSsoAuthSuccess=this.handleSsoAuthSuccess.bind(this),this.handleSsoAuthSuccessForRegistration=this.handleSsoAuthSuccessForRegistration.bind(this)}async handleSsoRecoverClick(){if(!this.state.processing){this.setState({processing:!0});try{await this.identifyViaSsoService.exec()}catch(e){console.error('Failed to identify via sso":',e)}finally{this.setState({processing:!1})}}}handleSsoAuthSuccess(e){const t=se(e);if(!t)throw new Error("The redirection URL is invalid. It must use a valid http or https protocol.");const s=new URL(window.location.href),i=new URL(t);if(s.origin!==i.origin)throw new Error("The redirection URL is invalid. It must happen within the same origin as the current window");window.location.href=i.toString()}handleSsoAuthSuccessForRegistration(e){this.props.onUserRegistrationRequired(e)}handleGoToEmailClick(){this.identifyViaSsoService.stopProcess(),this.props.onSecondaryActionClick()}isProcessing(){return this.state.processing}render(){const e=this.props.ssoProvider;if(!e)return null;const t=this.isProcessing(),s=t?"disabled":"";return i.createElement("div",{className:"enter-username"},i.createElement("h1",null,i.createElement(_.x,null,"Welcome back!")),i.createElement("p",null,i.createElement(_.x,null,"Your browser is not configured to work with this passbolt instance.")," ",i.createElement(_.x,null,"Please authenticate with the Single Sign-On provider to continue.")),i.createElement("div",{className:"sso-login-form form-actions"},i.createElement("button",{type:"button",className:`sso-login-button ${s} ${e.id}`,onClick:this.handleSsoRecoverClick,disabled:t},i.createElement("span",{className:"provider-logo"},e.icon),this.props.t("Sign in with {{providerName}}",{providerName:e.name})),i.createElement("button",{type:"button",className:"link",onClick:this.handleGoToEmailClick},i.createElement(_.x,null,"Continue with my email."))))}}st.propTypes={ssoProvider:d().object,onSecondaryActionClick:d().func,onUserRegistrationRequired:d().func,context:d().any,t:d().func};const it=a((0,P.C)("common")(st));class nt extends i.Component{componentDidMount(){this.initializeTriage(),this.getSsoProviderData=this.getSsoProviderData.bind(this)}initializeTriage(){setTimeout(this.props.apiTriageContext.onInitializeTriageRequested,1e3)}getSsoProviderData(){const e=this.props.apiTriageContext.getSsoProviderId();return S.find(t=>t.id===e)}render(){switch(this.props.apiTriageContext.state){case A.USERNAME_STATE:return i.createElement(ge,{isSsoRecoverEnabled:this.props.apiTriageContext.isSsoRecoverEnabled,onSecondaryActionClick:this.props.apiTriageContext.handleSwitchToSsoSignInState});case A.SSO_SIGN_IN_STATE:return i.createElement(it,{ssoProvider:this.getSsoProviderData(),onSecondaryActionClick:this.props.apiTriageContext.handleSwitchToUsernameState,onUserRegistrationRequired:this.props.apiTriageContext.handleSwitchToEnterNameState});case A.CHECK_MAILBOX_STATE:return i.createElement(be,null);case A.NAME_STATE:return i.createElement(ye,null);case A.USERNAME_NOT_FOUND_ERROR:return i.createElement(Te,null);case A.UNEXPECTED_ERROR_STATE:return i.createElement(Ie,{error:this.props.apiTriageContext.unexpectedError});default:return i.createElement(U,null)}}}nt.propTypes={apiTriageContext:d().object};const rt=C(nt);var at;function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ot.apply(null,arguments)}const lt=function(e){return i.createElement("svg",ot({xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),at||(at=i.createElement("g",{clipPath:"url(#heart_svg__clip0_93_734678)"},i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M13.497 9.333c.993-.973 2-2.14 2-3.666A3.667 3.667 0 0 0 11.83 2c-1.173 0-2 .333-3 1.333-1-1-1.827-1.333-3-1.333a3.667 3.667 0 0 0-3.667 3.667c0 1.533 1 2.7 2 3.666L8.83 14z"}))))};class ct extends i.Component{render(){return i.createElement("div",{className:"tooltip",tabIndex:"0"},this.props.children,i.createElement("span",{className:`tooltip-text ${this.props.direction}`},this.props.message))}}ct.defaultProps={direction:"right"},ct.propTypes={children:d().any,message:d().any.isRequired,direction:d().string};const dt=ct;var pt=s(28097),ht=s(44296);const ut=i.createContext({dialogs:[],open:()=>{},close:()=>{}});class mt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{dialogs:[],open:(e,t)=>{const s=(0,ht.A)();return this.setState(i=>({dialogs:[...i.dialogs,{key:s,Dialog:e,DialogProps:t}]})),s},close:e=>{this.setState(t=>({dialogs:t.dialogs.filter(t=>e!==t.key)}))},closeAll:()=>this.setState({dialogs:[]})}}render(){return i.createElement(ut.Provider,{value:this.state},this.props.children)}}function gt(e){return class extends i.Component{render(){return i.createElement(ut.Consumer,null,t=>i.createElement(e,{dialogContext:t,...this.props}))}}}mt.displayName="DialogContextProvider",mt.propTypes={children:d().any};var Et=s(75410);const yt=["/app/administration","/app/administration/mfa","/app/administration/mfa-policy","/app/administration/password-policies","/app/administration/secret-history","/app/administration/self-registration","/app/administration/users-directory","/app/administration/healthcheck","/app/administration/email-notification","/app/administration/smtp-settings","/app/administration/subscription","/app/administration/ce-downgrade","/app/administration/internationalization","/app/administration/account-recovery","/app/administration/sso","/app/administration/rbacs","/app/administration/content-types/metadata-getting-started","/app/administration/user-provisionning/scim","/app/administration/user-passphrase-policies","/app/administration/password-expiry","/app/administration/content-types/metadata","/app/administration/content-types/metadata-key","/app/administration/migrate-metadata","/app/administration/allow-content-types","/app/administration/subscription-teasing","/app/administration/password-policies-teasing","/app/administration/user-passphrase-policies-teasing","/app/administration/account-recovery-teasing","/app/administration/sso-teasing","/app/administration/mfa-policy-teasing","/app/administration/users-directory-teasing","/app/administration/scim-teasing","/app/administration/offline","/app/passwords","/app/users","/app/settings/profile","/app/settings/passphrase","/app/settings/security-token","/app/settings/theme","/app/settings/mfa","/app/settings/keys","/app/settings/mobile","/app/settings/desktop","/app/settings/account-recovery"],ft=i.createContext({onGoToAdministrationRequested:()=>{},onGoToAdministrationSelfRegistrationRequested:()=>{},onGoToAdministrationMfaRequested:()=>{},onGoToAdministrationUsersDirectoryRequested:()=>{},onGoToAdministrationEmailNotificationsRequested:()=>{},onGoToAdministrationSubscriptionRequested:()=>{},onGoToAdministrationDowngradeToCeRequested:()=>{},onGoToAdministrationInternationalizationRequested:()=>{},onGoToAdministrationAccountRecoveryRequested:()=>{},onGoToAdministrationSmtpSettingsRequested:()=>{},onGoToAdministrationSsoRequested:()=>{},onGoToAdministrationPasswordPoliciesRequested:()=>{},onGoToAdministrationSecretHistoryRequested:()=>{},onGoToAdministrationUserPassphrasePoliciesRequested:()=>{},onGoToAdministrationPasswordExpirySettingsRequested:()=>{},onGoToAdministrationHealthcheckRequested:()=>{},onGoToPasswordsRequested:()=>{},onGoToUsersRequested:()=>{},onGoToTermsRequested:()=>{},onGoToHelpRequested:()=>{},onGoToUserSettingsProfileRequested:()=>{},onGoToUserSettingsPassphraseRequested:()=>{},onGoToUserSettingsSecurityTokenRequested:()=>{},onGoToUserSettingsThemeRequested:()=>{},onGoToUserSettingsMfaRequested:()=>{},onGoToUserSettingsKeysRequested:()=>{},onGoToUserSettingsMobileRequested:()=>{},onGoToUserSettingsDesktopRequested:()=>{},onGoToUserSettingsAccountRecoveryRequested:()=>{},onGoToSubscriptionUpdateQuantityRequested:()=>{},onGoToSubscriptionRenewRequested:()=>{},onGoToAdministrationRbacsRequested:()=>{},onGoToAdministrationMigrateMetadataRequested:()=>{},onGoToAdministrationAllowContentTypesRequested:()=>{},onGoToAdministrationMetadataGettingStartedRequested:()=>{},onGoToAdministrationSubscriptionRequestedTeasing:()=>{},onGoToAdministrationPasswordPoliciesRequestedTeasing:()=>{},onGoToAdministrationUserPassphrasePoliciesRequestedTeasing:()=>{},onGoToAdministrationAccountRecoveryRequestedTeasing:()=>{},onGoToAdministrationSsoRequestedTeasing:()=>{},onGoToAdministrationMfaPolicyRequestedTeasing:()=>{},onGoToAdministrationUsersDirectoryRequestedTeasing:()=>{},onGoToAdministrationScimRequestedTeasing:()=>{},onGoToAdministrationScimRequested:()=>{},onGoToAdministrationOfflineRequested:()=>{}});class bt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{onGoToAdministrationRequested:this.onGoToAdministrationRequested.bind(this),onGoToAdministrationMfaRequested:this.onGoToAdministrationMfaRequested.bind(this),onGoToAdministrationUsersDirectoryRequested:this.onGoToAdministrationUsersDirectoryRequested.bind(this),onGoToAdministrationEmailNotificationsRequested:this.onGoToAdministrationEmailNotificationsRequested.bind(this),onGoToAdministrationSubscriptionRequested:this.onGoToAdministrationSubscriptionRequested.bind(this),onGoToAdministrationDowngradeToCeRequested:this.onGoToAdministrationDowngradeToCeRequested.bind(this),onGoToAdministrationInternationalizationRequested:this.onGoToAdministrationInternationalizationRequested.bind(this),onGoToAdministrationAccountRecoveryRequested:this.onGoToAdministrationAccountRecoveryRequested.bind(this),onGoToAdministrationSmtpSettingsRequested:this.onGoToAdministrationSmtpSettingsRequested.bind(this),onGoToAdministrationSelfRegistrationRequested:this.onGoToAdministrationSelfRegistrationRequested.bind(this),onGoToAdministrationSsoRequested:this.onGoToAdministrationSsoRequested.bind(this),onGoToAdministrationMfaPolicyRequested:this.onGoToAdministrationMfaPolicyRequested.bind(this),onGoToAdministrationPasswordPoliciesRequested:this.onGoToAdministrationPasswordPoliciesRequested.bind(this),onGoToAdministrationSecretHistoryRequested:this.onGoToAdministrationSecretHistoryRequested.bind(this),onGoToAdministrationUserPassphrasePoliciesRequested:this.onGoToAdministrationUserPassphrasePoliciesRequested.bind(this),onGoToAdministrationPasswordExpirySettingsRequested:this.onGoToAdministrationPasswordExpirySettingsRequested.bind(this),onGoToAdministrationHealthcheckRequested:this.onGoToAdministrationHealthcheckRequested.bind(this),onGoToAdministrationContentTypesEncryptedMetadataRequested:this.onGoToAdministrationContentTypesEncryptedMetadataRequested.bind(this),onGoToAdministrationContentTypesMetadataKeyRequested:this.onGoToAdministrationContentTypesMetadataKeyRequested.bind(this),onGoToAdministrationMigrateMetadataRequested:this.onGoToAdministrationMigrateMetadataRequested.bind(this),onGoToAdministrationAllowContentTypesRequested:this.onGoToAdministrationAllowContentTypesRequested.bind(this),onGoToPasswordsRequested:this.onGoToPasswordsRequested.bind(this),onGoToUsersRequested:this.onGoToUsersRequested.bind(this),onGoToHelpRequested:this.onGoToHelpRequested.bind(this),onGoToTermsRequested:this.onGoToTermsRequested.bind(this),onGoToUserSettingsProfileRequested:this.onGoToUserSettingsProfileRequested.bind(this),onGoToUserSettingsPassphraseRequested:this.onGoToUserSettingsPassphraseRequested.bind(this),onGoToUserSettingsSecurityTokenRequested:this.onGoToUserSettingsSecurityTokenRequested.bind(this),onGoToUserSettingsThemeRequested:this.onGoToUserSettingsThemeRequested.bind(this),onGoToUserSettingsMfaRequested:this.onGoToUserSettingsMfaRequested.bind(this),onGoToUserSettingsKeysRequested:this.onGoToUserSettingsKeysRequested.bind(this),onGoToUserSettingsMobileRequested:this.onGoToUserSettingsMobileRequested.bind(this),onGoToUserSettingsDesktopRequested:this.onGoToUserSettingsDesktopRequested.bind(this),onGoToUserSettingsAccountRecoveryRequested:this.onGoToUserSettingsAccountRecoveryRequested.bind(this),onGoToSubscriptionUpdateQuantityRequested:this.onGoToSubscriptionUpdateQuantityRequested.bind(this),onGoToSubscriptionRenewRequested:this.onGoToSubscriptionRenewRequested.bind(this),onGoToAdministrationRbacsRequested:this.onGoToAdministrationRbacsRequested.bind(this),onGoToAdministrationMetadataGettingStartedRequested:this.onGoToAdministrationMetadataGettingStartedRequested.bind(this),onGoToAdministrationSubscriptionRequestedTeasing:this.onGoToAdministrationSubscriptionRequestedTeasing.bind(this),onGoToAdministrationPasswordPoliciesRequestedTeasing:this.onGoToAdministrationPasswordPoliciesRequestedTeasing.bind(this),onGoToAdministrationUserPassphrasePoliciesRequestedTeasing:this.onGoToAdministrationUserPassphrasePoliciesRequestedTeasing.bind(this),onGoToAdministrationAccountRecoveryRequestedTeasing:this.onGoToAdministrationAccountRecoveryRequestedTeasing.bind(this),onGoToAdministrationSsoRequestedTeasing:this.onGoToAdministrationSsoRequestedTeasing.bind(this),onGoToAdministrationMfaPolicyRequestedTeasing:this.onGoToAdministrationMfaPolicyRequestedTeasing.bind(this),onGoToAdministrationUsersDirectoryRequestedTeasing:this.onGoToAdministrationUsersDirectoryRequestedTeasing.bind(this),onGoToAdministrationScimRequestedTeasing:this.onGoToAdministrationScimRequestedTeasing.bind(this),onGoToAdministrationScimRequested:this.onGoToAdministrationScimRequested.bind(this),onGoToAdministrationOfflineRequested:this.onGoToAdministrationOfflineRequested.bind(this)}}async goTo(e,t){if(!yt.includes(t))throw new Error("The pathname is not part of the allowed list of pathnames.");if(e===this.props.context.name)return void await this.props.history.push({pathname:t});if("api"===e)return void await this.props.context.port.request("passbolt.tabs.open-admin-page",t);const s=`${this.props.context.userSettings?this.props.context.userSettings.getTrustedDomain():this.props.context.trustedDomain}${t}`;window.open(s,"_parent","noopener,noreferrer")}async onGoToAdministrationRequested(){await this.goTo("browser-extension","/app/administration")}async onGoToAdministrationMfaRequested(){await this.goTo("api","/app/administration/mfa")}async onGoToAdministrationMfaPolicyRequested(){await this.goTo("api","/app/administration/mfa-policy")}async onGoToAdministrationPasswordPoliciesRequested(){await this.goTo("browser-extension","/app/administration/password-policies")}async onGoToAdministrationSecretHistoryRequested(){await this.goTo("browser-extension","/app/administration/secret-history")}async onGoToAdministrationOfflineRequested(){await this.goTo("browser-extension","/app/administration/offline")}async onGoToAdministrationSelfRegistrationRequested(){await this.goTo("api","/app/administration/self-registration")}async onGoToAdministrationUsersDirectoryRequested(){await this.goTo("api","/app/administration/users-directory")}async onGoToAdministrationHealthcheckRequested(){await this.goTo("api","/app/administration/healthcheck")}async onGoToAdministrationEmailNotificationsRequested(){await this.goTo("api","/app/administration/email-notification")}async onGoToAdministrationSmtpSettingsRequested(){await this.goTo("api","/app/administration/smtp-settings")}async onGoToAdministrationSubscriptionRequested(){await this.goTo("browser-extension","/app/administration/subscription")}async onGoToAdministrationDowngradeToCeRequested(){await this.goTo("browser-extension","/app/administration/ce-downgrade")}async onGoToAdministrationInternationalizationRequested(){await this.goTo("api","/app/administration/internationalization")}async onGoToAdministrationAccountRecoveryRequested(){await this.goTo("browser-extension","/app/administration/account-recovery")}async onGoToAdministrationSsoRequested(){await this.goTo("browser-extension","/app/administration/sso")}async onGoToAdministrationRbacsRequested(){await this.goTo("api","/app/administration/rbacs")}async onGoToAdministrationMetadataGettingStartedRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata-getting-started")}async onGoToAdministrationScimRequested(){await this.goTo("browser-extension","/app/administration/user-provisionning/scim")}async onGoToAdministrationUserPassphrasePoliciesRequested(){await this.goTo("browser-extension","/app/administration/user-passphrase-policies")}async onGoToAdministrationPasswordExpirySettingsRequested(){await this.goTo("browser-extension","/app/administration/password-expiry")}async onGoToAdministrationContentTypesEncryptedMetadataRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata")}async onGoToAdministrationContentTypesMetadataKeyRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata-key")}async onGoToAdministrationMigrateMetadataRequested(){await this.goTo("browser-extension","/app/administration/migrate-metadata")}async onGoToAdministrationAllowContentTypesRequested(){await this.goTo("browser-extension","/app/administration/allow-content-types")}async onGoToAdministrationSubscriptionRequestedTeasing(){await this.goTo("browser-extension","/app/administration/subscription-teasing")}async onGoToAdministrationPasswordPoliciesRequestedTeasing(){await this.goTo("browser-extension","/app/administration/password-policies-teasing")}async onGoToAdministrationUserPassphrasePoliciesRequestedTeasing(){await this.goTo("browser-extension","/app/administration/user-passphrase-policies-teasing")}async onGoToAdministrationAccountRecoveryRequestedTeasing(){await this.goTo("browser-extension","/app/administration/account-recovery-teasing")}async onGoToAdministrationSsoRequestedTeasing(){await this.goTo("browser-extension","/app/administration/sso-teasing")}async onGoToAdministrationMfaPolicyRequestedTeasing(){await this.goTo("browser-extension","/app/administration/mfa-policy-teasing")}async onGoToAdministrationUsersDirectoryRequestedTeasing(){await this.goTo("browser-extension","/app/administration/users-directory-teasing")}async onGoToAdministrationScimRequestedTeasing(){await this.goTo("browser-extension","/app/administration/scim-teasing")}get isMfaEnabled(){const e=this.props.context.siteSettings;return e&&e.canIUse("multiFactorAuthentication")}get isUserDirectoryEnabled(){const e=this.props.context.siteSettings;return e&&e.canIUse("directorySync")}get isSmtpSettingsEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("smtpSettings")}get isSelfRegistrationEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("selfRegistration")}get isPasswordPoliciesEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("passwordPoliciesUpdate")}get isUserPassphrasePoliciesEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("userPassphrasePolicies")}get isPasswordExpiryEnable(){const e=this.props.context.siteSettings;return e&&e.canIUse("passwordExpiry")}async onGoToPasswordsRequested(){await this.goTo("browser-extension","/app/passwords")}async onGoToUsersRequested(){await this.goTo("browser-extension","/app/users")}async onGoToHelpRequested(){window.open("https://www.passbolt.com/docs/","_blank","noopener,noreferrer")}async onGoToTermsRequested(){window.open("https://www.passbolt.com/terms","_blank","noopener,noreferrer")}async onGoToSubscriptionUpdateQuantityRequested(e,t){const s=`https://www.passbolt.com/subscription/ee/update/qty?subscription_id=${encodeURIComponent(e)}&customer_id=${encodeURIComponent(t)}`;window.open(s,"_blank","noopener,noreferrer")}async onGoToSubscriptionRenewRequested(e,t){const s=`https://www.passbolt.com/subscription/ee/update/renew?subscription_id=${encodeURIComponent(e)}&customer_id=${encodeURIComponent(t)}`;window.open(s,"_blank","noopener,noreferrer")}async onGoToUserSettingsProfileRequested(){await this.goTo("browser-extension","/app/settings/profile")}async onGoToUserSettingsPassphraseRequested(){await this.goTo("browser-extension","/app/settings/passphrase")}async onGoToUserSettingsSecurityTokenRequested(){await this.goTo("browser-extension","/app/settings/security-token")}async onGoToUserSettingsThemeRequested(){await this.goTo("browser-extension","/app/settings/theme")}async onGoToUserSettingsMfaRequested(){await this.goTo("browser-extension","/app/settings/mfa")}async onGoToUserSettingsKeysRequested(){await this.goTo("browser-extension","/app/settings/keys")}async onGoToUserSettingsMobileRequested(){await this.goTo("browser-extension","/app/settings/mobile")}async onGoToUserSettingsDesktopRequested(){await this.goTo("browser-extension","/app/settings/desktop")}async onGoToUserSettingsAccountRecoveryRequested(){await this.goTo("browser-extension","/app/settings/account-recovery")}render(){return i.createElement(ft.Provider,{value:this.state},this.props.children)}}bt.displayName="NavigationContextProvider",bt.propTypes={context:d().object,children:d().any,location:d().object,match:d().object,history:d().object},(0,Et.withRouter)(a(bt));const St=i.createContext({counter:[],add:()=>{},remove:()=>{}});class Tt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{counter:0,add:()=>{this.setState(e=>({counter:e.counter+1}))},remove:()=>{this.setState(e=>({counter:Math.min(e.counter-1,0)}))}}}render(){return i.createElement(St.Provider,{value:this.state},this.props.children)}}Tt.propTypes={children:d().any};class wt{}class vt extends wt{static execute(){return!0}}class Ct extends wt{static execute(){return!1}}const At="Folders.use",Rt="Administration.viewWorkspace",xt="GroupsAdd.addPost",_t="AccountRecoveryRequestsView.view",Pt="AccountRecoveryRequestsIndex.index",It="AccountRecoveryResponsesCreate.post",Nt="Allow",Ot="Deny",Ut="AllowIfGroupManagerInOneGroup",kt={[Nt]:vt,[Ot]:Ct,[Ut]:class extends wt{static execute(e){return e.groups_users.some(e=>e.is_admin)}}},Dt={[At]:kt[Nt]},Lt={[Rt]:kt[Ot],[xt]:kt[Ot],[_t]:kt[Ot],[Pt]:kt[Ot],[It]:kt[Ot]};class qt{static getByRbac(e){return kt[e.controlFunction]||(console.warn(`Could not find control function for the given rbac entity (${e.id})`),Ct)}static getDefaultForAdminAndAction(e){return Dt[e]||vt}static getDefaultForUserAndAction(e){return Lt[e]||vt}}class Gt extends ee{static getSchema(){return{type:"object",required:["name"],properties:{id:{type:"string",format:"uuid"},name:{type:"string",minLength:1,maxLength:50},description:{type:"string",maxLength:255,nullable:!0},created:{type:"string",format:"date-time"},modified:{type:"string",format:"date-time"}}}}validateBuildRules(){this.assertNoTrailingSpaces("name",this._props.name)}get id(){return this._props.id||null}get name(){return this._props.name}isAdmin(){return this.name.toLowerCase()===Gt.ROLE_ADMIN}isUser(){return this.name.toLowerCase()===Gt.ROLE_USER}isGuest(){return this.name.toLowerCase()===Gt.ROLE_GUEST}isAReservedRole(){return this.isAdmin()||this.isUser()||this.isGuest()}verifyHealth(){let e=null;return 50===this.name.length&&(e=new V,e.addError("name","maxLength","name reached maximum length limit")),e}assertNoTrailingSpaces(e,t){if(t.trim()!==t){const t=new V;throw t.addError(e,"trailing-spaces",`The property (${e}) contains forbidden trailing spaces.`),t}}static get ENTITY_NAME(){return"Role"}static get ROLE_ADMIN(){return"admin"}static get ROLE_USER(){return"user"}static get ROLE_GUEST(){return"guest"}static get ROLE_NAME_MAX_LENGTH(){return 50}toUpdateDto(){return{name:this.name}}}class Mt{static canRoleUseAction(e,t,s){if("undefined"!=typeof window&&window.chrome?.webview){const i=t.findRbacByActionName(s);if(i)return qt.getByRbac(i).execute(e)}const i=new Gt(e.role);if(i.isAdmin())return qt.getDefaultForAdminAndAction(s).execute();const n=t.findRbacByRoleAndActionName(i,s);return this.getByRbacOrDefault(n,s,e)}static getByRbacOrDefault(e,t,s){return e?qt.getByRbac(e).execute(s):qt.getDefaultForUserAndAction(t).execute()}}const Vt=i.createContext({canIUseAction:()=>{}});class $t extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{canIUseAction:this.canIUseAction.bind(this)}}canIUseAction(e){return Mt.canRoleUseAction(this.props.context.loggedInUser,this.props.context.rbacs,e)}render(){return i.createElement(Vt.Provider,{value:this.state},this.props.children)}}$t.propTypes={context:d().any,children:d().any},a($t);const Ft=i.createContext({selectedAdministration:null,can:{save:!1},must:{save:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1},administrationWorkspaceAction:null,setDisplayAdministrationWorkspaceAction:()=>{},resetDisplayAdministrationWorkspaceAction:()=>{},onUpdateSubscriptionKeyRequested:()=>{},onSaveEnabled:()=>{},onMustSaveSettings:()=>{},onMustEditSubscriptionKey:()=>{},onMustRefreshSubscriptionKey:()=>{},onResetActionsSettings:()=>{}});class Ht extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{selectedAdministration:jt.NONE,can:{save:!1},must:{save:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1},administrationWorkspaceAction:()=>i.createElement(i.Fragment,null),setDisplayAdministrationWorkspaceAction:this.setDisplayAdministrationWorkspaceAction.bind(this),resetDisplayAdministrationWorkspaceAction:this.resetDisplayAdministrationWorkspaceAction.bind(this),onSaveEnabled:this.handleSaveEnabled.bind(this),onMustSaveSettings:this.handleMustSaveSettings.bind(this),onMustEditSubscriptionKey:this.handleMustEditSubscriptionKey.bind(this),onMustRefreshSubscriptionKey:this.handleMustRefreshSubscriptionKey.bind(this),onResetActionsSettings:this.handleResetActionsSettings.bind(this)}}componentDidMount(){this.handleAdministrationMenuRouteChange()}componentDidUpdate(e){this.handleRouteChange(e.location)}handleSaveEnabled(){this.setState({can:{...this.state.can,save:!0}})}handleMustSaveSettings(){this.setState({must:{...this.state.must,save:!0}})}handleMustEditSubscriptionKey(){this.setState({must:{...this.state.must,editSubscriptionKey:!0}})}handleMustRefreshSubscriptionKey(){this.setState({must:{...this.state.must,refreshSubscriptionKey:!0}})}handleResetActionsSettings(){this.setState({must:{save:!1,test:!1,synchronize:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1}})}handleRouteChange(e){this.props.location.key!==e.key&&this.handleAdministrationMenuRouteChange()}handleAdministrationMenuRouteChange(){const e={can:{save:!1,test:!1,synchronize:!1},must:{save:!1,test:!1,synchronize:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1}};if(!this.props.rbacContext.canIUseAction(Rt))return e.selectedAdministration=jt.HTTP_403_ACCESS_DENIED,void this.setState(e);const t=this.props.location.pathname,s=Yt.homePage.test(t),i=Yt.mfa.test(t),n=Yt.mfaPolicy.test(t),r=Yt.passwordPolicies.test(t),a=Yt.usersDirectory.test(t),o=Yt.emailNotification.test(t),l=Yt.subscription.test(t),c=Yt.internationalization.test(t),d=Yt.accountRecovery.test(t),p=Yt.smtpSettings.test(t),h=Yt.selfRegistration.test(t),u=Yt.sso.test(t),m=Yt.rbac.test(t),g=Yt.userPassphrasePolicies.test(t),E=Yt.passwordExpirySettings.test(t),y=Yt.healthcheck.test(t),f=Yt.contentTypesEncryptedMetadata.test(t),b=Yt.contentTypesMetadataKey.test(t),S=Yt.migrateEncryptedMetadata.test(t),T=Yt.allowContentTypes.test(t),w=Yt.gettingStarted.test(t),v=Yt.scim.test(t),C=Yt.secretHistory.test(t),A=Yt.ceDowngrade.test(t),R=Yt.offline.test(t),x=Yt.mfaPolicyTeasing.test(t),_=Yt.passwordPoliciesTeasing.test(t),P=Yt.usersDirectoryTeasing.test(t),I=Yt.subscriptionTeasing.test(t),N=Yt.accountRecoveryTeasing.test(t),O=Yt.userPassphrasePoliciesTeasing.test(t),U=Yt.ssoTeasing.test(t),k=Yt.scimTeasing.test(t);let D;if(s?D=jt.HOME:n||x?D=jt.MFA_POLICY:r||_?D=jt.PASSWORD_POLICIES:i?D=jt.MFA:a||P?D=jt.USER_DIRECTORY:o?D=jt.EMAIL_NOTIFICATION:l||I?D=jt.SUBSCRIPTION:c?D=jt.INTERNATIONALIZATION:d||N?D=jt.ACCOUNT_RECOVERY:p?D=jt.SMTP_SETTINGS:h?D=jt.SELF_REGISTRATION:u||U?D=jt.SSO:m?D=jt.RBAC:g||O?D=jt.USER_PASSPHRASE_POLICIES:E?D=jt.PASSWORD_EXPIRY:y?D=jt.HEALTHCHECK:f?D=jt.CONTENT_TYPES_ENCRYPTED_METADATA:b?D=jt.CONTENT_TYPES_METADATA_KEY:S?D=jt.MIGRATE_METADATA:T?D=jt.ALLOW_CONTENT_TYPES:w?D=jt.METADATA_GETTING_STARTED:v||k?D=jt.SCIM:C?D=jt.SECRET_HISTORY:A?D=jt.CE_DOWNGRADE:R&&(D=jt.OFFLINE),!D)return e.selectedAdministration=jt.HTTP_404_NOT_FOUND,void this.setState(e);const L=Wt?.[D];e.selectedAdministration=L&&!(this.props.context.siteSettings.canIUse(L)||zt.includes(D)&&this.props.context.siteSettings.isCommunityEdition)?jt.HTTP_404_NOT_FOUND:D,this.setState(e)}setDisplayAdministrationWorkspaceAction(e){this.setState({administrationWorkspaceAction:e})}resetDisplayAdministrationWorkspaceAction(){this.setState({administrationWorkspaceAction:()=>i.createElement(i.Fragment,null)})}render(){return i.createElement(Ft.Provider,{value:this.state},this.props.children)}}var Kt;function Bt(e){return class extends i.Component{render(){return i.createElement(Ft.Consumer,null,t=>i.createElement(e,{administrationWorkspaceContext:t,...this.props}))}}}Ht.displayName="AdministrationWorkspaceContextProvider",Ht.propTypes={context:d().object,children:d().any,location:d().object,match:d().object,history:d().object,loadingContext:d().object,rbacContext:d().object},(0,Et.withRouter)(a(function(e){return class extends i.Component{render(){return i.createElement(Vt.Consumer,null,t=>i.createElement(e,{rbacContext:t,...this.props}))}}}((Kt=Ht,class extends i.Component{render(){return i.createElement(St.Consumer,null,e=>i.createElement(Kt,{loadingContext:e,...this.props}))}}))));const jt={NONE:"NONE",HOME:"HOME",MFA:"MFA",MFA_POLICY:"MFA-POLICY",PASSWORD_POLICIES:"PASSWORD-POLICIES",USER_DIRECTORY:"USER-DIRECTORY",EMAIL_NOTIFICATION:"EMAIL-NOTIFICATION",SUBSCRIPTION:"SUBSCRIPTION",INTERNATIONALIZATION:"INTERNATIONALIZATION",ACCOUNT_RECOVERY:"ACCOUNT-RECOVERY",SMTP_SETTINGS:"SMTP-SETTINGS",SELF_REGISTRATION:"SELF-REGISTRATION",SSO:"SSO",RBAC:"RBAC",USER_PASSPHRASE_POLICIES:"USER-PASSPHRASE-POLICIES",PASSWORD_EXPIRY:"PASSWORD-EXPIRY",HTTP_403_ACCESS_DENIED:"403-ACCESS-DENIED",HTTP_404_NOT_FOUND:"404-NOT-FOUND",HEALTHCHECK:"HEALTHCHECK",CONTENT_TYPES_ENCRYPTED_METADATA:"CONTENT_TYPES_ENCRYPTED_METADATA",CONTENT_TYPES_METADATA_KEY:"CONTENT_TYPES_METADATA_KEY",MIGRATE_METADATA:"MIGRATE_METADATA",ALLOW_CONTENT_TYPES:"ALLOW_CONTENT_TYPES",METADATA_GETTING_STARTED:"METADATA_GETTING_STARTED",SCIM:"SCIM",SECRET_HISTORY:"SECRET_HISTORY",CE_DOWNGRADE:"DOWNGRADE-TO-CE",OFFLINE:"OFFLINE"},Wt={[jt.MFA]:"multiFactorAuthentication",[jt.MFA_POLICY]:"mfaPolicies",[jt.PASSWORD_POLICIES]:"passwordPoliciesUpdate",[jt.USER_DIRECTORY]:"directorySync",[jt.SUBSCRIPTION]:"ee",[jt.INTERNATIONALIZATION]:"locale",[jt.ACCOUNT_RECOVERY]:"accountRecovery",[jt.SMTP_SETTINGS]:"smtpSettings",[jt.SELF_REGISTRATION]:"selfRegistration",[jt.SSO]:"sso",[jt.RBAC]:"rbacs",[jt.USER_PASSPHRASE_POLICIES]:"userPassphrasePolicies",[jt.PASSWORD_EXPIRY]:"passwordExpiry",[jt.HEALTHCHECK]:"healthcheckUi",[jt.CONTENT_TYPES_ENCRYPTED_METADATA]:"metadata",[jt.CONTENT_TYPES_METADATA_KEY]:"metadata",[jt.MIGRATE_METADATA]:"metadata",[jt.ALLOW_CONTENT_TYPES]:"metadata",[jt.METADATA_GETTING_STARTED]:"metadata",[jt.SCIM]:"scim",[jt.SECRET_HISTORY]:"secretRevisions",[jt.CE_DOWNGRADE]:"ee",[jt.OFFLINE]:"offlineMode"},Yt={homePage:/^\/app\/administration\/?$/,mfa:/^\/app\/administration\/mfa\/?$/,mfaPolicy:/^\/app\/administration\/mfa-policy\/?$/,mfaPolicyTeasing:/^\/app\/administration\/mfa-policy-teasing\/?$/,passwordPolicies:/^\/app\/administration\/password-policies\/?$/,passwordPoliciesTeasing:/^\/app\/administration\/password-policies-teasing\/?$/,usersDirectory:/^\/app\/administration\/users-directory\/?$/,usersDirectoryTeasing:/^\/app\/administration\/users-directory-teasing\/?$/,emailNotification:/^\/app\/administration\/email-notification\/?$/,subscription:/^\/app\/administration\/subscription\/?$/,subscriptionTeasing:/^\/app\/administration\/subscription-teasing\/?$/,internationalization:/^\/app\/administration\/internationalization\/?$/,accountRecovery:/^\/app\/administration\/account-recovery\/?$/,accountRecoveryTeasing:/^\/app\/administration\/account-recovery-teasing\/?$/,smtpSettings:/^\/app\/administration\/smtp-settings\/?$/,selfRegistration:/^\/app\/administration\/self-registration\/?$/,sso:/^\/app\/administration\/sso\/?$/,ssoTeasing:/^\/app\/administration\/sso-teasing\/?$/,rbac:/^\/app\/administration\/rbacs\/?$/,userPassphrasePolicies:/^\/app\/administration\/user-passphrase-policies\/?$/,userPassphrasePoliciesTeasing:/^\/app\/administration\/user-passphrase-policies-teasing\/?$/,passwordExpirySettings:/^\/app\/administration\/password-expiry\/?$/,healthcheck:/^\/app\/administration\/healthcheck\/?$/,contentTypesEncryptedMetadata:/^\/app\/administration\/content-types\/metadata\/?$/,contentTypesMetadataKey:/^\/app\/administration\/content-types\/metadata-key\/?$/,migrateEncryptedMetadata:/^\/app\/administration\/migrate-metadata\/?$/,allowContentTypes:/^\/app\/administration\/allow-content-types\/?$/,gettingStarted:/^\/app\/administration\/content-types\/metadata-getting-started\/?$/,scim:/^\/app\/administration\/user-provisionning\/scim\/?$/,scimTeasing:/^\/app\/administration\/scim-teasing\/?$/,secretHistory:/^\/app\/administration\/secret-history\/?$/,ceDowngrade:/^\/app\/administration\/ce-downgrade\/?$/,offline:/^\/app\/administration\/offline\/?$/},zt=[jt.SUBSCRIPTION,jt.PASSWORD_POLICIES,jt.USER_PASSPHRASE_POLICIES,jt.ACCOUNT_RECOVERY,jt.SSO,jt.MFA_POLICY,jt.USER_DIRECTORY,jt.SCIM],Zt=class{constructor(e){this.customerId=e?.customer_id||"",this.subscriptionId=e?"subscription_id"in e?e.subscription_id:"N/A":"",this.users=e?.users||null,this.email=e?"email"in e?e.email:"N/A":"",this.expiry=e?.expiry||null,this.created=e?.created||null,this.data=e?.data||null}},Jt=i.createContext({getSubscription:()=>{},findSubscriptionKey:()=>{},isProcessing:()=>{},setProcessing:()=>{},getActiveUsers:()=>{},clearContext:()=>{}});class Xt extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{subscription:new Zt,processing:!1,getSubscription:this.getSubscription.bind(this),findSubscriptionKey:this.findSubscriptionKey.bind(this),isProcessing:this.isProcessing.bind(this),setProcessing:this.setProcessing.bind(this),getActiveUsers:this.getActiveUsers.bind(this),clearContext:this.clearContext.bind(this)}}async findSubscriptionKey(){this.setProcessing(!0);let e=new Zt;try{const t=await this.props.context.onGetSubscriptionKeyRequested();e=new Zt(t.toDto())}catch(t){"PassboltSubscriptionError"===t.name&&(e=new Zt(t.subscription))}finally{this.setState({subscription:e}),this.setProcessing(!1)}}async getActiveUsers(){return(await this.props.context.port.request("passbolt.users.get-all")).filter(e=>e.active).length}getSubscription(){return this.state.subscription}isProcessing(){return this.state.processing}setProcessing(e){this.setState({processing:e})}clearContext(){const{subscription:e,processing:t}=this.defaultState;this.setState({subscription:e,processing:t})}render(){return i.createElement(Jt.Provider,{value:this.state},this.props.children)}}function Qt(e){return class extends i.Component{render(){return i.createElement(Jt.Consumer,null,t=>i.createElement(e,{adminSubscriptionContext:t,...this.props}))}}}var es;function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ts.apply(null,arguments)}Xt.propTypes={context:d().any,children:d().any},a(Xt);const ss=function(e){return i.createElement("svg",ts({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),es||(es=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m12 4-8 8M4 4l8 8"})))};class is extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.handleCloseClick=this.handleCloseClick.bind(this)}handleCloseClick(){this.props.onClose()}render(){return i.createElement("button",{type:"button",disabled:this.props.disabled,className:"dialog-close button button-transparent",onClick:this.handleCloseClick},i.createElement(ss,{className:"svg-icon close"}),i.createElement("span",{className:"visually-hidden"},i.createElement(_.x,null,"Close")))}}is.propTypes={onClose:d().func,disabled:d().bool};const ns=(0,P.C)("common")(is);var rs;function as(){return as=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},as.apply(null,arguments)}const os=function(e){return i.createElement("svg",as({xmlns:"http://www.w3.org/2000/svg",width:17,height:18,fill:"none",viewBox:"0 0 17 18"},e),rs||(rs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8.5 16.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15M8.5 12V9M8.5 6h.008"})))};class ls extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.handleKeyDown=this.handleKeyDown.bind(this),this.handleClose=this.handleClose.bind(this)}handleKeyDown(e){27===e.keyCode&&this.handleClose()}handleClose(){this.props.disabled||this.props.onClose()}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown,{capture:!1})}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown,{capture:!1})}render(){return i.createElement("div",{className:`${this.props.className} dialog-wrapper`},i.createElement("div",{className:"dialog"},i.createElement("div",{className:"dialog-header"},i.createElement("div",{className:"dialog-title-wrapper"},i.createElement("h2",null,i.createElement("span",{className:"dialog-header-title"},this.props.title),this.props.subtitle&&i.createElement("span",{className:"dialog-header-subtitle"},this.props.subtitle)),this.props.tooltip&&""!==this.props.tooltip&&i.createElement(dt,{message:this.props.tooltip},i.createElement(os,null))),i.createElement(ns,{onClose:this.handleClose,disabled:this.props.disabled})),i.createElement("div",{className:"dialog-content"},this.props.children)))}}ls.propTypes={children:d().node,className:d().string,title:d().oneOfType([d().arrayOf(d().node),d().node,d().string]),subtitle:d().string,tooltip:d().node,disabled:d().bool,onClose:d().func};const cs=ls,ds=i.createContext({feedbacks:[],displaySuccess:()=>{},displayWarning:()=>{},displayError:()=>{},remove:()=>{}});class ps extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{feedbacks:[],displaySuccess:this.displaySuccess.bind(this),displayWarning:this.displayWarning.bind(this),displayError:this.displayError.bind(this),remove:this.remove.bind(this)}}displaySuccess(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,ht.A)(),type:"success",message:e}]})}displayWarning(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,ht.A)(),type:"warning",message:e}]})}displayError(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,ht.A)(),type:"error",message:e}]})}remove(e){this.setState(t=>({feedbacks:t.feedbacks.filter(t=>e.id!==t.id)}))}render(){return i.createElement(ds.Provider,{value:this.state},this.props.children)}}ps.displayName="ActionFeedbackContextProvider",ps.propTypes={children:d().any};class hs extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindCallbacks()}get defaultState(){return{showErrorDetails:!1}}bindCallbacks(){this.handleKeyDown=this.handleKeyDown.bind(this),this.handleErrorDetailsToggle=this.handleErrorDetailsToggle.bind(this)}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown,{capture:!0})}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown,{capture:!0})}getTitle(){return this.props.title?this.props.title:this.props.t("There was an unexpected error...")}getMessage(){return this.props.error.message}handleKeyDown(e){27!==e.keyCode&&13!==e.keyCode||(e.stopPropagation(),this.props.onClose())}handleErrorDetailsToggle(){this.setState({showErrorDetails:!this.state.showErrorDetails})}get hasErrorDetails(){return Boolean(this.props.error.data?.body)||Boolean(this.props.error.details)}formatErrors(){const e=this.props.error?.details||this.props.error?.data;return JSON.stringify(e,null,4)}render(){return i.createElement(cs,{className:"dialog-wrapper error-dialog",onClose:this.props.onClose,title:this.getTitle()},i.createElement("div",{className:"form-content"},i.createElement("p",null,this.getMessage()),this.hasErrorDetails&&i.createElement("div",{className:"accordion error-details"},i.createElement("div",{className:"accordion-header"},i.createElement("button",{type:"button",className:"link no-border",onClick:this.handleErrorDetailsToggle},i.createElement("span",null,i.createElement(_.x,null,"Error details")),this.state.showErrorDetails?i.createElement(Ce,{className:"baseline svg-icon"}):i.createElement(xe,{className:"baseline svg-icon"}))),this.state.showErrorDetails&&i.createElement("div",{className:"accordion-content"},i.createElement("div",{className:"input text"},i.createElement("label",{htmlFor:"js_field_debug",className:"visuallyhidden"},i.createElement(_.x,null,"Error details")),i.createElement("textarea",{id:"js_field_debug",defaultValue:this.formatErrors(),readOnly:!0}))))),i.createElement("div",{className:"submit-wrapper clearfix"},i.createElement("button",{type:"button",className:"button primary warning",onClick:this.props.onClose},"Ok")))}}hs.propTypes={title:d().string,error:d().object.isRequired,onClose:d().func,t:d().func};const us=(0,P.C)("common")(hs);class ms extends i.Component{constructor(e){super(e),this.bindCallbacks()}bindCallbacks(){this.handleClick=this.handleClick.bind(this)}handleClick(){this.props.disabled||this.props.onClick()}render(){return i.createElement("button",{type:"button",disabled:this.props.disabled,className:"link cancel",onClick:this.handleClick},this.props.value)}}ms.defaultProps={value:i.createElement(_.x,null,"Cancel")},ms.propTypes={disabled:d().bool,onClick:d().func,value:d().oneOfType([d().arrayOf(d().node),d().node,d().string])};const gs=(0,P.C)("common")(ms),Es=class extends ee{static getSchema(){return{type:"object",required:["subscription_id","users","expiry","created","data"],properties:{customer_id:{type:"string"},subscription_id:{type:"string"},users:{type:"integer"},email:{type:"string",format:"email"},created:{type:"string",format:"date-time"},expiry:{type:"string",format:"date-time"},data:{type:"string"}}}}get expiry(){return this._props.expiry}toDto(){return Object.assign({},this._props)}toJSON(){return this.toDto()}static get ENTITY_NAME(){return"Subscription"}},ys=class{constructor(e){this.port=e}async createOrganizationSubscriptionKey(e){(0,L.A)(e);const t=await this.port.request("passbolt.subscription.create",{data:e});return new Es(t)}async findOrganizationSubscriptionKey(){const e=await this.port.request("passbolt.subscription.get");return new Es(e)}async updateOrganizationSubscriptionKey(e){(0,L.A)(e);const t=await this.port.request("passbolt.subscription.update",{data:e});return new Es(t)}async deleteOrganizationSubscriptionKey(){await this.port.request("passbolt.subscription.downgrade")}};class fs extends i.Component{constructor(e){super(e),this.state=this.getDefaultState(),this.initEventHandlers(),this.createInputRef(),this.subscriptionKeyService=new ys(e.context.port)}getDefaultState(){return{selectedFile:null,key:"",keyError:"",processing:!1,hasBeenValidated:!1}}initEventHandlers(){this.handleCloseClick=this.handleCloseClick.bind(this),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyInputKeyUp=this.handleKeyInputKeyUp.bind(this),this.handleSelectSubscriptionKeyFile=this.handleSelectSubscriptionKeyFile.bind(this),this.handleSelectFile=this.handleSelectFile.bind(this)}createInputRef(){this.keyInputRef=i.createRef(),this.fileUploaderRef=i.createRef()}componentDidMount(){this.setState({key:this.props.context.editSubscriptionKey?.key||""})}async handleFormSubmit(e){e.preventDefault(),this.state.processing||await this.save()}handleInputChange(e){const t=e.target,s=t.value,i=t.name;this.setState({[i]:s})}handleKeyInputKeyUp(){if(this.state.hasAlreadyBeenValidated){const e=this.validateNameInput();this.setState(e)}}handleCloseClick(){this.props.context.setContext({editSubscriptionKey:null}),this.props.onClose()}handleSelectFile(){this.fileUploaderRef.current.click()}get selectedFilename(){return this.state.selectedFile?this.state.selectedFile.name:""}async handleSelectSubscriptionKeyFile(e){const[t]=e.target.files,s=await this.readSubscriptionKeyFile(t);this.setState({key:s,selectedFile:t}),this.state.hasBeenValidated&&await this.validate()}readSubscriptionKeyFile(e){const t=new FileReader;return new Promise((s,i)=>{t.onloadend=()=>{try{s(t.result)}catch(e){i(e)}},t.readAsText(e)})}async save(){if(!this.state.processing){if(this.setState({hasBeenValidated:!0,processing:!0}),!await this.validate())return this.handleValidateError(),void this.setState({processing:!1});try{this.props.onSave?await this.props.onSave(this.state.key):await this.subscriptionKeyService.updateOrganizationSubscriptionKey(this.state.key),await this.handleSaveSuccess(),await this.props.adminSubscriptionContext.findSubscriptionKey()}catch(e){this.setState({processing:!1}),this.handleSaveError(e),this.focusFieldError()}}}handleValidateError(){this.focusFieldError()}async handleSaveSuccess(){await this.props.actionFeedbackContext.displaySuccess(this.translate("The subscription key has been updated successfully.")),this.props.administrationWorkspaceContext.onMustRefreshSubscriptionKey(),this.props.context.setContext({editSubscriptionKey:null,refreshSubscriptionAnnouncement:!0}),this.props.onClose()}handleSaveError(e){if("PassboltSubscriptionError"===e.name)this.setState({keyError:e.message});else if("EntityValidationError"===e.name)this.setState({keyError:this.translate("The subscription key is invalid.")});else if("PassboltApiFetchError"===e.name&&e.data&&400===e.data.code)this.setState({keyError:e.message});else{console.error(e);const t={error:e};this.props.dialogContext.open(us,t)}}focusFieldError(){this.state.keyError&&this.keyInputRef.current.focus()}validateKeyInput(){const e=this.state.key.trim();let t="";return e.length||(t=this.translate("A subscription key is required.")),new Promise(e=>{this.setState({keyError:t},e)})}async validate(){return this.setState({keyError:""}),await this.validateKeyInput(),""===this.state.keyError}hasAllInputDisabled(){return this.state.processing}get translate(){return this.props.t}render(){return i.createElement(cs,{title:this.props.title??this.translate("Edit subscription key"),onClose:this.handleCloseClick,disabled:this.state.processing,className:"edit-subscription-dialog"},i.createElement("form",{onSubmit:this.handleFormSubmit,noValidate:!0},i.createElement("div",{className:"form-content"},i.createElement("div",{className:`input textarea required ${this.state.keyError?"error":""} ${this.hasAllInputDisabled()?"disabled":""}`},i.createElement("label",{htmlFor:"edit-tag-form-name"},i.createElement(_.x,null,"Subscription key")),i.createElement("textarea",{id:"edit-subscription-form-key",name:"key",value:this.state.key,onKeyUp:this.handleKeyInputKeyUp,onChange:this.handleInputChange,disabled:this.hasAllInputDisabled(),ref:this.keyInputRef,className:"required full_report",required:"required",autoComplete:"off",autoFocus:!0})),i.createElement("div",{className:"input file "+(this.hasAllInputDisabled()?"disabled":"")},i.createElement("input",{type:"file",ref:this.fileUploaderRef,disabled:this.hasAllInputDisabled(),onChange:this.handleSelectSubscriptionKeyFile}),i.createElement("div",{className:"input-file-inline"},i.createElement("input",{type:"text",disabled:!0,placeholder:this.translate("No key file selected"),value:this.selectedFilename}),i.createElement("button",{type:"button",className:"button primary",onClick:this.handleSelectFile,disabled:this.hasAllInputDisabled()},i.createElement("span",null,i.createElement(_.x,null,"Choose a file")))),this.state.keyError&&i.createElement("div",{className:"key error-message"},this.state.keyError),this.props.warning&&i.createElement("p",null,this.props.warning))),i.createElement("div",{className:"submit-wrapper clearfix"},i.createElement(gs,{disabled:this.hasAllInputDisabled(),onClick:this.handleCloseClick}),i.createElement(D,{disabled:this.hasAllInputDisabled(),processing:this.state.processing,value:this.translate("Save")}))))}}fs.propTypes={context:d().any,onClose:d().func,actionFeedbackContext:d().any,adminSubscriptionContext:d().object,dialogContext:d().any,administrationWorkspaceContext:d().any,title:d().string,warning:d().string,onSave:d().func,t:d().func};const bs=a(Qt(Bt(function(e){return class extends i.Component{render(){return i.createElement(ds.Consumer,null,t=>i.createElement(e,{actionFeedbackContext:t,...this.props}))}}}(gt((0,P.C)("common")(fs))))));class Ss{constructor(e){this.context=e.context,this.dialogContext=e.dialogContext,this.subscriptionContext=e.adminSubscriptionContext}static getInstance(e){return this.instance||(this.instance=new Ss(e)),this.instance}static killInstance(){this.instance=null}editSubscription(){const e={key:this.subscriptionContext.getSubscription().data};this.context.setContext({editSubscriptionKey:e}),this.dialogContext.open(bs)}}const Ts=Ss;var ws=s(40961);var vs,Cs;function As(){return As=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},As.apply(null,arguments)}const Rs=function(e){return i.createElement("svg",As({xmlns:"http://www.w3.org/2000/svg",width:18,height:18,fill:"none",viewBox:"0 0 18 18"},e),vs||(vs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 3H3a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 3 15h12a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 15 3"})),Cs||(Cs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16.5 5.25 9.773 9.525a1.46 1.46 0 0 1-1.546 0L1.5 5.25"})))};var xs;function _s(){return _s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},_s.apply(null,arguments)}const Ps=function(e){return i.createElement("svg",_s({xmlns:"http://www.w3.org/2000/svg",width:18,height:18,fill:"none",viewBox:"0 0 18 18"},e),xs||(xs=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m16.298 13.5-6-10.5a1.5 1.5 0 0 0-2.61 0l-6 10.5A1.5 1.5 0 0 0 3 15.75h12a1.5 1.5 0 0 0 1.297-2.25M9 6.75v3M9 12.75h.008"})))},Is="Pro Edition",Ns="Community Edition";class Os extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindCallbacks(),this.subscriptionActionService=Ts.getInstance(this.props),this.subscriptionKeyService=new ys(this.props.context.port)}get defaultState(){return{activeUsers:null}}async componentDidMount(){this.props.context.siteSettings.isCommunityEdition&&this.hasEditionPlugin()||this.props.adminSubscriptionContext.findSubscriptionKey();const e=await this.props.adminSubscriptionContext.getActiveUsers();this.setState({activeUsers:e})}componentWillUnmount(){this.props.adminSubscriptionContext.clearContext(),Ts.killInstance()}bindCallbacks(){this.handleRenewKey=this.handleRenewKey.bind(this),this.handleUpdateKey=this.handleUpdateKey.bind(this),this.handleDowngradeClick=this.handleDowngradeClick.bind(this),this.handleAddSubscriptionKey=this.handleAddSubscriptionKey.bind(this),this.handleSaveSubscriptionKey=this.handleSaveSubscriptionKey.bind(this)}handleSaveSubscriptionKey(e){return this.subscriptionKeyService.createOrganizationSubscriptionKey(e)}handleAddSubscriptionKey(){this.props.dialogContext.open(bs,{title:this.props.t("New subscription key"),onSave:this.handleSaveSubscriptionKey,warning:this.translate("You and your team will be disconnected at the end of the process.")})}handleDowngradeClick(){this.props.navigationContext.onGoToAdministrationDowngradeToCeRequested()}handleRenewKey(){const e=this.props.adminSubscriptionContext.getSubscription();this.hasLimitUsersExceeded()?this.props.navigationContext.onGoToSubscriptionUpdateQuantityRequested(e.subscriptionId,e.customerId):(this.hasSubscriptionKeyExpired()||this.hasSubscriptionKeyGoingToExpire())&&this.props.navigationContext.onGoToSubscriptionRenewRequested(e.subscriptionId,e.customerId)}handleUpdateKey(){this.subscriptionActionService.editSubscription()}hasEditionPlugin(){return this.props.context.siteSettings.canIUse("edition")}hasSubscriptionKeyExpired(){return pt.c9.fromISO(this.props.adminSubscriptionContext.getSubscription().expiry)<pt.c9.now()}hasSubscriptionKeyGoingToExpire(){return!this.hasSubscriptionKeyExpired()&&pt.c9.fromISO(this.props.adminSubscriptionContext.getSubscription().expiry)<pt.c9.now().plus({days:30})}shouldShowDowngradeSection(){return this.hasEditionPlugin()&&!this.props.context.siteSettings.isCommunityEdition&&(this.hasSubscriptionKeyExpired()||this.hasSubscriptionKeyGoingToExpire())}hasLimitUsersExceeded(){return this.props.adminSubscriptionContext.getSubscription().users<this.state.activeUsers}hasValidSubscription(){return!this.props.context.siteSettings.isCommunityEdition&&!this.hasLimitUsersExceeded()&&!this.hasSubscriptionKeyExpired()}hasInvalidSubscription(){return!this.props.context.siteSettings.isCommunityEdition&&!this.props.adminSubscriptionContext.getSubscription().data}formatDate(e){try{return pt.c9.fromISO(e).setLocale(this.props.context.locale).toLocaleString(pt.c9.DATE_SHORT)}catch(t){return console.error(`Failed to format date "${e}":`,t),""}}get translate(){return this.props.t}render(){const e=this.props.adminSubscriptionContext.getSubscription(),t=this.props.adminSubscriptionContext.isProcessing();return i.createElement("div",{className:"row"},!t&&i.createElement("div",{className:"subscription-key main-column"},i.createElement("div",{className:"main-content"},i.createElement("h1",null,i.createElement(_.x,null,"Subscription")),i.createElement("h3",null,i.createElement(_.x,null,"Details")),i.createElement("div",{className:"subscription-information"},i.createElement("div",{className:"information container"},i.createElement("div",{className:"information"},i.createElement("div",{className:"information-label"},i.createElement("span",{className:"edition label"},i.createElement(_.x,null,"Edition:")),i.createElement("span",{className:"server-version label"},i.createElement(_.x,null,"Server version:")),i.createElement("span",{className:"client-version label"},i.createElement(_.x,null,"Client version:")),!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"email label"},i.createElement(_.x,null,"Email:")),i.createElement("span",{className:"users label"},i.createElement(_.x,null,"Users limit:")))),i.createElement("div",{className:"information-value"},i.createElement("span",{className:"edition value"},!this.props.context.siteSettings.isCommunityEdition&&Is,this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,Ns,i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"(Free forever)")))),i.createElement("span",{className:"server-version value"},this.props.context.siteSettings.version),i.createElement("span",{className:"client-version value"},this.props.context.extensionVersion),!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"email value"},e.email),i.createElement("span",{className:"users value "+(this.hasLimitUsersExceeded()?"error":"")},e.users," ",i.createElement("span",{className:"secondary-information"},"(",i.createElement(_.x,null,"currently:")," ",this.state.activeUsers,")"))))),i.createElement("div",{className:"information"},i.createElement("div",{className:"information-label"},!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"customer-id label"},i.createElement(_.x,null,"Customer id:")),i.createElement("span",{className:"subscription-id label"},i.createElement(_.x,null,"Subscription id:")),i.createElement("span",{className:"created label"},i.createElement(_.x,null,"Valid from:")),i.createElement("span",{className:"expiry label"},i.createElement(_.x,null,"Expires on:")))),i.createElement("div",{className:"information-value"},!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,i.createElement("span",{className:"customer-id value"},e.customerId),i.createElement("span",{className:"subscription-id value"},e.subscriptionId),i.createElement("span",{className:"created value"},this.formatDate(e.created)),i.createElement("span",{className:`expiry value ${this.hasSubscriptionKeyExpired()?"error":""} ${this.hasSubscriptionKeyGoingToExpire()?"warning":""}`},this.formatDate(e.expiry)," ",i.createElement("span",{className:"secondary-information",title:e.expiry},"(",`${this.hasSubscriptionKeyExpired()?this.translate("expired "):""}${((e,t,s)=>{if(null===e)return"n/a";if("Infinity"===e)return t("Never");const i=pt.c9.fromISO(e),n=i.diffNow().toMillis();return n>-1e3&&n<0?t("Just now"):i.toRelative({locale:s})})(e.expiry,this.props.t,this.props.context.locale)}`,")"))))))),!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,!this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"subscription-actions"},this.hasSubscriptionKeyExpired()&&i.createElement("div",{className:"subscription-warning"},i.createElement(Ps,null),i.createElement(_.x,null,"Your subscription key is expired.")),this.hasLimitUsersExceeded()&&i.createElement("div",{className:"subscription-warning"},i.createElement(Ps,null),i.createElement(_.x,null,"Your users limit has been reached.")),this.hasInvalidSubscription()&&i.createElement("div",{className:"subscription-warning"},i.createElement(Ps,null),i.createElement(_.x,null,"Your subscription key is either missing or not valid.")))),i.createElement("div",{className:"subscription-actions"},!this.props.context.siteSettings.isCommunityEdition&&i.createElement(i.Fragment,null,(this.shouldShowDowngradeSection()||this.hasLimitUsersExceeded())&&i.createElement("button",{className:"button",type:"button",onClick:this.handleRenewKey},i.createElement(_.x,null,"Renew subscription key")),i.createElement("button",{className:"button primary form",type:"button",onClick:this.handleUpdateKey},i.createElement(_.x,null,"Update subscription key"))),this.props.context.siteSettings.isCommunityEdition&&this.hasEditionPlugin()&&i.createElement(i.Fragment,null,i.createElement("button",{className:"button primary form",type:"button",onClick:this.handleAddSubscriptionKey},i.createElement(_.x,null,"Upload subscription key")))),i.createElement("h3",{className:"title"},i.createElement(_.x,null,"Plans")),i.createElement("div",{className:"subscription-editions"},i.createElement("div",{className:"edition "+(this.props.context.siteSettings.isCommunityEdition?"current-edition":"")},i.createElement("div",{className:"content"},i.createElement("div",{className:"title"},i.createElement("div",{className:"community-title"},i.createElement("h3",null,Ns),i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"(Free forever)"))),this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"current-edition-indicator-wrapper"},i.createElement("div",{className:"current-edition-indicator"},i.createElement(_.x,null,"Current plan")))),i.createElement("div",{className:"features"},i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"Features included:")),i.createElement("ul",null,i.createElement("li",null,i.createElement(_.x,null,"Open source under AGPLV3 license")),i.createElement("li",null,i.createElement(_.x,null,"Passwords management & sharing")),i.createElement("li",null,i.createElement(_.x,null,"Private and shared folders")),i.createElement("li",null,i.createElement(_.x,null,"Users and groups management")),i.createElement("li",null,i.createElement(_.x,null,"Secret key authentication (2FA)")),i.createElement("li",null,i.createElement(_.x,null,"Additional factor authentication (3-step verification)")),i.createElement("li",null,i.createElement(_.x,null,"Open API")),i.createElement("li",null,i.createElement(_.x,null,"Role Based Access Control")),i.createElement("li",null,i.createElement(_.x,null,"Password expiry")),i.createElement("li",null,i.createElement(_.x,null,"Secret history")),i.createElement("li",null,i.createElement(_.x,null,"Community support"))))),this.shouldShowDowngradeSection()&&i.createElement("div",{className:"subscription-actions"},i.createElement("button",{className:"button",type:"button",onClick:this.handleDowngradeClick},i.createElement(_.x,null,"Downgrade to ",{edition:"Community"})))),i.createElement("div",{className:"edition "+(this.props.context.siteSettings.isCommunityEdition?"":"current-edition")},i.createElement("div",{className:"content"},i.createElement("div",{className:"title"},i.createElement("h3",null,Is),!this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"current-edition-indicator-wrapper"},i.createElement("div",{className:"current-edition-indicator"},i.createElement(_.x,null,"Current plan")))),i.createElement("div",{className:"features"},i.createElement("span",{className:"subtitle"},i.createElement(_.x,null,"Features include everything in Community, plus:")),i.createElement("ul",null,i.createElement("li",null,i.createElement(_.x,null,"Account recovery (Escrow)")),i.createElement("li",null,i.createElement(_.x,null,"Users provisioning (AD / OpenLDAP / SCIM)")),i.createElement("li",null,i.createElement(_.x,null,"Single Sign On (SSO) with Microsoft, Google and more")),i.createElement("li",null,i.createElement(_.x,null,"Activity log (audit changes)")),i.createElement("li",null,i.createElement(_.x,null,"Additional policies")),i.createElement("li",null,i.createElement(_.x,null,"Tags management")),i.createElement("li",null,i.createElement(_.x,null,"VM appliance")),i.createElement("li",null,i.createElement(_.x,null,"Next business day support"))),i.createElement("div",null,i.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/pricing/pro?utm_campaign=21060976-CE%20to%20Pro&utm_source=product"},i.createElement(_.x,null,"See pricing page"))))),this.props.context.siteSettings.isCommunityEdition&&i.createElement("div",{className:"subscription-actions"},i.createElement("a",{className:"button primary",target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/pricing/pro?utm_campaign=21060976-CE%20to%20Pro&utm_source=product"},i.createElement(_.x,null,"Buy now")),i.createElement("a",{className:"button",target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/contact/pro/free-trial?utm_campaign=21060976-CE%20to%20Pro&utm_source=product"},i.createElement(_.x,null,"Start a free trial"))))))),(s=i.createElement("div",{className:"sidebar-help-section"},i.createElement("h3",null,i.createElement(_.x,null,"Need help?")),i.createElement("p",null,i.createElement(_.x,null,"For any change or question related to your passbolt subscription, kindly contact our sales team.")),i.createElement("a",{className:"button",target:"_blank",rel:"noopener noreferrer",href:"https://www.passbolt.com/contact"},i.createElement(Rs,null),i.createElement("span",null,i.createElement(_.x,null,"Contact Sales")))),n=document.getElementById("administration-help-panel"),i.createElement(i.Fragment,null,n&&(0,ws.createPortal)(s,n,void 0))));var s,n}}a(function(e){return class extends i.Component{render(){return i.createElement(ft.Consumer,null,t=>i.createElement(e,{navigationContext:t,...this.props}))}}}(Qt(Bt(gt((0,P.C)("common")(Os))))));class Us extends i.Component{get privacyUrl(){return this.props.context.siteSettings.privacyLink}get creditsUrl(){return"https://www.passbolt.com/terms"}get unsafeUrl(){return"https://www.passbolt.com/docs/hosting/faq/why-I-see-unsafe-mode-banner/"}get termsUrl(){return this.props.context.siteSettings.termsLink}get versions(){const e=this.props.context.extensionVersion,t=this.props.context.siteSettings.version;return i.createElement("div",null,e&&i.createElement("div",null,this.props.t("Client")," ",e),t&&i.createElement(i.Fragment,null,e&&i.createElement("hr",null),i.createElement("div",null,this.props.t("Server")," ",t)))}get isUnsafeMode(){if(!this.props.context.siteSettings)return!1;const e=this.props.context.siteSettings.debug,t=this.props.context.siteSettings.url.startsWith("http://");return e||t}get isCloud(){const e=new URL(this.props.context.siteSettings.url);return"https:"===e.protocol&&Boolean(e.hostname.match(/cloud.passbolt.com$/))}render(){return i.createElement("footer",{className:"footer"},i.createElement("ul",{className:"footer-links"},this.isUnsafeMode&&i.createElement("li",{className:"error-message"},i.createElement("a",{href:this.unsafeUrl,target:"_blank",rel:"noopener noreferrer"},i.createElement(_.x,null,"Unsafe mode"))),!this.isCloud&&i.createElement(i.Fragment,null,this.props.context.siteSettings.isCommunityEdition&&i.createElement("li",null,Ns,i.createElement("span",{className:"edition-suffix"},i.createElement(_.x,null," (free)"))),!this.props.context.siteSettings.isCommunityEdition&&i.createElement("li",null,Is)),this.isCloud&&i.createElement("li",null,"Cloud"),i.createElement("li",null,this.versions&&i.createElement(dt,{message:this.versions,direction:"top-left"},i.createElement("a",{className:"button button-transparent inline",href:this.creditsUrl,target:"_blank",rel:"noopener noreferrer"},i.createElement(lt,null))),!this.versions&&i.createElement("a",{className:"button button-transparent inline",href:this.creditsUrl,target:"_blank",rel:"noopener noreferrer"},i.createElement(lt,null)))))}}Us.propTypes={context:d().any,t:d().func};const ks=a((0,P.C)("common")(Us));var Ds=s(72635),Ls=s(51831),qs=s(32107);class Gs extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{ready:!1}}async componentDidMount(){await(0,Ds.Yx)(Ls.r).use(qs.A).init({lng:this.locale,load:"currentOnly",interpolation:{escapeValue:!1},react:{useSuspense:!1},backend:{loadPath:(e,t)=>this.getTranslationPath(e,t)},supportedLngs:this.supportedLocales,fallbackLng:!1,ns:["common"],defaultNS:"common",keySeparator:!1,nsSeparator:!1,debug:!1}),this.setState({ready:!0})}getTranslationPath(e,t){const s=e[0],i=t[0],n="en-GB"===s?"en-UK":s;return(this.props.loadingPath||"/locales/{{lng}}/{{ns}}.json").replace("{{lng}}",n).replace("{{ns}}",i)}get supportedLocales(){let e=[];return this.props.context.siteSettings?.supportedLocales?e=this.props.context.siteSettings?.supportedLocales.map(e=>e.locale):e.push(this.locale),e.includes("en-UK")&&e.push("en-GB"),e}get locale(){return this.props.context.locale}async componentDidUpdate(e){await this.handleLocaleChange(e.context.locale)}async handleLocaleChange(e){this.locale!==e&&await(0,Ds.v2)(this.locale)}get isReady(){return this.state.ready}render(){return i.createElement(i.Fragment,null,this.isReady&&this.props.children)}}Gs.propTypes={context:d().any,loadingPath:d().any,children:d().any};const Ms=a(Gs),Vs=new class{allPropTypes=(...e)=>(...t)=>{const s=e.map(e=>e(...t)).filter(Boolean);if(0===s.length)return;const i=s.map(e=>e.message).join("\n");return new Error(i)}};var $s;function Fs(){return Fs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},Fs.apply(null,arguments)}const Hs=function(e){return i.createElement("svg",Fs({width:25,height:24,fill:"none",viewBox:"0 0 25 24"},e),$s||($s=i.createElement("path",{stroke:"var(--icon-color)",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M11.597 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16M21.597 21l-4.35-4.35"})))};class Ks extends i.Component{constructor(e){super(e),this.state=this.getDefaultState(e),this.bindCallback(),this.createRefs()}getDefaultState(e){return{selectedValue:e.value,search:"",open:!1,style:void 0}}get listItemsFiltered(){const e=this.props.items.filter(e=>e.value!==this.state.selectedValue);return this.props.search&&""!==this.state.search?this.getItemsMatch(e,this.state.search):e}get selectedItemLabel(){const e=this.props.items&&this.props.items.find(e=>e.value===this.state.selectedValue);return e&&e.label||i.createElement(i.Fragment,null," ")}static getDerivedStateFromProps(e,t){return void 0!==e.value&&e.value!==t.selectedValue?{selectedValue:e.value}:null}bindCallback(){this.handleDocumentClickEvent=this.handleDocumentClickEvent.bind(this),this.handleDocumentContextualMenuEvent=this.handleDocumentContextualMenuEvent.bind(this),this.handleDocumentDragStartEvent=this.handleDocumentDragStartEvent.bind(this),this.handleDocumentScrollEvent=this.handleDocumentScrollEvent.bind(this),this.handleSelectClick=this.handleSelectClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleSelectKeyDown=this.handleSelectKeyDown.bind(this),this.handleItemKeyDown=this.handleItemKeyDown.bind(this),this.handleBlur=this.handleBlur.bind(this)}createRefs(){this.selectedItemRef=i.createRef(),this.selectItemsRef=i.createRef(),this.itemsRef=i.createRef()}componentDidMount(){document.addEventListener("click",this.handleDocumentClickEvent,{capture:!0}),document.addEventListener("contextmenu",this.handleDocumentContextualMenuEvent,{capture:!0}),document.addEventListener("dragstart",this.handleDocumentDragStartEvent,{capture:!0}),document.addEventListener("scroll",this.handleDocumentScrollEvent,{capture:!0})}componentWillUnmount(){document.removeEventListener("click",this.handleDocumentClickEvent,{capture:!0}),document.removeEventListener("contextmenu",this.handleDocumentContextualMenuEvent,{capture:!0}),document.removeEventListener("dragstart",this.handleDocumentDragStartEvent,{capture:!0}),document.removeEventListener("scroll",this.handleDocumentScrollEvent,{capture:!0})}handleDocumentClickEvent(e){this.selectedItemRef.current.contains(e.target)||this.selectItemsRef.current.contains(e.target)||this.closeSelect()}handleDocumentContextualMenuEvent(e){this.selectedItemRef.current.contains(e.target)||this.selectItemsRef.current.contains(e.target)||this.closeSelect()}handleDocumentDragStartEvent(){this.closeSelect()}handleDocumentScrollEvent(e){this.itemsRef.current.contains(e.target)||this.selectItemsRef.current.contains(e.target)||this.closeSelect()}handleSelectClick(){if(this.props.disabled)this.closeSelect();else{const e=!this.state.open;e?this.forceVisibilitySelect():this.resetStyleSelect(),this.setState({open:e})}}getFirstParentWithTransform(){let e=this.selectedItemRef.current.parentElement;for(;null!==e&&""===e.style.getPropertyValue("transform");)e=e.parentElement;return e}forceVisibilitySelect(){const e=this.selectedItemRef.current.getBoundingClientRect(),{width:t,height:s}=e;let{top:i,left:n}=e;const r=this.getFirstParentWithTransform();if(r){const e=r.getBoundingClientRect();i-=e.top,n-=e.left}const a={position:"fixed",zIndex:1,width:t,height:s,top:i,left:n};this.setState({style:a})}handleBlur(e){e.currentTarget.contains(e.relatedTarget)||this.closeSelect()}closeSelect(){this.resetStyleSelect(),this.setState({open:!1})}resetStyleSelect(){this.setState({style:void 0})}handleInputChange(e){const t=e.target,s=t.value,i=t.name;this.setState({[i]:s})}handleItemClick(e){if(this.setState({selectedValue:e.value,open:!1}),"function"==typeof this.props.onChange){const t={target:{value:e.value,name:this.props.name}};this.props.onChange(t)}this.closeSelect()}getItemsMatch(e,t){const s=t&&t.split(/\s+/)||[""];return e.filter(e=>s.every(t=>((e,t)=>(e=>new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(e),"i"))(e).test(t))(t,e.label)))}handleSelectKeyDown(e){switch(e.keyCode){case 13:return e.stopPropagation(),void this.handleSelectClick();case 40:return e.preventDefault(),e.stopPropagation(),void(this.state.open?this.focusItem(0):this.handleSelectClick());case 38:return e.preventDefault(),e.stopPropagation(),void(this.state.open?this.focusItem(this.listItemsFiltered.length-1):this.handleSelectClick());case 27:return e.stopPropagation(),void this.closeSelect();default:return}}focusItem(e){this.itemsRef.current.childNodes[e]?.focus()}handleItemKeyDown(e,t){switch(e.keyCode){case 13:return e.stopPropagation(),void this.handleItemClick(t);case 40:return e.stopPropagation(),e.preventDefault(),void(e.target.nextSibling?e.target.nextSibling.focus():this.focusItem(0));case 38:return e.stopPropagation(),e.preventDefault(),void(e.target.previousSibling?e.target.previousSibling.focus():this.focusItem(this.listItemsFiltered.length-1));default:return}}hasFilteredItems(){return this.listItemsFiltered.length>0}render(){return i.createElement("div",{className:`select-container ${this.props.className}`,style:{width:this.state.style?.width,height:this.state.style?.height}},i.createElement("div",{onKeyDown:this.handleSelectKeyDown,onBlur:this.handleBlur,id:this.props.id,className:`select ${this.props.direction} ${this.state.open?"open":""}`,style:this.state.style},i.createElement("div",{ref:this.selectedItemRef,className:"selected-value "+(this.props.disabled?"disabled":""),tabIndex:this.props.disabled?-1:0,onClick:this.handleSelectClick},i.createElement("span",{className:"value"},this.selectedItemLabel),i.createElement(Ce,null)),i.createElement("div",{ref:this.selectItemsRef,className:"select-items "+(this.state.open?"visible":"")},this.props.search&&i.createElement(i.Fragment,null,i.createElement("input",{className:"search-input",name:"search",value:this.state.search,onChange:this.handleInputChange,type:"text"}),i.createElement(Hs,{className:"search"})),i.createElement("ul",{ref:this.itemsRef,className:"items"},this.hasFilteredItems()&&this.listItemsFiltered.map(e=>i.createElement("li",{tabIndex:e.disabled?-1:0,key:e.value,title:e.title,className:`option ${e.value}`,onKeyDown:t=>this.handleItemKeyDown(t,e),onClick:()=>this.handleItemClick(e)},e.label)),!this.hasFilteredItems()&&this.props.search&&i.createElement("li",{className:"option no-results"},i.createElement(_.x,null,"No results match")," ",i.createElement("span",null,this.state.search))))))}}Ks.defaultProps={id:"",name:"select",className:"",direction:"bottom"},Ks.propTypes={id:d().string,name:d().string,className:d().string,direction:d().oneOf(Object.values({top:"top",bottom:"bottom",left:"left",right:"right"})),search:d().bool,items:d().array,value:Vs.allPropTypes(d().oneOfType([d().string,d().number,d().bool]),(e,t,s)=>{const i=e[t],n=e.items;if(null!==i&&n.length>0&&n.every(e=>e.value!==i))return new Error(`Invalid prop ${t} passed to ${s}. Expected the value ${i} in items.`)}),disabled:d().bool,onChange:d().func};const Bs=(0,P.C)("common")(Ks);class js extends i.Component{constructor(e){super(e),this.state=this.defaultState,this.bindHandlers()}componentDidMount(){this.initLocale()}componentDidUpdate(e){this.handleLocaleChange(e.context.locale)}handleLocaleChange(e){this.props.context.locale!==e&&this.setState({locale:this.props.context.locale})}get defaultState(){return{loading:!0,locale:null,processing:!1}}get areActionsAllowed(){return!this.state.processing}bindHandlers(){this.handleLocaleInputChange=this.handleLocaleInputChange.bind(this)}async handleLocaleInputChange(e){const t=e.target.value;this.updateLocale(t)}async updateLocale(e){this.setState({processing:!0}),await this.props.context.onUpdateLocaleRequested(e),this.setState({processing:!1})}initLocale(){this.setState({locale:this.props.context.locale,loading:!1})}isLoading(){return this.state.loading}get supportedLocales(){return this.props.context.siteSettings.supportedLocales?this.props.context.siteSettings.supportedLocales.map(e=>({value:e.locale,label:e.label})):[]}render(){return i.createElement(i.Fragment,null,!this.isLoading()&&i.createElement("div",{className:"select-wrapper input"},i.createElement(Bs,{id:"user-locale-input",className:"setup-extension",name:"locale",value:this.state.locale,disabled:!this.areActionsAllowed,items:this.supportedLocales,onChange:this.handleLocaleInputChange})))}}js.propTypes={context:d().any};const Ws=a(js);class Ys extends i.Component{get statesToHideLocaleSwitch(){return[A.INITIAL_STATE]}get mustDisplayLocaleSwitch(){return!this.statesToHideLocaleSwitch.includes(this.props.apiTriageContext.state)}render(){return i.createElement(i.Fragment,null,this.mustDisplayLocaleSwitch&&i.createElement(Ws,null))}}Ys.propTypes={apiTriageContext:d().any};const zs=C(Ys);var Zs,Js,Xs,Qs,ei;function ti(){return ti=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ti.apply(null,arguments)}const si=function(e){return i.createElement("svg",ti({xmlns:"http://www.w3.org/2000/svg",width:151,height:27,fill:"none","aria-labelledby":"logo-title logo-description",viewBox:"0 0 151 27"},e),Zs||(Zs=i.createElement("title",{id:"logo-title"},"Passbolt logo")),Js||(Js=i.createElement("desc",{id:"logo-description"},"This is the logo of passbolt.")),Xs||(Xs=i.createElement("path",{fill:"var(--icon-color)",d:"M4.648 9.234v8.607h2.48c1.646 0 2.786-.349 3.47-1.012.685-.664 1.013-1.823 1.013-3.395 0-1.52-.305-2.595-.938-3.218-.633-.673-1.695-.972-3.24-.972zM.597 5.963h7.797c2.357 0 4.178.676 5.496 2.048q1.976 2.058 1.974 5.689a8.6 8.6 0 0 1-.406 2.749 7.1 7.1 0 0 1-1.24 2.278 5.9 5.9 0 0 1-2.38 1.773c-.937.349-2.152.524-3.697.524H4.648V26.5H.597zM24.016 18.016h5.064v-3.119h-4.76c-.937 0-1.594.124-1.95.375-.357.25-.517.698-.517 1.321 0 .524.15.899.429 1.122.28.223.848.301 1.734.301M18.649 5.963h8.268c2.103 0 3.672.476 4.736 1.423 1.065.947 1.594 2.347 1.594 4.217v9.456H22.37c-1.52 0-2.708-.375-3.52-1.121-.81-.747-1.2-1.823-1.2-3.22 0-1.722.454-2.945 1.392-3.692s2.483-1.134 4.697-1.134h5.315v-.365c0-.898-.276-1.518-.809-1.896-.532-.377-1.47-.55-2.86-.55H18.65zM36.55 17.915h8.525c.76 0 1.318-.124 1.646-.35.183-.122.328-.29.423-.486.094-.197.134-.414.115-.63a1.2 1.2 0 0 0-.112-.632 1.24 1.24 0 0 0-.42-.492c-.355-.253-.91-.374-1.646-.374h-3.494c-2.067 0-3.467-.325-4.203-.947-.737-.623-1.088-1.747-1.088-3.32 0-1.62.431-2.82 1.318-3.592.886-.772 2.255-1.152 4.064-1.152h8.684v3.142h-7.134q-1.75 0-2.279.301c-.354.198-.532.547-.532 1.071-.017.193.016.387.096.564s.204.332.361.449c.302.223.809.324 1.468.324h3.676c1.672 0 2.961.397 3.824 1.172s1.315 1.871 1.315 3.32c0 1.397-.405 2.53-1.188 3.417-.37.427-.833.768-1.354.996-.522.23-1.09.34-1.661.325H36.549zM53.822 17.915h8.526c.76 0 1.318-.124 1.646-.35a1.23 1.23 0 0 0 .42-.487c.093-.196.132-.413.112-.629a1.2 1.2 0 0 0-.111-.632 1.24 1.24 0 0 0-.421-.492c-.354-.253-.91-.374-1.646-.374h-3.493c-2.067 0-3.467-.325-4.204-.947-.736-.623-1.088-1.752-1.088-3.324 0-1.62.432-2.82 1.318-3.593.886-.772 2.253-1.147 4.075-1.147h8.686v3.142h-7.141q-1.747 0-2.28.301c-.353.198-.531.547-.531 1.071-.017.193.016.387.096.564s.204.332.361.449c.302.223.809.324 1.468.324h3.671c1.672 0 2.963.397 3.824 1.172s1.315 1.871 1.315 3.32c0 1.397-.403 2.53-1.188 3.417-.37.427-.832.767-1.354.996a3.9 3.9 0 0 1-1.66.325H53.769v-3.106zM75.387.5v5.463h3.47c1.55 0 2.759.175 3.694.55.946.362 1.77.976 2.38 1.772a7.2 7.2 0 0 1 1.243 2.296c.281.888.417 1.814.403 2.744q0 3.63-1.974 5.689c-1.315 1.372-3.14 2.046-5.493 2.046h-7.8V.5zm2.462 8.734h-2.483v8.608h2.785c1.55 0 2.633-.324 3.243-.95s.935-1.721.935-3.268-.354-2.694-1.033-3.367c-.68-.673-1.832-1.023-3.447-1.023M92.3 13.525c0 1.445.328 2.532 1.013 3.367s1.62 1.198 2.86 1.198 2.152-.398 2.863-1.198 1.033-1.921 1.033-3.367-.356-2.547-1.033-3.344c-.677-.798-1.62-1.198-2.863-1.198a3.64 3.64 0 0 0-1.57.279 3.6 3.6 0 0 0-1.29.919c-.685.797-1.013 1.921-1.013 3.344m12.002 0q0 3.544-2.202 5.689c-1.47 1.397-3.42 2.121-5.901 2.121s-4.457-.699-5.924-2.121-2.202-3.292-2.202-5.664q0-3.558 2.202-5.69c1.467-1.424 3.444-2.145 5.919-2.145s4.431.724 5.901 2.144 2.207 3.294 2.207 5.666M110.935 21.06h-4.202V.5h4.202zM112.884 5.963h2.86V.5h4.052v5.463h4.278v3.02h-4.278v6.09c0 1.12.204 1.895.581 2.343.377.449 1.064.649 2.026.649h1.671v3.02h-3.72c-1.494 0-2.636-.4-3.444-1.223-.809-.823-1.189-1.995-1.189-3.519v-7.36h-2.863v-3.02z"})),Qs||(Qs=i.createElement("path",{fill:"var(--Passbolt-logo-passbolt-logo)",d:"m149.951 10.68-9.059-8.36a2.12 2.12 0 0 0-1.421-.543c-.526 0-1.033.194-1.421.544l-5.684 5.268c.745.271 1.414.71 1.952 1.282.539.572.933 1.26 1.149 2.01h7.673a.73.73 0 0 1 .504.204.69.69 0 0 1 .207.494v1.147a.68.68 0 0 1-.207.494.72.72 0 0 1-.504.204h-.886v1.623a.68.68 0 0 1-.205.494.72.72 0 0 1-.503.205h-1.945a.73.73 0 0 1-.503-.205.69.69 0 0 1-.205-.494v-1.623h-3.426a4.84 4.84 0 0 1-1.135 2.033 5 5 0 0 1-1.966 1.287l5.71 5.276c.388.349.895.543 1.421.543a2.12 2.12 0 0 0 1.421-.543l9.043-8.355a2.03 2.03 0 0 0-.01-2.985"})),ei||(ei=i.createElement("path",{fill:"var(--Passbolt-logo-passbolt-logo)",d:"M130.683 9.867a2.6 2.6 0 0 0-1.064.253c-.371.18-.686.455-.913.794a2.242 2.242 0 0 0-.113 2.305 2.3 2.3 0 0 0 .831.877 2.36 2.36 0 0 0 2.355.059c.362-.197.664-.484.875-.833a2.24 2.24 0 0 0 .324-1.153 2.21 2.21 0 0 0-.653-1.625 2.3 2.3 0 0 0-.751-.5 2.3 2.3 0 0 0-.891-.177"})))};class ii extends i.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{siteSettings:null,trustedDomain:this.baseUrl,getApiClientOptions:this.getApiClientOptions.bind(this),locale:null,onUpdateLocaleRequested:this.onUpdateLocaleRequested.bind(this)}}async componentDidMount(){const e=await this.getSiteSettings();this.initLocale(e)}get baseUrl(){const e=document.getElementsByTagName("base")&&document.getElementsByTagName("base")[0];return e?e.attributes.href.value.replace(/\/*$/g,""):(console.error("Unable to retrieve the page base tag"),"")}getApiClientOptions(){return(new l).setBaseUrl(this.state.trustedDomain)}async getSiteSettings(){const e=this.getApiClientOptions().setResourceName("settings"),t=new f(e),{body:s}=await t.findAll(),i=new le(s);return this.setState({siteSettings:i}),i}initLocale(e){const t=this.getUrlLocale(e)||this.getBrowserLocale(e)||this.getBrowserSimilarLocale(e)||e.locale;this.setState({locale:t}),this.setUrlLocale(t)}getUrlLocale(e){const t=new URL(window.location.href).searchParams.get("locale");if(t){const s=e.supportedLocales.find(e=>t===e.locale);if(s)return s.locale}}getBrowserLocale(e){const t=e.supportedLocales.find(e=>navigator.language===e.locale);if(t)return t.locale}getBrowserSimilarLocale(e){const t=navigator.language.split("-")[0],s=e.supportedLocales.find(e=>t===e.locale.split("-")[0]);if(s)return s.locale}onUpdateLocaleRequested(e){this.setState({locale:e}),this.setUrlLocale(e)}setUrlLocale(e){const t=new URL(window.location.href);t.searchParams.set("locale",e),window.history.replaceState(null,null,t)}isReady(){return null!==this.state.siteSettings&&null!==this.state.locale}render(){return i.createElement(o.Provider,{value:this.state},this.isReady()&&i.createElement(Ms,{loadingPath:`${this.state.trustedDomain}/locales/{{lng}}/{{ns}}.json`},i.createElement(v,null,i.createElement("div",{id:"container",className:"container page login"},i.createElement("div",{className:"content"},i.createElement("div",{className:"header"},i.createElement("div",{className:"logo-svg"},i.createElement(si,{role:"img",width:"20rem",height:"3.5rem"}))),i.createElement("div",{className:"login-form"},i.createElement(rt,null)),i.createElement(zs,null)),i.createElement(ks,null)))))}}const ni=ii,ri=document.createElement("div");document.body.appendChild(ri),(0,n.H)(ri).render(i.createElement(ni,null))}};const t={};function s(i){const n=t[i];if(void 0!==n)return n.exports;const r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,s),r.exports}s.m=e,(()=>{const e=[];s.O=(t,i,n)=>{if(!i){for(var r=0;r<e.length;r++){let[i,n]=e[r],o=!0;for(var a=0;a<i.length;a++)s.O.j(i[a])?i.splice(a--,1):o=!1;if(o){e.splice(r--,1);const s=n();void 0!==s&&(t=s)}}return t}e.push([i,n])}})(),s.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.cw=e=>{var t;return()=>{if(e){var s=e;e=0,t={exports:{}},s.call(t.exports,t,t.exports)}return t.exports}},s.d=(e,t)=>{if(Array.isArray(t))for(var i=0;i<t.length;){var n=t[i++],r=t[i++],a=0===r?{enumerable:!0,value:t[i++]}:{enumerable:!0,get:r};s.o(e,n)||Object.defineProperty(e,n,a)}else for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.j=666,s.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={666:0};s.O.j=t=>0===e[t];const t=(t,i)=>{let[n,r,a]=i;var o,l,c=0;if(n.some(t=>0!==e[t])){for(o in r)s.o(r,o)&&(s.m[o]=r[o]);if(a)var d=a(s)}for(t&&t(i);c<n.length;c++)l=n[c],s.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return s.O(d)},i=self.webpackChunkpassbolt_styleguide=self.webpackChunkpassbolt_styleguide||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();let i=s.O(void 0,[3847],()=>s(86954));i=s.O(i)})();