{"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 { Router } from '@angular/router';\nimport { LoggerService, NavComponent } from '@common';\nimport { DatePipe } from '@angular/common';\nimport * as i0 from \"@angular/core\";\nconst _forTrack0 = ($index, $item) => $item.timestamp;\nfunction LogsComponent_Conditional_5_Template(rf, ctx) {\n  if (rf & 1) {\n    const _r1 = i0.ɵɵgetCurrentView();\n    i0.ɵɵelementStart(0, \"button\", 11);\n    i0.ɵɵlistener(\"click\", function LogsComponent_Conditional_5_Template_button_click_0_listener() {\n      i0.ɵɵrestoreView(_r1);\n      const ctx_r1 = i0.ɵɵnextContext();\n      return i0.ɵɵresetView(ctx_r1.onTestPrompt());\n    });\n    i0.ɵɵelementStart(1, \"span\", 3);\n    i0.ɵɵtext(2, \"\\u2728\");\n    i0.ɵɵelementEnd()();\n  }\n}\nfunction LogsComponent_Conditional_14_Template(rf, ctx) {\n  if (rf & 1) {\n    i0.ɵɵelementStart(0, \"div\", 9);\n    i0.ɵɵtext(1, \"No activity logged yet\");\n    i0.ɵɵelementEnd();\n  }\n}\nfunction LogsComponent_For_16_Template(rf, ctx) {\n  if (rf & 1) {\n    i0.ɵɵelementStart(0, \"div\", 12)(1, \"span\", 13);\n    i0.ɵɵtext(2);\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(3, \"span\", 14);\n    i0.ɵɵtext(4);\n    i0.ɵɵpipe(5, \"date\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(6, \"span\", 15);\n    i0.ɵɵtext(7);\n    i0.ɵɵelementEnd()();\n  }\n  if (rf & 2) {\n    const log_r3 = ctx.$implicit;\n    const ctx_r1 = i0.ɵɵnextContext();\n    i0.ɵɵclassMap(ctx_r1.getLevelClass(log_r3.level));\n    i0.ɵɵadvance(2);\n    i0.ɵɵtextInterpolate(log_r3.icon);\n    i0.ɵɵadvance(2);\n    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(5, 5, log_r3.timestamp, \"HH:mm:ss\"));\n    i0.ɵɵadvance(3);\n    i0.ɵɵtextInterpolate(log_r3.message);\n  }\n}\nexport let LogsComponent = /*#__PURE__*/(() => {\n  class LogsComponent extends NavComponent {\n    #logger = inject(LoggerService);\n    #router = inject(Router);\n    get logs() {\n      return this.#logger.logs;\n    }\n    ngOnInit() {\n      // Refresh logs from storage to get background script logs\n      this.#logger.refreshLogs();\n    }\n    onRefresh() {\n      var _this = this;\n      return _asyncToGenerator(function* () {\n        yield _this.#logger.refreshLogs();\n      })();\n    }\n    onClear() {\n      var _this2 = this;\n      return _asyncToGenerator(function* () {\n        yield _this2.#logger.clear();\n      })();\n    }\n    getLevelClass(level) {\n      switch (level) {\n        case 'error':\n          return 'log-error';\n        case 'warn':\n          return 'log-warn';\n        case 'debug':\n          return 'log-debug';\n        default:\n          return 'log-info';\n      }\n    }\n    onClickLock() {\n      var _this3 = this;\n      return _asyncToGenerator(function* () {\n        _this3.#logger.logVaultLock();\n        yield _this3.storage.lockVault();\n        _this3.#router.navigateByUrl('/vault-login');\n      })();\n    }\n    static ɵfac = /*@__PURE__*/(() => {\n      let ɵLogsComponent_BaseFactory;\n      return function LogsComponent_Factory(__ngFactoryType__) {\n        return (ɵLogsComponent_BaseFactory || (ɵLogsComponent_BaseFactory = i0.ɵɵgetInheritedFactory(LogsComponent)))(__ngFactoryType__ || LogsComponent);\n      };\n    })();\n    static ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n      type: LogsComponent,\n      selectors: [[\"app-logs\"]],\n      features: [i0.ɵɵInheritDefinitionFeature],\n      decls: 17,\n      vars: 2,\n      consts: [[1, \"sam-text-header\"], [1, \"header-buttons\"], [\"title\", \"Lock\", 1, \"header-btn\", 3, \"click\"], [1, \"emoji\"], [\"title\", \"Test Permission Prompt\", 1, \"header-btn\"], [1, \"logs-actions\"], [\"title\", \"Refresh logs\", 1, \"btn\", \"btn-sm\", \"btn-secondary\", 3, \"click\"], [\"title\", \"Clear logs\", 1, \"btn\", \"btn-sm\", \"btn-secondary\", 3, \"click\"], [1, \"logs-container\"], [1, \"logs-empty\"], [1, \"log-entry\", 3, \"class\"], [\"title\", \"Test Permission Prompt\", 1, \"header-btn\", 3, \"click\"], [1, \"log-entry\"], [1, \"log-icon\", \"emoji\"], [1, \"log-time\"], [1, \"log-message\"]],\n      template: function LogsComponent_Template(rf, ctx) {\n        if (rf & 1) {\n          i0.ɵɵelementStart(0, \"div\", 0)(1, \"div\", 1)(2, \"button\", 2);\n          i0.ɵɵlistener(\"click\", function LogsComponent_Template_button_click_2_listener() {\n            return ctx.onClickLock();\n          });\n          i0.ɵɵelementStart(3, \"span\", 3);\n          i0.ɵɵtext(4, \"\\uD83D\\uDD12\");\n          i0.ɵɵelementEnd()();\n          i0.ɵɵtemplate(5, LogsComponent_Conditional_5_Template, 3, 0, \"button\", 4);\n          i0.ɵɵelementEnd();\n          i0.ɵɵelementStart(6, \"span\");\n          i0.ɵɵtext(7, \"Logs\");\n          i0.ɵɵelementEnd();\n          i0.ɵɵelementStart(8, \"div\", 5)(9, \"button\", 6);\n          i0.ɵɵlistener(\"click\", function LogsComponent_Template_button_click_9_listener() {\n            return ctx.onRefresh();\n          });\n          i0.ɵɵtext(10, \"Refresh\");\n          i0.ɵɵelementEnd();\n          i0.ɵɵelementStart(11, \"button\", 7);\n          i0.ɵɵlistener(\"click\", function LogsComponent_Template_button_click_11_listener() {\n            return ctx.onClear();\n          });\n          i0.ɵɵtext(12, \"Clear\");\n          i0.ɵɵelementEnd()()();\n          i0.ɵɵelementStart(13, \"div\", 8);\n          i0.ɵɵtemplate(14, LogsComponent_Conditional_14_Template, 2, 0, \"div\", 9);\n          i0.ɵɵrepeaterCreate(15, LogsComponent_For_16_Template, 8, 8, \"div\", 10, _forTrack0);\n          i0.ɵɵelementEnd();\n        }\n        if (rf & 2) {\n          i0.ɵɵadvance(5);\n          i0.ɵɵconditional(ctx.devMode ? 5 : -1);\n          i0.ɵɵadvance(9);\n          i0.ɵɵconditional(ctx.logs.length === 0 ? 14 : -1);\n          i0.ɵɵadvance();\n          i0.ɵɵrepeater(ctx.logs);\n        }\n      },\n      dependencies: [DatePipe],\n      styles: [\"[_nghost-%COMP%] {\\n  height: 100%;\\n  display: flex;\\n  flex-direction: column;\\n  padding-top: var(--size);\\n  padding-bottom: var(--size);\\n  overflow: hidden;\\n}\\n[_nghost-%COMP%]    > *[_ngcontent-%COMP%]:not(.sam-text-header) {\\n  margin-left: var(--size);\\n  margin-right: var(--size);\\n}\\n[_nghost-%COMP%]   .sam-text-header[_ngcontent-%COMP%] {\\n  margin-bottom: var(--size);\\n  flex-shrink: 0;\\n}\\n[_nghost-%COMP%]   .sam-text-header[_ngcontent-%COMP%]   .logs-actions[_ngcontent-%COMP%] {\\n  position: absolute;\\n  right: 0;\\n  display: flex;\\n  gap: 8px;\\n}\\n\\n.logs-container[_ngcontent-%COMP%] {\\n  flex: 1;\\n  overflow-y: auto;\\n  background: var(--background-light);\\n  border-radius: 8px;\\n  padding: var(--size-h);\\n}\\n\\n.logs-empty[_ngcontent-%COMP%] {\\n  color: var(--muted-foreground);\\n  text-align: center;\\n  padding: var(--size);\\n}\\n\\n.log-entry[_ngcontent-%COMP%] {\\n  font-family: var(--font-sans);\\n  font-size: 11px;\\n  padding: 6px 8px;\\n  border-radius: 4px;\\n  margin-bottom: 2px;\\n  display: flex;\\n  gap: 8px;\\n  align-items: center;\\n}\\n.log-entry.log-error[_ngcontent-%COMP%] {\\n  background: rgba(220, 53, 69, 0.15);\\n  color: #ff6b6b;\\n}\\n.log-entry.log-warn[_ngcontent-%COMP%] {\\n  background: rgba(255, 193, 7, 0.15);\\n  color: #ffc107;\\n}\\n.log-entry.log-debug[_ngcontent-%COMP%] {\\n  background: rgba(108, 117, 125, 0.15);\\n  color: #adb5bd;\\n}\\n.log-entry.log-info[_ngcontent-%COMP%] {\\n  background: rgba(13, 110, 253, 0.1);\\n  color: var(--foreground);\\n}\\n\\n.log-icon[_ngcontent-%COMP%] {\\n  font-size: 14px;\\n  flex-shrink: 0;\\n  width: 18px;\\n  text-align: center;\\n}\\n\\n.log-time[_ngcontent-%COMP%] {\\n  color: var(--muted-foreground);\\n  flex-shrink: 0;\\n  font-size: 10px;\\n}\\n\\n.log-message[_ngcontent-%COMP%] {\\n  flex: 1;\\n  word-break: break-word;\\n}\"]\n    });\n  }\n  return LogsComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}