@inkeep/open-knowledge 0.47.0-beta.6 → 0.47.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/{acp-harness-probe-CFPC18hA.mjs → acp-harness-probe-1hW3PL5n.mjs} +2 -2
  2. package/dist/cli.mjs +57 -57
  3. package/dist/config-schema.json +35 -1
  4. package/dist/config.user.schema.json +35 -1
  5. package/dist/constants-DIYjBPRr.mjs +2 -0
  6. package/dist/{fs-traced-D12ehU8a.mjs → fs-traced-ArlA_yTp.mjs} +2 -2
  7. package/dist/fs-traced-C9U9YUGm.mjs +1 -0
  8. package/dist/{git-handle-CllEzrX4.mjs → git-handle-B9cFlvR2.mjs} +2 -2
  9. package/dist/git-handle-pq-bTXGz.mjs +1 -0
  10. package/dist/index.d.mts +39 -19
  11. package/dist/index.mjs +1 -1
  12. package/dist/init-Bz1EZDov.mjs +1 -0
  13. package/dist/{init-DlyS-AcQ.mjs → init-D8sYk3tw.mjs} +3 -3
  14. package/dist/{launch-json-removal-C6WgGWrk.mjs → launch-json-removal-CEEYc6CX.mjs} +2 -2
  15. package/dist/{loader-ci2BKFOZ.mjs → loader-BKjQIQ-O.mjs} +2 -2
  16. package/dist/loader-Cb6MWpe2.mjs +1 -0
  17. package/dist/md-manager-CQwbqiDq.mjs +2 -0
  18. package/dist/{open-browser-BXJKGvZF.mjs → open-browser-DtS0SaFA.mjs} +2 -2
  19. package/dist/parse-worker.mjs +1 -1
  20. package/dist/preview-BiUIhZCf.mjs +1 -0
  21. package/dist/{preview-Cz0tdp5I.mjs → preview-GfE2HVUy.mjs} +2 -2
  22. package/dist/public/assets/{ActivityModeContent-2l8BA531.js → ActivityModeContent-BSIeX2WL.js} +1 -1
  23. package/dist/public/assets/{AgentDiffPane-wqdF9lpR.js → AgentDiffPane-u4kU4q9y.js} +1 -1
  24. package/dist/public/assets/{AgentThreadClientBinder-56IhVeqo.js → AgentThreadClientBinder-CMHNZB8k.js} +1 -1
  25. package/dist/public/assets/{ChangedOutsideBadge-eT1ODdAD.js → ChangedOutsideBadge-Byr7iRWr.js} +1 -1
  26. package/dist/public/assets/{CodeMirrorPropInput-L7fbBlLy.js → CodeMirrorPropInput-kJZpOqjB.js} +1 -1
  27. package/dist/public/assets/{ConsentDialogBody-CB447Y2k.js → ConsentDialogBody-VKhCzQXH.js} +1 -1
  28. package/dist/public/assets/{DocumentContext-DD95gIt4.js → DocumentContext-B5qum6Oo.js} +9 -9
  29. package/dist/public/assets/{EditorModeToggle-CR5jA0YM.js → EditorModeToggle-C7I7X4RS.js} +1 -1
  30. package/dist/public/assets/{EnableSyncConfirmDialog-C5fNw26t.js → EnableSyncConfirmDialog-C5lcZQ0m.js} +1 -1
  31. package/dist/public/assets/FeedbackForm-Bxhb1af-.js +1 -0
  32. package/dist/public/assets/{GraphPanel-BDGxPSvY.js → GraphPanel-BKU-sjWQ.js} +1 -1
  33. package/dist/public/assets/{ImportSkillDialog-B2ilfqxe.js → ImportSkillDialog-eU2Zr5ex.js} +1 -1
  34. package/dist/public/assets/{LintConfigEditor-ByUOzhaw.js → LintConfigEditor-xKBwOmU6.js} +1 -1
  35. package/dist/public/assets/{ManagedArtifactProperties-CVGjtd3P.js → ManagedArtifactProperties-C8FxdLXe.js} +1 -1
  36. package/dist/public/assets/ManagedArtifactProperties-Ck3gsN1B.js +1 -0
  37. package/dist/public/assets/{McpConsentDialogBody-B3ubISnW.js → McpConsentDialogBody-5vUQ_tGC.js} +1 -1
  38. package/dist/public/assets/{MermaidDocEditor-CftVeU4U.js → MermaidDocEditor-BZ9qREZ6.js} +1 -1
  39. package/dist/public/assets/{ReportBugDialogBody-CWbkwdNL.js → ReportBugDialogBody-rA74DPnv.js} +1 -1
  40. package/dist/public/assets/{SchemaConfigEditor-UkvF3UAn.js → SchemaConfigEditor-BzlmoCOH.js} +1 -1
  41. package/dist/public/assets/{SessionsHost-Pa6hY3sI.js → SessionsHost-D1cUv-UU.js} +2 -2
  42. package/dist/public/assets/SettingsDialogBody-Cg9DTpQ7.js +12 -0
  43. package/dist/public/assets/{ShareBranchSwitchDialog-BmGWQCY6.js → ShareBranchSwitchDialog-COHEBcfz.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveDialog-BoqZXYhT.js → ShareReceiveDialog-DcNIOm6y.js} +1 -1
  45. package/dist/public/assets/{ShareReceiveMissDialog-B_DT1dz2.js → ShareReceiveMissDialog-DVZqfzBh.js} +1 -1
  46. package/dist/public/assets/{SkillEditBanner-hcLaEQ2F.js → SkillEditBanner-nlYN__8g.js} +1 -1
  47. package/dist/public/assets/{SkillOriginInline-CtSdZ4_j.js → SkillOriginInline-BBZCbGv3.js} +1 -1
  48. package/dist/public/assets/{SkillToolbarControls-DQYbvJTe.js → SkillToolbarControls-VrT7GSrm.js} +1 -1
  49. package/dist/public/assets/{SourceEditor-DX9L1Mci.js → SourceEditor-DQatC6rT.js} +1 -1
  50. package/dist/public/assets/{TerminalPanel-WTiFd3Z6.js → TerminalPanel-BHk4hxn3.js} +1 -1
  51. package/dist/public/assets/{TerminalWindowApp-CnhrK_tv.js → TerminalWindowApp-C81f0KjQ.js} +1 -1
  52. package/dist/public/assets/{TextDocEditor-BGlQEeBq.js → TextDocEditor-BSQz8TPb.js} +1 -1
  53. package/dist/public/assets/{ThreadView-CExveDEV.js → ThreadView-FpQMMfQp.js} +1 -1
  54. package/dist/public/assets/{TimelineDiffPane-DDFvXSlv.js → TimelineDiffPane-DRAMrTuM.js} +1 -1
  55. package/dist/public/assets/{agent-diff-store-jazihC28.js → agent-diff-store-BMOeSX25.js} +1 -1
  56. package/dist/public/assets/{agent-visibility-Ch0XQMkJ.js → agent-visibility-CRJC_Mmi.js} +1 -1
  57. package/dist/public/assets/auth-state-cache-BUKZaRRr.js +11 -0
  58. package/dist/public/assets/{client-version-CHRlMl4l.js → client-version-NCw3CPbg.js} +1 -1
  59. package/dist/public/assets/config-context-wTySMMh_.js +1 -0
  60. package/dist/public/assets/config-provider-BtDy9McS.js +4 -0
  61. package/dist/public/assets/{dist-5ovMzVKN2.js → dist-0V5DS-jp2.js} +182 -182
  62. package/dist/public/assets/{doc-paths-BFNbv2er.js → doc-paths-eqs57MlK.js} +1 -1
  63. package/dist/public/assets/{documents-events-BM8xyAJz.js → documents-events-BtZ7NV1t.js} +1 -1
  64. package/dist/public/assets/{file-tree-adapter-C1zJK1Gk.js → file-tree-adapter-CheEwQMW.js} +1 -1
  65. package/dist/public/assets/{file-tree-utils-Dma5c4k_.js → file-tree-utils-KtcdmJ_g.js} +1 -1
  66. package/dist/public/assets/{folder-config-api-BxuLFuqM.js → folder-config-api-DT4VLF_M.js} +1 -1
  67. package/dist/public/assets/{globals-DliH2YSL.js → globals-BlQP66GU.js} +1 -1
  68. package/dist/public/assets/globals-CqGu_JES.css +1 -0
  69. package/dist/public/assets/{index-DlH6tzhG.js → index-CcB59-rH.js} +108 -108
  70. package/dist/public/assets/{lint-config-client-DDxBMTZk.js → lint-config-client-CKDOijIM.js} +1 -1
  71. package/dist/public/assets/{markdownlint-rule-browser-c2Uv_5Ry.js → markdownlint-rule-browser-P1sDghK_.js} +1 -1
  72. package/dist/public/assets/{navigation-targets-D9VW9WdW.js → navigation-targets-gc61t_Ad.js} +1 -1
  73. package/dist/public/assets/{open-managed-artifact-tab-CLwVAGCD.js → open-managed-artifact-tab-DnKux2mI.js} +1 -1
  74. package/dist/public/assets/{pending-receive-nav-store-BmcjNZOu.js → pending-receive-nav-store-VNTolH5C.js} +1 -1
  75. package/dist/public/assets/{project-paths-DF-eCznB.js → project-paths-B8XPtMMF.js} +1 -1
  76. package/dist/public/assets/{prop-types-BPmLSxhG.js → prop-types-BdjIW0eY.js} +1 -1
  77. package/dist/public/assets/{radio-group-MAC3jHHk.js → radio-group-CvYE9US5.js} +1 -1
  78. package/dist/public/assets/{receive-store-BlAqmJZT.js → receive-store-Cv1sOLk9.js} +1 -1
  79. package/dist/public/assets/{selection-context-DJvv-kK_.js → selection-context-bQG3wbZN.js} +1 -1
  80. package/dist/public/assets/{skill-actions-CfQkZqK6.js → skill-actions-BQVwP81Q.js} +2 -2
  81. package/dist/public/assets/skill-scope-C6bIed6c.js +1 -0
  82. package/dist/public/assets/{skills-api-BTy9LAk0.js → skills-api-MKau2YTq.js} +1 -1
  83. package/dist/public/assets/{src-hNXjwMT1.js → src-CChG2POU.js} +1 -1
  84. package/dist/public/assets/{tag-pill-input-DVdwNfBT.js → tag-pill-input-_lxupqbK.js} +1 -1
  85. package/dist/public/assets/{target-navigation-intent-C6AhTsfc.js → target-navigation-intent-BAyNSKBJ.js} +1 -1
  86. package/dist/public/assets/{terminal-launch-events-B1DGOVIv.js → terminal-launch-events-CwG2wSZB.js} +1 -1
  87. package/dist/public/assets/{terminal-telemetry-CviFLmIq.js → terminal-telemetry--GWjCDpk.js} +1 -1
  88. package/dist/public/assets/{typing-burst-detector-B4AQIJp7.js → typing-burst-detector-BPenX-sr.js} +2 -2
  89. package/dist/public/assets/{uninstall-CfW-qETg.js → uninstall-Dy_6kiW_.js} +1 -1
  90. package/dist/public/assets/{use-activity-panel-D8pDT3xu.js → use-activity-panel-BsN0fEDd.js} +1 -1
  91. package/dist/public/assets/{use-collab-url-CUHlgRv5.js → use-collab-url-BPCGWweY.js} +1 -1
  92. package/dist/public/assets/use-live-xterm-theme-ChdaDRFM.js +1 -0
  93. package/dist/public/assets/{use-open-skill-akwbVkG4.js → use-open-skill-Civ_cY4Q.js} +1 -1
  94. package/dist/public/assets/{use-settings-route-BnOIfxuB.js → use-settings-route-1lmVz-nQ.js} +1 -1
  95. package/dist/public/assets/{use-skill-directory-CSx9txvQ.js → use-skill-directory-DXhI7ilx.js} +1 -1
  96. package/dist/public/assets/{use-skill-origin-DvSOmIz_.js → use-skill-origin-_K8KHC47.js} +1 -1
  97. package/dist/public/assets/{use-skills-DcLUuUJ9.js → use-skills-BfXZuh-E.js} +1 -1
  98. package/dist/public/assets/{use-terminal-enabled-CgG0yd-l.js → use-terminal-enabled-BfSuv1_p.js} +1 -1
  99. package/dist/public/assets/{use-timeline-entry-diff-DD-1OHsM.js → use-timeline-entry-diff-DDbjjCJ4.js} +1 -1
  100. package/dist/public/assets/{use-workspace-J5QvjwOx.js → use-workspace-BqaxnWdM.js} +1 -1
  101. package/dist/public/index.html +67 -55
  102. package/dist/public/uninstall.html +5 -5
  103. package/dist/{repair-launch-json-JaAIVlC-.mjs → repair-launch-json-09_4Eq7Q.mjs} +2 -2
  104. package/dist/{repair-mcp-configs-CXkQl9nj.mjs → repair-mcp-configs-hOx2UuWW.mjs} +2 -2
  105. package/dist/{repair-skills-IlcXRdDC.mjs → repair-skills-BXCsRRL9.mjs} +2 -2
  106. package/dist/repair-skills-xur4yCYG.mjs +1 -0
  107. package/dist/schemas/v0/config.user.schema.json +35 -1
  108. package/dist/{server-lock-CmYdHyX7.mjs → server-lock-B1IPSV1G.mjs} +2 -2
  109. package/dist/server-lock-BWO8zIgq.mjs +1 -0
  110. package/dist/{sleep-jUpHbV7f.mjs → sleep-ByqzSHar.mjs} +2 -2
  111. package/dist/{src-BS7drzIV.mjs → src-CHGk5YB-.mjs} +318 -318
  112. package/dist/{src-LszWWrBD.mjs → src-CxlsTHjS.mjs} +2 -2
  113. package/dist/src-DjMcdwEK.mjs +1 -0
  114. package/dist/{src-CHSJwcpc.mjs → src-xqnWcl6h.mjs} +88 -88
  115. package/dist/start-Xrk-GV7g.mjs +1 -0
  116. package/dist/{start-Bn7CVb1m.mjs → start-hMxYZyqG.mjs} +3 -3
  117. package/dist/{write-project-skill-CzrMSTf3.mjs → write-project-skill-d8JhYDYY.mjs} +4 -4
  118. package/package.json +4 -4
  119. package/dist/constants-C8h37BEh.mjs +0 -2
  120. package/dist/fs-traced-C-HqiL6u.mjs +0 -1
  121. package/dist/git-handle-DJPLRe3o.mjs +0 -1
  122. package/dist/init-7pRRcfae.mjs +0 -1
  123. package/dist/loader-CsoJ-O4W.mjs +0 -1
  124. package/dist/md-manager-DqRVEVmJ.mjs +0 -2
  125. package/dist/preview-B1yN_XNw.mjs +0 -1
  126. package/dist/public/assets/FeedbackForm-macxQS8x.js +0 -1
  127. package/dist/public/assets/ManagedArtifactProperties-m1GRSrIt.js +0 -1
  128. package/dist/public/assets/SettingsDialogBody-Be8P3Vqa.js +0 -12
  129. package/dist/public/assets/auth-state-cache-D47fide1.js +0 -11
  130. package/dist/public/assets/config-context-B2fceTMP.js +0 -1
  131. package/dist/public/assets/config-provider-Cb43FIW2.js +0 -4
  132. package/dist/public/assets/globals-BLjNYywW.css +0 -1
  133. package/dist/public/assets/skill-scope-DwJ84s_r.js +0 -1
  134. package/dist/public/assets/use-live-xterm-theme-CLCjRdjJ.js +0 -1
  135. package/dist/repair-skills-3_7Dtv4E.mjs +0 -1
  136. package/dist/server-lock-D61z37T2.mjs +0 -1
  137. package/dist/src-BWFntIGk.mjs +0 -1
  138. package/dist/start-BwZFw6iw.mjs +0 -1
@@ -48,6 +48,40 @@
48
48
  "defaultScope": "user",
49
49
  "description": "Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project."
50
50
  },
51
+ "colorThemeLight": {
52
+ "type": "string",
53
+ "enum": [
54
+ "default",
55
+ "dracula",
56
+ "catppuccin-frappe",
57
+ "catppuccin-latte",
58
+ "monokai",
59
+ "gruvbox",
60
+ "solarized",
61
+ "custom"
62
+ ],
63
+ "scope": "user",
64
+ "agentSettable": false,
65
+ "defaultScope": "user",
66
+ "description": "IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized'. A personal preference (user scope) — not shared with the project."
67
+ },
68
+ "colorThemeDark": {
69
+ "type": "string",
70
+ "enum": [
71
+ "default",
72
+ "dracula",
73
+ "catppuccin-frappe",
74
+ "catppuccin-latte",
75
+ "monokai",
76
+ "gruvbox",
77
+ "solarized",
78
+ "custom"
79
+ ],
80
+ "scope": "user",
81
+ "agentSettable": false,
82
+ "defaultScope": "user",
83
+ "description": "IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized'. A personal preference (user scope) — not shared with the project."
84
+ },
51
85
  "colorTheme": {
52
86
  "type": "string",
53
87
  "enum": [
@@ -63,7 +97,7 @@
63
97
  "scope": "user",
64
98
  "agentSettable": false,
65
99
  "defaultScope": "user",
66
- "description": "IDE color palette: 'default' (follows the light/dark theme), 'custom' (your own colors from appearance.customTheme), or one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized'. A personal preference (user scope) — not shared with the project."
100
+ "description": "Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A personal preference (user scope) — not shared with the project."
67
101
  },
68
102
  "colorThemeEnabled": {
69
103
  "type": "boolean",
@@ -22,6 +22,40 @@
22
22
  "defaultScope": "user",
23
23
  "description": "Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project."
24
24
  },
25
+ "colorThemeLight": {
26
+ "type": "string",
27
+ "enum": [
28
+ "default",
29
+ "dracula",
30
+ "catppuccin-frappe",
31
+ "catppuccin-latte",
32
+ "monokai",
33
+ "gruvbox",
34
+ "solarized",
35
+ "custom"
36
+ ],
37
+ "scope": "user",
38
+ "agentSettable": false,
39
+ "defaultScope": "user",
40
+ "description": "IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized'. A personal preference (user scope) — not shared with the project."
41
+ },
42
+ "colorThemeDark": {
43
+ "type": "string",
44
+ "enum": [
45
+ "default",
46
+ "dracula",
47
+ "catppuccin-frappe",
48
+ "catppuccin-latte",
49
+ "monokai",
50
+ "gruvbox",
51
+ "solarized",
52
+ "custom"
53
+ ],
54
+ "scope": "user",
55
+ "agentSettable": false,
56
+ "defaultScope": "user",
57
+ "description": "IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized'. A personal preference (user scope) — not shared with the project."
58
+ },
25
59
  "colorTheme": {
26
60
  "type": "string",
27
61
  "enum": [
@@ -37,7 +71,7 @@
37
71
  "scope": "user",
38
72
  "agentSettable": false,
39
73
  "defaultScope": "user",
40
- "description": "IDE color palette: 'default' (follows the light/dark theme), 'custom' (your own colors from appearance.customTheme), or one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized'. A personal preference (user scope) — not shared with the project."
74
+ "description": "Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A personal preference (user scope) — not shared with the project."
41
75
  },
42
76
  "colorThemeEnabled": {
43
77
  "type": "boolean",
@@ -0,0 +1,2 @@
1
+ import"./src-xqnWcl6h.mjs";var e=`0.47.0-beta.8`;const t=`config.yml`,n=e;export{n,t};
2
+ //# sourceMappingURL=constants-DIYjBPRr.mjs.map
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-DTipWd-i.mjs";import{Y as o,_ as s,c,f as l,g as u,h as d,i as f,m as p,n as ee,o as m,p as te,s as ne,t as re,v as ie,w as ae,y as oe}from"./sleep-jUpHbV7f.mjs";import{a as h,c as se,i as ce,n as g,o as _,r as v,s as le,t as y}from"./esm-DxvI2ZVA.mjs";import{C as ue,_ as b,c as de,g as fe,h as pe,m as me,o as he,r as x,v as S,w as ge,y as C}from"./logger-5LePyO3n.mjs";import{basename as w,dirname as T,isAbsolute as _e,join as ve,resolve as ye,sep as E}from"node:path";import{appendFileSync as be,closeSync as xe,cpSync as Se,existsSync as Ce,linkSync as we,mkdirSync as Te,openSync as Ee,readFileSync as De,readdirSync as Oe,renameSync as ke,rmSync as Ae,rmdirSync as je,statSync as Me,symlinkSync as Ne,unlinkSync as D,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import{appendFile as Ie,mkdir as Le,readdir as Re,rename as ze,rm as Be,stat as Ve,unlink as He,writeFile as Ue}from"node:fs/promises";import*as We from"zlib";import{Readable as Ge}from"stream";g();var O=o();function Ke(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=c({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function qe(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return ke(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function Je(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=oe.parse({});if(!Ce(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=De(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,O.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?qe(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},u=m({value:c,file:t,source:o,doc:s}),d=u.length>0?ne(c):c,f=oe.safeParse(d);if(!f.success){let e=Ke(f,s,o,t);i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let c=n?qe(t,r,i):void 0;return{valid:!1,value:a,error:e,diagnostics:[...u,...l(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]],...c===void 0?{}:{sidelinedTo:c}}}return{valid:!0,value:f.data,source:t,diagnostics:u}}const Ye=3e4,Xe={writeFile:(e,t,n)=>Ue(e,t,n),rename:(e,t)=>ze(e,t)};async function Ze(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye,i=await Re(t);await Promise.all(i.map(async e=>{if(!e.startsWith(n))return;let i=ve(t,e);try{(await Ve(i)).mtimeMs<r&&await He(i)}catch{}}))}catch{}}function Qe(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye;for(let e of Oe(t)){if(!e.startsWith(n))continue;let i=ve(t,e);try{Me(i).mtimeMs<r&&D(i)}catch{}}}catch{}}async function $e(e,t,n={}){await Ze(e);let r=n.fs??Xe,i=`${e}.tmp.${crypto.randomUUID()}`;try{await r.writeFile(i,t,{encoding:`utf-8`,mode:n.mode??420}),await r.rename(i,e)}catch(e){try{D(i)}catch{}throw e}}function et(e,t,n={}){Qe(e);let r=`${e}.tmp.${crypto.randomUUID()}`;try{Pe(r,t,{encoding:`utf-8`,mode:n.mode??420}),ke(r,e)}catch(e){try{D(r)}catch{}throw e}}var k=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function tt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);await re(i);continue}try{return await t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}function nt(e){let t=Date.now()+e;for(;Date.now()<t;);}function rt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);nt(i);continue}try{return t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}const it=`config.yml`;function at(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${f}/${e===`user`?`config.user.schema.json`:e===`project-local`?`config.project-local.schema.json`:`config.project.schema.json`}`}function ot(e){return`# yaml-language-server: $schema=${at(e)}\n`}function st(e,t,n){if(e===`user`)return ye(n??Fe(),`.ok`,`global.yml`);let r=_e(t)?t:ye(t);return e===`project-local`?ye(r,`.ok`,ee,it):ye(r,`.ok`,it)}function A(e){return{ok:!1,error:e}}function ct(e){return{ok:!0,...e}}async function lt(e){return s(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await ut(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function ut(e){let{cwd:t,scope:n,patch:r,homedirOverride:i}=e,a=st(n,t,i),o=d(r,n);if(o!==null)return A(o);try{await Le(T(a),{recursive:!0})}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${a}: ${e instanceof Error?e.message:String(e)}`})}try{return await tt(`${a}.lock`,()=>dt(e,a))}catch(e){if(e instanceof k)return A({code:`WRITE_ERROR`,detail:e.message});throw e}}async function dt(e,t){let{patch:n,scope:r,firstWriteHeader:i}=e,a=``,o=!1;if(Ce(t)){o=!0;try{a=De(t,`utf-8`)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let s=(0,O.parseDocument)(a);if(s.errors.length>0)return A({code:`YAML_PARSE`,detail:s.errors.map(e=>e.message).join(`; `)});if(s.contents===null)s.contents=s.createNode({});else if(!(0,O.isMap)(s.contents))return A({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,O.isSeq)(s.contents)?`sequence`:`scalar`}`});let c=te(s,n),l=s.toJSON(),d=ie(`config.validate`,{"config.scope":r,"config.validation.layer":`L2`},e=>{let t=oe.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)u(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!d.success)return A({code:`SCHEMA_INVALID`,issues:d.error.issues.map(p)});let f=s.toString();if(!o){let e=i===void 0?ot(r):i??``;e.length>0&&(f=`${e.endsWith(`
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-DTipWd-i.mjs";import{Y as o,_ as s,c,f as l,g as u,h as d,i as f,m as p,n as ee,o as m,p as te,s as ne,t as re,v as ie,w as ae,y as oe}from"./sleep-ByqzSHar.mjs";import{a as h,c as se,i as ce,n as g,o as _,r as v,s as le,t as y}from"./esm-DxvI2ZVA.mjs";import{C as ue,_ as b,c as de,g as fe,h as pe,m as me,o as he,r as x,v as S,w as ge,y as C}from"./logger-5LePyO3n.mjs";import{basename as w,dirname as T,isAbsolute as _e,join as ve,resolve as ye,sep as E}from"node:path";import{appendFileSync as be,closeSync as xe,cpSync as Se,existsSync as Ce,linkSync as we,mkdirSync as Te,openSync as Ee,readFileSync as De,readdirSync as Oe,renameSync as ke,rmSync as Ae,rmdirSync as je,statSync as Me,symlinkSync as Ne,unlinkSync as D,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import{appendFile as Ie,mkdir as Le,readdir as Re,rename as ze,rm as Be,stat as Ve,unlink as He,writeFile as Ue}from"node:fs/promises";import*as We from"zlib";import{Readable as Ge}from"stream";g();var O=o();function Ke(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=c({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function qe(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return ke(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function Je(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=oe.parse({});if(!Ce(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=De(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,O.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?qe(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},u=m({value:c,file:t,source:o,doc:s}),d=u.length>0?ne(c):c,f=oe.safeParse(d);if(!f.success){let e=Ke(f,s,o,t);i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let c=n?qe(t,r,i):void 0;return{valid:!1,value:a,error:e,diagnostics:[...u,...l(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]],...c===void 0?{}:{sidelinedTo:c}}}return{valid:!0,value:f.data,source:t,diagnostics:u}}const Ye=3e4,Xe={writeFile:(e,t,n)=>Ue(e,t,n),rename:(e,t)=>ze(e,t)};async function Ze(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye,i=await Re(t);await Promise.all(i.map(async e=>{if(!e.startsWith(n))return;let i=ve(t,e);try{(await Ve(i)).mtimeMs<r&&await He(i)}catch{}}))}catch{}}function Qe(e){try{let t=T(e),n=`${w(e)}.tmp.`,r=Date.now()-Ye;for(let e of Oe(t)){if(!e.startsWith(n))continue;let i=ve(t,e);try{Me(i).mtimeMs<r&&D(i)}catch{}}}catch{}}async function $e(e,t,n={}){await Ze(e);let r=n.fs??Xe,i=`${e}.tmp.${crypto.randomUUID()}`;try{await r.writeFile(i,t,{encoding:`utf-8`,mode:n.mode??420}),await r.rename(i,e)}catch(e){try{D(i)}catch{}throw e}}function et(e,t,n={}){Qe(e);let r=`${e}.tmp.${crypto.randomUUID()}`;try{Pe(r,t,{encoding:`utf-8`,mode:n.mode??420}),ke(r,e)}catch(e){try{D(r)}catch{}throw e}}var k=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function tt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);await re(i);continue}try{return await t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}function nt(e){let t=Date.now()+e;for(;Date.now()<t;);}function rt(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ee(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Me(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{D(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new k(e,r);nt(i);continue}try{return t()}finally{try{xe(s)}catch{}try{D(e)}catch{}}}}const it=`config.yml`;function at(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${f}/${e===`user`?`config.user.schema.json`:e===`project-local`?`config.project-local.schema.json`:`config.project.schema.json`}`}function ot(e){return`# yaml-language-server: $schema=${at(e)}\n`}function st(e,t,n){if(e===`user`)return ye(n??Fe(),`.ok`,`global.yml`);let r=_e(t)?t:ye(t);return e===`project-local`?ye(r,`.ok`,ee,it):ye(r,`.ok`,it)}function A(e){return{ok:!1,error:e}}function ct(e){return{ok:!0,...e}}async function lt(e){return s(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await ut(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function ut(e){let{cwd:t,scope:n,patch:r,homedirOverride:i}=e,a=st(n,t,i),o=d(r,n);if(o!==null)return A(o);try{await Le(T(a),{recursive:!0})}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${a}: ${e instanceof Error?e.message:String(e)}`})}try{return await tt(`${a}.lock`,()=>dt(e,a))}catch(e){if(e instanceof k)return A({code:`WRITE_ERROR`,detail:e.message});throw e}}async function dt(e,t){let{patch:n,scope:r,firstWriteHeader:i}=e,a=``,o=!1;if(Ce(t)){o=!0;try{a=De(t,`utf-8`)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let s=(0,O.parseDocument)(a);if(s.errors.length>0)return A({code:`YAML_PARSE`,detail:s.errors.map(e=>e.message).join(`; `)});if(s.contents===null)s.contents=s.createNode({});else if(!(0,O.isMap)(s.contents))return A({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,O.isSeq)(s.contents)?`sequence`:`scalar`}`});let c=te(s,n),l=s.toJSON(),d=ie(`config.validate`,{"config.scope":r,"config.validation.layer":`L2`},e=>{let t=oe.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)u(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!d.success)return A({code:`SCHEMA_INVALID`,issues:d.error.issues.map(p)});let f=s.toString();if(!o){let e=i===void 0?ot(r):i??``;e.length>0&&(f=`${e.endsWith(`
2
2
  `)?e:`${e}\n`}${f}`)}try{await Le(T(t),{recursive:!0})}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${t}: ${e instanceof Error?e.message:String(e)}`})}try{await $e(t,f)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not write ${t}: ${e instanceof Error?e.message:String(e)}`})}return ct({effective:d.data,appliedPaths:c,path:t,created:!o})}const ft=[`user`,`project`,`project-local`];function pt(e){let t=[];for(let n of ft){let r=st(n,e.cwd,e.homedirOverride),i=Je({absPath:r,sideline:!1,...e.warn?{warn:e.warn}:{}});for(let e of i.diagnostics)t.push(mt(e,n,r))}return{diagnostics:t}}function mt(e,t,n){switch(e.code){case`REMOVED_KEY`:return{code:`REMOVED_KEY`,scope:t,file:n,path:e.path,redirect:e.redirect};case`YAML_PARSE`:return{code:`YAML_PARSE`,scope:t,file:n};case`SCHEMA_INVALID`:return{code:`SCHEMA_INVALID`,scope:t,file:n};case`UNREADABLE`:return{code:`UNREADABLE`,scope:t,file:n}}}var ht=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AbstractAsyncHooksContextManager=void 0;let n=t(`events`),r=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`];e.AbstractAsyncHooksContextManager=class{bind(e,t){return t instanceof n.EventEmitter?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindEventEmitter(e,t){return this._getPatchMap(t)===void 0?(this._createPatchMap(t),r.forEach(n=>{t[n]!==void 0&&(t[n]=this._patchAddListener(t,t[n],e))}),typeof t.removeListener==`function`&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off==`function`&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners==`function`&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners)),t):t}_patchRemoveListener(e,t){let n=this;return function(r,i){let a=n._getPatchMap(e)?.[r];if(a===void 0)return t.call(this,r,i);let o=a.get(i);return t.call(this,r,o||i)}}_patchRemoveAllListeners(e,t){let n=this;return function(r){let i=n._getPatchMap(e);return i!==void 0&&(arguments.length===0?n._createPatchMap(e):i[r]!==void 0&&delete i[r]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let r=this;return function(i,a){if(r._wrapped)return t.call(this,i,a);let o=r._getPatchMap(e);o===void 0&&(o=r._createPatchMap(e));let s=o[i];s===void 0&&(s=new WeakMap,o[i]=s);let c=r.bind(n,a);s.set(a,c),r._wrapped=!0;try{return t.call(this,i,c)}finally{r._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol(`OtListeners`);_wrapped=!1}})),gt=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AsyncHooksContextManager=void 0;let r=(g(),e(y)),i=t(`async_hooks`),a=ht();n.AsyncHooksContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=i.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??r.ROOT_CONTEXT}with(e,t,n,...r){this._enterContext(e);try{return t.call(n,...r)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,t){if(t===`TIMERWRAP`)return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let t=this._contexts.get(e);t!==void 0&&this._enterContext(t)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}}})),_t=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AsyncLocalStorageContextManager=void 0;let r=(g(),e(y)),i=t(`async_hooks`),a=ht();n.AsyncLocalStorageContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new i.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??r.ROOT_CONTEXT}with(e,t,n,...r){let i=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,i,...r)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}}})),vt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AsyncLocalStorageContextManager=e.AsyncHooksContextManager=void 0;var t=gt();Object.defineProperty(e,`AsyncHooksContextManager`,{enumerable:!0,get:function(){return t.AsyncHooksContextManager}});var n=_t();Object.defineProperty(e,`AsyncLocalStorageContextManager`,{enumerable:!0,get:function(){return n.AsyncLocalStorageContextManager}})})),yt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AggregationTemporalityPreference=void 0,(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(e.AggregationTemporalityPreference||={})})),bt,xt=n((()=>{bt=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}})),j,St=n((()=>{j=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}}}));function Ct(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function wt(e){if(e!=null)return()=>e}function Tt(e,t,n){return{timeoutMillis:Ct(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Et(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var M=n((()=>{})),Dt,Ot=n((()=>{(function(e){e.NONE=`none`,e.GZIP=`gzip`})(Dt||={})}));function kt(e){return new At(e.concurrencyLimit)}var At,jt=n((()=>{At=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}));function Mt(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Nt(){return{handleResponse(e){e==null||!Mt(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||_.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Pt=n((()=>{}));function Ft(e,t){return new It(e.transport,e.serializer,Nt(),e.promiseHandler,t.timeout)}var N,It,Lt=n((()=>{N=fe(),St(),Pt(),g(),It=class{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=_.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:N.ExportResultCode.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:N.ExportResultCode.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:N.ExportResultCode.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:N.ExportResultCode.FAILED,error:e.error});return}else e.status===`retryable`?t({code:N.ExportResultCode.FAILED,error:new j(`Export failed with retryable status`)}):t({code:N.ExportResultCode.FAILED,error:new j(`Export failed with unknown error`)})},e=>t({code:N.ExportResultCode.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}}}));function Rt(e,t,n){return Ft({transport:n,serializer:t,promiseHandler:kt(e)},{timeout:e.timeoutMillis})}var zt=n((()=>{jt(),Lt()})),Bt=i({CompressionAlgorithm:()=>Dt,OTLPExporterBase:()=>bt,OTLPExporterError:()=>j,createOtlpNetworkExportDelegate:()=>Rt,getSharedConfigurationDefaults:()=>Et,mergeOtlpSharedConfigurationWithDefaults:()=>Tt}),Vt=n((()=>{xt(),St(),M(),Ot(),zt()})),Ht=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPMetricExporterBase=t.LowMemoryTemporalitySelector=t.DeltaTemporalitySelector=t.CumulativeTemporalitySelector=void 0;let n=fe(),r=pe(),i=yt(),a=(Vt(),e(Bt)),o=(g(),e(y));t.CumulativeTemporalitySelector=()=>r.AggregationTemporality.CUMULATIVE,t.DeltaTemporalitySelector=e=>{switch(e){case r.InstrumentType.COUNTER:case r.InstrumentType.OBSERVABLE_COUNTER:case r.InstrumentType.GAUGE:case r.InstrumentType.HISTOGRAM:case r.InstrumentType.OBSERVABLE_GAUGE:return r.AggregationTemporality.DELTA;case r.InstrumentType.UP_DOWN_COUNTER:case r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return r.AggregationTemporality.CUMULATIVE}},t.LowMemoryTemporalitySelector=e=>{switch(e){case r.InstrumentType.COUNTER:case r.InstrumentType.HISTOGRAM:return r.AggregationTemporality.DELTA;case r.InstrumentType.GAUGE:case r.InstrumentType.UP_DOWN_COUNTER:case r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:case r.InstrumentType.OBSERVABLE_COUNTER:case r.InstrumentType.OBSERVABLE_GAUGE:return r.AggregationTemporality.CUMULATIVE}};function s(){let e=((0,n.getStringFromEnv)(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`)??`cumulative`).toLowerCase();return e===`cumulative`?t.CumulativeTemporalitySelector:e===`delta`?t.DeltaTemporalitySelector:e===`lowmemory`?t.LowMemoryTemporalitySelector:(o.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),t.CumulativeTemporalitySelector)}function c(e){return e==null?s():e===i.AggregationTemporalityPreference.DELTA?t.DeltaTemporalitySelector:e===i.AggregationTemporalityPreference.LOWMEMORY?t.LowMemoryTemporalitySelector:t.CumulativeTemporalitySelector}let l=Object.freeze({type:r.AggregationType.DEFAULT});function u(e){return e?.aggregationPreference??(()=>l)}t.OTLPMetricExporterBase=class extends a.OTLPExporterBase{_aggregationTemporalitySelector;_aggregationSelector;constructor(e,t){super(e),this._aggregationSelector=u(t),this._aggregationTemporalitySelector=c(t?.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}}})),Ut=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`0.204.0`}));function Wt(e){return()=>{let t={};return Object.entries(e?.()??{}).forEach(([e,n])=>{n===void 0?_.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}}var Gt=n((()=>{g()}));function Kt(e,t,n){let r={...n()},i={};return()=>(t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,r))}function qt(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Jt(e){return async t=>{let{Agent:n}=await(t===`http:`?import(`http`):import(`https`));return new n(e)}}function Yt(e,t,n){return{...Tt(e,t,n),headers:Kt(Wt(e.headers),t.headers,n.headers),url:qt(e.url)??t.url??n.url,agentFactory:e.agentFactory??t.agentFactory??n.agentFactory}}function Xt(e,t){return{...Et(),headers:()=>e,url:`http://localhost:4318/`+t,agentFactory:Jt({keepAlive:!0})}}var Zt=n((()=>{M(),Gt()}));function Qt(e){return[429,502,503,504].includes(e)}function $t(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var en=n((()=>{}));function tn(e,t,n,r,i,a){let o=new URL(t.url),s=e({hostname:o.hostname,port:o.port,path:o.pathname,method:`POST`,headers:{...t.headers()},agent:n},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>{e.statusCode&&e.statusCode<299?i({status:`success`,data:Buffer.concat(t)}):e.statusCode&&Qt(e.statusCode)?i({status:`retryable`,retryInMillis:$t(e.headers[`retry-after`])}):i({status:`failure`,error:new j(e.statusMessage,e.statusCode,Buffer.concat(t).toString())})})});s.setTimeout(a,()=>{s.destroy(),i({status:`failure`,error:Error(`Request Timeout`)})}),s.on(`error`,e=>{i({status:`failure`,error:e})}),nn(s,t.compression,r,e=>{i({status:`failure`,error:e})})}function nn(e,t,n,r){let i=rn(n);t===`gzip`&&(e.setHeader(`Content-Encoding`,`gzip`),i=i.on(`error`,r).pipe(We.createGzip()).on(`error`,r)),i.pipe(e).on(`error`,r)}function rn(e){let t=new Ge;return t.push(e),t.push(null),t}var an=n((()=>{en(),St()}));async function on(e){let{request:t}=await(e===`http:`?import(`http`):import(`https`));return t}function sn(e){return new cn(e)}var cn,ln=n((()=>{an(),cn=class{_parameters;_utils=null;constructor(e){this._parameters=e}async send(e,t){let{agent:n,request:r}=await this._loadUtils();return new Promise(i=>{tn(r,this._parameters,n,e,e=>{i(e)},t)})}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let t=new URL(this._parameters.url).protocol,[n,r]=await Promise.all([this._parameters.agentFactory(t),on(t)]);e=this._utils={agent:n,request:r}}return e}}}));function un(){return 2*gn*Math.random()-gn}function dn(e){return new _n(e.transport)}var fn,pn,mn,hn,gn,_n,vn=n((()=>{fn=5,pn=1e3,mn=5e3,hn=1.5,gn=.2,_n=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Date.now()+t,r=await this._transport.send(e,t),i=fn,a=pn;for(;r.status===`retryable`&&i>0;){i--;let t=Math.max(Math.min(a,mn)+un(),0);a*=hn;let o=r.retryInMillis??t,s=n-Date.now();if(o>s)return r;r=await this.retry(e,s,o)}return r}shutdown(){return this._transport.shutdown()}}}));function yn(e,t){return Ft({transport:dn({transport:sn(e)}),serializer:t,promiseHandler:kt(e)},{timeout:e.timeoutMillis})}var bn=n((()=>{Lt(),ln(),jt(),vn()}));function xn(e){let t=process.env[e]?.trim();if(t!=null&&t!==``){let n=Number(t);if(Number.isFinite(n)&&n>0)return n;_.warn(`Configuration: ${e} is invalid, expected number greater than 0 (actual: ${t})`)}}function Sn(e){let t=xn(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=xn(`OTEL_EXPORTER_OTLP_TIMEOUT`);return t??n}function Cn(e){let t=process.env[e]?.trim();if(t!==``){if(t==null||t===`none`||t===`gzip`)return t;_.warn(`Configuration: ${e} is invalid, expected 'none' or 'gzip' (actual: '${t}')`)}}function wn(e){let t=Cn(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=Cn(`OTEL_EXPORTER_OTLP_COMPRESSION`);return t??n}function Tn(e){return{timeoutMillis:Sn(e),compression:wn(e)}}var En=n((()=>{g()}));function Dn(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_${e}_HEADERS`),n=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_HEADERS`),r=(0,P.parseKeyPairsIntoRecord)(t),i=(0,P.parseKeyPairsIntoRecord)(n);if(!(Object.keys(r).length===0&&Object.keys(i).length===0))return Object.assign({},(0,P.parseKeyPairsIntoRecord)(n),(0,P.parseKeyPairsIntoRecord)(t))}function On(e){try{return new URL(e).toString()}catch{_.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}}function kn(e,t){try{new URL(e)}catch{_.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}e.endsWith(`/`)||(e+=`/`),e+=t;try{new URL(e)}catch{_.warn(`Configuration: Provided URL appended with '${t}' is not a valid URL, using 'undefined' instead of '${e}'`);return}return e}function An(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_ENDPOINT`);if(t!==void 0)return kn(t,e)}function jn(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`);if(t!==void 0)return On(t)}function Mn(e,t){return{...Tn(e),url:jn(e)??An(t),headers:wt(Dn(e))}}var P,Nn=n((()=>{P=fe(),g(),En(),M()}));function Pn(e){if(typeof e.httpAgentOptions==`function`)return e.httpAgentOptions;let t=e.httpAgentOptions;if(e.keepAlive!=null&&(t={keepAlive:e.keepAlive,...t}),t!=null)return Jt(t)}function Fn(e,t,n,r){return e.metadata&&_.warn(`Metadata cannot be set when using http`),Yt({url:e.url,headers:wt(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentFactory:Pn(e)},Mn(t,n),Xt(r,n))}var In=n((()=>{Zt(),Nn(),g(),M()})),Ln=i({convertLegacyHttpOptions:()=>Fn,createOtlpHttpExportDelegate:()=>yn,getSharedConfigurationFromEnvironment:()=>Tn,httpAgentFactoryFromOptions:()=>Jt}),Rn=n((()=>{Zt(),bn(),En(),In()})),zn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPMetricExporter=void 0;let n=Ht(),r=me(),i=Ut(),a=(Rn(),e(Ln)),o={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${i.VERSION}`};t.OTLPMetricExporter=class extends n.OTLPMetricExporterBase{constructor(e){super((0,a.createOtlpHttpExportDelegate)((0,a.convertLegacyHttpOptions)(e??{},`METRICS`,`v1/metrics`,{...o,"Content-Type":`application/json`}),r.JsonMetricsSerializer),e)}}})),Bn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporter=void 0;var t=zn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}})})),Vn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporter=void 0;var t=Bn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}})})),Hn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporterBase=e.LowMemoryTemporalitySelector=e.DeltaTemporalitySelector=e.CumulativeTemporalitySelector=e.AggregationTemporalityPreference=e.OTLPMetricExporter=void 0;var t=Vn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}});var n=yt();Object.defineProperty(e,`AggregationTemporalityPreference`,{enumerable:!0,get:function(){return n.AggregationTemporalityPreference}});var r=Ht();Object.defineProperty(e,`CumulativeTemporalitySelector`,{enumerable:!0,get:function(){return r.CumulativeTemporalitySelector}}),Object.defineProperty(e,`DeltaTemporalitySelector`,{enumerable:!0,get:function(){return r.DeltaTemporalitySelector}}),Object.defineProperty(e,`LowMemoryTemporalitySelector`,{enumerable:!0,get:function(){return r.LowMemoryTemporalitySelector}}),Object.defineProperty(e,`OTLPMetricExporterBase`,{enumerable:!0,get:function(){return r.OTLPMetricExporterBase}})})),Un=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`0.204.0`})),Wn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPTraceExporter=void 0;let n=(Vt(),e(Bt)),r=Un(),i=me(),a=(Rn(),e(Ln));t.OTLPTraceExporter=class extends n.OTLPExporterBase{constructor(e={}){super((0,a.createOtlpHttpExportDelegate)((0,a.convertLegacyHttpOptions)(e,`TRACES`,`v1/traces`,{"User-Agent":`OTel-OTLP-Exporter-JavaScript/${r.VERSION}`,"Content-Type":`application/json`}),i.JsonTraceSerializer))}}})),Gn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=Wn();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),Kn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=Gn();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),qn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=Kn();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),Jn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._clearDefaultServiceNameCache=e.defaultServiceName=void 0;let t;function n(){if(t===void 0)try{let e=globalThis.process.argv0;t=e?`unknown_service:${e}`:`unknown_service`}catch{t=`unknown_service`}return t}e.defaultServiceName=n;function r(){t=void 0}e._clearDefaultServiceNameCache=r})),Yn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isPromiseLike=void 0,e.isPromiseLike=e=>typeof e==`object`&&!!e&&typeof e.then==`function`})),Xn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.defaultResource=t.emptyResource=t.resourceFromDetectedResource=t.resourceFromAttributes=void 0;let n=(g(),e(y)),r=b(),i=(C(),e(S)),a=Jn(),o=Yn();var s=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=f(t),r._asyncAttributesPending=t.filter(([e,t])=>(0,o.isPromiseLike)(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>((0,o.isPromiseLike)(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=f(this._rawAttributes),this._schemaUrl=p(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,(0,o.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&n.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,r]of this._rawAttributes){if((0,o.isPromiseLike)(r)){n.diag.debug(`Unsettled resource attribute ${t} skipped`);continue}r!=null&&(e[t]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=ee(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function c(e,t){return s.FromAttributeList(Object.entries(e),t)}t.resourceFromAttributes=c;function l(e,t){return new s(e,t)}t.resourceFromDetectedResource=l;function u(){return c({})}t.emptyResource=u;function d(){return c({[i.ATTR_SERVICE_NAME]:(0,a.defaultServiceName)(),[i.ATTR_TELEMETRY_SDK_LANGUAGE]:r.SDK_INFO[i.ATTR_TELEMETRY_SDK_LANGUAGE],[i.ATTR_TELEMETRY_SDK_NAME]:r.SDK_INFO[i.ATTR_TELEMETRY_SDK_NAME],[i.ATTR_TELEMETRY_SDK_VERSION]:r.SDK_INFO[i.ATTR_TELEMETRY_SDK_VERSION]})}t.defaultResource=d;function f(e){return e.map(([e,t])=>(0,o.isPromiseLike)(t)?[e,t.catch(t=>{n.diag.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function p(e){if(typeof e==`string`||e===void 0)return e;n.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function ee(e,t){let r=e?.schemaUrl,i=t?.schemaUrl,a=r===void 0||r===``,o=i===void 0||i===``;if(a)return i;if(o||r===i)return r;n.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,r,i)}})),Zn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.detectResources=void 0;let n=(g(),e(y)),r=Xn();t.detectResources=(e={})=>(e.detectors||[]).map(t=>{try{let i=(0,r.resourceFromDetectedResource)(t.detect(e));return n.diag.debug(`${t.constructor.name} found resource.`,i),i}catch(e){return n.diag.debug(`${t.constructor.name} failed: ${e.message}`),(0,r.emptyResource)()}}).reduce((e,t)=>e.merge(t),(0,r.emptyResource)())})),Qn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.envDetector=void 0;let n=(g(),e(y)),r=(C(),e(S)),i=b();t.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(e){let t={},a=(0,i.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),o=(0,i.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(a)try{let e=this._parseResourceAttributes(a);Object.assign(t,e)}catch(e){n.diag.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return o&&(t[r.ATTR_SERVICE_NAME]=o),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}}})),F=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_WEBENGINE_VERSION=e.ATTR_WEBENGINE_NAME=e.ATTR_WEBENGINE_DESCRIPTION=e.ATTR_SERVICE_NAMESPACE=e.ATTR_SERVICE_INSTANCE_ID=e.ATTR_PROCESS_RUNTIME_VERSION=e.ATTR_PROCESS_RUNTIME_NAME=e.ATTR_PROCESS_RUNTIME_DESCRIPTION=e.ATTR_PROCESS_PID=e.ATTR_PROCESS_OWNER=e.ATTR_PROCESS_EXECUTABLE_PATH=e.ATTR_PROCESS_EXECUTABLE_NAME=e.ATTR_PROCESS_COMMAND_ARGS=e.ATTR_PROCESS_COMMAND=e.ATTR_OS_VERSION=e.ATTR_OS_TYPE=e.ATTR_K8S_POD_NAME=e.ATTR_K8S_NAMESPACE_NAME=e.ATTR_K8S_DEPLOYMENT_NAME=e.ATTR_K8S_CLUSTER_NAME=e.ATTR_HOST_TYPE=e.ATTR_HOST_NAME=e.ATTR_HOST_IMAGE_VERSION=e.ATTR_HOST_IMAGE_NAME=e.ATTR_HOST_IMAGE_ID=e.ATTR_HOST_ID=e.ATTR_HOST_ARCH=e.ATTR_CONTAINER_NAME=e.ATTR_CONTAINER_IMAGE_TAGS=e.ATTR_CONTAINER_IMAGE_NAME=e.ATTR_CONTAINER_ID=e.ATTR_CLOUD_REGION=e.ATTR_CLOUD_PROVIDER=e.ATTR_CLOUD_AVAILABILITY_ZONE=e.ATTR_CLOUD_ACCOUNT_ID=void 0,e.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,e.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,e.ATTR_CLOUD_PROVIDER=`cloud.provider`,e.ATTR_CLOUD_REGION=`cloud.region`,e.ATTR_CONTAINER_ID=`container.id`,e.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,e.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,e.ATTR_CONTAINER_NAME=`container.name`,e.ATTR_HOST_ARCH=`host.arch`,e.ATTR_HOST_ID=`host.id`,e.ATTR_HOST_IMAGE_ID=`host.image.id`,e.ATTR_HOST_IMAGE_NAME=`host.image.name`,e.ATTR_HOST_IMAGE_VERSION=`host.image.version`,e.ATTR_HOST_NAME=`host.name`,e.ATTR_HOST_TYPE=`host.type`,e.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,e.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,e.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,e.ATTR_K8S_POD_NAME=`k8s.pod.name`,e.ATTR_OS_TYPE=`os.type`,e.ATTR_OS_VERSION=`os.version`,e.ATTR_PROCESS_COMMAND=`process.command`,e.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,e.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,e.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,e.ATTR_PROCESS_OWNER=`process.owner`,e.ATTR_PROCESS_PID=`process.pid`,e.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,e.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,e.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,e.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,e.ATTR_SERVICE_NAMESPACE=`service.namespace`,e.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,e.ATTR_WEBENGINE_NAME=`webengine.name`,e.ATTR_WEBENGINE_VERSION=`webengine.version`})),$n=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getMachineId=void 0;let n=t(`process`),i;async function a(){if(!i)switch(n.platform){case`darwin`:i=(await import(`./getMachineId-darwin-CCtDS2VI.mjs`).then(e=>r(e.default))).getMachineId;break;case`linux`:i=(await import(`./getMachineId-linux-DMjXicei.mjs`).then(e=>r(e.default))).getMachineId;break;case`freebsd`:i=(await import(`./getMachineId-bsd-Ba_eiHKT.mjs`).then(e=>r(e.default))).getMachineId;break;case`win32`:i=(await import(`./getMachineId-win-mbAJtBuz.mjs`).then(e=>r(e.default))).getMachineId;break;default:i=(await import(`./getMachineId-unsupported-x9lk4Rw9.mjs`).then(e=>r(e.default))).getMachineId;break}return i()}e.getMachineId=a})),er=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.normalizeType=e.normalizeArch=void 0,e.normalizeArch=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},e.normalizeType=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),tr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hostDetector=void 0;let n=F(),r=t(`os`),i=$n(),a=er();e.hostDetector=new class{detect(e){return{attributes:{[n.ATTR_HOST_NAME]:(0,r.hostname)(),[n.ATTR_HOST_ARCH]:(0,a.normalizeArch)((0,r.arch)()),[n.ATTR_HOST_ID]:(0,i.getMachineId)()}}}}})),nr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.osDetector=void 0;let n=F(),r=t(`os`),i=er();e.osDetector=new class{detect(e){return{attributes:{[n.ATTR_OS_TYPE]:(0,i.normalizeType)((0,r.platform)()),[n.ATTR_OS_VERSION]:(0,r.release)()}}}}})),rr=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.processDetector=void 0;let r=(g(),e(y)),i=F(),a=t(`os`);n.processDetector=new class{detect(e){let t={[i.ATTR_PROCESS_PID]:process.pid,[i.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[i.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[i.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[i.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[i.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[i.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(t[i.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let e=a.userInfo();t[i.ATTR_PROCESS_OWNER]=e.username}catch(e){r.diag.debug(`error obtaining process owner: ${e}`)}return{attributes:t}}}})),ir=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=void 0;let n=F(),r=t(`crypto`);e.serviceInstanceIdDetector=new class{detect(e){return{attributes:{[n.ATTR_SERVICE_INSTANCE_ID]:(0,r.randomUUID)()}}}}})),ar=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=tr();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}});var n=nr();Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}});var r=rr();Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return r.processDetector}});var i=ir();Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return i.serviceInstanceIdDetector}})})),or=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=ar();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return t.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return t.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return t.serviceInstanceIdDetector}})})),sr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.NoopDetector=void 0;var t=class{detect(){return{attributes:{}}}};e.NoopDetector=t,e.noopDetector=new t})),cr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=void 0;var t=Qn();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return t.envDetector}});var n=or();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=sr();Object.defineProperty(e,`noopDetector`,{enumerable:!0,get:function(){return r.noopDetector}})})),lr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=e.emptyResource=e.defaultResource=e.resourceFromAttributes=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=e.detectResources=void 0;var t=Zn();Object.defineProperty(e,`detectResources`,{enumerable:!0,get:function(){return t.detectResources}});var n=cr();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return n.envDetector}}),Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=Xn();Object.defineProperty(e,`resourceFromAttributes`,{enumerable:!0,get:function(){return r.resourceFromAttributes}}),Object.defineProperty(e,`defaultResource`,{enumerable:!0,get:function(){return r.defaultResource}}),Object.defineProperty(e,`emptyResource`,{enumerable:!0,get:function(){return r.emptyResource}});var i=Jn();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return i.defaultServiceName}})})),ur=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AggregationTemporality=void 0,(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(e.AggregationTemporality||={})})),I=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DataPointType=e.InstrumentType=void 0,(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(e.InstrumentType||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(e.DataPointType||={})})),L=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.equalsCaseInsensitive=e.binarySearchUB=e.setEquals=e.callWithTimeout=e.TimeoutError=e.instrumentationScopeId=e.hashAttributes=void 0;function t(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}e.hashAttributes=t;function n(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}e.instrumentationScopeId=n;var r=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};e.TimeoutError=r;function i(e,t){let n,i=new Promise(function(e,i){n=setTimeout(function(){i(new r(`Operation timed out.`))},t)});return Promise.race([e,i]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}e.callWithTimeout=i;function a(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}e.setEquals=a;function o(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}e.binarySearchUB=o;function s(e,t){return e.toLowerCase()===t.toLowerCase()}e.equalsCaseInsensitive=s})),R=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AggregatorKind=void 0,(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(e.AggregatorKind||={})})),dr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DropAggregator=void 0;let t=R();e.DropAggregator=class{kind=t.AggregatorKind.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}})),fr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HistogramAggregator=e.HistogramAccumulation=void 0;let t=R(),n=I(),r=L();function i(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var a=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=i(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=(0,r.binarySearchUB)(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}};e.HistogramAccumulation=a,e.HistogramAggregator=class{kind=t.AggregatorKind.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new a(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,o=r.buckets.counts,s=Array(i.length);for(let e=0;e<i.length;e++)s[e]=i[e]+o[e];let c=1/0,l=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(c=Math.min(n.min,r.min),l=Math.max(n.max,r.max)):n.hasMinMax?(c=n.min,l=n.max):r.hasMinMax&&(c=r.min,l=r.max)),new a(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:s},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:c,max:l})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,o=r.buckets.counts,s=Array(i.length);for(let e=0;e<i.length;e++)s[e]=o[e]-i[e];return new a(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:s},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:n.DataPointType.HISTOGRAM,dataPoints:r.map(([t,r])=>{let a=r.toPointValue(),o=e.type===n.InstrumentType.GAUGE||e.type===n.InstrumentType.UP_DOWN_COUNTER||e.type===n.InstrumentType.OBSERVABLE_GAUGE||e.type===n.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:r.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:o?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}}})),pr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Buckets=void 0,e.Buckets=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new t,n=0,r=0,i=0){this.backing=e,this.indexBase=n,this.indexStart=r,this.indexEnd=i}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}};var t=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}})),mr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSignificand=e.getNormalBase2=e.MIN_VALUE=e.MAX_NORMAL_EXPONENT=e.MIN_NORMAL_EXPONENT=e.SIGNIFICAND_WIDTH=void 0,e.SIGNIFICAND_WIDTH=52;let t=1023;e.MIN_NORMAL_EXPONENT=-t+1,e.MAX_NORMAL_EXPONENT=t,e.MIN_VALUE=2**-1022;function n(e){let n=new DataView(new ArrayBuffer(8));return n.setFloat64(0,e),((n.getUint32(0)&2146435072)>>20)-t}e.getNormalBase2=n;function r(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&1048575)*2**32+r}e.getSignificand=r})),hr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.nextGreaterSquare=e.ldexp=void 0;function t(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}e.ldexp=t;function n(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}e.nextGreaterSquare=n})),gr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MappingError=void 0,e.MappingError=class extends Error{}})),_r=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExponentMapping=void 0;let t=mr(),n=hr(),r=gr();e.ExponentMapping=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<t.MIN_VALUE?this._minNormalLowerBoundaryIndex():t.getNormalBase2(e)+this._rightShift(t.getSignificand(e)-1,t.SIGNIFICAND_WIDTH)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new r.MappingError(`underflow: ${e} is < minimum lower boundary: ${t}`);let i=this._maxNormalLowerBoundaryIndex();if(e>i)throw new r.MappingError(`overflow: ${e} is > maximum lower boundary: ${i}`);return n.ldexp(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=t.MIN_NORMAL_EXPONENT>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return t.MAX_NORMAL_EXPONENT>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}}})),vr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LogarithmMapping=void 0;let t=mr(),n=hr(),r=gr();e.LogarithmMapping=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=n.ldexp(Math.LOG2E,e),this._inverseFactor=n.ldexp(Math.LN2,-e)}mapToIndex(e){if(e<=t.MIN_VALUE)return this._minNormalLowerBoundaryIndex()-1;if(t.getSignificand(e)===0)return(t.getNormalBase2(e)<<this._scale)-1;let n=Math.floor(Math.log(e)*this._scaleFactor),r=this._maxNormalLowerBoundaryIndex();return n>=r?r:n}lowerBoundary(e){let n=this._maxNormalLowerBoundaryIndex();if(e>=n){if(e===n)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new r.MappingError(`overflow: ${e} is > maximum lower boundary: ${n}`)}let i=this._minNormalLowerBoundaryIndex();if(e<=i){if(e===i)return t.MIN_VALUE;if(e===i-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new r.MappingError(`overflow: ${e} is < minimum lower boundary: ${i}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return t.MIN_NORMAL_EXPONENT<<this._scale}_maxNormalLowerBoundaryIndex(){return(t.MAX_NORMAL_EXPONENT+1<<this._scale)-1}}})),yr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getMapping=void 0;let t=_r(),n=vr(),r=gr(),i=Array.from({length:31},(e,r)=>r>10?new n.LogarithmMapping(r-10):new t.ExponentMapping(r-10));function a(e){if(e>20||e<-10)throw new r.MappingError(`expected scale >= -10 && <= 20, got: ${e}`);return i[e+10]}e.getMapping=a})),br=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ExponentialHistogramAggregator=t.ExponentialHistogramAccumulation=void 0;let n=R(),r=I(),i=(g(),e(y)),a=pr(),o=yr(),s=hr();var c=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},l=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=160,n=!0,r=0,s=0,c=0,l=1/0,u=-1/0,d=new a.Buckets,f=new a.Buckets,p=(0,o.getMapping)(20)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=s,this._zeroCount=c,this._min=l,this._max=u,this._positive=d,this._negative=f,this._mapping=p,this._maxSize<2&&(i.diag.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
3
3
  changing to the minimum size of: 2`),this._maxSize=2)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=(0,s.nextGreaterSquare)(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=(0,o.getMapping)(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=c.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=c.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new c(0,-1);let r=t-n;return new c(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}};t.ExponentialHistogramAccumulation=l,t.ExponentialHistogramAggregator=class{kind=n.AggregatorKind.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new l(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,i){return{descriptor:e,aggregationTemporality:t,dataPointType:r.DataPointType.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let a=n.toPointValue(),o=e.type===r.InstrumentType.GAUGE||e.type===r.InstrumentType.UP_DOWN_COUNTER||e.type===r.InstrumentType.OBSERVABLE_GAUGE||e.type===r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:o?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}}})),xr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LastValueAggregator=e.LastValueAccumulation=void 0;let t=R(),n=b(),r=I();var i=class{startTime;_current;sampleTime;constructor(e,t=0,n=[0,0]){this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=(0,n.millisToHrTime)(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}};e.LastValueAccumulation=i,e.LastValueAggregator=class{kind=t.AggregatorKind.LAST_VALUE;createAccumulation(e){return new i(e)}merge(e,t){let r=(0,n.hrTimeToMicroseconds)(t.sampleTime)>=(0,n.hrTimeToMicroseconds)(e.sampleTime)?t:e;return new i(e.startTime,r.toPointValue(),r.sampleTime)}diff(e,t){let r=(0,n.hrTimeToMicroseconds)(t.sampleTime)>=(0,n.hrTimeToMicroseconds)(e.sampleTime)?t:e;return new i(t.startTime,r.toPointValue(),r.sampleTime)}toMetricData(e,t,n,i){return{descriptor:e,aggregationTemporality:t,dataPointType:r.DataPointType.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:i,value:t.toPointValue()}))}}}})),Sr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SumAggregator=e.SumAccumulation=void 0;let t=R(),n=I();var r=class{startTime;monotonic;_current;reset;constructor(e,t,n=0,r=!1){this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}};e.SumAccumulation=r,e.SumAggregator=class{kind=t.AggregatorKind.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new r(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),i=t.toPointValue();return t.reset?new r(t.startTime,this.monotonic,i,t.reset):new r(e.startTime,this.monotonic,n+i)}diff(e,t){let n=e.toPointValue(),i=t.toPointValue();return this.monotonic&&n>i?new r(t.startTime,this.monotonic,i,!0):new r(t.startTime,this.monotonic,i-n)}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:n.DataPointType.SUM,dataPoints:r.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:i,value:t.toPointValue()})),isMonotonic:this.monotonic}}}})),Cr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SumAggregator=e.SumAccumulation=e.LastValueAggregator=e.LastValueAccumulation=e.ExponentialHistogramAggregator=e.ExponentialHistogramAccumulation=e.HistogramAggregator=e.HistogramAccumulation=e.DropAggregator=void 0;var t=dr();Object.defineProperty(e,`DropAggregator`,{enumerable:!0,get:function(){return t.DropAggregator}});var n=fr();Object.defineProperty(e,`HistogramAccumulation`,{enumerable:!0,get:function(){return n.HistogramAccumulation}}),Object.defineProperty(e,`HistogramAggregator`,{enumerable:!0,get:function(){return n.HistogramAggregator}});var r=br();Object.defineProperty(e,`ExponentialHistogramAccumulation`,{enumerable:!0,get:function(){return r.ExponentialHistogramAccumulation}}),Object.defineProperty(e,`ExponentialHistogramAggregator`,{enumerable:!0,get:function(){return r.ExponentialHistogramAggregator}});var i=xr();Object.defineProperty(e,`LastValueAccumulation`,{enumerable:!0,get:function(){return i.LastValueAccumulation}}),Object.defineProperty(e,`LastValueAggregator`,{enumerable:!0,get:function(){return i.LastValueAggregator}});var a=Sr();Object.defineProperty(e,`SumAccumulation`,{enumerable:!0,get:function(){return a.SumAccumulation}}),Object.defineProperty(e,`SumAggregator`,{enumerable:!0,get:function(){return a.SumAggregator}})})),wr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DEFAULT_AGGREGATION=t.EXPONENTIAL_HISTOGRAM_AGGREGATION=t.HISTOGRAM_AGGREGATION=t.LAST_VALUE_AGGREGATION=t.SUM_AGGREGATION=t.DROP_AGGREGATION=t.DefaultAggregation=t.ExponentialHistogramAggregation=t.ExplicitBucketHistogramAggregation=t.HistogramAggregation=t.LastValueAggregation=t.SumAggregation=t.DropAggregation=void 0;let n=(g(),e(y)),r=Cr(),i=I();var a=class e{static DEFAULT_INSTANCE=new r.DropAggregator;createAggregator(t){return e.DEFAULT_INSTANCE}};t.DropAggregation=a;var o=class e{static MONOTONIC_INSTANCE=new r.SumAggregator(!0);static NON_MONOTONIC_INSTANCE=new r.SumAggregator(!1);createAggregator(t){switch(t.type){case i.InstrumentType.COUNTER:case i.InstrumentType.OBSERVABLE_COUNTER:case i.InstrumentType.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};t.SumAggregation=o;var s=class e{static DEFAULT_INSTANCE=new r.LastValueAggregator;createAggregator(t){return e.DEFAULT_INSTANCE}};t.LastValueAggregation=s;var c=class e{static DEFAULT_INSTANCE=new r.HistogramAggregator([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};t.HistogramAggregation=c;var l=class{_boundaries;_recordMinMax;constructor(e,t=!0){if(e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new r.HistogramAggregator(this._boundaries,this._recordMinMax)}};t.ExplicitBucketHistogramAggregation=l;var u=class{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new r.ExponentialHistogramAggregator(this._maxSize,this._recordMinMax)}};t.ExponentialHistogramAggregation=u;var d=class{_resolve(e){switch(e.type){case i.InstrumentType.COUNTER:case i.InstrumentType.UP_DOWN_COUNTER:case i.InstrumentType.OBSERVABLE_COUNTER:case i.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return t.SUM_AGGREGATION;case i.InstrumentType.GAUGE:case i.InstrumentType.OBSERVABLE_GAUGE:return t.LAST_VALUE_AGGREGATION;case i.InstrumentType.HISTOGRAM:return e.advice.explicitBucketBoundaries?new l(e.advice.explicitBucketBoundaries):t.HISTOGRAM_AGGREGATION}return n.diag.warn(`Unable to recognize instrument type: ${e.type}`),t.DROP_AGGREGATION}createAggregator(e){return this._resolve(e).createAggregator(e)}};t.DefaultAggregation=d,t.DROP_AGGREGATION=new a,t.SUM_AGGREGATION=new o,t.LAST_VALUE_AGGREGATION=new s,t.HISTOGRAM_AGGREGATION=new c,t.EXPONENTIAL_HISTOGRAM_AGGREGATION=new u,t.DEFAULT_AGGREGATION=new d})),z=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.toAggregation=e.AggregationType=void 0;let t=wr();var n;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(n=e.AggregationType||={});function r(e){switch(e.type){case n.DEFAULT:return t.DEFAULT_AGGREGATION;case n.DROP:return t.DROP_AGGREGATION;case n.SUM:return t.SUM_AGGREGATION;case n.LAST_VALUE:return t.LAST_VALUE_AGGREGATION;case n.EXPONENTIAL_HISTOGRAM:{let n=e;return new t.ExponentialHistogramAggregation(n.options?.maxSize,n.options?.recordMinMax)}case n.EXPLICIT_BUCKET_HISTOGRAM:{let n=e;return n.options==null?t.HISTOGRAM_AGGREGATION:new t.ExplicitBucketHistogramAggregation(n.options?.boundaries,n.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}e.toAggregation=r})),Tr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=e.DEFAULT_AGGREGATION_SELECTOR=void 0;let t=ur(),n=z();e.DEFAULT_AGGREGATION_SELECTOR=e=>({type:n.AggregationType.DEFAULT}),e.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=e=>t.AggregationTemporality.CUMULATIVE})),Er=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_ERROR_TYPE=e.METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION=e.OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER=e.ATTR_OTEL_COMPONENT_TYPE=e.ATTR_OTEL_COMPONENT_NAME=void 0,e.ATTR_OTEL_COMPONENT_NAME=`otel.component.name`,e.ATTR_OTEL_COMPONENT_TYPE=`otel.component.type`,e.OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER=`periodic_metric_reader`,e.METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION=`otel.sdk.metric_reader.collection.duration`,e.ATTR_ERROR_TYPE=`error.type`})),Dr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricReaderMetrics=void 0;let t=Er(),n=new Map;e.MetricReaderMetrics=class{collectionDuration;standardAttrs;constructor(e,r){let i=n.get(e)??0;n.set(e,i+1),this.standardAttrs={[t.ATTR_OTEL_COMPONENT_TYPE]:e,[t.ATTR_OTEL_COMPONENT_NAME]:`${e}/${i}`},this.collectionDuration=r.createHistogram(t.METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,n){let r=n?{...this.standardAttrs,[t.ATTR_ERROR_TYPE]:n}:this.standardAttrs;this.collectionDuration.record(e,r)}}})),Or=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.9.0`})),kr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MetricReader=void 0;let n=(g(),e(y)),r=L(),i=Tr(),a=Dr(),o=Or(),s=b();t.MetricReader=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(e){this._aggregationSelector=e?.aggregationSelector??i.DEFAULT_AGGREGATION_SELECTOR,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??i.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new a.MetricReaderMetrics(this._otelComponentType,n.createNoopMeter())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,o.VERSION);this._selfObsMetrics=new a.MetricReaderMetrics(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=(0,s.hrTime)(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=(0,s.hrTime)(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=(0,s.hrTimeToSeconds)((0,s.hrTimeDuration)(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){n.diag.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await(0,r.callWithTimeout)(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){n.diag.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await(0,r.callWithTimeout)(this.onForceFlush(),e.timeoutMillis)}}})),Ar=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.splitMetricData=void 0;function t(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}e.splitMetricData=t})),jr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.PeriodicExportingMetricReader=void 0;let n=(g(),e(y)),r=b(),i=kr(),a=L(),o=I(),s=Ar(),c=Er();t.PeriodicExportingMetricReader=class extends i.MetricReader{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(e){let{exporter:t,exportIntervalMillis:r=6e4,metricProducers:i,cardinalityLimits:a,maxExportBatchSize:s}=e,{exportTimeoutMillis:l=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:c.OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER,metricProducers:i,cardinalitySelector:e=>{let t={default:2e3,...a};switch(e){case o.InstrumentType.COUNTER:return t.counter??t.default;case o.InstrumentType.GAUGE:return t.gauge??t.default;case o.InstrumentType.HISTOGRAM:return t.histogram??t.default;case o.InstrumentType.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case o.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case o.InstrumentType.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case o.InstrumentType.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),r<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(l<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(s!==void 0&&(!Number.isInteger(s)||s<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(r<l){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);n.diag.info(`Timeout of ${l} exceeds the interval of ${r}. Clamping timeout to interval duration.`),l=r}this._exportInterval=r,this._exportTimeout=l,this._exporter=t,this._maxExportBatchSize=s}async _runOnce(){try{await this._doRun()}catch(e){(0,r.globalErrorHandler)(e)}}async _doRun(){if(this._ongoingExportPromise){n.diag.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&n.diag.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){n.diag.debug(`Error while resolving async portion of resource: `,e),(0,r.globalErrorHandler)(e)}if(e.scopeMetrics.length===0)return;let i=this._maxExportBatchSize?(0,s.splitMetricData)(e,this._maxExportBatchSize):[e],o=null;for(let e of i)try{let t=await(0,a.callWithTimeout)(r.internal._export(this._exporter,e),this._exportTimeout);t.code!==r.ExportResultCode.SUCCESS&&(o=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof a.TimeoutError){n.diag.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else n.diag.error(`PeriodicExportingMetricReader: metrics export threw error`,e),o=e instanceof Error?e:Error(String(e))}if(o)throw o};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){n.diag.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}})),Mr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemoryMetricExporter=void 0;let t=b();e.InMemoryMetricExporter=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(e){this._aggregationTemporality=e}export(e,n){if(this._shutdown){setTimeout(()=>n({code:t.ExportResultCode.FAILED}),0);return}this._metrics.push(e),setTimeout(()=>n({code:t.ExportResultCode.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(e){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}})),Nr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleMetricExporter=void 0;let t=b(),n=Tr();e.ConsoleMetricExporter=class e{_shutdown=!1;_temporalitySelector;constructor(e){this._temporalitySelector=e?.temporalitySelector??n.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR}export(n,r){if(this._shutdown){r({code:t.ExportResultCode.FAILED});return}return e._sendMetrics(n,r)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,n){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});n({code:t.ExportResultCode.SUCCESS})}}})),Pr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ViewRegistry=void 0,e.ViewRegistry=class{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}}})),B=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isValidName=t.isDescriptorCompatibleWith=t.createInstrumentDescriptorWithView=t.createInstrumentDescriptor=void 0;let n=(g(),e(y)),r=L();function i(e,t,r){return c(e)||n.diag.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??``,unit:r?.unit??``,valueType:r?.valueType??n.ValueType.DOUBLE,advice:r?.advice??{}}}t.createInstrumentDescriptor=i;function a(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}t.createInstrumentDescriptorWithView=a;function o(e,t){return(0,r.equalsCaseInsensitive)(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}t.isDescriptorCompatibleWith=o;let s=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function c(e){return s.test(e)}t.isValidName=c})),Fr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isObservableInstrument=t.ObservableUpDownCounterInstrument=t.ObservableGaugeInstrument=t.ObservableCounterInstrument=t.ObservableInstrument=t.HistogramInstrument=t.GaugeInstrument=t.CounterInstrument=t.UpDownCounterInstrument=t.SyncInstrument=void 0;let n=(g(),e(y));var r=class{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},r){if(typeof e!=`number`){n.diag.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===n.ValueType.INT&&!Number.isInteger(e)&&(n.diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,r,Date.now())}};t.SyncInstrument=r,t.UpDownCounterInstrument=class extends r{add(e,t,n){this._record(e,t,n)}},t.CounterInstrument=class extends r{add(e,t,r){if(e<0){n.diag.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,r)}},t.GaugeInstrument=class extends r{record(e,t,n){this._record(e,t,n)}},t.HistogramInstrument=class extends r{record(e,t,r){if(e<0){n.diag.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,r)}};var i=class{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,n){this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}};t.ObservableInstrument=i,t.ObservableCounterInstrument=class extends i{},t.ObservableGaugeInstrument=class extends i{},t.ObservableUpDownCounterInstrument=class extends i{};function a(e){return e instanceof i}t.isObservableInstrument=a})),Ir=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Meter=void 0;let t=B(),n=Fr(),r=I();e.Meter=class{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.GAUGE,i),o=this._meterSharedState.registerMetricStorage(a);return new n.GaugeInstrument(o,a)}createHistogram(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.HISTOGRAM,i),o=this._meterSharedState.registerMetricStorage(a);return new n.HistogramInstrument(o,a)}createCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.COUNTER,i),o=this._meterSharedState.registerMetricStorage(a);return new n.CounterInstrument(o,a)}createUpDownCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.UP_DOWN_COUNTER,i),o=this._meterSharedState.registerMetricStorage(a);return new n.UpDownCounterInstrument(o,a)}createObservableGauge(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.OBSERVABLE_GAUGE,i),o=this._meterSharedState.registerAsyncMetricStorage(a);return new n.ObservableGaugeInstrument(a,o,this._meterSharedState.observableRegistry)}createObservableCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.OBSERVABLE_COUNTER,i),o=this._meterSharedState.registerAsyncMetricStorage(a);return new n.ObservableCounterInstrument(a,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,i){let a=(0,t.createInstrumentDescriptor)(e,r.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER,i),o=this._meterSharedState.registerAsyncMetricStorage(a);return new n.ObservableUpDownCounterInstrument(a,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}})),Lr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricStorage=void 0;let t=B();e.MetricStorage=class{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=(0,t.createInstrumentDescriptor)(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}})),V=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeHashMap=e.HashMap=void 0;let t=L();var n=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??=this._hash(e),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}};e.HashMap=n,e.AttributeHashMap=class extends n{constructor(){super(t.hashAttributes)}}})),Rr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeltaMetricProcessor=void 0;let t=b(),n=L(),r=V();e.DeltaMetricProcessor=class{_activeCollectionStorage=new r.AttributeHashMap;_cumulativeMemoStorage=new r.AttributeHashMap;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=(0,n.hashAttributes)(this._overflowAttributes)}record(e,n,r){let i=this._activeCollectionStorage.get(n);if(!i){let a=(0,t.millisToHrTime)(r);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(a))?.record(e);return}i=this._aggregator.createAccumulation(a),this._activeCollectionStorage.set(n,i)}i?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new r.AttributeHashMap,e}}})),zr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TemporalMetricProcessor=void 0;let t=ur(),n=V();e.TemporalMetricProcessor=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(e,t){this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(n,i,a,o){this._stashAccumulations(a);let s=this._getMergedUnreportedAccumulations(n),c=s,l;if(this._reportHistory.has(n)){let r=this._reportHistory.get(n),i=r.collectionTime;l=r.aggregationTemporality,c=l===t.AggregationTemporality.CUMULATIVE?e.merge(r.accumulations,s,this._aggregator):e.calibrateStartTime(r.accumulations,s,i)}else l=n.selectAggregationTemporality(i.type);this._reportHistory.set(n,{accumulations:c,collectionTime:o,aggregationTemporality:l});let u=r(c);if(u.length!==0)return this._aggregator.toMetricData(i,l,u,o)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let r=new n.AttributeHashMap,i=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),i===void 0)return r;for(let t of i)r=e.merge(r,t,this._aggregator);return r}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}};function r(e){return Array.from(e.entries())}})),Br=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AsyncMetricStorage=void 0;let t=Lr(),n=Rr(),r=zr(),i=V();e.AsyncMetricStorage=class extends t.MetricStorage{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,i,a,o){super(e),this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new n.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new r.TemporalMetricProcessor(t,a),this._attributesProcessor=i}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new i.AttributeHashMap;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),Vr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getConflictResolutionRecipe=e.getDescriptionResolutionRecipe=e.getTypeConflictResolutionRecipe=e.getUnitConflictResolutionRecipe=e.getValueTypeConflictResolutionRecipe=e.getIncompatibilityDetails=void 0;function t(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}e.getIncompatibilityDetails=t;function n(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}e.getValueTypeConflictResolutionRecipe=n;function r(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}e.getUnitConflictResolutionRecipe=r;function i(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}e.getTypeConflictResolutionRecipe=i;function a(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
4
4
  \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
@@ -9,4 +9,4 @@ To resolve the conflict:`,(0,i.getConflictResolutionRecipe)(t,e))),a=o):r.diag.w
9
9
  `,`Details:
10
10
  `,(0,i.getIncompatibilityDetails)(t,e),`To resolve the conflict:
11
11
  `,(0,i.getConflictResolutionRecipe)(t,e))}return a}}})),Ur=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MultiMetricStorage=void 0;let n=(g(),e(y));t.MultiMetricStorage=class{_backingStorages;hasAttributeProcessor;constructor(e){this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,r,i){this.hasAttributeProcessor&&r===void 0&&(r=n.context.active());let a=this._backingStorages;for(let n=0;n<a.length;n++)a[n].record(e,t,r,i)}}})),Wr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BatchObservableResultImpl=t.ObservableResultImpl=void 0;let n=(g(),e(y)),r=V(),i=Fr();t.ObservableResultImpl=class{_buffer=new r.AttributeHashMap;_instrumentName;_valueType;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){n.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===n.ValueType.INT&&!Number.isInteger(e)&&(n.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},t.BatchObservableResultImpl=class{_buffer=new Map;observe(e,t,a={}){if(!(0,i.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o??(o=new r.AttributeHashMap,this._buffer.set(e,o)),typeof t!=`number`){n.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===n.ValueType.INT&&!Number.isInteger(t)&&(n.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||o.set(a,t)}}})),Gr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ObservableRegistry=void 0;let n=(g(),e(y)),r=Fr(),i=Wr(),a=L();t.ObservableRegistry=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let i=new Set(t.filter(r.isObservableInstrument));if(i.size===0){n.diag.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,i)>=0||this._batchCallbacks.push({callback:e,instruments:i})}removeBatchCallback(e,t){let n=new Set(t.filter(r.isObservableInstrument)),i=this._findBatchCallback(e,n);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await Promise.allSettled([...n,...r])).filter(e=>e.status===`rejected`).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:r})=>{let o=new i.ObservableResultImpl(r._descriptor.name,r._descriptor.valueType),s=Promise.resolve(n(o));t!=null&&(s=(0,a.callWithTimeout)(s,t)),await s,r._metricStorages.forEach(t=>{t.record(o._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:r})=>{let o=new i.BatchObservableResultImpl,s=Promise.resolve(n(o));t!=null&&(s=(0,a.callWithTimeout)(s,t)),await s,r.forEach(t=>{let n=o._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,a.setEquals)(n.instruments,t))}}})),Kr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SyncMetricStorage=void 0;let n=(g(),e(y)),r=Lr(),i=Rr(),a=zr();t.SyncMetricStorage=class extends r.MetricStorage{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,n,r,o){super(e),this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new i.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new a.TemporalMetricProcessor(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}hasAttributeProcessor;record(e,t,r,i){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,r??n.context.active())),this._deltaMetricStorage.record(e,t,i)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),qr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSharedState=void 0;let t=B(),n=Ir(),r=Br(),i=Hr(),a=Ur(),o=Gr(),s=Kr();e.MeterSharedState=class{metricStorageRegistry=new i.MetricStorageRegistry;observableRegistry=new o.ObservableRegistry;meter;_meterProviderSharedState;_instrumentationScope;constructor(e,t){this.meter=new n.Meter(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,s.SyncMetricStorage);return t.length===1?t[0]:new a.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,r.AsyncMetricStorage)}async collect(e,t,n){let r=await this.observableRegistry.observe(t,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(e);if(i.length===0)return null;let a=[];return i.forEach(n=>{let r=n.collect(e,t);r!=null&&a.push(r)}),a.length===0?{errors:r}:{scopeMetrics:{scope:this._instrumentationScope,metrics:a},errors:r}}_registerMetricStorage(e,n){let r=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(r=>{let i=(0,t.createInstrumentDescriptorWithView)(r,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let o=new n(i,r.aggregation.createAggregator(i),r.attributesProcessor,this._meterProviderSharedState.metricCollectors,r.aggregationCardinalityLimit);return this.metricStorageRegistry.register(o),o});if(r.length===0){let t=this._meterProviderSharedState.selectAggregations(e.type).map(([t,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(t,e);if(i!=null)return i;let a=r.createAggregator(e),o=t.selectCardinalityLimit(e.type),s=new n(e,a,void 0,[t],o);return this.metricStorageRegistry.registerForCollector(t,s),s});r=r.concat(t)}return r}}})),Jr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterProviderSharedState=void 0;let t=L(),n=Pr(),r=qr(),i=z();e.MeterProviderSharedState=class{viewRegistry=new n.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;resource;constructor(e){this.resource=e}getMeterSharedState(e){let n=(0,t.instrumentationScopeId)(e),i=this.meterSharedStates.get(n);return i??(i=new r.MeterSharedState(this,e),this.meterSharedStates.set(n,i)),i}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,i.toAggregation)(n.selectAggregation(e))]);return t}}})),Yr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricCollector=void 0;let t=b();e.MetricCollector=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let n=(0,t.millisToHrTime)(Date.now()),r=[],i=[],a=Array.from(this._sharedState.meterSharedStates.values()).map(async t=>{let a=await t.collect(this,n,e);a?.scopeMetrics!=null&&r.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(a),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:r},errors:i}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}}})),Xr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExactPredicate=e.PatternPredicate=void 0;let t=/[\^$\\.+?()[\]{}|]/g;e.PatternPredicate=class e{_matchAll;_regexp;constructor(t){t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(t,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},e.ExactPredicate=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}}})),Zr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.createMultiAttributesProcessor=e.createNoopAttributesProcessor=void 0;var t=class{process(e,t){return e}},n=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}},r=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=new Set(e)}process(e,t){let n={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._allowedAttributeNames.has(t)&&(n[t]=e[t]);return n}},i=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=new Set(e)}process(e,t){let n={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&!this._deniedAttributeNames.has(t)&&(n[t]=e[t]);return n}};function a(){return l}e.createNoopAttributesProcessor=a;function o(e){return new n(e)}e.createMultiAttributesProcessor=o;function s(e){return new r(e)}e.createAllowListAttributesProcessor=s;function c(e){return new i(e)}e.createDenyListAttributesProcessor=c;let l=new t})),Qr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InstrumentSelector=void 0;let t=Xr();e.InstrumentSelector=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new t.PatternPredicate(e?.name??`*`),this._type=e?.type,this._unitFilter=new t.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),$r=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSelector=void 0;let t=Xr();e.MeterSelector=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new t.ExactPredicate(e?.name),this._versionFilter=new t.ExactPredicate(e?.version),this._schemaUrlFilter=new t.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}})),ei=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.View=void 0;let t=Xr(),n=Zr(),r=Qr(),i=$r(),a=z();function o(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function s(e){if(o(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||t.PatternPredicate.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}e.View=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){s(e),e.attributesProcessors==null?this.attributesProcessor=(0,n.createNoopAttributesProcessor)():this.attributesProcessor=(0,n.createMultiAttributesProcessor)(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=(0,a.toAggregation)(e.aggregation??{type:a.AggregationType.DEFAULT}),this.instrumentSelector=new r.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new i.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}}})),ti=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MeterProvider=void 0;let n=(g(),e(y)),r=lr(),i=kr(),a=Jr(),o=Yr(),s=ei();t.MeterProvider=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new a.MeterProviderSharedState(e?.resource??(0,r.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new s.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new o.MetricCollector(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof i.MetricReader&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,r={}){return this._shutdown?(n.diag.warn(`A shutdown MeterProvider cannot provide a Meter`),(0,n.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:r.schemaUrl}).meter}async shutdown(e){if(this._shutdown){n.diag.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){n.diag.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}}})),ni=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TimeoutError=e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.AggregationType=e.MeterProvider=e.ConsoleMetricExporter=e.InMemoryMetricExporter=e.PeriodicExportingMetricReader=e.MetricReader=e.InstrumentType=e.DataPointType=e.AggregationTemporality=void 0;var t=ur();Object.defineProperty(e,`AggregationTemporality`,{enumerable:!0,get:function(){return t.AggregationTemporality}});var n=I();Object.defineProperty(e,`DataPointType`,{enumerable:!0,get:function(){return n.DataPointType}}),Object.defineProperty(e,`InstrumentType`,{enumerable:!0,get:function(){return n.InstrumentType}});var r=kr();Object.defineProperty(e,`MetricReader`,{enumerable:!0,get:function(){return r.MetricReader}});var i=jr();Object.defineProperty(e,`PeriodicExportingMetricReader`,{enumerable:!0,get:function(){return i.PeriodicExportingMetricReader}});var a=Mr();Object.defineProperty(e,`InMemoryMetricExporter`,{enumerable:!0,get:function(){return a.InMemoryMetricExporter}});var o=Nr();Object.defineProperty(e,`ConsoleMetricExporter`,{enumerable:!0,get:function(){return o.ConsoleMetricExporter}});var s=ti();Object.defineProperty(e,`MeterProvider`,{enumerable:!0,get:function(){return s.MeterProvider}});var c=z();Object.defineProperty(e,`AggregationType`,{enumerable:!0,get:function(){return c.AggregationType}});var l=Zr();Object.defineProperty(e,`createAllowListAttributesProcessor`,{enumerable:!0,get:function(){return l.createAllowListAttributesProcessor}}),Object.defineProperty(e,`createDenyListAttributesProcessor`,{enumerable:!0,get:function(){return l.createDenyListAttributesProcessor}});var u=L();Object.defineProperty(e,`TimeoutError`,{enumerable:!0,get:function(){return u.TimeoutError}})})),ri=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExceptionEventName=void 0,e.ExceptionEventName=`exception`})),ii=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatInspect=e.settledResourceAttributes=e.inspectCustom=void 0,e.inspectCustom=Symbol.for(`nodejs.util.inspect.custom`);function t(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}e.settledResourceAttributes=t;function n(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}e.formatInspect=n})),ai=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SpanImpl=void 0;let n=(g(),e(y)),r=b(),i=(C(),e(S)),a=ri(),o=ii();t.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:n.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=r.otperformance.now(),this._performanceOffset=t-(this._performanceStartTime+r.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return n.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,r.isAttributeValue)(t))return n.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:i}=this._spanLimits,a=!Object.prototype.hasOwnProperty.call(this.attributes,e);return i!==void 0&&this._attributesCount>=i&&a?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),a&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,i){if(this._isSpanEnded())return this;let{eventCountLimit:a}=this._spanLimits;if(a===0)return n.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;a!==void 0&&this.events.length>=a&&(this._droppedEventsCount===0&&n.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,r.isTimeInput)(t)&&((0,r.isTimeInput)(i)||(i=t),t=void 0);let o=(0,r.sanitizeAttributes)(t),{attributePerEventCountLimit:s}=this._spanLimits,c={},l=0,u=0;for(let e in o){if(!Object.prototype.hasOwnProperty.call(o,e))continue;let t=o[e];if(s!==void 0&&u>=s){l++;continue}c[e]=this._truncateToSize(t),u++}return this.events.push({name:e,attributes:c,time:this._getTime(i),droppedAttributesCount:l}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&n.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:i}=this._spanLimits,a=(0,r.sanitizeAttributes)(e.attributes),o={},s=0,c=0;for(let e in a){if(!Object.prototype.hasOwnProperty.call(a,e))continue;let t=a[e];if(i!==void 0&&c>=i){s++;continue}o[e]=this._truncateToSize(t),c++}let l={context:e.context};return c>0&&(l.attributes=o),s>0&&(l.droppedAttributesCount=s),this.links.push(l),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===n.SpanStatusCode.UNSET||this.status.code===n.SpanStatusCode.OK)return this;let t={code:e.code};return e.code===n.SpanStatusCode.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&n.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){n.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,r.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(n.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&n.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&n.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=r.otperformance.now())return(0,r.hrTime)(e+this._performanceOffset);if(typeof e==`number`)return(0,r.millisToHrTime)(e);if(e instanceof Date)return(0,r.millisToHrTime)(e.getTime());if((0,r.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,r.millisToHrTime)(Date.now());let t=r.otperformance.now()-this._performanceStartTime;return(0,r.addHrTimes)(this.startTime,(0,r.millisToHrTime)(t))}isRecording(){return this._ended===!1}recordException(e,t){let r={};typeof e==`string`?r[i.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[i.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[i.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[i.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[i.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[i.ATTR_EXCEPTION_TYPE]||r[i.ATTR_EXCEPTION_MESSAGE]?this.addEvent(a.ExceptionEventName,r,t):n.diag.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);n.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(n.diag.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[o.inspectCustom](e,t,n){let r={name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:(0,o.settledResourceAttributes)(this.resource)}};return(0,o.formatInspect)(`SpanImpl`,r,e,t,n)}}})),H=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SamplingDecision=void 0,(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(e.SamplingDecision||={})})),U=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTEL_COMPONENT_TYPE_VALUE_SIMPLE_SPAN_PROCESSOR=e.OTEL_COMPONENT_TYPE_VALUE_BATCHING_SPAN_PROCESSOR=e.METRIC_OTEL_SDK_SPAN_STARTED=e.METRIC_OTEL_SDK_SPAN_LIVE=e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE=e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY=e.METRIC_OTEL_SDK_PROCESSOR_SPAN_PROCESSED=e.ATTR_OTEL_SPAN_SAMPLING_RESULT=e.ATTR_OTEL_SPAN_PARENT_ORIGIN=e.ATTR_OTEL_COMPONENT_TYPE=e.ATTR_OTEL_COMPONENT_NAME=void 0,e.ATTR_OTEL_COMPONENT_NAME=`otel.component.name`,e.ATTR_OTEL_COMPONENT_TYPE=`otel.component.type`,e.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,e.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,e.METRIC_OTEL_SDK_PROCESSOR_SPAN_PROCESSED=`otel.sdk.processor.span.processed`,e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY=`otel.sdk.processor.span.queue.capacity`,e.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE=`otel.sdk.processor.span.queue.size`,e.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,e.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`,e.OTEL_COMPONENT_TYPE_VALUE_BATCHING_SPAN_PROCESSOR=`batching_span_processor`,e.OTEL_COMPONENT_TYPE_VALUE_SIMPLE_SPAN_PROCESSOR=`simple_span_processor`})),oi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TracerMetrics=void 0;let t=H(),n=U();e.TracerMetrics=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(n.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(n.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,a){let o=i(a);if(this.startedSpans.add(1,{[n.ATTR_OTEL_SPAN_PARENT_ORIGIN]:r(e),[n.ATTR_OTEL_SPAN_SAMPLING_RESULT]:o}),a===t.SamplingDecision.NOT_RECORD)return()=>{};let s={[n.ATTR_OTEL_SPAN_SAMPLING_RESULT]:o};return this.liveSpans.add(1,s),()=>{this.liveSpans.add(-1,s)}}};function r(e){return e?e.isRemote?`remote`:`local`:`none`}function i(e){switch(e){case t.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case t.SamplingDecision.RECORD:return`RECORD_ONLY`;case t.SamplingDecision.NOT_RECORD:return`DROP`}}})),si=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.9.0`})),ci=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Tracer=void 0;let n=(g(),e(y)),r=b(),i=ai(),a=oi(),o=si(),s=ii();t.Tracer=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,o.VERSION);this._tracerMetrics=new a.TracerMetrics(n)}startSpan(e,t={},a=n.context.active()){t.root&&(a=n.trace.deleteSpan(a));let o=n.trace.getSpan(a);if((0,r.isTracingSuppressed)(a))return n.diag.debug(`Instrumentation suppressed, returning Noop Span`),n.trace.wrapSpanContext(n.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!n.trace.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=t.kind??n.SpanKind.INTERNAL,p=(t.links??[]).map(e=>({context:e.context,attributes:(0,r.sanitizeAttributes)(e.attributes)})),ee=(0,r.sanitizeAttributes)(t.attributes),m=this._sampler.shouldSample(a,u,e,f,ee,p),te=this._tracerMetrics.startSpan(s,m.decision);d=m.traceState??d;let ne=m.decision===n.SamplingDecision.RECORD_AND_SAMPLED?n.TraceFlags.SAMPLED:n.TraceFlags.NONE,re={traceId:u,spanId:c,traceFlags:ne,traceState:d};if(m.decision===n.SamplingDecision.NOT_RECORD)return n.diag.debug(`Recording is off, propagating context in a non-recording span`),n.trace.wrapSpanContext(re);let ie=(0,r.sanitizeAttributes)(Object.assign(ee,m.attributes));return new i.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:a,spanContext:re,name:e,kind:f,links:p,parentSpanContext:l,attributes:ie,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:te})}startActiveSpan(e,t,r,i){let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=r):(a=t,o=r,s=i);let c=o??n.context.active(),l=this.startSpan(e,a,c),u=n.trace.setSpan(c,l);return n.context.with(u,s,void 0,l)}[s.inspectCustom](e,t,n){let r={instrumentationScope:this.instrumentationScope,resource:{attributes:(0,s.settledResourceAttributes)(this._resource)},spanLimits:this._spanLimits};return(0,s.formatInspect)(`Tracer`,r,e,t,n)}}})),li=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MultiSpanProcessor=void 0;let t=b();e.MultiSpanProcessor=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(e=>{(0,t.globalErrorHandler)(e||Error(`MultiSpanProcessor: forceFlush failed`)),n()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}})),ui=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AlwaysOffSampler=void 0;let t=H();e.AlwaysOffSampler=class{shouldSample(){return{decision:t.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),di=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AlwaysOnSampler=void 0;let t=H();e.AlwaysOnSampler=class{shouldSample(){return{decision:t.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),fi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ParentBasedSampler=void 0;let n=(g(),e(y)),r=b(),i=ui(),a=di();t.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=((0,r.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new a.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new a.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new i.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new a.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new i.AlwaysOffSampler}shouldSample(e,t,r,i,a,o){let s=n.trace.getSpanContext(e);return!s||!(0,n.isSpanContextValid)(s)?this._root.shouldSample(e,t,r,i,a,o):s.isRemote?s.traceFlags&n.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,t,r,i,a,o):this._remoteParentNotSampled.shouldSample(e,t,r,i,a,o):s.traceFlags&n.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,t,r,i,a,o):this._localParentNotSampled.shouldSample(e,t,r,i,a,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),pi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SpanProcessorMetrics=void 0;let n=(C(),e(S)),r=U(),i=new Map;t.SpanProcessorMetrics=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,a){let o=i.get(e)??0;if(i.set(e,o+1),this.standardAttrs={[r.ATTR_OTEL_COMPONENT_TYPE]:e,[r.ATTR_OTEL_COMPONENT_NAME]:`${e}/${o}`},this.droppedAttrs={...this.standardAttrs,[n.ATTR_ERROR_TYPE]:`queue_full`},this.processedSpans=t.createCounter(r.METRIC_OTEL_SDK_PROCESSOR_SPAN_PROCESSED,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),a){let{capacity:e,getQueueSize:n}=a;t.createUpDownCounter(r.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(r.METRIC_OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(n(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let r={...this.standardAttrs,[n.ATTR_ERROR_TYPE]:t.name};this.processedSpans.add(e,r)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}})),mi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BatchSpanProcessorBase=void 0;let n=(g(),e(y)),r=b(),i=pi(),a=U();t.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new r.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(n.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):(0,n.createNoopMeter)();this._metrics=new i.SpanProcessorMetrics(a.OTEL_COMPONENT_TYPE_VALUE_BATCHING_SPAN_PROCESSOR,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&n.TraceFlags.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&n.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(n.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let i=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);n.context.with((0,r.suppressTracing)(n.context.active()),()=>{let n;this._finishedSpans.length<=this._maxExportBatchSize?(n=this._finishedSpans,this._finishedSpans=[]):n=this._finishedSpans.splice(0,this._maxExportBatchSize);let a=()=>this._exporter.export(n,a=>{clearTimeout(i),this._metrics.finishSpans(n.length,a.error),a.code===r.ExportResultCode.SUCCESS?e():t(a.error??Error(`BatchSpanProcessor: span export failed`))}),o=null;for(let e=0,t=n.length;e<t;e++){let t=n[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(o??=[],o.push(t.resource.waitForAsyncAttributes()))}o===null?a():Promise.all(o).then(a,e=>{(0,r.globalErrorHandler)(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,(0,r.globalErrorHandler)(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),hi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchSpanProcessor=void 0;let t=mi();e.BatchSpanProcessor=class extends t.BatchSpanProcessorBase{onShutdown(){}}})),gi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=void 0,e.RandomIdGenerator=class{generateTraceId=n(16);generateSpanId=n(8)};let t=Buffer.allocUnsafe(16);function n(e){return function(){for(let n=0;n<e/4;n++)t.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<e&&!(t[n]>0);n++)n===e-1&&(t[e-1]=1);return t.toString(`hex`,0,e)}}})),_i=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=e.BatchSpanProcessor=void 0;var t=hi();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return t.BatchSpanProcessor}});var n=gi();Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return n.RandomIdGenerator}})})),vi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=e.BatchSpanProcessor=void 0;var t=_i();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return t.BatchSpanProcessor}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return t.RandomIdGenerator}})})),yi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TracerProvider=void 0;let n=(g(),e(y)),r=lr(),i=ci(),a=li(),o=fi(),s=di(),c=vi(),l=ii();var u;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(u||={}),t.TracerProvider=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??(0,r.defaultResource)();let t=e.spanProcessors??[];this._activeSpanProcessor=new a.MultiSpanProcessor(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new o.ParentBasedSampler({root:new s.AlwaysOnSampler}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new c.RandomIdGenerator,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return(0,n.createNoopMeter)()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new i.Tracer({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=u.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==u.timeout&&(r=u.resolved,n(r))}).catch(e=>{clearTimeout(i),r=u.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==u.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[l.inspectCustom](e,t,n){let r=this._activeSpanProcessor._spanProcessors,i={resource:{attributes:(0,l.settledResourceAttributes)(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)};return(0,l.formatInspect)(`TracerProvider`,i,e,t,n)}}})),bi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleSpanExporter=void 0;let t=b();e.ConsoleSpanExporter=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,t.hrTimeToMicroseconds)(e.startTime),duration:(0,t.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(n)return n({code:t.ExportResultCode.SUCCESS})}}})),xi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemorySpanExporter=void 0;let t=b();e.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:t.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...e),setTimeout(()=>n({code:t.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),Si=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SimpleSpanProcessor=void 0;let n=(g(),e(y)),r=b(),i=pi(),a=U();t.SimpleSpanProcessor=class{_exporter;_metrics;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e.exporter,this._shutdownOnce=new r.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set;let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):(0,n.createNoopMeter)();this._metrics=new i.SpanProcessorMetrics(a.OTEL_COMPONENT_TYPE_VALUE_SIMPLE_SPAN_PROCESSOR,t)}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&n.TraceFlags.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>(0,r.globalErrorHandler)(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await r.internal._export(this._exporter,[e]);if(this._metrics.finishSpans(1,t.error),t.code!==r.ExportResultCode.SUCCESS)throw t.error??Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._metrics.shutdown(),this._exporter.shutdown()}}})),Ci=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NoopSpanProcessor=void 0,e.NoopSpanProcessor=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),wi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createAlwaysRecordSampler=void 0;let t=H();function n(e){if(!e)throw Error(`createAlwaysRecordSampler requires a delegate sampler`);return{shouldSample(n,r,i,a,o,s){let c=e.shouldSample(n,r,i,a,o,s);return c.decision===t.SamplingDecision.NOT_RECORD?{decision:t.SamplingDecision.RECORD,attributes:c.attributes,traceState:c.traceState}:c},toString(){return`AlwaysRecordSampler{${e.toString()}}`}}}e.createAlwaysRecordSampler=n})),Ti=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TraceIdRatioBasedSampler=void 0;let n=(g(),e(y)),r=H();t.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:(0,n.isValidTraceId)(t)&&this._accumulate(t)<this._upperBound?r.SamplingDecision.RECORD_AND_SAMPLED:r.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}})),W=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SamplingDecision=e.TraceIdRatioBasedSampler=e.ParentBasedSampler=e.createAlwaysRecordSampler=e.AlwaysOnSampler=e.AlwaysOffSampler=e.NoopSpanProcessor=e.SimpleSpanProcessor=e.InMemorySpanExporter=e.ConsoleSpanExporter=e.RandomIdGenerator=e.BatchSpanProcessor=e.TracerProvider=void 0;var t=yi();Object.defineProperty(e,`TracerProvider`,{enumerable:!0,get:function(){return t.TracerProvider}});var n=vi();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return n.BatchSpanProcessor}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return n.RandomIdGenerator}});var r=bi();Object.defineProperty(e,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return r.ConsoleSpanExporter}});var i=xi();Object.defineProperty(e,`InMemorySpanExporter`,{enumerable:!0,get:function(){return i.InMemorySpanExporter}});var a=Si();Object.defineProperty(e,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return a.SimpleSpanProcessor}});var o=Ci();Object.defineProperty(e,`NoopSpanProcessor`,{enumerable:!0,get:function(){return o.NoopSpanProcessor}});var s=ui();Object.defineProperty(e,`AlwaysOffSampler`,{enumerable:!0,get:function(){return s.AlwaysOffSampler}});var c=di();Object.defineProperty(e,`AlwaysOnSampler`,{enumerable:!0,get:function(){return c.AlwaysOnSampler}});var l=wi();Object.defineProperty(e,`createAlwaysRecordSampler`,{enumerable:!0,get:function(){return l.createAlwaysRecordSampler}});var u=fi();Object.defineProperty(e,`ParentBasedSampler`,{enumerable:!0,get:function(){return u.ParentBasedSampler}});var d=Ti();Object.defineProperty(e,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return d.TraceIdRatioBasedSampler}});var f=H();Object.defineProperty(e,`SamplingDecision`,{enumerable:!0,get:function(){return f.SamplingDecision}})})),Ei=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.buildSamplerFromEnv=t.loadDefaultConfig=void 0;let n=(g(),e(y)),r=b(),i=W();var a;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(a||={});function o(){return{sampler:s(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,r.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,r.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,r.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}t.loadDefaultConfig=o;function s(){let e=(0,r.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??a.ParentBasedAlwaysOn;switch(e){case a.AlwaysOn:return new i.AlwaysOnSampler;case a.AlwaysOff:return new i.AlwaysOffSampler;case a.ParentBasedAlwaysOn:return new i.ParentBasedSampler({root:new i.AlwaysOnSampler});case a.ParentBasedAlwaysOff:return new i.ParentBasedSampler({root:new i.AlwaysOffSampler});case a.TraceIdRatio:return new i.TraceIdRatioBasedSampler(c());case a.ParentBasedTraceIdRatio:return new i.ParentBasedSampler({root:new i.TraceIdRatioBasedSampler(c())});default:return n.diag.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${a.ParentBasedAlwaysOn}".`),new i.ParentBasedSampler({root:new i.AlwaysOnSampler})}}t.buildSamplerFromEnv=s;function c(){let e=(0,r.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(n.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):e<0||e>1?(n.diag.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to 1.`),1):e}})),Di=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reconfigureLimits=e.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=e.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let t=b();e.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,e.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function n(n){let r=Object.assign({},n.spanLimits);return r.attributeCountLimit=n.spanLimits?.attributeCountLimit??n.generalLimits?.attributeCountLimit??(0,t.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??e.DEFAULT_ATTRIBUTE_COUNT_LIMIT,r.attributeValueLengthLimit=n.spanLimits?.attributeValueLengthLimit??n.generalLimits?.attributeValueLengthLimit??(0,t.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??e.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},n,{spanLimits:r})}e.reconfigureLimits=n})),Oi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BasicTracerProvider=void 0;let t=b(),n=Ei(),r=Di(),i=W();e.BasicTracerProvider=class extends i.TracerProvider{constructor(e={}){let i=(0,t.merge)({},(0,n.loadDefaultConfig)(),(0,r.reconfigureLimits)(e));delete i.generalLimits,super(i)}}})),ki=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchSpanProcessor=void 0;let t=b(),n=W();e.BatchSpanProcessor=class extends n.BatchSpanProcessor{constructor(e,n){n||={};for(let[e,r]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(n[e]===void 0){let i=(0,t.getNumberFromEnv)(r);i!==void 0&&(n[e]=i)}super({exporter:e,...n})}}})),Ai=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SimpleSpanProcessor=void 0;let t=W();e.SimpleSpanProcessor=class extends t.SimpleSpanProcessor{constructor(e){super({exporter:e})}}})),ji=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SamplingDecision=e.TraceIdRatioBasedSampler=e.ParentBasedSampler=e.AlwaysOnSampler=e.AlwaysOffSampler=e.NoopSpanProcessor=e.InMemorySpanExporter=e.RandomIdGenerator=e.ConsoleSpanExporter=e.SimpleSpanProcessor=e.BatchSpanProcessor=e.BasicTracerProvider=void 0;var t=Oi();Object.defineProperty(e,`BasicTracerProvider`,{enumerable:!0,get:function(){return t.BasicTracerProvider}});var n=ki();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return n.BatchSpanProcessor}});var r=Ai();Object.defineProperty(e,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return r.SimpleSpanProcessor}});var i=W();Object.defineProperty(e,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return i.ConsoleSpanExporter}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return i.RandomIdGenerator}}),Object.defineProperty(e,`InMemorySpanExporter`,{enumerable:!0,get:function(){return i.InMemorySpanExporter}}),Object.defineProperty(e,`NoopSpanProcessor`,{enumerable:!0,get:function(){return i.NoopSpanProcessor}}),Object.defineProperty(e,`AlwaysOffSampler`,{enumerable:!0,get:function(){return i.AlwaysOffSampler}}),Object.defineProperty(e,`AlwaysOnSampler`,{enumerable:!0,get:function(){return i.AlwaysOnSampler}}),Object.defineProperty(e,`ParentBasedSampler`,{enumerable:!0,get:function(){return i.ParentBasedSampler}}),Object.defineProperty(e,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return i.TraceIdRatioBasedSampler}}),Object.defineProperty(e,`SamplingDecision`,{enumerable:!0,get:function(){return i.SamplingDecision}})}));g();var Mi=vt(),Ni=b(),Pi=Hn(),Fi=qn(),Ii=lr(),Li=ni(),Ri=ji();C();const G=`open-knowledge-server`;let K=null,q=null,J=null;function zi(){return{tracer:v.getTracer(G),meter:h.getMeter(G)}}function Bi(e={}){let t=e.localSink!==void 0,n=process.env.OTEL_SDK_DISABLED===`false`;if(!t&&!n||K)return zi();try{let r=(0,Ii.resourceFromAttributes)({[ue]:process.env.OTEL_SERVICE_NAME||`open-knowledge-server`,[ge]:process.env.OTEL_SERVICE_VERSION||`0.2.0`}),i=new Mi.AsyncLocalStorageContextManager;le.setGlobalContextManager(i);let a=[],o=e.localSink?.attributeDenylist??ae;a.push(new de({attributeDenylist:o})),t&&e.localSink!==void 0&&(J=new he({projectDir:e.localSink.projectDir,maxBytes:e.localSink.spansMaxBytes}),a.push(new Ri.SimpleSpanProcessor(J))),n&&a.push(new Ri.BatchSpanProcessor(new Fi.OTLPTraceExporter));let s=new Ri.BasicTracerProvider({resource:r,spanProcessors:a});v.setGlobalTracerProvider(s),K=s;try{ce.setGlobalPropagator(new Ni.W3CTraceContextPropagator)}catch(e){x(`telemetry`).warn({err:e},`OpenTelemetry propagator init failed — file sink active, distributed trace correlation degraded`)}let c=null;n&&(c=new Li.MeterProvider({resource:r,readers:[new Li.PeriodicExportingMetricReader({exporter:new Pi.OTLPMetricExporter})]}),h.setGlobalMeterProvider(c)),q=c,x(`telemetry`).info({file_sink_enabled:t,otlp_push_enabled:n,otlp_endpoint:n?process.env.OTEL_EXPORTER_OTLP_ENDPOINT||`http://localhost:4318`:null,service_name:r.attributes[ue]},`OpenTelemetry initialized`)}catch(e){let t=x(`telemetry`);K===null?(t.error({err:e},`failed to initialize OpenTelemetry — falling back to no-op`),q=null,J=null):(t.warn({err:e},`OpenTelemetry metrics init failed — traces still active, metrics degraded`),q=null)}return zi()}const Vi=5e3,Hi=new Set;function Ui(e){Hi.add(e)}async function Wi(){let e=x(`telemetry`);for(let t of Hi)try{t()}catch(t){e.warn({err:t},`telemetry shutdown reset hook threw; continuing teardown`)}if(!K&&!q)return;let t=(J?J.forceFlush().catch(t=>{e.warn({err:t},`telemetry file-sink flush failed during shutdown`)}):Promise.resolve()).then(()=>Promise.all([K?.shutdown().catch(t=>{e.warn({err:t},`tracer provider shutdown failed`)}),q?.shutdown().catch(t=>{e.warn({err:t},`meter provider shutdown failed`)})])),n;await Promise.race([t.then(()=>(n!==void 0&&clearTimeout(n),!1)),new Promise(e=>{n=setTimeout(()=>e(!0),Vi),n.unref?.()})])&&e.warn({},`telemetry shutdown timed out after ${Vi}ms — data may be lost`),K=null,q=null,J=null,v.disable(),h.disable(),le.disable()}function Gi(){return v.getTracer(G)}function Ki(){return h.getMeter(G)}async function Y(e,t,n){return Gi().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:se.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function X(e,t,n){return Gi().startActiveSpan(e,t??{},e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:se.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function qi(e){let t=v.getSpan(le.active());t&&t.setAttributes(e)}function Z(e){let t=e.split(E).filter(Boolean);return t.length<=2?e:`...${E}${t.slice(-2).join(E)}`}function Ji(e){return e.includes(`${E}.git${E}ok${E}`)||e.includes(`shadow-repo`)?`shadow-repo`:e.includes(`${E}.git${E}`)?`git`:w(e).endsWith(`.lock`)||w(e)===`lock`?`lock`:w(e)===`principal.json`?`principal`:e.includes(`${E}.ok${E}`)&&(w(e)===`conflicts.json`||e.includes(`${E}conflicts${E}`))?`conflict`:e.includes(`${E}.ok${E}`)?`ok-internal`:e.endsWith(`.md`)||e.endsWith(`.mdx`)?`content-md`:`other`}function Q(e,t,n){let r={"fs.operation":e,"fs.path":Z(t),"fs.path.role":Ji(t)};return n&&Object.assign(r,n),r}function $(e){return typeof e==`string`?Buffer.byteLength(e,`utf-8`):e instanceof Uint8Array?e.byteLength:e.byteLength??0}async function Yi(e,t,n){return Y(`fs.writeFile`,{attributes:Q(`writeFile`,e,{"fs.bytes":$(t)})},async()=>{await Ue(e,t,n)})}async function Xi(e,t,n){return Y(`fs.appendFile`,{attributes:Q(`appendFile`,e,{"fs.bytes":$(t)})},async()=>{await Ie(e,t,n)})}async function Zi(e,t){return Y(`fs.rm`,{attributes:Q(`rm`,e)},async()=>{await Be(e,t)})}async function Qi(e,t){return Y(`fs.rename`,{attributes:Q(`rename`,t,{"fs.source_path":Z(e)})},async()=>{await ze(e,t)})}async function $i(e,t){return Y(`fs.mkdir`,{attributes:Q(`mkdir`,e)},async()=>Le(e,t))}function ea(e,t,n){X(`fs.writeFileSync`,{attributes:Q(`writeFileSync`,e,{"fs.bytes":$(t)})},()=>{Pe(e,t,n)})}function ta(e,t,n){X(`fs.appendFileSync`,{attributes:Q(`appendFileSync`,e,{"fs.bytes":$(t)})},()=>{be(e,t,n)})}function na(e,t){return X(`fs.mkdirSync`,{attributes:Q(`mkdirSync`,e)},()=>Te(e,t))}function ra(e,t){X(`fs.renameSync`,{attributes:Q(`renameSync`,t,{"fs.source_path":Z(e)})},()=>{ke(e,t)})}function ia(e,t,n){X(`fs.cpSync`,{attributes:Q(`cpSync`,t,{"fs.source_path":Z(e)})},()=>{Se(e,t,n)})}function aa(e){X(`fs.unlinkSync`,{attributes:Q(`unlinkSync`,e)},()=>{D(e)})}function oa(e,t){X(`fs.linkSync`,{attributes:Q(`linkSync`,t,{"fs.source_path":Z(e)})},()=>{we(e,t)})}function sa(e,t,n){X(`fs.symlinkSync`,{attributes:Q(`symlinkSync`,t,{"fs.source_path":Z(e)})},()=>{Ne(e,t,n)})}function ca(e,t){X(`fs.rmSync`,{attributes:Q(`rmSync`,e)},()=>{Ae(e,t)})}function la(e){X(`fs.rmdirSync`,{attributes:Q(`rmdirSync`,e)},()=>{je(e)})}const ua={writeFile:(e,t,n)=>Yi(e,t,n),rename:(e,t)=>Qi(e,t)};export{k as A,qi as C,pt as D,X as E,Je as F,rt as M,$e as N,st as O,et as P,Ui as S,Y as T,Yi as _,ua as a,Gi as b,$i as c,ra as d,Zi as f,aa as g,sa as h,ta as i,tt as j,lt as k,na as l,la as m,Z as n,ia as o,ca as p,Xi as r,oa as s,Ji as t,Qi as u,ea as v,Wi as w,Bi as x,Ki as y};
12
- //# sourceMappingURL=fs-traced-D12ehU8a.mjs.map
12
+ //# sourceMappingURL=fs-traced-ArlA_yTp.mjs.map
@@ -0,0 +1 @@
1
+ import{_ as e,c as t}from"./fs-traced-ArlA_yTp.mjs";export{t as tracedMkdir,e as tracedWriteFile};