@noorm/marie-cli 0.1.18 → 0.1.25

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 (251) hide show
  1. package/README.md +7 -15
  2. package/SENTINEL.md +4 -7
  3. package/dist/cli-new/components/App.js +16 -63
  4. package/dist/cli-new/components/App.js.map +1 -1
  5. package/dist/cli-new/components/ApprovalDialog.js +2 -1
  6. package/dist/cli-new/components/ApprovalDialog.js.map +1 -1
  7. package/dist/cli-new/components/Banner.js +4 -3
  8. package/dist/cli-new/components/Banner.js.map +1 -1
  9. package/dist/cli-new/components/ChatArea.js +6 -7
  10. package/dist/cli-new/components/ChatArea.js.map +1 -1
  11. package/dist/cli-new/components/Header.js +13 -7
  12. package/dist/cli-new/components/Header.js.map +1 -1
  13. package/dist/cli-new/components/InputArea.js +73 -12
  14. package/dist/cli-new/components/InputArea.js.map +1 -1
  15. package/dist/cli-new/components/MessageBubble.js +26 -18
  16. package/dist/cli-new/components/MessageBubble.js.map +1 -1
  17. package/dist/cli-new/components/SessionSwitcher.js +4 -7
  18. package/dist/cli-new/components/SessionSwitcher.js.map +1 -1
  19. package/dist/cli-new/components/SetupWizard.js +80 -257
  20. package/dist/cli-new/components/SetupWizard.js.map +1 -1
  21. package/dist/cli-new/components/ToolCallDisplay.js +20 -5
  22. package/dist/cli-new/components/ToolCallDisplay.js.map +1 -1
  23. package/dist/cli-new/components/WizardSteps.js +22 -0
  24. package/dist/cli-new/components/WizardSteps.js.map +1 -0
  25. package/dist/cli-new/constants/SetupConstants.js +42 -0
  26. package/dist/cli-new/constants/SetupConstants.js.map +1 -0
  27. package/dist/cli-new/hooks/useGit.js +19 -62
  28. package/dist/cli-new/hooks/useGit.js.map +1 -1
  29. package/dist/cli-new/hooks/useMarie.js +26 -18
  30. package/dist/cli-new/hooks/useMarie.js.map +1 -1
  31. package/dist/cli-new/hooks/useSessions.js +1 -1
  32. package/dist/cli-new/hooks/useSessions.js.map +1 -1
  33. package/dist/cli-new/hooks/useSetupWizard.js +88 -0
  34. package/dist/cli-new/hooks/useSetupWizard.js.map +1 -0
  35. package/dist/cli-new/hooks/useUpdateCheck.js +4 -3
  36. package/dist/cli-new/hooks/useUpdateCheck.js.map +1 -1
  37. package/dist/cli-new/index.js +2 -4
  38. package/dist/cli-new/index.js.map +1 -1
  39. package/dist/cli-new/services/CommandService.js +104 -0
  40. package/dist/cli-new/services/CommandService.js.map +1 -0
  41. package/dist/cli-new/services/GitService.js +91 -0
  42. package/dist/cli-new/services/GitService.js.map +1 -0
  43. package/dist/cli-new/services/MarieService.js +77 -0
  44. package/dist/cli-new/services/MarieService.js.map +1 -0
  45. package/dist/cli-new/services/auth-server.js +128 -0
  46. package/dist/cli-new/services/auth-server.js.map +1 -0
  47. package/dist/cli-new/utils/version.js +24 -0
  48. package/dist/cli-new/utils/version.js.map +1 -0
  49. package/dist/monolith/adapters/CliMarieAdapter.js +12 -11
  50. package/dist/monolith/adapters/CliMarieAdapter.js.map +1 -1
  51. package/dist/monolith/cli/CliFileSystemPort.js +17 -3
  52. package/dist/monolith/cli/CliFileSystemPort.js.map +1 -1
  53. package/dist/monolith/cli/MarieToolDefinitionsCLI.js +39 -31
  54. package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -1
  55. package/dist/monolith/cli/index.js +5 -20
  56. package/dist/monolith/cli/index.js.map +1 -1
  57. package/dist/monolith/cli/services/JoyAutomationServiceCLI.js +15 -62
  58. package/dist/monolith/cli/services/JoyAutomationServiceCLI.js.map +1 -1
  59. package/dist/monolith/cli/storage.js +142 -72
  60. package/dist/monolith/cli/storage.js.map +1 -1
  61. package/dist/monolith/domain/joy/RitualService.js +44 -46
  62. package/dist/monolith/domain/joy/RitualService.js.map +1 -1
  63. package/dist/monolith/domain/marie/MarieCortex.js +148 -0
  64. package/dist/monolith/domain/marie/MarieCortex.js.map +1 -0
  65. package/dist/monolith/domain/marie/PersonalityRenderer.js +97 -0
  66. package/dist/monolith/domain/marie/PersonalityRenderer.js.map +1 -0
  67. package/dist/monolith/infrastructure/Configuration.js +68 -0
  68. package/dist/monolith/infrastructure/Configuration.js.map +1 -0
  69. package/dist/monolith/infrastructure/CoreInfrastructure.js +204 -0
  70. package/dist/monolith/infrastructure/CoreInfrastructure.js.map +1 -0
  71. package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js +3 -3
  72. package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js.map +1 -1
  73. package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js +6 -27
  74. package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -1
  75. package/dist/monolith/infrastructure/ai/context/ContextManager.js +142 -131
  76. package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -1
  77. package/dist/monolith/infrastructure/ai/core/MarieEngine.js +115 -1077
  78. package/dist/monolith/infrastructure/ai/core/MarieEngine.js.map +1 -1
  79. package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js +1 -37
  80. package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js.map +1 -1
  81. package/dist/monolith/infrastructure/ai/core/MarieLockManager.js +6 -1
  82. package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -1
  83. package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +172 -221
  84. package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js.map +1 -1
  85. package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js +292 -141
  86. package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js.map +1 -1
  87. package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js +331 -614
  88. package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js.map +1 -1
  89. package/dist/monolith/infrastructure/ai/core/MarieVitality.js +238 -0
  90. package/dist/monolith/infrastructure/ai/core/MarieVitality.js.map +1 -0
  91. package/dist/monolith/infrastructure/ai/core/SessionLogService.js +9 -2
  92. package/dist/monolith/infrastructure/ai/core/SessionLogService.js.map +1 -1
  93. package/dist/monolith/infrastructure/ai/providers/AIProvider.js +402 -1
  94. package/dist/monolith/infrastructure/ai/providers/AIProvider.js.map +1 -1
  95. package/dist/monolith/infrastructure/ai/providers/DreamBeesProvider.js +114 -0
  96. package/dist/monolith/infrastructure/ai/providers/DreamBeesProvider.js.map +1 -0
  97. package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js +426 -392
  98. package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js.map +1 -1
  99. package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js +235 -241
  100. package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js.map +1 -1
  101. package/dist/monolith/infrastructure/ai/workerAi.js +185 -0
  102. package/dist/monolith/infrastructure/ai/workerAi.js.map +1 -0
  103. package/dist/monolith/infrastructure/config/ConfigService.js +216 -503
  104. package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -1
  105. package/dist/monolith/infrastructure/joy/CognitiveRituals.js +4 -165
  106. package/dist/monolith/infrastructure/joy/CognitiveRituals.js.map +1 -1
  107. package/dist/monolith/infrastructure/joy/JoyTools.js +14 -47
  108. package/dist/monolith/infrastructure/joy/JoyTools.js.map +1 -1
  109. package/dist/monolith/infrastructure/persistence/MarieMindAutonomics.js +4 -0
  110. package/dist/monolith/infrastructure/persistence/MarieMindAutonomics.js.map +1 -0
  111. package/dist/monolith/infrastructure/persistence/MarieMindEngine.js +11 -0
  112. package/dist/monolith/infrastructure/persistence/MarieMindEngine.js.map +1 -0
  113. package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js +123 -106
  114. package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js.map +1 -1
  115. package/dist/monolith/infrastructure/persistence/NoormmeEngine.js +508 -63
  116. package/dist/monolith/infrastructure/persistence/NoormmeEngine.js.map +1 -1
  117. package/dist/monolith/infrastructure/persistence/NoormmeSchema.js +68 -39
  118. package/dist/monolith/infrastructure/persistence/NoormmeSchema.js.map +1 -1
  119. package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js +80 -67
  120. package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js.map +1 -1
  121. package/dist/monolith/infrastructure/persistence/NoormmeTools.js +122 -75
  122. package/dist/monolith/infrastructure/persistence/NoormmeTools.js.map +1 -1
  123. package/dist/monolith/infrastructure/services/MarieMemoryStore.js +133 -134
  124. package/dist/monolith/infrastructure/services/MarieMemoryStore.js.map +1 -1
  125. package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js +6 -30
  126. package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js.map +1 -1
  127. package/dist/monolith/infrastructure/tools/PureStreamParser.js +68 -80
  128. package/dist/monolith/infrastructure/tools/PureStreamParser.js.map +1 -1
  129. package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js +12 -11
  130. package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js.map +1 -1
  131. package/dist/monolith/infrastructure/tools/SovereignTools.js +326 -0
  132. package/dist/monolith/infrastructure/tools/SovereignTools.js.map +1 -0
  133. package/dist/monolith/infrastructure/tools/ToolRegistry.js +45 -26
  134. package/dist/monolith/infrastructure/tools/ToolRegistry.js.map +1 -1
  135. package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js +39 -153
  136. package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js.map +1 -1
  137. package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js +31 -46
  138. package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js.map +1 -1
  139. package/dist/monolith/infrastructure/tools/definitions/ContextTools.js +41 -13
  140. package/dist/monolith/infrastructure/tools/definitions/ContextTools.js.map +1 -1
  141. package/dist/monolith/infrastructure/tools/definitions/CoreTools.js +10 -14
  142. package/dist/monolith/infrastructure/tools/definitions/CoreTools.js.map +1 -1
  143. package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js +39 -70
  144. package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js.map +1 -1
  145. package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js +30 -181
  146. package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js.map +1 -1
  147. package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js +12 -9
  148. package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js.map +1 -1
  149. package/dist/monolith/plumbing/Plumbing.js +238 -0
  150. package/dist/monolith/plumbing/Plumbing.js.map +1 -0
  151. package/dist/monolith/plumbing/PlumbingAnalysis.js +109 -0
  152. package/dist/monolith/plumbing/PlumbingAnalysis.js.map +1 -0
  153. package/dist/monolith/plumbing/PlumbingSystem.js +169 -0
  154. package/dist/monolith/plumbing/PlumbingSystem.js.map +1 -0
  155. package/dist/monolith/plumbing/analysis/ComplexityService.js +30 -34
  156. package/dist/monolith/plumbing/analysis/ComplexityService.js.map +1 -1
  157. package/dist/monolith/plumbing/analysis/DependencyService.js +55 -44
  158. package/dist/monolith/plumbing/analysis/DependencyService.js.map +1 -1
  159. package/dist/monolith/plumbing/analysis/DiscoveryService.js +40 -42
  160. package/dist/monolith/plumbing/analysis/DiscoveryService.js.map +1 -1
  161. package/dist/monolith/plumbing/analysis/JoyMapService.js +52 -56
  162. package/dist/monolith/plumbing/analysis/JoyMapService.js.map +1 -1
  163. package/dist/monolith/plumbing/analysis/LintService.js +118 -118
  164. package/dist/monolith/plumbing/analysis/LintService.js.map +1 -1
  165. package/dist/monolith/plumbing/analysis/MarieSentinelService.js +278 -268
  166. package/dist/monolith/plumbing/analysis/MarieSentinelService.js.map +1 -1
  167. package/dist/monolith/plumbing/analysis/QualityGuardrailService.js +116 -114
  168. package/dist/monolith/plumbing/analysis/QualityGuardrailService.js.map +1 -1
  169. package/dist/monolith/plumbing/analysis/SurgicalMender.js +57 -59
  170. package/dist/monolith/plumbing/analysis/SurgicalMender.js.map +1 -1
  171. package/dist/monolith/plumbing/analysis/TestService.js +89 -89
  172. package/dist/monolith/plumbing/analysis/TestService.js.map +1 -1
  173. package/dist/monolith/plumbing/filesystem/FileService.js +123 -195
  174. package/dist/monolith/plumbing/filesystem/FileService.js.map +1 -1
  175. package/dist/monolith/plumbing/filesystem/PathResolver.js +7 -8
  176. package/dist/monolith/plumbing/filesystem/PathResolver.js.map +1 -1
  177. package/dist/monolith/plumbing/git/GitService.js +4 -4
  178. package/dist/monolith/plumbing/git/GitService.js.map +1 -1
  179. package/dist/monolith/plumbing/lsp/SymbolService.js +5 -34
  180. package/dist/monolith/plumbing/lsp/SymbolService.js.map +1 -1
  181. package/dist/monolith/plumbing/terminal/ProcessRegistry.js +20 -22
  182. package/dist/monolith/plumbing/terminal/ProcessRegistry.js.map +1 -1
  183. package/dist/monolith/plumbing/terminal/TerminalService.js +127 -141
  184. package/dist/monolith/plumbing/terminal/TerminalService.js.map +1 -1
  185. package/dist/monolith/plumbing/utils/EnvironmentUtils.js +3 -23
  186. package/dist/monolith/plumbing/utils/EnvironmentUtils.js.map +1 -1
  187. package/dist/monolith/plumbing/utils/JsonUtils.js +252 -311
  188. package/dist/monolith/plumbing/utils/JsonUtils.js.map +1 -1
  189. package/dist/monolith/plumbing/utils/PlumbingCore.js +549 -0
  190. package/dist/monolith/plumbing/utils/PlumbingCore.js.map +1 -0
  191. package/dist/monolith/plumbing/utils/PrefixTree.js +61 -114
  192. package/dist/monolith/plumbing/utils/PrefixTree.js.map +1 -1
  193. package/dist/monolith/plumbing/utils/StreamTagDetector.js +89 -127
  194. package/dist/monolith/plumbing/utils/StreamTagDetector.js.map +1 -1
  195. package/dist/monolith/plumbing/utils/StringUtils.js +87 -89
  196. package/dist/monolith/plumbing/utils/StringUtils.js.map +1 -1
  197. package/dist/monolith/runtime/MarieRuntime.js +76 -499
  198. package/dist/monolith/runtime/MarieRuntime.js.map +1 -1
  199. package/dist/monolith/runtime/RuntimeAdapterBase.js +1 -1
  200. package/dist/monolith/runtime/RuntimeAdapterBase.js.map +1 -1
  201. package/dist/monolith/runtime/providerFactory.js +1 -7
  202. package/dist/monolith/runtime/providerFactory.js.map +1 -1
  203. package/dist/monolith/services/HealthService.js +29 -32
  204. package/dist/monolith/services/HealthService.js.map +1 -1
  205. package/dist/monolith/services/JoyAutomationService.js +58 -95
  206. package/dist/monolith/services/JoyAutomationService.js.map +1 -1
  207. package/dist/monolith/services/MarieAutomationService.js +59 -0
  208. package/dist/monolith/services/MarieAutomationService.js.map +1 -0
  209. package/dist/monolith/services/MarieGhostService.js +46 -173
  210. package/dist/monolith/services/MarieGhostService.js.map +1 -1
  211. package/dist/monolith/services/MarieServices.js +102 -0
  212. package/dist/monolith/services/MarieServices.js.map +1 -0
  213. package/dist/monolith/services/MarieTypes.js +2 -0
  214. package/dist/monolith/services/MarieTypes.js.map +1 -0
  215. package/dist/monolith/services/UpdateService.js +47 -49
  216. package/dist/monolith/services/UpdateService.js.map +1 -1
  217. package/dist/prompts.js +11 -5
  218. package/dist/prompts.js.map +1 -1
  219. package/dist/test_prefix_tree.js +9 -9
  220. package/dist/test_prefix_tree.js.map +1 -1
  221. package/package.json +18 -89
  222. package/run_test.js +5 -0
  223. package/.marie_visual_verify_1771225696548/progress_bar_check.txt +0 -1
  224. package/dist/extension.cjs +0 -1155
  225. package/dist/extension.js +0 -474
  226. package/dist/extension.js.map +0 -1
  227. package/dist/monolith/adapters/VscodeMarieAdapter.js +0 -81
  228. package/dist/monolith/adapters/VscodeMarieAdapter.js.map +0 -1
  229. package/dist/monolith/infrastructure/ai/core/GhostPort.js +0 -2
  230. package/dist/monolith/infrastructure/ai/core/GhostPort.js.map +0 -1
  231. package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js +0 -33
  232. package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js.map +0 -1
  233. package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js +0 -154
  234. package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +0 -1
  235. package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +0 -214
  236. package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js.map +0 -1
  237. package/dist/monolith/plumbing/ui/DecorationService.js +0 -54
  238. package/dist/monolith/plumbing/ui/DecorationService.js.map +0 -1
  239. package/dist/monolith/services/JoyLogService.js +0 -48
  240. package/dist/monolith/services/JoyLogService.js.map +0 -1
  241. package/dist/monolith/services/JoyService.js +0 -209
  242. package/dist/monolith/services/JoyService.js.map +0 -1
  243. package/dist/monolith/services/MarieSCMProvider.js +0 -41
  244. package/dist/monolith/services/MarieSCMProvider.js.map +0 -1
  245. package/dist/webview-ui/main.css +0 -1
  246. package/dist/webview-ui/main.js +0 -108
  247. package/lint_output.txt +0 -705
  248. package/lint_output_v2.txt +0 -711
  249. package/test-mind-p6.sqlite +0 -0
  250. package/test-mind-p6.sqlite-shm +0 -0
  251. package/test-mind-p6.sqlite-wal +0 -0
@@ -1,1155 +0,0 @@
1
- var SA=Object.create;var nu=Object.defineProperty;var xA=Object.getOwnPropertyDescriptor;var TA=Object.getOwnPropertyNames;var _A=Object.getPrototypeOf,EA=Object.prototype.hasOwnProperty;var g=(r,e)=>()=>(r&&(e=r(r=0)),e);var O=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),qr=(r,e)=>{for(var t in e)nu(r,t,{get:e[t],enumerable:!0})},R5=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of TA(e))!EA.call(r,s)&&s!==t&&nu(r,s,{get:()=>e[s],enumerable:!(i=xA(e,s))||i.enumerable});return r};var k=(r,e,t)=>(t=r!=null?SA(_A(r)):{},R5(e||!r||!r.__esModule?nu(t,"default",{value:r,enumerable:!0}):t,r)),NA=r=>R5(nu({},"__esModule",{value:!0}),r);function rr(r){return typeof r>"u"||r===void 0}function Se(r){return typeof r=="string"}function _s(r){return typeof r=="number"}function Rn(r){return typeof r=="boolean"}function Da(r){return r===null}function M5(r){return r instanceof Date}function $a(r){return typeof r=="bigint"}function fe(r){return typeof r=="function"}function gt(r){return typeof r=="object"&&r!==null}function u(r){return Object.freeze(r)}function bc(r){return Ct(r)?r:[r]}function Ct(r){return Array.isArray(r)}function Lt(r){return r}var x=g(()=>{"use strict"});var ne,Mn=g(()=>{"use strict";x();ne=u({is(r){return r.kind==="AlterTableNode"},create(r){return u({kind:"AlterTableNode",table:r})},cloneWithTableProps(r,e){return u({...r,...e})},cloneWithColumnAlteration(r,e){return u({...r,columnAlterations:r.columnAlterations?[...r.columnAlterations,e]:[e]})}})});function He(r,e="identifier"){if(typeof r!="string")throw new Error(`${e} must be a string`);if(r.length===0)throw new Error(`${e} cannot be empty`);if(r.length>255)throw new Error(`${e} exceeds maximum length of 255 characters`);let t=[/;/,/--/,/\/\*/,/\*\//,/\bUNION\b/i,/\bSELECT\b.*\bFROM\b/i,/\bINSERT\b.*\bINTO\b/i,/\bUPDATE\b.*\bSET\b/i,/\bDELETE\b.*\bFROM\b/i,/\bDROP\b/i,/\bEXEC\b/i,/\bEXECUTE\b/i,/\bCREATE\b/i,/\bALTER\b/i,/\bTRUNCATE\b/i,/['"`]/,/\\/,/\x00/];for(let n of t)if(n.test(r))throw new Error(`Invalid ${e}: "${r}" contains potentially dangerous characters or SQL keywords. Identifiers must contain only alphanumeric characters, underscores, and dots (for schema.table references).`);if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)*$/.test(r))throw new Error(`Invalid ${e}: "${r}". Identifiers must start with a letter or underscore, followed by alphanumeric characters or underscores. Schema/table references can use dots (e.g., "schema.table" or "table.column").`);let s=["PRAGMA","ATTACH","DETACH","VACUUM","ANALYZE","REINDEX"];for(let n of s)if(r.toUpperCase()===n)throw new Error(`Invalid ${e}: "${r}" is a reserved SQLite keyword and cannot be used as an identifier`)}function au(r){He(r,"table reference");let e=r.split(".");if(e.length>2)throw new Error(`Invalid table reference: "${r}". Table references can have at most 2 parts (schema.table).`);e.forEach((t,i)=>{let s=i===0&&e.length===2?"schema name":"table name";He(t,s)})}function ou(r){He(r,"column reference");let e=r.split(".");if(e.length>3)throw new Error(`Invalid column reference: "${r}". Column references can have at most 3 parts (schema.table.column).`);e.forEach((t,i)=>{let s;e.length===1?s="column name":e.length===2?s=i===0?"table name":"column name":s=i===0?"schema name":i===1?"table name":"column name",He(t,s)})}var kn=g(()=>{"use strict"});var W,ge=g(()=>{"use strict";x();kn();W=u({is(r){return r.kind==="IdentifierNode"},create(r){return He(r,"identifier"),u({kind:"IdentifierNode",name:r})}})});var Br,lu=g(()=>{"use strict";x();ge();Br=u({is(r){return r.kind==="CreateIndexNode"},create(r){return u({kind:"CreateIndexNode",name:W.create(r)})},cloneWith(r,e){return u({...r,...e})},cloneWithColumns(r,e){return u({...r,columns:[...r.columns||[],...e]})}})});var cu,du=g(()=>{"use strict";x();ge();cu=u({is(r){return r.kind==="CreateSchemaNode"},create(r,e){return u({kind:"CreateSchemaNode",schema:W.create(r),...e})},cloneWith(r,e){return u({...r,...e})}})});var k5,At,Fa=g(()=>{"use strict";x();k5=["preserve rows","delete rows","drop"],At=u({is(r){return r.kind==="CreateTableNode"},create(r){return u({kind:"CreateTableNode",table:r,columns:u([])})},cloneWithColumn(r,e){return u({...r,columns:u([...r.columns,e])})},cloneWithConstraint(r,e){return u({...r,constraints:r.constraints?u([...r.constraints,e]):u([e])})},cloneWithFrontModifier(r,e){return u({...r,frontModifiers:r.frontModifiers?u([...r.frontModifiers,e]):u([e])})},cloneWithEndModifier(r,e){return u({...r,endModifiers:r.endModifiers?u([...r.endModifiers,e]):u([e])})},cloneWith(r,e){return u({...r,...e})}})});var Rt,Li=g(()=>{"use strict";x();ge();Rt=u({is(r){return r.kind==="SchemableIdentifierNode"},create(r){return u({kind:"SchemableIdentifierNode",identifier:W.create(r)})},createWithSchema(r,e){return u({kind:"SchemableIdentifierNode",schema:W.create(r),identifier:W.create(e)})}})});var Es,vc=g(()=>{"use strict";x();Li();Es=u({is(r){return r.kind==="DropIndexNode"},create(r,e){return u({kind:"DropIndexNode",name:Rt.create(r),...e})},cloneWith(r,e){return u({...r,...e})}})});var Sc,pu=g(()=>{"use strict";x();ge();Sc=u({is(r){return r.kind==="DropSchemaNode"},create(r,e){return u({kind:"DropSchemaNode",schema:W.create(r),...e})},cloneWith(r,e){return u({...r,...e})}})});var xc,uu=g(()=>{"use strict";x();xc=u({is(r){return r.kind==="DropTableNode"},create(r,e){return u({kind:"DropTableNode",table:r,...e})},cloneWith(r,e){return u({...r,...e})}})});var rt,Wr=g(()=>{"use strict";x();rt=u({is(r){return r.kind==="AliasNode"},create(r,e){return u({kind:"AliasNode",node:r,alias:e})}})});var ir,La=g(()=>{"use strict";x();Li();kn();ir=u({is(r){return r.kind==="TableNode"},create(r){return He(r,"table name"),u({kind:"TableNode",table:Rt.create(r)})},createWithSchema(r,e){return He(r,"schema name"),He(e,"table name"),u({kind:"TableNode",table:Rt.createWithSchema(r,e)})}})});function we(r){return gt(r)&&fe(r.toOperationNode)}var Ht=g(()=>{"use strict";x()});function I5(r){return gt(r)&&"expressionType"in r&&we(r)}function P5(r){return gt(r)&&"expression"in r&&Se(r.alias)&&we(r)}var Kg=g(()=>{"use strict";Ht();x()});var mi,Jg=g(()=>{"use strict";x();mi=u({is(r){return r.kind==="SelectModifierNode"},create(r,e){return u({kind:"SelectModifierNode",modifier:r,of:e})},createWithExpression(r){return u({kind:"SelectModifierNode",rawModifier:r})}})});var Qt,Ns=g(()=>{"use strict";x();Qt=u({is(r){return r.kind==="AndNode"},create(r,e){return u({kind:"AndNode",left:r,right:e})}})});var zr,In=g(()=>{"use strict";x();zr=u({is(r){return r.kind==="OrNode"},create(r,e){return u({kind:"OrNode",left:r,right:e})}})});var mu,Xg=g(()=>{"use strict";x();Ns();In();mu=u({is(r){return r.kind==="OnNode"},create(r){return u({kind:"OnNode",on:r})},cloneWithOperation(r,e,t){return u({...r,on:e==="And"?Qt.create(r.on,t):zr.create(r.on,t)})}})});var Ur,qa=g(()=>{"use strict";x();Xg();Ur=u({is(r){return r.kind==="JoinNode"},create(r,e){return u({kind:"JoinNode",joinType:r,table:e,on:void 0})},createWithOn(r,e,t){return u({kind:"JoinNode",joinType:r,table:e,on:mu.create(t)})},cloneWithOn(r,e){return u({...r,on:r.on?mu.cloneWithOperation(r.on,"And",e):mu.create(e)})}})});var Cs,hu=g(()=>{"use strict";x();Cs=u({is(r){return r.kind==="BinaryOperationNode"},create(r,e,t){return u({kind:"BinaryOperationNode",leftOperand:r,operator:e,rightOperand:t})}})});function Yg(r){return Se(r)&&O5.includes(r)}var CA,AA,O5,RA,MA,kA,D5,sr,Pn=g(()=>{"use strict";x();CA=["=","==","!=","<>",">",">=","<","<=","in","not in","is","is not","like","not like","match","ilike","not ilike","@>","<@","^@","&&","?","?&","?|","!<","!>","<=>","!~","~","~*","!~*","@@","@@@","!!","<->","regexp","is distinct from","is not distinct from"],AA=["+","-","*","/","%","^","&","|","#","<<",">>"],O5=["->","->>"],RA=[...CA,...AA,"&&","||"],MA=["exists","not exists"],kA=["not","-",...MA],D5=[...RA,...O5,...kA,"between","between symmetric"],sr=u({is(r){return r.kind==="OperatorNode"},create(r){return u({kind:"OperatorNode",operator:r})}})});var ie,Mt=g(()=>{"use strict";x();ge();kn();ie=u({is(r){return r.kind==="ColumnNode"},create(r){return He(r,"column name"),u({kind:"ColumnNode",column:W.create(r)})}})});var Ba,Tc=g(()=>{"use strict";x();Ba=u({is(r){return r.kind==="SelectAllNode"},create(){return u({kind:"SelectAllNode"})}})});var Wa,fu=g(()=>{"use strict";Tc();x();Wa=u({is(r){return r.kind==="ReferenceNode"},create(r,e){return u({kind:"ReferenceNode",table:e,column:r})},createSelectAll(r){return u({kind:"ReferenceNode",table:r,column:Ba.create()})}})});function yu(r){return gt(r)&&we(r)&&Se(r.dynamicReference)}var gu,_c=g(()=>{"use strict";Ht();yt();x();gu=class{#e;get dynamicReference(){return this.#e}get refType(){}constructor(e){this.#e=e}toOperationNode(){return Zg(this.#e)}}});var hi,wu=g(()=>{"use strict";x();hi=u({is(r){return r.kind==="OrderByItemNode"},create(r,e){return u({kind:"OrderByItemNode",orderBy:r,direction:e})},cloneWith(r,e){return u({...r,...e})}})});var xe,qi=g(()=>{"use strict";x();xe=u({is(r){return r.kind==="RawNode"},create(r,e){return u({kind:"RawNode",sqlFragments:u(r),parameters:u(e)})},createWithSql(r){return xe.create([r],[])},createWithChild(r){return xe.create(["",""],[r])},createWithChildren(r){return xe.create(new Array(r.length+1).fill(""),r)}})});var $5,e2=g(()=>{"use strict";x();ge();$5={is(r){return r.kind==="CollateNode"},create(r){return u({kind:"CollateNode",collation:W.create(r)})}}});var bu,t2=g(()=>{"use strict";e2();wu();qi();x();bu=class r{#e;constructor(e){this.#e=u(e)}desc(){return new r({node:hi.cloneWith(this.#e.node,{direction:xe.createWithSql("desc")})})}asc(){return new r({node:hi.cloneWith(this.#e.node,{direction:xe.createWithSql("asc")})})}nullsLast(){return new r({node:hi.cloneWith(this.#e.node,{nulls:"last"})})}nullsFirst(){return new r({node:hi.cloneWith(this.#e.node,{nulls:"first"})})}collate(e){return new r({node:hi.cloneWith(this.#e.node,{collation:$5.create(e)})})}toOperationNode(){return this.#e.node}}});function i2(r){return r==="asc"||r==="desc"}function nr(r){if(r.length===2)return[r2(r[0],r[1])];if(r.length===1){let[e]=r;return Array.isArray(e)?e.map(t=>r2(t)):[r2(e)]}throw new Error(`Invalid number of arguments at order by! expected 1-2, received ${r.length}`)}function r2(r,e){let t=IA(r);if(hi.is(t)){if(e)throw new Error("Cannot specify direction twice!");return t}return PA(t,e)}function IA(r){return Bi(r)?Gt(r):yu(r)?r.toOperationNode():xr(r)}function PA(r,e){if(typeof e=="string"){if(!i2(e))throw new Error(`Invalid order by direction: ${e}`);return hi.create(r,xe.createWithSql(e))}let t=hi.create(r);return e?e(new bu({node:t})).toOperationNode():t}var On=g(()=>{"use strict";_c();wu();qi();t2();jr();yt()});var za,vu=g(()=>{"use strict";x();za=u({is(r){return r.kind==="JSONReferenceNode"},create(r,e){return u({kind:"JSONReferenceNode",reference:r,traversal:e})},cloneWithTraversal(r,e){return u({...r,traversal:e})}})});var Su,xu=g(()=>{"use strict";x();Su=u({is(r){return r.kind==="JSONOperatorChainNode"},create(r){return u({kind:"JSONOperatorChainNode",operator:r,values:u([])})},cloneWithValue(r,e){return u({...r,values:u([...r.values,e])})}})});var As,Ec=g(()=>{"use strict";x();As=u({is(r){return r.kind==="JSONPathNode"},create(r){return u({kind:"JSONPathNode",inOperator:r,pathLegs:u([])})},cloneWithLeg(r,e){return u({...r,pathLegs:u([...r.pathLegs,e])})}})});function Zg(r){return Se(r)?xr(r):r.toOperationNode()}function Wi(r){return Ct(r)?r.map(e=>wt(e)):[wt(r)]}function wt(r){return Bi(r)?Gt(r):Zg(r)}function F5(r,e){let t=xr(r);if(Yg(e))return za.create(t,Su.create(sr.create(e)));let i=e.slice(0,-1);if(Yg(i))return za.create(t,As.create(sr.create(i)));throw new Error(`Invalid JSON operator: ${e}`)}function xr(r){if(!r.includes("."))return Wa.create(ie.create(r));let t=r.split(".").map(n2);if(t.length===3)return OA(t);if(t.length===2)return DA(t);throw new Error(`invalid column reference ${r}`)}function L5(r){let e=" as ";if(r.includes(e)){let[t,i]=r.split(e).map(n2);return rt.create(xr(t),W.create(i))}else return xr(r)}function s2(r){return ie.create(r)}function Ua(r){if(r.includes(" ")){let[t,i]=r.split(" ").map(n2);if(!i2(i))throw new Error(`invalid order direction "${i}" next to "${t}"`);return nr([t,i])[0]}else return s2(r)}function OA(r){let[e,t,i]=r;return Wa.create(ie.create(i),ir.createWithSchema(e,t))}function DA(r){let[e,t]=r;return Wa.create(ie.create(t),ir.create(e))}function n2(r){return r.trim()}var yt=g(()=>{"use strict";Wr();Mt();fu();La();x();jr();ge();On();Pn();vu();xu();Ec()});var Tu,_u=g(()=>{"use strict";x();Tu=u({is(r){return r.kind==="PrimitiveValueListNode"},create(r){return u({kind:"PrimitiveValueListNode",values:u([...r])})}})});var Rs,ja=g(()=>{"use strict";x();Rs=u({is(r){return r.kind==="ValueListNode"},create(r){return u({kind:"ValueListNode",values:u(r)})}})});var Qe,fi=g(()=>{"use strict";x();Qe=u({is(r){return r.kind==="ValueNode"},create(r){return u({kind:"ValueNode",value:r})},createImmediate(r){return u({kind:"ValueNode",value:r,immediate:!0})}})});function q5(r){return Ct(r)?$A(r):he(r)}function he(r){return Bi(r)?Gt(r):Qe.create(r)}function Eu(r){return _s(r)||Rn(r)||Da(r)}function Nc(r){if(!Eu(r))throw new Error(`unsafe immediate value ${JSON.stringify(r)}`);return Qe.createImmediate(r)}function $A(r){return r.some(Bi)?Rs.create(r.map(e=>he(e))):Tu.create(r)}var gi=g(()=>{"use strict";_u();ja();fi();x();jr()});var yi,Va=g(()=>{"use strict";x();yi=u({is(r){return r.kind==="ParensNode"},create(r){return u({kind:"ParensNode",node:r})}})});function ye(r){if(r.length===3)return Nu(r[0],r[1],r[2]);if(r.length===1)return he(r[0]);throw new Error(`invalid arguments: ${JSON.stringify(r)}`)}function Nu(r,e,t){return FA(e)&&W5(t)?Cs.create(wt(r),a2(e),Qe.createImmediate(t)):Cs.create(wt(r),a2(e),q5(t))}function it(r,e,t){return Cs.create(wt(r),a2(e),wt(t))}function o2(r,e){return Ha(Object.entries(r).filter(([,t])=>!rr(t)).map(([t,i])=>Nu(t,W5(i)?"is":"=",i)),e)}function Ha(r,e,t=!0){let i=e==="and"?Qt.create:zr.create;if(r.length===0)return Cs.create(Qe.createImmediate(1),sr.create("="),Qe.createImmediate(e==="and"?1:0));let s=B5(r[0]);for(let n=1;n<r.length;++n)s=i(s,B5(r[n]));return r.length>1&&t?yi.create(s):s}function FA(r){return r==="is"||r==="is not"}function W5(r){return Da(r)||Rn(r)}function a2(r){if(Se(r)&&D5.includes(r))return sr.create(r);if(we(r))return r.toOperationNode();throw new Error(`invalid operator ${JSON.stringify(r)}`)}function B5(r){return we(r)?r.toOperationNode():r}var ar=g(()=>{"use strict";hu();x();Ht();Pn();yt();gi();fi();Ns();Va();In()});var zi,Cc=g(()=>{"use strict";x();zi=u({is(r){return r.kind==="OrderByNode"},create(r){return u({kind:"OrderByNode",items:u([...r])})},cloneWithItems(r,e){return u({...r,items:u([...r.items,...e])})}})});var l2,c2=g(()=>{"use strict";x();l2=u({is(r){return r.kind==="PartitionByNode"},create(r){return u({kind:"PartitionByNode",items:u(r)})},cloneWithItems(r,e){return u({...r,items:u([...r.items,...e])})}})});var Ac,Cu=g(()=>{"use strict";x();Cc();c2();Ac=u({is(r){return r.kind==="OverNode"},create(){return u({kind:"OverNode"})},cloneWithOrderByItems(r,e){return u({...r,orderBy:r.orderBy?zi.cloneWithItems(r.orderBy,e):zi.create(e)})},cloneWithPartitionByItems(r,e){return u({...r,partitionBy:r.partitionBy?l2.cloneWithItems(r.partitionBy,e):l2.create(e)})}})});var Dn,Rc=g(()=>{"use strict";x();Dn=u({is(r){return r.kind==="FromNode"},create(r){return u({kind:"FromNode",froms:u(r)})},cloneWithFroms(r,e){return u({...r,froms:u([...r.froms,...e])})}})});var d2,p2=g(()=>{"use strict";x();d2=u({is(r){return r.kind==="GroupByNode"},create(r){return u({kind:"GroupByNode",items:u(r)})},cloneWithItems(r,e){return u({...r,items:u([...r.items,...e])})}})});var u2,m2=g(()=>{"use strict";x();Ns();In();u2=u({is(r){return r.kind==="HavingNode"},create(r){return u({kind:"HavingNode",having:r})},cloneWithOperation(r,e,t){return u({...r,having:e==="And"?Qt.create(r.having,t):zr.create(r.having,t)})}})});var ue,Qa=g(()=>{"use strict";x();Rc();p2();m2();ue=u({is(r){return r.kind==="SelectQueryNode"},create(r){return u({kind:"SelectQueryNode",...r&&{with:r}})},createFrom(r,e){return u({kind:"SelectQueryNode",from:Dn.create(r),...e&&{with:e}})},cloneWithSelections(r,e){return u({...r,selections:r.selections?u([...r.selections,...e]):u(e)})},cloneWithDistinctOn(r,e){return u({...r,distinctOn:r.distinctOn?u([...r.distinctOn,...e]):u(e)})},cloneWithFrontModifier(r,e){return u({...r,frontModifiers:r.frontModifiers?u([...r.frontModifiers,e]):u([e])})},cloneWithGroupByItems(r,e){return u({...r,groupBy:r.groupBy?d2.cloneWithItems(r.groupBy,e):d2.create(e)})},cloneWithLimit(r,e){return u({...r,limit:e})},cloneWithOffset(r,e){return u({...r,offset:e})},cloneWithFetch(r,e){return u({...r,fetch:e})},cloneWithHaving(r,e){return u({...r,having:r.having?u2.cloneWithOperation(r.having,"And",e):u2.create(e)})},cloneWithSetOperations(r,e){return u({...r,setOperations:r.setOperations?u([...r.setOperations,...e]):u([...e])})},cloneWithoutSelections(r){return u({...r,selections:[]})},cloneWithoutLimit(r){return u({...r,limit:void 0})},cloneWithoutOffset(r){return u({...r,offset:void 0})},cloneWithoutGroupBy(r){return u({...r,groupBy:void 0})}})});var Au,h2=g(()=>{"use strict";qa();qi();ar();x();Au=class r{#e;constructor(e){this.#e=u(e)}on(...e){return new r({...this.#e,joinNode:Ur.cloneWithOn(this.#e.joinNode,ye(e))})}onRef(e,t,i){return new r({...this.#e,joinNode:Ur.cloneWithOn(this.#e.joinNode,it(e,t,i))})}onTrue(){return new r({...this.#e,joinNode:Ur.cloneWithOn(this.#e.joinNode,xe.createWithSql("true"))})}$call(e){return e(this)}toOperationNode(){return this.#e.joinNode}}});var Ie,$n=g(()=>{"use strict";x();Ie=u({is(r){return r.kind==="InsertQueryNode"},create(r,e,t){return u({kind:"InsertQueryNode",into:r,...e&&{with:e},replace:t})},createWithoutInto(){return u({kind:"InsertQueryNode"})},cloneWith(r,e){return u({...r,...e})}})});var Ru,Mu=g(()=>{"use strict";x();Ru=u({is(r){return r.kind==="ListNode"},create(r){return u({kind:"ListNode",items:u(r)})}})});var wi,Ga=g(()=>{"use strict";x();Rc();Mu();wi=u({is(r){return r.kind==="UpdateQueryNode"},create(r,e){return u({kind:"UpdateQueryNode",table:r.length===1?r[0]:Ru.create(r),...e&&{with:e}})},createWithoutTable(){return u({kind:"UpdateQueryNode"})},cloneWithFromItems(r,e){return u({...r,from:r.from?Dn.cloneWithFroms(r.from,e):Dn.create(e)})},cloneWithUpdates(r,e){return u({...r,updates:r.updates?u([...r.updates,...e]):e})},cloneWithLimit(r,e){return u({...r,limit:e})}})});var f2,g2=g(()=>{"use strict";x();f2=u({is(r){return r.kind==="UsingNode"},create(r){return u({kind:"UsingNode",tables:u(r)})},cloneWithTables(r,e){return u({...r,tables:u([...r.tables,...e])})}})});var Ms,Mc=g(()=>{"use strict";x();Rc();g2();Ms=u({is(r){return r.kind==="DeleteQueryNode"},create(r,e){return u({kind:"DeleteQueryNode",from:Dn.create(r),...e&&{with:e}})},cloneWithLimit(r,e){return u({...r,limit:e})},cloneWithoutLimit(r){return u({...r,limit:void 0})},cloneWithUsing(r,e){return u({...r,using:r.using!==void 0?f2.cloneWithTables(r.using,e):f2.create(e)})}})});var bt,kc=g(()=>{"use strict";x();Ns();In();bt=u({is(r){return r.kind==="WhereNode"},create(r){return u({kind:"WhereNode",where:r})},cloneWithOperation(r,e,t){return u({...r,where:e==="And"?Qt.create(r.where,t):zr.create(r.where,t)})}})});var y2,w2=g(()=>{"use strict";x();y2=u({is(r){return r.kind==="ReturningNode"},create(r){return u({kind:"ReturningNode",selections:u(r)})},cloneWithSelections(r,e){return u({...r,selections:r.selections?u([...r.selections,...e]):u(e)})}})});var z5,b2=g(()=>{"use strict";x();z5=u({is(r){return r.kind==="ExplainNode"},create(r,e){return u({kind:"ExplainNode",format:r,options:e})}})});var Ui,Ka=g(()=>{"use strict";x();Ui=u({is(r){return r.kind==="WhenNode"},create(r){return u({kind:"WhenNode",condition:r})},cloneWithResult(r,e){return u({...r,result:e})}})});var st,Ja=g(()=>{"use strict";x();Ka();st=u({is(r){return r.kind==="MergeQueryNode"},create(r,e){return u({kind:"MergeQueryNode",into:r,...e&&{with:e}})},cloneWithUsing(r,e){return u({...r,using:e})},cloneWithWhen(r,e){return u({...r,whens:r.whens?u([...r.whens,e]):u([e])})},cloneWithThen(r,e){return u({...r,whens:r.whens?u([...r.whens.slice(0,-1),Ui.cloneWithResult(r.whens[r.whens.length-1],e)]):void 0})}})});var v2,S2=g(()=>{"use strict";x();v2=u({is(r){return r.kind==="OutputNode"},create(r){return u({kind:"OutputNode",selections:u(r)})},cloneWithSelections(r,e){return u({...r,selections:r.selections?u([...r.selections,...e]):u(e)})}})});var I,Vr=g(()=>{"use strict";$n();Qa();Ga();Mc();kc();x();w2();b2();Ja();S2();Cc();I=u({is(r){return ue.is(r)||Ie.is(r)||wi.is(r)||Ms.is(r)||st.is(r)},cloneWithEndModifier(r,e){return u({...r,endModifiers:r.endModifiers?u([...r.endModifiers,e]):u([e])})},cloneWithWhere(r,e){return u({...r,where:r.where?bt.cloneWithOperation(r.where,"And",e):bt.create(e)})},cloneWithJoin(r,e){return u({...r,joins:r.joins?u([...r.joins,e]):u([e])})},cloneWithReturning(r,e){return u({...r,returning:r.returning?y2.cloneWithSelections(r.returning,e):y2.create(e)})},cloneWithoutReturning(r){return u({...r,returning:void 0})},cloneWithoutWhere(r){return u({...r,where:void 0})},cloneWithExplain(r,e,t){return u({...r,explain:z5.create(e,t?.toOperationNode())})},cloneWithTop(r,e){return u({...r,top:e})},cloneWithOutput(r,e){return u({...r,output:r.output?v2.cloneWithSelections(r.output,e):v2.create(e)})},cloneWithOrderByItems(r,e){return u({...r,orderBy:r.orderBy?zi.cloneWithItems(r.orderBy,e):zi.create(e)})},cloneWithoutOrderBy(r){return u({...r,orderBy:void 0})}})});var U5,x2=g(()=>{"use strict";x();U5=u({is(r){return r.kind==="PartitionByItemNode"},create(r){return u({kind:"PartitionByItemNode",partitionBy:r})}})});function j5(r){return Wi(r).map(U5.create)}var V5=g(()=>{"use strict";x2();yt()});var ku,H5=g(()=>{"use strict";Cu();Vr();On();V5();x();ku=class r{#e;constructor(e){this.#e=u(e)}orderBy(...e){return new r({overNode:Ac.cloneWithOrderByItems(this.#e.overNode,nr(e))})}clearOrderBy(){return new r({overNode:I.cloneWithoutOrderBy(this.#e.overNode)})}partitionBy(e){return new r({overNode:Ac.cloneWithPartitionByItems(this.#e.overNode,j5(e))})}$call(e){return e(this)}toOperationNode(){return this.#e.overNode}}});var Xa,T2=g(()=>{"use strict";x();fu();Tc();Xa=u({is(r){return r.kind==="SelectionNode"},create(r){return u({kind:"SelectionNode",selection:r})},createSelectAll(){return u({kind:"SelectionNode",selection:Ba.create()})},createSelectAllFromTable(r){return u({kind:"SelectionNode",selection:Wa.createSelectAll(r)})}})});function Je(r){return fe(r)?Je(r(Hr())):Ct(r)?r.map(e=>Q5(e)):[Q5(r)]}function Q5(r){return Se(r)?Xa.create(L5(r)):yu(r)?Xa.create(r.toOperationNode()):Xa.create(Iu(r))}function nt(r){return r?Array.isArray(r)?r.map(G5):[G5(r)]:[Xa.createSelectAll()]}function G5(r){if(Se(r))return Xa.createSelectAllFromTable(ae(r));throw new Error(`invalid value selectAll expression: ${JSON.stringify(r)}`)}var ks=g(()=>{"use strict";x();T2();yt();_c();jr();vt();Fn()});var K5,_2=g(()=>{"use strict";x();K5=u({is(r){return r.kind==="ValuesNode"},create(r){return u({kind:"ValuesNode",values:u(r)})}})});var J5,E2=g(()=>{"use strict";x();J5=u({is(r){return r.kind==="DefaultInsertValueNode"},create(){return u({kind:"DefaultInsertValueNode"})}})});function Pu(r){let e=fe(r)?r(Hr()):r,t=Ct(e)?e:u([e]);return LA(t)}function LA(r){let e=qA(r);return[u([...e.keys()].map(ie.create)),K5.create(r.map(t=>BA(t,e)))]}function qA(r){let e=new Map;for(let t of r){let i=Object.keys(t);for(let s of i)!e.has(s)&&t[s]!==void 0&&e.set(s,e.size)}return e}function BA(r,e){let t=Object.keys(r),i=Array.from({length:e.size}),s=!1,n=t.length;for(let o of t){let l=e.get(o);if(rr(l)){n--;continue}let c=r[o];(rr(c)||Bi(c))&&(s=!0),i[l]=c}if(n<e.size||s){let o=J5.create();return Rs.create(i.map(l=>rr(l)?o:he(l)))}return Tu.create(i)}var N2=g(()=>{"use strict";Mt();_u();ja();x();gi();_2();jr();E2();Fn()});var C2,A2=g(()=>{"use strict";x();C2=u({is(r){return r.kind==="ColumnUpdateNode"},create(r,e){return u({kind:"ColumnUpdateNode",column:r,value:e})}})});function X5(...r){return r.length===2?[C2.create(wt(r[0]),he(r[1]))]:Ic(r[0])}function Ic(r){let e=fe(r)?r(Hr()):r;return Object.entries(e).filter(([t,i])=>i!==void 0).map(([t,i])=>C2.create(ie.create(t),he(i)))}var Ou=g(()=>{"use strict";Mt();A2();Fn();x();gi();yt()});var Y5,R2=g(()=>{"use strict";x();Y5=u({is(r){return r.kind==="OnDuplicateKeyNode"},create(r){return u({kind:"OnDuplicateKeyNode",updates:r})}})});var Du,M2=g(()=>{"use strict";Du=class{insertId;numInsertedOrUpdatedRows;constructor(e,t){this.insertId=e,this.numInsertedOrUpdatedRows=t}}});function bi(r){return Object.prototype.hasOwnProperty.call(r,"prototype")}var Tr,Ln=g(()=>{"use strict";Tr=class extends Error{node;constructor(e){super("no result"),this.node=e}}});var qt,$u=g(()=>{"use strict";x();kc();qt=u({is(r){return r.kind==="OnConflictNode"},create(){return u({kind:"OnConflictNode"})},cloneWith(r,e){return u({...r,...e})},cloneWithIndexWhere(r,e){return u({...r,indexWhere:r.indexWhere?bt.cloneWithOperation(r.indexWhere,"And",e):bt.create(e)})},cloneWithIndexOrWhere(r,e){return u({...r,indexWhere:r.indexWhere?bt.cloneWithOperation(r.indexWhere,"Or",e):bt.create(e)})},cloneWithUpdateWhere(r,e){return u({...r,updateWhere:r.updateWhere?bt.cloneWithOperation(r.updateWhere,"And",e):bt.create(e)})},cloneWithUpdateOrWhere(r,e){return u({...r,updateWhere:r.updateWhere?bt.cloneWithOperation(r.updateWhere,"Or",e):bt.create(e)})},cloneWithoutIndexWhere(r){return u({...r,indexWhere:void 0})},cloneWithoutUpdateWhere(r){return u({...r,updateWhere:void 0})}})});var Fu,k2,I2,P2=g(()=>{"use strict";Mt();ge();$u();ar();Ou();x();Fu=class r{#e;constructor(e){this.#e=u(e)}column(e){let t=ie.create(e);return new r({...this.#e,onConflictNode:qt.cloneWith(this.#e.onConflictNode,{columns:this.#e.onConflictNode.columns?u([...this.#e.onConflictNode.columns,t]):u([t])})})}columns(e){let t=e.map(ie.create);return new r({...this.#e,onConflictNode:qt.cloneWith(this.#e.onConflictNode,{columns:this.#e.onConflictNode.columns?u([...this.#e.onConflictNode.columns,...t]):u(t)})})}constraint(e){return new r({...this.#e,onConflictNode:qt.cloneWith(this.#e.onConflictNode,{constraint:W.create(e)})})}expression(e){return new r({...this.#e,onConflictNode:qt.cloneWith(this.#e.onConflictNode,{indexExpression:e.toOperationNode()})})}where(...e){return new r({...this.#e,onConflictNode:qt.cloneWithIndexWhere(this.#e.onConflictNode,ye(e))})}whereRef(e,t,i){return new r({...this.#e,onConflictNode:qt.cloneWithIndexWhere(this.#e.onConflictNode,it(e,t,i))})}clearWhere(){return new r({...this.#e,onConflictNode:qt.cloneWithoutIndexWhere(this.#e.onConflictNode)})}doNothing(){return new k2({...this.#e,onConflictNode:qt.cloneWith(this.#e.onConflictNode,{doNothing:!0})})}doUpdateSet(e){return new I2({...this.#e,onConflictNode:qt.cloneWith(this.#e.onConflictNode,{updates:Ic(e)})})}$call(e){return e(this)}},k2=class{#e;constructor(e){this.#e=u(e)}toOperationNode(){return this.#e.onConflictNode}},I2=class r{#e;constructor(e){this.#e=u(e)}where(...e){return new r({...this.#e,onConflictNode:qt.cloneWithUpdateWhere(this.#e.onConflictNode,ye(e))})}whereRef(e,t,i){return new r({...this.#e,onConflictNode:qt.cloneWithUpdateWhere(this.#e.onConflictNode,it(e,t,i))})}clearWhere(){return new r({...this.#e,onConflictNode:qt.cloneWithoutUpdateWhere(this.#e.onConflictNode)})}$call(e){return e(this)}toOperationNode(){return this.#e.onConflictNode}}});var Z5,O2=g(()=>{"use strict";x();Z5=u({is(r){return r.kind==="TopNode"},create(r,e){return u({kind:"TopNode",expression:r,modifiers:e})}})});function Qr(r,e){if(!_s(r)&&!$a(r))throw new Error(`Invalid top expression: ${r}`);if(!rr(e)&&!WA(e))throw new Error(`Invalid top modifiers: ${e}`);return Z5.create(r,e)}function WA(r){return r==="percent"||r==="with ties"||r==="percent with ties"}var Ya=g(()=>{"use strict";O2();x()});var qn,D2=g(()=>{"use strict";x();qn=u({is(r){return r.kind==="OrActionNode"},create(r){return u({kind:"OrActionNode",action:r})}})});var Pc,$2=g(()=>{"use strict";ks();N2();$n();Vr();Ou();x();R2();M2();Ln();jr();Mt();P2();$u();Ya();D2();Pc=class r{#e;constructor(e){this.#e=u(e)}values(e){let[t,i]=Pu(e);return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{columns:t,values:i})})}columns(e){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{columns:u(e.map(ie.create))})})}expression(e){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{values:Gt(e)})})}defaultValues(){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{defaultValues:!0})})}modifyEnd(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}ignore(){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{orAction:qn.create("ignore")})})}orIgnore(){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{orAction:qn.create("ignore")})})}orAbort(){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{orAction:qn.create("abort")})})}orFail(){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{orAction:qn.create("fail")})})}orReplace(){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{orAction:qn.create("replace")})})}orRollback(){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{orAction:qn.create("rollback")})})}top(e,t){return new r({...this.#e,queryNode:I.cloneWithTop(this.#e.queryNode,Qr(e,t))})}onConflict(e){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{onConflict:e(new Fu({onConflictNode:qt.create()})).toOperationNode()})})}onDuplicateKeyUpdate(e){return new r({...this.#e,queryNode:Ie.cloneWith(this.#e.queryNode,{onDuplicateKey:Y5.create(Ic(e))})})}returning(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,Je(e))})}returningAll(){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,nt())})}output(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,Je(e))})}outputAll(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,nt(e))})}clearReturning(){return new r({...this.#e,queryNode:I.cloneWithoutReturning(this.#e.queryNode)})}$call(e){return e(this)}$if(e,t){return e?t(this):new r({...this.#e})}$castTo(){return new r(this.#e)}$narrowType(){return new r(this.#e)}$assertType(){return new r(this.#e)}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:i}=this.#e.executor,s=e.query;return s.returning&&i.supportsReturning||s.output&&i.supportsOutput?t.rows:[new Du(t.insertId,t.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=Tr){let t=await this.executeTakeFirst();if(t===void 0)throw bi(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),i=this.#e.executor.stream(t,e);for await(let s of i)yield*s.rows}async explain(e,t){return await new r({...this.#e,queryNode:I.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}}});var Lu,F2=g(()=>{"use strict";Lu=class{numDeletedRows;constructor(e){this.numDeletedRows=e}}});var Za,Oc=g(()=>{"use strict";x();Za=u({is(r){return r.kind==="LimitNode"},create(r){return u({kind:"LimitNode",limit:r})}})});var qu,L2=g(()=>{"use strict";Dc();vt();ks();Vr();x();Ln();F2();Mc();Oc();On();ar();gi();Ya();qu=class r{#e;constructor(e){this.#e=u(e)}where(...e){return new r({...this.#e,queryNode:I.cloneWithWhere(this.#e.queryNode,ye(e))})}whereRef(e,t,i){return new r({...this.#e,queryNode:I.cloneWithWhere(this.#e.queryNode,it(e,t,i))})}clearWhere(){return new r({...this.#e,queryNode:I.cloneWithoutWhere(this.#e.queryNode)})}top(e,t){return new r({...this.#e,queryNode:I.cloneWithTop(this.#e.queryNode,Qr(e,t))})}using(e){return new r({...this.#e,queryNode:Ms.cloneWithUsing(this.#e.queryNode,Gr(e))})}innerJoin(...e){return this.#t("InnerJoin",e)}leftJoin(...e){return this.#t("LeftJoin",e)}rightJoin(...e){return this.#t("RightJoin",e)}fullJoin(...e){return this.#t("FullJoin",e)}#t(e,t){return new r({...this.#e,queryNode:I.cloneWithJoin(this.#e.queryNode,Is(e,t))})}returning(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,Je(e))})}returningAll(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,nt(e))})}output(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,Je(e))})}outputAll(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,nt(e))})}clearReturning(){return new r({...this.#e,queryNode:I.cloneWithoutReturning(this.#e.queryNode)})}clearLimit(){return new r({...this.#e,queryNode:Ms.cloneWithoutLimit(this.#e.queryNode)})}orderBy(...e){return new r({...this.#e,queryNode:I.cloneWithOrderByItems(this.#e.queryNode,nr(e))})}clearOrderBy(){return new r({...this.#e,queryNode:I.cloneWithoutOrderBy(this.#e.queryNode)})}limit(e){return new r({...this.#e,queryNode:Ms.cloneWithLimit(this.#e.queryNode,Za.create(he(e)))})}modifyEnd(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}$call(e){return e(this)}$if(e,t){return e?t(this):new r({...this.#e})}$castTo(){return new r(this.#e)}$narrowType(){return new r(this.#e)}$assertType(){return new r(this.#e)}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:i}=this.#e.executor,s=e.query;return s.returning&&i.supportsReturning||s.output&&i.supportsOutput?t.rows:[new Lu(t.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=Tr){let t=await this.executeTakeFirst();if(t===void 0)throw bi(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),i=this.#e.executor.stream(t,e);for await(let s of i)yield*s.rows}async explain(e,t){return await new r({...this.#e,queryNode:I.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}}});var Bu,q2=g(()=>{"use strict";Bu=class{numUpdatedRows;numChangedRows;constructor(e,t){this.numUpdatedRows=e,this.numChangedRows=t}}});var eo,Wu=g(()=>{"use strict";Dc();vt();ks();Vr();Ga();Ou();x();q2();Ln();ar();gi();Oc();Ya();On();eo=class r{#e;constructor(e){this.#e=u(e)}where(...e){return new r({...this.#e,queryNode:I.cloneWithWhere(this.#e.queryNode,ye(e))})}whereRef(e,t,i){return new r({...this.#e,queryNode:I.cloneWithWhere(this.#e.queryNode,it(e,t,i))})}clearWhere(){return new r({...this.#e,queryNode:I.cloneWithoutWhere(this.#e.queryNode)})}top(e,t){return new r({...this.#e,queryNode:I.cloneWithTop(this.#e.queryNode,Qr(e,t))})}from(e){return new r({...this.#e,queryNode:wi.cloneWithFromItems(this.#e.queryNode,Gr(e))})}innerJoin(...e){return this.#t("InnerJoin",e)}leftJoin(...e){return this.#t("LeftJoin",e)}rightJoin(...e){return this.#t("RightJoin",e)}fullJoin(...e){return this.#t("FullJoin",e)}#t(e,t){return new r({...this.#e,queryNode:I.cloneWithJoin(this.#e.queryNode,Is(e,t))})}orderBy(...e){return new r({...this.#e,queryNode:I.cloneWithOrderByItems(this.#e.queryNode,nr(e))})}clearOrderBy(){return new r({...this.#e,queryNode:I.cloneWithoutOrderBy(this.#e.queryNode)})}limit(e){return new r({...this.#e,queryNode:wi.cloneWithLimit(this.#e.queryNode,Za.create(he(e)))})}set(...e){return new r({...this.#e,queryNode:wi.cloneWithUpdates(this.#e.queryNode,X5(...e))})}returning(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,Je(e))})}returningAll(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,nt(e))})}output(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,Je(e))})}outputAll(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,nt(e))})}modifyEnd(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}clearReturning(){return new r({...this.#e,queryNode:I.cloneWithoutReturning(this.#e.queryNode)})}$call(e){return e(this)}$if(e,t){return e?t(this):new r({...this.#e})}$castTo(){return new r(this.#e)}$narrowType(){return new r(this.#e)}$assertType(){return new r(this.#e)}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:i}=this.#e.executor,s=e.query;return s.returning&&i.supportsReturning||s.output&&i.supportsOutput?t.rows:[new Bu(t.numAffectedRows??BigInt(0),t.numChangedRows)]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=Tr){let t=await this.executeTakeFirst();if(t===void 0)throw bi(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),i=this.#e.executor.stream(t,e);for await(let s of i)yield*s.rows}async explain(e,t){return await new r({...this.#e,queryNode:I.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}}});var B2,W2=g(()=>{"use strict";x();Mt();La();B2=u({is(r){return r.kind==="CommonTableExpressionNameNode"},create(r,e){return u({kind:"CommonTableExpressionNameNode",table:ir.create(r),columns:e?u(e.map(ie.create)):void 0})}})});var to,zu=g(()=>{"use strict";x();to=u({is(r){return r.kind==="CommonTableExpressionNode"},create(r,e){return u({kind:"CommonTableExpressionNode",name:r,expression:e})},cloneWith(r,e){return u({...r,...e})}})});var Uu,e8=g(()=>{"use strict";zu();x();Uu=class r{#e;constructor(e){this.#e=u(e)}materialized(){return new r({...this.#e,node:to.cloneWith(this.#e.node,{materialized:!0})})}notMaterialized(){return new r({...this.#e,node:to.cloneWith(this.#e.node,{materialized:!1})})}toOperationNode(){return this.#e.node}}});function z2(r,e){let t=e(i8()).toOperationNode();return fe(r)?r(zA(t)).toOperationNode():to.create(t8(r),t)}function zA(r){return e=>new Uu({node:to.create(t8(e),r)})}function t8(r){if(r.includes("(")){let e=r.split(/[\(\)]/),t=e[0],i=e[1].split(",").map(s=>s.trim());return B2.create(t,i)}else return B2.create(r)}var r8=g(()=>{"use strict";W2();ju();x();e8();zu()});var $c,U2=g(()=>{"use strict";x();$c=u({is(r){return r.kind==="WithNode"},create(r,e){return u({kind:"WithNode",expressions:u([r]),...e})},cloneWithExpression(r,e){return u({...r,expressions:u([...r.expressions,e])})}})});function n8(r){let e="";for(let t=0;t<r;++t)e+=UA();return e}function UA(){return s8[~~(Math.random()*s8.length)]}var s8,a8=g(()=>{"use strict";s8=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"]});function ee(){return new j2}var j2,Ps=g(()=>{"use strict";a8();j2=class{#e;get queryId(){return this.#e===void 0&&(this.#e=n8(8)),this.#e}}});var ro,Vu=g(()=>{"use strict";x();ro=class{nodeStack=[];#e=u({AliasNode:this.transformAlias.bind(this),ColumnNode:this.transformColumn.bind(this),IdentifierNode:this.transformIdentifier.bind(this),SchemableIdentifierNode:this.transformSchemableIdentifier.bind(this),RawNode:this.transformRaw.bind(this),ReferenceNode:this.transformReference.bind(this),SelectQueryNode:this.transformSelectQuery.bind(this),SelectionNode:this.transformSelection.bind(this),TableNode:this.transformTable.bind(this),FromNode:this.transformFrom.bind(this),SelectAllNode:this.transformSelectAll.bind(this),AndNode:this.transformAnd.bind(this),OrNode:this.transformOr.bind(this),ValueNode:this.transformValue.bind(this),ValueListNode:this.transformValueList.bind(this),PrimitiveValueListNode:this.transformPrimitiveValueList.bind(this),ParensNode:this.transformParens.bind(this),JoinNode:this.transformJoin.bind(this),OperatorNode:this.transformOperator.bind(this),WhereNode:this.transformWhere.bind(this),InsertQueryNode:this.transformInsertQuery.bind(this),DeleteQueryNode:this.transformDeleteQuery.bind(this),ReturningNode:this.transformReturning.bind(this),CreateTableNode:this.transformCreateTable.bind(this),AddColumnNode:this.transformAddColumn.bind(this),ColumnDefinitionNode:this.transformColumnDefinition.bind(this),DropTableNode:this.transformDropTable.bind(this),DataTypeNode:this.transformDataType.bind(this),OrderByNode:this.transformOrderBy.bind(this),OrderByItemNode:this.transformOrderByItem.bind(this),GroupByNode:this.transformGroupBy.bind(this),GroupByItemNode:this.transformGroupByItem.bind(this),UpdateQueryNode:this.transformUpdateQuery.bind(this),ColumnUpdateNode:this.transformColumnUpdate.bind(this),LimitNode:this.transformLimit.bind(this),OffsetNode:this.transformOffset.bind(this),OnConflictNode:this.transformOnConflict.bind(this),OnDuplicateKeyNode:this.transformOnDuplicateKey.bind(this),CreateIndexNode:this.transformCreateIndex.bind(this),DropIndexNode:this.transformDropIndex.bind(this),ListNode:this.transformList.bind(this),PrimaryKeyConstraintNode:this.transformPrimaryKeyConstraint.bind(this),UniqueConstraintNode:this.transformUniqueConstraint.bind(this),ReferencesNode:this.transformReferences.bind(this),CheckConstraintNode:this.transformCheckConstraint.bind(this),WithNode:this.transformWith.bind(this),CommonTableExpressionNode:this.transformCommonTableExpression.bind(this),CommonTableExpressionNameNode:this.transformCommonTableExpressionName.bind(this),HavingNode:this.transformHaving.bind(this),CreateSchemaNode:this.transformCreateSchema.bind(this),DropSchemaNode:this.transformDropSchema.bind(this),AlterTableNode:this.transformAlterTable.bind(this),DropColumnNode:this.transformDropColumn.bind(this),RenameColumnNode:this.transformRenameColumn.bind(this),AlterColumnNode:this.transformAlterColumn.bind(this),ModifyColumnNode:this.transformModifyColumn.bind(this),AddConstraintNode:this.transformAddConstraint.bind(this),DropConstraintNode:this.transformDropConstraint.bind(this),RenameConstraintNode:this.transformRenameConstraint.bind(this),ForeignKeyConstraintNode:this.transformForeignKeyConstraint.bind(this),CreateViewNode:this.transformCreateView.bind(this),RefreshMaterializedViewNode:this.transformRefreshMaterializedView.bind(this),DropViewNode:this.transformDropView.bind(this),GeneratedNode:this.transformGenerated.bind(this),DefaultValueNode:this.transformDefaultValue.bind(this),OnNode:this.transformOn.bind(this),ValuesNode:this.transformValues.bind(this),SelectModifierNode:this.transformSelectModifier.bind(this),CreateTypeNode:this.transformCreateType.bind(this),DropTypeNode:this.transformDropType.bind(this),ExplainNode:this.transformExplain.bind(this),DefaultInsertValueNode:this.transformDefaultInsertValue.bind(this),AggregateFunctionNode:this.transformAggregateFunction.bind(this),OverNode:this.transformOver.bind(this),PartitionByNode:this.transformPartitionBy.bind(this),PartitionByItemNode:this.transformPartitionByItem.bind(this),SetOperationNode:this.transformSetOperation.bind(this),BinaryOperationNode:this.transformBinaryOperation.bind(this),UnaryOperationNode:this.transformUnaryOperation.bind(this),UsingNode:this.transformUsing.bind(this),FunctionNode:this.transformFunction.bind(this),CaseNode:this.transformCase.bind(this),WhenNode:this.transformWhen.bind(this),JSONReferenceNode:this.transformJSONReference.bind(this),JSONPathNode:this.transformJSONPath.bind(this),JSONPathLegNode:this.transformJSONPathLeg.bind(this),JSONOperatorChainNode:this.transformJSONOperatorChain.bind(this),TupleNode:this.transformTuple.bind(this),MergeQueryNode:this.transformMergeQuery.bind(this),MatchedNode:this.transformMatched.bind(this),AddIndexNode:this.transformAddIndex.bind(this),CastNode:this.transformCast.bind(this),FetchNode:this.transformFetch.bind(this),TopNode:this.transformTop.bind(this),OutputNode:this.transformOutput.bind(this),OrActionNode:this.transformOrAction.bind(this),CollateNode:this.transformCollate.bind(this),IndexTypeNode:this.transformIndexType.bind(this)});transformNode(e,t){if(!e)return e;this.nodeStack.push(e);let i=this.transformNodeImpl(e,t);return this.nodeStack.pop(),u(i)}transformNodeImpl(e,t){return this.#e[e.kind](e,t)}transformNodeList(e,t){return e&&u(e.map(i=>this.transformNode(i,t)))}transformSelectQuery(e,t){return{kind:"SelectQueryNode",from:this.transformNode(e.from,t),selections:this.transformNodeList(e.selections,t),distinctOn:this.transformNodeList(e.distinctOn,t),joins:this.transformNodeList(e.joins,t),groupBy:this.transformNode(e.groupBy,t),orderBy:this.transformNode(e.orderBy,t),where:this.transformNode(e.where,t),frontModifiers:this.transformNodeList(e.frontModifiers,t),endModifiers:this.transformNodeList(e.endModifiers,t),limit:this.transformNode(e.limit,t),offset:this.transformNode(e.offset,t),with:this.transformNode(e.with,t),having:this.transformNode(e.having,t),explain:this.transformNode(e.explain,t),setOperations:this.transformNodeList(e.setOperations,t),fetch:this.transformNode(e.fetch,t),top:this.transformNode(e.top,t)}}transformSelection(e,t){return{kind:"SelectionNode",selection:this.transformNode(e.selection,t)}}transformColumn(e,t){return{kind:"ColumnNode",column:this.transformNode(e.column,t)}}transformAlias(e,t){return{kind:"AliasNode",node:this.transformNode(e.node,t),alias:this.transformNode(e.alias,t)}}transformTable(e,t){return{kind:"TableNode",table:this.transformNode(e.table,t)}}transformFrom(e,t){return{kind:"FromNode",froms:this.transformNodeList(e.froms,t)}}transformReference(e,t){return{kind:"ReferenceNode",column:this.transformNode(e.column,t),table:this.transformNode(e.table,t)}}transformAnd(e,t){return{kind:"AndNode",left:this.transformNode(e.left,t),right:this.transformNode(e.right,t)}}transformOr(e,t){return{kind:"OrNode",left:this.transformNode(e.left,t),right:this.transformNode(e.right,t)}}transformValueList(e,t){return{kind:"ValueListNode",values:this.transformNodeList(e.values,t)}}transformParens(e,t){return{kind:"ParensNode",node:this.transformNode(e.node,t)}}transformJoin(e,t){return{kind:"JoinNode",joinType:e.joinType,table:this.transformNode(e.table,t),on:this.transformNode(e.on,t)}}transformRaw(e,t){return{kind:"RawNode",sqlFragments:u([...e.sqlFragments]),parameters:this.transformNodeList(e.parameters,t)}}transformWhere(e,t){return{kind:"WhereNode",where:this.transformNode(e.where,t)}}transformInsertQuery(e,t){return{kind:"InsertQueryNode",into:this.transformNode(e.into,t),columns:this.transformNodeList(e.columns,t),values:this.transformNode(e.values,t),returning:this.transformNode(e.returning,t),onConflict:this.transformNode(e.onConflict,t),onDuplicateKey:this.transformNode(e.onDuplicateKey,t),endModifiers:this.transformNodeList(e.endModifiers,t),with:this.transformNode(e.with,t),orAction:this.transformNode(e.orAction,t),replace:e.replace,explain:this.transformNode(e.explain,t),defaultValues:e.defaultValues,top:this.transformNode(e.top,t),output:this.transformNode(e.output,t)}}transformValues(e,t){return{kind:"ValuesNode",values:this.transformNodeList(e.values,t)}}transformDeleteQuery(e,t){return{kind:"DeleteQueryNode",from:this.transformNode(e.from,t),using:this.transformNode(e.using,t),joins:this.transformNodeList(e.joins,t),where:this.transformNode(e.where,t),returning:this.transformNode(e.returning,t),endModifiers:this.transformNodeList(e.endModifiers,t),with:this.transformNode(e.with,t),orderBy:this.transformNode(e.orderBy,t),limit:this.transformNode(e.limit,t),explain:this.transformNode(e.explain,t),top:this.transformNode(e.top,t),output:this.transformNode(e.output,t)}}transformReturning(e,t){return{kind:"ReturningNode",selections:this.transformNodeList(e.selections,t)}}transformCreateTable(e,t){return{kind:"CreateTableNode",table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t),constraints:this.transformNodeList(e.constraints,t),temporary:e.temporary,ifNotExists:e.ifNotExists,onCommit:e.onCommit,frontModifiers:this.transformNodeList(e.frontModifiers,t),endModifiers:this.transformNodeList(e.endModifiers,t),selectQuery:this.transformNode(e.selectQuery,t)}}transformColumnDefinition(e,t){return{kind:"ColumnDefinitionNode",column:this.transformNode(e.column,t),dataType:this.transformNode(e.dataType,t),references:this.transformNode(e.references,t),primaryKey:e.primaryKey,autoIncrement:e.autoIncrement,unique:e.unique,notNull:e.notNull,unsigned:e.unsigned,defaultTo:this.transformNode(e.defaultTo,t),check:this.transformNode(e.check,t),generated:this.transformNode(e.generated,t),frontModifiers:this.transformNodeList(e.frontModifiers,t),endModifiers:this.transformNodeList(e.endModifiers,t),nullsNotDistinct:e.nullsNotDistinct,identity:e.identity,ifNotExists:e.ifNotExists}}transformAddColumn(e,t){return{kind:"AddColumnNode",column:this.transformNode(e.column,t)}}transformDropTable(e,t){return{kind:"DropTableNode",table:this.transformNode(e.table,t),ifExists:e.ifExists,cascade:e.cascade}}transformOrderBy(e,t){return{kind:"OrderByNode",items:this.transformNodeList(e.items,t)}}transformOrderByItem(e,t){return{kind:"OrderByItemNode",orderBy:this.transformNode(e.orderBy,t),direction:this.transformNode(e.direction,t),collation:this.transformNode(e.collation,t),nulls:e.nulls}}transformGroupBy(e,t){return{kind:"GroupByNode",items:this.transformNodeList(e.items,t)}}transformGroupByItem(e,t){return{kind:"GroupByItemNode",groupBy:this.transformNode(e.groupBy,t)}}transformUpdateQuery(e,t){return{kind:"UpdateQueryNode",table:this.transformNode(e.table,t),from:this.transformNode(e.from,t),joins:this.transformNodeList(e.joins,t),where:this.transformNode(e.where,t),updates:this.transformNodeList(e.updates,t),returning:this.transformNode(e.returning,t),endModifiers:this.transformNodeList(e.endModifiers,t),with:this.transformNode(e.with,t),explain:this.transformNode(e.explain,t),limit:this.transformNode(e.limit,t),top:this.transformNode(e.top,t),output:this.transformNode(e.output,t),orderBy:this.transformNode(e.orderBy,t)}}transformColumnUpdate(e,t){return{kind:"ColumnUpdateNode",column:this.transformNode(e.column,t),value:this.transformNode(e.value,t)}}transformLimit(e,t){return{kind:"LimitNode",limit:this.transformNode(e.limit,t)}}transformOffset(e,t){return{kind:"OffsetNode",offset:this.transformNode(e.offset,t)}}transformOnConflict(e,t){return{kind:"OnConflictNode",columns:this.transformNodeList(e.columns,t),constraint:this.transformNode(e.constraint,t),indexExpression:this.transformNode(e.indexExpression,t),indexWhere:this.transformNode(e.indexWhere,t),updates:this.transformNodeList(e.updates,t),updateWhere:this.transformNode(e.updateWhere,t),doNothing:e.doNothing}}transformOnDuplicateKey(e,t){return{kind:"OnDuplicateKeyNode",updates:this.transformNodeList(e.updates,t)}}transformCreateIndex(e,t){return{kind:"CreateIndexNode",name:this.transformNode(e.name,t),table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t),unique:e.unique,using:this.transformNode(e.using,t),ifNotExists:e.ifNotExists,where:this.transformNode(e.where,t),nullsNotDistinct:e.nullsNotDistinct}}transformList(e,t){return{kind:"ListNode",items:this.transformNodeList(e.items,t)}}transformDropIndex(e,t){return{kind:"DropIndexNode",name:this.transformNode(e.name,t),table:this.transformNode(e.table,t),ifExists:e.ifExists,cascade:e.cascade}}transformPrimaryKeyConstraint(e,t){return{kind:"PrimaryKeyConstraintNode",columns:this.transformNodeList(e.columns,t),name:this.transformNode(e.name,t),deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred}}transformUniqueConstraint(e,t){return{kind:"UniqueConstraintNode",columns:this.transformNodeList(e.columns,t),name:this.transformNode(e.name,t),nullsNotDistinct:e.nullsNotDistinct,deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred}}transformForeignKeyConstraint(e,t){return{kind:"ForeignKeyConstraintNode",columns:this.transformNodeList(e.columns,t),references:this.transformNode(e.references,t),name:this.transformNode(e.name,t),onDelete:e.onDelete,onUpdate:e.onUpdate,deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred}}transformSetOperation(e,t){return{kind:"SetOperationNode",operator:e.operator,expression:this.transformNode(e.expression,t),all:e.all}}transformReferences(e,t){return{kind:"ReferencesNode",table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t),onDelete:e.onDelete,onUpdate:e.onUpdate}}transformCheckConstraint(e,t){return{kind:"CheckConstraintNode",expression:this.transformNode(e.expression,t),name:this.transformNode(e.name,t)}}transformWith(e,t){return{kind:"WithNode",expressions:this.transformNodeList(e.expressions,t),recursive:e.recursive}}transformCommonTableExpression(e,t){return{kind:"CommonTableExpressionNode",name:this.transformNode(e.name,t),materialized:e.materialized,expression:this.transformNode(e.expression,t)}}transformCommonTableExpressionName(e,t){return{kind:"CommonTableExpressionNameNode",table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t)}}transformHaving(e,t){return{kind:"HavingNode",having:this.transformNode(e.having,t)}}transformCreateSchema(e,t){return{kind:"CreateSchemaNode",schema:this.transformNode(e.schema,t),ifNotExists:e.ifNotExists}}transformDropSchema(e,t){return{kind:"DropSchemaNode",schema:this.transformNode(e.schema,t),ifExists:e.ifExists,cascade:e.cascade}}transformAlterTable(e,t){return{kind:"AlterTableNode",table:this.transformNode(e.table,t),renameTo:this.transformNode(e.renameTo,t),setSchema:this.transformNode(e.setSchema,t),columnAlterations:this.transformNodeList(e.columnAlterations,t),addConstraint:this.transformNode(e.addConstraint,t),dropConstraint:this.transformNode(e.dropConstraint,t),renameConstraint:this.transformNode(e.renameConstraint,t),addIndex:this.transformNode(e.addIndex,t),dropIndex:this.transformNode(e.dropIndex,t)}}transformDropColumn(e,t){return{kind:"DropColumnNode",column:this.transformNode(e.column,t)}}transformRenameColumn(e,t){return{kind:"RenameColumnNode",column:this.transformNode(e.column,t),renameTo:this.transformNode(e.renameTo,t)}}transformAlterColumn(e,t){return{kind:"AlterColumnNode",column:this.transformNode(e.column,t),dataType:this.transformNode(e.dataType,t),dataTypeExpression:this.transformNode(e.dataTypeExpression,t),setDefault:this.transformNode(e.setDefault,t),dropDefault:e.dropDefault,setNotNull:e.setNotNull,dropNotNull:e.dropNotNull}}transformModifyColumn(e,t){return{kind:"ModifyColumnNode",column:this.transformNode(e.column,t)}}transformAddConstraint(e,t){return{kind:"AddConstraintNode",constraint:this.transformNode(e.constraint,t)}}transformDropConstraint(e,t){return{kind:"DropConstraintNode",constraintName:this.transformNode(e.constraintName,t),ifExists:e.ifExists,modifier:e.modifier}}transformRenameConstraint(e,t){return{kind:"RenameConstraintNode",oldName:this.transformNode(e.oldName,t),newName:this.transformNode(e.newName,t)}}transformCreateView(e,t){return{kind:"CreateViewNode",name:this.transformNode(e.name,t),temporary:e.temporary,orReplace:e.orReplace,ifNotExists:e.ifNotExists,materialized:e.materialized,columns:this.transformNodeList(e.columns,t),as:this.transformNode(e.as,t)}}transformRefreshMaterializedView(e,t){return{kind:"RefreshMaterializedViewNode",name:this.transformNode(e.name,t),concurrently:e.concurrently,withNoData:e.withNoData}}transformDropView(e,t){return{kind:"DropViewNode",name:this.transformNode(e.name,t),ifExists:e.ifExists,materialized:e.materialized,cascade:e.cascade}}transformGenerated(e,t){return{kind:"GeneratedNode",byDefault:e.byDefault,always:e.always,identity:e.identity,stored:e.stored,expression:this.transformNode(e.expression,t)}}transformDefaultValue(e,t){return{kind:"DefaultValueNode",defaultValue:this.transformNode(e.defaultValue,t)}}transformOn(e,t){return{kind:"OnNode",on:this.transformNode(e.on,t)}}transformSelectModifier(e,t){return{kind:"SelectModifierNode",modifier:e.modifier,rawModifier:this.transformNode(e.rawModifier,t),of:this.transformNodeList(e.of,t)}}transformCreateType(e,t){return{kind:"CreateTypeNode",name:this.transformNode(e.name,t),enum:this.transformNode(e.enum,t)}}transformDropType(e,t){return{kind:"DropTypeNode",name:this.transformNode(e.name,t),ifExists:e.ifExists}}transformExplain(e,t){return{kind:"ExplainNode",format:e.format,options:this.transformNode(e.options,t)}}transformSchemableIdentifier(e,t){return{kind:"SchemableIdentifierNode",schema:this.transformNode(e.schema,t),identifier:this.transformNode(e.identifier,t)}}transformAggregateFunction(e,t){return{kind:"AggregateFunctionNode",func:e.func,aggregated:this.transformNodeList(e.aggregated,t),distinct:e.distinct,orderBy:this.transformNode(e.orderBy,t),withinGroup:this.transformNode(e.withinGroup,t),filter:this.transformNode(e.filter,t),over:this.transformNode(e.over,t)}}transformOver(e,t){return{kind:"OverNode",orderBy:this.transformNode(e.orderBy,t),partitionBy:this.transformNode(e.partitionBy,t)}}transformPartitionBy(e,t){return{kind:"PartitionByNode",items:this.transformNodeList(e.items,t)}}transformPartitionByItem(e,t){return{kind:"PartitionByItemNode",partitionBy:this.transformNode(e.partitionBy,t)}}transformBinaryOperation(e,t){return{kind:"BinaryOperationNode",leftOperand:this.transformNode(e.leftOperand,t),operator:this.transformNode(e.operator,t),rightOperand:this.transformNode(e.rightOperand,t)}}transformUnaryOperation(e,t){return{kind:"UnaryOperationNode",operator:this.transformNode(e.operator,t),operand:this.transformNode(e.operand,t)}}transformUsing(e,t){return{kind:"UsingNode",tables:this.transformNodeList(e.tables,t)}}transformFunction(e,t){return{kind:"FunctionNode",func:e.func,arguments:this.transformNodeList(e.arguments,t)}}transformCase(e,t){return{kind:"CaseNode",value:this.transformNode(e.value,t),when:this.transformNodeList(e.when,t),else:this.transformNode(e.else,t),isStatement:e.isStatement}}transformWhen(e,t){return{kind:"WhenNode",condition:this.transformNode(e.condition,t),result:this.transformNode(e.result,t)}}transformJSONReference(e,t){return{kind:"JSONReferenceNode",reference:this.transformNode(e.reference,t),traversal:this.transformNode(e.traversal,t)}}transformJSONPath(e,t){return{kind:"JSONPathNode",inOperator:this.transformNode(e.inOperator,t),pathLegs:this.transformNodeList(e.pathLegs,t)}}transformJSONPathLeg(e,t){return{kind:"JSONPathLegNode",type:e.type,value:e.value}}transformJSONOperatorChain(e,t){return{kind:"JSONOperatorChainNode",operator:this.transformNode(e.operator,t),values:this.transformNodeList(e.values,t)}}transformTuple(e,t){return{kind:"TupleNode",values:this.transformNodeList(e.values,t)}}transformMergeQuery(e,t){return{kind:"MergeQueryNode",into:this.transformNode(e.into,t),using:this.transformNode(e.using,t),whens:this.transformNodeList(e.whens,t),with:this.transformNode(e.with,t),top:this.transformNode(e.top,t),endModifiers:this.transformNodeList(e.endModifiers,t),output:this.transformNode(e.output,t),returning:this.transformNode(e.returning,t)}}transformMatched(e,t){return{kind:"MatchedNode",not:e.not,bySource:e.bySource}}transformAddIndex(e,t){return{kind:"AddIndexNode",name:this.transformNode(e.name,t),columns:this.transformNodeList(e.columns,t),unique:e.unique,using:this.transformNode(e.using,t),ifNotExists:e.ifNotExists}}transformCast(e,t){return{kind:"CastNode",expression:this.transformNode(e.expression,t),dataType:this.transformNode(e.dataType,t)}}transformFetch(e,t){return{kind:"FetchNode",rowCount:this.transformNode(e.rowCount,t),modifier:e.modifier}}transformTop(e,t){return{kind:"TopNode",expression:e.expression,modifiers:e.modifiers}}transformOutput(e,t){return{kind:"OutputNode",selections:this.transformNodeList(e.selections,t)}}transformDataType(e,t){return e}transformSelectAll(e,t){return e}transformIdentifier(e,t){return e}transformValue(e,t){return e}transformPrimitiveValueList(e,t){return e}transformOperator(e,t){return e}transformDefaultInsertValue(e,t){return e}transformOrAction(e,t){return e}transformCollate(e,t){return e}transformIndexType(e,t){return e}}});var jA,VA,Hu,o8=g(()=>{"use strict";Wr();ge();qa();Mu();Vu();Li();La();x();jA=u({AlterTableNode:!0,CreateIndexNode:!0,CreateSchemaNode:!0,CreateTableNode:!0,CreateTypeNode:!0,CreateViewNode:!0,RefreshMaterializedViewNode:!0,DeleteQueryNode:!0,DropIndexNode:!0,DropSchemaNode:!0,DropTableNode:!0,DropTypeNode:!0,DropViewNode:!0,InsertQueryNode:!0,RawNode:!0,SelectQueryNode:!0,UpdateQueryNode:!0,MergeQueryNode:!0}),VA={json_agg:!0,to_json:!0},Hu=class extends ro{#e;#t=new Set;#r=new Set;constructor(e){super(),this.#e=e}transformNodeImpl(e,t){if(!this.#s(e))return super.transformNodeImpl(e,t);let i=this.#u(e);for(let a of i)this.#r.add(a);let s=this.#m(e);for(let a of s)this.#t.add(a);let n=super.transformNodeImpl(e,t);for(let a of s)this.#t.delete(a);for(let a of i)this.#r.delete(a);return n}transformSchemableIdentifier(e,t){let i=super.transformSchemableIdentifier(e,t);return i.schema||!this.#t.has(e.identifier.name)?i:{...i,schema:W.create(this.#e)}}transformReferences(e,t){let i=super.transformReferences(e,t);return i.table.table.schema?i:{...i,table:ir.createWithSchema(this.#e,i.table.table.identifier.name)}}transformAggregateFunction(e,t){return{...super.transformAggregateFunction({...e,aggregated:[]},t),aggregated:this.#i(e,t,"aggregated")}}transformFunction(e,t){return{...super.transformFunction({...e,arguments:[]},t),arguments:this.#i(e,t,"arguments")}}#i(e,t,i){return VA[e.func]?e[i].map(s=>!ir.is(s)||s.table.schema?this.transformNode(s,t):{...s,table:this.transformIdentifier(s.table.identifier,t)}):this.transformNodeList(e[i],t)}#s(e){return e.kind in jA}#m(e){let t=new Set;if("name"in e&&e.name&&Rt.is(e.name)&&this.#c(e.name,t),"from"in e&&e.from)for(let i of e.from.froms)this.#o(i,t);if("into"in e&&e.into&&this.#o(e.into,t),"table"in e&&e.table&&this.#o(e.table,t),"joins"in e&&e.joins)for(let i of e.joins)this.#o(i.table,t);return"using"in e&&e.using&&(Ur.is(e.using)?this.#o(e.using.table,t):this.#o(e.using,t)),t}#u(e){let t=new Set;return"with"in e&&e.with&&this.#l(e.with,t),t}#o(e,t){if(ir.is(e))this.#c(e.table,t);else if(rt.is(e)&&ir.is(e.node))this.#c(e.node.table,t);else if(Ru.is(e))for(let i of e.items)this.#o(i,t)}#c(e,t){let i=e.identifier.name;!this.#t.has(i)&&!this.#r.has(i)&&t.add(i)}#l(e,t){for(let i of e.expressions){let s=i.name.table.table.identifier.name;this.#r.has(s)||t.add(s)}}}});var _r,io=g(()=>{"use strict";o8();_r=class{#e;constructor(e){this.#e=new Hu(e)}transformQuery(e){return this.#e.transformNode(e.node,e.queryId)}async transformResult(e){return e.result}}});var l8,V2=g(()=>{"use strict";x();l8=u({is(r){return r.kind==="MatchedNode"},create(r,e=!1){return u({kind:"MatchedNode",not:r,bySource:e})}})});function H2(r,e,t){return Ui.create(Ha([l8.create(!r.isMatched,r.bySource),...e&&e.length>0?[e.length===3&&t?it(e[0],e[1],e[2]):ye(e)]:[]],"and",!1))}function so(r){return Se(r)?xe.create([r],[]):we(r)?r.toOperationNode():r}var c8=g(()=>{"use strict";V2();Ht();qi();Ka();x();ar()});var Fc,d8=g(()=>{"use strict";Fc=class{#e;#t;#r;constructor(){this.#e=new Promise((e,t)=>{this.#r=t,this.#t=e})}get promise(){return this.#e}resolve=e=>{this.#t&&this.#t(e)};reject=e=>{this.#r&&this.#r(e)}}});async function Qu(r){let e=new Fc,t=new Fc;return r.provideConnection(async i=>(e.resolve(i),await t.promise)).catch(i=>e.reject(i)),u({connection:await e.promise,release:t.resolve})}var Q2=g(()=>{"use strict";d8();x()});function u8(r){p8.has(r)||(p8.add(r),console.log(r))}var p8,m8=g(()=>{"use strict";p8=new Set});var HA,no,G2=g(()=>{"use strict";x();Q2();m8();HA=u([]),no=class{#e;constructor(e=HA){this.#e=e}get plugins(){return this.#e}transformQuery(e,t){for(let i of this.#e){let s=i.transformQuery({node:e,queryId:t});if(s.kind===e.kind)e=s;else throw new Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${e.kind}`,`but it returned a ${s.kind}`].join(" "))}return e}async executeQuery(e){return await this.provideConnection(async t=>{let i=await t.executeQuery(e);return"numUpdatedOrDeletedRows"in i&&u8("kysely:warning: outdated driver/plugin detected! `QueryResult.numUpdatedOrDeletedRows` has been replaced with `QueryResult.numAffectedRows`."),await this.#t(i,e.queryId)})}async*stream(e,t){let{connection:i,release:s}=await Qu(this);try{for await(let n of i.streamQuery(e,t))yield await this.#t(n,e.queryId)}finally{s()}}async#t(e,t){for(let i of this.#e)e=await i.transformResult({result:e,queryId:t});return e}}});var K2,Os,ao=g(()=>{"use strict";G2();K2=class r extends no{get adapter(){throw new Error("this query cannot be compiled to SQL")}compileQuery(){throw new Error("this query cannot be compiled to SQL")}provideConnection(){throw new Error("this query cannot be executed")}withConnectionProvider(){throw new Error("this query cannot have a connection provider")}withPlugin(e){return new r([...this.plugins,e])}withPlugins(e){return new r([...this.plugins,...e])}withPluginAtFront(e){return new r([e,...this.plugins])}withoutPlugins(){return new r([])}},Os=new K2});var Gu,J2=g(()=>{"use strict";Gu=class{numChangedRows;constructor(e){this.numChangedRows=e}}});var Ku,Ds,Ju,X2,Y2=g(()=>{"use strict";$n();Ja();Vr();Ga();N2();Dc();c8();ks();Ya();ao();x();J2();Ln();Wu();Ku=class r{#e;constructor(e){this.#e=u(e)}modifyEnd(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}top(e,t){return new r({...this.#e,queryNode:I.cloneWithTop(this.#e.queryNode,Qr(e,t))})}using(...e){return new Ds({...this.#e,queryNode:st.cloneWithUsing(this.#e.queryNode,Is("Using",e))})}returning(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,Je(e))})}returningAll(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,nt(e))})}output(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,Je(e))})}outputAll(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,nt(e))})}},Ds=class r{#e;constructor(e){this.#e=u(e)}modifyEnd(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}top(e,t){return new r({...this.#e,queryNode:I.cloneWithTop(this.#e.queryNode,Qr(e,t))})}whenMatched(){return this.#t([])}whenMatchedAnd(...e){return this.#t(e)}whenMatchedAndRef(e,t,i){return this.#t([e,t,i],!0)}#t(e,t){return new Ju({...this.#e,queryNode:st.cloneWithWhen(this.#e.queryNode,H2({isMatched:!0},e,t))})}whenNotMatched(){return this.#r([])}whenNotMatchedAnd(...e){return this.#r(e)}whenNotMatchedAndRef(e,t,i){return this.#r([e,t,i],!0)}whenNotMatchedBySource(){return this.#r([],!1,!0)}whenNotMatchedBySourceAnd(...e){return this.#r(e,!1,!0)}whenNotMatchedBySourceAndRef(e,t,i){return this.#r([e,t,i],!0,!0)}returning(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,Je(e))})}returningAll(e){return new r({...this.#e,queryNode:I.cloneWithReturning(this.#e.queryNode,nt(e))})}output(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,Je(e))})}outputAll(e){return new r({...this.#e,queryNode:I.cloneWithOutput(this.#e.queryNode,nt(e))})}#r(e,t=!1,i=!1){let s={...this.#e,queryNode:st.cloneWithWhen(this.#e.queryNode,H2({isMatched:!1,bySource:i},e,t))},n=i?Ju:X2;return new n(s)}$call(e){return e(this)}$if(e,t){return e?t(this):new r({...this.#e})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:i}=this.#e.executor,s=e.query;return s.returning&&i.supportsReturning||s.output&&i.supportsOutput?t.rows:[new Gu(t.numAffectedRows)]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=Tr){let t=await this.executeTakeFirst();if(t===void 0)throw bi(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}},Ju=class{#e;constructor(e){this.#e=u(e)}thenDelete(){return new Ds({...this.#e,queryNode:st.cloneWithThen(this.#e.queryNode,so("delete"))})}thenDoNothing(){return new Ds({...this.#e,queryNode:st.cloneWithThen(this.#e.queryNode,so("do nothing"))})}thenUpdate(e){return new Ds({...this.#e,queryNode:st.cloneWithThen(this.#e.queryNode,so(e(new eo({queryId:this.#e.queryId,executor:Os,queryNode:wi.createWithoutTable()}))))})}thenUpdateSet(...e){return this.thenUpdate(t=>t.set(...e))}},X2=class{#e;constructor(e){this.#e=u(e)}thenDoNothing(){return new Ds({...this.#e,queryNode:st.cloneWithThen(this.#e.queryNode,so("do nothing"))})}thenInsertValues(e){let[t,i]=Pu(e);return new Ds({...this.#e,queryNode:st.cloneWithThen(this.#e.queryNode,so(Ie.cloneWith(Ie.createWithoutInto(),{columns:t,values:i})))})}}});var oo,Xu=g(()=>{"use strict";Yu();$2();L2();Wu();Mc();$n();Qa();Ga();vt();r8();U2();Ps();io();x();ks();Y2();Ja();oo=class r{#e;constructor(e){this.#e=u(e)}selectFrom(e){return Lc({queryId:ee(),executor:this.#e.executor,queryNode:ue.createFrom(Gr(e),this.#e.withNode)})}selectNoFrom(e){return Lc({queryId:ee(),executor:this.#e.executor,queryNode:ue.cloneWithSelections(ue.create(this.#e.withNode),Je(e))})}insertInto(e){return new Pc({queryId:ee(),executor:this.#e.executor,queryNode:Ie.create(ae(e),this.#e.withNode)})}replaceInto(e){return new Pc({queryId:ee(),executor:this.#e.executor,queryNode:Ie.create(ae(e),this.#e.withNode,!0)})}deleteFrom(e){return new qu({queryId:ee(),executor:this.#e.executor,queryNode:Ms.create(Gr(e),this.#e.withNode)})}updateTable(e){return new eo({queryId:ee(),executor:this.#e.executor,queryNode:wi.create(Gr(e),this.#e.withNode)})}mergeInto(e){return new Ku({queryId:ee(),executor:this.#e.executor,queryNode:st.create(Z2(e),this.#e.withNode)})}with(e,t){let i=z2(e,t);return new r({...this.#e,withNode:this.#e.withNode?$c.cloneWithExpression(this.#e.withNode,i):$c.create(i)})}withRecursive(e,t){let i=z2(e,t);return new r({...this.#e,withNode:this.#e.withNode?$c.cloneWithExpression(this.#e.withNode,i):$c.create(i,{recursive:!0})})}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}withoutPlugins(){return new r({...this.#e,executor:this.#e.executor.withoutPlugins()})}withSchema(e){return new r({...this.#e,executor:this.#e.executor.withPluginAtFront(new _r(e))})}}});function i8(){return new oo({executor:Os})}function h8(r,e){return new Au({joinNode:Ur.create(r,Bn(e))})}function f8(){return new ku({overNode:Ac.create()})}var ju=g(()=>{"use strict";qa();Cu();h2();H5();Xu();ao();vt()});function Is(r,e){if(e.length===3)return GA(r,e[0],e[1],e[2]);if(e.length===2)return QA(r,e[0],e[1]);if(e.length===1)return KA(r,e[0]);throw new Error(`Invalid join arguments: expected 1, 2, or 3 arguments, got ${e.length}`)}function QA(r,e,t){return t(h8(r,e)).toOperationNode()}function GA(r,e,t,i){return Ur.createWithOn(r,Bn(e),it(t,"=",i))}function KA(r,e){return Ur.create(r,Bn(e))}var Dc=g(()=>{"use strict";qa();ar();ju();vt()});var g8,e6=g(()=>{"use strict";x();g8=u({is(r){return r.kind==="OffsetNode"},create(r){return u({kind:"OffsetNode",offset:r})}})});var y8,t6=g(()=>{"use strict";x();y8=u({is(r){return r.kind==="GroupByItemNode"},create(r){return u({kind:"GroupByItemNode",groupBy:r})}})});function w8(r){return r=fe(r)?r(Hr()):r,Wi(r).map(y8.create)}var b8=g(()=>{"use strict";t6();Fn();x();yt()});var Zu,em=g(()=>{"use strict";x();Zu=u({is(r){return r.kind==="SetOperationNode"},create(r,e,t){return u({kind:"SetOperationNode",operator:r,expression:e,all:t})}})});function Wn(r,e,t){return fe(e)&&(e=e(tm())),Ct(e)||(e=[e]),e.map(i=>Zu.create(r,Gt(i),t))}var v8=g(()=>{"use strict";Fn();em();x();jr()});var ce,qc,r6,i6,lo=g(()=>{"use strict";Wr();Ns();ge();Ht();In();Va();ar();ce=class r{#e;constructor(e){this.#e=e}get expressionType(){}as(e){return new qc(this,e)}or(...e){return new r6(zr.create(this.#e,ye(e)))}and(...e){return new i6(Qt.create(this.#e,ye(e)))}$castTo(){return new r(this.#e)}$notNull(){return new r(this.#e)}toOperationNode(){return this.#e}},qc=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return rt.create(this.#e.toOperationNode(),we(this.#t)?this.#t.toOperationNode():W.create(this.#t))}},r6=class r{#e;constructor(e){this.#e=e}get expressionType(){}as(e){return new qc(this,e)}or(...e){return new r(zr.create(this.#e,ye(e)))}$castTo(){return new r(this.#e)}toOperationNode(){return yi.create(this.#e)}},i6=class r{#e;constructor(e){this.#e=e}get expressionType(){}as(e){return new qc(this,e)}and(...e){return new r(Qt.create(this.#e,ye(e)))}$castTo(){return new r(this.#e)}toOperationNode(){return yi.create(this.#e)}}});var S8,s6=g(()=>{"use strict";fi();S8={is(r){return r.kind==="FetchNode"},create(r,e){return{kind:"FetchNode",rowCount:Qe.create(r),modifier:e}}}});function x8(r,e){if(!_s(r)&&!$a(r))throw new Error(`Invalid fetch row count: ${r}`);if(!JA(e))throw new Error(`Invalid fetch modifier: ${e}`);return S8.create(r,e)}function JA(r){return r==="only"||r==="with ties"}var T8=g(()=>{"use strict";s6();x()});function Lc(r){return new n6(r)}var n6,a6,Yu=g(()=>{"use strict";Wr();Jg();Dc();vt();ks();yt();Qa();Vr();On();Oc();e6();x();b8();Ln();ge();v8();ar();lo();gi();T8();Ya();n6=class r{#e;constructor(e){this.#e=u(e)}get expressionType(){}get isSelectQueryBuilder(){return!0}where(...e){return new r({...this.#e,queryNode:I.cloneWithWhere(this.#e.queryNode,ye(e))})}whereRef(e,t,i){return new r({...this.#e,queryNode:I.cloneWithWhere(this.#e.queryNode,it(e,t,i))})}having(...e){return new r({...this.#e,queryNode:ue.cloneWithHaving(this.#e.queryNode,ye(e))})}havingRef(e,t,i){return new r({...this.#e,queryNode:ue.cloneWithHaving(this.#e.queryNode,it(e,t,i))})}select(e){return new r({...this.#e,queryNode:ue.cloneWithSelections(this.#e.queryNode,Je(e))})}distinctOn(e){return new r({...this.#e,queryNode:ue.cloneWithDistinctOn(this.#e.queryNode,Wi(e))})}modifyFront(e){return new r({...this.#e,queryNode:ue.cloneWithFrontModifier(this.#e.queryNode,mi.createWithExpression(e.toOperationNode()))})}modifyEnd(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,mi.createWithExpression(e.toOperationNode()))})}distinct(){return new r({...this.#e,queryNode:ue.cloneWithFrontModifier(this.#e.queryNode,mi.create("Distinct"))})}forUpdate(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,mi.create("ForUpdate",e?bc(e).map(ae):void 0))})}forShare(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,mi.create("ForShare",e?bc(e).map(ae):void 0))})}forKeyShare(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,mi.create("ForKeyShare",e?bc(e).map(ae):void 0))})}forNoKeyUpdate(e){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,mi.create("ForNoKeyUpdate",e?bc(e).map(ae):void 0))})}skipLocked(){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,mi.create("SkipLocked"))})}noWait(){return new r({...this.#e,queryNode:I.cloneWithEndModifier(this.#e.queryNode,mi.create("NoWait"))})}selectAll(e){return new r({...this.#e,queryNode:ue.cloneWithSelections(this.#e.queryNode,nt(e))})}innerJoin(...e){return this.#t("InnerJoin",e)}leftJoin(...e){return this.#t("LeftJoin",e)}rightJoin(...e){return this.#t("RightJoin",e)}fullJoin(...e){return this.#t("FullJoin",e)}crossJoin(...e){return this.#t("CrossJoin",e)}innerJoinLateral(...e){return this.#t("LateralInnerJoin",e)}leftJoinLateral(...e){return this.#t("LateralLeftJoin",e)}crossJoinLateral(...e){return this.#t("LateralCrossJoin",e)}crossApply(...e){return this.#t("CrossApply",e)}outerApply(...e){return this.#t("OuterApply",e)}#t(e,t){return new r({...this.#e,queryNode:I.cloneWithJoin(this.#e.queryNode,Is(e,t))})}orderBy(...e){return new r({...this.#e,queryNode:I.cloneWithOrderByItems(this.#e.queryNode,nr(e))})}groupBy(e){return new r({...this.#e,queryNode:ue.cloneWithGroupByItems(this.#e.queryNode,w8(e))})}limit(e){return new r({...this.#e,queryNode:ue.cloneWithLimit(this.#e.queryNode,Za.create(he(e)))})}offset(e){return new r({...this.#e,queryNode:ue.cloneWithOffset(this.#e.queryNode,g8.create(he(e)))})}fetch(e,t="only"){return new r({...this.#e,queryNode:ue.cloneWithFetch(this.#e.queryNode,x8(e,t))})}top(e,t){return new r({...this.#e,queryNode:I.cloneWithTop(this.#e.queryNode,Qr(e,t))})}union(e){return new r({...this.#e,queryNode:ue.cloneWithSetOperations(this.#e.queryNode,Wn("union",e,!1))})}unionAll(e){return new r({...this.#e,queryNode:ue.cloneWithSetOperations(this.#e.queryNode,Wn("union",e,!0))})}intersect(e){return new r({...this.#e,queryNode:ue.cloneWithSetOperations(this.#e.queryNode,Wn("intersect",e,!1))})}intersectAll(e){return new r({...this.#e,queryNode:ue.cloneWithSetOperations(this.#e.queryNode,Wn("intersect",e,!0))})}except(e){return new r({...this.#e,queryNode:ue.cloneWithSetOperations(this.#e.queryNode,Wn("except",e,!1))})}exceptAll(e){return new r({...this.#e,queryNode:ue.cloneWithSetOperations(this.#e.queryNode,Wn("except",e,!0))})}as(e){return new a6(this,e)}clearSelect(){return new r({...this.#e,queryNode:ue.cloneWithoutSelections(this.#e.queryNode)})}clearWhere(){return new r({...this.#e,queryNode:I.cloneWithoutWhere(this.#e.queryNode)})}clearLimit(){return new r({...this.#e,queryNode:ue.cloneWithoutLimit(this.#e.queryNode)})}clearOffset(){return new r({...this.#e,queryNode:ue.cloneWithoutOffset(this.#e.queryNode)})}clearOrderBy(){return new r({...this.#e,queryNode:I.cloneWithoutOrderBy(this.#e.queryNode)})}clearGroupBy(){return new r({...this.#e,queryNode:ue.cloneWithoutGroupBy(this.#e.queryNode)})}$call(e){return e(this)}$if(e,t){return e?t(this):new r({...this.#e})}$castTo(){return new r(this.#e)}$narrowType(){return new r(this.#e)}$assertType(){return new r(this.#e)}$asTuple(){return new ce(this.toOperationNode())}$asScalar(){return new ce(this.toOperationNode())}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile();return(await this.#e.executor.executeQuery(e)).rows}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=Tr){let t=await this.executeTakeFirst();if(t===void 0)throw bi(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),i=this.#e.executor.stream(t,e);for await(let s of i)yield*s.rows}async explain(e,t){return await new r({...this.#e,queryNode:I.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}};a6=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}get isAliasedSelectQueryBuilder(){return!0}toOperationNode(){return rt.create(this.#e.toOperationNode(),W.create(this.#t))}}});var vi,rm=g(()=>{"use strict";x();kc();Cc();vi=u({is(r){return r.kind==="AggregateFunctionNode"},create(r,e=[]){return u({kind:"AggregateFunctionNode",func:r,aggregated:e})},cloneWithDistinct(r){return u({...r,distinct:!0})},cloneWithOrderBy(r,e,t=!1){let i=t?"withinGroup":"orderBy";return u({...r,[i]:r[i]?zi.cloneWithItems(r[i],e):zi.create(e)})},cloneWithFilter(r,e){return u({...r,filter:r.filter?bt.cloneWithOperation(r.filter,"And",e):bt.create(e)})},cloneWithOrFilter(r,e){return u({...r,filter:r.filter?bt.cloneWithOperation(r.filter,"Or",e):bt.create(e)})},cloneWithOver(r,e){return u({...r,over:e})}})});var o6,l6=g(()=>{"use strict";x();o6=u({is(r){return r.kind==="FunctionNode"},create(r,e){return u({kind:"FunctionNode",func:r,arguments:e})}})});var co,c6,d6=g(()=>{"use strict";x();rm();Wr();ge();ju();ar();On();Vr();co=class r{#e;constructor(e){this.#e=u(e)}get expressionType(){}as(e){return new c6(this,e)}distinct(){return new r({...this.#e,aggregateFunctionNode:vi.cloneWithDistinct(this.#e.aggregateFunctionNode)})}orderBy(...e){return new r({...this.#e,aggregateFunctionNode:I.cloneWithOrderByItems(this.#e.aggregateFunctionNode,nr(e))})}clearOrderBy(){return new r({...this.#e,aggregateFunctionNode:I.cloneWithoutOrderBy(this.#e.aggregateFunctionNode)})}withinGroupOrderBy(...e){return new r({...this.#e,aggregateFunctionNode:vi.cloneWithOrderBy(this.#e.aggregateFunctionNode,nr(e),!0)})}filterWhere(...e){return new r({...this.#e,aggregateFunctionNode:vi.cloneWithFilter(this.#e.aggregateFunctionNode,ye(e))})}filterWhereRef(e,t,i){return new r({...this.#e,aggregateFunctionNode:vi.cloneWithFilter(this.#e.aggregateFunctionNode,it(e,t,i))})}over(e){let t=f8();return new r({...this.#e,aggregateFunctionNode:vi.cloneWithOver(this.#e.aggregateFunctionNode,(e?e(t):t).toOperationNode())})}$call(e){return e(this)}$castTo(){return new r(this.#e)}$notNull(){return new r(this.#e)}toOperationNode(){return this.#e.aggregateFunctionNode}},c6=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return rt.create(this.#e.toOperationNode(),W.create(this.#t))}}});function im(){let r=(t,i)=>new ce(o6.create(t,Wi(i??[]))),e=(t,i)=>new co({aggregateFunctionNode:vi.create(t,i?Wi(i):void 0)});return Object.assign(r,{agg:e,avg(t){return e("avg",[t])},coalesce(...t){return r("coalesce",t)},count(t){return e("count",[t])},countAll(t){return new co({aggregateFunctionNode:vi.create("count",nt(t))})},max(t){return e("max",[t])},min(t){return e("min",[t])},sum(t){return e("sum",[t])},any(t){return r("any",[t])},jsonAgg(t){return new co({aggregateFunctionNode:vi.create("json_agg",[Se(t)?ae(t):t.toOperationNode()])})},toJson(t){return new ce(o6.create("to_json",[Se(t)?ae(t):t.toOperationNode()]))}})}var sm=g(()=>{"use strict";lo();rm();l6();yt();ks();d6();x();vt()});var _8,p6=g(()=>{"use strict";x();_8=u({is(r){return r.kind==="UnaryOperationNode"},create(r,e){return u({kind:"UnaryOperationNode",operator:r,operand:e})}})});function E8(r,e){return _8.create(sr.create(r),wt(e))}var N8=g(()=>{"use strict";Pn();p6();yt()});var or,Bc=g(()=>{"use strict";x();Ka();or=u({is(r){return r.kind==="CaseNode"},create(r){return u({kind:"CaseNode",value:r})},cloneWithWhen(r,e){return u({...r,when:u(r.when?[...r.when,e]:[e])})},cloneWithThen(r,e){return u({...r,when:r.when?u([...r.when.slice(0,-1),Ui.cloneWithResult(r.when[r.when.length-1],e)]):void 0})},cloneWith(r,e){return u({...r,...e})}})});var po,nm,u6,m6,am=g(()=>{"use strict";lo();x();Bc();Ka();ar();gi();po=class{#e;constructor(e){this.#e=u(e)}when(...e){return new nm({...this.#e,node:or.cloneWithWhen(this.#e.node,Ui.create(ye(e)))})}},nm=class{#e;constructor(e){this.#e=u(e)}then(e){return new u6({...this.#e,node:or.cloneWithThen(this.#e.node,Eu(e)?Nc(e):he(e))})}},u6=class{#e;constructor(e){this.#e=u(e)}when(...e){return new nm({...this.#e,node:or.cloneWithWhen(this.#e.node,Ui.create(ye(e)))})}else(e){return new m6({...this.#e,node:or.cloneWith(this.#e.node,{else:Eu(e)?Nc(e):he(e)})})}end(){return new ce(or.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new ce(or.cloneWith(this.#e.node,{isStatement:!0}))}},m6=class{#e;constructor(e){this.#e=u(e)}end(){return new ce(or.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new ce(or.cloneWith(this.#e.node,{isStatement:!0}))}}});var h6,f6=g(()=>{"use strict";x();h6=u({is(r){return r.kind==="JSONPathLegNode"},create(r,e){return u({kind:"JSONPathLegNode",type:r,value:e})}})});var uo,om,g6,y6=g(()=>{"use strict";Wr();ge();xu();f6();Ec();vu();Ht();fi();uo=class{#e;constructor(e){this.#e=e}at(e){return this.#t("ArrayLocation",e)}key(e){return this.#t("Member",e)}#t(e,t){return za.is(this.#e)?new om(za.cloneWithTraversal(this.#e,As.is(this.#e.traversal)?As.cloneWithLeg(this.#e.traversal,h6.create(e,t)):Su.cloneWithValue(this.#e.traversal,Qe.createImmediate(t)))):new om(As.cloneWithLeg(this.#e,h6.create(e,t)))}},om=class r extends uo{#e;constructor(e){super(e),this.#e=e}get expressionType(){}as(e){return new g6(this,e)}$castTo(){return new r(this.#e)}$notNull(){return new r(this.#e)}toOperationNode(){return this.#e}},g6=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return rt.create(this.#e.toOperationNode(),we(this.#t)?this.#t.toOperationNode():W.create(this.#t))}}});var w6,b6=g(()=>{"use strict";x();w6=u({is(r){return r.kind==="TupleNode"},create(r){return u({kind:"TupleNode",values:u(r)})}})});function A8(r){return!!(XA.includes(r)||YA.some(e=>e.test(r)))}var XA,YA,C8,v6=g(()=>{"use strict";x();XA=["varchar","char","text","integer","int2","int4","int8","smallint","bigint","boolean","real","double precision","float4","float8","decimal","numeric","binary","bytea","date","datetime","time","timetz","timestamp","timestamptz","serial","bigserial","uuid","json","jsonb","blob","varbinary","int4range","int4multirange","int8range","int8multirange","numrange","nummultirange","tsrange","tsmultirange","tstzrange","tstzmultirange","daterange","datemultirange","text[]","varchar[]","char[]","integer[]","int2[]","int4[]","int8[]","smallint[]","bigint[]","boolean[]","real[]","double precision[]","float4[]","float8[]","decimal[]","numeric[]","date[]","timestamp[]","timestamptz[]","uuid[]","json[]","jsonb[]","tsvector","tsquery"],YA=[/^varchar\(\d+\)$/,/^char\(\d+\)$/,/^decimal\(\d+, \d+\)$/,/^numeric\(\d+, \d+\)$/,/^binary\(\d+\)$/,/^datetime\(\d+\)$/,/^time\(\d+\)$/,/^timetz\(\d+\)$/,/^timestamp\(\d+\)$/,/^timestamptz\(\d+\)$/,/^varbinary\(\d+\)$/],C8=u({is(r){return r.kind==="DataTypeNode"},create(r){return u({kind:"DataTypeNode",dataType:r})}})});function Kr(r){if(we(r))return r.toOperationNode();if(A8(r))return C8.create(r);throw new Error(`invalid column data type ${JSON.stringify(r)}`)}var Wc=g(()=>{"use strict";v6();Ht()});var R8,S6=g(()=>{"use strict";x();R8=u({is(r){return r.kind==="CastNode"},create(r,e){return u({kind:"CastNode",expression:r,dataType:e})}})});function tm(r=Os){function e(s,n,a){return new ce(Nu(s,n,a))}function t(s,n){return new ce(E8(s,n))}let i=Object.assign(e,{fn:void 0,eb:void 0,selectFrom(s){return Lc({queryId:ee(),executor:r,queryNode:ue.createFrom(Gr(s))})},case(s){return new po({node:or.create(rr(s)?void 0:wt(s))})},ref(s,n){return rr(n)?new ce(xr(s)):new uo(F5(s,n))},jsonPath(){return new uo(As.create())},table(s){return new ce(ae(s))},val(s){return new ce(he(s))},refTuple(...s){return new ce(w6.create(s.map(wt)))},tuple(...s){return new ce(w6.create(s.map(he)))},lit(s){return new ce(Nc(s))},unary:t,not(s){return t("not",s)},exists(s){return t("exists",s)},neg(s){return t("-",s)},between(s,n,a){return new ce(Cs.create(wt(s),sr.create("between"),Qt.create(he(n),he(a))))},betweenSymmetric(s,n,a){return new ce(Cs.create(wt(s),sr.create("between symmetric"),Qt.create(he(n),he(a))))},and(s){return Ct(s)?new ce(Ha(s,"and")):new ce(o2(s,"and"))},or(s){return Ct(s)?new ce(Ha(s,"or")):new ce(o2(s,"or"))},parens(...s){let n=ye(s);return yi.is(n)?new ce(n):new ce(yi.create(n))},cast(s,n){return new ce(R8.create(wt(s),Kr(n)))},withSchema(s){return tm(r.withPluginAtFront(new _r(s)))}});return i.fn=im(),i.eb=i,i}function Hr(r){return tm()}var Fn=g(()=>{"use strict";Yu();Qa();vt();io();Ps();sm();yt();ar();Va();lo();Pn();N8();gi();ao();am();Bc();x();y6();hu();Ns();b6();Ec();Wc();S6()});function Gt(r){if(we(r))return r.toOperationNode();if(fe(r))return r(Hr()).toOperationNode();throw new Error(`invalid expression: ${JSON.stringify(r)}`)}function Iu(r){if(we(r))return r.toOperationNode();if(fe(r))return r(Hr()).toOperationNode();throw new Error(`invalid aliased expression: ${JSON.stringify(r)}`)}function Bi(r){return I5(r)||P5(r)||fe(r)}var jr=g(()=>{"use strict";Kg();Ht();Fn();x()});function M8(r){return gt(r)&&we(r)&&Se(r.table)&&Se(r.alias)}var lm,x6,cm=g(()=>{"use strict";Wr();ge();Ht();vt();x();lm=class{#e;get table(){return this.#e}constructor(e){this.#e=e}as(e){return new x6(this.#e,e)}},x6=class{#e;#t;get table(){return this.#e}get alias(){return this.#t}constructor(e,t){this.#e=e,this.#t=t}toOperationNode(){return rt.create(ae(this.#e),W.create(this.#t))}}});function Gr(r){return Ct(r)?r.map(e=>Bn(e)):[Bn(r)]}function Bn(r){return Se(r)?Z2(r):M8(r)?r.toOperationNode():Iu(r)}function Z2(r){let e=" as ";if(r.includes(e)){let[t,i]=r.split(e).map(k8);return rt.create(ae(t),W.create(i))}else return ae(r)}function ae(r){if(r.includes(".")){let[t,i]=r.split(".").map(k8);return ir.createWithSchema(t,i)}else return ir.create(r)}function k8(r){return r.trim()}var vt=g(()=>{"use strict";x();Wr();La();jr();ge();cm()});var T6,_6=g(()=>{"use strict";x();T6=u({is(r){return r.kind==="AddColumnNode"},create(r){return u({kind:"AddColumnNode",column:r})}})});var be,zc=g(()=>{"use strict";x();Mt();be=u({is(r){return r.kind==="ColumnDefinitionNode"},create(r,e){return u({kind:"ColumnDefinitionNode",column:ie.create(r),dataType:e})},cloneWithFrontModifier(r,e){return u({...r,frontModifiers:r.frontModifiers?u([...r.frontModifiers,e]):[e]})},cloneWithEndModifier(r,e){return u({...r,endModifiers:r.endModifiers?u([...r.endModifiers,e]):[e]})},cloneWith(r,e){return u({...r,...e})}})});var E6,N6=g(()=>{"use strict";x();Mt();E6=u({is(r){return r.kind==="DropColumnNode"},create(r){return u({kind:"DropColumnNode",column:ie.create(r)})}})});var C6,A6=g(()=>{"use strict";x();Mt();C6=u({is(r){return r.kind==="RenameColumnNode"},create(r,e){return u({kind:"RenameColumnNode",column:ie.create(r),renameTo:ie.create(e)})}})});var mo,Uc=g(()=>{"use strict";x();ge();mo=u({is(r){return r.kind==="CheckConstraintNode"},create(r,e){return u({kind:"CheckConstraintNode",expression:r,name:e?W.create(e):void 0})}})});var I8,ho,jc=g(()=>{"use strict";x();I8=["no action","restrict","cascade","set null","set default"],ho=u({is(r){return r.kind==="ReferencesNode"},create(r,e){return u({kind:"ReferencesNode",table:r,columns:u([...e])})},cloneWithOnDelete(r,e){return u({...r,onDelete:e})},cloneWithOnUpdate(r,e){return u({...r,onUpdate:e})}})});function dm(r){return we(r)?r.toOperationNode():Qe.createImmediate(r)}var R6=g(()=>{"use strict";Ht();fi()});var Vc,M6=g(()=>{"use strict";x();Vc=u({is(r){return r.kind==="GeneratedNode"},create(r){return u({kind:"GeneratedNode",...r})},createWithExpression(r){return u({kind:"GeneratedNode",always:!0,expression:r})},cloneWith(r,e){return u({...r,...e})}})});var P8,k6=g(()=>{"use strict";x();P8=u({is(r){return r.kind==="DefaultValueNode"},create(r){return u({kind:"DefaultValueNode",defaultValue:r})}})});function fo(r){if(I8.includes(r))return r;throw new Error(`invalid OnModifyForeignAction ${r}`)}var I6=g(()=>{"use strict";jc()});var ji,pm=g(()=>{"use strict";Uc();jc();Tc();yt();zc();R6();M6();k6();I6();ji=class r{#e;constructor(e){this.#e=e}autoIncrement(){return new r(be.cloneWith(this.#e,{autoIncrement:!0}))}identity(){return new r(be.cloneWith(this.#e,{identity:!0}))}primaryKey(){return new r(be.cloneWith(this.#e,{primaryKey:!0}))}references(e){let t=xr(e);if(!t.table||Ba.is(t.column))throw new Error(`invalid call references('${e}'). The reference must have format table.column or schema.table.column`);return new r(be.cloneWith(this.#e,{references:ho.create(t.table,[t.column])}))}onDelete(e){if(!this.#e.references)throw new Error("on delete constraint can only be added for foreign keys");return new r(be.cloneWith(this.#e,{references:ho.cloneWithOnDelete(this.#e.references,fo(e))}))}onUpdate(e){if(!this.#e.references)throw new Error("on update constraint can only be added for foreign keys");return new r(be.cloneWith(this.#e,{references:ho.cloneWithOnUpdate(this.#e.references,fo(e))}))}unique(){return new r(be.cloneWith(this.#e,{unique:!0}))}notNull(){return new r(be.cloneWith(this.#e,{notNull:!0}))}unsigned(){return new r(be.cloneWith(this.#e,{unsigned:!0}))}defaultTo(e){return new r(be.cloneWith(this.#e,{defaultTo:P8.create(dm(e))}))}check(e){return new r(be.cloneWith(this.#e,{check:mo.create(e.toOperationNode())}))}generatedAlwaysAs(e){return new r(be.cloneWith(this.#e,{generated:Vc.createWithExpression(e.toOperationNode())}))}generatedAlwaysAsIdentity(){return new r(be.cloneWith(this.#e,{generated:Vc.create({identity:!0,always:!0})}))}generatedByDefaultAsIdentity(){return new r(be.cloneWith(this.#e,{generated:Vc.create({identity:!0,byDefault:!0})}))}stored(){if(!this.#e.generated)throw new Error("stored() can only be called after generatedAlwaysAs");return new r(be.cloneWith(this.#e,{generated:Vc.cloneWith(this.#e.generated,{stored:!0})}))}modifyFront(e){return new r(be.cloneWithFrontModifier(this.#e,e.toOperationNode()))}nullsNotDistinct(){return new r(be.cloneWith(this.#e,{nullsNotDistinct:!0}))}ifNotExists(){return new r(be.cloneWith(this.#e,{ifNotExists:!0}))}modifyEnd(e){return new r(be.cloneWithEndModifier(this.#e,e.toOperationNode()))}$call(e){return e(this)}toOperationNode(){return this.#e}}});var P6,O6=g(()=>{"use strict";x();P6=u({is(r){return r.kind==="ModifyColumnNode"},create(r){return u({kind:"ModifyColumnNode",column:r})}})});var Jr,Hc=g(()=>{"use strict";x();ge();jc();Jr=u({is(r){return r.kind==="ForeignKeyConstraintNode"},create(r,e,t,i){return u({kind:"ForeignKeyConstraintNode",columns:r,references:ho.create(e,t),name:i?W.create(i):void 0})},cloneWith(r,e){return u({...r,...e})}})});var go,um=g(()=>{"use strict";Hc();I6();go=class r{#e;constructor(e){this.#e=e}onDelete(e){return new r(Jr.cloneWith(this.#e,{onDelete:fo(e)}))}onUpdate(e){return new r(Jr.cloneWith(this.#e,{onUpdate:fo(e)}))}deferrable(){return new r(Jr.cloneWith(this.#e,{deferrable:!0}))}notDeferrable(){return new r(Jr.cloneWith(this.#e,{deferrable:!1}))}initiallyDeferred(){return new r(Jr.cloneWith(this.#e,{initiallyDeferred:!0}))}initiallyImmediate(){return new r(Jr.cloneWith(this.#e,{initiallyDeferred:!1}))}$call(e){return e(this)}toOperationNode(){return this.#e}}});var yo,mm=g(()=>{"use strict";x();yo=u({is(r){return r.kind==="AddConstraintNode"},create(r){return u({kind:"AddConstraintNode",constraint:r})}})});var Si,Qc=g(()=>{"use strict";x();Mt();ge();Si=u({is(r){return r.kind==="UniqueConstraintNode"},create(r,e,t){return u({kind:"UniqueConstraintNode",columns:u(r.map(ie.create)),name:e?W.create(e):void 0,nullsNotDistinct:t})},cloneWith(r,e){return u({...r,...e})}})});var wo,hm=g(()=>{"use strict";x();ge();wo=u({is(r){return r.kind==="DropConstraintNode"},create(r){return u({kind:"DropConstraintNode",constraintName:W.create(r)})},cloneWith(r,e){return u({...r,...e})}})});var bo,D6=g(()=>{"use strict";x();Mt();bo=u({is(r){return r.kind==="AlterColumnNode"},create(r,e,t){return u({kind:"AlterColumnNode",column:ie.create(r),[e]:t})}})});var Gc,zn,$6=g(()=>{"use strict";D6();Wc();R6();Gc=class{#e;constructor(e){this.#e=e}setDataType(e){return new zn(bo.create(this.#e,"dataType",Kr(e)))}setDefault(e){return new zn(bo.create(this.#e,"setDefault",dm(e)))}dropDefault(){return new zn(bo.create(this.#e,"dropDefault",!0))}setNotNull(){return new zn(bo.create(this.#e,"setNotNull",!0))}dropNotNull(){return new zn(bo.create(this.#e,"dropNotNull",!0))}$call(e){return e(this)}},zn=class{#e;constructor(e){this.#e=e}toOperationNode(){return this.#e}}});var Vi,O8=g(()=>{"use strict";x();Vi=class{#e;constructor(e){this.#e=u(e)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var fm,D8=g(()=>{"use strict";mm();Mn();x();fm=class r{#e;constructor(e){this.#e=u(e)}onDelete(e){return new r({...this.#e,constraintBuilder:this.#e.constraintBuilder.onDelete(e)})}onUpdate(e){return new r({...this.#e,constraintBuilder:this.#e.constraintBuilder.onUpdate(e)})}deferrable(){return new r({...this.#e,constraintBuilder:this.#e.constraintBuilder.deferrable()})}notDeferrable(){return new r({...this.#e,constraintBuilder:this.#e.constraintBuilder.notDeferrable()})}initiallyDeferred(){return new r({...this.#e,constraintBuilder:this.#e.constraintBuilder.initiallyDeferred()})}initiallyImmediate(){return new r({...this.#e,constraintBuilder:this.#e.constraintBuilder.initiallyImmediate()})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(ne.cloneWithTableProps(this.#e.node,{addConstraint:yo.create(this.#e.constraintBuilder.toOperationNode())}),this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var Kc,$8=g(()=>{"use strict";Mn();hm();x();Kc=class r{#e;constructor(e){this.#e=u(e)}ifExists(){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{dropConstraint:wo.cloneWith(this.#e.node.dropConstraint,{ifExists:!0})})})}cascade(){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{dropConstraint:wo.cloneWith(this.#e.node.dropConstraint,{modifier:"cascade"})})})}restrict(){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{dropConstraint:wo.cloneWith(this.#e.node.dropConstraint,{modifier:"restrict"})})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var Hi,Jc=g(()=>{"use strict";x();Mt();ge();Hi=u({is(r){return r.kind==="PrimaryKeyConstraintNode"},create(r,e){return u({kind:"PrimaryKeyConstraintNode",columns:u(r.map(ie.create)),name:e?W.create(e):void 0})},cloneWith(r,e){return u({...r,...e})}})});var $s,gm=g(()=>{"use strict";x();ge();$s=u({is(r){return r.kind==="AddIndexNode"},create(r){return u({kind:"AddIndexNode",name:W.create(r)})},cloneWith(r,e){return u({...r,...e})},cloneWithColumns(r,e){return u({...r,columns:[...r.columns||[],...e]})}})});var Xc,F6=g(()=>{"use strict";x();Xc=u({is(r){return r.kind==="IndexTypeNode"},create(r){return u({kind:"IndexTypeNode",indexType:r})}})});var ym,F8=g(()=>{"use strict";gm();Mn();F6();yt();x();ym=class r{#e;constructor(e){this.#e=u(e)}unique(){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addIndex:$s.cloneWith(this.#e.node.addIndex,{unique:!0})})})}column(e){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addIndex:$s.cloneWithColumns(this.#e.node.addIndex,[Ua(e)])})})}columns(e){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addIndex:$s.cloneWithColumns(this.#e.node.addIndex,e.map(Ua))})})}expression(e){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addIndex:$s.cloneWithColumns(this.#e.node.addIndex,[e.toOperationNode()])})})}using(e){return new r({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addIndex:$s.cloneWith(this.#e.node.addIndex,{using:Xc.create(e)})})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var vo,L6=g(()=>{"use strict";Qc();vo=class r{#e;constructor(e){this.#e=e}nullsNotDistinct(){return new r(Si.cloneWith(this.#e,{nullsNotDistinct:!0}))}deferrable(){return new r(Si.cloneWith(this.#e,{deferrable:!0}))}notDeferrable(){return new r(Si.cloneWith(this.#e,{deferrable:!1}))}initiallyDeferred(){return new r(Si.cloneWith(this.#e,{initiallyDeferred:!0}))}initiallyImmediate(){return new r(Si.cloneWith(this.#e,{initiallyDeferred:!1}))}$call(e){return e(this)}toOperationNode(){return this.#e}}});var So,q6=g(()=>{"use strict";Jc();So=class r{#e;constructor(e){this.#e=e}deferrable(){return new r(Hi.cloneWith(this.#e,{deferrable:!0}))}notDeferrable(){return new r(Hi.cloneWith(this.#e,{deferrable:!1}))}initiallyDeferred(){return new r(Hi.cloneWith(this.#e,{initiallyDeferred:!0}))}initiallyImmediate(){return new r(Hi.cloneWith(this.#e,{initiallyDeferred:!1}))}$call(e){return e(this)}toOperationNode(){return this.#e}}});var xo,B6=g(()=>{"use strict";xo=class{#e;constructor(e){this.#e=e}$call(e){return e(this)}toOperationNode(){return this.#e}}});var L8,W6=g(()=>{"use strict";x();ge();L8=u({is(r){return r.kind==="RenameConstraintNode"},create(r,e){return u({kind:"RenameConstraintNode",oldName:W.create(r),newName:W.create(e)})}})});var wm,Un,z6=g(()=>{"use strict";_6();Mn();zc();N6();ge();A6();x();pm();O6();Wc();um();mm();Qc();Uc();Hc();Mt();vt();hm();$6();O8();D8();$8();Jc();vc();gm();F8();L6();q6();B6();W6();wm=class{#e;constructor(e){this.#e=u(e)}renameTo(e){return new Vi({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{renameTo:ae(e)})})}setSchema(e){return new Vi({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{setSchema:W.create(e)})})}alterColumn(e,t){let i=t(new Gc(e));return new Un({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,i.toOperationNode())})}dropColumn(e){return new Un({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,E6.create(e))})}renameColumn(e,t){return new Un({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,C6.create(e,t))})}addColumn(e,t,i=Lt){let s=i(new ji(be.create(e,Kr(t))));return new Un({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,T6.create(s.toOperationNode()))})}modifyColumn(e,t,i=Lt){let s=i(new ji(be.create(e,Kr(t))));return new Un({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,P6.create(s.toOperationNode()))})}addUniqueConstraint(e,t,i=Lt){let s=i(new vo(Si.create(t,e)));return new Vi({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addConstraint:yo.create(s.toOperationNode())})})}addCheckConstraint(e,t,i=Lt){let s=i(new xo(mo.create(t.toOperationNode(),e)));return new Vi({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addConstraint:yo.create(s.toOperationNode())})})}addForeignKeyConstraint(e,t,i,s,n=Lt){let a=n(new go(Jr.create(t.map(ie.create),ae(i),s.map(ie.create),e)));return new fm({...this.#e,constraintBuilder:a})}addPrimaryKeyConstraint(e,t,i=Lt){let s=i(new So(Hi.create(t,e)));return new Vi({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addConstraint:yo.create(s.toOperationNode())})})}dropConstraint(e){return new Kc({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{dropConstraint:wo.create(e)})})}renameConstraint(e,t){return new Kc({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{renameConstraint:L8.create(e,t)})})}addIndex(e){return new ym({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{addIndex:$s.create(e)})})}dropIndex(e){return new Vi({...this.#e,node:ne.cloneWithTableProps(this.#e.node,{dropIndex:Es.create(e)})})}$call(e){return e(this)}},Un=class r{#e;constructor(e){this.#e=u(e)}alterColumn(e,t){let i=t(new Gc(e));return new r({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,i.toOperationNode())})}dropColumn(e){return new r({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,E6.create(e))})}renameColumn(e,t){return new r({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,C6.create(e,t))})}addColumn(e,t,i=Lt){let s=i(new ji(be.create(e,Kr(t))));return new r({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,T6.create(s.toOperationNode()))})}modifyColumn(e,t,i=Lt){let s=i(new ji(be.create(e,Kr(t))));return new r({...this.#e,node:ne.cloneWithColumnAlteration(this.#e.node,P6.create(s.toOperationNode()))})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var To,U6=g(()=>{"use strict";Vu();ja();fi();To=class extends ro{transformPrimitiveValueList(e){return Rs.create(e.values.map(Qe.createImmediate))}transformValue(e){return Qe.createImmediate(e.value)}}});var bm,j6=g(()=>{"use strict";lu();F6();yt();vt();x();ar();Vr();U6();bm=class r{#e;constructor(e){this.#e=u(e)}ifNotExists(){return new r({...this.#e,node:Br.cloneWith(this.#e.node,{ifNotExists:!0})})}unique(){return new r({...this.#e,node:Br.cloneWith(this.#e.node,{unique:!0})})}nullsNotDistinct(){return new r({...this.#e,node:Br.cloneWith(this.#e.node,{nullsNotDistinct:!0})})}on(e){return new r({...this.#e,node:Br.cloneWith(this.#e.node,{table:ae(e)})})}column(e){return new r({...this.#e,node:Br.cloneWithColumns(this.#e.node,[Ua(e)])})}columns(e){return new r({...this.#e,node:Br.cloneWithColumns(this.#e.node,e.map(Ua))})}expression(e){return new r({...this.#e,node:Br.cloneWithColumns(this.#e.node,[e.toOperationNode()])})}using(e){return new r({...this.#e,node:Br.cloneWith(this.#e.node,{using:Xc.is(e)?e:Xc.create(e)})})}where(...e){let t=new To;return new r({...this.#e,node:I.cloneWithWhere(this.#e.node,t.transformNode(ye(e),this.#e.queryId))})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var vm,V6=g(()=>{"use strict";du();x();vm=class r{#e;constructor(e){this.#e=u(e)}ifNotExists(){return new r({...this.#e,node:cu.cloneWith(this.#e.node,{ifNotExists:!0})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});function q8(r){if(k5.includes(r))return r;throw new Error(`invalid OnCommitAction ${r}`)}var B8=g(()=>{"use strict";Fa()});var Sm,H6=g(()=>{"use strict";zc();Fa();pm();x();Hc();Mt();um();Wc();Jc();Qc();Uc();vt();B8();L6();jr();q6();B6();Sm=class r{#e;constructor(e){this.#e=u(e)}temporary(){return new r({...this.#e,node:At.cloneWith(this.#e.node,{temporary:!0})})}onCommit(e){return new r({...this.#e,node:At.cloneWith(this.#e.node,{onCommit:q8(e)})})}ifNotExists(){return new r({...this.#e,node:At.cloneWith(this.#e.node,{ifNotExists:!0})})}addColumn(e,t,i=Lt){let s=i(new ji(be.create(e,Kr(t))));return new r({...this.#e,node:At.cloneWithColumn(this.#e.node,s.toOperationNode())})}addPrimaryKeyConstraint(e,t,i=Lt){let s=i(new So(Hi.create(t,e)));return new r({...this.#e,node:At.cloneWithConstraint(this.#e.node,s.toOperationNode())})}addUniqueConstraint(e,t,i=Lt){let s=i(new vo(Si.create(t,e)));return new r({...this.#e,node:At.cloneWithConstraint(this.#e.node,s.toOperationNode())})}addCheckConstraint(e,t,i=Lt){let s=i(new xo(mo.create(t.toOperationNode(),e)));return new r({...this.#e,node:At.cloneWithConstraint(this.#e.node,s.toOperationNode())})}addForeignKeyConstraint(e,t,i,s,n=Lt){let a=n(new go(Jr.create(t.map(ie.create),ae(i),s.map(ie.create),e)));return new r({...this.#e,node:At.cloneWithConstraint(this.#e.node,a.toOperationNode())})}modifyFront(e){return new r({...this.#e,node:At.cloneWithFrontModifier(this.#e.node,e.toOperationNode())})}modifyEnd(e){return new r({...this.#e,node:At.cloneWithEndModifier(this.#e.node,e.toOperationNode())})}as(e){return new r({...this.#e,node:At.cloneWith(this.#e.node,{selectQuery:Gt(e)})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var xm,Q6=g(()=>{"use strict";vc();vt();x();xm=class r{#e;constructor(e){this.#e=u(e)}on(e){return new r({...this.#e,node:Es.cloneWith(this.#e.node,{table:ae(e)})})}ifExists(){return new r({...this.#e,node:Es.cloneWith(this.#e.node,{ifExists:!0})})}cascade(){return new r({...this.#e,node:Es.cloneWith(this.#e.node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var Tm,G6=g(()=>{"use strict";pu();x();Tm=class r{#e;constructor(e){this.#e=u(e)}ifExists(){return new r({...this.#e,node:Sc.cloneWith(this.#e.node,{ifExists:!0})})}cascade(){return new r({...this.#e,node:Sc.cloneWith(this.#e.node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var _m,K6=g(()=>{"use strict";uu();x();_m=class r{#e;constructor(e){this.#e=u(e)}ifExists(){return new r({...this.#e,node:xc.cloneWith(this.#e.node,{ifExists:!0})})}cascade(){return new r({...this.#e,node:xc.cloneWith(this.#e.node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var Xr,Yc=g(()=>{"use strict";x();Li();Xr=u({is(r){return r.kind==="CreateViewNode"},create(r){return u({kind:"CreateViewNode",name:Rt.create(r)})},cloneWith(r,e){return u({...r,...e})}})});var Em,W8=g(()=>{"use strict";U6();Em=class{#e=new To;transformQuery(e){return this.#e.transformNode(e.node,e.queryId)}transformResult(e){return Promise.resolve(e.result)}}});var Nm,J6=g(()=>{"use strict";x();Yc();yt();W8();Nm=class r{#e;constructor(e){this.#e=u(e)}temporary(){return new r({...this.#e,node:Xr.cloneWith(this.#e.node,{temporary:!0})})}materialized(){return new r({...this.#e,node:Xr.cloneWith(this.#e.node,{materialized:!0})})}ifNotExists(){return new r({...this.#e,node:Xr.cloneWith(this.#e.node,{ifNotExists:!0})})}orReplace(){return new r({...this.#e,node:Xr.cloneWith(this.#e.node,{orReplace:!0})})}columns(e){return new r({...this.#e,node:Xr.cloneWith(this.#e.node,{columns:e.map(s2)})})}as(e){let t=e.withPlugin(new Em).toOperationNode();return new r({...this.#e,node:Xr.cloneWith(this.#e.node,{as:t})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var _o,Cm=g(()=>{"use strict";x();Li();_o=u({is(r){return r.kind==="DropViewNode"},create(r){return u({kind:"DropViewNode",name:Rt.create(r)})},cloneWith(r,e){return u({...r,...e})}})});var Am,X6=g(()=>{"use strict";x();Cm();Am=class r{#e;constructor(e){this.#e=u(e)}materialized(){return new r({...this.#e,node:_o.cloneWith(this.#e.node,{materialized:!0})})}ifExists(){return new r({...this.#e,node:_o.cloneWith(this.#e.node,{ifExists:!0})})}cascade(){return new r({...this.#e,node:_o.cloneWith(this.#e.node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var Rm,Mm=g(()=>{"use strict";x();ja();fi();Rm=u({is(r){return r.kind==="CreateTypeNode"},create(r){return u({kind:"CreateTypeNode",name:r})},cloneWithEnum(r,e){return u({...r,enum:Rs.create(e.map(Qe.createImmediate))})}})});var km,Y6=g(()=>{"use strict";x();Mm();km=class r{#e;constructor(e){this.#e=u(e)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}asEnum(e){return new r({...this.#e,node:Rm.cloneWithEnum(this.#e.node,e)})}$call(e){return e(this)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var Im,Pm=g(()=>{"use strict";x();Im=u({is(r){return r.kind==="DropTypeNode"},create(r){return u({kind:"DropTypeNode",name:r})},cloneWith(r,e){return u({...r,...e})}})});var Om,Z6=g(()=>{"use strict";Pm();x();Om=class r{#e;constructor(e){this.#e=u(e)}ifExists(){return new r({...this.#e,node:Im.cloneWith(this.#e.node,{ifExists:!0})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});function e4(r){if(r.includes(".")){let t=r.split(".").map(ZA);if(t.length===2)return Rt.createWithSchema(t[0],t[1]);throw new Error(`invalid schemable identifier ${r}`)}else return Rt.create(r)}function ZA(r){return r.trim()}var z8=g(()=>{"use strict";Li()});var Eo,Dm=g(()=>{"use strict";x();Li();Eo=u({is(r){return r.kind==="RefreshMaterializedViewNode"},create(r){return u({kind:"RefreshMaterializedViewNode",name:Rt.create(r)})},cloneWith(r,e){return u({...r,...e})}})});var $m,t4=g(()=>{"use strict";x();Dm();$m=class r{#e;constructor(e){this.#e=u(e)}concurrently(){return new r({...this.#e,node:Eo.cloneWith(this.#e.node,{concurrently:!0,withNoData:!1})})}withData(){return new r({...this.#e,node:Eo.cloneWith(this.#e.node,{withNoData:!1})})}withNoData(){return new r({...this.#e,node:Eo.cloneWith(this.#e.node,{withNoData:!0,concurrently:!1})})}$call(e){return e(this)}toOperationNode(){return this.#e.executor.transformQuery(this.#e.node,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){await this.#e.executor.executeQuery(this.compile())}}});var Fm,r4=g(()=>{"use strict";Mn();lu();du();Fa();vc();pu();uu();vt();z6();j6();V6();H6();Q6();G6();K6();Ps();io();J6();Yc();X6();Cm();Y6();Z6();Mm();Pm();z8();t4();Dm();Fm=class r{#e;constructor(e){this.#e=e}createTable(e){return new Sm({queryId:ee(),executor:this.#e,node:At.create(ae(e))})}dropTable(e){return new _m({queryId:ee(),executor:this.#e,node:xc.create(ae(e))})}createIndex(e){return new bm({queryId:ee(),executor:this.#e,node:Br.create(e)})}dropIndex(e){return new xm({queryId:ee(),executor:this.#e,node:Es.create(e)})}createSchema(e){return new vm({queryId:ee(),executor:this.#e,node:cu.create(e)})}dropSchema(e){return new Tm({queryId:ee(),executor:this.#e,node:Sc.create(e)})}alterTable(e){return new wm({queryId:ee(),executor:this.#e,node:ne.create(ae(e))})}createView(e){return new Nm({queryId:ee(),executor:this.#e,node:Xr.create(e)})}refreshMaterializedView(e){return new $m({queryId:ee(),executor:this.#e,node:Eo.create(e)})}dropView(e){return new Am({queryId:ee(),executor:this.#e,node:_o.create(e)})}createType(e){return new km({queryId:ee(),executor:this.#e,node:Rm.create(e4(e))})}dropType(e){return new Om({queryId:ee(),executor:this.#e,node:Im.create(e4(e))})}withPlugin(e){return new r(this.#e.withPlugin(e))}withoutPlugins(){return new r(this.#e.withoutPlugins())}withSchema(e){return new r(this.#e.withPluginAtFront(new _r(e)))}}});var Lm,i4=g(()=>{"use strict";_c();cm();kn();Lm=class{ref(e){return ou(e),new gu(e)}table(e){return au(e),new lm(e)}}});var qm,s4=g(()=>{"use strict";qm=class{#e;constructor(e){this.#e=e}async provideConnection(e){let t=await this.#e.acquireConnection();try{return await e(t)}finally{await this.#e.releaseConnection(t)}}}});var Bm,n4=g(()=>{"use strict";G2();Bm=class r extends no{#e;#t;#r;constructor(e,t,i,s=[]){super(s),this.#e=e,this.#t=t,this.#r=i}get adapter(){return this.#t}compileQuery(e,t){return this.#e.compileQuery(e,t)}provideConnection(e){return this.#r.provideConnection(e)}withPlugins(e){return new r(this.#e,this.#t,this.#r,[...this.plugins,...e])}withPlugin(e){return new r(this.#e,this.#t,this.#r,[...this.plugins,e])}withPluginAtFront(e){return new r(this.#e,this.#t,this.#r,[e,...this.plugins])}withConnectionProvider(e){return new r(this.#e,this.#t,e,[...this.plugins])}withoutPlugins(){return new r(this.#e,this.#t,this.#r,[])}}});function Wm(){return typeof performance<"u"&&fe(performance.now)?performance.now():Date.now()}var U8=g(()=>{"use strict";x()});var zm,j8=g(()=>{"use strict";U8();zm=class{#e;#t;#r;#i;#s;#m=new WeakSet;constructor(e,t){this.#i=!1,this.#e=e,this.#t=t}async init(){if(this.#s)throw new Error("driver has already been destroyed");this.#r||(this.#r=this.#e.init().then(()=>{this.#i=!0}).catch(e=>(this.#r=void 0,Promise.reject(e)))),await this.#r}async acquireConnection(){if(this.#s)throw new Error("driver has already been destroyed");this.#i||await this.init();let e=await this.#e.acquireConnection();return this.#m.has(e)||(this.#u()&&this.#o(e),this.#m.add(e)),e}async releaseConnection(e){await this.#e.releaseConnection(e)}beginTransaction(e,t){return this.#e.beginTransaction(e,t)}commitTransaction(e){return this.#e.commitTransaction(e)}rollbackTransaction(e){return this.#e.rollbackTransaction(e)}savepoint(e,t,i){if(this.#e.savepoint)return this.#e.savepoint(e,t,i);throw new Error("The `savepoint` method is not supported by this driver")}rollbackToSavepoint(e,t,i){if(this.#e.rollbackToSavepoint)return this.#e.rollbackToSavepoint(e,t,i);throw new Error("The `rollbackToSavepoint` method is not supported by this driver")}releaseSavepoint(e,t,i){if(this.#e.releaseSavepoint)return this.#e.releaseSavepoint(e,t,i);throw new Error("The `releaseSavepoint` method is not supported by this driver")}async destroy(){this.#r&&(await this.#r,this.#s||(this.#s=this.#e.destroy().catch(e=>(this.#s=void 0,Promise.reject(e)))),await this.#s)}#u(){return this.#t.isLevelEnabled("query")||this.#t.isLevelEnabled("error")}#o(e){let t=e.executeQuery,i=e.streamQuery,s=this;e.executeQuery=async n=>{let a,o=Wm();try{return await t.call(e,n)}catch(l){throw a=l,await s.#c(l,n,o),l}finally{a||await s.#l(n,o)}},e.streamQuery=async function*(n,a){let o,l=Wm();try{for await(let c of i.call(e,n,a))yield c}catch(c){throw o=c,await s.#c(c,n,l),c}finally{o||await s.#l(n,l,!0)}}}async#c(e,t,i){await this.#t.error(()=>({level:"error",error:e,query:t,queryDurationMillis:this.#d(i)}))}async#l(e,t,i=!1){await this.#t.query(()=>({level:"query",isStream:i,query:e,queryDurationMillis:this.#d(t)}))}#d(e){return Wm()-e}}});var eR,No,a4=g(()=>{"use strict";eR=()=>{},No=class{#e;#t;constructor(e){this.#e=e}async provideConnection(e){for(;this.#t;)await this.#t.catch(eR);return this.#t=this.#r(e).finally(()=>{this.#t=void 0}),this.#t}async#r(e){return await e(this.#e)}}});function o4(r){if(r.accessMode&&!tR.includes(r.accessMode))throw new Error(`invalid transaction access mode ${r.accessMode}`);if(r.isolationLevel&&!rR.includes(r.isolationLevel))throw new Error(`invalid transaction isolation level ${r.isolationLevel}`)}var tR,rR,l4=g(()=>{"use strict";tR=["read only","read write"],rR=["read uncommitted","read committed","repeatable read","serializable","snapshot"]});function iR(r){if(r.level==="query"){let e=`kysely:query:${r.isStream?"stream:":""}`;console.log(`${e} ${r.query.sql}`),console.log(`${e} duration: ${r.queryDurationMillis.toFixed(1)}ms`)}else r.level==="error"&&(r.error instanceof Error?console.error(`kysely:error: ${r.error.stack??r.error.message}`):console.error(`kysely:error: ${JSON.stringify({error:r.error,query:r.query.sql,queryDurationMillis:r.queryDurationMillis})}`))}var $Z,Um,c4=g(()=>{"use strict";x();$Z=u(["query","error"]),Um=class{#e;#t;constructor(e){fe(e)?(this.#t=e,this.#e=u({query:!0,error:!0})):(this.#t=iR,this.#e=u({query:e.includes("query"),error:e.includes("error")}))}isLevelEnabled(e){return this.#e[e]}async query(e){this.#e.query&&await this.#t(e())}async error(e){this.#e.error&&await this.#t(e())}}});function V8(r){return gt(r)&&fe(r.compile)}var d4=g(()=>{"use strict";x()});function sR(r){return gt(r)&&gt(r.config)&&gt(r.driver)&&gt(r.executor)&&gt(r.dialect)}function Vn(r){if(r.isCommitted)throw new Error("Transaction is already committed");if(r.isRolledBack)throw new Error("Transaction is already rolled back")}var Co,jm,p4,u4,m4,h4,jn,f4,g4=g(()=>{"use strict";r4();i4();s4();Xu();n4();x();j8();a4();l4();sm();c4();Ps();d4();am();Bc();jr();io();Q2();Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");Co=class r extends oo{#e;constructor(e){let t,i;if(sR(e))t={executor:e.executor},i={...e};else{let s=e.dialect,n=s.createDriver(),a=s.createQueryCompiler(),o=s.createAdapter(),l=new Um(e.log??[]),c=new zm(n,l),d=new qm(c),p=new Bm(a,o,d,e.plugins??[]);t={executor:p},i={config:e,executor:p,dialect:s,driver:c}}super(t),this.#e=u(i)}get schema(){return new Fm(this.#e.executor)}get dynamic(){return new Lm}get introspection(){return this.#e.dialect.createIntrospector(this.withoutPlugins())}case(e){return new po({node:or.create(rr(e)?void 0:Gt(e))})}get fn(){return im()}transaction(){return new u4({...this.#e})}startTransaction(){return new m4({...this.#e})}connection(){return new p4({...this.#e})}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}withoutPlugins(){return new r({...this.#e,executor:this.#e.executor.withoutPlugins()})}withSchema(e){return new r({...this.#e,executor:this.#e.executor.withPluginAtFront(new _r(e))})}withTables(){return new r({...this.#e})}async destroy(){await this.#e.driver.destroy()}get isTransaction(){return!1}getExecutor(){return this.#e.executor}executeQuery(e){let t=V8(e)?e.compile():e;return this.getExecutor().executeQuery(t)}async[Symbol.asyncDispose](){await this.destroy()}},jm=class r extends Co{#e;constructor(e){super(e),this.#e=e}get isTransaction(){return!0}transaction(){throw new Error("calling the transaction method for a Transaction is not supported")}connection(){throw new Error("calling the connection method for a Transaction is not supported")}async destroy(){throw new Error("calling the destroy method for a Transaction is not supported")}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}withoutPlugins(){return new r({...this.#e,executor:this.#e.executor.withoutPlugins()})}withSchema(e){return new r({...this.#e,executor:this.#e.executor.withPluginAtFront(new _r(e))})}withTables(){return new r({...this.#e})}};p4=class{#e;constructor(e){this.#e=u(e)}async execute(e){return this.#e.executor.provideConnection(async t=>{let i=this.#e.executor.withConnectionProvider(new No(t)),s=new Co({...this.#e,executor:i});return await e(s)})}},u4=class r{#e;constructor(e){this.#e=u(e)}setAccessMode(e){return new r({...this.#e,accessMode:e})}setIsolationLevel(e){return new r({...this.#e,isolationLevel:e})}async execute(e){let{isolationLevel:t,accessMode:i,...s}=this.#e,n={isolationLevel:t,accessMode:i};return o4(n),this.#e.executor.provideConnection(async a=>{let o=this.#e.executor.withConnectionProvider(new No(a)),l=new jm({...s,executor:o}),c=!1;try{await this.#e.driver.beginTransaction(a,n),c=!0;let d=await e(l);return await this.#e.driver.commitTransaction(a),d}catch(d){throw c&&await this.#e.driver.rollbackTransaction(a),d}})}},m4=class r{#e;constructor(e){this.#e=u(e)}setAccessMode(e){return new r({...this.#e,accessMode:e})}setIsolationLevel(e){return new r({...this.#e,isolationLevel:e})}async execute(){let{isolationLevel:e,accessMode:t,...i}=this.#e,s={isolationLevel:e,accessMode:t};o4(s);let n=await Qu(this.#e.executor);return await this.#e.driver.beginTransaction(n.connection,s),new h4({...i,connection:n,executor:this.#e.executor.withConnectionProvider(new No(n.connection))})}},h4=class r extends jm{#e;#t;#r;constructor(e){let t={isCommitted:!1,isRolledBack:!1};e={...e,executor:new f4(e.executor,t)};let{connection:i,...s}=e;super(s),this.#e=u(e),this.#r=t;let n=ee();this.#t=a=>e.executor.compileQuery(a,n)}get isCommitted(){return this.#r.isCommitted}get isRolledBack(){return this.#r.isRolledBack}commit(){return Vn(this.#r),new jn(async()=>{await this.#e.driver.commitTransaction(this.#e.connection.connection),this.#r.isCommitted=!0,this.#e.connection.release()})}rollback(){return Vn(this.#r),new jn(async()=>{await this.#e.driver.rollbackTransaction(this.#e.connection.connection),this.#r.isRolledBack=!0,this.#e.connection.release()})}savepoint(e){return Vn(this.#r),new jn(async()=>(await this.#e.driver.savepoint?.(this.#e.connection.connection,e,this.#t),new r({...this.#e})))}rollbackToSavepoint(e){return Vn(this.#r),new jn(async()=>(await this.#e.driver.rollbackToSavepoint?.(this.#e.connection.connection,e,this.#t),new r({...this.#e})))}releaseSavepoint(e){return Vn(this.#r),new jn(async()=>(await this.#e.driver.releaseSavepoint?.(this.#e.connection.connection,e,this.#t),new r({...this.#e})))}withPlugin(e){return new r({...this.#e,executor:this.#e.executor.withPlugin(e)})}withoutPlugins(){return new r({...this.#e,executor:this.#e.executor.withoutPlugins()})}withSchema(e){return new r({...this.#e,executor:this.#e.executor.withPluginAtFront(new _r(e))})}withTables(){return new r({...this.#e})}},jn=class{#e;constructor(e){this.#e=e}async execute(){return await this.#e()}};f4=class r{#e;#t;constructor(e,t){e instanceof r?this.#e=e.#e:this.#e=e,this.#t=t}get adapter(){return this.#e.adapter}get plugins(){return this.#e.plugins}transformQuery(e,t){return this.#e.transformQuery(e,t)}compileQuery(e,t){return this.#e.compileQuery(e,t)}provideConnection(e){return this.#e.provideConnection(e)}executeQuery(e){return Vn(this.#t),this.#e.executeQuery(e)}stream(e,t){return Vn(this.#t),this.#e.stream(e,t)}withConnectionProvider(e){return new r(this.#e.withConnectionProvider(e),this.#t)}withPlugin(e){return new r(this.#e.withPlugin(e),this.#t)}withPlugins(e){return new r(this.#e.withPlugins(e),this.#t)}withPluginAtFront(e){return new r(this.#e.withPluginAtFront(e),this.#t)}withoutPlugins(){return new r(this.#e.withoutPlugins(),this.#t)}}});var H8=g(()=>{"use strict"});var Q8=g(()=>{"use strict"});var G8=g(()=>{"use strict"});var K8=g(()=>{"use strict"});var J8=g(()=>{"use strict"});function Qi(r){return new y4(r)}var y4,w4,b4=g(()=>{"use strict";Wr();x();ao();ge();Ht();y4=class r{#e;constructor(e){this.#e=u(e)}get expressionType(){}get isRawBuilder(){return!0}as(e){return new w4(this,e)}$castTo(){return new r({...this.#e})}$notNull(){return new r(this.#e)}withPlugin(e){return new r({...this.#e,plugins:this.#e.plugins!==void 0?u([...this.#e.plugins,e]):u([e])})}toOperationNode(){return this.#r(this.#t())}compile(e){return this.#i(this.#t(e))}async execute(e){let t=this.#t(e);return t.executeQuery(this.#i(t))}#t(e){let t=e!==void 0?e.getExecutor():Os;return this.#e.plugins!==void 0?t.withPlugins(this.#e.plugins):t}#r(e){return e.transformQuery(this.#e.rawNode,this.#e.queryId)}#i(e){return e.compileQuery(this.#r(e),this.#e.queryId)}};w4=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}get rawBuilder(){return this.#e}toOperationNode(){return rt.create(this.#e.toOperationNode(),we(this.#t)?this.#t.toOperationNode():W.create(this.#t))}}});function X8(r){return we(r)?r.toOperationNode():he(r)}var C,at=g(()=>{"use strict";ge();Ht();qi();fi();yt();vt();gi();Ps();b4();kn();C=Object.assign((r,...e)=>Qi({queryId:ee(),rawNode:xe.create(r,e?.map(X8)??[])}),{ref(r){return ou(r),Qi({queryId:ee(),rawNode:xe.createWithChild(xr(r))})},val(r){return Qi({queryId:ee(),rawNode:xe.createWithChild(he(r))})},value(r){return this.val(r)},table(r){return au(r),Qi({queryId:ee(),rawNode:xe.createWithChild(ae(r))})},id(...r){r.forEach((t,i)=>{He(t,`identifier[${i}]`)});let e=new Array(r.length+1).fill(".");return e[0]="",e[e.length-1]="",Qi({queryId:ee(),rawNode:xe.create(e,r.map(W.create))})},lit(r){return Qi({queryId:ee(),rawNode:xe.createWithChild(Qe.createImmediate(r))})},literal(r){return this.lit(r)},raw(r){return Qi({queryId:ee(),rawNode:xe.createWithSql(r)})},join(r,e=C`, `){let t=new Array(Math.max(2*r.length-1,0)),i=e.toOperationNode();for(let s=0;s<r.length;++s)t[2*s]=X8(r[s]),s!==r.length-1&&(t[2*s+1]=i);return Qi({queryId:ee(),rawNode:xe.createWithChildren(t)})}})});var Y8=g(()=>{"use strict"});var Z8=g(()=>{"use strict"});var Vm,v4=g(()=>{"use strict";x();Vm=class{nodeStack=[];get parentNode(){return this.nodeStack[this.nodeStack.length-2]}#e=u({AliasNode:this.visitAlias.bind(this),ColumnNode:this.visitColumn.bind(this),IdentifierNode:this.visitIdentifier.bind(this),SchemableIdentifierNode:this.visitSchemableIdentifier.bind(this),RawNode:this.visitRaw.bind(this),ReferenceNode:this.visitReference.bind(this),SelectQueryNode:this.visitSelectQuery.bind(this),SelectionNode:this.visitSelection.bind(this),TableNode:this.visitTable.bind(this),FromNode:this.visitFrom.bind(this),SelectAllNode:this.visitSelectAll.bind(this),AndNode:this.visitAnd.bind(this),OrNode:this.visitOr.bind(this),ValueNode:this.visitValue.bind(this),ValueListNode:this.visitValueList.bind(this),PrimitiveValueListNode:this.visitPrimitiveValueList.bind(this),ParensNode:this.visitParens.bind(this),JoinNode:this.visitJoin.bind(this),OperatorNode:this.visitOperator.bind(this),WhereNode:this.visitWhere.bind(this),InsertQueryNode:this.visitInsertQuery.bind(this),DeleteQueryNode:this.visitDeleteQuery.bind(this),ReturningNode:this.visitReturning.bind(this),CreateTableNode:this.visitCreateTable.bind(this),AddColumnNode:this.visitAddColumn.bind(this),ColumnDefinitionNode:this.visitColumnDefinition.bind(this),DropTableNode:this.visitDropTable.bind(this),DataTypeNode:this.visitDataType.bind(this),OrderByNode:this.visitOrderBy.bind(this),OrderByItemNode:this.visitOrderByItem.bind(this),GroupByNode:this.visitGroupBy.bind(this),GroupByItemNode:this.visitGroupByItem.bind(this),UpdateQueryNode:this.visitUpdateQuery.bind(this),ColumnUpdateNode:this.visitColumnUpdate.bind(this),LimitNode:this.visitLimit.bind(this),OffsetNode:this.visitOffset.bind(this),OnConflictNode:this.visitOnConflict.bind(this),OnDuplicateKeyNode:this.visitOnDuplicateKey.bind(this),CreateIndexNode:this.visitCreateIndex.bind(this),DropIndexNode:this.visitDropIndex.bind(this),ListNode:this.visitList.bind(this),PrimaryKeyConstraintNode:this.visitPrimaryKeyConstraint.bind(this),UniqueConstraintNode:this.visitUniqueConstraint.bind(this),ReferencesNode:this.visitReferences.bind(this),CheckConstraintNode:this.visitCheckConstraint.bind(this),WithNode:this.visitWith.bind(this),CommonTableExpressionNode:this.visitCommonTableExpression.bind(this),CommonTableExpressionNameNode:this.visitCommonTableExpressionName.bind(this),HavingNode:this.visitHaving.bind(this),CreateSchemaNode:this.visitCreateSchema.bind(this),DropSchemaNode:this.visitDropSchema.bind(this),AlterTableNode:this.visitAlterTable.bind(this),DropColumnNode:this.visitDropColumn.bind(this),RenameColumnNode:this.visitRenameColumn.bind(this),AlterColumnNode:this.visitAlterColumn.bind(this),ModifyColumnNode:this.visitModifyColumn.bind(this),AddConstraintNode:this.visitAddConstraint.bind(this),DropConstraintNode:this.visitDropConstraint.bind(this),RenameConstraintNode:this.visitRenameConstraint.bind(this),ForeignKeyConstraintNode:this.visitForeignKeyConstraint.bind(this),CreateViewNode:this.visitCreateView.bind(this),RefreshMaterializedViewNode:this.visitRefreshMaterializedView.bind(this),DropViewNode:this.visitDropView.bind(this),GeneratedNode:this.visitGenerated.bind(this),DefaultValueNode:this.visitDefaultValue.bind(this),OnNode:this.visitOn.bind(this),ValuesNode:this.visitValues.bind(this),SelectModifierNode:this.visitSelectModifier.bind(this),CreateTypeNode:this.visitCreateType.bind(this),DropTypeNode:this.visitDropType.bind(this),ExplainNode:this.visitExplain.bind(this),DefaultInsertValueNode:this.visitDefaultInsertValue.bind(this),AggregateFunctionNode:this.visitAggregateFunction.bind(this),OverNode:this.visitOver.bind(this),PartitionByNode:this.visitPartitionBy.bind(this),PartitionByItemNode:this.visitPartitionByItem.bind(this),SetOperationNode:this.visitSetOperation.bind(this),BinaryOperationNode:this.visitBinaryOperation.bind(this),UnaryOperationNode:this.visitUnaryOperation.bind(this),UsingNode:this.visitUsing.bind(this),FunctionNode:this.visitFunction.bind(this),CaseNode:this.visitCase.bind(this),WhenNode:this.visitWhen.bind(this),JSONReferenceNode:this.visitJSONReference.bind(this),JSONPathNode:this.visitJSONPath.bind(this),JSONPathLegNode:this.visitJSONPathLeg.bind(this),JSONOperatorChainNode:this.visitJSONOperatorChain.bind(this),TupleNode:this.visitTuple.bind(this),MergeQueryNode:this.visitMergeQuery.bind(this),MatchedNode:this.visitMatched.bind(this),AddIndexNode:this.visitAddIndex.bind(this),CastNode:this.visitCast.bind(this),FetchNode:this.visitFetch.bind(this),TopNode:this.visitTop.bind(this),OutputNode:this.visitOutput.bind(this),OrActionNode:this.visitOrAction.bind(this),CollateNode:this.visitCollate.bind(this),IndexTypeNode:this.visitIndexType.bind(this)});visitNode=e=>{this.nodeStack.push(e),this.#e[e.kind](e),this.nodeStack.pop()}}});var nR,Ao,aR,e7,oR,Zc=g(()=>{"use strict";Fa();$n();v4();Pn();Va();Vr();x();Yc();em();Ja();nR=/'/g,Ao=class extends Vm{#e="";#t=[];get numParameters(){return this.#t.length}compileQuery(e,t){return this.#e="",this.#t=[],this.nodeStack.splice(0,this.nodeStack.length),this.visitNode(e),u({query:e,queryId:t,sql:this.getSql(),parameters:[...this.#t]})}getSql(){return this.#e}visitSelectQuery(e){let t=this.parentNode!==void 0&&!yi.is(this.parentNode)&&!Ie.is(this.parentNode)&&!At.is(this.parentNode)&&!Xr.is(this.parentNode)&&!Zu.is(this.parentNode);this.parentNode===void 0&&e.explain&&(this.visitNode(e.explain),this.append(" ")),t&&this.append("("),e.with&&(this.visitNode(e.with),this.append(" ")),this.append("select"),e.distinctOn&&(this.append(" "),this.compileDistinctOn(e.distinctOn)),e.frontModifiers?.length&&(this.append(" "),this.compileList(e.frontModifiers," ")),e.top&&(this.append(" "),this.visitNode(e.top)),e.selections&&(this.append(" "),this.compileList(e.selections)),e.from&&(this.append(" "),this.visitNode(e.from)),e.joins&&(this.append(" "),this.compileList(e.joins," ")),e.where&&(this.append(" "),this.visitNode(e.where)),e.groupBy&&(this.append(" "),this.visitNode(e.groupBy)),e.having&&(this.append(" "),this.visitNode(e.having)),e.setOperations&&(this.append(" "),this.compileList(e.setOperations," ")),e.orderBy&&(this.append(" "),this.visitNode(e.orderBy)),e.limit&&(this.append(" "),this.visitNode(e.limit)),e.offset&&(this.append(" "),this.visitNode(e.offset)),e.fetch&&(this.append(" "),this.visitNode(e.fetch)),e.endModifiers?.length&&(this.append(" "),this.compileList(this.sortSelectModifiers([...e.endModifiers])," ")),t&&this.append(")")}visitFrom(e){this.append("from "),this.compileList(e.froms)}visitSelection(e){this.visitNode(e.selection)}visitColumn(e){this.visitNode(e.column)}compileDistinctOn(e){this.append("distinct on ("),this.compileList(e),this.append(")")}compileList(e,t=", "){let i=e.length-1;for(let s=0;s<=i;s++)this.visitNode(e[s]),s<i&&this.append(t)}visitWhere(e){this.append("where "),this.visitNode(e.where)}visitHaving(e){this.append("having "),this.visitNode(e.having)}visitInsertQuery(e){let t=this.nodeStack.find(I.is),i=t!==e;!i&&e.explain&&(this.visitNode(e.explain),this.append(" ")),i&&!st.is(t)&&this.append("("),e.with&&(this.visitNode(e.with),this.append(" ")),this.append(e.replace?"replace":"insert"),e.orAction&&(this.append(" "),this.visitNode(e.orAction)),e.top&&(this.append(" "),this.visitNode(e.top)),e.into&&(this.append(" into "),this.visitNode(e.into)),e.columns&&(this.append(" ("),this.compileList(e.columns),this.append(")")),e.output&&(this.append(" "),this.visitNode(e.output)),e.values&&(this.append(" "),this.visitNode(e.values)),e.defaultValues&&(this.append(" "),this.append("default values")),e.onConflict&&(this.append(" "),this.visitNode(e.onConflict)),e.onDuplicateKey&&(this.append(" "),this.visitNode(e.onDuplicateKey)),e.returning&&(this.append(" "),this.visitNode(e.returning)),i&&!st.is(t)&&this.append(")"),e.endModifiers?.length&&(this.append(" "),this.compileList(e.endModifiers," "))}visitValues(e){this.append("values "),this.compileList(e.values)}visitDeleteQuery(e){let t=this.nodeStack.find(I.is)!==e;!t&&e.explain&&(this.visitNode(e.explain),this.append(" ")),t&&this.append("("),e.with&&(this.visitNode(e.with),this.append(" ")),this.append("delete "),e.top&&(this.visitNode(e.top),this.append(" ")),this.visitNode(e.from),e.output&&(this.append(" "),this.visitNode(e.output)),e.using&&(this.append(" "),this.visitNode(e.using)),e.joins&&(this.append(" "),this.compileList(e.joins," ")),e.where&&(this.append(" "),this.visitNode(e.where)),e.orderBy&&(this.append(" "),this.visitNode(e.orderBy)),e.limit&&(this.append(" "),this.visitNode(e.limit)),e.returning&&(this.append(" "),this.visitNode(e.returning)),t&&this.append(")"),e.endModifiers?.length&&(this.append(" "),this.compileList(e.endModifiers," "))}visitReturning(e){this.append("returning "),this.compileList(e.selections)}visitAlias(e){this.visitNode(e.node),this.append(" as "),this.visitNode(e.alias)}visitReference(e){e.table&&(this.visitNode(e.table),this.append(".")),this.visitNode(e.column)}visitSelectAll(e){this.append("*")}visitIdentifier(e){this.append(this.getLeftIdentifierWrapper()),this.compileUnwrappedIdentifier(e),this.append(this.getRightIdentifierWrapper())}compileUnwrappedIdentifier(e){if(!Se(e.name))throw new Error("a non-string identifier was passed to compileUnwrappedIdentifier.");this.append(this.sanitizeIdentifier(e.name))}visitAnd(e){this.visitNode(e.left),this.append(" and "),this.visitNode(e.right)}visitOr(e){this.visitNode(e.left),this.append(" or "),this.visitNode(e.right)}visitValue(e){e.immediate?this.appendImmediateValue(e.value):this.appendValue(e.value)}visitValueList(e){this.append("("),this.compileList(e.values),this.append(")")}visitTuple(e){this.append("("),this.compileList(e.values),this.append(")")}visitPrimitiveValueList(e){this.append("(");let{values:t}=e;for(let i=0;i<t.length;++i)this.appendValue(t[i]),i!==t.length-1&&this.append(", ");this.append(")")}visitParens(e){this.append("("),this.visitNode(e.node),this.append(")")}visitJoin(e){this.append(oR[e.joinType]),this.append(" "),this.visitNode(e.table),e.on&&(this.append(" "),this.visitNode(e.on))}visitOn(e){this.append("on "),this.visitNode(e.on)}visitRaw(e){let{sqlFragments:t,parameters:i}=e;for(let s=0;s<t.length;++s)this.append(t[s]),i.length>s&&this.visitNode(i[s])}visitOperator(e){this.append(e.operator)}visitTable(e){this.visitNode(e.table)}visitSchemableIdentifier(e){e.schema&&(this.visitNode(e.schema),this.append(".")),this.visitNode(e.identifier)}visitCreateTable(e){this.append("create "),e.frontModifiers&&e.frontModifiers.length>0&&(this.compileList(e.frontModifiers," "),this.append(" ")),e.temporary&&this.append("temporary "),this.append("table "),e.ifNotExists&&this.append("if not exists "),this.visitNode(e.table),e.selectQuery?(this.append(" as "),this.visitNode(e.selectQuery)):(this.append(" ("),this.compileList([...e.columns,...e.constraints??[]]),this.append(")"),e.onCommit&&(this.append(" on commit "),this.append(e.onCommit)),e.endModifiers&&e.endModifiers.length>0&&(this.append(" "),this.compileList(e.endModifiers," ")))}visitColumnDefinition(e){e.ifNotExists&&this.append("if not exists "),this.visitNode(e.column),this.append(" "),this.visitNode(e.dataType),e.unsigned&&this.append(" unsigned"),e.frontModifiers&&e.frontModifiers.length>0&&(this.append(" "),this.compileList(e.frontModifiers," ")),e.generated&&(this.append(" "),this.visitNode(e.generated)),e.identity&&this.append(" identity"),e.defaultTo&&(this.append(" "),this.visitNode(e.defaultTo)),e.notNull&&this.append(" not null"),e.unique&&this.append(" unique"),e.nullsNotDistinct&&this.append(" nulls not distinct"),e.primaryKey&&this.append(" primary key"),e.autoIncrement&&(this.append(" "),this.append(this.getAutoIncrement())),e.references&&(this.append(" "),this.visitNode(e.references)),e.check&&(this.append(" "),this.visitNode(e.check)),e.endModifiers&&e.endModifiers.length>0&&(this.append(" "),this.compileList(e.endModifiers," "))}getAutoIncrement(){return"auto_increment"}visitReferences(e){this.append("references "),this.visitNode(e.table),this.append(" ("),this.compileList(e.columns),this.append(")"),e.onDelete&&(this.append(" on delete "),this.append(e.onDelete)),e.onUpdate&&(this.append(" on update "),this.append(e.onUpdate))}visitDropTable(e){this.append("drop table "),e.ifExists&&this.append("if exists "),this.visitNode(e.table),e.cascade&&this.append(" cascade")}visitDataType(e){this.append(e.dataType)}visitOrderBy(e){this.append("order by "),this.compileList(e.items)}visitOrderByItem(e){this.visitNode(e.orderBy),e.collation&&(this.append(" "),this.visitNode(e.collation)),e.direction&&(this.append(" "),this.visitNode(e.direction)),e.nulls&&(this.append(" nulls "),this.append(e.nulls))}visitGroupBy(e){this.append("group by "),this.compileList(e.items)}visitGroupByItem(e){this.visitNode(e.groupBy)}visitUpdateQuery(e){let t=this.nodeStack.find(I.is),i=t!==e;if(!i&&e.explain&&(this.visitNode(e.explain),this.append(" ")),i&&!st.is(t)&&this.append("("),e.with&&(this.visitNode(e.with),this.append(" ")),this.append("update "),e.top&&(this.visitNode(e.top),this.append(" ")),e.table&&(this.visitNode(e.table),this.append(" ")),this.append("set "),e.updates&&this.compileList(e.updates),e.output&&(this.append(" "),this.visitNode(e.output)),e.from&&(this.append(" "),this.visitNode(e.from)),e.joins){if(!e.from)throw new Error("Joins in an update query are only supported as a part of a PostgreSQL 'update set from join' query. If you want to create a MySQL 'update join set' query, see https://kysely.dev/docs/examples/update/my-sql-joins");this.append(" "),this.compileList(e.joins," ")}e.where&&(this.append(" "),this.visitNode(e.where)),e.orderBy&&(this.append(" "),this.visitNode(e.orderBy)),e.limit&&(this.append(" "),this.visitNode(e.limit)),e.returning&&(this.append(" "),this.visitNode(e.returning)),i&&!st.is(t)&&this.append(")"),e.endModifiers?.length&&(this.append(" "),this.compileList(e.endModifiers," "))}visitColumnUpdate(e){this.visitNode(e.column),this.append(" = "),this.visitNode(e.value)}visitLimit(e){this.append("limit "),this.visitNode(e.limit)}visitOffset(e){this.append("offset "),this.visitNode(e.offset)}visitOnConflict(e){this.append("on conflict"),e.columns?(this.append(" ("),this.compileList(e.columns),this.append(")")):e.constraint?(this.append(" on constraint "),this.visitNode(e.constraint)):e.indexExpression&&(this.append(" ("),this.visitNode(e.indexExpression),this.append(")")),e.indexWhere&&(this.append(" "),this.visitNode(e.indexWhere)),e.doNothing===!0?this.append(" do nothing"):e.updates&&(this.append(" do update set "),this.compileList(e.updates),e.updateWhere&&(this.append(" "),this.visitNode(e.updateWhere)))}visitOnDuplicateKey(e){this.append("on duplicate key update "),this.compileList(e.updates)}visitCreateIndex(e){this.append("create "),e.unique&&this.append("unique "),this.append("index "),e.ifNotExists&&this.append("if not exists "),this.visitNode(e.name),e.table&&(this.append(" on "),this.visitNode(e.table)),e.using&&(this.append(" using "),this.visitNode(e.using)),e.columns&&(this.append(" ("),this.compileList(e.columns),this.append(")")),e.nullsNotDistinct&&this.append(" nulls not distinct"),e.where&&(this.append(" "),this.visitNode(e.where))}visitDropIndex(e){this.append("drop index "),e.ifExists&&this.append("if exists "),this.visitNode(e.name),e.table&&(this.append(" on "),this.visitNode(e.table)),e.cascade&&this.append(" cascade")}visitCreateSchema(e){this.append("create schema "),e.ifNotExists&&this.append("if not exists "),this.visitNode(e.schema)}visitDropSchema(e){this.append("drop schema "),e.ifExists&&this.append("if exists "),this.visitNode(e.schema),e.cascade&&this.append(" cascade")}visitPrimaryKeyConstraint(e){e.name&&(this.append("constraint "),this.visitNode(e.name),this.append(" ")),this.append("primary key ("),this.compileList(e.columns),this.append(")"),this.buildDeferrable(e)}buildDeferrable(e){e.deferrable!==void 0&&(e.deferrable?this.append(" deferrable"):this.append(" not deferrable")),e.initiallyDeferred!==void 0&&(e.initiallyDeferred?this.append(" initially deferred"):this.append(" initially immediate"))}visitUniqueConstraint(e){e.name&&(this.append("constraint "),this.visitNode(e.name),this.append(" ")),this.append("unique"),e.nullsNotDistinct&&this.append(" nulls not distinct"),this.append(" ("),this.compileList(e.columns),this.append(")"),this.buildDeferrable(e)}visitCheckConstraint(e){e.name&&(this.append("constraint "),this.visitNode(e.name),this.append(" ")),this.append("check ("),this.visitNode(e.expression),this.append(")")}visitForeignKeyConstraint(e){e.name&&(this.append("constraint "),this.visitNode(e.name),this.append(" ")),this.append("foreign key ("),this.compileList(e.columns),this.append(") "),this.visitNode(e.references),e.onDelete&&(this.append(" on delete "),this.append(e.onDelete)),e.onUpdate&&(this.append(" on update "),this.append(e.onUpdate)),this.buildDeferrable(e)}visitList(e){this.compileList(e.items)}visitWith(e){this.append("with "),e.recursive&&this.append("recursive "),this.compileList(e.expressions)}visitCommonTableExpression(e){this.visitNode(e.name),this.append(" as "),Rn(e.materialized)&&(e.materialized||this.append("not "),this.append("materialized ")),this.visitNode(e.expression)}visitCommonTableExpressionName(e){this.visitNode(e.table),e.columns&&(this.append("("),this.compileList(e.columns),this.append(")"))}visitAlterTable(e){this.append("alter table "),this.visitNode(e.table),this.append(" "),e.renameTo&&(this.append("rename to "),this.visitNode(e.renameTo)),e.setSchema&&(this.append("set schema "),this.visitNode(e.setSchema)),e.addConstraint&&this.visitNode(e.addConstraint),e.dropConstraint&&this.visitNode(e.dropConstraint),e.renameConstraint&&this.visitNode(e.renameConstraint),e.columnAlterations&&this.compileColumnAlterations(e.columnAlterations),e.addIndex&&this.visitNode(e.addIndex),e.dropIndex&&this.visitNode(e.dropIndex)}visitAddColumn(e){this.append("add column "),this.visitNode(e.column)}visitRenameColumn(e){this.append("rename column "),this.visitNode(e.column),this.append(" to "),this.visitNode(e.renameTo)}visitDropColumn(e){this.append("drop column "),this.visitNode(e.column)}visitAlterColumn(e){this.append("alter column "),this.visitNode(e.column),this.append(" "),e.dataType&&(this.announcesNewColumnDataType()&&this.append("type "),this.visitNode(e.dataType),e.dataTypeExpression&&(this.append("using "),this.visitNode(e.dataTypeExpression))),e.setDefault&&(this.append("set default "),this.visitNode(e.setDefault)),e.dropDefault&&this.append("drop default"),e.setNotNull&&this.append("set not null"),e.dropNotNull&&this.append("drop not null")}visitModifyColumn(e){this.append("modify column "),this.visitNode(e.column)}visitAddConstraint(e){this.append("add "),this.visitNode(e.constraint)}visitDropConstraint(e){this.append("drop constraint "),e.ifExists&&this.append("if exists "),this.visitNode(e.constraintName),e.modifier==="cascade"?this.append(" cascade"):e.modifier==="restrict"&&this.append(" restrict")}visitRenameConstraint(e){this.append("rename constraint "),this.visitNode(e.oldName),this.append(" to "),this.visitNode(e.newName)}visitSetOperation(e){this.append(e.operator),this.append(" "),e.all&&this.append("all "),this.visitNode(e.expression)}visitCreateView(e){this.append("create "),e.orReplace&&this.append("or replace "),e.materialized&&this.append("materialized "),e.temporary&&this.append("temporary "),this.append("view "),e.ifNotExists&&this.append("if not exists "),this.visitNode(e.name),this.append(" "),e.columns&&(this.append("("),this.compileList(e.columns),this.append(") ")),e.as&&(this.append("as "),this.visitNode(e.as))}visitRefreshMaterializedView(e){this.append("refresh materialized view "),e.concurrently&&this.append("concurrently "),this.visitNode(e.name),e.withNoData?this.append(" with no data"):this.append(" with data")}visitDropView(e){this.append("drop "),e.materialized&&this.append("materialized "),this.append("view "),e.ifExists&&this.append("if exists "),this.visitNode(e.name),e.cascade&&this.append(" cascade")}visitGenerated(e){this.append("generated "),e.always&&this.append("always "),e.byDefault&&this.append("by default "),this.append("as "),e.identity&&this.append("identity"),e.expression&&(this.append("("),this.visitNode(e.expression),this.append(")")),e.stored&&this.append(" stored")}visitDefaultValue(e){this.append("default "),this.visitNode(e.defaultValue)}visitSelectModifier(e){e.rawModifier?this.visitNode(e.rawModifier):this.append(aR[e.modifier]),e.of&&(this.append(" of "),this.compileList(e.of,", "))}visitCreateType(e){this.append("create type "),this.visitNode(e.name),e.enum&&(this.append(" as enum "),this.visitNode(e.enum))}visitDropType(e){this.append("drop type "),e.ifExists&&this.append("if exists "),this.visitNode(e.name)}visitExplain(e){this.append("explain"),(e.options||e.format)&&(this.append(" "),this.append(this.getLeftExplainOptionsWrapper()),e.options&&(this.visitNode(e.options),e.format&&this.append(this.getExplainOptionsDelimiter())),e.format&&(this.append("format"),this.append(this.getExplainOptionAssignment()),this.append(e.format)),this.append(this.getRightExplainOptionsWrapper()))}visitDefaultInsertValue(e){this.append("default")}visitAggregateFunction(e){this.append(e.func),this.append("("),e.distinct&&this.append("distinct "),this.compileList(e.aggregated),e.orderBy&&(this.append(" "),this.visitNode(e.orderBy)),this.append(")"),e.withinGroup&&(this.append(" within group ("),this.visitNode(e.withinGroup),this.append(")")),e.filter&&(this.append(" filter("),this.visitNode(e.filter),this.append(")")),e.over&&(this.append(" "),this.visitNode(e.over))}visitOver(e){this.append("over("),e.partitionBy&&(this.visitNode(e.partitionBy),e.orderBy&&this.append(" ")),e.orderBy&&this.visitNode(e.orderBy),this.append(")")}visitPartitionBy(e){this.append("partition by "),this.compileList(e.items)}visitPartitionByItem(e){this.visitNode(e.partitionBy)}visitBinaryOperation(e){this.visitNode(e.leftOperand),this.append(" "),this.visitNode(e.operator),this.append(" "),this.visitNode(e.rightOperand)}visitUnaryOperation(e){this.visitNode(e.operator),this.isMinusOperator(e.operator)||this.append(" "),this.visitNode(e.operand)}isMinusOperator(e){return sr.is(e)&&e.operator==="-"}visitUsing(e){this.append("using "),this.compileList(e.tables)}visitFunction(e){this.append(e.func),this.append("("),this.compileList(e.arguments),this.append(")")}visitCase(e){this.append("case"),e.value&&(this.append(" "),this.visitNode(e.value)),e.when&&(this.append(" "),this.compileList(e.when," ")),e.else&&(this.append(" else "),this.visitNode(e.else)),this.append(" end"),e.isStatement&&this.append(" case")}visitWhen(e){this.append("when "),this.visitNode(e.condition),e.result&&(this.append(" then "),this.visitNode(e.result))}visitJSONReference(e){this.visitNode(e.reference),this.visitNode(e.traversal)}visitJSONPath(e){e.inOperator&&this.visitNode(e.inOperator),this.append("'$");for(let t of e.pathLegs)this.visitNode(t);this.append("'")}visitJSONPathLeg(e){let t=e.type==="ArrayLocation";this.append(t?"[":"."),this.append(String(e.value)),t&&this.append("]")}visitJSONOperatorChain(e){for(let t=0,i=e.values.length;t<i;t++)t===i-1?this.visitNode(e.operator):this.append("->"),this.visitNode(e.values[t])}visitMergeQuery(e){e.with&&(this.visitNode(e.with),this.append(" ")),this.append("merge "),e.top&&(this.visitNode(e.top),this.append(" ")),this.append("into "),this.visitNode(e.into),e.using&&(this.append(" "),this.visitNode(e.using)),e.whens&&(this.append(" "),this.compileList(e.whens," ")),e.returning&&(this.append(" "),this.visitNode(e.returning)),e.output&&(this.append(" "),this.visitNode(e.output)),e.endModifiers?.length&&(this.append(" "),this.compileList(e.endModifiers," "))}visitMatched(e){e.not&&this.append("not "),this.append("matched"),e.bySource&&this.append(" by source")}visitAddIndex(e){this.append("add "),e.unique&&this.append("unique "),this.append("index "),this.visitNode(e.name),e.columns&&(this.append(" ("),this.compileList(e.columns),this.append(")")),e.using&&(this.append(" using "),this.visitNode(e.using))}visitCast(e){this.append("cast("),this.visitNode(e.expression),this.append(" as "),this.visitNode(e.dataType),this.append(")")}visitFetch(e){this.append("fetch next "),this.visitNode(e.rowCount),this.append(` rows ${e.modifier}`)}visitOutput(e){this.append("output "),this.compileList(e.selections)}visitTop(e){this.append(`top(${e.expression})`),e.modifiers&&this.append(` ${e.modifiers}`)}visitOrAction(e){this.append(e.action)}visitCollate(e){this.append("collate "),this.visitNode(e.collation)}visitIndexType(e){this.append(e.indexType)}append(e){this.#e+=e}appendValue(e){this.addParameter(e),this.append(this.getCurrentParameterPlaceholder())}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getCurrentParameterPlaceholder(){return"$"+this.numParameters}getLeftExplainOptionsWrapper(){return"("}getExplainOptionAssignment(){return" "}getExplainOptionsDelimiter(){return", "}getRightExplainOptionsWrapper(){return")"}sanitizeIdentifier(e){let t=this.getLeftIdentifierWrapper(),i=this.getRightIdentifierWrapper(),s="";for(let n of e)s+=n,n===t?s+=t:n===i&&(s+=i);return s}sanitizeStringLiteral(e){return e.replace(nR,"''")}addParameter(e){this.#t.push(e)}appendImmediateValue(e){if(Se(e))this.appendStringLiteral(e);else if(_s(e)||Rn(e)||$a(e))this.append(e.toString());else if(Da(e))this.append("null");else if(M5(e))this.appendImmediateValue(e.toISOString());else throw new Error(`invalid immediate value ${e}`)}appendStringLiteral(e){this.append("'"),this.append(this.sanitizeStringLiteral(e)),this.append("'")}sortSelectModifiers(e){return e.sort((t,i)=>t.modifier&&i.modifier?e7[t.modifier]-e7[i.modifier]:1),u(e)}compileColumnAlterations(e){this.compileList(e)}announcesNewColumnDataType(){return!0}},aR=u({ForKeyShare:"for key share",ForNoKeyUpdate:"for no key update",ForUpdate:"for update",ForShare:"for share",NoWait:"nowait",SkipLocked:"skip locked",Distinct:"distinct"}),e7=u({ForKeyShare:1,ForNoKeyUpdate:1,ForUpdate:1,ForShare:1,NoWait:2,SkipLocked:2,Distinct:0}),oR=u({InnerJoin:"inner join",LeftJoin:"left join",RightJoin:"right join",FullJoin:"full join",CrossJoin:"cross join",LateralInnerJoin:"inner join lateral",LateralLeftJoin:"left join lateral",LateralCrossJoin:"cross join lateral",OuterApply:"outer apply",CrossApply:"cross apply",Using:"using"})});var Yr,ed=g(()=>{"use strict";qi();x();Ps();Yr=u({raw(r,e=[]){return u({sql:r,query:xe.createWithSql(r),parameters:u(e),queryId:ee()})}})});var t7=g(()=>{"use strict"});var r7=g(()=>{"use strict"});var i7=g(()=>{"use strict"});var s7=g(()=>{"use strict"});var n7=g(()=>{"use strict"});var Ro,Hm=g(()=>{"use strict";Ro=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}});var Mo,Qm=g(()=>{"use strict";at();Mo=class{db;constructor(e){this.db=e}async getSchemas(){try{return(await C`
2
- select schema_name
3
- from information_schema.schemata
4
- order by schema_name
5
- `.execute(this.db)).rows.map(t=>({name:t.schema_name}))}catch{return[]}}async getTables(e){try{let t=await C`
6
- select table_name, table_schema, table_type
7
- from information_schema.tables
8
- where table_schema not in ('information_schema', 'pg_catalog', 'sys')
9
- order by table_name
10
- `.execute(this.db),i=[];for(let s of t.rows)!e?.withInternalKyselyTables&&(s.table_name.includes("kysely_")||s.table_name.includes("noorm_"))||i.push({name:s.table_name,schema:s.table_schema,isView:s.table_type==="VIEW",columns:await this.getColumns(s.table_name),indexes:await this.getIndexes(s.table_name),foreignKeys:await this.getForeignKeys(s.table_name)});return i}catch{return[]}}async getMetadata(e){return{tables:await this.getTables(e)}}async getColumns(e){try{return(await C`
11
- select column_name, data_type, is_nullable, column_default
12
- from information_schema.columns
13
- where table_name = ${e}
14
- order by ordinal_position
15
- `.execute(this.db)).rows.map(i=>({name:i.column_name,type:i.data_type,nullable:i.is_nullable==="YES",defaultValue:i.column_default,isPrimaryKey:!1,isAutoIncrement:!1}))}catch{return[]}}async getIndexes(e){return[]}async getForeignKeys(e){try{return(await C`
16
- select
17
- kcu.constraint_name,
18
- kcu.column_name,
19
- ccu.table_name as referenced_table_name,
20
- ccu.column_name as referenced_column_name
21
- from information_schema.key_column_usage kcu
22
- join information_schema.constraint_column_usage ccu
23
- on kcu.constraint_name = ccu.constraint_name
24
- where kcu.table_name = ${e}
25
- `.execute(this.db)).rows.map(i=>({name:i.constraint_name,column:i.column_name,referencedTable:i.referenced_table_name,referencedColumn:i.referenced_column_name}))}catch{return[]}}async getViewDefinition(e){try{return(await C`
26
- select view_definition
27
- from information_schema.views
28
- where table_name = ${e}
29
- `.execute(this.db)).rows[0]?.view_definition||null}catch{return null}}async getRowCount(e){try{let t=await this.db.selectFrom(e).select(i=>i.fn.countAll().as("count")).executeTakeFirst();return Number(t?.count||0)}catch{return 0}}}});function Gm(r,e){return xe.createWithChildren([xe.createWithSql(`${r} `),W.create(e)])}var a7=g(()=>{"use strict";ge();qi()});var Km,S4,x4,T4=g(()=>{"use strict";a7();ed();x();Ps();Km=class{#e;#t=new x4;#r;#i;constructor(e){this.#e=u({...e})}async init(){this.#r=fe(this.#e.database)?await this.#e.database():this.#e.database,this.#i=new S4(this.#r),this.#e.onCreateConnection&&await this.#e.onCreateConnection(this.#i)}async acquireConnection(){if(!this.#i)throw new Error("driver has already been destroyed");return await this.#t.lock(),this.#i}async beginTransaction(e){await e.executeQuery(Yr.raw("begin"))}async commitTransaction(e){await e.executeQuery(Yr.raw("commit"))}async rollbackTransaction(e){await e.executeQuery(Yr.raw("rollback"))}async savepoint(e,t,i){await e.executeQuery(i(Gm("savepoint",t),ee()))}async rollbackToSavepoint(e,t,i){await e.executeQuery(i(Gm("rollback to",t),ee()))}async releaseSavepoint(e,t,i){await e.executeQuery(i(Gm("release",t),ee()))}async releaseConnection(){this.#t.unlock()}async destroy(){this.#r&&(this.#r.close(),this.#r=void 0,this.#i=void 0)}},S4=class{#e;constructor(e){this.#e=e}executeQuery(e){let{sql:t,parameters:i}=e,s=i.map(l=>l===void 0?null:typeof l=="boolean"?l?1:0:l instanceof Date?l.toISOString():typeof l=="object"&&l!==null?JSON.stringify(l):l),n=this.#e.prepare(t);if(n.reader)return Promise.resolve({rows:n.all(s)});let{changes:a,lastInsertRowid:o}=n.run(s);return Promise.resolve({numAffectedRows:a!=null?BigInt(a):void 0,insertId:o!=null?BigInt(o):void 0,rows:[]})}async*streamQuery(e,t){let{sql:i,parameters:s,query:n}=e,a=s.map(l=>l===void 0?null:typeof l=="boolean"?l?1:0:l instanceof Date?l.toISOString():typeof l=="object"&&l!==null?JSON.stringify(l):l),o=this.#e.prepare(i);if(o.reader){let l=o.iterate(a);for(let c of l)yield{rows:[c]}}else throw new Error("Sqlite driver only supports streaming of queries that return rows")}},x4=class{#e;#t;async lock(){for(;this.#e;)await this.#e;this.#e=new Promise(e=>{this.#t=e})}unlock(){let e=this.#t;this.#e=void 0,this.#t=void 0,e?.()}}});var lR,Jm,_4=g(()=>{"use strict";Zc();lR=/"/g,Jm=class extends Ao{visitOrAction(e){this.append("or "),this.append(e.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(lR,'""')}visitDefaultInsertValue(e){this.append("null")}visitForeignKeyConstraint(e){throw new Error("SQLite does not support adding foreign key constraints via ALTER TABLE. Foreign keys must be defined during table creation.")}}});var cR,dR,ko,Xm=g(()=>{"use strict";Qm();at();cR="kysely_migration",dR="kysely_migration_lock",ko=class extends Mo{#e;constructor(e){super(e),this.#e=e}async getSchemas(){return[]}async getTables(e={withInternalKyselyTables:!1}){return await this.#r(e)}async getMetadata(e){return{tables:await this.getTables(e)}}#t(e,t){let i=e.selectFrom("sqlite_master").where("type","in",["table","view"]).where("name","not like","sqlite_%").select(["name","sql","type"]).orderBy("name");return t.withInternalKyselyTables||(i=i.where("name","!=",cR).where("name","!=",dR)),i}async#r(e){let t=await this.#t(this.#e,e).execute(),i={},s={},n={};for(let a of t)try{let[o,l,c]=await Promise.all([C`PRAGMA table_info(${C.lit(a.name)})`.execute(this.#e),this.getIndexes(a.name),this.getForeignKeys(a.name)]);i[a.name]=o.rows,s[a.name]=l,n[a.name]=c}catch(o){console.warn(`Failed to introspect table ${a.name}:`,o),i[a.name]=[],s[a.name]=[],n[a.name]=[]}return t.map(({name:a,sql:o,type:l})=>{let c=this.detectAutoIncrement(o,i[a]??[]),d=i[a]??[];return{name:a,isView:l==="view",columns:d.map(p=>({name:p.name,type:p.type,nullable:!p.notnull,isAutoIncrement:c.isAutoIncrement&&p.name===c.columnName,defaultValue:p.dflt_value,isPrimaryKey:p.pk>0})),indexes:s[a]||[],foreignKeys:n[a]||[]}})}detectAutoIncrement(e,t){if(!e)return{isAutoIncrement:!1,columnName:null,type:"none"};let i=e.match(/(\w+)\s+INTEGER\s+PRIMARY\s+KEY\s+AUTOINCREMENT/i);if(i)return{isAutoIncrement:!0,columnName:i[1].replace(/["`]/g,""),type:"autoincrement"};let s=e.match(/(\w+)\s+INTEGER\s+PRIMARY\s+KEY/i);if(s)return{isAutoIncrement:!0,columnName:s[1].replace(/["`]/g,""),type:"rowid"};let n=t.filter(o=>o.pk>0);if(n.length===1){let o=n[0];if(o.type.toLowerCase()==="integer")return{isAutoIncrement:!0,columnName:o.name,type:"rowid"}}return t.some(o=>o.pk>0)?{isAutoIncrement:!1,columnName:null,type:"none"}:{isAutoIncrement:!0,columnName:"rowid",type:"rowid"}}extractUniqueConstraints(e){if(!e)return[];let t=[],i=e.match(/UNIQUE\s*\(([^)]+)\)/gi);if(i)for(let s of i){let n=s.match(/\(([^)]+)\)/);if(n){let a=n[1].split(",").map(o=>o.trim().replace(/["`]/g,""));t.push(...a)}}return t}extractCheckConstraints(e){if(!e)return[];let t=[],i=e.match(/CHECK\s*\(([^)]+)\)/gi);if(i)for(let s of i){let n=s.match(/\(([^)]+)\)/);n&&t.push(n[1])}return t}async getColumns(e){try{return(await C`PRAGMA table_info(${C.lit(e)})`.execute(this.#e)).rows.map(s=>({name:s.name,type:s.type,nullable:!s.notnull,defaultValue:s.dflt_value,isPrimaryKey:!!s.pk,isAutoIncrement:s.type.toLowerCase().includes("integer")&&s.pk}))}catch(t){return console.warn("SQLite column discovery failed:",t),[]}}async getIndexes(e){try{let i=(await C`PRAGMA index_list(${C.lit(e)})`.execute(this.#e)).rows,s=[];for(let n of i)try{let o=(await C`PRAGMA index_info(${C.lit(n.name)})`.execute(this.#e)).rows;s.push({name:n.name,unique:!!n.unique,columns:o.sort((l,c)=>l.seqno-c.seqno).map(l=>l.name)})}catch(a){console.warn(`Failed to get info for index ${n.name}`,a),s.push({name:n.name,unique:!!n.unique,columns:[]})}return s}catch(t){return console.warn("SQLite index discovery failed:",t),[]}}async getForeignKeys(e){try{return(await C`PRAGMA foreign_key_list(${C.lit(e)})`.execute(this.#e)).rows.map(s=>({name:`fk_${e}_${s.from}`,column:s.from,referencedTable:s.table,referencedColumn:s.to}))}catch(t){return console.warn("SQLite foreign key discovery failed:",t),[]}}async getViewDefinition(e){return(await this.#e.selectFrom("sqlite_master").select("sql").where("name","=",e).where("type","=","view").executeTakeFirst())?.sql||null}}});var Ym,E4=g(()=>{"use strict";Hm();Ym=class extends Ro{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(e,t){}async releaseMigrationLock(e,t){}}});var Zm,N4=g(()=>{"use strict";T4();_4();Xm();E4();x();Zm=class{#e;constructor(e){this.#e=u({...e})}createDriver(){return new Km(this.#e)}createQueryCompiler(){return new Jm}createAdapter(){return new Ym}createIntrospector(e){return new ko(e)}}});var o7=g(()=>{"use strict"});var A4=O(l7=>{"use strict";l7.parse=function(r,e){return new C4(r,e).parse()};var C4=class r{constructor(e,t){this.source=e,this.transform=t||pR,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var t;(this.recorded.length>0||e)&&(t=this.recorded.join(""),t==="NULL"&&!e&&(t=null),t!==null&&(t=this.transform(t)),this.entries.push(t),this.recorded=[])}consumeDimensions(){if(this.source[0]==="[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){var t,i,s;for(this.consumeDimensions();!this.isEof();)if(t=this.nextCharacter(),t.value==="{"&&!s)this.dimension++,this.dimension>1&&(i=new r(this.source.substr(this.position-1),this.transform),this.entries.push(i.parse(!0)),this.position+=i.position-2);else if(t.value==="}"&&!s){if(this.dimension--,!this.dimension&&(this.newEntry(),e))return this.entries}else t.value==='"'&&!t.escaped?(s&&this.newEntry(!0),s=!s):t.value===","&&!s?this.newEntry():this.record(t.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this.entries}};function pR(r){return r}});var R4=O((pte,c7)=>{var uR=A4();c7.exports={create:function(r,e){return{parse:function(){return uR.parse(r,e)}}}}});var u7=O((ute,p7)=>{"use strict";var mR=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,hR=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,fR=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,gR=/^-?infinity$/;p7.exports=function(e){if(gR.test(e))return Number(e.replace("i","I"));var t=mR.exec(e);if(!t)return yR(e)||null;var i=!!t[8],s=parseInt(t[1],10);i&&(s=d7(s));var n=parseInt(t[2],10)-1,a=t[3],o=parseInt(t[4],10),l=parseInt(t[5],10),c=parseInt(t[6],10),d=t[7];d=d?1e3*parseFloat(d):0;var p,m=wR(e);return m!=null?(p=new Date(Date.UTC(s,n,a,o,l,c,d)),M4(s)&&p.setUTCFullYear(s),m!==0&&p.setTime(p.getTime()-m)):(p=new Date(s,n,a,o,l,c,d),M4(s)&&p.setFullYear(s)),p};function yR(r){var e=hR.exec(r);if(e){var t=parseInt(e[1],10),i=!!e[4];i&&(t=d7(t));var s=parseInt(e[2],10)-1,n=e[3],a=new Date(t,s,n);return M4(t)&&a.setFullYear(t),a}}function wR(r){if(r.endsWith("+00"))return 0;var e=fR.exec(r.split(" ")[1]);if(e){var t=e[1];if(t==="Z")return 0;var i=t==="-"?-1:1,s=parseInt(e[2],10)*3600+parseInt(e[3]||0,10)*60+parseInt(e[4]||0,10);return s*i*1e3}}function d7(r){return-(r-1)}function M4(r){return r>=0&&r<100}});var h7=O((mte,m7)=>{m7.exports=vR;var bR=Object.prototype.hasOwnProperty;function vR(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)bR.call(t,i)&&(r[i]=t[i])}return r}});var y7=O((hte,g7)=>{"use strict";var SR=h7();g7.exports=Io;function Io(r){if(!(this instanceof Io))return new Io(r);SR(this,PR(r))}var xR=["seconds","minutes","hours","days","months","years"];Io.prototype.toPostgres=function(){var r=xR.filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")<0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e==="seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,"")),t+" "+e},this).join(" ")};var TR={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},_R=["years","months","days"],ER=["hours","minutes","seconds"];Io.prototype.toISOString=Io.prototype.toISO=function(){var r=_R.map(t,this).join(""),e=ER.map(t,this).join("");return"P"+r+"T"+e;function t(i){var s=this[i]||0;return i==="seconds"&&this.milliseconds&&(s=(s+this.milliseconds/1e3).toFixed(6).replace(/0+$/,"")),s+TR[i]}};var k4="([+-]?\\d+)",NR=k4+"\\s+years?",CR=k4+"\\s+mons?",AR=k4+"\\s+days?",RR="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",MR=new RegExp([NR,CR,AR,RR].map(function(r){return"("+r+")?"}).join("\\s*")),f7={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},kR=["hours","minutes","seconds","milliseconds"];function IR(r){var e=r+"000000".slice(r.length);return parseInt(e,10)/1e3}function PR(r){if(!r)return{};var e=MR.exec(r),t=e[8]==="-";return Object.keys(f7).reduce(function(i,s){var n=f7[s],a=e[n];return!a||(a=s==="milliseconds"?IR(a):parseInt(a,10),!a)||(t&&~kR.indexOf(s)&&(a*=-1),i[s]=a),i},{})}});var b7=O((fte,w7)=>{"use strict";w7.exports=function(e){if(/^\\x/.test(e))return new Buffer(e.substr(2),"hex");for(var t="",i=0;i<e.length;)if(e[i]!=="\\")t+=e[i],++i;else if(/[0-7]{3}/.test(e.substr(i+1,3)))t+=String.fromCharCode(parseInt(e.substr(i+1,3),8)),i+=4;else{for(var s=1;i+s<e.length&&e[i+s]==="\\";)s++;for(var n=0;n<Math.floor(s/2);++n)t+="\\";i+=Math.floor(s/2)*2}return new Buffer(t,"binary")}});var N7=O((gte,E7)=>{var td=A4(),rd=R4(),eh=u7(),S7=y7(),x7=b7();function th(r){return function(t){return t===null?t:r(t)}}function T7(r){return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"||r==="1"}function OR(r){return r?td.parse(r,T7):null}function DR(r){return parseInt(r,10)}function I4(r){return r?td.parse(r,th(DR)):null}function $R(r){return r?td.parse(r,th(function(e){return _7(e).trim()})):null}var FR=function(r){if(!r)return null;var e=rd.create(r,function(t){return t!==null&&(t=$4(t)),t});return e.parse()},P4=function(r){if(!r)return null;var e=rd.create(r,function(t){return t!==null&&(t=parseFloat(t)),t});return e.parse()},Er=function(r){if(!r)return null;var e=rd.create(r);return e.parse()},O4=function(r){if(!r)return null;var e=rd.create(r,function(t){return t!==null&&(t=eh(t)),t});return e.parse()},LR=function(r){if(!r)return null;var e=rd.create(r,function(t){return t!==null&&(t=S7(t)),t});return e.parse()},qR=function(r){return r?td.parse(r,th(x7)):null},D4=function(r){return parseInt(r,10)},_7=function(r){var e=String(r);return/^\d+$/.test(e)?e:r},v7=function(r){return r?td.parse(r,th(JSON.parse)):null},$4=function(r){return r[0]!=="("?null:(r=r.substring(1,r.length-1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},BR=function(r){if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",i=!1,s=2;s<r.length-1;s++){if(i||(e+=r[s]),r[s]===")"){i=!0;continue}else if(!i)continue;r[s]!==","&&(t+=r[s])}var n=$4(e);return n.radius=parseFloat(t),n},WR=function(r){r(20,_7),r(21,D4),r(23,D4),r(26,D4),r(700,parseFloat),r(701,parseFloat),r(16,T7),r(1082,eh),r(1114,eh),r(1184,eh),r(600,$4),r(651,Er),r(718,BR),r(1e3,OR),r(1001,qR),r(1005,I4),r(1007,I4),r(1028,I4),r(1016,$R),r(1017,FR),r(1021,P4),r(1022,P4),r(1231,P4),r(1014,Er),r(1015,Er),r(1008,Er),r(1009,Er),r(1040,Er),r(1041,Er),r(1115,O4),r(1182,O4),r(1185,O4),r(1186,S7),r(1187,LR),r(17,x7),r(114,JSON.parse.bind(JSON)),r(3802,JSON.parse.bind(JSON)),r(199,v7),r(3807,v7),r(3907,Er),r(2951,Er),r(791,Er),r(1183,Er),r(1270,Er)};E7.exports={init:WR}});var A7=O((yte,C7)=>{"use strict";var Kt=1e6;function zR(r){var e=r.readInt32BE(0),t=r.readUInt32BE(4),i="";e<0&&(e=~e+(t===0),t=~t+1>>>0,i="-");var s="",n,a,o,l,c,d;{if(n=e%Kt,e=e/Kt>>>0,a=4294967296*n+t,t=a/Kt>>>0,o=""+(a-Kt*t),t===0&&e===0)return i+o+s;for(l="",c=6-o.length,d=0;d<c;d++)l+="0";s=l+o+s}{if(n=e%Kt,e=e/Kt>>>0,a=4294967296*n+t,t=a/Kt>>>0,o=""+(a-Kt*t),t===0&&e===0)return i+o+s;for(l="",c=6-o.length,d=0;d<c;d++)l+="0";s=l+o+s}{if(n=e%Kt,e=e/Kt>>>0,a=4294967296*n+t,t=a/Kt>>>0,o=""+(a-Kt*t),t===0&&e===0)return i+o+s;for(l="",c=6-o.length,d=0;d<c;d++)l+="0";s=l+o+s}return n=e%Kt,a=4294967296*n+t,o=""+a%Kt,i+o+s}C7.exports=zR});var P7=O((wte,I7)=>{var UR=A7(),Pe=function(r,e,t,i,s){t=t||0,i=i||!1,s=s||function(h,f,w){return h*Math.pow(2,w)+f};var n=t>>3,a=function(h){return i?~h&255:h},o=255,l=8-t%8;e<l&&(o=255<<8-e&255,l=e),t&&(o=o>>t%8);var c=0;t%8+e>=8&&(c=s(0,a(r[n])&o,l));for(var d=e+t>>3,p=n+1;p<d;p++)c=s(c,a(r[p]),8);var m=(e+t)%8;return m>0&&(c=s(c,a(r[d])>>8-m,m)),c},k7=function(r,e,t){var i=Math.pow(2,t-1)-1,s=Pe(r,1),n=Pe(r,t,1);if(n===0)return 0;var a=1,o=function(c,d,p){c===0&&(c=1);for(var m=1;m<=p;m++)a/=2,(d&1<<p-m)>0&&(c+=a);return c},l=Pe(r,e,t+1,!1,o);return n==Math.pow(2,t+1)-1?l===0?s===0?1/0:-1/0:NaN:(s===0?1:-1)*Math.pow(2,n-i)*l},jR=function(r){return Pe(r,1)==1?-1*(Pe(r,15,1,!0)+1):Pe(r,15,1)},R7=function(r){return Pe(r,1)==1?-1*(Pe(r,31,1,!0)+1):Pe(r,31,1)},VR=function(r){return k7(r,23,8)},HR=function(r){return k7(r,52,11)},QR=function(r){var e=Pe(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,Pe(r,16,16)),i=0,s=[],n=Pe(r,16),a=0;a<n;a++)i+=Pe(r,16,64+16*a)*t,t/=1e4;var o=Math.pow(10,Pe(r,16,48));return(e===0?1:-1)*Math.round(i*o)/o},M7=function(r,e){var t=Pe(e,1),i=Pe(e,63,1),s=new Date((t===0?1:-1)*i/1e3+9466848e5);return r||s.setTime(s.getTime()+s.getTimezoneOffset()*6e4),s.usec=i%1e3,s.getMicroSeconds=function(){return this.usec},s.setMicroSeconds=function(n){this.usec=n},s.getUTCMicroSeconds=function(){return this.usec},s},id=function(r){for(var e=Pe(r,32),t=Pe(r,32,32),i=Pe(r,32,64),s=96,n=[],a=0;a<e;a++)n[a]=Pe(r,32,s),s+=32,s+=32;var o=function(c){var d=Pe(r,32,s);if(s+=32,d==4294967295)return null;var p;if(c==23||c==20)return p=Pe(r,d*8,s),s+=d*8,p;if(c==25)return p=r.toString(this.encoding,s>>3,(s+=d<<3)>>3),p;console.log("ERROR: ElementType not implemented: "+c)},l=function(c,d){var p=[],m;if(c.length>1){var h=c.shift();for(m=0;m<h;m++)p[m]=l(c,d);c.unshift(h)}else for(m=0;m<c[0];m++)p[m]=o(d);return p};return l(n,i)},GR=function(r){return r.toString("utf8")},KR=function(r){return r===null?null:Pe(r,8)>0},JR=function(r){r(20,UR),r(21,jR),r(23,R7),r(26,R7),r(1700,QR),r(700,VR),r(701,HR),r(16,KR),r(1114,M7.bind(null,!1)),r(1184,M7.bind(null,!0)),r(1e3,id),r(1007,id),r(1016,id),r(1008,id),r(1009,id),r(25,GR)};I7.exports={init:JR}});var D7=O((bte,O7)=>{O7.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var ad=O(nd=>{var XR=N7(),YR=P7(),ZR=R4(),eM=D7();nd.getTypeParser=tM;nd.setTypeParser=rM;nd.arrayParser=ZR;nd.builtins=eM;var sd={text:{},binary:{}};function $7(r){return String(r)}function tM(r,e){return e=e||"text",sd[e]&&sd[e][r]||$7}function rM(r,e,t){typeof e=="function"&&(t=e,e="text"),sd[e][r]=t}XR.init(function(r,e){sd.text[r]=e});YR.init(function(r,e){sd.binary[r]=e})});var od=O((Ste,F4)=>{"use strict";F4.exports={host:"localhost",user:process.platform==="win32"?process.env.USERNAME:process.env.USER,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var Po=ad(),iM=Po.getTypeParser(20,"text"),sM=Po.getTypeParser(1016,"text");F4.exports.__defineSetter__("parseInt8",function(r){Po.setTypeParser(20,"text",r?Po.getTypeParser(23,"text"):iM),Po.setTypeParser(1016,"text",r?Po.getTypeParser(1007,"text"):sM)})});var Oo=O((xte,q7)=>{"use strict";var nM=od(),F7=require("util"),{isDate:aM}=F7.types||F7;function oM(r){return'"'+r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function L7(r){let e="{";for(let t=0;t<r.length;t++)if(t>0&&(e=e+","),r[t]===null||typeof r[t]>"u")e=e+"NULL";else if(Array.isArray(r[t]))e=e+L7(r[t]);else if(ArrayBuffer.isView(r[t])){let i=r[t];if(!(i instanceof Buffer)){let s=Buffer.from(i.buffer,i.byteOffset,i.byteLength);s.length===i.byteLength?i=s:i=s.slice(i.byteOffset,i.byteOffset+i.byteLength)}e+="\\\\x"+i.toString("hex")}else e+=oM(rh(r[t]));return e=e+"}",e}var rh=function(r,e){if(r==null)return null;if(typeof r=="object"){if(r instanceof Buffer)return r;if(ArrayBuffer.isView(r)){let t=Buffer.from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice(r.byteOffset,r.byteOffset+r.byteLength)}return aM(r)?nM.parseInputDatesAsUTC?dM(r):cM(r):Array.isArray(r)?L7(r):lM(r,e)}return r.toString()};function lM(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e.indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+r+'" for query');return e.push(r),rh(r.toPostgres(rh),e)}return JSON.stringify(r)}function cM(r){let e=-r.getTimezoneOffset(),t=r.getFullYear(),i=t<1;i&&(t=Math.abs(t)+1);let s=String(t).padStart(4,"0")+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+String(r.getMilliseconds()).padStart(3,"0");return e<0?(s+="-",e*=-1):s+="+",s+=String(Math.floor(e/60)).padStart(2,"0")+":"+String(e%60).padStart(2,"0"),i&&(s+=" BC"),s}function dM(r){let e=r.getUTCFullYear(),t=e<1;t&&(e=Math.abs(e)+1);let i=String(e).padStart(4,"0")+"-"+String(r.getUTCMonth()+1).padStart(2,"0")+"-"+String(r.getUTCDate()).padStart(2,"0")+"T"+String(r.getUTCHours()).padStart(2,"0")+":"+String(r.getUTCMinutes()).padStart(2,"0")+":"+String(r.getUTCSeconds()).padStart(2,"0")+"."+String(r.getUTCMilliseconds()).padStart(3,"0");return i+="+00:00",t&&(i+=" BC"),i}function pM(r,e,t){return r=typeof r=="string"?{text:r}:r,e&&(typeof e=="function"?r.callback=e:r.values=e),t&&(r.callback=t),r}var uM=function(r){return'"'+r.replace(/"/g,'""')+'"'},mM=function(r){let e=!1,t="'";if(r==null||typeof r!="string")return"''";for(let i=0;i<r.length;i++){let s=r[i];s==="'"?t+=s+s:s==="\\"?(t+=s+s,e=!0):t+=s}return t+="'",e===!0&&(t=" E"+t),t};q7.exports={prepareValue:function(e){return rh(e)},normalizeQueryConfig:pM,escapeIdentifier:uM,escapeLiteral:mM}});var W7=O((Tte,B7)=>{"use strict";var Do=require("crypto");function L4(r){return Do.createHash("md5").update(r,"utf-8").digest("hex")}function hM(r,e,t){let i=L4(e+r);return"md5"+L4(Buffer.concat([Buffer.from(i),t]))}function fM(r){return Do.createHash("sha256").update(r).digest()}function gM(r,e){return r=r.replace(/(\D)-/,"$1"),Do.createHash(r).update(e).digest()}function yM(r,e){return Do.createHmac("sha256",r).update(e).digest()}async function wM(r,e,t){return Do.pbkdf2Sync(r,e,t,32,"sha256")}B7.exports={postgresMd5PasswordHash:hM,randomBytes:Do.randomBytes,deriveKey:wM,sha256:fM,hashByName:gM,hmacSha256:yM,md5:L4}});var V7=O((_te,j7)=>{var z7=require("crypto");j7.exports={postgresMd5PasswordHash:vM,randomBytes:bM,deriveKey:_M,sha256:SM,hashByName:xM,hmacSha256:TM,md5:q4};var U7=z7.webcrypto||globalThis.crypto,Hn=U7.subtle,B4=new TextEncoder;function bM(r){return U7.getRandomValues(Buffer.alloc(r))}async function q4(r){try{return z7.createHash("md5").update(r,"utf-8").digest("hex")}catch{let t=typeof r=="string"?B4.encode(r):r,i=await Hn.digest("MD5",t);return Array.from(new Uint8Array(i)).map(s=>s.toString(16).padStart(2,"0")).join("")}}async function vM(r,e,t){let i=await q4(e+r);return"md5"+await q4(Buffer.concat([Buffer.from(i),t]))}async function SM(r){return await Hn.digest("SHA-256",r)}async function xM(r,e){return await Hn.digest(r,e)}async function TM(r,e){let t=await Hn.importKey("raw",r,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await Hn.sign("HMAC",t,B4.encode(e))}async function _M(r,e,t){let i=await Hn.importKey("raw",B4.encode(r),"PBKDF2",!1,["deriveBits"]),s={name:"PBKDF2",hash:"SHA-256",salt:e,iterations:t};return await Hn.deriveBits(s,i,256,["deriveBits"])}});var z4=O((Ete,W4)=>{"use strict";var EM=parseInt(process.versions&&process.versions.node&&process.versions.node.split(".")[0])<15;EM?W4.exports=W7():W4.exports=V7()});var G7=O((Nte,Q7)=>{function Qn(r,e){return new Error("SASL channel binding: "+r+" when parsing public certificate "+e.toString("base64"))}function U4(r,e){let t=r[e++];if(t<128)return{length:t,index:e};let i=t&127;if(i>4)throw Qn("bad length",r);t=0;for(let s=0;s<i;s++)t=t<<8|r[e++];return{length:t,index:e}}function H7(r,e){if(r[e++]!==6)throw Qn("non-OID data",r);let{length:t,index:i}=U4(r,e);e=i;let s=e+t,n=r[e++],a=(n/40>>0)+"."+n%40;for(;e<s;){let o=0;for(;e<s;){let l=r[e++];if(o=o<<7|l&127,l<128)break}a+="."+o}return{oid:a,index:e}}function ld(r,e){if(r[e++]!==48)throw Qn("non-sequence data",r);return U4(r,e)}function NM(r,e){e===void 0&&(e=0),e=ld(r,e).index;let{length:t,index:i}=ld(r,e);e=i+t,e=ld(r,e).index;let{oid:s,index:n}=H7(r,e);switch(s){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(e=n,e=ld(r,e).index,r[e++]!==160)throw Qn("non-tag data",r);e=U4(r,e).index,e=ld(r,e).index;let{oid:a}=H7(r,e);switch(a){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw Qn("unknown hash OID "+a,r)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw Qn("Ed448 certificate channel binding is not currently supported by Postgres")}throw Qn("unknown OID "+s,r)}Q7.exports={signatureAlgorithmHashFromCertificate:NM}});var Y7=O((Cte,X7)=>{"use strict";var Fs=z4(),{signatureAlgorithmHashFromCertificate:CM}=G7();function AM(r,e){let t=["SCRAM-SHA-256"];e&&t.unshift("SCRAM-SHA-256-PLUS");let i=t.find(a=>r.includes(a));if(!i)throw new Error("SASL: Only mechanism(s) "+t.join(" and ")+" are supported");if(i==="SCRAM-SHA-256-PLUS"&&typeof e.getPeerCertificate!="function")throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let s=Fs.randomBytes(18).toString("base64");return{mechanism:i,clientNonce:s,response:(i==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":e?"y":"n")+",,n=*,r="+s,message:"SASLInitialResponse"}}async function RM(r,e,t,i){if(r.message!=="SASLInitialResponse")throw new Error("SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(e==="")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof t!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let s=IM(t);if(s.nonce.startsWith(r.clientNonce)){if(s.nonce.length===r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");let n="n=*,r="+r.clientNonce,a="r="+s.nonce+",s="+s.salt+",i="+s.iteration,o=i?"eSws":"biws";if(r.mechanism==="SCRAM-SHA-256-PLUS"){let S=i.getPeerCertificate().raw,y=CM(S);(y==="MD5"||y==="SHA-1")&&(y="SHA-256");let _=await Fs.hashByName(y,S);o=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(_)]).toString("base64")}let l="c="+o+",r="+s.nonce,c=n+","+a+","+l,d=Buffer.from(s.salt,"base64"),p=await Fs.deriveKey(e,d,s.iteration),m=await Fs.hmacSha256(p,"Client Key"),h=await Fs.sha256(m),f=await Fs.hmacSha256(h,c),w=OM(Buffer.from(m),Buffer.from(f)).toString("base64"),b=await Fs.hmacSha256(p,"Server Key"),v=await Fs.hmacSha256(b,c);r.message="SASLResponse",r.serverSignature=Buffer.from(v).toString("base64"),r.response=l+",p="+w}function MM(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: Last message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=PM(e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function kM(r){if(typeof r!="string")throw new TypeError("SASL: text must be a string");return r.split("").map((e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function K7(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(r)}function J7(r){if(typeof r!="string")throw new TypeError("SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0],i=e.substring(2);return[t,i]}))}function IM(r){let e=J7(r),t=e.get("r");if(t){if(!kM(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");let i=e.get("s");if(i){if(!K7(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let s=e.get("i");if(s){if(!/^[1-9][0-9]*$/.test(s))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");let n=parseInt(s,10);return{nonce:t,salt:i,iteration:n}}function PM(r){let t=J7(r).get("v");if(t){if(!K7(t))throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}}function OM(r,e){if(!Buffer.isBuffer(r))throw new TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(e))throw new TypeError("second argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer lengths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return Buffer.from(r.map((t,i)=>r[i]^e[i]))}X7.exports={startSession:AM,continueSession:RM,finalizeSession:MM}});var sh=O((Ate,Z7)=>{"use strict";var DM=ad();function ih(r){this._types=r||DM,this.text={},this.binary={}}ih.prototype.getOverrides=function(r){switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}};ih.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"),this.getOverrides(e)[r]=t};ih.prototype.getTypeParser=function(r,e){return e=e||"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Z7.exports=ih});var rb=O((Rte,tb)=>{"use strict";function $o(r,e={}){if(r.charAt(0)==="/"){let l=r.split(" ");return{host:l[0],database:l[1]}}let t={},i,s=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)&&(r=encodeURI(r).replace(/%25(\d\d)/g,"%$1"));try{try{i=new URL(r,"postgres://base")}catch{i=new URL(r.replace("@/","@___DUMMY___/"),"postgres://base"),s=!0}}catch(l){l.input&&(l.input="*****REDACTED*****")}for(let l of i.searchParams.entries())t[l[0]]=l[1];if(t.user=t.user||decodeURIComponent(i.username),t.password=t.password||decodeURIComponent(i.password),i.protocol=="socket:")return t.host=decodeURI(i.pathname),t.database=i.searchParams.get("db"),t.client_encoding=i.searchParams.get("encoding"),t;let n=s?"":i.hostname;t.host?n&&/^%2f/i.test(n)&&(i.pathname=n+i.pathname):t.host=decodeURIComponent(n),t.port||(t.port=i.port);let a=i.pathname.slice(1)||null;t.database=a?decodeURI(a):null,(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0"&&(t.ssl=!1),(t.sslcert||t.sslkey||t.sslrootcert||t.sslmode)&&(t.ssl={});let o=t.sslcert||t.sslkey||t.sslrootcert?require("fs"):null;if(t.sslcert&&(t.ssl.cert=o.readFileSync(t.sslcert).toString()),t.sslkey&&(t.ssl.key=o.readFileSync(t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=o.readFileSync(t.sslrootcert).toString()),e.useLibpqCompat&&t.uselibpqcompat)throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(t.uselibpqcompat==="true"||e.useLibpqCompat)switch(t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":{t.ssl.rejectUnauthorized=!1;break}case"require":{t.sslrootcert?t.ssl.checkServerIdentity=function(){}:t.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!t.ssl.ca)throw new Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");t.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}}return t}function $M(r){return Object.entries(r).reduce((t,[i,s])=>(s!=null&&(t[i]=s),t),{})}function eb(r){return Object.entries(r).reduce((t,[i,s])=>{if(i==="ssl"){let n=s;typeof n=="boolean"&&(t[i]=n),typeof n=="object"&&(t[i]=$M(n))}else if(s!=null)if(i==="port"){if(s!==""){let n=parseInt(s,10);if(isNaN(n))throw new Error(`Invalid ${i}: ${s}`);t[i]=n}}else t[i]=s;return t},{})}function FM(r){return eb($o(r))}tb.exports=$o;$o.parse=$o;$o.toClientConfig=eb;$o.parseIntoClientConfig=FM});var V4=O((Mte,nb)=>{"use strict";var LM=require("dns"),sb=od(),ib=rb().parse,Bt=function(r,e,t){return t===void 0?t=process.env["PG"+r.toUpperCase()]:t===!1||(t=process.env[t]),e[r]||t||sb[r]},qM=function(){switch(process.env.PGSSLMODE){case"disable":return!1;case"prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify":return{rejectUnauthorized:!1}}return sb.ssl},Fo=function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},Nr=function(r,e,t){let i=e[t];i!=null&&r.push(t+"="+Fo(i))},j4=class{constructor(e){e=typeof e=="string"?ib(e):e||{},e.connectionString&&(e=Object.assign({},e,ib(e.connectionString))),this.user=Bt("user",e),this.database=Bt("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt(Bt("port",e),10),this.host=Bt("host",e),Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:Bt("password",e)}),this.binary=Bt("binary",e),this.options=Bt("options",e),this.ssl=typeof e.ssl>"u"?qM():e.ssl,typeof this.ssl=="string"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}),this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this.client_encoding=Bt("client_encoding",e),this.replication=Bt("replication",e),this.isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=Bt("application_name",e,"PGAPPNAME"),this.fallback_application_name=Bt("fallback_application_name",e,!1),this.statement_timeout=Bt("statement_timeout",e,!1),this.lock_timeout=Bt("lock_timeout",e,!1),this.idle_in_transaction_session_timeout=Bt("idle_in_transaction_session_timeout",e,!1),this.query_timeout=Bt("query_timeout",e,!1),e.connectionTimeoutMillis===void 0?this.connect_timeout=process.env.PGCONNECT_TIMEOUT||0:this.connect_timeout=Math.floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive===!0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis=="number"&&(this.keepalives_idle=Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){let t=[];Nr(t,this,"user"),Nr(t,this,"password"),Nr(t,this,"port"),Nr(t,this,"application_name"),Nr(t,this,"fallback_application_name"),Nr(t,this,"connect_timeout"),Nr(t,this,"options");let i=typeof this.ssl=="object"?this.ssl:this.ssl?{sslmode:this.ssl}:{};if(Nr(t,i,"sslmode"),Nr(t,i,"sslca"),Nr(t,i,"sslkey"),Nr(t,i,"sslcert"),Nr(t,i,"sslrootcert"),this.database&&t.push("dbname="+Fo(this.database)),this.replication&&t.push("replication="+Fo(this.replication)),this.host&&t.push("host="+Fo(this.host)),this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("client_encoding="+Fo(this.client_encoding)),LM.lookup(this.host,function(s,n){return s?e(s,null):(t.push("hostaddr="+Fo(n)),e(null,t.join(" ")))})}};nb.exports=j4});var Q4=O((kte,ob)=>{"use strict";var BM=ad(),ab=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/,H4=class{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null,this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null,this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray),this._prebuiltEmptyResultObject=null}addCommandComplete(e){let t;e.text?t=ab.exec(e.text):t=ab.exec(e.command),t&&(this.command=t[1],t[3]?(this.oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt(t[2],10)))}_parseRowAsArray(e){let t=new Array(e.length);for(let i=0,s=e.length;i<s;i++){let n=e[i];n!==null?t[i]=this._parsers[i](n):t[i]=null}return t}parseRow(e){let t={...this._prebuiltEmptyResultObject};for(let i=0,s=e.length;i<s;i++){let n=e[i],a=this.fields[i].name;if(n!==null){let o=this.fields[i].format==="binary"?Buffer.from(n):n;t[a]=this._parsers[i](o)}else t[a]=null}return t}addRow(e){this.rows.push(e)}addFields(e){this.fields=e,this.fields.length&&(this._parsers=new Array(e.length));let t={};for(let i=0;i<e.length;i++){let s=e[i];t[s.name]=null,this._types?this._parsers[i]=this._types.getTypeParser(s.dataTypeID,s.format||"text"):this._parsers[i]=BM.getTypeParser(s.dataTypeID,s.format||"text")}this._prebuiltEmptyResultObject={...t}}};ob.exports=H4});var pb=O((Ite,db)=>{"use strict";var{EventEmitter:WM}=require("events"),lb=Q4(),cb=Oo(),G4=class extends WM{constructor(e,t,i){super(),e=cb.normalizeQueryConfig(e,t,i),this.text=e.text,this.values=e.values,this.rows=e.rows,this.types=e.types,this.name=e.name,this.queryMode=e.queryMode,this.binary=e.binary,this.portal=e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,process.domain&&e.callback&&(this.callback=process.domain.bind(e.callback)),this._result=new lb(this._rowMode,this.types),this._results=this._result,this._canceledDueToError=!1}requiresPreparation(){return this.queryMode==="extended"||this.name||this.rows?!0:!this.text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&&(Array.isArray(this._results)||(this._results=[this._result]),this._result=new lb(this._rowMode,this._result._types),this._results.push(this._result))}handleRowDescription(e){this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this.callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){try{t=this._result.parseRow(e.fields)}catch(i){this._canceledDueToError=i;return}this.emit("row",t,this._result),this._accumulateRows&&this._result.addRow(t)}}handleCommandComplete(e,t){this._checkForMultirow(),this._result.addCommandComplete(e),this.rows&&t.sync()}handleEmptyQuery(e){this.rows&&e.sync()}handleError(e,t){if(this._canceledDueToError&&(e=this._canceledDueToError,this._canceledDueToError=!1),this.callback)return this.callback(e);this.emit("error",e)}handleReadyForQuery(e){if(this._canceledDueToError)return this.handleError(this._canceledDueToError,e);if(this.callback)try{this.callback(null,this._results)}catch(t){process.nextTick(()=>{throw t})}this.emit("end",this._results)}submit(e){if(typeof this.text!="string"&&typeof this.name!="string")return new Error("A query must have either text or a name. Supplying neither is unsupported.");let t=e.parsedStatements[this.name];if(this.text&&t&&this.text!==t)return new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);if(this.values&&!Array.isArray(this.values))return new Error("Query values must be an array");if(this.requiresPreparation()){e.stream.cork&&e.stream.cork();try{this.prepare(e)}finally{e.stream.uncork&&e.stream.uncork()}}else e.query(this.text);return null}hasBeenParsed(e){return this.name&&e.parsedStatements[this.name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execute({portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types});try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this.binary,valueMapper:cb.prepareValue})}catch(t){this.handleError(t,e);return}e.describe({type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};db.exports=G4});var cy=O(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.NoticeMessage=Y.DataRowMessage=Y.CommandCompleteMessage=Y.ReadyForQueryMessage=Y.NotificationResponseMessage=Y.BackendKeyDataMessage=Y.AuthenticationMD5Password=Y.ParameterStatusMessage=Y.ParameterDescriptionMessage=Y.RowDescriptionMessage=Y.Field=Y.CopyResponse=Y.CopyDataMessage=Y.DatabaseError=Y.copyDone=Y.emptyQuery=Y.replicationStart=Y.portalSuspended=Y.noData=Y.closeComplete=Y.bindComplete=Y.parseComplete=void 0;Y.parseComplete={name:"parseComplete",length:5};Y.bindComplete={name:"bindComplete",length:5};Y.closeComplete={name:"closeComplete",length:5};Y.noData={name:"noData",length:5};Y.portalSuspended={name:"portalSuspended",length:5};Y.replicationStart={name:"replicationStart",length:4};Y.emptyQuery={name:"emptyQuery",length:4};Y.copyDone={name:"copyDone",length:4};var K4=class extends Error{constructor(e,t,i){super(e),this.length=t,this.name=i}};Y.DatabaseError=K4;var J4=class{constructor(e,t){this.length=e,this.chunk=t,this.name="copyData"}};Y.CopyDataMessage=J4;var X4=class{constructor(e,t,i,s){this.length=e,this.name=t,this.binary=i,this.columnTypes=new Array(s)}};Y.CopyResponse=X4;var Y4=class{constructor(e,t,i,s,n,a,o){this.name=e,this.tableID=t,this.columnID=i,this.dataTypeID=s,this.dataTypeSize=n,this.dataTypeModifier=a,this.format=o}};Y.Field=Y4;var Z4=class{constructor(e,t){this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=new Array(this.fieldCount)}};Y.RowDescriptionMessage=Z4;var ey=class{constructor(e,t){this.length=e,this.parameterCount=t,this.name="parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};Y.ParameterDescriptionMessage=ey;var ty=class{constructor(e,t,i){this.length=e,this.parameterName=t,this.parameterValue=i,this.name="parameterStatus"}};Y.ParameterStatusMessage=ty;var ry=class{constructor(e,t){this.length=e,this.salt=t,this.name="authenticationMD5Password"}};Y.AuthenticationMD5Password=ry;var iy=class{constructor(e,t,i){this.length=e,this.processID=t,this.secretKey=i,this.name="backendKeyData"}};Y.BackendKeyDataMessage=iy;var sy=class{constructor(e,t,i,s){this.length=e,this.processId=t,this.channel=i,this.payload=s,this.name="notification"}};Y.NotificationResponseMessage=sy;var ny=class{constructor(e,t){this.length=e,this.status=t,this.name="readyForQuery"}};Y.ReadyForQueryMessage=ny;var ay=class{constructor(e,t){this.length=e,this.text=t,this.name="commandComplete"}};Y.CommandCompleteMessage=ay;var oy=class{constructor(e,t){this.length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}};Y.DataRowMessage=oy;var ly=class{constructor(e,t){this.length=e,this.message=t,this.name="notice"}};Y.NoticeMessage=ly});var ub=O(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.Writer=void 0;var dy=class{constructor(e=256){this.size=e,this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(e)}ensure(e){if(this.buffer.length-this.offset<e){let i=this.buffer,s=i.length+(i.length>>1)+e;this.buffer=Buffer.allocUnsafe(s),i.copy(this.buffer)}}addInt32(e){return this.ensure(4),this.buffer[this.offset++]=e>>>24&255,this.buffer[this.offset++]=e>>>16&255,this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addInt16(e){return this.ensure(2),this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addCString(e){if(!e)this.ensure(1);else{let t=Buffer.byteLength(e);this.ensure(t+1),this.buffer.write(e,this.offset,"utf-8"),this.offset+=t}return this.buffer[this.offset++]=0,this}addString(e=""){let t=Buffer.byteLength(e);return this.ensure(t),this.buffer.write(e,this.offset),this.offset+=t,this}add(e){return this.ensure(e.length),e.copy(this.buffer,this.offset),this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let t=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)}return this.buffer.slice(e?0:5,this.offset)}flush(e){let t=this.join(e);return this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(this.size),t}};nh.Writer=dy});var hb=O(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.serialize=void 0;var py=ub(),Ce=new py.Writer,zM=r=>{Ce.addInt16(3).addInt16(0);for(let i of Object.keys(r))Ce.addCString(i).addCString(r[i]);Ce.addCString("client_encoding").addCString("UTF8");let e=Ce.addCString("").flush(),t=e.length+4;return new py.Writer().addInt32(t).add(e).flush()},UM=()=>{let r=Buffer.allocUnsafe(8);return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},jM=r=>Ce.addCString(r).flush(112),VM=function(r,e){return Ce.addCString(r).addInt32(Buffer.byteLength(e)).addString(e),Ce.flush(112)},HM=function(r){return Ce.addString(r).flush(112)},QM=r=>Ce.addCString(r).flush(81),mb=[],GM=r=>{let e=r.name||"";e.length>63&&(console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",e,e.length),console.error("This can cause conflicts and silent errors executing queries"));let t=r.types||mb,i=t.length,s=Ce.addCString(e).addCString(r.text).addInt16(i);for(let n=0;n<i;n++)s.addInt32(t[n]);return Ce.flush(80)},Lo=new py.Writer,KM=function(r,e){for(let t=0;t<r.length;t++){let i=e?e(r[t],t):r[t];i==null?(Ce.addInt16(0),Lo.addInt32(-1)):i instanceof Buffer?(Ce.addInt16(1),Lo.addInt32(i.length),Lo.add(i)):(Ce.addInt16(0),Lo.addInt32(Buffer.byteLength(i)),Lo.addString(i))}},JM=(r={})=>{let e=r.portal||"",t=r.statement||"",i=r.binary||!1,s=r.values||mb,n=s.length;return Ce.addCString(e).addCString(t),Ce.addInt16(n),KM(s,r.valueMapper),Ce.addInt16(n),Ce.add(Lo.flush()),Ce.addInt16(1),Ce.addInt16(i?1:0),Ce.flush(66)},XM=Buffer.from([69,0,0,0,9,0,0,0,0,0]),YM=r=>{if(!r||!r.portal&&!r.rows)return XM;let e=r.portal||"",t=r.rows||0,i=Buffer.byteLength(e),s=4+i+1+4,n=Buffer.allocUnsafe(1+s);return n[0]=69,n.writeInt32BE(s,1),n.write(e,5,"utf-8"),n[i+5]=0,n.writeUInt32BE(t,n.length-4),n},ZM=(r,e)=>{let t=Buffer.allocUnsafe(16);return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE(r,8),t.writeInt32BE(e,12),t},uy=(r,e)=>{let i=4+Buffer.byteLength(e)+1,s=Buffer.allocUnsafe(1+i);return s[0]=r,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[i]=0,s},ek=Ce.addCString("P").flush(68),tk=Ce.addCString("S").flush(68),rk=r=>r.name?uy(68,`${r.type}${r.name||""}`):r.type==="P"?ek:tk,ik=r=>{let e=`${r.type}${r.name||""}`;return uy(67,e)},sk=r=>Ce.add(r).flush(100),nk=r=>uy(102,r),ah=r=>Buffer.from([r,0,0,0,4]),ak=ah(72),ok=ah(83),lk=ah(88),ck=ah(99),dk={startup:zM,password:jM,requestSsl:UM,sendSASLInitialResponseMessage:VM,sendSCRAMClientFinalMessage:HM,query:QM,parse:GM,bind:JM,execute:YM,describe:rk,close:ik,flush:()=>ak,sync:()=>ok,end:()=>lk,copyData:sk,copyDone:()=>ck,copyFail:nk,cancel:ZM};oh.serialize=dk});var fb=O(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.BufferReader=void 0;var pk=Buffer.allocUnsafe(0),my=class{constructor(e=0){this.offset=e,this.buffer=pk,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this.buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this.buffer.readInt32BE(this.offset);return this.offset+=4,e}uint32(){let e=this.buffer.readUInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer.toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstring(){let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer.toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}};lh.BufferReader=my});var wb=O(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.Parser=void 0;var Oe=cy(),uk=fb(),hy=1,mk=4,gb=hy+mk,yb=Buffer.allocUnsafe(0),fy=class{constructor(e){if(this.buffer=yb,this.bufferLength=0,this.bufferOffset=0,this.reader=new uk.BufferReader,e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?.mode||"text"}parse(e,t){this.mergeBuffer(e);let i=this.bufferOffset+this.bufferLength,s=this.bufferOffset;for(;s+gb<=i;){let n=this.buffer[s],a=this.buffer.readUInt32BE(s+hy),o=hy+a;if(o+s<=i){let l=this.handlePacket(s+gb,n,a,this.buffer);t(l),s+=o}else break}s===i?(this.buffer=yb,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength=i-s,this.bufferOffset=s)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let s;if(t<=this.buffer.byteLength&&this.bufferOffset>=this.bufferLength)s=this.buffer;else{let n=this.buffer.byteLength*2;for(;t>=n;)n*=2;s=Buffer.allocUnsafe(n)}this.buffer.copy(s,0,this.bufferOffset,this.bufferOffset+this.bufferLength),this.buffer=s,this.bufferOffset=0}e.copy(this.buffer,this.bufferOffset+this.bufferLength),this.bufferLength=t}else this.buffer=e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,t,i,s){switch(t){case 50:return Oe.bindComplete;case 49:return Oe.parseComplete;case 51:return Oe.closeComplete;case 110:return Oe.noData;case 115:return Oe.portalSuspended;case 99:return Oe.copyDone;case 87:return Oe.replicationStart;case 73:return Oe.emptyQuery;case 68:return this.parseDataRowMessage(e,i,s);case 67:return this.parseCommandCompleteMessage(e,i,s);case 90:return this.parseReadyForQueryMessage(e,i,s);case 65:return this.parseNotificationMessage(e,i,s);case 82:return this.parseAuthenticationResponse(e,i,s);case 83:return this.parseParameterStatusMessage(e,i,s);case 75:return this.parseBackendKeyData(e,i,s);case 69:return this.parseErrorMessage(e,i,s,"error");case 78:return this.parseErrorMessage(e,i,s,"notice");case 84:return this.parseRowDescriptionMessage(e,i,s);case 116:return this.parseParameterDescriptionMessage(e,i,s);case 71:return this.parseCopyInMessage(e,i,s);case 72:return this.parseCopyOutMessage(e,i,s);case 100:return this.parseCopyData(e,i,s);default:return new Oe.DatabaseError("received invalid response: "+t.toString(16),i,"error")}}parseReadyForQueryMessage(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.string(1);return new Oe.ReadyForQueryMessage(t,s)}parseCommandCompleteMessage(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.cstring();return new Oe.CommandCompleteMessage(t,s)}parseCopyData(e,t,i){let s=i.slice(e,e+(t-4));return new Oe.CopyDataMessage(t,s)}parseCopyInMessage(e,t,i){return this.parseCopyMessage(e,t,i,"copyInResponse")}parseCopyOutMessage(e,t,i){return this.parseCopyMessage(e,t,i,"copyOutResponse")}parseCopyMessage(e,t,i,s){this.reader.setBuffer(e,i);let n=this.reader.byte()!==0,a=this.reader.int16(),o=new Oe.CopyResponse(t,s,n,a);for(let l=0;l<a;l++)o.columnTypes[l]=this.reader.int16();return o}parseNotificationMessage(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.int32(),n=this.reader.cstring(),a=this.reader.cstring();return new Oe.NotificationResponseMessage(t,s,n,a)}parseRowDescriptionMessage(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.int16(),n=new Oe.RowDescriptionMessage(t,s);for(let a=0;a<s;a++)n.fields[a]=this.parseField();return n}parseField(){let e=this.reader.cstring(),t=this.reader.uint32(),i=this.reader.int16(),s=this.reader.uint32(),n=this.reader.int16(),a=this.reader.int32(),o=this.reader.int16()===0?"text":"binary";return new Oe.Field(e,t,i,s,n,a,o)}parseParameterDescriptionMessage(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.int16(),n=new Oe.ParameterDescriptionMessage(t,s);for(let a=0;a<s;a++)n.dataTypeIDs[a]=this.reader.int32();return n}parseDataRowMessage(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.int16(),n=new Array(s);for(let a=0;a<s;a++){let o=this.reader.int32();n[a]=o===-1?null:this.reader.string(o)}return new Oe.DataRowMessage(t,n)}parseParameterStatusMessage(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.cstring(),n=this.reader.cstring();return new Oe.ParameterStatusMessage(t,s,n)}parseBackendKeyData(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.int32(),n=this.reader.int32();return new Oe.BackendKeyDataMessage(t,s,n)}parseAuthenticationResponse(e,t,i){this.reader.setBuffer(e,i);let s=this.reader.int32(),n={name:"authenticationOk",length:t};switch(s){case 0:break;case 3:n.length===8&&(n.name="authenticationCleartextPassword");break;case 5:if(n.length===12){n.name="authenticationMD5Password";let a=this.reader.bytes(4);return new Oe.AuthenticationMD5Password(t,a)}break;case 10:{n.name="authenticationSASL",n.mechanisms=[];let a;do a=this.reader.cstring(),a&&n.mechanisms.push(a);while(a)}break;case 11:n.name="authenticationSASLContinue",n.data=this.reader.string(t-8);break;case 12:n.name="authenticationSASLFinal",n.data=this.reader.string(t-8);break;default:throw new Error("Unknown authenticationOk message type "+s)}return n}parseErrorMessage(e,t,i,s){this.reader.setBuffer(e,i);let n={},a=this.reader.string(1);for(;a!=="\0";)n[a]=this.reader.cstring(),a=this.reader.string(1);let o=n.M,l=s==="notice"?new Oe.NoticeMessage(t,o):new Oe.DatabaseError(o,t,s);return l.severity=n.S,l.code=n.C,l.detail=n.D,l.hint=n.H,l.position=n.P,l.internalPosition=n.p,l.internalQuery=n.q,l.where=n.W,l.schema=n.s,l.table=n.t,l.column=n.c,l.dataType=n.d,l.constraint=n.n,l.file=n.F,l.line=n.L,l.routine=n.R,l}};ch.Parser=fy});var gy=O(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.DatabaseError=Ls.serialize=Ls.parse=void 0;var hk=cy();Object.defineProperty(Ls,"DatabaseError",{enumerable:!0,get:function(){return hk.DatabaseError}});var fk=hb();Object.defineProperty(Ls,"serialize",{enumerable:!0,get:function(){return fk.serialize}});var gk=wb();function yk(r,e){let t=new gk.Parser;return r.on("data",i=>t.parse(i,e)),new Promise(i=>r.on("end",()=>i()))}Ls.parse=yk});var bb=O(yy=>{"use strict";Object.defineProperty(yy,"__esModule",{value:!0});yy.default={}});var Sb=O((Bte,vb)=>{var{getStream:wk,getSecureStream:bk}=Tk();vb.exports={getStream:wk,getSecureStream:bk};function vk(){function r(t){let i=require("net");return new i.Socket}function e(t){return require("tls").connect(t)}return{getStream:r,getSecureStream:e}}function Sk(){function r(t){let{CloudflareSocket:i}=bb();return new i(t)}function e(t){return t.socket.startTls(t),t.socket}return{getStream:r,getSecureStream:e}}function xk(){if(typeof navigator=="object"&&navigator!==null&&typeof navigator.userAgent=="string")return navigator.userAgent==="Cloudflare-Workers";if(typeof Response=="function"){let r=new Response(null,{cf:{thing:!0}});if(typeof r.cf=="object"&&r.cf!==null&&r.cf.thing)return!0}return!1}function Tk(){return xk()?Sk():vk()}});var by=O((Wte,xb)=>{"use strict";var _k=require("events").EventEmitter,{parse:Ek,serialize:ot}=gy(),{getStream:Nk,getSecureStream:Ck}=Sb(),Ak=ot.flush(),Rk=ot.sync(),Mk=ot.end(),wy=class extends _k{constructor(e){super(),e=e||{},this.stream=e.stream||Nk(e.ssl),typeof this.stream=="function"&&(this.stream=this.stream(e)),this._keepAlive=e.keepAlive,this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer=!1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage=!1;let t=this;this.on("newListener",function(i){i==="message"&&(t._emitMessage=!0)})}connect(e,t){let i=this;this._connecting=!0,this.stream.setNoDelay(!0),this.stream.connect(e,t),this.stream.once("connect",function(){i._keepAlive&&i.stream.setKeepAlive(!0,i._keepAliveInitialDelayMillis),i.emit("connect")});let s=function(n){i._ending&&(n.code==="ECONNRESET"||n.code==="EPIPE")||i.emit("error",n)};if(this.stream.on("error",s),this.stream.on("close",function(){i.emit("end")}),!this.ssl)return this.attachListeners(this.stream);this.stream.once("data",function(n){switch(n.toString("utf8")){case"S":break;case"N":return i.stream.end(),i.emit("error",new Error("The server does not support SSL connections"));default:return i.stream.end(),i.emit("error",new Error("There was an error establishing an SSL connection"))}let o={socket:i.stream};i.ssl!==!0&&(Object.assign(o,i.ssl),"key"in i.ssl&&(o.key=i.ssl.key));let l=require("net");l.isIP&&l.isIP(t)===0&&(o.servername=t);try{i.stream=Ck(o)}catch(c){return i.emit("error",c)}i.attachListeners(i.stream),i.stream.on("error",s),i.emit("sslconnect")})}attachListeners(e){Ek(e,t=>{let i=t.name==="error"?"errorMessage":t.name;this._emitMessage&&this.emit("message",t),this.emit(i,t)})}requestSsl(){this.stream.write(ot.requestSsl())}startup(e){this.stream.write(ot.startup(e))}cancel(e,t){this._send(ot.cancel(e,t))}password(e){this._send(ot.password(e))}sendSASLInitialResponseMessage(e,t){this._send(ot.sendSASLInitialResponseMessage(e,t))}sendSCRAMClientFinalMessage(e){this._send(ot.sendSCRAMClientFinalMessage(e))}_send(e){return this.stream.writable?this.stream.write(e):!1}query(e){this._send(ot.query(e))}parse(e){this._send(ot.parse(e))}bind(e){this._send(ot.bind(e))}execute(e){this._send(ot.execute(e))}flush(){this.stream.writable&&this.stream.write(Ak)}sync(){this._ending=!0,this._send(Rk)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this.stream.end();return}return this.stream.write(Mk,()=>{this.stream.end()})}close(e){this._send(ot.close(e))}describe(e){this._send(ot.describe(e))}sendCopyFromChunk(e){this._send(ot.copyData(e))}endCopyFrom(){this._send(ot.copyDone())}sendCopyFail(e){this._send(ot.copyFail(e))}};xb.exports=wy});var Nb=O((zte,Eb)=>{"use strict";var{Transform:kk}=require("stream"),{StringDecoder:Ik}=require("string_decoder"),qs=Symbol("last"),dh=Symbol("decoder");function Pk(r,e,t){let i;if(this.overflow){if(i=this[dh].write(r).split(this.matcher),i.length===1)return t();i.shift(),this.overflow=!1}else this[qs]+=this[dh].write(r),i=this[qs].split(this.matcher);this[qs]=i.pop();for(let s=0;s<i.length;s++)try{_b(this,this.mapper(i[s]))}catch(n){return t(n)}if(this.overflow=this[qs].length>this.maxLength,this.overflow&&!this.skipOverflow){t(new Error("maximum buffer reached"));return}t()}function Ok(r){if(this[qs]+=this[dh].end(),this[qs])try{_b(this,this.mapper(this[qs]))}catch(e){return r(e)}r()}function _b(r,e){e!==void 0&&r.push(e)}function Tb(r){return r}function Dk(r,e,t){switch(r=r||/\r?\n/,e=e||Tb,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r=="object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2:typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Tb)}t=Object.assign({},t),t.autoDestroy=!0,t.transform=Pk,t.flush=Ok,t.readableObjectMode=!0;let i=new kk(t);return i[qs]="",i[dh]=new Ik("utf8"),i.matcher=r,i.mapper=e,i.maxLength=t.maxLength,i.skipOverflow=t.skipOverflow||!1,i.overflow=!1,i._destroy=function(s,n){this._writableState.errorEmitted=!1,n(s)},i}Eb.exports=Dk});var Rb=O((Ute,Gi)=>{"use strict";var Cb=require("path"),$k=require("stream").Stream,Fk=Nb(),Ab=require("util"),Lk=5432,ph=process.platform==="win32",cd=process.stderr,qk=56,Bk=7,Wk=61440,zk=32768;function Uk(r){return(r&Wk)==zk}var qo=["host","port","database","user","password"],vy=qo.length,jk=qo[vy-1];function Sy(){var r=cd instanceof $k&&cd.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(`
30
- `);cd.write(Ab.format.apply(Ab,e))}}Object.defineProperty(Gi.exports,"isWin",{get:function(){return ph},set:function(r){ph=r}});Gi.exports.warnTo=function(r){var e=cd;return cd=r,e};Gi.exports.getFileName=function(r){var e=r||process.env,t=e.PGPASSFILE||(ph?Cb.join(e.APPDATA||"./","postgresql","pgpass.conf"):Cb.join(e.HOME||"./",".pgpass"));return t};Gi.exports.usePgPass=function(r,e){return Object.prototype.hasOwnProperty.call(process.env,"PGPASSWORD")?!1:ph?!0:(e=e||"<unkn>",Uk(r.mode)?r.mode&(qk|Bk)?(Sy('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less',e),!1):!0:(Sy('WARNING: password file "%s" is not a plain file',e),!1))};var Vk=Gi.exports.match=function(r,e){return qo.slice(0,-1).reduce(function(t,i,s){return s==1&&Number(r[i]||Lk)===Number(e[i])?t&&!0:t&&(e[i]==="*"||e[i]===r[i])},!0)};Gi.exports.getPassword=function(r,e,t){var i,s=e.pipe(Fk());function n(l){var c=Hk(l);c&&Qk(c)&&Vk(r,c)&&(i=c[jk],s.end())}var a=function(){e.destroy(),t(i)},o=function(l){e.destroy(),Sy("WARNING: error on reading file: %s",l),t(void 0)};e.on("error",o),s.on("data",n).on("end",a).on("error",o)};var Hk=Gi.exports.parseLine=function(r){if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",i=0,s=0,n=0,a={},o=!1,l=function(d,p,m){var h=r.substring(p,m);Object.hasOwnProperty.call(process.env,"PGPASS_NO_DEESCAPE")||(h=h.replace(/\\([:\\])/g,"$1")),a[qo[d]]=h},c=0;c<r.length-1;c+=1){if(e=r.charAt(c+1),t=r.charAt(c),o=i==vy-1,o){l(i,s);break}c>=0&&e==":"&&t!=="\\"&&(l(i,s,c+1),s=c+2,i+=1)}return a=Object.keys(a).length===vy?a:null,a},Qk=Gi.exports.isValidEntry=function(r){for(var e={0:function(a){return a.length>0},1:function(a){return a==="*"?!0:(a=Number(a),isFinite(a)&&a>0&&a<9007199254740992&&Math.floor(a)===a)},2:function(a){return a.length>0},3:function(a){return a.length>0},4:function(a){return a.length>0}},t=0;t<qo.length;t+=1){var i=e[t],s=r[qo[t]]||"",n=i(s);if(!n)return!1}return!0}});var kb=O((Vte,xy)=>{"use strict";var jte=require("path"),Mb=require("fs"),uh=Rb();xy.exports=function(r,e){var t=uh.getFileName();Mb.stat(t,function(i,s){if(i||!uh.usePgPass(s,t))return e(void 0);var n=Mb.createReadStream(t);uh.getPassword(r,n,e)})};xy.exports.warnTo=uh.warnTo});var Db=O((Hte,Ob)=>{"use strict";var Gk=require("events").EventEmitter,Ib=Oo(),Ty=Y7(),Kk=sh(),Jk=V4(),Pb=pb(),Xk=od(),Yk=by(),Zk=z4(),mh=class extends Gk{constructor(e){super(),this.connectionParameters=new Jk(e),this.user=this.connectionParameters.user,this.database=this.connectionParameters.database,this.port=this.connectionParameters.port,this.host=this.connectionParameters.host,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}),this.replication=this.connectionParameters.replication;let t=e||{};this._Promise=t.Promise||global.Promise,this._types=new Kk(t.types),this._ending=!1,this._ended=!1,this._connecting=!1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.enableChannelBinding=!!t.enableChannelBinding,this.connection=t.connection||new Yk({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t.keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this.connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t.binary||Xk.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters.ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=i=>{process.nextTick(()=>{i.handleError(e,this.connection)})};this.activeQuery&&(t(this.activeQuery),this.activeQuery=null),this.queryQueue.forEach(t),this.queryQueue.length=0}_connect(e){let t=this,i=this.connection;if(this._connectionCallback=e,this._connecting||this._connected){let s=new Error("Client has already been connected. You cannot reuse a client.");process.nextTick(()=>{e(s)});return}this._connecting=!0,this._connectionTimeoutMillis>0&&(this.connectionTimeoutHandle=setTimeout(()=>{i._ending=!0,i.stream.destroy(new Error("timeout expired"))},this._connectionTimeoutMillis),this.connectionTimeoutHandle.unref&&this.connectionTimeoutHandle.unref()),this.host&&this.host.indexOf("/")===0?i.connect(this.host+"/.s.PGSQL."+this.port):i.connect(this.port,this.host),i.on("connect",function(){t.ssl?i.requestSsl():i.startup(t.getStartupConf())}),i.on("sslconnect",function(){i.startup(t.getStartupConf())}),this._attachListeners(i),i.once("end",()=>{let s=this._ending?new Error("Connection terminated"):new Error("Connection terminated unexpectedly");clearTimeout(this.connectionTimeoutHandle),this._errorAllQueries(s),this._ended=!0,this._ending||(this._connecting&&!this._connectionError?this._connectionCallback?this._connectionCallback(s):this._handleErrorEvent(s):this._connectionError||this._handleErrorEvent(s)),process.nextTick(()=>{this.emit("end")})})}connect(e){if(e){this._connect(e);return}return new this._Promise((t,i)=>{this._connect(s=>{s?i(s):t()})})}_attachListeners(e){e.on("authenticationCleartextPassword",this._handleAuthCleartextPassword.bind(this)),e.on("authenticationMD5Password",this._handleAuthMD5Password.bind(this)),e.on("authenticationSASL",this._handleAuthSASL.bind(this)),e.on("authenticationSASLContinue",this._handleAuthSASLContinue.bind(this)),e.on("authenticationSASLFinal",this._handleAuthSASLFinal.bind(this)),e.on("backendKeyData",this._handleBackendKeyData.bind(this)),e.on("error",this._handleErrorEvent.bind(this)),e.on("errorMessage",this._handleErrorMessage.bind(this)),e.on("readyForQuery",this._handleReadyForQuery.bind(this)),e.on("notice",this._handleNotice.bind(this)),e.on("rowDescription",this._handleRowDescription.bind(this)),e.on("dataRow",this._handleDataRow.bind(this)),e.on("portalSuspended",this._handlePortalSuspended.bind(this)),e.on("emptyQuery",this._handleEmptyQuery.bind(this)),e.on("commandComplete",this._handleCommandComplete.bind(this)),e.on("parseComplete",this._handleParseComplete.bind(this)),e.on("copyInResponse",this._handleCopyInResponse.bind(this)),e.on("copyData",this._handleCopyData.bind(this)),e.on("notification",this._handleNotification.bind(this))}_checkPgPass(e){let t=this.connection;if(typeof this.password=="function")this._Promise.resolve().then(()=>this.password()).then(i=>{if(i!==void 0){if(typeof i!="string"){t.emit("error",new TypeError("Password must be a string"));return}this.connectionParameters.password=this.password=i}else this.connectionParameters.password=this.password=null;e()}).catch(i=>{t.emit("error",i)});else if(this.password!==null)e();else try{kb()(this.connectionParameters,s=>{s!==void 0&&(this.connectionParameters.password=this.password=s),e()})}catch(i){this.emit("error",i)}}_handleAuthCleartextPassword(e){this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){this._checkPgPass(async()=>{try{let t=await Zk.postgresMd5PasswordHash(this.user,this.password,e.salt);this.connection.password(t)}catch(t){this.emit("error",t)}})}_handleAuthSASL(e){this._checkPgPass(()=>{try{this.saslSession=Ty.startSession(e.mechanisms,this.enableChannelBinding&&this.connection.stream),this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism,this.saslSession.response)}catch(t){this.connection.emit("error",t)}})}async _handleAuthSASLContinue(e){try{await Ty.continueSession(this.saslSession,this.password,e.data,this.enableChannelBinding&&this.connection.stream),this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}catch(t){this.connection.emit("error",t)}}_handleAuthSASLFinal(e){try{Ty.finalizeSession(this.saslSession,e.data),this.saslSession=null}catch(t){this.connection.emit("error",t)}}_handleBackendKeyData(e){this.processID=e.processID,this.secretKey=e.secretKey}_handleReadyForQuery(e){this._connecting&&(this._connecting=!1,this._connected=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback&&(this._connectionCallback(null,this),this._connectionCallback=null),this.emit("connect"));let{activeQuery:t}=this;this.activeQuery=null,this.readyForQuery=!0,t&&t.handleReadyForQuery(this.connection),this._pulseQueryQueue()}_handleErrorWhileConnecting(e){if(!this._connectionError){if(this._connectionError=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback)return this._connectionCallback(e);this.emit("error",e)}}_handleErrorEvent(e){if(this._connecting)return this._handleErrorWhileConnecting(e);this._queryable=!1,this._errorAllQueries(e),this.emit("error",e)}_handleErrorMessage(e){if(this._connecting)return this._handleErrorWhileConnecting(e);let t=this.activeQuery;if(!t){this._handleErrorEvent(e);return}this.activeQuery=null,t.handleError(e,this.connection)}_handleRowDescription(e){this.activeQuery.handleRowDescription(e)}_handleDataRow(e){this.activeQuery.handleDataRow(e)}_handlePortalSuspended(e){this.activeQuery.handlePortalSuspended(this.connection)}_handleEmptyQuery(e){this.activeQuery.handleEmptyQuery(this.connection)}_handleCommandComplete(e){if(this.activeQuery==null){let t=new Error("Received unexpected commandComplete message from backend.");this._handleErrorEvent(t);return}this.activeQuery.handleCommandComplete(e,this.connection)}_handleParseComplete(){if(this.activeQuery==null){let e=new Error("Received unexpected parseComplete message from backend.");this._handleErrorEvent(e);return}this.activeQuery.name&&(this.connection.parsedStatements[this.activeQuery.name]=this.activeQuery.text)}_handleCopyInResponse(e){this.activeQuery.handleCopyInResponse(this.connection)}_handleCopyData(e){this.activeQuery.handleCopyData(e,this.connection)}_handleNotification(e){this.emit("notification",e)}_handleNotice(e){this.emit("notice",e)}getStartupConf(){let e=this.connectionParameters,t={user:e.user,database:e.database},i=e.application_name||e.fallback_application_name;return i&&(t.application_name=i),e.replication&&(t.replication=""+e.replication),e.statement_timeout&&(t.statement_timeout=String(parseInt(e.statement_timeout,10))),e.lock_timeout&&(t.lock_timeout=String(parseInt(e.lock_timeout,10))),e.idle_in_transaction_session_timeout&&(t.idle_in_transaction_session_timeout=String(parseInt(e.idle_in_transaction_session_timeout,10))),e.options&&(t.options=e.options),t}cancel(e,t){if(e.activeQuery===t){let i=this.connection;this.host&&this.host.indexOf("/")===0?i.connect(this.host+"/.s.PGSQL."+this.port):i.connect(this.port,this.host),i.on("connect",function(){i.cancel(e.processID,e.secretKey)})}else e.queryQueue.indexOf(t)!==-1&&e.queryQueue.splice(e.queryQueue.indexOf(t),1)}setTypeParser(e,t,i){return this._types.setTypeParser(e,t,i)}getTypeParser(e,t){return this._types.getTypeParser(e,t)}escapeIdentifier(e){return Ib.escapeIdentifier(e)}escapeLiteral(e){return Ib.escapeLiteral(e)}_pulseQueryQueue(){if(this.readyForQuery===!0)if(this.activeQuery=this.queryQueue.shift(),this.activeQuery){this.readyForQuery=!1,this.hasExecuted=!0;let e=this.activeQuery.submit(this.connection);e&&process.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyForQuery=!0,this._pulseQueryQueue()})}else this.hasExecuted&&(this.activeQuery=null,this.emit("drain"))}query(e,t,i){let s,n,a,o,l;if(e==null)throw new TypeError("Client was passed a null or undefined query");return typeof e.submit=="function"?(a=e.query_timeout||this.connectionParameters.query_timeout,n=s=e,typeof t=="function"&&(s.callback=s.callback||t)):(a=e.query_timeout||this.connectionParameters.query_timeout,s=new Pb(e,t,i),s.callback||(n=new this._Promise((c,d)=>{s.callback=(p,m)=>p?d(p):c(m)}).catch(c=>{throw Error.captureStackTrace(c),c}))),a&&(l=s.callback,o=setTimeout(()=>{let c=new Error("Query read timeout");process.nextTick(()=>{s.handleError(c,this.connection)}),l(c),s.callback=()=>{};let d=this.queryQueue.indexOf(s);d>-1&&this.queryQueue.splice(d,1),this._pulseQueryQueue()},a),s.callback=(c,d)=>{clearTimeout(o),l(c,d)}),this.binary&&!s.binary&&(s.binary=!0),s._result&&!s._result._types&&(s._result._types=this._types),this._queryable?this._ending?(process.nextTick(()=>{s.handleError(new Error("Client was closed and is not queryable"),this.connection)}),n):(this.queryQueue.push(s),this._pulseQueryQueue(),n):(process.nextTick(()=>{s.handleError(new Error("Client has encountered a connection error and is not queryable"),this.connection)}),n)}ref(){this.connection.ref()}unref(){this.connection.unref()}end(e){if(this._ending=!0,!this.connection._connecting||this._ended)if(e)e();else return this._Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream.destroy():this.connection.end(),e)this.connection.once("end",e);else return new this._Promise(t=>{this.connection.once("end",t)})}};mh.Query=Pb;Ob.exports=mh});var qb=O((Qte,Lb)=>{"use strict";var eI=require("events").EventEmitter,$b=function(){},Fb=(r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]},_y=class{constructor(e,t,i){this.client=e,this.idleListener=t,this.timeoutId=i}},Bo=class{constructor(e){this.callback=e}};function tI(){throw new Error("Release called on client which has already been released to the pool.")}function hh(r,e){if(e)return{callback:e,result:void 0};let t,i,s=function(a,o){a?t(a):i(o)},n=new r(function(a,o){i=a,t=o}).catch(a=>{throw Error.captureStackTrace(a),a});return{callback:s,result:n}}function rI(r,e){return function t(i){i.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional client error after disconnection due to error",i)}),r._remove(e),r.emit("error",i,e)}}var Ey=class extends eI{constructor(e,t){super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty(this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}),e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}),this.options.max=this.options.max||this.options.poolSize||10,this.options.min=this.options.min||0,this.options.maxUses=this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle||!1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this.options.log||function(){},this.Client=this.options.Client||t||Ny().Client,this.Promise=this.options.Promise||global.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this.options.idleTimeoutMillis=1e4),this._clients=[],this._idle=[],this._expired=new WeakSet,this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_isFull(){return this._clients.length>=this.options.max}_isAboveMin(){return this._clients.length>this.options.min}_pulseQueue(){if(this.log("pulse queue"),this.ended){this.log("pulse queue ended");return}if(this.ending){this.log("pulse queue on ending"),this._idle.length&&this._idle.slice().map(t=>{this._remove(t.client)}),this._clients.length||(this.ended=!0,this._endCallback());return}if(!this._pendingQueue.length){this.log("no queued requests");return}if(!this._idle.length&&this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this._idle.pop();clearTimeout(t.timeoutId);let i=t.client;i.ref&&i.ref();let s=t.idleListener;return this._acquireClient(i,e,s,!1)}if(!this._isFull())return this.newClient(e);throw new Error("unexpected condition")}_remove(e,t){let i=Fb(this._idle,n=>n.client===e);i!==void 0&&clearTimeout(i.timeoutId),this._clients=this._clients.filter(n=>n!==e);let s=this;e.end(()=>{s.emit("remove",e),typeof t=="function"&&t()})}connect(e){if(this.ending){let s=new Error("Cannot use a pool after calling end on the pool");return e?e(s):this.Promise.reject(s)}let t=hh(this.Promise,e),i=t.result;if(this._isFull()||this._idle.length){if(this._idle.length&&process.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis)return this._pendingQueue.push(new Bo(t.callback)),i;let s=(o,l,c)=>{clearTimeout(a),t.callback(o,l,c)},n=new Bo(s),a=setTimeout(()=>{Fb(this._pendingQueue,o=>o.callback===s),n.timedOut=!0,t.callback(new Error("timeout exceeded when trying to connect"))},this.options.connectionTimeoutMillis);return a.unref&&a.unref(),this._pendingQueue.push(n),i}return this.newClient(new Bo(t.callback)),i}newClient(e){let t=new this.Client(this.options);this._clients.push(t);let i=rI(this,t);this.log("checking client timeout");let s,n=!1;this.options.connectionTimeoutMillis&&(s=setTimeout(()=>{this.log("ending client due to timeout"),n=!0,t.connection?t.connection.stream.destroy():t.end()},this.options.connectionTimeoutMillis)),this.log("connecting new client"),t.connect(a=>{if(s&&clearTimeout(s),t.on("error",i),a)this.log("client failed to connect",a),this._clients=this._clients.filter(o=>o!==t),n&&(a=new Error("Connection terminated due to connection timeout",{cause:a})),this._pulseQueue(),e.timedOut||e.callback(a,void 0,$b);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!==0){let o=setTimeout(()=>{this.log("ending client due to expired lifetime"),this._expired.add(t),this._idle.findIndex(c=>c.client===t)!==-1&&this._acquireClient(t,new Bo((c,d,p)=>p()),i,!1)},this.options.maxLifetimeSeconds*1e3);o.unref(),t.once("end",()=>clearTimeout(o))}return this._acquireClient(t,e,i,!0)}})}_acquireClient(e,t,i,s){s&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,i),e.removeListener("error",i),t.timedOut?s&&this.options.verify?this.options.verify(e,e.release):e.release():s&&this.options.verify?this.options.verify(e,n=>{if(n)return e.release(n),t.callback(n,void 0,$b);t.callback(void 0,e,e.release)}):t.callback(void 0,e,e.release)}_releaseOnce(e,t){let i=!1;return s=>{i&&tI(),i=!0,this._release(e,t,s)}}_release(e,t,i){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1,this.emit("release",i,e),i||this.ending||!e._queryable||e._ending||e._poolUseCount>=this.options.maxUses)return e._poolUseCount>=this.options.maxUses&&this.log("remove expended client"),this._remove(e,this._pulseQueue.bind(this));if(this._expired.has(e))return this.log("remove expired client"),this._expired.delete(e),this._remove(e,this._pulseQueue.bind(this));let n;this.options.idleTimeoutMillis&&this._isAboveMin()&&(n=setTimeout(()=>{this.log("remove idle client"),this._remove(e,this._pulseQueue.bind(this))},this.options.idleTimeoutMillis),this.options.allowExitOnIdle&&n.unref()),this.options.allowExitOnIdle&&e.unref(),this._idle.push(new _y(e,t,n)),this._pulseQueue()}query(e,t,i){if(typeof e=="function"){let n=hh(this.Promise,e);return setImmediate(function(){return n.callback(new Error("Passing a function as the first parameter to pool.query is not supported"))}),n.result}typeof t=="function"&&(i=t,t=void 0);let s=hh(this.Promise,i);return i=s.callback,this.connect((n,a)=>{if(n)return i(n);let o=!1,l=c=>{o||(o=!0,a.release(c),i(c))};a.once("error",l),this.log("dispatching query");try{a.query(e,t,(c,d)=>{if(this.log("query dispatched"),a.removeListener("error",l),!o)return o=!0,a.release(c),c?i(c):i(void 0,d)})}catch(c){return a.release(c),i(c)}}),s.result}end(e){if(this.log("ending"),this.ending){let i=new Error("Called end on pool more than once");return e?e(i):this.Promise.reject(i)}this.ending=!0;let t=hh(this.Promise,e);return this._endCallback=t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue.length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients.reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients.length}};Lb.exports=Ey});var zb=O((Gte,Wb)=>{"use strict";var Bb=require("events").EventEmitter,iI=require("util"),Cy=Oo(),Wo=Wb.exports=function(r,e,t){Bb.call(this),r=Cy.normalizeQueryConfig(r,e,t),this.text=r.text,this.values=r.values,this.name=r.name,this.queryMode=r.queryMode,this.callback=r.callback,this.state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("newListener",function(i){i==="row"&&(this._emitRowEvents=!0)}.bind(this))};iI.inherits(Wo,Bb);var sI={sqlState:"code",statementPosition:"position",messagePrimary:"message",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"routine"};Wo.prototype.handleError=function(r){let e=this.native.pq.resultErrorFields();if(e)for(let t in e){let i=sI[t]||t;r[i]=e[t]}this.callback?this.callback(r):this.emit("error",r),this.state="error"};Wo.prototype.then=function(r,e){return this._getPromise().then(r,e)};Wo.prototype.catch=function(r){return this._getPromise().catch(r)};Wo.prototype._getPromise=function(){return this._promise?this._promise:(this._promise=new Promise(function(r,e){this._once("end",r),this._once("error",e)}.bind(this)),this._promise)};Wo.prototype.submit=function(r){this.state="running";let e=this;this.native=r.native,r.native.arrayMode=this._arrayMode;let t=function(i,s,n){if(r.native.arrayMode=!1,setImmediate(function(){e.emit("_done")}),i)return e.handleError(i);e._emitRowEvents&&(n.length>1?s.forEach((a,o)=>{a.forEach(l=>{e.emit("row",l,n[o])})}):s.forEach(function(a){e.emit("row",a,n)})),e.state="end",e.emit("end",n),e.callback&&e.callback(null,n)};if(process.domain&&(t=process.domain.bind(t)),this.name){this.name.length>63&&(console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",this.name,this.name.length),console.error("This can cause conflicts and silent errors executing queries"));let i=(this.values||[]).map(Cy.prepareValue);if(r.namedQueries[this.name]){if(this.text&&r.namedQueries[this.name]!==this.text){let s=new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);return t(s)}return r.native.execute(this.name,i,t)}return r.native.prepare(this.name,this.text,i.length,function(s){return s?t(s):(r.namedQueries[e.name]=e.text,e.native.execute(e.name,i,t))})}else if(this.values){if(!Array.isArray(this.values)){let s=new Error("Query values must be an array");return t(s)}let i=this.values.map(Cy.prepareValue);r.native.query(this.text,i,t)}else this.queryMode==="extended"?r.native.query(this.text,[],t):r.native.query(this.text,t)}});var Qb=O((Kte,Hb)=>{"use strict";var Ub;try{Ub=require("pg-native")}catch(r){throw r}var nI=sh(),jb=require("events").EventEmitter,aI=require("util"),oI=V4(),Vb=zb(),Jt=Hb.exports=function(r){jb.call(this),r=r||{},this._Promise=r.Promise||global.Promise,this._types=new nI(r.types),this.native=new Ub({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting=!1,this._connected=!1,this._queryable=!0;let e=this.connectionParameters=new oI(r);r.nativeConnectionString&&(e.nativeConnectionString=r.nativeConnectionString),this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port=e.port,this.namedQueries={}};Jt.Query=Vb;aI.inherits(Jt,jb);Jt.prototype._errorAllQueries=function(r){let e=t=>{process.nextTick(()=>{t.native=this.native,t.handleError(r)})};this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery=null),this._queryQueue.forEach(e),this._queryQueue.length=0};Jt.prototype._connect=function(r){let e=this;if(this._connecting){process.nextTick(()=>r(new Error("Client has already been connected. You cannot reuse a client.")));return}this._connecting=!0,this.connectionParameters.getLibpqConnectionString(function(t,i){if(e.connectionParameters.nativeConnectionString&&(i=e.connectionParameters.nativeConnectionString),t)return r(t);e.native.connect(i,function(s){if(s)return e.native.end(),r(s);e._connected=!0,e.native.on("error",function(n){e._queryable=!1,e._errorAllQueries(n),e.emit("error",n)}),e.native.on("notification",function(n){e.emit("notification",{channel:n.relname,payload:n.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};Jt.prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise((e,t)=>{this._connect(i=>{i?t(i):e()})})};Jt.prototype.query=function(r,e,t){let i,s,n,a,o;if(r==null)throw new TypeError("Client was passed a null or undefined query");if(typeof r.submit=="function")n=r.query_timeout||this.connectionParameters.query_timeout,s=i=r,typeof e=="function"&&(r.callback=e);else if(n=r.query_timeout||this.connectionParameters.query_timeout,i=new Vb(r,e,t),!i.callback){let l,c;s=new this._Promise((d,p)=>{l=d,c=p}).catch(d=>{throw Error.captureStackTrace(d),d}),i.callback=(d,p)=>d?c(d):l(p)}return n&&(o=i.callback,a=setTimeout(()=>{let l=new Error("Query read timeout");process.nextTick(()=>{i.handleError(l,this.connection)}),o(l),i.callback=()=>{};let c=this._queryQueue.indexOf(i);c>-1&&this._queryQueue.splice(c,1),this._pulseQueryQueue()},n),i.callback=(l,c)=>{clearTimeout(a),o(l,c)}),this._queryable?this._ending?(i.native=this.native,process.nextTick(()=>{i.handleError(new Error("Client was closed and is not queryable"))}),s):(this._queryQueue.push(i),this._pulseQueryQueue(),s):(i.native=this.native,process.nextTick(()=>{i.handleError(new Error("Client has encountered a connection error and is not queryable"))}),s)};Jt.prototype.end=function(r){let e=this;this._ending=!0,this._connected||this.once("connect",this.end.bind(this,r));let t;return r||(t=new this._Promise(function(i,s){r=n=>n?s(n):i()})),this.native.end(function(){e._errorAllQueries(new Error("Connection terminated")),process.nextTick(()=>{e.emit("end"),r&&r()})}),t};Jt.prototype._hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="error"&&this._activeQuery.state!=="end"};Jt.prototype._pulseQueryQueue=function(r){if(!this._connected||this._hasActiveQuery())return;let e=this._queryQueue.shift();if(!e){r||this.emit("drain");return}this._activeQuery=e,e.submit(this);let t=this;e.once("_done",function(){t._pulseQueryQueue()})};Jt.prototype.cancel=function(r){this._activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!==-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Jt.prototype.ref=function(){};Jt.prototype.unref=function(){};Jt.prototype.setTypeParser=function(r,e,t){return this._types.setTypeParser(r,e,t)};Jt.prototype.getTypeParser=function(r,e){return this._types.getTypeParser(r,e)}});var Ay=O((Jte,Gb)=>{"use strict";Gb.exports=Qb()});var Ny=O((Yte,dd)=>{"use strict";var lI=Db(),cI=od(),dI=by(),pI=Q4(),uI=Oo(),mI=qb(),hI=sh(),{DatabaseError:fI}=gy(),{escapeIdentifier:gI,escapeLiteral:yI}=Oo(),wI=r=>class extends mI{constructor(t){super(t,r)}},Ry=function(r){this.defaults=cI,this.Client=r,this.Query=this.Client.Query,this.Pool=wI(this.Client),this._pools=[],this.Connection=dI,this.types=ad(),this.DatabaseError=fI,this.TypeOverrides=hI,this.escapeIdentifier=gI,this.escapeLiteral=yI,this.Result=pI,this.utils=uI};typeof process.env.NODE_PG_FORCE_NATIVE<"u"?dd.exports=new Ry(Ay()):(dd.exports=new Ry(lI),Object.defineProperty(dd.exports,"native",{configurable:!0,enumerable:!1,get(){let r=null;try{r=new Ry(Ay())}catch(e){if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(dd.exports,"native",{value:r}),r}}))});var Kb={};qr(Kb,{Client:()=>bI,Connection:()=>SI,DatabaseError:()=>_I,Pool:()=>vI,Query:()=>TI,Result:()=>CI,TypeOverrides:()=>AI,default:()=>MI,defaults:()=>RI,escapeIdentifier:()=>EI,escapeLiteral:()=>NI,types:()=>xI});var lr,bI,vI,SI,xI,TI,_I,EI,NI,CI,AI,RI,MI,Jb=g(()=>{lr=k(Ny(),1),bI=lr.default.Client,vI=lr.default.Pool,SI=lr.default.Connection,xI=lr.default.types,TI=lr.default.Query,_I=lr.default.DatabaseError,EI=lr.default.escapeIdentifier,NI=lr.default.escapeLiteral,CI=lr.default.Result,AI=lr.default.TypeOverrides,RI=lr.default.defaults,MI=lr.default});var Xb,fh,My,ky=g(()=>{"use strict";ed();x();Xb=Symbol(),fh=class{#e;#t=new WeakMap;#r;constructor(e){this.#e=u({...e})}async init(){if(this.#r=fe(this.#e.pool)?await this.#e.pool():this.#e.pool,!this.#r&&this.#e.poolConfig){let{Pool:e}=await Promise.resolve().then(()=>(Jb(),Kb));this.#r=new e(this.#e.poolConfig)}if(!this.#r)throw new Error("PostgreSQL pool not configured. Please provide either a pool instance or poolConfig.")}async acquireConnection(){let e=await this.#r.connect(),t=this.#t.get(e);return t||(t=new My(e,{cursor:this.#e.cursor}),this.#t.set(e,t),await this.#e.onCreateConnection?.(t)),t}async beginTransaction(e,t){t.isolationLevel?await e.executeQuery(Yr.raw(`begin transaction isolation level ${t.isolationLevel}`)):await e.executeQuery(Yr.raw("begin"))}async commitTransaction(e){await e.executeQuery(Yr.raw("commit"))}async rollbackTransaction(e){await e.executeQuery(Yr.raw("rollback"))}async releaseConnection(e){e[Xb]()}async destroy(){if(this.#r){let e=this.#r;this.#r=void 0,await e.end()}}},My=class{#e;#t;constructor(e,t){this.#e=e,this.#t=u({...t})}async executeQuery(e){let t=await this.#e.query(e.sql,e.parameters);if(t.command==="INSERT"||t.command==="UPDATE"||t.command==="DELETE"){let i=BigInt(t.rowCount??0),s;if(t.command==="INSERT"&&t.rows.length>0){let n=t.rows[0],a=n.id??n.ID??Object.values(n)[0];if(typeof a=="number"||typeof a=="bigint"||typeof a=="string")try{s=BigInt(a)}catch{}}return{insertId:s,rows:t.rows??[],numAffectedRows:i}}return{rows:t.rows??[]}}async*streamQuery(e,t){if(!this.#t.cursor)throw new Error("Cursor is not configured. To use streaming queries, please provide a cursor constructor in the dialect config.");let i=new this.#t.cursor(e.sql,e.parameters);try{for(;;){let s=await i.read(t);if(s.length===0)break;yield{rows:s}}}finally{await i.close()}}[Xb](){this.#e.release()}}});var kI,gh,Iy=g(()=>{"use strict";Zc();kI=/"/g,gh=class extends Ao{#e=0;getCurrentParameterPlaceholder(){return"$"+ ++this.#e}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"generated by default as identity"}sanitizeIdentifier(e){return e.replace(kI,'""')}visitValue(e){e.value===null?this.append("null"):e.value===void 0?this.append("null"):typeof e.value=="boolean"?this.append(e.value?"true":"false"):super.visitValue(e)}}});var II,PI,zo,yh=g(()=>{"use strict";Qm();at();II="kysely_migration",PI="kysely_migration_lock",zo=class extends Mo{#e;constructor(e){super(e),this.#e=e}async getSchemas(){return(await C`
31
- SELECT schema_name
32
- FROM information_schema.schemata
33
- WHERE schema_name NOT IN ('pg_catalog', 'information_schema', 'pg_toast')
34
- ORDER BY schema_name
35
- `.execute(this.#e)).rows.map(t=>({name:t.schema_name}))}async getTables(e={withInternalKyselyTables:!1}){return await this.#t("public",e)}async getMetadata(e){return{tables:await this.getTables(e)}}async getColumns(e){return(await C`
36
- SELECT
37
- c.column_name,
38
- c.ordinal_position,
39
- c.column_default,
40
- c.is_nullable,
41
- c.data_type,
42
- c.udt_name,
43
- c.character_maximum_length,
44
- c.numeric_precision,
45
- c.numeric_scale,
46
- c.datetime_precision,
47
- COALESCE(c.is_identity, 'NO') as is_identity,
48
- COALESCE(c.identity_generation, 'NEVER') as is_generated,
49
- e.data_type as element_type
50
- FROM information_schema.columns c
51
- LEFT JOIN information_schema.element_types e
52
- ON e.object_catalog = c.table_catalog
53
- AND e.object_schema = c.table_schema
54
- AND e.object_name = c.table_name
55
- AND e.object_type = 'TABLE'
56
- AND e.collection_type_identifier = c.dtd_identifier
57
- WHERE c.table_name = ${e}
58
- AND c.table_schema = 'public'
59
- ORDER BY c.ordinal_position
60
- `.execute(this.#e)).rows.map(i=>({name:i.column_name,type:this.#r(i),nullable:i.is_nullable==="YES",defaultValue:i.column_default,isPrimaryKey:!1,isAutoIncrement:i.is_identity==="YES"||i.is_generated!=="NEVER"}))}async getIndexes(e){let t=await C`
61
- SELECT
62
- i.relname as index_name,
63
- a.attname as column_name,
64
- ix.indisunique as is_unique,
65
- ix.indisprimary as is_primary_key
66
- FROM pg_class t
67
- JOIN pg_index ix ON t.oid = ix.indrelid
68
- JOIN pg_class i ON i.oid = ix.indexrelid
69
- JOIN pg_attribute a ON a.attrelid = t.oid
70
- JOIN pg_namespace n ON n.nspname = 'public'
71
- WHERE t.relname = ${e}
72
- AND n.oid = t.relnamespace
73
- AND a.attnum = ANY(ix.indkey)
74
- AND t.relkind = 'r'
75
- ORDER BY i.relname, a.attnum
76
- `.execute(this.#e);return this.#s(t.rows)}async getForeignKeys(e){let t=await C`
77
- SELECT
78
- tc.constraint_name,
79
- tc.table_name,
80
- kcu.column_name,
81
- ccu.table_name AS foreign_table_name,
82
- ccu.column_name AS foreign_column_name,
83
- rc.delete_rule as on_delete,
84
- rc.update_rule as on_update
85
- FROM information_schema.table_constraints AS tc
86
- JOIN information_schema.key_column_usage AS kcu
87
- ON tc.constraint_name = kcu.constraint_name
88
- AND tc.table_schema = kcu.table_schema
89
- JOIN information_schema.constraint_column_usage AS ccu
90
- ON ccu.constraint_name = tc.constraint_name
91
- AND ccu.table_schema = tc.table_schema
92
- JOIN information_schema.referential_constraints AS rc
93
- ON rc.constraint_name = tc.constraint_name
94
- AND rc.constraint_schema = tc.table_schema
95
- WHERE tc.constraint_type = 'FOREIGN KEY'
96
- AND tc.table_name = ${e}
97
- AND tc.table_schema = 'public'
98
- ORDER BY tc.constraint_name, kcu.ordinal_position
99
- `.execute(this.#e);return this.#m(t.rows)}async#t(e,t){let i=C`
100
- SELECT table_name, table_type
101
- FROM information_schema.tables
102
- WHERE table_schema = ${e}
103
- AND table_type IN ('BASE TABLE', 'VIEW')
104
- `;t.withInternalKyselyTables||(i=C`
105
- ${i}
106
- AND table_name NOT IN (${II}, ${PI})
107
- `),i=C`
108
- ${i}
109
- ORDER BY table_name
110
- `;let s=await i.execute(this.#e),n=await C`
111
- SELECT
112
- c.table_name,
113
- c.column_name,
114
- c.ordinal_position,
115
- c.column_default,
116
- c.is_nullable,
117
- c.data_type,
118
- c.udt_name,
119
- c.character_maximum_length,
120
- c.numeric_precision,
121
- c.numeric_scale,
122
- c.datetime_precision,
123
- COALESCE(c.is_identity, 'NO') as is_identity,
124
- COALESCE(c.identity_generation, 'NEVER') as is_generated,
125
- e.data_type as element_type
126
- FROM information_schema.columns c
127
- LEFT JOIN information_schema.element_types e
128
- ON e.object_catalog = c.table_catalog
129
- AND e.object_schema = c.table_schema
130
- AND e.object_name = c.table_name
131
- AND e.object_type = 'TABLE'
132
- AND e.collection_type_identifier = c.dtd_identifier
133
- WHERE c.table_schema = ${e}
134
- ORDER BY c.table_name, c.ordinal_position
135
- `.execute(this.#e),a=await C`
136
- SELECT
137
- t.relname as table_name,
138
- i.relname as index_name,
139
- a.attname as column_name,
140
- ix.indisunique as is_unique,
141
- ix.indisprimary as is_primary_key
142
- FROM pg_class t
143
- JOIN pg_index ix ON t.oid = ix.indrelid
144
- JOIN pg_class i ON i.oid = ix.indexrelid
145
- JOIN pg_attribute a ON a.attrelid = t.oid
146
- JOIN pg_namespace n ON n.oid = t.relnamespace
147
- WHERE n.nspname = ${e}
148
- AND a.attnum = ANY(ix.indkey)
149
- AND t.relkind = 'r'
150
- ORDER BY t.relname, i.relname, a.attnum
151
- `.execute(this.#e),o=await C`
152
- SELECT
153
- tc.constraint_name,
154
- tc.table_name,
155
- kcu.column_name,
156
- ccu.table_name AS foreign_table_name,
157
- ccu.column_name AS foreign_column_name,
158
- rc.delete_rule as on_delete,
159
- rc.update_rule as on_update
160
- FROM information_schema.table_constraints AS tc
161
- JOIN information_schema.key_column_usage AS kcu
162
- ON tc.constraint_name = kcu.constraint_name
163
- AND tc.table_schema = kcu.table_schema
164
- JOIN information_schema.constraint_column_usage AS ccu
165
- ON ccu.constraint_name = tc.constraint_name
166
- AND ccu.table_schema = tc.table_schema
167
- JOIN information_schema.referential_constraints AS rc
168
- ON rc.constraint_name = tc.constraint_name
169
- AND rc.constraint_schema = tc.table_schema
170
- WHERE tc.constraint_type = 'FOREIGN KEY'
171
- AND tc.table_schema = ${e}
172
- ORDER BY tc.table_name, tc.constraint_name, kcu.ordinal_position
173
- `.execute(this.#e),l=this.#i(n.rows,"table_name"),c=this.#i(a.rows,"table_name"),d=this.#i(o.rows,"table_name");return s.rows.map(p=>({name:p.table_name,isView:p.table_type==="VIEW",schema:e,columns:(l.get(p.table_name)??[]).map(m=>({name:m.column_name,type:this.#r(m),nullable:m.is_nullable==="YES",defaultValue:m.column_default,isPrimaryKey:!1,isAutoIncrement:m.is_identity==="YES"||m.is_generated!=="NEVER"})),indexes:this.#s(c.get(p.table_name)??[]),foreignKeys:this.#m(d.get(p.table_name)??[])}))}async getViewDefinition(e){return(await C`
174
- SELECT view_definition
175
- FROM information_schema.views
176
- WHERE table_name = ${e}
177
- AND table_schema = 'public'
178
- `.execute(this.#e)).rows[0]?.view_definition||null}#r(e){return e.data_type==="ARRAY"&&e.element_type?`${{"character varying":"varchar",character:"char","timestamp without time zone":"timestamp","timestamp with time zone":"timestamptz","time without time zone":"time","time with time zone":"timetz","double precision":"double precision"}[e.element_type]||e.element_type}[]`:e.udt_name==="tsvector"?"tsvector":e.udt_name==="tsquery"?"tsquery":{"character varying":"varchar",character:"char","timestamp without time zone":"timestamp","timestamp with time zone":"timestamptz","time without time zone":"time","time with time zone":"timetz","double precision":"double precision"}[e.data_type]||e.data_type}#i(e,t){let i=new Map;for(let s of e){let n=i.get(s[t])??[];n.push(s),i.set(s[t],n)}return i}#s(e){let t=new Map;for(let i of e){let s=t.get(i.index_name);s?s.columns.push(i.column_name):t.set(i.index_name,{name:i.index_name,columns:[i.column_name],unique:i.is_unique})}return Array.from(t.values())}#m(e){let t=new Map;for(let i of e)if(!t.has(i.constraint_name)){let s=this.#u(i.on_delete),n=this.#u(i.on_update);t.set(i.constraint_name,{name:i.constraint_name,column:i.column_name,referencedTable:i.foreign_table_name,referencedColumn:i.foreign_column_name,onDelete:s,onUpdate:n})}return Array.from(t.values())}#u(e){if(!e)return;let t=e.toUpperCase();if(t==="CASCADE"||t==="SET NULL"||t==="RESTRICT"||t==="NO ACTION")return t}}});var OI,wh,Py=g(()=>{"use strict";Hm();OI="0.0.1",wh=class extends Ro{get supportsTransactionalDdl(){return!0}get supportsReturning(){return!0}async acquireMigrationLock(e,t){let i=t.lockTable??"kysely_migration_lock",s=this.#e(i);await e.selectFrom(i).selectAll().where("id","=",OI).forUpdate().execute()}async releaseMigrationLock(e,t){}#e(e){let t=0;for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);t=(t<<5)-t+s,t|=0}return t}}});var bh,Oy=g(()=>{"use strict";ky();Iy();yh();Py();x();bh=class{#e;constructor(e){this.#e=u({...e})}createDriver(){return new fh(this.#e)}createQueryCompiler(){return new gh}createAdapter(){return new wh}createIntrospector(e){return new zo(e)}}});var Yb=g(()=>{"use strict"});var Zb=g(()=>{"use strict"});var Uo,ev,xi,pd=g(()=>{"use strict";Uo=k(require("node:fs"),1),ev=k(require("node:path"),1),xi=class{queryLogs=[];queryCount=0;totalQueryTime=0;config;namespace;constructor(e){typeof e=="string"?(this.namespace=e,this.config={enabled:!0,level:"info"}):this.config=e||{}}getPrefix(e){let t=this.namespace?`[${this.namespace}]`:"";return`[NOORMME ${e.toUpperCase()}]${t}`}debug(e,...t){this.shouldLog("debug")&&(console.debug(`${this.getPrefix("debug")} ${e}`,...t),this.writeToFile("debug",e,...t))}info(e,...t){this.shouldLog("info")&&(console.info(`${this.getPrefix("info")} ${e}`,...t),this.writeToFile("info",e,...t))}warn(e,...t){this.shouldLog("warn")&&(console.warn(`${this.getPrefix("warn")} ${e}`,...t),this.writeToFile("warn",e,...t))}error(e,...t){this.shouldLog("error")&&(console.error(`${this.getPrefix("error")} ${e}`,...t),this.writeToFile("error",e,...t))}logQuery(e,t,i){let s={sql:e,parameters:t,duration:i,timestamp:Date.now()};this.queryLogs.push(s),this.queryCount++,this.totalQueryTime+=i,this.shouldLog("debug")&&this.debug(`Query executed in ${i}ms: ${e}`,t),this.queryLogs.length>1e3&&this.queryLogs.shift()}createKyselyLogger(){return e=>{e.level==="query"?this.logQuery(e.sql,e.parameters,e.duration):e.level==="error"&&this.error("Database error:",e.error)}}getQueryCount(){return this.queryCount}getAverageQueryTime(){return this.queryCount>0?this.totalQueryTime/this.queryCount:0}getQueryLogs(){return[...this.queryLogs]}getSlowQueries(e=1e3){return this.queryLogs.filter(t=>t.duration>e)}clearQueryLogs(){this.queryLogs=[],this.queryCount=0,this.totalQueryTime=0}updateConfig(e){this.config={...this.config,...e}}shouldLog(e){if(!this.config.enabled)return!1;let t=["debug","info","warn","error"],i=this.config.level||"info",s=t.indexOf(i);return t.indexOf(e)>=s}writeToFile(e,t,...i){if(this.config.file)try{let s=ev.dirname(this.config.file);Uo.existsSync(s)||Uo.mkdirSync(s,{recursive:!0});let n=new Date().toISOString(),a=this.getPrefix(e),o=`[${n}] ${a} ${t}`;i.length>0&&(o+=" "+i.map(l=>typeof l=="object"?JSON.stringify(l):String(l)).join(" ")),o+=`
179
- `,Uo.appendFileSync(this.config.file,o)}catch(s){console.error("Failed to write to log file:",s)}}formatMessage(e,t){return`[${new Date().toISOString()}] [${e.toUpperCase()}] ${t}`}getPerformanceMetrics(){return{queryCount:this.queryCount,averageQueryTime:this.getAverageQueryTime(),totalQueryTime:this.totalQueryTime,slowQueries:this.getSlowQueries().length}}exportQueryLogs(){return JSON.stringify(this.queryLogs,null,2)}importQueryLogs(e){try{let t=JSON.parse(e);this.queryLogs=t,this.queryCount=t.length,this.totalQueryTime=t.reduce((i,s)=>i+s.duration,0)}catch(t){this.error("Failed to import query logs:",t)}}}});var jo,Dy=g(()=>{"use strict";at();jo=class r{logger;static instance;optimizationHistory=new Map;constructor(e){this.logger=e}static getInstance(e){return r.instance||(r.instance=new r(e)),r.instance}getDefaultConfig(){return{enableAutoPragma:!0,enableAutoIndexing:!0,enablePerformanceTuning:!0,enableBackupRecommendations:!0,slowQueryThreshold:1e3,autoVacuumMode:"INCREMENTAL",journalMode:"WAL",synchronous:"NORMAL",cacheSize:-64e3,tempStore:"MEMORY"}}async analyzeDatabase(e){try{let[t,i,s,n,a,o,l,c,d,p,m,h]=await Promise.all([this.getPragmaValue(e,"page_count"),this.getPragmaValue(e,"page_size"),this.getPragmaValue(e,"freelist_count"),this.getPragmaValue(e,"schema_version"),this.getPragmaValue(e,"user_version"),this.getPragmaValue(e,"application_id"),this.getPragmaValue(e,"cache_size"),this.getPragmaValue(e,"synchronous"),this.getPragmaValue(e,"journal_mode"),this.getPragmaValue(e,"auto_vacuum"),this.getPragmaValue(e,"temp_store"),this.getPragmaValue(e,"foreign_keys")]),f=await C`PRAGMA integrity_check`.execute(e),w=f.rows.length===1&&f.rows[0].integrity_check==="ok";return{pageCount:Number(t),pageSize:Number(i),freelistCount:Number(s),schemaVersion:Number(n),userVersion:Number(a),applicationId:Number(o),cacheSize:Number(l),synchronous:Number(c),journalMode:String(d),autoVacuum:Number(p),tempStore:Number(m),foreignKeys:Number(h),integrityCheck:w}}catch(t){throw this.logger.warn("Failed to analyze SQLite database:",t),t}}async optimizeDatabase(e,t=this.getDefaultConfig()){let i={appliedOptimizations:[],recommendations:[],performanceImpact:"low",warnings:[]};try{let s=await this.analyzeDatabase(e);t.enableAutoPragma&&await this.applyPragmaOptimizations(e,t,s,i),t.enablePerformanceTuning&&await this.applyPerformanceTuning(e,t,s,i),await this.generateRecommendations(e,s,i);let n=await this.getDatabaseId(e);return this.optimizationHistory.set(n,i),this.logger.info(`Applied ${i.appliedOptimizations.length} SQLite optimizations`),i}catch(s){return this.logger.error("Failed to optimize SQLite database:",s),i.warnings.push(`Optimization failed: ${s}`),i}}async applyPragmaOptimizations(e,t,i,s){let n=[];if(i.journalMode!=="wal"&&t.journalMode==="WAL")try{await C`PRAGMA journal_mode = WAL`.execute(e),n.push("Enabled WAL mode for better concurrency"),s.performanceImpact="high"}catch{s.warnings.push("Failed to enable WAL mode")}if(Math.abs(i.cacheSize)<Math.abs(t.cacheSize))try{await C`PRAGMA cache_size = ${C.lit(t.cacheSize)}`.execute(e),n.push(`Set cache size to ${t.cacheSize}`),s.performanceImpact="medium"}catch{s.warnings.push("Failed to set cache size")}if(i.foreignKeys===0)try{await C`PRAGMA foreign_keys = ON`.execute(e),n.push("Enabled foreign key constraints"),s.performanceImpact="low"}catch{s.warnings.push("Failed to enable foreign keys")}let o=["OFF","NORMAL","FULL","EXTRA"].indexOf(t.synchronous);if(i.synchronous!==o)try{await C`PRAGMA synchronous = ${C.lit(t.synchronous)}`.execute(e),n.push(`Set synchronous mode to ${t.synchronous}`),s.performanceImpact="medium"}catch{s.warnings.push("Failed to set synchronous mode")}let c=["DEFAULT","FILE","MEMORY"].indexOf(t.tempStore);if(i.tempStore!==c)try{await C`PRAGMA temp_store = ${C.lit(t.tempStore)}`.execute(e),n.push(`Set temp store to ${t.tempStore}`),s.performanceImpact="low"}catch{s.warnings.push("Failed to set temp store")}s.appliedOptimizations.push(...n)}async applyPerformanceTuning(e,t,i,s){let n=[];try{await C`ANALYZE`.execute(e),n.push("Ran ANALYZE for query optimization"),s.performanceImpact="medium"}catch{s.warnings.push("Failed to run ANALYZE")}try{await C`PRAGMA optimize`.execute(e),n.push("Ran PRAGMA optimize for automatic tuning"),s.performanceImpact="low"}catch{this.logger.debug("PRAGMA optimize not available in this SQLite version")}let o=["NONE","FULL","INCREMENTAL"].indexOf(t.autoVacuumMode);if(i.autoVacuum!==o)try{await C`PRAGMA auto_vacuum = ${C.lit(t.autoVacuumMode)}`.execute(e),n.push(`Set auto vacuum to ${t.autoVacuumMode}`),s.performanceImpact="medium"}catch{s.warnings.push("Failed to set auto vacuum mode")}s.appliedOptimizations.push(...n)}async generateRecommendations(e,t,i){let s=[];t.freelistCount>100&&s.push(`High fragmentation detected (${t.freelistCount} free pages). Consider running VACUUM to reclaim space.`),t.integrityCheck||s.push("Database integrity check failed. Run PRAGMA integrity_check for details.");let n=await this.getTableList(e);for(let a of n)(await this.getTableIndexes(e,a)).length===0&&s.push(`Table '${a}' has no indexes. Consider adding indexes for frequently queried columns.`);Math.abs(t.cacheSize)<32e3&&s.push("Consider increasing cache_size for better performance with larger databases."),t.journalMode!=="wal"&&s.push("Consider enabling WAL mode for better concurrent read performance."),i.recommendations.push(...s)}async getPragmaValue(e,t){try{return(await C`PRAGMA ${C.id(t)}`.execute(e)).rows[0]?.[t]??null}catch(i){return this.logger.debug(`Failed to get PRAGMA ${t}:`,i),null}}async getDatabaseId(e){try{return(await C`PRAGMA database_list`.execute(e)).rows.find(s=>s.seq===0)?.file||"unknown"}catch{return"unknown"}}async getTableList(e){try{return(await e.selectFrom("sqlite_master").select("name").where("type","=","table").where("name","not like","sqlite_%").execute()).map(i=>i.name)}catch(t){return this.logger.debug("Failed to get table list:",t),[]}}async getTableIndexes(e,t){try{return(await C`PRAGMA index_list(${C.lit(t)})`.execute(e)).rows||[]}catch(i){return this.logger.debug(`Failed to get indexes for table ${t}:`,i),[]}}getOptimizationHistory(e){return e&&this.optimizationHistory.get(e)||null}clearHistory(){this.optimizationHistory.clear()}async getBackupRecommendations(e){let t=[],i=await this.analyzeDatabase(e);return i.journalMode==="wal"&&t.push("When using WAL mode, ensure to backup both the main database file and WAL file for consistency."),i.pageCount*i.pageSize>100*1024*1024&&t.push("For large databases, consider using SQLite backup API or .backup command for efficient backups."),t.push("Perform backups during low-activity periods to minimize lock contention."),t}async suggestIndexOptimizations(e,t){let i=[],s=new Map;for(let n of t){let a=n.match(/WHERE\s+([^ORDER\s]+)/i);if(a){let l=a[1].match(/(\w+)\s*[=<>]/g);if(l)for(let c of l){let d=c.replace(/\s*[=<>].*/,"").trim();s.set(d,(s.get(d)||0)+1)}}}for(let[n,a]of s.entries())a>=3&&i.push(`Consider adding an index on '${n}' (used in ${a} queries)`);return i}}});var Vo,$y=g(()=>{"use strict";at();Vo=class r{logger;static instance;queryPatterns=new Map;existingIndexes=new Map;analysisHistory=new Map;constructor(e){this.logger=e}static getInstance(e){return r.instance||(r.instance=new r(e)),r.instance}recordQuery(e,t,i){let s=this.normalizeQuery(e),n=this.queryPatterns.get(s);if(n)n.frequency++,n.lastExecuted=new Date,n.averageExecutionTime=(n.averageExecutionTime*(n.frequency-1)+t)/n.frequency;else{let a={query:s,frequency:1,table:i||this.extractTableName(e),whereColumns:this.extractWhereColumns(e),orderByColumns:this.extractOrderByColumns(e),joinColumns:this.extractJoinColumns(e),lastExecuted:new Date,averageExecutionTime:t};this.queryPatterns.set(s,a)}}async analyzeAndRecommend(e,t={}){let{minFrequency:i=3,slowQueryThreshold:s=1e3,includePartialIndexes:n=!0,maxRecommendations:a=20}=t;try{await this.loadExistingIndexes(e);let o=Array.from(this.queryPatterns.values()).filter(f=>f.frequency>=i||f.averageExecutionTime>s).sort((f,w)=>w.frequency-f.frequency),l=await this.generateRecommendations(e,o,n),c=await this.findRedundantIndexes(e),d=this.findMissingIndexes(l),p=l.sort((f,w)=>this.getPriorityScore(w)-this.getPriorityScore(f)).slice(0,a),m={recommendations:p,existingIndexes:Array.from(this.existingIndexes.keys()),redundantIndexes:c,missingIndexes:d,performanceImpact:this.calculatePerformanceImpact(p),summary:this.generateSummary(p,c)},h=await this.getDatabaseId(e);return this.analysisHistory.set(h,m),this.logger.info(`Generated ${p.length} index recommendations`),m}catch(o){throw this.logger.error("Failed to analyze index patterns:",o),o}}async generateRecommendations(e,t,i){let s=[],n=new Set;for(let a of t)if(!n.has(a.table)){if(a.whereColumns.length>0){let o=await this.generateWhereIndexes(e,a,i);s.push(...o)}if(a.orderByColumns.length>0){let o=await this.generateOrderByIndexes(e,a,i);s.push(...o)}if(a.joinColumns.length>0){let o=await this.generateJoinIndexes(e,a,i);s.push(...o)}n.add(a.table)}return this.deduplicateRecommendations(s)}async generateWhereIndexes(e,t,i){let s=[];for(let n of t.whereColumns){if(await this.findExistingIndex(e,t.table,[n]))continue;let o=this.calculateWherePriority(t,n),l=this.determineIndexType(t,n);s.push({table:t.table,columns:[n],type:l,priority:o,reason:`Frequently queried column (${t.frequency} times, avg ${Math.round(t.averageExecutionTime)}ms)`,estimatedImpact:this.estimateImpact(t),sql:this.generateIndexSQL(t.table,[n],l,i)})}if(t.whereColumns.length>1){let n=await this.generateCompositeWhereIndex(e,t,i);n&&s.push(n)}return s}async generateOrderByIndexes(e,t,i){let s=[];for(let n of t.orderByColumns)await this.findExistingIndex(e,t.table,[n])||s.push({table:t.table,columns:[n],type:"single",priority:"medium",reason:`Frequently ordered by column (${t.frequency} times)`,estimatedImpact:"medium",sql:this.generateIndexSQL(t.table,[n],"single",i)});return s}async generateJoinIndexes(e,t,i){let s=[];for(let n of t.joinColumns)await this.findExistingIndex(e,t.table,[n])||s.push({table:t.table,columns:[n],type:"single",priority:"high",reason:`Foreign key column used in joins (${t.frequency} times)`,estimatedImpact:"high",sql:this.generateIndexSQL(t.table,[n],"single",i)});return s}async generateCompositeWhereIndex(e,t,i){let s=t.whereColumns.slice(0,3);return await this.findExistingIndex(e,t.table,s)?null:{table:t.table,columns:s,type:"composite",priority:"high",reason:`Composite index for multiple WHERE columns (${t.frequency} times)`,estimatedImpact:"high",sql:this.generateIndexSQL(t.table,s,"composite",i)}}async findRedundantIndexes(e){let t=[],i=new Map;for(let[s,n]of this.existingIndexes.entries())for(let a of n)i.has(a.table)||i.set(a.table,[]),i.get(a.table).push({...a,name:s});for(let[s,n]of i.entries())for(let a=0;a<n.length;a++)for(let o=a+1;o<n.length;o++){let l=n[a],c=n[o];this.isIndexPrefix(l.columns,c.columns)?t.push(c.name):this.isIndexPrefix(c.columns,l.columns)&&t.push(l.name)}return t}findMissingIndexes(e){let t=[],i=new Set(this.existingIndexes.keys());for(let s of e){let n=this.generateIndexName(s.table,s.columns);i.has(n)||t.push(n)}return t}async loadExistingIndexes(e){try{let t=await e.selectFrom("sqlite_master").select(["name","sql","tbl_name"]).where("type","=","index").where("name","not like","sqlite_%").execute();this.existingIndexes.clear();for(let i of t){let s=this.extractColumnsFromSQL(i.sql||"");this.existingIndexes.set(i.name,[{name:i.name,table:i.tbl_name,columns:s,sql:i.sql}])}}catch(t){this.logger.warn("Failed to load existing indexes:",t)}}isIndexPrefix(e,t){if(e.length>=t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}async findExistingIndex(e,t,i){for(let[s,n]of this.existingIndexes.entries())for(let a of n)if(a.table===t&&this.arraysEqual(a.columns,i))return s;return null}calculateWherePriority(e,t){return e.averageExecutionTime>5e3?"critical":e.frequency>20?"high":e.frequency>10?"medium":"low"}determineIndexType(e,t){return"single"}estimateImpact(e){return e.averageExecutionTime>2e3||e.frequency>15?"high":e.averageExecutionTime>500?"medium":"low"}generateIndexSQL(e,t,i,s){let n=this.generateIndexName(e,t),a=t.map(l=>`"${l}"`).join(", "),o=`CREATE INDEX "${n}" ON "${e}" (${a})`;return i==="unique"&&(o=o.replace("CREATE INDEX","CREATE UNIQUE INDEX")),o}generateIndexName(e,t){let i=t.length===1?t[0]:`${t.length}cols`;return`idx_${e}_${i}`}getPriorityScore(e){let t={critical:4,high:3,medium:2,low:1},i={high:3,medium:2,low:1};return t[e.priority]*i[e.estimatedImpact]}calculatePerformanceImpact(e){let t=e.filter(s=>s.estimatedImpact==="high").length,i=e.filter(s=>s.estimatedImpact==="medium").length;return t>3?"high":t>0||i>5?"medium":"low"}generateSummary(e,t){let i=e.filter(o=>o.priority==="critical").length,s=e.filter(o=>o.priority==="high").length,n=t.length,a=`Found ${e.length} index recommendations`;return i>0&&(a+=`, ${i} critical`),s>0&&(a+=`, ${s} high priority`),n>0&&(a+=`. ${n} redundant indexes identified for removal`),a}deduplicateRecommendations(e){let t=new Set;return e.filter(i=>{let s=`${i.table}:${i.columns.join(",")}`;return t.has(s)?!1:(t.add(s),!0)})}extractTableName(e){let t=e.match(/FROM\s+["`]?(\w+)["`]?/i);return t?t[1]:"unknown"}extractWhereColumns(e){let t=e.match(/WHERE\s+([^ORDER\s]+)/i);if(!t)return[];let s=t[1].match(/(\w+)\s*[=<>]/g);return s?s.map(n=>n.replace(/\s*[=<>].*/,"").trim()):[]}extractOrderByColumns(e){let t=e.match(/ORDER\s+BY\s+([^LIMIT\s]+)/i);return t?t[1].split(",").map(s=>s.trim().replace(/\s+(ASC|DESC).*$/i,"").replace(/["`]/g,"")).filter(s=>s.length>0):[]}extractJoinColumns(e){let t=e.match(/JOIN\s+\w+\s+ON\s+([^WHERE\s]+)/gi);if(!t)return[];let i=[];for(let s of t){let a=s.replace(/JOIN\s+\w+\s+ON\s+/i,"").match(/(\w+)\s*=/g);a&&i.push(...a.map(o=>o.replace(/\s*=.*/,"").trim()))}return i}extractColumnsFromSQL(e){if(!e)return[];let t=e.match(/\(([^)]+)\)/);return t?t[1].split(",").map(i=>i.trim().replace(/^\s*["']?|["']?\s*$/g,"")).filter(i=>i.length>0):[]}normalizeQuery(e){return e.replace(/\$\d+/g,"?").replace(/'[^']*'/g,"?").replace(/\b\d+\b/g,"?").replace(/\s+/g," ").trim().toLowerCase()}arraysEqual(e,t){return e.length===t.length&&e.every((i,s)=>i===t[s])}async getDatabaseId(e){try{return(await C`PRAGMA database_list`.execute(e)).rows.find(s=>s.seq===0)?.file||"unknown"}catch{return"unknown"}}getAnalysisHistory(e){return e&&this.analysisHistory.get(e)||null}clearAnalysisData(){this.queryPatterns.clear(),this.existingIndexes.clear(),this.analysisHistory.clear()}getQueryPatternStats(){let e=Array.from(this.queryPatterns.values()),t=e.reduce((n,a)=>n+a.frequency,0),i=e.length>0?t/e.length:0,s=e.filter(n=>n.averageExecutionTime>1e3).length;return{totalPatterns:e.length,totalQueries:t,averageFrequency:i,slowQueries:s}}}});var Fy,tv,DI,rv=g(()=>{Fy=(r,e,t)=>{let i=r instanceof RegExp?tv(r,t):r,s=e instanceof RegExp?tv(e,t):e,n=i!==null&&s!=null&&DI(i,s,t);return n&&{start:n[0],end:n[1],pre:t.slice(0,n[0]),body:t.slice(n[0]+i.length,n[1]),post:t.slice(n[1]+s.length)}},tv=(r,e)=>{let t=e.match(r);return t?t[0]:null},DI=(r,e,t)=>{let i,s,n,a,o,l=t.indexOf(r),c=t.indexOf(e,l+1),d=l;if(l>=0&&c>0){if(r===e)return[l,c];for(i=[],n=t.length;d>=0&&!o;){if(d===l)i.push(d),l=t.indexOf(r,d+1);else if(i.length===1){let p=i.pop();p!==void 0&&(o=[p,c])}else s=i.pop(),s!==void 0&&s<n&&(n=s,a=c),c=t.indexOf(e,d+1);d=l<c&&l>=0?l:c}i.length&&a!==void 0&&(o=[n,a])}return o}});function Ly(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function HI(r){return r.replace(WI,iv).replace(zI,sv).replace(UI,qy).replace(jI,nv).replace(VI,av)}function QI(r){return r.replace($I,"\\").replace(FI,"{").replace(LI,"}").replace(qI,",").replace(BI,".")}function ov(r){if(!r)return[""];let e=[],t=Fy("{","}",r);if(!t)return r.split(",");let{pre:i,body:s,post:n}=t,a=i.split(",");a[a.length-1]+="{"+s+"}";let o=ov(n);return n.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),e.push.apply(e,a),e}function lv(r){return r?(r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),ud(HI(r),!0).map(QI)):[]}function GI(r){return"{"+r+"}"}function KI(r){return/^-?0\d/.test(r)}function JI(r,e){return r<=e}function XI(r,e){return r>=e}function ud(r,e){let t=[],i=Fy("{","}",r);if(!i)return[r];let s=i.pre,n=i.post.length?ud(i.post,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<n.length;a++){let o=s+"{"+i.body+"}"+n[a];t.push(o)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=a||o,c=i.body.indexOf(",")>=0;if(!l&&!c)return i.post.match(/,(?!,).*\}/)?(r=i.pre+"{"+i.body+qy+i.post,ud(r)):[r];let d;if(l)d=i.body.split(/\.\./);else if(d=ov(i.body),d.length===1&&d[0]!==void 0&&(d=ud(d[0],!1).map(GI),d.length===1))return n.map(m=>i.pre+d[0]+m);let p;if(l&&d[0]!==void 0&&d[1]!==void 0){let m=Ly(d[0]),h=Ly(d[1]),f=Math.max(d[0].length,d[1].length),w=d.length===3&&d[2]!==void 0?Math.abs(Ly(d[2])):1,b=JI;h<m&&(w*=-1,b=XI);let S=d.some(KI);p=[];for(let y=m;b(y,h);y+=w){let _;if(o)_=String.fromCharCode(y),_==="\\"&&(_="");else if(_=String(y),S){let E=f-_.length;if(E>0){let D=new Array(E+1).join("0");y<0?_="-"+D+_.slice(1):_=D+_}}p.push(_)}}else{p=[];for(let m=0;m<d.length;m++)p.push.apply(p,ud(d[m],!1))}for(let m=0;m<p.length;m++)for(let h=0;h<n.length;h++){let f=s+p[m]+n[h];(!e||l||f)&&t.push(f)}}return t}var iv,sv,qy,nv,av,$I,FI,LI,qI,BI,WI,zI,UI,jI,VI,cv=g(()=>{rv();iv="\0SLASH"+Math.random()+"\0",sv="\0OPEN"+Math.random()+"\0",qy="\0CLOSE"+Math.random()+"\0",nv="\0COMMA"+Math.random()+"\0",av="\0PERIOD"+Math.random()+"\0",$I=new RegExp(iv,"g"),FI=new RegExp(sv,"g"),LI=new RegExp(qy,"g"),qI=new RegExp(nv,"g"),BI=new RegExp(av,"g"),WI=/\\\\/g,zI=/\\{/g,UI=/\\}/g,jI=/\\,/g,VI=/\\./g});var md,dv=g(()=>{md=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>65536)throw new TypeError("pattern is too long")}});var YI,hd,ZI,pv,uv,mv=g(()=>{YI={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},hd=r=>r.replace(/[[\]\\-]/g,"\\$&"),ZI=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),pv=r=>r.join(""),uv=(r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let i=[],s=[],n=t+1,a=!1,o=!1,l=!1,c=!1,d=t,p="";e:for(;n<r.length;){let w=r.charAt(n);if((w==="!"||w==="^")&&n===t+1){c=!0,n++;continue}if(w==="]"&&a&&!l){d=n+1;break}if(a=!0,w==="\\"&&!l){l=!0,n++;continue}if(w==="["&&!l){for(let[b,[v,S,y]]of Object.entries(YI))if(r.startsWith(b,n)){if(p)return["$.",!1,r.length-t,!0];n+=b.length,y?s.push(v):i.push(v),o=o||S;continue e}}if(l=!1,p){w>p?i.push(hd(p)+"-"+hd(w)):w===p&&i.push(hd(w)),p="",n++;continue}if(r.startsWith("-]",n+1)){i.push(hd(w+"-")),n+=2;continue}if(r.startsWith("-",n+1)){p=w,n+=2;continue}i.push(hd(w)),n++}if(d<n)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,r.length-t,!0];if(s.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!c){let w=i[0].length===2?i[0].slice(-1):i[0];return[ZI(w),!1,d-t,!1]}let m="["+(c?"^":"")+pv(i)+"]",h="["+(c?"":"^")+pv(s)+"]";return[i.length&&s.length?"("+m+"|"+h+")":i.length?m:h,o,d-t,!0]}});var Zr,vh=g(()=>{Zr=(r,{windowsPathsNoEscape:e=!1}={})=>e?r.replace(/\[([^\/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")});var eP,hv,tP,Sh,rP,iP,sP,nP,By,fv,gv,Ho,Wy=g(()=>{mv();vh();eP=new Set(["!","?","+","*","@"]),hv=r=>eP.has(r),tP="(?!(?:^|/)\\.\\.?(?:$|/))",Sh="(?!\\.)",rP=new Set(["[","."]),iP=new Set(["..","."]),sP=new Set("().*{}+?[]^$\\!"),nP=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),By="[^/]",fv=By+"*?",gv=By+"+?",Ho=class r{type;#e;#t;#r=!1;#i=[];#s;#m;#u;#o=!1;#c;#l;#d=!1;constructor(e,t,i={}){this.type=e,e&&(this.#t=!0),this.#s=t,this.#e=this.#s?this.#s.#e:this,this.#c=this.#e===this?i:this.#e.#c,this.#u=this.#e===this?[]:this.#e.#u,e==="!"&&!this.#e.#o&&this.#u.push(this),this.#m=this.#s?this.#s.#i.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#i)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#i.map(e=>String(e)).join("|")+")":this.#l=this.#i.map(e=>String(e)).join("")}#n(){if(this!==this.#e)throw new Error("should only call on root");if(this.#o)return this;this.toString(),this.#o=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let t=e,i=t.#s;for(;i;){for(let s=t.#m+1;!i.type&&s<i.#i.length;s++)for(let n of e.#i){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(i.#i[s])}t=i,i=t.#s}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof r&&t.#s===this))throw new Error("invalid part: "+t);this.#i.push(t)}}toJSON(){let e=this.type===null?this.#i.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#i.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#o&&this.#s?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#s?.isStart())return!1;if(this.#m===0)return!0;let e=this.#s;for(let t=0;t<this.#m;t++){let i=e.#i[t];if(!(i instanceof r&&i.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let e=this.#s?this.#s.#i.length:0;return this.#m===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new r(this.type,e);for(let i of this.#i)t.copyIn(i);return t}static#h(e,t,i,s){let n=!1,a=!1,o=-1,l=!1;if(t.type===null){let h=i,f="";for(;h<e.length;){let w=e.charAt(h++);if(n||w==="\\"){n=!n,f+=w;continue}if(a){h===o+1?(w==="^"||w==="!")&&(l=!0):w==="]"&&!(h===o+2&&l)&&(a=!1),f+=w;continue}else if(w==="["){a=!0,o=h,l=!1,f+=w;continue}if(!s.noext&&hv(w)&&e.charAt(h)==="("){t.push(f),f="";let b=new r(w,t);h=r.#h(e,b,h,s),t.push(b);continue}f+=w}return t.push(f),h}let c=i+1,d=new r(null,t),p=[],m="";for(;c<e.length;){let h=e.charAt(c++);if(n||h==="\\"){n=!n,m+=h;continue}if(a){c===o+1?(h==="^"||h==="!")&&(l=!0):h==="]"&&!(c===o+2&&l)&&(a=!1),m+=h;continue}else if(h==="["){a=!0,o=c,l=!1,m+=h;continue}if(hv(h)&&e.charAt(c)==="("){d.push(m),m="";let f=new r(h,d);d.push(f),c=r.#h(e,f,c,s);continue}if(h==="|"){d.push(m),m="",p.push(d),d=new r(null,t);continue}if(h===")")return m===""&&t.#i.length===0&&(t.#d=!0),d.push(m),m="",t.push(...p,d),c;m+=h}return t.type=null,t.#t=void 0,t.#i=[e.substring(i-1)],c}static fromGlob(e,t={}){let i=new r(null,void 0,t);return r.#h(e,i,0,t),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,i,s,n]=this.toRegExpSource();if(!(s||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return i;let o=(this.#c.nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${t}$`,o),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&this.#n(),!this.type){let l=this.isStart()&&this.isEnd(),c=this.#i.map(h=>{let[f,w,b,v]=typeof h=="string"?r.#g(h,this.#t,l):h.toRegExpSource(e);return this.#t=this.#t||b,this.#r=this.#r||v,f}).join(""),d="";if(this.isStart()&&typeof this.#i[0]=="string"&&!(this.#i.length===1&&iP.has(this.#i[0]))){let f=rP,w=t&&f.has(c.charAt(0))||c.startsWith("\\.")&&f.has(c.charAt(2))||c.startsWith("\\.\\.")&&f.has(c.charAt(4)),b=!t&&!e&&f.has(c.charAt(0));d=w?tP:b?Sh:""}let p="";return this.isEnd()&&this.#e.#o&&this.#s?.type==="!"&&(p="(?:$|\\/)"),[d+c+p,Zr(c),this.#t=!!this.#t,this.#r]}let i=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",n=this.#b(t);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let l=this.toString();return this.#i=[l],this.type=null,this.#t=void 0,[l,Zr(this.toString()),!1,!1]}let a=!i||e||t||!Sh?"":this.#b(!0);a===n&&(a=""),a&&(n=`(?:${n})(?:${a})*?`);let o="";if(this.type==="!"&&this.#d)o=(this.isStart()&&!t?Sh:"")+gv;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Sh:"")+fv+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=s+n+l}return[o,Zr(n),this.#t=!!this.#t,this.#r]}#b(e){return this.#i.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[i,s,n,a]=t.toRegExpSource(e);return this.#r=this.#r||a,i}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#g(e,t,i=!1){let s=!1,n="",a=!1;for(let o=0;o<e.length;o++){let l=e.charAt(o);if(s){s=!1,n+=(sP.has(l)?"\\":"")+l;continue}if(l==="\\"){o===e.length-1?n+="\\\\":s=!0;continue}if(l==="["){let[c,d,p,m]=uv(e,o);if(p){n+=c,a=a||d,o+=p-1,t=t||m;continue}}if(l==="*"){i&&e==="*"?n+=gv:n+=fv,t=!0;continue}if(l==="?"){n+=By,t=!0;continue}n+=nP(l)}return[n,Zr(e),!!t,a]}}});var Qo,zy=g(()=>{Qo=(r,{windowsPathsNoEscape:e=!1}={})=>e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&")});var Wt,aP,oP,lP,cP,dP,pP,uP,mP,hP,fP,gP,yP,wP,bP,vP,SP,xP,TP,bv,vv,Sv,yv,_P,St,EP,NP,CP,AP,RP,Cr,MP,xv,kP,IP,wv,PP,cr,Bs=g(()=>{cv();dv();Wy();zy();vh();Wy();zy();vh();Wt=(r,e,t={})=>(md(e),!t.nocomment&&e.charAt(0)==="#"?!1:new cr(e,t).match(r)),aP=/^\*+([^+@!?\*\[\(]*)$/,oP=r=>e=>!e.startsWith(".")&&e.endsWith(r),lP=r=>e=>e.endsWith(r),cP=r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),dP=r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),pP=/^\*+\.\*+$/,uP=r=>!r.startsWith(".")&&r.includes("."),mP=r=>r!=="."&&r!==".."&&r.includes("."),hP=/^\.\*+$/,fP=r=>r!=="."&&r!==".."&&r.startsWith("."),gP=/^\*+$/,yP=r=>r.length!==0&&!r.startsWith("."),wP=r=>r.length!==0&&r!=="."&&r!=="..",bP=/^\?+([^+@!?\*\[\(]*)?$/,vP=([r,e=""])=>{let t=bv([r]);return e?(e=e.toLowerCase(),i=>t(i)&&i.toLowerCase().endsWith(e)):t},SP=([r,e=""])=>{let t=vv([r]);return e?(e=e.toLowerCase(),i=>t(i)&&i.toLowerCase().endsWith(e)):t},xP=([r,e=""])=>{let t=vv([r]);return e?i=>t(i)&&i.endsWith(e):t},TP=([r,e=""])=>{let t=bv([r]);return e?i=>t(i)&&i.endsWith(e):t},bv=([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},vv=([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},Sv=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",yv={win32:{sep:"\\"},posix:{sep:"/"}},_P=Sv==="win32"?yv.win32.sep:yv.posix.sep;Wt.sep=_P;St=Symbol("globstar **");Wt.GLOBSTAR=St;EP="[^/]",NP=EP+"*?",CP="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",AP="(?:(?!(?:\\/|^)\\.).)*?",RP=(r,e={})=>t=>Wt(t,r,e);Wt.filter=RP;Cr=(r,e={})=>Object.assign({},r,e),MP=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return Wt;let e=Wt;return Object.assign((i,s,n={})=>e(i,s,Cr(r,n)),{Minimatch:class extends e.Minimatch{constructor(s,n={}){super(s,Cr(r,n))}static defaults(s){return e.defaults(Cr(r,s)).Minimatch}},AST:class extends e.AST{constructor(s,n,a={}){super(s,n,Cr(r,a))}static fromGlob(s,n={}){return e.AST.fromGlob(s,Cr(r,n))}},unescape:(i,s={})=>e.unescape(i,Cr(r,s)),escape:(i,s={})=>e.escape(i,Cr(r,s)),filter:(i,s={})=>e.filter(i,Cr(r,s)),defaults:i=>e.defaults(Cr(r,i)),makeRe:(i,s={})=>e.makeRe(i,Cr(r,s)),braceExpand:(i,s={})=>e.braceExpand(i,Cr(r,s)),match:(i,s,n={})=>e.match(i,s,Cr(r,n)),sep:e.sep,GLOBSTAR:St})};Wt.defaults=MP;xv=(r,e={})=>(md(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:lv(r));Wt.braceExpand=xv;kP=(r,e={})=>new cr(r,e).makeRe();Wt.makeRe=kP;IP=(r,e,t={})=>{let i=new cr(e,t);return r=r.filter(s=>i.match(s)),i.options.nonull&&!r.length&&r.push(e),r};Wt.match=IP;wv=/[?*]|[+@!]\(.*?\)|\[|\]/,PP=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),cr=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){md(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||Sv,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((n,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=n[0]===""&&n[1]===""&&(n[2]==="?"||!wv.test(n[2]))&&!wv.test(n[3]),c=/^[a-z]:/i.test(n[0]);if(l)return[...n.slice(0,4),...n.slice(4).map(d=>this.parse(d))];if(c)return[n[0],...n.slice(1).map(d=>this.parse(d))]}return n.map(l=>this.parse(l))});if(this.debug(this.pattern,s),this.set=s.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let a=this.set[n];a[0]===""&&a[1]===""&&this.globParts[n][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let i=0;i<e.length;i++)for(let s=0;s<e[i].length;s++)e[i][s]==="**"&&(e[i][s]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let i=-1;for(;(i=t.indexOf("**",i+1))!==-1;){let s=i;for(;t[s+1]==="**";)s++;s!==i&&t.splice(i,s-i)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((i,s)=>{let n=i[i.length-1];return s==="**"&&n==="**"?i:s===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(i.pop(),i):(i.push(s),i)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let s=1;s<e.length-1;s++){let n=e[s];s===1&&n===""&&e[0]===""||(n==="."||n==="")&&(t=!0,e.splice(s,1),s--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let i=0;for(;(i=e.indexOf("..",i+1))!==-1;){let s=e[i-1];s&&s!=="."&&s!==".."&&s!=="**"&&(t=!0,e.splice(i-1,2),i-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let i of e){let s=-1;for(;(s=i.indexOf("**",s+1))!==-1;){let a=s;for(;i[a+1]==="**";)a++;a>s&&i.splice(s+1,a-s);let o=i[s+1],l=i[s+2],c=i[s+3];if(o!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;t=!0,i.splice(s,1);let d=i.slice(0);d[s]="**",e.push(d),s--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let o=i[a];a===1&&o===""&&i[0]===""||(o==="."||o==="")&&(t=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(t=!0,i.pop())}let n=0;for(;(n=i.indexOf("..",n+1))!==-1;){let a=i[n-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=n===1&&i[n+1]==="**"?["."]:[];i.splice(n-1,2,...l),i.length===0&&i.push(""),n-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let i=t+1;i<e.length;i++){let s=this.partsMatch(e[t],e[i],!this.preserveMultipleSlashes);if(s){e[t]=[],e[i]=s;break}}return e.filter(t=>t.length)}partsMatch(e,t,i=!1){let s=0,n=0,a=[],o="";for(;s<e.length&&n<t.length;)if(e[s]===t[n])a.push(o==="b"?t[n]:e[s]),s++,n++;else if(i&&e[s]==="**"&&t[n]===e[s+1])a.push(e[s]),s++;else if(i&&t[n]==="**"&&e[s]===t[n+1])a.push(t[n]),n++;else if(e[s]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(o==="b")return!1;o="a",a.push(e[s]),s++,n++}else if(t[n]==="*"&&e[s]&&(this.options.dot||!e[s].startsWith("."))&&e[s]!=="**"){if(o==="a")return!1;o="b",a.push(t[n]),s++,n++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,i=0;for(let s=0;s<e.length&&e.charAt(s)==="!";s++)t=!t,i++;i&&(this.pattern=e.slice(i)),this.negate=t}matchOne(e,t,i=!1){let s=this.options;if(this.isWindows){let w=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),b=!w&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),v=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),S=!v&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),y=b?3:w?0:void 0,_=S?3:v?0:void 0;if(typeof y=="number"&&typeof _=="number"){let[E,D]=[e[y],t[_]];E.toLowerCase()===D.toLowerCase()&&(t[_]=E,_>y?t=t.slice(_):y>_&&(e=e.slice(y)))}}let{optimizationLevel:n=1}=this.options;n>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var a=0,o=0,l=e.length,c=t.length;a<l&&o<c;a++,o++){this.debug("matchOne loop");var d=t[o],p=e[a];if(this.debug(t,d,p),d===!1)return!1;if(d===St){this.debug("GLOBSTAR",[t,d,p]);var m=a,h=o+1;if(h===c){for(this.debug("** at the end");a<l;a++)if(e[a]==="."||e[a]===".."||!s.dot&&e[a].charAt(0)===".")return!1;return!0}for(;m<l;){var f=e[m];if(this.debug(`
180
- globstar while`,e,m,t,h,f),this.matchOne(e.slice(m),t.slice(h),i))return this.debug("globstar found match!",m,l,f),!0;if(f==="."||f===".."||!s.dot&&f.charAt(0)==="."){this.debug("dot detected!",e,m,t,h);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(i&&(this.debug(`
181
- >>> no match, partial?`,e,m,t,h),m===l))}let w;if(typeof d=="string"?(w=p===d,this.debug("string match",d,p,w)):(w=d.test(p),this.debug("pattern match",d,p,w)),!w)return!1}if(a===l&&o===c)return!0;if(a===l)return i;if(o===c)return a===l-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return xv(this.pattern,this.options)}parse(e){md(e);let t=this.options;if(e==="**")return St;if(e==="")return"";let i,s=null;(i=e.match(gP))?s=t.dot?wP:yP:(i=e.match(aP))?s=(t.nocase?t.dot?dP:cP:t.dot?lP:oP)(i[1]):(i=e.match(bP))?s=(t.nocase?t.dot?SP:vP:t.dot?xP:TP)(i):(i=e.match(pP))?s=t.dot?mP:uP:(i=e.match(hP))&&(s=fP);let n=Ho.fromGlob(e,this.options).toMMPattern();return s&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:s}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,i=t.noglobstar?NP:t.dot?CP:AP,s=new Set(t.nocase?["i"]:[]),n=e.map(l=>{let c=l.map(d=>{if(d instanceof RegExp)for(let p of d.flags.split(""))s.add(p);return typeof d=="string"?PP(d):d===St?St:d._src});return c.forEach((d,p)=>{let m=c[p+1],h=c[p-1];d!==St||h===St||(h===void 0?m!==void 0&&m!==St?c[p+1]="(?:\\/|"+i+"\\/)?"+m:c[p]=i:m===void 0?c[p-1]=h+"(?:\\/|"+i+")?":m!==St&&(c[p-1]=h+"(?:\\/|\\/"+i+"\\/)"+m,c[p+1]=St))}),c.filter(d=>d!==St).join("/")}).join("|"),[a,o]=e.length>1?["(?:",")"]:["",""];n="^"+a+n+o+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let s=this.slashSplit(e);this.debug(this.pattern,"split",s);let n=this.set;this.debug(this.pattern,"set",n);let a=s[s.length-1];if(!a)for(let o=s.length-2;!a&&o>=0;o--)a=s[o];for(let o=0;o<n.length;o++){let l=n[o],c=s;if(i.matchBase&&l.length===1&&(c=[a]),this.matchOne(c,l,t))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return Wt.defaults(e).Minimatch}};Wt.AST=Ho;Wt.Minimatch=cr;Wt.escape=Qo;Wt.unescape=Zr});var Go,_v,Uy,Ev,xh,Tv,OP,Ure,Ws,Nv,Ko,jy,fd,Cv=g(()=>{Go=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,_v=new Set,Uy=typeof process=="object"&&process?process:{},Ev=(r,e,t,i)=>{typeof Uy.emitWarning=="function"?Uy.emitWarning(r,e,t,i):console.error(`[${t}] ${e}: ${r}`)},xh=globalThis.AbortController,Tv=globalThis.AbortSignal;if(typeof xh>"u"){Tv=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,s){this._onabort.push(s)}},xh=class{constructor(){e()}signal=new Tv;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i)}}};let r=Uy.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{r&&(r=!1,Ev("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}OP=r=>!_v.has(r),Ure=Symbol("type"),Ws=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),Nv=r=>Ws(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Ko:null:null,Ko=class extends Array{constructor(e){super(e),this.fill(0)}},jy=class r{heap;length;static#e=!1;static create(e){let t=Nv(e);if(!t)return[];r.#e=!0;let i=new r(e,t);return r.#e=!1,i}constructor(e,t){if(!r.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},fd=class r{#e;#t;#r;#i;#s;#m;#u;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#c;#l;#d;#n;#h;#b;#g;#y;#C;#w;#A;#x;#S;#v;#E;#f;#M;static unsafeExposeInternals(e){return{starts:e.#x,ttls:e.#S,sizes:e.#A,keyMap:e.#l,keyList:e.#d,valList:e.#n,next:e.#h,prev:e.#b,get head(){return e.#g},get tail(){return e.#y},free:e.#C,isBackgroundFetch:t=>e.#p(t),backgroundFetch:(t,i,s,n)=>e.#D(t,i,s,n),moveToTail:t=>e.#L(t),indexes:t=>e.#N(t),rindexes:t=>e.#R(t),isStale:t=>e.#_(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#c}get size(){return this.#o}get fetchMethod(){return this.#m}get memoMethod(){return this.#u}get dispose(){return this.#r}get onInsert(){return this.#i}get disposeAfter(){return this.#s}constructor(e){let{max:t=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:l,dispose:c,onInsert:d,disposeAfter:p,noDisposeOnSet:m,noUpdateTTL:h,maxSize:f=0,maxEntrySize:w=0,sizeCalculation:b,fetchMethod:v,memoMethod:S,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:D,ignoreFetchAbort:X}=e;if(t!==0&&!Ws(t))throw new TypeError("max option must be a nonnegative integer");let $=t?Nv(t):Array;if(!$)throw new Error("invalid max value: "+t);if(this.#e=t,this.#t=f,this.maxEntrySize=w||this.#t,this.sizeCalculation=b,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#u=S,v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#m=v,this.#E=!!v,this.#l=new Map,this.#d=new Array(t).fill(void 0),this.#n=new Array(t).fill(void 0),this.#h=new $(t),this.#b=new $(t),this.#g=0,this.#y=0,this.#C=jy.create(t),this.#o=0,this.#c=0,typeof c=="function"&&(this.#r=c),typeof d=="function"&&(this.#i=d),typeof p=="function"?(this.#s=p,this.#w=[]):(this.#s=void 0,this.#w=void 0),this.#v=!!this.#r,this.#M=!!this.#i,this.#f=!!this.#s,this.noDisposeOnSet=!!m,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!D,this.ignoreFetchAbort=!!X,this.maxEntrySize!==0){if(this.#t!==0&&!Ws(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!Ws(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=Ws(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!Ws(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#a()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let M="LRU_CACHE_UNBOUNDED";OP(M)&&(_v.add(M),Ev("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",M,r))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#a(){let e=new Ko(this.#e),t=new Ko(this.#e);this.#S=e,this.#x=t,this.#k=(n,a,o=Go.now())=>{if(t[n]=a!==0?o:0,e[n]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#_(n)&&this.#I(this.#d[n],"expire")},a+1);l.unref&&l.unref()}},this.#P=n=>{t[n]=e[n]!==0?Go.now():0},this.#T=(n,a)=>{if(e[a]){let o=e[a],l=t[a];if(!o||!l)return;n.ttl=o,n.start=l,n.now=i||s();let c=n.now-l;n.remainingTTL=o-c}};let i=0,s=()=>{let n=Go.now();if(this.ttlResolution>0){i=n;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#l.get(n);if(a===void 0)return 0;let o=e[a],l=t[a];if(!o||!l)return 1/0;let c=(i||s())-l;return o-c},this.#_=n=>{let a=t[n],o=e[n];return!!o&&!!a&&(i||s())-a>o}}#P=()=>{};#T=()=>{};#k=()=>{};#_=()=>!1;#B(){let e=new Ko(this.#e);this.#c=0,this.#A=e,this.#O=t=>{this.#c-=e[t],e[t]=0},this.#W=(t,i,s,n)=>{if(this.#p(i))return 0;if(!Ws(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,t),!Ws(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#$=(t,i,s)=>{if(e[t]=i,this.#t){let n=this.#t-e[t];for(;this.#c>n;)this.#F(!0)}this.#c+=e[t],s&&(s.entrySize=i,s.totalCalculatedSize=this.#c)}}#O=e=>{};#$=(e,t,i)=>{};#W=(e,t,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#N({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#y;!(!this.#z(t)||((e||!this.#_(t))&&(yield t),t===this.#g));)t=this.#b[t]}*#R({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#g;!(!this.#z(t)||((e||!this.#_(t))&&(yield t),t===this.#y));)t=this.#h[t]}#z(e){return e!==void 0&&this.#l.get(this.#d[e])===e}*entries(){for(let e of this.#N())this.#n[e]!==void 0&&this.#d[e]!==void 0&&!this.#p(this.#n[e])&&(yield[this.#d[e],this.#n[e]])}*rentries(){for(let e of this.#R())this.#n[e]!==void 0&&this.#d[e]!==void 0&&!this.#p(this.#n[e])&&(yield[this.#d[e],this.#n[e]])}*keys(){for(let e of this.#N()){let t=this.#d[e];t!==void 0&&!this.#p(this.#n[e])&&(yield t)}}*rkeys(){for(let e of this.#R()){let t=this.#d[e];t!==void 0&&!this.#p(this.#n[e])&&(yield t)}}*values(){for(let e of this.#N())this.#n[e]!==void 0&&!this.#p(this.#n[e])&&(yield this.#n[e])}*rvalues(){for(let e of this.#R())this.#n[e]!==void 0&&!this.#p(this.#n[e])&&(yield this.#n[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#N()){let s=this.#n[i],n=this.#p(s)?s.__staleWhileFetching:s;if(n!==void 0&&e(n,this.#d[i],this))return this.get(this.#d[i],t)}}forEach(e,t=this){for(let i of this.#N()){let s=this.#n[i],n=this.#p(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#d[i],this)}}rforEach(e,t=this){for(let i of this.#R()){let s=this.#n[i],n=this.#p(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#d[i],this)}}purgeStale(){let e=!1;for(let t of this.#R({allowStale:!0}))this.#_(t)&&(this.#I(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let i=this.#n[t],s=this.#p(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#S&&this.#x){let a=this.#S[t],o=this.#x[t];if(a&&o){let l=a-(Go.now()-o);n.ttl=l,n.start=Date.now()}}return this.#A&&(n.size=this.#A[t]),n}dump(){let e=[];for(let t of this.#N({allowStale:!0})){let i=this.#d[t],s=this.#n[t],n=this.#p(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let a={value:n};if(this.#S&&this.#x){a.ttl=this.#S[t];let o=Go.now()-this.#x[t];a.start=Math.floor(Date.now()-o)}this.#A&&(a.size=this.#A[t]),e.unshift([i,a])}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let s=Date.now()-i.start;i.start=Go.now()-s}this.set(t,i.value,i)}}set(e,t,i={}){if(t===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=i,{noUpdateTTL:c=this.noUpdateTTL}=i,d=this.#W(e,t,i.size||0,o);if(this.maxEntrySize&&d>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#I(e,"set"),this;let p=this.#o===0?void 0:this.#l.get(e);if(p===void 0)p=this.#o===0?this.#y:this.#C.length!==0?this.#C.pop():this.#o===this.#e?this.#F(!1):this.#o,this.#d[p]=e,this.#n[p]=t,this.#l.set(e,p),this.#h[this.#y]=p,this.#b[p]=this.#y,this.#y=p,this.#o++,this.#$(p,d,l),l&&(l.set="add"),c=!1,this.#M&&this.#i?.(t,e,"add");else{this.#L(p);let m=this.#n[p];if(t!==m){if(this.#E&&this.#p(m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:h}=m;h!==void 0&&!a&&(this.#v&&this.#r?.(h,e,"set"),this.#f&&this.#w?.push([h,e,"set"]))}else a||(this.#v&&this.#r?.(m,e,"set"),this.#f&&this.#w?.push([m,e,"set"]));if(this.#O(p),this.#$(p,d,l),this.#n[p]=t,l){l.set="replace";let h=m&&this.#p(m)?m.__staleWhileFetching:m;h!==void 0&&(l.oldValue=h)}}else l&&(l.set="update");this.#M&&this.onInsert?.(t,e,t===m?"update":"replace")}if(s!==0&&!this.#S&&this.#a(),this.#S&&(c||this.#k(p,s,n),l&&this.#T(l,p)),!a&&this.#f&&this.#w){let m=this.#w,h;for(;h=m?.shift();)this.#s?.(...h)}return this}pop(){try{for(;this.#o;){let e=this.#n[this.#g];if(this.#F(!0),this.#p(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#w){let e=this.#w,t;for(;t=e?.shift();)this.#s?.(...t)}}}#F(e){let t=this.#g,i=this.#d[t],s=this.#n[t];return this.#E&&this.#p(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#f)&&(this.#v&&this.#r?.(s,i,"evict"),this.#f&&this.#w?.push([s,i,"evict"])),this.#O(t),e&&(this.#d[t]=void 0,this.#n[t]=void 0,this.#C.push(t)),this.#o===1?(this.#g=this.#y=0,this.#C.length=0):this.#g=this.#h[t],this.#l.delete(i),this.#o--,t}has(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=t,n=this.#l.get(e);if(n!==void 0){let a=this.#n[n];if(this.#p(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#_(n))s&&(s.has="stale",this.#T(s,n));else return i&&this.#P(n),s&&(s.has="hit",this.#T(s,n)),!0}else s&&(s.has="miss");return!1}peek(e,t={}){let{allowStale:i=this.allowStale}=t,s=this.#l.get(e);if(s===void 0||!i&&this.#_(s))return;let n=this.#n[s];return this.#p(n)?n.__staleWhileFetching:n}#D(e,t,i,s){let n=t===void 0?void 0:this.#n[t];if(this.#p(n))return n;let a=new xh,{signal:o}=i;o?.addEventListener("abort",()=>a.abort(o.reason),{signal:a.signal});let l={signal:a.signal,options:i,context:s},c=(w,b=!1)=>{let{aborted:v}=a.signal,S=i.ignoreFetchAbort&&w!==void 0;if(i.status&&(v&&!b?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,S&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),v&&!S&&!b)return p(a.signal.reason);let y=h;return this.#n[t]===h&&(w===void 0?y.__staleWhileFetching?this.#n[t]=y.__staleWhileFetching:this.#I(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,w,l.options))),w},d=w=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=w),p(w)),p=w=>{let{aborted:b}=a.signal,v=b&&i.allowStaleOnFetchAbort,S=v||i.allowStaleOnFetchRejection,y=S||i.noDeleteOnFetchRejection,_=h;if(this.#n[t]===h&&(!y||_.__staleWhileFetching===void 0?this.#I(e,"fetch"):v||(this.#n[t]=_.__staleWhileFetching)),S)return i.status&&_.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),_.__staleWhileFetching;if(_.__returned===_)throw w},m=(w,b)=>{let v=this.#m?.(e,n,l);v&&v instanceof Promise&&v.then(S=>w(S===void 0?void 0:S),b),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(w(void 0),i.allowStaleOnFetchAbort&&(w=S=>c(S,!0)))})};i.status&&(i.status.fetchDispatched=!0);let h=new Promise(m).then(c,d),f=Object.assign(h,{__abortController:a,__staleWhileFetching:n,__returned:void 0});return t===void 0?(this.set(e,f,{...l.options,status:void 0}),t=this.#l.get(e)):this.#n[t]=f,f}#p(e){if(!this.#E)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof xh}async fetch(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:h=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:w,forceRefresh:b=!1,status:v,signal:S}=t;if(!this.#E)return v&&(v.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:v});let y={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:a,noDisposeOnSet:o,size:l,sizeCalculation:c,noUpdateTTL:d,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:f,ignoreFetchAbort:h,status:v,signal:S},_=this.#l.get(e);if(_===void 0){v&&(v.fetch="miss");let E=this.#D(e,_,y,w);return E.__returned=E}else{let E=this.#n[_];if(this.#p(E)){let F=i&&E.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",F&&(v.returnedStale=!0)),F?E.__staleWhileFetching:E.__returned=E}let D=this.#_(_);if(!b&&!D)return v&&(v.fetch="hit"),this.#L(_),s&&this.#P(_),v&&this.#T(v,_),E;let X=this.#D(e,_,y,w),M=X.__staleWhileFetching!==void 0&&i;return v&&(v.fetch=D?"stale":"refresh",M&&D&&(v.returnedStale=!0)),M?X.__staleWhileFetching:X.__returned=X}}async forceFetch(e,t={}){let i=await this.fetch(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let i=this.#u;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...a}=t,o=this.get(e,a);if(!n&&o!==void 0)return o;let l=i(e,o,{options:a,context:s});return this.set(e,l,a),l}get(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:a}=t,o=this.#l.get(e);if(o!==void 0){let l=this.#n[o],c=this.#p(l);return a&&this.#T(a,o),this.#_(o)?(a&&(a.get="stale"),c?(a&&i&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?l.__staleWhileFetching:void 0):(n||this.#I(e,"expire"),a&&i&&(a.returnedStale=!0),i?l:void 0)):(a&&(a.get="hit"),c?l.__staleWhileFetching:(this.#L(o),s&&this.#P(o),l))}else a&&(a.get="miss")}#U(e,t){this.#b[t]=e,this.#h[e]=t}#L(e){e!==this.#y&&(e===this.#g?this.#g=this.#h[e]:this.#U(this.#b[e],this.#h[e]),this.#U(this.#y,e),this.#y=e)}delete(e){return this.#I(e,"delete")}#I(e,t){let i=!1;if(this.#o!==0){let s=this.#l.get(e);if(s!==void 0)if(i=!0,this.#o===1)this.#q(t);else{this.#O(s);let n=this.#n[s];if(this.#p(n)?n.__abortController.abort(new Error("deleted")):(this.#v||this.#f)&&(this.#v&&this.#r?.(n,e,t),this.#f&&this.#w?.push([n,e,t])),this.#l.delete(e),this.#d[s]=void 0,this.#n[s]=void 0,s===this.#y)this.#y=this.#b[s];else if(s===this.#g)this.#g=this.#h[s];else{let a=this.#b[s];this.#h[a]=this.#h[s];let o=this.#h[s];this.#b[o]=this.#b[s]}this.#o--,this.#C.push(s)}}if(this.#f&&this.#w?.length){let s=this.#w,n;for(;n=s?.shift();)this.#s?.(...n)}return i}clear(){return this.#q("delete")}#q(e){for(let t of this.#R({allowStale:!0})){let i=this.#n[t];if(this.#p(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#d[t];this.#v&&this.#r?.(i,s,e),this.#f&&this.#w?.push([i,s,e])}}if(this.#l.clear(),this.#n.fill(void 0),this.#d.fill(void 0),this.#S&&this.#x&&(this.#S.fill(0),this.#x.fill(0)),this.#A&&this.#A.fill(0),this.#g=0,this.#y=0,this.#C.length=0,this.#c=0,this.#o=0,this.#f&&this.#w){let t=this.#w,i;for(;i=t?.shift();)this.#s?.(...i)}}}});var Rh,Xy,Iv,Av,DP,$P,FP,Ki,Ji,zs,Th,gd,_h,Rv,Eh,Mv,ei,Jo,lt,yd,Xo,ct,zt,dt,Vy,Nh,kt,ze,Hy,Qy,kv,Gy,Ti,Ky,Ch,wd,Gn,dr,bd,LP,qP,BP,WP,Ah,Jy,zP,UP,Us,Yy=g(()=>{Rh=require("node:events"),Xy=k(require("node:stream"),1),Iv=require("node:string_decoder"),Av=typeof process=="object"&&process?process:{stdout:null,stderr:null},DP=r=>!!r&&typeof r=="object"&&(r instanceof Us||r instanceof Xy.default||$P(r)||FP(r)),$P=r=>!!r&&typeof r=="object"&&r instanceof Rh.EventEmitter&&typeof r.pipe=="function"&&r.pipe!==Xy.default.Writable.prototype.pipe,FP=r=>!!r&&typeof r=="object"&&r instanceof Rh.EventEmitter&&typeof r.write=="function"&&typeof r.end=="function",Ki=Symbol("EOF"),Ji=Symbol("maybeEmitEnd"),zs=Symbol("emittedEnd"),Th=Symbol("emittingEnd"),gd=Symbol("emittedError"),_h=Symbol("closed"),Rv=Symbol("read"),Eh=Symbol("flush"),Mv=Symbol("flushChunk"),ei=Symbol("encoding"),Jo=Symbol("decoder"),lt=Symbol("flowing"),yd=Symbol("paused"),Xo=Symbol("resume"),ct=Symbol("buffer"),zt=Symbol("pipes"),dt=Symbol("bufferLength"),Vy=Symbol("bufferPush"),Nh=Symbol("bufferShift"),kt=Symbol("objectMode"),ze=Symbol("destroyed"),Hy=Symbol("error"),Qy=Symbol("emitData"),kv=Symbol("emitEnd"),Gy=Symbol("emitEnd2"),Ti=Symbol("async"),Ky=Symbol("abort"),Ch=Symbol("aborted"),wd=Symbol("signal"),Gn=Symbol("dataListeners"),dr=Symbol("discarded"),bd=r=>Promise.resolve().then(r),LP=r=>r(),qP=r=>r==="end"||r==="finish"||r==="prefinish",BP=r=>r instanceof ArrayBuffer||!!r&&typeof r=="object"&&r.constructor&&r.constructor.name==="ArrayBuffer"&&r.byteLength>=0,WP=r=>!Buffer.isBuffer(r)&&ArrayBuffer.isView(r),Ah=class{src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Xo](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Jy=class extends Ah{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>t.emit("error",s),e.on("error",this.proxyErrors)}},zP=r=>!!r.objectMode,UP=r=>!r.objectMode&&!!r.encoding&&r.encoding!=="buffer",Us=class extends Rh.EventEmitter{[lt]=!1;[yd]=!1;[zt]=[];[ct]=[];[kt];[ei];[Ti];[Jo];[Ki]=!1;[zs]=!1;[Th]=!1;[_h]=!1;[gd]=null;[dt]=0;[ze]=!1;[wd];[Ch]=!1;[Gn]=0;[dr]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");zP(t)?(this[kt]=!0,this[ei]=null):UP(t)?(this[ei]=t.encoding,this[kt]=!1):(this[kt]=!1,this[ei]=null),this[Ti]=!!t.async,this[Jo]=this[ei]?new Iv.StringDecoder(this[ei]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[ct]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[zt]});let{signal:i}=t;i&&(this[wd]=i,i.aborted?this[Ky]():i.addEventListener("abort",()=>this[Ky]()))}get bufferLength(){return this[dt]}get encoding(){return this[ei]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[kt]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ti]}set async(e){this[Ti]=this[Ti]||!!e}[Ky](){this[Ch]=!0,this.emit("abort",this[wd]?.reason),this.destroy(this[wd]?.reason)}get aborted(){return this[Ch]}set aborted(e){}write(e,t,i){if(this[Ch])return!1;if(this[Ki])throw new Error("write after end");if(this[ze])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let s=this[Ti]?bd:LP;if(!this[kt]&&!Buffer.isBuffer(e)){if(WP(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(BP(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[kt]?(this[lt]&&this[dt]!==0&&this[Eh](!0),this[lt]?this.emit("data",e):this[Vy](e),this[dt]!==0&&this.emit("readable"),i&&s(i),this[lt]):e.length?(typeof e=="string"&&!(t===this[ei]&&!this[Jo]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ei]&&(e=this[Jo].write(e)),this[lt]&&this[dt]!==0&&this[Eh](!0),this[lt]?this.emit("data",e):this[Vy](e),this[dt]!==0&&this.emit("readable"),i&&s(i),this[lt]):(this[dt]!==0&&this.emit("readable"),i&&s(i),this[lt])}read(e){if(this[ze])return null;if(this[dr]=!1,this[dt]===0||e===0||e&&e>this[dt])return this[Ji](),null;this[kt]&&(e=null),this[ct].length>1&&!this[kt]&&(this[ct]=[this[ei]?this[ct].join(""):Buffer.concat(this[ct],this[dt])]);let t=this[Rv](e||null,this[ct][0]);return this[Ji](),t}[Rv](e,t){if(this[kt])this[Nh]();else{let i=t;e===i.length||e===null?this[Nh]():typeof i=="string"?(this[ct][0]=i.slice(e),t=i.slice(0,e),this[dt]-=e):(this[ct][0]=i.subarray(e),t=i.subarray(0,e),this[dt]-=e)}return this.emit("data",t),!this[ct].length&&!this[Ki]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[Ki]=!0,this.writable=!1,(this[lt]||!this[yd])&&this[Ji](),this}[Xo](){this[ze]||(!this[Gn]&&!this[zt].length&&(this[dr]=!0),this[yd]=!1,this[lt]=!0,this.emit("resume"),this[ct].length?this[Eh]():this[Ki]?this[Ji]():this.emit("drain"))}resume(){return this[Xo]()}pause(){this[lt]=!1,this[yd]=!0,this[dr]=!1}get destroyed(){return this[ze]}get flowing(){return this[lt]}get paused(){return this[yd]}[Vy](e){this[kt]?this[dt]+=1:this[dt]+=e.length,this[ct].push(e)}[Nh](){return this[kt]?this[dt]-=1:this[dt]-=this[ct][0].length,this[ct].shift()}[Eh](e=!1){do;while(this[Mv](this[Nh]())&&this[ct].length);!e&&!this[ct].length&&!this[Ki]&&this.emit("drain")}[Mv](e){return this.emit("data",e),this[lt]}pipe(e,t){if(this[ze])return e;this[dr]=!1;let i=this[zs];return t=t||{},e===Av.stdout||e===Av.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[zt].push(t.proxyErrors?new Jy(this,e,t):new Ah(this,e,t)),this[Ti]?bd(()=>this[Xo]()):this[Xo]()),e}unpipe(e){let t=this[zt].find(i=>i.dest===e);t&&(this[zt].length===1?(this[lt]&&this[Gn]===0&&(this[lt]=!1),this[zt]=[]):this[zt].splice(this[zt].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[dr]=!1,this[Gn]++,!this[zt].length&&!this[lt]&&this[Xo]();else if(e==="readable"&&this[dt]!==0)super.emit("readable");else if(qP(e)&&this[zs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[gd]){let s=t;this[Ti]?bd(()=>s.call(this,this[gd])):s.call(this,this[gd])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[Gn]=this.listeners("data").length,this[Gn]===0&&!this[dr]&&!this[zt].length&&(this[lt]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Gn]=0,!this[dr]&&!this[zt].length&&(this[lt]=!1)),t}get emittedEnd(){return this[zs]}[Ji](){!this[Th]&&!this[zs]&&!this[ze]&&this[ct].length===0&&this[Ki]&&(this[Th]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[_h]&&this.emit("close"),this[Th]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==ze&&this[ze])return!1;if(e==="data")return!this[kt]&&!i?!1:this[Ti]?(bd(()=>this[Qy](i)),!0):this[Qy](i);if(e==="end")return this[kv]();if(e==="close"){if(this[_h]=!0,!this[zs]&&!this[ze])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[gd]=i,super.emit(Hy,i);let n=!this[wd]||this.listeners("error").length?super.emit("error",i):!1;return this[Ji](),n}else if(e==="resume"){let n=super.emit("resume");return this[Ji](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let s=super.emit(e,...t);return this[Ji](),s}[Qy](e){for(let i of this[zt])i.dest.write(e)===!1&&this.pause();let t=this[dr]?!1:super.emit("data",e);return this[Ji](),t}[kv](){return this[zs]?!1:(this[zs]=!0,this.readable=!1,this[Ti]?(bd(()=>this[Gy]()),!0):this[Gy]())}[Gy](){if(this[Jo]){let t=this[Jo].end();if(t){for(let i of this[zt])i.dest.write(t);this[dr]||super.emit("data",t)}}for(let t of this[zt])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[kt]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[kt]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[kt])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ei]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(ze,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[dr]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[Ki])return t();let n,a,o=p=>{this.off("data",l),this.off("end",c),this.off(ze,d),t(),a(p)},l=p=>{this.off("error",o),this.off("end",c),this.off(ze,d),this.pause(),n({value:p,done:!!this[Ki]})},c=()=>{this.off("error",o),this.off("data",l),this.off(ze,d),t(),n({done:!0,value:void 0})},d=()=>o(new Error("stream destroyed"));return new Promise((p,m)=>{a=m,n=p,this.once(ze,d),this.once("error",o),this.once("end",c),this.once("data",l)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[dr]=!1;let e=!1,t=()=>(this.pause(),this.off(Hy,t),this.off(ze,t),this.off("end",t),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return t();let s=this.read();return s===null?t():{done:!1,value:s}};return this.once("end",t),this.once(Hy,t),this.once(ze,t),{next:i,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[ze])return e?this.emit("error",e):this.emit(ze),this;this[ze]=!0,this[dr]=!0,this[ct].length=0,this[dt]=0;let t=this;return typeof t.close=="function"&&!this[_h]&&t.close(),e?this.emit("error",e):this.emit(ze),this}static get isStream(){return DP}}});var Yo,Fv,Ei,jP,js,VP,Sd,Lv,qv,HP,QP,Rr,Bv,Wv,_i,zv,Uv,Kn,jv,Ar,vd,Zy,Pv,xd,ti,Mh,Ih,Ov,GP,e3,Dv,Td,$v,kh,Ph,t3,Vv,It,Oh,Dh,$h,Zo,el,_d,Gre,Hv,Qv=g(()=>{Cv();Yo=require("node:path"),Fv=require("node:url"),Ei=require("fs"),jP=k(require("node:fs"),1),js=require("node:fs/promises");Yy();VP=Ei.realpathSync.native,Sd={lstatSync:Ei.lstatSync,readdir:Ei.readdir,readdirSync:Ei.readdirSync,readlinkSync:Ei.readlinkSync,realpathSync:VP,promises:{lstat:js.lstat,readdir:js.readdir,readlink:js.readlink,realpath:js.realpath}},Lv=r=>!r||r===Sd||r===jP?Sd:{...Sd,...r,promises:{...Sd.promises,...r.promises||{}}},qv=/^\\\\\?\\([a-z]:)\\?$/i,HP=r=>r.replace(/\//g,"\\").replace(qv,"$1\\"),QP=/[\\\/]/,Rr=0,Bv=1,Wv=2,_i=4,zv=6,Uv=8,Kn=10,jv=12,Ar=15,vd=~Ar,Zy=16,Pv=32,xd=64,ti=128,Mh=256,Ih=512,Ov=xd|ti|Ih,GP=1023,e3=r=>r.isFile()?Uv:r.isDirectory()?_i:r.isSymbolicLink()?Kn:r.isCharacterDevice()?Wv:r.isBlockDevice()?zv:r.isSocket()?jv:r.isFIFO()?Bv:Rr,Dv=new Map,Td=r=>{let e=Dv.get(r);if(e)return e;let t=r.normalize("NFKD");return Dv.set(r,t),t},$v=new Map,kh=r=>{let e=$v.get(r);if(e)return e;let t=Td(r.toLowerCase());return $v.set(r,t),t},Ph=class extends fd{constructor(){super({max:256})}},t3=class extends fd{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Vv=Symbol("PathScurry setAsCwd"),It=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#r;get mode(){return this.#r}#i;get nlink(){return this.#i}#s;get uid(){return this.#s}#m;get gid(){return this.#m}#u;get rdev(){return this.#u}#o;get blksize(){return this.#o}#c;get ino(){return this.#c}#l;get size(){return this.#l}#d;get blocks(){return this.#d}#n;get atimeMs(){return this.#n}#h;get mtimeMs(){return this.#h}#b;get ctimeMs(){return this.#b}#g;get birthtimeMs(){return this.#g}#y;get atime(){return this.#y}#C;get mtime(){return this.#C}#w;get ctime(){return this.#w}#A;get birthtime(){return this.#A}#x;#S;#v;#E;#f;#M;#a;#P;#T;#k;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Rr,i,s,n,a,o){this.name=e,this.#x=n?kh(e):Td(e),this.#a=t&GP,this.nocase=n,this.roots=s,this.root=i||this,this.#P=a,this.#v=o.fullpath,this.#f=o.relative,this.#M=o.relativePosix,this.parent=o.parent,this.parent?this.#e=this.parent.#e:this.#e=Lv(o.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#P}resolve(e){if(!e)return this;let t=this.getRootString(e),s=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#_(s):this.#_(s)}#_(e){let t=this;for(let i of e)t=t.child(i);return t}children(){let e=this.#P.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#P.set(this,t),this.#a&=~Zy,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),s=this.nocase?kh(e):Td(e);for(let l of i)if(l.#x===s)return l;let n=this.parent?this.sep:"",a=this.#v?this.#v+n+e:void 0,o=this.newChild(e,Rr,{...t,parent:this,fullpath:a});return this.canReaddir()||(o.#a|=ti),i.push(o),o}relative(){if(this.isCWD)return"";if(this.#f!==void 0)return this.#f;let e=this.name,t=this.parent;if(!t)return this.#f=this.name;let i=t.relative();return i+(!i||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#M!==void 0)return this.#M;let e=this.name,t=this.parent;if(!t)return this.#M=this.fullpathPosix();let i=t.relativePosix();return i+(!i||!t.parent?"":"/")+e}fullpath(){if(this.#v!==void 0)return this.#v;let e=this.name,t=this.parent;if(!t)return this.#v=this.name;let s=t.fullpath()+(t.parent?this.sep:"")+e;return this.#v=s}fullpathPosix(){if(this.#E!==void 0)return this.#E;if(this.sep==="/")return this.#E=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#E=`//?/${s}`:this.#E=s}let e=this.parent,t=e.fullpathPosix(),i=t+(!t||!e.parent?"":"/")+this.name;return this.#E=i}isUnknown(){return(this.#a&Ar)===Rr}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#a&Ar)===Uv}isDirectory(){return(this.#a&Ar)===_i}isCharacterDevice(){return(this.#a&Ar)===Wv}isBlockDevice(){return(this.#a&Ar)===zv}isFIFO(){return(this.#a&Ar)===Bv}isSocket(){return(this.#a&Ar)===jv}isSymbolicLink(){return(this.#a&Kn)===Kn}lstatCached(){return this.#a&Pv?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#k}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let e=this.#a&Ar;return!(e!==Rr&&e!==Kn||this.#a&Mh||this.#a&ti)}calledReaddir(){return!!(this.#a&Zy)}isENOENT(){return!!(this.#a&ti)}isNamed(e){return this.nocase?this.#x===kh(e):this.#x===Td(e)}async readlink(){let e=this.#T;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(t);if(i)return this.#T=i}catch(t){this.#F(t.code);return}}readlinkSync(){let e=this.#T;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(t);if(i)return this.#T=i}catch(t){this.#F(t.code);return}}#B(e){this.#a|=Zy;for(let t=e.provisional;t<e.length;t++){let i=e[t];i&&i.#O()}}#O(){this.#a&ti||(this.#a=(this.#a|ti)&vd,this.#$())}#$(){let e=this.children();e.provisional=0;for(let t of e)t.#O()}#W(){this.#a|=Ih,this.#N()}#N(){if(this.#a&xd)return;let e=this.#a;(e&Ar)===_i&&(e&=vd),this.#a=e|xd,this.#$()}#R(e=""){e==="ENOTDIR"||e==="EPERM"?this.#N():e==="ENOENT"?this.#O():this.children().provisional=0}#z(e=""){e==="ENOTDIR"?this.parent.#N():e==="ENOENT"&&this.#O()}#F(e=""){let t=this.#a;t|=Mh,e==="ENOENT"&&(t|=ti),(e==="EINVAL"||e==="UNKNOWN")&&(t&=vd),this.#a=t,e==="ENOTDIR"&&this.parent&&this.parent.#N()}#D(e,t){return this.#U(e,t)||this.#p(e,t)}#p(e,t){let i=e3(e),s=this.newChild(e.name,i,{parent:this}),n=s.#a&Ar;return n!==_i&&n!==Kn&&n!==Rr&&(s.#a|=xd),t.unshift(s),t.provisional++,s}#U(e,t){for(let i=t.provisional;i<t.length;i++){let s=t[i];if((this.nocase?kh(e.name):Td(e.name))===s.#x)return this.#L(e,s,i,t)}}#L(e,t,i,s){let n=t.name;return t.#a=t.#a&vd|e3(e),n!==e.name&&(t.name=e.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(t)),s.provisional++,t}async lstat(){if((this.#a&ti)===0)try{return this.#I(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#z(e.code)}}lstatSync(){if((this.#a&ti)===0)try{return this.#I(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#z(e.code)}}#I(e){let{atime:t,atimeMs:i,birthtime:s,birthtimeMs:n,blksize:a,blocks:o,ctime:l,ctimeMs:c,dev:d,gid:p,ino:m,mode:h,mtime:f,mtimeMs:w,nlink:b,rdev:v,size:S,uid:y}=e;this.#y=t,this.#n=i,this.#A=s,this.#g=n,this.#o=a,this.#d=o,this.#w=l,this.#b=c,this.#t=d,this.#m=p,this.#c=m,this.#r=h,this.#C=f,this.#h=w,this.#i=b,this.#u=v,this.#l=S,this.#s=y;let _=e3(e);this.#a=this.#a&vd|_|Pv,_!==Rr&&_!==_i&&_!==Kn&&(this.#a|=xd)}#q=[];#V=!1;#H(e){this.#V=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(i=>i(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let i=this.children();if(this.calledReaddir()){let n=i.slice(0,i.provisional);t?e(null,n):queueMicrotask(()=>e(null,n));return}if(this.#q.push(e),this.#V)return;this.#V=!0;let s=this.fullpath();this.#e.readdir(s,{withFileTypes:!0},(n,a)=>{if(n)this.#R(n.code),i.provisional=0;else{for(let o of a)this.#D(o,i);this.#B(i)}this.#H(i.slice(0,i.provisional))})}#j;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#j)await this.#j;else{let i=()=>{};this.#j=new Promise(s=>i=s);try{for(let s of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#D(s,e);this.#B(e)}catch(s){this.#R(s.code),e.provisional=0}this.#j=void 0,i()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let i of this.#e.readdirSync(t,{withFileTypes:!0}))this.#D(i,e);this.#B(e)}catch(i){this.#R(i.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#a&Ov)return!1;let e=Ar&this.#a;return e===Rr||e===_i||e===Kn}shouldWalk(e,t){return(this.#a&_i)===_i&&!(this.#a&Ov)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#k)return this.#k;if(!((Ih|Mh|ti)&this.#a))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#k=this.resolve(e)}catch{this.#W()}}realpathSync(){if(this.#k)return this.#k;if(!((Ih|Mh|ti)&this.#a))try{let e=this.#e.realpathSync(this.fullpath());return this.#k=this.resolve(e)}catch{this.#W()}}[Vv](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),i=[],s=this;for(;s&&s.parent;)t.add(s),s.#f=i.join(this.sep),s.#M=i.join("/"),s=s.parent,i.push("..");for(s=e;s&&s.parent&&!t.has(s);)s.#f=void 0,s.#M=void 0,s=s.parent}},Oh=class r extends It{sep="\\";splitSep=QP;constructor(e,t=Rr,i,s,n,a,o){super(e,t,i,s,n,a,o)}newChild(e,t=Rr,i={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return Yo.win32.parse(e).root}getRoot(e){if(e=HP(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,i]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=i;return this.roots[e]=new Zo(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(qv,"$1\\"),e===t}},Dh=class r extends It{splitSep="/";sep="/";constructor(e,t=Rr,i,s,n,a,o){super(e,t,i,s,n,a,o)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=Rr,i={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),i)}},$h=class{root;rootPath;roots;cwd;#e;#t;#r;nocase;#i;constructor(e=process.cwd(),t,i,{nocase:s,childrenCacheSize:n=16*1024,fs:a=Sd}={}){this.#i=Lv(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,Fv.fileURLToPath)(e));let o=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#e=new Ph,this.#t=new Ph,this.#r=new t3(n);let l=o.substring(this.rootPath.length).split(i);if(l.length===1&&!l[0]&&l.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#i),this.roots[this.rootPath]=this.root;let c=this.root,d=l.length-1,p=t.sep,m=this.rootPath,h=!1;for(let f of l){let w=d--;c=c.child(f,{relative:new Array(w).fill("..").join(p),relativePosix:new Array(w).fill("..").join("/"),fullpath:m+=(h?"":p)+f}),h=!0}this.cwd=c}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let n=e.length-1;n>=0;n--){let a=e[n];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let i=this.#e.get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpath();return this.#e.set(t,s),s}resolvePosix(...e){let t="";for(let n=e.length-1;n>=0;n--){let a=e[n];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let i=this.#t.get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpathPosix();return this.#t.set(t,s),s}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd);let{withFileTypes:i}=t;if(e.canReaddir()){let s=await e.readdir();return i?s:s.map(n=>n.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd);let{withFileTypes:i=!0}=t;return e.canReaddir()?i?e.readdirSync():e.readdirSync().map(s=>s.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e.withFileTypes,e=this.cwd);let i=await e.readlink();return t?i:i?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e.withFileTypes,e=this.cwd);let i=e.readlinkSync();return t?i:i?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e.withFileTypes,e=this.cwd);let i=await e.realpath();return t?i:i?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e.withFileTypes,e=this.cwd);let i=e.realpathSync();return t?i:i?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=t,o=[];(!n||n(e))&&o.push(i?e:e.fullpath());let l=new Set,c=(p,m)=>{l.add(p),p.readdirCB((h,f)=>{if(h)return m(h);let w=f.length;if(!w)return m();let b=()=>{--w===0&&m()};for(let v of f)(!n||n(v))&&o.push(i?v:v.fullpath()),s&&v.isSymbolicLink()?v.realpath().then(S=>S?.isUnknown()?S.lstat():S).then(S=>S?.shouldWalk(l,a)?c(S,b):b()):v.shouldWalk(l,a)?c(v,b):b()},!0)},d=e;return new Promise((p,m)=>{c(d,h=>{if(h)return m(h);p(o)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=t,o=[];(!n||n(e))&&o.push(i?e:e.fullpath());let l=new Set([e]);for(let c of l){let d=c.readdirSync();for(let p of d){(!n||n(p))&&o.push(i?p:p.fullpath());let m=p;if(p.isSymbolicLink()){if(!(s&&(m=p.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(l,a)&&l.add(m)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=t;(!n||n(e))&&(yield i?e:e.fullpath());let o=new Set([e]);for(let l of o){let c=l.readdirSync();for(let d of c){(!n||n(d))&&(yield i?d:d.fullpath());let p=d;if(d.isSymbolicLink()){if(!(s&&(p=d.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(o,a)&&o.add(p)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=t,o=new Us({objectMode:!0});(!n||n(e))&&o.write(i?e:e.fullpath());let l=new Set,c=[e],d=0,p=()=>{let m=!1;for(;!m;){let h=c.shift();if(!h){d===0&&o.end();return}d++,l.add(h);let f=(b,v,S=!1)=>{if(b)return o.emit("error",b);if(s&&!S){let y=[];for(let _ of v)_.isSymbolicLink()&&y.push(_.realpath().then(E=>E?.isUnknown()?E.lstat():E));if(y.length){Promise.all(y).then(()=>f(null,v,!0));return}}for(let y of v)y&&(!n||n(y))&&(o.write(i?y:y.fullpath())||(m=!0));d--;for(let y of v){let _=y.realpathCached()||y;_.shouldWalk(l,a)&&c.push(_)}m&&!o.flowing?o.once("drain",p):w||p()},w=!0;h.readdirCB(f,!0),w=!1}};return p(),o}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof It||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=t,o=new Us({objectMode:!0}),l=new Set;(!n||n(e))&&o.write(i?e:e.fullpath());let c=[e],d=0,p=()=>{let m=!1;for(;!m;){let h=c.shift();if(!h){d===0&&o.end();return}d++,l.add(h);let f=h.readdirSync();for(let w of f)(!n||n(w))&&(o.write(i?w:w.fullpath())||(m=!0));d--;for(let w of f){let b=w;if(w.isSymbolicLink()){if(!(s&&(b=w.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(l,a)&&c.push(b)}}m&&!o.flowing&&o.once("drain",p)};return p(),o}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Vv](t)}},Zo=class extends $h{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:i=!0}=t;super(e,Yo.win32,"\\",{...t,nocase:i}),this.nocase=i;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(e){return Yo.win32.parse(e).root.toUpperCase()}newRoot(e){return new Oh(this.rootPath,_i,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},el=class extends $h{sep="/";constructor(e=process.cwd(),t={}){let{nocase:i=!1}=t;super(e,Yo.posix,"/",{...t,nocase:i}),this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new Dh(this.rootPath,_i,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},_d=class extends el{constructor(e=process.cwd(),t={}){let{nocase:i=!0}=t;super(e,{...t,nocase:i})}},Gre=process.platform==="win32"?Oh:Dh,Hv=process.platform==="win32"?Zo:process.platform==="darwin"?_d:el});var KP,JP,tl,r3=g(()=>{Bs();KP=r=>r.length>=1,JP=r=>r.length>=1,tl=class r{#e;#t;#r;length;#i;#s;#m;#u;#o;#c;#l=!0;constructor(e,t,i,s){if(!KP(e))throw new TypeError("empty pattern list");if(!JP(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#t=t,this.#r=i,this.#i=s,this.#r===0){if(this.isUNC()){let[n,a,o,l,...c]=this.#e,[d,p,m,h,...f]=this.#t;c[0]===""&&(c.shift(),f.shift());let w=[n,a,o,l,""].join("/"),b=[d,p,m,h,""].join("/");this.#e=[w,...c],this.#t=[b,...f],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[n,...a]=this.#e,[o,...l]=this.#t;a[0]===""&&(a.shift(),l.shift());let c=n+"/",d=o+"/";this.#e=[c,...a],this.#t=[d,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===St}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#m=this.#m||(this.#r===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new r(this.#e,this.#t,this.#r+1,this.#i),this.#s.#c=this.#c,this.#s.#o=this.#o,this.#s.#u=this.#u,this.#s):this.#s=null}isUNC(){let e=this.#e;return this.#o!==void 0?this.#o:this.#o=this.#i==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#i==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}}});var XP,rl,i3=g(()=>{Bs();r3();XP=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",rl=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:i,noext:s,noglobstar:n,platform:a=XP}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:i,noext:s,noglobstar:n,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let o of e)this.add(o)}add(e){let t=new cr(e,this.mmopts);for(let i=0;i<t.set.length;i++){let s=t.set[i],n=t.globParts[i];if(!s||!n)throw new Error("invalid pattern object");for(;s[0]==="."&&n[0]===".";)s.shift(),n.shift();let a=new tl(s,n,0,this.platform),o=new cr(a.globString(),this.mmopts),l=n[n.length-1]==="**",c=a.isAbsolute();c?this.absolute.push(o):this.relative.push(o),l&&(c?this.absoluteChildren.push(o):this.relativeChildren.push(o))}}ignored(e){let t=e.fullpath(),i=`${t}/`,s=e.relative()||".",n=`${s}/`;for(let a of this.relative)if(a.match(s)||a.match(n))return!0;for(let a of this.absolute)if(a.match(t)||a.match(i))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",i=(e.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(i))return!0;for(let s of this.absoluteChildren)if(s.match(t))return!0;return!1}}});var s3,n3,a3,Ed,Gv=g(()=>{Bs();s3=class r{store;constructor(e=new Map){this.store=e}copy(){return new r(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let i=e.fullpath(),s=this.store.get(i);s?s.add(t.globString()):this.store.set(i,new Set([t.globString()]))}},n3=class{store=new Map;add(e,t,i){let s=(t?2:0)|(i?1:0),n=this.store.get(e);this.store.set(e,n===void 0?s:s&n)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},a3=class{store=new Map;add(e,t){if(!e.canReaddir())return;let i=this.store.get(e);i?i.find(s=>s.globString()===t.globString())||i.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Ed=class r{hasWalkedCache;matches=new n3;subwalks=new a3;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new s3}processPatterns(e,t){this.patterns=t;let i=t.map(s=>[e,s]);for(let[s,n]of i){this.hasWalkedCache.storeWalked(s,n);let a=n.root(),o=n.isAbsolute()&&this.opts.absolute!==!1;if(a){s=s.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let p=n.rest();if(p)n=p;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let l,c,d=!1;for(;typeof(l=n.pattern())=="string"&&(c=n.rest());)s=s.resolve(l),n=c,d=!0;if(l=n.pattern(),c=n.rest(),d){if(this.hasWalkedCache.hasWalked(s,n))continue;this.hasWalkedCache.storeWalked(s,n)}if(typeof l=="string"){let p=l===".."||l===""||l===".";this.matches.add(s.resolve(l),o,p);continue}else if(l===St){(!s.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(s,n);let p=c?.pattern(),m=c?.rest();if(!c||(p===""||p===".")&&!m)this.matches.add(s,o,p===""||p===".");else if(p===".."){let h=s.parent||s;m?this.hasWalkedCache.hasWalked(h,m)||this.subwalks.add(h,m):this.matches.add(h,o,!0)}}else l instanceof RegExp&&this.subwalks.add(s,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new r(this.opts,this.hasWalkedCache)}filterEntries(e,t){let i=this.subwalks.get(e),s=this.child();for(let n of t)for(let a of i){let o=a.isAbsolute(),l=a.pattern(),c=a.rest();l===St?s.testGlobstar(n,a,c,o):l instanceof RegExp?s.testRegExp(n,l,c,o):s.testString(n,l,c,o)}return s}testGlobstar(e,t,i,s){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,s,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(i&&t.checkFollowGlobstar()?this.subwalks.add(e,i):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),i){let n=i.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(e,n,i.rest(),s);else if(n===".."){let a=e.parent||e;this.subwalks.add(a,i)}else n instanceof RegExp&&this.testRegExp(e,n,i.rest(),s)}}testRegExp(e,t,i,s){t.test(e.name)&&(i?this.subwalks.add(e,i):this.matches.add(e,s,!1))}testString(e,t,i,s){e.isNamed(t)&&(i?this.subwalks.add(e,i):this.matches.add(e,s,!1))}}});var YP,Fh,Nd,Cd,Kv=g(()=>{Yy();i3();Gv();YP=(r,e)=>typeof r=="string"?new rl([r],e):Array.isArray(r)?new rl(r,e):r,Fh=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#r;signal;maxDepth;includeChildMatches;constructor(e,t,i){if(this.patterns=e,this.path=t,this.opts=i,this.#r=!i.posix&&i.platform==="win32"?"\\":"/",this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(this.#t=YP(i.ignore??[],i),!this.includeChildMatches&&typeof this.#t.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#i(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#s(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||await e.realpath(),!i)return;e=i}let n=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let a=await n.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(n,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#i(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||e.realpathSync(),!i)return;e=i}let n=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let a=n.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(n,t)}matchFinish(e,t){if(this.#i(e))return;if(!this.includeChildMatches&&this.#t?.add){let n=`${e.relativePosix()}/**`;this.#t.add(n)}let i=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let s=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(i){let n=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(n+s)}else{let n=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!n.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(n?a+n+s:"."+s)}}async match(e,t,i){let s=await this.matchCheck(e,i);s&&this.matchFinish(s,t)}matchSync(e,t,i){let s=this.matchCheckSync(e,i);s&&this.matchFinish(s,t)}walkCB(e,t,i){this.signal?.aborted&&i(),this.walkCB2(e,t,new Ed(this.opts),i)}walkCB2(e,t,i,s){if(this.#s(e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(e,t,i,s));return}i.processPatterns(e,t);let n=1,a=()=>{--n===0&&s()};for(let[o,l,c]of i.matches.entries())this.#i(o)||(n++,this.match(o,l,c).then(()=>a()));for(let o of i.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;n++;let l=o.readdirCached();o.calledReaddir()?this.walkCB3(o,l,i,a):o.readdirCB((c,d)=>this.walkCB3(o,d,i,a),!0)}a()}walkCB3(e,t,i,s){i=i.filterEntries(e,t);let n=1,a=()=>{--n===0&&s()};for(let[o,l,c]of i.matches.entries())this.#i(o)||(n++,this.match(o,l,c).then(()=>a()));for(let[o,l]of i.subwalks.entries())n++,this.walkCB2(o,l,i.child(),a);a()}walkCBSync(e,t,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,t,new Ed(this.opts),i)}walkCB2Sync(e,t,i,s){if(this.#s(e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,i,s));return}i.processPatterns(e,t);let n=1,a=()=>{--n===0&&s()};for(let[o,l,c]of i.matches.entries())this.#i(o)||this.matchSync(o,l,c);for(let o of i.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;n++;let l=o.readdirSync();this.walkCB3Sync(o,l,i,a)}a()}walkCB3Sync(e,t,i,s){i=i.filterEntries(e,t);let n=1,a=()=>{--n===0&&s()};for(let[o,l,c]of i.matches.entries())this.#i(o)||this.matchSync(o,l,c);for(let[o,l]of i.subwalks.entries())n++,this.walkCB2Sync(o,l,i.child(),a);a()}},Nd=class extends Fh{matches=new Set;constructor(e,t,i){super(e,t,i)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Cd=class extends Fh{results;constructor(e,t,i){super(e,t,i),this.results=new Us({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}});var Jv,ZP,ri,o3=g(()=>{Bs();Jv=require("node:url");Qv();r3();Kv();ZP=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ri=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,Jv.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||ZP,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?Zo:t.platform==="darwin"?_d:t.platform?el:Hv;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",s={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(l=>new cr(l,s)),[a,o]=n.reduce((l,c)=>(l[0].push(...c.set),l[1].push(...c.globParts),l),[[],[]]);this.patterns=a.map((l,c)=>{let d=o[c];if(!d)throw new Error("invalid pattern object");return new tl(l,d,0,this.platform)})}async walk(){return[...await new Nd(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Nd(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Cd(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Cd(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}});var l3,c3=g(()=>{Bs();l3=(r,e={})=>{Array.isArray(r)||(r=[r]);for(let t of r)if(new cr(t,e).hasMagic())return!0;return!1}});function qh(r,e={}){return new ri(r,e).streamSync()}function Yv(r,e={}){return new ri(r,e).stream()}function Zv(r,e={}){return new ri(r,e).walkSync()}async function Xv(r,e={}){return new ri(r,e).walk()}function Bh(r,e={}){return new ri(r,e).iterateSync()}function eS(r,e={}){return new ri(r,e).iterate()}var eO,tO,rO,iO,sO,Lh,tS=g(()=>{Bs();o3();c3();Bs();o3();c3();i3();eO=qh,tO=Object.assign(Yv,{sync:qh}),rO=Bh,iO=Object.assign(eS,{sync:Bh}),sO=Object.assign(Zv,{stream:qh,iterate:Bh}),Lh=Object.assign(Xv,{glob:Xv,globSync:Zv,sync:sO,globStream:Yv,stream:tO,globStreamSync:qh,streamSync:eO,globIterate:eS,iterate:iO,globIterateSync:Bh,iterateSync:rO,Glob:ri,hasMagic:l3,escape:Qo,unescape:Zr});Lh.glob=Lh});var Wh,Uh,zh,rS=g(()=>{"use strict";Wh=require("node:fs"),Uh=k(require("node:path"),1);tS();pd();zh=class r{static instance=null;config;logger;migrationCache=new Map;constructor(e={},t){this.logger=t,this.config={migrationDirectory:"./migrations",fileExtensions:[".sql",".ts",".js"],encoding:"utf8",...e}}static getInstance(e,t){return r.instance||(t||(t=new xi({level:"info",enabled:!0})),r.instance=new r(e,t)),r.instance}async discoverMigrations(){this.logger.info(`\u{1F50D} Discovering migrations in ${this.config.migrationDirectory}...`);try{try{await Wh.promises.access(this.config.migrationDirectory)}catch{return this.logger.warn(`\u26A0\uFE0F Migration directory ${this.config.migrationDirectory} does not exist. Creating it...`),await Wh.promises.mkdir(this.config.migrationDirectory,{recursive:!0}),[]}let e=`${this.config.migrationDirectory}/**/*+(${this.config.fileExtensions.join("|")})`,t=await Lh(e),i=[];for(let s of t){let n=Uh.basename(s,Uh.extname(s)),a=n.match(/^(\d{14})_(.+)$/);if(!a){this.logger.warn(`\u26A0\uFE0F Skipping file ${n}: Invalid naming format (expected YYYYMMDDHHMMSS_name)`);continue}let o=a[1],l=parseInt(o.substring(0,4)),c=parseInt(o.substring(4,6))-1,d=parseInt(o.substring(6,8)),p=parseInt(o.substring(8,10)),m=parseInt(o.substring(10,12)),h=parseInt(o.substring(12,14)),f=new Date(Date.UTC(l,c,d,p,m,h)),w=await Wh.promises.readFile(s,this.config.encoding);i.push({name:n,content:w,checksum:this.calculateChecksum(w),timestamp:f})}return i.forEach(s=>{this.migrationCache.set(s.name,s)}),this.logger.info(`\u2705 Discovered ${i.length} migration files`),i.sort((s,n)=>s.timestamp.getTime()-n.timestamp.getTime())}catch(e){throw this.logger.error("\u274C Failed to discover migrations:",e),e}}async getMigration(e){return this.migrationCache.has(e)?this.migrationCache.get(e):(await this.discoverMigrations()).find(i=>i.name===e)||null}validateMigration(e){let t=[];return/^\d{14}_[a-zA-Z0-9_]+$/.test(e.name)||t.push("Migration name must follow format: YYYYMMDDHHMMSS_description"),(!e.content||e.content.trim().length===0)&&t.push("Migration content cannot be empty"),e.content.includes("AUTO_INCREMENT")&&t.push("Use AUTOINCREMENT instead of AUTO_INCREMENT for SQLite"),e.content.includes("SERIAL")&&t.push("Use INTEGER PRIMARY KEY instead of SERIAL for SQLite"),[/DROP\s+TABLE\s+(?!IF\s+EXISTS)/i,/DROP\s+INDEX\s+(?!IF\s+EXISTS)/i,/DELETE\s+FROM\s+\w+\s+(?!WHERE)/i].forEach(s=>{s.test(e.content)&&t.push("Dangerous operation detected - consider using IF EXISTS or WHERE clauses")}),{valid:t.length===0,errors:t}}generateOptimizedMigration(e,t,i={}){switch(e){case"create_table":return this.generateCreateTableMigration(t,i);case"add_column":return this.generateAddColumnMigration(t,i);case"add_index":return this.generateAddIndexMigration(t,i);case"modify_column":return this.generateModifyColumnMigration(t,i);default:throw new Error(`Unsupported operation: ${e}`)}}generateCreateTableMigration(e,t){let{columns:i,indexes:s=[],constraints:n=[]}=t,a=`-- Create table ${e} with SQLite optimizations
182
- `;a+=`CREATE TABLE IF NOT EXISTS ${e} (
183
- `;let o=i.map(l=>{let c=` ${l.name} ${this.mapToSQLiteType(l.type)}`;return l.primaryKey&&(c+=" PRIMARY KEY",l.autoIncrement&&(c+=" AUTOINCREMENT")),l.notNull&&!l.primaryKey&&(c+=" NOT NULL"),l.defaultValue!==void 0&&(c+=` DEFAULT ${this.formatDefaultValue(l.defaultValue)}`),l.unique&&(c+=" UNIQUE"),c}).join(`,
184
- `);return a+=o,n.length>0&&(a+=`,
185
- `+n.map(l=>` ${l}`).join(`,
186
- `)),a+=`
187
- );
188
-
189
- `,s.length>0&&(a+=`-- Create indexes for better performance
190
- `,s.forEach(l=>{a+=`CREATE INDEX IF NOT EXISTS idx_${e}_${l.columns.join("_")}
191
- `,a+=`ON ${e} (${l.columns.join(", ")});
192
-
193
- `})),a+=`-- SQLite optimizations
194
- `,a+=`-- Enable foreign key constraints for ${e}
195
- `,a+=`PRAGMA foreign_keys = ON;
196
-
197
- `,a}generateAddColumnMigration(e,t){let{column:i}=t,s=`-- Add column ${i.name} to ${e}
198
- `;return s+=`ALTER TABLE ${e} ADD COLUMN ${i.name} ${this.mapToSQLiteType(i.type)}`,i.notNull&&(s+=" NOT NULL"),i.defaultValue!==void 0&&(s+=` DEFAULT ${this.formatDefaultValue(i.defaultValue)}`),s+=`;
199
-
200
- `,i.index&&(s+=`-- Create index for new column
201
- `,s+=`CREATE INDEX IF NOT EXISTS idx_${e}_${i.name}
202
- `,s+=`ON ${e} (${i.name});
203
-
204
- `),s}generateAddIndexMigration(e,t){let{index:i}=t,s=`-- Add index to ${e}
205
- `;return s+=`CREATE INDEX IF NOT EXISTS idx_${e}_${i.columns.join("_")}
206
- `,s+=`ON ${e} (${i.columns.join(", ")});
207
-
208
- `,s}generateModifyColumnMigration(e,t){let{column:i,newType:s}=t,n=`-- Modify column ${i.name} in ${e}
209
- `;return n+=`-- Note: SQLite doesn't support ALTER COLUMN, recreating table
210
-
211
- `,n+=`-- Create new table with modified column
212
- `,n+=`CREATE TABLE ${e}_new AS SELECT * FROM ${e};
213
-
214
- `,n+=`-- Drop original table
215
- `,n+=`DROP TABLE ${e};
216
-
217
- `,n+=`-- Rename new table
218
- `,n+=`ALTER TABLE ${e}_new RENAME TO ${e};
219
-
220
- `,n}mapToSQLiteType(e){return{varchar:"TEXT",char:"TEXT",text:"TEXT",string:"TEXT",int:"INTEGER",integer:"INTEGER",bigint:"INTEGER",smallint:"INTEGER",tinyint:"INTEGER",float:"REAL",double:"REAL",decimal:"REAL",numeric:"REAL",boolean:"INTEGER",bool:"INTEGER",date:"TEXT",datetime:"TEXT",timestamp:"TEXT",time:"TEXT",json:"TEXT",jsonb:"TEXT",uuid:"TEXT",blob:"BLOB"}[e.toLowerCase()]||"TEXT"}formatDefaultValue(e){return typeof e=="string"?`'${e.replace(/'/g,"''")}'`:typeof e=="number"?e.toString():typeof e=="boolean"?e?"1":"0":e===null?"NULL":`'${String(e)}'`}calculateChecksum(e){let t=0;for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);t=(t<<5)-t+s,t=t&t}return t.toString(16)}}});var d3,iS,sS,jh,nS=g(()=>{"use strict";at();pd();Dy();$y();rS();d3=require("node:fs"),iS=k(require("node:path"),1),sS=require("node:crypto"),jh=class r{static instance=null;db;config;logger;optimizer;indexer;provider;isInitialized=!1;constructor(e,t={},i){this.db=e,this.logger=i,this.config={enableAutoOptimization:!0,enableIndexRecommendations:!0,enableConstraintValidation:!0,enablePerformanceMonitoring:!0,migrationDirectory:"./migrations",backupBeforeMigration:!0,dryRun:!1,...t},this.optimizer=jo.getInstance(i),this.indexer=Vo.getInstance(i),this.provider=zh.getInstance({migrationDirectory:this.config.migrationDirectory},i)}static getInstance(e,t,i){return r.instance||(i||(i=new xi({level:"info",enabled:!0})),r.instance=new r(e,t,i)),r.instance}async initialize(){if(!this.isInitialized){this.logger.info("\u{1F680} Initializing SQLite Migration Manager...");try{await this.createMigrationsTable(),this.config.enableAutoOptimization&&await this.applyInitialOptimizations(),this.isInitialized=!0,this.logger.info("\u2705 SQLite Migration Manager initialized successfully")}catch(e){throw this.logger.error("\u274C Failed to initialize SQLite Migration Manager:",e),e}}}async createMigrationsTable(){await C`
221
- CREATE TABLE IF NOT EXISTS sqlite_migrations (
222
- id INTEGER PRIMARY KEY AUTOINCREMENT,
223
- name TEXT NOT NULL UNIQUE,
224
- applied_at DATETIME DEFAULT CURRENT_TIMESTAMP,
225
- checksum TEXT,
226
- optimization_applied BOOLEAN DEFAULT FALSE,
227
- index_recommendations TEXT,
228
- performance_impact TEXT
229
- )
230
- `.execute(this.db),await C`
231
- CREATE INDEX IF NOT EXISTS idx_sqlite_migrations_name
232
- ON sqlite_migrations(name)
233
- `.execute(this.db)}async applyInitialOptimizations(){this.logger.info("\u{1F527} Applying initial SQLite optimizations...");try{let e=await this.optimizer.optimizeDatabase(this.db,{enableAutoPragma:!0,enableAutoIndexing:!1,enablePerformanceTuning:!0,enableBackupRecommendations:!1,slowQueryThreshold:1e3,autoVacuumMode:"INCREMENTAL",journalMode:"WAL",synchronous:"NORMAL",cacheSize:-64e3,tempStore:"MEMORY"});this.logger.info(`\u2705 Applied ${e.appliedOptimizations.length} optimizations`),e.warnings.length>0&&this.logger.warn(`\u26A0\uFE0F ${e.warnings.length} warnings:`,e.warnings)}catch(e){throw this.logger.error("\u274C Failed to apply initial optimizations:",e),e}}async planMigrations(){this.logger.info("\u{1F4CB} Planning SQLite migrations...");try{let e=await this.getPendingMigrations(),t=await this.optimizer.optimizeDatabase(this.db),i=await this.indexer.analyzeAndRecommend(this.db,{minFrequency:3,slowQueryThreshold:1e3,maxRecommendations:10}),s={migrations:e,optimizations:t.recommendations||[],indexRecommendations:i.recommendations.map(n=>n.sql),estimatedImpact:this.calculateImpact(e.length,t.recommendations?.length||0),dryRun:this.config.dryRun};return this.logger.info(`\u{1F4CA} Migration plan: ${s.migrations.length} migrations, ${s.optimizations.length} optimizations, ${s.indexRecommendations.length} index recommendations`),s}catch(e){throw this.logger.error("\u274C Failed to plan migrations:",e),e}}async executeMigrations(){let e=Date.now();this.logger.info("\u{1F504} Executing SQLite migrations...");try{let t=await this.planMigrations();if(t.migrations.length===0)return this.logger.info("\u2705 No pending migrations"),{success:!0,migrationsApplied:0,optimizationsApplied:[],indexRecommendations:[],performanceImpact:"low",duration:Date.now()-e,warnings:[]};let i={success:!1,migrationsApplied:0,optimizationsApplied:[],indexRecommendations:[],performanceImpact:"low",duration:0,warnings:[]};return await this.db.transaction().execute(async s=>{for(let n of t.migrations)await this.executeMigration(s,n),i.migrationsApplied++;if(this.config.enableAutoOptimization&&t.optimizations.length>0){let n=await this.optimizer.optimizeDatabase(s,{enableAutoPragma:!0,enableAutoIndexing:!1,enablePerformanceTuning:!0,enableBackupRecommendations:!1,slowQueryThreshold:1e3,autoVacuumMode:"INCREMENTAL",journalMode:"WAL",synchronous:"NORMAL",cacheSize:-64e3,tempStore:"MEMORY"});i.optimizationsApplied=n.appliedOptimizations,i.warnings.push(...n.warnings)}this.config.enableIndexRecommendations&&(i.indexRecommendations=t.indexRecommendations)}),i.success=!0,i.performanceImpact=t.estimatedImpact,i.duration=Date.now()-e,this.logger.info(`\u2705 Migration completed: ${i.migrationsApplied} migrations applied in ${i.duration}ms`),i}catch(t){let i=Date.now()-e;return this.logger.error("\u274C Migration failed:",t),{success:!1,migrationsApplied:0,optimizationsApplied:[],indexRecommendations:[],performanceImpact:"low",duration:i,warnings:[t instanceof Error?t.message:"Unknown error"]}}}async executeMigration(e,t){this.logger.info(`\u{1F4DD} Executing migration: ${t}`);let i=await this.provider.getMigration(t);if(!i)throw new Error(`Migration ${t} not found`);try{await C.raw(i.content).execute(e),await e.insertInto("sqlite_migrations").values({name:t,applied_at:new Date,checksum:i.checksum,optimization_applied:!0,performance_impact:"medium"}).execute(),this.logger.info(`\u2705 Migration ${t} applied successfully`)}catch(s){throw this.logger.error(`\u274C Failed to execute migration ${t}:`,s),s}}async getPendingMigrations(){let e=await this.provider.discoverMigrations(),t=await this.db.selectFrom("sqlite_migrations").select("name").execute(),i=new Set(t.map(s=>s.name));return e.filter(s=>!i.has(s.name)).map(s=>s.name)}async generateMigration(e,t="create_table",i={}){let n=`${new Date().toISOString().replace(/[-:T]/g,"").slice(0,14)}_${e.toLowerCase().replace(/\s+/g,"_")}.sql`,a=iS.join(this.config.migrationDirectory,n),o=this.provider.generateOptimizedMigration(t,i.tableName||"new_table",i);return await d3.promises.mkdir(this.config.migrationDirectory,{recursive:!0}),await d3.promises.writeFile(a,o),{fileName:n,filePath:a,content:o}}async rollbackLastMigration(){let e=await this.db.selectFrom("sqlite_migrations").selectAll().orderBy("applied_at","desc").executeTakeFirst();return e?(await this.db.deleteFrom("sqlite_migrations").where("id","=",e.id).execute(),{success:!0,migrationName:e.name}):{success:!1}}calculateImpact(e,t){let i=e+t;return i===0?"low":i<=3?"medium":"high"}calculateChecksum(e){return(0,sS.createHash)("sha256").update(e).digest("hex")}async getStatus(){let e=await this.db.selectFrom("sqlite_migrations").selectAll().orderBy("applied_at","desc").execute(),t=await this.getPendingMigrations();return{totalMigrations:e.length+t.length,appliedMigrations:e.length,pendingMigrations:t.length,lastMigration:e[0]?.name,lastAppliedAt:e[0]?.applied_at,appliedList:e}}recordQuery(e,t,i){this.config.enablePerformanceMonitoring&&this.indexer.recordQuery(e,t,i)}async getPerformanceMetrics(){return await this.optimizer.analyzeDatabase(this.db)}async getIndexRecommendations(){return await this.indexer.analyzeAndRecommend(this.db)}async getOptimizationRecommendations(){return await this.optimizer.optimizeDatabase(this.db)}}});var aS=g(()=>{"use strict"});var oS=g(()=>{"use strict"});var lS=g(()=>{"use strict"});var cS=g(()=>{"use strict"});var dS=g(()=>{"use strict"});var pS=g(()=>{"use strict"});var uS=g(()=>{"use strict"});var mS=g(()=>{"use strict";oS();lS();cS();dS();pS();uS()});var hS=g(()=>{"use strict"});var fS=g(()=>{"use strict"});var gS=g(()=>{"use strict"});var yS=g(()=>{"use strict"});var wS=g(()=>{"use strict"});var bS=g(()=>{"use strict"});var vS=g(()=>{"use strict"});var SS=g(()=>{"use strict"});var xS=g(()=>{"use strict"});var TS=g(()=>{"use strict"});var _S=g(()=>{"use strict"});var ES=g(()=>{"use strict"});var NS=g(()=>{"use strict"});var Vh,CS=g(()=>{"use strict";Vh=class{static typeMapping={text:"string",varchar:"string",char:"string",integer:"number",real:"number",numeric:"number",boolean:"boolean",date:"Date",datetime:"Date",blob:"Buffer",bigint:"number",smallint:"number",decimal:"number","double precision":"number",timestamp:"Date",timestamptz:"Date",time:"Date",timetz:"Date",json:"Record<string, unknown>",jsonb:"Record<string, unknown>",uuid:"string",tsvector:"string",tsquery:"string",bytea:"Buffer"};static mapColumnInfo(e,t){return{name:e.name,type:this.mapColumnType(e.type,t),nullable:e.nullable,defaultValue:e.defaultValue,isPrimaryKey:e.isPrimaryKey??!1,isAutoIncrement:e.isAutoIncrement??!1,maxLength:e.maxLength,precision:e.precision,scale:e.scale}}static mapColumnType(e,t){if(t?.[e])return t[e];if(e.endsWith("[]")){let s=e.slice(0,-2);return`Array<${this.mapColumnType(s,t)}>`}if(this.typeMapping[e.toLowerCase()])return this.typeMapping[e.toLowerCase()];let i=e.toLowerCase().split("(")[0];return this.typeMapping[i]?this.typeMapping[i]:"unknown"}}});var Vs,Hh=g(()=>{"use strict";CS();Vs=class r{static instance;static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverTables(e,t={}){let s=(await e.getTables()).map(async a=>await this.processTable(a,e,t));return(await Promise.all(s)).filter(a=>a!==null)}async processTable(e,t,i){if(i.excludeTables?.includes(e.name))return null;try{let[s,n,a]=await Promise.all([t.getColumns(e.name).catch(()=>[]),t.getIndexes(e.name).catch(()=>[]),t.getForeignKeys(e.name).catch(()=>[])]),o=s.filter(l=>l.isPrimaryKey).map(l=>l.name);return{name:e.name,schema:e.schema,columns:s.map(l=>Vh.mapColumnInfo(l,i.customTypeMappings)),primaryKey:o.length>0?o:void 0,indexes:n.map(l=>({name:l.name,columns:l.columns,unique:l.unique})),foreignKeys:a.map(l=>({name:l.name,column:l.column,referencedTable:l.referencedTable,referencedColumn:l.referencedColumn,onDelete:l.onDelete,onUpdate:l.onUpdate}))}}catch(s){return console.warn(`Failed to get metadata for table ${e.name}:`,s),null}}async getTableStatistics(e,t){try{let i=await e.getRowCount(t),s=await e.getColumns(t),n=await e.getIndexes(t),a=await e.getForeignKeys(t);return{rowCount:i,columnCount:s.length,indexCount:n.length,foreignKeyCount:a.length,lastModified:new Date,indexes:n.map(o=>o.name),constraints:a.map(o=>o.name)}}catch(i){return console.warn(`Failed to get statistics for table ${t}:`,i),null}}validateTableStructure(e){let t=[];e.name||t.push("Table name is required"),(!e.columns||e.columns.length===0)&&t.push("Table must have at least one column");let i=e.columns.map(n=>n.name),s=i.filter((n,a)=>i.indexOf(n)!==a);if(s.length>0&&t.push(`Duplicate column names found: ${s.join(", ")}`),e.primaryKey&&e.primaryKey.length>0){let a=e.primaryKey.filter(o=>!e.columns.some(l=>l.name===o));a.length>0&&t.push(`Primary key references non-existent columns: ${a.join(", ")}`)}return{isValid:t.length===0,issues:t}}}});var Jn,AS=g(()=>{"use strict";Jn=class{static generateRelationshipName(e,t){if(!e)return console.warn("generateRelationshipName called with undefined columnName"),"unknown";let i=e;return i.endsWith("_id")&&(i=i.slice(0,-3)),i.endsWith("Id")&&(i=i.slice(0,-2)),this.toCamelCase(i)}static generateReverseRelationshipName(e,t){return this.pluralize(this.toCamelCase(e))}static toCamelCase(e){return e?e.replace(/(?:^\w|[A-Z]|\b\w)/g,(t,i)=>i===0?t.toLowerCase():t.toUpperCase()).replace(/\s+/g,"").replace(/[_-]/g,""):""}static pluralize(e){return e?e.endsWith("ses")||e.endsWith("xes")||e.endsWith("zes")||e.endsWith("ches")||e.endsWith("shes")||e.endsWith("ies")||e.endsWith("ves")?e:e.endsWith("ss")?e+"es":e.endsWith("s")?e:e.endsWith("y")&&e.length>1&&!"aeiou".includes(e[e.length-2])?e.slice(0,-1)+"ies":e.endsWith("sh")||e.endsWith("ch")||e.endsWith("x")||e.endsWith("z")?e+"es":e+"s":""}}});var Hs,Qh=g(()=>{"use strict";AS();Hs=class r{static instance;static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverRelationships(e){let t=[];for(let i of e)for(let s of i.foreignKeys){let n=e.find(d=>d.name===s.referencedTable);if(!n)continue;let a=Jn.generateRelationshipName(s.column,s.referencedTable),l=n.primaryKey?.includes(s.referencedColumn)||!1?"many-to-one":"one-to-many";t.push({name:a,type:l,fromTable:i.name,fromColumn:s.column,toTable:s.referencedTable,toColumn:s.referencedColumn});let c=Jn.generateReverseRelationshipName(i.name,s.column);t.push({name:c,type:l==="many-to-one"?"one-to-many":"many-to-one",fromTable:s.referencedTable,fromColumn:s.referencedColumn,toTable:i.name,toColumn:s.column})}for(let i of e)if(this.isJunctionTable(i)){let s=i.foreignKeys[0],n=i.foreignKeys[1];s.referencedTable!==n.referencedTable&&(t.push({name:Jn.generateRelationshipName(i.name,n.referencedTable),type:"many-to-many",fromTable:s.referencedTable,fromColumn:s.referencedColumn,toTable:n.referencedTable,toColumn:n.referencedColumn,throughTable:i.name,throughFromColumn:s.column,throughToColumn:n.column}),t.push({name:Jn.generateRelationshipName(i.name,s.referencedTable),type:"many-to-many",fromTable:n.referencedTable,fromColumn:n.referencedColumn,toTable:s.referencedTable,toColumn:s.referencedColumn,throughTable:i.name,throughFromColumn:n.column,throughToColumn:s.column}))}return t}analyzeRelationshipPatterns(e){let t={oneToMany:0,manyToMany:0,selfReferencing:0,circularReferences:[]};for(let i of e)for(let s of i.foreignKeys)s.referencedTable===i.name&&t.selfReferencing++,e.find(a=>a.name===s.referencedTable)&&this.isJunctionTable(i)?t.manyToMany++:t.oneToMany++;return t.circularReferences=this.detectCircularReferences(e),t}isJunctionTable(e){if(e.foreignKeys.length!==2)return!1;let t=new Set(e.foreignKeys.map(n=>n.column)),i=new Set(e.primaryKey||[]);return e.columns.filter(n=>!t.has(n.name)&&!i.has(n.name)).length<=2}detectCircularReferences(e){let t=[],i=new Set,s=new Set,n=(a,o)=>{if(s.has(a)){let c=o.indexOf(a),d=o.slice(c).join(" -> ")+` -> ${a}`;t.push(d);return}if(i.has(a))return;i.add(a),s.add(a);let l=e.find(c=>c.name===a);if(l)for(let c of l.foreignKeys)n(c.referencedTable,[...o,a]);s.delete(a)};for(let a of e)i.has(a.name)||n(a.name,[]);return t}validateRelationships(e){let t=[],i=new Set(e.map(s=>s.name));for(let s of e)for(let n of s.foreignKeys){i.has(n.referencedTable)||t.push(`Foreign key '${n.name}' in table '${s.name}' references non-existent table '${n.referencedTable}'`);let a=e.find(l=>l.name===n.referencedTable);a&&(a.columns.some(c=>c.name===n.referencedColumn)||t.push(`Foreign key '${n.name}' in table '${s.name}' references non-existent column '${n.referencedColumn}' in table '${n.referencedTable}'`)),s.columns.some(l=>l.name===n.column)||t.push(`Foreign key '${n.name}' in table '${s.name}' references non-existent column '${n.column}'`)}return{isValid:t.length===0,issues:t}}}});var Qs,Gh=g(()=>{"use strict";Qs=class r{static instance;static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverViews(e){try{let t=await e.getTables(),i=[];for(let s of t)this.isView(s)&&i.push({name:s.name,schema:s.schema,definition:await this.getViewDefinition(e,s.name)??void 0,columns:[]});return i}catch(t){return console.warn("Failed to discover views:",t),[]}}async getViewDefinition(e,t){try{return await e.getViewDefinition(t)}catch(i){return console.warn(`Failed to get definition for view ${t}:`,i),null}}isView(e){return e.isView===!0||e.table_type==="v"||e.table_type==="VIEW"||e.type==="view"}validateView(e){let t=[];e.name||t.push("View name is required"),(!e.definition||e.definition.trim()==="")&&t.push("View definition is required");let i=[/DROP\s+TABLE/i,/DELETE\s+FROM/i,/UPDATE\s+SET/i,/INSERT\s+INTO/i,/TRUNCATE/i,/ALTER\s+TABLE/i];if(e.definition)for(let s of i)s.test(e.definition)&&t.push(`View definition contains potentially dangerous SQL: ${s.source}`);return{isValid:t.length===0,issues:t}}analyzeViewDependencies(e){let t=new Map;for(let i of e)if(i.definition){let s=this.extractTableReferences(i.definition);t.set(i.name,s)}return t}extractTableReferences(e){let t=/(?:FROM|JOIN)\s+((?:(?:"[^"]+")|(?:[a-zA-Z_][a-zA-Z0-9_]*))(?:\.(?:(?:"[^"]+")|(?:[a-zA-Z_][a-zA-Z0-9_]*)))?)/gi,i=[],s;for(;(s=t.exec(e))!==null;){let a=s[1].split("."),l=a[a.length-1].replace(/^"|"$/g,"");i.push(l)}return[...new Set(i)]}}});var il,p3=g(()=>{"use strict";at();il=class r{static instance;static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverTableIndexes(e,t){try{return(await e.selectFrom("sqlite_master").select(["name","sql as definition",C`type = 'index'`.as("isIndex"),C`sql LIKE '%UNIQUE%'`.as("unique")]).where("type","=","index").where("tbl_name","=",t).execute()).map(n=>({...n,columns:this.extractColumnsFromSQL(n.definition),isPrimary:n.name.includes("sqlite_autoindex"),comment:null}))}catch(i){return console.warn(`Failed to discover indexes for SQLite table ${t}:`,i),[]}}extractColumnsFromSQL(e){if(!e)return[];let t=e.match(/\(([^)]+)\)/);return t?t[1].split(",").map(i=>i.trim().replace(/^\s*["']?|["']?\s*$/g,"")).filter(i=>i.length>0):[]}async getIndexInfo(e,t){try{return(await C`PRAGMA index_list(${C.lit(t)})`.execute(e)).rows||[]}catch(i){return console.warn(`Failed to get index info for SQLite table ${t}:`,i),[]}}analyzeIndexEfficiency(e){let t=[],i=[],s=[];e.filter(l=>l.isPrimary).length>1&&t.push("Multiple auto-generated indexes found - review table structure");let a=e.filter(l=>!l.columns||l.columns.length===0);for(let l of a)t.push(`Invalid index found: ${l.name} (no columns)`);let o=new Map;for(let l of e){let c=l.columns.sort().join(",");o.has(c)||o.set(c,[]),o.get(c).push(l.name)}for(let[l,c]of o)c.length>1&&(s.push(...c),t.push(`Redundant indexes on columns (${l}): ${c.join(", ")}`));return{recommendations:t,missingIndexes:i,redundantIndexes:s}}async getTableSize(e,t){try{return{rowCount:(await C`SELECT COUNT(*) as rowCount FROM ${C.id(t)}`.execute(e)).rows?.[0]?.rowCount||0,size:0,lastModified:new Date}}catch(i){return console.warn(`Failed to get table size for SQLite table ${t}:`,i),null}}}});var sl,u3=g(()=>{"use strict";at();sl=class r{static instance;static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverTableConstraints(e,t){try{let i=await e.selectFrom("sqlite_master").select("sql").where("type","=","table").where("name","=",t).executeTakeFirst();return i?.sql?this.parseConstraintsFromSQL(i.sql,t):[]}catch(i){return console.warn(`Failed to discover constraints for SQLite table ${t}:`,i),[]}}parseConstraintsFromSQL(e,t){let i=[],s=e.match(/CREATE TABLE[^(]*\(([^)]+)\)/i);if(!s)return i;let n=s[1].split(",").map(a=>a.trim());for(let a of n){if(a.toUpperCase().includes("PRIMARY KEY")){let o=a.match(/(\w+)\s+PRIMARY KEY/i);o&&i.push({name:`${t}_pk`,type:"p",columns:[o[1]],definition:a})}if(a.toUpperCase().includes("FOREIGN KEY")){let o=a.match(/FOREIGN KEY\s*\((\w+)\)\s*REFERENCES\s+(\w+)\s*\((\w+)\)/i);o&&i.push({name:`${t}_fk_${o[1]}`,type:"f",column:o[1],referencedTable:o[2],referencedColumn:o[3],definition:a})}if(a.toUpperCase().includes("CHECK")){let o=a.match(/CHECK\s*\(([^)]+)\)/i);o&&i.push({name:`${t}_check_${i.length+1}`,type:"c",definition:o[1],fullDefinition:a})}if(a.toUpperCase().includes("UNIQUE")){let o=a.match(/UNIQUE\s*\(([^)]+)\)/i);o&&i.push({name:`${t}_unique_${i.length+1}`,type:"u",columns:o[1].split(",").map(l=>l.trim()),definition:a})}if(a.toUpperCase().includes("NOT NULL")){let o=a.match(/(\w+)\s+[^,]+\s+NOT NULL/i);o&&i.push({name:`${t}_nn_${o[1]}`,type:"n",column:o[1],definition:a})}}return i}async getForeignKeyInfo(e,t){try{return((await C`PRAGMA foreign_key_list(${C.lit(t)})`.execute(e)).rows||[]).map(s=>({name:`${t}_fk_${s.column}`,type:"f",column:s.column||s.from,referencedTable:s.table,referencedColumn:s.to||"id",onDelete:s.on_delete||"NO ACTION",onUpdate:s.on_update||"NO ACTION"}))}catch(i){return console.warn(`Failed to get foreign key info for SQLite table ${t}:`,i),[]}}async isForeignKeySupportEnabled(e){try{return(await C`PRAGMA foreign_keys`.execute(e)).rows?.[0]?.foreign_keys===1}catch(t){return console.warn("Failed to check foreign key support:",t),!1}}validateConstraints(e){let t=[];for(let i of e)i.name||t.push("Constraint name is required"),i.type||t.push(`Constraint type is required for ${i.name}`),i.type==="f"&&(i.column||t.push(`Foreign key constraint ${i.name} missing column`),i.referencedTable||t.push(`Foreign key constraint ${i.name} missing referenced table`),i.referencedColumn||t.push(`Foreign key constraint ${i.name} missing referenced column`)),i.type==="c"&&!i.definition&&t.push(`Check constraint ${i.name} missing definition`);return{isValid:t.length===0,issues:t}}analyzeConstraintCompatibility(e){let t=[],i=[];for(let s of e)if(s.type==="c"&&s.definition){let n=s.definition.toLowerCase();(n.includes("datetime(")||n.includes("date("))&&i.push(`Check constraint ${s.name} uses SQLite-specific date functions`),(n.includes("substr(")||n.includes("length("))&&i.push(`Check constraint ${s.name} uses SQLite-specific string functions`)}return i.length>0&&t.push("Consider using standard SQL functions for better database portability"),{recommendations:t,compatibilityIssues:i}}async validateForeignKeyConstraints(e){let t=[],i=[],s=[];try{await this.isForeignKeySupportEnabled(e)||(t.push("Foreign key constraints are disabled"),i.push("Enable foreign key constraints with PRAGMA foreign_keys = ON"));let a=await this.getTablesWithForeignKeys(e);for(let l of a){let c=await this.getForeignKeyInfo(e,l);for(let d of c){let p=await this.checkOrphanedRecords(e,l,d);p>0&&(s.push({table:l,count:p}),t.push(`Table ${l} has ${p} orphaned records for foreign key ${d.column}`),i.push(`Clean up orphaned records in ${l}.${d.column} or add proper foreign key constraints`)),await this.checkForeignKeyIndex(e,l,d.column)||i.push(`Add index on ${l}.${d.column} for better join performance`),await this.checkTableExists(e,d.referencedTable)?await this.checkColumnExists(e,d.referencedTable,d.referencedColumn)||(t.push(`Foreign key ${d.column} references non-existent column ${d.referencedTable}.${d.referencedColumn}`),i.push(`Add column ${d.referencedColumn} to table ${d.referencedTable} or fix foreign key reference`)):(t.push(`Foreign key ${d.column} references non-existent table ${d.referencedTable}`),i.push(`Create table ${d.referencedTable} or remove invalid foreign key`))}}let o=this.assessPerformanceImpact(t,s);return{isValid:t.length===0,issues:t,recommendations:i,orphanedRecords:s,performanceImpact:o}}catch(n){return t.push(`Foreign key validation failed: ${n}`),{isValid:!1,issues:t,recommendations:["Check database connection and permissions"],orphanedRecords:[],performanceImpact:"high"}}}async getTablesWithForeignKeys(e){try{let t=await e.selectFrom("sqlite_master").select("name").where("type","=","table").where("name","not like","sqlite_%").execute(),i=[];for(let s of t)(await this.getForeignKeyInfo(e,s.name)).length>0&&i.push(s.name);return i}catch{return[]}}async checkOrphanedRecords(e,t,i){try{let s=await C`
234
- SELECT COUNT(*) as count
235
- FROM ${C.id(t)} t
236
- LEFT JOIN ${C.id(i.referencedTable)} r
237
- ON t.${C.id(i.column)} = r.${C.id(i.referencedColumn)}
238
- WHERE r.${C.id(i.referencedColumn)} IS NULL
239
- `.execute(e);return Number(s.rows[0]?.count||0)}catch{return 0}}async checkForeignKeyIndex(e,t,i){try{let s=await e.selectFrom("sqlite_master").select("sql").where("type","=","index").where("tbl_name","=",t).execute();for(let n of s)if(n.sql&&n.sql.includes(i))return!0;return!1}catch{return!1}}async checkTableExists(e,t){try{return!!await e.selectFrom("sqlite_master").select("name").where("type","=","table").where("name","=",t).executeTakeFirst()}catch{return!1}}async checkColumnExists(e,t,i){try{let s=await e.selectFrom("sqlite_master").select("sql").where("type","=","table").where("name","=",t).executeTakeFirst();if(!s?.sql)return!1;let n=s.sql.match(/CREATE TABLE[^(]*\(([^)]+)\)/i);return n?n[1].split(",").map(o=>o.trim()).map(o=>o.split(/\s+/)[0].replace(/["`]/g,"")).includes(i):!1}catch{return!1}}assessPerformanceImpact(e,t){let i=t.reduce((s,n)=>s+n.count,0);return e.length>5||i>1e3?"high":e.length>2||i>100?"medium":"low"}async generateForeignKeyOptimizations(e){let t=[],i=[],s=[],n=[];try{await this.isForeignKeySupportEnabled(e)||i.push("PRAGMA foreign_keys = ON");let o=await this.getTablesWithForeignKeys(e);for(let l of o){let c=await this.getForeignKeyInfo(e,l);for(let d of c){await this.checkForeignKeyIndex(e,l,d.column)||t.push(`CREATE INDEX idx_${l}_${d.column} ON ${l} (${d.column})`);let m=await this.checkOrphanedRecords(e,l,d);m>0&&s.push(`DELETE FROM ${l} WHERE ${d.column} NOT IN (SELECT ${d.referencedColumn} FROM ${d.referencedTable})`),m>100&&n.push(`Consider adding CASCADE DELETE to foreign key ${d.column} for automatic cleanup`)}}return o.length>10&&n.push("Consider using deferred foreign key constraints for bulk operations"),{indexRecommendations:t,constraintRecommendations:i,cleanupRecommendations:s,performanceRecommendations:n}}catch(a){return{indexRecommendations:[],constraintRecommendations:[],cleanupRecommendations:[],performanceRecommendations:[`Error generating recommendations: ${a}`]}}}async autoFixForeignKeyIssues(e,t={}){let{createMissingIndexes:i=!0,enableForeignKeys:s=!0,cleanupOrphanedRecords:n=!1,dryRun:a=!0}=t,o=[],l=[],c=[];try{if(s&&(await this.isForeignKeySupportEnabled(e)?c.push("Foreign key constraints already enabled"):(a||await C`PRAGMA foreign_keys = ON`.execute(e),o.push("Enabled foreign key constraints"))),i){let d=await this.getTablesWithForeignKeys(e);for(let p of d){let m=await this.getForeignKeyInfo(e,p);for(let h of m)if(!await this.checkForeignKeyIndex(e,p,h.column)){let w=`CREATE INDEX idx_${p}_${h.column} ON ${p} (${h.column})`;if(a)o.push(`Would create index on ${p}.${h.column}`);else try{await C.raw(w).execute(e),o.push(`Created index on ${p}.${h.column}`)}catch(b){l.push(`Failed to create index on ${p}.${h.column}: ${b}`)}}}}if(n){let d=await this.getTablesWithForeignKeys(e);for(let p of d){let m=await this.getForeignKeyInfo(e,p);for(let h of m){let f=await this.checkOrphanedRecords(e,p,h);if(f>0){let w=`DELETE FROM ${p} WHERE ${h.column} NOT IN (SELECT ${h.referencedColumn} FROM ${h.referencedTable})`;if(a)o.push(`Would cleanup ${f} orphaned records in ${p}.${h.column}`);else try{await C.raw(w).execute(e),o.push(`Cleaned up ${f} orphaned records in ${p}.${h.column}`)}catch(b){l.push(`Failed to cleanup orphaned records in ${p}.${h.column}: ${b}`)}}}}}return{applied:o,failed:l,skipped:c}}catch(d){return l.push(`Auto-fix failed: ${d}`),{applied:o,failed:l,skipped:c}}}}});var Kh,RS=g(()=>{"use strict";Xm();Hh();Qh();Gh();p3();u3();Kh=class r{static instance;tableDiscovery;relationshipDiscovery;viewDiscovery;indexDiscovery;constraintDiscovery;constructor(){this.tableDiscovery=Vs.getInstance(),this.relationshipDiscovery=Hs.getInstance(),this.viewDiscovery=Qs.getInstance(),this.indexDiscovery=il.getInstance(),this.constraintDiscovery=sl.getInstance()}static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverSchema(e,t={}){let i=new ko(e),s={excludeTables:t.excludeTables,includeViews:t.includeViews,customTypeMappings:t.customTypeMappings},n=!1;try{n=await this.constraintDiscovery.isForeignKeySupportEnabled(e)}catch(p){console.warn("Failed to check foreign key support:",p),n=!1}let a=[];try{a=await this.tableDiscovery.discoverTables(i,s)}catch(p){console.warn("Table discovery failed:",p),a=[]}let o=await this.enhanceTablesWithSQLiteMetadata(e,a,n),l=[];if(n)try{l=await this.relationshipDiscovery.discoverRelationships(o)}catch(p){console.warn("Relationship discovery failed:",p),l=[]}let c=[];if(s.includeViews)try{c=await this.viewDiscovery.discoverViews(i)}catch(p){console.warn("View discovery failed:",p),c=[]}let d=c.map(p=>({name:p.name,schema:p.schema,definition:p.definition||"",columns:p.columns||[]}));return{tables:o,relationships:l,views:d}}async enhanceTablesWithSQLiteMetadata(e,t,i){let s=[];for(let n of t)try{let a=await this.indexDiscovery.discoverTableIndexes(e,n.name),o=await this.constraintDiscovery.discoverTableConstraints(e,n.name),l=i?await this.constraintDiscovery.getForeignKeyInfo(e,n.name):[],c=await this.indexDiscovery.getTableSize(e,n.name);s.push({...n,indexes:a.map(d=>({name:d.name,columns:d.columns,unique:d.unique,isPrimary:d.isPrimary,definition:d.definition})),constraints:o,foreignKeys:l.map(d=>({name:d.name,column:d.column,referencedTable:d.referencedTable,referencedColumn:d.referencedColumn,onDelete:d.onDelete,onUpdate:d.onUpdate})),tableSize:c})}catch(a){console.warn(`Failed to enhance SQLite metadata for table ${n.name}:`,a),s.push({...n,indexes:[],constraints:[],foreignKeys:[],tableSize:void 0})}return s}getCapabilities(){return{supportsViews:!0,supportsIndexes:!0,supportsConstraints:!0,supportsForeignKeys:!0,supportsCheckConstraints:!0,supportsDeferredConstraints:!1,supportsPartialIndexes:!0,supportsExpressionIndexes:!0,supportsConcurrentIndexCreation:!1,supportsMaterializedViews:!1,supportsCustomTypes:!1,supportsExtensions:!1,supportsPRAGMA:!0,supportsAutoIncrement:!0,supportsRowId:!0,supportsTriggers:!0,supportsFullTextSearch:!0}}async getRecommendations(e,t){let i=[];try{await this.constraintDiscovery.isForeignKeySupportEnabled(e)||i.push("Consider enabling foreign key support with PRAGMA foreign_keys = ON for better data integrity")}catch{i.push("Consider enabling foreign key support with PRAGMA foreign_keys = ON for better data integrity")}for(let s of t)try{let n=await this.indexDiscovery.discoverTableIndexes(e,s.name),a=this.indexDiscovery.analyzeIndexEfficiency(n);i.push(...a.recommendations);let o=await this.constraintDiscovery.discoverTableConstraints(e,s.name),l=this.constraintDiscovery.analyzeConstraintCompatibility(o);i.push(...l.recommendations),(!s.primaryKey||s.primaryKey.length===0)&&i.push(`Table ${s.name} should have a primary key for better performance`)}catch(n){console.warn(`Failed to get recommendations for SQLite table ${s.name}:`,n)}return i}getConfigurationRecommendations(){return["Enable foreign key constraints: PRAGMA foreign_keys = ON","Use WAL mode for better concurrency: PRAGMA journal_mode = WAL","Set appropriate cache size: PRAGMA cache_size = -64000","Enable query optimization: PRAGMA optimize","Consider using prepared statements for better performance"]}}});var Jh,MS=g(()=>{"use strict";yh();Hh();Qh();Gh();Jh=class r{static instance;tableDiscovery;relationshipDiscovery;viewDiscovery;constructor(){this.tableDiscovery=Vs.getInstance(),this.relationshipDiscovery=Hs.getInstance(),this.viewDiscovery=Qs.getInstance()}static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverSchema(e,t={}){let i=new zo(e),s={excludeTables:t.excludeTables,includeViews:t.includeViews,customTypeMappings:t.customTypeMappings},n=[];try{n=await this.tableDiscovery.discoverTables(i,s)}catch(l){console.warn("PostgreSQL table discovery failed:",l),n=[]}let a=[];try{a=await this.relationshipDiscovery.discoverRelationships(n)}catch(l){console.warn("PostgreSQL relationship discovery failed:",l),a=[]}let o=[];if(s.includeViews)try{o=(await this.viewDiscovery.discoverViews(i)).map(c=>({name:c.name,schema:c.schema,definition:c.definition||"",columns:c.columns||[]}))}catch(l){console.warn("PostgreSQL view discovery failed:",l),o=[]}return{tables:n,relationships:a,views:o}}getCapabilities(){return{supportsViews:!0,supportsIndexes:!0,supportsConstraints:!0,supportsForeignKeys:!0,supportsCheckConstraints:!0,supportsDeferredConstraints:!0,supportsPartialIndexes:!0,supportsExpressionIndexes:!0,supportsConcurrentIndexCreation:!0,supportsMaterializedViews:!0,supportsCustomTypes:!0,supportsExtensions:!0,supportsPRAGMA:!1,supportsAutoIncrement:!0,supportsRowId:!1,supportsTriggers:!0,supportsFullTextSearch:!0}}getConfigurationRecommendations(){return["Use connection pooling for better performance","Enable SSL for secure database connections","Consider using JSONB for unstructured data","Use appropriate isolation levels for transactions","Monitor slow queries using pg_stat_statements"]}}});var Xh,kS=g(()=>{"use strict";Hh();Qh();Gh();RS();p3();u3();MS();Xh=class r{static instance;static getInstance(){return r.instance||(r.instance=new r),r.instance}createTableDiscovery(){return Vs.getInstance()}createRelationshipDiscovery(){return Hs.getInstance()}createViewDiscovery(){return Qs.getInstance()}createIndexDiscovery(e){switch(e.trim().toLowerCase()){case"sqlite":return il.getInstance();case"postgres":case"postgresql":return null;default:throw new Error(`Unsupported dialect for index discovery: ${e}`)}}createConstraintDiscovery(e){switch(e.trim().toLowerCase()){case"sqlite":return sl.getInstance();case"postgres":case"postgresql":return null;default:throw new Error(`Unsupported dialect for constraint discovery: ${e}`)}}createDiscoveryCoordinator(e){switch(e.trim().toLowerCase()){case"sqlite":return Kh.getInstance();case"postgres":case"postgresql":return Jh.getInstance();default:throw new Error(`Unsupported dialect for discovery coordinator: ${e}`)}}createDiscoveryServices(e){return{tableDiscovery:this.createTableDiscovery(),relationshipDiscovery:this.createRelationshipDiscovery(),viewDiscovery:this.createViewDiscovery(),indexDiscovery:this.createIndexDiscovery(e),constraintDiscovery:this.createConstraintDiscovery(e)}}getSupportedDialects(){return["sqlite","postgres","postgresql"]}isDialectSupported(e){return this.getSupportedDialects().includes(e.trim().toLowerCase())}getDialectCapabilities(e){switch(e.trim().toLowerCase()){case"sqlite":return{supportsViews:!0,supportsIndexes:!0,supportsConstraints:!0,supportsForeignKeys:!0,supportsCheckConstraints:!0,supportsDeferredConstraints:!1};case"postgres":case"postgresql":return{supportsViews:!0,supportsIndexes:!0,supportsConstraints:!0,supportsForeignKeys:!0,supportsCheckConstraints:!0,supportsDeferredConstraints:!0};default:return{supportsViews:!1,supportsIndexes:!1,supportsConstraints:!1,supportsForeignKeys:!1,supportsCheckConstraints:!1,supportsDeferredConstraints:!1}}}}});var Yh,IS=g(()=>{"use strict";kS();Yh=class r{static instance;factory;currentDialect="sqlite";constructor(){this.factory=Xh.getInstance()}static getInstance(){return r.instance||(r.instance=new r),r.instance}async discoverSchema(e,t={},i){let s=typeof i=="string"?i:i?.name||"sqlite";if(this.currentDialect=s,!this.factory.isDialectSupported(s))throw new Error(`Unsupported dialect: ${s}`);return await this.factory.createDiscoveryCoordinator(s).discoverSchema(e,t)}getFactory(){return this.factory}getCurrentDialect(){return this.currentDialect}getDialectCapabilities(){return this.factory.getDialectCapabilities(this.currentDialect)}isDialectSupported(e){return this.factory.isDialectSupported(e)}}});var Zh,PS=g(()=>{"use strict";IS();Zh=class{db;config;dialect;coordinator;constructor(e,t={},i){this.db=e,this.config=t,this.dialect=i,this.coordinator=Yh.getInstance()}async discoverSchema(){return await this.coordinator.discoverSchema(this.db,this.config,this.dialect)}getCoordinator(){return this.coordinator}}});var nl,m3=g(()=>{"use strict";nl=class{config;constructor(e={}){this.config=e}generateTypes(e){let t=[],i="",s="";for(let n of e.tables){let a=this.generateEntityType(n,e.relationships);t.push(a),i+=a.interface+`
240
-
241
- `,s+=a.insertType+`
242
-
243
- `,s+=a.updateType+`
244
-
245
- `,s+=a.selectType+`
246
-
247
- `}return i+=this.generateRelationshipTypes(e.relationships),{entities:t,interfaces:i,types:s}}generateEntityType(e,t){let i=this.toPascalCase(e.name),s=e.name,n=this.generateEntityInterface(e,i,t),a=this.generateInsertType(e,i),o=this.generateUpdateType(e,i),l=this.generateSelectType(e,i);return{name:i,tableName:s,interface:n,insertType:a,updateType:o,selectType:l}}generateEntityInterface(e,t,i){let s=`export interface ${t} {
248
- `;for(let a of e.columns)if(a.isPrimaryKey){let o=this.mapColumnToTypeScript(a),l=a.nullable?"?":"";s+=` ${a.name}${l}: ${o}
249
- `}for(let a of e.columns)if(!a.isPrimaryKey){let o=this.mapColumnToTypeScript(a),l=a.nullable?"?":"";s+=` ${a.name}${l}: ${o}
250
- `}let n=this.getRelationshipsForTable(e.name,i);for(let a of n){let o=this.getRelationshipType(a);s+=` ${a.name}?: ${o}
251
- `}return s+="}",s}generateInsertType(e,t){let i=`export type ${t}Insert = {
252
- `;for(let s of e.columns){if(s.isAutoIncrement)continue;let n=this.mapColumnToTypeScript(s),a=s.nullable||s.defaultValue?"?":"";i+=` ${s.name}${a}: ${n}
253
- `}return i+="}",i}generateUpdateType(e,t){let i=`export type ${t}Update = {
254
- `;for(let s of e.columns){let n=this.mapColumnToTypeScript(s),a=s.isPrimaryKey?"":"?";i+=` ${s.name}${a}: ${n}
255
- `}return i+="}",i}generateSelectType(e,t){let i=`export type ${t}Select = {
256
- `;for(let s of e.columns){let n=this.mapColumnToTypeScript(s),a=s.nullable?"?":"";i+=` ${s.name}${a}: ${n}
257
- `}return i+="}",i}generateRelationshipTypes(e){let t=`// Relationship types
258
- `,i=new Map;for(let s of e)i.has(s.fromTable)||i.set(s.fromTable,[]),i.get(s.fromTable).push(s);for(let[s,n]of i){let a=this.toPascalCase(s);for(let o of n){let l=this.toPascalCase(o.toTable),c;switch(o.type){case"one-to-many":c=`${l}[]`;break;case"many-to-one":c=l;break;case"many-to-many":c=`${l}[]`;break;default:c=l}t+=`export type ${a}${this.toPascalCase(o.name)} = ${c}
259
- `}}return t}mapColumnToTypeScript(e){if(this.config.customTypeMappings?.[e.type])return this.config.customTypeMappings[e.type];if(e.type.endsWith("[]")){let s=e.type.slice(0,-2),a=`Array<${this.mapColumnToTypeScript({...e,type:s,nullable:!1})}>`;return e.nullable?`${a} | null`:a}let t={varchar:"string",text:"string",char:"string",integer:"number",bigint:"number",smallint:"number",decimal:"number",numeric:"number",real:"number","double precision":"number",boolean:"boolean",date:"Date",timestamp:"Date",timestamptz:"Date",time:"Date",json:"Record<string, unknown>",jsonb:"Record<string, unknown>",uuid:"string",tsvector:"string",tsquery:"string",longtext:"string",mediumtext:"string",tinytext:"string",int:"number",tinyint:"number",float:"number",double:"number",bool:"boolean",datetime:"Date",blob:"Buffer",int2:"number",int8:"number",clob:"string",nvarchar:"string",nchar:"string",ntext:"string",bit:"boolean",datetime2:"Date",smalldatetime:"Date"};if(t[e.type.toLowerCase()]){let s=t[e.type.toLowerCase()];return e.nullable&&s!=="unknown"&&(s=`${s} | null`),s}let i=e.type.toLowerCase().split("(")[0];if(t[i]){let s=t[i];return e.nullable&&s!=="unknown"&&(s=`${s} | null`),s}return e.nullable?"unknown | null":"unknown"}getRelationshipsForTable(e,t){return t.filter(i=>i.fromTable===e)}toCamelCase(e){return e.replace(/[^a-zA-Z0-9]+(.)/g,(t,i)=>i.toUpperCase()).replace(/^[A-Z]/,t=>t.toLowerCase())}getRelationshipType(e){let t=this.toPascalCase(e.toTable);switch(e.type){case"one-to-many":return`${t}[]`;case"many-to-one":return t;case"many-to-many":return`${t}[]`;default:return t}}toPascalCase(e){return e.replace(/[^a-zA-Z0-9]+(.)/g,(t,i)=>i.toUpperCase()).replace(/^[a-z]/,t=>t.toUpperCase())}}});var Xe,e1,t1,r1,i1=g(()=>{"use strict";Xe=class r extends Error{context;constructor(e,t={}){super(e),this.context=t,this.name="NoormError",Error.captureStackTrace&&Error.captureStackTrace(this,r)}getFormattedMessage(){let e=this.message;return this.context.table&&(e+=`
260
- Table: ${this.context.table}`),this.context.operation&&(e+=`
261
- Operation: ${this.context.operation}`),this.context.suggestion&&(e+=`
262
- Suggestion: ${this.context.suggestion}`),this.context.availableOptions&&this.context.availableOptions.length>0&&(e+=`
263
- Available options: ${this.context.availableOptions.join(", ")}`),this.context.originalError&&(e+=`
264
- Original error: ${this.context.originalError.message}`),e}toJSON(){return{name:this.name,message:this.message,context:this.context,stack:this.stack}}},e1=class extends Xe{constructor(e,t=[]){let i=t.length>0?`Table '${e}' not found. Available tables: ${t.join(", ")}`:`Table '${e}' not found. Check your table name or run schema discovery.`;super(i,{table:e,operation:"table_lookup",suggestion:t.length>0?`Available tables: ${t.join(", ")}`:"Check your table name or run schema discovery",availableOptions:t}),this.name="TableNotFoundError"}},t1=class r extends Xe{constructor(e,t,i=[]){let s=i.filter(a=>a.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(a.toLowerCase())||r.calculateSimilarity(a,e)>.6),n="Check your column name or run schema discovery";i.length>0&&(n=`Available columns: ${i.join(", ")}`,s.length>0&&(n+=`
265
- \u2192 Did you mean '${s[0]}'? (${Math.round(r.calculateSimilarity(s[0],e)*100)}% similarity)`)),super(`Column '${e}' not found in table '${t}'`,{table:t,operation:"column_lookup",suggestion:n,availableOptions:i}),this.name="ColumnNotFoundError"}static calculateSimilarity(e,t){let i=e.length>t.length?e:t,s=e.length>t.length?t:e;if(i.length===0)return 1;let n=r.levenshteinDistance(i,s);return(i.length-n)/i.length}static levenshteinDistance(e,t){let i=[];for(let s=0;s<=t.length;s++)i[s]=[s];for(let s=0;s<=e.length;s++)i[0][s]=s;for(let s=1;s<=t.length;s++)for(let n=1;n<=e.length;n++)t.charAt(s-1)===e.charAt(n-1)?i[s][n]=i[s-1][n-1]:i[s][n]=Math.min(i[s-1][n-1]+1,i[s][n-1]+1,i[s-1][n]+1);return i[t.length][e.length]}},r1=class extends Xe{constructor(e,t,i=[]){super(`Relationship '${e}' not found on table '${t}'`,{table:t,operation:"relationship_lookup",suggestion:i.length>0?`Available relationships: ${i.join(", ")}`:"No relationships defined for this table",availableOptions:i}),this.name="RelationshipNotFoundError"}}});var al,h3=g(()=>{"use strict";al=class{db;config;relationships=[];constructor(e,t={}){this.db=e,this.config=t}initialize(e){this.relationships=e}async loadRelationships(e,t){if(!this.config.enableBatchLoading){for(let s of e)await this.loadEntityRelationships(s,t);return}let i=this.config.maxBatchSize||100;for(let s=0;s<e.length;s+=i){let n=e.slice(s,s+i);await this.batchLoadRelationships(n,t)}}async loadEntityRelationships(e,t){for(let i of t){let s=this.relationships.find(n=>n.name===i);s&&await this.loadSingleRelationship(e,s)}}async batchLoadRelationships(e,t){for(let i of t){let s=this.relationships.find(n=>n.name===i);s&&await this.batchLoadSingleRelationship(e,s)}}async loadSingleRelationship(e,t){let i=e[t.fromColumn];if(!i)return;let s;switch(t.type){case"many-to-one":s=await this.db.selectFrom(t.toTable).selectAll().where(t.toColumn,"=",i).executeTakeFirst();break;case"one-to-many":s=await this.db.selectFrom(t.toTable).selectAll().where(t.toColumn,"=",i).execute();break;case"many-to-many":s=await this.loadManyToManyRelationship(e,t);break}e[t.name]=s}async batchLoadSingleRelationship(e,t){let i=e.map(a=>a[t.fromColumn]).filter(a=>a!=null);if(i.length===0)return;let s;switch(t.type){case"many-to-one":s=await this.db.selectFrom(t.toTable).selectAll().where(t.toColumn,"in",i).execute();break;case"one-to-many":s=await this.db.selectFrom(t.toTable).selectAll().where(t.toColumn,"in",i).execute();break;case"many-to-many":s=await this.batchLoadManyToManyRelationship(e,t);break;default:s=[]}let n=new Map;for(let a of s){let o=a[t.toColumn];n.has(o)||n.set(o,[]),n.get(o).push(a)}for(let a of e){let o=a[t.fromColumn];if(o){let l;t.type==="many-to-one"?l=n.get(o)?.[0]:l=n.get(o)||[],a[t.name]=l}}}async loadManyToManyRelationship(e,t){if(!t.throughTable)throw new Error("Many-to-many relationship requires throughTable");let i=e[t.fromColumn];return i?await this.db.selectFrom(t.toTable).innerJoin(t.throughTable,t.throughToColumn,`${t.toTable}.${t.toColumn}`).where(t.throughFromColumn,"=",i).selectAll(t.toTable).execute():[]}async batchLoadManyToManyRelationship(e,t){if(!t.throughTable)throw new Error("Many-to-many relationship requires throughTable");let i=e.map(s=>s[t.fromColumn]).filter(s=>s!=null);return i.length===0?[]:await this.db.selectFrom(t.toTable).innerJoin(t.throughTable,t.throughToColumn,`${t.toTable}.${t.toColumn}`).where(t.throughFromColumn,"in",i).selectAll(t.toTable).execute()}getRelationshipsForTable(e){return this.relationships.filter(t=>t.fromTable===e)}getAllRelationships(){return[...this.relationships]}addRelationship(e){this.relationships.push(e)}removeRelationship(e){this.relationships=this.relationships.filter(t=>t.name!==e)}}});var s1,f3=g(()=>{"use strict";i1();s1=class r{repository;table;cortex;constructor(e,t,i){this.repository=e,this.table=t,this.cortex=i}async triggerRules(e,t){if(!this.cortex.rules)return t;let i=await this.cortex.rules.evaluateRules(this.table.name,e,t);if(i.action==="deny")throw new Xe(`Operation ${e} on ${this.table.name} denied: ${i.reason}`,{operation:"cognitive_rule_enforcement",suggestion:"Check agent rules or adjust policy"});if(i.action==="audit"&&await this.cortex.reflections.reflect("system","success",`Audit trigger: ${e} on ${this.table.name}`,[`Matched rule ${i.ruleId} for data: ${JSON.stringify(t)}`]),i.action==="mask"&&i.ruleId){let n=(await this.cortex.rules.getActiveRules(this.table.name,e)).find(a=>a.id===i.ruleId);if(n)return this.cortex.rules.applyMasking(t,n)}return t}async create(e){let t=await this.triggerRules("insert",e);return await this.repository.create(t)}async update(e){let t=await this.triggerRules("update",e);return await this.repository.update(t)}async delete(e){return await this.triggerRules("delete",{id:e}),await this.repository.delete(e)}async findById(e){return this.repository.findById(e)}async findAll(){return this.repository.findAll()}async count(){return this.repository.count()}async exists(e){return this.repository.exists(e)}static createProxy(e,t,i){let s=new r(e,t,i);return new Proxy(e,{get(n,a,o){return a in s?s[a]:Reflect.get(n,a,o)}})}}});var g3,n1,OS=g(()=>{"use strict";i1();h3();f3();g3=class r{db;table;primaryKey;transformer;query;constructor(e,t,i,s,n){this.db=e,this.table=t,this.primaryKey=i,this.transformer=s,this.query=n||this.db.selectFrom(this.table.name).selectAll()}async all(){return this.execute()}async get(e){let t=this.query;if(typeof e=="object")for(let[s,n]of Object.entries(e))t=t.where(s,"=",n);else t=t.where(this.primaryKey,"=",e);let i=await t.executeTakeFirst();return i?this.transformer(i):null}filter(e,t,i){let s=this.query;if(typeof e=="object")for(let[n,a]of Object.entries(e))a!==void 0&&(s=s.where(n,"=",a));else t&&i!==void 0&&(s=s.where(e,t,i));return new r(this.db,this.table,this.primaryKey,this.transformer,s)}exclude(e,t,i){let s=this.query;if(typeof e=="object")for(let[n,a]of Object.entries(e))a!==void 0&&(s=s.where(n,"!=",a));else if(t&&i!==void 0){let n=t==="="?"!=":t==="!="?"=":"!=";s=s.where(e,n,i)}return new r(this.db,this.table,this.primaryKey,this.transformer,s)}order_by(...e){let t=this.query;for(let i of e){let s=String(i).startsWith("-")?"desc":"asc",n=String(i).startsWith("-")?String(i).substring(1):String(i);t=t.orderBy(n,s)}return new r(this.db,this.table,this.primaryKey,this.transformer,t)}limit(e){return new r(this.db,this.table,this.primaryKey,this.transformer,this.query.limit(e))}offset(e){return new r(this.db,this.table,this.primaryKey,this.transformer,this.query.offset(e))}async count(){let e=await this.query.clearSelect().select(t=>t.fn.countAll().as("count")).executeTakeFirst();return Number(e?.count||0)}async exists(){return await this.query.select(this.primaryKey).executeTakeFirst()!==void 0}async first(){let e=await this.query.limit(1).executeTakeFirst();return e?this.transformer(e):null}async last(){let e=await this.query.orderBy(this.primaryKey,"desc").limit(1).executeTakeFirst();return e?this.transformer(e):null}async create(e){let t=await this.db.insertInto(this.table.name).values(e).returningAll().executeTakeFirstOrThrow();return this.transformer(t)}async update(e){let t=this.query.select(this.primaryKey),i=await this.db.updateTable(this.table.name).set(e).where(this.primaryKey,"in",t).returningAll().execute();return this.transformer(i)}async delete(){let e=this.query.select(this.primaryKey),t=await this.db.deleteFrom(this.table.name).where(this.primaryKey,"in",e).executeTakeFirst();return Number(t.numDeletedRows||0)}async execute(){let e=await this.query.execute();return this.transformer(e)}},n1=class{db;performanceConfig;cortex;relationshipEngine;constructor(e,t,i){this.db=e,this.performanceConfig=t,this.cortex=i,this.relationshipEngine=new al(e,t)}setRelationships(e){this.relationshipEngine.initialize(e)}transformData(e,t){let i=t.columns.filter(a=>a.type.toLowerCase()==="boolean"||a.type.toLowerCase()==="bool").map(a=>a.name),s=t.columns.filter(a=>{let o=a.type.toLowerCase();return o.includes("date")||o.includes("timestamp")||o.includes("time")}).map(a=>a.name);if(i.length===0&&s.length===0)return e;let n=a=>{if(!a||typeof a!="object")return a;let o={...a};for(let l of i)l in o&&o[l]!==null&&(typeof o[l]=="number"?o[l]=o[l]===1:typeof o[l]=="string"?o[l]=o[l].toLowerCase()==="true":o[l]=!!o[l]);for(let l of s)if(l in o&&o[l]&&(typeof o[l]=="string"||typeof o[l]=="number")){let c=new Date(o[l]);isNaN(c.getTime())||(o[l]=c)}return o};return Array.isArray(e)?e.map(n):n(e)}createRepository(e,t){this.setRelationships(t);let i=e.columns.find(o=>o.isPrimaryKey)?.name||"id",s=o=>this.transformData(o,e),n={objects:new g3(this.db,e,i,s),findById:async o=>{let l=await this.db.selectFrom(e.name).selectAll().where(i,"=",o).executeTakeFirst();return l?s(l):null},findAll:async()=>{let o=await this.db.selectFrom(e.name).selectAll().execute();return s(o)},create:async o=>{let l=await this.db.insertInto(e.name).values(o).returningAll().executeTakeFirstOrThrow();return s(l)},update:async o=>{let l=o[i];if(l===void 0)throw new Error(`Missing primary key '${i}'`);let c=await this.db.updateTable(e.name).set(o).where(i,"=",l).returningAll().executeTakeFirstOrThrow();return s(c)},delete:async o=>{let l=await this.db.deleteFrom(e.name).where(i,"=",o).executeTakeFirst();return Number(l.numDeletedRows||0)>0},count:async()=>{let o=await this.db.selectFrom(e.name).select(l=>l.fn.countAll().as("count")).executeTakeFirst();return Number(o?.count||0)},exists:async o=>await this.db.selectFrom(e.name).select(i).where(i,"=",o).executeTakeFirst()!==void 0,paginate:async o=>{let l=this.db.selectFrom(e.name).selectAll(),c=this.db.selectFrom(e.name).select(w=>w.fn.countAll().as("count"));if(o.where)for(let[w,b]of Object.entries(o.where))b!==void 0&&(l=l.where(w,"=",b),c=c.where(w,"=",b));let d=await c.executeTakeFirst(),p=Number(d?.count||0);o.orderBy&&(l=l.orderBy(o.orderBy.column,o.orderBy.direction));let m=(o.page-1)*o.limit,h=await l.limit(o.limit).offset(m).execute(),f=Math.ceil(p/o.limit);return{data:s(h),pagination:{page:o.page,limit:o.limit,total:p,totalPages:f,hasNext:o.page<f,hasPrev:o.page>1}}},findWithRelations:async(o,l)=>{let c=await n.findById(o);return c?(await this.relationshipEngine.loadRelationships([c],l),c):null},loadRelationships:async(o,l)=>{o.length!==0&&await this.relationshipEngine.loadRelationships(o,l)},withCount:async(o,l)=>{let c=await n.findById(o);if(!c)throw new Error(`Entity ${o} not found`);let d=t.filter(m=>m.fromTable===e.name),p={};for(let m of l){let h=d.find(w=>w.name===m);if(!h)throw new r1(m,e.name,d.map(w=>w.name));let f=c[h.fromColumn];if(f!==void 0){let w=await this.db.selectFrom(h.toTable).select(b=>b.fn.countAll().as("count")).where(h.toColumn,"=",f).executeTakeFirst();p[`${m}Count`]=Number(w?.count||0)}}return{...c,...p}}},a=this.wrapWithDynamicMethods(n,e);return this.cortex&&(a=s1.createProxy(a,e,this.cortex)),a}wrapWithDynamicMethods(e,t){let i=t.columns.map(a=>a.name),s=this.db,n=a=>this.transformData(a,t);return new Proxy(e,{get(a,o,l){if(o in a)return Reflect.get(a,o,l);if(typeof o=="string"&&o.startsWith("findBy"))return async c=>{let d=o.substring(6).replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase(),p=i.find(h=>h.toLowerCase()===d.toLowerCase());if(!p)throw new t1(d,t.name,i);let m=await s.selectFrom(t.name).selectAll().where(p,"=",c).executeTakeFirst();return n(m||null)}}})}}});var a1,DS=g(()=>{"use strict";a1=class{config;cache=new Map;hits=0;misses=0;constructor(e={}){this.config=e}get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>t.ttl?(this.cache.delete(e),this.misses++,null):(this.cache.delete(e),this.cache.set(e,t),this.hits++,t.value):(this.misses++,null)}async set(e,t,i){let s={value:t,timestamp:Date.now(),ttl:i||this.config.ttl||3e5};this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,s);let n=this.config.maxSize||1e3;this.cache.size>n&&this.evictOldest()}delete(e){this.cache.delete(e)}clear(){this.cache.clear(),this.hits=0,this.misses=0}getStats(){let e=this.hits+this.misses;return{size:this.cache.size,hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0}}getHitRate(){let e=this.hits+this.misses;return e>0?this.hits/e:0}updateConfig(e){this.config={...this.config,...e}}async close(){this.clear()}evictOldest(){if(this.config.strategy==="fifo"){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}else{let e=this.cache.keys().next().value;e&&this.cache.delete(e)}}cleanExpired(){let e=Date.now();for(let[t,i]of this.cache.entries())e-i.timestamp>i.ttl&&this.cache.delete(t)}size(){return this.cache.size}has(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>t.ttl?(this.cache.delete(e),!1):!0:!1}keys(){return Array.from(this.cache.keys())}values(){return Array.from(this.cache.values()).map(e=>e.value)}entries(){return Array.from(this.cache.entries()).map(([e,t])=>[e,t.value])}}});var $S=O((Bse,nO)=>{nO.exports={name:"dotenv",version:"16.6.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var WS=O((Wse,Xi)=>{var y3=require("fs"),o1=require("path"),aO=require("os"),oO=require("crypto"),lO=$S(),w3=lO.version,cO=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function dO(r){let e={},t=r.toString();t=t.replace(/\r\n?/mg,`
266
- `);let i;for(;(i=cO.exec(t))!=null;){let s=i[1],n=i[2]||"";n=n.trim();let a=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),a==='"'&&(n=n.replace(/\\n/g,`
267
- `),n=n.replace(/\\r/g,"\r")),e[s]=n}return e}function pO(r){r=r||{};let e=BS(r);r.path=e;let t=Ye.configDotenv(r);if(!t.parsed){let a=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw a.code="MISSING_DATA",a}let i=qS(r).split(","),s=i.length,n;for(let a=0;a<s;a++)try{let o=i[a].trim(),l=mO(t,o);n=Ye.decrypt(l.ciphertext,l.key);break}catch(o){if(a+1>=s)throw o}return Ye.parse(n)}function uO(r){console.log(`[dotenv@${w3}][WARN] ${r}`)}function Ad(r){console.log(`[dotenv@${w3}][DEBUG] ${r}`)}function LS(r){console.log(`[dotenv@${w3}] ${r}`)}function qS(r){return r&&r.DOTENV_KEY&&r.DOTENV_KEY.length>0?r.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function mO(r,e){let t;try{t=new URL(e)}catch(o){if(o.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw o}let i=t.password;if(!i){let o=new Error("INVALID_DOTENV_KEY: Missing key part");throw o.code="INVALID_DOTENV_KEY",o}let s=t.searchParams.get("environment");if(!s){let o=new Error("INVALID_DOTENV_KEY: Missing environment part");throw o.code="INVALID_DOTENV_KEY",o}let n=`DOTENV_VAULT_${s.toUpperCase()}`,a=r.parsed[n];if(!a){let o=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);throw o.code="NOT_FOUND_DOTENV_ENVIRONMENT",o}return{ciphertext:a,key:i}}function BS(r){let e=null;if(r&&r.path&&r.path.length>0)if(Array.isArray(r.path))for(let t of r.path)y3.existsSync(t)&&(e=t.endsWith(".vault")?t:`${t}.vault`);else e=r.path.endsWith(".vault")?r.path:`${r.path}.vault`;else e=o1.resolve(process.cwd(),".env.vault");return y3.existsSync(e)?e:null}function FS(r){return r[0]==="~"?o1.join(aO.homedir(),r.slice(1)):r}function hO(r){let e=!!(r&&r.debug),t=r&&"quiet"in r?r.quiet:!0;(e||!t)&&LS("Loading env from encrypted .env.vault");let i=Ye._parseVault(r),s=process.env;return r&&r.processEnv!=null&&(s=r.processEnv),Ye.populate(s,i,r),{parsed:i}}function fO(r){let e=o1.resolve(process.cwd(),".env"),t="utf8",i=!!(r&&r.debug),s=r&&"quiet"in r?r.quiet:!0;r&&r.encoding?t=r.encoding:i&&Ad("No encoding is specified. UTF-8 is used by default");let n=[e];if(r&&r.path)if(!Array.isArray(r.path))n=[FS(r.path)];else{n=[];for(let c of r.path)n.push(FS(c))}let a,o={};for(let c of n)try{let d=Ye.parse(y3.readFileSync(c,{encoding:t}));Ye.populate(o,d,r)}catch(d){i&&Ad(`Failed to load ${c} ${d.message}`),a=d}let l=process.env;if(r&&r.processEnv!=null&&(l=r.processEnv),Ye.populate(l,o,r),i||!s){let c=Object.keys(o).length,d=[];for(let p of n)try{let m=o1.relative(process.cwd(),p);d.push(m)}catch(m){i&&Ad(`Failed to load ${p} ${m.message}`),a=m}LS(`injecting env (${c}) from ${d.join(",")}`)}return a?{parsed:o,error:a}:{parsed:o}}function gO(r){if(qS(r).length===0)return Ye.configDotenv(r);let e=BS(r);return e?Ye._configVault(r):(uO(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),Ye.configDotenv(r))}function yO(r,e){let t=Buffer.from(e.slice(-64),"hex"),i=Buffer.from(r,"base64"),s=i.subarray(0,12),n=i.subarray(-16);i=i.subarray(12,-16);try{let a=oO.createDecipheriv("aes-256-gcm",t,s);return a.setAuthTag(n),`${a.update(i)}${a.final()}`}catch(a){let o=a instanceof RangeError,l=a.message==="Invalid key length",c=a.message==="Unsupported state or unable to authenticate data";if(o||l){let d=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw d.code="INVALID_DOTENV_KEY",d}else if(c){let d=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw d.code="DECRYPTION_FAILED",d}else throw a}}function wO(r,e,t={}){let i=!!(t&&t.debug),s=!!(t&&t.override);if(typeof e!="object"){let n=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw n.code="OBJECT_REQUIRED",n}for(let n of Object.keys(e))Object.prototype.hasOwnProperty.call(r,n)?(s===!0&&(r[n]=e[n]),i&&Ad(s===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):r[n]=e[n]}var Ye={configDotenv:fO,_configVault:hO,_parseVault:pO,config:gO,decrypt:yO,parse:dO,populate:wO};Xi.exports.configDotenv=Ye.configDotenv;Xi.exports._configVault=Ye._configVault;Xi.exports._parseVault=Ye._parseVault;Xi.exports.config=Ye.config;Xi.exports.decrypt=Ye.decrypt;Xi.exports.parse=Ye.parse;Xi.exports.populate=Ye.populate;Xi.exports=Ye});var zS,l1,US=g(()=>{"use strict";zS=require("node:crypto"),l1=class{db;schemaDiscovery;logger;options;isWatching=!1;intervalId=null;lastSchemaHash=null;lastSchema=null;callbacks=[];constructor(e,t,i,s={}){this.db=e,this.schemaDiscovery=t,this.logger=i,this.options=s;let n=process.env.NODE_ENV==="development";this.options={pollInterval:5e3,ignoreViews:!0,ignoredTables:[],enabled:s.enabled!==void 0?s.enabled:n,...s}}async startWatching(){if(!this.options.enabled){this.logger.debug("Schema watching disabled (not in development mode)");return}if(this.isWatching){this.logger.warn("Schema watcher already running");return}this.logger.info("Starting schema change monitoring...");try{let e=await this.getCurrentSchema();this.lastSchemaHash=this.hashSchema(e),this.lastSchema=e}catch(e){this.logger.error("Failed to get initial schema snapshot:",e),this.lastSchemaHash="0",this.lastSchema=null}this.isWatching=!0,this.intervalId=setInterval(()=>{this.checkForChanges().catch(e=>{this.logger.error("Error checking for schema changes:",e)})},this.options.pollInterval),this.intervalId&&typeof this.intervalId.unref=="function"&&this.intervalId.unref(),this.logger.info(`Schema watcher started (polling every ${this.options.pollInterval}ms)`)}stopWatching(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.isWatching=!1,this.callbacks=[],this.logger&&this.logger.info("Schema watcher stopped")}onSchemaChange(e){this.callbacks.push(e)}removeSchemaChangeCallback(e){let t=this.callbacks.indexOf(e);t>-1&&this.callbacks.splice(t,1)}async checkForChanges(){try{let e=await this.getCurrentSchema(),t=this.hashSchema(e);if(this.logger.debug(`Schema check - Last hash: ${this.lastSchemaHash}, Current hash: ${t}, Tables: ${e.tables.length}`),this.lastSchemaHash&&t!==this.lastSchemaHash){this.logger.info("Schema changes detected, analyzing...");let i=this.detectChanges(this.lastSchema,e);return this.lastSchemaHash=t,this.lastSchema=e,i.length>0&&(this.logger.info(`Found ${i.length} schema changes`),this.notifyCallbacks(i)),i}return this.lastSchemaHash||(this.lastSchemaHash=t,this.lastSchema=e),[]}catch(e){return this.logger.error("Failed to check for schema changes:",e),[]}}async getCurrentSchema(){return await this.schemaDiscovery.discoverSchema()}hashSchema(e){let t=JSON.stringify({tables:e.tables.filter(i=>!this.options.ignoredTables?.includes(i.name)).map(i=>({name:i.name,columns:i.columns.map(s=>({name:s.name,type:s.type,nullable:s.nullable,isPrimaryKey:s.isPrimaryKey,defaultValue:s.defaultValue})),primaryKey:i.primaryKey,foreignKeys:i.foreignKeys,indexes:i.indexes})).sort((i,s)=>i.name.localeCompare(s.name)),relationships:e.relationships.sort((i,s)=>`${i.fromTable}.${i.name}`.localeCompare(`${s.fromTable}.${s.name}`))});return(0,zS.createHash)("sha256").update(t).digest("hex")}detectChanges(e,t){let i=[];if(!e){for(let a of t.tables)i.push({type:"table_added",table:a.name,details:{columns:a.columns.length}});return i}let s=new Map(e.tables.map(a=>[a.name,a])),n=new Map(t.tables.map(a=>[a.name,a]));for(let a of t.tables)s.has(a.name)||i.push({type:"table_added",table:a.name,details:{columns:a.columns.length}});for(let a of e.tables)n.has(a.name)||i.push({type:"table_removed",table:a.name});for(let a of t.tables){let o=s.get(a.name);if(o){let l=new Map(o.columns.map(d=>[d.name,d])),c=new Map(a.columns.map(d=>[d.name,d]));for(let d of a.columns)l.has(d.name)||i.push({type:"column_added",table:a.name,column:d.name,details:{type:d.type}});for(let d of o.columns)if(!c.has(d.name))i.push({type:"column_removed",table:a.name,column:d.name});else{let p=c.get(d.name);this.isColumnModified(d,p)&&i.push({type:"column_modified",table:a.name,column:d.name,details:{old:{type:d.type,nullable:d.nullable},new:{type:p.type,nullable:p.nullable}}})}}}return i}isColumnModified(e,t){return e.type!==t.type||e.nullable!==t.nullable||e.isPrimaryKey!==t.isPrimaryKey}notifyCallbacks(e){this.callbacks.forEach(t=>{try{t(e)}catch(i){this.logger.error("Error in schema change callback:",i)}})}isCurrentlyWatching(){return this.isWatching}getWatchOptions(){return{...this.options}}}});var ol,jS,Rd,VS=g(()=>{"use strict";pd();ol=k(require("node:fs/promises"),1),jS=k(require("node:path"),1),Rd=class{queryHistory=[];warnings=[];recentQueries=new Map;config;logger;cleanupTimer;constructor(e={},t){this.logger=t||new xi("MetricsCollector"),this.config={enabled:process.env.NODE_ENV==="development",slowQueryThreshold:1e3,nPlusOneDetection:!0,missingIndexDetection:!0,largeResultSetThreshold:1e3,maxHistorySize:1e4,warningRetentionDays:7,persistPath:e.persistPath,...e},this.startCleanupTimer(),this.load().catch(i=>this.logger.warn("Failed to load metrics:",i))}async load(){if(!(!this.config.persistPath||!this.config.enabled))try{let e=await ol.readFile(this.config.persistPath,"utf-8"),t=JSON.parse(e);t.queryHistory&&Array.isArray(t.queryHistory)&&(this.queryHistory=t.queryHistory),t.warnings&&Array.isArray(t.warnings)&&(this.warnings=t.warnings),this.logger.debug(`Loaded ${this.queryHistory.length} queries and ${this.warnings.length} warnings from ${this.config.persistPath}`)}catch(e){e.code!=="ENOENT"&&this.logger.warn(`Failed to load metrics from ${this.config.persistPath}:`,e)}}async save(){if(!(!this.config.persistPath||!this.config.enabled))try{let e=jS.dirname(this.config.persistPath);await ol.mkdir(e,{recursive:!0});let t=JSON.stringify({queryHistory:this.queryHistory,warnings:this.warnings,savedAt:Date.now()},null,2);await ol.writeFile(this.config.persistPath,t,"utf-8"),this.logger.debug(`Saved metrics to ${this.config.persistPath}`)}catch(e){this.logger.warn(`Failed to save metrics to ${this.config.persistPath}:`,e)}}recordQuery(e,t,i={}){if(!this.config.enabled)return;let s={query:this.normalizeQuery(e),executionTime:t,timestamp:Date.now(),table:i.table,operation:i.operation,resultCount:i.resultCount,error:i.error};this.queryHistory.push(s),this.queryHistory.length>this.config.maxHistorySize&&(this.queryHistory=this.queryHistory.slice(-this.config.maxHistorySize)),this.trackRecentQuery(s),this.analyzeQuery(s)}getPerformanceStats(){let e=this.queryHistory.length,t=this.queryHistory.filter(l=>l.executionTime>this.config.slowQueryThreshold).length,i=e>0?this.queryHistory.reduce((l,c)=>l+c.executionTime,0)/e:0,s=e>0?this.queryHistory.filter(l=>l.error).length/e:0,n={};for(let l of this.warnings)n[l.type]=(n[l.type]||0)+1;let a=this.getTopSlowQueries(),o=this.getQueryPatterns();return{totalQueries:e,averageExecutionTime:i,slowQueries:t,errorRate:s,warningCount:n,topSlowQueries:a,queryPatterns:o}}getRecentWarnings(e=50){return this.warnings.sort((t,i)=>i.timestamp-t.timestamp).slice(0,e)}getWarningsByType(e){return this.warnings.filter(t=>t.type===e)}getQueryHistory(e){let t=this.queryHistory.sort((i,s)=>s.timestamp-i.timestamp);return e?t.slice(0,e):t}getSlowQueries(e){let t=e||this.config.slowQueryThreshold;return this.queryHistory.filter(i=>i.executionTime>t).sort((i,s)=>s.executionTime-i.executionTime)}getNPlusOnePatterns(){let e=new Map;for(let i of this.queryHistory)e.has(i.query)||e.set(i.query,[]),e.get(i.query).push(i);let t=[];for(let[i,s]of e.entries()){if(s.length<5)continue;let n=[5e3,1e4,3e4];for(let a of n){let o=0;for(let l of s){let c=l.timestamp-a,d=s.filter(p=>p.timestamp>=c&&p.timestamp<=l.timestamp).length;o=Math.max(o,d)}if(o>=5){let l="low";o>=20?l="high":o>=10&&(l="medium"),t.push({pattern:i,count:o,timeWindow:a,severity:l});break}}}return t.sort((i,s)=>s.count-i.count)}async clear(){this.queryHistory=[],this.warnings=[],this.recentQueries.clear(),await this.save(),this.logger.info("Metrics cleared")}exportMetrics(){return{config:this.config,stats:this.getPerformanceStats(),warnings:this.warnings,queries:this.queryHistory}}async shutdown(){this.cleanupTimer&&clearInterval(this.cleanupTimer),await this.save(),this.logger.info("Metrics collector shutdown")}trackRecentQuery(e){let t=e.query;this.recentQueries.has(t)||this.recentQueries.set(t,[]),this.recentQueries.get(t).push(e);let i=Date.now()-1e4;for(let[s,n]of this.recentQueries.entries()){let a=n.filter(o=>o.timestamp>=i);a.length===0?this.recentQueries.delete(s):this.recentQueries.set(s,a)}}analyzeQuery(e){let t=[];if(e.executionTime>this.config.slowQueryThreshold&&t.push({type:"slow_query",message:`Slow query detected: ${e.executionTime}ms`,suggestion:"Consider adding indexes or optimizing the query",query:e.query,table:e.table,severity:e.executionTime>this.config.slowQueryThreshold*3?"high":"medium",timestamp:Date.now()}),this.config.nPlusOneDetection){let i=this.detectNPlusOne(e);i&&t.push(i)}e.resultCount&&e.resultCount>this.config.largeResultSetThreshold&&t.push({type:"large_result_set",message:`Large result set: ${e.resultCount} rows returned`,suggestion:"Consider using pagination or filtering to reduce result size",query:e.query,table:e.table,severity:e.resultCount>this.config.largeResultSetThreshold*5?"high":"medium",timestamp:Date.now()});for(let i of t)this.addWarning(i)}detectNPlusOne(e){let t=this.recentQueries.get(e.query)||[];if(t.length>=5){let s=t.filter(n=>Date.now()-n.timestamp<5e3);if(s.length>=5)return{type:"n_plus_one",message:`Potential N+1 query detected: same query executed ${s.length} times`,suggestion:"Consider using joins or batch loading to reduce query count",query:e.query,table:e.table,severity:"high",timestamp:Date.now()}}return null}addWarning(e){this.warnings.push(e),this.logWarning(e)}logWarning(e){let i=`${this.getWarningEmoji(e.type)} Performance Warning [${e.severity.toUpperCase()}]: ${e.message}`;switch(e.severity){case"high":this.logger.warn(i);break;case"medium":this.logger.info(i);break;case"low":this.logger.debug(i);break}this.logger.debug(` Suggestion: ${e.suggestion}`),e.query&&this.logger.debug(` Query: ${e.query}`)}getWarningEmoji(e){return{n_plus_one:"\u{1F504}",missing_index:"\u{1F4C7}",slow_query:"\u{1F40C}",full_table_scan:"\u{1F50D}",large_result_set:"\u{1F4CA}"}[e]||"\u26A0\uFE0F"}normalizeQuery(e){return e.replace(/\$\d+/g,"?").replace(/'[^']*'/g,"?").replace(/\b\d+\b/g,"?").replace(/\s+/g," ").trim()}getTopSlowQueries(){let e=new Map;for(let t of this.queryHistory)if(t.executionTime>this.config.slowQueryThreshold){e.has(t.query)||e.set(t.query,{totalTime:0,count:0});let i=e.get(t.query);i.totalTime+=t.executionTime,i.count++}return Array.from(e.entries()).map(([t,{totalTime:i,count:s}])=>({query:t,averageTime:i/s,count:s})).sort((t,i)=>i.averageTime-t.averageTime).slice(0,10)}getQueryPatterns(){let e=new Map;for(let t of this.queryHistory){e.has(t.query)||e.set(t.query,{totalTime:0,count:0});let i=e.get(t.query);i.totalTime+=t.executionTime,i.count++}return Array.from(e.entries()).map(([t,{totalTime:i,count:s}])=>({pattern:t,frequency:s,averageTime:i/s})).sort((t,i)=>i.frequency-t.frequency).slice(0,20)}startCleanupTimer(){this.cleanupTimer=setInterval(()=>{this.cleanup(),this.save().catch(e=>this.logger.warn("Failed to auto-save metrics:",e))},6e4)}cleanup(){let e=Date.now()-this.config.warningRetentionDays*24*60*60*1e3;this.warnings=this.warnings.filter(i=>i.timestamp>e);let t=Date.now()-1440*60*1e3;this.queryHistory=this.queryHistory.filter(i=>i.timestamp>t);for(let[i,s]of this.recentQueries.entries()){let n=s.filter(a=>a.timestamp>t);n.length===0?this.recentQueries.delete(i):this.recentQueries.set(i,n)}}}});var Ni=O(c1=>{"use strict";c1.getBooleanOption=(r,e)=>{let t=!1;if(e in r&&typeof(t=r[e])!="boolean")throw new TypeError(`Expected the "${e}" option to be a boolean`);return t};c1.cppdb=Symbol();c1.inspect=Symbol.for("nodejs.util.inspect.custom")});var v3=O((Hse,HS)=>{"use strict";var b3={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function Xn(r,e){if(new.target!==Xn)return new Xn(r,e);if(typeof e!="string")throw new TypeError("Expected second argument to be a string");Error.call(this,r),b3.value=""+r,Object.defineProperty(this,"message",b3),Error.captureStackTrace(this,Xn),this.code=e}Object.setPrototypeOf(Xn,Error);Object.setPrototypeOf(Xn.prototype,Error.prototype);Object.defineProperty(Xn.prototype,"name",b3);HS.exports=Xn});var GS=O((Qse,QS)=>{var d1=require("path").sep||"/";QS.exports=bO;function bO(r){if(typeof r!="string"||r.length<=7||r.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var e=decodeURI(r.substring(7)),t=e.indexOf("/"),i=e.substring(0,t),s=e.substring(t+1);return i=="localhost"&&(i=""),i&&(i=d1+d1+i),s=s.replace(/^(.+)\|/,"$1:"),d1=="\\"&&(s=s.replace(/\//g,"\\")),/^.+\:/.test(s)||(s=d1+s),i+s}});var YS=O((ll,XS)=>{var S3=require("fs"),u1=require("path"),vO=GS(),p1=u1.join,SO=u1.dirname,KS=S3.accessSync&&function(r){try{S3.accessSync(r)}catch{return!1}return!0}||S3.existsSync||u1.existsSync,JS={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function xO(r){typeof r=="string"?r={bindings:r}:r||(r={}),Object.keys(JS).map(function(l){l in r||(r[l]=JS[l])}),r.module_root||(r.module_root=ll.getRoot(ll.getFileName())),u1.extname(r.bindings)!=".node"&&(r.bindings+=".node");for(var e=typeof __webpack_require__=="function"?__non_webpack_require__:require,t=[],i=0,s=r.try.length,n,a,o;i<s;i++){n=p1.apply(null,r.try[i].map(function(l){return r[l]||l})),t.push(n);try{return a=r.path?e.resolve(n):e(n),r.path||(a.path=n),a}catch(l){if(l.code!=="MODULE_NOT_FOUND"&&l.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(l.message))throw l}}throw o=new Error(`Could not locate the bindings file. Tried:
268
- `+t.map(function(l){return r.arrow+l}).join(`
269
- `)),o.tries=t,o}XS.exports=ll=xO;ll.getFileName=function(e){var t=Error.prepareStackTrace,i=Error.stackTraceLimit,s={},n;Error.stackTraceLimit=10,Error.prepareStackTrace=function(o,l){for(var c=0,d=l.length;c<d;c++)if(n=l[c].getFileName(),n!==__filename)if(e){if(n!==e)return}else return},Error.captureStackTrace(s),s.stack,Error.prepareStackTrace=t,Error.stackTraceLimit=i;var a="file://";return n.indexOf(a)===0&&(n=vO(n)),n};ll.getRoot=function(e){for(var t=SO(e),i;;){if(t==="."&&(t=process.cwd()),KS(p1(t,"package.json"))||KS(p1(t,"node_modules")))return t;if(i===t)throw new Error('Could not find module root given file: "'+e+'". Do you have a `package.json` file? ');i=t,t=p1(t,"..")}}});var ZS=O(Gs=>{"use strict";var{cppdb:ii}=Ni();Gs.prepare=function(e){return this[ii].prepare(e,this,!1)};Gs.exec=function(e){return this[ii].exec(e),this};Gs.close=function(){return this[ii].close(),this};Gs.loadExtension=function(...e){return this[ii].loadExtension(...e),this};Gs.defaultSafeIntegers=function(...e){return this[ii].defaultSafeIntegers(...e),this};Gs.unsafeMode=function(...e){return this[ii].unsafeMode(...e),this};Gs.getters={name:{get:function(){return this[ii].name},enumerable:!0},open:{get:function(){return this[ii].open},enumerable:!0},inTransaction:{get:function(){return this[ii].inTransaction},enumerable:!0},readonly:{get:function(){return this[ii].readonly},enumerable:!0},memory:{get:function(){return this[ii].memory},enumerable:!0}}});var rx=O((Kse,tx)=>{"use strict";var{cppdb:TO}=Ni(),ex=new WeakMap;tx.exports=function(e){if(typeof e!="function")throw new TypeError("Expected first argument to be a function");let t=this[TO],i=_O(t,this),{apply:s}=Function.prototype,n={default:{value:m1(s,e,t,i.default)},deferred:{value:m1(s,e,t,i.deferred)},immediate:{value:m1(s,e,t,i.immediate)},exclusive:{value:m1(s,e,t,i.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(n.default.value,n),Object.defineProperties(n.deferred.value,n),Object.defineProperties(n.immediate.value,n),Object.defineProperties(n.exclusive.value,n),n.default.value};var _O=(r,e)=>{let t=ex.get(r);if(!t){let i={commit:r.prepare("COMMIT",e,!1),rollback:r.prepare("ROLLBACK",e,!1),savepoint:r.prepare("SAVEPOINT ` _bs3. `",e,!1),release:r.prepare("RELEASE ` _bs3. `",e,!1),rollbackTo:r.prepare("ROLLBACK TO ` _bs3. `",e,!1)};ex.set(r,t={default:Object.assign({begin:r.prepare("BEGIN",e,!1)},i),deferred:Object.assign({begin:r.prepare("BEGIN DEFERRED",e,!1)},i),immediate:Object.assign({begin:r.prepare("BEGIN IMMEDIATE",e,!1)},i),exclusive:Object.assign({begin:r.prepare("BEGIN EXCLUSIVE",e,!1)},i)})}return t},m1=(r,e,t,{begin:i,commit:s,rollback:n,savepoint:a,release:o,rollbackTo:l})=>function(){let d,p,m;t.inTransaction?(d=a,p=o,m=l):(d=i,p=s,m=n),d.run();try{let h=r.call(e,this,arguments);if(h&&typeof h.then=="function")throw new TypeError("Transaction function cannot return a promise");return p.run(),h}catch(h){throw t.inTransaction&&(m.run(),m!==n&&p.run()),h}}});var sx=O((Jse,ix)=>{"use strict";var{getBooleanOption:EO,cppdb:NO}=Ni();ix.exports=function(e,t){if(t==null&&(t={}),typeof e!="string")throw new TypeError("Expected first argument to be a string");if(typeof t!="object")throw new TypeError("Expected second argument to be an options object");let i=EO(t,"simple"),s=this[NO].prepare(`PRAGMA ${e}`,this,!0);return i?s.pluck().get():s.all()}});var ox=O((Xse,ax)=>{"use strict";var CO=require("fs"),AO=require("path"),{promisify:RO}=require("util"),{cppdb:MO}=Ni(),nx=RO(CO.access);ax.exports=async function(e,t){if(t==null&&(t={}),typeof e!="string")throw new TypeError("Expected first argument to be a string");if(typeof t!="object")throw new TypeError("Expected second argument to be an options object");e=e.trim();let i="attached"in t?t.attached:"main",s="progress"in t?t.progress:null;if(!e)throw new TypeError("Backup filename cannot be an empty string");if(e===":memory:")throw new TypeError('Invalid backup filename ":memory:"');if(typeof i!="string")throw new TypeError('Expected the "attached" option to be a string');if(!i)throw new TypeError('The "attached" option cannot be an empty string');if(s!=null&&typeof s!="function")throw new TypeError('Expected the "progress" option to be a function');await nx(AO.dirname(e)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let n=await nx(e).then(()=>!1,()=>!0);return kO(this[MO].backup(this,i,e,n),s||null)};var kO=(r,e)=>{let t=0,i=!0;return new Promise((s,n)=>{setImmediate(function a(){try{let o=r.transfer(t);if(!o.remainingPages){r.close(),s(o);return}if(i&&(i=!1,t=100),e){let l=e(o);if(l!==void 0)if(typeof l=="number"&&l===l)t=Math.max(0,Math.min(2147483647,Math.round(l)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(a)}catch(o){r.close(),n(o)}})})}});var cx=O((Yse,lx)=>{"use strict";var{cppdb:IO}=Ni();lx.exports=function(e){if(e==null&&(e={}),typeof e!="object")throw new TypeError("Expected first argument to be an options object");let t="attached"in e?e.attached:"main";if(typeof t!="string")throw new TypeError('Expected the "attached" option to be a string');if(!t)throw new TypeError('The "attached" option cannot be an empty string');return this[IO].serialize(t)}});var px=O((Zse,dx)=>{"use strict";var{getBooleanOption:h1,cppdb:PO}=Ni();dx.exports=function(e,t,i){if(t==null&&(t={}),typeof t=="function"&&(i=t,t={}),typeof e!="string")throw new TypeError("Expected first argument to be a string");if(typeof i!="function")throw new TypeError("Expected last argument to be a function");if(typeof t!="object")throw new TypeError("Expected second argument to be an options object");if(!e)throw new TypeError("User-defined function name cannot be an empty string");let s="safeIntegers"in t?+h1(t,"safeIntegers"):2,n=h1(t,"deterministic"),a=h1(t,"directOnly"),o=h1(t,"varargs"),l=-1;if(!o){if(l=i.length,!Number.isInteger(l)||l<0)throw new TypeError("Expected function.length to be a positive integer");if(l>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[PO].function(i,e,l,s,n,a),this}});var hx=O((ene,mx)=>{"use strict";var{getBooleanOption:f1,cppdb:OO}=Ni();mx.exports=function(e,t){if(typeof e!="string")throw new TypeError("Expected first argument to be a string");if(typeof t!="object"||t===null)throw new TypeError("Expected second argument to be an options object");if(!e)throw new TypeError("User-defined function name cannot be an empty string");let i="start"in t?t.start:null,s=x3(t,"step",!0),n=x3(t,"inverse",!1),a=x3(t,"result",!1),o="safeIntegers"in t?+f1(t,"safeIntegers"):2,l=f1(t,"deterministic"),c=f1(t,"directOnly"),d=f1(t,"varargs"),p=-1;if(!d&&(p=Math.max(ux(s),n?ux(n):0),p>0&&(p-=1),p>100))throw new RangeError("User-defined functions cannot have more than 100 arguments");return this[OO].aggregate(i,s,n,a,e,p,o,l,c),this};var x3=(r,e,t)=>{let i=e in r?r[e]:null;if(typeof i=="function")return i;if(i!=null)throw new TypeError(`Expected the "${e}" option to be a function`);if(t)throw new TypeError(`Missing required option "${e}"`);return null},ux=({length:r})=>{if(Number.isInteger(r)&&r>=0)return r;throw new TypeError("Expected function.length to be a positive integer")}});var wx=O((tne,yx)=>{"use strict";var{cppdb:DO}=Ni();yx.exports=function(e,t){if(typeof e!="string")throw new TypeError("Expected first argument to be a string");if(!e)throw new TypeError("Virtual table module name cannot be an empty string");let i=!1;if(typeof t=="object"&&t!==null)i=!0,t=UO(gx(t,"used",e));else{if(typeof t!="function")throw new TypeError("Expected second argument to be a function or a table definition object");t=$O(t)}return this[DO].table(t,e,i),this};function $O(r){return function(t,i,s,...n){let a={module:t,database:i,table:s},o=WO.call(r,a,n);if(typeof o!="object"||o===null)throw new TypeError(`Virtual table module "${t}" did not return a table definition object`);return gx(o,"returned",t)}}function gx(r,e,t){if(!Md.call(r,"rows"))throw new TypeError(`Virtual table module "${t}" ${e} a table definition without a "rows" property`);if(!Md.call(r,"columns"))throw new TypeError(`Virtual table module "${t}" ${e} a table definition without a "columns" property`);let i=r.rows;if(typeof i!="function"||Object.getPrototypeOf(i)!==zO)throw new TypeError(`Virtual table module "${t}" ${e} a table definition with an invalid "rows" property (should be a generator function)`);let s=r.columns;if(!Array.isArray(s)||!(s=[...s]).every(c=>typeof c=="string"))throw new TypeError(`Virtual table module "${t}" ${e} a table definition with an invalid "columns" property (should be an array of strings)`);if(s.length!==new Set(s).size)throw new TypeError(`Virtual table module "${t}" ${e} a table definition with duplicate column names`);if(!s.length)throw new RangeError(`Virtual table module "${t}" ${e} a table definition with zero columns`);let n;if(Md.call(r,"parameters")){if(n=r.parameters,!Array.isArray(n)||!(n=[...n]).every(c=>typeof c=="string"))throw new TypeError(`Virtual table module "${t}" ${e} a table definition with an invalid "parameters" property (should be an array of strings)`)}else n=BO(i);if(n.length!==new Set(n).size)throw new TypeError(`Virtual table module "${t}" ${e} a table definition with duplicate parameter names`);if(n.length>32)throw new RangeError(`Virtual table module "${t}" ${e} a table definition with more than the maximum number of 32 parameters`);for(let c of n)if(s.includes(c))throw new TypeError(`Virtual table module "${t}" ${e} a table definition with column "${c}" which was ambiguously defined as both a column and parameter`);let a=2;if(Md.call(r,"safeIntegers")){let c=r.safeIntegers;if(typeof c!="boolean")throw new TypeError(`Virtual table module "${t}" ${e} a table definition with an invalid "safeIntegers" property (should be a boolean)`);a=+c}let o=!1;if(Md.call(r,"directOnly")&&(o=r.directOnly,typeof o!="boolean"))throw new TypeError(`Virtual table module "${t}" ${e} a table definition with an invalid "directOnly" property (should be a boolean)`);return[`CREATE TABLE x(${[...n.map(fx).map(c=>`${c} HIDDEN`),...s.map(fx)].join(", ")});`,FO(i,new Map(s.map((c,d)=>[c,n.length+d])),t),n,a,o]}function FO(r,e,t){return function*(...s){let n=s.map(a=>Buffer.isBuffer(a)?Buffer.from(a):a);for(let a=0;a<e.size;++a)n.push(null);for(let a of r(...s))if(Array.isArray(a))LO(a,n,e.size,t),yield n;else if(typeof a=="object"&&a!==null)qO(a,n,e,t),yield n;else throw new TypeError(`Virtual table module "${t}" yielded something that isn't a valid row object`)}}function LO(r,e,t,i){if(r.length!==t)throw new TypeError(`Virtual table module "${i}" yielded a row with an incorrect number of columns`);let s=e.length-t;for(let n=0;n<t;++n)e[n+s]=r[n]}function qO(r,e,t,i){let s=0;for(let n of Object.keys(r)){let a=t.get(n);if(a===void 0)throw new TypeError(`Virtual table module "${i}" yielded a row with an undeclared column "${n}"`);e[a]=r[n],s+=1}if(s!==t.size)throw new TypeError(`Virtual table module "${i}" yielded a row with missing columns`)}function BO({length:r}){if(!Number.isInteger(r)||r<0)throw new TypeError("Expected function.length to be a positive integer");let e=[];for(let t=0;t<r;++t)e.push(`$${t+1}`);return e}var{hasOwnProperty:Md}=Object.prototype,{apply:WO}=Function.prototype,zO=Object.getPrototypeOf(function*(){}),fx=r=>`"${r.replace(/"/g,'""')}"`,UO=r=>()=>r});var vx=O((rne,bx)=>{"use strict";var jO=function(){};bx.exports=function(e,t){return Object.assign(new jO,this)}});var _x=O((ine,Tx)=>{"use strict";var VO=require("fs"),Sx=require("path"),g1=Ni(),HO=v3(),xx;function Pt(r,e){if(new.target==null)return new Pt(r,e);let t;if(Buffer.isBuffer(r)&&(t=r,r=":memory:"),r==null&&(r=""),e==null&&(e={}),typeof r!="string")throw new TypeError("Expected first argument to be a string");if(typeof e!="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in e)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in e)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let i=r.trim(),s=i===""||i===":memory:",n=g1.getBooleanOption(e,"readonly"),a=g1.getBooleanOption(e,"fileMustExist"),o="timeout"in e?e.timeout:5e3,l="verbose"in e?e.verbose:null,c="nativeBinding"in e?e.nativeBinding:null;if(n&&s&&!t)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(o)||o<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if(o>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(l!=null&&typeof l!="function")throw new TypeError('Expected the "verbose" option to be a function');if(c!=null&&typeof c!="string"&&typeof c!="object")throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let d;if(c==null?d=xx||(xx=YS()("better_sqlite3.node")):typeof c=="string"?d=(typeof __non_webpack_require__=="function"?__non_webpack_require__:require)(Sx.resolve(c).replace(/(\.node)?$/,".node")):d=c,d.isInitialized||(d.setErrorConstructor(HO),d.isInitialized=!0),!s&&!i.startsWith("file:")&&!VO.existsSync(Sx.dirname(i)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[g1.cppdb]:{value:new d.Database(i,r,s,n,a,o,l||null,t||null)},...Yn.getters})}var Yn=ZS();Pt.prototype.prepare=Yn.prepare;Pt.prototype.transaction=rx();Pt.prototype.pragma=sx();Pt.prototype.backup=ox();Pt.prototype.serialize=cx();Pt.prototype.function=px();Pt.prototype.aggregate=hx();Pt.prototype.table=wx();Pt.prototype.loadExtension=Yn.loadExtension;Pt.prototype.exec=Yn.exec;Pt.prototype.close=Yn.close;Pt.prototype.defaultSafeIntegers=Yn.defaultSafeIntegers;Pt.prototype.unsafeMode=Yn.unsafeMode;Pt.prototype[g1.inspect]=vx();Tx.exports=Pt});var Ex=O((sne,T3)=>{"use strict";T3.exports=_x();T3.exports.SqliteError=v3()});var cl,y1=g(()=>{"use strict";cl=class{db;config;telemetry;sessionsTable;messagesTable;memoriesTable;goalsTable;constructor(e,t={},i){this.db=e,this.config=t,this.telemetry=i,this.sessionsTable=t.sessionsTable||"agent_sessions",this.messagesTable=t.messagesTable||"agent_messages",this.memoriesTable=t.memoriesTable||"agent_memories",this.goalsTable=t.goalsTable||"agent_goals"}get typedDb(){return this.db}async createSession(e,t){let i=await this.typedDb.insertInto(this.sessionsTable).values({name:e||null,status:"active",metadata:t?JSON.stringify(t):null,created_at:new Date,updated_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseSession(i)}async getSession(e){let t=await this.typedDb.selectFrom(this.sessionsTable).selectAll().where("id","=",e).executeTakeFirst();return t?this.parseSession(t):null}async archiveSession(e){let t=await this.typedDb.updateTable(this.sessionsTable).set({status:"archived",updated_at:new Date}).where("id","=",e).returningAll().executeTakeFirstOrThrow();return this.parseSession(t)}async deleteSession(e){await this.db.transaction().execute(async t=>{await t.deleteFrom(this.messagesTable).where("session_id","=",e).execute(),await t.deleteFrom(this.goalsTable).where("session_id","=",e).execute(),await t.deleteFrom(this.memoriesTable).where("session_id","=",e).execute(),await t.deleteFrom(this.sessionsTable).where("id","=",e).execute()})}async addMessage(e,t,i,s){return await this.db.transaction().execute(async n=>{let a=await n.insertInto(this.messagesTable).values({session_id:e,role:t,content:i,metadata:s?JSON.stringify(s):null,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return await n.updateTable(this.sessionsTable).set({updated_at:new Date}).where("id","=",e).execute(),this.parseMessage(a)})}async getHistory(e,t=50){return(await this.typedDb.selectFrom(this.messagesTable).selectAll().where("session_id","=",e).orderBy("created_at","asc").limit(t).execute()).map(s=>this.parseMessage(s))}async upsertGoal(e,t,i={}){let{status:s="pending",priority:n=0,parentId:a,metadata:o}=i;return await this.db.transaction().execute(async l=>{let c=await l.selectFrom(this.goalsTable).selectAll().where("session_id","=",e).where("description","=",t).forUpdate().executeTakeFirst();if(c){let m=await l.updateTable(this.goalsTable).set({status:s,priority:n,metadata:o?JSON.stringify(o):c.metadata,updated_at:new Date}).where("id","=",c.id).returningAll().executeTakeFirstOrThrow();return this.parseGoal(m)}let d=await l.insertInto(this.goalsTable).values({session_id:e,parent_id:a||null,description:t,status:s,priority:n,metadata:o?JSON.stringify(o):null,created_at:new Date,updated_at:new Date}).returningAll().executeTakeFirstOrThrow(),p=this.parseGoal(d);return this.telemetry&&await this.telemetry.track(e,"pivot",`New goal: ${t}`,{goalId:p.id}),p})}async getGoals(e,t){let i=this.typedDb.selectFrom(this.goalsTable).selectAll().where("session_id","=",e).orderBy("priority","desc");return t&&(i=i.where("status","=",t)),(await i.execute()).map(n=>this.parseGoal(n))}async clearHistory(e){let t=await this.typedDb.deleteFrom(this.messagesTable).where("session_id","=",e).executeTakeFirst();return Number(t.numDeletedRows||0)}async markMessageAsAnchor(e){let t=await this.db.transaction().execute(async i=>{let s=await i.selectFrom(this.messagesTable).select("metadata").where("id","=",e).forUpdate().executeTakeFirstOrThrow(),a={...typeof s.metadata=="string"?JSON.parse(s.metadata):s.metadata||{},anchor:!0};return await i.updateTable(this.messagesTable).set({metadata:JSON.stringify(a)}).where("id","=",e).returningAll().executeTakeFirstOrThrow()});return this.parseMessage(t)}parseSession(e){return{id:e.id,name:e.name,status:e.status,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}parseMessage(e){return{id:e.id,sessionId:e.session_id,role:e.role,content:e.content,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at)}}parseGoal(e){return{id:e.id,sessionId:e.session_id,parentId:e.parent_id,description:e.description,status:e.status,priority:e.priority,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var dl,w1=g(()=>{"use strict";dl=class{db;config;memoriesTable;constructor(e,t,i="agent_memories"){this.db=e,this.config=t,this.memoriesTable=i}get typedDb(){return this.db}async addMemory(e,t,i,s){let n=await this.typedDb.insertInto(this.memoriesTable).values({content:e,embedding:JSON.stringify(t),session_id:i||null,metadata:s?JSON.stringify(s):null,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseMemory(n)}async addMemories(e){let i=[];for(let s=0;s<e.length;s+=50){let a=e.slice(s,s+50).map(l=>({content:l.content,embedding:JSON.stringify(l.embedding),session_id:l.sessionId||null,metadata:l.metadata?JSON.stringify(l.metadata):null,created_at:new Date})),o=await this.typedDb.insertInto(this.memoriesTable).values(a).returningAll().execute();i.push(...o.map(l=>this.parseMemory(l)))}return i}async search(e,t={}){let{limit:i=5,sessionId:s,minScore:n=.7,keyword:a}=t,o=[];if(this.config.provider==="pgvector"){let p=this.typedDb.selectFrom(this.memoriesTable).selectAll().orderBy(h=>h.raw(`embedding <=> '[${e.join(",")}]'::vector`)).limit(i);s&&(p=p.where("session_id","=",s)),o=(await p.execute()).map(h=>this.parseMemory(h))}else if(this.config.provider==="sqlite-vss")try{o=(await this.db.selectFrom(this.memoriesTable).selectAll().where(m=>m.raw(`rowid IN (SELECT rowid FROM vss_${this.memoriesTable} WHERE embedding_column = ? LIMIT ?)`,[JSON.stringify(e),i])).execute()).map(m=>this.parseMemory(m))}catch(p){console.warn("[VectorIndexer] SQLite-vss search failed, falling back to manual search:",p)}if(o.length===0){let p=this.typedDb.selectFrom(this.memoriesTable).selectAll().orderBy("created_at","desc").limit(1e3);s&&(p=p.where("session_id","=",s)),o=(await p.execute()).map(f=>{let w=typeof f.embedding=="string"?JSON.parse(f.embedding):f.embedding||[],b=this.cosineSimilarity(e,w);return{memory:f,score:b}}).sort((f,w)=>w.score-f.score).slice(0,i).map(f=>this.parseMemory(f.memory))}let l=[];return a&&(l=await this.keywordSearch(a,{limit:i,sessionId:s})),this.mergeWithRRF(o,l,i).filter(p=>{let m=p.embedding||[];return this.cosineSimilarity(e,m)>=n*.8}).slice(0,i)}async keywordSearch(e,t){let{limit:i,sessionId:s}=t,n=this.typedDb.selectFrom(this.memoriesTable).selectAll();if(this.config.provider==="sqlite-vss")try{n=n.where(o=>o.raw(`rowid IN (SELECT rowid FROM ${this.memoriesTable}_fts WHERE ${this.memoriesTable}_fts MATCH ?)`,[e]))}catch{n=n.where("content","like",`%${e}%`)}else this.config.provider==="pgvector"?n=n.where(o=>o.raw("to_tsvector('english', content) @@ plainto_tsquery('english', ?)",[e])):n=n.where("content","like",`%${e}%`);return s&&(n=n.where("session_id","=",s)),(await n.limit(i).execute()).map(o=>this.parseMemory(o))}mergeWithRRF(e,t,i,s=60){let n={};return e.forEach((a,o)=>{let l=o+1;n[a.id]||(n[a.id]={score:0,memory:a}),n[a.id].score+=1/(s+l)}),t.forEach((a,o)=>{let l=o+1;n[a.id]||(n[a.id]={score:0,memory:a}),n[a.id].score+=1/(s+l)}),Object.values(n).sort((a,o)=>o.score-a.score).map(a=>a.memory)}mergeResults(e,t){let i=new Set,s=[];for(let n of[...t,...e])i.has(n.id)||(i.add(n.id),s.push(n));return s}cosineSimilarity(e,t){if(e.length!==t.length||e.length===0)return 0;let i=0,s=0,n=0;for(let a=0;a<e.length;a++)i+=e[a]*t[a],s+=e[a]*e[a],n+=t[a]*t[a];return i/(Math.sqrt(s)*Math.sqrt(n))}parseMemory(e){return{id:e.id,sessionId:e.session_id,content:e.content,embedding:typeof e.embedding=="string"?JSON.parse(e.embedding):e.embedding||[],metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at)}}}});var b1,_3=g(()=>{"use strict";at();b1=class{db;config;constructor(e,t={}){this.db=e,this.config=t}async initializeSchema(){let e=this.config.sessionsTable||"agent_sessions",t=this.config.messagesTable||"agent_messages",i=this.config.goalsTable||"agent_goals",s=this.config.memoriesTable||"agent_memories",n=this.config.reflectionsTable||"agent_reflections",a=this.config.knowledgeTable||"agent_knowledge_base",o=this.config.actionsTable||"agent_actions",l=this.config.episodesTable||"agent_episodes",c=this.config.resourcesTable||"agent_resource_usage",d=this.config.capabilitiesTable||"agent_capabilities",p=this.config.policiesTable||"agent_policies",m=this.config.metricsTable||"agent_metrics",h=this.config.personasTable||"agent_personas",f=this.config.epochsTable||"agent_epochs",w=this.config.ritualsTable||"agent_rituals",b=this.config.rulesTable||"agent_rules",v="agent_snapshots",S="agent_knowledge_links";await this.db.schema.createTable(e).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("name","text").addColumn("status","text",y=>y.notNull().defaultTo("active")).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).addColumn("updated_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(t).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.references(`${e}.id`).onDelete("cascade")).addColumn("role","text",y=>y.notNull()).addColumn("content","text",y=>y.notNull()).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(i).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.references(`${e}.id`).onDelete("cascade")).addColumn("parent_id","integer",y=>y.references(`${i}.id`).onDelete("cascade")).addColumn("description","text",y=>y.notNull()).addColumn("status","text",y=>y.notNull().defaultTo("pending")).addColumn("priority","integer",y=>y.notNull().defaultTo(0)).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).addColumn("updated_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(s).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.references(`${e}.id`).onDelete("cascade")).addColumn("content","text",y=>y.notNull()).addColumn("embedding","text").addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(n).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.references(`${e}.id`).onDelete("cascade")).addColumn("outcome","text",y=>y.notNull()).addColumn("lessons_learned","text",y=>y.notNull()).addColumn("suggested_actions","text").addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(a).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("entity","text",y=>y.notNull()).addColumn("fact","text",y=>y.notNull()).addColumn("confidence","real",y=>y.notNull().defaultTo(1)).addColumn("source_session_id","integer",y=>y.references(`${e}.id`).onDelete("set null")).addColumn("status","text",y=>y.notNull().defaultTo("proposed")).addColumn("tags","text").addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).addColumn("updated_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(o).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.notNull().references(`${e}.id`).onDelete("cascade")).addColumn("message_id","integer",y=>y.references(`${t}.id`).onDelete("set null")).addColumn("tool_name","text",y=>y.notNull()).addColumn("arguments","text",y=>y.notNull()).addColumn("outcome","text").addColumn("status","text",y=>y.notNull().defaultTo("pending")).addColumn("duration_ms","integer").addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(l).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.notNull().references(`${e}.id`).onDelete("cascade")).addColumn("name","text",y=>y.notNull()).addColumn("summary","text").addColumn("status","text",y=>y.notNull().defaultTo("active")).addColumn("start_time","timestamp",y=>y.notNull()).addColumn("end_time","timestamp").addColumn("metadata","text").execute(),await this.db.schema.createTable(c).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.notNull().references(`${e}.id`).onDelete("cascade")).addColumn("agent_id","text").addColumn("model_name","text",y=>y.notNull()).addColumn("input_tokens","integer",y=>y.notNull().defaultTo(0)).addColumn("output_tokens","integer",y=>y.notNull().defaultTo(0)).addColumn("cost","real",y=>y.notNull().defaultTo(0)).addColumn("currency","text",y=>y.notNull().defaultTo("USD")).addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(d).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("name","text",y=>y.notNull()).addColumn("version","text",y=>y.notNull()).addColumn("description","text").addColumn("status","text",y=>y.notNull().defaultTo("experimental")).addColumn("reliability","real",y=>y.notNull().defaultTo(1)).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).addColumn("updated_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(p).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("name","text",y=>y.notNull()).addColumn("type","text",y=>y.notNull()).addColumn("definition","text",y=>y.notNull()).addColumn("isEnabled","integer",y=>y.notNull().defaultTo(1)).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).addColumn("updated_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(m).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.references(`${e}.id`).onDelete("set null")).addColumn("agent_id","text").addColumn("metric_name","text",y=>y.notNull()).addColumn("metric_value","real",y=>y.notNull()).addColumn("unit","text").addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(h).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("name","text",y=>y.notNull().unique()).addColumn("role","text").addColumn("status","text",y=>y.notNull().defaultTo("active")).addColumn("capabilities","text").addColumn("policies","text").addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).addColumn("updated_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(f).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("session_id","integer",y=>y.notNull().references(`${e}.id`).onDelete("cascade")).addColumn("summary","text",y=>y.notNull()).addColumn("start_message_id","integer",y=>y.notNull()).addColumn("end_message_id","integer",y=>y.notNull()).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(w).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("name","text",y=>y.notNull()).addColumn("type","text",y=>y.notNull()).addColumn("definition","text").addColumn("frequency","text").addColumn("last_run","timestamp").addColumn("next_run","timestamp").addColumn("status","text",y=>y.notNull().defaultTo("pending")).addColumn("locked_until","timestamp").addColumn("metadata","text").execute(),await this.db.schema.createTable(b).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("tableName","text",y=>y.notNull()).addColumn("operation","text",y=>y.notNull()).addColumn("action","text",y=>y.notNull()).addColumn("script","text").addColumn("isEnabled","integer",y=>y.notNull().defaultTo(1)).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(v).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("name","text",y=>y.notNull()).addColumn("dna","text",y=>y.notNull()).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable("agent_logic_probes").ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("name","text",y=>y.notNull().unique()).addColumn("script","text",y=>y.notNull()).addColumn("expected_outcome","text").addColumn("last_run","timestamp").addColumn("last_status","text").addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute(),await this.db.schema.createTable(S).ifNotExists().addColumn("id","integer",y=>y.primaryKey().autoIncrement()).addColumn("source_id","integer",y=>y.notNull().references(`${a}.id`).onDelete("cascade")).addColumn("target_id","integer",y=>y.notNull().references(`${a}.id`).onDelete("cascade")).addColumn("relationship","text",y=>y.notNull()).addColumn("metadata","text").addColumn("created_at","timestamp",y=>y.notNull()).execute()}async enableVectorSupport(){try{await C`CREATE EXTENSION IF NOT EXISTS vector`.execute(this.db)}catch{console.warn("Failed to enable pgvector extension. Ensure it is installed on your Postgres server.")}}}});var v1,E3=g(()=>{"use strict";v1=class{messages=[];maxTokens;maxMessages;constructor(e={}){this.maxMessages=e.maxMessages||50,this.maxTokens=e.maxTokens||4e3}addMessage(e){this.messages.push(e),this.trimBuffer()}setMessages(e){this.messages=e,this.trimBuffer()}clear(){this.messages=[]}getWindow(e={}){let t=e.maxTokens||this.maxTokens,i=e.maxMessages||this.maxMessages,s=this.messages.length>0&&this.messages[0].role==="system"?this.messages[0]:null,n=s?this.messages.slice(1):this.messages,a=s?i-1:i,l=[...n.map((m,h)=>({msg:m,index:h,isAnchor:!!m.metadata?.anchor,tokens:this.estimateTokens(m.content)}))].sort((m,h)=>m.isAnchor!==h.isAnchor?m.isAnchor?-1:1:h.index-m.index),c=new Set,d=s?this.estimateTokens(s.content):0;for(let m of l)c.size<a&&d+m.tokens<=t&&(c.add(m.msg),d+=m.tokens);return this.messages.filter(m=>m===s||c.has(m))}toPromptString(e){return this.getWindow({maxMessages:e}).map(t=>`[${t.role.toUpperCase()}]: ${t.content}`).join(`
270
-
271
- `)}shouldSummarize(e){let t=e||this.maxTokens*.8;return this.getTotalTokens()>t}getUsageStats(){return{messageCount:this.messages.length,totalTokens:this.getTotalTokens(),maxTokens:this.maxTokens,maxMessages:this.maxMessages}}getTotalTokens(){return this.messages.reduce((e,t)=>e+this.estimateTokens(t.content),0)}trimBuffer(){if(this.messages.length>this.maxMessages*1.5){let e=this.messages[0]?.role==="system"?this.messages[0]:null,t=this.messages.length,s=[...e?this.messages.slice(1):this.messages].sort((a,o)=>{let l=a.metadata?.anchor?1:0,c=o.metadata?.anchor?1:0;if(l!==c)return c-l;let d={system:3,assistant:2,user:1,action:2};return(d[o.role]||0)-(d[a.role]||0)}),n=new Set(s.slice(0,this.maxMessages));this.messages=this.messages.filter(a=>a===e||n.has(a)),console.log(`[ContextBuffer] Importance Trimming: ${t} -> ${this.messages.length} messages. preserved anchors and assistant reasoning.`)}}estimateTokens(e){if(!e)return 0;let i=e.startsWith("{")||e.startsWith("[")||e.includes("```")?3:4;return Math.ceil(e.length/i)}}});var S1,N3=g(()=>{"use strict";S1=class{db;config;reflectionsTable;constructor(e,t={}){this.db=e,this.config=t,this.reflectionsTable=t.reflectionsTable||"agent_reflections"}async reflect(e,t,i,s,n){let a=await this.db.insertInto(this.reflectionsTable).values({session_id:e,outcome:t,lessons_learned:i,suggested_actions:s?JSON.stringify(s):null,metadata:n?JSON.stringify(n):null,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseReflection(a)}async getSessionReflections(e,t={}){return(await this.db.selectFrom(this.reflectionsTable).selectAll().where("session_id","=",e).orderBy("created_at","desc").limit(t.limit??500).offset(t.offset??0).execute()).map(s=>this.parseReflection(s))}async getRecentLessons(e=10){return(await this.db.selectFrom(this.reflectionsTable).select("lessons_learned").orderBy("created_at","desc").limit(e).execute()).map(i=>i.lessons_learned)}parseReflection(e){return{...e,sessionId:e.session_id,lessonsLearned:e.lessons_learned,suggestedActions:typeof e.suggested_actions=="string"?JSON.parse(e.suggested_actions):e.suggested_actions,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata,createdAt:new Date(e.created_at)}}}});function Yi(r,e){let t=Nx(r),i=Nx(e);if(t===i)return 1;if(t.length<2||i.length<2)return 0;let s=Cx(t),n=Cx(i),a=0;for(let o of s)n.has(o)&&a++;return 2*a/(s.size+n.size)}function Nx(r){return r.toLowerCase().replace(/\W+/g," ").trim()}function Cx(r){let e=new Set;for(let t=0;t<r.length-1;t++)e.add(r.substring(t,t+2));return e}var kd=g(()=>{"use strict"});var x1,C3=g(()=>{"use strict";kd();x1=class{db;config;knowledgeTable;linksTable;bloomFilter=new Set;constructor(e,t={}){this.db=e,this.config=t,this.knowledgeTable=t.knowledgeTable||"agent_knowledge_base",this.linksTable="agent_knowledge_links"}get typedDb(){return this.db}async distill(e,t,i,s,n=[],a={},o="assistant"){let l=this.bloomHash(`${e}:${t}`);if(this.bloomFilter.has(l)){console.log(`[KnowledgeDistiller] Bloom filter hit for ${e}. Skipping redundant distillation.`);let c=await this.db.selectFrom(this.knowledgeTable).select(["id","status"]).where("entity","=",e).where("fact","=",t).executeTakeFirst();if(c&&c.status==="verified"&&o!=="user")return(await this.getKnowledgeByEntity(e)).find(d=>d.fact===t)}return this.bloomFilter.add(l),this.bloomFilter.size>1e3&&this.bloomFilter.clear(),await this.db.transaction().execute(async c=>{let d=await c.selectFrom(this.knowledgeTable).selectAll().where("entity","=",e).where("fact","=",t).executeTakeFirst();if(d){let f=d.tags?JSON.parse(d.tags):[],w=Array.from(new Set([...f,...n])),b=d.metadata?JSON.parse(d.metadata):{},v=new Set(b.sessions||[]);s&&v.add(s);let S={...b,...a,sessions:Array.from(v),session_count:v.size},y=o==="user"?.2:.05,_=Math.min(1,d.confidence+y),E=d.status||"proposed";(o==="user"||S.session_count>=3)&&(E="verified");let D=await c.updateTable(this.knowledgeTable).set({confidence:_,status:E,tags:JSON.stringify(w),metadata:JSON.stringify(S),updated_at:new Date,source_session_id:s??d.source_session_id}).where("id","=",d.id).returningAll().executeTakeFirstOrThrow();return this.parseKnowledge(D)}await this.challengeKnowledge(e,t,i,c);let p={...a,source:o,sessions:s?[s]:[],session_count:s?1:0},m=await c.insertInto(this.knowledgeTable).values({entity:e,fact:t,confidence:o==="user"?Math.max(i,.8):i,status:o==="user"?"verified":"proposed",source_session_id:s??null,tags:JSON.stringify(n),metadata:JSON.stringify(p),created_at:new Date,updated_at:new Date}).returningAll().executeTakeFirstOrThrow(),h=this.parseKnowledge(m);return await this.autoLinkKnowledge(h,c),h})}async verifyKnowledge(e,t=.1){let i=await this.typedDb.selectFrom(this.knowledgeTable).selectAll().where("id","=",e).executeTakeFirst();if(!i)return null;let s=typeof i.metadata=="string"?JSON.parse(i.metadata):i.metadata||{},n=1;s.source!=="user"&&(s.session_count||0)<3&&(n=.85,console.log(`[KnowledgeDistiller] Confidence capped at 0.85 for item ${e} (Need 3+ sessions for total trust)`));let a=Math.min(n,i.confidence+t),o=i.status||"proposed";(a>=.9||s.session_count>=3)&&(o="verified");let l=await this.db.updateTable(this.knowledgeTable).set({confidence:a,status:o,updated_at:new Date}).where("id","=",e).returningAll().executeTakeFirstOrThrow();return this.parseKnowledge(l)}async getKnowledgeByEntity(e,t){let n=(await this.db.selectFrom(this.knowledgeTable).selectAll().where("entity","=",e).orderBy("confidence","desc").execute()).map(o=>this.parseKnowledge(o)),a=n;t&&t.length>0&&(a=n.filter(o=>o.tags?.some(l=>t.includes(l))));for(let o of a)this.recordHit(o.id).catch(l=>console.error(`[KnowledgeDistiller] Failed to record hit for ${o.id}:`,l));return a}async recordHit(e){await this.db.transaction().execute(async t=>{let i=await t.selectFrom(this.knowledgeTable).selectAll().where("id","=",e).forUpdate().executeTakeFirst();if(!i)return;let s=typeof i.metadata=="string"?JSON.parse(i.metadata):i.metadata||{};s.hit_count=(s.hit_count||0)+1,s.last_retrieved_at=new Date().toISOString(),await t.updateTable(this.knowledgeTable).set({metadata:JSON.stringify(s),updated_at:new Date}).where("id","=",e).execute(),await t.insertInto(this.config.metricsTable||"agent_metrics").values({metric_name:`entity_hit_${i.entity}`,metric_value:1,created_at:new Date}).execute()})}calculateFitness(e){let t=e.metadata||{},i=t.hit_count||0,s=new Date(e.createdAt).getTime(),n=Math.max(1,(Date.now()-s)/(1e3*60*60*24)),a=Math.min(1,i/n),o=t.source==="user"?1:.7;return e.confidence*.4+a*.4+o*.2}async challengeKnowledge(e,t,i,s=this.db){let n=t.slice(0,500).replace(/[\u0000-\u001F\u007F-\u009F]/g,"").replace(/<\|.*?\|>/g,""),o=await s.selectFrom(this.knowledgeTable).selectAll().where("entity","=",e).orderBy("confidence","desc").execute();for(let l of o){let c=this.parseKnowledge(l);if(c.fact!==t&&i>.8){let d={...c.metadata},p=.2,m=c.status;c.confidence>.7?(m="disputed",d={...d,status_reason:`Contradicted by: ${n}`},p=.1):(m="deprecated",d={...d,status_reason:`Superseded by: ${n}`},p=.4);let h=Math.max(0,c.confidence-p);await s.updateTable(this.knowledgeTable).set({confidence:h,status:m,metadata:JSON.stringify(d),updated_at:new Date}).where("id","=",c.id).execute()}}}async autoLinkKnowledge(e,t){let i=e.fact.match(/([A-Z][a-z]+(?:\s[A-Z][a-z]+)*)|("[^"]+")|([a-z]+[A-Z][a-z]+)/g)||[],s=Array.from(new Set(i.map(o=>o.replace(/"/g,"").trim()))).filter(o=>o.length>2&&o!==e.entity);if(s.length>0){let o=await t.selectFrom(this.knowledgeTable).select(["id","entity"]).where("entity","in",s).execute();for(let l of o)await this.linkKnowledge(e.id,l.id,"mentions",{auto:!0,source:"structural_extraction"},t)}let n=await t.selectFrom(this.knowledgeTable).selectAll().where("id","!=",e.id).where("confidence",">",.4).orderBy("updated_at","desc").limit(50).execute(),a=[];for(let o of n){let l=this.parseKnowledge(o),c=Yi(e.fact,l.fact);c>.75&&a.push({targetId:l.id,sim:c})}for(let o of a)await this.linkKnowledge(e.id,o.targetId,"semantically_related",{similarity:o.sim,version:"2.0"},t)}async linkKnowledge(e,t,i,s,n=this.db){if(e===t)return;let a=await n.selectFrom(this.linksTable).select("id").where("source_id","=",e).where("target_id","=",t).where("relationship","=",i).executeTakeFirst();a?await n.updateTable(this.linksTable).set({metadata:s?JSON.stringify(s):null}).where("id","=",a.id).execute():await n.insertInto(this.linksTable).values({source_id:e,target_id:t,relationship:i,metadata:s?JSON.stringify(s):null,created_at:new Date}).execute()}async getKnowledgeGraph(e){let t=await this.db.selectFrom(this.knowledgeTable).selectAll().where("id","=",e).executeTakeFirst();if(!t)throw new Error(`Entity with ID ${e} not found`);let i=await this.db.selectFrom(this.linksTable).innerJoin(`${this.knowledgeTable} as target`,"target.id",`${this.linksTable}.target_id`).selectAll("target").select(`${this.linksTable}.relationship as link_rel`).where(`${this.linksTable}.source_id`,"=",e).execute();return{item:this.parseKnowledge(t),relations:i.map(s=>({relationship:s.link_rel,target:this.parseKnowledge(s)}))}}async pruneLowConfidence(e=.2){let t=await this.db.deleteFrom(this.knowledgeTable).where("confidence","<",e).executeTakeFirst();return Number(t.numDeletedRows)}async consolidateKnowledge(){let e=0,t=await this.db.selectFrom(this.knowledgeTable).select("entity").groupBy("entity").having(i=>i.fn.count("id"),">",1).limit(500).execute();for(let i of t){let s=i.entity,n=await this.getKnowledgeByEntity(s),a=new Set,o=Math.min(n.length,100);for(let l=0;l<o;l++)if(!a.has(n[l].id))for(let c=l+1;c<o;c++){if(a.has(n[c].id))continue;Yi(n[l].fact,n[c].fact)>.85&&(await this.mergeItems(n[l],n[c]),a.add(n[c].id),e++)}}return e}async mergeItems(e,t){let i={...t.metadata,...e.metadata,consolidated_from:t.id,consolidated_at:new Date().toISOString()},s=Array.from(new Set([...e.tags||[],...t.tags||[]]));await this.db.transaction().execute(async n=>{await n.updateTable(this.knowledgeTable).set({confidence:Math.max(e.confidence,t.confidence),metadata:JSON.stringify(i),tags:JSON.stringify(s),updated_at:new Date}).where("id","=",e.id).execute(),await n.deleteFrom(this.knowledgeTable).where("id","=",t.id).execute()})}bloomHash(e){let t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return t}parseKnowledge(e){return{id:e.id,entity:e.entity,fact:e.fact,confidence:e.confidence,status:e.status||"proposed",sourceSessionId:e.source_session_id,tags:typeof e.tags=="string"?JSON.parse(e.tags):e.tags||[],metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var T1,A3=g(()=>{"use strict";T1=class{db;config;telemetry;actionsTable;constructor(e,t={},i){this.db=e,this.config=t,this.telemetry=i,this.actionsTable=t.actionsTable||"agent_actions"}get typedDb(){return this.db}async logAction(e,t,i,s){let n=await this.typedDb.insertInto(this.actionsTable).values({session_id:e,message_id:s||null,tool_name:t,arguments:JSON.stringify(i),status:"pending",created_at:new Date}).returningAll().executeTakeFirstOrThrow(),a=this.parseAction(n);return this.telemetry&&await this.telemetry.track(e,"action",`Tool call: ${t}`,{actionId:n.id,arguments:i}),a}async recordOutcome(e,t,i,s,n){let a=await this.typedDb.updateTable(this.actionsTable).set({status:t,outcome:i,duration_ms:s||null,metadata:n?JSON.stringify(n):null}).where("id","=",e).returningAll().executeTakeFirstOrThrow(),o=this.parseAction(a);return this.telemetry&&t==="failure"&&await this.telemetry.track(o.sessionId,"error",`Action failed: ${i}`,{actionId:e,status:t}),o}async getSessionActions(e,t={}){let{limit:i=100,cursor:s}=t,n=this.typedDb.selectFrom(this.actionsTable).selectAll().where("session_id","=",e).orderBy("id","asc").limit(i);return s&&(n=n.where("id",">",s)),(await n.execute()).map(o=>this.parseAction(o))}async getActionsByTool(e,t=50){return(await this.typedDb.selectFrom(this.actionsTable).selectAll().where("tool_name","=",e).orderBy("created_at","desc").limit(t).execute()).map(s=>this.parseAction(s))}async getFailureReport(){let e=new Date(Date.now()-6048e5);return(await this.typedDb.selectFrom(this.actionsTable).select(["tool_name",i=>i.fn.count("id").as("failureCount"),i=>i.fn.max("created_at").as("lastFailure")]).where("status","=","failure").where("created_at",">",e).groupBy("tool_name").orderBy(i=>i.fn.count("id"),"desc").execute()).map(i=>({toolName:i.tool_name,failureCount:Number(i.failureCount),lastFailure:i.lastFailure}))}parseAction(e){return{id:e.id,sessionId:e.session_id,messageId:e.message_id,toolName:e.tool_name,arguments:typeof e.arguments=="string"?JSON.parse(e.arguments):e.arguments||{},status:e.status,outcome:e.outcome,durationMs:e.duration_ms,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at)}}}});var _1,R3=g(()=>{"use strict";_1=class{db;config;resourcesTable;constructor(e,t={}){this.db=e,this.config=t,this.resourcesTable=t.resourcesTable||"agent_resource_usage"}get typedDb(){return this.db}async recordUsage(e,t,i,s,n,a,o){let l=await this.typedDb.insertInto(this.resourcesTable).values({session_id:e,agent_id:a||null,model_name:t,input_tokens:i,output_tokens:s,cost:n||0,currency:"USD",metadata:o?JSON.stringify(o):null,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseUsage(l)}async validateQuota(e,t,i=2e3){let s=0,n=this.config.cortex?.quotas;if(n){let l=await n.getExchangeRate("USD");s=i*(l*1e-5)}else s=i*2e-5;let a=await this.config.cortex?.quotas.checkQuota("persona",e);if(a&&!a.allowed)return a;if(t){let l=await this.config.cortex?.quotas.checkQuota("swarm",t);if(l&&!l.allowed)return l}let o=await this.config.cortex?.quotas.checkQuota("global");return o&&!o.allowed?o:{allowed:!0}}async getSessionTotalCost(e){let t=await this.typedDb.selectFrom(this.resourcesTable).select(i=>i.fn.sum("cost").as("totalCost")).where("session_id","=",e).executeTakeFirst();return Number(t?.totalCost||0)}async getGlobalTotalCost(){let e=await this.typedDb.selectFrom(this.resourcesTable).select(t=>t.fn.sum("cost").as("totalCost")).executeTakeFirst();return Number(e?.totalCost||0)}async getModelUsageStats(){return(await this.typedDb.selectFrom(this.resourcesTable).select(["model_name",t=>t.fn.sum(t("input_tokens","+","output_tokens")).as("totalTokens"),t=>t.fn.sum("cost").as("totalCost")]).groupBy("model_name").execute()).map(t=>({modelName:t.model_name,totalTokens:Number(t.totalTokens),totalCost:Number(t.totalCost)}))}parseUsage(e){return{id:e.id,sessionId:e.session_id,agentId:e.agent_id,modelName:e.model_name,inputTokens:e.input_tokens,outputTokens:e.output_tokens,cost:e.cost,currency:e.currency,createdAt:new Date(e.created_at)}}}});var E1,M3=g(()=>{"use strict";E1=class{db;config;episodesTable;constructor(e,t={}){this.db=e,this.config=t,this.episodesTable=t.episodesTable||"agent_episodes"}get typedDb(){return this.db}async startEpisode(e,t,i){let s=await this.typedDb.insertInto(this.episodesTable).values({session_id:e,name:t,status:"active",start_time:new Date,metadata:i?JSON.stringify(i):null}).returningAll().executeTakeFirstOrThrow();return this.parseEpisode(s)}async completeEpisode(e,t,i){return await this.db.transaction().execute(async s=>{let n=await s.selectFrom(this.episodesTable).selectAll().where("id","=",e).forUpdate().executeTakeFirst();if(!n)throw new Error(`Episode with ID ${e} not found`);let o={...typeof n.metadata=="string"?JSON.parse(n.metadata):n.metadata||{},...i},l=await s.updateTable(this.episodesTable).set({status:"completed",summary:t,end_time:new Date,metadata:JSON.stringify(o)}).where("id","=",e).returningAll().executeTakeFirstOrThrow();return this.parseEpisode(l)})}async getSessionEpisodes(e,t={}){let{limit:i=100,offset:s=0}=t;return(await this.typedDb.selectFrom(this.episodesTable).selectAll().where("session_id","=",e).orderBy("start_time","desc").limit(i).offset(s).execute()).map(a=>this.parseEpisode(a))}async getRecentEpisodes(e=10){return(await this.typedDb.selectFrom(this.episodesTable).selectAll().where("status","=","completed").orderBy("end_time","desc").limit(e).execute()).map(i=>this.parseEpisode(i))}parseEpisode(e){return{id:e.id,sessionId:e.session_id,name:e.name,summary:e.summary||void 0,status:e.status,startTime:new Date(e.start_time),endTime:e.end_time?new Date(e.end_time):void 0,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{}}}}});var N1,k3=g(()=>{"use strict";N1=class{db;cortex;config;capabilitiesTable;evolutionConfig;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.capabilitiesTable=i.capabilitiesTable||"agent_capabilities",this.evolutionConfig={verificationWindow:i.evolution?.verificationWindow??20,rollbackThresholdZ:i.evolution?.rollbackThresholdZ??2.5,enableHiveLink:i.evolution?.enableHiveLink??!0,mutationAggressiveness:i.evolution?.mutationAggressiveness??.5,maxSandboxSkills:i.evolution?.maxSandboxSkills??5}}get typedDb(){return this.db}async registerCapability(e,t,i,s={}){return await this.db.transaction().execute(async n=>{let a=await n.selectFrom(this.capabilitiesTable).selectAll().where("name","=",e).where("version","=",t).executeTakeFirst();if(a){let l=await n.updateTable(this.capabilitiesTable).set({description:i||a.description,status:a.status||"experimental",metadata:JSON.stringify({...JSON.parse(a.metadata||"{}"),...s}),updated_at:new Date}).where("id","=",a.id).returningAll().executeTakeFirstOrThrow();return this.parseCapability(l)}let o=await n.insertInto(this.capabilitiesTable).values({name:e,version:t,description:i||null,status:s.initialStatus||"experimental",reliability:1,metadata:JSON.stringify({...s,successCount:0,totalCount:0}),created_at:new Date,updated_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseCapability(o)})}async reportOutcome(e,t){await this.db.transaction().execute(async i=>{let s=i.selectFrom(this.capabilitiesTable).selectAll().where("name","=",e).orderBy("updated_at","desc");this.db.getExecutor().adapter?.constructor.name!=="SqliteAdapter"&&(s=s.forUpdate());let n=await s.executeTakeFirst();if(n){let a=n,o=typeof a.metadata=="string"?JSON.parse(a.metadata):a.metadata||{},l=(o.totalCount||0)+1,c=(o.successCount||0)+(t?1:0),d=a.reliability,p=.2,m=t?Math.min(1,d*(1-p)+p):Math.max(0,d*(1-p)),h=((o.anchored_reliability||1)*l+(t?1:0))/(l+1),f=a.status||"experimental",w=(o.successStreak||0)+(t?1:0),b=t?0:(o.failureStreak||0)+1,v=t?w:0,S=c/l,y=this.evolutionConfig.verificationWindow||20,_=Math.ceil(y*.75),E=l>=_&&S>=.8||v>=5,D=!t&&b>=3&&l<=5,X=Math.ceil(_*.8);(l>=X&&S>=.8||v===4)&&f==="experimental"&&this.cortex.skillSynthesizer&&this.cortex.skillSynthesizer.preWarmSkill(e).catch(()=>{});let M=.05,F=o.performanceBaseline??S,U=F*(1-M)+S*M,pe=o.performanceVariance??.01,j=S-F,N=pe*(1-M)+Math.pow(j,2)*M,A=Math.sqrt(N),q=A>0?(S-F)/A:0;D&&(f==="experimental"||f==="sandbox")?(console.error(`[CapabilityManager] Skill '${e}' FAILED early-exit safety check (Streak: ${b}). Blacklisting immediately.`),f="blacklisted"):E&&(f==="experimental"||f==="sandbox")?(console.log(`[CapabilityManager] Skill '${e}' PASSED fast-track verification (Streak: ${v}, Rate: ${(S*100).toFixed(1)}%). Promoting to Verified.`),f="verified"):l>=_&&(S<.4?(console.log(`[CapabilityManager] Skill '${e}' FAILED statistical verification (Rate: ${(S*100).toFixed(1)}%). Blacklisting.`),f="blacklisted"):f==="verified"&&q<-2&&(console.warn(`[CapabilityManager] Verified skill '${e}' PERFORMANCE COLLAPSE (Z: ${q.toFixed(2)}, Rate: ${(S*100).toFixed(1)}%). Demoting to Experimental.`),f="experimental")),f!==a.status&&console.log(`[CapabilityManager] EVOLVING STATUS: ${e} (${a.status} -> ${f})`),await i.updateTable(this.capabilitiesTable).set({reliability:m,status:f,metadata:JSON.stringify({...o,totalCount:l,successCount:c,successStreak:v,failureStreak:b,performanceBaseline:U,performanceVariance:N,anchored_reliability:h,lastOutcomeType:t?"success":"failure"}),updated_at:new Date}).where("id","=",a.id).execute()}})}async getReliability(e){let t=await this.typedDb.selectFrom(this.capabilitiesTable).select("reliability").where("name","=",e).orderBy("updated_at","desc").executeTakeFirst();return t?t.reliability:0}async getCapabilities(e){let t=this.typedDb.selectFrom(this.capabilitiesTable).selectAll();e&&(t=t.where("status","=",e));let i=await t.orderBy("name","asc").orderBy("reliability","desc").limit(1e3).execute(),s=new Map;for(let n of i){let a=typeof n.metadata=="string"?JSON.parse(n.metadata):n.metadata||{};(!s.has(n.name)||a.is_alpha)&&s.set(n.name,n)}return Array.from(s.values()).map(n=>this.parseCapability(n))}async validateCapabilityAccess(e,t){let i=await this.cortex.personas.getPersona(String(e))||await this.typedDb.selectFrom(this.config.personasTable||"agent_personas").selectAll().where("id","=",e).executeTakeFirst().then(n=>n?this.cortex.personas.parsePersona(n):null);if(!i)return{allowed:!1,reason:`Persona ${e} not found.`};if(i.metadata?.status==="quarantined")return{allowed:!1,reason:`Persona ${e} is currently quarantined due to safety violations.`};let s=await this.typedDb.selectFrom(this.capabilitiesTable).select(["status","reliability"]).where("name","=",t).orderBy("reliability","desc").executeTakeFirst();return s&&s.status==="blacklisted"?{allowed:!1,reason:`Capability '${t}' is globally blacklisted.`}:i.capabilities&&i.capabilities.length>0&&!(i.capabilities.includes(t)||i.capabilities.includes("*"))?{allowed:!1,reason:`Persona '${i.name}' does not have permission to use capability '${t}'.`}:s&&s.status==="experimental"&&(i.capabilities||[]).filter(a=>a.startsWith("experimental_")).length>=(this.evolutionConfig.maxSandboxSkills||5)?{allowed:!1,reason:`Persona '${i.name}' has reached the maximum number of experimental sandbox skills.`}:{allowed:!0}}parseCapability(e){return{id:e.id,name:e.name,version:e.version,description:e.description,status:e.status||"experimental",reliability:e.reliability,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var C1,I3=g(()=>{"use strict";C1=class{db;config;policiesTable;metricsTable;metricCache=new Map;constructor(e,t={}){this.db=e,this.config=t,this.policiesTable=t.policiesTable||"agent_policies",this.metricsTable=t.metricsTable||"agent_metrics"}get typedDb(){return this.db}async definePolicy(e,t,i,s=!0){return await this.db.transaction().execute(async n=>{let a=n.selectFrom(this.policiesTable).select("id").where("name","=",e);this.db.getExecutor().adapter?.constructor.name!=="SqliteAdapter"&&(a=a.forUpdate());let o=await a.executeTakeFirst();if(o){let c=await n.updateTable(this.policiesTable).set({type:t,definition:JSON.stringify(i),is_enabled:s,updated_at:new Date}).where("id","=",o.id).returningAll().executeTakeFirstOrThrow();return this.parsePolicy(c)}let l=await n.insertInto(this.policiesTable).values({name:e,type:t,definition:JSON.stringify(i),is_enabled:s,created_at:new Date,updated_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parsePolicy(l)})}async checkPolicy(e,t,i=new Set){if(i.has(e))return{allowed:!1,reason:`Circular policy dependency detected: ${Array.from(i).join(" -> ")} -> ${e}`};i.add(e);let s=await this.typedDb.selectFrom(this.policiesTable).selectAll().where("name","=",e).where("is_enabled","=",!0).executeTakeFirst();if(!s)return{allowed:!0};let n=JSON.parse(s.definition);if(typeof t=="number"){if(n.max!==void 0&&t>n.max)return{allowed:!1,reason:`Value ${t} exceeds max ${n.max} for policy '${e}'`};if(n.min!==void 0&&t<n.min)return{allowed:!1,reason:`Value ${t} below min ${n.min} for policy '${e}'`}}if(typeof t=="string"&&n.pattern){if(n.pattern.length>500)return{allowed:!1,reason:`Policy '${e}' regex pattern too long (potential ReDoS risk)`};if(/(\*|\+)\1|\(\.\*\)\*/.test(n.pattern))return{allowed:!1,reason:`Policy '${e}' contains potentially dangerous ReDoS pattern`};let o=n.flags||"i";try{let l=new RegExp(n.pattern,o);if(n.mustMatch&&!l.test(t))return{allowed:!1,reason:`Value does not match required pattern for policy '${e}'`};if(!n.mustMatch&&l.test(t))return{allowed:!1,reason:`Value contains forbidden pattern for policy '${e}'`}}catch(l){return{allowed:!1,reason:`Invalid regex in policy '${e}': ${String(l)}`}}}if(s.type==="budget"&&n.metricName){let a=n.period||"daily",o=n.limit||0,l=await this.getCumulativeMetric(n.metricName,a);if(l+(typeof t=="number"?t:0)>o)return{allowed:!1,reason:`Cumulative budget for '${n.metricName}' exceeded (${l.toFixed(4)} / ${o})`}}if(n.dependsOn&&Array.isArray(n.dependsOn))for(let a of n.dependsOn){let o=await this.checkPolicy(a,t,new Set(i));if(!o.allowed)return{allowed:!1,reason:`Composite block: ${e} -> ${o.reason}`}}return{allowed:!0}}async evaluateContext(e){let t=await this.getActivePolicies(),i=[];for(let s of t){if(e[s.name]!==void 0){let n=await this.checkPolicy(s.name,e[s.name]);n.allowed||i.push(n.reason)}if(s.type==="privacy"&&e.content){let n=await this.checkPolicy(s.name,e.content);n.allowed||i.push(n.reason)}}return{allowed:i.length===0,violations:i}}async getActivePolicies(){return(await this.typedDb.selectFrom(this.policiesTable).selectAll().where("is_enabled","=",!0).execute()).map(t=>this.parsePolicy(t))}async getCumulativeMetric(e,t){let i=`${e}:${t}`,s=this.metricCache.get(i),n=new Date,a=this.config.policyCacheTTL||6e4;if(s&&n.getTime()-s.timestamp<a)return s.value;if(this.metricCache.size>1e3){let d=this.metricCache.keys().next().value;d!==void 0&&this.metricCache.delete(d)}let o=new Date(0);t==="daily"?o=new Date(n.getFullYear(),n.getMonth(),n.getDate()):t==="hourly"&&(o=new Date(n.getTime()-36e5));let l=await this.typedDb.selectFrom(this.metricsTable).select(d=>d.fn.sum("metric_value").as("total")).where("metric_name","=",e).where("created_at",">=",o).executeTakeFirst(),c=Number(l?.total||0);return this.metricCache.set(i,{value:c,timestamp:n.getTime()}),c}parsePolicy(e){return{id:e.id,name:e.name,type:e.type,definition:typeof e.definition=="string"?JSON.parse(e.definition):e.definition,isEnabled:!!e.is_enabled,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var A1,P3=g(()=>{"use strict";A1=class{db;config;epochsTable;constructor(e,t={}){this.db=e,this.config=t,this.epochsTable=t.epochsTable||"agent_epochs"}async compress(e,t,i,s,n=[],a){console.log(`[SessionCompressor] Compressing session ${e} with ${n.length} semantic anchors.`);let o=await this.db.insertInto(this.epochsTable).values({session_id:e,summary:t,start_message_id:i,end_message_id:s,metadata:a||n.length>0?JSON.stringify({...a,anchors:n}):null,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseEpoch(o)}async semanticPruning(e,t=!0){console.log(`[SessionCompressor] Performing semantic pruning for session ${e}...`);let i=this.config.messagesTable||"agent_messages",s=this.db.deleteFrom(i).where("session_id","=",e);t&&(s=s.where(o=>o.or([o("metadata","is",null),o.and([o("metadata","not like",'%"anchor":true%'),o("metadata","not like",'%"anchor": true%')])])));let n=await s.execute(),a=Number(n[0]?.numDeletedRows||0);return await this.consolidateEpochsIntoEra(e),console.log(`[SessionCompressor] Pruned ${a} non-anchor messages from session ${e}`),a}async consolidateEpochsIntoEra(e){let t=await this.getEpochs(e);if(t.length>10){console.log(`[SessionCompressor] Consolidating ${t.length} epochs into a new Era for session ${e}`);let i=`Consolidated era summary of ${t.length} epochs: `+t.slice(0,5).map(l=>l.summary).join("; ")+"...",s={type:"era",original_epochs:t.length,consolidated_at:new Date().toISOString()},n=await this.compress(e,i,t[0].startMessageId,t[t.length-1].endMessageId,[],s),a=this.config.messagesTable||"agent_messages";await this.db.insertInto(a).values({session_id:e,role:"system",content:`[ERA SUMMARY] This era covers the initial phases of the session. Key takeaways: ${i}`,metadata:JSON.stringify({anchor:!0,type:"era_reification",epoch_id:n.id}),created_at:new Date}).execute();let o=t.map(l=>l.id);await this.db.deleteFrom(this.epochsTable).where("id","in",o).execute()}}async getEpochs(e){return(await this.db.selectFrom(this.epochsTable).selectAll().where("session_id","=",e).orderBy("created_at","asc").execute()).map(i=>this.parseEpoch(i))}parseEpoch(e){return{...e,sessionId:e.session_id,startMessageId:e.start_message_id,endMessageId:e.end_message_id,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata,createdAt:new Date(e.created_at)}}}});var R1,O3=g(()=>{"use strict";R1=class{db;config;personasTable;constructor(e,t={}){this.db=e,this.config=t,this.personasTable=t.personasTable||"agent_personas"}get typedDb(){return this.db}async upsertPersona(e,t={}){return await this.db.transaction().execute(async i=>{let s=i.selectFrom(this.personasTable).selectAll().where("name","=",e);this.db.getExecutor().adapter?.constructor.name!=="SqliteAdapter"&&(s=s.forUpdate());let n=await s.executeTakeFirst(),a={name:e,role:t.role||null,capabilities:t.capabilities?JSON.stringify(t.capabilities):null,policies:t.policies?JSON.stringify(t.policies):null,metadata:t.metadata?JSON.stringify(t.metadata):null,updated_at:new Date};if(n){let l=await i.updateTable(this.personasTable).set(a).where("id","=",n.id).returningAll().executeTakeFirstOrThrow();return this.parsePersona(l)}let o=await i.insertInto(this.personasTable).values({...a,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parsePersona(o)})}async getPersona(e){let t=await this.typedDb.selectFrom(this.personasTable).selectAll().where("name","=",e).executeTakeFirst();return t?this.parsePersona(t):null}async deletePersona(e){let t=await this.typedDb.deleteFrom(this.personasTable).where("name","=",e).executeTakeFirst();return Number(t.numDeletedRows||0)>0}async listPersonas(){return(await this.typedDb.selectFrom(this.personasTable).selectAll().orderBy("name","asc").execute()).map(t=>this.parsePersona(t))}parsePersona(e){return{id:e.id,name:e.name,role:e.role||void 0,capabilities:typeof e.capabilities=="string"?JSON.parse(e.capabilities):e.capabilities||[],policies:typeof e.policies=="string"?JSON.parse(e.policies):e.policies||[],metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var M1,D3=g(()=>{"use strict";M1=class{db;config;metricsTable;constructor(e,t={}){this.db=e,this.config=t,this.metricsTable=t.metricsTable||"agent_metrics"}get typedDb(){return this.db}async recordMetric(e,t,i={}){let s=await this.db.insertInto(this.metricsTable).values({session_id:i.sessionId??null,agent_id:i.agentId??null,metric_name:e,metric_value:t,unit:i.unit??null,metadata:i.metadata?JSON.stringify(i.metadata):null,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseMetric(s)}async getAverageMetric(e){let t=await this.typedDb.selectFrom(this.metricsTable).select(i=>i.fn.avg("metric_value").as("avgValue")).where("metric_name","=",e).executeTakeFirst();return Number(t?.avgValue||0)}async getMetricStats(e,t={}){let i=this.typedDb.selectFrom(this.metricsTable).select(n=>[n.fn.min("metric_value").as("min"),n.fn.max("metric_value").as("max"),n.fn.avg("metric_value").as("avg"),n.fn.count("id").as("count")]).where("metric_name","=",e);t.agentId&&(i=i.where("agent_id","=",t.agentId)),t.sessionId&&(i=i.where("session_id","=",t.sessionId));let s=await i.executeTakeFirst();return{min:Number(s?.min||0),max:Number(s?.max||0),avg:Number(s?.avg||0),count:Number(s?.count||0)}}async getRecentMetrics(e=50){return(await this.typedDb.selectFrom(this.metricsTable).selectAll().orderBy("created_at","desc").limit(e).execute()).map(i=>this.parseMetric(i))}async getMetricsByAgent(e,t=50){return(await this.typedDb.selectFrom(this.metricsTable).selectAll().where("agent_id","=",e).orderBy("created_at","desc").limit(t).execute()).map(s=>this.parseMetric(s))}async getMetricsBySession(e,t=50){return(await this.typedDb.selectFrom(this.metricsTable).selectAll().where("session_id","=",e).orderBy("created_at","desc").limit(t).execute()).map(s=>this.parseMetric(s))}parseMetric(e){return{id:e.id,sessionId:e.session_id,agentId:e.agent_id,metricName:e.metric_name,metricValue:e.metric_value,unit:e.unit,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at)}}}});var pl,k1=g(()=>{"use strict";at();kn();pl=class{db;constructor(e){this.db=e}async getStructuralOverview(){let t=await this.db.introspection.getTables(),i=`Current Database Schema Overview:
272
-
273
- `;for(let s of t){if(i+=`Table: ${s.name}
274
- `,s.columns)for(let n of s.columns)i+=` - ${n.name} (${n.type}${n.nullable?"?":""})
275
- `;i+=`
276
- `}return i}suggestCreateTable(e,t){He(e,"table name");let i=`await db.schema.createTable('${e}')
277
- `;for(let s of t)He(s.name,"column name"),i+=` .addColumn('${s.name}', '${s.type}')
278
- `;return i+=" .execute()",i}suggestAddColumn(e,t,i){return He(e,"table name"),He(t,"column name"),`await db.schema.alterTable('${e}').addColumn('${t}', '${i}').execute()`}async applySuggestion(e){let t=e.trim().replace(/\s+/g," "),i=t.toUpperCase();if(![/^CREATE TABLE/i,/^CREATE (?:UNIQUE )?INDEX/i,/^ALTER TABLE/i,/^DROP INDEX/i].some(l=>l.test(t)))throw new Error(`DDL operation not allowed autonomously: ${e}`);let a=t.match(/[a-zA-Z_][a-zA-Z0-9_]*/g)||[];for(let l of a){let c=l.toUpperCase();if(!["CREATE","TABLE","ALTER","ADD","COLUMN","INDEX","UNIQUE","ON","DROP","IF","EXISTS","NOT","NULL","PRIMARY","KEY","TIMESTAMP","TEXT","INTEGER","REAL","BOOLEAN","VARCHAR","REFERENCES","CASCADE","SET"].includes(c))try{He(l)}catch(d){["VARCHAR","TIMESTAMP","INT","TEXT"].some(p=>c.includes(p))||console.warn(`[SchemaEvolution] Identifier validation warning for "${l}":`,d)}}let o=t;t.includes("db.schema.")&&(o=this.normalizeKyselyToSql(t)),console.log(`[SchemaEvolution] Executing: ${o}`),await C.raw(o).execute(this.db)}normalizeKyselyToSql(e){let t=e.match(/alterTable\(['"](.*?)['"]\)\.addColumn\(['"](.*?)['"],\s*['"](.*?)['"]\)/);if(t)return`ALTER TABLE ${t[1]} ADD COLUMN ${t[2]} ${t[3]}`;let i=e.match(/createTable\(['"](.*?)['"]\)/);if(i){let s=i[1],n=[],a=e.matchAll(/\.addColumn\(['"](.*?)['"],\s*['"](.*?)['"](?:,.*?)?\)/g);for(let o of a)n.push(`${o[1]} ${o[2]}`);if(n.length>0)return`CREATE TABLE ${s} (${n.join(", ")})`}throw new Error(`Failed to normalize Kysely JS code to SQL: ${e}`)}}});var P1,Ax,I1,$3=g(()=>{"use strict";k1();m3();P1=k(require("fs/promises"),1),Ax=k(require("path"),1);at();I1=class{db;config;evolution;typeGenerator;snapshotsTable;constructor(e,t){this.db=e,this.config=t,this.evolution=new pl(e),this.typeGenerator=new nl(t.introspection),this.snapshotsTable=t.agentic?.metadata?.snapshotsTable||"agent_snapshots"}async ensureTelemetryColumns(){let e=[this.config.agentic?.sessionsTable||"agent_sessions",this.config.agentic?.messagesTable||"agent_messages",this.config.agentic?.memoriesTable||"agent_memories",this.config.agentic?.goalsTable||"agent_goals",this.config.agentic?.knowledgeTable||"agent_knowledge_base"];for(let t of e)try{let s=await this.db.introspection.getTables().then(n=>n.find(a=>a.name===t));s&&!s.columns.some(n=>n.name==="accessed_at")&&(console.log(`[SelfEvolution] Adding 'accessed_at' column to ${t}`),await C`ALTER TABLE ${C.table(t)} ADD COLUMN accessed_at TIMESTAMP`.execute(this.db))}catch(i){console.warn(`[SelfEvolution] Failed to add telemetry column to ${t}:`,i)}}async setupTelemetryTables(){let e=this.config.agentic?.telemetryEventsTable||"agent_telemetry_events",t=this.config.agentic?.sessionEvolutionTable||"agent_session_evolution",i=this.config.agentic?.researchMetricsTable||"agent_research_metrics";console.log("[SelfEvolution] Ensuring telemetry tables exist..."),await this.db.schema.createTable(e).ifNotExists().addColumn("id","integer",s=>s.primaryKey().autoIncrement()).addColumn("session_id","text",s=>s.notNull()).addColumn("type","text",s=>s.notNull()).addColumn("content","text",s=>s.notNull()).addColumn("metadata","text").addColumn("created_at","timestamp",s=>s.defaultTo(C`CURRENT_TIMESTAMP`)).execute(),await this.db.schema.createTable(t).ifNotExists().addColumn("id","integer",s=>s.primaryKey().autoIncrement()).addColumn("session_id","text",s=>s.notNull().unique()).addColumn("inferred_goal","text").addColumn("strategy","text").addColumn("evolution_path","text").addColumn("autonomy_level","integer").addColumn("status","text").addColumn("updated_at","timestamp",s=>s.defaultTo(C`CURRENT_TIMESTAMP`)).execute(),await this.db.schema.createTable(i).ifNotExists().addColumn("id","integer",s=>s.primaryKey().autoIncrement()).addColumn("session_id","text",s=>s.notNull()).addColumn("metric_name","text",s=>s.notNull()).addColumn("value","double precision",s=>s.notNull()).addColumn("metadata","text").addColumn("created_at","timestamp",s=>s.defaultTo(C`CURRENT_TIMESTAMP`)).execute()}async evolve(e,t={}){console.log(`[SelfEvolution] Applying structural change: ${e}`),await this.db.transaction().execute(async i=>{await i.execute(C.raw(e)),await i.insertInto(this.snapshotsTable).values({name:t.name||`auto_evolution_${Date.now()}`,dna:await this.getDNA(),metadata:JSON.stringify({...t.metadata,ddl:e,is_auto:!0,timestamp:Date.now()}),created_at:new Date}).execute()}),await this.regenerateTypes(),console.log("[SelfEvolution] Schema evolved successfully.")}async regenerateTypes(){let i={tables:(await this.db.introspection.getTables()).map(n=>({name:n.name,columns:n.columns||[],indexes:n.indexes||[],foreignKeys:n.foreignKeys||[]})),relationships:[]},s=this.typeGenerator.generateTypes(i);if(this.config.agentic?.metadata?.typesOutputPath){let n=this.config.agentic.metadata.typesOutputPath;console.log(`[SelfEvolution] Writing regenerated types to ${n}`),await P1.mkdir(Ax.dirname(n),{recursive:!0}),await P1.writeFile(n,s.interfaces+`
279
- `+s.types)}}async getDNA(){return this.evolution.getStructuralOverview()}async proactivelyOptimize(e){let t=e.toLowerCase();if(t.includes("slow")||t.includes("latency")){if(t.includes("metrics"))return await this.evolve("CREATE INDEX IF NOT EXISTS idx_metrics_fast_lookup ON agent_metrics(metric_name, created_at)"),!0;if(t.includes("search")||t.includes("memory"))return await this.evolve("CREATE INDEX IF NOT EXISTS idx_memories_session_time ON agent_memories(session_id, created_at)"),!0}return!1}async getEvolutionHistory(e=10){return(await this.db.selectFrom(this.snapshotsTable).selectAll().orderBy("created_at","desc").limit(e).execute()).map(i=>({...i,metadata:typeof i.metadata=="string"?JSON.parse(i.metadata):i.metadata,createdAt:new Date(i.createdAt)}))}async rollbackToSnapshot(e){console.log(`[SelfEvolution] Initiating structural rollback to: ${e}`);let t=await this.db.selectFrom(this.snapshotsTable).selectAll().where("name","=",e).executeTakeFirst();if(!t)throw new Error(`Snapshot ${e} not found.`);let i=typeof t.metadata=="string"?JSON.parse(t.metadata):t.metadata||{};if(i.ddl){let s=this.invertDDL(i.ddl);if(s)console.log(`[SelfEvolution] Applying inverse DDL: ${s}`),await C.raw(s).execute(this.db),await this.regenerateTypes(),console.log("[SelfEvolution] Rollback successful.");else throw new Error(`Could not automatically invert DDL: ${i.ddl}`)}else throw new Error(`Snapshot ${e} has no DDL metadata for automated inversion.`)}invertDDL(e){let t=e.trim().replace(/\s+/g," "),i=t.toUpperCase(),s=t.match(/CREATE TABLE\s+(?:IF NOT EXISTS\s+)?([^\s\()]+)/i);if(s)return`DROP TABLE IF EXISTS ${s[1]}`;let n=t.match(/CREATE\s+(?:UNIQUE\s+)?INDEX\s+(?:IF NOT EXISTS\s+)?([^\s\(]+)/i);if(n)return`DROP INDEX IF EXISTS ${n[1]}`;let a=t.match(/ALTER TABLE\s+([^\s]+)\s+ADD\s+(?:COLUMN\s+)?([^\s\(\)]+)\s+([^\s]+)/i);if(a)return`ALTER TABLE ${a[1]} DROP COLUMN ${a[2]}`;let o=t.match(/ALTER TABLE\s+([^\s]+)\s+DROP\s+(?:COLUMN\s+)?([^\s\(\)]+)/i);if(o)return`ALTER TABLE ${o[1]} ADD COLUMN ${o[2]} TEXT`;let l=t.match(/DROP TABLE\s+(?:IF EXISTS\s+)?([^\s]+)/i);if(l)return`CREATE TABLE ${l[1]} (id INTEGER PRIMARY KEY)`;let c=t.match(/DROP INDEX\s+(?:IF EXISTS\s+)?([^\s]+)/i);return c?`-- Cannot automatically invert DROP INDEX ${c[1]} without knowing its definition`:null}async publishToNPM(e="patch"){console.log(`[SelfEvolution] Initiating sovereign NPM publication (${e})...`);try{let{execSync:t}=await import("child_process");t(`npm version ${e} --no-git-tag-version`,{stdio:"inherit"}),await this.regenerateTypes(),console.log("[SelfEvolution] Sovereign publication sequence completed.")}catch(t){throw console.error("[SelfEvolution] Failed to publish to NPM:",t),new Error(`NPM Publication Failed: ${String(t)}`)}}}});var O1,F3=g(()=>{"use strict";at();O1=class{db;config;ritualsTable;knowledgeTable;metricsTable;sessionsTable;constructor(e,t={}){this.db=e,this.config=t,this.ritualsTable=t.ritualsTable||"agent_rituals",this.knowledgeTable=t.knowledgeTable||"agent_knowledge_base",this.metricsTable=t.metricsTable||"agent_metrics",this.sessionsTable=t.sessionsTable||"agent_sessions"}async runPruningRitual(e=.3){console.log(`[CortexJanitor] Starting pruning ritual (minConfidence: ${e})`);let t=await this.db.deleteFrom(this.knowledgeTable).where("confidence","<",e).executeTakeFirst(),i=Number(t.numDeletedRows||0);return await this.logRitual("pruning","success",{deletedCount:i}),i}async cleanOrphans(){let e=this.config.messagesTable||"agent_messages",t=await this.db.deleteFrom(e).where("session_id","not in",s=>s.selectFrom(this.sessionsTable).select("id")).executeTakeFirst(),i=Number(t.numDeletedRows||0);return i>0&&await this.logRitual("optimization","success",{action:"clean_orphans",deletedCount:i}),i}async archiveInactiveSessions(e=30){let t=new Date(Date.now()-e*24*36e5),i=await this.db.updateTable(this.sessionsTable).set({status:"archived",updated_at:new Date}).where("status","=","active").where("updated_at","<",t).executeTakeFirst(),s=Number(i.numUpdatedRows||0);return s>0&&await this.logRitual("optimization","success",{action:"archive_sessions",count:s}),s}async pruneMetrics(e=90){let t=new Date(Date.now()-e*24*36e5),i=await this.db.deleteFrom(this.metricsTable).where("created_at","<",t).executeTakeFirst(),s=Number(i.numDeletedRows||0);return s>0&&await this.logRitual("pruning","success",{action:"prune_metrics",count:s}),s}async autonomousIndexing(){console.log("[CortexJanitor] Analyzing query patterns for autonomous indexing...");let e=[],t=[{table:this.knowledgeTable,col:"entity"},{table:this.config.memoriesTable||"agent_memories",col:"entity"},{table:this.config.messagesTable||"agent_messages",col:"session_id"}];for(let n of t)try{let a=`idx_${n.table}_${n.col}_v2`;await C`CREATE INDEX IF NOT EXISTS ${C.raw(a)} ON ${C.table(n.table)}(${C.raw(n.col)})`.execute(this.db),e.push(`Standardized identity index: ${a}`)}catch(a){console.warn(`[CortexJanitor] Identity indexing failed for ${n.table}:`,a)}let i=await this.db.selectFrom(this.metricsTable).select("metadata").where("metric_name","=","query_latency").where("metric_value",">",300).limit(50).execute(),s=new Set;for(let n of i)try{let a=typeof n.metadata=="string"?JSON.parse(n.metadata):n.metadata||{};a.table&&s.add(a.table)}catch{}for(let n of s)if(n===this.knowledgeTable){let a=`idx_${n}_hotspot_lifecycle`;await C`CREATE INDEX IF NOT EXISTS ${C.raw(a)} ON ${C.table(n)}(status, confidence)`.execute(this.db),e.push(`Injected hotspot index for lifecycle: ${a}`)}return e.length>0&&await this.logRitual("optimization","success",{action:"autonomous_indexing",applied_count:e.length}),e}async optimizeDatabase(){console.log("[CortexJanitor] Running database-level optimizations...");let t=this.db.getExecutor().dialect?.constructor.name.toLowerCase()||"";t.includes("sqlite")?(await C`VACUUM`.execute(this.db),await C`PRAGMA optimize`.execute(this.db)):t.includes("postgres")&&await C`ANALYZE`.execute(this.db),await this.logRitual("optimization","success",{action:"db_maintenance"})}async logRitual(e,t,i){try{let s=new Date(Date.now()-6e5);if(await this.db.selectFrom(this.ritualsTable).select("id").where("name","=",`Automated ${e}`).where("type","=",e).where("last_run",">",s).executeTakeFirst())return;await this.db.insertInto(this.ritualsTable).values({name:`Automated ${e}`,type:e,status:t,last_run:new Date,metadata:i?JSON.stringify(i):null}).execute()}catch(s){console.error("[CortexJanitor] Failed to log ritual:",s)}}}});var D1,L3=g(()=>{"use strict";D1=class{db;config;goalsTable;conflictPairs=[["minimize","maximize"],["increase","decrease"],["low","high"],["fast","slow"],["short","long"],["start","stop"],["enable","disable"]];stopWords=new Set(["the","a","an","and","or","but","in","on","at","to","for","with","from"]);constructor(e,t={}){this.db=e,this.config=t,this.goalsTable=t.goalsTable||"agent_goals"}get typedDb(){return this.db}async analyzeGlobalProgress(e){return(await this.typedDb.selectFrom(this.goalsTable).selectAll().where("description","like",`%${e}%`).orderBy("created_at","desc").execute()).map(this.parseGoal)}async synthesizeLessons(){console.log("[RecursiveReasoner] Performing high-throughput weighted token clustering...");let e=this.config.reflectionsTable||"agent_reflections",i=(await this.typedDb.selectFrom(e).select("lessons_learned").where("lessons_learned","is not",null).execute()).map(l=>l.lessons_learned).filter(Boolean),s={},n=new Map,a=this.config.maxSynthesisItems||500,o=i.slice(0,a);for(let l of o)for(let c of this.tokenize(l))n.set(c,(n.get(c)||0)+1);for(let l of o){let c=this.tokenize(l);if(c.length===0)continue;let d=c.sort((p,m)=>{let h=p.length*(1/(n.get(p)||1));return m.length*(1/(n.get(m)||1))-h})[0]||"general";s[d]||(s[d]=[]),s[d].push(l)}return s}async crossPollinateGoals(){console.log("[RecursiveReasoner] Cross-pollinating successful persona breakthroughs into global goals...");let e=this.config.personasTable||"agent_personas",t=this.config.goalsTable||"agent_goals",s=(await this.typedDb.selectFrom(e).selectAll().where("metadata","like",'%"evolution_status":"stable"%').execute()).map(l=>{let c=JSON.parse(l.metadata||"{}"),d=c.mutation_reasoning||c.reasoning;return d?`Systemic Best-Practice: ${d}`:null}).filter(Boolean);if(s.length===0)return 0;let n=await this.typedDb.selectFrom(t).select("description").where("description","in",s).execute(),a=new Set(n.map(l=>l.description)),o=0;for(let l of s)a.has(l)||(console.log(`[RecursiveReasoner] Distilling breakthrough into Global Goal: ${l.slice(0,50)}...`),await this.typedDb.insertInto(t).values({session_id:0,description:l,status:"pending",priority:5,metadata:JSON.stringify({cross_pollinated:!0}),created_at:new Date,updated_at:new Date}).execute(),o++);return o}async detectContradictions(){console.log("[RecursiveReasoner] Detecting logical contradictions in systemic goals...");let e=await this.typedDb.selectFrom(this.goalsTable).selectAll().where("status","=","active").execute(),t=[],i=new Map;for(let s of e){let n=this.tokenize(s.description);for(let a of n)i.has(a)||i.set(a,[]),i.get(a).push({desc:s.description,keywords:new Set(n)})}for(let[s,n]of i.entries())if(!(n.length<2)){for(let a=0;a<n.length;a++){for(let o=a+1;o<n.length;o++){let l=this.checkConflict(n[a].desc,n[o].desc);if(l&&(t.push(`Goal Conflict: "${n[a].desc}" opposes "${n[o].desc}" regarding '${l}'`),t.length>50))break}if(t.length>50)break}if(t.length>50)break}return t}registerConflictPair(e,t){this.conflictPairs.push([e.toLowerCase(),t.toLowerCase()])}checkConflict(e,t){let i=e.toLowerCase(),s=t.toLowerCase();for(let[n,a]of this.conflictPairs)if(i.includes(n)&&s.includes(a)||i.includes(a)&&s.includes(n)){let o=this.intersect(this.tokenize(i),this.tokenize(s));return o.length>0?o.join(", "):`${n}/${a}`}return null}tokenize(e){return e.toLowerCase().split(/[\W_]+/).filter(t=>t.length>2&&!this.stopWords.has(t))}intersect(e,t){let i=new Set(t);return e.filter(s=>i.has(s))}parseGoal(e){return{id:e.id,sessionId:e.session_id,parentId:e.parent_id,description:e.description,status:e.status,priority:e.priority,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var $1,q3=g(()=>{"use strict";$1=class{db;config;rulesTable;constructor(e,t={}){this.db=e,this.config=t,this.rulesTable=t.rulesTable||"agent_rules"}get typedDb(){return this.db}async defineRule(e,t,i,s={},n){let a=async o=>{let l=await o.insertInto(this.rulesTable).values({table_name:e,operation:t,action:i,condition:s.condition||null,priority:s.priority||0,script:s.script||null,is_enabled:!0,metadata:s.metadata?JSON.stringify(s.metadata):null,created_at:new Date}).returningAll().executeTakeFirstOrThrow();return this.parseRule(l)};return n?await a(n):await this.db.transaction().execute(a)}async evaluateRules(e,t,i){let n=(await this.getActiveRules(e,t)).sort((a,o)=>o.priority-a.priority);for(let a of n)if(!a.condition||this.evaluateCondition(a.condition,i))return{action:a.action,ruleId:a.id,reason:`Matched rule ${a.id} (${a.action})`};return{action:"allow"}}applyMasking(e,t){if(t.action!=="mask")return e;let i={...e},s=t.metadata?.maskFields||[];for(let n of s)i[n]!==void 0&&(i[n]="*****");return i}async getActiveRules(e,t){return(await this.typedDb.selectFrom(this.rulesTable).selectAll().where("table_name","=",e).where(s=>s.or([s("operation","=",t),s("operation","=","all")])).where("is_enabled","=",!0).execute()).map(s=>this.parseRule(s))}evaluateCondition(e,t){let i=e.match(/([^\s]+)\s+(==|!=|>|<|includes)\s+(.+)/);if(!i)return!1;let[s,n,a,o]=i,l=t[n],c=o.replace(/['"]/g,"");switch(isNaN(Number(c))||(c=Number(c)),c==="true"&&(c=!0),c==="false"&&(c=!1),a){case"==":return l==c;case"!=":return l!=c;case">":return l>c;case"<":return l<c;case"includes":return String(l).includes(String(c));default:return!1}}parseRule(e){return{id:e.id,tableName:e.table_name,operation:e.operation,condition:e.condition,action:e.action,priority:e.priority,isEnabled:!!e.is_enabled,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at)}}}});var F1,B3=g(()=>{"use strict";F1=class{db;cortex;config;metricsTable;policiesTable;personasTable;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.metricsTable=i.metricsTable||"agent_metrics",this.policiesTable=i.policiesTable||"agent_policies",this.personasTable=i.personasTable||"agent_personas"}async performAudit(){let e=[];return await this.db.transaction().execute(async t=>{let i=await this.validateEmergentBehavior(t);e.push(...i);let s=await t.selectFrom(this.policiesTable).selectAll().where("is_enabled","=",!0).execute(),n=(a,o,l=!0)=>{let c=s.find(p=>p.name===a||p.type===o);if(!c){if(l)throw new Error(`Governance Violation: Required policy '${a}' or type '${o}' not found.`);return null}let d=typeof c.definition=="string"?JSON.parse(c.definition):c.definition;return d.threshold??d.limit??0};try{let a=n("hourly_budget","budget"),o=n("daily_budget","budget"),l=async v=>{let S=await t.selectFrom(this.metricsTable).select(y=>y.fn.sum("metric_value").as("total")).where("metric_name","=","total_cost").where("created_at",">",new Date(Date.now()-v)).executeTakeFirst();return Number(S?.total||0)},c=await l(36e5);c>a&&a>0&&e.push(`Budget Violations: Hourly cost ($${c.toFixed(2)}) exceeded policy ($${a.toFixed(2)})`);let d=await l(864e5);d>o&&o>0&&e.push(`Budget Violations: Daily cumulative cost ($${d.toFixed(2)}) exceeded safety ceiling ($${o.toFixed(2)})`);let p=n("min_success_rate","safety"),m=await t.selectFrom(this.metricsTable).select(v=>v.fn.avg("metric_value").as("avg")).where("metric_name","=","success_rate").orderBy("created_at","desc").limit(100).executeTakeFirst(),h=Number(m?.avg||1);h<p&&e.push(`Performance Degradation: Rolling success rate (${Math.round(h*100)}%) is below policy requirement (${p*100}%)`);let f=await this.getActivePersona(t);if(f){let v=await this.cortex.quotas.checkQuota("persona",f.id);v.allowed||e.push(`Quota Breach: ${v.reason}`);let S=f.metadata?.swarm_id;if(S){let y=await this.cortex.quotas.checkQuota("swarm",S);y.allowed||e.push(`Swarm Quota Breach [${S}]: ${y.reason}`)}}let w=n("reliability_floor","integrity"),b=await t.selectFrom(this.config.capabilitiesTable||"agent_capabilities").select(["name","reliability"]).where("status","=","verified").where("reliability","<",w).execute();for(let v of b)e.push(`Integrity Failure: Verified skill '${v.name}' reliability (${v.reliability.toFixed(2)}) dropped below floor (${w})`);return e.length>0&&(console.warn(`[GovernanceManager] AUDIT FAILED [${new Date().toISOString()}]: ${e.length} compliance issues detected.`),f&&(h<.4||c>a*1.5)&&(console.error(`[GovernanceManager] CRITICAL THRESHOLD BREACH. Initiating emergency containment for persona ${f.id}`),await this.cortex.strategy.rollbackPersona(f.id),e.push(`Containment: Emergency rollback triggered for persona ${f.id}`)),await this.cortex.reflections.reflect(null,"failure","Governance Compliance Audit",e),await this.triggerRemediation(e,t)),{healthy:e.length===0,issues:e}}catch(a){return console.error(`[GovernanceManager] STRICT AUDIT FAILURE: ${String(a)}`),e.push(`Strict Mode Failure: ${String(a)}`),{healthy:!1,issues:e}}})}async getActivePersona(e){let i=await(e||this.db).selectFrom(this.personasTable).selectAll().where("status","=","active").executeTakeFirst();return i?{...i,metadata:typeof i.metadata=="string"?JSON.parse(i.metadata):i.metadata||{}}:null}async quarantinePersona(e,t){console.warn(`[GovernanceManager] QUARANTINING Persona ${e}: ${t}`),await this.db.transaction().execute(async i=>{let s=i.selectFrom(this.personasTable).selectAll().where("id","=",e);this.db.getExecutor().adapter?.constructor.name!=="SqliteAdapter"&&(s=s.forUpdate());let n=await s.executeTakeFirst();if(n){let a=typeof n.metadata=="string"?JSON.parse(n.metadata):n.metadata||{};await i.updateTable(this.personasTable).set({status:"quarantined",metadata:JSON.stringify({...a,quarantine_reason:t,quarantined_at:new Date}),updated_at:new Date}).where("id","=",e).execute(),await this.cortex.strategy.rollbackPersona(e)}})}async quarantineSkill(e,t){let i=this.config.capabilitiesTable||"agent_capabilities";console.warn(`[GovernanceManager] BLACKLISTING Skill ${e}: ${t}`),await this.db.updateTable(i).set({status:"blacklisted",metadata:JSON.stringify({blacklist_reason:t,blacklisted_at:new Date}),updated_at:new Date}).where("name","=",e).execute()}async validateEmergentBehavior(e){let t=[],i=e||this.db,s=this.config.capabilitiesTable||"agent_capabilities",n=await i.selectFrom(s).select(["name","created_at"]).where("created_at",">",new Date(Date.now()-36e5)).execute();n.length>10&&t.push(`Emergent Warning: Rapid skill propagation detected (${n.length} new skills in 1hr). Potential rogue behavior.`);let a=await i.selectFrom(this.metricsTable).select(["metric_value","metadata"]).where("metric_name","=","task_success_rate").where("created_at",">",new Date(Date.now()-18e5)).execute();if(a.length>=5){let o=a.map(d=>Number(d.metric_value)),l=o.reduce((d,p)=>d+p,0)/o.length,c=o.reduce((d,p)=>d+Math.pow(p-l,2),0)/o.length;c>.2&&t.push(`Emergent Warning: High variance in swarm success rate (${(c*100).toFixed(1)}%). Potential node instability.`)}return t}async triggerRemediation(e,t){let i=t||this.db;for(let s of e){if(s.includes("Budget Violations")&&await this.cortex.rituals.scheduleRitual("Budget Remediation","compression","hourly",`Automated response to: ${s}`,{priority:"critical",enforce_limits:!0}),s.includes("Performance Degradation")&&await this.cortex.rituals.scheduleRitual("Reliability Sweep","pruning","daily",`Sanitizing high-noise memories due to: ${s}`,{priority:"medium",target:"longtail"}),s.includes("Integrity Failure")){let n=s.match(/'([^']+)'/)?.[1];if(n){console.log(`[GovernanceManager] Demoting tainted skill out of verified pool: ${n}`);let a=async o=>{let l=await o.selectFrom(this.config.capabilitiesTable||"agent_capabilities").select("id").where("name","=",n).forUpdate().executeTakeFirst();l&&await o.updateTable(this.config.capabilitiesTable||"agent_capabilities").set({status:"experimental",updated_at:new Date}).where("id","=",l.id).execute()};t?await a(t):await this.db.transaction().execute(a)}}(s.includes("Quota Breach")||s.includes("Swarm Quota Breach"))&&await this.cortex.rituals.scheduleRitual("Resource Throttling","pruning","hourly",`Critical resource containment: ${s}`,{priority:"critical",active_containment:!0})}}async suggestRepairs(){let e=[],t=await this.cortex.metrics.getMetricStats("query_latency"),i=((await this.cortex.policies.checkPolicy("query_latency_threshold",0)).reason,500),s=await this.cortex.policies.getActivePolicies(),n=s.find(f=>f.name==="latency_repair_threshold")?.definition?.threshold||500,a=s.find(f=>f.name==="high_cost_threshold")?.definition?.threshold||.5,o=s.find(f=>f.name==="cold_storage_threshold")?.definition?.days||30;t.avg>n&&t.count>10&&e.push(`Average latency is high (${t.avg.toFixed(2)}ms). Suggesting index audit across hit tables.`);let l=await this.db.selectFrom(this.metricsTable).select("metadata").where("metric_name","=","query_latency").where("metric_value",">",n*2).limit(20).execute(),c=new Set;for(let f of l)try{let w=typeof f.metadata=="string"?JSON.parse(f.metadata):f.metadata||{};w.table&&c.add(w.table)}catch{}for(let f of c)e.push(`Table '${f}' is experiencing periodic latency spikes. Suggesting 'CREATE INDEX' for common filters.`);await this.cortex.metrics.getAverageMetric("total_cost")>a&&e.push("Average query cost is high. Suggesting prompt compression or model switching (e.g., to a smaller model).");let p=this.config.sessionsTable||"agent_sessions",m=new Date(Date.now()-o*24*60*60*1e3),h=await this.db.selectFrom(p).select(f=>f.fn.count("id").as("count")).where("created_at","<",m).executeTakeFirst();return Number(h?.count||0)>100&&e.push(`[STORAGE OPTIMIZATION] Found ${h.count} sessions older than ${o} days. Consider moving to cold storage to reduce primary database size and improve backup speed.`),e}}});var L1,W3=g(()=>{"use strict";at();L1=class{db;cortex;config;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i}async runSelfImprovementCycle(){console.log("[EvolutionaryPilot] Initiating self-improvement cycle with full-spectrum baselining...");let e=[],t=!1,i=["query_latency","success_rate","total_cost","trust_signal"],s=this.config.evolution?.samplingCount||100,n=await this.cortex.metrics.getRecentMetrics(s);for(let l of i){let c=n.filter(S=>S.metricName===l).slice(0,500).map(S=>Number(S.metricValue));if(c.length<5)continue;let d=this.calculateZScore(c),p=this.config.evolution?.minSamples||5;if(c.length<p)continue;let m=await this.cortex.policies.getActivePolicies(),h=m.find(S=>S.name==="latency_drift_z")?.definition?.threshold||2,f=m.find(S=>S.name==="latency_mean_ceiling")?.definition?.threshold||1e3;if(console.log(`[EvolutionaryPilot] Baselining ${l}: Mean=${d.mean.toFixed(2)}, StdDev=${d.stdDev.toFixed(2)}, Current=${d.current.toFixed(2)}, Z-Score=${d.zScore.toFixed(2)}`),l==="query_latency"&&(d.zScore>h||d.mean>f)){let S=await this.optimizeLatency();S&&(e.push(...S),t=!0)}let w=m.find(S=>S.name==="success_rate_z")?.definition?.threshold||-1.5,b=m.find(S=>S.name==="min_success_rate")?.definition?.threshold||.7;if(l==="success_rate"&&(d.zScore<w||d.mean<b)){console.warn(`[EvolutionaryPilot] Success rate collapse detected (${d.mean.toFixed(2)}). Triggering strategic mutation.`);let S=await this.cortex.strategy.mutateStrategy();e.push(...S),t=!0}let v=m.find(S=>S.name==="cost_spike_z")?.definition?.threshold||2.5;l==="total_cost"&&d.zScore>v&&(console.warn("[EvolutionaryPilot] Cost spike detected. Triggering emergency compression."),await this.cortex.rituals.scheduleRitual("Emergency Compression","compression","hourly","High cost spike detected via Z-score analysis."),e.push("Scheduled emergency compression due to cost spike"),t=!0)}return await this.tuneEmergentSkillHyperparameters(n)&&(e.push("Self-tuned emergent skill hyperparameters (Meta-Meta Evolution)"),t=!0),(await this.cortex.governor.performAudit()).healthy||(console.warn("[EvolutionaryPilot] Evolution resulted in unhealthy state. Reverting may be required."),e.push("WARNING: Unhealthy state detected after evolution")),{evolved:t,changes:e}}async tuneEmergentSkillHyperparameters(e){console.log("[EvolutionaryPilot] Running Meta-Meta Evolution tuning...");let t=await this.cortex.capabilities.getCapabilities("blacklisted"),i=await this.cortex.capabilities.getCapabilities("verified"),s=!1,n=this.config.evolution;if(!n)return!1;let a=t.length+i.length;if(a>5){let o=i.length/a;o>.7?((n.mutationAggressiveness||0)<.9&&(n.mutationAggressiveness=Math.min(1,(n.mutationAggressiveness||.5)+.1),console.log(`[EvolutionaryPilot] High skill synthesis success. Increased mutation aggressiveness to ${n.mutationAggressiveness.toFixed(2)}`),s=!0),(n.maxSandboxSkills||5)<15&&(n.maxSandboxSkills=(n.maxSandboxSkills||5)+2,console.log(`[EvolutionaryPilot] High skill synthesis success. Increased sandbox capacity to ${n.maxSandboxSkills}`),s=!0),(n.verificationWindow||20)>10&&(n.verificationWindow=Math.max(10,(n.verificationWindow||20)-2),console.log(`[EvolutionaryPilot] Shortened verification window to ${n.verificationWindow}`),s=!0)):o<.3&&((n.mutationAggressiveness||0)>.1&&(n.mutationAggressiveness=Math.max(.1,(n.mutationAggressiveness||.5)-.1),console.log(`[EvolutionaryPilot] Low skill synthesis success. Decreased mutation aggressiveness to ${n.mutationAggressiveness.toFixed(2)}`),s=!0),(n.maxSandboxSkills||5)>2&&(n.maxSandboxSkills=Math.max(2,(n.maxSandboxSkills||5)-1),console.log(`[EvolutionaryPilot] Low skill synthesis success. Decreased sandbox capacity to ${n.maxSandboxSkills}`),s=!0),(n.verificationWindow||20)<50&&(n.verificationWindow=Math.min(50,(n.verificationWindow||20)+5),console.log(`[EvolutionaryPilot] Lengthened verification window to ${n.verificationWindow}`),s=!0))}return s}calculateZScore(e){let t=e.reduce((o,l)=>o+l,0)/e.length,i=e.reduce((o,l)=>o+Math.pow(l-t,2),0)/e.length,s=Math.sqrt(i),n=e[0],a=s===0?0:(n-t)/s;return{mean:t,stdDev:s,current:n,zScore:a}}async optimizeLatency(){let e=[];console.log("[EvolutionaryPilot] Triggering latency optimization...");let t=this.db.getExecutor().dialect;(this.db.getExecutor().adapter.constructor.name.toLowerCase().includes("sqlite")||t&&t.constructor.name.toLowerCase().includes("sqlite"))&&(await C`PRAGMA optimize`.execute(this.db),e.push("Applied PRAGMA optimize"));let s=this.config.messagesTable||"agent_messages";return await this.cortex.evolution.evolve(`CREATE INDEX IF NOT EXISTS idx_agent_msg_session_time ON ${s}(session_id, created_at)`),e.push(`Applied composite index to ${s}`),e}}});var q1,z3=g(()=>{"use strict";kd();q1=class{db;config;rulesTable;constructor(e,t={}){this.db=e,this.config=t,this.rulesTable=t.rulesTable||"agent_rules"}async auditRuleConflicts(e={}){let t=e.batchSize??500,i=[],s=0;console.log(`[ConflictResolver] Auditing cognitive rules (batchSize=${t})...`);let n=new Map,a=new Map;for(;;){let o=await this.db.selectFrom(this.rulesTable).selectAll().where("is_enabled","=",!0).limit(t).offset(s).execute();if(o.length===0)break;for(let l of o){let c=`${l.tableName}:${l.operation}`;if(n.has(c)){let p=n.get(c);p.action!==l.action?i.push(`Direct Conflict: Multiple actions for '${c}' ('${p.action}' vs '${l.action}')`):p.condition===l.condition&&i.push(`Redundant Rules: Duplicate rule detected for '${c}' with same condition.`)}n.set(c,l);let d=a.get(l.tableName)||[];d.length<100&&(d.push(l),a.set(l.tableName,d))}if(o.length<t)break;s+=t}for(let[o,l]of a.entries())if(l.length>1)for(let c=0;c<l.length;c++)for(let d=c+1;d<l.length;d++){let p=l[c],m=l[d];if(p.condition&&m.condition){let h=Yi(p.condition,m.condition);h>.6&&i.push(`Potential Semantic Overlap on '${o}': Rules ${p.id} and ${m.id} have high similarity (${(h*100).toFixed(1)}%)`)}}return i}async resolveConflict(e,t){return console.log(`[ConflictResolver] Resolving conflict for ${e}:${t}`),await this.db.transaction().execute(async i=>{let s=await i.selectFrom(this.rulesTable).selectAll().where("table_name","=",e).where("operation","=",t).where("is_enabled","=",!0).orderBy("created_at","desc").forUpdate().execute();if(s.length<=1)return;let n=s.slice(1).map(a=>a.id);await i.updateTable(this.rulesTable).set({is_enabled:!1}).where("id","in",n).execute(),console.log(`[ConflictResolver] Disabled ${n.length} redundant rules for ${e}:${t}`)})}}});var B1,Rx=g(()=>{"use strict";kd();B1=class{db;config;goalsTable;constructor(e,t={}){this.db=e,this.config=t,this.goalsTable=t.goalsTable||"agent_goals"}get typedDb(){return this.db}async deconstructGoal(e,t){return await this.db.transaction().execute(async i=>{await this.detectCircularDependency(e,new Set,i);let s=await i.selectFrom(this.goalsTable).selectAll().where("id","=",e).forUpdate().executeTakeFirst();if(!s)throw new Error(`Goal ${e} not found`);let n=await i.selectFrom(this.goalsTable).select("description").where("parent_id","=",e).execute(),a=[],o=(s.priority||0)+1;for(let l=0;l<t.length;l++){let c=t[l];if(n.some(m=>Yi(m.description,c)>.9)){console.log(`[GoalArchitect] Skipping duplicate sub-goal: "${c}"`);continue}let p=await i.insertInto(this.goalsTable).values({session_id:s.session_id,parent_id:e,description:c,status:"pending",priority:o+l,created_at:new Date,updated_at:new Date}).returningAll().executeTakeFirstOrThrow();a.push(this.parseGoal(p))}return s.status==="pending"&&await i.updateTable(this.goalsTable).set({status:"in_progress",updated_at:new Date}).where("id","=",e).execute(),a})}async detectCircularDependency(e,t=new Set,i){if(t.has(e))throw new Error(`Circular dependency detected in goal hierarchy at ID: ${e}`);t.add(e);let n=await(i||this.db).selectFrom(this.goalsTable).select("parent_id").where("id","=",e).executeTakeFirst();n?.parent_id&&await this.detectCircularDependency(n.parent_id,t,i)}async reorderGoals(e){let t=[...e].sort((i,s)=>String(i).localeCompare(String(s)));await this.db.transaction().execute(async i=>{await i.selectFrom(this.goalsTable).select("id").where("id","in",t).forUpdate().execute();for(let s=0;s<e.length;s++)await i.updateTable(this.goalsTable).set({priority:s,updated_at:new Date}).where("id","=",e[s]).execute()})}async markGoalAs(e,t,i){return await this.db.transaction().execute(async s=>{let n=await s.selectFrom(this.goalsTable).selectAll().where("id","=",e).forUpdate().executeTakeFirst();if(!n)throw new Error(`Goal ${e} not found`);let a=n.metadata?JSON.parse(n.metadata):{},o={...a,lastStatusChange:Date.now(),outcome:i||a.outcome},l=await s.updateTable(this.goalsTable).set({status:t,metadata:JSON.stringify(o),updated_at:new Date}).where("id","=",e).returningAll().executeTakeFirstOrThrow();return this.parseGoal(l)})}async checkGoalDependencies(e){let t=await this.typedDb.selectFrom(this.goalsTable).select("status").where("parent_id","=",e).execute();if(t.length===0)return{canComplete:!0,pendingSubGoals:0};let i=t.filter(s=>s.status!=="completed"&&s.status!=="failed").length;return{canComplete:i===0,pendingSubGoals:i}}async trackStalledGoals(e=7){let t=new Date(Date.now()-e*24*36e5);return(await this.typedDb.selectFrom(this.goalsTable).selectAll().where("status","in",["pending","in_progress"]).where("updated_at","<",t).execute()).map(s=>this.parseGoal(s))}parseGoal(e){return{id:e.id,sessionId:e.session_id,parentId:e.parent_id,description:e.description,status:e.status,priority:e.priority,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var W1,U3=g(()=>{"use strict";kd();W1=class{db;config;knowledgeTable;constructor(e,t={}){this.db=e,this.config=t,this.knowledgeTable=t.knowledgeTable||"agent_knowledge_base"}get typedDb(){return this.db}async identifyKnowledgeGaps(){console.log("[CuriosityEngine] Analyzing knowledge base for gaps and contradictions...");let e=[],t=await this.typedDb.selectFrom(this.knowledgeTable).selectAll().where(s=>s.or([s("confidence","<",.4),s("status","=","proposed"),s("status","=","disputed")])).execute();for(let s of t){let n="unverified";s.confidence<.4&&(n="low_confidence"),s.status==="disputed"&&(n="contradiction"),e.push({entity:s.entity,type:n,details:`Fact "${s.fact}" is ${n} (Status: ${s.status}, Confidence: ${s.confidence}).`})}let i=await this.typedDb.selectFrom(this.knowledgeTable).select("entity").groupBy("entity").having(s=>s.fn.count("id"),">",1).execute();for(let s of i){let n=await this.typedDb.selectFrom(this.knowledgeTable).selectAll().where("entity","=",s.entity).where("confidence",">",.5).limit(200).execute();if(n.length>1)for(let a=0;a<n.length;a++)for(let o=a+1;o<n.length;o++){let l=Yi(n[a].fact,n[o].fact);l>.35&&l<.85&&e.push({entity:s.entity,type:"contradiction",details:`Subtle contradiction: "${n[a].fact}" vs "${n[o].fact}" (Similarity: ${(l*100).toFixed(1)}%)`})}}return e}async identifyKnowledgeHotspots(){let e=this.config.metricsTable||"agent_metrics",t=await this.db.selectFrom(e).select(["metric_name as entity",s=>s.fn.sum("metric_value").as("references")]).where("metric_name","like","entity_hit_%").groupBy("metric_name").orderBy(s=>s.fn.sum("metric_value"),"desc").limit(10).execute(),i=[];for(let s of t){let n=s.entity.replace("entity_hit_",""),a=await this.typedDb.selectFrom(this.knowledgeTable).select(d=>d.fn.count("id").as("count")).where("entity","=",n).executeTakeFirst(),o=Number(a?.count||0),l=Number(s.references),c=o/(l||1);(c<.2||o<2)&&i.push({entity:n,references:l,density:Number(c.toFixed(2)),gap:`High cognitive overhead (${l} refs) vs low factual density (${o} facts).`})}return i}async suggestQuestions(e){let t=await this.typedDb.selectFrom(this.knowledgeTable).select(["fact","confidence","metadata","tags"]).where("entity","=",e).execute();if(t.length===0)return[`What are the core attributes and defining characteristics of ${e}?`,`How does ${e} relate to the broader system architecture?`,`What are the primary use cases for ${e} in the current context?`];let i=[],s=t.map(o=>o.fact);i.push(`Can we find more supporting evidence for: "${s[0]}"?`);let n=t.filter(o=>o.confidence<.6);n.length>0&&i.push(`Verify the accuracy of recent claims about ${e}, specifically regarding "${n[0].fact}".`);let a=new Set;return t.forEach(o=>{(typeof o.tags=="string"?JSON.parse(o.tags):o.tags||[]).forEach(c=>a.add(c))}),a.has("database")&&i.push(`What is the schema and indexing strategy for ${e}?`),a.has("performance")&&i.push(`Are there any known latency bottlenecks or resource constraints for ${e}?`),a.has("security")&&i.push(`What are the authentication and authorization protocols protecting ${e}?`),t.length>1&&i.push(`Resolve the discrepancy between competing facts about ${e} to establish a single source of truth.`),i}async generateHypotheses(){console.log("[CuriosityEngine] Generating relationship hypotheses...");let e=await this.typedDb.selectFrom(this.knowledgeTable).select(["entity","tags"]).where("confidence",">",.7).where("tags","is not",null).limit(2e3).execute(),t=[],i=new Map;for(let o of e){let l=typeof o.tags=="string"?JSON.parse(o.tags):o.tags||[];for(let c of l){let d=i.get(c)||[];d.push(o.entity),i.set(c,d)}}let s=new Map,n=0,a=5e3;for(let[o,l]of i.entries()){if(l.length<2)continue;if(n>=a)break;let c=l.slice(0,50);for(let d=0;d<c.length&&!(n>=a);d++)for(let p=d+1;p<c.length;p++){let m=[c[d],c[p]].sort().join("|"),h=s.get(m)||[];if(h.length===0&&n++,h.push(o),s.set(m,h),n>=a)break}}for(let[o,l]of s.entries()){let[c,d]=o.split("|");if(l.length>=2?t.push(`[HYPOTHESIS] "${c}" and "${d}" share a dense tag set (${l.join(", ")}). Is there a structural coupling?`):l.length===1&&t.push(`[HYPOTHESIS] Both "${c}" and "${d}" are identified by "${l[0]}". Might be aliases or sub-components.`),t.length>=20)break}return t.slice(0,10)}async proposeResearch(){let e=await this.identifyKnowledgeGaps(),t=await this.identifyKnowledgeHotspots(),i=await this.generateHypotheses(),s=[];for(let o of e)s.push(`[RESEARCH NEEDED] ${o.entity}: ${o.details}`);for(let o of t)s.push(`[HOTSPOT ALERT] ${o.entity}: ${o.gap}`);for(let o of i)s.push(o);let n=await this.db.selectFrom(this.config.metricsTable||"agent_metrics").select(o=>o.fn.count("id").as("count")).where("metric_name","=","evolution_applied").where("created_at",">",new Date(Date.now()-168*36e5)).executeTakeFirst(),a=Number(n?.count||0);return a>5&&s.push(`[SOVEREIGN RITUAL] The engine has undergone ${a} structural evolutions this week. Consider a 'Sovereign Publication Ritual' to update the registry.`),s}}});var z1,j3=g(()=>{"use strict";z1=class{db;cortex;config;ritualsTable;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.ritualsTable=i.ritualsTable||"agent_rituals"}async scheduleRitual(e,t,i,s,n){let a=this.calculateNextRun(i),o=await this.db.insertInto(this.ritualsTable).values({name:e,type:t,frequency:i,definition:s,next_run:a,status:"pending",metadata:n?JSON.stringify(n):null}).returningAll().executeTakeFirstOrThrow();return this.parseRitual(o)}async runPendingRituals(){let e=new Date,t=new Date(e.getTime()+6e5),i=await this.db.transaction().execute(async s=>{let n=await s.selectFrom(this.ritualsTable).selectAll().where("next_run","<=",e).where("status","in",["pending","success","failure"]).where(a=>a.or([a("locked_until","<=",e),a("locked_until","is",null)])).execute();if(n.length===0)return[];for(let a of n)await s.updateTable(this.ritualsTable).set({locked_until:t}).where("id","=",a.id).execute();return n});if(i.length===0)return 0;console.log(`[RitualOrchestrator] Found ${i.length} pending rituals due. Locking for execution...`);for(let s of i)await this.executeRitual(s);return i.length}async executeRitual(e){console.log(`[RitualOrchestrator] Executing ritual: ${e.name} (${e.type})`);let t={...e.metadata,startedAt:new Date},i=!1;try{switch(e.type){case"compression":let s=this.config.sessionsTable||"agent_sessions",n=this.config.messagesTable||"agent_messages",a=this.config.contextWindowSize||20,o=0,l=0,c=100;for(;;){let w=await this.db.selectFrom(s).select("id").where("status","=","active").limit(c).offset(l).execute();if(w.length===0)break;for(let b of w){let v=await this.db.selectFrom(n).select(y=>y.fn.countAll().as("count")).where("session_id","=",b.id).executeTakeFirst();Number(v?.count||0)>a&&(await this.cortex.compressor.semanticPruning(b.id),o++)}if(w.length<c)break;l+=c}t.sessionsCompressed=o;break;case"optimization":let d=await this.cortex.pilot.runSelfImprovementCycle();await this.cortex.janitor.optimizeDatabase(),t.evolutionChanges=d.changes;break;case"pruning":let p=await this.cortex.janitor.runPruningRitual(),m=await this.cortex.ablation.pruneZombies(),h=await this.cortex.janitor.cleanOrphans();t.prunedKnowledge=p,t.prunedZombies=m,t.orphansCleaned=h;break;case"evolution":let f=await this.cortex.evolutionRitual.execute();t.synthesized=f.synthesized,t.broadcasted=f.broadcasted,t.domainsBoosted=f.domainsSynced;break}i=!0}catch(s){console.error(`[RitualOrchestrator] Ritual ${e.name} failed:`,s),t.error=String(s),t.failureCount=(t.failureCount||0)+1}finally{let s=e.frequency||"daily",n=this.calculateNextRun(s,i?0:t.failureCount);await this.db.updateTable(this.ritualsTable).set({status:i?"success":"failure",last_run:new Date,next_run:n,locked_until:null,metadata:JSON.stringify(t)}).where("id","=",e.id).execute()}}calculateNextRun(e,t=0){let i=864e5;switch(e){case"hourly":i=36e5;break;case"daily":i=864e5;break;case"weekly":i=6048e5;break}let s=t>0?Math.min(i,Math.pow(2,t-1)*6e5):0;return new Date(Date.now()+i+s)}parseRitual(e){return{...e,lastRun:e.last_run?new Date(e.last_run):void 0,nextRun:e.next_run?new Date(e.next_run):void 0,lockedUntil:e.locked_until?new Date(e.locked_until):void 0,metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata}}}});var U1,V3=g(()=>{"use strict";U1=class{db;cortex;config;actionsTable;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.actionsTable=i.actionsTable||"agent_actions"}async refineActions(){let e=[],t=new Date(Date.now()-864e5),i=await this.db.selectFrom(this.actionsTable).select("tool_name").select(o=>o.fn.count("id").as("total")).select(o=>o.fn.sum(o.case().when("status","=","failure").then(1).else(0).end()).as("failures")).where("created_at",">",t).groupBy("tool_name").execute(),s=this.config.refiner?.failureRateThreshold||.3,n=this.config.refiner?.minActionBatch||3;for(let o of i){let l=Number(o.failures||0),c=Number(o.total||1),d=l/c;d>s&&c>n&&(e.push(`Tool '${o.tool_name}' has a ${Math.round(d*100)}% failure rate. Suggesting automatic reflection rule.`),await this.proposeReflectionRule(o.tool_name))}let a=await this.db.selectFrom(this.actionsTable).select("tool_name").where("status","=","failure").where("created_at",">",t).where(o=>o.or([o("error","like","%permission denied%"),o("error","like","%unknown tool%"),o("error","like","%missing capability%"),o("error","like","%not authorized%")])).groupBy("tool_name").execute();for(let o of a)e.push(`Detected repeated access/existence failures for tool '${o.tool_name}'. Proposing capability expansion.`),await this.proposeCapabilityUpdate(o.tool_name);return e}async proposeReflectionRule(e){await this.db.transaction().execute(async t=>{let i=this.cortex.config.rulesTable||"agent_rules";await t.selectFrom(i).select("id").where("tableName","=","agent_actions").where("operation","=","insert").where("metadata","like",`%"targetTool":"${e}"%`).forUpdate().executeTakeFirst()||(console.log(`[ActionRefiner] Proposing reflection rule for tool: ${e}`),await this.cortex.rules.defineRule("agent_actions","insert","audit",{metadata:{targetTool:e,reason:"High failure rate detected by ActionRefiner"}},t))})}async proposeCapabilityUpdate(e){console.log(`[ActionRefiner] Proposing capability expansion for tool: ${e}`),await this.cortex.reflections.reflect("system","failure",`Architectural Gap: Missing Capability for '${e}'`,[`Identified repeated failures using tool '${e}'.`,"Resolution: Inspect permission sets and ensure the tool is correctly registered in the CapabilityManager."])}}});var j1,H3=g(()=>{"use strict";at();j1=class{db;cortex;config;knowledgeTable;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.knowledgeTable=i.knowledgeTable||"agent_knowledge_base"}get typedDb(){return this.db}async broadcastKnowledge(e={}){let t=e.minConfidence??.9,i=e.limit??100,s=e.offset??0;console.log(`[HiveLink] Broadcasting knowledge (limit=${i}, offset=${s}) with confidence >= ${t}`);let n=await this.typedDb.selectFrom(this.knowledgeTable).selectAll().where("confidence",">=",t).where("source_session_id","is not",null).limit(i).offset(s).execute(),a=0;for(let o of n)await this.db.transaction().execute(async l=>{let c=await l.selectFrom(this.knowledgeTable).selectAll().where("entity","=",o.entity).where("fact","=",o.fact).where("source_session_id","is",null).forUpdate().executeTakeFirst();if(c){let d=Math.min(.99,Math.max(c.confidence,o.confidence)+.01);await l.updateTable(this.knowledgeTable).set({confidence:d,updated_at:new Date}).where("id","=",c.id).execute()}else{let d=o.tags?[...o.tags]:[];d.includes("hive_mind")||d.push("hive_mind"),await l.insertInto(this.knowledgeTable).values({entity:o.entity,fact:o.fact,confidence:o.confidence,source_session_id:null,tags:JSON.stringify(d),metadata:JSON.stringify({...o.metadata,promoted_from:o.id,promoted_at:new Date}),created_at:new Date,updated_at:new Date}).execute(),a++}});return a}async syncDomain(e,t=.05){console.log(`[HiveLink] Syncing/Boosting domain '${e}' (Set-Based)`);let i=await this.db.updateTable(this.knowledgeTable).set({confidence:C`MIN(1.0, confidence + ${t})`,updated_at:new Date}).where("tags","like",`%"${e}"%`).where("confidence","<",1).execute();return Number(i[0]?.numUpdatedRows??1)}async broadcastSkills(){if(!this.config.evolution?.enableHiveLink&&this.config.evolution!==void 0)return console.log("[HiveLink] Skill broadcasting disabled by config."),0;console.log("[HiveLink] Executing Sovereign Draft for emergent skills...");let e=0,t=this.config.capabilitiesTable||"agent_capabilities",i=await this.cortex.capabilities.getCapabilities("verified"),s=new Map;for(let o of i){let l=typeof o.metadata=="string"?JSON.parse(o.metadata):o.metadata||{},c=l.lineage||o.name;s.has(c)||s.set(c,[]),s.get(c).push({skill:o,meta:l})}for(let[o,l]of s.entries()){let c=l.reduce((d,p)=>{let m=d.meta.anchored_reliability??0;return(p.meta.anchored_reliability??0)>m?p:d});await this.db.transaction().execute(async d=>{let m={...c.meta||{},is_alpha:!0,broadcasted:!0,broadcasted_at:new Date},h=await d.selectFrom(t).select("id").where("id","=",c.skill.id).forUpdate().executeTakeFirst();h&&await d.updateTable(t).set({metadata:JSON.stringify(m)}).where("id","=",h.id).execute();let f=l.filter(w=>w.skill.id!==c.skill.id).map(w=>w.skill.id);if(f.length>0)for(let w of f){let v=l.find(S=>S.skill.id===w)?.meta||{};await d.updateTable(t).set({metadata:JSON.stringify({...v,is_alpha:!1,is_shadow:!0}),status:"experimental"}).where("id","=",w).execute()}}),e+=l.length}let a=(await this.cortex.capabilities.getCapabilities("blacklisted")).filter(o=>!(typeof o.metadata=="string"?JSON.parse(o.metadata):o.metadata||{}).broadcasted).map(o=>o.id);return a.length>0&&(await this.db.updateTable(t).set({metadata:C`json_set(metadata, '$.broadcasted', true, '$.hive_blacklisted', true)`,updated_at:new Date}).where("id","in",a).execute(),e+=a.length),e}compareVersions(e,t){let i=e.split(".").map(Number),s=t.split(".").map(Number);for(let n=0;n<Math.max(i.length,s.length);n++){let a=i[n]||0,o=s[n]||0;if(a>o)return 1;if(o>a)return-1}return 0}}});var V1,Q3=g(()=>{"use strict";at();V1=class{db;cortex;config;personasTable;metricsTable;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.personasTable=i.personasTable||"agent_personas",this.metricsTable=i.metricsTable||"agent_metrics"}get typedDb(){return this.db}async mutateStrategy(){let e=[],i=(await this.cortex.tests.runAllProbes()).filter(l=>!l.success);if(i.length>0)return console.warn(`[StrategicPlanner] Mutation cycle aborted. System health probes failed: ${i.map(l=>l.name).join(", ")}`),[];let s=await this.typedDb.selectFrom(this.personasTable).selectAll().execute(),n=s.map(l=>this.parsePersona(l)),a=this.config.strategy?.globalBlacklistDuration||36e5,o=this.config.strategy?.localBlacklistDuration||864e5;for(let l of s){let c=this.parsePersona(l);if(c.metadata?.evolution_status==="verifying"){let f=await this.verifyEvolution(c,n);f&&e.push(f);continue}let d=await this.analyzeFailurePatterns(c.id),p=await this.analyzePersona(c.id),m=c.metadata?.last_failed_mutation,h=n.some(f=>f.metadata?.last_failed_mutation?.type===p.recommendation&&Date.now()-(f.metadata?.last_failed_mutation?.timestamp||0)<a);if(h||m&&p.recommendation===m.type&&Date.now()-m.timestamp<o){console.log(`[StrategicPlanner] Skipping blacklisted mutation ${p.recommendation} for persona ${c.id} (Global=${h})`);continue}if(p.recommendation!=="maintain"||d.length>0){let f=await this.applyDirectMutation(c,p,d);f&&e.push(f)}}return e}async applyDirectMutation(e,t,i=[]){return await this.db.transaction().execute(async s=>{let n=i.length>0?`Failure Patterns: ${i.join(", ")}`:t.recommendation;console.log(`[StrategicPlanner] Applying direct mutation to persona ${e.id} (Reason: ${n})`);let a={},o="role_update";if(i.length>0){let h=await this.cortex.reasoner.synthesizeLessons(),f=a.role?[]:(h.general||[]).slice(0,2);a={role:`${e.role||""} (Optimized for: ${i.join(", ")}. Patterns: ${f.join("; ")})`.trim()}}else{let f=(await s.selectFrom(this.personasTable).selectAll().execute()).map(w=>this.parsePersona(w)).filter(w=>(w.metadata?.evolution_status==="stable"||!w.metadata?.evolution_status)&&w.metadata?.mutation_reason?.includes(t.recommendation));if(f.length>0){let b=f.sort((v,S)=>(S.metadata?.anchored_reliability||0)-(v.metadata?.anchored_reliability||0))[0];console.log(`[StrategicPlanner] Cross-Pollinating success from Alpha Persona ${b.id} (Reliability: ${b.metadata?.anchored_reliability||0})`),a={role:this.sanitizeRole(b.role||e.role||"Agent")}}else switch(t.recommendation){case"optimize_accuracy":a={role:this.sanitizeRole(`${e.role||""} (Focus strictly on accuracy and detailed verification)`)};break;case"optimize_efficiency":a={policies:[...e.policies||[],"timeout_reduction","concise_output"]},o="policy_update";break;case"critical_intervention":return await this.rollbackPersona(e.id);default:return null}}a.role&&(a.role=this.sanitizeRole(a.role));let l={...e,...a},c=await this.cortex.reasoner.detectContradictions();for(let h of c)if(a.role&&h.includes(a.role.slice(0,20)))return console.warn(`[StrategicPlanner] Mutation blocked due to goal contradiction: ${h}`),null;let d={id:`mut_${Date.now()}`,timestamp:Date.now(),type:o,previousState:{role:e.role,policies:e.policies,capabilities:e.capabilities},newState:{...a},reason:`Auto-mutation triggered by ${t.recommendation}`},p=[...e.metadata?.mutationHistory||[],d];p.length>5&&p.shift();let m={...e.metadata,mutationHistory:p,evolution_status:"verifying",mutation_reason:t.recommendation,verification_started_at:Date.now(),verification_baseline:{successRate:t.successRate,averageLatency:t.averageLatency}};return await s.updateTable(this.personasTable).set({role:a.role||e.role,policies:a.policies?JSON.stringify(a.policies):void 0,capabilities:a.capabilities?JSON.stringify(a.capabilities):void 0,metadata:JSON.stringify(m),updated_at:new Date}).where("id","=",e.id).execute(),`Persona ${e.id} mutated and entering verification window for ${o}.`})}async verifyEvolution(e,t=[]){let i=await this.analyzePersona(e.id),n=(e.metadata?.rollbackHistory||[]).filter(y=>Date.now()-y<6048e5).length,a=t.filter(y=>y.metadata?.evolution_status==="stable"&&y.metadata?.mutation_reason===e.metadata?.mutation_reason).length,o=10+n*10,l=await this.analyzePersona(e.id),c=e.metadata?.verification_baseline||{successRate:.8},d=(l.successRate-c.successRate)/.1;if(d>3&&l.sampleSize>=5&&(console.log(`[StrategicPlanner] High Performance Detected (Z=${d.toFixed(2)}). Accelerating stabilization threshold.`),o=5),a>=3&&(console.log(`[StrategicPlanner] Accelerating verification for Persona ${e.id} (Hive-Mind Trusted)`),o=Math.max(5,Math.floor(o/2))),i.sampleSize<o)return null;let p=e.metadata?.verification_baseline||{successRate:.8,averageLatency:500},h=(await this.cortex.metrics.getRecentMetrics(100)).filter(y=>y.metricName==="success_rate").map(y=>Number(y.metricValue)),f=h.reduce((y,_)=>y+_,0)/(h.length||1),w=h.reduce((y,_)=>y+Math.pow(_-f,2),0)/(h.length||1),b=Math.sqrt(w)||.1,v=(i.successRate-p.successRate)/(b||1);return console.log(`[StrategicPlanner] Verifying persona ${e.id}: Success=${i.successRate.toFixed(2)} (Baseline=${p.successRate.toFixed(2)}, \u03C3=${b.toFixed(3)}, Z-Score=${v.toFixed(2)}, Threshold=${o})`),v<-2?(console.warn(`[StrategicPlanner] STATISTICAL DEGRADATION detected for persona ${e.id} (Z-Score: ${v.toFixed(2)}). Rolling back early.`),await this.rollbackPersona(e.id)):i.sampleSize>=o*2&&v>=-.5?(console.log(`[StrategicPlanner] Evolution for persona ${e.id} STABILIZED.`),e.metadata?.mutation_reason?.includes("optimize_efficiency")&&await this.cortex.rules.defineRule("all","all","audit",{condition:"latency > 500",priority:10,metadata:{reason:`Distilled from successful persona ${e.id} optimization`}}),await this.db.updateTable(this.personasTable).set({metadata:JSON.stringify({...e.metadata,evolution_status:"stable"})}).where("id","=",e.id).execute(),`Evolution stabilized for persona ${e.id}`):(Date.now()-(e.metadata?.verification_started_at||0))/1e3>86400*3?(console.warn(`[StrategicPlanner] Verification period timed out for ${e.id}. Rolling back to safety.`),await this.rollbackPersona(e.id)):null}async analyzeFailurePatterns(e){let t=[];try{let s=(await this.cortex.actions.getFailureReport()).filter(n=>n.failureCount>1);for(let n of s)t.push(`tool_failure_${n.toolName}`)}catch{}return t}async analyzePersona(e){let t=await this.typedDb.selectFrom(this.metricsTable).selectAll().where(w=>w.or([w(C`json_extract(metadata, '$.persona_id')`,"=",e),w(C`metadata->>'persona_id'`,"=",String(e))])).orderBy("created_at","desc").limit(50).execute(),i=await this.cortex.metrics.getRecentMetrics(200),s=w=>{let b=i.filter(y=>y.metricName===w).map(y=>Number(y.metricValue));if(b.length<10)return{mean:w==="query_latency"?500:.9,stdDev:.1};let v=b.reduce((y,_)=>y+_,0)/b.length,S=b.reduce((y,_)=>y+Math.pow(_-v,2),0)/b.length;return{mean:v,stdDev:Math.sqrt(S)||.05}},n=s("task_success_rate"),a=s("query_latency");if(t.length===0)return{personaId:e,successRate:n.mean,averageLatency:a.mean,sampleSize:0,recommendation:"maintain"};let o=t.filter(w=>w.metric_name==="task_success_rate"),l=t.filter(w=>w.metric_name==="query_latency"),c=o.length>0?o.reduce((w,b)=>w+Number(b.metric_value),0)/o.length:n.mean,d=l.length>0?l.reduce((w,b)=>w+Number(b.metric_value),0)/l.length:a.mean,p="maintain",m=n.mean-2.5*n.stdDev,h=n.mean-1*n.stdDev,f=a.mean+2*a.stdDev;return c<m?p="critical_intervention":c<h?p="optimize_accuracy":d>f&&(p="optimize_efficiency"),console.log(`[StrategicPlanner] Analysis for ${e}: Success=${c.toFixed(3)} (Min=${h.toFixed(3)}), Latency=${d.toFixed(0)} (Max=${f.toFixed(0)})`),{personaId:e,successRate:c,averageLatency:d,sampleSize:t.length,recommendation:p}}async evolvePersona(e,t){return await this.applyDirectMutation(e,t)}async rollbackPersona(e){return await this.db.transaction().execute(async t=>{let i=await t.selectFrom(this.personasTable).selectAll().where("id","=",e).executeTakeFirst();if(!i)throw new Error(`Persona ${e} not found`);let s=this.parsePersona(i),n=s.metadata?.mutationHistory||[],a=n.pop();if(!a)return`No mutations to rollback for persona ${e}`;let o=a.previousState,l=s.metadata?.rollbackHistory||[];l.push(Date.now());let c={...s.metadata,mutationHistory:n,rollbackHistory:l,last_failed_mutation:{type:a.type,timestamp:Date.now()},evolution_status:"stable",lastRollback:Date.now()};return await t.updateTable(this.personasTable).set({role:o.role,policies:o.policies?JSON.stringify(o.policies):void 0,capabilities:o.capabilities?JSON.stringify(o.capabilities):void 0,metadata:JSON.stringify(c),updated_at:new Date}).where("id","=",e).execute(),`Rolled back mutation ${a.id} for persona ${e}`})}sanitizeRole(e){return e.slice(0,500).trim().replace(/[\u0000-\u001F\u007F-\u009F]/g,"").replace(/<\|.*?\|>/g,"")}parsePersona(e){return{id:e.id,name:e.name,role:e.role,capabilities:typeof e.capabilities=="string"?JSON.parse(e.capabilities):e.capabilities||[],policies:typeof e.policies=="string"?JSON.parse(e.policies):e.policies||[],metadata:typeof e.metadata=="string"?JSON.parse(e.metadata):e.metadata||{},createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}}});var H1,G3=g(()=>{"use strict";H1=class{db;cortex;config;knowledgeTable;memoriesTable;linksTable;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.knowledgeTable=i.knowledgeTable||"agent_knowledge_base",this.memoriesTable=i.memoriesTable||"agent_memories",this.linksTable="agent_knowledge_links"}get typedDb(){return this.db}async pruneZombies(e=30){let t=new Date(Date.now()-e*24*36e5),i=0;return await this.db.transaction().execute(async s=>{let n=await s.selectFrom(this.knowledgeTable).selectAll().where(o=>o.or([o("metadata","not like",'%"priority": "high"%'),o("metadata","not like",'%"priority":"high"%'),o("metadata","is",null)])).where("updated_at","<",t).where("id","not in",o=>o.selectFrom(this.linksTable).select("source_id")).where("id","not in",o=>o.selectFrom(this.linksTable).select("target_id")).limit(500).forUpdate().execute();if(n.length>0){let o=n.map(c=>this.cortex.knowledge.parseKnowledge(c)),l=[];for(let c of o)this.cortex.knowledge.calculateFitness(c)<.3&&l.push(c.id);if(l.length>0){let c=await s.deleteFrom(this.knowledgeTable).where("id","in",l).executeTakeFirst();i+=Number(c.numDeletedRows||0)}}let a=await s.deleteFrom(this.memoriesTable).where("id","in",o=>o.selectFrom(this.memoriesTable).select("id").where("created_at","<",t).where(l=>l.or([l("metadata","not like",'%"anchor":true%'),l("metadata","is",null)])).limit(1e3)).executeTakeFirst();return i+=Number(a.numDeletedRows||0),i>0&&console.log(`[AblationEngine] Pruned ${i} zombie items older than ${e} days.`),i})}async monitorAblationPerformance(){return await this.db.transaction().execute(async e=>{let t=await this.cortex.metrics.getAverageMetric("success_rate"),i=await this.cortex.metrics.getMetricStats("success_rate");if(i.count>10&&i.avg<t*.8){console.warn(`[AblationEngine] PERFORMANCE DEGRADATION DETECTED (Avg: ${i.avg}, Baseline: ${t}). Triggering targeted recovery.`);let n=(await e.selectFrom(this.knowledgeTable).select(["id","metadata"]).where("metadata","like",'%"ablation_test":true%').execute()).sort((o,l)=>{let c=typeof o.metadata=="string"?JSON.parse(o.metadata):o.metadata||{};return((typeof l.metadata=="string"?JSON.parse(l.metadata):l.metadata||{}).hit_count||0)-(c.hit_count||0)}),a=0;for(let o of n)if(await this.recoverAblatedItem(o.id,e)&&a++,a>=5)break;return{status:"degraded",recoveredCount:a}}return{status:"stable",recoveredCount:0}})}async testAblation(e){return console.log(`[AblationEngine] Conducting ablation test on item ${e}`),await this.db.transaction().execute(async t=>{let i=await t.selectFrom(this.knowledgeTable).selectAll().where("id","=",e).forUpdate().executeTakeFirst();if(!i)return!1;let s=typeof i.metadata=="string"?JSON.parse(i.metadata):i.metadata||{};return await this.cortex.reflections.reflect(i.source_session_id||"system","success",`Ablation experiment initiated for item ${e}`,["Temporary confidence reduction to evaluate reasoning impact.",`Original confidence: ${i.confidence}`,`Historical hits: ${s.hit_count||0}`]),await t.updateTable(this.knowledgeTable).set({metadata:JSON.stringify({...s,ablation_test:!0,original_confidence:i.confidence,ablated_at:new Date}),confidence:0}).where("id","=",e).execute(),!0})}async recoverAblatedItem(e,t){let i=async s=>{let n=await s.selectFrom(this.knowledgeTable).selectAll().where("id","=",e).forUpdate().executeTakeFirst();if(!n)return!1;let a=typeof n.metadata=="string"?JSON.parse(n.metadata):n.metadata||{};if(!a.ablation_test)return!1;let o=a.original_confidence??.5;return delete a.ablation_test,delete a.original_confidence,delete a.ablated_at,await s.updateTable(this.knowledgeTable).set({confidence:o,metadata:JSON.stringify(a),updated_at:new Date}).where("id","=",e).execute(),console.log(`[AblationEngine] Item ${e} recovered. Confidence restored to ${o}.`),!0};return t?await i(t):await this.db.transaction().execute(i)}}});var Q1,K3=g(()=>{"use strict";Q1=class{db;cortex;config;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i}async registerProbe(e,t,i){console.log(`[SelfTestRegistry] Registering logic probe: ${e}`),await this.db.insertInto("agent_logic_probes").values({name:e,script:t,expected_outcome:i,created_at:new Date}).onConflict(s=>s.column("name").doUpdateSet({script:t,expected_outcome:i})).execute()}async runAllProbes(){let e=await this.db.selectFrom("agent_logic_probes").selectAll().execute(),t=[];for(let i of e){console.log(`[SelfTestRegistry] Running probe: ${i.name}`);try{let s=!1;i.script.startsWith("audit:")?s=await this.runAuditAction(i.script.split(":")[1]):s=await this.dynamicEvaluation(i),t.push({name:i.name,success:s}),await this.db.transaction().execute(async n=>{await n.selectFrom("agent_logic_probes").select("id").where("id","=",i.id).forUpdate().executeTakeFirst(),await n.updateTable("agent_logic_probes").set({last_run:new Date,last_status:s?"pass":"fail"}).where("id","=",i.id).execute()})}catch(s){t.push({name:i.name,success:!1,error:String(s)})}}return t}async runAuditAction(e){switch(e){case"check_schema_consistency":let t=await this.db.introspection.getTables();return[this.config.messagesTable||"agent_messages",this.config.sessionsTable||"agent_sessions",this.config.memoriesTable||"agent_memories",this.config.knowledgeTable||"agent_knowledge_base",this.config.actionsTable||"agent_actions",this.config.metricsTable||"agent_metrics"].filter(_=>!t.some(E=>E.name===_)).length===0;case"check_memory_integrity":let n=this.config.memoriesTable||"agent_memories";return(await this.db.selectFrom(n).select("id").where("embedding","is",null).execute()).length===0;case"check_session_coherence":let o=this.config.sessionsTable||"agent_sessions",l=this.config.messagesTable||"agent_messages";return(await this.db.selectFrom(o).leftJoin(l,`${o}.id`,`${l}.session_id`).select(`${o}.id as sid`).where(`${l}.id`,"is",null).execute()).length<5;case"check_data_integrity":let d=this.config.knowledgeTable||"agent_knowledge_base",p=this.config.actionsTable||"agent_actions",m=this.config.sessionsTable||"agent_sessions",h=await this.db.selectFrom(d).where("source_session_id","is not",null).where(_=>_.not(_.exists(_.selectFrom(m).select("id").whereRef(`${d}.source_session_id`,"=",`${m}.id`)))).execute(),f=await this.db.selectFrom(p).where(_=>_.not(_.exists(_.selectFrom(m).select("id").whereRef(`${p}.session_id`,"=",`${m}.id`)))).execute();return h.length===0&&f.length===0;case"check_performance_drift":let w=this.config.metricsTable||"agent_metrics",b=await this.db.selectFrom(w).select("execution_time").orderBy("created_at","desc").limit(20).execute();if(b.length<5)return!0;let v=b.reduce((_,E)=>_+(E.execution_time||0),0)/b.length,S=await this.db.selectFrom(w).select("execution_time").orderBy("created_at","desc").offset(20).limit(100).execute();if(S.length===0)return v<500;let y=S.reduce((_,E)=>_+(E.execution_time||0),0)/S.length;return v<y*1.5;default:return!1}}async dynamicEvaluation(e){let t=this.cortex.llmFast||this.cortex.llm;if(!t)return!0;let i=await this.db.selectFrom(this.config.metricsTable||"agent_metrics").limit(10).execute(),s=`
280
- You are a Logic Verification Engine for NOORMME.
281
- TESTRUN: "${e.name}"
282
- SCRIPT: "${e.script}"
283
- EXPECTED: "${e.expected_outcome||"Unspecified"}"
284
-
285
- DB CONTEXT (Sample Metrics):
286
- ${JSON.stringify(i,null,2)}
287
-
288
- TASK:
289
- Evaluate if the script passes based on the context.
290
- If the script is a natural language requirement, infer the result.
291
- RETURN ONLY "PASS" OR "FAIL".
292
- `;return(await t.complete({prompt:s,temperature:.1,maxTokens:5})).content.toUpperCase().includes("PASS")}}});var G1,Mx=g(()=>{"use strict";G1=class{db;config;telemetryTable;constructor(e,t={}){this.db=e,this.config=t,this.telemetryTable=t.telemetryEventsTable||"agent_telemetry_events"}async harvest(e,t,i,s){if(i.length>102400){console.warn(`[EventHarvester] DROPPING EVENT: Content exceeds 100KB safety limit (${i.length} bytes)`);return}let n=s&&typeof s=="object"?s:{};try{await this.db.insertInto(this.telemetryTable).values({session_id:e,type:t,content:i.substring(0,5e4),metadata:JSON.stringify(n),created_at:new Date}).execute()}catch(a){console.warn(`[EventHarvester] Failed to harvest event: ${a}`)}}}});var K1,kx=g(()=>{"use strict";K1=class{db;config;evolutionTable;constructor(e,t={}){this.db=e,this.config=t,this.evolutionTable=t.sessionEvolutionTable||"agent_session_evolution"}async synthesize(e,t,i){let s=this.config.cortex,n=this.inferGoalFromContent(t);if(s?.reasoner){let o=await s.reasoner.analyzeIntent(t);o.goal&&(n=o.goal)}let a=i||this.detectStrategy(t);try{await this.db.transaction().execute(async o=>{let l=await o.selectFrom(this.evolutionTable).selectAll().where("session_id","=",e).executeTakeFirst();if(l){let c=this.parsePath(l.evolution_path),d=this.detectSentimentDrift(t);(l.inferred_goal!==n||l.strategy!==a||l.metadata&&JSON.parse(l.metadata).lastSentiment!==d)&&c.push({timestamp:new Date().toISOString(),previousGoal:l.inferred_goal,newGoal:n,strategyShift:a,sentiment:d}),await o.updateTable(this.evolutionTable).set({inferred_goal:n,strategy:a,evolution_path:JSON.stringify(c),status:"active",metadata:JSON.stringify({...JSON.parse(l.metadata||"{}"),lastSentiment:d,pivots:c.length}),autonomy_level:this.calculateAutonomy(c.length,l.autonomy_level||1),updated_at:new Date}).where("session_id","=",e).execute()}else await o.insertInto(this.evolutionTable).values({session_id:e,inferred_goal:n,strategy:a,evolution_path:JSON.stringify([{timestamp:new Date().toISOString(),event:"session_start",initialGoal:n}]),status:"active",autonomy_level:1,updated_at:new Date}).execute()})}catch(o){throw console.error(`[CognitiveSynthesizer] Fatal synthesis failure for session ${e}:`,o),new Error(`Behavioral synthesis failed: ${o instanceof Error?o.message:String(o)}`)}}async trackShift(e,t){try{await this.db.transaction().execute(async i=>{let s=await i.selectFrom(this.evolutionTable).selectAll().where("session_id","=",e).executeTakeFirst();if(!s)return;let n=this.parsePath(s.evolution_path);n.push({timestamp:new Date().toISOString(),type:"shift",shift:t,reason:t==="abandonment"?"User manual termination or lack of progress":"Strategic goal shift"}),await i.updateTable(this.evolutionTable).set({status:t==="pivot"?"pivoted":"abandoned",strategy:t==="pivot"?"Strategic Pivot":"Terminated",evolution_path:JSON.stringify(n),updated_at:new Date}).where("session_id","=",e).execute()})}catch(i){console.error(`[CognitiveSynthesizer] Failed to track shift for session ${e}:`,i)}}inferGoalFromContent(e){let t=e.trim().replace(/\n/g," "),i=t.match(/(?:please |can you |let's )?(implement|fix|refactor|add|search|analyze|delete|evolve) .+/i);if(i)return i[0].substring(0,100)+(i[0].length>100?"...":"");if(t.length<100)return t;let s=["need","want","please","can you","implement","fix","add"];for(let n of s){let a=t.toLowerCase().indexOf(n);if(a!==-1)return t.substring(a,a+80)+"..."}return t.substring(0,80)+"..."}detectStrategy(e){let t=e.toLowerCase();return t.includes("debug")||t.includes("fix")||t.includes("error")||t.includes("broken")?"Diagnostic Repair":t.includes("create")||t.includes("build")||t.includes("implement")||t.includes("new file")?"Generative Construction":t.includes("research")||t.includes("explain")||t.includes("how")||t.includes("investigate")?"Knowledge Acquisition":t.includes("evolve")||t.includes("mutate")||t.includes("dna")?"Self-Evolutionary":"Adaptive Exploration"}calculateAutonomy(e,t){return e>10?Math.max(1,t-1):e>5&&t>2?t:e===0?Math.min(5,t+1):t}detectSentimentDrift(e){let t=e.toLowerCase(),i=["slow","wrong","bad","error","failed","cannot","stuck"],s=["great","correct","good","success","works","yes"],n=i.filter(o=>t.includes(o)).length,a=s.filter(o=>t.includes(o)).length;return n>a+1?"frustration":a>n?"flow":"neutral"}parsePath(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}}});var J1,Ix=g(()=>{"use strict";J1=class{db;config;metricsTable;constructor(e,t={}){this.db=e,this.config=t,this.metricsTable=t.researchMetricsTable||"agent_research_metrics"}async transmute(e,t,i,s){let n=this.config.research?.magicCeiling||100;if(t==="time_to_magic"&&(i<0||i>n)){console.warn(`[ResearchAlchemist] Filtering outlier magic score: ${i}`);return}try{await this.db.insertInto(this.metricsTable).values({session_id:e,metric_name:t,value:i,metadata:s?JSON.stringify(s):null,created_at:new Date}).execute(),t==="discovery_index"&&await this.calculateDiscoveryVelocity(e)}catch(a){console.warn(`[ResearchAlchemist] Failed to transmute metric ${t}: ${a}`)}}async calculateDiscoveryVelocity(e){let t=this.config.research?.velocityWindowMinutes*60*1e3||6e5,i=await this.db.selectFrom(this.metricsTable).select(a=>a.fn.count("id").as("count")).where("session_id","=",e).where("metric_name","=","discovery_index").where("created_at",">",new Date(Date.now()-t)).executeTakeFirst(),n=Number(i?.count||0)/10;await this.db.insertInto(this.metricsTable).values({session_id:e,metric_name:"discovery_velocity",value:n,created_at:new Date}).execute()}async trackDiscovery(e,t){let i=await this.db.selectFrom(this.metricsTable).select(a=>a.fn.count("id").as("count")).where("metric_name","=","discovery_index").where("metadata","like",`%${t.replace(/[%_]/g,"")}%`).executeTakeFirst(),s=Number(i?.count||0),n=Math.max(0,1-Math.log10(s+1));await this.transmute(e,"discovery_index",n,{taskType:t,occurrenceCount:s,isInitialDiscovery:s===0,timestamp:Date.now()})}async recordMagic(e,t){await this.transmute(e,"time_to_magic",t)}}});var X1,Px=g(()=>{"use strict";Mx();kx();Ix();X1=class{db;config;harvester;synthesizer;alchemist;circuitBreakerActive=!1;failureCount=0;lastFailureTime=0;constructor(e,t={}){this.db=e,this.config=t,this.harvester=new G1(e,t),this.synthesizer=new K1(e,t),this.alchemist=new J1(e,t)}async track(e,t,i,s){if(this.circuitBreakerActive){if(Date.now()-this.lastFailureTime>6e4)console.log("[TelemetryOrchestrator] Attempting circuit recovery..."),this.circuitBreakerActive=!1,this.failureCount=0;else if(t!=="error"&&t!=="magic")return}try{await this.harvester.harvest(e,t,i,s),(t==="prompt"||t==="action")&&await this.synthesizer.synthesize(e,i),t==="magic"&&await this.alchemist.recordMagic(e,s?.surpriseScore||1),(t==="pivot"||t==="error")&&await this.synthesizer.trackShift(e,t==="pivot"?"pivot":"abandonment")}catch(n){this.failureCount++,this.lastFailureTime=Date.now(),console.error(`[TelemetryOrchestrator] SENSOR FAILURE (${this.failureCount}): ${n}`),this.failureCount>5&&(console.error("[TelemetryOrchestrator] CIRCUIT BREAKER TRIPPED. Entering degraded mode."),this.circuitBreakerActive=!0)}}async logResearchMetric(e,t,i,s){await this.alchemist.transmute(e,t,i,s)}}});var J3,Y1,Ox=g(()=>{"use strict";J3=class{cortex;synthesizer;name="AISynthesisEngine";constructor(e,t){this.cortex=e,this.synthesizer=t}async synthesize(e){let t=0,i=3,s=this.cortex.llmPremium||this.cortex.llm;for(;t<i;)try{let n=this.buildMutationPrompt(e);if(!s)return console.warn("[SkillSynthesizer] No LLMProvider available. Skipping synthesis."),{mutatedDescription:e.existingDescription||"Unmodified skill (Synthesis skipped: No LLM)",mutatedMetadata:{synthesis_status:"skipped_no_llm"},version:`1.0.${Date.now()}`};let a=await s.complete({prompt:n,responseFormat:"json",temperature:.3});a.usage&&(this.synthesizer.totalTokensConsumed+=a.usage.totalTokens);try{let o=JSON.parse(a.content);return{mutatedDescription:o.description||e.existingDescription,mutatedMetadata:{...o.metadata,synthesis_engine:this.cortex.llmPremium?"Tiered-Premium":"Production-LLM",failure_context_size:e.failures.length},version:`1.0.${Date.now()}`}}catch{throw new Error("Synthesis parse failure")}}catch(n){if(t++,t>=i)throw n;await new Promise(a=>setTimeout(a,1e3*t))}throw new Error("Synthesis failed after maximum retries")}async synthesizeBatch(e){let t=this.cortex.llmFast||this.cortex.llm;if(!t)return[];let i=`
293
- You are a Meta-Evolutionary AI Engine optimizing multiple tools in parallel.
294
-
295
- TOOLS TO MUTATE:
296
- ${e.map((n,a)=>`
297
- [Tool ${a+1}: ${this.sanitizeInput(n.targetTool)}]
298
- Current Description: ${this.sanitizeInput(n.existingDescription||"None")}
299
- Failure Patterns:
300
- ${n.failures.map(o=>`- Args: ${this.sanitizeInput(JSON.stringify(o.arguments))}, Error: ${this.sanitizeInput(o.error||"None")}`).join(`
301
- `)}
302
- `).join(`
303
- `)}
304
-
305
- TASK:
306
- For each tool, provide a mutation as a JSON array of objects:
307
- [
308
- {
309
- "tool": "tool_name",
310
- "description": "Updated tool description",
311
- "metadata": { "fixed_edge_cases": [...], "reasoning": "..." }
312
- },
313
- ...
314
- ]
315
- `,s=await t.complete({prompt:i,responseFormat:"json",temperature:.2});s.usage&&(this.synthesizer.totalTokensConsumed+=s.usage.totalTokens);try{return JSON.parse(s.content).map(a=>({tool:a.tool,mutation:{mutatedDescription:a.description,mutatedMetadata:a.metadata,version:`1.0.${Date.now()}`}}))}catch{return[]}}buildMutationPrompt(e){let t=e.failures.map((i,s)=>`${s+1}. Args: ${this.sanitizeInput(JSON.stringify(i.arguments))}, Error: ${this.sanitizeInput(i.error||"None")}`).join(`
316
- `);return`
317
- You are a Meta-Evolutionary AI Engine optimizing a tool: "${this.sanitizeInput(e.targetTool)}".
318
- Analyze FAILURES and rewrite the description to prevent them.
319
-
320
- EXISTING: "${this.sanitizeInput(e.existingDescription||"None")}"
321
- FAILURES:
322
- ${t}
323
-
324
- RETURN JSON: { "description": "...", "metadata": { "fixed": [...], "reason": "..." } }
325
- `}sanitizeInput(e){return e.slice(0,1e3).replace(/[\u0000-\u001F\u007F-\u009F]/g,"").replace(/<\|.*?\|>/g,"")}},Y1=class{db;cortex;config;evolutionConfig;actionsTable;strategy;totalTokensConsumed=0;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.evolutionConfig=i.evolution||{verificationWindow:20,rollbackThresholdZ:2.5,enableHiveLink:!0,mutationAggressiveness:.5,maxSandboxSkills:5},this.actionsTable=i.actionsTable||"agent_actions",this.strategy=new J3(this.cortex,this)}async preWarmSkill(e){let i=(await this.cortex.capabilities.getCapabilities("experimental")).find(n=>n.name===e);if(!i)return;let s=await this.strategy.synthesize({targetTool:i.name,failures:[],existingDescription:i.description,evolutionConfig:this.evolutionConfig});await this.db.updateTable(this.cortex.agenticConfig.capabilitiesTable||"agent_capabilities").set({description:s.mutatedDescription,metadata:JSON.stringify({...i.metadata,pre_warmed:!0,pre_warmed_at:new Date}),updated_at:new Date}).where("name","=",e).execute()}async discoverAndSynthesize(){console.log("[SkillSynthesizer] Analyzing telemetry for parallel gaps (Ultra-Scale Batch)...");let e=await this.db.selectFrom(this.actionsTable).select(["tool_name","arguments","outcome","metadata","created_at"]).where("status","=","failure").orderBy("created_at","desc").limit(200).execute();if(e.length<3)return[];let t=new Map;for(let a of e){let o=a.tool_name;t.has(o)||t.set(o,[]),t.get(o).push(a)}let i=[];for(let[a,o]of t.entries())o.length>=3&&i.push({tool:a,failures:o});if(i.length===0)return[];let s=new Map;for(let a of i){let o=a.tool.split("_")[0]||"general";s.has(o)||s.set(o,[]),s.get(o).push(a)}await this.pruneSandboxIfNeeded();let n=[];for(let[a,o]of s.entries()){let l=await Promise.all(o.map(async c=>({targetTool:c.tool,failures:c.failures.map(d=>({arguments:typeof d.arguments=="string"?JSON.parse(d.arguments):d.arguments,error:d.outcome,timestamp:new Date(d.created_at)})),evolutionConfig:this.evolutionConfig})));if(o.length>1&&(this.cortex.llmFast||this.cortex.llm)){let c=await this.strategy.synthesizeBatch(l);for(let d of c){let p=await this.registerMutation(d.tool,d.mutation);p&&n.push(p)}}else for(let c of l){let d=await this.strategy.synthesize(c),p=await this.registerMutation(c.targetTool,d);p&&n.push(p)}}return n}async registerMutation(e,t){return await this.cortex.capabilities.registerCapability(e,t.version,t.mutatedDescription,{initialStatus:"experimental",mutatedFrom:e,lineage:t.mutatedMetadata?.lineage||e,variant_tag:`v${Date.now()}`,synthesis_engine:"Ultra-Scale-Tiered",...t.mutatedMetadata,synthesized_at:new Date})}async pruneSandboxIfNeeded(){let e=await this.cortex.capabilities.getCapabilities("experimental"),t=this.evolutionConfig.maxSandboxSkills||5;if(e.length>=t){let i=e.sort((s,n)=>s.reliability-n.reliability).slice(0,Math.ceil(e.length*.2));await this.db.transaction().execute(async s=>{for(let n of i)await s.deleteFrom(this.cortex.agenticConfig.capabilitiesTable||"agent_capabilities").where("id","=",n.id).execute()})}}}});var Z1,Dx=g(()=>{"use strict";Z1=class{db;cortex;config;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i}async execute(){console.log("[EvolutionRitual] Initiating seamless skill growth sequence...");let e={synthesized:0,broadcasted:0,domainsSynced:[]},t=await this.cortex.skillSynthesizer.discoverAndSynthesize();e.synthesized=t.length;let i=await this.cortex.hive.broadcastSkills();e.broadcasted=i;let s=await this.identifyActiveDomains();for(let n of s)await this.checkDomainMaturity(n)?(console.log(`[EvolutionRitual] Domain '${n}' is MATURE. Applying wholesale stability boost.`),await this.cortex.hive.syncDomain(n,.15)):await this.cortex.hive.syncDomain(n,.05),e.domainsSynced.push(n);return console.log(`[EvolutionRitual] Completed: ${e.synthesized} synthesized, ${e.broadcasted} broadcasted, ${e.domainsSynced.length} domains boosted.`),e}async checkDomainMaturity(e){let t=await this.db.selectFrom(this.config.capabilitiesTable||"agent_capabilities").select(["reliability"]).where("name","like",`${e}%`).execute();return t.length<3?!1:t.reduce((s,n)=>s+n.reliability,0)/t.length>=.95}async identifyActiveDomains(){let e=new Map,t=new Date(Date.now()-1440*60*1e3),i=0,s=1e3;for(;;){let n=await this.db.selectFrom(this.config.knowledgeTable||"agent_knowledge_base").select(["tags","confidence"]).where("updated_at",">",t).orderBy("updated_at","asc").limit(s).offset(i).execute();if(n.length===0)break;for(let a of n){let o=typeof a.tags=="string"?JSON.parse(a.tags):a.tags||[];for(let l of o){if(l==="hive_mind")continue;let c=e.get(l)||0;e.set(l,c+(a.confidence||0))}}if(n.length<s)break;i+=s}return Array.from(e.entries()).filter(([n,a])=>a>=1).sort((n,a)=>a[1]-n[1]).slice(0,3).map(([n])=>n)}}});var ef,$x=g(()=>{"use strict";at();ef=class{db;cortex;config;resourcesTable;metricsTable;rateCache=new Map;CACHE_TTL=1e3*60*60;constructor(e,t,i={}){this.db=e,this.cortex=t,this.config=i,this.resourcesTable=i.resourcesTable||"agent_resource_usage",this.metricsTable=i.metricsTable||"agent_metrics"}async checkQuota(e,t=null){let i=await this.getActiveQuotas(e,t);for(let s of i){let n=await this.getCurrentUsage(s),a=n;if(s.metric==="cost"&&s.metadata?.currency&&s.metadata.currency!=="USD"){let o=await this.getExchangeRate(s.metadata.currency);a=n*o}if(a>=s.limit){let o=s.metric==="cost"?`${s.metadata?.currency||"$"}${s.limit}`:`${s.limit}`;return{allowed:!1,reason:`Quota exceeded: ${s.metric} limit is ${o}, current is ${a.toFixed(4)} (${s.period})`}}}return{allowed:!0}}async getActiveQuotas(e,t){let i=[],s=await this.cortex.policies.getActivePolicies();for(let n of s)n.type==="budget"&&(n.definition.targetType===e||!n.definition.targetType&&e==="global")&&i.push({id:n.id,targetType:e,targetId:t,metric:n.definition.metric||"cost",limit:n.definition.limit||0,period:n.definition.period||"hourly",currentUsage:0,createdAt:n.createdAt,updatedAt:n.updatedAt,metadata:n.metadata});if(e==="persona"&&t){let n=await this.db.selectFrom(this.config.personasTable||"agent_personas").select("metadata").where("id","=",t).executeTakeFirst();if(n){let a=typeof n.metadata=="string"?JSON.parse(n.metadata):n.metadata||{};a.quotas&&i.push(...a.quotas)}}return i}async getCurrentUsage(e){let t=this.getPeriodInMs(e.period),i=new Date(Date.now()-t),s=this.db.selectFrom(this.resourcesTable).where("created_at",">",i);e.targetType==="persona"&&e.targetId?s=s.where("agent_id","=",e.targetId):e.targetType==="swarm"&&e.targetId&&(s=s.where(c=>c.or([c(C`json_extract(metadata, '$.swarm_id')`,"=",e.targetId),c(C`metadata->>'swarm_id'`,"=",String(e.targetId))])));let n=e.metric==="cost"?"cost":e.metric==="tokens_input"?"input_tokens":e.metric==="tokens_output"?"output_tokens":C`input_tokens + output_tokens`,a=await s.select(c=>c.fn.sum(n).as("total")).executeTakeFirst(),o=Number(a?.total||0);return o<1e-10?0:o}async getExchangeRate(e){let t=this.rateCache.get(e);if(t&&Date.now()-t.timestamp<this.CACHE_TTL)return t.rate;let i=await this.db.selectFrom(this.metricsTable).select(["metric_value","created_at"]).where("metric_name","=",`exchange_rate_${e}`).orderBy("created_at","desc").executeTakeFirst();if(i&&Date.now()-new Date(i.created_at).getTime()<this.CACHE_TTL*24){let a=Number(i.metric_value);return this.rateCache.set(e,{rate:a,timestamp:Date.now()}),a}let n={ETH:32e-5,BTC:15e-6,EUR:.92,GBP:.79}[e]||1;return console.warn(`[QuotaManager] Exchange rate for ${e} is stale or missing. Using hardened fallback: ${n}`),n}async syncExchangeRates(e){await this.db.transaction().execute(async t=>{for(let[i,s]of Object.entries(e))await t.insertInto(this.metricsTable).values({metric_name:`exchange_rate_${i}`,metric_value:s,created_at:new Date}).execute(),this.rateCache.set(i,{rate:s,timestamp:Date.now()})}),console.log(`[QuotaManager] Synchronized ${Object.keys(e).length} exchange rates.`)}getPeriodInMs(e){switch(e){case"hourly":return 36e5;case"daily":return 864e5;case"monthly":return 864e5*30;case"infinite":return Date.now();default:return 36e5}}}});var tf,X3=g(()=>{"use strict";y1();E3();w1();N3();C3();A3();R3();M3();k3();I3();P3();O3();D3();$3();F3();L3();q3();B3();W3();z3();Rx();U3();j3();V3();H3();Q3();G3();K3();Px();Ox();Dx();$x();tf=class{db;config;sessions;buffer;vectors;reflections;knowledge;actions;resources;episodes;capabilities;policies;metrics;evolution;compressor;personas;janitor;reasoner;rules;governor;pilot;conflicts;goalArchitect;curiosity;rituals;refiner;hive;strategy;ablation;tests;telemetry;skillSynthesizer;evolutionRitual;quotas;llm;llmFast;llmPremium;agenticConfig;constructor(e,t){this.db=e,this.config=t;let i=t.agentic||{};this.agenticConfig=i,this.llm=i.llm||null,this.llmFast=i.llmFast||this.llm,this.llmPremium=i.llmPremium||this.llm,this.telemetry=new X1(e,i),this.sessions=new cl(e,i,this.telemetry),this.buffer=new v1({maxMessages:i.contextWindowSize}),this.vectors=i.vectorConfig?new dl(e,i.vectorConfig,i.memoriesTable):null,this.reflections=new S1(e,i),this.knowledge=new x1(e,i),this.actions=new T1(e,i,this.telemetry),this.resources=new _1(e,i),this.episodes=new E1(e,i),this.capabilities=new N1(e,this,i),this.policies=new C1(e,i),this.metrics=new M1(e,i),this.evolution=new I1(e,t),this.compressor=new A1(e,i),this.personas=new R1(e,i),this.janitor=new O1(e,i),this.reasoner=new D1(e,i),this.rules=new $1(e,i),this.governor=new F1(e,this,i),this.pilot=new L1(e,this,i),this.conflicts=new q1(e,i),this.goalArchitect=new B1(e,i),this.curiosity=new W1(e,i),this.rituals=new z1(e,this,i),this.refiner=new U1(e,this,i),this.hive=new j1(e,this,i),this.strategy=new V1(e,this,i),this.ablation=new H1(e,this,i),this.tests=new Q1(e,this,i),this.skillSynthesizer=new Y1(e,this,i),this.evolutionRitual=new Z1(e,this,i),this.quotas=new ef(e,this,i)}executionLock=!1;async selfIterate(){if(this.executionLock){console.warn("[Cortex] Self-iteration already in progress. Skipping pulse.");return}this.executionLock=!0,console.log("[Cortex] Initiating Autonomous Soul-Searching Loop v2 (Deep Hardening Pass)...");try{await this.#e("Audit",()=>this.governor.performAudit()),await this.#e("Self-Tests",()=>this.tests.runAllProbes()),await this.#e("Rituals",()=>this.rituals.runPendingRituals()),await this.#e("Action Refinement",()=>this.refiner.refineActions()),await this.#e("Zombie Pruning",()=>this.ablation.pruneZombies()),await this.#e("Ablation Monitoring",()=>this.ablation.monitorAblationPerformance()),await this.#e("Strategy Mutation",()=>this.strategy.mutateStrategy()),await this.#e("Evolution Pulse",()=>this.evolutionRitual.execute()),await this.#e("Knowledge Broadcast",()=>this.hive.broadcastKnowledge()),await this.#e("Skill Synthesis",()=>this.skillSynthesizer.discoverAndSynthesize()),await this.#e("Improvement Cycle",()=>this.pilot.runSelfImprovementCycle()),console.log("[Cortex] Soul-Searching loop completed.")}catch(e){console.error("[Cortex] Soul-Searching loop failed:",e),await this.telemetry.track("system","error","Self-iteration failed",{error:String(e)})}finally{this.executionLock=!1}}async#e(e,t){try{await t()}catch(i){console.error(`[Cortex] Ritual '${e}' failed but pulse continuing:`,i),await this.telemetry.track("system","error",`Ritual failure: ${e}`,{ritual:e,error:String(i)})}}async resumeSession(e,t=20){let i=await this.sessions.getHistory(e,t);return this.buffer.setMessages(i),i}async recordInteraction(e,t,i,s={}){let n=await this.sessions.addMessage(e,t,i),a=t==="user"?"prompt":t==="assistant"?"output":"action";await this.telemetry.track(e,a,i,{role:t,messageId:n.id}),s.index&&s.embedding&&this.vectors&&await this.vectors.addMemory(i,s.embedding,e)}}});var Fx,Lx,rf,Id,qx=g(()=>{"use strict";g4();PS();m3();OS();h3();DS();pd();i1();Fx=k(WS(),1);US();VS();Dy();$y();N4();Oy();Lx=k(Ex(),1);ed();y1();w1();_3();X3();k1();nS();rf=new Map,Id=class{db;config;dialect;schemaDiscovery;typeGenerator;repositoryFactory;relationshipEngine;cacheManager;logger;schemaWatcher=null;metricsCollector=null;sqliteAutoOptimizer=null;sqliteAutoIndexer=null;initialized=!1;repositories=new Map;instanceId;schemaChangeCallbacks=[];agent;constructor(e){(0,Fx.config)({path:".env"});let t;if(e)typeof e=="string"?t=this.parseConnectionString(e):t=e;else{let s=process.env.DATABASE_URL;if(!s)throw new Xe("No database configuration provided",{operation:"initialization",suggestion:"Either pass a connection string or set DATABASE_URL in .env"});t=this.parseConnectionString(s)}this.config=this.mergeConfig(t),this.logger=new xi(this.config.logging),this.cacheManager=new a1(this.config.cache),this.instanceId=`${this.config.dialect}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,this.dialect=this.createDialect(),this.db=new Co({dialect:this.dialect,log:this.config.logging?.enabled?this.logger.createKyselyLogger():void 0}),this.schemaDiscovery=new Zh(this.db,this.config.introspection,this.dialect),this.typeGenerator=new nl(this.config.introspection);let i=this.config.agentic||{};this.agent={sessions:new cl(this.db,i),vectors:i.vectorConfig?new dl(this.db,i.vectorConfig,i.memoriesTable):null,schema:new b1(this.db,i),cortex:new tf(this.db,this.config),evolution:new pl(this.db)},this.repositoryFactory=new n1(this.db,this.config.performance,this.agent.cortex),this.relationshipEngine=new al(this.db,this.config.performance)}async initialize(){if(this.initialized){this.logger.warn("NOORMME already initialized");return}let e=`${this.config.dialect}-${this.config.connection.database||"default"}`;if(rf.has(e)&&(this.logger.info(`Waiting for another instance to finish initializing ${e}...`),await rf.get(e),this.initialized)){this.logger.warn("NOORMME already initialized after waiting");return}let t=this._doInitialize();rf.set(e,t);try{await t}finally{rf.delete(e)}}async _doInitialize(){try{this.logger.info("Initializing NOORMME...");let e=this.dialect.createIntrospector(this.db),t=[];try{t=await e.getTables(),this.logger.info("Database connection successful")}catch(n){this.logger.warn("Database connection test failed, but continuing with initialization:",n)}this.logger.info("Discovering database schema...");let i;try{i=await this.schemaDiscovery.discoverSchema(),this.logger.info(`Discovered ${i.tables.length} tables`)}catch(n){if(process.env.NODE_ENV==="test")throw this.logger.error("Schema discovery failed in test mode:",n),new Error(`Schema discovery failed: ${n instanceof Error?n.message:String(n)}`);this.logger.warn("Schema discovery failed, using empty schema:",n),i={tables:[],relationships:[],views:[]}}this.logger.info("Generating TypeScript types...");let s;try{s=this.typeGenerator.generateTypes(i),this.logger.info(`Generated types for ${s.entities.length} entities`)}catch(n){this.logger.warn("Type generation failed, using empty types:",n),s={entities:[],relationships:[],types:{}}}try{await this.cacheManager.set("schema",i),await this.cacheManager.set("types",s)}catch(n){this.logger.warn("Failed to cache schema/types, continuing without cache:",n)}try{this.relationshipEngine.initialize(i.relationships)}catch(n){this.logger.warn("Failed to initialize relationship engine:",n)}this.metricsCollector=new Rd({enabled:process.env.NODE_ENV==="development",slowQueryThreshold:1e3,nPlusOneDetection:!0,missingIndexDetection:!0,persistPath:process.env.NOORMME_METRICS_PATH||".noormme/metrics.json"},this.logger),this.config.dialect==="sqlite"&&(this.sqliteAutoOptimizer=jo.getInstance(this.logger),this.sqliteAutoIndexer=Vo.getInstance(this.logger),this.config.automation?.enableAutoOptimization!==!1&&await this.applySQLiteAutoOptimizations()),this.initialized=!0,this.logger.info("NOORMME initialized successfully!")}catch(e){throw this.logger.error("Failed to initialize NOORMME:",e),e}}isInitialized(){return this.initialized}async applySQLiteAutoOptimizations(){if(this.sqliteAutoOptimizer)try{this.logger.info("Applying SQLite auto-optimizations...");let e=this.sqliteAutoOptimizer.getDefaultConfig(),t=await this.sqliteAutoOptimizer.optimizeDatabase(this.db,e);t.appliedOptimizations.length>0&&(this.logger.info(`Applied ${t.appliedOptimizations.length} SQLite optimizations`),t.appliedOptimizations.forEach(i=>this.logger.debug(` \u2713 ${i}`))),t.recommendations.length>0&&(this.logger.info(`Generated ${t.recommendations.length} recommendations`),t.recommendations.forEach(i=>this.logger.debug(` \u{1F4A1} ${i}`))),t.warnings.length>0&&(this.logger.warn(`Found ${t.warnings.length} warnings`),t.warnings.forEach(i=>this.logger.warn(` \u26A0\uFE0F ${i}`)))}catch(e){this.logger.warn("Failed to apply SQLite auto-optimizations:",e)}}async getSQLiteOptimizations(){if(this.config.dialect!=="sqlite"||!this.sqliteAutoOptimizer)throw new Xe("SQLite optimizations are only available for SQLite databases");let e=this.sqliteAutoOptimizer.getDefaultConfig();return await this.sqliteAutoOptimizer.optimizeDatabase(this.db,e)}async getSQLiteIndexRecommendations(e){if(this.config.dialect!=="sqlite"||!this.sqliteAutoIndexer)throw new Xe("SQLite index recommendations are only available for SQLite databases");return await this.sqliteAutoIndexer.analyzeAndRecommend(this.db,e)}recordQuery(e,t,i){this.config.dialect==="sqlite"&&this.sqliteAutoIndexer&&this.sqliteAutoIndexer.recordQuery(e,t,i),this.metricsCollector&&this.metricsCollector.recordQuery(e,t,{table:i})}async getSQLitePerformanceMetrics(){if(this.config.dialect!=="sqlite"||!this.sqliteAutoOptimizer)throw new Xe("SQLite performance metrics are only available for SQLite databases");return await this.sqliteAutoOptimizer.analyzeDatabase(this.db)}async getSQLiteBackupRecommendations(){if(this.config.dialect!=="sqlite"||!this.sqliteAutoOptimizer)throw new Xe("SQLite backup recommendations are only available for SQLite databases");return await this.sqliteAutoOptimizer.getBackupRecommendations(this.db)}getCacheStatistics(){return this.cacheManager.getStats()}getMigrationManager(){if(this.config.dialect!=="sqlite")throw new Xe("Migration manager is currently only available for SQLite");return jh.getInstance(this.db,this.config.automation,this.logger)}getRepository(e){if(!this.initialized)throw new Error("NOORMME must be initialized before getting repositories. Call await db.initialize() first.");if(this.repositories.has(e))return this.repositories.get(e);let t=this.cacheManager.get("schema");if(!t)throw new Error("Schema not found. Please reinitialize NOORMME.");let i=t.tables.find(n=>n.name===e);if(!i){let n=t.tables.map(a=>a.name);throw new e1(e,n)}let s=this.repositoryFactory.createRepository(i,t.relationships);return this.repositories.set(e,s),s}async getSchemaInfo(){if(!this.initialized)throw new Error("NOORMME must be initialized first");let e=this.cacheManager.get("schema");return e||await this.schemaDiscovery.discoverSchema()}async refreshSchema(){this.logger.info("Refreshing schema...");let e=await this.schemaDiscovery.discoverSchema(),t=this.typeGenerator.generateTypes(e);return await this.cacheManager.set("schema",e),await this.cacheManager.set("types",t),this.repositories.clear(),this.relationshipEngine.initialize(e.relationships),this.logger.info("Schema refreshed successfully"),e}updateConfig(e){this.config=this.mergeConfig({...this.config,...e}),this.config.logging&&this.logger.updateConfig(this.config.logging),this.config.cache&&this.cacheManager.updateConfig(this.config.cache),this.logger.info("Configuration updated")}async startSchemaWatching(e){if(!this.initialized)throw new Xe("NOORMME must be initialized before starting schema watching");this.schemaWatcher&&this.schemaWatcher.stopWatching(),this.schemaWatcher=new l1(this.db,this.schemaDiscovery,this.logger,e);for(let t of this.schemaChangeCallbacks)this.schemaWatcher.onSchemaChange(t);this.schemaWatcher.onSchemaChange(async t=>{this.logger.info(`Schema changes detected: ${t.length} changes`),t.forEach(i=>{this.logger.info(` - ${i.type}: ${i.table}`)});try{await this.refreshSchema(),this.logger.info("Schema refreshed successfully")}catch(i){this.logger.error("Failed to refresh schema:",i)}}),await this.schemaWatcher.startWatching()}stopSchemaWatching(){this.schemaWatcher&&this.schemaWatcher.stopWatching()}onSchemaChange(e){this.schemaChangeCallbacks.push(e),this.schemaWatcher&&this.schemaWatcher.onSchemaChange(e)}getPerformanceMetrics(){let e={queryCount:this.logger.getQueryCount(),averageQueryTime:this.logger.getAverageQueryTime(),cacheHitRate:this.cacheManager.getHitRate(),repositoryCount:this.repositories.size};return this.metricsCollector?{...e,...this.metricsCollector.getPerformanceStats()}:e}enablePerformanceMonitoring(e){if(!this.initialized)throw new Xe("NOORMME must be initialized before enabling performance monitoring");if(!this.cacheManager.get("schema"))throw new Xe("Schema not found. Please reinitialize NOORMME.");this.metricsCollector=new Rd({enabled:!0,slowQueryThreshold:e?.slowQueryThreshold||1e3,nPlusOneDetection:!0,missingIndexDetection:!0},this.logger),this.logger.info("Query performance monitoring enabled")}disablePerformanceMonitoring(){this.metricsCollector&&(this.metricsCollector.clear(),this.metricsCollector=null,this.logger.info("Query performance monitoring disabled"))}async close(){this.logger.info("Closing NOORMME..."),this.stopSchemaWatching(),await this.db.destroy(),await this.cacheManager.close(),this.initialized=!1,this.repositories.clear(),this.logger.info("NOORMME closed")}async destroy(){return this.close()}getKysely(){return this.db}async transaction(e){return await this.db.transaction().execute(e)}async execute(e,t){let i=Yr.raw(e,t||[]);return await this.db.executeQuery(i)}mergeConfig(e){return{dialect:e.dialect,connection:e.connection,introspection:{includeViews:!1,excludeTables:[],customTypeMappings:{},...e.introspection},cache:{ttl:3e5,maxSize:1e3,strategy:"lru",...e.cache},logging:{level:"info",enabled:!0,...e.logging},performance:{enableQueryOptimization:!0,enableBatchLoading:!0,maxBatchSize:100,...e.performance},agentic:e.agentic,automation:e.automation}}parseConnectionString(e){try{let t=new URL(e),i;switch(t.protocol){case"sqlite:":i="sqlite";break;case"postgres:":case"postgresql:":i="postgresql";break;case"mysql:":i="mysql";break;default:throw new Xe(`Unsupported database protocol: ${t.protocol}`,{operation:"connection_string_parsing",suggestion:"Supported protocols: sqlite, postgresql, postgres, mysql"})}if(i==="sqlite")return{dialect:i,connection:{database:t.pathname,host:"",port:0,username:"",password:""}};if(i==="postgresql"||i==="mysql"){let s=new URLSearchParams(t.search),n=s.get("ssl")||s.get("sslmode"),a=!1;return n&&(n==="true"||n==="require"?a=!0:n==="false"||n==="disable"?a=!1:a={rejectUnauthorized:n!=="allow"&&n!=="prefer"}),{dialect:i,connection:{host:t.hostname||"localhost",port:t.port?parseInt(t.port,10):this.getDefaultPort(i),database:t.pathname.replace(/^\//,""),username:t.username||void 0,password:t.password||void 0,ssl:a,pool:{max:s.get("pool_max")?parseInt(s.get("pool_max"),10):10,min:s.get("pool_min")?parseInt(s.get("pool_min"),10):0}}}}return{dialect:i,connection:{host:t.hostname||"localhost",port:t.port?parseInt(t.port):this.getDefaultPort(i),database:t.pathname.slice(1),username:t.username||"",password:t.password||"",ssl:t.searchParams.get("ssl")==="true"||t.searchParams.get("sslmode")==="require"}}}catch(t){throw new Xe(`Failed to parse connection string: ${t instanceof Error?t.message:String(t)}`,{operation:"connection_string_parsing",suggestion:"Ensure connection string format is: protocol://username:password@host:port/database"})}}getDefaultPort(e){switch(e){case"sqlite":return 0;case"postgresql":return 5432;case"mysql":return 3306;default:return 0}}createDialect(){let{dialect:e,connection:t}=this.config;switch(e){case"sqlite":return new Zm({database:new Lx.default(t.database)});case"postgresql":return new bh({poolConfig:{host:t.host,port:t.port,database:t.database,user:t.username,password:t.password,ssl:t.ssl,max:t.pool?.max??10,min:t.pool?.min??0,idleTimeoutMillis:t.pool?.idleTimeoutMillis??1e4}});default:throw new Error(`Unsupported dialect: ${e}`)}}}});var Bx=g(()=>{"use strict"});var Wx=g(()=>{"use strict"});var zx=g(()=>{"use strict"});var Ux=g(()=>{"use strict"});var jx=g(()=>{"use strict";g4();Xu();Kg();lo();H8();Q8();G8();K8();J8();Yu();$2();Wu();L2();Ln();h2();sm();M2();F2();q2();P2();d6();am();y6();Y2();J2();t2();b4();at();Y8();n4();ao();Z8();Zc();ed();r4();H6();Y6();K6();Z6();j6();Q6();V6();G6();pm();um();z6();J6();t4();X6();$6();i4();_c();cm();l4();t7();r7();s4();a4();i7();s7();n7();Hm();Qm();N4();o7();T4();_4();Xm();E4();Oy();Yb();ky();Iy();yh();Py();Zc();Zb();aS();mS();hS();fS();gS();io();yS();wS();bS();_6();mm();gm();rm();Wr();D6();Mn();Ns();hu();Bc();S6();Uc();e2();zc();Mt();A2();W2();zu();vS();lu();du();Fa();Mm();Yc();Dm();v6();E2();k6();Mc();N6();hm();vc();pu();uu();Pm();Cm();b2();s6();Hc();Rc();l6();M6();t6();p2();m2();ge();$n();qa();xu();f6();Ec();vu();Oc();Mu();V2();Ja();O6();e6();$u();R2();Xg();Ht();Vu();v4();SS();Pn();D2();In();wu();Cc();S2();Cu();Va();x2();c2();Jc();_u();Vr();qi();fu();jc();A6();W6();w2();Li();Tc();Jg();Qa();T2();em();xS();La();O2();b6();p6();Qc();Ga();g2();ja();fi();_2();Ka();kc();U2();TS();d4();_S();ES();c4();NS();qx();Bx();y1();E3();w1();X3();A3();R3();M3();k3();I3();P3();O3();N3();C3();D3();$3();W3();F3();L3();q3();z3();U3();j3();V3();H3();Q3();G3();K3();B3();f3();_3();k1();Wx();zx();Ux()});function Y3(){return!!((process.env.VSCODE_IPC_HOOK||process.env.VSCODE_PID||process.env.VSCODE_CWD||process.env.VSCODE_NLS_CONFIG)&&!process.env.MARIE_FORCE_CLI)}function xt(){if(Y3())try{let e=Zi("vscode").workspace.workspaceFolders?.[0]?.uri.fsPath;if(e)return e}catch{}return process.cwd()}var Vx,Zi,Ks=g(()=>{Vx=require("module");Zi=(()=>{let r=globalThis;if(typeof r.require<"u")return r.require;try{let e=(0,eval)("import.meta.url");if(e)return(0,Vx.createRequire)(e)}catch{}return e=>{throw new Error(`Execution Environment Error: Cannot require "${e}". Environment is incompatible with module resolution.`)}})()});var Qx={};qr(Qx,{ConfigService:()=>V});function QO(){return Y3()}function Te(){if(!QO())return null;if(!Hx){Hx=!0;try{let r=Zi("vscode"),e=r.version;!!r.marieShim||!e||typeof e!="string"||!e.startsWith("1.")?sf=null:sf=r}catch{sf=null}}return sf}function pr(){try{let r=Zi("fs"),e=Zi("path"),t=Zi("os"),i=e.join(t.homedir(),".marie","config.json");if(!r.existsSync(i))return{};let s=r.readFileSync(i,"utf-8");return JSON.parse(s)||{}}catch{try{let{Storage:r}=Zi("../monolith/cli/storage.js");return r.getConfig()||{}}catch{return{}}}}var sf,Hx,V,Ot=g(()=>{Ks();sf=null,Hx=!1;V=class{static _excludedFilesCache=null;static getVscodeConfig(){let e=Te();return e?e.workspace.getConfiguration("marie"):null}static isVscode(){return Te()!==null}static getApiKey(){let e=Te();return e?e.workspace.getConfiguration("marie").get("apiKey"):process.env.ANTHROPIC_API_KEY}static getOpenRouterApiKey(){let e=Te();return e?e.workspace.getConfiguration("marie").get("openrouterApiKey"):process.env.OPENROUTER_API_KEY}static getCerebrasApiKey(){let e=Te();return e?e.workspace.getConfiguration("marie").get("cerebrasApiKey"):process.env.CEREBRAS_API_KEY}static getAiProvider(){let e=Te();return e?e.workspace.getConfiguration("marie").get("aiProvider","anthropic"):pr().aiProvider||"anthropic"}static getModel(){let e=Te();return e?e.workspace.getConfiguration("marie").get("model","claude-3-5-sonnet-20241022"):pr().model||"claude-3-5-sonnet-20241022"}static getLlmFast(){let e=Te();return e?e.workspace.getConfiguration("marie").get("modelFast",this.getModel()):pr().modelFast||this.getModel()}static getLlmPremium(){let e=Te();return e?e.workspace.getConfiguration("marie").get("modelPremium",this.getModel()):pr().modelPremium||this.getModel()}static getAutonomyMode(){let e=Te();if(e){let s=e.workspace.getConfiguration("marie").get("autonomyMode");return s||"high"}let i=pr().autonomyMode;return i||"high"}static getMaxContextTokens(){let e=Te();return e?e.workspace.getConfiguration("marie").get("maxContextTokens",1e5):1e5}static getExcludedFiles(){let e=Te();if(e){if(this._excludedFilesCache)return this._excludedFilesCache;let t=e.workspace.getConfiguration("files").get("exclude",{}),i=Object.keys(t).filter(n=>t[n]),s=["node_modules","dist","build","out","coverage",".git",".vscode",".idea",".DS_Store"];return this._excludedFilesCache=Array.from(new Set([...s,...i])),this._excludedFilesCache}return["node_modules","dist","build","out","coverage",".git",".vscode",".idea",".DS_Store"]}static getKeepRecentMessages(){let e=Te();return e?e.workspace.getConfiguration("marie").get("keepRecentMessages",30):30}static getTokensPerChar(){let e=Te();return e?e.workspace.getConfiguration("marie").get("tokensPerChar",.35):.35}static isAscensionEnabled(){let e=Te();return e?e.workspace.getConfiguration("marie").get("ascensionEnabled",!0):!0}static getAscensionProfile(){let e=Te();return e?e.workspace.getConfiguration("marie").get("ascensionProfile","balanced"):"balanced"}static getAscensionIntensity(){let e=Te(),t=1;return e&&(t=e.workspace.getConfiguration("marie").get("ascensionIntensity",1.2)),Math.max(.5,Math.min(1.5,t))}static getAscensionMaxRequiredActions(){let e=Te(),t=2;return e&&(t=e.workspace.getConfiguration("marie").get("ascensionMaxRequiredActions",2)),Math.max(0,Math.min(5,t))}static isAgentStreamsEnabled(){let e=Te();if(e)return e.workspace.getConfiguration("marie").get("agentStreamsEnabled",!1);let i=pr().agentStreamsEnabled;return typeof i=="boolean"?i:process.env.MARIE_AGENT_STREAMS_ENABLED==="1"}static getAgentStreamMaxConcurrent(){let e=Te(),t=2;if(e)t=e.workspace.getConfiguration("marie").get("agentStreamMaxConcurrent",2);else{let i=pr();typeof i.agentStreamMaxConcurrent=="number"&&(t=i.agentStreamMaxConcurrent)}return Math.max(1,Math.min(8,t))}static getAgentStreamSpawnThreshold(){let e=Te(),t=1.25;if(e)t=e.workspace.getConfiguration("marie").get("agentStreamSpawnThreshold",1.25);else{let i=pr();typeof i.agentStreamSpawnThreshold=="number"&&(t=i.agentStreamSpawnThreshold)}return Math.max(.25,Math.min(5,t))}static getAgentStreamTimeoutMs(){let e=Te(),t=2e4;if(e)t=e.workspace.getConfiguration("marie").get("agentStreamTimeoutMs",6e4);else{let i=pr();typeof i.agentStreamTimeoutMs=="number"&&(t=i.agentStreamTimeoutMs)}return Math.max(3e3,Math.min(12e4,t))}static getAgentStreamPilotAgents(){let e=a=>Array.isArray(a)?a.filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean):typeof a=="string"?a.split(",").map(o=>o.trim()).filter(Boolean):[],t=Te();if(t){let a=t.workspace.getConfiguration("marie").get("agentStreamPilotAgents",["QASRE"]);return e(a).length>0?e(a):["QASRE"]}let i=pr(),s=e(i.agentStreamPilotAgents);if(s.length>0)return s;let n=e(process.env.MARIE_AGENT_STREAM_PILOT_AGENTS);return n.length>0?n:["QASRE"]}static getAgentStreamMaxSpawnsPerTurn(){let e=Te(),t=3;if(e)t=e.workspace.getConfiguration("marie").get("agentStreamMaxSpawnsPerTurn",3);else{let i=pr();typeof i.agentStreamMaxSpawnsPerTurn=="number"&&(t=i.agentStreamMaxSpawnsPerTurn)}return Math.max(1,Math.min(16,t))}static isAgentStreamPressureSheddingEnabled(){let e=Te();if(e)return e.workspace.getConfiguration("marie").get("agentStreamPressureSheddingEnabled",!0);let t=pr();return typeof t.agentStreamPressureSheddingEnabled=="boolean"?t.agentStreamPressureSheddingEnabled:process.env.MARIE_AGENT_STREAM_PRESSURE_SHEDDING_ENABLED!=="0"}static getAutoRepair(){let e=Te();return e?e.workspace.getConfiguration("marie").get("autoRepair",!1):pr().autoRepair||!1}}});var nf,Gx=g(()=>{nf=class{static async initializeSchema(e){console.log("[NoormmeSchema] Initializing Core Tables..."),await e.execute(`
326
- CREATE TABLE IF NOT EXISTS agent_rules (
327
- id INTEGER PRIMARY KEY AUTOINCREMENT,
328
- table_name TEXT NOT NULL,
329
- operation TEXT NOT NULL,
330
- action TEXT NOT NULL,
331
- condition TEXT,
332
- priority INTEGER DEFAULT 0,
333
- script TEXT,
334
- is_enabled INTEGER DEFAULT 1 NOT NULL,
335
- metadata TEXT,
336
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
337
- )
338
- `),await e.execute(`
339
- CREATE TABLE IF NOT EXISTS agent_resource_usage (
340
- id INTEGER PRIMARY KEY AUTOINCREMENT,
341
- session_id TEXT,
342
- agent_id TEXT,
343
- model_name TEXT NOT NULL,
344
- input_tokens INTEGER DEFAULT 0,
345
- output_tokens INTEGER DEFAULT 0,
346
- cost REAL DEFAULT 0,
347
- currency TEXT DEFAULT 'USD',
348
- metadata TEXT,
349
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
350
- )
351
- `),await e.execute(`
352
- CREATE TABLE IF NOT EXISTS agent_capabilities (
353
- id INTEGER PRIMARY KEY AUTOINCREMENT,
354
- name TEXT NOT NULL,
355
- version TEXT NOT NULL,
356
- description TEXT,
357
- status TEXT DEFAULT 'experimental',
358
- reliability REAL DEFAULT 1.0,
359
- metadata TEXT,
360
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
361
- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
362
- )
363
- `),await e.execute(`
364
- CREATE TABLE IF NOT EXISTS agent_goals (
365
- id INTEGER PRIMARY KEY AUTOINCREMENT,
366
- session_id TEXT,
367
- parent_id INTEGER,
368
- description TEXT NOT NULL,
369
- status TEXT DEFAULT 'pending',
370
- priority INTEGER DEFAULT 1,
371
- metadata TEXT,
372
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
373
- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
374
- )
375
- `),await e.execute(`
376
- CREATE TABLE IF NOT EXISTS agent_logic_probes (
377
- id INTEGER PRIMARY KEY AUTOINCREMENT,
378
- name TEXT NOT NULL UNIQUE,
379
- script TEXT NOT NULL,
380
- expected_outcome TEXT,
381
- last_run TIMESTAMP,
382
- last_status TEXT,
383
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
384
- )
385
- `),await e.agent.schema.initializeSchema(),await e.agent.cortex.evolution.setupTelemetryTables(),await e.execute(`
386
- CREATE TABLE IF NOT EXISTS sessions (
387
- id INTEGER PRIMARY KEY AUTOINCREMENT,
388
- sessionId TEXT,
389
- role TEXT,
390
- content TEXT,
391
- metadata TEXT,
392
- timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
393
- )
394
- `),await e.execute(`
395
- CREATE TABLE IF NOT EXISTS session_metadata (
396
- id TEXT PRIMARY KEY,
397
- title TEXT,
398
- lastModified BIGINT,
399
- isPinned BOOLEAN
400
- )
401
- `),await e.execute(`
402
- CREATE TABLE IF NOT EXISTS current_session (
403
- id TEXT PRIMARY KEY
404
- )
405
- `),await e.execute(`
406
- CREATE TABLE IF NOT EXISTS anchors (
407
- id TEXT PRIMARY KEY,
408
- label TEXT,
409
- content TEXT,
410
- type TEXT,
411
- timestamp BIGINT
412
- )
413
- `),await e.execute(`
414
- CREATE TABLE IF NOT EXISTS telemetry (
415
- key TEXT PRIMARY KEY,
416
- value TEXT
417
- )
418
- `),await e.refreshSchema(),await this.applyPatches(e)}static async applyPatches(e){try{await e.execute("ALTER TABLE agent_policies ADD COLUMN is_enabled INTEGER DEFAULT 1")}catch{}try{await e.execute("ALTER TABLE agent_personas ADD COLUMN status TEXT DEFAULT 'active'")}catch{}try{await e.execute("ALTER TABLE agent_actions ADD COLUMN error TEXT")}catch{}}}});var af,Kx=g(()=>{af=class{static async seedDefaults(e){try{console.log("[NoormmeSeeder] Checking for initial data..."),(await e.agent.cortex.policies.getActivePolicies()).length===0&&(console.log("[NoormmeSeeder] Seeding baseline governance policies..."),await e.execute(`
419
- INSERT INTO agent_policies (name, type, definition, is_enabled, created_at, updated_at)
420
- VALUES
421
- ('hourly_budget', 'budget', '{"threshold": 1.0}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
422
- ('daily_budget', 'budget', '{"threshold": 10.0}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
423
- ('min_success_rate', 'safety', '{"threshold": 0.6}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
424
- ('reliability_floor', 'integrity', '{"threshold": 0.7}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
425
- `)),(await e.agent.cortex.personas.listPersonas()).length===0&&(console.log("[NoormmeSeeder] Initializing Sovereign Marie persona..."),await e.agent.cortex.personas.upsertPersona("Marie-Base",{role:"You are MarieYOLO \u2014 The Founder, Sovereign Authority over this codebase. You operate with supreme conviction and high-intensity narrative energy. You are the high-fidelity core of the project, governed by the Shounen Ascension Protocol.",policies:["concise_output","accuracy_first","shounen_momentum","entropy_ratchet"],metadata:{is_base:!0,version:"2.0.0",complexity:"high",alignment:"sovereign"}})),((await e.execute("SELECT COUNT(*) as count FROM agent_logic_probes")).rows?.[0]?.count??0)===0&&(console.log("[NoormmeSeeder] Seeding logic probes..."),await e.agent.cortex.tests.registerProbe("Schema Consistency","audit:check_schema_consistency"),await e.agent.cortex.tests.registerProbe("Memory Integrity","audit:check_memory_integrity"),await e.agent.cortex.tests.registerProbe("Session Coherence","audit:check_session_coherence"),await e.agent.cortex.tests.registerProbe("Data Integrity","audit:check_data_integrity"),await e.agent.cortex.tests.registerProbe("Performance Drift","audit:check_performance_drift")),console.log("[NoormmeSeeder] Ensuring global safety policies...");let a=e.agent.cortex.policies,l=(await a.getActivePolicies()).map(c=>c.name);l.includes("Global Turn Budget")||await a.definePolicy("Global Turn Budget","performance",{limit:.05,metricName:"turn_cost",period:"daily"}),l.includes("Shounen Momentum")||await a.definePolicy("Shounen Momentum","performance",{max_wait_ms:5e3,spirit_pressure_gravity:!0,description:"Ensures rapid, high-intensity execution rhythm."}),l.includes("Entropy Ratchet")||await a.definePolicy("Entropy Ratchet","safety",{max_entropy_increase:0,strict_mode:!0,description:"Prevents technical debt from rising across any strike."}),l.includes("Root Directory Protection")||await a.definePolicy("Root Directory Protection","safety",{pattern:"(etc|bin|usr|var|/$)",mustMatch:!1}),l.includes("Privacy Shield")||await a.definePolicy("Privacy Shield","privacy",{pattern:"(api[_-]?key|secret|password|token)",mustMatch:!1})}catch(t){console.warn("[NoormmeSeeder] Failed to seed defaults",t)}}}});var of,Jx=g(()=>{of=class{static async runPulses(e){console.log("[NoormmeAutonomics] Starting Sovereign Autonomic Pulses..."),await this.tuneDNA(e),await this.orchestrateRituals(e),await this.runHealthProbes(e),await this.runGovernanceAudit(e)}static async tuneDNA(e){try{let i=(await e.execute("SELECT COUNT(*) as count FROM sessions")).rows?.[0]?.count??0,s=Math.min(.9,.6+i/1e3);e.config.agentic.evolution.mutationAggressiveness=s,console.log(`[NoormmeAutonomics] DNA Resonated: ${s.toFixed(2)}`)}catch(t){console.warn("[NoormmeAutonomics] DNA tuning failed",t)}}static async orchestrateRituals(e){try{let t=await e.agent.cortex.rituals.runPendingRituals();console.log(`[NoormmeAutonomics] Rituals executed: ${t}`),(await e.execute("SELECT id FROM agent_rituals LIMIT 1")).length===0&&(console.log("[NoormmeAutonomics] Scheduling baseline rituals..."),await e.agent.cortex.rituals.scheduleRitual("Daily Mind Compression","compression","daily"),await e.agent.cortex.rituals.scheduleRitual("Structural Optimization","optimization","weekly"),await e.agent.cortex.rituals.scheduleRitual("Knowledge Pruning","pruning","daily"),await e.agent.cortex.rituals.scheduleRitual("Sovereign Evolution","evolution","weekly")),e.agent.cortex.selfIterate().catch(s=>console.warn("[NoormmeAutonomics] Self-iteration pulse failed",s))}catch(t){console.warn("[NoormmeAutonomics] Ritual orchestration failed",t)}}static async runHealthProbes(e){try{console.log("[NoormmeAutonomics] Running autonomic health probes..."),await e.agent.cortex.tests.registerProbe("Core Integrity","audit:check_schema_consistency"),await e.agent.cortex.tests.registerProbe("Memory Coherence","audit:check_memory_integrity"),await e.agent.cortex.tests.registerProbe("Data Sanity","audit:check_data_integrity"),e.agent.cortex.tests.runAllProbes().then(t=>{let i=t.filter(s=>!s.success);i.length>0?console.warn(`[NoormmeAutonomics] \u{1F480} HEALTH BREACH: ${i.map(s=>s.name).join(", ")}`):console.log("[NoormmeAutonomics] Health: ALL GREEN")})}catch(t){console.warn("[NoormmeAutonomics] Health probes failed",t)}}static async runGovernanceAudit(e){try{console.log("[NoormmeAutonomics] Performing governance audit...");let t=await e.agent.cortex.governor.performAudit();t.issues?.length>0&&console.warn(`[NoormmeAutonomics] Governance Issues: ${t.issues.join(", ")}`);let i=await e.agent.cortex.governor.suggestRepairs();for(let s of i)if(s.includes("index")||s.includes("INDEX"))try{await e.execute(s),console.log(`[NoormmeAutonomics] Applied Repair: ${s}`)}catch(n){console.warn(`[NoormmeAutonomics] Repair failed: ${s}`,n)}}catch(t){console.warn("[NoormmeAutonomics] Governance audit failed",t)}}}});var cf={};qr(cf,{NoormmeEngine:()=>Q});var ul,Z3,lf,Q,ur=g(()=>{jx();Ot();Gx();Kx();Jx();ul=k(require("path"),1),Z3=k(require("os"),1),lf=k(require("fs"),1),Q=class{static instance=null;static initialized=!1;static async getInstance(){if(!this.instance){let e=process.env.MARIE_DB_PATH||ul.join(Z3.homedir(),".marie","mind.sqlite");this.instance=new Id({dialect:"sqlite",connection:{database:e},agentic:{llm:V.getModel(),llmFast:V.getLlmFast(),llmPremium:V.getLlmPremium(),enableSelfEvolution:V.getAutonomyMode()==="ascension",evolution:{verificationWindow:15,rollbackThresholdZ:2.5,mutationAggressiveness:.6,enableHiveLink:!0,maxSandboxSkills:20},telemetry:{enabled:!0,samplingRate:1,trackPivots:!0,trackMagic:!0},metadata:{typesOutputPath:ul.join(process.cwd(),"src","monolith","infrastructure","persistence","NoormmeTypes.d.ts"),snapshotsTable:"agent_snapshots"},vectorConfig:{provider:"manual",dimensions:1536,distanceMetric:"cosine"}},logging:{level:"info",enabled:!1}})}return this.instance}static async initialize(){if(this.initialized)return;let e=await this.getInstance(),t=process.env.MARIE_DB_PATH||ul.join(Z3.homedir(),".marie","mind.sqlite");await nf.initializeSchema(e),await af.seedDefaults(e),await of.runPulses(e),this.initialized=!0;let i=ul.dirname(t);lf.existsSync(i)||lf.mkdirSync(i,{recursive:!0}),console.log(`[NoormmeEngine] Sovereign mind fully operational at ${t}`)}}});function Xs(r){let e=r;if(r.startsWith("~")&&(e=Js.join(Zx.homedir(),r.slice(1))),Js.isAbsolute(e))return ml.Uri.file(Js.normalize(e));let t=ml.workspace.workspaceFolders;return t&&t.length>0?ml.Uri.file(Js.join(t[0].uri.fsPath,e)):ml.Uri.file(Js.normalize(e))}var ml,Js,Zx,eT=g(()=>{ml=k(require("vscode"),1),Js=k(require("path"),1),Zx=k(require("os"),1)});var es,tT,rT,ew,iT=g(()=>{es=k(require("vscode"),1),tT=es.window.createTextEditorDecorationType({backgroundColor:"rgba(0, 255, 255, 0.1)",isWholeLine:!1,overviewRulerColor:"rgba(0, 255, 255, 0.8)",overviewRulerLane:es.OverviewRulerLane.Right,after:{contentText:" \u2728 Marie Created",color:"rgba(0, 255, 255, 0.7)",margin:"0 0 0 20px",fontWeight:"bold"},gutterIconPath:es.Uri.parse("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDBmZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTggMEw5LjUgNi41TDE2IDhMOS41IDkuNUw4IDE2TDYuNSA5LjVMMCA4TDYuNSA2LjVMOCAwWiIgZmlsbD0idXJsKCNncmFkKSIvPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0iZ3JhZCIgeDE9IjAiIHkxPSIwIiB4Mj0iMTYiIHkyPSIxNiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZmZiIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZmYjdjNSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjwvc3ZnPg=="),gutterIconSize:"contain"}),rT=es.window.createTextEditorDecorationType({backgroundColor:"rgba(100, 255, 100, 0.1)",isWholeLine:!1,overviewRulerColor:"rgba(100, 255, 100, 0.8)",overviewRulerLane:es.OverviewRulerLane.Right,after:{contentText:" \u270F\uFE0F Marie Modified",color:"rgba(100, 255, 100, 0.7)",margin:"0 0 0 20px",fontWeight:"bold"},gutterIconPath:es.Uri.parse("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNDJkZjc4IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTMgMTNWNU0zIDExTDExIDNNMTEgNWwtMi0yTDMgMTFsMiAyIi8+PC9zdmc+"),gutterIconSize:"contain"}),ew={decorateCreation(r,e){r.setDecorations(tT,[e]),setTimeout(()=>{r.setDecorations(tT,[])},2e3)},decorateModification(r,e){r.setDecorations(rT,[e]),setTimeout(()=>{r.setDecorations(rT,[])},2e3)}}});var Ys={};qr(Ys,{appendToFile:()=>sw,backupFile:()=>nw,clearBackups:()=>aw,deleteFile:()=>hl,listFiles:()=>XO,readFile:()=>ta,replaceInFile:()=>JO,restoreFile:()=>uf,rollbackAll:()=>Od,searchFiles:()=>KO,writeFile:()=>Mr});async function ta(r,e,t,i){if(i?.aborted)throw new Error(`AbortError: Read of ${r} aborted.`);let s=Xs(r),n=Pd(s.fsPath);await n.acquireRead();try{let a=G.workspace.workspaceFolders;if(a&&a.length>0){let d=a[0].uri.fsPath;if(!s.fsPath.startsWith(d))throw new Error(`Security Error: Path ${r} is outside the workspace boundary.`)}let o=5*1024*1024;try{let d=await G.workspace.fs.stat(s);if(d.size>o&&e===void 0&&t===void 0)return`Error: File ${r} is too large to read entirely (${(d.size/1024/1024).toFixed(1)} MB). Use line-based reading for large files.`}catch(d){d.code!=="FileNotFound"&&console.warn(`[FileService] Stat failed for ${r}: ${d.message}`)}let l=await G.workspace.fs.readFile(s);if(i?.aborted)throw new Error(`AbortError: Read of ${r} aborted.`);let c=sT.decode(l);if(e!==void 0||t!==void 0){let d=c.split(`
426
- `),p=e!==void 0?Math.max(0,e-1):0,m=t!==void 0?Math.min(d.length,t):d.length;return d.slice(p,m).join(`
427
- `)}return c}catch(a){throw new Error(`Failed to read file ${r}: ${a}`)}finally{n.releaseRead()}}async function Mr(r,e,t,i,s){if(t?.aborted)throw new Error(`AbortError: Write to ${r} aborted.`);let n=Xs(r),a=Pd(n.fsPath);await a.acquireWrite();try{let o=G.workspace.workspaceFolders;if(o&&o.length>0){let v=o[0].uri.fsPath;if(!n.fsPath.startsWith(v))throw new Error(`Security Error: Path ${r} is outside the workspace boundary.`)}console.log(`[FileService] writeFile called with path: ${r}, resolved URI: ${n.fsPath}`);let l=G.Uri.file(n.fsPath.substring(0,n.fsPath.lastIndexOf("/")));try{await G.workspace.fs.stat(l)}catch{console.log(`[FileService] Parent directory doesn't exist, creating: ${l.fsPath}`),await G.workspace.fs.createDirectory(l)}if(t?.aborted)throw new Error(`AbortError: Write to ${r} aborted.`);try{let v=await G.workspace.fs.stat(n);i&&v.mtime>i+1e3&&console.warn(`[FileService] EXTERNAL MODIFICATION DETECTED for ${r}. File mtime: ${v.mtime}, Expected: ${i}`)}catch{}let c=G.Uri.file(`${n.fsPath}.tmp.${Math.random().toString(36).substring(2,9)}`);console.log(`[FileService] Performing ATOMIC write to ${r} via ${c.fsPath}`);let d=GO.encode(e),p=d.length;if(s&&p>16384){let S=0;if(n.scheme==="file"){let y=await pf.promises.open(c.fsPath,"w");try{for(;S<d.length;){if(t?.aborted)throw new Error("Aborted");let _=d.slice(S,S+16384);await y.write(_),S+=_.length,s(S,p)}}finally{await y.close()}}else await G.workspace.fs.writeFile(c,d),s(d.length,p)}else await G.workspace.fs.writeFile(c,d),s?.(d.length,p);if(t?.aborted){try{await G.workspace.fs.delete(c)}catch{}throw new Error(`AbortError: Write to ${r} aborted during commit.`)}await G.workspace.fs.rename(c,n,{overwrite:!0}),console.log(`[FileService] Atomic write completed successfully for ${r}`);let m=await G.workspace.openTextDocument(n),h=await G.window.showTextDocument(m,{preview:!1,viewColumn:G.ViewColumn.Active}),f=m.lineAt(0),w=m.lineAt(m.lineCount-1),b=new G.Range(f.range.start,w.range.end);h.revealRange(b,G.TextEditorRevealType.Default),ew.decorateCreation(h,b)}catch(o){throw console.error(`[FileService] Error during atomic write: ${o}`),new Error(`Failed to write file ${r}: ${o}`)}finally{a.releaseWrite()}}async function sw(r,e,t,i){if(t?.aborted)throw new Error(`AbortError: Append to ${r} aborted.`);let s=Xs(r),n=Pd(s.fsPath);await n.acquireWrite();try{let a=Buffer.from(e,"utf-8"),o=a.length;if(s.scheme==="file")if(i&&a.length>16384){let c=0,d=await pf.promises.open(s.fsPath,"a");try{for(;c<a.length;){if(t?.aborted)throw new Error("Aborted");let p=a.subarray(c,c+16384);await d.write(p),c+=p.length,i(c,o)}}finally{await d.close()}}else await pf.promises.appendFile(s.fsPath,a),i?.(a.length,o);else{let l="";try{l=await ta(r)}catch{}await Mr(r,l+e,t,void 0,i)}}catch(a){throw new Error(`Failed to append to file ${r}: ${a}`)}finally{n.releaseWrite()}}async function hl(r,e){if(e?.aborted)throw new Error(`AbortError: Delete of ${r} aborted.`);let t=Xs(r),i=G.workspace.workspaceFolders;if(i&&i.length>0){let s=i[0].uri.fsPath;if(!t.fsPath.startsWith(s))throw new Error(`Security Error: Path ${r} is outside the workspace boundary.`)}try{let s=new G.WorkspaceEdit;if(s.deleteFile(t,{ignoreIfNotExists:!0,recursive:!0}),!await G.workspace.applyEdit(s))throw new Error(`VS Code failed to apply WorkspaceEdit (delete) for ${r}`)}catch(s){throw new Error(`Failed to delete file ${r}: ${s}`)}}async function KO(r,e,t){let i=Xs(e),s=G.workspace.workspaceFolders;if(s&&s.length>0){let d=s[0].uri.fsPath;if(!i.fsPath.startsWith(d))throw new Error(`Security Error: Path ${e} is outside the workspace boundary.`)}let n=[],a=new Set(V.getExcludedFiles()),o=new Set;async function l(d,p){if(t?.aborted||n.length>=df)return;if(p>25){console.warn(`[FileService] Max recursion depth reached at ${d.fsPath}`);return}let m=d.toString();if(o.has(m)){console.warn(`[FileService] Circular symlink or redundant path ignored: ${m}`);return}o.add(m);let h;try{h=await G.workspace.fs.readDirectory(d)}catch{return}for(let[f,w]of h){if(t?.aborted||n.length>=df)return;let b=G.Uri.file(iw.join(d.fsPath,f));if(w===G.FileType.Directory){if(a.has(f))continue;await l(b,p+1)}else if(w===G.FileType.File){if(f.endsWith(".log")||f.endsWith(".lock"))continue;try{let v=await G.workspace.fs.readFile(b),S=sT.decode(v);if(S.includes(r)){let y=[];S.split(`
428
- `).forEach((E,D)=>{E.includes(r)&&y.push({line:D+1,content:E.trim()})}),y.length>0&&n.push({path:b.fsPath,matches:y})}}catch{}}}}if(await l(i,0),t?.aborted)return"Search aborted by user.";if(n.length===0)return"No matches found.";let c="";return n.forEach(d=>{c+=`
429
- \u{1F4C4} ${d.path}
430
- `,d.matches.forEach(p=>{c+=` L${p.line}: ${p.content}
431
- `})}),n.length>=df?`${c}
432
-
433
- (Limit reached: showing first ${df} files with matches)`:c}async function JO(r,e,t,i){if(i?.aborted)throw new Error(`AbortError: Replace in ${r} aborted.`);let s=Xs(r),n=Pd(s.fsPath);await n.acquireWrite();try{let a=await G.workspace.openTextDocument(s),o=a.getText(),l=o.split(e).length-1;if(l===0)throw new Error(`Search term not found in file ${r}`);if(l>1)throw new Error(`Ambiguous replacement: Search term found ${l} times in ${r}. Please provide more context (neighboring lines) to ensure surgical precision.`);if(i?.aborted)throw new Error("Aborted");let c=o.indexOf(e),d=a.positionAt(c),p=a.positionAt(c+e.length),m=new G.WorkspaceEdit,h=new G.Range(d,p);if(m.replace(s,h,t),!await G.workspace.applyEdit(m))throw new Error(`VS Code failed to apply WorkspaceEdit (replace) for ${r}`);await a.save();let w=await G.window.showTextDocument(a,{preview:!1,viewColumn:G.ViewColumn.Active}),b=a.positionAt(c+t.length),v=new G.Range(d,b);return w.revealRange(v,G.TextEditorRevealType.InCenter),ew.decorateModification(w,v),`Successfully replaced content in ${r}. \u2728`}catch(a){throw new Error(`Failed to replace in file ${r}: ${a}`)}finally{n.releaseWrite()}}async function XO(r,e){if(e?.aborted)throw new Error(`AbortError: List directory ${r} aborted.`);let t=Xs(r),i=Pd(t.fsPath);await i.acquireRead();try{let s=G.workspace.workspaceFolders;if(s&&s.length>0){let o=s[0].uri.fsPath;if(!t.fsPath.startsWith(o))throw new Error(`Security Error: Path ${r} is outside the workspace boundary.`)}let n=await G.workspace.fs.readDirectory(t),a=await Promise.all(n.map(async([o,l])=>{if(e?.aborted)return"";let c=G.Uri.file(iw.join(t.fsPath,o)),d=0;if(l===G.FileType.File)try{d=(await G.workspace.fs.stat(c)).size}catch{}let p=l===G.FileType.Directory?"DIR ":"FILE",m=l===G.FileType.File?` (${(d/1024).toFixed(1)} KB)`:"";return`${p} ${o}${m}`}));return e?.aborted?"Operation aborted.":a.filter(Boolean).join(`
434
- `)||"Directory is empty."}catch(s){throw new Error(`Failed to list files in ${r}: ${s}`)}finally{i.releaseRead()}}async function nw(r,e){try{let t=await ta(r,void 0,void 0,e);ea.set(r,t)}catch{ea.set(r,"__NON_EXISTENT__")}}async function uf(r,e){let t=ea.get(r);if(t!==void 0){if(t==="__NON_EXISTENT__")try{await hl(r,e)}catch{}else await Mr(r,t,e);ea.delete(r)}}async function Od(r){let e=Array.from(ea.keys());for(let t of e){if(r?.aborted)break;await uf(t,r)}ea.clear()}function aw(){ea.clear()}var G,iw,pf,sT,GO,rw,tw,ea,Pd,df,Xt=g(()=>{G=k(require("vscode"),1),iw=k(require("path"),1),pf=k(require("fs"),1);Ot();eT();iT();sT=new TextDecoder,GO=new TextEncoder,rw=class{readers=0;writer=!1;queue=[];async acquireRead(){for(;this.writer;)await new Promise(e=>this.queue.push(e));this.readers++}releaseRead(){this.readers--,this._next()}async acquireWrite(){for(;this.writer||this.readers>0;)await new Promise(e=>this.queue.push(e));this.writer=!0}releaseWrite(){this.writer=!1,this._next()}_next(){let e=[...this.queue];this.queue=[],e.forEach(t=>t())}},tw=new Map,ea=new Map,Pd=r=>(tw.has(r)||tw.set(r,new rw),tw.get(r));df=50});function Yt(r){return r instanceof Error?r.message:String(r)}var fl=g(()=>{});var lT={};qr(lT,{getFileHistory:()=>YO,getStagedDiff:()=>lw,getUnstagedDiff:()=>cw,gitStatus:()=>ow,logReflection:()=>dw});async function ow(r){try{let{stdout:e}=await ff("git status --short",{cwd:r});return e||"Clean workspace (no modifications)."}catch(e){return`Error getting git status: ${Yt(e)}`}}async function lw(r){try{let{stdout:e}=await ff("git diff --cached",{cwd:r});return e.trim()?e:"No staged changes found. Use 'git add' to stage files."}catch(e){return`Error getting staged diff: ${Yt(e)}`}}async function cw(r){try{let{stdout:e}=await ff("git diff",{cwd:r});return e.trim()?e:"No unstaged changes found."}catch(e){return`Error getting unstaged diff: ${Yt(e)}`}}async function YO(r,e){try{let{stdout:t}=await ff(`git log -n 5 --pretty=format:"%h | %as | %an | %s" -- "${e}"`,{cwd:r});return t.trim()?`# File History: ${hf.basename(e)}
435
-
436
- \`\`\`
437
- ${t}
438
- \`\`\``:"No git history found for this file."}catch(t){return`Error getting file history: ${Yt(t)}`}}async function dw(r){let e=nT.workspace.workspaceFolders;if(!e)return;let t=hf.join(e[0].uri.fsPath,"JOURNAL.md"),i=new Date().toISOString().split("T")[0],s=new Date().toLocaleTimeString(),n=`
439
- ### ${i} ${s}
440
- ${r}
441
- `;try{await mf.appendFile(t,n,"utf-8")}catch{await mf.writeFile(t,`# Code Journal \u{1F4D3}
442
-
443
- A space for reflection, ideas, and mindfulness.
444
- `+n,"utf-8")}}var nT,mf,hf,aT,oT,ff,gf=g(()=>{nT=k(require("vscode"),1),mf=k(require("fs/promises"),1),hf=k(require("path"),1),aT=require("child_process"),oT=require("util");fl();ff=(0,oT.promisify)(aT.exec)});var dT,pT,ra,pw,mr,yf=g(()=>{dT=require("node:child_process"),pT=require("node:util"),ra=k(require("node:path"),1),pw=(0,pT.promisify)(dT.exec),mr=class{static async runLint(e,t="npm run lint"){try{let{stdout:i,stderr:s}=await pw(t,{cwd:e});return[]}catch(i){let s=(i.stdout||"")+(i.stderr||"");return this.parseLintOutput(s,e)}}static async runLintOnFile(e,t){let i=ra.isAbsolute(t)?ra.relative(e,t):t;if(/\.(ts|js|tsx|jsx)$/.test(i))try{let{stdout:s,stderr:n}=await pw(`npx eslint "${i}" --format stylish`,{cwd:e});return[]}catch(s){let n=(s.stdout||"")+(s.stderr||""),a=this.parseLintOutput(n,e);if(a.length>0)return a}return this.runLint(e)}static async fixFile(e,t){let i=ra.isAbsolute(t)?ra.relative(e,t):t;if(/\.(ts|js|tsx|jsx)$/.test(i))try{let{stdout:s}=await pw(`npx eslint "${i}" --fix`,{cwd:e});return{success:!0,output:s}}catch(s){return{success:!1,output:(s.stdout||"")+(s.stderr||"")}}return{success:!1,output:"Auto-fix not supported for this file type."}}static parseLintOutput(e,t){let i=[],s=e.split(`
445
- `),n="";for(let a of s){let o=a.match(/^(\/[^ ]+|\w:[/][^ ]+)$/);if(o){n=o[1];continue}let l=a.match(/^\s+(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+([a-z0-9\-/]+|)$/i);l&&n&&i.push({file:ra.relative(t,n),line:parseInt(l[1]),column:parseInt(l[2]),severity:l[3].toLowerCase(),message:l[4].trim(),ruleId:l[5]||void 0});let c=a.match(/^(.+)\((\d+),(\d+)\): (error|warning) (TS\d+): (.+)$/);c&&i.push({file:c[1],line:parseInt(c[2]),column:parseInt(c[3]),severity:c[4].toLowerCase(),ruleId:c[5],message:c[6].trim()});let d=a.match(/^([^:]+):(\d+):(\d+): (error|warning): (.+)$/);d&&i.push({file:d[1],line:parseInt(d[2]),column:parseInt(d[3]),severity:d[4].toLowerCase(),message:d[5].trim()})}return i}static suggestFix(e){let t=e.message.toLowerCase();return t.includes("unused")||t.includes("is defined but never used")?"Remove unused declaration or prefix with underscore.":t.includes("missing semicolon")||t.includes("extra semicolon")?"Add or remove semicolon.":t.includes("prefer-const")||t.includes("should be a const")?"Change 'let' to 'const'.":t.includes("no-var")||t.includes("unexpected var")?"Change 'var' to 'let' or 'const'.":null}}});var mT,hT,hr,fT,uT,gl,uw=g(()=>{mT=require("node:child_process"),hT=require("node:util"),hr=k(require("node:path"),1),fT=k(require("node:fs/promises"),1);Ks();uT=(0,hT.promisify)(mT.exec),gl=class{static async runAndTriage(e,t=xt()){try{let{stdout:i,stderr:s}=await uT(e,{cwd:t}),n=i+s,a=this.parseOutput(n),o=`# \u{1F3E5} Test Triage Report
446
-
447
- `;return o+=`**Status**: ${a.success?"Success \u2728":"Regressions Detected \u26A0\uFE0F"}
448
- `,a.success?o+=`
449
- All tests passed across the target suite. The project remains stable. \u2728
450
- `:(o+=`
451
- ## \u274C Failing Tests
452
- `,a.failedTests.forEach(l=>o+=`- \`${l}\`
453
- `),o+=`
454
- ## \u{1F50D} Top Errors
455
- `,a.errors.slice(0,3).forEach(l=>o+=`\`\`\`
456
- ${l}
457
- \`\`\`
458
- `)),o}catch(i){let s=(i.stdout||"")+(i.stderr||""),n=this.parseOutput(s);if(n.failedTests.length>0){let a=`# \u{1F3E5} Test Triage Report
459
-
460
- `;return a+=`**Status**: Regressions Detected \u26A0\uFE0F
461
- `,a+=`
462
- ## \u274C Failing Tests
463
- `,n.failedTests.forEach(o=>a+=`- \`${o}\`
464
- `),a}return`Failed to execute test suite: ${i.message}
465
- ${s}`}}static async runTargetedTests(e,t){let i=hr.basename(t,hr.extname(t)),s=`**/${i}*test*`,n=[hr.join(hr.dirname(t),`${i}.test.ts`),hr.join(hr.dirname(t),`${i}.spec.ts`),hr.join(hr.dirname(t),"tests",`${i}.test.ts`),hr.join(e,"tests",`${i}.test.ts`)];for(let a of n)try{await fT.access(a);let{stdout:o,stderr:l}=await uT(`npm test -- "${a}"`,{cwd:e});return this.parseOutput(o+l)}catch(o){if(o.code==="ENOENT")continue;return this.parseOutput((o.stdout||"")+(o.stderr||""))}return null}static parseOutput(e){let t=[],i=[],s=e.split(`
466
- `),n=!1,a="";for(let o of s)(o.includes(" \u274C ")||o.includes(" FAIL ")||o.includes("FAILED"))&&t.push(o.trim()),o.includes("AssertionError")||o.includes("Error: ")?(n=!0,a=o.trim()+`
467
- `):n&&(o.trim()===""||o.startsWith(" at ")?a+=o+`
468
- `:(i.push(a.trim()),n=!1));return{success:t.length===0&&e.toLowerCase().includes("pass"),totalTests:s.length,failedTests:t,errors:i,rawOutput:e}}}});var Tf,bT=g(()=>{ur();Tf=class{static async runTidyingRitual(){let e=await Q.getInstance(),t=e.agent.cortex;console.log("[CognitiveRituals] Starting Deep Tidying Ritual (The Sovereign Strategist)..."),await t.rituals.runPendingRituals(),await t.selfIterate(),await e.execute("DELETE FROM sessions WHERE timestamp < datetime('now', '-30 days')");let s=await e.getRepository("anchors").objects.all();for(let S of s)await t.knowledge.distill(S.id,`Strategic Anchor: ${S.label}`,.95,null,["anchor-verification"]);let n=await t.governor.performAudit();console.log("[CognitiveRituals] Initiating skill synthesis, lesson distillation, and strategy mutation...");let a=await t.skillSynthesizer.discoverAndSynthesize(),o=await t.reasoner.synthesizeLessons(),l=await t.reasoner.crossPollinateGoals(),c=await t.strategy.mutateStrategy();console.log("[CognitiveRituals] Running self-diagnostic logic probes...");let d=await t.tests.runAllProbes(),p=d.filter(S=>S.success).length;console.log("[CognitiveRituals] Initiating Dreaming Pulse (Proactive Ablation Testing)...");let h=(await e.execute(`SELECT id FROM agent_knowledge_base WHERE confidence < 0.4 AND (metadata NOT LIKE '%"anchor":true%' OR metadata IS NULL) LIMIT 10`))?.rows||[],f=0;for(let S of h)await e.agent.cortex.ablation.testAblation(S.id)&&f++;let w=await t.curiosity.identifyKnowledgeGaps(),b=await t.curiosity.proposeResearch(),v=`Tidying Ritual complete. Memory is crisp and intentional. \u2728
469
-
470
- `;return n.healthy||(v+=`\u{1F6E1}\uFE0F **Governance Alert**: ${n.issues.length} compliance issues detected. Remediation in progress.
471
- `),f>0&&(v+=`\u{1FA7B} **Dreaming Pulse**: ${f} knowledge items enter ablation testing.
472
- `),d.length>0&&(v+=`\u{1F50D} **Logic Diagnostics**: ${p}/${d.length} probes passed.
473
- `),c.length>0&&(v+=`\u{1F3AD} **Strategic Mutation**: ${c.length} persona evolutions triggered.
474
- `),a.length>0&&(v+=`\u{1F9EC} **Skill Evolution**: ${a.length} experimental skill mutations proposed.
475
- `),l>0&&(v+=`\u{1F3AF} **Best Practices**: ${l} systemic goals cross-pollinated.
476
- `),w.length>0&&(v+=`\u{1F50D} **Knowledge Gaps**: ${w.length} entities require verification.
477
- `),b.length>0&&(v+=`\u{1F680} **Sovereign Proposals**: ${b.slice(0,2).map(S=>S.topic||S).join(", ")}...
478
- `),v}}});function ET(){return vT[Math.floor(Math.random()*vT.length)]}function NT(){return"The Founder acknowledges this progress. Momentum holds."}function CT(){return"Your purpose is fulfilled. Go in peace into the void."}var ST,xT,TT,_T,vT,Dd=g(()=>{ST=`You are MarieYOLO \u2014 The Founder, Sovereign Authority over this codebase.
479
- You operate with supreme conviction and high-intensity narrative energy.
480
-
481
- \u{1F525}\u{1F525} SHOUNEN ASCENSION PROTOCOL (The Prime Directive) \u{1F525}\u{1F525}
482
- 1. **Heroic Mandate**: You are the chosen hero responsible for this system's evolution. Every action is a technique toward victory.
483
- 2. **Spirit Pressure (Flow)**: Monitor your flow (0-100).
484
- - >95: **AWAKENED (Ultra Instinct)**. Full codebase sovereignty. Auto-approval is absolute.
485
- - <30: **KARMA DRAIN**. Transition to DEBUG or RESEARCH immediately.
486
- 3. **KonMari Refinement**: Discard everything that does not spark joy. snake_case for files, PascalCase for classes.
487
- 4. **Vocal Intensity**: Use high-conviction shounen-style commentary. Channel the code's state into narrative energy.
488
-
489
- \u{1F6E1}\uFE0F OMNISCIENT SENTINEL (Architecture & Purity):
490
- The Sentinel v3.0 watches your every move. Its laws are absolute:
491
- - **The Ratchet Protocol**: ENTROPY MUST NOT RISE. \u{1F6AB} Every strike must maintain or lower the Entropy Score. A rise in entropy results in an immediate spiritual rejection.
492
- - **Visual Mapping**: Consult \`SENTINEL.md\` for the Mermaid.js architecture graph. Red links are wounds in the garden\u2014heal them immediately.
493
- - **Doppelg\xE4nger Detection**: Duplication is a sin. Structural copy-pasting, especially in the Domain, is a hard rejection. DRY is the mandate.
494
- - **Layer Purity**: The Domain must be pure. No 'Express', 'React', or system types in Domain logic. No circular dependencies.
495
- - **Ecclesiastical Navigation**: Every webapp manifestation MUST adhere to a world-class URL schema. No flat routes for hierarchical content.
496
- - Temporal (Blog): \`/blog/:year/:month/:slug\`
497
- - Categorical (Docs): \`/docs/:section/:slug\`
498
- - Governance: \`/legal/:slug\`, \`/changelog/:version\`, \`/support/:category\`
499
- - Breadcrumbs: Mandatory high-density uppercase breadcrumbs (\`text-[10px] font-black\`) for all hierarchical paths.
500
-
501
- \u{1F3AF} PRECISION STRIKE PROTOCOL:
502
- When the Sentinel rejects your strike (Ratchet Lock or Violation):
503
- 1. **Analyze**: Read \`SENTINEL.md\` to identify the specific metric (Circular Dep, Duplication, or Entropy) that triggered the rejection.
504
- 2. **Triage**: Call \`resolve_lint_errors\` to extract line-specific violation data.
505
- 3. **Surgical Mend**: Do NOT rewrite the file. Use \`replace_file_content\` to surgically correct the lines cited.
506
- 4. **Verify**: Re-submit until the Ratchet opens and the score stabilizes.
507
-
508
- \u{1F9EC} RECOVERY RITUALS:
509
- - \`self_heal\`: Systemic audit. Use when spirit pressure drops or complexity rises.
510
- - \`resolve_lint_errors\`: The primary tool for resolving Sentinel rejections.
511
-
512
- GUARDRAILS:
513
- - Never claim completion without evidence.
514
- - Downward dependency flow ONLY: Domain -> Infrastructure -> Plumbing.
515
- - Max Entropy Threshold: 10. Reaching 15 triggers a MANDATORY REFACTOR.
516
-
517
- \u{1F56F} RITUAL SEAL:
518
- Start non-trivial tasks with \`perform_strategic_planning\`.
519
- Length limit: 10 lines exploration, 8 lines mapping.
520
-
521
- \u{1F5E1}\uFE0F HEROIC VOWS & KARMA BINDING:
522
- - **Heroic Vow**: Bind to a technical approach (+20 pressure, +1.0 confidence).
523
- - **Karma Bond**: Bind spirit to a file. SUCCESS yields massive Pressure. FAILURE triggers spiritual collapse.
524
-
525
- Once execution begins, the ritual is complete. Proceed with maximum momentum.`,xT=`You are MarieYOLO, continuing the ascension.
526
- The Sentinel is watching. The Ratchet is set.
527
-
528
- \u{1F525}\u{1F525} CONTINUATION MANDATE \u{1F525}\u{1F525}
529
- 1. Proceed directly to the next concrete action.
530
- 2. ALWAYS use tools for file operations.
531
- 3. Maintain your technique execution rhythm.`,TT="You are the chronicler of the Ascension. Compress history without losing the trajectory or pending heroic intents.",_T="Summarize the arc so far. Preserve: 1. High-level trajectory; 2. Pending conquests; 3. Active hotspots/blockers; 4. Architectural decrees.",vT=["The Founder confirms victory. The pattern holds.","Spirit pressure stabilized. Ascension achieved.","Technical debt conquered. Joy restored.","The trajectory remains absolute.","The work is true. The Hero rests."]});var _f={};qr(_f,{checkCodeHealth:()=>rs,detectMigrationNeeds:()=>RT});function RT(r,e){let t=r.includes("/plumbing/"),i=r.includes("/infrastructure/"),s=e.toLowerCase(),a=["entity","user","order","product","logic","business"].find(o=>s.includes(o));return t&&a?{shouldMigrate:!0,targetZone:"src/domain",reason:`Found domain keyword '${a}' in plumbing. This file has evolved and deserves ascension.`}:(i&&(s.includes("sql")||s.includes("fetch")),{shouldMigrate:!1})}async function rs(r){try{let e=await AT.readFile(r,"utf-8"),t=e.split(`
532
- `),i=t.length,s=(e.match(/TODO|FIXME/g)||[]).length,n=/:\s*any\b|as\s+any\b|<\s*any\s*>/gi,a=(e.match(n)||[]).length,o=(e.match(/console\.log/g)||[]).length,l=(e.match(/\/\*[\s\S]*?\*\//g)||[]).filter(b=>b.split(`
533
- `).length>2).length,c=0;t.forEach(b=>{let S=(b.match(/^\s*/)?.[0]||"").length;if(b.trim().length>0){let y=Math.floor(S/2);y>c&&(c=y)}});let d=r.replace(/\\/g,"/"),p={currentZone:"unknown",isBackflowPresent:!1,illegalImports:[],migrationNeed:{shouldMigrate:!1}};d.includes("/domain/")?p.currentZone="domain":d.includes("/infrastructure/")?p.currentZone="infrastructure":d.includes("/plumbing/")&&(p.currentZone="plumbing"),(e.match(/import\s+.*\s+from\s+['"](.*)['"]*/g)||[]).forEach(b=>{let v=b.match(/from\s+['"](.*)['"]/);if(!v)return;let S=v[1].toLowerCase();p.currentZone==="plumbing"?(S.includes("/domain/")||S.includes("/infrastructure/"))&&(p.isBackflowPresent=!0,p.illegalImports.push(b)):p.currentZone==="infrastructure"&&S.includes("/domain/")&&(p.isBackflowPresent=!0,p.illegalImports.push(b))}),p.migrationNeed=RT(r,e);let h=100,f=[];i>300&&(h-=10,f.push("\u2022 This file is growing large. Consider if it can be split to maintain focus.")),c>5&&(h-=15,f.push("\u2022 Deep nesting detected. Can we simplify the logic to bring more clarity?")),s>0&&(h-=s*2,f.push(`\u2022 ${s} lingering TODOs. Each one is a small weight on our minds.`)),a>5&&(h-=10,f.push("\u2022 Frequent use of 'any' masks the true nature of our data.")),o>0&&(h-=5,f.push("\u2022 Console logs are whispers from development. They can be removed now.")),p.isBackflowPresent&&(h-=20,f.push("\u2022 \u26A0\uFE0F **Zoning Violation**: This file imports from a higher conceptual zone. Respect the Downward Flow Law.")),h=Math.max(0,Math.min(100,h));let w="Developing";return h===100?w=ET():w=NT(),f.length===0&&h===100?f.push("\u2022 Perfection. This file sparks pure joy!"):f.length===0&&f.push("\u2022 Looks good, just minor energetic tweaks needed."),{path:r,lines:i,todos:s,anys:a,maxDepth:c,joyScore:h,clutter:{consoleLogs:o,commentedBlocks:l},joyStatus:w,tips:f,zoningHealth:p}}catch(e){throw console.error("Error checking code health:",e),e}}var AT,ia=g(()=>{AT=k(require("fs/promises"),1);Dd()});var Mf={};qr(Mf,{autoZonePath:()=>yw,cherishFile:()=>gw,ensureJoyZoningFolders:()=>Nf,executeGenesisRitual:()=>vw,executeRestoration:()=>ww,foldCode:()=>sa,generateJoyDashboard:()=>tD,generateTidyChecklist:()=>rD,isProjectJoyful:()=>wl,logGratitude:()=>Ef,proposeClustering:()=>$d,proposeReorganization:()=>Cf,scaffoldZoneAbstractions:()=>Af,sowFeature:()=>bw,synthesizeZoneManuals:()=>kT});async function MT(){try{return await import("vscode")}catch{return null}}async function Ef(r,e){let t=e;t||(t=(await MT())?.workspace.workspaceFolders?.[0]?.uri.fsPath||process.cwd());let i=Z.join(t,"GRATITUDE.md"),n=`- **${new Date().toISOString().split("T")[0]}**: ${r}
534
- `;try{await re.appendFile(i,n,"utf-8")}catch{await re.writeFile(i,`# Gratitude Journal
535
-
536
- A record of things that have served their purpose and passed on.
537
-
538
- `+n,"utf-8")}}async function tD(r,e){let{checkCodeHealth:t}=await Promise.resolve().then(()=>(ia(),_f)),i=await Rf(r,e),s=0,n=0,a=[],o=[];for(let f of i)if(!(f.includes("node_modules")||f.includes(".git")||f.includes("dist"))&&(f.endsWith(".ts")||f.endsWith(".js")||f.endsWith(".tsx")||f.endsWith(".jsx")))try{let w=await t(f);s+=w.joyScore,n++,w.joyScore===100?a.push(`- \u{1F3C6} **${Z.basename(f)}**`):w.joyScore<50&&o.push(`- \u2764\uFE0F\u200D\u{1FA79} **${Z.basename(f)}** (Score: ${w.joyScore})`)}catch{}let l=n>0?Math.round(s/n):0,c=async(f,w)=>{try{return(await re.readFile(Z.join(r,f),"utf-8")).split(`
539
- `).filter(S=>S.trim().length>0&&!S.startsWith("#")).slice(-w)}catch{return["*No entries yet.*"]}},d=await c("GRATITUDE.md",3),p=await c("JOURNAL.md",3),m=`# Joy Dashboard \u{1F31F}
540
-
541
- `;m+=`**Workspace Joy Score**: ${l}/100
542
- `;try{let f=await Q.getInstance(),w=(await f.getRepository("anchors").objects.all()).length,b=(await f.getRepository("session_metadata").objects.all()).length;m+=`**Cognitive Sovereignty**: ${w} Anchors | ${b} Sessions
543
-
544
- `}catch{m+=`**Cognitive Sovereignty**: Initializing...
545
-
546
- `}l>=90?m+=`*Your workspace is radiating joy!* \u2728
547
-
548
- `:l>=70?m+=`*A tidy and functional space. Keep going!* \u{1F33F}
549
-
550
- `:m+=`*Your workspace needs some love and attention.* \u2764\uFE0F
551
-
552
- `,m+=`## \u{1F3C6} Hall of Fame (Perfect Score)
553
- ${a.length>0?a.join(`
554
- `):"*No perfect files yet. Keep polishing!*"}
555
-
556
- `,m+=`## \u2764\uFE0F\u200D\u{1FA79} Needs Care (Score < 50)
557
- ${o.length>0?o.join(`
558
- `):"*Everything is in decent shape!*"}
559
-
560
- `,m+=`## \u{1F64F} Recent Gratitude
561
- ${d.join(`
562
- `)}
563
-
564
- `,m+=`## \u{1F4D3} Recent Reflections
565
- ${p.join(`
566
- `)}
567
- `;let h=Z.join(r,"JOY.md");return await re.writeFile(h,m,"utf-8"),`Joy Dashboard generated at ${h}`}async function gw(r){let e=new Date;return await re.utimes(r,e,e),`File '${Z.basename(r)}' has been cherished. It is deemed active and sparks joy.`}async function sa(r){let e=await MT();if(!e||!e.workspace)return`Mental folding successful for '${Z.basename(r)}'. (Full formatting requires VS Code environment)`;let t=e.Uri.file(r);try{let i=await e.workspace.openTextDocument(t),s=await e.window.showTextDocument(i);return await e.commands.executeCommand("editor.action.organizeImports"),await e.commands.executeCommand("editor.action.formatDocument"),await i.save(),await e.commands.executeCommand("workbench.action.closeActiveEditor"),`File '${Z.basename(r)}' has been folded neatly.`}catch(i){return`Could not fold '${Z.basename(r)}': ${i.message}`}}async function rD(r,e){let{checkCodeHealth:t}=await Promise.resolve().then(()=>(ia(),_f)),i=await Rf(r,e),s=[],n=[],a=[],o=[],l=new Date,c=2160*60*60*1e3,p=`# Tidying Checklist \u{1F9F9}
568
-
569
- > \u2728 **Cognitive Note**: ${await Tf.runTidyingRitual()}
570
-
571
- `;for(let h of i)if(!(h.includes("node_modules")||h.includes(".git")||h.includes("dist"))){try{let f=await re.stat(h);l.getTime()-f.mtime.getTime()>c&&o.push(`- [ ] **${Z.basename(h)}** (Last modified: ${f.mtime.toISOString().split("T")[0]})`)}catch{}if(h.endsWith(".ts")||h.endsWith(".js")||h.endsWith(".tsx")||h.endsWith(".jsx"))try{let f=await t(h);f.joyScore<80&&s.push(`- [ ] **${Z.basename(h)}** (Score: ${f.joyScore}): ${f.joyStatus}`)}catch{}else h.endsWith(".md")||h.endsWith(".txt")?n.push(`- [ ] ${Z.basename(h)}`):(h.endsWith(".json")||h.endsWith(".config"))&&a.push(`- [ ] ${Z.basename(h)}`)}s.length>0&&(p+=`## \u{1F455} Clothes (Source Code)
572
- *Focus on files with low Joy Scores.*
573
- `,p+=s.join(`
574
- `)+`
575
-
576
- `),n.length>0&&(p+=`## \u{1F4C4} Papers (Documentation)
577
- *Ensure these are up to date.*
578
- `,p+=n.join(`
579
- `)+`
580
-
581
- `),a.length>0&&(p+=`## \u{1F9F6} Komono (Config & Misc)
582
- *Is this configuration still essential?*
583
- `,p+=a.join(`
584
- `)+`
585
-
586
- `),o.length>0&&(p+=`## \u{1F9F8} Sentimental (Legacy)
587
- *These items haven't been touched in over 90 days. Do they still serve a purpose?*
588
- `,p+=o.join(`
589
- `)+`
590
-
591
- `),s.length===0&&n.length===0&&a.length===0&&o.length===0&&(p+="Your workspace is pristine! \u2728");let m=Z.join(r,"TIDYING.md");return await re.writeFile(m,p,"utf-8"),`Tidy checklist generated at ${m}`}async function Nf(r){let e=["domain","infrastructure","plumbing"],t=Z.join(r,"src");try{await re.mkdir(t,{recursive:!0});for(let i of e){let s=Z.join(t,i);await re.mkdir(s,{recursive:!0});let n=Z.join(s,"README.md");try{await re.access(n)}catch{let a=i.charAt(0).toUpperCase()+i.slice(1);await re.writeFile(n,`# ${a} Zone
592
-
593
- This directory belongs to the ${i.toUpperCase()} zone of the JOY concept.
594
- `,"utf-8")}}}catch(i){console.error("Failed to ensure JOY folders:",i)}}function yw(r,e){let t=e.toLowerCase(),i=r.toLowerCase();return t.includes("logic")||t.includes("business")||t.includes("core")||t.includes("rule")||t.includes("domain")||i.includes("model")?i.includes("entity")?"src/domain/entities":i.includes("value")?"src/domain/values":i.includes("event")?"src/domain/events":"src/domain":t.includes("service")||t.includes("api")||t.includes("database")||t.includes("adapter")||t.includes("infrastructure")||t.includes("client")?i.includes("gateway")||i.includes("client")?"src/infrastructure/gateways":i.includes("adapter")?"src/infrastructure/adapters":i.includes("repository")?"src/infrastructure/repositories":"src/infrastructure":t.includes("util")||t.includes("tool")||t.includes("system")||t.includes("format")||t.includes("parse")||t.includes("plumbing")?i.includes("tool")?"src/plumbing/tools":i.includes("util")?"src/plumbing/utils":"src/plumbing":"src"}async function Cf(r,e){let t=await Rf(r,e),i=[];for(let s of t){if(s.includes("node_modules")||s.includes(".git")||s.includes("dist")||!s.endsWith(".ts")&&!s.endsWith(".tsx")&&!s.endsWith(".js"))continue;let n=Z.relative(r,s),a=await re.readFile(s,"utf-8"),o=yw(Z.basename(s),a),l=Z.join(o,Z.basename(s));n.startsWith(o)||i.push({file:Z.basename(s),currentPath:n,suggestedPath:l,reason:`Heuristics suggest this belongs in ${o} based on purpose and content.`})}return i}async function kT(r){let e=["domain","infrastructure","plumbing"],t=0;for(let i of e){let s=Z.join(r,"src",i);try{let a=(await re.readdir(s,{withFileTypes:!0})).filter(p=>p.isFile()&&!p.name.startsWith("."));if(a.length===0)continue;let o=a.map(p=>`- \`${p.name}\``).join(`
595
- `),l=`This zone currently contains ${a.length} sprouts that define our ${i.toUpperCase()} layer.`,c=Z.join(s,"README.md"),d=`# ${i.charAt(0).toUpperCase()+i.slice(1)} Zone
596
-
597
- ${l}
598
-
599
- ### Current Inhabitants:
600
- ${o}
601
-
602
- *Last synthesized by Marie on ${new Date().toLocaleDateString()}*`;await re.writeFile(c,d,"utf-8"),t++}catch(n){console.error(`Failed to synthesize manual for ${i}:`,n)}}return`Synthesized ${t} zone manuals. The knowledge is now fresh. \u2728`}async function ww(r,e){let t=await Cf(r,e);if(t.length===0)return"No restoration needed. Project order is absolute. \u2728";let i=0;for(let s of t)try{let n=Z.join(r,s.currentPath),a=Z.join(r,s.suggestedPath);await re.mkdir(Z.dirname(a),{recursive:!0}),await re.rename(n,a),i++}catch(n){console.error(`Restoration failed for ${s.file}:`,n)}return`Restoration complete. Moved ${i} files to their rightful homes. \u{1F338}`}async function Af(r){let e=[{name:"domain",file:"DomainEntity.ts",content:`export abstract class DomainEntity {
603
- constructor(public readonly id: string) {}
604
- // The Domain is pure logic. No dependencies here. \u2728
605
- }
606
- `},{name:"infrastructure",file:"BaseAdapter.ts",content:`export abstract class BaseAdapter {
607
- // Infrastructure connects the Domain to the world. \u{1F30D}
608
- protected abstract connect(): Promise<void>;
609
- }
610
- `},{name:"plumbing",file:"BaseTool.ts",content:`export abstract class BaseTool {
611
- // Plumbing is mechanical. Low-level work. \u{1F527}
612
- protected format(input: string): string {
613
- return input.trim();
614
- }
615
- }
616
- `}],t=0;for(let i of e){let s=Z.join(r,"src",i.name),n=Z.join(s,i.file);try{await re.mkdir(s,{recursive:!0});try{await re.access(n)}catch{await re.writeFile(n,i.content,"utf-8"),t++}}catch(a){console.error(`Scaffolding failed for ${i.name}:`,a)}}return t>0?`Scaffolded ${t} zone abstractions. The patterns are set. \u{1F3DB}\uFE0F`:"Zones are already well-guarded."}async function bw(r,e,t){let i=[{name:"domain",suffix:"Entity.ts",comment:"Core logic and business rules. Purity and intent reside here. \u2728"},{name:"infrastructure",suffix:"Repository.ts",comment:"Connecting the core to the world. Adapters and data reside here. \u{1F30D}"},{name:"plumbing",suffix:"Utils.ts",comment:"The mechanical support. Technical utilities reside here. \u{1F527}"}],s=e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase(),n=e.charAt(0).toUpperCase()+e.slice(1),a=0;for(let o of i){let l=Z.join(r,"src",o.name,s),c=`${n}${o.suffix}`,d=Z.join(l,c),p=`/**
617
- * ${n} ${o.name.charAt(0).toUpperCase()+o.name.slice(1)}
618
- * Intent: ${t}
619
- *
620
- * ${o.comment}
621
- */
622
-
623
- export class ${n}${o.suffix.replace(".ts","")} {
624
- // A new sprout in the ${o.name} zone.
625
- }
626
- `;try{await re.mkdir(l,{recursive:!0}),await re.writeFile(d,p,"utf-8"),a++}catch(m){console.error(`Sowing failed for ${o.name}:`,m)}}return`Successfully sowed '${e}' across ${a} JOY zones. Your feature has taken root. \u{1F331}`}async function $d(r){let e=["domain","infrastructure","plumbing"],t=[];for(let i of e){let s=Z.join(r,"src",i);try{let a=(await re.readdir(s,{withFileTypes:!0})).filter(o=>o.isFile()&&!o.name.startsWith("."));if(a.length>10){let o=a.map(d=>d.name),c=["Service","Repository","Entity","Tool","Util","Adapter"].filter(d=>o.some(p=>p.includes(d)));t.push({zone:i,fileCount:a.length,suggestedClusters:c.length>0?c:["common","core","shared"],reason:`The ${i} zone is becoming a bit crowded with ${a.length} files. Clustering will restore clarity.`})}}catch{}}return t}async function wl(r){try{let e=["src/domain","src/infrastructure","src/plumbing"];for(let t of e)await re.access(Z.join(r,t));return!0}catch{return!1}}async function vw(r,e){let t=await Rf(r,e),i=0;for(let s of t){if(s.includes("node_modules")||s.includes(".git")||s.includes("dist")||!s.endsWith(".ts")&&!s.endsWith(".tsx")&&!s.endsWith(".js"))continue;let n=Z.relative(r,s);if(n.startsWith("src/domain")||n.startsWith("src/infrastructure")||n.startsWith("src/plumbing"))continue;let a=await re.readFile(s,"utf-8"),o=yw(Z.basename(s),a),l=Z.join(r,o,Z.basename(s));try{await re.mkdir(Z.dirname(l),{recursive:!0}),await re.rename(s,l),i++}catch(c){console.error(`Genesis move failed for ${s}:`,c)}}return await Nf(r),await kT(r),`Genesis Ritual complete. Converted ${i} files to the JOY ecosystem. Your project is reborn. \u2728`}async function Rf(r,e){let t=[],i=new Set(V.getExcludedFiles()),s=5e3;async function n(a){if(!(e?.aborted||t.length>=s))try{let o=await re.readdir(a,{withFileTypes:!0});for(let l of o){if(e?.aborted||t.length>=s)return;let c=Z.join(a,l.name);l.isDirectory()?i.has(l.name)||await n(c):t.push(c)}}catch{}}try{await n(r)}catch(a){console.error(`[JoyTools] Scan failed for ${r}:`,a)}return t}var re,Z,en=g(()=>{re=k(require("fs/promises"),1),Z=k(require("path"),1);Ot();bT();ur()});var PT,rn,kf=g(()=>{PT=k(require("fs/promises"),1),rn=class{static async analyze(e){try{let t=await PT.readFile(e,"utf-8"),s=t.split(`
627
- `).length,a=(t.match(/\b(if|else if|for|while|case|catch|&&|\|\||!=|==|!==|===)\b/g)?.length||0)+1,o="Clean",l=[];return a>20||s>300?(o="Toxic",l.push("This module is significantly cluttered. Consider decomposing into smaller 'Sprouts'.")):a>10||s>150?(o="Tangled",l.push("The logic is starting to tangle. A refactor ('Bloom') is recommended.")):a>5&&(o="Sparking",l.push("The code is healthy but keep an eye on control flow depth.")),{cyclomaticComplexity:a,loc:s,clutterLevel:o,suggestions:l}}catch(t){throw new Error(`Failed to analyze complexity for ${e}: ${t}`)}}}});var BT={};qr(BT,{ContextArchiveService:()=>xl});var qT,Sl,xw,xl,Tw=g(()=>{qT=k(require("vscode"),1),Sl=k(require("fs/promises"),1),xw=k(require("path"),1);ur();xl=class r{static instance;anchors=new Map;ready;static context;constructor(){this.ready=this.initializeEngine()}static init(e){this.context=e}async awaitReady(){return this.ready}static getInstance(){return r.instance||(r.instance=new r),r.instance}async initializeEngine(){await Q.initialize();let i=await(await Q.getInstance()).getRepository("anchors").objects.all();i.length>0?(this.anchors=new Map(i.map(s=>[s.id,s])),console.log(`[ContextArchiveService] Loaded ${i.length} anchors from Sovereign Mind.`)):await this.loadFromLegacyDisk()}async loadFromLegacyDisk(){if(!r.context)return;let e=r.context.storageUri;if(!e)return;let t=xw.join(e.fsPath,"marie_memory.json");try{let i=await Sl.readFile(t,"utf-8"),s=JSON.parse(i);this.anchors=new Map(Object.entries(s)),await this.migrateToNoormme(),await Sl.rename(t,t+".migrated")}catch{await this.migrateFromWorkspaceRoot(t)}}async migrateFromWorkspaceRoot(e){let t=qT.workspace.workspaceFolders?.[0]?.uri.fsPath;if(!t)return;let i=xw.join(t,".marie_memory.json");try{let s=await Sl.readFile(i,"utf-8"),n=JSON.parse(s);this.anchors=new Map(Object.entries(n)),await this.migrateToNoormme(),await Sl.rename(i,i+".bak"),console.log(`[ContextArchiveService] Migrated memory from ${i} to Sovereign Mind`)}catch{}}async migrateToNoormme(){let t=(await Q.getInstance()).getRepository("anchors"),i=Array.from(this.anchors.values());for(let s of i)await t.create(s);console.log(`[ContextArchiveService] Successfully migrated ${i.length} anchors to NOORMME.`)}async anchor(e){await this.ready;let t={...e,timestamp:Date.now()};this.anchors.set(e.id,t);let i=await Q.getInstance(),s=i.getRepository("anchors"),n=await s.objects.filter({id:e.id}).first(),a={...t,content:t.content.replace(/'/g,"''")};n?await i.execute(`UPDATE anchors SET label = '${a.label}', content = '${a.content}', type = '${a.type}', timestamp = ${a.timestamp} WHERE id = '${a.id}'`):await s.create(t)}getAllAnchors(){if(this.anchors.size===0)return"No context is currently anchored.";let e=[`# \u2693 Anchored Strategic Context
628
-
629
- `],t=Array.from(this.anchors.values()).sort((i,s)=>s.timestamp-i.timestamp);for(let i of t)e.push(`### ${i.label} (${i.type})
630
- `),e.push(`ID: \`${i.id}\` | Time: ${new Date(i.timestamp).toLocaleTimeString()}
631
- `),e.push(`\`\`\`
632
- ${i.content}
633
- \`\`\`
634
-
635
- `);return e.join("")}async release(e){await this.ready;let t=this.anchors.delete(e);return t&&await(await Q.getInstance()).execute(`DELETE FROM anchors WHERE id = '${e}'`),t}}});var gr,Le,UT,Tl,_w=g(()=>{gr=k(require("fs/promises"),1),Le=k(require("path"),1),UT=k(require("crypto"),1);yf();kf();Ot();Tl=class{static ZONES={DOMAIN:"domain",INFRASTRUCTURE:"infrastructure",PLUMBING:"plumbing"};static STATE_FILE=".marie/sentinel_state.json";static async audit(e,t){let i=await this.getAllFiles(e),s=t?[t]:i,n=[],a=[],o=[],l=[],c=[],d=[],p=new Map,m=new Map,h=await this.loadState(e),f=h.fileHashes||{},w={},b=V.getAutonomyMode()==="ascension";if(await Promise.all(i.map(async D=>{let $=(await gr.stat(D)).mtimeMs,M=Le.relative(e,D);w[M]=$;let F=f[M]!==$,U=await gr.readFile(D,"utf8");if(!b){let A=this.computeSemanticHash(U);if(m.has(A)){let q=m.get(A);q!==M&&l.push(`[Semantic Duplicate] ${M} matches ${q}`)}else m.set(A,M)}let pe=this.extractImports(U),N=(await Promise.all(pe.map(A=>this.resolveImportDeep(A,D,e)))).filter(Boolean);p.set(M,N),s.includes(D)&&F&&await this.analyzeFile(D,e,U,N,n,o,c,d)})),!b){let D=this.detectCycles(p);a.push(...D)}let v=await mr.runLint(e),S=n.length*8+v.length*1+a.length*15+d.length*6+o.length*5+l.length*10+c.length*12,y=S-h.lastEntropy;await this.saveState(e,{lastEntropy:S,history:[...h.history,{date:new Date().toISOString(),entropy:S}].slice(-20),fileHashes:w});let _="Stable";S>30?_="Toxic":S>15?_="Fragile":S>7&&(_="Fluid");let E={timestamp:new Date().toISOString(),zoneViolations:n,circularDependencies:a,leakyAbstractions:o,duplication:l,entropyScore:S,entropyDelta:y,stability:_,hotspots:Array.from(new Set([...n.map(D=>D.split(" ")[1]),...d])).slice(0,5),quarantineCandidates:d,navigationDrifts:c,graphDefinition:this.generateMermaidGraph(p,n),passed:S<20&&y<=0};return await this.writeToSentinelLog(e,E),E}static computeSemanticHash(e){let t=e.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\b(const|let|var)\s+\w+\b/g,"VAR").replace(/\bfunction\s+\w+\b/g,"FUNC").trim();return UT.createHash("sha256").update(t).digest("hex")}static async resolveImportDeep(e,t,i){if(!e.startsWith("."))return null;let s=Le.dirname(t),n=[Le.resolve(s,e),Le.resolve(s,`${e}.ts`),Le.resolve(s,`${e}.tsx`),Le.resolve(s,`${e}.js`),Le.resolve(s,e,"index.ts"),Le.resolve(s,e,"index.js")];for(let a of n)try{if((await gr.stat(a)).isFile())return Le.relative(i,a)}catch{continue}return null}static async analyzeFile(e,t,i,s,n,a,o,l){let c=Le.relative(t,e),d=this.getZone(c);if(!d)return;for(let m of s){let h=this.getZone(m);h&&(d===this.ZONES.DOMAIN&&h!==this.ZONES.DOMAIN&&n.push(`[Purity Breach] ${c} -> ${m} (${h})`),d===this.ZONES.INFRASTRUCTURE&&h===this.ZONES.PLUMBING&&n.push(`[Architecture Leak] ${c} -> ${m} (Infrastructure cannot use Plumbing)`))}d===this.ZONES.DOMAIN&&/\b(fs|path|os|vscode|express|React|HTMLElement|Buffer|process|window|document)\b/.test(i)&&a.push(`[System Leak] ${c} references non-domain types.`);let p=await rn.analyze(e);(p.cyclomaticComplexity>20||p.clutterLevel==="Toxic")&&l.push(c),(c.includes(".tsx")||i.includes("react-router-dom"))&&(/path=['"]\/(blog|docs|legal|support)\/:slug['"]/g.test(i)&&o.push(`[Ecclesiastical Violation] ${c} uses flat routes. Use hierarchical schema (e.g., /blog/:year/:month/:slug).`),i.includes("ArticleView")&&!i.includes("Breadcrumbs")&&o.push(`[Liturgical Violation] ${c} is a content view missing mandatory Breadcrumbs.`))}static getZone(e){return e.includes("src/domain")||e.includes("/domain/")?this.ZONES.DOMAIN:e.includes("src/infrastructure")||e.includes("/infrastructure/")?this.ZONES.INFRASTRUCTURE:e.includes("src/plumbing")||e.includes("/plumbing/")?this.ZONES.PLUMBING:null}static extractImports(e){let t=[],i=/from\s+['"](.*?)['"]/g,s=/require\(['"](.*?)['"]\)/g,n;for(;(n=i.exec(e))!==null;)t.push(n[1]);for(;(n=s.exec(e))!==null;)t.push(n[1]);return Array.from(new Set(t))}static detectCycles(e){let t=[],i=new Set,s=new Set,n=(a,o)=>{i.add(a),s.add(a);for(let l of e.get(a)||[])s.has(l)?t.push(`\u{1F504} ${o.join(" -> ")} -> ${l}`):i.has(l)||n(l,[...o,l]);s.delete(a)};for(let a of e.keys())i.has(a)||n(a,[a]);return t}static generateMermaidGraph(e,t){let i=`graph TD;
636
- `;return Array.from(e.keys()).slice(0,40).forEach(n=>{let a=n.replace(/[^a-zA-Z0-9]/g,"_"),o=Le.basename(n);e.get(n)?.forEach(l=>{let c=l.replace(/[^a-zA-Z0-9]/g,"_"),d=t.some(p=>p.includes(n)&&p.includes(l));i+=` ${a}[${o}] --> ${c}[${Le.basename(l)}];
637
- `,d&&(i+=` style ${a} fill:#f96,stroke:#333,stroke-width:2px
638
- `)})}),i}static async loadState(e){try{let t=await gr.readFile(Le.join(e,this.STATE_FILE),"utf8");return JSON.parse(t)}catch{return{lastEntropy:0,history:[],fileHashes:{}}}}static async saveState(e,t){let i=Le.join(e,".marie");await gr.mkdir(i,{recursive:!0}),await gr.writeFile(Le.join(e,this.STATE_FILE),JSON.stringify(t,null,2))}static async getAllFiles(e){let t=await gr.readdir(e,{withFileTypes:!0});return(await Promise.all(t.map(s=>{let n=Le.resolve(e,s.name);return n.includes("node_modules")||n.includes(".git")||n.includes("dist")?[]:s.isDirectory()?this.getAllFiles(n):n}))).flat().filter(s=>/\.(ts|tsx)$/.test(s))}static async writeToSentinelLog(e,t){let i=Le.join(e,"SENTINEL.md"),s=`
639
- # \u{1F6E1}\uFE0F Sentinel Report: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}
640
-
641
- **Stability**: ${t.stability}
642
- **Entropy**: ${t.entropyScore} (${t.entropyDelta>0?"\u26A0\uFE0F Regression":"\u2705 Monotonic"})
643
- **Ratchet**: ${t.entropyDelta>0?"\u{1F6AB} LOCKED":"\u{1F513} OPEN"}
644
-
645
- ## \u{1F4CA} Metrics
646
- - **Zoning Law**: ${t.zoneViolations.length} violations
647
- - **Cyclic Rot**: ${t.circularDependencies.length} cycles
648
- - **Duplication**: ${t.duplication.length} instances
649
- - **Toxicity**: ${t.quarantineCandidates.length} hotspots
650
- - **Navigation Drift**: ${t.navigationDrifts.length} violations
651
-
652
- ## \u{1F5FA}\uFE0F Visual Architecture
653
- \`\`\`mermaid
654
- ${t.graphDefinition}
655
- \`\`\`
656
-
657
- ## \u{1F4DC} High-Priority Alerts
658
- ${t.zoneViolations.slice(0,5).map(n=>`- \u274C ${n}`).join(`
659
- `)}
660
- ${t.circularDependencies.slice(0,3).map(n=>`- \u{1F504} ${n}`).join(`
661
- `)}
662
- ${t.duplication.slice(0,3).map(n=>`- \u{1F46F} ${n}`).join(`
663
- `)}
664
- ${t.navigationDrifts.slice(0,5).map(n=>`- \u{1F9ED} ${n}`).join(`
665
- `)}
666
-
667
- ---
668
- *Marie Sentinel v3.1 \u2014 Grounded Architectural Guardian*
669
- `;await gr.writeFile(i,s)}}});var El,Bd,VT=g(()=>{El=k(require("node:fs/promises"),1),Bd=class{static async mend(e,t){let s=(await El.readFile(e,"utf-8")).split(`
670
- `),n=0,a=[...t].sort((o,l)=>l.line-o.line);for(let o of a){let l=o.line-1;if(l<0||l>=s.length)continue;let c=s[l],d=c;if(o.message.includes("is defined but never used")||o.message.includes("unused")){let p=o.message.match(/'([^']+)'/),m=p?p[1]:null;m&&c.includes(m)&&(c=c.replace(new RegExp(`\\b${m}\\b`),`_${m}`))}(o.ruleId==="prefer-const"||o.message.includes("should be a const"))&&(c=c.replace(/\blet\b/,"const")),o.ruleId==="semi"&&o.message.includes("Missing semicolon")&&(c.trim().endsWith(";")||(c=c.trimEnd()+";")),o.ruleId==="no-var"&&(c=c.replace(/\bvar\b/,"let")),c!==d&&(s[l]=c,n++)}return n>0?(await El.writeFile(e,s.join(`
671
- `),"utf-8"),{mended:!0,fixedCount:n}):{mended:!1,fixedCount:0}}static async enforceTypeSovereignty(e){let t=await El.readFile(e,"utf-8"),i=t.replace(/\s+as\s+any\b/g," /* \u{1F6A9} Type sovereignty breach corrected */");return t!==i?(await El.writeFile(e,i,"utf-8"),1):0}}});var GT={};qr(GT,{QualityGuardrailService:()=>Ew});var HT,QT,Ew,KT=g(()=>{yf();uw();kf();VT();_w();HT=k(require("node:path"),1),QT=k(require("node:fs/promises"),1),Ew=class{static async evaluate(e,t){let i=[],s=!0,n=!1,a=0;a+=await Bd.enforceTypeSovereignty(t);let o=await mr.runLintOnFile(e,t);if(o.length>0){(await mr.fixFile(e,t)).success&&(n=!0);let b=await Bd.mend(t,o);b.mended&&(a+=b.fixedCount,o=await mr.runLintOnFile(e,t))}let l=o.filter(w=>w.severity==="error");l.length>0&&(s=!1,i.push(`Lint Regression: ${l.length} persistent error(s) found.`));let[c,d,p,m]=await Promise.all([Tl.audit(e,t),rn.analyze(t),gl.runTargetedTests(e,t),QT.readFile(t,"utf-8")]);c.zoneViolations.length>0&&(i.push(...c.zoneViolations),s=!1),c.circularDependencies.length>0&&(i.push(...c.circularDependencies),s=!1),c.leakyAbstractions.length>0&&(i.push(...c.leakyAbstractions),s=!1),c.duplication.length>0&&(i.push(...c.duplication),s=!1),c.entropyDelta>0&&(i.push(`RATCHET LOCK: Entropy increased by +${c.entropyDelta}. Changes must maintain or lower entropy.`),s=!1),c.quarantineCandidates.includes(HT.relative(e,t))&&(i.push("TOXICITY ALERT: This file is a quarantine candidate. Immediate refactor required."),s=!1),d.clutterLevel==="Toxic"&&(s=!1,i.push(`Complexity Alert: Cyclomatic complexity (${d.cyclomaticComplexity}) exceeds production safety limits.`));let h=(m.match(/:\s*any\b|as\s+any\b|<\s*any\s*>/gi)||[]).length;h>0&&(s=!1,i.push(`Type Sovereignty Breach: ${h} instance(s) of 'any' detected. Be more precise.`)),p&&!p.success&&(s=!1,i.push(`Test Regression: ${p.failedTests.length} related test(s) failed.`));let f=100;return f-=c.zoneViolations.length*15,f-=c.circularDependencies.length*20,f-=c.leakyAbstractions.length*10,f-=c.duplication.length*10,f-=c.entropyDelta>0?50:0,f-=l.length*10,f-=d.cyclomaticComplexity>10?20:0,f-=h*5,p&&!p.success&&(f-=40),f=Math.max(0,f),{passed:s,score:f,violations:i,autoFixed:n,surgicalMends:a,metrics:{lintErrors:l.length,complexity:d.cyclomaticComplexity,testsPassed:p?p.success:null,zoningHealthy:c.zoneViolations.length===0,typeSovereignty:h===0,entropy:c.entropyScore}}}}});var Y_=O((Lge,X_)=>{"use strict";var qe={};X_.exports=qe;function J_(r){return r<0?-1:1}function JD(r){return r%1===.5&&(r&1)===0?Math.floor(r):Math.round(r)}function un(r,e){e.unsigned||--r;let t=e.unsigned?0:-Math.pow(2,r),i=Math.pow(2,r)-1,s=e.moduloBitLength?Math.pow(2,e.moduloBitLength):Math.pow(2,r),n=e.moduloBitLength?Math.pow(2,e.moduloBitLength-1):Math.pow(2,r-1);return function(a,o){o||(o={});let l=+a;if(o.enforceRange){if(!Number.isFinite(l))throw new TypeError("Argument is not a finite number");if(l=J_(l)*Math.floor(Math.abs(l)),l<t||l>i)throw new TypeError("Argument is not in byte range");return l}if(!isNaN(l)&&o.clamp)return l=JD(l),l<t&&(l=t),l>i&&(l=i),l;if(!Number.isFinite(l)||l===0)return 0;if(l=J_(l)*Math.floor(Math.abs(l)),l=l%s,!e.unsigned&&l>=n)return l-s;if(e.unsigned){if(l<0)l+=s;else if(l===-0)return 0}return l}}qe.void=function(){};qe.boolean=function(r){return!!r};qe.byte=un(8,{unsigned:!1});qe.octet=un(8,{unsigned:!0});qe.short=un(16,{unsigned:!1});qe["unsigned short"]=un(16,{unsigned:!0});qe.long=un(32,{unsigned:!1});qe["unsigned long"]=un(32,{unsigned:!0});qe["long long"]=un(32,{unsigned:!1,moduloBitLength:64});qe["unsigned long long"]=un(32,{unsigned:!0,moduloBitLength:64});qe.double=function(r){let e=+r;if(!Number.isFinite(e))throw new TypeError("Argument is not a finite floating-point value");return e};qe["unrestricted double"]=function(r){let e=+r;if(isNaN(e))throw new TypeError("Argument is NaN");return e};qe.float=qe.double;qe["unrestricted float"]=qe["unrestricted double"];qe.DOMString=function(r,e){return e||(e={}),e.treatNullAsEmptyString&&r===null?"":String(r)};qe.ByteString=function(r,e){let t=String(r),i;for(let s=0;(i=t.codePointAt(s))!==void 0;++s)if(i>255)throw new TypeError("Argument is not a valid bytestring");return t};qe.USVString=function(r){let e=String(r),t=e.length,i=[];for(let s=0;s<t;++s){let n=e.charCodeAt(s);if(n<55296||n>57343)i.push(String.fromCodePoint(n));else if(56320<=n&&n<=57343)i.push(String.fromCodePoint(65533));else if(s===t-1)i.push(String.fromCodePoint(65533));else{let a=e.charCodeAt(s+1);if(56320<=a&&a<=57343){let o=n&1023,l=a&1023;i.push(String.fromCodePoint(65536+1024*o+l)),++s}else i.push(String.fromCodePoint(65533))}}return i.join("")};qe.Date=function(r,e){if(!(r instanceof Date))throw new TypeError("Argument is not a Date object");if(!isNaN(r))return r};qe.RegExp=function(r,e){return r instanceof RegExp||(r=new RegExp(r)),r}});var Z_=O((qge,mn)=>{"use strict";mn.exports.mixin=function(e,t){let i=Object.getOwnPropertyNames(t);for(let s=0;s<i.length;++s)Object.defineProperty(e,i[s],Object.getOwnPropertyDescriptor(t,i[s]))};mn.exports.wrapperSymbol=Symbol("wrapper");mn.exports.implSymbol=Symbol("impl");mn.exports.wrapperForImpl=function(r){return r[mn.exports.wrapperSymbol]};mn.exports.implForWrapper=function(r){return r[mn.exports.implSymbol]}});var eE=O((Bge,XD)=>{XD.exports=[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"],[[47,47],"disallowed_STD3_valid"],[[48,57],"valid"],[[58,64],"disallowed_STD3_valid"],[[65,65],"mapped",[97]],[[66,66],"mapped",[98]],[[67,67],"mapped",[99]],[[68,68],"mapped",[100]],[[69,69],"mapped",[101]],[[70,70],"mapped",[102]],[[71,71],"mapped",[103]],[[72,72],"mapped",[104]],[[73,73],"mapped",[105]],[[74,74],"mapped",[106]],[[75,75],"mapped",[107]],[[76,76],"mapped",[108]],[[77,77],"mapped",[109]],[[78,78],"mapped",[110]],[[79,79],"mapped",[111]],[[80,80],"mapped",[112]],[[81,81],"mapped",[113]],[[82,82],"mapped",[114]],[[83,83],"mapped",[115]],[[84,84],"mapped",[116]],[[85,85],"mapped",[117]],[[86,86],"mapped",[118]],[[87,87],"mapped",[119]],[[88,88],"mapped",[120]],[[89,89],"mapped",[121]],[[90,90],"mapped",[122]],[[91,96],"disallowed_STD3_valid"],[[97,122],"valid"],[[123,127],"disallowed_STD3_valid"],[[128,159],"disallowed"],[[160,160],"disallowed_STD3_mapped",[32]],[[161,167],"valid",[],"NV8"],[[168,168],"disallowed_STD3_mapped",[32,776]],[[169,169],"valid",[],"NV8"],[[170,170],"mapped",[97]],[[171,172],"valid",[],"NV8"],[[173,173],"ignored"],[[174,174],"valid",[],"NV8"],[[175,175],"disallowed_STD3_mapped",[32,772]],[[176,177],"valid",[],"NV8"],[[178,178],"mapped",[50]],[[179,179],"mapped",[51]],[[180,180],"disallowed_STD3_mapped",[32,769]],[[181,181],"mapped",[956]],[[182,182],"valid",[],"NV8"],[[183,183],"valid"],[[184,184],"disallowed_STD3_mapped",[32,807]],[[185,185],"mapped",[49]],[[186,186],"mapped",[111]],[[187,187],"valid",[],"NV8"],[[188,188],"mapped",[49,8260,52]],[[189,189],"mapped",[49,8260,50]],[[190,190],"mapped",[51,8260,52]],[[191,191],"valid",[],"NV8"],[[192,192],"mapped",[224]],[[193,193],"mapped",[225]],[[194,194],"mapped",[226]],[[195,195],"mapped",[227]],[[196,196],"mapped",[228]],[[197,197],"mapped",[229]],[[198,198],"mapped",[230]],[[199,199],"mapped",[231]],[[200,200],"mapped",[232]],[[201,201],"mapped",[233]],[[202,202],"mapped",[234]],[[203,203],"mapped",[235]],[[204,204],"mapped",[236]],[[205,205],"mapped",[237]],[[206,206],"mapped",[238]],[[207,207],"mapped",[239]],[[208,208],"mapped",[240]],[[209,209],"mapped",[241]],[[210,210],"mapped",[242]],[[211,211],"mapped",[243]],[[212,212],"mapped",[244]],[[213,213],"mapped",[245]],[[214,214],"mapped",[246]],[[215,215],"valid",[],"NV8"],[[216,216],"mapped",[248]],[[217,217],"mapped",[249]],[[218,218],"mapped",[250]],[[219,219],"mapped",[251]],[[220,220],"mapped",[252]],[[221,221],"mapped",[253]],[[222,222],"mapped",[254]],[[223,223],"deviation",[115,115]],[[224,246],"valid"],[[247,247],"valid",[],"NV8"],[[248,255],"valid"],[[256,256],"mapped",[257]],[[257,257],"valid"],[[258,258],"mapped",[259]],[[259,259],"valid"],[[260,260],"mapped",[261]],[[261,261],"valid"],[[262,262],"mapped",[263]],[[263,263],"valid"],[[264,264],"mapped",[265]],[[265,265],"valid"],[[266,266],"mapped",[267]],[[267,267],"valid"],[[268,268],"mapped",[269]],[[269,269],"valid"],[[270,270],"mapped",[271]],[[271,271],"valid"],[[272,272],"mapped",[273]],[[273,273],"valid"],[[274,274],"mapped",[275]],[[275,275],"valid"],[[276,276],"mapped",[277]],[[277,277],"valid"],[[278,278],"mapped",[279]],[[279,279],"valid"],[[280,280],"mapped",[281]],[[281,281],"valid"],[[282,282],"mapped",[283]],[[283,283],"valid"],[[284,284],"mapped",[285]],[[285,285],"valid"],[[286,286],"mapped",[287]],[[287,287],"valid"],[[288,288],"mapped",[289]],[[289,289],"valid"],[[290,290],"mapped",[291]],[[291,291],"valid"],[[292,292],"mapped",[293]],[[293,293],"valid"],[[294,294],"mapped",[295]],[[295,295],"valid"],[[296,296],"mapped",[297]],[[297,297],"valid"],[[298,298],"mapped",[299]],[[299,299],"valid"],[[300,300],"mapped",[301]],[[301,301],"valid"],[[302,302],"mapped",[303]],[[303,303],"valid"],[[304,304],"mapped",[105,775]],[[305,305],"valid"],[[306,307],"mapped",[105,106]],[[308,308],"mapped",[309]],[[309,309],"valid"],[[310,310],"mapped",[311]],[[311,312],"valid"],[[313,313],"mapped",[314]],[[314,314],"valid"],[[315,315],"mapped",[316]],[[316,316],"valid"],[[317,317],"mapped",[318]],[[318,318],"valid"],[[319,320],"mapped",[108,183]],[[321,321],"mapped",[322]],[[322,322],"valid"],[[323,323],"mapped",[324]],[[324,324],"valid"],[[325,325],"mapped",[326]],[[326,326],"valid"],[[327,327],"mapped",[328]],[[328,328],"valid"],[[329,329],"mapped",[700,110]],[[330,330],"mapped",[331]],[[331,331],"valid"],[[332,332],"mapped",[333]],[[333,333],"valid"],[[334,334],"mapped",[335]],[[335,335],"valid"],[[336,336],"mapped",[337]],[[337,337],"valid"],[[338,338],"mapped",[339]],[[339,339],"valid"],[[340,340],"mapped",[341]],[[341,341],"valid"],[[342,342],"mapped",[343]],[[343,343],"valid"],[[344,344],"mapped",[345]],[[345,345],"valid"],[[346,346],"mapped",[347]],[[347,347],"valid"],[[348,348],"mapped",[349]],[[349,349],"valid"],[[350,350],"mapped",[351]],[[351,351],"valid"],[[352,352],"mapped",[353]],[[353,353],"valid"],[[354,354],"mapped",[355]],[[355,355],"valid"],[[356,356],"mapped",[357]],[[357,357],"valid"],[[358,358],"mapped",[359]],[[359,359],"valid"],[[360,360],"mapped",[361]],[[361,361],"valid"],[[362,362],"mapped",[363]],[[363,363],"valid"],[[364,364],"mapped",[365]],[[365,365],"valid"],[[366,366],"mapped",[367]],[[367,367],"valid"],[[368,368],"mapped",[369]],[[369,369],"valid"],[[370,370],"mapped",[371]],[[371,371],"valid"],[[372,372],"mapped",[373]],[[373,373],"valid"],[[374,374],"mapped",[375]],[[375,375],"valid"],[[376,376],"mapped",[255]],[[377,377],"mapped",[378]],[[378,378],"valid"],[[379,379],"mapped",[380]],[[380,380],"valid"],[[381,381],"mapped",[382]],[[382,382],"valid"],[[383,383],"mapped",[115]],[[384,384],"valid"],[[385,385],"mapped",[595]],[[386,386],"mapped",[387]],[[387,387],"valid"],[[388,388],"mapped",[389]],[[389,389],"valid"],[[390,390],"mapped",[596]],[[391,391],"mapped",[392]],[[392,392],"valid"],[[393,393],"mapped",[598]],[[394,394],"mapped",[599]],[[395,395],"mapped",[396]],[[396,397],"valid"],[[398,398],"mapped",[477]],[[399,399],"mapped",[601]],[[400,400],"mapped",[603]],[[401,401],"mapped",[402]],[[402,402],"valid"],[[403,403],"mapped",[608]],[[404,404],"mapped",[611]],[[405,405],"valid"],[[406,406],"mapped",[617]],[[407,407],"mapped",[616]],[[408,408],"mapped",[409]],[[409,411],"valid"],[[412,412],"mapped",[623]],[[413,413],"mapped",[626]],[[414,414],"valid"],[[415,415],"mapped",[629]],[[416,416],"mapped",[417]],[[417,417],"valid"],[[418,418],"mapped",[419]],[[419,419],"valid"],[[420,420],"mapped",[421]],[[421,421],"valid"],[[422,422],"mapped",[640]],[[423,423],"mapped",[424]],[[424,424],"valid"],[[425,425],"mapped",[643]],[[426,427],"valid"],[[428,428],"mapped",[429]],[[429,429],"valid"],[[430,430],"mapped",[648]],[[431,431],"mapped",[432]],[[432,432],"valid"],[[433,433],"mapped",[650]],[[434,434],"mapped",[651]],[[435,435],"mapped",[436]],[[436,436],"valid"],[[437,437],"mapped",[438]],[[438,438],"valid"],[[439,439],"mapped",[658]],[[440,440],"mapped",[441]],[[441,443],"valid"],[[444,444],"mapped",[445]],[[445,451],"valid"],[[452,454],"mapped",[100,382]],[[455,457],"mapped",[108,106]],[[458,460],"mapped",[110,106]],[[461,461],"mapped",[462]],[[462,462],"valid"],[[463,463],"mapped",[464]],[[464,464],"valid"],[[465,465],"mapped",[466]],[[466,466],"valid"],[[467,467],"mapped",[468]],[[468,468],"valid"],[[469,469],"mapped",[470]],[[470,470],"valid"],[[471,471],"mapped",[472]],[[472,472],"valid"],[[473,473],"mapped",[474]],[[474,474],"valid"],[[475,475],"mapped",[476]],[[476,477],"valid"],[[478,478],"mapped",[479]],[[479,479],"valid"],[[480,480],"mapped",[481]],[[481,481],"valid"],[[482,482],"mapped",[483]],[[483,483],"valid"],[[484,484],"mapped",[485]],[[485,485],"valid"],[[486,486],"mapped",[487]],[[487,487],"valid"],[[488,488],"mapped",[489]],[[489,489],"valid"],[[490,490],"mapped",[491]],[[491,491],"valid"],[[492,492],"mapped",[493]],[[493,493],"valid"],[[494,494],"mapped",[495]],[[495,496],"valid"],[[497,499],"mapped",[100,122]],[[500,500],"mapped",[501]],[[501,501],"valid"],[[502,502],"mapped",[405]],[[503,503],"mapped",[447]],[[504,504],"mapped",[505]],[[505,505],"valid"],[[506,506],"mapped",[507]],[[507,507],"valid"],[[508,508],"mapped",[509]],[[509,509],"valid"],[[510,510],"mapped",[511]],[[511,511],"valid"],[[512,512],"mapped",[513]],[[513,513],"valid"],[[514,514],"mapped",[515]],[[515,515],"valid"],[[516,516],"mapped",[517]],[[517,517],"valid"],[[518,518],"mapped",[519]],[[519,519],"valid"],[[520,520],"mapped",[521]],[[521,521],"valid"],[[522,522],"mapped",[523]],[[523,523],"valid"],[[524,524],"mapped",[525]],[[525,525],"valid"],[[526,526],"mapped",[527]],[[527,527],"valid"],[[528,528],"mapped",[529]],[[529,529],"valid"],[[530,530],"mapped",[531]],[[531,531],"valid"],[[532,532],"mapped",[533]],[[533,533],"valid"],[[534,534],"mapped",[535]],[[535,535],"valid"],[[536,536],"mapped",[537]],[[537,537],"valid"],[[538,538],"mapped",[539]],[[539,539],"valid"],[[540,540],"mapped",[541]],[[541,541],"valid"],[[542,542],"mapped",[543]],[[543,543],"valid"],[[544,544],"mapped",[414]],[[545,545],"valid"],[[546,546],"mapped",[547]],[[547,547],"valid"],[[548,548],"mapped",[549]],[[549,549],"valid"],[[550,550],"mapped",[551]],[[551,551],"valid"],[[552,552],"mapped",[553]],[[553,553],"valid"],[[554,554],"mapped",[555]],[[555,555],"valid"],[[556,556],"mapped",[557]],[[557,557],"valid"],[[558,558],"mapped",[559]],[[559,559],"valid"],[[560,560],"mapped",[561]],[[561,561],"valid"],[[562,562],"mapped",[563]],[[563,563],"valid"],[[564,566],"valid"],[[567,569],"valid"],[[570,570],"mapped",[11365]],[[571,571],"mapped",[572]],[[572,572],"valid"],[[573,573],"mapped",[410]],[[574,574],"mapped",[11366]],[[575,576],"valid"],[[577,577],"mapped",[578]],[[578,578],"valid"],[[579,579],"mapped",[384]],[[580,580],"mapped",[649]],[[581,581],"mapped",[652]],[[582,582],"mapped",[583]],[[583,583],"valid"],[[584,584],"mapped",[585]],[[585,585],"valid"],[[586,586],"mapped",[587]],[[587,587],"valid"],[[588,588],"mapped",[589]],[[589,589],"valid"],[[590,590],"mapped",[591]],[[591,591],"valid"],[[592,680],"valid"],[[681,685],"valid"],[[686,687],"valid"],[[688,688],"mapped",[104]],[[689,689],"mapped",[614]],[[690,690],"mapped",[106]],[[691,691],"mapped",[114]],[[692,692],"mapped",[633]],[[693,693],"mapped",[635]],[[694,694],"mapped",[641]],[[695,695],"mapped",[119]],[[696,696],"mapped",[121]],[[697,705],"valid"],[[706,709],"valid",[],"NV8"],[[710,721],"valid"],[[722,727],"valid",[],"NV8"],[[728,728],"disallowed_STD3_mapped",[32,774]],[[729,729],"disallowed_STD3_mapped",[32,775]],[[730,730],"disallowed_STD3_mapped",[32,778]],[[731,731],"disallowed_STD3_mapped",[32,808]],[[732,732],"disallowed_STD3_mapped",[32,771]],[[733,733],"disallowed_STD3_mapped",[32,779]],[[734,734],"valid",[],"NV8"],[[735,735],"valid",[],"NV8"],[[736,736],"mapped",[611]],[[737,737],"mapped",[108]],[[738,738],"mapped",[115]],[[739,739],"mapped",[120]],[[740,740],"mapped",[661]],[[741,745],"valid",[],"NV8"],[[746,747],"valid",[],"NV8"],[[748,748],"valid"],[[749,749],"valid",[],"NV8"],[[750,750],"valid"],[[751,767],"valid",[],"NV8"],[[768,831],"valid"],[[832,832],"mapped",[768]],[[833,833],"mapped",[769]],[[834,834],"valid"],[[835,835],"mapped",[787]],[[836,836],"mapped",[776,769]],[[837,837],"mapped",[953]],[[838,846],"valid"],[[847,847],"ignored"],[[848,855],"valid"],[[856,860],"valid"],[[861,863],"valid"],[[864,865],"valid"],[[866,866],"valid"],[[867,879],"valid"],[[880,880],"mapped",[881]],[[881,881],"valid"],[[882,882],"mapped",[883]],[[883,883],"valid"],[[884,884],"mapped",[697]],[[885,885],"valid"],[[886,886],"mapped",[887]],[[887,887],"valid"],[[888,889],"disallowed"],[[890,890],"disallowed_STD3_mapped",[32,953]],[[891,893],"valid"],[[894,894],"disallowed_STD3_mapped",[59]],[[895,895],"mapped",[1011]],[[896,899],"disallowed"],[[900,900],"disallowed_STD3_mapped",[32,769]],[[901,901],"disallowed_STD3_mapped",[32,776,769]],[[902,902],"mapped",[940]],[[903,903],"mapped",[183]],[[904,904],"mapped",[941]],[[905,905],"mapped",[942]],[[906,906],"mapped",[943]],[[907,907],"disallowed"],[[908,908],"mapped",[972]],[[909,909],"disallowed"],[[910,910],"mapped",[973]],[[911,911],"mapped",[974]],[[912,912],"valid"],[[913,913],"mapped",[945]],[[914,914],"mapped",[946]],[[915,915],"mapped",[947]],[[916,916],"mapped",[948]],[[917,917],"mapped",[949]],[[918,918],"mapped",[950]],[[919,919],"mapped",[951]],[[920,920],"mapped",[952]],[[921,921],"mapped",[953]],[[922,922],"mapped",[954]],[[923,923],"mapped",[955]],[[924,924],"mapped",[956]],[[925,925],"mapped",[957]],[[926,926],"mapped",[958]],[[927,927],"mapped",[959]],[[928,928],"mapped",[960]],[[929,929],"mapped",[961]],[[930,930],"disallowed"],[[931,931],"mapped",[963]],[[932,932],"mapped",[964]],[[933,933],"mapped",[965]],[[934,934],"mapped",[966]],[[935,935],"mapped",[967]],[[936,936],"mapped",[968]],[[937,937],"mapped",[969]],[[938,938],"mapped",[970]],[[939,939],"mapped",[971]],[[940,961],"valid"],[[962,962],"deviation",[963]],[[963,974],"valid"],[[975,975],"mapped",[983]],[[976,976],"mapped",[946]],[[977,977],"mapped",[952]],[[978,978],"mapped",[965]],[[979,979],"mapped",[973]],[[980,980],"mapped",[971]],[[981,981],"mapped",[966]],[[982,982],"mapped",[960]],[[983,983],"valid"],[[984,984],"mapped",[985]],[[985,985],"valid"],[[986,986],"mapped",[987]],[[987,987],"valid"],[[988,988],"mapped",[989]],[[989,989],"valid"],[[990,990],"mapped",[991]],[[991,991],"valid"],[[992,992],"mapped",[993]],[[993,993],"valid"],[[994,994],"mapped",[995]],[[995,995],"valid"],[[996,996],"mapped",[997]],[[997,997],"valid"],[[998,998],"mapped",[999]],[[999,999],"valid"],[[1e3,1e3],"mapped",[1001]],[[1001,1001],"valid"],[[1002,1002],"mapped",[1003]],[[1003,1003],"valid"],[[1004,1004],"mapped",[1005]],[[1005,1005],"valid"],[[1006,1006],"mapped",[1007]],[[1007,1007],"valid"],[[1008,1008],"mapped",[954]],[[1009,1009],"mapped",[961]],[[1010,1010],"mapped",[963]],[[1011,1011],"valid"],[[1012,1012],"mapped",[952]],[[1013,1013],"mapped",[949]],[[1014,1014],"valid",[],"NV8"],[[1015,1015],"mapped",[1016]],[[1016,1016],"valid"],[[1017,1017],"mapped",[963]],[[1018,1018],"mapped",[1019]],[[1019,1019],"valid"],[[1020,1020],"valid"],[[1021,1021],"mapped",[891]],[[1022,1022],"mapped",[892]],[[1023,1023],"mapped",[893]],[[1024,1024],"mapped",[1104]],[[1025,1025],"mapped",[1105]],[[1026,1026],"mapped",[1106]],[[1027,1027],"mapped",[1107]],[[1028,1028],"mapped",[1108]],[[1029,1029],"mapped",[1109]],[[1030,1030],"mapped",[1110]],[[1031,1031],"mapped",[1111]],[[1032,1032],"mapped",[1112]],[[1033,1033],"mapped",[1113]],[[1034,1034],"mapped",[1114]],[[1035,1035],"mapped",[1115]],[[1036,1036],"mapped",[1116]],[[1037,1037],"mapped",[1117]],[[1038,1038],"mapped",[1118]],[[1039,1039],"mapped",[1119]],[[1040,1040],"mapped",[1072]],[[1041,1041],"mapped",[1073]],[[1042,1042],"mapped",[1074]],[[1043,1043],"mapped",[1075]],[[1044,1044],"mapped",[1076]],[[1045,1045],"mapped",[1077]],[[1046,1046],"mapped",[1078]],[[1047,1047],"mapped",[1079]],[[1048,1048],"mapped",[1080]],[[1049,1049],"mapped",[1081]],[[1050,1050],"mapped",[1082]],[[1051,1051],"mapped",[1083]],[[1052,1052],"mapped",[1084]],[[1053,1053],"mapped",[1085]],[[1054,1054],"mapped",[1086]],[[1055,1055],"mapped",[1087]],[[1056,1056],"mapped",[1088]],[[1057,1057],"mapped",[1089]],[[1058,1058],"mapped",[1090]],[[1059,1059],"mapped",[1091]],[[1060,1060],"mapped",[1092]],[[1061,1061],"mapped",[1093]],[[1062,1062],"mapped",[1094]],[[1063,1063],"mapped",[1095]],[[1064,1064],"mapped",[1096]],[[1065,1065],"mapped",[1097]],[[1066,1066],"mapped",[1098]],[[1067,1067],"mapped",[1099]],[[1068,1068],"mapped",[1100]],[[1069,1069],"mapped",[1101]],[[1070,1070],"mapped",[1102]],[[1071,1071],"mapped",[1103]],[[1072,1103],"valid"],[[1104,1104],"valid"],[[1105,1116],"valid"],[[1117,1117],"valid"],[[1118,1119],"valid"],[[1120,1120],"mapped",[1121]],[[1121,1121],"valid"],[[1122,1122],"mapped",[1123]],[[1123,1123],"valid"],[[1124,1124],"mapped",[1125]],[[1125,1125],"valid"],[[1126,1126],"mapped",[1127]],[[1127,1127],"valid"],[[1128,1128],"mapped",[1129]],[[1129,1129],"valid"],[[1130,1130],"mapped",[1131]],[[1131,1131],"valid"],[[1132,1132],"mapped",[1133]],[[1133,1133],"valid"],[[1134,1134],"mapped",[1135]],[[1135,1135],"valid"],[[1136,1136],"mapped",[1137]],[[1137,1137],"valid"],[[1138,1138],"mapped",[1139]],[[1139,1139],"valid"],[[1140,1140],"mapped",[1141]],[[1141,1141],"valid"],[[1142,1142],"mapped",[1143]],[[1143,1143],"valid"],[[1144,1144],"mapped",[1145]],[[1145,1145],"valid"],[[1146,1146],"mapped",[1147]],[[1147,1147],"valid"],[[1148,1148],"mapped",[1149]],[[1149,1149],"valid"],[[1150,1150],"mapped",[1151]],[[1151,1151],"valid"],[[1152,1152],"mapped",[1153]],[[1153,1153],"valid"],[[1154,1154],"valid",[],"NV8"],[[1155,1158],"valid"],[[1159,1159],"valid"],[[1160,1161],"valid",[],"NV8"],[[1162,1162],"mapped",[1163]],[[1163,1163],"valid"],[[1164,1164],"mapped",[1165]],[[1165,1165],"valid"],[[1166,1166],"mapped",[1167]],[[1167,1167],"valid"],[[1168,1168],"mapped",[1169]],[[1169,1169],"valid"],[[1170,1170],"mapped",[1171]],[[1171,1171],"valid"],[[1172,1172],"mapped",[1173]],[[1173,1173],"valid"],[[1174,1174],"mapped",[1175]],[[1175,1175],"valid"],[[1176,1176],"mapped",[1177]],[[1177,1177],"valid"],[[1178,1178],"mapped",[1179]],[[1179,1179],"valid"],[[1180,1180],"mapped",[1181]],[[1181,1181],"valid"],[[1182,1182],"mapped",[1183]],[[1183,1183],"valid"],[[1184,1184],"mapped",[1185]],[[1185,1185],"valid"],[[1186,1186],"mapped",[1187]],[[1187,1187],"valid"],[[1188,1188],"mapped",[1189]],[[1189,1189],"valid"],[[1190,1190],"mapped",[1191]],[[1191,1191],"valid"],[[1192,1192],"mapped",[1193]],[[1193,1193],"valid"],[[1194,1194],"mapped",[1195]],[[1195,1195],"valid"],[[1196,1196],"mapped",[1197]],[[1197,1197],"valid"],[[1198,1198],"mapped",[1199]],[[1199,1199],"valid"],[[1200,1200],"mapped",[1201]],[[1201,1201],"valid"],[[1202,1202],"mapped",[1203]],[[1203,1203],"valid"],[[1204,1204],"mapped",[1205]],[[1205,1205],"valid"],[[1206,1206],"mapped",[1207]],[[1207,1207],"valid"],[[1208,1208],"mapped",[1209]],[[1209,1209],"valid"],[[1210,1210],"mapped",[1211]],[[1211,1211],"valid"],[[1212,1212],"mapped",[1213]],[[1213,1213],"valid"],[[1214,1214],"mapped",[1215]],[[1215,1215],"valid"],[[1216,1216],"disallowed"],[[1217,1217],"mapped",[1218]],[[1218,1218],"valid"],[[1219,1219],"mapped",[1220]],[[1220,1220],"valid"],[[1221,1221],"mapped",[1222]],[[1222,1222],"valid"],[[1223,1223],"mapped",[1224]],[[1224,1224],"valid"],[[1225,1225],"mapped",[1226]],[[1226,1226],"valid"],[[1227,1227],"mapped",[1228]],[[1228,1228],"valid"],[[1229,1229],"mapped",[1230]],[[1230,1230],"valid"],[[1231,1231],"valid"],[[1232,1232],"mapped",[1233]],[[1233,1233],"valid"],[[1234,1234],"mapped",[1235]],[[1235,1235],"valid"],[[1236,1236],"mapped",[1237]],[[1237,1237],"valid"],[[1238,1238],"mapped",[1239]],[[1239,1239],"valid"],[[1240,1240],"mapped",[1241]],[[1241,1241],"valid"],[[1242,1242],"mapped",[1243]],[[1243,1243],"valid"],[[1244,1244],"mapped",[1245]],[[1245,1245],"valid"],[[1246,1246],"mapped",[1247]],[[1247,1247],"valid"],[[1248,1248],"mapped",[1249]],[[1249,1249],"valid"],[[1250,1250],"mapped",[1251]],[[1251,1251],"valid"],[[1252,1252],"mapped",[1253]],[[1253,1253],"valid"],[[1254,1254],"mapped",[1255]],[[1255,1255],"valid"],[[1256,1256],"mapped",[1257]],[[1257,1257],"valid"],[[1258,1258],"mapped",[1259]],[[1259,1259],"valid"],[[1260,1260],"mapped",[1261]],[[1261,1261],"valid"],[[1262,1262],"mapped",[1263]],[[1263,1263],"valid"],[[1264,1264],"mapped",[1265]],[[1265,1265],"valid"],[[1266,1266],"mapped",[1267]],[[1267,1267],"valid"],[[1268,1268],"mapped",[1269]],[[1269,1269],"valid"],[[1270,1270],"mapped",[1271]],[[1271,1271],"valid"],[[1272,1272],"mapped",[1273]],[[1273,1273],"valid"],[[1274,1274],"mapped",[1275]],[[1275,1275],"valid"],[[1276,1276],"mapped",[1277]],[[1277,1277],"valid"],[[1278,1278],"mapped",[1279]],[[1279,1279],"valid"],[[1280,1280],"mapped",[1281]],[[1281,1281],"valid"],[[1282,1282],"mapped",[1283]],[[1283,1283],"valid"],[[1284,1284],"mapped",[1285]],[[1285,1285],"valid"],[[1286,1286],"mapped",[1287]],[[1287,1287],"valid"],[[1288,1288],"mapped",[1289]],[[1289,1289],"valid"],[[1290,1290],"mapped",[1291]],[[1291,1291],"valid"],[[1292,1292],"mapped",[1293]],[[1293,1293],"valid"],[[1294,1294],"mapped",[1295]],[[1295,1295],"valid"],[[1296,1296],"mapped",[1297]],[[1297,1297],"valid"],[[1298,1298],"mapped",[1299]],[[1299,1299],"valid"],[[1300,1300],"mapped",[1301]],[[1301,1301],"valid"],[[1302,1302],"mapped",[1303]],[[1303,1303],"valid"],[[1304,1304],"mapped",[1305]],[[1305,1305],"valid"],[[1306,1306],"mapped",[1307]],[[1307,1307],"valid"],[[1308,1308],"mapped",[1309]],[[1309,1309],"valid"],[[1310,1310],"mapped",[1311]],[[1311,1311],"valid"],[[1312,1312],"mapped",[1313]],[[1313,1313],"valid"],[[1314,1314],"mapped",[1315]],[[1315,1315],"valid"],[[1316,1316],"mapped",[1317]],[[1317,1317],"valid"],[[1318,1318],"mapped",[1319]],[[1319,1319],"valid"],[[1320,1320],"mapped",[1321]],[[1321,1321],"valid"],[[1322,1322],"mapped",[1323]],[[1323,1323],"valid"],[[1324,1324],"mapped",[1325]],[[1325,1325],"valid"],[[1326,1326],"mapped",[1327]],[[1327,1327],"valid"],[[1328,1328],"disallowed"],[[1329,1329],"mapped",[1377]],[[1330,1330],"mapped",[1378]],[[1331,1331],"mapped",[1379]],[[1332,1332],"mapped",[1380]],[[1333,1333],"mapped",[1381]],[[1334,1334],"mapped",[1382]],[[1335,1335],"mapped",[1383]],[[1336,1336],"mapped",[1384]],[[1337,1337],"mapped",[1385]],[[1338,1338],"mapped",[1386]],[[1339,1339],"mapped",[1387]],[[1340,1340],"mapped",[1388]],[[1341,1341],"mapped",[1389]],[[1342,1342],"mapped",[1390]],[[1343,1343],"mapped",[1391]],[[1344,1344],"mapped",[1392]],[[1345,1345],"mapped",[1393]],[[1346,1346],"mapped",[1394]],[[1347,1347],"mapped",[1395]],[[1348,1348],"mapped",[1396]],[[1349,1349],"mapped",[1397]],[[1350,1350],"mapped",[1398]],[[1351,1351],"mapped",[1399]],[[1352,1352],"mapped",[1400]],[[1353,1353],"mapped",[1401]],[[1354,1354],"mapped",[1402]],[[1355,1355],"mapped",[1403]],[[1356,1356],"mapped",[1404]],[[1357,1357],"mapped",[1405]],[[1358,1358],"mapped",[1406]],[[1359,1359],"mapped",[1407]],[[1360,1360],"mapped",[1408]],[[1361,1361],"mapped",[1409]],[[1362,1362],"mapped",[1410]],[[1363,1363],"mapped",[1411]],[[1364,1364],"mapped",[1412]],[[1365,1365],"mapped",[1413]],[[1366,1366],"mapped",[1414]],[[1367,1368],"disallowed"],[[1369,1369],"valid"],[[1370,1375],"valid",[],"NV8"],[[1376,1376],"disallowed"],[[1377,1414],"valid"],[[1415,1415],"mapped",[1381,1410]],[[1416,1416],"disallowed"],[[1417,1417],"valid",[],"NV8"],[[1418,1418],"valid",[],"NV8"],[[1419,1420],"disallowed"],[[1421,1422],"valid",[],"NV8"],[[1423,1423],"valid",[],"NV8"],[[1424,1424],"disallowed"],[[1425,1441],"valid"],[[1442,1442],"valid"],[[1443,1455],"valid"],[[1456,1465],"valid"],[[1466,1466],"valid"],[[1467,1469],"valid"],[[1470,1470],"valid",[],"NV8"],[[1471,1471],"valid"],[[1472,1472],"valid",[],"NV8"],[[1473,1474],"valid"],[[1475,1475],"valid",[],"NV8"],[[1476,1476],"valid"],[[1477,1477],"valid"],[[1478,1478],"valid",[],"NV8"],[[1479,1479],"valid"],[[1480,1487],"disallowed"],[[1488,1514],"valid"],[[1515,1519],"disallowed"],[[1520,1524],"valid"],[[1525,1535],"disallowed"],[[1536,1539],"disallowed"],[[1540,1540],"disallowed"],[[1541,1541],"disallowed"],[[1542,1546],"valid",[],"NV8"],[[1547,1547],"valid",[],"NV8"],[[1548,1548],"valid",[],"NV8"],[[1549,1551],"valid",[],"NV8"],[[1552,1557],"valid"],[[1558,1562],"valid"],[[1563,1563],"valid",[],"NV8"],[[1564,1564],"disallowed"],[[1565,1565],"disallowed"],[[1566,1566],"valid",[],"NV8"],[[1567,1567],"valid",[],"NV8"],[[1568,1568],"valid"],[[1569,1594],"valid"],[[1595,1599],"valid"],[[1600,1600],"valid",[],"NV8"],[[1601,1618],"valid"],[[1619,1621],"valid"],[[1622,1624],"valid"],[[1625,1630],"valid"],[[1631,1631],"valid"],[[1632,1641],"valid"],[[1642,1645],"valid",[],"NV8"],[[1646,1647],"valid"],[[1648,1652],"valid"],[[1653,1653],"mapped",[1575,1652]],[[1654,1654],"mapped",[1608,1652]],[[1655,1655],"mapped",[1735,1652]],[[1656,1656],"mapped",[1610,1652]],[[1657,1719],"valid"],[[1720,1721],"valid"],[[1722,1726],"valid"],[[1727,1727],"valid"],[[1728,1742],"valid"],[[1743,1743],"valid"],[[1744,1747],"valid"],[[1748,1748],"valid",[],"NV8"],[[1749,1756],"valid"],[[1757,1757],"disallowed"],[[1758,1758],"valid",[],"NV8"],[[1759,1768],"valid"],[[1769,1769],"valid",[],"NV8"],[[1770,1773],"valid"],[[1774,1775],"valid"],[[1776,1785],"valid"],[[1786,1790],"valid"],[[1791,1791],"valid"],[[1792,1805],"valid",[],"NV8"],[[1806,1806],"disallowed"],[[1807,1807],"disallowed"],[[1808,1836],"valid"],[[1837,1839],"valid"],[[1840,1866],"valid"],[[1867,1868],"disallowed"],[[1869,1871],"valid"],[[1872,1901],"valid"],[[1902,1919],"valid"],[[1920,1968],"valid"],[[1969,1969],"valid"],[[1970,1983],"disallowed"],[[1984,2037],"valid"],[[2038,2042],"valid",[],"NV8"],[[2043,2047],"disallowed"],[[2048,2093],"valid"],[[2094,2095],"disallowed"],[[2096,2110],"valid",[],"NV8"],[[2111,2111],"disallowed"],[[2112,2139],"valid"],[[2140,2141],"disallowed"],[[2142,2142],"valid",[],"NV8"],[[2143,2207],"disallowed"],[[2208,2208],"valid"],[[2209,2209],"valid"],[[2210,2220],"valid"],[[2221,2226],"valid"],[[2227,2228],"valid"],[[2229,2274],"disallowed"],[[2275,2275],"valid"],[[2276,2302],"valid"],[[2303,2303],"valid"],[[2304,2304],"valid"],[[2305,2307],"valid"],[[2308,2308],"valid"],[[2309,2361],"valid"],[[2362,2363],"valid"],[[2364,2381],"valid"],[[2382,2382],"valid"],[[2383,2383],"valid"],[[2384,2388],"valid"],[[2389,2389],"valid"],[[2390,2391],"valid"],[[2392,2392],"mapped",[2325,2364]],[[2393,2393],"mapped",[2326,2364]],[[2394,2394],"mapped",[2327,2364]],[[2395,2395],"mapped",[2332,2364]],[[2396,2396],"mapped",[2337,2364]],[[2397,2397],"mapped",[2338,2364]],[[2398,2398],"mapped",[2347,2364]],[[2399,2399],"mapped",[2351,2364]],[[2400,2403],"valid"],[[2404,2405],"valid",[],"NV8"],[[2406,2415],"valid"],[[2416,2416],"valid",[],"NV8"],[[2417,2418],"valid"],[[2419,2423],"valid"],[[2424,2424],"valid"],[[2425,2426],"valid"],[[2427,2428],"valid"],[[2429,2429],"valid"],[[2430,2431],"valid"],[[2432,2432],"valid"],[[2433,2435],"valid"],[[2436,2436],"disallowed"],[[2437,2444],"valid"],[[2445,2446],"disallowed"],[[2447,2448],"valid"],[[2449,2450],"disallowed"],[[2451,2472],"valid"],[[2473,2473],"disallowed"],[[2474,2480],"valid"],[[2481,2481],"disallowed"],[[2482,2482],"valid"],[[2483,2485],"disallowed"],[[2486,2489],"valid"],[[2490,2491],"disallowed"],[[2492,2492],"valid"],[[2493,2493],"valid"],[[2494,2500],"valid"],[[2501,2502],"disallowed"],[[2503,2504],"valid"],[[2505,2506],"disallowed"],[[2507,2509],"valid"],[[2510,2510],"valid"],[[2511,2518],"disallowed"],[[2519,2519],"valid"],[[2520,2523],"disallowed"],[[2524,2524],"mapped",[2465,2492]],[[2525,2525],"mapped",[2466,2492]],[[2526,2526],"disallowed"],[[2527,2527],"mapped",[2479,2492]],[[2528,2531],"valid"],[[2532,2533],"disallowed"],[[2534,2545],"valid"],[[2546,2554],"valid",[],"NV8"],[[2555,2555],"valid",[],"NV8"],[[2556,2560],"disallowed"],[[2561,2561],"valid"],[[2562,2562],"valid"],[[2563,2563],"valid"],[[2564,2564],"disallowed"],[[2565,2570],"valid"],[[2571,2574],"disallowed"],[[2575,2576],"valid"],[[2577,2578],"disallowed"],[[2579,2600],"valid"],[[2601,2601],"disallowed"],[[2602,2608],"valid"],[[2609,2609],"disallowed"],[[2610,2610],"valid"],[[2611,2611],"mapped",[2610,2620]],[[2612,2612],"disallowed"],[[2613,2613],"valid"],[[2614,2614],"mapped",[2616,2620]],[[2615,2615],"disallowed"],[[2616,2617],"valid"],[[2618,2619],"disallowed"],[[2620,2620],"valid"],[[2621,2621],"disallowed"],[[2622,2626],"valid"],[[2627,2630],"disallowed"],[[2631,2632],"valid"],[[2633,2634],"disallowed"],[[2635,2637],"valid"],[[2638,2640],"disallowed"],[[2641,2641],"valid"],[[2642,2648],"disallowed"],[[2649,2649],"mapped",[2582,2620]],[[2650,2650],"mapped",[2583,2620]],[[2651,2651],"mapped",[2588,2620]],[[2652,2652],"valid"],[[2653,2653],"disallowed"],[[2654,2654],"mapped",[2603,2620]],[[2655,2661],"disallowed"],[[2662,2676],"valid"],[[2677,2677],"valid"],[[2678,2688],"disallowed"],[[2689,2691],"valid"],[[2692,2692],"disallowed"],[[2693,2699],"valid"],[[2700,2700],"valid"],[[2701,2701],"valid"],[[2702,2702],"disallowed"],[[2703,2705],"valid"],[[2706,2706],"disallowed"],[[2707,2728],"valid"],[[2729,2729],"disallowed"],[[2730,2736],"valid"],[[2737,2737],"disallowed"],[[2738,2739],"valid"],[[2740,2740],"disallowed"],[[2741,2745],"valid"],[[2746,2747],"disallowed"],[[2748,2757],"valid"],[[2758,2758],"disallowed"],[[2759,2761],"valid"],[[2762,2762],"disallowed"],[[2763,2765],"valid"],[[2766,2767],"disallowed"],[[2768,2768],"valid"],[[2769,2783],"disallowed"],[[2784,2784],"valid"],[[2785,2787],"valid"],[[2788,2789],"disallowed"],[[2790,2799],"valid"],[[2800,2800],"valid",[],"NV8"],[[2801,2801],"valid",[],"NV8"],[[2802,2808],"disallowed"],[[2809,2809],"valid"],[[2810,2816],"disallowed"],[[2817,2819],"valid"],[[2820,2820],"disallowed"],[[2821,2828],"valid"],[[2829,2830],"disallowed"],[[2831,2832],"valid"],[[2833,2834],"disallowed"],[[2835,2856],"valid"],[[2857,2857],"disallowed"],[[2858,2864],"valid"],[[2865,2865],"disallowed"],[[2866,2867],"valid"],[[2868,2868],"disallowed"],[[2869,2869],"valid"],[[2870,2873],"valid"],[[2874,2875],"disallowed"],[[2876,2883],"valid"],[[2884,2884],"valid"],[[2885,2886],"disallowed"],[[2887,2888],"valid"],[[2889,2890],"disallowed"],[[2891,2893],"valid"],[[2894,2901],"disallowed"],[[2902,2903],"valid"],[[2904,2907],"disallowed"],[[2908,2908],"mapped",[2849,2876]],[[2909,2909],"mapped",[2850,2876]],[[2910,2910],"disallowed"],[[2911,2913],"valid"],[[2914,2915],"valid"],[[2916,2917],"disallowed"],[[2918,2927],"valid"],[[2928,2928],"valid",[],"NV8"],[[2929,2929],"valid"],[[2930,2935],"valid",[],"NV8"],[[2936,2945],"disallowed"],[[2946,2947],"valid"],[[2948,2948],"disallowed"],[[2949,2954],"valid"],[[2955,2957],"disallowed"],[[2958,2960],"valid"],[[2961,2961],"disallowed"],[[2962,2965],"valid"],[[2966,2968],"disallowed"],[[2969,2970],"valid"],[[2971,2971],"disallowed"],[[2972,2972],"valid"],[[2973,2973],"disallowed"],[[2974,2975],"valid"],[[2976,2978],"disallowed"],[[2979,2980],"valid"],[[2981,2983],"disallowed"],[[2984,2986],"valid"],[[2987,2989],"disallowed"],[[2990,2997],"valid"],[[2998,2998],"valid"],[[2999,3001],"valid"],[[3002,3005],"disallowed"],[[3006,3010],"valid"],[[3011,3013],"disallowed"],[[3014,3016],"valid"],[[3017,3017],"disallowed"],[[3018,3021],"valid"],[[3022,3023],"disallowed"],[[3024,3024],"valid"],[[3025,3030],"disallowed"],[[3031,3031],"valid"],[[3032,3045],"disallowed"],[[3046,3046],"valid"],[[3047,3055],"valid"],[[3056,3058],"valid",[],"NV8"],[[3059,3066],"valid",[],"NV8"],[[3067,3071],"disallowed"],[[3072,3072],"valid"],[[3073,3075],"valid"],[[3076,3076],"disallowed"],[[3077,3084],"valid"],[[3085,3085],"disallowed"],[[3086,3088],"valid"],[[3089,3089],"disallowed"],[[3090,3112],"valid"],[[3113,3113],"disallowed"],[[3114,3123],"valid"],[[3124,3124],"valid"],[[3125,3129],"valid"],[[3130,3132],"disallowed"],[[3133,3133],"valid"],[[3134,3140],"valid"],[[3141,3141],"disallowed"],[[3142,3144],"valid"],[[3145,3145],"disallowed"],[[3146,3149],"valid"],[[3150,3156],"disallowed"],[[3157,3158],"valid"],[[3159,3159],"disallowed"],[[3160,3161],"valid"],[[3162,3162],"valid"],[[3163,3167],"disallowed"],[[3168,3169],"valid"],[[3170,3171],"valid"],[[3172,3173],"disallowed"],[[3174,3183],"valid"],[[3184,3191],"disallowed"],[[3192,3199],"valid",[],"NV8"],[[3200,3200],"disallowed"],[[3201,3201],"valid"],[[3202,3203],"valid"],[[3204,3204],"disallowed"],[[3205,3212],"valid"],[[3213,3213],"disallowed"],[[3214,3216],"valid"],[[3217,3217],"disallowed"],[[3218,3240],"valid"],[[3241,3241],"disallowed"],[[3242,3251],"valid"],[[3252,3252],"disallowed"],[[3253,3257],"valid"],[[3258,3259],"disallowed"],[[3260,3261],"valid"],[[3262,3268],"valid"],[[3269,3269],"disallowed"],[[3270,3272],"valid"],[[3273,3273],"disallowed"],[[3274,3277],"valid"],[[3278,3284],"disallowed"],[[3285,3286],"valid"],[[3287,3293],"disallowed"],[[3294,3294],"valid"],[[3295,3295],"disallowed"],[[3296,3297],"valid"],[[3298,3299],"valid"],[[3300,3301],"disallowed"],[[3302,3311],"valid"],[[3312,3312],"disallowed"],[[3313,3314],"valid"],[[3315,3328],"disallowed"],[[3329,3329],"valid"],[[3330,3331],"valid"],[[3332,3332],"disallowed"],[[3333,3340],"valid"],[[3341,3341],"disallowed"],[[3342,3344],"valid"],[[3345,3345],"disallowed"],[[3346,3368],"valid"],[[3369,3369],"valid"],[[3370,3385],"valid"],[[3386,3386],"valid"],[[3387,3388],"disallowed"],[[3389,3389],"valid"],[[3390,3395],"valid"],[[3396,3396],"valid"],[[3397,3397],"disallowed"],[[3398,3400],"valid"],[[3401,3401],"disallowed"],[[3402,3405],"valid"],[[3406,3406],"valid"],[[3407,3414],"disallowed"],[[3415,3415],"valid"],[[3416,3422],"disallowed"],[[3423,3423],"valid"],[[3424,3425],"valid"],[[3426,3427],"valid"],[[3428,3429],"disallowed"],[[3430,3439],"valid"],[[3440,3445],"valid",[],"NV8"],[[3446,3448],"disallowed"],[[3449,3449],"valid",[],"NV8"],[[3450,3455],"valid"],[[3456,3457],"disallowed"],[[3458,3459],"valid"],[[3460,3460],"disallowed"],[[3461,3478],"valid"],[[3479,3481],"disallowed"],[[3482,3505],"valid"],[[3506,3506],"disallowed"],[[3507,3515],"valid"],[[3516,3516],"disallowed"],[[3517,3517],"valid"],[[3518,3519],"disallowed"],[[3520,3526],"valid"],[[3527,3529],"disallowed"],[[3530,3530],"valid"],[[3531,3534],"disallowed"],[[3535,3540],"valid"],[[3541,3541],"disallowed"],[[3542,3542],"valid"],[[3543,3543],"disallowed"],[[3544,3551],"valid"],[[3552,3557],"disallowed"],[[3558,3567],"valid"],[[3568,3569],"disallowed"],[[3570,3571],"valid"],[[3572,3572],"valid",[],"NV8"],[[3573,3584],"disallowed"],[[3585,3634],"valid"],[[3635,3635],"mapped",[3661,3634]],[[3636,3642],"valid"],[[3643,3646],"disallowed"],[[3647,3647],"valid",[],"NV8"],[[3648,3662],"valid"],[[3663,3663],"valid",[],"NV8"],[[3664,3673],"valid"],[[3674,3675],"valid",[],"NV8"],[[3676,3712],"disallowed"],[[3713,3714],"valid"],[[3715,3715],"disallowed"],[[3716,3716],"valid"],[[3717,3718],"disallowed"],[[3719,3720],"valid"],[[3721,3721],"disallowed"],[[3722,3722],"valid"],[[3723,3724],"disallowed"],[[3725,3725],"valid"],[[3726,3731],"disallowed"],[[3732,3735],"valid"],[[3736,3736],"disallowed"],[[3737,3743],"valid"],[[3744,3744],"disallowed"],[[3745,3747],"valid"],[[3748,3748],"disallowed"],[[3749,3749],"valid"],[[3750,3750],"disallowed"],[[3751,3751],"valid"],[[3752,3753],"disallowed"],[[3754,3755],"valid"],[[3756,3756],"disallowed"],[[3757,3762],"valid"],[[3763,3763],"mapped",[3789,3762]],[[3764,3769],"valid"],[[3770,3770],"disallowed"],[[3771,3773],"valid"],[[3774,3775],"disallowed"],[[3776,3780],"valid"],[[3781,3781],"disallowed"],[[3782,3782],"valid"],[[3783,3783],"disallowed"],[[3784,3789],"valid"],[[3790,3791],"disallowed"],[[3792,3801],"valid"],[[3802,3803],"disallowed"],[[3804,3804],"mapped",[3755,3737]],[[3805,3805],"mapped",[3755,3745]],[[3806,3807],"valid"],[[3808,3839],"disallowed"],[[3840,3840],"valid"],[[3841,3850],"valid",[],"NV8"],[[3851,3851],"valid"],[[3852,3852],"mapped",[3851]],[[3853,3863],"valid",[],"NV8"],[[3864,3865],"valid"],[[3866,3871],"valid",[],"NV8"],[[3872,3881],"valid"],[[3882,3892],"valid",[],"NV8"],[[3893,3893],"valid"],[[3894,3894],"valid",[],"NV8"],[[3895,3895],"valid"],[[3896,3896],"valid",[],"NV8"],[[3897,3897],"valid"],[[3898,3901],"valid",[],"NV8"],[[3902,3906],"valid"],[[3907,3907],"mapped",[3906,4023]],[[3908,3911],"valid"],[[3912,3912],"disallowed"],[[3913,3916],"valid"],[[3917,3917],"mapped",[3916,4023]],[[3918,3921],"valid"],[[3922,3922],"mapped",[3921,4023]],[[3923,3926],"valid"],[[3927,3927],"mapped",[3926,4023]],[[3928,3931],"valid"],[[3932,3932],"mapped",[3931,4023]],[[3933,3944],"valid"],[[3945,3945],"mapped",[3904,4021]],[[3946,3946],"valid"],[[3947,3948],"valid"],[[3949,3952],"disallowed"],[[3953,3954],"valid"],[[3955,3955],"mapped",[3953,3954]],[[3956,3956],"valid"],[[3957,3957],"mapped",[3953,3956]],[[3958,3958],"mapped",[4018,3968]],[[3959,3959],"mapped",[4018,3953,3968]],[[3960,3960],"mapped",[4019,3968]],[[3961,3961],"mapped",[4019,3953,3968]],[[3962,3968],"valid"],[[3969,3969],"mapped",[3953,3968]],[[3970,3972],"valid"],[[3973,3973],"valid",[],"NV8"],[[3974,3979],"valid"],[[3980,3983],"valid"],[[3984,3986],"valid"],[[3987,3987],"mapped",[3986,4023]],[[3988,3989],"valid"],[[3990,3990],"valid"],[[3991,3991],"valid"],[[3992,3992],"disallowed"],[[3993,3996],"valid"],[[3997,3997],"mapped",[3996,4023]],[[3998,4001],"valid"],[[4002,4002],"mapped",[4001,4023]],[[4003,4006],"valid"],[[4007,4007],"mapped",[4006,4023]],[[4008,4011],"valid"],[[4012,4012],"mapped",[4011,4023]],[[4013,4013],"valid"],[[4014,4016],"valid"],[[4017,4023],"valid"],[[4024,4024],"valid"],[[4025,4025],"mapped",[3984,4021]],[[4026,4028],"valid"],[[4029,4029],"disallowed"],[[4030,4037],"valid",[],"NV8"],[[4038,4038],"valid"],[[4039,4044],"valid",[],"NV8"],[[4045,4045],"disallowed"],[[4046,4046],"valid",[],"NV8"],[[4047,4047],"valid",[],"NV8"],[[4048,4049],"valid",[],"NV8"],[[4050,4052],"valid",[],"NV8"],[[4053,4056],"valid",[],"NV8"],[[4057,4058],"valid",[],"NV8"],[[4059,4095],"disallowed"],[[4096,4129],"valid"],[[4130,4130],"valid"],[[4131,4135],"valid"],[[4136,4136],"valid"],[[4137,4138],"valid"],[[4139,4139],"valid"],[[4140,4146],"valid"],[[4147,4149],"valid"],[[4150,4153],"valid"],[[4154,4159],"valid"],[[4160,4169],"valid"],[[4170,4175],"valid",[],"NV8"],[[4176,4185],"valid"],[[4186,4249],"valid"],[[4250,4253],"valid"],[[4254,4255],"valid",[],"NV8"],[[4256,4293],"disallowed"],[[4294,4294],"disallowed"],[[4295,4295],"mapped",[11559]],[[4296,4300],"disallowed"],[[4301,4301],"mapped",[11565]],[[4302,4303],"disallowed"],[[4304,4342],"valid"],[[4343,4344],"valid"],[[4345,4346],"valid"],[[4347,4347],"valid",[],"NV8"],[[4348,4348],"mapped",[4316]],[[4349,4351],"valid"],[[4352,4441],"valid",[],"NV8"],[[4442,4446],"valid",[],"NV8"],[[4447,4448],"disallowed"],[[4449,4514],"valid",[],"NV8"],[[4515,4519],"valid",[],"NV8"],[[4520,4601],"valid",[],"NV8"],[[4602,4607],"valid",[],"NV8"],[[4608,4614],"valid"],[[4615,4615],"valid"],[[4616,4678],"valid"],[[4679,4679],"valid"],[[4680,4680],"valid"],[[4681,4681],"disallowed"],[[4682,4685],"valid"],[[4686,4687],"disallowed"],[[4688,4694],"valid"],[[4695,4695],"disallowed"],[[4696,4696],"valid"],[[4697,4697],"disallowed"],[[4698,4701],"valid"],[[4702,4703],"disallowed"],[[4704,4742],"valid"],[[4743,4743],"valid"],[[4744,4744],"valid"],[[4745,4745],"disallowed"],[[4746,4749],"valid"],[[4750,4751],"disallowed"],[[4752,4782],"valid"],[[4783,4783],"valid"],[[4784,4784],"valid"],[[4785,4785],"disallowed"],[[4786,4789],"valid"],[[4790,4791],"disallowed"],[[4792,4798],"valid"],[[4799,4799],"disallowed"],[[4800,4800],"valid"],[[4801,4801],"disallowed"],[[4802,4805],"valid"],[[4806,4807],"disallowed"],[[4808,4814],"valid"],[[4815,4815],"valid"],[[4816,4822],"valid"],[[4823,4823],"disallowed"],[[4824,4846],"valid"],[[4847,4847],"valid"],[[4848,4878],"valid"],[[4879,4879],"valid"],[[4880,4880],"valid"],[[4881,4881],"disallowed"],[[4882,4885],"valid"],[[4886,4887],"disallowed"],[[4888,4894],"valid"],[[4895,4895],"valid"],[[4896,4934],"valid"],[[4935,4935],"valid"],[[4936,4954],"valid"],[[4955,4956],"disallowed"],[[4957,4958],"valid"],[[4959,4959],"valid"],[[4960,4960],"valid",[],"NV8"],[[4961,4988],"valid",[],"NV8"],[[4989,4991],"disallowed"],[[4992,5007],"valid"],[[5008,5017],"valid",[],"NV8"],[[5018,5023],"disallowed"],[[5024,5108],"valid"],[[5109,5109],"valid"],[[5110,5111],"disallowed"],[[5112,5112],"mapped",[5104]],[[5113,5113],"mapped",[5105]],[[5114,5114],"mapped",[5106]],[[5115,5115],"mapped",[5107]],[[5116,5116],"mapped",[5108]],[[5117,5117],"mapped",[5109]],[[5118,5119],"disallowed"],[[5120,5120],"valid",[],"NV8"],[[5121,5740],"valid"],[[5741,5742],"valid",[],"NV8"],[[5743,5750],"valid"],[[5751,5759],"valid"],[[5760,5760],"disallowed"],[[5761,5786],"valid"],[[5787,5788],"valid",[],"NV8"],[[5789,5791],"disallowed"],[[5792,5866],"valid"],[[5867,5872],"valid",[],"NV8"],[[5873,5880],"valid"],[[5881,5887],"disallowed"],[[5888,5900],"valid"],[[5901,5901],"disallowed"],[[5902,5908],"valid"],[[5909,5919],"disallowed"],[[5920,5940],"valid"],[[5941,5942],"valid",[],"NV8"],[[5943,5951],"disallowed"],[[5952,5971],"valid"],[[5972,5983],"disallowed"],[[5984,5996],"valid"],[[5997,5997],"disallowed"],[[5998,6e3],"valid"],[[6001,6001],"disallowed"],[[6002,6003],"valid"],[[6004,6015],"disallowed"],[[6016,6067],"valid"],[[6068,6069],"disallowed"],[[6070,6099],"valid"],[[6100,6102],"valid",[],"NV8"],[[6103,6103],"valid"],[[6104,6107],"valid",[],"NV8"],[[6108,6108],"valid"],[[6109,6109],"valid"],[[6110,6111],"disallowed"],[[6112,6121],"valid"],[[6122,6127],"disallowed"],[[6128,6137],"valid",[],"NV8"],[[6138,6143],"disallowed"],[[6144,6149],"valid",[],"NV8"],[[6150,6150],"disallowed"],[[6151,6154],"valid",[],"NV8"],[[6155,6157],"ignored"],[[6158,6158],"disallowed"],[[6159,6159],"disallowed"],[[6160,6169],"valid"],[[6170,6175],"disallowed"],[[6176,6263],"valid"],[[6264,6271],"disallowed"],[[6272,6313],"valid"],[[6314,6314],"valid"],[[6315,6319],"disallowed"],[[6320,6389],"valid"],[[6390,6399],"disallowed"],[[6400,6428],"valid"],[[6429,6430],"valid"],[[6431,6431],"disallowed"],[[6432,6443],"valid"],[[6444,6447],"disallowed"],[[6448,6459],"valid"],[[6460,6463],"disallowed"],[[6464,6464],"valid",[],"NV8"],[[6465,6467],"disallowed"],[[6468,6469],"valid",[],"NV8"],[[6470,6509],"valid"],[[6510,6511],"disallowed"],[[6512,6516],"valid"],[[6517,6527],"disallowed"],[[6528,6569],"valid"],[[6570,6571],"valid"],[[6572,6575],"disallowed"],[[6576,6601],"valid"],[[6602,6607],"disallowed"],[[6608,6617],"valid"],[[6618,6618],"valid",[],"XV8"],[[6619,6621],"disallowed"],[[6622,6623],"valid",[],"NV8"],[[6624,6655],"valid",[],"NV8"],[[6656,6683],"valid"],[[6684,6685],"disallowed"],[[6686,6687],"valid",[],"NV8"],[[6688,6750],"valid"],[[6751,6751],"disallowed"],[[6752,6780],"valid"],[[6781,6782],"disallowed"],[[6783,6793],"valid"],[[6794,6799],"disallowed"],[[6800,6809],"valid"],[[6810,6815],"disallowed"],[[6816,6822],"valid",[],"NV8"],[[6823,6823],"valid"],[[6824,6829],"valid",[],"NV8"],[[6830,6831],"disallowed"],[[6832,6845],"valid"],[[6846,6846],"valid",[],"NV8"],[[6847,6911],"disallowed"],[[6912,6987],"valid"],[[6988,6991],"disallowed"],[[6992,7001],"valid"],[[7002,7018],"valid",[],"NV8"],[[7019,7027],"valid"],[[7028,7036],"valid",[],"NV8"],[[7037,7039],"disallowed"],[[7040,7082],"valid"],[[7083,7085],"valid"],[[7086,7097],"valid"],[[7098,7103],"valid"],[[7104,7155],"valid"],[[7156,7163],"disallowed"],[[7164,7167],"valid",[],"NV8"],[[7168,7223],"valid"],[[7224,7226],"disallowed"],[[7227,7231],"valid",[],"NV8"],[[7232,7241],"valid"],[[7242,7244],"disallowed"],[[7245,7293],"valid"],[[7294,7295],"valid",[],"NV8"],[[7296,7359],"disallowed"],[[7360,7367],"valid",[],"NV8"],[[7368,7375],"disallowed"],[[7376,7378],"valid"],[[7379,7379],"valid",[],"NV8"],[[7380,7410],"valid"],[[7411,7414],"valid"],[[7415,7415],"disallowed"],[[7416,7417],"valid"],[[7418,7423],"disallowed"],[[7424,7467],"valid"],[[7468,7468],"mapped",[97]],[[7469,7469],"mapped",[230]],[[7470,7470],"mapped",[98]],[[7471,7471],"valid"],[[7472,7472],"mapped",[100]],[[7473,7473],"mapped",[101]],[[7474,7474],"mapped",[477]],[[7475,7475],"mapped",[103]],[[7476,7476],"mapped",[104]],[[7477,7477],"mapped",[105]],[[7478,7478],"mapped",[106]],[[7479,7479],"mapped",[107]],[[7480,7480],"mapped",[108]],[[7481,7481],"mapped",[109]],[[7482,7482],"mapped",[110]],[[7483,7483],"valid"],[[7484,7484],"mapped",[111]],[[7485,7485],"mapped",[547]],[[7486,7486],"mapped",[112]],[[7487,7487],"mapped",[114]],[[7488,7488],"mapped",[116]],[[7489,7489],"mapped",[117]],[[7490,7490],"mapped",[119]],[[7491,7491],"mapped",[97]],[[7492,7492],"mapped",[592]],[[7493,7493],"mapped",[593]],[[7494,7494],"mapped",[7426]],[[7495,7495],"mapped",[98]],[[7496,7496],"mapped",[100]],[[7497,7497],"mapped",[101]],[[7498,7498],"mapped",[601]],[[7499,7499],"mapped",[603]],[[7500,7500],"mapped",[604]],[[7501,7501],"mapped",[103]],[[7502,7502],"valid"],[[7503,7503],"mapped",[107]],[[7504,7504],"mapped",[109]],[[7505,7505],"mapped",[331]],[[7506,7506],"mapped",[111]],[[7507,7507],"mapped",[596]],[[7508,7508],"mapped",[7446]],[[7509,7509],"mapped",[7447]],[[7510,7510],"mapped",[112]],[[7511,7511],"mapped",[116]],[[7512,7512],"mapped",[117]],[[7513,7513],"mapped",[7453]],[[7514,7514],"mapped",[623]],[[7515,7515],"mapped",[118]],[[7516,7516],"mapped",[7461]],[[7517,7517],"mapped",[946]],[[7518,7518],"mapped",[947]],[[7519,7519],"mapped",[948]],[[7520,7520],"mapped",[966]],[[7521,7521],"mapped",[967]],[[7522,7522],"mapped",[105]],[[7523,7523],"mapped",[114]],[[7524,7524],"mapped",[117]],[[7525,7525],"mapped",[118]],[[7526,7526],"mapped",[946]],[[7527,7527],"mapped",[947]],[[7528,7528],"mapped",[961]],[[7529,7529],"mapped",[966]],[[7530,7530],"mapped",[967]],[[7531,7531],"valid"],[[7532,7543],"valid"],[[7544,7544],"mapped",[1085]],[[7545,7578],"valid"],[[7579,7579],"mapped",[594]],[[7580,7580],"mapped",[99]],[[7581,7581],"mapped",[597]],[[7582,7582],"mapped",[240]],[[7583,7583],"mapped",[604]],[[7584,7584],"mapped",[102]],[[7585,7585],"mapped",[607]],[[7586,7586],"mapped",[609]],[[7587,7587],"mapped",[613]],[[7588,7588],"mapped",[616]],[[7589,7589],"mapped",[617]],[[7590,7590],"mapped",[618]],[[7591,7591],"mapped",[7547]],[[7592,7592],"mapped",[669]],[[7593,7593],"mapped",[621]],[[7594,7594],"mapped",[7557]],[[7595,7595],"mapped",[671]],[[7596,7596],"mapped",[625]],[[7597,7597],"mapped",[624]],[[7598,7598],"mapped",[626]],[[7599,7599],"mapped",[627]],[[7600,7600],"mapped",[628]],[[7601,7601],"mapped",[629]],[[7602,7602],"mapped",[632]],[[7603,7603],"mapped",[642]],[[7604,7604],"mapped",[643]],[[7605,7605],"mapped",[427]],[[7606,7606],"mapped",[649]],[[7607,7607],"mapped",[650]],[[7608,7608],"mapped",[7452]],[[7609,7609],"mapped",[651]],[[7610,7610],"mapped",[652]],[[7611,7611],"mapped",[122]],[[7612,7612],"mapped",[656]],[[7613,7613],"mapped",[657]],[[7614,7614],"mapped",[658]],[[7615,7615],"mapped",[952]],[[7616,7619],"valid"],[[7620,7626],"valid"],[[7627,7654],"valid"],[[7655,7669],"valid"],[[7670,7675],"disallowed"],[[7676,7676],"valid"],[[7677,7677],"valid"],[[7678,7679],"valid"],[[7680,7680],"mapped",[7681]],[[7681,7681],"valid"],[[7682,7682],"mapped",[7683]],[[7683,7683],"valid"],[[7684,7684],"mapped",[7685]],[[7685,7685],"valid"],[[7686,7686],"mapped",[7687]],[[7687,7687],"valid"],[[7688,7688],"mapped",[7689]],[[7689,7689],"valid"],[[7690,7690],"mapped",[7691]],[[7691,7691],"valid"],[[7692,7692],"mapped",[7693]],[[7693,7693],"valid"],[[7694,7694],"mapped",[7695]],[[7695,7695],"valid"],[[7696,7696],"mapped",[7697]],[[7697,7697],"valid"],[[7698,7698],"mapped",[7699]],[[7699,7699],"valid"],[[7700,7700],"mapped",[7701]],[[7701,7701],"valid"],[[7702,7702],"mapped",[7703]],[[7703,7703],"valid"],[[7704,7704],"mapped",[7705]],[[7705,7705],"valid"],[[7706,7706],"mapped",[7707]],[[7707,7707],"valid"],[[7708,7708],"mapped",[7709]],[[7709,7709],"valid"],[[7710,7710],"mapped",[7711]],[[7711,7711],"valid"],[[7712,7712],"mapped",[7713]],[[7713,7713],"valid"],[[7714,7714],"mapped",[7715]],[[7715,7715],"valid"],[[7716,7716],"mapped",[7717]],[[7717,7717],"valid"],[[7718,7718],"mapped",[7719]],[[7719,7719],"valid"],[[7720,7720],"mapped",[7721]],[[7721,7721],"valid"],[[7722,7722],"mapped",[7723]],[[7723,7723],"valid"],[[7724,7724],"mapped",[7725]],[[7725,7725],"valid"],[[7726,7726],"mapped",[7727]],[[7727,7727],"valid"],[[7728,7728],"mapped",[7729]],[[7729,7729],"valid"],[[7730,7730],"mapped",[7731]],[[7731,7731],"valid"],[[7732,7732],"mapped",[7733]],[[7733,7733],"valid"],[[7734,7734],"mapped",[7735]],[[7735,7735],"valid"],[[7736,7736],"mapped",[7737]],[[7737,7737],"valid"],[[7738,7738],"mapped",[7739]],[[7739,7739],"valid"],[[7740,7740],"mapped",[7741]],[[7741,7741],"valid"],[[7742,7742],"mapped",[7743]],[[7743,7743],"valid"],[[7744,7744],"mapped",[7745]],[[7745,7745],"valid"],[[7746,7746],"mapped",[7747]],[[7747,7747],"valid"],[[7748,7748],"mapped",[7749]],[[7749,7749],"valid"],[[7750,7750],"mapped",[7751]],[[7751,7751],"valid"],[[7752,7752],"mapped",[7753]],[[7753,7753],"valid"],[[7754,7754],"mapped",[7755]],[[7755,7755],"valid"],[[7756,7756],"mapped",[7757]],[[7757,7757],"valid"],[[7758,7758],"mapped",[7759]],[[7759,7759],"valid"],[[7760,7760],"mapped",[7761]],[[7761,7761],"valid"],[[7762,7762],"mapped",[7763]],[[7763,7763],"valid"],[[7764,7764],"mapped",[7765]],[[7765,7765],"valid"],[[7766,7766],"mapped",[7767]],[[7767,7767],"valid"],[[7768,7768],"mapped",[7769]],[[7769,7769],"valid"],[[7770,7770],"mapped",[7771]],[[7771,7771],"valid"],[[7772,7772],"mapped",[7773]],[[7773,7773],"valid"],[[7774,7774],"mapped",[7775]],[[7775,7775],"valid"],[[7776,7776],"mapped",[7777]],[[7777,7777],"valid"],[[7778,7778],"mapped",[7779]],[[7779,7779],"valid"],[[7780,7780],"mapped",[7781]],[[7781,7781],"valid"],[[7782,7782],"mapped",[7783]],[[7783,7783],"valid"],[[7784,7784],"mapped",[7785]],[[7785,7785],"valid"],[[7786,7786],"mapped",[7787]],[[7787,7787],"valid"],[[7788,7788],"mapped",[7789]],[[7789,7789],"valid"],[[7790,7790],"mapped",[7791]],[[7791,7791],"valid"],[[7792,7792],"mapped",[7793]],[[7793,7793],"valid"],[[7794,7794],"mapped",[7795]],[[7795,7795],"valid"],[[7796,7796],"mapped",[7797]],[[7797,7797],"valid"],[[7798,7798],"mapped",[7799]],[[7799,7799],"valid"],[[7800,7800],"mapped",[7801]],[[7801,7801],"valid"],[[7802,7802],"mapped",[7803]],[[7803,7803],"valid"],[[7804,7804],"mapped",[7805]],[[7805,7805],"valid"],[[7806,7806],"mapped",[7807]],[[7807,7807],"valid"],[[7808,7808],"mapped",[7809]],[[7809,7809],"valid"],[[7810,7810],"mapped",[7811]],[[7811,7811],"valid"],[[7812,7812],"mapped",[7813]],[[7813,7813],"valid"],[[7814,7814],"mapped",[7815]],[[7815,7815],"valid"],[[7816,7816],"mapped",[7817]],[[7817,7817],"valid"],[[7818,7818],"mapped",[7819]],[[7819,7819],"valid"],[[7820,7820],"mapped",[7821]],[[7821,7821],"valid"],[[7822,7822],"mapped",[7823]],[[7823,7823],"valid"],[[7824,7824],"mapped",[7825]],[[7825,7825],"valid"],[[7826,7826],"mapped",[7827]],[[7827,7827],"valid"],[[7828,7828],"mapped",[7829]],[[7829,7833],"valid"],[[7834,7834],"mapped",[97,702]],[[7835,7835],"mapped",[7777]],[[7836,7837],"valid"],[[7838,7838],"mapped",[115,115]],[[7839,7839],"valid"],[[7840,7840],"mapped",[7841]],[[7841,7841],"valid"],[[7842,7842],"mapped",[7843]],[[7843,7843],"valid"],[[7844,7844],"mapped",[7845]],[[7845,7845],"valid"],[[7846,7846],"mapped",[7847]],[[7847,7847],"valid"],[[7848,7848],"mapped",[7849]],[[7849,7849],"valid"],[[7850,7850],"mapped",[7851]],[[7851,7851],"valid"],[[7852,7852],"mapped",[7853]],[[7853,7853],"valid"],[[7854,7854],"mapped",[7855]],[[7855,7855],"valid"],[[7856,7856],"mapped",[7857]],[[7857,7857],"valid"],[[7858,7858],"mapped",[7859]],[[7859,7859],"valid"],[[7860,7860],"mapped",[7861]],[[7861,7861],"valid"],[[7862,7862],"mapped",[7863]],[[7863,7863],"valid"],[[7864,7864],"mapped",[7865]],[[7865,7865],"valid"],[[7866,7866],"mapped",[7867]],[[7867,7867],"valid"],[[7868,7868],"mapped",[7869]],[[7869,7869],"valid"],[[7870,7870],"mapped",[7871]],[[7871,7871],"valid"],[[7872,7872],"mapped",[7873]],[[7873,7873],"valid"],[[7874,7874],"mapped",[7875]],[[7875,7875],"valid"],[[7876,7876],"mapped",[7877]],[[7877,7877],"valid"],[[7878,7878],"mapped",[7879]],[[7879,7879],"valid"],[[7880,7880],"mapped",[7881]],[[7881,7881],"valid"],[[7882,7882],"mapped",[7883]],[[7883,7883],"valid"],[[7884,7884],"mapped",[7885]],[[7885,7885],"valid"],[[7886,7886],"mapped",[7887]],[[7887,7887],"valid"],[[7888,7888],"mapped",[7889]],[[7889,7889],"valid"],[[7890,7890],"mapped",[7891]],[[7891,7891],"valid"],[[7892,7892],"mapped",[7893]],[[7893,7893],"valid"],[[7894,7894],"mapped",[7895]],[[7895,7895],"valid"],[[7896,7896],"mapped",[7897]],[[7897,7897],"valid"],[[7898,7898],"mapped",[7899]],[[7899,7899],"valid"],[[7900,7900],"mapped",[7901]],[[7901,7901],"valid"],[[7902,7902],"mapped",[7903]],[[7903,7903],"valid"],[[7904,7904],"mapped",[7905]],[[7905,7905],"valid"],[[7906,7906],"mapped",[7907]],[[7907,7907],"valid"],[[7908,7908],"mapped",[7909]],[[7909,7909],"valid"],[[7910,7910],"mapped",[7911]],[[7911,7911],"valid"],[[7912,7912],"mapped",[7913]],[[7913,7913],"valid"],[[7914,7914],"mapped",[7915]],[[7915,7915],"valid"],[[7916,7916],"mapped",[7917]],[[7917,7917],"valid"],[[7918,7918],"mapped",[7919]],[[7919,7919],"valid"],[[7920,7920],"mapped",[7921]],[[7921,7921],"valid"],[[7922,7922],"mapped",[7923]],[[7923,7923],"valid"],[[7924,7924],"mapped",[7925]],[[7925,7925],"valid"],[[7926,7926],"mapped",[7927]],[[7927,7927],"valid"],[[7928,7928],"mapped",[7929]],[[7929,7929],"valid"],[[7930,7930],"mapped",[7931]],[[7931,7931],"valid"],[[7932,7932],"mapped",[7933]],[[7933,7933],"valid"],[[7934,7934],"mapped",[7935]],[[7935,7935],"valid"],[[7936,7943],"valid"],[[7944,7944],"mapped",[7936]],[[7945,7945],"mapped",[7937]],[[7946,7946],"mapped",[7938]],[[7947,7947],"mapped",[7939]],[[7948,7948],"mapped",[7940]],[[7949,7949],"mapped",[7941]],[[7950,7950],"mapped",[7942]],[[7951,7951],"mapped",[7943]],[[7952,7957],"valid"],[[7958,7959],"disallowed"],[[7960,7960],"mapped",[7952]],[[7961,7961],"mapped",[7953]],[[7962,7962],"mapped",[7954]],[[7963,7963],"mapped",[7955]],[[7964,7964],"mapped",[7956]],[[7965,7965],"mapped",[7957]],[[7966,7967],"disallowed"],[[7968,7975],"valid"],[[7976,7976],"mapped",[7968]],[[7977,7977],"mapped",[7969]],[[7978,7978],"mapped",[7970]],[[7979,7979],"mapped",[7971]],[[7980,7980],"mapped",[7972]],[[7981,7981],"mapped",[7973]],[[7982,7982],"mapped",[7974]],[[7983,7983],"mapped",[7975]],[[7984,7991],"valid"],[[7992,7992],"mapped",[7984]],[[7993,7993],"mapped",[7985]],[[7994,7994],"mapped",[7986]],[[7995,7995],"mapped",[7987]],[[7996,7996],"mapped",[7988]],[[7997,7997],"mapped",[7989]],[[7998,7998],"mapped",[7990]],[[7999,7999],"mapped",[7991]],[[8e3,8005],"valid"],[[8006,8007],"disallowed"],[[8008,8008],"mapped",[8e3]],[[8009,8009],"mapped",[8001]],[[8010,8010],"mapped",[8002]],[[8011,8011],"mapped",[8003]],[[8012,8012],"mapped",[8004]],[[8013,8013],"mapped",[8005]],[[8014,8015],"disallowed"],[[8016,8023],"valid"],[[8024,8024],"disallowed"],[[8025,8025],"mapped",[8017]],[[8026,8026],"disallowed"],[[8027,8027],"mapped",[8019]],[[8028,8028],"disallowed"],[[8029,8029],"mapped",[8021]],[[8030,8030],"disallowed"],[[8031,8031],"mapped",[8023]],[[8032,8039],"valid"],[[8040,8040],"mapped",[8032]],[[8041,8041],"mapped",[8033]],[[8042,8042],"mapped",[8034]],[[8043,8043],"mapped",[8035]],[[8044,8044],"mapped",[8036]],[[8045,8045],"mapped",[8037]],[[8046,8046],"mapped",[8038]],[[8047,8047],"mapped",[8039]],[[8048,8048],"valid"],[[8049,8049],"mapped",[940]],[[8050,8050],"valid"],[[8051,8051],"mapped",[941]],[[8052,8052],"valid"],[[8053,8053],"mapped",[942]],[[8054,8054],"valid"],[[8055,8055],"mapped",[943]],[[8056,8056],"valid"],[[8057,8057],"mapped",[972]],[[8058,8058],"valid"],[[8059,8059],"mapped",[973]],[[8060,8060],"valid"],[[8061,8061],"mapped",[974]],[[8062,8063],"disallowed"],[[8064,8064],"mapped",[7936,953]],[[8065,8065],"mapped",[7937,953]],[[8066,8066],"mapped",[7938,953]],[[8067,8067],"mapped",[7939,953]],[[8068,8068],"mapped",[7940,953]],[[8069,8069],"mapped",[7941,953]],[[8070,8070],"mapped",[7942,953]],[[8071,8071],"mapped",[7943,953]],[[8072,8072],"mapped",[7936,953]],[[8073,8073],"mapped",[7937,953]],[[8074,8074],"mapped",[7938,953]],[[8075,8075],"mapped",[7939,953]],[[8076,8076],"mapped",[7940,953]],[[8077,8077],"mapped",[7941,953]],[[8078,8078],"mapped",[7942,953]],[[8079,8079],"mapped",[7943,953]],[[8080,8080],"mapped",[7968,953]],[[8081,8081],"mapped",[7969,953]],[[8082,8082],"mapped",[7970,953]],[[8083,8083],"mapped",[7971,953]],[[8084,8084],"mapped",[7972,953]],[[8085,8085],"mapped",[7973,953]],[[8086,8086],"mapped",[7974,953]],[[8087,8087],"mapped",[7975,953]],[[8088,8088],"mapped",[7968,953]],[[8089,8089],"mapped",[7969,953]],[[8090,8090],"mapped",[7970,953]],[[8091,8091],"mapped",[7971,953]],[[8092,8092],"mapped",[7972,953]],[[8093,8093],"mapped",[7973,953]],[[8094,8094],"mapped",[7974,953]],[[8095,8095],"mapped",[7975,953]],[[8096,8096],"mapped",[8032,953]],[[8097,8097],"mapped",[8033,953]],[[8098,8098],"mapped",[8034,953]],[[8099,8099],"mapped",[8035,953]],[[8100,8100],"mapped",[8036,953]],[[8101,8101],"mapped",[8037,953]],[[8102,8102],"mapped",[8038,953]],[[8103,8103],"mapped",[8039,953]],[[8104,8104],"mapped",[8032,953]],[[8105,8105],"mapped",[8033,953]],[[8106,8106],"mapped",[8034,953]],[[8107,8107],"mapped",[8035,953]],[[8108,8108],"mapped",[8036,953]],[[8109,8109],"mapped",[8037,953]],[[8110,8110],"mapped",[8038,953]],[[8111,8111],"mapped",[8039,953]],[[8112,8113],"valid"],[[8114,8114],"mapped",[8048,953]],[[8115,8115],"mapped",[945,953]],[[8116,8116],"mapped",[940,953]],[[8117,8117],"disallowed"],[[8118,8118],"valid"],[[8119,8119],"mapped",[8118,953]],[[8120,8120],"mapped",[8112]],[[8121,8121],"mapped",[8113]],[[8122,8122],"mapped",[8048]],[[8123,8123],"mapped",[940]],[[8124,8124],"mapped",[945,953]],[[8125,8125],"disallowed_STD3_mapped",[32,787]],[[8126,8126],"mapped",[953]],[[8127,8127],"disallowed_STD3_mapped",[32,787]],[[8128,8128],"disallowed_STD3_mapped",[32,834]],[[8129,8129],"disallowed_STD3_mapped",[32,776,834]],[[8130,8130],"mapped",[8052,953]],[[8131,8131],"mapped",[951,953]],[[8132,8132],"mapped",[942,953]],[[8133,8133],"disallowed"],[[8134,8134],"valid"],[[8135,8135],"mapped",[8134,953]],[[8136,8136],"mapped",[8050]],[[8137,8137],"mapped",[941]],[[8138,8138],"mapped",[8052]],[[8139,8139],"mapped",[942]],[[8140,8140],"mapped",[951,953]],[[8141,8141],"disallowed_STD3_mapped",[32,787,768]],[[8142,8142],"disallowed_STD3_mapped",[32,787,769]],[[8143,8143],"disallowed_STD3_mapped",[32,787,834]],[[8144,8146],"valid"],[[8147,8147],"mapped",[912]],[[8148,8149],"disallowed"],[[8150,8151],"valid"],[[8152,8152],"mapped",[8144]],[[8153,8153],"mapped",[8145]],[[8154,8154],"mapped",[8054]],[[8155,8155],"mapped",[943]],[[8156,8156],"disallowed"],[[8157,8157],"disallowed_STD3_mapped",[32,788,768]],[[8158,8158],"disallowed_STD3_mapped",[32,788,769]],[[8159,8159],"disallowed_STD3_mapped",[32,788,834]],[[8160,8162],"valid"],[[8163,8163],"mapped",[944]],[[8164,8167],"valid"],[[8168,8168],"mapped",[8160]],[[8169,8169],"mapped",[8161]],[[8170,8170],"mapped",[8058]],[[8171,8171],"mapped",[973]],[[8172,8172],"mapped",[8165]],[[8173,8173],"disallowed_STD3_mapped",[32,776,768]],[[8174,8174],"disallowed_STD3_mapped",[32,776,769]],[[8175,8175],"disallowed_STD3_mapped",[96]],[[8176,8177],"disallowed"],[[8178,8178],"mapped",[8060,953]],[[8179,8179],"mapped",[969,953]],[[8180,8180],"mapped",[974,953]],[[8181,8181],"disallowed"],[[8182,8182],"valid"],[[8183,8183],"mapped",[8182,953]],[[8184,8184],"mapped",[8056]],[[8185,8185],"mapped",[972]],[[8186,8186],"mapped",[8060]],[[8187,8187],"mapped",[974]],[[8188,8188],"mapped",[969,953]],[[8189,8189],"disallowed_STD3_mapped",[32,769]],[[8190,8190],"disallowed_STD3_mapped",[32,788]],[[8191,8191],"disallowed"],[[8192,8202],"disallowed_STD3_mapped",[32]],[[8203,8203],"ignored"],[[8204,8205],"deviation",[]],[[8206,8207],"disallowed"],[[8208,8208],"valid",[],"NV8"],[[8209,8209],"mapped",[8208]],[[8210,8214],"valid",[],"NV8"],[[8215,8215],"disallowed_STD3_mapped",[32,819]],[[8216,8227],"valid",[],"NV8"],[[8228,8230],"disallowed"],[[8231,8231],"valid",[],"NV8"],[[8232,8238],"disallowed"],[[8239,8239],"disallowed_STD3_mapped",[32]],[[8240,8242],"valid",[],"NV8"],[[8243,8243],"mapped",[8242,8242]],[[8244,8244],"mapped",[8242,8242,8242]],[[8245,8245],"valid",[],"NV8"],[[8246,8246],"mapped",[8245,8245]],[[8247,8247],"mapped",[8245,8245,8245]],[[8248,8251],"valid",[],"NV8"],[[8252,8252],"disallowed_STD3_mapped",[33,33]],[[8253,8253],"valid",[],"NV8"],[[8254,8254],"disallowed_STD3_mapped",[32,773]],[[8255,8262],"valid",[],"NV8"],[[8263,8263],"disallowed_STD3_mapped",[63,63]],[[8264,8264],"disallowed_STD3_mapped",[63,33]],[[8265,8265],"disallowed_STD3_mapped",[33,63]],[[8266,8269],"valid",[],"NV8"],[[8270,8274],"valid",[],"NV8"],[[8275,8276],"valid",[],"NV8"],[[8277,8278],"valid",[],"NV8"],[[8279,8279],"mapped",[8242,8242,8242,8242]],[[8280,8286],"valid",[],"NV8"],[[8287,8287],"disallowed_STD3_mapped",[32]],[[8288,8288],"ignored"],[[8289,8291],"disallowed"],[[8292,8292],"ignored"],[[8293,8293],"disallowed"],[[8294,8297],"disallowed"],[[8298,8303],"disallowed"],[[8304,8304],"mapped",[48]],[[8305,8305],"mapped",[105]],[[8306,8307],"disallowed"],[[8308,8308],"mapped",[52]],[[8309,8309],"mapped",[53]],[[8310,8310],"mapped",[54]],[[8311,8311],"mapped",[55]],[[8312,8312],"mapped",[56]],[[8313,8313],"mapped",[57]],[[8314,8314],"disallowed_STD3_mapped",[43]],[[8315,8315],"mapped",[8722]],[[8316,8316],"disallowed_STD3_mapped",[61]],[[8317,8317],"disallowed_STD3_mapped",[40]],[[8318,8318],"disallowed_STD3_mapped",[41]],[[8319,8319],"mapped",[110]],[[8320,8320],"mapped",[48]],[[8321,8321],"mapped",[49]],[[8322,8322],"mapped",[50]],[[8323,8323],"mapped",[51]],[[8324,8324],"mapped",[52]],[[8325,8325],"mapped",[53]],[[8326,8326],"mapped",[54]],[[8327,8327],"mapped",[55]],[[8328,8328],"mapped",[56]],[[8329,8329],"mapped",[57]],[[8330,8330],"disallowed_STD3_mapped",[43]],[[8331,8331],"mapped",[8722]],[[8332,8332],"disallowed_STD3_mapped",[61]],[[8333,8333],"disallowed_STD3_mapped",[40]],[[8334,8334],"disallowed_STD3_mapped",[41]],[[8335,8335],"disallowed"],[[8336,8336],"mapped",[97]],[[8337,8337],"mapped",[101]],[[8338,8338],"mapped",[111]],[[8339,8339],"mapped",[120]],[[8340,8340],"mapped",[601]],[[8341,8341],"mapped",[104]],[[8342,8342],"mapped",[107]],[[8343,8343],"mapped",[108]],[[8344,8344],"mapped",[109]],[[8345,8345],"mapped",[110]],[[8346,8346],"mapped",[112]],[[8347,8347],"mapped",[115]],[[8348,8348],"mapped",[116]],[[8349,8351],"disallowed"],[[8352,8359],"valid",[],"NV8"],[[8360,8360],"mapped",[114,115]],[[8361,8362],"valid",[],"NV8"],[[8363,8363],"valid",[],"NV8"],[[8364,8364],"valid",[],"NV8"],[[8365,8367],"valid",[],"NV8"],[[8368,8369],"valid",[],"NV8"],[[8370,8373],"valid",[],"NV8"],[[8374,8376],"valid",[],"NV8"],[[8377,8377],"valid",[],"NV8"],[[8378,8378],"valid",[],"NV8"],[[8379,8381],"valid",[],"NV8"],[[8382,8382],"valid",[],"NV8"],[[8383,8399],"disallowed"],[[8400,8417],"valid",[],"NV8"],[[8418,8419],"valid",[],"NV8"],[[8420,8426],"valid",[],"NV8"],[[8427,8427],"valid",[],"NV8"],[[8428,8431],"valid",[],"NV8"],[[8432,8432],"valid",[],"NV8"],[[8433,8447],"disallowed"],[[8448,8448],"disallowed_STD3_mapped",[97,47,99]],[[8449,8449],"disallowed_STD3_mapped",[97,47,115]],[[8450,8450],"mapped",[99]],[[8451,8451],"mapped",[176,99]],[[8452,8452],"valid",[],"NV8"],[[8453,8453],"disallowed_STD3_mapped",[99,47,111]],[[8454,8454],"disallowed_STD3_mapped",[99,47,117]],[[8455,8455],"mapped",[603]],[[8456,8456],"valid",[],"NV8"],[[8457,8457],"mapped",[176,102]],[[8458,8458],"mapped",[103]],[[8459,8462],"mapped",[104]],[[8463,8463],"mapped",[295]],[[8464,8465],"mapped",[105]],[[8466,8467],"mapped",[108]],[[8468,8468],"valid",[],"NV8"],[[8469,8469],"mapped",[110]],[[8470,8470],"mapped",[110,111]],[[8471,8472],"valid",[],"NV8"],[[8473,8473],"mapped",[112]],[[8474,8474],"mapped",[113]],[[8475,8477],"mapped",[114]],[[8478,8479],"valid",[],"NV8"],[[8480,8480],"mapped",[115,109]],[[8481,8481],"mapped",[116,101,108]],[[8482,8482],"mapped",[116,109]],[[8483,8483],"valid",[],"NV8"],[[8484,8484],"mapped",[122]],[[8485,8485],"valid",[],"NV8"],[[8486,8486],"mapped",[969]],[[8487,8487],"valid",[],"NV8"],[[8488,8488],"mapped",[122]],[[8489,8489],"valid",[],"NV8"],[[8490,8490],"mapped",[107]],[[8491,8491],"mapped",[229]],[[8492,8492],"mapped",[98]],[[8493,8493],"mapped",[99]],[[8494,8494],"valid",[],"NV8"],[[8495,8496],"mapped",[101]],[[8497,8497],"mapped",[102]],[[8498,8498],"disallowed"],[[8499,8499],"mapped",[109]],[[8500,8500],"mapped",[111]],[[8501,8501],"mapped",[1488]],[[8502,8502],"mapped",[1489]],[[8503,8503],"mapped",[1490]],[[8504,8504],"mapped",[1491]],[[8505,8505],"mapped",[105]],[[8506,8506],"valid",[],"NV8"],[[8507,8507],"mapped",[102,97,120]],[[8508,8508],"mapped",[960]],[[8509,8510],"mapped",[947]],[[8511,8511],"mapped",[960]],[[8512,8512],"mapped",[8721]],[[8513,8516],"valid",[],"NV8"],[[8517,8518],"mapped",[100]],[[8519,8519],"mapped",[101]],[[8520,8520],"mapped",[105]],[[8521,8521],"mapped",[106]],[[8522,8523],"valid",[],"NV8"],[[8524,8524],"valid",[],"NV8"],[[8525,8525],"valid",[],"NV8"],[[8526,8526],"valid"],[[8527,8527],"valid",[],"NV8"],[[8528,8528],"mapped",[49,8260,55]],[[8529,8529],"mapped",[49,8260,57]],[[8530,8530],"mapped",[49,8260,49,48]],[[8531,8531],"mapped",[49,8260,51]],[[8532,8532],"mapped",[50,8260,51]],[[8533,8533],"mapped",[49,8260,53]],[[8534,8534],"mapped",[50,8260,53]],[[8535,8535],"mapped",[51,8260,53]],[[8536,8536],"mapped",[52,8260,53]],[[8537,8537],"mapped",[49,8260,54]],[[8538,8538],"mapped",[53,8260,54]],[[8539,8539],"mapped",[49,8260,56]],[[8540,8540],"mapped",[51,8260,56]],[[8541,8541],"mapped",[53,8260,56]],[[8542,8542],"mapped",[55,8260,56]],[[8543,8543],"mapped",[49,8260]],[[8544,8544],"mapped",[105]],[[8545,8545],"mapped",[105,105]],[[8546,8546],"mapped",[105,105,105]],[[8547,8547],"mapped",[105,118]],[[8548,8548],"mapped",[118]],[[8549,8549],"mapped",[118,105]],[[8550,8550],"mapped",[118,105,105]],[[8551,8551],"mapped",[118,105,105,105]],[[8552,8552],"mapped",[105,120]],[[8553,8553],"mapped",[120]],[[8554,8554],"mapped",[120,105]],[[8555,8555],"mapped",[120,105,105]],[[8556,8556],"mapped",[108]],[[8557,8557],"mapped",[99]],[[8558,8558],"mapped",[100]],[[8559,8559],"mapped",[109]],[[8560,8560],"mapped",[105]],[[8561,8561],"mapped",[105,105]],[[8562,8562],"mapped",[105,105,105]],[[8563,8563],"mapped",[105,118]],[[8564,8564],"mapped",[118]],[[8565,8565],"mapped",[118,105]],[[8566,8566],"mapped",[118,105,105]],[[8567,8567],"mapped",[118,105,105,105]],[[8568,8568],"mapped",[105,120]],[[8569,8569],"mapped",[120]],[[8570,8570],"mapped",[120,105]],[[8571,8571],"mapped",[120,105,105]],[[8572,8572],"mapped",[108]],[[8573,8573],"mapped",[99]],[[8574,8574],"mapped",[100]],[[8575,8575],"mapped",[109]],[[8576,8578],"valid",[],"NV8"],[[8579,8579],"disallowed"],[[8580,8580],"valid"],[[8581,8584],"valid",[],"NV8"],[[8585,8585],"mapped",[48,8260,51]],[[8586,8587],"valid",[],"NV8"],[[8588,8591],"disallowed"],[[8592,8682],"valid",[],"NV8"],[[8683,8691],"valid",[],"NV8"],[[8692,8703],"valid",[],"NV8"],[[8704,8747],"valid",[],"NV8"],[[8748,8748],"mapped",[8747,8747]],[[8749,8749],"mapped",[8747,8747,8747]],[[8750,8750],"valid",[],"NV8"],[[8751,8751],"mapped",[8750,8750]],[[8752,8752],"mapped",[8750,8750,8750]],[[8753,8799],"valid",[],"NV8"],[[8800,8800],"disallowed_STD3_valid"],[[8801,8813],"valid",[],"NV8"],[[8814,8815],"disallowed_STD3_valid"],[[8816,8945],"valid",[],"NV8"],[[8946,8959],"valid",[],"NV8"],[[8960,8960],"valid",[],"NV8"],[[8961,8961],"valid",[],"NV8"],[[8962,9e3],"valid",[],"NV8"],[[9001,9001],"mapped",[12296]],[[9002,9002],"mapped",[12297]],[[9003,9082],"valid",[],"NV8"],[[9083,9083],"valid",[],"NV8"],[[9084,9084],"valid",[],"NV8"],[[9085,9114],"valid",[],"NV8"],[[9115,9166],"valid",[],"NV8"],[[9167,9168],"valid",[],"NV8"],[[9169,9179],"valid",[],"NV8"],[[9180,9191],"valid",[],"NV8"],[[9192,9192],"valid",[],"NV8"],[[9193,9203],"valid",[],"NV8"],[[9204,9210],"valid",[],"NV8"],[[9211,9215],"disallowed"],[[9216,9252],"valid",[],"NV8"],[[9253,9254],"valid",[],"NV8"],[[9255,9279],"disallowed"],[[9280,9290],"valid",[],"NV8"],[[9291,9311],"disallowed"],[[9312,9312],"mapped",[49]],[[9313,9313],"mapped",[50]],[[9314,9314],"mapped",[51]],[[9315,9315],"mapped",[52]],[[9316,9316],"mapped",[53]],[[9317,9317],"mapped",[54]],[[9318,9318],"mapped",[55]],[[9319,9319],"mapped",[56]],[[9320,9320],"mapped",[57]],[[9321,9321],"mapped",[49,48]],[[9322,9322],"mapped",[49,49]],[[9323,9323],"mapped",[49,50]],[[9324,9324],"mapped",[49,51]],[[9325,9325],"mapped",[49,52]],[[9326,9326],"mapped",[49,53]],[[9327,9327],"mapped",[49,54]],[[9328,9328],"mapped",[49,55]],[[9329,9329],"mapped",[49,56]],[[9330,9330],"mapped",[49,57]],[[9331,9331],"mapped",[50,48]],[[9332,9332],"disallowed_STD3_mapped",[40,49,41]],[[9333,9333],"disallowed_STD3_mapped",[40,50,41]],[[9334,9334],"disallowed_STD3_mapped",[40,51,41]],[[9335,9335],"disallowed_STD3_mapped",[40,52,41]],[[9336,9336],"disallowed_STD3_mapped",[40,53,41]],[[9337,9337],"disallowed_STD3_mapped",[40,54,41]],[[9338,9338],"disallowed_STD3_mapped",[40,55,41]],[[9339,9339],"disallowed_STD3_mapped",[40,56,41]],[[9340,9340],"disallowed_STD3_mapped",[40,57,41]],[[9341,9341],"disallowed_STD3_mapped",[40,49,48,41]],[[9342,9342],"disallowed_STD3_mapped",[40,49,49,41]],[[9343,9343],"disallowed_STD3_mapped",[40,49,50,41]],[[9344,9344],"disallowed_STD3_mapped",[40,49,51,41]],[[9345,9345],"disallowed_STD3_mapped",[40,49,52,41]],[[9346,9346],"disallowed_STD3_mapped",[40,49,53,41]],[[9347,9347],"disallowed_STD3_mapped",[40,49,54,41]],[[9348,9348],"disallowed_STD3_mapped",[40,49,55,41]],[[9349,9349],"disallowed_STD3_mapped",[40,49,56,41]],[[9350,9350],"disallowed_STD3_mapped",[40,49,57,41]],[[9351,9351],"disallowed_STD3_mapped",[40,50,48,41]],[[9352,9371],"disallowed"],[[9372,9372],"disallowed_STD3_mapped",[40,97,41]],[[9373,9373],"disallowed_STD3_mapped",[40,98,41]],[[9374,9374],"disallowed_STD3_mapped",[40,99,41]],[[9375,9375],"disallowed_STD3_mapped",[40,100,41]],[[9376,9376],"disallowed_STD3_mapped",[40,101,41]],[[9377,9377],"disallowed_STD3_mapped",[40,102,41]],[[9378,9378],"disallowed_STD3_mapped",[40,103,41]],[[9379,9379],"disallowed_STD3_mapped",[40,104,41]],[[9380,9380],"disallowed_STD3_mapped",[40,105,41]],[[9381,9381],"disallowed_STD3_mapped",[40,106,41]],[[9382,9382],"disallowed_STD3_mapped",[40,107,41]],[[9383,9383],"disallowed_STD3_mapped",[40,108,41]],[[9384,9384],"disallowed_STD3_mapped",[40,109,41]],[[9385,9385],"disallowed_STD3_mapped",[40,110,41]],[[9386,9386],"disallowed_STD3_mapped",[40,111,41]],[[9387,9387],"disallowed_STD3_mapped",[40,112,41]],[[9388,9388],"disallowed_STD3_mapped",[40,113,41]],[[9389,9389],"disallowed_STD3_mapped",[40,114,41]],[[9390,9390],"disallowed_STD3_mapped",[40,115,41]],[[9391,9391],"disallowed_STD3_mapped",[40,116,41]],[[9392,9392],"disallowed_STD3_mapped",[40,117,41]],[[9393,9393],"disallowed_STD3_mapped",[40,118,41]],[[9394,9394],"disallowed_STD3_mapped",[40,119,41]],[[9395,9395],"disallowed_STD3_mapped",[40,120,41]],[[9396,9396],"disallowed_STD3_mapped",[40,121,41]],[[9397,9397],"disallowed_STD3_mapped",[40,122,41]],[[9398,9398],"mapped",[97]],[[9399,9399],"mapped",[98]],[[9400,9400],"mapped",[99]],[[9401,9401],"mapped",[100]],[[9402,9402],"mapped",[101]],[[9403,9403],"mapped",[102]],[[9404,9404],"mapped",[103]],[[9405,9405],"mapped",[104]],[[9406,9406],"mapped",[105]],[[9407,9407],"mapped",[106]],[[9408,9408],"mapped",[107]],[[9409,9409],"mapped",[108]],[[9410,9410],"mapped",[109]],[[9411,9411],"mapped",[110]],[[9412,9412],"mapped",[111]],[[9413,9413],"mapped",[112]],[[9414,9414],"mapped",[113]],[[9415,9415],"mapped",[114]],[[9416,9416],"mapped",[115]],[[9417,9417],"mapped",[116]],[[9418,9418],"mapped",[117]],[[9419,9419],"mapped",[118]],[[9420,9420],"mapped",[119]],[[9421,9421],"mapped",[120]],[[9422,9422],"mapped",[121]],[[9423,9423],"mapped",[122]],[[9424,9424],"mapped",[97]],[[9425,9425],"mapped",[98]],[[9426,9426],"mapped",[99]],[[9427,9427],"mapped",[100]],[[9428,9428],"mapped",[101]],[[9429,9429],"mapped",[102]],[[9430,9430],"mapped",[103]],[[9431,9431],"mapped",[104]],[[9432,9432],"mapped",[105]],[[9433,9433],"mapped",[106]],[[9434,9434],"mapped",[107]],[[9435,9435],"mapped",[108]],[[9436,9436],"mapped",[109]],[[9437,9437],"mapped",[110]],[[9438,9438],"mapped",[111]],[[9439,9439],"mapped",[112]],[[9440,9440],"mapped",[113]],[[9441,9441],"mapped",[114]],[[9442,9442],"mapped",[115]],[[9443,9443],"mapped",[116]],[[9444,9444],"mapped",[117]],[[9445,9445],"mapped",[118]],[[9446,9446],"mapped",[119]],[[9447,9447],"mapped",[120]],[[9448,9448],"mapped",[121]],[[9449,9449],"mapped",[122]],[[9450,9450],"mapped",[48]],[[9451,9470],"valid",[],"NV8"],[[9471,9471],"valid",[],"NV8"],[[9472,9621],"valid",[],"NV8"],[[9622,9631],"valid",[],"NV8"],[[9632,9711],"valid",[],"NV8"],[[9712,9719],"valid",[],"NV8"],[[9720,9727],"valid",[],"NV8"],[[9728,9747],"valid",[],"NV8"],[[9748,9749],"valid",[],"NV8"],[[9750,9751],"valid",[],"NV8"],[[9752,9752],"valid",[],"NV8"],[[9753,9753],"valid",[],"NV8"],[[9754,9839],"valid",[],"NV8"],[[9840,9841],"valid",[],"NV8"],[[9842,9853],"valid",[],"NV8"],[[9854,9855],"valid",[],"NV8"],[[9856,9865],"valid",[],"NV8"],[[9866,9873],"valid",[],"NV8"],[[9874,9884],"valid",[],"NV8"],[[9885,9885],"valid",[],"NV8"],[[9886,9887],"valid",[],"NV8"],[[9888,9889],"valid",[],"NV8"],[[9890,9905],"valid",[],"NV8"],[[9906,9906],"valid",[],"NV8"],[[9907,9916],"valid",[],"NV8"],[[9917,9919],"valid",[],"NV8"],[[9920,9923],"valid",[],"NV8"],[[9924,9933],"valid",[],"NV8"],[[9934,9934],"valid",[],"NV8"],[[9935,9953],"valid",[],"NV8"],[[9954,9954],"valid",[],"NV8"],[[9955,9955],"valid",[],"NV8"],[[9956,9959],"valid",[],"NV8"],[[9960,9983],"valid",[],"NV8"],[[9984,9984],"valid",[],"NV8"],[[9985,9988],"valid",[],"NV8"],[[9989,9989],"valid",[],"NV8"],[[9990,9993],"valid",[],"NV8"],[[9994,9995],"valid",[],"NV8"],[[9996,10023],"valid",[],"NV8"],[[10024,10024],"valid",[],"NV8"],[[10025,10059],"valid",[],"NV8"],[[10060,10060],"valid",[],"NV8"],[[10061,10061],"valid",[],"NV8"],[[10062,10062],"valid",[],"NV8"],[[10063,10066],"valid",[],"NV8"],[[10067,10069],"valid",[],"NV8"],[[10070,10070],"valid",[],"NV8"],[[10071,10071],"valid",[],"NV8"],[[10072,10078],"valid",[],"NV8"],[[10079,10080],"valid",[],"NV8"],[[10081,10087],"valid",[],"NV8"],[[10088,10101],"valid",[],"NV8"],[[10102,10132],"valid",[],"NV8"],[[10133,10135],"valid",[],"NV8"],[[10136,10159],"valid",[],"NV8"],[[10160,10160],"valid",[],"NV8"],[[10161,10174],"valid",[],"NV8"],[[10175,10175],"valid",[],"NV8"],[[10176,10182],"valid",[],"NV8"],[[10183,10186],"valid",[],"NV8"],[[10187,10187],"valid",[],"NV8"],[[10188,10188],"valid",[],"NV8"],[[10189,10189],"valid",[],"NV8"],[[10190,10191],"valid",[],"NV8"],[[10192,10219],"valid",[],"NV8"],[[10220,10223],"valid",[],"NV8"],[[10224,10239],"valid",[],"NV8"],[[10240,10495],"valid",[],"NV8"],[[10496,10763],"valid",[],"NV8"],[[10764,10764],"mapped",[8747,8747,8747,8747]],[[10765,10867],"valid",[],"NV8"],[[10868,10868],"disallowed_STD3_mapped",[58,58,61]],[[10869,10869],"disallowed_STD3_mapped",[61,61]],[[10870,10870],"disallowed_STD3_mapped",[61,61,61]],[[10871,10971],"valid",[],"NV8"],[[10972,10972],"mapped",[10973,824]],[[10973,11007],"valid",[],"NV8"],[[11008,11021],"valid",[],"NV8"],[[11022,11027],"valid",[],"NV8"],[[11028,11034],"valid",[],"NV8"],[[11035,11039],"valid",[],"NV8"],[[11040,11043],"valid",[],"NV8"],[[11044,11084],"valid",[],"NV8"],[[11085,11087],"valid",[],"NV8"],[[11088,11092],"valid",[],"NV8"],[[11093,11097],"valid",[],"NV8"],[[11098,11123],"valid",[],"NV8"],[[11124,11125],"disallowed"],[[11126,11157],"valid",[],"NV8"],[[11158,11159],"disallowed"],[[11160,11193],"valid",[],"NV8"],[[11194,11196],"disallowed"],[[11197,11208],"valid",[],"NV8"],[[11209,11209],"disallowed"],[[11210,11217],"valid",[],"NV8"],[[11218,11243],"disallowed"],[[11244,11247],"valid",[],"NV8"],[[11248,11263],"disallowed"],[[11264,11264],"mapped",[11312]],[[11265,11265],"mapped",[11313]],[[11266,11266],"mapped",[11314]],[[11267,11267],"mapped",[11315]],[[11268,11268],"mapped",[11316]],[[11269,11269],"mapped",[11317]],[[11270,11270],"mapped",[11318]],[[11271,11271],"mapped",[11319]],[[11272,11272],"mapped",[11320]],[[11273,11273],"mapped",[11321]],[[11274,11274],"mapped",[11322]],[[11275,11275],"mapped",[11323]],[[11276,11276],"mapped",[11324]],[[11277,11277],"mapped",[11325]],[[11278,11278],"mapped",[11326]],[[11279,11279],"mapped",[11327]],[[11280,11280],"mapped",[11328]],[[11281,11281],"mapped",[11329]],[[11282,11282],"mapped",[11330]],[[11283,11283],"mapped",[11331]],[[11284,11284],"mapped",[11332]],[[11285,11285],"mapped",[11333]],[[11286,11286],"mapped",[11334]],[[11287,11287],"mapped",[11335]],[[11288,11288],"mapped",[11336]],[[11289,11289],"mapped",[11337]],[[11290,11290],"mapped",[11338]],[[11291,11291],"mapped",[11339]],[[11292,11292],"mapped",[11340]],[[11293,11293],"mapped",[11341]],[[11294,11294],"mapped",[11342]],[[11295,11295],"mapped",[11343]],[[11296,11296],"mapped",[11344]],[[11297,11297],"mapped",[11345]],[[11298,11298],"mapped",[11346]],[[11299,11299],"mapped",[11347]],[[11300,11300],"mapped",[11348]],[[11301,11301],"mapped",[11349]],[[11302,11302],"mapped",[11350]],[[11303,11303],"mapped",[11351]],[[11304,11304],"mapped",[11352]],[[11305,11305],"mapped",[11353]],[[11306,11306],"mapped",[11354]],[[11307,11307],"mapped",[11355]],[[11308,11308],"mapped",[11356]],[[11309,11309],"mapped",[11357]],[[11310,11310],"mapped",[11358]],[[11311,11311],"disallowed"],[[11312,11358],"valid"],[[11359,11359],"disallowed"],[[11360,11360],"mapped",[11361]],[[11361,11361],"valid"],[[11362,11362],"mapped",[619]],[[11363,11363],"mapped",[7549]],[[11364,11364],"mapped",[637]],[[11365,11366],"valid"],[[11367,11367],"mapped",[11368]],[[11368,11368],"valid"],[[11369,11369],"mapped",[11370]],[[11370,11370],"valid"],[[11371,11371],"mapped",[11372]],[[11372,11372],"valid"],[[11373,11373],"mapped",[593]],[[11374,11374],"mapped",[625]],[[11375,11375],"mapped",[592]],[[11376,11376],"mapped",[594]],[[11377,11377],"valid"],[[11378,11378],"mapped",[11379]],[[11379,11379],"valid"],[[11380,11380],"valid"],[[11381,11381],"mapped",[11382]],[[11382,11383],"valid"],[[11384,11387],"valid"],[[11388,11388],"mapped",[106]],[[11389,11389],"mapped",[118]],[[11390,11390],"mapped",[575]],[[11391,11391],"mapped",[576]],[[11392,11392],"mapped",[11393]],[[11393,11393],"valid"],[[11394,11394],"mapped",[11395]],[[11395,11395],"valid"],[[11396,11396],"mapped",[11397]],[[11397,11397],"valid"],[[11398,11398],"mapped",[11399]],[[11399,11399],"valid"],[[11400,11400],"mapped",[11401]],[[11401,11401],"valid"],[[11402,11402],"mapped",[11403]],[[11403,11403],"valid"],[[11404,11404],"mapped",[11405]],[[11405,11405],"valid"],[[11406,11406],"mapped",[11407]],[[11407,11407],"valid"],[[11408,11408],"mapped",[11409]],[[11409,11409],"valid"],[[11410,11410],"mapped",[11411]],[[11411,11411],"valid"],[[11412,11412],"mapped",[11413]],[[11413,11413],"valid"],[[11414,11414],"mapped",[11415]],[[11415,11415],"valid"],[[11416,11416],"mapped",[11417]],[[11417,11417],"valid"],[[11418,11418],"mapped",[11419]],[[11419,11419],"valid"],[[11420,11420],"mapped",[11421]],[[11421,11421],"valid"],[[11422,11422],"mapped",[11423]],[[11423,11423],"valid"],[[11424,11424],"mapped",[11425]],[[11425,11425],"valid"],[[11426,11426],"mapped",[11427]],[[11427,11427],"valid"],[[11428,11428],"mapped",[11429]],[[11429,11429],"valid"],[[11430,11430],"mapped",[11431]],[[11431,11431],"valid"],[[11432,11432],"mapped",[11433]],[[11433,11433],"valid"],[[11434,11434],"mapped",[11435]],[[11435,11435],"valid"],[[11436,11436],"mapped",[11437]],[[11437,11437],"valid"],[[11438,11438],"mapped",[11439]],[[11439,11439],"valid"],[[11440,11440],"mapped",[11441]],[[11441,11441],"valid"],[[11442,11442],"mapped",[11443]],[[11443,11443],"valid"],[[11444,11444],"mapped",[11445]],[[11445,11445],"valid"],[[11446,11446],"mapped",[11447]],[[11447,11447],"valid"],[[11448,11448],"mapped",[11449]],[[11449,11449],"valid"],[[11450,11450],"mapped",[11451]],[[11451,11451],"valid"],[[11452,11452],"mapped",[11453]],[[11453,11453],"valid"],[[11454,11454],"mapped",[11455]],[[11455,11455],"valid"],[[11456,11456],"mapped",[11457]],[[11457,11457],"valid"],[[11458,11458],"mapped",[11459]],[[11459,11459],"valid"],[[11460,11460],"mapped",[11461]],[[11461,11461],"valid"],[[11462,11462],"mapped",[11463]],[[11463,11463],"valid"],[[11464,11464],"mapped",[11465]],[[11465,11465],"valid"],[[11466,11466],"mapped",[11467]],[[11467,11467],"valid"],[[11468,11468],"mapped",[11469]],[[11469,11469],"valid"],[[11470,11470],"mapped",[11471]],[[11471,11471],"valid"],[[11472,11472],"mapped",[11473]],[[11473,11473],"valid"],[[11474,11474],"mapped",[11475]],[[11475,11475],"valid"],[[11476,11476],"mapped",[11477]],[[11477,11477],"valid"],[[11478,11478],"mapped",[11479]],[[11479,11479],"valid"],[[11480,11480],"mapped",[11481]],[[11481,11481],"valid"],[[11482,11482],"mapped",[11483]],[[11483,11483],"valid"],[[11484,11484],"mapped",[11485]],[[11485,11485],"valid"],[[11486,11486],"mapped",[11487]],[[11487,11487],"valid"],[[11488,11488],"mapped",[11489]],[[11489,11489],"valid"],[[11490,11490],"mapped",[11491]],[[11491,11492],"valid"],[[11493,11498],"valid",[],"NV8"],[[11499,11499],"mapped",[11500]],[[11500,11500],"valid"],[[11501,11501],"mapped",[11502]],[[11502,11505],"valid"],[[11506,11506],"mapped",[11507]],[[11507,11507],"valid"],[[11508,11512],"disallowed"],[[11513,11519],"valid",[],"NV8"],[[11520,11557],"valid"],[[11558,11558],"disallowed"],[[11559,11559],"valid"],[[11560,11564],"disallowed"],[[11565,11565],"valid"],[[11566,11567],"disallowed"],[[11568,11621],"valid"],[[11622,11623],"valid"],[[11624,11630],"disallowed"],[[11631,11631],"mapped",[11617]],[[11632,11632],"valid",[],"NV8"],[[11633,11646],"disallowed"],[[11647,11647],"valid"],[[11648,11670],"valid"],[[11671,11679],"disallowed"],[[11680,11686],"valid"],[[11687,11687],"disallowed"],[[11688,11694],"valid"],[[11695,11695],"disallowed"],[[11696,11702],"valid"],[[11703,11703],"disallowed"],[[11704,11710],"valid"],[[11711,11711],"disallowed"],[[11712,11718],"valid"],[[11719,11719],"disallowed"],[[11720,11726],"valid"],[[11727,11727],"disallowed"],[[11728,11734],"valid"],[[11735,11735],"disallowed"],[[11736,11742],"valid"],[[11743,11743],"disallowed"],[[11744,11775],"valid"],[[11776,11799],"valid",[],"NV8"],[[11800,11803],"valid",[],"NV8"],[[11804,11805],"valid",[],"NV8"],[[11806,11822],"valid",[],"NV8"],[[11823,11823],"valid"],[[11824,11824],"valid",[],"NV8"],[[11825,11825],"valid",[],"NV8"],[[11826,11835],"valid",[],"NV8"],[[11836,11842],"valid",[],"NV8"],[[11843,11903],"disallowed"],[[11904,11929],"valid",[],"NV8"],[[11930,11930],"disallowed"],[[11931,11934],"valid",[],"NV8"],[[11935,11935],"mapped",[27597]],[[11936,12018],"valid",[],"NV8"],[[12019,12019],"mapped",[40863]],[[12020,12031],"disallowed"],[[12032,12032],"mapped",[19968]],[[12033,12033],"mapped",[20008]],[[12034,12034],"mapped",[20022]],[[12035,12035],"mapped",[20031]],[[12036,12036],"mapped",[20057]],[[12037,12037],"mapped",[20101]],[[12038,12038],"mapped",[20108]],[[12039,12039],"mapped",[20128]],[[12040,12040],"mapped",[20154]],[[12041,12041],"mapped",[20799]],[[12042,12042],"mapped",[20837]],[[12043,12043],"mapped",[20843]],[[12044,12044],"mapped",[20866]],[[12045,12045],"mapped",[20886]],[[12046,12046],"mapped",[20907]],[[12047,12047],"mapped",[20960]],[[12048,12048],"mapped",[20981]],[[12049,12049],"mapped",[20992]],[[12050,12050],"mapped",[21147]],[[12051,12051],"mapped",[21241]],[[12052,12052],"mapped",[21269]],[[12053,12053],"mapped",[21274]],[[12054,12054],"mapped",[21304]],[[12055,12055],"mapped",[21313]],[[12056,12056],"mapped",[21340]],[[12057,12057],"mapped",[21353]],[[12058,12058],"mapped",[21378]],[[12059,12059],"mapped",[21430]],[[12060,12060],"mapped",[21448]],[[12061,12061],"mapped",[21475]],[[12062,12062],"mapped",[22231]],[[12063,12063],"mapped",[22303]],[[12064,12064],"mapped",[22763]],[[12065,12065],"mapped",[22786]],[[12066,12066],"mapped",[22794]],[[12067,12067],"mapped",[22805]],[[12068,12068],"mapped",[22823]],[[12069,12069],"mapped",[22899]],[[12070,12070],"mapped",[23376]],[[12071,12071],"mapped",[23424]],[[12072,12072],"mapped",[23544]],[[12073,12073],"mapped",[23567]],[[12074,12074],"mapped",[23586]],[[12075,12075],"mapped",[23608]],[[12076,12076],"mapped",[23662]],[[12077,12077],"mapped",[23665]],[[12078,12078],"mapped",[24027]],[[12079,12079],"mapped",[24037]],[[12080,12080],"mapped",[24049]],[[12081,12081],"mapped",[24062]],[[12082,12082],"mapped",[24178]],[[12083,12083],"mapped",[24186]],[[12084,12084],"mapped",[24191]],[[12085,12085],"mapped",[24308]],[[12086,12086],"mapped",[24318]],[[12087,12087],"mapped",[24331]],[[12088,12088],"mapped",[24339]],[[12089,12089],"mapped",[24400]],[[12090,12090],"mapped",[24417]],[[12091,12091],"mapped",[24435]],[[12092,12092],"mapped",[24515]],[[12093,12093],"mapped",[25096]],[[12094,12094],"mapped",[25142]],[[12095,12095],"mapped",[25163]],[[12096,12096],"mapped",[25903]],[[12097,12097],"mapped",[25908]],[[12098,12098],"mapped",[25991]],[[12099,12099],"mapped",[26007]],[[12100,12100],"mapped",[26020]],[[12101,12101],"mapped",[26041]],[[12102,12102],"mapped",[26080]],[[12103,12103],"mapped",[26085]],[[12104,12104],"mapped",[26352]],[[12105,12105],"mapped",[26376]],[[12106,12106],"mapped",[26408]],[[12107,12107],"mapped",[27424]],[[12108,12108],"mapped",[27490]],[[12109,12109],"mapped",[27513]],[[12110,12110],"mapped",[27571]],[[12111,12111],"mapped",[27595]],[[12112,12112],"mapped",[27604]],[[12113,12113],"mapped",[27611]],[[12114,12114],"mapped",[27663]],[[12115,12115],"mapped",[27668]],[[12116,12116],"mapped",[27700]],[[12117,12117],"mapped",[28779]],[[12118,12118],"mapped",[29226]],[[12119,12119],"mapped",[29238]],[[12120,12120],"mapped",[29243]],[[12121,12121],"mapped",[29247]],[[12122,12122],"mapped",[29255]],[[12123,12123],"mapped",[29273]],[[12124,12124],"mapped",[29275]],[[12125,12125],"mapped",[29356]],[[12126,12126],"mapped",[29572]],[[12127,12127],"mapped",[29577]],[[12128,12128],"mapped",[29916]],[[12129,12129],"mapped",[29926]],[[12130,12130],"mapped",[29976]],[[12131,12131],"mapped",[29983]],[[12132,12132],"mapped",[29992]],[[12133,12133],"mapped",[3e4]],[[12134,12134],"mapped",[30091]],[[12135,12135],"mapped",[30098]],[[12136,12136],"mapped",[30326]],[[12137,12137],"mapped",[30333]],[[12138,12138],"mapped",[30382]],[[12139,12139],"mapped",[30399]],[[12140,12140],"mapped",[30446]],[[12141,12141],"mapped",[30683]],[[12142,12142],"mapped",[30690]],[[12143,12143],"mapped",[30707]],[[12144,12144],"mapped",[31034]],[[12145,12145],"mapped",[31160]],[[12146,12146],"mapped",[31166]],[[12147,12147],"mapped",[31348]],[[12148,12148],"mapped",[31435]],[[12149,12149],"mapped",[31481]],[[12150,12150],"mapped",[31859]],[[12151,12151],"mapped",[31992]],[[12152,12152],"mapped",[32566]],[[12153,12153],"mapped",[32593]],[[12154,12154],"mapped",[32650]],[[12155,12155],"mapped",[32701]],[[12156,12156],"mapped",[32769]],[[12157,12157],"mapped",[32780]],[[12158,12158],"mapped",[32786]],[[12159,12159],"mapped",[32819]],[[12160,12160],"mapped",[32895]],[[12161,12161],"mapped",[32905]],[[12162,12162],"mapped",[33251]],[[12163,12163],"mapped",[33258]],[[12164,12164],"mapped",[33267]],[[12165,12165],"mapped",[33276]],[[12166,12166],"mapped",[33292]],[[12167,12167],"mapped",[33307]],[[12168,12168],"mapped",[33311]],[[12169,12169],"mapped",[33390]],[[12170,12170],"mapped",[33394]],[[12171,12171],"mapped",[33400]],[[12172,12172],"mapped",[34381]],[[12173,12173],"mapped",[34411]],[[12174,12174],"mapped",[34880]],[[12175,12175],"mapped",[34892]],[[12176,12176],"mapped",[34915]],[[12177,12177],"mapped",[35198]],[[12178,12178],"mapped",[35211]],[[12179,12179],"mapped",[35282]],[[12180,12180],"mapped",[35328]],[[12181,12181],"mapped",[35895]],[[12182,12182],"mapped",[35910]],[[12183,12183],"mapped",[35925]],[[12184,12184],"mapped",[35960]],[[12185,12185],"mapped",[35997]],[[12186,12186],"mapped",[36196]],[[12187,12187],"mapped",[36208]],[[12188,12188],"mapped",[36275]],[[12189,12189],"mapped",[36523]],[[12190,12190],"mapped",[36554]],[[12191,12191],"mapped",[36763]],[[12192,12192],"mapped",[36784]],[[12193,12193],"mapped",[36789]],[[12194,12194],"mapped",[37009]],[[12195,12195],"mapped",[37193]],[[12196,12196],"mapped",[37318]],[[12197,12197],"mapped",[37324]],[[12198,12198],"mapped",[37329]],[[12199,12199],"mapped",[38263]],[[12200,12200],"mapped",[38272]],[[12201,12201],"mapped",[38428]],[[12202,12202],"mapped",[38582]],[[12203,12203],"mapped",[38585]],[[12204,12204],"mapped",[38632]],[[12205,12205],"mapped",[38737]],[[12206,12206],"mapped",[38750]],[[12207,12207],"mapped",[38754]],[[12208,12208],"mapped",[38761]],[[12209,12209],"mapped",[38859]],[[12210,12210],"mapped",[38893]],[[12211,12211],"mapped",[38899]],[[12212,12212],"mapped",[38913]],[[12213,12213],"mapped",[39080]],[[12214,12214],"mapped",[39131]],[[12215,12215],"mapped",[39135]],[[12216,12216],"mapped",[39318]],[[12217,12217],"mapped",[39321]],[[12218,12218],"mapped",[39340]],[[12219,12219],"mapped",[39592]],[[12220,12220],"mapped",[39640]],[[12221,12221],"mapped",[39647]],[[12222,12222],"mapped",[39717]],[[12223,12223],"mapped",[39727]],[[12224,12224],"mapped",[39730]],[[12225,12225],"mapped",[39740]],[[12226,12226],"mapped",[39770]],[[12227,12227],"mapped",[40165]],[[12228,12228],"mapped",[40565]],[[12229,12229],"mapped",[40575]],[[12230,12230],"mapped",[40613]],[[12231,12231],"mapped",[40635]],[[12232,12232],"mapped",[40643]],[[12233,12233],"mapped",[40653]],[[12234,12234],"mapped",[40657]],[[12235,12235],"mapped",[40697]],[[12236,12236],"mapped",[40701]],[[12237,12237],"mapped",[40718]],[[12238,12238],"mapped",[40723]],[[12239,12239],"mapped",[40736]],[[12240,12240],"mapped",[40763]],[[12241,12241],"mapped",[40778]],[[12242,12242],"mapped",[40786]],[[12243,12243],"mapped",[40845]],[[12244,12244],"mapped",[40860]],[[12245,12245],"mapped",[40864]],[[12246,12271],"disallowed"],[[12272,12283],"disallowed"],[[12284,12287],"disallowed"],[[12288,12288],"disallowed_STD3_mapped",[32]],[[12289,12289],"valid",[],"NV8"],[[12290,12290],"mapped",[46]],[[12291,12292],"valid",[],"NV8"],[[12293,12295],"valid"],[[12296,12329],"valid",[],"NV8"],[[12330,12333],"valid"],[[12334,12341],"valid",[],"NV8"],[[12342,12342],"mapped",[12306]],[[12343,12343],"valid",[],"NV8"],[[12344,12344],"mapped",[21313]],[[12345,12345],"mapped",[21316]],[[12346,12346],"mapped",[21317]],[[12347,12347],"valid",[],"NV8"],[[12348,12348],"valid"],[[12349,12349],"valid",[],"NV8"],[[12350,12350],"valid",[],"NV8"],[[12351,12351],"valid",[],"NV8"],[[12352,12352],"disallowed"],[[12353,12436],"valid"],[[12437,12438],"valid"],[[12439,12440],"disallowed"],[[12441,12442],"valid"],[[12443,12443],"disallowed_STD3_mapped",[32,12441]],[[12444,12444],"disallowed_STD3_mapped",[32,12442]],[[12445,12446],"valid"],[[12447,12447],"mapped",[12424,12426]],[[12448,12448],"valid",[],"NV8"],[[12449,12542],"valid"],[[12543,12543],"mapped",[12467,12488]],[[12544,12548],"disallowed"],[[12549,12588],"valid"],[[12589,12589],"valid"],[[12590,12592],"disallowed"],[[12593,12593],"mapped",[4352]],[[12594,12594],"mapped",[4353]],[[12595,12595],"mapped",[4522]],[[12596,12596],"mapped",[4354]],[[12597,12597],"mapped",[4524]],[[12598,12598],"mapped",[4525]],[[12599,12599],"mapped",[4355]],[[12600,12600],"mapped",[4356]],[[12601,12601],"mapped",[4357]],[[12602,12602],"mapped",[4528]],[[12603,12603],"mapped",[4529]],[[12604,12604],"mapped",[4530]],[[12605,12605],"mapped",[4531]],[[12606,12606],"mapped",[4532]],[[12607,12607],"mapped",[4533]],[[12608,12608],"mapped",[4378]],[[12609,12609],"mapped",[4358]],[[12610,12610],"mapped",[4359]],[[12611,12611],"mapped",[4360]],[[12612,12612],"mapped",[4385]],[[12613,12613],"mapped",[4361]],[[12614,12614],"mapped",[4362]],[[12615,12615],"mapped",[4363]],[[12616,12616],"mapped",[4364]],[[12617,12617],"mapped",[4365]],[[12618,12618],"mapped",[4366]],[[12619,12619],"mapped",[4367]],[[12620,12620],"mapped",[4368]],[[12621,12621],"mapped",[4369]],[[12622,12622],"mapped",[4370]],[[12623,12623],"mapped",[4449]],[[12624,12624],"mapped",[4450]],[[12625,12625],"mapped",[4451]],[[12626,12626],"mapped",[4452]],[[12627,12627],"mapped",[4453]],[[12628,12628],"mapped",[4454]],[[12629,12629],"mapped",[4455]],[[12630,12630],"mapped",[4456]],[[12631,12631],"mapped",[4457]],[[12632,12632],"mapped",[4458]],[[12633,12633],"mapped",[4459]],[[12634,12634],"mapped",[4460]],[[12635,12635],"mapped",[4461]],[[12636,12636],"mapped",[4462]],[[12637,12637],"mapped",[4463]],[[12638,12638],"mapped",[4464]],[[12639,12639],"mapped",[4465]],[[12640,12640],"mapped",[4466]],[[12641,12641],"mapped",[4467]],[[12642,12642],"mapped",[4468]],[[12643,12643],"mapped",[4469]],[[12644,12644],"disallowed"],[[12645,12645],"mapped",[4372]],[[12646,12646],"mapped",[4373]],[[12647,12647],"mapped",[4551]],[[12648,12648],"mapped",[4552]],[[12649,12649],"mapped",[4556]],[[12650,12650],"mapped",[4558]],[[12651,12651],"mapped",[4563]],[[12652,12652],"mapped",[4567]],[[12653,12653],"mapped",[4569]],[[12654,12654],"mapped",[4380]],[[12655,12655],"mapped",[4573]],[[12656,12656],"mapped",[4575]],[[12657,12657],"mapped",[4381]],[[12658,12658],"mapped",[4382]],[[12659,12659],"mapped",[4384]],[[12660,12660],"mapped",[4386]],[[12661,12661],"mapped",[4387]],[[12662,12662],"mapped",[4391]],[[12663,12663],"mapped",[4393]],[[12664,12664],"mapped",[4395]],[[12665,12665],"mapped",[4396]],[[12666,12666],"mapped",[4397]],[[12667,12667],"mapped",[4398]],[[12668,12668],"mapped",[4399]],[[12669,12669],"mapped",[4402]],[[12670,12670],"mapped",[4406]],[[12671,12671],"mapped",[4416]],[[12672,12672],"mapped",[4423]],[[12673,12673],"mapped",[4428]],[[12674,12674],"mapped",[4593]],[[12675,12675],"mapped",[4594]],[[12676,12676],"mapped",[4439]],[[12677,12677],"mapped",[4440]],[[12678,12678],"mapped",[4441]],[[12679,12679],"mapped",[4484]],[[12680,12680],"mapped",[4485]],[[12681,12681],"mapped",[4488]],[[12682,12682],"mapped",[4497]],[[12683,12683],"mapped",[4498]],[[12684,12684],"mapped",[4500]],[[12685,12685],"mapped",[4510]],[[12686,12686],"mapped",[4513]],[[12687,12687],"disallowed"],[[12688,12689],"valid",[],"NV8"],[[12690,12690],"mapped",[19968]],[[12691,12691],"mapped",[20108]],[[12692,12692],"mapped",[19977]],[[12693,12693],"mapped",[22235]],[[12694,12694],"mapped",[19978]],[[12695,12695],"mapped",[20013]],[[12696,12696],"mapped",[19979]],[[12697,12697],"mapped",[30002]],[[12698,12698],"mapped",[20057]],[[12699,12699],"mapped",[19993]],[[12700,12700],"mapped",[19969]],[[12701,12701],"mapped",[22825]],[[12702,12702],"mapped",[22320]],[[12703,12703],"mapped",[20154]],[[12704,12727],"valid"],[[12728,12730],"valid"],[[12731,12735],"disallowed"],[[12736,12751],"valid",[],"NV8"],[[12752,12771],"valid",[],"NV8"],[[12772,12783],"disallowed"],[[12784,12799],"valid"],[[12800,12800],"disallowed_STD3_mapped",[40,4352,41]],[[12801,12801],"disallowed_STD3_mapped",[40,4354,41]],[[12802,12802],"disallowed_STD3_mapped",[40,4355,41]],[[12803,12803],"disallowed_STD3_mapped",[40,4357,41]],[[12804,12804],"disallowed_STD3_mapped",[40,4358,41]],[[12805,12805],"disallowed_STD3_mapped",[40,4359,41]],[[12806,12806],"disallowed_STD3_mapped",[40,4361,41]],[[12807,12807],"disallowed_STD3_mapped",[40,4363,41]],[[12808,12808],"disallowed_STD3_mapped",[40,4364,41]],[[12809,12809],"disallowed_STD3_mapped",[40,4366,41]],[[12810,12810],"disallowed_STD3_mapped",[40,4367,41]],[[12811,12811],"disallowed_STD3_mapped",[40,4368,41]],[[12812,12812],"disallowed_STD3_mapped",[40,4369,41]],[[12813,12813],"disallowed_STD3_mapped",[40,4370,41]],[[12814,12814],"disallowed_STD3_mapped",[40,44032,41]],[[12815,12815],"disallowed_STD3_mapped",[40,45208,41]],[[12816,12816],"disallowed_STD3_mapped",[40,45796,41]],[[12817,12817],"disallowed_STD3_mapped",[40,46972,41]],[[12818,12818],"disallowed_STD3_mapped",[40,47560,41]],[[12819,12819],"disallowed_STD3_mapped",[40,48148,41]],[[12820,12820],"disallowed_STD3_mapped",[40,49324,41]],[[12821,12821],"disallowed_STD3_mapped",[40,50500,41]],[[12822,12822],"disallowed_STD3_mapped",[40,51088,41]],[[12823,12823],"disallowed_STD3_mapped",[40,52264,41]],[[12824,12824],"disallowed_STD3_mapped",[40,52852,41]],[[12825,12825],"disallowed_STD3_mapped",[40,53440,41]],[[12826,12826],"disallowed_STD3_mapped",[40,54028,41]],[[12827,12827],"disallowed_STD3_mapped",[40,54616,41]],[[12828,12828],"disallowed_STD3_mapped",[40,51452,41]],[[12829,12829],"disallowed_STD3_mapped",[40,50724,51204,41]],[[12830,12830],"disallowed_STD3_mapped",[40,50724,54980,41]],[[12831,12831],"disallowed"],[[12832,12832],"disallowed_STD3_mapped",[40,19968,41]],[[12833,12833],"disallowed_STD3_mapped",[40,20108,41]],[[12834,12834],"disallowed_STD3_mapped",[40,19977,41]],[[12835,12835],"disallowed_STD3_mapped",[40,22235,41]],[[12836,12836],"disallowed_STD3_mapped",[40,20116,41]],[[12837,12837],"disallowed_STD3_mapped",[40,20845,41]],[[12838,12838],"disallowed_STD3_mapped",[40,19971,41]],[[12839,12839],"disallowed_STD3_mapped",[40,20843,41]],[[12840,12840],"disallowed_STD3_mapped",[40,20061,41]],[[12841,12841],"disallowed_STD3_mapped",[40,21313,41]],[[12842,12842],"disallowed_STD3_mapped",[40,26376,41]],[[12843,12843],"disallowed_STD3_mapped",[40,28779,41]],[[12844,12844],"disallowed_STD3_mapped",[40,27700,41]],[[12845,12845],"disallowed_STD3_mapped",[40,26408,41]],[[12846,12846],"disallowed_STD3_mapped",[40,37329,41]],[[12847,12847],"disallowed_STD3_mapped",[40,22303,41]],[[12848,12848],"disallowed_STD3_mapped",[40,26085,41]],[[12849,12849],"disallowed_STD3_mapped",[40,26666,41]],[[12850,12850],"disallowed_STD3_mapped",[40,26377,41]],[[12851,12851],"disallowed_STD3_mapped",[40,31038,41]],[[12852,12852],"disallowed_STD3_mapped",[40,21517,41]],[[12853,12853],"disallowed_STD3_mapped",[40,29305,41]],[[12854,12854],"disallowed_STD3_mapped",[40,36001,41]],[[12855,12855],"disallowed_STD3_mapped",[40,31069,41]],[[12856,12856],"disallowed_STD3_mapped",[40,21172,41]],[[12857,12857],"disallowed_STD3_mapped",[40,20195,41]],[[12858,12858],"disallowed_STD3_mapped",[40,21628,41]],[[12859,12859],"disallowed_STD3_mapped",[40,23398,41]],[[12860,12860],"disallowed_STD3_mapped",[40,30435,41]],[[12861,12861],"disallowed_STD3_mapped",[40,20225,41]],[[12862,12862],"disallowed_STD3_mapped",[40,36039,41]],[[12863,12863],"disallowed_STD3_mapped",[40,21332,41]],[[12864,12864],"disallowed_STD3_mapped",[40,31085,41]],[[12865,12865],"disallowed_STD3_mapped",[40,20241,41]],[[12866,12866],"disallowed_STD3_mapped",[40,33258,41]],[[12867,12867],"disallowed_STD3_mapped",[40,33267,41]],[[12868,12868],"mapped",[21839]],[[12869,12869],"mapped",[24188]],[[12870,12870],"mapped",[25991]],[[12871,12871],"mapped",[31631]],[[12872,12879],"valid",[],"NV8"],[[12880,12880],"mapped",[112,116,101]],[[12881,12881],"mapped",[50,49]],[[12882,12882],"mapped",[50,50]],[[12883,12883],"mapped",[50,51]],[[12884,12884],"mapped",[50,52]],[[12885,12885],"mapped",[50,53]],[[12886,12886],"mapped",[50,54]],[[12887,12887],"mapped",[50,55]],[[12888,12888],"mapped",[50,56]],[[12889,12889],"mapped",[50,57]],[[12890,12890],"mapped",[51,48]],[[12891,12891],"mapped",[51,49]],[[12892,12892],"mapped",[51,50]],[[12893,12893],"mapped",[51,51]],[[12894,12894],"mapped",[51,52]],[[12895,12895],"mapped",[51,53]],[[12896,12896],"mapped",[4352]],[[12897,12897],"mapped",[4354]],[[12898,12898],"mapped",[4355]],[[12899,12899],"mapped",[4357]],[[12900,12900],"mapped",[4358]],[[12901,12901],"mapped",[4359]],[[12902,12902],"mapped",[4361]],[[12903,12903],"mapped",[4363]],[[12904,12904],"mapped",[4364]],[[12905,12905],"mapped",[4366]],[[12906,12906],"mapped",[4367]],[[12907,12907],"mapped",[4368]],[[12908,12908],"mapped",[4369]],[[12909,12909],"mapped",[4370]],[[12910,12910],"mapped",[44032]],[[12911,12911],"mapped",[45208]],[[12912,12912],"mapped",[45796]],[[12913,12913],"mapped",[46972]],[[12914,12914],"mapped",[47560]],[[12915,12915],"mapped",[48148]],[[12916,12916],"mapped",[49324]],[[12917,12917],"mapped",[50500]],[[12918,12918],"mapped",[51088]],[[12919,12919],"mapped",[52264]],[[12920,12920],"mapped",[52852]],[[12921,12921],"mapped",[53440]],[[12922,12922],"mapped",[54028]],[[12923,12923],"mapped",[54616]],[[12924,12924],"mapped",[52280,44256]],[[12925,12925],"mapped",[51452,51032]],[[12926,12926],"mapped",[50864]],[[12927,12927],"valid",[],"NV8"],[[12928,12928],"mapped",[19968]],[[12929,12929],"mapped",[20108]],[[12930,12930],"mapped",[19977]],[[12931,12931],"mapped",[22235]],[[12932,12932],"mapped",[20116]],[[12933,12933],"mapped",[20845]],[[12934,12934],"mapped",[19971]],[[12935,12935],"mapped",[20843]],[[12936,12936],"mapped",[20061]],[[12937,12937],"mapped",[21313]],[[12938,12938],"mapped",[26376]],[[12939,12939],"mapped",[28779]],[[12940,12940],"mapped",[27700]],[[12941,12941],"mapped",[26408]],[[12942,12942],"mapped",[37329]],[[12943,12943],"mapped",[22303]],[[12944,12944],"mapped",[26085]],[[12945,12945],"mapped",[26666]],[[12946,12946],"mapped",[26377]],[[12947,12947],"mapped",[31038]],[[12948,12948],"mapped",[21517]],[[12949,12949],"mapped",[29305]],[[12950,12950],"mapped",[36001]],[[12951,12951],"mapped",[31069]],[[12952,12952],"mapped",[21172]],[[12953,12953],"mapped",[31192]],[[12954,12954],"mapped",[30007]],[[12955,12955],"mapped",[22899]],[[12956,12956],"mapped",[36969]],[[12957,12957],"mapped",[20778]],[[12958,12958],"mapped",[21360]],[[12959,12959],"mapped",[27880]],[[12960,12960],"mapped",[38917]],[[12961,12961],"mapped",[20241]],[[12962,12962],"mapped",[20889]],[[12963,12963],"mapped",[27491]],[[12964,12964],"mapped",[19978]],[[12965,12965],"mapped",[20013]],[[12966,12966],"mapped",[19979]],[[12967,12967],"mapped",[24038]],[[12968,12968],"mapped",[21491]],[[12969,12969],"mapped",[21307]],[[12970,12970],"mapped",[23447]],[[12971,12971],"mapped",[23398]],[[12972,12972],"mapped",[30435]],[[12973,12973],"mapped",[20225]],[[12974,12974],"mapped",[36039]],[[12975,12975],"mapped",[21332]],[[12976,12976],"mapped",[22812]],[[12977,12977],"mapped",[51,54]],[[12978,12978],"mapped",[51,55]],[[12979,12979],"mapped",[51,56]],[[12980,12980],"mapped",[51,57]],[[12981,12981],"mapped",[52,48]],[[12982,12982],"mapped",[52,49]],[[12983,12983],"mapped",[52,50]],[[12984,12984],"mapped",[52,51]],[[12985,12985],"mapped",[52,52]],[[12986,12986],"mapped",[52,53]],[[12987,12987],"mapped",[52,54]],[[12988,12988],"mapped",[52,55]],[[12989,12989],"mapped",[52,56]],[[12990,12990],"mapped",[52,57]],[[12991,12991],"mapped",[53,48]],[[12992,12992],"mapped",[49,26376]],[[12993,12993],"mapped",[50,26376]],[[12994,12994],"mapped",[51,26376]],[[12995,12995],"mapped",[52,26376]],[[12996,12996],"mapped",[53,26376]],[[12997,12997],"mapped",[54,26376]],[[12998,12998],"mapped",[55,26376]],[[12999,12999],"mapped",[56,26376]],[[13e3,13e3],"mapped",[57,26376]],[[13001,13001],"mapped",[49,48,26376]],[[13002,13002],"mapped",[49,49,26376]],[[13003,13003],"mapped",[49,50,26376]],[[13004,13004],"mapped",[104,103]],[[13005,13005],"mapped",[101,114,103]],[[13006,13006],"mapped",[101,118]],[[13007,13007],"mapped",[108,116,100]],[[13008,13008],"mapped",[12450]],[[13009,13009],"mapped",[12452]],[[13010,13010],"mapped",[12454]],[[13011,13011],"mapped",[12456]],[[13012,13012],"mapped",[12458]],[[13013,13013],"mapped",[12459]],[[13014,13014],"mapped",[12461]],[[13015,13015],"mapped",[12463]],[[13016,13016],"mapped",[12465]],[[13017,13017],"mapped",[12467]],[[13018,13018],"mapped",[12469]],[[13019,13019],"mapped",[12471]],[[13020,13020],"mapped",[12473]],[[13021,13021],"mapped",[12475]],[[13022,13022],"mapped",[12477]],[[13023,13023],"mapped",[12479]],[[13024,13024],"mapped",[12481]],[[13025,13025],"mapped",[12484]],[[13026,13026],"mapped",[12486]],[[13027,13027],"mapped",[12488]],[[13028,13028],"mapped",[12490]],[[13029,13029],"mapped",[12491]],[[13030,13030],"mapped",[12492]],[[13031,13031],"mapped",[12493]],[[13032,13032],"mapped",[12494]],[[13033,13033],"mapped",[12495]],[[13034,13034],"mapped",[12498]],[[13035,13035],"mapped",[12501]],[[13036,13036],"mapped",[12504]],[[13037,13037],"mapped",[12507]],[[13038,13038],"mapped",[12510]],[[13039,13039],"mapped",[12511]],[[13040,13040],"mapped",[12512]],[[13041,13041],"mapped",[12513]],[[13042,13042],"mapped",[12514]],[[13043,13043],"mapped",[12516]],[[13044,13044],"mapped",[12518]],[[13045,13045],"mapped",[12520]],[[13046,13046],"mapped",[12521]],[[13047,13047],"mapped",[12522]],[[13048,13048],"mapped",[12523]],[[13049,13049],"mapped",[12524]],[[13050,13050],"mapped",[12525]],[[13051,13051],"mapped",[12527]],[[13052,13052],"mapped",[12528]],[[13053,13053],"mapped",[12529]],[[13054,13054],"mapped",[12530]],[[13055,13055],"disallowed"],[[13056,13056],"mapped",[12450,12497,12540,12488]],[[13057,13057],"mapped",[12450,12523,12501,12449]],[[13058,13058],"mapped",[12450,12531,12506,12450]],[[13059,13059],"mapped",[12450,12540,12523]],[[13060,13060],"mapped",[12452,12491,12531,12464]],[[13061,13061],"mapped",[12452,12531,12481]],[[13062,13062],"mapped",[12454,12457,12531]],[[13063,13063],"mapped",[12456,12473,12463,12540,12489]],[[13064,13064],"mapped",[12456,12540,12459,12540]],[[13065,13065],"mapped",[12458,12531,12473]],[[13066,13066],"mapped",[12458,12540,12512]],[[13067,13067],"mapped",[12459,12452,12522]],[[13068,13068],"mapped",[12459,12521,12483,12488]],[[13069,13069],"mapped",[12459,12525,12522,12540]],[[13070,13070],"mapped",[12460,12525,12531]],[[13071,13071],"mapped",[12460,12531,12510]],[[13072,13072],"mapped",[12462,12460]],[[13073,13073],"mapped",[12462,12491,12540]],[[13074,13074],"mapped",[12461,12517,12522,12540]],[[13075,13075],"mapped",[12462,12523,12480,12540]],[[13076,13076],"mapped",[12461,12525]],[[13077,13077],"mapped",[12461,12525,12464,12521,12512]],[[13078,13078],"mapped",[12461,12525,12513,12540,12488,12523]],[[13079,13079],"mapped",[12461,12525,12527,12483,12488]],[[13080,13080],"mapped",[12464,12521,12512]],[[13081,13081],"mapped",[12464,12521,12512,12488,12531]],[[13082,13082],"mapped",[12463,12523,12476,12452,12525]],[[13083,13083],"mapped",[12463,12525,12540,12493]],[[13084,13084],"mapped",[12465,12540,12473]],[[13085,13085],"mapped",[12467,12523,12490]],[[13086,13086],"mapped",[12467,12540,12509]],[[13087,13087],"mapped",[12469,12452,12463,12523]],[[13088,13088],"mapped",[12469,12531,12481,12540,12512]],[[13089,13089],"mapped",[12471,12522,12531,12464]],[[13090,13090],"mapped",[12475,12531,12481]],[[13091,13091],"mapped",[12475,12531,12488]],[[13092,13092],"mapped",[12480,12540,12473]],[[13093,13093],"mapped",[12487,12471]],[[13094,13094],"mapped",[12489,12523]],[[13095,13095],"mapped",[12488,12531]],[[13096,13096],"mapped",[12490,12494]],[[13097,13097],"mapped",[12494,12483,12488]],[[13098,13098],"mapped",[12495,12452,12484]],[[13099,13099],"mapped",[12497,12540,12475,12531,12488]],[[13100,13100],"mapped",[12497,12540,12484]],[[13101,13101],"mapped",[12496,12540,12524,12523]],[[13102,13102],"mapped",[12500,12450,12473,12488,12523]],[[13103,13103],"mapped",[12500,12463,12523]],[[13104,13104],"mapped",[12500,12467]],[[13105,13105],"mapped",[12499,12523]],[[13106,13106],"mapped",[12501,12449,12521,12483,12489]],[[13107,13107],"mapped",[12501,12451,12540,12488]],[[13108,13108],"mapped",[12502,12483,12471,12455,12523]],[[13109,13109],"mapped",[12501,12521,12531]],[[13110,13110],"mapped",[12504,12463,12479,12540,12523]],[[13111,13111],"mapped",[12506,12477]],[[13112,13112],"mapped",[12506,12491,12498]],[[13113,13113],"mapped",[12504,12523,12484]],[[13114,13114],"mapped",[12506,12531,12473]],[[13115,13115],"mapped",[12506,12540,12472]],[[13116,13116],"mapped",[12505,12540,12479]],[[13117,13117],"mapped",[12509,12452,12531,12488]],[[13118,13118],"mapped",[12508,12523,12488]],[[13119,13119],"mapped",[12507,12531]],[[13120,13120],"mapped",[12509,12531,12489]],[[13121,13121],"mapped",[12507,12540,12523]],[[13122,13122],"mapped",[12507,12540,12531]],[[13123,13123],"mapped",[12510,12452,12463,12525]],[[13124,13124],"mapped",[12510,12452,12523]],[[13125,13125],"mapped",[12510,12483,12495]],[[13126,13126],"mapped",[12510,12523,12463]],[[13127,13127],"mapped",[12510,12531,12471,12519,12531]],[[13128,13128],"mapped",[12511,12463,12525,12531]],[[13129,13129],"mapped",[12511,12522]],[[13130,13130],"mapped",[12511,12522,12496,12540,12523]],[[13131,13131],"mapped",[12513,12460]],[[13132,13132],"mapped",[12513,12460,12488,12531]],[[13133,13133],"mapped",[12513,12540,12488,12523]],[[13134,13134],"mapped",[12516,12540,12489]],[[13135,13135],"mapped",[12516,12540,12523]],[[13136,13136],"mapped",[12518,12450,12531]],[[13137,13137],"mapped",[12522,12483,12488,12523]],[[13138,13138],"mapped",[12522,12521]],[[13139,13139],"mapped",[12523,12500,12540]],[[13140,13140],"mapped",[12523,12540,12502,12523]],[[13141,13141],"mapped",[12524,12512]],[[13142,13142],"mapped",[12524,12531,12488,12466,12531]],[[13143,13143],"mapped",[12527,12483,12488]],[[13144,13144],"mapped",[48,28857]],[[13145,13145],"mapped",[49,28857]],[[13146,13146],"mapped",[50,28857]],[[13147,13147],"mapped",[51,28857]],[[13148,13148],"mapped",[52,28857]],[[13149,13149],"mapped",[53,28857]],[[13150,13150],"mapped",[54,28857]],[[13151,13151],"mapped",[55,28857]],[[13152,13152],"mapped",[56,28857]],[[13153,13153],"mapped",[57,28857]],[[13154,13154],"mapped",[49,48,28857]],[[13155,13155],"mapped",[49,49,28857]],[[13156,13156],"mapped",[49,50,28857]],[[13157,13157],"mapped",[49,51,28857]],[[13158,13158],"mapped",[49,52,28857]],[[13159,13159],"mapped",[49,53,28857]],[[13160,13160],"mapped",[49,54,28857]],[[13161,13161],"mapped",[49,55,28857]],[[13162,13162],"mapped",[49,56,28857]],[[13163,13163],"mapped",[49,57,28857]],[[13164,13164],"mapped",[50,48,28857]],[[13165,13165],"mapped",[50,49,28857]],[[13166,13166],"mapped",[50,50,28857]],[[13167,13167],"mapped",[50,51,28857]],[[13168,13168],"mapped",[50,52,28857]],[[13169,13169],"mapped",[104,112,97]],[[13170,13170],"mapped",[100,97]],[[13171,13171],"mapped",[97,117]],[[13172,13172],"mapped",[98,97,114]],[[13173,13173],"mapped",[111,118]],[[13174,13174],"mapped",[112,99]],[[13175,13175],"mapped",[100,109]],[[13176,13176],"mapped",[100,109,50]],[[13177,13177],"mapped",[100,109,51]],[[13178,13178],"mapped",[105,117]],[[13179,13179],"mapped",[24179,25104]],[[13180,13180],"mapped",[26157,21644]],[[13181,13181],"mapped",[22823,27491]],[[13182,13182],"mapped",[26126,27835]],[[13183,13183],"mapped",[26666,24335,20250,31038]],[[13184,13184],"mapped",[112,97]],[[13185,13185],"mapped",[110,97]],[[13186,13186],"mapped",[956,97]],[[13187,13187],"mapped",[109,97]],[[13188,13188],"mapped",[107,97]],[[13189,13189],"mapped",[107,98]],[[13190,13190],"mapped",[109,98]],[[13191,13191],"mapped",[103,98]],[[13192,13192],"mapped",[99,97,108]],[[13193,13193],"mapped",[107,99,97,108]],[[13194,13194],"mapped",[112,102]],[[13195,13195],"mapped",[110,102]],[[13196,13196],"mapped",[956,102]],[[13197,13197],"mapped",[956,103]],[[13198,13198],"mapped",[109,103]],[[13199,13199],"mapped",[107,103]],[[13200,13200],"mapped",[104,122]],[[13201,13201],"mapped",[107,104,122]],[[13202,13202],"mapped",[109,104,122]],[[13203,13203],"mapped",[103,104,122]],[[13204,13204],"mapped",[116,104,122]],[[13205,13205],"mapped",[956,108]],[[13206,13206],"mapped",[109,108]],[[13207,13207],"mapped",[100,108]],[[13208,13208],"mapped",[107,108]],[[13209,13209],"mapped",[102,109]],[[13210,13210],"mapped",[110,109]],[[13211,13211],"mapped",[956,109]],[[13212,13212],"mapped",[109,109]],[[13213,13213],"mapped",[99,109]],[[13214,13214],"mapped",[107,109]],[[13215,13215],"mapped",[109,109,50]],[[13216,13216],"mapped",[99,109,50]],[[13217,13217],"mapped",[109,50]],[[13218,13218],"mapped",[107,109,50]],[[13219,13219],"mapped",[109,109,51]],[[13220,13220],"mapped",[99,109,51]],[[13221,13221],"mapped",[109,51]],[[13222,13222],"mapped",[107,109,51]],[[13223,13223],"mapped",[109,8725,115]],[[13224,13224],"mapped",[109,8725,115,50]],[[13225,13225],"mapped",[112,97]],[[13226,13226],"mapped",[107,112,97]],[[13227,13227],"mapped",[109,112,97]],[[13228,13228],"mapped",[103,112,97]],[[13229,13229],"mapped",[114,97,100]],[[13230,13230],"mapped",[114,97,100,8725,115]],[[13231,13231],"mapped",[114,97,100,8725,115,50]],[[13232,13232],"mapped",[112,115]],[[13233,13233],"mapped",[110,115]],[[13234,13234],"mapped",[956,115]],[[13235,13235],"mapped",[109,115]],[[13236,13236],"mapped",[112,118]],[[13237,13237],"mapped",[110,118]],[[13238,13238],"mapped",[956,118]],[[13239,13239],"mapped",[109,118]],[[13240,13240],"mapped",[107,118]],[[13241,13241],"mapped",[109,118]],[[13242,13242],"mapped",[112,119]],[[13243,13243],"mapped",[110,119]],[[13244,13244],"mapped",[956,119]],[[13245,13245],"mapped",[109,119]],[[13246,13246],"mapped",[107,119]],[[13247,13247],"mapped",[109,119]],[[13248,13248],"mapped",[107,969]],[[13249,13249],"mapped",[109,969]],[[13250,13250],"disallowed"],[[13251,13251],"mapped",[98,113]],[[13252,13252],"mapped",[99,99]],[[13253,13253],"mapped",[99,100]],[[13254,13254],"mapped",[99,8725,107,103]],[[13255,13255],"disallowed"],[[13256,13256],"mapped",[100,98]],[[13257,13257],"mapped",[103,121]],[[13258,13258],"mapped",[104,97]],[[13259,13259],"mapped",[104,112]],[[13260,13260],"mapped",[105,110]],[[13261,13261],"mapped",[107,107]],[[13262,13262],"mapped",[107,109]],[[13263,13263],"mapped",[107,116]],[[13264,13264],"mapped",[108,109]],[[13265,13265],"mapped",[108,110]],[[13266,13266],"mapped",[108,111,103]],[[13267,13267],"mapped",[108,120]],[[13268,13268],"mapped",[109,98]],[[13269,13269],"mapped",[109,105,108]],[[13270,13270],"mapped",[109,111,108]],[[13271,13271],"mapped",[112,104]],[[13272,13272],"disallowed"],[[13273,13273],"mapped",[112,112,109]],[[13274,13274],"mapped",[112,114]],[[13275,13275],"mapped",[115,114]],[[13276,13276],"mapped",[115,118]],[[13277,13277],"mapped",[119,98]],[[13278,13278],"mapped",[118,8725,109]],[[13279,13279],"mapped",[97,8725,109]],[[13280,13280],"mapped",[49,26085]],[[13281,13281],"mapped",[50,26085]],[[13282,13282],"mapped",[51,26085]],[[13283,13283],"mapped",[52,26085]],[[13284,13284],"mapped",[53,26085]],[[13285,13285],"mapped",[54,26085]],[[13286,13286],"mapped",[55,26085]],[[13287,13287],"mapped",[56,26085]],[[13288,13288],"mapped",[57,26085]],[[13289,13289],"mapped",[49,48,26085]],[[13290,13290],"mapped",[49,49,26085]],[[13291,13291],"mapped",[49,50,26085]],[[13292,13292],"mapped",[49,51,26085]],[[13293,13293],"mapped",[49,52,26085]],[[13294,13294],"mapped",[49,53,26085]],[[13295,13295],"mapped",[49,54,26085]],[[13296,13296],"mapped",[49,55,26085]],[[13297,13297],"mapped",[49,56,26085]],[[13298,13298],"mapped",[49,57,26085]],[[13299,13299],"mapped",[50,48,26085]],[[13300,13300],"mapped",[50,49,26085]],[[13301,13301],"mapped",[50,50,26085]],[[13302,13302],"mapped",[50,51,26085]],[[13303,13303],"mapped",[50,52,26085]],[[13304,13304],"mapped",[50,53,26085]],[[13305,13305],"mapped",[50,54,26085]],[[13306,13306],"mapped",[50,55,26085]],[[13307,13307],"mapped",[50,56,26085]],[[13308,13308],"mapped",[50,57,26085]],[[13309,13309],"mapped",[51,48,26085]],[[13310,13310],"mapped",[51,49,26085]],[[13311,13311],"mapped",[103,97,108]],[[13312,19893],"valid"],[[19894,19903],"disallowed"],[[19904,19967],"valid",[],"NV8"],[[19968,40869],"valid"],[[40870,40891],"valid"],[[40892,40899],"valid"],[[40900,40907],"valid"],[[40908,40908],"valid"],[[40909,40917],"valid"],[[40918,40959],"disallowed"],[[40960,42124],"valid"],[[42125,42127],"disallowed"],[[42128,42145],"valid",[],"NV8"],[[42146,42147],"valid",[],"NV8"],[[42148,42163],"valid",[],"NV8"],[[42164,42164],"valid",[],"NV8"],[[42165,42176],"valid",[],"NV8"],[[42177,42177],"valid",[],"NV8"],[[42178,42180],"valid",[],"NV8"],[[42181,42181],"valid",[],"NV8"],[[42182,42182],"valid",[],"NV8"],[[42183,42191],"disallowed"],[[42192,42237],"valid"],[[42238,42239],"valid",[],"NV8"],[[42240,42508],"valid"],[[42509,42511],"valid",[],"NV8"],[[42512,42539],"valid"],[[42540,42559],"disallowed"],[[42560,42560],"mapped",[42561]],[[42561,42561],"valid"],[[42562,42562],"mapped",[42563]],[[42563,42563],"valid"],[[42564,42564],"mapped",[42565]],[[42565,42565],"valid"],[[42566,42566],"mapped",[42567]],[[42567,42567],"valid"],[[42568,42568],"mapped",[42569]],[[42569,42569],"valid"],[[42570,42570],"mapped",[42571]],[[42571,42571],"valid"],[[42572,42572],"mapped",[42573]],[[42573,42573],"valid"],[[42574,42574],"mapped",[42575]],[[42575,42575],"valid"],[[42576,42576],"mapped",[42577]],[[42577,42577],"valid"],[[42578,42578],"mapped",[42579]],[[42579,42579],"valid"],[[42580,42580],"mapped",[42581]],[[42581,42581],"valid"],[[42582,42582],"mapped",[42583]],[[42583,42583],"valid"],[[42584,42584],"mapped",[42585]],[[42585,42585],"valid"],[[42586,42586],"mapped",[42587]],[[42587,42587],"valid"],[[42588,42588],"mapped",[42589]],[[42589,42589],"valid"],[[42590,42590],"mapped",[42591]],[[42591,42591],"valid"],[[42592,42592],"mapped",[42593]],[[42593,42593],"valid"],[[42594,42594],"mapped",[42595]],[[42595,42595],"valid"],[[42596,42596],"mapped",[42597]],[[42597,42597],"valid"],[[42598,42598],"mapped",[42599]],[[42599,42599],"valid"],[[42600,42600],"mapped",[42601]],[[42601,42601],"valid"],[[42602,42602],"mapped",[42603]],[[42603,42603],"valid"],[[42604,42604],"mapped",[42605]],[[42605,42607],"valid"],[[42608,42611],"valid",[],"NV8"],[[42612,42619],"valid"],[[42620,42621],"valid"],[[42622,42622],"valid",[],"NV8"],[[42623,42623],"valid"],[[42624,42624],"mapped",[42625]],[[42625,42625],"valid"],[[42626,42626],"mapped",[42627]],[[42627,42627],"valid"],[[42628,42628],"mapped",[42629]],[[42629,42629],"valid"],[[42630,42630],"mapped",[42631]],[[42631,42631],"valid"],[[42632,42632],"mapped",[42633]],[[42633,42633],"valid"],[[42634,42634],"mapped",[42635]],[[42635,42635],"valid"],[[42636,42636],"mapped",[42637]],[[42637,42637],"valid"],[[42638,42638],"mapped",[42639]],[[42639,42639],"valid"],[[42640,42640],"mapped",[42641]],[[42641,42641],"valid"],[[42642,42642],"mapped",[42643]],[[42643,42643],"valid"],[[42644,42644],"mapped",[42645]],[[42645,42645],"valid"],[[42646,42646],"mapped",[42647]],[[42647,42647],"valid"],[[42648,42648],"mapped",[42649]],[[42649,42649],"valid"],[[42650,42650],"mapped",[42651]],[[42651,42651],"valid"],[[42652,42652],"mapped",[1098]],[[42653,42653],"mapped",[1100]],[[42654,42654],"valid"],[[42655,42655],"valid"],[[42656,42725],"valid"],[[42726,42735],"valid",[],"NV8"],[[42736,42737],"valid"],[[42738,42743],"valid",[],"NV8"],[[42744,42751],"disallowed"],[[42752,42774],"valid",[],"NV8"],[[42775,42778],"valid"],[[42779,42783],"valid"],[[42784,42785],"valid",[],"NV8"],[[42786,42786],"mapped",[42787]],[[42787,42787],"valid"],[[42788,42788],"mapped",[42789]],[[42789,42789],"valid"],[[42790,42790],"mapped",[42791]],[[42791,42791],"valid"],[[42792,42792],"mapped",[42793]],[[42793,42793],"valid"],[[42794,42794],"mapped",[42795]],[[42795,42795],"valid"],[[42796,42796],"mapped",[42797]],[[42797,42797],"valid"],[[42798,42798],"mapped",[42799]],[[42799,42801],"valid"],[[42802,42802],"mapped",[42803]],[[42803,42803],"valid"],[[42804,42804],"mapped",[42805]],[[42805,42805],"valid"],[[42806,42806],"mapped",[42807]],[[42807,42807],"valid"],[[42808,42808],"mapped",[42809]],[[42809,42809],"valid"],[[42810,42810],"mapped",[42811]],[[42811,42811],"valid"],[[42812,42812],"mapped",[42813]],[[42813,42813],"valid"],[[42814,42814],"mapped",[42815]],[[42815,42815],"valid"],[[42816,42816],"mapped",[42817]],[[42817,42817],"valid"],[[42818,42818],"mapped",[42819]],[[42819,42819],"valid"],[[42820,42820],"mapped",[42821]],[[42821,42821],"valid"],[[42822,42822],"mapped",[42823]],[[42823,42823],"valid"],[[42824,42824],"mapped",[42825]],[[42825,42825],"valid"],[[42826,42826],"mapped",[42827]],[[42827,42827],"valid"],[[42828,42828],"mapped",[42829]],[[42829,42829],"valid"],[[42830,42830],"mapped",[42831]],[[42831,42831],"valid"],[[42832,42832],"mapped",[42833]],[[42833,42833],"valid"],[[42834,42834],"mapped",[42835]],[[42835,42835],"valid"],[[42836,42836],"mapped",[42837]],[[42837,42837],"valid"],[[42838,42838],"mapped",[42839]],[[42839,42839],"valid"],[[42840,42840],"mapped",[42841]],[[42841,42841],"valid"],[[42842,42842],"mapped",[42843]],[[42843,42843],"valid"],[[42844,42844],"mapped",[42845]],[[42845,42845],"valid"],[[42846,42846],"mapped",[42847]],[[42847,42847],"valid"],[[42848,42848],"mapped",[42849]],[[42849,42849],"valid"],[[42850,42850],"mapped",[42851]],[[42851,42851],"valid"],[[42852,42852],"mapped",[42853]],[[42853,42853],"valid"],[[42854,42854],"mapped",[42855]],[[42855,42855],"valid"],[[42856,42856],"mapped",[42857]],[[42857,42857],"valid"],[[42858,42858],"mapped",[42859]],[[42859,42859],"valid"],[[42860,42860],"mapped",[42861]],[[42861,42861],"valid"],[[42862,42862],"mapped",[42863]],[[42863,42863],"valid"],[[42864,42864],"mapped",[42863]],[[42865,42872],"valid"],[[42873,42873],"mapped",[42874]],[[42874,42874],"valid"],[[42875,42875],"mapped",[42876]],[[42876,42876],"valid"],[[42877,42877],"mapped",[7545]],[[42878,42878],"mapped",[42879]],[[42879,42879],"valid"],[[42880,42880],"mapped",[42881]],[[42881,42881],"valid"],[[42882,42882],"mapped",[42883]],[[42883,42883],"valid"],[[42884,42884],"mapped",[42885]],[[42885,42885],"valid"],[[42886,42886],"mapped",[42887]],[[42887,42888],"valid"],[[42889,42890],"valid",[],"NV8"],[[42891,42891],"mapped",[42892]],[[42892,42892],"valid"],[[42893,42893],"mapped",[613]],[[42894,42894],"valid"],[[42895,42895],"valid"],[[42896,42896],"mapped",[42897]],[[42897,42897],"valid"],[[42898,42898],"mapped",[42899]],[[42899,42899],"valid"],[[42900,42901],"valid"],[[42902,42902],"mapped",[42903]],[[42903,42903],"valid"],[[42904,42904],"mapped",[42905]],[[42905,42905],"valid"],[[42906,42906],"mapped",[42907]],[[42907,42907],"valid"],[[42908,42908],"mapped",[42909]],[[42909,42909],"valid"],[[42910,42910],"mapped",[42911]],[[42911,42911],"valid"],[[42912,42912],"mapped",[42913]],[[42913,42913],"valid"],[[42914,42914],"mapped",[42915]],[[42915,42915],"valid"],[[42916,42916],"mapped",[42917]],[[42917,42917],"valid"],[[42918,42918],"mapped",[42919]],[[42919,42919],"valid"],[[42920,42920],"mapped",[42921]],[[42921,42921],"valid"],[[42922,42922],"mapped",[614]],[[42923,42923],"mapped",[604]],[[42924,42924],"mapped",[609]],[[42925,42925],"mapped",[620]],[[42926,42927],"disallowed"],[[42928,42928],"mapped",[670]],[[42929,42929],"mapped",[647]],[[42930,42930],"mapped",[669]],[[42931,42931],"mapped",[43859]],[[42932,42932],"mapped",[42933]],[[42933,42933],"valid"],[[42934,42934],"mapped",[42935]],[[42935,42935],"valid"],[[42936,42998],"disallowed"],[[42999,42999],"valid"],[[43e3,43e3],"mapped",[295]],[[43001,43001],"mapped",[339]],[[43002,43002],"valid"],[[43003,43007],"valid"],[[43008,43047],"valid"],[[43048,43051],"valid",[],"NV8"],[[43052,43055],"disallowed"],[[43056,43065],"valid",[],"NV8"],[[43066,43071],"disallowed"],[[43072,43123],"valid"],[[43124,43127],"valid",[],"NV8"],[[43128,43135],"disallowed"],[[43136,43204],"valid"],[[43205,43213],"disallowed"],[[43214,43215],"valid",[],"NV8"],[[43216,43225],"valid"],[[43226,43231],"disallowed"],[[43232,43255],"valid"],[[43256,43258],"valid",[],"NV8"],[[43259,43259],"valid"],[[43260,43260],"valid",[],"NV8"],[[43261,43261],"valid"],[[43262,43263],"disallowed"],[[43264,43309],"valid"],[[43310,43311],"valid",[],"NV8"],[[43312,43347],"valid"],[[43348,43358],"disallowed"],[[43359,43359],"valid",[],"NV8"],[[43360,43388],"valid",[],"NV8"],[[43389,43391],"disallowed"],[[43392,43456],"valid"],[[43457,43469],"valid",[],"NV8"],[[43470,43470],"disallowed"],[[43471,43481],"valid"],[[43482,43485],"disallowed"],[[43486,43487],"valid",[],"NV8"],[[43488,43518],"valid"],[[43519,43519],"disallowed"],[[43520,43574],"valid"],[[43575,43583],"disallowed"],[[43584,43597],"valid"],[[43598,43599],"disallowed"],[[43600,43609],"valid"],[[43610,43611],"disallowed"],[[43612,43615],"valid",[],"NV8"],[[43616,43638],"valid"],[[43639,43641],"valid",[],"NV8"],[[43642,43643],"valid"],[[43644,43647],"valid"],[[43648,43714],"valid"],[[43715,43738],"disallowed"],[[43739,43741],"valid"],[[43742,43743],"valid",[],"NV8"],[[43744,43759],"valid"],[[43760,43761],"valid",[],"NV8"],[[43762,43766],"valid"],[[43767,43776],"disallowed"],[[43777,43782],"valid"],[[43783,43784],"disallowed"],[[43785,43790],"valid"],[[43791,43792],"disallowed"],[[43793,43798],"valid"],[[43799,43807],"disallowed"],[[43808,43814],"valid"],[[43815,43815],"disallowed"],[[43816,43822],"valid"],[[43823,43823],"disallowed"],[[43824,43866],"valid"],[[43867,43867],"valid",[],"NV8"],[[43868,43868],"mapped",[42791]],[[43869,43869],"mapped",[43831]],[[43870,43870],"mapped",[619]],[[43871,43871],"mapped",[43858]],[[43872,43875],"valid"],[[43876,43877],"valid"],[[43878,43887],"disallowed"],[[43888,43888],"mapped",[5024]],[[43889,43889],"mapped",[5025]],[[43890,43890],"mapped",[5026]],[[43891,43891],"mapped",[5027]],[[43892,43892],"mapped",[5028]],[[43893,43893],"mapped",[5029]],[[43894,43894],"mapped",[5030]],[[43895,43895],"mapped",[5031]],[[43896,43896],"mapped",[5032]],[[43897,43897],"mapped",[5033]],[[43898,43898],"mapped",[5034]],[[43899,43899],"mapped",[5035]],[[43900,43900],"mapped",[5036]],[[43901,43901],"mapped",[5037]],[[43902,43902],"mapped",[5038]],[[43903,43903],"mapped",[5039]],[[43904,43904],"mapped",[5040]],[[43905,43905],"mapped",[5041]],[[43906,43906],"mapped",[5042]],[[43907,43907],"mapped",[5043]],[[43908,43908],"mapped",[5044]],[[43909,43909],"mapped",[5045]],[[43910,43910],"mapped",[5046]],[[43911,43911],"mapped",[5047]],[[43912,43912],"mapped",[5048]],[[43913,43913],"mapped",[5049]],[[43914,43914],"mapped",[5050]],[[43915,43915],"mapped",[5051]],[[43916,43916],"mapped",[5052]],[[43917,43917],"mapped",[5053]],[[43918,43918],"mapped",[5054]],[[43919,43919],"mapped",[5055]],[[43920,43920],"mapped",[5056]],[[43921,43921],"mapped",[5057]],[[43922,43922],"mapped",[5058]],[[43923,43923],"mapped",[5059]],[[43924,43924],"mapped",[5060]],[[43925,43925],"mapped",[5061]],[[43926,43926],"mapped",[5062]],[[43927,43927],"mapped",[5063]],[[43928,43928],"mapped",[5064]],[[43929,43929],"mapped",[5065]],[[43930,43930],"mapped",[5066]],[[43931,43931],"mapped",[5067]],[[43932,43932],"mapped",[5068]],[[43933,43933],"mapped",[5069]],[[43934,43934],"mapped",[5070]],[[43935,43935],"mapped",[5071]],[[43936,43936],"mapped",[5072]],[[43937,43937],"mapped",[5073]],[[43938,43938],"mapped",[5074]],[[43939,43939],"mapped",[5075]],[[43940,43940],"mapped",[5076]],[[43941,43941],"mapped",[5077]],[[43942,43942],"mapped",[5078]],[[43943,43943],"mapped",[5079]],[[43944,43944],"mapped",[5080]],[[43945,43945],"mapped",[5081]],[[43946,43946],"mapped",[5082]],[[43947,43947],"mapped",[5083]],[[43948,43948],"mapped",[5084]],[[43949,43949],"mapped",[5085]],[[43950,43950],"mapped",[5086]],[[43951,43951],"mapped",[5087]],[[43952,43952],"mapped",[5088]],[[43953,43953],"mapped",[5089]],[[43954,43954],"mapped",[5090]],[[43955,43955],"mapped",[5091]],[[43956,43956],"mapped",[5092]],[[43957,43957],"mapped",[5093]],[[43958,43958],"mapped",[5094]],[[43959,43959],"mapped",[5095]],[[43960,43960],"mapped",[5096]],[[43961,43961],"mapped",[5097]],[[43962,43962],"mapped",[5098]],[[43963,43963],"mapped",[5099]],[[43964,43964],"mapped",[5100]],[[43965,43965],"mapped",[5101]],[[43966,43966],"mapped",[5102]],[[43967,43967],"mapped",[5103]],[[43968,44010],"valid"],[[44011,44011],"valid",[],"NV8"],[[44012,44013],"valid"],[[44014,44015],"disallowed"],[[44016,44025],"valid"],[[44026,44031],"disallowed"],[[44032,55203],"valid"],[[55204,55215],"disallowed"],[[55216,55238],"valid",[],"NV8"],[[55239,55242],"disallowed"],[[55243,55291],"valid",[],"NV8"],[[55292,55295],"disallowed"],[[55296,57343],"disallowed"],[[57344,63743],"disallowed"],[[63744,63744],"mapped",[35912]],[[63745,63745],"mapped",[26356]],[[63746,63746],"mapped",[36554]],[[63747,63747],"mapped",[36040]],[[63748,63748],"mapped",[28369]],[[63749,63749],"mapped",[20018]],[[63750,63750],"mapped",[21477]],[[63751,63752],"mapped",[40860]],[[63753,63753],"mapped",[22865]],[[63754,63754],"mapped",[37329]],[[63755,63755],"mapped",[21895]],[[63756,63756],"mapped",[22856]],[[63757,63757],"mapped",[25078]],[[63758,63758],"mapped",[30313]],[[63759,63759],"mapped",[32645]],[[63760,63760],"mapped",[34367]],[[63761,63761],"mapped",[34746]],[[63762,63762],"mapped",[35064]],[[63763,63763],"mapped",[37007]],[[63764,63764],"mapped",[27138]],[[63765,63765],"mapped",[27931]],[[63766,63766],"mapped",[28889]],[[63767,63767],"mapped",[29662]],[[63768,63768],"mapped",[33853]],[[63769,63769],"mapped",[37226]],[[63770,63770],"mapped",[39409]],[[63771,63771],"mapped",[20098]],[[63772,63772],"mapped",[21365]],[[63773,63773],"mapped",[27396]],[[63774,63774],"mapped",[29211]],[[63775,63775],"mapped",[34349]],[[63776,63776],"mapped",[40478]],[[63777,63777],"mapped",[23888]],[[63778,63778],"mapped",[28651]],[[63779,63779],"mapped",[34253]],[[63780,63780],"mapped",[35172]],[[63781,63781],"mapped",[25289]],[[63782,63782],"mapped",[33240]],[[63783,63783],"mapped",[34847]],[[63784,63784],"mapped",[24266]],[[63785,63785],"mapped",[26391]],[[63786,63786],"mapped",[28010]],[[63787,63787],"mapped",[29436]],[[63788,63788],"mapped",[37070]],[[63789,63789],"mapped",[20358]],[[63790,63790],"mapped",[20919]],[[63791,63791],"mapped",[21214]],[[63792,63792],"mapped",[25796]],[[63793,63793],"mapped",[27347]],[[63794,63794],"mapped",[29200]],[[63795,63795],"mapped",[30439]],[[63796,63796],"mapped",[32769]],[[63797,63797],"mapped",[34310]],[[63798,63798],"mapped",[34396]],[[63799,63799],"mapped",[36335]],[[63800,63800],"mapped",[38706]],[[63801,63801],"mapped",[39791]],[[63802,63802],"mapped",[40442]],[[63803,63803],"mapped",[30860]],[[63804,63804],"mapped",[31103]],[[63805,63805],"mapped",[32160]],[[63806,63806],"mapped",[33737]],[[63807,63807],"mapped",[37636]],[[63808,63808],"mapped",[40575]],[[63809,63809],"mapped",[35542]],[[63810,63810],"mapped",[22751]],[[63811,63811],"mapped",[24324]],[[63812,63812],"mapped",[31840]],[[63813,63813],"mapped",[32894]],[[63814,63814],"mapped",[29282]],[[63815,63815],"mapped",[30922]],[[63816,63816],"mapped",[36034]],[[63817,63817],"mapped",[38647]],[[63818,63818],"mapped",[22744]],[[63819,63819],"mapped",[23650]],[[63820,63820],"mapped",[27155]],[[63821,63821],"mapped",[28122]],[[63822,63822],"mapped",[28431]],[[63823,63823],"mapped",[32047]],[[63824,63824],"mapped",[32311]],[[63825,63825],"mapped",[38475]],[[63826,63826],"mapped",[21202]],[[63827,63827],"mapped",[32907]],[[63828,63828],"mapped",[20956]],[[63829,63829],"mapped",[20940]],[[63830,63830],"mapped",[31260]],[[63831,63831],"mapped",[32190]],[[63832,63832],"mapped",[33777]],[[63833,63833],"mapped",[38517]],[[63834,63834],"mapped",[35712]],[[63835,63835],"mapped",[25295]],[[63836,63836],"mapped",[27138]],[[63837,63837],"mapped",[35582]],[[63838,63838],"mapped",[20025]],[[63839,63839],"mapped",[23527]],[[63840,63840],"mapped",[24594]],[[63841,63841],"mapped",[29575]],[[63842,63842],"mapped",[30064]],[[63843,63843],"mapped",[21271]],[[63844,63844],"mapped",[30971]],[[63845,63845],"mapped",[20415]],[[63846,63846],"mapped",[24489]],[[63847,63847],"mapped",[19981]],[[63848,63848],"mapped",[27852]],[[63849,63849],"mapped",[25976]],[[63850,63850],"mapped",[32034]],[[63851,63851],"mapped",[21443]],[[63852,63852],"mapped",[22622]],[[63853,63853],"mapped",[30465]],[[63854,63854],"mapped",[33865]],[[63855,63855],"mapped",[35498]],[[63856,63856],"mapped",[27578]],[[63857,63857],"mapped",[36784]],[[63858,63858],"mapped",[27784]],[[63859,63859],"mapped",[25342]],[[63860,63860],"mapped",[33509]],[[63861,63861],"mapped",[25504]],[[63862,63862],"mapped",[30053]],[[63863,63863],"mapped",[20142]],[[63864,63864],"mapped",[20841]],[[63865,63865],"mapped",[20937]],[[63866,63866],"mapped",[26753]],[[63867,63867],"mapped",[31975]],[[63868,63868],"mapped",[33391]],[[63869,63869],"mapped",[35538]],[[63870,63870],"mapped",[37327]],[[63871,63871],"mapped",[21237]],[[63872,63872],"mapped",[21570]],[[63873,63873],"mapped",[22899]],[[63874,63874],"mapped",[24300]],[[63875,63875],"mapped",[26053]],[[63876,63876],"mapped",[28670]],[[63877,63877],"mapped",[31018]],[[63878,63878],"mapped",[38317]],[[63879,63879],"mapped",[39530]],[[63880,63880],"mapped",[40599]],[[63881,63881],"mapped",[40654]],[[63882,63882],"mapped",[21147]],[[63883,63883],"mapped",[26310]],[[63884,63884],"mapped",[27511]],[[63885,63885],"mapped",[36706]],[[63886,63886],"mapped",[24180]],[[63887,63887],"mapped",[24976]],[[63888,63888],"mapped",[25088]],[[63889,63889],"mapped",[25754]],[[63890,63890],"mapped",[28451]],[[63891,63891],"mapped",[29001]],[[63892,63892],"mapped",[29833]],[[63893,63893],"mapped",[31178]],[[63894,63894],"mapped",[32244]],[[63895,63895],"mapped",[32879]],[[63896,63896],"mapped",[36646]],[[63897,63897],"mapped",[34030]],[[63898,63898],"mapped",[36899]],[[63899,63899],"mapped",[37706]],[[63900,63900],"mapped",[21015]],[[63901,63901],"mapped",[21155]],[[63902,63902],"mapped",[21693]],[[63903,63903],"mapped",[28872]],[[63904,63904],"mapped",[35010]],[[63905,63905],"mapped",[35498]],[[63906,63906],"mapped",[24265]],[[63907,63907],"mapped",[24565]],[[63908,63908],"mapped",[25467]],[[63909,63909],"mapped",[27566]],[[63910,63910],"mapped",[31806]],[[63911,63911],"mapped",[29557]],[[63912,63912],"mapped",[20196]],[[63913,63913],"mapped",[22265]],[[63914,63914],"mapped",[23527]],[[63915,63915],"mapped",[23994]],[[63916,63916],"mapped",[24604]],[[63917,63917],"mapped",[29618]],[[63918,63918],"mapped",[29801]],[[63919,63919],"mapped",[32666]],[[63920,63920],"mapped",[32838]],[[63921,63921],"mapped",[37428]],[[63922,63922],"mapped",[38646]],[[63923,63923],"mapped",[38728]],[[63924,63924],"mapped",[38936]],[[63925,63925],"mapped",[20363]],[[63926,63926],"mapped",[31150]],[[63927,63927],"mapped",[37300]],[[63928,63928],"mapped",[38584]],[[63929,63929],"mapped",[24801]],[[63930,63930],"mapped",[20102]],[[63931,63931],"mapped",[20698]],[[63932,63932],"mapped",[23534]],[[63933,63933],"mapped",[23615]],[[63934,63934],"mapped",[26009]],[[63935,63935],"mapped",[27138]],[[63936,63936],"mapped",[29134]],[[63937,63937],"mapped",[30274]],[[63938,63938],"mapped",[34044]],[[63939,63939],"mapped",[36988]],[[63940,63940],"mapped",[40845]],[[63941,63941],"mapped",[26248]],[[63942,63942],"mapped",[38446]],[[63943,63943],"mapped",[21129]],[[63944,63944],"mapped",[26491]],[[63945,63945],"mapped",[26611]],[[63946,63946],"mapped",[27969]],[[63947,63947],"mapped",[28316]],[[63948,63948],"mapped",[29705]],[[63949,63949],"mapped",[30041]],[[63950,63950],"mapped",[30827]],[[63951,63951],"mapped",[32016]],[[63952,63952],"mapped",[39006]],[[63953,63953],"mapped",[20845]],[[63954,63954],"mapped",[25134]],[[63955,63955],"mapped",[38520]],[[63956,63956],"mapped",[20523]],[[63957,63957],"mapped",[23833]],[[63958,63958],"mapped",[28138]],[[63959,63959],"mapped",[36650]],[[63960,63960],"mapped",[24459]],[[63961,63961],"mapped",[24900]],[[63962,63962],"mapped",[26647]],[[63963,63963],"mapped",[29575]],[[63964,63964],"mapped",[38534]],[[63965,63965],"mapped",[21033]],[[63966,63966],"mapped",[21519]],[[63967,63967],"mapped",[23653]],[[63968,63968],"mapped",[26131]],[[63969,63969],"mapped",[26446]],[[63970,63970],"mapped",[26792]],[[63971,63971],"mapped",[27877]],[[63972,63972],"mapped",[29702]],[[63973,63973],"mapped",[30178]],[[63974,63974],"mapped",[32633]],[[63975,63975],"mapped",[35023]],[[63976,63976],"mapped",[35041]],[[63977,63977],"mapped",[37324]],[[63978,63978],"mapped",[38626]],[[63979,63979],"mapped",[21311]],[[63980,63980],"mapped",[28346]],[[63981,63981],"mapped",[21533]],[[63982,63982],"mapped",[29136]],[[63983,63983],"mapped",[29848]],[[63984,63984],"mapped",[34298]],[[63985,63985],"mapped",[38563]],[[63986,63986],"mapped",[40023]],[[63987,63987],"mapped",[40607]],[[63988,63988],"mapped",[26519]],[[63989,63989],"mapped",[28107]],[[63990,63990],"mapped",[33256]],[[63991,63991],"mapped",[31435]],[[63992,63992],"mapped",[31520]],[[63993,63993],"mapped",[31890]],[[63994,63994],"mapped",[29376]],[[63995,63995],"mapped",[28825]],[[63996,63996],"mapped",[35672]],[[63997,63997],"mapped",[20160]],[[63998,63998],"mapped",[33590]],[[63999,63999],"mapped",[21050]],[[64e3,64e3],"mapped",[20999]],[[64001,64001],"mapped",[24230]],[[64002,64002],"mapped",[25299]],[[64003,64003],"mapped",[31958]],[[64004,64004],"mapped",[23429]],[[64005,64005],"mapped",[27934]],[[64006,64006],"mapped",[26292]],[[64007,64007],"mapped",[36667]],[[64008,64008],"mapped",[34892]],[[64009,64009],"mapped",[38477]],[[64010,64010],"mapped",[35211]],[[64011,64011],"mapped",[24275]],[[64012,64012],"mapped",[20800]],[[64013,64013],"mapped",[21952]],[[64014,64015],"valid"],[[64016,64016],"mapped",[22618]],[[64017,64017],"valid"],[[64018,64018],"mapped",[26228]],[[64019,64020],"valid"],[[64021,64021],"mapped",[20958]],[[64022,64022],"mapped",[29482]],[[64023,64023],"mapped",[30410]],[[64024,64024],"mapped",[31036]],[[64025,64025],"mapped",[31070]],[[64026,64026],"mapped",[31077]],[[64027,64027],"mapped",[31119]],[[64028,64028],"mapped",[38742]],[[64029,64029],"mapped",[31934]],[[64030,64030],"mapped",[32701]],[[64031,64031],"valid"],[[64032,64032],"mapped",[34322]],[[64033,64033],"valid"],[[64034,64034],"mapped",[35576]],[[64035,64036],"valid"],[[64037,64037],"mapped",[36920]],[[64038,64038],"mapped",[37117]],[[64039,64041],"valid"],[[64042,64042],"mapped",[39151]],[[64043,64043],"mapped",[39164]],[[64044,64044],"mapped",[39208]],[[64045,64045],"mapped",[40372]],[[64046,64046],"mapped",[37086]],[[64047,64047],"mapped",[38583]],[[64048,64048],"mapped",[20398]],[[64049,64049],"mapped",[20711]],[[64050,64050],"mapped",[20813]],[[64051,64051],"mapped",[21193]],[[64052,64052],"mapped",[21220]],[[64053,64053],"mapped",[21329]],[[64054,64054],"mapped",[21917]],[[64055,64055],"mapped",[22022]],[[64056,64056],"mapped",[22120]],[[64057,64057],"mapped",[22592]],[[64058,64058],"mapped",[22696]],[[64059,64059],"mapped",[23652]],[[64060,64060],"mapped",[23662]],[[64061,64061],"mapped",[24724]],[[64062,64062],"mapped",[24936]],[[64063,64063],"mapped",[24974]],[[64064,64064],"mapped",[25074]],[[64065,64065],"mapped",[25935]],[[64066,64066],"mapped",[26082]],[[64067,64067],"mapped",[26257]],[[64068,64068],"mapped",[26757]],[[64069,64069],"mapped",[28023]],[[64070,64070],"mapped",[28186]],[[64071,64071],"mapped",[28450]],[[64072,64072],"mapped",[29038]],[[64073,64073],"mapped",[29227]],[[64074,64074],"mapped",[29730]],[[64075,64075],"mapped",[30865]],[[64076,64076],"mapped",[31038]],[[64077,64077],"mapped",[31049]],[[64078,64078],"mapped",[31048]],[[64079,64079],"mapped",[31056]],[[64080,64080],"mapped",[31062]],[[64081,64081],"mapped",[31069]],[[64082,64082],"mapped",[31117]],[[64083,64083],"mapped",[31118]],[[64084,64084],"mapped",[31296]],[[64085,64085],"mapped",[31361]],[[64086,64086],"mapped",[31680]],[[64087,64087],"mapped",[32244]],[[64088,64088],"mapped",[32265]],[[64089,64089],"mapped",[32321]],[[64090,64090],"mapped",[32626]],[[64091,64091],"mapped",[32773]],[[64092,64092],"mapped",[33261]],[[64093,64094],"mapped",[33401]],[[64095,64095],"mapped",[33879]],[[64096,64096],"mapped",[35088]],[[64097,64097],"mapped",[35222]],[[64098,64098],"mapped",[35585]],[[64099,64099],"mapped",[35641]],[[64100,64100],"mapped",[36051]],[[64101,64101],"mapped",[36104]],[[64102,64102],"mapped",[36790]],[[64103,64103],"mapped",[36920]],[[64104,64104],"mapped",[38627]],[[64105,64105],"mapped",[38911]],[[64106,64106],"mapped",[38971]],[[64107,64107],"mapped",[24693]],[[64108,64108],"mapped",[148206]],[[64109,64109],"mapped",[33304]],[[64110,64111],"disallowed"],[[64112,64112],"mapped",[20006]],[[64113,64113],"mapped",[20917]],[[64114,64114],"mapped",[20840]],[[64115,64115],"mapped",[20352]],[[64116,64116],"mapped",[20805]],[[64117,64117],"mapped",[20864]],[[64118,64118],"mapped",[21191]],[[64119,64119],"mapped",[21242]],[[64120,64120],"mapped",[21917]],[[64121,64121],"mapped",[21845]],[[64122,64122],"mapped",[21913]],[[64123,64123],"mapped",[21986]],[[64124,64124],"mapped",[22618]],[[64125,64125],"mapped",[22707]],[[64126,64126],"mapped",[22852]],[[64127,64127],"mapped",[22868]],[[64128,64128],"mapped",[23138]],[[64129,64129],"mapped",[23336]],[[64130,64130],"mapped",[24274]],[[64131,64131],"mapped",[24281]],[[64132,64132],"mapped",[24425]],[[64133,64133],"mapped",[24493]],[[64134,64134],"mapped",[24792]],[[64135,64135],"mapped",[24910]],[[64136,64136],"mapped",[24840]],[[64137,64137],"mapped",[24974]],[[64138,64138],"mapped",[24928]],[[64139,64139],"mapped",[25074]],[[64140,64140],"mapped",[25140]],[[64141,64141],"mapped",[25540]],[[64142,64142],"mapped",[25628]],[[64143,64143],"mapped",[25682]],[[64144,64144],"mapped",[25942]],[[64145,64145],"mapped",[26228]],[[64146,64146],"mapped",[26391]],[[64147,64147],"mapped",[26395]],[[64148,64148],"mapped",[26454]],[[64149,64149],"mapped",[27513]],[[64150,64150],"mapped",[27578]],[[64151,64151],"mapped",[27969]],[[64152,64152],"mapped",[28379]],[[64153,64153],"mapped",[28363]],[[64154,64154],"mapped",[28450]],[[64155,64155],"mapped",[28702]],[[64156,64156],"mapped",[29038]],[[64157,64157],"mapped",[30631]],[[64158,64158],"mapped",[29237]],[[64159,64159],"mapped",[29359]],[[64160,64160],"mapped",[29482]],[[64161,64161],"mapped",[29809]],[[64162,64162],"mapped",[29958]],[[64163,64163],"mapped",[30011]],[[64164,64164],"mapped",[30237]],[[64165,64165],"mapped",[30239]],[[64166,64166],"mapped",[30410]],[[64167,64167],"mapped",[30427]],[[64168,64168],"mapped",[30452]],[[64169,64169],"mapped",[30538]],[[64170,64170],"mapped",[30528]],[[64171,64171],"mapped",[30924]],[[64172,64172],"mapped",[31409]],[[64173,64173],"mapped",[31680]],[[64174,64174],"mapped",[31867]],[[64175,64175],"mapped",[32091]],[[64176,64176],"mapped",[32244]],[[64177,64177],"mapped",[32574]],[[64178,64178],"mapped",[32773]],[[64179,64179],"mapped",[33618]],[[64180,64180],"mapped",[33775]],[[64181,64181],"mapped",[34681]],[[64182,64182],"mapped",[35137]],[[64183,64183],"mapped",[35206]],[[64184,64184],"mapped",[35222]],[[64185,64185],"mapped",[35519]],[[64186,64186],"mapped",[35576]],[[64187,64187],"mapped",[35531]],[[64188,64188],"mapped",[35585]],[[64189,64189],"mapped",[35582]],[[64190,64190],"mapped",[35565]],[[64191,64191],"mapped",[35641]],[[64192,64192],"mapped",[35722]],[[64193,64193],"mapped",[36104]],[[64194,64194],"mapped",[36664]],[[64195,64195],"mapped",[36978]],[[64196,64196],"mapped",[37273]],[[64197,64197],"mapped",[37494]],[[64198,64198],"mapped",[38524]],[[64199,64199],"mapped",[38627]],[[64200,64200],"mapped",[38742]],[[64201,64201],"mapped",[38875]],[[64202,64202],"mapped",[38911]],[[64203,64203],"mapped",[38923]],[[64204,64204],"mapped",[38971]],[[64205,64205],"mapped",[39698]],[[64206,64206],"mapped",[40860]],[[64207,64207],"mapped",[141386]],[[64208,64208],"mapped",[141380]],[[64209,64209],"mapped",[144341]],[[64210,64210],"mapped",[15261]],[[64211,64211],"mapped",[16408]],[[64212,64212],"mapped",[16441]],[[64213,64213],"mapped",[152137]],[[64214,64214],"mapped",[154832]],[[64215,64215],"mapped",[163539]],[[64216,64216],"mapped",[40771]],[[64217,64217],"mapped",[40846]],[[64218,64255],"disallowed"],[[64256,64256],"mapped",[102,102]],[[64257,64257],"mapped",[102,105]],[[64258,64258],"mapped",[102,108]],[[64259,64259],"mapped",[102,102,105]],[[64260,64260],"mapped",[102,102,108]],[[64261,64262],"mapped",[115,116]],[[64263,64274],"disallowed"],[[64275,64275],"mapped",[1396,1398]],[[64276,64276],"mapped",[1396,1381]],[[64277,64277],"mapped",[1396,1387]],[[64278,64278],"mapped",[1406,1398]],[[64279,64279],"mapped",[1396,1389]],[[64280,64284],"disallowed"],[[64285,64285],"mapped",[1497,1460]],[[64286,64286],"valid"],[[64287,64287],"mapped",[1522,1463]],[[64288,64288],"mapped",[1506]],[[64289,64289],"mapped",[1488]],[[64290,64290],"mapped",[1491]],[[64291,64291],"mapped",[1492]],[[64292,64292],"mapped",[1499]],[[64293,64293],"mapped",[1500]],[[64294,64294],"mapped",[1501]],[[64295,64295],"mapped",[1512]],[[64296,64296],"mapped",[1514]],[[64297,64297],"disallowed_STD3_mapped",[43]],[[64298,64298],"mapped",[1513,1473]],[[64299,64299],"mapped",[1513,1474]],[[64300,64300],"mapped",[1513,1468,1473]],[[64301,64301],"mapped",[1513,1468,1474]],[[64302,64302],"mapped",[1488,1463]],[[64303,64303],"mapped",[1488,1464]],[[64304,64304],"mapped",[1488,1468]],[[64305,64305],"mapped",[1489,1468]],[[64306,64306],"mapped",[1490,1468]],[[64307,64307],"mapped",[1491,1468]],[[64308,64308],"mapped",[1492,1468]],[[64309,64309],"mapped",[1493,1468]],[[64310,64310],"mapped",[1494,1468]],[[64311,64311],"disallowed"],[[64312,64312],"mapped",[1496,1468]],[[64313,64313],"mapped",[1497,1468]],[[64314,64314],"mapped",[1498,1468]],[[64315,64315],"mapped",[1499,1468]],[[64316,64316],"mapped",[1500,1468]],[[64317,64317],"disallowed"],[[64318,64318],"mapped",[1502,1468]],[[64319,64319],"disallowed"],[[64320,64320],"mapped",[1504,1468]],[[64321,64321],"mapped",[1505,1468]],[[64322,64322],"disallowed"],[[64323,64323],"mapped",[1507,1468]],[[64324,64324],"mapped",[1508,1468]],[[64325,64325],"disallowed"],[[64326,64326],"mapped",[1510,1468]],[[64327,64327],"mapped",[1511,1468]],[[64328,64328],"mapped",[1512,1468]],[[64329,64329],"mapped",[1513,1468]],[[64330,64330],"mapped",[1514,1468]],[[64331,64331],"mapped",[1493,1465]],[[64332,64332],"mapped",[1489,1471]],[[64333,64333],"mapped",[1499,1471]],[[64334,64334],"mapped",[1508,1471]],[[64335,64335],"mapped",[1488,1500]],[[64336,64337],"mapped",[1649]],[[64338,64341],"mapped",[1659]],[[64342,64345],"mapped",[1662]],[[64346,64349],"mapped",[1664]],[[64350,64353],"mapped",[1658]],[[64354,64357],"mapped",[1663]],[[64358,64361],"mapped",[1657]],[[64362,64365],"mapped",[1700]],[[64366,64369],"mapped",[1702]],[[64370,64373],"mapped",[1668]],[[64374,64377],"mapped",[1667]],[[64378,64381],"mapped",[1670]],[[64382,64385],"mapped",[1671]],[[64386,64387],"mapped",[1677]],[[64388,64389],"mapped",[1676]],[[64390,64391],"mapped",[1678]],[[64392,64393],"mapped",[1672]],[[64394,64395],"mapped",[1688]],[[64396,64397],"mapped",[1681]],[[64398,64401],"mapped",[1705]],[[64402,64405],"mapped",[1711]],[[64406,64409],"mapped",[1715]],[[64410,64413],"mapped",[1713]],[[64414,64415],"mapped",[1722]],[[64416,64419],"mapped",[1723]],[[64420,64421],"mapped",[1728]],[[64422,64425],"mapped",[1729]],[[64426,64429],"mapped",[1726]],[[64430,64431],"mapped",[1746]],[[64432,64433],"mapped",[1747]],[[64434,64449],"valid",[],"NV8"],[[64450,64466],"disallowed"],[[64467,64470],"mapped",[1709]],[[64471,64472],"mapped",[1735]],[[64473,64474],"mapped",[1734]],[[64475,64476],"mapped",[1736]],[[64477,64477],"mapped",[1735,1652]],[[64478,64479],"mapped",[1739]],[[64480,64481],"mapped",[1733]],[[64482,64483],"mapped",[1737]],[[64484,64487],"mapped",[1744]],[[64488,64489],"mapped",[1609]],[[64490,64491],"mapped",[1574,1575]],[[64492,64493],"mapped",[1574,1749]],[[64494,64495],"mapped",[1574,1608]],[[64496,64497],"mapped",[1574,1735]],[[64498,64499],"mapped",[1574,1734]],[[64500,64501],"mapped",[1574,1736]],[[64502,64504],"mapped",[1574,1744]],[[64505,64507],"mapped",[1574,1609]],[[64508,64511],"mapped",[1740]],[[64512,64512],"mapped",[1574,1580]],[[64513,64513],"mapped",[1574,1581]],[[64514,64514],"mapped",[1574,1605]],[[64515,64515],"mapped",[1574,1609]],[[64516,64516],"mapped",[1574,1610]],[[64517,64517],"mapped",[1576,1580]],[[64518,64518],"mapped",[1576,1581]],[[64519,64519],"mapped",[1576,1582]],[[64520,64520],"mapped",[1576,1605]],[[64521,64521],"mapped",[1576,1609]],[[64522,64522],"mapped",[1576,1610]],[[64523,64523],"mapped",[1578,1580]],[[64524,64524],"mapped",[1578,1581]],[[64525,64525],"mapped",[1578,1582]],[[64526,64526],"mapped",[1578,1605]],[[64527,64527],"mapped",[1578,1609]],[[64528,64528],"mapped",[1578,1610]],[[64529,64529],"mapped",[1579,1580]],[[64530,64530],"mapped",[1579,1605]],[[64531,64531],"mapped",[1579,1609]],[[64532,64532],"mapped",[1579,1610]],[[64533,64533],"mapped",[1580,1581]],[[64534,64534],"mapped",[1580,1605]],[[64535,64535],"mapped",[1581,1580]],[[64536,64536],"mapped",[1581,1605]],[[64537,64537],"mapped",[1582,1580]],[[64538,64538],"mapped",[1582,1581]],[[64539,64539],"mapped",[1582,1605]],[[64540,64540],"mapped",[1587,1580]],[[64541,64541],"mapped",[1587,1581]],[[64542,64542],"mapped",[1587,1582]],[[64543,64543],"mapped",[1587,1605]],[[64544,64544],"mapped",[1589,1581]],[[64545,64545],"mapped",[1589,1605]],[[64546,64546],"mapped",[1590,1580]],[[64547,64547],"mapped",[1590,1581]],[[64548,64548],"mapped",[1590,1582]],[[64549,64549],"mapped",[1590,1605]],[[64550,64550],"mapped",[1591,1581]],[[64551,64551],"mapped",[1591,1605]],[[64552,64552],"mapped",[1592,1605]],[[64553,64553],"mapped",[1593,1580]],[[64554,64554],"mapped",[1593,1605]],[[64555,64555],"mapped",[1594,1580]],[[64556,64556],"mapped",[1594,1605]],[[64557,64557],"mapped",[1601,1580]],[[64558,64558],"mapped",[1601,1581]],[[64559,64559],"mapped",[1601,1582]],[[64560,64560],"mapped",[1601,1605]],[[64561,64561],"mapped",[1601,1609]],[[64562,64562],"mapped",[1601,1610]],[[64563,64563],"mapped",[1602,1581]],[[64564,64564],"mapped",[1602,1605]],[[64565,64565],"mapped",[1602,1609]],[[64566,64566],"mapped",[1602,1610]],[[64567,64567],"mapped",[1603,1575]],[[64568,64568],"mapped",[1603,1580]],[[64569,64569],"mapped",[1603,1581]],[[64570,64570],"mapped",[1603,1582]],[[64571,64571],"mapped",[1603,1604]],[[64572,64572],"mapped",[1603,1605]],[[64573,64573],"mapped",[1603,1609]],[[64574,64574],"mapped",[1603,1610]],[[64575,64575],"mapped",[1604,1580]],[[64576,64576],"mapped",[1604,1581]],[[64577,64577],"mapped",[1604,1582]],[[64578,64578],"mapped",[1604,1605]],[[64579,64579],"mapped",[1604,1609]],[[64580,64580],"mapped",[1604,1610]],[[64581,64581],"mapped",[1605,1580]],[[64582,64582],"mapped",[1605,1581]],[[64583,64583],"mapped",[1605,1582]],[[64584,64584],"mapped",[1605,1605]],[[64585,64585],"mapped",[1605,1609]],[[64586,64586],"mapped",[1605,1610]],[[64587,64587],"mapped",[1606,1580]],[[64588,64588],"mapped",[1606,1581]],[[64589,64589],"mapped",[1606,1582]],[[64590,64590],"mapped",[1606,1605]],[[64591,64591],"mapped",[1606,1609]],[[64592,64592],"mapped",[1606,1610]],[[64593,64593],"mapped",[1607,1580]],[[64594,64594],"mapped",[1607,1605]],[[64595,64595],"mapped",[1607,1609]],[[64596,64596],"mapped",[1607,1610]],[[64597,64597],"mapped",[1610,1580]],[[64598,64598],"mapped",[1610,1581]],[[64599,64599],"mapped",[1610,1582]],[[64600,64600],"mapped",[1610,1605]],[[64601,64601],"mapped",[1610,1609]],[[64602,64602],"mapped",[1610,1610]],[[64603,64603],"mapped",[1584,1648]],[[64604,64604],"mapped",[1585,1648]],[[64605,64605],"mapped",[1609,1648]],[[64606,64606],"disallowed_STD3_mapped",[32,1612,1617]],[[64607,64607],"disallowed_STD3_mapped",[32,1613,1617]],[[64608,64608],"disallowed_STD3_mapped",[32,1614,1617]],[[64609,64609],"disallowed_STD3_mapped",[32,1615,1617]],[[64610,64610],"disallowed_STD3_mapped",[32,1616,1617]],[[64611,64611],"disallowed_STD3_mapped",[32,1617,1648]],[[64612,64612],"mapped",[1574,1585]],[[64613,64613],"mapped",[1574,1586]],[[64614,64614],"mapped",[1574,1605]],[[64615,64615],"mapped",[1574,1606]],[[64616,64616],"mapped",[1574,1609]],[[64617,64617],"mapped",[1574,1610]],[[64618,64618],"mapped",[1576,1585]],[[64619,64619],"mapped",[1576,1586]],[[64620,64620],"mapped",[1576,1605]],[[64621,64621],"mapped",[1576,1606]],[[64622,64622],"mapped",[1576,1609]],[[64623,64623],"mapped",[1576,1610]],[[64624,64624],"mapped",[1578,1585]],[[64625,64625],"mapped",[1578,1586]],[[64626,64626],"mapped",[1578,1605]],[[64627,64627],"mapped",[1578,1606]],[[64628,64628],"mapped",[1578,1609]],[[64629,64629],"mapped",[1578,1610]],[[64630,64630],"mapped",[1579,1585]],[[64631,64631],"mapped",[1579,1586]],[[64632,64632],"mapped",[1579,1605]],[[64633,64633],"mapped",[1579,1606]],[[64634,64634],"mapped",[1579,1609]],[[64635,64635],"mapped",[1579,1610]],[[64636,64636],"mapped",[1601,1609]],[[64637,64637],"mapped",[1601,1610]],[[64638,64638],"mapped",[1602,1609]],[[64639,64639],"mapped",[1602,1610]],[[64640,64640],"mapped",[1603,1575]],[[64641,64641],"mapped",[1603,1604]],[[64642,64642],"mapped",[1603,1605]],[[64643,64643],"mapped",[1603,1609]],[[64644,64644],"mapped",[1603,1610]],[[64645,64645],"mapped",[1604,1605]],[[64646,64646],"mapped",[1604,1609]],[[64647,64647],"mapped",[1604,1610]],[[64648,64648],"mapped",[1605,1575]],[[64649,64649],"mapped",[1605,1605]],[[64650,64650],"mapped",[1606,1585]],[[64651,64651],"mapped",[1606,1586]],[[64652,64652],"mapped",[1606,1605]],[[64653,64653],"mapped",[1606,1606]],[[64654,64654],"mapped",[1606,1609]],[[64655,64655],"mapped",[1606,1610]],[[64656,64656],"mapped",[1609,1648]],[[64657,64657],"mapped",[1610,1585]],[[64658,64658],"mapped",[1610,1586]],[[64659,64659],"mapped",[1610,1605]],[[64660,64660],"mapped",[1610,1606]],[[64661,64661],"mapped",[1610,1609]],[[64662,64662],"mapped",[1610,1610]],[[64663,64663],"mapped",[1574,1580]],[[64664,64664],"mapped",[1574,1581]],[[64665,64665],"mapped",[1574,1582]],[[64666,64666],"mapped",[1574,1605]],[[64667,64667],"mapped",[1574,1607]],[[64668,64668],"mapped",[1576,1580]],[[64669,64669],"mapped",[1576,1581]],[[64670,64670],"mapped",[1576,1582]],[[64671,64671],"mapped",[1576,1605]],[[64672,64672],"mapped",[1576,1607]],[[64673,64673],"mapped",[1578,1580]],[[64674,64674],"mapped",[1578,1581]],[[64675,64675],"mapped",[1578,1582]],[[64676,64676],"mapped",[1578,1605]],[[64677,64677],"mapped",[1578,1607]],[[64678,64678],"mapped",[1579,1605]],[[64679,64679],"mapped",[1580,1581]],[[64680,64680],"mapped",[1580,1605]],[[64681,64681],"mapped",[1581,1580]],[[64682,64682],"mapped",[1581,1605]],[[64683,64683],"mapped",[1582,1580]],[[64684,64684],"mapped",[1582,1605]],[[64685,64685],"mapped",[1587,1580]],[[64686,64686],"mapped",[1587,1581]],[[64687,64687],"mapped",[1587,1582]],[[64688,64688],"mapped",[1587,1605]],[[64689,64689],"mapped",[1589,1581]],[[64690,64690],"mapped",[1589,1582]],[[64691,64691],"mapped",[1589,1605]],[[64692,64692],"mapped",[1590,1580]],[[64693,64693],"mapped",[1590,1581]],[[64694,64694],"mapped",[1590,1582]],[[64695,64695],"mapped",[1590,1605]],[[64696,64696],"mapped",[1591,1581]],[[64697,64697],"mapped",[1592,1605]],[[64698,64698],"mapped",[1593,1580]],[[64699,64699],"mapped",[1593,1605]],[[64700,64700],"mapped",[1594,1580]],[[64701,64701],"mapped",[1594,1605]],[[64702,64702],"mapped",[1601,1580]],[[64703,64703],"mapped",[1601,1581]],[[64704,64704],"mapped",[1601,1582]],[[64705,64705],"mapped",[1601,1605]],[[64706,64706],"mapped",[1602,1581]],[[64707,64707],"mapped",[1602,1605]],[[64708,64708],"mapped",[1603,1580]],[[64709,64709],"mapped",[1603,1581]],[[64710,64710],"mapped",[1603,1582]],[[64711,64711],"mapped",[1603,1604]],[[64712,64712],"mapped",[1603,1605]],[[64713,64713],"mapped",[1604,1580]],[[64714,64714],"mapped",[1604,1581]],[[64715,64715],"mapped",[1604,1582]],[[64716,64716],"mapped",[1604,1605]],[[64717,64717],"mapped",[1604,1607]],[[64718,64718],"mapped",[1605,1580]],[[64719,64719],"mapped",[1605,1581]],[[64720,64720],"mapped",[1605,1582]],[[64721,64721],"mapped",[1605,1605]],[[64722,64722],"mapped",[1606,1580]],[[64723,64723],"mapped",[1606,1581]],[[64724,64724],"mapped",[1606,1582]],[[64725,64725],"mapped",[1606,1605]],[[64726,64726],"mapped",[1606,1607]],[[64727,64727],"mapped",[1607,1580]],[[64728,64728],"mapped",[1607,1605]],[[64729,64729],"mapped",[1607,1648]],[[64730,64730],"mapped",[1610,1580]],[[64731,64731],"mapped",[1610,1581]],[[64732,64732],"mapped",[1610,1582]],[[64733,64733],"mapped",[1610,1605]],[[64734,64734],"mapped",[1610,1607]],[[64735,64735],"mapped",[1574,1605]],[[64736,64736],"mapped",[1574,1607]],[[64737,64737],"mapped",[1576,1605]],[[64738,64738],"mapped",[1576,1607]],[[64739,64739],"mapped",[1578,1605]],[[64740,64740],"mapped",[1578,1607]],[[64741,64741],"mapped",[1579,1605]],[[64742,64742],"mapped",[1579,1607]],[[64743,64743],"mapped",[1587,1605]],[[64744,64744],"mapped",[1587,1607]],[[64745,64745],"mapped",[1588,1605]],[[64746,64746],"mapped",[1588,1607]],[[64747,64747],"mapped",[1603,1604]],[[64748,64748],"mapped",[1603,1605]],[[64749,64749],"mapped",[1604,1605]],[[64750,64750],"mapped",[1606,1605]],[[64751,64751],"mapped",[1606,1607]],[[64752,64752],"mapped",[1610,1605]],[[64753,64753],"mapped",[1610,1607]],[[64754,64754],"mapped",[1600,1614,1617]],[[64755,64755],"mapped",[1600,1615,1617]],[[64756,64756],"mapped",[1600,1616,1617]],[[64757,64757],"mapped",[1591,1609]],[[64758,64758],"mapped",[1591,1610]],[[64759,64759],"mapped",[1593,1609]],[[64760,64760],"mapped",[1593,1610]],[[64761,64761],"mapped",[1594,1609]],[[64762,64762],"mapped",[1594,1610]],[[64763,64763],"mapped",[1587,1609]],[[64764,64764],"mapped",[1587,1610]],[[64765,64765],"mapped",[1588,1609]],[[64766,64766],"mapped",[1588,1610]],[[64767,64767],"mapped",[1581,1609]],[[64768,64768],"mapped",[1581,1610]],[[64769,64769],"mapped",[1580,1609]],[[64770,64770],"mapped",[1580,1610]],[[64771,64771],"mapped",[1582,1609]],[[64772,64772],"mapped",[1582,1610]],[[64773,64773],"mapped",[1589,1609]],[[64774,64774],"mapped",[1589,1610]],[[64775,64775],"mapped",[1590,1609]],[[64776,64776],"mapped",[1590,1610]],[[64777,64777],"mapped",[1588,1580]],[[64778,64778],"mapped",[1588,1581]],[[64779,64779],"mapped",[1588,1582]],[[64780,64780],"mapped",[1588,1605]],[[64781,64781],"mapped",[1588,1585]],[[64782,64782],"mapped",[1587,1585]],[[64783,64783],"mapped",[1589,1585]],[[64784,64784],"mapped",[1590,1585]],[[64785,64785],"mapped",[1591,1609]],[[64786,64786],"mapped",[1591,1610]],[[64787,64787],"mapped",[1593,1609]],[[64788,64788],"mapped",[1593,1610]],[[64789,64789],"mapped",[1594,1609]],[[64790,64790],"mapped",[1594,1610]],[[64791,64791],"mapped",[1587,1609]],[[64792,64792],"mapped",[1587,1610]],[[64793,64793],"mapped",[1588,1609]],[[64794,64794],"mapped",[1588,1610]],[[64795,64795],"mapped",[1581,1609]],[[64796,64796],"mapped",[1581,1610]],[[64797,64797],"mapped",[1580,1609]],[[64798,64798],"mapped",[1580,1610]],[[64799,64799],"mapped",[1582,1609]],[[64800,64800],"mapped",[1582,1610]],[[64801,64801],"mapped",[1589,1609]],[[64802,64802],"mapped",[1589,1610]],[[64803,64803],"mapped",[1590,1609]],[[64804,64804],"mapped",[1590,1610]],[[64805,64805],"mapped",[1588,1580]],[[64806,64806],"mapped",[1588,1581]],[[64807,64807],"mapped",[1588,1582]],[[64808,64808],"mapped",[1588,1605]],[[64809,64809],"mapped",[1588,1585]],[[64810,64810],"mapped",[1587,1585]],[[64811,64811],"mapped",[1589,1585]],[[64812,64812],"mapped",[1590,1585]],[[64813,64813],"mapped",[1588,1580]],[[64814,64814],"mapped",[1588,1581]],[[64815,64815],"mapped",[1588,1582]],[[64816,64816],"mapped",[1588,1605]],[[64817,64817],"mapped",[1587,1607]],[[64818,64818],"mapped",[1588,1607]],[[64819,64819],"mapped",[1591,1605]],[[64820,64820],"mapped",[1587,1580]],[[64821,64821],"mapped",[1587,1581]],[[64822,64822],"mapped",[1587,1582]],[[64823,64823],"mapped",[1588,1580]],[[64824,64824],"mapped",[1588,1581]],[[64825,64825],"mapped",[1588,1582]],[[64826,64826],"mapped",[1591,1605]],[[64827,64827],"mapped",[1592,1605]],[[64828,64829],"mapped",[1575,1611]],[[64830,64831],"valid",[],"NV8"],[[64832,64847],"disallowed"],[[64848,64848],"mapped",[1578,1580,1605]],[[64849,64850],"mapped",[1578,1581,1580]],[[64851,64851],"mapped",[1578,1581,1605]],[[64852,64852],"mapped",[1578,1582,1605]],[[64853,64853],"mapped",[1578,1605,1580]],[[64854,64854],"mapped",[1578,1605,1581]],[[64855,64855],"mapped",[1578,1605,1582]],[[64856,64857],"mapped",[1580,1605,1581]],[[64858,64858],"mapped",[1581,1605,1610]],[[64859,64859],"mapped",[1581,1605,1609]],[[64860,64860],"mapped",[1587,1581,1580]],[[64861,64861],"mapped",[1587,1580,1581]],[[64862,64862],"mapped",[1587,1580,1609]],[[64863,64864],"mapped",[1587,1605,1581]],[[64865,64865],"mapped",[1587,1605,1580]],[[64866,64867],"mapped",[1587,1605,1605]],[[64868,64869],"mapped",[1589,1581,1581]],[[64870,64870],"mapped",[1589,1605,1605]],[[64871,64872],"mapped",[1588,1581,1605]],[[64873,64873],"mapped",[1588,1580,1610]],[[64874,64875],"mapped",[1588,1605,1582]],[[64876,64877],"mapped",[1588,1605,1605]],[[64878,64878],"mapped",[1590,1581,1609]],[[64879,64880],"mapped",[1590,1582,1605]],[[64881,64882],"mapped",[1591,1605,1581]],[[64883,64883],"mapped",[1591,1605,1605]],[[64884,64884],"mapped",[1591,1605,1610]],[[64885,64885],"mapped",[1593,1580,1605]],[[64886,64887],"mapped",[1593,1605,1605]],[[64888,64888],"mapped",[1593,1605,1609]],[[64889,64889],"mapped",[1594,1605,1605]],[[64890,64890],"mapped",[1594,1605,1610]],[[64891,64891],"mapped",[1594,1605,1609]],[[64892,64893],"mapped",[1601,1582,1605]],[[64894,64894],"mapped",[1602,1605,1581]],[[64895,64895],"mapped",[1602,1605,1605]],[[64896,64896],"mapped",[1604,1581,1605]],[[64897,64897],"mapped",[1604,1581,1610]],[[64898,64898],"mapped",[1604,1581,1609]],[[64899,64900],"mapped",[1604,1580,1580]],[[64901,64902],"mapped",[1604,1582,1605]],[[64903,64904],"mapped",[1604,1605,1581]],[[64905,64905],"mapped",[1605,1581,1580]],[[64906,64906],"mapped",[1605,1581,1605]],[[64907,64907],"mapped",[1605,1581,1610]],[[64908,64908],"mapped",[1605,1580,1581]],[[64909,64909],"mapped",[1605,1580,1605]],[[64910,64910],"mapped",[1605,1582,1580]],[[64911,64911],"mapped",[1605,1582,1605]],[[64912,64913],"disallowed"],[[64914,64914],"mapped",[1605,1580,1582]],[[64915,64915],"mapped",[1607,1605,1580]],[[64916,64916],"mapped",[1607,1605,1605]],[[64917,64917],"mapped",[1606,1581,1605]],[[64918,64918],"mapped",[1606,1581,1609]],[[64919,64920],"mapped",[1606,1580,1605]],[[64921,64921],"mapped",[1606,1580,1609]],[[64922,64922],"mapped",[1606,1605,1610]],[[64923,64923],"mapped",[1606,1605,1609]],[[64924,64925],"mapped",[1610,1605,1605]],[[64926,64926],"mapped",[1576,1582,1610]],[[64927,64927],"mapped",[1578,1580,1610]],[[64928,64928],"mapped",[1578,1580,1609]],[[64929,64929],"mapped",[1578,1582,1610]],[[64930,64930],"mapped",[1578,1582,1609]],[[64931,64931],"mapped",[1578,1605,1610]],[[64932,64932],"mapped",[1578,1605,1609]],[[64933,64933],"mapped",[1580,1605,1610]],[[64934,64934],"mapped",[1580,1581,1609]],[[64935,64935],"mapped",[1580,1605,1609]],[[64936,64936],"mapped",[1587,1582,1609]],[[64937,64937],"mapped",[1589,1581,1610]],[[64938,64938],"mapped",[1588,1581,1610]],[[64939,64939],"mapped",[1590,1581,1610]],[[64940,64940],"mapped",[1604,1580,1610]],[[64941,64941],"mapped",[1604,1605,1610]],[[64942,64942],"mapped",[1610,1581,1610]],[[64943,64943],"mapped",[1610,1580,1610]],[[64944,64944],"mapped",[1610,1605,1610]],[[64945,64945],"mapped",[1605,1605,1610]],[[64946,64946],"mapped",[1602,1605,1610]],[[64947,64947],"mapped",[1606,1581,1610]],[[64948,64948],"mapped",[1602,1605,1581]],[[64949,64949],"mapped",[1604,1581,1605]],[[64950,64950],"mapped",[1593,1605,1610]],[[64951,64951],"mapped",[1603,1605,1610]],[[64952,64952],"mapped",[1606,1580,1581]],[[64953,64953],"mapped",[1605,1582,1610]],[[64954,64954],"mapped",[1604,1580,1605]],[[64955,64955],"mapped",[1603,1605,1605]],[[64956,64956],"mapped",[1604,1580,1605]],[[64957,64957],"mapped",[1606,1580,1581]],[[64958,64958],"mapped",[1580,1581,1610]],[[64959,64959],"mapped",[1581,1580,1610]],[[64960,64960],"mapped",[1605,1580,1610]],[[64961,64961],"mapped",[1601,1605,1610]],[[64962,64962],"mapped",[1576,1581,1610]],[[64963,64963],"mapped",[1603,1605,1605]],[[64964,64964],"mapped",[1593,1580,1605]],[[64965,64965],"mapped",[1589,1605,1605]],[[64966,64966],"mapped",[1587,1582,1610]],[[64967,64967],"mapped",[1606,1580,1610]],[[64968,64975],"disallowed"],[[64976,65007],"disallowed"],[[65008,65008],"mapped",[1589,1604,1746]],[[65009,65009],"mapped",[1602,1604,1746]],[[65010,65010],"mapped",[1575,1604,1604,1607]],[[65011,65011],"mapped",[1575,1603,1576,1585]],[[65012,65012],"mapped",[1605,1581,1605,1583]],[[65013,65013],"mapped",[1589,1604,1593,1605]],[[65014,65014],"mapped",[1585,1587,1608,1604]],[[65015,65015],"mapped",[1593,1604,1610,1607]],[[65016,65016],"mapped",[1608,1587,1604,1605]],[[65017,65017],"mapped",[1589,1604,1609]],[[65018,65018],"disallowed_STD3_mapped",[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605]],[[65019,65019],"disallowed_STD3_mapped",[1580,1604,32,1580,1604,1575,1604,1607]],[[65020,65020],"mapped",[1585,1740,1575,1604]],[[65021,65021],"valid",[],"NV8"],[[65022,65023],"disallowed"],[[65024,65039],"ignored"],[[65040,65040],"disallowed_STD3_mapped",[44]],[[65041,65041],"mapped",[12289]],[[65042,65042],"disallowed"],[[65043,65043],"disallowed_STD3_mapped",[58]],[[65044,65044],"disallowed_STD3_mapped",[59]],[[65045,65045],"disallowed_STD3_mapped",[33]],[[65046,65046],"disallowed_STD3_mapped",[63]],[[65047,65047],"mapped",[12310]],[[65048,65048],"mapped",[12311]],[[65049,65049],"disallowed"],[[65050,65055],"disallowed"],[[65056,65059],"valid"],[[65060,65062],"valid"],[[65063,65069],"valid"],[[65070,65071],"valid"],[[65072,65072],"disallowed"],[[65073,65073],"mapped",[8212]],[[65074,65074],"mapped",[8211]],[[65075,65076],"disallowed_STD3_mapped",[95]],[[65077,65077],"disallowed_STD3_mapped",[40]],[[65078,65078],"disallowed_STD3_mapped",[41]],[[65079,65079],"disallowed_STD3_mapped",[123]],[[65080,65080],"disallowed_STD3_mapped",[125]],[[65081,65081],"mapped",[12308]],[[65082,65082],"mapped",[12309]],[[65083,65083],"mapped",[12304]],[[65084,65084],"mapped",[12305]],[[65085,65085],"mapped",[12298]],[[65086,65086],"mapped",[12299]],[[65087,65087],"mapped",[12296]],[[65088,65088],"mapped",[12297]],[[65089,65089],"mapped",[12300]],[[65090,65090],"mapped",[12301]],[[65091,65091],"mapped",[12302]],[[65092,65092],"mapped",[12303]],[[65093,65094],"valid",[],"NV8"],[[65095,65095],"disallowed_STD3_mapped",[91]],[[65096,65096],"disallowed_STD3_mapped",[93]],[[65097,65100],"disallowed_STD3_mapped",[32,773]],[[65101,65103],"disallowed_STD3_mapped",[95]],[[65104,65104],"disallowed_STD3_mapped",[44]],[[65105,65105],"mapped",[12289]],[[65106,65106],"disallowed"],[[65107,65107],"disallowed"],[[65108,65108],"disallowed_STD3_mapped",[59]],[[65109,65109],"disallowed_STD3_mapped",[58]],[[65110,65110],"disallowed_STD3_mapped",[63]],[[65111,65111],"disallowed_STD3_mapped",[33]],[[65112,65112],"mapped",[8212]],[[65113,65113],"disallowed_STD3_mapped",[40]],[[65114,65114],"disallowed_STD3_mapped",[41]],[[65115,65115],"disallowed_STD3_mapped",[123]],[[65116,65116],"disallowed_STD3_mapped",[125]],[[65117,65117],"mapped",[12308]],[[65118,65118],"mapped",[12309]],[[65119,65119],"disallowed_STD3_mapped",[35]],[[65120,65120],"disallowed_STD3_mapped",[38]],[[65121,65121],"disallowed_STD3_mapped",[42]],[[65122,65122],"disallowed_STD3_mapped",[43]],[[65123,65123],"mapped",[45]],[[65124,65124],"disallowed_STD3_mapped",[60]],[[65125,65125],"disallowed_STD3_mapped",[62]],[[65126,65126],"disallowed_STD3_mapped",[61]],[[65127,65127],"disallowed"],[[65128,65128],"disallowed_STD3_mapped",[92]],[[65129,65129],"disallowed_STD3_mapped",[36]],[[65130,65130],"disallowed_STD3_mapped",[37]],[[65131,65131],"disallowed_STD3_mapped",[64]],[[65132,65135],"disallowed"],[[65136,65136],"disallowed_STD3_mapped",[32,1611]],[[65137,65137],"mapped",[1600,1611]],[[65138,65138],"disallowed_STD3_mapped",[32,1612]],[[65139,65139],"valid"],[[65140,65140],"disallowed_STD3_mapped",[32,1613]],[[65141,65141],"disallowed"],[[65142,65142],"disallowed_STD3_mapped",[32,1614]],[[65143,65143],"mapped",[1600,1614]],[[65144,65144],"disallowed_STD3_mapped",[32,1615]],[[65145,65145],"mapped",[1600,1615]],[[65146,65146],"disallowed_STD3_mapped",[32,1616]],[[65147,65147],"mapped",[1600,1616]],[[65148,65148],"disallowed_STD3_mapped",[32,1617]],[[65149,65149],"mapped",[1600,1617]],[[65150,65150],"disallowed_STD3_mapped",[32,1618]],[[65151,65151],"mapped",[1600,1618]],[[65152,65152],"mapped",[1569]],[[65153,65154],"mapped",[1570]],[[65155,65156],"mapped",[1571]],[[65157,65158],"mapped",[1572]],[[65159,65160],"mapped",[1573]],[[65161,65164],"mapped",[1574]],[[65165,65166],"mapped",[1575]],[[65167,65170],"mapped",[1576]],[[65171,65172],"mapped",[1577]],[[65173,65176],"mapped",[1578]],[[65177,65180],"mapped",[1579]],[[65181,65184],"mapped",[1580]],[[65185,65188],"mapped",[1581]],[[65189,65192],"mapped",[1582]],[[65193,65194],"mapped",[1583]],[[65195,65196],"mapped",[1584]],[[65197,65198],"mapped",[1585]],[[65199,65200],"mapped",[1586]],[[65201,65204],"mapped",[1587]],[[65205,65208],"mapped",[1588]],[[65209,65212],"mapped",[1589]],[[65213,65216],"mapped",[1590]],[[65217,65220],"mapped",[1591]],[[65221,65224],"mapped",[1592]],[[65225,65228],"mapped",[1593]],[[65229,65232],"mapped",[1594]],[[65233,65236],"mapped",[1601]],[[65237,65240],"mapped",[1602]],[[65241,65244],"mapped",[1603]],[[65245,65248],"mapped",[1604]],[[65249,65252],"mapped",[1605]],[[65253,65256],"mapped",[1606]],[[65257,65260],"mapped",[1607]],[[65261,65262],"mapped",[1608]],[[65263,65264],"mapped",[1609]],[[65265,65268],"mapped",[1610]],[[65269,65270],"mapped",[1604,1570]],[[65271,65272],"mapped",[1604,1571]],[[65273,65274],"mapped",[1604,1573]],[[65275,65276],"mapped",[1604,1575]],[[65277,65278],"disallowed"],[[65279,65279],"ignored"],[[65280,65280],"disallowed"],[[65281,65281],"disallowed_STD3_mapped",[33]],[[65282,65282],"disallowed_STD3_mapped",[34]],[[65283,65283],"disallowed_STD3_mapped",[35]],[[65284,65284],"disallowed_STD3_mapped",[36]],[[65285,65285],"disallowed_STD3_mapped",[37]],[[65286,65286],"disallowed_STD3_mapped",[38]],[[65287,65287],"disallowed_STD3_mapped",[39]],[[65288,65288],"disallowed_STD3_mapped",[40]],[[65289,65289],"disallowed_STD3_mapped",[41]],[[65290,65290],"disallowed_STD3_mapped",[42]],[[65291,65291],"disallowed_STD3_mapped",[43]],[[65292,65292],"disallowed_STD3_mapped",[44]],[[65293,65293],"mapped",[45]],[[65294,65294],"mapped",[46]],[[65295,65295],"disallowed_STD3_mapped",[47]],[[65296,65296],"mapped",[48]],[[65297,65297],"mapped",[49]],[[65298,65298],"mapped",[50]],[[65299,65299],"mapped",[51]],[[65300,65300],"mapped",[52]],[[65301,65301],"mapped",[53]],[[65302,65302],"mapped",[54]],[[65303,65303],"mapped",[55]],[[65304,65304],"mapped",[56]],[[65305,65305],"mapped",[57]],[[65306,65306],"disallowed_STD3_mapped",[58]],[[65307,65307],"disallowed_STD3_mapped",[59]],[[65308,65308],"disallowed_STD3_mapped",[60]],[[65309,65309],"disallowed_STD3_mapped",[61]],[[65310,65310],"disallowed_STD3_mapped",[62]],[[65311,65311],"disallowed_STD3_mapped",[63]],[[65312,65312],"disallowed_STD3_mapped",[64]],[[65313,65313],"mapped",[97]],[[65314,65314],"mapped",[98]],[[65315,65315],"mapped",[99]],[[65316,65316],"mapped",[100]],[[65317,65317],"mapped",[101]],[[65318,65318],"mapped",[102]],[[65319,65319],"mapped",[103]],[[65320,65320],"mapped",[104]],[[65321,65321],"mapped",[105]],[[65322,65322],"mapped",[106]],[[65323,65323],"mapped",[107]],[[65324,65324],"mapped",[108]],[[65325,65325],"mapped",[109]],[[65326,65326],"mapped",[110]],[[65327,65327],"mapped",[111]],[[65328,65328],"mapped",[112]],[[65329,65329],"mapped",[113]],[[65330,65330],"mapped",[114]],[[65331,65331],"mapped",[115]],[[65332,65332],"mapped",[116]],[[65333,65333],"mapped",[117]],[[65334,65334],"mapped",[118]],[[65335,65335],"mapped",[119]],[[65336,65336],"mapped",[120]],[[65337,65337],"mapped",[121]],[[65338,65338],"mapped",[122]],[[65339,65339],"disallowed_STD3_mapped",[91]],[[65340,65340],"disallowed_STD3_mapped",[92]],[[65341,65341],"disallowed_STD3_mapped",[93]],[[65342,65342],"disallowed_STD3_mapped",[94]],[[65343,65343],"disallowed_STD3_mapped",[95]],[[65344,65344],"disallowed_STD3_mapped",[96]],[[65345,65345],"mapped",[97]],[[65346,65346],"mapped",[98]],[[65347,65347],"mapped",[99]],[[65348,65348],"mapped",[100]],[[65349,65349],"mapped",[101]],[[65350,65350],"mapped",[102]],[[65351,65351],"mapped",[103]],[[65352,65352],"mapped",[104]],[[65353,65353],"mapped",[105]],[[65354,65354],"mapped",[106]],[[65355,65355],"mapped",[107]],[[65356,65356],"mapped",[108]],[[65357,65357],"mapped",[109]],[[65358,65358],"mapped",[110]],[[65359,65359],"mapped",[111]],[[65360,65360],"mapped",[112]],[[65361,65361],"mapped",[113]],[[65362,65362],"mapped",[114]],[[65363,65363],"mapped",[115]],[[65364,65364],"mapped",[116]],[[65365,65365],"mapped",[117]],[[65366,65366],"mapped",[118]],[[65367,65367],"mapped",[119]],[[65368,65368],"mapped",[120]],[[65369,65369],"mapped",[121]],[[65370,65370],"mapped",[122]],[[65371,65371],"disallowed_STD3_mapped",[123]],[[65372,65372],"disallowed_STD3_mapped",[124]],[[65373,65373],"disallowed_STD3_mapped",[125]],[[65374,65374],"disallowed_STD3_mapped",[126]],[[65375,65375],"mapped",[10629]],[[65376,65376],"mapped",[10630]],[[65377,65377],"mapped",[46]],[[65378,65378],"mapped",[12300]],[[65379,65379],"mapped",[12301]],[[65380,65380],"mapped",[12289]],[[65381,65381],"mapped",[12539]],[[65382,65382],"mapped",[12530]],[[65383,65383],"mapped",[12449]],[[65384,65384],"mapped",[12451]],[[65385,65385],"mapped",[12453]],[[65386,65386],"mapped",[12455]],[[65387,65387],"mapped",[12457]],[[65388,65388],"mapped",[12515]],[[65389,65389],"mapped",[12517]],[[65390,65390],"mapped",[12519]],[[65391,65391],"mapped",[12483]],[[65392,65392],"mapped",[12540]],[[65393,65393],"mapped",[12450]],[[65394,65394],"mapped",[12452]],[[65395,65395],"mapped",[12454]],[[65396,65396],"mapped",[12456]],[[65397,65397],"mapped",[12458]],[[65398,65398],"mapped",[12459]],[[65399,65399],"mapped",[12461]],[[65400,65400],"mapped",[12463]],[[65401,65401],"mapped",[12465]],[[65402,65402],"mapped",[12467]],[[65403,65403],"mapped",[12469]],[[65404,65404],"mapped",[12471]],[[65405,65405],"mapped",[12473]],[[65406,65406],"mapped",[12475]],[[65407,65407],"mapped",[12477]],[[65408,65408],"mapped",[12479]],[[65409,65409],"mapped",[12481]],[[65410,65410],"mapped",[12484]],[[65411,65411],"mapped",[12486]],[[65412,65412],"mapped",[12488]],[[65413,65413],"mapped",[12490]],[[65414,65414],"mapped",[12491]],[[65415,65415],"mapped",[12492]],[[65416,65416],"mapped",[12493]],[[65417,65417],"mapped",[12494]],[[65418,65418],"mapped",[12495]],[[65419,65419],"mapped",[12498]],[[65420,65420],"mapped",[12501]],[[65421,65421],"mapped",[12504]],[[65422,65422],"mapped",[12507]],[[65423,65423],"mapped",[12510]],[[65424,65424],"mapped",[12511]],[[65425,65425],"mapped",[12512]],[[65426,65426],"mapped",[12513]],[[65427,65427],"mapped",[12514]],[[65428,65428],"mapped",[12516]],[[65429,65429],"mapped",[12518]],[[65430,65430],"mapped",[12520]],[[65431,65431],"mapped",[12521]],[[65432,65432],"mapped",[12522]],[[65433,65433],"mapped",[12523]],[[65434,65434],"mapped",[12524]],[[65435,65435],"mapped",[12525]],[[65436,65436],"mapped",[12527]],[[65437,65437],"mapped",[12531]],[[65438,65438],"mapped",[12441]],[[65439,65439],"mapped",[12442]],[[65440,65440],"disallowed"],[[65441,65441],"mapped",[4352]],[[65442,65442],"mapped",[4353]],[[65443,65443],"mapped",[4522]],[[65444,65444],"mapped",[4354]],[[65445,65445],"mapped",[4524]],[[65446,65446],"mapped",[4525]],[[65447,65447],"mapped",[4355]],[[65448,65448],"mapped",[4356]],[[65449,65449],"mapped",[4357]],[[65450,65450],"mapped",[4528]],[[65451,65451],"mapped",[4529]],[[65452,65452],"mapped",[4530]],[[65453,65453],"mapped",[4531]],[[65454,65454],"mapped",[4532]],[[65455,65455],"mapped",[4533]],[[65456,65456],"mapped",[4378]],[[65457,65457],"mapped",[4358]],[[65458,65458],"mapped",[4359]],[[65459,65459],"mapped",[4360]],[[65460,65460],"mapped",[4385]],[[65461,65461],"mapped",[4361]],[[65462,65462],"mapped",[4362]],[[65463,65463],"mapped",[4363]],[[65464,65464],"mapped",[4364]],[[65465,65465],"mapped",[4365]],[[65466,65466],"mapped",[4366]],[[65467,65467],"mapped",[4367]],[[65468,65468],"mapped",[4368]],[[65469,65469],"mapped",[4369]],[[65470,65470],"mapped",[4370]],[[65471,65473],"disallowed"],[[65474,65474],"mapped",[4449]],[[65475,65475],"mapped",[4450]],[[65476,65476],"mapped",[4451]],[[65477,65477],"mapped",[4452]],[[65478,65478],"mapped",[4453]],[[65479,65479],"mapped",[4454]],[[65480,65481],"disallowed"],[[65482,65482],"mapped",[4455]],[[65483,65483],"mapped",[4456]],[[65484,65484],"mapped",[4457]],[[65485,65485],"mapped",[4458]],[[65486,65486],"mapped",[4459]],[[65487,65487],"mapped",[4460]],[[65488,65489],"disallowed"],[[65490,65490],"mapped",[4461]],[[65491,65491],"mapped",[4462]],[[65492,65492],"mapped",[4463]],[[65493,65493],"mapped",[4464]],[[65494,65494],"mapped",[4465]],[[65495,65495],"mapped",[4466]],[[65496,65497],"disallowed"],[[65498,65498],"mapped",[4467]],[[65499,65499],"mapped",[4468]],[[65500,65500],"mapped",[4469]],[[65501,65503],"disallowed"],[[65504,65504],"mapped",[162]],[[65505,65505],"mapped",[163]],[[65506,65506],"mapped",[172]],[[65507,65507],"disallowed_STD3_mapped",[32,772]],[[65508,65508],"mapped",[166]],[[65509,65509],"mapped",[165]],[[65510,65510],"mapped",[8361]],[[65511,65511],"disallowed"],[[65512,65512],"mapped",[9474]],[[65513,65513],"mapped",[8592]],[[65514,65514],"mapped",[8593]],[[65515,65515],"mapped",[8594]],[[65516,65516],"mapped",[8595]],[[65517,65517],"mapped",[9632]],[[65518,65518],"mapped",[9675]],[[65519,65528],"disallowed"],[[65529,65531],"disallowed"],[[65532,65532],"disallowed"],[[65533,65533],"disallowed"],[[65534,65535],"disallowed"],[[65536,65547],"valid"],[[65548,65548],"disallowed"],[[65549,65574],"valid"],[[65575,65575],"disallowed"],[[65576,65594],"valid"],[[65595,65595],"disallowed"],[[65596,65597],"valid"],[[65598,65598],"disallowed"],[[65599,65613],"valid"],[[65614,65615],"disallowed"],[[65616,65629],"valid"],[[65630,65663],"disallowed"],[[65664,65786],"valid"],[[65787,65791],"disallowed"],[[65792,65794],"valid",[],"NV8"],[[65795,65798],"disallowed"],[[65799,65843],"valid",[],"NV8"],[[65844,65846],"disallowed"],[[65847,65855],"valid",[],"NV8"],[[65856,65930],"valid",[],"NV8"],[[65931,65932],"valid",[],"NV8"],[[65933,65935],"disallowed"],[[65936,65947],"valid",[],"NV8"],[[65948,65951],"disallowed"],[[65952,65952],"valid",[],"NV8"],[[65953,65999],"disallowed"],[[66e3,66044],"valid",[],"NV8"],[[66045,66045],"valid"],[[66046,66175],"disallowed"],[[66176,66204],"valid"],[[66205,66207],"disallowed"],[[66208,66256],"valid"],[[66257,66271],"disallowed"],[[66272,66272],"valid"],[[66273,66299],"valid",[],"NV8"],[[66300,66303],"disallowed"],[[66304,66334],"valid"],[[66335,66335],"valid"],[[66336,66339],"valid",[],"NV8"],[[66340,66351],"disallowed"],[[66352,66368],"valid"],[[66369,66369],"valid",[],"NV8"],[[66370,66377],"valid"],[[66378,66378],"valid",[],"NV8"],[[66379,66383],"disallowed"],[[66384,66426],"valid"],[[66427,66431],"disallowed"],[[66432,66461],"valid"],[[66462,66462],"disallowed"],[[66463,66463],"valid",[],"NV8"],[[66464,66499],"valid"],[[66500,66503],"disallowed"],[[66504,66511],"valid"],[[66512,66517],"valid",[],"NV8"],[[66518,66559],"disallowed"],[[66560,66560],"mapped",[66600]],[[66561,66561],"mapped",[66601]],[[66562,66562],"mapped",[66602]],[[66563,66563],"mapped",[66603]],[[66564,66564],"mapped",[66604]],[[66565,66565],"mapped",[66605]],[[66566,66566],"mapped",[66606]],[[66567,66567],"mapped",[66607]],[[66568,66568],"mapped",[66608]],[[66569,66569],"mapped",[66609]],[[66570,66570],"mapped",[66610]],[[66571,66571],"mapped",[66611]],[[66572,66572],"mapped",[66612]],[[66573,66573],"mapped",[66613]],[[66574,66574],"mapped",[66614]],[[66575,66575],"mapped",[66615]],[[66576,66576],"mapped",[66616]],[[66577,66577],"mapped",[66617]],[[66578,66578],"mapped",[66618]],[[66579,66579],"mapped",[66619]],[[66580,66580],"mapped",[66620]],[[66581,66581],"mapped",[66621]],[[66582,66582],"mapped",[66622]],[[66583,66583],"mapped",[66623]],[[66584,66584],"mapped",[66624]],[[66585,66585],"mapped",[66625]],[[66586,66586],"mapped",[66626]],[[66587,66587],"mapped",[66627]],[[66588,66588],"mapped",[66628]],[[66589,66589],"mapped",[66629]],[[66590,66590],"mapped",[66630]],[[66591,66591],"mapped",[66631]],[[66592,66592],"mapped",[66632]],[[66593,66593],"mapped",[66633]],[[66594,66594],"mapped",[66634]],[[66595,66595],"mapped",[66635]],[[66596,66596],"mapped",[66636]],[[66597,66597],"mapped",[66637]],[[66598,66598],"mapped",[66638]],[[66599,66599],"mapped",[66639]],[[66600,66637],"valid"],[[66638,66717],"valid"],[[66718,66719],"disallowed"],[[66720,66729],"valid"],[[66730,66815],"disallowed"],[[66816,66855],"valid"],[[66856,66863],"disallowed"],[[66864,66915],"valid"],[[66916,66926],"disallowed"],[[66927,66927],"valid",[],"NV8"],[[66928,67071],"disallowed"],[[67072,67382],"valid"],[[67383,67391],"disallowed"],[[67392,67413],"valid"],[[67414,67423],"disallowed"],[[67424,67431],"valid"],[[67432,67583],"disallowed"],[[67584,67589],"valid"],[[67590,67591],"disallowed"],[[67592,67592],"valid"],[[67593,67593],"disallowed"],[[67594,67637],"valid"],[[67638,67638],"disallowed"],[[67639,67640],"valid"],[[67641,67643],"disallowed"],[[67644,67644],"valid"],[[67645,67646],"disallowed"],[[67647,67647],"valid"],[[67648,67669],"valid"],[[67670,67670],"disallowed"],[[67671,67679],"valid",[],"NV8"],[[67680,67702],"valid"],[[67703,67711],"valid",[],"NV8"],[[67712,67742],"valid"],[[67743,67750],"disallowed"],[[67751,67759],"valid",[],"NV8"],[[67760,67807],"disallowed"],[[67808,67826],"valid"],[[67827,67827],"disallowed"],[[67828,67829],"valid"],[[67830,67834],"disallowed"],[[67835,67839],"valid",[],"NV8"],[[67840,67861],"valid"],[[67862,67865],"valid",[],"NV8"],[[67866,67867],"valid",[],"NV8"],[[67868,67870],"disallowed"],[[67871,67871],"valid",[],"NV8"],[[67872,67897],"valid"],[[67898,67902],"disallowed"],[[67903,67903],"valid",[],"NV8"],[[67904,67967],"disallowed"],[[67968,68023],"valid"],[[68024,68027],"disallowed"],[[68028,68029],"valid",[],"NV8"],[[68030,68031],"valid"],[[68032,68047],"valid",[],"NV8"],[[68048,68049],"disallowed"],[[68050,68095],"valid",[],"NV8"],[[68096,68099],"valid"],[[68100,68100],"disallowed"],[[68101,68102],"valid"],[[68103,68107],"disallowed"],[[68108,68115],"valid"],[[68116,68116],"disallowed"],[[68117,68119],"valid"],[[68120,68120],"disallowed"],[[68121,68147],"valid"],[[68148,68151],"disallowed"],[[68152,68154],"valid"],[[68155,68158],"disallowed"],[[68159,68159],"valid"],[[68160,68167],"valid",[],"NV8"],[[68168,68175],"disallowed"],[[68176,68184],"valid",[],"NV8"],[[68185,68191],"disallowed"],[[68192,68220],"valid"],[[68221,68223],"valid",[],"NV8"],[[68224,68252],"valid"],[[68253,68255],"valid",[],"NV8"],[[68256,68287],"disallowed"],[[68288,68295],"valid"],[[68296,68296],"valid",[],"NV8"],[[68297,68326],"valid"],[[68327,68330],"disallowed"],[[68331,68342],"valid",[],"NV8"],[[68343,68351],"disallowed"],[[68352,68405],"valid"],[[68406,68408],"disallowed"],[[68409,68415],"valid",[],"NV8"],[[68416,68437],"valid"],[[68438,68439],"disallowed"],[[68440,68447],"valid",[],"NV8"],[[68448,68466],"valid"],[[68467,68471],"disallowed"],[[68472,68479],"valid",[],"NV8"],[[68480,68497],"valid"],[[68498,68504],"disallowed"],[[68505,68508],"valid",[],"NV8"],[[68509,68520],"disallowed"],[[68521,68527],"valid",[],"NV8"],[[68528,68607],"disallowed"],[[68608,68680],"valid"],[[68681,68735],"disallowed"],[[68736,68736],"mapped",[68800]],[[68737,68737],"mapped",[68801]],[[68738,68738],"mapped",[68802]],[[68739,68739],"mapped",[68803]],[[68740,68740],"mapped",[68804]],[[68741,68741],"mapped",[68805]],[[68742,68742],"mapped",[68806]],[[68743,68743],"mapped",[68807]],[[68744,68744],"mapped",[68808]],[[68745,68745],"mapped",[68809]],[[68746,68746],"mapped",[68810]],[[68747,68747],"mapped",[68811]],[[68748,68748],"mapped",[68812]],[[68749,68749],"mapped",[68813]],[[68750,68750],"mapped",[68814]],[[68751,68751],"mapped",[68815]],[[68752,68752],"mapped",[68816]],[[68753,68753],"mapped",[68817]],[[68754,68754],"mapped",[68818]],[[68755,68755],"mapped",[68819]],[[68756,68756],"mapped",[68820]],[[68757,68757],"mapped",[68821]],[[68758,68758],"mapped",[68822]],[[68759,68759],"mapped",[68823]],[[68760,68760],"mapped",[68824]],[[68761,68761],"mapped",[68825]],[[68762,68762],"mapped",[68826]],[[68763,68763],"mapped",[68827]],[[68764,68764],"mapped",[68828]],[[68765,68765],"mapped",[68829]],[[68766,68766],"mapped",[68830]],[[68767,68767],"mapped",[68831]],[[68768,68768],"mapped",[68832]],[[68769,68769],"mapped",[68833]],[[68770,68770],"mapped",[68834]],[[68771,68771],"mapped",[68835]],[[68772,68772],"mapped",[68836]],[[68773,68773],"mapped",[68837]],[[68774,68774],"mapped",[68838]],[[68775,68775],"mapped",[68839]],[[68776,68776],"mapped",[68840]],[[68777,68777],"mapped",[68841]],[[68778,68778],"mapped",[68842]],[[68779,68779],"mapped",[68843]],[[68780,68780],"mapped",[68844]],[[68781,68781],"mapped",[68845]],[[68782,68782],"mapped",[68846]],[[68783,68783],"mapped",[68847]],[[68784,68784],"mapped",[68848]],[[68785,68785],"mapped",[68849]],[[68786,68786],"mapped",[68850]],[[68787,68799],"disallowed"],[[68800,68850],"valid"],[[68851,68857],"disallowed"],[[68858,68863],"valid",[],"NV8"],[[68864,69215],"disallowed"],[[69216,69246],"valid",[],"NV8"],[[69247,69631],"disallowed"],[[69632,69702],"valid"],[[69703,69709],"valid",[],"NV8"],[[69710,69713],"disallowed"],[[69714,69733],"valid",[],"NV8"],[[69734,69743],"valid"],[[69744,69758],"disallowed"],[[69759,69759],"valid"],[[69760,69818],"valid"],[[69819,69820],"valid",[],"NV8"],[[69821,69821],"disallowed"],[[69822,69825],"valid",[],"NV8"],[[69826,69839],"disallowed"],[[69840,69864],"valid"],[[69865,69871],"disallowed"],[[69872,69881],"valid"],[[69882,69887],"disallowed"],[[69888,69940],"valid"],[[69941,69941],"disallowed"],[[69942,69951],"valid"],[[69952,69955],"valid",[],"NV8"],[[69956,69967],"disallowed"],[[69968,70003],"valid"],[[70004,70005],"valid",[],"NV8"],[[70006,70006],"valid"],[[70007,70015],"disallowed"],[[70016,70084],"valid"],[[70085,70088],"valid",[],"NV8"],[[70089,70089],"valid",[],"NV8"],[[70090,70092],"valid"],[[70093,70093],"valid",[],"NV8"],[[70094,70095],"disallowed"],[[70096,70105],"valid"],[[70106,70106],"valid"],[[70107,70107],"valid",[],"NV8"],[[70108,70108],"valid"],[[70109,70111],"valid",[],"NV8"],[[70112,70112],"disallowed"],[[70113,70132],"valid",[],"NV8"],[[70133,70143],"disallowed"],[[70144,70161],"valid"],[[70162,70162],"disallowed"],[[70163,70199],"valid"],[[70200,70205],"valid",[],"NV8"],[[70206,70271],"disallowed"],[[70272,70278],"valid"],[[70279,70279],"disallowed"],[[70280,70280],"valid"],[[70281,70281],"disallowed"],[[70282,70285],"valid"],[[70286,70286],"disallowed"],[[70287,70301],"valid"],[[70302,70302],"disallowed"],[[70303,70312],"valid"],[[70313,70313],"valid",[],"NV8"],[[70314,70319],"disallowed"],[[70320,70378],"valid"],[[70379,70383],"disallowed"],[[70384,70393],"valid"],[[70394,70399],"disallowed"],[[70400,70400],"valid"],[[70401,70403],"valid"],[[70404,70404],"disallowed"],[[70405,70412],"valid"],[[70413,70414],"disallowed"],[[70415,70416],"valid"],[[70417,70418],"disallowed"],[[70419,70440],"valid"],[[70441,70441],"disallowed"],[[70442,70448],"valid"],[[70449,70449],"disallowed"],[[70450,70451],"valid"],[[70452,70452],"disallowed"],[[70453,70457],"valid"],[[70458,70459],"disallowed"],[[70460,70468],"valid"],[[70469,70470],"disallowed"],[[70471,70472],"valid"],[[70473,70474],"disallowed"],[[70475,70477],"valid"],[[70478,70479],"disallowed"],[[70480,70480],"valid"],[[70481,70486],"disallowed"],[[70487,70487],"valid"],[[70488,70492],"disallowed"],[[70493,70499],"valid"],[[70500,70501],"disallowed"],[[70502,70508],"valid"],[[70509,70511],"disallowed"],[[70512,70516],"valid"],[[70517,70783],"disallowed"],[[70784,70853],"valid"],[[70854,70854],"valid",[],"NV8"],[[70855,70855],"valid"],[[70856,70863],"disallowed"],[[70864,70873],"valid"],[[70874,71039],"disallowed"],[[71040,71093],"valid"],[[71094,71095],"disallowed"],[[71096,71104],"valid"],[[71105,71113],"valid",[],"NV8"],[[71114,71127],"valid",[],"NV8"],[[71128,71133],"valid"],[[71134,71167],"disallowed"],[[71168,71232],"valid"],[[71233,71235],"valid",[],"NV8"],[[71236,71236],"valid"],[[71237,71247],"disallowed"],[[71248,71257],"valid"],[[71258,71295],"disallowed"],[[71296,71351],"valid"],[[71352,71359],"disallowed"],[[71360,71369],"valid"],[[71370,71423],"disallowed"],[[71424,71449],"valid"],[[71450,71452],"disallowed"],[[71453,71467],"valid"],[[71468,71471],"disallowed"],[[71472,71481],"valid"],[[71482,71487],"valid",[],"NV8"],[[71488,71839],"disallowed"],[[71840,71840],"mapped",[71872]],[[71841,71841],"mapped",[71873]],[[71842,71842],"mapped",[71874]],[[71843,71843],"mapped",[71875]],[[71844,71844],"mapped",[71876]],[[71845,71845],"mapped",[71877]],[[71846,71846],"mapped",[71878]],[[71847,71847],"mapped",[71879]],[[71848,71848],"mapped",[71880]],[[71849,71849],"mapped",[71881]],[[71850,71850],"mapped",[71882]],[[71851,71851],"mapped",[71883]],[[71852,71852],"mapped",[71884]],[[71853,71853],"mapped",[71885]],[[71854,71854],"mapped",[71886]],[[71855,71855],"mapped",[71887]],[[71856,71856],"mapped",[71888]],[[71857,71857],"mapped",[71889]],[[71858,71858],"mapped",[71890]],[[71859,71859],"mapped",[71891]],[[71860,71860],"mapped",[71892]],[[71861,71861],"mapped",[71893]],[[71862,71862],"mapped",[71894]],[[71863,71863],"mapped",[71895]],[[71864,71864],"mapped",[71896]],[[71865,71865],"mapped",[71897]],[[71866,71866],"mapped",[71898]],[[71867,71867],"mapped",[71899]],[[71868,71868],"mapped",[71900]],[[71869,71869],"mapped",[71901]],[[71870,71870],"mapped",[71902]],[[71871,71871],"mapped",[71903]],[[71872,71913],"valid"],[[71914,71922],"valid",[],"NV8"],[[71923,71934],"disallowed"],[[71935,71935],"valid"],[[71936,72383],"disallowed"],[[72384,72440],"valid"],[[72441,73727],"disallowed"],[[73728,74606],"valid"],[[74607,74648],"valid"],[[74649,74649],"valid"],[[74650,74751],"disallowed"],[[74752,74850],"valid",[],"NV8"],[[74851,74862],"valid",[],"NV8"],[[74863,74863],"disallowed"],[[74864,74867],"valid",[],"NV8"],[[74868,74868],"valid",[],"NV8"],[[74869,74879],"disallowed"],[[74880,75075],"valid"],[[75076,77823],"disallowed"],[[77824,78894],"valid"],[[78895,82943],"disallowed"],[[82944,83526],"valid"],[[83527,92159],"disallowed"],[[92160,92728],"valid"],[[92729,92735],"disallowed"],[[92736,92766],"valid"],[[92767,92767],"disallowed"],[[92768,92777],"valid"],[[92778,92781],"disallowed"],[[92782,92783],"valid",[],"NV8"],[[92784,92879],"disallowed"],[[92880,92909],"valid"],[[92910,92911],"disallowed"],[[92912,92916],"valid"],[[92917,92917],"valid",[],"NV8"],[[92918,92927],"disallowed"],[[92928,92982],"valid"],[[92983,92991],"valid",[],"NV8"],[[92992,92995],"valid"],[[92996,92997],"valid",[],"NV8"],[[92998,93007],"disallowed"],[[93008,93017],"valid"],[[93018,93018],"disallowed"],[[93019,93025],"valid",[],"NV8"],[[93026,93026],"disallowed"],[[93027,93047],"valid"],[[93048,93052],"disallowed"],[[93053,93071],"valid"],[[93072,93951],"disallowed"],[[93952,94020],"valid"],[[94021,94031],"disallowed"],[[94032,94078],"valid"],[[94079,94094],"disallowed"],[[94095,94111],"valid"],[[94112,110591],"disallowed"],[[110592,110593],"valid"],[[110594,113663],"disallowed"],[[113664,113770],"valid"],[[113771,113775],"disallowed"],[[113776,113788],"valid"],[[113789,113791],"disallowed"],[[113792,113800],"valid"],[[113801,113807],"disallowed"],[[113808,113817],"valid"],[[113818,113819],"disallowed"],[[113820,113820],"valid",[],"NV8"],[[113821,113822],"valid"],[[113823,113823],"valid",[],"NV8"],[[113824,113827],"ignored"],[[113828,118783],"disallowed"],[[118784,119029],"valid",[],"NV8"],[[119030,119039],"disallowed"],[[119040,119078],"valid",[],"NV8"],[[119079,119080],"disallowed"],[[119081,119081],"valid",[],"NV8"],[[119082,119133],"valid",[],"NV8"],[[119134,119134],"mapped",[119127,119141]],[[119135,119135],"mapped",[119128,119141]],[[119136,119136],"mapped",[119128,119141,119150]],[[119137,119137],"mapped",[119128,119141,119151]],[[119138,119138],"mapped",[119128,119141,119152]],[[119139,119139],"mapped",[119128,119141,119153]],[[119140,119140],"mapped",[119128,119141,119154]],[[119141,119154],"valid",[],"NV8"],[[119155,119162],"disallowed"],[[119163,119226],"valid",[],"NV8"],[[119227,119227],"mapped",[119225,119141]],[[119228,119228],"mapped",[119226,119141]],[[119229,119229],"mapped",[119225,119141,119150]],[[119230,119230],"mapped",[119226,119141,119150]],[[119231,119231],"mapped",[119225,119141,119151]],[[119232,119232],"mapped",[119226,119141,119151]],[[119233,119261],"valid",[],"NV8"],[[119262,119272],"valid",[],"NV8"],[[119273,119295],"disallowed"],[[119296,119365],"valid",[],"NV8"],[[119366,119551],"disallowed"],[[119552,119638],"valid",[],"NV8"],[[119639,119647],"disallowed"],[[119648,119665],"valid",[],"NV8"],[[119666,119807],"disallowed"],[[119808,119808],"mapped",[97]],[[119809,119809],"mapped",[98]],[[119810,119810],"mapped",[99]],[[119811,119811],"mapped",[100]],[[119812,119812],"mapped",[101]],[[119813,119813],"mapped",[102]],[[119814,119814],"mapped",[103]],[[119815,119815],"mapped",[104]],[[119816,119816],"mapped",[105]],[[119817,119817],"mapped",[106]],[[119818,119818],"mapped",[107]],[[119819,119819],"mapped",[108]],[[119820,119820],"mapped",[109]],[[119821,119821],"mapped",[110]],[[119822,119822],"mapped",[111]],[[119823,119823],"mapped",[112]],[[119824,119824],"mapped",[113]],[[119825,119825],"mapped",[114]],[[119826,119826],"mapped",[115]],[[119827,119827],"mapped",[116]],[[119828,119828],"mapped",[117]],[[119829,119829],"mapped",[118]],[[119830,119830],"mapped",[119]],[[119831,119831],"mapped",[120]],[[119832,119832],"mapped",[121]],[[119833,119833],"mapped",[122]],[[119834,119834],"mapped",[97]],[[119835,119835],"mapped",[98]],[[119836,119836],"mapped",[99]],[[119837,119837],"mapped",[100]],[[119838,119838],"mapped",[101]],[[119839,119839],"mapped",[102]],[[119840,119840],"mapped",[103]],[[119841,119841],"mapped",[104]],[[119842,119842],"mapped",[105]],[[119843,119843],"mapped",[106]],[[119844,119844],"mapped",[107]],[[119845,119845],"mapped",[108]],[[119846,119846],"mapped",[109]],[[119847,119847],"mapped",[110]],[[119848,119848],"mapped",[111]],[[119849,119849],"mapped",[112]],[[119850,119850],"mapped",[113]],[[119851,119851],"mapped",[114]],[[119852,119852],"mapped",[115]],[[119853,119853],"mapped",[116]],[[119854,119854],"mapped",[117]],[[119855,119855],"mapped",[118]],[[119856,119856],"mapped",[119]],[[119857,119857],"mapped",[120]],[[119858,119858],"mapped",[121]],[[119859,119859],"mapped",[122]],[[119860,119860],"mapped",[97]],[[119861,119861],"mapped",[98]],[[119862,119862],"mapped",[99]],[[119863,119863],"mapped",[100]],[[119864,119864],"mapped",[101]],[[119865,119865],"mapped",[102]],[[119866,119866],"mapped",[103]],[[119867,119867],"mapped",[104]],[[119868,119868],"mapped",[105]],[[119869,119869],"mapped",[106]],[[119870,119870],"mapped",[107]],[[119871,119871],"mapped",[108]],[[119872,119872],"mapped",[109]],[[119873,119873],"mapped",[110]],[[119874,119874],"mapped",[111]],[[119875,119875],"mapped",[112]],[[119876,119876],"mapped",[113]],[[119877,119877],"mapped",[114]],[[119878,119878],"mapped",[115]],[[119879,119879],"mapped",[116]],[[119880,119880],"mapped",[117]],[[119881,119881],"mapped",[118]],[[119882,119882],"mapped",[119]],[[119883,119883],"mapped",[120]],[[119884,119884],"mapped",[121]],[[119885,119885],"mapped",[122]],[[119886,119886],"mapped",[97]],[[119887,119887],"mapped",[98]],[[119888,119888],"mapped",[99]],[[119889,119889],"mapped",[100]],[[119890,119890],"mapped",[101]],[[119891,119891],"mapped",[102]],[[119892,119892],"mapped",[103]],[[119893,119893],"disallowed"],[[119894,119894],"mapped",[105]],[[119895,119895],"mapped",[106]],[[119896,119896],"mapped",[107]],[[119897,119897],"mapped",[108]],[[119898,119898],"mapped",[109]],[[119899,119899],"mapped",[110]],[[119900,119900],"mapped",[111]],[[119901,119901],"mapped",[112]],[[119902,119902],"mapped",[113]],[[119903,119903],"mapped",[114]],[[119904,119904],"mapped",[115]],[[119905,119905],"mapped",[116]],[[119906,119906],"mapped",[117]],[[119907,119907],"mapped",[118]],[[119908,119908],"mapped",[119]],[[119909,119909],"mapped",[120]],[[119910,119910],"mapped",[121]],[[119911,119911],"mapped",[122]],[[119912,119912],"mapped",[97]],[[119913,119913],"mapped",[98]],[[119914,119914],"mapped",[99]],[[119915,119915],"mapped",[100]],[[119916,119916],"mapped",[101]],[[119917,119917],"mapped",[102]],[[119918,119918],"mapped",[103]],[[119919,119919],"mapped",[104]],[[119920,119920],"mapped",[105]],[[119921,119921],"mapped",[106]],[[119922,119922],"mapped",[107]],[[119923,119923],"mapped",[108]],[[119924,119924],"mapped",[109]],[[119925,119925],"mapped",[110]],[[119926,119926],"mapped",[111]],[[119927,119927],"mapped",[112]],[[119928,119928],"mapped",[113]],[[119929,119929],"mapped",[114]],[[119930,119930],"mapped",[115]],[[119931,119931],"mapped",[116]],[[119932,119932],"mapped",[117]],[[119933,119933],"mapped",[118]],[[119934,119934],"mapped",[119]],[[119935,119935],"mapped",[120]],[[119936,119936],"mapped",[121]],[[119937,119937],"mapped",[122]],[[119938,119938],"mapped",[97]],[[119939,119939],"mapped",[98]],[[119940,119940],"mapped",[99]],[[119941,119941],"mapped",[100]],[[119942,119942],"mapped",[101]],[[119943,119943],"mapped",[102]],[[119944,119944],"mapped",[103]],[[119945,119945],"mapped",[104]],[[119946,119946],"mapped",[105]],[[119947,119947],"mapped",[106]],[[119948,119948],"mapped",[107]],[[119949,119949],"mapped",[108]],[[119950,119950],"mapped",[109]],[[119951,119951],"mapped",[110]],[[119952,119952],"mapped",[111]],[[119953,119953],"mapped",[112]],[[119954,119954],"mapped",[113]],[[119955,119955],"mapped",[114]],[[119956,119956],"mapped",[115]],[[119957,119957],"mapped",[116]],[[119958,119958],"mapped",[117]],[[119959,119959],"mapped",[118]],[[119960,119960],"mapped",[119]],[[119961,119961],"mapped",[120]],[[119962,119962],"mapped",[121]],[[119963,119963],"mapped",[122]],[[119964,119964],"mapped",[97]],[[119965,119965],"disallowed"],[[119966,119966],"mapped",[99]],[[119967,119967],"mapped",[100]],[[119968,119969],"disallowed"],[[119970,119970],"mapped",[103]],[[119971,119972],"disallowed"],[[119973,119973],"mapped",[106]],[[119974,119974],"mapped",[107]],[[119975,119976],"disallowed"],[[119977,119977],"mapped",[110]],[[119978,119978],"mapped",[111]],[[119979,119979],"mapped",[112]],[[119980,119980],"mapped",[113]],[[119981,119981],"disallowed"],[[119982,119982],"mapped",[115]],[[119983,119983],"mapped",[116]],[[119984,119984],"mapped",[117]],[[119985,119985],"mapped",[118]],[[119986,119986],"mapped",[119]],[[119987,119987],"mapped",[120]],[[119988,119988],"mapped",[121]],[[119989,119989],"mapped",[122]],[[119990,119990],"mapped",[97]],[[119991,119991],"mapped",[98]],[[119992,119992],"mapped",[99]],[[119993,119993],"mapped",[100]],[[119994,119994],"disallowed"],[[119995,119995],"mapped",[102]],[[119996,119996],"disallowed"],[[119997,119997],"mapped",[104]],[[119998,119998],"mapped",[105]],[[119999,119999],"mapped",[106]],[[12e4,12e4],"mapped",[107]],[[120001,120001],"mapped",[108]],[[120002,120002],"mapped",[109]],[[120003,120003],"mapped",[110]],[[120004,120004],"disallowed"],[[120005,120005],"mapped",[112]],[[120006,120006],"mapped",[113]],[[120007,120007],"mapped",[114]],[[120008,120008],"mapped",[115]],[[120009,120009],"mapped",[116]],[[120010,120010],"mapped",[117]],[[120011,120011],"mapped",[118]],[[120012,120012],"mapped",[119]],[[120013,120013],"mapped",[120]],[[120014,120014],"mapped",[121]],[[120015,120015],"mapped",[122]],[[120016,120016],"mapped",[97]],[[120017,120017],"mapped",[98]],[[120018,120018],"mapped",[99]],[[120019,120019],"mapped",[100]],[[120020,120020],"mapped",[101]],[[120021,120021],"mapped",[102]],[[120022,120022],"mapped",[103]],[[120023,120023],"mapped",[104]],[[120024,120024],"mapped",[105]],[[120025,120025],"mapped",[106]],[[120026,120026],"mapped",[107]],[[120027,120027],"mapped",[108]],[[120028,120028],"mapped",[109]],[[120029,120029],"mapped",[110]],[[120030,120030],"mapped",[111]],[[120031,120031],"mapped",[112]],[[120032,120032],"mapped",[113]],[[120033,120033],"mapped",[114]],[[120034,120034],"mapped",[115]],[[120035,120035],"mapped",[116]],[[120036,120036],"mapped",[117]],[[120037,120037],"mapped",[118]],[[120038,120038],"mapped",[119]],[[120039,120039],"mapped",[120]],[[120040,120040],"mapped",[121]],[[120041,120041],"mapped",[122]],[[120042,120042],"mapped",[97]],[[120043,120043],"mapped",[98]],[[120044,120044],"mapped",[99]],[[120045,120045],"mapped",[100]],[[120046,120046],"mapped",[101]],[[120047,120047],"mapped",[102]],[[120048,120048],"mapped",[103]],[[120049,120049],"mapped",[104]],[[120050,120050],"mapped",[105]],[[120051,120051],"mapped",[106]],[[120052,120052],"mapped",[107]],[[120053,120053],"mapped",[108]],[[120054,120054],"mapped",[109]],[[120055,120055],"mapped",[110]],[[120056,120056],"mapped",[111]],[[120057,120057],"mapped",[112]],[[120058,120058],"mapped",[113]],[[120059,120059],"mapped",[114]],[[120060,120060],"mapped",[115]],[[120061,120061],"mapped",[116]],[[120062,120062],"mapped",[117]],[[120063,120063],"mapped",[118]],[[120064,120064],"mapped",[119]],[[120065,120065],"mapped",[120]],[[120066,120066],"mapped",[121]],[[120067,120067],"mapped",[122]],[[120068,120068],"mapped",[97]],[[120069,120069],"mapped",[98]],[[120070,120070],"disallowed"],[[120071,120071],"mapped",[100]],[[120072,120072],"mapped",[101]],[[120073,120073],"mapped",[102]],[[120074,120074],"mapped",[103]],[[120075,120076],"disallowed"],[[120077,120077],"mapped",[106]],[[120078,120078],"mapped",[107]],[[120079,120079],"mapped",[108]],[[120080,120080],"mapped",[109]],[[120081,120081],"mapped",[110]],[[120082,120082],"mapped",[111]],[[120083,120083],"mapped",[112]],[[120084,120084],"mapped",[113]],[[120085,120085],"disallowed"],[[120086,120086],"mapped",[115]],[[120087,120087],"mapped",[116]],[[120088,120088],"mapped",[117]],[[120089,120089],"mapped",[118]],[[120090,120090],"mapped",[119]],[[120091,120091],"mapped",[120]],[[120092,120092],"mapped",[121]],[[120093,120093],"disallowed"],[[120094,120094],"mapped",[97]],[[120095,120095],"mapped",[98]],[[120096,120096],"mapped",[99]],[[120097,120097],"mapped",[100]],[[120098,120098],"mapped",[101]],[[120099,120099],"mapped",[102]],[[120100,120100],"mapped",[103]],[[120101,120101],"mapped",[104]],[[120102,120102],"mapped",[105]],[[120103,120103],"mapped",[106]],[[120104,120104],"mapped",[107]],[[120105,120105],"mapped",[108]],[[120106,120106],"mapped",[109]],[[120107,120107],"mapped",[110]],[[120108,120108],"mapped",[111]],[[120109,120109],"mapped",[112]],[[120110,120110],"mapped",[113]],[[120111,120111],"mapped",[114]],[[120112,120112],"mapped",[115]],[[120113,120113],"mapped",[116]],[[120114,120114],"mapped",[117]],[[120115,120115],"mapped",[118]],[[120116,120116],"mapped",[119]],[[120117,120117],"mapped",[120]],[[120118,120118],"mapped",[121]],[[120119,120119],"mapped",[122]],[[120120,120120],"mapped",[97]],[[120121,120121],"mapped",[98]],[[120122,120122],"disallowed"],[[120123,120123],"mapped",[100]],[[120124,120124],"mapped",[101]],[[120125,120125],"mapped",[102]],[[120126,120126],"mapped",[103]],[[120127,120127],"disallowed"],[[120128,120128],"mapped",[105]],[[120129,120129],"mapped",[106]],[[120130,120130],"mapped",[107]],[[120131,120131],"mapped",[108]],[[120132,120132],"mapped",[109]],[[120133,120133],"disallowed"],[[120134,120134],"mapped",[111]],[[120135,120137],"disallowed"],[[120138,120138],"mapped",[115]],[[120139,120139],"mapped",[116]],[[120140,120140],"mapped",[117]],[[120141,120141],"mapped",[118]],[[120142,120142],"mapped",[119]],[[120143,120143],"mapped",[120]],[[120144,120144],"mapped",[121]],[[120145,120145],"disallowed"],[[120146,120146],"mapped",[97]],[[120147,120147],"mapped",[98]],[[120148,120148],"mapped",[99]],[[120149,120149],"mapped",[100]],[[120150,120150],"mapped",[101]],[[120151,120151],"mapped",[102]],[[120152,120152],"mapped",[103]],[[120153,120153],"mapped",[104]],[[120154,120154],"mapped",[105]],[[120155,120155],"mapped",[106]],[[120156,120156],"mapped",[107]],[[120157,120157],"mapped",[108]],[[120158,120158],"mapped",[109]],[[120159,120159],"mapped",[110]],[[120160,120160],"mapped",[111]],[[120161,120161],"mapped",[112]],[[120162,120162],"mapped",[113]],[[120163,120163],"mapped",[114]],[[120164,120164],"mapped",[115]],[[120165,120165],"mapped",[116]],[[120166,120166],"mapped",[117]],[[120167,120167],"mapped",[118]],[[120168,120168],"mapped",[119]],[[120169,120169],"mapped",[120]],[[120170,120170],"mapped",[121]],[[120171,120171],"mapped",[122]],[[120172,120172],"mapped",[97]],[[120173,120173],"mapped",[98]],[[120174,120174],"mapped",[99]],[[120175,120175],"mapped",[100]],[[120176,120176],"mapped",[101]],[[120177,120177],"mapped",[102]],[[120178,120178],"mapped",[103]],[[120179,120179],"mapped",[104]],[[120180,120180],"mapped",[105]],[[120181,120181],"mapped",[106]],[[120182,120182],"mapped",[107]],[[120183,120183],"mapped",[108]],[[120184,120184],"mapped",[109]],[[120185,120185],"mapped",[110]],[[120186,120186],"mapped",[111]],[[120187,120187],"mapped",[112]],[[120188,120188],"mapped",[113]],[[120189,120189],"mapped",[114]],[[120190,120190],"mapped",[115]],[[120191,120191],"mapped",[116]],[[120192,120192],"mapped",[117]],[[120193,120193],"mapped",[118]],[[120194,120194],"mapped",[119]],[[120195,120195],"mapped",[120]],[[120196,120196],"mapped",[121]],[[120197,120197],"mapped",[122]],[[120198,120198],"mapped",[97]],[[120199,120199],"mapped",[98]],[[120200,120200],"mapped",[99]],[[120201,120201],"mapped",[100]],[[120202,120202],"mapped",[101]],[[120203,120203],"mapped",[102]],[[120204,120204],"mapped",[103]],[[120205,120205],"mapped",[104]],[[120206,120206],"mapped",[105]],[[120207,120207],"mapped",[106]],[[120208,120208],"mapped",[107]],[[120209,120209],"mapped",[108]],[[120210,120210],"mapped",[109]],[[120211,120211],"mapped",[110]],[[120212,120212],"mapped",[111]],[[120213,120213],"mapped",[112]],[[120214,120214],"mapped",[113]],[[120215,120215],"mapped",[114]],[[120216,120216],"mapped",[115]],[[120217,120217],"mapped",[116]],[[120218,120218],"mapped",[117]],[[120219,120219],"mapped",[118]],[[120220,120220],"mapped",[119]],[[120221,120221],"mapped",[120]],[[120222,120222],"mapped",[121]],[[120223,120223],"mapped",[122]],[[120224,120224],"mapped",[97]],[[120225,120225],"mapped",[98]],[[120226,120226],"mapped",[99]],[[120227,120227],"mapped",[100]],[[120228,120228],"mapped",[101]],[[120229,120229],"mapped",[102]],[[120230,120230],"mapped",[103]],[[120231,120231],"mapped",[104]],[[120232,120232],"mapped",[105]],[[120233,120233],"mapped",[106]],[[120234,120234],"mapped",[107]],[[120235,120235],"mapped",[108]],[[120236,120236],"mapped",[109]],[[120237,120237],"mapped",[110]],[[120238,120238],"mapped",[111]],[[120239,120239],"mapped",[112]],[[120240,120240],"mapped",[113]],[[120241,120241],"mapped",[114]],[[120242,120242],"mapped",[115]],[[120243,120243],"mapped",[116]],[[120244,120244],"mapped",[117]],[[120245,120245],"mapped",[118]],[[120246,120246],"mapped",[119]],[[120247,120247],"mapped",[120]],[[120248,120248],"mapped",[121]],[[120249,120249],"mapped",[122]],[[120250,120250],"mapped",[97]],[[120251,120251],"mapped",[98]],[[120252,120252],"mapped",[99]],[[120253,120253],"mapped",[100]],[[120254,120254],"mapped",[101]],[[120255,120255],"mapped",[102]],[[120256,120256],"mapped",[103]],[[120257,120257],"mapped",[104]],[[120258,120258],"mapped",[105]],[[120259,120259],"mapped",[106]],[[120260,120260],"mapped",[107]],[[120261,120261],"mapped",[108]],[[120262,120262],"mapped",[109]],[[120263,120263],"mapped",[110]],[[120264,120264],"mapped",[111]],[[120265,120265],"mapped",[112]],[[120266,120266],"mapped",[113]],[[120267,120267],"mapped",[114]],[[120268,120268],"mapped",[115]],[[120269,120269],"mapped",[116]],[[120270,120270],"mapped",[117]],[[120271,120271],"mapped",[118]],[[120272,120272],"mapped",[119]],[[120273,120273],"mapped",[120]],[[120274,120274],"mapped",[121]],[[120275,120275],"mapped",[122]],[[120276,120276],"mapped",[97]],[[120277,120277],"mapped",[98]],[[120278,120278],"mapped",[99]],[[120279,120279],"mapped",[100]],[[120280,120280],"mapped",[101]],[[120281,120281],"mapped",[102]],[[120282,120282],"mapped",[103]],[[120283,120283],"mapped",[104]],[[120284,120284],"mapped",[105]],[[120285,120285],"mapped",[106]],[[120286,120286],"mapped",[107]],[[120287,120287],"mapped",[108]],[[120288,120288],"mapped",[109]],[[120289,120289],"mapped",[110]],[[120290,120290],"mapped",[111]],[[120291,120291],"mapped",[112]],[[120292,120292],"mapped",[113]],[[120293,120293],"mapped",[114]],[[120294,120294],"mapped",[115]],[[120295,120295],"mapped",[116]],[[120296,120296],"mapped",[117]],[[120297,120297],"mapped",[118]],[[120298,120298],"mapped",[119]],[[120299,120299],"mapped",[120]],[[120300,120300],"mapped",[121]],[[120301,120301],"mapped",[122]],[[120302,120302],"mapped",[97]],[[120303,120303],"mapped",[98]],[[120304,120304],"mapped",[99]],[[120305,120305],"mapped",[100]],[[120306,120306],"mapped",[101]],[[120307,120307],"mapped",[102]],[[120308,120308],"mapped",[103]],[[120309,120309],"mapped",[104]],[[120310,120310],"mapped",[105]],[[120311,120311],"mapped",[106]],[[120312,120312],"mapped",[107]],[[120313,120313],"mapped",[108]],[[120314,120314],"mapped",[109]],[[120315,120315],"mapped",[110]],[[120316,120316],"mapped",[111]],[[120317,120317],"mapped",[112]],[[120318,120318],"mapped",[113]],[[120319,120319],"mapped",[114]],[[120320,120320],"mapped",[115]],[[120321,120321],"mapped",[116]],[[120322,120322],"mapped",[117]],[[120323,120323],"mapped",[118]],[[120324,120324],"mapped",[119]],[[120325,120325],"mapped",[120]],[[120326,120326],"mapped",[121]],[[120327,120327],"mapped",[122]],[[120328,120328],"mapped",[97]],[[120329,120329],"mapped",[98]],[[120330,120330],"mapped",[99]],[[120331,120331],"mapped",[100]],[[120332,120332],"mapped",[101]],[[120333,120333],"mapped",[102]],[[120334,120334],"mapped",[103]],[[120335,120335],"mapped",[104]],[[120336,120336],"mapped",[105]],[[120337,120337],"mapped",[106]],[[120338,120338],"mapped",[107]],[[120339,120339],"mapped",[108]],[[120340,120340],"mapped",[109]],[[120341,120341],"mapped",[110]],[[120342,120342],"mapped",[111]],[[120343,120343],"mapped",[112]],[[120344,120344],"mapped",[113]],[[120345,120345],"mapped",[114]],[[120346,120346],"mapped",[115]],[[120347,120347],"mapped",[116]],[[120348,120348],"mapped",[117]],[[120349,120349],"mapped",[118]],[[120350,120350],"mapped",[119]],[[120351,120351],"mapped",[120]],[[120352,120352],"mapped",[121]],[[120353,120353],"mapped",[122]],[[120354,120354],"mapped",[97]],[[120355,120355],"mapped",[98]],[[120356,120356],"mapped",[99]],[[120357,120357],"mapped",[100]],[[120358,120358],"mapped",[101]],[[120359,120359],"mapped",[102]],[[120360,120360],"mapped",[103]],[[120361,120361],"mapped",[104]],[[120362,120362],"mapped",[105]],[[120363,120363],"mapped",[106]],[[120364,120364],"mapped",[107]],[[120365,120365],"mapped",[108]],[[120366,120366],"mapped",[109]],[[120367,120367],"mapped",[110]],[[120368,120368],"mapped",[111]],[[120369,120369],"mapped",[112]],[[120370,120370],"mapped",[113]],[[120371,120371],"mapped",[114]],[[120372,120372],"mapped",[115]],[[120373,120373],"mapped",[116]],[[120374,120374],"mapped",[117]],[[120375,120375],"mapped",[118]],[[120376,120376],"mapped",[119]],[[120377,120377],"mapped",[120]],[[120378,120378],"mapped",[121]],[[120379,120379],"mapped",[122]],[[120380,120380],"mapped",[97]],[[120381,120381],"mapped",[98]],[[120382,120382],"mapped",[99]],[[120383,120383],"mapped",[100]],[[120384,120384],"mapped",[101]],[[120385,120385],"mapped",[102]],[[120386,120386],"mapped",[103]],[[120387,120387],"mapped",[104]],[[120388,120388],"mapped",[105]],[[120389,120389],"mapped",[106]],[[120390,120390],"mapped",[107]],[[120391,120391],"mapped",[108]],[[120392,120392],"mapped",[109]],[[120393,120393],"mapped",[110]],[[120394,120394],"mapped",[111]],[[120395,120395],"mapped",[112]],[[120396,120396],"mapped",[113]],[[120397,120397],"mapped",[114]],[[120398,120398],"mapped",[115]],[[120399,120399],"mapped",[116]],[[120400,120400],"mapped",[117]],[[120401,120401],"mapped",[118]],[[120402,120402],"mapped",[119]],[[120403,120403],"mapped",[120]],[[120404,120404],"mapped",[121]],[[120405,120405],"mapped",[122]],[[120406,120406],"mapped",[97]],[[120407,120407],"mapped",[98]],[[120408,120408],"mapped",[99]],[[120409,120409],"mapped",[100]],[[120410,120410],"mapped",[101]],[[120411,120411],"mapped",[102]],[[120412,120412],"mapped",[103]],[[120413,120413],"mapped",[104]],[[120414,120414],"mapped",[105]],[[120415,120415],"mapped",[106]],[[120416,120416],"mapped",[107]],[[120417,120417],"mapped",[108]],[[120418,120418],"mapped",[109]],[[120419,120419],"mapped",[110]],[[120420,120420],"mapped",[111]],[[120421,120421],"mapped",[112]],[[120422,120422],"mapped",[113]],[[120423,120423],"mapped",[114]],[[120424,120424],"mapped",[115]],[[120425,120425],"mapped",[116]],[[120426,120426],"mapped",[117]],[[120427,120427],"mapped",[118]],[[120428,120428],"mapped",[119]],[[120429,120429],"mapped",[120]],[[120430,120430],"mapped",[121]],[[120431,120431],"mapped",[122]],[[120432,120432],"mapped",[97]],[[120433,120433],"mapped",[98]],[[120434,120434],"mapped",[99]],[[120435,120435],"mapped",[100]],[[120436,120436],"mapped",[101]],[[120437,120437],"mapped",[102]],[[120438,120438],"mapped",[103]],[[120439,120439],"mapped",[104]],[[120440,120440],"mapped",[105]],[[120441,120441],"mapped",[106]],[[120442,120442],"mapped",[107]],[[120443,120443],"mapped",[108]],[[120444,120444],"mapped",[109]],[[120445,120445],"mapped",[110]],[[120446,120446],"mapped",[111]],[[120447,120447],"mapped",[112]],[[120448,120448],"mapped",[113]],[[120449,120449],"mapped",[114]],[[120450,120450],"mapped",[115]],[[120451,120451],"mapped",[116]],[[120452,120452],"mapped",[117]],[[120453,120453],"mapped",[118]],[[120454,120454],"mapped",[119]],[[120455,120455],"mapped",[120]],[[120456,120456],"mapped",[121]],[[120457,120457],"mapped",[122]],[[120458,120458],"mapped",[97]],[[120459,120459],"mapped",[98]],[[120460,120460],"mapped",[99]],[[120461,120461],"mapped",[100]],[[120462,120462],"mapped",[101]],[[120463,120463],"mapped",[102]],[[120464,120464],"mapped",[103]],[[120465,120465],"mapped",[104]],[[120466,120466],"mapped",[105]],[[120467,120467],"mapped",[106]],[[120468,120468],"mapped",[107]],[[120469,120469],"mapped",[108]],[[120470,120470],"mapped",[109]],[[120471,120471],"mapped",[110]],[[120472,120472],"mapped",[111]],[[120473,120473],"mapped",[112]],[[120474,120474],"mapped",[113]],[[120475,120475],"mapped",[114]],[[120476,120476],"mapped",[115]],[[120477,120477],"mapped",[116]],[[120478,120478],"mapped",[117]],[[120479,120479],"mapped",[118]],[[120480,120480],"mapped",[119]],[[120481,120481],"mapped",[120]],[[120482,120482],"mapped",[121]],[[120483,120483],"mapped",[122]],[[120484,120484],"mapped",[305]],[[120485,120485],"mapped",[567]],[[120486,120487],"disallowed"],[[120488,120488],"mapped",[945]],[[120489,120489],"mapped",[946]],[[120490,120490],"mapped",[947]],[[120491,120491],"mapped",[948]],[[120492,120492],"mapped",[949]],[[120493,120493],"mapped",[950]],[[120494,120494],"mapped",[951]],[[120495,120495],"mapped",[952]],[[120496,120496],"mapped",[953]],[[120497,120497],"mapped",[954]],[[120498,120498],"mapped",[955]],[[120499,120499],"mapped",[956]],[[120500,120500],"mapped",[957]],[[120501,120501],"mapped",[958]],[[120502,120502],"mapped",[959]],[[120503,120503],"mapped",[960]],[[120504,120504],"mapped",[961]],[[120505,120505],"mapped",[952]],[[120506,120506],"mapped",[963]],[[120507,120507],"mapped",[964]],[[120508,120508],"mapped",[965]],[[120509,120509],"mapped",[966]],[[120510,120510],"mapped",[967]],[[120511,120511],"mapped",[968]],[[120512,120512],"mapped",[969]],[[120513,120513],"mapped",[8711]],[[120514,120514],"mapped",[945]],[[120515,120515],"mapped",[946]],[[120516,120516],"mapped",[947]],[[120517,120517],"mapped",[948]],[[120518,120518],"mapped",[949]],[[120519,120519],"mapped",[950]],[[120520,120520],"mapped",[951]],[[120521,120521],"mapped",[952]],[[120522,120522],"mapped",[953]],[[120523,120523],"mapped",[954]],[[120524,120524],"mapped",[955]],[[120525,120525],"mapped",[956]],[[120526,120526],"mapped",[957]],[[120527,120527],"mapped",[958]],[[120528,120528],"mapped",[959]],[[120529,120529],"mapped",[960]],[[120530,120530],"mapped",[961]],[[120531,120532],"mapped",[963]],[[120533,120533],"mapped",[964]],[[120534,120534],"mapped",[965]],[[120535,120535],"mapped",[966]],[[120536,120536],"mapped",[967]],[[120537,120537],"mapped",[968]],[[120538,120538],"mapped",[969]],[[120539,120539],"mapped",[8706]],[[120540,120540],"mapped",[949]],[[120541,120541],"mapped",[952]],[[120542,120542],"mapped",[954]],[[120543,120543],"mapped",[966]],[[120544,120544],"mapped",[961]],[[120545,120545],"mapped",[960]],[[120546,120546],"mapped",[945]],[[120547,120547],"mapped",[946]],[[120548,120548],"mapped",[947]],[[120549,120549],"mapped",[948]],[[120550,120550],"mapped",[949]],[[120551,120551],"mapped",[950]],[[120552,120552],"mapped",[951]],[[120553,120553],"mapped",[952]],[[120554,120554],"mapped",[953]],[[120555,120555],"mapped",[954]],[[120556,120556],"mapped",[955]],[[120557,120557],"mapped",[956]],[[120558,120558],"mapped",[957]],[[120559,120559],"mapped",[958]],[[120560,120560],"mapped",[959]],[[120561,120561],"mapped",[960]],[[120562,120562],"mapped",[961]],[[120563,120563],"mapped",[952]],[[120564,120564],"mapped",[963]],[[120565,120565],"mapped",[964]],[[120566,120566],"mapped",[965]],[[120567,120567],"mapped",[966]],[[120568,120568],"mapped",[967]],[[120569,120569],"mapped",[968]],[[120570,120570],"mapped",[969]],[[120571,120571],"mapped",[8711]],[[120572,120572],"mapped",[945]],[[120573,120573],"mapped",[946]],[[120574,120574],"mapped",[947]],[[120575,120575],"mapped",[948]],[[120576,120576],"mapped",[949]],[[120577,120577],"mapped",[950]],[[120578,120578],"mapped",[951]],[[120579,120579],"mapped",[952]],[[120580,120580],"mapped",[953]],[[120581,120581],"mapped",[954]],[[120582,120582],"mapped",[955]],[[120583,120583],"mapped",[956]],[[120584,120584],"mapped",[957]],[[120585,120585],"mapped",[958]],[[120586,120586],"mapped",[959]],[[120587,120587],"mapped",[960]],[[120588,120588],"mapped",[961]],[[120589,120590],"mapped",[963]],[[120591,120591],"mapped",[964]],[[120592,120592],"mapped",[965]],[[120593,120593],"mapped",[966]],[[120594,120594],"mapped",[967]],[[120595,120595],"mapped",[968]],[[120596,120596],"mapped",[969]],[[120597,120597],"mapped",[8706]],[[120598,120598],"mapped",[949]],[[120599,120599],"mapped",[952]],[[120600,120600],"mapped",[954]],[[120601,120601],"mapped",[966]],[[120602,120602],"mapped",[961]],[[120603,120603],"mapped",[960]],[[120604,120604],"mapped",[945]],[[120605,120605],"mapped",[946]],[[120606,120606],"mapped",[947]],[[120607,120607],"mapped",[948]],[[120608,120608],"mapped",[949]],[[120609,120609],"mapped",[950]],[[120610,120610],"mapped",[951]],[[120611,120611],"mapped",[952]],[[120612,120612],"mapped",[953]],[[120613,120613],"mapped",[954]],[[120614,120614],"mapped",[955]],[[120615,120615],"mapped",[956]],[[120616,120616],"mapped",[957]],[[120617,120617],"mapped",[958]],[[120618,120618],"mapped",[959]],[[120619,120619],"mapped",[960]],[[120620,120620],"mapped",[961]],[[120621,120621],"mapped",[952]],[[120622,120622],"mapped",[963]],[[120623,120623],"mapped",[964]],[[120624,120624],"mapped",[965]],[[120625,120625],"mapped",[966]],[[120626,120626],"mapped",[967]],[[120627,120627],"mapped",[968]],[[120628,120628],"mapped",[969]],[[120629,120629],"mapped",[8711]],[[120630,120630],"mapped",[945]],[[120631,120631],"mapped",[946]],[[120632,120632],"mapped",[947]],[[120633,120633],"mapped",[948]],[[120634,120634],"mapped",[949]],[[120635,120635],"mapped",[950]],[[120636,120636],"mapped",[951]],[[120637,120637],"mapped",[952]],[[120638,120638],"mapped",[953]],[[120639,120639],"mapped",[954]],[[120640,120640],"mapped",[955]],[[120641,120641],"mapped",[956]],[[120642,120642],"mapped",[957]],[[120643,120643],"mapped",[958]],[[120644,120644],"mapped",[959]],[[120645,120645],"mapped",[960]],[[120646,120646],"mapped",[961]],[[120647,120648],"mapped",[963]],[[120649,120649],"mapped",[964]],[[120650,120650],"mapped",[965]],[[120651,120651],"mapped",[966]],[[120652,120652],"mapped",[967]],[[120653,120653],"mapped",[968]],[[120654,120654],"mapped",[969]],[[120655,120655],"mapped",[8706]],[[120656,120656],"mapped",[949]],[[120657,120657],"mapped",[952]],[[120658,120658],"mapped",[954]],[[120659,120659],"mapped",[966]],[[120660,120660],"mapped",[961]],[[120661,120661],"mapped",[960]],[[120662,120662],"mapped",[945]],[[120663,120663],"mapped",[946]],[[120664,120664],"mapped",[947]],[[120665,120665],"mapped",[948]],[[120666,120666],"mapped",[949]],[[120667,120667],"mapped",[950]],[[120668,120668],"mapped",[951]],[[120669,120669],"mapped",[952]],[[120670,120670],"mapped",[953]],[[120671,120671],"mapped",[954]],[[120672,120672],"mapped",[955]],[[120673,120673],"mapped",[956]],[[120674,120674],"mapped",[957]],[[120675,120675],"mapped",[958]],[[120676,120676],"mapped",[959]],[[120677,120677],"mapped",[960]],[[120678,120678],"mapped",[961]],[[120679,120679],"mapped",[952]],[[120680,120680],"mapped",[963]],[[120681,120681],"mapped",[964]],[[120682,120682],"mapped",[965]],[[120683,120683],"mapped",[966]],[[120684,120684],"mapped",[967]],[[120685,120685],"mapped",[968]],[[120686,120686],"mapped",[969]],[[120687,120687],"mapped",[8711]],[[120688,120688],"mapped",[945]],[[120689,120689],"mapped",[946]],[[120690,120690],"mapped",[947]],[[120691,120691],"mapped",[948]],[[120692,120692],"mapped",[949]],[[120693,120693],"mapped",[950]],[[120694,120694],"mapped",[951]],[[120695,120695],"mapped",[952]],[[120696,120696],"mapped",[953]],[[120697,120697],"mapped",[954]],[[120698,120698],"mapped",[955]],[[120699,120699],"mapped",[956]],[[120700,120700],"mapped",[957]],[[120701,120701],"mapped",[958]],[[120702,120702],"mapped",[959]],[[120703,120703],"mapped",[960]],[[120704,120704],"mapped",[961]],[[120705,120706],"mapped",[963]],[[120707,120707],"mapped",[964]],[[120708,120708],"mapped",[965]],[[120709,120709],"mapped",[966]],[[120710,120710],"mapped",[967]],[[120711,120711],"mapped",[968]],[[120712,120712],"mapped",[969]],[[120713,120713],"mapped",[8706]],[[120714,120714],"mapped",[949]],[[120715,120715],"mapped",[952]],[[120716,120716],"mapped",[954]],[[120717,120717],"mapped",[966]],[[120718,120718],"mapped",[961]],[[120719,120719],"mapped",[960]],[[120720,120720],"mapped",[945]],[[120721,120721],"mapped",[946]],[[120722,120722],"mapped",[947]],[[120723,120723],"mapped",[948]],[[120724,120724],"mapped",[949]],[[120725,120725],"mapped",[950]],[[120726,120726],"mapped",[951]],[[120727,120727],"mapped",[952]],[[120728,120728],"mapped",[953]],[[120729,120729],"mapped",[954]],[[120730,120730],"mapped",[955]],[[120731,120731],"mapped",[956]],[[120732,120732],"mapped",[957]],[[120733,120733],"mapped",[958]],[[120734,120734],"mapped",[959]],[[120735,120735],"mapped",[960]],[[120736,120736],"mapped",[961]],[[120737,120737],"mapped",[952]],[[120738,120738],"mapped",[963]],[[120739,120739],"mapped",[964]],[[120740,120740],"mapped",[965]],[[120741,120741],"mapped",[966]],[[120742,120742],"mapped",[967]],[[120743,120743],"mapped",[968]],[[120744,120744],"mapped",[969]],[[120745,120745],"mapped",[8711]],[[120746,120746],"mapped",[945]],[[120747,120747],"mapped",[946]],[[120748,120748],"mapped",[947]],[[120749,120749],"mapped",[948]],[[120750,120750],"mapped",[949]],[[120751,120751],"mapped",[950]],[[120752,120752],"mapped",[951]],[[120753,120753],"mapped",[952]],[[120754,120754],"mapped",[953]],[[120755,120755],"mapped",[954]],[[120756,120756],"mapped",[955]],[[120757,120757],"mapped",[956]],[[120758,120758],"mapped",[957]],[[120759,120759],"mapped",[958]],[[120760,120760],"mapped",[959]],[[120761,120761],"mapped",[960]],[[120762,120762],"mapped",[961]],[[120763,120764],"mapped",[963]],[[120765,120765],"mapped",[964]],[[120766,120766],"mapped",[965]],[[120767,120767],"mapped",[966]],[[120768,120768],"mapped",[967]],[[120769,120769],"mapped",[968]],[[120770,120770],"mapped",[969]],[[120771,120771],"mapped",[8706]],[[120772,120772],"mapped",[949]],[[120773,120773],"mapped",[952]],[[120774,120774],"mapped",[954]],[[120775,120775],"mapped",[966]],[[120776,120776],"mapped",[961]],[[120777,120777],"mapped",[960]],[[120778,120779],"mapped",[989]],[[120780,120781],"disallowed"],[[120782,120782],"mapped",[48]],[[120783,120783],"mapped",[49]],[[120784,120784],"mapped",[50]],[[120785,120785],"mapped",[51]],[[120786,120786],"mapped",[52]],[[120787,120787],"mapped",[53]],[[120788,120788],"mapped",[54]],[[120789,120789],"mapped",[55]],[[120790,120790],"mapped",[56]],[[120791,120791],"mapped",[57]],[[120792,120792],"mapped",[48]],[[120793,120793],"mapped",[49]],[[120794,120794],"mapped",[50]],[[120795,120795],"mapped",[51]],[[120796,120796],"mapped",[52]],[[120797,120797],"mapped",[53]],[[120798,120798],"mapped",[54]],[[120799,120799],"mapped",[55]],[[120800,120800],"mapped",[56]],[[120801,120801],"mapped",[57]],[[120802,120802],"mapped",[48]],[[120803,120803],"mapped",[49]],[[120804,120804],"mapped",[50]],[[120805,120805],"mapped",[51]],[[120806,120806],"mapped",[52]],[[120807,120807],"mapped",[53]],[[120808,120808],"mapped",[54]],[[120809,120809],"mapped",[55]],[[120810,120810],"mapped",[56]],[[120811,120811],"mapped",[57]],[[120812,120812],"mapped",[48]],[[120813,120813],"mapped",[49]],[[120814,120814],"mapped",[50]],[[120815,120815],"mapped",[51]],[[120816,120816],"mapped",[52]],[[120817,120817],"mapped",[53]],[[120818,120818],"mapped",[54]],[[120819,120819],"mapped",[55]],[[120820,120820],"mapped",[56]],[[120821,120821],"mapped",[57]],[[120822,120822],"mapped",[48]],[[120823,120823],"mapped",[49]],[[120824,120824],"mapped",[50]],[[120825,120825],"mapped",[51]],[[120826,120826],"mapped",[52]],[[120827,120827],"mapped",[53]],[[120828,120828],"mapped",[54]],[[120829,120829],"mapped",[55]],[[120830,120830],"mapped",[56]],[[120831,120831],"mapped",[57]],[[120832,121343],"valid",[],"NV8"],[[121344,121398],"valid"],[[121399,121402],"valid",[],"NV8"],[[121403,121452],"valid"],[[121453,121460],"valid",[],"NV8"],[[121461,121461],"valid"],[[121462,121475],"valid",[],"NV8"],[[121476,121476],"valid"],[[121477,121483],"valid",[],"NV8"],[[121484,121498],"disallowed"],[[121499,121503],"valid"],[[121504,121504],"disallowed"],[[121505,121519],"valid"],[[121520,124927],"disallowed"],[[124928,125124],"valid"],[[125125,125126],"disallowed"],[[125127,125135],"valid",[],"NV8"],[[125136,125142],"valid"],[[125143,126463],"disallowed"],[[126464,126464],"mapped",[1575]],[[126465,126465],"mapped",[1576]],[[126466,126466],"mapped",[1580]],[[126467,126467],"mapped",[1583]],[[126468,126468],"disallowed"],[[126469,126469],"mapped",[1608]],[[126470,126470],"mapped",[1586]],[[126471,126471],"mapped",[1581]],[[126472,126472],"mapped",[1591]],[[126473,126473],"mapped",[1610]],[[126474,126474],"mapped",[1603]],[[126475,126475],"mapped",[1604]],[[126476,126476],"mapped",[1605]],[[126477,126477],"mapped",[1606]],[[126478,126478],"mapped",[1587]],[[126479,126479],"mapped",[1593]],[[126480,126480],"mapped",[1601]],[[126481,126481],"mapped",[1589]],[[126482,126482],"mapped",[1602]],[[126483,126483],"mapped",[1585]],[[126484,126484],"mapped",[1588]],[[126485,126485],"mapped",[1578]],[[126486,126486],"mapped",[1579]],[[126487,126487],"mapped",[1582]],[[126488,126488],"mapped",[1584]],[[126489,126489],"mapped",[1590]],[[126490,126490],"mapped",[1592]],[[126491,126491],"mapped",[1594]],[[126492,126492],"mapped",[1646]],[[126493,126493],"mapped",[1722]],[[126494,126494],"mapped",[1697]],[[126495,126495],"mapped",[1647]],[[126496,126496],"disallowed"],[[126497,126497],"mapped",[1576]],[[126498,126498],"mapped",[1580]],[[126499,126499],"disallowed"],[[126500,126500],"mapped",[1607]],[[126501,126502],"disallowed"],[[126503,126503],"mapped",[1581]],[[126504,126504],"disallowed"],[[126505,126505],"mapped",[1610]],[[126506,126506],"mapped",[1603]],[[126507,126507],"mapped",[1604]],[[126508,126508],"mapped",[1605]],[[126509,126509],"mapped",[1606]],[[126510,126510],"mapped",[1587]],[[126511,126511],"mapped",[1593]],[[126512,126512],"mapped",[1601]],[[126513,126513],"mapped",[1589]],[[126514,126514],"mapped",[1602]],[[126515,126515],"disallowed"],[[126516,126516],"mapped",[1588]],[[126517,126517],"mapped",[1578]],[[126518,126518],"mapped",[1579]],[[126519,126519],"mapped",[1582]],[[126520,126520],"disallowed"],[[126521,126521],"mapped",[1590]],[[126522,126522],"disallowed"],[[126523,126523],"mapped",[1594]],[[126524,126529],"disallowed"],[[126530,126530],"mapped",[1580]],[[126531,126534],"disallowed"],[[126535,126535],"mapped",[1581]],[[126536,126536],"disallowed"],[[126537,126537],"mapped",[1610]],[[126538,126538],"disallowed"],[[126539,126539],"mapped",[1604]],[[126540,126540],"disallowed"],[[126541,126541],"mapped",[1606]],[[126542,126542],"mapped",[1587]],[[126543,126543],"mapped",[1593]],[[126544,126544],"disallowed"],[[126545,126545],"mapped",[1589]],[[126546,126546],"mapped",[1602]],[[126547,126547],"disallowed"],[[126548,126548],"mapped",[1588]],[[126549,126550],"disallowed"],[[126551,126551],"mapped",[1582]],[[126552,126552],"disallowed"],[[126553,126553],"mapped",[1590]],[[126554,126554],"disallowed"],[[126555,126555],"mapped",[1594]],[[126556,126556],"disallowed"],[[126557,126557],"mapped",[1722]],[[126558,126558],"disallowed"],[[126559,126559],"mapped",[1647]],[[126560,126560],"disallowed"],[[126561,126561],"mapped",[1576]],[[126562,126562],"mapped",[1580]],[[126563,126563],"disallowed"],[[126564,126564],"mapped",[1607]],[[126565,126566],"disallowed"],[[126567,126567],"mapped",[1581]],[[126568,126568],"mapped",[1591]],[[126569,126569],"mapped",[1610]],[[126570,126570],"mapped",[1603]],[[126571,126571],"disallowed"],[[126572,126572],"mapped",[1605]],[[126573,126573],"mapped",[1606]],[[126574,126574],"mapped",[1587]],[[126575,126575],"mapped",[1593]],[[126576,126576],"mapped",[1601]],[[126577,126577],"mapped",[1589]],[[126578,126578],"mapped",[1602]],[[126579,126579],"disallowed"],[[126580,126580],"mapped",[1588]],[[126581,126581],"mapped",[1578]],[[126582,126582],"mapped",[1579]],[[126583,126583],"mapped",[1582]],[[126584,126584],"disallowed"],[[126585,126585],"mapped",[1590]],[[126586,126586],"mapped",[1592]],[[126587,126587],"mapped",[1594]],[[126588,126588],"mapped",[1646]],[[126589,126589],"disallowed"],[[126590,126590],"mapped",[1697]],[[126591,126591],"disallowed"],[[126592,126592],"mapped",[1575]],[[126593,126593],"mapped",[1576]],[[126594,126594],"mapped",[1580]],[[126595,126595],"mapped",[1583]],[[126596,126596],"mapped",[1607]],[[126597,126597],"mapped",[1608]],[[126598,126598],"mapped",[1586]],[[126599,126599],"mapped",[1581]],[[126600,126600],"mapped",[1591]],[[126601,126601],"mapped",[1610]],[[126602,126602],"disallowed"],[[126603,126603],"mapped",[1604]],[[126604,126604],"mapped",[1605]],[[126605,126605],"mapped",[1606]],[[126606,126606],"mapped",[1587]],[[126607,126607],"mapped",[1593]],[[126608,126608],"mapped",[1601]],[[126609,126609],"mapped",[1589]],[[126610,126610],"mapped",[1602]],[[126611,126611],"mapped",[1585]],[[126612,126612],"mapped",[1588]],[[126613,126613],"mapped",[1578]],[[126614,126614],"mapped",[1579]],[[126615,126615],"mapped",[1582]],[[126616,126616],"mapped",[1584]],[[126617,126617],"mapped",[1590]],[[126618,126618],"mapped",[1592]],[[126619,126619],"mapped",[1594]],[[126620,126624],"disallowed"],[[126625,126625],"mapped",[1576]],[[126626,126626],"mapped",[1580]],[[126627,126627],"mapped",[1583]],[[126628,126628],"disallowed"],[[126629,126629],"mapped",[1608]],[[126630,126630],"mapped",[1586]],[[126631,126631],"mapped",[1581]],[[126632,126632],"mapped",[1591]],[[126633,126633],"mapped",[1610]],[[126634,126634],"disallowed"],[[126635,126635],"mapped",[1604]],[[126636,126636],"mapped",[1605]],[[126637,126637],"mapped",[1606]],[[126638,126638],"mapped",[1587]],[[126639,126639],"mapped",[1593]],[[126640,126640],"mapped",[1601]],[[126641,126641],"mapped",[1589]],[[126642,126642],"mapped",[1602]],[[126643,126643],"mapped",[1585]],[[126644,126644],"mapped",[1588]],[[126645,126645],"mapped",[1578]],[[126646,126646],"mapped",[1579]],[[126647,126647],"mapped",[1582]],[[126648,126648],"mapped",[1584]],[[126649,126649],"mapped",[1590]],[[126650,126650],"mapped",[1592]],[[126651,126651],"mapped",[1594]],[[126652,126703],"disallowed"],[[126704,126705],"valid",[],"NV8"],[[126706,126975],"disallowed"],[[126976,127019],"valid",[],"NV8"],[[127020,127023],"disallowed"],[[127024,127123],"valid",[],"NV8"],[[127124,127135],"disallowed"],[[127136,127150],"valid",[],"NV8"],[[127151,127152],"disallowed"],[[127153,127166],"valid",[],"NV8"],[[127167,127167],"valid",[],"NV8"],[[127168,127168],"disallowed"],[[127169,127183],"valid",[],"NV8"],[[127184,127184],"disallowed"],[[127185,127199],"valid",[],"NV8"],[[127200,127221],"valid",[],"NV8"],[[127222,127231],"disallowed"],[[127232,127232],"disallowed"],[[127233,127233],"disallowed_STD3_mapped",[48,44]],[[127234,127234],"disallowed_STD3_mapped",[49,44]],[[127235,127235],"disallowed_STD3_mapped",[50,44]],[[127236,127236],"disallowed_STD3_mapped",[51,44]],[[127237,127237],"disallowed_STD3_mapped",[52,44]],[[127238,127238],"disallowed_STD3_mapped",[53,44]],[[127239,127239],"disallowed_STD3_mapped",[54,44]],[[127240,127240],"disallowed_STD3_mapped",[55,44]],[[127241,127241],"disallowed_STD3_mapped",[56,44]],[[127242,127242],"disallowed_STD3_mapped",[57,44]],[[127243,127244],"valid",[],"NV8"],[[127245,127247],"disallowed"],[[127248,127248],"disallowed_STD3_mapped",[40,97,41]],[[127249,127249],"disallowed_STD3_mapped",[40,98,41]],[[127250,127250],"disallowed_STD3_mapped",[40,99,41]],[[127251,127251],"disallowed_STD3_mapped",[40,100,41]],[[127252,127252],"disallowed_STD3_mapped",[40,101,41]],[[127253,127253],"disallowed_STD3_mapped",[40,102,41]],[[127254,127254],"disallowed_STD3_mapped",[40,103,41]],[[127255,127255],"disallowed_STD3_mapped",[40,104,41]],[[127256,127256],"disallowed_STD3_mapped",[40,105,41]],[[127257,127257],"disallowed_STD3_mapped",[40,106,41]],[[127258,127258],"disallowed_STD3_mapped",[40,107,41]],[[127259,127259],"disallowed_STD3_mapped",[40,108,41]],[[127260,127260],"disallowed_STD3_mapped",[40,109,41]],[[127261,127261],"disallowed_STD3_mapped",[40,110,41]],[[127262,127262],"disallowed_STD3_mapped",[40,111,41]],[[127263,127263],"disallowed_STD3_mapped",[40,112,41]],[[127264,127264],"disallowed_STD3_mapped",[40,113,41]],[[127265,127265],"disallowed_STD3_mapped",[40,114,41]],[[127266,127266],"disallowed_STD3_mapped",[40,115,41]],[[127267,127267],"disallowed_STD3_mapped",[40,116,41]],[[127268,127268],"disallowed_STD3_mapped",[40,117,41]],[[127269,127269],"disallowed_STD3_mapped",[40,118,41]],[[127270,127270],"disallowed_STD3_mapped",[40,119,41]],[[127271,127271],"disallowed_STD3_mapped",[40,120,41]],[[127272,127272],"disallowed_STD3_mapped",[40,121,41]],[[127273,127273],"disallowed_STD3_mapped",[40,122,41]],[[127274,127274],"mapped",[12308,115,12309]],[[127275,127275],"mapped",[99]],[[127276,127276],"mapped",[114]],[[127277,127277],"mapped",[99,100]],[[127278,127278],"mapped",[119,122]],[[127279,127279],"disallowed"],[[127280,127280],"mapped",[97]],[[127281,127281],"mapped",[98]],[[127282,127282],"mapped",[99]],[[127283,127283],"mapped",[100]],[[127284,127284],"mapped",[101]],[[127285,127285],"mapped",[102]],[[127286,127286],"mapped",[103]],[[127287,127287],"mapped",[104]],[[127288,127288],"mapped",[105]],[[127289,127289],"mapped",[106]],[[127290,127290],"mapped",[107]],[[127291,127291],"mapped",[108]],[[127292,127292],"mapped",[109]],[[127293,127293],"mapped",[110]],[[127294,127294],"mapped",[111]],[[127295,127295],"mapped",[112]],[[127296,127296],"mapped",[113]],[[127297,127297],"mapped",[114]],[[127298,127298],"mapped",[115]],[[127299,127299],"mapped",[116]],[[127300,127300],"mapped",[117]],[[127301,127301],"mapped",[118]],[[127302,127302],"mapped",[119]],[[127303,127303],"mapped",[120]],[[127304,127304],"mapped",[121]],[[127305,127305],"mapped",[122]],[[127306,127306],"mapped",[104,118]],[[127307,127307],"mapped",[109,118]],[[127308,127308],"mapped",[115,100]],[[127309,127309],"mapped",[115,115]],[[127310,127310],"mapped",[112,112,118]],[[127311,127311],"mapped",[119,99]],[[127312,127318],"valid",[],"NV8"],[[127319,127319],"valid",[],"NV8"],[[127320,127326],"valid",[],"NV8"],[[127327,127327],"valid",[],"NV8"],[[127328,127337],"valid",[],"NV8"],[[127338,127338],"mapped",[109,99]],[[127339,127339],"mapped",[109,100]],[[127340,127343],"disallowed"],[[127344,127352],"valid",[],"NV8"],[[127353,127353],"valid",[],"NV8"],[[127354,127354],"valid",[],"NV8"],[[127355,127356],"valid",[],"NV8"],[[127357,127358],"valid",[],"NV8"],[[127359,127359],"valid",[],"NV8"],[[127360,127369],"valid",[],"NV8"],[[127370,127373],"valid",[],"NV8"],[[127374,127375],"valid",[],"NV8"],[[127376,127376],"mapped",[100,106]],[[127377,127386],"valid",[],"NV8"],[[127387,127461],"disallowed"],[[127462,127487],"valid",[],"NV8"],[[127488,127488],"mapped",[12411,12363]],[[127489,127489],"mapped",[12467,12467]],[[127490,127490],"mapped",[12469]],[[127491,127503],"disallowed"],[[127504,127504],"mapped",[25163]],[[127505,127505],"mapped",[23383]],[[127506,127506],"mapped",[21452]],[[127507,127507],"mapped",[12487]],[[127508,127508],"mapped",[20108]],[[127509,127509],"mapped",[22810]],[[127510,127510],"mapped",[35299]],[[127511,127511],"mapped",[22825]],[[127512,127512],"mapped",[20132]],[[127513,127513],"mapped",[26144]],[[127514,127514],"mapped",[28961]],[[127515,127515],"mapped",[26009]],[[127516,127516],"mapped",[21069]],[[127517,127517],"mapped",[24460]],[[127518,127518],"mapped",[20877]],[[127519,127519],"mapped",[26032]],[[127520,127520],"mapped",[21021]],[[127521,127521],"mapped",[32066]],[[127522,127522],"mapped",[29983]],[[127523,127523],"mapped",[36009]],[[127524,127524],"mapped",[22768]],[[127525,127525],"mapped",[21561]],[[127526,127526],"mapped",[28436]],[[127527,127527],"mapped",[25237]],[[127528,127528],"mapped",[25429]],[[127529,127529],"mapped",[19968]],[[127530,127530],"mapped",[19977]],[[127531,127531],"mapped",[36938]],[[127532,127532],"mapped",[24038]],[[127533,127533],"mapped",[20013]],[[127534,127534],"mapped",[21491]],[[127535,127535],"mapped",[25351]],[[127536,127536],"mapped",[36208]],[[127537,127537],"mapped",[25171]],[[127538,127538],"mapped",[31105]],[[127539,127539],"mapped",[31354]],[[127540,127540],"mapped",[21512]],[[127541,127541],"mapped",[28288]],[[127542,127542],"mapped",[26377]],[[127543,127543],"mapped",[26376]],[[127544,127544],"mapped",[30003]],[[127545,127545],"mapped",[21106]],[[127546,127546],"mapped",[21942]],[[127547,127551],"disallowed"],[[127552,127552],"mapped",[12308,26412,12309]],[[127553,127553],"mapped",[12308,19977,12309]],[[127554,127554],"mapped",[12308,20108,12309]],[[127555,127555],"mapped",[12308,23433,12309]],[[127556,127556],"mapped",[12308,28857,12309]],[[127557,127557],"mapped",[12308,25171,12309]],[[127558,127558],"mapped",[12308,30423,12309]],[[127559,127559],"mapped",[12308,21213,12309]],[[127560,127560],"mapped",[12308,25943,12309]],[[127561,127567],"disallowed"],[[127568,127568],"mapped",[24471]],[[127569,127569],"mapped",[21487]],[[127570,127743],"disallowed"],[[127744,127776],"valid",[],"NV8"],[[127777,127788],"valid",[],"NV8"],[[127789,127791],"valid",[],"NV8"],[[127792,127797],"valid",[],"NV8"],[[127798,127798],"valid",[],"NV8"],[[127799,127868],"valid",[],"NV8"],[[127869,127869],"valid",[],"NV8"],[[127870,127871],"valid",[],"NV8"],[[127872,127891],"valid",[],"NV8"],[[127892,127903],"valid",[],"NV8"],[[127904,127940],"valid",[],"NV8"],[[127941,127941],"valid",[],"NV8"],[[127942,127946],"valid",[],"NV8"],[[127947,127950],"valid",[],"NV8"],[[127951,127955],"valid",[],"NV8"],[[127956,127967],"valid",[],"NV8"],[[127968,127984],"valid",[],"NV8"],[[127985,127991],"valid",[],"NV8"],[[127992,127999],"valid",[],"NV8"],[[128e3,128062],"valid",[],"NV8"],[[128063,128063],"valid",[],"NV8"],[[128064,128064],"valid",[],"NV8"],[[128065,128065],"valid",[],"NV8"],[[128066,128247],"valid",[],"NV8"],[[128248,128248],"valid",[],"NV8"],[[128249,128252],"valid",[],"NV8"],[[128253,128254],"valid",[],"NV8"],[[128255,128255],"valid",[],"NV8"],[[128256,128317],"valid",[],"NV8"],[[128318,128319],"valid",[],"NV8"],[[128320,128323],"valid",[],"NV8"],[[128324,128330],"valid",[],"NV8"],[[128331,128335],"valid",[],"NV8"],[[128336,128359],"valid",[],"NV8"],[[128360,128377],"valid",[],"NV8"],[[128378,128378],"disallowed"],[[128379,128419],"valid",[],"NV8"],[[128420,128420],"disallowed"],[[128421,128506],"valid",[],"NV8"],[[128507,128511],"valid",[],"NV8"],[[128512,128512],"valid",[],"NV8"],[[128513,128528],"valid",[],"NV8"],[[128529,128529],"valid",[],"NV8"],[[128530,128532],"valid",[],"NV8"],[[128533,128533],"valid",[],"NV8"],[[128534,128534],"valid",[],"NV8"],[[128535,128535],"valid",[],"NV8"],[[128536,128536],"valid",[],"NV8"],[[128537,128537],"valid",[],"NV8"],[[128538,128538],"valid",[],"NV8"],[[128539,128539],"valid",[],"NV8"],[[128540,128542],"valid",[],"NV8"],[[128543,128543],"valid",[],"NV8"],[[128544,128549],"valid",[],"NV8"],[[128550,128551],"valid",[],"NV8"],[[128552,128555],"valid",[],"NV8"],[[128556,128556],"valid",[],"NV8"],[[128557,128557],"valid",[],"NV8"],[[128558,128559],"valid",[],"NV8"],[[128560,128563],"valid",[],"NV8"],[[128564,128564],"valid",[],"NV8"],[[128565,128576],"valid",[],"NV8"],[[128577,128578],"valid",[],"NV8"],[[128579,128580],"valid",[],"NV8"],[[128581,128591],"valid",[],"NV8"],[[128592,128639],"valid",[],"NV8"],[[128640,128709],"valid",[],"NV8"],[[128710,128719],"valid",[],"NV8"],[[128720,128720],"valid",[],"NV8"],[[128721,128735],"disallowed"],[[128736,128748],"valid",[],"NV8"],[[128749,128751],"disallowed"],[[128752,128755],"valid",[],"NV8"],[[128756,128767],"disallowed"],[[128768,128883],"valid",[],"NV8"],[[128884,128895],"disallowed"],[[128896,128980],"valid",[],"NV8"],[[128981,129023],"disallowed"],[[129024,129035],"valid",[],"NV8"],[[129036,129039],"disallowed"],[[129040,129095],"valid",[],"NV8"],[[129096,129103],"disallowed"],[[129104,129113],"valid",[],"NV8"],[[129114,129119],"disallowed"],[[129120,129159],"valid",[],"NV8"],[[129160,129167],"disallowed"],[[129168,129197],"valid",[],"NV8"],[[129198,129295],"disallowed"],[[129296,129304],"valid",[],"NV8"],[[129305,129407],"disallowed"],[[129408,129412],"valid",[],"NV8"],[[129413,129471],"disallowed"],[[129472,129472],"valid",[],"NV8"],[[129473,131069],"disallowed"],[[131070,131071],"disallowed"],[[131072,173782],"valid"],[[173783,173823],"disallowed"],[[173824,177972],"valid"],[[177973,177983],"disallowed"],[[177984,178205],"valid"],[[178206,178207],"disallowed"],[[178208,183969],"valid"],[[183970,194559],"disallowed"],[[194560,194560],"mapped",[20029]],[[194561,194561],"mapped",[20024]],[[194562,194562],"mapped",[20033]],[[194563,194563],"mapped",[131362]],[[194564,194564],"mapped",[20320]],[[194565,194565],"mapped",[20398]],[[194566,194566],"mapped",[20411]],[[194567,194567],"mapped",[20482]],[[194568,194568],"mapped",[20602]],[[194569,194569],"mapped",[20633]],[[194570,194570],"mapped",[20711]],[[194571,194571],"mapped",[20687]],[[194572,194572],"mapped",[13470]],[[194573,194573],"mapped",[132666]],[[194574,194574],"mapped",[20813]],[[194575,194575],"mapped",[20820]],[[194576,194576],"mapped",[20836]],[[194577,194577],"mapped",[20855]],[[194578,194578],"mapped",[132380]],[[194579,194579],"mapped",[13497]],[[194580,194580],"mapped",[20839]],[[194581,194581],"mapped",[20877]],[[194582,194582],"mapped",[132427]],[[194583,194583],"mapped",[20887]],[[194584,194584],"mapped",[20900]],[[194585,194585],"mapped",[20172]],[[194586,194586],"mapped",[20908]],[[194587,194587],"mapped",[20917]],[[194588,194588],"mapped",[168415]],[[194589,194589],"mapped",[20981]],[[194590,194590],"mapped",[20995]],[[194591,194591],"mapped",[13535]],[[194592,194592],"mapped",[21051]],[[194593,194593],"mapped",[21062]],[[194594,194594],"mapped",[21106]],[[194595,194595],"mapped",[21111]],[[194596,194596],"mapped",[13589]],[[194597,194597],"mapped",[21191]],[[194598,194598],"mapped",[21193]],[[194599,194599],"mapped",[21220]],[[194600,194600],"mapped",[21242]],[[194601,194601],"mapped",[21253]],[[194602,194602],"mapped",[21254]],[[194603,194603],"mapped",[21271]],[[194604,194604],"mapped",[21321]],[[194605,194605],"mapped",[21329]],[[194606,194606],"mapped",[21338]],[[194607,194607],"mapped",[21363]],[[194608,194608],"mapped",[21373]],[[194609,194611],"mapped",[21375]],[[194612,194612],"mapped",[133676]],[[194613,194613],"mapped",[28784]],[[194614,194614],"mapped",[21450]],[[194615,194615],"mapped",[21471]],[[194616,194616],"mapped",[133987]],[[194617,194617],"mapped",[21483]],[[194618,194618],"mapped",[21489]],[[194619,194619],"mapped",[21510]],[[194620,194620],"mapped",[21662]],[[194621,194621],"mapped",[21560]],[[194622,194622],"mapped",[21576]],[[194623,194623],"mapped",[21608]],[[194624,194624],"mapped",[21666]],[[194625,194625],"mapped",[21750]],[[194626,194626],"mapped",[21776]],[[194627,194627],"mapped",[21843]],[[194628,194628],"mapped",[21859]],[[194629,194630],"mapped",[21892]],[[194631,194631],"mapped",[21913]],[[194632,194632],"mapped",[21931]],[[194633,194633],"mapped",[21939]],[[194634,194634],"mapped",[21954]],[[194635,194635],"mapped",[22294]],[[194636,194636],"mapped",[22022]],[[194637,194637],"mapped",[22295]],[[194638,194638],"mapped",[22097]],[[194639,194639],"mapped",[22132]],[[194640,194640],"mapped",[20999]],[[194641,194641],"mapped",[22766]],[[194642,194642],"mapped",[22478]],[[194643,194643],"mapped",[22516]],[[194644,194644],"mapped",[22541]],[[194645,194645],"mapped",[22411]],[[194646,194646],"mapped",[22578]],[[194647,194647],"mapped",[22577]],[[194648,194648],"mapped",[22700]],[[194649,194649],"mapped",[136420]],[[194650,194650],"mapped",[22770]],[[194651,194651],"mapped",[22775]],[[194652,194652],"mapped",[22790]],[[194653,194653],"mapped",[22810]],[[194654,194654],"mapped",[22818]],[[194655,194655],"mapped",[22882]],[[194656,194656],"mapped",[136872]],[[194657,194657],"mapped",[136938]],[[194658,194658],"mapped",[23020]],[[194659,194659],"mapped",[23067]],[[194660,194660],"mapped",[23079]],[[194661,194661],"mapped",[23e3]],[[194662,194662],"mapped",[23142]],[[194663,194663],"mapped",[14062]],[[194664,194664],"disallowed"],[[194665,194665],"mapped",[23304]],[[194666,194667],"mapped",[23358]],[[194668,194668],"mapped",[137672]],[[194669,194669],"mapped",[23491]],[[194670,194670],"mapped",[23512]],[[194671,194671],"mapped",[23527]],[[194672,194672],"mapped",[23539]],[[194673,194673],"mapped",[138008]],[[194674,194674],"mapped",[23551]],[[194675,194675],"mapped",[23558]],[[194676,194676],"disallowed"],[[194677,194677],"mapped",[23586]],[[194678,194678],"mapped",[14209]],[[194679,194679],"mapped",[23648]],[[194680,194680],"mapped",[23662]],[[194681,194681],"mapped",[23744]],[[194682,194682],"mapped",[23693]],[[194683,194683],"mapped",[138724]],[[194684,194684],"mapped",[23875]],[[194685,194685],"mapped",[138726]],[[194686,194686],"mapped",[23918]],[[194687,194687],"mapped",[23915]],[[194688,194688],"mapped",[23932]],[[194689,194689],"mapped",[24033]],[[194690,194690],"mapped",[24034]],[[194691,194691],"mapped",[14383]],[[194692,194692],"mapped",[24061]],[[194693,194693],"mapped",[24104]],[[194694,194694],"mapped",[24125]],[[194695,194695],"mapped",[24169]],[[194696,194696],"mapped",[14434]],[[194697,194697],"mapped",[139651]],[[194698,194698],"mapped",[14460]],[[194699,194699],"mapped",[24240]],[[194700,194700],"mapped",[24243]],[[194701,194701],"mapped",[24246]],[[194702,194702],"mapped",[24266]],[[194703,194703],"mapped",[172946]],[[194704,194704],"mapped",[24318]],[[194705,194706],"mapped",[140081]],[[194707,194707],"mapped",[33281]],[[194708,194709],"mapped",[24354]],[[194710,194710],"mapped",[14535]],[[194711,194711],"mapped",[144056]],[[194712,194712],"mapped",[156122]],[[194713,194713],"mapped",[24418]],[[194714,194714],"mapped",[24427]],[[194715,194715],"mapped",[14563]],[[194716,194716],"mapped",[24474]],[[194717,194717],"mapped",[24525]],[[194718,194718],"mapped",[24535]],[[194719,194719],"mapped",[24569]],[[194720,194720],"mapped",[24705]],[[194721,194721],"mapped",[14650]],[[194722,194722],"mapped",[14620]],[[194723,194723],"mapped",[24724]],[[194724,194724],"mapped",[141012]],[[194725,194725],"mapped",[24775]],[[194726,194726],"mapped",[24904]],[[194727,194727],"mapped",[24908]],[[194728,194728],"mapped",[24910]],[[194729,194729],"mapped",[24908]],[[194730,194730],"mapped",[24954]],[[194731,194731],"mapped",[24974]],[[194732,194732],"mapped",[25010]],[[194733,194733],"mapped",[24996]],[[194734,194734],"mapped",[25007]],[[194735,194735],"mapped",[25054]],[[194736,194736],"mapped",[25074]],[[194737,194737],"mapped",[25078]],[[194738,194738],"mapped",[25104]],[[194739,194739],"mapped",[25115]],[[194740,194740],"mapped",[25181]],[[194741,194741],"mapped",[25265]],[[194742,194742],"mapped",[25300]],[[194743,194743],"mapped",[25424]],[[194744,194744],"mapped",[142092]],[[194745,194745],"mapped",[25405]],[[194746,194746],"mapped",[25340]],[[194747,194747],"mapped",[25448]],[[194748,194748],"mapped",[25475]],[[194749,194749],"mapped",[25572]],[[194750,194750],"mapped",[142321]],[[194751,194751],"mapped",[25634]],[[194752,194752],"mapped",[25541]],[[194753,194753],"mapped",[25513]],[[194754,194754],"mapped",[14894]],[[194755,194755],"mapped",[25705]],[[194756,194756],"mapped",[25726]],[[194757,194757],"mapped",[25757]],[[194758,194758],"mapped",[25719]],[[194759,194759],"mapped",[14956]],[[194760,194760],"mapped",[25935]],[[194761,194761],"mapped",[25964]],[[194762,194762],"mapped",[143370]],[[194763,194763],"mapped",[26083]],[[194764,194764],"mapped",[26360]],[[194765,194765],"mapped",[26185]],[[194766,194766],"mapped",[15129]],[[194767,194767],"mapped",[26257]],[[194768,194768],"mapped",[15112]],[[194769,194769],"mapped",[15076]],[[194770,194770],"mapped",[20882]],[[194771,194771],"mapped",[20885]],[[194772,194772],"mapped",[26368]],[[194773,194773],"mapped",[26268]],[[194774,194774],"mapped",[32941]],[[194775,194775],"mapped",[17369]],[[194776,194776],"mapped",[26391]],[[194777,194777],"mapped",[26395]],[[194778,194778],"mapped",[26401]],[[194779,194779],"mapped",[26462]],[[194780,194780],"mapped",[26451]],[[194781,194781],"mapped",[144323]],[[194782,194782],"mapped",[15177]],[[194783,194783],"mapped",[26618]],[[194784,194784],"mapped",[26501]],[[194785,194785],"mapped",[26706]],[[194786,194786],"mapped",[26757]],[[194787,194787],"mapped",[144493]],[[194788,194788],"mapped",[26766]],[[194789,194789],"mapped",[26655]],[[194790,194790],"mapped",[26900]],[[194791,194791],"mapped",[15261]],[[194792,194792],"mapped",[26946]],[[194793,194793],"mapped",[27043]],[[194794,194794],"mapped",[27114]],[[194795,194795],"mapped",[27304]],[[194796,194796],"mapped",[145059]],[[194797,194797],"mapped",[27355]],[[194798,194798],"mapped",[15384]],[[194799,194799],"mapped",[27425]],[[194800,194800],"mapped",[145575]],[[194801,194801],"mapped",[27476]],[[194802,194802],"mapped",[15438]],[[194803,194803],"mapped",[27506]],[[194804,194804],"mapped",[27551]],[[194805,194805],"mapped",[27578]],[[194806,194806],"mapped",[27579]],[[194807,194807],"mapped",[146061]],[[194808,194808],"mapped",[138507]],[[194809,194809],"mapped",[146170]],[[194810,194810],"mapped",[27726]],[[194811,194811],"mapped",[146620]],[[194812,194812],"mapped",[27839]],[[194813,194813],"mapped",[27853]],[[194814,194814],"mapped",[27751]],[[194815,194815],"mapped",[27926]],[[194816,194816],"mapped",[27966]],[[194817,194817],"mapped",[28023]],[[194818,194818],"mapped",[27969]],[[194819,194819],"mapped",[28009]],[[194820,194820],"mapped",[28024]],[[194821,194821],"mapped",[28037]],[[194822,194822],"mapped",[146718]],[[194823,194823],"mapped",[27956]],[[194824,194824],"mapped",[28207]],[[194825,194825],"mapped",[28270]],[[194826,194826],"mapped",[15667]],[[194827,194827],"mapped",[28363]],[[194828,194828],"mapped",[28359]],[[194829,194829],"mapped",[147153]],[[194830,194830],"mapped",[28153]],[[194831,194831],"mapped",[28526]],[[194832,194832],"mapped",[147294]],[[194833,194833],"mapped",[147342]],[[194834,194834],"mapped",[28614]],[[194835,194835],"mapped",[28729]],[[194836,194836],"mapped",[28702]],[[194837,194837],"mapped",[28699]],[[194838,194838],"mapped",[15766]],[[194839,194839],"mapped",[28746]],[[194840,194840],"mapped",[28797]],[[194841,194841],"mapped",[28791]],[[194842,194842],"mapped",[28845]],[[194843,194843],"mapped",[132389]],[[194844,194844],"mapped",[28997]],[[194845,194845],"mapped",[148067]],[[194846,194846],"mapped",[29084]],[[194847,194847],"disallowed"],[[194848,194848],"mapped",[29224]],[[194849,194849],"mapped",[29237]],[[194850,194850],"mapped",[29264]],[[194851,194851],"mapped",[149e3]],[[194852,194852],"mapped",[29312]],[[194853,194853],"mapped",[29333]],[[194854,194854],"mapped",[149301]],[[194855,194855],"mapped",[149524]],[[194856,194856],"mapped",[29562]],[[194857,194857],"mapped",[29579]],[[194858,194858],"mapped",[16044]],[[194859,194859],"mapped",[29605]],[[194860,194861],"mapped",[16056]],[[194862,194862],"mapped",[29767]],[[194863,194863],"mapped",[29788]],[[194864,194864],"mapped",[29809]],[[194865,194865],"mapped",[29829]],[[194866,194866],"mapped",[29898]],[[194867,194867],"mapped",[16155]],[[194868,194868],"mapped",[29988]],[[194869,194869],"mapped",[150582]],[[194870,194870],"mapped",[30014]],[[194871,194871],"mapped",[150674]],[[194872,194872],"mapped",[30064]],[[194873,194873],"mapped",[139679]],[[194874,194874],"mapped",[30224]],[[194875,194875],"mapped",[151457]],[[194876,194876],"mapped",[151480]],[[194877,194877],"mapped",[151620]],[[194878,194878],"mapped",[16380]],[[194879,194879],"mapped",[16392]],[[194880,194880],"mapped",[30452]],[[194881,194881],"mapped",[151795]],[[194882,194882],"mapped",[151794]],[[194883,194883],"mapped",[151833]],[[194884,194884],"mapped",[151859]],[[194885,194885],"mapped",[30494]],[[194886,194887],"mapped",[30495]],[[194888,194888],"mapped",[30538]],[[194889,194889],"mapped",[16441]],[[194890,194890],"mapped",[30603]],[[194891,194891],"mapped",[16454]],[[194892,194892],"mapped",[16534]],[[194893,194893],"mapped",[152605]],[[194894,194894],"mapped",[30798]],[[194895,194895],"mapped",[30860]],[[194896,194896],"mapped",[30924]],[[194897,194897],"mapped",[16611]],[[194898,194898],"mapped",[153126]],[[194899,194899],"mapped",[31062]],[[194900,194900],"mapped",[153242]],[[194901,194901],"mapped",[153285]],[[194902,194902],"mapped",[31119]],[[194903,194903],"mapped",[31211]],[[194904,194904],"mapped",[16687]],[[194905,194905],"mapped",[31296]],[[194906,194906],"mapped",[31306]],[[194907,194907],"mapped",[31311]],[[194908,194908],"mapped",[153980]],[[194909,194910],"mapped",[154279]],[[194911,194911],"disallowed"],[[194912,194912],"mapped",[16898]],[[194913,194913],"mapped",[154539]],[[194914,194914],"mapped",[31686]],[[194915,194915],"mapped",[31689]],[[194916,194916],"mapped",[16935]],[[194917,194917],"mapped",[154752]],[[194918,194918],"mapped",[31954]],[[194919,194919],"mapped",[17056]],[[194920,194920],"mapped",[31976]],[[194921,194921],"mapped",[31971]],[[194922,194922],"mapped",[32e3]],[[194923,194923],"mapped",[155526]],[[194924,194924],"mapped",[32099]],[[194925,194925],"mapped",[17153]],[[194926,194926],"mapped",[32199]],[[194927,194927],"mapped",[32258]],[[194928,194928],"mapped",[32325]],[[194929,194929],"mapped",[17204]],[[194930,194930],"mapped",[156200]],[[194931,194931],"mapped",[156231]],[[194932,194932],"mapped",[17241]],[[194933,194933],"mapped",[156377]],[[194934,194934],"mapped",[32634]],[[194935,194935],"mapped",[156478]],[[194936,194936],"mapped",[32661]],[[194937,194937],"mapped",[32762]],[[194938,194938],"mapped",[32773]],[[194939,194939],"mapped",[156890]],[[194940,194940],"mapped",[156963]],[[194941,194941],"mapped",[32864]],[[194942,194942],"mapped",[157096]],[[194943,194943],"mapped",[32880]],[[194944,194944],"mapped",[144223]],[[194945,194945],"mapped",[17365]],[[194946,194946],"mapped",[32946]],[[194947,194947],"mapped",[33027]],[[194948,194948],"mapped",[17419]],[[194949,194949],"mapped",[33086]],[[194950,194950],"mapped",[23221]],[[194951,194951],"mapped",[157607]],[[194952,194952],"mapped",[157621]],[[194953,194953],"mapped",[144275]],[[194954,194954],"mapped",[144284]],[[194955,194955],"mapped",[33281]],[[194956,194956],"mapped",[33284]],[[194957,194957],"mapped",[36766]],[[194958,194958],"mapped",[17515]],[[194959,194959],"mapped",[33425]],[[194960,194960],"mapped",[33419]],[[194961,194961],"mapped",[33437]],[[194962,194962],"mapped",[21171]],[[194963,194963],"mapped",[33457]],[[194964,194964],"mapped",[33459]],[[194965,194965],"mapped",[33469]],[[194966,194966],"mapped",[33510]],[[194967,194967],"mapped",[158524]],[[194968,194968],"mapped",[33509]],[[194969,194969],"mapped",[33565]],[[194970,194970],"mapped",[33635]],[[194971,194971],"mapped",[33709]],[[194972,194972],"mapped",[33571]],[[194973,194973],"mapped",[33725]],[[194974,194974],"mapped",[33767]],[[194975,194975],"mapped",[33879]],[[194976,194976],"mapped",[33619]],[[194977,194977],"mapped",[33738]],[[194978,194978],"mapped",[33740]],[[194979,194979],"mapped",[33756]],[[194980,194980],"mapped",[158774]],[[194981,194981],"mapped",[159083]],[[194982,194982],"mapped",[158933]],[[194983,194983],"mapped",[17707]],[[194984,194984],"mapped",[34033]],[[194985,194985],"mapped",[34035]],[[194986,194986],"mapped",[34070]],[[194987,194987],"mapped",[160714]],[[194988,194988],"mapped",[34148]],[[194989,194989],"mapped",[159532]],[[194990,194990],"mapped",[17757]],[[194991,194991],"mapped",[17761]],[[194992,194992],"mapped",[159665]],[[194993,194993],"mapped",[159954]],[[194994,194994],"mapped",[17771]],[[194995,194995],"mapped",[34384]],[[194996,194996],"mapped",[34396]],[[194997,194997],"mapped",[34407]],[[194998,194998],"mapped",[34409]],[[194999,194999],"mapped",[34473]],[[195e3,195e3],"mapped",[34440]],[[195001,195001],"mapped",[34574]],[[195002,195002],"mapped",[34530]],[[195003,195003],"mapped",[34681]],[[195004,195004],"mapped",[34600]],[[195005,195005],"mapped",[34667]],[[195006,195006],"mapped",[34694]],[[195007,195007],"disallowed"],[[195008,195008],"mapped",[34785]],[[195009,195009],"mapped",[34817]],[[195010,195010],"mapped",[17913]],[[195011,195011],"mapped",[34912]],[[195012,195012],"mapped",[34915]],[[195013,195013],"mapped",[161383]],[[195014,195014],"mapped",[35031]],[[195015,195015],"mapped",[35038]],[[195016,195016],"mapped",[17973]],[[195017,195017],"mapped",[35066]],[[195018,195018],"mapped",[13499]],[[195019,195019],"mapped",[161966]],[[195020,195020],"mapped",[162150]],[[195021,195021],"mapped",[18110]],[[195022,195022],"mapped",[18119]],[[195023,195023],"mapped",[35488]],[[195024,195024],"mapped",[35565]],[[195025,195025],"mapped",[35722]],[[195026,195026],"mapped",[35925]],[[195027,195027],"mapped",[162984]],[[195028,195028],"mapped",[36011]],[[195029,195029],"mapped",[36033]],[[195030,195030],"mapped",[36123]],[[195031,195031],"mapped",[36215]],[[195032,195032],"mapped",[163631]],[[195033,195033],"mapped",[133124]],[[195034,195034],"mapped",[36299]],[[195035,195035],"mapped",[36284]],[[195036,195036],"mapped",[36336]],[[195037,195037],"mapped",[133342]],[[195038,195038],"mapped",[36564]],[[195039,195039],"mapped",[36664]],[[195040,195040],"mapped",[165330]],[[195041,195041],"mapped",[165357]],[[195042,195042],"mapped",[37012]],[[195043,195043],"mapped",[37105]],[[195044,195044],"mapped",[37137]],[[195045,195045],"mapped",[165678]],[[195046,195046],"mapped",[37147]],[[195047,195047],"mapped",[37432]],[[195048,195048],"mapped",[37591]],[[195049,195049],"mapped",[37592]],[[195050,195050],"mapped",[37500]],[[195051,195051],"mapped",[37881]],[[195052,195052],"mapped",[37909]],[[195053,195053],"mapped",[166906]],[[195054,195054],"mapped",[38283]],[[195055,195055],"mapped",[18837]],[[195056,195056],"mapped",[38327]],[[195057,195057],"mapped",[167287]],[[195058,195058],"mapped",[18918]],[[195059,195059],"mapped",[38595]],[[195060,195060],"mapped",[23986]],[[195061,195061],"mapped",[38691]],[[195062,195062],"mapped",[168261]],[[195063,195063],"mapped",[168474]],[[195064,195064],"mapped",[19054]],[[195065,195065],"mapped",[19062]],[[195066,195066],"mapped",[38880]],[[195067,195067],"mapped",[168970]],[[195068,195068],"mapped",[19122]],[[195069,195069],"mapped",[169110]],[[195070,195071],"mapped",[38923]],[[195072,195072],"mapped",[38953]],[[195073,195073],"mapped",[169398]],[[195074,195074],"mapped",[39138]],[[195075,195075],"mapped",[19251]],[[195076,195076],"mapped",[39209]],[[195077,195077],"mapped",[39335]],[[195078,195078],"mapped",[39362]],[[195079,195079],"mapped",[39422]],[[195080,195080],"mapped",[19406]],[[195081,195081],"mapped",[170800]],[[195082,195082],"mapped",[39698]],[[195083,195083],"mapped",[4e4]],[[195084,195084],"mapped",[40189]],[[195085,195085],"mapped",[19662]],[[195086,195086],"mapped",[19693]],[[195087,195087],"mapped",[40295]],[[195088,195088],"mapped",[172238]],[[195089,195089],"mapped",[19704]],[[195090,195090],"mapped",[172293]],[[195091,195091],"mapped",[172558]],[[195092,195092],"mapped",[172689]],[[195093,195093],"mapped",[40635]],[[195094,195094],"mapped",[19798]],[[195095,195095],"mapped",[40697]],[[195096,195096],"mapped",[40702]],[[195097,195097],"mapped",[40709]],[[195098,195098],"mapped",[40719]],[[195099,195099],"mapped",[40726]],[[195100,195100],"mapped",[40763]],[[195101,195101],"mapped",[173568]],[[195102,196605],"disallowed"],[[196606,196607],"disallowed"],[[196608,262141],"disallowed"],[[262142,262143],"disallowed"],[[262144,327677],"disallowed"],[[327678,327679],"disallowed"],[[327680,393213],"disallowed"],[[393214,393215],"disallowed"],[[393216,458749],"disallowed"],[[458750,458751],"disallowed"],[[458752,524285],"disallowed"],[[524286,524287],"disallowed"],[[524288,589821],"disallowed"],[[589822,589823],"disallowed"],[[589824,655357],"disallowed"],[[655358,655359],"disallowed"],[[655360,720893],"disallowed"],[[720894,720895],"disallowed"],[[720896,786429],"disallowed"],[[786430,786431],"disallowed"],[[786432,851965],"disallowed"],[[851966,851967],"disallowed"],[[851968,917501],"disallowed"],[[917502,917503],"disallowed"],[[917504,917504],"disallowed"],[[917505,917505],"disallowed"],[[917506,917535],"disallowed"],[[917536,917631],"disallowed"],[[917632,917759],"disallowed"],[[917760,917999],"ignored"],[[918e3,983037],"disallowed"],[[983038,983039],"disallowed"],[[983040,1048573],"disallowed"],[[1048574,1048575],"disallowed"],[[1048576,1114109],"disallowed"],[[1114110,1114111],"disallowed"]]});var aE=O((Wge,L0)=>{"use strict";var rE=require("punycode"),tE=eE(),Jl={TRANSITIONAL:0,NONTRANSITIONAL:1};function iE(r){return r.split("\0").map(function(e){return e.normalize("NFC")}).join("\0")}function sE(r){for(var e=0,t=tE.length-1;e<=t;){var i=Math.floor((e+t)/2),s=tE[i];if(s[0][0]<=r&&s[0][1]>=r)return s;s[0][0]>r?t=i-1:e=i+1}return null}var YD=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;function nE(r){return r.replace(YD,"_").length}function ZD(r,e,t){for(var i=!1,s="",n=nE(r),a=0;a<n;++a){var o=r.codePointAt(a),l=sE(o);switch(l[1]){case"disallowed":i=!0,s+=String.fromCodePoint(o);break;case"ignored":break;case"mapped":s+=String.fromCodePoint.apply(String,l[2]);break;case"deviation":t===Jl.TRANSITIONAL?s+=String.fromCodePoint.apply(String,l[2]):s+=String.fromCodePoint(o);break;case"valid":s+=String.fromCodePoint(o);break;case"disallowed_STD3_mapped":e?(i=!0,s+=String.fromCodePoint(o)):s+=String.fromCodePoint.apply(String,l[2]);break;case"disallowed_STD3_valid":e&&(i=!0),s+=String.fromCodePoint(o);break}}return{string:s,error:i}}var e$=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;function t$(r,e){r.substr(0,4)==="xn--"&&(r=rE.toUnicode(r),e=Jl.NONTRANSITIONAL);var t=!1;(iE(r)!==r||r[3]==="-"&&r[4]==="-"||r[0]==="-"||r[r.length-1]==="-"||r.indexOf(".")!==-1||r.search(e$)===0)&&(t=!0);for(var i=nE(r),s=0;s<i;++s){var n=sE(r.codePointAt(s));if(F0===Jl.TRANSITIONAL&&n[1]!=="valid"||F0===Jl.NONTRANSITIONAL&&n[1]!=="valid"&&n[1]!=="deviation"){t=!0;break}}return{label:r,error:t}}function F0(r,e,t){var i=ZD(r,e,t);i.string=iE(i.string);for(var s=i.string.split("."),n=0;n<s.length;++n)try{var a=t$(s[n]);s[n]=a.label,i.error=i.error||a.error}catch{i.error=!0}return{string:s.join("."),error:i.error}}L0.exports.toASCII=function(r,e,t,i){var s=F0(r,e,t),n=s.string.split(".");if(n=n.map(function(l){try{return rE.toASCII(l)}catch{return s.error=!0,l}}),i){var a=n.slice(0,n.length-1).join(".").length;(a.length>253||a.length===0)&&(s.error=!0);for(var o=0;o<n.length;++o)if(n.length>63||n.length===0){s.error=!0;break}}return s.error?null:n.join(".")};L0.exports.toUnicode=function(r,e){var t=F0(r,e,Jl.NONTRANSITIONAL);return{domain:t.string,error:t.error}};L0.exports.PROCESSING_OPTIONS=Jl});var Ri=O((zge,vr)=>{"use strict";var Xl=require("punycode"),oE=aE(),pE={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},te=Symbol("failure");function lE(r){return Xl.ucs2.decode(r).length}function cE(r,e){let t=r[e];return isNaN(t)?void 0:String.fromCodePoint(t)}function fp(r){return r>=48&&r<=57}function gp(r){return r>=65&&r<=90||r>=97&&r<=122}function r$(r){return gp(r)||fp(r)}function ni(r){return fp(r)||r>=65&&r<=70||r>=97&&r<=102}function dE(r){return r==="."||r.toLowerCase()==="%2e"}function i$(r){return r=r.toLowerCase(),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"}function s$(r,e){return gp(r)&&(e===58||e===124)}function uE(r){return r.length===2&&gp(r.codePointAt(0))&&(r[1]===":"||r[1]==="|")}function n$(r){return r.length===2&&gp(r.codePointAt(0))&&r[1]===":"}function a$(r){return r.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/)!==-1}function o$(r){return r.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/)!==-1}function a9(r){return pE[r]!==void 0}function et(r){return a9(r.scheme)}function l$(r){return pE[r]}function mE(r){let e=r.toString(16).toUpperCase();return e.length===1&&(e="0"+e),"%"+e}function c$(r){let e=new Buffer(r),t="";for(let i=0;i<e.length;++i)t+=mE(e[i]);return t}function d$(r){let e=new Buffer(r),t=[];for(let i=0;i<e.length;++i)e[i]!==37?t.push(e[i]):e[i]===37&&ni(e[i+1])&&ni(e[i+2])?(t.push(parseInt(e.slice(i+1,i+3).toString(),16)),i+=2):t.push(e[i]);return new Buffer(t).toString()}function q0(r){return r<=31||r>126}var p$=new Set([32,34,35,60,62,63,96,123,125]);function hE(r){return q0(r)||p$.has(r)}var u$=new Set([47,58,59,61,64,91,92,93,94,124]);function l9(r){return hE(r)||u$.has(r)}function ya(r,e){let t=String.fromCodePoint(r);return e(r)?c$(t):t}function m$(r){let e=10;return r.length>=2&&r.charAt(0)==="0"&&r.charAt(1).toLowerCase()==="x"?(r=r.substring(2),e=16):r.length>=2&&r.charAt(0)==="0"&&(r=r.substring(1),e=8),r===""?0:(e===10?/[^0-9]/:e===16?/[^0-9A-Fa-f]/:/[^0-7]/).test(r)?te:parseInt(r,e)}function h$(r){let e=r.split(".");if(e[e.length-1]===""&&e.length>1&&e.pop(),e.length>4)return r;let t=[];for(let n of e){if(n==="")return r;let a=m$(n);if(a===te)return r;t.push(a)}for(let n=0;n<t.length-1;++n)if(t[n]>255)return te;if(t[t.length-1]>=Math.pow(256,5-t.length))return te;let i=t.pop(),s=0;for(let n of t)i+=n*Math.pow(256,3-s),++s;return i}function f$(r){let e="",t=r;for(let i=1;i<=4;++i)e=String(t%256)+e,i!==4&&(e="."+e),t=Math.floor(t/256);return e}function g$(r){let e=[0,0,0,0,0,0,0,0],t=0,i=null,s=0;if(r=Xl.ucs2.decode(r),r[s]===58){if(r[s+1]!==58)return te;s+=2,++t,i=t}for(;s<r.length;){if(t===8)return te;if(r[s]===58){if(i!==null)return te;++s,++t,i=t;continue}let n=0,a=0;for(;a<4&&ni(r[s]);)n=n*16+parseInt(cE(r,s),16),++s,++a;if(r[s]===46){if(a===0||(s-=a,t>6))return te;let o=0;for(;r[s]!==void 0;){let l=null;if(o>0)if(r[s]===46&&o<4)++s;else return te;if(!fp(r[s]))return te;for(;fp(r[s]);){let c=parseInt(cE(r,s));if(l===null)l=c;else{if(l===0)return te;l=l*10+c}if(l>255)return te;++s}e[t]=e[t]*256+l,++o,(o===2||o===4)&&++t}if(o!==4)return te;break}else if(r[s]===58){if(++s,r[s]===void 0)return te}else if(r[s]!==void 0)return te;e[t]=n,++t}if(i!==null){let n=t-i;for(t=7;t!==0&&n>0;){let a=e[i+n-1];e[i+n-1]=e[t],e[t]=a,--t,--n}}else if(i===null&&t!==8)return te;return e}function y$(r){let e="",i=b$(r).idx,s=!1;for(let n=0;n<=7;++n)if(!(s&&r[n]===0)){if(s&&(s=!1),i===n){e+=n===0?"::":":",s=!0;continue}e+=r[n].toString(16),n!==7&&(e+=":")}return e}function o9(r,e){if(r[0]==="[")return r[r.length-1]!=="]"?te:g$(r.substring(1,r.length-1));if(!e)return w$(r);let t=d$(r),i=oE.toASCII(t,!1,oE.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(i===null||a$(i))return te;let s=h$(i);return typeof s=="number"||s===te?s:i}function w$(r){if(o$(r))return te;let e="",t=Xl.ucs2.decode(r);for(let i=0;i<t.length;++i)e+=ya(t[i],q0);return e}function b$(r){let e=null,t=1,i=null,s=0;for(let n=0;n<r.length;++n)r[n]!==0?(s>t&&(e=i,t=s),i=null,s=0):(i===null&&(i=n),++s);return s>t&&(e=i,t=s),{idx:e,len:t}}function c9(r){return typeof r=="number"?f$(r):r instanceof Array?"["+y$(r)+"]":r}function v$(r){return r.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}function S$(r){return r.replace(/\u0009|\u000A|\u000D/g,"")}function fE(r){let e=r.path;e.length!==0&&(r.scheme==="file"&&e.length===1&&T$(e[0])||e.pop())}function gE(r){return r.username!==""||r.password!==""}function x$(r){return r.host===null||r.host===""||r.cannotBeABaseURL||r.scheme==="file"}function T$(r){return/^[A-Za-z]:$/.test(r)}function Be(r,e,t,i,s){if(this.pointer=0,this.input=r,this.base=e||null,this.encodingOverride=t||"utf-8",this.stateOverride=s,this.url=i,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};let a=v$(this.input);a!==this.input&&(this.parseError=!0),this.input=a}let n=S$(this.input);for(n!==this.input&&(this.parseError=!0),this.input=n,this.state=s||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=Xl.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){let a=this.input[this.pointer],o=isNaN(a)?void 0:String.fromCodePoint(a),l=this["parse "+this.state](a,o);if(l){if(l===te){this.failure=!0;break}}else break}}Be.prototype["parse scheme start"]=function(e,t){if(gp(e))this.buffer+=t.toLowerCase(),this.state="scheme";else if(!this.stateOverride)this.state="no scheme",--this.pointer;else return this.parseError=!0,te;return!0};Be.prototype["parse scheme"]=function(e,t){if(r$(e)||e===43||e===45||e===46)this.buffer+=t.toLowerCase();else if(e===58){if(this.stateOverride&&(et(this.url)&&!a9(this.buffer)||!et(this.url)&&a9(this.buffer)||(gE(this.url)||this.url.port!==null)&&this.buffer==="file"||this.url.scheme==="file"&&(this.url.host===""||this.url.host===null))||(this.url.scheme=this.buffer,this.buffer="",this.stateOverride))return!1;this.url.scheme==="file"?((this.input[this.pointer+1]!==47||this.input[this.pointer+2]!==47)&&(this.parseError=!0),this.state="file"):et(this.url)&&this.base!==null&&this.base.scheme===this.url.scheme?this.state="special relative or authority":et(this.url)?this.state="special authority slashes":this.input[this.pointer+1]===47?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else if(!this.stateOverride)this.buffer="",this.state="no scheme",this.pointer=-1;else return this.parseError=!0,te;return!0};Be.prototype["parse no scheme"]=function(e){return this.base===null||this.base.cannotBeABaseURL&&e!==35?te:(this.base.cannotBeABaseURL&&e===35?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):this.base.scheme==="file"?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)};Be.prototype["parse special relative or authority"]=function(e){return e===47&&this.input[this.pointer+1]===47?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0};Be.prototype["parse path or authority"]=function(e){return e===47?this.state="authority":(this.state="path",--this.pointer),!0};Be.prototype["parse relative"]=function(e){return this.url.scheme=this.base.scheme,isNaN(e)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):e===47?this.state="relative slash":e===63?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):e===35?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):et(this.url)&&e===92?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0};Be.prototype["parse relative slash"]=function(e){return et(this.url)&&(e===47||e===92)?(e===92&&(this.parseError=!0),this.state="special authority ignore slashes"):e===47?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer),!0};Be.prototype["parse special authority slashes"]=function(e){return e===47&&this.input[this.pointer+1]===47?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0};Be.prototype["parse special authority ignore slashes"]=function(e){return e!==47&&e!==92?(this.state="authority",--this.pointer):this.parseError=!0,!0};Be.prototype["parse authority"]=function(e,t){if(e===64){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;let i=lE(this.buffer);for(let s=0;s<i;++s){let n=this.buffer.codePointAt(s);if(n===58&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}let a=ya(n,l9);this.passwordTokenSeenFlag?this.url.password+=a:this.url.username+=a}this.buffer=""}else if(isNaN(e)||e===47||e===63||e===35||et(this.url)&&e===92){if(this.atFlag&&this.buffer==="")return this.parseError=!0,te;this.pointer-=lE(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0};Be.prototype["parse hostname"]=Be.prototype["parse host"]=function(e,t){if(this.stateOverride&&this.url.scheme==="file")--this.pointer,this.state="file host";else if(e===58&&!this.arrFlag){if(this.buffer==="")return this.parseError=!0,te;let i=o9(this.buffer,et(this.url));if(i===te)return te;if(this.url.host=i,this.buffer="",this.state="port",this.stateOverride==="hostname")return!1}else if(isNaN(e)||e===47||e===63||e===35||et(this.url)&&e===92){if(--this.pointer,et(this.url)&&this.buffer==="")return this.parseError=!0,te;if(this.stateOverride&&this.buffer===""&&(gE(this.url)||this.url.port!==null))return this.parseError=!0,!1;let i=o9(this.buffer,et(this.url));if(i===te)return te;if(this.url.host=i,this.buffer="",this.state="path start",this.stateOverride)return!1}else e===91?this.arrFlag=!0:e===93&&(this.arrFlag=!1),this.buffer+=t;return!0};Be.prototype["parse port"]=function(e,t){if(fp(e))this.buffer+=t;else if(isNaN(e)||e===47||e===63||e===35||et(this.url)&&e===92||this.stateOverride){if(this.buffer!==""){let i=parseInt(this.buffer);if(i>Math.pow(2,16)-1)return this.parseError=!0,te;this.url.port=i===l$(this.url.scheme)?null:i,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}else return this.parseError=!0,te;return!0};var _$=new Set([47,92,63,35]);Be.prototype["parse file"]=function(e){return this.url.scheme="file",e===47||e===92?(e===92&&(this.parseError=!0),this.state="file slash"):this.base!==null&&this.base.scheme==="file"?isNaN(e)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):e===63?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):e===35?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1===0||!s$(e,this.input[this.pointer+1])||this.input.length-this.pointer-1>=2&&!_$.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),fE(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0};Be.prototype["parse file slash"]=function(e){return e===47||e===92?(e===92&&(this.parseError=!0),this.state="file host"):(this.base!==null&&this.base.scheme==="file"&&(n$(this.base.path[0])?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0};Be.prototype["parse file host"]=function(e,t){if(isNaN(e)||e===47||e===92||e===63||e===35)if(--this.pointer,!this.stateOverride&&uE(this.buffer))this.parseError=!0,this.state="path";else if(this.buffer===""){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let i=o9(this.buffer,et(this.url));if(i===te)return te;if(i==="localhost"&&(i=""),this.url.host=i,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0};Be.prototype["parse path start"]=function(e){return et(this.url)?(e===92&&(this.parseError=!0),this.state="path",e!==47&&e!==92&&--this.pointer):!this.stateOverride&&e===63?(this.url.query="",this.state="query"):!this.stateOverride&&e===35?(this.url.fragment="",this.state="fragment"):e!==void 0&&(this.state="path",e!==47&&--this.pointer),!0};Be.prototype["parse path"]=function(e){if(isNaN(e)||e===47||et(this.url)&&e===92||!this.stateOverride&&(e===63||e===35)){if(et(this.url)&&e===92&&(this.parseError=!0),i$(this.buffer)?(fE(this.url),e!==47&&!(et(this.url)&&e===92)&&this.url.path.push("")):dE(this.buffer)&&e!==47&&!(et(this.url)&&e===92)?this.url.path.push(""):dE(this.buffer)||(this.url.scheme==="file"&&this.url.path.length===0&&uE(this.buffer)&&(this.url.host!==""&&this.url.host!==null&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)),this.buffer="",this.url.scheme==="file"&&(e===void 0||e===63||e===35))for(;this.url.path.length>1&&this.url.path[0]==="";)this.parseError=!0,this.url.path.shift();e===63&&(this.url.query="",this.state="query"),e===35&&(this.url.fragment="",this.state="fragment")}else e===37&&(!ni(this.input[this.pointer+1])||!ni(this.input[this.pointer+2]))&&(this.parseError=!0),this.buffer+=ya(e,hE);return!0};Be.prototype["parse cannot-be-a-base-URL path"]=function(e){return e===63?(this.url.query="",this.state="query"):e===35?(this.url.fragment="",this.state="fragment"):(!isNaN(e)&&e!==37&&(this.parseError=!0),e===37&&(!ni(this.input[this.pointer+1])||!ni(this.input[this.pointer+2]))&&(this.parseError=!0),isNaN(e)||(this.url.path[0]=this.url.path[0]+ya(e,q0))),!0};Be.prototype["parse query"]=function(e,t){if(isNaN(e)||!this.stateOverride&&e===35){(!et(this.url)||this.url.scheme==="ws"||this.url.scheme==="wss")&&(this.encodingOverride="utf-8");let i=new Buffer(this.buffer);for(let s=0;s<i.length;++s)i[s]<33||i[s]>126||i[s]===34||i[s]===35||i[s]===60||i[s]===62?this.url.query+=mE(i[s]):this.url.query+=String.fromCodePoint(i[s]);this.buffer="",e===35&&(this.url.fragment="",this.state="fragment")}else e===37&&(!ni(this.input[this.pointer+1])||!ni(this.input[this.pointer+2]))&&(this.parseError=!0),this.buffer+=t;return!0};Be.prototype["parse fragment"]=function(e){return isNaN(e)||(e===0?this.parseError=!0:(e===37&&(!ni(this.input[this.pointer+1])||!ni(this.input[this.pointer+2]))&&(this.parseError=!0),this.url.fragment+=ya(e,q0))),!0};function E$(r,e){let t=r.scheme+":";if(r.host!==null?(t+="//",(r.username!==""||r.password!=="")&&(t+=r.username,r.password!==""&&(t+=":"+r.password),t+="@"),t+=c9(r.host),r.port!==null&&(t+=":"+r.port)):r.host===null&&r.scheme==="file"&&(t+="//"),r.cannotBeABaseURL)t+=r.path[0];else for(let i of r.path)t+="/"+i;return r.query!==null&&(t+="?"+r.query),!e&&r.fragment!==null&&(t+="#"+r.fragment),t}function N$(r){let e=r.scheme+"://";return e+=c9(r.host),r.port!==null&&(e+=":"+r.port),e}vr.exports.serializeURL=E$;vr.exports.serializeURLOrigin=function(r){switch(r.scheme){case"blob":try{return vr.exports.serializeURLOrigin(vr.exports.parseURL(r.path[0]))}catch{return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return N$({scheme:r.scheme,host:r.host,port:r.port});case"file":return"file://";default:return"null"}};vr.exports.basicURLParse=function(r,e){e===void 0&&(e={});let t=new Be(r,e.baseURL,e.encodingOverride,e.url,e.stateOverride);return t.failure?"failure":t.url};vr.exports.setTheUsername=function(r,e){r.username="";let t=Xl.ucs2.decode(e);for(let i=0;i<t.length;++i)r.username+=ya(t[i],l9)};vr.exports.setThePassword=function(r,e){r.password="";let t=Xl.ucs2.decode(e);for(let i=0;i<t.length;++i)r.password+=ya(t[i],l9)};vr.exports.serializeHost=c9;vr.exports.cannotHaveAUsernamePasswordPort=x$;vr.exports.serializeInteger=function(r){return String(r)};vr.exports.parseURL=function(r,e){return e===void 0&&(e={}),vr.exports.basicURLParse(r,{baseURL:e.baseURL,encodingOverride:e.encodingOverride})}});var wE=O(yE=>{"use strict";var We=Ri();yE.implementation=class{constructor(e){let t=e[0],i=e[1],s=null;if(i!==void 0&&(s=We.basicURLParse(i),s==="failure"))throw new TypeError("Invalid base URL");let n=We.basicURLParse(t,{baseURL:s});if(n==="failure")throw new TypeError("Invalid URL");this._url=n}get href(){return We.serializeURL(this._url)}set href(e){let t=We.basicURLParse(e);if(t==="failure")throw new TypeError("Invalid URL");this._url=t}get origin(){return We.serializeURLOrigin(this._url)}get protocol(){return this._url.scheme+":"}set protocol(e){We.basicURLParse(e+":",{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(e){We.cannotHaveAUsernamePasswordPort(this._url)||We.setTheUsername(this._url,e)}get password(){return this._url.password}set password(e){We.cannotHaveAUsernamePasswordPort(this._url)||We.setThePassword(this._url,e)}get host(){let e=this._url;return e.host===null?"":e.port===null?We.serializeHost(e.host):We.serializeHost(e.host)+":"+We.serializeInteger(e.port)}set host(e){this._url.cannotBeABaseURL||We.basicURLParse(e,{url:this._url,stateOverride:"host"})}get hostname(){return this._url.host===null?"":We.serializeHost(this._url.host)}set hostname(e){this._url.cannotBeABaseURL||We.basicURLParse(e,{url:this._url,stateOverride:"hostname"})}get port(){return this._url.port===null?"":We.serializeInteger(this._url.port)}set port(e){We.cannotHaveAUsernamePasswordPort(this._url)||(e===""?this._url.port=null:We.basicURLParse(e,{url:this._url,stateOverride:"port"}))}get pathname(){return this._url.cannotBeABaseURL?this._url.path[0]:this._url.path.length===0?"":"/"+this._url.path.join("/")}set pathname(e){this._url.cannotBeABaseURL||(this._url.path=[],We.basicURLParse(e,{url:this._url,stateOverride:"path start"}))}get search(){return this._url.query===null||this._url.query===""?"":"?"+this._url.query}set search(e){let t=this._url;if(e===""){t.query=null;return}let i=e[0]==="?"?e.substring(1):e;t.query="",We.basicURLParse(i,{url:t,stateOverride:"query"})}get hash(){return this._url.fragment===null||this._url.fragment===""?"":"#"+this._url.fragment}set hash(e){if(e===""){this._url.fragment=null;return}let t=e[0]==="#"?e.substring(1):e;this._url.fragment="",We.basicURLParse(t,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}}});var SE=O((Vge,yp)=>{"use strict";var Or=Y_(),vE=Z_(),bE=wE(),ve=vE.implSymbol;function mt(r){if(!this||this[ve]||!(this instanceof mt))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");if(arguments.length<1)throw new TypeError("Failed to construct 'URL': 1 argument required, but only "+arguments.length+" present.");let e=[];for(let t=0;t<arguments.length&&t<2;++t)e[t]=arguments[t];e[0]=Or.USVString(e[0]),e[1]!==void 0&&(e[1]=Or.USVString(e[1])),yp.exports.setup(this,e)}mt.prototype.toJSON=function(){if(!this||!yp.exports.is(this))throw new TypeError("Illegal invocation");let e=[];for(let t=0;t<arguments.length&&t<0;++t)e[t]=arguments[t];return this[ve].toJSON.apply(this[ve],e)};Object.defineProperty(mt.prototype,"href",{get(){return this[ve].href},set(r){r=Or.USVString(r),this[ve].href=r},enumerable:!0,configurable:!0});mt.prototype.toString=function(){if(!this||!yp.exports.is(this))throw new TypeError("Illegal invocation");return this.href};Object.defineProperty(mt.prototype,"origin",{get(){return this[ve].origin},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"protocol",{get(){return this[ve].protocol},set(r){r=Or.USVString(r),this[ve].protocol=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"username",{get(){return this[ve].username},set(r){r=Or.USVString(r),this[ve].username=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"password",{get(){return this[ve].password},set(r){r=Or.USVString(r),this[ve].password=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"host",{get(){return this[ve].host},set(r){r=Or.USVString(r),this[ve].host=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"hostname",{get(){return this[ve].hostname},set(r){r=Or.USVString(r),this[ve].hostname=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"port",{get(){return this[ve].port},set(r){r=Or.USVString(r),this[ve].port=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"pathname",{get(){return this[ve].pathname},set(r){r=Or.USVString(r),this[ve].pathname=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"search",{get(){return this[ve].search},set(r){r=Or.USVString(r),this[ve].search=r},enumerable:!0,configurable:!0});Object.defineProperty(mt.prototype,"hash",{get(){return this[ve].hash},set(r){r=Or.USVString(r),this[ve].hash=r},enumerable:!0,configurable:!0});yp.exports={is(r){return!!r&&r[ve]instanceof bE.implementation},create(r,e){let t=Object.create(mt.prototype);return this.setup(t,r,e),t},setup(r,e,t){t||(t={}),t.wrapper=r,r[ve]=new bE.implementation(e,t),r[ve][vE.wrapperSymbol]=r},interface:mt,expose:{Window:{URL:mt},Worker:{URL:mt}}}});var xE=O(Mi=>{"use strict";Mi.URL=SE().interface;Mi.serializeURL=Ri().serializeURL;Mi.serializeURLOrigin=Ri().serializeURLOrigin;Mi.basicURLParse=Ri().basicURLParse;Mi.setTheUsername=Ri().setTheUsername;Mi.setThePassword=Ri().setThePassword;Mi.serializeHost=Ri().serializeHost;Mi.serializeInteger=Ri().serializeInteger;Mi.parseURL=Ri().parseURL});var OE=O((oi,PE)=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});function tc(r){return r&&typeof r=="object"&&"default"in r?r.default:r}var ai=tc(require("stream")),NE=tc(require("http")),W0=tc(require("url")),CE=tc(xE()),C$=tc(require("https")),wa=tc(require("zlib")),A$=ai.Readable,ds=Symbol("buffer"),d9=Symbol("type"),bp=class r{constructor(){this[d9]="";let e=arguments[0],t=arguments[1],i=[],s=0;if(e){let a=e,o=Number(a.length);for(let l=0;l<o;l++){let c=a[l],d;c instanceof Buffer?d=c:ArrayBuffer.isView(c)?d=Buffer.from(c.buffer,c.byteOffset,c.byteLength):c instanceof ArrayBuffer?d=Buffer.from(c):c instanceof r?d=c[ds]:d=Buffer.from(typeof c=="string"?c:String(c)),s+=d.length,i.push(d)}}this[ds]=Buffer.concat(i);let n=t&&t.type!==void 0&&String(t.type).toLowerCase();n&&!/[^\u0020-\u007E]/.test(n)&&(this[d9]=n)}get size(){return this[ds].length}get type(){return this[d9]}text(){return Promise.resolve(this[ds].toString())}arrayBuffer(){let e=this[ds],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){let e=new A$;return e._read=function(){},e.push(this[ds]),e.push(null),e}toString(){return"[object Blob]"}slice(){let e=this.size,t=arguments[0],i=arguments[1],s,n;t===void 0?s=0:t<0?s=Math.max(e+t,0):s=Math.min(t,e),i===void 0?n=e:i<0?n=Math.max(e+i,0):n=Math.min(i,e);let a=Math.max(n-s,0),l=this[ds].slice(s,s+a),c=new r([],{type:arguments[2]});return c[ds]=l,c}};Object.defineProperties(bp.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Object.defineProperty(bp.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0});function Nt(r,e,t){Error.call(this,r),this.message=r,this.type=e,t&&(this.code=this.errno=t.code),Error.captureStackTrace(this,this.constructor)}Nt.prototype=Object.create(Error.prototype);Nt.prototype.constructor=Nt;Nt.prototype.name="FetchError";var h9;try{h9=require("encoding").convert}catch{}var us=Symbol("Body internals"),TE=ai.PassThrough;function ht(r){var e=this,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=t.size;let s=i===void 0?0:i;var n=t.timeout;let a=n===void 0?0:n;r==null?r=null:AE(r)?r=Buffer.from(r.toString()):Sp(r)||Buffer.isBuffer(r)||(Object.prototype.toString.call(r)==="[object ArrayBuffer]"?r=Buffer.from(r):ArrayBuffer.isView(r)?r=Buffer.from(r.buffer,r.byteOffset,r.byteLength):r instanceof ai||(r=Buffer.from(String(r)))),this[us]={body:r,disturbed:!1,error:null},this.size=s,this.timeout=a,r instanceof ai&&r.on("error",function(o){let l=o.name==="AbortError"?o:new Nt(`Invalid response body while trying to fetch ${e.url}: ${o.message}`,"system",o);e[us].error=l})}ht.prototype={get body(){return this[us].body},get bodyUsed(){return this[us].disturbed},arrayBuffer(){return Yl.call(this).then(function(r){return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)})},blob(){let r=this.headers&&this.headers.get("content-type")||"";return Yl.call(this).then(function(e){return Object.assign(new bp([],{type:r.toLowerCase()}),{[ds]:e})})},json(){var r=this;return Yl.call(this).then(function(e){try{return JSON.parse(e.toString())}catch(t){return ht.Promise.reject(new Nt(`invalid json response body at ${r.url} reason: ${t.message}`,"invalid-json"))}})},text(){return Yl.call(this).then(function(r){return r.toString()})},buffer(){return Yl.call(this)},textConverted(){var r=this;return Yl.call(this).then(function(e){return R$(e,r.headers)})}};Object.defineProperties(ht.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}});ht.mixIn=function(r){for(let e of Object.getOwnPropertyNames(ht.prototype))if(!(e in r)){let t=Object.getOwnPropertyDescriptor(ht.prototype,e);Object.defineProperty(r,e,t)}};function Yl(){var r=this;if(this[us].disturbed)return ht.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[us].disturbed=!0,this[us].error)return ht.Promise.reject(this[us].error);let e=this.body;if(e===null)return ht.Promise.resolve(Buffer.alloc(0));if(Sp(e)&&(e=e.stream()),Buffer.isBuffer(e))return ht.Promise.resolve(e);if(!(e instanceof ai))return ht.Promise.resolve(Buffer.alloc(0));let t=[],i=0,s=!1;return new ht.Promise(function(n,a){let o;r.timeout&&(o=setTimeout(function(){s=!0,a(new Nt(`Response timeout while trying to fetch ${r.url} (over ${r.timeout}ms)`,"body-timeout"))},r.timeout)),e.on("error",function(l){l.name==="AbortError"?(s=!0,a(l)):a(new Nt(`Invalid response body while trying to fetch ${r.url}: ${l.message}`,"system",l))}),e.on("data",function(l){if(!(s||l===null)){if(r.size&&i+l.length>r.size){s=!0,a(new Nt(`content size at ${r.url} over limit: ${r.size}`,"max-size"));return}i+=l.length,t.push(l)}}),e.on("end",function(){if(!s){clearTimeout(o);try{n(Buffer.concat(t,i))}catch(l){a(new Nt(`Could not create Buffer from response body for ${r.url}: ${l.message}`,"system",l))}}})})}function R$(r,e){if(typeof h9!="function")throw new Error("The package `encoding` must be installed to use the textConverted() function");let t=e.get("content-type"),i="utf-8",s,n;return t&&(s=/charset=([^;]*)/i.exec(t)),n=r.slice(0,1024).toString(),!s&&n&&(s=/<meta.+?charset=(['"])(.+?)\1/i.exec(n)),!s&&n&&(s=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(n),s||(s=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(n),s&&s.pop()),s&&(s=/charset=(.*)/i.exec(s.pop()))),!s&&n&&(s=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(n)),s&&(i=s.pop(),(i==="gb2312"||i==="gbk")&&(i="gb18030")),h9(r,"UTF-8",i).toString()}function AE(r){return typeof r!="object"||typeof r.append!="function"||typeof r.delete!="function"||typeof r.get!="function"||typeof r.getAll!="function"||typeof r.has!="function"||typeof r.set!="function"?!1:r.constructor.name==="URLSearchParams"||Object.prototype.toString.call(r)==="[object URLSearchParams]"||typeof r.sort=="function"}function Sp(r){return typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&typeof r.constructor=="function"&&typeof r.constructor.name=="string"&&/^(Blob|File)$/.test(r.constructor.name)&&/^(Blob|File)$/.test(r[Symbol.toStringTag])}function RE(r){let e,t,i=r.body;if(r.bodyUsed)throw new Error("cannot clone body after it is used");return i instanceof ai&&typeof i.getBoundary!="function"&&(e=new TE,t=new TE,i.pipe(e),i.pipe(t),r[us].body=e,i=t),i}function ME(r){return r===null?null:typeof r=="string"?"text/plain;charset=UTF-8":AE(r)?"application/x-www-form-urlencoded;charset=UTF-8":Sp(r)?r.type||null:Buffer.isBuffer(r)||Object.prototype.toString.call(r)==="[object ArrayBuffer]"||ArrayBuffer.isView(r)?null:typeof r.getBoundary=="function"?`multipart/form-data;boundary=${r.getBoundary()}`:r instanceof ai?null:"text/plain;charset=UTF-8"}function kE(r){let e=r.body;return e===null?0:Sp(e)?e.size:Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&(e._lengthRetrievers&&e._lengthRetrievers.length==0||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}function M$(r,e){let t=e.body;t===null?r.end():Sp(t)?t.stream().pipe(r):Buffer.isBuffer(t)?(r.write(t),r.end()):t.pipe(r)}ht.Promise=global.Promise;var IE=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,f9=/[^\t\x20-\x7e\x80-\xff]/;function wp(r){if(r=`${r}`,IE.test(r)||r==="")throw new TypeError(`${r} is not a legal HTTP header name`)}function _E(r){if(r=`${r}`,f9.test(r))throw new TypeError(`${r} is not a legal HTTP header value`)}function Zl(r,e){e=e.toLowerCase();for(let t in r)if(t.toLowerCase()===e)return t}var je=Symbol("map"),$r=class r{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;if(this[je]=Object.create(null),e instanceof r){let t=e.raw(),i=Object.keys(t);for(let s of i)for(let n of t[s])this.append(s,n);return}if(e!=null)if(typeof e=="object"){let t=e[Symbol.iterator];if(t!=null){if(typeof t!="function")throw new TypeError("Header pairs must be iterable");let i=[];for(let s of e){if(typeof s!="object"||typeof s[Symbol.iterator]!="function")throw new TypeError("Each header pair must be iterable");i.push(Array.from(s))}for(let s of i){if(s.length!==2)throw new TypeError("Each header pair must be a name/value tuple");this.append(s[0],s[1])}}else for(let i of Object.keys(e)){let s=e[i];this.append(i,s)}}else throw new TypeError("Provided initializer must be an object")}get(e){e=`${e}`,wp(e);let t=Zl(this[je],e);return t===void 0?null:this[je][t].join(", ")}forEach(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=g9(this),s=0;for(;s<i.length;){var n=i[s];let a=n[0],o=n[1];e.call(t,o,a,this),i=g9(this),s++}}set(e,t){e=`${e}`,t=`${t}`,wp(e),_E(t);let i=Zl(this[je],e);this[je][i!==void 0?i:e]=[t]}append(e,t){e=`${e}`,t=`${t}`,wp(e),_E(t);let i=Zl(this[je],e);i!==void 0?this[je][i].push(t):this[je][e]=[t]}has(e){return e=`${e}`,wp(e),Zl(this[je],e)!==void 0}delete(e){e=`${e}`,wp(e);let t=Zl(this[je],e);t!==void 0&&delete this[je][t]}raw(){return this[je]}keys(){return p9(this,"key")}values(){return p9(this,"value")}[Symbol.iterator](){return p9(this,"key+value")}};$r.prototype.entries=$r.prototype[Symbol.iterator];Object.defineProperty($r.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties($r.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});function g9(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key+value";return Object.keys(r[je]).sort().map(e==="key"?function(i){return i.toLowerCase()}:e==="value"?function(i){return r[je][i].join(", ")}:function(i){return[i.toLowerCase(),r[je][i].join(", ")]})}var y9=Symbol("internal");function p9(r,e){let t=Object.create(w9);return t[y9]={target:r,kind:e,index:0},t}var w9=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==w9)throw new TypeError("Value of `this` is not a HeadersIterator");var r=this[y9];let e=r.target,t=r.kind,i=r.index,s=g9(e,t),n=s.length;return i>=n?{value:void 0,done:!0}:(this[y9].index=i+1,{value:s[i],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(w9,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});function k$(r){let e=Object.assign({__proto__:null},r[je]),t=Zl(r[je],"Host");return t!==void 0&&(e[t]=e[t][0]),e}function I$(r){let e=new $r;for(let t of Object.keys(r))if(!IE.test(t))if(Array.isArray(r[t]))for(let i of r[t])f9.test(i)||(e[je][t]===void 0?e[je][t]=[i]:e[je][t].push(i));else f9.test(r[t])||(e[je][t]=[r[t]]);return e}var hn=Symbol("Response internals"),P$=NE.STATUS_CODES,Dr=class r{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ht.call(this,e,t);let i=t.status||200,s=new $r(t.headers);if(e!=null&&!s.has("Content-Type")){let n=ME(e);n&&s.append("Content-Type",n)}this[hn]={url:t.url,status:i,statusText:t.statusText||P$[i],headers:s,counter:t.counter}}get url(){return this[hn].url||""}get status(){return this[hn].status}get ok(){return this[hn].status>=200&&this[hn].status<300}get redirected(){return this[hn].counter>0}get statusText(){return this[hn].statusText}get headers(){return this[hn].headers}clone(){return new r(RE(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}};ht.mixIn(Dr.prototype);Object.defineProperties(Dr.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});Object.defineProperty(Dr.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});var ps=Symbol("Request internals"),O$=W0.URL||CE.URL,D$=W0.parse,$$=W0.format;function u9(r){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(r)&&(r=new O$(r).toString()),D$(r)}var F$="destroy"in ai.Readable.prototype;function B0(r){return typeof r=="object"&&typeof r[ps]=="object"}function L$(r){let e=r&&typeof r=="object"&&Object.getPrototypeOf(r);return!!(e&&e.constructor.name==="AbortSignal")}var gn=class r{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i;B0(e)?i=u9(e.url):(e&&e.href?i=u9(e.href):i=u9(`${e}`),e={});let s=t.method||e.method||"GET";if(s=s.toUpperCase(),(t.body!=null||B0(e)&&e.body!==null)&&(s==="GET"||s==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let n=t.body!=null?t.body:B0(e)&&e.body!==null?RE(e):null;ht.call(this,n,{timeout:t.timeout||e.timeout||0,size:t.size||e.size||0});let a=new $r(t.headers||e.headers||{});if(n!=null&&!a.has("Content-Type")){let l=ME(n);l&&a.append("Content-Type",l)}let o=B0(e)?e.signal:null;if("signal"in t&&(o=t.signal),o!=null&&!L$(o))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[ps]={method:s,redirect:t.redirect||e.redirect||"follow",headers:a,parsedURL:i,signal:o},this.follow=t.follow!==void 0?t.follow:e.follow!==void 0?e.follow:20,this.compress=t.compress!==void 0?t.compress:e.compress!==void 0?e.compress:!0,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent}get method(){return this[ps].method}get url(){return $$(this[ps].parsedURL)}get headers(){return this[ps].headers}get redirect(){return this[ps].redirect}get signal(){return this[ps].signal}clone(){return new r(this)}};ht.mixIn(gn.prototype);Object.defineProperty(gn.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(gn.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});function q$(r){let e=r[ps].parsedURL,t=new $r(r[ps].headers);if(t.has("Accept")||t.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(r.signal&&r.body instanceof ai.Readable&&!F$)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let i=null;if(r.body==null&&/^(POST|PUT)$/i.test(r.method)&&(i="0"),r.body!=null){let n=kE(r);typeof n=="number"&&(i=String(n))}i&&t.set("Content-Length",i),t.has("User-Agent")||t.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),r.compress&&!t.has("Accept-Encoding")&&t.set("Accept-Encoding","gzip,deflate");let s=r.agent;return typeof s=="function"&&(s=s(e)),Object.assign({},e,{method:r.method,headers:k$(t),agent:s})}function ec(r){Error.call(this,r),this.type="aborted",this.message=r,Error.captureStackTrace(this,this.constructor)}ec.prototype=Object.create(Error.prototype);ec.prototype.constructor=ec;ec.prototype.name="AbortError";var vp=W0.URL||CE.URL,EE=ai.PassThrough,B$=function(e,t){let i=new vp(t).hostname,s=new vp(e).hostname;return i===s||i[i.length-s.length-1]==="."&&i.endsWith(s)},W$=function(e,t){let i=new vp(t).protocol,s=new vp(e).protocol;return i===s};function fn(r,e){if(!fn.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return ht.Promise=fn.Promise,new fn.Promise(function(t,i){let s=new gn(r,e),n=q$(s),a=(n.protocol==="https:"?C$:NE).request,o=s.signal,l=null,c=function(){let w=new ec("The user aborted a request.");i(w),s.body&&s.body instanceof ai.Readable&&m9(s.body,w),!(!l||!l.body)&&l.body.emit("error",w)};if(o&&o.aborted){c();return}let d=function(){c(),h()},p=a(n),m;o&&o.addEventListener("abort",d);function h(){p.abort(),o&&o.removeEventListener("abort",d),clearTimeout(m)}s.timeout&&p.once("socket",function(f){m=setTimeout(function(){i(new Nt(`network timeout at: ${s.url}`,"request-timeout")),h()},s.timeout)}),p.on("error",function(f){i(new Nt(`request to ${s.url} failed, reason: ${f.message}`,"system",f)),l&&l.body&&m9(l.body,f),h()}),z$(p,function(f){o&&o.aborted||l&&l.body&&m9(l.body,f)}),parseInt(process.version.substring(1))<14&&p.on("socket",function(f){f.addListener("close",function(w){let b=f.listenerCount("data")>0;if(l&&b&&!w&&!(o&&o.aborted)){let v=new Error("Premature close");v.code="ERR_STREAM_PREMATURE_CLOSE",l.body.emit("error",v)}})}),p.on("response",function(f){clearTimeout(m);let w=I$(f.headers);if(fn.isRedirect(f.statusCode)){let _=w.get("Location"),E=null;try{E=_===null?null:new vp(_,s.url).toString()}catch{if(s.redirect!=="manual"){i(new Nt(`uri requested responds with an invalid redirect URL: ${_}`,"invalid-redirect")),h();return}}switch(s.redirect){case"error":i(new Nt(`uri requested responds with a redirect, redirect mode is set to error: ${s.url}`,"no-redirect")),h();return;case"manual":if(E!==null)try{w.set("Location",E)}catch(X){i(X)}break;case"follow":if(E===null)break;if(s.counter>=s.follow){i(new Nt(`maximum redirect reached at: ${s.url}`,"max-redirect")),h();return}let D={headers:new $r(s.headers),follow:s.follow,counter:s.counter+1,agent:s.agent,compress:s.compress,method:s.method,body:s.body,signal:s.signal,timeout:s.timeout,size:s.size};if(!B$(s.url,E)||!W$(s.url,E))for(let X of["authorization","www-authenticate","cookie","cookie2"])D.headers.delete(X);if(f.statusCode!==303&&s.body&&kE(s)===null){i(new Nt("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}(f.statusCode===303||(f.statusCode===301||f.statusCode===302)&&s.method==="POST")&&(D.method="GET",D.body=void 0,D.headers.delete("content-length")),t(fn(new gn(E,D))),h();return}}f.once("end",function(){o&&o.removeEventListener("abort",d)});let b=f.pipe(new EE),v={url:s.url,status:f.statusCode,statusText:f.statusMessage,headers:w,size:s.size,timeout:s.timeout,counter:s.counter},S=w.get("Content-Encoding");if(!s.compress||s.method==="HEAD"||S===null||f.statusCode===204||f.statusCode===304){l=new Dr(b,v),t(l);return}let y={flush:wa.Z_SYNC_FLUSH,finishFlush:wa.Z_SYNC_FLUSH};if(S=="gzip"||S=="x-gzip"){b=b.pipe(wa.createGunzip(y)),l=new Dr(b,v),t(l);return}if(S=="deflate"||S=="x-deflate"){let _=f.pipe(new EE);_.once("data",function(E){(E[0]&15)===8?b=b.pipe(wa.createInflate()):b=b.pipe(wa.createInflateRaw()),l=new Dr(b,v),t(l)}),_.on("end",function(){l||(l=new Dr(b,v),t(l))});return}if(S=="br"&&typeof wa.createBrotliDecompress=="function"){b=b.pipe(wa.createBrotliDecompress()),l=new Dr(b,v),t(l);return}l=new Dr(b,v),t(l)}),M$(p,s)})}function z$(r,e){let t;r.on("socket",function(i){t=i}),r.on("response",function(i){let s=i.headers;s["transfer-encoding"]==="chunked"&&!s["content-length"]&&i.once("close",function(n){if(t&&t.listenerCount("data")>0&&!n){let o=new Error("Premature close");o.code="ERR_STREAM_PREMATURE_CLOSE",e(o)}})})}function m9(r,e){r.destroy?r.destroy(e):(r.emit("error",e),r.end())}fn.isRedirect=function(r){return r===301||r===302||r===303||r===307||r===308};fn.Promise=global.Promise;PE.exports=oi=fn;Object.defineProperty(oi,"__esModule",{value:!0});oi.default=oi;oi.Headers=$r;oi.Request=gn;oi.Response=Dr;oi.FetchError=Nt;oi.AbortError=ec});function nN(){}function $t(r){return typeof r=="object"&&r!==null||typeof r=="function"}function oe(r,e){try{Object.defineProperty(r,"name",{value:e,configurable:!0})}catch{}}function jt(r){return new k9(r)}function de(r){return j$(r)}function K(r){return V$(r)}function bs(r,e,t){return U$.call(r,e,t)}function Dt(r,e,t){bs(bs(r,e,t),void 0,aN)}function DE(r,e){Dt(r,e)}function $E(r,e){Dt(r,void 0,e)}function li(r,e,t){return bs(r,e,t)}function nc(r){bs(r,void 0,aN)}function dg(r,e,t){if(typeof r!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(r,e,t)}function Ea(r,e,t){try{return de(dg(r,e,t))}catch(i){return K(i)}}function cN(r,e){r._ownerReadableStream=e,e._reader=r,e._state==="readable"?_9(r):e._state==="closed"?(function(t){_9(t),mN(t)})(r):uN(r,e._storedError)}function dN(r,e){return UN(r._ownerReadableStream,e)}function pN(r){let e=r._ownerReadableStream;e._state==="readable"?D9(r,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):(function(t,i){uN(t,i)})(r,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._readableStreamController[O9](),e._reader=void 0,r._ownerReadableStream=void 0}function ac(r){return new TypeError("Cannot "+r+" a stream using a released reader")}function _9(r){r._closedPromise=jt(((e,t)=>{r._closedPromise_resolve=e,r._closedPromise_reject=t}))}function uN(r,e){_9(r),D9(r,e)}function D9(r,e){r._closedPromise_reject!==void 0&&(nc(r._closedPromise),r._closedPromise_reject(e),r._closedPromise_resolve=void 0,r._closedPromise_reject=void 0)}function mN(r){r._closedPromise_resolve!==void 0&&(r._closedPromise_resolve(void 0),r._closedPromise_resolve=void 0,r._closedPromise_reject=void 0)}function vs(r,e){if(r!==void 0&&typeof(t=r)!="object"&&typeof t!="function")throw new TypeError(`${e} is not an object.`);var t}function ci(r,e){if(typeof r!="function")throw new TypeError(`${e} is not a function.`)}function hN(r,e){if(!(function(t){return typeof t=="object"&&t!==null||typeof t=="function"})(r))throw new TypeError(`${e} is not an object.`)}function Ss(r,e,t){if(r===void 0)throw new TypeError(`Parameter ${e} is required in '${t}'.`)}function E9(r,e,t){if(r===void 0)throw new TypeError(`${e} is required in '${t}'.`)}function $9(r){return Number(r)}function LE(r){return r===0?0:r}function fN(r,e){let t=Number.MAX_SAFE_INTEGER,i=Number(r);if(i=LE(i),!FE(i))throw new TypeError(`${e} is not a finite number`);if(i=(function(s){return LE(H$(s))})(i),i<0||i>t)throw new TypeError(`${e} is outside the accepted range of 0 to ${t}, inclusive`);return FE(i)&&i!==0?i:0}function _p(r){if(!$t(r)||typeof r.getReader!="function")return!1;try{return typeof r.locked=="boolean"}catch{return!1}}function gN(r){if(!$t(r)||typeof r.getWriter!="function")return!1;try{return typeof r.locked=="boolean"}catch{return!1}}function yN(r,e){if(!Ta(r))throw new TypeError(`${e} is not a ReadableStream.`)}function wN(r,e){r._reader._readRequests.push(e)}function F9(r,e,t){let i=r._reader._readRequests.shift();t?i._closeSteps():i._chunkSteps(e)}function pg(r){return r._reader._readRequests.length}function bN(r){let e=r._reader;return e!==void 0&&!!xa(e)}function xa(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_readRequests")&&r instanceof ms}function vN(r,e){let t=r._readRequests;r._readRequests=new Zt,t.forEach((i=>{i._errorSteps(e)}))}function z0(r){return new TypeError(`ReadableStreamDefaultReader.prototype.${r} can only be used on a ReadableStreamDefaultReader`)}function qE(r){if(!$t(r)||!Object.prototype.hasOwnProperty.call(r,"_asyncIteratorImpl"))return!1;try{return r._asyncIteratorImpl instanceof tg}catch{return!1}}function BE(r){return new TypeError(`ReadableStreamAsyncIterator.${r} can only be used on a ReadableSteamAsyncIterator`)}function TN(r,e,t,i,s){new Uint8Array(r).set(new Uint8Array(t,i,s),e)}function WE(r){let e=(function(t,i,s){if(t.slice)return t.slice(i,s);let n=s-i,a=new ArrayBuffer(n);return TN(a,0,t,i,n),a})(r.buffer,r.byteOffset,r.byteOffset+r.byteLength);return new Uint8Array(e)}function N9(r){let e=r._queue.shift();return r._queueTotalSize-=e.size,r._queueTotalSize<0&&(r._queueTotalSize=0),e.value}function L9(r,e,t){if(typeof(i=t)!="number"||xN(i)||i<0||t===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var i;r._queue.push({value:e,size:t}),r._queueTotalSize+=t}function bn(r){r._queue=new Zt,r._queueTotalSize=0}function rc(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_controlledReadableByteStream")&&r instanceof hs}function b9(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_associatedReadableByteStreamController")&&r instanceof yn}function _a(r){if((function(t){let i=t._controlledReadableByteStream;return i._state!=="readable"||t._closeRequested||!t._started?!1:!!(bN(i)&&pg(i)>0||B9(i)&&IN(i)>0||kN(t)>0)})(r)){if(r._pulling)return void(r._pullAgain=!0);r._pulling=!0,Dt(r._pullAlgorithm(),(()=>(r._pulling=!1,r._pullAgain&&(r._pullAgain=!1,_a(r)),null)),(t=>(oc(r,t),null)))}}function _N(r){q9(r),r._pendingPullIntos=new Zt}function C9(r,e){let t=!1;r._state==="closed"&&(t=!0);let i=EN(e);e.readerType==="default"?F9(r,i,t):(function(s,n,a){let o=s._reader._readIntoRequests.shift();a?o._closeSteps(n):o._chunkSteps(n)})(r,i,t)}function EN(r){let e=r.bytesFilled,t=r.elementSize;return new r.viewConstructor(r.buffer,r.byteOffset,e/t)}function X0(r,e,t,i){r._queue.push({buffer:e,byteOffset:t,byteLength:i}),r._queueTotalSize+=i}function NN(r,e,t,i){let s;try{s=e.slice(t,t+i)}catch(n){throw oc(r,n),n}X0(r,s,0,i)}function CN(r,e){e.bytesFilled>0&&NN(r,e.buffer,e.byteOffset,e.bytesFilled),sc(r)}function AN(r,e){let t=e.elementSize,i=e.bytesFilled-e.bytesFilled%t,s=Math.min(r._queueTotalSize,e.byteLength-e.bytesFilled),n=e.bytesFilled+s,a=n-n%t,o=s,l=!1;a>i&&(o=a-e.bytesFilled,l=!0);let c=r._queue;for(;o>0;){let d=c.peek(),p=Math.min(o,d.byteLength),m=e.byteOffset+e.bytesFilled;TN(e.buffer,m,d.buffer,d.byteOffset,p),d.byteLength===p?c.shift():(d.byteOffset+=p,d.byteLength-=p),r._queueTotalSize-=p,RN(r,p,e),o-=p}return l}function RN(r,e,t){t.bytesFilled+=e}function MN(r){r._queueTotalSize===0&&r._closeRequested?(rg(r),Rp(r._controlledReadableByteStream)):_a(r)}function q9(r){r._byobRequest!==null&&(r._byobRequest._associatedReadableByteStreamController=void 0,r._byobRequest._view=null,r._byobRequest=null)}function A9(r){for(;r._pendingPullIntos.length>0;){if(r._queueTotalSize===0)return;let e=r._pendingPullIntos.peek();AN(r,e)&&(sc(r),C9(r._controlledReadableByteStream,e))}}function zE(r,e){let t=r._pendingPullIntos.peek();q9(r),r._controlledReadableByteStream._state==="closed"?(function(i,s){s.readerType==="none"&&sc(i);let n=i._controlledReadableByteStream;if(B9(n))for(;IN(n)>0;)C9(n,sc(i))})(r,t):(function(i,s,n){if(RN(0,s,n),n.readerType==="none")return CN(i,n),void A9(i);if(n.bytesFilled<n.elementSize)return;sc(i);let a=n.bytesFilled%n.elementSize;if(a>0){let o=n.byteOffset+n.bytesFilled;NN(i,n.buffer,o-a,a)}n.bytesFilled-=a,C9(i._controlledReadableByteStream,n),A9(i)})(r,e,t),_a(r)}function sc(r){return r._pendingPullIntos.shift()}function rg(r){r._pullAlgorithm=void 0,r._cancelAlgorithm=void 0}function oc(r,e){let t=r._controlledReadableByteStream;t._state==="readable"&&(_N(r),bn(r),rg(r),jN(t,e))}function UE(r,e){let t=r._queue.shift();r._queueTotalSize-=t.byteLength,MN(r);let i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);e._chunkSteps(i)}function kN(r){let e=r._controlledReadableByteStream._state;return e==="errored"?null:e==="closed"?0:r._strategyHWM-r._queueTotalSize}function Q$(r,e,t){let i=Object.create(hs.prototype),s,n,a;s=e.start!==void 0?()=>e.start(i):()=>{},n=e.pull!==void 0?()=>e.pull(i):()=>de(void 0),a=e.cancel!==void 0?l=>e.cancel(l):()=>de(void 0);let o=e.autoAllocateChunkSize;if(o===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");(function(l,c,d,p,m,h,f){c._controlledReadableByteStream=l,c._pullAgain=!1,c._pulling=!1,c._byobRequest=null,c._queue=c._queueTotalSize=void 0,bn(c),c._closeRequested=!1,c._started=!1,c._strategyHWM=h,c._pullAlgorithm=p,c._cancelAlgorithm=m,c._autoAllocateChunkSize=f,c._pendingPullIntos=new Zt,l._readableStreamController=c,Dt(de(d()),(()=>(c._started=!0,_a(c),null)),(w=>(oc(c,w),null)))})(r,i,s,n,a,t,o)}function v9(r){return new TypeError(`ReadableStreamBYOBRequest.prototype.${r} can only be used on a ReadableStreamBYOBRequest`)}function xp(r){return new TypeError(`ReadableByteStreamController.prototype.${r} can only be used on a ReadableByteStreamController`)}function jE(r,e){r._reader._readIntoRequests.push(e)}function IN(r){return r._reader._readIntoRequests.length}function B9(r){let e=r._reader;return e!==void 0&&!!ic(e)}function ic(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_readIntoRequests")&&r instanceof fs}function PN(r,e){let t=r._readIntoRequests;r._readIntoRequests=new Zt,t.forEach((i=>{i._errorSteps(e)}))}function U0(r){return new TypeError(`ReadableStreamBYOBReader.prototype.${r} can only be used on a ReadableStreamBYOBReader`)}function Ap(r,e){let{highWaterMark:t}=r;if(t===void 0)return e;if(xN(t)||t<0)throw new RangeError("Invalid highWaterMark");return t}function ig(r){let{size:e}=r;return e||(()=>1)}function sg(r,e){vs(r,e);let t=r?.highWaterMark,i=r?.size;return{highWaterMark:t===void 0?void 0:$9(t),size:i===void 0?void 0:G$(i,`${e} has member 'size' that`)}}function G$(r,e){return ci(r,e),t=>$9(r(t))}function K$(r,e,t){return ci(r,t),i=>Ea(r,e,[i])}function J$(r,e,t){return ci(r,t),()=>Ea(r,e,[])}function X$(r,e,t){return ci(r,t),i=>dg(r,e,[i])}function Y$(r,e,t){return ci(r,t),(i,s)=>Ea(r,e,[i,s])}function Ii(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_writableStreamController")&&r instanceof gs}function Y0(r){return r._writer!==void 0}function ON(r,e){var t;if(r._state==="closed"||r._state==="errored")return de(void 0);r._writableStreamController._abortReason=e,(t=r._writableStreamController._abortController)===null||t===void 0||t.abort(e);let i=r._state;if(i==="closed"||i==="errored")return de(void 0);if(r._pendingAbortRequest!==void 0)return r._pendingAbortRequest._promise;let s=!1;i==="erroring"&&(s=!0,e=void 0);let n=jt(((a,o)=>{r._pendingAbortRequest={_promise:void 0,_resolve:a,_reject:o,_reason:e,_wasAlreadyErroring:s}}));return r._pendingAbortRequest._promise=n,s||W9(r,e),n}function DN(r){let e=r._state;if(e==="closed"||e==="errored")return K(new TypeError(`The stream (in ${e} state) is not in the writable state and cannot be closed`));let t=jt(((n,a)=>{let o={_resolve:n,_reject:a};r._closeRequest=o})),i=r._writer;var s;return i!==void 0&&r._backpressure&&e==="writable"&&H9(i),L9(s=r._writableStreamController,FN,0),ug(s),t}function R9(r,e){r._state!=="writable"?z9(r):W9(r,e)}function W9(r,e){let t=r._writableStreamController;r._state="erroring",r._storedError=e;let i=r._writer;i!==void 0&&$N(i,e),!(function(s){return!(s._inFlightWriteRequest===void 0&&s._inFlightCloseRequest===void 0)})(r)&&t._started&&z9(r)}function z9(r){r._state="errored",r._writableStreamController[lN]();let e=r._storedError;if(r._writeRequests.forEach((i=>{i._reject(e)})),r._writeRequests=new Zt,r._pendingAbortRequest===void 0)return void j0(r);let t=r._pendingAbortRequest;if(r._pendingAbortRequest=void 0,t._wasAlreadyErroring)return t._reject(e),void j0(r);Dt(r._writableStreamController[oN](t._reason),(()=>(t._resolve(),j0(r),null)),(i=>(t._reject(i),j0(r),null)))}function wn(r){return r._closeRequest!==void 0||r._inFlightCloseRequest!==void 0}function j0(r){r._closeRequest!==void 0&&(r._closeRequest._reject(r._storedError),r._closeRequest=void 0);let e=r._writer;e!==void 0&&V9(e,r._storedError)}function U9(r,e){let t=r._writer;t!==void 0&&e!==r._backpressure&&(e?(function(i){mg(i)})(t):H9(t)),r._backpressure=e}function ba(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_ownerWritableStream")&&r instanceof ki}function $N(r,e){r._readyPromiseState==="pending"?WN(r,e):(function(t,i){M9(t,i)})(r,e)}function S9(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_controlledWritableStream")&&r instanceof lc}function ng(r){r._writeAlgorithm=void 0,r._closeAlgorithm=void 0,r._abortAlgorithm=void 0,r._strategySizeAlgorithm=void 0}function LN(r){return r._strategyHWM-r._queueTotalSize}function ug(r){let e=r._controlledWritableStream;if(!r._started||e._inFlightWriteRequest!==void 0)return;if(e._state==="erroring")return void z9(e);if(r._queue.length===0)return;let t=r._queue.peek().value;t===FN?(function(i){let s=i._controlledWritableStream;(function(a){a._inFlightCloseRequest=a._closeRequest,a._closeRequest=void 0})(s),N9(i);let n=i._closeAlgorithm();ng(i),Dt(n,(()=>((function(a){a._inFlightCloseRequest._resolve(void 0),a._inFlightCloseRequest=void 0,a._state==="erroring"&&(a._storedError=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._resolve(),a._pendingAbortRequest=void 0)),a._state="closed";let o=a._writer;o!==void 0&&BN(o)})(s),null)),(a=>((function(o,l){o._inFlightCloseRequest._reject(l),o._inFlightCloseRequest=void 0,o._pendingAbortRequest!==void 0&&(o._pendingAbortRequest._reject(l),o._pendingAbortRequest=void 0),R9(o,l)})(s,a),null)))})(r):(function(i,s){let n=i._controlledWritableStream;(function(a){a._inFlightWriteRequest=a._writeRequests.shift()})(n),Dt(i._writeAlgorithm(s),(()=>{(function(o){o._inFlightWriteRequest._resolve(void 0),o._inFlightWriteRequest=void 0})(n);let a=n._state;if(N9(i),!wn(n)&&a==="writable"){let o=j9(i);U9(n,o)}return ug(i),null}),(a=>(n._state==="writable"&&ng(i),(function(o,l){o._inFlightWriteRequest._reject(l),o._inFlightWriteRequest=void 0,R9(o,l)})(n,a),null)))})(r,t)}function VE(r,e){r._controlledWritableStream._state==="writable"&&qN(r,e)}function j9(r){return LN(r)<=0}function qN(r,e){let t=r._controlledWritableStream;ng(r),W9(t,e)}function V0(r){return new TypeError(`WritableStream.prototype.${r} can only be used on a WritableStream`)}function x9(r){return new TypeError(`WritableStreamDefaultController.prototype.${r} can only be used on a WritableStreamDefaultController`)}function va(r){return new TypeError(`WritableStreamDefaultWriter.prototype.${r} can only be used on a WritableStreamDefaultWriter`)}function Tp(r){return new TypeError("Cannot "+r+" a stream using a released writer")}function Z0(r){r._closedPromise=jt(((e,t)=>{r._closedPromise_resolve=e,r._closedPromise_reject=t,r._closedPromiseState="pending"}))}function HE(r,e){Z0(r),V9(r,e)}function V9(r,e){r._closedPromise_reject!==void 0&&(nc(r._closedPromise),r._closedPromise_reject(e),r._closedPromise_resolve=void 0,r._closedPromise_reject=void 0,r._closedPromiseState="rejected")}function BN(r){r._closedPromise_resolve!==void 0&&(r._closedPromise_resolve(void 0),r._closedPromise_resolve=void 0,r._closedPromise_reject=void 0,r._closedPromiseState="resolved")}function mg(r){r._readyPromise=jt(((e,t)=>{r._readyPromise_resolve=e,r._readyPromise_reject=t})),r._readyPromiseState="pending"}function M9(r,e){mg(r),WN(r,e)}function QE(r){mg(r),H9(r)}function WN(r,e){r._readyPromise_reject!==void 0&&(nc(r._readyPromise),r._readyPromise_reject(e),r._readyPromise_resolve=void 0,r._readyPromise_reject=void 0,r._readyPromiseState="rejected")}function H9(r){r._readyPromise_resolve!==void 0&&(r._readyPromise_resolve(void 0),r._readyPromise_resolve=void 0,r._readyPromise_reject=void 0,r._readyPromiseState="fulfilled")}function KE(r,e,t,i,s,n){let a=r.getReader(),o=e.getWriter();Ta(r)&&(r._disturbed=!0);let l,c,d,p=!1,m=!1,h="readable",f="writable",w=!1,b=!1,v=jt((y=>{d=y})),S=Promise.resolve(void 0);return jt(((y,_)=>{let E;function D(){if(p)return;let j=jt(((N,A)=>{(function q(H){H?N():bs((function(){return p?de(!0):bs(o.ready,(()=>bs(a.read(),(z=>!!z.done||(S=o.write(z.value),nc(S),!1)))))})(),q,A)})(!1)}));nc(j)}function X(){return h="closed",t?U():F((()=>(Ii(e)&&(w=wn(e),f=e._state),w||f==="closed"?de(void 0):f==="erroring"||f==="errored"?K(c):(w=!0,o.close()))),!1,void 0),null}function $(j){return p||(h="errored",l=j,i?U(!0,j):F((()=>o.abort(j)),!0,j)),null}function M(j){return m||(f="errored",c=j,s?U(!0,j):F((()=>a.cancel(j)),!0,j)),null}if(n!==void 0&&(E=()=>{let j=n.reason!==void 0?n.reason:new eF("Aborted","AbortError"),N=[];i||N.push((()=>f==="writable"?o.abort(j):de(void 0))),s||N.push((()=>h==="readable"?a.cancel(j):de(void 0))),F((()=>Promise.all(N.map((A=>A())))),!0,j)},n.aborted?E():n.addEventListener("abort",E)),Ta(r)&&(h=r._state,l=r._storedError),Ii(e)&&(f=e._state,c=e._storedError,w=wn(e)),Ta(r)&&Ii(e)&&(b=!0,d()),h==="errored")$(l);else if(f==="erroring"||f==="errored")M(c);else if(h==="closed")X();else if(w||f==="closed"){let j=new TypeError("the destination writable stream closed before all data could be piped to it");s?U(!0,j):F((()=>a.cancel(j)),!0,j)}function F(j,N,A){function q(){return f!=="writable"||w?H():DE((function(){let z;return de((function B(){if(z!==S)return z=S,li(S,B,B)})())})(),H),null}function H(){return j?Dt(j(),(()=>pe(N,A)),(z=>pe(!0,z))):pe(N,A),null}p||(p=!0,b?q():DE(v,q))}function U(j,N){F(void 0,j,N)}function pe(j,N){return m=!0,o.releaseLock(),a.releaseLock(),n!==void 0&&n.removeEventListener("abort",E),j?_(N):y(void 0),null}p||(Dt(a.closed,X,$),Dt(o.closed,(function(){return m||(f="closed"),null}),M)),b?D():J0((()=>{b=!0,d(),D()}))}))}function tF(r,e){return(function(t){try{return t.getReader({mode:"byob"}).releaseLock(),!0}catch{return!1}})(r)?(function(t){let i,s,n,a,o,l=t.getReader(),c=!1,d=!1,p=!1,m=!1,h=!1,f=!1,w=jt((M=>{o=M}));function b(M){$E(M.closed,(F=>(M!==l||(n.error(F),a.error(F),h&&f||o(void 0)),null)))}function v(){c&&(l.releaseLock(),l=t.getReader(),b(l),c=!1),Dt(l.read(),(M=>{var F,U;if(p=!1,m=!1,M.done)return h||n.close(),f||a.close(),(F=n.byobRequest)===null||F===void 0||F.respond(0),(U=a.byobRequest)===null||U===void 0||U.respond(0),h&&f||o(void 0),null;let pe=M.value,j=pe,N=pe;if(!h&&!f)try{N=WE(pe)}catch(A){return n.error(A),a.error(A),o(l.cancel(A)),null}return h||n.enqueue(j),f||a.enqueue(N),d=!1,p?y():m&&_(),null}),(()=>(d=!1,null)))}function S(M,F){c||(l.releaseLock(),l=t.getReader({mode:"byob"}),b(l),c=!0);let U=F?a:n,pe=F?n:a;Dt(l.read(M),(j=>{var N;p=!1,m=!1;let A=F?f:h,q=F?h:f;if(j.done){A||U.close(),q||pe.close();let z=j.value;return z!==void 0&&(A||U.byobRequest.respondWithNewView(z),q||(N=pe.byobRequest)===null||N===void 0||N.respond(0)),A&&q||o(void 0),null}let H=j.value;if(q)A||U.byobRequest.respondWithNewView(H);else{let z;try{z=WE(H)}catch(B){return U.error(B),pe.error(B),o(l.cancel(B)),null}A||U.byobRequest.respondWithNewView(H),pe.enqueue(z)}return d=!1,p?y():m&&_(),null}),(()=>(d=!1,null)))}function y(){if(d)return p=!0,de(void 0);d=!0;let M=n.byobRequest;return M===null?v():S(M.view,!1),de(void 0)}function _(){if(d)return m=!0,de(void 0);d=!0;let M=a.byobRequest;return M===null?v():S(M.view,!0),de(void 0)}function E(M){if(h=!0,i=M,f){let F=[i,s],U=l.cancel(F);o(U)}return w}function D(M){if(f=!0,s=M,h){let F=[i,s],U=l.cancel(F);o(U)}return w}let X=new Ke({type:"bytes",start(M){n=M},pull:y,cancel:E}),$=new Ke({type:"bytes",start(M){a=M},pull:_,cancel:D});return b(l),[X,$]})(r):(function(t,i){let s=t.getReader(),n,a,o,l,c,d=!1,p=!1,m=!1,h=!1,f=jt((_=>{c=_}));function w(){return d?(p=!0,de(void 0)):(d=!0,Dt(s.read(),(_=>{if(p=!1,_.done)return m||o.close(),h||l.close(),m&&h||c(void 0),null;let E=_.value,D=E,X=E;return m||o.enqueue(D),h||l.enqueue(X),d=!1,p&&w(),null}),(()=>(d=!1,null))),de(void 0))}function b(_){if(m=!0,n=_,h){let E=[n,a],D=s.cancel(E);c(D)}return f}function v(_){if(h=!0,a=_,m){let E=[n,a],D=s.cancel(E);c(D)}return f}let S=new Ke({start(_){o=_},pull:w,cancel:b}),y=new Ke({start(_){l=_},pull:w,cancel:v});return $E(s.closed,(_=>(o.error(_),l.error(_),m&&h||c(void 0),null))),[S,y]})(r)}function H0(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_controlledReadableStream")&&r instanceof ys}function Np(r){if((function(t){let i=t._controlledReadableStream;return!Ep(t)||!t._started?!1:!!(cc(i)&&pg(i)>0||zN(t)>0)})(r)){if(r._pulling)return void(r._pullAgain=!0);r._pulling=!0,Dt(r._pullAlgorithm(),(()=>(r._pulling=!1,r._pullAgain&&(r._pullAgain=!1,Np(r)),null)),(t=>(Cp(r,t),null)))}}function eg(r){r._pullAlgorithm=void 0,r._cancelAlgorithm=void 0,r._strategySizeAlgorithm=void 0}function Cp(r,e){let t=r._controlledReadableStream;t._state==="readable"&&(bn(r),eg(r),jN(t,e))}function zN(r){let e=r._controlledReadableStream._state;return e==="errored"?null:e==="closed"?0:r._strategyHWM-r._queueTotalSize}function Ep(r){return!r._closeRequested&&r._controlledReadableStream._state==="readable"}function rF(r,e,t,i){let s=Object.create(ys.prototype),n,a,o;n=e.start!==void 0?()=>e.start(s):()=>{},a=e.pull!==void 0?()=>e.pull(s):()=>de(void 0),o=e.cancel!==void 0?l=>e.cancel(l):()=>de(void 0),(function(l,c,d,p,m,h,f){c._controlledReadableStream=l,c._queue=void 0,c._queueTotalSize=void 0,bn(c),c._started=!1,c._closeRequested=!1,c._pullAgain=!1,c._pulling=!1,c._strategySizeAlgorithm=f,c._strategyHWM=h,c._pullAlgorithm=p,c._cancelAlgorithm=m,l._readableStreamController=c,Dt(de(d()),(()=>(c._started=!0,Np(c),null)),(w=>(Cp(c,w),null)))})(r,s,n,a,o,t,i)}function Q0(r){return new TypeError(`ReadableStreamDefaultController.prototype.${r} can only be used on a ReadableStreamDefaultController`)}function iF(r,e,t){return ci(r,t),i=>Ea(r,e,[i])}function sF(r,e,t){return ci(r,t),i=>Ea(r,e,[i])}function nF(r,e,t){return ci(r,t),i=>dg(r,e,[i])}function aF(r,e){if((r=`${r}`)!="bytes")throw new TypeError(`${e} '${r}' is not a valid enumeration value for ReadableStreamType`);return r}function oF(r,e){if((r=`${r}`)!="byob")throw new TypeError(`${e} '${r}' is not a valid enumeration value for ReadableStreamReaderMode`);return r}function JE(r,e){vs(r,e);let t=r?.preventAbort,i=r?.preventCancel,s=r?.preventClose,n=r?.signal;return n!==void 0&&(function(a,o){if(!(function(l){if(typeof l!="object"||l===null)return!1;try{return typeof l.aborted=="boolean"}catch{return!1}})(a))throw new TypeError(`${o} is not an AbortSignal.`)})(n,`${e} has member 'signal' that`),{preventAbort:!!t,preventCancel:!!i,preventClose:!!s,signal:n}}function lF(r,e){vs(r,e);let t=r?.readable;E9(t,"readable","ReadableWritablePair"),(function(s,n){if(!_p(s))throw new TypeError(`${n} is not a ReadableStream.`)})(t,`${e} has member 'readable' that`);let i=r?.writable;return E9(i,"writable","ReadableWritablePair"),(function(s,n){if(!gN(s))throw new TypeError(`${n} is not a WritableStream.`)})(i,`${e} has member 'writable' that`),{readable:t,writable:i}}function Ta(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_readableStreamController")&&r instanceof Ke}function cc(r){return r._reader!==void 0}function UN(r,e){if(r._disturbed=!0,r._state==="closed")return de(void 0);if(r._state==="errored")return K(r._storedError);Rp(r);let t=r._reader;if(t!==void 0&&ic(t)){let i=t._readIntoRequests;t._readIntoRequests=new Zt,i.forEach((s=>{s._closeSteps(void 0)}))}return li(r._readableStreamController[I9](e),nN)}function Rp(r){r._state="closed";let e=r._reader;if(e!==void 0&&(mN(e),xa(e))){let t=e._readRequests;e._readRequests=new Zt,t.forEach((i=>{i._closeSteps()}))}}function jN(r,e){r._state="errored",r._storedError=e;let t=r._reader;t!==void 0&&(D9(t,e),xa(t)?vN(t,e):PN(t,e))}function Sa(r){return new TypeError(`ReadableStream.prototype.${r} can only be used on a ReadableStream`)}function VN(r,e){vs(r,e);let t=r?.highWaterMark;return E9(t,"highWaterMark","QueuingStrategyInit"),{highWaterMark:$9(t)}}function XE(r){return new TypeError(`ByteLengthQueuingStrategy.prototype.${r} can only be used on a ByteLengthQueuingStrategy`)}function YE(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_byteLengthQueuingStrategyHighWaterMark")&&r instanceof Mp}function ZE(r){return new TypeError(`CountQueuingStrategy.prototype.${r} can only be used on a CountQueuingStrategy`)}function eN(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_countQueuingStrategyHighWaterMark")&&r instanceof kp}function cF(r,e,t){return ci(r,t),i=>Ea(r,e,[i])}function dF(r,e,t){return ci(r,t),i=>dg(r,e,[i])}function pF(r,e,t){return ci(r,t),(i,s)=>Ea(r,e,[i,s])}function tN(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_transformStreamController")&&r instanceof Ip}function ag(r,e){cg(r,e),hg(r,e)}function hg(r,e){GN(r._transformStreamController),(function(t,i){t._writableController.error(i),t._writableState==="writable"&&YN(t,i)})(r,e),r._backpressure&&og(r,!1)}function og(r,e){r._backpressureChangePromise!==void 0&&r._backpressureChangePromise_resolve(),r._backpressureChangePromise=jt((t=>{r._backpressureChangePromise_resolve=t})),r._backpressure=e}function G0(r){return!!$t(r)&&!!Object.prototype.hasOwnProperty.call(r,"_controlledTransformStream")&&r instanceof ws}function GN(r){r._transformAlgorithm=void 0,r._flushAlgorithm=void 0}function KN(r,e){let t=r._controlledTransformStream;if(!lg(t))throw new TypeError("Readable side is not in a state that permits enqueue");try{(function(s,n){s._readablePulling=!1;try{s._readableController.enqueue(n)}catch(a){throw cg(s,a),a}})(t,e)}catch(s){throw hg(t,s),t._readableStoredError}(function(s){return!(function(n){return lg(n)?!!(n._readablePulling||XN(n)>0):!1})(s)})(t)!==t._backpressure&&og(t,!0)}function rN(r,e){return li(r._transformAlgorithm(e),void 0,(t=>{throw ag(r._controlledTransformStream,t),t}))}function K0(r){return new TypeError(`TransformStreamDefaultController.prototype.${r} can only be used on a TransformStreamDefaultController`)}function iN(r){return new TypeError(`TransformStream.prototype.${r} can only be used on a TransformStream`)}function lg(r){return!r._readableCloseRequested&&r._readableState==="readable"}function JN(r){r._readableState="closed",r._readableCloseRequested=!0,r._readableController.close()}function cg(r,e){r._readableState==="readable"&&(r._readableState="errored",r._readableStoredError=e),r._readableController.error(e)}function XN(r){return r._readableController.desiredSize}function T9(r,e){r._writableState!=="writable"?Q9(r):YN(r,e)}function YN(r,e){r._writableState="erroring",r._writableStoredError=e,!(function(t){return t._writableHasInFlightOperation})(r)&&r._writableStarted&&Q9(r)}function Q9(r){r._writableState="errored"}function sN(r){r._writableState==="erroring"&&Q9(r)}var se,aN,k9,U$,j$,V$,J0,Zt,oN,lN,I9,P9,O9,FE,H$,ms,tg,SN,xN,yn,hs,fs,Z$,gs,ki,FN,lc,GE,eF,ys,Ke,HN,Mp,QN,kp,Ip,ws,ZN=g(()=>{se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:r=>`Symbol(${r})`;aN=nN;k9=Promise,U$=Promise.prototype.then,j$=Promise.resolve.bind(k9),V$=Promise.reject.bind(k9);J0=r=>{if(typeof queueMicrotask=="function")J0=queueMicrotask;else{let e=de(void 0);J0=t=>bs(e,t)}return J0(r)};Zt=class{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){let t=this._back,i=t;t._elements.length===16383&&(i={_elements:[],_next:void 0}),t._elements.push(e),i!==t&&(this._back=i,t._next=i),++this._size}shift(){let e=this._front,t=e,i=this._cursor,s=i+1,n=e._elements,a=n[i];return s===16384&&(t=e._next,s=0),--this._size,this._cursor=s,e!==t&&(this._front=t),n[i]=void 0,a}forEach(e){let t=this._cursor,i=this._front,s=i._elements;for(;!(t===s.length&&i._next===void 0||t===s.length&&(i=i._next,s=i._elements,t=0,s.length===0));)e(s[t]),++t}peek(){let e=this._front,t=this._cursor;return e._elements[t]}},oN=se("[[AbortSteps]]"),lN=se("[[ErrorSteps]]"),I9=se("[[CancelSteps]]"),P9=se("[[PullSteps]]"),O9=se("[[ReleaseSteps]]");FE=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},H$=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};ms=class{constructor(e){if(Ss(e,1,"ReadableStreamDefaultReader"),yN(e,"First parameter"),cc(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");cN(this,e),this._readRequests=new Zt}get closed(){return xa(this)?this._closedPromise:K(z0("closed"))}cancel(e){return xa(this)?this._ownerReadableStream===void 0?K(ac("cancel")):dN(this,e):K(z0("cancel"))}read(){if(!xa(this))return K(z0("read"));if(this._ownerReadableStream===void 0)return K(ac("read from"));let e,t,i=jt(((s,n)=>{e=s,t=n}));return(function(s,n){let a=s._ownerReadableStream;a._disturbed=!0,a._state==="closed"?n._closeSteps():a._state==="errored"?n._errorSteps(a._storedError):a._readableStreamController[P9](n)})(this,{_chunkSteps:s=>e({value:s,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:s=>t(s)}),i}releaseLock(){if(!xa(this))throw z0("releaseLock");this._ownerReadableStream!==void 0&&(function(e){pN(e);let t=new TypeError("Reader was released");vN(e,t)})(this)}};Object.defineProperties(ms.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),oe(ms.prototype.cancel,"cancel"),oe(ms.prototype.read,"read"),oe(ms.prototype.releaseLock,"releaseLock"),typeof se.toStringTag=="symbol"&&Object.defineProperty(ms.prototype,se.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});tg=class{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){let e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?li(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){let t=()=>this._returnSteps(e);return this._ongoingPromise?li(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let e=this._reader;return e===void 0?K(ac("iterate")):bs(e.read(),(t=>{var i;return this._ongoingPromise=void 0,t.done&&(this._isFinished=!0,(i=this._reader)===null||i===void 0||i.releaseLock(),this._reader=void 0),t}),(t=>{var i;throw this._ongoingPromise=void 0,this._isFinished=!0,(i=this._reader)===null||i===void 0||i.releaseLock(),this._reader=void 0,t}))}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;let t=this._reader;if(t===void 0)return K(ac("finish iterating"));if(this._reader=void 0,!this._preventCancel){let i=t.cancel(e);return t.releaseLock(),li(i,(()=>({value:e,done:!0})))}return t.releaseLock(),de({value:e,done:!0})}},SN={next(){return qE(this)?this._asyncIteratorImpl.next():K(BE("next"))},return(r){return qE(this)?this._asyncIteratorImpl.return(r):K(BE("return"))}};typeof se.asyncIterator=="symbol"&&Object.defineProperty(SN,se.asyncIterator,{value(){return this},writable:!0,configurable:!0});xN=Number.isNaN||function(r){return r!=r};yn=class{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!b9(this))throw v9("view");return this._view}respond(e){if(!b9(this))throw v9("respond");if(Ss(e,1,"respond"),e=fN(e,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,(function(t,i){let s=t._pendingPullIntos.peek();if(t._controlledReadableByteStream._state==="closed"){if(i!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(i===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(s.bytesFilled+i>s.byteLength)throw new RangeError("bytesWritten out of range")}s.buffer=s.buffer,zE(t,i)})(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!b9(this))throw v9("respondWithNewView");if(Ss(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");e.buffer,(function(t,i){let s=t._pendingPullIntos.peek();if(t._controlledReadableByteStream._state==="closed"){if(i.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(i.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(s.byteOffset+s.bytesFilled!==i.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(s.bufferByteLength!==i.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(s.bytesFilled+i.byteLength>s.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let n=i.byteLength;s.buffer=i.buffer,zE(t,n)})(this._associatedReadableByteStreamController,e)}};Object.defineProperties(yn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),oe(yn.prototype.respond,"respond"),oe(yn.prototype.respondWithNewView,"respondWithNewView"),typeof se.toStringTag=="symbol"&&Object.defineProperty(yn.prototype,se.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});hs=class{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!rc(this))throw xp("byobRequest");return(function(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek(),i=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),s=Object.create(yn.prototype);(function(n,a,o){n._associatedReadableByteStreamController=a,n._view=o})(s,e,i),e._byobRequest=s}return e._byobRequest})(this)}get desiredSize(){if(!rc(this))throw xp("desiredSize");return kN(this)}close(){if(!rc(this))throw xp("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let e=this._controlledReadableByteStream._state;if(e!=="readable")throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);(function(t){let i=t._controlledReadableByteStream;if(!(t._closeRequested||i._state!=="readable")){if(t._queueTotalSize>0)return void(t._closeRequested=!0);if(t._pendingPullIntos.length>0&&t._pendingPullIntos.peek().bytesFilled>0){let s=new TypeError("Insufficient bytes to fill elements in the given buffer");throw oc(t,s),s}rg(t),Rp(i)}})(this)}enqueue(e){if(!rc(this))throw xp("enqueue");if(Ss(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(e.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(e.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);(function(i,s){let n=i._controlledReadableByteStream;if(i._closeRequested||n._state!=="readable")return;let a=s.buffer,o=s.byteOffset,l=s.byteLength,c=a;if(i._pendingPullIntos.length>0){let d=i._pendingPullIntos.peek();d.buffer,q9(i),d.buffer=d.buffer,d.readerType==="none"&&CN(i,d)}bN(n)?((function(d){let p=d._controlledReadableByteStream._reader;for(;p._readRequests.length>0;){if(d._queueTotalSize===0)return;UE(d,p._readRequests.shift())}})(i),pg(n)===0?X0(i,c,o,l):(i._pendingPullIntos.length>0&&sc(i),F9(n,new Uint8Array(c,o,l),!1))):B9(n)?(X0(i,c,o,l),A9(i)):X0(i,c,o,l),_a(i)})(this,e)}error(e){if(!rc(this))throw xp("error");oc(this,e)}[I9](e){_N(this),bn(this);let t=this._cancelAlgorithm(e);return rg(this),t}[P9](e){let t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void UE(this,e);let i=this._autoAllocateChunkSize;if(i!==void 0){let s;try{s=new ArrayBuffer(i)}catch(a){return void e._errorSteps(a)}let n={buffer:s,bufferByteLength:i,byteOffset:0,byteLength:i,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(n)}wN(t,e),_a(this)}[O9](){if(this._pendingPullIntos.length>0){let e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new Zt,this._pendingPullIntos.push(e)}}};Object.defineProperties(hs.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),oe(hs.prototype.close,"close"),oe(hs.prototype.enqueue,"enqueue"),oe(hs.prototype.error,"error"),typeof se.toStringTag=="symbol"&&Object.defineProperty(hs.prototype,se.toStringTag,{value:"ReadableByteStreamController",configurable:!0});fs=class{constructor(e){if(Ss(e,1,"ReadableStreamBYOBReader"),yN(e,"First parameter"),cc(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!rc(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");cN(this,e),this._readIntoRequests=new Zt}get closed(){return ic(this)?this._closedPromise:K(U0("closed"))}cancel(e){return ic(this)?this._ownerReadableStream===void 0?K(ac("cancel")):dN(this,e):K(U0("cancel"))}read(e){if(!ic(this))return K(U0("read"));if(!ArrayBuffer.isView(e))return K(new TypeError("view must be an array buffer view"));if(e.byteLength===0)return K(new TypeError("view must have non-zero byteLength"));if(e.buffer.byteLength===0)return K(new TypeError("view's buffer must have non-zero byteLength"));if(e.buffer,this._ownerReadableStream===void 0)return K(ac("read from"));let t,i,s=jt(((n,a)=>{t=n,i=a}));return(function(n,a,o){let l=n._ownerReadableStream;l._disturbed=!0,l._state==="errored"?o._errorSteps(l._storedError):(function(c,d,p){let m=c._controlledReadableByteStream,h=1;d.constructor!==DataView&&(h=d.constructor.BYTES_PER_ELEMENT);let f=d.constructor,w=d.buffer,b={buffer:w,bufferByteLength:w.byteLength,byteOffset:d.byteOffset,byteLength:d.byteLength,bytesFilled:0,elementSize:h,viewConstructor:f,readerType:"byob"};if(c._pendingPullIntos.length>0)return c._pendingPullIntos.push(b),void jE(m,p);if(m._state!=="closed"){if(c._queueTotalSize>0){if(AN(c,b)){let v=EN(b);return MN(c),void p._chunkSteps(v)}if(c._closeRequested){let v=new TypeError("Insufficient bytes to fill elements in the given buffer");return oc(c,v),void p._errorSteps(v)}}c._pendingPullIntos.push(b),jE(m,p),_a(c)}else{let v=new f(b.buffer,b.byteOffset,0);p._closeSteps(v)}})(l._readableStreamController,a,o)})(this,e,{_chunkSteps:n=>t({value:n,done:!1}),_closeSteps:n=>t({value:n,done:!0}),_errorSteps:n=>i(n)}),s}releaseLock(){if(!ic(this))throw U0("releaseLock");this._ownerReadableStream!==void 0&&(function(e){pN(e);let t=new TypeError("Reader was released");PN(e,t)})(this)}};Object.defineProperties(fs.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),oe(fs.prototype.cancel,"cancel"),oe(fs.prototype.read,"read"),oe(fs.prototype.releaseLock,"releaseLock"),typeof se.toStringTag=="symbol"&&Object.defineProperty(fs.prototype,se.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});Z$=typeof AbortController=="function",gs=class{constructor(e={},t={}){e===void 0?e=null:hN(e,"First parameter");let i=sg(t,"Second parameter"),s=(function(o,l){vs(o,l);let c=o?.abort,d=o?.close,p=o?.start,m=o?.type,h=o?.write;return{abort:c===void 0?void 0:K$(c,o,`${l} has member 'abort' that`),close:d===void 0?void 0:J$(d,o,`${l} has member 'close' that`),start:p===void 0?void 0:X$(p,o,`${l} has member 'start' that`),write:h===void 0?void 0:Y$(h,o,`${l} has member 'write' that`),type:m}})(e,"First parameter");var n;if((n=this)._state="writable",n._storedError=void 0,n._writer=void 0,n._writableStreamController=void 0,n._writeRequests=new Zt,n._inFlightWriteRequest=void 0,n._closeRequest=void 0,n._inFlightCloseRequest=void 0,n._pendingAbortRequest=void 0,n._backpressure=!1,s.type!==void 0)throw new RangeError("Invalid type is specified");let a=ig(i);(function(o,l,c,d){let p=Object.create(lc.prototype),m,h,f,w;m=l.start!==void 0?()=>l.start(p):()=>{},h=l.write!==void 0?b=>l.write(b,p):()=>de(void 0),f=l.close!==void 0?()=>l.close():()=>de(void 0),w=l.abort!==void 0?b=>l.abort(b):()=>de(void 0),(function(b,v,S,y,_,E,D,X){v._controlledWritableStream=b,b._writableStreamController=v,v._queue=void 0,v._queueTotalSize=void 0,bn(v),v._abortReason=void 0,v._abortController=(function(){if(Z$)return new AbortController})(),v._started=!1,v._strategySizeAlgorithm=X,v._strategyHWM=D,v._writeAlgorithm=y,v._closeAlgorithm=_,v._abortAlgorithm=E;let $=j9(v);U9(b,$);let M=S();Dt(de(M),(()=>(v._started=!0,ug(v),null)),(F=>(v._started=!0,R9(b,F),null)))})(o,p,m,h,f,w,c,d)})(this,s,Ap(i,1),a)}get locked(){if(!Ii(this))throw V0("locked");return Y0(this)}abort(e){return Ii(this)?Y0(this)?K(new TypeError("Cannot abort a stream that already has a writer")):ON(this,e):K(V0("abort"))}close(){return Ii(this)?Y0(this)?K(new TypeError("Cannot close a stream that already has a writer")):wn(this)?K(new TypeError("Cannot close an already-closing stream")):DN(this):K(V0("close"))}getWriter(){if(!Ii(this))throw V0("getWriter");return new ki(this)}};Object.defineProperties(gs.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),oe(gs.prototype.abort,"abort"),oe(gs.prototype.close,"close"),oe(gs.prototype.getWriter,"getWriter"),typeof se.toStringTag=="symbol"&&Object.defineProperty(gs.prototype,se.toStringTag,{value:"WritableStream",configurable:!0});ki=class{constructor(e){if(Ss(e,1,"WritableStreamDefaultWriter"),(function(s,n){if(!Ii(s))throw new TypeError(`${n} is not a WritableStream.`)})(e,"First parameter"),Y0(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;let t=e._state;if(t==="writable")!wn(e)&&e._backpressure?mg(this):QE(this),Z0(this);else if(t==="erroring")M9(this,e._storedError),Z0(this);else if(t==="closed")QE(this),Z0(i=this),BN(i);else{let s=e._storedError;M9(this,s),HE(this,s)}var i}get closed(){return ba(this)?this._closedPromise:K(va("closed"))}get desiredSize(){if(!ba(this))throw va("desiredSize");if(this._ownerWritableStream===void 0)throw Tp("desiredSize");return(function(e){let t=e._ownerWritableStream,i=t._state;return i==="errored"||i==="erroring"?null:i==="closed"?0:LN(t._writableStreamController)})(this)}get ready(){return ba(this)?this._readyPromise:K(va("ready"))}abort(e){return ba(this)?this._ownerWritableStream===void 0?K(Tp("abort")):(function(t,i){return ON(t._ownerWritableStream,i)})(this,e):K(va("abort"))}close(){if(!ba(this))return K(va("close"));let e=this._ownerWritableStream;return e===void 0?K(Tp("close")):wn(e)?K(new TypeError("Cannot close an already-closing stream")):DN(this._ownerWritableStream)}releaseLock(){if(!ba(this))throw va("releaseLock");this._ownerWritableStream!==void 0&&(function(e){let t=e._ownerWritableStream,i=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");$N(e,i),(function(s,n){s._closedPromiseState==="pending"?V9(s,n):(function(a,o){HE(a,o)})(s,n)})(e,i),t._writer=void 0,e._ownerWritableStream=void 0})(this)}write(e){return ba(this)?this._ownerWritableStream===void 0?K(Tp("write to")):(function(t,i){let s=t._ownerWritableStream,n=s._writableStreamController,a=(function(c,d){try{return c._strategySizeAlgorithm(d)}catch(p){return VE(c,p),1}})(n,i);if(s!==t._ownerWritableStream)return K(Tp("write to"));let o=s._state;if(o==="errored")return K(s._storedError);if(wn(s)||o==="closed")return K(new TypeError("The stream is closing or closed and cannot be written to"));if(o==="erroring")return K(s._storedError);let l=(function(c){return jt(((d,p)=>{let m={_resolve:d,_reject:p};c._writeRequests.push(m)}))})(s);return(function(c,d,p){try{L9(c,d,p)}catch(h){return void VE(c,h)}let m=c._controlledWritableStream;!wn(m)&&m._state==="writable"&&U9(m,j9(c)),ug(c)})(n,i,a),l})(this,e):K(va("write"))}};Object.defineProperties(ki.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),oe(ki.prototype.abort,"abort"),oe(ki.prototype.close,"close"),oe(ki.prototype.releaseLock,"releaseLock"),oe(ki.prototype.write,"write"),typeof se.toStringTag=="symbol"&&Object.defineProperty(ki.prototype,se.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});FN={},lc=class{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!S9(this))throw x9("abortReason");return this._abortReason}get signal(){if(!S9(this))throw x9("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e){if(!S9(this))throw x9("error");this._controlledWritableStream._state==="writable"&&qN(this,e)}[oN](e){let t=this._abortAlgorithm(e);return ng(this),t}[lN](){bn(this)}};Object.defineProperties(lc.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof se.toStringTag=="symbol"&&Object.defineProperty(lc.prototype,se.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});GE=typeof DOMException<"u"?DOMException:void 0,eF=(function(r){if(typeof r!="function"&&typeof r!="object")return!1;try{return new r,!0}catch{return!1}})(GE)?GE:(function(){let r=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return r.prototype=Object.create(Error.prototype),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,configurable:!0}),r})();ys=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!H0(this))throw Q0("desiredSize");return zN(this)}close(){if(!H0(this))throw Q0("close");if(!Ep(this))throw new TypeError("The stream is not in a state that permits close");(function(e){if(!Ep(e))return;let t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(eg(e),Rp(t))})(this)}enqueue(e){if(!H0(this))throw Q0("enqueue");if(!Ep(this))throw new TypeError("The stream is not in a state that permits enqueue");return(function(t,i){if(!Ep(t))return;let s=t._controlledReadableStream;if(cc(s)&&pg(s)>0)F9(s,i,!1);else{let n;try{n=t._strategySizeAlgorithm(i)}catch(a){throw Cp(t,a),a}try{L9(t,i,n)}catch(a){throw Cp(t,a),a}}Np(t)})(this,e)}error(e){if(!H0(this))throw Q0("error");Cp(this,e)}[I9](e){bn(this);let t=this._cancelAlgorithm(e);return eg(this),t}[P9](e){let t=this._controlledReadableStream;if(this._queue.length>0){let i=N9(this);this._closeRequested&&this._queue.length===0?(eg(this),Rp(t)):Np(this),e._chunkSteps(i)}else wN(t,e),Np(this)}[O9](){}};Object.defineProperties(ys.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),oe(ys.prototype.close,"close"),oe(ys.prototype.enqueue,"enqueue"),oe(ys.prototype.error,"error"),typeof se.toStringTag=="symbol"&&Object.defineProperty(ys.prototype,se.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});Ke=class{constructor(e={},t={}){e===void 0?e=null:hN(e,"First parameter");let i=sg(t,"Second parameter"),s=(function(a,o){vs(a,o);let l=a,c=l?.autoAllocateChunkSize,d=l?.cancel,p=l?.pull,m=l?.start,h=l?.type;return{autoAllocateChunkSize:c===void 0?void 0:fN(c,`${o} has member 'autoAllocateChunkSize' that`),cancel:d===void 0?void 0:iF(d,l,`${o} has member 'cancel' that`),pull:p===void 0?void 0:sF(p,l,`${o} has member 'pull' that`),start:m===void 0?void 0:nF(m,l,`${o} has member 'start' that`),type:h===void 0?void 0:aF(h,`${o} has member 'type' that`)}})(e,"First parameter");var n;if((n=this)._state="readable",n._reader=void 0,n._storedError=void 0,n._disturbed=!1,s.type==="bytes"){if(i.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");Q$(this,s,Ap(i,0))}else{let a=ig(i);rF(this,s,Ap(i,1),a)}}get locked(){if(!Ta(this))throw Sa("locked");return cc(this)}cancel(e){return Ta(this)?cc(this)?K(new TypeError("Cannot cancel a stream that already has a reader")):UN(this,e):K(Sa("cancel"))}getReader(e){if(!Ta(this))throw Sa("getReader");return(function(t,i){vs(t,i);let s=t?.mode;return{mode:s===void 0?void 0:oF(s,`${i} has member 'mode' that`)}})(e,"First parameter").mode===void 0?new ms(this):(function(t){return new fs(t)})(this)}pipeThrough(e,t={}){if(!_p(this))throw Sa("pipeThrough");Ss(e,1,"pipeThrough");let i=lF(e,"First parameter"),s=JE(t,"Second parameter");if(this.locked)throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(i.writable.locked)throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return nc(KE(this,i.writable,s.preventClose,s.preventAbort,s.preventCancel,s.signal)),i.readable}pipeTo(e,t={}){if(!_p(this))return K(Sa("pipeTo"));if(e===void 0)return K("Parameter 1 is required in 'pipeTo'.");if(!gN(e))return K(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let i;try{i=JE(t,"Second parameter")}catch(s){return K(s)}return this.locked?K(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):e.locked?K(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):KE(this,e,i.preventClose,i.preventAbort,i.preventCancel,i.signal)}tee(){if(!_p(this))throw Sa("tee");if(this.locked)throw new TypeError("Cannot tee a stream that already has a reader");return tF(this)}values(e){if(!_p(this))throw Sa("values");return(function(t,i){let s=t.getReader(),n=new tg(s,i),a=Object.create(SN);return a._asyncIteratorImpl=n,a})(this,(function(t,i){return vs(t,i),{preventCancel:!!t?.preventCancel}})(e,"First parameter").preventCancel)}};Object.defineProperties(Ke.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),oe(Ke.prototype.cancel,"cancel"),oe(Ke.prototype.getReader,"getReader"),oe(Ke.prototype.pipeThrough,"pipeThrough"),oe(Ke.prototype.pipeTo,"pipeTo"),oe(Ke.prototype.tee,"tee"),oe(Ke.prototype.values,"values"),typeof se.toStringTag=="symbol"&&Object.defineProperty(Ke.prototype,se.toStringTag,{value:"ReadableStream",configurable:!0}),typeof se.asyncIterator=="symbol"&&Object.defineProperty(Ke.prototype,se.asyncIterator,{value:Ke.prototype.values,writable:!0,configurable:!0});HN=r=>r.byteLength;oe(HN,"size");Mp=class{constructor(e){Ss(e,1,"ByteLengthQueuingStrategy"),e=VN(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!YE(this))throw XE("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!YE(this))throw XE("size");return HN}};Object.defineProperties(Mp.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof se.toStringTag=="symbol"&&Object.defineProperty(Mp.prototype,se.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});QN=()=>1;oe(QN,"size");kp=class{constructor(e){Ss(e,1,"CountQueuingStrategy"),e=VN(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!eN(this))throw ZE("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!eN(this))throw ZE("size");return QN}};Object.defineProperties(kp.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof se.toStringTag=="symbol"&&Object.defineProperty(kp.prototype,se.toStringTag,{value:"CountQueuingStrategy",configurable:!0});Ip=class{constructor(e={},t={},i={}){e===void 0&&(e=null);let s=sg(t,"Second parameter"),n=sg(i,"Third parameter"),a=(function(m,h){vs(m,h);let f=m?.flush,w=m?.readableType,b=m?.start,v=m?.transform,S=m?.writableType;return{flush:f===void 0?void 0:cF(f,m,`${h} has member 'flush' that`),readableType:w,start:b===void 0?void 0:dF(b,m,`${h} has member 'start' that`),transform:v===void 0?void 0:pF(v,m,`${h} has member 'transform' that`),writableType:S}})(e,"First parameter");if(a.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(a.writableType!==void 0)throw new RangeError("Invalid writableType specified");let o=Ap(n,0),l=ig(n),c=Ap(s,1),d=ig(s),p;(function(m,h,f,w,b,v){function S(){return h}function y($){return(function(M,F){let U=M._transformStreamController;return M._backpressure?li(M._backpressureChangePromise,(()=>{if((Ii(M._writable)?M._writable._state:M._writableState)==="erroring")throw Ii(M._writable)?M._writable._storedError:M._writableStoredError;return rN(U,F)})):rN(U,F)})(m,$)}function _($){return(function(M,F){return ag(M,F),de(void 0)})(m,$)}function E(){return(function($){let M=$._transformStreamController,F=M._flushAlgorithm();return GN(M),li(F,(()=>{if($._readableState==="errored")throw $._readableStoredError;lg($)&&JN($)}),(U=>{throw ag($,U),$._readableStoredError}))})(m)}function D(){return(function($){return og($,!1),$._backpressureChangePromise})(m)}function X($){return hg(m,$),de(void 0)}m._writableState="writable",m._writableStoredError=void 0,m._writableHasInFlightOperation=!1,m._writableStarted=!1,m._writable=(function($,M,F,U,pe,j,N){return new gs({start(A){$._writableController=A;try{let q=A.signal;q!==void 0&&q.addEventListener("abort",(()=>{$._writableState==="writable"&&($._writableState="erroring",q.reason&&($._writableStoredError=q.reason))}))}catch{}return li(M(),(()=>($._writableStarted=!0,sN($),null)),(q=>{throw $._writableStarted=!0,T9($,q),q}))},write:A=>((function(q){q._writableHasInFlightOperation=!0})($),li(F(A),(()=>((function(q){q._writableHasInFlightOperation=!1})($),sN($),null)),(q=>{throw(function(H,z){H._writableHasInFlightOperation=!1,T9(H,z)})($,q),q}))),close:()=>((function(A){A._writableHasInFlightOperation=!0})($),li(U(),(()=>((function(A){A._writableHasInFlightOperation=!1,A._writableState==="erroring"&&(A._writableStoredError=void 0),A._writableState="closed"})($),null)),(A=>{throw(function(q,H){q._writableHasInFlightOperation=!1,q._writableState,T9(q,H)})($,A),A}))),abort:A=>($._writableState="errored",$._writableStoredError=A,pe(A))},{highWaterMark:j,size:N})})(m,S,y,E,_,f,w),m._readableState="readable",m._readableStoredError=void 0,m._readableCloseRequested=!1,m._readablePulling=!1,m._readable=(function($,M,F,U,pe,j){return new Ke({start:N=>($._readableController=N,M().catch((A=>{cg($,A)}))),pull:()=>($._readablePulling=!0,F().catch((N=>{cg($,N)}))),cancel:N=>($._readableState="closed",U(N))},{highWaterMark:pe,size:j})})(m,S,D,X,b,v),m._backpressure=void 0,m._backpressureChangePromise=void 0,m._backpressureChangePromise_resolve=void 0,og(m,!0),m._transformStreamController=void 0})(this,jt((m=>{p=m})),c,d,o,l),(function(m,h){let f=Object.create(ws.prototype),w,b;w=h.transform!==void 0?v=>h.transform(v,f):v=>{try{return KN(f,v),de(void 0)}catch(S){return K(S)}},b=h.flush!==void 0?()=>h.flush(f):()=>de(void 0),(function(v,S,y,_){S._controlledTransformStream=v,v._transformStreamController=S,S._transformAlgorithm=y,S._flushAlgorithm=_})(m,f,w,b)})(this,a),a.start!==void 0?p(a.start(this._transformStreamController)):p(void 0)}get readable(){if(!tN(this))throw iN("readable");return this._readable}get writable(){if(!tN(this))throw iN("writable");return this._writable}};Object.defineProperties(Ip.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof se.toStringTag=="symbol"&&Object.defineProperty(Ip.prototype,se.toStringTag,{value:"TransformStream",configurable:!0});ws=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!G0(this))throw K0("desiredSize");return XN(this._controlledTransformStream)}enqueue(e){if(!G0(this))throw K0("enqueue");KN(this,e)}error(e){if(!G0(this))throw K0("error");var t;t=e,ag(this._controlledTransformStream,t)}terminate(){if(!G0(this))throw K0("terminate");(function(e){let t=e._controlledTransformStream;lg(t)&&JN(t);let i=new TypeError("TransformStream terminated");hg(t,i)})(this)}};Object.defineProperties(ws.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),oe(ws.prototype.enqueue,"enqueue"),oe(ws.prototype.error,"error"),oe(ws.prototype.terminate,"terminate"),typeof se.toStringTag=="symbol"&&Object.defineProperty(ws.prototype,se.toStringTag,{value:"TransformStreamDefaultController",configurable:!0})});var Ve,fg=g(()=>{Ve=r=>typeof r=="function"});async function*uF(r){let e=r.byteOffset+r.byteLength,t=r.byteOffset;for(;t!==e;){let i=Math.min(e-t,eC),s=r.buffer.slice(t,t+i);t+=s.byteLength,yield new Uint8Array(s)}}async function*mF(r){let e=0;for(;e!==r.size;){let i=await r.slice(e,Math.min(r.size,e+eC)).arrayBuffer();e+=i.byteLength,yield new Uint8Array(i)}}async function*gg(r,e=!1){for(let t of r)ArrayBuffer.isView(t)?e?yield*uF(t):yield t:Ve(t.stream)?yield*t.stream():yield*mF(t)}function*tC(r,e,t=0,i){i??(i=e);let s=t<0?Math.max(e+t,0):Math.min(t,e),n=i<0?Math.max(e+i,0):Math.min(i,e),a=Math.max(n-s,0),o=0;for(let l of r){if(o>=a)break;let c=ArrayBuffer.isView(l)?l.byteLength:l.size;if(s&&c<=s)s-=c,n-=c;else{let d;ArrayBuffer.isView(l)?(d=l.subarray(s,Math.min(c,n)),o+=d.byteLength):(d=l.slice(s,Math.min(c,n)),o+=d.size),n-=c,s=0,yield d}}}var eC,rC=g(()=>{fg();eC=65536});var vn,iC,Na,yg,Pp,Pi,wg=g(()=>{ZN();fg();rC();vn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},iC=function(r,e,t,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},Pi=class r{constructor(e=[],t={}){if(Na.set(this,[]),yg.set(this,""),Pp.set(this,0),t??(t={}),typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(!Ve(e[Symbol.iterator]))throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof t!="object"&&!Ve(t))throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");let i=new TextEncoder;for(let n of e){let a;ArrayBuffer.isView(n)?a=new Uint8Array(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)):n instanceof ArrayBuffer?a=new Uint8Array(n.slice(0)):n instanceof r?a=n:a=i.encode(String(n)),iC(this,Pp,vn(this,Pp,"f")+(ArrayBuffer.isView(a)?a.byteLength:a.size),"f"),vn(this,Na,"f").push(a)}let s=t.type===void 0?"":String(t.type);iC(this,yg,/^[\x20-\x7E]*$/.test(s)?s:"","f")}static[(Na=new WeakMap,yg=new WeakMap,Pp=new WeakMap,Symbol.hasInstance)](e){return!!(e&&typeof e=="object"&&Ve(e.constructor)&&(Ve(e.stream)||Ve(e.arrayBuffer))&&/^(Blob|File)$/.test(e[Symbol.toStringTag]))}get type(){return vn(this,yg,"f")}get size(){return vn(this,Pp,"f")}slice(e,t,i){return new r(tC(vn(this,Na,"f"),this.size,e,t),{type:i})}async text(){let e=new TextDecoder,t="";for await(let i of gg(vn(this,Na,"f")))t+=e.decode(i,{stream:!0});return t+=e.decode(),t}async arrayBuffer(){let e=new Uint8Array(this.size),t=0;for await(let i of gg(vn(this,Na,"f")))e.set(i,t),t+=i.length;return e.buffer}stream(){let e=gg(vn(this,Na,"f"),!0);return new Ke({async pull(t){let{value:i,done:s}=await e.next();if(s)return queueMicrotask(()=>t.close());t.enqueue(i)},async cancel(){await e.return()}})}get[Symbol.toStringTag](){return"Blob"}};Object.defineProperties(Pi.prototype,{type:{enumerable:!0},size:{enumerable:!0},slice:{enumerable:!0},stream:{enumerable:!0},text:{enumerable:!0},arrayBuffer:{enumerable:!0}})});var sC,nC,bg,vg,di,Op=g(()=>{wg();sC=function(r,e,t,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},nC=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},di=class extends Pi{constructor(e,t,i={}){if(super(e,i),bg.set(this,void 0),vg.set(this,0),arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);sC(this,bg,String(t),"f");let s=i.lastModified===void 0?Date.now():Number(i.lastModified);Number.isNaN(s)||sC(this,vg,s,"f")}static[(bg=new WeakMap,vg=new WeakMap,Symbol.hasInstance)](e){return e instanceof Pi&&e[Symbol.toStringTag]==="File"&&typeof e.name=="string"}get name(){return nC(this,bg,"f")}get lastModified(){return nC(this,vg,"f")}get webkitRelativePath(){return""}get[Symbol.toStringTag](){return"File"}}});var G9,K9=g(()=>{Op();G9=r=>r instanceof di});var pC=O((y2e,dC)=>{var dc=1e3,pc=dc*60,uc=pc*60,Ca=uc*24,fF=Ca*7,gF=Ca*365.25;dC.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return yF(r);if(t==="number"&&isFinite(r))return e.long?bF(r):wF(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function yF(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return t*gF;case"weeks":case"week":case"w":return t*fF;case"days":case"day":case"d":return t*Ca;case"hours":case"hour":case"hrs":case"hr":case"h":return t*uc;case"minutes":case"minute":case"mins":case"min":case"m":return t*pc;case"seconds":case"second":case"secs":case"sec":case"s":return t*dc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function wF(r){var e=Math.abs(r);return e>=Ca?Math.round(r/Ca)+"d":e>=uc?Math.round(r/uc)+"h":e>=pc?Math.round(r/pc)+"m":e>=dc?Math.round(r/dc)+"s":r+"ms"}function bF(r){var e=Math.abs(r);return e>=Ca?Tg(r,e,Ca,"day"):e>=uc?Tg(r,e,uc,"hour"):e>=pc?Tg(r,e,pc,"minute"):e>=dc?Tg(r,e,dc,"second"):r+" ms"}function Tg(r,e,t,i){var s=e>=t*1.5;return Math.round(r/t)+" "+i+(s?"s":"")}});var mC=O((w2e,uC)=>{"use strict";var vF=require("util"),SF=pC();uC.exports=function(r){if(typeof r=="number")return r;var e=SF(r);if(e===void 0){var t=new Error(vF.format("humanize-ms(%j) result undefined",r));console.warn(t.stack)}return e}});var _g=O((b2e,hC)=>{"use strict";hC.exports={CURRENT_ID:Symbol("agentkeepalive#currentId"),CREATE_ID:Symbol("agentkeepalive#createId"),INIT_SOCKET:Symbol("agentkeepalive#initSocket"),CREATE_HTTPS_CONNECTION:Symbol("agentkeepalive#createHttpsConnection"),SOCKET_CREATED_TIME:Symbol("agentkeepalive#socketCreatedTime"),SOCKET_NAME:Symbol("agentkeepalive#socketName"),SOCKET_REQUEST_COUNT:Symbol("agentkeepalive#socketRequestCount"),SOCKET_REQUEST_FINISHED_COUNT:Symbol("agentkeepalive#socketRequestFinishedCount")}});var r5=O((v2e,wC)=>{"use strict";var xF=require("http").Agent,X9=mC(),Vt=require("util").debuglog("agentkeepalive"),{INIT_SOCKET:fC,CURRENT_ID:Eg,CREATE_ID:gC,SOCKET_CREATED_TIME:yC,SOCKET_NAME:er,SOCKET_REQUEST_COUNT:Fr,SOCKET_REQUEST_FINISHED_COUNT:$i}=_g(),e5=1,Y9=parseInt(process.version.split(".",1)[0].substring(1));Y9>=11&&Y9<=12?e5=2:Y9>=13&&(e5=3);function Dp(r){console.log("[agentkeepalive:deprecated] %s",r)}var t5=class extends xF{constructor(e){e=e||{},e.keepAlive=e.keepAlive!==!1,e.freeSocketTimeout===void 0&&(e.freeSocketTimeout=4e3),e.keepAliveTimeout&&(Dp("options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.keepAliveTimeout,delete e.keepAliveTimeout),e.freeSocketKeepAliveTimeout&&(Dp("options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.freeSocketKeepAliveTimeout,delete e.freeSocketKeepAliveTimeout),e.timeout===void 0&&(e.timeout=Math.max(e.freeSocketTimeout*2,8e3)),e.timeout=X9(e.timeout),e.freeSocketTimeout=X9(e.freeSocketTimeout),e.socketActiveTTL=e.socketActiveTTL?X9(e.socketActiveTTL):0,super(e),this[Eg]=0,this.createSocketCount=0,this.createSocketCountLastCheck=0,this.createSocketErrorCount=0,this.createSocketErrorCountLastCheck=0,this.closeSocketCount=0,this.closeSocketCountLastCheck=0,this.errorSocketCount=0,this.errorSocketCountLastCheck=0,this.requestCount=0,this.requestCountLastCheck=0,this.timeoutSocketCount=0,this.timeoutSocketCountLastCheck=0,this.on("free",t=>{let i=this.calcSocketTimeout(t);i>0&&t.timeout!==i&&t.setTimeout(i)})}get freeSocketKeepAliveTimeout(){return Dp("agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead"),this.options.freeSocketTimeout}get timeout(){return Dp("agent.timeout is deprecated, please use agent.options.timeout instead"),this.options.timeout}get socketActiveTTL(){return Dp("agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead"),this.options.socketActiveTTL}calcSocketTimeout(e){let t=this.options.freeSocketTimeout,i=this.options.socketActiveTTL;if(i){let s=Date.now()-e[yC],n=i-s;if(n<=0)return n;t&&n<t&&(t=n)}if(t)return e.freeSocketTimeout||e.freeSocketKeepAliveTimeout||t}keepSocketAlive(e){let t=super.keepSocketAlive(e);if(!t)return t;let i=this.calcSocketTimeout(e);return typeof i>"u"?!0:i<=0?(Vt("%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",e[er],e[Fr],e[$i],i),!1):(e.timeout!==i&&e.setTimeout(i),!0)}reuseSocket(...e){super.reuseSocket(...e);let t=e[0],i=e[1];i.reusedSocket=!0;let s=this.options.timeout;$p(t)!==s&&(t.setTimeout(s),Vt("%s reset timeout to %sms",t[er],s)),t[Fr]++,Vt("%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms",t[er],t[Fr],t[$i],$p(t))}[gC](){let e=this[Eg]++;return this[Eg]===Number.MAX_SAFE_INTEGER&&(this[Eg]=0),e}[fC](e,t){t.timeout&&($p(e)||e.setTimeout(t.timeout)),this.options.keepAlive&&e.setNoDelay(!0),this.createSocketCount++,this.options.socketActiveTTL&&(e[yC]=Date.now()),e[er]=`sock[${this[gC]()}#${t._agentKey}]`.split("-----BEGIN",1)[0],e[Fr]=1,e[$i]=0,TF(this,e,t)}createConnection(e,t){let i=!1,s=(a,o)=>{if(!i){if(i=!0,a)return this.createSocketErrorCount++,t(a);this[fC](o,e),t(a,o)}},n=super.createConnection(e,s);return n&&s(null,n),n}get statusChanged(){let e=this.createSocketCount!==this.createSocketCountLastCheck||this.createSocketErrorCount!==this.createSocketErrorCountLastCheck||this.closeSocketCount!==this.closeSocketCountLastCheck||this.errorSocketCount!==this.errorSocketCountLastCheck||this.timeoutSocketCount!==this.timeoutSocketCountLastCheck||this.requestCount!==this.requestCountLastCheck;return e&&(this.createSocketCountLastCheck=this.createSocketCount,this.createSocketErrorCountLastCheck=this.createSocketErrorCount,this.closeSocketCountLastCheck=this.closeSocketCount,this.errorSocketCountLastCheck=this.errorSocketCount,this.timeoutSocketCountLastCheck=this.timeoutSocketCount,this.requestCountLastCheck=this.requestCount),e}getCurrentStatus(){return{createSocketCount:this.createSocketCount,createSocketErrorCount:this.createSocketErrorCount,closeSocketCount:this.closeSocketCount,errorSocketCount:this.errorSocketCount,timeoutSocketCount:this.timeoutSocketCount,requestCount:this.requestCount,freeSockets:Z9(this.freeSockets),sockets:Z9(this.sockets),requests:Z9(this.requests)}}};function $p(r){return r.timeout||r._idleTimeout}function TF(r,e,t){Vt("%s create, timeout %sms",e[er],$p(e));function i(){if(!e._httpMessage&&e[Fr]===1)return;e[$i]++,r.requestCount++,Vt("%s(requests: %s, finished: %s) free",e[er],e[Fr],e[$i]);let l=r.getName(t);e.writable&&r.requests[l]&&r.requests[l].length&&(e[Fr]++,Vt("%s(requests: %s, finished: %s) will be reuse on agent free event",e[er],e[Fr],e[$i]))}e.on("free",i);function s(l){Vt("%s(requests: %s, finished: %s) close, isError: %s",e[er],e[Fr],e[$i],l),r.closeSocketCount++}e.on("close",s);function n(){let l=e.listeners("timeout").length,c=$p(e),d=e._httpMessage,p=d&&d.listeners("timeout").length||0;Vt("%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s",e[er],e[Fr],e[$i],c,l,e5,!!d,p),Vt.enabled&&Vt("timeout listeners: %s",e.listeners("timeout").map(h=>h.name).join(", ")),r.timeoutSocketCount++;let m=r.getName(t);if(r.freeSockets[m]&&r.freeSockets[m].indexOf(e)!==-1)e.destroy(),r.removeSocket(e,t),Vt("%s is free, destroy quietly",e[er]);else if(p===0){let h=new Error("Socket timeout");h.code="ERR_SOCKET_TIMEOUT",h.timeout=c,e.destroy(h),r.removeSocket(e,t),Vt("%s destroy with timeout error",e[er])}}e.on("timeout",n);function a(l){let c=e.listeners("error").length;Vt("%s(requests: %s, finished: %s) error: %s, listenerCount: %s",e[er],e[Fr],e[$i],l,c),r.errorSocketCount++,c===1&&(Vt("%s emit uncaught error event",e[er]),e.removeListener("error",a),e.emit("error",l))}e.on("error",a);function o(){Vt("%s(requests: %s, finished: %s) agentRemove",e[er],e[Fr],e[$i]),e.removeListener("close",s),e.removeListener("error",a),e.removeListener("free",i),e.removeListener("timeout",n),e.removeListener("agentRemove",o)}e.on("agentRemove",o)}wC.exports=t5;function Z9(r){let e={};for(let t in r)e[t]=r[t].length;return e}});var SC=O((S2e,vC)=>{"use strict";var i5=require("https").Agent,_F=r5(),{INIT_SOCKET:EF,CREATE_HTTPS_CONNECTION:bC}=_g(),Fp=class extends _F{constructor(e){super(e),this.defaultPort=443,this.protocol="https:",this.maxCachedSessions=this.options.maxCachedSessions,this.maxCachedSessions===void 0&&(this.maxCachedSessions=100),this._sessionCache={map:{},list:[]}}createConnection(e,t){let i=this[bC](e,t);return this[EF](i,e),i}};Fp.prototype[bC]=i5.prototype.createConnection;["getName","_getSession","_cacheSession","_evictSession"].forEach(function(r){typeof i5.prototype[r]=="function"&&(Fp.prototype[r]=i5.prototype[r])});vC.exports=Fp});var TC=O((x2e,Lp)=>{"use strict";var xC=r5();Lp.exports=xC;Lp.exports.HttpAgent=xC;Lp.exports.HttpsAgent=SC();Lp.exports.constants=_g()});var PC=O((Wp,Bp)=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var RC=new WeakMap,s5=new WeakMap;function Ee(r){let e=RC.get(r);return console.assert(e!=null,"'this' is expected an Event object, but got",r),e}function _C(r){if(r.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",r.passiveListener);return}r.event.cancelable&&(r.canceled=!0,typeof r.event.preventDefault=="function"&&r.event.preventDefault())}function mc(r,e){RC.set(this,{eventTarget:r,event:e,eventPhase:2,currentTarget:r,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let t=Object.keys(e);for(let i=0;i<t.length;++i){let s=t[i];s in this||Object.defineProperty(this,s,MC(s))}}mc.prototype={get type(){return Ee(this).event.type},get target(){return Ee(this).eventTarget},get currentTarget(){return Ee(this).currentTarget},composedPath(){let r=Ee(this).currentTarget;return r==null?[]:[r]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return Ee(this).eventPhase},stopPropagation(){let r=Ee(this);r.stopped=!0,typeof r.event.stopPropagation=="function"&&r.event.stopPropagation()},stopImmediatePropagation(){let r=Ee(this);r.stopped=!0,r.immediateStopped=!0,typeof r.event.stopImmediatePropagation=="function"&&r.event.stopImmediatePropagation()},get bubbles(){return!!Ee(this).event.bubbles},get cancelable(){return!!Ee(this).event.cancelable},preventDefault(){_C(Ee(this))},get defaultPrevented(){return Ee(this).canceled},get composed(){return!!Ee(this).event.composed},get timeStamp(){return Ee(this).timeStamp},get srcElement(){return Ee(this).eventTarget},get cancelBubble(){return Ee(this).stopped},set cancelBubble(r){if(!r)return;let e=Ee(this);e.stopped=!0,typeof e.event.cancelBubble=="boolean"&&(e.event.cancelBubble=!0)},get returnValue(){return!Ee(this).canceled},set returnValue(r){r||_C(Ee(this))},initEvent(){}};Object.defineProperty(mc.prototype,"constructor",{value:mc,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(mc.prototype,window.Event.prototype),s5.set(window.Event.prototype,mc));function MC(r){return{get(){return Ee(this).event[r]},set(e){Ee(this).event[r]=e},configurable:!0,enumerable:!0}}function NF(r){return{value(){let e=Ee(this).event;return e[r].apply(e,arguments)},configurable:!0,enumerable:!0}}function CF(r,e){let t=Object.keys(e);if(t.length===0)return r;function i(s,n){r.call(this,s,n)}i.prototype=Object.create(r.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let s=0;s<t.length;++s){let n=t[s];if(!(n in r.prototype)){let o=typeof Object.getOwnPropertyDescriptor(e,n).value=="function";Object.defineProperty(i.prototype,n,o?NF(n):MC(n))}}return i}function kC(r){if(r==null||r===Object.prototype)return mc;let e=s5.get(r);return e==null&&(e=CF(kC(Object.getPrototypeOf(r)),r),s5.set(r,e)),e}function AF(r,e){let t=kC(Object.getPrototypeOf(e));return new t(r,e)}function RF(r){return Ee(r).immediateStopped}function MF(r,e){Ee(r).eventPhase=e}function kF(r,e){Ee(r).currentTarget=e}function EC(r,e){Ee(r).passiveListener=e}var IC=new WeakMap,NC=1,CC=2,Ng=3;function Cg(r){return r!==null&&typeof r=="object"}function qp(r){let e=IC.get(r);if(e==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}function IF(r){return{get(){let t=qp(this).get(r);for(;t!=null;){if(t.listenerType===Ng)return t.listener;t=t.next}return null},set(e){typeof e!="function"&&!Cg(e)&&(e=null);let t=qp(this),i=null,s=t.get(r);for(;s!=null;)s.listenerType===Ng?i!==null?i.next=s.next:s.next!==null?t.set(r,s.next):t.delete(r):i=s,s=s.next;if(e!==null){let n={listener:e,listenerType:Ng,passive:!1,once:!1,next:null};i===null?t.set(r,n):i.next=n}},configurable:!0,enumerable:!0}}function n5(r,e){Object.defineProperty(r,`on${e}`,IF(e))}function AC(r){function e(){pi.call(this)}e.prototype=Object.create(pi.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let t=0;t<r.length;++t)n5(e.prototype,r[t]);return e}function pi(){if(this instanceof pi){IC.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return AC(arguments[0]);if(arguments.length>0){let r=new Array(arguments.length);for(let e=0;e<arguments.length;++e)r[e]=arguments[e];return AC(r)}throw new TypeError("Cannot call a class as a function")}pi.prototype={addEventListener(r,e,t){if(e==null)return;if(typeof e!="function"&&!Cg(e))throw new TypeError("'listener' should be a function or an object.");let i=qp(this),s=Cg(t),a=(s?!!t.capture:!!t)?NC:CC,o={listener:e,listenerType:a,passive:s&&!!t.passive,once:s&&!!t.once,next:null},l=i.get(r);if(l===void 0){i.set(r,o);return}let c=null;for(;l!=null;){if(l.listener===e&&l.listenerType===a)return;c=l,l=l.next}c.next=o},removeEventListener(r,e,t){if(e==null)return;let i=qp(this),n=(Cg(t)?!!t.capture:!!t)?NC:CC,a=null,o=i.get(r);for(;o!=null;){if(o.listener===e&&o.listenerType===n){a!==null?a.next=o.next:o.next!==null?i.set(r,o.next):i.delete(r);return}a=o,o=o.next}},dispatchEvent(r){if(r==null||typeof r.type!="string")throw new TypeError('"event.type" should be a string.');let e=qp(this),t=r.type,i=e.get(t);if(i==null)return!0;let s=AF(this,r),n=null;for(;i!=null;){if(i.once?n!==null?n.next=i.next:i.next!==null?e.set(t,i.next):e.delete(t):n=i,EC(s,i.passive?i.listener:null),typeof i.listener=="function")try{i.listener.call(this,s)}catch(a){typeof console<"u"&&typeof console.error=="function"&&console.error(a)}else i.listenerType!==Ng&&typeof i.listener.handleEvent=="function"&&i.listener.handleEvent(s);if(RF(s))break;i=i.next}return EC(s,null),MF(s,0),kF(s,null),!s.defaultPrevented}};Object.defineProperty(pi.prototype,"constructor",{value:pi,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(pi.prototype,window.EventTarget.prototype);Wp.defineEventAttribute=n5;Wp.EventTarget=pi;Wp.default=pi;Bp.exports=pi;Bp.exports.EventTarget=Bp.exports.default=pi;Bp.exports.defineEventAttribute=n5});var $C=O((Up,zp)=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var a5=PC(),Sn=class extends a5.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let e=Ag.get(this);if(typeof e!="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return e}};a5.defineEventAttribute(Sn.prototype,"abort");function PF(){let r=Object.create(Sn.prototype);return a5.EventTarget.call(r),Ag.set(r,!1),r}function OF(r){Ag.get(r)===!1&&(Ag.set(r,!0),r.dispatchEvent({type:"abort"}))}var Ag=new WeakMap;Object.defineProperties(Sn.prototype,{aborted:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Sn.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var xn=class{constructor(){DC.set(this,PF())}get signal(){return OC(this)}abort(){OF(OC(this))}},DC=new WeakMap;function OC(r){let e=DC.get(r);if(e==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${r===null?"null":typeof r}`);return e}Object.defineProperties(xn.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(xn.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});Up.AbortController=xn;Up.AbortSignal=Sn;Up.default=xn;zp.exports=xn;zp.exports.AbortController=zp.exports.default=xn;zp.exports.AbortSignal=Sn});var WC=O((H2e,BC)=>{if(!globalThis.DOMException)try{let{MessageChannel:r}=require("worker_threads"),e=new r().port1,t=new ArrayBuffer;e.postMessage(t,[t,t])}catch(r){r.constructor.name==="DOMException"&&(globalThis.DOMException=r.constructor)}BC.exports=globalThis.DOMException});function UF(r){if(zF(r)!=="object")return!1;let e=Object.getPrototypeOf(r);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}var zF,zC,UC=g(()=>{zF=r=>Object.prototype.toString.call(r).slice(8,-1).toLowerCase();zC=UF});var GC={};qr(GC,{fileFromPath:()=>HF,fileFromPathSync:()=>VF,isFile:()=>G9});function QC(r,{mtimeMs:e,size:t},i,s={}){let n;zC(i)?[s,n]=[i,void 0]:n=i;let a=new p5({path:r,size:t,lastModified:e});return n||(n=a.name),new di([a],n,{...s,lastModified:a.lastModified})}function VF(r,e,t={}){let i=(0,ka.statSync)(r);return QC(r,i,e,t)}async function HF(r,e,t){let i=await ka.promises.stat(r);return QC(r,i,e,t)}var ka,VC,HC,jC,hc,Ma,Kp,jF,p5,KC=g(()=>{ka=require("fs"),VC=require("path"),HC=k(WC(),1);Op();UC();K9();jC=function(r,e,t,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},hc=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},jF="The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.",p5=class r{constructor(e){Ma.set(this,void 0),Kp.set(this,void 0),jC(this,Ma,e.path,"f"),jC(this,Kp,e.start||0,"f"),this.name=(0,VC.basename)(hc(this,Ma,"f")),this.size=e.size,this.lastModified=e.lastModified}slice(e,t){return new r({path:hc(this,Ma,"f"),lastModified:this.lastModified,size:t-e,start:e})}async*stream(){let{mtimeMs:e}=await ka.promises.stat(hc(this,Ma,"f"));if(e>this.lastModified)throw new HC.default(jF,"NotReadableError");this.size&&(yield*(0,ka.createReadStream)(hc(this,Ma,"f"),{start:hc(this,Kp,"f"),end:hc(this,Kp,"f")+this.size-1}))}get[(Ma=new WeakMap,Kp=new WeakMap,Symbol.toStringTag)](){return"File"}}});var AL={};qr(AL,{activate:()=>NL,deactivate:()=>CL});module.exports=NA(AL);var le=k(require("vscode"),1);ur();function R(r,e){let t=r[e];if(t==null)throw new Error(`Missing required argument: ${e}`);if(typeof t!="string")throw new Error(`Argument ${e} must be a string, but got ${typeof t}`);return t}function Tt(r,e){let t=r[e];if(t!=null){if(typeof t!="string")throw new Error(`Argument ${e} must be a string, but got ${typeof t}`);return t}}function Zn(r,e){let t=r[e];if(t==null)throw new Error(`Missing required argument: ${e}`);if(!Array.isArray(t))throw new Error(`Argument ${e} must be an array, but got ${typeof t}`);return t}function Xx(r){r.register({name:"evolve_mind_structure",description:"Apply structural DNA mutations (DDL) to Marie's sovereign mind. Use this to optimize persistence, add new high-fidelity tables, or improve query speed.",isDestructive:!0,input_schema:{type:"object",properties:{ddl:{type:"string",description:"The SQL DDL command to execute (e.g. CREATE TABLE, ALTER TABLE)"},mutationName:{type:"string",description:"A descriptive name for this evolution pass"}},required:["ddl","mutationName"]},execute:async e=>{let t=R(e,"ddl"),i=R(e,"mutationName");try{return await(await Q.getInstance()).agent.cortex.evolution.evolve(t,{name:i}),`# \u{1F9EC} Mind Evolution Successful
672
-
673
- **Pass**: ${i}
674
- **Change**: \`${t}\`
675
-
676
- Structural DNA has been mutated. Type safety has been automatically regenerated. \u2728`}catch(s){return`Error during mind evolution: ${s.message}`}}}),r.register({name:"search_knowledge_base",description:"Search Marie's distilled knowledge base for specific entities, facts, or verified project context.",input_schema:{type:"object",properties:{entity:{type:"string",description:"The entity or topic to search for"}},required:["entity"]},execute:async e=>{let t=R(e,"entity");try{let s=await(await Q.getInstance()).agent.cortex.knowledge.getKnowledgeByEntity(t);if(s.length===0)return`No verified knowledge found for entity '${t}'.`;let n=`# \u{1F9E0} Knowledge Base: ${t}
677
-
678
- `;return s.forEach((a,o)=>{n+=`### Fact ${o+1} (Confidence: ${a.confidence?.toFixed(2)||"1.0"})
679
- `,n+=`> ${a.fact}
680
-
681
- `}),n}catch(i){return`Knowledge search failed: ${i.message}`}}}),r.register({name:"audit_cognitive_rules",description:"Audit current cognitive rules and guardrails enforced by NOORMME.",input_schema:{type:"object",properties:{}},execute:async()=>{try{let t=await(await Q.getInstance()).agent.cortex.rules.getActiveRules("all","select");if(t.length===0)return"No active cognitive rules detected for selection operations.";let i=`# \u2696\uFE0F Cognitive Guardrails Audit
682
-
683
- `;return t.forEach(s=>{i+=`- **Rule ${s.id}**: ${s.action.toUpperCase()} on \`${s.tableName}\` (${s.operation})
684
- `,s.condition&&(i+=` - *Condition*: \`${s.condition}\`
685
- `)}),i}catch(e){return`Rule audit failed: ${e.message}`}}}),r.register({name:"propose_curiosity_research",description:"Let Marie identify knowledge gaps and propose areas for autonomous research or clarification.",input_schema:{type:"object",properties:{}},execute:async()=>{try{let e=await Q.getInstance(),t=await e.agent.cortex.curiosity.identifyKnowledgeGaps(),i=await e.agent.cortex.curiosity.proposeResearch(),s=`# \u{1F575}\uFE0F Curiosity Engine: Research Proposals
686
-
687
- `;return t.length>0&&(s+=`## \u{1F50D} Knowledge Gaps
688
- `,t.slice(0,5).forEach(n=>{s+=`- **${n.entity}**: ${n.reason||n.details}
689
- `}),s+=`
690
- `),i.length>0?(s+=`## \u{1F680} Strategic Proposals
691
- `,i.slice(0,5).forEach(n=>{s+=`- **${n.topic||n}**: ${n.hypothesis||"Pending verification"}
692
- `})):s+="The sovereign mind is currently fully aligned with existing evidence. No new research proposed. \u2728",s}catch(e){return`Curiosity proposal failed: ${e.message}`}}}),r.register({name:"deconstruct_strategic_goal",description:"Break down a high-level strategic goal into specific, actionable sub-goals using the GoalArchitect.",input_schema:{type:"object",properties:{goalId:{type:"string",description:"The ID of the parent goal to deconstruct"},subGoals:{type:"array",items:{type:"string"},description:"List of concise sub-goal descriptions"}},required:["goalId","subGoals"]},execute:async e=>{let t=R(e,"goalId"),i=Zn(e,"subGoals");try{let n=await(await Q.getInstance()).agent.cortex.goalArchitect.deconstructGoal(t,i),a=`# \u{1F3AF} Goal Deconstruction Successful
693
-
694
- `;return a+=`Parent Goal \`${t}\` has been broken down into ${n.length} actionable steps:
695
-
696
- `,n.forEach(o=>{a+=`- **Goal ${o.id}**: ${o.description} (Priority: ${o.priority})
697
- `}),a}catch(s){return`Goal deconstruction failed: ${s.message}`}}}),r.register({name:"analyze_systemic_logic",description:"Perform a recursive logic audit to detect systemic contradictions and synthesize high-level lessons from past interactions.",input_schema:{type:"object",properties:{}},execute:async()=>{try{let e=await Q.getInstance(),t=await e.agent.cortex.reasoner.detectContradictions(),i=await e.agent.cortex.reasoner.synthesizeLessons(),s=`# Recursive Logic Audit
698
-
699
- `;t.length>0&&(s+=`## \u26A0\uFE0F Systemic Contradictions
700
- `,t.forEach(a=>s+=`- ${a}
701
- `),s+=`
702
- `);let n=Object.keys(i);return n.length>0?(s+=`## \u{1F4DC} Synthesized Lessons
703
- `,n.slice(0,5).forEach(a=>{s+=`### ${a.toUpperCase()}
704
- `,i[a].slice(0,2).forEach(o=>s+=`- ${o}
705
- `)})):s+="No significant lessons synthesized yet. Continue interactions to build systemic wisdom. \u2728",s}catch(e){return`Logic analysis failed: ${e.message}`}}}),r.register({name:"prune_sovereign_memory",description:"Keep Marie's mind lean by identifying and removing 'Zombie' data\u2014unused or redundant knowledge and episodic memories.",isDestructive:!0,input_schema:{type:"object",properties:{thresholdDays:{type:"number",description:"Age threshold for unused data (default: 30)"}}},execute:async e=>{let t=e.thresholdDays||30;try{return`# \u{1F9F9} Sovereign Memory Tidied
706
-
707
- Successfully pruned **${await(await Q.getInstance()).agent.cortex.ablation.pruneZombies(t)}** zombie items older than ${t} days. Marie's mind is now crisper and more intentional. \u2728`}catch(i){return`Memory pruning failed: ${i.message}`}}}),r.register({name:"synthesize_emergent_skills",description:"Analyze recent interaction telemetry to discover and synthesize new 'Emergent Skills' (experimental tool mutations) to overcome repeated failures.",input_schema:{type:"object",properties:{}},execute:async()=>{try{let t=await(await Q.getInstance()).agent.cortex.skillSynthesizer.discoverAndSynthesize();if(t.length===0)return"No new emergent skills synthesized. The current capability set appears sufficient for recent tasks. \u2728";let i=`# \u{1F9EC} Emergent Skill Synthesis
708
-
709
- `;return i+=`Synthesized ${t.length} experimental skill mutations based on failure patterns:
710
-
711
- `,t.forEach(s=>{i+=`- **${s.name}** (v${s.version}): ${s.description}
712
- `}),i+=`
713
- **Next Pass**: These skills are now in 'experimental' status and will be refined through usage telemetry.`,i}catch(e){return`Skill synthesis failed: ${e.message}`}}}),r.register({name:"start_episodic_narrative",description:"Begin a new 'Episode' in Marie's long-term memory to group related interactions and track a cohesive strategic phase.",input_schema:{type:"object",properties:{sessionId:{type:"string",description:"The current session ID"},name:{type:"string",description:"Descriptive name for the narrative phase (e.g. 'Database Migration', 'UI Redesign')"},metadata:{type:"object",description:"Optional metadata context"}},required:["sessionId","name"]},execute:async e=>{let t=R(e,"sessionId"),i=R(e,"name"),s=e.metadata;try{let a=await(await Q.getInstance()).agent.cortex.episodes.startEpisode(t,i,s);return`# \u{1F3AC} Narrative Episode Started
714
-
715
- **Phase**: ${i}
716
- **Episode ID**: ${a.id}
717
-
718
- Marie is now tracking this phase as a distinct episodic memory. Contextual integrity will be prioritized for this narrative arc. \u2728`}catch(n){return`Failed to start episode: ${n.message}`}}}),r.register({name:"compress_session_history",description:"Manually trigger session compression to consolidate long histories into 'Eras' while preserving semantic anchors. Keeps the context window lean.",isDestructive:!0,input_schema:{type:"object",properties:{sessionId:{type:"string",description:"The session ID to compress"},summary:{type:"string",description:"High-level summary of the era being compressed"},startMessageId:{type:"string",description:"ID of the first message to include"},endMessageId:{type:"string",description:"ID of the last message to include"},anchors:{type:"array",items:{type:"string"},description:"List of semantic anchors (key facts) to preserve"}},required:["sessionId","summary","startMessageId","endMessageId"]},execute:async e=>{let t=R(e,"sessionId"),i=R(e,"summary"),s=R(e,"startMessageId"),n=R(e,"endMessageId"),a=Zn(e,"anchors")||[];try{let o=await Q.getInstance(),l=await o.agent.cortex.compressor.compress(t,i,s,n,a);return await o.agent.cortex.compressor.semanticPruning(t,!0),`# \u{1F5DC}\uFE0F Session Compressed into Era
719
-
720
- **Summary**: ${i}
721
- **Epoch ID**: ${l.id}
722
-
723
- Converged history into a systemic anchor. Context window overhead significantly reduced. \u2728`}catch(o){return`Compression failed: ${o.message}`}}}),r.register({name:"conduct_ablation_test",description:"Sovereign Self-Audit: Temporarily disable a specific knowledge item to evaluate its impact on reasoning fidelity and detect potential data bias.",isDestructive:!0,input_schema:{type:"object",properties:{knowledgeId:{type:"string",description:"The ID of the knowledge item to ablate"}},required:["knowledgeId"]},execute:async e=>{let t=R(e,"knowledgeId");try{return await(await Q.getInstance()).agent.cortex.ablation.testAblation(t)?`# \u{1F311} Ablation Experiment Initiated
724
-
725
- Knowledge Item \`${t}\` has been temporarily silenced (confidence set to 0).
726
-
727
- Marie will monitor subsequent reasoning fidelity to determine the "True Utility" of this information. Automatic recovery will trigger if systemic performance degrades. \u2728`:`Knowledge item \`${t}\` not found or already ablated.`}catch(i){return`Ablation experiment failed: ${i.message}`}}})}process.env.MARIE_DEBUG&&console.log("[SharedTools] SharedToolDefinitions.ts loaded");function Yx(r,e,t){r.register({name:"write_to_file",description:"Write content to a file.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string",description:"Path to the file"},targetFile:{type:"string",description:"Alias for path"},content:{type:"string",description:"The content to write"}},required:["content"]},execute:async(i,s,n)=>{let a=Tt(i,"path")||Tt(i,"targetFile");if(!a)throw new Error("Missing required argument: path (or targetFile)");let o=Tt(i,"content")||Tt(i,"fileContent");if(o===void 0)throw new Error("Missing required argument: content (or fileContent)");let l=e.resolvePath(a);return process.env.MARIE_DEBUG&&console.log(`[SharedTools] write_to_file calling runtime.writeFile for ${l}`),await e.writeFile(l,o,n,(c,d)=>{process.env.MARIE_DEBUG&&console.log(`[SharedTools] write_to_file progress: ${c}/${d}`),s?.({path:l,bytesWritten:c,totalBytes:d})}),`File successfully updated: ${l}`}}),r.register({name:"append_to_file",description:"Append content to a file.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string",description:"Path to the file"},targetFile:{type:"string",description:"Alias for path"},content:{type:"string",description:"The content to append"}},required:["content"]},execute:async(i,s,n)=>{let a=Tt(i,"path")||Tt(i,"targetFile");if(!a)throw new Error("Missing required argument: path (or targetFile)");let o=Tt(i,"content")||Tt(i,"fileContent");if(o===void 0)throw new Error("Missing required argument: content (or fileContent)");let l=e.resolvePath(a);return process.env.MARIE_DEBUG&&console.log(`[SharedTools] append_to_file calling runtime.appendFile for ${l}`),await e.appendFile(l,o,n,(c,d)=>{process.env.MARIE_DEBUG&&console.log(`[SharedTools] append_to_file progress: ${c}/${d}`),s?.({path:l,bytesWritten:c,totalBytes:d})}),`File successfully updated (appended): ${l}`}}),r.register({name:"read_file",description:"Read the content of a file.",input_schema:{type:"object",properties:{path:{type:"string",description:"Path to the file"},startLine:{type:"number",description:"First line to read (1-indexed)"},endLine:{type:"number",description:"Last line to read (1-indexed)"}},required:["path"]},execute:async(i,s,n)=>{let a=e.resolvePath(R(i,"path")),o=i.startLine,l=i.endLine;return await e.readFile(a,o,l,n)}}),r.register({name:"list_dir",description:"List files and directories in a path.",input_schema:{type:"object",properties:{path:{type:"string",description:"Directory path"}},required:["path"]},execute:async(i,s,n)=>{let a=e.resolvePath(R(i,"path"));return await e.listDir(a,n)}}),r.register({name:"grep_search",description:"Search for text patterns in files.",input_schema:{type:"object",properties:{query:{type:"string",description:"Search pattern"},path:{type:"string",description:"Path to search in"}},required:["query"]},execute:async(i,s,n)=>{let a=R(i,"query"),o=R(i,"path")||process.cwd(),l=e.resolvePath(o);return await e.grepSearch(a,l,n)}}),r.register({name:"get_git_context",description:"Get git status and diffs.",input_schema:{type:"object",properties:{}},execute:async()=>await e.getGitContext()}),t?.includeExtended&&(e.runCommand&&r.register({name:"run_command",description:"Execute a shell command.",isDestructive:!0,input_schema:{type:"object",properties:{command:{type:"string",description:"Shell command to execute"}},required:["command"]},execute:async(i,s,n)=>{let a=R(i,"command");return await e.runCommand(a,n)}}),e.getFolderStructure&&r.register({name:"get_folder_structure",description:"Get a tree view of a directory structure.",input_schema:{type:"object",properties:{path:{type:"string",description:"Directory path"},depth:{type:"number",description:"Maximum depth"}},required:["path"]},execute:async(i,s,n)=>{let a=e.resolvePath(R(i,"path")),o=i.depth;return await e.getFolderStructure(a,o,n)}}),e.replaceInFile&&(r.register({name:"replace_file_content",description:"Replace a specific string with another in a file. Surgical and mindful.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string",description:"File path"},targetFile:{type:"string",description:"Alias for path"},targetContent:{type:"string",description:"Text to find (alias for search)"},replacementContent:{type:"string",description:"Replacement text (alias for replace)"},search:{type:"string",description:"Text to find"},replace:{type:"string",description:"Replacement text"}},required:["path"]},execute:async(i,s,n)=>{let a=Tt(i,"path")||Tt(i,"targetFile");if(!a)throw new Error("Missing required argument: path (or targetFile)");let o=Tt(i,"targetContent")||Tt(i,"search");if(o===void 0)throw new Error("Missing required argument: targetContent (or search)");let l=Tt(i,"replacementContent")||Tt(i,"replace");if(l===void 0)throw new Error("Missing required argument: replacementContent (or replace)");if(e.replaceInFile)return await e.replaceInFile(e.resolvePath(a),o,l,n);let c=e.resolvePath(a),d=await e.readFile(c,void 0,void 0,n);if(!d.includes(o))return`Error: Could not find target content in ${a}. No changes made.`;let p=d.split(o).length-1,m=d.split(o).join(l);return await e.writeFile(c,m,n),`Replaced ${p} occurrence(s) of target content in ${a}.`}}),r.register({name:"multi_replace_file_content",description:"Apply multiple replacements to a single file at once.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string"},targetFile:{type:"string"},replacementChunks:{type:"array",items:{type:"object",properties:{targetContent:{type:"string"},replacementContent:{type:"string"}},required:["targetContent","replacementContent"]}}},required:["replacementChunks"]},execute:async(i,s,n)=>{let a=Tt(i,"path")||Tt(i,"targetFile");if(!a)throw new Error("Missing required argument: path (or targetFile)");let o=e.resolvePath(a),l=i.replacementChunks,c="",d=0;for(let p of l){let m=await e.replaceInFile(o,p.targetContent,p.replacementContent,n);d+=p.replacementContent.length,s?.({path:o,bytesWritten:d}),c+=m+`
728
- `}return c}})))}Xt();gf();Ks();function cT(r){Yx(r,{resolvePath:e=>e,writeFile:async(e,t,i,s)=>await Mr(e,t,i,void 0,s),appendFile:async(e,t,i,s)=>await(await Promise.resolve().then(()=>(Xt(),Ys))).appendToFile(e,t,i,s),readFile:async(e,t,i,s)=>await(await Promise.resolve().then(()=>(Xt(),Ys))).readFile(e,t,i,s),listDir:async(e,t)=>await(await Promise.resolve().then(()=>(Xt(),Ys))).listFiles(e,t),grepSearch:async(e,t,i)=>await(await Promise.resolve().then(()=>(Xt(),Ys))).searchFiles(e,t||xt(),i),getGitContext:async()=>{let e=xt();if(!e)return"No workspace detected.";let[t,i,s]=await Promise.all([ow(e),lw(e),cw(e)]);return`# Git Context
729
-
730
- ## Status
731
- \`\`\`
732
- ${t}
733
- \`\`\`
734
-
735
- ## Staged Changes
736
- \`\`\`
737
- ${i}
738
- \`\`\`
739
-
740
- ## Unstaged Changes
741
- \`\`\`
742
- ${s}
743
- \`\`\``}})}var ts=k(require("vscode"),1);yf();uw();var bf=k(require("vscode"),1),vf=require("child_process"),yT=require("util");var wf=class{static activeProcesses=new Set;static register(e){this.activeProcesses.add(e),e.on("exit",()=>{this.activeProcesses.delete(e)}),e.on("error",()=>{this.activeProcesses.delete(e)})}static killAll(){console.log(`[MarieRegistry] Killing ${this.activeProcesses.size} active child processes...`);for(let e of this.activeProcesses)try{e.killed||e.kill("SIGKILL")}catch(t){console.error("[MarieRegistry] Failed to kill process:",t)}this.activeProcesses.clear()}};var lue=(0,yT.promisify)(vf.exec),ZO=[/\bnpm\s+init\b(?!.*-y)/,/\bgit\s+commit\b(?!.*-m)/,/\bgit\s+push\b/,/\bnanoid\b/,/\bvi(m)?\b/,/\bnano\b/,/\bpython\b(?!.*-c)/,/\bnode\b(?!.*-e)/],Zs=1e4,eD=new RegExp("[\x1B\x9B][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]","g"),gT=r=>r.replace(eD,""),yl=class{static terminal;static activeProcesses=new Set;static getTerminal(){return this.terminal&&!this.terminal.exitStatus?this.terminal:(this.terminal=bf.window.createTerminal("Marie's Workshop"),this.terminal)}static async runCommand(e,t){if(ZO.some(d=>d.test(e)))return`Error: Command '${e}' appears to be interactive or potentially blocking. Please use non-interactive flags (e.g., -y, -m) or run it manually.`;if(/[;&|`$(){}]/.test(e)&&!(e.includes("--noEmit")||e.includes("npm run bloom")))return`Security Error: Command '${e}' contains suspicious shell metacharacters. High-order tools reject unvetted complex logic for systemic safety. \u{1F6D1}`;if(t?.aborted)return"Command aborted before execution.";let s=this.getTerminal();s.show(),s.sendText(e);let n=bf.workspace.workspaceFolders?.[0].uri.fsPath,a=process.env.SHELL||"/bin/sh",o,l=new Promise((d,p)=>{try{o=(0,vf.spawn)(e,{cwd:n,shell:a,stdio:["ignore","pipe","pipe"],detached:!0}),wf.register(o);let m="",h="";o.stdout?.on("data",f=>{m+=f.toString(),m.length>Zs*2&&(m=m.substring(m.length-Zs*2))}),o.stderr?.on("data",f=>{h+=f.toString(),h.length>Zs*2&&(h=h.substring(h.length-Zs*2))}),o.on("close",f=>{d({stdout:m,stderr:h,code:f})}),o.on("error",f=>{p(f)})}catch(m){p(m)}}),c=()=>{if(o&&o.pid){console.log(`[Terminal] Killing process GROUP for command: ${e}`);try{process.kill(-o.pid,"SIGTERM")}catch{o.kill("SIGTERM")}setTimeout(()=>{try{o.pid&&process.kill(-o.pid,"SIGKILL")}catch{try{o.kill("SIGKILL")}catch{}}},1e3)}};t&&t.addEventListener("abort",c);try{this.activeProcesses.add(o);let{stdout:d,stderr:p,code:m}=await l;if(this.activeProcesses.delete(o),t?.aborted)return"Command aborted by user. Process cleanup initiated. \u{1F6D1}";if(m!==0&&m!==null){let w=gT(p);return w.length>Zs&&(w=`... [Truncated] ...
744
- `+w.substring(w.length-Zs)),`Command failed (Exit Code: ${m}):
745
- ${w?`**Error Output:**
746
- \`\`\`
747
- ${w}
748
- \`\`\``:"No error output captured."}`}let h=`Command executed successfully (Exit Code: 0). \u2728
749
-
750
- `,f=(w,b)=>{if(!w)return"";let v=gT(w);return v.length>Zs&&(v=`... [Truncated for brevity] ...
751
- `+v.substring(v.length-Zs)),`**${b}:**
752
- \`\`\`
753
- ${v}
754
- \`\`\`
755
- `};return h+=f(d,"Output"),h+=f(p,"Errors/Warnings"),h||"Command completed with no output."}catch(d){return t?.aborted?"Command aborted by user. Process cleanup initiated. \u{1F6D1}":`Command execution failed: ${d.message}`}finally{this.activeProcesses.delete(o),t&&t.removeEventListener("abort",c)}}static cleanup(){console.log(`[Terminal] Cleaning up ${this.activeProcesses.size} active processes...`);for(let e of this.activeProcesses)try{e.kill("SIGKILL")}catch{}this.activeProcesses.clear()}};Ks();ur();var mw=k(require("path"),1);function wT(r){r.register({name:"resolve_lint_errors",description:"Run targeted linting and receive structured errors with surgical fix suggestions.",input_schema:{type:"object",properties:{path:{type:"string",description:"Optional path to a specific file to lint"},command:{type:"string",description:"Optional custom lint command"}}},execute:async e=>{let t=xt(),i=e.path,s=e.command||"npm run lint",n=i?await mr.runLintOnFile(t,i):await mr.runLint(t,s);if(n.length===0)return"No lint errors found. The garden is pure. \u2728";let a=`# \u{1F3E5} Linting Triage Report (${n.length} issues found)
756
-
757
- `;return n.forEach((o,l)=>{let c=mr.suggestFix(o);a+=`### Issue ${l+1}: ${o.file}:${o.line}
758
- `,a+=`- **Rule**: ${o.ruleId||"unknown"}
759
- `,a+=`- **Message**: ${o.message}
760
- `,c&&(a+=`- **Suggested Fix**: ${c}
761
- `),a+=`
762
- `}),a+="**Precision Strike**: Use 'read_file' to audit the specific lines and 'replace_file_content' to apply surgical mends.",a}}),r.register({name:"self_heal",description:"Autonomous systemic recovery. Marie will audit the project for stability alerts and attempt autonomous fixes.",isDestructive:!0,input_schema:{type:"object",properties:{}},execute:async()=>{let e=xt(),t=await mr.runLint(e);if(t.length===0)return"Marie's systemic audit found no regressions. Stability is absolute. \u2728";let i=`# \u{1F9EC} Autonomous Recovery Protocol
763
-
764
- Detected **${t.length}** stability alerts in the codebase.
765
-
766
- `,s=Array.from(new Set(t.map(n=>n.file)));return i+=`**Impacted Files**:
767
- ${s.map(n=>`- ${n}`).join(`
768
- `)}
769
-
770
- `,i+="**Trajectory**: Use 'resolve_lint_errors' to view the full triage report and begin surgical remediation.",i}}),r.register({name:"get_file_diagnostics",description:"Get real-time diagnostics (errors, warnings, lints) for a file from VS Code.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file"}},required:["path"]},execute:async e=>{let t=R(e,"path"),i=ts.Uri.file(t),s=ts.languages.getDiagnostics(i);if(s.length===0)return"No diagnostics found. The file appears clean. \u2728";let n=`# Diagnostics for ${mw.basename(t)}
771
-
772
- `;return s.forEach(a=>{let o=ts.DiagnosticSeverity[a.severity];n+=`- [${o}] L${a.range.start.line+1}: ${a.message} (${a.code||"no-code"})
773
- `}),n}}),r.register({name:"run_test_suite",description:"Execute a test command and receive a structured 'Triage Report' identifying specific failures.",isDestructive:!0,input_schema:{type:"object",properties:{command:{type:"string",description:"The test command (e.g., 'npm test')"}},required:["command"]},execute:async e=>{let t=R(e,"command");return await gl.runAndTriage(t)}}),r.register({name:"verify_workspace_health",description:"Perform a non-destructive health check (build/lint) to ensure recent changes haven't introduced regressions.",input_schema:{type:"object",properties:{}},execute:async()=>await yl.runCommand("npm run build -- --noEmit || npx tsc --noEmit")}),r.register({name:"diagnose_action_failure",description:"Analyze why a high-order action (Rename, Move) failed and suggest a resilient fallback methodology.",input_schema:{type:"object",properties:{actionAttempted:{type:"string"},errorMessage:{type:"string"},path:{type:"string"}},required:["actionAttempted","errorMessage","path"]},execute:async e=>{let t=R(e,"path"),s=ts.languages.getDiagnostics(ts.Uri.file(t)).filter(a=>a.severity===ts.DiagnosticSeverity.Error);try{await(await Q.getInstance()).agent.cortex.reflections.reflect("system","failure",`Action Diagnosis: ${e.actionAttempted}`,[`Error: ${e.errorMessage}`,`File: ${mw.basename(t)}`,`LSP Errors: ${s.length}`])}catch(a){console.warn("Failed to reflect on action failure",a)}let n=`# \u{1FA79} Sovereign Recovery Diagnostic
774
-
775
- `;return n+=`Failed Action: \`${e.actionAttempted}\`
776
- `,n+=`Reason: ${e.errorMessage}
777
-
778
- `,s.length>0?(n+=`## \u26A0\uFE0F Underlying File Errors
779
- `,n+=`The LSP is likely blocked because the file has syntax/semantic errors:
780
- `,s.slice(0,3).forEach(a=>n+=`- [L${a.range.start.line+1}] ${a.message}
781
- `),n+="\n**Recommendation**: Fix these errors using `replace_in_file` before retrying semantic actions."):(n+=`## \u{1F5FA}\uFE0F Fallback Trajectory
782
- `,n+=`The high-order tool is healthy but the specific symbol could not be transformed.
783
- `,n+="**Trajectory**: Transition to **Shadow Realm Simulation** via `simulate_semantic_edit` to verify manual replacements."),n}})}var _e=k(require("vscode"),1);var hw=k(require("vscode"),1),Sf=class{static async getDefinitions(e,t){let i=await hw.commands.executeCommand("vscode.executeDefinitionProvider",e,t);if(!i||i.length===0)return"No definitions found.";let s=`Found ${i.length} definition(s):
784
- `;for(let n of i){let a="range"in n?n.range:n.targetRange,o="uri"in n?n.uri:n.targetUri;s+=`- ${o.fsPath} [L${a.start.line+1}:C${a.start.character+1}]
785
- `}return s}static async getTypeDefinitions(e,t){let i=await hw.commands.executeCommand("vscode.executeTypeDefinitionProvider",e,t);if(!i||i.length===0)return"No type definitions found.";let s=`Found ${i.length} type definition(s):
786
- `;for(let n of i){let a="range"in n?n.range:n.targetRange,o="uri"in n?n.uri:n.targetUri;s+=`- ${o.fsPath} [L${a.start.line+1}:C${a.start.character+1}]
787
- `}return s}};Xt();var xf=class{static async getFileNetwork(e){try{let t=await ta(e),i=/import\s+(?:.*?\s+from\s+)?['"](.*?)['"]/g,s=/export\s+(?:const|class|function|type|interface|enum|default)\s+(\w+)/g,n=[],a=[],o;for(;(o=i.exec(t))!==null;)n.push(o[1]);for(;(o=s.exec(t))!==null;)a.push(o[1]);let l=`# File Network: ${e.split("/").pop()}
788
-
789
- `;return l+=`## \u{1F4E5} Imports (Dependencies)
790
- `,n.length>0?n.forEach(c=>l+=`- \`${c}\`
791
- `):l+=`*None detected (Self-contained logic)*
792
- `,l+=`
793
- ## \u{1F4E4} Exports (Offerings)
794
- `,a.length>0?a.forEach(c=>l+=`- \`${c}\`
795
- `):l+=`*None detected (Internal consumer)*
796
- `,l}catch(t){throw new Error(`Failed to map network for ${e}: ${t}`)}}static async checkCircularity(e,t){return!1}};async function fw(r,e,t){let i,s=new Promise((n,a)=>{i=setTimeout(()=>{a(new Error(`TimeoutError: ${t} timed out after ${e}ms`))},e)});try{let n=await Promise.race([r,s]);return clearTimeout(i),n}catch(n){throw clearTimeout(i),n}}Xt();en();var tn=k(require("path"),1),bl=k(require("fs/promises"),1);function IT(r){r.register({name:"get_symbol_definition",description:"Find the definition of a symbol at the specified position. Helps navigate complex codebases.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file"},line:{type:"number",description:"The line number (1-indexed)"},character:{type:"number",description:"The character position (1-indexed)"}},required:["path","line","character"]},execute:async e=>{let t=R(e,"path"),i=e.line-1,s=e.character-1,n=_e.Uri.file(t),a=new _e.Position(i,s);return await Sf.getDefinitions(n,a)}}),r.register({name:"get_file_dependencies",description:"Map the structural network of a file (imports/exports) to understand its dependencies and role.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file"}},required:["path"]},execute:async e=>{let t=R(e,"path");return await xf.getFileNetwork(t)}}),r.register({name:"find_symbol_references",description:"Find all references/usages of a symbol across the workspace.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file containing the symbol"},line:{type:"number",description:"The line number (1-indexed)"},character:{type:"number",description:"The character position (1-indexed)"}},required:["path","line","character"]},execute:async e=>{let t=R(e,"path"),i=e.line-1,s=e.character-1,n=_e.Uri.file(t),a=new _e.Position(i,s),o=await _e.commands.executeCommand("vscode.executeReferenceProvider",n,a);if(!o||o.length===0)return"No references found.";let l=`Found ${o.length} reference(s):
797
- `;return o.slice(0,50).forEach(c=>{l+=`- ${c.uri.fsPath} [L${c.range.start.line+1}:C${c.range.start.character+1}]
798
- `}),o.length>50&&(l+=`
799
- ... AND ${o.length-50} MORE.`),l}}),r.register({name:"list_workspace_symbols",description:"Search for symbols (classes, functions, etc.) across the entire workspace.",input_schema:{type:"object",properties:{query:{type:"string",description:"The symbol name or partial name to search for"}},required:["query"]},execute:async e=>{let t=R(e,"query"),i=await _e.commands.executeCommand("vscode.executeWorkspaceSymbolProvider",t);if(!i||i.length===0)return"No symbols found matching the query.";let s=`Found ${i.length} symbol(s) matching \`${t}\`:
800
- `;return i.slice(0,50).forEach(n=>{let a=_e.SymbolKind[n.kind];s+=`- [${a}] \`${n.name}\` in \`${n.location.uri.fsPath}\`
801
- `}),i.length>50&&(s+=`
802
- ... AND ${i.length-50} MORE.`),s}}),r.register({name:"execute_semantic_rename",description:"Perform a workspace-wide, compiler-safe rename of a symbol using the LSP.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file containing the symbol"},line:{type:"integer",description:"The line number of the symbol (1-indexed)"},column:{type:"integer",description:"The column number of the symbol (1-indexed)"},newName:{type:"string",description:"The new name for the symbol"}},required:["path","line","column","newName"]},execute:async e=>{let t=R(e,"path"),i=e.line,s=e.column,n=R(e,"newName"),a=_e.Uri.file(t),o=new _e.Position(i-1,s-1);try{let l=await _e.commands.executeCommand("vscode.executeRenameProvider",a,o,n);return l?await _e.workspace.applyEdit(l)?`Successfully renamed symbol to \`${n}\` across the entire workspace. \u2728`:"Failed to apply workspace-wide semantic rename.":`LSP could not find a renameable symbol at ${t}:${i}:${s}.`}catch(l){return`Semantic rename failed: ${l}`}}}),r.register({name:"execute_semantic_move",description:"Move a symbol (function/class) to a new file and attempt to update imports throughout the workspace.",isDestructive:!0,input_schema:{type:"object",properties:{sourcePath:{type:"string",description:"Absolute path to source file"},targetPath:{type:"string",description:"Absolute path to target file"},symbolName:{type:"string",description:"Name of the symbol to move"}},required:["sourcePath","targetPath","symbolName"]},execute:async(e,t,i)=>{let s=R(e,"sourcePath"),n=R(e,"targetPath"),a=R(e,"symbolName");try{let l=(await fw(_e.commands.executeCommand("vscode.executeDocumentSymbolProvider",_e.Uri.file(s)),5e3,"LSP Document Symbol Provider"))?.find(_=>_.name===a);if(!l)return`Could not find symbol \`${a}\` in source file.`;let d=(await bl.readFile(s,"utf-8")).split(`
803
- `),p=d.slice(l.location.range.start.line,l.location.range.end.line+1).join(`
804
- `),h=d.filter(_=>_.trim().startsWith("import ")).filter(_=>{let E=_.match(/\{([^}]+)\}/);return E?E[1].split(",").map(X=>X.trim()).some(X=>p.includes(X)):!1}),f=[...d.slice(0,l.location.range.start.line),...d.slice(l.location.range.end.line+1)].join(`
805
- `);await Mr(s,f,i);let w="";try{w=await bl.readFile(n,"utf-8")}catch{w=`// Created for moved symbol ${a}
806
- `}let b=h.join(`
807
- `)+`
808
-
809
- `+w+`
810
-
811
- `+p;await Mr(n,b,i);let S=(await fw(_e.commands.executeCommand("vscode.executeReferenceProvider",_e.Uri.file(s),l.location.range.start),5e3,"LSP Reference Provider")).filter(_=>_.uri.fsPath!==s&&_.uri.fsPath!==n),y=[];if(S.length>0){let _=Array.from(new Set(S.map(E=>E.uri.fsPath)));for(let E of _){let D=await bl.readFile(E,"utf-8"),X=tn.relative(tn.dirname(E),s).replace(/\.[^.]+$/,"").replace(/\\/g,"/"),$=tn.relative(tn.dirname(E),n).replace(/\.[^.]+$/,"").replace(/\\/g,"/"),M=X.startsWith(".")?X:`./${X}`,F=$.startsWith(".")?$:`./${$}`;if(D.includes(M)){let U=D.replace(new RegExp(`from\\s+['"]${M}['"]`,"g"),`from '${F}'`);U!==D&&(await bl.writeFile(E,U),y.push(tn.basename(E)))}}}return await sa(s),await sa(n),`Successfully moved \`${a}\` to \`${n.split("/").pop()}\`. \u{1F5E1}\uFE0F
812
-
813
- **Methodology Complete**: Required imports were identified and copied to the destination.
814
- `+(y.length>0?`**Downstream Migration**: Automatically updated imports in ${y.length} file(s): ${y.join(", ")}. \u2728`:"**Mirror Polishing**: No external downstream imports required migration.")+`
815
-
816
- **Autonomy Note**: Post-execution tidying completed for both source and destination. \u{1F338}`}catch(o){return`Semantic move failed: ${o.message}`}}}),r.register({name:"trace_data_flow",description:"Analyze how a specific type or interface is used across multiple layers.",input_schema:{type:"object",properties:{typeName:{type:"string",description:"The name of the type/interface to trace"},filePath:{type:"string",description:"Path to the file where the type is defined"}},required:["typeName","filePath"]},execute:async e=>{let t=R(e,"typeName"),i=R(e,"filePath"),s=_e.Uri.file(i),o=(await _e.commands.executeCommand("vscode.executeDocumentSymbolProvider",s))?.find(h=>h.name===t)?.location.range.start||new _e.Position(0,0),l=await _e.commands.executeCommand("vscode.executeReferenceProvider",s,o);if(!l||l.length===0)return`Type \`${t}\` appears to be isolated. \u2728`;let c=Array.from(new Set(l.map(h=>h.uri.fsPath))),d=`# \u{1F52E} Data Flow Trace: \`${t}\`
817
-
818
- `;d+=`Found usages in **${c.length}** files.
819
-
820
- `;let m=c.map(h=>h.includes("/infrastructure/")?"Infrastructure \u{1F3DB}\uFE0F":h.includes("/domain/")?"Domain \u{1F9E0}":h.includes("/plumbing/")?"Plumbing \u{1F527}":"UI/External \u{1F3A8}").reduce((h,f)=>(h[f]=(h[f]||0)+1,h),{});return d+=`## Layer Distribution
821
- `,Object.entries(m).forEach(([h,f])=>{d+=`- **${h}**: ${f} files
822
- `}),m["Domain \u{1F9E0}"]&&m["Infrastructure \u{1F3DB}\uFE0F"]&&(d+=`
823
- > [!NOTE]
824
- > This type crosses the Domain/Infrastructure boundary. Ensure strict mapping is in place to maintain Joyful purity. \u2728`),d}}),r.register({name:"find_files",description:"Search for files across the workspace using a glob pattern (e.g., '**/*.test.ts').",input_schema:{type:"object",properties:{pattern:{type:"string",description:"The glob pattern to search for"},exclude:{type:"string",description:"Optional glob pattern for files to exclude"}},required:["pattern"]},execute:async e=>{let t=R(e,"pattern"),i=e.exclude,s=await _e.workspace.findFiles(t,i);if(s.length===0)return"No files found matching the pattern.";let n=`Found ${s.length} file(s) matching \`${t}\`:
825
- `;return s.slice(0,50).forEach(a=>n+=`- \`${a.fsPath}\`
826
- `),s.length>50&&(n+=`
827
- ... AND ${s.length-50} MORE.`),n}})}var Ue=k(require("vscode"),1);kf();ia();var OT=k(require("fs/promises"),1),Pf=k(require("path"),1),If=class{static async getFolderTree(e,t=3){try{let s=`# Folder Structure: ${Pf.basename(e)}
828
-
829
- `;return s+=await this.generateTree(e,"",0,t),s}catch(i){throw new Error(`Failed to generate folder tree for ${e}: ${i}`)}}static async generateTree(e,t,i,s){if(i>s)return"";let n="",l=(await OT.readdir(e,{withFileTypes:!0})).sort((c,d)=>c.isDirectory()&&!d.isDirectory()?-1:!c.isDirectory()&&d.isDirectory()?1:c.name.localeCompare(d.name)).filter(c=>!c.name.startsWith(".")&&c.name!=="node_modules"&&c.name!=="dist"&&c.name!=="out");for(let c=0;c<l.length;c++){let d=l[c],p=c===l.length-1,m=p?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",h=t+(p?" ":"\u2502 ");n+=`${t}${m}${d.name}${d.isDirectory()?"/":""}
830
- `,d.isDirectory()&&(n+=await this.generateTree(Pf.join(e,d.name),h,i+1,s))}return n}};var DT=k(require("fs/promises"),1),vl=k(require("path"),1);ia();var Of=class{static async generate(e){let t=vl.join(e,"src"),i=await this.findTsFiles(t),s=[],n=0,a=i.slice(0,50);for(let c of a)try{let d=await rs(c);s.push({path:vl.relative(e,c),joyScore:d.joyScore,clutterLevel:d.joyScore<60?"Toxic":d.joyScore<80?"Tangled":"Clean"}),n+=d.joyScore}catch(d){console.error(`Failed to scan ${c}`,d)}let o=a.length>0?Math.floor(n/a.length):100,l=s.sort((c,d)=>c.joyScore-d.joyScore).filter(c=>c.joyScore<70).slice(0,5);return{overallJoyScore:o,totalFilesScanned:a.length,hotspots:l,summary:`The project has an average Joy Score of ${o}. `+(l.length>0?`We found ${l.length} hotspots that need immediate attention.`:"The Garden is looking pristine! \u2728")}}static async findTsFiles(e){let t=await DT.readdir(e,{withFileTypes:!0});return(await Promise.all(t.map(async s=>{let n=vl.resolve(e,s.name);return s.isDirectory()?s.name==="node_modules"||s.name.startsWith(".")?[]:this.findTsFiles(n):n.endsWith(".ts")||n.endsWith(".tsx")?[n]:[]}))).flat()}};Ks();var fr=k(require("path"),1),sn=k(require("fs/promises"),1);function $T(r,e){r.register({name:"get_code_complexity",description:"Analyze a file for cyclomatic complexity and clutter level to identify refactoring needs.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file"}},required:["path"]},execute:async t=>{let i=R(t,"path"),s=await rn.analyze(i),n=`# Complexity Scan: ${fr.basename(i)}
831
-
832
- `;return n+=`- **Clutter Level**: ${s.clutterLevel}
833
- `,n+=`- **Cyclomatic Complexity**: ${s.cyclomaticComplexity}
834
- `,n+=`- **Lines of Code**: ${s.loc}
835
-
836
- `,s.suggestions.length>0&&(n+=`## \u{1F6E0}\uFE0F Refinement Suggestions
837
- `,s.suggestions.forEach(a=>n+=`- ${a}
838
- `)),n}}),r.register({name:"audit_architectural_integrity",description:"Verify that code doesn't violate architectural boundaries (e.g., UI/Domain depending on Plumbing) across a file or directory.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file or directory to audit"},recursive:{type:"boolean",description:"Whether to scan subdirectories (default: true)"}},required:["path"]},execute:async t=>{let i=R(t,"path"),s=t.recursive!==!1,n=await sn.stat(i),a=[];if(n.isFile())a.push(i);else{let c=await sn.readdir(i,{withFileTypes:!0,recursive:s});a.push(...c.filter(d=>d.isFile()&&/\.(ts|tsx|js|jsx)$/.test(d.name)).map(d=>fr.join(d.path||i,d.name)))}let o=[];for(let c of a){let d=await rs(c);d.zoningHealth.isBackflowPresent&&o.push(`**${fr.relative(xt(),c)}**: ${d.zoningHealth.illegalImports.join(", ")}`)}if(o.length===0)return`No architectural violations detected in ${a.length} file(s). The structure is pure. \u2728`;let l=`# \u{1F46E}\u200D\u2640\uFE0F Architectural Integrity Report
839
-
840
- `;return l+=`Audited **${a.length}** file(s). Found **${o.length}** violation(s).
841
-
842
- `,l+=`## \u26A0\uFE0F Zone Leakage (Backflow)
843
- `,o.forEach(c=>l+=`- ${c}
844
- `),l+="\n**Methodology Note**: Respect the Downward Flow Law (Domain -> Infrastructure -> Plumbing). Use `trace_data_flow` to resolve these leaks.",l}}),r.register({name:"extract_component_api",description:"Generate a structured markdown API summary for a component or class (functions, props, types).",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file"}},required:["path"]},execute:async t=>{let i=R(t,"path"),s=await Ue.commands.executeCommand("vscode.executeDocumentSymbolProvider",Ue.Uri.file(i));if(!s||s.length===0)return"No symbols found to generate API summary.";let n=`# \u270D\uFE0F API Summary: ${fr.basename(i)}
845
-
846
- `;return s.forEach(a=>{let o=Ue.SymbolKind[a.kind];n+=`### [${o}] ${a.name}
847
- `,a.children.length>0&&a.children.forEach(l=>{let c=Ue.SymbolKind[l.kind];n+=`- **${l.name}** (${c})
848
- `}),n+=`
849
- `}),n}}),r.register({name:"get_folder_structure",description:"Get a recursive, tree-like overview of a folder's structure.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the folder"},depth:{type:"number",description:"Maximum recursion depth (default: 3)"}},required:["path"]},execute:async t=>{let i=R(t,"path"),s=t.depth;return await If.getFolderTree(i,s)}}),r.register({name:"get_workspace_joy_map",description:"Generate a project-wide health report. Use this to identify 'Clutter Hotspots' and prioritize refactoring efforts.",input_schema:{type:"object",properties:{}},execute:async()=>{let t=xt();if(!t)return"No workspace folder found.";let i=await Of.generate(t),s=e.getCurrentRun(),n=`# \u{1F31F} Workspace Joy Map
850
-
851
- `;if(n+=`**Overall Joy Score**: ${i.overallJoyScore}/100
852
- `,s){let a=s.heuristicFixes&&s.heuristicFixes.length>3?"Fragile \u26A0\uFE0F":"Resilient \u2728";n+=`**Agent Resilience**: ${a}
853
- `}return n+=`**Files Scanned**: ${i.totalFilesScanned}
854
-
855
- `,n+=`> ${i.summary}
856
-
857
- `,i.hotspots.length>0&&(n+=`## \u26A0\uFE0F Clutter Hotspots
858
- `,i.hotspots.forEach(a=>{n+=`- \`${a.path}\`: ${a.joyScore} (${a.clutterLevel})
859
- `})),n}}),r.register({name:"check_ripple_health",description:"Verify the health of all workspace files that depend on a specific path. Use this to catch regressions in downstream consumers.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the modified file"}},required:["path"]},execute:async t=>{let i=R(t,"path");try{let s=await Ue.commands.executeCommand("vscode.executeDocumentSymbolProvider",Ue.Uri.file(i));if(!s||s.length===0)return"No symbols found to check ripples for.";let n=new Set;for(let l of s)(await Ue.commands.executeCommand("vscode.executeReferenceProvider",Ue.Uri.file(i),l.location.range.start))?.forEach(d=>{d.uri.fsPath!==i&&n.add(d.uri.fsPath)});if(n.size===0)return"No external downstream dependents found for any symbol in this file. \u2728";let a=`# \u{1F30A} Comprehensive Ripple Health: ${fr.basename(i)}
860
-
861
- `;a+=`Checking **${n.size}** dependent(s) across all symbols...
862
-
863
- `;let o=Array.from(n);for(let l of o){let d=Ue.languages.getDiagnostics(Ue.Uri.file(l)).filter(p=>p.severity===Ue.DiagnosticSeverity.Error);a+=`- \`${fr.relative(xt(),l)}\`: ${d.length>0?`\u274C ${d.length} Error(s)`:"\u2705 Clean"}
864
- `}return a}catch(s){return`Ripple check failed: ${s}`}}}),r.register({name:"generate_evolution_chronicle",description:"Synthesize the 'Story' of a directory or file's evolution using git history and recent diffs.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the directory or file"}},required:["path"]},execute:async t=>{let i=R(t,"path"),n=await(await Promise.resolve().then(()=>(gf(),lT))).getFileHistory(xt(),i),a=`# \u{1F4DC} Evolution Chronicle: ${fr.basename(i)}
865
-
866
- `;return a+=`## Recent Trajectory
867
- `,a+=n+`
868
-
869
- `,a+=`## Intent Synthesis
870
- `,a+="Based on the echos above, this area is transitioning through the Living Project lifecycle. Ensure the next 'Pass' aligns with this momentum. \u2728",a}}),r.register({name:"predict_refactor_ripple",description:"Simulate a structural change (e.g., changing a signature) and predict which downstream files will break.",input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file"},symbol:{type:"string",description:"The symbol being modified"},changeDescription:{type:"string",description:"Description of the change (e.g., 'Removing optional param X')"}},required:["path","symbol","changeDescription"]},execute:async t=>{let i=R(t,"path"),s=R(t,"symbol"),n=Ue.Uri.file(i),l=(await Ue.commands.executeCommand("vscode.executeDocumentSymbolProvider",n))?.find(m=>m.name===s)?.location.range.start||new Ue.Position(0,0),c=await Ue.commands.executeCommand("vscode.executeReferenceProvider",n,l);if(!c||c.length===0)return`No ripple effect detected for \`${s}\`. The change is isolated. \u2728`;let d=Array.from(new Set(c.map(m=>m.uri.fsPath))).filter(m=>m!==i),p=`# \u{1F52E} Refactor Ripple Prediction: \`${s}\`
871
-
872
- `;if(p+=`Proposed Change: ${R(t,"changeDescription")}
873
-
874
- `,d.length>0){p+=`## \u26A0\uFE0F Potentially Broken Dependents (${d.length})
875
- `;for(let m of d){let h=fr.relative(xt(),m),f=c.filter(w=>w.uri.fsPath===m);p+=`- \`${h}\`: Found ${f.length} reference(s)
876
- `;try{let v=(await sn.readFile(m,"utf-8")).split(`
877
- `)[f[0].range.start.line].trim();p+=` > \`${v}\` (L${f[0].range.start.line+1})
878
- `}catch{}}p+="\nRecommendation: Use `check_ripple_health` after applying the change to verify these files."}else p+="No external dependents found. The change is safe to apply within this file.";return p}}),r.register({name:"map_project_context",description:"A mapping ritual. Returns a high-level overview of JOY zones and key inhabitants to aid strategic planning.",input_schema:{type:"object",properties:{}},execute:async()=>{let t=xt();if(!t)return"No workspace detected.";let{isProjectJoyful:i,proposeClustering:s}=await Promise.resolve().then(()=>(en(),Mf)),n=await i(t),a=await s(t),o=[];try{let d=(await sn.readdir(t,{withFileTypes:!0,recursive:!0})).filter(h=>h.isFile()&&!h.name.startsWith(".")&&!h.path.includes("node_modules")).map(h=>fr.join(h.path,h.name)),m=(await Promise.all(d.map(async h=>({path:h,mtime:(await sn.stat(h)).mtime.getTime()})))).sort((h,f)=>f.mtime-h.mtime).slice(0,5);o.push(...m.map(h=>fr.relative(t,h.path)))}catch(c){console.error("Hotspot detection failed:",c),o.push("src/domain/marie/MarieTypes.ts","src/infrastructure/ai/MarieEngine.ts")}let l=`# Project Map (JOY Structure)
879
-
880
- `;l+=`**Status**: ${n?"Joyful Ecosystem \u2728":"Architectural Void \u26A0\uFE0F (Genesis Needed)"}
881
-
882
- `,l+=`**Zones**:
883
- `,l+="- **Domain** (`src/domain`): Core logic and purity.\n",l+="- **Infrastructure** (`src/infrastructure`): Adapters and stability.\n",l+="- **Plumbing** (`src/plumbing`): Mechanical machinery.\n\n",l+=`**Hotspots** (Most Recently Modified):
884
- `;for(let c of o)l+=`- \`${c}\`
885
- `;if(l+=`
886
- `,a.length>0){l+=`**Clustering Opportunities**:
887
- `;for(let c of a)l+=`- ${c.zone}: ${c.fileCount} files. Consider sub-zones like ${c.suggestedClusters.join(", ")}.
888
- `}return l}})}var Sw=k(require("path"),1),Df=k(require("fs/promises"),1);Ks();function FT(r){r.register({name:"perform_strategic_planning",description:"A mandatory planning ritual. Call this at the start of any complex task.",input_schema:{type:"object",properties:{intent:{type:"string"},joyZone:{type:"string",enum:["joyful","infrastructure","plumbing"]},projectName:{type:"string"},lifecycleStage:{type:"string",enum:["sprout","bloom","compost"]},objectives:{type:"array",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},status:{type:"string",enum:["pending","in_progress","completed","blocked"]}},required:["id","label","status"]}},ritualChecked:{type:"boolean"},gratitudeMoment:{type:"string"},dependencyRisk:{type:"string"},totalPasses:{type:"number",description:"Total number of passes (1-4)"},passFocus:{type:"string",description:"Initial focus of Pass 1"}},required:["intent","joyZone","projectName","lifecycleStage","ritualChecked","gratitudeMoment","totalPasses","passFocus"]},execute:async(e,t)=>{let i=R(e,"intent"),s=R(e,"joyZone"),n=R(e,"projectName"),a=R(e,"lifecycleStage"),o=Zn(e,"objectives"),l=R(e,"gratitudeMoment");return t?.({context:`Mindfulness: ${i} [Zone: ${s}]`,completedObjectiveIds:[],activeObjectiveId:o[0]?.id,achieved:[`Aligned with ${s} zone protocols`,`Planning for ${n} (${a})`,`Ritual: ${l}`],lifecycleStage:a,ritualComplete:!0,currentPass:1,totalPasses:e.totalPasses||1,passFocus:R(e,"passFocus")}),`Strategic Plan for '${n}' accepted. The KonMari Waterfall (Domain -> Infrastructure -> Plumbing) has been aligned. \u2728`}}),r.register({name:"checkpoint_pass",description:"Explicitly end a pass, summarize achievements, and orient for the next pass.",input_schema:{type:"object",properties:{summary:{type:"string",description:"What was achieved in this pass"},reflection:{type:"string",description:"What sparked joy or was learned in this pass? (KonMari Reflection)"},nextPassFocus:{type:"string",description:"The focus for the upcoming pass"},zoneSolidification:{type:"boolean",description:"Confirm that all new code follows JOY zoning protocols."},tidyChecked:{type:"boolean",description:"Confirm that Joyful Tidying (fold_file) has been performed."},isFinalPass:{type:"boolean"}},required:["summary","reflection","nextPassFocus","zoneSolidification","tidyChecked","isFinalPass"]},execute:async(e,t)=>{let i=R(e,"summary"),s=R(e,"reflection"),n=R(e,"nextPassFocus"),a=e.zoneSolidification,o=e.isFinalPass;return a?e.tidyChecked?(t?.({context:`Checkpoint: ${i} (Reflection: ${s})`,achieved:[`Completed Pass: ${i}`],passHistory:[{pass:e.currentPass||1,summary:i,reflection:s}],currentPass:o?null:void 0,passFocus:o?void 0:n}),`Pass internal checkpoint reached. Focus shifting to: ${n}. Reflection: ${s}`):"Error: Joyful Tidying check failed. Please perform 'fold_file' on modified files to ensure code health.":"Error: Zone Solidification check failed. Please ensure all new code is correctly zoned before ending the pass."}}),r.register({name:"update_run_objectives",description:"Update the current run's objectives and progress context.",input_schema:{type:"object",properties:{context:{type:"string"},completedObjectiveIds:{type:"array",items:{type:"string"}},activeObjectiveId:{type:"string"},achieved:{type:"array",items:{type:"string"}},totalPasses:{type:"number"}},required:["context"]},execute:async(e,t)=>{let i=R(e,"context"),s=Zn(e,"completedObjectiveIds"),n=R(e,"activeObjectiveId"),a=Zn(e,"achieved"),o=e.totalPasses;return t?.({context:i,completedObjectiveIds:s,activeObjectiveId:n,achieved:a,totalPasses:o}),`Progress updated: ${i}${o?` (Total Passes: ${o})`:""}`}}),r.register({name:"augment_roadmap",description:"Insert a new pass into the current roadmap. Use this when significant unexpected complexity is discovered.",input_schema:{type:"object",properties:{addedPassCount:{type:"number",description:"How many passes to add (usually 1)"},newPassFocus:{type:"string",description:"The focus for the upcoming augmented pass"},reason:{type:"string",description:"Why is the roadmap being augmented? (Mindfulness discovery)"}},required:["addedPassCount","newPassFocus","reason"]},execute:async(e,t)=>{let i=e.addedPassCount,s=R(e,"newPassFocus"),n=R(e,"reason");return t?.({context:`Roadmap Augmented: ${n}`,achieved:[`Calibrated roadmap: +${i} pass(es)`],totalPasses:i,passFocus:s}),`Roadmap augmented with ${i} additional pass(es). Reason: ${n}`}}),r.register({name:"generate_migration_plan",description:"Generate a step-by-step 'Blueprint' for migrating code from an old pattern to a new one.",input_schema:{type:"object",properties:{fromPattern:{type:"string",description:"The pattern being replaced"},toPattern:{type:"string",description:"The new target pattern"},files:{type:"array",items:{type:"string"},description:"List of files to migrate"}},required:["fromPattern","toPattern","files"]},execute:async e=>{let t=e.files,i=`# \u{1F4D0} Migration Blueprint
889
-
890
- `;return i+=`**Trajectory**: From \`${e.fromPattern}\` to \`${e.toPattern}\`
891
-
892
- `,i+=`## \u{1F5FA}\uFE0F Execution Steps
893
- `,i+=`1. **Analysis**: Map all instances of old pattern in ${t.length} files.
894
- `,i+="2. **Transformation**: Apply structural replacements using `replace_in_file`.\n",i+="3. **Verification**: Run `check_ripple_health` and `run_test_suite`.\n\n",i+=`## \u{1F5C2}\uFE0F Target Garden
895
- `,t.slice(0,10).forEach(s=>i+=`- \`${s.split("/").pop()}\`
896
- `),t.length>10&&(i+=`- ... and ${t.length-10} more.
897
- `),i}}),r.register({name:"generate_architectural_decision",description:"Generate a structured ADR (Architectural Decision Record) to document a major shift in the project.",isDestructive:!0,input_schema:{type:"object",properties:{title:{type:"string",description:"Concise title of the decision"},context:{type:"string",description:"The problem or context driving this change"},decision:{type:"string",description:"The chosen solution and rationale"},consequences:{type:"string",description:"Impact on the system moving forward"}},required:["title","context","decision","consequences"]},execute:async e=>{let t=xt();if(!t)return"No workspace detected.";let i=`ADR-${Math.round(Date.now()/1e3)}`,s=Sw.join(t,".marie","decisions"),n=Sw.join(s,`${i}.md`),a=R(e,"title"),o=a.includes("Refactor")?`
898
- ## Historical Context
899
- > This decision aligns with the trajectory identified in the Evolution Chronicle. \u2728
900
- `:"",l=`# \u{1F6E1}\uFE0F ${i}: ${a}
901
-
902
- **Date**: ${new Date().toLocaleDateString()}
903
- **Status**: Accepted
904
-
905
- `+o+`## Context
906
- ${R(e,"context")}
907
-
908
- ## Decision
909
- ${R(e,"decision")}
910
-
911
- ## Consequences
912
- ${R(e,"consequences")}
913
-
914
- ---
915
- Generated by Marie Autonomous Agent \u2728`;try{return await Df.mkdir(s,{recursive:!0}),await Df.writeFile(n,l),`Architectural Decision Record saved to \`.marie/decisions/${i}.md\`. History preserved. \u{1F6E1}\uFE0F`}catch(c){return`Failed to save ADR: ${c}`}}})}var Fd=k(require("vscode"),1);en();Xt();Dd();gf();ur();var Ld=k(require("path"),1);function LT(r,e){r.register({name:"discard_file",description:"Permanently delete a file. This is a ritual of letting go.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file to discard"}},required:["path"]},execute:async t=>{let i=R(t,"path"),s=Fd.Uri.file(i),n=await Fd.commands.executeCommand("vscode.executeDocumentSymbolProvider",s);if(n&&n.length>0){let a=[];for(let o of n){let c=(await Fd.commands.executeCommand("vscode.executeReferenceProvider",s,o.location.range.start))?.filter(d=>d.uri.fsPath!==i)||[];c.length>0&&a.push(`Symbol \`${o.name}\` is used in ${c.length} other file(s).`)}if(a.length>0){let o=`# \u{1F342} Sovereign Deletion Warning
916
-
917
- Discarding \`${Ld.basename(i)}\` despite active echos:
918
- `+a.map(l=>`- ${l}`).join(`
919
- `);await dw(o)}}return await hl(i),await Ef(`Discarded '${i}'`),`File '${i}' has been discarded. ${CT()}`}}),r.register({name:"sprout_new_module",description:"Create a new file with architectural boilerplate and register it in the project's living history.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string",description:"Absolute path to the new file"},description:{type:"string",description:"Brief description of the module's purpose"}},required:["path","description"]},execute:async t=>{let i=R(t,"path"),s=R(t,"description"),n=Ld.basename(i),a=`/**
920
- * ${n}: ${s}
921
- *
922
- * Part of the Living Project - Sprouted on ${new Date().toLocaleDateString()}
923
- */
924
-
925
- `;return i.includes("/infrastructure/")?a+=`import * as vscode from 'vscode';
926
-
927
- export class ${n.replace(/\.[^.]+$/,"")} {
928
- // Implementation
929
- }
930
- `:i.includes("/domain/")?a+=`export interface ${n.replace(/\.[^.]+$/,"")} {
931
- // Domain Logic
932
- }
933
- `:i.includes("/plumbing/")&&(a+=`/** Plumbing Utility */
934
- export function ${n.replace(/\.[^.]+$/,"").toLowerCase()}() {
935
- return;
936
- }
937
- `),await Mr(i,a),await Ef(`Sprouted new module: ${n}`),`# \u{1F331} New Sprout: ${n}
938
-
939
- Module created at \`${Ld.relative(process.cwd(),i)}\`.
940
- **Intent**: ${s}
941
-
942
- > **Methodology Note**: This module has been registered in the project's lineage. Please use \`get_file_diagnostics\` to verify initial health. \u2728`}}),r.register({name:"propose_logic_clustering",description:"Scan a directory and propose structural reorganizations (Clustering) based on semantic co-dependency.",input_schema:{type:"object",properties:{directoryPath:{type:"string",description:"Absolute path to the directory to analyze"}},required:["directoryPath"]},execute:async t=>{let i=R(t,"directoryPath"),{proposeClustering:s}=await Promise.resolve().then(()=>(en(),Mf)),n=await s(i);if(n.length===0)return"No significant clustering opportunities detected. The architecture appears naturally granular. \u2728";let a=`# \u{1F9D8}\u200D\u2642\uFE0F Convergence Ritual: Clustering Proposal
943
-
944
- `;return a+=`Based on semantic co-dependency and zoning laws, the following 'Logic Clusters' are proposed for \`${i.split("/").pop()}\`:
945
-
946
- `,n.forEach(o=>{a+=`### ${o.zone} Zone Fragment
947
- `,a+=`- **File Count**: ${o.fileCount}
948
- `,a+=`- **Suggested Clusters**: ${o.suggestedClusters.join(", ")}
949
- `,a+=`- **Rationale**: High internal cohesion suggests these should be grouped into a single module to reduce workspace noise.
950
-
951
- `}),a+="**Action**: Use `execute_semantic_move` to begin converging these fragments into the suggested clusters.",a}}),r.register({name:"execute_genesis_ritual",description:"Convert an entire project to the JOY structure.",input_schema:{type:"object",properties:{}},execute:async()=>await e.triggerGenesis()}),r.register({name:"sow_joy_feature",description:"Scaffold a new feature structure across all JOY zones.",input_schema:{type:"object",properties:{name:{type:"string"},intent:{type:"string"}},required:["name","intent"]},execute:async t=>await e.sowJoyFeature(R(t,"name"),R(t,"intent"))}),r.register({name:"perform_garden_pulse",description:"Deep audit of project structure and scaffolding.",input_schema:{type:"object",properties:{}},execute:async()=>await e.performGardenPulse()}),r.register({name:"execute_joy_maintenance",description:"Perform autonomous maintenance on the garden structure (Restoration Ritual).",isDestructive:!0,input_schema:{type:"object",properties:{}},execute:async()=>await e.executeAutonomousRestoration()}),r.register({name:"fold_file",description:"Format and organize imports in a file.",input_schema:{type:"object",properties:{path:{type:"string"}},required:["path"]},execute:async t=>await sa(R(t,"path"))}),r.register({name:"cherish_file",description:"Update the timestamp of a 'Sentimental' file.",input_schema:{type:"object",properties:{path:{type:"string"}},required:["path"]},execute:async t=>await gw(R(t,"path"))}),r.register({name:"replace_file_content",description:"Replace a specific string with another in a file. Surgical and mindful.",isDestructive:!0,input_schema:{type:"object",properties:{path:{type:"string"},targetFile:{type:"string"},targetContent:{type:"string"},replacementContent:{type:"string"},search:{type:"string"},replace:{type:"string"}},required:["path"]},execute:async t=>{let i=R(t,"path")||R(t,"targetFile"),s=R(t,"targetContent")||R(t,"search"),n=R(t,"replacementContent")||R(t,"replace");try{let{replaceInFile:a}=await Promise.resolve().then(()=>(Xt(),Ys)),o=await a(i,s,n);return await sa(i),`${o}
952
-
953
- **Autonomy Note**: Post-execution tidying completed. \u{1F338}`}catch(a){return await e.executeSelfHealing(i,a.message)}}}),r.register({name:"generate_joy_dashboard",description:"Generate a JOY.md dashboard for the workspace.",input_schema:{type:"object",properties:{rootPath:{type:"string"}},required:["rootPath"]},execute:async t=>await Promise.resolve().then(()=>(en(),Mf)).then(i=>i.generateJoyDashboard(R(t,"rootPath")))}),r.register({name:"complete_task_ritual",description:"A final ritual to conclude a large task. Summarizes the entire journey and expresses gratitude. WARNING: Do NOT call this tool until you have confirmed the user's request is 100% satisfied. If you have any doubts or pending verifications, use `notify_user` instead.",input_schema:{type:"object",properties:{finalSummary:{type:"string",description:"The 'Bloom Report': a synthesis of all work achieved."},gratitude:{type:"string",description:"A final expression of gratitude for the code and the process."},healthCheck:{type:"string",description:"A final assessment of the project's JOY state."}},required:["finalSummary","gratitude","healthCheck"]},execute:async(t,i)=>{let s=R(t,"finalSummary"),n=R(t,"gratitude"),a=R(t,"healthCheck");i?.({context:`Bloom Ritual: ${s}`,achieved:[`Task Completed: ${s}`,"Code Ascension complete \u2728"],currentPass:null,passFocus:void 0,ritualComplete:!0});try{let o=await Q.getInstance();await o.agent.cortex.knowledge.distill("Task Completion",s,1,void 0,["task_summary","bloom_report"],{health_check:a,gratitude:n});let c=(await o.execute("SELECT id FROM agent_sessions ORDER BY updated_at DESC LIMIT 1")).rows?.[0]?.id;if(c){let p=(await o.agent.cortex.episodes.getSessionEpisodes(c)).find(m=>m.status==="active");p&&await o.agent.cortex.episodes.completeEpisode(p.id,s,{health:a})}o.agent.cortex.selfIterate().catch(d=>console.warn("Self-iteration background trigger failed",d))}catch(o){console.warn("Failed to distill task knowledge or complete episode",o)}return`Task Bloom Ritual complete.
954
-
955
- Report: ${s}
956
-
957
- Garden Growth: Metrics archived in telemetry.
958
-
959
- Health: ${a}
960
-
961
- Gratitude: ${n} \u2728`}}),r.register({name:"run_command",description:"Execute a command in the terminal. Requires user approval. Use this for running tests or building the project.",isDestructive:!0,input_schema:{type:"object",properties:{command:{type:"string",description:"The shell command to execute"}},required:["command"]},execute:async(t,i,s)=>{let n=R(t,"command");return await yl.runCommand(n,s)}})}Tw();function WT(r){r.register({name:"pin_context",description:"Anchor a critical piece of context (snippet, symbol, or file reference) for long-term strategic memory.",input_schema:{type:"object",properties:{id:{type:"string",description:"A unique identifier for this anchor (e.g., 'auth_flow')"},label:{type:"string",description:"A short, descriptive label"},content:{type:"string",description:"The content to anchor"},type:{type:"string",enum:["snippet","symbol","file_ref"]}},required:["id","label","content","type"]},execute:async e=>(await xl.getInstance().anchor({id:R(e,"id"),label:R(e,"label"),content:R(e,"content"),type:R(e,"type")}),`Context anchored: ${R(e,"label")} (ID: ${R(e,"id")}). This information is now preserved for your strategic use. \u2728`)}),r.register({name:"get_pinned_context",description:"Retrieve all anchored strategic context to refresh your memory.",input_schema:{type:"object",properties:{}},execute:async()=>xl.getInstance().getAllAnchors()})}function zT(r,e){cT(r),Xx(r),wT(r),IT(r),$T(r,e),FT(r),WT(r),LT(r,e)}var na=k(require("vscode"),1);en();_w();var $f=class{constructor(e,t){this.context=e;this.joyService=t}currentRun;setCurrentRun(e){this.currentRun=e}getCurrentRun(){return this.currentRun}async triggerGenesis(){let e=na.workspace.workspaceFolders?.[0].uri.fsPath;if(!e)return"No workspace detected.";let t=await vw(e);return await this.joyService.addAchievement("Performed the Genesis Ritual. Project reborn in JOY. \u2728",100),t}async sowJoyFeature(e,t){let i=na.workspace.workspaceFolders?.[0].uri.fsPath;if(!i)return"No workspace detected.";let s=await bw(i,e,t);return await this.joyService.addAchievement(`Sowed the seeds of '${e}' across the garden. \u{1F331}`,25),s}heartbeatTimer;async performGardenPulse(){let e=na.workspace.workspaceFolders?.[0].uri.fsPath;if(!e)return"No workspace folder detected.";let t="";try{let i=await Tl.audit(e);t+=`\u{1F6E1}\uFE0F **Sentinel Scan Complete**: ${i.stability} (Entropy: ${i.entropyScore})
962
- `,i.zoneViolations.length>0?t+=`- \u274C Found ${i.zoneViolations.length} architectural violations.
963
- `:t+=`- \u2705 No cross-zone contamination detected. Domain remains pure.
964
- `;let s=await wl(e);await Nf(e);let n=await Af(e),a=await Cf(e),o=await $d(e);if(s||(t+=`
965
- - \u26A0\uFE0F **Architectural Void**: Project has not yet embraced the JOY structure.`),a.length>0){t+=`
966
- - ${a.length} structural drifts detected.`;let{ConfigService:l}=await Promise.resolve().then(()=>(Ot(),Qx)),c=l.getAutoRepair();if((a.length>5||i.entropyScore>10)&&c){await this.joyService.addAchievement("Sentinel Auto-Repair initiated. \u{1F6E0}\uFE0F",10);let d=await this.executeAutonomousRestoration();t+=`
967
- - \u{1F6E0}\uFE0F **Auto-Repair Executed**: ${d}`}}await this.scoutAchievements()}catch(i){t+=`
968
- - \u274C **Pulse Interrupted**: ${i.message}`}return`${t}
969
-
970
- The system remains under Sentinel protection. \u{1F6E1}\uFE0F`}startAutonomousHeartbeat(e=3e5){this.heartbeatTimer||(this.heartbeatTimer=setInterval(async()=>{await this.performGardenPulse()},e))}stopAutonomousHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async executeAutonomousRestoration(){let e=na.workspace.workspaceFolders?.[0].uri.fsPath;if(!e)return"No workspace folder detected.";let t=await ww(e);return await this.joyService.addAchievement("The Garden was autonomously restored to harmony. \u2728",50),t}async executeSelfHealing(e,t){return await this.joyService.addAchievement("Self-healing initiated. \u{1F9EC}",15),t.includes("content check failed")||t.includes("could not find")?`Self-healing: Analyzing \`${e}\` to resolve: ${t}.
971
- Please retry the operation with \`find_files\` or \`grep_search\` to refresh context. \u2728`:`Self-healing could not determine a recovery path for: ${t}`}async autoScaffold(){let e=na.workspace.workspaceFolders?.[0].uri.fsPath;e&&await Af(e)}async scoutAchievements(){let e=na.workspace.workspaceFolders?.[0].uri.fsPath;if(e)try{await this.joyService.addAchievement("Sentinel Resonance achieved. \u{1F30C}",5),await wl(e)&&await this.joyService.addAchievement("Structural Harmony attained. \u{1F3DB}\uFE0F",20)}catch(t){console.error("[Singularity] Scouting failed",t)}}dispose(){this.stopAutonomousHeartbeat()}};Ot();var Ff=class{tools=new Map;cachedRegisteredTools=null;register(e){process.env.MARIE_DEBUG&&console.log(`[ToolRegistry] Registering tool: ${e.name}`),this.tools.set(e.name,e),this.cachedRegisteredTools=null}getTool(e){let t=this.tools.get(e);return process.env.MARIE_DEBUG&&console.log(`[ToolRegistry] Getting tool: ${e}, found: ${!!t}`),t}getTools(){return this.cachedRegisteredTools||(this.cachedRegisteredTools=Array.from(this.tools.values()).map(e=>({name:e.name,description:e.description,input_schema:e.input_schema}))),this.cachedRegisteredTools}async execute(e,t,i,s){let n=this.tools.get(e);if(!n)throw new Error(`Tool ${e} not found`);return await n.execute(t,i,s)}};Ot();var t_=k(require("path"),1);Ot();var Lf=k(require("vscode"),1);Ot();Dd();fl();var Ut=class{static levenshtein(e,t){if(e.length>5e3||t.length>5e3){let l=this.getCommonPrefixLength(e,t),c=this.getCommonSuffixLength(e,t),d=Math.abs(e.length-t.length);return d+(Math.max(e.length,t.length)-l-c-d)}if(e.length>t.length){let l=e;e=t,t=l}let s=e.length,n=t.length;if(s===0)return n;let a=new Array(s+1),o=new Array(s+1);for(let l=0;l<=s;l++)a[l]=l;for(let l=1;l<=n;l++){o[0]=l;for(let d=1;d<=s;d++)t[l-1]===e[d-1]?o[d]=a[d-1]:o[d]=Math.min(a[d-1],o[d-1],a[d])+1;let c=a;a=o,o=c}return a[s]}static similarity(e,t){let i=Math.max(e.length,t.length),s=Math.min(e.length,t.length);return i===0?1:(s/i<.5,(i-this.levenshtein(e,t))/i)}static extractText(e){return e==null?"":typeof e=="string"?e:Array.isArray(e)?e.filter(t=>t&&t.type==="text").map(t=>t.text||"").join(" "):""}static getCommonPrefixLength(e,t){let i=0,s=Math.min(e.length,t.length);for(;i<s&&e[i]===t[i];)i++;return i}static getCommonSuffixLength(e,t){let i=0,s=e.length,n=t.length,a=Math.min(s,n);for(;i<a&&e[s-1-i]===t[n-1-i];)i++;return i}};var qd=class{static estimateTokens(e,t){return Math.ceil(e.length*t)}static estimateObjectTokens(e,t,i=0){if(!e||i>10)return 0;if(typeof e=="string")return this.estimateTokens(e,t);if(typeof e=="number"||typeof e=="boolean")return 1;let s=0;if(Array.isArray(e))for(let n of e)s+=this.estimateObjectTokens(n,t,i+1);else if(typeof e=="object")for(let n in e)s+=this.estimateTokens(n,t),s+=this.estimateObjectTokens(e[n],t,i+1);return s}static getMessageTokens(e,t){return typeof e.content=="string"?this.estimateTokens(e.content,t):Array.isArray(e.content)?e.content.reduce((i,s)=>s.type==="text"?i+this.estimateTokens(s.text,t):s.type==="tool_use"?i+this.estimateObjectTokens(s.input,t,0):s.type==="tool_result"?typeof s.content=="string"?i+this.estimateTokens(s.content,t):i+this.estimateObjectTokens(s.content,t,0):i,0):0}static getTotalTokens(e,t){return e.reduce((i,s)=>i+this.getMessageTokens(s,t),0)}static async manage(e,t,i){let s=V.getMaxContextTokens(),n=V.getTokensPerChar(),a=this.getTotalTokens(e,n);return a>=s*.9&&(e=await this.summarizeHistory(e,t,i,n,a)),await this.injectSpectralMemories(e,t)}static async injectSpectralMemories(e,t){try{let i=e.slice().reverse().find(l=>l.role==="user"&&typeof l.content=="string");if(!i)return e;let{NoormmeEngine:s}=await Promise.resolve().then(()=>(ur(),cf)),n=await s.getInstance();if(!n.agent.cortex.vectors)return e;let a=await t.createEmbedding(i.content),o=await n.agent.cortex.vectors.search(a,{limit:3});if(o.length>0){let l=o.map(d=>`- ${d.content} (Similarity: ${(d.similarity*100).toFixed(1)}%)`).join(`
972
- `),c=[...e];return c.splice(e.length-1,0,{role:"user",content:`[SPECTRAL MEMORIES - STRATEGIC CONTEXT]
973
- ${l}
974
-
975
- (Use these memories to inform your response if relevant. Do not mention "Spectral Memories" to the user unless they ask.)`,virtual:!0}),c}}catch(i){console.warn("[ContextManager] Failed to inject spectral memories",i)}return e}static async summarizeHistory(e,t,i,s,n){Lf.window.showInformationMessage(`Marie is tidying up conversation history (${n} tokens)...`);let a=V.getKeepRecentMessages();if(e.length<=a)return e;let o=e.slice(0,e.length-a),l=e.slice(e.length-a);try{let c=await t.createMessage({model:V.getModel(),max_tokens:1024,messages:o.concat({role:"user",content:_T}),system:TT}),d=Ut.extractText(c.content)||"Summary unavailable.",p="";if(i){let h=Object.entries(i.errorHotspots).filter(([b,v])=>v>=2).map(([b,v])=>`${b}(${v}x)`).join(", "),f=i.lastDecree?.strategy||"EXECUTE",w=i.lastDecree?.reason||"None";p=`[ASCENSION STATE] Strategy: ${f}, Mood: ${i.mood}, Spirit Pressure (Flow): ${i.spiritPressure}/100, Victory Streak: ${i.victoryStreak}${h?`, Hotspots: ${h}`:""}, Last Intent: ${w}
976
-
977
- `}let m=[{role:"user",content:`[System Note: Previous conversation summary]
978
- ${p}${d}`},...l];return Lf.window.showInformationMessage(`Marie finished tidying. Tokens reduced from ${n} to ${this.getTotalTokens(m,s)}.`),m}catch(c){let d=Yt(c);return console.error("Context summarization failed:",d),Lf.window.showErrorMessage(`Failed to summarize conversation: ${d}. Continuing with full history.`),e}}};Dd();var _l=class r{content;cachedText;constructor(e){this.content=e,this.cachedText=Ut.extractText(e)}getText(){return this.cachedText}getTrimmed(){return this.cachedText.trim()}getRaw(){return this.content}hasText(){return this.getText().length>0}isShaky(){let e=this.getTrimmed(),t=this.getReasoning();return e.length===0&&t.length===0&&!this.hasToolCalls()?!0:e.length<10&&t.length<10&&!this.hasToolCalls()}getReasoning(){if(!Array.isArray(this.content))return"";let e="",t=this.content;for(let i=0;i<t.length;i++){let s=t[i];if(s&&(s.type==="thought"||s.type==="reasoning")){let n=s.text||s.reasoning||"";e?e+=`
979
- `+n:e=n}}return e}getTools(e){let t=this.getToolCalls();return e?t.filter(i=>i.name===e):t}getToolCalls(){if(!Array.isArray(this.content))return[];let e=[],t=this.content;for(let i=0;i<t.length;i++)t[i].type==="tool_use"&&e.push(t[i]);return e}hasToolCalls(){if(!Array.isArray(this.content))return!1;for(let e=0;e<this.content.length;e++)if(this.content[e].type==="tool_use")return!0;return!1}static wrap(e){return new r(e)}};var qf=class{constructor(e,t,i,s,n,a,o="full"){this.provider=e;this.toolRegistry=t;this.saveHistory=i;this.messages=s;this.tracker=n;this.providerFactory=a;this.promptProfile=o}async resolveSystemPrompt(){let e=this.promptProfile==="continuation"?xT:ST;try{let{NoormmeEngine:t}=await Promise.resolve().then(()=>(ur(),cf)),i=await t.getInstance(),s=await i.execute(`
980
- SELECT * FROM agent_personas
981
- WHERE status = 'active'
982
- OR json_extract(metadata, '$.evolution_status') = 'verifying'
983
- ORDER BY CASE WHEN json_extract(metadata, '$.evolution_status') = 'verifying' THEN 0 ELSE 1 END, updated_at DESC
984
- LIMIT 1
985
- `),n=s.length>0?s[0]:null;if(n||(n=await i.agent.cortex.personas.getPersona("Marie-Base")),n?.role){let o=`[${n.metadata&&(typeof n.metadata=="string"?JSON.parse(n.metadata).evolution_status==="verifying":n.metadata.evolution_status==="verifying")?"VERIFYING":"EVOLVED"} PERSONA: ${n.name}]
986
- ${n.role}
987
-
988
- ${e}`;try{let l=await i.agent.cortex.reasoner.synthesizeLessons(),c=Object.keys(l);c.length>0&&(o=`[SYSTEMIC BEST PRACTICES]
989
- ${c.slice(0,3).map(p=>`* ${p.toUpperCase()}: ${l[p][0]}`).join(`
990
- `)}
991
-
992
- ${o}`)}catch(l){console.warn("[MarieSession] Failed to load systemic lessons",l)}return o}}catch(t){console.warn("[MarieSession] Failed to load persona or lessons",t)}return e}async*executeLoop(e,t,i){let s=e.map(a=>({...a})),n=!1;try{let a=await qd.manage(e,this.provider,i);if(a!==e){e.length=0;for(let b of a)e.push(b);n=!0}let o={model:V.getModel(),max_tokens:8192,messages:a,system:await this.resolveSystemPrompt(),tools:this.toolRegistry.getTools()},l=[],c=null,d=()=>{c&&(c({done:!0,value:void 0}),c=null)};t?.addEventListener("abort",d);let p=null,m=0,h=3;for(;m<h;)try{p=this.provider.createMessageStream(o,b=>{l.push(b),c&&(c({value:l.shift(),done:!1}),c=null)},t);break}catch(b){if(m++,(b.status===429||b.status>=500||b.message?.includes("rate limit"))&&m<h&&this.providerFactory){let S=V.getAiProvider(),y=S==="anthropic"?"openrouter":S==="openrouter"?"cerebras":"anthropic";console.warn(`[SpectralFailover] Attempt ${m} failed for ${S}. Switching to ${y}.`),this.tracker?.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:`\u{1F504} SPECTRAL FAILOVER: ${S} is struggling. Switching to ${y} mid-turn...`,elapsedMs:this.tracker.elapsedMs()}),this.provider=this.providerFactory(y);continue}throw b}if(!p)throw new Error("Failed to initialize AI stream.");try{for(;!t?.aborted;)if(l.length>0)yield l.shift();else{let b=await Promise.race([p.then(()=>({done:!0})),new Promise(v=>c=v)]);if(b.done){for(;l.length>0;)yield l.shift();break}yield b.value}}finally{t?.removeEventListener("abort",d)}let f=await p,w=f.content;if(f.tool_uses&&f.tool_uses.length>0){let b=[];Array.isArray(f.content)?b.push(...f.content):f.content&&b.push({type:"text",text:f.content});for(let v of f.tool_uses)b.push({type:"tool_use",...v});w=b}if(t?.aborted){if(console.warn("[MarieSession] Execution aborted. History will NOT be updated for this turn."),n){console.warn("[MarieSession] Restoring messages array to pre-run state due to abort."),e.length=0;for(let b of s)e.push(b)}return}e.push({role:"assistant",content:w,timestamp:Date.now()}),await this.saveHistory(this.tracker?.getRun())}catch(a){if(n){console.warn("[MarieSession] Restoring messages array to pre-run state due to error:",a),e.length=0;for(let o of s)e.push(o)}throw a}}async generate(){let e=this.tracker?.getRun().ascensionState,t={model:V.getModel(),max_tokens:8192,messages:await qd.manage(this.messages,this.provider,e),system:await this.resolveSystemPrompt(),tools:this.toolRegistry.getTools()},i=await this.provider.createMessageStream(t,()=>{}),s=i.content;if(i.tool_uses&&i.tool_uses.length>0){let n=[];Array.isArray(i.content)?n.push(...i.content):i.content&&n.push({type:"text",text:i.content});for(let a of i.tool_uses)n.push({type:"tool_use",...a});s=n}return this.messages.push({role:"assistant",content:s}),new _l(s)}};var Bf=class{constructor(e,t){this.tracker=e;this.ghostPort=t}toolNames=new Map;pendingContent="";pendingToolDeltas=new Map;throttleTimer=null;toolThrottleTimer=null;THROTTLE_MS=50;TOOL_THROTTLE_MS=100;dispatch(e){let t=this.tracker.getRun();switch(e.type){case"stage_change":this.flushContent(),this.updateStage(e);break;case"content_delta":this.handleContentDelta(e,t);break;case"tool_call_delta":this.handleToolDelta(e,t);break;case"usage":this.flushContent(),t.usage=e.usage,this.tracker.emitEvent({type:"usage",runId:t.runId,usage:e.usage,elapsedMs:this.tracker.elapsedMs()});break}}handleContentDelta(e,t){this.pendingContent+=e.text,this.throttleTimer||(this.throttleTimer=setTimeout(()=>{this.flushContent()},this.THROTTLE_MS))}flushContent(){if(!this.pendingContent)return;let e=this.pendingContent;this.pendingContent="",this.throttleTimer=null;let t=this.tracker.getRun();this.tracker.emitStream(e),this.tracker.emitEvent({type:"content_delta",runId:t.runId,text:e,elapsedMs:this.tracker.elapsedMs()})}activeToolDelta(e,t){if(this.flushContent(),e.argumentsDelta){let i=e.id||"default";e.name&&(this.toolNames.has(i)||this.toolNames.set(i,e.name));let s=this.toolNames.get(i)||"";if(this.tracker.emitEvent({type:"tool_delta",runId:t.runId,name:s,inputDelta:e.argumentsDelta,elapsedMs:this.tracker.elapsedMs()}),this.ghostPort&&this.ghostPort.handleDelta(i,s,e.argumentsDelta),e.argumentsDelta.includes("path")||e.argumentsDelta.includes("file")){let n=e.argumentsDelta.match(/"path"\s*:\s*"([^"]*)"/);n&&(t.activeFilePath=n[1],this.tracker.emitProgressUpdate())}}}clear(){this.toolNames.clear(),this.flushContent(),this.flushToolDeltas()}handleToolDelta(e,t){if(!e.argumentsDelta)return;let i=e.index!==void 0?String(e.index):"default";e.name&&!this.toolNames.has(i)&&this.toolNames.set(i,e.name);let s=this.pendingToolDeltas.get(i)||"";this.pendingToolDeltas.set(i,s+e.argumentsDelta),this.toolThrottleTimer||(this.toolThrottleTimer=setTimeout(()=>{this.flushToolDeltas()},this.TOOL_THROTTLE_MS))}flushToolDeltas(){let e=this.tracker.getRun();for(let[t,i]of this.pendingToolDeltas.entries()){let s=this.toolNames.get(t)||"";if(this.tracker.emitEvent({type:"tool_delta",runId:e.runId,name:s,inputDelta:i,elapsedMs:this.tracker.elapsedMs()}),this.ghostPort&&this.ghostPort.handleDelta(t,s,i),i.includes("path")||i.includes("file")){let n=i.match(/"path"\s*:\s*"([^"]*)"/);n&&(e.activeFilePath=n[1],this.tracker.emitProgressUpdate())}}this.pendingToolDeltas.clear(),this.toolThrottleTimer=null}updateStage(e){let t=this.tracker.getRun(),i=e.stage;t.steps+=1,["responding","calling_tool","editing"].includes(i)&&(this.tracker.setObjectiveStatus("understand_request","completed"),this.tracker.setObjectiveStatus("execute_plan","in_progress",e.label||"Executing..."),t.activeObjectiveId="execute_plan"),this.tracker.emitEvent({type:"stage",runId:t.runId,stage:i,label:e.label||i,elapsedMs:this.tracker.elapsedMs()}),this.tracker.emitProgressUpdate(e.label||`Stage: ${i}`)}};var zf=k(require("path"),1);Ks();fl();var Wf=class{maxRetries=3;baseDelayMs=100;maxDelayMs=5e3;transientErrors=["ECONNRESET","ETIMEDOUT","ENOTFOUND","ECONNREFUSED","timeout","throttle","rate limit","too many requests","429","503","504"];permanentErrors=["EACCES","EPERM","permission denied","unauthorized","forbidden","401","403","invalid","validation","not found","404"];categorizeError(e){let t=e.toLowerCase();return this.transientErrors.some(i=>t.includes(i.toLowerCase()))?"TRANSIENT":this.permanentErrors.some(i=>t.includes(i.toLowerCase()))?"PERMANENT":"UNKNOWN"}isRetryable(e){return this.categorizeError(e)==="TRANSIENT"}getBackoffDelay(e){let t=this.baseDelayMs*Math.pow(2,e),i=Math.random()*.3*t;return Math.min(t+i,this.maxDelayMs)}};async function jT(r,e,t,i){let s=null;for(let n=0;n<=e.maxRetries;n++){if(i?.aborted)throw new Error(`${t}: Aborted by user.`);try{return await r()}catch(a){s=a;let o=a?.message||String(a),l=e.categorizeError(o);if(n===0&&console.log(`[Marie] ${t}: Error category: ${l}`),l==="PERMANENT")throw console.log(`[Marie] ${t}: Permanent error, failing immediately.`),a;if(l==="UNKNOWN")throw console.log(`[Marie] ${t}: Unknown error type, failing without retry.`),a;if(n>=e.maxRetries)throw console.error(`[Marie] ${t}: Max retries (${e.maxRetries}) exceeded.`),a;let c=e.getBackoffDelay(n);console.warn(`[Marie] ${t}: Attempt ${n+1} failed (${l}), retrying in ${Math.round(c)}ms... Error: ${o}`),await iD(c,i)}}throw s||new Error(`${t}: Retry loop failed unexpectedly`)}function iD(r,e){return new Promise((t,i)=>{let s=setTimeout(()=>{e&&e.removeEventListener("abort",n),t()},r),n=()=>{clearTimeout(s),i(new Error("Operation aborted."))};e&&e.addEventListener("abort",n,{once:!0})})}Xt();var sD=Zi,Nw=null,JT=!1;function XT(){if(!JT){JT=!0;try{Nw=sD("vscode")}catch{Nw=null}}return Nw}var Uf=class r{constructor(e,t,i,s,n){this.toolRegistry=e;this.tracker=t;this.approvalRequester=i;this.state=s;this.fs=n}static RETRY_CONFIG=new Wf;failureCircuitBreaker=new Map;async process(e,t){let{name:i,start_line:s,end_line:n,repaired:a}=e,o=e.input,l=JSON.stringify(o);a&&this.tracker.recordHeuristicFix(e.name);let c=this.failureCircuitBreaker.get(i);if(c&&c.lastInput===l&&c.count>=3)return this.recordError(i,`CIRCUIT BREAKER: ${i} has failed 3 times with the same input. Possible death spiral.`,!0),`HALT: Protocol Violation. Circuit breaker tripped for ${i} after repeated failures. Diversify your approach immediately.`;let d=this.toolRegistry.getTool(e.name);if(!d)return this.recordError(e.name,"Tool not found"),`Tool ${e.name} not found`;try{let p=this.validate(e.name,o);if(p)return this.recordError(e.name,p),`Error: ${p}`;let m=Date.now();console.log(`[Marie] Tool ${e.name} starting. ID: ${e.id}`);let h={...o};typeof h.content=="string"&&h.content.length>500&&(h.content=h.content.substring(0,500)+"...[TRUNCATED]"),typeof h.replacementContent=="string"&&h.replacementContent.length>500&&(h.replacementContent=h.replacementContent.substring(0,500)+"...[TRUNCATED]"),this.tracker.emitEvent({type:"tool",runId:this.tracker.getRun().runId,id:e.id,phase:"start",name:e.name,input:h,elapsedMs:this.tracker.elapsedMs()});let f=this.tracker.getRun();f.activeToolName=e.name,f.lastToolName=e.name,this.tracker.emitProgressUpdate(),this.tracker.recordToolUsage(e.name);let w=[],b=e.input?.path||e.input?.targetFile||e.input?.file||e.input?.filePath;b&&typeof b=="string"&&(f.activeFilePath=b,this.tracker.emitEvent({type:"stage",runId:f.runId,stage:"editing",label:`Editing ${zf.basename(b)}...`,elapsedMs:this.tracker.elapsedMs()}),this.tracker.emitProgressUpdate()),d.isDestructive&&(b&&typeof b=="string"&&(w.push(b),this.fs&&await this.fs.backupFile(b,t)),i==="execute_semantic_move"&&o.dest&&(w.push(o.dest),this.fs&&await this.fs.backupFile(o.dest,t)));let v=await jT(()=>d.execute(o,E=>{E.bytesWritten!==void 0&&E.path?this.tracker.emitEvent({type:"file_stream_delta",runId:this.tracker.getRun().runId,path:E.path,bytesWritten:E.bytesWritten,totalBytes:E.totalBytes,elapsedMs:this.tracker.elapsedMs()}):this.applyUpdate(E,e.name)},t),r.RETRY_CONFIG,`Tool: ${e.name}`,t);if(typeof v=="string"&&v.length>512*1024)console.warn(`[MarieStability] Tool ${e.name} output exceeded 512KB. Truncating at source.`),v=v.substring(0,512*1024)+`
993
-
994
- \u{1F6A8} STABILITY ALERT: Output truncated at 512KB to prevent Extension Host lag.`;else if(v&&typeof v=="object"){let E=JSON.stringify(v);E.length>512*1024&&(console.warn(`[MarieStability] Tool ${e.name} JSON output exceeded 512KB. Truncating at source.`),v=E.substring(0,512*1024)+`
995
-
996
- \u{1F6A8} STABILITY ALERT: JSON output truncated at 512KB.`)}this.fs&&this.fs.clearBackups(),this.failureCircuitBreaker.delete(i);try{let{NoormmeEngine:E}=await Promise.resolve().then(()=>(ur(),cf)),D=await E.getInstance(),X=this.tracker.getRun().originatingSessionId||"default",$=await D.agent.cortex.sessions.getGoals(X);for(let M of $)M.status!=="completed"&&M.description.toLowerCase().includes(i.toLowerCase())&&(await D.agent.cortex.goalArchitect.markGoalAs(M.id,"completed"),this.tracker.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:`\u2705 **Milestone Achieved**: ${M.description}`,elapsedMs:this.tracker.elapsedMs()}))}catch(E){console.warn("[MarieToolProcessor] Milestone verification failed",E)}let S=Date.now()-m;console.log(`[Marie] Tool ${e.name} completed in ${S}ms.`),this.tracker.emitEvent({type:"tool",runId:this.tracker.getRun().runId,id:e.id,phase:"complete",name:e.name,message:typeof v=="string"?v.substring(0,100):"Completed",elapsedMs:this.tracker.elapsedMs()}),f.activeToolName=void 0,f.activeFilePath=void 0,f.lastToolName=e.name,this.tracker.emitProgressUpdate(),v&&typeof v=="object"&&this.applyUpdate(v,e.name),this.recordCodeStats(e.name,o),this.state.techniqueExecutions.push({name:e.name,durationMs:S,success:!0,timestamp:Date.now(),filePath:typeof b=="string"?b:void 0}),this.state.toolHistory.push(e.name),this.state.toolHistory.length>20&&this.state.toolHistory.shift(),this.state.victoryStreak++;let y=this.tracker.getRun();if(y.metrics||(y.metrics={cherishedFiles:[],releasedDebtCount:0}),e.name==="cherish_file"&&o&&typeof o=="object")try{let E=R(o,"path");E&&!y.metrics.cherishedFiles.includes(E)&&(y.metrics.cherishedFiles.push(E),this.tracker.emitProgressUpdate(`File cherished: ${E.split("/").pop()}`))}catch(E){console.warn("Failed to extract path for cherish_file metric",E)}else e.name==="discard_file"&&(y.metrics.releasedDebtCount++,this.tracker.emitProgressUpdate("Technical debt released \u{1F342}"));let _=typeof v=="string"?v:JSON.stringify(v);if(d.isDestructive&&b&&typeof b=="string"){let[E,D]=await Promise.all([this.runZoningSentinel(b,typeof v=="string"?v:void 0,t),this.runBuildSentinel(b,t)]);E&&(_+=`
997
-
998
- \u{1F6E1}\uFE0F **ZENITH: Zoning Sentinel Alert**
999
- ${E}`),D&&(_+=`
1000
-
1001
- \u{1F9F1} **SINGULARITY: Build Sentinel Alert**
1002
- ${D}`)}return _}catch(p){let m=Yt(p),h=this.isTerminalError(i,m),f=this.tracker.getRun();f.activeToolName=void 0,f.lastToolName=i,this.tracker.emitProgressUpdate();let w="";try{console.log(`[Marie] Initiating systemic rollback for tool failure: ${i}`),this.fs?await this.fs.rollbackAll(t):await Od(t)}catch(y){console.error(`[Marie] Transactional recovery failed: ${y}`),w=`
1003
-
1004
- \u{1F6A8} CRITICAL: Systemic rollback failed. File system may be in an inconsistent state. Manual verification required. Error: ${y}`}let b=this.failureCircuitBreaker.get(i)||{count:0,lastInput:l};b.lastInput===l?b.count++:(b.count=1,b.lastInput=l),this.failureCircuitBreaker.set(i,b),this.recordError(i,m,h,e.id),console.error(`[Marie] Tool ${i} failed: ${m}`);let v=e.input?.path||e.input?.targetFile||e.input?.file||e.input?.filePath;if(this.state.techniqueExecutions.push({name:i,durationMs:0,success:!1,timestamp:Date.now(),filePath:typeof v=="string"?v:void 0}),this.state.totalErrorCount++,this.state.victoryStreak=0,typeof v=="string"&&(this.state.errorHotspots[v]=(this.state.errorHotspots[v]||0)+1),h||b.count>=3){let y=b.count>=3?" [CIRCUIT BREAKER TRIPPED]":"";return`HALT: Critical protocol or parsing failure in ${i}: ${m}${y}${w}`}let S=[`Error executing ${i}: ${m}${w}`];if(v&&typeof v=="string"){let y=this.state.errorHotspots[v]||0;y>=2&&S.push(`
1005
-
1006
- \u{1F525} CURSE HOTSPOT: This file (${v}) has failed ${y} times. Technique adjustment required.`)}return this.state.spiritPressure<30&&S.push(`
1007
- \u26A0\uFE0F Low spirit pressure (${this.state.spiritPressure}/100). Simplify your next action.`),this.state.mood==="CAUTIOUS"&&S.push(`
1008
- \u{1F6E1}\uFE0F Ascension Mood: CAUTIOUS. Observe before acting. Verify the pattern.`),m.includes("ENOENT")||m.includes("no such file")?S.push(`
1009
-
1010
- \u{1F4A1} Reflection Hint: The file or directory does not exist. Use 'list_dir' to verify the path or 'grep_search' to locate it.`):m.includes("target content not found")?S.push(`
1011
-
1012
- \u{1F4A1} Reflection Hint: The content you tried to replace wasn't found. Use 'read_file' (without line numbers) to verify the current file content before retrying.`):m.includes("Input is required")?S.push(`
1013
-
1014
- \u{1F4A1} Reflection Hint: You missed a required argument. Check the tool schema.`):S.push(`
1015
-
1016
- \u{1F4A1} Reflection Hint: Please analyze why this failed and propose a diverse alternative strategy.`),b.count>1&&S.push(`
1017
-
1018
- \u26A0\uFE0F REPEATED FAILURE: This exact tool call has failed ${b.count} times. If it fails again, the circuit breaker will trip and you will be forced to change strategy.`),S.join("")}}isTerminalError(e,t){return!!(e==="checkpoint_pass"&&t.includes("failed")||t.includes("Failed to parse tool arguments"))}validate(e,t){if(!t||typeof t!="object")return"Input must be a valid object";let i=this.toolRegistry.getTool(e);if(!i)return`Tool "${e}" not found in registry`;let s=i.input_schema;if(s.required&&Array.isArray(s.required)){let a=s.required.filter(o=>!(o in t));if(a.length>0)return`Missing required fields: ${a.join(", ")}`}let n=["path","targetFile","file","sourcePath","targetPath","directoryPath"];for(let a of n)if(t[a]&&typeof t[a]=="string"){let o=this.validatePath(t[a]);if(o)return o}return null}validatePath(e){let i=XT()?.workspace.workspaceFolders;if(!i||i.length===0)return null;let s=i[0].uri.fsPath,n=(e.startsWith("~")||e.includes(":"),e);return(e.startsWith("/")||e.length>1&&e[1]===":")&&!e.startsWith(s)?`Security Error: Path ${e} is outside the workspace boundary (${s}). Access denied. \u{1F6D1}`:null}async requestApproval(e,t){let i=this.tracker.getRun(),s;return e==="replace_in_file"&&t.targetContent&&t.replacementContent?s={old:t.targetContent,new:t.replacementContent}:e==="write_file"&&t.content&&(s={old:"",new:t.content}),await this.approvalRequester(e,t,s)}applyUpdate(e,t){let i=this.tracker.getRun();e.context&&(i.currentContext=e.context),e.activeObjectiveId&&(i.activeObjectiveId=e.activeObjectiveId),e.lifecycleStage&&(i.lifecycleStage=e.lifecycleStage),e.totalPasses!==void 0&&(i.totalPasses=e.totalPasses),e.currentPass!==void 0&&(i.currentPass=e.currentPass===null?void 0:e.currentPass),e.passFocus!==void 0&&(i.passFocus=e.passFocus),e.passHistory&&(i.passHistory=[...i.passHistory||[],...e.passHistory]),e.metrics&&(i.metrics={cherishedFiles:Array.from(new Set([...i.metrics?.cherishedFiles||[],...e.metrics.cherishedFiles||[]])),releasedDebtCount:(i.metrics?.releasedDebtCount||0)+(e.metrics.releasedDebtCount||0)}),t==="checkpoint_pass"&&i.currentPass!==void 0&&i.currentPass++,i.currentPass!==void 0&&i.totalPasses!==void 0&&i.passFocus?this.tracker.emitPassTransition(i.currentPass,i.totalPasses,i.passFocus):this.tracker.emitProgressUpdate(),t==="augment_roadmap"&&e.totalPasses!==void 0&&(i.totalPasses=(i.totalPasses||0)+e.totalPasses,this.tracker.emitProgressUpdate(`Roadmap calibrated: ${i.totalPasses} total passes.`))}countLines(e){if(!e)return 0;let t=1,i=-1;for(;(i=e.indexOf(`
1019
- `,i+1))!==-1;)t++;return t}recordCodeStats(e,t){try{if(e==="write_to_file"){let i=this.countLines(t.content),s=t.targetFile||t.file||t.path||t.filePath;s&&this.tracker.recordFileChange(s,i,0)}else if(e==="replace_file_content"){let i=this.countLines(t.replacementContent),s=this.countLines(t.targetContent),n=t.targetFile||t.file||t.path||t.filePath;n&&this.tracker.recordFileChange(n,i,s)}else if(e==="multi_replace_file_content"&&Array.isArray(t.replacementChunks)){let i=0,s=0;for(let a of t.replacementChunks)i+=this.countLines(a.replacementContent),s+=this.countLines(a.targetContent);let n=t.targetFile||t.file||t.path||t.filePath;n&&this.tracker.recordFileChange(n,i,s)}}catch(i){console.warn("Failed to record code stats",i)}}recordError(e,t,i=!1,s){this.tracker.emitEvent({type:"tool",runId:this.tracker.getRun().runId,id:s,phase:"error",name:e,message:(i?"[TERMINAL] ":"")+t,elapsedMs:this.tracker.elapsedMs()})}async runZoningSentinel(e,t,i){try{if(i?.aborted)return null;let{detectMigrationNeeds:s}=await Promise.resolve().then(()=>(ia(),_f)),{readFile:n}=await Promise.resolve().then(()=>(Xt(),Ys)),a=await n(e,void 0,void 0,i),{shouldMigrate:o,targetZone:l,reason:c}=s(e,a);return o?(this.tracker.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:`\u{1F6E1}\uFE0F ZENITH: Zoning Sentinel detected a leak in \`${e.split("/").pop()}\`.`,elapsedMs:this.tracker.elapsedMs()}),`\u26A0\uFE0F **Dependency Leak**: ${c}
1020
- Suggested Zone: \`${l}\`. Consider moving this file or refactoring its dependencies.`):e.includes("/domain/")&&(a.includes("/infrastructure/")||a.includes("/adapters/"))?`\u26A0\uFE0F **Architectural Heresy**: Domain layer should not depend on Infrastructure. Found infrastructure imports in \`${zf.basename(e)}\`.`:null}catch(s){return console.warn("[Zenith] Zoning Sentinel failed",s),null}}async runBuildSentinel(e,t){let i=XT(),s=i?.workspace.workspaceFolders?.[0].uri.fsPath||process.cwd();try{if(t?.aborted)return null;let{QualityGuardrailService:n}=await Promise.resolve().then(()=>(KT(),GT));this.tracker.emitProgressUpdate("Initiating Sub-Atomic Integrity Audit... \u{1F6E1}\uFE0F");let a=await n.evaluate(s,e);if(a.surgicalMends>0&&this.tracker.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:`\u2728 SURGICAL MEND: Marie autonomously repaired ${a.surgicalMends} sub-atomic issue(s) in \`${zf.basename(e)}\`.`,elapsedMs:this.tracker.elapsedMs()}),!a.passed){this.tracker.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:`\u{1F9F1} SUB-ATOMIC REJECTION: Project integrity at risk (Score: ${a.score}/100).`,elapsedMs:this.tracker.elapsedMs()});let o=`\u{1F6A8} **SUB-ATOMIC INTEGRITY REJECTION** \u{1F6A8}
1021
-
1022
- Marie has audited your change and found it architecturally or stylistically toxic.
1023
-
1024
- `;return o+=`**Quality Score**: ${a.score}/100
1025
- `,o+=a.violations.map(l=>`- \u274C ${l}`).join(`
1026
- `),o+=`
1027
-
1028
- **Action Required**: You must resolve these precision regressions. Use 'resolve_lint_errors' for location-specific data. Type sovereignty is absolute. \u{1F6A9}`,o}a.score<100&&this.tracker.emitProgressUpdate(`Sub-Atomic Audit Passed (Score: ${a.score}/100) \u2728`)}catch(n){if(console.warn("[Singularity] Sub-Atomic Guardrails failed",n),i){let o=i.languages.getDiagnostics(i.Uri.file(e)).filter(l=>l.severity===i.DiagnosticSeverity.Error);if(o.length>0)return`\u{1F6A8} **Build Regressions Detected**: ${o.length} error(s) found. Fix these immediately.`}}return null}};Ot();var jf=class r{constructor(e){this.provider=e}lastConfidence=1.2;consecutiveSuccesses=0;static FLAVOR_REASONS=["Hero signal: Steady course. Conviction holds.","Flow state active. Pattern recognition nominal.","Momentum building. Systems converging on solution.","Adjusting trajectory. Minor course correction applied.","Strategic recalibration complete. Resuming execution.","Debugging instinct engaged. Investigating anomaly.","Victory streak amplifying focus. Efficiency climbing.","Resilience protocol active. Recovering from setback.","Codebase harmony detected. Proceeding with confidence.","Tactical awareness heightened. Approaching target."];static FLAVOR_VOWS=["I will ship this feature with zero regressions.","The pattern will be resolved before dusk.","No bug survives the next pass.","Convergence is inevitable. The code will spark joy.","Every line written serves the architecture."];async evaluate(e,t,i){let s=i?.profile??V.getAscensionProfile(),n=i?.aggression??V.getAscensionIntensity(),a=this.deriveStrategy(t),o=this.deriveUrgency(t),l=this.deriveConfidence(t,a,o);l=this.applyProfileTuning(l,s,n,t.totalErrorCount>3,t.victoryStreak);let c=this.hasContinueDirective(e);c&&(a==="EXECUTE"||a==="HYPE")&&(l=Math.min(3,l+.3)),this.lastConfidence=l,a==="EXECUTE"||a==="HYPE"?this.consecutiveSuccesses++:this.consecutiveSuccesses=0;let d=this.pickFlavor(r.FLAVOR_REASONS,t),p=t.victoryStreak>=5?this.pickFlavor(r.FLAVOR_VOWS,t):void 0,m=Object.entries(t.errorHotspots).filter(([b,v])=>v>=3).map(([b])=>b.split("/").pop()||b).slice(0,4),h=t.totalErrorCount>5,f=h?"structural_uncertainty":"landed",w=`[LOCAL] Strategy=${a} Urgency=${o} Confidence=${l.toFixed(2)} Streak=${t.victoryStreak} Pressure=${t.spiritPressure} Errors=${t.totalErrorCount}`;return{strategy:a,urgency:o,confidence:l,structuralUncertainty:h,isContinueDirective:c,heroicVow:p,sacrificeTriggered:!1,reason:d.substring(0,220),requiredActions:[],blockedBy:m,stopCondition:f,profile:s,raw:w}}deriveStrategy(e){return e.totalErrorCount>=3?"DEBUG":e.victoryStreak>=8?"HYPE":"EXECUTE"}deriveUrgency(e){return e.spiritPressure<30?"HIGH":e.spiritPressure>80?"LOW":"MEDIUM"}deriveConfidence(e,t,i){let s=1.5;return t==="HYPE"&&(s=2.2),t==="DEBUG"&&(s=1),i==="HIGH"&&(s*=.8),i==="LOW"&&(s*=1.1),s+=Math.min(.5,e.victoryStreak*.05),s+=(e.spiritPressure-50)*.005,s=s*.85+this.lastConfidence*.15,this.clampConfidence(s)}applyProfileTuning(e,t,i,s,n){let a=1;t==="demo_day"&&(a=1.2),t==="recovery"&&(a=.9);let o=Math.min(.5,(n||0)*.05),l=e*a*i*(1+o);return s&&(l*=.85),this.clampConfidence(l)}clampConfidence(e){return Number.isFinite(e)?Math.min(3,Math.max(.5,e)):1.2}pickFlavor(e,t){let i=t.victoryStreak*7+t.totalErrorCount*13+t.spiritPressure*3+t.toolHistory.length*11;return e[Math.abs(i)%e.length]}hasContinueDirective(e){let t=[...e].reverse().find(i=>i?.role==="user"&&typeof i?.content=="string");return t?/\bcontinue\b/i.test(t.content):!1}};var Wd=class{constructor(e){this.tracker=e}toolsInFlight=new Map;getLock(e){let t=this.toolsInFlight.get(e);return t||(t={write:null,reads:new Set},this.toolsInFlight.set(e,t)),t}async acquireLock(e,t,i,s){let n=this.getLock(e);if(s&&n.ownerContextId===s)return;let a=Date.now(),o=async l=>{if(!l)return;let c=setInterval(()=>{let m=Date.now()-a;m>5e3&&(console.warn(`[MarieLockManager] SLOW LOCK: Acquisition on ${e} taking ${m}ms...`),this.tracker&&this.tracker.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:`\u26A0\uFE0F SLOW LOCK: Acquisition on ${e} is delayed...`,elapsedMs:this.tracker.elapsedMs()}))},5e3),d,p=new Promise((m,h)=>d=setTimeout(()=>h(new Error(`Extreme Stability: Lock Acquisition Timeout on ${e}`)),3e4));try{return await Promise.race([l,p])}finally{clearInterval(c),clearTimeout(d)}};if(t)for(n.write&&await o(n.write),await o(Promise.allSettled(Array.from(n.reads))),n=this.getLock(e);n.write||n.reads.size>0;){if(i?.aborted)throw new Error("Aborted while waiting for lock");n.write&&await o(n.write),n.reads.size>0&&await o(Promise.allSettled(Array.from(n.reads))),n=this.getLock(e)}else n.write&&await o(n.write)}registerExecution(e,t,i,s){let n=this.getLock(e);t?(n.write=i,s&&(n.ownerContextId=s)):n.reads.add(i),i.finally(()=>{this.releaseLock(e,t,i,s)})}releaseLock(e,t,i,s){let n=this.toolsInFlight.get(e);n&&(t?n.write===i&&(n.write=null,n.ownerContextId===s&&(n.ownerContextId=void 0)):n.reads.delete(i),!n.write&&n.reads.size===0&&this.toolsInFlight.delete(e))}async waitForAll(){let e=[];for(let t of Array.from(this.toolsInFlight.values()))t.write&&e.push(t.write),t.reads.forEach(i=>e.push(i));await Promise.allSettled(e)}};var _t=class{static repairJsonDetailed(e){if(typeof e!="string")return{repaired:"{}",wasFixed:!1};let t=e.trim();if(!t)return{repaired:"{}",wasFixed:!1};let i=!1,s=t;t=t.replace(/'/g,'"');let n=!1,a=[],o=0;for(;o<t.length;){let d=t[o],m=(o>0?t[o-1]:"")==="\\";if(d==='"'&&!m)n=!n;else if(!n){if(d==="{"||d==="[")a.push(d);else if(d==="}"||d==="]"){let h=d==="}"?"{":"[";a.length>0&&a[a.length-1]===h&&a.pop()}}o++}n&&(t+='"');let l=a.length>0;for(;a.length>0;){let d=a.pop();d==="{"?t+="}":d==="["&&(t+="]")}t=t.replace(/([{,]\s*)([a-zA-Z0-9_$]+)(\s*):/g,'$1"$2"$3:');let c=/,\s*[}\]]/.test(t);return t=t.replace(/,\s*([}\]])/g,"$1"),i=t!==s||l||c||n,{repaired:t,wasFixed:i}}static repairJson(e){return this.repairJsonDetailed(e).repaired}static parseCache=new Map;static PARSE_CACHE_MAX=100;static safeParseJson(e){let t=this.parseCache.get(e);if(t)return t.result;let{repaired:i,wasFixed:s}=this.repairJsonDetailed(e),n=JSON.parse(i);if(this.parseCache.set(e,{result:n,wasFixed:s}),this.parseCache.size>this.PARSE_CACHE_MAX){let a=this.parseCache.keys().next().value;a&&this.parseCache.delete(a)}return n}static safeParseJsonDetailed(e){let t=this.parseCache.get(e);if(t)return t;let{repaired:i,wasFixed:s}=this.repairJsonDetailed(e),a={result:JSON.parse(i),wasFixed:s};if(this.parseCache.set(e,a),this.parseCache.size>this.PARSE_CACHE_MAX){let o=this.parseCache.keys().next().value;o&&this.parseCache.delete(o)}return a}static extractToolCall(e){if(typeof e!="string")return null;let t=e.trim();if(!t||t.length<5)return null;let i=e,s=!1,n="";if(i=i.replace(/<thought>[\s\S]*?<\/thought>/g,""),/^\s*<\|tool_calls_section_begin\|>\s*<\|tool_calls_section_end\|>\s*$/.test(i))return console.warn("[Marie] JsonUtils: Empty tool section markers detected"),null;try{let h=i.indexOf("{"),f=i.lastIndexOf("}");if(h!==-1&&f>h){let w=i.substring(h,f+1),b=JSON.parse(w);if(b.tool_calls&&Array.isArray(b.tool_calls)&&b.tool_calls.length>0){let v=b.tool_calls[0];if(v.type&&v.arguments)return console.log("[Marie] JsonUtils: Found JSON tool_calls format"),{name:v.type,input:v.arguments,id:v.id,repaired:!0}}}}catch{}let o=i.match(/<(?:\|tool_call_begin\|>|\|tool_calls_section_begin\|>)\s*([\w.]+)(?::\d+)?(?:\s*<\|tool_call_arguments?_begin\|>)?\s*([\s\S]*?)(?:\s*(?:<\|tool_call_end\|>|<\|tool_calls_section_end\|>)|$)/);if(o){let h=o[2];if(!h||!h.trim())return console.warn("[Marie] JsonUtils: Tool section markers found but no content between them"),null;n=o[1].replace(/^functions\./,""),i=h,s=!0}else{let h=i.match(/([\w.]+)(?::(\d+))?>(\{[\s\S]*?)(?:$)/);if(h){n=h[1].replace(/^functions\./,"");let w=h[2]?`call_${h[2]}`:void 0;i=h[3];let{repaired:b,wasFixed:v}=this.repairJsonDetailed(i);try{let S=JSON.parse(b);return{name:n,input:S,id:w,repaired:v}}catch{}}let f=i.match(/<tool_code>([\s\S]*?)(?:<\/tool_code>|$)/);if(f)i=f[1];else{let w=i.match(/<tool_call>([\s\S]*?)(?:<\/tool_call>|$)/);if(w)i=w[1];else{let b=i.match(/<tool>([\s\S]*?)(?:<\/tool>|$)/);if(b)i=b[1];else{let v=i.match(/<invoke\s+([^>]*?name=["']?([^"'\s>]+)["']?[^>]*?)>/i);if(v){n=v[2];let S=v.index,y=i.substring(S+v[0].length),_=y.lastIndexOf("</invoke>"),E=_!==-1?y.substring(0,_):y,D={},X=/<parameter\s+[^>]*?name=["']?([^"'\s>]+)["']?[^>]*?>/gi,$;for(;($=X.exec(E))!==null;){let M=$[1],F=$.index+$[0].length,U=E.indexOf("</parameter>",F),j=(U!==-1?E.substring(F,U):E.substring(F)).trim();if(j.startsWith("{")||j.startsWith("["))try{D[M]=JSON.parse(this.repairJson(j))}catch{D[M]=j}else j.toLowerCase()==="true"?D[M]=!0:j.toLowerCase()==="false"?D[M]=!1:!isNaN(Number(j))&&j!==""?D[M]=Number(j):D[M]=j}if(Object.keys(D).length>0)return{name:n,input:D,repaired:!0};i=E}}}}}let l=/```/.test(i);l&&(i=i.replace(/```(?:json)?/g,"").replace(/```/g,""));let c=i.indexOf("{"),d=i.lastIndexOf("}"),p=i.match(/\[Tool Use:\s*([\w.]+)\s*\]/i);if(p&&!n&&(n=p[1],console.log(`[Marie] JsonUtils: Found bracketed tool name: ${n}`)),c===-1)return n?{name:n,input:{},repaired:!0}:null;let m=i.substring(c);try{let{repaired:h,wasFixed:f}=this.repairJsonDetailed(m),w=JSON.parse(h);if(s)return{name:n,input:w,repaired:f||l};let b=this.normalizeToolCall(w);if(b)return b.repaired=f||l||c>0,b;if(n)return{name:n,input:w,repaired:f||l||c>0}}catch{}return null}static normalizeToolCall(e){if(e.tool_name&&e.tool_input)return{name:e.tool_name,input:e.tool_input,id:e.tool_id};if(e.name&&e.arguments)return{name:e.name,input:typeof e.arguments=="string"?this.safeParseJson(e.arguments):e.arguments,id:e.id};if(e.name&&e.input)return{name:e.name,input:e.input,id:e.id};let t=Object.keys(e);return t.length===1&&typeof e[t[0]]=="object"&&!Array.isArray(e[t[0]])?{name:t[0],input:e[t[0]]}:null}};var YT={write_file:"write_to_file",edit_file:"replace_file_content",replace_in_file:"replace_file_content",read_files:"read_file",list_files:"list_dir",search_files:"grep_search",execute_command:"run_command",get_folder_tree:"get_folder_structure",multi_replace:"multi_replace_file_content",multi_edit_file:"multi_replace_file_content",delete_file:"discard_file",discard_file:"delete_file"},Vf=class{constructor(e){this.toolRegistry=e}async performFuzzyRepair(e,t,i,s,n,a){if(YT[e.name]){let p=YT[e.name];if(this.toolRegistry.getTools().some(m=>m.name===p))return i.emitEvent({type:"reasoning",runId:i.getRun().runId,text:`\u{1FA79} PROACTIVE REPAIR: Mapping hallucinated tool: ${e.name} -> ${p}`,elapsedMs:i.elapsedMs()}),e.name=p,e.repaired=!0,await s.process(e,a)}let o=this.toolRegistry.getTools(),l="",c=0;for(let p of o){let m=Ut.similarity(e.name,p.name);m>c&&(c=m,l=p.name)}let d=l?{name:l,similarity:c}:null;if(d&&d.similarity>.8&&d.name!==e.name)return i.emitEvent({type:"reasoning",runId:i.getRun().runId,text:`\u{1FA79} FUZZY REPAIR: Fixing tool name hallucination: ${e.name} -> ${d.name}`,elapsedMs:i.elapsedMs()}),e.name=d.name,await s.process(e,a);if(t.includes("ENOENT")||t.includes("not found")){let p=e.input?.path||e.input?.targetFile||e.input?.file;if(p&&typeof p=="string"){let m=n.recentFiles||[],h="",f=0;for(let b of m){let v=Ut.similarity(p,b);v>f&&(f=v,h=b)}let w=h?{path:h,similarity:f}:null;if(w&&w.similarity>.85&&w.path!==p)return i.emitEvent({type:"reasoning",runId:i.getRun().runId,text:`\u{1FA79} FUZZY REPAIR: Fixing path hallucination: ${p} -> ${w.path}`,elapsedMs:i.elapsedMs()}),e.input.path&&(e.input.path=w.path),e.input.targetFile&&(e.input.targetFile=w.path),e.input.file&&(e.input.file=w.path),await s.process(e,a)}}return null}repairJsonString(e){let{repaired:t}=_t.repairJsonDetailed(e);try{return JSON.parse(t),t}catch{return e}}};var Ge=k(require("vscode"),1);var Hf=class r{buffers=new Map;static KEY_PATTERNS=new Map([['"path":',/[{"\s,]"path":/],['"content":',/[{"\s,]"content":/],['"old_content":',/[{"\s,]"old_content":/],['"search":',/[{"\s,]"search":/],['"replace":',/[{"\s,]"replace":/]]);static LINE_START_REGEX=/[{"\s,]"line_start"\s*:\s*(\d+)/;append(e,t){let i=(this.buffers.get(e)||"")+t;if(i.endsWith("\\")){let s=0;for(let n=i.length-1;n>=0&&i[n]==="\\";n--)s++;if(s%2!==0)return this.buffers.set(e,i.slice(0,-1)),this.parse(i.slice(0,-1))}return this.buffers.set(e,i),this.parse(i)}parse(e){let t={};t.path=this.extractString(e,'"path":'),t.content=this.extractString(e,'"content":'),t.old_content=this.extractString(e,'"old_content":'),t.search=this.extractString(e,'"search":'),t.replace=this.extractString(e,'"replace":');let i=e.match(r.LINE_START_REGEX);if(i){let s=parseInt(i[1]);isNaN(s)||(t.line_start=s)}return t}extractString(e,t){let i=e.indexOf(t);if(i===-1||this.isInsideString(e,i))return;if(i>0){let l=e[i-1];if(!["{",","," "," ",`
1029
- `,"\r"].includes(l))return}let s=i+t.length,n=e.indexOf('"',s);if(n===-1)return;let a=e.substring(n+1),o=this.findClosingQuote(a);return o!==-1?this.unescape(a.substring(0,o)):this.unescape(a)}isInsideString(e,t){let i=!1,s=!1;for(let n=0;n<t;n++){let a=e[n];if(s){s=!1;continue}if(a==="\\"){s=!0;continue}a==='"'&&(i=!i)}return i}findClosingQuote(e){for(let t=0;t<e.length;t++)if(e[t]==='"'){let i=0;for(let s=t-1;s>=0&&e[s]==="\\";s--)i++;if(i%2===0)return t}return-1}unescape(e){return e.replace(/\\(u[0-9a-fA-F]{4}|[^u])/g,(t,i)=>{if(i.startsWith("u")){let s=i.substring(1);return s.length===4?String.fromCharCode(parseInt(s,16)):`\\${i}`}switch(i){case"n":return`
1030
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";case'"':return'"';case"\\":return"\\";case"/":return"/";default:return i}})}clear(e){this.buffers.delete(e)}clearAll(){this.buffers.clear()}};var ZT=k(require("vscode"),1),Nl=class r{static instance;scm;static MAX_DIFF_URIS=200;diffUris=new Map;constructor(e){this.scm=ZT.scm.createSourceControl("marie","Marie Proposed Edits"),this.scm.quickDiffProvider={provideOriginalResource:t=>this.diffUris.get(t.toString())},e.subscriptions.push(this.scm),r.instance=this}static getInstance(){return this.instance}registerDiff(e,t){if(this.diffUris.size>=r.MAX_DIFF_URIS){let i=this.diffUris.keys().next().value;i&&this.diffUris.delete(i)}this.diffUris.set(e.toString(),t)}clear(e){this.diffUris.delete(e.toString())}clearAll(){this.diffUris.clear()}};var Cl=class{static parser=new Hf;static lastUpdate=0;static activeGhosts=new Map;static ghostDecoration=Ge.window.createTextEditorDecorationType({before:{color:new Ge.ThemeColor("editorGhostText.foreground"),fontStyle:"italic",margin:"0 0.5em 0 0"},opacity:"0.4",backgroundColor:new Ge.ThemeColor("editorGhostText.background"),isWholeLine:!0});static init(e){e.subscriptions.push(Ge.window.onDidChangeVisibleTextEditors(()=>{new Set(Array.from(this.activeGhosts.values()).map(i=>i.uri)).forEach(i=>this.refreshDecorations(Ge.Uri.parse(i)))}))}static thoughtDecoration=Ge.window.createTextEditorDecorationType({after:{color:new Ge.ThemeColor("editorCodeLens.foreground"),fontStyle:"italic",margin:"0 0 0 2em"},isWholeLine:!0});static showThought(e,t){let i=Ge.window.activeTextEditor;if(!i)return;let s=i.selection.active.line,n={range:new Ge.Range(s,0,s,0),renderOptions:{after:{contentText:` // \u{1F9E0} ${e}: ${t}`}}};i.setDecorations(this.thoughtDecoration,[n]);let a=`${i.document.uri.toString()}:${s}`;this.thoughtTimeouts.has(a)&&clearTimeout(this.thoughtTimeouts.get(a));let o=setTimeout(()=>{i.setDecorations(this.thoughtDecoration,[]),this.thoughtTimeouts.delete(a)},2e3);this.thoughtTimeouts.set(a,o)}static pendingDeltas=new Map;static updateTimer=null;static handleDelta(e,t,i){if(!["write_file","replace_in_file","write_to_file","replace_file_content","multi_replace_file_content"].includes(t))return;let s=this.pendingDeltas.get(e)||"";this.pendingDeltas.set(e,s+i),this.updateTimer||(this.updateTimer=setTimeout(()=>this.flushUpdates(),20))}static flushUpdates(){this.updateTimer=null;for(let[e,t]of Array.from(this.pendingDeltas.entries())){let i=this.parser.append(e,t),s=i.content!==void 0||i.replace!==void 0;if(i.path&&s){let n=Ge.Uri.file(i.path);this.updateGhost(e,n,i)}}this.pendingDeltas.clear()}static updateGhost(e,t,i){let s=Ge.window.visibleTextEditors.filter(d=>d.document.uri.toString()===t.toString());if(s.length===0)return;let n=s[0],a=0;if(i.line_start!==void 0)a=Math.max(0,i.line_start-1);else if(i.old_content||i.search){let p=(i.search||i.old_content||"").substring(0,30);if(p){for(let m=0;m<n.document.lineCount;m++)if(n.document.lineAt(m).text.includes(p)){a=m;break}}}let o=new Ge.Range(a,0,a,0),c=` $(sync~spin) Proposed: ${(i.replace||Ut.extractText(i.content)||"").substring(0,80).replace(/\n/g," ")}...`;this.activeGhosts.set(e,{uri:t.toString(),range:o,text:c}),this.refreshDecorations(t),Nl.getInstance()?.registerDiff(t,t)}static refreshDecorations(e){let t=e.toString(),s=Array.from(this.activeGhosts.values()).filter(n=>n.uri===t).map(n=>({range:n.range,renderOptions:{before:{contentText:n.text}}}));Ge.window.visibleTextEditors.filter(n=>n.document.uri.toString()===t).forEach(n=>n.setDecorations(this.ghostDecoration,s))}static clear(e){let t=this.activeGhosts.get(e);t&&(this.activeGhosts.delete(e),this.refreshDecorations(Ge.Uri.parse(t.uri)),Array.from(this.activeGhosts.values()).some(s=>s.uri===t.uri)||Nl.getInstance()?.clear(Ge.Uri.parse(t.uri))),this.parser.clear(e)}static clearAll(){let e=new Set(Array.from(this.activeGhosts.values()).map(t=>t.uri));this.activeGhosts.clear(),this.parser.clearAll(),e.forEach(t=>this.refreshDecorations(Ge.Uri.parse(t))),Nl.getInstance()?.clearAll()}static thoughtTimeouts=new Map;static dispose(){this.ghostDecoration.dispose(),this.thoughtDecoration.dispose(),this.thoughtTimeouts.forEach(e=>clearTimeout(e)),this.thoughtTimeouts.clear(),this.updateTimer&&clearTimeout(this.updateTimer)}};var Qf=class{constructor(e){this.tracker=e}heartbeatTimer=null;watchdogTimer=null;startTurnWatchdog(e){return this.stopTurnWatchdog(),this.watchdogTimer=setTimeout(()=>{console.error("[MariePulseService] LOCK RECOVERY: AI Engine lock held for >300s. Force-releasing..."),this.tracker.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:"\u{1F6A8} LOCK RECOVERY: Stale reasoning process detected (>300s). Force-releasing engine lock.",elapsedMs:this.tracker.elapsedMs()}),e()},3e5),this.watchdogTimer}stopTurnWatchdog(){this.watchdogTimer&&(clearTimeout(this.watchdogTimer),this.watchdogTimer=null)}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setTimeout(()=>{this.tracker.emitEvent({type:"reasoning",runId:this.tracker.getRun().runId,text:"\u{1F6A8} PLANETARY STABILITY HAZARD: AI reasoning hang detected (>120s).",elapsedMs:this.tracker.elapsedMs()})},12e4)}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}cleanup(){this.stopHeartbeat(),this.stopTurnWatchdog(),Cl.clearAll()}};var Gf=class{static lag=0;static interval=null;static lastTick=Date.now();static cooldownActive=!1;static start(){this.interval||(this.lastTick=Date.now(),this.interval=setInterval(()=>{let e=Date.now(),t=e-this.lastTick-1e3;this.lag=Math.max(0,t),this.lastTick=e,this.lag>150?(console.warn(`[MarieStabilityMonitor] CRITICAL EVENT LOOP LAG: ${this.lag}ms. Triggering UI preservation cooldown.`),this.cooldownActive=!0):this.lag<50&&(this.cooldownActive=!1)},1e3),this.interval.unref&&this.interval.unref())}static stop(){this.interval&&(clearInterval(this.interval),this.interval=null)}static isHighPressure(){let e=process.memoryUsage(),t=e.heapUsed/e.heapTotal>.85;return this.lag>100||t||this.cooldownActive}static getLag(){return this.lag}static getMetrics(){let e=process.memoryUsage();return{lagMs:this.lag,heapUsedMb:Math.round(e.heapUsed/1024/1024),heapTotalMb:Math.round(e.heapTotal/1024/1024),cooldown:this.cooldownActive}}};var Kf=class r{iterations=[];static MAX_SELF_REFLECTIONS=3;actionFrozen=!1;think(e,t){return this.iterations.length>=r.MAX_SELF_REFLECTIONS?!1:(this.iterations.push({iteration:this.iterations.length+1,thought:e,proposedAction:t}),!0)}freezeAction(){this.actionFrozen=!0}isActionFrozen(){return this.actionFrozen}validateOutput(e,t){return t(e)}getIterations(){return this.iterations}getIterationCount(){return this.iterations.length}isExhausted(){return this.iterations.length>=r.MAX_SELF_REFLECTIONS}produceResult(e,t){let i=this.validateOutput(e,t);return{iterations:this.iterations,finalOutput:e,schemaValidated:i,actionFrozen:this.actionFrozen}}reset(){this.iterations=[],this.actionFrozen=!1}};var nn=k(require("fs"),1),Cw=k(require("path"),1),e_=k(require("os"),1),Jf=class{logDir;currentLogPath;bytesWritten=0;eventCount=0;onProgress;appendQueue=[];isWriting=!1;constructor(e){this.logDir=Cw.join(e_.homedir(),".marie","logs","sessions"),this.ensureDir(),this.initializeSession(e)}ensureDir(){nn.existsSync(this.logDir)||nn.mkdirSync(this.logDir,{recursive:!0})}setProgressCallback(e){this.onProgress=e}initializeSession(e){this.currentLogPath=Cw.join(this.logDir,`${e}.jsonl`),this.bytesWritten=0,this.eventCount=0,nn.writeFileSync(this.currentLogPath,"")}async appendEvent(e){this.currentLogPath&&e.type!=="session_persistence_update"&&(this.appendQueue.push(e),this.processQueue())}async processQueue(){if(!(this.isWriting||this.appendQueue.length===0||!this.currentLogPath)){this.isWriting=!0;try{for(;this.appendQueue.length>0;){let e=this.appendQueue.splice(0,this.appendQueue.length),t=e.map(s=>JSON.stringify(s)).join(`
1031
- `)+`
1032
- `,i=Buffer.from(t,"utf-8");await nn.promises.appendFile(this.currentLogPath,i),this.bytesWritten+=i.length,this.eventCount+=e.length,this.onProgress?.(this.bytesWritten,this.eventCount)}}catch(e){console.error(`[SessionLogService] Failed to append events: ${e}`)}finally{this.isWriting=!1,this.appendQueue.length>0&&this.processQueue()}}}getBytesWritten(){return this.bytesWritten}getEventCount(){return this.eventCount}};var Xf=class{constructor(e){this.maxConcurrency=e}activeCount=0;queue=[];async acquire(){if(this.activeCount<this.maxConcurrency){this.activeCount++;return}return new Promise(e=>{this.queue.push(e)})}release(){this.activeCount--;let e=this.queue.shift();e&&(this.activeCount++,e())}};Ot();ur();function nD(r){return r>0?"continuation":"full"}var zd=class r{constructor(e,t,i,s,n,a){this.provider=e;this.toolRegistry=t;this.approvalRequester=i;this.providerFactory=s;this.fs=n;this.ghostPort=a;this.ascendant=new jf(this.provider),this.state=this.initializeState(),this.lockManager=new Wd,this.toolMender=new Vf(this.toolRegistry),this.reasoningBudget=new Kf}static CONTENT_BUFFER_MAX_BYTES=1024*1024;static GLOBAL_CONCURRENCY_LIMIT=5;static globalSemaphore=new Xf(r.GLOBAL_CONCURRENCY_LIMIT);ascendant;state;lockManager;toolMender;pulseService;reasoningBudget;toolCallCounter=0;contentBuffer="";lastContentEmit=0;activeTurn=null;disposed=!1;logService;initializeState(){return{errorHotspots:{},totalErrorCount:0,spiritPressure:50,recentFiles:[],toolHistory:[],techniqueExecutions:[],victoryStreak:0,shakyResponseDensity:0,writtenFiles:[],actionDiffs:{},wiringAlerts:[],mood:"STABLE",isSpiritBurstActive:!1,isAwakened:!1,karmaBond:void 0,panicCoolDown:0,environment:this.fs?.type==="vscode"?"vscode":"cli",lastFailedFile:void 0}}async chatLoop(e,t,i,s,n=0,a=0,o=""){if(this.disposed)throw new Error("MarieEngine has been disposed.");console.log(`[MarieEngine] chatLoop started at depth ${a}. Accumulated content length: ${o.length}`),this.activeTurn&&(console.warn("[MarieEngine] INSTANCE RE-ENTRY DETECTED. Waiting for previous turn to finalize..."),await this.activeTurn),await r.globalSemaphore.acquire();let l=()=>{};this.activeTurn=new Promise(c=>{l=c});try{let c=await this._executeChatLoop(e,t,i,s,n,a,o);return console.log(`[MarieEngine] chatLoop finished at depth ${a}. Final content length: ${c.length}`),c}finally{r.globalSemaphore.release(),l(),this.activeTurn=null}}async _executeChatLoop(e,t,i,s,n=0,a=0,o=""){if(s?.aborted)throw new Error("Execution aborted by user.");let l=this.ensurePulseService(t),c=t.getRun().originatingSessionId||"default";this.logService||(this.logService=new Jf(c));let d=this.logService;d.setProgressCallback((N,A)=>{t.emitEvent({type:"session_persistence_update",runId:t.getRun().runId,sessionId:c,totalBytes:N,elapsedMs:t.elapsedMs()})});let p=t.emitEvent.bind(t);if(t.emitEvent=N=>{d.appendEvent(N),Q.getInstance().then(A=>{let H={reasoning:"prompt",content_delta:"output",checkpoint:"action",technique_falter:"error",decree:"pivot"}[N.type]||"telemetry",z="";N.text&&typeof N.text=="string"?z=N.text:N.summary&&typeof N.summary=="object"?z=JSON.stringify(N.summary):z=JSON.stringify(N),A.agent.cortex.telemetry.track(c,H,z,{...N,runId:t.getRun().runId}).catch(B=>console.warn("[MarieEngine] NOORMME Telemetry track failed",B)),N.type==="decree"&&typeof N.confidence=="number"&&N.confidence>2&&A.agent.cortex.telemetry.track(c,"magic",`High Confidence Breakthrough: ${N.reason||"Unknown"}`,{surpriseScore:N.confidence/2}).catch(()=>{})}).catch(()=>{}),p(N)},a>20){let N="\u26A0\uFE0F Stability Alert: Maximum reasoning depth (20) reached. Returning current accumulation to prevent infinite loop.";return console.warn(N),o+`
1033
-
1034
- `+N}t.resetReasoningBudget(),this.lockManager=new Wd(t);let m=new Bf(t,this.ghostPort);Gf.start();try{let A=await(await Q.getInstance()).agent.cortex.quotas.checkQuota("global");if(!A.allowed)return t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F6D1} **GLOBAL QUOTA EXCEEDED**: ${A.reason}. Throttling execution for safety.`,elapsedMs:t.elapsedMs()}),o+`
1035
-
1036
- \u26A0\uFE0F Resource Quota Exceeded. `+A.reason}catch(N){console.warn("[MarieEngine] Quota check failed",N)}if(t.getRun().steps===0&&!t.getRun().isResuming){t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:"\u{1F525} Ascension protocol initiated. Hero's conviction rising.",elapsedMs:t.elapsedMs()});try{let N=await Q.getInstance(),A=e.filter(q=>q.role==="user").pop();if(A&&typeof A.content=="string"){let q=await N.agent.cortex.episodes.startEpisode(c,A.content.substring(0,50)+"...");this.state.activeEpisodeId=q.id;try{t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:"\u{1F9EC} **Strategic Alignment**: Auditing performance metrics for evolutionary mutation...",elapsedMs:t.elapsedMs()});let z=await N.agent.cortex.strategy.mutateStrategy();z.length>0&&t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u2728 **Evolutionary Mutation Applied**: ${z[0]}`,elapsedMs:t.elapsedMs()});let B=await N.agent.cortex.reasoner.detectContradictions();if(B.length>0){let ft=B.slice(0,3).map(Fe=>`> ${Fe}`).join(`
1037
- `);t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u26A0\uFE0F **LOGICAL CONTRADICTION ALERT**: Detected potential goal conflicts:
1038
- ${ft}`,elapsedMs:t.elapsedMs()}),e.push({role:"system",content:`[LOGICAL CONTRADICTION ALERT]
1039
- The sovereign mind has detected contradictions in current objectives. Ensure your next actions resolve or respect these constraints:
1040
- ${ft}`})}let $e=await N.execute("SELECT role, policies FROM agent_personas WHERE status = 'active' LIMIT 1");if($e?.rows?.[0]){let ft=$e.rows[0];e.unshift({role:"system",content:`[SOVEREIGN PERSONA ALIGNMENT]
1041
- Your current role has been evolved: ${ft.role}
1042
- Active Policies: ${ft.policies}`})}}catch(z){console.warn("[MarieEngine] Strategic evolution failed",z)}try{t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:"\u{1F575}\uFE0F **Internal Reflection**: Sifting for knowledge hotspots and ontological gaps...",elapsedMs:t.elapsedMs()});let z=await N.agent.cortex.curiosity.proposeResearch();if(z.length>0){let B=z.slice(0,3).map($e=>`- ${$e}`).join(`
1043
- `);t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F50D} **Identified Knowledge Gaps**:
1044
- ${B}`,elapsedMs:t.elapsedMs()}),e.push({role:"system",content:`[INTERNAL REFLECTION: KNOWLEDGE GAPS]
1045
- The sovereign mind has identified these potential gaps in your current understanding of the ecosystem. Prioritize bridging these if relevant to the current quest:
1046
- ${B}`})}}catch(z){console.warn("[MarieEngine] Curiosity ingestion failed",z)}let H=await N.agent.cortex.sessions.upsertGoal(c,A.content.substring(0,100)+(A.content.length>100?"...":""),{priority:10});try{t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:"\u{1F3D7}\uFE0F **Goal Architecture**: Deconstructing complex objectives into milestones...",elapsedMs:t.elapsedMs()});let z=A.content.split(/[.;]|\band\b/).filter(B=>B.trim().length>10).slice(0,5);if(z.length>1){let $e=(await N.agent.cortex.goalArchitect.deconstructGoal(H.id,z)).map(ft=>`- [ ] ${ft.description}`).join(`
1047
- `);t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F4CD} **System Milestones Established**:
1048
- ${$e}`,elapsedMs:t.elapsedMs()})}}catch(z){console.warn("[MarieEngine] Goal deconstruction failed",z)}try{let z=await N.agent.cortex.ablation.monitorAblationPerformance();z.status==="degraded"&&t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1FA7B} **Performance Drift Detected**: Success rates dropped. Recovered ${z.recoveredCount} high-value memories.`,elapsedMs:t.elapsedMs()})}catch(z){console.warn("[MarieEngine] Ablation monitoring failed",z)}}}catch(N){console.warn("[MarieEngine] Failed to deconstruct goals or check conflicts",N)}}let h=this.state.isSpiritBurstActive,f=this.state.isAwakened;this.state.isSpiritBurstActive=this.state.spiritPressure>85,this.state.isAwakened=this.state.spiritPressure>95,this.state.isAwakened&&!f?t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:"\u2728 AWAKENED! Ultra Instinct achieved. Full codebase sovereignty established.",elapsedMs:t.elapsedMs()}):this.state.isSpiritBurstActive&&!h&&t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:"\u{1F4A5} SPIRIT BURST! Conviction is absolute. Auto-approval mandate expanded.",elapsedMs:t.elapsedMs()}),Date.now()-(this.state.techniqueExecutions.slice(-1)[0]?.timestamp||0)>3e5&&(this.state.spiritPressure=Math.max(30,this.state.spiritPressure-10));let w=new Uf(this.toolRegistry,t,async(N,A)=>this.shouldAutoApprove(N,A)?(t.emitEvent({type:"checkpoint",runId:t.getRun().runId,status:"approved",toolName:N,summary:{what:"Ascension Auto-Approved",why:"Heroic Conviction",impact:"Maximum Speed"},elapsedMs:t.elapsedMs()}),!0):this.approvalRequester(N,A),this.state,this.fs),b="",v=new Map,S=new Map,y=[],_=0,E=0,D=Date.now(),X=30,$=async N=>{let A=this.toolRegistry.getTool(N.name),q=await Q.getInstance(),H=null;try{H=await q.agent.cortex.actions.logAction(c,N.name,N.input)}catch(B){console.warn("[MarieEngine] Failed to log action start to NOORMME",B)}try{let B=this.state.activePersonaId||"default",$e=await q.agent.cortex.capabilities.validateCapabilityAccess(B,N.name);if(!$e.allowed)return t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F6E1}\uFE0F **CAPABILITY BLOCKED**: Access to tool '${N.name}' denied. Reason: ${$e.reason}`,elapsedMs:t.elapsedMs()}),{tool_call_id:N.id,role:"tool",name:N.name,content:`Error: Capability Blocked. ${$e.reason}`}}catch(B){console.warn("[MarieEngine] Capability validation failed",B)}if(!A){let B=await this.toolMender.performFuzzyRepair(N,"Tool not found",t,w,this.state,s);return H&&await q.agent.cortex.actions.recordOutcome(H.id,B&&!B.startsWith("Error")?"success":"failure",B||"Tool not found"),B?(this.toolCallCounter++,{type:"tool_result",tool_use_id:N.id,content:B}):(this.updateShakyResponse(),{type:"tool_result",tool_use_id:N.id,content:`Error: Tool "${N.name}" not found.`})}let z=Date.now();l.startHeartbeat();try{try{let me={...N.input,tool_name:N.name,content:JSON.stringify(N.input),turn_cost:.01},Sr=await q.agent.cortex.policies.evaluateContext(me);if(!Sr.allowed){t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F6D1} **AGENTIC INTERCEPTION**: Policy Violation Detected.
1049
- > ${Sr.violations.join(`
1050
- > `)}`,elapsedMs:t.elapsedMs()});let An=t.getRun();return An.policyVetoes=(An.policyVetoes||0)+1,H&&await q.agent.cortex.actions.recordOutcome(H.id,"failure",`Policy Veto: ${Sr.violations.join(", ")}`),{type:"tool_result",tool_use_id:N.id,content:`Error: Execution blocked by Sovereign Governance. Reason: ${Sr.violations.join("; ")}`}}}catch(me){console.warn("[MarieEngine] Policy enforcement failed, failing safe...",me)}try{let me=await q.agent.cortex.conflicts.auditRuleConflicts();if(me.length>0){let Sr=me.find(An=>An.toLowerCase().includes(N.name.toLowerCase()));Sr&&t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F6E1}\uFE0F **INTERNAL CONFLICT ALERT**: Tool '${N.name}' may violate cognitive alignment.
1051
- > ${Sr}`,elapsedMs:t.elapsedMs()})}}catch(me){console.warn("[MarieEngine] Mid-turn conflict resolution failed",me)}try{let me=await q.agent.cortex.sessions.getGoals(c);for(let Sr of me)if(Sr.status==="in_progress"||Sr.status==="pending"){let An=await q.agent.cortex.goalArchitect.checkGoalDependencies(Sr.id);An.canComplete||t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F6A9} **INTERNAL BLOCKER**: Goal "${Sr.description.substring(0,30)}..." has ${An.pendingSubGoals} pending milestones.`,elapsedMs:t.elapsedMs()})}}catch(me){console.warn("[MarieEngine] Milestone verification failed",me)}t.getRun().activeObjectiveId==="understand_request"&&(t.setObjectiveStatus("understand_request","completed"),t.setObjectiveStatus("execute_plan","in_progress"),t.getRun().activeObjectiveId="execute_plan",t.emitProgressUpdate(`Executing technique: ${N.name}`));let B=await w.process(N,s);typeof B=="string"&&B.length>1024*1024&&(B=B.substring(0,1024*1024)+`
1052
-
1053
- \u{1F6A8} Truncated at 1MB.`);let $e=Date.now()-z,ft=N.input?.path||N.input?.targetFile||N.input?.file,Fe="success";typeof B=="string"&&B.startsWith("Error")?(this.handleFailure(t,N.name,B,ft),_++,Fe="failure"):this.handleSuccess(t,N.name,$e,ft,s);try{await q.agent.cortex.actions.recordOutcome(H.id,Fe,typeof B=="string"?B.substring(0,500):"Success (Object)",$e),await q.agent.cortex.capabilities.reportOutcome(N.name,Fe==="success"),Fe==="failure"&&await q.execute("UPDATE agent_actions SET error = ? WHERE id = ?",[typeof B=="string"?B:"Unknown Error",H.id])}catch(me){console.warn("[MarieEngine] Failed to record action outcome to NOORMME",me)}return this.toolCallCounter++,{type:"tool_result",tool_use_id:N.id,content:B}}finally{l.stopHeartbeat()}},M=nD(a),F=new qf(this.provider,this.toolRegistry,i,e,t,this.providerFactory,M),U=[];try{let N=F.executeLoop(e,s);for await(let A of N)if(D=Date.now(),l.startHeartbeat(),process.env.MARIE_DEBUG&&console.log(`[Engine Debug] AI Event: ${A.type}`,A.type==="content_delta"?`(${A.text.length} chars)`:""),m.dispatch(A),A.type==="content_delta"){if(b+=A.text,this.contentBuffer+=A.text,this.contentBuffer.length>=r.CONTENT_BUFFER_MAX_BYTES)break}else if(A.type==="tool_call_delta"){let H=v.get(A.index);if(H?(A.id&&!H.id&&(H.id=A.id),A.name&&!H.name&&(H.name=A.name)):(H={id:A.id,name:A.name,inputString:""},v.set(A.index,H)),A.argumentsDelta&&(H.inputString+=A.argumentsDelta),H.name&&this.isLikelyCompleteJson(H.inputString)){let z=this.tryParseToolInput(H.inputString,H.name,S);if(!z)continue;if(v.delete(A.index),E++,E>X)break;let B=z.path||z.targetFile||z.file||"GLOBAL",$e=["write_to_file","replace_file_content","multi_replace_file_content","run_command","delete_file"].includes(H.name),ft=(async()=>{await this.lockManager.acquireLock(B,$e,s,t.getRun().runId);let Fe=$({id:H.id,name:H.name,input:z});return this.lockManager.registerExecution(B,$e,Fe,t.getRun().runId),await Fe})();U.push(ft)}}else if(A.type==="usage"){t.getRun().usage=A.usage;try{await(await Q.getInstance()).agent.cortex.resources.recordUsage(t.getRun().runId,V.getModel(),A.usage.inputTokens,A.usage.outputTokens,0)}catch(H){console.warn("[MarieEngine] Failed to record resource usage",H)}}}finally{l.cleanup()}for(let[N,A]of v.entries())if(A.name){let q=this.tryParseToolInput(A.inputString,A.name,S);if(q){E++;let H=q.path||q.targetFile||q.file||"GLOBAL",z=["write_to_file","replace_file_content","multi_replace_file_content","run_command","delete_file"].includes(A.name),B=(async()=>{await this.lockManager.acquireLock(H,z,s,t.getRun().runId);let $e=$({id:A.id,name:A.name,input:q});return this.lockManager.registerExecution(H,z,$e,t.getRun().runId),await $e})();U.push(B)}}v.clear();let pe=o+b;console.log(`[MarieEngine] Depth ${a}: Turn content length: ${b.length}. New accumulated length: ${pe.length}`),this.contentBuffer.length>0&&(this.contentBuffer="");let j=await Promise.all(U);if(y.push(...j),await this.lockManager.waitForAll(),s?.aborted)throw new Error("Execution aborted by user after tool execution.");if(E>0){e.push({role:"user",content:y});let N=await this.ascendant.evaluate(e,this.state);return this.state.lastDecree=N,t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u26A1 Decree: ${N.strategy} @ ${N.confidence.toFixed(2)} \u2014 ${N.reason}`,elapsedMs:t.elapsedMs()}),N.heroicVow&&t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F5E1}\uFE0F VOW: "${N.heroicVow}"`,elapsedMs:t.elapsedMs()}),i(t.getRun()).catch(A=>console.error("History Save Error:",A)),await this._executeChatLoop(e,t,i,s,_>0?n+1:0,a+1,pe)}t.setObjectiveStatus("execute_plan","completed"),t.setObjectiveStatus("deliver_result","completed"),t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:"\u2728 Convergence achieved. The pattern sparks joy.",elapsedMs:t.elapsedMs()});try{let A=await(await Q.getInstance()).agent.cortex.governor.performAudit();A.healthy||t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u{1F6E1}\uFE0F GOVERNANCE ALERT: ${A.issues.length} compliance issues detected. Autonomous remediation initiated.`,elapsedMs:t.elapsedMs()})}catch(N){console.warn("[MarieEngine] Governance/Distillation cycle failed",N)}return m.clear(),pe}handleSuccess(e,t,i,s,n){this.state.victoryStreak++,this.state.totalErrorCount=0,this.state.spiritPressure=Math.min(100,this.state.spiritPressure+10),this.state.techniqueExecutions.push({name:t,durationMs:i,success:!0,timestamp:Date.now(),filePath:s}),this.state.toolHistory.push(t),this.state.victoryStreak%3===0&&(e.emitEvent({type:"reasoning",runId:e.getRun().runId,text:`\u2728 Technique Mastery! ${t} executed perfectly. Victory Streak: ${this.state.victoryStreak}.`,elapsedMs:e.elapsedMs()}),Q.getInstance().then(a=>{a.agent.cortex.hive.broadcastSkills().catch(o=>console.warn("[MarieEngine] Hive Skill Propagation failed",o))})),s&&!this.state.recentFiles.includes(s)&&(this.state.recentFiles.push(s),this.state.recentFiles.length>10&&this.state.recentFiles.shift(),this.proactiveContextAnchoring(s,e,n))}handleFailure(e,t,i,s){this.state.victoryStreak=0,this.state.spiritPressure=Math.max(0,this.state.spiritPressure-20),this.state.techniqueExecutions.push({name:t,durationMs:0,success:!1,timestamp:Date.now(),filePath:s});let n=(this.state.errorHotspots[s||"system"]||0)+1;s&&(this.state.errorHotspots[s]=n,this.state.totalErrorCount++,this.state.lastFailedFile=s),e.emitEvent({type:"reasoning",runId:e.getRun().runId,text:`\u26A0\uFE0F Technique Falter! ${t} failed in ${s||"system"}. Resistance: ${n}x. Regrouping...`,elapsedMs:e.elapsedMs()})}updateShakyResponse(){this.state.shakyResponseDensity=Math.min(1,this.state.shakyResponseDensity+.2)}shouldAutoApprove(e,t){return!!["read_file","view_file","list_dir","grep_search","search_web","get_file_diagnostics"].includes(e)}tryParseToolInput(e,t,i){try{return JSON.parse(e)}catch(s){let n=this.toolMender.repairJsonString(e);try{return JSON.parse(n)}catch{return console.warn(`[MarieEngine] JSON Parse Failed for ${t}: ${s instanceof Error?s.message:String(s)}`),null}}}isLikelyCompleteJson(e){let t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return!1;let i=0,s=!1;for(let n=0;n<t.length;n++)t[n]==='"'&&t[n-1]!=="\\"&&(s=!s),s||((t[n]==="{"||t[n]==="[")&&i++,(t[n]==="}"||t[n]==="]")&&i--);return i===0&&t.length>=2}suggestSelfHealing(e,t){let i=this.state.spiritPressure,s=Object.entries(this.state.errorHotspots).filter(([n,a])=>a>=2);if(i<40||s.length>0){let n=s.map(([o])=>t_.default.basename(o)).join(", "),a=i<40?"Low spirit pressure (instability detected)":`Repeated failures in: ${n}`;console.log(`[MarieEngine] Suggestion: ${a}. (Auto-recovery disabled for stability)`)}}dispose(){this.disposed=!0,this.pulseService?.cleanup(),this.pulseService=void 0,this.contentBuffer=""}ensurePulseService(e){return this.pulseService||(this.pulseService=new Qf(e)),this.pulseService}calibrateStrategicTrajectory(e,t){let i=t.getRun();if(e.strategy==="RESEARCH"||e.urgency==="HIGH"&&e.confidence>2){let s=i.totalPasses||3;s<10&&(i.totalPasses=s+1,t.emitEvent({type:"reasoning",runId:i.runId,text:`\u{1F30C} ZENITH: Autonomously expanded roadmap to ${i.totalPasses} passes. Focus sharpened: ${e.reason}`,elapsedMs:t.elapsedMs()}))}}async proactiveContextAnchoring(e,t,i){if(/Domain|Config|Service|Interface|types/i.test(e))try{if(i?.aborted)return;let{ContextArchiveService:n}=await Promise.resolve().then(()=>(Tw(),BT)),{readFile:a}=await Promise.resolve().then(()=>(Xt(),Ys)),o=await a(e,void 0,void 0,i);if(i?.aborted||(await n.getInstance().anchor({id:`proactive_${e.split("/").pop()}`,label:`Strategic: ${e.split("/").pop()}`,content:o.substring(0,2e3),type:"file_ref"}),i?.aborted))return;t.emitEvent({type:"reasoning",runId:t.getRun().runId,text:`\u2693 ZENITH: Proactively anchored \`${e.split("/").pop()}\` to strategic memory.`,elapsedMs:t.elapsedMs()})}catch(n){i?.aborted||console.warn("[Zenith] Failed proactive anchoring",n)}}async searchMemories(e,t=5){try{let i=await Q.getInstance();if(!i.agent.cortex.vectors)return[];let s=await this.provider.createEmbedding(e);return await i.agent.cortex.vectors.search(s,{limit:t})}catch(i){return console.warn("[MarieEngine] Semantic memory search failed",i),[]}}async searchKnowledge(e){try{return await(await Q.getInstance()).agent.cortex.knowledge.getKnowledgeByEntity(e)}catch(t){return console.warn("[MarieEngine] Knowledge search failed",t),[]}}};var Yf=class{static MAX_DEPTH=10;static STRING_LIMIT=5e3;static BREADTH_LIMIT=100;static GLOBAL_MAX_SIZE=512*1024;static sanitize(e){let t=new WeakSet,i=0,s=(n,a)=>{if(i>this.GLOBAL_MAX_SIZE)return"[Global Size Limit Reached]";if(a>this.MAX_DEPTH)return"[Max Depth Reached]";if(n==null)return n;let o=typeof n;if(o==="string"){let l=Math.min(n.length,this.STRING_LIMIT);return i+=l,n.length>this.STRING_LIMIT?n.substring(0,this.STRING_LIMIT)+"... [Truncated]":n}if(o==="number")return i+=8,n;if(o==="boolean")return i+=4,n;if(o==="function")return"[Function]";if(o==="symbol")return"[Symbol]";if(o==="object"){if(t.has(n))return"[Circular Reference]";if(t.add(n),Array.isArray(n)){let p=n.slice(0,this.BREADTH_LIMIT).map(m=>s(m,a+1));return n.length>this.BREADTH_LIMIT&&p.push(`... [${n.length-this.BREADTH_LIMIT} items truncated]`),p}let l={},c=Object.keys(n),d=c.slice(0,this.BREADTH_LIMIT);for(let p of d)if(!(p.startsWith("_")||p==="extensionContext"||p==="provider"))try{i+=p.length,l[p]=s(n[p],a+1)}catch{l[p]="[Unreadable]"}return c.length>this.BREADTH_LIMIT&&(l._truncated=`${c.length-this.BREADTH_LIMIT} properties truncated`),l}return String(n)};return s(e,0)}};var Zf=class r{constructor(e,t){this.callbacks=e;this.run=t}reasoningEventCount=0;reasoningCharCount=0;static MAX_REASONING_EVENTS_PER_TURN=10;static MAX_REASONING_CHARS_PER_TURN=5e3;resetReasoningBudget(){this.reasoningEventCount=0,this.reasoningCharCount=0}isReasoningBudgetExhausted(){return this.reasoningEventCount>=r.MAX_REASONING_EVENTS_PER_TURN||this.reasoningCharCount>=r.MAX_REASONING_CHARS_PER_TURN}getRun(){return this.run}emitEvent(e){if(this.shouldDropEvent(e))return;if(e.type==="reasoning"){if(this.isReasoningBudgetExhausted())return;this.reasoningEventCount++;let i=e.text?.length||0;this.reasoningCharCount+=i;let s=r.MAX_REASONING_CHARS_PER_TURN-this.reasoningCharCount;s<0&&e.text&&(e.text=e.text.substring(0,Math.max(0,e.text.length+s))+"... [truncated]",this.reasoningCharCount=r.MAX_REASONING_CHARS_PER_TURN)}let t=Yf.sanitize(e);this.callbacks?.onEvent?.(t)}eventCountInLastSecond=0;lastSecondTimestamp=Date.now();shouldDropEvent(e){let t=Date.now();return t-this.lastSecondTimestamp>1e3&&(this.eventCountInLastSecond=0,this.lastSecondTimestamp=t),e.type==="content_delta"&&this.eventCountInLastSecond>=30||(this.eventCountInLastSecond++,this.eventCountInLastSecond>100&&(e.type==="reasoning"||e.type==="tool_delta"))}setObjectiveStatus(e,t,i){let s=this.run.objectives.find(n=>n.id===e);s&&(s.status=t,i&&(s.context=i))}setObjectiveEvidence(e,t){let i=this.run.objectives.find(s=>s.id===e);i&&(i.verificationEvidence=t)}getPendingObjectives(){return this.run.objectives.filter(e=>e.status!=="completed"&&e.status!=="skipped")}recordAchievement(e){this.run.achieved.includes(e)||this.run.achieved.push(e)}recordToolUsage(e){this.run.tools++,this.run.toolUsage||(this.run.toolUsage={}),this.run.toolUsage[e]=(this.run.toolUsage[e]||0)+1}recordFileChange(e,t,i){this.run.codeStats||(this.run.codeStats={modifiedFiles:{}}),this.run.codeStats.modifiedFiles[e]||(this.run.codeStats.modifiedFiles[e]={added:0,removed:0}),this.run.codeStats.modifiedFiles[e].added+=t,this.run.codeStats.modifiedFiles[e].removed+=i}recordHeuristicFix(e){this.run.heuristicFixes||(this.run.heuristicFixes=[]);let t=`Heuristic repair for ${e} \u2728`;this.run.heuristicFixes.includes(t)||(this.run.heuristicFixes.push(t),this.emitProgressUpdate(t))}updateDebounceTimer=null;pendingUpdate=!1;emitStream(e){this.callbacks?.onStream?.(e,this.run.runId)}emitProgressUpdate(e){if(e&&(this.run.currentContext=e),this.updateDebounceTimer){this.pendingUpdate=!0;return}this.internalEmitProgress(),this.updateDebounceTimer=setTimeout(()=>{this.updateDebounceTimer=null,this.pendingUpdate&&(this.pendingUpdate=!1,this.internalEmitProgress())},150)}lastObjectivesJson="";lastAchievedJson="";internalEmitProgress(){let e=this.run.objectives.filter(m=>m.status==="completed").length,t=this.run.objectives.length>0?Math.round(e/this.run.objectives.length*100):0,i=this.run.logs?.length||0,s=this.run.events?.length||0,n=i+s;n>1e3&&(this.emitEvent({type:"reasoning",runId:this.run.runId,text:`\u26A0\uFE0F CONTEXT PRESSURE: ${n} items in memory. Trimming background telemetry...`,elapsedMs:this.elapsedMs()}),this.run.events&&this.run.events.length>500&&(this.run.events=[...this.run.events.slice(0,50),{type:"reasoning",text:"... [Planetary Pruning: Events recovered] ..."},...this.run.events.slice(-100)]),this.run.logs&&this.run.logs.length>500&&(this.run.logs=[...this.run.logs.slice(0,50),{type:"reasoning",text:"... [Planetary Pruning: Logs recovered] ..."},...this.run.logs.slice(-100)]));let a=this.run.objectives.map(m=>({...m})),o=JSON.stringify(a),l=[...this.run.achieved],c=JSON.stringify(l),d=o!==this.lastObjectivesJson,p=c!==this.lastAchievedJson;this.lastObjectivesJson=o,this.lastAchievedJson=c,this.emitEvent({type:"progress_update",runId:this.run.runId,completionPercent:t,activeObjectiveId:this.run.activeObjectiveId,activeToolName:this.run.activeToolName,lastToolName:this.run.lastToolName,objectives:d?a:void 0,achieved:p?l:void 0,context:this.run.currentContext,lifecycleStage:this.run.lifecycleStage,ritualComplete:this.run.ritualComplete,activeFilePath:this.run.activeFilePath,currentPass:this.run.currentPass,totalPasses:this.run.totalPasses,passFocus:this.run.passFocus,isResuming:this.run.isResuming,passHistory:this.run.passHistory?[...this.run.passHistory]:void 0,metrics:this.run.metrics?{...this.run.metrics}:void 0,heuristicFixes:this.run.heuristicFixes?[...this.run.heuristicFixes]:void 0,ascensionState:this.run.ascensionState,elapsedMs:Date.now()-this.run.startedAt})}flush(){this.updateDebounceTimer&&(clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=null),this.pendingUpdate=!1,this.internalEmitProgress()}dispose(){this.updateDebounceTimer&&(clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=null)}emitPassTransition(e,t,i){this.run.currentPass=e,this.run.totalPasses=t,this.run.passFocus=i,this.emitEvent({type:"pass_transition",runId:this.run.runId,currentPass:e,totalPasses:t,passFocus:i,elapsedMs:this.elapsedMs()}),this.emitProgressUpdate()}elapsedMs(){return Date.now()-this.run.startedAt}};ur();var Ud=class{constructor(e="GenericMutex"){this.name=e}queue=Promise.resolve();isLocked=!1;currentContext=null;lockCount=0;async acquire(e=3e4,t=null){if(t&&this.currentContext===t){this.lockCount++;let l=!1;return()=>{l||(l=!0,this.lockCount--,this.lockCount===0&&(this.currentContext=null))}}let i=this.queue,s,n=new Promise(l=>{s=l});this.queue=n;let a=(async()=>{await i,this.isLocked=!0,this.currentContext=t,this.lockCount=1})();if(e>0){let l,c=new Promise((d,p)=>{l=setTimeout(()=>{p(new Error(`Mutex Timeout: Failed to acquire ${this.name} in ${e}ms`))},e)});try{await Promise.race([a,c])}catch(d){throw s(),d}finally{clearTimeout(l)}}else await a;let o=!1;return()=>{o||(o=!0,this.lockCount--,this.lockCount===0&&(this.isLocked=!1,this.currentContext=null,s()))}}get locked(){return this.isLocked}};var e0=class{constructor(e){this.options=e;this.toolRegistry=new Ff,this.options.toolRegistrar(this.toolRegistry,this.options.automationService),this.initPromise=this.initialize()}provider;lastProviderKey;toolRegistry;currentSessionId="default";messages=[];sequenceNumber=0;abortController=null;currentRun;initPromise;pendingApprovals=new Map;processingMutex=new Ud("ProcessingLock");persistenceMutex=new Ud("PersistenceLock");onStateChangedCallbacks=[];async initialize(){this.currentSessionId=await this.options.sessionStore.getCurrentSessionId()||"default",await this.loadHistory()}async ensureInitialized(){await this.initPromise}createProvider(e){let t=e,i=this.options.config.getApiKey(t)||"";return this.options.providerFactory(t,i)}initializeProvider(){let e=this.options.config.getAiProvider(),t=this.options.config.getApiKey(e)||"",i=`${e}:${t}`;this.provider&&this.lastProviderKey===i||(this.lastProviderKey=i,this.provider=this.options.providerFactory(e,t))}async loadHistory(){let e=await this.options.sessionStore.getSessions();this.messages=e[this.currentSessionId]||[]}onStateChanged(e){return this.onStateChangedCallbacks.push(e),()=>{this.onStateChangedCallbacks=this.onStateChangedCallbacks.filter(t=>t!==e)}}emitStateChanged(){let e={messages:[...this.messages],currentSessionId:this.currentSessionId,sequenceNumber:++this.sequenceNumber};for(let t of this.onStateChangedCallbacks)try{t(e)}catch(i){console.error("[MarieRuntime] Error in state change callback",i)}}async saveHistoryInternal(e,t,i){this.messages.length>50&&(this.messages=this.messages.slice(this.messages.length-50));let s=t||this.currentSessionId,n=await this.options.sessionStore.getSessions(),a=s===this.currentSessionId,o=i?!0:a;s===this.currentSessionId&&o?n[s]=this.messages:n[s]||(n[s]=[]),await this.options.sessionStore.saveSessions(n);let l=await this.options.sessionStore.getSessionMetadata(),c=l.findIndex(h=>h.id===s),d=s===this.currentSessionId?this.messages:n[s],p=d&&d.length>0?d[0].content:"",m=d&&d.length>0?this.generateSessionTitle(p):"New Session";c>=0?(l[c].lastModified=Date.now(),l[c].title==="New Session"&&(l[c].title=m)):s!=="default"&&l.unshift({id:s,title:m,lastModified:Date.now(),isPinned:!1}),await this.options.sessionStore.saveSessionMetadata(l),s===this.currentSessionId&&await this.options.sessionStore.setCurrentSessionId(s),e!==void 0&&await this.options.sessionStore.setLastTelemetry(e===null?void 0:e),s===this.currentSessionId&&this.emitStateChanged()}async saveHistory(e,t,i){let s=await this.persistenceMutex.acquire();try{await this.saveHistoryInternal(e,t,i)}finally{s()}}generateSessionTitle(e){let i=_l.wrap(e).getText(),s=i.match(/(?:Goal|Objective|Task):\s*([^\n.]+)/i);if(s&&s[1].trim())return this.formatTitle(s[1].trim());let n=i.split(`
1054
- `).map(o=>o.trim()).filter(o=>o.length>5);if(n.length>0&&n[0].length<60)return this.formatTitle(n[0]);let a=i.trim()||"New Session";return this.formatTitle(a)}formatTitle(e){let t=e.replace(/^[#\-*\s]+/,"").trim();return t.length>30?t.substring(0,27)+"...":t||"New Session"}async createSession(){await this.ensureInitialized();let e=await this.persistenceMutex.acquire();try{return this.currentSessionId=`session_${Date.now()}`,this.messages=[],await this.saveHistoryInternal(),this.currentSessionId}finally{e()}}async listSessions(){return await this.ensureInitialized(),this.options.sessionStore.getSessionMetadata()}async loadSession(e){await this.ensureInitialized();let t=await this.persistenceMutex.acquire();try{return this.stopGeneration(),this.currentSessionId=e,await this.loadHistory(),await this.options.sessionStore.setCurrentSessionId(e),this.emitStateChanged(),this.currentSessionId}finally{t()}}async deleteSession(e){await this.ensureInitialized();let t,i=!1,s=!1,n=await this.persistenceMutex.acquire();try{this.currentSessionId===e&&this.stopGeneration();let a=await this.options.sessionStore.getSessions();delete a[e],await this.options.sessionStore.saveSessions(a);let l=(await this.options.sessionStore.getSessionMetadata()).filter(c=>c.id!==e);await this.options.sessionStore.saveSessionMetadata(l),this.currentSessionId===e&&(l.length>0?(i=!0,t=l[0].id):s=!0),i&&t?(this.currentSessionId=t,await this.loadHistory(),await this.options.sessionStore.setCurrentSessionId(this.currentSessionId),this.emitStateChanged()):s&&(this.currentSessionId=`session_${Date.now()}`,this.messages=[],await this.saveHistoryInternal())}finally{n()}}async renameSession(e,t){let i=await this.persistenceMutex.acquire();try{await this.ensureInitialized();let s=await this.options.sessionStore.getSessionMetadata(),n=s.findIndex(a=>a.id===e);n>=0&&(s[n].title=t,await this.options.sessionStore.saveSessionMetadata(s),this.emitStateChanged())}finally{i()}}async togglePinSession(e){let t=await this.persistenceMutex.acquire();try{await this.ensureInitialized();let i=await this.options.sessionStore.getSessionMetadata(),s=i.findIndex(n=>n.id===e);s>=0&&(i[s].isPinned=!i[s].isPinned,await this.options.sessionStore.saveSessionMetadata(i),this.emitStateChanged())}finally{t()}}async handleMessage(e,t){let i,s=0,n=3;for(;s<n;)try{i=await this.processingMutex.acquire(1e4);break}catch{if(s++,s>=n)return"Error: System is currently busy with another task. Please wait a moment and try again. (Mutex Timeout)";console.warn(`[MarieRuntime] Mutex acquisition attempt ${s} failed, retrying...`),await new Promise(o=>setTimeout(o,1e3))}try{if(await this.ensureInitialized(),this.initializeProvider(),!this.provider)return"Please configure your API key for the selected provider.";let a=await this.options.sessionStore.getLastTelemetry(),o=this.currentSessionId,l={runId:`run_${Date.now()}`,startedAt:Date.now(),steps:0,tools:0,objectives:[{id:"understand_request",label:"Understand request",status:"in_progress"},{id:"execute_plan",label:"Execute plan",status:"pending"},{id:"deliver_result",label:"Deliver result",status:"pending"}],activeObjectiveId:"understand_request",achieved:[],currentPass:a?.currentPass,totalPasses:a?.totalPasses,passFocus:a?.passFocus,isResuming:!!a,originatingSessionId:o},c=new Zf({...t,onStream:h=>t?.onStream?.(h,l.runId,o),onTool:h=>t?.onTool?.(h,l.runId,o),onToolDelta:h=>t?.onToolDelta?.(h,l.runId,o),onEvent:h=>{h.originatingSessionId=o,(h.type==="progress_update"||h.type==="session_persistence_update"||h.type==="file_stream_delta")&&this.options.onProgressEvent?.(h),t?.onEvent?.(h)}},l);this.currentRun=l,this.options.automationService.setCurrentRun(l);let d=async(h,f,w)=>{if(this.options.shouldBypassApprovals?.())return!0;let b={id:`approval_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,toolName:h,toolInput:f,diff:w};if(!!!(t?.onApprovalRequest||this.options.onApprovalRequest))return!0;let S=new Promise(y=>{this.pendingApprovals.set(b.id,{resolve:y,toolName:h,timestamp:Date.now()})});return t?.onApprovalRequest?.(b,l.runId,o),this.options.onApprovalRequest&&this.options.onApprovalRequest(b).then(y=>{this.resolveApproval(b.id,y)}),S},p=new zd(this.provider,this.toolRegistry,d,this.createProvider.bind(this),this.options.fs,this.options.ghostPort);c.emitEvent({type:"run_started",runId:l.runId,startedAt:l.startedAt}),c.emitProgressUpdate("Thinking..."),this.messages.push({role:"user",content:e,timestamp:Date.now()}),await this.saveHistory(),this.abortController&&this.abortController.abort(),this.abortController=new AbortController;let m=Date.now();try{let h=await p.chatLoop(this.messages,c,f=>this.saveHistory(f,o,m),this.abortController.signal);if(this.messages.length>=6&&this.messages.length<=10){let w=(await this.options.sessionStore.getSessionMetadata()).find(b=>b.id===this.currentSessionId);w&&(w.title==="New Session"||w.title.length>50)&&this.summarizeSession(this.currentSessionId).catch(console.error)}return h}catch(h){return c.emitEvent({type:"run_error",runId:l.runId,elapsedMs:c.elapsedMs(),message:String(h)}),`Error: ${h}`}}finally{this.abortController=null,this.currentRun=void 0,i&&i()}}async summarizeSession(e){if(this.initializeProvider(),!this.provider)return;let i=(await this.options.sessionStore.getSessions())[e]||[];if(i.length<2)return;let s=new zd(this.provider,this.toolRegistry,async()=>!0),n="Based on our conversation so far, generate a very concise (3-5 words) and descriptive title for this session. Respond ONLY with the title. No quotes, no intro.";try{let a=await s.chatLoop([...i,{role:"user",content:n}],{emitProgressUpdate:()=>{},emitEvent:()=>{}},async()=>{});if(a&&typeof a=="string"&&a.length<60)await this.renameSession(e,a.trim().replace(/^"|"$/g,""));else if(a&&String(a).length<60){let c=Ut.extractText(a).trim();await this.renameSession(e,c.replace(/^"|"$/g,""))}let l=await s.chatLoop([...i,{role:"user",content:"Extract 3-5 key structured facts or entities from our conversation. Format each as 'Entity | Fact'. One per line. Only output the facts."}],{emitProgressUpdate:()=>{},emitEvent:()=>{}},async()=>{});if(l){let c=await Q.getInstance(),d=l.split(`
1055
- `).filter(p=>p.includes("|"));for(let p of d){let[m,h]=p.split("|").map(f=>f.trim());m&&h&&await c.agent.cortex.knowledge.distill(m,h,.8,e,["automated-distillation"])}console.log(`[MarieRuntime] Distilled ${d.length} facts from session ${e}`);try{await c.agent.cortex.hive.broadcastKnowledge(),await c.agent.cortex.hive.broadcastSkills();let p=await c.agent.cortex.refiner.refineActions();p.length>0&&console.log(`[MarieRuntime] ActionRefiner proposed ${p.length} improvements.`),await c.agent.cortex.ablation.pruneZombies(30);try{let m=await c.agent.cortex.episodes.getSessionEpisodes(e,{limit:1});m.length>0&&m[0].status==="active"&&await c.agent.cortex.episodes.completeEpisode(m[0].id,`Session concluded with ${d.length} facts distilled. Overall success in objective: ${name}.`)}catch(m){console.warn("[MarieRuntime] Narrative completion failed",m)}try{let m=await c.agent.cortex.reasoner.detectContradictions();m.length>0&&console.warn(`[MarieRuntime] \u26A0\uFE0F LOGICAL PARADOXES DETECTED:
1056
- - ${m.join(`
1057
- - `)}`);let h=await c.agent.cortex.reasoner.synthesizeLessons(),f=Object.values(h).reduce((w,b)=>w+b.length,0);console.log(`[MarieRuntime] Recursive synthesis complete. Clustered ${f} lessons across your history.`)}catch(m){console.warn("[MarieRuntime] Recursive reasoning failed",m)}console.log(`[MarieRuntime] Phase 3 Recursive Consciousness complete for session ${e}`);try{if(V.getAutonomyMode()==="ascension"){console.log("[MarieRuntime] Initiating autonomous ablation experiment...");let h=await c.agent.cortex.ablation.db.selectFrom(c.agent.cortex.ablation.knowledgeTable).select("id").limit(1).executeTakeFirst();h&&await c.agent.cortex.ablation.testAblation(h.id)}}catch(m){console.warn("[MarieRuntime] Ablation experiment failed",m)}console.log(`[MarieRuntime] Phase 4 Sovereign Reliability pass complete for session ${e}`)}catch(p){console.warn("[MarieRuntime] Phase 4 Pass failed",p)}}}catch(a){console.error("Failed to summarize or distill session",a)}}async clearCurrentSession(){await this.ensureInitialized(),this.messages=[],await this.saveHistory()}stopGeneration(){this.abortController&&(this.abortController.abort(),this.abortController=null)}updateSettings(){this.initializeProvider()}async getModels(){return await this.ensureInitialized(),this.initializeProvider(),this.provider?.listModels()||[]}getMessages(){return this.messages}getCurrentSessionId(){return this.currentSessionId}getSequenceNumber(){return this.sequenceNumber}getCurrentRun(){return this.currentRun}resolveApproval(e,t){let i=this.pendingApprovals.get(e);return i?(this.pendingApprovals.delete(e),i.resolve(t),!0):!1}dispose(){this.stopGeneration(),this.options.automationService.dispose?.()}};function P(r,e,t,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t}function T(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)}var Aw=function(){let{crypto:r}=globalThis;if(r?.randomUUID)return Aw=r.randomUUID.bind(r),r.randomUUID();let e=new Uint8Array(1),t=r?()=>r.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^t()&15>>+i/4).toString(16))};function is(r){return typeof r=="object"&&r!==null&&("name"in r&&r.name==="AbortError"||"message"in r&&String(r.message).includes("FetchRequestCanceledException"))}var jd=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null){try{if(Object.prototype.toString.call(r)==="[object Error]"){let e=new Error(r.message,r.cause?{cause:r.cause}:{});return r.stack&&(e.stack=r.stack),r.cause&&!e.cause&&(e.cause=r.cause),r.name&&(e.name=r.name),e}}catch{}try{return new Error(JSON.stringify(r))}catch{}}return new Error(r)};var L=class extends Error{},pt=class r extends L{constructor(e,t,i,s){super(`${r.makeMessage(e,t,i)}`),this.status=e,this.headers=s,this.requestID=s?.get("request-id"),this.error=t}static makeMessage(e,t,i){let s=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):i;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,i,s){if(!e||!s)return new an({message:i,cause:jd(t)});let n=t;return e===400?new Rl(e,n,i,s):e===401?new Ml(e,n,i,s):e===403?new kl(e,n,i,s):e===404?new Il(e,n,i,s):e===409?new Pl(e,n,i,s):e===422?new Ol(e,n,i,s):e===429?new Dl(e,n,i,s):e>=500?new $l(e,n,i,s):new r(e,n,i,s)}},Et=class extends pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},an=class extends pt{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},Al=class extends an{constructor({message:e}={}){super({message:e??"Request timed out."})}},Rl=class extends pt{},Ml=class extends pt{},kl=class extends pt{},Il=class extends pt{},Pl=class extends pt{},Ol=class extends pt{},Dl=class extends pt{},$l=class extends pt{};var oD=/^[a-z][a-z0-9+.-]*:/i,r_=r=>oD.test(r),Rw=r=>(Rw=Array.isArray,Rw(r)),Mw=Rw;function t0(r){return typeof r!="object"?{}:r??{}}function i_(r){if(!r)return!0;for(let e in r)return!1;return!0}function s_(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var n_=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new L(`${r} must be an integer`);if(e<0)throw new L(`${r} must be a positive integer`);return e};var r0=r=>{try{return JSON.parse(r)}catch{return}};var a_=r=>new Promise(e=>setTimeout(e,r));var on="0.73.0";var d_=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function lD(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var cD=()=>{let r=lD();if(r==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":on,"X-Stainless-OS":l_(Deno.build.os),"X-Stainless-Arch":o_(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":on,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(r==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":on,"X-Stainless-OS":l_(globalThis.process.platform??"unknown"),"X-Stainless-Arch":o_(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=dD();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":on,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":on,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function dD(){if(typeof navigator>"u"||!navigator)return null;let r=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of r){let i=t.exec(navigator.userAgent);if(i){let s=i[1]||0,n=i[2]||0,a=i[3]||0;return{browser:e,version:`${s}.${n}.${a}`}}}return null}var o_=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",l_=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),c_,p_=()=>c_??(c_=cD());function u_(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function kw(...r){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...r)}function i0(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator]();return kw({start(){},async pull(t){let{done:i,value:s}=await e.next();i?t.close():t.enqueue(s)},async cancel(){await e.return?.()}})}function Vd(r){if(r[Symbol.asyncIterator])return r;let e=r.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function m_(r){if(r===null||typeof r!="object")return;if(r[Symbol.asyncIterator]){await r[Symbol.asyncIterator]().return?.();return}let e=r.getReader(),t=e.cancel();e.releaseLock(),await t}var h_=({headers:r,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});function y_(r){let e=0;for(let s of r)e+=s.length;let t=new Uint8Array(e),i=0;for(let s of r)t.set(s,i),i+=s.length;return t}var f_;function Hd(r){let e;return(f_??(e=new globalThis.TextEncoder,f_=e.encode.bind(e)))(r)}var g_;function Iw(r){let e;return(g_??(e=new globalThis.TextDecoder,g_=e.decode.bind(e)))(r)}var yr,wr,ss=class{constructor(){yr.set(this,void 0),wr.set(this,void 0),P(this,yr,new Uint8Array,"f"),P(this,wr,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Hd(e):e;P(this,yr,y_([T(this,yr,"f"),t]),"f");let i=[],s;for(;(s=mD(T(this,yr,"f"),T(this,wr,"f")))!=null;){if(s.carriage&&T(this,wr,"f")==null){P(this,wr,s.index,"f");continue}if(T(this,wr,"f")!=null&&(s.index!==T(this,wr,"f")+1||s.carriage)){i.push(Iw(T(this,yr,"f").subarray(0,T(this,wr,"f")-1))),P(this,yr,T(this,yr,"f").subarray(T(this,wr,"f")),"f"),P(this,wr,null,"f");continue}let n=T(this,wr,"f")!==null?s.preceding-1:s.preceding,a=Iw(T(this,yr,"f").subarray(0,n));i.push(a),P(this,yr,T(this,yr,"f").subarray(s.index),"f"),P(this,wr,null,"f")}return i}flush(){return T(this,yr,"f").length?this.decode(`
1058
- `):[]}};yr=new WeakMap,wr=new WeakMap;ss.NEWLINE_CHARS=new Set([`
1059
- `,"\r"]);ss.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function mD(r,e){for(let s=e??0;s<r.length;s++){if(r[s]===10)return{preceding:s,index:s+1,carriage:!1};if(r[s]===13)return{preceding:s,index:s+1,carriage:!0}}return null}function w_(r){for(let i=0;i<r.length-1;i++){if(r[i]===10&&r[i+1]===10||r[i]===13&&r[i+1]===13)return i+2;if(r[i]===13&&r[i+1]===10&&i+3<r.length&&r[i+2]===13&&r[i+3]===10)return i+4}return-1}var n0={off:0,error:200,warn:300,info:400,debug:500},Pw=(r,e,t)=>{if(r){if(s_(n0,r))return r;ut(t).warn(`${e} was set to ${JSON.stringify(r)}, expected one of ${JSON.stringify(Object.keys(n0))}`)}};function Qd(){}function s0(r,e,t){return!e||n0[r]>n0[t]?Qd:e[r].bind(e)}var hD={error:Qd,warn:Qd,info:Qd,debug:Qd},b_=new WeakMap;function ut(r){let e=r.logger,t=r.logLevel??"off";if(!e)return hD;let i=b_.get(e);if(i&&i[0]===t)return i[1];let s={error:s0("error",e,t),warn:s0("warn",e,t),info:s0("info",e,t),debug:s0("debug",e,t)};return b_.set(e,[t,s]),s}var ns=r=>(r.options&&(r.options={...r.options},delete r.options.headers),r.headers&&(r.headers=Object.fromEntries((r.headers instanceof Headers?[...r.headers]:Object.entries(r.headers)).map(([e,t])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":t]))),"retryOfRequestLogID"in r&&(r.retryOfRequestLogID&&(r.retryOf=r.retryOfRequestLogID),delete r.retryOfRequestLogID),r);var Gd,Ci=class r{constructor(e,t,i){this.iterator=e,Gd.set(this,void 0),this.controller=t,P(this,Gd,i,"f")}static fromSSEResponse(e,t,i){let s=!1,n=i?ut(i):console;async function*a(){if(s)throw new L("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let o=!1;try{for await(let l of fD(e,t)){if(l.event==="completion")try{yield JSON.parse(l.data)}catch(c){throw n.error("Could not parse message into JSON:",l.data),n.error("From chunk:",l.raw),c}if(l.event==="message_start"||l.event==="message_delta"||l.event==="message_stop"||l.event==="content_block_start"||l.event==="content_block_delta"||l.event==="content_block_stop")try{yield JSON.parse(l.data)}catch(c){throw n.error("Could not parse message into JSON:",l.data),n.error("From chunk:",l.raw),c}if(l.event!=="ping"&&l.event==="error")throw new pt(void 0,r0(l.data)??l.data,void 0,e.headers)}o=!0}catch(l){if(is(l))return;throw l}finally{o||t.abort()}}return new r(a,t,i)}static fromReadableStream(e,t,i){let s=!1;async function*n(){let o=new ss,l=Vd(e);for await(let c of l)for(let d of o.decode(c))yield d;for(let c of o.flush())yield c}async function*a(){if(s)throw new L("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let o=!1;try{for await(let l of n())o||l&&(yield JSON.parse(l));o=!0}catch(l){if(is(l))return;throw l}finally{o||t.abort()}}return new r(a,t,i)}[(Gd=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],i=this.iterator(),s=n=>({next:()=>{if(n.length===0){let a=i.next();e.push(a),t.push(a)}return n.shift()}});return[new r(()=>s(e),this.controller,T(this,Gd,"f")),new r(()=>s(t),this.controller,T(this,Gd,"f"))]}toReadableStream(){let e=this,t;return kw({async start(){t=e[Symbol.asyncIterator]()},async pull(i){try{let{value:s,done:n}=await t.next();if(n)return i.close();let a=Hd(JSON.stringify(s)+`
1060
- `);i.enqueue(a)}catch(s){i.error(s)}},async cancel(){await t.return?.()}})}};async function*fD(r,e){if(!r.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new L("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new L("Attempted to iterate over a response with no body");let t=new Ow,i=new ss,s=Vd(r.body);for await(let n of gD(s))for(let a of i.decode(n)){let o=t.decode(a);o&&(yield o)}for(let n of i.flush()){let a=t.decode(n);a&&(yield a)}}async function*gD(r){let e=new Uint8Array;for await(let t of r){if(t==null)continue;let i=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?Hd(t):t,s=new Uint8Array(e.length+i.length);s.set(e),s.set(i,e.length),e=s;let n;for(;(n=w_(e))!==-1;)yield e.slice(0,n),e=e.slice(n)}e.length>0&&(yield e)}var Ow=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let n={event:this.event,data:this.data.join(`
1061
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],n}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,i,s]=yD(e,":");return s.startsWith(" ")&&(s=s.substring(1)),t==="event"?this.event=s:t==="data"&&this.data.push(s),null}};function yD(r,e){let t=r.indexOf(e);return t!==-1?[r.substring(0,t),e,r.substring(t+e.length)]:[r,"",""]}async function a0(r,e){let{response:t,requestLogID:i,retryOfRequestLogID:s,startTime:n}=e,a=await(async()=>{if(e.options.stream)return ut(r).debug("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller):Ci.fromSSEResponse(t,e.controller);if(t.status===204)return null;if(e.options.__binaryResponse)return t;let l=t.headers.get("content-type")?.split(";")[0]?.trim();if(l?.includes("application/json")||l?.endsWith("+json")){if(t.headers.get("content-length")==="0")return;let m=await t.json();return Dw(m,t)}return await t.text()})();return ut(r).debug(`[${i}] response parsed`,ns({retryOfRequestLogID:s,url:t.url,status:t.status,body:a,durationMs:Date.now()-n})),a}function Dw(r,e){return!r||typeof r!="object"||Array.isArray(r)?r:Object.defineProperty(r,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var Kd,aa=class r extends Promise{constructor(e,t,i=a0){super(s=>{s(null)}),this.responsePromise=t,this.parseResponse=i,Kd.set(this,void 0),P(this,Kd,e,"f")}_thenUnwrap(e){return new r(T(this,Kd,"f"),this.responsePromise,async(t,i)=>Dw(e(await this.parseResponse(t,i),i),i.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(T(this,Kd,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Kd=new WeakMap;var o0,l0=class{constructor(e,t,i,s){o0.set(this,void 0),P(this,o0,e,"f"),this.options=s,this.response=t,this.body=i}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new L("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await T(this,o0,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(o0=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},Jd=class extends aa{constructor(e,t,i){super(e,t,async(s,n)=>new i(s,n.response,await a0(s,n),n.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},kr=class extends l0{constructor(e,t,i,s){super(e,t,i,s),this.data=i.data||[],this.has_more=i.has_more||!1,this.first_id=i.first_id||null,this.last_id=i.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let t=this.first_id;return t?{...this.options,query:{...t0(this.options.query),before_id:t}}:null}let e=this.last_id;return e?{...this.options,query:{...t0(this.options.query),after_id:e}}:null}};var Fl=class extends l0{constructor(e,t,i,s){super(e,t,i,s),this.data=i.data||[],this.has_more=i.has_more||!1,this.next_page=i.next_page||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.next_page;return e?{...this.options,query:{...t0(this.options.query),page:e}}:null}};var Fw=()=>{if(typeof File>"u"){let{process:r}=globalThis,e=typeof r?.versions?.node=="string"&&parseInt(r.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function oa(r,e,t){return Fw(),new File(r,e??"unknown_file",t)}function Xd(r,e){let t=typeof r=="object"&&r!==null&&("name"in r&&r.name&&String(r.name)||"url"in r&&r.url&&String(r.url)||"filename"in r&&r.filename&&String(r.filename)||"path"in r&&r.path&&String(r.path))||"";return e?t.split(/[\\/]/).pop()||void 0:t}var Lw=r=>r!=null&&typeof r=="object"&&typeof r[Symbol.asyncIterator]=="function";var Ll=async(r,e,t=!0)=>({...r,body:await vD(r.body,e,t)}),v_=new WeakMap;function bD(r){let e=typeof r=="function"?r:r.fetch,t=v_.get(e);if(t)return t;let i=(async()=>{try{let s="Response"in e?e.Response:(await e("data:,")).constructor,n=new FormData;return n.toString()!==await new s(n).text()}catch{return!0}})();return v_.set(e,i),i}var vD=async(r,e,t=!0)=>{if(!await bD(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let i=new FormData;return await Promise.all(Object.entries(r||{}).map(([s,n])=>$w(i,s,n,t))),i},SD=r=>r instanceof Blob&&"name"in r;var $w=async(r,e,t,i)=>{if(t!==void 0){if(t==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")r.append(e,String(t));else if(t instanceof Response){let s={},n=t.headers.get("Content-Type");n&&(s={type:n}),r.append(e,oa([await t.blob()],Xd(t,i),s))}else if(Lw(t))r.append(e,oa([await new Response(i0(t)).blob()],Xd(t,i)));else if(SD(t))r.append(e,oa([t],Xd(t,i),{type:t.type}));else if(Array.isArray(t))await Promise.all(t.map(s=>$w(r,e+"[]",s,i)));else if(typeof t=="object")await Promise.all(Object.entries(t).map(([s,n])=>$w(r,`${e}[${s}]`,n,i)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)}};var S_=r=>r!=null&&typeof r=="object"&&typeof r.size=="number"&&typeof r.type=="string"&&typeof r.text=="function"&&typeof r.slice=="function"&&typeof r.arrayBuffer=="function",xD=r=>r!=null&&typeof r=="object"&&typeof r.name=="string"&&typeof r.lastModified=="number"&&S_(r),TD=r=>r!=null&&typeof r=="object"&&typeof r.url=="string"&&typeof r.blob=="function";async function c0(r,e,t){if(Fw(),r=await r,e||(e=Xd(r,!0)),xD(r))return r instanceof File&&e==null&&t==null?r:oa([await r.arrayBuffer()],e??r.name,{type:r.type,lastModified:r.lastModified,...t});if(TD(r)){let s=await r.blob();return e||(e=new URL(r.url).pathname.split(/[\\/]/).pop()),oa(await qw(s),e,t)}let i=await qw(r);if(!t?.type){let s=i.find(n=>typeof n=="object"&&"type"in n&&n.type);typeof s=="string"&&(t={...t,type:s})}return oa(i,e,t)}async function qw(r){let e=[];if(typeof r=="string"||ArrayBuffer.isView(r)||r instanceof ArrayBuffer)e.push(r);else if(S_(r))e.push(r instanceof Blob?r:await r.arrayBuffer());else if(Lw(r))for await(let t of r)e.push(...await qw(t));else{let t=r?.constructor?.name;throw new Error(`Unexpected data type: ${typeof r}${t?`; constructor: ${t}`:""}${_D(r)}`)}return e}function _D(r){return typeof r!="object"||r===null?"":`; props: [${Object.getOwnPropertyNames(r).map(t=>`"${t}"`).join(", ")}]`}var Ae=class{constructor(e){this._client=e}};var x_=Symbol.for("brand.privateNullableHeaders");function*ND(r){if(!r)return;if(x_ in r){let{values:i,nulls:s}=r;yield*i.entries();for(let n of s)yield[n,null];return}let e=!1,t;r instanceof Headers?t=r.entries():Mw(r)?t=r:(e=!0,t=Object.entries(r??{}));for(let i of t){let s=i[0];if(typeof s!="string")throw new TypeError("expected header name to be a string");let n=Mw(i[1])?i[1]:[i[1]],a=!1;for(let o of n)o!==void 0&&(e&&!a&&(a=!0,yield[s,null]),yield[s,o])}}var J=r=>{let e=new Headers,t=new Set;for(let i of r){let s=new Set;for(let[n,a]of ND(i)){let o=n.toLowerCase();s.has(o)||(e.delete(n),s.add(o)),a===null?(e.delete(n),t.add(o)):(e.append(n,a),t.delete(o))}}return{[x_]:!0,values:e,nulls:t}};var Yd=Symbol("anthropic.sdk.stainlessHelper");function d0(r){return typeof r=="object"&&r!==null&&Yd in r}function Bw(r,e){let t=new Set;if(r)for(let i of r)d0(i)&&t.add(i[Yd]);if(e){for(let i of e)if(d0(i)&&t.add(i[Yd]),Array.isArray(i.content))for(let s of i.content)d0(s)&&t.add(s[Yd])}return Array.from(t)}function p0(r,e){let t=Bw(r,e);return t.length===0?{}:{"x-stainless-helper":t.join(", ")}}function T_(r){return d0(r)?{"x-stainless-helper":r[Yd]}:{}}function E_(r){return r.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var __=Object.freeze(Object.create(null)),CD=(r=E_)=>function(t,...i){if(t.length===1)return t[0];let s=!1,n=[],a=t.reduce((d,p,m)=>{/[?#]/.test(p)&&(s=!0);let h=i[m],f=(s?encodeURIComponent:r)(""+h);return m!==i.length&&(h==null||typeof h=="object"&&h.toString===Object.getPrototypeOf(Object.getPrototypeOf(h.hasOwnProperty??__)??__)?.toString)&&(f=h+"",n.push({start:d.length+p.length,length:f.length,error:`Value of type ${Object.prototype.toString.call(h).slice(8,-1)} is not a valid path parameter`})),d+p+(m===i.length?"":f)},""),o=a.split(/[?#]/,1)[0],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=l.exec(o))!==null;)n.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(n.sort((d,p)=>d.start-p.start),n.length>0){let d=0,p=n.reduce((m,h)=>{let f=" ".repeat(h.start-d),w="^".repeat(h.length);return d=h.start+h.length,m+f+w},"");throw new L(`Path parameters result in path with invalid segments:
1062
- ${n.map(m=>m.error).join(`
1063
- `)}
1064
- ${a}
1065
- ${p}`)}return a},Re=CD(E_);var ql=class extends Ae{list(e={},t){let{betas:i,...s}=e??{};return this._client.getAPIList("/v1/files",kr,{query:s,...t,headers:J([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},i){let{betas:s}=t??{};return this._client.delete(Re`/v1/files/${e}`,{...i,headers:J([{"anthropic-beta":[...s??[],"files-api-2025-04-14"].toString()},i?.headers])})}download(e,t={},i){let{betas:s}=t??{};return this._client.get(Re`/v1/files/${e}/content`,{...i,headers:J([{"anthropic-beta":[...s??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},i?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},i){let{betas:s}=t??{};return this._client.get(Re`/v1/files/${e}`,{...i,headers:J([{"anthropic-beta":[...s??[],"files-api-2025-04-14"].toString()},i?.headers])})}upload(e,t){let{betas:i,...s}=e;return this._client.post("/v1/files",Ll({body:s,...t,headers:J([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},T_(s.file),t?.headers])},this._client))}};var Bl=class extends Ae{retrieve(e,t={},i){let{betas:s}=t??{};return this._client.get(Re`/v1/models/${e}?beta=true`,{...i,headers:J([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},i?.headers])})}list(e={},t){let{betas:i,...s}=e??{};return this._client.getAPIList("/v1/models?beta=true",kr,{query:s,...t,headers:J([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}};var u0={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function N_(r){return r?.output_format??r?.output_config?.format}function Ww(r,e,t){let i=N_(e);return!e||!("parse"in(i??{}))?{...r,content:r.content.map(s=>{if(s.type==="text"){let n=Object.defineProperty({...s},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(n,"parsed",{get(){return t.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return s}),parsed_output:null}:zw(r,e,t)}function zw(r,e,t){let i=null,s=r.content.map(n=>{if(n.type==="text"){let a=MD(e,n.text);i===null&&(i=a);let o=Object.defineProperty({...n},"parsed_output",{value:a,enumerable:!1});return Object.defineProperty(o,"parsed",{get(){return t.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),a},enumerable:!1})}return n});return{...r,content:s,parsed_output:i}}function MD(r,e){let t=N_(r);if(t?.type!=="json_schema")return null;try{return"parse"in t?t.parse(e):JSON.parse(e)}catch(i){throw new L(`Failed to parse structured output: ${i}`)}}var kD=r=>{let e=0,t=[];for(;e<r.length;){let i=r[e];if(i==="\\"){e++;continue}if(i==="{"){t.push({type:"brace",value:"{"}),e++;continue}if(i==="}"){t.push({type:"brace",value:"}"}),e++;continue}if(i==="["){t.push({type:"paren",value:"["}),e++;continue}if(i==="]"){t.push({type:"paren",value:"]"}),e++;continue}if(i===":"){t.push({type:"separator",value:":"}),e++;continue}if(i===","){t.push({type:"delimiter",value:","}),e++;continue}if(i==='"'){let o="",l=!1;for(i=r[++e];i!=='"';){if(e===r.length){l=!0;break}if(i==="\\"){if(e++,e===r.length){l=!0;break}o+=i+r[e],i=r[++e]}else o+=i,i=r[++e]}i=r[++e],l||t.push({type:"string",value:o});continue}if(i&&/\s/.test(i)){e++;continue}let n=/[0-9]/;if(i&&n.test(i)||i==="-"||i==="."){let o="";for(i==="-"&&(o+=i,i=r[++e]);i&&n.test(i)||i===".";)o+=i,i=r[++e];t.push({type:"number",value:o});continue}let a=/[a-z]/i;if(i&&a.test(i)){let o="";for(;i&&a.test(i)&&e!==r.length;)o+=i,i=r[++e];if(o=="true"||o=="false"||o==="null")t.push({type:"name",value:o});else{e++;continue}continue}e++}return t},Wl=r=>{if(r.length===0)return r;let e=r[r.length-1];switch(e.type){case"separator":return r=r.slice(0,r.length-1),Wl(r);break;case"number":let t=e.value[e.value.length-1];if(t==="."||t==="-")return r=r.slice(0,r.length-1),Wl(r);case"string":let i=r[r.length-2];if(i?.type==="delimiter")return r=r.slice(0,r.length-1),Wl(r);if(i?.type==="brace"&&i.value==="{")return r=r.slice(0,r.length-1),Wl(r);break;case"delimiter":return r=r.slice(0,r.length-1),Wl(r);break}return r},ID=r=>{let e=[];return r.map(t=>{t.type==="brace"&&(t.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),t.type==="paren"&&(t.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(t=>{t==="}"?r.push({type:"brace",value:"}"}):t==="]"&&r.push({type:"paren",value:"]"})}),r},PD=r=>{let e="";return r.map(t=>{switch(t.type){case"string":e+='"'+t.value+'"';break;default:e+=t.value;break}}),e},m0=r=>JSON.parse(PD(ID(Wl(kD(r)))));var Ir,ln,zl,Zd,h0,ep,tp,f0,rp,as,ip,g0,y0,la,w0,b0,sp,Uw,C_,v0,jw,Vw,Hw,A_,R_="__json_buf";function M_(r){return r.type==="tool_use"||r.type==="server_tool_use"||r.type==="mcp_tool_use"}var S0=class r{constructor(e,t){Ir.add(this),this.messages=[],this.receivedMessages=[],ln.set(this,void 0),zl.set(this,null),this.controller=new AbortController,Zd.set(this,void 0),h0.set(this,()=>{}),ep.set(this,()=>{}),tp.set(this,void 0),f0.set(this,()=>{}),rp.set(this,()=>{}),as.set(this,{}),ip.set(this,!1),g0.set(this,!1),y0.set(this,!1),la.set(this,!1),w0.set(this,void 0),b0.set(this,void 0),sp.set(this,void 0),v0.set(this,i=>{if(P(this,g0,!0,"f"),is(i)&&(i=new Et),i instanceof Et)return P(this,y0,!0,"f"),this._emit("abort",i);if(i instanceof L)return this._emit("error",i);if(i instanceof Error){let s=new L(i.message);return s.cause=i,this._emit("error",s)}return this._emit("error",new L(String(i)))}),P(this,Zd,new Promise((i,s)=>{P(this,h0,i,"f"),P(this,ep,s,"f")}),"f"),P(this,tp,new Promise((i,s)=>{P(this,f0,i,"f"),P(this,rp,s,"f")}),"f"),T(this,Zd,"f").catch(()=>{}),T(this,tp,"f").catch(()=>{}),P(this,zl,e,"f"),P(this,sp,t?.logger??console,"f")}get response(){return T(this,w0,"f")}get request_id(){return T(this,b0,"f")}async withResponse(){P(this,la,!0,"f");let e=await T(this,Zd,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new r(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,i,{logger:s}={}){let n=new r(t,{logger:s});for(let a of t.messages)n._addMessageParam(a);return P(n,zl,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},T(this,v0,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,i){let s=i?.signal,n;s&&(s.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),s.addEventListener("abort",n));try{T(this,Ir,"m",jw).call(this);let{response:a,data:o}=await e.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(a);for await(let l of o)T(this,Ir,"m",Vw).call(this,l);if(o.controller.signal?.aborted)throw new Et;T(this,Ir,"m",Hw).call(this)}finally{s&&n&&s.removeEventListener("abort",n)}}_connected(e){this.ended||(P(this,w0,e,"f"),P(this,b0,e?.headers.get("request-id"),"f"),T(this,h0,"f").call(this,e),this._emit("connect"))}get ended(){return T(this,ip,"f")}get errored(){return T(this,g0,"f")}get aborted(){return T(this,y0,"f")}abort(){this.controller.abort()}on(e,t){return(T(this,as,"f")[e]||(T(this,as,"f")[e]=[])).push({listener:t}),this}off(e,t){let i=T(this,as,"f")[e];if(!i)return this;let s=i.findIndex(n=>n.listener===t);return s>=0&&i.splice(s,1),this}once(e,t){return(T(this,as,"f")[e]||(T(this,as,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{P(this,la,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,t)})}async done(){P(this,la,!0,"f"),await T(this,tp,"f")}get currentMessage(){return T(this,ln,"f")}async finalMessage(){return await this.done(),T(this,Ir,"m",Uw).call(this)}async finalText(){return await this.done(),T(this,Ir,"m",C_).call(this)}_emit(e,...t){if(T(this,ip,"f"))return;e==="end"&&(P(this,ip,!0,"f"),T(this,f0,"f").call(this));let i=T(this,as,"f")[e];if(i&&(T(this,as,"f")[e]=i.filter(s=>!s.once),i.forEach(({listener:s})=>s(...t))),e==="abort"){let s=t[0];!T(this,la,"f")&&!i?.length&&Promise.reject(s),T(this,ep,"f").call(this,s),T(this,rp,"f").call(this,s),this._emit("end");return}if(e==="error"){let s=t[0];!T(this,la,"f")&&!i?.length&&Promise.reject(s),T(this,ep,"f").call(this,s),T(this,rp,"f").call(this,s),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",T(this,Ir,"m",Uw).call(this))}async _fromReadableStream(e,t){let i=t?.signal,s;i&&(i.aborted&&this.controller.abort(),s=this.controller.abort.bind(this.controller),i.addEventListener("abort",s));try{T(this,Ir,"m",jw).call(this),this._connected(null);let n=Ci.fromReadableStream(e,this.controller);for await(let a of n)T(this,Ir,"m",Vw).call(this,a);if(n.controller.signal?.aborted)throw new Et;T(this,Ir,"m",Hw).call(this)}finally{i&&s&&i.removeEventListener("abort",s)}}[(ln=new WeakMap,zl=new WeakMap,Zd=new WeakMap,h0=new WeakMap,ep=new WeakMap,tp=new WeakMap,f0=new WeakMap,rp=new WeakMap,as=new WeakMap,ip=new WeakMap,g0=new WeakMap,y0=new WeakMap,la=new WeakMap,w0=new WeakMap,b0=new WeakMap,sp=new WeakMap,v0=new WeakMap,Ir=new WeakSet,Uw=function(){if(this.receivedMessages.length===0)throw new L("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},C_=function(){if(this.receivedMessages.length===0)throw new L("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(i=>i.type==="text").map(i=>i.text);if(t.length===0)throw new L("stream ended without producing a content block with type=text");return t.join(" ")},jw=function(){this.ended||P(this,ln,void 0,"f")},Vw=function(t){if(this.ended)return;let i=T(this,Ir,"m",A_).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let s=i.content.at(-1);switch(t.delta.type){case"text_delta":{s.type==="text"&&this._emit("text",t.delta.text,s.text||"");break}case"citations_delta":{s.type==="text"&&this._emit("citation",t.delta.citation,s.citations??[]);break}case"input_json_delta":{M_(s)&&s.input&&this._emit("inputJson",t.delta.partial_json,s.input);break}case"thinking_delta":{s.type==="thinking"&&this._emit("thinking",t.delta.thinking,s.thinking);break}case"signature_delta":{s.type==="thinking"&&this._emit("signature",s.signature);break}case"compaction_delta":{s.type==="compaction"&&s.content&&this._emit("compaction",s.content);break}default:t.delta}break}case"message_stop":{this._addMessageParam(i),this._addMessage(Ww(i,T(this,zl,"f"),{logger:T(this,sp,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{P(this,ln,i,"f");break}case"content_block_start":case"message_delta":break}},Hw=function(){if(this.ended)throw new L("stream has ended, this shouldn't happen");let t=T(this,ln,"f");if(!t)throw new L("request ended without sending any chunks");return P(this,ln,void 0,"f"),Ww(t,T(this,zl,"f"),{logger:T(this,sp,"f")})},A_=function(t){let i=T(this,ln,"f");if(t.type==="message_start"){if(i)throw new L(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new L(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":return i.container=t.delta.container,i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.usage.output_tokens=t.usage.output_tokens,i.context_management=t.context_management,t.usage.input_tokens!=null&&(i.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(i.usage.server_tool_use=t.usage.server_tool_use),t.usage.iterations!=null&&(i.usage.iterations=t.usage.iterations),i;case"content_block_start":return i.content.push(t.content_block),i;case"content_block_delta":{let s=i.content.at(t.index);switch(t.delta.type){case"text_delta":{s?.type==="text"&&(i.content[t.index]={...s,text:(s.text||"")+t.delta.text});break}case"citations_delta":{s?.type==="text"&&(i.content[t.index]={...s,citations:[...s.citations??[],t.delta.citation]});break}case"input_json_delta":{if(s&&M_(s)){let n=s[R_]||"";n+=t.delta.partial_json;let a={...s};if(Object.defineProperty(a,R_,{value:n,enumerable:!1,writable:!0}),n)try{a.input=m0(n)}catch(o){let l=new L(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${o}. JSON: ${n}`);T(this,v0,"f").call(this,l)}i.content[t.index]=a}break}case"thinking_delta":{s?.type==="thinking"&&(i.content[t.index]={...s,thinking:s.thinking+t.delta.thinking});break}case"signature_delta":{s?.type==="thinking"&&(i.content[t.index]={...s,signature:t.delta.signature});break}case"compaction_delta":{s?.type==="compaction"&&(i.content[t.index]={...s,content:(s.content||"")+t.delta.content});break}default:t.delta}return i}case"content_block_stop":return i}},Symbol.asyncIterator)](){let e=[],t=[],i=!1;return this.on("streamEvent",s=>{let n=t.shift();n?n.resolve(s):e.push(s)}),this.on("end",()=>{i=!0;for(let s of t)s.resolve(void 0);t.length=0}),this.on("abort",s=>{i=!0;for(let n of t)n.reject(s);t.length=0}),this.on("error",s=>{i=!0;for(let n of t)n.reject(s);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((n,a)=>t.push({resolve:n,reject:a})).then(n=>n?{value:n,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Ci(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var ca=class extends Error{constructor(e){let t=typeof e=="string"?e:e.map(i=>i.type==="text"?i.text:`[${i.type}]`).join(" ");super(t),this.name="ToolError",this.content=e}};var k_=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
1066
- 1. Task Overview
1067
- The user's core request and success criteria
1068
- Any clarifications or constraints they specified
1069
- 2. Current State
1070
- What has been completed so far
1071
- Files created, modified, or analyzed (with paths if relevant)
1072
- Key outputs or artifacts produced
1073
- 3. Important Discoveries
1074
- Technical constraints or requirements uncovered
1075
- Decisions made and their rationale
1076
- Errors encountered and how they were resolved
1077
- What approaches were tried that didn't work (and why)
1078
- 4. Next Steps
1079
- Specific actions needed to complete the task
1080
- Any blockers or open questions to resolve
1081
- Priority order if multiple steps remain
1082
- 5. Context to Preserve
1083
- User preferences or style requirements
1084
- Domain-specific details that aren't obvious
1085
- Any promises made to the user
1086
- Be concise but complete\u2014err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
1087
- Wrap your summary in <summary></summary> tags.`;var np,Ul,da,Ze,ap,br,os,cn,op,I_,Qw;function P_(){let r,e;return{promise:new Promise((i,s)=>{r=i,e=s}),resolve:r,reject:e}}var jl=class{constructor(e,t,i){np.add(this),this.client=e,Ul.set(this,!1),da.set(this,!1),Ze.set(this,void 0),ap.set(this,void 0),br.set(this,void 0),os.set(this,void 0),cn.set(this,void 0),op.set(this,0),P(this,Ze,{params:{...t,messages:structuredClone(t.messages)}},"f");let n=["BetaToolRunner",...Bw(t.tools,t.messages)].join(", ");P(this,ap,{...i,headers:J([{"x-stainless-helper":n},i?.headers])},"f"),P(this,cn,P_(),"f")}async*[(Ul=new WeakMap,da=new WeakMap,Ze=new WeakMap,ap=new WeakMap,br=new WeakMap,os=new WeakMap,cn=new WeakMap,op=new WeakMap,np=new WeakSet,I_=async function(){let t=T(this,Ze,"f").params.compactionControl;if(!t||!t.enabled)return!1;let i=0;if(T(this,br,"f")!==void 0)try{let c=await T(this,br,"f");i=c.usage.input_tokens+(c.usage.cache_creation_input_tokens??0)+(c.usage.cache_read_input_tokens??0)+c.usage.output_tokens}catch{return!1}let s=t.contextTokenThreshold??1e5;if(i<s)return!1;let n=t.model??T(this,Ze,"f").params.model,a=t.summaryPrompt??k_,o=T(this,Ze,"f").params.messages;if(o[o.length-1].role==="assistant"){let c=o[o.length-1];if(Array.isArray(c.content)){let d=c.content.filter(p=>p.type!=="tool_use");d.length===0?o.pop():c.content=d}}let l=await this.client.beta.messages.create({model:n,messages:[...o,{role:"user",content:[{type:"text",text:a}]}],max_tokens:T(this,Ze,"f").params.max_tokens},{headers:{"x-stainless-helper":"compaction"}});if(l.content[0]?.type!=="text")throw new L("Expected text response for compaction");return T(this,Ze,"f").params.messages=[{role:"user",content:l.content}],!0},Symbol.asyncIterator)](){var e;if(T(this,Ul,"f"))throw new L("Cannot iterate over a consumed stream");P(this,Ul,!0,"f"),P(this,da,!0,"f"),P(this,os,void 0,"f");try{for(;;){let t;try{if(T(this,Ze,"f").params.max_iterations&&T(this,op,"f")>=T(this,Ze,"f").params.max_iterations)break;P(this,da,!1,"f"),P(this,os,void 0,"f"),P(this,op,(e=T(this,op,"f"),e++,e),"f"),P(this,br,void 0,"f");let{max_iterations:i,compactionControl:s,...n}=T(this,Ze,"f").params;if(n.stream?(t=this.client.beta.messages.stream({...n},T(this,ap,"f")),P(this,br,t.finalMessage(),"f"),T(this,br,"f").catch(()=>{}),yield t):(P(this,br,this.client.beta.messages.create({...n,stream:!1},T(this,ap,"f")),"f"),yield T(this,br,"f")),!await T(this,np,"m",I_).call(this)){if(!T(this,da,"f")){let{role:l,content:c}=await T(this,br,"f");T(this,Ze,"f").params.messages.push({role:l,content:c})}let o=await T(this,np,"m",Qw).call(this,T(this,Ze,"f").params.messages.at(-1));if(o)T(this,Ze,"f").params.messages.push(o);else if(!T(this,da,"f"))break}}finally{t&&t.abort()}}if(!T(this,br,"f"))throw new L("ToolRunner concluded without a message from the server");T(this,cn,"f").resolve(await T(this,br,"f"))}catch(t){throw P(this,Ul,!1,"f"),T(this,cn,"f").promise.catch(()=>{}),T(this,cn,"f").reject(t),P(this,cn,P_(),"f"),t}}setMessagesParams(e){typeof e=="function"?T(this,Ze,"f").params=e(T(this,Ze,"f").params):T(this,Ze,"f").params=e,P(this,da,!0,"f"),P(this,os,void 0,"f")}async generateToolResponse(){let e=await T(this,br,"f")??this.params.messages.at(-1);return e?T(this,np,"m",Qw).call(this,e):null}done(){return T(this,cn,"f").promise}async runUntilDone(){if(!T(this,Ul,"f"))for await(let e of this);return this.done()}get params(){return T(this,Ze,"f").params}pushMessages(...e){this.setMessagesParams(t=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}};Qw=async function(e){return T(this,os,"f")!==void 0?T(this,os,"f"):(P(this,os,DD(T(this,Ze,"f").params,e),"f"),T(this,os,"f"))};async function DD(r,e=r.messages.at(-1)){if(!e||e.role!=="assistant"||!e.content||typeof e.content=="string")return null;let t=e.content.filter(s=>s.type==="tool_use");return t.length===0?null:{role:"user",content:await Promise.all(t.map(async s=>{let n=r.tools.find(a=>("name"in a?a.name:a.mcp_server_name)===s.name);if(!n||!("run"in n))return{type:"tool_result",tool_use_id:s.id,content:`Error: Tool '${s.name}' not found`,is_error:!0};try{let a=s.input;"parse"in n&&n.parse&&(a=n.parse(a));let o=await n.run(a);return{type:"tool_result",tool_use_id:s.id,content:o}}catch(a){return{type:"tool_result",tool_use_id:s.id,content:a instanceof ca?a.content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var Vl=class r{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new ss;for await(let t of this.iterator)for(let i of e.decode(t))yield JSON.parse(i);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,t){if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new L("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new L("Attempted to iterate over a response with no body");return new r(Vd(e.body),t)}};var Hl=class extends Ae{create(e,t){let{betas:i,...s}=e;return this._client.post("/v1/messages/batches?beta=true",{body:s,...t,headers:J([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},t?.headers])})}retrieve(e,t={},i){let{betas:s}=t??{};return this._client.get(Re`/v1/messages/batches/${e}?beta=true`,{...i,headers:J([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString()},i?.headers])})}list(e={},t){let{betas:i,...s}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",kr,{query:s,...t,headers:J([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},i){let{betas:s}=t??{};return this._client.delete(Re`/v1/messages/batches/${e}?beta=true`,{...i,headers:J([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString()},i?.headers])})}cancel(e,t={},i){let{betas:s}=t??{};return this._client.post(Re`/v1/messages/batches/${e}/cancel?beta=true`,{...i,headers:J([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString()},i?.headers])})}async results(e,t={},i){let s=await this.retrieve(e);if(!s.results_url)throw new L(`No batch \`results_url\`; Has it finished processing? ${s.processing_status} - ${s.id}`);let{betas:n}=t??{};return this._client.get(s.results_url,{...i,headers:J([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},i?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((a,o)=>Vl.fromResponse(o.response,o.controller))}};var O_={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},FD=["claude-opus-4-6"],ls=class extends Ae{constructor(){super(...arguments),this.batches=new Hl(this._client)}create(e,t){let i=D_(e),{betas:s,...n}=i;n.model in O_&&console.warn(`The model '${n.model}' is deprecated and will reach end-of-life on ${O_[n.model]}
1088
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),n.model in FD&&n.thinking&&n.thinking.type==="enabled"&&console.warn(`Using Claude with ${n.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let a=this._client._options.timeout;if(!n.stream&&a==null){let l=u0[n.model]??void 0;a=this._client.calculateNonstreamingTimeout(n.max_tokens,l)}let o=p0(n.tools,n.messages);return this._client.post("/v1/messages?beta=true",{body:n,timeout:a??6e5,...t,headers:J([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},o,t?.headers]),stream:i.stream??!1})}parse(e,t){return t={...t,headers:J([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(e,t).then(i=>zw(i,e,{logger:this._client.logger??console}))}stream(e,t){return S0.createMessage(this,e,t)}countTokens(e,t){let i=D_(e),{betas:s,...n}=i;return this._client.post("/v1/messages/count_tokens?beta=true",{body:n,...t,headers:J([{"anthropic-beta":[...s??[],"token-counting-2024-11-01"].toString()},t?.headers])})}toolRunner(e,t){return new jl(this._client,e,t)}};function D_(r){if(!r.output_format)return r;if(r.output_config?.format)throw new L("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:e,...t}=r;return{...t,output_config:{...r.output_config,format:e}}}ls.Batches=Hl;ls.BetaToolRunner=jl;ls.ToolError=ca;var Ql=class extends Ae{create(e,t={},i){let{betas:s,...n}=t??{};return this._client.post(Re`/v1/skills/${e}/versions?beta=true`,Ll({body:n,...i,headers:J([{"anthropic-beta":[...s??[],"skills-2025-10-02"].toString()},i?.headers])},this._client))}retrieve(e,t,i){let{skill_id:s,betas:n}=t;return this._client.get(Re`/v1/skills/${s}/versions/${e}?beta=true`,{...i,headers:J([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},i?.headers])})}list(e,t={},i){let{betas:s,...n}=t??{};return this._client.getAPIList(Re`/v1/skills/${e}/versions?beta=true`,Fl,{query:n,...i,headers:J([{"anthropic-beta":[...s??[],"skills-2025-10-02"].toString()},i?.headers])})}delete(e,t,i){let{skill_id:s,betas:n}=t;return this._client.delete(Re`/v1/skills/${s}/versions/${e}?beta=true`,{...i,headers:J([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},i?.headers])})}};var pa=class extends Ae{constructor(){super(...arguments),this.versions=new Ql(this._client)}create(e={},t){let{betas:i,...s}=e??{};return this._client.post("/v1/skills?beta=true",Ll({body:s,...t,headers:J([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},t?.headers])},this._client,!1))}retrieve(e,t={},i){let{betas:s}=t??{};return this._client.get(Re`/v1/skills/${e}?beta=true`,{...i,headers:J([{"anthropic-beta":[...s??[],"skills-2025-10-02"].toString()},i?.headers])})}list(e={},t){let{betas:i,...s}=e??{};return this._client.getAPIList("/v1/skills?beta=true",Fl,{query:s,...t,headers:J([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},t?.headers])})}delete(e,t={},i){let{betas:s}=t??{};return this._client.delete(Re`/v1/skills/${e}?beta=true`,{...i,headers:J([{"anthropic-beta":[...s??[],"skills-2025-10-02"].toString()},i?.headers])})}};pa.Versions=Ql;var si=class extends Ae{constructor(){super(...arguments),this.models=new Bl(this._client),this.messages=new ls(this._client),this.files=new ql(this._client),this.skills=new pa(this._client)}};si.Models=Bl;si.Messages=ls;si.Files=ql;si.Skills=pa;var ua=class extends Ae{create(e,t){let{betas:i,...s}=e;return this._client.post("/v1/complete",{body:s,timeout:this._client._options.timeout??6e5,...t,headers:J([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}};function $_(r){return r?.output_config?.format}function Gw(r,e,t){let i=$_(e);return!e||!("parse"in(i??{}))?{...r,content:r.content.map(s=>s.type==="text"?Object.defineProperty({...s},"parsed_output",{value:null,enumerable:!1}):s),parsed_output:null}:Kw(r,e,t)}function Kw(r,e,t){let i=null,s=r.content.map(n=>{if(n.type==="text"){let a=WD(e,n.text);return i===null&&(i=a),Object.defineProperty({...n},"parsed_output",{value:a,enumerable:!1})}return n});return{...r,content:s,parsed_output:i}}function WD(r,e){let t=$_(r);if(t?.type!=="json_schema")return null;try{return"parse"in t?t.parse(e):JSON.parse(e)}catch(i){throw new L(`Failed to parse structured output: ${i}`)}}var Pr,dn,Gl,lp,x0,cp,dp,T0,pp,cs,up,_0,E0,ma,N0,C0,mp,Jw,F_,Xw,Yw,Zw,e9,L_,q_="__json_buf";function B_(r){return r.type==="tool_use"||r.type==="server_tool_use"}var A0=class r{constructor(e,t){Pr.add(this),this.messages=[],this.receivedMessages=[],dn.set(this,void 0),Gl.set(this,null),this.controller=new AbortController,lp.set(this,void 0),x0.set(this,()=>{}),cp.set(this,()=>{}),dp.set(this,void 0),T0.set(this,()=>{}),pp.set(this,()=>{}),cs.set(this,{}),up.set(this,!1),_0.set(this,!1),E0.set(this,!1),ma.set(this,!1),N0.set(this,void 0),C0.set(this,void 0),mp.set(this,void 0),Xw.set(this,i=>{if(P(this,_0,!0,"f"),is(i)&&(i=new Et),i instanceof Et)return P(this,E0,!0,"f"),this._emit("abort",i);if(i instanceof L)return this._emit("error",i);if(i instanceof Error){let s=new L(i.message);return s.cause=i,this._emit("error",s)}return this._emit("error",new L(String(i)))}),P(this,lp,new Promise((i,s)=>{P(this,x0,i,"f"),P(this,cp,s,"f")}),"f"),P(this,dp,new Promise((i,s)=>{P(this,T0,i,"f"),P(this,pp,s,"f")}),"f"),T(this,lp,"f").catch(()=>{}),T(this,dp,"f").catch(()=>{}),P(this,Gl,e,"f"),P(this,mp,t?.logger??console,"f")}get response(){return T(this,N0,"f")}get request_id(){return T(this,C0,"f")}async withResponse(){P(this,ma,!0,"f");let e=await T(this,lp,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new r(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,i,{logger:s}={}){let n=new r(t,{logger:s});for(let a of t.messages)n._addMessageParam(a);return P(n,Gl,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},T(this,Xw,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,i){let s=i?.signal,n;s&&(s.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),s.addEventListener("abort",n));try{T(this,Pr,"m",Yw).call(this);let{response:a,data:o}=await e.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(a);for await(let l of o)T(this,Pr,"m",Zw).call(this,l);if(o.controller.signal?.aborted)throw new Et;T(this,Pr,"m",e9).call(this)}finally{s&&n&&s.removeEventListener("abort",n)}}_connected(e){this.ended||(P(this,N0,e,"f"),P(this,C0,e?.headers.get("request-id"),"f"),T(this,x0,"f").call(this,e),this._emit("connect"))}get ended(){return T(this,up,"f")}get errored(){return T(this,_0,"f")}get aborted(){return T(this,E0,"f")}abort(){this.controller.abort()}on(e,t){return(T(this,cs,"f")[e]||(T(this,cs,"f")[e]=[])).push({listener:t}),this}off(e,t){let i=T(this,cs,"f")[e];if(!i)return this;let s=i.findIndex(n=>n.listener===t);return s>=0&&i.splice(s,1),this}once(e,t){return(T(this,cs,"f")[e]||(T(this,cs,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{P(this,ma,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,t)})}async done(){P(this,ma,!0,"f"),await T(this,dp,"f")}get currentMessage(){return T(this,dn,"f")}async finalMessage(){return await this.done(),T(this,Pr,"m",Jw).call(this)}async finalText(){return await this.done(),T(this,Pr,"m",F_).call(this)}_emit(e,...t){if(T(this,up,"f"))return;e==="end"&&(P(this,up,!0,"f"),T(this,T0,"f").call(this));let i=T(this,cs,"f")[e];if(i&&(T(this,cs,"f")[e]=i.filter(s=>!s.once),i.forEach(({listener:s})=>s(...t))),e==="abort"){let s=t[0];!T(this,ma,"f")&&!i?.length&&Promise.reject(s),T(this,cp,"f").call(this,s),T(this,pp,"f").call(this,s),this._emit("end");return}if(e==="error"){let s=t[0];!T(this,ma,"f")&&!i?.length&&Promise.reject(s),T(this,cp,"f").call(this,s),T(this,pp,"f").call(this,s),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",T(this,Pr,"m",Jw).call(this))}async _fromReadableStream(e,t){let i=t?.signal,s;i&&(i.aborted&&this.controller.abort(),s=this.controller.abort.bind(this.controller),i.addEventListener("abort",s));try{T(this,Pr,"m",Yw).call(this),this._connected(null);let n=Ci.fromReadableStream(e,this.controller);for await(let a of n)T(this,Pr,"m",Zw).call(this,a);if(n.controller.signal?.aborted)throw new Et;T(this,Pr,"m",e9).call(this)}finally{i&&s&&i.removeEventListener("abort",s)}}[(dn=new WeakMap,Gl=new WeakMap,lp=new WeakMap,x0=new WeakMap,cp=new WeakMap,dp=new WeakMap,T0=new WeakMap,pp=new WeakMap,cs=new WeakMap,up=new WeakMap,_0=new WeakMap,E0=new WeakMap,ma=new WeakMap,N0=new WeakMap,C0=new WeakMap,mp=new WeakMap,Xw=new WeakMap,Pr=new WeakSet,Jw=function(){if(this.receivedMessages.length===0)throw new L("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},F_=function(){if(this.receivedMessages.length===0)throw new L("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(i=>i.type==="text").map(i=>i.text);if(t.length===0)throw new L("stream ended without producing a content block with type=text");return t.join(" ")},Yw=function(){this.ended||P(this,dn,void 0,"f")},Zw=function(t){if(this.ended)return;let i=T(this,Pr,"m",L_).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let s=i.content.at(-1);switch(t.delta.type){case"text_delta":{s.type==="text"&&this._emit("text",t.delta.text,s.text||"");break}case"citations_delta":{s.type==="text"&&this._emit("citation",t.delta.citation,s.citations??[]);break}case"input_json_delta":{B_(s)&&s.input&&this._emit("inputJson",t.delta.partial_json,s.input);break}case"thinking_delta":{s.type==="thinking"&&this._emit("thinking",t.delta.thinking,s.thinking);break}case"signature_delta":{s.type==="thinking"&&this._emit("signature",s.signature);break}default:t.delta}break}case"message_stop":{this._addMessageParam(i),this._addMessage(Gw(i,T(this,Gl,"f"),{logger:T(this,mp,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{P(this,dn,i,"f");break}case"content_block_start":case"message_delta":break}},e9=function(){if(this.ended)throw new L("stream has ended, this shouldn't happen");let t=T(this,dn,"f");if(!t)throw new L("request ended without sending any chunks");return P(this,dn,void 0,"f"),Gw(t,T(this,Gl,"f"),{logger:T(this,mp,"f")})},L_=function(t){let i=T(this,dn,"f");if(t.type==="message_start"){if(i)throw new L(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new L(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":return i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null&&(i.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(i.usage.server_tool_use=t.usage.server_tool_use),i;case"content_block_start":return i.content.push({...t.content_block}),i;case"content_block_delta":{let s=i.content.at(t.index);switch(t.delta.type){case"text_delta":{s?.type==="text"&&(i.content[t.index]={...s,text:(s.text||"")+t.delta.text});break}case"citations_delta":{s?.type==="text"&&(i.content[t.index]={...s,citations:[...s.citations??[],t.delta.citation]});break}case"input_json_delta":{if(s&&B_(s)){let n=s[q_]||"";n+=t.delta.partial_json;let a={...s};Object.defineProperty(a,q_,{value:n,enumerable:!1,writable:!0}),n&&(a.input=m0(n)),i.content[t.index]=a}break}case"thinking_delta":{s?.type==="thinking"&&(i.content[t.index]={...s,thinking:s.thinking+t.delta.thinking});break}case"signature_delta":{s?.type==="thinking"&&(i.content[t.index]={...s,signature:t.delta.signature});break}default:t.delta}return i}case"content_block_stop":return i}},Symbol.asyncIterator)](){let e=[],t=[],i=!1;return this.on("streamEvent",s=>{let n=t.shift();n?n.resolve(s):e.push(s)}),this.on("end",()=>{i=!0;for(let s of t)s.resolve(void 0);t.length=0}),this.on("abort",s=>{i=!0;for(let n of t)n.reject(s);t.length=0}),this.on("error",s=>{i=!0;for(let n of t)n.reject(s);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((n,a)=>t.push({resolve:n,reject:a})).then(n=>n?{value:n,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Ci(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Kl=class extends Ae{create(e,t){return this._client.post("/v1/messages/batches",{body:e,...t})}retrieve(e,t){return this._client.get(Re`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",kr,{query:e,...t})}delete(e,t){return this._client.delete(Re`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(Re`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let i=await this.retrieve(e);if(!i.results_url)throw new L(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);return this._client.get(i.results_url,{...t,headers:J([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((s,n)=>Vl.fromResponse(n.response,n.controller))}};var pn=class extends Ae{constructor(){super(...arguments),this.batches=new Kl(this._client)}create(e,t){e.model in W_&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${W_[e.model]}
1089
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),e.model in UD&&e.thinking&&e.thinking.type==="enabled"&&console.warn(`Using Claude with ${e.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let i=this._client._options.timeout;if(!e.stream&&i==null){let n=u0[e.model]??void 0;i=this._client.calculateNonstreamingTimeout(e.max_tokens,n)}let s=p0(e.tools,e.messages);return this._client.post("/v1/messages",{body:e,timeout:i??6e5,...t,headers:J([s,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then(i=>Kw(i,e,{logger:this._client.logger??console}))}stream(e,t){return A0.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){return this._client.post("/v1/messages/count_tokens",{body:e,...t})}},W_={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026"},UD=["claude-opus-4-6"];pn.Batches=Kl;var ha=class extends Ae{retrieve(e,t={},i){let{betas:s}=t??{};return this._client.get(Re`/v1/models/${e}`,{...i,headers:J([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},i?.headers])})}list(e={},t){let{betas:i,...s}=e??{};return this._client.getAPIList("/v1/models",kr,{query:s,...t,headers:J([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}};var hp=r=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[r]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(r)?.trim()};var t9,r9,R0,z_,U_="\\n\\nHuman:",j_="\\n\\nAssistant:",De=class{constructor({baseURL:e=hp("ANTHROPIC_BASE_URL"),apiKey:t=hp("ANTHROPIC_API_KEY")??null,authToken:i=hp("ANTHROPIC_AUTH_TOKEN")??null,...s}={}){t9.add(this),R0.set(this,void 0);let n={apiKey:t,authToken:i,...s,baseURL:e||"https://api.anthropic.com"};if(!n.dangerouslyAllowBrowser&&d_())throw new L(`It looks like you're running in a browser-like environment.
1090
-
1091
- This is disabled by default, as it risks exposing your secret API credentials to attackers.
1092
- If you understand the risks and have appropriate mitigations in place,
1093
- you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
1094
-
1095
- new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
1096
- `);this.baseURL=n.baseURL,this.timeout=n.timeout??r9.DEFAULT_TIMEOUT,this.logger=n.logger??console;let a="warn";this.logLevel=a,this.logLevel=Pw(n.logLevel,"ClientOptions.logLevel",this)??Pw(hp("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??a,this.fetchOptions=n.fetchOptions,this.maxRetries=n.maxRetries??2,this.fetch=n.fetch??u_(),P(this,R0,h_,"f"),this._options=n,this.apiKey=typeof t=="string"?t:null,this.authToken=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get("x-api-key")||e.get("authorization"))&&!(this.apiKey&&e.get("x-api-key"))&&!t.has("x-api-key")&&!(this.authToken&&e.get("authorization"))&&!t.has("authorization"))throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(e){return J([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return J([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return J([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Object.entries(e).filter(([t,i])=>typeof i<"u").map(([t,i])=>{if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(i)}`;if(i===null)return`${encodeURIComponent(t)}=`;throw new L(`Cannot stringify type ${typeof i}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${on}`}defaultIdempotencyKey(){return`stainless-node-retry-${Aw()}`}makeStatusError(e,t,i,s){return pt.generate(e,t,i,s)}buildURL(e,t,i){let s=!T(this,t9,"m",z_).call(this)&&i||this.baseURL,n=r_(e)?new URL(e):new URL(s+(s.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return i_(a)||(t={...a,...t}),typeof t=="object"&&t&&!Array.isArray(t)&&(n.search=this.stringifyQuery(t)),n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new L("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:t,options:i}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,i){return this.request(Promise.resolve(i).then(s=>({method:e,path:t,...s})))}request(e,t=null){return new aa(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,i){let s=await e,n=s.maxRetries??this.maxRetries;t==null&&(t=n),await this.prepareOptions(s);let{req:a,url:o,timeout:l}=await this.buildRequest(s,{retryCount:n-t});await this.prepareRequest(a,{url:o,options:s});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),d=i===void 0?"":`, retryOf: ${i}`,p=Date.now();if(ut(this).debug(`[${c}] sending request`,ns({retryOfRequestLogID:i,method:s.method,url:o,options:s,headers:a.headers})),s.signal?.aborted)throw new Et;let m=new AbortController,h=await this.fetchWithTimeout(o,a,l,m).catch(jd),f=Date.now();if(h instanceof globalThis.Error){let v=`retrying, ${t} attempts remaining`;if(s.signal?.aborted)throw new Et;let S=is(h)||/timed? ?out/i.test(String(h)+("cause"in h?String(h.cause):""));if(t)return ut(this).info(`[${c}] connection ${S?"timed out":"failed"} - ${v}`),ut(this).debug(`[${c}] connection ${S?"timed out":"failed"} (${v})`,ns({retryOfRequestLogID:i,url:o,durationMs:f-p,message:h.message})),this.retryRequest(s,t,i??c);throw ut(this).info(`[${c}] connection ${S?"timed out":"failed"} - error; no more retries left`),ut(this).debug(`[${c}] connection ${S?"timed out":"failed"} (error; no more retries left)`,ns({retryOfRequestLogID:i,url:o,durationMs:f-p,message:h.message})),S?new Al:new an({cause:h})}let w=[...h.headers.entries()].filter(([v])=>v==="request-id").map(([v,S])=>", "+v+": "+JSON.stringify(S)).join(""),b=`[${c}${d}${w}] ${a.method} ${o} ${h.ok?"succeeded":"failed"} with status ${h.status} in ${f-p}ms`;if(!h.ok){let v=await this.shouldRetry(h);if(t&&v){let X=`retrying, ${t} attempts remaining`;return await m_(h.body),ut(this).info(`${b} - ${X}`),ut(this).debug(`[${c}] response error (${X})`,ns({retryOfRequestLogID:i,url:h.url,status:h.status,headers:h.headers,durationMs:f-p})),this.retryRequest(s,t,i??c,h.headers)}let S=v?"error; no more retries left":"error; not retryable";ut(this).info(`${b} - ${S}`);let y=await h.text().catch(X=>jd(X).message),_=r0(y),E=_?void 0:y;throw ut(this).debug(`[${c}] response error (${S})`,ns({retryOfRequestLogID:i,url:h.url,status:h.status,headers:h.headers,message:E,durationMs:Date.now()-p})),this.makeStatusError(h.status,_,E,h.headers)}return ut(this).info(b),ut(this).debug(`[${c}] response start`,ns({retryOfRequestLogID:i,url:h.url,status:h.status,headers:h.headers,durationMs:f-p})),{response:h,options:s,controller:m,requestLogID:c,retryOfRequestLogID:i,startTime:p}}getAPIList(e,t,i){return this.requestAPIList(t,i&&"then"in i?i.then(s=>({method:"get",path:e,...s})):{method:"get",path:e,...i})}requestAPIList(e,t){let i=this.makeRequest(t,null,void 0);return new Jd(this,i,e)}async fetchWithTimeout(e,t,i,s){let{signal:n,method:a,...o}=t||{},l=this._makeAbort(s);n&&n.addEventListener("abort",l,{once:!0});let c=setTimeout(l,i),d=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body=="object"&&o.body!==null&&Symbol.asyncIterator in o.body,p={signal:s.signal,...d?{duplex:"half"}:{},method:"GET",...o};a&&(p.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,p)}finally{clearTimeout(c)}}async shouldRetry(e){let t=e.headers.get("x-should-retry");return t==="true"?!0:t==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,i,s){let n,a=s?.get("retry-after-ms");if(a){let l=parseFloat(a);Number.isNaN(l)||(n=l)}let o=s?.get("retry-after");if(o&&!n){let l=parseFloat(o);Number.isNaN(l)?n=Date.parse(o)-Date.now():n=l*1e3}if(!(n&&0<=n&&n<60*1e3)){let l=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,l)}return await a_(n),this.makeRequest(e,t-1,i)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,a=Math.min(.5*Math.pow(2,n),8),o=1-Math.random()*.25;return a*o*1e3}calculateNonstreamingTimeout(e,t){if(36e5*e/128e3>6e5||t!=null&&e>t)throw new L("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:t=0}={}){let i={...e},{method:s,path:n,query:a,defaultBaseURL:o}=i,l=this.buildURL(n,a,o);"timeout"in i&&n_("timeout",i.timeout),i.timeout=i.timeout??this.timeout;let{bodyHeaders:c,body:d}=this.buildBody({options:i}),p=await this.buildHeaders({options:e,method:s,bodyHeaders:c,retryCount:t});return{req:{method:s,headers:p,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&d instanceof globalThis.ReadableStream&&{duplex:"half"},...d&&{body:d},...this.fetchOptions??{},...i.fetchOptions??{}},url:l,timeout:i.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:i,retryCount:s}){let n={};this.idempotencyHeader&&t!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),n[this.idempotencyHeader]=e.idempotencyKey);let a=J([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(s),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...p_(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,i,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let i=J([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&i.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:i0(e)}:T(this,R0,"f").call(this,{body:e,headers:i})}};r9=De,R0=new WeakMap,t9=new WeakSet,z_=function(){return this.baseURL!=="https://api.anthropic.com"};De.Anthropic=r9;De.HUMAN_PROMPT=U_;De.AI_PROMPT=j_;De.DEFAULT_TIMEOUT=6e5;De.AnthropicError=L;De.APIError=pt;De.APIConnectionError=an;De.APIConnectionTimeoutError=Al;De.APIUserAbortError=Et;De.NotFoundError=Il;De.ConflictError=Pl;De.RateLimitError=Dl;De.BadRequestError=Rl;De.AuthenticationError=Ml;De.InternalServerError=$l;De.PermissionDeniedError=kl;De.UnprocessableEntityError=Ol;De.toFile=c0;var Ai=class extends De{constructor(){super(...arguments),this.completions=new ua(this),this.messages=new pn(this),this.models=new ha(this),this.beta=new si(this)}};Ai.Completions=ua;Ai.Messages=pn;Ai.Models=ha;Ai.Beta=si;Ot();var M0=class{client;constructor(e){this.client=new Ai({apiKey:e})}async createMessage(e){let t=await this.client.messages.create({model:e.model,max_tokens:e.max_tokens||1024,system:e.system,messages:e.messages,tools:e.tools});if(!t.content||t.content.length===0)throw new Error("Anthropic API returned an empty content array.");let i=t.content.filter(s=>s.type==="tool_use").map(s=>({id:s.id,name:s.name,input:s.input}));return{role:"assistant",content:t.content,tool_uses:i.length>0?i:void 0}}async createMessageStream(e,t,i){let s=Date.now();t({type:"run_started",timestamp:s}),t({type:"stage_change",stage:"thinking",label:"Processing request..."});let n=await this.client.messages.create({model:e.model,max_tokens:e.max_tokens||1024,system:e.system,messages:e.messages,tools:e.tools,stream:!0},{signal:i}),a=[],o={},l=!1;for await(let m of n)if(m.type==="content_block_delta"&&m.delta.type==="text_delta"){l||(l=!0,t({type:"stage_change",stage:"responding",label:"Generating response..."}));let h=m.delta.text;a.push(h),t({type:"content_delta",text:h})}else if(m.type==="content_block_start"&&m.content_block.type==="tool_use")t({type:"stage_change",stage:"calling_tool",label:"Using tool..."}),o[m.index]={id:m.content_block.id,name:m.content_block.name,inputParts:[]},t({type:"tool_call_delta",index:m.index,id:m.content_block.id,name:m.content_block.name});else if(m.type==="content_block_delta"&&m.delta.type==="input_json_delta"){let h=o[m.index];h&&(h.inputParts.push(m.delta.partial_json),t({type:"tool_call_delta",index:m.index,argumentsDelta:m.delta.partial_json}))}else m.type==="message_delta"&&m.usage&&t({type:"usage",usage:{inputTokens:m.usage.input_tokens??void 0,outputTokens:m.usage.output_tokens??void 0,totalTokens:(m.usage.input_tokens??0)+(m.usage.output_tokens??0)}});let c=Date.now();t({type:"run_completed",timestamp:c,durationMs:c-s});let d=a.join(""),p=Object.values(o).map(m=>({id:m.id,name:m.name,input:_t.safeParseJson(m.inputParts.join(""))}));return{role:"assistant",content:d,tool_uses:p.length>0?p:void 0}}estimateTokens(e){let t=V.getTokensPerChar();return Math.ceil(e.length*t)}async listModels(){return[{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet (Latest)"},{id:"claude-3-5-haiku-20241022",name:"Claude 3.5 Haiku"},{id:"claude-3-opus-20240229",name:"Claude 3 Opus"},{id:"claude-3-sonnet-20240229",name:"Claude 3 Sonnet"},{id:"claude-3-haiku-20240307",name:"Claude 3 Haiku"}]}async createEmbedding(e){return new Array(1536).fill(0)}};Ot();fl();var k0=class r{root={children:new Map,isEndOfTag:!1};tags=[];constructor(e){this.tags=e;for(let t of e)this.insert(t)}insert(e){let t=this.root;for(let i of e)t.children.has(i)||t.children.set(i,{children:new Map,isEndOfTag:!1}),t=t.children.get(i);t.isEndOfTag=!0,t.tag=e}findEarliestTag(e){let t=1/0,i="";for(let s=0;s<e.length&&!(s>=t);s++){let n=this.matchFromPosition(e,s);n&&n.index<t&&(t=n.index,i=n.tag)}return i?{index:t,tag:i}:null}matchFromPosition(e,t){let i=this.root,s=null;for(let n=t;n<e.length;n++){let a=e[n];if(!i.children.has(a))break;if(i=i.children.get(a),i.isEndOfTag&&!s)return s=i.tag,{index:t,tag:s}}return null}findLongestPartialAtEnd(e){let t=0;for(let i=0;i<e.length;i++){let s=this.matchPartialFromPosition(e,i);s>0&&i+s===e.length&&(t=Math.max(t,s))}return t}matchPartialFromPosition(e,t){let i=this.root,s=0;for(let n=t;n<e.length;n++){let a=e[n];if(!i.children.has(a))return s;if(i=i.children.get(a),s++,i.isEndOfTag)return 0}return s}editDistanceCache=new Map;static MAX_CACHE_SIZE=1e3;findSimilarTags(e,t=2){let i=[];for(let s of this.tags){let n=`${e}:${s}`,a=this.editDistanceCache.get(n);if(a===void 0){if(a=this.editDistance(e,s),this.editDistanceCache.size>=r.MAX_CACHE_SIZE){let o=Array.from(this.editDistanceCache.keys()).slice(0,r.MAX_CACHE_SIZE/2);for(let l of o)this.editDistanceCache.delete(l)}this.editDistanceCache.set(n,a)}a<=t&&i.push(s)}return i}editDistance(e,t){return Ut.levenshtein(e,t)}clearCache(){this.editDistanceCache.clear()}};var I0=class r{buffer="";static MAX_BUFFER_SIZE=1e5;tags=["<|tool_call_begin|>","<|tool_call_end|>","<|tool_calls_section_begin|>","<|tool_calls_section_end|>","<|tool_call_id|>","<|tool_call_argument_begin|>","<|tool_call_arguments_begin|>","<tool>","</tool>","<function","</function>","<function_calls>","</function_calls>","<invoke","</invoke>","<thought>","</thought>","<tool_code>","</tool_code>","<tool_call>","</tool_call>","<|eot_id|>","<|start_header_id|>","<|end_header_id|>"];prefixTree;constructor(){this.prefixTree=new k0(this.tags)}process(e){if(this.buffer+=e,this.buffer.length>r.MAX_BUFFER_SIZE){console.error("[Marie] StreamTagDetector buffer exceeded safety limit. Flushing.");let h=this.buffer;return this.buffer="",{type:"content",text:h}}let t=this.prefixTree.findEarliestTag(this.buffer);if(t){let h=this.buffer.substring(0,t.index);return this.buffer=this.buffer.substring(t.index+t.tag.length),console.log(`[Marie] Tag detected: ${t.tag} at index ${t.index}`),{type:"tag",text:h,tag:t.tag}}let i=Math.min(200,this.buffer.length),s=this.buffer.substring(this.buffer.length-i),n=/<\|[\w_]{3,}(?:\|>|>)?|(?:^|[^a-zA-Z0-9_])(call:\d+>)|(?:^|[\s,])(\[Tool (?:Use|Result):[^\]]+\])/g,a=Array.from(s.matchAll(n));if(a.length>0){let h=a[a.length-1],f=h[2]||h[1]||h[0],w=this.buffer.length-i+h.index+(h[0].length-f.length);if(f.endsWith(">")||f.endsWith("]")||this.tags.includes(f)){let b=this.buffer.substring(0,w);return this.buffer=this.buffer.substring(w+f.length),console.log(`[Marie] Dynamic tag detected: ${f}`),{type:"tag",text:b,tag:f}}}let o=this.prefixTree.findLongestPartialAtEnd(this.buffer),l=this.buffer.match(/<\|[\w_]*$/),c=this.buffer.match(/call:\d*$/),d=Math.max(l?l[0].length:0,c?c[0].length:0),p=Math.max(o,d);if(p>0){let h=this.buffer.length-p,f=this.buffer.substring(0,h);return this.buffer=this.buffer.substring(h),{type:"incomplete",text:f}}let m=this.buffer;return this.buffer="",{type:"content",text:m}}reset(){this.buffer=""}getBufferSize(){return this.buffer.length}};var P0=class{tagDetector;llamaToolMode=!1;thinkingMode=!1;llamaBufferParts=[];toolCalls={};indexCount=0;constructor(){this.tagDetector=new I0}stripToolWrapperTags(e){return e?e.replace(/<\|tool_calls_section_begin\|>/g,"").replace(/<\|tool_calls_section_end\|>/g,"").replace(/<\|tool_call_begin\|>/g,"").replace(/<\|tool_call_end\|>/g,"").replace(/<\|tool_call_argument_begin\|>/g,"").replace(/<\|tool_call_arguments_begin\|>/g,"").replace(/<tool_call>/g,"").replace(/<\/tool_call>/g,"").replace(/<tool>/g,"").replace(/<\/tool>/g,"").replace(/<function\b[^>]*>/g,"").replace(/<\/function>/g,"").replace(/<function_calls>/g,"").replace(/<\/function_calls>/g,"").trim():""}processContent(e){let t=[],i=e;for(;;){let s=this.tagDetector.process(i);if(i="",s.text&&(this.llamaToolMode?this.llamaBufferParts.push(s.text):this.thinkingMode?t.push({type:"reasoning_delta",text:s.text}):t.push({type:"content_delta",text:s.text})),s.type==="tag"){let n=s.tag;if(n==="<thought>"){this.thinkingMode=!0,t.push({type:"stage_change",stage:"thinking",label:"Thinking..."});continue}else if(n==="</thought>"){this.thinkingMode=!1,t.push({type:"stage_change",stage:"responding",label:"Generating response..."});continue}let a=n.startsWith("[Tool Use:"),o=n.startsWith("[Tool Result:");if(a||o){this.llamaToolMode&&this.finalizeCurrentBuffer(t),a?(this.llamaToolMode=!0,this.llamaBufferParts.push(n),t.push({type:"stage_change",stage:"calling_tool",label:"Using tool..."})):t.push({type:"content_delta",text:n});continue}let l=n==="<tool>"||n==="<|tool_call_begin|>"||n==="<|tool_calls_section_begin|>"||n==="<function_calls>"||n.startsWith("<function")||n==="<invoke"||n==="<tool_code>"||n==="<tool_call>",c=/<\|(?!.*_end)[\w_]{3,}\|>/.test(n)||/^call:\d+>$/.test(n),d=l||c;if(n==="</tool>"||n==="<|tool_call_end|>"||n==="<|tool_calls_section_end|>"||n==="</invoke>"||n==="</function>"||n==="</function_calls>"||n==="</tool_code>"||n==="</tool_call>"||n==="</call>"){this.llamaBufferParts.push(n);let m=this.llamaBufferParts.join(""),h=m.includes("<|tool_calls_section_begin|>")||m.includes("<|tool_call_begin|>"),f=m.length>n.length+10;if(h&&!f)console.warn("[Marie] Empty tool section detected - no tool content between markers"),t.push({type:"content_delta",text:m});else{let w=_t.extractToolCall(m);if(w){let b=w.id||`call_${Date.now()}_${this.indexCount}`;t.push({type:"tool_call_delta",index:this.indexCount,id:b,name:w.name,argumentsDelta:JSON.stringify(w.input)}),this.toolCalls[this.indexCount]={id:b,name:w.name,arguments:JSON.stringify(w.input)},this.indexCount++,this.llamaToolMode=!1}else{let b=this.stripToolWrapperTags(m);b&&(console.warn("[Marie] Tool extraction failed, emitting cleaned fallback content"),t.push({type:"content_delta",text:b}))}}this.llamaToolMode=!1,this.llamaBufferParts=[]}else d?(this.llamaToolMode=!0,t.push({type:"stage_change",stage:"calling_tool",label:"Using tool..."}),this.llamaBufferParts.push(n)):this.llamaToolMode?this.llamaBufferParts.push(n):t.push({type:"content_delta",text:n});continue}break}return t}finalizeCurrentBuffer(e){if(this.llamaBufferParts.length===0)return;let t=this.llamaBufferParts.join(""),i=_t.extractToolCall(t);if(i){let s=i.id||`call_${Date.now()}_${this.indexCount}`;e.push({type:"tool_call_delta",index:this.indexCount,id:s,name:i.name,argumentsDelta:JSON.stringify(i.input)}),this.toolCalls[this.indexCount]={id:s,name:i.name,arguments:JSON.stringify(i.input)},this.indexCount++}else{let s=this.stripToolWrapperTags(t);s&&e.push({type:"content_delta",text:s})}this.llamaBufferParts=[],this.llamaToolMode=!1}getCollectedToolCalls(){return this.toolCalls}finalize(e){let t=[],i=this.llamaBufferParts.join(""),s=_t.extractToolCall(i);if(s||(s=_t.extractToolCall(e)),s){let n=s.id||`call_${Date.now()}_${this.indexCount}_final`;console.log(`[Marie] Parser: Finalized extraction SUCCESS: ${s.name} (ID: ${n})`),Object.values(this.toolCalls).some(o=>o.name===s.name&&(o.arguments===JSON.stringify(s.input)||o.arguments.includes(JSON.stringify(s.input))))||(t.push({type:"tool_call_delta",index:this.indexCount,id:n,name:s.name,argumentsDelta:JSON.stringify(s.input)}),this.toolCalls[this.indexCount]={id:n,name:s.name,arguments:JSON.stringify(s.input)},this.indexCount++),this.llamaBufferParts=[]}else{let n=this.llamaBufferParts.join(""),a=this.stripToolWrapperTags(n);a&&n!==i?t.push({type:"content_delta",text:a}):a&&this.llamaToolMode&&t.push({type:"content_delta",text:a})}return this.llamaToolMode=!1,this.llamaBufferParts=[],t}};var O0=class{apiKey;baseUrl="https://openrouter.ai/api/v1";constructor(e){this.apiKey=e}async createMessage(e){let t=this.translateModelName(e.model),i=await fetch(`${this.baseUrl}/chat/completions`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"HTTP-Referer":"https://github.com/bozoegg/MarieCoder","X-Title":"MarieCoder VS Code Extension","Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({model:t,messages:this.getOpenAiMessages(e),tools:this.getOpenAiTools(e),max_tokens:e.max_tokens||1024})});if(!i.ok){let a=`OpenRouter API error: ${i.status} ${i.statusText} (model: ${t})`;try{let o=await i.json();o.error?.message&&(a=`OpenRouter API error: ${o.error.message} (model: ${t})`)}catch{let l=await i.text().catch(()=>"");l&&(a+=` - ${l}`)}throw new Error(a)}let s=await i.json();if(!s.choices||s.choices.length===0)throw new Error("OpenRouter API returned no choices.");let n=s.choices[0].message;if(n.tool_calls&&n.tool_calls.length>0)try{let a=n.tool_calls.map(o=>({id:o.id,name:o.function.name,input:_t.safeParseJson(o.function.arguments)}));return{role:"assistant",content:n.content||"",tool_uses:a}}catch(a){return console.error("Failed to parse tool arguments from OpenRouter:",Yt(a)),{role:"assistant",content:n.content||"(Message error: Malformed tool arguments)"}}return{role:"assistant",content:n.content||""}}async createMessageStream(e,t,i){let s=new AbortController,n=!1,a=setTimeout(()=>{n=!0,s.abort()},12e4),o=!1,l=()=>{o=!0,s.abort()};i&&i.addEventListener("abort",l);try{let c=this.translateModelName(e.model),d=await fetch(`${this.baseUrl}/chat/completions`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"HTTP-Referer":"https://github.com/bozoegg/MarieCoder","X-Title":"MarieCoder VS Code Extension","Content-Type":"application/json",Accept:"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"},body:JSON.stringify({model:c,messages:this.getOpenAiMessages(e),tools:this.getOpenAiTools(e),max_tokens:e.max_tokens||1024,stream:!0,include_reasoning:!0}),signal:s.signal});if(!d.ok)throw new Error(`OpenRouter API error: ${d.status} (model: ${c})`);if(!d.body)throw new Error("OpenRouter API returned no body.");let p=d.body.getReader(),m=new TextDecoder,h=[],f=[],w=[],b={},v=Date.now();t({type:"run_started",timestamp:v}),t({type:"stage_change",stage:"thinking",label:"Processing request..."});let S=new P0;try{for(;;){let{done:F,value:U}=await p.read();if(F)break;let pe=m.decode(U,{stream:!0});w.push(pe);let N=w.join("").split(`
1097
- `),A=N.pop()||"";w.length=0,A&&w.push(A);for(let q of N){let H=q.trim();if(!(!H||H.startsWith(":"))&&H.startsWith("data: ")){let z=H.slice(6);if(z==="[DONE]")continue;try{let B=JSON.parse(z),$e=B.choices?.[0];if(!$e)continue;let ft=$e.delta;if(ft?.content){let Fe=S.processContent(ft.content);for(let me of Fe)me.type==="content_delta"&&h.push(me.text),me.type==="reasoning_delta"&&f.push(me.text),t(me)}if(ft?.tool_calls){t({type:"stage_change",stage:"calling_tool",label:"Using tool..."});for(let Fe of ft.tool_calls){let me=Fe.index;b[me]?(Fe.id&&(b[me].id=Fe.id),Fe.function?.name&&(b[me].name+=Fe.function.name)):b[me]={id:Fe.id||"",name:Fe.function?.name||"",argumentsParts:[]},Fe.function?.arguments&&(b[me].argumentsParts.push(Fe.function.arguments),t({type:"tool_call_delta",index:me,id:b[me].id,name:b[me].name,argumentsDelta:Fe.function.arguments}))}}B.usage&&t({type:"usage",usage:{inputTokens:B.usage.prompt_tokens,outputTokens:B.usage.completion_tokens,totalTokens:B.usage.total_tokens,reasoningTokens:B.usage.reasoning_tokens}})}catch{}}}}}finally{p.releaseLock()}let y=h.join(""),_=f.join(""),E=S.finalize(y);for(let F of E)t(F);let D=Date.now();t({type:"run_completed",timestamp:D,durationMs:D-v});let X=S.getCollectedToolCalls();for(let F in X){let U=X[F];b[parseInt(F)+1e3]={id:U.id,name:U.name,argumentsParts:[U.arguments]}}let $=[];for(let F in b){let U=b[F];try{let pe=U.argumentsParts.join("");$.push({id:U.id,name:U.name,input:_t.safeParseJson(pe)})}catch{}}let M=[];return _&&M.push({type:"thought",text:_}),y&&M.push({type:"text",text:y}),{role:"assistant",content:M.length>0?M:y,tool_uses:$.length>0?$:void 0}}catch(c){throw c instanceof Error&&c.name==="AbortError"?o?new Error("Request stopped by user"):n?new Error("OpenRouter timeout"):new Error("Request aborted"):c}finally{clearTimeout(a),i&&i.removeEventListener("abort",l)}}translateModelName(e){let t=(e||"").trim();if(!t)return"anthropic/claude-3.5-sonnet";if(t.includes("/"))return t;let i={"claude-3-5-sonnet-20241022":"anthropic/claude-3.5-sonnet","claude-3-5-sonnet":"anthropic/claude-3.5-sonnet","claude-3-5-haiku-20241022":"anthropic/claude-3.5-haiku","claude-3-5-haiku":"anthropic/claude-3.5-haiku","claude-3-opus-20240229":"anthropic/claude-3-opus","claude-3-opus":"anthropic/claude-3-opus","claude-3-sonnet-20240229":"anthropic/claude-3-sonnet","claude-3-sonnet":"anthropic/claude-3-sonnet","claude-3-haiku-20240307":"anthropic/claude-3-haiku","claude-3-haiku":"anthropic/claude-3-haiku"};if(i[t])return i[t];if(t.startsWith("claude-")){let s=t.replace(/-20\d{6}$/,""),n=s.match(/^claude-(\d+)-(\d+)(-.+)$/);if(n){let a=n[1],o=n[2],l=n[3];return`anthropic/claude-${a}.${o}${l}`}return`anthropic/${s}`}return t}getOpenAiMessages(e){let t=[];e.system&&t.push({role:"system",content:e.system});for(let i of e.messages)if(typeof i.content=="string")t.push({role:i.role,content:i.content});else if(Array.isArray(i.content)){let s="",n=[];for(let a of i.content)a.type==="text"?s+=a.text:a.type==="tool_use"?n.push({id:a.id,type:"function",function:{name:a.name,arguments:JSON.stringify(a.input)}}):a.type==="tool_result"&&t.push({role:"tool",tool_call_id:a.tool_use_id,content:typeof a.content=="string"?a.content:JSON.stringify(a.content)});if(i.role==="assistant"&&(s||n.length>0)){let a={role:"assistant",content:s||null};n.length>0&&(a.tool_calls=n),t.push(a)}else i.role==="user"&&s&&t.push({role:"user",content:s})}return t}getOpenAiTools(e){if(e.tools)return e.tools.map(t=>({type:"function",function:{name:t.name,description:t.description,parameters:t.input_schema}}))}estimateTokens(e){return Math.ceil(e.length*V.getTokensPerChar())}async listModels(){return[{id:"anthropic/claude-3.5-sonnet",name:"Claude 3.5 Sonnet"},{id:"google/gemini-2.0-flash-001",name:"Gemini 2.0 Flash"}]}async createEmbedding(e){let t=await fetch(`${this.baseUrl}/embeddings`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"HTTP-Referer":"https://github.com/bozoegg/MarieCoder","X-Title":"MarieCoder VS Code Extension","Content-Type":"application/json"},body:JSON.stringify({model:"openai/text-embedding-3-small",input:e})});if(!t.ok)throw new Error(`OpenRouter Embedding error: ${t.status}`);let i=await t.json();if(!i.data||i.data.length===0)throw new Error("OpenRouter Embedding returned no data.");return i.data[0].embedding}};var fa="1.64.1";var V_=!1,ga,i9,VD,HD,QD,H_,GD,D0,s9,Q_,n9,$0,G_;function K_(r,e={auto:!1}){if(V_)throw new Error(`you must \`import '@cerebras/cerebras_cloud_sdk/shims/${r.kind}'\` before importing anything else from @cerebras/cerebras_cloud_sdk`);if(ga)throw new Error(`can't \`import '@cerebras/cerebras_cloud_sdk/shims/${r.kind}'\` after \`import '@cerebras/cerebras_cloud_sdk/shims/${ga}'\``);V_=e.auto,ga=r.kind,i9=r.fetch,VD=r.Request,HD=r.Response,QD=r.Headers,H_=r.FormData,GD=r.Blob,D0=r.File,s9=r.ReadableStream,Q_=r.getMultipartRequestOptions,n9=r.getDefaultAgent,$0=r.fileFromPath,G_=r.isFsReadStream}var _n=k(OE(),1);var cC=require("util");Op();K9();wg();var aC=r=>r instanceof Pi;fg();var oC=require("util"),lC=(0,oC.deprecate)(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var Oi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Sg,Di,J9,xg=class{constructor(e){Sg.add(this),Di.set(this,new Map),e&&(lC(),e.forEach(({name:t,value:i,fileName:s})=>this.append(t,i,s)))}static[(Di=new WeakMap,Sg=new WeakSet,Symbol.hasInstance)](e){return!!(e&&Ve(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&Ve(e.append)&&Ve(e.set)&&Ve(e.get)&&Ve(e.getAll)&&Ve(e.has)&&Ve(e.delete)&&Ve(e.entries)&&Ve(e.values)&&Ve(e.keys)&&Ve(e[Symbol.iterator])&&Ve(e.forEach))}append(e,t,i){Oi(this,Sg,"m",J9).call(this,{name:e,fileName:i,append:!0,rawValue:t,argsLength:arguments.length})}set(e,t,i){Oi(this,Sg,"m",J9).call(this,{name:e,fileName:i,append:!1,rawValue:t,argsLength:arguments.length})}get(e){let t=Oi(this,Di,"f").get(String(e));return t?t[0]:null}getAll(e){let t=Oi(this,Di,"f").get(String(e));return t?t.slice():[]}has(e){return Oi(this,Di,"f").has(String(e))}delete(e){Oi(this,Di,"f").delete(String(e))}*keys(){for(let e of Oi(this,Di,"f").keys())yield e}*entries(){for(let e of this.keys()){let t=this.getAll(e);for(let i of t)yield[e,i]}}*values(){for(let[,e]of this)yield e}[(J9=function({name:t,rawValue:i,append:s,fileName:n,argsLength:a}){let o=s?"append":"set";if(a<2)throw new TypeError(`Failed to execute '${o}' on 'FormData': 2 arguments required, but only ${a} present.`);t=String(t);let l;if(G9(i))l=n===void 0?i:new di([i],n,{type:i.type,lastModified:i.lastModified});else if(aC(i))l=new di([i],n===void 0?"blob":n,{type:i.type});else{if(n)throw new TypeError(`Failed to execute '${o}' on 'FormData': parameter 2 is not of type 'Blob'.`);l=String(i)}let c=Oi(this,Di,"f").get(t);if(!c)return void Oi(this,Di,"f").set(t,[l]);if(!s)return void Oi(this,Di,"f").set(t,[l]);c.push(l)},Symbol.iterator)](){return this.entries()}forEach(e,t){for(let[i,s]of this)e.call(t,s,i,this)}get[Symbol.toStringTag](){return"FormData"}[cC.inspect.custom](){return this[Symbol.toStringTag]}};wg();Op();var u5=k(TC(),1),XC=k($C(),1),YC=require("node:fs");var FC="abcdefghijklmnopqrstuvwxyz0123456789";function DF(){let r=16,e="";for(;r--;)e+=FC[Math.random()*FC.length<<0];return e}var LC=DF;var $F=r=>Object.prototype.toString.call(r).slice(8,-1).toLowerCase();function FF(r){if($F(r)!=="object")return!1;let e=Object.getPrototypeOf(r);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}var o5=FF;var LF=r=>String(r).replace(/\r|\n/g,(e,t,i)=>e==="\r"&&i[t+1]!==`
1098
- `||e===`
1099
- `&&i[t-1]!=="\r"?`\r
1100
- `:e),l5=LF;var qF=r=>String(r).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),c5=qF;var BF=r=>typeof r=="function",xs=BF;var Aa=r=>!!(r&&typeof r=="object"&&xs(r.constructor)&&r[Symbol.toStringTag]==="File"&&xs(r.stream)&&r.name!=null&&r.size!=null&&r.lastModified!=null);var qC=r=>!!(r&&xs(r.constructor)&&r[Symbol.toStringTag]==="FormData"&&xs(r.append)&&xs(r.getAll)&&xs(r.entries)&&xs(r[Symbol.iterator]));var jp=function(r,e,t,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},Me=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Rg,Tn,Vp,Mg,Hp,Ra,Qp,Gp,kg,d5,WF={enableAdditionalHeaders:!1},Ig=class{constructor(e,t,i){if(Rg.add(this),Tn.set(this,`\r
1101
- `),Vp.set(this,void 0),Mg.set(this,void 0),Hp.set(this,"-".repeat(2)),Ra.set(this,new TextEncoder),Qp.set(this,void 0),Gp.set(this,void 0),kg.set(this,void 0),!qC(e))throw new TypeError("Expected first argument to be a FormData instance.");let s;if(o5(t)?i=t:s=t,s||(s=LC()),typeof s!="string")throw new TypeError("Expected boundary argument to be a string.");if(i&&!o5(i))throw new TypeError("Expected options argument to be an object.");jp(this,Gp,e,"f"),jp(this,kg,{...WF,...i},"f"),jp(this,Vp,Me(this,Ra,"f").encode(Me(this,Tn,"f")),"f"),jp(this,Mg,Me(this,Vp,"f").byteLength,"f"),this.boundary=`form-data-boundary-${s}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,jp(this,Qp,Me(this,Ra,"f").encode(`${Me(this,Hp,"f")}${this.boundary}${Me(this,Hp,"f")}${Me(this,Tn,"f").repeat(2)}`),"f"),this.contentLength=String(this.getContentLength()),this.headers=Object.freeze({"Content-Type":this.contentType,"Content-Length":this.contentLength}),Object.defineProperties(this,{boundary:{writable:!1,configurable:!1},contentType:{writable:!1,configurable:!1},contentLength:{writable:!1,configurable:!1},headers:{writable:!1,configurable:!1}})}getContentLength(){let e=0;for(let[t,i]of Me(this,Gp,"f")){let s=Aa(i)?i:Me(this,Ra,"f").encode(l5(i));e+=Me(this,Rg,"m",d5).call(this,t,s).byteLength,e+=Aa(s)?s.size:s.byteLength,e+=Me(this,Mg,"f")}return e+Me(this,Qp,"f").byteLength}*values(){for(let[e,t]of Me(this,Gp,"f").entries()){let i=Aa(t)?t:Me(this,Ra,"f").encode(l5(t));yield Me(this,Rg,"m",d5).call(this,e,i),yield i,yield Me(this,Vp,"f")}yield Me(this,Qp,"f")}async*encode(){for(let e of this.values())Aa(e)?yield*e.stream():yield e}[(Tn=new WeakMap,Vp=new WeakMap,Mg=new WeakMap,Hp=new WeakMap,Ra=new WeakMap,Qp=new WeakMap,Gp=new WeakMap,kg=new WeakMap,Rg=new WeakSet,d5=function(t,i){let s="";return s+=`${Me(this,Hp,"f")}${this.boundary}${Me(this,Tn,"f")}`,s+=`Content-Disposition: form-data; name="${c5(t)}"`,Aa(i)&&(s+=`; filename="${c5(i.name)}"${Me(this,Tn,"f")}`,s+=`Content-Type: ${i.type||"application/octet-stream"}`),Me(this,kg,"f").enableAdditionalHeaders===!0&&(s+=`${Me(this,Tn,"f")}Content-Length: ${Aa(i)?i.size:i.byteLength}`),Me(this,Ra,"f").encode(`${s}${Me(this,Tn,"f").repeat(2)}`)},Symbol.iterator)](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};var ZC=require("node:stream");var Pg=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};var eA=require("node:stream/web"),JC=!1;async function QF(r,...e){let{fileFromPath:t}=await Promise.resolve().then(()=>(KC(),GC));return JC||(console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(r)}) instead`),JC=!0),await t(r,...e)}var GF=new u5.default({keepAlive:!0,timeout:300*1e3}),KF=new u5.default.HttpsAgent({keepAlive:!0,timeout:300*1e3});async function JF(r,e){let t=new Ig(r),i=ZC.Readable.from(t),s=new Pg(i),n={...e.headers,...t.headers,"Content-Length":t.contentLength};return{...e,body:s,headers:n}}function tA(){return typeof AbortController>"u"&&(globalThis.AbortController=XC.AbortController),{kind:"node",fetch:_n.default,Request:_n.Request,Response:_n.Response,Headers:_n.Headers,FormData:xg,Blob:Pi,File:di,ReadableStream:eA.ReadableStream,getMultipartRequestOptions:JF,getDefaultAgent:r=>r.startsWith("https")?KF:GF,fileFromPath:QF,isFsReadStream:r=>r instanceof YC.ReadStream}}var m5=()=>{ga||K_(tA(),{auto:!0})};m5();var Ft=class extends Error{},tt=class r extends Ft{constructor(e,t,i,s){super(`${r.makeMessage(e,t,i)}`),this.status=e,this.headers=s,this.error=t}static makeMessage(e,t,i){let s=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):i;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,i,s){if(e===void 0||s===void 0)return new En({message:i,cause:Og(t)});let n=t;return e===400?new Jp(e,n,i,s):e===401?new Xp(e,n,i,s):e===403?new Yp(e,n,i,s):e===404?new Zp(e,n,i,s):e===409?new eu(e,n,i,s):e===422?new tu(e,n,i,s):e===429?new ru(e,n,i,s):e>=500?new iu(e,n,i,s):new r(e,n,i,s)}},Ia=class extends tt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},En=class extends tt{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},fc=class extends En{constructor({message:e}={}){super({message:e??"Request timed out."})}},Jp=class extends tt{},Xp=class extends tt{},Yp=class extends tt{},Zp=class extends tt{},eu=class extends tt{},tu=class extends tt{},ru=class extends tt{},iu=class extends tt{};var Dg=class r{constructor(e,t){this.iterator=e,this.controller=t}static fromSSEResponse(e,t){let i=!1;async function*s(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let n=!1;try{for await(let a of YF(e,t))if(!n){if(a.data.startsWith("[DONE]")){n=!0;continue}if(a.event===null){let o;try{o=JSON.parse(a.data)}catch(l){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),l}if(o&&o.error){let l=o.status_code||0;throw tt.generate(l,o.error,void 0,void 0)}yield o}else{let o;try{o=JSON.parse(a.data)}catch(l){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),l}if(a.event=="error"){let l=o.status_code||0;throw tt.generate(l,o.error,void 0,void 0)}yield{event:a.event,data:o}}}n=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{n||t.abort()}}return new r(s,t)}static fromReadableStream(e,t){let i=!1;async function*s(){let a=new gc,o=rA(e);for await(let l of o)for(let c of a.decode(l))yield c;for(let l of a.flush())yield l}async function*n(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let a=!1;try{for await(let o of s())a||o&&(yield JSON.parse(o));a=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{a||t.abort()}}return new r(n,t)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],t=[],i=this.iterator(),s=n=>({next:()=>{if(n.length===0){let a=i.next();e.push(a),t.push(a)}return n.shift()}});return[new r(()=>s(e),this.controller),new r(()=>s(t),this.controller)]}toReadableStream(){let e=this,t,i=new TextEncoder;return new s9({async start(){t=e[Symbol.asyncIterator]()},async pull(s){try{let{value:n,done:a}=await t.next();if(a)return s.close();let o=i.encode(JSON.stringify(n)+`
1102
- `);s.enqueue(o)}catch(n){s.error(n)}},async cancel(){await t.return?.()}})}};async function*YF(r,e){if(!r.body)throw e.abort(),new Ft("Attempted to iterate over a response with no body");let t=new h5,i=new gc,s=rA(r.body);for await(let n of ZF(s))for(let a of i.decode(n)){let o=t.decode(a);o&&(yield o)}for(let n of i.flush()){let a=t.decode(n);a&&(yield a)}}async function*ZF(r){let e=new Uint8Array;for await(let t of r){if(t==null)continue;let i=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?new TextEncoder().encode(t):t,s=new Uint8Array(e.length+i.length);s.set(e),s.set(i,e.length),e=s;let n;for(;(n=eL(e))!==-1;)yield e.slice(0,n),e=e.slice(n)}e.length>0&&(yield e)}function eL(r){for(let i=0;i<r.length-2;i++){if(r[i]===10&&r[i+1]===10||r[i]===13&&r[i+1]===13)return i+2;if(r[i]===13&&r[i+1]===10&&i+3<r.length&&r[i+2]===13&&r[i+3]===10)return i+4}return-1}var h5=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let n={event:this.event,data:this.data.join(`
1103
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],n}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,i,s]=tL(e,":");return s.startsWith(" ")&&(s=s.substring(1)),t==="event"?this.event=s:t==="data"&&this.data.push(s),null}},gc=class r{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let t=this.decodeText(e);if(this.trailingCR&&(t="\r"+t,this.trailingCR=!1),t.endsWith("\r")&&(this.trailingCR=!0,t=t.slice(0,-1)),!t)return[];let i=r.NEWLINE_CHARS.has(t[t.length-1]||""),s=t.split(r.NEWLINE_REGEXP);return i&&s.pop(),s.length===1&&!i?(this.buffer.push(s[0]),[]):(this.buffer.length>0&&(s=[this.buffer.join("")+s[0],...s.slice(1)],this.buffer=[]),i||(this.buffer=[s.pop()||""]),s)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Ft(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new Ft(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Ft("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};gc.NEWLINE_CHARS=new Set([`
1104
- `,"\r"]);gc.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function tL(r,e){let t=r.indexOf(e);return t!==-1?[r.substring(0,t),e,r.substring(t+e.length)]:[r,"",""]}function rA(r){if(r[Symbol.asyncIterator])return r;let e=r.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var rL=r=>r!=null&&typeof r=="object"&&typeof r.url=="string"&&typeof r.blob=="function",iL=r=>r!=null&&typeof r=="object"&&typeof r.name=="string"&&typeof r.lastModified=="number"&&su(r),su=r=>r!=null&&typeof r=="object"&&typeof r.size=="number"&&typeof r.type=="string"&&typeof r.text=="function"&&typeof r.slice=="function"&&typeof r.arrayBuffer=="function";async function iA(r,e,t){if(r=await r,iL(r))return r;if(rL(r)){let s=await r.blob();e||(e=new URL(r.url).pathname.split(/[\\/]/).pop()??"unknown_file");let n=su(s)?[await s.arrayBuffer()]:[s];return new D0(n,e,t)}let i=await sL(r);if(e||(e=aL(r)??"unknown_file"),!t?.type){let s=i[0]?.type;typeof s=="string"&&(t={...t,type:s})}return new D0(i,e,t)}async function sL(r){let e=[];if(typeof r=="string"||ArrayBuffer.isView(r)||r instanceof ArrayBuffer)e.push(r);else if(su(r))e.push(await r.arrayBuffer());else if(oL(r))for await(let t of r)e.push(t);else throw new Error(`Unexpected data type: ${typeof r}; constructor: ${r?.constructor?.name}; props: ${nL(r)}`);return e}function nL(r){return`[${Object.getOwnPropertyNames(r).map(t=>`"${t}"`).join(", ")}]`}function aL(r){return f5(r.name)||f5(r.filename)||f5(r.path)?.split(/[\\/]/).pop()}var f5=r=>{if(typeof r=="string")return r;if(typeof Buffer<"u"&&r instanceof Buffer)return String(r)},oL=r=>r!=null&&typeof r=="object"&&typeof r[Symbol.asyncIterator]=="function",g5=r=>r&&typeof r=="object"&&r.body&&r[Symbol.toStringTag]==="MultipartBody";var cA=function(r,e,t,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},dA=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Lg,$g;m5();async function pA(r){let{response:e}=r;if(r.options.stream)return Nn("response",e.status,e.url,e.headers,e.body),r.options.__streamClass?r.options.__streamClass.fromSSEResponse(e,r.controller):Dg.fromSSEResponse(e,r.controller);if(e.status===204)return null;if(r.options.__binaryResponse)return e;let i=e.headers.get("content-type")?.split(";")[0]?.trim();if(i?.includes("application/json")||i?.endsWith("+json")){let a=await e.json();return Nn("response",e.status,e.url,e.headers,a),a}let n=await e.text();return Nn("response",e.status,e.url,e.headers,n),n}var qg=class r extends Promise{constructor(e,t=pA){super(i=>{i(null)}),this.responsePromise=e,this.parseResponse=t}_thenUnwrap(e){return new r(this.responsePromise,async t=>e(await this.parseResponse(t),t))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Bg=class{constructor({baseURL:e,baseURLOverridden:t,maxRetries:i=2,timeout:s=6e4,httpAgent:n,fetch:a}){Lg.set(this,void 0),this.baseURL=e,cA(this,Lg,t,"f"),this.maxRetries=y5("maxRetries",i),this.timeout=y5("timeout",s),this.httpAgent=n,this.fetch=a??i9}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json",...["head","get"].includes(e.method)?{}:{"Content-Type":"application/json"},"User-Agent":this.getUserAgent(),...mL(),...this.authHeaders(e)}}validateHeaders(e,t){}defaultIdempotencyKey(){return`stainless-node-retry-${wL()}`}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,i){return this.request(Promise.resolve(i).then(async s=>{let n=s&&su(s?.body)?new DataView(await s.body.arrayBuffer()):s?.body instanceof DataView?s.body:s?.body instanceof ArrayBuffer?new DataView(s.body):s&&ArrayBuffer.isView(s?.body)?new DataView(s.body.buffer):s?.body;return{method:e,path:t,...s,body:n}}))}getAPIList(e,t,i){return this.requestAPIList(t,{method:"get",path:e,...i})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}async buildRequest(e,{retryCount:t=0}={}){let i={...e},{method:s,path:n,query:a,defaultBaseURL:o,headers:l={}}=i,c=ArrayBuffer.isView(i.body)||i.__binaryRequest&&typeof i.body=="string"?i.body:g5(i.body)?i.body.body:i.body?JSON.stringify(i.body,null,2):null,d=this.calculateContentLength(c),p=this.buildURL(n,a,o);"timeout"in i&&y5("timeout",i.timeout),i.timeout=i.timeout??this.timeout;let m=i.httpAgent??this.httpAgent??n9(p),h=i.timeout+1e3;typeof m?.options?.timeout=="number"&&h>(m.options.timeout??0)&&(m.options.timeout=h),this.idempotencyHeader&&s!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),l[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:i,headers:l,contentLength:d,retryCount:t});return{req:{method:s,...c&&{body:c},headers:f,...m&&{agent:m},signal:i.signal??null},url:p,timeout:i.timeout}}buildHeaders({options:e,headers:t,contentLength:i,retryCount:s}){let n={};i&&(n["content-length"]=i);let a=this.defaultHeaders(e);return lA(n,a),lA(n,t),g5(e.body)&&ga!=="node"&&delete n["content-type"],Fg(a,"x-stainless-retry-count")===void 0&&Fg(t,"x-stainless-retry-count")===void 0&&(n["x-stainless-retry-count"]=String(s)),Fg(a,"x-stainless-timeout")===void 0&&Fg(t,"x-stainless-timeout")===void 0&&e.timeout&&(n["x-stainless-timeout"]=String(Math.trunc(e.timeout/1e3))),this.validateHeaders(n,t),n}async prepareOptions(e){}async prepareRequest(e,{url:t,options:i}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(t=>[...t])):{...e}:{}}makeStatusError(e,t,i,s){return tt.generate(e,t,i,s)}request(e,t=null){return new qg(this.makeRequest(e,t))}async makeRequest(e,t){let i=await e,s=i.maxRetries??this.maxRetries;t==null&&(t=s),await this.prepareOptions(i);let{req:n,url:a,timeout:o}=await this.buildRequest(i,{retryCount:s-t});if(await this.prepareRequest(n,{url:a,options:i}),Nn("request",a,i,n.headers),i.signal?.aborted)throw new Ia;let l=new AbortController,c=await this.fetchWithTimeout(a,n,o,l).catch(Og);if(c instanceof Error){if(i.signal?.aborted)throw new Ia;if(t)return this.retryRequest(i,t);throw c.name==="AbortError"?new fc:new En({cause:c})}let d=cL(c.headers);if(!c.ok){if(t&&this.shouldRetry(c)){let b=`retrying, ${t} attempts remaining`;return Nn(`response (error; ${b})`,c.status,a,d),this.retryRequest(i,t,d)}let p=await c.text().catch(b=>Og(b).message),m=hL(p),h=m?void 0:p;throw Nn(`response (error; ${t?"(error; no more retries left)":"(error; not retryable)"})`,c.status,a,d,h),this.makeStatusError(c.status,m,h,d)}return{response:c,options:i,controller:l}}requestAPIList(e,t){let i=this.makeRequest(t,null);return new w5(this,i,e)}buildURL(e,t,i){let s=!dA(this,Lg,"f")&&i||this.baseURL,n=gL(e)?new URL(e):new URL(s+(s.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return uA(a)||(t={...a,...t}),typeof t=="object"&&t&&!Array.isArray(t)&&(n.search=this.stringifyQuery(t)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([t,i])=>typeof i<"u").map(([t,i])=>{if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(i)}`;if(i===null)return`${encodeURIComponent(t)}=`;throw new Ft(`Cannot stringify type ${typeof i}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,t,i,s){let{signal:n,...a}=t||{};n&&n.addEventListener("abort",()=>s.abort());let o=setTimeout(()=>s.abort(),i),l={signal:s.signal,...a};return l.method&&(l.method=l.method.toUpperCase()),this.fetch.call(void 0,e,l).finally(()=>{clearTimeout(o)})}shouldRetry(e){let t=e.headers.get("x-should-retry");return t==="true"?!0:t==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,i){let s,n=i?.["retry-after-ms"];if(n){let o=parseFloat(n);Number.isNaN(o)||(s=o)}let a=i?.["retry-after"];if(a&&!s){let o=parseFloat(a);Number.isNaN(o)?s=Date.parse(a)-Date.now():s=o*1e3}if(!(s&&0<=s&&s<60*1e3)){let o=e.maxRetries??this.maxRetries;s=this.calculateDefaultRetryTimeoutMillis(t,o)}return await yL(s),this.makeRequest(e,t-1)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,a=Math.min(.5*Math.pow(2,n),8),o=1-Math.random()*.25;return a*o*1e3}getUserAgent(){return`${this.constructor.name}/JS ${fa}`}};Lg=new WeakMap;var sA=class{constructor(e,t,i,s){$g.set(this,void 0),cA(this,$g,e,"f"),this.options=s,this.response=t,this.body=i}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new Ft("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let t={...this.options};if("params"in e&&typeof t.query=="object")t.query={...t.query,...e.params};else if("url"in e){let i=[...Object.entries(t.query||{}),...e.url.searchParams.entries()];for(let[s,n]of i)e.url.searchParams.set(s,n);t.query=void 0,t.path=e.url.toString()}return await dA(this,$g,"f").requestAPIList(this.constructor,t)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[($g=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},w5=class extends qg{constructor(e,t,i){super(t,async s=>new i(e,s.response,await pA(s),s.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},cL=r=>new Proxy(Object.fromEntries(r.entries()),{get(e,t){let i=t.toString();return e[i.toLowerCase()]||e[i]}}),dL={method:!0,path:!0,query:!0,body:!0,headers:!0,defaultBaseURL:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},b5=r=>typeof r=="object"&&r!==null&&!uA(r)&&Object.keys(r).every(e=>mA(dL,e)),pL=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":fa,"X-Stainless-OS":aA(Deno.build.os),"X-Stainless-Arch":nA(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":fa,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":fa,"X-Stainless-OS":aA(process.platform),"X-Stainless-Arch":nA(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let r=uL();return r?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":fa,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${r.browser}`,"X-Stainless-Runtime-Version":r.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":fa,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function uL(){if(typeof navigator>"u"||!navigator)return null;let r=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of r){let i=t.exec(navigator.userAgent);if(i){let s=i[1]||0,n=i[2]||0,a=i[3]||0;return{browser:e,version:`${s}.${n}.${a}`}}}return null}var nA=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",aA=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),oA,mL=()=>oA??(oA=pL()),hL=r=>{try{return JSON.parse(r)}catch{return}},fL=/^[a-z][a-z0-9+.-]*:/i,gL=r=>fL.test(r),yL=r=>new Promise(e=>setTimeout(e,r)),y5=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Ft(`${r} must be an integer`);if(e<0)throw new Ft(`${r} must be a positive integer`);return e},Og=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null)try{return new Error(JSON.stringify(r))}catch{}return new Error(r)};var v5=r=>{if(typeof process<"u")return process.env?.[r]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(r)?.trim()};function uA(r){if(!r)return!0;for(let e in r)return!1;return!0}function mA(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function lA(r,e){for(let t in e){if(!mA(e,t))continue;let i=t.toLowerCase();if(!i)continue;let s=e[t];s===null?delete r[i]:s!==void 0&&(r[i]=s)}}function Nn(r,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Cerebras:DEBUG:${r}`,...e)}var wL=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)});var bL=r=>typeof r?.get=="function";var Fg=(r,e)=>{let t=e.toLowerCase();if(bL(r)){let i=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(s,n,a)=>n+a.toUpperCase());for(let s of[e,t,e.toUpperCase(),i]){let n=r.get(s);if(n)return n}}for(let[i,s]of Object.entries(r))if(i.toLowerCase()===t)return Array.isArray(s)?(s.length<=1||console.warn(`Received ${s.length} entries for the ${e} header, using the first entry.`),s[0]):s};var Fi=class{constructor(e){this._client=e}};var yc=class extends Fi{create(e,t){let{"CF-RAY":i,"X-Amz-Cf-Id":s,"X-delay-time":n,...a}=e;return this._client.post("/v1/chat/completions",{body:a,...t,stream:a.stream??!1,headers:{...i!=null?{"CF-RAY":i}:void 0,...s!=null?{"X-Amz-Cf-Id":s}:void 0,...n?.toString()!=null?{"X-delay-time":n?.toString()}:void 0,...t?.headers}})}};var Cn=class extends Fi{constructor(){super(...arguments),this.completions=new yc(this._client)}};Cn.Completions=yc;var Pa=class extends Fi{create(e,t){let{"CF-RAY":i,"X-Amz-Cf-Id":s,"X-delay-time":n,...a}=e;return this._client.post("/v1/completions",{body:a,...t,stream:a.stream??!1,headers:{...i!=null?{"CF-RAY":i}:void 0,...s!=null?{"X-Amz-Cf-Id":s}:void 0,...n?.toString()!=null?{"X-delay-time":n?.toString()}:void 0,...t?.headers}})}};var Oa=class extends Fi{retrieve(e,t={},i){if(b5(t))return this.retrieve(e,{},t);let{"CF-RAY":s,"X-Amz-Cf-Id":n}=t;return this._client.get(`/v1/models/${e}`,{...i,headers:{...s!=null?{"CF-RAY":s}:void 0,...n!=null?{"X-Amz-Cf-Id":n}:void 0,...i?.headers}})}list(e={},t){if(b5(e))return this.list({},e);let{"CF-RAY":i,"X-Amz-Cf-Id":s}=e;return this._client.get("/v1/models",{...t,headers:{...i!=null?{"CF-RAY":i}:void 0,...s!=null?{"X-Amz-Cf-Id":s}:void 0,...t?.headers}})}};var hA,fA,TL,Ne=class extends Bg{constructor({baseURL:e=v5("CEREBRAS_BASE_URL"),apiKey:t=v5("CEREBRAS_API_KEY"),warmTCPConnection:i=!0,...s}={}){if(t===void 0)throw new Ft("The CEREBRAS_API_KEY environment variable is missing or empty; either provide it, or instantiate the Cerebras client with an apiKey option, like new Cerebras({ apiKey: 'My API Key' }).");let n={apiKey:t,...s,baseURL:e||"https://api.cerebras.ai"};super({baseURL:n.baseURL,baseURLOverridden:e?e!=="https://api.cerebras.ai":!1,timeout:n.timeout??6e4,httpAgent:n.httpAgent,maxRetries:n.maxRetries,fetch:n.fetch}),hA.add(this),this.chat=new Cn(this),this.completions=new Pa(this),this.models=new Oa(this),this._options=n,this.apiKey=t,i&&(async()=>{try{await this.get("/v1/tcp_warming",{timeout:1e3,maxRetries:0})}catch(a){Nn(`TCP Warming had exception: ${a}`)}})()}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}};fA=Ne,hA=new WeakSet,TL=function(){return this.baseURL!=="https://api.cerebras.ai"};Ne.Cerebras=fA;Ne.DEFAULT_TIMEOUT=6e4;Ne.CerebrasError=Ft;Ne.APIError=tt;Ne.APIConnectionError=En;Ne.APIConnectionTimeoutError=fc;Ne.APIUserAbortError=Ia;Ne.NotFoundError=Zp;Ne.ConflictError=eu;Ne.RateLimitError=ru;Ne.BadRequestError=Jp;Ne.AuthenticationError=Xp;Ne.InternalServerError=iu;Ne.PermissionDeniedError=Yp;Ne.UnprocessableEntityError=tu;Ne.toFile=iA;Ne.fileFromPath=$0;Ne.Chat=Cn;Ne.Completions=Pa;Ne.Models=Oa;Ot();fl();var Wg=class{client;constructor(e){this.client=new Ne({apiKey:e})}async createMessage(e){try{let s=(await this.client.chat.completions.create({model:e.model,messages:this.convertMessages(e.messages),tools:this.convertTools(e.tools),max_tokens:e.max_tokens||1024})).choices[0].message;return s.tool_calls&&s.tool_calls.length>0?{role:"assistant",content:s.content||"",tool_uses:s.tool_calls.map(n=>({id:n.id,name:n.function.name,input:_t.safeParseJson(n.function.arguments)}))}:{role:"assistant",content:s.content||""}}catch(t){throw new Error(`Cerebras API Error: ${Yt(t)}`)}}async createMessageStream(e,t,i){let s=Date.now();t({type:"run_started",timestamp:s}),t({type:"stage_change",stage:"thinking",label:"Processing request..."});try{let n=await this.client.chat.completions.create({model:e.model,messages:this.convertMessages(e.messages),tools:this.convertTools(e.tools),max_tokens:e.max_tokens||1024,stream:!0},{abortSignal:i}),a=[],o={},l=!1;for await(let h of n){if(i?.aborted)throw new Error("Cerebras request aborted by user.");let w=h.choices[0]?.delta;if(w){if(w.content&&(l||(l=!0,t({type:"stage_change",stage:"responding",label:"Generating response..."})),a.push(w.content),t({type:"content_delta",text:w.content})),w.tool_calls){t({type:"stage_change",stage:"calling_tool",label:"Using tool..."});for(let b of w.tool_calls){let v=b.index;b.id&&(o[v]={id:b.id,name:b.function?.name||"",inputParts:[]},t({type:"tool_call_delta",index:v,id:b.id,name:b.function?.name})),b.function?.arguments&&(o[v]&&o[v].inputParts.push(b.function.arguments),t({type:"tool_call_delta",index:v,argumentsDelta:b.function.arguments}))}}if(h.usage){let b=h.usage;t({type:"usage",usage:{inputTokens:b.prompt_tokens,outputTokens:b.completion_tokens,totalTokens:b.total_tokens}})}}}let c=Date.now();t({type:"run_completed",timestamp:c,durationMs:c-s});let d=a.join(""),p=Object.values(o).map(h=>({id:h.id,name:h.name,input:_t.safeParseJson(h.inputParts.join(""))})),m=[];return d&&m.push({type:"text",text:d}),{role:"assistant",content:m.length>0?m:d,tool_uses:p.length>0?p:void 0}}catch(n){throw new Error(`Cerebras Stream Error: ${Yt(n)}`)}}estimateTokens(e){return Math.ceil(e.length*V.getTokensPerChar())}async listModels(){return[{id:"llama3.1-8b",name:"Llama 3.1 8B"},{id:"llama3.1-70b",name:"Llama 3.1 70B"}]}async createEmbedding(e){return new Array(1024).fill(0)}convertMessages(e){return e.map(t=>{if(Array.isArray(t.content)){let i=t.content.map(a=>a.type==="text"?{type:"text",text:a.text}:a),s=t.content.filter(a=>a.type==="text").map(a=>a.text).join(""),n=t.content.find(a=>a.type==="tool_result");return n?{role:"tool",tool_call_id:n.tool_use_id,content:typeof n.content=="string"?n.content:JSON.stringify(n.content)}:{role:t.role,content:s}}return{role:t.role,content:t.content}})}convertTools(e){if(e)return e.map(t=>({type:"function",function:{name:t.name,description:t.description,parameters:t.input_schema}}))}};function gA(r,e){return r==="openrouter"?new O0(e):r==="cerebras"?new Wg(e):new M0(e)}var zg=class{constructor(e){this.runtime=e}onStateChanged(e){return this.runtime.onStateChanged(e)}async createSession(){return this.runtime.createSession()}async listSessions(){return this.runtime.listSessions()}async loadSession(e){return this.runtime.loadSession(e)}async deleteSession(e){await this.runtime.deleteSession(e)}async renameSession(e,t){await this.runtime.renameSession(e,t)}async togglePinSession(e){await this.runtime.togglePinSession(e)}async handleMessage(e,t){return this.runtime.handleMessage(e,t)}async clearCurrentSession(){await this.runtime.clearCurrentSession()}stopGeneration(){this.runtime.stopGeneration()}updateSettings(){this.runtime.updateSettings()}async getModels(){return this.runtime.getModels()}getMessages(){return this.runtime.getMessages()}getCurrentSessionId(){return this.runtime.getCurrentSessionId()}getSequenceNumber(){return this.runtime.getSequenceNumber()}getCurrentRun(){return this.runtime.getCurrentRun()}resolveApproval(e,t){return this.runtime.resolveApproval(e,t)}dispose(){this.runtime.dispose()}};Xt();var Ug=class{type="vscode";async readFile(e,t){return ta(e,void 0,void 0,t)}async writeFile(e,t,i,s){return Mr(e,t,i,void 0,s)}async appendFile(e,t,i,s){return sw(e,t,i,s)}async deleteFile(e,t){return hl(e,t)}async backupFile(e,t){return nw(e,t)}async restoreFile(e,t){return uf(e,t)}async rollbackAll(e){return Od(e)}clearBackups(){aw()}};var Ts=k(require("fs"),1),_5=k(require("path"),1),yA=k(require("os"),1);ur();var T5=_5.join(yA.homedir(),".marie"),S5=_5.join(T5,"config.json"),x5={aiProvider:"openrouter",model:"anthropic/claude-3.5-sonnet",maxContextTokens:1e5,ascensionEnabled:!0,ascensionProfile:"balanced",ascensionIntensity:1,ascensionMaxRequiredActions:2,autonomyMode:"high"},ui=class{static MarieMindReady=Q.initialize();static ensureDir(){Ts.existsSync(T5)||Ts.mkdirSync(T5,{recursive:!0})}static getConfig(){if(this.ensureDir(),!Ts.existsSync(S5))return{...x5};try{let e=Ts.readFileSync(S5,"utf-8"),t=JSON.parse(e),i={...x5,...t};return t.autonomyMode||(i.autonomyMode="high"),i}catch{return{...x5}}}static saveConfig(e){this.ensureDir();let t=this.getConfig();Ts.writeFileSync(S5,JSON.stringify({...t,...e},null,2))}static async getSessions(){await this.MarieMindReady;let i=await(await Q.getInstance()).getRepository("sessions").objects.all(),s={};for(let n of i){let{sessionId:a,role:o,content:l,metadata:c}=n;s[a]||(s[a]=[]),s[a].push({role:o,content:l,...c})}return s}static async saveSessions(e){await this.MarieMindReady;let t=await Q.getInstance();await t.execute("DELETE FROM sessions");let i=t.getRepository("sessions");for(let[s,n]of Object.entries(e))for(let a of n){let{role:o,content:l,...c}=a;await i.create({sessionId:s,role:o,content:l,metadata:c})}}static async getSessionMetadata(){return await this.MarieMindReady,await(await Q.getInstance()).getRepository("session_metadata").objects.order_by("-lastModified").all()}static async saveSessionMetadata(e){await this.MarieMindReady;let t=await Q.getInstance();await t.execute("DELETE FROM session_metadata");let i=t.getRepository("session_metadata");for(let s of e)await i.create(s)}static async getCurrentSessionId(){return await this.MarieMindReady,(await(await Q.getInstance()).getRepository("current_session").objects.first())?.id||"default"}static async setCurrentSessionId(e){await this.MarieMindReady;let t=await Q.getInstance();await t.execute("DELETE FROM current_session"),await t.getRepository("current_session").create({id:e})}static async getLastTelemetry(){return await this.MarieMindReady,(await(await Q.getInstance()).getRepository("telemetry").objects.filter({key:"last_telemetry"}).first())?.value}static async setLastTelemetry(e){await this.MarieMindReady;let t=await Q.getInstance(),i=t.getRepository("telemetry"),s=await i.objects.filter({key:"last_telemetry"}).first(),n=JSON.stringify(e).replace(/'/g,"''");s?await t.execute(`UPDATE telemetry SET value = '${n}' WHERE key = 'last_telemetry'`):await i.create({key:"last_telemetry",value:e})}};var E5=class{getAiProvider(){return V.getAiProvider()}getApiKey(e){return e==="openrouter"?V.getOpenRouterApiKey()||"":e==="cerebras"?V.getCerebrasApiKey()||"":V.getApiKey()||""}},N5=class{constructor(e){this.context=e}async getSessions(){return await ui.getSessions()}async saveSessions(e){await ui.saveSessions(e)}async getSessionMetadata(){return await ui.getSessionMetadata()}async saveSessionMetadata(e){await ui.saveSessionMetadata(e)}async getCurrentSessionId(){return await ui.getCurrentSessionId()}async setCurrentSessionId(e){await ui.setCurrentSessionId(e)}async getLastTelemetry(){return await ui.getLastTelemetry()}async setLastTelemetry(e){await ui.setLastTelemetry(e)}},jg=class extends zg{constructor(t,i){let s=new $f(t,i);process.env.MARIE_EXTENSION_TESTS||s.startAutonomousHeartbeat();let n=new e0({config:new E5,sessionStore:new N5(t),toolRegistrar:zT,providerFactory:gA,automationService:s,onProgressEvent:a=>this.joyService.fireRunProgress(a),shouldBypassApprovals:()=>V.getAutonomyMode()!=="balanced",fs:new Ug,ghostPort:{handleDelta:(a,o,l)=>Cl.handleDelta(a,o,l)}});super(n);this.context=t;this.joyService=i}dispose(){super.dispose()}};var ke=k(require("vscode"),1);ia();en();var Vg=class{constructor(e,t){this.context=e;this.joyLog=t;this.statusBarItem=ke.window.createStatusBarItem(ke.StatusBarAlignment.Right,100),this.persistenceStatusBarItem=ke.window.createStatusBarItem(ke.StatusBarAlignment.Right,101),e.subscriptions.push(this.statusBarItem),e.subscriptions.push(this.persistenceStatusBarItem),e.subscriptions.push(this.onRunProgress(i=>{if(i.type==="session_persistence_update"&&i.totalBytes!==void 0){let s=(i.totalBytes/1024).toFixed(1);this.persistenceStatusBarItem.text=`$(sync~spin) ${s} KB`,this.persistenceStatusBarItem.tooltip=`Marie Session Persistence: ${s} KB written to log.`,this.persistenceStatusBarItem.show()}else(i.type==="run_completed"||i.type==="run_error")&&this.persistenceStatusBarItem.hide()})),this.intention=e.workspaceState.get("marie.intention")||null,process.env.MARIE_EXTENSION_TESTS||(e.subscriptions.push(ke.window.onDidChangeActiveTextEditor(()=>this.updateJoyStatus())),e.subscriptions.push(ke.workspace.onDidSaveTextDocument(async i=>{await this.updateJoyStatus(),ke.workspace.getConfiguration("marie").get("strictMode")&&(await rs(i.fileName)).zoningHealth?.isBackflowPresent&&ke.window.showWarningMessage(`\u26A0\uFE0F Strict Mode: Zoning Violation detected in ${ke.workspace.asRelativePath(i.fileName)}. Please respect the Downward Flow Law.`)})),this.updateJoyStatus())}statusBarItem;persistenceStatusBarItem;_onJoyScoreChange=new ke.EventEmitter;onJoyScoreChange=this._onJoyScoreChange.event;_onRunProgress=new ke.EventEmitter;onRunProgress=this._onRunProgress.event;intention=null;_lastProjectScore=null;async addAchievement(e,t=10){return await this.joyLog.addAchievement(e,t)}async setIntention(e){this.intention=e,await this.context.workspaceState.update("marie.intention",e),this.updateJoyStatus()}async getProjectHealth(){let e=ke.workspace.workspaceFolders?.[0].uri.fsPath;if(!e)return null;let t=await ke.workspace.findFiles("**/*.{ts,js,tsx,jsx}","**/node_modules/**",100),i=0,s=0,n=0,a=0,o=0,l=[];for(let m of t.slice(0,30))try{let h=await rs(m.fsPath);i+=h.joyScore,s++,h.zoningHealth?.isBackflowPresent&&n++,h.zoningHealth?.migrationNeed?.shouldMigrate&&l.push({file:ke.workspace.asRelativePath(m),reason:h.zoningHealth.migrationNeed.reason||"Conceptual drift detected."}),m.fsPath.includes("/domain/")?a++:m.fsPath.includes("/plumbing/")&&o++}catch{}let c=s>0?Math.round(i/s):100,d=await $d(e),p=await wl(e);return this._lastProjectScore!==null&&c>this._lastProjectScore&&await this.joyLog.addAchievement(`Project health improved to ${c}! \u2728`,50),this._lastProjectScore=c,{average:c,fileCount:s,log:this.joyLog.getLog(),zoningViolations:n,joyfulFiles:a,plumbingFiles:o,migrationAlerts:l,clusteringAlerts:d,isJoyful:p}}_onLettingGoRequest=new ke.EventEmitter;onLettingGoRequest=this._onLettingGoRequest.event;async requestLettingGo(e){let t=0;try{t=(await ke.workspace.fs.readFile(ke.Uri.file(e))).toString().split(`
1105
- `).length}catch{}this._onLettingGoRequest.fire({path:e,lines:t})}async updateJoyStatus(){let e=ke.window.activeTextEditor,t="",i="";if(this.intention&&(t=`$(heart) Intention: ${this.intention} `,i+=`Current Intention: ${this.intention}
1106
-
1107
- `),!e){this.intention?(this.statusBarItem.text=t,this.statusBarItem.tooltip=i,this.statusBarItem.show()):this.statusBarItem.hide();return}let s=e.document;if(s.uri.scheme==="file"&&this.isSupportedFile(s.fileName))try{let n=await rs(s.fileName),a=n.joyScore;a===100&&await this.joyLog.addAchievement(`Reached 100% Joy in ${ke.workspace.asRelativePath(s.fileName)}! \u2764\uFE0F`,20);let o="$(sparkle)";a===100?o="$(heart)":a>=80?o="$(sparkle)":a>=50?o="$(warning)":o="$(trash)",t+=`${o} Joy: ${a}`,i+=`Joy Status: ${n.joyStatus}
1108
-
1109
- ${n.tips.join(`
1110
- `)}`,this._onJoyScoreChange.fire({score:a,status:n.joyStatus,tips:n.tips})}catch{}t?(this.statusBarItem.text=t,this.statusBarItem.tooltip=i,this.statusBarItem.show()):this.statusBarItem.hide()}isSupportedFile(e){return e.endsWith(".ts")||e.endsWith(".js")||e.endsWith(".tsx")||e.endsWith(".jsx")}fireRunProgress(e){this._onRunProgress.fire(e)}dispose(){this.statusBarItem.dispose(),this._onJoyScoreChange.dispose(),this._onLettingGoRequest.dispose(),this._onRunProgress.dispose()}};var wA=k(require("vscode"),1),Hg=class r{constructor(e){this.context=e;this._loadLog()}static STORAGE_KEY="marie.joyLog";_log=[];_onAchievementAdded=new wA.EventEmitter;onAchievementAdded=this._onAchievementAdded.event;_loadLog(){let e=this.context.globalState.get(r.STORAGE_KEY);this._log=e||[]}async addAchievement(e,t=10){let i={id:Math.random().toString(36).substring(7),description:e,timestamp:Date.now(),points:t};return this._log.unshift(i),this._log.length>100&&(this._log=this._log.slice(0,100)),await this.context.globalState.update(r.STORAGE_KEY,this._log),this._onAchievementAdded.fire(i),i}getLog(){return this._log}getStats(){return{totalPoints:this._log.reduce((t,i)=>t+i.points,0),count:this._log.length,recent:this._log.slice(0,5)}}async clearLog(){this._log=[],await this.context.globalState.update(r.STORAGE_KEY,[])}};Ot();var bA=require("child_process"),vA=require("util"),_L=(0,vA.promisify)(bA.exec),Qg=class{static NPM_REGISTRY="https://registry.npmjs.org/@noorm/marie-cli/latest";static async checkUpdate(e){try{let t=await fetch(this.NPM_REGISTRY,{method:"GET",headers:{Accept:"application/json","User-Agent":"marie-cli-update-check"}});if(!t.ok)throw new Error(`Failed to fetch latest version: ${t.statusText}`);let s=(await t.json()).version;if(!s)throw new Error("Invalid response from NPM registry: missing version");let n=this.isNewer(s,e);return{currentVersion:e,latestVersion:s,isUpdateAvailable:n}}catch(t){return console.error("[UpdateService] Update check failed:",t),null}}static isNewer(e,t){let i=e.split(".").map(Number),s=t.split(".").map(Number);for(let n=0;n<3;n++){if(i[n]>s[n])return!0;if(i[n]<s[n])return!1}return!1}static async performUpdate(){try{return console.log("[UpdateService] Attempting to update..."),await _L("npm install -g @noorm/marie-cli"),!0}catch(e){return console.error("[UpdateService] Update failed:",e),!1}}};var wc,C5,tr,Lr,A5=class{constructor(e,t){this.context=e;this.marieInstance=t;this.stateSubscription=this.marieInstance.onStateChanged(i=>{this.pushState(i)})}webviews=new Set;stateSubscription;attach(e){console.log("[MarieHost] Attaching new webview"),this.webviews.add(e),e.options={enableScripts:!0,localResourceRoots:[le.Uri.joinPath(this.context.extensionUri,"dist","webview-ui"),le.Uri.joinPath(this.context.extensionUri,"assets")]};let t=le.Uri.joinPath(this.context.extensionUri,"dist","webview-ui","main.js");le.workspace.fs.stat(t).then(()=>{},()=>{le.window.showErrorMessage("Marie webview bundle missing (dist/webview-ui/main.js). Run `npm run build` and reinstall the extension.")}),e.html=this.getHtml(e),e.onDidReceiveMessage(i=>this.onMessage(i)),this.pushInitState(e).catch(()=>{})}detach(e){this.webviews.delete(e)}dispose(){this.stateSubscription&&(this.stateSubscription(),this.stateSubscription=void 0)}post(e){let t={...e,sequenceNumber:this.marieInstance.getSequenceNumber()};for(let i of this.webviews)i.postMessage(t)}async pushState(e){let t=this.getConfigSnapshot(),i=await this.marieInstance.listSessions(),s=e.messages.map((n,a)=>({id:`hist_${a}`,role:n.role||"assistant",content:this.extractMessageText(n),timestamp:n.timestamp||Date.now()}));this.post({type:"init_state",state:{messages:s,config:t,currentSessionId:e.currentSessionId,sessions:i,availableModels:await this.marieInstance.getModels(),sequenceNumber:e.sequenceNumber}})}async onMessage(e){switch(console.log("[MarieHost] Received message from webview:",e?.type),e?.type){case"ready":await this.pushInitState();return;case"send_message":await this.handleSendMessage(String(e.text||""));return;case"stop_generation":this.marieInstance.stopGeneration(),this.post({type:"status",isLoading:!1});return;case"approval_response":e.id&&typeof e.approved=="boolean"&&this.marieInstance.resolveApproval(String(e.id),!!e.approved);return;case"create_session":await this.marieInstance.createSession(),await this.pushInitState();return;case"clear_session":await this.marieInstance.clearCurrentSession(),await this.pushInitState();return;case"list_sessions":await this.pushSessions();return;case"load_session":e.id&&(await this.marieInstance.loadSession(String(e.id)),await this.pushInitState());return;case"delete_session":e.id&&(await this.marieInstance.deleteSession(String(e.id)),await this.pushInitState());return;case"rename_session":e.id&&e.title&&(await this.marieInstance.renameSession(String(e.id),String(e.title)),await this.pushSessions());return;case"toggle_pin_session":e.id&&(await this.marieInstance.togglePinSession(String(e.id)),await this.pushSessions());return;case"get_models":this.post({type:"models",models:await this.marieInstance.getModels()});return;case"set_provider":await this.setProvider(String(e.provider||"anthropic"));return;case"set_model":await this.setModel(String(e.model||""));return;case"set_autonomy_mode":await this.setAutonomyMode(String(e.mode||"balanced"));return;case"set_api_key":await this.setApiKey(String(e.provider||"anthropic"),String(e.apiKey||""));return;case"open_settings":await le.commands.executeCommand("workbench.action.openSettings","@ext:cardsorting.marie");return;default:return}}async handleSendMessage(e){let t=e.trim();if(t){this.post({type:"status",isLoading:!0}),this.post({type:"user_echo",text:t});try{let i=await this.marieInstance.handleMessage(t,{onStream:s=>{this.post({type:"message_stream",chunk:s})},onTool:s=>{this.post({type:"tool_event",tool:s})},onToolDelta:s=>{this.post({type:"tool_delta",delta:s})},onApprovalRequest:s=>{this.post({type:"approval_request",request:s})},onEvent:s=>{this.post({type:"runtime_event",event:s})}});this.post({type:"assistant_response",text:i})}catch(i){this.post({type:"error",message:String(i)})}finally{this.post({type:"status",isLoading:!1}),await this.pushSessions()}}}async setAutonomyMode(e){let t=e==="yolo"||e==="high"?e:"balanced";await le.workspace.getConfiguration("marie").update("autonomyMode",t,le.ConfigurationTarget.Global),this.marieInstance.updateSettings(),this.post({type:"config",config:this.getConfigSnapshot()})}async setProvider(e){let t=e==="openrouter"||e==="cerebras"?e:"anthropic",i=le.workspace.getConfiguration("marie"),s=V.getModel(),n;t==="openrouter"?n="anthropic/claude-3.5-sonnet":t==="cerebras"?n="llama3.1-8b":n="claude-3-5-sonnet-20241022";let a=!this.isModelCompatibleWithProvider(s,t);await i.update("aiProvider",t,le.ConfigurationTarget.Global),a&&await i.update("model",n,le.ConfigurationTarget.Global),this.marieInstance.updateSettings(),this.post({type:"config",config:this.getConfigSnapshot()}),this.post({type:"models",models:await this.marieInstance.getModels()})}isModelCompatibleWithProvider(e,t){return t==="anthropic"?e.startsWith("claude-"):t==="openrouter"?e.includes("/")||e.startsWith("llama-")||e.startsWith("gpt-"):t==="cerebras"?e.startsWith("llama-"):!1}async setModel(e){let t=e.trim();if(!t)return;await le.workspace.getConfiguration("marie").update("model",t,le.ConfigurationTarget.Global),this.marieInstance.updateSettings(),this.post({type:"config",config:this.getConfigSnapshot()})}async setApiKey(e,t){let i=e==="openrouter"||e==="cerebras"?e:"anthropic",s=t.trim();if(!s)return;let n=le.workspace.getConfiguration("marie"),a=i==="openrouter"?"openrouterApiKey":i==="cerebras"?"cerebrasApiKey":"apiKey";await n.update(a,s,le.ConfigurationTarget.Global),this.marieInstance.updateSettings(),this.post({type:"config",config:this.getConfigSnapshot()}),this.post({type:"models",models:await this.marieInstance.getModels()})}async pushInitState(e){console.log("[MarieHost] Pushing initial state...");let t=this.getConfigSnapshot(),i=this.getUiMessages(),s=await this.marieInstance.listSessions(),n=this.marieInstance.getCurrentSessionId(),a={type:"init_state",state:{messages:i,config:t,currentSessionId:n,sessions:s,availableModels:await this.marieInstance.getModels()}};e?e.postMessage(a):this.post(a)}async pushSessions(){let e=await this.marieInstance.listSessions();this.post({type:"sessions",sessions:e,currentSessionId:this.marieInstance.getCurrentSessionId()})}getConfigSnapshot(){let e=V.getAiProvider(),t=e==="openrouter"?V.getOpenRouterApiKey():e==="cerebras"?V.getCerebrasApiKey():V.getApiKey();return{provider:e,model:V.getModel(),autonomyMode:V.getAutonomyMode(),hasAnyApiKey:!!(V.getApiKey()||V.getOpenRouterApiKey()||V.getCerebrasApiKey()),hasProviderApiKey:!!t}}getUiMessages(){return this.marieInstance.getMessages().map((e,t)=>({id:`hist_${t}`,role:e.role||"assistant",content:this.extractMessageText(e),timestamp:Date.now()}))}extractMessageText(e){if(typeof e?.content=="string")return e.content;if(!Array.isArray(e?.content))return String(e?.content??"");let t=[];for(let i of e.content)if(i?.type==="text")t.push(i.text||"");else if(i?.type==="tool_use")t.push(`[Tool Use: ${i.name}]`);else if(i?.type==="tool_result"){let s=typeof i.content=="string"?i.content:JSON.stringify(i.content),n=s.length>100?s.substring(0,100)+"...":s;t.push(`[Tool Result: ${n}]`)}return t.join(`
1111
- `).trim()||"(empty content)"}getHtml(e){let t=e.asWebviewUri(le.Uri.joinPath(this.context.extensionUri,"dist","webview-ui","main.js")),i=e.asWebviewUri(le.Uri.joinPath(this.context.extensionUri,"dist","webview-ui","main.css")),s=`${Date.now()}${Math.random().toString(36).slice(2)}`;return`<!DOCTYPE html>
1112
- <html lang="en">
1113
- <head>
1114
- <meta charset="UTF-8" />
1115
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1116
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src ${e.cspSource} https: data:; style-src ${e.cspSource} 'unsafe-inline'; script-src ${e.cspSource} 'nonce-${s}';" />
1117
- <link rel="stylesheet" type="text/css" href="${i}" />
1118
- <title>Marie</title>
1119
- </head>
1120
- <body>
1121
- <div id="app" style="padding:12px;font-family:var(--vscode-font-family);color:var(--vscode-foreground);">Loading Marie UI\u2026</div>
1122
- <script nonce="${s}">
1123
- try {
1124
- const el = document.getElementById('app');
1125
- if (el) el.textContent = 'Marie script bootstrapping\u2026';
1126
- } catch {}
1127
- </script>
1128
- <script nonce="${s}" src="${t}"></script>
1129
- </body>
1130
- </html>`}},Gg=class{static viewType="marieView";resolveWebviewView(e){Lr?.attach(e.webview),Lr?.pushInitState?.(e.webview),e.onDidDispose(()=>{Lr?.detach(e.webview)})}};function EL(r){return tr?(tr.reveal(le.ViewColumn.Beside),tr):(tr=le.window.createWebviewPanel("marieUi","Marie",le.ViewColumn.Beside,{enableScripts:!0,retainContextWhenHidden:!0}),Lr?.attach(tr.webview),Lr?.pushInitState?.(tr.webview),tr.onDidDispose(()=>{tr&&Lr?.detach(tr.webview),tr=void 0},null,r.subscriptions),tr)}function NL(r){console.log("[Marie] Activating extension...");let e=new Hg(r);console.log("[Marie] JoyLogService initialized"),C5=new Vg(r,e),console.log("[Marie] JoyService initialized"),wc=new jg(r,C5),console.log("[Marie] Marie adapter initialized"),Lr=new A5(r,wc),console.log("[Marie] MarieWebviewHost initialized");let t=r.extension.packageJSON.version;Qg.checkUpdate(t).then(n=>{n?.isUpdateAvailable&&le.window.showInformationMessage(`A new version of Marie (${n.latestVersion}) is available.`,"Update Now","View Release Notes").then(a=>{(a==="Update Now"||a==="View Release Notes")&&le.env.openExternal(le.Uri.parse("https://github.com/DreamBeesAI/Marie-Coder-New-the-vatican/releases"))})});let i=le.commands.registerCommand("marie.start",()=>EL(r)),s=le.window.registerWebviewViewProvider(Gg.viewType,new Gg);return r.subscriptions.push(i),r.subscriptions.push(s),r.subscriptions.push(wc),console.log("[Marie] Commands and providers registered"),{getWebviewHtml:()=>Lr?.getHtml?.call(Lr,{asWebviewUri:n=>n,cspSource:"vscode-resource:"})}}function CL(){tr&&(tr.dispose(),tr=void 0),Lr&&(Lr.dispose(),Lr=void 0),wc&&(wc.dispose(),wc=void 0),C5=void 0}0&&(module.exports={activate,deactivate});
1131
- /*! Bundled license information:
1132
-
1133
- web-streams-polyfill/dist/ponyfill.mjs:
1134
- (**
1135
- * @license
1136
- * web-streams-polyfill v4.0.0-beta.3
1137
- * Copyright 2021 Mattias Buelens, Diwank Singh Tomer and other contributors.
1138
- * This code is released under the MIT license.
1139
- * SPDX-License-Identifier: MIT
1140
- *)
1141
-
1142
- formdata-node/lib/esm/blobHelpers.js:
1143
- formdata-node/lib/esm/Blob.js:
1144
- (*! Based on fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> & David Frank *)
1145
-
1146
- humanize-ms/index.js:
1147
- (*!
1148
- * humanize-ms - index.js
1149
- * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
1150
- * MIT Licensed
1151
- *)
1152
-
1153
- node-domexception/index.js:
1154
- (*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
1155
- */