@zaip-ai/cli 1.0.7 → 1.0.8

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 (410) hide show
  1. package/README.md +6 -4
  2. package/dist/services/adapters.d.ts +1 -1
  3. package/dist/services/adapters.d.ts.map +1 -1
  4. package/dist/services/adapters.js +15 -5
  5. package/dist/services/adapters.js.map +1 -1
  6. package/dist/services/adapters.test.js +1 -1
  7. package/dist/services/agent-adapters.d.ts +9 -0
  8. package/dist/services/agent-adapters.d.ts.map +1 -1
  9. package/dist/services/agent-adapters.js +38 -3
  10. package/dist/services/agent-adapters.js.map +1 -1
  11. package/dist/services/agent-adapters.test.js +8 -1
  12. package/dist/services/agent-adapters.test.js.map +1 -1
  13. package/dist/services/codex-config-template.d.ts +2 -1
  14. package/dist/services/codex-config-template.d.ts.map +1 -1
  15. package/dist/services/codex-config-template.js +13 -2
  16. package/dist/services/codex-config-template.js.map +1 -1
  17. package/dist/services/codex-rules.d.ts +1 -1
  18. package/dist/services/codex-rules.d.ts.map +1 -1
  19. package/dist/services/codex-rules.js +31 -7
  20. package/dist/services/codex-rules.js.map +1 -1
  21. package/dist/services/codex-subagent-hook-template.d.ts +1 -1
  22. package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
  23. package/dist/services/codex-subagent-hook-template.js +4 -1
  24. package/dist/services/codex-subagent-hook-template.js.map +1 -1
  25. package/dist/services/doctor.d.ts.map +1 -1
  26. package/dist/services/doctor.js +3 -1
  27. package/dist/services/doctor.js.map +1 -1
  28. package/dist/services/global-codex-config.d.ts +6 -3
  29. package/dist/services/global-codex-config.d.ts.map +1 -1
  30. package/dist/services/global-codex-config.js +82 -13
  31. package/dist/services/global-codex-config.js.map +1 -1
  32. package/dist/services/global-codex-config.test.js +57 -10
  33. package/dist/services/global-codex-config.test.js.map +1 -1
  34. package/dist/services/install-agents-template.d.ts.map +1 -1
  35. package/dist/services/install-agents-template.js +15 -2
  36. package/dist/services/install-agents-template.js.map +1 -1
  37. package/dist/services/logger.js +1 -1
  38. package/dist/services/logger.js.map +1 -1
  39. package/dist/services/logger.test.js +3 -3
  40. package/dist/services/logger.test.js.map +1 -1
  41. package/dist/services/runtime-template.test.js +21 -5
  42. package/dist/services/runtime-template.test.js.map +1 -1
  43. package/dist/services/template-manifest.d.ts.map +1 -1
  44. package/dist/services/template-manifest.js +2 -0
  45. package/dist/services/template-manifest.js.map +1 -1
  46. package/package.json +1 -1
  47. package/templates/.agents/config/agents/catalog.yaml +310 -10
  48. package/templates/.agents/config/clients/codex/agents/zaip-agent-brand-strategist.toml +30 -0
  49. package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +5 -5
  50. package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +1 -1
  51. package/templates/.agents/config/clients/codex/agents/zaip-agent-general-operations.toml +30 -0
  52. package/templates/.agents/config/clients/codex/agents/zaip-agent-governance-compliance.toml +30 -0
  53. package/templates/.agents/config/clients/codex/agents/zaip-agent-growth-strategist.toml +30 -0
  54. package/templates/.agents/config/clients/codex/agents/zaip-agent-marketing-analyst.toml +8 -8
  55. package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +5 -3
  56. package/templates/.agents/config/clients/codex/agents/zaip-agent-sales-specialist.toml +30 -0
  57. package/templates/.agents/config/project.yaml +1 -1
  58. package/templates/.agents/dashboard/.zaip-managed.json +659 -163
  59. package/templates/.agents/dashboard/DATA-DICTIONARY.md +2227 -0
  60. package/templates/.agents/dashboard/README.md +48 -97
  61. package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-Z60df2r-.js +1 -0
  62. package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-Cv-JcoxP.js → DashboardHelpDialog-Cs6dzDmW.js} +294 -109
  63. package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-Coc6pA-1.js +1 -0
  64. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-QE1k9yZB.css +1 -0
  65. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-_Pf5DA_A.js +3 -0
  66. package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BVlz3DLZ.js +1 -0
  67. package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-CaKwQP43.css +1 -0
  68. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-BZ5WdaMN.css +1 -0
  69. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-Cf9ctPVt.js +68 -0
  70. package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-C98LGC-Q.js → dashboard-localization-CLJ0lT9v.js} +1 -1
  71. package/templates/.agents/dashboard/apps/frontend/dist/assets/icons-vendor-DFBuc_qp.js +1 -0
  72. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8A4DcNXM.js +2 -0
  73. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DK_enB5Z.css +1 -0
  74. package/templates/.agents/dashboard/apps/frontend/dist/assets/react-vendor-CCQOHdVI.js +9 -0
  75. package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-D9-fqq9M.js +1 -0
  76. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DFY7ZDlu.css +1 -0
  77. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-pC2_0J8x.js +1 -0
  78. package/templates/.agents/dashboard/apps/frontend/dist/index.html +9 -2
  79. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  80. package/templates/.agents/dashboard/apps/frontend/src/App.tsx +952 -595
  81. package/templates/.agents/dashboard/apps/frontend/src/AppLoadingBoundary.tsx +48 -0
  82. package/templates/.agents/dashboard/apps/frontend/src/AppLoadingPanels.tsx +2 -0
  83. package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +247 -0
  84. package/templates/.agents/dashboard/apps/frontend/src/AppRequestGuards.tsx +95 -0
  85. package/templates/.agents/dashboard/apps/frontend/src/AppSetupRoutes.tsx +87 -0
  86. package/templates/.agents/dashboard/apps/frontend/src/CostCalculationGuidePage.tsx +641 -0
  87. package/templates/.agents/dashboard/apps/frontend/src/DashboardAlternateContent.tsx +159 -0
  88. package/templates/.agents/dashboard/apps/frontend/src/DashboardCapabilityNav.tsx +13 -13
  89. package/templates/.agents/dashboard/apps/frontend/src/DashboardGlobalSettings.tsx +56 -0
  90. package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +257 -313
  91. package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +149 -0
  92. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.test.ts +35 -0
  93. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.tsx +111 -12
  94. package/templates/.agents/dashboard/apps/frontend/src/app-preferences.ts +15 -0
  95. package/templates/.agents/dashboard/apps/frontend/src/app-session-token.ts +20 -0
  96. package/templates/.agents/dashboard/apps/frontend/src/cost-calculation-guide.css +267 -0
  97. package/templates/.agents/dashboard/apps/frontend/src/cost-calculation-guide.test.ts +69 -0
  98. package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +70 -0
  99. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +111 -0
  100. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +432 -13
  101. package/templates/.agents/dashboard/apps/frontend/src/dashboard-localization.ts +1 -1
  102. package/templates/.agents/dashboard/apps/frontend/src/main.tsx +1 -0
  103. package/templates/.agents/dashboard/apps/frontend/src/operations-detail-hydration.test.ts +55 -0
  104. package/templates/.agents/dashboard/apps/frontend/src/operations-detail-hydration.ts +36 -0
  105. package/templates/.agents/dashboard/apps/frontend/src/operations-entity-page-projection.test.ts +126 -0
  106. package/templates/.agents/dashboard/apps/frontend/src/operations-entity-page-projection.ts +181 -0
  107. package/templates/.agents/dashboard/apps/frontend/src/operations-period-contract.test.ts +138 -0
  108. package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +105 -0
  109. package/templates/.agents/dashboard/apps/frontend/src/operations-period.test.ts +6 -3
  110. package/templates/.agents/dashboard/apps/frontend/src/operations-period.ts +9 -5
  111. package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +24 -0
  112. package/templates/.agents/dashboard/apps/frontend/src/period-transition-overlay.css +44 -0
  113. package/templates/.agents/dashboard/apps/frontend/src/project-settings-model.ts +121 -62
  114. package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +471 -2
  115. package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +84 -17
  116. package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +44 -0
  117. package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +196 -39
  118. package/templates/.agents/dashboard/apps/frontend/src/snapshot-notice.ts +15 -0
  119. package/templates/.agents/dashboard/apps/frontend/src/sqlite-cost-adapters.ts +26 -0
  120. package/templates/.agents/dashboard/apps/frontend/src/styles.css +14 -2
  121. package/templates/.agents/dashboard/apps/frontend/src/traceability-workspace.css +38 -2
  122. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +187 -0
  123. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +190 -0
  124. package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +121 -0
  125. package/templates/.agents/dashboard/apps/frontend/src/use-app-operations-pages.ts +398 -0
  126. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +141 -0
  127. package/templates/.agents/dashboard/apps/frontend/src/use-idle-cost-prefetch.ts +45 -0
  128. package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.test.ts +46 -0
  129. package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.ts +37 -0
  130. package/templates/.agents/dashboard/apps/frontend/vite.config.ts +55 -5
  131. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  132. package/templates/.agents/dashboard/modules/cost-monitor/src/contracts.ts +47 -6
  133. package/templates/.agents/dashboard/modules/cost-monitor/src/duration-estimate.ts +13 -0
  134. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +64 -0
  135. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +275 -0
  136. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.test.ts +100 -15
  137. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.tsx +131 -40
  138. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.tsx +137 -19
  139. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.test.ts +2 -0
  140. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.tsx +13 -10
  141. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +303 -0
  142. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +226 -6
  143. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +479 -402
  144. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostSummary.tsx +5 -13
  145. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +312 -72
  146. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +373 -321
  147. package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.test.ts +17 -0
  148. package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.tsx +25 -6
  149. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-copy.ts +0 -2
  150. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-helpers.ts +17 -0
  151. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-responsive.css +6 -3
  152. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-row-filters.ts +123 -0
  153. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-summary.ts +8 -3
  154. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-views.ts +32 -0
  155. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor.css +52 -14
  156. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-presentation.ts +121 -0
  157. package/templates/.agents/dashboard/modules/cost-monitor/src/react/index.ts +3 -0
  158. package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.test.ts +68 -0
  159. package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +32 -5
  160. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +108 -0
  161. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.test.ts +12 -0
  162. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +60 -0
  163. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +106 -0
  164. package/templates/.agents/dashboard/modules/cost-monitor/src/server/aggregate.test.ts +2 -2
  165. package/templates/.agents/dashboard/modules/cost-monitor/src/server/aggregate.ts +5 -3
  166. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-pricing-fallback.test.ts +53 -0
  167. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.basics.test.ts +34 -0
  168. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test.ts +168 -137
  169. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.ts +188 -29
  170. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.test.ts +956 -0
  171. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +775 -0
  172. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-terminal-day.test.ts +95 -0
  173. package/templates/.agents/dashboard/modules/cost-monitor/src/server/index.ts +1 -0
  174. package/templates/.agents/dashboard/modules/cost-monitor/src/server/refactor-map-xr9l.json +61 -0
  175. package/templates/.agents/dashboard/modules/cost-monitor/src/task-cost-groups.test.ts +41 -0
  176. package/templates/.agents/dashboard/modules/cost-monitor/src/task-cost-groups.ts +55 -11
  177. package/templates/.agents/dashboard/modules/operations/package.json +2 -1
  178. package/templates/.agents/dashboard/modules/operations/src/contracts.ts +182 -0
  179. package/templates/.agents/dashboard/modules/operations/src/duration-population.test.ts +63 -1
  180. package/templates/.agents/dashboard/modules/operations/src/duration-population.ts +60 -5
  181. package/templates/.agents/dashboard/modules/operations/src/react/EntityDetailsDialog.tsx +14 -3
  182. package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.test.ts +44 -1
  183. package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +325 -18
  184. package/templates/.agents/dashboard/modules/operations/src/react/MacroPlanningDialog.tsx +1 -0
  185. package/templates/.agents/dashboard/modules/operations/src/react/OperationDateFilters.test.ts +9 -5
  186. package/templates/.agents/dashboard/modules/operations/src/react/OperationDateFilters.tsx +2 -2
  187. package/templates/.agents/dashboard/modules/operations/src/react/OperationsMainContent.tsx +168 -0
  188. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +95 -6
  189. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +365 -14
  190. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +532 -131
  191. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +314 -358
  192. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageNavigation.tsx +68 -0
  193. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +169 -0
  194. package/templates/.agents/dashboard/modules/operations/src/react/PeriodSummaryTable.tsx +51 -8
  195. package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.test.tsx +32 -0
  196. package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.tsx +62 -6
  197. package/templates/.agents/dashboard/modules/operations/src/react/TaskBoard.test.ts +55 -0
  198. package/templates/.agents/dashboard/modules/operations/src/react/TaskBoard.tsx +27 -19
  199. package/templates/.agents/dashboard/modules/operations/src/react/TaskDetailsDialog.tsx +99 -42
  200. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.priority.test.ts +19 -0
  201. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +255 -34
  202. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +163 -8
  203. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +101 -68
  204. package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.test.ts +72 -1
  205. package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.ts +78 -16
  206. package/templates/.agents/dashboard/modules/operations/src/react/execution-metrics.ts +6 -4
  207. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +50 -1
  208. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +143 -9
  209. package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +29 -4
  210. package/templates/.agents/dashboard/modules/operations/src/react/macro-planning-dialog-content.css +49 -0
  211. package/templates/.agents/dashboard/modules/operations/src/react/macro-planning-dialog.css +93 -50
  212. package/templates/.agents/dashboard/modules/operations/src/react/manual-work-priority.test.ts +82 -0
  213. package/templates/.agents/dashboard/modules/operations/src/react/operation-date-range.test.ts +29 -2
  214. package/templates/.agents/dashboard/modules/operations/src/react/operation-date-range.ts +22 -1
  215. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.test.ts +77 -4
  216. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.ts +65 -5
  217. package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +54 -0
  218. package/templates/.agents/dashboard/modules/operations/src/react/operations-global-filters.test.ts +19 -0
  219. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +149 -12
  220. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +27 -0
  221. package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +136 -0
  222. package/templates/.agents/dashboard/modules/operations/src/react/operations-period-scope.test.ts +160 -0
  223. package/templates/.agents/dashboard/modules/operations/src/react/operations-period-scope.ts +47 -0
  224. package/templates/.agents/dashboard/modules/operations/src/react/operations-query.ts +10 -0
  225. package/templates/.agents/dashboard/modules/operations/src/react/operations-responsive.css +3 -0
  226. package/templates/.agents/dashboard/modules/operations/src/react/operations-view-labels.ts +28 -0
  227. package/templates/.agents/dashboard/modules/operations/src/react/operations-view-order.test.ts +24 -7
  228. package/templates/.agents/dashboard/modules/operations/src/react/operations.css +42 -0
  229. package/templates/.agents/dashboard/modules/operations/src/react/period-summary-population.test.ts +54 -0
  230. package/templates/.agents/dashboard/modules/operations/src/react/period-summary-population.ts +32 -0
  231. package/templates/.agents/dashboard/modules/operations/src/react/period-summary.test.ts +165 -6
  232. package/templates/.agents/dashboard/modules/operations/src/react/period-summary.ts +148 -6
  233. package/templates/.agents/dashboard/modules/operations/src/react/popup-localization.test.ts +1 -1
  234. package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.css +132 -0
  235. package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.css.test.ts +13 -0
  236. package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.header.test.ts +16 -0
  237. package/templates/.agents/dashboard/modules/operations/src/react/use-infinite-column.ts +11 -5
  238. package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +5 -3
  239. package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.ts +4 -83
  240. package/templates/.agents/dashboard/modules/operations/src/server/build-operations-projection.test.ts +291 -15
  241. package/templates/.agents/dashboard/modules/operations/src/server/build-operations-projection.ts +182 -472
  242. package/templates/.agents/dashboard/modules/operations/src/server/canonical-compat.test.ts +40 -0
  243. package/templates/.agents/dashboard/modules/operations/src/server/canonical-compat.ts +19 -6
  244. package/templates/.agents/dashboard/modules/operations/src/server/canonical-run-projection.ts +31 -6
  245. package/templates/.agents/dashboard/modules/operations/src/server/daily-duration-projection.ts +220 -0
  246. package/templates/.agents/dashboard/modules/operations/src/server/execution-duration-projection.ts +28 -0
  247. package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.test.ts +27 -2
  248. package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.ts +22 -13
  249. package/templates/.agents/dashboard/modules/operations/src/server/filter.test.ts +3 -3
  250. package/templates/.agents/dashboard/modules/operations/src/server/filter.ts +7 -2
  251. package/templates/.agents/dashboard/modules/operations/src/server/index.ts +3 -0
  252. package/templates/.agents/dashboard/modules/operations/src/server/macro.ts +3 -12
  253. package/templates/.agents/dashboard/modules/operations/src/server/manifest-usage.ts +65 -0
  254. package/templates/.agents/dashboard/modules/operations/src/server/operations-projection-aggregates.ts +297 -0
  255. package/templates/.agents/dashboard/modules/operations/src/server/quick-daily-operations-projection.ts +324 -0
  256. package/templates/.agents/dashboard/modules/operations/src/server/quick-operations-projection.test.ts +505 -0
  257. package/templates/.agents/dashboard/modules/operations/src/server/quick-operations-projection.ts +609 -0
  258. package/templates/.agents/dashboard/modules/operations/src/server/runs.ts +18 -19
  259. package/templates/.agents/dashboard/modules/operations/src/work-board-model.ts +76 -0
  260. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  261. package/templates/.agents/dashboard/modules/traceability/src/server/build-task-trace.ts +3 -1
  262. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  263. package/templates/.agents/dashboard/packages/branding/src/index.ts +1 -1
  264. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  265. package/templates/.agents/dashboard/packages/contracts/src/index.ts +1 -0
  266. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  267. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +1756 -0
  268. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +1608 -0
  269. package/templates/.agents/dashboard/packages/local-runtime/package.json +8 -3
  270. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-dashboard.mjs +12 -0
  271. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +83 -0
  272. package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +28 -0
  273. package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-read-model.mjs +262 -0
  274. package/templates/.agents/dashboard/packages/local-runtime/scripts/test-unix-launchers.mjs +41 -0
  275. package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +105 -0
  276. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +1643 -107
  277. package/templates/.agents/dashboard/packages/local-runtime/src/agent-adapter-sync.ts +30 -0
  278. package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.test.ts +3 -2
  279. package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.ts +5 -0
  280. package/templates/.agents/dashboard/packages/local-runtime/src/manifest-runs.ts +72 -33
  281. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +335 -4
  282. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +392 -1
  283. package/templates/.agents/dashboard/packages/local-runtime/src/runtime.mjs +5 -5
  284. package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +71 -0
  285. package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +179 -0
  286. package/templates/.agents/dashboard/packages/local-runtime/src/server-cross-layer-parity.test.ts +245 -0
  287. package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models-route.ts +64 -0
  288. package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models.test.ts +204 -0
  289. package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models.ts +194 -0
  290. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.test.ts +163 -0
  291. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.ts +354 -0
  292. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-runs-route.test.ts +74 -0
  293. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-runs-route.ts +113 -0
  294. package/templates/.agents/dashboard/packages/local-runtime/src/server-overview.test.ts +68 -0
  295. package/templates/.agents/dashboard/packages/local-runtime/src/server-period.ts +47 -0
  296. package/templates/.agents/dashboard/packages/local-runtime/src/server-projections.ts +483 -0
  297. package/templates/.agents/dashboard/packages/local-runtime/src/server-settings.test.ts +5 -2
  298. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +163 -84
  299. package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +145 -0
  300. package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +551 -266
  301. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +1145 -308
  302. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.test.ts +53 -0
  303. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.ts +708 -0
  304. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +2232 -0
  305. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +6151 -0
  306. package/templates/.agents/dashboard/packages/local-runtime/src/work-priority-contract.test.ts +33 -0
  307. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-history.mjs +41 -0
  308. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-processes.mjs +210 -0
  309. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +437 -190
  310. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +299 -24
  311. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  312. package/templates/.agents/dashboard/packages/windows-launcher/LauncherVerificationBehaviorTests.cs +206 -0
  313. package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +95 -8
  314. package/templates/.agents/dashboard/packages/windows-launcher/build-dashboard-launcher.ps1 +2 -2
  315. package/templates/.agents/dashboard/packages/windows-launcher/run-launcher-verification-tests.ps1 +22 -0
  316. package/templates/.agents/dashboard/read-model.dbml +2201 -0
  317. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  318. package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +1 -1
  319. package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +214 -41
  320. package/templates/.agents/dashboard/work-priority.json +34 -0
  321. package/templates/.agents/dashboard/zaip-dashboard-linux.sh +45 -0
  322. package/templates/.agents/dashboard/zaip-dashboard-mac.command +3 -0
  323. package/templates/.agents/dashboard/zaip-dashboard-windows.exe +0 -0
  324. package/templates/.agents/design/.zaip-managed.json +3 -3
  325. package/templates/.agents/design/apps/catalog/package.json +1 -1
  326. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  327. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  328. package/templates/.agents/requirements/comparative-audit.md +1 -1
  329. package/templates/.agents/requirements/context-engine.md +1 -1
  330. package/templates/.agents/requirements/cost-observability.md +1 -1
  331. package/templates/.agents/requirements/dashboard-launch.md +24 -0
  332. package/templates/.agents/requirements/data-export.md +1 -1
  333. package/templates/.agents/requirements/design-system.md +1 -1
  334. package/templates/.agents/requirements/execution-engine.md +1 -1
  335. package/templates/.agents/requirements/kanban-dashboard.md +4 -3
  336. package/templates/.agents/requirements/model-orchestration.md +1 -1
  337. package/templates/.agents/requirements/public-distribution.md +9 -6
  338. package/templates/.agents/requirements/software-architecture.md +1 -1
  339. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  340. package/templates/.agents/requirements/work-lifecycle.md +9 -3
  341. package/templates/.agents/requirements/zaip-strategic-95.md +4 -4
  342. package/templates/.agents/rules/autonomy-decision.md +15 -0
  343. package/templates/.agents/rules/core.md +1 -1
  344. package/templates/.agents/rules/run-lifecycle-closure.md +1 -1
  345. package/templates/.agents/rules/specialist-routing.md +19 -0
  346. package/templates/.agents/rules/workflow.md +1 -1
  347. package/templates/.agents/runtime/VERSION +1 -1
  348. package/templates/.agents/runtime/bin/zaip.mjs +114 -64
  349. package/templates/.agents/runtime/checksums.sha256 +6 -4
  350. package/templates/.agents/runtime/manifest.json +3 -1
  351. package/templates/.agents/runtime/pnpm-lock.sha256 +1 -0
  352. package/templates/.agents/runtime/provenance.json +11 -0
  353. package/templates/.agents/runtime/sbom.cdx.json +1929 -39
  354. package/templates/.agents/skills/zaip-aios/SKILL.md +1 -1
  355. package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +15 -0
  356. package/templates/.agents/skills/zaip-skill-brand-governance/agents/openai.yaml +4 -0
  357. package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-standards.md +30 -0
  358. package/templates/.agents/skills/zaip-skill-dashboard-sqlite/SKILL.md +25 -0
  359. package/templates/.agents/skills/zaip-skill-dashboard-sqlite/agents/openai.yaml +4 -0
  360. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/SKILL.md +18 -0
  361. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/agents/openai.yaml +6 -0
  362. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.mjs +71 -0
  363. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.test.mjs +60 -0
  364. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/scheduled-ready-queue-contract.test.mjs +111 -0
  365. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +2 -2
  366. package/templates/.agents/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +3 -1
  367. package/templates/.agents/skills/zaip-skill-general-operations/SKILL.md +12 -0
  368. package/templates/.agents/skills/zaip-skill-general-operations/agents/openai.yaml +4 -0
  369. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +9 -7
  370. package/templates/.agents/skills/zaip-skill-github-deploy/agents/openai.yaml +2 -2
  371. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +11 -38
  372. package/templates/.agents/skills/zaip-skill-governance-compliance/SKILL.md +12 -0
  373. package/templates/.agents/skills/zaip-skill-governance-compliance/agents/openai.yaml +4 -0
  374. package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +15 -0
  375. package/templates/.agents/skills/zaip-skill-growth-strategy-revops/agents/openai.yaml +4 -0
  376. package/templates/.agents/skills/zaip-skill-growth-strategy-revops/references/growth-revops-framework.md +25 -0
  377. package/templates/.agents/skills/zaip-skill-instalar-agendamento/SKILL.md +17 -0
  378. package/templates/.agents/skills/zaip-skill-instalar-agendamento/agents/openai.yaml +6 -0
  379. package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +3 -3
  380. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +76 -27
  381. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +128 -24
  382. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +122 -4
  383. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +66 -19
  384. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.test.mjs +193 -7
  385. package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +14 -0
  386. package/templates/.agents/skills/zaip-skill-sales-methodology/agents/openai.yaml +4 -0
  387. package/templates/.agents/skills/zaip-skill-sales-methodology/references/sales-process-framework.md +77 -0
  388. package/templates/.agents/skills/zaip-skill-setup/SKILL.md +5 -0
  389. package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +96 -0
  390. package/templates/.agents/skills/zaip-skill-sqlite-read-model/agents/openai.yaml +4 -0
  391. package/templates/.agents/skills/zaip-skill-sqlite-read-model/scripts/ensure-node.mjs +18 -0
  392. package/templates/.agents/zaip-aios/INDEX.md +1 -0
  393. package/templates/.agents/zaip-aios/README.md +37 -8
  394. package/templates/.agents/zaip-aios/VERSION +1 -1
  395. package/templates/.agents/zaip-aios/guides/09-agentes-e-squads.md +43 -6
  396. package/templates/.agents/zaip-aios/guides/10-seguranca.md +21 -7
  397. package/templates/.agents/zaip-aios/guides/17-como-o-custo-e-calculado.md +32 -0
  398. package/templates/template-manifest.json +945 -214
  399. package/templates/.agents/dashboard/apps/frontend/dist/assets/AgentCatalogSettingsPage-CLYIi7Vo.js +0 -1
  400. package/templates/.agents/dashboard/apps/frontend/dist/assets/AgentCatalogSettingsPage-DTDNVQGX.css +0 -1
  401. package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-CzEggcRb.js +0 -1
  402. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-05YKn6Z4.js +0 -3
  403. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-YO3yqtgV.css +0 -1
  404. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8AzCnl3a.js +0 -77
  405. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DdBYQ_8D.css +0 -1
  406. package/templates/.agents/dashboard/apps/frontend/src/AgentCatalogSettingsPage.tsx +0 -617
  407. package/templates/.agents/dashboard/apps/frontend/src/agent-catalog-settings-page.css +0 -660
  408. package/templates/.agents/dashboard/apps/frontend/src/agent-catalog-settings.test.ts +0 -249
  409. package/templates/.agents/dashboard/dashboard.config.json +0 -4
  410. package/templates/.agents/dashboard/zaip-dashboard.exe +0 -0
@@ -0,0 +1,1756 @@
1
+ "use strict";var jC=Object.create;var fc=Object.defineProperty;var DC=Object.getOwnPropertyDescriptor;var UC=Object.getOwnPropertyNames;var zC=Object.getPrototypeOf,FC=Object.prototype.hasOwnProperty;var L=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(i){throw n=[i],i}};var M=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},ey=(e,t)=>{for(var n in t)fc(e,n,{get:t[n],enumerable:!0})},ty=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of UC(t))!FC.call(e,r)&&r!==n&&fc(e,r,{get:()=>t[r],enumerable:!(i=DC(t,r))||i.enumerable});return e};var Be=(e,t,n)=>(n=e!=null?jC(zC(e)):{},ty(t||!e||!e.__esModule?fc(n,"default",{value:e,enumerable:!0}):n,e)),qC=e=>ty(fc({},"__esModule",{value:!0}),e);var Ni=M(Rt=>{"use strict";var Ry;Object.defineProperty(Rt,"__esModule",{value:!0});Rt.globalConfig=Rt.$ZodEncodeError=Rt.$ZodAsyncError=Rt.$brand=Rt.NEVER=void 0;Rt.$constructor=j$;Rt.config=D$;Rt.NEVER=Object.freeze({status:"aborted"});function j$(e,t,n){function i(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,l);let c=a.prototype,d=Object.keys(c);for(let u=0;u<d.length;u++){let _=d[u];_ in s||(s[_]=c[_].bind(s))}}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function a(s){var l;let c=n?.Parent?new o:this;i(c,s),(l=c._zod).deferred??(l.deferred=[]);for(let d of c._zod.deferred)d();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Rt.$brand=Symbol("zod_brand");var K_=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};Rt.$ZodAsyncError=K_;var G_=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};Rt.$ZodEncodeError=G_;(Ry=globalThis).__zod_globalConfig??(Ry.__zod_globalConfig={});Rt.globalConfig=globalThis.__zod_globalConfig;function D$(e){return e&&Object.assign(Rt.globalConfig,e),Rt.globalConfig}});var le=M(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.Class=ne.BIGINT_FORMAT_RANGES=ne.NUMBER_FORMAT_RANGES=ne.primitiveTypes=ne.propertyKeyTypes=ne.getParsedType=ne.allowsEval=ne.captureStackTrace=void 0;ne.assertEqual=z$;ne.assertNotEqual=F$;ne.assertIs=q$;ne.assertNever=V$;ne.assert=W$;ne.getEnumValues=Z$;ne.joinValues=B$;ne.jsonStringifyReplacer=H$;ne.cached=$y;ne.nullish=J$;ne.cleanRegex=K$;ne.floatSafeRemainder=G$;ne.defineLazy=X$;ne.objectClone=Y$;ne.assignProp=ni;ne.mergeDefs=Lr;ne.cloneDef=Q$;ne.getElementAtPath=eI;ne.promiseAllObject=tI;ne.randomString=nI;ne.esc=rI;ne.slugify=iI;ne.isObject=X_;ne.isPlainObject=kc;ne.shallowClone=oI;ne.numKeys=aI;ne.escapeRegex=cI;ne.clone=ri;ne.normalizeParams=lI;ne.createTransparentProxy=uI;ne.stringifyPrimitive=Iy;ne.optionalKeys=dI;ne.pick=_I;ne.omit=pI;ne.extend=fI;ne.safeExtend=mI;ne.merge=gI;ne.partial=hI;ne.required=yI;ne.aborted=vI;ne.explicitlyAborted=bI;ne.prefixIssues=SI;ne.unwrapMessage=Aa;ne.finalizeIssue=kI;ne.getSizableOrigin=wI;ne.getLengthableOrigin=EI;ne.parsedType=AI;ne.issue=TI;ne.cleanEnum=xI;ne.base64ToUint8Array=Ny;ne.uint8ArrayToBase64=Py;ne.base64urlToUint8Array=OI;ne.uint8ArrayToBase64url=RI;ne.hexToUint8Array=CI;ne.uint8ArrayToHex=$I;var U$=Ni();function z$(e){return e}function F$(e){return e}function q$(e){}function V$(e){throw new Error("Unexpected value in exhaustive check")}function W$(e){}function Z$(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function B$(e,t="|"){return e.map(n=>Iy(n)).join(t)}function H$(e,t){return typeof t=="bigint"?t.toString():t}function $y(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function J$(e){return e==null}function K$(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function G$(e,t){let n=e/t,i=Math.round(n),r=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var Cy=Symbol("evaluating");function X$(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==Cy)return i===void 0&&(i=Cy,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Y$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ni(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Lr(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function Q$(e){return Lr(e._zod.def)}function eI(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function tI(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function nI(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function rI(e){return JSON.stringify(e)}function iI(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}ne.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function X_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}ne.allowsEval=$y(()=>{if(U$.globalConfig.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function kc(e){if(X_(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(X_(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function oI(e){return kc(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function aI(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var sI=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};ne.getParsedType=sI;ne.propertyKeyTypes=new Set(["string","number","symbol"]);ne.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function cI(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ri(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function lI(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function uI(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function Iy(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dI(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}ne.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};ne.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function _I(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Lr(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=n.shape[s])}return ni(this,"shape",a),a},checks:[]});return ri(e,o)}function pI(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Lr(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return ni(this,"shape",a),a},checks:[]});return ri(e,o)}function fI(e,t){if(!kc(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=Lr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return ni(this,"shape",o),o}});return ri(e,r)}function mI(e,t){if(!kc(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Lr(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ni(this,"shape",i),i}});return ri(e,n)}function gI(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Lr(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return ni(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ri(e,n)}function hI(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Lr(t._zod.def,{get shape(){let s=t._zod.def.shape,l={...s};if(n)for(let c in n){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=e?new e({type:"optional",innerType:s[c]}):s[c])}else for(let c in s)l[c]=e?new e({type:"optional",innerType:s[c]}):s[c];return ni(this,"shape",l),l},checks:[]});return ri(t,a)}function yI(e,t,n){let i=Lr(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:r[a]}))}else for(let a in r)o[a]=new e({type:"nonoptional",innerType:r[a]});return ni(this,"shape",o),o}});return ri(t,i)}function vI(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function bI(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function SI(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Aa(e){return typeof e=="string"?e:e?.message}function kI(e,t,n){let i=e.message?e.message:Aa(e.inst?._zod.def?.error?.(e))??Aa(t?.error?.(e))??Aa(n.customError?.(e))??Aa(n.localeError?.(e))??"Invalid input",{inst:r,continue:o,input:a,...s}=e;return s.path??(s.path=[]),s.message=i,t?.reportInput&&(s.input=a),s}function wI(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function EI(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function AI(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function TI(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function xI(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ny(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function Py(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function OI(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Ny(t+n)}function RI(e){return Py(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function CI(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function $I(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Y_=class{constructor(...t){}};ne.Class=Y_});var Q_=M(Tt=>{"use strict";var II=Tt&&Tt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),NI=Tt&&Tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),PI=Tt&&Tt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&II(t,e,n);return NI(t,e),t};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.$ZodRealError=Tt.$ZodError=void 0;Tt.flattenError=LI;Tt.formatError=jI;Tt.treeifyError=DI;Tt.toDotPath=jy;Tt.prettifyError=UI;var My=Ni(),MI=PI(le()),Ly=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,MI.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};Tt.$ZodError=(0,My.$constructor)("$ZodError",Ly);Tt.$ZodRealError=(0,My.$constructor)("$ZodError",Ly,{Parent:Error});function LI(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function jI(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>i({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)n._errors.push(t(a));else{let l=n,c=0;for(;c<s.length;){let d=s[c];c===s.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(a))):l[d]=l[d]||{_errors:[]},l=l[d],c++}}}};return i(e),n}function DI(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var a,s;for(let l of r.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>i({issues:c},[...o,...l.path]));else if(l.code==="invalid_key")i({issues:l.issues},[...o,...l.path]);else if(l.code==="invalid_element")i({issues:l.issues},[...o,...l.path]);else{let c=[...o,...l.path];if(c.length===0){n.errors.push(t(l));continue}let d=n,u=0;for(;u<c.length;){let _=c[u],p=u===c.length-1;typeof _=="string"?(d.properties??(d.properties={}),(a=d.properties)[_]??(a[_]={errors:[]}),d=d.properties[_]):(d.items??(d.items=[]),(s=d.items)[_]??(s[_]={errors:[]}),d=d.items[_]),p&&d.errors.push(t(l)),u++}}};return i(e),n}function jy(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function UI(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${jy(i.path)}`);return t.join(`
2
+ `)}});var tp=M(ee=>{"use strict";var zI=ee&&ee.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),FI=ee&&ee.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ep=ee&&ee.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&zI(t,e,n);return FI(t,e),t};Object.defineProperty(ee,"__esModule",{value:!0});ee.safeDecodeAsync=ee._safeDecodeAsync=ee.safeEncodeAsync=ee._safeEncodeAsync=ee.safeDecode=ee._safeDecode=ee.safeEncode=ee._safeEncode=ee.decodeAsync=ee._decodeAsync=ee.encodeAsync=ee._encodeAsync=ee.decode=ee._decode=ee.encode=ee._encode=ee.safeParseAsync=ee._safeParseAsync=ee.safeParse=ee._safeParse=ee.parseAsync=ee._parseAsync=ee.parse=ee._parse=void 0;var wo=ep(Ni()),Jt=ep(Q_()),Eo=ep(le()),qI=e=>(t,n,i,r)=>{let o=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new wo.$ZodAsyncError;if(a.issues.length){let s=new(r?.Err??e)(a.issues.map(l=>Eo.finalizeIssue(l,o,wo.config())));throw Eo.captureStackTrace(s,r?.callee),s}return a.value};ee._parse=qI;ee.parse=(0,ee._parse)(Jt.$ZodRealError);var VI=e=>async(t,n,i,r)=>{let o=i?{...i,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(r?.Err??e)(a.issues.map(l=>Eo.finalizeIssue(l,o,wo.config())));throw Eo.captureStackTrace(s,r?.callee),s}return a.value};ee._parseAsync=VI;ee.parseAsync=(0,ee._parseAsync)(Jt.$ZodRealError);var WI=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new wo.$ZodAsyncError;return o.issues.length?{success:!1,error:new(e??Jt.$ZodError)(o.issues.map(a=>Eo.finalizeIssue(a,r,wo.config())))}:{success:!0,data:o.value}};ee._safeParse=WI;ee.safeParse=(0,ee._safeParse)(Jt.$ZodRealError);var ZI=e=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Eo.finalizeIssue(a,r,wo.config())))}:{success:!0,data:o.value}};ee._safeParseAsync=ZI;ee.safeParseAsync=(0,ee._safeParseAsync)(Jt.$ZodRealError);var BI=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,ee._parse)(e)(t,n,r)};ee._encode=BI;ee.encode=(0,ee._encode)(Jt.$ZodRealError);var HI=e=>(t,n,i)=>(0,ee._parse)(e)(t,n,i);ee._decode=HI;ee.decode=(0,ee._decode)(Jt.$ZodRealError);var JI=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,ee._parseAsync)(e)(t,n,r)};ee._encodeAsync=JI;ee.encodeAsync=(0,ee._encodeAsync)(Jt.$ZodRealError);var KI=e=>async(t,n,i)=>(0,ee._parseAsync)(e)(t,n,i);ee._decodeAsync=KI;ee.decodeAsync=(0,ee._decodeAsync)(Jt.$ZodRealError);var GI=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,ee._safeParse)(e)(t,n,r)};ee._safeEncode=GI;ee.safeEncode=(0,ee._safeEncode)(Jt.$ZodRealError);var XI=e=>(t,n,i)=>(0,ee._safeParse)(e)(t,n,i);ee._safeDecode=XI;ee.safeDecode=(0,ee._safeDecode)(Jt.$ZodRealError);var YI=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,ee._safeParseAsync)(e)(t,n,r)};ee._safeEncodeAsync=YI;ee.safeEncodeAsync=(0,ee._safeEncodeAsync)(Jt.$ZodRealError);var QI=e=>async(t,n,i)=>(0,ee._safeParseAsync)(e)(t,n,i);ee._safeDecodeAsync=QI;ee.safeDecodeAsync=(0,ee._safeDecodeAsync)(Jt.$ZodRealError)});var wc=M(D=>{"use strict";var e0=D&&D.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),t0=D&&D.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),n0=D&&D.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&e0(t,e,n);return t0(t,e),t};Object.defineProperty(D,"__esModule",{value:!0});D.sha256_base64url=D.sha256_base64=D.sha256_hex=D.sha1_base64url=D.sha1_base64=D.sha1_hex=D.md5_base64url=D.md5_base64=D.md5_hex=D.hex=D.uppercase=D.lowercase=D.undefined=D.null=D.boolean=D.number=D.integer=D.bigint=D.string=D.date=D.e164=D.httpProtocol=D.domain=D.hostname=D.base64url=D.base64=D.cidrv6=D.cidrv4=D.mac=D.ipv6=D.ipv4=D.browserEmail=D.idnEmail=D.unicodeEmail=D.rfc5322Email=D.html5Email=D.email=D.uuid7=D.uuid6=D.uuid4=D.uuid=D.guid=D.extendedDuration=D.duration=D.nanoid=D.ksuid=D.xid=D.ulid=D.cuid2=D.cuid=void 0;D.sha512_base64url=D.sha512_base64=D.sha512_hex=D.sha384_base64url=D.sha384_base64=D.sha384_hex=void 0;D.emoji=a0;D.time=c0;D.datetime=l0;var r0=n0(le());D.cuid=/^[cC][0-9a-z]{6,}$/;D.cuid2=/^[0-9a-z]+$/;D.ulid=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;D.xid=/^[0-9a-vA-V]{20}$/;D.ksuid=/^[A-Za-z0-9]{27}$/;D.nanoid=/^[a-zA-Z0-9_-]{21}$/;D.duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;D.extendedDuration=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;D.guid=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;var i0=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;D.uuid=i0;D.uuid4=(0,D.uuid)(4);D.uuid6=(0,D.uuid)(6);D.uuid7=(0,D.uuid)(7);D.email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;D.html5Email=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;D.rfc5322Email=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;D.unicodeEmail=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;D.idnEmail=D.unicodeEmail;D.browserEmail=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;var o0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function a0(){return new RegExp(o0,"u")}D.ipv4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;D.ipv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var s0=e=>{let t=r0.escapeRegex(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)};D.mac=s0;D.cidrv4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;D.cidrv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;D.base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;D.base64url=/^[A-Za-z0-9_-]*$/;D.hostname=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;D.domain=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;D.httpProtocol=/^https?$/;D.e164=/^\+[1-9]\d{6,14}$/;var Dy="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";D.date=new RegExp(`^${Dy}$`);function Uy(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function c0(e){return new RegExp(`^${Uy(e)}$`)}function l0(e){let t=Uy({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${Dy}T(?:${i})$`)}var u0=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};D.string=u0;D.bigint=/^-?\d+n?$/;D.integer=/^-?\d+$/;D.number=/^-?\d+(?:\.\d+)?$/;D.boolean=/^(?:true|false)$/i;var d0=/^null$/i;D.null=d0;var _0=/^undefined$/i;D.undefined=_0;D.lowercase=/^[^A-Z]*$/;D.uppercase=/^[^a-z]*$/;D.hex=/^[0-9a-fA-F]*$/;function Ta(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function xa(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}D.md5_hex=/^[0-9a-fA-F]{32}$/;D.md5_base64=Ta(22,"==");D.md5_base64url=xa(22);D.sha1_hex=/^[0-9a-fA-F]{40}$/;D.sha1_base64=Ta(27,"=");D.sha1_base64url=xa(27);D.sha256_hex=/^[0-9a-fA-F]{64}$/;D.sha256_base64=Ta(43,"=");D.sha256_base64url=xa(43);D.sha384_hex=/^[0-9a-fA-F]{96}$/;D.sha384_base64=Ta(64,"");D.sha384_base64url=xa(64);D.sha512_hex=/^[0-9a-fA-F]{128}$/;D.sha512_base64=Ta(86,"==");D.sha512_base64url=xa(86)});var Ec=M(re=>{"use strict";var p0=re&&re.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),f0=re&&re.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),np=re&&re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&p0(t,e,n);return f0(t,e),t};Object.defineProperty(re,"__esModule",{value:!0});re.$ZodCheckOverwrite=re.$ZodCheckMimeType=re.$ZodCheckProperty=re.$ZodCheckEndsWith=re.$ZodCheckStartsWith=re.$ZodCheckIncludes=re.$ZodCheckUpperCase=re.$ZodCheckLowerCase=re.$ZodCheckRegex=re.$ZodCheckStringFormat=re.$ZodCheckLengthEquals=re.$ZodCheckMinLength=re.$ZodCheckMaxLength=re.$ZodCheckSizeEquals=re.$ZodCheckMinSize=re.$ZodCheckMaxSize=re.$ZodCheckBigIntFormat=re.$ZodCheckNumberFormat=re.$ZodCheckMultipleOf=re.$ZodCheckGreaterThan=re.$ZodCheckLessThan=re.$ZodCheck=void 0;var ct=np(Ni()),rp=np(wc()),gt=np(le());re.$ZodCheck=ct.$constructor("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var Fy={number:"number",bigint:"bigint",object:"date"};re.$ZodCheckLessThan=ct.$constructor("$ZodCheckLessThan",(e,t)=>{re.$ZodCheck.init(e,t);let n=Fy[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});re.$ZodCheckGreaterThan=ct.$constructor("$ZodCheckGreaterThan",(e,t)=>{re.$ZodCheck.init(e,t);let n=Fy[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});re.$ZodCheckMultipleOf=ct.$constructor("$ZodCheckMultipleOf",(e,t)=>{re.$ZodCheck.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):gt.floatSafeRemainder(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}});re.$ZodCheckNumberFormat=ct.$constructor("$ZodCheckNumberFormat",(e,t)=>{re.$ZodCheck.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=gt.NUMBER_FORMAT_RANGES[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=r,s.maximum=o,n&&(s.pattern=rp.integer)}),e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});re.$ZodCheckBigIntFormat=ct.$constructor("$ZodCheckBigIntFormat",(e,t)=>{re.$ZodCheck.init(e,t);let[n,i]=gt.BIGINT_FORMAT_RANGES[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});re.$ZodCheckMaxSize=ct.$constructor("$ZodCheckMaxSize",(e,t)=>{var n;re.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!gt.nullish(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:gt.getSizableOrigin(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});re.$ZodCheckMinSize=ct.$constructor("$ZodCheckMinSize",(e,t)=>{var n;re.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!gt.nullish(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:gt.getSizableOrigin(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});re.$ZodCheckSizeEquals=ct.$constructor("$ZodCheckSizeEquals",(e,t)=>{var n;re.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!gt.nullish(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=i=>{let r=i.value,o=r.size;if(o===t.size)return;let a=o>t.size;i.issues.push({origin:gt.getSizableOrigin(r),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}});re.$ZodCheckMaxLength=ct.$constructor("$ZodCheckMaxLength",(e,t)=>{var n;re.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!gt.nullish(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;if(r.length<=t.maximum)return;let a=gt.getLengthableOrigin(r);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});re.$ZodCheckMinLength=ct.$constructor("$ZodCheckMinLength",(e,t)=>{var n;re.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!gt.nullish(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;if(r.length>=t.minimum)return;let a=gt.getLengthableOrigin(r);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});re.$ZodCheckLengthEquals=ct.$constructor("$ZodCheckLengthEquals",(e,t)=>{var n;re.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!gt.nullish(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=i=>{let r=i.value,o=r.length;if(o===t.length)return;let a=gt.getLengthableOrigin(r),s=o>t.length;i.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}});re.$ZodCheckStringFormat=ct.$constructor("$ZodCheckStringFormat",(e,t)=>{var n,i;re.$ZodCheck.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})});re.$ZodCheckRegex=ct.$constructor("$ZodCheckRegex",(e,t)=>{re.$ZodCheckStringFormat.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});re.$ZodCheckLowerCase=ct.$constructor("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rp.lowercase),re.$ZodCheckStringFormat.init(e,t)});re.$ZodCheckUpperCase=ct.$constructor("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rp.uppercase),re.$ZodCheckStringFormat.init(e,t)});re.$ZodCheckIncludes=ct.$constructor("$ZodCheckIncludes",(e,t)=>{re.$ZodCheck.init(e,t);let n=gt.escapeRegex(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}});re.$ZodCheckStartsWith=ct.$constructor("$ZodCheckStartsWith",(e,t)=>{re.$ZodCheck.init(e,t);let n=new RegExp(`^${gt.escapeRegex(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}});re.$ZodCheckEndsWith=ct.$constructor("$ZodCheckEndsWith",(e,t)=>{re.$ZodCheck.init(e,t);let n=new RegExp(`.*${gt.escapeRegex(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function zy(e,t,n){e.issues.length&&t.issues.push(...gt.prefixIssues(n,e.issues))}re.$ZodCheckProperty=ct.$constructor("$ZodCheckProperty",(e,t)=>{re.$ZodCheck.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>zy(r,n,t.property));zy(i,n,t.property)}});re.$ZodCheckMimeType=ct.$constructor("$ZodCheckMimeType",(e,t)=>{re.$ZodCheck.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}});re.$ZodCheckOverwrite=ct.$constructor("$ZodCheckOverwrite",(e,t)=>{re.$ZodCheck.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var op=M(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.Doc=void 0;var ip=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
3
+ `).filter(a=>a),r=Math.min(...i.map(a=>a.length-a.trimStart().length)),o=i.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,n=this?.args,r=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,r.join(`
4
+ `))}};Ac.Doc=ip});var ap=M(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.version=void 0;Tc.version={major:4,minor:4,patch:3}});var lp=M(E=>{"use strict";var m0=E&&E.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),g0=E&&E.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$c=E&&E.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&m0(t,e,n);return g0(t,e),t};Object.defineProperty(E,"__esModule",{value:!0});E.$ZodTuple=E.$ZodIntersection=E.$ZodDiscriminatedUnion=E.$ZodXor=E.$ZodUnion=E.$ZodObjectJIT=E.$ZodObject=E.$ZodArray=E.$ZodDate=E.$ZodVoid=E.$ZodNever=E.$ZodUnknown=E.$ZodAny=E.$ZodNull=E.$ZodUndefined=E.$ZodSymbol=E.$ZodBigIntFormat=E.$ZodBigInt=E.$ZodBoolean=E.$ZodNumberFormat=E.$ZodNumber=E.$ZodCustomStringFormat=E.$ZodJWT=E.$ZodE164=E.$ZodBase64URL=E.$ZodBase64=E.$ZodCIDRv6=E.$ZodCIDRv4=E.$ZodMAC=E.$ZodIPv6=E.$ZodIPv4=E.$ZodISODuration=E.$ZodISOTime=E.$ZodISODate=E.$ZodISODateTime=E.$ZodKSUID=E.$ZodXID=E.$ZodULID=E.$ZodCUID2=E.$ZodCUID=E.$ZodNanoID=E.$ZodEmoji=E.$ZodURL=E.$ZodEmail=E.$ZodUUID=E.$ZodGUID=E.$ZodStringFormat=E.$ZodString=E.clone=E.$ZodType=void 0;E.$ZodCustom=E.$ZodLazy=E.$ZodPromise=E.$ZodFunction=E.$ZodTemplateLiteral=E.$ZodReadonly=E.$ZodPreprocess=E.$ZodCodec=E.$ZodPipe=E.$ZodNaN=E.$ZodCatch=E.$ZodSuccess=E.$ZodNonOptional=E.$ZodPrefault=E.$ZodDefault=E.$ZodNullable=E.$ZodExactOptional=E.$ZodOptional=E.$ZodTransform=E.$ZodFile=E.$ZodLiteral=E.$ZodEnum=E.$ZodSet=E.$ZodMap=E.$ZodRecord=void 0;E.isValidBase64=cp;E.isValidBase64URL=nv;E.isValidJWT=rv;var Ic=$c(Ec()),G=$c(Ni()),h0=op(),Ao=tp(),Le=$c(wc()),X=$c(le()),y0=ap();E.$ZodType=G.$constructor("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=y0.version;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(a,s,l)=>{let c=X.aborted(a),d;for(let u of s){if(u._zod.def.when){if(X.explicitlyAborted(a)||!u._zod.def.when(a))continue}else if(c)continue;let _=a.issues.length,p=u._zod.check(a);if(p instanceof Promise&&l?.async===!1)throw new G.$ZodAsyncError;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,a.issues.length!==_&&(c||(c=X.aborted(a,_)))});else{if(a.issues.length===_)continue;c||(c=X.aborted(a,_))}}return d?d.then(()=>a):a},o=(a,s,l)=>{if(X.aborted(a))return a.aborted=!0,a;let c=r(s,i,l);if(c instanceof Promise){if(l.async===!1)throw new G.$ZodAsyncError;return c.then(d=>e._zod.parse(d,l))}return e._zod.parse(c,l)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let c=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return c instanceof Promise?c.then(d=>o(d,a,s)):o(c,a,s)}let l=e._zod.parse(a,s);if(l instanceof Promise){if(s.async===!1)throw new G.$ZodAsyncError;return l.then(c=>r(c,i,s))}return r(l,i,s)}}X.defineLazy(e,"~standard",()=>({validate:r=>{try{let o=(0,Ao.safeParse)(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return(0,Ao.safeParseAsync)(e,r).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))});var v0=le();Object.defineProperty(E,"clone",{enumerable:!0,get:function(){return v0.clone}});E.$ZodString=G.$constructor("$ZodString",(e,t)=>{E.$ZodType.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Le.string(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}});E.$ZodStringFormat=G.$constructor("$ZodStringFormat",(e,t)=>{Ic.$ZodCheckStringFormat.init(e,t),E.$ZodString.init(e,t)});E.$ZodGUID=G.$constructor("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Le.guid),E.$ZodStringFormat.init(e,t)});E.$ZodUUID=G.$constructor("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Le.uuid(i))}else t.pattern??(t.pattern=Le.uuid());E.$ZodStringFormat.init(e,t)});E.$ZodEmail=G.$constructor("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Le.email),E.$ZodStringFormat.init(e,t)});E.$ZodURL=G.$constructor("$ZodURL",(e,t)=>{E.$ZodStringFormat.init(e,t),e._zod.check=n=>{try{let i=n.value.trim();if(!t.normalize&&t.protocol?.source===Le.httpProtocol.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}let r=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}});E.$ZodEmoji=G.$constructor("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Le.emoji()),E.$ZodStringFormat.init(e,t)});E.$ZodNanoID=G.$constructor("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Le.nanoid),E.$ZodStringFormat.init(e,t)});E.$ZodCUID=G.$constructor("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Le.cuid),E.$ZodStringFormat.init(e,t)});E.$ZodCUID2=G.$constructor("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Le.cuid2),E.$ZodStringFormat.init(e,t)});E.$ZodULID=G.$constructor("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Le.ulid),E.$ZodStringFormat.init(e,t)});E.$ZodXID=G.$constructor("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Le.xid),E.$ZodStringFormat.init(e,t)});E.$ZodKSUID=G.$constructor("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Le.ksuid),E.$ZodStringFormat.init(e,t)});E.$ZodISODateTime=G.$constructor("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Le.datetime(t)),E.$ZodStringFormat.init(e,t)});E.$ZodISODate=G.$constructor("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Le.date),E.$ZodStringFormat.init(e,t)});E.$ZodISOTime=G.$constructor("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Le.time(t)),E.$ZodStringFormat.init(e,t)});E.$ZodISODuration=G.$constructor("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Le.duration),E.$ZodStringFormat.init(e,t)});E.$ZodIPv4=G.$constructor("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Le.ipv4),E.$ZodStringFormat.init(e,t),e._zod.bag.format="ipv4"});E.$ZodIPv6=G.$constructor("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Le.ipv6),E.$ZodStringFormat.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}});E.$ZodMAC=G.$constructor("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Le.mac(t.delimiter)),E.$ZodStringFormat.init(e,t),e._zod.bag.format="mac"});E.$ZodCIDRv4=G.$constructor("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Le.cidrv4),E.$ZodStringFormat.init(e,t)});E.$ZodCIDRv6=G.$constructor("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Le.cidrv6),E.$ZodStringFormat.init(e,t),e._zod.check=n=>{let i=n.value.split("/");try{if(i.length!==2)throw new Error;let[r,o]=i;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function cp(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}E.$ZodBase64=G.$constructor("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Le.base64),E.$ZodStringFormat.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{cp(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function nv(e){if(!Le.base64url.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return cp(n)}E.$ZodBase64URL=G.$constructor("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Le.base64url),E.$ZodStringFormat.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{nv(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}});E.$ZodE164=G.$constructor("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Le.e164),E.$ZodStringFormat.init(e,t)});function rv(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}E.$ZodJWT=G.$constructor("$ZodJWT",(e,t)=>{E.$ZodStringFormat.init(e,t),e._zod.check=n=>{rv(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});E.$ZodCustomStringFormat=G.$constructor("$ZodCustomStringFormat",(e,t)=>{E.$ZodStringFormat.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}});E.$ZodNumber=G.$constructor("$ZodNumber",(e,t)=>{E.$ZodType.init(e,t),e._zod.pattern=e._zod.bag.pattern??Le.number,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let o=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}});E.$ZodNumberFormat=G.$constructor("$ZodNumberFormat",(e,t)=>{Ic.$ZodCheckNumberFormat.init(e,t),E.$ZodNumber.init(e,t)});E.$ZodBoolean=G.$constructor("$ZodBoolean",(e,t)=>{E.$ZodType.init(e,t),e._zod.pattern=Le.boolean,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});E.$ZodBigInt=G.$constructor("$ZodBigInt",(e,t)=>{E.$ZodType.init(e,t),e._zod.pattern=Le.bigint,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}});E.$ZodBigIntFormat=G.$constructor("$ZodBigIntFormat",(e,t)=>{Ic.$ZodCheckBigIntFormat.init(e,t),E.$ZodBigInt.init(e,t)});E.$ZodSymbol=G.$constructor("$ZodSymbol",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}});E.$ZodUndefined=G.$constructor("$ZodUndefined",(e,t)=>{E.$ZodType.init(e,t),e._zod.pattern=Le.undefined,e._zod.values=new Set([void 0]),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}});E.$ZodNull=G.$constructor("$ZodNull",(e,t)=>{E.$ZodType.init(e,t),e._zod.pattern=Le.null,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}});E.$ZodAny=G.$constructor("$ZodAny",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=n=>n});E.$ZodUnknown=G.$constructor("$ZodUnknown",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=n=>n});E.$ZodNever=G.$constructor("$ZodNever",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});E.$ZodVoid=G.$constructor("$ZodVoid",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}});E.$ZodDate=G.$constructor("$ZodDate",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});function qy(e,t,n){e.issues.length&&t.issues.push(...X.prefixIssues(n,e.issues)),t.value[n]=e.value}E.$ZodArray=G.$constructor("$ZodArray",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let o=[];for(let a=0;a<r.length;a++){let s=r[a],l=t.element._zod.run({value:s,issues:[]},i);l instanceof Promise?o.push(l.then(c=>qy(c,n,a))):qy(l,n,a)}return o.length?Promise.all(o).then(()=>n):n}});function Cc(e,t,n,i,r,o){let a=n in i;if(e.issues.length){if(r&&o&&!a)return;t.issues.push(...X.prefixIssues(n,e.issues))}if(!a&&!r){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?a&&(t.value[n]=void 0):t.value[n]=e.value}function iv(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let n=X.optionalKeys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ov(e,t,n,i,r,o){let a=[],s=r.keySet,l=r.catchall._zod,c=l.def.type,d=l.optin==="optional",u=l.optout==="optional";for(let _ in t){if(_==="__proto__"||s.has(_))continue;if(c==="never"){a.push(_);continue}let p=l.run({value:t[_],issues:[]},i);p instanceof Promise?e.push(p.then(y=>Cc(y,n,_,t,d,u))):Cc(p,n,_,t,d,u)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}E.$ZodObject=G.$constructor("$ZodObject",(e,t)=>{if(E.$ZodType.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...s};return Object.defineProperty(t,"shape",{value:l}),l}})}let i=X.cached(()=>iv(t));X.defineLazy(e._zod,"propValues",()=>{let s=t.shape,l={};for(let c in s){let d=s[c]._zod;if(d.values){l[c]??(l[c]=new Set);for(let u of d.values)l[c].add(u)}}return l});let r=X.isObject,o=t.catchall,a;e._zod.parse=(s,l)=>{a??(a=i.value);let c=s.value;if(!r(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),s;s.value={};let d=[],u=a.shape;for(let _ of a.keys){let p=u[_],y=p._zod.optin==="optional",f=p._zod.optout==="optional",h=p._zod.run({value:c[_],issues:[]},l);h instanceof Promise?d.push(h.then(k=>Cc(k,s,_,c,y,f))):Cc(h,s,_,c,y,f)}return o?ov(d,c,s,l,i.value,e):d.length?Promise.all(d).then(()=>s):s}});E.$ZodObjectJIT=G.$constructor("$ZodObjectJIT",(e,t)=>{E.$ZodObject.init(e,t);let n=e._zod.parse,i=X.cached(()=>iv(t)),r=_=>{let p=new h0.Doc(["shape","payload","ctx"]),y=i.value,f=R=>{let g=X.esc(R);return`shape[${g}]._zod.run({ value: input[${g}], issues: [] }, ctx)`};p.write("const input = payload.value;");let h=Object.create(null),k=0;for(let R of y.keys)h[R]=`key_${k++}`;p.write("const newResult = {};");for(let R of y.keys){let g=h[R],b=X.esc(R),O=_[R],P=O?._zod?.optin==="optional",C=O?._zod?.optout==="optional";p.write(`const ${g} = ${f(R)};`),P&&C?p.write(`
5
+ if (${g}.issues.length) {
6
+ if (${b} in input) {
7
+ payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${b}, ...iss.path] : [${b}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${g}.value === undefined) {
15
+ if (${b} in input) {
16
+ newResult[${b}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${b}] = ${g}.value;
20
+ }
21
+
22
+ `):P?p.write(`
23
+ if (${g}.issues.length) {
24
+ payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
25
+ ...iss,
26
+ path: iss.path ? [${b}, ...iss.path] : [${b}]
27
+ })));
28
+ }
29
+
30
+ if (${g}.value === undefined) {
31
+ if (${b} in input) {
32
+ newResult[${b}] = undefined;
33
+ }
34
+ } else {
35
+ newResult[${b}] = ${g}.value;
36
+ }
37
+
38
+ `):p.write(`
39
+ const ${g}_present = ${b} in input;
40
+ if (${g}.issues.length) {
41
+ payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
42
+ ...iss,
43
+ path: iss.path ? [${b}, ...iss.path] : [${b}]
44
+ })));
45
+ }
46
+ if (!${g}_present && !${g}.issues.length) {
47
+ payload.issues.push({
48
+ code: "invalid_type",
49
+ expected: "nonoptional",
50
+ input: undefined,
51
+ path: [${b}]
52
+ });
53
+ }
54
+
55
+ if (${g}_present) {
56
+ if (${g}.value === undefined) {
57
+ newResult[${b}] = undefined;
58
+ } else {
59
+ newResult[${b}] = ${g}.value;
60
+ }
61
+ }
62
+
63
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");let S=p.compile();return(R,g)=>S(_,R,g)},o,a=X.isObject,s=!G.globalConfig.jitless,l=X.allowsEval,c=s&&l.value,d=t.catchall,u;e._zod.parse=(_,p)=>{u??(u=i.value);let y=_.value;return a(y)?s&&c&&p?.async===!1&&p.jitless!==!0?(o||(o=r(t.shape)),_=o(_,p),d?ov([],y,_,p,u,e):_):n(_,p):(_.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),_)}});function Vy(e,t,n,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let r=e.filter(o=>!X.aborted(o));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>X.finalizeIssue(a,i,G.config())))}),t)}E.$ZodUnion=G.$constructor("$ZodUnion",(e,t)=>{E.$ZodType.init(e,t),X.defineLazy(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),X.defineLazy(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),X.defineLazy(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),X.defineLazy(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${i.map(r=>X.cleanRegex(r.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let o=!1,a=[];for(let s of t.options){let l=s._zod.run({value:i.value,issues:[]},r);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}return o?Promise.all(a).then(s=>Vy(s,i,e,r)):Vy(a,i,e,r)}});function Wy(e,t,n,i){let r=e.filter(o=>o.issues.length===0);return r.length===1?(t.value=r[0].value,t):(r.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>X.finalizeIssue(a,i,G.config())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}E.$ZodXor=G.$constructor("$ZodXor",(e,t)=>{E.$ZodUnion.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let o=!1,a=[];for(let s of t.options){let l=s._zod.run({value:i.value,issues:[]},r);l instanceof Promise?(a.push(l),o=!0):a.push(l)}return o?Promise.all(a).then(s=>Wy(s,i,e,r)):Wy(a,i,e,r)}});E.$ZodDiscriminatedUnion=G.$constructor("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,E.$ZodUnion.init(e,t);let n=e._zod.parse;X.defineLazy(e._zod,"propValues",()=>{let r={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,l]of Object.entries(a)){r[s]||(r[s]=new Set);for(let c of l)r[s].add(c)}}return r});let i=X.cached(()=>{let r=t.options,o=new Map;for(let a of r){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let l of s){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,a)}}return o});e._zod.parse=(r,o)=>{let a=r.value;if(!X.isObject(a))return r.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),r;let s=i.value.get(a?.[t.discriminator]);return s?s._zod.run(r,o):t.unionFallback||o.direction==="backward"?n(r,o):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()),input:a,path:[t.discriminator],inst:e}),r)}});E.$ZodIntersection=G.$constructor("$ZodIntersection",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,o=t.left._zod.run({value:r,issues:[]},i),a=t.right._zod.run({value:r,issues:[]},i);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,c])=>Zy(n,l,c)):Zy(n,o,a)}});function sp(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(X.isPlainObject(e)&&X.isPlainObject(t)){let n=Object.keys(t),i=Object.keys(e).filter(o=>n.indexOf(o)!==-1),r={...e,...t};for(let o of i){let a=sp(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r[o]=a.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],o=t[i],a=sp(r,o);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Zy(e,t,n){let i=new Map,r;for(let s of t.issues)if(s.code==="unrecognized_keys"){r??(r=s);for(let l of s.keys)i.has(l)||i.set(l,{}),i.get(l).l=!0}else e.issues.push(s);for(let s of n.issues)if(s.code==="unrecognized_keys")for(let l of s.keys)i.has(l)||i.set(l,{}),i.get(l).r=!0;else e.issues.push(s);let o=[...i].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(o.length&&r&&e.issues.push({...r,keys:o}),X.aborted(e))return e;let a=sp(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}E.$ZodTuple=G.$constructor("$ZodTuple",(e,t)=>{E.$ZodType.init(e,t);let n=t.items;e._zod.parse=(i,r)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=[];let a=[],s=By(n,"optin"),l=By(n,"optout");if(!t.rest){if(o.length<s)return i.issues.push({code:"too_small",minimum:s,inclusive:!0,input:o,inst:e,origin:"array"}),i;o.length>n.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:o,inst:e,origin:"array"})}let c=new Array(n.length);for(let d=0;d<n.length;d++){let u=n[d]._zod.run({value:o[d],issues:[]},r);u instanceof Promise?a.push(u.then(_=>{c[d]=_})):c[d]=u}if(t.rest){let d=n.length-1,u=o.slice(n.length);for(let _ of u){d++;let p=t.rest._zod.run({value:_,issues:[]},r);p instanceof Promise?a.push(p.then(y=>Hy(y,i,d))):Hy(p,i,d)}}return a.length?Promise.all(a).then(()=>Jy(c,i,n,o,l)):Jy(c,i,n,o,l)}});function By(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!=="optional")return n+1;return 0}function Hy(e,t,n){e.issues.length&&t.issues.push(...X.prefixIssues(n,e.issues)),t.value[n]=e.value}function Jy(e,t,n,i,r){for(let o=0;o<n.length;o++){let a=e[o],s=o<i.length;if(a.issues.length){if(!s&&o>=r){t.value.length=o;break}t.issues.push(...X.prefixIssues(o,a.issues))}t.value[o]=a.value}for(let o=t.value.length-1;o>=i.length&&(n[o]._zod.optout==="optional"&&t.value[o]===void 0);o--)t.value.length=o;return t}E.$ZodRecord=G.$constructor("$ZodRecord",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!X.isPlainObject(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let o=[],a=t.keyType._zod.values;if(a){n.value={};let s=new Set;for(let c of a)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){s.add(typeof c=="number"?c.toString():c);let d=t.keyType._zod.run({value:c,issues:[]},i);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>X.finalizeIssue(p,i,G.config())),input:c,path:[c],inst:e});continue}let u=d.value,_=t.valueType._zod.run({value:r[c],issues:[]},i);_ instanceof Promise?o.push(_.then(p=>{p.issues.length&&n.issues.push(...X.prefixIssues(c,p.issues)),n.value[u]=p.value})):(_.issues.length&&n.issues.push(...X.prefixIssues(c,_.issues)),n.value[u]=_.value)}let l;for(let c in r)s.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:l})}else{n.value={};for(let s of Reflect.ownKeys(r)){if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,s))continue;let l=t.keyType._zod.run({value:s,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Le.number.test(s)&&l.issues.length){let u=t.keyType._zod.run({value:Number(s),issues:[]},i);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");u.issues.length===0&&(l=u)}if(l.issues.length){t.mode==="loose"?n.value[s]=r[s]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>X.finalizeIssue(u,i,G.config())),input:s,path:[s],inst:e});continue}let d=t.valueType._zod.run({value:r[s],issues:[]},i);d instanceof Promise?o.push(d.then(u=>{u.issues.length&&n.issues.push(...X.prefixIssues(s,u.issues)),n.value[l.value]=u.value})):(d.issues.length&&n.issues.push(...X.prefixIssues(s,d.issues)),n.value[l.value]=d.value)}}return o.length?Promise.all(o).then(()=>n):n}});E.$ZodMap=G.$constructor("$ZodMap",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let o=[];n.value=new Map;for(let[a,s]of r){let l=t.keyType._zod.run({value:a,issues:[]},i),c=t.valueType._zod.run({value:s,issues:[]},i);l instanceof Promise||c instanceof Promise?o.push(Promise.all([l,c]).then(([d,u])=>{Ky(d,u,n,a,r,e,i)})):Ky(l,c,n,a,r,e,i)}return o.length?Promise.all(o).then(()=>n):n}});function Ky(e,t,n,i,r,o,a){e.issues.length&&(X.propertyKeyTypes.has(typeof i)?n.issues.push(...X.prefixIssues(i,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:o,issues:e.issues.map(s=>X.finalizeIssue(s,a,G.config()))})),t.issues.length&&(X.propertyKeyTypes.has(typeof i)?n.issues.push(...X.prefixIssues(i,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:o,key:i,issues:t.issues.map(s=>X.finalizeIssue(s,a,G.config()))})),n.value.set(e.value,t.value)}E.$ZodSet=G.$constructor("$ZodSet",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let o=[];n.value=new Set;for(let a of r){let s=t.valueType._zod.run({value:a,issues:[]},i);s instanceof Promise?o.push(s.then(l=>Gy(l,n))):Gy(s,n)}return o.length?Promise.all(o).then(()=>n):n}});function Gy(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}E.$ZodEnum=G.$constructor("$ZodEnum",(e,t)=>{E.$ZodType.init(e,t);let n=X.getEnumValues(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(r=>X.propertyKeyTypes.has(typeof r)).map(r=>typeof r=="string"?X.escapeRegex(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{let a=r.value;return i.has(a)||r.issues.push({code:"invalid_value",values:n,input:a,inst:e}),r}});E.$ZodLiteral=G.$constructor("$ZodLiteral",(e,t)=>{if(E.$ZodType.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?X.escapeRegex(i):i?X.escapeRegex(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,r)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),i}});E.$ZodFile=G.$constructor("$ZodFile",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return r instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}});E.$ZodTransform=G.$constructor("$ZodTransform",(e,t)=>{E.$ZodType.init(e,t),e._zod.optin="optional",e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new G.$ZodEncodeError(e.constructor.name);let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then(a=>(n.value=a,n.fallback=!0,n));if(r instanceof Promise)throw new G.$ZodAsyncError;return n.value=r,n.fallback=!0,n}});function Xy(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}E.$ZodOptional=G.$constructor("$ZodOptional",(e,t)=>{E.$ZodType.init(e,t),e._zod.optin="optional",e._zod.optout="optional",X.defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),X.defineLazy(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${X.cleanRegex(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){let r=n.value,o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(a=>Xy(a,r)):Xy(o,r)}return n.value===void 0?n:t.innerType._zod.run(n,i)}});E.$ZodExactOptional=G.$constructor("$ZodExactOptional",(e,t)=>{E.$ZodOptional.init(e,t),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),X.defineLazy(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)});E.$ZodNullable=G.$constructor("$ZodNullable",(e,t)=>{E.$ZodType.init(e,t),X.defineLazy(e._zod,"optin",()=>t.innerType._zod.optin),X.defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),X.defineLazy(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${X.cleanRegex(n.source)}|null)$`):void 0}),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)});E.$ZodDefault=G.$constructor("$ZodDefault",(e,t)=>{E.$ZodType.init(e,t),e._zod.optin="optional",X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Yy(o,t)):Yy(r,t)}});function Yy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}E.$ZodPrefault=G.$constructor("$ZodPrefault",(e,t)=>{E.$ZodType.init(e,t),e._zod.optin="optional",X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))});E.$ZodNonOptional=G.$constructor("$ZodNonOptional",(e,t)=>{E.$ZodType.init(e,t),X.defineLazy(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Qy(o,e)):Qy(r,e)}});function Qy(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}E.$ZodSuccess=G.$constructor("$ZodSuccess",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new G.$ZodEncodeError("ZodSuccess");let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.issues.length===0,n)):(n.value=r.issues.length===0,n)}});E.$ZodCatch=G.$constructor("$ZodCatch",(e,t)=>{E.$ZodType.init(e,t),e._zod.optin="optional",X.defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>X.finalizeIssue(a,i,G.config()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(o=>X.finalizeIssue(o,i,G.config()))},input:n.value}),n.issues=[],n.fallback=!0),n)}});E.$ZodNaN=G.$constructor("$ZodNaN",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)});E.$ZodPipe=G.$constructor("$ZodPipe",(e,t)=>{E.$ZodType.init(e,t),X.defineLazy(e._zod,"values",()=>t.in._zod.values),X.defineLazy(e._zod,"optin",()=>t.in._zod.optin),X.defineLazy(e._zod,"optout",()=>t.out._zod.optout),X.defineLazy(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){let o=t.out._zod.run(n,i);return o instanceof Promise?o.then(a=>xc(a,t.in,i)):xc(o,t.in,i)}let r=t.in._zod.run(n,i);return r instanceof Promise?r.then(o=>xc(o,t.out,i)):xc(r,t.out,i)}});function xc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}E.$ZodCodec=G.$constructor("$ZodCodec",(e,t)=>{E.$ZodType.init(e,t),X.defineLazy(e._zod,"values",()=>t.in._zod.values),X.defineLazy(e._zod,"optin",()=>t.in._zod.optin),X.defineLazy(e._zod,"optout",()=>t.out._zod.optout),X.defineLazy(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if((i.direction||"forward")==="forward"){let o=t.in._zod.run(n,i);return o instanceof Promise?o.then(a=>Oc(a,t,i)):Oc(o,t,i)}else{let o=t.out._zod.run(n,i);return o instanceof Promise?o.then(a=>Oc(a,t,i)):Oc(o,t,i)}}});function Oc(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);return r instanceof Promise?r.then(o=>Rc(e,o,t.out,n)):Rc(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(o=>Rc(e,o,t.in,n)):Rc(e,r,t.in,n)}}function Rc(e,t,n,i){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},i)}E.$ZodPreprocess=G.$constructor("$ZodPreprocess",(e,t)=>{E.$ZodPipe.init(e,t)});E.$ZodReadonly=G.$constructor("$ZodReadonly",(e,t)=>{E.$ZodType.init(e,t),X.defineLazy(e._zod,"propValues",()=>t.innerType._zod.propValues),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),X.defineLazy(e._zod,"optin",()=>t.innerType?._zod?.optin),X.defineLazy(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(ev):ev(r)}});function ev(e){return e.value=Object.freeze(e.value),e}E.$ZodTemplateLiteral=G.$constructor("$ZodTemplateLiteral",(e,t)=>{E.$ZodType.init(e,t);let n=[];for(let i of t.parts)if(typeof i=="object"&&i!==null){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let r=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!r)throw new Error(`Invalid template literal part: ${i._zod.traits}`);let o=r.startsWith("^")?1:0,a=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(o,a))}else if(i===null||X.primitiveTypes.has(typeof i))n.push(X.escapeRegex(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(i,r)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"string",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),i)});E.$ZodFunction=G.$constructor("$ZodFunction",(e,t)=>(E.$ZodType.init(e,t),e._def=t,e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return function(...i){let r=e._def.input?(0,Ao.parse)(e._def.input,i):i,o=Reflect.apply(n,this,r);return e._def.output?(0,Ao.parse)(e._def.output,o):o}},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return async function(...i){let r=e._def.input?await(0,Ao.parseAsync)(e._def.input,i):i,o=await Reflect.apply(n,this,r);return e._def.output?await(0,Ao.parseAsync)(e._def.output,o):o}},e._zod.parse=(n,i)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let i=e.constructor;return Array.isArray(n[0])?new i({type:"function",input:new E.$ZodTuple({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new i({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let i=e.constructor;return new i({type:"function",input:e._def.input,output:n})},e));E.$ZodPromise=G.$constructor("$ZodPromise",(e,t)=>{E.$ZodType.init(e,t),e._zod.parse=(n,i)=>Promise.resolve(n.value).then(r=>t.innerType._zod.run({value:r,issues:[]},i))});E.$ZodLazy=G.$constructor("$ZodLazy",(e,t)=>{E.$ZodType.init(e,t),X.defineLazy(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),X.defineLazy(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),X.defineLazy(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),X.defineLazy(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),X.defineLazy(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,i)=>e._zod.innerType._zod.run(n,i)});E.$ZodCustom=G.$constructor("$ZodCustom",(e,t)=>{Ic.$ZodCheck.init(e,t),E.$ZodType.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then(o=>tv(o,n,i,e));tv(r,n,i,e)}});function tv(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(r.params=i._zod.def.params),t.issues.push(X.issue(r))}}});var sv=M((An,av)=>{"use strict";var b0=An&&An.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),S0=An&&An.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),k0=An&&An.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&b0(t,e,n);return S0(t,e),t};Object.defineProperty(An,"__esModule",{value:!0});An.default=E0;var Nc=k0(le()),w0=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(r){return e[r]??null}let n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Nc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${r.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`}case"invalid_value":return r.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Nc.stringifyPrimitive(r.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${Nc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${r.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${n[o.format]??r.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${r.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${r.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${r.keys.length>1?"\u0629":""}: ${Nc.joinValues(r.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function E0(){return{localeError:w0()}}av.exports=An.default});var lv=M((Tn,cv)=>{"use strict";var A0=Tn&&Tn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),T0=Tn&&Tn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),x0=Tn&&Tn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&A0(t,e,n);return T0(t,e),t};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.default=R0;var Pc=x0(le()),O0=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Pc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${r.expected}, daxil olan ${s}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o}, daxil olan ${s}`}case"invalid_value":return r.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Pc.stringifyPrimitive(r.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${Pc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[o.format]??r.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${r.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${r.keys.length>1?"lar":""}: ${Pc.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${r.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function R0(){return{localeError:O0()}}cv.exports=Tn.default});var _v=M((xn,dv)=>{"use strict";var C0=xn&&xn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),$0=xn&&xn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),I0=xn&&xn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&C0(t,e,n);return $0(t,e),t};Object.defineProperty(xn,"__esModule",{value:!0});xn.default=P0;var Mc=I0(le());function uv(e,t,n,i){let r=Math.abs(e),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?n:i}var N0=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(r){return e[r]??null}let n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},i={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Mc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${r.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Mc.stringifyPrimitive(r.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${Mc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),l=uv(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),l=uv(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${r.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${Mc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${r.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function P0(){return{localeError:N0()}}dv.exports=xn.default});var fv=M((On,pv)=>{"use strict";var M0=On&&On.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),L0=On&&On.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),j0=On&&On.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&M0(t,e,n);return L0(t,e),t};Object.defineProperty(On,"__esModule",{value:!0});On.default=U0;var Lc=j0(le()),D0=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Lc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${Lc.stringifyPrimitive(r.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${Lc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${r.minimum.toString()} ${a.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${a} ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${r.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u043E\u0432\u0435":""}: ${Lc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function U0(){return{localeError:D0()}}pv.exports=On.default});var gv=M((Rn,mv)=>{"use strict";var z0=Rn&&Rn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),F0=Rn&&Rn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),q0=Rn&&Rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&z0(t,e,n);return F0(t,e),t};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.default=W0;var jc=q0(le()),V0=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=jc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${r.expected}, s'ha rebut ${s}`:`Tipus inv\xE0lid: s'esperava ${o}, s'ha rebut ${s}`}case"invalid_value":return r.values.length===1?`Valor inv\xE0lid: s'esperava ${jc.stringifyPrimitive(r.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${jc.joinValues(r.values," o ")}`;case"too_big":{let o=r.inclusive?"com a m\xE0xim":"menys de",a=t(r.origin);return a?`Massa gran: s'esperava que ${r.origin??"el valor"} contingu\xE9s ${o} ${r.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"com a m\xEDnim":"m\xE9s de",a=t(r.origin);return a?`Massa petit: s'esperava que ${r.origin} contingu\xE9s ${o} ${r.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${r.origin} fos ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${n[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${jc.joinValues(r.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${r.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${r.origin}`;default:return"Entrada inv\xE0lida"}}};function W0(){return{localeError:V0()}}mv.exports=Rn.default});var yv=M((Cn,hv)=>{"use strict";var Z0=Cn&&Cn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),B0=Cn&&Cn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),H0=Cn&&Cn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Z0(t,e,n);return B0(t,e),t};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.default=K0;var Dc=H0(le()),J0=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(r){return e[r]??null}let n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Dc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${r.expected}, obdr\u017Eeno ${s}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o}, obdr\u017Eeno ${s}`}case"invalid_value":return r.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Dc.stringifyPrimitive(r.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${Dc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${n[o.format]??r.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${r.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${Dc.joinValues(r.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${r.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${r.origin}`;default:return"Neplatn\xFD vstup"}}};function K0(){return{localeError:J0()}}hv.exports=Cn.default});var bv=M(($n,vv)=>{"use strict";var G0=$n&&$n.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),X0=$n&&$n.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Y0=$n&&$n.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&G0(t,e,n);return X0(t,e),t};Object.defineProperty($n,"__esModule",{value:!0});$n.default=eN;var Uc=Y0(le()),Q0=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(r){return e[r]??null}let n={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},i={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Uc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ugyldigt input: forventede instanceof ${r.expected}, fik ${s}`:`Ugyldigt input: forventede ${o}, fik ${s}`}case"invalid_value":return r.values.length===1?`Ugyldig v\xE6rdi: forventede ${Uc.stringifyPrimitive(r.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${Uc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=i[r.origin]??r.origin;return a?`For stor: forventede ${s??"value"} ${a.verb} ${o} ${r.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=i[r.origin]??r.origin;return a?`For lille: forventede ${s} ${a.verb} ${o} ${r.minimum.toString()} ${a.unit}`:`For lille: forventede ${s} havde ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${n[o.format]??r.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${Uc.joinValues(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${r.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${r.origin}`;default:return"Ugyldigt input"}}};function eN(){return{localeError:Q0()}}vv.exports=$n.default});var kv=M((In,Sv)=>{"use strict";var tN=In&&In.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),nN=In&&In.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),rN=In&&In.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&tN(t,e,n);return nN(t,e),t};Object.defineProperty(In,"__esModule",{value:!0});In.default=oN;var zc=rN(le()),iN=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},i={nan:"NaN",number:"Zahl",array:"Array"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=zc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${r.expected}, erhalten ${s}`:`Ung\xFCltige Eingabe: erwartet ${o}, erhalten ${s}`}case"invalid_value":return r.values.length===1?`Ung\xFCltige Eingabe: erwartet ${zc.stringifyPrimitive(r.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${zc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ist`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ist`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${n[o.format]??r.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${zc.joinValues(r.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${r.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${r.origin}`;default:return"Ung\xFCltige Eingabe"}}};function oN(){return{localeError:iN()}}Sv.exports=In.default});var Ev=M((Nn,wv)=>{"use strict";var aN=Nn&&Nn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),sN=Nn&&Nn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),cN=Nn&&Nn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&aN(t,e,n);return sN(t,e),t};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.default=uN;var Fc=cN(le()),lN=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(r){return e[r]??null}let n={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Fc.parsedType(r.input),s=i[a]??a;return typeof r.expected=="string"&&/^[A-Z]/.test(r.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${r.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`}case"invalid_value":return r.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${Fc.stringifyPrimitive(r.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${Fc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${r.maximum.toString()} ${a.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${r.minimum.toString()} ${a.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${o.prefix}"`:o.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${o.suffix}"`:o.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${o.includes}"`:o.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${o.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${n[o.format]??r.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${r.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${r.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${r.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${Fc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${r.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${r.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function uN(){return{localeError:lN()}}wv.exports=Nn.default});var up=M((Pn,Av)=>{"use strict";var dN=Pn&&Pn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),_N=Pn&&Pn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pN=Pn&&Pn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&dN(t,e,n);return _N(t,e),t};Object.defineProperty(Pn,"__esModule",{value:!0});Pn.default=mN;var qc=pN(le()),fN=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(r){return e[r]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=qc.parsedType(r.input),s=i[a]??a;return`Invalid input: expected ${o}, received ${s}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${qc.stringifyPrimitive(r.values[0])}`:`Invalid option: expected one of ${qc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${a.unit}`:`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${qc.joinValues(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return r.options&&Array.isArray(r.options)&&r.options.length>0?`Invalid discriminator value. Expected ${r.options.map(a=>`'${a}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function mN(){return{localeError:fN()}}Av.exports=Pn.default});var xv=M((Mn,Tv)=>{"use strict";var gN=Mn&&Mn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),hN=Mn&&Mn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),yN=Mn&&Mn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&gN(t,e,n);return hN(t,e),t};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.default=bN;var Vc=yN(le()),vN=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(r){return e[r]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},i={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Vc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${r.expected}, ricevi\u011Dis ${s}`:`Nevalida enigo: atendi\u011Dis ${o}, ricevi\u011Dis ${s}`}case"invalid_value":return r.values.length===1?`Nevalida enigo: atendi\u011Dis ${Vc.stringifyPrimitive(r.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${Vc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${o}${r.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Tro malgranda: atendi\u011Dis ke ${r.origin} havu ${o}${r.minimum.toString()} ${a.unit}`:`Tro malgranda: atendi\u011Dis ke ${r.origin} estu ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${n[o.format]??r.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${r.divisor}`;case"unrecognized_keys":return`Nekonata${r.keys.length>1?"j":""} \u015Dlosilo${r.keys.length>1?"j":""}: ${Vc.joinValues(r.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${r.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${r.origin}`;default:return"Nevalida enigo"}}};function bN(){return{localeError:vN()}}Tv.exports=Mn.default});var Rv=M((Ln,Ov)=>{"use strict";var SN=Ln&&Ln.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),kN=Ln&&Ln.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),wN=Ln&&Ln.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&SN(t,e,n);return kN(t,e),t};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=AN;var Wc=wN(le()),EN=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(r){return e[r]??null}let n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Wc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${r.expected}, recibido ${s}`:`Entrada inv\xE1lida: se esperaba ${o}, recibido ${s}`}case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: se esperaba ${Wc.stringifyPrimitive(r.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${Wc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Demasiado peque\xF1o: se esperaba que ${s} tuviera ${o}${r.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${s} fuera ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${n[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Llave${r.keys.length>1?"s":""} desconocida${r.keys.length>1?"s":""}: ${Wc.joinValues(r.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${i[r.origin]??r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${i[r.origin]??r.origin}`;default:return"Entrada inv\xE1lida"}}};function AN(){return{localeError:EN()}}Ov.exports=Ln.default});var $v=M((jn,Cv)=>{"use strict";var TN=jn&&jn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),xN=jn&&jn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ON=jn&&jn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&TN(t,e,n);return xN(t,e),t};Object.defineProperty(jn,"__esModule",{value:!0});jn.default=CN;var Zc=ON(le()),RN=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(r){return e[r]??null}let n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Zc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${r.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return r.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Zc.stringifyPrimitive(r.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${Zc.joinValues(r.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[o.format]??r.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${r.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${r.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${Zc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${r.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${r.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function CN(){return{localeError:RN()}}Cv.exports=jn.default});var Nv=M((Dn,Iv)=>{"use strict";var $N=Dn&&Dn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),IN=Dn&&Dn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),NN=Dn&&Dn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&$N(t,e,n);return IN(t,e),t};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.default=MN;var Bc=NN(le()),PN=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(r){return e[r]??null}let n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Bc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Virheellinen tyyppi: odotettiin instanceof ${r.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${s}`}case"invalid_value":return r.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Bc.stringifyPrimitive(r.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${Bc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${o}${r.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${o}${r.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${n[o.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${Bc.joinValues(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function MN(){return{localeError:PN()}}Iv.exports=Dn.default});var Mv=M((Un,Pv)=>{"use strict";var LN=Un&&Un.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),jN=Un&&Un.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),DN=Un&&Un.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&LN(t,e,n);return jN(t,e),t};Object.defineProperty(Un,"__esModule",{value:!0});Un.default=zN;var Hc=DN(le()),UN=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},i={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Hc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Entr\xE9e invalide : instanceof ${r.expected} attendu, ${s} re\xE7u`:`Entr\xE9e invalide : ${o} attendu, ${s} re\xE7u`}case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : ${Hc.stringifyPrimitive(r.values[0])} attendu`:`Option invalide : une valeur parmi ${Hc.joinValues(r.values,"|")} attendue`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Trop grand : ${i[r.origin]??"valeur"} doit ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${i[r.origin]??"valeur"} doit \xEAtre ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Trop petit : ${i[r.origin]??"valeur"} doit ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : ${i[r.origin]??"valeur"} doit \xEAtre ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${n[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${Hc.joinValues(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};function zN(){return{localeError:UN()}}Pv.exports=Un.default});var jv=M((zn,Lv)=>{"use strict";var FN=zn&&zn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),qN=zn&&zn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),VN=zn&&zn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&FN(t,e,n);return qN(t,e),t};Object.defineProperty(zn,"__esModule",{value:!0});zn.default=ZN;var Jc=VN(le()),WN=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Jc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Entr\xE9e invalide : attendu instanceof ${r.expected}, re\xE7u ${s}`:`Entr\xE9e invalide : attendu ${o}, re\xE7u ${s}`}case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : attendu ${Jc.stringifyPrimitive(r.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${Jc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u2264":"<",a=t(r.origin);return a?`Trop grand : attendu que ${r.origin??"la valeur"} ait ${o}${r.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${r.origin??"la valeur"} soit ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u2265":">",a=t(r.origin);return a?`Trop petit : attendu que ${r.origin} ait ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${r.origin} soit ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${n[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${Jc.joinValues(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};function ZN(){return{localeError:WN()}}Lv.exports=zn.default});var Uv=M((Fn,Dv)=>{"use strict";var BN=Fn&&Fn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),HN=Fn&&Fn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),JN=Fn&&Fn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&BN(t,e,n);return HN(t,e),t};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.default=GN;var Kc=JN(le()),KN=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},n=c=>c?e[c]:void 0,i=c=>{let d=n(c);return d?d.label:c??e.unknown.label},r=c=>`\u05D4${i(c)}`,o=c=>(n(c)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",a=c=>c?t[c]??null:null,s={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return c=>{switch(c.code){case"invalid_type":{let d=c.expected,u=l[d??""]??i(d),_=Kc.parsedType(c.input),p=l[_]??e[_]?.label??_;return/^[A-Z]/.test(c.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${c.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${u}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(c.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${Kc.stringifyPrimitive(c.values[0])}`;let d=c.values.map(p=>Kc.stringifyPrimitive(p));if(c.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d[0]} \u05D0\u05D5 ${d[1]}`;let u=d[d.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d.slice(0,-1).join(", ")} \u05D0\u05D5 ${u}`}case"too_big":{let d=a(c.origin),u=r(c.origin??"value");if(c.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${c.maximum.toString()} ${d?.unit??""} ${c.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(c.origin==="number"){let y=c.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${c.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${c.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${y}`}if(c.origin==="array"||c.origin==="set"){let y=c.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",f=c.inclusive?`${c.maximum} ${d?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${c.maximum} ${d?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${u} ${y} \u05DC\u05D4\u05DB\u05D9\u05DC ${f}`.trim()}let _=c.inclusive?"<=":"<",p=o(c.origin??"value");return d?.unit?`${d.longLabel} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.maximum.toString()} ${d.unit}`:`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.maximum.toString()}`}case"too_small":{let d=a(c.origin),u=r(c.origin??"value");if(c.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${c.minimum.toString()} ${d?.unit??""} ${c.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(c.origin==="number"){let y=c.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${c.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${c.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${y}`}if(c.origin==="array"||c.origin==="set"){let y=c.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(c.minimum===1&&c.inclusive){let h=(c.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${u} ${y} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`}let f=c.inclusive?`${c.minimum} ${d?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${c.minimum} ${d?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${u} ${y} \u05DC\u05D4\u05DB\u05D9\u05DC ${f}`.trim()}let _=c.inclusive?">=":">",p=o(c.origin??"value");return d?.unit?`${d.shortLabel} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.minimum.toString()} ${d.unit}`:`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.minimum.toString()}`}case"invalid_format":{let d=c;if(d.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${d.prefix}"`;if(d.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${d.suffix}"`;if(d.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${d.includes}"`;if(d.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${d.pattern}`;let u=s[d.format],_=u?.label??d.format,y=(u?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${_} \u05DC\u05D0 ${y}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${c.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${c.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${c.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${Kc.joinValues(c.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${r(c.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function GN(){return{localeError:KN()}}Dv.exports=Fn.default});var Fv=M((qn,zv)=>{"use strict";var XN=qn&&qn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),YN=qn&&qn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),QN=qn&&qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&XN(t,e,n);return YN(t,e),t};Object.defineProperty(qn,"__esModule",{value:!0});qn.default=tP;var Gc=QN(le()),eP=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(r){return e[r]??null}let n={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},i={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Gc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${r.expected}, a primljeno je ${s}`:`Neispravan unos: o\u010Dekuje se ${o}, a primljeno je ${s}`}case"invalid_value":return r.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${Gc.stringifyPrimitive(r.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${Gc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Preveliko: o\u010Dekivano da ${s??"vrijednost"} ima ${o}${r.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${s??"vrijednost"} bude ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Premalo: o\u010Dekivano da ${s} ima ${o}${r.minimum.toString()} ${a.unit}`:`Premalo: o\u010Dekivano da ${s} bude ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${o.prefix}"`:o.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${o.suffix}"`:o.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${o.includes}"`:o.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${o.pattern}`:`Neispravna ${n[o.format]??r.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${r.divisor}`;case"unrecognized_keys":return`Neprepoznat${r.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${Gc.joinValues(r.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${i[r.origin]??r.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${i[r.origin]??r.origin}`;default:return"Neispravan unos"}}};function tP(){return{localeError:eP()}}zv.exports=qn.default});var Vv=M((Vn,qv)=>{"use strict";var nP=Vn&&Vn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),rP=Vn&&Vn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),iP=Vn&&Vn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&nP(t,e,n);return rP(t,e),t};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.default=aP;var Xc=iP(le()),oP=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},i={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Xc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${r.expected}, a kapott \xE9rt\xE9k ${s}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o}, a kapott \xE9rt\xE9k ${s}`}case"invalid_value":return r.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Xc.stringifyPrimitive(r.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${Xc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`T\xFAl nagy: ${r.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${r.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${r.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} m\xE9rete t\xFAl kicsi ${o}${r.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} t\xFAl kicsi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[o.format]??r.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${r.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${Xc.joinValues(r.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${r.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${r.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function aP(){return{localeError:oP()}}qv.exports=Vn.default});var Bv=M((Wn,Zv)=>{"use strict";var sP=Wn&&Wn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),cP=Wn&&Wn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),lP=Wn&&Wn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&sP(t,e,n);return cP(t,e),t};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.default=dP;var Yc=lP(le());function Wv(e,t,n){return Math.abs(e)===1?t:n}function To(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],n=e[e.length-1];return e+(t.includes(n)?"\u0576":"\u0568")}var uP=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(r){return e[r]??null}let n={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},i={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Yc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${r.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${o}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`}case"invalid_value":return r.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${Yc.stringifyPrimitive(r.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${Yc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),l=Wv(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${To(r.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${r.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${To(r.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),l=Wv(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${To(r.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${r.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${To(r.origin)} \u056C\u056B\u0576\u056B ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${o.prefix}"-\u0578\u057E`:o.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${o.suffix}"-\u0578\u057E`:o.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${o.includes}"`:o.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${o.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${n[o.format]??r.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${r.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${r.keys.length>1?"\u0576\u0565\u0580":""}. ${Yc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${To(r.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${To(r.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function dP(){return{localeError:uP()}}Zv.exports=Wn.default});var Jv=M((Zn,Hv)=>{"use strict";var _P=Zn&&Zn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),pP=Zn&&Zn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),fP=Zn&&Zn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&_P(t,e,n);return pP(t,e),t};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.default=gP;var Qc=fP(le()),mP=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Qc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Input tidak valid: diharapkan instanceof ${r.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${o}, diterima ${s}`}case"invalid_value":return r.values.length===1?`Input tidak valid: diharapkan ${Qc.stringifyPrimitive(r.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${Qc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: diharapkan ${r.origin} memiliki ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${r.origin} menjadi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${n[o.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${Qc.joinValues(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function gP(){return{localeError:mP()}}Hv.exports=Zn.default});var Gv=M((Bn,Kv)=>{"use strict";var hP=Bn&&Bn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),yP=Bn&&Bn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),vP=Bn&&Bn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&hP(t,e,n);return yP(t,e),t};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.default=SP;var el=vP(le()),bP=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(r){return e[r]??null}let n={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},i={nan:"NaN",number:"n\xFAmer",array:"fylki"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=el.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera instanceof ${r.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera ${o}`}case"invalid_value":return r.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${el.stringifyPrimitive(r.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${el.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin??"gildi"} hafi ${o}${r.maximum.toString()} ${a.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin??"gildi"} s\xE9 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin} hafi ${o}${r.minimum.toString()} ${a.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin} s\xE9 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${n[o.format]??r.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${r.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${r.keys.length>1?"ir lyklar":"ur lykill"}: ${el.joinValues(r.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${r.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${r.origin}`;default:return"Rangt gildi"}}};function SP(){return{localeError:bP()}}Kv.exports=Bn.default});var Yv=M((Hn,Xv)=>{"use strict";var kP=Hn&&Hn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),wP=Hn&&Hn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EP=Hn&&Hn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&kP(t,e,n);return wP(t,e),t};Object.defineProperty(Hn,"__esModule",{value:!0});Hn.default=TP;var tl=EP(le()),AP=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"numero",array:"vettore"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=tl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Input non valido: atteso instanceof ${r.expected}, ricevuto ${s}`:`Input non valido: atteso ${o}, ricevuto ${s}`}case"invalid_value":return r.values.length===1?`Input non valido: atteso ${tl.stringifyPrimitive(r.values[0])}`:`Opzione non valida: atteso uno tra ${tl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Troppo grande: ${r.origin??"valore"} deve avere ${o}${r.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${r.origin??"valore"} deve essere ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Troppo piccolo: ${r.origin} deve avere ${o}${r.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${r.origin} deve essere ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Input non valido: ${n[o.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${tl.joinValues(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function TP(){return{localeError:AP()}}Xv.exports=Hn.default});var eb=M((Jn,Qv)=>{"use strict";var xP=Jn&&Jn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),OP=Jn&&Jn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),RP=Jn&&Jn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&xP(t,e,n);return OP(t,e),t};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.default=$P;var nl=RP(le()),CP=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(r){return e[r]??null}let n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},i={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=nl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${r.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${o}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return r.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${nl.stringifyPrimitive(r.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${nl.joinValues(r.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=r.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=t(r.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${a.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=r.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=t(r.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${a.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${r.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${r.keys.length>1?"\u7FA4":""}: ${nl.joinValues(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function $P(){return{localeError:CP()}}Qv.exports=Jn.default});var nb=M((Kn,tb)=>{"use strict";var IP=Kn&&Kn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),NP=Kn&&Kn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),PP=Kn&&Kn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&IP(t,e,n);return NP(t,e),t};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.default=LP;var rl=PP(le()),MP=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(r){return e[r]??null}let n={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},i={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=rl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${r.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`}case"invalid_value":return r.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${rl.stringifyPrimitive(r.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${rl.joinValues(r.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${r.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${r.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${rl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${r.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${r.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function LP(){return{localeError:MP()}}tb.exports=Kn.default});var dp=M((Gn,rb)=>{"use strict";var jP=Gn&&Gn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),DP=Gn&&Gn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),UP=Gn&&Gn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&jP(t,e,n);return DP(t,e),t};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.default=FP;var il=UP(le()),zP=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(r){return e[r]??null}let n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},i={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=il.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${r.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`}case"invalid_value":return r.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${il.stringifyPrimitive(r.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${il.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${r.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${il.joinValues(r.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function FP(){return{localeError:zP()}}rb.exports=Gn.default});var ob=M((xo,ib)=>{"use strict";var qP=xo&&xo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});xo.default=WP;var VP=qP(dp());function WP(){return(0,VP.default)()}ib.exports=xo.default});var sb=M((Xn,ab)=>{"use strict";var ZP=Xn&&Xn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),BP=Xn&&Xn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),HP=Xn&&Xn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&ZP(t,e,n);return BP(t,e),t};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.default=KP;var ol=HP(le()),JP=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(r){return e[r]??null}let n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ol.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${r.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`}case"invalid_value":return r.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${ol.stringifyPrimitive(r.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${ol.joinValues(r.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=r.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),l=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()}${l} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()} ${o}${a}`}case"too_small":{let o=r.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),l=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()}${l} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()} ${o}${a}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[o.format]??r.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${r.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${ol.joinValues(r.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${r.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${r.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function KP(){return{localeError:JP()}}ab.exports=Xn.default});var ub=M((Yn,lb)=>{"use strict";var GP=Yn&&Yn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),XP=Yn&&Yn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),YP=Yn&&Yn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&GP(t,e,n);return XP(t,e),t};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.default=eM;var al=YP(le()),Oa=e=>e.charAt(0).toUpperCase()+e.slice(1);function cb(e){let t=Math.abs(e),n=t%10,i=t%100;return i>=11&&i<=19||n===0?"many":n===1?"one":"few"}var QP=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(r,o,a,s){let l=e[r]??null;return l===null?l:{unit:l.unit[o],verb:l.verb[s][a?"inclusive":"notInclusive"]}}let n={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},i={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=al.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Gautas tipas ${s}, o tik\u0117tasi - instanceof ${r.expected}`:`Gautas tipas ${s}, o tik\u0117tasi - ${o}`}case"invalid_value":return r.values.length===1?`Privalo b\u016Bti ${al.stringifyPrimitive(r.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${al.joinValues(r.values,"|")} pasirinkim\u0173`;case"too_big":{let o=i[r.origin]??r.origin,a=t(r.origin,cb(Number(r.maximum)),r.inclusive??!1,"smaller");if(a?.verb)return`${Oa(o??r.origin??"reik\u0161m\u0117")} ${a.verb} ${r.maximum.toString()} ${a.unit??"element\u0173"}`;let s=r.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Oa(o??r.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${r.maximum.toString()} ${a?.unit}`}case"too_small":{let o=i[r.origin]??r.origin,a=t(r.origin,cb(Number(r.minimum)),r.inclusive??!1,"bigger");if(a?.verb)return`${Oa(o??r.origin??"reik\u0161m\u0117")} ${a.verb} ${r.minimum.toString()} ${a.unit??"element\u0173"}`;let s=r.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Oa(o??r.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${r.minimum.toString()} ${a?.unit}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${n[o.format]??r.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${r.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${r.keys.length>1?"i":"as"} rakt${r.keys.length>1?"ai":"as"}: ${al.joinValues(r.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=i[r.origin]??r.origin;return`${Oa(o??r.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function eM(){return{localeError:QP()}}lb.exports=Yn.default});var _b=M((Qn,db)=>{"use strict";var tM=Qn&&Qn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),nM=Qn&&Qn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),rM=Qn&&Qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&tM(t,e,n);return nM(t,e),t};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.default=oM;var sl=rM(le()),iM=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(r){return e[r]??null}let n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},i={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=sl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${r.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${sl.stringifyPrimitive(r.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${sl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${sl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${r.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${r.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function oM(){return{localeError:iM()}}db.exports=Qn.default});var fb=M((er,pb)=>{"use strict";var aM=er&&er.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),sM=er&&er.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),cM=er&&er.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&aM(t,e,n);return sM(t,e),t};Object.defineProperty(er,"__esModule",{value:!0});er.default=uM;var cl=cM(le()),lM=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"nombor"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=cl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Input tidak sah: dijangka instanceof ${r.expected}, diterima ${s}`:`Input tidak sah: dijangka ${o}, diterima ${s}`}case"invalid_value":return r.values.length===1?`Input tidak sah: dijangka ${cl.stringifyPrimitive(r.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${cl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: dijangka ${r.origin??"nilai"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: dijangka ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${r.origin} adalah ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${n[o.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${cl.joinValues(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function uM(){return{localeError:lM()}}pb.exports=er.default});var gb=M((tr,mb)=>{"use strict";var dM=tr&&tr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),_M=tr&&tr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pM=tr&&tr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&dM(t,e,n);return _M(t,e),t};Object.defineProperty(tr,"__esModule",{value:!0});tr.default=mM;var ll=pM(le()),fM=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(r){return e[r]??null}let n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},i={nan:"NaN",number:"getal"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ll.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ongeldige invoer: verwacht instanceof ${r.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${o}, ontving ${s}`}case"invalid_value":return r.values.length===1?`Ongeldige invoer: verwacht ${ll.stringifyPrimitive(r.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${ll.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=r.origin==="date"?"laat":r.origin==="string"?"lang":"groot";return a?`Te ${s}: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${s}: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} is`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=r.origin==="date"?"vroeg":r.origin==="string"?"kort":"klein";return a?`Te ${s}: verwacht dat ${r.origin} ${o}${r.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${s}: verwacht dat ${r.origin} ${o}${r.minimum.toString()} is`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${n[o.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${ll.joinValues(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function mM(){return{localeError:fM()}}mb.exports=tr.default});var yb=M((nr,hb)=>{"use strict";var gM=nr&&nr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),hM=nr&&nr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),yM=nr&&nr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&gM(t,e,n);return hM(t,e),t};Object.defineProperty(nr,"__esModule",{value:!0});nr.default=bM;var ul=yM(le()),vM=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(r){return e[r]??null}let n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"tall",array:"liste"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ul.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ugyldig input: forventet instanceof ${r.expected}, fikk ${s}`:`Ugyldig input: forventet ${o}, fikk ${s}`}case"invalid_value":return r.values.length===1?`Ugyldig verdi: forventet ${ul.stringifyPrimitive(r.values[0])}`:`Ugyldig valg: forventet en av ${ul.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${n[o.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${ul.joinValues(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function bM(){return{localeError:vM()}}hb.exports=nr.default});var bb=M((rr,vb)=>{"use strict";var SM=rr&&rr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),kM=rr&&rr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),wM=rr&&rr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&SM(t,e,n);return kM(t,e),t};Object.defineProperty(rr,"__esModule",{value:!0});rr.default=AM;var dl=wM(le()),EM=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},i={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=dl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`F\xE2sit giren: umulan instanceof ${r.expected}, al\u0131nan ${s}`:`F\xE2sit giren: umulan ${o}, al\u0131nan ${s}`}case"invalid_value":return r.values.length===1?`F\xE2sit giren: umulan ${dl.stringifyPrimitive(r.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${dl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=r;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[o.format]??r.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${r.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${r.keys.length>1?"s":""}: ${dl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${r.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function AM(){return{localeError:EM()}}vb.exports=rr.default});var kb=M((ir,Sb)=>{"use strict";var TM=ir&&ir.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),xM=ir&&ir.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),OM=ir&&ir.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&TM(t,e,n);return xM(t,e),t};Object.defineProperty(ir,"__esModule",{value:!0});ir.default=CM;var _l=OM(le()),RM=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(r){return e[r]??null}let n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=_l.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${r.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return r.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${_l.stringifyPrimitive(r.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${_l.joinValues(r.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0648\u064A`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[o.format]??r.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${r.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${r.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${_l.joinValues(r.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${r.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${r.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function CM(){return{localeError:RM()}}Sb.exports=ir.default});var Eb=M((or,wb)=>{"use strict";var $M=or&&or.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),IM=or&&or.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),NM=or&&or.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&$M(t,e,n);return IM(t,e),t};Object.defineProperty(or,"__esModule",{value:!0});or.default=MM;var pl=NM(le()),PM=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(r){return e[r]??null}let n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},i={nan:"NaN",number:"liczba",array:"tablica"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=pl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${r.expected}, otrzymano ${s}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o}, otrzymano ${s}`}case"invalid_value":return r.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${pl.stringifyPrimitive(r.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${pl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[o.format]??r.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${pl.joinValues(r.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${r.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${r.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function MM(){return{localeError:PM()}}wb.exports=or.default});var Tb=M((ar,Ab)=>{"use strict";var LM=ar&&ar.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),jM=ar&&ar.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),DM=ar&&ar.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&LM(t,e,n);return jM(t,e),t};Object.defineProperty(ar,"__esModule",{value:!0});ar.default=zM;var fl=DM(le()),UM=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",number:"n\xFAmero",null:"nulo"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=fl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Tipo inv\xE1lido: esperado instanceof ${r.expected}, recebido ${s}`:`Tipo inv\xE1lido: esperado ${o}, recebido ${s}`}case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: esperado ${fl.stringifyPrimitive(r.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${fl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Muito grande: esperado que ${r.origin??"valor"} tivesse ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${r.origin??"valor"} fosse ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Muito pequeno: esperado que ${r.origin} tivesse ${o}${r.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${r.origin} fosse ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${n[o.format]??r.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${fl.joinValues(r.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${r.origin}`;default:return"Campo inv\xE1lido"}}};function zM(){return{localeError:UM()}}Ab.exports=ar.default});var Ob=M((sr,xb)=>{"use strict";var FM=sr&&sr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),qM=sr&&sr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),VM=sr&&sr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&FM(t,e,n);return qM(t,e),t};Object.defineProperty(sr,"__esModule",{value:!0});sr.default=ZM;var ml=VM(le()),WM=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(r){return e[r]??null}let n={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},i={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ml.parsedType(r.input),s=i[a]??a;return`Intrare invalid\u0103: a\u0219teptat ${o}, primit ${s}`}case"invalid_value":return r.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${ml.stringifyPrimitive(r.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${ml.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Prea mare: a\u0219teptat ca ${r.origin??"valoarea"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${r.origin??"valoarea"} s\u0103 fie ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Prea mic: a\u0219teptat ca ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Prea mic: a\u0219teptat ca ${r.origin} s\u0103 fie ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${o.prefix}"`:o.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${o.suffix}"`:o.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${o.includes}"`:o.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${o.pattern}`:`Format invalid: ${n[o.format]??r.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${r.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${ml.joinValues(r.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${r.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${r.origin}`;default:return"Intrare invalid\u0103"}}};function ZM(){return{localeError:WM()}}xb.exports=sr.default});var $b=M((cr,Cb)=>{"use strict";var BM=cr&&cr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),HM=cr&&cr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),JM=cr&&cr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&BM(t,e,n);return HM(t,e),t};Object.defineProperty(cr,"__esModule",{value:!0});cr.default=GM;var gl=JM(le());function Rb(e,t,n,i){let r=Math.abs(e),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?n:i}var KM=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=gl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${gl.stringifyPrimitive(r.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${gl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),l=Rb(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),l=Rb(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${r.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0438":""}: ${gl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function GM(){return{localeError:KM()}}Cb.exports=cr.default});var Nb=M((lr,Ib)=>{"use strict";var XM=lr&&lr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),YM=lr&&lr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),QM=lr&&lr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&XM(t,e,n);return YM(t,e),t};Object.defineProperty(lr,"__esModule",{value:!0});lr.default=tL;var hl=QM(le()),eL=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},i={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=hl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${r.expected}, prejeto ${s}`:`Neveljaven vnos: pri\u010Dakovano ${o}, prejeto ${s}`}case"invalid_value":return r.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${hl.stringifyPrimitive(r.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${hl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} imelo ${o}${r.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${r.origin} imelo ${o}${r.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${n[o.format]??r.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${hl.joinValues(r.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function tL(){return{localeError:eL()}}Ib.exports=lr.default});var Mb=M((ur,Pb)=>{"use strict";var nL=ur&&ur.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),rL=ur&&ur.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),iL=ur&&ur.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&nL(t,e,n);return rL(t,e),t};Object.defineProperty(ur,"__esModule",{value:!0});ur.default=aL;var yl=iL(le()),oL=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(r){return e[r]??null}let n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},i={nan:"NaN",number:"antal",array:"lista"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=yl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${r.expected}, fick ${s}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${o}, fick ${s}`}case"invalid_value":return r.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${yl.stringifyPrimitive(r.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${yl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${n[o.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${yl.joinValues(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${r.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function aL(){return{localeError:oL()}}Pb.exports=ur.default});var jb=M((dr,Lb)=>{"use strict";var sL=dr&&dr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),cL=dr&&dr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),lL=dr&&dr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&sL(t,e,n);return cL(t,e),t};Object.defineProperty(dr,"__esModule",{value:!0});dr.default=dL;var vl=lL(le()),uL=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(r){return e[r]??null}let n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=vl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${r.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`}case"invalid_value":return r.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${vl.stringifyPrimitive(r.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${vl.joinValues(r.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${r.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${r.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${vl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function dL(){return{localeError:uL()}}Lb.exports=dr.default});var Ub=M((_r,Db)=>{"use strict";var _L=_r&&_r.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),pL=_r&&_r.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),fL=_r&&_r.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&_L(t,e,n);return pL(t,e),t};Object.defineProperty(_r,"__esModule",{value:!0});_r.default=gL;var bl=fL(le()),mL=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(r){return e[r]??null}let n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},i={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=bl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${r.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`}case"invalid_value":return r.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${bl.stringifyPrimitive(r.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${bl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[o.format]??r.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${r.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${bl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function gL(){return{localeError:mL()}}Db.exports=_r.default});var Fb=M((pr,zb)=>{"use strict";var hL=pr&&pr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),yL=pr&&pr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),vL=pr&&pr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&hL(t,e,n);return yL(t,e),t};Object.defineProperty(pr,"__esModule",{value:!0});pr.default=SL;var Sl=vL(le()),bL=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(r){return e[r]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Sl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${r.expected}, al\u0131nan ${s}`:`Ge\xE7ersiz de\u011Fer: beklenen ${o}, al\u0131nan ${s}`}case"invalid_value":return r.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Sl.stringifyPrimitive(r.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${Sl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${o}${r.maximum.toString()} ${a.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${n[o.format]??r.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${r.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${r.keys.length>1?"lar":""}: ${Sl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${r.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function SL(){return{localeError:bL()}}zb.exports=pr.default});var _p=M((fr,qb)=>{"use strict";var kL=fr&&fr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),wL=fr&&fr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EL=fr&&fr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&kL(t,e,n);return wL(t,e),t};Object.defineProperty(fr,"__esModule",{value:!0});fr.default=TL;var kl=EL(le()),AL=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=kl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${r.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${kl.stringifyPrimitive(r.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${kl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} \u0431\u0443\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0456":""}: ${kl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${r.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function TL(){return{localeError:AL()}}qb.exports=fr.default});var Wb=M((Oo,Vb)=>{"use strict";var xL=Oo&&Oo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.default=RL;var OL=xL(_p());function RL(){return(0,OL.default)()}Vb.exports=Oo.default});var Bb=M((mr,Zb)=>{"use strict";var CL=mr&&mr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),$L=mr&&mr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),IL=mr&&mr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&CL(t,e,n);return $L(t,e),t};Object.defineProperty(mr,"__esModule",{value:!0});mr.default=PL;var wl=IL(le()),NL=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(r){return e[r]??null}let n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},i={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=wl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${r.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return r.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${wl.stringifyPrimitive(r.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${wl.joinValues(r.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${r.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u06D2 ${o}${r.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u0627 ${o}${r.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${r.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${r.keys.length>1?"\u0632":""}: ${wl.joinValues(r.keys,"\u060C ")}`;case"invalid_key":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function PL(){return{localeError:NL()}}Zb.exports=mr.default});var Jb=M((gr,Hb)=>{"use strict";var ML=gr&&gr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),LL=gr&&gr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),jL=gr&&gr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&ML(t,e,n);return LL(t,e),t};Object.defineProperty(gr,"__esModule",{value:!0});gr.default=UL;var El=jL(le()),DL=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(r){return e[r]??null}let n={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},i={nan:"NaN",number:"raqam",array:"massiv"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=El.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${r.expected}, qabul qilingan ${s}`:`Noto\u2018g\u2018ri kirish: kutilgan ${o}, qabul qilingan ${s}`}case"invalid_value":return r.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${El.stringifyPrimitive(r.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${El.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Juda katta: kutilgan ${r.origin??"qiymat"} ${o}${r.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${r.origin??"qiymat"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Juda kichik: kutilgan ${r.origin} ${o}${r.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto\u2018g\u2018ri satr: "${o.includes}" ni o\u2018z ichiga olishi kerak`:o.format==="regex"?`Noto\u2018g\u2018ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${n[o.format]??r.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${r.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${r.keys.length>1?"lar":""}: ${El.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${r.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function UL(){return{localeError:DL()}}Hb.exports=gr.default});var Gb=M((hr,Kb)=>{"use strict";var zL=hr&&hr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),FL=hr&&hr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),qL=hr&&hr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&zL(t,e,n);return FL(t,e),t};Object.defineProperty(hr,"__esModule",{value:!0});hr.default=WL;var Al=qL(le()),VL=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(r){return e[r]??null}let n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},i={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Al.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${r.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`}case"invalid_value":return r.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Al.stringifyPrimitive(r.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${Al.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${n[o.format]??r.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${r.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${Al.joinValues(r.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function WL(){return{localeError:VL()}}Kb.exports=hr.default});var Yb=M((yr,Xb)=>{"use strict";var ZL=yr&&yr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),BL=yr&&yr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),HL=yr&&yr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&ZL(t,e,n);return BL(t,e),t};Object.defineProperty(yr,"__esModule",{value:!0});yr.default=KL;var Tl=HL(le()),JL=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(r){return e[r]??null}let n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},i={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Tl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${r.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`}case"invalid_value":return r.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Tl.stringifyPrimitive(r.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${Tl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${n[o.format]??r.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${r.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${Tl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${r.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function KL(){return{localeError:JL()}}Xb.exports=yr.default});var eS=M((vr,Qb)=>{"use strict";var GL=vr&&vr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),XL=vr&&vr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),YL=vr&&vr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&GL(t,e,n);return XL(t,e),t};Object.defineProperty(vr,"__esModule",{value:!0});vr.default=ej;var xl=YL(le()),QL=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(r){return e[r]??null}let n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=xl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${r.expected}\uFF0C\u4F46\u6536\u5230 ${s}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o}\uFF0C\u4F46\u6536\u5230 ${s}`}case"invalid_value":return r.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${xl.stringifyPrimitive(r.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${xl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${r.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${r.keys.length>1?"\u5011":""}\uFF1A${xl.joinValues(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function ej(){return{localeError:QL()}}Qb.exports=vr.default});var nS=M((br,tS)=>{"use strict";var tj=br&&br.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),nj=br&&br.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),rj=br&&br.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&tj(t,e,n);return nj(t,e),t};Object.defineProperty(br,"__esModule",{value:!0});br.default=oj;var Ol=rj(le()),ij=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(r){return e[r]??null}let n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},i={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Ol.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${r.expected}, \xE0m\u1ECD\u0300 a r\xED ${s}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o}, \xE0m\u1ECD\u0300 a r\xED ${s}`}case"invalid_value":return r.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${Ol.stringifyPrimitive(r.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${Ol.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${r.origin??"iye"} ${a.verb} ${o}${r.maximum} ${a.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${r.maximum}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${r.origin} ${a.verb} ${o}${r.minimum} ${a.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${r.minimum}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${o.prefix}"`:o.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${o.suffix}"`:o.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${o.includes}"`:o.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${o.pattern}`:`A\u1E63\xEC\u1E63e: ${n[o.format]??r.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${r.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${Ol.joinValues(r.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${r.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${r.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function oj(){return{localeError:ij()}}tS.exports=br.default});var pp=M(q=>{"use strict";var me=q&&q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.zhCN=q.vi=q.uz=q.ur=q.uk=q.ua=q.tr=q.th=q.ta=q.sv=q.sl=q.ru=q.ro=q.pt=q.pl=q.ps=q.ota=q.no=q.nl=q.ms=q.mk=q.lt=q.ko=q.km=q.kh=q.ka=q.ja=q.it=q.is=q.id=q.hy=q.hu=q.hr=q.he=q.frCA=q.fr=q.fi=q.fa=q.es=q.eo=q.en=q.el=q.de=q.da=q.cs=q.ca=q.bg=q.be=q.az=q.ar=void 0;q.yo=q.zhTW=void 0;var aj=sv();Object.defineProperty(q,"ar",{enumerable:!0,get:function(){return me(aj).default}});var sj=lv();Object.defineProperty(q,"az",{enumerable:!0,get:function(){return me(sj).default}});var cj=_v();Object.defineProperty(q,"be",{enumerable:!0,get:function(){return me(cj).default}});var lj=fv();Object.defineProperty(q,"bg",{enumerable:!0,get:function(){return me(lj).default}});var uj=gv();Object.defineProperty(q,"ca",{enumerable:!0,get:function(){return me(uj).default}});var dj=yv();Object.defineProperty(q,"cs",{enumerable:!0,get:function(){return me(dj).default}});var _j=bv();Object.defineProperty(q,"da",{enumerable:!0,get:function(){return me(_j).default}});var pj=kv();Object.defineProperty(q,"de",{enumerable:!0,get:function(){return me(pj).default}});var fj=Ev();Object.defineProperty(q,"el",{enumerable:!0,get:function(){return me(fj).default}});var mj=up();Object.defineProperty(q,"en",{enumerable:!0,get:function(){return me(mj).default}});var gj=xv();Object.defineProperty(q,"eo",{enumerable:!0,get:function(){return me(gj).default}});var hj=Rv();Object.defineProperty(q,"es",{enumerable:!0,get:function(){return me(hj).default}});var yj=$v();Object.defineProperty(q,"fa",{enumerable:!0,get:function(){return me(yj).default}});var vj=Nv();Object.defineProperty(q,"fi",{enumerable:!0,get:function(){return me(vj).default}});var bj=Mv();Object.defineProperty(q,"fr",{enumerable:!0,get:function(){return me(bj).default}});var Sj=jv();Object.defineProperty(q,"frCA",{enumerable:!0,get:function(){return me(Sj).default}});var kj=Uv();Object.defineProperty(q,"he",{enumerable:!0,get:function(){return me(kj).default}});var wj=Fv();Object.defineProperty(q,"hr",{enumerable:!0,get:function(){return me(wj).default}});var Ej=Vv();Object.defineProperty(q,"hu",{enumerable:!0,get:function(){return me(Ej).default}});var Aj=Bv();Object.defineProperty(q,"hy",{enumerable:!0,get:function(){return me(Aj).default}});var Tj=Jv();Object.defineProperty(q,"id",{enumerable:!0,get:function(){return me(Tj).default}});var xj=Gv();Object.defineProperty(q,"is",{enumerable:!0,get:function(){return me(xj).default}});var Oj=Yv();Object.defineProperty(q,"it",{enumerable:!0,get:function(){return me(Oj).default}});var Rj=eb();Object.defineProperty(q,"ja",{enumerable:!0,get:function(){return me(Rj).default}});var Cj=nb();Object.defineProperty(q,"ka",{enumerable:!0,get:function(){return me(Cj).default}});var $j=ob();Object.defineProperty(q,"kh",{enumerable:!0,get:function(){return me($j).default}});var Ij=dp();Object.defineProperty(q,"km",{enumerable:!0,get:function(){return me(Ij).default}});var Nj=sb();Object.defineProperty(q,"ko",{enumerable:!0,get:function(){return me(Nj).default}});var Pj=ub();Object.defineProperty(q,"lt",{enumerable:!0,get:function(){return me(Pj).default}});var Mj=_b();Object.defineProperty(q,"mk",{enumerable:!0,get:function(){return me(Mj).default}});var Lj=fb();Object.defineProperty(q,"ms",{enumerable:!0,get:function(){return me(Lj).default}});var jj=gb();Object.defineProperty(q,"nl",{enumerable:!0,get:function(){return me(jj).default}});var Dj=yb();Object.defineProperty(q,"no",{enumerable:!0,get:function(){return me(Dj).default}});var Uj=bb();Object.defineProperty(q,"ota",{enumerable:!0,get:function(){return me(Uj).default}});var zj=kb();Object.defineProperty(q,"ps",{enumerable:!0,get:function(){return me(zj).default}});var Fj=Eb();Object.defineProperty(q,"pl",{enumerable:!0,get:function(){return me(Fj).default}});var qj=Tb();Object.defineProperty(q,"pt",{enumerable:!0,get:function(){return me(qj).default}});var Vj=Ob();Object.defineProperty(q,"ro",{enumerable:!0,get:function(){return me(Vj).default}});var Wj=$b();Object.defineProperty(q,"ru",{enumerable:!0,get:function(){return me(Wj).default}});var Zj=Nb();Object.defineProperty(q,"sl",{enumerable:!0,get:function(){return me(Zj).default}});var Bj=Mb();Object.defineProperty(q,"sv",{enumerable:!0,get:function(){return me(Bj).default}});var Hj=jb();Object.defineProperty(q,"ta",{enumerable:!0,get:function(){return me(Hj).default}});var Jj=Ub();Object.defineProperty(q,"th",{enumerable:!0,get:function(){return me(Jj).default}});var Kj=Fb();Object.defineProperty(q,"tr",{enumerable:!0,get:function(){return me(Kj).default}});var Gj=Wb();Object.defineProperty(q,"ua",{enumerable:!0,get:function(){return me(Gj).default}});var Xj=_p();Object.defineProperty(q,"uk",{enumerable:!0,get:function(){return me(Xj).default}});var Yj=Bb();Object.defineProperty(q,"ur",{enumerable:!0,get:function(){return me(Yj).default}});var Qj=Jb();Object.defineProperty(q,"uz",{enumerable:!0,get:function(){return me(Qj).default}});var eD=Gb();Object.defineProperty(q,"vi",{enumerable:!0,get:function(){return me(eD).default}});var tD=Yb();Object.defineProperty(q,"zhCN",{enumerable:!0,get:function(){return me(tD).default}});var nD=eS();Object.defineProperty(q,"zhTW",{enumerable:!0,get:function(){return me(nD).default}});var rD=nS();Object.defineProperty(q,"yo",{enumerable:!0,get:function(){return me(rD).default}})});var Ra=M(pn=>{"use strict";var rS;Object.defineProperty(pn,"__esModule",{value:!0});pn.globalRegistry=pn.$ZodRegistry=pn.$input=pn.$output=void 0;pn.registry=iS;pn.$output=Symbol("ZodOutput");pn.$input=Symbol("ZodInput");var Rl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let i={...this.get(n)??{}};delete i.id;let r={...i,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};pn.$ZodRegistry=Rl;function iS(){return new Rl}(rS=globalThis).__zod_globalRegistry??(rS.__zod_globalRegistry=iS());pn.globalRegistry=globalThis.__zod_globalRegistry});var cS=M(j=>{"use strict";var iD=j&&j.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),oD=j&&j.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Il=j&&j.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&iD(t,e,n);return oD(t,e),t};Object.defineProperty(j,"__esModule",{value:!0});j.TimePrecision=void 0;j._string=aD;j._coercedString=sD;j._email=cD;j._guid=lD;j._uuid=uD;j._uuidv4=dD;j._uuidv6=_D;j._uuidv7=pD;j._url=fD;j._emoji=mD;j._nanoid=gD;j._cuid=hD;j._cuid2=yD;j._ulid=vD;j._xid=bD;j._ksuid=SD;j._ipv4=kD;j._ipv6=wD;j._mac=ED;j._cidrv4=AD;j._cidrv6=TD;j._base64=xD;j._base64url=OD;j._e164=RD;j._jwt=CD;j._isoDateTime=$D;j._isoDate=ID;j._isoTime=ND;j._isoDuration=PD;j._number=MD;j._coercedNumber=LD;j._int=jD;j._float32=DD;j._float64=UD;j._int32=zD;j._uint32=FD;j._boolean=qD;j._coercedBoolean=VD;j._bigint=WD;j._coercedBigint=ZD;j._int64=BD;j._uint64=HD;j._symbol=JD;j._undefined=KD;j._null=GD;j._any=XD;j._unknown=YD;j._never=QD;j._void=eU;j._date=tU;j._coercedDate=nU;j._nan=rU;j._lt=oS;j._lte=Ca;j._max=Ca;j._lte=Ca;j._max=Ca;j._gt=aS;j._gte=$a;j._min=$a;j._gte=$a;j._min=$a;j._positive=iU;j._negative=oU;j._nonpositive=aU;j._nonnegative=sU;j._multipleOf=cU;j._maxSize=lU;j._minSize=uU;j._size=dU;j._maxLength=_U;j._minLength=pU;j._length=fU;j._regex=mU;j._lowercase=gU;j._uppercase=hU;j._includes=yU;j._startsWith=vU;j._endsWith=bU;j._property=SU;j._mime=kU;j._overwrite=Ro;j._normalize=wU;j._trim=EU;j._toLowerCase=AU;j._toUpperCase=TU;j._slugify=xU;j._array=OU;j._union=RU;j._xor=CU;j._discriminatedUnion=$U;j._intersection=IU;j._tuple=NU;j._record=PU;j._map=MU;j._set=LU;j._enum=jU;j._nativeEnum=DU;j._literal=UU;j._file=zU;j._transform=FU;j._optional=qU;j._nullable=VU;j._default=WU;j._nonoptional=ZU;j._success=BU;j._catch=HU;j._pipe=JU;j._readonly=KU;j._templateLiteral=GU;j._lazy=XU;j._promise=YU;j._custom=QU;j._refine=e1;j._superRefine=t1;j._check=sS;j.describe=n1;j.meta=r1;j._stringbool=i1;j._stringFormat=o1;var it=Il(Ec()),$l=Il(Ra()),Cl=Il(lp()),J=Il(le());function aD(e,t){return new e({type:"string",...J.normalizeParams(t)})}function sD(e,t){return new e({type:"string",coerce:!0,...J.normalizeParams(t)})}function cD(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...J.normalizeParams(t)})}function lD(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function uD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function dD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J.normalizeParams(t)})}function _D(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J.normalizeParams(t)})}function pD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J.normalizeParams(t)})}function fD(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...J.normalizeParams(t)})}function mD(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...J.normalizeParams(t)})}function gD(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function hD(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function yD(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...J.normalizeParams(t)})}function vD(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function bD(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function SD(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function kD(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...J.normalizeParams(t)})}function wD(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...J.normalizeParams(t)})}function ED(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...J.normalizeParams(t)})}function AD(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J.normalizeParams(t)})}function TD(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J.normalizeParams(t)})}function xD(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...J.normalizeParams(t)})}function OD(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...J.normalizeParams(t)})}function RD(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...J.normalizeParams(t)})}function CD(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...J.normalizeParams(t)})}j.TimePrecision={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function $D(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J.normalizeParams(t)})}function ID(e,t){return new e({type:"string",format:"date",check:"string_format",...J.normalizeParams(t)})}function ND(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...J.normalizeParams(t)})}function PD(e,t){return new e({type:"string",format:"duration",check:"string_format",...J.normalizeParams(t)})}function MD(e,t){return new e({type:"number",checks:[],...J.normalizeParams(t)})}function LD(e,t){return new e({type:"number",coerce:!0,checks:[],...J.normalizeParams(t)})}function jD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...J.normalizeParams(t)})}function DD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...J.normalizeParams(t)})}function UD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...J.normalizeParams(t)})}function zD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...J.normalizeParams(t)})}function FD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...J.normalizeParams(t)})}function qD(e,t){return new e({type:"boolean",...J.normalizeParams(t)})}function VD(e,t){return new e({type:"boolean",coerce:!0,...J.normalizeParams(t)})}function WD(e,t){return new e({type:"bigint",...J.normalizeParams(t)})}function ZD(e,t){return new e({type:"bigint",coerce:!0,...J.normalizeParams(t)})}function BD(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...J.normalizeParams(t)})}function HD(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...J.normalizeParams(t)})}function JD(e,t){return new e({type:"symbol",...J.normalizeParams(t)})}function KD(e,t){return new e({type:"undefined",...J.normalizeParams(t)})}function GD(e,t){return new e({type:"null",...J.normalizeParams(t)})}function XD(e){return new e({type:"any"})}function YD(e){return new e({type:"unknown"})}function QD(e,t){return new e({type:"never",...J.normalizeParams(t)})}function eU(e,t){return new e({type:"void",...J.normalizeParams(t)})}function tU(e,t){return new e({type:"date",...J.normalizeParams(t)})}function nU(e,t){return new e({type:"date",coerce:!0,...J.normalizeParams(t)})}function rU(e,t){return new e({type:"nan",...J.normalizeParams(t)})}function oS(e,t){return new it.$ZodCheckLessThan({check:"less_than",...J.normalizeParams(t),value:e,inclusive:!1})}function Ca(e,t){return new it.$ZodCheckLessThan({check:"less_than",...J.normalizeParams(t),value:e,inclusive:!0})}function aS(e,t){return new it.$ZodCheckGreaterThan({check:"greater_than",...J.normalizeParams(t),value:e,inclusive:!1})}function $a(e,t){return new it.$ZodCheckGreaterThan({check:"greater_than",...J.normalizeParams(t),value:e,inclusive:!0})}function iU(e){return aS(0,e)}function oU(e){return oS(0,e)}function aU(e){return Ca(0,e)}function sU(e){return $a(0,e)}function cU(e,t){return new it.$ZodCheckMultipleOf({check:"multiple_of",...J.normalizeParams(t),value:e})}function lU(e,t){return new it.$ZodCheckMaxSize({check:"max_size",...J.normalizeParams(t),maximum:e})}function uU(e,t){return new it.$ZodCheckMinSize({check:"min_size",...J.normalizeParams(t),minimum:e})}function dU(e,t){return new it.$ZodCheckSizeEquals({check:"size_equals",...J.normalizeParams(t),size:e})}function _U(e,t){return new it.$ZodCheckMaxLength({check:"max_length",...J.normalizeParams(t),maximum:e})}function pU(e,t){return new it.$ZodCheckMinLength({check:"min_length",...J.normalizeParams(t),minimum:e})}function fU(e,t){return new it.$ZodCheckLengthEquals({check:"length_equals",...J.normalizeParams(t),length:e})}function mU(e,t){return new it.$ZodCheckRegex({check:"string_format",format:"regex",...J.normalizeParams(t),pattern:e})}function gU(e){return new it.$ZodCheckLowerCase({check:"string_format",format:"lowercase",...J.normalizeParams(e)})}function hU(e){return new it.$ZodCheckUpperCase({check:"string_format",format:"uppercase",...J.normalizeParams(e)})}function yU(e,t){return new it.$ZodCheckIncludes({check:"string_format",format:"includes",...J.normalizeParams(t),includes:e})}function vU(e,t){return new it.$ZodCheckStartsWith({check:"string_format",format:"starts_with",...J.normalizeParams(t),prefix:e})}function bU(e,t){return new it.$ZodCheckEndsWith({check:"string_format",format:"ends_with",...J.normalizeParams(t),suffix:e})}function SU(e,t,n){return new it.$ZodCheckProperty({check:"property",property:e,schema:t,...J.normalizeParams(n)})}function kU(e,t){return new it.$ZodCheckMimeType({check:"mime_type",mime:e,...J.normalizeParams(t)})}function Ro(e){return new it.$ZodCheckOverwrite({check:"overwrite",tx:e})}function wU(e){return Ro(t=>t.normalize(e))}function EU(){return Ro(e=>e.trim())}function AU(){return Ro(e=>e.toLowerCase())}function TU(){return Ro(e=>e.toUpperCase())}function xU(){return Ro(e=>J.slugify(e))}function OU(e,t,n){return new e({type:"array",element:t,...J.normalizeParams(n)})}function RU(e,t,n){return new e({type:"union",options:t,...J.normalizeParams(n)})}function CU(e,t,n){return new e({type:"union",options:t,inclusive:!1,...J.normalizeParams(n)})}function $U(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...J.normalizeParams(i)})}function IU(e,t,n){return new e({type:"intersection",left:t,right:n})}function NU(e,t,n,i){let r=n instanceof Cl.$ZodType,o=r?i:n,a=r?n:null;return new e({type:"tuple",items:t,rest:a,...J.normalizeParams(o)})}function PU(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...J.normalizeParams(i)})}function MU(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...J.normalizeParams(i)})}function LU(e,t,n){return new e({type:"set",valueType:t,...J.normalizeParams(n)})}function jU(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:i,...J.normalizeParams(n)})}function DU(e,t,n){return new e({type:"enum",entries:t,...J.normalizeParams(n)})}function UU(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...J.normalizeParams(n)})}function zU(e,t){return new e({type:"file",...J.normalizeParams(t)})}function FU(e,t){return new e({type:"transform",transform:t})}function qU(e,t){return new e({type:"optional",innerType:t})}function VU(e,t){return new e({type:"nullable",innerType:t})}function WU(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():J.shallowClone(n)}})}function ZU(e,t,n){return new e({type:"nonoptional",innerType:t,...J.normalizeParams(n)})}function BU(e,t){return new e({type:"success",innerType:t})}function HU(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}function JU(e,t,n){return new e({type:"pipe",in:t,out:n})}function KU(e,t){return new e({type:"readonly",innerType:t})}function GU(e,t,n){return new e({type:"template_literal",parts:t,...J.normalizeParams(n)})}function XU(e,t){return new e({type:"lazy",getter:t})}function YU(e,t){return new e({type:"promise",innerType:t})}function QU(e,t,n){let i=J.normalizeParams(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function e1(e,t,n){return new e({type:"custom",check:"custom",fn:t,...J.normalizeParams(n)})}function t1(e,t){let n=sS(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(J.issue(r,i.value,n._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=i.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),i.issues.push(J.issue(o))}},e(i.value,i)),t);return n}function sS(e,t){let n=new it.$ZodCheck({check:"custom",...J.normalizeParams(t)});return n._zod.check=e,n}function n1(e){let t=new it.$ZodCheck({check:"describe"});return t._zod.onattach=[n=>{let i=$l.globalRegistry.get(n)??{};$l.globalRegistry.add(n,{...i,description:e})}],t._zod.check=()=>{},t}function r1(e){let t=new it.$ZodCheck({check:"meta"});return t._zod.onattach=[n=>{let i=$l.globalRegistry.get(n)??{};$l.globalRegistry.add(n,{...i,...e})}],t._zod.check=()=>{},t}function i1(e,t){let n=J.normalizeParams(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(p=>typeof p=="string"?p.toLowerCase():p),r=r.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(i),a=new Set(r),s=e.Codec??Cl.$ZodCodec,l=e.Boolean??Cl.$ZodBoolean,c=e.String??Cl.$ZodString,d=new c({type:"string",error:n.error}),u=new l({type:"boolean",error:n.error}),_=new s({type:"pipe",in:d,out:u,transform:((p,y)=>{let f=p;return n.case!=="sensitive"&&(f=f.toLowerCase()),o.has(f)?!0:a.has(f)?!1:(y.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:y.value,inst:_,continue:!1}),{})}),reverseTransform:((p,y)=>p===!0?i[0]||"true":r[0]||"false"),error:n.error});return _}function o1(e,t,n,i={}){let r=J.normalizeParams(i),o={...J.normalizeParams(i),check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:s=>n.test(s),...r};return n instanceof RegExp&&(o.pattern=n),new e(o)}});var Ia=M(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.createStandardJSONSchemaMethod=en.createToJSONSchemaMethod=void 0;en.initializeContext=fp;en.process=Nl;en.extractDefs=mp;en.finalize=gp;var a1=Ra();function fp(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??a1.globalRegistry,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Nl(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let _=a.schema,p=t.processors[r.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);p(e,t,_,d)}let u=e._zod.parent;u&&(a.ref||(a.ref=u),Nl(u,t,d),t.seen.get(u).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Mt(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function mp(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let l=i.get(s);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(s,a[0])}}let r=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let u=e.external.registry.get(a[0])?.id,_=e.external.uri??(y=>y);if(u)return{ref:_(u)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${_("__shared")}#/${s}/${p}`}}if(a[1]===n)return{ref:"#"};let c=`#/${s}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:c+d}},o=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:c}=r(a);s.def={...s.schema},c&&(s.defId=c);let d=s.schema;for(let u in d)delete d[u];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
64
+
65
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){o(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(t!==a[0]&&c){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&e.reused==="ref"){o(a);continue}}}function gp(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=s=>{let l=e.seen.get(s);if(l.ref===null)return;let c=l.def??l.schema,d={...c},u=l.ref;if(l.ref=null,u){i(u);let p=e.seen.get(u),y=p.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(y)):Object.assign(c,y),Object.assign(c,d),s._zod.parent===u)for(let h in c)h==="$ref"||h==="allOf"||h in d||delete c[h];if(y.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let _=s._zod.parent;if(_&&_!==u){i(_);let p=e.seen.get(_);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let y in c)y==="$ref"||y==="allOf"||y in p.def&&JSON.stringify(c[y])===JSON.stringify(p.def[y])&&delete c[y]}e.override({zodSchema:s,jsonSchema:c,path:l.path??[]})};for(let s of[...e.seen.entries()].reverse())i(s[0]);let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(s)}Object.assign(r,n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let a=e.external?.defs??{};for(let s of e.seen.entries()){let l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,a[l.defId]=l.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?r.$defs=a:r.definitions=a);try{let s=JSON.parse(JSON.stringify(r));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:(0,en.createStandardJSONSchemaMethod)(t,"input",e.processors),output:(0,en.createStandardJSONSchemaMethod)(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Mt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Mt(i.element,n);if(i.type==="set")return Mt(i.valueType,n);if(i.type==="lazy")return Mt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Mt(i.innerType,n);if(i.type==="intersection")return Mt(i.left,n)||Mt(i.right,n);if(i.type==="record"||i.type==="map")return Mt(i.keyType,n)||Mt(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Mt(i.in,n)||Mt(i.out,n);if(i.type==="object"){for(let r in i.shape)if(Mt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Mt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Mt(r,n))return!0;return!!(i.rest&&Mt(i.rest,n))}return!1}var s1=(e,t={})=>n=>{let i=fp({...n,processors:t});return Nl(e,i),mp(i,e),gp(i,e)};en.createToJSONSchemaMethod=s1;var c1=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},a=fp({...r??{},target:o,io:t,processors:n});return Nl(e,a),mp(a,e),gp(a,e)};en.createStandardJSONSchemaMethod=c1});var Na=M(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.allProcessors=U.lazyProcessor=U.optionalProcessor=U.promiseProcessor=U.readonlyProcessor=U.pipeProcessor=U.catchProcessor=U.prefaultProcessor=U.defaultProcessor=U.nonoptionalProcessor=U.nullableProcessor=U.recordProcessor=U.tupleProcessor=U.intersectionProcessor=U.unionProcessor=U.objectProcessor=U.arrayProcessor=U.setProcessor=U.mapProcessor=U.transformProcessor=U.functionProcessor=U.customProcessor=U.successProcessor=U.fileProcessor=U.templateLiteralProcessor=U.nanProcessor=U.literalProcessor=U.enumProcessor=U.dateProcessor=U.unknownProcessor=U.anyProcessor=U.neverProcessor=U.voidProcessor=U.undefinedProcessor=U.nullProcessor=U.symbolProcessor=U.bigintProcessor=U.booleanProcessor=U.numberProcessor=U.stringProcessor=void 0;U.toJSONSchema=G1;var We=Ia(),l1=le(),u1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},d1=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:a,format:s,patterns:l,contentEncoding:c}=e._zod.bag;if(typeof o=="number"&&(r.minLength=o),typeof a=="number"&&(r.maxLength=a),s&&(r.format=u1[s]??s,r.format===""&&delete r.format,s==="time"&&delete r.format),c&&(r.contentEncoding=c),l&&l.size>0){let d=[...l];d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(u=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:u.source}))])}};U.stringProcessor=d1;var _1=(e,t,n,i)=>{let r=n,{minimum:o,maximum:a,format:s,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;typeof s=="string"&&s.includes("int")?r.type="integer":r.type="number";let u=typeof d=="number"&&d>=(o??Number.NEGATIVE_INFINITY),_=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";u?p?(r.minimum=d,r.exclusiveMinimum=!0):r.exclusiveMinimum=d:typeof o=="number"&&(r.minimum=o),_?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:typeof a=="number"&&(r.maximum=a),typeof l=="number"&&(r.multipleOf=l)};U.numberProcessor=_1;var p1=(e,t,n,i)=>{n.type="boolean"};U.booleanProcessor=p1;var f1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};U.bigintProcessor=f1;var m1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")};U.symbolProcessor=m1;var g1=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"};U.nullProcessor=g1;var h1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")};U.undefinedProcessor=h1;var y1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")};U.voidProcessor=y1;var v1=(e,t,n,i)=>{n.not={}};U.neverProcessor=v1;var b1=(e,t,n,i)=>{};U.anyProcessor=b1;var S1=(e,t,n,i)=>{};U.unknownProcessor=S1;var k1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")};U.dateProcessor=k1;var w1=(e,t,n,i)=>{let r=e._zod.def,o=(0,l1.getEnumValues)(r.entries);o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),n.enum=o};U.enumProcessor=w1;var E1=(e,t,n,i)=>{let r=e._zod.def,o=[];for(let a of r.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),o.every(a=>typeof a=="boolean")&&(n.type="boolean"),o.every(a=>a===null)&&(n.type="null"),n.enum=o};U.literalProcessor=E1;var A1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")};U.nanProcessor=A1;var T1=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source};U.templateLiteralProcessor=T1;var x1=(e,t,n,i)=>{let r=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:l}=e._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),l?l.length===1?(o.contentMediaType=l[0],Object.assign(r,o)):(Object.assign(r,o),r.anyOf=l.map(c=>({contentMediaType:c}))):Object.assign(r,o)};U.fileProcessor=x1;var O1=(e,t,n,i)=>{n.type="boolean"};U.successProcessor=O1;var R1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};U.customProcessor=R1;var C1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")};U.functionProcessor=C1;var $1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};U.transformProcessor=$1;var I1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")};U.mapProcessor=I1;var N1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")};U.setProcessor=N1;var P1=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(r.minItems=a),typeof s=="number"&&(r.maxItems=s),r.type="array",r.items=(0,We.process)(o.element,t,{...i,path:[...i.path,"items"]})};U.arrayProcessor=P1;var M1=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object",r.properties={};let a=o.shape;for(let c in a)r.properties[c]=(0,We.process)(a[c],t,{...i,path:[...i.path,"properties",c]});let s=new Set(Object.keys(a)),l=new Set([...s].filter(c=>{let d=o.shape[c]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(r.required=Array.from(l)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=(0,We.process)(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)};U.objectProcessor=M1;var L1=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,a=r.options.map((s,l)=>(0,We.process)(s,t,{...i,path:[...i.path,o?"oneOf":"anyOf",l]}));o?n.oneOf=a:n.anyOf=a};U.unionProcessor=L1;var j1=(e,t,n,i)=>{let r=e._zod.def,o=(0,We.process)(r.left,t,{...i,path:[...i.path,"allOf",0]}),a=(0,We.process)(r.right,t,{...i,path:[...i.path,"allOf",1]}),s=c=>"allOf"in c&&Object.keys(c).length===1,l=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];n.allOf=l};U.intersectionProcessor=j1;var D1=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((_,p)=>(0,We.process)(_,t,{...i,path:[...i.path,a,p]})),c=o.rest?(0,We.process)(o.rest,t,{...i,path:[...i.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=l,c&&(r.items=c)):t.target==="openapi-3.0"?(r.items={anyOf:l},c&&r.items.anyOf.push(c),r.minItems=l.length,c||(r.maxItems=l.length)):(r.items=l,c&&(r.additionalItems=c));let{minimum:d,maximum:u}=e._zod.bag;typeof d=="number"&&(r.minItems=d),typeof u=="number"&&(r.maxItems=u)};U.tupleProcessor=D1;var U1=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let a=o.keyType,l=a._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let d=(0,We.process)(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let u of l)r.patternProperties[u.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=(0,We.process)(o.keyType,t,{...i,path:[...i.path,"propertyNames"]})),r.additionalProperties=(0,We.process)(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]});let c=a._zod.values;if(c){let d=[...c].filter(u=>typeof u=="string"||typeof u=="number");d.length>0&&(r.required=d)}};U.recordProcessor=U1;var z1=(e,t,n,i)=>{let r=e._zod.def,o=(0,We.process)(r.innerType,t,i),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]};U.nullableProcessor=z1;var F1=(e,t,n,i)=>{let r=e._zod.def;(0,We.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType};U.nonoptionalProcessor=F1;var q1=(e,t,n,i)=>{let r=e._zod.def;(0,We.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))};U.defaultProcessor=q1;var V1=(e,t,n,i)=>{let r=e._zod.def;(0,We.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))};U.prefaultProcessor=V1;var W1=(e,t,n,i)=>{let r=e._zod.def;(0,We.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let a;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a};U.catchProcessor=W1;var Z1=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?r.out:r.in:r.out;(0,We.process)(a,t,i);let s=t.seen.get(e);s.ref=a};U.pipeProcessor=Z1;var B1=(e,t,n,i)=>{let r=e._zod.def;(0,We.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0};U.readonlyProcessor=B1;var H1=(e,t,n,i)=>{let r=e._zod.def;(0,We.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType};U.promiseProcessor=H1;var J1=(e,t,n,i)=>{let r=e._zod.def;(0,We.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType};U.optionalProcessor=J1;var K1=(e,t,n,i)=>{let r=e._zod.innerType;(0,We.process)(r,t,i);let o=t.seen.get(e);o.ref=r};U.lazyProcessor=K1;U.allProcessors={string:U.stringProcessor,number:U.numberProcessor,boolean:U.booleanProcessor,bigint:U.bigintProcessor,symbol:U.symbolProcessor,null:U.nullProcessor,undefined:U.undefinedProcessor,void:U.voidProcessor,never:U.neverProcessor,any:U.anyProcessor,unknown:U.unknownProcessor,date:U.dateProcessor,enum:U.enumProcessor,literal:U.literalProcessor,nan:U.nanProcessor,template_literal:U.templateLiteralProcessor,file:U.fileProcessor,success:U.successProcessor,custom:U.customProcessor,function:U.functionProcessor,transform:U.transformProcessor,map:U.mapProcessor,set:U.setProcessor,array:U.arrayProcessor,object:U.objectProcessor,union:U.unionProcessor,intersection:U.intersectionProcessor,tuple:U.tupleProcessor,record:U.recordProcessor,nullable:U.nullableProcessor,nonoptional:U.nonoptionalProcessor,default:U.defaultProcessor,prefault:U.prefaultProcessor,catch:U.catchProcessor,pipe:U.pipeProcessor,readonly:U.readonlyProcessor,promise:U.promiseProcessor,optional:U.optionalProcessor,lazy:U.lazyProcessor};function G1(e,t){if("_idmap"in e){let i=e,r=(0,We.initializeContext)({...t,processors:U.allProcessors}),o={};for(let l of i._idmap.entries()){let[c,d]=l;(0,We.process)(d,r)}let a={},s={registry:i,uri:t?.uri,defs:o};r.external=s;for(let l of i._idmap.entries()){let[c,d]=l;(0,We.extractDefs)(r,d),a[c]=(0,We.finalize)(r,d)}if(Object.keys(o).length>0){let l=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let n=(0,We.initializeContext)({...t,processors:U.allProcessors});return(0,We.process)(e,n),(0,We.extractDefs)(n,e),(0,We.finalize)(n,e)}});var lS=M(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.JSONSchemaGenerator=void 0;var X1=Na(),Pl=Ia(),hp=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=(0,Pl.initializeContext)({processors:X1.allProcessors,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return(0,Pl.process)(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),(0,Pl.extractDefs)(this.ctx,t);let i=(0,Pl.finalize)(this.ctx,t),{"~standard":r,...o}=i;return o}};Ml.JSONSchemaGenerator=hp});var dS=M(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0})});var Vt=M(je=>{"use strict";var _S=je&&je.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),Y1=je&&je.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Sr=je&&je.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&_S(t,e,n)},Ll=je&&je.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&_S(t,e,n);return Y1(t,e),t};Object.defineProperty(je,"__esModule",{value:!0});je.JSONSchema=je.JSONSchemaGenerator=je.toJSONSchema=je.locales=je.regexes=je.util=void 0;Sr(Ni(),je);Sr(tp(),je);Sr(Q_(),je);Sr(lp(),je);Sr(Ec(),je);Sr(ap(),je);je.util=Ll(le());je.regexes=Ll(wc());je.locales=Ll(pp());Sr(Ra(),je);Sr(op(),je);Sr(cS(),je);Sr(Ia(),je);var Q1=Na();Object.defineProperty(je,"toJSONSchema",{enumerable:!0,get:function(){return Q1.toJSONSchema}});var ez=lS();Object.defineProperty(je,"JSONSchemaGenerator",{enumerable:!0,get:function(){return ez.JSONSchemaGenerator}});je.JSONSchema=Ll(dS())});var jl=M(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.slugify=ue.toUpperCase=ue.toLowerCase=ue.trim=ue.normalize=ue.overwrite=ue.mime=ue.property=ue.endsWith=ue.startsWith=ue.includes=ue.uppercase=ue.lowercase=ue.regex=ue.length=ue.minLength=ue.maxLength=ue.size=ue.minSize=ue.maxSize=ue.multipleOf=ue.nonnegative=ue.nonpositive=ue.negative=ue.positive=ue.gte=ue.gt=ue.lte=ue.lt=void 0;var Ze=Vt();Object.defineProperty(ue,"lt",{enumerable:!0,get:function(){return Ze._lt}});Object.defineProperty(ue,"lte",{enumerable:!0,get:function(){return Ze._lte}});Object.defineProperty(ue,"gt",{enumerable:!0,get:function(){return Ze._gt}});Object.defineProperty(ue,"gte",{enumerable:!0,get:function(){return Ze._gte}});Object.defineProperty(ue,"positive",{enumerable:!0,get:function(){return Ze._positive}});Object.defineProperty(ue,"negative",{enumerable:!0,get:function(){return Ze._negative}});Object.defineProperty(ue,"nonpositive",{enumerable:!0,get:function(){return Ze._nonpositive}});Object.defineProperty(ue,"nonnegative",{enumerable:!0,get:function(){return Ze._nonnegative}});Object.defineProperty(ue,"multipleOf",{enumerable:!0,get:function(){return Ze._multipleOf}});Object.defineProperty(ue,"maxSize",{enumerable:!0,get:function(){return Ze._maxSize}});Object.defineProperty(ue,"minSize",{enumerable:!0,get:function(){return Ze._minSize}});Object.defineProperty(ue,"size",{enumerable:!0,get:function(){return Ze._size}});Object.defineProperty(ue,"maxLength",{enumerable:!0,get:function(){return Ze._maxLength}});Object.defineProperty(ue,"minLength",{enumerable:!0,get:function(){return Ze._minLength}});Object.defineProperty(ue,"length",{enumerable:!0,get:function(){return Ze._length}});Object.defineProperty(ue,"regex",{enumerable:!0,get:function(){return Ze._regex}});Object.defineProperty(ue,"lowercase",{enumerable:!0,get:function(){return Ze._lowercase}});Object.defineProperty(ue,"uppercase",{enumerable:!0,get:function(){return Ze._uppercase}});Object.defineProperty(ue,"includes",{enumerable:!0,get:function(){return Ze._includes}});Object.defineProperty(ue,"startsWith",{enumerable:!0,get:function(){return Ze._startsWith}});Object.defineProperty(ue,"endsWith",{enumerable:!0,get:function(){return Ze._endsWith}});Object.defineProperty(ue,"property",{enumerable:!0,get:function(){return Ze._property}});Object.defineProperty(ue,"mime",{enumerable:!0,get:function(){return Ze._mime}});Object.defineProperty(ue,"overwrite",{enumerable:!0,get:function(){return Ze._overwrite}});Object.defineProperty(ue,"normalize",{enumerable:!0,get:function(){return Ze._normalize}});Object.defineProperty(ue,"trim",{enumerable:!0,get:function(){return Ze._trim}});Object.defineProperty(ue,"toLowerCase",{enumerable:!0,get:function(){return Ze._toLowerCase}});Object.defineProperty(ue,"toUpperCase",{enumerable:!0,get:function(){return Ze._toUpperCase}});Object.defineProperty(ue,"slugify",{enumerable:!0,get:function(){return Ze._slugify}})});var Pa=M(tt=>{"use strict";var tz=tt&&tt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),nz=tt&&tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pS=tt&&tt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&tz(t,e,n);return nz(t,e),t};Object.defineProperty(tt,"__esModule",{value:!0});tt.ZodISODuration=tt.ZodISOTime=tt.ZodISODate=tt.ZodISODateTime=void 0;tt.datetime=rz;tt.date=iz;tt.time=oz;tt.duration=az;var tn=pS(Vt()),Dl=pS(Ma());tt.ZodISODateTime=tn.$constructor("ZodISODateTime",(e,t)=>{tn.$ZodISODateTime.init(e,t),Dl.ZodStringFormat.init(e,t)});function rz(e){return tn._isoDateTime(tt.ZodISODateTime,e)}tt.ZodISODate=tn.$constructor("ZodISODate",(e,t)=>{tn.$ZodISODate.init(e,t),Dl.ZodStringFormat.init(e,t)});function iz(e){return tn._isoDate(tt.ZodISODate,e)}tt.ZodISOTime=tn.$constructor("ZodISOTime",(e,t)=>{tn.$ZodISOTime.init(e,t),Dl.ZodStringFormat.init(e,t)});function oz(e){return tn._isoTime(tt.ZodISOTime,e)}tt.ZodISODuration=tn.$constructor("ZodISODuration",(e,t)=>{tn.$ZodISODuration.init(e,t),Dl.ZodStringFormat.init(e,t)});function az(e){return tn._isoDuration(tt.ZodISODuration,e)}});var yp=M(nn=>{"use strict";var sz=nn&&nn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),cz=nn&&nn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),mS=nn&&nn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&sz(t,e,n);return cz(t,e),t};Object.defineProperty(nn,"__esModule",{value:!0});nn.ZodRealError=nn.ZodError=void 0;var Ul=mS(Vt()),lz=Vt(),fS=mS(le()),gS=(e,t)=>{lz.$ZodError.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Ul.formatError(e,n)},flatten:{value:n=>Ul.flattenError(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fS.jsonStringifyReplacer,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fS.jsonStringifyReplacer,2)}},isEmpty:{get(){return e.issues.length===0}}})};nn.ZodError=Ul.$constructor("ZodError",gS);nn.ZodRealError=Ul.$constructor("ZodError",gS,{Parent:Error})});var vp=M(De=>{"use strict";var uz=De&&De.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),dz=De&&De.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),_z=De&&De.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&uz(t,e,n);return dz(t,e),t};Object.defineProperty(De,"__esModule",{value:!0});De.safeDecodeAsync=De.safeEncodeAsync=De.safeDecode=De.safeEncode=De.decodeAsync=De.encodeAsync=De.decode=De.encode=De.safeParseAsync=De.safeParse=De.parseAsync=De.parse=void 0;var rn=_z(Vt()),on=yp();De.parse=rn._parse(on.ZodRealError);De.parseAsync=rn._parseAsync(on.ZodRealError);De.safeParse=rn._safeParse(on.ZodRealError);De.safeParseAsync=rn._safeParseAsync(on.ZodRealError);De.encode=rn._encode(on.ZodRealError);De.decode=rn._decode(on.ZodRealError);De.encodeAsync=rn._encodeAsync(on.ZodRealError);De.decodeAsync=rn._decodeAsync(on.ZodRealError);De.safeEncode=rn._safeEncode(on.ZodRealError);De.safeDecode=rn._safeDecode(on.ZodRealError);De.safeEncodeAsync=rn._safeEncodeAsync(on.ZodRealError);De.safeDecodeAsync=rn._safeDecodeAsync(on.ZodRealError)});var Ma=M(m=>{"use strict";var pz=m&&m.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),fz=m&&m.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),La=m&&m.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&pz(t,e,n);return fz(t,e),t};Object.defineProperty(m,"__esModule",{value:!0});m.ZodLiteral=m.ZodEnum=m.ZodSet=m.ZodMap=m.ZodRecord=m.ZodTuple=m.ZodIntersection=m.ZodDiscriminatedUnion=m.ZodXor=m.ZodUnion=m.ZodObject=m.ZodArray=m.ZodDate=m.ZodVoid=m.ZodNever=m.ZodUnknown=m.ZodAny=m.ZodNull=m.ZodUndefined=m.ZodSymbol=m.ZodBigIntFormat=m.ZodBigInt=m.ZodBoolean=m.ZodNumberFormat=m.ZodNumber=m.ZodCustomStringFormat=m.ZodJWT=m.ZodE164=m.ZodBase64URL=m.ZodBase64=m.ZodCIDRv6=m.ZodCIDRv4=m.ZodIPv6=m.ZodMAC=m.ZodIPv4=m.ZodKSUID=m.ZodXID=m.ZodULID=m.ZodCUID2=m.ZodCUID=m.ZodNanoID=m.ZodEmoji=m.ZodURL=m.ZodUUID=m.ZodGUID=m.ZodEmail=m.ZodStringFormat=m.ZodString=m._ZodString=m.ZodType=void 0;m.stringbool=m.meta=m.describe=m.ZodCustom=m.ZodFunction=m.ZodPromise=m.ZodLazy=m.ZodTemplateLiteral=m.ZodReadonly=m.ZodPreprocess=m.ZodCodec=m.ZodPipe=m.ZodNaN=m.ZodCatch=m.ZodSuccess=m.ZodNonOptional=m.ZodPrefault=m.ZodDefault=m.ZodNullable=m.ZodExactOptional=m.ZodOptional=m.ZodTransform=m.ZodFile=void 0;m.string=Fl;m.email=mz;m.guid=gz;m.uuid=hz;m.uuidv4=yz;m.uuidv6=vz;m.uuidv7=bz;m.url=Sz;m.httpUrl=kz;m.emoji=wz;m.nanoid=Ez;m.cuid=Az;m.cuid2=Tz;m.ulid=xz;m.xid=Oz;m.ksuid=Rz;m.ipv4=Cz;m.mac=$z;m.ipv6=Iz;m.cidrv4=Nz;m.cidrv6=Pz;m.base64=Mz;m.base64url=Lz;m.e164=jz;m.jwt=Dz;m.stringFormat=Uz;m.hostname=zz;m.hex=Fz;m.hash=qz;m.number=yS;m.int=Sp;m.float32=Vz;m.float64=Wz;m.int32=Zz;m.uint32=Bz;m.boolean=vS;m.bigint=Hz;m.int64=Jz;m.uint64=Kz;m.symbol=Gz;m.undefined=Xz;m.null=bS;m.any=Yz;m.unknown=Co;m.never=wp;m.void=Qz;m.date=eF;m.array=Wl;m.keyof=tF;m.object=nF;m.strictObject=rF;m.looseObject=iF;m.union=Ep;m.xor=oF;m.discriminatedUnion=aF;m.intersection=SS;m.tuple=kS;m.record=wS;m.partialRecord=sF;m.looseRecord=cF;m.map=lF;m.set=uF;m.enum=Ap;m.nativeEnum=dF;m.literal=_F;m.file=pF;m.transform=Tp;m.optional=ql;m.exactOptional=ES;m.nullable=Vl;m.nullish=fF;m._default=AS;m.prefault=TS;m.nonoptional=xS;m.success=mF;m.catch=OS;m.nan=gF;m.pipe=kp;m.codec=hF;m.invertCodec=yF;m.readonly=RS;m.templateLiteral=vF;m.lazy=CS;m.promise=bF;m._function=Zl;m.function=Zl;m._function=Zl;m.function=Zl;m.check=SF;m.custom=kF;m.refine=$S;m.superRefine=IS;m.instanceof=wF;m.json=AF;m.preprocess=TF;var w=La(Vt()),Ie=Vt(),xe=La(Na()),bp=Ia(),ke=La(jl()),zl=La(Pa()),an=La(vp()),hS=new WeakMap;function ja(e,t,n){let i=Object.getPrototypeOf(e),r=hS.get(i);if(r||(r=new Set,hS.set(i,r)),!r.has(t)){r.add(t);for(let o in n){let a=n[o];Object.defineProperty(i,o,{configurable:!0,enumerable:!1,get(){let s=a.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}m.ZodType=w.$constructor("ZodType",(e,t)=>(w.$ZodType.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:(0,bp.createStandardJSONSchemaMethod)(e,"input"),output:(0,bp.createStandardJSONSchemaMethod)(e,"output")}}),e.toJSONSchema=(0,bp.createToJSONSchemaMethod)(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>an.parse(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>an.safeParse(e,n,i),e.parseAsync=async(n,i)=>an.parseAsync(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>an.safeParseAsync(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>an.encode(e,n,i),e.decode=(n,i)=>an.decode(e,n,i),e.encodeAsync=async(n,i)=>an.encodeAsync(e,n,i),e.decodeAsync=async(n,i)=>an.decodeAsync(e,n,i),e.safeEncode=(n,i)=>an.safeEncode(e,n,i),e.safeDecode=(n,i)=>an.safeDecode(e,n,i),e.safeEncodeAsync=async(n,i)=>an.safeEncodeAsync(e,n,i),e.safeDecodeAsync=async(n,i)=>an.safeDecodeAsync(e,n,i),ja(e,"ZodType",{check(...n){let i=this.def;return this.clone(Ie.util.mergeDefs(i,{checks:[...i.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return w.clone(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check($S(n,i))},superRefine(n,i){return this.check(IS(n,i))},overwrite(n){return this.check(ke.overwrite(n))},optional(){return ql(this)},exactOptional(){return ES(this)},nullable(){return Vl(this)},nullish(){return ql(Vl(this))},nonoptional(n){return xS(this,n)},array(){return Wl(this)},or(n){return Ep([this,n])},and(n){return SS(this,n)},transform(n){return kp(this,Tp(n))},default(n){return AS(this,n)},prefault(n){return TS(this,n)},catch(n){return OS(this,n)},pipe(n){return kp(this,n)},readonly(){return RS(this)},describe(n){let i=this.clone();return w.globalRegistry.add(i,{description:n}),i},meta(...n){if(n.length===0)return w.globalRegistry.get(this);let i=this.clone();return w.globalRegistry.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return w.globalRegistry.get(e)?.description},configurable:!0}),e));m._ZodString=w.$constructor("_ZodString",(e,t)=>{w.$ZodString.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.stringProcessor(e,i,r,o);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ja(e,"_ZodString",{regex(...i){return this.check(ke.regex(...i))},includes(...i){return this.check(ke.includes(...i))},startsWith(...i){return this.check(ke.startsWith(...i))},endsWith(...i){return this.check(ke.endsWith(...i))},min(...i){return this.check(ke.minLength(...i))},max(...i){return this.check(ke.maxLength(...i))},length(...i){return this.check(ke.length(...i))},nonempty(...i){return this.check(ke.minLength(1,...i))},lowercase(i){return this.check(ke.lowercase(i))},uppercase(i){return this.check(ke.uppercase(i))},trim(){return this.check(ke.trim())},normalize(...i){return this.check(ke.normalize(...i))},toLowerCase(){return this.check(ke.toLowerCase())},toUpperCase(){return this.check(ke.toUpperCase())},slugify(){return this.check(ke.slugify())}})});m.ZodString=w.$constructor("ZodString",(e,t)=>{w.$ZodString.init(e,t),m._ZodString.init(e,t),e.email=n=>e.check(w._email(m.ZodEmail,n)),e.url=n=>e.check(w._url(m.ZodURL,n)),e.jwt=n=>e.check(w._jwt(m.ZodJWT,n)),e.emoji=n=>e.check(w._emoji(m.ZodEmoji,n)),e.guid=n=>e.check(w._guid(m.ZodGUID,n)),e.uuid=n=>e.check(w._uuid(m.ZodUUID,n)),e.uuidv4=n=>e.check(w._uuidv4(m.ZodUUID,n)),e.uuidv6=n=>e.check(w._uuidv6(m.ZodUUID,n)),e.uuidv7=n=>e.check(w._uuidv7(m.ZodUUID,n)),e.nanoid=n=>e.check(w._nanoid(m.ZodNanoID,n)),e.guid=n=>e.check(w._guid(m.ZodGUID,n)),e.cuid=n=>e.check(w._cuid(m.ZodCUID,n)),e.cuid2=n=>e.check(w._cuid2(m.ZodCUID2,n)),e.ulid=n=>e.check(w._ulid(m.ZodULID,n)),e.base64=n=>e.check(w._base64(m.ZodBase64,n)),e.base64url=n=>e.check(w._base64url(m.ZodBase64URL,n)),e.xid=n=>e.check(w._xid(m.ZodXID,n)),e.ksuid=n=>e.check(w._ksuid(m.ZodKSUID,n)),e.ipv4=n=>e.check(w._ipv4(m.ZodIPv4,n)),e.ipv6=n=>e.check(w._ipv6(m.ZodIPv6,n)),e.cidrv4=n=>e.check(w._cidrv4(m.ZodCIDRv4,n)),e.cidrv6=n=>e.check(w._cidrv6(m.ZodCIDRv6,n)),e.e164=n=>e.check(w._e164(m.ZodE164,n)),e.datetime=n=>e.check(zl.datetime(n)),e.date=n=>e.check(zl.date(n)),e.time=n=>e.check(zl.time(n)),e.duration=n=>e.check(zl.duration(n))});function Fl(e){return w._string(m.ZodString,e)}m.ZodStringFormat=w.$constructor("ZodStringFormat",(e,t)=>{w.$ZodStringFormat.init(e,t),m._ZodString.init(e,t)});m.ZodEmail=w.$constructor("ZodEmail",(e,t)=>{w.$ZodEmail.init(e,t),m.ZodStringFormat.init(e,t)});function mz(e){return w._email(m.ZodEmail,e)}m.ZodGUID=w.$constructor("ZodGUID",(e,t)=>{w.$ZodGUID.init(e,t),m.ZodStringFormat.init(e,t)});function gz(e){return w._guid(m.ZodGUID,e)}m.ZodUUID=w.$constructor("ZodUUID",(e,t)=>{w.$ZodUUID.init(e,t),m.ZodStringFormat.init(e,t)});function hz(e){return w._uuid(m.ZodUUID,e)}function yz(e){return w._uuidv4(m.ZodUUID,e)}function vz(e){return w._uuidv6(m.ZodUUID,e)}function bz(e){return w._uuidv7(m.ZodUUID,e)}m.ZodURL=w.$constructor("ZodURL",(e,t)=>{w.$ZodURL.init(e,t),m.ZodStringFormat.init(e,t)});function Sz(e){return w._url(m.ZodURL,e)}function kz(e){return w._url(m.ZodURL,{protocol:w.regexes.httpProtocol,hostname:w.regexes.domain,...Ie.util.normalizeParams(e)})}m.ZodEmoji=w.$constructor("ZodEmoji",(e,t)=>{w.$ZodEmoji.init(e,t),m.ZodStringFormat.init(e,t)});function wz(e){return w._emoji(m.ZodEmoji,e)}m.ZodNanoID=w.$constructor("ZodNanoID",(e,t)=>{w.$ZodNanoID.init(e,t),m.ZodStringFormat.init(e,t)});function Ez(e){return w._nanoid(m.ZodNanoID,e)}m.ZodCUID=w.$constructor("ZodCUID",(e,t)=>{w.$ZodCUID.init(e,t),m.ZodStringFormat.init(e,t)});function Az(e){return w._cuid(m.ZodCUID,e)}m.ZodCUID2=w.$constructor("ZodCUID2",(e,t)=>{w.$ZodCUID2.init(e,t),m.ZodStringFormat.init(e,t)});function Tz(e){return w._cuid2(m.ZodCUID2,e)}m.ZodULID=w.$constructor("ZodULID",(e,t)=>{w.$ZodULID.init(e,t),m.ZodStringFormat.init(e,t)});function xz(e){return w._ulid(m.ZodULID,e)}m.ZodXID=w.$constructor("ZodXID",(e,t)=>{w.$ZodXID.init(e,t),m.ZodStringFormat.init(e,t)});function Oz(e){return w._xid(m.ZodXID,e)}m.ZodKSUID=w.$constructor("ZodKSUID",(e,t)=>{w.$ZodKSUID.init(e,t),m.ZodStringFormat.init(e,t)});function Rz(e){return w._ksuid(m.ZodKSUID,e)}m.ZodIPv4=w.$constructor("ZodIPv4",(e,t)=>{w.$ZodIPv4.init(e,t),m.ZodStringFormat.init(e,t)});function Cz(e){return w._ipv4(m.ZodIPv4,e)}m.ZodMAC=w.$constructor("ZodMAC",(e,t)=>{w.$ZodMAC.init(e,t),m.ZodStringFormat.init(e,t)});function $z(e){return w._mac(m.ZodMAC,e)}m.ZodIPv6=w.$constructor("ZodIPv6",(e,t)=>{w.$ZodIPv6.init(e,t),m.ZodStringFormat.init(e,t)});function Iz(e){return w._ipv6(m.ZodIPv6,e)}m.ZodCIDRv4=w.$constructor("ZodCIDRv4",(e,t)=>{w.$ZodCIDRv4.init(e,t),m.ZodStringFormat.init(e,t)});function Nz(e){return w._cidrv4(m.ZodCIDRv4,e)}m.ZodCIDRv6=w.$constructor("ZodCIDRv6",(e,t)=>{w.$ZodCIDRv6.init(e,t),m.ZodStringFormat.init(e,t)});function Pz(e){return w._cidrv6(m.ZodCIDRv6,e)}m.ZodBase64=w.$constructor("ZodBase64",(e,t)=>{w.$ZodBase64.init(e,t),m.ZodStringFormat.init(e,t)});function Mz(e){return w._base64(m.ZodBase64,e)}m.ZodBase64URL=w.$constructor("ZodBase64URL",(e,t)=>{w.$ZodBase64URL.init(e,t),m.ZodStringFormat.init(e,t)});function Lz(e){return w._base64url(m.ZodBase64URL,e)}m.ZodE164=w.$constructor("ZodE164",(e,t)=>{w.$ZodE164.init(e,t),m.ZodStringFormat.init(e,t)});function jz(e){return w._e164(m.ZodE164,e)}m.ZodJWT=w.$constructor("ZodJWT",(e,t)=>{w.$ZodJWT.init(e,t),m.ZodStringFormat.init(e,t)});function Dz(e){return w._jwt(m.ZodJWT,e)}m.ZodCustomStringFormat=w.$constructor("ZodCustomStringFormat",(e,t)=>{w.$ZodCustomStringFormat.init(e,t),m.ZodStringFormat.init(e,t)});function Uz(e,t,n={}){return w._stringFormat(m.ZodCustomStringFormat,e,t,n)}function zz(e){return w._stringFormat(m.ZodCustomStringFormat,"hostname",w.regexes.hostname,e)}function Fz(e){return w._stringFormat(m.ZodCustomStringFormat,"hex",w.regexes.hex,e)}function qz(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=w.regexes[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return w._stringFormat(m.ZodCustomStringFormat,i,r,t)}m.ZodNumber=w.$constructor("ZodNumber",(e,t)=>{w.$ZodNumber.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.numberProcessor(e,i,r,o),ja(e,"ZodNumber",{gt(i,r){return this.check(ke.gt(i,r))},gte(i,r){return this.check(ke.gte(i,r))},min(i,r){return this.check(ke.gte(i,r))},lt(i,r){return this.check(ke.lt(i,r))},lte(i,r){return this.check(ke.lte(i,r))},max(i,r){return this.check(ke.lte(i,r))},int(i){return this.check(Sp(i))},safe(i){return this.check(Sp(i))},positive(i){return this.check(ke.gt(0,i))},nonnegative(i){return this.check(ke.gte(0,i))},negative(i){return this.check(ke.lt(0,i))},nonpositive(i){return this.check(ke.lte(0,i))},multipleOf(i,r){return this.check(ke.multipleOf(i,r))},step(i,r){return this.check(ke.multipleOf(i,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function yS(e){return w._number(m.ZodNumber,e)}m.ZodNumberFormat=w.$constructor("ZodNumberFormat",(e,t)=>{w.$ZodNumberFormat.init(e,t),m.ZodNumber.init(e,t)});function Sp(e){return w._int(m.ZodNumberFormat,e)}function Vz(e){return w._float32(m.ZodNumberFormat,e)}function Wz(e){return w._float64(m.ZodNumberFormat,e)}function Zz(e){return w._int32(m.ZodNumberFormat,e)}function Bz(e){return w._uint32(m.ZodNumberFormat,e)}m.ZodBoolean=w.$constructor("ZodBoolean",(e,t)=>{w.$ZodBoolean.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.booleanProcessor(e,n,i,r)});function vS(e){return w._boolean(m.ZodBoolean,e)}m.ZodBigInt=w.$constructor("ZodBigInt",(e,t)=>{w.$ZodBigInt.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.bigintProcessor(e,i,r,o),e.gte=(i,r)=>e.check(ke.gte(i,r)),e.min=(i,r)=>e.check(ke.gte(i,r)),e.gt=(i,r)=>e.check(ke.gt(i,r)),e.gte=(i,r)=>e.check(ke.gte(i,r)),e.min=(i,r)=>e.check(ke.gte(i,r)),e.lt=(i,r)=>e.check(ke.lt(i,r)),e.lte=(i,r)=>e.check(ke.lte(i,r)),e.max=(i,r)=>e.check(ke.lte(i,r)),e.positive=i=>e.check(ke.gt(BigInt(0),i)),e.negative=i=>e.check(ke.lt(BigInt(0),i)),e.nonpositive=i=>e.check(ke.lte(BigInt(0),i)),e.nonnegative=i=>e.check(ke.gte(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(ke.multipleOf(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function Hz(e){return w._bigint(m.ZodBigInt,e)}m.ZodBigIntFormat=w.$constructor("ZodBigIntFormat",(e,t)=>{w.$ZodBigIntFormat.init(e,t),m.ZodBigInt.init(e,t)});function Jz(e){return w._int64(m.ZodBigIntFormat,e)}function Kz(e){return w._uint64(m.ZodBigIntFormat,e)}m.ZodSymbol=w.$constructor("ZodSymbol",(e,t)=>{w.$ZodSymbol.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.symbolProcessor(e,n,i,r)});function Gz(e){return w._symbol(m.ZodSymbol,e)}m.ZodUndefined=w.$constructor("ZodUndefined",(e,t)=>{w.$ZodUndefined.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.undefinedProcessor(e,n,i,r)});function Xz(e){return w._undefined(m.ZodUndefined,e)}m.ZodNull=w.$constructor("ZodNull",(e,t)=>{w.$ZodNull.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nullProcessor(e,n,i,r)});function bS(e){return w._null(m.ZodNull,e)}m.ZodAny=w.$constructor("ZodAny",(e,t)=>{w.$ZodAny.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.anyProcessor(e,n,i,r)});function Yz(){return w._any(m.ZodAny)}m.ZodUnknown=w.$constructor("ZodUnknown",(e,t)=>{w.$ZodUnknown.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.unknownProcessor(e,n,i,r)});function Co(){return w._unknown(m.ZodUnknown)}m.ZodNever=w.$constructor("ZodNever",(e,t)=>{w.$ZodNever.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.neverProcessor(e,n,i,r)});function wp(e){return w._never(m.ZodNever,e)}m.ZodVoid=w.$constructor("ZodVoid",(e,t)=>{w.$ZodVoid.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.voidProcessor(e,n,i,r)});function Qz(e){return w._void(m.ZodVoid,e)}m.ZodDate=w.$constructor("ZodDate",(e,t)=>{w.$ZodDate.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.dateProcessor(e,i,r,o),e.min=(i,r)=>e.check(ke.gte(i,r)),e.max=(i,r)=>e.check(ke.lte(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function eF(e){return w._date(m.ZodDate,e)}m.ZodArray=w.$constructor("ZodArray",(e,t)=>{w.$ZodArray.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.arrayProcessor(e,n,i,r),e.element=t.element,ja(e,"ZodArray",{min(n,i){return this.check(ke.minLength(n,i))},nonempty(n){return this.check(ke.minLength(1,n))},max(n,i){return this.check(ke.maxLength(n,i))},length(n,i){return this.check(ke.length(n,i))},unwrap(){return this.element}})});function Wl(e,t){return w._array(m.ZodArray,e,t)}function tF(e){let t=e._zod.def.shape;return Ap(Object.keys(t))}m.ZodObject=w.$constructor("ZodObject",(e,t)=>{w.$ZodObjectJIT.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.objectProcessor(e,n,i,r),Ie.util.defineLazy(e,"shape",()=>t.shape),ja(e,"ZodObject",{keyof(){return Ap(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Co()})},loose(){return this.clone({...this._zod.def,catchall:Co()})},strict(){return this.clone({...this._zod.def,catchall:wp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Ie.util.extend(this,n)},safeExtend(n){return Ie.util.safeExtend(this,n)},merge(n){return Ie.util.merge(this,n)},pick(n){return Ie.util.pick(this,n)},omit(n){return Ie.util.omit(this,n)},partial(...n){return Ie.util.partial(m.ZodOptional,this,n[0])},required(...n){return Ie.util.required(m.ZodNonOptional,this,n[0])}})});function nF(e,t){let n={type:"object",shape:e??{},...Ie.util.normalizeParams(t)};return new m.ZodObject(n)}function rF(e,t){return new m.ZodObject({type:"object",shape:e,catchall:wp(),...Ie.util.normalizeParams(t)})}function iF(e,t){return new m.ZodObject({type:"object",shape:e,catchall:Co(),...Ie.util.normalizeParams(t)})}m.ZodUnion=w.$constructor("ZodUnion",(e,t)=>{w.$ZodUnion.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.unionProcessor(e,n,i,r),e.options=t.options});function Ep(e,t){return new m.ZodUnion({type:"union",options:e,...Ie.util.normalizeParams(t)})}m.ZodXor=w.$constructor("ZodXor",(e,t)=>{m.ZodUnion.init(e,t),w.$ZodXor.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.unionProcessor(e,n,i,r),e.options=t.options});function oF(e,t){return new m.ZodXor({type:"union",options:e,inclusive:!1,...Ie.util.normalizeParams(t)})}m.ZodDiscriminatedUnion=w.$constructor("ZodDiscriminatedUnion",(e,t)=>{m.ZodUnion.init(e,t),w.$ZodDiscriminatedUnion.init(e,t)});function aF(e,t,n){return new m.ZodDiscriminatedUnion({type:"union",options:t,discriminator:e,...Ie.util.normalizeParams(n)})}m.ZodIntersection=w.$constructor("ZodIntersection",(e,t)=>{w.$ZodIntersection.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.intersectionProcessor(e,n,i,r)});function SS(e,t){return new m.ZodIntersection({type:"intersection",left:e,right:t})}m.ZodTuple=w.$constructor("ZodTuple",(e,t)=>{w.$ZodTuple.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.tupleProcessor(e,n,i,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function kS(e,t,n){let i=t instanceof w.$ZodType,r=i?n:t,o=i?t:null;return new m.ZodTuple({type:"tuple",items:e,rest:o,...Ie.util.normalizeParams(r)})}m.ZodRecord=w.$constructor("ZodRecord",(e,t)=>{w.$ZodRecord.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.recordProcessor(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function wS(e,t,n){return!t||!t._zod?new m.ZodRecord({type:"record",keyType:Fl(),valueType:e,...Ie.util.normalizeParams(t)}):new m.ZodRecord({type:"record",keyType:e,valueType:t,...Ie.util.normalizeParams(n)})}function sF(e,t,n){let i=w.clone(e);return i._zod.values=void 0,new m.ZodRecord({type:"record",keyType:i,valueType:t,...Ie.util.normalizeParams(n)})}function cF(e,t,n){return new m.ZodRecord({type:"record",keyType:e,valueType:t,mode:"loose",...Ie.util.normalizeParams(n)})}m.ZodMap=w.$constructor("ZodMap",(e,t)=>{w.$ZodMap.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.mapProcessor(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(w._minSize(...n)),e.nonempty=n=>e.check(w._minSize(1,n)),e.max=(...n)=>e.check(w._maxSize(...n)),e.size=(...n)=>e.check(w._size(...n))});function lF(e,t,n){return new m.ZodMap({type:"map",keyType:e,valueType:t,...Ie.util.normalizeParams(n)})}m.ZodSet=w.$constructor("ZodSet",(e,t)=>{w.$ZodSet.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.setProcessor(e,n,i,r),e.min=(...n)=>e.check(w._minSize(...n)),e.nonempty=n=>e.check(w._minSize(1,n)),e.max=(...n)=>e.check(w._maxSize(...n)),e.size=(...n)=>e.check(w._size(...n))});function uF(e,t){return new m.ZodSet({type:"set",valueType:e,...Ie.util.normalizeParams(t)})}m.ZodEnum=w.$constructor("ZodEnum",(e,t)=>{w.$ZodEnum.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.enumProcessor(e,i,r,o),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let a of i)if(n.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new m.ZodEnum({...t,checks:[],...Ie.util.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let a of i)if(n.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new m.ZodEnum({...t,checks:[],...Ie.util.normalizeParams(r),entries:o})}});function Ap(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new m.ZodEnum({type:"enum",entries:n,...Ie.util.normalizeParams(t)})}function dF(e,t){return new m.ZodEnum({type:"enum",entries:e,...Ie.util.normalizeParams(t)})}m.ZodLiteral=w.$constructor("ZodLiteral",(e,t)=>{w.$ZodLiteral.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.literalProcessor(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function _F(e,t){return new m.ZodLiteral({type:"literal",values:Array.isArray(e)?e:[e],...Ie.util.normalizeParams(t)})}m.ZodFile=w.$constructor("ZodFile",(e,t)=>{w.$ZodFile.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.fileProcessor(e,n,i,r),e.min=(n,i)=>e.check(w._minSize(n,i)),e.max=(n,i)=>e.check(w._maxSize(n,i)),e.mime=(n,i)=>e.check(w._mime(Array.isArray(n)?n:[n],i))});function pF(e){return w._file(m.ZodFile,e)}m.ZodTransform=w.$constructor("ZodTransform",(e,t)=>{w.$ZodTransform.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.transformProcessor(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new w.$ZodEncodeError(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(Ie.util.issue(o,n.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Ie.util.issue(a))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=r,n.fallback=!0,n)}});function Tp(e){return new m.ZodTransform({type:"transform",transform:e})}m.ZodOptional=w.$constructor("ZodOptional",(e,t)=>{w.$ZodOptional.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.optionalProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function ql(e){return new m.ZodOptional({type:"optional",innerType:e})}m.ZodExactOptional=w.$constructor("ZodExactOptional",(e,t)=>{w.$ZodExactOptional.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.optionalProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function ES(e){return new m.ZodExactOptional({type:"optional",innerType:e})}m.ZodNullable=w.$constructor("ZodNullable",(e,t)=>{w.$ZodNullable.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nullableProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Vl(e){return new m.ZodNullable({type:"nullable",innerType:e})}function fF(e){return ql(Vl(e))}m.ZodDefault=w.$constructor("ZodDefault",(e,t)=>{w.$ZodDefault.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.defaultProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function AS(e,t){return new m.ZodDefault({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ie.util.shallowClone(t)}})}m.ZodPrefault=w.$constructor("ZodPrefault",(e,t)=>{w.$ZodPrefault.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.prefaultProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function TS(e,t){return new m.ZodPrefault({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ie.util.shallowClone(t)}})}m.ZodNonOptional=w.$constructor("ZodNonOptional",(e,t)=>{w.$ZodNonOptional.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nonoptionalProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function xS(e,t){return new m.ZodNonOptional({type:"nonoptional",innerType:e,...Ie.util.normalizeParams(t)})}m.ZodSuccess=w.$constructor("ZodSuccess",(e,t)=>{w.$ZodSuccess.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.successProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function mF(e){return new m.ZodSuccess({type:"success",innerType:e})}m.ZodCatch=w.$constructor("ZodCatch",(e,t)=>{w.$ZodCatch.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.catchProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function OS(e,t){return new m.ZodCatch({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}m.ZodNaN=w.$constructor("ZodNaN",(e,t)=>{w.$ZodNaN.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nanProcessor(e,n,i,r)});function gF(e){return w._nan(m.ZodNaN,e)}m.ZodPipe=w.$constructor("ZodPipe",(e,t)=>{w.$ZodPipe.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.pipeProcessor(e,n,i,r),e.in=t.in,e.out=t.out});function kp(e,t){return new m.ZodPipe({type:"pipe",in:e,out:t})}m.ZodCodec=w.$constructor("ZodCodec",(e,t)=>{m.ZodPipe.init(e,t),w.$ZodCodec.init(e,t)});function hF(e,t,n){return new m.ZodCodec({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function yF(e){let t=e._zod.def;return new m.ZodCodec({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}m.ZodPreprocess=w.$constructor("ZodPreprocess",(e,t)=>{m.ZodPipe.init(e,t),w.$ZodPreprocess.init(e,t)});m.ZodReadonly=w.$constructor("ZodReadonly",(e,t)=>{w.$ZodReadonly.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.readonlyProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function RS(e){return new m.ZodReadonly({type:"readonly",innerType:e})}m.ZodTemplateLiteral=w.$constructor("ZodTemplateLiteral",(e,t)=>{w.$ZodTemplateLiteral.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.templateLiteralProcessor(e,n,i,r)});function vF(e,t){return new m.ZodTemplateLiteral({type:"template_literal",parts:e,...Ie.util.normalizeParams(t)})}m.ZodLazy=w.$constructor("ZodLazy",(e,t)=>{w.$ZodLazy.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.lazyProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function CS(e){return new m.ZodLazy({type:"lazy",getter:e})}m.ZodPromise=w.$constructor("ZodPromise",(e,t)=>{w.$ZodPromise.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.promiseProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function bF(e){return new m.ZodPromise({type:"promise",innerType:e})}m.ZodFunction=w.$constructor("ZodFunction",(e,t)=>{w.$ZodFunction.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.functionProcessor(e,n,i,r)});function Zl(e){return new m.ZodFunction({type:"function",input:Array.isArray(e?.input)?kS(e?.input):e?.input??Wl(Co()),output:e?.output??Co()})}m.ZodCustom=w.$constructor("ZodCustom",(e,t)=>{w.$ZodCustom.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.customProcessor(e,n,i,r)});function SF(e){let t=new w.$ZodCheck({check:"custom"});return t._zod.check=e,t}function kF(e,t){return w._custom(m.ZodCustom,e??(()=>!0),t)}function $S(e,t={}){return w._refine(m.ZodCustom,e,t)}function IS(e,t){return w._superRefine(e,t)}m.describe=w.describe;m.meta=w.meta;function wF(e,t={}){let n=new m.ZodCustom({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...Ie.util.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var EF=(...e)=>w._stringbool({Codec:m.ZodCodec,Boolean:m.ZodBoolean,String:m.ZodString},...e);m.stringbool=EF;function AF(e){let t=CS(()=>Ep([Fl(e),yS(),vS(),bS(),Wl(t),wS(Fl(),t)]));return t}function TF(e,t){return new m.ZodPreprocess({type:"pipe",in:Tp(e),out:t})}});var LS=M(St=>{"use strict";var xF=St&&St.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),OF=St&&St.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),RF=St&&St.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&xF(t,e,n);return OF(t,e),t};Object.defineProperty(St,"__esModule",{value:!0});St.ZodFirstPartyTypeKind=St.config=St.$brand=St.ZodIssueCode=void 0;St.setErrorMap=CF;St.getErrorMap=$F;var PS=RF(Vt());St.ZodIssueCode={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var MS=Vt();Object.defineProperty(St,"$brand",{enumerable:!0,get:function(){return MS.$brand}});Object.defineProperty(St,"config",{enumerable:!0,get:function(){return MS.config}});function CF(e){PS.config({customError:e})}function $F(){return PS.config().customError}var NS;NS||(St.ZodFirstPartyTypeKind=NS={})});var DS=M(jr=>{"use strict";var IF=jr&&jr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),NF=jr&&jr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),xp=jr&&jr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&IF(t,e,n);return NF(t,e),t};Object.defineProperty(jr,"__esModule",{value:!0});jr.fromJSONSchema=FF;var PF=Ra(),MF=xp(jl()),LF=xp(Pa()),jF=xp(Ma()),te={...jF,...MF,iso:LF},DF=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function UF(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function zF(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function jS(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return te.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return te.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=zF(r,t),a=Ct(o,t);return t.refs.set(r,a),t.processing.delete(r),a}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return te.null();if(r.length===0)return te.never();if(r.length===1)return te.literal(r[0]);if(r.every(a=>typeof a=="string"))return te.enum(r);let o=r.map(a=>te.literal(a));return o.length<2?o[0]:te.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return te.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let a={...e,type:o};return jS(a,t)});return r.length===0?te.never():r.length===1?r[0]:te.union(r)}if(!n)return te.any();let i;switch(n){case"string":{let r=te.string();if(e.format){let o=e.format;o==="email"?r=r.check(te.email()):o==="uri"||o==="uri-reference"?r=r.check(te.url()):o==="uuid"||o==="guid"?r=r.check(te.uuid()):o==="date-time"?r=r.check(te.iso.datetime()):o==="date"?r=r.check(te.iso.date()):o==="time"?r=r.check(te.iso.time()):o==="duration"?r=r.check(te.iso.duration()):o==="ipv4"?r=r.check(te.ipv4()):o==="ipv6"?r=r.check(te.ipv6()):o==="mac"?r=r.check(te.mac()):o==="cidr"?r=r.check(te.cidrv4()):o==="cidr-v6"?r=r.check(te.cidrv6()):o==="base64"?r=r.check(te.base64()):o==="base64url"?r=r.check(te.base64url()):o==="e164"?r=r.check(te.e164()):o==="jwt"?r=r.check(te.jwt()):o==="emoji"?r=r.check(te.emoji()):o==="nanoid"?r=r.check(te.nanoid()):o==="cuid"?r=r.check(te.cuid()):o==="cuid2"?r=r.check(te.cuid2()):o==="ulid"?r=r.check(te.ulid()):o==="xid"?r=r.check(te.xid()):o==="ksuid"&&(r=r.check(te.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?te.number().int():te.number();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=te.boolean();break}case"null":{i=te.null();break}case"object":{let r={},o=e.properties||{},a=new Set(e.required||[]);for(let[l,c]of Object.entries(o)){let d=Ct(c,t);r[l]=a.has(l)?d:d.optional()}if(e.propertyNames){let l=Ct(e.propertyNames,t),c=e.additionalProperties&&typeof e.additionalProperties=="object"?Ct(e.additionalProperties,t):te.any();if(Object.keys(r).length===0){i=te.record(l,c);break}let d=te.object(r).passthrough(),u=te.looseRecord(l,c);i=te.intersection(d,u);break}if(e.patternProperties){let l=e.patternProperties,c=Object.keys(l),d=[];for(let _ of c){let p=Ct(l[_],t),y=te.string().regex(new RegExp(_));d.push(te.looseRecord(y,p))}let u=[];if(Object.keys(r).length>0&&u.push(te.object(r).passthrough()),u.push(...d),u.length===0)i=te.object({}).passthrough();else if(u.length===1)i=u[0];else{let _=te.intersection(u[0],u[1]);for(let p=2;p<u.length;p++)_=te.intersection(_,u[p]);i=_}break}let s=te.object(r);e.additionalProperties===!1?i=s.strict():typeof e.additionalProperties=="object"?i=s.catchall(Ct(e.additionalProperties,t)):i=s.passthrough();break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let a=r.map(l=>Ct(l,t)),s=o&&typeof o=="object"&&!Array.isArray(o)?Ct(o,t):void 0;s?i=te.tuple(a).rest(s):i=te.tuple(a),typeof e.minItems=="number"&&(i=i.check(te.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(te.maxLength(e.maxItems)))}else if(Array.isArray(o)){let a=o.map(l=>Ct(l,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?Ct(e.additionalItems,t):void 0;s?i=te.tuple(a).rest(s):i=te.tuple(a),typeof e.minItems=="number"&&(i=i.check(te.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(te.maxLength(e.maxItems)))}else if(o!==void 0){let a=Ct(o,t),s=te.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),i=s}else i=te.array(te.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function Ct(e,t){if(typeof e=="boolean")return e?te.any():te.never();let n=jS(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(c=>Ct(c,t)),l=te.union(s);n=i?te.intersection(n,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(c=>Ct(c,t)),l=te.xor(s);n=i?te.intersection(n,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:te.any();else{let s=i?n:Ct(e.allOf[0],t),l=i?0:1;for(let c=l;c<e.allOf.length;c++)s=te.intersection(s,Ct(e.allOf[c],t));n=s}e.nullable===!0&&t.version==="openapi-3.0"&&(n=te.nullable(n)),e.readOnly===!0&&(n=te.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of o)s in e&&(r[s]=e[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in e&&(r[s]=e[s]);for(let s of Object.keys(e))DF.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function FF(e,t){if(typeof e=="boolean")return e?te.any():te.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=UF(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??PF.globalRegistry};return Ct(n,o)}});var zS=M(Kt=>{"use strict";var qF=Kt&&Kt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),VF=Kt&&Kt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),US=Kt&&Kt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&qF(t,e,n);return VF(t,e),t};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.string=WF;Kt.number=ZF;Kt.boolean=BF;Kt.bigint=HF;Kt.date=JF;var Da=US(Vt()),Ua=US(Ma());function WF(e){return Da._coercedString(Ua.ZodString,e)}function ZF(e){return Da._coercedNumber(Ua.ZodNumber,e)}function BF(e){return Da._coercedBoolean(Ua.ZodBoolean,e)}function HF(e){return Da._coercedBigint(Ua.ZodBigInt,e)}function JF(e){return Da._coercedDate(Ua.ZodDate,e)}});var Op=M(ae=>{"use strict";var FS=ae&&ae.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),KF=ae&&ae.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Bl=ae&&ae.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&FS(t,e,n);return KF(t,e),t},za=ae&&ae.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&FS(t,e,n)},GF=ae&&ae.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ae,"__esModule",{value:!0});ae.coerce=ae.iso=ae.ZodISODuration=ae.ZodISOTime=ae.ZodISODate=ae.ZodISODateTime=ae.locales=ae.fromJSONSchema=ae.toJSONSchema=ae.NEVER=ae.util=ae.TimePrecision=ae.flattenError=ae.formatError=ae.prettifyError=ae.treeifyError=ae.regexes=ae.clone=ae.$brand=ae.$input=ae.$output=ae.config=ae.registry=ae.globalRegistry=ae.core=void 0;ae.core=Bl(Vt());za(Ma(),ae);za(jl(),ae);za(yp(),ae);za(vp(),ae);za(LS(),ae);var XF=Vt(),YF=GF(up());(0,XF.config)((0,YF.default)());var Lt=Vt();Object.defineProperty(ae,"globalRegistry",{enumerable:!0,get:function(){return Lt.globalRegistry}});Object.defineProperty(ae,"registry",{enumerable:!0,get:function(){return Lt.registry}});Object.defineProperty(ae,"config",{enumerable:!0,get:function(){return Lt.config}});Object.defineProperty(ae,"$output",{enumerable:!0,get:function(){return Lt.$output}});Object.defineProperty(ae,"$input",{enumerable:!0,get:function(){return Lt.$input}});Object.defineProperty(ae,"$brand",{enumerable:!0,get:function(){return Lt.$brand}});Object.defineProperty(ae,"clone",{enumerable:!0,get:function(){return Lt.clone}});Object.defineProperty(ae,"regexes",{enumerable:!0,get:function(){return Lt.regexes}});Object.defineProperty(ae,"treeifyError",{enumerable:!0,get:function(){return Lt.treeifyError}});Object.defineProperty(ae,"prettifyError",{enumerable:!0,get:function(){return Lt.prettifyError}});Object.defineProperty(ae,"formatError",{enumerable:!0,get:function(){return Lt.formatError}});Object.defineProperty(ae,"flattenError",{enumerable:!0,get:function(){return Lt.flattenError}});Object.defineProperty(ae,"TimePrecision",{enumerable:!0,get:function(){return Lt.TimePrecision}});Object.defineProperty(ae,"util",{enumerable:!0,get:function(){return Lt.util}});Object.defineProperty(ae,"NEVER",{enumerable:!0,get:function(){return Lt.NEVER}});var QF=Na();Object.defineProperty(ae,"toJSONSchema",{enumerable:!0,get:function(){return QF.toJSONSchema}});var eq=DS();Object.defineProperty(ae,"fromJSONSchema",{enumerable:!0,get:function(){return eq.fromJSONSchema}});ae.locales=Bl(pp());var Hl=Pa();Object.defineProperty(ae,"ZodISODateTime",{enumerable:!0,get:function(){return Hl.ZodISODateTime}});Object.defineProperty(ae,"ZodISODate",{enumerable:!0,get:function(){return Hl.ZodISODate}});Object.defineProperty(ae,"ZodISOTime",{enumerable:!0,get:function(){return Hl.ZodISOTime}});Object.defineProperty(ae,"ZodISODuration",{enumerable:!0,get:function(){return Hl.ZodISODuration}});ae.iso=Bl(Pa());ae.coerce=Bl(zS())});var Xe=M(Wt=>{"use strict";var qS=Wt&&Wt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),tq=Wt&&Wt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),nq=Wt&&Wt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&qS(t,e,n);return tq(t,e),t},rq=Wt&&Wt.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&qS(t,e,n)};Object.defineProperty(Wt,"__esModule",{value:!0});Wt.z=void 0;var VS=nq(Op());Wt.z=VS;rq(Op(),Wt);Wt.default=VS});var Ee,OG,iq,RG,CG,WS=L(()=>{"use strict";Ee=Be(Xe(),1),OG=Ee.z.object({provider:Ee.z.string().min(1),models:Ee.z.array(Ee.z.string().min(1)).min(1),reasoning_efforts:Ee.z.array(Ee.z.enum(["low","medium","high","xhigh"])).min(1),velocities:Ee.z.array(Ee.z.literal("standard")).length(1),streaming:Ee.z.boolean(),cancellation:Ee.z.boolean(),checkpointing:Ee.z.boolean(),resume:Ee.z.boolean(),tool_calls:Ee.z.boolean(),structured_output:Ee.z.boolean(),max_parallel_invocations:Ee.z.number().int().positive()}).strict().superRefine((e,t)=>{e.resume&&!e.checkpointing&&t.addIssue({code:"custom",message:"Resume requires checkpointing"})}),iq=Ee.z.object({role:Ee.z.enum(["system","user","assistant","tool"]),content:Ee.z.string(),name:Ee.z.string().min(1).nullable().default(null)}).strict(),RG=Ee.z.object({schema_version:Ee.z.literal(1),invocation_id:Ee.z.string().regex(/^INV-[A-Z0-9-]+$/),agent_id:Ee.z.string().min(1),model:Ee.z.string().min(1),reasoning_effort:Ee.z.enum(["low","medium","high","xhigh"]),velocity:Ee.z.literal("standard"),input:Ee.z.object({messages:Ee.z.array(iq).min(1),context_refs:Ee.z.array(Ee.z.string().min(1)),tools:Ee.z.array(Ee.z.string().min(1)),response_format:Ee.z.enum(["text","json"])}).strict(),budget:Ee.z.object({max_output_tokens:Ee.z.number().int().positive(),timeout_ms:Ee.z.number().int().positive().nullable(),max_tool_calls:Ee.z.number().int().nonnegative()}).strict(),metadata:Ee.z.record(Ee.z.string(),Ee.z.string()),resume_from:Ee.z.string().min(1).nullable()}).strict(),CG=Ee.z.object({invocation_id:Ee.z.string().regex(/^INV-[A-Z0-9-]+$/),reason:Ee.z.enum(["user","budget","timeout","shutdown","superseded"]),requested_at:Ee.z.string().datetime()}).strict()});var Se,Dr,BS,ZS,oq,aq,Rp=L(()=>{"use strict";Se=Be(Xe(),1),Dr={schema_version:Se.z.literal(1),invocation_id:Se.z.string().regex(/^INV-[A-Z0-9-]+$/),sequence:Se.z.number().int().nonnegative(),occurred_at:Se.z.string().datetime()},BS=Se.z.object({checkpoint_id:Se.z.string().regex(/^CHK-[A-Z0-9-]+$/),opaque_token:Se.z.string().min(1),resumable_until:Se.z.string().datetime().nullable(),state_hash:Se.z.string().regex(/^[a-f0-9]{64}$/)}).strict(),ZS=Se.z.object({input_tokens:Se.z.number().int().nonnegative(),cached_input_tokens:Se.z.number().int().nonnegative(),output_tokens:Se.z.number().int().nonnegative(),reasoning_tokens:Se.z.number().int().nonnegative(),source:Se.z.enum(["provider","estimated","unavailable"])}).strict(),oq=Se.z.object({code:Se.z.enum(["authentication","authorization","invalid_request","rate_limit","provider_unavailable","timeout","budget_exceeded","tool_error","protocol_error","unknown"]),message:Se.z.string().min(1),retryable:Se.z.boolean(),retry_after_ms:Se.z.number().int().nonnegative().nullable(),provider_code:Se.z.string().nullable()}).strict(),aq=Se.z.discriminatedUnion("type",[Se.z.object({...Dr,type:Se.z.literal("invocation.started")}).strict(),Se.z.object({...Dr,type:Se.z.literal("output.delta"),delta:Se.z.string().min(1)}).strict(),Se.z.object({...Dr,type:Se.z.literal("tool.requested"),call_id:Se.z.string().min(1),name:Se.z.string().min(1),arguments:Se.z.unknown()}).strict(),Se.z.object({...Dr,type:Se.z.literal("tool.completed"),call_id:Se.z.string().min(1),output:Se.z.unknown()}).strict(),Se.z.object({...Dr,type:Se.z.literal("checkpoint.created"),checkpoint:BS}).strict(),Se.z.object({...Dr,type:Se.z.literal("usage.updated"),usage:ZS}).strict(),Se.z.object({...Dr,type:Se.z.literal("invocation.completed"),output:Se.z.string(),usage:ZS}).strict(),Se.z.object({...Dr,type:Se.z.literal("invocation.failed"),error:oq}).strict(),Se.z.object({...Dr,type:Se.z.literal("invocation.cancelled"),reason:Se.z.string().min(1)}).strict()])});var HS=L(()=>{"use strict";Rp()});var Cp=L(()=>{"use strict";WS();Rp();HS()});function cq(e){return`${e.nome}_${e.cargo}_zaip_agent`}function ii(e){return gq.parse(e)}var de,jt,JS,sq,lq,uq,dq,KS,_q,pq,Jl,fq,mq,gq,GS=L(()=>{"use strict";de=Be(Xe(),1),jt=de.z.array(de.z.string().min(1)).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:"custom",message:"Values must be unique"})}),JS=de.z.string().regex(/^[a-z0-9]+(?:_[a-z0-9]+)*$/),sq=de.z.object({nome:JS,cargo:JS,foto_url:de.z.url().refine(e=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Persona photo URL must use http or https").optional()}).strict();lq=jt.length(1).superRefine((e,t)=>{for(let[n,i]of e.entries())/^[a-z0-9_]+$/.test(i)||t.addIssue({code:"custom",path:[n],message:"Codex nicknames must be lowercase snake_case"})}),uq=de.z.string().regex(/^zaip-agent-[a-z0-9-]+$/,'Codex agent name must use the "zaip-agent-NOME" format'),dq=de.z.string().regex(/^[a-z0-9_]+$/,"Codex task name must use lowercase snake_case"),KS=de.z.enum(["orchestrator","analyst","task-executor","execution-finalizer","builder","reviewer","integrator","auditor"]),_q=de.z.enum(["id","codex_name","codex_task_name"]),pq=de.z.object({kind:_q,value:de.z.string().min(1),deprecated_at:de.z.iso.date(),remove_after:de.z.iso.date(),replacement:de.z.string().regex(/^agent-[a-z0-9-]+$/)}).strict().superRefine((e,t)=>{(e.kind==="id"?/^agent-[a-z0-9-]+$/.test(e.value):e.kind==="codex_name"?/^zaip-agent-[a-z0-9-]+$/.test(e.value):/^[a-z0-9_]+$/.test(e.value))||t.addIssue({code:"custom",path:["value"],message:`Alias value does not match identity kind ${e.kind}`}),e.remove_after<=e.deprecated_at&&t.addIssue({code:"custom",path:["remove_after"],message:"Alias removal date must be after its deprecation date"})}),Jl=de.z.object({allow:jt,deny:jt}).strict().superRefine((e,t)=>{let n=e.allow.filter(i=>e.deny.includes(i));n.length>0&&t.addIssue({code:"custom",message:`Permission both allowed and denied: ${n.join(", ")}`})}),fq=de.z.object({id:de.z.string().regex(/^agent-[a-z0-9-]+$/),version:de.z.number().int().positive(),purpose:de.z.string().min(1),use_when:jt.min(1),do_not_use:jt.min(1),codex_name:uq,codex_task_name:dq,persona:sq,nickname_candidates:lq,compatibility:de.z.object({aliases:de.z.array(pq)}).strict().optional(),role:KS,priority:de.z.number().int().nonnegative().default(100),inherits:de.z.string().regex(/^agent-[a-z0-9-]+$/).nullable().default(null),capabilities:jt.min(1),execution_eligibility:de.z.array(de.z.enum(["interaction","delivery"])),tools:jt,skills:jt,write_scopes:jt,permissions:de.z.object({filesystem:Jl,network:Jl,shell:Jl,deployment:Jl}).strict(),model:de.z.object({required_capabilities:jt,preferred:jt,reasoning_effort:de.z.enum(["low","medium","high","xhigh","ultra"]).optional()}).strict(),budget:de.z.object({soft_cycles:de.z.number().int().positive()}).strict(),contract:de.z.object({inputs:jt.min(1),outputs:jt.min(1),evidence:jt.min(1)}).strict(),review:de.z.object({can_approve:de.z.boolean(),cannot_review_roles:de.z.array(KS)}).strict(),escalation:jt}).strict().superRefine((e,t)=>{let n=e.nickname_candidates[0];e.codex_task_name!==n&&t.addIssue({code:"custom",path:["codex_task_name"],message:`Codex task name must equal the primary nickname candidate: ${n}`});let i=cq(e.persona);e.nickname_candidates[0]!==i&&t.addIssue({code:"custom",path:["nickname_candidates"],message:`nickname_candidates must contain only the derived persona nickname: ${i}`})}),mq=de.z.object({id:de.z.string().regex(/^squad-[a-z0-9-]+$/),version:de.z.number().int().positive(),purpose:de.z.string().min(1),members:de.z.array(de.z.string().regex(/^agent-[a-z0-9-]+$/)).min(2),max_parallelism:de.z.number().int().positive(),delegation:de.z.array(de.z.object({from:de.z.string().regex(/^agent-[a-z0-9-]+$/),to:de.z.string().regex(/^agent-[a-z0-9-]+$/),capability:de.z.string().min(1)}).strict()),review_policy:de.z.object({independent:de.z.literal(!0),executor_roles:de.z.array(de.z.enum(["analyst","builder","task-executor"])).min(1),reviewer_roles:de.z.array(de.z.enum(["reviewer","auditor"])).min(1)}).strict(),escalation:de.z.array(de.z.string().regex(/^agent-[a-z0-9-]+$/)).min(1)}).strict(),gq=de.z.object({schema_version:de.z.literal(1),agents:de.z.array(fq).min(1),squads:de.z.array(mq).min(1)}).strict()});function $p(e){let t=[],n=new Map,i=new Set,r=new Set;for(let l of e.agents)n.has(l.id)&&t.push({rule:"duplicate-id",subject:l.id,message:"Duplicate Agent id"}),i.has(l.codex_name)&&t.push({rule:"duplicate-codex-name",subject:l.codex_name,message:"Duplicate Codex agent name"}),i.add(l.codex_name),r.has(l.codex_task_name)&&t.push({rule:"duplicate-codex-task-name",subject:l.codex_task_name,message:"Duplicate Codex task name"}),r.add(l.codex_task_name),n.set(l.id,l);let o=new Set(e.agents.flatMap(l=>[l.id,l.codex_name,l.codex_task_name])),a=new Map;for(let l of e.agents)for(let c of l.compatibility?.aliases??[]){let d=a.get(c.value);o.has(c.value)||d!==void 0?t.push({rule:"identity-alias-collision",subject:c.value,message:d===void 0?`Agent alias collides with a canonical identity: ${c.value}`:`Agent alias is ambiguous between ${d} and ${l.id}: ${c.value}`}):a.set(c.value,l.id),(c.replacement!==l.id||!n.has(c.replacement))&&t.push({rule:"invalid-identity-replacement",subject:c.value,message:`Agent alias replacement must be its owning canonical id: ${l.id}`})}let s=new Set;for(let l of e.squads)s.has(l.id)&&t.push({rule:"duplicate-id",subject:l.id,message:"Duplicate Squad id"}),s.add(l.id),hq(l,n,t);for(let l of e.agents){if(l.inherits!==null){let c=n.get(l.inherits);c===void 0?t.push({rule:"unknown-agent",subject:l.id,message:`Inherited Agent does not exist: ${l.inherits}`}):yq(l,c,t)}for(let c of l.escalation)n.has(c)||t.push({rule:"unknown-agent",subject:l.id,message:`Escalation target does not exist: ${c}`})}return t}function hq(e,t,n){for(let s of[...e.members,...e.escalation])t.has(s)||n.push({rule:"unknown-agent",subject:e.id,message:`Unknown member: ${s}`});let i=new Map,r=new Set;for(let s of e.delegation){e.members.includes(s.from)||n.push({rule:"invalid-delegation-source",subject:e.id,message:`Delegation source is not a squad member: ${s.from}`}),t.has(s.to)?e.members.includes(s.to)||n.push({rule:"invalid-delegation-target",subject:e.id,message:`Delegation target is not a squad member: ${s.to}`}):n.push({rule:"invalid-delegation-target",subject:e.id,message:`Delegation target does not exist: ${s.to}`}),s.from===s.to&&n.push({rule:"delegation-cycle",subject:e.id,message:`Self delegation: ${s.from}`}),i.set(s.from,[...i.get(s.from)??[],s.to]),r.add(s.to);let l=t.get(s.to);l!==void 0&&!l.capabilities.includes(s.capability)&&n.push({rule:"missing-capability",subject:s.to,message:`Delegation target lacks ${s.capability}`})}for(let s of e.members)s!=="agent-orchestrator"&&!r.has(s)&&n.push({rule:"unreachable-agent",subject:s,message:`Squad member has no inbound delegation route: ${s}`});for(let s of e.members)if(XS(s,i,new Set,new Set)){n.push({rule:"delegation-cycle",subject:e.id,message:"Delegation graph contains a cycle"});break}let o=e.members.map(s=>t.get(s)).filter(s=>s?.role==="builder"),a=e.members.map(s=>t.get(s)).filter(s=>s?.role==="reviewer"||s?.role==="auditor");o.some(s=>a.some(l=>l?.id===s?.id))&&n.push({rule:"self-review",subject:e.id,message:"Builder is also the reviewer"})}function yq(e,t,n){for(let i of["filesystem","network","shell","deployment"]){let r=e.permissions[i].allow.filter(o=>!t.permissions[i].allow.includes(o));r.length>0&&n.push({rule:"privilege-escalation",subject:e.id,message:`${i} inheritance adds authority: ${r.join(", ")}`})}}function XS(e,t,n,i){if(n.has(e))return!0;if(i.has(e))return!1;n.add(e);for(let r of t.get(e)??[])if(XS(r,t,n,i))return!0;return n.delete(e),i.add(e),!1}var Ip=L(()=>{"use strict"});var YS=L(()=>{"use strict";Ip()});var QS=L(()=>{"use strict";GS();YS();Ip()});var Qe,Np=L(()=>{"use strict";Qe=class{now(){return new Date}}});function Eq(e){let t=Mp.parse(e.risk_signals);return t.production_impact||t.external_action||t.irreversible_change||t.security_or_critical_data||t.data_migration||t.broad_audit?$o("critical","CRITICAL_EXPLICIT_IMPACT"):t.rollback==="complex"?$o("critical","CRITICAL_COMPLEX_ROLLBACK"):e.ambiguity==="high"&&e.transversality==="cross_system"?$o("critical","CRITICAL_AMBIGUOUS_CROSS_SYSTEM"):e.rework==="structural"&&e.rework_cost==="high"?$o("critical","CRITICAL_STRUCTURAL_REWORK"):e.complexity==="simple"&&e.transversality==="local"&&e.ambiguity==="low"&&e.rework==="none"&&e.rework_cost==="low"&&e.bounded&&t.rollback==="trivial"&&t.verification_scope==="scoped"?$o("lite","LITE_BOUNDED_LOCAL"):$o("standard","STANDARD_GOVERNED")}function $o(e,t){return{risk:e,policy_version:ek,reasons:[t]}}var _e,vq,bq,ek,tk,nk,Pp,Kl,Sq,kq,wq,Mp,Gl,Pi,KG,rk,Io=L(()=>{"use strict";_e=Be(Xe(),1),vq=["gpt-5.6-luna","gpt-5.6-terra","gpt-5.6-sol"],bq=["low","medium","high","xhigh"],ek="task-risk-v1",tk=_e.z.enum(vq),nk=_e.z.enum(bq),Pp=_e.z.literal("standard"),Kl=_e.z.object({model:_e.z.string().min(1).optional(),reasoning_effort:_e.z.string().min(1).optional(),velocity:_e.z.string().min(1).optional()}).strict().refine(e=>e.model!==void 0||e.reasoning_effort!==void 0||e.velocity!==void 0,"Model selection override must define at least one field"),Sq=_e.z.enum(["discovery","planning","replanning","implementation","testing","integration","review","audit","finalization","rework"]),kq=_e.z.enum(["full_stack_boundary","shared_contracts_3_plus","critical_data_or_security","rollout_and_rollback","repeated_structural_repair","architectural_review_finding","prepared_plan_invalidated","material_architectural_tradeoffs"]),wq=_e.z.object({phase:Sq,agent_role:_e.z.string().min(1),complexity:_e.z.enum(["simple","standard","complex"]),risk:_e.z.enum(["lite","standard","critical"]),transversality:_e.z.enum(["local","multi_module","cross_system"]),ambiguity:_e.z.enum(["low","medium","high"]),rework:_e.z.enum(["none","localized","structural"]),rework_cost:_e.z.enum(["low","medium","high"]),bounded:_e.z.boolean(),high_volume:_e.z.boolean().default(!1),xhigh_triggers:_e.z.array(kq).default([])}).strict(),Mp=_e.z.object({production_impact:_e.z.boolean(),external_action:_e.z.boolean(),irreversible_change:_e.z.boolean(),security_or_critical_data:_e.z.boolean(),data_migration:_e.z.boolean(),broad_audit:_e.z.boolean(),rollback:_e.z.enum(["trivial","planned","complex"]),verification_scope:_e.z.enum(["scoped","package","cross_scope","full"])}).strict(),Gl=wq.omit({agent_role:!0,risk:!0}).extend({risk_signals:Mp}).strict(),Pi=Gl.extend({risk:_e.z.enum(["lite","standard","critical"]),risk_signals:Mp,risk_policy_version:_e.z.literal(ek),risk_reasons:_e.z.array(_e.z.enum(["CRITICAL_EXPLICIT_IMPACT","CRITICAL_COMPLEX_ROLLBACK","CRITICAL_AMBIGUOUS_CROSS_SYSTEM","CRITICAL_STRUCTURAL_REWORK","LITE_BOUNDED_LOCAL","STANDARD_GOVERNED"])).min(1)}).strict().superRefine((e,t)=>{let n=Eq(e);e.risk!==n.risk&&t.addIssue({code:"custom",path:["risk"],message:`Task risk must be ${n.risk} for the persisted signals`}),JSON.stringify(e.risk_reasons)!==JSON.stringify(n.reasons)&&t.addIssue({code:"custom",path:["risk_reasons"],message:`Task risk reasons must be ${n.reasons.join(",")}`})}),KG=_e.z.object({models:_e.z.array(_e.z.string().min(1)).min(1),reasoning_efforts:_e.z.array(_e.z.string().min(1)).min(1),velocities:_e.z.array(_e.z.string().min(1)).min(1)}).strict(),rk=_e.z.object({mode:_e.z.literal("auto"),default_model:_e.z.literal("gpt-5.6-terra"),default_effort:_e.z.literal("medium"),default_velocity:Pp,allowed_models:_e.z.tuple([_e.z.literal("gpt-5.6-luna"),_e.z.literal("gpt-5.6-terra"),_e.z.literal("gpt-5.6-sol")]),allowed_efforts:_e.z.tuple([_e.z.literal("low"),_e.z.literal("medium"),_e.z.literal("high"),_e.z.literal("xhigh")]),max_auto_effort:_e.z.literal("xhigh"),automatic_sources:_e.z.tuple([_e.z.literal("spec"),_e.z.literal("prd")]),notice:_e.z.enum(["always","mismatch"])}).strict()});var Ne=M(xt=>{"use strict";var Lp=Symbol.for("yaml.alias"),ik=Symbol.for("yaml.document"),Xl=Symbol.for("yaml.map"),ok=Symbol.for("yaml.pair"),jp=Symbol.for("yaml.scalar"),Yl=Symbol.for("yaml.seq"),Ur=Symbol.for("yaml.node.type"),Aq=e=>!!e&&typeof e=="object"&&e[Ur]===Lp,Tq=e=>!!e&&typeof e=="object"&&e[Ur]===ik,xq=e=>!!e&&typeof e=="object"&&e[Ur]===Xl,Oq=e=>!!e&&typeof e=="object"&&e[Ur]===ok,ak=e=>!!e&&typeof e=="object"&&e[Ur]===jp,Rq=e=>!!e&&typeof e=="object"&&e[Ur]===Yl;function sk(e){if(e&&typeof e=="object")switch(e[Ur]){case Xl:case Yl:return!0}return!1}function Cq(e){if(e&&typeof e=="object")switch(e[Ur]){case Lp:case Xl:case jp:case Yl:return!0}return!1}var $q=e=>(ak(e)||sk(e))&&!!e.anchor;xt.ALIAS=Lp;xt.DOC=ik;xt.MAP=Xl;xt.NODE_TYPE=Ur;xt.PAIR=ok;xt.SCALAR=jp;xt.SEQ=Yl;xt.hasAnchor=$q;xt.isAlias=Aq;xt.isCollection=sk;xt.isDocument=Tq;xt.isMap=xq;xt.isNode=Cq;xt.isPair=Oq;xt.isScalar=ak;xt.isSeq=Rq});var Fa=M(Dp=>{"use strict";var ht=Ne(),Zt=Symbol("break visit"),ck=Symbol("skip children"),kr=Symbol("remove node");function Ql(e,t){let n=lk(t);ht.isDocument(e)?No(null,e.contents,n,Object.freeze([e]))===kr&&(e.contents=null):No(null,e,n,Object.freeze([]))}Ql.BREAK=Zt;Ql.SKIP=ck;Ql.REMOVE=kr;function No(e,t,n,i){let r=uk(e,t,n,i);if(ht.isNode(r)||ht.isPair(r))return dk(e,i,r),No(e,r,n,i);if(typeof r!="symbol"){if(ht.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let a=No(o,t.items[o],n,i);if(typeof a=="number")o=a-1;else{if(a===Zt)return Zt;a===kr&&(t.items.splice(o,1),o-=1)}}}else if(ht.isPair(t)){i=Object.freeze(i.concat(t));let o=No("key",t.key,n,i);if(o===Zt)return Zt;o===kr&&(t.key=null);let a=No("value",t.value,n,i);if(a===Zt)return Zt;a===kr&&(t.value=null)}}return r}async function eu(e,t){let n=lk(t);ht.isDocument(e)?await Po(null,e.contents,n,Object.freeze([e]))===kr&&(e.contents=null):await Po(null,e,n,Object.freeze([]))}eu.BREAK=Zt;eu.SKIP=ck;eu.REMOVE=kr;async function Po(e,t,n,i){let r=await uk(e,t,n,i);if(ht.isNode(r)||ht.isPair(r))return dk(e,i,r),Po(e,r,n,i);if(typeof r!="symbol"){if(ht.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let a=await Po(o,t.items[o],n,i);if(typeof a=="number")o=a-1;else{if(a===Zt)return Zt;a===kr&&(t.items.splice(o,1),o-=1)}}}else if(ht.isPair(t)){i=Object.freeze(i.concat(t));let o=await Po("key",t.key,n,i);if(o===Zt)return Zt;o===kr&&(t.key=null);let a=await Po("value",t.value,n,i);if(a===Zt)return Zt;a===kr&&(t.value=null)}}return r}function lk(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function uk(e,t,n,i){if(typeof n=="function")return n(e,t,i);if(ht.isMap(t))return n.Map?.(e,t,i);if(ht.isSeq(t))return n.Seq?.(e,t,i);if(ht.isPair(t))return n.Pair?.(e,t,i);if(ht.isScalar(t))return n.Scalar?.(e,t,i);if(ht.isAlias(t))return n.Alias?.(e,t,i)}function dk(e,t,n){let i=t[t.length-1];if(ht.isCollection(i))i.items[e]=n;else if(ht.isPair(i))e==="key"?i.key=n:i.value=n;else if(ht.isDocument(i))i.contents=n;else{let r=ht.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}Dp.visit=Ql;Dp.visitAsync=eu});var Up=M(pk=>{"use strict";var _k=Ne(),Iq=Fa(),Nq={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pq=e=>e.replace(/[!,[\]{}]/g,t=>Nq[t]),qa=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,a]=i;return this.tags[o]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let a=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,a),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}let[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(a){return n(String(a)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+Pq(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(t&&i.length>0&&_k.isNode(t.contents)){let o={};Iq.visit(t.contents,(a,s)=>{_k.isNode(s)&&s.tag&&(o[s.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,a]of i)o==="!!"&&a==="tag:yaml.org,2002:"||(!t||r.some(s=>s.startsWith(a)))&&n.push(`%TAG ${o} ${a}`);return n.join(`
66
+ `)}};qa.defaultYaml={explicit:!1,version:"1.2"};qa.defaultTags={"!!":"tag:yaml.org,2002:"};pk.Directives=qa});var tu=M(Va=>{"use strict";var fk=Ne(),Mq=Fa();function Lq(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function mk(e){let t=new Set;return Mq.visit(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function gk(e,t){for(let n=1;;++n){let i=`${e}${n}`;if(!t.has(i))return i}}function jq(e,t){let n=[],i=new Map,r=null;return{onAnchor:o=>{n.push(o),r??(r=mk(e));let a=gk(t,r);return r.add(a),a},setAnchors:()=>{for(let o of n){let a=i.get(o);if(typeof a=="object"&&a.anchor&&(fk.isScalar(a.node)||fk.isCollection(a.node)))a.node.anchor=a.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=o,s}}},sourceObjects:i}}Va.anchorIsValid=Lq;Va.anchorNames=mk;Va.createNodeAnchors=jq;Va.findNewAnchor=gk});var zp=M(hk=>{"use strict";function Wa(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r){let a=i[r],s=Wa(e,i,String(r),a);s===void 0?delete i[r]:s!==a&&(i[r]=s)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let o=i.get(r),a=Wa(e,i,r,o);a===void 0?i.delete(r):a!==o&&i.set(r,a)}else if(i instanceof Set)for(let r of Array.from(i)){let o=Wa(e,i,r,r);o===void 0?i.delete(r):o!==r&&(i.delete(r),i.add(o))}else for(let[r,o]of Object.entries(i)){let a=Wa(e,i,r,o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}return e.call(t,n,i)}hk.applyReviver=Wa});var oi=M(vk=>{"use strict";var Dq=Ne();function yk(e,t,n){if(Array.isArray(e))return e.map((i,r)=>yk(i,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!Dq.hasAnchor(e))return e.toJSON(t,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=o=>{i.res=o,delete n.onCreate};let r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!n?.keep?Number(e):e}vk.toJS=yk});var nu=M(Sk=>{"use strict";var Uq=zp(),bk=Ne(),zq=oi(),Fp=class{constructor(t){Object.defineProperty(this,bk.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){if(!bk.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},s=zq.toJS(this,"",a);if(typeof r=="function")for(let{count:l,res:c}of a.anchors.values())r(c,l);return typeof o=="function"?Uq.applyReviver(o,{"":s},"",s):s}};Sk.NodeBase=Fp});var Za=M(kk=>{"use strict";var Fq=tu(),qq=Fa(),Mo=Ne(),Vq=nu(),Wq=oi(),qp=class extends Vq.NodeBase{constructor(t){super(Mo.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],qq.visit(t,{Node:(o,a)=>{(Mo.isAlias(a)||Mo.hasAnchor(a))&&i.push(a)}}),n&&(n.aliasResolveCache=i));let r;for(let o of i){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(t,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:o}=n,a=this.resolve(r,n);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let s=i.get(a);if(s||(Wq.toJS(a,null,n),s=i.get(a)),s?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(o>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ru(r,a,i)),s.count*s.aliasCount>o)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return s.res}toString(t,n,i){let r=`*${this.source}`;if(t){if(Fq.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${r} `}return r}};function ru(e,t,n){if(Mo.isAlias(t)){let i=t.resolve(e),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(Mo.isCollection(t)){let i=0;for(let r of t.items){let o=ru(e,r,n);o>i&&(i=o)}return i}else if(Mo.isPair(t)){let i=ru(e,t.key,n),r=ru(e,t.value,n);return Math.max(i,r)}return 1}kk.Alias=qp});var mt=M(Vp=>{"use strict";var Zq=Ne(),Bq=nu(),Hq=oi(),Jq=e=>!e||typeof e!="function"&&typeof e!="object",ai=class extends Bq.NodeBase{constructor(t){super(Zq.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:Hq.toJS(this.value,t,n)}toString(){return String(this.value)}};ai.BLOCK_FOLDED="BLOCK_FOLDED";ai.BLOCK_LITERAL="BLOCK_LITERAL";ai.PLAIN="PLAIN";ai.QUOTE_DOUBLE="QUOTE_DOUBLE";ai.QUOTE_SINGLE="QUOTE_SINGLE";Vp.Scalar=ai;Vp.isScalarValue=Jq});var Ba=M(Ek=>{"use strict";var Kq=Za(),Mi=Ne(),wk=mt(),Gq="tag:yaml.org,2002:";function Xq(e,t,n){if(t){let i=n.filter(o=>o.tag===t),r=i.find(o=>!o.format)??i[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(i=>i.identify?.(e)&&!i.format)}function Yq(e,t,n){if(Mi.isDocument(e)&&(e=e.contents),Mi.isNode(e))return e;if(Mi.isPair(e)){let u=n.schema[Mi.MAP].createNode?.(n.schema,null,n);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:o,schema:a,sourceObjects:s}=n,l;if(i&&e&&typeof e=="object"){if(l=s.get(e),l)return l.anchor??(l.anchor=r(e)),new Kq.Alias(l.anchor);l={anchor:null,node:null},s.set(e,l)}t?.startsWith("!!")&&(t=Gq+t.slice(2));let c=Xq(e,t,a.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new wk.Scalar(e);return l&&(l.node=u),u}c=e instanceof Map?a[Mi.MAP]:Symbol.iterator in Object(e)?a[Mi.SEQ]:a[Mi.MAP]}o&&(o(c),delete n.onTagObj);let d=c?.createNode?c.createNode(n.schema,e,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,e,n):new wk.Scalar(e);return t?d.tag=t:c.default||(d.tag=c.tag),l&&(l.node=d),d}Ek.createNode=Yq});var ou=M(iu=>{"use strict";var Qq=Ba(),wr=Ne(),eV=nu();function Wp(e,t,n){let i=n;for(let r=t.length-1;r>=0;--r){let o=t[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let a=[];a[o]=i,i=a}else i=new Map([[o,i]])}return Qq.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Ak=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Zp=class extends eV.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(i=>wr.isNode(i)||wr.isPair(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Ak(t))this.add(n);else{let[i,...r]=t,o=this.get(i,!0);if(wr.isCollection(o))o.addIn(r,n);else if(o===void 0&&this.schema)this.set(i,Wp(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(t){let[n,...i]=t;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(wr.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){let[i,...r]=t,o=this.get(i,!0);return r.length===0?!n&&wr.isScalar(o)?o.value:o:wr.isCollection(o)?o.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!wr.isPair(n))return!1;let i=n.value;return i==null||t&&wr.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[n,...i]=t;if(i.length===0)return this.has(n);let r=this.get(n,!0);return wr.isCollection(r)?r.hasIn(i):!1}setIn(t,n){let[i,...r]=t;if(r.length===0)this.set(i,n);else{let o=this.get(i,!0);if(wr.isCollection(o))o.setIn(r,n);else if(o===void 0&&this.schema)this.set(i,Wp(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};iu.Collection=Zp;iu.collectionFromPath=Wp;iu.isEmptyPath=Ak});var Ha=M(au=>{"use strict";var tV=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Bp(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var nV=(e,t,n)=>e.endsWith(`
67
+ `)?Bp(n,t):n.includes(`
68
+ `)?`
69
+ `+Bp(n,t):(e.endsWith(" ")?"":" ")+n;au.indentComment=Bp;au.lineComment=nV;au.stringifyComment=tV});var xk=M(Ja=>{"use strict";var rV="flow",Hp="block",su="quoted";function iV(e,t,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:o=20,onFold:a,onOverflow:s}={}){if(!r||r<0)return e;r<o&&(o=0);let l=Math.max(1+o,1+r-t.length);if(e.length<=l)return e;let c=[],d={},u=r-t.length;typeof i=="number"&&(i>r-Math.max(2,o)?c.push(0):u=r-i);let _,p,y=!1,f=-1,h=-1,k=-1;n===Hp&&(f=Tk(e,f,t.length),f!==-1&&(u=f+l));for(let R;R=e[f+=1];){if(n===su&&R==="\\"){switch(h=f,e[f+1]){case"x":f+=3;break;case"u":f+=5;break;case"U":f+=9;break;default:f+=1}k=f}if(R===`
70
+ `)n===Hp&&(f=Tk(e,f,t.length)),u=f+t.length+l,_=void 0;else{if(R===" "&&p&&p!==" "&&p!==`
71
+ `&&p!==" "){let g=e[f+1];g&&g!==" "&&g!==`
72
+ `&&g!==" "&&(_=f)}if(f>=u)if(_)c.push(_),u=_+l,_=void 0;else if(n===su){for(;p===" "||p===" ";)p=R,R=e[f+=1],y=!0;let g=f>k+1?f-2:h-1;if(d[g])return e;c.push(g),d[g]=!0,u=g+l,_=void 0}else y=!0}p=R}if(y&&s&&s(),c.length===0)return e;a&&a();let S=e.slice(0,c[0]);for(let R=0;R<c.length;++R){let g=c[R],b=c[R+1]||e.length;g===0?S=`
73
+ ${t}${e.slice(0,b)}`:(n===su&&d[g]&&(S+=`${e[g]}\\`),S+=`
74
+ ${t}${e.slice(g+1,b)}`)}return S}function Tk(e,t,n){let i=t,r=t+1,o=e[r];for(;o===" "||o===" ";)if(t<r+n)o=e[++t];else{do o=e[++t];while(o&&o!==`
75
+ `);i=t,r=t+1,o=e[r]}return i}Ja.FOLD_BLOCK=Hp;Ja.FOLD_FLOW=rV;Ja.FOLD_QUOTED=su;Ja.foldFlowLines=iV});var Ga=M(Ok=>{"use strict";var fn=mt(),si=xk(),lu=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),uu=e=>/^(%|---|\.\.\.)/m.test(e);function oV(e,t,n){if(!t||t<0)return!1;let i=t-n,r=e.length;if(r<=i)return!1;for(let o=0,a=0;o<r;++o)if(e[o]===`
76
+ `){if(o-a>i)return!0;if(a=o+1,r-a<=i)return!1}return!0}function Ka(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=t,r=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(uu(e)?" ":""),a="",s=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(a+=n.slice(s,l)+"\\ ",l+=1,s=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{a+=n.slice(s,l);let d=n.substr(l+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(l,6)}l+=5,s=l+1}break;case"n":if(i||n[l+2]==='"'||n.length<r)l+=1;else{for(a+=n.slice(s,l)+`
77
+
78
+ `;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)a+=`
79
+ `,l+=2;a+=o,n[l+2]===" "&&(a+="\\"),l+=1,s=l+1}break;default:l+=1}return a=s?a+n.slice(s):n,i?a:si.foldFlowLines(a,o,si.FOLD_QUOTED,lu(t,!1))}function Jp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
80
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Ka(e,t);let n=t.indent||(uu(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
81
+ ${n}`)+"'";return t.implicitKey?i:si.foldFlowLines(i,n,si.FOLD_FLOW,lu(t,!1))}function Lo(e,t){let{singleQuote:n}=t.options,i;if(n===!1)i=Ka;else{let r=e.includes('"'),o=e.includes("'");r&&!o?i=Jp:o&&!r?i=Ka:i=n?Jp:Ka}return i(e,t)}var Kp;try{Kp=new RegExp(`(^|(?<!
82
+ ))
83
+ +(?!
84
+ |$)`,"g")}catch{Kp=/\n+(?!\n|$)/g}function cu({comment:e,type:t,value:n},i,r,o){let{blockQuote:a,commentString:s,lineWidth:l}=i.options;if(!a||/\n[\t ]+$/.test(n))return Lo(n,i);let c=i.indent||(i.forceBlockIndent||uu(n)?" ":""),d=a==="literal"?!0:a==="folded"||t===fn.Scalar.BLOCK_FOLDED?!1:t===fn.Scalar.BLOCK_LITERAL?!0:!oV(n,l,c.length);if(!n)return d?`|
85
+ `:`>
86
+ `;let u,_;for(_=n.length;_>0;--_){let b=n[_-1];if(b!==`
87
+ `&&b!==" "&&b!==" ")break}let p=n.substring(_),y=p.indexOf(`
88
+ `);y===-1?u="-":n===p||y!==p.length-1?(u="+",o&&o()):u="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
89
+ `&&(p=p.slice(0,-1)),p=p.replace(Kp,`$&${c}`));let f=!1,h,k=-1;for(h=0;h<n.length;++h){let b=n[h];if(b===" ")f=!0;else if(b===`
90
+ `)k=h;else break}let S=n.substring(0,k<h?k+1:h);S&&(n=n.substring(S.length),S=S.replace(/\n+/g,`$&${c}`));let g=(f?c?"2":"1":"")+u;if(e&&(g+=" "+s(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!d){let b=n.replace(/\n+/g,`
91
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),O=!1,P=lu(i,!0);a!=="folded"&&t!==fn.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{O=!0});let C=si.foldFlowLines(`${S}${b}${p}`,c,si.FOLD_BLOCK,P);if(!O)return`>${g}
92
+ ${c}${C}`}return n=n.replace(/\n+/g,`$&${c}`),`|${g}
93
+ ${c}${S}${n}${p}`}function aV(e,t,n,i){let{type:r,value:o}=e,{actualString:a,implicitKey:s,indent:l,indentStep:c,inFlow:d}=t;if(s&&o.includes(`
94
+ `)||d&&/[[\]{},]/.test(o))return Lo(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return s||d||!o.includes(`
95
+ `)?Lo(o,t):cu(e,t,n,i);if(!s&&!d&&r!==fn.Scalar.PLAIN&&o.includes(`
96
+ `))return cu(e,t,n,i);if(uu(o)){if(l==="")return t.forceBlockIndent=!0,cu(e,t,n,i);if(s&&l===c)return Lo(o,t)}let u=o.replace(/\n+/g,`$&
97
+ ${l}`);if(a){let _=f=>f.default&&f.tag!=="tag:yaml.org,2002:str"&&f.test?.test(u),{compat:p,tags:y}=t.doc.schema;if(y.some(_)||p?.some(_))return Lo(o,t)}return s?u:si.foldFlowLines(u,l,si.FOLD_FLOW,lu(t,!1))}function sV(e,t,n,i){let{implicitKey:r,inFlow:o}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==fn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(s=fn.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case fn.Scalar.BLOCK_FOLDED:case fn.Scalar.BLOCK_LITERAL:return r||o?Lo(a.value,t):cu(a,t,n,i);case fn.Scalar.QUOTE_DOUBLE:return Ka(a.value,t);case fn.Scalar.QUOTE_SINGLE:return Jp(a.value,t);case fn.Scalar.PLAIN:return aV(a,t,n,i);default:return null}},c=l(s);if(c===null){let{defaultKeyType:d,defaultStringType:u}=t.options,_=r&&d||u;if(c=l(_),c===null)throw new Error(`Unsupported default string type ${_}`)}return c}Ok.stringifyString=sV});var Xa=M(Gp=>{"use strict";var cV=tu(),ci=Ne(),lV=Ha(),uV=Ga();function dV(e,t){let n=Object.assign({blockQuote:!0,commentString:lV.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function _V(e,t){if(t.tag){let r=e.filter(o=>o.tag===t.tag);if(r.length>0)return r.find(o=>o.format===t.format)??r[0]}let n,i;if(ci.isScalar(t)){i=t.value;let r=e.filter(o=>o.identify?.(i));if(r.length>1){let o=r.filter(a=>a.test);o.length>0&&(r=o)}n=r.find(o=>o.format===t.format)??r.find(o=>!o.format)}else i=t,n=e.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function pV(e,t,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],o=(ci.isScalar(e)||ci.isCollection(e))&&e.anchor;o&&cV.anchorIsValid(o)&&(n.add(o),r.push(`&${o}`));let a=e.tag??(t.default?null:t.tag);return a&&r.push(i.directives.tagString(a)),r.join(" ")}function fV(e,t,n,i){if(ci.isPair(e))return e.toString(t,n,i);if(ci.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,o=ci.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>r=l});r??(r=_V(t.doc.schema.tags,o));let a=pV(o,r,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let s=typeof r.stringify=="function"?r.stringify(o,t,n,i):ci.isScalar(o)?uV.stringifyString(o,t,n,i):o.toString(t,n,i);return a?ci.isScalar(o)||s[0]==="{"||s[0]==="["?`${a} ${s}`:`${a}
98
+ ${t.indent}${s}`:s}Gp.createStringifyContext=dV;Gp.stringify=fV});var Ik=M($k=>{"use strict";var zr=Ne(),Rk=mt(),Ck=Xa(),Ya=Ha();function mV({key:e,value:t},n,i,r){let{allNullValues:o,doc:a,indent:s,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:u}}=n,_=zr.isNode(e)&&e.comment||null;if(u){if(_)throw new Error("With simple keys, key nodes cannot have comments");if(zr.isCollection(e)||!zr.isNode(e)&&typeof e=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!u&&(!e||_&&t==null&&!n.inFlow||zr.isCollection(e)||(zr.isScalar(e)?e.type===Rk.Scalar.BLOCK_FOLDED||e.type===Rk.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(u||!o),indent:s+l});let y=!1,f=!1,h=Ck.stringify(e,n,()=>y=!0,()=>f=!0);if(!p&&!n.inFlow&&h.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||t==null)return y&&i&&i(),h===""?"?":p?`? ${h}`:h}else if(o&&!u||t==null&&p)return h=`? ${h}`,_&&!y?h+=Ya.lineComment(h,n.indent,c(_)):f&&r&&r(),h;y&&(_=null),p?(_&&(h+=Ya.lineComment(h,n.indent,c(_))),h=`? ${h}
99
+ ${s}:`):(h=`${h}:`,_&&(h+=Ya.lineComment(h,n.indent,c(_))));let k,S,R;zr.isNode(t)?(k=!!t.spaceBefore,S=t.commentBefore,R=t.comment):(k=!1,S=null,R=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!_&&zr.isScalar(t)&&(n.indentAtStart=h.length+1),f=!1,!d&&l.length>=2&&!n.inFlow&&!p&&zr.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let g=!1,b=Ck.stringify(t,n,()=>g=!0,()=>f=!0),O=" ";if(_||k||S){if(O=k?`
100
+ `:"",S){let P=c(S);O+=`
101
+ ${Ya.indentComment(P,n.indent)}`}b===""&&!n.inFlow?O===`
102
+ `&&R&&(O=`
103
+
104
+ `):O+=`
105
+ ${n.indent}`}else if(!p&&zr.isCollection(t)){let P=b[0],C=b.indexOf(`
106
+ `),v=C!==-1,A=n.inFlow??t.flow??t.items.length===0;if(v||!A){let x=!1;if(v&&(P==="&"||P==="!")){let T=b.indexOf(" ");P==="&"&&T!==-1&&T<C&&b[T+1]==="!"&&(T=b.indexOf(" ",T+1)),(T===-1||C<T)&&(x=!0)}x||(O=`
107
+ ${n.indent}`)}}else(b===""||b[0]===`
108
+ `)&&(O="");return h+=O+b,n.inFlow?g&&i&&i():R&&!g?h+=Ya.lineComment(h,n.indent,c(R)):f&&r&&r(),h}$k.stringifyPair=mV});var Yp=M(Xp=>{"use strict";var Nk=require("process");function gV(e,...t){e==="debug"&&console.log(...t)}function hV(e,t){(e==="debug"||e==="warn")&&(typeof Nk.emitWarning=="function"?Nk.emitWarning(t):console.warn(t))}Xp.debug=gV;Xp.warn=hV});var mu=M(fu=>{"use strict";var pu=Ne(),Pk=mt(),du="<<",_u={identify:e=>e===du||typeof e=="symbol"&&e.description===du,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Pk.Scalar(Symbol(du)),{addToJSMap:Mk}),stringify:()=>du},yV=(e,t)=>(_u.identify(t)||pu.isScalar(t)&&(!t.type||t.type===Pk.Scalar.PLAIN)&&_u.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===_u.tag&&n.default);function Mk(e,t,n){let i=Lk(e,n);if(pu.isSeq(i))for(let r of i.items)Qp(e,t,r);else if(Array.isArray(i))for(let r of i)Qp(e,t,r);else Qp(e,t,i)}function Qp(e,t,n){let i=Lk(e,n);if(!pu.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,e,Map);for(let[o,a]of r)t instanceof Map?t.has(o)||t.set(o,a):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function Lk(e,t){return e&&pu.isAlias(t)?t.resolve(e.doc,e):t}fu.addMergeToJSMap=Mk;fu.isMergeKey=yV;fu.merge=_u});var tf=M(Uk=>{"use strict";var vV=Yp(),jk=mu(),bV=Xa(),Dk=Ne(),ef=oi();function SV(e,t,{key:n,value:i}){if(Dk.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(jk.isMergeKey(e,n))jk.addMergeToJSMap(e,t,i);else{let r=ef.toJS(n,"",e);if(t instanceof Map)t.set(r,ef.toJS(i,r,e));else if(t instanceof Set)t.add(r);else{let o=kV(n,r,e),a=ef.toJS(i,o,e);o in t?Object.defineProperty(t,o,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[o]=a}}return t}function kV(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Dk.isNode(e)&&n?.doc){let i=bV.createStringifyContext(n.doc,{});i.anchors=new Set;for(let o of n.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=e.toString(i);if(!n.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),vV.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}Uk.addPairToJSMap=SV});var li=M(nf=>{"use strict";var zk=Ba(),wV=Ik(),EV=tf(),gu=Ne();function AV(e,t,n){let i=zk.createNode(e,void 0,n),r=zk.createNode(t,void 0,n);return new hu(i,r)}var hu=class e{constructor(t,n=null){Object.defineProperty(this,gu.NODE_TYPE,{value:gu.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return gu.isNode(n)&&(n=n.clone(t)),gu.isNode(i)&&(i=i.clone(t)),new e(n,i)}toJSON(t,n){let i=n?.mapAsMap?new Map:{};return EV.addPairToJSMap(n,i,this)}toString(t,n,i){return t?.doc?wV.stringifyPair(this,t,n,i):JSON.stringify(this)}};nf.Pair=hu;nf.createPair=AV});var rf=M(qk=>{"use strict";var Li=Ne(),Fk=Xa(),yu=Ha();function TV(e,t,n){return(t.inFlow??e.flow?OV:xV)(e,t,n)}function xV({comment:e,items:t},n,{blockItemPrefix:i,flowChars:r,itemIndent:o,onChompKeep:a,onComment:s}){let{indent:l,options:{commentString:c}}=n,d=Object.assign({},n,{indent:o,type:null}),u=!1,_=[];for(let y=0;y<t.length;++y){let f=t[y],h=null;if(Li.isNode(f))!u&&f.spaceBefore&&_.push(""),vu(n,_,f.commentBefore,u),f.comment&&(h=f.comment);else if(Li.isPair(f)){let S=Li.isNode(f.key)?f.key:null;S&&(!u&&S.spaceBefore&&_.push(""),vu(n,_,S.commentBefore,u))}u=!1;let k=Fk.stringify(f,d,()=>h=null,()=>u=!0);h&&(k+=yu.lineComment(k,o,c(h))),u&&h&&(u=!1),_.push(i+k)}let p;if(_.length===0)p=r.start+r.end;else{p=_[0];for(let y=1;y<_.length;++y){let f=_[y];p+=f?`
109
+ ${l}${f}`:`
110
+ `}}return e?(p+=`
111
+ `+yu.indentComment(c(e),l),s&&s()):u&&a&&a(),p}function OV({items:e},t,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:o,flowCollectionPadding:a,options:{commentString:s}}=t;i+=o;let l=Object.assign({},t,{indent:i,inFlow:!0,type:null}),c=!1,d=0,u=[];for(let y=0;y<e.length;++y){let f=e[y],h=null;if(Li.isNode(f))f.spaceBefore&&u.push(""),vu(t,u,f.commentBefore,!1),f.comment&&(h=f.comment);else if(Li.isPair(f)){let S=Li.isNode(f.key)?f.key:null;S&&(S.spaceBefore&&u.push(""),vu(t,u,S.commentBefore,!1),S.comment&&(c=!0));let R=Li.isNode(f.value)?f.value:null;R?(R.comment&&(h=R.comment),R.commentBefore&&(c=!0)):f.value==null&&S?.comment&&(h=S.comment)}h&&(c=!0);let k=Fk.stringify(f,l,()=>h=null);c||(c=u.length>d||k.includes(`
112
+ `)),y<e.length-1?k+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=u.reduce((S,R)=>S+R.length+2,2)+(k.length+2)>t.options.lineWidth)),c&&(k+=",")),h&&(k+=yu.lineComment(k,i,s(h))),u.push(k),d=u.length}let{start:_,end:p}=n;if(u.length===0)return _+p;if(!c){let y=u.reduce((f,h)=>f+h.length+2,2);c=t.options.lineWidth>0&&y>t.options.lineWidth}if(c){let y=_;for(let f of u)y+=f?`
113
+ ${o}${r}${f}`:`
114
+ `;return`${y}
115
+ ${r}${p}`}else return`${_}${a}${u.join(" ")}${a}${p}`}function vu({indent:e,options:{commentString:t}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=yu.indentComment(t(i),e);n.push(o.trimStart())}}qk.stringifyCollection=TV});var di=M(af=>{"use strict";var RV=rf(),CV=tf(),$V=ou(),ui=Ne(),bu=li(),IV=mt();function Qa(e,t){let n=ui.isScalar(t)?t.value:t;for(let i of e)if(ui.isPair(i)&&(i.key===t||i.key===n||ui.isScalar(i.key)&&i.key.value===n))return i}var of=class extends $V.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ui.MAP,t),this.items=[]}static from(t,n,i){let{keepUndefined:r,replacer:o}=i,a=new this(t),s=(l,c)=>{if(typeof o=="function")c=o.call(n,l,c);else if(Array.isArray(o)&&!o.includes(l))return;(c!==void 0||r)&&a.items.push(bu.createPair(l,c,i))};if(n instanceof Map)for(let[l,c]of n)s(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))s(l,n[l]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){let i;ui.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new bu.Pair(t,t?.value):i=new bu.Pair(t.key,t.value);let r=Qa(this.items,i.key),o=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);ui.isScalar(r.value)&&IV.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(o){let a=this.items.findIndex(s=>o(i,s)<0);a===-1?this.items.push(i):this.items.splice(a,0,i)}else this.items.push(i)}delete(t){let n=Qa(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let r=Qa(this.items,t)?.value;return(!n&&ui.isScalar(r)?r.value:r)??void 0}has(t){return!!Qa(this.items,t)}set(t,n){this.add(new bu.Pair(t,n),!0)}toJSON(t,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let o of this.items)CV.addPairToJSMap(n,r,o);return r}toString(t,n,i){if(!t)return JSON.stringify(this);for(let r of this.items)if(!ui.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),RV.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}};af.YAMLMap=of;af.findPair=Qa});var jo=M(Wk=>{"use strict";var NV=Ne(),Vk=di(),PV={collection:"map",default:!0,nodeClass:Vk.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return NV.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Vk.YAMLMap.from(e,t,n)};Wk.map=PV});var _i=M(Zk=>{"use strict";var MV=Ba(),LV=rf(),jV=ou(),ku=Ne(),DV=mt(),UV=oi(),sf=class extends jV.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(ku.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=Su(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let i=Su(t);if(typeof i!="number")return;let r=this.items[i];return!n&&ku.isScalar(r)?r.value:r}has(t){let n=Su(t);return typeof n=="number"&&n<this.items.length}set(t,n){let i=Su(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[i];ku.isScalar(r)&&DV.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(t,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let o of this.items)i.push(UV.toJS(o,String(r++),n));return i}toString(t,n,i){return t?LV.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n)){let a=0;for(let s of n){if(typeof r=="function"){let l=n instanceof Set?s:String(a++);s=r.call(n,l,s)}o.items.push(MV.createNode(s,void 0,i))}}return o}};function Su(e){let t=ku.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Zk.YAMLSeq=sf});var Do=M(Hk=>{"use strict";var zV=Ne(),Bk=_i(),FV={collection:"seq",default:!0,nodeClass:Bk.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return zV.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Bk.YAMLSeq.from(e,t,n)};Hk.seq=FV});var es=M(Jk=>{"use strict";var qV=Ga(),VV={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),qV.stringifyString(e,t,n,i)}};Jk.string=VV});var wu=M(Xk=>{"use strict";var Kk=mt(),Gk={identify:e=>e==null,createNode:()=>new Kk.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Kk.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Gk.test.test(e)?e:t.options.nullStr};Xk.nullTag=Gk});var cf=M(Qk=>{"use strict";var WV=mt(),Yk={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new WV.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Yk.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};Qk.boolTag=Yk});var Uo=M(ew=>{"use strict";function ZV({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let a=o.indexOf(".");a<0&&(a=o.length,o+=".");let s=t-(o.length-a-1);for(;s-- >0;)o+="0"}return o}ew.stringifyNumber=ZV});var uf=M(Eu=>{"use strict";var BV=mt(),lf=Uo(),HV={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:lf.stringifyNumber},JV={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():lf.stringifyNumber(e)}},KV={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new BV.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:lf.stringifyNumber};Eu.float=KV;Eu.floatExp=JV;Eu.floatNaN=HV});var _f=M(Tu=>{"use strict";var tw=Uo(),Au=e=>typeof e=="bigint"||Number.isInteger(e),df=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function nw(e,t,n){let{value:i}=e;return Au(i)&&i>=0?n+i.toString(t):tw.stringifyNumber(e)}var GV={identify:e=>Au(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>df(e,2,8,n),stringify:e=>nw(e,8,"0o")},XV={identify:Au,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>df(e,0,10,n),stringify:tw.stringifyNumber},YV={identify:e=>Au(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>df(e,2,16,n),stringify:e=>nw(e,16,"0x")};Tu.int=XV;Tu.intHex=YV;Tu.intOct=GV});var iw=M(rw=>{"use strict";var QV=jo(),e2=wu(),t2=Do(),n2=es(),r2=cf(),pf=uf(),ff=_f(),i2=[QV.map,t2.seq,n2.string,e2.nullTag,r2.boolTag,ff.intOct,ff.int,ff.intHex,pf.floatNaN,pf.floatExp,pf.float];rw.schema=i2});var sw=M(aw=>{"use strict";var o2=mt(),a2=jo(),s2=Do();function ow(e){return typeof e=="bigint"||Number.isInteger(e)}var xu=({value:e})=>JSON.stringify(e),c2=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:xu},{identify:e=>e==null,createNode:()=>new o2.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:xu},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:xu},{identify:ow,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>ow(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:xu}],l2={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},u2=[a2.map,s2.seq].concat(c2,l2);aw.schema=u2});var gf=M(cw=>{"use strict";var ts=require("buffer"),mf=mt(),d2=Ga(),_2={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof ts.Buffer=="function")return ts.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},i,r,o){if(!n)return"";let a=n,s;if(typeof ts.Buffer=="function")s=a instanceof ts.Buffer?a.toString("base64"):ts.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<a.length;++c)l+=String.fromCharCode(a[c]);s=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=mf.Scalar.BLOCK_LITERAL),t!==mf.Scalar.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(s.length/l),d=new Array(c);for(let u=0,_=0;u<c;++u,_+=l)d[u]=s.substr(_,l);s=d.join(t===mf.Scalar.BLOCK_LITERAL?`
116
+ `:" ")}return d2.stringifyString({comment:e,type:t,value:s},i,r,o)}};cw.binary=_2});var Cu=M(Ru=>{"use strict";var Ou=Ne(),hf=li(),p2=mt(),f2=_i();function lw(e,t){if(Ou.isSeq(e))for(let n=0;n<e.items.length;++n){let i=e.items[n];if(!Ou.isPair(i)){if(Ou.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let r=i.items[0]||new hf.Pair(new p2.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
117
+ ${r.key.commentBefore}`:i.commentBefore),i.comment){let o=r.value??r.key;o.comment=o.comment?`${i.comment}
118
+ ${o.comment}`:i.comment}i=r}e.items[n]=Ou.isPair(i)?i:new hf.Pair(i)}}else t("Expected a sequence for this tag");return e}function uw(e,t,n){let{replacer:i}=n,r=new f2.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof i=="function"&&(a=i.call(t,String(o++),a));let s,l;if(Array.isArray(a))if(a.length===2)s=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let c=Object.keys(a);if(c.length===1)s=c[0],l=a[s];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else s=a;r.items.push(hf.createPair(s,l,n))}return r}var m2={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:lw,createNode:uw};Ru.createPairs=uw;Ru.pairs=m2;Ru.resolvePairs=lw});var bf=M(vf=>{"use strict";var dw=Ne(),yf=oi(),ns=di(),g2=_i(),_w=Cu(),ji=class e extends g2.YAMLSeq{constructor(){super(),this.add=ns.YAMLMap.prototype.add.bind(this),this.delete=ns.YAMLMap.prototype.delete.bind(this),this.get=ns.YAMLMap.prototype.get.bind(this),this.has=ns.YAMLMap.prototype.has.bind(this),this.set=ns.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,a;if(dw.isPair(r)?(o=yf.toJS(r.key,"",n),a=yf.toJS(r.value,o,n)):o=yf.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,a)}return i}static from(t,n,i){let r=_w.createPairs(t,n,i),o=new this;return o.items=r.items,o}};ji.tag="tag:yaml.org,2002:omap";var h2={collection:"seq",identify:e=>e instanceof Map,nodeClass:ji,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=_w.resolvePairs(e,t),i=[];for(let{key:r}of n.items)dw.isScalar(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new ji,n)},createNode:(e,t,n)=>ji.from(e,t,n)};vf.YAMLOMap=ji;vf.omap=h2});var hw=M(Sf=>{"use strict";var pw=mt();function fw({value:e,source:t},n){return t&&(e?mw:gw).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var mw={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new pw.Scalar(!0),stringify:fw},gw={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new pw.Scalar(!1),stringify:fw};Sf.falseTag=gw;Sf.trueTag=mw});var yw=M($u=>{"use strict";var y2=mt(),kf=Uo(),v2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:kf.stringifyNumber},b2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():kf.stringifyNumber(e)}},S2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new y2.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:kf.stringifyNumber};$u.float=S2;$u.floatExp=b2;$u.floatNaN=v2});var bw=M(is=>{"use strict";var vw=Uo(),rs=e=>typeof e=="bigint"||Number.isInteger(e);function Iu(e,t,n,{intAsBigInt:i}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return r==="-"?BigInt(-1)*a:a}let o=parseInt(e,n);return r==="-"?-1*o:o}function wf(e,t,n){let{value:i}=e;if(rs(i)){let r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return vw.stringifyNumber(e)}var k2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Iu(e,2,2,n),stringify:e=>wf(e,2,"0b")},w2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Iu(e,1,8,n),stringify:e=>wf(e,8,"0")},E2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Iu(e,0,10,n),stringify:vw.stringifyNumber},A2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Iu(e,2,16,n),stringify:e=>wf(e,16,"0x")};is.int=E2;is.intBin=k2;is.intHex=A2;is.intOct=w2});var Af=M(Ef=>{"use strict";var Mu=Ne(),Nu=li(),Pu=di(),Di=class e extends Pu.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Mu.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Nu.Pair(t.key,null):n=new Nu.Pair(t,null),Pu.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let i=Pu.findPair(this.items,t);return!n&&Mu.isPair(i)?Mu.isScalar(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=Pu.findPair(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new Nu.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof r=="function"&&(a=r.call(n,a,a)),o.items.push(Nu.createPair(a,null,i));return o}};Di.tag="tag:yaml.org,2002:set";var T2={collection:"map",identify:e=>e instanceof Set,nodeClass:Di,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Di.from(e,t,n),resolve(e,t){if(Mu.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Di,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Ef.YAMLSet=Di;Ef.set=T2});var xf=M(Lu=>{"use strict";var x2=Uo();function Tf(e,t){let n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=a=>t?BigInt(a):Number(a),o=i.replace(/_/g,"").split(":").reduce((a,s)=>a*r(60)+r(s),r(0));return n==="-"?r(-1)*o:o}function Sw(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return x2.stringifyNumber(e);let i="";t<0&&(i="-",t*=n(-1));let r=n(60),o=[t%r];return t<60?o.unshift(0):(t=(t-o[0])/r,o.unshift(t%r),t>=60&&(t=(t-o[0])/r,o.unshift(t))),i+o.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var O2={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Tf(e,n),stringify:Sw},R2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Tf(e,!1),stringify:Sw},kw={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(kw.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,a,s]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,i-1,r,o||0,a||0,s||0,l),d=t[8];if(d&&d!=="Z"){let u=Tf(d,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Lu.floatTime=R2;Lu.intTime=O2;Lu.timestamp=kw});var Aw=M(Ew=>{"use strict";var C2=jo(),$2=wu(),I2=Do(),N2=es(),P2=gf(),ww=hw(),Of=yw(),ju=bw(),M2=mu(),L2=bf(),j2=Cu(),D2=Af(),Rf=xf(),U2=[C2.map,I2.seq,N2.string,$2.nullTag,ww.trueTag,ww.falseTag,ju.intBin,ju.intOct,ju.int,ju.intHex,Of.floatNaN,Of.floatExp,Of.float,P2.binary,M2.merge,L2.omap,j2.pairs,D2.set,Rf.intTime,Rf.floatTime,Rf.timestamp];Ew.schema=U2});var Mw=M(If=>{"use strict";var Rw=jo(),z2=wu(),Cw=Do(),F2=es(),q2=cf(),Cf=uf(),$f=_f(),V2=iw(),W2=sw(),$w=gf(),os=mu(),Iw=bf(),Nw=Cu(),Tw=Aw(),Pw=Af(),Du=xf(),xw=new Map([["core",V2.schema],["failsafe",[Rw.map,Cw.seq,F2.string]],["json",W2.schema],["yaml11",Tw.schema],["yaml-1.1",Tw.schema]]),Ow={binary:$w.binary,bool:q2.boolTag,float:Cf.float,floatExp:Cf.floatExp,floatNaN:Cf.floatNaN,floatTime:Du.floatTime,int:$f.int,intHex:$f.intHex,intOct:$f.intOct,intTime:Du.intTime,map:Rw.map,merge:os.merge,null:z2.nullTag,omap:Iw.omap,pairs:Nw.pairs,seq:Cw.seq,set:Pw.set,timestamp:Du.timestamp},Z2={"tag:yaml.org,2002:binary":$w.binary,"tag:yaml.org,2002:merge":os.merge,"tag:yaml.org,2002:omap":Iw.omap,"tag:yaml.org,2002:pairs":Nw.pairs,"tag:yaml.org,2002:set":Pw.set,"tag:yaml.org,2002:timestamp":Du.timestamp};function B2(e,t,n){let i=xw.get(t);if(i&&!e)return n&&!i.includes(os.merge)?i.concat(os.merge):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{let o=Array.from(xw.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)r=r.concat(o);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(os.merge)),r.reduce((o,a)=>{let s=typeof a=="string"?Ow[a]:a;if(!s){let l=JSON.stringify(a),c=Object.keys(Ow).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(s)||o.push(s),o},[])}If.coreKnownTags=Z2;If.getTags=B2});var Mf=M(Lw=>{"use strict";var Nf=Ne(),H2=jo(),J2=Do(),K2=es(),Uu=Mw(),G2=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Pf=class e{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:a,toStringDefaults:s}){this.compat=Array.isArray(t)?Uu.getTags(t,"compat"):t?Uu.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?Uu.coreKnownTags:{},this.tags=Uu.getTags(n,this.name,i),this.toStringOptions=s??null,Object.defineProperty(this,Nf.MAP,{value:H2.map}),Object.defineProperty(this,Nf.SCALAR,{value:K2.string}),Object.defineProperty(this,Nf.SEQ,{value:J2.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?G2:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Lw.Schema=Pf});var Dw=M(jw=>{"use strict";var X2=Ne(),Lf=Xa(),as=Ha();function Y2(e,t){let n=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");let r=Lf.createStringifyContext(e,t),{commentString:o}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=o(e.commentBefore);n.unshift(as.indentComment(l,""))}let a=!1,s=null;if(e.contents){if(X2.isNode(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){let d=o(e.contents.commentBefore);n.push(as.indentComment(d,""))}r.forceBlockIndent=!!e.comment,s=e.contents.comment}let l=s?void 0:()=>a=!0,c=Lf.stringify(e.contents,r,()=>s=null,l);s&&(c+=as.lineComment(c,"",o(s))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Lf.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let l=o(e.comment);l.includes(`
119
+ `)?(n.push("..."),n.push(as.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&a&&(l=l.replace(/^\n+/,"")),l&&((!a||s)&&n[n.length-1]!==""&&n.push(""),n.push(as.indentComment(o(l),"")))}return n.join(`
120
+ `)+`
121
+ `}jw.stringifyDocument=Y2});var ss=M(Uw=>{"use strict";var Q2=Za(),zo=ou(),sn=Ne(),eW=li(),tW=oi(),nW=Mf(),rW=Dw(),jf=tu(),iW=zp(),oW=Ba(),Df=Up(),Uf=class e{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,sn.NODE_TYPE,{value:sn.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=o;let{version:a}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Df.Directives({version:a}),this.setSchema(a,i),this.contents=t===void 0?null:this.createNode(t,r,i)}clone(){let t=Object.create(e.prototype,{[sn.NODE_TYPE]:{value:sn.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=sn.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Fo(this.contents)&&this.contents.add(t)}addIn(t,n){Fo(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let i=jf.anchorNames(this);t.anchor=!n||i.has(n)?jf.findNewAnchor(n||"a",i):n}return new Q2.Alias(t.anchor)}createNode(t,n,i){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){let h=S=>typeof S=="number"||S instanceof String||S instanceof Number,k=n.filter(h).map(String);k.length>0&&(n=n.concat(k)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:a,flow:s,keepUndefined:l,onTagObj:c,tag:d}=i??{},{onAnchor:u,setAnchors:_,sourceObjects:p}=jf.createNodeAnchors(this,a||"a"),y={aliasDuplicateObjects:o??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:p},f=oW.createNode(t,d,y);return s&&sn.isCollection(f)&&(f.flow=!0),_(),f}createPair(t,n,i={}){let r=this.createNode(t,null,i),o=this.createNode(n,null,i);return new eW.Pair(r,o)}delete(t){return Fo(this.contents)?this.contents.delete(t):!1}deleteIn(t){return zo.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Fo(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return sn.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return zo.isEmptyPath(t)?!n&&sn.isScalar(this.contents)?this.contents.value:this.contents:sn.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return sn.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return zo.isEmptyPath(t)?this.contents!==void 0:sn.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=zo.collectionFromPath(this.schema,[t],n):Fo(this.contents)&&this.contents.set(t,n)}setIn(t,n){zo.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=zo.collectionFromPath(this.schema,Array.from(t),n):Fo(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Df.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Df.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new nW.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:a}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=tW.toJS(this.contents,n??"",s);if(typeof o=="function")for(let{count:c,res:d}of s.anchors.values())o(d,c);return typeof a=="function"?iW.applyReviver(a,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return rW.stringifyDocument(this,t)}};function Fo(e){if(sn.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Uw.Document=Uf});var us=M(ls=>{"use strict";var cs=class extends Error{constructor(t,n,i,r){super(),this.name=t,this.code=i,this.message=r,this.pos=n}},zf=class extends cs{constructor(t,n,i){super("YAMLParseError",t,n,i)}},Ff=class extends cs{constructor(t,n,i){super("YAMLWarning",t,n,i)}},aW=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(s=>t.linePos(s));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let o=r-1,a=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(o>=60&&a.length>80){let s=Math.min(o-39,a.length-79);a="\u2026"+a.substring(s),o-=s-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(a.substring(0,o))){let s=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);s.length>80&&(s=s.substring(0,79)+`\u2026
122
+ `),a=s+a}if(/[^ ]/.test(a)){let s=1,l=n.linePos[1];l?.line===i&&l.col>r&&(s=Math.max(1,Math.min(l.col-r,80-o)));let c=" ".repeat(o)+"^".repeat(s);n.message+=`:
123
+
124
+ ${a}
125
+ ${c}
126
+ `}};ls.YAMLError=cs;ls.YAMLParseError=zf;ls.YAMLWarning=Ff;ls.prettifyError=aW});var ds=M(zw=>{"use strict";function sW(e,{flow:t,indicator:n,next:i,offset:r,onError:o,parentIndent:a,startOnNewline:s}){let l=!1,c=s,d=s,u="",_="",p=!1,y=!1,f=null,h=null,k=null,S=null,R=null,g=null,b=null;for(let C of e)switch(y&&(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma"&&o(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),f&&(c&&C.type!=="comment"&&C.type!=="newline"&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),f=null),C.type){case"space":!t&&(n!=="doc-start"||i?.type!=="flow-collection")&&C.source.includes(" ")&&(f=C),d=!0;break;case"comment":{d||o(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let v=C.source.substring(1)||" ";u?u+=_+v:u=v,_="",c=!1;break}case"newline":c?u?u+=C.source:(!g||n!=="seq-item-ind")&&(l=!0):_+=C.source,c=!0,p=!0,(h||k)&&(S=C),d=!0;break;case"anchor":h&&o(C,"MULTIPLE_ANCHORS","A node can have at most one anchor"),C.source.endsWith(":")&&o(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=C,b??(b=C.offset),c=!1,d=!1,y=!0;break;case"tag":{k&&o(C,"MULTIPLE_TAGS","A node can have at most one tag"),k=C,b??(b=C.offset),c=!1,d=!1,y=!0;break}case n:(h||k)&&o(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`),g&&o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${t??"collection"}`),g=C,c=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){R&&o(C,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),R=C,c=!1,d=!1;break}default:o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),c=!1,d=!1}let O=e[e.length-1],P=O?O.offset+O.source.length:r;return y&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f&&(c&&f.indent<=a||i?.type==="block-map"||i?.type==="block-seq")&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:R,found:g,spaceBefore:l,comment:u,hasNewline:p,anchor:h,tag:k,newlineAfterProp:S,end:P,start:b??P}}zw.resolveProps=sW});var zu=M(Fw=>{"use strict";function qf(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
127
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(qf(t.key)||qf(t.value))return!0}return!1;default:return!0}}Fw.containsNewline=qf});var Vf=M(qw=>{"use strict";var cW=zu();function lW(e,t,n){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&cW.containsNewline(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}qw.flowIndentCheck=lW});var Wf=M(Ww=>{"use strict";var Vw=Ne();function uW(e,t,n){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let r=typeof i=="function"?i:(o,a)=>o===a||Vw.isScalar(o)&&Vw.isScalar(a)&&o.value===a.value;return t.some(o=>r(o.key,n))}Ww.mapIncludes=uW});var Gw=M(Kw=>{"use strict";var Zw=li(),dW=di(),Bw=ds(),_W=zu(),Hw=Vf(),pW=Wf(),Jw="All mapping items must start at the same column";function fW({composeNode:e,composeEmptyNode:t},n,i,r,o){let a=o?.nodeClass??dW.YAMLMap,s=new a(n.schema);n.atRoot&&(n.atRoot=!1);let l=i.offset,c=null;for(let d of i.items){let{start:u,key:_,sep:p,value:y}=d,f=Bw.resolveProps(u,{indicator:"explicit-key-ind",next:_??p?.[0],offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0}),h=!f.found;if(h){if(_&&(_.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in _&&_.indent!==i.indent&&r(l,"BAD_INDENT",Jw)),!f.anchor&&!f.tag&&!p){c=f.end,f.comment&&(s.comment?s.comment+=`
128
+ `+f.comment:s.comment=f.comment);continue}(f.newlineAfterProp||_W.containsNewline(_))&&r(_??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else f.found?.indent!==i.indent&&r(l,"BAD_INDENT",Jw);n.atKey=!0;let k=f.end,S=_?e(n,_,f,r):t(n,k,u,null,f,r);n.schema.compat&&Hw.flowIndentCheck(i.indent,_,r),n.atKey=!1,pW.mapIncludes(n,s.items,S)&&r(k,"DUPLICATE_KEY","Map keys must be unique");let R=Bw.resolveProps(p??[],{indicator:"map-value-ind",next:y,offset:S.range[2],onError:r,parentIndent:i.indent,startOnNewline:!_||_.type==="block-scalar"});if(l=R.end,R.found){h&&(y?.type==="block-map"&&!R.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&f.start<R.found.offset-1024&&r(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let g=y?e(n,y,R,r):t(n,l,p,null,R,r);n.schema.compat&&Hw.flowIndentCheck(i.indent,y,r),l=g.range[2];let b=new Zw.Pair(S,g);n.options.keepSourceTokens&&(b.srcToken=d),s.items.push(b)}else{h&&r(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),R.comment&&(S.comment?S.comment+=`
129
+ `+R.comment:S.comment=R.comment);let g=new Zw.Pair(S);n.options.keepSourceTokens&&(g.srcToken=d),s.items.push(g)}}return c&&c<l&&r(c,"IMPOSSIBLE","Map comment with trailing content"),s.range=[i.offset,l,c??l],s}Kw.resolveBlockMap=fW});var Yw=M(Xw=>{"use strict";var mW=_i(),gW=ds(),hW=Vf();function yW({composeNode:e,composeEmptyNode:t},n,i,r,o){let a=o?.nodeClass??mW.YAMLSeq,s=new a(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=i.offset,c=null;for(let{start:d,value:u}of i.items){let _=gW.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!_.found)if(_.anchor||_.tag||u)u?.type==="block-seq"?r(_.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=_.end,_.comment&&(s.comment=_.comment);continue}let p=u?e(n,u,_,r):t(n,_.end,d,null,_,r);n.schema.compat&&hW.flowIndentCheck(i.indent,u,r),l=p.range[2],s.items.push(p)}return s.range=[i.offset,l,c??l],s}Xw.resolveBlockSeq=yW});var qo=M(Qw=>{"use strict";function vW(e,t,n,i){let r="";if(e){let o=!1,a="";for(let s of e){let{source:l,type:c}=s;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";r?r+=a+d:r=d,a="";break}case"newline":r&&(a+=l),o=!0;break;default:i(s,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:r,offset:t}}Qw.resolveEnd=vW});var rE=M(nE=>{"use strict";var bW=Ne(),SW=li(),eE=di(),kW=_i(),wW=qo(),tE=ds(),EW=zu(),AW=Wf(),Zf="Block collections are not allowed within flow collections",Bf=e=>e&&(e.type==="block-map"||e.type==="block-seq");function TW({composeNode:e,composeEmptyNode:t},n,i,r,o){let a=i.start.source==="{",s=a?"flow map":"flow sequence",l=o?.nodeClass??(a?eE.YAMLMap:kW.YAMLSeq),c=new l(n.schema);c.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let h=0;h<i.items.length;++h){let k=i.items[h],{start:S,key:R,sep:g,value:b}=k,O=tE.resolveProps(S,{flow:s,indicator:"explicit-key-ind",next:R??g?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!g&&!b){h===0&&O.comma?r(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):h<i.items.length-1&&r(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),O.comment&&(c.comment?c.comment+=`
130
+ `+O.comment:c.comment=O.comment),u=O.end;continue}!a&&n.options.strict&&EW.containsNewline(R)&&r(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)O.comma&&r(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(O.comma||r(O.start,"MISSING_CHAR",`Missing , between ${s} items`),O.comment){let P="";e:for(let C of S)switch(C.type){case"comma":case"space":break;case"comment":P=C.source.substring(1);break e;default:break e}if(P){let C=c.items[c.items.length-1];bW.isPair(C)&&(C=C.value??C.key),C.comment?C.comment+=`
131
+ `+P:C.comment=P,O.comment=O.comment.substring(P.length+1)}}if(!a&&!g&&!O.found){let P=b?e(n,b,O,r):t(n,O.end,g,null,O,r);c.items.push(P),u=P.range[2],Bf(b)&&r(P.range,"BLOCK_IN_FLOW",Zf)}else{n.atKey=!0;let P=O.end,C=R?e(n,R,O,r):t(n,P,S,null,O,r);Bf(R)&&r(C.range,"BLOCK_IN_FLOW",Zf),n.atKey=!1;let v=tE.resolveProps(g??[],{flow:s,indicator:"map-value-ind",next:b,offset:C.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(v.found){if(!a&&!O.found&&n.options.strict){if(g)for(let T of g){if(T===v.found)break;if(T.type==="newline"){r(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<v.found.offset-1024&&r(v.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else b&&("source"in b&&b.source?.[0]===":"?r(b,"MISSING_CHAR",`Missing space after : in ${s}`):r(v.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let A=b?e(n,b,v,r):v.found?t(n,v.end,g,null,v,r):null;A?Bf(b)&&r(A.range,"BLOCK_IN_FLOW",Zf):v.comment&&(C.comment?C.comment+=`
132
+ `+v.comment:C.comment=v.comment);let x=new SW.Pair(C,A);if(n.options.keepSourceTokens&&(x.srcToken=k),a){let T=c;AW.mapIncludes(n,T.items,C)&&r(P,"DUPLICATE_KEY","Map keys must be unique"),T.items.push(x)}else{let T=new eE.YAMLMap(n.schema);T.flow=!0,T.items.push(x);let N=(A??C).range;T.range=[C.range[0],N[1],N[2]],c.items.push(T)}u=A?A.range[2]:v.end}}let _=a?"}":"]",[p,...y]=i.end,f=u;if(p?.source===_)f=p.offset+p.source.length;else{let h=s[0].toUpperCase()+s.substring(1),k=d?`${h} must end with a ${_}`:`${h} in block collection must be sufficiently indented and end with a ${_}`;r(u,d?"MISSING_CHAR":"BAD_INDENT",k),p&&p.source.length!==1&&y.unshift(p)}if(y.length>0){let h=wW.resolveEnd(y,f,n.options.strict,r);h.comment&&(c.comment?c.comment+=`
133
+ `+h.comment:c.comment=h.comment),c.range=[i.offset,f,h.offset]}else c.range=[i.offset,f,f];return c}nE.resolveFlowCollection=TW});var oE=M(iE=>{"use strict";var xW=Ne(),OW=mt(),RW=di(),CW=_i(),$W=Gw(),IW=Yw(),NW=rE();function Hf(e,t,n,i,r,o){let a=n.type==="block-map"?$W.resolveBlockMap(e,t,n,i,o):n.type==="block-seq"?IW.resolveBlockSeq(e,t,n,i,o):NW.resolveFlowCollection(e,t,n,i,o),s=a.constructor;return r==="!"||r===s.tagName?(a.tag=s.tagName,a):(r&&(a.tag=r),a)}function PW(e,t,n,i,r){let o=i.tag,a=o?t.directives.tagName(o.source,_=>r(o,"TAG_RESOLVE_FAILED",_)):null;if(n.type==="block-seq"){let{anchor:_,newlineAfterProp:p}=i,y=_&&o?_.offset>o.offset?_:o:_??o;y&&(!p||p.offset<y.offset)&&r(y,"MISSING_CHAR","Missing newline after block sequence props")}let s=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!a||a==="!"||a===RW.YAMLMap.tagName&&s==="map"||a===CW.YAMLSeq.tagName&&s==="seq")return Hf(e,t,n,r,a);let l=t.schema.tags.find(_=>_.tag===a&&_.collection===s);if(!l){let _=t.schema.knownTags[a];if(_?.collection===s)t.schema.tags.push(Object.assign({},_,{default:!1})),l=_;else return _?r(o,"BAD_COLLECTION_TYPE",`${_.tag} used for ${s} collection, but expects ${_.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Hf(e,t,n,r,a)}let c=Hf(e,t,n,r,a,l),d=l.resolve?.(c,_=>r(o,"TAG_RESOLVE_FAILED",_),t.options)??c,u=xW.isNode(d)?d:new OW.Scalar(d);return u.range=c.range,u.tag=a,l?.format&&(u.format=l.format),u}iE.composeCollection=PW});var Kf=M(aE=>{"use strict";var Jf=mt();function MW(e,t,n){let i=t.offset,r=LW(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let o=r.mode===">"?Jf.Scalar.BLOCK_FOLDED:Jf.Scalar.BLOCK_LITERAL,a=t.source?jW(t.source):[],s=a.length;for(let f=a.length-1;f>=0;--f){let h=a[f][1];if(h===""||h==="\r")s=f;else break}if(s===0){let f=r.chomp==="+"&&a.length>0?`
134
+ `.repeat(Math.max(1,a.length-1)):"",h=i+r.length;return t.source&&(h+=t.source.length),{value:f,type:o,comment:r.comment,range:[i,h,h]}}let l=t.indent+r.indent,c=t.offset+r.length,d=0;for(let f=0;f<s;++f){let[h,k]=a[f];if(k===""||k==="\r")r.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&n(c+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=h.length),d=f,l===0&&!e.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=h.length+k.length+1}for(let f=a.length-1;f>=s;--f)a[f][0].length>l&&(s=f+1);let u="",_="",p=!1;for(let f=0;f<d;++f)u+=a[f][0].slice(l)+`
135
+ `;for(let f=d;f<s;++f){let[h,k]=a[f];c+=h.length+k.length+1;let S=k[k.length-1]==="\r";if(S&&(k=k.slice(0,-1)),k&&h.length<l){let g=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(c-k.length-(S?2:1),"BAD_INDENT",g),h=""}o===Jf.Scalar.BLOCK_LITERAL?(u+=_+h.slice(l)+k,_=`
136
+ `):h.length>l||k[0]===" "?(_===" "?_=`
137
+ `:!p&&_===`
138
+ `&&(_=`
139
+
140
+ `),u+=_+h.slice(l)+k,_=`
141
+ `,p=!0):k===""?_===`
142
+ `?u+=`
143
+ `:_=`
144
+ `:(u+=_+k,_=" ",p=!1)}switch(r.chomp){case"-":break;case"+":for(let f=s;f<a.length;++f)u+=`
145
+ `+a[f][0].slice(l);u[u.length-1]!==`
146
+ `&&(u+=`
147
+ `);break;default:u+=`
148
+ `}let y=i+r.length+t.source.length;return{value:u,type:o,comment:r.comment,range:[i,y,y]}}function LW({offset:e,props:t},n,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],o=r[0],a=0,s="",l=-1;for(let _=1;_<r.length;++_){let p=r[_];if(!s&&(p==="-"||p==="+"))s=p;else{let y=Number(p);!a&&y?a=y:l===-1&&(l=e+_)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,d="",u=r.length;for(let _=1;_<t.length;++_){let p=t[_];switch(p.type){case"space":c=!0;case"newline":u+=p.source.length;break;case"comment":n&&!c&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let y=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",y);let f=p.source;f&&typeof f=="string"&&(u+=f.length)}}}return{mode:o,indent:a,chomp:s,comment:d,length:u}}function jW(e){let t=e.split(/\n( *)/),n=t[0],i=n.match(/^( *)/),o=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let a=1;a<t.length;a+=2)o.push([t[a],t[a+1]]);return o}aE.resolveBlockScalar=MW});var Xf=M(cE=>{"use strict";var Gf=mt(),DW=qo();function UW(e,t,n){let{offset:i,type:r,source:o,end:a}=e,s,l,c=(_,p,y)=>n(i+_,p,y);switch(r){case"scalar":s=Gf.Scalar.PLAIN,l=zW(o,c);break;case"single-quoted-scalar":s=Gf.Scalar.QUOTE_SINGLE,l=FW(o,c);break;case"double-quoted-scalar":s=Gf.Scalar.QUOTE_DOUBLE,l=qW(o,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let d=i+o.length,u=DW.resolveEnd(a,d,t,n);return{value:l,type:s,comment:u.comment,range:[i,d,u.offset]}}function zW(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),sE(e)}function FW(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),sE(e.slice(1,-1)).replace(/''/g,"'")}function sE(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
149
+ `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
150
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let r=i[1],o=" ",a=t.lastIndex;for(n.lastIndex=a;i=n.exec(e);)i[1]===""?o===`
151
+ `?r+=o:o=`
152
+ `:(r+=o+i[1],o=" "),a=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=a,i=s.exec(e),r+o+(i?.[1]??"")}function qW(e,t){let n="";for(let i=1;i<e.length-1;++i){let r=e[i];if(!(r==="\r"&&e[i+1]===`
153
+ `))if(r===`
154
+ `){let{fold:o,offset:a}=VW(e,i);n+=o,i=a}else if(r==="\\"){let o=e[++i],a=WW[o];if(a)n+=a;else if(o===`
155
+ `)for(o=e[i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="\r"&&e[i+1]===`
156
+ `)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let s=o==="x"?2:o==="u"?4:8;n+=ZW(e,i+1,s,t),i+=s}else{let s=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),n+=s}}else if(r===" "||r===" "){let o=i,a=e[i+1];for(;a===" "||a===" ";)a=e[++i+1];a!==`
157
+ `&&!(a==="\r"&&e[i+2]===`
158
+ `)&&(n+=i>o?e.slice(o,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function VW(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===`
159
+ `||i==="\r")&&!(i==="\r"&&e[t+2]!==`
160
+ `);)i===`
161
+ `&&(n+=`
162
+ `),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}var WW={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
163
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ZW(e,t,n,i){let r=e.substr(t,n),a=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(a)}catch{let s=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}cE.resolveFlowScalar=UW});var dE=M(uE=>{"use strict";var Ui=Ne(),lE=mt(),BW=Kf(),HW=Xf();function JW(e,t,n,i){let{value:r,type:o,comment:a,range:s}=t.type==="block-scalar"?BW.resolveBlockScalar(e,t,i):HW.resolveFlowScalar(t,e.options.strict,i),l=n?e.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[Ui.SCALAR]:l?c=KW(e.schema,r,l,n,i):t.type==="scalar"?c=GW(e,r,t,i):c=e.schema[Ui.SCALAR];let d;try{let u=c.resolve(r,_=>i(n??t,"TAG_RESOLVE_FAILED",_),e.options);d=Ui.isScalar(u)?u:new lE.Scalar(u)}catch(u){let _=u instanceof Error?u.message:String(u);i(n??t,"TAG_RESOLVE_FAILED",_),d=new lE.Scalar(r)}return d.range=s,d.source=r,o&&(d.type=o),l&&(d.tag=l),c.format&&(d.format=c.format),a&&(d.comment=a),d}function KW(e,t,n,i,r){if(n==="!")return e[Ui.SCALAR];let o=[];for(let s of e.tags)if(!s.collection&&s.tag===n)if(s.default&&s.test)o.push(s);else return s;for(let s of o)if(s.test?.test(t))return s;let a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ui.SCALAR])}function GW({atKey:e,directives:t,schema:n},i,r,o){let a=n.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(i))||n[Ui.SCALAR];if(n.compat){let s=n.compat.find(l=>l.default&&l.test?.test(i))??n[Ui.SCALAR];if(a.tag!==s.tag){let l=t.tagString(a.tag),c=t.tagString(s.tag),d=`Value may be parsed as either ${l} or ${c}`;o(r,"TAG_RESOLVE_FAILED",d,!0)}}return a}uE.composeScalar=JW});var pE=M(_E=>{"use strict";function XW(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let r=t[i];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++i];r?.type==="space";)e+=r.source.length,r=t[++i];break}}return e}_E.emptyScalarPosition=XW});var gE=M(Qf=>{"use strict";var YW=Za(),QW=Ne(),eZ=oE(),fE=dE(),tZ=qo(),nZ=pE(),rZ={composeNode:mE,composeEmptyNode:Yf};function mE(e,t,n,i){let r=e.atKey,{spaceBefore:o,comment:a,anchor:s,tag:l}=n,c,d=!0;switch(t.type){case"alias":c=iZ(e,t,i),(s||l)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=fE.composeScalar(e,t,l,i),s&&(c.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=eZ.composeCollection(rZ,e,t,n,i),s&&(c.anchor=s.source.substring(1))}catch(u){let _=u instanceof Error?u.message:String(u);i(t,"RESOURCE_EXHAUSTION",_)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",u),d=!1}}return c??(c=Yf(e,t.offset,void 0,null,n,i)),s&&c.anchor===""&&i(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!QW.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?c.comment=a:c.commentBefore=a),e.options.keepSourceTokens&&d&&(c.srcToken=t),c}function Yf(e,t,n,i,{spaceBefore:r,comment:o,anchor:a,tag:s,end:l},c){let d={type:"scalar",offset:nZ.emptyScalarPosition(t,n,i),indent:-1,source:""},u=fE.composeScalar(e,d,s,c);return a&&(u.anchor=a.source.substring(1),u.anchor===""&&c(a,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=l),u}function iZ({options:e},{offset:t,source:n,end:i},r){let o=new YW.Alias(n.substring(1));o.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+n.length,s=tZ.resolveEnd(i,a,e.strict,r);return o.range=[t,a,s.offset],s.comment&&(o.comment=s.comment),o}Qf.composeEmptyNode=Yf;Qf.composeNode=mE});var vE=M(yE=>{"use strict";var oZ=ss(),hE=gE(),aZ=qo(),sZ=ds();function cZ(e,t,{offset:n,start:i,value:r,end:o},a){let s=Object.assign({_directives:t},e),l=new oZ.Document(void 0,s),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=sZ.resolveProps(i,{indicator:"doc-start",next:r??o?.[0],offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?hE.composeNode(c,r,d,a):hE.composeEmptyNode(c,d.end,i,null,d,a);let u=l.contents.range[2],_=aZ.resolveEnd(o,u,!1,a);return _.comment&&(l.comment=_.comment),l.range=[n,u,_.offset],l}yE.composeDoc=cZ});var tm=M(kE=>{"use strict";var lZ=require("process"),uZ=Up(),dZ=ss(),_s=us(),bE=Ne(),_Z=vE(),pZ=qo();function ps(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function SE(e){let t="",n=!1,i=!1;for(let r=0;r<e.length;++r){let o=e[r];switch(o[0]){case"#":t+=(t===""?"":i?`
164
+
165
+ `:`
166
+ `)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var em=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,o)=>{let a=ps(n);o?this.warnings.push(new _s.YAMLWarning(a,i,r)):this.errors.push(new _s.YAMLParseError(a,i,r))},this.directives=new uZ.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:i,afterEmptyLine:r}=SE(this.prelude);if(i){let o=t.contents;if(n)t.comment=t.comment?`${t.comment}
167
+ ${i}`:i;else if(r||t.directives.docStart||!o)t.commentBefore=i;else if(bE.isCollection(o)&&!o.flow&&o.items.length>0){let a=o.items[0];bE.isPair(a)&&(a=a.key);let s=a.commentBefore;a.commentBefore=s?`${i}
168
+ ${s}`:i}else{let a=o.commentBefore;o.commentBefore=a?`${i}
169
+ ${a}`:i}}if(n){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:SE(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,i=-1){for(let r of t)yield*this.next(r);yield*this.end(n,i)}*next(t){switch(lZ.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,i,r)=>{let o=ps(t);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",i,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=_Z.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new _s.YAMLParseError(ps(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new _s.YAMLParseError(ps(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=pZ.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
170
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new _s.YAMLParseError(ps(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),r=new dZ.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};kE.Composer=em});var AE=M(Fu=>{"use strict";var fZ=Kf(),mZ=Xf(),gZ=us(),wE=Ga();function hZ(e,t=!0,n){if(e){let i=(r,o,a)=>{let s=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(s,o,a);else throw new gZ.YAMLParseError([s,s+1],o,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return mZ.resolveFlowScalar(e,t,i);case"block-scalar":return fZ.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function yZ(e,t){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:a="PLAIN"}=t,s=wE.stringifyString({type:a,value:e},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:i,source:`
171
+ `}];switch(s[0]){case"|":case">":{let c=s.indexOf(`
172
+ `),d=s.substring(0,c),u=s.substring(c+1)+`
173
+ `,_=[{type:"block-scalar-header",offset:o,indent:i,source:d}];return EE(_,l)||_.push({type:"newline",offset:-1,indent:i,source:`
174
+ `}),{type:"block-scalar",offset:o,indent:i,props:_,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:s,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:s,end:l};default:return{type:"scalar",offset:o,indent:i,source:s,end:l}}}function vZ(e,t,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:o=!1,type:a}=n,s="indent"in e?e.indent:null;if(i&&typeof s=="number"&&(s+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let l=wE.stringifyString({type:a,value:t},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":bZ(e,l);break;case'"':nm(e,l,"double-quoted-scalar");break;case"'":nm(e,l,"single-quoted-scalar");break;default:nm(e,l,"scalar")}}function bZ(e,t){let n=t.indexOf(`
175
+ `),i=t.substring(0,n),r=t.substring(n+1)+`
176
+ `;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=r}else{let{offset:o}=e,a="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:o,indent:a,source:i}];EE(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:a,source:`
177
+ `});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:a,props:s,source:r})}}function EE(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function nm(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let o of i)o.offset+=r;delete e.props,Object.assign(e,{type:n,source:t,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
178
+ `};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let i="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:n,indent:i,source:t,end:r})}}}Fu.createScalarToken=yZ;Fu.resolveAsScalar=hZ;Fu.setScalarValue=vZ});var xE=M(TE=>{"use strict";var SZ=e=>"type"in e?Vu(e):qu(e);function Vu(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Vu(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=qu(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=qu(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=qu(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function qu({start:e,key:t,sep:n,value:i}){let r="";for(let o of e)r+=o.source;if(t&&(r+=Vu(t)),n)for(let o of n)r+=o.source;return i&&(r+=Vu(i)),r}TE.stringify=SZ});var $E=M(CE=>{"use strict";var rm=Symbol("break visit"),kZ=Symbol("skip children"),OE=Symbol("remove item");function zi(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),RE(Object.freeze([]),e,t)}zi.BREAK=rm;zi.SKIP=kZ;zi.REMOVE=OE;zi.itemAtPath=(e,t)=>{let n=e;for(let[i,r]of t){let o=n?.[i];if(o&&"items"in o)n=o.items[r];else return}return n};zi.parentCollection=(e,t)=>{let n=zi.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function RE(e,t,n){let i=n(t,e);if(typeof i=="symbol")return i;for(let r of["key","value"]){let o=t[r];if(o&&"items"in o){for(let a=0;a<o.items.length;++a){let s=RE(Object.freeze(e.concat([[r,a]])),o.items[a],n);if(typeof s=="number")a=s-1;else{if(s===rm)return rm;s===OE&&(o.items.splice(a,1),a-=1)}}typeof i=="function"&&r==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}CE.visit=zi});var Wu=M(Bt=>{"use strict";var im=AE(),wZ=xE(),EZ=$E(),om="\uFEFF",am="",sm="",cm="",AZ=e=>!!e&&"items"in e,TZ=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function xZ(e){switch(e){case om:return"<BOM>";case am:return"<DOC>";case sm:return"<FLOW_END>";case cm:return"<SCALAR>";default:return JSON.stringify(e)}}function OZ(e){switch(e){case om:return"byte-order-mark";case am:return"doc-mode";case sm:return"flow-error-end";case cm:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
179
+ `:case`\r
180
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Bt.createScalarToken=im.createScalarToken;Bt.resolveAsScalar=im.resolveAsScalar;Bt.setScalarValue=im.setScalarValue;Bt.stringify=wZ.stringify;Bt.visit=EZ.visit;Bt.BOM=om;Bt.DOCUMENT=am;Bt.FLOW_END=sm;Bt.SCALAR=cm;Bt.isCollection=AZ;Bt.isScalar=TZ;Bt.prettyToken=xZ;Bt.tokenType=OZ});var dm=M(NE=>{"use strict";var fs=Wu();function mn(e){switch(e){case void 0:case" ":case`
181
+ `:case"\r":case" ":return!0;default:return!1}}var IE=new Set("0123456789ABCDEFabcdef"),RZ=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Zu=new Set(",[]{}"),CZ=new Set(` ,[]{}
182
+ \r `),lm=e=>!e||CZ.has(e),um=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
183
+ `?!0:n==="\r"?this.buffer[t+1]===`
184
+ `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+t];if(n==="\r"){let r=this.buffer[i+t+1];if(r===`
185
+ `||!r&&!this.atEnd)return t+i+1}return n===`
186
+ `||i>=this.indentNext||!n&&!this.atEnd?t+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&mn(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
187
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===fs.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){n=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield fs.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&mn(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!mn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&mn(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(lm),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,i=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&mn(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield fs.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(lm),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||mn(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
188
+ `,this.pos);if(r!==-1){for(;r!==-1;){let o=this.continueScalar(r+1);if(o===-1)break;r=i.indexOf(`
189
+ `,o)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>mn(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){case" ":n+=1;break;case`
190
+ `:t=o,n=0;break;case"\r":{let a=this.buffer[o+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
191
+ `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(t+1);if(o===-1)break;t=this.buffer.indexOf(`
192
+ `,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
193
+ `;)i=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let o=t-1,a=this.buffer[o];a==="\r"&&(a=this.buffer[--o]);let s=o;for(;a===" ";)a=this.buffer[--o];if(a===`
194
+ `&&o>=this.pos&&o+1+n>s)t=o;else break}while(!0);return yield fs.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let o=this.buffer[i+1];if(mn(o)||t&&Zu.has(o))break;n=i}else if(mn(r)){let o=this.buffer[i+1];if(r==="\r"&&(o===`
195
+ `?(i+=1,r=`
196
+ `,o=this.buffer[i+1]):n=i),o==="#"||t&&Zu.has(o))break;if(r===`
197
+ `){let a=this.continueScalar(i+1);if(a===-1)break;i=Math.max(i,a-2)}}else{if(t&&Zu.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield fs.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(lm),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(mn(i)||n&&Zu.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!mn(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(RZ.has(n))n=this.buffer[++t];else if(n==="%"&&IE.has(this.buffer[t+1])&&IE.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
198
+ `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
199
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};NE.Lexer=um});var pm=M(PE=>{"use strict";var _m=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=this.lineStarts.length;for(;n<i;){let o=n+i>>1;this.lineStarts[o]<t?n=o+1:i=o}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}};PE.LineCounter=_m});var mm=M(UE=>{"use strict";var $Z=require("process"),ME=Wu(),IZ=dm();function pi(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function LE(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function DE(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Bu(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Vo(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Hu(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function jE(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!pi(t.start,"explicit-key-ind")&&!pi(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,DE(t.value)?t.value.end?Hu(t.value.end,t.sep):t.value.end=t.sep:Hu(t.start,t.sep),delete t.sep)}var fm=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new IZ.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,n))yield*this.next(i);n||(yield*this.end())}*next(t){if(this.source=t,$Z.env.LOG_TOKENS&&console.log("|",ME.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=ME.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&jE(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&LE(r.start)===-1&&(n.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{LE(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Bu(this.peek(2)),i=Vo(n),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
200
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
201
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Hu(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&n.sep&&!n.value){let a=[];for(let s=0;s<n.sep.length;++s){let l=n.sep[s];switch(l.type){case"newline":a.push(s);break;case"space":break;case"comment":l.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(o=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(pi(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(DE(n.key)&&!pi(n.sep,"newline")){let a=Vo(n.start),s=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:s,sep:l}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(pi(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=Vo(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:o,key:null,sep:[this.sourceToken]}):pi(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);r||n.value?(t.items.push({start:o,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!pi(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:o});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Hu(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||pi(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=Bu(i),o=Vo(r);jE(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
202
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
203
+ `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Bu(t),i=Vo(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Bu(t),i=Vo(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};UE.Parser=fm});var WE=M(gs=>{"use strict";var zE=tm(),NZ=ss(),ms=us(),PZ=Yp(),MZ=Ne(),LZ=pm(),FE=mm();function qE(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new LZ.LineCounter||null,prettyErrors:t}}function jZ(e,t={}){let{lineCounter:n,prettyErrors:i}=qE(t),r=new FE.Parser(n?.addNewLine),o=new zE.Composer(t),a=Array.from(o.compose(r.parse(e)));if(i&&n)for(let s of a)s.errors.forEach(ms.prettifyError(e,n)),s.warnings.forEach(ms.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},o.streamInfo())}function VE(e,t={}){let{lineCounter:n,prettyErrors:i}=qE(t),r=new FE.Parser(n?.addNewLine),o=new zE.Composer(t),a=null;for(let s of o.compose(r.parse(e),!0,e.length))if(!a)a=s;else if(a.options.logLevel!=="silent"){a.errors.push(new ms.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(a.errors.forEach(ms.prettifyError(e,n)),a.warnings.forEach(ms.prettifyError(e,n))),a}function DZ(e,t,n){let i;typeof t=="function"?i=t:n===void 0&&t&&typeof t=="object"&&(n=t);let r=VE(e,n);if(!r)return null;if(r.warnings.forEach(o=>PZ.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function UZ(e,t,n){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}return MZ.isDocument(e)&&!i?e.toString(n):new NZ.Document(e,i,n).toString(n)}gs.parse=DZ;gs.parseAllDocuments=jZ;gs.parseDocument=VE;gs.stringify=UZ});var hm=M(qe=>{"use strict";var zZ=tm(),FZ=ss(),qZ=Mf(),gm=us(),VZ=Za(),fi=Ne(),WZ=li(),ZZ=mt(),BZ=di(),HZ=_i(),JZ=Wu(),KZ=dm(),GZ=pm(),XZ=mm(),Ju=WE(),ZE=Fa();qe.Composer=zZ.Composer;qe.Document=FZ.Document;qe.Schema=qZ.Schema;qe.YAMLError=gm.YAMLError;qe.YAMLParseError=gm.YAMLParseError;qe.YAMLWarning=gm.YAMLWarning;qe.Alias=VZ.Alias;qe.isAlias=fi.isAlias;qe.isCollection=fi.isCollection;qe.isDocument=fi.isDocument;qe.isMap=fi.isMap;qe.isNode=fi.isNode;qe.isPair=fi.isPair;qe.isScalar=fi.isScalar;qe.isSeq=fi.isSeq;qe.Pair=WZ.Pair;qe.Scalar=ZZ.Scalar;qe.YAMLMap=BZ.YAMLMap;qe.YAMLSeq=HZ.YAMLSeq;qe.CST=JZ;qe.Lexer=KZ.Lexer;qe.LineCounter=GZ.LineCounter;qe.Parser=XZ.Parser;qe.parse=Ju.parse;qe.parseAllDocuments=Ju.parseAllDocuments;qe.parseDocument=Ju.parseDocument;qe.stringify=Ju.stringify;qe.visit=ZE.visit;qe.visitAsync=ZE.visitAsync});function yt(e){let t=(0,Ku.parseDocument)(e,{strict:!0,uniqueKeys:!0});if(t.errors.length>0)throw new ym(t.errors.map(n=>n.message).join("; "));return t.toJS({maxAliasCount:YZ})}function Fr(e){return(0,Ku.stringify)(e,{lineWidth:0,aliasDuplicateObjects:!1})}var Ku,YZ,ym,hs=L(()=>{"use strict";Ku=Be(hm(),1),YZ=10,ym=class extends Error{name="YamlContractError"}});function e6(e){return e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||e.endsWith("/")||/^[A-Za-z]:/.test(e)?!1:e.split("/").every(t=>t.length>0&&t!=="."&&t!=="..")}function BE(e){return Z.z.record(Z.z.string().min(1),e).superRefine((t,n)=>{for(let i of Object.keys(t))e6(i)||n.addIssue({code:"custom",path:[i],message:"Managed file path must be canonical and workspace-relative"})})}function qr(e){let t=HE.parse(e),n=t.zaip?.enabled??t["zaip-aios"]?.enabled,{"zaip-aios":i,...r}=t;return n===void 0?r:{...r,zaip:{enabled:n}}}function i6(e){let t=Z.z.union([KE,Xu]).parse(e);return t.lock_version===2?t:Xu.parse({...t,lock_version:2,managed_files:Object.fromEntries(Object.entries(t.managed_files).map(([n,i])=>[n,i.sha256]))})}var Z,gn,ed,Gu,QZ,t6,n6,r6,HE,JE,KE,Xu,yY,vY,Yu,Qu,vm=L(()=>{"use strict";Z=Be(Xe(),1);Io();hs();gn=".agents/config/project.yaml",ed=".agents/config/framework.lock.yaml",Gu=Z.z.string().regex(/^[a-f0-9]{64}$/i,"Expected a SHA-256 checksum"),QZ=Z.z.string().min(1).superRefine((e,t)=>{try{new Intl.DateTimeFormat("en",{timeZone:e}).format()}catch{t.addIssue({code:"custom",message:"Expected a valid IANA timezone"})}});t6=Z.z.object({sha256:Gu}).strict();n6=BE(t6),r6=BE(Gu),HE=Z.z.object({schema_version:Z.z.literal(1),zaip:Z.z.object({enabled:Z.z.boolean()}).strict().optional(),"zaip-aios":Z.z.object({enabled:Z.z.boolean()}).strict().optional(),project:Z.z.object({id:Z.z.string().min(1),name:Z.z.string().min(1),timezone:QZ}).strict(),stack:Z.z.object({id:Z.z.string().min(1),language:Z.z.string().min(1).optional(),api:Z.z.string().min(1).optional(),query_builder:Z.z.string().min(1).optional(),extensions:Z.z.array(Z.z.string().min(1)).min(1).optional(),layout:Z.z.object({frontend:Z.z.string().min(1),backend:Z.z.string().min(1),site:Z.z.string().min(1),modules:Z.z.string().min(1),packages:Z.z.string().min(1),e2e:Z.z.string().min(1)}).strict().optional(),source_limits:Z.z.object({warning_lines:Z.z.number().int().positive(),error_lines:Z.z.number().int().positive()}).strict().optional(),invariants:Z.z.array(Z.z.string().min(1)).min(1).optional(),commands:Z.z.object({test:Z.z.string().min(1),typecheck:Z.z.string().min(1)}).strict().optional(),overrides:Z.z.record(Z.z.string(),Z.z.unknown())}).strict(),clients:Z.z.object({codex:Z.z.boolean(),claude:Z.z.boolean()}).strict(),tracking:Z.z.object({enabled:Z.z.boolean(),currency:Z.z.string().regex(/^[A-Z]{3}$/,"Expected an ISO 4217 currency code"),storage_mode:Z.z.enum(["tracked_sanitized","local_only"])}).strict(),model_orchestration:Z.z.discriminatedUnion("mode",[Z.z.object({mode:Z.z.literal("manual"),default_model:Z.z.literal("manual"),default_effort:Z.z.literal("manual"),default_velocity:Z.z.literal("manual"),notice:Z.z.enum(["always","mismatch"])}).strict(),Z.z.object({mode:Z.z.literal("off"),default_model:Z.z.string().min(1),default_effort:Z.z.string().min(1),default_velocity:Z.z.string().min(1),notice:Z.z.enum(["always","mismatch"])}).strict(),rk]).optional(),execution:Z.z.discriminatedUnion("runtime",[Z.z.object({runtime:Z.z.literal("manual")}).strict(),Z.z.object({runtime:Z.z.literal("autonomous"),autonomous:Z.z.object({provider:Z.z.enum(["codex","claude"]),model:Z.z.string().min(1),max_parallelism:Z.z.number().int().min(1).max(8),lease_ms:Z.z.number().int().min(5e3).max(36e5),max_phase_attempts:Z.z.number().int().positive().nullable().optional(),max_total_invocations:Z.z.number().int().positive().nullable().optional()}).strict()}).strict()]).optional(),assurance:Z.z.object({version:Z.z.literal(1),standard_depth:Z.z.enum(["auto","base","elevated"]),require_final_commit:Z.z.boolean()}).strict().optional(),context:Z.z.object({canonical_roots:Z.z.array(Z.z.string().min(1)).min(1),projection_roots:Z.z.array(Z.z.string().min(1))}).strict().optional()}).strict().superRefine((e,t)=>{let n=e.zaip?.enabled,i=e["zaip-aios"]?.enabled;n!==void 0&&i!==void 0&&n!==i&&t.addIssue({code:"custom",path:["zaip","enabled"],message:"Conflicting ZAIP activation keys: zaip.enabled and legacy zaip-aios.enabled must agree"})}),JE={framework:Z.z.object({version:Z.z.string().min(1),distribution_sha256:Gu.nullable()}).strict(),layout:Z.z.object({version:Z.z.union([Z.z.literal(2),Z.z.literal(3)])}).strict(),resolved_profile:Z.z.object({id:Z.z.string().min(1).nullable(),sha256:Gu.nullable()}).strict()},KE=Z.z.object({lock_version:Z.z.literal(1),...JE,managed_files:n6}).strict(),Xu=Z.z.object({lock_version:Z.z.literal(2),...JE,managed_files:r6}).strict(),yY=Z.z.toJSONSchema(HE),vY=Z.z.toJSONSchema(Z.z.union([KE,Xu]));Yu=class{constructor(t,n=gn){this.filesystem=t;this.path=n}filesystem;path;async read(){return qr(yt(await this.filesystem.readText(this.path)))}async write(t){await this.filesystem.writeTextAtomic(this.path,Fr(qr(t)))}},Qu=class{constructor(t,n=ed){this.filesystem=t;this.path=n}filesystem;path;async read(){return i6(yt(await this.filesystem.readText(this.path)))}async write(t){await this.filesystem.writeTextAtomic(this.path,Fr(Xu.parse(t)))}}});function bm(e){let t=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/([a-z\d])([A-Z])/g,"$1-$2").toUpperCase().replace(/[^A-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-").slice(0,48).replace(/-+$/g,"");if(t.length===0)throw new TypeError("shortName must contain at least one letter or number");return t}function Fi(e=4){if(!Number.isSafeInteger(e)||e<2||e>16)throw new RangeError("collision code length must be between 2 and 16");let t=(0,XE.randomBytes)(e);return Array.from(t,n=>GE[n%GE.length]).join("")}function qi(e,t,n={}){let i=n.clock??new Qe,r=n.timeZone??"America/Sao_Paulo",o=(n.collisionCode??Fi()).toUpperCase();if(!/^[A-Z2-9]{2,16}$/.test(o))throw new TypeError("collisionCode must contain 2-16 unambiguous uppercase characters");let a=new Intl.DateTimeFormat("en-CA",{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(i.now()),s=l=>{let c=a.find(d=>d.type===l)?.value;if(c===void 0)throw new Error(`Unable to format ID date part: ${l}`);return c};return[e,s("year"),s("month"),s("day"),s("hour"),s("minute"),bm(t),o].join("-")}var XE,GE,Sm=L(()=>{"use strict";XE=require("node:crypto");Np();GE="23456789ABCDEFGHJKLMNPQRSTUVWXYZ"});function o6(e){return He.posix.isAbsolute(e)||He.win32.isAbsolute(e)||/^[A-Za-z]:/.test(e)}function a6(e){return e.split(/[\\/]+/).some(t=>t==="..")}function ys(e){return e instanceof Error&&"code"in e}async function s6(e,t){if(process.platform!=="win32"){await(0,$e.rename)(e,t);return}for(let n=0;n<5;n+=1)try{await(0,$e.rm)(t,{force:!0}),await(0,$e.rename)(e,t);return}catch(i){if(!c6(i)||n===4)throw i;await l6(25*(n+1))}}function c6(e){return ys(e)&&["EPERM","EBUSY","EACCES"].includes(e.code??"")}async function l6(e){await new Promise(t=>setTimeout(t,e))}var $e,He,Vr,mi,YE=L(()=>{"use strict";$e=require("node:fs/promises"),He=require("node:path");Sm();Vr=class extends Error{name="WorkspacePathError"},mi=class{root;appendQueues=new Map;constructor(t){this.root=(0,He.resolve)(t)}resolve(t){if(o6(t)||a6(t))throw new Vr("Expected a path relative to the workspace root");let n=(0,He.resolve)(this.root,t),i=(0,He.relative)(this.root,n);if(i===".."||i.startsWith(`..${He.sep}`)||(0,He.isAbsolute)(i))throw new Vr(`Path escapes workspace root: ${t}`);return n}async exists(t){try{let n=this.resolve(t);return await this.assertPhysicalContainment(n),await(0,$e.stat)(n),!0}catch(n){if(ys(n)&&n.code==="ENOENT")return!1;throw n}}async readText(t){let n=this.resolve(t);return await this.assertPhysicalContainment(n),(0,$e.readFile)(n,"utf8")}async readBytes(t){let n=this.resolve(t);return await this.assertPhysicalContainment(n),(0,$e.readFile)(n)}async readTextFrom(t,n){if(!Number.isSafeInteger(n)||n<0)throw new RangeError("Expected a non-negative byte offset");let i=this.resolve(t);await this.assertPhysicalContainment(i);let r=await(0,$e.open)(i,"r");try{let o=await r.stat(),a=Math.min(n,o.size),s=Buffer.allocUnsafe(o.size-a);return s.byteLength>0&&await r.read(s,0,s.byteLength,a),{content:s.toString("utf8"),nextOffset:o.size}}finally{await r.close()}}async listFiles(t,n=""){let i=this.resolve(t);return await this.assertPhysicalContainment(i),await this.exists(t)?(await(0,$e.readdir)(i,{recursive:!0,withFileTypes:!0})).filter(o=>o.isFile()).map(o=>(0,He.relative)(this.root,(0,He.resolve)(o.parentPath,o.name)).replace(/\\/g,"/")).filter(o=>o.endsWith(n)).sort():[]}async listDirectories(t){let n=this.resolve(t);return await this.assertPhysicalContainment(n),await this.exists(t)?(await(0,$e.readdir)(n,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>(0,He.relative)(this.root,(0,He.resolve)(n,r.name)).replace(/\\/g,"/")).sort():[]}async writeTextAtomic(t,n){let i=this.resolve(t),r=`${i}.${Fi(6)}.tmp`;await this.assertPhysicalContainment(i),await(0,$e.mkdir)((0,He.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i);try{await(0,$e.writeFile)(r,n,{encoding:"utf8",flag:"wx"}),await s6(r,i)}finally{await(0,$e.rm)(r,{force:!0})}}async appendText(t,n){let i=this.resolve(t),o=(this.appendQueues.get(i)??Promise.resolve()).catch(()=>{}).then(async()=>{await this.assertPhysicalContainment(i),await(0,$e.mkdir)((0,He.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i),await(0,$e.appendFile)(i,n,{encoding:"utf8",flush:!0})});this.appendQueues.set(i,o);try{await o}finally{this.appendQueues.get(i)===o&&this.appendQueues.delete(i)}}async writeTextExclusive(t,n){let i=this.resolve(t);await this.assertPhysicalContainment(i),await(0,$e.mkdir)((0,He.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i),await(0,$e.writeFile)(i,n,{encoding:"utf8",flag:"wx",flush:!0})}async writeTextAtomicExclusive(t,n){let i=this.resolve(t),r=`${i}.${Fi(6)}.tmp`;await this.assertPhysicalContainment(i),await(0,$e.mkdir)((0,He.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i);try{await(0,$e.writeFile)(r,n,{encoding:"utf8",flag:"wx",flush:!0}),await(0,$e.link)(r,i)}finally{await(0,$e.rm)(r,{force:!0})}}async removeFile(t){let n=this.resolve(t);await this.assertPhysicalContainment(n),await(0,$e.rm)(n,{force:!0})}async removeFileIfContentMatches(t,n){let i=`${t}.${Fi(16)}.compare-delete`;try{await this.moveFileAtomic(t,i)}catch(s){if(ys(s)&&s.code==="ENOENT")return!1;throw s}if(await this.readText(i)===n)return await this.removeFile(i),!0;let o=this.resolve(i),a=this.resolve(t);try{await(0,$e.link)(o,a),await this.removeFile(i)}catch(s){throw ys(s)&&s.code==="EEXIST"?new Vr(`Conditional delete observed a replacement; captured file retained at ${i}`):s}return!1}async collectCompareDeleteTombstones(t){let n=[];for(let i of await this.listFiles(t)){let r=/^(.*)\.[A-Z0-9]{16}\.compare-delete$/.exec(i);if(r===null)continue;let o=r[1];o!==void 0&&await this.exists(o)&&(await this.removeFile(i),n.push(i))}return n}async moveFileAtomic(t,n){let i=this.resolve(t),r=this.resolve(n);await this.assertPhysicalContainment(i),await this.assertPhysicalContainment(r),await(0,$e.mkdir)((0,He.dirname)(r),{recursive:!0}),await this.assertPhysicalContainment(r),await(0,$e.rename)(i,r)}async assertPhysicalContainment(t){let n=await(0,$e.realpath)(this.root),i=t,r=null;for(;;)try{i=await(0,$e.realpath)(i);break}catch(a){if(!ys(a)||a.code!=="ENOENT")throw a;if(r=a,i===this.root)throw new Vr(`Cannot resolve workspace root for: ${t}`,{cause:r});let s=(0,He.dirname)(i);if(s===i)throw new Vr(`Cannot resolve workspace ancestor for: ${t}`,{cause:r});i=s}let o=(0,He.relative)(n,i);if(o===".."||o.startsWith(`..${He.sep}`)||(0,He.isAbsolute)(o))throw new Vr(`Physical path escapes workspace root: ${t}`)}}});var QE,eA,AY,tA=L(()=>{"use strict";QE=require("node:child_process"),eA=require("node:util"),AY=(0,eA.promisify)(QE.execFile)});function $t(e,t){let n=e.replace(/^\uFEFF/,"").replace(/\r\n/g,`
204
+ `);if(!n.startsWith(`${td}
205
+ `))throw new Wo("Markdown document must begin with YAML frontmatter");let i=n.indexOf(`
206
+ ${td}
207
+ `,4);if(i===-1)throw new Wo("Markdown frontmatter is not closed");let r=n.slice(4,i),o=(0,nd.parseDocument)(r,{strict:!0,uniqueKeys:!0});if(o.errors.length>0)throw new Wo(`Invalid YAML frontmatter: ${o.errors.map(s=>s.message).join("; ")}`);let a=t.safeParse(o.toJS({maxAliasCount:u6}));if(!a.success)throw new Wo(`Invalid metadata: ${a.error.message}`);return{metadata:a.data,body:n.slice(i+5).replace(/^\n/,"").replace(/\s+$/g,"")}}function cn(e){let t=(0,nd.stringify)(e.metadata,{lineWidth:0,aliasDuplicateObjects:!1}).trimEnd(),n=e.body.trim();return`${td}
208
+ ${t}
209
+ ${td}
210
+
211
+ ${n}
212
+ `}var nd,td,u6,Wo,km=L(()=>{"use strict";nd=Be(hm(),1),td="---",u6=10,Wo=class extends Error{name="MarkdownContractError"}});var vt,RY,CY,nA=L(()=>{"use strict";vt=Be(Xe(),1);km();RY=vt.z.object({id:vt.z.string().regex(/^RULE-[A-Z0-9-]+$/),load:vt.z.enum(["always","auto","file_match","manual"]),globs:vt.z.array(vt.z.string().min(1)).default([]),priority:vt.z.enum(["critical","high","medium","low"]),max_context_tokens:vt.z.number().int().positive(),requires:vt.z.array(vt.z.string().regex(/^RULE-[A-Z0-9-]+$/))}).strict().superRefine((e,t)=>{e.load==="file_match"&&e.globs.length===0&&t.addIssue({code:"custom",path:["globs"],message:"file_match Rules require at least one glob"})}),CY=vt.z.object({schema_version:vt.z.literal(2),id:vt.z.string().regex(/^REQUIREMENTS-[A-Z0-9-]+$/),area:vt.z.string().regex(/^[a-z][a-z0-9-]*$/),title:vt.z.string().min(1),status:vt.z.enum(["proposed","active","deprecated"]),version:vt.z.number().int().positive(),source_change:vt.z.string().min(1).nullable(),source_release:vt.z.string().regex(/^\d+\.\d+\.\d+$/).optional()}).strict().superRefine((e,t)=>{e.source_change===null&&e.source_release===void 0&&t.addIssue({code:"custom",path:["source_release"],message:"released Requirements require source_release when source_change is null"}),e.source_change!==null&&e.source_release!==void 0&&t.addIssue({code:"custom",path:["source_release"],message:"source_release is only valid when source_change is null"})})});var ge,d6,_6,p6,NY,PY,rA,f6,m6,g6,h6,y6,rd,MY,LY,iA=L(()=>{"use strict";ge=Be(Xe(),1);hs();d6=["codex_host_native","provider_subprocess"],_6=["frontier","balanced","fast_scan","review"],p6=["subagents","worktrees","sandbox","approvals","skills","mcp"],NY=ge.z.enum(d6),PY=ge.z.enum(_6),rA=ge.z.enum(p6),f6=ge.z.array(rA).min(1).refine(e=>new Set(e).size===e.length,{message:"native_surfaces must be unique"}),m6=ge.z.object({locator:ge.z.string().min(1),candidate_sha256:ge.z.string().regex(/^[a-f0-9]{64}$/)}).strict(),g6=ge.z.object({capability_id:ge.z.string().regex(/^CAP-[A-Z0-9-]+$/),current_state:ge.z.literal("implemented"),previous_states:ge.z.tuple([ge.z.literal("declared")]),evidence:ge.z.array(m6).length(0)}).strict(),h6=ge.z.object({tier:ge.z.literal(1),enabled:ge.z.literal(!0),optional:ge.z.literal(!1),invokes_provider_subprocess:ge.z.literal(!1),authority:ge.z.literal("host"),native_surfaces:f6,capability_bindings:ge.z.record(rA,g6)}).strict().superRefine((e,t)=>{let n=Object.keys(e.capability_bindings).sort(),i=[...e.native_surfaces].sort();JSON.stringify(n)!==JSON.stringify(i)&&t.addIssue({code:"custom",path:["capability_bindings"],message:"every native surface requires exactly one conformance/maturity binding"})}),y6=ge.z.object({tier:ge.z.union([ge.z.literal(2),ge.z.literal(3)]),enabled:ge.z.boolean(),optional:ge.z.literal(!0),invokes_provider_subprocess:ge.z.literal(!0),authority:ge.z.literal("framework"),native_surfaces:ge.z.array(ge.z.never()).length(0),opt_in:ge.z.object({required:ge.z.literal(!0),allowed_sources:ge.z.array(ge.z.enum(["project_config","human_decision"])).min(1).refine(e=>new Set(e).size===e.length,{message:"opt-in sources must be unique"})}).strict()}).strict(),rd=ge.z.object({selection:ge.z.enum(["host_available","inherit_host"]),reasoning:ge.z.enum(["low","medium","high"]),intent:ge.z.string().min(1)}).strict(),MY=ge.z.object({schema_version:ge.z.literal(1),host_id:ge.z.literal("codex"),candidate_sha256:ge.z.null(),default_mode:ge.z.literal("codex_host_native"),modes:ge.z.object({codex_host_native:h6,provider_subprocess:y6}).strict(),model_classes:ge.z.object({frontier:rd,balanced:rd,fast_scan:rd,review:rd}).strict()}).strict(),LY=ge.z.object({enabled:ge.z.literal(!0),source:ge.z.enum(["project_config","human_decision"]),provenance:ge.z.object({reference:ge.z.string().min(1),recorded_at:ge.z.string().datetime({offset:!0})}).strict()}).strict()});var oA=L(()=>{"use strict";iA()});function wm(e,t){return`${v6}/${e}/${t}.json`}var v6,aA=L(()=>{"use strict";v6=".local/claims"});function b6(e){return Em.parse(e)}var nt,Em,qY,id,Am=L(()=>{"use strict";nt=Be(Xe(),1);hs();Em=nt.z.object({schema_version:nt.z.literal(1),project:nt.z.object({id:nt.z.string().min(1),name:nt.z.string().min(1),timezone:nt.z.string().min(1).default("America/Sao_Paulo")}),framework:nt.z.object({version:nt.z.string().min(1)}),layout:nt.z.object({version:nt.z.literal(1),managed_namespace:nt.z.string().min(1).default(".agents/managed"),project_namespace:nt.z.string().min(1).default(".agents/project")}).default({version:1,managed_namespace:".agents/managed",project_namespace:".agents/project"}),profile:nt.z.object({id:nt.z.string().min(1).default("zaip-aios-stack")}),paths:nt.z.object({specs:nt.z.string().min(1).default(".agents/specs"),changes:nt.z.string().min(1).default(".agents/changes"),tasks:nt.z.string().min(1).default(".agents/tasks"),decisions:nt.z.string().min(1).default(".agents/decisions"),runs:nt.z.string().min(1).default(".agents/runs")}).default({specs:".agents/specs",changes:".agents/changes",tasks:".agents/tasks",decisions:".agents/decisions",runs:".agents/runs"}),agents:nt.z.array(nt.z.enum(["codex","claude"])).default(["codex","claude"])}).strict(),qY=nt.z.toJSONSchema(Em);id=class{constructor(t,n=".agents/manifest.yaml"){this.filesystem=t;this.path=n}filesystem;path;async read(){return b6(yt(await this.filesystem.readText(this.path)))}async write(t){await this.filesystem.writeTextAtomic(this.path,Fr(Em.parse(t)))}}});function vs(e){let t=e.match(/^([A-Z]+(?:-[A-Z]+)*)-(\d{4})-(\d{2})-(\d{2})-\d{2}-\d{2}-/);if(t?.[1]===void 0||t[2]===void 0||t[3]===void 0||t[4]===void 0)throw new TypeError(`ID does not contain the canonical date: ${e}`);let[,n,i,r,o]=t,a=new Date(`${i}-${r}-${o}T00:00:00.000Z`);if(Number.isNaN(a.getTime())||String(a.getUTCFullYear()).padStart(4,"0")!==i||String(a.getUTCMonth()+1).padStart(2,"0")!==r||String(a.getUTCDate()).padStart(2,"0")!==o)throw new TypeError(`ID contains an invalid canonical date: ${e}`);return{prefix:n,year:i,month:r,day:o}}function Vi(e){let{year:t,month:n}=vs(e);return{year:t,month:n}}function bs(e,t){let{year:n,month:i}=Vi(t);return`${e}/${n}/${i}/${t}.md`}function sA(e,t){let{year:n,month:i}=Vi(t);return`${e}/${n}/${i}`}function Tm(e,t){let{year:n,month:i,day:r}=vs(t);return`${e}/${n}/${i}/${r}`}var xm=L(()=>{"use strict"});var cA=L(()=>{"use strict"});var lA=L(()=>{"use strict";cA()});var uA=L(()=>{"use strict"});var dA=L(()=>{"use strict";uA()});var _A=L(()=>{"use strict"});var Om,S6,pA=L(()=>{"use strict";Om=class{#e;constructor(t){let n=new Map;for(let i of t){let r=n.get(i.from)??new Set;r.add(i.to),n.set(i.from,r)}this.#e=n}canTransition(t,n){return this.#e.get(t)?.has(n)??!1}assertTransition(t,n){if(!this.canTransition(t,n))throw new Error(`Invalid state transition: ${t} -> ${n}`)}nextStates(t){return[...this.#e.get(t)??[]]}},S6=new Om([{from:"draft",to:"planned"},{from:"draft",to:"cancelled"},{from:"planned",to:"executing"},{from:"planned",to:"cancelled"},{from:"executing",to:"verifying"},{from:"executing",to:"blocked"},{from:"executing",to:"cancelled"},{from:"verifying",to:"completed"},{from:"verifying",to:"failed"},{from:"verifying",to:"blocked"},{from:"verifying",to:"cancelled"},{from:"blocked",to:"executing"},{from:"blocked",to:"cancelled"}])});async function mA(e){let[t,n]=await Promise.all([e.exists(gn),e.exists(ed)]);if(t!==n){let i=t?ed:gn;throw new $m(`Partial V2 configuration; missing ${i}`)}if(t&&n){let[i,r]=await Promise.all([new Yu(e).read(),new Qu(e).read()]);return w6(i,r)}if(await e.exists(".agents/manifest.yaml"))return E6(await new id(e).read());throw new Im("Workspace has neither complete V2 config nor a legacy V1 manifest")}function w6(e,t){let n=t.layout.version,i=n===3?".agents/records":".agents/data";return{version:n,source:"project-config",project:e.project,projectConfig:e,frameworkLock:t,legacyManifest:null,supports:()=>!0,entityRoot:r=>`${i}/${Lm[r]}`,activePath(r,o){yA(r,o);let a=this.entityRoot(r),s=n===3?sA(a,o):Tm(a,o);return r==="change"?`${s}/${o}/change.md`:r==="execution"?`${s}/${o}/execution.md`:r==="run"?`${s}/${o}.jsonl`:`${s}/${o}.md`},legacyReadRoot(r){return n===3?`.agents/data/${Lm[r]}`:hA(Rm,r)},legacyReadCandidate(r,o,a){return n===3?{path:Cm(".agents/data",r,o),readOnly:!0}:fA(Rm,r,o,a)},legacyReadCandidates(r,o,a){if(n===3)return[{path:Cm(".agents/records",r,o),readOnly:!0},{path:Cm(".agents/data",r,o),readOnly:!0}];let s=fA(Rm,r,o,a);return s===null?[]:[s]}}}function Cm(e,t,n){yA(t,n);let i=Tm(`${e}/${Lm[t]}`,n);return t==="change"?`${i}/${n}/change.md`:t==="execution"?`${i}/${n}/execution.md`:t==="run"?`${i}/${n}.jsonl`:`${i}/${n}.md`}function E6(e){let t={spec:od(`${e.paths.specs}/capabilities`),change:od(e.paths.changes),task:od(e.paths.tasks),run:od(e.paths.runs)};return{version:1,source:"legacy-manifest",project:e.project,projectConfig:null,frameworkLock:null,legacyManifest:e,supports:n=>n!=="prd"&&n!=="execution",entityRoot(n){let i=hA(t,n);if(i===null)throw jm(n,1);return i},activePath(n,i,r){if(!this.supports(n))throw jm(n,1);return gA(t,n,i,r)},legacyReadRoot:()=>null,legacyReadCandidate:()=>null,legacyReadCandidates:()=>[]}}async function A6(e,t,n,i,r){let o=t.activePath(n,i,r),a=t.legacyReadCandidates(n,i,r),[s,...l]=await Promise.all([e.exists(o),...a.map(f=>e.exists(f.path))]),c=a.filter((f,h)=>l[h]).map(f=>f.path),d=c[0]??a[0]?.path??null,u=c.length>0;if(!s&&!u)return{state:"missing",activePath:o,legacyPath:d};if(s&&!u)return{state:"active-only",activePath:o,legacyPath:d};let _=await Promise.all([...s?[e.readText(o)]:[],...c.map(f=>e.readText(f))]);if(!s){let[f,...h]=_;return{state:h.every(k=>k===f)?"legacy-only":"duplicate-divergent",activePath:o,legacyPath:d}}let[p,...y]=_;return{state:y.every(f=>f===p)?"duplicate-identical":"duplicate-divergent",activePath:o,legacyPath:d}}async function Ss(e,t,n,i,r){let o=await A6(e,t,n,i,r);if(o.state==="duplicate-divergent")throw new Mm(`Divergent ${n} ${i} exists in active and legacy layouts: ${o.activePath}, ${o.legacyPath}`);return o.state==="missing"?null:o.state==="legacy-only"?o.legacyPath:o.activePath}function fA(e,t,n,i){return t==="prd"||t==="execution"||t==="spec"&&i?.legacyCapability===void 0?null:{path:gA(e,t,n,i),readOnly:!0}}function gA(e,t,n,i){if(vA(t,n),t==="prd"||t==="execution")throw jm(t,1);if(t==="spec"){let r=i?.legacyCapability;if(r===void 0||!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(r))throw new Wr("Legacy spec lookup requires a canonical legacyCapability");return`${e.spec}/${r}/spec.md`}if(Vi(n),t==="change"){let{year:r,month:o}=Vi(n);return`${e.change}/${r}/${o}/${n}/proposal.md`}return t==="task"?bs(e.task,n):bs(e.run,n)}function hA(e,t){return t==="prd"||t==="execution"?null:e[t]}function yA(e,t){vA(e,t),vs(t)}function vA(e,t){let n=k6[e];if(!t.startsWith(`${n}-`))throw new Pm(`Expected ${e} id to start with ${n}-: ${t}`)}function od(e){if(e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||e.endsWith("/")||/^[A-Za-z]:/.test(e)||e.split("/").some(t=>t.length===0||t==="."||t===".."))throw new Wr(`Workspace layout path is not canonical: ${e}`);return e}function jm(e,t){return new Nm(`Layout V${t} does not support ${e}`)}var Wr,$m,Im,Nm,Pm,Mm,k6,Lm,Rm,bA=L(()=>{"use strict";vm();Am();xm();Wr=class extends Error{name="WorkspaceLayoutError"},$m=class extends Wr{name="PartialWorkspaceConfigError"},Im=class extends Wr{name="WorkspaceLayoutNotFoundError"},Nm=class extends Wr{name="UnsupportedLayoutEntityError"},Pm=class extends Wr{name="ArtifactKindMismatchError"},Mm=class extends Wr{name="InactiveLayoutConflictError"},k6={prd:"PRD",spec:"SPEC",change:"CHG",task:"TASK",execution:"EXEC",run:"RUN"},Lm={prd:"prds",spec:"specs",change:"changes",task:"tasks",execution:"executions",run:"runs"},Rm={spec:".agents/specs/capabilities",change:".agents/changes",task:".agents/tasks",run:".agents/runs"}});var bt=L(()=>{"use strict";Cp();QS();Np();vm();YE();tA();nA();oA();Sm();aA();Am();km();Io();xm();lA();dA();_A();pA();bA();hs()});var Dm=L(()=>{"use strict";bt()});function ad(e,t,n){let i=`${e} ${t} ${n}`.toLowerCase();return i.includes("claude")||i.includes("anthropic")?"anthropic":i.includes("gpt")||i.includes("openai")||i.includes("codex")?"openai":null}function SA(e){let t=Math.max(e.inputTokens-e.cachedInputTokens,0),n=Um(t/1e6*e.inputRate*e.inputMultiplier),i=Um(e.cachedInputTokens/1e6*(e.cachedInputRate??0)*e.inputMultiplier),r=Um(e.outputTokens/1e6*e.outputRate*e.outputMultiplier);return{inputUsd:n,cachedInputUsd:i,outputUsd:r,reasoningUsd:0}}var Um,kA=L(()=>{"use strict";Um=e=>Math.round(e*1e6)/1e6});function Fm(e){let t=a=>typeof a=="object"&&a!==null&&!Array.isArray(a),n=a=>typeof a=="number"&&Number.isFinite(a)?a:null,i=a=>a.length===0||a.some(s=>s===null)?null:a.reduce((s,l)=>s+(l??0),0),r=e.map(a=>t(a.historical_cost)?a.historical_cost:null),o=e.map(a=>t(a.time)?a.time:null);return{invocation_count:e.length,cost:{estimated_usd:i(r.map(a=>a===null?null:n(a.estimated_usd))),estimated_brl:i(r.map(a=>a===null?null:n(a.estimated_brl))),observed_count:r.filter(a=>a!==null).length,unavailable_count:r.filter(a=>a===null).length},time:{duration_ms:i(o.map(a=>a===null?null:n(a.duration_ms))),latency_ms:i(o.map(a=>a===null?null:n(a.latency_ms))),duration_observed_count:o.filter(a=>a!==null&&n(a.duration_ms)!==null).length,latency_observed_count:o.filter(a=>a!==null&&n(a.latency_ms)!==null).length},groups:T6(e)}}function T6(e){let t=new Map;for(let r of e)typeof r.agent_invocation_id=="string"&&t.set(r.agent_invocation_id,r);return{...Object.fromEntries(Object.entries({phases:"phase",tasks:"task_id",specs:"spec_id",prds:"prd_id",executions:"execution_id",agents:"zaip_agent"}).map(([r,o])=>[r,zm(t.values(),a=>typeof a[o]=="string"?[a[o]]:[])])),providers:zm(t.values(),r=>wA(r,"provider")),models:zm(t.values(),r=>wA(r,"model"))}}function zm(e,t){let n=new Map;for(let i of e)for(let r of new Set(t(i)))n.set(r,(n.get(r)??0)+1);return Object.fromEntries([...n.entries()].sort())}function wA(e,t){return Array.isArray(e.usage_segments)?e.usage_segments.flatMap(n=>typeof n=="object"&&n!==null&&t in n&&typeof n[t]=="string"?[n[t]]:[]):[]}var qm=L(()=>{"use strict"});var Vm=L(()=>{"use strict"});var EA=L(()=>{"use strict"});var AA=L(()=>{"use strict";Zr()});function TA(e,t=null){let n=R6(e).filter(r=>t===null||$6(r,t)),i=C6(n);return{scope_id:t,run_count:n.length,run_coverage:{usage:sd(n,r=>r.effective_usage_records.length>0),tokens:sd(n,r=>r.effective_usage_records.some(o=>xA(o)!==null)),usd:sd(n,r=>r.effective_usage_records.some(o=>o.cost.usd!==null)),brl:sd(n,r=>r.effective_usage_records.some(o=>o.cost.brl!==null))},attribution:{attributed_runs:n.filter(r=>r.run.attribution_status==="attributed").length,legacy_unattributed_runs:n.filter(r=>r.run.attribution_status==="legacy_unattributed").length},conversation:gi(i.filter(({event:r})=>r.phase==="conversation")),planning:gi(i.filter(({event:r})=>r.phase==="planning")),execution:gi(i.filter(({event:r})=>r.phase==="execution")),total:gi(i),work_types:{new:gi(i.filter(({run:r})=>r.run.work_type==="new")),rework:gi(i.filter(({run:r})=>r.run.work_type==="rework"))},cohorts:{v2_live:gi(i.filter(({run:r})=>r.run.attribution_status==="attributed")),legacy_imported:gi(i.filter(({run:r})=>r.run.attribution_status==="legacy_unattributed"))}}}function sd(e,t){let n=e.filter(t).length,i=e.length-n;return{known_runs:n,unknown_runs:i,complete:i===0,coverage_ratio:e.length===0?1:n/e.length}}function R6(e){let t=new Map;for(let n of e){let i=t.get(n.run.run_id);if(i!==void 0){if(JSON.stringify(i.records)!==JSON.stringify(n.records))throw new Error(`Divergent duplicate Run V2 fold: ${n.run.run_id}`);continue}t.set(n.run.run_id,n)}return[...t.values()]}function C6(e){let t=new Map;for(let n of e)for(let i of n.effective_usage_records){let r=t.get(i.event_id);if(r!==void 0){if(JSON.stringify(r.event)!==JSON.stringify(i))throw new Error(`Divergent duplicate usage event: ${i.event_id}`);continue}t.set(i.event_id,{run:n,event:i})}return[...t.values()]}function $6(e,t){return[e.run.run_id,e.run.conversation_id,e.run.execution_id,e.run.task_id,e.run.spec_id,e.run.prd_id,e.run.change_id].includes(t)}function gi(e){let t=e.map(({event:o})=>o),n=t.map(o=>xA(o)),i={input:t.map(o=>o.tokens.input),cached_input:t.map(o=>o.tokens.cached_input),output:t.map(o=>o.tokens.output),reasoning:t.map(o=>o.tokens.reasoning),total:n},r={usd:t.map(o=>o.cost.usd),brl:t.map(o=>o.cost.brl)};return{usage_event_count:t.length,tokens:{input:Zi(t.map(o=>o.tokens.input)),cached_input:Zi(t.map(o=>o.tokens.cached_input)),output:Zi(t.map(o=>o.tokens.output)),reasoning:Zi(t.map(o=>o.tokens.reasoning)),total:Zi(n)},cost:{usd:Zi(t.map(o=>o.cost.usd)),brl:Zi(t.map(o=>o.cost.brl))},coverage:{events:t.length,tokens:n.filter(o=>o!==null).length,usd:t.filter(o=>o.cost.usd!==null).length,brl:t.filter(o=>o.cost.brl!==null).length},known:{tokens:{input:Wi(i.input),cached_input:Wi(i.cached_input),output:Wi(i.output),reasoning:Wi(i.reasoning),total:Wi(i.total)},cost:{usd:Wi(r.usd),brl:Wi(r.brl)}}}}function Wi(e){let t=e.filter(i=>i!==null),n=e.length-t.length;return{known_sum:t.reduce((i,r)=>i+r,0),unknown_event_count:n,complete:n===0,coverage_ratio:e.length===0?1:t.length/e.length}}function xA(e){if(e.tokens.total!==null)return e.tokens.total;let{input:t,output:n}=e.tokens;return t===null||n===null?null:t+n}function Zi(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}var OA=L(()=>{"use strict"});var Ve,Zo,I6,N9,RA=L(()=>{"use strict";Ve=Be(Xe(),1),Zo=Ve.z.number().finite().nonnegative().nullable(),I6=Ve.z.object({task_id:Ve.z.string().min(1),completed:Ve.z.boolean(),completed_at:Ve.z.string().min(1).nullable(),attempt:Ve.z.number().int().nonnegative().nullable(),attempt_id:Ve.z.string().min(1).nullable().optional(),equivalence_key:Ve.z.string().min(1).nullable().optional(),model:Ve.z.string().min(1).nullable(),reasoning_effort:Ve.z.enum(["low","medium","high","xhigh"]).nullable(),baseline_task_id:Ve.z.string().min(1).nullable(),baseline_attempt_id:Ve.z.string().min(1).nullable().optional(),baseline_equivalence_id:Ve.z.string().min(1).nullable(),observed_cost_usd:Zo,baseline_observed_cost_usd:Zo,quality_score:Zo,quality_floor:Zo,rework_count:Ve.z.number().int().nonnegative().nullable(),billed_amount:Zo.optional(),billed_currency:Ve.z.string().min(1).nullable().optional(),billed_provenance:Ve.z.enum(["observed","inferred","unavailable"]).nullable().optional(),billed_source_id:Ve.z.string().min(1).nullable().optional(),billed_at:Ve.z.string().min(1).nullable().optional(),baseline_billed_amount:Zo.optional(),baseline_billed_currency:Ve.z.string().min(1).nullable().optional(),baseline_billed_provenance:Ve.z.enum(["observed","inferred","unavailable"]).nullable().optional(),baseline_billed_source_id:Ve.z.string().min(1).nullable().optional(),baseline_billed_at:Ve.z.string().min(1).nullable().optional()}).strict(),N9=Ve.z.object({timezone:Ve.z.string().min(1),interval:Ve.z.object({start:Ve.z.string().min(1),end:Ve.z.string().min(1)}).strict(),equivalence_key:Ve.z.string().min(1).nullable().optional(),tasks:Ve.z.array(I6)}).strict()});var CA=L(()=>{"use strict"});var $A=L(()=>{"use strict"});var IA=L(()=>{"use strict";$A()});async function Wm(e,t){let n=Bo(t.from),i=Bo(t.to,!0);if(n>i)throw new RangeError("Manifest query from must not be after to");let r=t.offset??0,o=t.limit??100;if(!Number.isSafeInteger(r)||r<0||!Number.isSafeInteger(o)||o<1||o>500)throw new RangeError("Manifest page pagination is invalid");let a=t.filters??{},s=y=>Object.keys(a).every(f=>(a[f]?.length??0)===0||(y[f]??[]).some(h=>a[f]?.includes(h))),l=[],c=new Date(n);for(c.setUTCDate(1),c.setUTCHours(0,0,0,0);c.getTime()<=i;){let y=c.getUTCFullYear(),f=c.getUTCMonth()+1,h=`.agents/records/telemetry/${y}/${String(f).padStart(2,"0")}`,k=`${h}/manifest.json`;c.setUTCMonth(c.getUTCMonth()+1);let S=e.listFiles===void 0?await e.exists(k)?[k]:[]:await e.listFiles(h,"manifest.json");for(let R of S){let g=await PA(e,R,t.cache),b=JSON.parse(g),{manifest_hash:O,...P}=b;if(typeof O!="string"||!Array.isArray(b.chunks)||await MA(JSON.stringify(P))!==O)throw new Error(`Invalid invocation manifest: ${R}`);for(let C of b.chunks)!N6(C)||Bo(C.from)>i||Bo(C.to,!0)<n||C.dimensions!==void 0&&!s(C.dimensions)||l.push(C)}}let d=new Map,u=r+o+1,_=0;for(let y of l.sort((f,h)=>h.to.localeCompare(f.to)||h.path.localeCompare(f.path))){let f=[...d.values()].sort(NA)[u-1]?.occurred_at;if(f!==void 0&&y.to<f)break;let h=await PA(e,y.path,t.cache);if(await MA(h)!==y.content_sha256)throw new Error(`Invocation chunk hash mismatch: ${y.path}`);let k=h.split(/\r?\n/).filter(Boolean);if(k.length!==y.summary_count)throw new Error(`Invocation chunk summary count mismatch: ${y.path}`);let S=new Set(y.summary_hashes);for(let R of k){let g=JSON.parse(R);if(!P6(g)||!S.has(g.summary_hash))throw new Error(`Invalid Invocation Summary in ${y.path}`);if(Bo(g.occurred_at)<n||Bo(g.occurred_at)>i||!s(M6(g)))continue;let b=d.get(g.agent_invocation_id);if(b!==void 0&&b.summary_hash!==g.summary_hash)throw new Error(`Divergent Invocation Summary: ${g.agent_invocation_id}`);d.set(g.agent_invocation_id,g)}_+=1}let p=[...d.values()].sort(NA);return{summaries:p.slice(r,r+o),offset:r,limit:o,has_more:p.length>r+o,total:null,chunk_count:_}}function Bo(e,t=!1){let n=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T${t?"23:59:59.999":"00:00:00.000"}Z`:e);if(!Number.isFinite(n))throw new RangeError(`Invalid manifest query timestamp: ${e}`);return n}function NA(e,t){return t.occurred_at.localeCompare(e.occurred_at)||e.agent_invocation_id.localeCompare(t.agent_invocation_id)}function N6(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.content_sha256=="string"&&typeof e.summary_count=="number"&&Array.isArray(e.summary_hashes)}function P6(e){return typeof e=="object"&&e!==null&&typeof e.agent_invocation_id=="string"&&typeof e.occurred_at=="string"&&typeof e.summary_hash=="string"&&Array.isArray(e.usage_segments)}function M6(e){return{providers:e.usage_segments.flatMap(t=>t.provider===null?[]:[t.provider]),models:e.usage_segments.flatMap(t=>t.model===null?[]:[t.model]),zaip_agents:e.zaip_agent===null?[]:[e.zaip_agent],phases:e.phase===null?[]:[e.phase],purposes:e.purpose===null?[]:[e.purpose],statuses:e.status===null?[]:[e.status],executions:e.execution_id===null?[]:[e.execution_id],tasks:e.task_id===null?[]:[e.task_id],specs:e.spec_id===null?[]:[e.spec_id],prds:e.prd_id===null?[]:[e.prd_id],changes:e.change_id===null?[]:[e.change_id]}}async function PA(e,t,n){let i=n?.get(t);if(i!==void 0)return i;let r=await e.readText(t);return n?.set(t,r),r}async function MA(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e)))].map(t=>t.toString(16).padStart(2,"0")).join("")}var LA=L(()=>{"use strict"});async function DA(e,t){let n=R=>typeof R=="object"&&R!==null&&!Array.isArray(R),i=async R=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(R)))].map(g=>g.toString(16).padStart(2,"0")).join(""),r=(R,g=!1)=>{let b=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(R)?`${R}T${g?"23:59:59.999":"00:00:00.000"}Z`:R);if(!Number.isFinite(b))throw new RangeError(`Invalid manifest query timestamp: ${R}`);return b},o=r(t.from),a=r(t.to,!0);if(o>a)throw new RangeError("Manifest query from must not be after to");let s=t.page??1,l=t.page_size??100;if(!Number.isSafeInteger(s)||s<1||!Number.isSafeInteger(l)||l<1||l>500)throw new RangeError("Manifest query pagination is invalid");let c=new Map,d=[],u=[],_=0,p=0,y=t.filters??{},f=R=>Object.keys(y).every(g=>(y[g]?.length??0)===0||(R[g]??[]).some(b=>y[g]?.includes(b))),h=new Date(o);for(h.setUTCDate(1),h.setUTCHours(0,0,0,0);h.getTime()<=a;){t.signal?.throwIfAborted();let R=h.getUTCFullYear(),g=h.getUTCMonth()+1,b=`.agents/records/telemetry/${R}/${String(g).padStart(2,"0")}`,O=`${b}/manifest.json`;h.setUTCMonth(h.getUTCMonth()+1);let P=e.listFiles===void 0?await e.exists(O)?[O]:[]:await e.listFiles(b,"manifest.json");for(let C of P){let v=t.cache?.get(C)??await e.readText(C);t.cache?.set(C,v);let A=JSON.parse(v);if(!n(A)||typeof A.manifest_hash!="string"||!Array.isArray(A.chunks)||!n(A.period)||A.period.year!==R||A.period.month!==g)throw new Error(`Invalid invocation manifest: ${C}`);let{manifest_hash:x,...T}=A;if(await i(JSON.stringify(T))!==x)throw new Error(`Invocation manifest hash mismatch: ${C}`);_+=1,typeof A.source_latest_at=="string"&&d.push(A.source_latest_at),typeof A.lag_ms=="number"&&u.push(A.lag_ms);for(let N of A.chunks){if(!n(N)||typeof N.path!="string"||typeof N.from!="string"||typeof N.to!="string"||typeof N.content_sha256!="string"||!Array.isArray(N.summary_hashes)||r(N.from)>a||r(N.to,!0)<o||n(N.dimensions)&&!f(N.dimensions))continue;t.signal?.throwIfAborted();let H=t.cache?.get(N.path)??await e.readText(N.path);if(t.cache?.set(N.path,H),await i(H)!==N.content_sha256)throw new Error(`Invocation chunk hash mismatch: ${N.path}`);let ie=H.split(/\r?\n/).filter(Boolean);if(typeof N.summary_count=="number"&&ie.length!==N.summary_count)throw new Error(`Invocation chunk summary count mismatch: ${N.path}`);let oe=new Set(N.summary_hashes.filter(be=>typeof be=="string"));for(let be of ie){let z=JSON.parse(be);if(!n(z)||typeof z.agent_invocation_id!="string"||typeof z.occurred_at!="string"||typeof z.summary_hash!="string")throw new Error(`Invalid Invocation Summary in ${N.path}`);if(!oe.has(z.summary_hash))throw new Error(`Invocation Summary hash mismatch: ${z.agent_invocation_id}`);let ye=r(z.occurred_at),B=Array.isArray(z.usage_segments)?z.usage_segments.filter(n):[],he={providers:B.flatMap(Fe=>typeof Fe.provider=="string"?[Fe.provider]:[]),models:B.flatMap(Fe=>typeof Fe.model=="string"?[Fe.model]:[]),zaip_agents:typeof z.zaip_agent=="string"?[z.zaip_agent]:[],phases:typeof z.phase=="string"?[z.phase]:[],purposes:typeof z.purpose=="string"?[z.purpose]:[],statuses:typeof z.status=="string"?[z.status]:[],executions:typeof z.execution_id=="string"?[z.execution_id]:[],tasks:typeof z.task_id=="string"?[z.task_id]:[],specs:typeof z.spec_id=="string"?[z.spec_id]:[],prds:typeof z.prd_id=="string"?[z.prd_id]:[],changes:typeof z.change_id=="string"?[z.change_id]:[]};if(ye<o||ye>a||!f(he))continue;let Ke=c.get(z.agent_invocation_id);if(Ke?.summary_hash!==void 0&&Ke.summary_hash!==z.summary_hash)throw new Error(`Divergent Invocation Summary: ${z.agent_invocation_id}`);c.set(z.agent_invocation_id,z)}p+=1}}}let k=[...c.values()].sort((R,g)=>String(g.occurred_at).localeCompare(String(R.occurred_at))||String(R.agent_invocation_id).localeCompare(String(g.agent_invocation_id))),S=(s-1)*l;return{summaries:k.slice(S,S+l),total:k.length,page:s,page_size:l,has_more:S+l<k.length,manifest_count:_,chunk_count:p,source_latest_at:d.sort().at(-1)??null,lag_ms:u.length===0?null:Math.max(...u),aggregate:Fm(k)}}function jA(e){return Math.round(e*1e6)/1e6}function Ki(e){let t=e.provider??ad(e.model,"",""),n=e.model.toLowerCase(),i=b=>{let O=b.toLowerCase();if(n===O)return!0;let P=n.slice(O.length);return P.startsWith("@")||P.startsWith(":")||P.startsWith("/")||/^-\d{4}-\d{2}-\d{2}(?:$|[.:@/])/.test(P)},r=e.catalog.models.find(b=>i(b.id)||b.aliases.some(O=>i(O)));if(!r||t!==null&&r.provider!==t)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:null,pricing_source:null,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let o=e.usage.cached_input,a=e.usage.input,s=e.usage.output;if(a===null||o===null||s===null)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let l=e.usage.reasoning??0,c=r.long_context_threshold_tokens!==null&&(e.usage.input??0)>r.long_context_threshold_tokens,d=c?r.long_context_input_multiplier:1,u=c?r.long_context_output_multiplier:1,_=e.serviceTier==="priority"||e.serviceTier==="fast";if(_&&c)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let p=_?r.priority_input_per_million_usd??null:r.input_per_million_usd,y=_?r.priority_output_per_million_usd??null:r.output_per_million_usd;if(p===null||y===null)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let{inputUsd:f,cachedInputUsd:h,outputUsd:k,reasoningUsd:S}=SA({inputTokens:a,cachedInputTokens:o,outputTokens:s,reasoningTokens:l,inputRate:p,cachedInputRate:_?r.priority_cached_input_per_million_usd??null:r.cached_input_per_million_usd,outputRate:y,reasoningRate:_?r.priority_reasoning_per_million_usd??null:r.reasoning_per_million_usd,inputMultiplier:d,outputMultiplier:u}),R=jA(f+h+k+S),g=e.fxRate===null||e.fxRate===void 0?null:jA(R*e.fxRate.rate);return{estimated_usd:R,estimated_brl:g,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:f,cached_input_usd:h,output_usd:k,reasoning_usd:S}}var Q,Bi,j6,Ji,Hi,UA,zA,D6,x6,O6,hi,Zr=L(()=>{"use strict";Q=Be(Xe(),1);Dm();kA();qm();Vm();Dm();EA();AA();OA();RA();CA();IA();Vm();LA();qm();Bi=Q.z.string().datetime({offset:!0}).or(Q.z.string().datetime()),j6=Q.z.object({id:Q.z.string().min(1),provider:Q.z.enum(["openai","anthropic"]),aliases:Q.z.array(Q.z.string().min(1)).default([]),input_per_million_usd:Q.z.number().nonnegative(),cached_input_per_million_usd:Q.z.number().nonnegative().nullable().default(null),output_per_million_usd:Q.z.number().nonnegative(),reasoning_per_million_usd:Q.z.number().nonnegative().nullable().default(null),priority_input_per_million_usd:Q.z.number().nonnegative().nullable().optional(),priority_cached_input_per_million_usd:Q.z.number().nonnegative().nullable().optional(),priority_output_per_million_usd:Q.z.number().nonnegative().nullable().optional(),priority_reasoning_per_million_usd:Q.z.number().nonnegative().nullable().optional(),reasoning_billed_separately:Q.z.boolean().default(!1),long_context_threshold_tokens:Q.z.number().int().positive().nullable().default(null),long_context_input_multiplier:Q.z.number().positive().default(1),long_context_output_multiplier:Q.z.number().positive().default(1),source_label:Q.z.string().min(1),source_url:Q.z.string().url(),notes:Q.z.array(Q.z.string()).default([])}).strict(),Ji=Q.z.object({schema_version:Q.z.literal(1),updated_at:Bi,source:Q.z.string().min(1),disclaimer:Q.z.string().min(1),models:Q.z.array(j6)}).strict(),Hi=Q.z.object({schema_version:Q.z.literal(1),base:Q.z.literal("USD"),quote:Q.z.literal("BRL"),rate:Q.z.number().positive(),as_of:Bi,source_label:Q.z.string().min(1),source_url:Q.z.string().url()}).strict(),UA=Q.z.object({input:Q.z.number().int().nonnegative().nullable(),cached_input:Q.z.number().int().nonnegative().nullable().default(null),output:Q.z.number().int().nonnegative().nullable(),reasoning:Q.z.number().int().nonnegative().nullable(),total:Q.z.number().int().nonnegative().nullable().default(null),source:Q.z.preprocess(e=>e==="client"?"provider_reported":e,Q.z.enum(["provider_reported","estimated","unavailable"]))}).strict(),zA=Q.z.object({estimated_usd:Q.z.number().nonnegative().nullable(),estimated_brl:Q.z.number().nonnegative().nullable(),fx_rate:Q.z.number().positive().nullable(),pricing_model:Q.z.string().nullable(),pricing_source:Q.z.string().nullable(),input_usd:Q.z.number().nonnegative().nullable().default(null),cached_input_usd:Q.z.number().nonnegative().nullable().default(null),output_usd:Q.z.number().nonnegative().nullable().default(null),reasoning_usd:Q.z.number().nonnegative().nullable().default(null)}).strict(),D6=Q.z.object({cycle_count:Q.z.number().int().nonnegative().nullable(),source:Q.z.enum(["repository","local-codex","manual","unavailable"]),segment_key:Q.z.string().nullable()}).strict(),x6=Q.z.object({schema_version:Q.z.literal(1),recorded_at:Bi,run_id:Q.z.string().startsWith("RUN-"),task_id:Q.z.string().startsWith("TASK-"),spec_id:Q.z.string().nullable(),change_id:Q.z.string().nullable(),task_title:Q.z.string().nullable(),task_status:Q.z.string().nullable(),client:Q.z.string().min(1),agent:Q.z.string().min(1),provider:Q.z.enum(["openai","anthropic"]).nullable(),model:Q.z.string().min(1),status:Q.z.enum(["running","completed","failed"]),started_at:Bi,finished_at:Bi.nullable(),duration_ms:Q.z.number().int().nonnegative().nullable(),token_usage:UA,estimated_cost:zA,telemetry:D6,source_segment_key:Q.z.string().nullable()}).strict(),O6=Q.z.object({schema_version:Q.z.literal(1),recorded_at:Bi,run_id:Q.z.string().startsWith("RUN-"),task_id:Q.z.string().startsWith("TASK-"),cycle_index:Q.z.number().int().nonnegative(),provider:Q.z.enum(["openai","anthropic"]).nullable(),model:Q.z.string().min(1),timestamp:Bi,source:Q.z.enum(["local-codex","manual"]),source_segment_key:Q.z.string().nullable(),token_usage:UA,estimated_cost:zA}).strict();hi=class{constructor(t,n=".agents/config/pricing/models.json",i=".agents/config/pricing/fx"){this.filesystem=t;this.modelsPath=n;this.fxBasePath=i}filesystem;modelsPath;fxBasePath;async readCatalog(){try{return Ji.parse(JSON.parse(await this.filesystem.readText(this.modelsPath)))}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return Ji.parse({schema_version:1,updated_at:new Date().toISOString(),source:"missing-local-pricing",disclaimer:"Tabela de pre\xC3\xA7os ausente no workspace.",models:[]});throw t}}async readLatestFxRate(){let t=`${this.fxBasePath}/current-usd-brl.json`;try{return Hi.parse(JSON.parse(await this.filesystem.readText(t)))}catch{}let n=[...await this.filesystem.listFiles(this.fxBasePath,".json")].sort().reverse();for(let i of n)try{return Hi.parse(JSON.parse(await this.filesystem.readText(i)))}catch{}return null}async writeCurrentFxRate(t){let n=Hi.parse({schema_version:1,base:"USD",quote:"BRL",rate:t,as_of:new Date().toISOString(),source_label:"Dashboard manual override",source_url:"https://www.bcb.gov.br/"});return await this.filesystem.writeTextAtomic(`${this.fxBasePath}/current-usd-brl.json`,`${JSON.stringify(n,null,2)}
213
+ `),n}}});function cd(e){return Math.max(z6,Math.floor(e/36e5)*36e5)}function ld(e){return e!=null&&Date.parse(e)>=Date.parse(Gt.cutoff)}function Ot(e,t){if(e==null)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let i=new Intl.DateTimeFormat("en-CA",{timeZone:U6,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(n),r=l=>i.find(c=>c.type===l)?.value,o=r("year"),a=r("month"),s=r("day");return o===void 0||a===void 0||s===void 0?null:t==="year"?o:t==="month"?`${o}-${a}`:`${o}-${a}-${s}`}var U6,Br,Gt,z6,Ho=L(()=>{"use strict";U6="America/Sao_Paulo",Br={"2026-08-02":4809511,"2026-08-01":8894527,"2026-07-31":9472804,"2026-07-30":5167818,"2026-07-29":11336221,"2026-07-28":8262282,"2026-07-27":4862150,"2026-07-26":970899,"2026-07-25":7465970,"2026-07-24":9041538,"2026-07-23":19750,"2026-07-22":1371560,"2026-07-21":14992543,"2026-07-20":3168460,"2026-07-19":929990,"2026-07-18":9232700,"2026-07-17":16882853,"2026-07-16":20054785,"2026-07-15":35459620,"2026-07-14":24078852,"2026-07-13":22611635,"2026-07-12":8339738,"2026-07-11":1859980},Gt={cutoff:"2026-08-02T03:14:00.000Z",cutoffDay:"2026-08-02",durationMs:Object.values(Br).reduce((e,t)=>e+t,0),costXlsxSha256:"C3EE0495667289FB81DD8F9268697CEB7692433C14CB19934C89B5F39129902A",operationsXlsxSha256:"94E9577A7CA27F7FDD277D81E34156296CB28FE39CF6D7636B259EBBB7E56BCC"},z6=76*36e5});function Es(e){let t=new Map;for(let i of e)t.has(i.id)||t.set(i.id,i);return[...t.values()].filter(i=>(i.phase===void 0||i.phase==="execution")&&i.parent_run_id==null)}function Hr(e){return i4(Es(e))}function i4(e){let t=e.flatMap(o=>{let a=typeof o.source_duration_ms=="number"&&o.source_duration_ms>=0?o.source_duration_ms:o.duration_ms,s=o.source_started_at??o.duration_started_at??o.started_at,l=Date.parse(s);return typeof a=="number"&&a>=0&&Number.isFinite(l)?[{start:l,end:l+a}]:[]}).sort((o,a)=>o.start-a.start);if(t.length===0)return null;let n=0,i=t[0].start,r=t[0].end;for(let o of t.slice(1))o.start<=r?r=Math.max(r,o.end):(n+=r-i,i=o.start,r=o.end);return n+r-i}var As=L(()=>{"use strict"});function a4(e){let t=e.alternatives.map(i=>`- ${i}`).join(`
214
+ `)||"Nenhuma.",n=e.consequences.map(i=>`- ${i}`).join(`
215
+ `)||"Nenhuma.";return`# ${e.title}
216
+
217
+ ## Decis\xE3o
218
+
219
+ ${e.decision}
220
+
221
+ ## Contexto
222
+
223
+ ${e.context}
224
+
225
+ ## Motivo
226
+
227
+ ${e.reason}
228
+
229
+ ## Alternativas
230
+
231
+ ${t}
232
+
233
+ ## Consequ\xEAncias
234
+
235
+ ${n}`}function s4(e){return e instanceof Error&&"code"in e}var Km,dt,XA,YA,o4,Jm,Xo,md,Gm=L(()=>{"use strict";Km=require("node:path");bt();dt=Be(Xe(),1),XA=dt.z.string().datetime({offset:!0}).or(dt.z.string().datetime()),YA=dt.z.string().regex(/^DEC-(?:HUMAN|AI)-/),o4=dt.z.enum(["architecture","contract","database","security","dependency","network","infrastructure","cost","implementation","rollback"]),Jm=dt.z.object({schema_version:dt.z.literal(2),id:YA,title:dt.z.string().min(1),scope_type:dt.z.enum(["change","execution"]),scope_id:dt.z.string().min(1),origin:dt.z.enum(["human","agent"]),category:o4,context:dt.z.string().min(1),decision:dt.z.string().min(1),reason:dt.z.string().min(1),alternatives:dt.z.array(dt.z.string().min(1)),consequences:dt.z.array(dt.z.string().min(1)),reversible:dt.z.boolean(),rollback:dt.z.string().min(1),confidence:dt.z.number().min(0).max(1).nullable(),created_at:XA,confirmed_at:XA.nullable()}).strict().superRefine((e,t)=>{let n=e.scope_type==="change"?"CHG-":"EXEC-";e.scope_id.startsWith(n)||t.addIssue({code:"custom",path:["scope_id"],message:`${e.scope_type} decision requires ${n} scope_id`});let i=e.origin==="human"?"DEC-HUMAN-":"DEC-AI-";e.id.startsWith(i)||t.addIssue({code:"custom",path:["id"],message:`${e.origin} decision requires ${i} id`}),e.origin==="human"&&e.confidence!==null&&t.addIssue({code:"custom",path:["confidence"],message:"Human decisions do not use agent confidence"}),e.origin==="agent"&&e.confidence===null&&t.addIssue({code:"custom",path:["confidence"],message:"Agent decisions require confidence"}),e.origin==="human"&&e.confirmed_at===null&&t.addIssue({code:"custom",path:["confirmed_at"],message:"Human decisions require explicit confirmation provenance"})}),Xo=class extends Error{name="DecisionV2ConflictError"},md=class{constructor(t,n){this.filesystem=t;this.layout=n;if(n.version===1)throw new Error("Decision V2 requires a modern WorkspaceLayout")}filesystem;layout;async record(t){if(t.origin==="human"&&t.confirmed!==!0)throw new Error("Human decisions require confirmed: true from the caller");let n=t.clock??new Qe,i=n.now().toISOString(),r=t.id??qi(t.origin==="human"?"DEC-HUMAN":"DEC-AI",t.shortName,{clock:n,...t.collisionCode===void 0?{}:{collisionCode:t.collisionCode},...t.timeZone===void 0?{}:{timeZone:t.timeZone}}),o=Jm.parse({schema_version:2,id:r,title:t.title,scope_type:t.scopeType,scope_id:t.scopeId,origin:t.origin,category:t.category,context:t.context,decision:t.decision,reason:t.reason,alternatives:[...t.alternatives],consequences:[...t.consequences],reversible:t.reversible,rollback:t.rollback,confidence:t.confidence,created_at:i,confirmed_at:t.confirmed===!0?i:null}),a=this.path(o.scope_type,o.scope_id,o.id),s=cn({metadata:o,body:a4(o)});try{return await this.filesystem.writeTextExclusive(a,s),o}catch(l){if(!s4(l)||l.code!=="EEXIST")throw l;let c=await this.read(o.scope_type,o.scope_id,o.id);if(JSON.stringify(c)===JSON.stringify(o))return c;throw new Xo(`Divergent Decision V2 already exists: ${o.id}`)}}async read(t,n,i){let r=this.path(t,n,i),o=$t(await this.filesystem.readText(r),Jm).metadata;if(o.scope_type!==t||o.scope_id!==n||o.id!==i)throw new Xo(`Decision V2 metadata does not match its path: ${r}`);return o}async list(t){let i=(t?await this.filesystem.listFiles(this.decisionDirectory(t.type,t.id),".md"):(await Promise.all(["change","execution"].map(o=>this.filesystem.listFiles(this.layout.entityRoot(o),".md")))).flat()).filter(o=>/\/decisions\/DEC-(?:HUMAN|AI)-[^/]+\.md$/.test(o)).sort();return(await Promise.all(i.map(async o=>{let a=$t(await this.filesystem.readText(o),Jm).metadata;if(Km.posix.basename(o,".md")!==a.id)throw new Xo(`Decision V2 id does not match filename: ${o}`);if(this.path(a.scope_type,a.scope_id,a.id)!==o)throw new Xo(`Decision V2 owner does not match path: ${o}`);return a}))).sort((o,a)=>o.created_at.localeCompare(a.created_at)||o.id.localeCompare(a.id))}path(t,n,i){return YA.parse(i),`${this.decisionDirectory(t,n)}/${i}.md`}decisionDirectory(t,n){let i=this.layout.activePath(t,n);return`${Km.posix.dirname(i)}/decisions`}}});function eT(e,t){return e.entrypoint==="task"&&e.execution_id!==null&&e.task_id!==null&&e.change_id===null&&t.execution_id===e.execution_id&&t.task_id===e.task_id}var Xt,c4,QA,Xm=L(()=>{"use strict";Xt=Be(Xe(),1),c4=Xt.z.string().datetime({offset:!0}).or(Xt.z.string().datetime()),QA=Xt.z.object({schema_version:Xt.z.literal(2),event_id:Xt.z.string().min(1).max(200),run_id:Xt.z.string().startsWith("RUN-"),sequence:Xt.z.number().int().positive(),occurred_at:c4,type:Xt.z.literal("run.attribution.recovered"),phase:Xt.z.literal("execution"),execution_id:Xt.z.string().startsWith("EXEC-"),task_id:Xt.z.string().startsWith("TASK-"),change_id:Xt.z.string().startsWith("CHG-")}).strict()});function Ym(e,t){return e.coverage==="partial"&&t.coverage==="complete"&&e.call_id===t.call_id&&e.agent_invocation_id===t.agent_invocation_id&&e.source_call_key===t.source_call_key&&JSON.stringify(e.tokens)===JSON.stringify(t.tokens)}function Qm(e,t,n){return e.type==="usage.recorded"&&e.retrospective_correction===!0&&e.activity_kind==="retrospective_local_remeasurement"&&e.supersedes_event_id!==null&&n.has(e.supersedes_event_id)&&e.phase===t.phase}function gd(e,t){let n={conversation:0,planning:1,execution:2};if(n[t]<n[e])throw new Error(`Run V2 phase cannot move backward from ${e} to ${t}`)}var tT=L(()=>{"use strict"});function ig(e){return e.run_role==="owner"?"orchestrator":e.run_role==="contributor"?"subagent":e.run_role!==void 0?e.run_role:e.phase!=="execution"?"intake":e.parent_run_id===null?"orchestrator":"subagent"}function bT(e){return e.parent_run_id===null?"run":"subrun"}function ST(e){return e.run_purpose!==void 0?e.run_purpose:e.phase!=="execution"?"intake":e.agent==="agent-finalizer"||e.agent==="agent-task-finalizer"?"finalization":e.agent==="agent-reviewer"?"review":e.agent==="agent-auditor"?"audit":e.parent_run_id===null||ig(e)==="orchestrator"?"orchestration":"execution"}function kT(e){return e.requires_finalizer===!0}var $,Ar,hd,tg,d4,nT,rT,iT,oT,aT,eg,Gi,sT,j3,_4,cT,ng,lT,rg,uT,Yo,p4,dT,_T,pT,fT,mT,f4,gT,hT,yT,vT,yd,vd=L(()=>{"use strict";bt();$=Be(Xe(),1);Xm();tT();Gm();Ar=$.z.string().datetime({offset:!0}).or($.z.string().datetime()),hd=$.z.enum(["conversation","planning","execution"]),tg=$.z.string().startsWith("RUN-"),d4=$.z.string().startsWith("CONV-"),nT=$.z.string().startsWith("EXEC-").nullable(),rT=$.z.string().startsWith("TASK-").nullable(),iT=$.z.string().startsWith("SPEC-").nullable(),oT=$.z.string().startsWith("PRD-").nullable(),aT=$.z.string().startsWith("CHG-").nullable(),eg=tg.nullable(),Gi=$.z.string().regex(/^(?:AINV|INV)-/).max(200),sT=$.z.string().startsWith("MCALL-").max(200),j3=$.z.enum(["intake","orchestrator","subagent"]),_4=$.z.enum(["intake","orchestrator","subagent","owner","contributor"]),cT=$.z.enum(["intake","orchestration","execution","review","audit","finalization"]),ng=$.z.enum(["low","medium","high","xhigh"]),lT=$.z.enum(["orchestrator","delegated"]),rg=$.z.object({input:$.z.number().int().nonnegative().nullable(),cached_input:$.z.number().int().nonnegative().nullable(),output:$.z.number().int().nonnegative().nullable(),reasoning:$.z.number().int().nonnegative().nullable(),total:$.z.number().int().nonnegative().nullable(),source:$.z.enum(["provider_reported","estimated","unavailable"])}).strict().superRefine((e,t)=>{e.input!==null&&e.cached_input!==null&&e.cached_input>e.input&&t.addIssue({code:"custom",path:["cached_input"],message:"cached_input cannot exceed input"}),e.total!==null&&e.input!==null&&e.output!==null&&e.total<e.input+e.output&&t.addIssue({code:"custom",path:["total"],message:"total cannot be lower than input + output"})}),uT=$.z.object({usd:$.z.number().nonnegative().nullable(),brl:$.z.number().nonnegative().nullable(),fx_rate:$.z.number().positive().nullable().optional()}).strict(),Yo={schema_version:$.z.literal(2),event_id:$.z.string().min(1).max(200),run_id:tg,sequence:$.z.number().int().positive(),occurred_at:Ar},p4=$.z.object({intent:$.z.enum(["conversation","continue","refine","rework","new_work"]),classification_source:$.z.enum(["agent","explicit","fallback"]),confidence:$.z.number().min(0).max(1),reason_codes:$.z.array($.z.string().regex(/^[a-z][a-z0-9-]{0,63}$/)).min(1).max(12)}).strict(),dT=$.z.object({...Yo,type:$.z.literal("run.started"),attribution_status:$.z.enum(["attributed","legacy_unattributed"]),phase:hd,run_role:_4.optional(),run_purpose:cT.optional(),requires_finalizer:$.z.boolean().optional(),execution_kind:$.z.enum(["interaction","delivery"]).optional(),execution_eligibility:$.z.array($.z.enum(["interaction","delivery"])).optional(),entrypoint:$.z.enum(["conversation","task","spec","prd"]),work_type:$.z.enum(["new","rework"]),storage_mode:$.z.enum(["tracked_sanitized","local_only"]),client:$.z.string().min(1).max(100),agent:$.z.string().min(1).max(100),agent_name:$.z.string().min(1).max(100).nullable().optional(),agent_identity_warning:$.z.object({code:$.z.literal("deprecated-agent-identity"),kind:$.z.enum(["id","codex_name","codex_task_name"]),requested:$.z.string().min(1),canonical_id:$.z.string().min(1),deprecated_at:$.z.iso.date(),remove_after:$.z.iso.date()}).strict().optional(),provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200),reasoning_effort:ng.nullable().optional(),client_thread_id:$.z.string().min(1).max(200).nullable().optional(),client_turn_id:$.z.string().min(1).max(200).nullable().optional(),conversation_id:d4,execution_id:nT,task_id:rT,spec_id:iT,prd_id:oT,change_id:aT,parent_run_id:eg,continuation_of_run_id:eg,retry_of_run_id:eg,agent_invocation_id:Gi.optional(),root_agent_invocation_id:Gi.optional(),parent_agent_invocation_id:Gi.nullable().optional(),invocation_kind:lT.optional(),delegation_depth:$.z.number().int().nonnegative().optional(),intake:p4.nullable().optional()}).strict().superRefine((e,t)=>{e.phase==="execution"&&e.execution_id===null&&e.attribution_status!=="legacy_unattributed"&&t.addIssue({code:"custom",path:["execution_id"],message:"Execution phase requires execution_id"}),{conversation:e.conversation_id,task:e.task_id,spec:e.spec_id,prd:e.prd_id}[e.entrypoint]===null&&t.addIssue({code:"custom",path:[`${e.entrypoint}_id`],message:`${e.entrypoint} entrypoint requires its scope id`}),e.run_role==="orchestrator"&&e.parent_run_id!==null&&t.addIssue({code:"custom",path:["parent_run_id"],message:"orchestrator Run cannot have parent_run_id"}),e.run_role==="subagent"&&e.parent_run_id===null&&t.addIssue({code:"custom",path:["parent_run_id"],message:"subagent Sub-Run requires parent_run_id"});let i=e.agent_invocation_id!==void 0;i&&(e.root_agent_invocation_id===void 0||e.parent_agent_invocation_id===void 0||e.invocation_kind===void 0||e.delegation_depth===void 0)&&t.addIssue({code:"custom",path:["agent_invocation_id"],message:"Agent Invocation identity must be complete when present"}),i&&e.invocation_kind==="orchestrator"&&(e.parent_agent_invocation_id!==null||e.root_agent_invocation_id!==e.agent_invocation_id||e.delegation_depth!==0)&&t.addIssue({code:"custom",path:["invocation_kind"],message:"orchestrator Agent Invocation must be its root at depth zero"}),i&&e.invocation_kind==="delegated"&&(e.parent_agent_invocation_id===null||e.delegation_depth===0)&&t.addIssue({code:"custom",path:["parent_agent_invocation_id"],message:"delegated Agent Invocation requires a parent and positive depth"});for(let[r,o]of[["parent_run_id",e.parent_run_id],["continuation_of_run_id",e.continuation_of_run_id],["retry_of_run_id",e.retry_of_run_id]])o===e.run_id&&t.addIssue({code:"custom",path:[r],message:`${r} cannot reference itself`})}),_T=$.z.object({...Yo,type:$.z.literal("usage.recorded"),phase:hd,activity_kind:$.z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),classification_source:$.z.enum(["explicit","current_context","default","legacy_inferred"]),tokens:rg,cost:uT,provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),source_segment_key:$.z.string().min(1).max(500).nullable(),model_call_id:sT.nullable().optional(),runtime:$.z.object({reasoning_effort:$.z.string().min(1).max(40).nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict().optional(),supersedes_event_id:$.z.string().min(1).max(200).nullable(),retrospective_correction:$.z.literal(!0).optional(),source_occurred_at:Ar.optional(),source_started_at:Ar.optional(),source_finished_at:Ar.optional(),duration_ms:$.z.number().int().nonnegative().nullable().optional(),duration_provenance:$.z.enum(["observed","reconciled","legacy_inferred","estimated","unavailable"]).nullable().optional(),context_stats:$.z.object({initial_pack_tokens:$.z.number().int().nonnegative().nullable(),tool_output_tokens:$.z.number().int().nonnegative().nullable(),files_opened:$.z.number().int().nonnegative().nullable(),snippets_opened:$.z.number().int().nonnegative().nullable()}).strict().optional()}).strict(),pT=$.z.object({...Yo,type:$.z.literal("model.call.observed"),call_id:sT,agent_invocation_id:Gi,coverage:$.z.enum(["complete","partial","unavailable"]),tokens:rg,cost:uT,provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),source_call_key:$.z.string().min(1).max(500).nullable(),source_occurred_at:Ar.optional(),source_started_at:Ar.optional(),source_finished_at:Ar.optional(),runtime:$.z.object({reasoning_effort:$.z.string().min(1).max(40).nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict().optional()}).strict(),fT=$.z.object({schema_version:$.z.literal(1),run_id:tg,execution_id:nT.nullable().default(null),task_id:rT.nullable().default(null),spec_id:iT.nullable().default(null),prd_id:oT.nullable().default(null),change_id:aT.nullable().default(null),zaip_agent:$.z.string().min(1).max(100).nullable().default(null),phase:hd.nullable().default(null),purpose:cT.nullable().default(null),agent_invocation_id:Gi,root_agent_invocation_id:Gi,parent_agent_invocation_id:Gi.nullable(),invocation_kind:lT,delegation_depth:$.z.number().int().nonnegative(),client:$.z.enum(["codex","codex-desktop","codex-subagent"]),thread_id:$.z.string().min(1).max(200).nullable(),turn_id:$.z.string().min(1).max(200).nullable(),agent_path:$.z.string().min(1).max(500).nullable()}).strict().superRefine((e,t)=>{e.invocation_kind==="orchestrator"&&(e.parent_agent_invocation_id!==null||e.root_agent_invocation_id!==e.agent_invocation_id||e.delegation_depth!==0)&&t.addIssue({code:"custom",path:["invocation_kind"],message:"orchestrator telemetry correlation must be its root at depth zero"}),e.invocation_kind==="delegated"&&(e.parent_agent_invocation_id===null||e.delegation_depth===0)&&t.addIssue({code:"custom",path:["parent_agent_invocation_id"],message:"delegated telemetry correlation requires a parent and positive depth"}),e.client==="codex-subagent"&&(e.thread_id!==null||e.agent_path===null&&e.turn_id===null)&&t.addIssue({code:"custom",path:["agent_path"],message:"Codex subagent telemetry requires agent_path or turn_id and no root thread_id"}),e.client!=="codex-subagent"&&e.thread_id===null&&e.turn_id===null&&t.addIssue({code:"custom",path:["thread_id"],message:"Codex root telemetry requires thread_id or turn_id"})}),mT=$.z.object({correlation:fT,event_kind:$.z.enum(["response","usage","terminal","error"]),source:$.z.enum(["codex_app_server","codex_session_fallback","unavailable"]),source_event_key:$.z.string().min(1).max(500),source_method:$.z.enum(["item/completed","rawResponse/completed","thread/tokenUsage/updated","error","turn/completed"]).optional(),stream_boundary:$.z.enum(["item_completed","response_completed","usage_updated","error","turn_completed"]).optional(),source_occurred_at:Ar.nullable(),captured_at:Ar,coverage:$.z.enum(["complete","partial","unavailable"]),tokens:rg.nullable(),provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),runtime:$.z.object({reasoning_effort:$.z.string().min(1).max(40).nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict(),status:$.z.enum(["completed","failed","cancelled"]).nullable(),will_retry:$.z.boolean().nullable().optional(),latency_ms:$.z.number().int().nonnegative().nullable(),historical_cost:$.z.object({estimated_usd:$.z.number().nonnegative().nullable(),estimated_brl:$.z.number().nonnegative().nullable(),fx_rate:$.z.number().positive().nullable(),pricing_model:$.z.string().nullable(),pricing_source:$.z.string().nullable(),input_usd:$.z.number().nonnegative().nullable(),cached_input_usd:$.z.number().nonnegative().nullable(),output_usd:$.z.number().nonnegative().nullable(),reasoning_usd:$.z.number().nonnegative().nullable()}).strict().nullable().optional(),context_stats:$.z.object({initial_pack_tokens:$.z.number().int().nonnegative().nullable(),tool_output_tokens:$.z.number().int().nonnegative().nullable(),files_opened:$.z.number().int().nonnegative().nullable(),snippets_opened:$.z.number().int().nonnegative().nullable()}).strict().nullable(),discarded_counts:$.z.object({prompt:$.z.number().int().nonnegative(),response_text:$.z.number().int().nonnegative(),reasoning:$.z.number().int().nonnegative(),secrets:$.z.number().int().nonnegative()}).strict()}).strict().superRefine((e,t)=>{e.source==="codex_session_fallback"&&e.coverage==="complete"&&t.addIssue({code:"custom",path:["coverage"],message:"Codex session fallback coverage must be partial or unavailable"}),e.source==="unavailable"&&e.coverage!=="unavailable"&&t.addIssue({code:"custom",path:["coverage"],message:"Unavailable source requires unavailable coverage"}),e.source==="unavailable"&&(e.provider!==null||e.model!==null||e.runtime.reasoning_effort!==null||e.runtime.service_tier!==null||e.latency_ms!==null)&&t.addIssue({code:"custom",path:["source"],message:"Unavailable source cannot contain effective runtime observations"}),e.coverage==="unavailable"&&e.tokens!==null&&e.tokens.source!=="unavailable"&&t.addIssue({code:"custom",path:["tokens","source"],message:"Unavailable coverage cannot contain observed tokens"}),e.event_kind==="terminal"&&e.status===null&&t.addIssue({code:"custom",path:["status"],message:"Terminal telemetry requires status"}),e.event_kind==="error"&&(e.will_retry===!0&&e.status!==null||e.will_retry!==!0&&e.status!=="failed")&&t.addIssue({code:"custom",path:["status"],message:"Retrying errors require null status; terminal errors require failed status"})}),f4=$.z.object({schema_version:$.z.literal(1),event_id:$.z.string().startsWith("CEVT-").max(200),checksum_sha256:$.z.string().regex(/^[a-f0-9]{64}$/),compaction:$.z.object({status:$.z.enum(["pending","compacted"]),compacted_at:Ar.nullable()}).strict(),event:mT}).strict(),gT=$.z.string().startsWith("INV-").max(200),hT=$.z.object({...Yo,type:$.z.literal("model.selection.recorded"),invocation_id:gT,requested:$.z.object({model:$.z.string().min(1).max(200),reasoning_effort:ng.nullable(),velocity:$.z.literal("standard")}).strict(),selection:$.z.object({source:$.z.enum(["execution-override","task-override","auto-policy","project-default"]),policy_version:$.z.number().int().positive(),reasons:$.z.array($.z.string().regex(/^[a-z][a-z0-9-]{0,63}$/)).min(1).max(20)}).strict()}).strict(),yT=$.z.object({...Yo,type:$.z.literal("provider.invocation.finished"),invocation_id:gT,status:$.z.enum(["completed","failed","cancelled"]),effective:$.z.object({provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),reasoning_effort:ng.nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict(),latency_ms:$.z.number().int().nonnegative().nullable()}).strict(),vT=$.z.object({...Yo,type:$.z.literal("run.finished"),phase:hd,status:$.z.enum(["completed","failed","cancelled"]),duration_ms:$.z.number().int().nonnegative().nullable().default(null),duration_provenance:$.z.enum(["observed","reconciled","legacy_inferred","estimated","unavailable"]).nullable().default(null)}).strict(),yd=$.z.discriminatedUnion("type",[dT,_T,pT,hT,yT,QA,vT])});var q3,og=L(()=>{"use strict";vd();q3=64*1024});var ag=L(()=>{"use strict";bt();og();sg();og()});function TT(e){let t=new Map,n=[];for(let i of e){if(i.source_segment_key===null){n.push(i);continue}let r=t.get(i.source_segment_key);if(r===void 0){t.set(i.source_segment_key,i),n.push(i);continue}if(!xT(i,r))throw new Error(`Divergent duplicate source segment: ${i.source_segment_key}`)}return n}function xT(e,t){return JSON.stringify(AT(e))===JSON.stringify(AT(t))}function AT(e){return{phase:e.phase,activity_kind:e.activity_kind,classification_source:e.classification_source,tokens:e.tokens,cost:e.cost,provider:e.provider,model:e.model,source_segment_key:e.source_segment_key,model_call_id:e.model_call_id??null}}var OT=L(()=>{"use strict"});function Ts(e){let t=[],n=null;for(let i of e.split(/\r?\n/).map(r=>r.trim()).filter(Boolean)){let r=JSON.parse(i),o=Array.isArray(r)?S4(r,n):r,a=yd.parse(o);n??=a.run_id,t.push(a)}return t}function xs(e){let t=new Map;for(let f of e){let h=yd.parse(f),k=t.get(h.event_id);if(k!==void 0){if(JSON.stringify(k)!==JSON.stringify(h))throw new Error(`Divergent duplicate Run V2 event: ${h.event_id}`);continue}t.set(h.event_id,h)}let n=[...t.values()].sort((f,h)=>f.sequence-h.sequence);if(n.length===0||n[0]?.type!=="run.started")throw new Error("Run V2 stream must start with run.started");let i=n[0],r=i.phase,o=null,a=null,s=new Map,l=new Map,c=new Map,d=new Map,u=new Map;for(let[f,h]of n.entries()){if(h.run_id!==i.run_id)throw new Error("Run V2 stream mixes run ids");if(h.sequence!==f+1)throw new Error("Run V2 sequence must be contiguous");let k=s.get(h.sequence);if(k!==void 0&&k!==h.event_id)throw new Error(`Run V2 sequence is duplicated: ${h.sequence}`);if(s.set(h.sequence,h.event_id),f>0&&h.type==="run.started")throw new Error("Run V2 has multiple starts");if(o!==null&&!Qm(h,o,l))throw new Error("Run V2 contains a non-retrospective record after run.finished");if(h.type==="usage.recorded"){if(gd(r,h.phase),h.phase==="execution"&&i.execution_id===null&&i.attribution_status!=="legacy_unattributed")throw new Error("Execution phase requires execution_id");if(h.supersedes_event_id!==null&&!l.has(h.supersedes_event_id))throw new Error(`Superseded usage event must occur earlier: ${h.supersedes_event_id}`);l.set(h.event_id,h),r=h.phase}if(h.type==="run.attribution.recovered"){if(!eT(i,h))throw new Error("Run attribution recovery does not match its immutable start header");if(a!==null)throw new Error("Run V2 has multiple attribution recoveries");gd(r,h.phase),r=h.phase,a=h}if(h.type==="model.selection.recorded"){if(k4(i,n.slice(0,f),{invocationId:h.invocation_id,requested:h.requested,selection:h.selection}),c.has(h.invocation_id))throw new Error(`Duplicate model selection for invocation: ${h.invocation_id}`);c.set(h.invocation_id,h)}if(h.type==="provider.invocation.finished"){if(!c.has(h.invocation_id))throw new Error(`Provider invocation requires earlier model selection: ${h.invocation_id}`);if(d.has(h.invocation_id))throw new Error(`Duplicate provider terminal for invocation: ${h.invocation_id}`);d.set(h.invocation_id,h)}if(h.type==="model.call.observed"){let S=u.get(h.call_id);if(S!==void 0&&JSON.stringify(S)!==JSON.stringify(h)&&!Ym(S,h))throw new Error(`Divergent duplicate Model Call: ${h.call_id}`);u.set(h.call_id,h)}if(h.type==="run.finished"){if(h.phase!==r)throw new Error("run.finished phase must match the latest phase");o=h}}let _=n.filter(f=>f.type==="usage.recorded"),p=new Set(_.map(f=>f.supersedes_event_id).filter(f=>f!==null)),y=TT(_.filter(f=>!p.has(f.event_id)));return{run:a===null?i:{...i,phase:a.phase,execution_id:a.execution_id,task_id:a.task_id,change_id:a.change_id},status:o?.status??"running",finished:o,attribution_recovery:a,records:n,usage_records:_,effective_usage_records:y,model_selection_records:[...c.values()],provider_invocation_records:[...d.values()],model_call_records:[...u.values()]}}function S4(e,t){if(e[0]!==3||t===null)throw new Error("Run delta requires transport version 3 and a preceding run.started header");if(e[1]==="f")return{schema_version:2,type:"run.finished",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],phase:e[5],status:e[6]};if(e[1]==="a")return{schema_version:2,type:"run.attribution.recovered",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],phase:e[5],execution_id:e[6],task_id:e[7],change_id:e[8]};if(e[1]==="m"&&Array.isArray(e[6])&&Array.isArray(e[7])){let d=e[6],u=e[7];return{schema_version:2,type:"model.selection.recorded",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],invocation_id:e[5],requested:{model:d[0],reasoning_effort:d[1],velocity:d[2]},selection:{source:u[0],policy_version:u[1],reasons:u[2]}}}if(e[1]==="p"&&Array.isArray(e[7])){let d=e[7];return{schema_version:2,type:"provider.invocation.finished",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],invocation_id:e[5],status:e[6],effective:{provider:d[0],model:d[1],reasoning_effort:d[2],service_tier:d[3]},latency_ms:e[8]}}if(e[1]==="c"&&Array.isArray(e[8])&&Array.isArray(e[9])){let d=e[8],u=e[9],_=e[16];return{schema_version:2,type:"model.call.observed",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],call_id:e[5],agent_invocation_id:e[6],coverage:e[7],tokens:{input:d[0],cached_input:d[1],output:d[2],reasoning:d[3],total:d[4],source:d[5]},cost:{usd:u[0],brl:u[1],fx_rate:u[2]??null},provider:e[10],model:e[11],source_call_key:e[12],...e[13]===null?{}:{source_occurred_at:e[13]},...e[14]===null||e[14]===void 0?{}:{source_started_at:e[14]},...e[15]===null||e[15]===void 0?{}:{source_finished_at:e[15]},..._===null||!Array.isArray(_)?{}:{runtime:{reasoning_effort:_[0],service_tier:_[1]}}}}if(e[1]!=="u"||!Array.isArray(e[8])||!Array.isArray(e[9]))throw new Error("Invalid Run transport v3 delta");let n=e[8],i=e[9],r=e[15],o=e[16],a=e[17],s=e[18],l=e[19],c=e[20];return{schema_version:2,type:"usage.recorded",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],phase:e[5],activity_kind:e[6],classification_source:e[7],tokens:{input:n[0],cached_input:n[1],output:n[2],reasoning:n[3],total:n[4],source:n[5]},cost:{usd:i[0],brl:i[1],fx_rate:i[2]??null},provider:e[10],model:e[11],source_segment_key:e[12],...c==null?{}:{model_call_id:c},supersedes_event_id:e[13],...e[14]===null?{}:{source_occurred_at:e[14]},...a==null?{}:{source_started_at:a},...s==null?{}:{source_finished_at:s},...l===!0?{retrospective_correction:!0}:{},...r===null||!Array.isArray(r)?{}:{context_stats:{initial_pack_tokens:r[0],tool_output_tokens:r[1],files_opened:r[2],snippets_opened:r[3]}},...o===null||!Array.isArray(o)?{}:{runtime:{reasoning_effort:o[0],service_tier:o[1]}}}}function k4(e,t,n){if(e.model!=="unknown"&&n.requested.model!==e.model)throw new Error(`Agent Run model is immutable: expected ${e.model}, received ${n.requested.model}`);if(e.reasoning_effort!==void 0&&e.reasoning_effort!==null&&n.requested.reasoning_effort!==e.reasoning_effort)throw new Error(`Agent Run reasoning effort is immutable: expected ${e.reasoning_effort}, received ${n.requested.reasoning_effort}`);let i=t.find(r=>r.type==="model.selection.recorded");if(i!==void 0){if(JSON.stringify(i.requested)!==JSON.stringify(n.requested))throw new Error(`Agent Run calls must inherit one model configuration: ${e.run_id}`);if(JSON.stringify(i.selection)!==JSON.stringify(n.selection))throw new Error(`Agent Run calls must inherit one selection decision: ${e.run_id}`)}}var RT=L(()=>{"use strict";vd();Xm();OT();ag()});var CT=L(()=>{"use strict"});var sg=L(()=>{"use strict";Gm();ag();vd();RT();CT()});var pe,bd,w4,p5,f5,Os=L(()=>{"use strict";bt();pe=Be(Xe(),1);sg();bd=pe.z.string().datetime({offset:!0}),w4=pe.z.preprocess(e=>e==="client"?"provider_reported":e,pe.z.enum(["provider_reported","estimated","unavailable"])),p5=pe.z.object({id:pe.z.string().regex(/^DEC-(?:HUMAN|AI)-/),title:pe.z.string().min(1),origin:pe.z.enum(["human","agent"]),category:pe.z.enum(["architecture","contract","database","security","dependency","network","infrastructure","cost","implementation"]),status:pe.z.enum(["active","superseded","rejected"]),task:pe.z.string().startsWith("TASK-").nullable(),change:pe.z.string().startsWith("CHG-").nullable(),context:pe.z.string().min(1),decision:pe.z.string().min(1),reason:pe.z.string().min(1),alternatives:pe.z.array(pe.z.string()),consequences:pe.z.array(pe.z.string()),reversible:pe.z.boolean(),rollback:pe.z.string(),confidence:pe.z.number().min(0).max(1).nullable(),created_at:bd,confirmed_at:bd.nullable()}).strict(),f5=pe.z.object({id:pe.z.string().startsWith("RUN-"),task:pe.z.string().startsWith("TASK-"),status:pe.z.enum(["running","completed","failed"]),client:pe.z.string().min(1),agent:pe.z.string().min(1),model:pe.z.string().min(1),started_at:bd,finished_at:bd.nullable(),duration_ms:pe.z.number().int().nonnegative().nullable(),provider:pe.z.string().min(1).nullable().default(null),token_usage:pe.z.object({input:pe.z.number().int().nonnegative().nullable(),cached_input:pe.z.number().int().nonnegative().nullable().default(null),output:pe.z.number().int().nonnegative().nullable(),reasoning:pe.z.number().int().nonnegative().nullable(),total:pe.z.number().int().nonnegative().nullable().default(null),source:w4}),cost:pe.z.object({estimated_usd:pe.z.number().nonnegative().nullable(),estimated_brl:pe.z.number().nonnegative().nullable(),fx_rate:pe.z.number().positive().nullable(),pricing_model:pe.z.string().nullable(),pricing_source:pe.z.string().nullable(),input_usd:pe.z.number().nonnegative().nullable().default(null),cached_input_usd:pe.z.number().nonnegative().nullable().default(null),output_usd:pe.z.number().nonnegative().nullable().default(null),reasoning_usd:pe.z.number().nonnegative().nullable().default(null)}).default({estimated_usd:null,estimated_brl:null,fx_rate:null,pricing_model:null,pricing_source:null,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null}),telemetry:pe.z.object({cycle_count:pe.z.number().int().nonnegative().nullable(),source:pe.z.enum(["repository","local-codex","manual","unavailable"]),segment_key:pe.z.string().nullable()}).default({cycle_count:null,source:"unavailable",segment_key:null}),commands:pe.z.array(pe.z.string()),gates:pe.z.array(pe.z.string()),decisions:pe.z.array(pe.z.string()),evidence:pe.z.array(pe.z.string())}).strict()});function hn(e){let t=e.data;return e.kind==="evidence"?typeof t?.observed_at=="string"?t.observed_at:null:e.kind==="validation"?typeof t?.executed_at=="string"?t.executed_at:null:e.kind==="run"?typeof t?.source_started_at=="string"?t.source_started_at:typeof t?.started_at=="string"?t.started_at:e.updated_at:typeof t?.created_at=="string"?t.created_at:e.updated_at}function Dt(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let i=new Intl.DateTimeFormat("en-CA",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(n),r=l=>i.find(c=>c.type===l)?.value,o=r("year"),a=r("month"),s=r("day");return o===void 0||a===void 0||s===void 0?null:t==="year"?o:t==="month"?`${o}-${a}`:`${o}-${a}-${s}`}function Xi(e,t="execution"){let n=e.filter(c=>cg(c,t)).map(c=>{let d=NT(c),u=c.data?.source_started_at??c.data?.started_at;if(typeof d!="number"||d<0||typeof u!="string")return null;let _=Date.parse(u);return Number.isFinite(_)?{start:_,end:_+d}:null}),i=n.filter(c=>c!==null),r=n.length-i.length,o=i.toSorted((c,d)=>c.start-d.start),a=0,s=Number.NaN,l=Number.NaN;for(let c of o)!Number.isFinite(s)||c.start>l?(Number.isFinite(s)&&(a+=l-s),s=c.start,l=c.end):l=Math.max(l,c.end);return Number.isFinite(s)&&(a+=l-s),{known_sum:a,unknown:r,complete:r===0,coverage_ratio:n.length===0?1:i.length/n.length}}function IT(e,t){let n=new Map,i=r=>{let o=n.get(r)??{intervals:[],known:0,unknown:0};return n.set(r,o),o};for(let r of e.filter(o=>cg(o,"execution"))){let o=r.data?.source_started_at??r.data?.started_at,a=NT(r);if(typeof o!="string")continue;let s=Date.parse(o),l=Dt(o,t);if(!Number.isFinite(s)||l===null||typeof a!="number"||a<0){l!==null&&(i(l).unknown+=1);continue}let c=s+a,d=s;do{let u=Dt(new Date(d).toISOString(),t);if(u===null)break;let _=A4(u,t),p=Math.min(c,_.end),y=i(u);if(y.intervals.push({start:Math.max(s,_.start),end:p}),y.known+=1,p>=c)break;d=p}while(d<=c)}return Object.fromEntries([...n].map(([r,o])=>{let a=o.known+o.unknown;return[r,{known_sum:E4(o.intervals),unknown:o.unknown,complete:o.unknown===0,coverage_ratio:a===0?1:o.known/a}]}))}function NT(e){let t=e.data?.source_duration_ms;if(typeof t=="number")return t;let n=e.data?.duration_ms;return typeof n=="number"?n:null}function cg(e,t){return(t===null||e.data?.phase===t)&&(e.data?.parent_run_id===null||e.data?.parent_run_id===void 0)}function E4(e){let t=e.toSorted((o,a)=>o.start-a.start),n=0,i=Number.NaN,r=Number.NaN;for(let o of t)!Number.isFinite(i)||o.start>r?(Number.isFinite(i)&&(n+=r-i),i=o.start,r=o.end):r=Math.max(r,o.end);return Number.isFinite(i)?n+r-i:n}function A4(e,t){let[n,i="01",r="01"]=e.split("-"),o={year:Number(n),month:Number(i),day:Number(r)},a=new Date(Date.UTC(o.year,o.month-1,o.day));return t==="day"?a.setUTCDate(a.getUTCDate()+1):t==="month"?a.setUTCMonth(a.getUTCMonth()+1,1):a.setUTCFullYear(a.getUTCFullYear()+1,0,1),{start:$T(o.year,o.month,o.day),end:$T(a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate())}}function $T(e,t,n){let i=Date.UTC(e,t-1,n),o=new Intl.DateTimeFormat("en-US",{timeZone:"America/Sao_Paulo",timeZoneName:"longOffset"}).formatToParts(new Date(i)).find(l=>l.type==="timeZoneName")?.value??"GMT",a=/^GMT([+-])(\d{2}):(\d{2})$/.exec(o);if(a===null)return i;let s=(Number(a[2])*60+Number(a[3]))*6e4*(a[1]==="+"?1:-1);return i-s}function lg(e){let t=new Intl.DateTimeFormat("en-CA",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"});return new Set(e.filter(n=>cg(n,"execution")).map(n=>n.data?.source_started_at??n.data?.started_at).filter(n=>typeof n=="string").map(n=>t.format(new Date(n)))).size}var Rs=L(()=>{"use strict"});function MT(e){let t=e.data?.source_duration_ms;if(typeof t=="number")return t;let n=e.data?.duration_ms;return typeof n=="number"?n:null}function LT(e){return e.filter(t=>t.kind==="task").map(t=>({id:t.id,status:t.status,risk:t.risk,updated_at:t.updated_at,finished_at:typeof t.data?.finished_at=="string"?t.data.finished_at:null})).sort((t,n)=>t.id.localeCompare(n.id))}function jT(e){let t=e.filter(l=>l.kind==="prd"||l.kind==="spec"),n=t.filter(l=>l.kind==="spec"),i=e.filter(l=>l.kind==="change"),r=e.filter(l=>l.kind==="task"),o=e.filter(l=>l.kind==="execution"),a=e.filter(l=>l.kind==="run"),s=new Map(t.map(l=>[l.id,l]));return t.map(l=>{let c=new Set(l.kind==="spec"?[l.id]:n.filter(b=>ot(b.data,"prd_id")===l.id).map(b=>b.id)),d=new Set(i.filter(b=>{let O=vi(b.data,"source"),P=ot(O,"type");return l.kind==="prd"&&P==="prd"&&ot(O,"prd_id")===l.id||(P==="spec"||P==="prd")&&c.has(ot(O,"spec_id")??"")}).map(b=>b.id)),u=new Set(r.filter(b=>d.has(ot(b.data,"change_id")??"")).map(b=>b.id));for(let b of O4(l,s))u.add(b);let _=new Set(o.filter(b=>{let O=vi(b.data,"origin"),P=ot(O,"type");return l.kind==="prd"&&P==="prd"&&ot(O,"prd_id")===l.id||P==="spec"&&c.has(ot(O,"spec_id")??"")?!0:C4(b.data).some(C=>u.has(C))}).map(b=>b.id)),p=new Set([l,...n.filter(b=>c.has(b.id))].map(b=>ot(b.data,"creation_run_id")).filter(b=>b!==null)),y=a.filter(b=>{let O=b.data;return p.has(b.id)||c.has(ot(O,"spec_id")??"")||l.kind==="prd"&&ot(O,"prd_id")===l.id||u.has(ot(O,"task_id")??"")||_.has(ot(O,"execution_id")??"")}),f=[...new Map(y.map(b=>[b.id,b])).values()],h=f.filter(b=>b.data?.phase==="execution"&&b.data.parent_run_id==null),k=Xi(f),S=T4(f),R=h.filter(b=>{let O=MT(b),P=b.data?.source_started_at??b.data?.started_at;return typeof O=="number"&&O>=0&&typeof P=="string"&&Number.isFinite(Date.parse(P))}),g=o.filter(b=>_.has(b.id)).map(b=>b.status??"");return{id:l.id,title:l.title??l.id,kind:l.kind,parent_id:l.kind==="spec"?ot(l.data,"prd_id"):null,lifecycle_status:l.status??"draft",work_status:x4(l.status,g),created_at:ot(l.data,"created_at")??l.updated_at,updated_at:l.updated_at,task_count:u.size,run_count:f.length,rework_run_count:f.filter(b=>ot(b.data,"work_type")==="rework").length,canonical_run_ids:f.map(b=>b.id).sort(),root_execution_run_ids:h.map(b=>b.id).sort(),duration_ms:R.length===0?null:k.known_sum,observed_root_duration_ms:R.length===0?null:k.known_sum,observed_lifecycle_duration_ms:S.known_runs===0?null:S.known_sum,duration_coverage:{eligible_runs:h.length,known_runs:R.length,unknown_runs:h.length-R.length,coverage_ratio:h.length===0?1:R.length/h.length},duration_provenance:R.length===0?"unavailable":"observed",lifecycle_duration_coverage:S.coverage,lifecycle_duration_provenance:S.known_runs===0?"unavailable":"observed",total_tokens:PT(f.map(b=>b.usage?.total_tokens??null)),cost:PT(f.map(b=>b.usage?.cost??null))}}).sort((l,c)=>l.id.localeCompare(c.id))}function T4(e){let t=e.filter(c=>c.data?.parent_run_id==null),n=[],i=0;for(let c of t){let d=MT(c),u=c.data?.source_started_at??c.data?.started_at,_=typeof u=="string"?Date.parse(u):Number.NaN;typeof d!="number"||d<0||!Number.isFinite(_)||(i+=1,n.push({start:_,end:_+d}))}let r=n.toSorted((c,d)=>c.start-d.start),o=0,a=Number.NaN,s=Number.NaN;for(let c of r)!Number.isFinite(a)||c.start>s?(Number.isFinite(a)&&(o+=s-a),a=c.start,s=c.end):s=Math.max(s,c.end);Number.isFinite(a)&&(o+=s-a);let l=t.length;return{known_sum:o,known_runs:i,coverage:{eligible_runs:l,known_runs:i,unknown_runs:l-i,coverage_ratio:l===0?1:i/l}}}function x4(e,t){return e==="delivered"?"completed":e==="blocked"?"blocked":e==="failed"?"failed":e==="cancelled"?"cancelled":t.some(n=>n==="running"||n==="paused")?"executing":t.includes("verifying")?"verifying":t.length>0&&t.every(n=>n==="completed")?e==="active"?"verifying":"completed":e==="active"?"executing":t.includes("blocked")?"blocked":t.includes("failed")?"failed":"planning"}function O4(e,t){let n=R4(vi(e.data,"prepared_plan"));if(n.length>0||e.kind!=="spec")return n;let i=ot(e.data,"prd_id"),r=i===null?void 0:t.get(i),o=vi(vi(r?.data??null,"prepared_plan"),"blueprints"),a=new Set(Sd(o,"changes").filter(s=>ot(vi(s,"source"),"spec_id")===e.id).map(s=>ot(s,"id")).filter(s=>s!==null));return Sd(o,"tasks").filter(s=>a.has(ot(s,"change_id")??"")).map(s=>ot(s,"id")).filter(s=>s!==null)}function R4(e){return Sd(vi(e,"blueprints"),"tasks").map(t=>ot(t,"id")).filter(t=>t!==null)}function C4(e){return Sd(vi(e,"dag"),"nodes").map(t=>ot(t,"task_id")).filter(t=>t!==null)}function vi(e,t){let n=e?.[t];return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function Sd(e,t){let n=e?.[t];return Array.isArray(n)?n.filter(i=>typeof i=="object"&&i!==null&&!Array.isArray(i)):[]}function ot(e,t){return typeof e?.[t]=="string"?e[t]:null}function PT(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}var DT=L(()=>{"use strict";Rs()});function kd(e){return e.map(t=>{let n=t.data,i=typeof n?.started_at=="string"?n.started_at:t.updated_at,r=n?.entrypoint_usage!==null&&typeof n?.entrypoint_usage=="object"&&"total"in n.entrypoint_usage?n.entrypoint_usage.total:null,o=r!==null&&typeof r=="object"&&"events"in r?r.events:null;return{id:t.id,started_at:i,finished_at:typeof n?.terminal_finished_at=="string"?n.terminal_finished_at:typeof n?.finished_at=="string"?n.finished_at:null,task_id:typeof n?.task_id=="string"?n.task_id:null,execution_id:typeof n?.execution_id=="string"?n.execution_id:null,conversation_id:typeof n?.conversation_id=="string"?n.conversation_id:typeof n?.client_thread_id=="string"?n.client_thread_id:null,agent:typeof n?.agent=="string"?n.agent:null,agent_name:typeof n?.agent_name=="string"?n.agent_name:typeof n?.agent=="string"?n.agent:null,provider:typeof n?.provider=="string"?n.provider:null,model:typeof n?.effective_model=="string"?n.effective_model:typeof n?.model=="string"?n.model:null,spec_id:typeof n?.spec_id=="string"?n.spec_id:null,prd_id:typeof n?.prd_id=="string"?n.prd_id:null,change_id:typeof n?.change_id=="string"?n.change_id:null,run_kind:n?.run_kind==="run"||n?.run_kind==="subrun"?n.run_kind:null,phase:typeof n?.phase=="string"?n.phase:null,parent_run_id:typeof n?.parent_run_id=="string"?n.parent_run_id:null,status:t.status,duration_ms:typeof n?.source_duration_ms=="number"&&n.source_duration_ms>=0?n.source_duration_ms:typeof n?.duration_ms=="number"&&n.duration_ms>=0?n.duration_ms:null,duration_started_at:typeof n?.source_started_at=="string"?n.source_started_at:i,total_tokens:t.usage?.total_tokens??null,cost:t.usage?.cost??null,currency:t.usage?.currency??null,events:typeof o=="number"&&Number.isFinite(o)?o:null}}).sort((t,n)=>n.started_at.localeCompare(t.started_at))}function ug(e){let t=new Map;for(let n of kd(e)){if(n.task_id===null)continue;let i=t.get(n.task_id)??{task_id:n.task_id,duration_ms:0,total_tokens:0,cost:0,run_count:0,intervals:[]};if(n.phase==="execution"&&n.parent_run_id===null&&n.duration_ms!==null&&typeof n.duration_started_at=="string"){let r=Date.parse(n.duration_started_at);Number.isFinite(r)&&i.intervals.push({start:r,end:r+n.duration_ms})}i.total_tokens+=n.total_tokens??0,i.cost+=n.cost??0,i.run_count+=1,t.set(n.task_id,i)}return[...t.values()].map(({intervals:n,...i})=>({...i,duration_ms:$4(n)})).sort((n,i)=>i.duration_ms-n.duration_ms||n.task_id.localeCompare(i.task_id)).slice(0,5)}function dg(e,t){let n=kd(e).map(o=>o[t]),i=n.filter(o=>o!==null),r=n.length-i.length;return{known_sum:i.reduce((o,a)=>o+a,0),unknown:r,complete:r===0,coverage_ratio:n.length===0?1:i.length/n.length}}function $4(e){let t=0,n=Number.NaN,i=Number.NaN;for(let r of e.toSorted((o,a)=>o.start-a.start))!Number.isFinite(n)||r.start>i?(Number.isFinite(n)&&(t+=i-n),n=r.start,i=r.end):i=Math.max(i,r.end);return Number.isFinite(n)&&(t+=i-n),t}var UT=L(()=>{"use strict"});function I4(e,t=16){let n=0;for(let i of e)n=n*31+i.charCodeAt(0)>>>0;return n%t}function FT(e,t,n=16){let i=Object.fromEntries(zT.map(o=>[o,Array.from({length:n},(a,s)=>`${t}/${o}/${s.toString(16).padStart(2,"0")}.json`)])),r=new Map;for(let o of zT){let a=Object.entries(e.days).flatMap(([s,l])=>l[o].map(c=>({day:s,value:c})));for(let s=0;s<n;s+=1){let l=i[o][s];r.set(l,{schema_version:1,collection:o,shard:s,rows:a.filter(({value:c})=>I4(c.id,n)===s)})}}return{manifest:{schema_version:1,snapshot_id:e.updated_at,source_latest_at:e.source_latest_at,shard_count:n,overview_path:`${t}/overview.json`,collections:i},overview:{schema_version:1,days:Object.fromEntries(Object.entries(e.days).map(([o,a])=>[o,a.overview]))},shards:r}}function qT(e,t,n){let i=Object.fromEntries(Object.entries(t.days).map(([r,o])=>[r,{overview:o,tasks:[],specs:[],prds:[],executions:[],conversations:[]}]));for(let r of n)for(let o of r.rows){let a=i[o.day];a!==void 0&&(a[r.collection]=[...a[r.collection],o.value])}return{schema_version:1,updated_at:e.snapshot_id,source_latest_at:e.source_latest_at,days:i}}var zT,VT=L(()=>{"use strict";zT=["tasks","specs","prds","executions","conversations"]});async function HT(e,t){if(!await e.exists(Qo))return null;let n=JSON.parse(await e.readText(Qo)),i=t===void 0?Object.values(n.collections).flat():t==="overview"?[]:n.collections[t],[r,...o]=await Promise.all([e.readText(n.overview_path).then(a=>JSON.parse(a)),...i.map(a=>e.readText(a).then(s=>JSON.parse(s)))]);return qT(n,r,o)}async function JT(e,t){let n=await e.exists(Qo)?JSON.parse(await e.readText(Qo)):null,i=FT(t,Yi),r={},o=[];for(let[u,_]of Object.entries(i.manifest.collections))r[u]=_.map(p=>{let y=i.shards.get(p),f=_g(y),h=`${Yi}/${u}/${y.shard.toString(16).padStart(2,"0")}-${ZT(f)}.json`;return o.push(WT(e,h,f)),h});let a=_g(i.overview),s=`${Yi}/overview-${ZT(a)}.json`;o.push(WT(e,s,a)),await Promise.all(o);let l={...i.manifest,overview_path:s,collections:r};await e.writeTextAtomic(Qo,_g(l));let c=new Set([Qo,l.overview_path,...Object.values(l.collections).flat(),...n===null?[]:[n.overview_path,...Object.values(n.collections).flat()]]),d=await e.listFiles(Yi,".json");await Promise.all(d.filter(u=>!c.has(u)).map(u=>e.removeFile(u)))}async function WT(e,t,n){await e.exists(t)||await e.writeTextAtomic(t,n)}function _g(e){return`${JSON.stringify(e,null,2)}
236
+ `}function ZT(e){return(0,BT.createHash)("sha256").update(e).digest("hex").slice(0,16)}var BT,Yi,Qo,KT=L(()=>{"use strict";BT=require("node:crypto");VT();Yi=".agents/records/lifecycle/views",Qo=`${Yi}/manifest.json`});function XT(e,t,n,i,r,o){let a=r!==null&&o.size>0,s=a?Object.fromEntries(Object.entries(r.days).filter(([f])=>!o.has(f.slice(0,7)))):{},l=e.filter(f=>{if(f.kind!=="run")return!1;if(!a)return!0;let h=hn(f);return h!==null&&o.has(Dt(h,"month")??"")}),c=new Map(e.map(f=>[f.id,f])),d=N4(e),u=P4(e,l,d),_=new Map;for(let f of l){let h=hn(f);if(h===null)continue;let k=Dt(h,"day");if(k===null)continue;let S=Je(f.data,"execution_id"),R=S===null?void 0:c.get(S),g=fg(R?.data,"origin"),b=Je(f.data,"task_id")??Je(g,"task_id"),O=Je(f.data,"spec_id")??Je(g,"spec_id")??(b===null?null:d.taskToSpec.get(b)??null),P=Je(f.data,"prd_id")??Je(g,"prd_id"),C=b===null?void 0:d.taskToPrd.get(b),v=O===null?void 0:d.specToPrd.get(O),A=P??C??v??null,x=Je(f.data,"conversation_id")??Je(f.data,"client_thread_id")??Je(g,"conversation_id");for(let[T,N]of[["task",b],["spec",O],["prd",A],["execution",S],["conversation",x]])N===null||!u.has(`${T}:${N}`)||GT(_,k,T,N,f)}for(let f of u.values()){if(f.created_at===null)continue;let h=Dt(f.created_at,"day");h!==null&&GT(_,h,f.kind,f.id,null)}let p=Object.keys(t).filter(f=>!a||o.has(f.slice(0,7))).sort(),y=Object.fromEntries(p.map(f=>{let h=t[f];if(h===void 0)throw new Error(`Missing overview for selected day: ${f}`);let k=_.get(f),S=R=>[...k?.get(R)??new Map].flatMap(([g,b])=>{let O=u.get(`${R}:${g}`);return O===void 0?[]:[L4(O,f,b)]}).sort(M4);return[f,{overview:h,tasks:S("task"),specs:S("spec"),prds:S("prd"),executions:S("execution"),conversations:S("conversation")}]}));return{schema_version:1,updated_at:n,source_latest_at:i,days:{...s,...y}}}function N4(e){let t=new Map,n=new Map,i=new Map;for(let a of e)if(a.kind==="change"){let s=fg(a.data,"source"),l=Je(s,"spec_id"),c=Je(s,"prd_id");l!==null&&t.set(a.id,l),c!==null&&n.set(a.id,c)}else if(a.kind==="spec"){let s=Je(a.data,"prd_id");s!==null&&i.set(a.id,s)}let r=new Map,o=new Map;for(let a of e.filter(s=>s.kind==="task")){let s=Je(a.data,"change_id"),l=Je(a.data,"spec_id")??(s===null?null:t.get(s)??null),c=Je(a.data,"prd_id"),d=s===null?void 0:n.get(s),u=l===null?void 0:i.get(l),_=c??d??u??null;l!==null&&r.set(a.id,l),_!==null&&o.set(a.id,_)}return{taskToSpec:r,taskToPrd:o,specToPrd:i}}function P4(e,t,n){let i=new Map;for(let r of e){if(!["task","spec","prd","execution"].includes(r.kind))continue;let o=r.kind,a=r.data??{},s=fg(a,"origin"),l=o==="task"?n.taskToSpec.get(r.id)??n.taskToPrd.get(r.id)??null:o==="spec"?n.specToPrd.get(r.id)??null:o==="execution"?Je(s,"task_id")??Je(s,"spec_id")??Je(s,"prd_id"):null,c=o==="task"?Je(a,"finished_at")??r.updated_at:r.updated_at;i.set(`${o}:${r.id}`,pg(r.id,o,r.title,r.status,r.risk,hn(r),c,l))}for(let r of t){let o=Je(r.data,"execution_id"),a=Je(r.data,"conversation_id")??Je(r.data,"client_thread_id"),s=hn(r);if(o!==null&&!i.has(`execution:${o}`)&&i.set(`execution:${o}`,pg(o,"execution",null,r.status,null,s,s,Je(r.data,"task_id"))),a!==null){let l=`conversation:${a}`,c=i.get(l);(c===void 0||s!==null&&(c.created_at===null||s<c.created_at))&&i.set(l,pg(a,"conversation",null,r.status,null,s,s,o))}}return i}function pg(e,t,n,i,r,o,a,s){return{id:e,title:n??e,kind:t,status:i,risk:r,created_at:o,window_at:a??o??new Date(0).toISOString(),parent_id:s}}function GT(e,t,n,i,r){let o=e.get(t)??new Map,a=o.get(n)??new Map,s=a.get(i)??[];r!==null&&s.push(r),a.set(i,s),o.set(n,a),e.set(t,o)}function Je(e,t){return typeof e=="object"&&e!==null&&typeof e[t]=="string"?e[t]:null}function fg(e,t){if(typeof e!="object"||e===null)return null;let n=e[t];return typeof n=="object"&&n!==null?n:null}function M4(e,t){return t.occurred_at.localeCompare(e.occurred_at)||e.id.localeCompare(t.id)}function L4(e,t,n){let i=U4(n),r=e.kind==="conversation"?null:"execution";return{id:e.id,title:e.title,kind:e.kind,status:e.status,risk:e.risk,occurred_at:hn(i.at(0)??{kind:"task",updated_at:`${t}T00:00:00.000Z`})??`${t}T00:00:00.000Z`,window_at:e.window_at,parent_id:e.parent_id,run_count:i.length,cost_currency:D4(i),lifecycle_elapsed_ms:j4(i,r),metrics:z4(i,r)}}function j4(e,t){let n=e.filter(u=>(t===null||u.data?.phase===t)&&(u.data?.parent_run_id===null||u.data?.parent_run_id===void 0));if(n.length===0)return null;let i=new Set(["completed","failed","cancelled"]),r=n.flatMap(u=>{if(!i.has(u.status??""))return[];let _=Je(u.data,"started_at"),p=Je(u.data,"finished_at"),y=_===null?Number.NaN:Date.parse(_),f=p===null?Number.NaN:Date.parse(p);return Number.isFinite(y)&&Number.isFinite(f)&&f>=y?[{start:y,end:f}]:[]});if(r.length!==n.length)return null;let o=r.toSorted((u,_)=>u.start-_.start),[a,...s]=o;if(a===void 0)return null;let l=0,c=a.start,d=a.end;for(let u of s)u.start>d?(l+=d-c,c=u.start,d=u.end):d=Math.max(d,u.end);return l+d-c}function D4(e){let t=new Set(e.flatMap(i=>i.usage?.currency?[i.usage.currency]:[])),[n]=t;return t.size===1?n??null:null}function U4(e){let t=new Set;return e.filter(n=>{let i=Je(n.data,"source_segment_key")??n.id;return t.has(i)?!1:(t.add(i),!0)})}function z4(e,t){let n=i=>{let r=e.map(i),o=r.filter(s=>s!==null),a=r.length-o.length;return{known_sum:o.reduce((s,l)=>s+l,0),unknown:a,complete:a===0,coverage_ratio:r.length===0?1:o.length/r.length}};return{duration:Xi(e,t),total_tokens:n(i=>i.usage?.total_tokens??null),cost:n(i=>i.usage?.cost??null)}}var YT=L(()=>{"use strict";Rs()});var QT=L(()=>{"use strict"});var ex=L(()=>{"use strict"});var tx=L(()=>{"use strict";QT();ex()});function nx(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return t%rx}function B4(e,t,n=null,i=new Set){let r={},o={},a={};for(let _ of e)if(r[_.kind]=(r[_.kind]??0)+1,_.status!==null){o[_.status]=(o[_.status]??0)+1;let p=a[_.kind]??{};p[_.status]=(p[_.status]??0)+1,a[_.kind]=p}let s=e.filter(_=>_.kind==="run"),l=ox(s),d=n?.run_metrics!==void 0&&i.size>0?J4(e,n,i):{daily:ta(e,"day"),monthly:ta(e,"month"),annual:ta(e,"year")},u=e.map(_=>_.updated_at).sort().at(-1)??null;return{schema_version:1,updated_at:t,freshness:{source_latest_at:u,lag_ms:u===null?null:Math.max(0,Date.parse(t)-Date.parse(u))},counts:{total:e.length,by_kind:r,by_status:o,by_kind_status:a},usage:l,duration:Xi(s),execution_day_count:lg(s),events:dg(s,"events"),run_metrics:kd(s),task_metrics:LT(e),macro_metrics:jT(e),task_status_counts:xd(e,"status"),task_risk_counts:xd(e,"risk"),top_tasks:ug(s),latest_task_created_at:ax(e),periods:d}}function H4(e){let{run_metrics:t,daily_read_models:n,...i}=e;return i}function J4(e,t,n){let i=new Set([...n].map(s=>s.slice(0,4))),r=e.filter(s=>{let l=hn(s),c=l===null?null:Dt(l,"month");return c!==null&&n.has(c)}),o=e.filter(s=>{let l=hn(s),c=l===null?null:Dt(l,"year");return c!==null&&i.has(c)}),a=(s,l)=>Object.fromEntries(Object.entries(s).filter(([c])=>!l(c)));return{daily:{...a(t.periods.daily,s=>n.has(s.slice(0,7))),...ta(r,"day")},monthly:{...a(t.periods.monthly,s=>n.has(s)),...ta(r,"month")},annual:{...a(t.periods.annual,s=>i.has(s)),...ta(o,"year")}}}function K4(e){let t=hn(e),n=t===null?null:Dt(t,"month");if(n===null)return[];let i=e.kind==="run"?e.data?.source_duration_ms:null,r=t===null?Number.NaN:Date.parse(t);if(typeof i!="number"||i<=0||!Number.isFinite(r))return[n];let o=Dt(new Date(r+Math.max(0,i-1)).toISOString(),"month");return o===null||o===n?[n]:[n,o]}function ox(e){let t=i=>{let r=e.map(s=>s.usage?.[i]??null),o=r.filter(s=>s!==null),a=r.length-o.length;return{known_sum:o.reduce((s,l)=>s+l,0),unknown:a,complete:a===0,coverage_ratio:r.length===0?1:o.length/r.length}},n=new Set(e.map(i=>i.usage?.currency).filter(i=>i!==null));return{input_tokens:t("input_tokens"),output_tokens:t("output_tokens"),total_tokens:t("total_tokens"),cost:{...t("cost"),currency:n.size===1?[...n][0]??null:null}}}function ta(e,t){let n=new Map,i=IT(e.filter(r=>r.kind==="run"),t);for(let r of e){let o=hn(r);if(o===null)continue;let a=Dt(o,t);a!==null&&n.set(a,[...n.get(a)??[],r])}return Object.fromEntries([...new Set([...n.keys(),...Object.keys(i)])].sort((r,o)=>r.localeCompare(o)).map(r=>{let o=n.get(r)??[],a=o.filter(s=>s.kind==="run");return[r,{prds:o.filter(s=>s.kind==="prd").length,specs:o.filter(s=>s.kind==="spec").length,tasks:o.filter(s=>s.kind==="task").length,validations:o.filter(s=>s.kind==="validation").length,evidences:o.filter(s=>s.kind==="evidence").length,runs:a.length,usage:ox(a),duration:i[r]??Xi(a),execution_day_count:lg(a),events:dg(a,"events"),task_status_counts:xd(o,"status"),task_risk_counts:xd(o,"risk"),top_tasks:ug(a),latest_task_created_at:ax(o)}]}))}function xd(e,t){let n={};for(let i of e){if(i.kind!=="task")continue;let r=i[t];r!==null&&(n[r]=(n[r]??0)+1)}return n}function ax(e){return e.filter(t=>t.kind==="task").map(t=>typeof t.data?.created_at=="string"?t.data.created_at:t.updated_at).sort().at(-1)??null}function G4(e,t){let n=new Set(["prd","spec","change","task","execution","run"]),i=new Set(["completed","delivered","cancelled","superseded","failed","rolled_back","passed"]);return{schema_version:1,updated_at:t,items:e.filter(r=>n.has(r.kind)&&r.status!==null&&!i.has(r.status)).sort((r,o)=>o.updated_at.localeCompare(r.updated_at)).map(({usage:r,data:o,...a})=>a)}}function Qi(e){return`${JSON.stringify(e,null,2)}
237
+ `}function X4(e){try{return process.kill(e,0),!0}catch(t){return Td(t)&&t.code==="EPERM"}}function Td(e){return e instanceof Error&&"code"in e}function Y4(e){return new Promise(t=>setTimeout(t,e))}var Pe,yn,wd,mg,Cs,Ed,rx,gg,hg,yg,Ad,ix,ea,F4,q4,V4,W4,Z4,vg,Ut,bi=L(()=>{"use strict";Pe=Be(Xe(),1);DT();UT();KT();YT();Rs();tx();Rs();yn=".agents/records/lifecycle",wd=`${yn}/manifest.json`,mg=`${yn}/entity-snapshot.json`,Cs=`${yn}/entity-state.json`,Ed=`${yn}/indexes`,rx=16,gg=`${yn}/summary.json`,hg=`${yn}/overview.json`,yg=`${yn}/active-work.json`,Ad=".local/locks/lifecycle-manifest.lock",ix=Pe.z.enum(["prd","spec","change","task","execution","run","decision","validation","evidence"]),ea=ix.options,F4=Pe.z.enum(["parent","child","references","evidence","requirement"]),q4=Pe.z.enum(["explicit","derived"]),V4=Pe.z.object({target_id:Pe.z.string().min(1),type:F4,direction:Pe.z.enum(["outbound","inbound"]),provenance:q4,source_locator:Pe.z.string().min(1).nullable().default(null)}).strict(),W4=Pe.z.object({input_tokens:Pe.z.number().int().nonnegative().nullable().default(null),output_tokens:Pe.z.number().int().nonnegative().nullable().default(null),cached_input_tokens:Pe.z.number().int().nonnegative().nullable().default(null),total_tokens:Pe.z.number().int().nonnegative().nullable().default(null),cost:Pe.z.number().nonnegative().nullable().default(null),currency:Pe.z.string().min(1).nullable().default(null)}).strict(),Z4=Pe.z.object({kind:ix,id:Pe.z.string().min(1),title:Pe.z.string().min(1).nullable().default(null),status:Pe.z.string().min(1).nullable().default(null),risk:Pe.z.string().min(1).nullable().default(null),priority:Pe.z.string().min(1).nullable().default(null),updated_at:Pe.z.string().datetime({offset:!0}),relations:Pe.z.array(Pe.z.string().min(1)).default([]),relation_edges:Pe.z.array(V4).optional(),usage:W4.nullable().default(null),data:Pe.z.record(Pe.z.string(),Pe.z.unknown()).nullable().default(null)}).strict(),vg=Pe.z.object({schema_version:Pe.z.literal(1),event_id:Pe.z.string().min(1),occurred_at:Pe.z.string().datetime({offset:!0}),operation:Pe.z.enum(["upsert","remove"]),entity:Z4}).strict(),Ut=class{constructor(t){this.filesystem=t}filesystem;async append(t){return this.appendMany([t])}async appendMany(t){let n=t.map(i=>vg.parse(i));return this.withLock(async()=>{let i=new Map;for(let r of n){let o=r.occurred_at.slice(0,7);i.set(o,[...i.get(o)??[],r])}return await Promise.all([...i].map(([r,o])=>this.filesystem.appendText(`${yn}/chunks/${r}.jsonl`,`${o.map(a=>JSON.stringify(a)).join(`
238
+ `)}
239
+ `))),this.refreshUnlocked()})}async refresh(){return this.withLock(()=>this.refreshUnlocked())}async refreshUnlocked(){let t=await this.readJson(wd,{schema_version:1,updated_at:new Date(0).toISOString(),offsets:{}}),n=await this.readStates(),[i,r]=await Promise.all([this.readSummary(),this.readDailyReadModels()]),o=new Set,a=new Set,s=await this.filesystem.exists(Cs)||(await Promise.all(ea.map(f=>this.filesystem.exists(this.aggregateStatePath(f))))).some(Boolean);if(s)for(let f of ea)for(let h=0;h<rx;h+=1)o.add(`${f}:${h}`);let l=await this.filesystem.listFiles(`${yn}/chunks`,".jsonl");for(let f of l){let h=t.offsets[f]??0,k=await this.filesystem.readTextFrom(f,h);for(let S of k.content.split(/\r?\n/).filter(Boolean)){let R=vg.parse(JSON.parse(S)),g=n[R.entity.kind],b=g.entities[R.entity.id];for(let O of[b,R.entity])if(O!==void 0)for(let P of K4(O))a.add(P);R.operation==="remove"?delete g.entities[R.entity.id]:g.entities[R.entity.id]=R.entity,o.add(`${R.entity.kind}:${nx(R.entity.id)}`)}t.offsets[f]=k.nextOffset}if(o.size===0&&!s&&r!==null&&i!==null)return i;let c=new Date().toISOString();t.updated_at=c;let d=ea.flatMap(f=>Object.values(n[f].entities)),u=B4(d,c,i,a),_=XT(d,u.periods.daily,c,u.freshness.source_latest_at,r,a),p=u,y=G4(d,c);return await Promise.all([this.filesystem.writeTextAtomic(wd,Qi(t)),this.filesystem.writeTextAtomic(mg,Qi({schema_version:1,updated_at:c,entities:Object.fromEntries(d.map(f=>[`${f.kind}:${f.id}`,f]))})),...[...o].map(f=>{let[h,k]=f.split(":"),S=Number(k),R=Object.fromEntries(Object.entries(n[h].entities).filter(([g])=>nx(g)===S));return this.filesystem.writeTextAtomic(this.statePath(h,S),Qi({schema_version:1,entities:R}))}),this.filesystem.writeTextAtomic(gg,Qi(p)),this.filesystem.writeTextAtomic(hg,Qi(H4(p))),this.writeDailyReadModels(_),this.filesystem.writeTextAtomic(yg,Qi(y))]),await this.filesystem.exists(Cs)&&await this.filesystem.removeFile(Cs),await Promise.all(ea.map(async f=>{let h=this.aggregateStatePath(f);await this.filesystem.exists(h)&&await this.filesystem.removeFile(h)})),p}async replace(t){return this.withLock(async()=>{let n=new Date().toISOString(),i=`${yn}/chunks/${n.slice(0,7)}.jsonl`,r=t.map(l=>JSON.stringify(vg.parse(l))).join(`
240
+ `),o=await this.filesystem.listFiles(`${yn}/chunks`,".jsonl"),a=await this.filesystem.listFiles(Ed,".json"),s=await this.filesystem.listFiles(Yi,".json");return await Promise.all(o.filter(l=>l!==i).map(l=>this.filesystem.removeFile(l))),await Promise.all([this.filesystem.writeTextAtomic(i,r.length===0?"":`${r}
241
+ `),this.filesystem.writeTextAtomic(wd,Qi({schema_version:1,updated_at:new Date(0).toISOString(),offsets:{}})),this.filesystem.removeFile(mg),this.filesystem.removeFile(Cs),...a.map(l=>this.filesystem.removeFile(l)),...s.map(l=>this.filesystem.removeFile(l))]),this.refreshUnlocked()})}async readSummary(){return await this.filesystem.exists(gg)?JSON.parse(await this.filesystem.readText(gg)):null}async readOverview(){return await this.filesystem.exists(hg)?JSON.parse(await this.filesystem.readText(hg)):this.readSummary()}async readDailyReadModels(t){return await HT(this.filesystem,t)??(await this.readSummary())?.daily_read_models??null}async writeDailyReadModels(t){await JT(this.filesystem,t)}async readActiveWork(){return await this.filesystem.exists(yg)?JSON.parse(await this.filesystem.readText(yg)):null}async readEntities(t){let[n,i]=await Promise.all([this.readJson(wd,null),this.readJson(mg,null)]);if(n!==null&&i!==null&&i.schema_version===1&&i.updated_at===n.updated_at){let o=Object.values(i.entities);return t===void 0?o:o.filter(a=>a.kind===t)}if(t!==void 0)return Object.values((await this.readKindState(t)).entities);let r=await this.readStates();return ea.flatMap(o=>Object.values(r[o].entities))}statePath(t,n){return`${Ed}/${t}/${n.toString(16).padStart(2,"0")}.json`}aggregateStatePath(t){return`${Ed}/${t}.json`}async readStates(){let t=Object.fromEntries(await Promise.all(ea.map(async i=>[i,await this.readKindState(i)]))),n=await this.readJson(Cs,null);for(let i of Object.values(n?.entities??{}))t[i.kind].entities[i.id]=i;return t}async readKindState(t){let n=await this.readJson(this.aggregateStatePath(t),null);if(n!==null)return n;let i=await this.filesystem.listFiles(`${Ed}/${t}`,".json"),r=await Promise.all(i.map(o=>this.readJson(o,null)));return{schema_version:1,entities:Object.assign({},...r.map(o=>o?.entities??{}))}}async readJson(t,n){try{return JSON.parse(await this.filesystem.readText(t))}catch(i){if(Td(i)&&i.code==="ENOENT")return n;throw i}}async withLock(t){for(let n=0;n<80;n+=1)try{await this.filesystem.writeTextExclusive(Ad,`${JSON.stringify({pid:process.pid,acquired_at:new Date().toISOString()})}
242
+ `);try{return await t()}finally{await this.filesystem.removeFile(Ad)}}catch(i){if(!Td(i)||i.code!=="EEXIST")throw i;if(await this.removeStaleLock())continue;await Y4(Math.min(100,10+n*2))}throw new Error("Lifecycle manifest is busy; retry the operation")}async removeStaleLock(){try{let t=JSON.parse(await this.filesystem.readText(Ad));if(typeof t.pid!="number"||!X4(t.pid))return await this.filesystem.removeFile(Ad),!0}catch(t){return!!(Td(t)&&t.code==="ENOENT")}return!1}}});var sx=L(()=>{"use strict"});var bg,z5,cx=L(()=>{"use strict";bg=["objective","requirement_ids","acceptance_ids","write_scopes"],z5={simple:{level:"simple",requiredFields:[...bg,"verification"],optionalFields:["risk_notes","rollback"],maximumUnresolvedQuestions:0},standard:{level:"standard",requiredFields:[...bg,"included_scope","excluded_scope","design","risks","verification","rollback"],optionalFields:["rollout","open_questions"],maximumUnresolvedQuestions:2},complex:{level:"complex",requiredFields:[...bg,"problem","outcomes","included_scope","excluded_scope","architecture","security","dag","budgets","risks","rollout","rollback","verification","independent_reviewer"],optionalFields:["open_questions"],maximumUnresolvedQuestions:3}}});var lx=L(()=>{"use strict";sx();cx()});var Oe,Od,Z5,B5,Sg=L(()=>{"use strict";Oe=Be(Xe(),1),Od=Oe.z.enum(["test","eval","check","review","spec_review","quality_review","mutation","integration","cross_spec_e2e"]),Z5=Oe.z.object({schema_version:Oe.z.literal(2),assurance_version:Oe.z.literal(1),profile:Oe.z.enum(["task-lite","task-standard-2","task-standard-3","task-critical"]),risk:Oe.z.enum(["lite","standard","critical"]),minimum_validation_artifacts:Oe.z.number().int().positive(),maximum_validation_artifacts:Oe.z.number().int().positive().nullable(),minimum_evidence_artifacts:Oe.z.number().int().positive(),maximum_evidence_artifacts:Oe.z.number().int().positive().nullable(),minimum_distinct_modalities:Oe.z.number().int().positive(),complete_acceptance_coverage:Oe.z.literal(!0),evidence_per_acceptance:Oe.z.boolean(),requires_independent_verifier:Oe.z.boolean(),requires_mutation_discrimination:Oe.z.boolean(),minimum_mutation_kill_ratio:Oe.z.number().min(0).max(1).nullable(),requires_rollback:Oe.z.boolean(),requires_final_commit_evidence:Oe.z.boolean(),requires_test:Oe.z.boolean(),required_modalities:Oe.z.array(Od)}).strict().superRefine((e,t)=>{e.maximum_validation_artifacts!==null&&e.maximum_validation_artifacts<e.minimum_validation_artifacts&&t.addIssue({code:"custom",path:["maximum_validation_artifacts"],message:"maximum validation artifacts cannot be lower than the minimum"}),e.maximum_evidence_artifacts!==null&&e.maximum_evidence_artifacts<e.minimum_evidence_artifacts&&t.addIssue({code:"custom",path:["maximum_evidence_artifacts"],message:"maximum Evidence artifacts cannot be lower than the minimum"})}),B5=Oe.z.object({schema_version:Oe.z.literal(2),assurance_version:Oe.z.literal(1),profile:Oe.z.enum(["spec-delivery","prd-delivery"]),origin:Oe.z.enum(["spec","prd"]),minimum_parent_validation_artifacts:Oe.z.number().int().positive(),minimum_parent_evidence_artifacts:Oe.z.number().int().positive(),minimum_distinct_modalities:Oe.z.number().int().positive(),complete_acceptance_coverage:Oe.z.literal(!0),requires_acceptance_matrix:Oe.z.literal(!0),requires_independent_verifier:Oe.z.literal(!0),integration_modality:Oe.z.enum(["integration","cross_spec_e2e"]),evidence_per_acceptance:Oe.z.boolean(),evidence_per_outcome:Oe.z.boolean(),requires_mutation_discrimination:Oe.z.boolean(),minimum_mutation_kill_ratio:Oe.z.number().min(0).max(1).nullable(),requires_rollback:Oe.z.boolean(),requires_final_commit_evidence:Oe.z.boolean(),required_modalities:Oe.z.array(Od).min(3)}).strict()});function na(e){return ze.z.array(e).superRefine((t,n)=>{let i=new Set;for(let[r,o]of t.entries())i.has(o)&&n.addIssue({code:"custom",path:[r],message:`duplicate value: ${o}`}),i.add(o)})}function fx(e,t,n){e==="not_applicable"&&t===null&&n.addIssue({code:"custom",path:["not_applicable_reason"],message:"not-applicable artifacts require a reason"}),e!=="not_applicable"&&t!==null&&n.addIssue({code:"custom",path:["not_applicable_reason"],message:"applicable artifacts cannot retain a not-applicable reason"})}function Q4(e){return e==="review"||e==="spec_review"||e==="quality_review"}var ze,dx,_x,px,ux,K5,G5,mx=L(()=>{"use strict";ze=Be(Xe(),1);Sg();dx=ze.z.string().datetime({offset:!0}),_x=ze.z.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/).nullable(),px=na(ze.z.string().startsWith("AC-")).min(1),ux={test:"TEST-",eval:"EVAL-",check:"CHECK-",review:"REVIEW-",spec_review:"REVIEW-SPEC-",quality_review:"REVIEW-QUALITY-",mutation:"MUT-",integration:"INT-",cross_spec_e2e:"E2E-"},K5=ze.z.object({schema_version:ze.z.literal(2),id:ze.z.string().min(1),kind:Od,task_id:ze.z.string().startsWith("TASK-"),change_id:ze.z.string().startsWith("CHG-"),execution_id:ze.z.string().startsWith("EXEC-"),run_id:ze.z.string().startsWith("RUN-"),acceptance_ids:px,executed_at:dx,command:ze.z.string().min(1).nullable(),status:ze.z.enum(["passed","failed","not_applicable"]),asserted_outcomes:na(ze.z.string().min(1)).min(1),locators:na(ze.z.string().min(1)).min(1),author_id:ze.z.string().min(1),commit_sha:_x,not_applicable_reason:ze.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{e.id.startsWith(ux[e.kind])||t.addIssue({code:"custom",path:["id"],message:`${e.kind} validation id must start with ${ux[e.kind]}`}),!Q4(e.kind)&&e.command===null&&t.addIssue({code:"custom",path:["command"],message:`${e.kind} validation requires its executed command`}),fx(e.status,e.not_applicable_reason,t)}),G5=ze.z.object({schema_version:ze.z.literal(2),id:ze.z.string().startsWith("EVD-"),task_id:ze.z.string().startsWith("TASK-"),change_id:ze.z.string().startsWith("CHG-"),execution_id:ze.z.string().startsWith("EXEC-"),run_id:ze.z.string().startsWith("RUN-"),acceptance_ids:px,outcome_ids:na(ze.z.string().startsWith("OUT-")).default([]),validation_artifact_ids:na(ze.z.string().min(1)).min(1),observed_at:dx,status:ze.z.enum(["passed","not_applicable"]),summary:ze.z.string().min(1),locators:na(ze.z.string().min(1)).min(1),commit_sha:_x,not_applicable_reason:ze.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{fx(e.status,e.not_applicable_reason,t)})});var gx=L(()=>{"use strict"});var hx=L(()=>{"use strict"});var yx=L(()=>{"use strict";mx();gx();Sg();hx()});var vx=L(()=>{"use strict"});var bx=L(()=>{"use strict";vx()});function kx(e){return(0,Sx.createHash)("sha256").update(JSON.stringify(kg(e))).digest("hex")}function kg(e){return Array.isArray(e)?e.map(kg):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>[t,kg(n)])):e}var Sx,wx=L(()=>{"use strict";Sx=require("node:crypto")});async function $d(e,t,n){if(e===null)throw new TypeError("SPEC requires an implementation stack snapshot before prepare or execute");let i=n.projectConfig?.stack;if(i===void 0)throw new TypeError("SPEC stack validation requires .agents/config/project.yaml");if(e.stack_profile!==i.id)throw new TypeError(`SPEC stack_profile ${e.stack_profile} does not match project stack.id ${i.id}`);if(Rd(e.stack_overrides)!==Rd(i.overrides))throw new TypeError("SPEC stack_overrides do not match project stack.overrides");for(let r of e.stack_components){if(!await t.exists(r.version_source))throw new TypeError(`SPEC stack component ${r.name} has missing version source ${r.version_source}`);if(!(await t.readText(r.version_source)).includes(r.version))throw new TypeError(`SPEC stack component ${r.name} version source ${r.version_source} does not contain exact version ${r.version}`)}}function Rd(e){return Array.isArray(e)?`[${e.map(Rd).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${Rd(n)}`).join(",")}}`:JSON.stringify(e)}var Yt,eB,tB,nB,Cd,ra=L(()=>{"use strict";Yt=Be(Xe(),1),eB=Yt.z.string().min(1).superRefine((e,t)=>{(e.toLowerCase()==="latest"||/[<>=~^*|,\s]/.test(e)||/(?:^|[.-])[xX](?:$|[.-])/.test(e))&&t.addIssue({code:"custom",message:"Expected an exact resolved version, not a range, wildcard, or moving tag"})}),tB=Yt.z.string().min(1).superRefine((e,t)=>{(e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||/^[A-Za-z]:/.test(e)||e.split("/").some(n=>n.length===0||n==="."||n===".."))&&t.addIssue({code:"custom",message:"version_source must be a canonical workspace-relative file path"})}),nB=Yt.z.object({name:Yt.z.string().min(1),kind:Yt.z.enum(["language","runtime","framework","library","persistence","database","tooling","platform"]),version:eB,version_source:tB}).strict(),Cd=Yt.z.object({stack_profile:Yt.z.string().min(1),stack_overrides:Yt.z.record(Yt.z.string(),Yt.z.unknown()),stack_description:Yt.z.string().min(20),stack_components:Yt.z.array(nB).min(1)}).strict().superRefine((e,t)=>{e.stack_components.some(i=>i.kind==="language")||t.addIssue({code:"custom",path:["stack_components"],message:"SPEC implementation requires at least one exact programming language"});let n=e.stack_description.toLocaleLowerCase("en");for(let[i,r]of e.stack_components.entries())(!n.includes(r.name.toLocaleLowerCase("en"))||!n.includes(r.version.toLocaleLowerCase("en")))&&t.addIssue({code:"custom",path:["stack_components",i],message:`stack_description must mention ${r.name} ${r.version}`})})});var vn,zt,ia,eo,Si,oa,It,aa,ki,to,Ex,wg=L(()=>{"use strict";vn=Be(Xe(),1),zt=vn.z.string().datetime({offset:!0}),ia=vn.z.string().regex(/^[a-f0-9]{64}$/),eo=vn.z.string().startsWith("PRD-"),Si=vn.z.string().startsWith("SPEC-"),oa=vn.z.string().startsWith("CHG-"),It=vn.z.string().startsWith("TASK-"),aa=vn.z.string().startsWith("EXEC-"),ki=vn.z.string().startsWith("REQ-"),to=vn.z.string().startsWith("AC-"),Ex=vn.z.string().startsWith("OUT-")});function Is(e){return ca.parse({revision:e.revision,hash:e.hash,execution_id:e.execution_id})}function Ix(e){let t=[],n=new Map(e.blueprints.changes.map(c=>[c.id,c])),i=new Map(e.blueprints.tasks.map(c=>[c.id,c])),r=new Map((e.blueprints.specs??[]).map(c=>[c.id,c]));$s(e.blueprints.changes.map(c=>c.key),"duplicate-key",["blueprints","changes"],t),$s((e.blueprints.specs??[]).map(c=>c.id),"duplicate-id",["blueprints","specs"],t),$s(e.blueprints.tasks.map(c=>c.key),"duplicate-key",["blueprints","tasks"],t),$s([...e.blueprints.changes,...e.blueprints.tasks].map(c=>c.id),"duplicate-id",["blueprints"],t);for(let[c,d]of e.blueprints.tasks.entries()){d.model_profile!==void 0&&d.risk!==d.model_profile.risk&&t.push({rule:"risk-classification",path:["blueprints","tasks",c,"risk"],message:`Task risk ${d.risk} does not match classified risk ${d.model_profile.risk}`});let u=n.get(d.change_id);if(u===void 0){t.push({rule:"missing-change",path:["blueprints","tasks",c,"change_id"],message:`${d.change_id} does not resolve`});continue}for(let _ of d.requirement_ids)u.requirement_ids.includes(_)||t.push({rule:"requirement-outside-change",path:["blueprints","tasks",c,"requirement_ids"],message:`${_} is absent from ${u.id}`});for(let _ of d.acceptance_ids)u.acceptance_ids.includes(_)||t.push({rule:"acceptance-outside-change",path:["blueprints","tasks",c,"acceptance_ids"],message:`${_} is absent from ${u.id}`})}for(let[c,d]of e.blueprints.changes.entries())[...i.values()].some(u=>u.change_id===d.id)||t.push({rule:"change-without-task",path:["blueprints","changes",c],message:`${d.id} has no task`}),dB(e.source,d.source)||t.push({rule:"source-mismatch",path:["blueprints","changes",c,"source"],message:`${d.id} source does not match the prepared plan source`}),e.source.type==="prd"&&d.source.type==="prd"&&d.source.spec_id===null&&t.push({rule:"prd-change-without-spec",path:["blueprints","changes",c,"source","spec_id"],message:`${d.id} must belong to a SPEC of ${e.source.prd_id}`}),e.source.type==="prd"&&d.source.type==="prd"&&d.source.spec_id!==null&&e.blueprints.specs!==void 0&&!r.has(d.source.spec_id)&&t.push({rule:"missing-spec-blueprint",path:["blueprints","changes",c,"source","spec_id"],message:`${d.source.spec_id} requires a composite SPEC blueprint`});if(e.blueprints.specs!==void 0&&e.source.type==="prd"){let c=e.source.prd_id,d=new Set(e.blueprints.changes.flatMap(_=>_.source.type==="prd"&&_.source.prd_id===c?[_.source.spec_id]:[]));for(let[_,p]of e.blueprints.specs.entries()){d.has(p.id)||t.push({rule:"orphan-spec-blueprint",path:["blueprints","specs",_,"id"],message:`${p.id} has no PRD Change`});for(let y of p.requirement_ids)e.blueprints.changes.some(f=>f.source.type==="prd"&&f.source.spec_id===p.id&&f.requirement_ids.includes(y))||t.push({rule:"orphan-spec-blueprint",path:["blueprints","specs",_,"requirement_ids"],message:`${y} is not used by ${p.id}`});for(let y of p.acceptance_ids)e.blueprints.changes.some(f=>f.source.type==="prd"&&f.source.spec_id===p.id&&f.acceptance_ids.includes(y))||t.push({rule:"orphan-spec-blueprint",path:["blueprints","specs",_,"acceptance_ids"],message:`${y} is not used by ${p.id}`})}let u=new Map(e.blueprints.tasks.map(_=>{let p=n.get(_.change_id);return[_.id,p?.source.type==="prd"?p.source.spec_id:null]}));for(let[_,p]of e.dag.nodes.entries())for(let y of p.depends_on){let f=u.get(p.task_id),h=u.get(y);f!==null&&h!==null&&f!==h&&t.push({rule:"cross-spec-dependency",path:["dag","nodes",_,"depends_on"],message:`${p.task_id} crosses SPEC boundary; compose it into one SPEC instead`})}for(let _=0;_<e.blueprints.specs.length;_+=1)for(let p=_+1;p<e.blueprints.specs.length;p+=1){let y=e.blueprints.specs[_],f=e.blueprints.specs[p];if(y===void 0||f===void 0)continue;let h=y.included_scope.find(k=>f.included_scope.some(S=>Ax(k,S)));h!==void 0&&t.push({rule:"overlapping-spec-scope",path:["blueprints","specs"],message:`${y.id} and ${f.id} overlap at ${h}; compose them into one SPEC`})}}e.source.type==="spec"&&e.blueprints.specs!==void 0&&(e.blueprints.specs.length!==1||e.blueprints.specs[0]?.id!==e.source.spec_id)&&t.push({rule:"missing-spec-blueprint",path:["blueprints","specs"],message:`SPEC plan must contain exactly its source blueprint ${e.source.spec_id}`}),e.source.type==="task"&&!i.has(e.source.task_id)&&t.push({rule:"missing-task",path:["source","task_id"],message:`${e.source.task_id} does not resolve`});let o=new Map(e.dag.nodes.map(c=>[c.task_id,c]));$s(e.dag.nodes.map(c=>c.task_id),"duplicate-id",["dag","nodes"],t);for(let c of i.values())o.has(c.id)||t.push({rule:"missing-task",path:["dag","nodes"],message:`${c.id} is missing from the DAG`});for(let[c,d]of e.dag.nodes.entries()){i.has(d.task_id)||t.push({rule:"missing-task",path:["dag","nodes",c,"task_id"],message:`${d.task_id} does not resolve`});for(let u of d.depends_on)u===d.task_id?t.push({rule:"self-dependency",path:["dag","nodes",c,"depends_on"],message:`${d.task_id} depends on itself`}):i.has(u)||t.push({rule:"missing-dependency",path:["dag","nodes",c,"depends_on"],message:`${u} does not resolve`})}let a=lB(e.dag.nodes);if(a.length!==i.size?t.push({rule:"cycle",path:["dag"],message:"DAG contains a cycle"}):JSON.stringify(a)!==JSON.stringify(e.dag.topological_order)&&t.push({rule:"topological-order",path:["dag","topological_order"],message:"topological_order is not canonical"}),a.length===i.size){let c=uB(e.dag.nodes),d=[...i.values()];for(let u=0;u<d.length;u+=1)for(let _=u+1;_<d.length;_+=1){let p=d[u],y=d[_];if(p===void 0||y===void 0)continue;let f=p.write_scopes.find(k=>y.write_scopes.some(S=>Ax(k,S)));if(f===void 0)continue;c.get(p.id)?.has(y.id)===!0||c.get(y.id)?.has(p.id)===!0||t.push({rule:"overlapping-write-scope",path:["blueprints","tasks"],message:`${p.id} and ${y.id} may overlap at ${f}; add a DAG dependency`})}}let{hash:s,...l}=e;return kx(l)!==e.hash&&t.push({rule:"hash",path:["hash"],message:"prepared plan hash does not match"}),t}function lB(e){let t=new Set(e.map(a=>a.task_id)),n=new Map(e.map(a=>[a.task_id,0])),i=new Map;for(let a of e)for(let s of new Set(a.depends_on))!t.has(s)||s===a.task_id||(n.set(a.task_id,(n.get(a.task_id)??0)+1),i.set(s,[...i.get(s)??[],a.task_id]));let r=[...n].filter(([,a])=>a===0).map(([a])=>a).sort(),o=[];for(;r.length>0;){let a=r.shift();o.push(a);for(let s of(i.get(a)??[]).sort()){let l=(n.get(s)??0)-1;n.set(s,l),l===0&&(r.push(s),r.sort())}}return o}function Nx(e,t){if(e.source.type!=="prd"||e.source.prd_id!==t)throw new TypeError(`Prepared plan source must be prd ${t}`);let n=e.blueprints.changes.map(i=>{if(i.source.type!=="prd"||i.source.prd_id!==t||i.source.spec_id===null)throw new TypeError(`Every PRD Change must belong to a SPEC of ${t}`);return i.source.spec_id});return[...new Set(n)].sort()}function uB(e){let t=new Map(e.map(r=>[r.task_id,r.depends_on])),n=new Map,i=(r,o)=>{let a=n.get(r);if(a!==void 0)return a;if(o.has(r))return new Set;let s=new Set;for(let l of t.get(r)??[]){s.add(l);for(let c of i(l,new Set([...o,r])))s.add(c)}return n.set(r,s),s};for(let r of t.keys())i(r,new Set);return n}function Ax(e,t){if(e===t)return!0;let n=e.search(/[*?]/),i=t.search(/[*?]/);if(n===-1&&i===-1)return!1;let r=e.slice(0,n===-1?e.length:n).replace(/\/$/,""),o=t.slice(0,i===-1?t.length:i).replace(/\/$/,"");return r===o||r.startsWith(`${o}/`)||o.startsWith(`${r}/`)}function dB(e,t){return e.type!==t.type?!1:e.type==="task"&&t.type==="task"?e.task_id===t.task_id:e.type==="spec"&&t.type==="spec"?e.spec_id===t.spec_id:e.type==="prd"&&t.type==="prd"&&e.prd_id===t.prd_id}function $s(e,t,n,i){let r=new Set;for(let o of e)r.has(o)&&i.push({rule:t,path:n,message:`Duplicate value: ${o}`}),r.add(o)}function Qt(e,t,n){let i=new Set;for(let r of e)i.has(r)&&n.addIssue({code:"custom",path:[t],message:`Duplicate value: ${r}`}),i.add(r)}var Y,sa,rB,ca,la,Ag,Tg,Tx,iB,xg,xx,Eg,Ox,Rx,Cx,oB,aB,$x,sB,cB,Jr,Ns=L(()=>{"use strict";bt();Y=Be(Xe(),1);wx();ra();wg();sa=Y.z.enum(["lite","standard","critical"]),rB=Y.z.enum(["low","medium","high","urgent"]),ca=Y.z.object({revision:Y.z.number().int().positive(),hash:ia,execution_id:aa}).strict();la=Y.z.discriminatedUnion("type",[Y.z.object({type:Y.z.literal("task"),task_id:It}).strict(),Y.z.object({type:Y.z.literal("spec"),spec_id:Si}).strict(),Y.z.object({type:Y.z.literal("prd"),prd_id:eo}).strict()]),Ag=Y.z.discriminatedUnion("type",[Y.z.object({type:Y.z.literal("task"),task_id:It}).strict(),Y.z.object({type:Y.z.literal("spec"),spec_id:Si}).strict(),Y.z.object({type:Y.z.literal("prd"),prd_id:eo,spec_id:Si.nullable()}).strict()]),Tg=Y.z.discriminatedUnion("type",[Y.z.object({type:Y.z.literal("none"),reason:Y.z.string().min(1)}).strict(),Y.z.object({type:Y.z.literal("update"),requirement_ids:Y.z.array(ki).min(1)}).strict()]),Tx=Y.z.object({model:tk,reasoning_effort:nk,velocity:Pp.optional()}).strict(),iB=Tx.extend({client:Y.z.string().min(1),provider:Y.z.string().min(1)}).strict(),xg=Y.z.object({failure_policy:Y.z.enum(["stop_on_terminal_failure","continue_independent"]),max_parallelism:Y.z.number().int().positive(),independent_branches:Y.z.boolean().optional(),max_cost_usd:Y.z.number().nonnegative().nullable().optional(),max_operational_retries:Y.z.number().int().nonnegative(),max_repair_cycles_per_task:Y.z.number().int().nonnegative(),soft_model_cycle_budget:Y.z.number().int().positive().optional(),soft_input_token_budget:Y.z.number().int().positive().optional(),context_refresh_after_cycles:Y.z.number().int().positive().optional(),verification_mode:Y.z.enum(["scoped","full"]).optional(),runtime_defaults:iB.optional()}).strict(),xx=Y.z.string().regex(/^[a-z][a-z0-9-]*$/),Eg=Y.z.string().min(1).superRefine((e,t)=>{(e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||/^[A-Za-z]:/.test(e)||e.split("/").some(n=>n.length===0||n==="."||n===".."))&&t.addIssue({code:"custom",message:"write_scope must be workspace-relative"})}),Ox=Y.z.object({key:xx,id:oa,title:Y.z.string().min(1),short_name:Y.z.string().min(1),risk:sa,source:Ag,requirement_ids:Y.z.array(ki).min(1),acceptance_ids:Y.z.array(to).min(1),requirement_impact:Tg}).strict().superRefine((e,t)=>{Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t)}),Rx=Y.z.object({id:Si,title:Y.z.string().min(1),short_name:Y.z.string().min(1),objective:Y.z.string().min(1),summary:Y.z.string().min(1),risk:sa,included_scope:Y.z.array(Eg).min(1),excluded_scope:Y.z.array(Eg),requirement_ids:Y.z.array(ki).min(1),acceptance_ids:Y.z.array(to).min(1),implementation:Cd,rollout:Y.z.string().min(1),fallback:Y.z.string().min(1),model_signals:Gl}).strict().superRefine((e,t)=>{Qt(e.included_scope,"included_scope",t),Qt(e.excluded_scope,"excluded_scope",t),Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t)}),Cx={key:xx,id:It,change_id:oa,title:Y.z.string().min(1),short_name:Y.z.string().min(1),objective:Y.z.string().min(1),priority:rB,owner:Y.z.string().min(1).nullable(),requirement_ids:Y.z.array(ki).min(1),acceptance_ids:Y.z.array(to).min(1),write_scopes:Y.z.array(Eg),runtime:Tx.optional()},oB=Y.z.object({...Cx,risk:sa,model_profile:Pi.optional()}).strict().superRefine((e,t)=>{Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t),Qt(e.write_scopes,"write_scopes",t)}),aB=Y.z.object({...Cx,risk:sa.optional(),model_signals:Gl.optional(),model_profile:Pi.optional()}).strict().superRefine((e,t)=>{Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t),Qt(e.write_scopes,"write_scopes",t)}),$x=Y.z.object({task_id:It,depends_on:Y.z.array(It)}).strict().superRefine((e,t)=>{e.depends_on.includes(e.task_id)&&t.addIssue({code:"custom",path:["depends_on"],message:"self dependency"}),Qt(e.depends_on,"depends_on",t)}),sB=Y.z.object({revision:Y.z.number().int().positive(),source:la,execution_id:aa,prepared_at:zt,policy:xg,blueprints:Y.z.object({specs:Y.z.array(Rx).min(1).optional(),changes:Y.z.array(Ox).min(1),tasks:Y.z.array(aB).min(1)}).strict(),dag:Y.z.object({nodes:Y.z.array($x).min(1)}).strict()}).strict(),cB=sB.extend({schema_version:Y.z.literal(2),blueprints:Y.z.object({specs:Y.z.array(Rx).min(1).optional(),changes:Y.z.array(Ox).min(1),tasks:Y.z.array(oB).min(1)}).strict(),dag:Y.z.object({nodes:Y.z.array($x).min(1),topological_order:Y.z.array(It).min(1)}).strict(),hash:ia}).strict(),Jr=cB.superRefine((e,t)=>{for(let n of Ix(e))t.addIssue({code:"custom",path:[...n.path],message:n.message})})});function bB(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t=e;return Object.hasOwn(t,"outcome_ids")||typeof t.id!="string"||!Array.isArray(t.outcomes)?e:{...t,outcome_ids:Og(t.id,t.outcomes)}}function Og(e,t){let n=e.replace(/^PRD-/,"OUT-");return t.map((i,r)=>`${n}-${String(r+1).padStart(2,"0")}`)}var V,_B,wi,Kr,Ei,Ps,pB,fB,Ms,mB,gB,hB,yB,vB,ln,Id=L(()=>{"use strict";V=Be(Xe(),1);Ns();ra();wg();Ns();ra();_B=V.z.object({schema_version:V.z.literal(2),id:eo,revision:V.z.number().int().positive(),title:V.z.string().min(1),status:V.z.enum(["draft","ready","active","delivered","blocked","failed","cancelled"]),status_reason:V.z.string().min(1).nullable().default(null),outcome_status:V.z.enum(["unmeasured","measuring","met","not_met","inconclusive"]),problem:V.z.string().min(1),audiences:V.z.array(V.z.string().min(1)),outcomes:V.z.array(V.z.string().min(1)),outcome_ids:V.z.array(Ex),constraints:V.z.array(V.z.string().min(1)),non_goals:V.z.array(V.z.string().min(1)),prepared_plan:Jr.nullable(),plan_ref:ca.nullable().default(null),creation_run_id:V.z.string().startsWith("RUN-").nullable().default(null),rework_of_prd_id:eo.nullable().default(null),tags:V.z.array(V.z.string().min(1)).default([]),created_at:zt,updated_at:zt}).strict().superRefine((e,t)=>{e.prepared_plan!==null&&e.plan_ref!==null&&t.addIssue({code:"custom",message:"PRD cannot contain prepared_plan and plan_ref"}),e.outcome_ids.length!==e.outcomes.length&&t.addIssue({code:"custom",path:["outcome_ids"],message:"PRD outcome_ids must identify every declared outcome exactly once"}),new Set(e.outcome_ids).size!==e.outcome_ids.length&&t.addIssue({code:"custom",path:["outcome_ids"],message:"PRD outcome_ids must be unique"})}),wi=V.z.preprocess(bB,_B),Kr=V.z.object({schema_version:V.z.literal(2),id:Si,prd_id:eo.nullable(),revision:V.z.number().int().positive(),title:V.z.string().min(1),status:V.z.enum(["draft","ready","active","delivered","blocked","failed","cancelled"]),status_reason:V.z.string().min(1).nullable().default(null),objective:V.z.string().min(1),included_scope:V.z.array(V.z.string().min(1)),excluded_scope:V.z.array(V.z.string().min(1)),requirement_ids:V.z.array(ki),acceptance_ids:V.z.array(to),implementation:Cd.nullable().default(null),prepared_plan:Jr.nullable(),plan_ref:ca.nullable().default(null),creation_run_id:V.z.string().startsWith("RUN-").nullable().default(null),created_at:zt,updated_at:zt}).strict().superRefine((e,t)=>{e.prepared_plan!==null&&e.plan_ref!==null&&t.addIssue({code:"custom",message:"SPEC cannot contain prepared_plan and plan_ref"})}),Ei=V.z.object({schema_version:V.z.literal(2),id:oa,revision:V.z.number().int().positive(),title:V.z.string().min(1),status:V.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),status_reason:V.z.string().min(1).nullable().optional(),risk:sa,source:Ag,requirement_ids:V.z.array(ki).min(1),acceptance_ids:V.z.array(to).min(1),requirement_impact:Tg,task_ids:V.z.array(It).min(1),plan_revision:V.z.number().int().positive().nullable(),plan_hash:ia.nullable(),created_at:zt,updated_at:zt,started_at:zt.nullable(),finished_at:zt.nullable(),result:V.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{let n=e.plan_revision===null&&e.plan_hash===null;e.status==="draft"||(e.status==="blocked"||e.status==="cancelled")&&n?n||t.addIssue({code:"custom",message:"draft Change cannot contain a prepared plan"}):(n||e.plan_revision===null||e.plan_hash===null)&&t.addIssue({code:"custom",message:`${e.status} Change requires plan_revision and plan_hash`}),["completed","failed","cancelled"].includes(e.status)&&(e.finished_at===null||e.result===null)&&t.addIssue({code:"custom",message:"terminal Change requires finished_at and result"}),["executing","verifying","completed"].includes(e.status)&&e.started_at===null&&t.addIssue({code:"custom",message:`${e.status} Change requires started_at`})}),Ps=V.z.object({task_id:It,change_id:oa,depends_on:V.z.array(It)}).strict(),pB=V.z.object({max_total_invocations:V.z.number().int().positive().nullable(),cancelled:V.z.boolean().default(!1),finalizer_scope:V.z.enum(["spec","parent"]).default("spec")}).strict(),fB=V.z.record(Si,pB).optional(),Ms={schema_version:V.z.literal(2),id:aa,parent_execution_id:aa.nullable().optional(),revision:V.z.number().int().positive(),status:V.z.enum(["planned","running","paused","verifying","completed","failed","blocked","cancelled"]),status_reason:V.z.string().min(1).nullable().optional(),policy:xg,spec_execution_policies:fB,created_at:zt,updated_at:zt,started_at:zt.nullable(),finished_at:zt.nullable(),result:V.z.string().min(1).nullable()},mB=V.z.object({...Ms,kind:V.z.literal("delivery").optional(),client_turn_id:V.z.string().min(1).max(200).nullable().optional(),origin:la,plan_revision:V.z.number().int().positive(),plan_hash:ia,dag:V.z.object({nodes:V.z.array(Ps).min(1),topological_order:V.z.array(It).min(1)}).strict()}).strict(),gB=V.z.object({...Ms,kind:V.z.literal("delivery"),client_turn_id:V.z.string().min(1).max(200),origin:la,status:V.z.enum(["planned","blocked"]),plan_revision:V.z.null(),plan_hash:V.z.null(),dag:V.z.object({nodes:V.z.array(Ps).length(0),topological_order:V.z.array(It).length(0)}).strict()}).strict(),hB=V.z.object({...Ms,kind:V.z.literal("delivery"),client_turn_id:V.z.string().min(1).max(200).nullable().optional(),origin:la,status:V.z.literal("cancelled"),plan_revision:V.z.null(),plan_hash:V.z.null(),dag:V.z.object({nodes:V.z.array(Ps).length(0),topological_order:V.z.array(It).length(0)}).strict()}).strict(),yB=V.z.object({...Ms,kind:V.z.literal("interaction"),client_turn_id:V.z.string().min(1).max(200),origin:V.z.object({type:V.z.literal("interaction"),conversation_id:V.z.string().startsWith("CONV-")}).strict(),plan_revision:V.z.null(),plan_hash:V.z.null(),dag:V.z.object({nodes:V.z.array(Ps).length(0),topological_order:V.z.array(It).length(0)}).strict()}).strict(),vB=V.z.object({...Ms,kind:V.z.literal("interaction"),client_turn_id:V.z.string().min(1).max(200).nullable().optional(),origin:la,plan_revision:V.z.null(),plan_hash:V.z.null(),dag:V.z.object({nodes:V.z.array(Ps).length(0),topological_order:V.z.array(It).length(0)}).strict()}).strict(),ln=V.z.union([yB,vB,hB,gB,mB]).superRefine((e,t)=>{e.status==="blocked"&&e.status_reason==null&&t.addIssue({code:"custom",message:"blocked Execution requires status_reason"}),["completed","failed","cancelled"].includes(e.status)&&(e.finished_at===null||e.result===null)&&t.addIssue({code:"custom",message:"terminal Execution requires finished_at and result"}),["running","paused","verifying","completed"].includes(e.status)&&e.started_at===null&&t.addIssue({code:"custom",message:`${e.status} Execution requires started_at`})})});function Lx(e){return ln.parse({schema_version:2,id:e.id,revision:1,kind:"interaction",client_turn_id:e.clientTurnId,origin:e.origin,status:"running",status_reason:null,plan_revision:null,plan_hash:null,policy:e.policy,dag:{nodes:[],topological_order:[]},created_at:e.now,updated_at:e.now,started_at:e.now,finished_at:null,result:null})}function jx(e){return ln.parse({schema_version:2,id:e.id,revision:1,kind:"delivery",client_turn_id:e.clientTurnId,origin:e.origin,status:"planned",status_reason:null,plan_revision:null,plan_hash:null,policy:e.policy,dag:{nodes:[],topological_order:[]},created_at:e.now,updated_at:e.now,started_at:null,finished_at:null,result:null})}function Px(e){let t;try{t=JSON.parse(e)}catch{throw new Ai("Invalid persisted client turn claim")}if(t.schema_version!==1||typeof t.client_turn_id!="string"||typeof t.execution_id!="string"||t.kind!=="interaction"&&t.kind!=="delivery"||typeof t.origin!="object"||t.origin===null)throw new Ai("Invalid persisted client turn claim");return{schema_version:1,client_turn_id:t.client_turn_id,execution_id:t.execution_id,kind:t.kind,origin:t.origin}}function Rg(e){return e instanceof Error&&"code"in e&&e.code==="EEXIST"}var Mx,Ai,Nd,Cg=L(()=>{"use strict";Mx=require("node:crypto");bt();Id();Ai=class extends Error{name="ExecutionClientTurnConflictError"},Nd=class{constructor(t,n){this.filesystem=t;this._layout=n}filesystem;_layout;async claimIdentity(t,n,i,r,o){let a=o.filter(u=>u.client_turn_id===t);if(a.length>1)throw new Ai(`Client turn resolves to multiple Executions: ${t}`);let s=a[0];s!==void 0&&this.assertExpectedExecution(s,i,r);let l={schema_version:1,client_turn_id:t,execution_id:s?.id??n,kind:i,origin:r},c=this.claimPath(t);try{return await this.filesystem.writeTextExclusive(c,`${JSON.stringify(l)}
243
+ `),l.execution_id}catch(u){if(!Rg(u))throw u}let d=Px(await this.filesystem.readText(c));return this.assertCompatibleClaim(d,t,i,r),d.execution_id}async claimExplicitIdentity(t,n,i,r){let o={schema_version:1,client_turn_id:t,execution_id:n,kind:i,origin:r},a=this.claimPath(t);try{return await this.filesystem.writeTextExclusive(a,`${JSON.stringify(o)}
244
+ `),n}catch(l){if(!Rg(l))throw l}let s=Px(await this.filesystem.readText(a));return this.assertCompatibleClaim(s,t,i,r),s.execution_id}async createExecution(t,n,i,r,o,a){try{return await this.filesystem.writeTextExclusive(r,o),t}catch(s){if(!Rg(s))throw s;return this.assertExpectedExecution(await a(),n,i)}}assertExpectedExecution(t,n,i){if(t.kind!==n||JSON.stringify(t.origin)!==JSON.stringify(i))throw new Ai(`Client turn ${t.client_turn_id??"unknown"} resolves to incompatible ${t.kind??"legacy-delivery"} Execution ${t.id}`);return t}claimPath(t){let n=(0,Mx.createHash)("sha256").update(t).digest("hex");return wm("execution-client-turn",n)}assertCompatibleClaim(t,n,i,r){if(t.client_turn_id!==n||t.kind!==i||JSON.stringify(t.origin)!==JSON.stringify(r))throw new Ai(`Client turn ${n} is already claimed by incompatible Execution ${t.execution_id}`)}}});function Dx(e){return`# ${e.title}
245
+
246
+ ## Problema
247
+
248
+ ${e.problem}
249
+
250
+ ## Outcomes
251
+
252
+ ${Ls(e.outcomes)}
253
+
254
+ ## Restri\xE7\xF5es
255
+
256
+ ${Ls(e.constraints)}
257
+
258
+ ## Fora de escopo
259
+
260
+ ${Ls(e.non_goals)}`}function Ux(e){let t=e.implementation,n=t===null?"N\xE3o resolvida. Consulte `stack` e `stack.overrides` em `.agents/config/project.yaml` antes de preparar esta SPEC.":`Profile: ${t.stack_profile}
261
+
262
+ ${t.stack_description}
263
+
264
+ ${t.stack_components.map(i=>`- ${i.kind}: ${i.name} ${i.version} (${i.version_source})`).join(`
265
+ `)}`;return`# ${e.title}
266
+
267
+ ## Objetivo
268
+
269
+ ${e.objective}
270
+
271
+ ## Escopo
272
+
273
+ ${Ls(e.included_scope)}
274
+
275
+ ## Fora de escopo
276
+
277
+ ${Ls(e.excluded_scope)}
278
+
279
+ ## Stack de implementa\xE7\xE3o
280
+
281
+ ${n}`}function Ls(e){return e.length===0?"Nenhum.":e.map(t=>`- ${t}`).join(`
282
+ `)}var zx=L(()=>{"use strict"});function $g(e,t,n,i){let r=new Intl.DateTimeFormat("en-CA",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(n.now()),o=a=>{let s=r.find(l=>l.type===a)?.value;if(s===void 0)throw new Error(`Unable to format ID date part: ${a}`);return s};return[e,o("year"),o("month"),o("day"),o("hour"),o("minute"),bm(t),Fi()].join("-")}var Fx=L(()=>{"use strict";bt()});function qx(e){return`# ${e}
283
+
284
+ ## Plano
285
+
286
+ Plano preparado e aguardando execu\xE7\xE3o.
287
+
288
+ ## Implementa\xE7\xE3o
289
+
290
+ Ainda n\xE3o executada.
291
+
292
+ ## Decis\xF5es
293
+
294
+ Nenhuma decis\xE3o registrada.
295
+
296
+ ## Evid\xEAncias
297
+
298
+ Nenhuma evid\xEAncia registrada.
299
+
300
+ ## Evals
301
+
302
+ Ainda n\xE3o executados.
303
+
304
+ ## Testes
305
+
306
+ Ainda n\xE3o executados.
307
+
308
+ ## Resultado
309
+
310
+ Aguardando execu\xE7\xE3o.`}function Wx(e,t){return e.id===t.id&&e.title===t.title&&e.risk===t.risk&&JSON.stringify(e.source)===JSON.stringify(t.source)&&e.requirement_ids.every(n=>t.requirement_ids.includes(n))&&e.acceptance_ids.every(n=>t.acceptance_ids.includes(n))&&e.task_ids.every(n=>t.task_ids.includes(n))}function SB(e,t){return e.status==="planned"&&Wx(e,t)&&e.plan_revision===t.plan_revision&&e.plan_hash===t.plan_hash&&JSON.stringify(e.requirement_impact)===JSON.stringify(t.requirement_impact)}function Vx(e){return`# Execution ${e.id}
311
+
312
+ ## Plano
313
+
314
+ DAG e pol\xEDtica est\xE3o persistidas no frontmatter.
315
+
316
+ ## Progresso
317
+
318
+ Estado atual: ${e.status}.
319
+
320
+ ## Resultado
321
+
322
+ ${e.result??e.status_reason??"Ainda n\xE3o conclu\xEDda."}`}async function js(e,t,n,i){let r=await e.listFiles(t,n);return Promise.all(r.map(async o=>$t(await e.readText(o),i).metadata))}function Pd(e,t,n,i){if(!e[t].includes(n))throw new Error(`Invalid ${i} transition: ${t} -> ${n}`)}function Md(e){if(e.version===1)throw new TypeError("V2 repositories require a modern WorkspaceLayout")}async function Ld(e,t,n,i){let r=await Ss(e,t,n,i);if(r===null)throw new Error(`${n} not found: ${i}`);return r}var no,ro,io,oo,kB,wB,EB,AB,Zx=L(()=>{"use strict";bt();Cg();zx();Fx();Cg();Ns();ra();Id();no=class{constructor(t,n){this.filesystem=t;this.layout=n;Md(n)}filesystem;layout;async create(t){let n=t.clock??new Qe,i=n.now().toISOString(),r=t.id??$g("PRD",t.shortName,n,this.layout.project.timezone),o=[...t.outcomes??[]],a=wi.parse({schema_version:2,id:r,revision:1,title:t.title,status:"draft",status_reason:null,outcome_status:"unmeasured",problem:t.problem,audiences:[...t.audiences??[]],outcomes:o,outcome_ids:t.outcomeIds??Og(r,o),constraints:[...t.constraints??[]],non_goals:[...t.nonGoals??[]],prepared_plan:null,plan_ref:null,creation_run_id:t.creationRunId??null,rework_of_prd_id:t.reworkOfPrdId??null,tags:[...t.tags??[]],created_at:i,updated_at:i});return await this.write(a,Dx(a),!0),a}async createReworkSuccessor(t,n){let{prd:i}=await this.read(t);if(i.status!=="cancelled")throw new TypeError(`PRD ${t} must be cancelled before rework`);return this.create({...n,reworkOfPrdId:i.id,tags:["rework"]})}async read(t){let n=await Ld(this.filesystem,this.layout,"prd",t),i=$t(await this.filesystem.readText(n),wi);return{prd:i.metadata,body:i.body}}async list(){return js(this.filesystem,this.layout.entityRoot("prd"),".md",wi)}async setPreparedPlan(t,n){let i=Jr.parse(n),r=await this.read(t);if(!new Set(["draft","ready"]).has(r.prd.status))throw new TypeError(`PRD ${t} cannot be prepared from status ${r.prd.status}`);let o=Nx(i,t);if(o.length===0)throw new TypeError(`PRD ${t} requires at least one SPEC`);let a=await js(this.filesystem,this.layout.entityRoot("spec"),".md",Kr),s=new Map(a.map(c=>[c.id,c]));for(let c of o){let d=s.get(c);if(d===void 0)throw new TypeError(`PRD SPEC does not resolve: ${c}`);if(d.prd_id!==t)throw new TypeError(`SPEC ${c} does not belong to PRD ${t}`);if(["active","delivered","cancelled"].includes(d.status))throw new TypeError(`SPEC ${c} cannot be prepared from status ${d.status}`);await $d(d.implementation,this.filesystem,this.layout)}let l=wi.parse({...r.prd,revision:r.prd.revision+1,prepared_plan:i,plan_ref:null,updated_at:i.prepared_at});return await this.write(l,r.body),l}async transition(t,n,i=new Qe,r=null){let o=await this.read(t);Pd(kB,o.prd.status,n,"PRD");let a=typeof i=="string"?new Qe:i,s=typeof i=="string"?i:r,l=wi.parse({...o.prd,revision:o.prd.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?s??`PRD moved to ${n}.`:null,updated_at:a.now().toISOString()});return await this.write(l,o.body),l}async normalizePreparedPlan(t,n){let i=await this.read(t);if(i.prd.plan_ref?.hash===n.hash)return i.prd;if(i.prd.prepared_plan?.hash!==n.hash)throw new Error(`PRD ${t} does not contain PreparedPlan ${n.hash}`);let r=wi.parse({...i.prd,revision:i.prd.revision+1,prepared_plan:null,plan_ref:Is(n),updated_at:new Date().toISOString()});return await this.write(r,i.body),r}path(t){return this.layout.activePath("prd",t)}async write(t,n,i=!1){await this.filesystem[i?"writeTextAtomicExclusive":"writeTextAtomic"](this.path(t.id),cn({metadata:wi.parse(t),body:n}))}},ro=class{constructor(t,n){this.filesystem=t;this.layout=n;Md(n)}filesystem;layout;async create(t){let n=t.clock??new Qe,i=n.now().toISOString(),r=Kr.parse({schema_version:2,id:t.id??$g("SPEC",t.shortName,n,this.layout.project.timezone),prd_id:t.prdId??null,revision:1,title:t.title,status:"draft",status_reason:null,objective:t.objective,included_scope:[...t.includedScope??[]],excluded_scope:[...t.excludedScope??[]],requirement_ids:[...t.requirementIds??[]],acceptance_ids:[...t.acceptanceIds??[]],implementation:t.implementation??null,prepared_plan:null,plan_ref:null,creation_run_id:t.creationRunId??null,created_at:i,updated_at:i});return await this.write(r,Ux(r),!0),r}async read(t){let n=await Ld(this.filesystem,this.layout,"spec",t),i=$t(await this.filesystem.readText(n),Kr);return{spec:i.metadata,body:i.body}}async list(){return js(this.filesystem,this.layout.entityRoot("spec"),".md",Kr)}async setPreparedPlan(t,n){let i=Jr.parse(n);if(i.source.type!=="spec"||i.source.spec_id!==t)throw new TypeError(`Prepared plan source must be spec ${t}`);let r=await this.read(t);if(!new Set(["draft","ready"]).has(r.spec.status))throw new TypeError(`SPEC ${t} cannot be prepared from status ${r.spec.status}`);await $d(r.spec.implementation,this.filesystem,this.layout);let o=Kr.parse({...r.spec,revision:r.spec.revision+1,prepared_plan:i,plan_ref:null,updated_at:i.prepared_at});return await this.write(o,r.body),o}async transition(t,n,i=new Qe,r=null){let o=await this.read(t);Pd(wB,o.spec.status,n,"DeliverySpec");let a=typeof i=="string"?new Qe:i,s=typeof i=="string"?i:r;["active","delivered"].includes(n)&&await $d(o.spec.implementation,this.filesystem,this.layout);let l=Kr.parse({...o.spec,revision:o.spec.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?s??`SPEC moved to ${n}.`:null,updated_at:a.now().toISOString()});return await this.write(l,o.body),l}async normalizePreparedPlan(t,n){let i=await this.read(t);if(i.spec.plan_ref?.hash===n.hash)return i.spec;if(i.spec.prepared_plan?.hash!==n.hash)throw new Error(`SPEC ${t} does not contain PreparedPlan ${n.hash}`);let r=Kr.parse({...i.spec,revision:i.spec.revision+1,prepared_plan:null,plan_ref:Is(n),updated_at:new Date().toISOString()});return await this.write(r,i.body),r}path(t){return this.layout.activePath("spec",t)}async write(t,n,i=!1){await this.filesystem[i?"writeTextAtomicExclusive":"writeTextAtomic"](this.path(t.id),cn({metadata:Kr.parse(t),body:n}))}},io=class{constructor(t,n){this.filesystem=t;this.layout=n;Md(n)}filesystem;layout;async read(t){let n=await Ld(this.filesystem,this.layout,"change",t),i=$t(await this.filesystem.readText(n),Ei);return{change:i.metadata,body:i.body}}async createDraft(t){let i=(t.clock??new Qe).now().toISOString(),r=Ei.parse({schema_version:2,id:t.id,revision:1,title:t.title,status:"draft",risk:t.risk,source:{type:"task",task_id:t.taskId},requirement_ids:[...t.requirementIds],acceptance_ids:[...t.acceptanceIds],requirement_impact:{type:"none",reason:"Awaiting prepared plan."},task_ids:[t.taskId],plan_revision:null,plan_hash:null,created_at:i,updated_at:i,started_at:null,finished_at:null,result:null});return await this.filesystem.writeTextExclusive(this.path(r.id),this.serialize(r)),r}async promoteDraft(t,n){let i=await this.read(t);if(i.change.status==="planned"&&SB(i.change,n))return i.change;if(i.change.status!=="draft"||!Wx(i.change,n))throw new TypeError(`Change ${t} does not match its Task draft`);let r=Ei.parse({...n,revision:i.change.revision+1,created_at:i.change.created_at,updated_at:n.updated_at});return await this.write(r),r}async list(){return js(this.filesystem,this.layout.entityRoot("change"),"change.md",Ei)}async transition(t,n,i=null,r=new Qe,o=null){let a=await this.read(t);Pd(EB,a.change.status,n,"Change");let s=r.now().toISOString(),l=["completed","failed","cancelled"].includes(n),c=Ei.parse({...a.change,revision:a.change.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?o??i??`Change moved to ${n}.`:null,updated_at:s,started_at:n==="executing"&&a.change.started_at===null?s:a.change.started_at,finished_at:l?s:null,result:l?i:null});return await this.write(c,a.body),c}async write(t,n=qx(t.title)){await this.filesystem.writeTextAtomic(this.path(t.id),this.serialize(t,n))}serialize(t,n=qx(t.title)){return cn({metadata:Ei.parse(t),body:n})}path(t){return this.layout.activePath("change",t)}},oo=class{constructor(t,n){this.filesystem=t;this.layout=n;Md(n),this.clientTurnClaims=new Nd(t,n)}filesystem;layout;clientTurnClaims;async read(t){let n=await Ld(this.filesystem,this.layout,"execution",t),i=$t(await this.filesystem.readText(n),ln);return{execution:i.metadata,body:i.body}}async list(){return js(this.filesystem,this.layout.entityRoot("execution"),"execution.md",ln)}async createInteraction(t){let n={type:"interaction",conversation_id:t.conversationId},i=await this.clientTurnClaims.claimIdentity(t.clientTurnId,t.id,"interaction",n,await this.list()),r=await this.read(i).catch(()=>null);if(r!==null)return this.clientTurnClaims.assertExpectedExecution(r.execution,"interaction",n);let a=(t.clock??new Qe).now().toISOString(),s=Lx({id:i,clientTurnId:t.clientTurnId,origin:n,policy:t.policy,now:a});return this.clientTurnClaims.createExecution(s,"interaction",n,this.path(s.id),this.serialize(s),async()=>(await this.read(s.id)).execution)}async createDeliveryIntake(t){let n=await this.clientTurnClaims.claimIdentity(t.clientTurnId,t.id,"delivery",t.origin,await this.list()),i=await this.read(n).catch(()=>null);if(i!==null)return this.clientTurnClaims.assertExpectedExecution(i.execution,"delivery",t.origin);let o=(t.clock??new Qe).now().toISOString(),a=jx({id:n,clientTurnId:t.clientTurnId,origin:t.origin,policy:t.policy,now:o});return this.clientTurnClaims.createExecution(a,"delivery",t.origin,this.path(a.id),this.serialize(a),async()=>(await this.read(a.id)).execution)}async promoteDeliveryIntake(t,n){let i=await this.read(t);if(i.execution.plan_hash===n.plan_hash)return i.execution;if(i.execution.kind!=="delivery"||i.execution.plan_hash!==null||i.execution.plan_revision!==null||JSON.stringify(i.execution.origin)!==JSON.stringify(n.origin))throw new TypeError(`Execution ${t} is not a matching delivery intake`);let r=ln.parse({...n,kind:"delivery",client_turn_id:i.execution.client_turn_id,revision:i.execution.revision+1,created_at:i.execution.created_at});return await this.write(r),r}async claimClientTurn(t,n){let i=await this.read(t),r=i.execution.kind??"delivery",o=await this.clientTurnClaims.claimExplicitIdentity(n,t,r,i.execution.origin);if(o!==t){let s=await this.read(o);return this.clientTurnClaims.assertExpectedExecution(s.execution,r,i.execution.origin)}if(i.execution.kind==="interaction"){if(i.execution.client_turn_id!==n)throw new Error(`Interaction Execution ${t} belongs to another client turn`);return i.execution}if(i.execution.client_turn_id===n)return i.execution;if(i.execution.client_turn_id!=null)throw new Error(`Delivery Execution ${t} already belongs to another client turn`);let a=ln.parse({...i.execution,revision:i.execution.revision+1,kind:"delivery",client_turn_id:n,updated_at:new Date().toISOString()});return await this.write(a),a}async linkChildExecution(t,n){if(t===n)throw new TypeError("Execution cannot be its own parent");let[i,r]=await Promise.all([this.read(t),this.read(n)]);if(i.execution.origin.type!=="spec"||r.execution.origin.type!=="prd")throw new TypeError("Child Execution must originate from a SPEC under a PRD Execution");if(i.execution.parent_execution_id===n)return i.execution;if(i.execution.parent_execution_id!=null)throw new TypeError(`Execution ${t} is already linked to ${i.execution.parent_execution_id}`);if(["completed","failed","cancelled"].includes(r.execution.status))throw new TypeError(`Parent Execution ${n} is terminal`);let o=ln.parse({...i.execution,parent_execution_id:n,revision:i.execution.revision+1,updated_at:new Date().toISOString()});return await this.write(o),o}async normalizeBody(t){let n=await this.read(t);return await this.write(n.execution),n.execution}async transition(t,n,i=null,r=new Qe,o=null){let a=await this.read(t);Pd(AB,a.execution.status,n,"Execution");let s=r.now().toISOString(),l=["completed","failed","cancelled"].includes(n),c=ln.parse({...a.execution,revision:a.execution.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?o??i??`Execution moved to ${n}.`:null,updated_at:s,started_at:n==="running"&&a.execution.started_at===null?s:a.execution.started_at,finished_at:l?s:null,result:l?i:null});return await this.write(c),c}async write(t,n=Vx(t)){await this.filesystem.writeTextAtomic(this.path(t.id),this.serialize(t,n))}serialize(t,n=Vx(t)){return cn({metadata:ln.parse(t),body:n})}path(t){return this.layout.activePath("execution",t)}};kB={draft:["ready","blocked","failed","cancelled"],ready:["active","blocked","failed","cancelled"],active:["delivered","blocked","failed","cancelled"],blocked:["active","failed","cancelled"],delivered:[],failed:[],cancelled:[]},wB={draft:["ready","blocked","failed","cancelled"],ready:["active","blocked","failed","cancelled"],active:["delivered","blocked","failed","cancelled"],blocked:["active","failed","cancelled"],delivered:[],failed:[],cancelled:[]},EB={draft:["planned","blocked","cancelled"],planned:["executing","blocked","failed","cancelled"],executing:["verifying","failed","blocked","cancelled"],verifying:["completed","failed","blocked","cancelled"],blocked:["executing","cancelled"],completed:[],failed:["executing"],cancelled:[]},AB={planned:["running","blocked","failed","cancelled"],running:["paused","verifying","failed","blocked","cancelled"],paused:["running","cancelled"],verifying:["completed","failed","blocked","cancelled"],blocked:["running","cancelled"],completed:[],failed:["running"],cancelled:[]}});var Bx=L(()=>{"use strict";Ns();ra();Zx();Id()});var at,TB,jd,W8,Z8,Ds=L(()=>{"use strict";bt();at=Be(Xe(),1);lx();yx();bx();Bx();TB=["lite","standard","critical"],jd=at.z.string().datetime({offset:!0}),W8=at.z.object({id:at.z.string().startsWith("SPEC-"),capability:at.z.string().min(1),title:at.z.string().min(1),status:at.z.enum(["active","deprecated"]).default("active"),version:at.z.number().int().positive().default(1),updated_at:jd}).strict(),Z8=at.z.object({id:at.z.string().startsWith("CHG-"),title:at.z.string().min(1),status:at.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),risk:at.z.enum(TB),capabilities:at.z.array(at.z.string().startsWith("SPEC-")),requirements:at.z.array(at.z.string().startsWith("REQ-")),tasks:at.z.array(at.z.string().startsWith("TASK-")),human_decisions:at.z.array(at.z.string().startsWith("DEC-HUMAN-")),agent_decisions:at.z.array(at.z.string().startsWith("DEC-AI-")),created_at:jd,updated_at:jd,completed_at:jd.nullable().default(null)}).strict()});var Hx=L(()=>{"use strict"});var Ig=L(()=>{"use strict";Hx()});var Jx=L(()=>{"use strict"});var Kx=L(()=>{"use strict";Jx()});var ao,Gx=L(()=>{"use strict";ao=["validate","develop","review","fix","verify","close"]});var Us=L(()=>{"use strict";Gx()});var Xx=L(()=>{"use strict"});var Yx=L(()=>{"use strict";Xx()});var Qx=L(()=>{"use strict"});var eO=L(()=>{"use strict"});var Ng=L(()=>{"use strict"});var Dd=L(()=>{"use strict"});var Pg=L(()=>{"use strict"});var AQ,tO=L(()=>{"use strict";Io();Ig();Us();Ng();Dd();Pg();AQ=5*6e4});var I,Mg,nO,OB,RB,CB,Ud,$B,IB,NB,PB,MB,LB,jB,DB,UB,RQ,zd=L(()=>{"use strict";I=Be(Xe(),1);Io();Us();Mg=I.z.string().datetime(),nO=I.z.object({id:I.z.string().min(1),acceptance_ids:I.z.array(I.z.string().min(1))}).strict(),OB=I.z.object({soft_cycles:I.z.number().int().positive(),max_attempts:I.z.number().int().positive().nullable()}).strict(),RB=I.z.object({phase:I.z.enum(ao),event_id:I.z.string().min(1),state_hash:I.z.string().regex(/^[a-f0-9]{64}$/),cycles:I.z.number().int().nonnegative(),input_tokens:I.z.number().int().nonnegative().nullable(),measurement_source:I.z.enum(["provider-uncached-input","observable-context-fallback","unavailable"]),checkpoint_required:I.z.boolean()}).strict(),CB=I.z.object({schema_version:I.z.literal(1),id:I.z.string().min(1),phase:I.z.enum(ao),status:I.z.enum(["running","blocked","completed"]),revision:I.z.number().int().positive(),acceptance_ids:I.z.array(I.z.string().min(1)).min(1),budgets:I.z.object(Object.fromEntries(ao.map(e=>[e,OB]))),attempts:I.z.object(Object.fromEntries(ao.map(e=>[e,I.z.number().int().nonnegative()]))),checkpoints:I.z.array(RB),evidence:I.z.array(nO),processed_event_ids:I.z.array(I.z.string().min(1)),blocker:I.z.string().min(1).nullable()}).strict(),Ud=I.z.enum(["execution_override","task_override","automatic_policy","project_defaults"]),$B=I.z.enum(["EXECUTION_OVERRIDE","TASK_OVERRIDE","XHIGH_ELIGIBLE","SIMPLE_BOUNDED_WORK","SOL_PLANNING_OR_REVIEW","SOL_AMBIGUOUS_OR_TRANSVERSAL","SOL_STRUCTURAL_REWORK","TERRA_IMPLEMENTATION_BASELINE","PROJECT_DEFAULTS","RISK_ASSURANCE_ONLY"]),IB=I.z.object({model:I.z.string().min(1),reasoning_effort:I.z.enum(["low","medium","high","xhigh"]),velocity:I.z.literal("standard"),origin:Ud,sources:I.z.object({model:Ud,reasoning_effort:Ud,velocity:Ud}).strict(),policy_version:I.z.string().min(1),reasons:I.z.array($B).min(1)}).strict(),NB=I.z.object({invocation_id:I.z.string().regex(/^INV-[A-Z0-9-]+$/),run_id:I.z.string().min(1).nullable().default(null),phase:I.z.enum(ao),role:I.z.enum(["builder","verifier","finalizer"]),checkpoint_id:I.z.string().min(1).nullable(),checkpoint_hash:I.z.string().regex(/^[a-f0-9]{64}$/).nullable(),selection:IB.nullable().default(null)}).strict(),PB=I.z.object({rework:I.z.enum(["localized","structural"]),rework_cost:I.z.enum(["medium","high"]),findings:I.z.array(I.z.string().min(1)).default([]),complexity:I.z.enum(["simple","standard","complex"]),transversality:I.z.enum(["local","multi_module","cross_system"]),ambiguity:I.z.enum(["low","medium","high"]),bounded:I.z.boolean(),high_volume:I.z.boolean(),xhigh_triggers:I.z.array(I.z.enum(["full_stack_boundary","shared_contracts_3_plus","critical_data_or_security","rollout_and_rollback","repeated_structural_repair","architectural_review_finding","prepared_plan_invalidated","material_architectural_tradeoffs"]))}).strict(),MB=I.z.object({task_id:I.z.string().min(1),status:I.z.enum(["available","unavailable","quality_below_floor"]),evidence_ids:I.z.array(I.z.string().min(1)),validation_ids:I.z.array(I.z.string().min(1)),rework_count:I.z.number().int().nonnegative().nullable(),quality_score:I.z.number().nonnegative().nullable(),quality_floor:I.z.number().nonnegative().nullable(),cost_delta_usd:I.z.number().nullable(),economy_status:I.z.enum(["available","unavailable"])}).strict(),LB=I.z.object({baseline_task_id:I.z.string().min(1).nullable(),baseline_equivalence_id:I.z.string().min(1).nullable(),model:I.z.string().min(1).nullable(),reasoning_effort:I.z.enum(["low","medium","high","xhigh"]).nullable(),context_budget_tokens:I.z.number().int().nonnegative().nullable(),cached_context_tokens:I.z.number().int().nonnegative().nullable(),early_stop_reason:I.z.string().min(1).nullable(),retry_count:I.z.number().int().nonnegative().nullable(),rework_count:I.z.number().int().nonnegative().nullable(),observed_cost_usd:I.z.number().nonnegative().nullable(),baseline_observed_cost_usd:I.z.number().nonnegative().nullable(),quality_score:I.z.number().nonnegative().nullable(),quality_floor:I.z.number().nonnegative().nullable()}).strict(),jB=I.z.object({provider:I.z.enum(["codex","claude"]),host_authentication_available:I.z.boolean(),requires_external_provider:I.z.boolean(),requires_remote_operation:I.z.boolean()}).strict(),DB=I.z.object({identity:I.z.string().min(1),replay_key:I.z.string().regex(/^[a-f0-9]{64}$/),validation_ids:I.z.array(I.z.string().min(1)),evidence_ids:I.z.array(I.z.string().min(1))}).strict(),UB=I.z.object({id:I.z.string().min(1),change_id:I.z.string().min(1),title:I.z.string().min(1),objective:I.z.string().min(1),risk:I.z.enum(["lite","standard","critical"]),priority:I.z.number().int(),depends_on:I.z.array(I.z.string().min(1)),acceptance_ids:I.z.array(I.z.string().min(1)).min(1),write_scopes:I.z.array(I.z.string().min(1)),child_execution_id:I.z.string().min(1).optional(),builder:I.z.object({id:I.z.string().min(1),model:I.z.string().min(1),reasoning_effort:I.z.enum(["low","medium","high","xhigh"]).optional(),tools:I.z.array(I.z.string()).optional(),execution_eligibility:I.z.array(I.z.enum(["interaction","delivery"])).optional()}).optional(),verifier:I.z.object({id:I.z.string().min(1),model:I.z.string().min(1),reasoning_effort:I.z.enum(["low","medium","high","xhigh"]).optional(),tools:I.z.array(I.z.string()).optional(),execution_eligibility:I.z.array(I.z.enum(["interaction","delivery"])).optional()}).optional(),commit:I.z.object({agent:I.z.enum(["CODEX","CLAUDE"]),execution_id:I.z.string().min(1),change_id:I.z.string().min(1),task_id:I.z.string().min(1),title:I.z.string().min(1),prd_id:I.z.string().min(1).nullable(),spec_id:I.z.string().min(1).nullable()}).strict().optional(),runtime:Kl.optional(),model_profile:Pi.optional(),outcome_measurement:LB.optional(),status:I.z.enum(["planned","running","completed","failed","blocked"]),worktree_path:I.z.string().min(1).nullable(),integration_commit:I.z.string().min(1).nullable(),changed_files:I.z.array(I.z.string().min(1)).default([]),task_run_id:I.z.string().min(1).nullable().default(null),finalizer_approved:I.z.boolean().default(!1),active_invocation:NB.nullable(),rework_profile:PB.nullable().default(null),sdc:CB,validation_ids:I.z.array(I.z.string().min(1)),evidence:I.z.array(nO),outcome_projection:MB.nullable().default(null),validation_attempts:I.z.array(DB).default([]),last_error:I.z.string().min(1).nullable()}).strict(),RQ=I.z.object({schema_version:I.z.literal(1),execution_id:I.z.string().min(1),source:I.z.enum(["task","spec","prd"]),operational_context:jB.default({provider:"codex",host_authentication_available:!1,requires_external_provider:!1,requires_remote_operation:!1}),status:I.z.enum(["running","completed","failed","blocked"]),revision:I.z.number().int().nonnegative(),created_at:Mg,updated_at:Mg,execution_started_at:Mg.nullable().default(null),invocation_count:I.z.number().int().nonnegative().default(0),stalled_cycles:I.z.number().int().nonnegative().default(0),handoff_worktree_path:I.z.string().min(1).nullable().default(null),handoff_branch:I.z.string().min(1).nullable().default(null),handoff_commit:I.z.string().min(1).nullable().default(null),tasks:I.z.array(UB).min(1),last_error:I.z.string().min(1).nullable()}).strict()});var Lg=L(()=>{"use strict"});var rO=L(()=>{"use strict";Cp();Io();Us();Qx();eO();tO();Dd();zd();Lg()});var iO=L(()=>{"use strict"});var oO=L(()=>{"use strict";bt();zd()});var aO=L(()=>{"use strict";rO();iO();oO();Ng();Dd();zd();Lg();Pg()});var sO=L(()=>{"use strict";Ds()});var cO=L(()=>{"use strict";sO()});function jg(e){let t=e.status==="draft"?"Rascunho aguardando classifica\xE7\xE3o; pode possuir Run de conversa, mas nenhum Change ou Execution foi criado.":e.plan_hash===null?`Captura encerrada como ${e.status} sem materializar Change ou Execution.`:`Plano ${e.plan_revision??"-"} materializado em ${e.change_id}; estado atual: ${e.status}.`,n=e.result?.summary??e.status_reason??"Ainda n\xE3o conclu\xEDda.",i=e.result?.evidence_ids.length?e.result.evidence_ids.map(r=>`- ${r}`).join(`
323
+ `):"Nenhuma evid\xEAncia registrada.";return`# ${e.title}
324
+
325
+ ## Objetivo
326
+
327
+ ${e.objective}
328
+
329
+ ## Plano
330
+
331
+ ${t}
332
+
333
+ ## Evid\xEAncias
334
+
335
+ ${i}
336
+
337
+ ## Resultado
338
+
339
+ ${n}`}function zs(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Fs(e,t,n){let i=new Set;for(let r of e)i.has(r)&&n.addIssue({code:"custom",path:[t],message:`Duplicate value: ${r}`}),i.add(r)}var lO=L(()=>{"use strict"});var Me,Fd,FB,uO,qB,VB,WB,ZB,so,ua,BB,dO=L(()=>{"use strict";bt();Ds();Me=Be(Xe(),1);lO();Fd=Me.z.string().datetime({offset:!0}),FB=Me.z.string().regex(/^[a-f0-9]{64}$/),uO=Me.z.string().startsWith("TASK-"),qB=Me.z.string().startsWith("CHG-"),VB=Me.z.string().startsWith("REQ-"),WB=Me.z.string().startsWith("AC-"),ZB=Me.z.preprocess(e=>typeof e=="string"?{summary:e,changed_files:[],evidence_ids:[],completed_run_id:null}:e,Me.z.object({summary:Me.z.string().min(1),changed_files:Me.z.array(Me.z.string().min(1)),evidence_ids:Me.z.array(Me.z.string().startsWith("EVD-")),completed_run_id:Me.z.string().startsWith("RUN-").nullable()}).strict()),so=Me.z.object({schema_version:Me.z.literal(2),id:uO,revision:Me.z.number().int().positive(),change_id:qB,title:Me.z.string().min(1),short_name:Me.z.string().min(1),objective:Me.z.string().min(1),status:Me.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),status_reason:Me.z.string().min(1).nullable().optional(),attempt_count:Me.z.number().int().nonnegative().optional(),risk:Me.z.enum(["lite","standard","critical"]),priority:Me.z.enum(["low","medium","high","urgent"]),owner:Me.z.string().min(1).nullable(),requirement_ids:Me.z.array(VB).min(1),acceptance_ids:Me.z.array(WB).min(1),depends_on:Me.z.array(uO),write_scopes:Me.z.array(Me.z.string().min(1)),runtime:Kl.optional(),model_profile:Pi.optional(),plan_revision:Me.z.number().int().positive().nullable(),plan_hash:FB.nullable(),prepared_plan:Jr.optional(),plan_ref:ca.optional(),created_at:Fd,updated_at:Fd,started_at:Fd.nullable(),finished_at:Fd.nullable(),result:ZB.nullable()}).strict().superRefine((e,t)=>{let n=e.plan_revision===null&&e.plan_hash===null;e.status==="draft"||n&&["blocked","failed","cancelled"].includes(e.status)?(!n||e.prepared_plan!==void 0||e.plan_ref!==void 0)&&t.addIssue({code:"custom",message:`${e.status} Task without materialization cannot contain a prepared plan`}):(e.plan_revision===null||e.plan_hash===null)&&t.addIssue({code:"custom",message:`${e.status} Task requires plan_revision and plan_hash`}),e.prepared_plan!==void 0&&e.plan_ref!==void 0&&t.addIssue({code:"custom",message:"Task cannot contain prepared_plan and plan_ref"}),e.plan_ref!==void 0&&e.plan_ref.hash!==e.plan_hash&&t.addIssue({code:"custom",path:["plan_ref"],message:"plan_ref must match plan_hash"}),e.prepared_plan!==void 0&&(e.prepared_plan.source.type!=="task"||e.prepared_plan.source.task_id!==e.id||e.prepared_plan.hash!==e.plan_hash)&&t.addIssue({code:"custom",path:["prepared_plan"],message:"prepared_plan must belong to the Task and match plan_hash"}),["completed","failed","cancelled"].includes(e.status)&&(e.finished_at===null||e.result===null)&&t.addIssue({code:"custom",message:"terminal Task requires finished_at and result"}),["executing","verifying","completed"].includes(e.status)&&e.started_at===null&&t.addIssue({code:"custom",message:`${e.status} Task requires started_at`}),e.status==="completed"&&(e.result?.completed_run_id===null||e.result?.evidence_ids.length===0)&&t.addIssue({code:"custom",path:["result"],message:"completed Task requires completed_run_id and at least one Evidence"}),Fs(e.requirement_ids,"requirement_ids",t),Fs(e.acceptance_ids,"acceptance_ids",t),Fs(e.depends_on,"depends_on",t),Fs(e.write_scopes,"write_scopes",t)}),ua=class{constructor(t,n){this.filesystem=t;this.layout=n;if(n.version===1)throw new TypeError("TaskV2Repository requires a modern WorkspaceLayout")}filesystem;layout;async read(t){let n=await Ss(this.filesystem,this.layout,"task",t);if(n===null)throw new Error(`task not found: ${t}`);let i=$t(await this.filesystem.readText(n),so);return{task:i.metadata,body:i.body}}async list(){let t=await this.filesystem.listFiles(this.layout.entityRoot("task"),".md");return Promise.all(t.map(async n=>$t(await this.filesystem.readText(n),so).metadata))}async createDraft(t){let i=(t.clock??new Qe).now().toISOString(),r=so.parse({schema_version:2,id:t.id,revision:1,change_id:t.changeId,title:t.title,short_name:t.shortName,objective:t.objective,status:"draft",attempt_count:0,risk:t.risk,priority:t.priority,owner:t.owner??null,requirement_ids:[...t.requirementIds],acceptance_ids:[...t.acceptanceIds],depends_on:[...t.dependsOn??[]],write_scopes:[...t.writeScopes??[]],plan_revision:null,plan_hash:null,created_at:i,updated_at:i,started_at:null,finished_at:null,result:null});return await this.filesystem.writeTextExclusive(this.path(r.id),this.serialize(r)),r}async setPreparedPlan(t,n){let i=Jr.parse(n);if(i.source.type!=="task"||i.source.task_id!==t)throw new TypeError(`Prepared plan source must be task ${t}`);let r=await this.read(t);if(r.task.status==="planned"&&r.task.prepared_plan?.hash===i.hash)return r.task;if(r.task.status!=="draft")throw new Error(`Task ${t} must be draft before prepare`);let o=i.blueprints.tasks.find(c=>c.id===t);if(o===void 0)throw new Error(`Prepared plan does not contain Task ${t}`);let a=[o.change_id===r.task.change_id?null:"change_id",o.title===r.task.title?null:"title",o.short_name===r.task.short_name?null:"short_name",o.objective===r.task.objective?null:"objective",o.risk===r.task.risk?null:"risk",o.priority===r.task.priority?null:"priority",o.owner===r.task.owner?null:"owner",zs(o.requirement_ids,r.task.requirement_ids)?null:"requirement_ids",zs(o.acceptance_ids,r.task.acceptance_ids)?null:"acceptance_ids",zs(o.write_scopes,r.task.write_scopes)?null:"write_scopes"].filter(c=>c!==null),s=i.dag.nodes.find(c=>c.task_id===t);if((s===void 0||!zs(s.depends_on,r.task.depends_on))&&a.push("depends_on"),a.length>0)throw new Error(`Prepared plan diverges from Task draft: ${a.join(", ")}`);let l=so.parse({...r.task,revision:r.task.revision+1,status:"planned",plan_revision:i.revision,plan_hash:i.hash,prepared_plan:i,updated_at:i.prepared_at});return await this.write(l),l}async write(t,n=jg(t)){await this.filesystem.writeTextAtomic(this.path(t.id),this.serialize(t,n))}async normalizePreparedPlan(t,n){let i=await this.read(t);if(i.task.plan_ref?.hash===n.hash)return i.task;if(i.task.prepared_plan?.hash!==n.hash)throw new Error(`Task ${t} does not contain PreparedPlan ${n.hash}`);let{prepared_plan:r,...o}=i.task,a=so.parse({...o,revision:i.task.revision+1,plan_ref:Is(n),updated_at:new Date().toISOString()});return await this.write(a),a}async normalizeBody(t){let n=await this.read(t);return await this.write(n.task),n.task}serialize(t,n=jg(t)){return cn({metadata:so.parse(t),body:n})}async transition(t,n,i=null,r=new Qe,o=null){let a=await this.read(t);if(!BB[a.task.status].includes(n))throw new Error(`Invalid Task transition: ${a.task.status} -> ${n}`);let s=r.now().toISOString(),l=["completed","failed","cancelled"].includes(n),c=so.parse({...a.task,revision:a.task.revision+1,status:n,attempt_count:n==="executing"?(a.task.attempt_count??0)+1:a.task.attempt_count,status_reason:["blocked","failed","cancelled"].includes(n)?o??i?.summary??`Task moved to ${n}.`:null,updated_at:s,started_at:n==="executing"&&a.task.started_at===null?s:a.task.started_at,finished_at:l?s:null,result:l?i:null});return await this.write(c),c}path(t){return this.layout.activePath("task",t)}},BB={draft:["planned","blocked","failed","cancelled"],planned:["executing","blocked","failed","cancelled"],executing:["verifying","failed","blocked","cancelled"],verifying:["executing","completed","failed","blocked","cancelled"],blocked:["executing","cancelled"],completed:[],failed:["executing"],cancelled:[]}});var _t,Dg,W7,Ug=L(()=>{"use strict";bt();_t=Be(Xe(),1);Ig();Kx();Us();Yx();aO();cO();dO();Dg=_t.z.string().datetime({offset:!0}),W7=_t.z.object({id:_t.z.string().startsWith("TASK-"),title:_t.z.string().min(1),short_name:_t.z.string().min(1),status:_t.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),risk:_t.z.enum(["lite","standard","critical"]),priority:_t.z.enum(["low","medium","high","urgent"]),owner:_t.z.string().min(1).nullable().default(null),progress:_t.z.number().int().min(0).max(100),spec:_t.z.string().startsWith("SPEC-"),change:_t.z.string().startsWith("CHG-"),requirements:_t.z.array(_t.z.string().startsWith("REQ-")),depends_on:_t.z.array(_t.z.string().startsWith("TASK-")),human_decisions:_t.z.array(_t.z.string().startsWith("DEC-HUMAN-")),agent_decisions:_t.z.array(_t.z.string().startsWith("DEC-AI-")),created_at:Dg,started_at:Dg.nullable(),finished_at:Dg.nullable()}).strict()});function qd(e){return new Set(e.filter(t=>t.status!=="planned").flatMap(t=>t.dag.nodes.map(n=>n.task_id)))}var zg=L(()=>{"use strict"});function _O(e){let t=new Map,n=(i,r)=>i===null&&r===null?null:(i??0)+(r??0);for(let i of e){if(i.task_id===null)continue;let r=t.get(i.task_id)??{duration_ms:null,tokens:null,cost_brl:null};t.set(i.task_id,{duration_ms:n(r.duration_ms,i.phase==="execution"&&i.parent_run_id==null?i.duration_ms:null),tokens:n(r.tokens,i.usage.total.tokens.total),cost_brl:n(r.cost_brl,i.usage.total.cost.brl)})}return t}function qs(e,t){let n=e.filter(a=>a.status==="completed").length,i=t.filter(a=>a.status!=="running"),r=i.filter(a=>a.status==="completed").length,o=t.filter(a=>a.work_type==="rework").length;return{completed_tasks:n,task_completion_rate:e.length===0?0:n/e.length,terminal_runs:i.length,successful_runs:r,terminal_success_rate:i.length===0?0:r/i.length,rework_rate:t.length===0?0:o/t.length}}var Fg=L(()=>{"use strict"});function Vd(e){let t=e?.source_started_at??null,n=e?.source_finished_at??e?.source_occurred_at??null;return{source_started_at:t,source_finished_at:n,source_duration_ms:t===null||n===null?null:Math.max(0,Date.parse(n)-Date.parse(t)),capture_lag_ms:n===null||e===void 0?null:Math.max(0,Date.parse(e.occurred_at)-Date.parse(n))}}function Wd(e,t,n,i){let r=Date.parse(e),o=c=>{let d=c==null?Number.NaN:Date.parse(c);return Number.isFinite(d)?d:null},a=(c,d)=>{let u=o(c),_=o(d);return u!==null&&_!==null&&_>=u&&_>=r},s=[];for(let c of[...n,...i]){let d=c.source_started_at,u=c.source_finished_at;if(d!==void 0&&u!==void 0&&a(d,u)){s.push({...c,source_finished_at:u});continue}c.activity_kind==="retrospective_local_reconciliation"&&typeof c.source_occurred_at=="string"&&(o(c.source_occurred_at)??Number.NEGATIVE_INFINITY)>=r&&s.push({...c,source_started_at:e,source_finished_at:c.source_occurred_at})}s.sort((c,d)=>Date.parse(c.occurred_at)-Date.parse(d.occurred_at));let l=s.at(-1);return Vd(l===void 0?void 0:{occurred_at:l.occurred_at,source_occurred_at:l.source_occurred_at??void 0,source_started_at:l.source_started_at,source_finished_at:l.source_finished_at})}function pO(e){function t(n,i){let r=new Set([...i===null?[]:e.prds.filter(c=>c.id===i).map(c=>c.creation_run_id),...e.specs.filter(c=>n.has(c.id)).map(c=>c.creation_run_id)].filter(c=>c!=null)),o=new Set(e.changes.filter(c=>i!==null&&c.source.type==="prd"&&c.source.prd_id===i||(c.source.type==="spec"||c.source.type==="prd")&&c.source.spec_id!==null&&c.source.spec_id!==void 0&&n.has(c.source.spec_id)).map(c=>c.id)),a=new Set(e.tasks.filter(c=>o.has(c.change_id)).map(c=>c.id)),s=new Set(e.executions.filter(c=>i!==null&&c.origin.type==="prd"&&c.origin.prd_id===i||c.origin.type==="spec"&&c.origin.spec_id!==void 0&&n.has(c.origin.spec_id)||c.dag.nodes.some(d=>a.has(d.task_id))).map(c=>c.id)),l=e.runs.filter(c=>{let d=c.fold.run.spec_id!==null&&n.has(c.fold.run.spec_id)||c.fold.run.task_id!==null&&a.has(c.fold.run.task_id)||r.has(c.fold.run.run_id);return i===null?d:d||c.fold.run.prd_id===i||c.fold.run.execution_id!==null&&s.has(c.fold.run.execution_id)});return{changeIds:o,taskIds:a,executionIds:s,runs:l}}return{forSpec:n=>t(new Set([n]),null),forPrd:n=>t(new Set(e.specs.filter(i=>i.prd_id===n).map(i=>i.id)),n)}}var qg=L(()=>{"use strict"});function fO(e){let t=TA(e.map(n=>n.cost));return{conversation:da(t.conversation),planning:da(t.planning),execution:da(t.execution),total:da(t.total),new_work:da(t.work_types.new),rework:da(t.work_types.rework)}}function da(e){return{events:e.usage_event_count,tokens:e.tokens,cost:e.cost,coverage:e.coverage}}function Bd(e){return{human:e.filter(t=>t.origin==="human").length,agent:e.filter(t=>t.origin==="agent").length}}function Hd(e,t){let n=[e.conversation,e.planning,e.execution],i=Object.values(t).map(r=>r.total);return{phase_tokens_match_total:Zd(n.map(r=>r.tokens.total),e.total.tokens.total),phase_usd_match_total:Zd(n.map(r=>r.cost.usd),e.total.cost.usd),phase_brl_match_total:Zd(n.map(r=>r.cost.brl),e.total.cost.brl),origin_tokens_match_total:Zd(i.map(r=>r.tokens.total),e.total.tokens.total)}}function Zd(e,t){let n=e.filter(i=>i!==null);return t===null?n.length===0:Math.abs(n.reduce((i,r)=>i+r,0)-t)<1e-9}function Jd(e){return e==="completed"?100:e==="verifying"?80:e==="executing"?50:["blocked","failed","cancelled"].includes(e)?0:10}function mO(e){return e==="planned"?"planning":["running","paused","verifying"].includes(e)?"executing":e}function gO(e,t){if(e==="delivered")return"completed";if(e==="blocked")return"blocked";if(e==="failed")return"failed";if(e==="cancelled")return"cancelled";let n=t.flatMap(i=>i===void 0?[]:[i.status]);return n.some(i=>["running","paused"].includes(i))?"executing":n.includes("verifying")?"verifying":n.length>0&&n.every(i=>i==="completed")?e==="active"?"verifying":"completed":e==="active"?"executing":n.includes("blocked")?"blocked":n.includes("failed")?"failed":(n.includes("planned")||["draft","ready"].includes(e),"planning")}function Vs(e){return e.filter(t=>t!==null).map(t=>new Date(t).toISOString()).sort().at(-1)??null}var Ws=L(()=>{"use strict";Zr()});function hO(e){let t=e.fold.finished?.occurred_at??null,n=e.fold.effective_usage_records.findLast(l=>l.runtime)?.runtime,i=e.fold.effective_usage_records.at(-1),r=Wd(e.fold.run.occurred_at,t,e.fold.effective_usage_records,e.fold.records),o=e.fold.finished,a=typeof r.source_duration_ms=="number"&&r.source_duration_ms>=0?r.source_duration_ms:typeof o?.duration_ms=="number"&&o.duration_ms>=0&&(o.duration_provenance==="observed"||o.duration_provenance==="reconciled"||o.duration_provenance==="legacy_inferred")?o.duration_ms:null,s=typeof r.source_duration_ms=="number"&&r.source_duration_ms>=0?"observed":a===null?"unavailable":o?.duration_provenance??"unavailable";return{id:e.fold.run.run_id,artifact_path:e.artifactPath,status:e.fold.status,phase:e.fold.records.findLast(l=>"phase"in l)?.phase??e.fold.run.phase,entrypoint:e.fold.run.entrypoint,work_type:e.fold.run.work_type,run_role:ig(e.fold.run),run_kind:bT(e.fold.run),run_purpose:ST(e.fold.run),requires_finalizer:kT(e.fold.run),parent_run_id:e.fold.run.parent_run_id,client:e.fold.run.client,agent:e.fold.run.agent,agent_name:HB(e.fold.run.agent,e.fold.run.agent_name),provider:i?.provider??e.fold.run.provider,model:e.fold.run.model,reasoning_effort:e.fold.run.reasoning_effort??null,...JB(e.fold),...KB(e.fold),service_tier:n?.service_tier??null,conversation_id:e.fold.run.conversation_id,execution_id:e.fold.run.execution_id,task_id:e.fold.run.task_id,spec_id:e.fold.run.spec_id,prd_id:e.fold.run.prd_id,change_id:e.fold.run.change_id,started_at:e.fold.run.occurred_at,finished_at:t,duration_ms:a,duration_started_at:a===null?null:o?.started_at??e.fold.run.occurred_at,duration_provenance:s,...r,pricing_segments:e.fold.effective_usage_records.map(l=>({phase:l.phase,provider:l.provider,model:l.model,service_tier:l.runtime?.service_tier??n?.service_tier??null,input_tokens:l.tokens.input,cached_input_tokens:l.tokens.cached_input,output_tokens:l.tokens.output,reasoning_tokens:l.tokens.reasoning,total_tokens:l.tokens.total,recorded_usd:l.cost.usd,recorded_brl:l.cost.brl,recorded_fx_rate:l.cost.fx_rate??null})),usage:fO([e])}}function HB(e,t){if(e==="codex")return"codex";let n=t??e;return n.startsWith("agent-")?`zaip-agent-${n.slice(6)}`:n}function JB(e){let t=new Set([...e.provider_invocation_records.map(i=>i.effective.model),...e.effective_usage_records.map(i=>i.model)].filter(i=>i!==null)),n=new Set([...e.provider_invocation_records.map(i=>i.effective.reasoning_effort),...e.effective_usage_records.map(i=>i.runtime?.reasoning_effort??null)].filter(i=>i!==null));return{effective_model:t.size===1?[...t][0]??null:null,effective_reasoning_effort:n.size===1?[...n][0]??null:null,effective_config_mixed:t.size>1||n.size>1}}function KB(e){let t=new Set([...e.model_selection_records.map(n=>n.invocation_id),...e.provider_invocation_records.map(n=>n.invocation_id)]);return t.size===0?{call_count:null,terminal_call_count:null,failed_call_count:null,cancelled_call_count:null}:{call_count:t.size,terminal_call_count:e.provider_invocation_records.length,failed_call_count:e.provider_invocation_records.filter(n=>n.status==="failed").length,cancelled_call_count:e.provider_invocation_records.filter(n=>n.status==="cancelled").length}}function yO(e,t){return e!==null&&e>=0?e:null}var Vg=L(()=>{"use strict";Os();qg();Ws()});function Tr(e){return e.map(t=>typeof t.source_duration_ms=="number"&&t.source_duration_ms>=0?{...t,duration_ms:t.source_duration_ms,duration_provenance:"observed",estimation_basis:null}:typeof t.duration_ms=="number"&&t.duration_ms>=0&&(t.duration_provenance==="observed"||t.duration_provenance==="reconciled"||t.duration_provenance==="legacy_inferred")?{...t,estimation_basis:null}:{...t,duration_ms:null,duration_provenance:"unavailable",estimation_basis:null})}var Kd=L(()=>{"use strict"});function bO(e,t){let n=new Set(e.dag.nodes.map(_=>_.task_id)),i=new Map(t.changes.map(_=>[_.id,_])),r=new Map(t.specs.map(_=>[_.id,_])),o=new Set,a=new Set,s=_=>{o.add(_);let p=r.get(_),y=p?.prd_id??p?.parent_id??null;y!==null&&a.add(y)};e.origin.type==="spec"&&s(e.origin.spec_id),e.origin.type==="prd"&&a.add(e.origin.prd_id);for(let _ of t.tasks){if(!n.has(_.id))continue;let p=i.get(_.change_id)?.source;p&&((p.type==="spec"||p.type==="prd")&&p.spec_id&&s(p.spec_id),p.type==="prd"&&p.prd_id&&a.add(p.prd_id))}let l=t.runs.filter(_=>_.execution_id===e.id||_.task_id!==null&&n.has(_.task_id)),c=l.flatMap(_=>_.call_count===null?[]:[_.call_count]),d=l.filter(_=>_.run_purpose==="finalization"||_.agent==="agent-finalizer"||_.agent==="agent-task-finalizer"),u=new Set(d.flatMap(_=>_.status==="completed"&&_.task_id!==null?[_.task_id]:[]));return{agent_call_count:l.length,orchestrator_run_count:l.filter(_=>_.parent_run_id===null).length,subagent_run_count:l.filter(_=>_.parent_run_id!==null).length,finalizer_run_count:d.length,finalized_task_count:u.size,llm_call_count:c.reduce((_,p)=>_+p,0),llm_call_count_complete:c.length===l.length,task_count:n.size,spec_count:o.size,prd_count:a.size,duration_ms:GB(l.filter(_=>_.parent_run_id===null)),total_tokens:vO(l.map(_=>_.usage?.tokens.total??null)),cost_brl:vO(l.map(_=>_.usage?.cost.brl??null))}}function vO(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}function GB(e){let t=e.flatMap(n=>typeof n.source_duration_ms=="number"&&n.source_duration_ms>=0?[n.source_duration_ms]:typeof n.duration_ms=="number"&&n.duration_ms>=0&&(n.duration_provenance==="observed"||n.duration_provenance==="reconciled"||n.duration_provenance==="legacy_inferred")?[n.duration_ms]:[]);return t.length===0?null:t.reduce((n,i)=>n+i,0)}var SO=L(()=>{"use strict"});function Gd(e){let t=kO(e.from??null,"from"),n=kO(e.to??null,"to");if(t!==null&&n!==null&&t>n)throw new Error("from must not be after to");return{from:t,to:n}}function kO(e,t){if(e===null||e.length===0)return null;let n=/^\d{4}-\d{2}-\d{2}$/.test(e)?t==="to"?`${e}T23:59:59.999-03:00`:`${e}T00:00:00.000-03:00`:e,i=Date.parse(n);if(Number.isNaN(i))throw new Error(`${t} must be an ISO timestamp`);return new Date(i).toISOString()}var Wg=L(()=>{"use strict"});function un(e){let t=n=>{let i=e.map(n),r=o=>{let a=o.filter(s=>s!==null);return a.length===0?null:a.reduce((s,l)=>s+l,0)};return{events:i.reduce((o,a)=>o+a.events,0),tokens:{input:r(i.map(o=>o.tokens.input)),cached_input:r(i.map(o=>o.tokens.cached_input)),output:r(i.map(o=>o.tokens.output)),reasoning:r(i.map(o=>o.tokens.reasoning)),total:r(i.map(o=>o.tokens.total))},cost:{usd:r(i.map(o=>o.cost.usd)),brl:r(i.map(o=>o.cost.brl))},coverage:{events:i.reduce((o,a)=>o+a.coverage.events,0),tokens:i.reduce((o,a)=>o+a.coverage.tokens,0),usd:i.reduce((o,a)=>o+a.coverage.usd,0),brl:i.reduce((o,a)=>o+a.coverage.brl,0)}}};return{conversation:t(n=>n.usage.conversation),planning:t(n=>n.usage.planning),execution:t(n=>n.usage.execution),total:t(n=>n.usage.total),new_work:t(n=>n.usage.new_work),rework:t(n=>n.usage.rework)}}function Xd(e){let t=Tr(e.runs),n=Es(t),i=un(t),r={conversation:un(t.filter(o=>o.entrypoint==="conversation")),task:un(t.filter(o=>o.entrypoint==="task")),spec:un(t.filter(o=>o.entrypoint==="spec")),prd:un(t.filter(o=>o.entrypoint==="prd"))};return{...e,runs:t,origins:r,summary:{...e.summary,run_count:t.length,execution_duration_ms:Hr(n)??0,execution_day_count:new Set(n.map(o=>o.started_at.slice(0,10))).size,source_latest_at:Vs([e.summary.source_latest_at,...t.map(o=>o.finished_at??o.started_at)]),quality:qs(e.tasks,t),reconciliation:Hd(i,r),usage:i}}}function Bg(e){let t=[...e.taskIds].flatMap(r=>{let o=e.tasks.get(r);return o===void 0?[]:[o]}),n=e.decisions.filter(r=>r.scope_type==="change"&&e.changeIds.has(r.scope_id)||r.scope_type==="execution"&&e.executionIds.has(r.scope_id)),i=Hg(e.runs);return{id:e.id,title:e.title,created_at:e.createdAt,updated_at:e.updatedAt,kind:e.kind,parent_id:e.parentId,artifact_path:e.artifactPath,lifecycle_status:e.lifecycleStatus,work_status:gO(e.lifecycleStatus,[...e.executionIds].map(r=>e.executions.get(r))),execution_ids:[...e.executionIds].sort(),task_ids:[...e.taskIds].sort(),planned_tasks:[...e.plannedTasks],canonical_run_ids:i.canonicalRuns.map(r=>r.id).sort(),run_ids:i.canonicalRuns.map(r=>r.id).sort(),root_execution_run_ids:i.rootExecutionRuns.map(r=>r.id).sort(),execution_count:e.executionIds.size,task_count:Math.max(e.taskIds.size,e.plannedTasks.length),run_count:i.canonicalRuns.length,duration_ms:i.observedRootDuration,observed_root_duration_ms:i.observedRootDuration,observed_lifecycle_duration_ms:i.observedLifecycleDuration,duration_coverage:{eligible_runs:i.rootExecutionRuns.length,known_runs:i.knownRootRuns.length,unknown_runs:i.rootExecutionRuns.length-i.knownRootRuns.length,coverage_ratio:i.rootExecutionRuns.length===0?1:i.knownRootRuns.length/i.rootExecutionRuns.length},duration_provenance:i.observedRootDuration===null?"unavailable":"observed",lifecycle_duration_coverage:i.lifecycleCoverage,lifecycle_duration_provenance:i.observedLifecycleDuration===null?"unavailable":"observed",decisions:Bd(n),rework_run_count:i.canonicalRuns.filter(r=>r.work_type==="rework").length,quality:qs(t,i.canonicalRuns),usage:un(i.canonicalRuns)}}function Hg(e){let t=[...new Map(e.map(a=>[a.id,a])).values()],n=t.filter(a=>a.phase==="execution"&&a.parent_run_id==null),i=n.filter(a=>Zg(a)!==null),r=t.filter(a=>a.parent_run_id==null),o=r.filter(a=>Zg(a)!==null);return{canonicalRuns:t,rootExecutionRuns:n,knownRootRuns:i,observedRootDuration:Hr(n),observedLifecycleDuration:XB(r),lifecycleCoverage:{eligible_runs:r.length,known_runs:o.length,unknown_runs:r.length-o.length,coverage_ratio:r.length===0?1:o.length/r.length}}}function XB(e){let t=e.flatMap(a=>{let s=Zg(a),l=Date.parse(a.source_started_at??a.duration_started_at??a.started_at);return s!==null&&Number.isFinite(l)?[{start:l,end:l+s}]:[]}).toSorted((a,s)=>a.start-s.start),n=t[0];if(n===void 0)return null;let i=0,r=n.start,o=n.end;for(let a of t.slice(1))a.start<=o?o=Math.max(o,a.end):(i+=o-r,r=a.start,o=a.end);return i+o-r}function Zg(e){return typeof e.source_duration_ms=="number"&&e.source_duration_ms>=0?e.source_duration_ms:typeof e.duration_ms=="number"&&e.duration_ms>=0&&(e.duration_provenance==="observed"||e.duration_provenance==="reconciled"||e.duration_provenance==="legacy_inferred")?e.duration_ms:null}function wO(e){function t(n,i){let r=new Set([...i===null?[]:e.prds.filter(c=>c.id===i).map(c=>c.creation_run_id),...e.specs.filter(c=>n.has(c.id)).map(c=>c.creation_run_id)].filter(c=>c!=null)),o=new Set(e.changes.filter(c=>i!==null&&c.source.type==="prd"&&c.source.prd_id===i||(c.source.type==="spec"||c.source.type==="prd")&&c.source.spec_id!==null&&c.source.spec_id!==void 0&&n.has(c.source.spec_id)).map(c=>c.id)),a=new Set(e.tasks.filter(c=>o.has(c.change_id)).map(c=>c.id)),s=new Set(e.executions.filter(c=>i!==null&&c.origin.type==="prd"&&c.origin.prd_id===i||c.origin.type==="spec"&&n.has(c.origin.spec_id)||c.dag.nodes.some(d=>a.has(d.task_id))).map(c=>c.id)),l=e.runs.filter(c=>c.spec_id!==null&&n.has(c.spec_id)||c.task_id!==null&&a.has(c.task_id)||r.has(c.id)||i!==null&&(c.prd_id===i||c.execution_id!==null&&s.has(c.execution_id)));return{changeIds:o,taskIds:a,executionIds:s,runs:l}}return{forSpec:n=>t(new Set([n]),null),forPrd:n=>t(new Set(e.specs.filter(i=>i.prd_id===n).map(i=>i.id)),n)}}var Jg=L(()=>{"use strict";As();Fg();Kd();Ws()});function EO(e,t){let n=new Map(e.map(r=>[r.id,Kg(r.prepared_plan)])),i=new Map(t.map(r=>{let o=Kg(r.prepared_plan);if(o.length>0||r.prd_id===null)return[r.id,o];let a=e.find(s=>s.id===r.prd_id);return[r.id,a===void 0?[]:Kg(a.prepared_plan,r.id)]}));return{byPrd:n,bySpec:i}}function AO(e){let t=new Map;for(let n of e){if(n.kind==="interaction")continue;let i=new Set(n.dag.nodes.map(r=>r.task_id));n.origin.type==="task"&&i.add(n.origin.task_id);for(let r of i)t.set(r,new Set([...t.get(r)??[],n.id]))}return new Map([...t].map(([n,i])=>[n,[...i].sort()]))}function Kg(e,t){if(e==null||e.blueprints===void 0)return[];let n=new Map(e.blueprints.changes.map(r=>[r.id,r.source.type==="spec"||r.source.type==="prd"?r.source.spec_id??null:null])),i=new Map(e.dag.nodes.map(r=>[r.task_id,r.depends_on]));return e.blueprints.tasks.filter(r=>t===void 0||n.get(r.change_id)===t).map(r=>({id:r.id,title:r.title,objective:r.objective,depends_on:i.get(r.id)??[]}))}var TO=L(()=>{"use strict"});function OO(e){return typeof e=="number"&&e>0?Math.round(e*36e5/4e6):null}function Yd(e,t){let n=e.filter(o=>(o.total_tokens??0)>0);if(n.length<7||t<n.length)return e.map(o=>xO(o));let i=n.reduce((o,a)=>o+(a.total_tokens??0),0),r=0;return e.map(o=>{if(!n.includes(o))return xO(o);let a=n.at(-1)===o?t-r:1+Math.floor((t-n.length)*(o.total_tokens??0)/i);return r+=a,{...o,duration:{known_sum:a,unknown:0,complete:!0,coverage_ratio:1}}})}function Gg(e,t){let n=Yd(e.map(([r,o])=>({key:r,total_tokens:o.usage.total_tokens.known_sum,estimated_brl:o.usage.cost.known_sum,duration:co(r,o).value})),t),i=new Map(n.map(r=>[r.key,r.duration]));return Object.fromEntries(e.map(([r,o])=>[r,{...o,duration:i.get(r)??co(r,o).value}]))}function xO(e){if((e.total_tokens??0)<=0||e.duration.known_sum>0)return e;let t=OO(e.total_tokens);return t===null?e:{...e,duration:{known_sum:t,unknown:0,complete:!0,coverage_ratio:1}}}function Zs(e){let t=e.filter(i=>(i.phase===void 0||i.phase==="execution")&&i.parent_run_id==null),n=new Map;for(let i of t){let r=i.duration_started_at??i.started_at;if(!ld(r)||r===null)continue;let o=Date.parse(r),a=Ot(r,"day");if(!Number.isFinite(o)||a===null)continue;if(i.duration_ms===null||i.duration_ms<0){let l=n.get(a)??{intervals:[],known:0,unknown:0};l.unknown+=1,n.set(a,l);continue}let s=o+i.duration_ms;for(let l=o;l<=s;){let c=Ot(new Date(l).toISOString(),"day");if(c===null)break;let d=Math.min(s,QB(c)),u=n.get(c)??{intervals:[],known:0,unknown:0};if(u.intervals.push({start:l,end:d}),u.known+=1,n.set(c,u),d>=s)break;l=d}}return new Map([...n].map(([i,r])=>{let o=r.known+r.unknown;return[i,{value:{known_sum:eH(r.intervals),unknown:r.unknown,complete:r.unknown===0,coverage_ratio:o===0?1:r.known/o},population:{eligible_runs:o,known_runs:r.known,unknown_runs:r.unknown}}]}))}function co(e,t,n,i=!1){let r=Br[e]??0,o=e>=Gt.cutoffDay?n:void 0;if(i&&r===0&&o===void 0)return YB();let a=i?o?.value:e<Gt.cutoffDay?void 0:t.duration,s=a?.unknown??0,l=i?o?.population.eligible_runs??0:t.runs,c=i?o?.population.known_runs??0:t.runs-s;return{value:{known_sum:r+(a?.known_sum??0),unknown:s,complete:s===0,coverage_ratio:l===0?1:c/l},population:{eligible_runs:l,known_runs:c,unknown_runs:s}}}function YB(){return{value:{known_sum:0,unknown:0,complete:!0,coverage_ratio:1},population:{eligible_runs:0,known_runs:0,unknown_runs:0}}}function QB(e){let[t,n,i]=e.split("-").map(Number),r=new Date(Date.UTC(t,n-1,i+1)),o=new Intl.DateTimeFormat("en-US",{timeZone:"America/Sao_Paulo",timeZoneName:"longOffset"}).formatToParts(r).find(s=>s.type==="timeZoneName")?.value??"GMT",a=/^GMT([+-])(\d{2}):(\d{2})$/.exec(o);return a===null?r.getTime():r.getTime()-(Number(a[2])*60+Number(a[3]))*6e4*(a[1]==="+"?1:-1)}function eH(e){let t=0,n=Number.NaN,i=Number.NaN;for(let r of e.toSorted((o,a)=>o.start-a.start))!Number.isFinite(n)||r.start>i?(Number.isFinite(n)&&(t+=i-n),n=r.start,i=r.end):i=Math.max(i,r.end);return Number.isFinite(n)?t+i-n:t}var Xg=L(()=>{"use strict";Ho()});function tH(e,t){return(t.from===null||e>=t.from.slice(0,10))&&(t.to===null||e<=t.to.slice(0,10))}function RO(e,t){let n=u=>{let _=e.reduce((f,[,h])=>f+u(h).known_sum,0),p=e.reduce((f,[,h])=>f+u(h).unknown,0),y=e.reduce((f,[,h])=>f+h.runs,0);return{value:y===p?null:_,coverage:y===0?1:(y-p)/y}},i=e.map(([u,_])=>{let p=u<=Gt.cutoffDay?Br[u]??0:0,y=u<Gt.cutoffDay?void 0:_.duration;return{known_sum:p+(y?.known_sum??0),unknown:y?.unknown??0,runs:_.runs}}),r=i.reduce((u,_)=>u+_.known_sum,0),o=i.reduce((u,_)=>u+_.unknown,0),a=i.reduce((u,_)=>u+_.runs,0),s=a===o&&r===0?null:r,l={value:t.from===null&&t.to===null&&s!==null?cd(s):s,coverage:a===0?1:(a-o)/a},c=n(u=>u.usage.total_tokens),d=n(u=>u.usage.cost);return{duration_ms:l.value,tokens:c.value,cost_brl:d.value,coverage:{duration:l.coverage,tokens:c.coverage,cost:d.coverage},execution_day_count:i.filter(u=>u.known_sum>0).length}}function Qd(e,t){if(e===null)return[];let n=new Map;for(let[i,r]of Object.entries(e.days)){if(!tH(i,t))continue;let o=r.tasks.length>0?r.tasks:r.specs.length>0?r.specs:r.prds;for(let a of o){let s=n.get(a.id);if(s===void 0){n.set(a.id,structuredClone(a));continue}s.run_count+=a.run_count;for(let l of["duration","total_tokens","cost"])s.metrics[l].known_sum+=a.metrics[l].known_sum,s.metrics[l].unknown+=a.metrics[l].unknown,s.metrics[l].complete=s.metrics[l].unknown===0,s.metrics[l].coverage_ratio=s.run_count===0?1:(s.run_count-s.metrics[l].unknown)/s.run_count;(a.window_at??a.occurred_at)>(s.window_at??s.occurred_at)&&(s.status=a.status,s.risk=a.risk,a.window_at!==void 0&&(s.window_at=a.window_at))}}return[...n.values()]}function CO(e){let t={},n={};for(let i of e){let r=i.status??"unclassified",o=i.risk??"unclassified";t[r]=(t[r]??0)+1,n[o]=(n[o]??0)+1}return{total:e.length,statuses:t,risks:n}}function Yg(e,t,n){let i=oH(),r={...i,tokens:{...i.tokens,total:lo(e.metrics.total_tokens)},cost:{...i.cost,brl:lo(e.metrics.cost)}};return{id:e.id,title:e.title??e.id,created_at:e.occurred_at,updated_at:e.window_at??null,kind:t,parent_id:e.parent_id,artifact_path:"",lifecycle_status:e.status??"unavailable",work_status:nH(e.status),execution_ids:[],task_ids:[],planned_tasks:[],canonical_run_ids:[],run_ids:[],root_execution_run_ids:[],execution_count:0,task_count:n,run_count:e.run_count,duration_ms:lo(e.metrics.duration),observed_root_duration_ms:lo(e.metrics.duration),observed_lifecycle_duration_ms:null,duration_coverage:rH(e),duration_provenance:e.metrics.duration.complete?"observed":"unavailable",lifecycle_duration_coverage:iH(),lifecycle_duration_provenance:"unavailable",decisions:{human:0,agent:0},rework_run_count:0,quality:{completed_tasks:0,task_completion_rate:0,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},usage:aH(i,r)}}function $O(e){let t=e.status,n=["completed","blocked","failed","cancelled"].includes(t??"");return{schema_version:2,id:e.id,revision:0,change_id:"",title:e.title??e.id,short_name:e.id,objective:"",status:t==="draft"||t==="planned"||t==="executing"||t==="verifying"||t==="completed"||t==="failed"||t==="blocked"||t==="cancelled"?t:"draft",attempt_count:t==="planned"||t==="draft"?0:null,risk:e.risk==="lite"||e.risk==="standard"||e.risk==="critical"?e.risk:"standard",priority:"medium",owner:null,requirement_ids:[],acceptance_ids:[],depends_on:[],write_scopes:[],created_at:e.occurred_at,updated_at:e.window_at??e.occurred_at,started_at:t==="executing"||t==="verifying"||n?e.occurred_at:null,finished_at:n?e.window_at??e.occurred_at:null,result:null,artifact_path:"",progress:n?1:0,spec_id:e.parent_id,execution_started:t==="executing"||t==="verifying"||n,execution_ids:[],execution_count:0,telemetry:{duration_ms:lo(e.metrics.duration),tokens:lo(e.metrics.total_tokens),cost_brl:lo(e.metrics.cost)},test_count:0}}function IO(e){return e.map(t=>({task_id:t.id,duration_ms:t.metrics.duration.known_sum,total_tokens:t.metrics.total_tokens.known_sum,cost_brl:t.metrics.cost.known_sum,run_count:t.run_count})).sort((t,n)=>n.duration_ms-t.duration_ms||t.task_id.localeCompare(n.task_id)).slice(0,5)}function lo(e){return e.known_sum===0&&e.unknown>0?null:e.known_sum}function nH(e){return e==="delivered"?"completed":["planning","executing","verifying","completed","blocked","failed","cancelled"].includes(e??"")?e:"planning"}function rH(e){return{eligible_runs:e.run_count,known_runs:e.run_count-e.metrics.duration.unknown,unknown_runs:e.metrics.duration.unknown,coverage_ratio:e.metrics.duration.coverage_ratio}}function iH(){return{eligible_runs:0,known_runs:0,unknown_runs:0,coverage_ratio:1}}function oH(){return{events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}}}function aH(e,t){return{conversation:e,planning:e,execution:e,total:t,new_work:e,rework:e}}var NO=L(()=>{"use strict";Ho()});function Qg(e,t,n=!0){let i=[...new Map(e.map(c=>[c.id,c])).values()],r=n?i.filter(c=>n_(c.finished_at??c.started_at,t)):i,o=r.filter(c=>c.phase==="execution"&&c.parent_run_id==null),a=eh(o,t),s=c=>{let d=c.filter(u=>u!==null);return d.length===0?null:Math.round(d.reduce((u,_)=>u+_,0)*1e9)/1e9},l=c=>c.length===0?1:c.filter(d=>d!==null).length/c.length;return{duration_ms:a===void 0||a.coverage_ratio===0?null:a.known_sum,tokens:s(r.map(c=>c.total_tokens)),cost_brl:s(r.map(c=>c.cost)),coverage:{duration:a?.coverage_ratio??1,tokens:l(r.map(c=>c.total_tokens)),cost:l(r.map(c=>c.cost))},execution_day_count:new Set(o.map(c=>Ot(c.duration_started_at??c.started_at,"day")).filter(c=>c!==null)).size}}function eh(e,t){let n=Zs(e),r=[...new Set([...Object.keys(Br),...n.keys()])].filter(c=>e_(c,t)).map(c=>co(c,{runs:0},n.get(c),!0).value);if(r.length===0)return;let o=r.reduce((c,d)=>c+d.unknown,0),a=r.reduce((c,d)=>c+d.known_sum,0),s=[...n].filter(([c])=>e_(c,t)).reduce((c,[,d])=>c+d.population.eligible_runs,0),l=[...n].filter(([c])=>e_(c,t)).reduce((c,[,d])=>c+d.population.known_runs,0);return{known_sum:a,unknown:o,complete:o===0,coverage_ratio:s===0?1:l/s}}function e_(e,t){return(t.from===null||e>=t.from.slice(0,10))&&(t.to===null||e<=t.to.slice(0,10))}async function Hs(e,t,n={},i={}){if(t.version===1)throw new Error("Operations projection requires a modern WorkspaceLayout");let r=new Ut(e),o=Gd(n),[a,s,l,c]=await Promise.all([r.readDailyReadModels("overview"),r.readDailyReadModels("tasks"),r.readDailyReadModels("specs"),r.readDailyReadModels("prds")]);if(a===null)throw new Error("Lifecycle daily overview is not initialized");let d=Object.entries(a.days).filter(([T])=>e_(T,o)).map(([T,N])=>[T,N.overview]),u=RO(d,o),_={runs:d.reduce((T,[,N])=>T+N.runs,0)},p=mH(),y={...p,tokens:{...p.tokens,total:u.tokens},cost:{...p.cost,brl:u.cost_brl}},f=u.coverage,h=Gg(d,u.duration_ms??0),k=Qd(s,o),S=Qd(c,o),R=Qd(l,o),g=CO(k),b=g.statuses,O=g.risks,P=new Map;for(let T of k)T.parent_id!==null&&P.set(T.parent_id,(P.get(T.parent_id)??0)+1);let C=new Map(R.map(T=>[T.id,T.parent_id])),v=S.map(T=>Yg(T,"prd",k.filter(N=>N.parent_id===T.id).length+[...P].filter(([N])=>C.get(N)===T.id).reduce((N,[,H])=>N+H,0))),A=R.map(T=>Yg(T,"spec",P.get(T.id)??0)),x=IO(k);return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",filters:o,summary:{prd_count:v.length,spec_count:A.length,execution_count:0,task_count:g.total,run_count:_.runs,overview_metrics:{duration_ms:u.duration_ms,execution_day_count:u.execution_day_count,tokens:u.tokens,cost_brl:u.cost_brl,prd_count:v.length,spec_count:A.length,selected_counts:{prds:v.length,specs:A.length},task_count:g.total,completed_prd_count:v.filter(T=>T.work_status==="completed").length,completed_spec_count:A.filter(T=>T.work_status==="completed").length,completed_task_count:b.completed??0,task_status_counts:b,task_risk_counts:O,top_tasks:x,latest_task_created_at:k.map(T=>T.occurred_at).sort().at(-1)??null,coverage:{duration:f.duration,tokens:f.tokens,cost:f.cost},data_source:"lifecycle_manifest_summary",partial:!0},decisions:{human:0,agent:0},source_latest_at:a.source_latest_at,quality:{completed_tasks:0,task_completion_rate:0,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},reconciliation:{phase_tokens_match_total:!1,phase_usd_match_total:!1,phase_brl_match_total:!1,origin_tokens_match_total:!1},usage:Bs(p,y),periods:{daily:h}},origins:{conversation:Bs(p,p),task:Bs(p,p),spec:Bs(p,p),prd:Bs(p,p)},prds:v,specs:A,tasks:i.includeBoardTasks?k.map($O):[],changes:[],executions:[],runs:[],decisions:[],evidences:[],validations:[]}}function sH(e,t){return Object.fromEntries(e.map(([n,i])=>{let r=eh(t.filter(lH),{from:n,to:n});return[n,{...i,...r===void 0?{}:{duration:r}}]}))}function cH(e,t){let n={},i={},r=0;for(let o of e){let s=o.finished_at??(typeof o.data?.finished_at=="string"?o.data.finished_at:null)??o.updated_at;if(!n_(s,t))continue;r+=1;let l=o.status??"unclassified",c=o.risk??"unclassified";n[l]=(n[l]??0)+1,i[c]=(i[c]??0)+1}return{total:r,statuses:n,risks:i}}function n_(e,t){let n=new Date(e).toISOString();return(t.from===null||n>=t.from)&&(t.to===null||n<=t.to)}function PO(e,t){let n=new Map;for(let i of e){if(i.task_id===null||!t.has(i.task_id))continue;let r=n.get(i.task_id)??{task_id:i.task_id,duration_ms:0,total_tokens:0,cost_brl:0,run_count:0,runs:[]};r.runs.push(i),r.total_tokens+=i.total_tokens??0,r.cost_brl+=i.cost??0,r.run_count+=1,n.set(i.task_id,r)}return[...n.values()].map(({runs:i,...r})=>({...r,duration_ms:Hr(i)??0})).sort((i,r)=>r.duration_ms-i.duration_ms||i.task_id.localeCompare(r.task_id)).slice(0,5)}function lH(e){return e.phase==="execution"&&e.parent_run_id==null}function uH(e,t,n){let i=t===null?null:Ot(t,"day"),r=n===null?null:Ot(n,"day");return Object.entries(dH(e)).filter(([o])=>(i===null||o>=i)&&(r===null||o<=r))}function dH(e){let t=[...new Map((e.run_metrics??[]).map(o=>[o.id,o])).values()],n=Object.values(e.periods.daily).reduce((o,a)=>o+a.runs,0);if(t.length===0||t.length!==n)return e.periods.daily;let i=new Map;for(let o of t){let a=Ot(o.finished_at??o.started_at,"day");a!==null&&i.set(a,[...i.get(a)??[],o])}let r=new Set([...Object.keys(e.periods.daily),...i.keys()]);return Object.fromEntries([...r].map(o=>{let a=e.periods.daily[o]??_H(e.usage.cost.currency),s=i.get(o)??[];return[o,{...a,runs:s.length,usage:{...a.usage,total_tokens:t_(s.map(l=>l.total_tokens)),cost:{...t_(s.map(l=>l.cost)),currency:a.usage.cost.currency??e.usage.cost.currency}},events:t_(s.map(l=>l.events))}]}))}function t_(e){let t=e.filter(i=>i!==null),n=e.length-t.length;return{known_sum:t.reduce((i,r)=>i+r,0),unknown:n,complete:n===0,coverage_ratio:e.length===0?1:t.length/e.length}}function _H(e){let t=t_([]);return{prds:0,specs:0,tasks:0,validations:0,evidences:0,runs:0,usage:{input_tokens:t,output_tokens:t,total_tokens:t,cost:{...t,currency:e}},events:t}}function pH(e,t,n){return PO((e.run_metrics??[]).filter(i=>n_(i.finished_at??i.started_at,t)),n)}function fH(e,t){return n_(e.updated_at,t)}function mH(){return{events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}}}function Bs(e,t){return{conversation:e,planning:e,execution:e,total:t,new_work:e,rework:e}}function gH(e){let t=n=>e.length===0?1:n/e.length;return{duration:t(e.filter(n=>n.duration_ms!==null).length),tokens:t(e.filter(n=>n.total_tokens!==null).length),cost:t(e.filter(n=>n.cost!==null).length)}}var th=L(()=>{"use strict";bi();Ho();As();Xg();Wg();NO()});function MO(e){return[...e].sort((t,n)=>n.started_at.localeCompare(t.started_at)||n.id.localeCompare(t.id))}var LO=L(()=>{"use strict"});async function jO(e,t,n){if(t.version===1)throw new TypeError("Operations projection requires a modern layout");let i=(await Promise.all(yH(t.entityRoot("run"),n).map(o=>e.listFiles(o,".jsonl")))).flat();return(await hH(i,32,async o=>{let a=xs(Ts(await e.readText(o))),s=a.finished?.occurred_at??a.run.occurred_at;return(n.from!==null||n.to!==null)&&!vH(s,n)?null:{fold:a,artifactPath:o,cost:{run:a.run,records:a.records,effective_usage_records:a.effective_usage_records}}})).filter(o=>o!==null).sort((o,a)=>o.fold.run.run_id.localeCompare(a.fold.run.run_id))}async function hH(e,t,n){let i=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);i.push(...await Promise.all(o.map(n)))}return i}function yH(e,t){return[e]}function vH(e,t){let n=new Date(e).toISOString();return(t.from===null||n>=t.from)&&(t.to===null||n<=t.to)}var DO=L(()=>{"use strict";Os()});async function r_(e,t,n){let i=new Map(t.map(o=>[o.id,0])),r=new Map;for(let o of t)r.set(o.change_id,[...r.get(o.change_id)??[],o]);for(let[o,a]of r){let s=n(o).replace(/\\/g,"/"),l=s.slice(0,s.lastIndexOf("/")),c;try{c=await e.listFiles(l)}catch{continue}let d=c.filter(u=>u.replace(/\\/g,"/").includes("/artifacts/tests/")&&/\.(?:md|json|jsonl|txt|log)$/i.test(u));for(let u of d){let _;try{_=await e.readText(u)}catch{continue}for(let p of a)_.includes(p.id)&&i.set(p.id,(i.get(p.id)??0)+1)}}return i}var nh=L(()=>{"use strict"});function FO(e,t){let n=Qg(e.map(i=>({id:i.id,started_at:i.started_at,finished_at:i.finished_at??null,phase:i.phase??null,parent_run_id:i.parent_run_id??null,duration_started_at:i.source_started_at??i.duration_started_at??null,duration_ms:i.source_duration_ms!==null&&i.source_duration_ms!==void 0?i.source_duration_ms:i.duration_ms,total_tokens:i.usage.total.tokens.total,cost:i.usage.total.cost.brl})),t,!1);return{duration_ms:n.duration_ms,execution_day_count:n.execution_day_count,tokens:n.tokens,cost_brl:n.cost_brl}}async function Ks(e,t,n={},i={}){if(t.version===1)throw new Error("Operations projection requires a modern WorkspaceLayout");let r=Gd(n),o=new Ut(e),a=new no(e,t),s=new ro(e,t),l=new io(e,t),c=new oo(e,t),d=new ua(e,t),u=new md(e,t),[_,p]=await Promise.all([o.readEntities(),i.overviewOnly?Promise.resolve([]):jO(e,t,r)]);if(_.length===0&&await o.readSummary()===null&&!await e.exists(".agents/records/lifecycle/.gitkeep"))throw new Error("Lifecycle manifest is not initialized; run `zaip manifest rebuild --confirm-full-scan`");let y=Js(_,"prd"),f=Js(_,"spec"),h=Js(_,"change"),k=Js(_,"execution"),S=Js(_,"task"),R=kH(_),g=SH(_),b=bH(_),O=p.map(hO),P=y.filter(F=>zO(F.status,F.updated_at,r)),C=f.filter(F=>zO(F.status,F.updated_at,r)),v=h.filter(F=>rh(F,r)),A=k.filter(F=>rh(F,r)),x=S.filter(F=>rh(F,r)),T=R.filter(F=>_a(F.created_at,r)),N=g.filter(F=>_a(F.observed_at,r)),H=b.filter(F=>_a(F.executed_at,r)),ie=O.filter(F=>_a(F.finished_at??F.started_at,r)),oe=Tr(ie),be=new Map(h.map(F=>[F.id,F])),z=new Map(S.map(F=>[F.id,F])),ye=new Map(k.map(F=>[F.id,F])),B=wO({changes:h,tasks:S,executions:k,prds:y,specs:f,runs:oe}),he=i.overviewOnly||i.skipTestArtifacts?new Map:await r_(e,x,F=>l.path(F)),Ke=qd(k),Fe=AO(k),Ae=_O(oe),W=EO(y,f),ce=P.map(F=>{let Ye=B.forPrd(F.id);return Bg({id:F.id,title:F.title,createdAt:F.created_at,updatedAt:F.updated_at,kind:"prd",parentId:null,artifactPath:a.path(F.id),lifecycleStatus:F.status,...Ye,decisions:R,executions:ye,tasks:z,plannedTasks:W.byPrd.get(F.id)??[]})}),fe=C.map(F=>{let Ye=B.forSpec(F.id);return Bg({id:F.id,title:F.title,createdAt:F.created_at,updatedAt:F.updated_at,kind:"spec",parentId:F.prd_id,artifactPath:s.path(F.id),lifecycleStatus:F.status,...Ye,decisions:R,executions:ye,tasks:z,plannedTasks:W.bySpec.get(F.id)??[]})}),Re=x.map(F=>{let Ye=be.get(F.change_id);return{...F,attempt_count:F.attempt_count??null,artifact_path:d.path(F.id),progress:Jd(F.status),test_count:he.get(F.id)??0,spec_id:Ye?.source.type==="spec"||Ye?.source.type==="prd"?Ye.source.spec_id:null,execution_started:Ke.has(F.id),execution_ids:Fe.get(F.id)??[],execution_count:Fe.get(F.id)?.length??0,telemetry:Ae.get(F.id)??null}}),Ue=un(oe),pt=Es(oe),Et=FO(oe,r),Pt=i.overviewOnly?await Hs(e,t,r):null,go=UO(x,F=>F.status),ho=UO(x,F=>F.risk),lc=qO(P,C),uc={prd_count:ce.length,spec_count:fe.length,selected_counts:{prds:ce.length,specs:fe.length},task_count:x.length,completed_prd_count:lc.prds,completed_spec_count:lc.specs,completed_task_count:go.completed??0,task_status_counts:go,task_risk_counts:ho,latest_task_created_at:Vs(x.map(F=>F.created_at))},dc={conversation:un(oe.filter(F=>F.entrypoint==="conversation")),task:un(oe.filter(F=>F.entrypoint==="task")),spec:un(oe.filter(F=>F.entrypoint==="spec")),prd:un(oe.filter(F=>F.entrypoint==="prd"))};return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",filters:r,summary:{prd_count:ce.length,spec_count:fe.length,execution_count:A.length,task_count:x.length,run_count:oe.length,execution_duration_ms:Hr(pt)??0,execution_day_count:new Set(pt.map(F=>F.started_at.slice(0,10))).size,overview_metrics:Pt?.summary.overview_metrics===void 0?{...Et,...uc,data_source:"run_records",partial:!1}:{...Pt.summary.overview_metrics,...uc,partial:!1},decisions:Bd(T),source_latest_at:Pt?.summary.source_latest_at??Vs([...P.map(F=>F.updated_at),...C.map(F=>F.updated_at),...v.map(F=>F.updated_at),...A.map(F=>F.updated_at),...x.map(F=>F.updated_at),...T.map(F=>F.created_at),...oe.map(F=>F.finished_at??F.started_at)]),quality:qs(x,oe),reconciliation:Hd(Ue,dc),usage:Pt?.summary.usage??Ue},origins:dc,prds:ce,specs:fe,tasks:Re,changes:i.overviewOnly&&!i.includeOverviewChanges?[]:v.map(F=>({...F,artifact_path:l.path(F.id)})),executions:i.overviewOnly?[]:A.map(F=>({...F,kind:F.kind??"delivery",client_turn_id:F.client_turn_id??null,...bO(F,{runs:oe.map(Ye=>({agent:Ye.agent,call_count:Ye.call_count,duration_ms:Ye.duration_ms,...Ye.duration_provenance===void 0?{}:{duration_provenance:Ye.duration_provenance},execution_id:Ye.execution_id,finished_at:Ye.finished_at,parent_run_id:Ye.parent_run_id,run_purpose:Ye.run_purpose,source_duration_ms:Ye.source_duration_ms??null,started_at:Ye.started_at,status:Ye.status,task_id:Ye.task_id,usage:Ye.usage.total})),tasks:x,changes:v,specs:C}),artifact_path:c.path(F.id),work_status:mO(F.status)})),runs:i.overviewOnly?[]:MO(oe),evidences:N,validations:H,decisions:i.overviewOnly?[]:T.map(F=>({id:F.id,title:F.title,origin:F.origin,scope_type:F.scope_type,scope_id:F.scope_id,artifact_path:u.path(F.scope_type,F.scope_id,F.id),created_at:F.created_at}))}}function qO(e,t){return{prds:e.filter(n=>n.status==="delivered").length,specs:t.filter(n=>n.status==="delivered").length}}function UO(e,t){return e.reduce((n,i)=>{let r=t(i);return n[r]=(n[r]??0)+1,n},{})}function bH(e){return e.flatMap(t=>{let n=t.data;return t.kind!=="validation"||n===null||typeof n.executed_at!="string"?[]:[{id:t.id,task_id:typeof n.task_id=="string"?n.task_id:null,executed_at:n.executed_at}]})}function SH(e){return e.flatMap(t=>{let n=t.data;return t.kind!=="evidence"||n===null||typeof n.observed_at!="string"?[]:[{id:t.id,task_id:typeof n.task_id=="string"?n.task_id:null,observed_at:n.observed_at}]})}function Js(e,t){return e.flatMap(n=>n.kind===t&&n.data!==null?[{...n.data,id:n.id,title:n.title??n.data.title,status:n.status??n.data.status,risk:n.risk??n.data.risk,priority:n.priority??n.data.priority,updated_at:n.updated_at}]:[])}function kH(e){return e.flatMap(t=>{if(t.kind!=="decision"||t.data===null)return[];let n=t.data;return n.origin!=="human"&&n.origin!=="agent"||n.scope_type!=="change"&&n.scope_type!=="execution"||typeof n.scope_id!="string"||typeof n.created_at!="string"?[]:[{id:t.id,title:t.title??t.id,origin:n.origin,scope_type:n.scope_type,scope_id:n.scope_id,created_at:n.created_at}]})}function rh(e,t){return _a(e.finished_at??e.updated_at,t)}function zO(e,t,n){return _a(t,n)}function _a(e,t){let n=new Date(e).toISOString();return(t.from===null||n>=t.from)&&(t.to===null||n<=t.to)}var VO=L(()=>{"use strict";Os();bi();Ds();Ug();As();zg();Fg();Vg();Kd();SO();Wg();Jg();TO();th();LO();DO();nh();Ws();qg();Vg();Kd();Jg()});async function ih(e,t,n){if(t.version===1)throw new Error("Task detail requires a modern WorkspaceLayout");let i=new ua(e,t),r=new io(e,t),o=new oo(e,t),{task:a,body:s}=await i.read(n),{change:l}=await r.read(a.change_id),c=l.source.type==="spec"||l.source.type==="prd"?l.source.spec_id:null,d=await r_(e,[a],y=>r.path(y)),u=await o.list(),_=qd(u),p=u.filter(y=>y.kind!=="interaction"&&(y.origin.type==="task"&&y.origin.task_id===a.id||y.dag.nodes.some(f=>f.task_id===a.id))).map(y=>y.id).sort();return{task:{...a,attempt_count:a.attempt_count??null,artifact_path:i.path(a.id),progress:Jd(a.status),spec_id:c,execution_started:_.has(a.id),execution_ids:p,execution_count:p.length,test_count:d.get(a.id)??0},body:s,artifact_path:i.path(a.id)}}async function oh(e,t,n){if(t.version===1)throw new Error("PRD detail requires a modern WorkspaceLayout");let i=new no(e,t),{prd:r,body:o}=await i.read(n);return{id:r.id,title:r.title,body:o,artifact_path:i.path(r.id)}}async function ah(e,t,n){if(t.version===1)throw new Error("SPEC detail requires a modern WorkspaceLayout");let i=new ro(e,t),{spec:r,body:o}=await i.read(n);return{id:r.id,title:r.title,body:o,artifact_path:i.path(r.id)}}var WO=L(()=>{"use strict";Ds();Ug();zg();nh();Ws()});var ZO={};ey(ZO,{aggregateOverviewRunMetrics:()=>Qg,aggregateTopTasks:()=>PO,buildOperationsProjection:()=>Ks,buildQuickOperationsProjection:()=>Hs,coverageFromRuns:()=>gH,createDescendantQueries:()=>pO,deliveredMacroCounts:()=>qO,effectiveOperationsDurationMs:()=>yO,estimatedTokenDurationMs:()=>OO,hybridDailyDuration:()=>co,hybridLegacyDurationMetric:()=>eh,latestObservedSourceTiming:()=>Wd,macroInWindow:()=>fH,manifestDailyPeriods:()=>uH,normalizeDailyPeriods:()=>Gg,normalizeTokenBackedDailyDuration:()=>Yd,observedExecutionElapsedMs:()=>Hr,observedMacroRunTelemetry:()=>Hg,observedSourceTiming:()=>Vd,overviewMetricTotals:()=>FO,projectExecutionDurations:()=>Tr,readPrdDetail:()=>oh,readSpecDetail:()=>ah,readTaskDetail:()=>ih,recalculateOperationsRunSummary:()=>Xd,rootExecutionDurationByDay:()=>Zs,summaryTopTasks:()=>pH,taskCountsInWindow:()=>cH,withExecutionDurations:()=>sH});var Gs=L(()=>{"use strict";As();VO();Xg();th();WO()});var jK={};ey(jK,{SqliteReadModelFileSystem:()=>wt,app:()=>MK,createDashboardApp:()=>Kh,dashboardWorkspaceKey:()=>A_,defaultDashboardApp:()=>Jh,githubRepositoryFromRemote:()=>E_,manifestRun:()=>Mh,mergeManifestRuns:()=>ic,openWorkIds:()=>AK,projectAllTimeTopTasks:()=>TC,projectionPeriodFilter:()=>Nt,rebuildSqliteReadModel:()=>ac,reconciliationResult:()=>zh,validateSqliteReadModelSchema:()=>oc});module.exports=qC(jK);var cc=require("node:crypto"),AC=require("node:fs/promises"),Bh=require("node:path");var ny="x-hono-already-sent";var bc=require("node:http"),Pr=require("node:http2"),M_=require("node:stream");var ry=e=>((...t)=>{if(typeof t[0]=="function"){let[n,i]=t;return async function(o,a){let s=await n(o),l=await e(o,s,i);if(l)return l;await a()}}else{let[n,i,r]=t;return(async()=>{let o=await e(n,i,r);if(!o)throw new Error("Failed to upgrade WebSocket");return o})()}});var kn=class extends Error{constructor(e,t){super(e,t),this.name="RequestError"}},VC=/^\/[!#$&-;=?-\[\]_a-z~]*$/,WC=/\/\.\.?(?:[/?#]|$)/,ZC=/^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/,BC=(e,t,n)=>{let i=`${e}://${t}${n}`;if(ZC.test(t)){if(n.length===0)return i+"/";if(n.charCodeAt(0)!==47)throw new kn("Invalid URL");return!VC.test(n)||WC.test(n)?new URL(i).href:i}else{let r=new URL(i);if(r.hostname.length!==t.length&&r.hostname!==(t.includes(":")?t.replace(/:\d+$/,""):t).toLowerCase())throw new kn("Invalid host header");return r.href}},HC=e=>e instanceof kn?e:new kn(e.message,{cause:e}),JC=global.Request,So=class extends JC{constructor(e,t){if(typeof e=="object"&&ti in e){let n=t!==void 0&&"body"in t&&t.body!=null;if(e[Mr]&&!n)throw new TypeError("Cannot construct a Request with a Request object that has already been used.");e=e[ti]()}typeof t?.body?.getReader<"u"&&(t.duplex??="half"),super(e,t)}},dy=e=>{let t=[],n=e.rawHeaders;for(let i=0,r=n.length;i<r;i+=2){let o=n[i];o.charCodeAt(0)!==58&&t.push([o,n[i+1]])}return new Headers(t)},_y=Symbol("wrapBodyStream"),KC=new Set(["latin1","binary","hex","base64","base64url"]),GC=e=>e===null||KC.has(e),P_=Symbol("bodyBufferedBeforeDisconnect"),L_=Symbol("bodyBufferedLengthBeforeDisconnect"),py=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??"utf8"),q_=e=>!(e instanceof Pr.Http2ServerRequest)&&!!e.complete&&!!e.readableAborted&&typeof e.read=="function"&&GC(e.readableEncoding),iy=e=>{if(e.readableDidRead||!q_(e))return;let t=e;t[L_]??=e.readableLength},gc=(e,t)=>{if(e.readableDidRead&&!t||!q_(e))return;let n=e;if(n[P_]!==void 0)return n[P_];let i,r=e.errored;if(r&&r.code!=="ECONNRESET")i=r;else if(n[L_]!==void 0&&e.readableLength!==n[L_])i=hc();else{let o=t??[],a=e.read();a!==null&&o.push(py(a,e.readableEncoding));let s=o.length===1?o[0]:Buffer.concat(o);i=s;let l=e.headers["content-length"];if(typeof l=="string"&&/^\d+$/.test(l)){let c=Number(l);Number.isSafeInteger(c)&&s.length!==c&&(i=hc())}}return n[P_]=i,i},oy=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},XC=(e,t,n,i,r)=>{let o={method:e,headers:n,signal:r.signal};if(e==="TRACE"){o.method="GET";let a=new So(t,o);return Object.defineProperty(a,"method",{get(){return"TRACE"}}),a}if(!(e==="GET"||e==="HEAD"))if("rawBody"in i&&i.rawBody instanceof Buffer)o.body=new ReadableStream({start(a){a.enqueue(i.rawBody),a.close()}});else if(i[_y]){let a;o.body=new ReadableStream({async pull(s){try{if(!a){let d=gc(i);if(d!==void 0){oy(s,d);return}}a||=M_.Readable.toWeb(i).getReader();let{done:l,value:c}=await a.read();l?s.close():s.enqueue(c)}catch(l){s.error(l)}}})}else{let a=gc(i);a!==void 0?o.body=new ReadableStream({start(s){oy(s,a)}}):o.body=M_.Readable.toWeb(i)}return new So(t,o)},ti=Symbol("getRequestCache"),Ir=Symbol("requestCache"),ko=Symbol("incomingKey"),wa=Symbol("urlKey"),fy=Symbol("methodKey"),my=Symbol("headersKey"),Sa=Symbol("abortControllerKey"),j_=Symbol("getAbortController"),D_=Symbol("abortRequest"),ei=Symbol("bodyBuffer"),mc=Symbol("bodyReadPromise"),Mr=Symbol("bodyConsumedDirectly"),ay=Symbol("bodyLockReader"),ka=Symbol("abortReason"),hc=()=>new TypeError("Body is unusable"),Ea=()=>Promise.reject(hc()),YC=new TextDecoder,QC=e=>{if(e[Mr])return Ea();e[Mr]=!0},e$=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),t$=e=>(e[my]||=dy(e[ko])).get("content-type")||"",n$=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,r$=e=>{if(typeof e!="string"||e.length===0)return"GET";switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return e}let t=e.toUpperCase();switch(t){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return t;default:return e}},i$=e=>{if(!n$.test(e))return new TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t==="CONNECT"||t==="TRACK"||t==="TRACE"&&e!=="TRACE")return new TypeError(`'${e}' HTTP method is unsupported.`)},V_=(e,t,n)=>{if(e[Mr])return Ea();let i=e.method;if(i==="GET"||i==="HEAD")return e[ti]()[t]();let r=i$(i);if(r)return Promise.reject(r);if(e[Ir]&&i!=="TRACE")return e[Ir][t]();let o=QC(e);if(o)return o;let a=o$(e);if(a){let s=Promise.resolve(n(a,e));return e[ei]=void 0,s}return a$(e).then(s=>{let l=n(s,e);return e[ei]=void 0,l})},o$=e=>{let t=e[ko];if("rawBody"in t&&t.rawBody instanceof Buffer)return t.rawBody},sy=(e,t)=>{if(t.errored)return t.errored;let n=e[ka];return n!==void 0?n instanceof Error?n:new Error(String(n)):new Error("Client connection prematurely closed.")},a$=e=>{if(e[ei])return Promise.resolve(e[ei]);if(e[mc])return e[mc];let t=e[ko];if(t.readableDidRead)return Ea();let n=gc(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[ei]=n,Promise.resolve(n));let i=new Promise((r,o)=>{let a=[],s=!1,l=f=>{s||(s=!0,y(),f())},c=f=>{let h=t.errored??f;return!q_(t)||h&&h.code!=="ECONNRESET"?!1:(l(()=>{let k=gc(t,a);k instanceof Error?o(k):k===void 0?o(f??sy(e,t)):(e[ei]=k,r(k))}),!0)},d=f=>{a.push(py(f,t.readableEncoding))},u=()=>{l(()=>{let f=a.length===1?a[0]:Buffer.concat(a);e[ei]=f,r(f)})},_=f=>{c(f)||l(()=>{o(f)})},p=()=>{if(t.readableEnded){u();return}c()||l(()=>{o(sy(e,t))})},y=()=>{t.off("data",d),t.off("end",u),t.off("error",_),t.off("close",p),e[mc]=void 0};t.on("data",d),t.on("end",u),t.on("error",_),t.on("close",p),queueMicrotask(()=>{s||(t.readableEnded?u():t.errored?_(t.errored):t.destroyed&&p())})});return e[mc]=i,i},En={get method(){return this[fy]},get url(){return this[wa]},get headers(){return this[my]||=dy(this[ko])},[D_](e){this[ka]===void 0&&(this[ka]=e);let t=this[Sa];t&&!t.signal.aborted&&t.abort(e)},[j_](){return this[Sa]||=new AbortController,this[ka]!==void 0&&!this[Sa].signal.aborted&&this[Sa].abort(this[ka]),this[Sa]},[ti](){let e=this[j_]();if(this[Ir])return this[Ir];let t=this.method;if(this[Mr]&&!(t==="GET"||t==="HEAD")){this[ei]=void 0;let n={method:t==="TRACE"?"GET":t,headers:this.headers,signal:e.signal};t!=="TRACE"&&(n.body=new ReadableStream({start(r){r.close()}}),n.duplex="half");let i=new So(this[wa],n);return t==="TRACE"&&Object.defineProperty(i,"method",{get(){return"TRACE"}}),this[Ir]=i}return this[Ir]=XC(this.method,this[wa],this.headers,this[ko],e)},get body(){if(!this[Mr])return this[ti]().body;let e=this[ti]();return!this[ay]&&e.body&&(this[ay]=e.body.getReader()),e.body},get bodyUsed(){return this[Mr]?!0:this[Ir]?this[Ir].bodyUsed:!1}};Object.defineProperty(En,"signal",{get(){return this[j_]().signal}});["cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","keepalive"].forEach(e=>{Object.defineProperty(En,e,{get(){return this[ti]()[e]}})});["clone","formData"].forEach(e=>{Object.defineProperty(En,e,{value:function(){if(this[Mr]){if(e==="clone")throw hc();return Ea()}return this[ti]()[e]()}})});Object.defineProperty(En,"text",{value:function(){return V_(this,"text",e=>YC.decode(e))}});Object.defineProperty(En,"arrayBuffer",{value:function(){return V_(this,"arrayBuffer",e=>e$(e))}});Object.defineProperty(En,"blob",{value:function(){return V_(this,"blob",(e,t)=>{let n=t$(t),i=n?{headers:{"content-type":n}}:void 0;return new Response(e,i).blob()})}});Object.defineProperty(En,"json",{value:function(){return this[Mr]?Ea():this.text().then(JSON.parse)}});Object.defineProperty(En,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Ir]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(En,So.prototype);var s$=(e,t)=>{let n=Object.create(En);n[ko]=e,n[fy]=r$(e.method);let i=e.url||"";if(i[0]!=="/"&&(i.startsWith("http://")||i.startsWith("https://"))){if(e instanceof Pr.Http2ServerRequest)throw new kn("Absolute URL for :path is not allowed in HTTP/2");try{n[wa]=new URL(i).href}catch(a){throw new kn("Invalid absolute URL",{cause:a})}return n}let r=(e instanceof Pr.Http2ServerRequest?e.authority:e.headers.host)||t;if(!r)throw new kn("Missing host header");let o;if(e instanceof Pr.Http2ServerRequest){if(o=e.scheme,!(o==="http"||o==="https"))throw new kn("Unsupported scheme")}else o=e.socket&&e.socket.encrypted?"https":"http";try{n[wa]=BC(o,r,i)}catch(a){throw a instanceof kn?a:new kn("Invalid URL",{cause:a})}return n},Qr="text/plain; charset=UTF-8",U_=Symbol("responseCache"),bo=Symbol("getResponseCache"),Nr=Symbol("cache"),W_=global.Response,wn=class gy{#e;#t;[bo](){let t=this[Nr],n=t&&t[2]instanceof Headers?t[2]:void 0;return delete this[Nr],this[U_]||=new W_(this.#e,n?{status:this.#t?.status,statusText:this.#t?.statusText,headers:n}:this.#t)}constructor(t,n){let i;if(this.#e=t,n instanceof gy){let r=n[U_];if(r){this.#t=r,this[bo]();return}else this.#t=n.#t,i=new Headers(n.headers)}else this.#t=n;(t==null||typeof t=="string"||typeof t?.getReader<"u"||t instanceof Blob||t instanceof Uint8Array)&&(this[Nr]=[n?.status||200,t??null,i||n?.headers])}get headers(){let t=this[Nr];return t?(t[2]instanceof Headers||(t[2]=new Headers(t[2]||(t[1]===null?void 0:{"content-type":Qr}))),t[2]):this[bo]().headers}get status(){return this[Nr]?.[0]??this[bo]().status}get ok(){let t=this.status;return t>=200&&t<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(wn.prototype,e,{get(){return this[bo]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(wn.prototype,e,{value:function(){return this[bo]()[e]()}})});Object.defineProperty(wn.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[U_]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(wn,W_);Object.setPrototypeOf(wn.prototype,W_.prototype);var c$=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,l$=e=>e instanceof URL?e.href:c$.test(e)?e:new URL(e).href,u$=new Set([301,302,303,307,308]);Object.defineProperty(wn,"redirect",{value:function(t,n=302){if(!u$.has(n))throw new RangeError("Invalid status code");return new wn(null,{status:n,headers:{location:l$(t)}})},writable:!0,configurable:!0});Object.defineProperty(wn,"json",{value:function(t,n){let i=JSON.stringify(t);if(i===void 0)throw new TypeError("The data is not JSON serializable");let r=n?.headers,o;return r?(o=new Headers(r),o.has("content-type")||o.set("content-type","application/json")):o={"content-type":"application/json"},new wn(i,{status:n?.status??200,statusText:n?.statusText,headers:o})},writable:!0,configurable:!0});async function d$(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function hy(e,t,n){let i=s=>{e.cancel(s).catch(()=>{})};return t.on("close",i),t.on("error",i),(n??e.read()).then(a,r),e.closed.finally(()=>{t.off("close",i),t.off("error",i)});function r(s){s&&t.destroy(s)}function o(){e.read().then(a,r)}function a({done:s,value:l}){try{if(s)t.end();else if(!t.write(l))t.once("drain",o);else return e.read().then(a,r)}catch(c){r(c)}}}function cy(e,t){if(e.locked)throw new TypeError("ReadableStream is locked.");return t.destroyed?void 0:hy(e.getReader(),t)}var z_=(e,t)=>{let n={};if(e instanceof Headers||(e=new Headers(e??void 0)),e.has("set-cookie")){let i=[];for(let[r,o]of e)r==="set-cookie"?i.push(o):n[r]=o;i.length>0&&(n["set-cookie"]=i)}else for(let[i,r]of e)n[i]=r;return t&&(n["content-type"]??=t),n},yc=Symbol("outgoingEnded"),ly=Symbol("incomingDraining"),_$=500,p$=64*1024*1024,yy=e=>{let t=e;if(e.destroyed||t[ly])return;if(t[ly]=!0,e instanceof Pr.Http2ServerRequest){try{e.stream?.close?.(Pr.constants.NGHTTP2_NO_ERROR)}catch{}return}let n=0,i=()=>{clearTimeout(o),e.off("data",a),e.off("end",i),e.off("error",i)},r=()=>{i();let s=e.socket;s&&!s.destroyed&&s.destroySoon()},o=setTimeout(r,_$);o.unref?.();let a=s=>{n+=s.length,n>p$&&r()};e.on("data",a),e.on("end",i),e.on("error",i),e.resume()},f$=(e,t,n,i)=>()=>{t.errored?(iy(t),e[D_](t.errored.toString())):n.writableFinished||(iy(t),e[D_]("Client connection prematurely closed.")),i&&!t.readableEnded&&setTimeout(()=>{t.readableEnded||setTimeout(()=>{yy(t)})})},m$=e=>{if(!(Nr in e))return!1;let t=e[Nr][1];return t===null||typeof t=="string"||t instanceof Uint8Array},g$=()=>new Response(null,{status:400}),vy=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),vc=(e,t)=>{let n=e instanceof Error?e:new Error("unknown error",{cause:e});n.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),t.headersSent||t.writeHead(500,{"Content-Type":"text/plain"}),t.end(`Error: ${n.message}`),t.destroy(n))},F_=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},by=async(e,t)=>{let[n,i,r]=e[Nr];if(!r){i===null?(t.writeHead(n),t.end()):typeof i=="string"?(t.writeHead(n,{"Content-Type":Qr,"Content-Length":Buffer.byteLength(i)}),t.end(i)):i instanceof Uint8Array?(t.writeHead(n,{"Content-Type":Qr,"Content-Length":i.byteLength}),t.end(i)):i instanceof Blob?(t.writeHead(n,{"Content-Type":Qr,"Content-Length":i.size}),t.end(new Uint8Array(await i.arrayBuffer()))):(t.writeHead(n,{"Content-Type":Qr}),F_(t),await cy(i,t)?.catch(a=>vc(a,t))),t[yc]?.();return}let o=!1;if(r instanceof Headers)o=r.has("content-length"),r=z_(r,i===null?void 0:Qr);else if(Array.isArray(r)){let a=new Headers(r);o=a.has("content-length"),r=z_(a,i===null?void 0:Qr)}else for(let a in r)if(a.length===14&&a.toLowerCase()==="content-length"){o=!0;break}o||(typeof i=="string"?r["Content-Length"]=Buffer.byteLength(i):i instanceof Uint8Array?r["Content-Length"]=i.byteLength:i instanceof Blob&&(r["Content-Length"]=i.size)),t.writeHead(n,r),i==null?t.end():typeof i=="string"||i instanceof Uint8Array?t.end(i):i instanceof Blob?t.end(new Uint8Array(await i.arrayBuffer())):(F_(t),await cy(i,t)?.catch(a=>vc(a,t))),t[yc]?.()},Sy=e=>typeof e.then=="function",h$=async(e,t,n={})=>{if(Sy(e))if(n.errorHandler)try{e=await e}catch(r){let o=await n.errorHandler(r);if(!o)return;e=o}else e=await e.catch(vy);if(Nr in e)return by(e,t);let i=z_(e.headers,e.body===null?void 0:Qr);if(e.body){let r=e.body.getReader(),o=[],a=!1,s;if(i["transfer-encoding"]!=="chunked"){let l=2;for(let c=0;c<l;c++){s||=r.read();let d=await d$(s).catch(u=>{console.error(u),a=!0});if(!d){if(c===1){await new Promise(u=>setTimeout(u)),l=3;continue}break}if(s=void 0,d.value&&o.push(d.value),d.done){a=!0;break}}a&&!("content-length"in i)&&(i["content-length"]=o.reduce((c,d)=>c+d.length,0))}t.writeHead(e.status,i),o.forEach(l=>{t.write(l)}),a?t.end():(o.length===0&&F_(t),await hy(r,t,s))}else i[ny]||(t.writeHead(e.status,i),t.end());t[yc]?.()},y$=(e,t={})=>{let n=t.autoCleanupIncoming??!0;return t.overrideGlobalObjects!==!1&&global.Request!==So&&(Object.defineProperty(global,"Request",{value:So}),Object.defineProperty(global,"Response",{value:wn})),async(i,r)=>{let o,a,s=!1,l=!1,c=()=>{!a||l||(l=!0,r.on("close",f$(a,i,r,s)))};try{if(a=s$(i,t.hostname),s=n&&!(i.method==="GET"||i.method==="HEAD"),s&&(i[_y]=!0,i instanceof Pr.Http2ServerRequest&&(r[yc]=()=>{i.readableEnded||setTimeout(()=>{i.readableEnded||setTimeout(()=>{i.destroy(),r.destroy()})})})),o=e(a,{incoming:i,outgoing:r}),!Sy(o)&&m$(o))return s&&!i.readableEnded&&r.once("finish",()=>{i.readableEnded||yy(i)}),by(o,r);c()}catch(d){if(o)return vc(d,r);if(t.errorHandler){if(c(),o=await t.errorHandler(a?d:HC(d)),!o)return}else a?o=vy(d):o=g$()}try{return await h$(o,r,t)}catch(d){return vc(d,r)}}},v$=globalThis.CloseEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get wasClean(){return this.#e.wasClean??!1}get code(){return this.#e.code??0}get reason(){return this.#e.reason??""}},b$=globalThis.ErrorEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get message(){return this.#e.message??""}get filename(){return this.#e.filename??""}get lineno(){return this.#e.lineno??0}get colno(){return this.#e.colno??0}get error(){return this.#e.error??null}},S$=()=>Symbol("connection"),ky=Symbol("CONNECTION_SYMBOL_KEY"),wy=Symbol("WAIT_FOR_WEBSOCKET_SYMBOL"),k$=new Set(["connection","content-length","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade","sec-websocket-accept","sec-websocket-extensions","sec-websocket-protocol"]),Ey=(e,t)=>{t&&t.forEach((n,i)=>{k$.has(i.toLowerCase())||e.push(`${i}: ${n}`)})},uy=(e,t,n)=>{let i=["Connection: close","Content-Length: 0"];Ey(i,n),e.end(`HTTP/1.1 ${t.toString()} ${bc.STATUS_CODES[t]??""}\r
340
+ ${i.join(`\r
341
+ `)}\r
342
+ \r
343
+ `)},w$=e=>{let t=e.socket.encrypted?"https":"http",n=new URL(e.url??"/",`${t}://${e.headers.host??"localhost"}`),i=new Headers;for(let r in e.headers){let o=e.headers[r];o&&i.append(r,Array.isArray(o)?o[0]:o)}return new Request(n,{headers:i})},E$=e=>{let{server:t,fetchCallback:n,wss:i}=e,r=new Map;i.on("connection",(s,l)=>{let c=r.get(l);c&&(c.resolve(s),r.delete(l))});let o=s=>{let l=r.get(s);l&&(r.delete(s),l.reject(new Error("WebSocket handshake aborted")))},a=(s,l)=>new Promise((c,d)=>{r.set(s,{resolve:c,reject:d,connectionSymbol:l})});t.on("upgrade",async(s,l,c)=>{if(s.headers.upgrade?.toLowerCase()!=="websocket")return;let d={incoming:s,outgoing:void 0,wss:i,[wy]:a},u=400,_;try{let h=await n(w$(s),d);h instanceof Response&&(u=h.status,_=h.headers)}catch{t.listenerCount("upgrade")===1&&uy(l,500);return}let p=r.get(s);if(!p||p.connectionSymbol!==d[ky]){o(s),t.listenerCount("upgrade")===1&&uy(l,u,_);return}let y=h=>{Ey(h,_)},f=()=>o(s);l.once("close",f),i.on("headers",y);try{i.handleUpgrade(s,l,c,h=>{l.off("close",f),i.emit("connection",h,s)})}finally{i.off("headers",y)}}),t.on("close",()=>{i.close()})},WK=ry(async(e,t,n)=>{if(e.req.header("upgrade")?.toLowerCase()!=="websocket")return;let i=e.env,r=i[wy];if(!r||!i.incoming)return new Response(null,{status:500});let o=S$();return i[ky]=o,(async()=>{let a;try{a=await r(i.incoming,o)}catch{return}let s=[],l=(u,_)=>{s.push([u,_])};a.on("message",l);let c={binaryType:"arraybuffer",close(u,_){a.close(u,_)},protocol:a.protocol,raw:a,get readyState(){return a.readyState},send(u,_){a.send(u,{compress:_?.compress})},url:new URL(e.req.url)};try{t?.onOpen?.(new Event("open"),c)}catch(u){(n?.onError??console.error)(u)}let d=(u,_)=>{let p=Array.isArray(u)?u:[u];for(let y of p)try{t?.onMessage?.(new MessageEvent("message",{data:_?y instanceof ArrayBuffer?y:y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength):typeof y=="string"?y:Buffer.from(y).toString("utf-8")}),c)}catch(f){(n?.onError??console.error)(f)}};a.off("message",l);for(let u of s)d(...u);a.on("message",(u,_)=>{d(u,_)}),a.on("close",(u,_)=>{try{t?.onClose?.(new v$("close",{code:u,reason:_.toString()}),c)}catch(p){(n?.onError??console.error)(p)}}),a.on("error",u=>{try{t?.onError?.(new b$("error",{error:u}),c)}catch(_){(n?.onError??console.error)(_)}})})(),new Response}),A$=e=>{let t=e.fetch,n=y$(t,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming}),i=(e.createServer||bc.createServer)(e.serverOptions||{},n);if(e.websocket&&e.websocket.server){if(e.websocket.server.options.noServer!==!0)throw new Error("WebSocket server must be created with { noServer: true } option");E$({server:i,fetchCallback:t,wss:e.websocket.server})}return i},Ay=(e,t)=>{let n=A$(e);return n.listen(e?.port??3e3,e.hostname,()=>{let i=n.address();t&&t(i)}),n};var Ty=require("node:stream"),xy=require("node:process"),T$=()=>{let[e,t]=xy.versions.node.split(".").map(n=>parseInt(n));return e>=23||e===22&&t>=7||e===20&&t>=18},x$=T$(),Z_=(e,t=x$)=>{if(t)return Ty.Readable.toWeb(e);let n,i=!1,r=()=>{e.off("data",a),e.off("error",s),e.off("end",l),e.off("close",l)},o=c=>{i||(i=!0,r(),c?.())},a=c=>{i||!n||(n.enqueue(c),(n.desiredSize??0)<=0&&e.pause())},s=c=>{o(()=>{n?.error(c)})},l=()=>{o(()=>{n?.close()})};return new ReadableStream({start(c){n=c,e.on("data",a),e.on("error",s),e.on("end",l),e.on("close",l),e.pause()},pull(){i||e.resume()},cancel(){o();let c=()=>{};e.on("error",c),e.once("close",()=>e.off("error",c)),e.destroy()}})};var Oy=(e,t=R$)=>{let n=/\.([a-zA-Z0-9]+?)$/,i=e.match(n);if(i)return t[i[1].toLowerCase()]};var O$={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css; charset=utf-8",csv:"text/csv; charset=utf-8",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html; charset=utf-8",html:"text/html; charset=utf-8",ico:"image/x-icon",ics:"text/calendar; charset=utf-8",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript; charset=utf-8",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript; charset=utf-8",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml; charset=utf-8",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain; charset=utf-8",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml; charset=utf-8",xml:"application/xml; charset=utf-8",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},R$=O$;var Ii=require("node:fs"),H_=require("node:path"),C$=/^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i,J_={br:".br",zstd:".zst",gzip:".gz"},$$=Object.keys(J_),B_=e=>{let t;try{t=(0,Ii.statSync)(e)}catch{}return t},I$=/^(?:bytes=)?(?!-$)(\d*)-(\d*)$/,N$=e=>{let t=e.match(I$);if(!t)return;let[,n,i]=t;return n===""?{type:"suffix",length:Number(i)}:i===""?{type:"open-ended",start:Number(n)}:{type:"bounded",start:Number(n),end:Number(i)}},P$=(e,t)=>{if(t===0)return;if(e.type==="suffix")return e.length===0?void 0:{start:Math.max(t-e.length,0),end:t-1};let n=e.type==="bounded"?Math.min(e.end,t-1):t-1;if(!(e.start>=t||e.start>n))return{start:e.start,end:n}},M$=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},L$=e=>M$(e,decodeURI),Sc=(e={root:""})=>{let t=e.root||"",n=e.path;return t!==""&&!(0,Ii.existsSync)(t)&&console.error(`serveStatic: root path '${t}' is not found, are you sure it's correct?`),async(i,r)=>{if(i.finalized)return r();let o;if(n)o=n;else try{if(o=L$(i.req.path),/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}|\\/.test(o))throw new Error}catch{return await e.onNotFound?.(i.req.path,i),r()}let a=(0,H_.join)(t,!n&&e.rewriteRequestPath?e.rewriteRequestPath(o,i):o),s=B_(a);if(s&&s.isDirectory()){let _=e.index??"index.html";a=(0,H_.join)(a,_),s=B_(a)}if(!s)return await e.onNotFound?.(a,i),r();let l=Oy(a);if(i.header("Content-Type",l||"application/octet-stream"),e.precompressed&&(!l||l==="application/octet-stream"||C$.test(l))){let _=new Set(i.req.header("Accept-Encoding")?.split(",").map(p=>p.trim()));for(let p of $$){if(!_.has(p))continue;let y=B_(a+J_[p]);if(y){i.header("Content-Encoding",p),i.header("Vary","Accept-Encoding",{append:!0}),s=y,a=a+J_[p];break}}}let c,d=s.size,u=i.req.header("range")||"";if(i.header("Last-Modified",s.mtime.toUTCString()),i.req.method=="HEAD"||i.req.method=="OPTIONS")i.header("Content-Length",d.toString()),i.status(200),c=i.body(null);else if(!u)i.header("Content-Length",d.toString()),c=i.body(Z_((0,Ii.createReadStream)(a)),200);else{i.header("Accept-Ranges","bytes");let _=P$(N$(u)??{type:"open-ended",start:0},d);if(!_)i.header("Content-Range",`bytes */${d}`),c=i.body(null,416);else{let{start:p,end:y}=_,f=y-p+1,h=(0,Ii.createReadStream)(a,{start:p,end:y});i.header("Content-Length",f.toString()),i.header("Content-Range",`bytes ${p}-${y}/${d}`),c=i.body(Z_(h),206)}}return await e.onFound?.(a,i),c}};bt();Zr();Zr();Ho();function FA(e,t){let n=new Map(e.map(i=>[i.key,i]));for(let i of t??[])n.has(i)||n.set(i,F6(i));return[...n.values()].sort((i,r)=>r.latest_started_at.localeCompare(i.latest_started_at)||i.label.localeCompare(r.label))}function F6(e){return{key:e,label:e,latest_started_at:"",run_count:0,task_count:0,prd_count:0,spec_count:0,evidence_count:0,test_count:0,event_count:0,total_tokens:0,estimated_usd:0,estimated_brl:0,duration_ms:0,duration:{known_sum:0,unknown:0,complete:!0,coverage_ratio:1},coverage:{events:0,tokens:0,usd:0,brl:0}}}function Jo(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}function ks(e,t="all_invocations"){let n=new Map;for(let a of e)n.has(a.run_id)||n.set(a.run_id,a);let i=[...n.values()];if(t==="all_invocations")return i;let r=new Set(i.map(a=>a.run_id));return t==="all_execution"?i.filter(a=>a.phase==="execution"):i.filter(a=>a.phase==="execution"&&(a.parent_run_id===null||!r.has(a.parent_run_id)))}function ud(e,t="all_invocations"){let n=ks(e,t),i=n.filter(o=>o.duration_ms!==null),r=n.length-i.length;return{known_sum:i.reduce((o,a)=>o+a.duration_ms,0),unknown:r,complete:r===0,coverage_ratio:n.length===0?1:i.length/n.length}}var ws="token_budget_v1:4_000_000_tokens_per_hour";function Ko(e){return typeof e!="number"||e<=0?null:Math.round(e*36e5/4e6)}function dd(e){let t=e?.trim().toLowerCase();return!t||t==="unknown"||t==="codex"?"openai":t}var q6={events:0,tokens:0,usd:0,brl:0};function VA(e,t){let n=new Map;for(let l of t)l.task_id!==null&&n.set(l.task_id,[...n.get(l.task_id)??[],l]);let i=e.filter(l=>n.has(l.id)).map(l=>WA(l,n.get(l.id)??[])),r=new Set(e.map(l=>l.id)),o=[...n].filter(([l])=>!r.has(l)).map(([l,c])=>qA(l,c)),a=t.filter(l=>l.task_id===null),s=a.length===0?[]:[qA("Sem tarefa vinculada",a)];return[...i,...o,...s].sort((l,c)=>c.latest_started_at.localeCompare(l.latest_started_at))}function qA(e,t){return{...WA({id:e,title:e,created_at:t[0]?.started_at??"",test_count:0},t),label:`Tarefa hist\xF3rica: ${e}`,latest_started_at:t.reduce((n,i)=>i.started_at>n?i.started_at:n,"")}}function WA(e,t){let n=ud(t);return{key:e.id,label:e.title,latest_started_at:e.created_at,run_count:t.length,task_count:1,tasksCreated:1,tasksActive:1,prd_count:0,spec_count:0,evidence_count:0,test_count:e.test_count??0,event_count:t.reduce((i,r)=>i+(r.event_count??0),0),total_tokens:Jo(t.map(i=>i.total_tokens)),estimated_usd:Jo(t.map(i=>i.estimated_usd)),estimated_brl:Jo(t.map(i=>i.estimated_brl)),duration_ms:n.known_sum,duration:n,coverage:t.reduce((i,r)=>({events:i.events+r.coverage.events,tokens:i.tokens+r.coverage.tokens,usd:i.usd+r.coverage.usd,brl:i.brl+r.coverage.brl}),q6),coverage_counts:{source:"run_rows",granularity:"event",events:t.reduce((i,r)=>i+r.coverage.events,0),tokens:null,usd:null,brl:null,metrics:{tokens:Zm(t,i=>i.total_tokens),usd:Zm(t,i=>i.estimated_usd),brl:Zm(t,i=>i.estimated_brl)}}}}function Zm(e,t){let n=e.filter(i=>t(i)!==null).length;return{eligible_runs:e.length,known_runs:n,unknown_runs:e.length-n}}function Go(e,t,n=r=>r,i="all_invocations"){let r=[...new Set(e.map(t))],o=new Set(ks(e,i).map(a=>a.run_id));return r.map(a=>{let s=e.filter(c=>t(c)===a),l=ud(s.filter(c=>o.has(c.run_id)),i);return{key:a,label:n(a),latest_started_at:s.reduce((c,d)=>d.started_at>c?d.started_at:c,s[0]?.started_at??""),run_count:s.length,task_count:new Set(s.flatMap(c=>c.task_id===null?[]:[c.task_id])).size,tasksActive:new Set(s.flatMap(c=>c.task_id===null?[]:[c.task_id])).size,taskDaysActive:new Set(s.flatMap(c=>c.task_id===null?[]:[c.task_id])).size,prd_count:0,spec_count:0,evidence_count:0,test_count:0,event_count:s.reduce((c,d)=>c+(d.event_count??0),0),total_tokens:Bm(s.map(c=>c.total_tokens)),estimated_usd:Bm(s.map(c=>c.estimated_usd)),estimated_brl:Bm(s.map(c=>c.estimated_brl)),duration_ms:l.known_sum,duration:l,coverage:V6(s)}}).sort(W6)}function Bm(e){return Jo(e)}function _d(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)/t.length}function V6(e){return e.reduce((t,n)=>({events:t.events+n.coverage.events,tokens:t.tokens+n.coverage.tokens,usd:t.usd+n.coverage.usd,brl:t.brl+n.coverage.brl}),{events:0,tokens:0,usd:0,brl:0})}function W6(e,t){return t.latest_started_at.localeCompare(e.latest_started_at)}function pd(e,t,n){if(e.schema_version!==2)throw new TypeError("Cost Monitor accepts only OperationsProjection V2");let i=t?.currency??"BRL",r=Er(n?.agentNames??[]),o=e.runs,a=new Map(e.runs.map(g=>[g.id,g])),s=o,l=s,c=new Map(e.tasks.map(g=>[g.id,g])),d=l.map(g=>{let b=g.task_id===null?void 0:c.get(g.task_id),O=a.get(g.id),P=O?.usage.total.cost??{usd:null,brl:null},C=(O?.pricing_segments??[]).map(oe=>oe.recorded_fx_rate??HA(oe.recorded_usd??null,oe.recorded_brl??null)).filter(oe=>oe!==null),v=g.usage.total,A=v.coverage.tokens>0,x=v.coverage.usd>0,T=v.coverage.brl>0,N=t?G6(g,t):null,H=A?GA(O?.usage.total.tokens??v.tokens):null,ie=n4(g,H);return{run_id:g.id,execution_id:g.execution_id,conversation_id:g.conversation_id,task_id:g.task_id,task_title:b?.title??g.task_id??g.conversation_id,task_status:b?.status??g.status,priority:b?.priority??"none",risk:b?.risk??"none",spec_id:g.spec_id,prd_id:g.prd_id,change_id:g.change_id,parent_run_id:g.parent_run_id,run_role:g.run_role,run_kind:g.run_kind,run_purpose:g.run_purpose,requires_finalizer:g.requires_finalizer,client:g.client,agent:g.agent,agent_name:K6(g,n),provider:dd(g.provider),model:g.effective_model??g.model,requested_model:g.model,reasoning_effort:g.reasoning_effort??null,effective_reasoning_effort:g.effective_reasoning_effort,service_tier:g.service_tier??null,call_count:g.call_count,status:g.status,phase:J6(g),origin:g.entrypoint,work_type:g.work_type,started_at:g.started_at,finished_at:g.finished_at,...ie,estimation_basis:ie.duration_provenance==="estimated"?ws:g.estimation_basis??null,source_started_at:g.source_started_at??null,source_finished_at:g.source_finished_at??null,capture_lag_ms:g.capture_lag_ms??null,event_count:v.events,input_tokens:v.tokens.input,cached_input_tokens:v.tokens.cached_input,output_tokens:v.tokens.output,reasoning_tokens:v.tokens.reasoning,total_tokens:H,uncached_input_tokens:v.tokens.input===null?null:Math.max(v.tokens.input-(v.tokens.cached_input??0),0),visible_output_tokens:v.tokens.output===null?null:Math.max(v.tokens.output-(v.tokens.reasoning??0),0),input_rate_usd_per_million:N?.rates.input??null,cached_input_rate_usd_per_million:N?.rates.cached??null,output_rate_usd_per_million:N?.rates.output??null,reasoning_rate_usd_per_million:N?.rates.reasoning??null,context_input_multiplier:N?.context.input??null,context_output_multiplier:N?.context.output??null,speed_cost_multiplier:N?.speedMultiplier??null,standard_cost_usd:N?.standardUsd??null,speed_uplift_usd:N?.upliftUsd??null,input_cost_usd:N?.components.input??null,cached_input_cost_usd:N?.components.cached??null,output_cost_usd:N?.components.output??null,reasoning_cost_usd:N?.components.reasoning??null,fx_rate:i==="BRL"?t?.fxRate?.rate??null:null,estimated_usd:x?P.usd:null,estimated_brl:T?P.brl:null,recorded_usd:x?P.usd:null,recorded_brl:T?P.brl:null,recorded_fx_rate:t4(C)??HA(P.usd,P.brl),coverage:v.coverage,artifact_path:g.artifact_path}}),u=H6(Z6(B6(d),e)),_=(g,b,O)=>Go(u,g,b,O),p=yi(s),y={conversation:yi(s.filter(g=>g.entrypoint==="conversation")),task:yi(s.filter(g=>g.entrypoint==="task")),spec:yi(s.filter(g=>g.entrypoint==="spec")),prd:yi(s.filter(g=>g.entrypoint==="prd"))},f=p.total,h=u.filter(g=>g.total_tokens!==null),k=h.reduce((g,b)=>g+(b.total_tokens??0),0),S=h.reduce((g,b)=>g+(b.event_count??0),0),R=[...h].sort((g,b)=>(b.total_tokens??0)-(g.total_tokens??0)).slice(0,10).reduce((g,b)=>g+(b.total_tokens??0),0);return{schema_version:2,layout_version:2,readonly:!0,legacy_effort_baseline:{cutoff:Gt.cutoff,duration_ms:Gt.durationMs},source:e.source,currency:i,pricing:{catalog_updated_at:t?.catalog.updated_at??null,fx_rate:i==="BRL"?t?.fxRate?.rate??null:null,conversion_applied:t!==void 0&&i==="BRL"&&t.fxRate!==null},filters:e.filters,overview:{task_count:new Set(u.flatMap(g=>g.task_id===null?[]:[g.task_id])).size,run_count:u.length,event_count:u.reduce((g,b)=>g+(b.event_count??0),0),total_tokens:f.tokens.total,estimated_usd:f.cost.usd,estimated_brl:f.cost.brl,recorded_usd:BA(s.map(g=>a.get(g.id)?.usage.total.cost.usd??null)),recorded_brl:BA(s.map(g=>a.get(g.id)?.usage.total.cost.brl??null)),average_run_cost_usd:_d(u.map(g=>g.estimated_usd)),average_run_cost_brl:_d(u.map(g=>g.estimated_brl)),average_run_duration_ms:_d(ks(u).map(g=>g.duration_ms)),known_tokens_per_cycle:S===0?null:k/S,top_10_token_share:k===0?null:R/k,coverage:f.coverage},filters_available:{providers:Er(u.map(g=>dd(g.provider))),agents:Er(u.map(g=>g.agent_name)),models:Er(u.map(g=>g.model)),statuses:Er(u.map(g=>g.task_status)),priorities:Er(u.map(g=>g.priority)),risks:Er(u.map(g=>g.risk)),phases:Er(u.map(g=>g.phase)),origins:Er(u.map(g=>g.origin)),work_types:Er(u.map(g=>g.work_type))},configured_agents:r,usage:p,origins:y,prds:JA(e.prds,s,u),specs:JA(e.specs,s,u),runs:[...u].sort((g,b)=>b.started_at.localeCompare(g.started_at)),groups:{conversations:Go(u,g=>g.conversation_id,void 0,"all_invocations"),tasks:VA(e.tasks,u),providers:_(g=>dd(g.provider)),agents:FA(_(g=>g.agent_name),r),models:_(g=>g.model),daily:Hm(Go(u,g=>{let b=g.finished_at??g.started_at;return Ot(b,"day")??b.slice(0,10)},void 0,"all_invocations"),e.tasks,"day"),monthly:Hm(Go(u,g=>{let b=g.finished_at??g.started_at;return Ot(b,"month")??b.slice(0,7)},void 0,"all_invocations"),e.tasks,"month"),annual:Hm(Go(u,g=>{let b=g.finished_at??g.started_at;return Ot(b,"year")??b.slice(0,4)},void 0,"all_invocations"),e.tasks,"year")}}}function Z6(e,t){let n=t.summary.overview_metrics?.duration_ms;if(typeof n!="number"||n<0)return[...e];let i=t.filters.from===null&&t.filters.to===null?Math.round(n/36e5)*36e5:n,r=e.filter(c=>(c.total_tokens??0)>0);if(r.length===0)return[...e];if(i<r.length)return[...e];let o=r.reduce((c,d)=>c+(d.total_tokens??0),0),a=i>=r.length?1:0,s=Math.max(0,i-a*r.length),l=0;return e.map(c=>{if(!r.includes(c))return{...c,duration_ms:null,duration_provenance:"unavailable",estimation_basis:null};let u=r.at(-1)===c?i-l:a+Math.floor(s*(c.total_tokens??0)/o);return l+=u,{...c,duration_ms:u,duration_provenance:"estimated",estimation_basis:"operations_canonical_budget_v1:proportional_tokens"}})}function B6(e){return e.map(t=>{if((t.total_tokens??0)<=0||(t.duration_ms??0)>0)return t;let n=Ko(t.total_tokens);return n===null||n<=0?t:{...t,duration_ms:n,duration_provenance:"estimated",estimation_basis:ws}})}function H6(e){let t=e.find(n=>(n.total_tokens??0)>0&&(n.duration_ms??0)<=0);if(t!==void 0)throw new TypeError(`Cost Monitor invariant violated: ${t.run_id} has tokens without positive duration`);return[...e]}function Hm(e,t,n){let i=new Map(e.map(r=>[r.key,{...r,tasksActive:r.tasksActive??r.task_count,taskDaysActive:r.tasksActive??r.task_count,tasksCreated:0}]));for(let r of t){let o=Ot(r.created_at,n);if(o===null)continue;let a=i.get(o);a!==void 0&&(a.tasksCreated=(a.tasksCreated??0)+1)}return[...i.values()]}function J6(e){return e.entrypoint==="task"&&e.phase==="conversation"?"planning":e.phase}function K6(e,t){if(e.agent==="codex")return"codex";let n=t?.agentNamesById?.[e.agent];if(n!==void 0)return n;if(e.agent==="agent-orchestrator")return t?.agentNamesByRole?.orchestrator??"zaip-agent-orchestrator";if(e.agent_name.trim()===e.agent){let i=t?.agentNamesByRole?.[e.run_role];if(i!==void 0)return i}return e.agent_name!=="codex",e.agent_name}function G6(e,t){let n=e.pricing_segments??[],i=n.length>0?n.map(f=>({provider:f.provider,model:f.model??e.effective_model??e.model,serviceTier:f.service_tier??e.service_tier??"default",usage:Q6(f)})):[{provider:e.provider,model:e.effective_model??e.model,serviceTier:e.service_tier??"default",usage:e4(e.usage.total)}],r=i.map(f=>Ki({provider:f.provider==="openai"||f.provider==="anthropic"?f.provider:null,model:f.model,serviceTier:f.serviceTier,usage:f.usage,catalog:t.catalog,fxRate:null})),o=i.map(f=>Ki({provider:f.provider==="openai"||f.provider==="anthropic"?f.provider:null,model:f.model,serviceTier:"default",usage:f.usage,catalog:t.catalog,fxRate:null})),a=ZA(r.map(f=>f.estimated_usd)),s=ZA(o.map(f=>f.estimated_usd)),l=a,c=l===null&&s!==null,d=X6(i,t.catalog),u=Y6(t.catalog,i.map(f=>f.model)),_=i.some(f=>f.serviceTier==="priority"||f.serviceTier==="fast"),p=(f,h)=>_&&!c?h:f,y=i.some(f=>u?.long_context_threshold_tokens!==null&&u?.long_context_threshold_tokens!==void 0&&(f.usage.input??0)>u.long_context_threshold_tokens);return{rates:{input:u?p(u.input_per_million_usd,u.priority_input_per_million_usd??null):null,cached:u?p(u.cached_input_per_million_usd,u.priority_cached_input_per_million_usd??null):null,output:u?p(u.output_per_million_usd,u.priority_output_per_million_usd??null):null,reasoning:u?p(u.reasoning_per_million_usd??u.output_per_million_usd,u.priority_reasoning_per_million_usd??u.priority_output_per_million_usd??null):null},context:{input:u?y?u.long_context_input_multiplier:1:null,output:u?y?u.long_context_output_multiplier:1:null},speedMultiplier:l!==null&&s!==null&&s>0?Math.round(l/s*1e3)/1e3:null,standardUsd:s,upliftUsd:l!==null&&s!==null?fd(l-s):null,components:{input:d?.input??null,cached:d?.cached??null,output:d?.output??null,reasoning:d?.reasoning??null}}}function X6(e,t){let n=0,i=0,r=0;for(let o of e){let a=KA(t,o.model);if(a===null||o.provider!==null&&o.provider!==a.provider||o.usage.input===null||o.usage.cached_input===null||o.usage.output===null)return null;let s=a.long_context_threshold_tokens!==null&&o.usage.input>a.long_context_threshold_tokens,l=o.serviceTier==="priority"||o.serviceTier==="fast",c=a.priority_input_per_million_usd,d=a.priority_output_per_million_usd,u=l&&!s&&c!==null&&c!==void 0&&d!==null&&d!==void 0,_=u&&c!==null&&c!==void 0?c:a.input_per_million_usd,p=u?a.priority_cached_input_per_million_usd??0:a.cached_input_per_million_usd??0,y=u&&d!==null&&d!==void 0?d:a.output_per_million_usd,f=s?a.long_context_input_multiplier:1,h=s?a.long_context_output_multiplier:1,k=Math.max(o.usage.input-o.usage.cached_input,0);n+=k/1e6*_*f,i+=o.usage.cached_input/1e6*p*f,r+=o.usage.output/1e6*y*h}return{input:n,cached:i,output:r,reasoning:0}}function KA(e,t){let n=t.toLowerCase();return e.models.find(i=>i.id.toLowerCase()===n||i.aliases.some(r=>r.toLowerCase()===n))??null}function Y6(e,t){let n=t.map(r=>KA(e,r));if(n.some(r=>r===null))return null;let i=n[0];return!i||n.some(r=>r?.id!==i.id)?null:i}function Q6(e){return{input:e.input_tokens,cached_input:e.cached_input_tokens,output:e.output_tokens,reasoning:e.reasoning_tokens,total:e.total_tokens,source:"provider_reported"}}function e4(e){return{input:e.tokens.input,cached_input:e.tokens.cached_input,output:e.tokens.output,reasoning:e.tokens.reasoning,total:e.tokens.total,source:"provider_reported"}}function ZA(e){return e.length===0||e.some(t=>t===null)?null:fd(e.reduce((t,n)=>t+n,0))}function BA(e){let t=e.filter(n=>n!==null);return t.length===0?null:fd(t.reduce((n,i)=>n+i,0))}function fd(e){return Math.round(e*1e6)/1e6}function HA(e,t){return e!==null&&e>0&&t!==null?fd(t/e):null}function t4(e){if(e.length===0)return null;let t=e[0]??null;return e.every(n=>n===t)?t:null}function n4(e,t){if(typeof e.source_duration_ms=="number"&&e.source_duration_ms>=0)return{duration_ms:e.source_duration_ms,duration_provenance:"observed"};if(typeof e.duration_ms=="number"&&e.duration_ms>=0&&(e.duration_provenance==="observed"||e.duration_provenance==="reconciled"||e.duration_provenance==="legacy_inferred"))return{duration_ms:e.duration_ms,duration_provenance:e.duration_provenance};let n=Ko(t);return n!==null?{duration_ms:n,duration_provenance:"estimated"}:{duration_ms:null,duration_provenance:"unavailable"}}function yi(e){return Object.fromEntries(["conversation","planning","execution","total","new_work","rework"].map(n=>[n,r4(e.map(i=>i.usage[n]))]))}function r4(e){let t=n=>{let i=n.filter(r=>r!==null);return i.length===0?null:i.reduce((r,o)=>r+o,0)};return{events:e.reduce((n,i)=>n+i.events,0),duration_ms:t(e.map(n=>n.duration_ms??null)),tokens:{input:t(e.map(n=>n.tokens.input)),cached_input:t(e.map(n=>n.tokens.cached_input)),output:t(e.map(n=>n.tokens.output)),reasoning:t(e.map(n=>n.tokens.reasoning)),total:t(e.map(n=>GA(n.tokens)))},cost:{usd:t(e.map(n=>n.cost.usd)),brl:t(e.map(n=>n.cost.brl))},coverage:{events:e.reduce((n,i)=>n+i.coverage.events,0),tokens:e.reduce((n,i)=>n+i.coverage.tokens,0),usd:e.reduce((n,i)=>n+i.coverage.usd,0),brl:e.reduce((n,i)=>n+i.coverage.brl,0)}}}function GA(e){return e.input!==null&&e.output!==null?e.input+e.output:e.total}function JA(e,t,n){let i=e.map(l=>{let c=new Set(l.run_ids),d=t.filter(u=>c.has(u.id)||l.kind==="prd"&&u.prd_id===l.id||l.kind==="spec"&&u.spec_id===l.id);return{...l,usage:yi(d)}}),r=n.reduce((l,c)=>l+(c.duration_ms??0),0),o=i.filter(l=>(l.usage.total.tokens.total??0)>0),a=o.reduce((l,c)=>l+(c.usage.total.tokens.total??0),0),s=0;return i.map(l=>{if(!o.includes(l))return{...l,duration_ms:null};let d=o.at(-1)===l?r-s:Math.round(r*(l.usage.total.tokens.total??0)/a);return s+=d,{...l,duration_ms:d}})}function Er(e){return[...new Set(e)].sort()}Ho();Gs();function ph(e,t,n,i){let r=(e.run_metrics??[]).map(AH),o=r.filter(T=>{let N=Ot(T.finished_at??T.started_at,"day");return N!==null&&HO(N,t.filters.from,t.filters.to)}).map(EH),a=t.schema_version===2?pd({...t,tasks:t.tasks??[],runs:o},void 0):null,s=T=>T.filter(N=>{let H=N.key.trim().toLowerCase();return H.length>0&&!["mixed","unknown","unavailable"].includes(H)}),l=e.run_metrics!==void 0,c=e.cost_monitor_daily_duration!==void 0||e.canonical_daily_duration_ms!==void 0,d=new Map(Object.entries(OH(e)));for(let T of Object.keys(e.cost_monitor_daily_duration??{}))d.has(T)||d.set(T,_h());if(!l&&!c)for(let T of Object.keys(Br))d.has(T)||d.set(T,_h());let u=[...d].filter(([T])=>HO(T,t.filters.from,t.filters.to)),_=CH(r),p=e.cost_monitor_daily_duration,y=(T,N)=>{if(p!==void 0){let H=p[T];return H===void 0?lh():{value:{known_sum:H.known_sum,unknown:H.eligible_runs-H.known_runs,complete:H.eligible_runs===H.known_runs,coverage_ratio:H.eligible_runs===0?1:H.known_runs/H.eligible_runs},population:Ti(H.eligible_runs,H.known_runs)}}if(e.canonical_daily_duration_ms!==void 0){let H=e.canonical_daily_duration_ms[T];return H===void 0?lh():{value:{known_sum:H,unknown:0,complete:!0,coverage_ratio:1},population:Ti(N.runs,N.runs)}}return l?_.get(T)??lh():wH(T,N)},f=u.reduce((T,[N,H])=>T+y(N,H).value.known_sum,0),h=!l&&!c&&t.filters.from===null&&t.filters.to===null?cd(f):f,k=new Map((e.daily_rows??[]).map(T=>[T.key,T])),S=u.map(([T,N])=>RH(T,N,i,y(T,N),k.get(T))),R=c?S:xH(S.map(TH),h),g=R.reduce((T,N)=>T+N.run_count,0),b=R.reduce((T,N)=>T+N.event_count,0),O=!c&&o.every(T=>T.usage.total.tokens.total===null)?null:uh(R.map(T=>T.total_tokens)),P=!c&&o.every(T=>T.usage.total.cost.brl===null)?null:uh(R.map(T=>T.estimated_brl)),C=uh(R.map(T=>T.estimated_usd)),v=$H(e.run_metrics??[]),A=t.summary.overview_metrics?.task_count??t.summary.task_count,x={events:g,tokens:R.reduce((T,N)=>T+N.coverage.tokens,0),usd:R.reduce((T,N)=>T+N.coverage.usd,0),brl:R.reduce((T,N)=>T+N.coverage.brl,0)};return{schema_version:2,layout_version:t.layout_version,readonly:!0,source:".agents/records",aggregate_only:!0,data_source:l||c?"run_records":"lifecycle_manifest_summary",legacy_effort_baseline:!l&&!c&&t.filters.from===null&&t.filters.to===null?{cutoff:Gt.cutoff,duration_ms:Gt.durationMs}:null,currency:n,pricing:{catalog_updated_at:null,fx_rate:i,conversion_applied:i!==null},filters:t.filters,overview:{task_count:A,run_count:g,event_count:b,total_tokens:O,estimated_usd:C,estimated_brl:P,recorded_usd:null,recorded_brl:null,average_run_cost_usd:g===0||C===null?null:C/g,average_run_cost_brl:g===0||P===null?null:P/g,average_run_duration_ms:v,known_tokens_per_cycle:g===0||O===null?null:O/g,top_10_token_share:null,coverage:x},filters_available:{providers:a?.filters_available.providers??[],agents:a?.filters_available.agents??[],models:a?.filters_available.models??[],statuses:a?.filters_available.statuses??[],priorities:a?.filters_available.priorities??[],risks:a?.filters_available.risks??[],phases:a?.filters_available.phases??[],origins:a?.filters_available.origins??[],work_types:a?.filters_available.work_types??[]},configured_agents:a?.configured_agents??[],usage:e.aggregate_usage??a?.usage??yi(o),origins:IH(),prds:a?.prds??t.prds,specs:a?.specs??t.specs,runs:[],groups:{conversations:[],tasks:[],providers:s(a?.groups.providers??[]),agents:a?.groups.agents??[],models:s(e.model_groups??a?.groups.models??[]),daily:R,monthly:BO(R,7),annual:BO(R,4)}}}function wH(e,t){return co(e,t)}function _h(){let e={known_sum:0,unknown:0,complete:!0,coverage_ratio:1};return{prds:0,specs:0,tasks:0,validations:0,evidences:0,runs:0,usage:{total_tokens:e,cost:{...e,currency:"BRL"}}}}function EH(e){let t={events:0,duration_ms:null,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},n={...t,events:e.events??0,duration_ms:e.source_duration_ms??null,tokens:{...t.tokens,input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:null,brl:e.currency==="BRL"?e.cost:null},coverage:{events:e.events??0,tokens:e.total_tokens===null?0:1,usd:0,brl:e.cost===null?0:1}},i=e.phase==="conversation"||e.phase==="planning"?e.phase:"execution";return{id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status==="failed"||e.status==="cancelled"||e.status==="running"?e.status:"completed",phase:i,entrypoint:e.task_id===null?"conversation":"task",work_type:"new",run_role:e.run_kind==="subrun"?"subagent":"orchestrator",run_kind:e.run_kind??"run",run_purpose:"execution",requires_finalizer:!1,parent_run_id:e.parent_run_id,client:"unknown",agent:e.agent??"unknown",agent_name:e.agent_name??e.agent??"unknown",provider:e.provider??"unavailable",model:e.model??"unknown",reasoning_effort:null,effective_model:e.model??null,effective_reasoning_effort:null,effective_config_mixed:!1,call_count:null,terminal_call_count:null,failed_call_count:0,cancelled_call_count:0,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id??null,task_id:e.task_id,spec_id:e.spec_id??null,prd_id:e.prd_id??null,change_id:e.change_id??null,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.source_duration_ms??null,...e.duration_provenance===void 0?{}:{duration_provenance:e.duration_provenance},...e.estimation_basis===void 0?{}:{estimation_basis:e.estimation_basis},usage:{conversation:i==="conversation"?n:t,planning:i==="planning"?n:t,execution:i==="execution"?n:t,total:n,new_work:n,rework:t}}}function AH(e){if(e.duration_ms!==null)return{...e,duration_provenance:e.duration_provenance??"unavailable",estimation_basis:e.duration_provenance==="estimated"?e.estimation_basis??null:null};let t=Ko(e.total_tokens);return t===null?{...e,duration_provenance:"unavailable",estimation_basis:null}:{...e,duration_ms:t,duration_provenance:"estimated",estimation_basis:ws}}function TH(e){if((e.total_tokens??0)<=0||(e.duration_ms??0)>0)return e;let t=Ko(e.total_tokens);if(t===null||t<=0)return e;let n=e.coverage_counts;return{...e,duration_ms:t,duration:{known_sum:t,unknown:0,complete:!0,coverage_ratio:1},...n===void 0?{}:{coverage_counts:{...n,...n.metrics===void 0?{}:{metrics:{...n.metrics,duration:{eligible_runs:e.run_count,known_runs:e.run_count,unknown_runs:0}}}}}}}function xH(e,t){return Yd(e,t).map(n=>({...n,duration_ms:n.duration.complete?n.duration.known_sum:null}))}function OH(e){let t=[...new Map((e.run_metrics??[]).map(r=>[r.id,r])).values()];if(e.run_metrics===void 0)return e.periods.daily;let n=new Map;for(let r of t){let o=Ot(r.started_at,"day");o!==null&&n.set(o,[...n.get(o)??[],r])}let i=new Set([...Object.keys(e.periods.daily),...n.keys()]);return Object.fromEntries([...i].map(r=>{let o=e.periods.daily[r]??_h(),a=n.get(r)??[],s=sh(a.map(d=>d.total_tokens)),l=sh(a.map(d=>d.cost)),c=sh(a.map(d=>d.events));return[r,{...o,runs:a.length,usage:{total_tokens:s,cost:{...l,currency:a.find(d=>d.currency!==null)?.currency??o.usage.cost.currency}},events:c}]}))}function sh(e){let t=e.filter(i=>i!==null),n=e.length-t.length;return{known_sum:t.reduce((i,r)=>i+r,0),unknown:n,complete:n===0,coverage_ratio:e.length===0?1:t.length/e.length}}function RH(e,t,n,i,r){let o=t.usage.cost.known_sum===0&&t.usage.cost.unknown>0?null:t.usage.cost.known_sum,a=r===void 0?o:r.total_cost_brl,s=r===void 0?a!==null&&n!==null&&n>0?a/n:null:r.total_cost_usd,l=t.events?.known_sum??0,c=JO(t.runs,t.usage.total_tokens.unknown),d=JO(t.runs,t.usage.cost.unknown);return{key:e,label:e,latest_started_at:`${e}T23:59:59.999-03:00`,run_count:t.runs,task_count:t.tasks,tasksCreated:t.tasks,tasksActive:t.tasks,taskDaysActive:t.tasks,prd_count:t.prds,spec_count:t.specs,evidence_count:t.evidences,test_count:t.validations,event_count:l,total_tokens:t.usage.total_tokens.known_sum===0&&t.usage.total_tokens.unknown>0?null:t.usage.total_tokens.known_sum,estimated_usd:s,estimated_brl:a,duration_ms:i.population.known_runs>0?i.value.known_sum:null,duration:i.value,coverage:{events:t.runs,tokens:c,usd:d,brl:d},coverage_counts:{source:"period_summary",granularity:t.events===void 0?"unavailable":"event",events:t.events?.known_sum??null,tokens:null,usd:null,brl:null,metrics:{duration:i.population,tokens:Ti(t.runs,c),usd:Ti(t.runs,d),brl:Ti(t.runs,d)}}}}function BO(e,t){let n=new Map;for(let i of e){let r=i.key.slice(0,t);n.set(r,[...n.get(r)??[],i])}return[...n].map(([i,r])=>{let o=r[0],a=r.reduce((u,_)=>u+_.duration.known_sum,0),s=r.reduce((u,_)=>u+_.duration.unknown,0),l=r.reduce((u,_)=>u+(_.coverage_counts?.metrics?.duration?.eligible_runs??0),0),c=r.reduce((u,_)=>u+(_.coverage_counts?.metrics?.duration?.known_runs??0),0),d=r.reduce((u,_)=>u+_.run_count,0);return{...o,key:i,label:i,latest_started_at:r.map(u=>u.latest_started_at).sort().at(-1)??o.latest_started_at,run_count:d,task_count:r.reduce((u,_)=>u+(_.task_count??0),0),tasksCreated:r.reduce((u,_)=>u+(_.tasksCreated??0),0),tasksActive:r.reduce((u,_)=>u+(_.tasksActive??0),0),taskDaysActive:r.reduce((u,_)=>u+(_.taskDaysActive??0),0),prd_count:r.reduce((u,_)=>u+_.prd_count,0),spec_count:r.reduce((u,_)=>u+_.spec_count,0),evidence_count:r.reduce((u,_)=>u+_.evidence_count,0),test_count:r.reduce((u,_)=>u+_.test_count,0),event_count:r.reduce((u,_)=>u+_.event_count,0),total_tokens:dh(r.map(u=>u.total_tokens)),estimated_usd:dh(r.map(u=>u.estimated_usd)),estimated_brl:dh(r.map(u=>u.estimated_brl)),duration_ms:s===0?a:null,duration:{known_sum:a,unknown:s,complete:s===0,coverage_ratio:l===0?1:c/l},coverage:{events:r.reduce((u,_)=>u+_.coverage.events,0),tokens:r.reduce((u,_)=>u+_.coverage.tokens,0),usd:r.reduce((u,_)=>u+_.coverage.usd,0),brl:r.reduce((u,_)=>u+_.coverage.brl,0)},...o.coverage_counts===void 0?{}:{coverage_counts:{...o.coverage_counts,metrics:{duration:Ti(l,c),tokens:ch(r,"tokens"),usd:ch(r,"usd"),brl:ch(r,"brl")}}}}}).sort((i,r)=>r.key.localeCompare(i.key))}function ch(e,t){let n=e.map(i=>i.coverage_counts?.metrics?.[t]);return Ti(n.reduce((i,r)=>i+(r?.eligible_runs??0),0),n.reduce((i,r)=>i+(r?.known_runs??0),0))}function CH(e){return Zs(e)}function $H(e){let t=e.filter(n=>n.phase==="execution"&&n.parent_run_id==null&&ld(n.duration_started_at??n.started_at)&&n.duration_ms!==null&&n.duration_ms>=0);return t.length===0?null:t.reduce((n,i)=>n+i.duration_ms,0)/t.length}function lh(){return{value:{known_sum:0,unknown:0,complete:!0,coverage_ratio:1},population:Ti(0,0)}}function HO(e,t,n){let i=a=>a===null?null:/^\d{4}-\d{2}-\d{2}$/.test(a)?a:Ot(a,"day"),r=i(t),o=i(n);return(r===null||e>=r)&&(o===null||e<=o)}function uh(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}function dh(e){return e.some(t=>t===null)?null:e.reduce((t,n)=>t+(n??0),0)}function JO(e,t){return Math.max(0,e-t)}function Ti(e,t){return{eligible_runs:e,known_runs:t,unknown_runs:e-t}}function pa(){return{events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}}}function IH(){let e=()=>({conversation:pa(),planning:pa(),execution:pa(),total:pa(),new_work:pa(),rework:pa()});return{conversation:e(),task:e(),spec:e(),prd:e()}}Zr();Gs();var fa=require("node:crypto");bi();var NH=25e4;async function GO(e,t,n){if(t.version===1)throw new Error("Task trace requires a modern WorkspaceLayout");let i=await new Ut(e).readEntities(),r=i.find(g=>g.kind==="task"&&g.id===n);if(r===void 0)throw new Error(`Task ${n} was not found in the lifecycle manifest`);let o=xr(r,"change_id")??Xs(r,"CHG-")??r.id,a=i.find(g=>g.kind==="change"&&g.id===o),s=KO(a,"spec_id")??Xs(r,"SPEC-")??Xs(a,"SPEC-"),l=KO(a,"prd_id")??Xs(r,"PRD-")??Xs(a,"PRD-"),c=new Set([r.id,o]);s!==null&&c.add(s),l!==null&&c.add(l);let d=new Set([...r.relations,...a?.relations??[]].filter(g=>/^(?:REQ|AC)-/.test(g))),u=i.filter(g=>DH(g,c)),_=u.filter(g=>g.kind==="run"&&xr(g,"task_id")===r.id),p=new Set;for(let g of u)g.kind!=="decision"&&g.kind!=="evidence"&&g.kind!=="validation"&&p.add(t.activePath(g.kind,g.id));p.add(t.activePath("task",r.id)),o.startsWith("CHG-")&&p.add(t.activePath("change",o)),s!==null&&p.add(t.activePath("spec",s)),l!==null&&p.add(t.activePath("prd",l));let y=new Set(p),f=await Promise.all(PH(p).map(g=>e.listFiles(g)));for(let g of f.flat())y.add(g);let h=[],k=xr(r,"finished_at");for(let g of y){if(!/\.(?:md|json|jsonl|txt|log)$/i.test(g)||!await e.exists(g))continue;let b=await e.readText(g);if(b.length>NH||!(!g.includes("/requirements/")||[...d].some(H=>b.includes(H))))continue;let C=gh(g),v=o_(b),A=(C.kind==="evidence"||C.kind==="test"||C.kind==="eval"||C.kind==="check")&&b.includes(r.id);if((C.kind==="evidence"||C.kind==="test"||C.kind==="eval"||C.kind==="check")&&!A)continue;let x={id:(0,fa.createHash)("sha256").update(g).digest("hex").slice(0,16),path:g,title:ZH(g,b),...C,content:b,recorded_at:v.recorded_at??(A?k:null),updated_at:v.updated_at??(A?k:null)};h.push(x);let T=zH(x);T!==null&&h.push(T);let N=FH(x,r.id);N!==null&&h.push(N)}for(let g of VH(r,d,h))h.push(g);for(let g of qH(r,h))h.push(g);h.sort((g,b)=>fh[g.stage]-fh[b.stage]||g.path.localeCompare(b.path));let S=new Set(h.map(g=>g.stage)),R=mh(h);return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",task_id:r.id,task_title:r.title??r.id,task_risk:r.risk==="lite"||r.risk==="standard"||r.risk==="critical"?r.risk:null,task_created_at:xr(r,"created_at"),task_progress:UH(r.status),spec_id:s,prd_id:l,change_id:o,usage:MH(_),documents:h,stages:R,coverage:{stages_with_documents:S.size,stages_with_timestamps:R.filter(g=>g.status==="recorded").length,total_stages:6,evidence_count:h.filter(g=>g.kind==="evidence").length,test_count:h.filter(g=>g.kind==="test").length}}}function PH(e){let t=new Set;for(let n of e){if(!n.endsWith("/change.md")&&!n.endsWith("/execution.md"))continue;let i=n.slice(0,n.lastIndexOf("/"));t.add(`${i}/decisions`);for(let r of["evidence","tests","evals","checks"])t.add(`${i}/artifacts/${r}`)}return[...t].sort()}function MH(e,t=Date.now()){let n=e.map(s=>LH(s)?jH(s,t):null),i=e.map(s=>s.usage?.total_tokens??null),r=e.map(s=>s.usage?.cost??null),o=new Set(e.map(s=>s.usage?.currency).filter(s=>s==="BRL"||s==="USD")),a=o.size===1?[...o][0]??null:null;return{run_count:e.length,duration_ms:i_(n),total_tokens:i_(i),cost:o.size<=1?{...i_(r),currency:a}:{...i_(e.map(()=>null)),currency:null}}}function LH(e){return xr(e,"phase")==="execution"&&xr(e,"parent_run_id")===null}function i_(e){let t=e.filter(n=>n!==null);return{value:t.length===0?null:t.reduce((n,i)=>n+i,0),known_runs:t.length,unknown_runs:e.length-t.length,coverage_ratio:e.length===0?1:t.length/e.length}}function jH(e,t){let n=xr(e,"started_at"),i=xr(e,"finished_at");if(n===null)return null;let r=Date.parse(n),o=i===null?null:Date.parse(i),a=o===null&&e.status==="running"?t-r:(o??Number.NaN)-r;return Number.isFinite(a)?Math.max(0,a):null}function mh(e){return Object.keys(fh).map(t=>{let n=e.filter(r=>r.stage===t),i=n.flatMap(r=>[r.recorded_at,r.updated_at]).filter(r=>r!==null).sort(XO);return{stage:t,status:n.length===0?"pending":i.length===0?"missing_timestamp":"recorded",first_recorded_at:i.at(0)??null,last_recorded_at:i.at(-1)??null,document_count:n.length,test_count:n.filter(r=>r.kind==="test").length}})}function DH(e,t){return t.has(e.id)||e.relations.some(n=>t.has(n))}function UH(e){return e==="completed"?100:e==="verifying"?80:e==="executing"?50:e==="blocked"||e==="failed"||e==="cancelled"?0:10}function xr(e,t){let n=e.data?.[t];return typeof n=="string"&&n.length>0?n:null}function Xs(e,t){return e?.relations.find(n=>n.startsWith(t))??null}function KO(e,t){let n=e?.data?.source;if(typeof n!="object"||n===null)return null;let i=n[t];return typeof i=="string"&&i.length>0?i:null}var fh={definition:0,planning:1,execution:2,decisions:3,verification:4,evidence:5};function gh(e){return e.includes("/prds/")?{stage:"definition",kind:"prd"}:e.includes("/requirements/")?{stage:"definition",kind:"requirement"}:e.includes("/specs/")?{stage:"planning",kind:"spec"}:e.includes("/decisions/")?{stage:"decisions",kind:"decision"}:e.includes("/artifacts/evidence/")?{stage:"evidence",kind:"evidence"}:e.includes("/artifacts/tests/")?{stage:"verification",kind:"test"}:e.includes("/artifacts/evals/")?{stage:"verification",kind:"eval"}:e.includes("/artifacts/checks/")?{stage:"verification",kind:"check"}:e.includes("/tasks/")?{stage:"execution",kind:"task"}:e.includes("/executions/")?{stage:"execution",kind:"execution"}:e.includes("/runs/")?{stage:"execution",kind:"run"}:e.includes("/changes/")?{stage:"planning",kind:"change"}:{stage:"evidence",kind:"evidence"}}function o_(e){let t=[...e.matchAll(/\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})\b/g)].map(n=>n[0]).filter(n=>Number.isFinite(Date.parse(n))).sort(XO);return{recorded_at:t.at(0)??null,updated_at:t.at(-1)??null}}function XO(e,t){return Date.parse(e)-Date.parse(t)}function zH(e){if(e.kind!=="change")return null;let t=e.content.match(/^## Decis(?:ões|oes)\s*\r?\n([\s\S]*?)(?=^##\s|\s*$)/m)?.[1]?.trim();return t===void 0||t.length===0||/^Nenhuma decis(?:ão|ao) registrada\.?$/i.test(t)?null:{id:(0,fa.createHash)("sha256").update(`${e.path}#decisions`).digest("hex").slice(0,16),path:`${e.path}#decisions`,title:`Decis\xF5es \u2014 ${e.title}`,stage:"decisions",kind:"decision",content:t,...o_(t)}}function FH(e,t){return e.kind!=="evidence"||!e.content.includes(t)||!/(?:test|vitest|typecheck|biome|build|lint|check|eval)/i.test(e.content)||!/(?:passed|passing|aprovad[oa]|exit\s*code\s*[:=]?\s*0|\bPASS\b)/i.test(e.content)?null:{...e,id:(0,fa.createHash)("sha256").update(`${e.path}#verification`).digest("hex").slice(0,16),path:`${e.path}#verification`,title:`Verifica\xE7\xE3o \u2014 ${e.title}`,stage:"verification",kind:"check"}}function qH(e,t){let n=e.data?.result;if(typeof n!="object"||n===null)return[];let i=n.evidence_ids;if(!Array.isArray(i))return[];let r=xr(e,"finished_at");return i.filter(o=>typeof o=="string"&&o.length>0).filter(o=>!t.some(a=>a.kind==="evidence"&&a.content.includes(o))).map(o=>({id:(0,fa.createHash)("sha256").update(`${e.id}#evidence/${o}`).digest("hex").slice(0,16),path:`${WH(e.id)}#evidence/${o}`,title:o,stage:"evidence",kind:"evidence",content:`Task: ${e.id}
344
+ Evidence reference: ${o}`,recorded_at:r,updated_at:r}))}function VH(e,t,n){let i=xr(e,"finished_at");return[...t].filter(r=>!n.some(o=>o.content.includes(r))).sort().map(r=>({id:(0,fa.createHash)("sha256").update(`${e.id}#requirement/${r}`).digest("hex").slice(0,16),path:`.agents/requirements#${r}`,title:r,stage:"definition",kind:"requirement",content:`Task: ${e.id}
345
+ Requirement reference: ${r}`,recorded_at:i,updated_at:i}))}function WH(e){return`.agents/records/tasks/${e}.md`}function ZH(e,t){return t.match(/^#\s+(.+)$/m)?.[1]?.trim()??e.split("/").at(-1)??e}bi();var hh=(e,t,n)=>(i,r)=>{let o=-1;return a(0);async function a(s){if(s<=o)throw new Error("next() called multiple times");o=s;let l,c=!1,d;if(e[s]?(d=e[s][0][0],i.req.routeIndex=s):d=s===e.length&&r||void 0,d)try{l=await d(i,()=>a(s+1))}catch(u){if(u instanceof Error&&t)i.error=u,l=await t(u,i),c=!0;else throw u}else i.finalized===!1&&n&&(l=await n(i));return l&&(i.finalized===!1||c)&&(i.res=l),i}};var YO=Symbol();var QO=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,i=>i.toLowerCase())}}).formData();var a_=e=>"headers"in e,tR=async(e,t=Object.create(null))=>{let{all:n=!1,dot:i=!1}=t,a=(a_(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();return a==="multipart/form-data"||a==="application/x-www-form-urlencoded"?BH(e,{all:n,dot:i}):{}};async function BH(e,t){if(!a_(e)&&e.bodyCache.formData)return eR(await e.bodyCache.formData,t);let n=a_(e)?e.headers:e.raw.headers,i=await e.arrayBuffer(),r=QO(i,n.get("Content-Type")||"");a_(e)||(e.bodyCache.formData=r);let o=await r;return o?eR(o,t):{}}function eR(e,t){let n=Object.create(null);return e.forEach((i,r)=>{t.all||r.endsWith("[]")?HH(n,r,i):n[r]=i}),t.dot&&Object.entries(n).forEach(([i,r])=>{i.includes(".")&&(JH(n,i,r),delete n[i])}),n}var HH=(e,t,n)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]:t.endsWith("[]")?e[t]=[n]:e[t]=n},JH=(e,t,n)=>{if(/(?:^|\.)__proto__\./.test(t))return;let i=e,r=t.split(".");r.forEach((o,a)=>{a===r.length-1?i[o]=n:((!i[o]||typeof i[o]!="object"||Array.isArray(i[o])||i[o]instanceof File)&&(i[o]=Object.create(null)),i=i[o])})};var vh=e=>{let t=e.split("/");return t[0]===""&&t.shift(),t},nR=e=>{let{groups:t,path:n}=KH(e),i=vh(n);return GH(i,t)},KH=e=>{let t=[];return e=e.replace(/\{[^}]+\}/g,(n,i)=>{let r=`@${i}`;return t.push([r,n]),r}),{groups:t,path:e}},GH=(e,t)=>{for(let n=t.length-1;n>=0;n--){let[i]=t[n];for(let r=e.length-1;r>=0;r--)if(e[r].includes(i)){e[r]=e[r].replace(i,t[n][1]);break}}return e},s_={},rR=(e,t)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let i=`${e}#${t}`;return s_[i]||(n[2]?s_[i]=t&&t[0]!==":"&&t[0]!=="*"?[i,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:s_[i]=[e,n[1],!0]),s_[i]}return null},ma=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},XH=e=>ma(e,decodeURI),bh=e=>{let t=e.url,n=t.indexOf("/",t.indexOf(":")+4),i=n;for(;i<t.length;i++){let r=t.charCodeAt(i);if(r===37){let o=t.indexOf("?",i),a=t.indexOf("#",i),s=o===-1?a===-1?void 0:a:a===-1?o:Math.min(o,a),l=t.slice(n,s);return XH(l.includes("%25")?l.replace(/%25/g,"%2525"):l)}else if(r===63||r===35)break}return t.slice(n,i)};var iR=e=>{let t=bh(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},xi=(e,t,...n)=>(n.length&&(t=xi(t,...n)),`${e?.[0]==="/"?"":"/"}${e}${t==="/"?"":`${e?.at(-1)==="/"?"":"/"}${t?.[0]==="/"?t.slice(1):t}`}`),c_=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let t=e.split("/"),n=[],i="";return t.forEach(r=>{if(r!==""&&!/\:/.test(r))i+="/"+r;else if(/\:/.test(r))if(/\?/.test(r)){n.length===0&&i===""?n.push("/"):n.push(i);let o=r.replace("?","");i+="/"+o,n.push(i)}else i+="/"+r}),n.filter((r,o,a)=>a.indexOf(r)===o)},yh=e=>/[%+]/.test(e)?(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),e.indexOf("%")!==-1?ma(e,Ys):e):e,oR=(e,t,n)=>{let i;if(!n&&t&&!/[%+]/.test(t)){let a=e.indexOf("?",8);if(a===-1)return;for(e.startsWith(t,a+1)||(a=e.indexOf(`&${t}`,a+1));a!==-1;){let s=e.charCodeAt(a+t.length+1);if(s===61){let l=a+t.length+2,c=e.indexOf("&",l);return yh(e.slice(l,c===-1?void 0:c))}else if(s==38||isNaN(s))return"";a=e.indexOf(`&${t}`,a+1)}if(i=/[%+]/.test(e),!i)return}let r=Object.create(null);i??=/[%+]/.test(e);let o=e.indexOf("?",8);for(;o!==-1;){let a=e.indexOf("&",o+1),s=e.indexOf("=",o);s>a&&a!==-1&&(s=-1);let l=e.slice(o+1,s===-1?a===-1?void 0:a:s);if(i&&(l=yh(l)),o=a,l==="")continue;let c;s===-1?c="":(c=e.slice(s+1,a===-1?void 0:a),i&&(c=yh(c))),n?(r[l]&&Array.isArray(r[l])||(r[l]=[]),r[l].push(c)):r[l]??=c}return t?r[t]:r},aR=oR,sR=(e,t)=>oR(e,t,!0),Ys=decodeURIComponent;var cR=e=>ma(e,Ys),lR=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",n=[[]]){this.raw=e,this.path=t,this.#t=n,this.#e={}}param(e){return e?this.#n(e):this.#o()}#n(e){let t=this.#t[0][this.routeIndex][1][e],n=this.#i(t);return n&&/\%/.test(n)?cR(n):n}#o(){let e={},t=Object.keys(this.#t[0][this.routeIndex][1]);for(let n of t){let i=this.#i(this.#t[0][this.routeIndex][1][n]);i!==void 0&&(e[n]=/\%/.test(i)?cR(i):i)}return e}#i(e){return this.#t[1]?this.#t[1][e]:e}query(e){return aR(this.url,e)}queries(e){return sR(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((n,i)=>{t[i]=n}),t}async parseBody(e){return tR(this,e)}#r=e=>{let{bodyCache:t,raw:n}=this,i=t[e];if(i)return i;let r=Object.keys(t)[0];return r?t[r].then(o=>(r==="json"&&(o=JSON.stringify(o)),new Response(o)[e]())):t[e]=n[e]()};json(){return this.#r("text").then(e=>JSON.parse(e))}text(){return this.#r("text")}arrayBuffer(){return this.#r("arrayBuffer")}bytes(){return this.#r("arrayBuffer").then(e=>new Uint8Array(e))}blob(){return this.#r("blob")}formData(){return this.#r("formData")}addValidatedData(e,t){this.#e[e]=t}valid(e){return this.#e[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[YO](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}};var uR={Stringify:1,BeforeStream:2,Stream:3},YH=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n};var Sh=async(e,t,n,i,r)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let o=e.callbacks;if(!o?.length)return Promise.resolve(e);r?r[0]+=e:r=[e];let a=Promise.all(o.map(s=>s({phase:t,buffer:r,context:i}))).then(s=>Promise.all(s.filter(Boolean).map(l=>Sh(l,t,!1,i,r))).then(()=>r[0]));return n?YH(await a,o):a};var QH="text/plain; charset=UTF-8",kh=(e,t)=>({"Content-Type":e,...t}),Qs=(e,t)=>new Response(e,t),wh=class{#e;#t;env={};#n;finalized=!1;error;#o;#i;#r;#u;#c;#l;#s;#d;#_;constructor(e,t){this.#e=e,t&&(this.#i=t.executionCtx,this.env=t.env,this.#l=t.notFoundHandler,this.#_=t.path,this.#d=t.matchResult)}get req(){return this.#t??=new lR(this.#e,this.#_,this.#d),this.#t}get event(){if(this.#i&&"respondWith"in this.#i)return this.#i;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#i)return this.#i;throw Error("This context has no ExecutionContext")}get res(){return this.#r||=Qs(null,{headers:this.#s??=new Headers})}set res(e){if(this.#r&&e){e=Qs(e.body,e);for(let[t,n]of this.#r.headers.entries())if(t!=="content-type")if(t==="set-cookie"){let i=this.#r.headers.getSetCookie();e.headers.delete("set-cookie");for(let r of i)e.headers.append("set-cookie",r)}else e.headers.set(t,n)}this.#r=e,this.finalized=!0}render=(...e)=>(this.#c??=t=>this.html(t),this.#c(...e));setLayout=e=>this.#u=e;getLayout=()=>this.#u;setRenderer=e=>{this.#c=e};header=(e,t,n)=>{this.finalized&&(this.#r=Qs(this.#r.body,this.#r));let i=this.#r?this.#r.headers:this.#s??=new Headers;t===void 0?i.delete(e):n?.append?i.append(e,t):i.set(e,t)};status=e=>{this.#o=e};set=(e,t)=>{this.#n??=new Map,this.#n.set(e,t)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#a(e,t,n){let i=this.#r?new Headers(this.#r.headers):this.#s??new Headers;if(typeof t=="object"&&"headers"in t){let o=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(let[a,s]of o)a.toLowerCase()==="set-cookie"?i.append(a,s):i.set(a,s)}if(n)for(let[o,a]of Object.entries(n))if(typeof a=="string")i.set(o,a);else{i.delete(o);for(let s of a)i.append(o,s)}let r=typeof t=="number"?t:t?.status??this.#o;return Qs(e,{status:r,headers:i})}newResponse=(...e)=>this.#a(...e);body=(e,t,n)=>this.#a(e,t,n);text=(e,t,n)=>!this.#s&&!this.#o&&!t&&!n&&!this.finalized?new Response(e):this.#a(e,t,kh(QH,n));json=(e,t,n)=>this.#a(JSON.stringify(e),t,kh("application/json",n));html=(e,t,n)=>{let i=r=>this.#a(r,t,kh("text/html; charset=UTF-8",n));return typeof e=="object"?Sh(e,uR.Stringify,!1,{}).then(i):i(e)};redirect=(e,t)=>{let n=String(e);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,t??302)};notFound=()=>(this.#l??=()=>Qs(),this.#l(this))};var rt="ALL",dR="all",_R=["get","post","put","delete","options","patch"],l_="Can not add a route since the matcher is already built.",u_=class extends Error{};var pR="__COMPOSED_HANDLER";var eJ=e=>e.text("404 Not Found",404),fR=(e,t)=>{if("getResponse"in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},mR=class gR{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(t={}){[..._R,dR].forEach(o=>{this[o]=(a,...s)=>(typeof a=="string"?this.#e=a:this.#o(o,this.#e,a),s.forEach(l=>{this.#o(o,this.#e,l)}),this)}),this.on=(o,a,...s)=>{for(let l of[a].flat()){this.#e=l;for(let c of[o].flat())s.map(d=>{this.#o(c.toUpperCase(),this.#e,d)})}return this},this.use=(o,...a)=>(typeof o=="string"?this.#e=o:(this.#e="*",a.unshift(o)),a.forEach(s=>{this.#o(rt,this.#e,s)}),this);let{strict:i,...r}=t;Object.assign(this,r),this.getPath=i??!0?t.getPath??bh:iR}#t(){let t=new gR({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#n=this.#n,t.routes=this.routes,t}#n=eJ;errorHandler=fR;route(t,n){let i=this.basePath(t);return n.routes.map(r=>{let o;n.errorHandler===fR?o=r.handler:(o=async(a,s)=>(await hh([],n.errorHandler)(a,()=>r.handler(a,s))).res,o[pR]=r.handler),i.#o(r.method,r.path,o,r.basePath)}),this}basePath(t){let n=this.#t();return n._basePath=xi(this._basePath,t),n}onError=t=>(this.errorHandler=t,this);notFound=t=>(this.#n=t,this);mount(t,n,i){let r,o;i&&(typeof i=="function"?o=i:(o=i.optionHandler,i.replaceRequest===!1?r=l=>l:r=i.replaceRequest));let a=o?l=>{let c=o(l);return Array.isArray(c)?c:[c]}:l=>{let c;try{c=l.executionCtx}catch{}return[l.env,c]};r||=(()=>{let l=xi(this._basePath,t),c=l==="/"?0:l.length;return d=>{let u=new URL(d.url);return u.pathname=this.getPath(d).slice(c)||"/",new Request(u,d)}})();let s=async(l,c)=>{let d=await n(r(l.req.raw),...a(l));if(d)return d;await c()};return this.#o(rt,xi(t,"*"),s),this}#o(t,n,i,r){t=t.toUpperCase(),n=xi(this._basePath,n);let o={basePath:r!==void 0?xi(this._basePath,r):this._basePath,path:n,method:t,handler:i};this.router.add(t,n,[i,o]),this.routes.push(o)}#i(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t}#r(t,n,i,r){if(r==="HEAD")return(async()=>new Response(null,await this.#r(t,n,i,"GET")))();let o=this.getPath(t,{env:i}),a=this.router.match(r,o),s=new wh(t,{path:o,matchResult:a,env:i,executionCtx:n,notFoundHandler:this.#n});if(a[0].length===1){let c;try{c=a[0][0][0][0](s,async()=>{s.res=await this.#n(s)})}catch(d){return this.#i(d,s)}return c instanceof Promise?c.then(d=>d||(s.finalized?s.res:this.#n(s))).catch(d=>this.#i(d,s)):c??this.#n(s)}let l=hh(a[0],this.errorHandler,this.#n);return(async()=>{try{let c=await l(s);if(!c.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return this.#i(c,s)}})()}fetch=(t,...n)=>this.#r(t,n[1],n[0],t.method);request=(t,n,i,r)=>t instanceof Request?this.fetch(n?new Request(t,n):t,i,r):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${xi("/",t)}`,n),i,r));fire=()=>{addEventListener("fetch",t=>{t.respondWith(this.#r(t.request,t,void 0,t.request.method))})}};var d_=[];function Eh(e,t){let n=this.buildAllMatchers(),i=((r,o)=>{let a=n[r]||n[rt],s=a[2][o];if(s)return s;let l=o.match(a[0]);if(!l)return[[],d_];let c=l.indexOf("",1);return[a[1][c],l]});return this.match=i,i(e,t)}var __="[^/]+",ec=".*",tc="(?:|/.*)",uo=Symbol(),tJ=new Set(".\\+*[^]$()");function nJ(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1||e===ec||e===tc?1:t===ec||t===tc?-1:e===__?1:t===__?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var hR=class Ah{#e;#t;#n=Object.create(null);insert(t,n,i,r,o){if(t.length===0){if(this.#e!==void 0)throw uo;if(o)return;this.#e=n;return}let[a,...s]=t,l=a==="*"?s.length===0?["","",ec]:["","",__]:a==="/*"?["","",tc]:a.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),c;if(l){let d=l[1],u=l[2]||__;if(d&&l[2]&&(u===".*"||(u=u.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(u))))throw uo;if(c=this.#n[u],!c){if(Object.keys(this.#n).some(_=>_!==ec&&_!==tc))throw uo;if(o)return;c=this.#n[u]=new Ah,d!==""&&(c.#t=r.varIndex++)}!o&&d!==""&&i.push([d,c.#t])}else if(c=this.#n[a],!c){if(Object.keys(this.#n).some(d=>d.length>1&&d!==ec&&d!==tc))throw uo;if(o)return;c=this.#n[a]=new Ah}c.insert(s,n,i,r,o)}buildRegExpStr(){let n=Object.keys(this.#n).sort(nJ).map(i=>{let r=this.#n[i];return(typeof r.#t=="number"?`(${i})@${r.#t}`:tJ.has(i)?`\\${i}`:i)+r.buildRegExpStr()});return typeof this.#e=="number"&&n.unshift(`#${this.#e}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}};var yR=class{#e={varIndex:0};#t=new hR;insert(e,t,n){let i=[],r=[];for(let a=0;;){let s=!1;if(e=e.replace(/\{[^}]+\}/g,l=>{let c=`@\\${a}`;return r[a]=[c,l],a++,s=!0,c}),!s)break}let o=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=r.length-1;a>=0;a--){let[s]=r[a];for(let l=o.length-1;l>=0;l--)if(o[l].indexOf(s)!==-1){o[l]=o[l].replace(s,r[a][1]);break}}return this.#t.insert(o,t,i,this.#e,n),i}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0,n=[],i=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(r,o,a)=>o!==void 0?(n[++t]=Number(o),"$()"):(a!==void 0&&(i[Number(a)]=++t),"")),[new RegExp(`^${e}`),n,i]}};var rJ=[/^$/,[],Object.create(null)],vR=Object.create(null);function bR(e){return vR[e]??=new RegExp(e==="*"?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(t,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function iJ(){vR=Object.create(null)}function oJ(e){let t=new yR,n=[];if(e.length===0)return rJ;let i=e.map(c=>[!/\*|\/:/.test(c[0]),...c]).sort(([c,d],[u,_])=>c?1:u?-1:d.length-_.length),r=Object.create(null);for(let c=0,d=-1,u=i.length;c<u;c++){let[_,p,y]=i[c];_?r[p]=[y.map(([h])=>[h,Object.create(null)]),d_]:d++;let f;try{f=t.insert(p,d,_)}catch(h){throw h===uo?new u_(p):h}_||(n[d]=y.map(([h,k])=>{let S=Object.create(null);for(k-=1;k>=0;k--){let[R,g]=f[k];S[R]=g}return[h,S]}))}let[o,a,s]=t.buildRegExp();for(let c=0,d=n.length;c<d;c++)for(let u=0,_=n[c].length;u<_;u++){let p=n[c][u]?.[1];if(!p)continue;let y=Object.keys(p);for(let f=0,h=y.length;f<h;f++)p[y[f]]=s[p[y[f]]]}let l=[];for(let c in a)l[c]=n[a[c]];return[o,l,r]}function ga(e,t){if(e){for(let n of Object.keys(e).sort((i,r)=>r.length-i.length))if(bR(n).test(t))return[...e[n]]}}var p_=class{name="RegExpRouter";#e;#t;constructor(){this.#e={[rt]:Object.create(null)},this.#t={[rt]:Object.create(null)}}add(e,t,n){let i=this.#e,r=this.#t;if(!i||!r)throw new Error(l_);i[e]||[i,r].forEach(s=>{s[e]=Object.create(null),Object.keys(s[rt]).forEach(l=>{s[e][l]=[...s[rt][l]]})}),t==="/*"&&(t="*");let o=(t.match(/\/:/g)||[]).length;if(/\*$/.test(t)){let s=bR(t);e===rt?Object.keys(i).forEach(l=>{i[l][t]||=ga(i[l],t)||ga(i[rt],t)||[]}):i[e][t]||=ga(i[e],t)||ga(i[rt],t)||[],Object.keys(i).forEach(l=>{(e===rt||e===l)&&Object.keys(i[l]).forEach(c=>{s.test(c)&&i[l][c].push([n,o])})}),Object.keys(r).forEach(l=>{(e===rt||e===l)&&Object.keys(r[l]).forEach(c=>s.test(c)&&r[l][c].push([n,o]))});return}let a=c_(t)||[t];for(let s=0,l=a.length;s<l;s++){let c=a[s];Object.keys(r).forEach(d=>{(e===rt||e===d)&&(r[d][c]||=[...ga(i[d],c)||ga(i[rt],c)||[]],r[d][c].push([n,o-l+s+1]))})}}match=Eh;buildAllMatchers(){let e=Object.create(null);return Object.keys(this.#t).concat(Object.keys(this.#e)).forEach(t=>{e[t]||=this.#n(t)}),this.#e=this.#t=void 0,iJ(),e}#n(e){let t=[],n=e===rt;return[this.#e,this.#t].forEach(i=>{let r=i[e]?Object.keys(i[e]).map(o=>[o,i[e][o]]):[];r.length!==0?(n||=!0,t.push(...r)):e!==rt&&t.push(...Object.keys(i[rt]).map(o=>[o,i[rt][o]]))}),n?oJ(t):null}};var Th=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,n){if(!this.#t)throw new Error(l_);this.#t.push([e,t,n])}match(e,t){if(!this.#t)throw new Error("Fatal error");let n=this.#e,i=this.#t,r=n.length,o=0,a;for(;o<r;o++){let s=n[o];try{for(let l=0,c=i.length;l<c;l++)s.add(...i[l]);a=s.match(e,t)}catch(l){if(l instanceof u_)continue;throw l}this.match=s.match.bind(s),this.#e=[s],this.#t=void 0;break}if(o===r)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#t||this.#e.length!==1)throw new Error("No active router has been determined yet.");return this.#e[0]}};var nc=Object.create(null),aJ=e=>{for(let t in e)return!0;return!1},SR=class kR{#e;#t;#n;#o=0;#i=nc;constructor(t,n,i){if(this.#t=i||Object.create(null),this.#e=[],t&&n){let r=Object.create(null);r[t]={handler:n,possibleKeys:[],score:0},this.#e=[r]}this.#n=[]}insert(t,n,i){this.#o=++this.#o;let r=this,o=nR(n),a=[];for(let s=0,l=o.length;s<l;s++){let c=o[s],d=o[s+1],u=rR(c,d),_=Array.isArray(u)?u[0]:c;if(_ in r.#t){r=r.#t[_],u&&a.push(u[1]);continue}r.#t[_]=new kR,u&&(r.#n.push(u),a.push(u[1])),r=r.#t[_]}return r.#e.push({[t]:{handler:i,possibleKeys:a.filter((s,l,c)=>c.indexOf(s)===l),score:this.#o}}),r}#r(t,n,i,r,o){for(let a=0,s=n.#e.length;a<s;a++){let l=n.#e[a],c=l[i]||l[rt],d={};if(c!==void 0&&(c.params=Object.create(null),t.push(c),r!==nc||o&&o!==nc))for(let u=0,_=c.possibleKeys.length;u<_;u++){let p=c.possibleKeys[u],y=d[c.score];c.params[p]=o?.[p]&&!y?o[p]:r[p]??o?.[p],d[c.score]=!0}}}search(t,n){let i=[];this.#i=nc;let o=[this],a=vh(n),s=[],l=a.length,c=null;for(let d=0;d<l;d++){let u=a[d],_=d===l-1,p=[];for(let f=0,h=o.length;f<h;f++){let k=o[f],S=k.#t[u];S&&(S.#i=k.#i,_?(S.#t["*"]&&this.#r(i,S.#t["*"],t,k.#i),this.#r(i,S,t,k.#i)):p.push(S));for(let R=0,g=k.#n.length;R<g;R++){let b=k.#n[R],O=k.#i===nc?{}:{...k.#i};if(b==="*"){let x=k.#t["*"];x&&(this.#r(i,x,t,k.#i),x.#i=O,p.push(x));continue}let[P,C,v]=b;if(!u&&!(v instanceof RegExp))continue;let A=k.#t[P];if(v instanceof RegExp){if(c===null){c=new Array(l);let N=n[0]==="/"?1:0;for(let H=0;H<l;H++)c[H]=N,N+=a[H].length+1}let x=n.substring(c[d]),T=v.exec(x);if(T){if(O[C]=T[0],this.#r(i,A,t,k.#i,O),T[0].length===x.length&&A.#t["*"]&&this.#r(i,A.#t["*"],t,k.#i,O),aJ(A.#t)){A.#i=O;let N=T[0].match(/\//)?.length??0;(s[N]||=[]).push(A)}continue}}(v===!0||v.test(u))&&(O[C]=u,_?(this.#r(i,A,t,O,k.#i),A.#t["*"]&&this.#r(i,A.#t["*"],t,O,k.#i)):(A.#i=O,p.push(A)))}}let y=s.shift();o=y?p.concat(y):p}return i.length>1&&i.sort((d,u)=>d.score-u.score),[i.map(({handler:d,params:u})=>[d,u])]}};var xh=class{name="TrieRouter";#e;constructor(){this.#e=new SR}add(e,t,n){let i=c_(t);if(i){for(let r=0,o=i.length;r<o;r++)this.#e.insert(e,i[r],n);return}this.#e.insert(e,t,n)}match(e,t){return this.#e.search(e,t)}};var Oh=class extends mR{constructor(e={}){super(e),this.router=e.router??new Th({routers:[new p_,new xh]})}};var sJ=/^[\w!#$%&'*.^`|~+-]+$/,cJ=/^[!#-:<>-[\]-~]+$/,lJ=/^[ !#-:<-[\]-~]*$/,wR=e=>{let t=0,n=e.length;for(;t<n;){let i=e.charCodeAt(t);if(i!==32&&i!==9)break;t++}for(;n>t;){let i=e.charCodeAt(n-1);if(i!==32&&i!==9)break;n--}return t===0&&n===e.length?e:e.slice(t,n)},Rh=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};let n=e.split(";"),i=Object.create(null);for(let r of n){let o=r.indexOf("=");if(o===-1)continue;let a=wR(r.substring(0,o));if(t&&t!==a||!cJ.test(a)||a in i)continue;let s=wR(r.substring(o+1));if(s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1)),lJ.test(s)&&(i[a]=s.indexOf("%")!==-1?ma(s,Ys):s,t))break}return i};var uJ=(e,t,n={})=>{if(!sJ.test(e))throw new Error("Invalid cookie name");let i=`${e}=${t}`;if(e.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}for(let r of["domain","path","sameSite","priority"])if(n[r]&&/[;\r\n]/.test(n[r]))throw new Error(`${r} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge=="number"&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");i+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host"&&(i+=`; Domain=${n.domain}`),n.path&&(i+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");i+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(i+="; HttpOnly"),n.secure&&(i+="; Secure"),n.sameSite&&(i+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(i+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");i+="; Partitioned"}return i},f_=(e,t,n)=>(t=encodeURIComponent(t),uJ(e,t,n));var ER=(e,t,n)=>{let i=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!i)return;let o=t;return n==="secure"?o="__Secure-"+t:n==="host"&&(o="__Host-"+t),Rh(i,o)[o]}return i?Rh(i):{}};var dJ=(e,t,n)=>{let i;return n?.prefix==="secure"?i=f_("__Secure-"+e,t,{path:"/",...n,secure:!0}):n?.prefix==="host"?i=f_("__Host-"+e,t,{...n,path:"/",secure:!0,domain:void 0}):i=f_(e,t,{path:"/",...n}),i},AR=(e,t,n,i)=>{let r=dJ(t,n,i);e.header("Set-Cookie",r,{append:!0})};var xR=require("node:child_process"),OR=require("node:path"),RR=require("node:util"),TR=(0,RR.promisify)(xR.execFile);async function CR(e){let t=(0,OR.resolve)(e,".agents","runtime","bin","zaip.mjs"),n={cwd:e,encoding:"utf8",windowsHide:!0,timeout:12e4,maxBuffer:10*1024*1024};await TR(process.execPath,[t,"adapters","build","--json"],n);let{stdout:i}=await TR(process.execPath,[t,"adapters","check","--json"],n),r=JSON.parse(i);return{valid:r.valid===!0,drifted:Array.isArray(r.drifted)?r.drifted.filter(o=>typeof o=="string"):[]}}var $h=require("node:util");bt();var m_=".agents/config/agents/catalog.yaml",Ih=["agent-orchestrator","agent-builder","agent-task-executor","agent-analyst","agent-finalizer","agent-reviewer","agent-integrator","agent-auditor","agent-text-summarizer","agent-data-analyst","agent-refactoring-specialist","agent-frontend","agent-backend","agent-website-developer","agent-designer","agent-cloud-engineer","agent-security-auditor","agent-marketing-analyst","agent-brand-strategist","agent-growth-strategist","agent-sales-specialist","agent-general-operations","agent-governance-compliance"],_J=new Set(Ih),Ft=class extends Error{constructor(n,i){super(n);this.status=i}status;name="AgentCatalogUpdateError"};async function NR(e){let t=await MR(e);return{catalog:await gJ(e),framework_agent_ids:Ih,...t,sync:{required:!0,valid:null,drifted:[]}}}async function PR(e,t,n){let i=await e.readText(m_),r=ii(yt(i)),o=await MR(e),a=pJ(r,t,o);await e.writeTextAtomic(m_,Fr(a));try{let s=await n();if(!s.valid||s.drifted.length>0)throw new Error(`Adapter parity failed; drifted: ${s.drifted.join(", ")||"unknown"}`);return{catalog:a,framework_agent_ids:Ih,...o,sync:{required:!0,valid:!0,drifted:[]}}}catch(s){await e.writeTextAtomic(m_,i);try{await n()}catch{}throw new Ft(`Agent catalog was not saved because adapter synchronization failed: ${s instanceof Error?s.message:String(s)}`,500)}}function pJ(e,t,n){if(!Ch(t)||!Array.isArray(t.agents))throw new Ft("Request body must contain an agents array",400);if(Object.keys(t).some(o=>o!=="agents"))throw new Ft("Only the agents collection may be updated",400);let i;try{let o=t.agents.map(a=>fJ(a));i=ii({schema_version:e.schema_version,agents:o,squads:e.squads})}catch(o){throw new Ft(o instanceof Error?o.message:String(o),400)}hJ(e,i),vJ(e,i),yJ(e,i),n!==void 0&&mJ(i,n);let r=$p(i);if(r.length>0)throw new Ft(r.map(o=>`${o.rule}: ${o.message}`).join("; "),409);return i}function fJ(e){if(!Ch(e)||!Ch(e.persona))return e;let t=e.persona.nome,n=e.persona.cargo;if(typeof t!="string"||typeof n!="string")return e;let i=`${t}_${n}_zaip_agent`;return{...e,codex_task_name:i,nickname_candidates:[i]}}async function MR(e){let n=qr(yt(await e.readText(".agents/config/project.yaml"))).model_orchestration;return n?.mode==="auto"?{default_model:n.default_model,default_reasoning_effort:n.default_effort,allowed_models:n.allowed_models,allowed_reasoning_efforts:n.allowed_efforts}:{default_model:n?.default_model??null,default_reasoning_effort:n?.default_effort??null,allowed_models:[],allowed_reasoning_efforts:[]}}function mJ(e,t){for(let n of e.agents){let i=n.model.preferred.find(r=>r!=="policy-selected"&&!t.allowed_models.includes(r));if(t.allowed_models.length>0&&i!==void 0)throw new Ft(`Agent ${n.id} uses a model outside project.allowed_models: ${i}`,400);if(n.model.reasoning_effort!==void 0&&t.allowed_reasoning_efforts.length>0&&!t.allowed_reasoning_efforts.includes(n.model.reasoning_effort))throw new Ft(`Agent ${n.id} uses reasoning effort outside project.allowed_efforts: ${n.model.reasoning_effort}`,400)}}async function gJ(e){return ii(yt(await e.readText(m_)))}function hJ(e,t){for(let n of _J){let i=e.agents.find(o=>o.id===n),r=t.agents.find(o=>o.id===n);if(i===void 0||r===void 0)throw new Ft(`Framework agent cannot be removed: ${n}`,409);if(!(0,$h.isDeepStrictEqual)($R(i),$R(r)))throw new Ft(`Framework agent ${n} only allows persona name and role changes`,409)}}function $R(e){let{persona:t,codex_task_name:n,nickname_candidates:i,...r}=e;return{...r,persona:{nome:"protected",cargo:"protected"},codex_task_name:"protected_protected_zaip_agent",nickname_candidates:["protected_protected_zaip_agent"],model:{...e.model,preferred:[],reasoning_effort:void 0}}}function yJ(e,t){for(let n of e.agents){let i=t.agents.find(r=>r.id===n.id);if(i!==void 0&&!(0,$h.isDeepStrictEqual)(IR(n),IR(i)))throw new Ft(`Existing agent ${n.id} only allows persona name and role changes`,409)}}function IR(e){let{persona:t,codex_task_name:n,nickname_candidates:i,...r}=e;return{...r,persona:{...t,nome:"protected",cargo:"protected"}}}function vJ(e,t){for(let n of e.agents){let i=t.agents.find(r=>r.id===n.id);if(i!==void 0&&n.codex_name!==i.codex_name)throw new Ft(`Technical identity is stable and cannot be changed: ${n.id}`,409)}}function Ch(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}bt();var bJ=".agents/config/agents/catalog.yaml",SJ=".codex/config.toml",kJ=".agents/config/framework.lock.yaml",wJ=".local/dashboard-sqlite/read-model.sqlite",LR="docs/SOFTWARE-ARCHITECTURE.md",EJ=[{id:"software_architecture",label:"Arquitetura de Software",artifact:LR},{id:"design_system",label:"Design system",artifact:".agents/design/DESIGN.md"},{id:"brandbook",label:"Brandbook",artifact:".agents/brand/brandbook.md"},{id:"marketing_strategy",label:"Estrat\xE9gia de Marketing",artifact:".agents/marketing/strategy.md"},{id:"sales_playbook",label:"Playbook de Sales",artifact:".agents/sales/playbook.md"},{id:"growth_strategy",label:"Estrat\xE9gia de Growth",artifact:".agents/growth/strategy.md"}];async function jR(e){return qr(yt(await e.readText(gn)))}async function DR(e){let[t,n,i,r,o,a]=await Promise.all([e.readText(bJ).then(yt).then(ii),AJ(e),e.exists(wJ),TJ(e),xJ(e,".agents/rules"),OJ(e)]);return{framework_version:n,metrics:[{id:"agents",label:"Agentes",value:t.agents.length},{id:"squads",label:"Squads",value:t.squads.length},{id:"skills",label:"Skills",value:r},{id:"rules",label:"Rules",value:o},{id:"hooks",label:"Hooks",value:a},{id:"database",label:"Database",value:i?"Ativo":"Inativo"}],stack_components:await RJ(e),areas:await Promise.all(EJ.map(async s=>({...s,available:await e.exists(s.artifact)})))}}async function AJ(e){try{let t=Ri(yt(await e.readText(kJ))),n=Ri(t.framework).version;return typeof n=="string"&&n.trim()?n.trim():null}catch{return null}}async function TJ(e){let t=await e.listDirectories(".agents/skills");return(await Promise.all(t.map(i=>e.exists(`${i}/SKILL.md`)))).filter(Boolean).length}async function xJ(e,t){let n=`${t}/`;return(await e.listFiles(t,".md")).filter(r=>!r.slice(n.length).includes("/")).length}async function OJ(e){try{let t=await e.readText(SJ);return new Set([...t.matchAll(/^\s*\[\[hooks\.([A-Za-z0-9_-]+)\]\]\s*$/gm)].map(i=>i[1])).size}catch{return 0}}async function RJ(e){let[t,n,i]=await Promise.all([Nh(e,"package.json"),Nh(e,".agents/dashboard/packages/local-runtime/package.json"),Nh(e,".agents/dashboard/apps/frontend/package.json")]);return[Oi("Node.js",process.versions.node,`Runtime observado: ${process.execPath}`,"exact"),Oi("TypeScript",_o(t,"typescript"),"package.json","exact"),Oi("Vite",_o(t,"vite"),"package.json","exact"),Oi("Astro",_o(t,"astro"),"package.json","exact"),Oi("Redis",_o(t,"redis"),"package.json","exact"),Oi("BullMQ",_o(t,"bullmq"),"package.json","exact"),Oi("Hono",_o(n,"hono"),".agents/dashboard/packages/local-runtime/package.json","exact"),Oi("React",_o(i,"react"),".agents/dashboard/apps/frontend/package.json","exact")]}async function Nh(e,t){try{let n=JSON.parse(await e.readText(t));return typeof n=="object"&&n!==null?n:{}}catch{return{}}}function _o(e,t){return e.dependencies?.[t]??e.devDependencies?.[t]??null}function Oi(e,t,n,i){return t===null?{name:e,version:null,source:null,verification:"unavailable"}:{name:e,version:t,source:n,verification:i}}async function UR(e,t){let n=await e.readText(gn),i=qr(yt(n)),r=qr(t);if(r.tracking.storage_mode!=="tracked_sanitized")throw new TypeError("This project requires Git-native tracked_sanitized storage.");let o=qr({...r,clients:i.clients,tracking:i.tracking,model_orchestration:i.model_orchestration,stack:{...r.stack,overrides:{...i.stack.overrides,...r.stack.overrides}}});await e.writeTextAtomic(gn,Fr(o));try{await e.writeTextAtomic(LR,IJ(o))}catch(a){throw await e.writeTextAtomic(gn,n),new Error("Project settings were rolled back because the software architecture summary could not be updated.",{cause:a})}return o}var CJ={primary_language:"Linguagem principal",backend_runtime:"Runtime backend",backend_api:"Framework backend / API",query_builder:"Query builder",database:"Banco de dados",auth_storage:"Autentica\xE7\xE3o e Storage",cache_messaging:"Cache e mensageria",async_queue:"Filas e processamento ass\xEDncrono",backend_infrastructure:"Infraestrutura backend",web_framework:"Framework do Web App",web_language:"Linguagem do Web App",web_build:"Build do Web App",frontend_hosting:"Hospedagem do frontend",site_framework:"Framework do site",site_language:"Linguagem do site",site_islands:"Componentes interativos",site_build:"Build do site",site_hosting:"Hospedagem do site"},$J={backend_data_and_managed_services:"Dados e servi\xE7os gerenciados",backend_api_and_business_rules:"APIs e regras de neg\xF3cio",backend_async_processing:"Filas e processamento ass\xEDncrono",backend_infrastructure:"Infraestrutura backend"};function IJ(e){let t=Ri(e.stack.overrides),n=Ri(t.components),i=Ri(t.languages),r=Ri(t.architecture),o=Object.entries(CJ).map(([u,_])=>{let p=Ri(n[u]);return`| ${_} | ${kt(p.name,"N\xE3o definido")} | ${kt(p.version,"N\xE3o fixada")} | ${kt(p.reference,"\u2014")} |`}),a=Object.entries(e.stack.layout??{}).map(([u,_])=>`| ${kt(u)} | ${kt(_)} |`),s=Object.entries(e.stack.commands??{}).map(([u,_])=>`| ${kt(u)} | \`${NJ(_)}\` |`),l=Object.entries(r).flatMap(([u,_])=>[`### ${$J[u]??PJ(u)}`,"",...rc(g_(_)),""]),c=e.execution?.runtime==="autonomous"?["- **Runtime:** autonomous",`- **Provider:** ${kt(e.execution.autonomous.provider)}`,`- **Modelo-base:** ${kt(e.execution.autonomous.model)}`,`- **Paralelismo m\xE1ximo:** ${e.execution.autonomous.max_parallelism}`,`- **Lease configurado:** ${e.execution.autonomous.lease_ms} ms`,`- **Limite total de invoca\xE7\xF5es:** ${e.execution.autonomous.max_total_invocations??"N\xE3o definido"}`]:[`- **Runtime:** ${e.execution?.runtime??"manual (padr\xE3o impl\xEDcito)"}`],d=e.assurance===void 0?["- N\xE3o configurada."]:[`- **Vers\xE3o:** ${e.assurance.version}`,`- **Profundidade padr\xE3o:** ${kt(e.assurance.standard_depth)}`,`- **Exigir commit final:** ${e.assurance.require_final_commit?"Sim":"N\xE3o"}`];return["---","schema_version: 1","kind: software-architecture",`generated_from: ${gn}`,"---","","# Arquitetura de Software","",`> Proje\xE7\xE3o gerada automaticamente pela p\xE1gina de configura\xE7\xF5es a partir de \`${gn}\`. N\xE3o edite este arquivo manualmente.`,"","## Projeto","",`- **Nome:** ${kt(e.project.name)}`,`- **ID:** ${kt(e.project.id)}`,`- **Timezone:** ${kt(e.project.timezone)}`,"","## Perfil t\xE9cnico","",`- **Stack profile:** ${kt(e.stack.id)}`,`- **Linguagem:** ${kt(e.stack.language,"N\xE3o definida")}`,`- **API:** ${kt(e.stack.api,"N\xE3o definida")}`,`- **Query builder:** ${kt(e.stack.query_builder,"N\xE3o definido")}`,"","## Execu\xE7\xE3o","",...c,"","## Assurance","",...d,"","## Componentes e vers\xF5es","","| Responsabilidade | Tecnologia | Vers\xE3o exata | Pacote / imagem / servi\xE7o |","| --- | --- | --- | --- |",...o,"","## Superf\xEDcies","","### Web App \u2014 Frontend","",...rc(g_(i.frontend)),"","### Backend","",...rc(g_(i.backend)),"","### Site e Landing Pages","",...rc(g_(i.site)),"","## Decis\xF5es de arquitetura","",...l.length>0?l:["- Nenhuma decis\xE3o adicional registrada.",""],"## Layout do c\xF3digo","","| Papel | Caminho |","| --- | --- |",...a.length>0?a:["| N\xE3o definido | \u2014 |"],"","## Invariantes","",...rc(e.stack.invariants??[]),"","## Comandos de valida\xE7\xE3o","","| Comando | Execu\xE7\xE3o |","| --- | --- |",...s.length>0?s:["| N\xE3o definido | \u2014 |"],""].join(`
346
+ `)}function Ri(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{}}function g_(e){return Array.isArray(e)?e.flatMap(t=>{if(typeof t=="string"&&t.length>0)return[t];let n=Object.entries(Ri(t));return n.length===1&&typeof n[0]?.[1]=="string"?[`${n[0][0]}: ${n[0][1]}`]:[]}):[]}function rc(e){return e.length>0?e.map(t=>`- ${kt(t)}`):["- N\xE3o definido."]}function kt(e,t="\u2014"){return typeof e!="string"||e.trim().length===0?t:e.trim().replaceAll("|","\\|").replaceAll(/\r?\n/g," ")}function NJ(e){return kt(e).replaceAll("`","\\`")}function PJ(e){let t=e.replaceAll("_"," ");return t.charAt(0).toUpperCase()+t.slice(1)}function h_(e){return e.status==="completed"?"completed":e.status==="cancelled"?"cancelled":e.status==="failed"?"failed":e.status==="blocked"?"blocked":e.is_active===!0||e.status==="executing"?"executing":e.status==="verifying"?"verifying":(e.attempt_count??0)>0||e.started_at!=null||e.execution_started===!0?"executing":e.status==="draft"?"definition":e.status==="planned"?"ready":null}function y_(e,t){if(e.lifecycle_status==="cancelled")return"cancelled";if(e.lifecycle_status==="failed")return"failed";if(e.lifecycle_status==="blocked")return"blocked";if(e.lifecycle_status==="delivered"||e.lifecycle_status==="completed")return"completed";if(e.lifecycle_status==="ready")return"ready";if(e.kind==="prd"&&e.lifecycle_status==="draft")return"definition";if(e.kind==="spec"&&e.lifecycle_status==="draft")return"planning";if(e.work_status==="cancelled")return"cancelled";if(e.work_status==="failed")return"failed";if(e.work_status==="blocked")return"blocked";if(e.work_status==="completed")return"completed";if(e.is_active||t.some(n=>e.task_ids.includes(n.id)&&n.is_active))return"executing";if(e.lifecycle_status==="verifying"||e.work_status==="verifying")return"verifying";if(e.work_status==="executing"){let n=t.filter(i=>e.task_ids.includes(i.id));return n.some(i=>i.status==="verifying")&&n.every(i=>i.status==="verifying"||i.status==="completed")?"verifying":"executing"}return e.lifecycle_status==="active"?"executing":"planning"}function zR(e){return{query:(e.req.query("query")??"").trim().toLocaleLowerCase(),status:e.req.query("status")??"",risk:e.req.query("risk")??"",origin:e.req.query("origin")??"",kind:e.req.query("kind")??""}}function FR(e){if(e===void 0||!["definition","planning","ready","executing","verifying","completed","blocked","cancelled","failed"].includes(e))throw new Error("A valid Kanban stage is required");return e}function qR(e,t,n,i,r,o){let a=new Map(e.changes.map(S=>[S.id,S.source.type])),s=S=>o.query===""||S.some(R=>R?.toLocaleLowerCase().includes(o.query)),l=S=>(o.status===""||h_(S)===o.status)&&(o.risk===""||S.risk===o.risk)&&(o.origin===""||(a.get(S.change_id)??(S.spec_id===null?"task":"spec"))===o.origin)&&s([S.id,S.title,S.short_name,S.objective,S.change_id,S.spec_id]),c=S=>o.risk===""&&o.origin===""&&(o.status===""||y_(S,e.tasks)===o.status)&&s([S.id,S.title,S.parent_id]),d=e.tasks.filter(l),u=e.prds.filter(c),_=e.specs.filter(c),y=[...u.map(S=>({kind:"prd",row:S})),..._.map(S=>({kind:"spec",row:S})),...d.map(S=>({kind:"task",row:S}))].filter(S=>(S.kind==="task"?h_(S.row):y_(S.row,e.tasks))===t).toSorted((S,R)=>{let g=new Map(r.map((b,O)=>[b,O]));return(g.get(S.row.id)??Number.MAX_SAFE_INTEGER)-(g.get(R.row.id)??Number.MAX_SAFE_INTEGER)||String(R.row.updated_at??"").localeCompare(String(S.row.updated_at??""))||S.row.id.localeCompare(R.row.id)}).filter(S=>(S.kind==="task"?h_(S.row):y_(S.row,e.tasks))===t),f=o.kind===""?y:y.filter(S=>S.kind===o.kind),h=f.slice(n,n+i),k=new Set(h.map(S=>S.row.id));return{stage:t,offset:n,total:f.length,totals_by_kind:{all:y.length,task:y.filter(S=>S.kind==="task").length,prd:y.filter(S=>S.kind==="prd").length,spec:y.filter(S=>S.kind==="spec").length},prds:h.filter(S=>S.kind==="prd").map(S=>S.row),specs:h.filter(S=>S.kind==="spec").map(S=>S.row),tasks:h.filter(S=>S.kind==="task").map(S=>S.row),changes:e.changes.filter(S=>S.task_ids.some(R=>k.has(R)))}}function VR(e,t,n,i,r){let o=c=>c.rework_run_count>0?"rework":c.task_count>0?"structured":"empty",s=(t==="task"?e.tasks.filter(c=>c.risk===n):(t==="spec"?e.specs:e.prds).filter(c=>o(c)===n)).toSorted((c,d)=>String(d.updated_at??d.created_at??"").localeCompare(String(c.updated_at??c.created_at??""))||c.id.localeCompare(d.id)),l=s.slice(i,i+r);return{offset:i,total:s.length,prds:t==="prd"?l:[],specs:t==="spec"?l:[],tasks:t==="task"?l:[],changes:t==="task"?e.changes.filter(c=>l.some(d=>c.task_ids.includes(d.id))):[]}}bi();bi();function v_(e,t,n,i,r,o,a=null){let s=Object.entries(e.days).sort(([S],[R])=>R.localeCompare(S)),l=n.from===null?null:WR(n.from),c=n.to===null?null:WR(n.to),d=s.filter(([S])=>(l===null||S>=l)&&(c===null||S<=c)),_=(t==="overview"?d.map(([S,R])=>({day:S,...R.overview})):MJ(t,ZR(d.flatMap(([,S])=>S[t])),ZR(s.flatMap(([,S])=>S[t])),n)).filter(S=>DJ(S,i)),p=jJ(a),y=p===null?_:_.filter(S=>`${BR(S)}\0${HR(S)}`<p),f=p===null?r:0,h=y.slice(f,f+o),k=h.at(-1);return{data_source:"lifecycle_daily_read_models",snapshot_id:e.updated_at,source_latest_at:e.source_latest_at,kind:t,offset:f,limit:o,total:_.length,has_more:f+o<y.length,next_cursor:k===void 0||f+o>=y.length?null:LJ(BR(k),HR(k)),rows:h}}function WR(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:Dt(e,"day")}function MJ(e,t,n,i){if(e!=="tasks"&&e!=="specs"&&e!=="prds")return[...t];let r=new Set(["completed","delivered","failed","cancelled","superseded","rolled_back"]),o=new Map(n.map(c=>[c.id,c])),a=t.filter(c=>{let d=o.get(c.id)??c;if(d.status===null||!r.has(d.status)||c.run_count>0)return!0;let u=d.window_at??d.occurred_at;return(i.from===null||u>=i.from)&&(i.to===null||u<=i.to)}),s=new Set(a.map(c=>c.id)),l=()=>({known_sum:0,unknown:0,complete:!0,coverage_ratio:1});return[...a,...n.filter(c=>!s.has(c.id)&&(c.status===null||!r.has(c.status))).map(c=>({...c,run_count:0,cost_currency:null,metrics:{duration:l(),total_tokens:l(),cost:l()}}))].sort((c,d)=>d.occurred_at.localeCompare(c.occurred_at)||c.id.localeCompare(d.id))}function ZR(e){let t=new Map;for(let n of e){let i=t.get(n.id);if(i===void 0){t.set(n.id,structuredClone(n));continue}let r=i.run_count;if(n.run_count>0){let o=n.lifecycle_elapsed_ms??null;if(r===0)i.lifecycle_elapsed_ms=o;else{let a=i.lifecycle_elapsed_ms??null;i.lifecycle_elapsed_ms=a===null||o===null?null:a+o}}i.run_count+=n.run_count;for(let o of["duration","total_tokens","cost"]){let a=i.metrics[o],s=n.metrics[o];a.known_sum+=s.known_sum,a.unknown+=s.unknown,a.complete=a.unknown===0;let l=i.run_count;a.coverage_ratio=l===0?1:Math.max(0,Math.min(1,(l-a.unknown)/l))}}return[...t.values()].sort((n,i)=>i.occurred_at.localeCompare(n.occurred_at)||n.id.localeCompare(i.id))}function BR(e){let t=e;return typeof t.occurred_at=="string"?t.occurred_at:typeof t.day=="string"?t.day:""}function HR(e){let t=e;return typeof t.id=="string"?t.id:typeof t.day=="string"?t.day:""}function LJ(e,t){return encodeURIComponent(JSON.stringify([e,t]))}function jJ(e){if(e===null)return null;try{let t=JSON.parse(decodeURIComponent(e));return Array.isArray(t)&&typeof t[0]=="string"&&typeof t[1]=="string"?`${t[0]}\0${t[1]}`:null}catch{return null}}function DJ(e,t){return t.status&&e.status!==t.status||t.risk&&e.risk!==t.risk?!1:t.query?Object.values(e).some(n=>typeof n=="string"&&n.toLocaleLowerCase().includes(t.query)):!0}var JR=require("node:path");function KR(e,t){if(t!=="executions"&&t!=="conversations")return[...e];let n=new Map;for(let i of e){let r=t==="executions"?i.execution_id:i.conversation_id;if(r==null)continue;let o=n.get(r)??{...i,id:r,duration_ms:null,total_tokens:null,cost:null};i.phase==="execution"&&i.parent_run_id===null&&i.duration_ms!==null&&(o.duration_ms=(o.duration_ms??0)+i.duration_ms),i.total_tokens!==null&&(o.total_tokens=(o.total_tokens??0)+i.total_tokens),i.cost!==null&&(o.cost=(o.cost??0)+i.cost),i.started_at<o.started_at&&(o.started_at=i.started_at),(o.finished_at===null||i.finished_at!==null&&i.finished_at>o.finished_at)&&(o.finished_at=i.finished_at),n.set(r,o)}return[...n.values()].sort((i,r)=>r.started_at.localeCompare(i.started_at))}function GR(e,t,n,i){return e.flatMap(r=>{let o=r.data,a=typeof o?.created_at=="string"?o.created_at:null;if(a===null||n!==null&&a<n||i!==null&&a>i)return[];let s=o?.source;if(s===null||typeof s!="object"||!("type"in s))return[];let l=s;return l.type==="task"&&typeof l.task_id=="string"||l.type==="spec"&&typeof l.spec_id=="string"||l.type==="prd"&&typeof l.prd_id=="string"?[{id:r.id,title:r.title??(typeof o?.title=="string"?o.title:r.id),created_at:a,status:r.status??(typeof o?.status=="string"?o.status:"unclassified"),risk:r.risk??(typeof o?.risk=="string"?o.risk:"unclassified"),source:l,requirement_ids:Ph(o?.requirement_ids),acceptance_ids:Ph(o?.acceptance_ids),task_ids:Ph(o?.task_ids),result:typeof o?.result=="string"?o.result:null,artifact_path:t.activePath("change",r.id)}]:[]}).sort((r,o)=>o.created_at.localeCompare(r.created_at))}function XR(e,t,n,i){return e.flatMap(r=>{let o=r.data,a=typeof o?.created_at=="string"?o.created_at:null;return a===null||n!==null&&a<n||i!==null&&a>i||o?.origin!=="human"&&o?.origin!=="agent"||o?.scope_type!=="change"&&o?.scope_type!=="execution"||typeof o?.scope_id!="string"?[]:[{id:r.id,title:r.title??(typeof o?.title=="string"?o.title:r.id),origin:o.origin,scope_type:o.scope_type,scope_id:o.scope_id,artifact_path:`${JR.posix.dirname(t.activePath(o.scope_type,o.scope_id))}/decisions/${r.id}.md`,created_at:a}]}).sort((r,o)=>o.created_at.localeCompare(r.created_at))}function Ph(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function po(e){return{query:(e.req.query("query")??"").trim().toLocaleLowerCase(),status:(e.req.query("status")??"").trim(),risk:(e.req.query("risk")??"").trim()}}function YR(e,t){return e.filter(n=>t.status&&n.status!==t.status?!1:t.query?[n.id,n.task_id,n.execution_id,n.conversation_id,n.parent_run_id,n.run_kind,n.phase,n.agent].some(i=>typeof i=="string"&&i.toLocaleLowerCase().includes(t.query)):!0)}function QR(e,t){return e.filter(n=>t.status&&n.status!==t.status||t.risk&&n.risk!==t.risk?!1:t.query?[n.id,n.title,n.status,n.risk,n.source,n.origin,n.scope_type,n.scope_id].flatMap(i=>typeof i=="object"&&i!==null?Object.values(i):[i]).some(i=>typeof i=="string"&&i.toLocaleLowerCase().includes(t.query)):!0)}function Nt(e){let t=e.req.query("from")??null,n=e.req.query("to")??null;return{from:eC(t,"start"),to:eC(n,"end")}}function eC(e,t){if(e===null||!/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let n=tC(e);if(t==="start")return new Date(n).toISOString();let[i,r,o]=e.split("-").map(Number),a=new Date(Date.UTC(i,r-1,o+1)).toISOString().slice(0,10);return new Date(tC(a)-1).toISOString()}function tC(e){let[t,n,i]=e.split("-").map(Number),r=Date.UTC(t,n-1,i),o=r-nC(r);return o=r-nC(o),o}function nC(e){let n=new Intl.DateTimeFormat("en-US",{timeZone:"America/Sao_Paulo",timeZoneName:"longOffset"}).formatToParts(new Date(e)).find(o=>o.type==="timeZoneName")?.value??"GMT",i=/^GMT([+-])(\d{2}):(\d{2})$/.exec(n);if(i===null)return 0;let r=Number(i[2])*60+Number(i[3]);return(i[1]==="+"?1:-1)*r*6e4}function rC(e,t,n,i){e.on(["GET","HEAD"],"/api/v2/operations/read-models",async r=>{let o=r.req.query("kind");if(!["overview","tasks","specs","prds","executions","conversations"].includes(o))return i(r,{error:"Unsupported daily read model"},400,!1);let a=Math.max(0,Number.parseInt(r.req.query("offset")??"0",10)||0),s=Math.min(200,Math.max(1,Number.parseInt(r.req.query("limit")??"20",10)||20)),{from:l,to:c}=Nt(r),d=po(r),u=await n(`operations:read-model:${o}:${l??""}:${c??""}:${a}:${s}:${r.req.query("cursor")??""}:${d.query}:${d.status}:${d.risk}`,async()=>{let _=await new Ut(t).readDailyReadModels(o);return _===null?{data_source:"lifecycle_daily_read_models",snapshot_id:null,source_latest_at:null,kind:o,offset:a,limit:s,total:0,has_more:!1,next_cursor:null,rows:[]}:v_(_,o,{from:l,to:c},d,a,s,r.req.query("cursor")??null)});return i(r,u,200,!0)})}bi();function iC(e,t,n,i){e.on(["GET","HEAD"],"/api/v2/operations/runs",async r=>{let o=Math.max(0,Number.parseInt(r.req.query("offset")??"0",10)||0),a=Math.min(200,Math.max(1,Number.parseInt(r.req.query("limit")??"100",10)||100)),{from:s,to:l}=Nt(r),c=r.req.query("kind")??"runs",d=po(r),u=await n(`operations:runs:${c}:${s??""}:${l??""}:${o}:${a}:${d.query}:${d.status}:${d.risk}`,async()=>{if(c==="executions"||c==="conversations"){let f=await new Ut(t).readDailyReadModels(c);if(f!==null){let h=v_(f,c,{from:s,to:l},d,o,a);return UJ(c,h,h.rows)}}let p=(JSON.parse(await t.readText(".agents/records/lifecycle/summary.json")).run_metrics??[]).filter(f=>(s===null||f.started_at>=s)&&(l===null||f.started_at<=l)&&(c==="runs"||c==="conversations"&&f.phase==="conversation"&&f.conversation_id!==null||c==="executions"&&f.execution_id!==null)),y=YR(KR(p,c),d);return{data_source:"lifecycle_manifest_summary",kind:c,offset:o,limit:a,total:y.length,rows:y.slice(o,o+a)}});return i(r,u,200,!0)})}function UJ(e,t,n){let i=r=>r.complete||r.known_sum>0?r.known_sum:null;return{data_source:t.data_source,kind:e,offset:t.offset,limit:t.limit,total:t.total,rows:n.map(r=>({id:r.id,started_at:r.occurred_at,finished_at:null,task_id:r.kind==="execution"?r.parent_id:null,execution_id:r.kind==="execution"?r.id:r.parent_id,conversation_id:r.kind==="conversation"?r.id:null,parent_run_id:null,run_kind:"run",phase:r.kind,status:r.status,duration_ms:i(r.metrics.duration),lifecycle_elapsed_ms:r.lifecycle_elapsed_ms??null,total_tokens:i(r.metrics.total_tokens),cost:i(r.metrics.cost),currency:r.cost_currency}))}}Zr();Gs();function ic(e,t){let n=new Map(e.map(i=>[i.id,i]));for(let i of t.map(r=>Mh(r,t))){let r=n.get(i.id);if(r===void 0){n.set(i.id,i);continue}n.set(i.id,{...i,...r,usage:zJ(r.usage,i.usage),provider:r.provider??i.provider,model:r.model==="unknown"?i.model:r.model,reasoning_effort:r.reasoning_effort??i.reasoning_effort,service_tier:r.service_tier??i.service_tier??null,call_count:r.call_count??i.call_count,terminal_call_count:r.terminal_call_count??i.terminal_call_count,...(r.pricing_segments?.length??0)>0?{pricing_segments:r.pricing_segments}:i.pricing_segments===void 0?{}:{pricing_segments:i.pricing_segments},...r.duration_ms!==null&&(r.source_duration_ms===null||r.source_duration_ms===0)?{duration_ms:r.duration_ms,source_duration_ms:null,source_started_at:null,source_finished_at:null,capture_lag_ms:null}:FJ(r)})}return[...n.values()]}function zJ(e,t){let n=(i,r)=>({...r,...i,tokens:{...r.tokens,...i.tokens,input:i.tokens.input??r.tokens.input,cached_input:i.tokens.cached_input??r.tokens.cached_input,output:i.tokens.output??r.tokens.output,reasoning:i.tokens.reasoning??r.tokens.reasoning,total:i.tokens.total??r.tokens.total},cost:{...r.cost,...i.cost,usd:i.cost.usd??r.cost.usd,brl:i.cost.brl??r.cost.brl}});return{conversation:n(e.conversation,t.conversation),planning:n(e.planning,t.planning),execution:n(e.execution,t.execution),total:n(e.total,t.total),new_work:n(e.new_work,t.new_work),rework:n(e.rework,t.rework)}}function FJ(e){return{duration_ms:e.duration_ms,...typeof e.source_duration_ms=="number"?{duration_provenance:"observed"}:e.duration_provenance===void 0?{}:{duration_provenance:e.duration_provenance},estimation_basis:typeof e.source_duration_ms=="number"?null:e.estimation_basis??null,source_duration_ms:e.source_duration_ms??null,source_started_at:e.source_started_at??null,source_finished_at:e.source_finished_at??null,capture_lag_ms:e.capture_lag_ms??null}}function Mh(e,t){let n=Array.isArray(e.usage_segments)?e.usage_segments:[],i=u=>n.length===0||n.some(_=>!VJ(_.tokens?.[u]))?null:n.reduce((_,p)=>_+(p.tokens?.[u]??0),0),r=e.quantitative_metrics.tokens_total,o=e.quantitative_metrics.estimated_usd,a=e.quantitative_metrics.estimated_brl,s={events:e.source_event_count,tokens:{input:i("input"),cached_input:i("cached_input"),output:i("output"),reasoning:i("reasoning"),total:r.known_sum},cost:{usd:e.historical_cost?.estimated_usd??o.known_sum,brl:e.historical_cost?.estimated_brl??a.known_sum},coverage:{events:e.source_event_count,tokens:r.complete,usd:o.complete,brl:a.complete}},l={...s,events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},c=e.phase==="execution"?s:l,d=e.invocation_kind==="delegated";return{id:e.run_id,artifact_path:`.agents/records/runs/${e.run_id}`,status:e.status??"completed",phase:e.phase??"execution",entrypoint:e.task_id===null?"conversation":"task",work_type:"new",run_role:d?"subagent":"orchestrator",run_kind:d?"subrun":"run",run_purpose:qJ(e.purpose,d),requires_finalizer:!1,parent_run_id:t.find(u=>u.agent_invocation_id===e.parent_agent_invocation_id)?.run_id??null,client:"codex",agent:e.zaip_agent??"unknown",agent_name:e.zaip_agent??"unknown",provider:n.find(u=>typeof u.provider=="string")?.provider??null,model:n.find(u=>typeof u.model=="string")?.model??"unknown",reasoning_effort:n.find(u=>typeof u.reasoning_effort=="string")?.reasoning_effort??null,effective_model:null,effective_reasoning_effort:null,effective_config_mixed:!1,service_tier:n.find(u=>typeof u.service_tier=="string")?.service_tier??null,call_count:e.llm_call_count,terminal_call_count:e.llm_call_count,failed_call_count:e.status==="failed"?e.llm_call_count:0,cancelled_call_count:e.status==="cancelled"?e.llm_call_count:0,conversation_id:e.agent_invocation_id,execution_id:e.execution_id,task_id:e.task_id,spec_id:e.spec_id,prd_id:e.prd_id,change_id:e.change_id,started_at:e.occurred_at,finished_at:e.status===null?null:e.occurred_at,duration_ms:e.time.duration_ms,source_duration_ms:e.time.duration_ms,source_started_at:null,source_finished_at:e.time.source_latest_at,pricing_segments:n.map(u=>({phase:"execution",provider:u.provider,model:u.model,service_tier:u.service_tier,input_tokens:u.tokens?.input??null,cached_input_tokens:u.tokens?.cached_input??null,output_tokens:u.tokens?.output??null,reasoning_tokens:u.tokens?.reasoning??null,total_tokens:u.tokens?.total??null})),usage:{conversation:l,planning:l,execution:c,total:s,new_work:s,rework:l}}}function qJ(e,t){return e==="intake"||e==="orchestration"||e==="execution"||e==="review"||e==="audit"||e==="finalization"?e:t?"execution":"orchestration"}function VJ(e){return typeof e=="number"&&Number.isFinite(e)}bt();Zr();function Gr(e){return e.req.query("currency")==="USD"?"USD":"BRL"}function lt(e,t){let n=e.req.query(t);return n===void 0||n===""?[]:n.split(",").filter(Boolean)}async function Lh(e,t){let n=new Map,i=new Map,r=1,o=!0;for(;o;){let a=await DA(e,{...t,cache:n,page:r,page_size:500});for(let s of a.summaries)WJ(s)&&i.set(s.agent_invocation_id,s);o=a.has_more,r+=1}return[...i.values()]}function WJ(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.agent_invocation_id=="string"&&typeof t.root_agent_invocation_id=="string"&&(t.parent_agent_invocation_id===null||typeof t.parent_agent_invocation_id=="string")&&(t.invocation_kind==="orchestrator"||t.invocation_kind==="delegated")&&typeof t.run_id=="string"&&typeof t.quantitative_metrics=="object"&&t.quantitative_metrics!==null&&typeof t.time=="object"&&t.time!==null&&Array.isArray(t.usage_segments)}async function oC(e){try{let t=ii(yt(await e.readText(".agents/config/agents/catalog.yaml"))).agents;return{agentNames:t.map(n=>n.codex_name),agentNamesById:Object.fromEntries(t.map(n=>[n.id,n.codex_name])),agentNamesByRole:Object.fromEntries(t.map(n=>[n.role,n.codex_name]))}}catch{return{agentNames:[],agentNamesById:{},agentNamesByRole:{}}}}var ZJ=".agents/dashboard/work-priority.json";async function S_(e,t,n,i=!1,r=!1){let o=await Ks(e,t,n,{overviewOnly:i,includeOverviewChanges:r}),a=BJ(o,await k_(e,w_(o)));if(i||n.from===null||n.to===null)return a;let s=await Lh(e,{from:n.from,to:n.to});return s.length===0?a:Xd({...a,runs:Tr(cC(a.runs,s))})}async function k_(e,t){try{let n=jh(JSON.parse(await e.readText(ZJ)),!1);return t===void 0?n:{...n,item_ids:n.item_ids.filter(i=>t.has(i))}}catch{return{schema_version:1,item_ids:[],updated_at:null}}}function w_(e){return new Set([...e.prds.map(t=>t.id),...e.specs.map(t=>t.id),...e.tasks.map(t=>t.id)])}function jh(e,t=!0){let n=typeof e=="object"&&e!==null?e:{};return{schema_version:1,item_ids:Array.isArray(n.item_ids)?[...new Set(n.item_ids.filter(r=>typeof r=="string"&&r.length>0))]:[],updated_at:typeof n.updated_at=="string"&&!t?n.updated_at:new Date().toISOString()}}function BJ(e,t){let n=new Map(t.item_ids.map((r,o)=>[r,o])),i=r=>n.get(r)??null;return{...e,prds:e.prds.map(r=>({...r,manual_order:i(r.id)})),specs:e.specs.map(r=>({...r,manual_order:i(r.id)})),tasks:e.tasks.map(r=>({...r,manual_order:i(r.id)}))}}async function ha(e,t,n){let i=new hi(e),[r,o]=await Promise.all([i.readCatalog(),n==="BRL"?i.readLatestFxRate():Promise.resolve(null)]),a=await oC(e);return pd(t,{catalog:r,fxRate:o,currency:n},a)}async function sC(e,t,n){let i=n.req.query("from")??null,r=n.req.query("to")??null;if(i===null||r===null)return ha(e,t,Gr(n));let o={providers:lt(n,"provider"),models:lt(n,"model"),zaip_agents:lt(n,"agent"),phases:lt(n,"phase"),statuses:lt(n,"status")},a=await Lh(e,{from:i,to:r,filters:o});if(a.length===0)return ha(e,t,Gr(n));let s=Tr(cC(t.runs,a));return ha(e,{...t,runs:s},Gr(n))}function cC(e,t){let n=new Set(e.map(i=>i.id));return ic(e,t.filter(i=>n.has(i.run_id)))}async function lC(e,t,n,i,r,o){let a=await JJ(e,i.from,i.to),{from:s,to:l}=a,c={providers:lt(n,"provider"),models:lt(n,"model"),zaip_agents:lt(n,"agent"),phases:lt(n,"phase"),statuses:lt(n,"status")},d=c.providers.length>0||c.models.length>0||c.zaip_agents.length>0||c.statuses.length>0,[u,_,p]=await Promise.all([Promise.resolve().then(()=>(Gs(),ZO)).then(({buildQuickOperationsProjection:b})=>b(e,t,{from:s,to:l})),Wm(e,{from:s,to:l,filters:c,offset:r,limit:o}),e.readText(".agents/records/lifecycle/summary.json").then(b=>JSON.parse(b))]),y=(p.run_metrics??[]).filter(b=>KJ(b.finished_at??b.started_at,s,l)).sort((b,O)=>(O.finished_at??O.started_at).localeCompare(b.finished_at??b.started_at)||b.id.localeCompare(O.id)),f=c.phases.length===0?y:y.filter(b=>b.phase!==null&&c.phases.includes(b.phase)),h=new Set(_.summaries.map(b=>b.run_id)),k=d?f.filter(b=>h.has(b.id)).map(aC):f.slice(r,r+o).map(aC),S=HJ(k,_.summaries),R=Tr(S),g=await ha(e,{...u,runs:R},Gr(n));return{...g,page_only:!0,overview:{...g.overview,run_count:0,event_count:0,total_tokens:null,estimated_usd:null,estimated_brl:null,recorded_usd:null,recorded_brl:null,average_run_cost_usd:null,average_run_cost_brl:null,average_run_duration_ms:null,known_tokens_per_cycle:null,top_10_token_share:null},groups:{conversations:[],tasks:[],providers:[],agents:[],models:[],daily:[],monthly:[],annual:[]},run_page:{offset:r,limit:o,total:d?null:f.length,has_more:d?_.has_more:r+o<f.length}}}function HJ(e,t){let n=new Set(e.map(o=>o.id)),i=ic(e,t.filter(o=>n.has(o.run_id))),r=new Map(i.map(o=>[o.id,o]));return e.map(o=>r.get(o.id)??o)}function aC(e){let t={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},n={...t,events:e.events??0,tokens:{...t.tokens,total:e.total_tokens},cost:{usd:null,brl:e.currency==="BRL"?e.cost:null},coverage:{events:e.events??0,tokens:e.total_tokens===null?0:1,usd:0,brl:e.cost===null?0:1}};return{id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status==="failed"||e.status==="cancelled"||e.status==="running"?e.status:"completed",phase:e.phase??"execution",entrypoint:e.task_id===null?"conversation":"task",work_type:"new",run_role:e.run_kind==="subrun"?"subagent":"orchestrator",run_kind:e.run_kind??"run",run_purpose:"execution",requires_finalizer:!1,parent_run_id:e.parent_run_id,client:"unknown",agent:e.agent??"unknown",agent_name:e.agent_name??e.agent??"unknown",provider:e.provider,model:e.model??"unknown",reasoning_effort:null,effective_model:e.model,effective_reasoning_effort:null,effective_config_mixed:!1,call_count:null,terminal_call_count:null,failed_call_count:0,cancelled_call_count:0,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id,task_id:e.task_id,spec_id:e.spec_id,prd_id:e.prd_id,change_id:e.change_id,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.duration_ms,usage:{conversation:t,planning:t,execution:n,total:n,new_work:n,rework:t}}}async function JJ(e,t,n){if(t!==null&&n!==null)return{from:t,to:n};let i=await e.readText(".agents/records/lifecycle/summary.json").then(l=>JSON.parse(l)),r=Object.keys(i.periods?.daily??{}).sort(),o=r.at(0),a=r.at(-1),s=new Date().toISOString().slice(0,10);return{from:b_(t??o??s,"start"),to:b_(n??a??s,"end")}}function KJ(e,t,n){let i=Date.parse(e),r=Date.parse(b_(t,"start")),o=Date.parse(b_(n,"end"));return Number.isFinite(i)&&Number.isFinite(r)&&Number.isFinite(o)&&i>=r&&i<=o}function b_(e,t){return/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T${t==="start"?"00:00:00.000":"23:59:59.999"}Z`:e}async function Dh(e){return new hi(e).readLatestFxRate()}function uC(e){return["provider","model","agent","phase","status"].every(t=>(e.req.queries(t)?.length??0)===0)}var _C=require("node:child_process"),pC=require("node:crypto"),Uh=require("node:path"),fC=require("node:util"),dC=".agents/dashboard/dashboard.config.json",mC=(0,fC.promisify)(_C.execFile);async function gC(e,t){let n=process.env.ZAIP_DASHBOARD_TITLE?.trim()||"Dashboard Zaip AIOS SQLite",i="auto";try{if(await e.exists(dC)){let r=JSON.parse(await e.readText(dC));typeof r.title=="string"&&r.title.trim()&&(n=r.title.trim()),typeof r.github_repository=="string"&&(i=r.github_repository.trim())}}catch{}if(i.toLowerCase()!=="auto")return{title:n,repository_name:E_(i)??""};try{let{stdout:r}=await mC("git",["-C",t,"remote","get-url","origin"],{encoding:"utf8",windowsHide:!0});return{title:n,repository_name:E_(r)??""}}catch{return{title:n,repository_name:""}}}function E_(e){let t=e.trim(),n=t.match(/github\.com(?::|\/)([^/\s]+)\/([^/\s]+?)(?:\.git)?$/i)??t.match(/^([^/:\s]+)\/([^/\s]+?)(?:\.git)?$/);return n?`${n[1]}/${n[2]}`:null}function A_(e){return(0,pC.createHash)("sha256").update(`${(0,Uh.resolve)(e)}:dashboard-sqlite`).digest("hex").slice(0,16)}async function hC(e,t){if(!await e.exists(".agents/runtime/bin/zaip.mjs"))return{reconciled_ids:[],blocked:[],not_reconciled:[]};let n=(0,Uh.resolve)(t,".agents","runtime","bin","zaip.mjs"),{stdout:i}=await mC(process.execPath,[n,"run","reconcile","--open","--json"],{cwd:t,windowsHide:!0,timeout:12e4,maxBuffer:10*1024*1024});return zh(JSON.parse(i))}function zh(e){let t=new Set,n=new Map,i=new Map,r=(u,_,p)=>{typeof _=="string"&&u.set(_,typeof p=="string"&&p.trim()?p:null)},o=typeof e=="object"&&e!==null?e:{},a=Array.isArray(o.reconciliations)?o.reconciliations:[];for(let u of a){if(typeof u!="object"||u===null)continue;let _=u,p=_.error,y=["tasks","changes","executions","specs","prds"].flatMap(f=>Array.isArray(_[f])?_[f]:[]);for(let f of y){if(typeof f!="object"||f===null)continue;let h=f;_.status==="closed"&&h.status==="completed"&&typeof h.id=="string"?t.add(h.id):h.status==="blocked"?r(n,h.id,h.status_reason??p):_.status==="deferred"&&r(i,h.id,p)}}(Array.isArray(o.orphaned_executions)?o.orphaned_executions:[]).forEach(u=>{r(n,u,"Execution orphaned after the reconciliation grace period.")}),(Array.isArray(o.reconciliation_errors)?o.reconciliation_errors:[]).forEach(u=>{if(typeof u!="object"||u===null)return;let _=u;r(i,_.run_id,_.error)}),(Array.isArray(o.unresolved_running_run_ids)?o.unresolved_running_run_ids:[]).forEach(u=>{r(i,u,"Invocation is still running.")});let d=u=>[...u.entries()].map(([_,p])=>({id:_,reason:p})).sort((_,p)=>_.id.localeCompare(p.id));return{reconciled_ids:[...t].sort(),blocked:d(n),not_reconciled:d(i)}}var bn=require("node:crypto"),et=require("node:fs/promises"),st=require("node:path"),$i=require("node:sqlite");bt();Zr();Os();var bC=".local/dashboard-sqlite/read-model.sqlite",GJ=new Set([".json",".jsonl",".md",".yaml",".yml",".txt"]),fo="60",XJ=["zaip_aios_activities","zaip_dim_llm_model","zaip_dim_provider","zaip_dim_zaip_agent","cost_invocation_dimension_facts"],YJ=["zaip_activities_agent_run","zaip_activities_relationships","zaip_activities_task_day","zaip_activities_spec_day","zaip_activities_prd_day","zaip_activities_agent","zaip_activities_run_id","zaip_activities_run_hierarchy","zaip_activities_period","zaip_activities_period_invocation","zaip_activities_status","zaip_activities_payload","cost_dimension_facts_day_model","cost_dimension_facts_day_provider","cost_dimension_facts_invocation"],QJ=["zaip_vw_read_model_metadata","zaip_vw_operations_overview","zaip_vw_cost_overview","zaip_vw_cost_models","zaip_vw_cost_providers","zaip_vw_operations_agent_invocations"],Wh=2*36e5;function Xr(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0&&!["unavailable","unknown","mixed"].includes(t.toLowerCase())?t:null}function eK(){let e=new Intl.DateTimeFormat("en-CA",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date),t=Object.fromEntries(e.map(i=>[i.type,i.value])),n=`${t.year}-${t.month}-${t.day}`;return{from:`${t.year}-${t.month}-01`,to:n}}function tK(e){let t=["model","provider"],n=new Set(e.prepare("SELECT provider FROM zaip_dim_provider").all().map(u=>u.provider)),i=e.prepare(`SELECT activity_row_id, agent_invocation_id, task_id, duration_ms,
347
+ source_event_count, provider, model, total_tokens, cost_usd, cost_brl
348
+ FROM zaip_aios_activities WHERE payload_type IS NULL`).all(),r=e.prepare(`SELECT agent_invocation_id, provider, model, total_tokens, cost_usd, cost_brl
349
+ FROM invocation_usage_segments`).all(),o=new Map(i.filter(u=>typeof u.agent_invocation_id=="string").map(u=>[String(u.agent_invocation_id),u])),a=new Map(t.map(u=>[u,new Map])),s=(u,_)=>{let p=a.get(u),y=p.get(_);if(y!==void 0)return y;let f={key:_,label:_,invocation_count:0,task_count:0,total_duration:null,source_event_count:null,total_tokens:null,total_cost_usd:null,total_cost_brl:null};return p.set(_,f),f},l=(u,_,p)=>{typeof p=="number"&&(u[_]=(u[_]??0)+p)},c=new Map;for(let u of r){let _=String(u.agent_invocation_id??"");if(_.length===0)continue;let p=c.get(_);p===void 0?c.set(_,[u]):p.push(u)}for(let[u,_]of c){let p=o.get(u);if(p!==void 0)for(let y of t){let f=_.filter(k=>Xr(k[y])!==null&&Xr(k.provider)!==null&&n.has(Xr(k.provider))&&(typeof k.total_tokens=="number"||typeof k.cost_usd=="number"||typeof k.cost_brl=="number")),h=[...new Set(f.map(k=>Xr(k[y])))];if(h.length===0){let k=s(y,"unavailable");k.invocation_count+=1,typeof p.duration_ms=="number"&&(k.total_duration=(k.total_duration??0)+p.duration_ms),typeof p.source_event_count=="number"&&(k.source_event_count=(k.source_event_count??0)+p.source_event_count),l(k,"total_tokens",p.total_tokens),l(k,"total_cost_usd",p.cost_usd),l(k,"total_cost_brl",p.cost_brl)}for(let k of f){let S=s(y,Xr(k[y]));l(S,"total_tokens",k.total_tokens),l(S,"total_cost_usd",k.cost_usd),l(S,"total_cost_brl",k.cost_brl)}if(h.length===1){let k=s(y,h[0]);k.invocation_count+=1,typeof p.duration_ms=="number"&&(k.total_duration=(k.total_duration??0)+p.duration_ms),typeof p.source_event_count=="number"&&(k.source_event_count=(k.source_event_count??0)+p.source_event_count)}}}let d=new Map(t.map(u=>[u,new Map]));for(let[u,_]of c){let p=o.get(u)?.task_id;if(typeof p=="string")for(let y of t){let f=d.get(y),h=f.get(p)??new Set;for(let k of _){let S=Xr(k[y]),R=Xr(k.provider),g=typeof k.total_tokens=="number"||typeof k.cost_usd=="number"||typeof k.cost_brl=="number";S!==null&&R!==null&&n.has(R)&&g&&h.add(S)}f.set(p,h)}}for(let u of t)for(let _ of d.get(u).values())for(let p of _)s(u,p).task_count+=1;for(let u of i){if(typeof u.agent_invocation_id=="string"||!(typeof u.total_tokens=="number"||typeof u.cost_usd=="number"||typeof u.cost_brl=="number"))continue;let p=Xr(u.provider);if(!(p===null||!n.has(p)))for(let y of t){let f=Xr(u[y])??"unavailable",h=s(y,f);h.invocation_count+=1,typeof u.task_id=="string"&&(h.task_count+=1),typeof u.duration_ms=="number"&&(h.total_duration=(h.total_duration??0)+u.duration_ms),typeof u.source_event_count=="number"&&(h.source_event_count=(h.source_event_count??0)+u.source_event_count),l(h,"total_tokens",u.total_tokens),l(h,"total_cost_usd",u.cost_usd),l(h,"total_cost_brl",u.cost_brl)}}return Object.fromEntries(t.map(u=>[u,[...a.get(u).values()].sort((_,p)=>(p.total_cost_brl??-1)-(_.total_cost_brl??-1)||_.key.localeCompare(p.key))]))}function nK(e){return e===".agents/config/project.yaml"||e===".agents/config/framework.lock.yaml"||e===".agents/config/agents/catalog.yaml"||e===".agents/config/clients.yaml"||e.startsWith(".agents/config/pricing/")||e.startsWith(".agents/records/runs/")&&e.endsWith(".jsonl")||/^\.agents\/records\/(tasks|specs|prds)\/.*\.md$/.test(e)||/^\.agents\/records\/executions\/.*\/execution\.md$/.test(e)?!0:/^\.agents\/records\/changes\/.*\/(change\.md|decisions\/.*\.md|artifacts\/(evidence|validations)\/.*\.md)$/.test(e)}function rK(e){let t=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(e)?.[1];if(t===void 0)return null;try{let n=yt(t);return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function yC(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ut(e){return typeof e=="string"&&e.length>0?e:null}function Fh(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function iK(e){let t=[],n=[],i=[];for(let r of e){let o=rK(r.content);if(o===null)continue;let a=ut(o.id),s=ut(o.created_at);if(!(a===null||s===null||Number.isNaN(Date.parse(s)))){if(/^\.agents\/records\/executions\/.*\/execution\.md$/.test(r.path)){let l=yC(o.origin),c=ut(l?.type),d=c==="interaction"?ut(l?.conversation_id):c==="task"?ut(l?.task_id):c==="spec"?ut(l?.spec_id):c==="prd"?ut(l?.prd_id):null;t.push({id:a,status:ut(o.status),kind:ut(o.kind),originType:c,originId:d,createdAt:s,finishedAt:ut(o.finished_at),sourcePath:r.path});continue}if(/^\.agents\/records\/changes\/.*\/change\.md$/.test(r.path)){let l=yC(o.source),c=ut(l?.type),d=c==="task"?ut(l?.task_id):c==="spec"?ut(l?.spec_id):c==="prd"?ut(l?.prd_id):null;if(c===null||d===null)continue;n.push({id:a,title:ut(o.title)??a,status:ut(o.status)??"unclassified",risk:ut(o.risk)??"unclassified",sourceType:c,sourceId:d,sourceSpecId:ut(l?.spec_id),sourcePrdId:ut(l?.prd_id),requirementIds:Fh(o.requirement_ids),acceptanceIds:Fh(o.acceptance_ids),taskIds:Fh(o.task_ids),result:ut(o.result),createdAt:s,sourcePath:r.path});continue}if(/^\.agents\/records\/(changes|executions)\/.*\/decisions\/.*\.md$/.test(r.path)){let l=o.origin,c=o.scope_type,d=ut(o.scope_id);if(l!=="human"&&l!=="agent"||c!=="change"&&c!=="execution"||d===null)continue;i.push({id:a,title:ut(o.title)??a,origin:l,scopeType:c,scopeId:d,createdAt:s,sourcePath:r.path})}}}return{executions:t,changes:n,decisions:i}}function oK(e){let t=new Map;for(let n of e){let i=/^\.agents\/records\/(tasks|specs|prds|changes|executions|conversations)\//.exec(n.path);if(i===null)continue;let r=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(n.content)?.[1];if(r===void 0)continue;let o=l=>{let c=new RegExp(`^${l}:\\s*(.+?)\\s*$`,"m").exec(r)?.[1]?.trim();return c===void 0||c==="null"?null:c.replace(/^['"]|['"]$/g,"")},a=o("id");if(a===null)continue;let s=i[1]?.slice(0,-1);s!==void 0&&t.set(`${s}:${a}`,{kind:s,id:a,title:o("title"),status:o("status"),stage:o("stage"),risk:o("risk"),occurredAt:o("created_at")??o("started_at")??o("recorded_at")})}return t}function aK(e,t){let n=new Map;for(let i of(e??"").split(/^ {2}- id: /m).slice(1)){let r=i.slice(0,i.indexOf(`
350
+ `)).trim(),o=/\bcodex_name:\s*([^\s#]+)/.exec(i)?.[1]??null;if(o===null)continue;let a=/persona:\s*\{\s*nome:\s*([^,}\s]+),\s*cargo:\s*([^,}\s]+)\s*\}/.exec(i),s=/\brole:\s*([^\s#]+)/.exec(i)?.[1]??null,l={catalogId:r,persona:a?.[1]??null,job:a?.[2]??null,role:s},c=new Set([o,r]);for(let d of i.matchAll(/^ {8}- kind:\s*(?:id|codex_name|codex_task_name)\s*\r?\n {10}value:\s*([^\s#]+)/gm)){let u=d[1];u!==void 0&&c.add(u)}for(let d of[...c])d.startsWith("agent-")&&c.add(`zaip-${d}`);for(let d of c)n.set(d,l)}return/^ {2}- id:\s*codex\s*$/m.test(t??"")&&n.set("codex",{catalogId:"client:codex",persona:"codex",job:"client_host",role:"host"}),n}function sK(e){return e.prd_id!==null&&e.execution_id===null||e.spec_id!==null&&e.execution_id===null||e.phase==="planning"||e.purpose==="planning"?"planning":e.execution_id!==null||e.task_id!==null||e.phase==="execution"||e.purpose==="implementation"?"development":"conversation"}function ya(e,t){let n=e.map(i=>i.tokens[t]).filter(i=>typeof i=="number");return n.length===0?null:n.reduce((i,r)=>i+r,0)}function Ci(e){let t=[...new Set(e.filter(n=>typeof n=="string"&&n.length>0&&n!=="unavailable"))];return t.length===0?null:t.length===1?t[0]:"mixed"}function T_(e,t,n){return e==="openai"||e==="anthropic"?e:e==="unavailable"||t==="unavailable"||t===null?null:ad(t,n,"")}function cK(e){return typeof e.duration_ms=="number"&&(e.duration_provenance==="observed"||e.duration_provenance==="reconciled"||e.duration_provenance==="legacy_inferred")}function lK(e){let t=e.flatMap(r=>{let o=r.source_started_at,a=r.source_finished_at,s=typeof o=="string"?Date.parse(o):Number.NaN,l=typeof a=="string"?Date.parse(a):Number.NaN;return typeof o=="string"&&typeof a=="string"&&Number.isFinite(s)&&Number.isFinite(l)&&l>s&&l-s<=Wh?[{start:o,end:a,startMs:s,endMs:l}]:[]});if(t.length===0)return null;let n=t.reduce((r,o)=>o.startMs<r.startMs?o:r),i=t.reduce((r,o)=>o.endMs>r.endMs?o:r);return i.endMs-n.startMs<=Wh?{start:n.start,end:i.end,duration:i.endMs-n.startMs}:null}function uK(e,t){let n=lK(e);if(n!==null)return{source:n.duration,effective:n.duration,provenance:"reconciled",sourceStartedAt:n.start,sourceFinishedAt:n.end};if(typeof t.finished?.duration_ms=="number"&&t.finished.duration_provenance!=="estimated"&&t.finished.duration_provenance!=="unavailable")return{source:t.finished.duration_ms,effective:t.finished.duration_ms,provenance:t.finished.duration_provenance??"observed",sourceStartedAt:null,sourceFinishedAt:null};let i=e.filter(cK);if(i.length>0){let a=i.reduce((l,c)=>l+(c.duration_ms??0),0),s=Ci(i.map(l=>l.duration_provenance))??"observed";return{source:a,effective:a,provenance:s,sourceStartedAt:null,sourceFinishedAt:null}}let r=Date.parse(t.run.occurred_at),o=typeof t.finished?.occurred_at=="string"?Date.parse(t.finished.occurred_at):Number.NaN;return Number.isFinite(r)&&Number.isFinite(o)&&o>r&&o-r<=Wh?{source:null,effective:o-r,provenance:"reconciled",sourceStartedAt:null,sourceFinishedAt:null}:{source:null,effective:null,provenance:null,sourceStartedAt:null,sourceFinishedAt:null}}function dK(e){return e.flatMap(t=>{try{return[Hi.parse(JSON.parse(t.content))]}catch{return[]}}).sort((t,n)=>n.as_of.localeCompare(t.as_of))[0]??null}function _K(e,t,n,i){let r=0,o=0,a=!1,s=!1,l=!1,c=[],d=[];for(let _ of e){if(typeof _.cost.usd=="number"&&(r+=_.cost.usd,a=!0),typeof _.cost.brl=="number"&&(o+=_.cost.brl,s=!0),typeof _.cost.usd=="number"&&typeof _.cost.brl=="number"||_.tokens.total===null)continue;if(_.tokens.total===0){a=!0,s=!0;continue}let p=_.model??t.run.model;if(p===null||p==="unavailable")continue;let y=Ki({provider:T_(_.provider,p,t.run.client),model:p,usage:_.tokens,catalog:n,fxRate:i,serviceTier:_.runtime?.service_tier??null});typeof _.cost.usd!="number"&&y.estimated_usd!==null&&(r+=y.estimated_usd,a=!0,l=!0),typeof _.cost.brl!="number"&&y.estimated_brl!==null&&(o+=y.estimated_brl,s=!0,l=!0),y.pricing_model!==null&&c.push(y.pricing_model),y.pricing_source!==null&&d.push(y.pricing_source)}let u=ya(e,"total");return{usd:a?Math.round(r*1e6)/1e6:null,brl:s?Math.round(o*1e6)/1e6:null,method:u===0?"zero_no_llm_usage":l?"token_pricing_estimate":a||s?"canonical_recorded":null,pricingModel:Ci(c),pricingSource:Ci(d),fxRate:s?i?.rate??null:null}}function pK(e,t){if(t===null)return null;let n=t.toLowerCase(),i=r=>{let o=r.toLowerCase();if(n===o)return!0;let a=n.slice(o.length);return a.startsWith("@")||a.startsWith(":")||a.startsWith("/")||/^-\d{4}-\d{2}-\d{2}(?:$|[.:@/])/.test(a)};return e.models.find(r=>i(r.id)||r.aliases.some(o=>i(o)))??null}function fK(e,t,n,i){let r=e.model??t.run.model,o=T_(e.provider,r,t.run.client),a=e.runtime?.service_tier??null,s=pK(n,r),l=r===null?null:Ki({provider:o,model:r,usage:e.tokens,catalog:n,fxRate:i,serviceTier:a}),c=r===null?null:Ki({provider:o,model:r,usage:e.tokens,catalog:n,fxRate:i,serviceTier:"default"}),d=s?.long_context_threshold_tokens!==null&&s?.long_context_threshold_tokens!==void 0&&(e.tokens.input??0)>s.long_context_threshold_tokens,u=a==="priority"||a==="fast",_=u&&!d,p=s?_?s.priority_input_per_million_usd??null:s.input_per_million_usd:null,y=s?_?s.priority_cached_input_per_million_usd??null:s.cached_input_per_million_usd:null,f=s?_?s.priority_output_per_million_usd??null:s.output_per_million_usd:null,h=s?_?s.priority_reasoning_per_million_usd??s.priority_output_per_million_usd??null:s.reasoning_per_million_usd??s.output_per_million_usd:null,k=l?.estimated_usd!==null&&l!==null?l:c,S=k?.estimated_usd??null,R=c?.estimated_usd??null,g=e.cost.usd,b=g??S,O=e.cost.brl??l?.estimated_brl??(b!==null&&i!==null?Math.round(b*i.rate*1e6)/1e6:null);return{provider:o,model:r,serviceTier:a,uncachedInputTokens:e.tokens.input===null?null:Math.max(e.tokens.input-(e.tokens.cached_input??0),0),visibleOutputTokens:e.tokens.output===null?null:Math.max(e.tokens.output-(e.tokens.reasoning??0),0),inputRate:p,cachedRate:y,outputRate:f,reasoningRate:h,contextInputMultiplier:s?d?s.long_context_input_multiplier:1:null,contextOutputMultiplier:s?d?s.long_context_output_multiplier:1:null,speedCostMultiplier:S!==null&&R!==null&&R>0?Math.round(S/R*1e3)/1e3:null,pricingScenario:u&&d?"standard_long_context_fallback":u?"priority":"standard",standardUsd:R,speedUpliftUsd:S!==null&&R!==null?Math.round((S-R)*1e6)/1e6:null,inputUsd:k?.input_usd??null,cachedInputUsd:k?.cached_input_usd??null,outputUsd:k?.output_usd??null,reasoningUsd:k?.reasoning_usd??null,calculatedUsd:S,recordedUsd:g,effectiveUsd:b,effectiveBrl:O,varianceUsd:g!==null&&S!==null?Math.round((g-S)*1e6)/1e6:null,pricingModel:k?.pricing_model??null,pricingSource:k?.pricing_source??null,fxRate:e.cost.fx_rate??i?.rate??null}}function dn(e){let t=Object.fromEntries(new Intl.DateTimeFormat("en",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(e)).filter(n=>n.type!=="literal").map(n=>[n.type,n.value]));return`${t.year}-${t.month}-${t.day}`}function mK(e){let t=new Set;for(let r of e){t.add(r.startMs),t.add(r.endMs);for(let o=r.startMs;o<r.endMs;){let a=Date.parse(`${dn(new Date(o).toISOString())}T03:00:00.000Z`)+864e5;if(a>=r.endMs)break;t.add(a),o=a}}let n=[...t].sort((r,o)=>r-o),i=new Map;for(let r=0;r<n.length-1;r+=1){let o=n[r],a=n[r+1],s=e.filter(d=>d.startMs<a&&d.endMs>o);if(s.length===0||a<=o)continue;let l=(a-o)/s.length,c=dn(new Date(o).toISOString());for(let d of s){let u=`${d.activityRowId}:${c}`,_=i.get(u);i.set(u,{activityRowId:d.activityRowId,day:c,value:(_?.value??0)+l})}}return[...i.values()]}function Ht(e){return e==null?null:/^\d{4}-\d{2}-\d{2}$/.test(e)?e:dn(e)}function gK(e,t){let n=e.includes("/artifacts/evidence/")?"evidence":e.includes("/artifacts/validations/")?"validation":null;if(n===null)return null;let i=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t)?.[1]??"",r=a=>{let s=new RegExp(`^${a}:\\s*['"]?(.+?)['"]?\\s*$`,"m").exec(i)?.[1]?.trim();return s===void 0||s==="null"?null:s},o=r("observed_at")??r("executed_at")??r("created_at")??r("recorded_at");return o===null||Number.isNaN(Date.parse(o))?null:{kind:n,id:r("id")??e.slice(e.lastIndexOf("/")+1,-3),occurredAt:o,occurredDaySp:dn(o)}}function Zh(e){return(0,st.resolve)(process.env.ZAIP_SQLITE_DB_PATH??(0,st.resolve)(e,bC))}function oc(e){let t=new $i.DatabaseSync(e,{readOnly:!0});try{let n=t.prepare("PRAGMA integrity_check").get();if(n.integrity_check!=="ok")throw new Error(`SQLite integrity check failed for ${e}: ${n.integrity_check??"unknown"}`);let i=t.prepare("SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view', 'index')").all(),r=i.filter(u=>u.type==="table").map(u=>u.name).sort(),o=[...XJ].sort();if(r.length!==o.length||r.some((u,_)=>u!==o[_]))throw new Error(`SQLite schema ${fo} requires exactly five persisted tables; found ${r.join(", ")||"none"}`);let a=new Set(i.map(u=>u.name)),s=QJ.filter(u=>!a.has(u));if(s.length>0)throw new Error(`SQLite schema is missing required views: ${s.join(", ")}`);let l=i.filter(u=>u.type==="view").map(u=>u.name);if(l.some(u=>!u.startsWith("zaip_vw_")))throw new Error("SQLite persisted views must use the zaip_vw_ namespace");let c=YJ.filter(u=>!a.has(u));if(c.length>0)throw new Error(`SQLite schema is missing required indexes: ${c.join(", ")}`);let d=t.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("schema_version")?.value;if(d!==fo)throw new Error(`SQLite schema version must be ${fo}; found ${d??"missing"}`);return{schemaVersion:d,tableCount:r.length,viewCount:l.length,indexCount:i.filter(u=>u.type==="index"&&!u.name.startsWith("sqlite_")).length}}finally{t.close()}}async function ac(e){let t=Zh(e),n=performance.now(),i=await bK(e),r=(g,b,O)=>{process.env.ZAIP_DASHBOARD_LAUNCH_PROGRESS==="1"&&process.stderr.write(`${JSON.stringify({event:"dashboard_sqlite_rebuild_progress",phase:g,percent:b,detail:O})}
351
+ `)},{fingerprint:o}=i,a=Math.round(performance.now()-n),s=qh(t,o);if(s!==null)return oc(t),{files:s,path:t,cache:"generation",fingerprint_ms:a,materialize_ms:0};let l=(0,st.join)(process.env.ZAIP_SQLITE_CACHE_DIR??(0,st.join)((0,st.dirname)(t),"cache"),`v${fo}-${(0,bn.createHash)("sha256").update(o).digest("hex")}.sqlite`),c=qh(l,o);if(c!==null){let g=performance.now();return await Vh(l,t),oc(t),{files:c,path:t,cache:"seed",fingerprint_ms:a,materialize_ms:Math.round(performance.now()-g)}}if(process.env.ZAIP_SQLITE_PREFER_LAST_VALID_SEED==="1"){let g=await yK((0,st.dirname)(l));if(g!==null){let b=performance.now();return await Vh(g.path,t),{files:g.files,path:t,cache:"stale_seed",fingerprint_ms:a,materialize_ms:Math.round(performance.now()-b)}}}r("source_inventory",52,`Encontradas ${i.candidates.length} fontes can\xF4nicas.`),await(0,et.mkdir)((0,st.dirname)(l),{recursive:!0});let d=`${l}.${process.pid}.${(0,bn.randomUUID)()}.tmp`,u=new $i.DatabaseSync(d),_=0;try{u.exec("PRAGMA journal_mode=DELETE; BEGIN IMMEDIATE;");try{u.exec(`
352
+ CREATE TEMP TABLE files (path TEXT PRIMARY KEY, content TEXT NOT NULL, mtime_ms INTEGER NOT NULL, size_bytes INTEGER NOT NULL, content_sha256 TEXT NOT NULL, artifact_kind TEXT, artifact_id TEXT, artifact_occurred_at TEXT, artifact_occurred_day_sp TEXT);
353
+ CREATE TEMP TABLE read_model_source_state (source_path TEXT PRIMARY KEY, source_hash TEXT NOT NULL, mtime_ms INTEGER NOT NULL, size_bytes INTEGER NOT NULL, source_kind TEXT NOT NULL, last_processed_at TEXT NOT NULL);
354
+ CREATE TEMP TABLE read_model_metadata (key TEXT PRIMARY KEY, value TEXT NOT NULL);
355
+ CREATE TEMP TABLE canonical_work_items (entity_kind TEXT NOT NULL, id TEXT NOT NULL, title TEXT, status TEXT, stage TEXT, risk TEXT, occurred_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, PRIMARY KEY(entity_kind, id));
356
+ CREATE TEMP TABLE canonical_executions (id TEXT PRIMARY KEY, status TEXT, kind TEXT, origin_type TEXT, origin_id TEXT, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, finished_at TEXT, source_path TEXT NOT NULL);
357
+ CREATE TEMP TABLE canonical_changes (id TEXT PRIMARY KEY, title TEXT NOT NULL, status TEXT NOT NULL, risk TEXT NOT NULL, source_type TEXT NOT NULL, source_id TEXT NOT NULL, source_spec_id TEXT, source_prd_id TEXT, requirement_ids_json TEXT NOT NULL, acceptance_ids_json TEXT NOT NULL, task_ids_json TEXT NOT NULL, result TEXT, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, source_path TEXT NOT NULL);
358
+ CREATE TEMP TABLE canonical_decisions (id TEXT PRIMARY KEY, title TEXT NOT NULL, origin TEXT NOT NULL, scope_type TEXT NOT NULL, scope_id TEXT NOT NULL, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, source_path TEXT NOT NULL);
359
+ CREATE TEMP TABLE canonical_run_index (run_id TEXT PRIMARY KEY, occurred_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, task_id TEXT, phase TEXT, run_role TEXT NOT NULL, duration_ms REAL, source_event_count INTEGER NOT NULL, zaip_agent TEXT, provider TEXT, model TEXT, status TEXT);
360
+ CREATE TEMP TABLE invocation_usage_segments (
361
+ agent_invocation_id TEXT NOT NULL, provider TEXT, model TEXT, service_tier TEXT, reasoning_effort TEXT,
362
+ input_tokens REAL, cached_input_tokens REAL, uncached_input_tokens REAL,
363
+ output_tokens REAL, reasoning_tokens REAL, visible_output_tokens REAL, total_tokens REAL,
364
+ input_rate_usd_per_million REAL, cached_input_rate_usd_per_million REAL,
365
+ output_rate_usd_per_million REAL, reasoning_rate_usd_per_million REAL,
366
+ context_input_multiplier REAL, context_output_multiplier REAL, speed_cost_multiplier REAL, pricing_scenario TEXT,
367
+ standard_cost_usd REAL, speed_uplift_usd REAL,
368
+ input_cost_usd REAL, cached_input_cost_usd REAL, output_cost_usd REAL, reasoning_cost_usd REAL,
369
+ calculated_cost_usd REAL, recorded_cost_usd REAL, cost_variance_usd REAL,
370
+ cost_usd REAL, cost_brl REAL, cost_method TEXT, pricing_model TEXT, pricing_source TEXT, fx_rate REAL
371
+ );
372
+ CREATE TABLE zaip_aios_activities (
373
+ activity_row_id TEXT PRIMARY KEY, activity_source_kind TEXT NOT NULL, activity_key TEXT NOT NULL,
374
+ source_path TEXT NOT NULL, source_hash TEXT NOT NULL, source_occurred_at TEXT, recorded_at TEXT NOT NULL, version_activity_id TEXT,
375
+ source_last_event_id TEXT, source_last_sequence INTEGER,
376
+ work_item_kind TEXT, title TEXT, work_item_status TEXT, work_stage TEXT, risk TEXT,
377
+ run_role TEXT NOT NULL, root_run_id TEXT NOT NULL, parent_run_id TEXT,
378
+ agent_run_id TEXT, root_agent_run_id TEXT, parent_agent_run_id TEXT, agent_run_role TEXT, delegation_depth INTEGER,
379
+ agent_invocation_id TEXT, root_agent_invocation_id TEXT, parent_agent_invocation_id TEXT, invocation_kind TEXT,
380
+ execution_id TEXT, task_id TEXT, spec_id TEXT, prd_id TEXT, change_id TEXT, conversation_id TEXT, run_id TEXT,
381
+ occurred_at TEXT, occurred_day_sp TEXT, execution_kind TEXT, entrypoint TEXT, work_type TEXT, phase TEXT, purpose TEXT, status TEXT, activity_kind TEXT,
382
+ zaip_agent TEXT, zaip_agent_persona TEXT, zaip_agent_job TEXT, zaip_agent_role TEXT, agent_catalog_id TEXT, agent_catalog_hash TEXT,
383
+ client TEXT, provider TEXT, model TEXT, service_tier TEXT, reasoning_effort TEXT,
384
+ source_duration_ms REAL, source_started_at TEXT, source_finished_at TEXT, duration_ms REAL, duration_provenance TEXT, input_tokens REAL, cached_input_tokens REAL, output_tokens REAL, reasoning_tokens REAL, total_tokens REAL, token_source TEXT, usage_event_count INTEGER, llm_call_count INTEGER,
385
+ cost_usd REAL, cost_brl REAL, cost_method TEXT, pricing_model TEXT, pricing_source TEXT, fx_rate REAL, source_event_count INTEGER,
386
+ root_run_duration REAL, sub_run_duration REAL,
387
+ payload_type TEXT, payload_json TEXT
388
+ );`),u.exec(`
389
+ CREATE TABLE zaip_dim_zaip_agent (
390
+ zaip_agent TEXT PRIMARY KEY, catalog_id TEXT, persona TEXT, job TEXT, role TEXT, catalog_hash TEXT
391
+ );
392
+ CREATE TABLE zaip_dim_llm_model (
393
+ model TEXT PRIMARY KEY
394
+ );
395
+ CREATE TABLE zaip_dim_provider (
396
+ provider TEXT PRIMARY KEY
397
+ );
398
+ `),u.exec(`CREATE TEMP TABLE attributed_token_active_facts (
399
+ activity_row_id TEXT NOT NULL,
400
+ occurred_day_sp TEXT NOT NULL,
401
+ attributed_token_active_ms REAL NOT NULL,
402
+ PRIMARY KEY(activity_row_id, occurred_day_sp)
403
+ );`);let g=u.prepare("INSERT INTO files(path, content, mtime_ms, size_bytes, content_sha256, artifact_kind, artifact_id, artifact_occurred_at, artifact_occurred_day_sp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"),b=u.prepare("INSERT INTO read_model_source_state(source_path, source_hash, mtime_ms, size_bytes, source_kind, last_processed_at) VALUES (?, ?, ?, ?, ?, ?)"),O=0,P=0,C=32;for(let K=0;K<i.candidates.length;K+=C){let we=i.candidates.slice(K,K+C),se=await Promise.all(we.map(qt=>(0,et.readFile)(qt.path,"utf8")));for(let qt=0;qt<we.length;qt+=1){let yo=we[qt],Or=se[qt];if(yo===void 0||Or===void 0)continue;let{source:Rr,mtimeMs:vo,size:At}=yo,Cr=(0,bn.createHash)("sha256").update(Or).digest("hex"),_c=Rr.includes("/runs/")?"run":Rr.includes("/artifacts/evidence/")?"evidence":Rr.includes("/artifacts/validations/")?"validation":Rr.startsWith(".agents/config/")?"config":"entity",Yr=gK(Rr,Or);g.run(Rr,Or,vo,At,Cr,Yr?.kind??null,Yr?.id??null,Yr?.occurredAt??null,Yr?.occurredDaySp??null),b.run(Rr,Cr,vo,At,_c,new Date().toISOString()),O+=1}let ft=52+Math.round((K+we.length)/i.candidates.length*20);r("source_import",ft,`Lidas ${Math.min(K+we.length,i.candidates.length)} de ${i.candidates.length} fontes.`)}r("projection_build",74,"Organizando fatos e proje\xE7\xF5es do banco local.");let v=oK(u.prepare("SELECT path, content FROM files WHERE path LIKE '.agents/records/%'").all()),A=u.prepare("INSERT INTO canonical_work_items(entity_kind, id, title, status, stage, risk, occurred_at, occurred_day_sp) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");for(let K of v.values())K.kind!=="task"&&K.kind!=="spec"&&K.kind!=="prd"||K.occurredAt===null||Number.isNaN(Date.parse(K.occurredAt))||A.run(K.kind,K.id,K.title,K.status,K.stage,K.risk,K.occurredAt,dn(K.occurredAt));let x=iK(u.prepare("SELECT path, content FROM files WHERE path LIKE '.agents/records/%'").all()),T=u.prepare("INSERT INTO canonical_executions(id, status, kind, origin_type, origin_id, created_at, occurred_day_sp, finished_at, source_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");for(let K of x.executions)T.run(K.id,K.status,K.kind,K.originType,K.originId,K.createdAt,dn(K.createdAt),K.finishedAt,K.sourcePath);let N=u.prepare("INSERT INTO canonical_changes(id, title, status, risk, source_type, source_id, source_spec_id, source_prd_id, requirement_ids_json, acceptance_ids_json, task_ids_json, result, created_at, occurred_day_sp, source_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");for(let K of x.changes)N.run(K.id,K.title,K.status,K.risk,K.sourceType,K.sourceId,K.sourceSpecId,K.sourcePrdId,JSON.stringify(K.requirementIds),JSON.stringify(K.acceptanceIds),JSON.stringify(K.taskIds),K.result,K.createdAt,dn(K.createdAt),K.sourcePath);let H=u.prepare("INSERT INTO canonical_decisions(id, title, origin, scope_type, scope_id, created_at, occurred_day_sp, source_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");for(let K of x.decisions)H.run(K.id,K.title,K.origin,K.scopeType,K.scopeId,K.createdAt,dn(K.createdAt),K.sourcePath);let ie=u.prepare("SELECT content FROM files WHERE path = ?").get(".agents/config/agents/catalog.yaml")?.content,oe=u.prepare("SELECT content FROM files WHERE path = ?").get(".agents/config/clients.yaml")?.content,be=aK(ie,oe),z=ie===void 0?null:(0,bn.createHash)("sha256").update(ie).digest("hex"),ye=u.prepare("SELECT content FROM files WHERE path = ?").get(".agents/config/pricing/models.json")?.content,B=Ji.parse(JSON.parse(ye??'{"schema_version":1,"updated_at":"1970-01-01T00:00:00.000Z","source":"missing","disclaimer":"missing","models":[]}')),he=dK(u.prepare("SELECT path, content FROM files WHERE path LIKE '.agents/config/pricing/fx/%.json'").all()),Ke=u.prepare("SELECT path, content, content_sha256 FROM files WHERE path LIKE '.agents/records/runs/%.jsonl' ORDER BY path").all(),Fe=new Map(Ke.map(K=>{let we=xs(Ts(K.content));return[we.run.run_id,{row:K,fold:we}]})),Ae=K=>{let we=K,se=new Set;for(;we.run.parent_run_id!==null&&!se.has(we.run.run_id);){se.add(we.run.run_id);let ft=Fe.get(we.run.parent_run_id)?.fold;if(ft===void 0)break;we=ft}return we.run.run_id},W=["activity_row_id","activity_source_kind","activity_key","source_path","source_hash","source_occurred_at","recorded_at","version_activity_id","source_last_event_id","source_last_sequence","work_item_kind","title","work_item_status","work_stage","risk","run_role","root_run_id","parent_run_id","agent_run_id","root_agent_run_id","parent_agent_run_id","agent_run_role","delegation_depth","agent_invocation_id","root_agent_invocation_id","parent_agent_invocation_id","invocation_kind","execution_id","task_id","spec_id","prd_id","change_id","conversation_id","run_id","occurred_at","occurred_day_sp","execution_kind","entrypoint","work_type","phase","purpose","status","activity_kind","zaip_agent","zaip_agent_persona","zaip_agent_job","zaip_agent_role","agent_catalog_id","agent_catalog_hash","client","provider","model","service_tier","reasoning_effort","source_duration_ms","source_started_at","source_finished_at","duration_ms","duration_provenance","input_tokens","cached_input_tokens","output_tokens","reasoning_tokens","total_tokens","token_source","usage_event_count","llm_call_count","cost_usd","cost_brl","cost_method","pricing_model","pricing_source","fx_rate","source_event_count","root_run_duration","sub_run_duration","payload_type","payload_json"],ce=u.prepare(`INSERT INTO zaip_aios_activities(${W.join(",")}) VALUES (${W.map(()=>"?").join(",")})`),fe=u.prepare("INSERT INTO attributed_token_active_facts(activity_row_id, occurred_day_sp, attributed_token_active_ms) VALUES (?, ?, ?)"),Re=u.prepare("INSERT INTO invocation_usage_segments VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),Ue=u.prepare("INSERT INTO canonical_run_index(run_id, occurred_at, occurred_day_sp, task_id, phase, run_role, duration_ms, source_event_count, zaip_agent, provider, model, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),pt=0,Et=0,Pt=[];for(let{row:K,fold:we}of Fe.values()){let se=we.run,ft=we.effective_usage_records,qt=se.agent_invocation_id??null,yo=qt!==null,Or=se.parent_run_id===null?"root":"subrun",Rr=yo?se.parent_agent_invocation_id===null?"root":"subagent":null,vo=ya(ft,"total"),At=uK(ft,we),Cr=_K(ft,we,B,he),_c=ft.filter(Ce=>typeof Ce.tokens.total=="number"||typeof Ce.cost.usd=="number"||typeof Ce.cost.brl=="number"),Yr=Ci(_c.map(Ce=>Ce.model??se.model))??(se.model==="unavailable"?null:se.model),Yh=Ci(_c.map(Ce=>T_(Ce.provider,Ce.model??se.model,se.client)))??T_(se.provider,Yr,se.client),$_=se.agent_name??se.agent;if(Ue.run(se.run_id,se.occurred_at,dn(se.occurred_at),se.task_id,se.phase,Or,At.effective,we.records.length,$_,Yh,Yr,we.status),vo===null){Et+=1;continue}let pc=be.get($_)??be.get(se.agent),ba=se.task_id===null?se.spec_id===null?se.prd_id===null?null:v.get(`prd:${se.prd_id}`):v.get(`spec:${se.spec_id}`):v.get(`task:${se.task_id}`),Qh=new Set([...we.model_call_records.map(Ce=>Ce.call_id),...ft.map(Ce=>Ce.model_call_id).filter(Ce=>typeof Ce=="string")]),I_=we.records.at(-1),N_=`ACTV-${(0,bn.createHash)("sha256").update(`run:${se.run_id}`).digest("hex").slice(0,24)}`,LC={activity_row_id:N_,activity_source_kind:yo?"agent_run":"unassisted_turn",activity_key:`run:${se.run_id}`,source_path:K.path,source_hash:K.content_sha256,source_occurred_at:ft.map(Ce=>Ce.source_occurred_at).filter(Ce=>typeof Ce=="string").sort()[0]??se.occurred_at,recorded_at:I_.occurred_at,version_activity_id:null,source_last_event_id:I_.event_id,source_last_sequence:I_.sequence,work_item_kind:ba?.kind??null,title:ba?.title??null,work_item_status:ba?.status??null,work_stage:ba?.stage??null,risk:ba?.risk??null,run_role:Or,root_run_id:Ae(we),parent_run_id:se.parent_run_id,agent_run_id:qt,root_agent_run_id:se.root_agent_invocation_id??qt,parent_agent_run_id:se.parent_agent_invocation_id??null,agent_run_role:Rr,delegation_depth:se.delegation_depth??null,agent_invocation_id:qt,root_agent_invocation_id:se.root_agent_invocation_id??qt,parent_agent_invocation_id:se.parent_agent_invocation_id??null,invocation_kind:se.invocation_kind??null,execution_id:se.execution_id,task_id:se.task_id,spec_id:se.spec_id,prd_id:se.prd_id,change_id:se.change_id,conversation_id:se.conversation_id,run_id:se.run_id,occurred_at:se.occurred_at,occurred_day_sp:dn(se.occurred_at),execution_kind:se.execution_kind??null,entrypoint:se.entrypoint,work_type:se.work_type,phase:se.phase,purpose:se.run_purpose??null,status:we.status,activity_kind:sK({execution_id:se.execution_id,task_id:se.task_id,spec_id:se.spec_id,prd_id:se.prd_id,phase:se.phase,purpose:se.run_purpose??null}),zaip_agent:$_,zaip_agent_persona:pc?.persona??null,zaip_agent_job:pc?.job??null,zaip_agent_role:pc?.role??null,agent_catalog_id:pc?.catalogId??null,agent_catalog_hash:z,client:se.client,provider:Yh,model:Yr,service_tier:Ci(ft.map(Ce=>Ce.runtime?.service_tier??null)),reasoning_effort:Ci(ft.map(Ce=>Ce.runtime?.reasoning_effort??null))??se.reasoning_effort??null,source_duration_ms:At.source,source_started_at:At.sourceStartedAt,source_finished_at:At.sourceFinishedAt,duration_ms:At.effective,duration_provenance:At.provenance,input_tokens:ya(ft,"input"),cached_input_tokens:ya(ft,"cached_input"),output_tokens:ya(ft,"output"),reasoning_tokens:ya(ft,"reasoning"),total_tokens:vo,token_source:Ci(ft.map(Ce=>Ce.tokens.source)),usage_event_count:ft.length,llm_call_count:Qh.size>0?Qh.size:null,cost_usd:Cr.usd,cost_brl:Cr.brl,cost_method:Cr.method,pricing_model:Cr.pricingModel,pricing_source:Cr.pricingSource,fx_rate:Cr.fxRate,source_event_count:we.records.length,root_run_duration:Or==="root"?At.effective:null,sub_run_duration:Or==="subrun"?At.effective:null,payload_type:null,payload_json:null};if(ce.run(...W.map(Ce=>LC[Ce]??null)),vo>0&&At.effective!==null&&At.effective>=0){let Ce=Date.parse(At.sourceStartedAt??se.occurred_at),$r=Date.parse(At.sourceFinishedAt??"")||Ce+At.effective;Number.isFinite(Ce)&&Number.isFinite($r)&&$r>Ce?Pt.push({activityRowId:N_,startMs:Ce,endMs:$r}):At.effective===0&&fe.run(N_,dn(se.occurred_at),0)}if(qt!==null)for(let Ce of ft){let $r=Ce.tokens,Ge=fK(Ce,we,B,he);Re.run(qt,Ce.provider??null,Ce.model??null,Ge.serviceTier,Ce.runtime?.reasoning_effort??null,$r.input,$r.cached_input,Ge.uncachedInputTokens,$r.output,$r.reasoning,Ge.visibleOutputTokens,$r.total,Ge.inputRate,Ge.cachedRate,Ge.outputRate,Ge.reasoningRate,Ge.contextInputMultiplier,Ge.contextOutputMultiplier,Ge.speedCostMultiplier,Ge.pricingScenario,Ge.standardUsd,Ge.speedUpliftUsd,Ge.inputUsd,Ge.cachedInputUsd,Ge.outputUsd,Ge.reasoningUsd,Ge.calculatedUsd,Ge.recordedUsd,Ge.varianceUsd,Ge.effectiveUsd,Ge.effectiveBrl,Ge.recordedUsd!==null?"canonical_recorded":"token_pricing_estimate",Ge.pricingModel,Ge.pricingSource,Ge.fxRate)}yo||(pt+=1)}for(let K of mK(Pt))fe.run(K.activityRowId,K.day,K.value);u.exec(`UPDATE zaip_aios_activities
404
+ SET duration_ms = (
405
+ SELECT SUM(f.attributed_token_active_ms)
406
+ FROM attributed_token_active_facts f
407
+ WHERE f.activity_row_id=zaip_aios_activities.activity_row_id
408
+ ),
409
+ duration_provenance = CASE
410
+ WHEN EXISTS (SELECT 1 FROM attributed_token_active_facts f WHERE f.activity_row_id=zaip_aios_activities.activity_row_id)
411
+ THEN 'attributed_token_active' ELSE NULL END;`);let go=Fe.size,ho=u.prepare("SELECT COUNT(*) AS count FROM zaip_aios_activities WHERE agent_invocation_id IS NOT NULL").get().count;u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("source_file_count",String(O)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("excluded_source_count",String(P));let lc=u.prepare("SELECT COUNT(DISTINCT occurred_day_sp) AS count FROM zaip_aios_activities WHERE occurred_day_sp IS NOT NULL").get().count,uc=u.prepare("SELECT COUNT(*) AS count FROM zaip_aios_activities").get().count,dc=u.prepare("SELECT COUNT(*) AS count FROM zaip_aios_activities WHERE activity_source_kind = 'agent_run'").get().count;u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("daily_aggregate_count",String(lc)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("activity_count",String(uc)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("canonical_run_count",String(go)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("excluded_unknown_token_run_count",String(Et)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("agent_run_count",String(dc)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("telemetry_summary_count","0"),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("unassisted_activity_count",String(pt)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("unassisted_turn_count",String(pt)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("agent_invocation_count",String(ho)),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("schema_version",fo),u.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("source_fingerprint",o);let F=u.prepare("INSERT OR IGNORE INTO zaip_dim_llm_model(model) VALUES (?)"),Ye=u.prepare("INSERT OR IGNORE INTO zaip_dim_provider(provider) VALUES (?)");for(let K of B.models)F.run(K.id),Ye.run(K.provider);let $C=tK(u),Sn=(K,we)=>u.exec(`INSERT INTO zaip_aios_activities(
412
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
413
+ recorded_at, run_role, root_run_id, payload_type, payload_json
414
+ ) SELECT
415
+ 'TECH-' || lower(hex(randomblob(16))), 'technical_payload', '${K}:' || row_key,
416
+ 'sqlite://${K}', '', datetime('now'), 'technical', 'technical', '${K}', payload_json
417
+ FROM (${we});`);Sn("metadata","SELECT key AS row_key, json_object('key', key, 'value', value) AS payload_json FROM read_model_metadata"),Sn("source_state","SELECT source_path AS row_key, json_object('source_path', source_path, 'source_hash', source_hash, 'mtime_ms', mtime_ms, 'size_bytes', size_bytes, 'source_kind', source_kind, 'last_processed_at', last_processed_at) AS payload_json FROM read_model_source_state"),Sn("file","SELECT path AS row_key, json_object('path', path, 'content', content, 'mtime_ms', mtime_ms, 'size_bytes', size_bytes, 'content_sha256', content_sha256, 'artifact_kind', artifact_kind, 'artifact_id', artifact_id, 'artifact_occurred_at', artifact_occurred_at, 'artifact_occurred_day_sp', artifact_occurred_day_sp) AS payload_json FROM files"),Sn("work_item","SELECT entity_kind || ':' || id AS row_key, json_object('entity_kind', entity_kind, 'id', id, 'title', title, 'status', status, 'stage', stage, 'risk', risk, 'occurred_at', occurred_at, 'occurred_day_sp', occurred_day_sp) AS payload_json FROM canonical_work_items"),Sn("execution","SELECT id AS row_key, json_object('id', id, 'status', status, 'kind', kind, 'origin_type', origin_type, 'origin_id', origin_id, 'created_at', created_at, 'occurred_day_sp', occurred_day_sp, 'finished_at', finished_at, 'source_path', source_path) AS payload_json FROM canonical_executions"),Sn("change","SELECT id AS row_key, json_object('id', id, 'title', title, 'status', status, 'risk', risk, 'source_type', source_type, 'source_id', source_id, 'source_spec_id', source_spec_id, 'source_prd_id', source_prd_id, 'requirement_ids_json', requirement_ids_json, 'acceptance_ids_json', acceptance_ids_json, 'task_ids_json', task_ids_json, 'result', result, 'created_at', created_at, 'occurred_day_sp', occurred_day_sp, 'source_path', source_path) AS payload_json FROM canonical_changes"),Sn("decision","SELECT id AS row_key, json_object('id', id, 'title', title, 'origin', origin, 'scope_type', scope_type, 'scope_id', scope_id, 'created_at', created_at, 'occurred_day_sp', occurred_day_sp, 'source_path', source_path) AS payload_json FROM canonical_decisions"),Sn("run_index","SELECT run_id AS row_key, json_object('run_id', run_id, 'occurred_at', occurred_at, 'occurred_day_sp', occurred_day_sp, 'task_id', task_id, 'phase', phase, 'run_role', run_role, 'duration_ms', duration_ms, 'source_event_count', source_event_count, 'zaip_agent', zaip_agent, 'provider', provider, 'model', model, 'status', status) AS payload_json FROM canonical_run_index"),Sn("usage_segment","SELECT agent_invocation_id || ':' || rowid AS row_key, json_object('agent_invocation_id', agent_invocation_id, 'provider', provider, 'model', model, 'service_tier', service_tier, 'reasoning_effort', reasoning_effort, 'input_tokens', input_tokens, 'cached_input_tokens', cached_input_tokens, 'uncached_input_tokens', uncached_input_tokens, 'output_tokens', output_tokens, 'reasoning_tokens', reasoning_tokens, 'visible_output_tokens', visible_output_tokens, 'total_tokens', total_tokens, 'input_rate_usd_per_million', input_rate_usd_per_million, 'cached_input_rate_usd_per_million', cached_input_rate_usd_per_million, 'output_rate_usd_per_million', output_rate_usd_per_million, 'reasoning_rate_usd_per_million', reasoning_rate_usd_per_million, 'context_input_multiplier', context_input_multiplier, 'context_output_multiplier', context_output_multiplier, 'speed_cost_multiplier', speed_cost_multiplier, 'pricing_scenario', pricing_scenario, 'standard_cost_usd', standard_cost_usd, 'speed_uplift_usd', speed_uplift_usd, 'input_cost_usd', input_cost_usd, 'cached_input_cost_usd', cached_input_cost_usd, 'output_cost_usd', output_cost_usd, 'reasoning_cost_usd', reasoning_cost_usd, 'calculated_cost_usd', calculated_cost_usd, 'recorded_cost_usd', recorded_cost_usd, 'cost_variance_usd', cost_variance_usd, 'cost_usd', cost_usd, 'cost_brl', cost_brl, 'cost_method', cost_method, 'pricing_model', pricing_model, 'pricing_source', pricing_source, 'fx_rate', fx_rate) AS payload_json FROM invocation_usage_segments"),Sn("duration_allocation","SELECT activity_row_id || ':' || occurred_day_sp AS row_key, json_object('activity_row_id', activity_row_id, 'occurred_day_sp', occurred_day_sp, 'attributed_token_active_ms', attributed_token_active_ms) AS payload_json FROM attributed_token_active_facts");let IC=u.prepare("INSERT OR IGNORE INTO zaip_dim_zaip_agent(zaip_agent, catalog_id, persona, job, role, catalog_hash) VALUES (?, ?, ?, ?, ?, ?)");for(let[K,we]of be)IC.run(K,we.catalogId,we.persona,we.job,we.role,z);let NC=u.prepare(`INSERT INTO zaip_aios_activities(
418
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
419
+ recorded_at, run_role, root_run_id, payload_type, payload_json
420
+ ) VALUES (?, 'technical_payload', ?, ?, '', datetime('now'), 'technical', 'technical', 'cost_dimension_aggregate_v1', ?)`);for(let K of["model","provider"])for(let we of $C[K])NC.run(`TECH-${(0,bn.randomUUID)().toLowerCase()}`,`cost_dimension_aggregate_v1:${K}:${we.key}`,`sqlite://cost_dimension_aggregate_v1/${K}`,JSON.stringify({schema_version:1,dimension:K,...we}));let Gh=`
421
+ CREATE INDEX zaip_activities_agent_run ON zaip_aios_activities(activity_source_kind, agent_run_id, occurred_day_sp, occurred_at DESC);
422
+ CREATE INDEX zaip_activities_relationships ON zaip_aios_activities(task_id, spec_id, prd_id, execution_id, conversation_id);
423
+ CREATE INDEX zaip_activities_task_day ON zaip_aios_activities(payload_type, task_id, occurred_day_sp) WHERE task_id IS NOT NULL;
424
+ CREATE INDEX zaip_activities_spec_day ON zaip_aios_activities(payload_type, spec_id, occurred_day_sp) WHERE spec_id IS NOT NULL;
425
+ CREATE INDEX zaip_activities_prd_day ON zaip_aios_activities(payload_type, prd_id, occurred_day_sp) WHERE prd_id IS NOT NULL;
426
+ CREATE INDEX zaip_activities_agent ON zaip_aios_activities(zaip_agent, zaip_agent_persona, zaip_agent_job, provider, model);
427
+ CREATE UNIQUE INDEX zaip_activities_run_id ON zaip_aios_activities(run_id);
428
+ CREATE INDEX zaip_activities_run_hierarchy ON zaip_aios_activities(root_run_id, parent_run_id, run_role);
429
+ CREATE INDEX zaip_activities_period ON zaip_aios_activities(occurred_day_sp, occurred_at DESC);
430
+ -- Dimension residuals first restrict the visible period, then group
431
+ -- usage by invocation. This composite index avoids a temporary
432
+ -- grouping B-tree on Models/Providers filtered reads.
433
+ CREATE INDEX zaip_activities_period_invocation ON zaip_aios_activities(occurred_day_sp, agent_invocation_id)
434
+ WHERE agent_invocation_id IS NOT NULL;
435
+ CREATE INDEX zaip_activities_status ON zaip_aios_activities(activity_source_kind, status, phase);
436
+ CREATE INDEX zaip_activities_payload ON zaip_aios_activities(payload_type, activity_key);
437
+ CREATE VIEW files AS SELECT json_extract(payload_json, '$.path') AS path, json_extract(payload_json, '$.content') AS content, json_extract(payload_json, '$.mtime_ms') AS mtime_ms, json_extract(payload_json, '$.size_bytes') AS size_bytes, json_extract(payload_json, '$.content_sha256') AS content_sha256, json_extract(payload_json, '$.artifact_kind') AS artifact_kind, json_extract(payload_json, '$.artifact_id') AS artifact_id, json_extract(payload_json, '$.artifact_occurred_at') AS artifact_occurred_at, json_extract(payload_json, '$.artifact_occurred_day_sp') AS artifact_occurred_day_sp FROM zaip_aios_activities WHERE payload_type='file';
438
+ CREATE VIEW read_model_source_state AS SELECT json_extract(payload_json, '$.source_path') AS source_path, json_extract(payload_json, '$.source_hash') AS source_hash, json_extract(payload_json, '$.mtime_ms') AS mtime_ms, json_extract(payload_json, '$.size_bytes') AS size_bytes, json_extract(payload_json, '$.source_kind') AS source_kind, json_extract(payload_json, '$.last_processed_at') AS last_processed_at FROM zaip_aios_activities WHERE payload_type='source_state';
439
+ CREATE VIEW read_model_metadata AS SELECT json_extract(payload_json, '$.key') AS key, json_extract(payload_json, '$.value') AS value FROM zaip_aios_activities WHERE payload_type='metadata';
440
+ CREATE VIEW canonical_work_items AS SELECT json_extract(payload_json, '$.entity_kind') AS entity_kind, json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.title') AS title, json_extract(payload_json, '$.status') AS status, json_extract(payload_json, '$.stage') AS stage, json_extract(payload_json, '$.risk') AS risk, json_extract(payload_json, '$.occurred_at') AS occurred_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp FROM zaip_aios_activities WHERE payload_type='work_item';
441
+ CREATE VIEW canonical_executions AS SELECT json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.status') AS status, json_extract(payload_json, '$.kind') AS kind, json_extract(payload_json, '$.origin_type') AS origin_type, json_extract(payload_json, '$.origin_id') AS origin_id, json_extract(payload_json, '$.created_at') AS created_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.finished_at') AS finished_at, json_extract(payload_json, '$.source_path') AS source_path FROM zaip_aios_activities WHERE payload_type='execution';
442
+ CREATE VIEW canonical_changes AS SELECT json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.title') AS title, json_extract(payload_json, '$.status') AS status, json_extract(payload_json, '$.risk') AS risk, json_extract(payload_json, '$.source_type') AS source_type, json_extract(payload_json, '$.source_id') AS source_id, json_extract(payload_json, '$.source_spec_id') AS source_spec_id, json_extract(payload_json, '$.source_prd_id') AS source_prd_id, json_extract(payload_json, '$.requirement_ids_json') AS requirement_ids_json, json_extract(payload_json, '$.acceptance_ids_json') AS acceptance_ids_json, json_extract(payload_json, '$.task_ids_json') AS task_ids_json, json_extract(payload_json, '$.result') AS result, json_extract(payload_json, '$.created_at') AS created_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.source_path') AS source_path FROM zaip_aios_activities WHERE payload_type='change';
443
+ CREATE VIEW canonical_decisions AS SELECT json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.title') AS title, json_extract(payload_json, '$.origin') AS origin, json_extract(payload_json, '$.scope_type') AS scope_type, json_extract(payload_json, '$.scope_id') AS scope_id, json_extract(payload_json, '$.created_at') AS created_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.source_path') AS source_path FROM zaip_aios_activities WHERE payload_type='decision';
444
+ CREATE VIEW canonical_run_index AS SELECT json_extract(payload_json, '$.run_id') AS run_id, json_extract(payload_json, '$.occurred_at') AS occurred_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.task_id') AS task_id, json_extract(payload_json, '$.phase') AS phase, json_extract(payload_json, '$.run_role') AS run_role, json_extract(payload_json, '$.duration_ms') AS duration_ms, json_extract(payload_json, '$.source_event_count') AS source_event_count, json_extract(payload_json, '$.zaip_agent') AS zaip_agent, json_extract(payload_json, '$.provider') AS provider, json_extract(payload_json, '$.model') AS model, json_extract(payload_json, '$.status') AS status FROM zaip_aios_activities WHERE payload_type='run_index';
445
+ CREATE VIEW invocation_usage_segments AS SELECT json_extract(payload_json, '$.agent_invocation_id') AS agent_invocation_id, json_extract(payload_json, '$.provider') AS provider, json_extract(payload_json, '$.model') AS model, json_extract(payload_json, '$.service_tier') AS service_tier, json_extract(payload_json, '$.reasoning_effort') AS reasoning_effort, json_extract(payload_json, '$.input_tokens') AS input_tokens, json_extract(payload_json, '$.cached_input_tokens') AS cached_input_tokens, json_extract(payload_json, '$.uncached_input_tokens') AS uncached_input_tokens, json_extract(payload_json, '$.output_tokens') AS output_tokens, json_extract(payload_json, '$.reasoning_tokens') AS reasoning_tokens, json_extract(payload_json, '$.visible_output_tokens') AS visible_output_tokens, json_extract(payload_json, '$.total_tokens') AS total_tokens, json_extract(payload_json, '$.input_rate_usd_per_million') AS input_rate_usd_per_million, json_extract(payload_json, '$.cached_input_rate_usd_per_million') AS cached_input_rate_usd_per_million, json_extract(payload_json, '$.output_rate_usd_per_million') AS output_rate_usd_per_million, json_extract(payload_json, '$.reasoning_rate_usd_per_million') AS reasoning_rate_usd_per_million, json_extract(payload_json, '$.context_input_multiplier') AS context_input_multiplier, json_extract(payload_json, '$.context_output_multiplier') AS context_output_multiplier, json_extract(payload_json, '$.speed_cost_multiplier') AS speed_cost_multiplier, json_extract(payload_json, '$.pricing_scenario') AS pricing_scenario, json_extract(payload_json, '$.standard_cost_usd') AS standard_cost_usd, json_extract(payload_json, '$.speed_uplift_usd') AS speed_uplift_usd, json_extract(payload_json, '$.input_cost_usd') AS input_cost_usd, json_extract(payload_json, '$.cached_input_cost_usd') AS cached_input_cost_usd, json_extract(payload_json, '$.output_cost_usd') AS output_cost_usd, json_extract(payload_json, '$.reasoning_cost_usd') AS reasoning_cost_usd, json_extract(payload_json, '$.calculated_cost_usd') AS calculated_cost_usd, json_extract(payload_json, '$.recorded_cost_usd') AS recorded_cost_usd, json_extract(payload_json, '$.cost_variance_usd') AS cost_variance_usd, json_extract(payload_json, '$.cost_usd') AS cost_usd, json_extract(payload_json, '$.cost_brl') AS cost_brl, json_extract(payload_json, '$.cost_method') AS cost_method, json_extract(payload_json, '$.pricing_model') AS pricing_model, json_extract(payload_json, '$.pricing_source') AS pricing_source, json_extract(payload_json, '$.fx_rate') AS fx_rate FROM zaip_aios_activities WHERE payload_type='usage_segment';
446
+ CREATE VIEW attributed_token_active_facts AS SELECT json_extract(payload_json, '$.activity_row_id') AS activity_row_id, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.attributed_token_active_ms') AS attributed_token_active_ms FROM zaip_aios_activities WHERE payload_type='duration_allocation';
447
+ CREATE VIEW canonical_artifacts AS SELECT artifact_kind, artifact_id, artifact_occurred_at AS occurred_at, artifact_occurred_day_sp AS occurred_day_sp, path AS source_path FROM files WHERE artifact_kind IS NOT NULL AND artifact_occurred_at IS NOT NULL;
448
+ CREATE VIEW activities AS
449
+ SELECT a.*, f.attributed_token_active_ms
450
+ FROM zaip_aios_activities a
451
+ LEFT JOIN (
452
+ SELECT activity_row_id, SUM(attributed_token_active_ms) AS attributed_token_active_ms
453
+ FROM attributed_token_active_facts GROUP BY activity_row_id
454
+ ) f USING(activity_row_id)
455
+ WHERE a.payload_type IS NULL;
456
+ CREATE VIEW attributed_token_active AS
457
+ SELECT f.activity_row_id, f.occurred_day_sp, f.attributed_token_active_ms,
458
+ a.run_id, a.execution_id, a.task_id, a.spec_id, a.prd_id, a.conversation_id,
459
+ a.zaip_agent, a.provider, a.model, a.phase, a.status
460
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id);
461
+ CREATE VIEW agent_runs AS SELECT * FROM activities WHERE activity_source_kind = 'agent_run';
462
+ CREATE VIEW root_runs AS SELECT * FROM activities WHERE run_role = 'root';
463
+ CREATE VIEW sub_runs AS SELECT * FROM activities WHERE run_role = 'subrun';
464
+ CREATE VIEW invocations AS SELECT activity_row_id, activity_key, version_activity_id, source_occurred_at, root_agent_run_id AS root_agent_invocation_id, parent_agent_run_id AS parent_agent_invocation_id, execution_id, task_id, spec_id, prd_id, change_id, conversation_id, run_id, occurred_at, occurred_day_sp, invocation_kind, delegation_depth, zaip_agent, zaip_agent_persona, zaip_agent_job, zaip_agent_role, client, provider, model, phase, purpose, status, source_started_at, source_finished_at, attributed_token_active_ms, attributed_token_active_ms AS duration_ms, CASE WHEN attributed_token_active_ms IS NOT NULL THEN 'observed' ELSE 'unavailable' END AS duration_provenance, CASE WHEN attributed_token_active_ms IS NOT NULL THEN 'attributed_token_active' ELSE NULL END AS duration_fact_provenance, input_tokens, cached_input_tokens, output_tokens, reasoning_tokens, total_tokens, token_source, cost_usd, cost_brl, cost_method, pricing_model, pricing_source, fx_rate, service_tier, reasoning_effort, source_event_count, usage_event_count, llm_call_count, agent_run_id AS agent_invocation_id FROM agent_runs;
465
+ CREATE VIEW invocation_usage AS SELECT agent_invocation_id, agent_invocation_id AS usage_index, provider, model, service_tier, reasoning_effort, input_tokens, cached_input_tokens, uncached_input_tokens, output_tokens, reasoning_tokens, visible_output_tokens, total_tokens, input_rate_usd_per_million, cached_input_rate_usd_per_million, output_rate_usd_per_million, reasoning_rate_usd_per_million, context_input_multiplier, context_output_multiplier, speed_cost_multiplier, pricing_scenario, standard_cost_usd, speed_uplift_usd, input_cost_usd, cached_input_cost_usd, output_cost_usd, reasoning_cost_usd, calculated_cost_usd, recorded_cost_usd, cost_variance_usd, cost_usd, cost_brl, cost_method, pricing_model, pricing_source, fx_rate FROM invocation_usage_segments;
466
+ -- Flatten the small financial dimension fact once during rebuild.
467
+ -- Models/Providers must never execute JSON extraction for each paint.
468
+ CREATE TABLE cost_invocation_dimension_facts AS
469
+ SELECT i.agent_invocation_id, date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') AS occurred_day_sp,
470
+ CASE WHEN u.model IS NULL OR trim(u.model)='' OR u.model='unavailable' THEN 'unavailable' ELSE u.model END AS model,
471
+ CASE WHEN u.provider IS NULL OR trim(u.provider)='' OR u.provider='unavailable' THEN 'unavailable' ELSE u.provider END AS provider,
472
+ u.input_tokens, u.cached_input_tokens, u.output_tokens, u.reasoning_tokens,
473
+ u.total_tokens, u.cost_usd, u.cost_brl, i.attributed_token_active_ms AS duration_ms, 0 AS residual
474
+ FROM invocations i JOIN invocation_usage u USING(agent_invocation_id)
475
+ WHERE u.total_tokens IS NOT NULL OR u.cost_usd IS NOT NULL OR u.cost_brl IS NOT NULL;
476
+ CREATE INDEX cost_dimension_facts_day_model ON cost_invocation_dimension_facts(occurred_day_sp, model);
477
+ CREATE INDEX cost_dimension_facts_day_provider ON cost_invocation_dimension_facts(occurred_day_sp, provider);
478
+ CREATE INDEX cost_dimension_facts_invocation ON cost_invocation_dimension_facts(agent_invocation_id);
479
+ INSERT INTO cost_invocation_dimension_facts
480
+ SELECT i.agent_invocation_id, date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') AS occurred_day_sp, 'unavailable', 'unavailable',
481
+ i.input_tokens-COALESCE(s.input_tokens,0), i.cached_input_tokens-COALESCE(s.cached_input_tokens,0),
482
+ i.output_tokens-COALESCE(s.output_tokens,0), i.reasoning_tokens-COALESCE(s.reasoning_tokens,0),
483
+ i.total_tokens-COALESCE(s.total_tokens,0), i.cost_usd-COALESCE(s.cost_usd,0),
484
+ i.cost_brl-COALESCE(s.cost_brl,0), i.attributed_token_active_ms, 1
485
+ FROM invocations i LEFT JOIN (
486
+ SELECT agent_invocation_id, SUM(input_tokens) input_tokens, SUM(cached_input_tokens) cached_input_tokens,
487
+ SUM(output_tokens) output_tokens, SUM(reasoning_tokens) reasoning_tokens, SUM(total_tokens) total_tokens,
488
+ SUM(cost_usd) cost_usd, SUM(cost_brl) cost_brl
489
+ FROM cost_invocation_dimension_facts GROUP BY agent_invocation_id
490
+ ) s USING(agent_invocation_id)
491
+ WHERE i.total_tokens<>COALESCE(s.total_tokens,0) OR i.cost_usd<>COALESCE(s.cost_usd,0) OR i.cost_brl<>COALESCE(s.cost_brl,0);
492
+ -- Financial activities outside Agent Invocation telemetry are still
493
+ -- factual Cost Monitor facts. Give them a stable synthetic key and
494
+ -- retain them as the explicit no-dimension population.
495
+ INSERT INTO cost_invocation_dimension_facts
496
+ SELECT 'activity:' || a.activity_row_id, a.occurred_day_sp, 'unavailable', 'unavailable',
497
+ a.input_tokens, a.cached_input_tokens, a.output_tokens, a.reasoning_tokens,
498
+ a.total_tokens, a.cost_usd, a.cost_brl, f.attributed_token_active_ms, 1
499
+ FROM zaip_aios_activities a
500
+ LEFT JOIN attributed_token_active_facts f USING(activity_row_id)
501
+ WHERE a.payload_type IS NULL AND a.activity_source_kind <> 'agent_run'
502
+ AND (a.total_tokens IS NOT NULL OR a.cost_usd IS NOT NULL OR a.cost_brl IS NOT NULL)
503
+ AND NOT EXISTS (SELECT 1 FROM cost_invocation_dimension_facts d WHERE d.agent_invocation_id='activity:' || a.activity_row_id);
504
+ CREATE VIEW work_items AS SELECT entity_kind, id, title, status, risk, occurred_at, occurred_day_sp FROM canonical_work_items UNION ALL SELECT 'task', task_id, COALESCE(MAX(title), task_id), MAX(work_item_status), MAX(risk), MIN(occurred_at), MIN(occurred_day_sp) FROM activities WHERE task_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='task' AND c.id=activities.task_id) GROUP BY task_id UNION ALL SELECT 'spec', spec_id, COALESCE(MAX(title), spec_id), MAX(work_item_status), MAX(risk), MIN(occurred_at), MIN(occurred_day_sp) FROM activities WHERE spec_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='spec' AND c.id=activities.spec_id) GROUP BY spec_id UNION ALL SELECT 'prd', prd_id, COALESCE(MAX(title), prd_id), MAX(work_item_status), MAX(risk), MIN(occurred_at), MIN(occurred_day_sp) FROM activities WHERE prd_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='prd' AND c.id=activities.prd_id) GROUP BY prd_id;
505
+ CREATE VIEW tasks AS SELECT id, title, status, risk, occurred_at, occurred_day_sp FROM work_items WHERE entity_kind = 'task';
506
+ CREATE VIEW specs AS SELECT id, title, status, risk, occurred_at, occurred_day_sp FROM work_items WHERE entity_kind = 'spec';
507
+ CREATE VIEW prds AS SELECT id, title, status, risk, occurred_at, occurred_day_sp FROM work_items WHERE entity_kind = 'prd';
508
+ CREATE VIEW executions AS
509
+ SELECT id, status, created_at AS occurred_at, occurred_day_sp FROM canonical_executions
510
+ UNION ALL
511
+ SELECT execution_id, MAX(status), MIN(occurred_at), MIN(occurred_day_sp)
512
+ FROM activities
513
+ WHERE execution_id IS NOT NULL
514
+ AND NOT EXISTS (SELECT 1 FROM canonical_executions c WHERE c.id=activities.execution_id)
515
+ GROUP BY execution_id;
516
+ CREATE VIEW conversations AS
517
+ SELECT origin_id AS id, MAX(status) AS status, MIN(created_at) AS occurred_at, MIN(occurred_day_sp) AS occurred_day_sp
518
+ FROM canonical_executions WHERE origin_type='interaction' AND origin_id IS NOT NULL GROUP BY origin_id
519
+ UNION ALL
520
+ SELECT conversation_id, MAX(status), MIN(occurred_at), MIN(occurred_day_sp)
521
+ FROM activities
522
+ WHERE conversation_id IS NOT NULL
523
+ AND NOT EXISTS (SELECT 1 FROM canonical_executions c WHERE c.origin_type='interaction' AND c.origin_id=activities.conversation_id)
524
+ GROUP BY conversation_id;
525
+ CREATE VIEW decisions AS SELECT id, title, origin, scope_type, scope_id, NULL AS status, NULL AS risk, created_at AS occurred_at, occurred_day_sp, source_path FROM canonical_decisions;
526
+ CREATE VIEW changes AS SELECT id, title, status, risk, source_type, source_id, requirement_ids_json, acceptance_ids_json, task_ids_json, result, created_at AS occurred_at, occurred_day_sp, source_path FROM canonical_changes;
527
+ CREATE VIEW dimensions AS SELECT 'zaip_agent' AS dimension, zaip_agent AS value FROM agent_runs WHERE zaip_agent IS NOT NULL UNION SELECT 'provider', provider FROM agent_runs WHERE provider IS NOT NULL UNION SELECT 'model', model FROM agent_runs WHERE model IS NOT NULL UNION SELECT 'status', status FROM zaip_aios_activities WHERE status IS NOT NULL;
528
+ CREATE VIEW daily_aggregate_cache AS
529
+ WITH RECURSIVE raw_intervals AS (
530
+ SELECT
531
+ (julianday(COALESCE(source_started_at, occurred_at)) - 2440587.5) * 86400000.0 AS start_ms,
532
+ (julianday(COALESCE(source_finished_at, occurred_at)) - 2440587.5) * 86400000.0 AS source_end_ms,
533
+ duration_ms
534
+ FROM invocations
535
+ WHERE total_tokens IS NOT NULL AND duration_ms IS NOT NULL AND duration_ms > 0
536
+ ), measurable_intervals AS (
537
+ SELECT start_ms,
538
+ CASE WHEN source_end_ms > start_ms THEN source_end_ms ELSE start_ms + duration_ms END AS end_ms
539
+ FROM raw_intervals
540
+ ), split_intervals(day, start_ms, end_ms, segment_end_ms) AS (
541
+ -- America/Sao_Paulo has used UTC-03:00 throughout the canonical
542
+ -- dashboard period. Split before unioning so a day cannot exceed
543
+ -- its local 24-hour boundary even when Runs span midnight.
544
+ SELECT date(start_ms / 1000.0, 'unixepoch', '-3 hours'), start_ms, end_ms,
545
+ MIN(end_ms, strftime('%s', date(start_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0)
546
+ FROM measurable_intervals
547
+ UNION ALL
548
+ SELECT date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours'), segment_end_ms, end_ms,
549
+ MIN(end_ms, strftime('%s', date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0)
550
+ FROM split_intervals WHERE segment_end_ms < end_ms
551
+ ), intervals AS (
552
+ SELECT day, start_ms, segment_end_ms AS end_ms FROM split_intervals
553
+ ), ordered AS (
554
+ SELECT *, MAX(end_ms) OVER (PARTITION BY day ORDER BY start_ms, end_ms ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS prior_end_ms
555
+ FROM intervals
556
+ ), grouped AS (
557
+ SELECT *, SUM(CASE WHEN prior_end_ms IS NULL OR start_ms > prior_end_ms THEN 1 ELSE 0 END)
558
+ OVER (PARTITION BY day ORDER BY start_ms, end_ms) AS interval_group
559
+ FROM ordered
560
+ ), merged AS (
561
+ SELECT day, interval_group, MIN(start_ms) AS start_ms, MAX(end_ms) AS end_ms
562
+ FROM grouped GROUP BY day, interval_group
563
+ ), operations_daily_duration AS (
564
+ SELECT occurred_day_sp AS day, SUM(attributed_token_active_ms) AS total_duration
565
+ FROM attributed_token_active_facts GROUP BY occurred_day_sp
566
+ ), work_item_days AS (
567
+ SELECT entity_kind AS kind, id, occurred_day_sp AS day FROM canonical_work_items
568
+ UNION ALL SELECT 'task', task_id, MIN(occurred_day_sp) FROM activities WHERE task_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='task' AND c.id=activities.task_id) GROUP BY task_id
569
+ UNION ALL SELECT 'spec', spec_id, MIN(occurred_day_sp) FROM activities WHERE spec_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='spec' AND c.id=activities.spec_id) GROUP BY spec_id
570
+ UNION ALL SELECT 'prd', prd_id, MIN(occurred_day_sp) FROM activities WHERE prd_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='prd' AND c.id=activities.prd_id) GROUP BY prd_id
571
+ ), work_item_daily AS (
572
+ SELECT day,
573
+ SUM(CASE WHEN kind='prd' THEN 1 ELSE 0 END) AS prd_count,
574
+ SUM(CASE WHEN kind='spec' THEN 1 ELSE 0 END) AS spec_count,
575
+ SUM(CASE WHEN kind='task' THEN 1 ELSE 0 END) AS task_count
576
+ FROM work_item_days GROUP BY day
577
+ ), artifact_daily AS (
578
+ SELECT occurred_day_sp AS day,
579
+ SUM(CASE WHEN artifact_kind='validation' THEN 1 ELSE 0 END) AS validation_count,
580
+ SUM(CASE WHEN artifact_kind='evidence' THEN 1 ELSE 0 END) AS evidence_count
581
+ FROM canonical_artifacts GROUP BY occurred_day_sp
582
+ ), activity_daily AS (
583
+ SELECT date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours') AS day,
584
+ COUNT(*) AS activity_count,
585
+ SUM(CASE WHEN activity_source_kind='agent_run' THEN 1 ELSE 0 END) AS invocation_count,
586
+ SUM(llm_call_count) AS llm_call_count,
587
+ SUM(root_run_duration) AS total_root_run_duration,
588
+ SUM(sub_run_duration) AS total_sub_run_duration,
589
+ SUM(total_tokens) AS total_tokens,
590
+ SUM(cost_usd) AS total_cost_usd,
591
+ SUM(cost_brl) AS total_cost_brl
592
+ FROM activities
593
+ GROUP BY date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours')
594
+ ), cost_monitor_financial_daily AS (
595
+ -- Cost Monitor retains every canonical activity with a financial
596
+ -- observation. Historical telemetry can predate
597
+ -- agent_invocation_id, so restricting this population to
598
+ -- invocations would silently discard those facts.
599
+ SELECT date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours') AS day,
600
+ COUNT(*) AS invocation_count,
601
+ SUM(total_tokens) AS total_tokens,
602
+ SUM(cost_usd) AS total_cost_usd,
603
+ SUM(cost_brl) AS total_cost_brl
604
+ FROM activities
605
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
606
+ GROUP BY date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours')
607
+ ), cost_monitor_raw_intervals AS (
608
+ -- Only complete source intervals from the Cost Monitor financial
609
+ -- population are factual. Run duration and token estimates never
610
+ -- fill this measure.
611
+ SELECT activity_row_id AS activity_id,
612
+ (julianday(source_started_at) - 2440587.5) * 86400000.0 AS start_ms,
613
+ (julianday(source_finished_at) - 2440587.5) * 86400000.0 AS end_ms
614
+ FROM activities
615
+ WHERE (total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL)
616
+ AND source_started_at IS NOT NULL
617
+ AND source_finished_at IS NOT NULL
618
+ AND julianday(source_finished_at) > julianday(source_started_at)
619
+ ), cost_monitor_split_intervals AS (
620
+ -- Split at America/Sao_Paulo day boundaries before unioning. This
621
+ -- makes the factual daily measure bounded by one local day.
622
+ SELECT date(start_ms / 1000.0, 'unixepoch', '-3 hours') AS day,
623
+ activity_id, start_ms, end_ms,
624
+ MIN(end_ms, strftime('%s', date(start_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0) AS segment_end_ms
625
+ FROM cost_monitor_raw_intervals
626
+ UNION ALL
627
+ SELECT date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours'),
628
+ activity_id, segment_end_ms, end_ms,
629
+ MIN(end_ms, strftime('%s', date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0)
630
+ FROM cost_monitor_split_intervals WHERE segment_end_ms < end_ms
631
+ ), cost_monitor_ordered_intervals AS (
632
+ SELECT day, start_ms, segment_end_ms AS end_ms,
633
+ MAX(segment_end_ms) OVER (PARTITION BY day ORDER BY start_ms, segment_end_ms ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS prior_end_ms
634
+ FROM cost_monitor_split_intervals
635
+ ), cost_monitor_grouped_intervals AS (
636
+ SELECT *, SUM(CASE WHEN prior_end_ms IS NULL OR start_ms > prior_end_ms THEN 1 ELSE 0 END)
637
+ OVER (PARTITION BY day ORDER BY start_ms, end_ms) AS interval_group
638
+ FROM cost_monitor_ordered_intervals
639
+ ), cost_monitor_merged_intervals AS (
640
+ SELECT day, interval_group, MIN(start_ms) AS start_ms, MAX(end_ms) AS end_ms
641
+ FROM cost_monitor_grouped_intervals GROUP BY day, interval_group
642
+ ), cost_monitor_daily_duration AS (
643
+ -- Tempo is the shared attributed activity fact. Financial
644
+ -- coverage is reported independently below; an incomplete price
645
+ -- record must never erase an observed temporal fact.
646
+ SELECT occurred_day_sp AS day, SUM(attributed_token_active_ms) AS total_duration
647
+ FROM attributed_token_active_facts GROUP BY occurred_day_sp
648
+ ), cost_monitor_duration_coverage AS (
649
+ SELECT day, COUNT(DISTINCT activity_id) AS eligible_runs,
650
+ COUNT(DISTINCT activity_id) AS known_runs
651
+ FROM cost_monitor_split_intervals GROUP BY day
652
+ UNION ALL
653
+ SELECT date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours'),
654
+ COUNT(DISTINCT activity_row_id), 0
655
+ FROM activities
656
+ WHERE (total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL)
657
+ AND NOT (
658
+ source_started_at IS NOT NULL
659
+ AND source_finished_at IS NOT NULL
660
+ AND julianday(source_finished_at) > julianday(source_started_at)
661
+ )
662
+ GROUP BY date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours')
663
+ ), cost_monitor_daily_coverage AS (
664
+ SELECT day, SUM(eligible_runs) AS eligible_runs, SUM(known_runs) AS known_runs
665
+ FROM cost_monitor_duration_coverage GROUP BY day
666
+ ), run_daily AS (
667
+ SELECT occurred_day_sp AS day,
668
+ SUM(CASE WHEN run_role='root' THEN 1 ELSE 0 END) AS root_run_count,
669
+ SUM(CASE WHEN run_role='subrun' THEN 1 ELSE 0 END) AS sub_run_count,
670
+ COUNT(*) AS total_run_count,
671
+ SUM(source_event_count) AS source_event_count
672
+ FROM canonical_run_index GROUP BY occurred_day_sp
673
+ ), days AS (
674
+ SELECT day FROM work_item_daily UNION SELECT day FROM artifact_daily
675
+ UNION SELECT day FROM activity_daily UNION SELECT day FROM cost_monitor_financial_daily
676
+ UNION SELECT day FROM cost_monitor_daily_duration UNION SELECT day FROM cost_monitor_daily_coverage UNION SELECT day FROM run_daily
677
+ UNION SELECT day FROM operations_daily_duration
678
+ )
679
+ SELECT d.day,
680
+ COALESCE(w.prd_count, 0) AS prd_count,
681
+ COALESCE(w.spec_count, 0) AS spec_count,
682
+ COALESCE(w.task_count, 0) AS task_count,
683
+ COALESCE(a.validation_count, 0) AS validation_count,
684
+ COALESCE(a.evidence_count, 0) AS evidence_count,
685
+ COALESCE(i.activity_count, 0) AS activity_count,
686
+ COALESCE(r.root_run_count, 0) AS root_run_count,
687
+ COALESCE(r.sub_run_count, 0) AS sub_run_count,
688
+ COALESCE(r.total_run_count, 0) AS total_run_count,
689
+ COALESCE(i.invocation_count, 0) AS invocation_count,
690
+ COALESCE(f.invocation_count, 0) AS cost_monitor_invocation_count,
691
+ i.llm_call_count,
692
+ COALESCE(r.source_event_count, 0) AS source_event_count,
693
+ i.total_root_run_duration,
694
+ i.total_sub_run_duration,
695
+ o.total_duration AS operations_total_duration,
696
+ COALESCE(dcm.total_duration, o.total_duration) AS cost_monitor_total_duration,
697
+ coverage.eligible_runs AS cost_monitor_duration_eligible_runs,
698
+ coverage.known_runs AS cost_monitor_duration_known_runs,
699
+ o.total_duration AS total_duration,
700
+ f.total_tokens,
701
+ f.total_cost_usd,
702
+ f.total_cost_brl
703
+ FROM days d
704
+ LEFT JOIN work_item_daily w USING(day)
705
+ LEFT JOIN artifact_daily a USING(day)
706
+ LEFT JOIN activity_daily i USING(day)
707
+ LEFT JOIN cost_monitor_financial_daily f USING(day)
708
+ LEFT JOIN cost_monitor_daily_duration dcm USING(day)
709
+ LEFT JOIN cost_monitor_daily_coverage coverage USING(day)
710
+ LEFT JOIN run_daily r USING(day)
711
+ LEFT JOIN operations_daily_duration o USING(day);
712
+ -- SPEC/PRD rows have the same canonical population as the big
713
+ -- numbers. A macro without direct invocation remains visible with
714
+ -- factual NULL usage/cost/time, never a fabricated zero.
715
+ CREATE VIEW cost_monitor_group_daily_cache AS SELECT occurred_day_sp AS day, 'execution' AS group_kind, execution_id AS group_value, COUNT(*) AS invocation_count, SUM(llm_call_count) AS llm_call_count, SUM(duration_ms) AS total_duration, SUM(input_tokens) AS total_input_tokens, SUM(cached_input_tokens) AS total_cached_input_tokens, SUM(output_tokens) AS total_output_tokens, SUM(reasoning_tokens) AS total_reasoning_tokens, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM invocations WHERE execution_id IS NOT NULL GROUP BY occurred_day_sp, execution_id UNION ALL SELECT occurred_day_sp, 'zaip_agent', zaip_agent, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE zaip_agent IS NOT NULL GROUP BY occurred_day_sp, zaip_agent UNION ALL SELECT occurred_day_sp, 'provider', provider, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE provider IS NOT NULL GROUP BY occurred_day_sp, provider UNION ALL SELECT occurred_day_sp, 'model', model, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE model IS NOT NULL GROUP BY occurred_day_sp, model UNION ALL SELECT occurred_day_sp, 'task', task_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE task_id IS NOT NULL GROUP BY occurred_day_sp, task_id UNION ALL SELECT occurred_day_sp, 'spec', spec_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE spec_id IS NOT NULL GROUP BY occurred_day_sp, spec_id UNION ALL SELECT occurred_day_sp, 'prd', prd_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE prd_id IS NOT NULL GROUP BY occurred_day_sp, prd_id UNION ALL SELECT occurred_day_sp, 'conversation', conversation_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE conversation_id IS NOT NULL GROUP BY occurred_day_sp, conversation_id;
716
+ CREATE VIEW daily_aggregates AS SELECT * FROM daily_aggregate_cache;
717
+ CREATE VIEW overview AS
718
+ SELECT 'day' AS period_kind, day AS period_key, day AS start_day, day AS end_day, prd_count, spec_count, task_count, validation_count, evidence_count, activity_count, root_run_count, sub_run_count, total_run_count, invocation_count, cost_monitor_invocation_count, llm_call_count, source_event_count, total_root_run_duration, total_sub_run_duration, operations_total_duration, cost_monitor_total_duration, total_duration, total_tokens, total_cost_usd, total_cost_brl FROM daily_aggregates
719
+ UNION ALL
720
+ SELECT 'month', substr(day, 1, 7), MIN(day), MAX(day), SUM(prd_count), SUM(spec_count), SUM(task_count), SUM(validation_count), SUM(evidence_count), SUM(activity_count), SUM(root_run_count), SUM(sub_run_count), SUM(total_run_count), SUM(invocation_count), SUM(cost_monitor_invocation_count), SUM(llm_call_count), SUM(source_event_count), SUM(total_root_run_duration), SUM(total_sub_run_duration), SUM(operations_total_duration), SUM(cost_monitor_total_duration), SUM(total_duration), SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl) FROM daily_aggregates GROUP BY substr(day, 1, 7)
721
+ UNION ALL
722
+ SELECT 'year', substr(day, 1, 4), MIN(day), MAX(day), SUM(prd_count), SUM(spec_count), SUM(task_count), SUM(validation_count), SUM(evidence_count), SUM(activity_count), SUM(root_run_count), SUM(sub_run_count), SUM(total_run_count), SUM(invocation_count), SUM(cost_monitor_invocation_count), SUM(llm_call_count), SUM(source_event_count), SUM(total_root_run_duration), SUM(total_sub_run_duration), SUM(operations_total_duration), SUM(cost_monitor_total_duration), SUM(total_duration), SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl) FROM daily_aggregates GROUP BY substr(day, 1, 4);
723
+ CREATE VIEW overview_daily AS SELECT * FROM overview WHERE period_kind = 'day';
724
+ CREATE VIEW overview_monthly AS SELECT * FROM overview WHERE period_kind = 'month';
725
+ CREATE VIEW overview_annual AS SELECT * FROM overview WHERE period_kind = 'year';
726
+ CREATE VIEW operations_overview AS SELECT period_kind, period_key, start_day, end_day, prd_count, spec_count, task_count, validation_count, evidence_count, total_run_count, invocation_count, llm_call_count, operations_total_duration, total_tokens, total_cost_usd, total_cost_brl FROM overview;
727
+ -- Cost Monitor deliberately projects its measurable invocation
728
+ -- population rather than Operations' broader Run/activity totals.
729
+ CREATE VIEW cost_monitor_overview AS SELECT period_kind, period_key, cost_monitor_invocation_count AS total_run_count, cost_monitor_invocation_count AS invocation_count, llm_call_count, source_event_count, cost_monitor_total_duration, total_tokens, total_cost_usd, total_cost_brl FROM overview;
730
+ CREATE VIEW task_summary AS SELECT t.id, t.title, t.status, t.risk, t.occurred_at, t.occurred_day_sp, COUNT(i.run_id) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM tasks t LEFT JOIN activities i ON i.task_id = t.id GROUP BY t.id, t.title, t.status, t.risk, t.occurred_at, t.occurred_day_sp;
731
+ CREATE VIEW spec_summary AS SELECT s.id, s.title, s.status, s.risk, s.occurred_at, s.occurred_day_sp, COUNT(i.run_id) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM specs s LEFT JOIN activities i ON i.spec_id = s.id GROUP BY s.id, s.title, s.status, s.risk, s.occurred_at, s.occurred_day_sp;
732
+ CREATE VIEW prd_summary AS SELECT p.id, p.title, p.status, p.risk, p.occurred_at, p.occurred_day_sp, COUNT(i.run_id) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM prds p LEFT JOIN activities i ON i.prd_id = p.id GROUP BY p.id, p.title, p.status, p.risk, p.occurred_at, p.occurred_day_sp;
733
+ CREATE VIEW cost_monitor_group_daily AS SELECT * FROM cost_monitor_group_daily_cache;
734
+ CREATE VIEW vw_overview AS SELECT * FROM overview;
735
+ CREATE VIEW vw_overview_daily AS SELECT * FROM overview WHERE period_kind = 'day';
736
+ CREATE VIEW vw_overview_monthly AS SELECT * FROM overview WHERE period_kind = 'month';
737
+ CREATE VIEW vw_overview_annual AS SELECT * FROM overview WHERE period_kind = 'year';
738
+ CREATE VIEW vw_task_summary AS SELECT * FROM task_summary;
739
+ CREATE VIEW vw_spec_summary AS SELECT * FROM spec_summary;
740
+ CREATE VIEW vw_prd_summary AS SELECT * FROM prd_summary;
741
+ CREATE VIEW vw_task_summary_daily AS SELECT occurred_day_sp AS day, COUNT(*) AS task_count, SUM(llm_call_count) AS llm_call_count FROM task_summary GROUP BY occurred_day_sp;
742
+ CREATE VIEW vw_spec_summary_daily AS SELECT occurred_day_sp AS day, COUNT(*) AS spec_count, SUM(llm_call_count) AS llm_call_count FROM spec_summary GROUP BY occurred_day_sp;
743
+ CREATE VIEW vw_prd_summary_daily AS SELECT occurred_day_sp AS day, COUNT(*) AS prd_count, SUM(llm_call_count) AS llm_call_count FROM prd_summary GROUP BY occurred_day_sp;
744
+ CREATE VIEW vw_task_status_daily AS SELECT occurred_day_sp AS day, status, COUNT(*) AS task_count FROM task_summary GROUP BY occurred_day_sp, status;
745
+ CREATE VIEW vw_task_risk_daily AS SELECT occurred_day_sp AS day, risk, COUNT(*) AS task_count FROM task_summary GROUP BY occurred_day_sp, risk;
746
+ CREATE VIEW vw_entities AS SELECT 'task' AS entity_kind, id, title, status, risk, occurred_at, occurred_day_sp FROM task_summary UNION ALL SELECT 'spec', id, title, status, risk, occurred_at, occurred_day_sp FROM spec_summary UNION ALL SELECT 'prd', id, title, status, risk, occurred_at, occurred_day_sp FROM prd_summary;
747
+ CREATE VIEW vw_cost_group_daily AS SELECT * FROM cost_monitor_group_daily_cache;
748
+ -- Narrow temporal Cost surfaces. Do not route the visible Cost
749
+ -- tables through the three-grain overview union: it expands every
750
+ -- daily interval pipeline twice and prevents the outer from/to filter
751
+ -- from remaining a simple period predicate. These views expose only
752
+ -- the columns consumed by Daily, Monthly and Annual.
753
+ CREATE VIEW vw_cost_daily AS
754
+ SELECT day AS period_key, day AS start_day, day AS end_day,
755
+ cost_monitor_invocation_count AS total_run_count,
756
+ cost_monitor_invocation_count AS invocation_count,
757
+ llm_call_count, source_event_count,
758
+ cost_monitor_total_duration AS total_duration,
759
+ total_tokens, total_cost_usd, total_cost_brl
760
+ FROM daily_aggregate_cache;
761
+ CREATE VIEW vw_cost_monthly AS
762
+ SELECT substr(day, 1, 7) AS period_key, MIN(day) AS start_day, MAX(day) AS end_day,
763
+ SUM(cost_monitor_invocation_count) AS total_run_count,
764
+ SUM(cost_monitor_invocation_count) AS invocation_count,
765
+ SUM(llm_call_count) AS llm_call_count, SUM(source_event_count) AS source_event_count,
766
+ SUM(cost_monitor_total_duration) AS total_duration,
767
+ SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
768
+ FROM daily_aggregate_cache GROUP BY substr(day, 1, 7);
769
+ CREATE VIEW vw_cost_annual AS
770
+ SELECT substr(day, 1, 4) AS period_key, MIN(day) AS start_day, MAX(day) AS end_day,
771
+ SUM(cost_monitor_invocation_count) AS total_run_count,
772
+ SUM(cost_monitor_invocation_count) AS invocation_count,
773
+ SUM(llm_call_count) AS llm_call_count, SUM(source_event_count) AS source_event_count,
774
+ SUM(cost_monitor_total_duration) AS total_duration,
775
+ SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
776
+ FROM daily_aggregate_cache GROUP BY substr(day, 1, 4);
777
+ CREATE VIEW vw_cost_overview AS
778
+ -- MATERIALIZED keeps the expensive factual daily interval pipeline
779
+ -- to one evaluation for this three-grain overview response.
780
+ WITH daily AS MATERIALIZED (
781
+ SELECT day, cost_monitor_invocation_count, llm_call_count,
782
+ source_event_count, cost_monitor_total_duration,
783
+ cost_monitor_duration_eligible_runs, cost_monitor_duration_known_runs,
784
+ total_tokens, total_cost_usd, total_cost_brl
785
+ FROM daily_aggregate_cache
786
+ )
787
+ SELECT 'day' AS period_kind, day AS period_key,
788
+ cost_monitor_invocation_count AS total_run_count,
789
+ cost_monitor_invocation_count AS invocation_count,
790
+ llm_call_count, source_event_count,
791
+ cost_monitor_total_duration AS cost_monitor_total_duration,
792
+ total_tokens, total_cost_usd, total_cost_brl, day AS start_day, day AS end_day,
793
+ cost_monitor_total_duration AS total_duration
794
+ FROM daily
795
+ UNION ALL
796
+ SELECT 'month', substr(day, 1, 7), SUM(cost_monitor_invocation_count), SUM(cost_monitor_invocation_count),
797
+ SUM(llm_call_count), SUM(source_event_count),
798
+ SUM(cost_monitor_total_duration),
799
+ SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl), MIN(day), MAX(day),
800
+ SUM(cost_monitor_total_duration)
801
+ FROM daily GROUP BY substr(day, 1, 7)
802
+ UNION ALL
803
+ SELECT 'year', substr(day, 1, 4), SUM(cost_monitor_invocation_count), SUM(cost_monitor_invocation_count),
804
+ SUM(llm_call_count), SUM(source_event_count),
805
+ SUM(cost_monitor_total_duration),
806
+ SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl), MIN(day), MAX(day),
807
+ SUM(cost_monitor_total_duration)
808
+ FROM daily GROUP BY substr(day, 1, 4);
809
+ CREATE VIEW vw_cost_executions AS SELECT i.execution_id, i.execution_id AS title, e.status, NULL AS risk, MIN(i.occurred_at) AS occurred_at, MIN(i.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(*) AS invocation_count FROM invocations i LEFT JOIN executions e ON e.id = i.execution_id WHERE i.execution_id IS NOT NULL GROUP BY i.execution_id, e.status;
810
+ CREATE VIEW vw_cost_agent_invocations AS
811
+ SELECT i.*,
812
+ COUNT(u.usage_index) AS pricing_segment_count,
813
+ CASE WHEN COUNT(DISTINCT COALESCE(u.provider, '') || '|' || COALESCE(u.model, '') || '|' || COALESCE(u.service_tier, 'default') || '|' || COALESCE(CAST(u.context_input_multiplier AS TEXT), '') || '|' || COALESCE(CAST(u.context_output_multiplier AS TEXT), '')) > 1 THEN 1 ELSE 0 END AS pricing_mixed,
814
+ SUM(u.uncached_input_tokens) AS uncached_input_tokens,
815
+ SUM(u.visible_output_tokens) AS visible_output_tokens,
816
+ CASE COUNT(DISTINCT u.input_rate_usd_per_million) WHEN 1 THEN MIN(u.input_rate_usd_per_million) ELSE NULL END AS input_rate_usd_per_million,
817
+ CASE COUNT(DISTINCT u.cached_input_rate_usd_per_million) WHEN 1 THEN MIN(u.cached_input_rate_usd_per_million) ELSE NULL END AS cached_input_rate_usd_per_million,
818
+ CASE COUNT(DISTINCT u.output_rate_usd_per_million) WHEN 1 THEN MIN(u.output_rate_usd_per_million) ELSE NULL END AS output_rate_usd_per_million,
819
+ CASE COUNT(DISTINCT u.reasoning_rate_usd_per_million) WHEN 1 THEN MIN(u.reasoning_rate_usd_per_million) ELSE NULL END AS reasoning_rate_usd_per_million,
820
+ CASE COUNT(DISTINCT u.context_input_multiplier) WHEN 1 THEN MIN(u.context_input_multiplier) ELSE NULL END AS context_input_multiplier,
821
+ CASE COUNT(DISTINCT u.context_output_multiplier) WHEN 1 THEN MIN(u.context_output_multiplier) ELSE NULL END AS context_output_multiplier,
822
+ CASE COUNT(DISTINCT u.speed_cost_multiplier) WHEN 1 THEN MIN(u.speed_cost_multiplier) ELSE NULL END AS speed_cost_multiplier,
823
+ CASE COUNT(DISTINCT u.pricing_scenario) WHEN 1 THEN MIN(u.pricing_scenario) ELSE 'mixed' END AS pricing_scenario,
824
+ SUM(u.standard_cost_usd) AS standard_cost_usd,
825
+ SUM(u.speed_uplift_usd) AS speed_uplift_usd,
826
+ SUM(u.input_cost_usd) AS input_cost_usd,
827
+ SUM(u.cached_input_cost_usd) AS cached_input_cost_usd,
828
+ SUM(u.output_cost_usd) AS output_cost_usd,
829
+ SUM(u.reasoning_cost_usd) AS reasoning_cost_usd,
830
+ SUM(u.calculated_cost_usd) AS calculated_cost_usd,
831
+ SUM(u.recorded_cost_usd) AS recorded_cost_usd,
832
+ CASE COUNT(DISTINCT CASE WHEN u.recorded_cost_usd IS NOT NULL THEN u.fx_rate END)
833
+ WHEN 1 THEN MIN(CASE WHEN u.recorded_cost_usd IS NOT NULL THEN u.fx_rate END)
834
+ ELSE NULL
835
+ END AS recorded_fx_rate,
836
+ SUM(CASE WHEN u.recorded_cost_usd IS NOT NULL THEN u.cost_brl END) AS recorded_brl,
837
+ (SELECT json_extract(fx.content, '$.rate')
838
+ FROM files fx
839
+ WHERE fx.path LIKE '.agents/config/pricing/fx/%.json'
840
+ ORDER BY CASE WHEN fx.path LIKE '%/current-usd-brl.json' THEN 0 ELSE 1 END,
841
+ json_extract(fx.content, '$.as_of') DESC
842
+ LIMIT 1) AS current_fx_rate,
843
+ SUM(u.cost_variance_usd) AS cost_variance_usd,
844
+ CASE COUNT(DISTINCT u.pricing_model) WHEN 1 THEN MIN(u.pricing_model) ELSE NULL END AS audit_pricing_model,
845
+ CASE COUNT(DISTINCT u.pricing_source) WHEN 1 THEN MIN(u.pricing_source) ELSE NULL END AS audit_pricing_source
846
+ FROM invocations i LEFT JOIN invocation_usage u USING(agent_invocation_id)
847
+ GROUP BY i.agent_invocation_id;
848
+ CREATE VIEW vw_cost_zaip_agents AS SELECT zaip_agent, SUM(llm_call_count) AS llm_call_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl, COUNT(*) AS invocation_count FROM invocations GROUP BY zaip_agent;
849
+ CREATE VIEW vw_cost_models AS WITH usage AS (SELECT model, agent_invocation_id, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl FROM invocation_usage GROUP BY model, agent_invocation_id), calls AS (SELECT i.agent_invocation_id, CASE WHEN (SELECT COUNT(DISTINCT m.model) FROM invocation_usage m WHERE m.agent_invocation_id = i.agent_invocation_id AND m.model IS NOT NULL) = 1 THEN i.llm_call_count END AS llm_call_count FROM invocations i) SELECT u.model, SUM(c.llm_call_count) AS llm_call_count, SUM(u.total_tokens) AS total_tokens, SUM(u.cost_usd) AS cost_usd, SUM(u.cost_brl) AS cost_brl, COUNT(*) AS invocation_count FROM usage u JOIN calls c USING(agent_invocation_id) GROUP BY u.model;
850
+ CREATE VIEW vw_cost_providers AS WITH usage AS (SELECT provider, agent_invocation_id, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl FROM invocation_usage GROUP BY provider, agent_invocation_id), calls AS (SELECT i.agent_invocation_id, CASE WHEN (SELECT COUNT(DISTINCT p.provider) FROM invocation_usage p WHERE p.agent_invocation_id = i.agent_invocation_id AND p.provider IS NOT NULL) = 1 THEN i.llm_call_count END AS llm_call_count FROM invocations i) SELECT u.provider, SUM(c.llm_call_count) AS llm_call_count, SUM(u.total_tokens) AS total_tokens, SUM(u.cost_usd) AS cost_usd, SUM(u.cost_brl) AS cost_brl, COUNT(*) AS invocation_count FROM usage u JOIN calls c USING(agent_invocation_id) GROUP BY u.provider;
851
+ CREATE VIEW vw_cost_tasks AS SELECT i.task_id, COALESCE(MAX(t.title), i.task_id) AS title, MAX(t.status) AS status, MAX(t.risk) AS risk, MIN(i.occurred_at) AS occurred_at, MIN(i.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(*) AS invocation_count FROM invocations i LEFT JOIN tasks t ON t.id = i.task_id WHERE i.task_id IS NOT NULL GROUP BY i.task_id;
852
+ CREATE VIEW vw_cost_specs AS SELECT s.id AS spec_id, s.title, s.status, s.risk, COALESCE(MIN(i.occurred_at), s.occurred_at) AS occurred_at, COALESCE(MIN(i.occurred_day_sp), s.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(i.agent_invocation_id) AS invocation_count FROM specs s LEFT JOIN invocations i ON i.spec_id = s.id GROUP BY s.id, s.title, s.status, s.risk, s.occurred_at, s.occurred_day_sp;
853
+ CREATE VIEW vw_cost_prds AS SELECT p.id AS prd_id, p.title, p.status, p.risk, COALESCE(MIN(i.occurred_at), p.occurred_at) AS occurred_at, COALESCE(MIN(i.occurred_day_sp), p.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(i.agent_invocation_id) AS invocation_count FROM prds p LEFT JOIN invocations i ON i.prd_id = p.id GROUP BY p.id, p.title, p.status, p.risk, p.occurred_at, p.occurred_day_sp;
854
+ CREATE VIEW vw_cost_conversations AS SELECT i.conversation_id, i.conversation_id AS title, MAX(c.status) AS status, NULL AS risk, MIN(i.occurred_at) AS occurred_at, MIN(i.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(*) AS invocation_count FROM invocations i LEFT JOIN conversations c ON c.id = i.conversation_id WHERE i.conversation_id IS NOT NULL GROUP BY i.conversation_id;
855
+ CREATE VIEW vw_operations_work_list AS SELECT * FROM vw_entities;
856
+ -- Full work summary retains historical activity coverage for internal
857
+ -- entity summaries. It is not the Kanban population.
858
+ CREATE VIEW vw_operations_work_summary AS
859
+ WITH task_lineage AS (
860
+ SELECT DISTINCT
861
+ CAST(task.value AS TEXT) AS task_id,
862
+ COALESCE(c.source_spec_id, CASE WHEN c.source_type='spec' THEN c.source_id END) AS spec_id,
863
+ COALESCE(c.source_prd_id, CASE WHEN c.source_type='prd' THEN c.source_id END) AS prd_id
864
+ FROM canonical_changes c, json_each(c.task_ids_json) AS task
865
+ ), lineage_cardinality AS (
866
+ -- Parent creation Runs are not observed Task Runs. They can be
867
+ -- displayed on a child only when exactly one canonical Task owns
868
+ -- that lineage, preventing a shared macro total from being copied
869
+ -- into sibling cards.
870
+ SELECT spec_id, prd_id, COUNT(*) AS task_count
871
+ FROM task_lineage
872
+ GROUP BY spec_id, prd_id
873
+ ), entity_activity AS (
874
+ SELECT 'task' AS entity_kind, task_id AS entity_id, * FROM activities WHERE task_id IS NOT NULL
875
+ UNION ALL SELECT 'spec', spec_id, * FROM activities WHERE spec_id IS NOT NULL
876
+ UNION ALL SELECT 'prd', prd_id, * FROM activities WHERE prd_id IS NOT NULL
877
+ UNION ALL
878
+ SELECT 'task', l.task_id, a.*
879
+ FROM task_lineage l
880
+ JOIN lineage_cardinality cardinality
881
+ ON cardinality.spec_id IS l.spec_id AND cardinality.prd_id IS l.prd_id
882
+ JOIN activities a
883
+ ON a.task_id IS NULL
884
+ AND (
885
+ (l.spec_id IS NOT NULL AND a.spec_id = l.spec_id)
886
+ OR (
887
+ l.spec_id IS NULL
888
+ AND l.prd_id IS NOT NULL
889
+ AND a.spec_id IS NULL
890
+ AND a.prd_id = l.prd_id
891
+ )
892
+ )
893
+ WHERE cardinality.task_count = 1
894
+ AND NOT EXISTS (SELECT 1 FROM activities direct WHERE direct.task_id = l.task_id)
895
+ ), financial AS (
896
+ SELECT entity_kind, entity_id,
897
+ COUNT(*) AS invocation_count,
898
+ SUM(llm_call_count) AS llm_call_count,
899
+ SUM(total_tokens) AS total_tokens,
900
+ SUM(cost_usd) AS total_cost_usd,
901
+ SUM(cost_brl) AS total_cost_brl
902
+ FROM entity_activity GROUP BY entity_kind, entity_id
903
+ ), durations AS (
904
+ SELECT entity_kind, entity_id, ROUND(SUM(duration_ms)) AS total_duration
905
+ FROM entity_activity GROUP BY entity_kind, entity_id
906
+ )
907
+ SELECT w.entity_kind, w.id, w.title, w.status, w.risk, w.occurred_at, w.occurred_day_sp,
908
+ f.invocation_count, f.llm_call_count, d.total_duration,
909
+ f.total_tokens, f.total_cost_usd, f.total_cost_brl
910
+ FROM work_items w
911
+ LEFT JOIN financial f ON f.entity_kind=w.entity_kind AND f.entity_id=w.id
912
+ LEFT JOIN durations d ON d.entity_kind=w.entity_kind AND d.entity_id=w.id;
913
+ -- Kanban is a lifecycle surface: it lists only canonical records.
914
+ -- Telemetry-only identifiers remain Cost Monitor facts but cannot
915
+ -- create a synthetic operational card.
916
+ CREATE VIEW vw_operations_work_kanban AS
917
+ SELECT summary.*
918
+ FROM canonical_work_items canonical
919
+ JOIN vw_operations_work_summary summary
920
+ ON summary.entity_kind=canonical.entity_kind AND summary.id=canonical.id;
921
+ CREATE VIEW vw_operations_executions AS
922
+ WITH metrics AS (
923
+ SELECT i.execution_id,
924
+ CASE COUNT(DISTINCT t.risk) WHEN 0 THEN NULL WHEN 1 THEN MIN(t.risk) ELSE 'mixed' END AS risk,
925
+ MIN(i.occurred_at) AS telemetry_started_at,
926
+ SUM(i.llm_call_count) AS llm_call_count,
927
+ SUM(i.duration_ms) AS duration_ms,
928
+ CASE WHEN COUNT(i.duration_ms) > 0 THEN 'observed' ELSE 'unavailable' END AS duration_provenance,
929
+ SUM(i.total_tokens) AS total_tokens,
930
+ SUM(i.cost_brl) AS total_cost_brl,
931
+ COUNT(*) AS invocation_count
932
+ FROM invocations i LEFT JOIN tasks t ON t.id=i.task_id
933
+ WHERE i.execution_id IS NOT NULL GROUP BY i.execution_id
934
+ )
935
+ SELECT c.id AS execution_id, c.status, m.risk,
936
+ c.created_at AS started_at, c.finished_at,
937
+ c.kind AS execution_kind, c.origin_type,
938
+ CASE WHEN c.origin_type='task' THEN c.origin_id END AS task_id,
939
+ CASE WHEN c.origin_type='interaction' THEN c.origin_id END AS conversation_id,
940
+ m.llm_call_count, m.duration_ms, COALESCE(m.duration_provenance, 'unavailable') AS duration_provenance,
941
+ CASE WHEN c.status IN ('completed', 'failed', 'cancelled') AND c.finished_at IS NOT NULL THEN MAX(0, CAST((julianday(c.finished_at) - julianday(c.created_at)) * 86400000 AS INTEGER)) ELSE NULL END AS lifecycle_elapsed_ms,
942
+ m.total_tokens, m.total_cost_brl,
943
+ COALESCE(m.invocation_count, 0) AS invocation_count,
944
+ c.source_path
945
+ FROM canonical_executions c LEFT JOIN metrics m ON m.execution_id=c.id
946
+ UNION ALL
947
+ SELECT i.execution_id, MAX(i.status),
948
+ CASE COUNT(DISTINCT t.risk) WHEN 0 THEN NULL WHEN 1 THEN MIN(t.risk) ELSE 'mixed' END,
949
+ MIN(i.occurred_at), MAX(i.occurred_at), NULL, NULL, MAX(i.task_id), MAX(i.conversation_id),
950
+ SUM(i.llm_call_count), SUM(i.duration_ms), CASE WHEN COUNT(i.duration_ms) > 0 THEN 'observed' ELSE 'unavailable' END, NULL, SUM(i.total_tokens), SUM(i.cost_brl), COUNT(*), NULL
951
+ FROM invocations i LEFT JOIN tasks t ON t.id=i.task_id
952
+ WHERE i.execution_id IS NOT NULL
953
+ AND NOT EXISTS (SELECT 1 FROM canonical_executions c WHERE c.id=i.execution_id)
954
+ GROUP BY i.execution_id;
955
+ CREATE VIEW vw_operations_agent_invocations AS
956
+ SELECT c.*,
957
+ date(COALESCE(c.source_started_at, c.source_occurred_at, c.occurred_at), '-3 hours') AS source_day_sp,
958
+ t.risk
959
+ FROM vw_cost_agent_invocations c LEFT JOIN tasks t ON t.id=c.task_id;
960
+ CREATE VIEW vw_operations_conversations AS
961
+ SELECT i.conversation_id, c.status,
962
+ CASE COUNT(DISTINCT t.risk) WHEN 0 THEN NULL WHEN 1 THEN MIN(t.risk) ELSE 'mixed' END AS risk,
963
+ MIN(i.occurred_at) AS started_at, MAX(i.occurred_at) AS finished_at,
964
+ SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration,
965
+ CASE WHEN COUNT(i.duration_ms) > 0 THEN 'observed' ELSE 'unavailable' END AS duration_provenance,
966
+ SUM(i.total_tokens) AS total_tokens, SUM(i.cost_brl) AS total_cost_brl,
967
+ GROUP_CONCAT(DISTINCT CASE WHEN i.model IS NULL OR trim(i.model) = '' OR lower(i.model) = 'unknown' THEN NULL ELSE i.model END) AS model,
968
+ GROUP_CONCAT(DISTINCT CASE WHEN i.reasoning_effort IS NULL OR trim(i.reasoning_effort) = '' OR lower(i.reasoning_effort) = 'unknown' THEN NULL ELSE i.reasoning_effort END) AS reasoning_effort,
969
+ COUNT(*) AS invocation_count
970
+ FROM invocations i LEFT JOIN conversations c ON c.id=i.conversation_id LEFT JOIN tasks t ON t.id=i.task_id
971
+ WHERE i.conversation_id IS NOT NULL GROUP BY i.conversation_id, c.status
972
+ UNION ALL
973
+ SELECT c.id, c.status, NULL, c.occurred_at, NULL, NULL, NULL, 'unavailable', NULL, NULL, NULL, NULL, 0
974
+ FROM conversations c
975
+ WHERE NOT EXISTS (SELECT 1 FROM invocations i WHERE i.conversation_id=c.id);
976
+ CREATE VIEW vw_operations_decisions AS SELECT * FROM decisions;
977
+ CREATE VIEW vw_operations_changes AS SELECT * FROM changes;
978
+ CREATE VIEW vw_operations_daily AS SELECT period_key AS day, * FROM operations_overview WHERE period_kind = 'day';
979
+ CREATE VIEW vw_operations_monthly AS SELECT * FROM operations_overview WHERE period_kind = 'month';
980
+ CREATE VIEW vw_operations_annual AS SELECT * FROM operations_overview WHERE period_kind = 'year';
981
+ CREATE VIEW vw_first_fold_overview AS SELECT * FROM vw_overview_daily;
982
+ CREATE VIEW vw_first_fold_task_status AS SELECT * FROM vw_task_status_daily;
983
+ CREATE VIEW vw_first_fold_task_risk AS SELECT * FROM vw_task_risk_daily;
984
+ CREATE VIEW vw_first_fold_top_tasks AS SELECT t.*, c.total_duration, c.total_tokens, c.total_cost_usd, c.total_cost_brl FROM task_summary t LEFT JOIN (SELECT task_id, SUM(llm_call_count) AS llm_call_count, SUM(duration_ms) AS total_duration, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM invocations GROUP BY task_id) c ON c.task_id = t.id ORDER BY c.total_duration DESC;
985
+ CREATE VIEW vw_first_fold_overview_all_time AS
986
+ WITH totals AS (
987
+ SELECT MIN(day) AS start_day, MAX(day) AS end_day,
988
+ SUM(total_run_count) AS total_run_count,
989
+ SUM(invocation_count) AS agent_invocation_count,
990
+ SUM(llm_call_count) AS llm_call_count,
991
+ ROUND(SUM(total_duration)) AS total_duration_ms,
992
+ SUM(total_tokens) AS total_tokens,
993
+ SUM(total_cost_usd) AS total_cost_usd,
994
+ SUM(total_cost_brl) AS total_cost_brl,
995
+ SUM(CASE WHEN total_duration IS NOT NULL THEN 1 ELSE 0 END) AS execution_day_count
996
+ FROM daily_aggregates
997
+ ), task_totals AS (
998
+ SELECT COUNT(*) AS task_count,
999
+ SUM(CASE WHEN status='completed' THEN 1 ELSE 0 END) AS completed_task_count,
1000
+ MAX(occurred_at) AS latest_task_created_at
1001
+ FROM task_summary
1002
+ ), spec_totals AS (
1003
+ SELECT COUNT(*) AS spec_count,
1004
+ SUM(CASE WHEN status IN ('completed','delivered') THEN 1 ELSE 0 END) AS completed_spec_count
1005
+ FROM spec_summary
1006
+ ), prd_totals AS (
1007
+ SELECT COUNT(*) AS prd_count,
1008
+ SUM(CASE WHEN status IN ('completed','delivered') THEN 1 ELSE 0 END) AS completed_prd_count
1009
+ FROM prd_summary
1010
+ )
1011
+ SELECT 'all' AS period_key, totals.start_day, totals.end_day,
1012
+ task_totals.task_count, task_totals.completed_task_count,
1013
+ spec_totals.spec_count, spec_totals.completed_spec_count,
1014
+ prd_totals.prd_count, prd_totals.completed_prd_count,
1015
+ totals.total_run_count, totals.agent_invocation_count, totals.llm_call_count,
1016
+ totals.total_duration_ms, totals.total_tokens,
1017
+ totals.total_cost_usd, totals.total_cost_brl, totals.execution_day_count,
1018
+ task_totals.latest_task_created_at
1019
+ FROM totals CROSS JOIN task_totals CROSS JOIN spec_totals CROSS JOIN prd_totals;
1020
+ CREATE VIEW vw_first_fold_task_status_all_time AS
1021
+ WITH counts AS (
1022
+ SELECT COALESCE(status, 'draft') AS status, COUNT(*) AS task_count
1023
+ FROM task_summary GROUP BY COALESCE(status, 'draft')
1024
+ ), total AS (SELECT SUM(task_count) AS task_count FROM counts)
1025
+ SELECT counts.status, counts.task_count,
1026
+ CASE WHEN total.task_count = 0 THEN 0.0 ELSE CAST(counts.task_count AS REAL) / total.task_count END AS task_percentage
1027
+ FROM counts CROSS JOIN total;
1028
+ CREATE VIEW vw_first_fold_task_risk_all_time AS
1029
+ WITH counts AS (
1030
+ SELECT COALESCE(risk, 'standard') AS risk, COUNT(*) AS task_count
1031
+ FROM task_summary GROUP BY COALESCE(risk, 'standard')
1032
+ ), total AS (SELECT SUM(task_count) AS task_count FROM counts)
1033
+ SELECT counts.risk, counts.task_count,
1034
+ CASE WHEN total.task_count = 0 THEN 0.0 ELSE CAST(counts.task_count AS REAL) / total.task_count END AS task_percentage
1035
+ FROM counts CROSS JOIN total;
1036
+ CREATE VIEW vw_first_fold_task_metrics_all_time AS
1037
+ SELECT overview.task_count,
1038
+ CASE WHEN overview.task_count = 0 OR overview.total_duration_ms IS NULL THEN NULL ELSE overview.total_duration_ms / overview.task_count END AS average_duration_ms_per_task,
1039
+ CASE WHEN overview.task_count = 0 OR overview.total_tokens IS NULL THEN NULL ELSE overview.total_tokens / overview.task_count END AS average_tokens_per_task,
1040
+ CASE WHEN overview.task_count = 0 OR overview.total_cost_usd IS NULL THEN NULL ELSE overview.total_cost_usd / overview.task_count END AS average_cost_usd_per_task,
1041
+ CASE WHEN overview.task_count = 0 OR overview.total_cost_brl IS NULL THEN NULL ELSE overview.total_cost_brl / overview.task_count END AS average_cost_brl_per_task,
1042
+ overview.latest_task_created_at
1043
+ FROM vw_first_fold_overview_all_time overview;
1044
+ CREATE VIEW vw_first_fold_spec_status_all_time AS
1045
+ WITH counts AS (
1046
+ SELECT CASE
1047
+ WHEN status='cancelled' THEN 'cancelled'
1048
+ WHEN status='failed' THEN 'failed'
1049
+ WHEN status='blocked' THEN 'blocked'
1050
+ WHEN status IN ('delivered','completed') THEN 'completed'
1051
+ WHEN status='ready' THEN 'ready'
1052
+ WHEN status='draft' THEN 'planning'
1053
+ WHEN status='verifying' THEN 'verifying'
1054
+ WHEN status IN ('active','executing') THEN 'executing'
1055
+ ELSE 'planning'
1056
+ END AS stage, COUNT(*) AS entity_count
1057
+ FROM spec_summary GROUP BY stage
1058
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1059
+ SELECT counts.stage, counts.entity_count,
1060
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1061
+ FROM counts CROSS JOIN total;
1062
+ CREATE VIEW vw_first_fold_prd_status_all_time AS
1063
+ WITH counts AS (
1064
+ SELECT CASE
1065
+ WHEN status='cancelled' THEN 'cancelled'
1066
+ WHEN status='failed' THEN 'failed'
1067
+ WHEN status='blocked' THEN 'blocked'
1068
+ WHEN status IN ('delivered','completed') THEN 'completed'
1069
+ WHEN status='ready' THEN 'ready'
1070
+ WHEN status='draft' THEN 'definition'
1071
+ WHEN status='verifying' THEN 'verifying'
1072
+ WHEN status IN ('active','executing') THEN 'executing'
1073
+ ELSE 'definition'
1074
+ END AS stage, COUNT(*) AS entity_count
1075
+ FROM prd_summary GROUP BY stage
1076
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1077
+ SELECT counts.stage, counts.entity_count,
1078
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1079
+ FROM counts CROSS JOIN total;
1080
+ CREATE VIEW vw_first_fold_spec_classification_all_time AS
1081
+ WITH rollup AS (
1082
+ SELECT s.id, COUNT(DISTINCT a.task_id) AS task_count,
1083
+ SUM(CASE WHEN a.work_type='rework' AND a.run_role='root' THEN 1 ELSE 0 END) AS rework_run_count
1084
+ FROM spec_summary s LEFT JOIN activities a ON a.spec_id=s.id GROUP BY s.id
1085
+ ), counts AS (
1086
+ SELECT CASE WHEN rework_run_count>0 THEN 'rework' WHEN task_count>0 THEN 'structured' ELSE 'empty' END AS classification,
1087
+ COUNT(*) AS entity_count
1088
+ FROM rollup GROUP BY classification
1089
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1090
+ SELECT counts.classification, counts.entity_count,
1091
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1092
+ FROM counts CROSS JOIN total;
1093
+ CREATE VIEW vw_first_fold_prd_classification_all_time AS
1094
+ WITH rollup AS (
1095
+ SELECT p.id, COUNT(DISTINCT a.task_id) AS task_count,
1096
+ SUM(CASE WHEN a.work_type='rework' AND a.run_role='root' THEN 1 ELSE 0 END) AS rework_run_count
1097
+ FROM prd_summary p LEFT JOIN activities a ON a.prd_id=p.id GROUP BY p.id
1098
+ ), counts AS (
1099
+ SELECT CASE WHEN rework_run_count>0 THEN 'rework' WHEN task_count>0 THEN 'structured' ELSE 'empty' END AS classification,
1100
+ COUNT(*) AS entity_count
1101
+ FROM rollup GROUP BY classification
1102
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1103
+ SELECT counts.classification, counts.entity_count,
1104
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1105
+ FROM counts CROSS JOIN total;
1106
+ CREATE VIEW vw_first_fold_spec_metrics_all_time AS
1107
+ WITH usage AS (
1108
+ SELECT spec_id,
1109
+ COUNT(*) AS total_run_count,
1110
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1111
+ SUM(total_tokens) AS total_tokens,
1112
+ SUM(cost_usd) AS total_cost_usd,
1113
+ SUM(cost_brl) AS total_cost_brl
1114
+ FROM activities WHERE spec_id IS NOT NULL GROUP BY spec_id
1115
+ )
1116
+ SELECT COUNT(*) AS entity_count,
1117
+ SUM(usage.total_run_count) AS total_run_count,
1118
+ SUM(usage.total_duration_ms) AS total_duration_ms,
1119
+ SUM(usage.total_tokens) AS total_tokens,
1120
+ SUM(usage.total_cost_usd) AS total_cost_usd,
1121
+ SUM(usage.total_cost_brl) AS total_cost_brl,
1122
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_duration_ms)/COUNT(*) END AS average_duration_ms,
1123
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_tokens)/COUNT(*) END AS average_tokens,
1124
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_usd)/COUNT(*) END AS average_cost_usd,
1125
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_brl)/COUNT(*) END AS average_cost_brl,
1126
+ MAX(s.occurred_at) AS latest_created_at
1127
+ FROM spec_summary s LEFT JOIN usage ON usage.spec_id=s.id;
1128
+ CREATE VIEW vw_first_fold_prd_metrics_all_time AS
1129
+ WITH usage AS (
1130
+ SELECT prd_id,
1131
+ COUNT(*) AS total_run_count,
1132
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1133
+ SUM(total_tokens) AS total_tokens,
1134
+ SUM(cost_usd) AS total_cost_usd,
1135
+ SUM(cost_brl) AS total_cost_brl
1136
+ FROM activities WHERE prd_id IS NOT NULL GROUP BY prd_id
1137
+ )
1138
+ SELECT COUNT(*) AS entity_count,
1139
+ SUM(usage.total_run_count) AS total_run_count,
1140
+ SUM(usage.total_duration_ms) AS total_duration_ms,
1141
+ SUM(usage.total_tokens) AS total_tokens,
1142
+ SUM(usage.total_cost_usd) AS total_cost_usd,
1143
+ SUM(usage.total_cost_brl) AS total_cost_brl,
1144
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_duration_ms)/COUNT(*) END AS average_duration_ms,
1145
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_tokens)/COUNT(*) END AS average_tokens,
1146
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_usd)/COUNT(*) END AS average_cost_usd,
1147
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_brl)/COUNT(*) END AS average_cost_brl,
1148
+ MAX(p.occurred_at) AS latest_created_at
1149
+ FROM prd_summary p LEFT JOIN usage ON usage.prd_id=p.id;
1150
+ CREATE VIEW vw_first_fold_top_specs_all_time AS
1151
+ WITH usage AS (
1152
+ SELECT spec_id,
1153
+ COUNT(*) AS total_run_count,
1154
+ SUM(llm_call_count) AS llm_call_count,
1155
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1156
+ SUM(total_tokens) AS total_tokens,
1157
+ SUM(cost_usd) AS total_cost_usd,
1158
+ SUM(cost_brl) AS total_cost_brl
1159
+ FROM activities WHERE spec_id IS NOT NULL GROUP BY spec_id
1160
+ ), ranked AS (
1161
+ SELECT s.id AS entity_id, s.title, s.status, usage.total_run_count, usage.llm_call_count,
1162
+ usage.total_duration_ms, usage.total_tokens, usage.total_cost_usd, usage.total_cost_brl,
1163
+ ROW_NUMBER() OVER (ORDER BY usage.total_duration_ms IS NOT NULL DESC, usage.total_duration_ms DESC, usage.total_run_count DESC, s.id) AS rank
1164
+ FROM spec_summary s LEFT JOIN usage ON usage.spec_id=s.id
1165
+ ), total AS (SELECT SUM(total_duration_ms) AS total_duration_ms FROM ranked)
1166
+ SELECT ranked.rank, ranked.entity_id, ranked.title, ranked.status,
1167
+ COALESCE(ranked.total_run_count,0) AS total_run_count, ranked.llm_call_count,
1168
+ ranked.total_duration_ms, ranked.total_tokens, ranked.total_cost_usd, ranked.total_cost_brl,
1169
+ CASE WHEN total.total_duration_ms IS NULL OR total.total_duration_ms=0 OR ranked.total_duration_ms IS NULL THEN 0.0 ELSE ranked.total_duration_ms/total.total_duration_ms END AS duration_share
1170
+ FROM ranked CROSS JOIN total WHERE ranked.rank<=5 ORDER BY ranked.rank;
1171
+ CREATE VIEW vw_first_fold_top_prds_all_time AS
1172
+ WITH usage AS (
1173
+ SELECT prd_id,
1174
+ COUNT(*) AS total_run_count,
1175
+ SUM(llm_call_count) AS llm_call_count,
1176
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1177
+ SUM(total_tokens) AS total_tokens,
1178
+ SUM(cost_usd) AS total_cost_usd,
1179
+ SUM(cost_brl) AS total_cost_brl
1180
+ FROM activities WHERE prd_id IS NOT NULL GROUP BY prd_id
1181
+ ), ranked AS (
1182
+ SELECT p.id AS entity_id, p.title, p.status, usage.total_run_count, usage.llm_call_count,
1183
+ usage.total_duration_ms, usage.total_tokens, usage.total_cost_usd, usage.total_cost_brl,
1184
+ ROW_NUMBER() OVER (ORDER BY usage.total_duration_ms IS NOT NULL DESC, usage.total_duration_ms DESC, usage.total_run_count DESC, p.id) AS rank
1185
+ FROM prd_summary p LEFT JOIN usage ON usage.prd_id=p.id
1186
+ ), total AS (SELECT SUM(total_duration_ms) AS total_duration_ms FROM ranked)
1187
+ SELECT ranked.rank, ranked.entity_id, ranked.title, ranked.status,
1188
+ COALESCE(ranked.total_run_count,0) AS total_run_count, ranked.llm_call_count,
1189
+ ranked.total_duration_ms, ranked.total_tokens, ranked.total_cost_usd, ranked.total_cost_brl,
1190
+ CASE WHEN total.total_duration_ms IS NULL OR total.total_duration_ms=0 OR ranked.total_duration_ms IS NULL THEN 0.0 ELSE ranked.total_duration_ms/total.total_duration_ms END AS duration_share
1191
+ FROM ranked CROSS JOIN total WHERE ranked.rank<=5 ORDER BY ranked.rank;
1192
+ CREATE VIEW vw_first_fold_top_tasks_all_time AS
1193
+ WITH duration AS (
1194
+ SELECT a.task_id, ROUND(SUM(f.attributed_token_active_ms)) AS total_duration_ms
1195
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id)
1196
+ WHERE a.task_id IS NOT NULL AND a.phase='execution' GROUP BY a.task_id
1197
+ ), usage AS (
1198
+ SELECT task_id, COUNT(*) AS total_run_count, SUM(llm_call_count) AS llm_call_count,
1199
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl
1200
+ FROM activities WHERE task_id IS NOT NULL AND phase='execution' GROUP BY task_id
1201
+ ), ranked AS (
1202
+ SELECT t.id AS task_id, t.title, t.status, t.risk,
1203
+ usage.total_run_count, usage.llm_call_count, duration.total_duration_ms,
1204
+ usage.total_tokens, usage.total_cost_usd, usage.total_cost_brl,
1205
+ ROW_NUMBER() OVER (ORDER BY duration.total_duration_ms DESC, t.id) AS rank
1206
+ FROM duration JOIN task_summary t ON t.id=duration.task_id
1207
+ LEFT JOIN usage ON usage.task_id=duration.task_id
1208
+ ), total AS (SELECT SUM(total_duration_ms) AS total_duration_ms FROM ranked)
1209
+ SELECT ranked.rank, ranked.task_id, ranked.title, ranked.status, ranked.risk,
1210
+ ranked.total_run_count, ranked.llm_call_count, ranked.total_duration_ms,
1211
+ ranked.total_tokens, ranked.total_cost_usd, ranked.total_cost_brl,
1212
+ CASE WHEN total.total_duration_ms IS NULL OR total.total_duration_ms = 0 THEN 0.0 ELSE ranked.total_duration_ms / total.total_duration_ms END AS duration_share
1213
+ FROM ranked CROSS JOIN total WHERE ranked.rank <= 5 ORDER BY ranked.rank;
1214
+ CREATE VIEW vw_first_fold_task_summary AS SELECT * FROM vw_task_summary;
1215
+ CREATE VIEW vw_first_fold_spec_summary AS SELECT * FROM vw_spec_summary;
1216
+ CREATE VIEW vw_first_fold_prd_summary AS SELECT * FROM vw_prd_summary;
1217
+ CREATE VIEW cost_monitor_daily AS SELECT * FROM vw_cost_daily;
1218
+ CREATE VIEW cost_monitor_monthly AS SELECT * FROM vw_cost_monthly;
1219
+ CREATE VIEW cost_monitor_annual AS SELECT * FROM vw_cost_annual;
1220
+ CREATE VIEW cost_monitor_overview_view AS SELECT * FROM vw_cost_overview;
1221
+ CREATE VIEW cost_monitor_executions AS SELECT * FROM vw_cost_executions;
1222
+ CREATE VIEW cost_monitor_agent_invocations AS SELECT * FROM vw_cost_agent_invocations;
1223
+ CREATE VIEW cost_monitor_zaip_agents AS SELECT * FROM vw_cost_zaip_agents;
1224
+ CREATE VIEW cost_monitor_models AS SELECT * FROM vw_cost_models;
1225
+ CREATE VIEW cost_monitor_providers AS SELECT * FROM vw_cost_providers;
1226
+ CREATE VIEW cost_monitor_tasks AS SELECT * FROM vw_cost_tasks;
1227
+ CREATE VIEW cost_monitor_specs AS SELECT * FROM vw_cost_specs;
1228
+ CREATE VIEW cost_monitor_prds AS SELECT * FROM vw_cost_prds;
1229
+ CREATE VIEW cost_monitor_conversations AS SELECT * FROM vw_cost_conversations;
1230
+ CREATE VIEW operations_work_list AS SELECT * FROM vw_operations_work_list;
1231
+ CREATE VIEW operations_work_summary AS SELECT * FROM vw_operations_work_summary;
1232
+ CREATE VIEW operations_work_kanban AS SELECT * FROM vw_operations_work_kanban;
1233
+ CREATE VIEW operations_executions AS SELECT * FROM vw_operations_executions;
1234
+ CREATE VIEW operations_agent_invocations AS SELECT * FROM vw_operations_agent_invocations;
1235
+ CREATE VIEW operations_conversations AS SELECT * FROM vw_operations_conversations;
1236
+ CREATE VIEW operations_decisions AS SELECT * FROM vw_operations_decisions;
1237
+ CREATE VIEW operations_changes AS SELECT * FROM vw_operations_changes;
1238
+ CREATE VIEW operations_daily AS SELECT * FROM vw_operations_daily;
1239
+ CREATE VIEW operations_monthly AS SELECT * FROM vw_operations_monthly;
1240
+ CREATE VIEW operations_annual AS SELECT * FROM vw_operations_annual;
1241
+ CREATE VIEW first_fold_overview AS SELECT * FROM vw_first_fold_overview;
1242
+ CREATE VIEW first_fold_task_status AS SELECT * FROM vw_first_fold_task_status;
1243
+ CREATE VIEW first_fold_task_risk AS SELECT * FROM vw_first_fold_task_risk;
1244
+ CREATE VIEW first_fold_top_tasks AS SELECT * FROM vw_first_fold_top_tasks;
1245
+ CREATE VIEW first_fold_overview_all_time AS SELECT * FROM vw_first_fold_overview_all_time;
1246
+ CREATE VIEW first_fold_task_status_all_time AS SELECT * FROM vw_first_fold_task_status_all_time;
1247
+ CREATE VIEW first_fold_task_risk_all_time AS SELECT * FROM vw_first_fold_task_risk_all_time;
1248
+ CREATE VIEW first_fold_task_metrics_all_time AS SELECT * FROM vw_first_fold_task_metrics_all_time;
1249
+ CREATE VIEW first_fold_top_tasks_all_time AS SELECT * FROM vw_first_fold_top_tasks_all_time;
1250
+ CREATE VIEW first_fold_spec_status_all_time AS SELECT * FROM vw_first_fold_spec_status_all_time;
1251
+ CREATE VIEW first_fold_spec_classification_all_time AS SELECT * FROM vw_first_fold_spec_classification_all_time;
1252
+ CREATE VIEW first_fold_spec_metrics_all_time AS SELECT * FROM vw_first_fold_spec_metrics_all_time;
1253
+ CREATE VIEW first_fold_top_specs_all_time AS SELECT * FROM vw_first_fold_top_specs_all_time;
1254
+ CREATE VIEW first_fold_prd_status_all_time AS SELECT * FROM vw_first_fold_prd_status_all_time;
1255
+ CREATE VIEW first_fold_prd_classification_all_time AS SELECT * FROM vw_first_fold_prd_classification_all_time;
1256
+ CREATE VIEW first_fold_prd_metrics_all_time AS SELECT * FROM vw_first_fold_prd_metrics_all_time;
1257
+ CREATE VIEW first_fold_top_prds_all_time AS SELECT * FROM vw_first_fold_top_prds_all_time;
1258
+ CREATE VIEW first_fold_task AS SELECT * FROM vw_first_fold_task_summary;
1259
+ CREATE VIEW first_fold_spec AS SELECT * FROM vw_first_fold_spec_summary;
1260
+ CREATE VIEW first_fold_prd AS SELECT * FROM vw_first_fold_prd_summary;
1261
+ CREATE VIEW task_summary_daily AS SELECT * FROM vw_task_summary_daily;
1262
+ CREATE VIEW spec_summary_daily AS SELECT * FROM vw_spec_summary_daily;
1263
+ CREATE VIEW prd_summary_daily AS SELECT * FROM vw_prd_summary_daily;
1264
+ CREATE VIEW task_status_daily AS SELECT * FROM vw_task_status_daily;
1265
+ CREATE VIEW task_risk_daily AS SELECT * FROM vw_task_risk_daily;
1266
+ COMMIT;`,PC=[...Gh.matchAll(/\bCREATE VIEW ([A-Za-z_][A-Za-z0-9_]*)/g)].map(K=>K[1]).filter(K=>K!==void 0).reduce((K,we)=>{let se=we.startsWith("vw_")?we.slice(3):we;return K.replace(new RegExp(`\\b${we}\\b`,"g"),`zaip_vw_${se}`)},Gh),Xh=new Set,MC=PC.replace(/\bCREATE VIEW ([A-Za-z_][A-Za-z0-9_]*)[\s\S]*?;/g,(K,we)=>Xh.has(we)?"":(Xh.add(we),K));u.exec(MC),r("projection_finalize",80,"Finalizando \xEDndices e a c\xF3pia local do dashboard."),_=O}catch(g){throw u.exec("ROLLBACK;"),g}}finally{u.close()}try{await(0,et.rename)(d,l)}catch(g){if(qh(l,o)===null)throw await(0,et.rm)(d,{force:!0}),g;await(0,et.rm)(d,{force:!0})}let p=performance.now();await Vh(l,t);let y=new wt(e),f=y.firstFoldViewportAllTime(),h=eK(),k={from_day:h.from,to_day:h.to,source_latest_day:y.firstFoldRelevantLatestDay(),aggregate:y.firstFoldAggregate(h),pages:{task:y.summaryPage("task",h,0,1e4).rows,spec:y.summaryPage("spec",h,0,1e4).rows,prd:y.summaryPage("prd",h,0,1e4).rows},top_tasks:y.topTasks(h)};y.close();let S=JSON.stringify(f),R=JSON.stringify(k);for(let g of[l,t]){let b=new $i.DatabaseSync(g);try{b.prepare(`INSERT INTO zaip_aios_activities(
1267
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
1268
+ recorded_at, run_role, root_run_id, payload_type, payload_json
1269
+ ) VALUES (?, 'technical_payload', 'first_fold_viewport_cache:all_time',
1270
+ 'sqlite://first_fold_viewport_cache/all_time', '', datetime('now'), 'technical', 'technical',
1271
+ 'first_fold_viewport_cache', ?)`).run(`TECH-${(0,bn.randomUUID)().toLowerCase()}`,S),b.prepare(`INSERT INTO zaip_aios_activities(
1272
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
1273
+ recorded_at, run_role, root_run_id, payload_type, payload_json
1274
+ ) VALUES (?, 'technical_payload', 'first_fold_monthly_quick_cache:default',
1275
+ 'sqlite://first_fold_monthly_quick_cache/default', '', datetime('now'), 'technical', 'technical',
1276
+ 'first_fold_monthly_quick_cache', ?)`).run(`TECH-${(0,bn.randomUUID)().toLowerCase()}`,R)}finally{b.close()}}return r("snapshot_ready",86,"A c\xF3pia privada do banco local est\xE1 pronta."),oc(t),await hK((0,st.dirname)(l),l),{files:_,path:t,cache:"rebuilt",fingerprint_ms:a,materialize_ms:Math.round(performance.now()-p)}}async function hK(e,t){let n=await(0,et.readdir)(e,{withFileTypes:!0}).catch(()=>[]),i=await Promise.all(n.filter(r=>r.isFile()&&r.name.endsWith(".sqlite")&&(0,st.resolve)(e,r.name)!==t).map(async r=>({path:(0,st.resolve)(e,r.name),mtime:(await(0,et.stat)((0,st.resolve)(e,r.name))).mtimeMs})));for(let r of i.sort((o,a)=>a.mtime-o.mtime).slice(1))await(0,et.rm)(r.path,{force:!0}).catch(()=>{});for(let r of n){if(!r.isFile()||!r.name.includes(".sqlite.")||!r.name.includes(".tmp"))continue;let o=(0,st.resolve)(e,r.name);Date.now()-(await(0,et.stat)(o)).mtimeMs>6e4&&await(0,et.rm)(o,{force:!0}).catch(()=>{})}}function qh(e,t){try{let n=new $i.DatabaseSync(e,{readOnly:!0}),i=n.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("source_fingerprint")?.value,r=n.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("schema_version")?.value,o=Number(n.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("source_file_count")?.value??0);return n.close(),i===t&&r===fo?o:null}catch{return null}}async function yK(e){let t=await(0,et.readdir)(e,{withFileTypes:!0}).catch(()=>[]),n=await Promise.all(t.filter(i=>i.isFile()&&i.name.endsWith(".sqlite")).map(async i=>({path:(0,st.join)(e,i.name),mtime:(await(0,et.stat)((0,st.join)(e,i.name))).mtimeMs})));for(let i of n.sort((r,o)=>o.mtime-r.mtime)){let r=vK(i.path);if(r!==null)return{path:i.path,files:r}}return null}function vK(e){try{let t=new $i.DatabaseSync(e,{readOnly:!0}),n=t.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("schema_version")?.value,i=Number(t.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("source_file_count")?.value??0);return t.close(),n===fo?i:null}catch{return null}}function vC(e){let t=e.prepare("SELECT name FROM sqlite_master WHERE type = 'view' AND name LIKE 'zaip_vw_%'").all();for(let{name:n}of t){let i=n.slice(8),r=o=>`"${o.replaceAll('"','""')}"`;e.exec(`CREATE TEMP VIEW ${r(i)} AS SELECT * FROM main.${r(n)}`)}}async function Vh(e,t){await(0,et.mkdir)((0,st.dirname)(t),{recursive:!0});let n=`${t}.${process.pid}.${(0,bn.randomUUID)()}.tmp`;await(0,et.copyFile)(e,n);try{await(0,et.rename)(n,t)}catch(i){throw await(0,et.rm)(n,{force:!0}),i}}async function bK(e){let t=(await Promise.all([".agents/records",".agents/config"].map(i=>SC((0,st.resolve)(e,i))))).flat().filter(i=>GJ.has(i.slice(i.lastIndexOf(".")).toLowerCase())&&nK((0,st.relative)(e,i).replaceAll("\\","/"))).sort(),n=await Promise.all(t.map(async i=>{let r=await(0,et.stat)(i);return{path:i,source:(0,st.relative)(e,i).replaceAll("\\","/"),mtimeMs:Math.trunc(r.mtimeMs),size:r.size}}));return{fingerprint:n.map(i=>`${i.source}:${i.mtimeMs}:${i.size}`).join("|"),candidates:n}}var x_={cost_monitor_daily:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_monthly:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_annual:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_overview_view:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_executions:{date:null,id:"execution_id",order:"invocation_count DESC, execution_id DESC"},cost_monitor_agent_invocations:{date:"occurred_day_sp",id:"agent_invocation_id",order:"occurred_at DESC, agent_invocation_id DESC"},cost_monitor_zaip_agents:{date:null,id:"zaip_agent",order:"invocation_count DESC, zaip_agent"},cost_monitor_models:{date:null,id:"model",order:"invocation_count DESC, model"},cost_monitor_providers:{date:null,id:"provider",order:"invocation_count DESC, provider"},cost_monitor_tasks:{date:null,id:"task_id",order:"invocation_count DESC, task_id"},cost_monitor_specs:{date:null,id:"spec_id",order:"invocation_count DESC, spec_id"},cost_monitor_prds:{date:null,id:"prd_id",order:"invocation_count DESC, prd_id"},cost_monitor_conversations:{date:null,id:"conversation_id",order:"invocation_count DESC, conversation_id"},operations_work_list:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_work_kanban:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_executions:{date:null,id:"execution_id",order:"started_at DESC, execution_id DESC"},operations_agent_invocations:{date:"source_day_sp",id:"agent_invocation_id",order:"occurred_at DESC, agent_invocation_id DESC"},operations_conversations:{date:null,id:"conversation_id",order:"started_at DESC, conversation_id DESC"},operations_decisions:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_changes:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_daily:{date:"day",id:"day",order:"day DESC"},operations_monthly:{date:"period_key",id:"period_key",order:"period_key DESC"},operations_annual:{date:"period_key",id:"period_key",order:"period_key DESC"},first_fold_overview:{date:"start_day",id:"period_key",order:"period_key DESC"},first_fold_task_status:{date:"day",id:"status",order:"day DESC, status"},first_fold_task_risk:{date:"day",id:"risk",order:"day DESC, risk"},first_fold_top_tasks:{date:"occurred_day_sp",id:"id",order:"total_duration DESC, id DESC"},first_fold_overview_all_time:{date:null,id:"period_key",order:"period_key"},first_fold_task_status_all_time:{date:null,id:"status",order:"status"},first_fold_task_risk_all_time:{date:null,id:"risk",order:"risk"},first_fold_task_metrics_all_time:{date:null,id:null,order:"task_count DESC"},first_fold_top_tasks_all_time:{date:null,id:"task_id",order:"rank"},first_fold_spec_status_all_time:{date:null,id:"stage",order:"stage"},first_fold_spec_classification_all_time:{date:null,id:"classification",order:"classification"},first_fold_spec_metrics_all_time:{date:null,id:null,order:"entity_count DESC"},first_fold_top_specs_all_time:{date:null,id:"entity_id",order:"rank"},first_fold_prd_status_all_time:{date:null,id:"stage",order:"stage"},first_fold_prd_classification_all_time:{date:null,id:"classification",order:"classification"},first_fold_prd_metrics_all_time:{date:null,id:null,order:"entity_count DESC"},first_fold_top_prds_all_time:{date:null,id:"entity_id",order:"rank"},first_fold_task:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},first_fold_spec:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},first_fold_prd:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"}};async function SC(e){let t=await(0,et.readdir)(e,{withFileTypes:!0}).catch(()=>[]);return(await Promise.all(t.map(async i=>{let r=(0,st.join)(e,i.name);return i.isDirectory()?SC(r):i.isFile()?[r]:[]}))).flat()}var wt=class extends mi{executionDurationCache=new Map;dailyAggregateRowsCache=null;firstFoldAllTimeCache=null;firstFoldTopTasksAllTimeCache=null;firstFoldViewportCache=null;firstFoldMonthlyQuickCache=void 0;firstFoldViewportTimings={};metadataValues=null;unfilteredViewPageCache=new Map;viewPageResultCache=new Map;operationsWorkListPageCache=null;dailyAggregateRows(){return this.dailyAggregateRowsCache===null&&(this.dailyAggregateRowsCache=this.database.prepare("SELECT * FROM daily_aggregate_cache ORDER BY day").all()),this.dailyAggregateRowsCache}operationsWorkListRows(){return this.operationsWorkListPageCache??=this.database.prepare("SELECT * FROM operations_work_list ORDER BY occurred_at DESC, id DESC").all(),this.operationsWorkListPageCache}unfilteredViewRows(t){let n=this.unfilteredViewPageCache.get(t);if(n!==void 0)return n;let i=x_[t].order,r=this.database.prepare(`SELECT * FROM ${t} ORDER BY ${i}`).all();return this.unfilteredViewPageCache.set(t,r),r}database;constructor(t){super(t),this.database=new $i.DatabaseSync(Zh(t),{readOnly:!0}),vC(this.database)}async exists(t){let n=this.database.prepare("SELECT 1 FROM files WHERE path = ? LIMIT 1").get(t),i=this.database.prepare("SELECT 1 FROM files WHERE path LIKE ? LIMIT 1").get(`${t.replace(/\/$/,"")}/%`);return n!==void 0||i!==void 0}async readText(t){let n=this.database.prepare("SELECT content FROM files WHERE path = ?").get(t);if(n?.content===void 0)throw Object.assign(new Error(`SQLite read model is missing ${t}`),{code:"ENOENT"});return n.content}async readBytes(t){return Buffer.from(await this.readText(t),"utf8")}async readTextFrom(t,n){let i=await this.readText(t),r=Buffer.from(i,"utf8");return{content:r.subarray(Math.min(n,r.byteLength)).toString("utf8"),nextOffset:r.byteLength}}async listFiles(t,n=""){let i=`${t.replace(/\/$/,"")}/%`;return this.database.prepare("SELECT path FROM files WHERE path LIKE ? ORDER BY path").all(i).map(o=>o.path).filter(o=>o.endsWith(n))}async listDirectories(t){let n=`${t.replace(/\/$/,"")}/`,i=this.database.prepare("SELECT path FROM files WHERE path LIKE ?").all(`${n}%`);return[...new Set(i.map(r=>r.path.slice(n.length).split("/")[0]).filter(Boolean).map(r=>`${t.replace(/\/$/,"")}/${r}`))].sort()}close(){this.database.close()}reopen(){this.database=new $i.DatabaseSync(Zh(this.root),{readOnly:!0}),vC(this.database),this.executionDurationCache.clear(),this.dailyAggregateRowsCache=null,this.firstFoldAllTimeCache=null,this.firstFoldTopTasksAllTimeCache=null,this.firstFoldViewportCache=null,this.firstFoldMonthlyQuickCache=void 0,this.firstFoldViewportTimings={},this.metadataValues=null,this.viewPageResultCache.clear()}refresh(){this.database.close(),this.reopen()}async rebuildAndRefresh(t){this.database.close();try{await t()}finally{this.reopen()}this.viewPage("cost_monitor_daily",{limit:1,offset:0})}executionDurationByDay(t,n=null){let i=t.from?.slice(0,10)??null,r=t.to?.slice(0,10)??null,o=JSON.stringify({...t,from:i,to:r,taskId:n}),a=this.executionDurationCache.get(o);if(a!==void 0)return new Map(a);let s=["(? IS NULL OR f.occurred_day_sp >= ?)","(? IS NULL OR f.occurred_day_sp <= ?)","(? IS NULL OR a.task_id = ?)"],l=[i,i,r,r,n,n],c=(t.providers??[]).filter(f=>f!=="unavailable"),d=(t.models??[]).filter(f=>f!=="unavailable");if(t.providers?.includes("unavailable")===!0||t.models?.includes("unavailable")===!0){let f=(h,k)=>{if(k===void 0||k.length===0)return;let S=k.filter(b=>b!=="unavailable"),R=S.length===0?"0":`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=a.agent_run_id AND u.${h} IN (${S.map(()=>"?").join(",")}))`;S.length>0&&l.push(...S);let g=`NOT EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=a.agent_run_id AND u.${h} IS NOT NULL AND u.${h} <> 'unavailable')`;s.push(k.includes("unavailable")?`(${R} OR ${g})`:R)};f("provider",t.providers),f("model",t.models)}else if(c.length>0||d.length>0){let f=[];c.length>0&&(f.push(`u.provider IN (${c.map(()=>"?").join(",")})`),l.push(...c)),d.length>0&&(f.push(`u.model IN (${d.map(()=>"?").join(",")})`),l.push(...d)),s.push(`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=a.agent_run_id AND ${f.join(" AND ")})`)}let _=[["zaip_agent",t.agents],["phase",t.phases],["status",t.statuses]];for(let[f,h]of _)h===void 0||h.length===0||(s.push(`a.${f} IN (${h.map(()=>"?").join(",")})`),l.push(...h));let p=this.database.prepare(`SELECT f.occurred_day_sp AS day, SUM(f.attributed_token_active_ms) AS duration_ms
1277
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id)
1278
+ WHERE ${s.join(" AND ")} GROUP BY f.occurred_day_sp`).all(...l),y=new Map(p.map(f=>[f.day,Number(f.duration_ms)]));return this.executionDurationCache.set(o,y),new Map(y)}canonicalRunCountByDay(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=["(? IS NULL OR occurred_day_sp >= ?)","(? IS NULL OR occurred_day_sp <= ?)"],o=[n,n,i,i],a=(t.providers??[]).filter(u=>u!=="unavailable"),s=(t.models??[]).filter(u=>u!=="unavailable");if(t.providers?.includes("unavailable")===!0||t.models?.includes("unavailable")===!0){let u=(_,p)=>{if(p===void 0||p.length===0)return;let y=p.filter(k=>k!=="unavailable"),f=y.length===0?"0":`EXISTS (SELECT 1 FROM invocations i JOIN invocation_usage u USING(agent_invocation_id) WHERE i.run_id=canonical_run_index.run_id AND u.${_} IN (${y.map(()=>"?").join(",")}))`;y.length>0&&o.push(...y);let h=`NOT EXISTS (SELECT 1 FROM invocations i JOIN invocation_usage u USING(agent_invocation_id) WHERE i.run_id=canonical_run_index.run_id AND u.${_} IS NOT NULL AND u.${_} <> 'unavailable')`;r.push(p.includes("unavailable")?`(${f} OR ${h})`:f)};u("provider",t.providers),u("model",t.models)}else if(a.length>0||s.length>0){let u=[];a.length>0&&(u.push(`u.provider IN (${a.map(()=>"?").join(",")})`),o.push(...a)),s.length>0&&(u.push(`u.model IN (${s.map(()=>"?").join(",")})`),o.push(...s)),r.push(`EXISTS (SELECT 1 FROM invocations i JOIN invocation_usage u USING(agent_invocation_id) WHERE i.run_id=canonical_run_index.run_id AND ${u.join(" AND ")})`)}let c=[["zaip_agent",t.agents],["phase",t.phases],["status",t.statuses]];for(let[u,_]of c)_===void 0||_.length===0||(r.push(`${u} IN (${_.map(()=>"?").join(",")})`),o.push(..._));let d=this.database.prepare(`SELECT occurred_day_sp AS day, COUNT(*) AS count FROM canonical_run_index WHERE ${r.join(" AND ")} GROUP BY occurred_day_sp`).all(...o);return new Map(d.map(u=>[u.day,Number(u.count)]))}dailyPeriods(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=this.executionDurationByDay(t),o=this.dailyAggregateRows().filter(l=>{let c=String(l.day);return(n===null||c>=n)&&(i===null||c<=i)}),a=new Map(o.map(l=>[String(l.day),l])),s=[...new Set([...a.keys(),...r.keys()])].sort();return Object.fromEntries(s.map(l=>{let c=a.get(l)??{},d=Number(c.total_run_count??0),u=Number(c.activity_count??0),_=Math.max(0,d-u);return[l,{prds:Number(c.prd_count??0),specs:Number(c.spec_count??0),tasks:Number(c.task_count??0),validations:Number(c.validation_count??0),evidences:Number(c.evidence_count??0),runs:Number(c.total_run_count??0),usage:{total_tokens:{known_sum:Number(c.total_tokens??0),unknown:_},cost:{known_sum:Number(c.total_cost_brl??0),unknown:_}},duration:{known_sum:r.get(l)??0,unknown:r.has(l)?0:Number(c.total_run_count??0)}}]}))}firstFoldAggregate(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=this.dailyAggregateRows().filter(l=>{let c=String(l.day);return(n===null||c>=n)&&(i===null||c<=i)}),o=l=>{let c=r.map(d=>d[l]).filter(d=>typeof d=="number");return c.length===0?null:c.reduce((d,u)=>d+u,0)},a=this.executionDurationByDay(t),s=[...a.values()].reduce((l,c)=>l+c,0);return{days:r.length,total_run_count:o("total_run_count")??0,agent_invocation_count:o("invocation_count")??0,llm_call_count:o("llm_call_count"),duration_ms:a.size===0?null:s,total_tokens:o("total_tokens"),cost_brl:o("total_cost_brl"),execution_day_count:a.size}}firstFoldMonthlyQuick(t){if(this.firstFoldMonthlyQuickCache===void 0){let c=this.database.prepare("SELECT payload_json FROM zaip_aios_activities WHERE payload_type='first_fold_monthly_quick_cache' ORDER BY recorded_at DESC LIMIT 1").get();try{let d=typeof c?.payload_json=="string"?JSON.parse(c.payload_json):null;this.firstFoldMonthlyQuickCache=d!==null&&typeof d.from_day=="string"&&typeof d.to_day=="string"&&d.aggregate!==void 0&&d.pages!==void 0&&Array.isArray(d.top_tasks)?d:null}catch{this.firstFoldMonthlyQuickCache=null}}let n=this.firstFoldMonthlyQuickCache;if(n===null)return null;let i=t.from?.slice(0,10)??null,r=t.to?.slice(0,10)??null,o=i===n.from_day&&r===n.to_day,a=i===n.from_day&&r!==null&&r>n.to_day&&r.slice(0,7)===n.from_day.slice(0,7),s=n.source_latest_day===null||n.source_latest_day<=n.to_day;return o||a&&s?n:i!==null&&r!==null&&i.slice(0,7)>(n.source_latest_day===null?n.from_day.slice(0,7):n.source_latest_day.slice(0,7))?{from_day:i,to_day:r,source_latest_day:n.source_latest_day,aggregate:{days:0,total_run_count:0,agent_invocation_count:0,llm_call_count:null,duration_ms:null,total_tokens:null,cost_brl:null,execution_day_count:0},pages:{task:[],spec:[],prd:[]},top_tasks:[]}:null}firstFoldRelevantLatestDay(){let t=this.database.prepare(`SELECT MAX(day) AS day FROM (
1279
+ SELECT occurred_day_sp AS day FROM activities
1280
+ UNION ALL SELECT occurred_day_sp AS day FROM canonical_work_items
1281
+ UNION ALL SELECT occurred_day_sp AS day FROM canonical_artifacts
1282
+ UNION ALL SELECT occurred_day_sp AS day FROM canonical_run_index
1283
+ UNION ALL SELECT occurred_day_sp AS day FROM attributed_token_active_facts
1284
+ )`).get();return typeof t.day=="string"?t.day:null}firstFoldAllTime(){if(this.firstFoldAllTimeCache!==null)return this.firstFoldAllTimeCache;let t=this.database.prepare("SELECT * FROM zaip_vw_first_fold_overview_all_time").get(),n=this.database.prepare("SELECT status, task_count FROM zaip_vw_first_fold_task_status_all_time").all(),i=this.database.prepare("SELECT risk, task_count FROM zaip_vw_first_fold_task_risk_all_time").all(),r=this.database.prepare("SELECT * FROM zaip_vw_first_fold_task_metrics_all_time").get(),o=this.database.prepare("SELECT * FROM zaip_vw_first_fold_top_tasks_all_time ORDER BY rank").all(),a=(c,d=0)=>typeof c=="number"?c:d,s=c=>typeof c=="number"?c:null,l=c=>{let d=this.database.prepare(`SELECT stage, entity_count FROM zaip_vw_first_fold_${c}_status_all_time`).all(),u=this.database.prepare(`SELECT classification, entity_count FROM zaip_vw_first_fold_${c}_classification_all_time`).all(),_=this.database.prepare(`SELECT * FROM zaip_vw_first_fold_${c}_metrics_all_time`).get(),p=this.database.prepare(`SELECT * FROM zaip_vw_first_fold_top_${c}s_all_time ORDER BY rank`).all();return{status_counts:Object.fromEntries(d.map(y=>[y.stage,Number(y.entity_count)])),classification_counts:Object.fromEntries(u.map(y=>[y.classification,Number(y.entity_count)])),entity_count:a(_.entity_count),total_run_count:a(_.total_run_count),total_duration_ms:s(_.total_duration_ms),total_tokens:s(_.total_tokens),total_cost_usd:s(_.total_cost_usd),total_cost_brl:s(_.total_cost_brl),average_duration_ms:s(_.average_duration_ms),average_tokens:s(_.average_tokens),average_cost_usd:s(_.average_cost_usd),average_cost_brl:s(_.average_cost_brl),latest_created_at:typeof _.latest_created_at=="string"?_.latest_created_at:null,top_entities:p}};return this.firstFoldAllTimeCache={aggregate:{days:typeof t.start_day=="string"&&typeof t.end_day=="string"?this.dailyAggregateRows().length:0,start_day:typeof t.start_day=="string"?t.start_day:null,end_day:typeof t.end_day=="string"?t.end_day:null,task_count:a(t.task_count),completed_task_count:a(t.completed_task_count),spec_count:a(t.spec_count),completed_spec_count:a(t.completed_spec_count),prd_count:a(t.prd_count),completed_prd_count:a(t.completed_prd_count),total_run_count:a(t.total_run_count),agent_invocation_count:a(t.agent_invocation_count),llm_call_count:s(t.llm_call_count),duration_ms:s(t.total_duration_ms),total_tokens:s(t.total_tokens),total_cost_usd:s(t.total_cost_usd),cost_brl:s(t.total_cost_brl),execution_day_count:a(t.execution_day_count),latest_task_created_at:typeof t.latest_task_created_at=="string"?t.latest_task_created_at:null},task_status_counts:Object.fromEntries(n.map(c=>[c.status,Number(c.task_count)])),task_risk_counts:Object.fromEntries(i.map(c=>[c.risk,Number(c.task_count)])),task_metrics:{average_duration_ms_per_task:s(r.average_duration_ms_per_task),average_tokens_per_task:s(r.average_tokens_per_task),average_cost_usd_per_task:s(r.average_cost_usd_per_task),average_cost_brl_per_task:s(r.average_cost_brl_per_task),latest_task_created_at:typeof r.latest_task_created_at=="string"?r.latest_task_created_at:null},top_tasks:o,macro_metrics:{specs:l("spec"),prds:l("prd")}},this.firstFoldAllTimeCache}firstFoldTopTasksAllTime(){return this.firstFoldTopTasksAllTimeCache!==null?this.firstFoldTopTasksAllTimeCache:(this.firstFoldTopTasksAllTimeCache=this.database.prepare("SELECT * FROM zaip_vw_first_fold_top_tasks_all_time ORDER BY rank").all(),this.firstFoldTopTasksAllTimeCache)}firstFoldViewportAllTime(){if(this.firstFoldViewportCache!==null)return this.firstFoldViewportCache;let t=this.database.prepare("SELECT payload_json FROM zaip_aios_activities WHERE payload_type='first_fold_viewport_cache' ORDER BY recorded_at DESC LIMIT 1").get();if(typeof t?.payload_json=="string")return this.firstFoldViewportCache=JSON.parse(t.payload_json),this.firstFoldViewportCache;let n=process.env.ZAIP_DASHBOARD_PROFILE_FIRST_FOLD==="1",r=((s,l)=>{let c=performance.now(),d=l();return n&&(this.firstFoldViewportTimings[s]=Math.round((performance.now()-c)*10)/10),n&&console.info(JSON.stringify({event:"dashboard_first_fold_select",select:s,elapsed_ms:Math.round((performance.now()-c)*10)/10})),d})("viewport_overview",()=>this.database.prepare(`WITH totals AS (
1285
+ SELECT SUM(CASE WHEN activity_source_kind='agent_run' THEN 1 ELSE 0 END) AS agent_invocation_count,
1286
+ SUM(llm_call_count) AS llm_call_count,
1287
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd,
1288
+ SUM(cost_brl) AS total_cost_brl FROM activities
1289
+ ), run_totals AS (
1290
+ SELECT COUNT(*) AS total_run_count FROM canonical_run_index
1291
+ ), duration_totals AS (
1292
+ SELECT ROUND(SUM(attributed_token_active_ms)) AS total_duration_ms,
1293
+ COUNT(DISTINCT occurred_day_sp) AS execution_day_count
1294
+ FROM attributed_token_active_facts
1295
+ ), bounds AS (
1296
+ SELECT MIN(day) AS start_day, MAX(day) AS end_day, COUNT(*) AS day_count FROM (
1297
+ SELECT occurred_day_sp AS day FROM activities
1298
+ UNION SELECT occurred_day_sp AS day FROM canonical_work_items
1299
+ UNION SELECT occurred_day_sp AS day FROM canonical_artifacts
1300
+ )
1301
+ ), canonical_items AS MATERIALIZED (
1302
+ SELECT json_extract(payload_json, '$.entity_kind') AS entity_kind,
1303
+ json_extract(payload_json, '$.id') AS id,
1304
+ json_extract(payload_json, '$.status') AS status,
1305
+ json_extract(payload_json, '$.risk') AS risk,
1306
+ json_extract(payload_json, '$.occurred_at') AS occurred_at
1307
+ FROM zaip_aios_activities WHERE payload_type='work_item'
1308
+ ), items AS MATERIALIZED (
1309
+ SELECT entity_kind, id, status, risk, occurred_at FROM canonical_items
1310
+ UNION ALL SELECT 'task', a.task_id, MAX(a.work_item_status), MAX(a.risk), MIN(a.occurred_at)
1311
+ FROM zaip_aios_activities a WHERE a.payload_type IS NULL AND a.task_id IS NOT NULL
1312
+ AND NOT EXISTS (SELECT 1 FROM canonical_items c WHERE c.entity_kind='task' AND c.id=a.task_id)
1313
+ GROUP BY task_id
1314
+ UNION ALL SELECT 'spec', a.spec_id, MAX(a.work_item_status), MAX(a.risk), MIN(a.occurred_at)
1315
+ FROM zaip_aios_activities a WHERE a.payload_type IS NULL AND a.spec_id IS NOT NULL
1316
+ AND NOT EXISTS (SELECT 1 FROM canonical_items c WHERE c.entity_kind='spec' AND c.id=a.spec_id)
1317
+ GROUP BY spec_id
1318
+ UNION ALL SELECT 'prd', a.prd_id, MAX(a.work_item_status), MAX(a.risk), MIN(a.occurred_at)
1319
+ FROM zaip_aios_activities a WHERE a.payload_type IS NULL AND a.prd_id IS NOT NULL
1320
+ AND NOT EXISTS (SELECT 1 FROM canonical_items c WHERE c.entity_kind='prd' AND c.id=a.prd_id)
1321
+ GROUP BY prd_id
1322
+ ), item_totals AS (
1323
+ SELECT
1324
+ SUM(entity_kind='task') AS task_count,
1325
+ SUM(entity_kind='task' AND status='completed') AS completed_task_count,
1326
+ MAX(CASE WHEN entity_kind='task' THEN occurred_at END) AS latest_task_created_at,
1327
+ SUM(entity_kind='spec') AS spec_count,
1328
+ SUM(entity_kind='spec' AND status IN ('completed','delivered')) AS completed_spec_count,
1329
+ SUM(entity_kind='prd') AS prd_count,
1330
+ SUM(entity_kind='prd' AND status IN ('completed','delivered')) AS completed_prd_count
1331
+ FROM items
1332
+ ), task_status AS (
1333
+ SELECT json_group_object(status, task_count) AS task_status_json FROM (
1334
+ SELECT COALESCE(status, 'draft') AS status, COUNT(*) AS task_count
1335
+ FROM items WHERE entity_kind='task' GROUP BY COALESCE(status, 'draft')
1336
+ )
1337
+ ), task_risk AS (
1338
+ SELECT json_group_object(risk, task_count) AS task_risk_json FROM (
1339
+ SELECT COALESCE(risk, 'standard') AS risk, COUNT(*) AS task_count
1340
+ FROM items WHERE entity_kind='task' GROUP BY COALESCE(risk, 'standard')
1341
+ )
1342
+ ) SELECT totals.*, run_totals.*, duration_totals.*, bounds.*, item_totals.*, task_status.*, task_risk.*
1343
+ FROM totals CROSS JOIN run_totals CROSS JOIN duration_totals CROSS JOIN bounds
1344
+ CROSS JOIN item_totals CROSS JOIN task_status CROSS JOIN task_risk`).get()),o=(s,l=0)=>typeof s=="number"?s:l,a=s=>typeof s=="number"?s:null;return this.firstFoldViewportCache={aggregate:{days:o(r.day_count),start_day:typeof r.start_day=="string"?r.start_day:null,end_day:typeof r.end_day=="string"?r.end_day:null,task_count:o(r.task_count),completed_task_count:o(r.completed_task_count),spec_count:o(r.spec_count),completed_spec_count:o(r.completed_spec_count),prd_count:o(r.prd_count),completed_prd_count:o(r.completed_prd_count),total_run_count:o(r.total_run_count),agent_invocation_count:o(r.agent_invocation_count),llm_call_count:a(r.llm_call_count),duration_ms:a(r.total_duration_ms),total_tokens:a(r.total_tokens),total_cost_usd:a(r.total_cost_usd),cost_brl:a(r.total_cost_brl),execution_day_count:o(r.execution_day_count),latest_task_created_at:typeof r.latest_task_created_at=="string"?r.latest_task_created_at:null},task_status_counts:typeof r.task_status_json=="string"?JSON.parse(r.task_status_json):{},task_risk_counts:typeof r.task_risk_json=="string"?JSON.parse(r.task_risk_json):{}},this.firstFoldViewportCache}firstFoldViewportProfile(){return this.firstFoldViewportTimings}topTasks(t,n=5){let i=t.from?.slice(0,10)??null,r=t.to?.slice(0,10)??null,o=this.database.prepare(`SELECT task_id, SUM(total_tokens) AS total_tokens, SUM(cost_brl) AS cost_brl, COUNT(*) AS run_count
1345
+ FROM activities WHERE task_id IS NOT NULL AND phase = 'execution'
1346
+ AND (? IS NULL OR occurred_day_sp >= ?) AND (? IS NULL OR occurred_day_sp <= ?)
1347
+ GROUP BY task_id`).all(i,i,r,r),a=this.database.prepare(`SELECT a.task_id, SUM(f.attributed_token_active_ms) AS duration_ms
1348
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id)
1349
+ WHERE a.task_id IS NOT NULL AND a.phase = 'execution'
1350
+ AND (? IS NULL OR f.occurred_day_sp >= ?) AND (? IS NULL OR f.occurred_day_sp <= ?)
1351
+ GROUP BY a.task_id`).all(i,i,r,r),s=new Map(a.map(l=>[l.task_id,Number(l.duration_ms)]));return o.map(l=>({...l,duration_ms:s.get(l.task_id)??0})).filter(l=>l.duration_ms>0).sort((l,c)=>c.duration_ms-l.duration_ms||l.task_id.localeCompare(c.task_id)).slice(0,n)}canonicalTraceFiles(t){let n=[...new Set(t.filter(Boolean))];if(n.length===0)return[];let i=n.map(()=>"content LIKE ?").join(" OR ");return this.database.prepare(`SELECT path, content FROM files
1352
+ WHERE path LIKE '.agents/records/%' AND (${i}) ORDER BY path`).all(...n.map(r=>`%${r}%`))}taskTraceUsage(t){let n=this.database.prepare(`SELECT run_id, run_role, phase, duration_ms FROM canonical_run_index
1353
+ WHERE task_id = ?`).all(t),i=this.database.prepare("SELECT run_id, total_tokens, cost_brl FROM activities WHERE task_id = ?").all(t),r=n.filter(d=>d.run_role==="root"&&d.phase==="execution"&&typeof d.duration_ms=="number").length,o=this.executionDurationByDay({from:null,to:null},t),a=o.size===0?null:[...o.values()].reduce((d,u)=>d+u,0),s=i.filter(d=>typeof d.total_tokens=="number"),l=i.filter(d=>typeof d.cost_brl=="number"),c=(d,u)=>({value:d,known_runs:u,unknown_runs:Math.max(0,n.length-u),coverage_ratio:n.length===0?1:u/n.length});return{run_count:n.length,duration_ms:c(a,r),total_tokens:c(s.length===0?null:s.reduce((d,u)=>d+Number(u.total_tokens),0),s.length),cost:{...c(l.length===0?null:l.reduce((d,u)=>d+Number(u.cost_brl),0),l.length),currency:l.length===0?null:"BRL"}}}invocationTotals(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null;return this.database.prepare("SELECT COUNT(*) AS invocation_count, SUM(llm_call_count) AS llm_call_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl FROM invocations WHERE (? IS NULL OR occurred_day_sp >= ?) AND (? IS NULL OR occurred_day_sp <= ?)").get(n,n,i,i)}invocationCostRows(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r="date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')",o=[`(? IS NULL OR ${r} >= ?)`,`(? IS NULL OR ${r} <= ?)`],a=[n,n,i,i],s=(u,_)=>{_!==void 0&&_.length>0&&(o.push(`${u} IN (${_.map(()=>"?").join(",")})`),a.push(..._))};s("i.zaip_agent",t.agents),s("i.phase",t.phases),s("i.status",t.statuses),s("i.task_id",t.tasks),s("i.spec_id",t.specs),s("i.prd_id",t.prds),s("i.execution_id",t.executions),s("i.change_id",t.changes);let l=(t.providers??[]).filter(u=>u!=="unavailable"),c=(t.models??[]).filter(u=>u!=="unavailable");if(t.providers?.includes("unavailable")===!0||t.models?.includes("unavailable")===!0){let u=(_,p)=>{if(p===void 0||p.length===0)return;let y=p.filter(S=>S!=="unavailable"),f=p.includes("unavailable"),h=y.length===0?"0":`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id = i.agent_invocation_id AND f.${_} IN (${y.map(()=>"?").join(",")}))`;y.length>0&&a.push(...y);let k=`NOT EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id = i.agent_invocation_id AND f.${_} IS NOT NULL AND f.${_} <> 'unavailable')`;o.push(f?`(${h} OR ${k})`:h)};u("provider",t.providers),u("model",t.models)}else if(l.length>0||c.length>0){let u=[];l.length>0&&(u.push(`f.provider IN (${l.map(()=>"?").join(",")})`),a.push(...l)),c.length>0&&(u.push(`f.model IN (${c.map(()=>"?").join(",")})`),a.push(...c)),o.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id = i.agent_invocation_id AND ${u.join(" AND ")})`)}return this.database.prepare(`SELECT i.*, CASE COUNT(DISTINCT s.provider) WHEN 0 THEN NULL WHEN 1 THEN MIN(s.provider) ELSE 'mixed' END AS provider, CASE COUNT(DISTINCT s.model) WHEN 0 THEN NULL WHEN 1 THEN MIN(s.model) ELSE 'mixed' END AS model,
1354
+ SUM(s.input_tokens) AS input_tokens, SUM(s.cached_input_tokens) AS cached_input_tokens,
1355
+ SUM(s.output_tokens) AS output_tokens, SUM(s.reasoning_tokens) AS reasoning_tokens,
1356
+ SUM(s.total_tokens) AS total_tokens, SUM(s.cost_usd) AS cost_usd, SUM(s.cost_brl) AS cost_brl
1357
+ FROM invocations i LEFT JOIN invocation_usage s USING(agent_invocation_id)
1358
+ WHERE ${o.join(" AND ")}
1359
+ GROUP BY i.agent_invocation_id ORDER BY i.occurred_at`).all(...a)}costMonitorFactualDurationByDay(t,n=this.costMonitorFinancialActivityRows(t)){let i=n,r=new Set,o=new Map;for(let u of i){let _=typeof u.source_started_at=="string"?u.source_started_at:typeof u.source_occurred_at=="string"?u.source_occurred_at:typeof u.occurred_at=="string"?u.occurred_at:null;if(_===null||!(typeof u.total_tokens=="number"||typeof u.cost_brl=="number"||typeof u.cost_usd=="number"))continue;let y=typeof u.activity_row_id=="string"||typeof u.activity_row_id=="number"?String(u.activity_row_id):String(u.run_id??_);r.add(y)}let a=new Map,s=new Set,l=this.database.prepare("SELECT 1 AS present FROM sqlite_master WHERE name = 'attributed_token_active_facts'").get()!==void 0?"attributed_token_active_facts":"zaip_vw_attributed_token_active_facts",c=Array.from(r);for(let u=0;u<c.length;u+=900){let _=c.slice(u,u+900),p=this.database.prepare(`SELECT activity_row_id, occurred_day_sp, attributed_token_active_ms
1360
+ FROM ${l}
1361
+ WHERE activity_row_id IN (${_.map(()=>"?").join(",")})`).all(..._);for(let y of p){let f=String(y.activity_row_id),h=String(y.occurred_day_sp),k=Number(y.attributed_token_active_ms);if(!Number.isFinite(k)||k<0)continue;let S=a.get(h)??{known_sum:0,activityIds:new Set};S.known_sum+=k,S.activityIds.add(f),a.set(h,S),s.add(f)}}for(let u of i){let _=typeof u.activity_row_id=="string"||typeof u.activity_row_id=="number"?String(u.activity_row_id):null;if(_===null||s.has(_))continue;let p=typeof u.source_started_at=="string"?u.source_started_at:typeof u.source_occurred_at=="string"?u.source_occurred_at:typeof u.occurred_at=="string"?u.occurred_at:null;if(p===null)continue;let y=dn(p),f=o.get(y)??new Set;f.add(_),o.set(y,f)}let d=new Map;for(let u of new Set([...a.keys(),...o.keys()])){let _=a.get(u)??{known_sum:0,activityIds:new Set},p=o.get(u)??new Set;d.set(u,{known_sum:_.known_sum,eligible_runs:new Set([..._.activityIds,...p]).size,known_runs:_.activityIds.size})}return d}activityCostRows(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=["(? IS NULL OR i.occurred_day_sp >= ?)","(? IS NULL OR i.occurred_day_sp <= ?)"],o=[n,n,i,i],a=(s,l)=>{l!==void 0&&l.length>0&&(r.push(`${s} IN (${l.map(()=>"?").join(",")})`),o.push(...l))};return a("i.zaip_agent",t.agents),a("i.provider",t.providers),a("i.model",t.models),a("i.phase",t.phases),a("i.status",t.statuses),a("i.task_id",t.tasks),a("i.spec_id",t.specs),a("i.prd_id",t.prds),a("i.execution_id",t.executions),a("i.change_id",t.changes),this.database.prepare(`SELECT i.*, i.activity_row_id AS agent_invocation_id,
1362
+ i.parent_run_id AS parent_agent_invocation_id
1363
+ FROM activities i WHERE ${r.join(" AND ")} ORDER BY i.occurred_at`).all(...o)}costMonitorFinancialActivityRows(t){let{from:n,to:i,providers:r=[],models:o=[]}=t,a=Ht(n),s=Ht(i),l="date(COALESCE(a.source_started_at, a.source_occurred_at, a.occurred_at), '-3 hours')",c=["(a.total_tokens IS NOT NULL OR a.cost_brl IS NOT NULL OR a.cost_usd IS NOT NULL)",`(? IS NULL OR ${l} >= ?)`,`(? IS NULL OR ${l} <= ?)`],d=[a,a,s,s],u=(_,p)=>{p!==void 0&&p.length>0&&(c.push(`a.${_} IN (${p.map(()=>"?").join(",")})`),d.push(...p))};if(u("zaip_agent",t.agents),u("phase",t.phases),u("status",t.statuses),u("task_id",t.tasks),u("spec_id",t.specs),u("prd_id",t.prds),u("execution_id",t.executions),u("change_id",t.changes),r.length>0||o.length>0){let _=[];r.length>0&&_.push(`COALESCE(u.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),o.length>0&&_.push(`COALESCE(u.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`);let p=[...r,...o],y=[];r.length>0&&y.push(`COALESCE(a.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),o.length>0&&y.push(`COALESCE(a.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`),c.push(`((a.agent_run_id IS NULL AND ${y.join(" AND ")}) OR (a.agent_run_id IS NOT NULL AND EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id = a.agent_run_id AND ${_.join(" AND ")})))`),d.push(...r,...o,...p)}return this.database.prepare(`SELECT
1364
+ a.activity_row_id, a.agent_run_id, a.parent_run_id,
1365
+ a.source_started_at, a.source_finished_at, a.source_occurred_at,
1366
+ a.occurred_at, a.occurred_day_sp, a.run_id,
1367
+ a.task_id, a.execution_id, a.spec_id, a.prd_id, a.change_id,
1368
+ a.zaip_agent, a.provider, a.model, a.phase, a.status,
1369
+ a.duration_ms, a.source_duration_ms, a.duration_provenance,
1370
+ a.total_tokens, a.input_tokens, a.cached_input_tokens,
1371
+ a.output_tokens, a.reasoning_tokens, a.cost_usd, a.cost_brl,
1372
+ a.source_event_count,
1373
+ a.activity_row_id AS agent_invocation_id,
1374
+ a.parent_run_id AS parent_agent_invocation_id
1375
+ FROM activities a WHERE ${c.join(" AND ")} ORDER BY a.occurred_at`).all(...d)}costMonitorSummaryAggregate(t){let{from:n,to:i,providers:r=[],models:o=[]}=t,a=Ht(n),s=Ht(i),l="date(COALESCE(a.source_started_at, a.source_occurred_at, a.occurred_at), '-3 hours')",c=["(a.total_tokens IS NOT NULL OR a.cost_brl IS NOT NULL OR a.cost_usd IS NOT NULL)",`(? IS NULL OR ${l} >= ?)`,`(? IS NULL OR ${l} <= ?)`],d=[a,a,s,s],u=(W,ce)=>{ce===void 0||ce.length===0||(c.push(`a.${W} IN (${ce.map(()=>"?").join(",")})`),d.push(...ce))};if(u("zaip_agent",t.agents),u("phase",t.phases),u("status",t.statuses),u("task_id",t.tasks),u("spec_id",t.specs),u("prd_id",t.prds),u("execution_id",t.executions),u("change_id",t.changes),r.length>0||o.length>0){let W=[],ce=[],fe=[],Re=[];r.length>0&&(W.push(`COALESCE(u.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),ce.push(`COALESCE(a.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),fe.push(...r),Re.push(...r)),o.length>0&&(W.push(`COALESCE(u.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`),ce.push(`COALESCE(a.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`),fe.push(...o),Re.push(...o)),c.push(`((a.agent_run_id IS NULL AND ${ce.join(" AND ")}) OR (a.agent_run_id IS NOT NULL AND a.agent_run_id IN (SELECT u.agent_invocation_id FROM invocation_usage u WHERE ${W.join(" AND ")})))`),d.push(...Re,...fe)}let _=`WITH selected AS (
1376
+ SELECT ${l} AS day,
1377
+ CASE WHEN a.phase='conversation' THEN 'conversation'
1378
+ WHEN a.phase='planning' THEN 'planning' ELSE 'execution' END AS phase_key,
1379
+ a.task_id, a.model, a.agent_run_id, a.activity_source_kind,
1380
+ a.source_event_count AS event_count,
1381
+ a.attributed_token_active_ms AS duration_ms,
1382
+ a.input_tokens, a.cached_input_tokens, a.output_tokens, a.reasoning_tokens,
1383
+ a.total_tokens, a.cost_usd, a.cost_brl
1384
+ FROM activities a WHERE ${c.join(" AND ")}
1385
+ )`,y=this.database.prepare(`${_}
1386
+ SELECT day, phase_key, COUNT(*) AS eligible_runs,
1387
+ json_group_array(DISTINCT task_id) AS task_ids_json,
1388
+ COALESCE(SUM(event_count), 0) AS events,
1389
+ SUM(duration_ms) AS duration_ms,
1390
+ SUM(input_tokens) AS input_tokens,
1391
+ SUM(cached_input_tokens) AS cached_input_tokens,
1392
+ SUM(output_tokens) AS output_tokens,
1393
+ SUM(reasoning_tokens) AS reasoning_tokens,
1394
+ SUM(total_tokens) AS total_tokens,
1395
+ SUM(cost_usd) AS cost_usd,
1396
+ SUM(cost_brl) AS cost_brl,
1397
+ COUNT(duration_ms) AS duration_known,
1398
+ COUNT(total_tokens) AS tokens_known,
1399
+ COUNT(cost_usd) AS usd_known,
1400
+ COUNT(cost_brl) AS brl_known
1401
+ FROM selected GROUP BY day, phase_key ORDER BY day, phase_key`).all(...d),f=["duration_ms","input_tokens","cached_input_tokens","output_tokens","reasoning_tokens","total_tokens","cost_usd","cost_brl"],h=["eligible_runs","events","duration_known","tokens_known","usd_known","brl_known"],k=(W,ce)=>{let fe={key:W};for(let Ue of h)fe[Ue]=ce.reduce((pt,Et)=>pt+(typeof Et[Ue]=="number"?Number(Et[Ue]):0),0);for(let Ue of f){let pt=ce.filter(Et=>typeof Et[Ue]=="number");fe[Ue]=pt.length===0?null:pt.reduce((Et,Pt)=>Et+Number(Pt[Ue]),0)}let Re=new Set;for(let Ue of ce)if(typeof Ue.task_ids_json=="string")for(let pt of JSON.parse(Ue.task_ids_json))typeof pt=="string"&&Re.add(pt);return fe.task_count=Re.size,fe},R=["conversation","planning","execution"].map(W=>k(W,y.filter(ce=>ce.phase_key===W)));R.push(k("total",y));let g=[...new Set(y.map(W=>String(W.day)))].map(W=>k(W,y.filter(ce=>String(ce.day)===W))),b=this.database.prepare(`WITH canonical_ids AS MATERIALIZED (
1402
+ SELECT entity_kind AS kind, id FROM canonical_work_items
1403
+ ), work_item_days AS (
1404
+ SELECT entity_kind AS kind, id, occurred_day_sp AS day FROM canonical_work_items
1405
+ UNION ALL
1406
+ SELECT 'task', a.task_id, MIN(a.occurred_day_sp) FROM activities a
1407
+ LEFT JOIN canonical_ids c ON c.kind='task' AND c.id=a.task_id
1408
+ WHERE a.task_id IS NOT NULL AND c.id IS NULL
1409
+ GROUP BY a.task_id
1410
+ UNION ALL
1411
+ SELECT 'spec', a.spec_id, MIN(a.occurred_day_sp) FROM activities a
1412
+ LEFT JOIN canonical_ids c ON c.kind='spec' AND c.id=a.spec_id
1413
+ WHERE a.spec_id IS NOT NULL AND c.id IS NULL
1414
+ GROUP BY a.spec_id
1415
+ UNION ALL
1416
+ SELECT 'prd', a.prd_id, MIN(a.occurred_day_sp) FROM activities a
1417
+ LEFT JOIN canonical_ids c ON c.kind='prd' AND c.id=a.prd_id
1418
+ WHERE a.prd_id IS NOT NULL AND c.id IS NULL
1419
+ GROUP BY a.prd_id
1420
+ ), structural AS (
1421
+ SELECT day,
1422
+ SUM(CASE WHEN kind='prd' THEN 1 ELSE 0 END) AS prd_count,
1423
+ SUM(CASE WHEN kind='spec' THEN 1 ELSE 0 END) AS spec_count,
1424
+ SUM(CASE WHEN kind='task' THEN 1 ELSE 0 END) AS task_count,
1425
+ 0 AS validation_count, 0 AS evidence_count
1426
+ FROM work_item_days
1427
+ WHERE day IS NOT NULL
1428
+ AND (? IS NULL OR day >= ?)
1429
+ AND (? IS NULL OR day <= ?)
1430
+ GROUP BY day
1431
+ UNION ALL
1432
+ SELECT occurred_day_sp,
1433
+ 0, 0, 0,
1434
+ SUM(CASE WHEN artifact_kind='validation' THEN 1 ELSE 0 END),
1435
+ SUM(CASE WHEN artifact_kind='evidence' THEN 1 ELSE 0 END)
1436
+ FROM canonical_artifacts
1437
+ WHERE occurred_day_sp IS NOT NULL
1438
+ AND (? IS NULL OR occurred_day_sp >= ?)
1439
+ AND (? IS NULL OR occurred_day_sp <= ?)
1440
+ GROUP BY occurred_day_sp
1441
+ )
1442
+ SELECT day,
1443
+ SUM(prd_count) AS prd_count,
1444
+ SUM(spec_count) AS spec_count,
1445
+ SUM(task_count) AS task_count,
1446
+ SUM(validation_count) AS validation_count,
1447
+ SUM(evidence_count) AS evidence_count
1448
+ FROM structural GROUP BY day ORDER BY day`).all(a,a,s,s,a,a,s,s),O=W=>typeof W=="number"?W:0,P=W=>typeof W=="number"?W:null,C=W=>{let ce=O(W?.eligible_runs);return{events:O(W?.events),duration_ms:P(W?.duration_ms),tokens:{input:P(W?.input_tokens),cached_input:P(W?.cached_input_tokens),output:P(W?.output_tokens),reasoning:P(W?.reasoning_tokens),total:P(W?.total_tokens)},cost:{usd:P(W?.cost_usd),brl:P(W?.cost_brl)},coverage:{events:O(W?.events),tokens:O(W?.tokens_known),usd:O(W?.usd_known),brl:O(W?.brl_known)},_duration_population:{eligible_runs:ce,known_runs:O(W?.duration_known)}}},v=new Map(R.map(W=>[String(W.key),W])),A=v.get("total"),x=W=>{let{_duration_population:ce,...fe}=W;return fe},T=x(C(v.get("conversation"))),N=x(C(v.get("planning"))),H=x(C(v.get("execution"))),ie=x(C(v.get("total"))),oe=x(C()),be=new Map(g.map(W=>[String(W.key),W])),z=new Map(b.map(W=>[String(W.day),W])),B=[...new Set([...be.keys(),...z.keys()])].sort().map(W=>{let ce=be.get(W),fe=z.get(W),Re=O(ce?.eligible_runs),Ue=O(ce?.duration_known);return{key:W,prd_count:O(fe?.prd_count),spec_count:O(fe?.spec_count),task_count:O(fe?.task_count),validation_count:O(fe?.validation_count),evidence_count:O(fe?.evidence_count),total_run_count:Re,total_duration:P(ce?.duration_ms),duration_known:O(ce?.duration_ms),duration_unknown:Math.max(0,Re-Ue),total_tokens:P(ce?.total_tokens),total_cost_usd:P(ce?.cost_usd),total_cost_brl:P(ce?.cost_brl),source_event_count:O(ce?.events)}}),he=Object.fromEntries(B.map(W=>{let ce=be.get(W.key),fe=O(ce?.eligible_runs),Re=O(ce?.tokens_known),Ue=O(ce?.brl_known);return[W.key,{prds:W.prd_count,specs:W.spec_count,tasks:W.task_count,validations:W.validation_count,evidences:W.evidence_count,runs:fe,usage:{total_tokens:{known_sum:O(ce?.total_tokens),unknown:fe-Re,complete:Re===fe,coverage_ratio:fe===0?1:Re/fe},cost:{known_sum:O(ce?.cost_brl),unknown:fe-Ue,complete:Ue===fe,coverage_ratio:fe===0?1:Ue/fe,currency:"BRL"}},events:{known_sum:O(ce?.events),unknown:0,complete:!0,coverage_ratio:1}}]})),Ke=Object.fromEntries(g.map(W=>{let ce=C(W);return[String(W.key),{known_sum:O(W.duration_ms),eligible_runs:ce._duration_population.eligible_runs,known_runs:ce._duration_population.known_runs}]})),Ae=this.database.prepare(`${_},
1449
+ segment_totals AS (
1450
+ SELECT agent_invocation_id, SUM(total_tokens) AS total_tokens,
1451
+ SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1452
+ FROM cost_invocation_dimension_facts
1453
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1454
+ GROUP BY agent_invocation_id
1455
+ ), components AS (
1456
+ -- Agent facts can contain several observed models. Attribute their
1457
+ -- financial components to the model segment, never to a mixed parent.
1458
+ SELECT CASE WHEN f.model IS NULL OR trim(f.model) = '' OR lower(f.model) IN ('unavailable', 'unknown', 'mixed')
1459
+ THEN 'unavailable' ELSE f.model END AS key,
1460
+ SUM(f.total_tokens) AS total_tokens, SUM(f.cost_usd) AS total_cost_usd,
1461
+ SUM(f.cost_brl) AS total_cost_brl
1462
+ FROM selected s JOIN cost_invocation_dimension_facts f
1463
+ ON f.agent_invocation_id=s.agent_run_id
1464
+ WHERE s.agent_run_id IS NOT NULL
1465
+ GROUP BY key
1466
+ UNION ALL
1467
+ -- Non-agent financial facts have no invocation segments, so their
1468
+ -- observed model remains the only factual dimension.
1469
+ SELECT CASE WHEN model IS NULL OR trim(model) = '' OR lower(model) IN ('unavailable', 'unknown', 'mixed')
1470
+ THEN 'unavailable' ELSE model END AS key,
1471
+ SUM(total_tokens), SUM(cost_usd), SUM(cost_brl)
1472
+ FROM selected WHERE agent_run_id IS NULL GROUP BY key
1473
+ UNION ALL
1474
+ -- Preserve any consolidated invocation remainder as Sem dimens\xE3o so
1475
+ -- the model chart reconciles to the same financial population.
1476
+ SELECT 'unavailable' AS key,
1477
+ SUM(s.total_tokens - COALESCE(st.total_tokens, 0)),
1478
+ SUM(s.cost_usd - COALESCE(st.cost_usd, 0)),
1479
+ SUM(s.cost_brl - COALESCE(st.cost_brl, 0))
1480
+ FROM selected s LEFT JOIN segment_totals st ON st.agent_invocation_id=s.agent_run_id
1481
+ WHERE s.agent_run_id IS NOT NULL
1482
+ AND (s.total_tokens <> COALESCE(st.total_tokens, 0)
1483
+ OR s.cost_usd <> COALESCE(st.cost_usd, 0)
1484
+ OR s.cost_brl <> COALESCE(st.cost_brl, 0))
1485
+ )
1486
+ SELECT key, 0 AS invocation_count, NULL AS task_count,
1487
+ NULL AS total_duration, 0 AS duration_unknown, 0 AS duration_known,
1488
+ 0 AS source_event_count, SUM(total_tokens) AS total_tokens,
1489
+ SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
1490
+ FROM components GROUP BY key ORDER BY total_cost_brl DESC, key`).all(...d).map(W=>{let ce=P(W.total_duration),fe=O(W.duration_unknown),Re=P(W.duration_known)??ce??0;return{key:String(W.key??"unavailable"),label:String(W.label??W.key??"unavailable"),latest_started_at:"",run_count:O(W.invocation_count),task_count:P(W.task_count),prd_count:0,spec_count:0,evidence_count:0,test_count:0,event_count:O(W.source_event_count),total_tokens:P(W.total_tokens),estimated_usd:P(W.total_cost_usd),estimated_brl:P(W.total_cost_brl),duration_ms:ce,duration:{known_sum:Re,unknown:fe,complete:fe===0,coverage_ratio:fe===0?1:0},coverage:{events:0,tokens:0,usd:0,brl:0}}});return{periods:{daily:he},aggregate_usage:{conversation:T,planning:N,execution:H,total:ie,new_work:ie,rework:oe},task_count:O(A?.task_count),model_groups:Ae,cost_monitor_daily_duration:Ke,daily_rows:B}}summaryPage(t,n,i,r,o=null){let a="operations_work_summary",s=n.from?.slice(0,10)??null,l=n.to?.slice(0,10)??null,c=kK(o),d=["entity_kind = ?","(? IS NULL OR occurred_day_sp >= ?)","(? IS NULL OR occurred_day_sp <= ?)"],u=[t,s,s,l,l];n.status&&(d.push("status = ?"),u.push(n.status)),n.risk&&(d.push("risk = ?"),u.push(n.risk)),n.query&&(d.push("(id LIKE ? OR title LIKE ?)"),u.push(`%${n.query}%`,`%${n.query}%`));let _=d.join(" AND "),p=[...u];c!==null&&(d.push("(occurred_at < ? OR (occurred_at = ? AND id < ?))"),u.push(c[0],c[0],c[1]));let y=d.join(" AND "),f=Number(this.database.prepare(`SELECT COUNT(*) AS count FROM ${a} WHERE ${_}`).get(...p).count),h=c===null?i:0,k=this.database.prepare(`SELECT id, title, status, risk, occurred_at, occurred_day_sp,
1491
+ invocation_count, llm_call_count, total_duration, total_tokens, total_cost_usd, total_cost_brl
1492
+ FROM ${a} WHERE ${y} ORDER BY occurred_at DESC, id DESC LIMIT ? OFFSET ?`).all(...u,r,h),S=k.at(-1);return{data_source:"sqlite_read_model",kind:t,offset:h,limit:r,total:f,has_more:k.length===r&&(c!==null||h+k.length<f),next_cursor:S===void 0||k.length<r?null:SK(String(S.occurred_at),String(S.id)),rows:k}}overviewPage(t,n,i){let r=Number(this.database.prepare("SELECT COUNT(*) AS count FROM overview WHERE period_kind = ?").get(t).count),o=this.database.prepare(`SELECT o.*, op.operations_total_duration, cm.cost_monitor_total_duration, cm.total_tokens, cm.total_cost_usd, cm.total_cost_brl
1493
+ FROM overview o JOIN operations_overview op USING(period_kind, period_key) JOIN cost_monitor_overview cm USING(period_kind, period_key)
1494
+ WHERE o.period_kind = ? ORDER BY o.period_key DESC LIMIT ? OFFSET ?`).all(t,i,n),a=this.executionDurationByDay({from:null,to:null});for(let s of o)s.operations_total_duration=[...a].filter(([l])=>t==="day"?l===s.period_key:l.startsWith(String(s.period_key))).reduce((l,[,c])=>l+c,0);return{data_source:"sqlite_read_model",kind:"overview",period:t,offset:n,limit:i,total:r,has_more:n+o.length<r,rows:o}}viewPage(t,n){let i=`${t}:${JSON.stringify(n)}`,r=this.viewPageResultCache.get(i);if(r!==void 0)return structuredClone(r);let o=this.uncachedViewPage(t,n);if(this.viewPageResultCache.size>=256){let a=this.viewPageResultCache.keys().next().value;a!==void 0&&this.viewPageResultCache.delete(a)}return this.viewPageResultCache.set(i,structuredClone(o)),o}uncachedViewPage(t,n){if(["operations_work_kanban","operations_executions","operations_agent_invocations","operations_conversations"].includes(t)&&!n.from&&!n.to&&!n.query&&!n.status&&!n.risk&&!n.provider&&!n.model&&!n.agent&&!n.phase&&!n.origin&&!n.workType&&!n.priority){let g=this.unfilteredViewRows(t),b=Math.min(200,Math.max(1,n.limit??100)),O=Math.max(0,n.offset??0),P=g.slice(O,O+b);return{data_source:"sqlite_read_model",view:t,offset:O,limit:b,total_count:g.length,has_more:O+P.length<g.length,rows:P}}if(t==="operations_work_list"&&!n.from&&!n.to&&!n.query&&!n.status&&!n.risk){let g=this.operationsWorkListRows(),b=Math.min(200,Math.max(1,n.limit??50)),O=Math.max(0,n.offset??0),P=g.slice(O,O+b);return{data_source:"sqlite_read_model",view:t,offset:O,limit:b,total_count:g.length,has_more:O+P.length<g.length,rows:P}}if(t==="cost_monitor_agent_invocations"){let g="date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')",b=[`(? IS NULL OR ${g} >= ?)`,`(? IS NULL OR ${g} <= ?)`],O=Ht(n.from),P=Ht(n.to),C=[O,O,P,P],v=(oe,be)=>{be&&(b.push(`${oe} = ?`),C.push(be))};v("i.zaip_agent",n.agent),v("i.phase",n.phase),v("i.status",n.status);let A=[];n.provider&&(n.provider==="unavailable"?b.push("((i.agent_invocation_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')) OR (i.agent_invocation_id IS NULL AND (i.provider IS NULL OR i.provider = 'unavailable')))"):(A.push("f.provider=?"),C.push(n.provider))),n.model&&(n.model==="unavailable"?b.push("((i.agent_invocation_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')) OR (i.agent_invocation_id IS NULL AND (i.model IS NULL OR i.model = 'unavailable')))"):(A.push("f.model=?"),C.push(n.model))),A.length>0&&b.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id=i.agent_invocation_id AND ${A.join(" AND ")})`),n.query&&(b.push("(i.agent_invocation_id LIKE ? OR i.task_id LIKE ? OR i.execution_id LIKE ?)"),C.push(`%${n.query}%`,`%${n.query}%`,`%${n.query}%`));let x=b.join(" AND "),T=Math.min(200,Math.max(1,n.limit??100)),N=Math.max(0,n.offset??0),H=Number(this.database.prepare(`SELECT COUNT(*) AS count FROM cost_agent_invocations i WHERE ${x}`).get(...C).count),ie=this.database.prepare(`SELECT i.* FROM cost_agent_invocations i WHERE ${x} ORDER BY i.occurred_at DESC, i.agent_invocation_id DESC LIMIT ? OFFSET ?`).all(...C,T,N);return{data_source:"sqlite_read_model",view:t,offset:N,limit:T,total_count:H,has_more:N+ie.length<H,rows:ie}}let o={cost_monitor_daily:"day",cost_monitor_monthly:"month",cost_monitor_annual:"year",cost_monitor_zaip_agents:"agent",cost_monitor_models:"model",cost_monitor_providers:"provider"}[t];if((o==="model"||o==="provider")&&!n.from&&!n.to&&!n.query&&!n.status&&!n.risk&&!n.provider&&!n.model&&!n.agent&&!n.phase&&!n.origin&&!n.workType&&!n.priority){let g=o,b=this.database.prepare(`SELECT
1495
+ json_extract(payload_json, '$.key') AS key,
1496
+ json_extract(payload_json, '$.label') AS label,
1497
+ json_extract(payload_json, '$.invocation_count') AS invocation_count,
1498
+ json_extract(payload_json, '$.task_count') AS task_count,
1499
+ json_extract(payload_json, '$.total_duration') AS total_duration,
1500
+ json_extract(payload_json, '$.source_event_count') AS source_event_count,
1501
+ json_extract(payload_json, '$.total_tokens') AS total_tokens,
1502
+ json_extract(payload_json, '$.total_cost_usd') AS total_cost_usd,
1503
+ json_extract(payload_json, '$.total_cost_brl') AS total_cost_brl
1504
+ FROM zaip_aios_activities
1505
+ WHERE payload_type='cost_dimension_aggregate_v1'
1506
+ AND json_extract(payload_json, '$.dimension')=?
1507
+ ORDER BY total_cost_brl DESC, key`).all(g),O=Math.min(200,Math.max(1,n.limit??50)),P=Math.max(0,n.offset??0),C=b.slice(P,P+O);return{data_source:"sqlite_read_model",view:t,offset:P,limit:O,total_count:b.length,has_more:P+C.length<b.length,rows:C}}if(o==="agent"){let g=["i.zaip_agent IS NOT NULL"],b=[];if(n.from&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),b.push(n.from.slice(0,10))),n.to&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),b.push(n.to.slice(0,10))),n.agent&&(g.push("i.zaip_agent = ?"),b.push(n.agent)),n.phase&&(g.push("i.phase = ?"),b.push(n.phase)),n.status&&(g.push("i.status = ?"),b.push(n.status)),n.priority&&g.push("0"),n.risk&&(g.push("t.risk = ?"),b.push(n.risk)),n.origin){let B=n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL";g.push(B)}n.workType&&g.push("0");let O=[];if(n.provider&&(n.provider==="unavailable"?g.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(O.push("f.provider = ?"),b.push(n.provider))),n.model&&(n.model==="unavailable"?g.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')"):(O.push("f.model = ?"),b.push(n.model))),O.length>0&&g.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id=i.agent_invocation_id AND ${O.join(" AND ")})`),n.query){let B=`%${n.query}%`;g.push("(i.zaip_agent LIKE ? OR i.zaip_agent_persona LIKE ? OR i.zaip_agent_job LIKE ?)"),b.push(B,B,B)}let P="date(COALESCE(a.source_started_at, a.source_occurred_at, a.occurred_at), '-3 hours')",C=["a.activity_source_kind <> 'agent_run'","a.zaip_agent IS NOT NULL","(a.total_tokens IS NOT NULL OR a.cost_brl IS NOT NULL OR a.cost_usd IS NOT NULL)"],v=[];if(n.from&&(C.push(`${P} >= ?`),v.push(n.from.slice(0,10))),n.to&&(C.push(`${P} <= ?`),v.push(n.to.slice(0,10))),n.agent&&(C.push("a.zaip_agent = ?"),v.push(n.agent)),n.phase&&(C.push("a.phase = ?"),v.push(n.phase)),n.status&&(C.push("a.status = ?"),v.push(n.status)),(n.priority||n.workType)&&C.push("0"),n.risk&&(C.push("activity_task.risk = ?"),v.push(n.risk)),n.origin&&C.push(n.origin==="prd"?"a.prd_id IS NOT NULL":n.origin==="spec"?"a.prd_id IS NULL AND a.spec_id IS NOT NULL":n.origin==="task"?"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NOT NULL":"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NULL"),n.provider||n.model){let B=[],he=[];n.provider&&(B.push("COALESCE(a.provider, 'unavailable') = ?"),he.push("COALESCE(u.provider, 'unavailable') = ?"),v.push(n.provider)),n.model&&(B.push("COALESCE(a.model, 'unavailable') = ?"),he.push("COALESCE(u.model, 'unavailable') = ?"),v.push(n.model)),C.push(`((a.agent_run_id IS NULL AND ${B.join(" AND ")}) OR (a.agent_run_id IS NOT NULL AND EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id = a.agent_run_id AND ${he.join(" AND ")})))`),n.provider&&v.push(n.provider),n.model&&v.push(n.model)}if(n.query){let B=`%${n.query}%`;C.push("(a.zaip_agent LIKE ? OR a.zaip_agent_persona LIKE ? OR a.zaip_agent_job LIKE ?)"),v.push(B,B,B)}let A=g.join(" AND "),x=["i.zaip_agent IS NOT NULL","(i.total_tokens IS NOT NULL OR i.cost_brl IS NOT NULL OR i.cost_usd IS NOT NULL)"],T=[],N="date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')";if(n.from&&(x.push(`${N} >= ?`),T.push(n.from.slice(0,10))),n.to&&(x.push(`${N} <= ?`),T.push(n.to.slice(0,10))),n.agent&&(x.push("i.zaip_agent = ?"),T.push(n.agent)),n.phase&&(x.push("i.phase = ?"),T.push(n.phase)),n.status&&(x.push("i.status = ?"),T.push(n.status)),(n.priority||n.workType)&&x.push("0"),n.risk&&(x.push("invocation_task.risk = ?"),T.push(n.risk)),n.origin&&x.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.provider||n.model){let B=[];n.provider&&(B.push("COALESCE(u.provider, 'unavailable') = ?"),T.push(n.provider)),n.model&&(B.push("COALESCE(u.model, 'unavailable') = ?"),T.push(n.model)),x.push(`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=i.agent_invocation_id AND ${B.join(" AND ")})`)}if(n.query){let B=`%${n.query}%`;x.push("(i.zaip_agent LIKE ? OR i.zaip_agent_persona LIKE ? OR i.zaip_agent_job LIKE ?)"),T.push(B,B,B)}let H=`WITH agent_facts AS (
1508
+ SELECT i.zaip_agent AS key, i.zaip_agent_persona AS persona, i.zaip_agent_job AS job, d.persona AS catalog_persona, d.job AS catalog_job,
1509
+ i.occurred_at, i.task_id, i.duration_ms, i.source_event_count, i.total_tokens, i.cost_usd, i.cost_brl
1510
+ FROM invocations i LEFT JOIN tasks invocation_task ON invocation_task.id=i.task_id LEFT JOIN zaip_dim_zaip_agent d ON d.zaip_agent = i.zaip_agent
1511
+ WHERE ${x.join(" AND ")}
1512
+ UNION ALL
1513
+ SELECT a.zaip_agent AS key, a.zaip_agent_persona AS persona, a.zaip_agent_job AS job, d.persona AS catalog_persona, d.job AS catalog_job,
1514
+ a.occurred_at, a.task_id, a.attributed_token_active_ms AS duration_ms, a.source_event_count, a.total_tokens, a.cost_usd, a.cost_brl
1515
+ FROM activities a LEFT JOIN tasks activity_task ON activity_task.id=a.task_id LEFT JOIN zaip_dim_zaip_agent d ON d.zaip_agent = a.zaip_agent
1516
+ WHERE ${C.join(" AND ")}
1517
+ )`,ie=Math.min(200,Math.max(1,n.limit??50)),oe=Math.max(0,n.offset??0),be=Number(this.database.prepare(`${H} SELECT COUNT(DISTINCT key) AS count FROM agent_facts`).get(...T,...v).count),z=this.database.prepare(`${H} SELECT COUNT(*) AS invocation_count, COUNT(DISTINCT task_id) AS task_count, SUM(duration_ms) AS total_duration, SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) AS duration_unknown, SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) AS duration_known, SUM(source_event_count) AS source_event_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM agent_facts`).get(...T,...v),ye=this.database.prepare(`${H} SELECT key, key AS label, COALESCE(MAX(persona), MAX(catalog_persona)) AS persona, COALESCE(MAX(job), MAX(catalog_job)) AS job, MAX(occurred_at) AS latest_started_at, COUNT(*) AS invocation_count, COUNT(DISTINCT task_id) AS task_count, SUM(duration_ms) AS total_duration, SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) AS duration_unknown, SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) AS duration_known, SUM(source_event_count) AS source_event_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM agent_facts GROUP BY key ORDER BY total_cost_brl DESC, key LIMIT ? OFFSET ?`).all(...T,...v,ie,oe);return{data_source:"sqlite_read_model",view:t,offset:oe,limit:ie,total_count:be,has_more:oe+ye.length<be,totals:z,rows:ye}}if(o==="model"){let g=["1=1"],b=[];n.from&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),b.push(n.from.slice(0,10))),n.to&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),b.push(n.to.slice(0,10))),n.agent&&(g.push("i.zaip_agent = ?"),b.push(n.agent)),n.phase&&(g.push("i.phase = ?"),b.push(n.phase)),n.status&&(g.push("i.status = ?"),b.push(n.status)),(n.priority||n.workType)&&g.push("0"),n.risk&&(g.push("t.risk = ?"),b.push(n.risk)),n.origin&&g.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.provider&&(n.provider==="unavailable"?g.push("s.provider IS NULL AND NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(g.push("s.provider = ?"),b.push(n.provider))),n.model&&(n.model==="unavailable"?g.push("s.model_key = 'unavailable'"):(g.push("s.model_key = ?"),b.push(n.model))),n.query&&(g.push("s.model_key LIKE ?"),b.push(`%${n.query}%`));let O=g.join(" AND "),P=["a.activity_source_kind <> 'agent_run'"],C=[];n.from&&(P.push("a.occurred_day_sp >= ?"),C.push(n.from.slice(0,10))),n.to&&(P.push("a.occurred_day_sp <= ?"),C.push(n.to.slice(0,10))),n.agent&&(P.push("a.zaip_agent = ?"),C.push(n.agent)),n.phase&&(P.push("a.phase = ?"),C.push(n.phase)),n.status&&(P.push("a.status = ?"),C.push(n.status)),(n.priority||n.workType)&&P.push("0"),n.risk&&(P.push("activity_task.risk = ?"),C.push(n.risk)),n.origin&&P.push(n.origin==="prd"?"a.prd_id IS NOT NULL":n.origin==="spec"?"a.prd_id IS NULL AND a.spec_id IS NOT NULL":n.origin==="task"?"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NOT NULL":"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NULL"),n.provider&&(n.provider==="unavailable"?P.push("a.provider IS NULL OR trim(a.provider) = '' OR a.provider = 'unavailable'"):(P.push("a.provider = ?"),C.push(n.provider))),n.model&&(n.model==="unavailable"?P.push("a.model IS NULL OR trim(a.model) = '' OR a.model = 'unavailable'"):(P.push("a.model = ?"),C.push(n.model))),n.query&&(P.push("COALESCE(a.model, 'unavailable') LIKE ?"),C.push(`%${n.query}%`));let v=`WITH segment_totals AS (
1518
+ SELECT agent_invocation_id, SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1519
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1520
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1521
+ FROM cost_invocation_dimension_facts
1522
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1523
+ GROUP BY agent_invocation_id
1524
+ ), segments AS (
1525
+ SELECT agent_invocation_id,
1526
+ CASE WHEN model IS NULL OR trim(model) = '' OR model = 'unavailable' THEN 'unavailable' ELSE model END AS model_key,
1527
+ CASE WHEN provider IS NULL OR trim(provider) = '' OR provider = 'unavailable' THEN NULL ELSE provider END AS provider,
1528
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1529
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1530
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1531
+ FROM cost_invocation_dimension_facts
1532
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1533
+ GROUP BY agent_invocation_id, model_key, provider
1534
+ UNION ALL
1535
+ -- Preserve every factual residual from the consolidated invocation:
1536
+ -- source totals can exceed their attributed usage segments even when
1537
+ -- a provider/model string exists. The residual is Sem dimens\xE3o.
1538
+ SELECT i.agent_invocation_id, 'unavailable' AS model_key, NULL AS provider,
1539
+ i.input_tokens - COALESCE(st.input_tokens, 0), i.cached_input_tokens - COALESCE(st.cached_input_tokens, 0),
1540
+ i.output_tokens - COALESCE(st.output_tokens, 0), i.reasoning_tokens - COALESCE(st.reasoning_tokens, 0),
1541
+ i.total_tokens - COALESCE(st.total_tokens, 0), i.cost_usd - COALESCE(st.cost_usd, 0), i.cost_brl - COALESCE(st.cost_brl, 0)
1542
+ FROM invocations i LEFT JOIN segment_totals st USING(agent_invocation_id)
1543
+ WHERE (i.total_tokens IS NOT NULL OR i.cost_usd IS NOT NULL OR i.cost_brl IS NOT NULL)
1544
+ AND (i.total_tokens <> COALESCE(st.total_tokens, 0) OR i.cost_usd <> COALESCE(st.cost_usd, 0) OR i.cost_brl <> COALESCE(st.cost_brl, 0))
1545
+ ), model_segments AS (
1546
+ SELECT agent_invocation_id, model_key, SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1547
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1548
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1549
+ FROM segments GROUP BY agent_invocation_id, model_key
1550
+ ), known_models AS (
1551
+ SELECT agent_invocation_id, COUNT(DISTINCT model_key) AS model_count
1552
+ FROM model_segments WHERE model_key <> 'unavailable' GROUP BY agent_invocation_id
1553
+ ), filtered_segments AS (
1554
+ SELECT s.*, i.task_id, i.duration_ms, i.source_event_count, km.model_count
1555
+ FROM segments s JOIN invocations i USING(agent_invocation_id)
1556
+ LEFT JOIN tasks t ON t.id=i.task_id LEFT JOIN known_models km USING(agent_invocation_id)
1557
+ WHERE ${O}`,A=`), financial_components AS (
1558
+ SELECT model_key AS key, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl
1559
+ FROM filtered_segments GROUP BY model_key
1560
+ UNION ALL
1561
+ SELECT CASE WHEN a.model IS NULL OR trim(a.model) = '' OR lower(a.model) IN ('unavailable', 'unknown', 'mixed') THEN 'unavailable' ELSE a.model END AS key,
1562
+ SUM(a.total_tokens) AS total_tokens, SUM(a.cost_usd) AS total_cost_usd, SUM(a.cost_brl) AS total_cost_brl
1563
+ FROM activities a LEFT JOIN tasks activity_task ON activity_task.id=a.task_id
1564
+ WHERE ${P.join(" AND ")}
1565
+ AND (a.total_tokens IS NOT NULL OR a.cost_usd IS NOT NULL OR a.cost_brl IS NOT NULL)
1566
+ GROUP BY key
1567
+ ), financial AS (
1568
+ SELECT key, SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
1569
+ FROM financial_components GROUP BY key
1570
+ ), population_models AS (
1571
+ SELECT agent_invocation_id, model_key, MAX(task_id) AS task_id, MAX(duration_ms) AS duration_ms,
1572
+ MAX(source_event_count) AS source_event_count, MAX(model_count) AS model_count
1573
+ FROM filtered_segments GROUP BY agent_invocation_id, model_key
1574
+ ), population_ranked AS (
1575
+ SELECT *, ROW_NUMBER() OVER (PARTITION BY agent_invocation_id ORDER BY model_key) AS model_rank
1576
+ FROM population_models
1577
+ ), population AS (
1578
+ SELECT model_key AS key,
1579
+ COUNT(*) AS invocation_count,
1580
+ SUM(duration_ms) AS total_duration,
1581
+ SUM(source_event_count) AS source_event_count
1582
+ FROM population_ranked WHERE model_rank = 1 AND model_count = 1
1583
+ GROUP BY model_key
1584
+ ), task_models AS (
1585
+ SELECT task_id, model_key
1586
+ FROM population_models WHERE task_id IS NOT NULL
1587
+ GROUP BY task_id, model_key
1588
+ ), task_population AS (
1589
+ SELECT model_key AS key,
1590
+ COUNT(*) AS task_count
1591
+ FROM task_models
1592
+ GROUP BY model_key
1593
+ ), keys AS (
1594
+ SELECT key FROM financial UNION SELECT key FROM population UNION SELECT key FROM task_population
1595
+ )`,x=Math.min(200,Math.max(1,n.limit??50)),T=Math.max(0,n.offset??0),N=Number(this.database.prepare(`${v} ${A} SELECT COUNT(*) AS count FROM keys`).get(...b,...C).count),H=this.database.prepare(`${v} ${A} SELECT
1596
+ (SELECT COUNT(*) FROM population_ranked WHERE model_rank = 1) AS invocation_count,
1597
+ (SELECT COUNT(DISTINCT task_id) FROM population_models) AS task_count,
1598
+ (SELECT SUM(duration_ms) FROM population_ranked WHERE model_rank = 1) AS total_duration,
1599
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) FROM population_ranked WHERE model_rank = 1) AS duration_unknown,
1600
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) FROM population_ranked WHERE model_rank = 1) AS duration_known,
1601
+ (SELECT SUM(source_event_count) FROM population_ranked WHERE model_rank = 1) AS source_event_count,
1602
+ SUM(input_tokens) AS total_input_tokens,
1603
+ SUM(cached_input_tokens) AS total_cached_input_tokens,
1604
+ SUM(output_tokens) AS total_output_tokens,
1605
+ SUM(reasoning_tokens) AS total_reasoning_tokens,
1606
+ SUM(total_tokens) AS total_tokens,
1607
+ SUM(cost_usd) AS total_cost_usd,
1608
+ SUM(cost_brl) AS total_cost_brl
1609
+ FROM filtered_segments`).get(...b,...C),ie=this.database.prepare(`${v} ${A} SELECT keys.key, keys.key AS label, COALESCE(population.invocation_count, 0) AS invocation_count, COALESCE(task_population.task_count, 0) AS task_count, population.total_duration, population.source_event_count, financial.total_tokens, financial.total_cost_usd, financial.total_cost_brl FROM keys LEFT JOIN population USING(key) LEFT JOIN task_population USING(key) LEFT JOIN financial USING(key) ORDER BY financial.total_cost_brl DESC, keys.key LIMIT ? OFFSET ?`).all(...b,...C,x,T);return{data_source:"sqlite_read_model",view:t,offset:T,limit:x,total_count:N,has_more:T+ie.length<N,totals:H,rows:ie}}if(o==="provider"){let g=["1=1"],b=[];n.from&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),b.push(n.from.slice(0,10))),n.to&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),b.push(n.to.slice(0,10))),n.agent&&(g.push("i.zaip_agent = ?"),b.push(n.agent)),n.phase&&(g.push("i.phase = ?"),b.push(n.phase)),n.status&&(g.push("i.status = ?"),b.push(n.status)),(n.priority||n.workType)&&g.push("0"),n.risk&&(g.push("t.risk = ?"),b.push(n.risk)),n.origin&&g.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.provider&&(n.provider==="unavailable"?g.push("s.provider_key = 'unavailable'"):(g.push("s.provider_key = ?"),b.push(n.provider))),n.model&&(n.model==="unavailable"?g.push("s.model_key = 'unavailable'"):(g.push("s.model_key = ?"),b.push(n.model))),n.query&&(g.push("s.provider_key LIKE ?"),b.push(`%${n.query}%`));let P=`WITH segment_totals AS (
1610
+ SELECT agent_invocation_id, SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1611
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1612
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1613
+ FROM cost_invocation_dimension_facts
1614
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1615
+ GROUP BY agent_invocation_id
1616
+ ), segments AS (
1617
+ SELECT agent_invocation_id,
1618
+ CASE WHEN provider IS NULL OR trim(provider) = '' OR provider = 'unavailable' THEN 'unavailable' ELSE provider END AS provider_key,
1619
+ CASE WHEN model IS NULL OR trim(model) = '' OR model = 'unavailable' THEN 'unavailable' ELSE model END AS model_key,
1620
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1621
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1622
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1623
+ FROM cost_invocation_dimension_facts
1624
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1625
+ GROUP BY agent_invocation_id, provider_key, model_key
1626
+ UNION ALL
1627
+ -- See the equivalent Models branch: attribute only the segment part;
1628
+ -- retain the consolidated factual remainder as Sem dimens\xE3o.
1629
+ SELECT i.agent_invocation_id, 'unavailable' AS provider_key, 'unavailable' AS model_key,
1630
+ i.input_tokens - COALESCE(st.input_tokens, 0), i.cached_input_tokens - COALESCE(st.cached_input_tokens, 0),
1631
+ i.output_tokens - COALESCE(st.output_tokens, 0), i.reasoning_tokens - COALESCE(st.reasoning_tokens, 0),
1632
+ i.total_tokens - COALESCE(st.total_tokens, 0), i.cost_usd - COALESCE(st.cost_usd, 0), i.cost_brl - COALESCE(st.cost_brl, 0)
1633
+ FROM invocations i LEFT JOIN segment_totals st USING(agent_invocation_id)
1634
+ WHERE (i.total_tokens IS NOT NULL OR i.cost_usd IS NOT NULL OR i.cost_brl IS NOT NULL)
1635
+ AND (i.total_tokens <> COALESCE(st.total_tokens, 0) OR i.cost_usd <> COALESCE(st.cost_usd, 0) OR i.cost_brl <> COALESCE(st.cost_brl, 0))
1636
+ ), provider_segments AS (
1637
+ SELECT agent_invocation_id, provider_key,
1638
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1639
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1640
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1641
+ FROM segments GROUP BY agent_invocation_id, provider_key
1642
+ ), known_providers AS (
1643
+ SELECT agent_invocation_id, COUNT(DISTINCT provider_key) AS provider_count
1644
+ FROM provider_segments WHERE provider_key <> 'unavailable' GROUP BY agent_invocation_id
1645
+ ), filtered_segments AS (
1646
+ SELECT s.*, i.task_id, i.duration_ms, i.source_event_count, kp.provider_count
1647
+ FROM segments s JOIN invocations i USING(agent_invocation_id)
1648
+ LEFT JOIN tasks t ON t.id=i.task_id LEFT JOIN known_providers kp USING(agent_invocation_id)
1649
+ WHERE ${g.join(" AND ")}`,C=`), financial AS (
1650
+ SELECT provider_key AS key, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM filtered_segments GROUP BY provider_key
1651
+ ), population_providers AS (
1652
+ SELECT agent_invocation_id, provider_key, MAX(task_id) AS task_id, MAX(duration_ms) AS duration_ms, MAX(source_event_count) AS source_event_count, MAX(provider_count) AS provider_count
1653
+ FROM filtered_segments GROUP BY agent_invocation_id, provider_key
1654
+ ), population_ranked AS (
1655
+ SELECT *, ROW_NUMBER() OVER (PARTITION BY agent_invocation_id ORDER BY provider_key) AS provider_rank FROM population_providers
1656
+ ), population AS (
1657
+ SELECT provider_key AS key, COUNT(*) AS invocation_count, SUM(duration_ms) AS total_duration, SUM(source_event_count) AS source_event_count
1658
+ FROM population_ranked WHERE provider_rank = 1 AND provider_count = 1 GROUP BY provider_key
1659
+ ), task_providers AS (
1660
+ SELECT task_id, provider_key FROM population_providers WHERE task_id IS NOT NULL GROUP BY task_id, provider_key
1661
+ ), task_population AS (
1662
+ SELECT provider_key AS key, COUNT(*) AS task_count
1663
+ FROM task_providers GROUP BY provider_key
1664
+ ), keys AS (SELECT key FROM financial UNION SELECT key FROM population UNION SELECT key FROM task_population)`,v=Math.min(200,Math.max(1,n.limit??50)),A=Math.max(0,n.offset??0),x=Number(this.database.prepare(`${P} ${C} SELECT COUNT(*) AS count FROM keys`).get(...b).count),T=this.database.prepare(`${P} ${C} SELECT
1665
+ (SELECT COUNT(*) FROM population_ranked WHERE provider_rank = 1) AS invocation_count,
1666
+ (SELECT COUNT(DISTINCT task_id) FROM population_providers) AS task_count,
1667
+ (SELECT SUM(duration_ms) FROM population_ranked WHERE provider_rank = 1) AS total_duration,
1668
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) FROM population_ranked WHERE provider_rank = 1) AS duration_unknown,
1669
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) FROM population_ranked WHERE provider_rank = 1) AS duration_known,
1670
+ (SELECT SUM(source_event_count) FROM population_ranked WHERE provider_rank = 1) AS source_event_count,
1671
+ SUM(input_tokens) AS total_input_tokens,
1672
+ SUM(cached_input_tokens) AS total_cached_input_tokens,
1673
+ SUM(output_tokens) AS total_output_tokens,
1674
+ SUM(reasoning_tokens) AS total_reasoning_tokens,
1675
+ SUM(total_tokens) AS total_tokens,
1676
+ SUM(cost_usd) AS total_cost_usd,
1677
+ SUM(cost_brl) AS total_cost_brl
1678
+ FROM filtered_segments`).get(...b),N=this.database.prepare(`${P} ${C} SELECT keys.key, keys.key AS label, COALESCE(population.invocation_count,0) AS invocation_count, COALESCE(task_population.task_count,0) AS task_count, population.total_duration, population.source_event_count, financial.total_tokens, financial.total_cost_usd, financial.total_cost_brl FROM keys LEFT JOIN population USING(key) LEFT JOIN task_population USING(key) LEFT JOIN financial USING(key) ORDER BY financial.total_cost_brl DESC, keys.key LIMIT ? OFFSET ?`).all(...b,v,A);return{data_source:"sqlite_read_model",view:t,offset:A,limit:v,total_count:x,has_more:A+N.length<x,totals:T,rows:N}}let s=o==="day"||o==="month"||o==="year",l=!!(n.provider||n.model||n.agent||n.phase||n.status||n.origin||n.priority||n.risk||n.workType);if(o!==void 0&&s&&!l){let g=Ht(n.from),b=Ht(n.to),P=this.costMonitorSummaryAggregate({from:g,to:b}).daily_rows,C=new Map(P.map(z=>[String(z.key),z])),v=[...C.keys()].sort(),A=new Map,x=["prd_count","spec_count","task_count","validation_count","evidence_count","total_run_count","invocation_count","cost_monitor_invocation_count","llm_call_count","source_event_count","total_tokens","total_cost_usd","total_cost_brl"];for(let z of v){let ye=o==="day"?z:o==="month"?z.slice(0,7):z.slice(0,4),B=A.get(ye)??{key:ye,label:ye,period_key:ye,start_day:z,end_day:z,total_duration:null,duration_incomplete:!1,duration_provenance:"unavailable",estimation_basis:null};B.start_day=String(B.start_day)<z?B.start_day:z,B.end_day=String(B.end_day)>z?B.end_day:z;let he=C.get(z);for(let Fe of x){let Ae=he?.[Fe];typeof Ae=="number"&&(B[Fe]=(typeof B[Fe]=="number"?Number(B[Fe]):0)+Ae)}let Ke=he?.total_duration;typeof Ke=="number"&&(B.total_duration=(typeof B.total_duration=="number"?Number(B.total_duration):0)+Ke),typeof he?.duration_unknown=="number"&&he.duration_unknown>0&&(B.duration_incomplete=!0),A.set(ye,B)}let T=n.query?.toLocaleLowerCase()??null,N=[...A.values()].map(z=>{let ye=typeof z.total_duration=="number"?z.total_duration:null,B=z.duration_incomplete===!0?1:0;return{key:String(z.key),label:String(z.label),prd_count:Number(z.prd_count??0),spec_count:Number(z.spec_count??0),task_count:Number(z.task_count??0),total_run_count:Number(z.total_run_count??0),validation_count:Number(z.validation_count??0),evidence_count:Number(z.evidence_count??0),total_duration:ye,duration_known:ye??0,duration_unknown:B,total_tokens:typeof z.total_tokens=="number"?z.total_tokens:null,total_cost_usd:typeof z.total_cost_usd=="number"?z.total_cost_usd:null,total_cost_brl:typeof z.total_cost_brl=="number"?z.total_cost_brl:null}}).filter(z=>T===null||String(z.key).toLocaleLowerCase().includes(T)).sort((z,ye)=>String(ye.key).localeCompare(String(z.key))),H=N.reduce((z,ye)=>{for(let B of["prd_count","spec_count","task_count","total_run_count","validation_count","evidence_count","total_duration","duration_known","duration_unknown","total_tokens","total_cost_usd","total_cost_brl"]){let he=ye[B];typeof he=="number"?z[B]=(z[B]??0)+he:B in z||(z[B]=null)}return z},{}),ie=Math.min(200,Math.max(1,n.limit??50)),oe=Math.max(0,n.offset??0),be=N.slice(oe,oe+ie);return{data_source:"sqlite_read_model",view:t,offset:oe,limit:ie,total_count:N.length,has_more:oe+be.length<N.length,totals:H,rows:be}}if(o!==void 0&&(!s||l)){if(s&&n.workType)return{data_source:"sqlite_read_model",view:t,offset:Math.max(0,n.offset??0),limit:Math.min(200,Math.max(1,n.limit??50)),total_count:0,has_more:!1,rows:[]};let g=o==="day"?"date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')":o==="month"?"substr(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours'), 1, 7)":o==="year"?"substr(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours'), 1, 4)":"i.provider_group",b=[`${g} IS NOT NULL`,"(i.total_tokens IS NOT NULL OR i.cost_usd IS NOT NULL OR i.cost_brl IS NOT NULL)"],O=[];n.from&&(b.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),O.push(Ht(n.from))),n.to&&(b.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),O.push(Ht(n.to)));let P=[];if(n.provider&&(n.provider==="unavailable"?b.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(P.push("f.provider=?"),O.push(n.provider))),n.model&&(n.model==="unavailable"?b.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')"):(P.push("f.model=?"),O.push(n.model))),P.length>0&&b.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id=i.agent_invocation_id AND ${P.join(" AND ")})`),n.agent&&(b.push("i.zaip_agent = ?"),O.push(n.agent)),n.phase&&(b.push("i.phase = ?"),O.push(n.phase)),n.status&&(b.push("i.status = ?"),O.push(n.status)),n.priority&&b.push("0"),n.risk&&(b.push("i.task_risk = ?"),O.push(n.risk)),n.origin&&b.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.workType&&b.push("0"),n.query){let ie=`%${n.query}%`;b.push("(i.agent_invocation_id LIKE ? OR i.execution_id LIKE ? OR i.task_id LIKE ? OR i.spec_id LIKE ? OR i.prd_id LIKE ? OR i.conversation_id LIKE ? OR i.zaip_agent LIKE ? OR i.purpose LIKE ?)"),O.push(ie,ie,ie,ie,ie,ie,ie,ie)}let C=`WITH usage_rollup AS (
1679
+ SELECT agent_invocation_id,
1680
+ CASE COUNT(DISTINCT provider) WHEN 0 THEN NULL WHEN 1 THEN MIN(provider) ELSE 'mixed' END AS provider_group,
1681
+ CASE COUNT(DISTINCT model) WHEN 0 THEN NULL WHEN 1 THEN MIN(model) ELSE 'mixed' END AS model_group,
1682
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1683
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens
1684
+ FROM invocation_usage GROUP BY agent_invocation_id
1685
+ ), facts AS (
1686
+ -- Temporal Cost Monitor groups intentionally retain historical
1687
+ -- financial activities that have no agent invocation id. For modern
1688
+ -- Agent Runs, usage_rollup remains available for provider/model
1689
+ -- same-segment filtering; historical facts keep their own recorded
1690
+ -- provider/model attributes.
1691
+ SELECT v.*, v.agent_run_id AS agent_invocation_id, t.risk AS task_risk,
1692
+ u.provider_group, u.model_group, u.input_tokens, u.cached_input_tokens,
1693
+ u.output_tokens, u.reasoning_tokens
1694
+ FROM activities v
1695
+ LEFT JOIN tasks t ON t.id=v.task_id
1696
+ LEFT JOIN usage_rollup u ON u.agent_invocation_id=v.agent_run_id
1697
+ )`,v=b.join(" AND "),A=Number(this.database.prepare(`${C} SELECT COUNT(*) AS count FROM (SELECT ${g} FROM facts i WHERE ${v} GROUP BY ${g})`).get(...O).count),x=Math.min(200,Math.max(1,n.limit??50)),T=Math.max(0,n.offset??0),N=o==="day"||o==="month"||o==="year"?"key DESC":"total_cost_brl DESC, key",H=this.database.prepare(`${C} SELECT ${g} AS key, ${g} AS label, ${g} AS period_key, MIN(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')) AS start_day, MAX(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')) AS end_day, COUNT(*) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.source_event_count) AS source_event_count, NULL AS total_duration, SUM(i.input_tokens) AS total_input_tokens, SUM(i.cached_input_tokens) AS total_cached_input_tokens, SUM(i.output_tokens) AS total_output_tokens, SUM(i.reasoning_tokens) AS total_reasoning_tokens, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM facts i WHERE ${v} GROUP BY ${g} ORDER BY ${N} LIMIT ? OFFSET ?`).all(...O,x,T);if(s){let ie={from:n.from??null,to:n.to??null,providers:n.provider?[n.provider]:[],models:n.model?[n.model]:[],agents:n.agent?[n.agent]:[],phases:n.phase?[n.phase]:[],statuses:n.status?[n.status]:[]},oe=this.costMonitorFactualDurationByDay(ie),be=!!(n.origin||n.priority||n.risk||n.workType),z=be?[]:this.database.prepare(`SELECT day, prd_count, spec_count, task_count, validation_count, evidence_count
1698
+ FROM daily_aggregate_cache WHERE (? IS NULL OR day >= ?) AND (? IS NULL OR day <= ?)`).all(Ht(n.from),Ht(n.from),Ht(n.to),Ht(n.to)),ye=new Map;for(let Ae of z){let W=String(Ae.day),ce=o==="day"?W:o==="month"?W.slice(0,7):W.slice(0,4),fe=ye.get(ce)??{prd_count:0,spec_count:0,task_count:0,validation_count:0,evidence_count:0};for(let Re of["prd_count","spec_count","task_count","validation_count","evidence_count"])fe[Re]=(fe[Re]??0)+Number(Ae[Re]??0);ye.set(ce,fe)}let B=new Map(H.map(Ae=>[String(Ae.period_key),Ae])),he=new Set((n.query?[]:[...new Set([...oe.keys(),...z.map(Ae=>String(Ae.day))])]).map(Ae=>o==="day"?Ae:o==="month"?Ae.slice(0,7):Ae.slice(0,4))),Fe=[...new Set([...B.keys(),...he])].sort((Ae,W)=>W.localeCompare(Ae)).map(Ae=>{let W=B.get(Ae)??{key:Ae,label:Ae,period_key:Ae,start_day:Ae,end_day:Ae,invocation_count:0,llm_call_count:null,source_event_count:0,total_tokens:null,total_cost_usd:null,total_cost_brl:null},ce=Re=>o==="day"?Re===Ae:Re.startsWith(Ae),fe=[...oe].filter(([Re])=>ce(Re));return{...W,...ye.get(Ae)??(be?{prd_count:null,spec_count:null,task_count:null,validation_count:null,evidence_count:null}:{prd_count:0,spec_count:0,task_count:0,validation_count:0,evidence_count:0}),total_run_count:Number(W.invocation_count??0),total_duration:fe.length===0||fe.some(([,Re])=>Re.eligible_runs!==Re.known_runs)?null:fe.reduce((Re,[,Ue])=>Re+Ue.known_sum,0)}});A=Fe.length,H=Fe.slice(T,T+x);for(let Ae of H){let W=String(Ae.period_key),ce=[...oe.keys()].filter(fe=>o==="day"?fe===W:fe.startsWith(W));ce.length>0&&(Ae.start_day=ce.sort()[0],Ae.end_day=ce.sort().at(-1))}}return{data_source:"sqlite_read_model",view:t,offset:T,limit:x,total_count:A,has_more:T+H.length<A,rows:H}}let d={cost_monitor_executions:"execution",cost_monitor_tasks:"task",cost_monitor_specs:"spec",cost_monitor_prds:"prd",cost_monitor_conversations:"conversation"}[t];if(d!==void 0){let g=d==="spec"||d==="prd",b=!!(n.provider||n.model||n.agent||n.phase||n.origin||n.workType||n.priority);if(g&&!b){let z=d==="spec"?"specs":"prds",ye=d==="spec"?"spec_id":"prd_id",B=[],he=[],Ke=[],Fe=[];n.from&&(B.push("entity.occurred_day_sp >= ?"),he.push(n.from.slice(0,10)),Ke.push("i.occurred_day_sp >= ?"),Fe.push(n.from.slice(0,10))),n.to&&(B.push("entity.occurred_day_sp <= ?"),he.push(n.to.slice(0,10)),Ke.push("i.occurred_day_sp <= ?"),Fe.push(n.to.slice(0,10))),n.status&&(B.push("entity.status = ?"),he.push(n.status)),n.risk&&(B.push("entity.risk = ?"),he.push(n.risk)),n.query&&(B.push("(entity.id LIKE ? OR COALESCE(entity.title, '') LIKE ?)"),he.push(`%${n.query}%`,`%${n.query}%`));let Ae=B.length===0?"1":B.join(" AND "),W=Ke.length===0?"":` AND ${Ke.join(" AND ")}`,ce=`WITH grouped AS (
1699
+ SELECT entity.id AS group_value, entity.title, entity.status, entity.risk,
1700
+ COALESCE(MIN(i.occurred_day_sp), entity.occurred_day_sp) AS first_day,
1701
+ COALESCE(MAX(i.occurred_day_sp), entity.occurred_day_sp) AS last_day,
1702
+ COALESCE(MAX(i.occurred_at), entity.occurred_at) AS occurred_at,
1703
+ COUNT(i.agent_invocation_id) AS invocation_count,
1704
+ SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration,
1705
+ SUM(i.input_tokens) AS total_input_tokens,
1706
+ SUM(i.cached_input_tokens) AS total_cached_input_tokens,
1707
+ SUM(i.output_tokens) AS total_output_tokens,
1708
+ SUM(i.reasoning_tokens) AS total_reasoning_tokens,
1709
+ SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd,
1710
+ SUM(i.cost_brl) AS total_cost_brl
1711
+ FROM ${z} entity
1712
+ LEFT JOIN invocations i ON i.${ye} = entity.id${W}
1713
+ WHERE ${Ae}
1714
+ GROUP BY entity.id, entity.title, entity.status, entity.risk, entity.occurred_at, entity.occurred_day_sp
1715
+ )`,fe=Math.min(200,Math.max(1,n.limit??50)),Re=Math.max(0,n.offset??0),Ue=[...Fe,...he],pt=Number(this.database.prepare(`${ce} SELECT COUNT(*) AS count FROM grouped`).get(...Ue).count),Et=this.database.prepare(`${ce} SELECT COUNT(*) AS entity_count, COALESCE(SUM(invocation_count), 0) AS invocation_count, ROUND(SUM(total_duration)) AS total_duration, SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl FROM grouped`).get(...Ue),Pt=this.database.prepare(`${ce} SELECT group_value AS id, group_value AS key, title, status, risk, first_day, last_day, occurred_at, invocation_count, llm_call_count, total_duration, total_input_tokens, total_cached_input_tokens, total_output_tokens, total_reasoning_tokens, total_tokens, total_cost_usd, total_cost_brl FROM grouped ORDER BY total_cost_brl DESC, group_value LIMIT ? OFFSET ?`).all(...Ue,fe,Re);return{data_source:"sqlite_read_model",view:t,offset:Re,limit:fe,total_count:pt,has_more:Re+Pt.length<pt,totals:Et,rows:Pt}}if(!!(n.provider||n.model||n.agent||n.phase||n.status||n.origin||n.workType||n.priority||n.risk)){let z={task:"i.task_id",spec:"i.spec_id",prd:"i.prd_id",execution:"i.execution_id",conversation:"i.conversation_id"}[d],ye=d==="task"?"tasks":d==="spec"?"specs":d==="prd"?"prds":null,B=[`${z} IS NOT NULL`],he=[];n.from&&(B.push("i.occurred_day_sp >= ?"),he.push(n.from.slice(0,10))),n.to&&(B.push("i.occurred_day_sp <= ?"),he.push(n.to.slice(0,10))),n.agent&&(B.push("i.zaip_agent = ?"),he.push(n.agent)),n.phase&&(B.push("i.phase = ?"),he.push(n.phase)),n.status&&(B.push("i.status = ?"),he.push(n.status)),n.risk&&(B.push("task_entity.risk = ?"),he.push(n.risk)),n.origin&&B.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),(n.workType||n.priority)&&B.push("0");let Ke=[];n.provider&&(n.provider==="unavailable"?B.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(Ke.push("u.provider = ?"),he.push(n.provider))),n.model&&(n.model==="unavailable"?B.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')"):(Ke.push("u.model = ?"),he.push(n.model))),Ke.length>0&&B.push(`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=i.agent_invocation_id AND ${Ke.join(" AND ")})`),n.query&&(B.push(ye===null?`${z} LIKE ?`:`(${z} LIKE ? OR COALESCE(entity.title, '') LIKE ?)`),he.push(`%${n.query}%`,...ye===null?[]:[`%${n.query}%`]));let W=`${ye===null?"":`LEFT JOIN ${ye} entity ON entity.id=${z}`} LEFT JOIN tasks task_entity ON task_entity.id=i.task_id`,ce=B.join(" AND "),fe=ye===null?z:`COALESCE(MAX(entity.title), ${z})`,Ue=`WITH grouped AS (SELECT ${z} AS group_value, ${fe} AS title, ${ye===null?"NULL":"MAX(entity.status)"} AS status, MAX(task_entity.risk) AS risk, MAX(i.occurred_at) AS occurred_at, COUNT(*) AS invocation_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM invocations i ${W} WHERE ${ce} GROUP BY ${z})`,pt=Math.min(200,Math.max(1,n.limit??50)),Et=Math.max(0,n.offset??0),Pt=Number(this.database.prepare(`${Ue} SELECT COUNT(*) AS count FROM grouped`).get(...he).count),go=this.database.prepare(`${Ue} SELECT COUNT(*) AS entity_count, COALESCE(SUM(invocation_count), 0) AS invocation_count, ROUND(SUM(total_duration)) AS total_duration, SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl FROM grouped`).get(...he),ho=this.database.prepare(`${Ue} SELECT group_value AS id, group_value AS key, title, status, risk, occurred_at, invocation_count, total_duration, total_tokens, total_cost_usd, total_cost_brl FROM grouped ORDER BY total_cost_brl DESC, group_value LIMIT ? OFFSET ?`).all(...he,pt,Et);return{data_source:"sqlite_read_model",view:t,offset:Et,limit:pt,total_count:Pt,has_more:Et+ho.length<Pt,totals:go,rows:ho}}let C={task:{table:"tasks",title:"entity.title",status:"entity.status",risk:"entity.risk"},spec:{table:"specs",title:"entity.title",status:"entity.status",risk:"entity.risk"},prd:{table:"prds",title:"entity.title",status:"entity.status",risk:"entity.risk"},execution:{table:"executions",title:"grouped.group_value",status:"entity.status",risk:"NULL"},conversation:{table:"conversations",title:"grouped.group_value",status:"entity.status",risk:"NULL"}}[d],v=["group_kind = ?","group_value IS NOT NULL"],A=[d];n.from&&(v.push("day >= ?"),A.push(n.from.slice(0,10))),n.to&&(v.push("day <= ?"),A.push(n.to.slice(0,10))),n.query&&(v.push("group_value LIKE ?"),A.push(`%${n.query}%`));let x=d==="provider"?n.provider:d==="model"?n.model:d==="zaip_agent"?n.agent:void 0;x&&(v.push("group_value = ?"),A.push(x));let T=v.join(" AND "),N=Number(this.database.prepare(`SELECT COUNT(DISTINCT group_value) AS count FROM cost_monitor_group_daily_cache WHERE ${T}`).get(...A).count),H=this.database.prepare(`SELECT COUNT(DISTINCT group_value) AS entity_count,
1716
+ COALESCE(SUM(invocation_count), 0) AS invocation_count,
1717
+ ROUND(SUM(total_duration)) AS total_duration,
1718
+ SUM(total_tokens) AS total_tokens,
1719
+ SUM(total_cost_usd) AS total_cost_usd,
1720
+ SUM(total_cost_brl) AS total_cost_brl
1721
+ FROM cost_monitor_group_daily_cache
1722
+ WHERE ${T}`).get(...A),ie=Math.min(200,Math.max(1,n.limit??50)),oe=Math.max(0,n.offset??0),be=this.database.prepare(`WITH grouped AS (
1723
+ SELECT group_value, MIN(day) AS first_day, MAX(day) AS last_day,
1724
+ SUM(invocation_count) AS invocation_count,
1725
+ SUM(llm_call_count) AS llm_call_count,
1726
+ SUM(total_duration) AS total_duration,
1727
+ SUM(total_input_tokens) AS total_input_tokens,
1728
+ SUM(total_cached_input_tokens) AS total_cached_input_tokens,
1729
+ SUM(total_output_tokens) AS total_output_tokens,
1730
+ SUM(total_reasoning_tokens) AS total_reasoning_tokens,
1731
+ SUM(total_tokens) AS total_tokens,
1732
+ SUM(total_cost_usd) AS total_cost_usd,
1733
+ SUM(total_cost_brl) AS total_cost_brl
1734
+ FROM cost_monitor_group_daily_cache
1735
+ WHERE ${T}
1736
+ GROUP BY group_value
1737
+ )
1738
+ SELECT grouped.group_value AS id, grouped.group_value AS key,
1739
+ COALESCE(${C.title}, grouped.group_value) AS title,
1740
+ ${C.status} AS status, ${C.risk} AS risk,
1741
+ grouped.first_day, grouped.last_day,
1742
+ grouped.last_day || 'T12:00:00.000Z' AS occurred_at,
1743
+ grouped.invocation_count, grouped.llm_call_count, grouped.total_duration,
1744
+ grouped.total_input_tokens, grouped.total_cached_input_tokens,
1745
+ grouped.total_output_tokens, grouped.total_reasoning_tokens,
1746
+ grouped.total_tokens, grouped.total_cost_usd, grouped.total_cost_brl
1747
+ FROM grouped
1748
+ LEFT JOIN ${C.table} entity ON entity.id = grouped.group_value
1749
+ ORDER BY grouped.total_cost_brl DESC, grouped.group_value
1750
+ LIMIT ? OFFSET ?`).all(...A,ie,oe);return{data_source:"sqlite_read_model",view:t,offset:oe,limit:ie,total_count:N,has_more:oe+be.length<N,totals:H,rows:be}}let u=x_[t],_=[],p=[],y=t==="cost_monitor_monthly"||t==="cost_monitor_annual"||t==="operations_monthly"||t==="operations_annual";y&&n.from?(_.push("end_day >= ?"),p.push(n.from.slice(0,10))):u.date!==null&&n.from&&(_.push(`${u.date} >= ?`),p.push(n.from.slice(0,10))),y&&n.to?(_.push("start_day <= ?"),p.push(n.to.slice(0,10))):u.date!==null&&n.to&&(_.push(`${u.date} <= ?`),p.push(n.to.slice(0,10))),n.query&&["cost_monitor_daily","cost_monitor_monthly","cost_monitor_annual","cost_monitor_overview_view","operations_monthly","operations_annual"].includes(t)&&(_.push("period_key LIKE ?"),p.push(`%${n.query}%`)),n.query&&t==="operations_daily"&&(_.push("day LIKE ?"),p.push(`%${n.query}%`)),n.status&&["operations_work_list","operations_work_kanban","operations_executions","operations_conversations","operations_decisions","operations_changes","operations_agent_invocations","first_fold_task","first_fold_spec","first_fold_prd"].includes(t)&&(_.push("status = ?"),p.push(n.status)),n.risk&&["operations_work_list","operations_work_kanban","operations_executions","operations_conversations","operations_decisions","operations_changes","operations_agent_invocations","first_fold_task","first_fold_spec","first_fold_prd"].includes(t)&&(_.push("risk = ?"),p.push(n.risk)),n.query&&["operations_work_list","operations_work_kanban","first_fold_top_tasks","first_fold_task","first_fold_spec","first_fold_prd"].includes(t)&&(_.push("(id LIKE ? OR title LIKE ?)"),p.push(`%${n.query}%`,`%${n.query}%`)),n.query&&t==="operations_executions"&&(_.push("execution_id LIKE ?"),p.push(`%${n.query}%`)),n.query&&t==="operations_conversations"&&(_.push("conversation_id LIKE ?"),p.push(`%${n.query}%`)),n.query&&(t==="operations_decisions"||t==="operations_changes")&&(_.push("id LIKE ?"),p.push(`%${n.query}%`)),t==="operations_agent_invocations"&&(n.query&&(_.push("(agent_invocation_id LIKE ? OR task_id LIKE ? OR execution_id LIKE ?)"),p.push(`%${n.query}%`,`%${n.query}%`,`%${n.query}%`)),n.agent&&(_.push("zaip_agent = ?"),p.push(n.agent)),n.phase&&(_.push("phase = ?"),p.push(n.phase)),n.provider&&(_.push("provider = ?"),p.push(n.provider)),n.model&&(_.push("model = ?"),p.push(n.model)));let f=_.length===0?"":` WHERE ${_.join(" AND ")}`,h=Number(this.database.prepare(`SELECT COUNT(*) AS count FROM ${t}${f}`).get(...p).count),k=Math.min(200,Math.max(1,n.limit??(t.includes("agent_invocations")?100:t==="first_fold_top_tasks"?5:50))),S=Math.max(0,n.offset??0),R=this.database.prepare(`SELECT * FROM ${t}${f} ORDER BY ${u.order} LIMIT ? OFFSET ?`).all(...p,k,S);if(t==="operations_daily"||t==="operations_monthly"||t==="operations_annual"){let g=t!=="operations_daily"&&(n.from||n.to),b=n.from?.slice(0,10)??null,O=n.to?.slice(0,10)??null,P=g?this.database.prepare("SELECT * FROM operations_daily WHERE (? IS NULL OR day >= ?) AND (? IS NULL OR day <= ?)").all(b,b,O,O):[],C=this.executionDurationByDay({from:n.from??null,to:n.to??null});for(let v of R){let A=String(v.day??v.period_key);if(g){let x=P.filter(N=>String(N.day).startsWith(A)),T=x.map(N=>String(N.day)).sort();v.start_day=T[0]??null,v.end_day=T.at(-1)??null;for(let N of["prd_count","spec_count","task_count","validation_count","evidence_count","total_run_count","invocation_count","llm_call_count","total_tokens","total_cost_usd","total_cost_brl"])v[N]=x.reduce((H,ie)=>H+(typeof ie[N]=="number"?Number(ie[N]):0),0)}v.operations_total_duration=[...C].filter(([x])=>t==="operations_daily"?x===A:x.startsWith(A)).reduce((x,[,T])=>x+T,0)}}return{data_source:"sqlite_read_model",view:t,offset:S,limit:k,total_count:h,has_more:S+R.length<h,rows:R}}metadata(){this.metadataValues===null&&(this.metadataValues=new Map(this.database.prepare("SELECT key, value FROM read_model_metadata").all().map(n=>[n.key,n.value])));let t=n=>Number(this.metadataValues?.get(n)??0);return{storage_mode:"sqlite_read_model",db_path:process.env.ZAIP_SQLITE_DB_PATH?"session-specific":bC,source_file_count:t("source_file_count"),excluded_source_count:t("excluded_source_count"),daily_aggregate_count:t("daily_aggregate_count"),activity_count:t("activity_count"),canonical_run_count:t("canonical_run_count"),agent_run_count:t("agent_run_count"),telemetry_summary_count:t("telemetry_summary_count"),unassisted_activity_count:t("unassisted_activity_count")}}};function SK(e,t){return encodeURIComponent(JSON.stringify([e,t]))}function kK(e){if(e===null)return null;try{let t=JSON.parse(decodeURIComponent(e));return Array.isArray(t)&&typeof t[0]=="string"&&typeof t[1]=="string"?[t[0],t[1]]:null}catch{return null}}function TC(e){return e.map(t=>({task_id:t.task_id,duration_ms:t.total_duration_ms,total_tokens:t.total_tokens,total_cost_usd:t.total_cost_usd,cost_brl:t.total_cost_brl,run_count:t.total_run_count}))}var Te="/api/v2",Hh="127.0.0.1",sc="zaip-dashboard-sqlite-runtime",kC="zaip-dashboard-sqlite-session",wK=".agents/dashboard/work-priority.json",wC=5e3,EK={"agent-orchestrator":"1 - Dave - Product Owner.png","agent-builder":"2 - Rafa - Tech Lead.png","agent-task-executor":"3 - Leo - Software Engineer.png","agent-analyst":"4 - Bia - Product Manager.png","agent-finalizer":"5 - Gui - Quality Assurance Lead.png","agent-reviewer":"6 - Nanda - Principal Engineer.png","agent-integrator":"7 - Dani - Integration Engineer.png","agent-auditor":"8 - Ana - Quality Auditor.png","agent-text-summarizer":"9 - Lia - Technical Writer.png","agent-data-analyst":"10 - Gabi - Data Analyst.png","agent-refactoring-specialist":"11 - Tati - Refactoring Specialist.png","agent-frontend":"12 - Doug - Frontend Developer.png","agent-backend":"13 - Will - Backend Developer.png","agent-website-developer":"14 - Jonny - Website Developer.png","agent-designer":"15 - Manu - Product Designer.png","agent-cloud-engineer":"16 - Dan - Cloud Engineer.png","agent-security-auditor":"17 - Luis - Security Auditor.png","agent-marketing-analyst":"18 - Lucia - Marketing Analyst.png"};function AK(e){let t=new Set(["prd","spec","change","task","execution"]),n=new Set(["active","executing","verifying","running","paused"]);return e.filter(i=>t.has(i.kind)&&(n.has(i.status??"")||i.kind==="task"&&i.status==="planned")).map(i=>i.id).sort()}var _n=class extends Error{name="V2WorkspaceRequiredError"};function xC(e){try{let t=new URL(e);return t.protocol==="http:"&&(t.hostname===Hh||t.hostname==="localhost")}catch{return!1}}function TK(e){try{let t=decodeURIComponent(e).replaceAll("\\","/");return!t.includes("\0")&&!t.split("/").some(n=>n==="..")}catch{return!1}}function OC(){return process.env.ZAIP_UI_TOKEN??(0,cc.randomBytes)(24).toString("base64url")}function xK(e){if(e.req.method!=="GET"&&e.req.method!=="HEAD"||e.req.path!=="/"&&e.req.path!=="/index.html")return!1;let t=e.req.header("origin");return t!==void 0&&!xC(t)?!1:e.req.header("sec-fetch-site")!=="cross-site"}async function R_(e){let t=await mA(e);if(t.version===1)throw new _n("Dashboard API requires a modern ZAIP-AIOS workspace");return t}function ve(e,t,n=200,i=!1){if(i){let r=`"${(0,cc.createHash)("sha256").update(JSON.stringify(t)).digest("base64url")}"`;if(e.header("ETag",r),e.header("Cache-Control","private, no-cache"),e.req.header("if-none-match")===r)return e.body(null,304)}return e.req.method==="HEAD"?e.body(null,n):e.json(t,n)}async function va(e,t,n,i={}){let r=e instanceof wt?OK(e,t,n,i):await Hs(e,t,n,i);if(!(e instanceof wt))return r;let o=e.firstFoldMonthlyQuick(n),a=n.from===null&&n.to===null?e.firstFoldViewportAllTime().aggregate:o?.aggregate??e.firstFoldAggregate(n);return{...r,summary:{...r.summary,run_count:a.total_run_count,overview_metrics:{...r.summary.overview_metrics,duration_ms:a.duration_ms,tokens:a.total_tokens,cost_brl:a.cost_brl,execution_day_count:a.execution_day_count,data_source:"run_records"}}}}function OK(e,t,n,i){let r=e.firstFoldMonthlyQuick(n),o=n.from===null&&n.to===null&&i.includeExtended===!0?e.firstFoldAllTime():null,a=o??(n.from===null&&n.to===null?e.firstFoldViewportAllTime():null),s=x=>r?.pages[x]??e.summaryPage(x,n,0,1e4).rows,l=a===null||i.includeBoardTasks===!0,c=l?s("task"):[],d=l?s("spec"):[],u=l?s("prd"):[],_=a?.aggregate??r?.aggregate??e.firstFoldAggregate(n),p=a?.aggregate.task_count??c.length,y=n.from===null&&n.to===null&&(o!==null||i.includeTopTasks===!0)?o?.top_tasks??e.firstFoldTopTasksAllTime():null,f=y===null?(r?.top_tasks??e.topTasks(n)).map(x=>({task_id:x.task_id,duration_ms:x.duration_ms,total_tokens:x.total_tokens,cost_brl:x.cost_brl,run_count:x.run_count})):TC(y),h=o===null?void 0:Object.fromEntries(["specs","prds"].map(x=>{let T=o.macro_metrics[x];return[x,{status_counts:T.status_counts,classification_counts:T.classification_counts,entity_count:T.entity_count,total_run_count:T.total_run_count,total_duration_ms:T.total_duration_ms,total_tokens:T.total_tokens,total_cost_usd:T.total_cost_usd,total_cost_brl:T.total_cost_brl,average_duration_ms:T.average_duration_ms,average_tokens:T.average_tokens,average_cost_usd:T.average_cost_usd,average_cost_brl:T.average_cost_brl,latest_created_at:T.latest_created_at,top_entities:T.top_entities.map(N=>({entity_id:N.entity_id,title:N.title,duration_ms:N.total_duration_ms,total_tokens:N.total_tokens,total_cost_usd:N.total_cost_usd,cost_brl:N.total_cost_brl,run_count:N.total_run_count,duration_share:N.duration_share}))}]})),k=a?.task_status_counts??{},S=a?.task_risk_counts??{};if(a===null)for(let x of c){let T=typeof x.status=="string"?x.status:"draft",N=typeof x.risk=="string"?x.risk:"standard";k[T]=(k[T]??0)+1,S[N]=(S[N]??0)+1}let R=a?.aggregate.latest_task_created_at??[...c,...d,...u].map(x=>typeof x.occurred_at=="string"?x.occurred_at:null).filter(x=>x!==null).sort().at(-1)??null,g={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},b={...g,tokens:{...g.tokens,total:_.total_tokens},cost:{...g.cost,brl:_.cost_brl}},O={conversation:g,planning:g,execution:g,total:b,new_work:g,rework:g},P=i.includePeriods===!0?e.dailyPeriods(n):{},C=Object.values(P).some(x=>x.usage.total_tokens.unknown>0||x.usage.cost.unknown>0),v=x=>({schema_version:2,id:String(x.id),revision:1,change_id:"",title:String(x.title??x.id),short_name:String(x.title??x.id),objective:"",status:RK(x.status),attempt_count:null,risk:CK(x.risk),priority:"medium",owner:null,requirement_ids:[],acceptance_ids:[],depends_on:[],write_scopes:[],created_at:String(x.occurred_at),updated_at:String(x.occurred_at),started_at:null,finished_at:null,result:null,artifact_path:".agents/records",progress:0,spec_id:null,execution_started:!1,telemetry:{duration_ms:mo(x.total_duration),tokens:mo(x.total_tokens),cost_brl:mo(x.total_cost_brl)}}),A=(x,T)=>{let N={...g,tokens:{...g.tokens,total:mo(x.total_tokens)},cost:{...g.cost,brl:mo(x.total_cost_brl)}};return{id:String(x.id),title:String(x.title??x.id),created_at:String(x.occurred_at),updated_at:String(x.occurred_at),kind:T,parent_id:null,artifact_path:".agents/records",lifecycle_status:String(x.status??"draft"),work_status:$K(x.status),execution_ids:[],task_ids:[],planned_tasks:[],canonical_run_ids:[],run_ids:[],root_execution_run_ids:[],execution_count:0,task_count:0,run_count:mo(x.invocation_count)??0,duration_ms:mo(x.total_duration),decisions:{human:0,agent:0},rework_run_count:0,quality:{completed_tasks:0,task_completion_rate:0,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},usage:{conversation:g,planning:g,execution:g,total:N,new_work:g,rework:g}}};return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",filters:n,summary:{prd_count:a?.aggregate.prd_count??u.length,spec_count:a?.aggregate.spec_count??d.length,execution_count:0,task_count:p,run_count:_.total_run_count,overview_metrics:{duration_ms:_.duration_ms,execution_day_count:_.execution_day_count,tokens:_.total_tokens,cost_brl:_.cost_brl,prd_count:a?.aggregate.prd_count??u.length,spec_count:a?.aggregate.spec_count??d.length,selected_counts:{prds:a?.aggregate.prd_count??u.length,specs:a?.aggregate.spec_count??d.length},task_count:p,completed_prd_count:a?.aggregate.completed_prd_count??u.filter(x=>x.status==="completed").length,completed_spec_count:a?.aggregate.completed_spec_count??d.filter(x=>x.status==="completed").length,completed_task_count:a?.aggregate.completed_task_count??k.completed??0,task_status_counts:k,task_risk_counts:S,top_tasks:f,...h===void 0?{}:{macro_metrics:h},latest_task_created_at:R,coverage:{duration:1,tokens:C?0:1,cost:C?0:1},data_source:"run_records",partial:!0},decisions:{human:0,agent:0},source_latest_at:R,quality:{completed_tasks:k.completed??0,task_completion_rate:p===0?0:(a?.aggregate.completed_task_count??k.completed??0)/p,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},reconciliation:{phase_tokens_match_total:!0,phase_usd_match_total:!0,phase_brl_match_total:!0,origin_tokens_match_total:!0},usage:O,periods:{daily:i.includePeriods===!0?P:{}}},origins:{conversation:O,task:O,spec:O,prd:O},prds:u.map(x=>A(x,"prd")),specs:d.map(x=>A(x,"spec")),tasks:i.includeBoardTasks?c.map(v):[],changes:[],executions:[],runs:[],decisions:[],evidences:[],validations:[]}}function mo(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function RK(e){return["draft","planned","executing","verifying","completed","failed","blocked","cancelled"].includes(String(e))?String(e):"draft"}function CK(e){return["lite","standard","critical"].includes(String(e))?String(e):"standard"}function $K(e){let t=String(e);return["executing","verifying","completed","blocked","failed","cancelled"].includes(t)?t:"planning"}async function RC(e,t={from:null,to:null}){if(e instanceof wt)return e.costMonitorSummaryAggregate(t);let n=await new Ut(e).readDailyReadModels("overview");if(n===null)throw new Error("Lifecycle daily overview is not initialized");return{periods:{daily:Object.fromEntries(Object.entries(n.days).map(([i,r])=>[i,r.overview]))}}}function IK(e,t,n){let r=e.canonicalTraceFiles([n]).find(h=>h.path.includes("/.agents/records/tasks/")||h.path.includes(".agents/records/tasks/"));if(r===void 0)throw new Error(`Canonical Task ${n} was not found`);let o=h=>{let k=/^---\r?\n([\s\S]*?)\r?\n---/.exec(r.content)?.[1]??"",S=new RegExp(`^${h}:\\s*(.+?)\\s*$`,"m").exec(k)?.[1]?.trim();return S===void 0||S==="null"?null:S.replace(/^['"]|['"]$/g,"")},a=(h,k)=>o(h)??new RegExp(`\\b${k}[A-Z0-9-]+`).exec(r.content)?.[0]??null,s=a("change_id","CHG-")??n,l=a("spec_id","SPEC-"),c=a("prd_id","PRD-"),d=[n,s,l,c].filter(h=>h!==null),u=e.canonicalTraceFiles(d).filter(h=>/\.(?:md|json|jsonl|txt|log)$/i.test(h.path)&&h.content.length<=25e4).map(h=>{let k=gh(h.path),S=o_(h.content);return{id:(0,cc.createHash)("sha256").update(h.path).digest("hex").slice(0,16),path:h.path,title:h.content.match(/^#\s+(.+)$/m)?.[1]?.trim()??h.path.split("/").at(-1)??h.path,...k,content:h.content,...S}}),_=mh(u),p=new Set(u.map(h=>h.stage)),y=o("risk"),f=o("status");return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",task_id:n,task_title:o("title")??r.content.match(/^#\s+(.+)$/m)?.[1]?.trim()??n,task_risk:y==="lite"||y==="standard"||y==="critical"?y:null,task_created_at:o("created_at"),task_progress:f==="completed"?100:f==="verifying"?80:f==="executing"?50:f==="blocked"||f==="failed"||f==="cancelled"?0:10,spec_id:l,prd_id:c,change_id:s,usage:e.taskTraceUsage(n),documents:u,stages:_,coverage:{stages_with_documents:p.size,stages_with_timestamps:_.filter(h=>h.status==="recorded").length,total_stages:6,evidence_count:u.filter(h=>h.kind==="evidence").length,test_count:u.filter(h=>h.kind==="test").length}}}function Kh(e=process.env.ZAIP_WORKSPACE??process.cwd(),t=OC(),n=(0,Bh.resolve)(process.env.ZAIP_UI_ROOT??"./dist"),i={}){let r=new Oh,o=i.filesystem??new mi(e),a=o instanceof wt,s=a?R_(o):null,l=()=>s??R_(o),c=i.snapshotReadOnly??a,d=i.snapshotState??"current",u=i.canonicalFilesystem??new mi(e),_=i.reconcileOpenWork??hC,p=i.refreshReadModel??(async()=>{a&&await o.rebuildAndRefresh(()=>ac(e))}),y=A_(e),f=i.syncAgentAdapters??(()=>CR(e)),h=Promise.resolve(),k=new Map,S=new Map,R=new Map,g=new Map,b=async(v,A,x=!1)=>{let T=R.get(v);if(!x&&T!==void 0&&(v.startsWith("operations:board:")||Date.now()-T.cachedAt<wC))return T.payload;let N=g.get(v);if(N!==void 0)return x?(await N,b(v,A,!0)):N;let H=A().then(ie=>(R.set(v,{payload:ie,cachedAt:Date.now()}),ie)).finally(()=>g.delete(v));return g.set(v,H),H},O=v=>{let{from:A,to:x}=Nt(v);return`${Gr(v)}:${A??""}:${x??""}`},P=()=>{S.clear(),R.clear(),g.clear()},C=v=>{let A=O(v),x=S.get(A);if(x!==void 0&&Date.now()-x.cachedAt<wC)return v.header("X-ZAIP-Snapshot-Cache","hit"),Promise.resolve(x.snapshot);let T=k.get(A);if(T!==void 0)return v.header("X-ZAIP-Snapshot-Cache","inflight"),T;v.header("X-ZAIP-Snapshot-Cache","miss");let N=l().then(H=>NK(o,e,v,H)).then(H=>(S.set(A,{snapshot:H,cachedAt:Date.now()}),H)).finally(()=>{k.delete(A)});return k.set(A,N),N};return r.use("*",async(v,A)=>(v.header("Cache-Control","no-store"),v.header("X-Content-Type-Options","nosniff"),v.header("Referrer-Policy","no-referrer"),v.header("Content-Security-Policy","default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; object-src 'none'; frame-ancestors 'none'"),xK(v)&&AR(v,kC,t,{httpOnly:!0,path:"/",sameSite:"Strict"}),A())),r.use(`${Te}/*`,async(v,A)=>{let x=v.req.method==="PUT"&&(v.req.path===`${Te}/work-priority`||v.req.path===`${Te}/project-settings`||!c&&(v.req.path===`${Te}/pricing`||v.req.path===`${Te}/fx-rate`||v.req.path===`${Te}/agent-catalog`)),T=v.req.method==="POST"&&v.req.path===`${Te}/reconcile-open-work`;if(v.req.method!=="GET"&&v.req.method!=="HEAD"&&!x&&!T)return v.header("Allow",v.req.path===`${Te}/pricing`||v.req.path===`${Te}/fx-rate`||v.req.path===`${Te}/agent-catalog`||v.req.path===`${Te}/project-settings`||v.req.path===`${Te}/work-priority`?"GET, HEAD, PUT":v.req.path===`${Te}/reconcile-open-work`?"POST":"GET, HEAD"),v.json({error:"Dashboard API is read-only"},405);if(v.req.path===`${Te}/health`||v.req.path===`${Te}/ready`)return A();let N=v.req.header("origin");if(N!==void 0&&!xC(N))return v.json({error:"Origin rejected"},403);let H=v.req.header("x-zaip-session"),ie=ER(v,kC),oe=v.req.method==="GET"&&v.req.path.startsWith(`${Te}/agent-catalog-assets/`)?v.req.query("token"):void 0;return H!==t&&ie!==t&&oe!==t?v.json({error:"Invalid local session"},401):A()}),r.on(["GET","HEAD"],`${Te}/health`,async v=>{try{let A=await l();return ve(v,{kind:sc,workspaceKey:y,service:"zaip-aios-dashboard",status:"ok",api_version:2,workspace_layout:A.version,read_only:!0,storage:a?o.metadata():{storage_mode:"filesystem"},snapshot_state:d})}catch(A){return ve(v,{kind:sc,workspaceKey:y,service:"zaip-aios-dashboard",status:"unavailable",api_version:2,read_only:!0,error:A instanceof Error?A.message:String(A)},503)}}),r.on(["GET","HEAD"],`${Te}/ready`,async v=>{try{let A=await l();if(a){let T=o.metadata();return ve(v,{kind:sc,workspaceKey:y,status:"ready",workspace_layout:A.version,storage_mode:T.storage_mode,activity_count:T.activity_count,day_count:T.daily_aggregate_count,snapshot_state:d})}let x=await va(o,A,{from:null,to:null});return ve(v,{kind:sc,workspaceKey:y,status:"ready",source_latest_at:x.summary.source_latest_at})}catch(A){return ve(v,{kind:sc,workspaceKey:y,status:"unavailable",error:A instanceof Error?A.message:String(A)},503)}}),r.on(["GET","HEAD"],`${Te}/operations`,async v=>{try{let A=performance.now(),x=v.req.query("scope");if(x!=="overview"&&x!=="quick"&&x!=="detail"&&x!=="board"&&x!=="classification")return ve(v,(await C(v)).operations);let T=await l(),N=performance.now()-A,{from:H,to:ie}=Nt(v);if(x==="board"){let be=FR(v.req.query("stage")),z=Math.max(0,Number.parseInt(v.req.query("offset")??"0",10)||0),ye=Math.min(50,Math.max(1,Number.parseInt(v.req.query("limit")??"10",10)||10)),B=await b(`operations:board:${H??""}:${ie??""}`,async()=>{let Ae=await va(o,T,{from:H,to:ie},{includeBoardTasks:!0});return{projection:Ae,priority:await k_(u,w_(Ae))}}),he=zR(v),Ke=JSON.stringify({from:H,to:ie,stage:be,offset:z,limit:ye,...he}),Fe=await b(`operations:board-page:${Ke}`,async()=>qR(B.projection,be,z,ye,B.priority.item_ids,he));return ve(v,Fe,200,!0)}if(x==="classification"){let be=v.req.query("kind"),z=v.req.query("classification");if(be!=="task"&&be!=="spec"&&be!=="prd")return ve(v,{error:"A valid work kind is required"},400);if(!["lite","standard","critical","empty","structured","rework"].includes(z??""))return ve(v,{error:"A valid classification is required"},400);let ye=Math.max(0,Number.parseInt(v.req.query("offset")??"0",10)||0),B=Math.min(50,Math.max(1,Number.parseInt(v.req.query("limit")??"50",10)||50)),he=await b(`operations:classification:${H??""}:${ie??""}`,()=>va(o,T,{from:H,to:ie},{includeBoardTasks:!0}));return ve(v,VR(he,be,z,ye,B),200,!0)}if(x==="quick"){let be=performance.now(),z=await b(`operations:quick:${H??""}:${ie??""}`,()=>va(o,T,{from:H,to:ie},{includeTopTasks:H===null&&ie===null}),v.req.query("fresh")==="1");if(process.env.ZAIP_DASHBOARD_PROFILE_FIRST_FOLD==="1"&&o instanceof wt){let ye=o.firstFoldViewportProfile();v.header("Server-Timing",[`layout;dur=${Math.round(N*10)/10}`,`projection;dur=${Math.round((performance.now()-be)*10)/10}`,...Object.entries(ye).map(([B,he])=>`${B};dur=${he}`)].join(", "))}return ve(v,z,200,!0)}let oe=o instanceof wt?await va(o,T,{from:H,to:ie},{includeBoardTasks:x==="detail",includeExtended:x==="detail"||x==="overview",includePeriods:x==="detail"||x==="overview"}):await S_(o,T,{from:H,to:ie},x==="overview");return ve(v,oe,200,x==="overview")}catch(A){if(A instanceof _n)throw A;return ve(v,{error:A instanceof Error?A.message:String(A)},400)}}),iC(r,o,b,ve),r.on(["GET","HEAD"],`${Te}/sqlite-read-models`,async v=>{if(!(o instanceof wt))return ve(v,{error:"SQLite read model is not active"},409);let A=v.req.query("kind"),x=Math.max(0,Number.parseInt(v.req.query("offset")??"0",10)||0),T=Math.min(200,Math.max(1,Number.parseInt(v.req.query("limit")??"20",10)||20));if(A==="overview"){let oe=v.req.query("period");return oe!=="day"&&oe!=="month"&&oe!=="year"?ve(v,{error:"Unsupported SQLite overview period"},400):ve(v,o.overviewPage(oe,x,T),200,!0)}if(A!=="task"&&A!=="spec"&&A!=="prd")return ve(v,{error:"Unsupported SQLite read model"},400);let{from:N,to:H}=Nt(v),ie=po(v);return ve(v,o.summaryPage(A,{from:N,to:H,...ie},x,T,v.req.query("cursor")??null),200,!0)}),r.on(["GET","HEAD"],`${Te}/sqlite-views`,async v=>{if(!(o instanceof wt))return ve(v,{error:"SQLite read model is not active"},409);let A=v.req.query("view");if(A===void 0||!(A in x_))return ve(v,{error:"Unsupported SQLite view"},400);let x=Number.parseInt(v.req.query("limit")??"",10),T=A.includes("agent_invocations")?100:A==="first_fold_top_tasks"?5:50,N=Math.min(200,Math.max(1,Number.isFinite(x)?x:T)),{from:H,to:ie}=Nt(v),oe=be=>{let z=v.req.query(be);return z===void 0?{}:{[be]:z}};return ve(v,o.viewPage(A,{from:H,to:ie,...oe("query"),...oe("status"),...oe("risk"),...oe("provider"),...oe("model"),...oe("agent"),...oe("phase"),...oe("origin"),...oe("workType"),...oe("priority"),offset:Math.max(0,Number.parseInt(v.req.query("offset")??"0",10)||0),limit:N}),200,!0)}),r.on(["GET","HEAD"],`${Te}/work-priority`,async v=>{let A=await R_(u),x=await Ks(u,A,{from:null,to:null});return ve(v,await k_(u,w_(x)))}),r.on(["GET","HEAD"],`${Te}/operations/entities`,async v=>{let A=Math.max(0,Number.parseInt(v.req.query("offset")??"0",10)||0),x=Math.min(500,Math.max(1,Number.parseInt(v.req.query("limit")??"100",10)||100)),T=v.req.query("kind");if(T!=="changes"&&T!=="decisions")return ve(v,{error:"Unsupported Operations entity page"},400);let{from:N,to:H}=Nt(v),ie=po(v),oe=await b(`operations:entities:${T}:${N??""}:${H??""}:${A}:${x}:${ie.query}:${ie.status}:${ie.risk}`,async()=>{let be=await l(),z=await new Ut(o).readEntities(T==="changes"?"change":"decision"),ye=T==="changes"?GR(z,be,N,H):XR(z,be,N,H),B=QR(ye,ie);return{data_source:"lifecycle_manifest_shards",kind:T,offset:A,limit:x,total:B.length,rows:B.slice(A,A+x)}});return ve(v,oe,200,!0)}),rC(r,o,b,ve),r.put(`${Te}/work-priority`,async v=>{let A=jh(await v.req.json());return await u.writeTextAtomic(wK,`${JSON.stringify(A,null,2)}
1751
+ `),P(),v.json(A)}),r.on(["GET","HEAD"],`${Te}/snapshot`,async v=>{try{return ve(v,await C(v))}catch(A){if(A instanceof _n)throw A;return ve(v,{error:A instanceof Error?A.message:String(A)},400)}}),r.post(`${Te}/reconcile-open-work`,async v=>{try{await l();let A=await _(u,e);return await p(),P(),v.json({...await C(v),reconciliation:A})}catch(A){if(A instanceof _n)throw A;return v.json({error:A instanceof Error?A.message:String(A)},400)}}),r.on(["GET","HEAD"],`${Te}/cost-monitor`,async v=>{try{let A=v.req.query("scope")??"summary";if(A==="summary"){let ie=await l(),{from:oe,to:be}=Nt(v),z=Gr(v),ye=performance.now(),[B,he]=await Promise.all([RC(o,{from:oe,to:be,providers:lt(v,"provider"),models:lt(v,"model"),agents:lt(v,"agent"),phases:lt(v,"phase"),statuses:lt(v,"status"),tasks:lt(v,"task"),specs:lt(v,"spec"),prds:lt(v,"prd"),executions:lt(v,"execution"),changes:lt(v,"change")}),z==="BRL"?Dh(o):Promise.resolve(null)]),Ke=performance.now()-ye,Fe={schema_version:1,layout_version:ie.version,readonly:!0,source:".agents/records",filters:{from:oe,to:be},summary:{task_count:B.task_count??0},prds:[],specs:[],runs:[]},Ae=performance.now(),W=ph(B,Fe,z,he?.rate??null);return v.header("Server-Timing",`cost_sql;dur=${Ke.toFixed(1)},cost_projection;dur=${(performance.now()-Ae).toFixed(1)}`),ve(v,W,200,!0)}if(A==="runs"){let ie=await l(),{from:oe,to:be}=Nt(v),z=Math.max(0,Number.parseInt(v.req.query("offset")??"0",10)||0),ye=Math.min(500,Math.max(1,Number.parseInt(v.req.query("limit")??"100",10)||100));return ve(v,await lC(o,ie,v,{from:oe,to:be},z,ye),200,!0)}if(uC(v))return ve(v,(await C(v)).costs);let x=await l(),{from:T,to:N}=Nt(v),H=await S_(o,x,{from:T,to:N});return ve(v,await sC(o,H,v))}catch(A){if(A instanceof _n)throw A;return ve(v,{error:A instanceof Error?A.message:String(A)},400)}}),r.on(["GET","HEAD"],`${Te}/pricing`,async v=>ve(v,Ji.parse(JSON.parse(await o.readText(".agents/config/pricing/models.json"))))),r.put(`${Te}/pricing`,async v=>{let A=Ji.parse({...await v.req.json(),updated_at:new Date().toISOString()});return await o.writeTextAtomic(".agents/config/pricing/models.json",`${JSON.stringify(A,null,2)}
1752
+ `),P(),v.json(A)}),r.on(["GET","HEAD"],`${Te}/fx-rate`,async v=>{let A=await new hi(o).readLatestFxRate();return ve(v,A)}),r.put(`${Te}/fx-rate`,async v=>{let A=Hi.pick({rate:!0}).parse(await v.req.json()),x=await new hi(o).writeCurrentFxRate(A.rate);return P(),v.json(x)}),r.on(["GET","HEAD"],`${Te}/agent-catalog`,async v=>{try{return ve(v,await NR(o))}catch(A){return ve(v,{error:A instanceof Error?A.message:String(A)},400)}}),r.get(`${Te}/agent-catalog-assets/:agentId`,async v=>{let A=EK[v.req.param("agentId")];if(A===void 0)return v.json({error:"Agent portrait not found"},404);try{return v.body(await(0,AC.readFile)((0,Bh.resolve)(e,".agents/config/src",A)),200,{"cache-control":"no-store","content-type":"image/png"})}catch(x){return x.code==="ENOENT"?v.json({error:"Agent portrait not found"},404):v.json({error:"Agent portrait could not be read"},500)}}),r.put(`${Te}/agent-catalog`,async v=>{let A=async()=>{try{let T=await PR(o,await v.req.json(),f);return P(),v.json(T)}catch(T){return T instanceof Ft?v.json({error:T.message},T.status):v.json({error:"Agent catalog update failed"},500)}},x=h.then(A,A);return h=x.then(()=>{},()=>{}),x}),r.on(["GET","HEAD"],`${Te}/project-settings`,async v=>{try{return ve(v,await jR(u))}catch(A){return ve(v,{error:A instanceof Error?A.message:String(A)},400)}}),r.on(["GET","HEAD"],`${Te}/project-settings/overview`,async v=>ve(v,await DR(u))),r.put(`${Te}/project-settings`,async v=>{try{let A=await UR(u,await v.req.json());return P(),v.json(A)}catch(A){return v.json({error:A instanceof Error?A.message:"Project settings update failed"},400)}}),r.on(["GET","HEAD"],`${Te}/tasks/:id`,async v=>{try{let A=await l();return ve(v,await ih(o,A,v.req.param("id")))}catch(A){if(A instanceof _n)throw A;return ve(v,{error:"Task not found"},404)}}),r.on(["GET","HEAD"],`${Te}/prds/:id`,async v=>{try{let A=await l();return ve(v,await oh(o,A,v.req.param("id")))}catch(A){if(A instanceof _n)throw A;return ve(v,{error:"PRD not found"},404)}}),r.on(["GET","HEAD"],`${Te}/specs/:id`,async v=>{try{let A=await l();return ve(v,await ah(o,A,v.req.param("id")))}catch(A){if(A instanceof _n)throw A;return ve(v,{error:"SPEC not found"},404)}}),r.on(["GET","HEAD"],`${Te}/tasks/:id/trace`,async v=>{try{let A=await l(),x=v.req.param("id");return ve(v,o instanceof wt?IK(o,A,x):await GO(o,A,x))}catch(A){if(A instanceof _n)throw A;return ve(v,{error:"Task trace not found"},404)}}),r.onError((v,A)=>{let x=v instanceof _n?409:500;return ve(A,{error:x===409?v.message:"Dashboard projection failed"},x)}),r.all(`${Te}/*`,v=>ve(v,{error:"Not found"},404)),r.on(["GET","HEAD"],"/",Sc({path:`${n}/index.html`})),r.use("/*",async(v,A)=>TK(v.req.path)?A():v.json({error:"Invalid dashboard asset path"},400)),r.use("/*",Sc({root:n})),r.on(["GET","HEAD"],"/*",Sc({path:`${n}/index.html`})),r}async function NK(e,t,n,i){let r=i??await R_(e),{from:o,to:a}=Nt(n),s=Gr(n),l=e instanceof wt?await va(e,r,{from:o,to:a}):await S_(e,r,{from:o,to:a}),c=e instanceof wt?ph(await RC(e,{from:o,to:a}),l,s,s==="BRL"?(await Dh(e))?.rate??null:null):await ha(e,l,s);return{operations:l,costs:c,dashboard:await gC(e,t),projection:{source_latest_at:l.summary.source_latest_at,served_at:new Date().toISOString()}}}var PK=performance.now(),CC=OC(),C_=process.env.ZAIP_WORKSPACE??process.cwd(),EC;function Jh(){return EC??=Kh(C_,CC),EC}var MK=new Proxy({},{get(e,t){let n=Reflect.get(Jh(),t);return typeof n=="function"?n.bind(Jh()):n}});function O_(e){process.stderr.write(`${JSON.stringify({event:"dashboard_sqlite_startup_phase",phase:e,elapsed_ms:Math.round(performance.now()-PK)})}
1753
+ `)}async function LK(){let e=Number.parseInt(process.env.ZAIP_SERVER_PORT??"4317",10);O_("main_entered");let t=performance.now(),n=await ac(C_);process.stderr.write(`${JSON.stringify({event:"dashboard_sqlite_read_model",elapsed_ms:Math.round(performance.now()-t),cache:n.cache,fingerprint_ms:n.fingerprint_ms,materialize_ms:n.materialize_ms,source_files:n.files})}
1754
+ `),O_("read_model_ready");let i=Kh(C_,CC,void 0,{filesystem:new wt(C_),snapshotState:n.cache==="stale_seed"?"updating":"current"});O_("runtime_app_ready"),Ay({fetch:i.fetch,hostname:Hh,port:e},({port:r})=>{O_("listening"),process.stdout.write(`ZAIP-AIOS dashboard API: http://${Hh}:${r}${Te}/health
1755
+ `)})}(process.argv[1]?.endsWith("server.cjs")||process.argv[1]?.endsWith("server.js")||process.argv[1]?.endsWith("server.mjs"))&&LK();0&&(module.exports={SqliteReadModelFileSystem,app,createDashboardApp,dashboardWorkspaceKey,defaultDashboardApp,githubRepositoryFromRemote,manifestRun,mergeManifestRuns,openWorkIds,projectAllTimeTopTasks,projectionPeriodFilter,rebuildSqliteReadModel,reconciliationResult,validateSqliteReadModelSchema});
1756
+ //# sourceMappingURL=server.cjs.map