e525f6bd01d34fd4dcf52b0a4642dc7bfbf45e9507bbe16d8500a21ee9787925.json raw
1 {"ast":null,"code":"import _asyncToGenerator from \"/home/mleku/src/orly.dev/next/signer/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { Router } from '@angular/router';\nimport { LoggerService, NavComponent, StorageService, DerivingModalComponent } from '@common';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@angular/forms\";\nconst _c0 = [\"derivingModal\"];\nexport let NewComponent = /*#__PURE__*/(() => {\n class NewComponent extends NavComponent {\n derivingModal;\n password = '';\n #router = inject(Router);\n #storage = inject(StorageService);\n #logger = inject(LoggerService);\n toggleType(element) {\n if (element.type === 'password') {\n element.type = 'text';\n } else {\n element.type = 'password';\n }\n }\n createVault() {\n var _this = this;\n return _asyncToGenerator(function* () {\n if (!_this.password) {\n return;\n }\n // Show deriving modal during key derivation (~3-6 seconds)\n _this.derivingModal.show('Creating secure vault');\n try {\n yield _this.#storage.createNewVault(_this.password);\n _this.derivingModal.hide();\n _this.#logger.logVaultCreated();\n _this.#router.navigateByUrl('/home/identities');\n } catch (error) {\n _this.derivingModal.hide();\n console.error('Failed to create vault:', error);\n }\n })();\n }\n static ɵfac = /*@__PURE__*/(() => {\n let ɵNewComponent_BaseFactory;\n return function NewComponent_Factory(__ngFactoryType__) {\n return (ɵNewComponent_BaseFactory || (ɵNewComponent_BaseFactory = i0.ɵɵgetInheritedFactory(NewComponent)))(__ngFactoryType__ || NewComponent);\n };\n })();\n static ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: NewComponent,\n selectors: [[\"app-new\"]],\n viewQuery: function NewComponent_Query(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵviewQuery(_c0, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.derivingModal = _t.first);\n }\n },\n features: [i0.ɵɵInheritDefinitionFeature],\n decls: 20,\n vars: 6,\n consts: [[\"derivingModal\", \"\"], [\"passwordInputElement\", \"\"], [1, \"sam-text-header\"], [1, \"content\"], [1, \"sam-flex-column\", \"gap\", 2, \"align-items\", \"center\"], [1, \"logo-frame\"], [\"src\", \"logo.svg\", \"height\", \"120\", \"width\", \"120\", \"alt\", \"\"], [1, \"sam-mt-2\"], [1, \"sam-text-muted\"], [1, \"sam-mt\", \"input-group\"], [\"type\", \"password\", \"placeholder\", \"vault password\", 1, \"form-control\", \"form-control-lg\", 2, \"font-size\", \"1rem\", 3, \"ngModelChange\", \"ngModel\"], [\"type\", \"button\", 1, \"btn\", \"btn-outline-secondary\", 3, \"click\"], [1, \"bi\", \"bi-eye\"], [\"type\", \"button\", 1, \"sam-mt\", \"btn\", \"btn-primary\", 3, \"click\", \"disabled\"]],\n template: function NewComponent_Template(rf, ctx) {\n if (rf & 1) {\n const _r1 = i0.ɵɵgetCurrentView();\n i0.ɵɵelement(0, \"app-deriving-modal\", null, 0);\n i0.ɵɵelementStart(2, \"div\", 2)(3, \"span\");\n i0.ɵɵtext(4, \"Smesh Signer\");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(5, \"div\", 3)(6, \"div\", 4)(7, \"div\", 5);\n i0.ɵɵelement(8, \"img\", 6);\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(9, \"span\", 7);\n i0.ɵɵtext(10, \" Please define a password for your vault. \");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(11, \"small\", 8);\n i0.ɵɵtext(12, \" Sensitive data is encypted before it is stored. \");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(13, \"div\", 9)(14, \"input\", 10, 1);\n i0.ɵɵtwoWayListener(\"ngModelChange\", function NewComponent_Template_input_ngModelChange_14_listener($event) {\n i0.ɵɵrestoreView(_r1);\n i0.ɵɵtwoWayBindingSet(ctx.password, $event) || (ctx.password = $event);\n return i0.ɵɵresetView($event);\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(16, \"button\", 11);\n i0.ɵɵlistener(\"click\", function NewComponent_Template_button_click_16_listener() {\n i0.ɵɵrestoreView(_r1);\n const passwordInputElement_r2 = i0.ɵɵreference(15);\n return i0.ɵɵresetView(ctx.toggleType(passwordInputElement_r2));\n });\n i0.ɵɵelement(17, \"i\", 12);\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(18, \"button\", 13);\n i0.ɵɵlistener(\"click\", function NewComponent_Template_button_click_18_listener() {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView(ctx.createVault());\n });\n i0.ɵɵtext(19, \" Create vault \");\n i0.ɵɵelementEnd()()();\n }\n if (rf & 2) {\n const passwordInputElement_r2 = i0.ɵɵreference(15);\n i0.ɵɵadvance(14);\n i0.ɵɵtwoWayProperty(\"ngModel\", ctx.password);\n i0.ɵɵadvance(3);\n i0.ɵɵclassProp(\"bi-eye\", passwordInputElement_r2.type === \"password\")(\"bi-eye-slash\", passwordInputElement_r2.type === \"text\");\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"disabled\", !ctx.password || ctx.password.length < 4);\n }\n },\n dependencies: [FormsModule, i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgModel, DerivingModalComponent],\n styles: [\"[_nghost-%COMP%] {\\n height: 100%;\\n display: flex;\\n flex-direction: column;\\n color-scheme: dark;\\n}\\n[_nghost-%COMP%] .custom-header[_ngcontent-%COMP%] {\\n padding-top: var(--size);\\n padding-bottom: var(--size);\\n display: grid;\\n grid-template-columns: 1fr;\\n grid-template-rows: auto;\\n align-items: center;\\n}\\n[_nghost-%COMP%] .custom-header[_ngcontent-%COMP%] .back[_ngcontent-%COMP%] {\\n grid-column-start: 1;\\n grid-column-end: 2;\\n grid-row-start: 1;\\n grid-row-end: 2;\\n justify-self: start;\\n padding-left: var(--size);\\n}\\n[_nghost-%COMP%] .custom-header[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] {\\n grid-column-start: 1;\\n grid-column-end: 2;\\n grid-row-start: 1;\\n grid-row-end: 2;\\n font-size: 20px;\\n font-weight: 500;\\n justify-self: center;\\n}\\n[_nghost-%COMP%] .content[_ngcontent-%COMP%] {\\n display: flex;\\n flex-direction: column;\\n height: 100%;\\n justify-content: center;\\n padding: 0 var(--size) var(--size) var(--size);\\n}\"]\n });\n }\n return NewComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}