@inkeep/open-knowledge 0.65.0-beta.0 → 0.65.0-beta.10
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.
- package/dist/{acp-harness-probe-D8GNCLKI.mjs → acp-harness-probe-0kysXPS3.mjs} +2 -2
- package/dist/assets/skills/packs/okf/SKILL.md +2 -1
- package/dist/assets/skills/project/references/components-and-visuals.md +1 -1
- package/dist/cli.mjs +16 -16
- package/dist/config-schema.json +9 -1
- package/dist/config.project-local.schema.json +9 -1
- package/dist/constants-DedAFfaQ.mjs +2 -0
- package/dist/fs-traced-ByTZUu6k.mjs +1 -0
- package/dist/{fs-traced-C5oeVBiQ.mjs → fs-traced-C5AXyho0.mjs} +2 -2
- package/dist/git-handle-CeiR-ZT6.mjs +1 -0
- package/dist/{git-handle-UnQwrdlT.mjs → git-handle-tSoVdwPX.mjs} +2 -2
- package/dist/index.d.mts +40 -1
- package/dist/index.mjs +167 -164
- package/dist/init-BChmDJQ4.mjs +1 -0
- package/dist/{init-eBP6ynxi.mjs → init-CJFMf0Pt.mjs} +3 -3
- package/dist/{launch-json-removal-BFpdcojK.mjs → launch-json-removal-D9Kpu384.mjs} +2 -2
- package/dist/loader-CgTokkEd.mjs +1 -0
- package/dist/{loader-CRRZ4eTQ.mjs → loader-t89TDKH-.mjs} +2 -2
- package/dist/md-manager-BI4O3a2W.mjs +2 -0
- package/dist/{open-browser-mXaE0V-v.mjs → open-browser-Dwh3SYxd.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-cPC1BHPG.mjs → preview-CVVCkcP3.mjs} +2 -2
- package/dist/preview-Jo70n6y1.mjs +1 -0
- package/dist/public/assets/ActivityModeContent-DHLRkmUf.js +1 -0
- package/dist/public/assets/{AddPropertiesButton-CDqx5oOU.js → AddPropertiesButton-CJf3djMt.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-DySEAYNs.js → AgentDiffPane-CL3qqW5L.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-XXRp8VNW.js → AgentThreadClientBinder-Cnk8titC.js} +1 -1
- package/dist/public/assets/{BugReportHistory-BzqzlDvE.js → BugReportHistory-CVREyd4K.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog--Su04gP8.js → BugReportHistoryDialog-BK5ks1Al.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-BM7OpNpf.js +3 -0
- package/dist/public/assets/{ConsentDialogBody-DWgT7k5c.js → ConsentDialogBody-BQ_fKUiO.js} +1 -1
- package/dist/public/assets/{DocumentContext-BId0aBaa.js → DocumentContext-D4-sdlnA.js} +9 -9
- package/dist/public/assets/{EditorModeToggle-D7GXfSQE.js → EditorModeToggle-D00jPWtj.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-CVKmC5yw.js → EnableSyncConfirmDialog-Dxi4MbUU.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-mxb0y2TR.js → ExcalidrawDocEditor-BFJVzGmK.js} +1 -1
- package/dist/public/assets/FeedbackForm-9dHSfS4a.js +1 -0
- package/dist/public/assets/{GraphPanel-DlmLJpXS.js → GraphPanel-DGW3J-Ha.js} +2 -2
- package/dist/public/assets/{ImportSkillDialog-WPJMdoUX.js → ImportSkillDialog-D-xDH6nL.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-CREx0S2c.js → LintConfigEditor-CA6cGIYg.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-B5dlxFFd.js +1 -0
- package/dist/public/assets/ManagedArtifactProperties-C-BMogEh.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-BeIZEdGa.js → MermaidDocEditor-B9X4OOzm.js} +1 -1
- package/dist/public/assets/PropertyDisplayRow-1okRxEyy.js +2 -0
- package/dist/public/assets/{ReportBugDialogBody-uz1wEEaL.js → ReportBugDialogBody-BSRU1H9A.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-CciQFblr.js → ReportBugMenuTrigger-DcH2LZLT.js} +2 -2
- package/dist/public/assets/{SchemaConfigEditor-sXi89wgY.js → SchemaConfigEditor-De_1t-Fp.js} +1 -1
- package/dist/public/assets/SessionsHost--dTOCWsD.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-BeSclbmh.js → SettingsDialogBody-DZPZfEx4.js} +4 -4
- package/dist/public/assets/{ShareBranchSwitchDialog-BuKFUw0e.js → ShareBranchSwitchDialog-BOB7Gs1O.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-ILk9qSQi.js → ShareReceiveDialog-C6O1U-80.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DSPm1Ymd.js → ShareReceiveMissDialog-DbAUwOz_.js} +1 -1
- package/dist/public/assets/{SkillCostValue-Dnq-P4nV.js → SkillCostValue-CULUHX1h.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-Bi5UjV5F.js → SkillEditBanner-Ci2waYek.js} +1 -1
- package/dist/public/assets/SkillInstallMenu-CcQ4rXjm.js +2 -0
- package/dist/public/assets/{SkillOriginInline-CxtxMYgG.js → SkillOriginInline-C6zCsZpu.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BonUlpuf.js → SkillToolbarControls-BWRfAnRt.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-BFw5X_I9.js → SlidesToolbarControls-DjnFahGv.js} +1 -1
- package/dist/public/assets/SourceEditor-DddbKAmO.js +1 -0
- package/dist/public/assets/TerminalPanel-CK5xSGJs.js +146 -0
- package/dist/public/assets/{TerminalWindowApp-Bg0ksRvd.js → TerminalWindowApp-DjNC3U-x.js} +1 -1
- package/dist/public/assets/{TextDocEditor-oysjAuPF.js → TextDocEditor-gh6CMivc.js} +1 -1
- package/dist/public/assets/{ThreadView-B6FpcgQA.js → ThreadView-Be84yxwe.js} +9 -9
- package/dist/public/assets/{TimelineDiffPane-CQtzCGhI.js → TimelineDiffPane-C0l2Bf5B.js} +1 -1
- package/dist/public/assets/{agent-diff-store-7YPKABFM.js → agent-diff-store-BYJQ8UAU.js} +1 -1
- package/dist/public/assets/auth-state-cache-BI-V32hk.js +11 -0
- package/dist/public/assets/{bug-report-send-manager-idwD-g0s.js → bug-report-send-manager-B5OBrvsh.js} +1 -1
- package/dist/public/assets/client-version-DP_DFbkp.js +1 -0
- package/dist/public/assets/{comment-chips-Dd3uvf5B.js → comment-chips-2fhX9RKd.js} +1 -1
- package/dist/public/assets/config-provider-CH25hiPj.js +5 -0
- package/dist/public/assets/{dist-C_QZEaeX.js → dist-CNUsB2q0.js} +122 -119
- package/dist/public/assets/doc-paths-BShtZt2N.js +1 -0
- package/dist/public/assets/{documents-events-CwqQxQT5.js → documents-events-B4_gdzXM.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-Blu63jOX.js → file-tree-adapter-DxRpIDJ8.js} +1 -1
- package/dist/public/assets/{file-tree-utils-CJ625FXw.js → file-tree-utils-BU-0tVMx.js} +1 -1
- package/dist/public/assets/{folder-config-api-Dxuhqlqr.js → folder-config-api-BjfmZE1E.js} +1 -1
- package/dist/public/assets/globals-BaOeic4_.css +1 -0
- package/dist/public/assets/i18n-30_sL_u7.js +1 -0
- package/dist/public/assets/{index-xtNevPWi.js → index-C0zLyhIb.js} +120 -120
- package/dist/public/assets/{launcher-selection-h6hBbSeu.js → launcher-selection-tWPyNXck.js} +1 -1
- package/dist/public/assets/{lint-config-client-CHoPvgQx.js → lint-config-client-DJ92O3EE.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-B15oIG0p.js → markdownlint-rule-browser-ClR8537V.js} +1 -1
- package/dist/public/assets/messages-B1y9my2y.js +1 -0
- package/dist/public/assets/messages-BLPbK3hY.js +1 -0
- package/dist/public/assets/messages-BXcet8bS.js +1 -0
- package/dist/public/assets/messages-BwTBQu-G.js +1 -0
- package/dist/public/assets/messages-CkfMXdXE.js +1 -0
- package/dist/public/assets/messages-CuLYOX5w.js +1 -0
- package/dist/public/assets/messages-Dea4EQjg.js +1 -0
- package/dist/public/assets/messages-IxOupfHQ.js +1 -0
- package/dist/public/assets/messages-Pn_9kcf-.js +1 -0
- package/dist/public/assets/messages-S6T9NAt6.js +1 -0
- package/dist/public/assets/messages-TF1JDcwi.js +1 -0
- package/dist/public/assets/messages-rf4KfpqB.js +1 -0
- package/dist/public/assets/page-list-cache-CdV30Rpz.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-DSQDb6m_.js → pending-receive-nav-store-BnfTQ1tD.js} +1 -1
- package/dist/public/assets/progress-w86CmZY7.js +9 -0
- package/dist/public/assets/{project-paths-Da-3VtPS.js → project-paths-CuywV7Pt.js} +1 -1
- package/dist/public/assets/prop-types-CeSzd9V3.js +1 -0
- package/dist/public/assets/{receive-store-CZytnhfP.js → receive-store-CXAmTr2-.js} +1 -1
- package/dist/public/assets/{selection-context-DcqZ3oLY.js → selection-context-DyXHLVzS.js} +1 -1
- package/dist/public/assets/{skill-scope-BOgGK9dw.js → skill-scope-C7vDwjos.js} +1 -1
- package/dist/public/assets/{skills-api-Cpxu_weC.js → skills-api-DwfG7_Ox.js} +1 -1
- package/dist/public/assets/{src-o99n4-mI.js → src-diXOV2W6.js} +1 -1
- package/dist/public/assets/{startup-marks-CwgakJzA.js → startup-marks-CxS3ch-T.js} +1 -1
- package/dist/public/assets/{tag-pill-input-Czha5J4D.js → tag-pill-input-CesVkRpl.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-C2Nfap4j.js → target-navigation-intent-DEVrbZZv.js} +1 -1
- package/dist/public/assets/{telemetry-startup-Cr2hA85U.js → telemetry-startup-DvSZlbqT.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-Dt4cbzju.js → terminal-cli-display-D5Yx8BYY.js} +1 -1
- package/dist/public/assets/terminal-command-events-CL99X6I2.js +1 -0
- package/dist/public/assets/typing-burst-detector-CV8eJchU.js +8 -0
- package/dist/public/assets/{uninstall-0vFtGMK2.js → uninstall-C2pTf0Bn.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DgMjR_uo.js → use-activity-panel-CwFDPRy2.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-pxpDfOq4.js → use-apply-config-color-theme-Huz8DxMv.js} +1 -1
- package/dist/public/assets/{use-collab-url-CrPRD0Do.js → use-collab-url-BPWe4f76.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-vRNyzDLo.js → use-live-xterm-theme-BK6xLi85.js} +1 -1
- package/dist/public/assets/{use-open-skill-DDH7y31F.js → use-open-skill-CZ1fVBS0.js} +1 -1
- package/dist/public/assets/{use-settings-route-6Aa41RPQ.js → use-settings-route-CUsaVNEW.js} +1 -1
- package/dist/public/assets/{use-skill-origin-CCXLtFlz.js → use-skill-origin-DMFgaCuR.js} +1 -1
- package/dist/public/assets/{use-skills-L0px0Zhw.js → use-skills-DIoMs6BD.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-UleqVo0K.js → use-terminal-enabled-CNvrm-_x.js} +1 -1
- package/dist/public/assets/use-timeline-entry-diff-BN0p_LxP.js +6 -0
- package/dist/public/assets/{use-workspace-7B06onC_.js → use-workspace-BLzLEi-_.js} +1 -1
- package/dist/public/index.html +51 -51
- package/dist/public/uninstall.html +6 -6
- package/dist/{repair-launch-json-CkxVvou7.mjs → repair-launch-json-DlGRZVwx.mjs} +2 -2
- package/dist/{repair-mcp-configs-DjVdyrm2.mjs → repair-mcp-configs-Ct8lk44M.mjs} +2 -2
- package/dist/{repair-skills-Dbdo1dep.mjs → repair-skills-BCpTKERH.mjs} +2 -2
- package/dist/repair-skills-CvFeICKK.mjs +1 -0
- package/dist/{resolve-project-root-BgZ293gs.mjs → resolve-project-root-DEipdv30.mjs} +5 -5
- package/dist/schemas/v0/config.project-local.schema.json +9 -1
- package/dist/server-lock-BtkTgyPE.mjs +1 -0
- package/dist/{server-lock-CcnGITIh.mjs → server-lock-CFtoCcIl.mjs} +2 -2
- package/dist/{skill-teardown-BQcurw-H.mjs → skill-teardown-CNyUhPcN.mjs} +2 -2
- package/dist/{sleep-DyLEGHvt.mjs → sleep-BZCw-NJO.mjs} +2 -2
- package/dist/src-BVV6pMrY.mjs +2041 -0
- package/dist/src-CRBq5Usz.mjs +1 -0
- package/dist/{src-DB7C0CZe.mjs → src-CaoQ9J7M.mjs} +1 -1
- package/dist/{src-CaLoSvK5.mjs → src-DYG0hctS.mjs} +130 -127
- package/dist/{src-BQg24g5w.mjs → src-l2oabBVG.mjs} +4 -4
- package/dist/start-CqK6A0Ss.mjs +1 -0
- package/dist/{start-Cx3sd9S_.mjs → start-ice1TOrd.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-DzLzqZ-e.mjs +0 -2
- package/dist/fs-traced-DiZ_Z58g.mjs +0 -1
- package/dist/git-handle-Bh1alj7a.mjs +0 -1
- package/dist/init-BX_9NOtu.mjs +0 -1
- package/dist/loader-BO6n9crj.mjs +0 -1
- package/dist/md-manager-BJ88tow5.mjs +0 -2
- package/dist/preview-DyOUTvCV.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-BfSvNw28.js +0 -1
- package/dist/public/assets/CodeMirrorPropInput-DtX4bjvR.js +0 -3
- package/dist/public/assets/FeedbackForm-RpZ8ZAA4.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-3wX-4L9A.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CEBc2qva.js +0 -1
- package/dist/public/assets/PropertyDisplayRow-DDOV4-Ci.js +0 -2
- package/dist/public/assets/SessionsHost-DUYXhSk4.js +0 -2
- package/dist/public/assets/SkillInstallMenu-DiCGjWcJ.js +0 -2
- package/dist/public/assets/SourceEditor-BzonD5kQ.js +0 -1
- package/dist/public/assets/TerminalPanel-Dqg_--C1.js +0 -146
- package/dist/public/assets/auth-state-cache-CrQ_9ffi.js +0 -11
- package/dist/public/assets/client-version-BH4Ct1dv.js +0 -1
- package/dist/public/assets/config-provider-C6FHgLZX.js +0 -5
- package/dist/public/assets/doc-paths-CzO1mA3r.js +0 -1
- package/dist/public/assets/globals-D1lEgZg7.css +0 -1
- package/dist/public/assets/i18n-Bn0IL-Jk.js +0 -1
- package/dist/public/assets/messages-20ZT_n81.js +0 -1
- package/dist/public/assets/messages-B2X-60YW.js +0 -1
- package/dist/public/assets/messages-B9Qrr14Q.js +0 -1
- package/dist/public/assets/messages-BUgRBtWn.js +0 -1
- package/dist/public/assets/messages-B_l2z4-1.js +0 -1
- package/dist/public/assets/messages-Bu7B_SFk.js +0 -1
- package/dist/public/assets/messages-CFu0nt3l.js +0 -1
- package/dist/public/assets/messages-CLBJUWjQ.js +0 -1
- package/dist/public/assets/messages-DagesR8a.js +0 -1
- package/dist/public/assets/messages-Dl-AHyyi.js +0 -1
- package/dist/public/assets/messages-mvZekN3y.js +0 -1
- package/dist/public/assets/messages-zTkemwXI.js +0 -1
- package/dist/public/assets/page-list-cache-CI-xFldj.js +0 -1
- package/dist/public/assets/progress-Cbjh5yOY.js +0 -9
- package/dist/public/assets/prop-types-DTEkSQcM.js +0 -1
- package/dist/public/assets/terminal-command-events-D0gJ8NJs.js +0 -1
- package/dist/public/assets/typing-burst-detector-BfXA1WDv.js +0 -8
- package/dist/public/assets/use-timeline-entry-diff-CZDwTk89.js +0 -6
- package/dist/repair-skills-CBdnIHQ1.mjs +0 -1
- package/dist/server-lock-D8d0WVYU.mjs +0 -1
- package/dist/src-C28fg0N6.mjs +0 -1
- package/dist/src-DGS-lA-C.mjs +0 -2041
- package/dist/start-Bzg4UT8v.mjs +0 -1
- /package/dist/public/assets/{globals-CVUc-u8t.js → globals-Bezfr5us.js} +0 -0
package/dist/config-schema.json
CHANGED
|
@@ -545,6 +545,14 @@
|
|
|
545
545
|
"type": "null"
|
|
546
546
|
}
|
|
547
547
|
]
|
|
548
|
+
},
|
|
549
|
+
"shell": {
|
|
550
|
+
"type": "string",
|
|
551
|
+
"scope": "project-local",
|
|
552
|
+
"agentSettable": false,
|
|
553
|
+
"reload": "live",
|
|
554
|
+
"defaultScope": "project-local",
|
|
555
|
+
"description": "Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync."
|
|
548
556
|
}
|
|
549
557
|
},
|
|
550
558
|
"additionalProperties": {}
|
|
@@ -1209,7 +1217,7 @@
|
|
|
1209
1217
|
"agentSettable": false,
|
|
1210
1218
|
"reload": "live",
|
|
1211
1219
|
"defaultScope": "project-local",
|
|
1212
|
-
"description": "Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m'
|
|
1220
|
+
"description": "Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared."
|
|
1213
1221
|
}
|
|
1214
1222
|
},
|
|
1215
1223
|
"additionalProperties": {}
|
|
@@ -208,6 +208,14 @@
|
|
|
208
208
|
"type": "null"
|
|
209
209
|
}
|
|
210
210
|
]
|
|
211
|
+
},
|
|
212
|
+
"shell": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"scope": "project-local",
|
|
215
|
+
"agentSettable": false,
|
|
216
|
+
"reload": "live",
|
|
217
|
+
"defaultScope": "project-local",
|
|
218
|
+
"description": "Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync."
|
|
211
219
|
}
|
|
212
220
|
},
|
|
213
221
|
"additionalProperties": {}
|
|
@@ -358,7 +366,7 @@
|
|
|
358
366
|
"agentSettable": false,
|
|
359
367
|
"reload": "live",
|
|
360
368
|
"defaultScope": "project-local",
|
|
361
|
-
"description": "Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m'
|
|
369
|
+
"description": "Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared."
|
|
362
370
|
}
|
|
363
371
|
},
|
|
364
372
|
"additionalProperties": {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,c as t}from"./fs-traced-C5AXyho0.mjs";export{t as tracedMkdir,e as tracedWriteFile};
|
|
@@ -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{A as o,C as s,D as c,I as l,O as u,S as d,a as f,b as p,c as m,g as h,h as ee,k as te,p as ne,s as re,t as ie,u as ae,w as oe,x as se,yt as ce}from"./sleep-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-DTipWd-i.mjs";import{A as o,C as s,D as c,I as l,O as u,S as d,a as f,b as p,c as m,g as h,h as ee,k as te,p as ne,s as re,t as ie,u as ae,w as oe,x as se,yt as ce}from"./sleep-BZCw-NJO.mjs";import{a as le,c as ue,i as de,n as g,o as _,r as v,s as fe,t as y}from"./esm-DxvI2ZVA.mjs";import{C as pe,S as me,_ as b,c as he,g as x,h as ge,m as _e,o as ve,r as ye,v as S}from"./logger-Dq-cRhcP.mjs";import{basename as C,dirname as w,isAbsolute as be,join as xe,resolve as T,sep as E}from"node:path";import{appendFileSync as Se,closeSync as Ce,cpSync as we,existsSync as Te,fchmodSync as Ee,linkSync as De,mkdirSync as Oe,openSync as ke,readFileSync as Ae,readdirSync as je,renameSync as Me,rmSync as Ne,rmdirSync as Pe,statSync as D,symlinkSync as Fe,unlinkSync as O,writeFileSync as Ie,writeSync as Le}from"node:fs";import{homedir as Re}from"node:os";import{appendFile as ze,mkdir as Be,readdir as Ve,rename as He,rm as Ue,stat as We,unlink as Ge,writeFile as Ke}from"node:fs/promises";import*as qe from"zlib";import{Readable as Je}from"stream";g();var k=ce();function Ye(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=se({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function Xe(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return Me(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 Ze(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=o.parse({});if(!Te(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let s;try{s=Ae(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 c=(0,k.parseDocument)(s);if(c.errors.length>0){let e=c.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?Xe(t,r,i):void 0,s={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:s,diagnostics:[{...s}],...o===void 0?{}:{sidelinedTo:o}}}let l=c.toJSON()??{},u=ee({value:l,file:t,source:s,doc:c}),d=u.length>0?h(l):l,f=o.safeParse(d);if(!f.success){let e=Ye(f,c,s,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 o=n?Xe(t,r,i):void 0;return{valid:!1,value:a,error:e,diagnostics:[...u,...p(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]],...o===void 0?{}:{sidelinedTo:o}}}return{valid:!0,value:f.data,source:t,diagnostics:u}}const Qe=3e4,$e={writeFile:(e,t,n)=>Ke(e,t,n),rename:(e,t)=>He(e,t)};async function et(e){try{let t=w(e),n=`${C(e)}.tmp.`,r=Date.now()-Qe,i=await Ve(t);await Promise.all(i.map(async e=>{if(!e.startsWith(n))return;let i=xe(t,e);try{(await We(i)).mtimeMs<r&&await Ge(i)}catch{}}))}catch{}}function tt(e){try{let t=w(e),n=`${C(e)}.tmp.`,r=Date.now()-Qe;for(let e of je(t)){if(!e.startsWith(n))continue;let i=xe(t,e);try{D(i).mtimeMs<r&&O(i)}catch{}}}catch{}}async function nt(e,t,n={}){n.sweepStaleTmps!==!1&&await et(e);let r=n.fs??$e,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{O(i)}catch{}throw e}}function rt(e,t,n={}){tt(e);let r=`${e}.tmp.${crypto.randomUUID()}`;try{Ie(r,t,{encoding:`utf-8`,mode:n.mode??420}),Me(r,e)}catch(e){try{O(r)}catch{}throw e}}var A=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 it(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=ke(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=D(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{O(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new A(e,r);await ie(i);continue}try{return await t()}finally{try{Ce(s)}catch{}try{O(e)}catch{}}}}function at(e){let t=Date.now()+e;for(;Date.now()<t;);}function ot(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=ke(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=D(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{O(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new A(e,r);at(i);continue}try{return t()}finally{try{Ce(s)}catch{}try{O(e)}catch{}}}}const st=`config.yml`;function ct(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${ne}/${e===`user`?`config.user.schema.json`:e===`project-local`?`config.project-local.schema.json`:`config.project.schema.json`}`}function lt(e){return`# yaml-language-server: $schema=${ct(e)}\n`}function ut(e,t,n){if(e===`user`)return T(n??Re(),`.ok`,`global.yml`);let r=be(t)?t:T(t);return e===`project-local`?T(r,`.ok`,ae,st):T(r,`.ok`,st)}function j(e){return{ok:!1,error:e}}function dt(e){return{ok:!0,...e}}async function ft(e){return u(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await pt(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function pt(e){let{cwd:t,scope:n,patch:r,homedirOverride:i}=e,a=ut(n,t,i),o=oe(r,n);if(o!==null)return j(o);try{await Be(w(a),{recursive:!0})}catch(e){return j({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${a}: ${e instanceof Error?e.message:String(e)}`})}try{return await it(`${a}.lock`,()=>mt(e,a))}catch(e){if(e instanceof A)return j({code:`WRITE_ERROR`,detail:e.message});throw e}}async function mt(e,t){let{patch:n,scope:r,firstWriteHeader:i}=e,a=``,l=!1;if(Te(t)){l=!0;try{a=Ae(t,`utf-8`)}catch(e){return j({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let u=(0,k.parseDocument)(a);if(u.errors.length>0)return j({code:`YAML_PARSE`,detail:u.errors.map(e=>e.message).join(`; `)});if(u.contents===null)u.contents=u.createNode({});else if(!(0,k.isMap)(u.contents))return j({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,k.isSeq)(u.contents)?`sequence`:`scalar`}`});let f=d(u,n),p=u.toJSON(),m=te(`config.validate`,{"config.scope":r,"config.validation.layer":`L2`},e=>{let t=o.safeParse(p);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)c(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!m.success)return j({code:`SCHEMA_INVALID`,issues:m.error.issues.map(s)});let h=u.toString();if(!l){let e=i===void 0?lt(r):i??``;e.length>0&&(h=`${e.endsWith(`
|
|
2
2
|
`)?e:`${e}\n`}${h}`)}try{await Be(w(t),{recursive:!0})}catch(e){return j({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${t}: ${e instanceof Error?e.message:String(e)}`})}try{await nt(t,h)}catch(e){return j({code:`WRITE_ERROR`,detail:`Could not write ${t}: ${e instanceof Error?e.message:String(e)}`})}return dt({effective:m.data,appliedPaths:f,path:t,created:!l})}const ht=[`user`,`project`,`project-local`];function gt(e){let t=[];for(let n of ht){let r=ut(n,e.cwd,e.homedirOverride),i=Ze({absPath:r,sideline:!1,...e.warn?{warn:e.warn}:{}});for(let e of i.diagnostics)t.push(_t(e,n,r))}return{diagnostics:t}}function _t(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}}}const vt=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function yt(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:m(t.replaceAll(`_`,`-`))}function bt(e){for(let t of vt){let n=e[t]?.trim();if(!(n===void 0||n===``))return yt(n)}return null}function xt(e){let t=e.OK_LANG?.trim();if(!(t===void 0||t===``))return m(t)??void 0}function St(e=process.env){let t=xt(e),n=bt(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=yt(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}function Ct(e,t){let n;try{n=D(e).size}catch{n=void 0}let r=ke(e,re(n),384);try{Ee(r,384)}catch{}try{Le(r,f(new Date,t))}catch{}return r}var wt=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}})),Tt=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AsyncHooksContextManager=void 0;let r=(g(),e(y)),i=t(`async_hooks`),a=wt();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()}}})),Et=a((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AsyncLocalStorageContextManager=void 0;let r=(g(),e(y)),i=t(`async_hooks`),a=wt();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}}})),Dt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AsyncLocalStorageContextManager=e.AsyncHooksContextManager=void 0;var t=Tt();Object.defineProperty(e,`AsyncHooksContextManager`,{enumerable:!0,get:function(){return t.AsyncHooksContextManager}});var n=Et();Object.defineProperty(e,`AsyncLocalStorageContextManager`,{enumerable:!0,get:function(){return n.AsyncLocalStorageContextManager}})})),Ot=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||={})})),kt,At=n((()=>{kt=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()}}})),M,jt=n((()=>{M=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}}}));function Mt(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Nt(e){if(e!=null)return()=>e}function Pt(e,t,n){return{timeoutMillis:Mt(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Ft(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var It=n((()=>{})),Lt,Rt=n((()=>{(function(e){e.NONE=`none`,e.GZIP=`gzip`})(Lt||={})}));function zt(e){return new Bt(e.concurrencyLimit)}var Bt,Vt=n((()=>{Bt=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 Ht(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ut(){return{handleResponse(e){e==null||!Ht(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||_.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Wt=n((()=>{}));function Gt(e,t){return new Kt(e.transport,e.serializer,Ut(),e.promiseHandler,t.timeout)}var N,Kt,qt=n((()=>{N=x(),jt(),Wt(),g(),Kt=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 M(`Export failed with retryable status`)}):t({code:N.ExportResultCode.FAILED,error:new M(`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 Jt(e,t,n){return Gt({transport:n,serializer:t,promiseHandler:zt(e)},{timeout:e.timeoutMillis})}var Yt=n((()=>{Vt(),qt()})),Xt=i({CompressionAlgorithm:()=>Lt,OTLPExporterBase:()=>kt,OTLPExporterError:()=>M,createOtlpNetworkExportDelegate:()=>Jt,getSharedConfigurationDefaults:()=>Ft,mergeOtlpSharedConfigurationWithDefaults:()=>Pt}),Zt=n((()=>{At(),jt(),It(),Rt(),Yt()})),Qt=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPMetricExporterBase=t.LowMemoryTemporalitySelector=t.DeltaTemporalitySelector=t.CumulativeTemporalitySelector=void 0;let n=x(),r=ge(),i=Ot(),a=(Zt(),e(Xt)),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)}}})),$t=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`0.204.0`}));function en(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 tn=n((()=>{g()}));function nn(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 rn(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 an(e){return async t=>{let{Agent:n}=await(t===`http:`?import(`http`):import(`https`));return new n(e)}}function on(e,t,n){return{...Pt(e,t,n),headers:nn(en(e.headers),t.headers,n.headers),url:rn(e.url)??t.url??n.url,agentFactory:e.agentFactory??t.agentFactory??n.agentFactory}}function sn(e,t){return{...Ft(),headers:()=>e,url:`http://localhost:4318/`+t,agentFactory:an({keepAlive:!0})}}var cn=n((()=>{It(),tn()}));function ln(e){return[429,502,503,504].includes(e)}function un(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 dn=n((()=>{}));function fn(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&&ln(e.statusCode)?i({status:`retryable`,retryInMillis:un(e.headers[`retry-after`])}):i({status:`failure`,error:new M(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})}),pn(s,t.compression,r,e=>{i({status:`failure`,error:e})})}function pn(e,t,n,r){let i=mn(n);t===`gzip`&&(e.setHeader(`Content-Encoding`,`gzip`),i=i.on(`error`,r).pipe(qe.createGzip()).on(`error`,r)),i.pipe(e).on(`error`,r)}function mn(e){let t=new Je;return t.push(e),t.push(null),t}var hn=n((()=>{dn(),jt()}));async function gn(e){let{request:t}=await(e===`http:`?import(`http`):import(`https`));return t}function _n(e){return new vn(e)}var vn,yn=n((()=>{hn(),vn=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=>{fn(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),gn(t)]);e=this._utils={agent:n,request:r}}return e}}}));function bn(){return 2*En*Math.random()-En}function xn(e){return new Dn(e.transport)}var Sn,Cn,wn,Tn,En,Dn,On=n((()=>{Sn=5,Cn=1e3,wn=5e3,Tn=1.5,En=.2,Dn=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=Sn,a=Cn;for(;r.status===`retryable`&&i>0;){i--;let t=Math.max(Math.min(a,wn)+bn(),0);a*=Tn;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 kn(e,t){return Gt({transport:xn({transport:_n(e)}),serializer:t,promiseHandler:zt(e)},{timeout:e.timeoutMillis})}var An=n((()=>{qt(),yn(),Vt(),On()}));function jn(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 Mn(e){let t=jn(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=jn(`OTEL_EXPORTER_OTLP_TIMEOUT`);return t??n}function Nn(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 Pn(e){let t=Nn(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=Nn(`OTEL_EXPORTER_OTLP_COMPRESSION`);return t??n}function Fn(e){return{timeoutMillis:Mn(e),compression:Pn(e)}}var In=n((()=>{g()}));function Ln(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 Rn(e){try{return new URL(e).toString()}catch{_.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}}function zn(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 Bn(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_ENDPOINT`);if(t!==void 0)return zn(t,e)}function Vn(e){let t=(0,P.getStringFromEnv)(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`);if(t!==void 0)return Rn(t)}function Hn(e,t){return{...Fn(e),url:Vn(e)??Bn(t),headers:Nt(Ln(e))}}var P,Un=n((()=>{P=x(),g(),In(),It()}));function Wn(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 an(t)}function Gn(e,t,n,r){return e.metadata&&_.warn(`Metadata cannot be set when using http`),on({url:e.url,headers:Nt(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentFactory:Wn(e)},Hn(t,n),sn(r,n))}var Kn=n((()=>{cn(),Un(),g(),It()})),qn=i({convertLegacyHttpOptions:()=>Gn,createOtlpHttpExportDelegate:()=>kn,getSharedConfigurationFromEnvironment:()=>Fn,httpAgentFactoryFromOptions:()=>an}),Jn=n((()=>{cn(),An(),In(),Kn()})),Yn=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPMetricExporter=void 0;let n=Qt(),r=_e(),i=$t(),a=(Jn(),e(qn)),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)}}})),Xn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporter=void 0;var t=Yn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}})})),Zn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporter=void 0;var t=Xn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}})})),Qn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPMetricExporterBase=e.LowMemoryTemporalitySelector=e.DeltaTemporalitySelector=e.CumulativeTemporalitySelector=e.AggregationTemporalityPreference=e.OTLPMetricExporter=void 0;var t=Zn();Object.defineProperty(e,`OTLPMetricExporter`,{enumerable:!0,get:function(){return t.OTLPMetricExporter}});var n=Ot();Object.defineProperty(e,`AggregationTemporalityPreference`,{enumerable:!0,get:function(){return n.AggregationTemporalityPreference}});var r=Qt();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}})})),$n=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`0.204.0`})),er=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OTLPTraceExporter=void 0;let n=(Zt(),e(Xt)),r=$n(),i=_e(),a=(Jn(),e(qn));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))}}})),tr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=er();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),nr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=tr();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),rr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTLPTraceExporter=void 0;var t=nr();Object.defineProperty(e,`OTLPTraceExporter`,{enumerable:!0,get:function(){return t.OTLPTraceExporter}})})),ir=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})),ar=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isPromiseLike=void 0,e.isPromiseLike=e=>typeof e==`object`&&!!e&&typeof e.then==`function`})),or=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.defaultResource=t.emptyResource=t.resourceFromDetectedResource=t.resourceFromAttributes=void 0;let n=(g(),e(y)),r=x(),i=(S(),e(b)),a=ir(),o=ar();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=m(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 m(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)}})),sr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.detectResources=void 0;let n=(g(),e(y)),r=or();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)())})),cr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.envDetector=void 0;let n=(g(),e(y)),r=(S(),e(b)),i=x();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`})),lr=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})),ur=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}}})),dr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hostDetector=void 0;let n=F(),r=t(`os`),i=lr(),a=ur();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)()}}}}})),fr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.osDetector=void 0;let n=F(),r=t(`os`),i=ur();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)()}}}}})),pr=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}}}})),mr=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)()}}}}})),hr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=dr();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}});var n=fr();Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}});var r=pr();Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return r.processDetector}});var i=mr();Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return i.serviceInstanceIdDetector}})})),gr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=hr();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}})})),_r=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})),vr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=void 0;var t=cr();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return t.envDetector}});var n=gr();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=_r();Object.defineProperty(e,`noopDetector`,{enumerable:!0,get:function(){return r.noopDetector}})})),yr=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=sr();Object.defineProperty(e,`detectResources`,{enumerable:!0,get:function(){return t.detectResources}});var n=vr();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=or();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=ir();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return i.defaultServiceName}})})),br=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||={})})),xr=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){}}})),Sr=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}}})}}}})),Cr=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])}}})),wr=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})),Tr=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})),Er=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MappingError=void 0,e.MappingError=class extends Error{}})),Dr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExponentMapping=void 0;let t=wr(),n=Tr(),r=Er();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)}}})),Or=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LogarithmMapping=void 0;let t=wr(),n=Tr(),r=Er();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}}})),kr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getMapping=void 0;let t=Dr(),n=Or(),r=Er(),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})),Ar=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ExponentialHistogramAggregator=t.ExponentialHistogramAccumulation=void 0;let n=R(),r=I(),i=(g(),e(y)),a=Cr(),o=kr(),s=Tr();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}}})}}}})),jr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LastValueAggregator=e.LastValueAccumulation=void 0;let t=R(),n=x(),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()}))}}}})),Mr=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}}}})),Nr=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=xr();Object.defineProperty(e,`DropAggregator`,{enumerable:!0,get:function(){return t.DropAggregator}});var n=Sr();Object.defineProperty(e,`HistogramAccumulation`,{enumerable:!0,get:function(){return n.HistogramAccumulation}}),Object.defineProperty(e,`HistogramAggregator`,{enumerable:!0,get:function(){return n.HistogramAggregator}});var r=Ar();Object.defineProperty(e,`ExponentialHistogramAccumulation`,{enumerable:!0,get:function(){return r.ExponentialHistogramAccumulation}}),Object.defineProperty(e,`ExponentialHistogramAggregator`,{enumerable:!0,get:function(){return r.ExponentialHistogramAggregator}});var i=jr();Object.defineProperty(e,`LastValueAccumulation`,{enumerable:!0,get:function(){return i.LastValueAccumulation}}),Object.defineProperty(e,`LastValueAggregator`,{enumerable:!0,get:function(){return i.LastValueAggregator}});var a=Mr();Object.defineProperty(e,`SumAccumulation`,{enumerable:!0,get:function(){return a.SumAccumulation}}),Object.defineProperty(e,`SumAggregator`,{enumerable:!0,get:function(){return a.SumAggregator}})})),Pr=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=Nr(),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=Pr();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})),Fr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=e.DEFAULT_AGGREGATION_SELECTOR=void 0;let t=br(),n=z();e.DEFAULT_AGGREGATION_SELECTOR=e=>({type:n.AggregationType.DEFAULT}),e.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=e=>t.AggregationTemporality.CUMULATIVE})),Ir=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`})),Lr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricReaderMetrics=void 0;let t=Ir(),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)}}})),Rr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.9.0`})),zr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MetricReader=void 0;let n=(g(),e(y)),r=L(),i=Fr(),a=Lr(),o=Rr(),s=x();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)}}})),Br=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})),Vr=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.PeriodicExportingMetricReader=void 0;let n=(g(),e(y)),r=x(),i=zr(),a=L(),o=I(),s=Br(),c=Ir();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()}}})),Hr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemoryMetricExporter=void 0;let t=x();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()}}})),Ur=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleMetricExporter=void 0;let t=x(),n=Fr();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})}}})),Wr=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})),Gr=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})),Kr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Meter=void 0;let t=B(),n=Gr(),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)}}})),qr=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)}}})),Jr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeltaMetricProcessor=void 0;let t=x(),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}}})),Yr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TemporalMetricProcessor=void 0;let t=br(),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())}})),Xr=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AsyncMetricStorage=void 0;let t=qr(),n=Jr(),r=Yr(),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)}}})),Zr=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}}})),$r=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)}}})),ei=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BatchObservableResultImpl=t.ObservableResultImpl=void 0;let n=(g(),e(y)),r=V(),i=Gr();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)}}})),ti=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ObservableRegistry=void 0;let n=(g(),e(y)),r=Gr(),i=ei(),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))}}})),ni=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SyncMetricStorage=void 0;let n=(g(),e(y)),r=qr(),i=Jr(),a=Yr();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)}}})),ri=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSharedState=void 0;let t=B(),n=Kr(),r=Xr(),i=Qr(),a=$r(),o=ti(),s=ni();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}}})),ii=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterProviderSharedState=void 0;let t=L(),n=Wr(),r=ri(),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}}})),ai=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricCollector=void 0;let t=x();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}}})),oi=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)}}})),si=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})),ci=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InstrumentSelector=void 0;let t=oi();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}}})),li=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSelector=void 0;let t=oi();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}}})),ui=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.View=void 0;let t=oi(),n=si(),r=ci(),i=li(),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}}})),di=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MeterProvider=void 0;let n=(g(),e(y)),r=yr(),i=zr(),a=ii(),o=ai(),s=ui();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)))}}})),fi=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=br();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=zr();Object.defineProperty(e,`MetricReader`,{enumerable:!0,get:function(){return r.MetricReader}});var i=Vr();Object.defineProperty(e,`PeriodicExportingMetricReader`,{enumerable:!0,get:function(){return i.PeriodicExportingMetricReader}});var a=Hr();Object.defineProperty(e,`InMemoryMetricExporter`,{enumerable:!0,get:function(){return a.InMemoryMetricExporter}});var o=Ur();Object.defineProperty(e,`ConsoleMetricExporter`,{enumerable:!0,get:function(){return o.ConsoleMetricExporter}});var s=di();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=si();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}})})),pi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExceptionEventName=void 0,e.ExceptionEventName=`exception`})),mi=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})),hi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SpanImpl=void 0;let n=(g(),e(y)),r=x(),i=(S(),e(b)),a=pi(),o=mi();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`})),gi=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`}}})),_i=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.9.0`})),vi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Tracer=void 0;let n=(g(),e(y)),r=x(),i=hi(),a=gi(),o=_i(),s=mi();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)})),m=(0,r.sanitizeAttributes)(t.attributes),h=this._sampler.shouldSample(a,u,e,f,m,p),ee=this._tracerMetrics.startSpan(s,h.decision);d=h.traceState??d;let te=h.decision===n.SamplingDecision.RECORD_AND_SAMPLED?n.TraceFlags.SAMPLED:n.TraceFlags.NONE,ne={traceId:u,spanId:c,traceFlags:te,traceState:d};if(h.decision===n.SamplingDecision.NOT_RECORD)return n.diag.debug(`Recording is off, propagating context in a non-recording span`),n.trace.wrapSpanContext(ne);let re=(0,r.sanitizeAttributes)(Object.assign(m,h.attributes));return new i.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:a,spanContext:ne,name:e,kind:f,links:p,parentSpanContext:l,attributes:re,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:ee})}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)}}})),yi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MultiSpanProcessor=void 0;let t=x();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)})}}})),bi=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`}}})),xi=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`}}})),Si=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ParentBasedSampler=void 0;let n=(g(),e(y)),r=x(),i=bi(),a=xi();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()}}`}}})),Ci=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SpanProcessorMetrics=void 0;let n=(S(),e(b)),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)}}})),wi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BatchSpanProcessorBase=void 0;let n=(g(),e(y)),r=x(),i=Ci(),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)}}})),Ti=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchSpanProcessor=void 0;let t=wi();e.BatchSpanProcessor=class extends t.BatchSpanProcessorBase{onShutdown(){}}})),Ei=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)}}})),Di=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=e.BatchSpanProcessor=void 0;var t=Ti();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return t.BatchSpanProcessor}});var n=Ei();Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return n.RandomIdGenerator}})})),Oi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RandomIdGenerator=e.BatchSpanProcessor=void 0;var t=Di();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return t.BatchSpanProcessor}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return t.RandomIdGenerator}})})),ki=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TracerProvider=void 0;let n=(g(),e(y)),r=yr(),i=vi(),a=yi(),o=Si(),s=xi(),c=Oi(),l=mi();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)}}})),Ai=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleSpanExporter=void 0;let t=x();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})}}})),ji=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemorySpanExporter=void 0;let t=x();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}}})),Mi=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SimpleSpanProcessor=void 0;let n=(g(),e(y)),r=x(),i=Ci(),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()}}})),Ni=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()}}})),Pi=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})),Fi=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=ki();Object.defineProperty(e,`TracerProvider`,{enumerable:!0,get:function(){return t.TracerProvider}});var n=Oi();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return n.BatchSpanProcessor}}),Object.defineProperty(e,`RandomIdGenerator`,{enumerable:!0,get:function(){return n.RandomIdGenerator}});var r=Ai();Object.defineProperty(e,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return r.ConsoleSpanExporter}});var i=ji();Object.defineProperty(e,`InMemorySpanExporter`,{enumerable:!0,get:function(){return i.InMemorySpanExporter}});var a=Mi();Object.defineProperty(e,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return a.SimpleSpanProcessor}});var o=Ni();Object.defineProperty(e,`NoopSpanProcessor`,{enumerable:!0,get:function(){return o.NoopSpanProcessor}});var s=bi();Object.defineProperty(e,`AlwaysOffSampler`,{enumerable:!0,get:function(){return s.AlwaysOffSampler}});var c=xi();Object.defineProperty(e,`AlwaysOnSampler`,{enumerable:!0,get:function(){return c.AlwaysOnSampler}});var l=Pi();Object.defineProperty(e,`createAlwaysRecordSampler`,{enumerable:!0,get:function(){return l.createAlwaysRecordSampler}});var u=Si();Object.defineProperty(e,`ParentBasedSampler`,{enumerable:!0,get:function(){return u.ParentBasedSampler}});var d=Fi();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}})})),Ii=a((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.buildSamplerFromEnv=t.loadDefaultConfig=void 0;let n=(g(),e(y)),r=x(),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}})),Li=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=x();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})),Ri=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BasicTracerProvider=void 0;let t=x(),n=Ii(),r=Li(),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)}}})),zi=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchSpanProcessor=void 0;let t=x(),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})}}})),Bi=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})}}})),Vi=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=Ri();Object.defineProperty(e,`BasicTracerProvider`,{enumerable:!0,get:function(){return t.BasicTracerProvider}});var n=zi();Object.defineProperty(e,`BatchSpanProcessor`,{enumerable:!0,get:function(){return n.BatchSpanProcessor}});var r=Bi();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 Hi=Dt(),Ui=x(),Wi=Qn(),Gi=rr(),Ki=yr(),qi=fi(),Ji=Vi();S();const G=`open-knowledge-server`;let K=null,q=null,J=null;function Yi(){return{tracer:v.getTracer(G),meter:le.getMeter(G)}}function Xi(e={}){let t=e.localSink!==void 0,n=process.env.OTEL_SDK_DISABLED===`false`;if(!t&&!n||K)return Yi();try{let r=(0,Ki.resourceFromAttributes)({[me]:process.env.OTEL_SERVICE_NAME||`open-knowledge-server`,[pe]:process.env.OTEL_SERVICE_VERSION||`0.2.0`}),i=new Hi.AsyncLocalStorageContextManager;fe.setGlobalContextManager(i);let a=[],o=e.localSink?.attributeDenylist??l;a.push(new he({attributeDenylist:o})),t&&e.localSink!==void 0&&(J=new ve({projectDir:e.localSink.projectDir,maxBytes:e.localSink.spansMaxBytes}),a.push(new Ji.SimpleSpanProcessor(J))),n&&a.push(new Ji.BatchSpanProcessor(new Gi.OTLPTraceExporter));let s=new Ji.BasicTracerProvider({resource:r,spanProcessors:a});v.setGlobalTracerProvider(s),K=s;try{de.setGlobalPropagator(new Ui.W3CTraceContextPropagator)}catch(e){ye(`telemetry`).warn({err:e},`OpenTelemetry propagator init failed — file sink active, distributed trace correlation degraded`)}let c=null;n&&(c=new qi.MeterProvider({resource:r,readers:[new qi.PeriodicExportingMetricReader({exporter:new Wi.OTLPMetricExporter})]}),le.setGlobalMeterProvider(c)),q=c,ye(`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[me]},`OpenTelemetry initialized`)}catch(e){let t=ye(`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 Yi()}const Zi=5e3,Qi=new Set;function $i(e){Qi.add(e)}async function ea(){let e=ye(`telemetry`);for(let t of Qi)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),Zi),n.unref?.()})])&&e.warn({},`telemetry shutdown timed out after ${Zi}ms — data may be lost`),K=null,q=null,J=null,v.disable(),le.disable(),fe.disable()}function ta(){return v.getTracer(G)}function na(){return le.getMeter(G)}async function Y(e,t,n){return ta().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:ue.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function X(e,t,n){return ta().startActiveSpan(e,t??{},e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:ue.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function ra(e){let t=v.getSpan(fe.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 ia(e){return e.includes(`${E}.git${E}ok${E}`)||e.includes(`shadow-repo`)?`shadow-repo`:e.includes(`${E}.git${E}`)?`git`:C(e).endsWith(`.lock`)||C(e)===`lock`?`lock`:C(e)===`principal.json`?`principal`:e.includes(`${E}.ok${E}`)&&(C(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":ia(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 aa(e,t,n){return Y(`fs.writeFile`,{attributes:Q(`writeFile`,e,{"fs.bytes":$(t)})},async()=>{await Ke(e,t,n)})}async function oa(e,t,n){return Y(`fs.appendFile`,{attributes:Q(`appendFile`,e,{"fs.bytes":$(t)})},async()=>{await ze(e,t,n)})}async function sa(e,t){return Y(`fs.rm`,{attributes:Q(`rm`,e)},async()=>{await Ue(e,t)})}async function ca(e,t){return Y(`fs.rename`,{attributes:Q(`rename`,t,{"fs.source_path":Z(e)})},async()=>{await He(e,t)})}async function la(e,t){return Y(`fs.mkdir`,{attributes:Q(`mkdir`,e)},async()=>Be(e,t))}function ua(e,t,n){X(`fs.writeFileSync`,{attributes:Q(`writeFileSync`,e,{"fs.bytes":$(t)})},()=>{Ie(e,t,n)})}function da(e,t,n){X(`fs.appendFileSync`,{attributes:Q(`appendFileSync`,e,{"fs.bytes":$(t)})},()=>{Se(e,t,n)})}function fa(e,t){return X(`fs.mkdirSync`,{attributes:Q(`mkdirSync`,e)},()=>Oe(e,t))}function pa(e,t){X(`fs.renameSync`,{attributes:Q(`renameSync`,t,{"fs.source_path":Z(e)})},()=>{Me(e,t)})}function ma(e,t,n){X(`fs.cpSync`,{attributes:Q(`cpSync`,t,{"fs.source_path":Z(e)})},()=>{we(e,t,n)})}function ha(e){X(`fs.unlinkSync`,{attributes:Q(`unlinkSync`,e)},()=>{O(e)})}function ga(e,t){X(`fs.linkSync`,{attributes:Q(`linkSync`,t,{"fs.source_path":Z(e)})},()=>{De(e,t)})}function _a(e,t,n){X(`fs.symlinkSync`,{attributes:Q(`symlinkSync`,t,{"fs.source_path":Z(e)})},()=>{Fe(e,t,n)})}function va(e,t){X(`fs.rmSync`,{attributes:Q(`rmSync`,e)},()=>{Ne(e,t)})}function ya(e){X(`fs.rmdirSync`,{attributes:Q(`rmdirSync`,e)},()=>{Pe(e)})}const ba={writeFile:(e,t,n)=>aa(e,t,n),rename:(e,t)=>ca(e,t)};export{ut as A,ra as C,Ct as D,X as E,nt as F,rt as I,Ze as L,A as M,it as N,St as O,ot as P,$i as S,Y as T,aa as _,ba as a,ta as b,la as c,pa as d,sa as f,ha as g,_a as h,da as i,ft as j,gt as k,fa as l,ya as m,Z as n,ma as o,va as p,oa as r,ga as s,ia as t,ca as u,ua as v,ea as w,Xi as x,na as y};
|
|
12
|
-
//# sourceMappingURL=fs-traced-
|
|
12
|
+
//# sourceMappingURL=fs-traced-C5AXyho0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./git-handle-tSoVdwPX.mjs";export{e as createGitInstance};
|