claude-code-zanii 2.8.4
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/README.md +146 -0
- package/dist/chunks/AddWorkspaceDirectory-y_rd6sRl.js +1 -0
- package/dist/chunks/App-DgWSavG1.js +1 -0
- package/dist/chunks/ApproveApiKey-CJKWha-a.js +1 -0
- package/dist/chunks/ApproveApiKey-DTs2ExZH.js +1 -0
- package/dist/chunks/AssistantSessionChooser-BAhVk4id.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-XU_JPh7R.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-DV0Pi7ys.js +1 -0
- package/dist/chunks/ClaudeInChromeOnboarding-6erm_8Fn.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CjBvzB5s.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-ts0XnWwl.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-DySPdSqQ.js +1 -0
- package/dist/chunks/CustomSelect-DqZxzBZP.js +1 -0
- package/dist/chunks/DesktopHandoff-5c90JK88.js +1 -0
- package/dist/chunks/DevChannelsDialog-DCMderzu.js +1 -0
- package/dist/chunks/Dialog-Dgg8bqcG.js +1 -0
- package/dist/chunks/DiffDialog-BU765aqh.js +6 -0
- package/dist/chunks/Doctor-B73iDB-d.js +3 -0
- package/dist/chunks/Doctor-CLZDdNRo.js +1 -0
- package/dist/chunks/ExitFlow-DBqn2mUf.js +2 -0
- package/dist/chunks/Feedback-D-JHabwi.js +2 -0
- package/dist/chunks/Grove-D-uQNMMo.js +11 -0
- package/dist/chunks/HybridTransport-B-G4QJcy.js +4 -0
- package/dist/chunks/ITermBackend-KP1vKsRN.js +1 -0
- package/dist/chunks/InProcessTransport-ByBEKxrQ.js +1 -0
- package/dist/chunks/InvalidConfigDialog-CMqiZ5nG.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-CjPCKzVZ.js +1 -0
- package/dist/chunks/ListItem-B6MyhHvM.js +1 -0
- package/dist/chunks/MCPConnectionManager-BJ8PcYPe.js +1 -0
- package/dist/chunks/Message-DNxJ_tMS.js +1 -0
- package/dist/chunks/MessageSelector-D79Ug71B.js +3 -0
- package/dist/chunks/Messages-CtIbkB2M.js +11 -0
- package/dist/chunks/Onboarding-DVrgKrI9.js +1 -0
- package/dist/chunks/OverageCreditUpsell-D_td1ss4.js +1 -0
- package/dist/chunks/PermissionDialog-BCS22yEO.js +1 -0
- package/dist/chunks/PermissionDialog-C5O1fL53.js +1 -0
- package/dist/chunks/PermissionRequestTitle-CtlbBU9t.js +1 -0
- package/dist/chunks/PluginSettings-OPrg-_3N.js +17 -0
- package/dist/chunks/PressEnterToContinue-DmzxIgbZ.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-CcsKj5DK.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-JedFdsxU.js +1 -0
- package/dist/chunks/REPL-ByhyIRnf.js +1 -0
- package/dist/chunks/REPL-Clve-8zC.js +157 -0
- package/dist/chunks/RemoteCallout-BZcabEKb.js +1 -0
- package/dist/chunks/RemoteSessionManager-C2PIFDHt.js +1 -0
- package/dist/chunks/ResumeConversation-D3ZRTFcF.js +1 -0
- package/dist/chunks/SSETransport-DmZWnH0k.js +4 -0
- package/dist/chunks/SearchBox-DQg2Ph0V.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-CLO4nt6N.js +1 -0
- package/dist/chunks/SentryErrorBoundary-BVfBaOOU.js +2 -0
- package/dist/chunks/SentryErrorBoundary-DIaVFad-.js +1 -0
- package/dist/chunks/Settings-rOCxQdS8.js +2 -0
- package/dist/chunks/TeleportProgress-CP8IY6bz.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-DMmHgBqo.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-D5wEAW1-.js +1 -0
- package/dist/chunks/ThemePicker-Bgr7yOQB.js +1 -0
- package/dist/chunks/TmuxBackend-BzbtUtP1.js +9 -0
- package/dist/chunks/TrustDialog-BI5U3BQ0.js +1 -0
- package/dist/chunks/TungstenTool-CiQclNwj.js +1 -0
- package/dist/chunks/TungstenTool-kMqy-ifa.js +1 -0
- package/dist/chunks/ValidationErrorsList-DprGtB2w.js +2 -0
- package/dist/chunks/WelcomeV2-C4vfBnIy.js +1 -0
- package/dist/chunks/WindowsTerminalBackend-BSoezOCE.js +2 -0
- package/dist/chunks/add-dir-DpOmv6kv.js +1 -0
- package/dist/chunks/agentDisplay-DuYEwOwO.js +1 -0
- package/dist/chunks/agents-BlurXZrF.js +2 -0
- package/dist/chunks/agents-DhZf7ftU.js +103 -0
- package/dist/chunks/ajv-CDrSAj3O.js +8 -0
- package/dist/chunks/analytics-i6X1et4O.js +1 -0
- package/dist/chunks/ant-D9hd_iYy.js +1 -0
- package/dist/chunks/api-CoaOHwDQ.js +4 -0
- package/dist/chunks/api-DvyGR-L7.js +1 -0
- package/dist/chunks/api-YHYC4Zdk.js +1 -0
- package/dist/chunks/artifacts-BMAYdaqh.js +1 -0
- package/dist/chunks/asciicast-DpHRoebc.js +1 -0
- package/dist/chunks/asciicast-HG1EoAQe.js +4 -0
- package/dist/chunks/assistant-D4-qcNT1.js +1 -0
- package/dist/chunks/assistant-DO2ZmZn1.js +1 -0
- package/dist/chunks/assistant-Dd86NmJM.js +1 -0
- package/dist/chunks/attributionHooks-BUmHrLhB.js +1 -0
- package/dist/chunks/attributionTrailer-r2Pbpu2N.js +1 -0
- package/dist/chunks/auth-CF3BGNYT.js +1 -0
- package/dist/chunks/auth-DwWwG43F.js +1 -0
- package/dist/chunks/auth-V_Xk2iea.js +1 -0
- package/dist/chunks/autoMode-DUksX5_i.js +45 -0
- package/dist/chunks/autoModeDenials-0CPO-Jbu.js +1 -0
- package/dist/chunks/autonomy-C5mNhAdz.js +21 -0
- package/dist/chunks/autonomy-CLt1dWaC.js +1 -0
- package/dist/chunks/autonomyPanel-rioFnrQO.js +1 -0
- package/dist/chunks/axios-DPuSPBlH.js +1 -0
- package/dist/chunks/axios-Zh7qGPze.js +12 -0
- package/dist/chunks/backgroundHousekeeping-BGtfqu-J.js +1 -0
- package/dist/chunks/backgroundHousekeeping-BqKZEvy0.js +17 -0
- package/dist/chunks/banner-BGLr3KYQ.js +2 -0
- package/dist/chunks/base64-js-B1tFNiG0.js +1 -0
- package/dist/chunks/bedrockClient-BFzWuhQK.js +15 -0
- package/dist/chunks/bg-B-YgGwLj.js +9 -0
- package/dist/chunks/bg-IU4gG3jc.js +1 -0
- package/dist/chunks/branch-BWY5W7hf.js +3 -0
- package/dist/chunks/break-cache-CY-O23fJ.js +8 -0
- package/dist/chunks/bridge-CqWd70vK.js +2 -0
- package/dist/chunks/bridgeConfig-CWO8AmCY.js +1 -0
- package/dist/chunks/bridgeConfig-D38y9eXn.js +1 -0
- package/dist/chunks/bridgeConfig-EwUq__ct.js +1 -0
- package/dist/chunks/bridgeConfig-GYR-LUiu.js +1 -0
- package/dist/chunks/bridgeEnabled-DKqmLnKO.js +1 -0
- package/dist/chunks/bridgeEnabled-DZIGDtfY.js +1 -0
- package/dist/chunks/bridgeMain-CXVks2ND.js +1 -0
- package/dist/chunks/bridgeMain-D4nsECwJ.js +68 -0
- package/dist/chunks/bridgeMessaging-BUOZU_ba.js +1 -0
- package/dist/chunks/bridgePointer-BpzIEsD_.js +1 -0
- package/dist/chunks/browser-D1vC3BNd.js +1 -0
- package/dist/chunks/btw-CVXJwoXo.js +1 -0
- package/dist/chunks/buddy-BLcvL8lP.js +3 -0
- package/dist/chunks/bundledMode-DQNSSQbt.js +1 -0
- package/dist/chunks/caches-BrfvzKn5.js +1 -0
- package/dist/chunks/caches-CkSv3MfC.js +3 -0
- package/dist/chunks/capacityWake-BWCSatN6.js +1 -0
- package/dist/chunks/changeDetector-DEZU6tum.js +1 -0
- package/dist/chunks/changeDetector-Df7c6U3d.js +1 -0
- package/dist/chunks/channelAllowlist-BApjAS0V.js +1 -0
- package/dist/chunks/channelNotification-BjWwF85R.js +1 -0
- package/dist/chunks/channelNotification-D01YVwNj.js +1 -0
- package/dist/chunks/chokidar-DPwMBcWI.js +1 -0
- package/dist/chunks/chokidar-DkDXNCTz.js +1 -0
- package/dist/chunks/chrome-D7coxEOI.js +1 -0
- package/dist/chunks/chromeNativeHost-CPj9M_4-.js +1 -0
- package/dist/chunks/chunk-DR8-3Aex.js +1 -0
- package/dist/chunks/classPrivateFieldSet2-DZkxcFPS.js +1 -0
- package/dist/chunks/claudeAiLimitsHook-ATshVrOH.js +1 -0
- package/dist/chunks/claudeDesktop-PVa9tWsM.js +1 -0
- package/dist/chunks/cleanup-C-PGmKpV.js +1 -0
- package/dist/chunks/clear-CxGE9Ntr.js +1 -0
- package/dist/chunks/cliLaunch-CMXoY_LO.js +1 -0
- package/dist/chunks/client-BWED8Tbu.js +35 -0
- package/dist/chunks/client-CinDjeSq.js +7 -0
- package/dist/chunks/client-CpXGg9e0.js +1 -0
- package/dist/chunks/color-B3w_VQTn.js +1 -0
- package/dist/chunks/color-convert-BQZnVz_5.js +1 -0
- package/dist/chunks/commands-DFp48zwy.js +1 -0
- package/dist/chunks/commitAttribution-B0cXmbvv.js +2 -0
- package/dist/chunks/commitAttribution-DRSKRoH6.js +1 -0
- package/dist/chunks/common-BX7bn3hg.js +1 -0
- package/dist/chunks/common-Ce3LanTX.js +1 -0
- package/dist/chunks/common-DdLQuE2_.js +1 -0
- package/dist/chunks/common-HfKcqOYK.js +1 -0
- package/dist/chunks/compact-C8ljGMdo.js +3 -0
- package/dist/chunks/companion-mD1jw6xX.js +1 -0
- package/dist/chunks/completionCache-BqQXVTa9.js +1 -0
- package/dist/chunks/completionCache-BtP4vfAi.js +4 -0
- package/dist/chunks/computerUseLock-ADE_PhIK.js +1 -0
- package/dist/chunks/config-CmyaIIOY.js +1 -0
- package/dist/chunks/config-Rl1Y_Dtq.js +1 -0
- package/dist/chunks/connectHeadless-MFABhXpz.js +1 -0
- package/dist/chunks/constants-BM62Vf_X.js +1 -0
- package/dist/chunks/constants-BfXy-5cI.js +1 -0
- package/dist/chunks/context-BeiZkUNq.js +1 -0
- package/dist/chunks/context-noninteractive-CRdF3iv8.js +54 -0
- package/dist/chunks/controlMessageCompat-591iGHUK.js +1 -0
- package/dist/chunks/conversation-BoguXZEI.js +1 -0
- package/dist/chunks/conversation-yhs7tT-g.js +1 -0
- package/dist/chunks/copy-BpeUcqku.js +7 -0
- package/dist/chunks/createSSHSession-B3JOB4TE.js +6 -0
- package/dist/chunks/createSession-BJSnFBGt.js +1 -0
- package/dist/chunks/createSession-CnRHI3RU.js +1 -0
- package/dist/chunks/cron-iqTFGIos.js +1 -0
- package/dist/chunks/cronScheduler-zRXhgEEU.js +6 -0
- package/dist/chunks/cronTasks-CMJldfoP.js +2 -0
- package/dist/chunks/crossProjectResume-DxO6TX30.js +40 -0
- package/dist/chunks/cwd-B2guYBbl.js +1 -0
- package/dist/chunks/cwd-B5bbyUwz.js +1 -0
- package/dist/chunks/cwd-BXiaJzLh.js +1 -0
- package/dist/chunks/daemon-B3v4OoOu.js +2 -0
- package/dist/chunks/dangerousBackend-OmCzoW35.js +1 -0
- package/dist/chunks/datadog-3-Vvz0yz.js +1 -0
- package/dist/chunks/datadog-BQlp3bTs.js +1 -0
- package/dist/chunks/debug-BDBIipC1.js +2 -0
- package/dist/chunks/debug-C7tW7DFW.js +1 -0
- package/dist/chunks/debug-CjIaNjpK.js +5 -0
- package/dist/chunks/debugUtils-Dsg-UHeg.js +1 -0
- package/dist/chunks/defineProperty-CaCI0a5T.js +1 -0
- package/dist/chunks/desktop-C_SS0068.js +1 -0
- package/dist/chunks/detached-B7RNZeyl.js +5 -0
- package/dist/chunks/detect-libc-DFFGDzPC.js +1 -0
- package/dist/chunks/detectRepository-BnTCJAXR.js +1 -0
- package/dist/chunks/detectRepository-Gobn9eFt.js +1 -0
- package/dist/chunks/detection-CN_uLGU2.js +1 -0
- package/dist/chunks/detection-DW6grIlc.js +1 -0
- package/dist/chunks/diff-B8YmRG5T.js +1 -0
- package/dist/chunks/directoryCompletion-J560aATd.js +1 -0
- package/dist/chunks/dist-B1wOprSs.js +29 -0
- package/dist/chunks/dist-DZQOarNX.js +5 -0
- package/dist/chunks/dist-HZfkKiUF.js +20 -0
- package/dist/chunks/dist-es-4xyrZoNc2.js +1 -0
- package/dist/chunks/dist-es-6kjvVbJd.js +1 -0
- package/dist/chunks/dist-es-BJldFHbt.js +3 -0
- package/dist/chunks/dist-es-BM013UFT.js +1 -0
- package/dist/chunks/dist-es-BPPewn1A.js +1 -0
- package/dist/chunks/dist-es-BZGG3Hnm.js +1 -0
- package/dist/chunks/dist-es-BZjJL64k2.js +1 -0
- package/dist/chunks/dist-es-BctcPxLN.js +1 -0
- package/dist/chunks/dist-es-Bf2jR30y.js +1 -0
- package/dist/chunks/dist-es-BgLoR-hQ.js +1 -0
- package/dist/chunks/dist-es-BismPcTW.js +1 -0
- package/dist/chunks/dist-es-BrPzXmSP.js +1 -0
- package/dist/chunks/dist-es-Bu21Wvhs.js +1 -0
- package/dist/chunks/dist-es-BuWNNAXW.js +1 -0
- package/dist/chunks/dist-es-Bz11sFiK2.js +1 -0
- package/dist/chunks/dist-es-C5VplyPL2.js +5 -0
- package/dist/chunks/dist-es-C66BuLgn.js +1 -0
- package/dist/chunks/dist-es-CCIzgNln2.js +1 -0
- package/dist/chunks/dist-es-CLyx7Kge2.js +1 -0
- package/dist/chunks/dist-es-CUbatGdn.js +1 -0
- package/dist/chunks/dist-es-CYe_-TbD.js +1 -0
- package/dist/chunks/dist-es-C_IHUdzL.js +1 -0
- package/dist/chunks/dist-es-Ci_rKlMr.js +1 -0
- package/dist/chunks/dist-es-ClDZBAj7.js +1 -0
- package/dist/chunks/dist-es-Cp--qjOi.js +1 -0
- package/dist/chunks/dist-es-CzE4kW1L.js +9 -0
- package/dist/chunks/dist-es-DUg5w7-v.js +1 -0
- package/dist/chunks/dist-es-Dl0ZRczY.js +1 -0
- package/dist/chunks/dist-es-Do_155z5.js +1 -0
- package/dist/chunks/dist-es-DxIM0jd82.js +1 -0
- package/dist/chunks/dist-es-Fav2oBDs.js +1 -0
- package/dist/chunks/dist-es-TZjwPaGn.js +1 -0
- package/dist/chunks/dist-es-W22ud2el2.js +1 -0
- package/dist/chunks/dist-es-aU8-02YH.js +1 -0
- package/dist/chunks/dist-es-b3yZSGx82.js +1 -0
- package/dist/chunks/dist-es-dIP5JtXz.js +5 -0
- package/dist/chunks/dist-es-mQ4HvnYs2.js +1 -0
- package/dist/chunks/distRoot-CJaacAHy.js +1 -0
- package/dist/chunks/doctor-DLZPF4iY.js +1 -0
- package/dist/chunks/earlyInput-BTI1CSNt.js +2 -0
- package/dist/chunks/earlyInput-BwGtzhhP.js +1 -0
- package/dist/chunks/effort-BaHvpBWr.js +9 -0
- package/dist/chunks/entry-_e-lyRwv.js +14 -0
- package/dist/chunks/env-CesrOJJq.js +1 -0
- package/dist/chunks/envLessBridgeConfig-4oys0_9A.js +1 -0
- package/dist/chunks/envLessBridgeConfig-DJ1Sts3F.js +1 -0
- package/dist/chunks/envUtils-CFG7IQID.js +1 -0
- package/dist/chunks/errorLogSink-Ti4Suoz6.js +2 -0
- package/dist/chunks/escHotkey-CVn_80xM.js +259 -0
- package/dist/chunks/esm-BFnjHW38.js +1 -0
- package/dist/chunks/esm-BQg_LX3V.js +1 -0
- package/dist/chunks/esm-BtC6CMmM.js +1 -0
- package/dist/chunks/esm-BwzC0MQp.js +1 -0
- package/dist/chunks/esm-CFybeQ_Q.js +1 -0
- package/dist/chunks/esm-CK-5CT5X.js +1 -0
- package/dist/chunks/esm-CL1OwlZB.js +1 -0
- package/dist/chunks/esm-CMzgSTAl.js +1 -0
- package/dist/chunks/esm-CPE_H2Lx.js +1 -0
- package/dist/chunks/esm-CcWquv5a.js +10 -0
- package/dist/chunks/esm-CeNEpRZt.js +1 -0
- package/dist/chunks/esm-D7hykoRB.js +1 -0
- package/dist/chunks/esm-DUtcefEV.js +1 -0
- package/dist/chunks/esm-DhrUwJBp.js +1 -0
- package/dist/chunks/esm-Duu1fRQ8.js +1 -0
- package/dist/chunks/esm-Ght2BaU2.js +1 -0
- package/dist/chunks/esm-Q6Yz2GMx.js +56 -0
- package/dist/chunks/esm-WONEiurY.js +13 -0
- package/dist/chunks/event-streams-BumpU1aB.js +1 -0
- package/dist/chunks/eventLoopStallDetector-DxyFdg1h.js +1 -0
- package/dist/chunks/execAsync-ChKxDZ8C.js +1 -0
- package/dist/chunks/execFileNoThrow-DdmR1mBS.js +1 -0
- package/dist/chunks/execSyncWrapper-Ch4TNj8u.js +1 -0
- package/dist/chunks/execa-BMaINL7N.js +34 -0
- package/dist/chunks/executor-C7INr19-.js +1 -0
- package/dist/chunks/executor-Dnf3YYma.js +1604 -0
- package/dist/chunks/exit-BakzsOD0.js +1 -0
- package/dist/chunks/exit-CiDn2tN9.js +2 -0
- package/dist/chunks/export-b-6pqMqz.js +2 -0
- package/dist/chunks/exportRenderer-RxtEIyTm.js +1 -0
- package/dist/chunks/extra-usage-7EPJNjNW.js +1 -0
- package/dist/chunks/extra-usage-ChvuewCq.js +1 -0
- package/dist/chunks/extra-usage-core-BVhLtoDF.js +1 -0
- package/dist/chunks/extra-usage-noninteractive-_Njh6q-q.js +1 -0
- package/dist/chunks/extraUsage-qOBMQB6g.js +1 -0
- package/dist/chunks/extractMemories-CRBVNiG1.js +1 -0
- package/dist/chunks/fast-C4uw_g7o.js +1 -0
- package/dist/chunks/fast-CEaIzaPl.js +1 -0
- package/dist/chunks/featureCheck-B1GSTyhh.js +1 -0
- package/dist/chunks/featureCheck-DKigAPal.js +1 -0
- package/dist/chunks/feedback-Bf3TjjuD.js +1 -0
- package/dist/chunks/figures-fES5sASd.js +1 -0
- package/dist/chunks/fileStateCache-DAsLEZau.js +1 -0
- package/dist/chunks/files-B-m_4X8b.js +2 -0
- package/dist/chunks/findExecutable-D8vJrFnO.js +1 -0
- package/dist/chunks/firstPartyEventLogger-BtrGagNa.js +1 -0
- package/dist/chunks/flushGate-2zqab-Pp.js +1 -0
- package/dist/chunks/foundry-sdk-CtX8C0x3.js +1 -0
- package/dist/chunks/fpsMetrics-ts_jaF3g.js +1 -0
- package/dist/chunks/fuse-ivQ_eRwF.js +1 -0
- package/dist/chunks/gates-CmKoQ0O-.js +1 -0
- package/dist/chunks/gates-_wbPDQ3M.js +1 -0
- package/dist/chunks/gemini-DRx495gn.js +3 -0
- package/dist/chunks/generateRecap-Cv8gd_QF.js +1 -0
- package/dist/chunks/generateSessionName-Dpjg-u_x.js +1 -0
- package/dist/chunks/genericProcessUtils-BFJMxLqn.js +23 -0
- package/dist/chunks/getMachineId-bsd-C9pL9Ajr.js +1 -0
- package/dist/chunks/getMachineId-darwin-Ma4F9rJg.js +2 -0
- package/dist/chunks/getMachineId-linux-C0lXMqsj.js +1 -0
- package/dist/chunks/getMachineId-unsupported-ByHQTXat.js +1 -0
- package/dist/chunks/getMachineId-win-DZsXZmTz.js +1 -0
- package/dist/chunks/git-Bj8Ow4pJ.js +6 -0
- package/dist/chunks/git-Q_b4oZ17.js +1 -0
- package/dist/chunks/githubRepoPathMapping-DGivBX9h.js +1 -0
- package/dist/chunks/goal-BrHEJv8o.js +3 -0
- package/dist/chunks/goalStorage-CsuPOQbk.js +1 -0
- package/dist/chunks/graceful-fs-BuPWC-vB.js +2 -0
- package/dist/chunks/grok-CDkDDaY_.js +1 -0
- package/dist/chunks/growthbook-D3_Cr9n-.js +1 -0
- package/dist/chunks/growthbook-p4aJ_UMv.js +32 -0
- package/dist/chunks/hash-KW-tVnPp.js +1 -0
- package/dist/chunks/heapdump-CloylIZ9.js +5 -0
- package/dist/chunks/help-DpSJlHIc.js +1 -0
- package/dist/chunks/hooks-2pogt8nv.js +79 -0
- package/dist/chunks/hooks-BBODdwnE.js +1 -0
- package/dist/chunks/hostAdapter-B5KTUqhv.js +1 -0
- package/dist/chunks/hostGuard-DyWr2TwE.js +1 -0
- package/dist/chunks/httpAuthSchemes-CgPbtGos.js +13 -0
- package/dist/chunks/ide-CJEcfBZq.js +2 -0
- package/dist/chunks/inboundAttachments-RNpYpRTO.js +1 -0
- package/dist/chunks/index.min-DCDiLq-j.js +1 -0
- package/dist/chunks/initReplBridge-D2E6IM2B.js +1 -0
- package/dist/chunks/initReplBridge-p2uwDBPx.js +1 -0
- package/dist/chunks/insights-DnpZScKs.js +822 -0
- package/dist/chunks/install-D_vTxUlG.js +1 -0
- package/dist/chunks/install-github-app-BK8A7g3i.js +147 -0
- package/dist/chunks/install-slack-app-C47R9VoI.js +1 -0
- package/dist/chunks/instinctParser-DxKdI3JC.js +1 -0
- package/dist/chunks/instrumentation-DkdAJFrZ.js +12 -0
- package/dist/chunks/intl-Pse97ORk.js +1 -0
- package/dist/chunks/isObject-DaxDnPKm.js +1 -0
- package/dist/chunks/isSymbol-D7QeUnS5.js +1 -0
- package/dist/chunks/job-opl00C4l.js +2 -0
- package/dist/chunks/json-bigint-BRRVs1dv.js +8 -0
- package/dist/chunks/jsx-runtime-BTgGEFjL.js +1 -0
- package/dist/chunks/jws-B_ieuaZg.js +3 -0
- package/dist/chunks/jwtUtils-D-tJzoJY.js +1 -0
- package/dist/chunks/keybindings-mRf9VSe8.js +2 -0
- package/dist/chunks/lang-eH4EJErj.js +1 -0
- package/dist/chunks/language-DD9ar6RA.js +1 -0
- package/dist/chunks/language-EZLNdETg.js +1 -0
- package/dist/chunks/launchAgentsPlatform-Cq0_7-IM.js +1 -0
- package/dist/chunks/launchAutofixPr-Bw7aUHUs.js +18 -0
- package/dist/chunks/launchCommand-Bk1Fn-qZ.js +1 -0
- package/dist/chunks/launchLocalMemory-CLBCUgwd.js +3 -0
- package/dist/chunks/launchLocalVault-BfWJWrBg.js +3 -0
- package/dist/chunks/launchMemoryStores-DdnSVSDZ.js +1 -0
- package/dist/chunks/launchOnboarding-ziCEX3GI.js +8 -0
- package/dist/chunks/launchSchedule-G_c7sgmy.js +1 -0
- package/dist/chunks/launchSkillStore-Z1Kd7nCg.js +1 -0
- package/dist/chunks/launchTeleport-Dp9AFbPx.js +3 -0
- package/dist/chunks/launchVault-hwK-Ljek.js +1 -0
- package/dist/chunks/lazySchema-2sOku3cX.js +1 -0
- package/dist/chunks/lib-BHRYgENJ.js +8 -0
- package/dist/chunks/lib-DRyNc7xD.js +2 -0
- package/dist/chunks/lib-Ddq71jM5.js +14 -0
- package/dist/chunks/loadAgentsDir-Bz0FfcVt.js +5620 -0
- package/dist/chunks/loadAgentsDir-CLM0ws7u.js +1 -0
- package/dist/chunks/loadPluginHooks-B5SIS2uo.js +1 -0
- package/dist/chunks/loadSso-RY87rrJO.js +1 -0
- package/dist/chunks/localSearch-BLF6PSv2.js +1 -0
- package/dist/chunks/localSearch-CTycGe3E.js +1 -0
- package/dist/chunks/localSearch-inDahM8I.js +1 -0
- package/dist/chunks/lockfile--gk1HDM6.js +1 -0
- package/dist/chunks/log-B-Nj3Yed.js +1 -0
- package/dist/chunks/log-DVv8YiNo.js +1 -0
- package/dist/chunks/login-BeLvLowc.js +1 -0
- package/dist/chunks/login-DUUOeNoz.js +1 -0
- package/dist/chunks/logoV2Utils-D5SpeZ3C.js +1 -0
- package/dist/chunks/logout-C2QuTBdS.js +1 -0
- package/dist/chunks/magicDocs-CUXKi-Wv.js +57 -0
- package/dist/chunks/main-CFhpWtpC.js +1420 -0
- package/dist/chunks/main-sboa5RKc.js +31 -0
- package/dist/chunks/mappers-DLkk0PZz.js +1 -0
- package/dist/chunks/mcp-C2f6IgAp.js +2 -0
- package/dist/chunks/mcp-Djui9m3_.js +6 -0
- package/dist/chunks/mcp-DvTSxrJ4.js +1 -0
- package/dist/chunks/mcpServer-DMA0bdFC.js +1 -0
- package/dist/chunks/mcpServer-DxEHfW2v.js +1 -0
- package/dist/chunks/memoize-Bg2dXTzV.js +1 -0
- package/dist/chunks/memoize-DNnuA2aU.js +1 -0
- package/dist/chunks/memory-B9io9Zcv.js +1 -0
- package/dist/chunks/mobile-CPnnvkQV.js +2 -0
- package/dist/chunks/modalContext-B1b0Gsro.js +1 -0
- package/dist/chunks/mode-BDgwh_Xb.js +2 -0
- package/dist/chunks/model-B6cpEh-s.js +1 -0
- package/dist/chunks/model-BcunOCC9.js +1 -0
- package/dist/chunks/modelOptions-CHUHQ9WG.js +1 -0
- package/dist/chunks/normalization-cjPqid31.js +1 -0
- package/dist/chunks/oauth-CnBLewrU.js +1 -0
- package/dist/chunks/oauth-DMPGYAoZ.js +1 -0
- package/dist/chunks/observationStore-DVBxrSdI.js +4 -0
- package/dist/chunks/onChangeAppState-M61XDN6V.js +1 -0
- package/dist/chunks/open-CsUNPSNx.js +1 -0
- package/dist/chunks/openai-BHvlYW3m.js +2 -0
- package/dist/chunks/output-style-BtKuBrs4.js +1 -0
- package/dist/chunks/outputStyles-hHuIBkRB.js +84 -0
- package/dist/chunks/overageCreditGrant-BLFT-rF3.js +1 -0
- package/dist/chunks/p-map-C-WNcN6g.js +1 -0
- package/dist/chunks/p-map-CQ2NythB.js +1 -0
- package/dist/chunks/package-9IAs5Qf0.js +1 -0
- package/dist/chunks/panel-27xLZI7c.js +1 -0
- package/dist/chunks/panel-NoDfShEZ.js +1 -0
- package/dist/chunks/panelCall-CEOWVNCM.js +1 -0
- package/dist/chunks/parseConnectUrl-CxU4IX9o.js +1 -0
- package/dist/chunks/parser-DGlAnaNj.js +1 -0
- package/dist/chunks/parser-DGoLe2RS.js +1 -0
- package/dist/chunks/passes-CExcqu66.js +1 -0
- package/dist/chunks/path-uaxlnhva.js +1 -0
- package/dist/chunks/permissions-B3PceQul.js +1 -0
- package/dist/chunks/permissions-DezIL2xF.js +3 -0
- package/dist/chunks/permissions-DnpI8Whh.js +1 -0
- package/dist/chunks/pipeTransport-CB_Wq_Kx.js +1 -0
- package/dist/chunks/plan-cfZBclh9.js +1 -0
- package/dist/chunks/platform-BXz_rgpy.js +2 -0
- package/dist/chunks/plist-DLGDWBD6.js +6 -0
- package/dist/chunks/plugin-CuhENLRs.js +1 -0
- package/dist/chunks/pluginAutoupdate-wTeOXfQe.js +1 -0
- package/dist/chunks/pluginBlocklist-D6pkKfXr.js +1 -0
- package/dist/chunks/pluginCliCommands-DqxdCwsq.js +1 -0
- package/dist/chunks/pluginFlagging-CjH48f-K.js +1 -0
- package/dist/chunks/pluginOperations-DMFYB3pK.js +2 -0
- package/dist/chunks/pluginStartupCheck-BW3_KfZz.js +1 -0
- package/dist/chunks/pluginStartupCheck-Cj2BMjVw.js +1 -0
- package/dist/chunks/plugins-CarsG2v8.js +4 -0
- package/dist/chunks/policyLimits-DFn1vHkN.js +1 -0
- package/dist/chunks/pollConfig-C8nODJY1.js +1 -0
- package/dist/chunks/poller-DXZJ-dUP.js +1 -0
- package/dist/chunks/poor-C7GQ4a5X.js +1 -0
- package/dist/chunks/poorMode-CBe0rfxB.js +1 -0
- package/dist/chunks/poorMode-CbZTudtw.js +1 -0
- package/dist/chunks/postCommitAttribution--vvAWIqD.js +1 -0
- package/dist/chunks/print-CwwtGSbK.js +114 -0
- package/dist/chunks/privacy-settings-Bz8cAVp5.js +11 -0
- package/dist/chunks/privacyLevel-CRCHhztk.js +1 -0
- package/dist/chunks/process-CnhUplBr.js +1 -0
- package/dist/chunks/process-X4vCP9x0.js +1 -0
- package/dist/chunks/processBashCommand-NL0YEUqW.js +3 -0
- package/dist/chunks/processSlashCommand-FPMWElsI.js +6 -0
- package/dist/chunks/processSlashCommand-_oJs6_w8.js +6 -0
- package/dist/chunks/processUserInput-QAJK0XSn.js +1 -0
- package/dist/chunks/projectContext-B21hXj9q.js +1 -0
- package/dist/chunks/projectContext-DbTQHQS3.js +1 -0
- package/dist/chunks/prompt-C6eleu4x.js +1 -0
- package/dist/chunks/prompt-CUdoQXyN.js +1 -0
- package/dist/chunks/prompt-CsBCtw4l.js +228 -0
- package/dist/chunks/prompt-hnIDYhP4.js +54 -0
- package/dist/chunks/promptEditor-CrlVcc17.js +4 -0
- package/dist/chunks/protectedNamespace-Cn4901XG.js +1 -0
- package/dist/chunks/protocolHandler-DM_w7sJ5.js +13 -0
- package/dist/chunks/protocols-CpoQzjyI.js +7 -0
- package/dist/chunks/proxy-9WvtUy8E.js +99 -0
- package/dist/chunks/rate-limit-options-BehQ3MoX.js +1 -0
- package/dist/chunks/rcDebugLog-BbHlIxCm.js +11 -0
- package/dist/chunks/referral-BfAZEIZL.js +1 -0
- package/dist/chunks/refresh-Bl3Miver.js +1 -0
- package/dist/chunks/registerProtocol-BHZ3vZED.js +36 -0
- package/dist/chunks/registerSkillHooks-BR7v5qDA.js +1 -0
- package/dist/chunks/registry-C2igpRd-.js +1 -0
- package/dist/chunks/release-notes-C_Cou6ye.js +4 -0
- package/dist/chunks/releaseNotes-DveQShyB.js +2 -0
- package/dist/chunks/reload-plugins-D-pAUoB5.js +1 -0
- package/dist/chunks/remote-env-C_dBgbgo.js +1 -0
- package/dist/chunks/remoteBridgeCore-BxWhTy1u.js +1 -0
- package/dist/chunks/remoteControlServer-D3OjUlB-.js +3 -0
- package/dist/chunks/rename-f3m0ETSt.js +1 -0
- package/dist/chunks/renderOptions-QZLxGnh_.js +1 -0
- package/dist/chunks/replBridge-qeVmCJOb.js +1 -0
- package/dist/chunks/resume-CM_8p9Iu.js +2 -0
- package/dist/chunks/rewind-0cB7o6fx.js +1 -0
- package/dist/chunks/ripgrep-BEWqxrpl.js +5 -0
- package/dist/chunks/ripgrep-G82m12Ng.js +1 -0
- package/dist/chunks/rollback-CVo2gqgR.js +11 -0
- package/dist/chunks/runtimeObserver-1EdvvoYw.js +1 -0
- package/dist/chunks/runtimeObserver-CX6vepq9.js +10 -0
- package/dist/chunks/sandbox-adapter-DzHfW2tH.js +1 -0
- package/dist/chunks/sandbox-toggle-N6KgmH2T.js +1 -0
- package/dist/chunks/sanitization-CIBpY9KT.js +1 -0
- package/dist/chunks/satisfies-B7ZvBUQP.js +1 -0
- package/dist/chunks/schemas-Bwt-7U5W.js +40 -0
- package/dist/chunks/sdk-Drp69kIx.js +1 -0
- package/dist/chunks/sdkHeapDumpMonitor-B9GVkISU.js +1 -0
- package/dist/chunks/searchExtraTools-BphNJsl8.js +1 -0
- package/dist/chunks/semver-BsItM2Z4.js +1 -0
- package/dist/chunks/semver-D3lOjiBN.js +1 -0
- package/dist/chunks/sentry-ySzRCXGd.js +1 -0
- package/dist/chunks/server-C8nMDji6.js +1 -0
- package/dist/chunks/server-XZG51Slr.js +1 -0
- package/dist/chunks/serverBanner-D68EBGzH.js +1 -0
- package/dist/chunks/serverLog-hv2hc5US.js +1 -0
- package/dist/chunks/session-CVoGFb8a.js +2 -0
- package/dist/chunks/sessionDataUploader-BaD1Q7v3.js +1 -0
- package/dist/chunks/sessionDiscovery-D7g66TX6.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-9lPjspRX.js +1 -0
- package/dist/chunks/sessionManager-BhOjMNAP.js +1 -0
- package/dist/chunks/sessionMemory-BA6cdxqP.js +1 -0
- package/dist/chunks/sessionMemory-CtEhIRGF.js +1 -0
- package/dist/chunks/sessionMemoryUtils-D_B92ypa.js +1 -0
- package/dist/chunks/sessionObserver-CESI-uVZ.js +1 -0
- package/dist/chunks/sessionObserver-SpE_eglb.js +20 -0
- package/dist/chunks/sessionRestore-DqsqYK4K.js +1 -0
- package/dist/chunks/sessionState-Dgky34M4.js +1 -0
- package/dist/chunks/sessionStorage-DJb5HKhQ.js +1 -0
- package/dist/chunks/sessionStorage-DSMfHTcg.js +1 -0
- package/dist/chunks/sessionStoragePortable-DyM_hZnp.js +3 -0
- package/dist/chunks/sessionTitle-Bzxk_EW9.js +14 -0
- package/dist/chunks/sessionTracing-DR8O0686.js +12 -0
- package/dist/chunks/setup-BHNS9sBS.js +9 -0
- package/dist/chunks/setup-BafJxZ0F.js +4 -0
- package/dist/chunks/setup-MLNNYLi6.js +1 -0
- package/dist/chunks/shadowedRuleDetection-Ch9gTxfD.js +1 -0
- package/dist/chunks/shellQuote-3s6tV-hK.js +1 -0
- package/dist/chunks/sideQuestion-BBn6XIOD.js +20 -0
- package/dist/chunks/signal-BTxmab6r.js +1 -0
- package/dist/chunks/signin-ChbUAEGq.js +1 -0
- package/dist/chunks/sink-B1qICbRh.js +1 -0
- package/dist/chunks/sink-yBIcxQf1.js +1 -0
- package/dist/chunks/sinks-C7weduDR.js +1 -0
- package/dist/chunks/skill-learning-08nEdOJ2.js +5 -0
- package/dist/chunks/skillGapStore-CuvWGqFb.js +5 -0
- package/dist/chunks/skillGapStore-DmMuDXKO.js +1 -0
- package/dist/chunks/skillGenerator-mEMjcmmm.js +8 -0
- package/dist/chunks/skillLearning-B3a-8Ys3.js +1 -0
- package/dist/chunks/skillLearning-q5T6o0mH.js +1 -0
- package/dist/chunks/skillPanel-BuUMhONI.js +28 -0
- package/dist/chunks/skillSearchPanel-BUEv7Sm9.js +21 -0
- package/dist/chunks/skillUsageTracking-BBTiWOKB.js +1 -0
- package/dist/chunks/skills-DvQuQfDW.js +1 -0
- package/dist/chunks/slashCommandParsing-BkTC3GRb.js +1 -0
- package/dist/chunks/sleep-CC8jykQd.js +1 -0
- package/dist/chunks/slowOperations-niPqC54V.js +1 -0
- package/dist/chunks/sprites-C5X62Vyh.js +1 -0
- package/dist/chunks/src-58uAJYF_.js +6 -0
- package/dist/chunks/src-7Y8fx6gl.js +2 -0
- package/dist/chunks/src-BuserDTl.js +1 -0
- package/dist/chunks/src-CMY4XoRy.js +1 -0
- package/dist/chunks/src-CfeAM1FB.js +1 -0
- package/dist/chunks/src-CxT2FDXy.js +1 -0
- package/dist/chunks/src-CyQf7rVu.js +26 -0
- package/dist/chunks/src-DJLbU8sT.js +1 -0
- package/dist/chunks/src-DJQlyVK6.js +5 -0
- package/dist/chunks/src-DNHWYkls.js +53 -0
- package/dist/chunks/src-DU_g0n_Q.js +1 -0
- package/dist/chunks/src-DhqzQjMg.js +19 -0
- package/dist/chunks/src-Duzv1Znh.js +1 -0
- package/dist/chunks/src-OBx6GAig.js +1 -0
- package/dist/chunks/src-WjnK2Dbo.js +1 -0
- package/dist/chunks/src-hjAMxWFj.js +7 -0
- package/dist/chunks/src-lLwoqdC0.js +9 -0
- package/dist/chunks/src-yRsWbJp_.js +2 -0
- package/dist/chunks/sso-oidc-yfC-A2A2.js +1 -0
- package/dist/chunks/startupProfiler-4P7GdVw6.js +3 -0
- package/dist/chunks/startupProfiler-CipS0otN.js +1 -0
- package/dist/chunks/state-9wSimHaL.js +1 -0
- package/dist/chunks/state-BQkyHx88.js +1 -0
- package/dist/chunks/state-CEAUTY3A.js +1 -0
- package/dist/chunks/state-CUZTq6r0.js +1 -0
- package/dist/chunks/state-U0HNbTx8.js +1 -0
- package/dist/chunks/staticRender-BB3CisKd.js +1 -0
- package/dist/chunks/stats-Dyi2U_mq.js +1 -0
- package/dist/chunks/status-CSL-GMou.js +1 -0
- package/dist/chunks/statusNoticeHelpers-BaXE951d.js +1 -0
- package/dist/chunks/stdio-BuUJYJFs.js +3 -0
- package/dist/chunks/stdio-iX0TTmbp.js +1 -0
- package/dist/chunks/stickers-2CRSckfH.js +1 -0
- package/dist/chunks/store-DdfsZvtr.js +1 -0
- package/dist/chunks/stringUtils-U7kMYMJq.js +4 -0
- package/dist/chunks/sts-CJmdeT7s.js +1 -0
- package/dist/chunks/subprocessEnv-DKTILev5.js +1 -0
- package/dist/chunks/subprocessEnv-WjRguKWf.js +1 -0
- package/dist/chunks/supports-color-DaytqqjM.js +1 -0
- package/dist/chunks/systemPromptSections-BnrxBWdc.js +1 -0
- package/dist/chunks/systemPromptSections-Dk6azdAb.js +1 -0
- package/dist/chunks/systemTheme-C1GNqIfy.js +1 -0
- package/dist/chunks/tag-C4cH016L.js +11 -0
- package/dist/chunks/tasks-CEdUW3RQ.js +1 -0
- package/dist/chunks/teamHelpers-CTA_CtTT.js +1 -0
- package/dist/chunks/teamHelpers-D65qZInv.js +1 -0
- package/dist/chunks/teammate-C-FiRloZ.js +1 -0
- package/dist/chunks/teammateModeSnapshot-DWRG5-Us.js +1 -0
- package/dist/chunks/teammateModeSnapshot-DtgsNj1G.js +1 -0
- package/dist/chunks/teleport-C_UgMy0V.js +1 -0
- package/dist/chunks/templateJobs-CMbS0tuk.js +12 -0
- package/dist/chunks/terminalSetup--jwGVap8.js +33 -0
- package/dist/chunks/terminalSetup-zID-wokH.js +1 -0
- package/dist/chunks/theme-C6XwTpVy.js +1 -0
- package/dist/chunks/thinkback-CVLnmLAT.js +1 -0
- package/dist/chunks/thinkback-MeOOO7gf.js +1 -0
- package/dist/chunks/thinkback-play-D7G260F4.js +1 -0
- package/dist/chunks/tmux-DtYJuTWh.js +1 -0
- package/dist/chunks/toolEventObserver-BtC9xDYY.js +1 -0
- package/dist/chunks/toolEventObserver-MfsHAt8h.js +1 -0
- package/dist/chunks/toolPool-CEi_2xIH.js +1 -0
- package/dist/chunks/toolPool-CdYJcCnc.js +1 -0
- package/dist/chunks/trustedDevice-CjQTGAa4.js +1 -0
- package/dist/chunks/trustedDevice-DADcxAAs.js +1 -0
- package/dist/chunks/tui-B8Ijq4Pk.js +6 -0
- package/dist/chunks/turndown.es-T-Xe93nc.js +69 -0
- package/dist/chunks/types-BVelRhgb.js +17 -0
- package/dist/chunks/types-Bqp3meR4.js +1 -0
- package/dist/chunks/types-CNmINIu3.js +1 -0
- package/dist/chunks/types-DgzOOCDl.js +3 -0
- package/dist/chunks/udsClient-ClY_0CKr.js +1 -0
- package/dist/chunks/ultrareviewCommand-CqvHj9Io.js +3 -0
- package/dist/chunks/undercover-CVCVOSrs.js +1 -0
- package/dist/chunks/undercover-CbxiJO2b.js +31 -0
- package/dist/chunks/up-CBJhVVbd.js +12 -0
- package/dist/chunks/updateCCB-DPPpquAw.js +11 -0
- package/dist/chunks/upgrade-DaaHOvft.js +1 -0
- package/dist/chunks/upgrade-k7ZvAWZ0.js +1 -0
- package/dist/chunks/upload-CEDxwMa1.js +1 -0
- package/dist/chunks/upstreamproxy-BtGJ2LRi.js +11 -0
- package/dist/chunks/usage-CsUSu4fb.js +1 -0
- package/dist/chunks/usage-oABvixCs.js +1 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-CBce_-hb.js +1 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-CLYjTZXb.js +1 -0
- package/dist/chunks/useKeybinding-DAQL_dB_.js +1 -0
- package/dist/chunks/useMainLoopModel-QC_H3esG.js +1 -0
- package/dist/chunks/useManageMCPConnections-bf-VfJGD.js +1 -0
- package/dist/chunks/useManagePlugins-CXdYUpit.js +1 -0
- package/dist/chunks/useMergedTools-DERzhQOJ.js +1 -0
- package/dist/chunks/useSearchInput-nqhdILI2.js +1 -0
- package/dist/chunks/useTerminalSize-DzV4aaTi.js +1 -0
- package/dist/chunks/useVoice-CO69xtWC.js +1 -0
- package/dist/chunks/util-C8wqPqv0.js +1 -0
- package/dist/chunks/utils-CDFsSXHr.js +1 -0
- package/dist/chunks/utils-ZO5TryVH.js +1 -0
- package/dist/chunks/v4-DLhvDPkt.js +1 -0
- package/dist/chunks/validatePlugin-C4cd71Yz.js +1 -0
- package/dist/chunks/vertex-sdk-CC3U26o7.js +9 -0
- package/dist/chunks/vim-BNiQx5Vf.js +1 -0
- package/dist/chunks/voice-BCbnJzYL.js +8 -0
- package/dist/chunks/voice-BJyz9KZO.js +8 -0
- package/dist/chunks/voice-CP2ULpju.js +2 -0
- package/dist/chunks/voiceModeEnabled-C-pa8B3Q.js +1 -0
- package/dist/chunks/voiceModeEnabled-CMtRN2pa.js +1 -0
- package/dist/chunks/voiceStreamSTT-31b2u0rj.js +1 -0
- package/dist/chunks/voiceStreamSTT-Fkhm6Ftg.js +1 -0
- package/dist/chunks/voiceStreamSTT-sI-hg-aP.js +1 -0
- package/dist/chunks/web-tools-CLmlPgLk.js +1 -0
- package/dist/chunks/which-C0ex-06E.js +1 -0
- package/dist/chunks/windowsPaths-C5TNvKYu.js +1 -0
- package/dist/chunks/windowsPaths-Kue_7s52.js +1 -0
- package/dist/chunks/workSecret-Dh5Ayceu.js +1 -0
- package/dist/chunks/workerRegistry-B5iWYqpK.js +1 -0
- package/dist/chunks/worktree-BypJA0GB.js +1 -0
- package/dist/chunks/worktreeModeEnabled-DPTdK3JV.js +1 -0
- package/dist/chunks/worktreeModeEnabled-Dtrcn7eD.js +1 -0
- package/dist/chunks/wrapper-BDPb4PTV.js +6 -0
- package/dist/chunks/wrapper-DRTs77RK.js +1 -0
- package/dist/chunks/xdg-BaVL-FHd.js +1 -0
- package/dist/chunks/xml-E8VMPwdJ.js +1 -0
- package/dist/chunks/zod-B_P2Eo_D.js +1 -0
- package/dist/cli-bun.js +2 -0
- package/dist/cli-node.js +2 -0
- package/dist/cli.js +2 -0
- package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
- package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/package.json +233 -0
- package/scripts/postinstall.cjs +389 -0
- package/scripts/run-parallel.mjs +10 -0
- package/scripts/setup-chrome-mcp.mjs +70 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./chunk-DR8-3Aex.js";import{n as a,t as o}from"./defineProperty-CaCI0a5T.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,t as h,u as g}from"./classPrivateFieldSet2-DZkxcFPS.js";import{t as _}from"./src-DJQlyVK6.js";import{a as v,b as y,c as b,d as x,h as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k,v as ee,x as te,y as ne}from"./esm-BwzC0MQp.js";import{$ as re,A,At as j,F as ie,G as ae,H as M,I as N,J as oe,K as se,L as ce,M as le,N as ue,Ot as de,P,Q as fe,R as pe,U as me,W as he,X as ge,Y as _e,Z as ve,bt as ye,c as be,dt as xe,et as Se,ft as Ce,g as we,h as Te,ht as Ee,it as De,j as F,jt as Oe,k as ke,lt as Ae,m as je,mt as Me,nt as Ne,ot as Pe,p as Fe,pt as Ie,q as Le,rt as Re,st as ze,tt as Be,vt as Ve,xt as He,yt as Ue}from"./esm-BtC6CMmM.js";import{i as We,o as Ge,t as Ke}from"./esm-Duu1fRQ8.js";import*as qe from"path";import{normalize as Je,normalize as Ye}from"path";import{AsyncLocalStorage as Xe}from"node:async_hooks";import*as Ze from"node:util";import{promisify as Qe}from"node:util";import{createInterface as $e}from"node:readline";import{dirname as et,join as tt,posix as nt,sep as rt}from"node:path";import{readFileSync as it}from"fs";import{execFile as at}from"node:child_process";import{createReadStream as ot,existsSync as st,readFile as ct,readFileSync as lt,readdir as ut}from"node:fs";import*as dt from"node:os";import*as ft from"module";import{inspect as pt,types as mt}from"util";import{EventEmitter as ht,errorMonitor as gt}from"node:events";import{Readable as _t}from"node:stream";import*as vt from"node:https";import*as yt from"node:http";import{createGzip as bt}from"node:zlib";import*as xt from"node:diagnostics_channel";import{subscribe as St,unsubscribe as Ct}from"node:diagnostics_channel";import*as wt from"node:net";import*as Tt from"node:tls";import{Worker as Et}from"node:worker_threads";import{isMainThread as Dt,threadId as Ot}from"worker_threads";import*as kt from"diagnostics_channel";function At(e){return e.setValue(Nt,!0)}function jt(e){return e.deleteValue(Nt)}function Mt(e){return e.getValue(Nt)===!0}var Nt,Pt=n((()=>{T(),Nt=ne(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)})),Ft,It,Lt=n((()=>{Ft=`baggage`,It=4096}));function Rt(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function zt(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Bt(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=y(e.substring(t+1))),{key:o,value:s,metadata:c}}function Vt(e){let t={};return typeof e==`string`&&e.length>0&&e.split(`,`).forEach(e=>{let n=Bt(e);n!==void 0&&n.value.length>0&&(t[n.key]=n.value)}),t}var Ht=n((()=>{T(),Lt()})),Ut,Wt=n((()=>{T(),Pt(),Lt(),Ht(),Ut=class{inject(e,t,n){let r=C.getBaggage(e);if(!r||Mt(e))return;let i=Rt(zt(r).filter(e=>e.length<=It).slice(0,180));i.length>0&&n.set(t,Ft,i)}extract(e,t,n){let r=n.get(t,Ft),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=Bt(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:C.setBaggage(e,C.createBaggage(a))}fields(){return[Ft]}}})),Gt,Kt=n((()=>{a(),Gt=class{constructor(e,t){o(this,`_monotonicClock`,void 0),o(this,`_epochMillis`,void 0),o(this,`_performanceMillis`,void 0),this._monotonicClock=t,this._epochMillis=e.now(),this._performanceMillis=t.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}}}));function qt(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Jt(n)){E.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Yt(r)){E.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Jt(e){return typeof e==`string`&&e!==``}function Yt(e){return e==null?!0:Array.isArray(e)?Xt(e):Zt(typeof e)}function Xt(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Zt(e)){t=e;continue}return!1}return!1}}return!0}function Zt(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Qt=n((()=>{T()}));function $t(){return e=>{E.error(en(e))}}function en(e){return typeof e==`string`?e:JSON.stringify(tn(e))}function tn(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var nn=n((()=>{T()}));function rn(e){on=e}function an(e){try{on(e)}catch{}}var on,sn=n((()=>{nn(),on=$t()}));function cn(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){E.warn(`Unknown value ${pt(t)} for ${e}, expected a number, using defaults`);return}return n}function ln(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}function un(e){let t=process.env[e]?.trim().toLowerCase();return t==null||t===``?!1:t===`true`?!0:(t===`false`||E.warn(`Unknown value ${pt(t)} for ${e}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}function dn(e){return ln(e)?.split(`,`).map(e=>e.trim()).filter(e=>e!==``)}var fn=n((()=>{T()})),pn,mn=n((()=>{pn=globalThis})),hn,gn=n((()=>{hn=`2.6.1`})),_n,vn=n((()=>{_n=`process.runtime.name`})),yn,bn=n((()=>{gn(),F(),vn(),yn={[Se]:`opentelemetry`,[_n]:`node`,[re]:De,[Be]:hn}})),xn,Sn=n((()=>{fn(),mn(),bn(),xn=performance})),Cn=n((()=>{Sn()}));function wn(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Ln)]}function Tn(){return xn.timeOrigin}function En(e){return Fn(wn(xn.timeOrigin),wn(typeof e==`number`?e:xn.now()))}function Dn(e){if(Nn(e))return e;if(typeof e==`number`)return e<xn.timeOrigin?En(e):wn(e);if(e instanceof Date)return wn(e.getTime());throw TypeError(`Invalid input type`)}function On(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Rn),[n,r]}function kn(e){let t=In,n=`${`0`.repeat(t)}${e[1]}Z`,r=n.substring(n.length-t-1);return new Date(e[0]*1e3).toISOString().replace(`000Z`,r)}function An(e){return e[0]*Rn+e[1]}function jn(e){return e[0]*1e3+e[1]/1e6}function Mn(e){return e[0]*1e6+e[1]/1e3}function Nn(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Pn(e){return Nn(e)||typeof e==`number`||e instanceof Date}function Fn(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Rn&&(n[1]-=Rn,n[0]+=1),n}var In,Ln,Rn,zn=n((()=>{Cn(),In=9,Ln=10**6,Rn=10**In}));function Bn(e){typeof e!=`number`&&e.unref()}var Vn=n((()=>{})),Hn,Un=n((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(Hn||(Hn={}))})),Wn,Gn=n((()=>{T(),a(),Wn=class{constructor(e={}){o(this,`_propagators`,void 0),o(this,`_fields`,void 0),this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){E.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){E.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}}));function Kn(e){return Zn.test(e)}function qn(e){return Qn.test(e)&&!$n.test(e)}var Jn,Yn,Xn,Zn,Qn,$n,er=n((()=>{Jn=`[_0-9a-z-*/]`,Yn=`[a-z]${Jn}{0,255}`,Xn=`[a-z0-9]${Jn}{0,240}@[a-z]${Jn}{0,13}`,Zn=RegExp(`^(?:${Yn}|${Xn})$`),Qn=/^[ -~]{0,255}[!-~]$/,$n=/,|=/})),tr,nr,rr,ir,ar,or=n((()=>{er(),a(),tr=32,nr=512,rr=`,`,ir=`=`,ar=class e{constructor(e){o(this,`_internalState`,new Map),e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+ir+this.get(t)),e),[]).join(rr)}_parse(e){e.length>nr||(this._internalState=e.split(rr).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(ir);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Kn(i)&&qn(a)&&e.set(i,a)}return e},new Map),this._internalState.size>tr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,tr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}}}));function sr(e){let t=dr.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var cr,lr,ur,dr,fr,pr=n((()=>{T(),Pt(),or(),cr=`traceparent`,lr=`tracestate`,ur=`00`,dr=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),fr=class{inject(e,t,n){let r=D.getSpanContext(e);if(!r||Mt(e)||!x(r))return;let i=`${ur}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||S.NONE).toString(16)}`;n.set(t,cr,i),r.traceState&&n.set(t,lr,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,cr);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=sr(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,lr);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new ar(typeof e==`string`?e:void 0)}return D.setSpanContext(e,a)}fields(){return[cr,lr]}}}));function mr(e,t){return e.setValue(_r,t)}function hr(e){return e.deleteValue(_r)}function gr(e){return e.getValue(_r)}var _r,vr,yr=n((()=>{T(),_r=ne(`OpenTelemetry SDK Context Key RPC_METADATA`),(function(e){e.HTTP=`http`})(vr||(vr={}))}));function br(e){if(!xr(e)||Sr(e)!==Tr)return!1;let t=Ar(e);if(t===null)return!0;let n=Mr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Or.call(n)===kr}function xr(e){return typeof e==`object`&&!!e}function Sr(e){return e==null?e===void 0?Dr:Er:Nr&&Nr in Object(e)?Cr(e):wr(e)}function Cr(e){let t=Mr.call(e,Nr),n=e[Nr],r=!1;try{e[Nr]=void 0,r=!0}catch{}let i=Pr.call(e);return r&&(t?e[Nr]=n:delete e[Nr]),i}function wr(e){return Pr.call(e)}var Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr=n((()=>{Tr=`[object Object]`,Er=`[object Null]`,Dr=`[object Undefined]`,Or=Function.prototype.toString,kr=Or.call(Object),Ar=Object.getPrototypeOf,jr=Object.prototype,Mr=jr.hasOwnProperty,Nr=Symbol?Symbol.toStringTag:void 0,Pr=jr.toString}));function Ir(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Rr(t,e.shift(),0,n);return t}function Lr(e){return Br(e)?e.slice():e}function Rr(e,t,n=0,r){let i;if(!(n>Gr)){if(n++,Ur(e)||Ur(t)||Vr(t))i=Lr(t);else if(Br(e)){if(i=e.slice(),Br(t))for(let e=0,n=t.length;e<n;e++)i.push(Lr(t[e]));else if(Hr(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];i[r]=Lr(t[r])}}}else if(Hr(e))if(Hr(t)){if(!Wr(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o],c=t[s];if(Ur(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(zr(e,s,r)||zr(t,s,r))delete i[s];else{if(Hr(a)&&Hr(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Rr(i[s],c,n,r)}}}}else i=t;return i}}function zr(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Br(e){return Array.isArray(e)}function Vr(e){return typeof e==`function`}function Hr(e){return!Ur(e)&&!Br(e)&&!Vr(e)&&typeof e==`object`}function Ur(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Wr(e,t){return!(!br(e)||!br(t))}var Gr,Kr=n((()=>{Fr(),Gr=20}));function qr(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Jr(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Jr,Yr=n((()=>{Jr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function Xr(e,t){return typeof t==`string`?e===t:!!e.match(t)}function Zr(e,t){if(!t)return!1;for(let n of t)if(Xr(e,n))return!0;return!1}var Qr=n((()=>{})),$r,ei=n((()=>{a(),$r=class{constructor(){o(this,`_promise`,void 0),o(this,`_resolve`,void 0),o(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),ti,ni=n((()=>{ei(),a(),ti=class{constructor(e,t){o(this,`_isCalled`,!1),o(this,`_deferred`,new $r),o(this,`_callback`,void 0),o(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function ri(e){return e==null?void 0:ii[e.toUpperCase()]??(E.warn(`Unknown log level "${e}", expected one of ${Object.keys(ii)}, using default`),te.INFO)}var ii,ai=n((()=>{T(),ii={ALL:te.ALL,VERBOSE:te.VERBOSE,DEBUG:te.DEBUG,INFO:te.INFO,WARN:te.WARN,ERROR:te.ERROR,NONE:te.NONE}}));function oi(e,t){return new Promise(n=>{O.with(At(O.active()),()=>{e.export(t,n)})})}var si=n((()=>{T(),Pt()})),ci=r({AnchoredClock:()=>Gt,BindOnceFuture:()=>ti,CompositePropagator:()=>Wn,ExportResultCode:()=>Hn,RPCType:()=>vr,SDK_INFO:()=>yn,TRACE_PARENT_HEADER:()=>cr,TRACE_STATE_HEADER:()=>lr,TimeoutError:()=>Jr,TraceState:()=>ar,W3CBaggagePropagator:()=>Ut,W3CTraceContextPropagator:()=>fr,_globalThis:()=>pn,addHrTimes:()=>Fn,callWithTimeout:()=>qr,deleteRPCMetadata:()=>hr,diagLogLevelFromString:()=>ri,getBooleanFromEnv:()=>un,getNumberFromEnv:()=>cn,getRPCMetadata:()=>gr,getStringFromEnv:()=>ln,getStringListFromEnv:()=>dn,getTimeOrigin:()=>Tn,globalErrorHandler:()=>an,hrTime:()=>En,hrTimeDuration:()=>On,hrTimeToMicroseconds:()=>Mn,hrTimeToMilliseconds:()=>jn,hrTimeToNanoseconds:()=>An,hrTimeToTimeStamp:()=>kn,internal:()=>li,isAttributeValue:()=>Yt,isTimeInput:()=>Pn,isTimeInputHrTime:()=>Nn,isTracingSuppressed:()=>Mt,isUrlIgnored:()=>Zr,loggingErrorHandler:()=>$t,merge:()=>Ir,millisToHrTime:()=>wn,otperformance:()=>xn,parseKeyPairsIntoRecord:()=>Vt,parseTraceParent:()=>sr,sanitizeAttributes:()=>qt,setGlobalErrorHandler:()=>rn,setRPCMetadata:()=>mr,suppressTracing:()=>At,timeInputToHrTime:()=>Dn,unrefTimer:()=>Bn,unsuppressTracing:()=>jt,urlMatches:()=>Xr}),li,ui=n((()=>{Wt(),Kt(),Qt(),sn(),nn(),zn(),Vn(),Un(),Ht(),Cn(),Gn(),pr(),yr(),Pt(),or(),Kr(),Yr(),Qr(),ni(),ai(),si(),li={_export:oi}})),di=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`0.214.0`})),fi,pi,mi=n((()=>{fi=class{emit(e){}},pi=new fi}));function hi(e,t,n){return r=>r===e?t:n}var gi,_i,vi=n((()=>{gi=Symbol.for(`io.opentelemetry.js.api.logs`),_i=globalThis})),yi,bi,xi=n((()=>{mi(),yi=class{getLogger(e,t,n){return new fi}},bi=new yi})),Si,Ci=n((()=>{mi(),Si=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):pi}}})),wi,Ti=n((()=>{xi(),Ci(),wi=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Si(this,e,t,n)}_getDelegate(){return this._delegate??bi}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}})),Ei,Di=n((()=>{vi(),xi(),Ti(),Ei=class e{constructor(){this._proxyLoggerProvider=new wi}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return _i[gi]?this.getLoggerProvider():(_i[gi]=hi(1,e,bi),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return _i[gi]?.call(_i,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete _i[gi],this._proxyLoggerProvider=new wi}}})),Oi,ki=n((()=>{mi(),Di(),Oi=Ei.getInstance()}));function Ai(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function ji(e){e.forEach(e=>e.disable())}var Mi=n((()=>{}));function Ni(e){let t=e.tracerProvider||D.getTracerProvider(),n=e.meterProvider||v.getMeterProvider(),r=e.loggerProvider||Oi.getLoggerProvider(),i=e.instrumentations?.flat()??[];return Ai(i,t,n,r),()=>{ji(i)}}var Pi=n((()=>{T(),ki(),Mi()}));function Fi(e,t,n){if(!Ii(e))return E.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,`$1`);let r=Ui(e);if(!r)return!1;let i=[],a=Li(r,t,i,n);return a&&!n?.includePrerelease?Bi(r,i):a}function Ii(e){return typeof e==`string`&&ea.test(e)}function Li(e,t,n,r){if(t.includes(`||`)){let i=t.trim().split(`||`);for(let t of i)if(Ri(e,t,n,r))return!0;return!1}else if(t.includes(` - `))t=$i(t,r);else if(t.includes(` `)){let i=t.trim().replace(/\s{2,}/g,` `).split(` `);for(let t of i)if(!Ri(e,t,n,r))return!1;return!0}return Ri(e,t,n,r)}function Ri(e,t,n,r){if(t=Vi(t,r),t.includes(` `))return Li(e,t,n,r);{let r=Wi(t);return n.push(r),zi(e,r)}}function zi(e,t){if(t.invalid)return!1;if(!t.version||Gi(t.version))return!0;let n=Yi(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];n=!r.length&&!i.length?0:!r.length&&i.length?1:r.length&&!i.length?-1:Yi(r,i)}return na[t.op]?.includes(n)}function Bi(e,t){return e.prerelease?t.some(t=>t.prerelease&&t.version===e.version):!0}function Vi(e,t){return e=e.trim(),e=Zi(e,t),e=Xi(e),e=Qi(e,t),e=e.trim(),e}function Hi(e){return!e||e.toLowerCase()===`x`||e===`*`}function Ui(e){let t=e.match(ea);if(!t){E.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,a=n.split(`.`),o=r?.split(`.`);return{op:void 0,version:n,versionSegments:a,versionSegmentCount:a.length,prerelease:r,prereleaseSegments:o,prereleaseSegmentCount:o?o.length:0,build:i}}function Wi(e){if(!e)return{};let t=e.match(ta);if(!t)return E.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,a=t.groups.build,o=r.split(`.`),s=i?.split(`.`);return n===`==`&&(n=`=`),{op:n||`=`,version:r,versionSegments:o,versionSegmentCount:o.length,prerelease:i,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:a}}function Gi(e){return e===`*`||e===`x`||e===`X`}function Ki(e){let t=parseInt(e,10);return isNaN(t)?e:t}function qi(e,t){if(typeof e==typeof t){if(typeof e==`number`||typeof e==`string`)return[e,t];throw Error(`Version segments can only be strings or numbers`)}else return[String(e),String(t)]}function Ji(e,t){if(Gi(e)||Gi(t))return 0;let[n,r]=qi(Ki(e),Ki(t));return n>r?1:n<r?-1:0}function Yi(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=Ji(e[n]||`0`,t[n]||`0`);if(r!==0)return r}return 0}function Xi(e){let t=va;return e.replace(t,(e,t,n,r,i)=>{let a;return a=Hi(t)?``:Hi(n)?`>=${t}.0.0 <${+t+1}.0.0-0`:Hi(r)?`>=${t}.${n}.0 <${t}.${+n+1}.0-0`:i?`>=${t}.${n}.${r}-${i} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${r} <${t}.${+n+1}.0-0`,a})}function Zi(e,t){let n=ba,r=t?.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>{let o;return o=Hi(t)?``:Hi(n)?`>=${t}.0.0${r} <${+t+1}.0.0-0`:Hi(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.0${r} <${+t+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i}-${a} <${+t+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i}${r} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i} <${+t+1}.0.0-0`,o})}function Qi(e,t){let n=ma;return e.replace(n,(e,n,r,i,a,o)=>{let s=Hi(r),c=s||Hi(i),l=c||Hi(a),u=l;return n===`=`&&u&&(n=``),o=t?.includePrerelease?`-0`:``,s?e=n===`>`||n===`<`?`<0.0.0-0`:`*`:n&&u?(c&&(i=0),a=0,n===`>`?(n=`>=`,c?(r=+r+1,i=0,a=0):(i=+i+1,a=0)):n===`<=`&&(n=`<`,c?r=+r+1:i=+i+1),n===`<`&&(o=`-0`),e=`${n+r}.${i}.${a}${o}`):c?e=`>=${r}.0.0${o} <${+r+1}.0.0-0`:l&&(e=`>=${r}.${i}.0${o} <${r}.${+i+1}.0-0`),e})}function $i(e,t){let n=ga;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>(n=Hi(r)?``:Hi(i)?`>=${r}.0.0${t?.includePrerelease?`-0`:``}`:Hi(a)?`>=${r}.${i}.0${t?.includePrerelease?`-0`:``}`:o?`>=${n}`:`>=${n}${t?.includePrerelease?`-0`:``}`,c=Hi(l)?``:Hi(u)?`<${+l+1}.0.0-0`:Hi(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t?.includePrerelease?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()))}var ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa=n((()=>{T(),ea=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,ta=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,na={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},ra=`[a-zA-Z0-9-]`,ia=`0|[1-9]\\d*`,aa=`\\d*[a-zA-Z-]${ra}*`,oa=`((?:<|>)?=?)`,sa=`(?:${ia}|${aa})`,ca=`(?:-(${sa}(?:\\.${sa})*))`,la=`${ra}+`,ua=`(?:\\+(${la}(?:\\.${la})*))`,da=`${ia}|x|X|\\*`,fa=`[v=\\s]*(${da})(?:\\.(${da})(?:\\.(${da})(?:${ca})?${ua}?)?)?`,pa=`^${oa}\\s*${fa}$`,ma=new RegExp(pa),ha=`^\\s*(${fa})\\s+-\\s+(${fa})\\s*$`,ga=new RegExp(ha),_a=`^(?:~>?)${fa}$`,va=new RegExp(_a),ya=`^(?:\\^)${fa}$`,ba=new RegExp(ya)}));function Sa(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function Ca(e){e&&e.logger&&(typeof e.logger==`function`?wa=e.logger:wa(`new logger isn't a function, not replacing`))}var wa,Ta,Ea,Da,Oa,ka=n((()=>{wa=console.error.bind(console),Ta=(e,t,n)=>{if(!e||!e[t]){wa(`no original function `+String(t)+` to wrap`);return}if(!n){wa(`no wrapper function`),wa(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){wa(`original object and wrapper must be functions`);return}let i=n(r,t);return Sa(i,`__original`,r),Sa(i,`__unwrap`,()=>{e[t]===i&&Sa(e,t,r)}),Sa(i,`__wrapped`,!0),Sa(e,t,i),i},Ea=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{wa(`must provide one or more modules to patch`),wa(Error().stack);return}if(!(t&&Array.isArray(t))){wa(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Ta(e,t,n)})})},Da=(e,t)=>{if(!e||!e[t]){wa(`no function to unwrap.`),wa(Error().stack);return}let n=e[t];if(!n.__unwrap)wa(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Oa=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{wa(`must provide one or more modules to patch`),wa(Error().stack);return}if(!(t&&Array.isArray(t))){wa(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Da(e,t)})})},Ca.wrap=Ta,Ca.massWrap=Ea,Ca.unwrap=Da,Ca.massUnwrap=Oa})),Aa,ja=n((()=>{T(),ki(),ka(),a(),Aa=class{constructor(e,t,n){o(this,`_config`,{}),o(this,`_tracer`,void 0),o(this,`_meter`,void 0),o(this,`_logger`,void 0),o(this,`_diag`,void 0),o(this,`instrumentationName`,void 0),o(this,`instrumentationVersion`,void 0),o(this,`_wrap`,Ta),o(this,`_unwrap`,Da),o(this,`_massWrap`,Ea),o(this,`_massUnwrap`,Oa),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=D.getTracer(e,t),this._meter=v.getMeter(e,t),this._logger=Oi.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),Ma=i(((e,n)=>{var r=t(`path`).sep;n.exports=function(e){var t=e.split(r),n=t.lastIndexOf(`node_modules`);if(n!==-1&&t[n+1]){for(var i=t[n+1][0]===`@`,a=i?t[n+1]+`/`+t[n+2]:t[n+1],o=i?3:2,s=``,c=n+o-1,l=0;l<=c;l++)l===c?s+=t[l]:s+=t[l]+r;for(var u=``,d=t.length-1,f=n+o;f<=d;f++)f===d?u+=t[f]:u+=t[f]+r;return{name:a,basedir:s,path:u}}}})),Na=i(((e,n)=>{var r=t(`path`),i=t(`module`),a=_()(`require-in-the-middle`),o=Ma();n.exports=d,n.exports.Hook=d;var s,c;if(i.isBuiltin)c=i.isBuiltin;else if(i.builtinModules)c=e=>e.startsWith(`node:`)?!0:(s===void 0&&(s=new Set(i.builtinModules)),s.has(e));else throw Error(`'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0`);var l=/([/\\]index)?(\.js)?$/,u=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol(`RitmExports`)}has(e,n){if(this._localCache.has(e))return!0;if(n)return!1;{let n=t.cache[e];return!!(n&&this._kRitmExports in n)}}get(e,n){let r=this._localCache.get(e);if(r!==void 0)return r;if(!n){let n=t.cache[e];return n&&n[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in t.cache?t.cache[e][this._kRitmExports]=n:(a(`non-core module is unexpectedly not in require.cache: "%s"`,e),this._localCache.set(e,n))}};function d(e,n,s){if(!(this instanceof d))return new d(e,n,s);if(typeof e==`function`?(s=e,e=null,n=null):typeof n==`function`&&(s=n,n=null),typeof i._resolveFilename!=`function`){console.error(`Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!`,typeof i._resolveFilename),console.error(`Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues`,process.version);return}this._cache=new u,this._unhooked=!1,this._origRequire=i.prototype.require;let l=this,p=new Set,m=n?n.internals===!0:!1,h=Array.isArray(e);a(`registering require hook`),this._require=i.prototype.require=function(e){return l._unhooked===!0?(a(`ignoring require call - module is soft-unhooked`),l._origRequire.apply(this,arguments)):g.call(this,arguments,!1)},typeof process.getBuiltinModule==`function`&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(e){return l._unhooked===!0?(a(`ignoring process.getBuiltinModule call - module is soft-unhooked`),l._origGetBuiltinModule.apply(this,arguments)):g.call(this,arguments,!0)});function g(n,u){let d=n[0],g=c(d),_;if(g){if(_=d,d.startsWith(`node:`)){let e=d.slice(5);c(e)&&(_=e)}}else if(u)return a(`call to process.getBuiltinModule with unknown built-in id`),l._origGetBuiltinModule.apply(this,n);else try{_=i._resolveFilename(d,this)}catch(e){return a(`Module._resolveFilename("%s") threw %j, calling original Module.require`,d,e.message),l._origRequire.apply(this,n)}let v,y;if(a(`processing %s module require('%s'): %s`,g===!0?`core`:`non-core`,d,_),l._cache.has(_,g)===!0)return a(`returning already patched cached module: %s`,_),l._cache.get(_,g);let b=p.has(_);b===!1&&p.add(_);let x=u?l._origGetBuiltinModule.apply(this,n):l._origRequire.apply(this,n);if(b===!0)return a(`module is in the process of being patched already - ignoring: %s`,_),x;if(p.delete(_),g===!0){if(h===!0&&e.includes(_)===!1)return a(`ignoring core module not on whitelist: %s`,_),x;v=_}else if(h===!0&&e.includes(_)){let e=r.parse(_);v=e.name,y=e.dir}else{let n=o(_);if(n===void 0)return a(`could not parse filename: %s`,_),x;v=n.name,y=n.basedir;let i=f(n);a(`resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)`,v,d,i,y);let s=!1;if(h){if(!d.startsWith(`.`)&&e.includes(d)&&(v=d,s=!0),!e.includes(v)&&!e.includes(i))return x;e.includes(i)&&i!==v&&(v=i,s=!0)}if(!s){let e;try{e=t.resolve(v,{paths:[y]})}catch{return a(`could not resolve module: %s`,v),l._cache.set(_,x,g),x}if(e!==_)if(m===!0)v=v+r.sep+r.relative(y,_),a(`preparing to process require of internal file: %s`,v);else return a(`ignoring require of non-main module file: %s`,e),l._cache.set(_,x,g),x}}l._cache.set(_,x,g),a(`calling require hook: %s`,v);let S=s(x,v,y);return l._cache.set(_,S,g),a(`returning module: %s`,v),S}}d.prototype.unhook=function(){this._unhooked=!0,this._require===i.prototype.require?(i.prototype.require=this._origRequire,a(`require unhook successful`)):a(`require unhook unsuccessful`),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,a(`process.getBuiltinModule unhook successful`)):a(`process.getBuiltinModule unhook unsuccessful`))};function f(e){let t=r.sep===`/`?e.path:e.path.split(r.sep).join(`/`);return r.posix.join(e.name,t).replace(l,``)}})),Pa,Fa,Ia=n((()=>{a(),Pa=class{constructor(){o(this,`hooks`,[]),o(this,`children`,new Map)}},Fa=class{constructor(){o(this,`_trie`,new Pa),o(this,`_counter`,0)}insert(e){let t=this._trie;for(let n of e.moduleName.split(`/`)){let e=t.children.get(n);e||(e=new Pa,t.children.set(n,e)),t=e}t.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:t,fullOnly:n}={}){let r=this._trie,i=[],a=!0;for(let t of e.split(`/`)){let e=r.children.get(t);if(!e){a=!1;break}n||i.push(...e.hooks),r=e}return n&&a&&i.push(...r.hooks),i.length===0?[]:i.length===1?[i[0].hook]:(t&&i.sort((e,t)=>e.insertedId-t.insertedId),i.map(({hook:e})=>e))}}}));function La(e){return qe.sep===`/`?e:e.split(qe.sep).join(`/`)}var Ra,za,Ba,Va=n((()=>{Ra=Na(),Ia(),a(),za=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(e=>typeof global[e]==`function`),Ba=class e{constructor(){o(this,`_moduleNameTrie`,new Fa),this._initialize()}_initialize(){new Ra.Hook(null,{internals:!0},(e,t,n)=>{let r=La(t),i=this._moduleNameTrie.search(r,{maintainInsertionOrder:!0,fullOnly:n===void 0});for(let{onRequire:r}of i)e=r(e,t,n);return e})}register(e,t){let n={moduleName:e,onRequire:t};return this._moduleNameTrie.insert(n),n}static getInstance(){return za?new e:this._instance=this._instance??new e}},o(Ba,`_instance`,void 0)})),Ha=i((e=>{var t=[],n=new WeakMap,r=new WeakMap,i=new Map,a=[],o={set(e,t,r){let i=n.get(e),a=i&&i[t];return typeof a==`function`?a(r):!0},get(e,t){if(t===Symbol.toStringTag)return`Module`;let n=r.get(e)[t];if(typeof n==`function`)return n()},defineProperty(e,t,r){if(!(`value`in r))throw Error(`Getters/setters are not supported for exports property descriptors.`);let i=n.get(e),a=i&&i[t];return typeof a==`function`?a(r.value):!0}};function s(e,s,c,l,u){i.set(e,u),n.set(s,c),r.set(s,l);let d=new Proxy(s,o);t.forEach(t=>t(e,d,u)),a.push([e,d,u])}e.register=s,e.importHooks=t,e.specifiers=i,e.toHook=a})),Ua=i(((e,n)=>{var r=t(`path`),i=Ma(),{fileURLToPath:a}=t(`url`),{MessageChannel:o}=t(`worker_threads`),{isBuiltin:s}=t(`module`);s||(s=()=>!0);var{importHooks:c,specifiers:l,toHook:u}=Ha();function d(e,t){if(!(process.env.TURBOPACK??process.argv.includes(`--turbo`)))return!1;let n=e.slice(0,e.lastIndexOf(`-`));return t.endsWith(n)}function f(e){c.push(e),u.forEach(([t,n,r])=>e(t,n,r))}function p(e){let t=c.indexOf(e);t>-1&&c.splice(t,1)}function m(e,t,n,r){let i=e(t,n,r);i&&i!==t&&`default`in t&&(t.default=i)}var h;function g(){let{port1:e,port2:t}=new o,n=0,r;h=t=>{n++,e.postMessage(t)},e.on(`message`,()=>{n--,r&&n<=0&&r()}).unref();function i(){let e=setInterval(()=>{},1e3),t=new Promise(e=>{r=e}).then(()=>{clearInterval(e)});return n===0&&r(),t}let a=t;return{registerOptions:{data:{addHookMessagePort:a,include:[]},transferList:[a]},addHookMessagePort:a,waitForAllMessagesAcknowledged:i}}function _(e,t,n){if(!(this instanceof _))return new _(e,t,n);typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null);let o=t?t.internals===!0:!1;h&&Array.isArray(e)&&h(e),this._iitmHook=(t,c,u)=>{let f=t,p=f.startsWith(`node:`),h,g;if(p){let e=t.slice(5);s(e)&&(t=e)}else if(f.startsWith(`file://`)){let e=Error.stackTraceLimit;Error.stackTraceLimit=0;try{h=a(t),t=h}catch{}if(Error.stackTraceLimit=e,h){let e=i(h);e&&(t=e.name,g=e.basedir)}}if(e)for(let i of e)if(h&&i===h)m(n,c,h,void 0);else if(i===t){if(!g)m(n,c,t,g);else if(g.endsWith(l.get(f))||d(l.get(f),g))m(n,c,t,g);else if(o){let e=t+r.sep+r.relative(g,h);m(n,c,e,g)}}else i===u&&m(n,c,u,g);else m(n,c,t,g)},f(this._iitmHook)}_.prototype.unhook=function(){p(this._iitmHook)},n.exports=_,n.exports.Hook=_,n.exports.addHook=f,n.exports.removeHook=p,n.exports.createAddHookMessageChannel=g}));function Wa(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}async function Ga(e,t,n){let r,i;try{i=await e()}catch(e){r=e}finally{if(await t(r,i),r&&!n)throw r;return i}}function Ka(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var qa=n((()=>{}));function Ja(e,t,n){return t===void 0?e.includes(`*`):e.some(e=>Fi(t,e,{includePrerelease:n}))}var Ya,Xa,Za,Qa=n((()=>{xa(),ka(),ja(),Va(),Ya=Ua(),T(),Xa=Na(),qa(),a(),Za=class extends Aa{constructor(e,t,n){super(e,t,n),o(this,`_modules`,void 0),o(this,`_hooks`,[]),o(this,`_requireInTheMiddleSingleton`,Ba.getInstance()),o(this,`_enabled`,!1),o(this,`_wrap`,(e,t,n)=>{if(Ka(e[t])&&this._unwrap(e,t),mt.isProxy(e)){let r=Ta(Object.assign({},e),t,n);return Object.defineProperty(e,t,{value:r}),r}else return Ta(e,t,n)}),o(this,`_unwrap`,(e,t)=>mt.isProxy(e)?Object.defineProperty(e,t,{value:e[t]}):Da(e,t)),o(this,`_massWrap`,(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{E.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){E.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._wrap(e,t,n)})})}),o(this,`_massUnwrap`,(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{E.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){E.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._unwrap(e,t)})})});let r=this.init();r&&!Array.isArray(r)&&(r=[r]),this._modules=r||[],this._config.enabled&&this.enable()}_warnOnPreloadedModules(){let e=globalThis.require;!e?.resolve||!e?.cache||this._modules.forEach(t=>{let{name:n}=t;try{let t=e.resolve(n);e.cache[t]?.loaded&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let t=it(qe.join(e,`package.json`),{encoding:`utf8`}),n=JSON.parse(t).version;return typeof n==`string`?n:void 0}catch{E.warn(`Failed extracting version`,e)}}_onRequire(e,t,n,r){if(!r)return typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:e.name}),e.patch(t)):t;let i=this._extractPackageVersion(r);if(e.moduleVersion=i,e.name===n)return Ja(e.supportedVersions,i,e.includePrerelease)&&typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:e.name,version:e.moduleVersion,baseDir:r}),e.patch(t,e.moduleVersion)):t;let a=e.files??[],o=qe.normalize(n);return a.filter(t=>t.name===o&&Ja(t.supportedVersions,i,e.includePrerelease)).reduce((t,n)=>(n.moduleExports=t,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:e.name,version:e.moduleVersion,fileName:n.name,baseDir:r}),n.patch(t,e.moduleVersion)):t),t)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch==`function`&&e.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.patch(t.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let t=(t,n,r)=>{if(!r&&qe.isAbsolute(n)){let e=qe.parse(n);n=e.name,r=e.dir}return this._onRequire(e,t,n,r)},n=(t,n,r)=>this._onRequire(e,t,n,r),r=qe.isAbsolute(e.name)?new Xa.Hook([e.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(e.name,n);this._hooks.push(r);let i=new Ya.Hook([e.name],{internals:!0},t);this._hooks.push(i)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch==`function`&&e.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.unpatch(t.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}}})),$a=n((()=>{})),eo=n((()=>{Qa(),$a()})),to=n((()=>{eo()})),no,ro=n((()=>{a(),no=class{constructor(e,t,n,r,i){o(this,`files`,void 0),o(this,`name`,void 0),o(this,`supportedVersions`,void 0),o(this,`patch`,void 0),o(this,`unpatch`,void 0),this.files=i||[],this.name=e,this.supportedVersions=t,this.patch=n,this.unpatch=r}}})),io,ao=n((()=>{to(),a(),io=class{constructor(e,t,n,r){o(this,`name`,void 0),o(this,`supportedVersions`,void 0),o(this,`patch`,void 0),o(this,`unpatch`,void 0),this.name=Ye(e),this.supportedVersions=t,this.patch=n,this.unpatch=r}}}));function oo(e,t){let n=so.OLD,r=t?.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r??[])if(t.toLowerCase()===e+`/dup`){n=so.DUPLICATE;break}else t.toLowerCase()===e&&(n=so.STABLE);return n}var so,co=n((()=>{(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(so||(so={}))})),I=r({InstrumentationBase:()=>Za,InstrumentationNodeModuleDefinition:()=>no,InstrumentationNodeModuleFile:()=>io,SemconvStability:()=>so,isWrapped:()=>Ka,registerInstrumentations:()=>Ni,safeExecuteInTheMiddle:()=>Wa,safeExecuteInTheMiddleAsync:()=>Ga,semconvStabilityFromStr:()=>oo}),L=n((()=>{Pi(),to(),ro(),ao(),qa(),co()})),lo=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HTTP_FLAVOR_VALUE_HTTP_1_1=e.NET_TRANSPORT_VALUE_IP_UDP=e.NET_TRANSPORT_VALUE_IP_TCP=e.ATTR_NET_TRANSPORT=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_NET_PEER_IP=e.ATTR_NET_HOST_PORT=e.ATTR_NET_HOST_NAME=e.ATTR_NET_HOST_IP=e.ATTR_HTTP_USER_AGENT=e.ATTR_HTTP_URL=e.ATTR_HTTP_TARGET=e.ATTR_HTTP_STATUS_CODE=e.ATTR_HTTP_SERVER_NAME=e.ATTR_HTTP_SCHEME=e.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=e.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=e.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=e.ATTR_HTTP_REQUEST_CONTENT_LENGTH=e.ATTR_HTTP_METHOD=e.ATTR_HTTP_HOST=e.ATTR_HTTP_FLAVOR=e.ATTR_HTTP_CLIENT_IP=e.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=e.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=e.ATTR_USER_AGENT_SYNTHETIC_TYPE=void 0,e.ATTR_USER_AGENT_SYNTHETIC_TYPE=`user_agent.synthetic.type`,e.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=`bot`,e.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=`test`,e.ATTR_HTTP_CLIENT_IP=`http.client_ip`,e.ATTR_HTTP_FLAVOR=`http.flavor`,e.ATTR_HTTP_HOST=`http.host`,e.ATTR_HTTP_METHOD=`http.method`,e.ATTR_HTTP_REQUEST_CONTENT_LENGTH=`http.request_content_length`,e.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=`http.request_content_length_uncompressed`,e.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=`http.response_content_length`,e.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=`http.response_content_length_uncompressed`,e.ATTR_HTTP_SCHEME=`http.scheme`,e.ATTR_HTTP_SERVER_NAME=`http.server_name`,e.ATTR_HTTP_STATUS_CODE=`http.status_code`,e.ATTR_HTTP_TARGET=`http.target`,e.ATTR_HTTP_URL=`http.url`,e.ATTR_HTTP_USER_AGENT=`http.user_agent`,e.ATTR_NET_HOST_IP=`net.host.ip`,e.ATTR_NET_HOST_NAME=`net.host.name`,e.ATTR_NET_HOST_PORT=`net.host.port`,e.ATTR_NET_PEER_IP=`net.peer.ip`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.ATTR_NET_TRANSPORT=`net.transport`,e.NET_TRANSPORT_VALUE_IP_TCP=`ip_tcp`,e.NET_TRANSPORT_VALUE_IP_UDP=`ip_udp`,e.HTTP_FLAVOR_VALUE_HTTP_1_1=`1.1`})),uo=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=void 0,(function(e){e.HTTP_ERROR_NAME=`http.error_name`,e.HTTP_ERROR_MESSAGE=`http.error_message`,e.HTTP_STATUS_TEXT=`http.status_text`})(e.AttributeNames||(e.AttributeNames={}))})),fo=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DEFAULT_QUERY_STRINGS_TO_REDACT=e.STR_REDACTED=e.SYNTHETIC_BOT_NAMES=e.SYNTHETIC_TEST_NAMES=void 0,e.SYNTHETIC_TEST_NAMES=[`alwayson`],e.SYNTHETIC_BOT_NAMES=[`googlebot`,`bingbot`],e.STR_REDACTED=`REDACTED`,e.DEFAULT_QUERY_STRINGS_TO_REDACT=[`sig`,`Signature`,`AWSAccessKeyId`,`X-Goog-Signature`]})),po=i(((e,n)=>{var r=t(`util`);function i(e,t){Error.captureStackTrace(this,i),this.name=this.constructor.name,this.message=e,this.input=t}r.inherits(i,Error),n.exports=i})),mo=i(((e,t)=>{function n(e){return e===34||e===40||e===41||e===44||e===47||e>=58&&e<=64||e>=91&&e<=93||e===123||e===125}function r(e){return e===33||e>=35&&e<=39||e===42||e===43||e===45||e===46||e>=48&&e<=57||e>=65&&e<=90||e>=94&&e<=122||e===124||e===126}function i(e){return e>=32&&e<=126}function a(e){return e>=128&&e<=255}t.exports={isDelimiter:n,isTokenChar:r,isExtended:a,isPrint:i}})),ho=i(((e,n)=>{var r=t(`util`),i=po(),a=mo(),o=a.isDelimiter,s=a.isTokenChar,c=a.isExtended,l=a.isPrint;function u(e){return e.replace(/\\(.)/g,`$1`)}function d(e,t){return r.format(`Unexpected character '%s' at index %d`,e.charAt(t),t)}function f(e){for(var t=!1,n=!1,r=!1,a={},f=[],p=-1,m=-1,h,g,_=0;_<e.length;_++)if(g=e.charCodeAt(_),h===void 0){if(_!==0&&p===-1&&(g===32||g===9))continue;if(s(g))p===-1&&(p=_);else if(g===61&&p!==-1)h=e.slice(p,_).toLowerCase(),p=-1;else throw new i(d(e,_),e)}else if(n&&(g===9||l(g)||c(g)))n=!1;else if(s(g)){if(m!==-1)throw new i(d(e,_),e);p===-1&&(p=_)}else if(o(g)||c(g))if(r)g===34?(r=!1,m=_):g===92?(p===-1&&(p=_),n=t=!0):p===-1&&(p=_);else if(g===34&&e.charCodeAt(_-1)===61)r=!0;else if((g===44||g===59)&&(p!==-1||m!==-1))p===-1?a[h]=``:(m===-1&&(m=_),a[h]=t?u(e.slice(p,m)):e.slice(p,m)),g===44&&(f.push(a),a={}),h=void 0,p=m=-1;else throw new i(d(e,_),e);else if(g===32||g===9){if(m!==-1)continue;if(r)p===-1&&(p=_);else if(p!==-1)m=_;else throw new i(d(e,_),e)}else throw new i(d(e,_),e);if(h===void 0||r||p===-1&&m===-1||g===32||g===9)throw new i(`Unexpected end of input`,e);return p===-1?a[h]=``:(m===-1&&(m=_),a[h]=t?u(e.slice(p,m)):e.slice(p,m)),f.push(a),f}n.exports=f})),go=i((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.headerCapture=n.getIncomingStableRequestMetricAttributesOnResponse=n.getIncomingRequestMetricAttributesOnResponse=n.getIncomingRequestAttributesOnResponse=n.getIncomingRequestMetricAttributes=n.getIncomingRequestAttributes=n.getRemoteClientAddress=n.getOutgoingStableRequestMetricAttributesOnResponse=n.getOutgoingRequestMetricAttributesOnResponse=n.getOutgoingRequestAttributesOnResponse=n.setAttributesFromHttpKind=n.getOutgoingRequestMetricAttributes=n.getOutgoingRequestAttributes=n.extractHostnameAndPort=n.isValidOptionsType=n.getRequestInfo=n.isCompressed=n.setResponseContentLengthAttribute=n.setRequestContentLengthAttribute=n.setSpanWithError=n.satisfiesPattern=n.parseResponseStatus=n.getAbsoluteUrl=void 0;var r=(T(),e(k)),i=(F(),e(A)),a=lo(),o=(ui(),e(ci)),s=(L(),e(I)),c=t(`url`),l=uo(),u=fo(),d=fo(),f=ho();n.getAbsoluteUrl=(e,t,n=`http:`,r=Array.from(d.DEFAULT_QUERY_STRINGS_TO_REDACT))=>{let i=e||{},a=i.protocol||n,o=(i.port||``).toString(),s=i.path||`/`,c=i.host||i.hostname||t.host||`localhost`;if(c.indexOf(`:`)===-1&&o&&o!==`80`&&o!==`443`&&(c+=`:${o}`),s.includes(`?`))try{let e=new URL(s,`http://localhost`),t=r||[];for(let n of t)e.searchParams.get(n)&&e.searchParams.set(n,d.STR_REDACTED);s=`${e.pathname}${e.search}`}catch{}return`${a}//${i.auth?`${d.STR_REDACTED}:${d.STR_REDACTED}@`:``}${c}${s}`},n.parseResponseStatus=(e,t)=>{let n=e===r.SpanKind.CLIENT?400:500;return t&&t>=100&&t<n?r.SpanStatusCode.UNSET:r.SpanStatusCode.ERROR},n.satisfiesPattern=(e,t)=>{if(typeof t==`string`)return t===e;if(t instanceof RegExp)return t.test(e);if(typeof t==`function`)return t(e);throw TypeError(`Pattern is in unsupported datatype`)},n.setSpanWithError=(e,t,n)=>{let a=t.message;n&s.SemconvStability.OLD&&(e.setAttribute(l.AttributeNames.HTTP_ERROR_NAME,t.name),e.setAttribute(l.AttributeNames.HTTP_ERROR_MESSAGE,a)),n&s.SemconvStability.STABLE&&e.setAttribute(i.ATTR_ERROR_TYPE,t.name),e.setStatus({code:r.SpanStatusCode.ERROR,message:a}),e.recordException(t)},n.setRequestContentLengthAttribute=(e,t)=>{let r=p(e.headers);r!==null&&((0,n.isCompressed)(e.headers)?t[a.ATTR_HTTP_REQUEST_CONTENT_LENGTH]=r:t[a.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=r)},n.setResponseContentLengthAttribute=(e,t)=>{let r=p(e.headers);r!==null&&((0,n.isCompressed)(e.headers)?t[a.ATTR_HTTP_RESPONSE_CONTENT_LENGTH]=r:t[a.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=r)};function p(e){let t=e[`content-length`];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}n.isCompressed=e=>{let t=e[`content-encoding`];return!!t&&t!==`identity`};function m(e){let{hostname:t,pathname:n,port:r,username:i,password:a,search:o,protocol:s,hash:c,href:l,origin:u,host:d}=new URL(e),f={protocol:s,hostname:t&&t[0]===`[`?t.slice(1,-1):t,hash:c,search:o,pathname:n,path:`${n||``}${o||``}`,href:l,origin:u,host:d};return r!==``&&(f.port=Number(r)),(i||a)&&(f.auth=`${decodeURIComponent(i)}:${decodeURIComponent(a)}`),f}n.getRequestInfo=(e,t,n)=>{let r,i,a,o=!1;if(typeof t==`string`){try{let e=m(t);a=e,r=e.pathname||`/`}catch(n){o=!0,e.verbose(`Unable to parse URL provided to HTTP request, using fallback to determine path. Original error:`,n),a={path:t},r=a.path||`/`}i=`${a.protocol||`http:`}//${a.host}`,n!==void 0&&Object.assign(a,n)}else if(t instanceof c.URL)a={protocol:t.protocol,hostname:typeof t.hostname==`string`&&t.hostname.startsWith(`[`)?t.hostname.slice(1,-1):t.hostname,path:`${t.pathname||``}${t.search||``}`},t.port!==``&&(a.port=Number(t.port)),(t.username||t.password)&&(a.auth=`${t.username}:${t.password}`),r=t.pathname,i=t.origin,n!==void 0&&Object.assign(a,n);else{a=Object.assign({protocol:t.host?`http:`:void 0},t);let e=a.host||(a.port==null?a.hostname:`${a.hostname}${a.port}`);if(i=`${a.protocol||`http:`}//${e}`,r=t.pathname,!r&&a.path)try{r=new URL(a.path,i).pathname||`/`}catch{r=`/`}}let s=a.method?a.method.toUpperCase():`GET`;return{origin:i,pathname:r,method:s,optionsParsed:a,invalidUrl:o}},n.isValidOptionsType=e=>{if(!e)return!1;let t=typeof e;return t===`string`||t===`object`&&!Array.isArray(e)},n.extractHostnameAndPort=e=>{if(e.hostname&&e.port)return{hostname:e.hostname,port:e.port};let t=e.host?.match(/^([^:/ ]+)(:\d{1,5})?/)||null,n=e.hostname||(t===null?`localhost`:t[1]),r=e.port;return r||(r=t&&t[2]?t[2].substring(1):e.protocol===`https:`?`443`:`80`),{hostname:n,port:r}},n.getOutgoingRequestAttributes=(e,t,r,o)=>{let c=t.hostname,l=t.port,u=e.method??`GET`,d=C(u),f=e.headers||{},p=f[`user-agent`],m=(0,n.getAbsoluteUrl)(e,f,`${t.component}:`,t.redactedQueryParams),g={[a.ATTR_HTTP_URL]:m,[a.ATTR_HTTP_METHOD]:u,[a.ATTR_HTTP_TARGET]:e.path||`/`,[a.ATTR_NET_PEER_NAME]:c,[a.ATTR_HTTP_HOST]:f.host??`${c}:${l}`},_={[i.ATTR_HTTP_REQUEST_METHOD]:d,[i.ATTR_SERVER_ADDRESS]:c,[i.ATTR_SERVER_PORT]:Number(l),[i.ATTR_URL_FULL]:m,[i.ATTR_USER_AGENT_ORIGINAL]:p};switch(u!==d&&(_[i.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=u),o&&p&&(_[a.ATTR_USER_AGENT_SYNTHETIC_TYPE]=h(p)),p!==void 0&&(g[a.ATTR_HTTP_USER_AGENT]=p),r){case s.SemconvStability.STABLE:return Object.assign(_,t.hookAttributes);case s.SemconvStability.OLD:return Object.assign(g,t.hookAttributes)}return Object.assign(g,_,t.hookAttributes)},n.getOutgoingRequestMetricAttributes=e=>{let t={};return t[a.ATTR_HTTP_METHOD]=e[a.ATTR_HTTP_METHOD],t[a.ATTR_NET_PEER_NAME]=e[a.ATTR_NET_PEER_NAME],t},n.setAttributesFromHttpKind=(e,t)=>{e&&(t[a.ATTR_HTTP_FLAVOR]=e,e.toUpperCase()===`QUIC`?t[a.ATTR_NET_TRANSPORT]=a.NET_TRANSPORT_VALUE_IP_UDP:t[a.ATTR_NET_TRANSPORT]=a.NET_TRANSPORT_VALUE_IP_TCP)};var h=e=>{let t=String(e).toLowerCase();for(let e of u.SYNTHETIC_TEST_NAMES)if(t.includes(e))return a.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST;for(let e of u.SYNTHETIC_BOT_NAMES)if(t.includes(e))return a.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT};n.getOutgoingRequestAttributesOnResponse=(e,t)=>{let{statusCode:r,statusMessage:o,httpVersion:c,socket:u}=e,d={},f={};if(r!=null&&(f[i.ATTR_HTTP_RESPONSE_STATUS_CODE]=r),u){let{remoteAddress:t,remotePort:n}=u;d[a.ATTR_NET_PEER_IP]=t,d[a.ATTR_NET_PEER_PORT]=n,f[i.ATTR_NETWORK_PEER_ADDRESS]=t,f[i.ATTR_NETWORK_PEER_PORT]=n,f[i.ATTR_NETWORK_PROTOCOL_VERSION]=e.httpVersion}switch((0,n.setResponseContentLengthAttribute)(e,d),r&&(d[a.ATTR_HTTP_STATUS_CODE]=r,d[l.AttributeNames.HTTP_STATUS_TEXT]=(o||``).toUpperCase()),(0,n.setAttributesFromHttpKind)(c,d),t){case s.SemconvStability.STABLE:return f;case s.SemconvStability.OLD:return d}return Object.assign(d,f)},n.getOutgoingRequestMetricAttributesOnResponse=e=>{let t={};return t[a.ATTR_NET_PEER_PORT]=e[a.ATTR_NET_PEER_PORT],t[a.ATTR_HTTP_STATUS_CODE]=e[a.ATTR_HTTP_STATUS_CODE],t[a.ATTR_HTTP_FLAVOR]=e[a.ATTR_HTTP_FLAVOR],t},n.getOutgoingStableRequestMetricAttributesOnResponse=e=>{let t={};return e[i.ATTR_NETWORK_PROTOCOL_VERSION]&&(t[i.ATTR_NETWORK_PROTOCOL_VERSION]=e[i.ATTR_NETWORK_PROTOCOL_VERSION]),e[i.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(t[i.ATTR_HTTP_RESPONSE_STATUS_CODE]=e[i.ATTR_HTTP_RESPONSE_STATUS_CODE]),t};function g(e,t){let n=e.split(`:`);if(n.length===1)return t===`http`?{host:n[0],port:`80`}:t===`https`?{host:n[0],port:`443`}:{host:n[0]};if(n.length===2)return{host:n[0],port:n[1]};if(n[0].startsWith(`[`)){if(n[n.length-1].endsWith(`]`)){if(t===`http`)return{host:e,port:`80`};if(t===`https`)return{host:e,port:`443`}}else if(n[n.length-2].endsWith(`]`))return{host:n.slice(0,-1).join(`:`),port:n[n.length-1]}}return{host:e}}function _(e,t){let n=e.headers.forwarded;if(n){for(let e of w(n))if(e.host)return g(e.host,e.proto)}let r=e.headers[`x-forwarded-host`];if(typeof r==`string`)return typeof e.headers[`x-forwarded-proto`]==`string`?g(r,e.headers[`x-forwarded-proto`]):Array.isArray(e.headers[`x-forwarded-proto`])?g(r,e.headers[`x-forwarded-proto`][0]):g(r);if(Array.isArray(r)&&typeof r[0]==`string`&&r[0].length>0)return typeof e.headers[`x-forwarded-proto`]==`string`?g(r[0],e.headers[`x-forwarded-proto`]):Array.isArray(e.headers[`x-forwarded-proto`])?g(r[0],e.headers[`x-forwarded-proto`][0]):g(r[0]);let i=e.headers.host;return typeof i==`string`&&i.length>0?g(i,t):null}function v(e){let t=e.headers.forwarded;if(t){for(let e of w(t))if(e.for)return y(e.for)}let n=e.headers[`x-forwarded-for`];if(n){let e;if(typeof n==`string`?e=n:Array.isArray(n)&&(e=n[0]),typeof e==`string`)return e=e.split(`,`)[0].trim(),y(e)}return e.socket.remoteAddress||null}n.getRemoteClientAddress=v;function y(e){try{let{hostname:t}=new URL(`http://${e}`);return t.startsWith(`[`)&&t.endsWith(`]`)?t.slice(1,-1):t}catch{return e}}function b(e,t,n){try{if(t.headers.host)return new URL(t.url??`/`,`${e}://${t.headers.host}`);{let n=new URL(t.url??`/`,`${e}://localhost`);return{pathname:n.pathname,search:n.search,toString:function(){return n.pathname+n.search}}}}catch(e){return n.verbose(`Unable to get URL from request`,e),{}}}n.getIncomingRequestAttributes=(e,t,r)=>{let{component:o,enableSyntheticSourceDetection:c,hookAttributes:l,semconvStability:u,serverName:d}=t,{headers:f,httpVersion:p,method:m}=e,{host:g,"user-agent":y,"x-forwarded-for":x}=f,S=b(o,e,r),w,T;if(u!==s.SemconvStability.OLD){let t=C(m),n=_(e,o),r=v(e);w={[i.ATTR_HTTP_REQUEST_METHOD]:t,[i.ATTR_URL_SCHEME]:o,[i.ATTR_SERVER_ADDRESS]:n?.host,[i.ATTR_NETWORK_PEER_ADDRESS]:e.socket.remoteAddress,[i.ATTR_NETWORK_PEER_PORT]:e.socket.remotePort,[i.ATTR_NETWORK_PROTOCOL_VERSION]:e.httpVersion,[i.ATTR_USER_AGENT_ORIGINAL]:y},S.pathname!=null&&(w[i.ATTR_URL_PATH]=S.pathname),S.search&&(w[i.ATTR_URL_QUERY]=S.search.slice(1)),r!=null&&(w[i.ATTR_CLIENT_ADDRESS]=r),n?.port!=null&&(w[i.ATTR_SERVER_PORT]=Number(n.port)),m!==t&&(w[i.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=m),c&&y&&(w[a.ATTR_USER_AGENT_SYNTHETIC_TYPE]=h(y))}if(u!==s.SemconvStability.STABLE){let t=g?.replace(/^(.*)(:[0-9]{1,5})/,`$1`)||`localhost`;T={[a.ATTR_HTTP_URL]:S.toString(),[a.ATTR_HTTP_HOST]:g,[a.ATTR_NET_HOST_NAME]:t,[a.ATTR_HTTP_METHOD]:m,[a.ATTR_HTTP_SCHEME]:o},typeof x==`string`&&(T[a.ATTR_HTTP_CLIENT_IP]=x.split(`,`)[0]),typeof d==`string`&&(T[a.ATTR_HTTP_SERVER_NAME]=d),S.pathname&&(T[a.ATTR_HTTP_TARGET]=S.pathname+S.search||`/`),y!==void 0&&(T[a.ATTR_HTTP_USER_AGENT]=y),(0,n.setRequestContentLengthAttribute)(e,T),(0,n.setAttributesFromHttpKind)(p,T)}switch(u){case s.SemconvStability.STABLE:return Object.assign(w,l);case s.SemconvStability.OLD:return Object.assign(T,l);default:return Object.assign(T,w,l)}},n.getIncomingRequestMetricAttributes=e=>{let t={};return t[a.ATTR_HTTP_SCHEME]=e[a.ATTR_HTTP_SCHEME],t[a.ATTR_HTTP_METHOD]=e[a.ATTR_HTTP_METHOD],t[a.ATTR_NET_HOST_NAME]=e[a.ATTR_NET_HOST_NAME],t[a.ATTR_HTTP_FLAVOR]=e[a.ATTR_HTTP_FLAVOR],t},n.getIncomingRequestAttributesOnResponse=(e,t,n)=>{let{socket:c}=e,{statusCode:u,statusMessage:d}=t,f={[i.ATTR_HTTP_RESPONSE_STATUS_CODE]:u},p=(0,o.getRPCMetadata)(r.context.active()),m={};if(c){let{localAddress:e,localPort:t,remoteAddress:n,remotePort:r}=c;m[a.ATTR_NET_HOST_IP]=e,m[a.ATTR_NET_HOST_PORT]=t,m[a.ATTR_NET_PEER_IP]=n,m[a.ATTR_NET_PEER_PORT]=r}switch(m[a.ATTR_HTTP_STATUS_CODE]=u,m[l.AttributeNames.HTTP_STATUS_TEXT]=(d||``).toUpperCase(),p?.type===o.RPCType.HTTP&&p.route!==void 0&&(m[i.ATTR_HTTP_ROUTE]=p.route,f[i.ATTR_HTTP_ROUTE]=p.route),n){case s.SemconvStability.STABLE:return f;case s.SemconvStability.OLD:return m}return Object.assign(m,f)},n.getIncomingRequestMetricAttributesOnResponse=e=>{let t={};return t[a.ATTR_HTTP_STATUS_CODE]=e[a.ATTR_HTTP_STATUS_CODE],t[a.ATTR_NET_HOST_PORT]=e[a.ATTR_NET_HOST_PORT],e[i.ATTR_HTTP_ROUTE]!==void 0&&(t[i.ATTR_HTTP_ROUTE]=e[i.ATTR_HTTP_ROUTE]),t},n.getIncomingStableRequestMetricAttributesOnResponse=e=>{let t={};return e[i.ATTR_HTTP_ROUTE]!==void 0&&(t[i.ATTR_HTTP_ROUTE]=e[i.ATTR_HTTP_ROUTE]),e[i.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(t[i.ATTR_HTTP_RESPONSE_STATUS_CODE]=e[i.ATTR_HTTP_RESPONSE_STATUS_CODE]),t};function x(e,t,n){let r=new Map;for(let e=0,i=t.length;e<i;e++){let i=t[e].toLowerCase();n&s.SemconvStability.STABLE?r.set(i,i):r.set(i,i.replaceAll(`-`,`_`))}return t=>{let n={};for(let i of r.keys()){let a=t(i);if(a===void 0)continue;let o=`http.${e}.header.${r.get(i)}`;typeof a==`string`?n[o]=[a]:Array.isArray(a)?n[o]=a:n[o]=[a]}return n}}n.headerCapture=x;var S=new Set([`GET`,`HEAD`,`POST`,`PUT`,`DELETE`,`CONNECT`,`OPTIONS`,`TRACE`,`PATCH`,`QUERY`]);function C(e){if(e==null)return`GET`;let t=e.toUpperCase();return S.has(t)?t:`_OTHER`}function w(e){try{return f(e)}catch{return[]}}})),_o=i((n=>{a(),Object.defineProperty(n,`__esModule`,{value:!0}),n.HttpInstrumentation=void 0;var r=(T(),e(k)),i=(ui(),e(ci)),s=t(`url`),c=di(),l=(L(),e(I)),u=t(`events`),d=(F(),e(A)),f=go();n.HttpInstrumentation=class extends l.InstrumentationBase{constructor(e={}){super(`@opentelemetry/instrumentation-http`,c.VERSION,e),o(this,`_spanNotEnded`,new WeakSet),o(this,`_headerCapture`,void 0),o(this,`_httpPatched`,!1),o(this,`_httpsPatched`,!1),o(this,`_semconvStability`,l.SemconvStability.OLD),this._semconvStability=(0,l.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._headerCapture=this._createHeaderCapture(this._semconvStability)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram(`http.server.duration`,{description:`Measures the duration of inbound HTTP requests.`,unit:`ms`,valueType:r.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram(`http.client.duration`,{description:`Measures the duration of outbound HTTP requests.`,unit:`ms`,valueType:r.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(d.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:`Duration of HTTP server requests.`,unit:`s`,valueType:r.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}}),this._stableHttpClientDurationHistogram=this.meter.createHistogram(d.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:`Duration of HTTP client requests.`,unit:`s`,valueType:r.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}_recordServerDuration(e,t,n){this._semconvStability&l.SemconvStability.OLD&&this._oldHttpServerDurationHistogram.record(e,t),this._semconvStability&l.SemconvStability.STABLE&&this._stableHttpServerDurationHistogram.record(e/1e3,n)}_recordClientDuration(e,t,n){this._semconvStability&l.SemconvStability.OLD&&this._oldHttpClientDurationHistogram.record(e,t),this._semconvStability&l.SemconvStability.STABLE&&this._stableHttpClientDurationHistogram.record(e/1e3,n)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture(this._semconvStability)}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new l.InstrumentationNodeModuleDefinition(`http`,[`*`],e=>{if(this._httpPatched)return e;this._httpPatched=!0;let t=e[Symbol.toStringTag]===`Module`;if(!this.getConfig().disableOutgoingRequestInstrumentation){let n=this._wrap(e,`request`,this._getPatchOutgoingRequestFunction(`http`)),r=this._wrap(e,`get`,this._getPatchOutgoingGetFunction(n));t&&(e.default.request=n,e.default.get=r)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,`emit`,this._getPatchIncomingRequestFunction(`http`)),e},e=>{this._httpPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,`request`),this._unwrap(e,`get`)),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,`emit`))})}_getHttpsInstrumentation(){return new l.InstrumentationNodeModuleDefinition(`https`,[`*`],e=>{if(this._httpsPatched)return e;this._httpsPatched=!0;let t=e[Symbol.toStringTag]===`Module`;if(!this.getConfig().disableOutgoingRequestInstrumentation){let n=this._wrap(e,`request`,this._getPatchHttpsOutgoingRequestFunction(`https`)),r=this._wrap(e,`get`,this._getPatchHttpsOutgoingGetFunction(n));t&&(e.default.request=n,e.default.get=r)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,`emit`,this._getPatchIncomingRequestFunction(`https`)),e},e=>{this._httpsPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,`request`),this._unwrap(e,`get`)),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,`emit`))})}_getPatchIncomingRequestFunction(e){return t=>this._incomingRequestFunction(e,t)}_getPatchOutgoingRequestFunction(e){return t=>this._outgoingRequestFunction(e,t)}_getPatchOutgoingGetFunction(e){return t=>function(t,...n){let r=e(t,...n);return r.end(),r}}_getPatchHttpsOutgoingRequestFunction(e){return t=>{let n=this;return function(r,...i){return e===`https`&&typeof r==`object`&&r?.constructor?.name!==`URL`&&(r=Object.assign({},r),n._setDefaultOptions(r)),n._getPatchOutgoingRequestFunction(e)(t)(r,...i)}}}_setDefaultOptions(e){e.protocol=e.protocol||`https:`,e.port=e.port||443}_getPatchHttpsOutgoingGetFunction(e){return t=>{let n=this;return function(r,...i){return n._getPatchOutgoingGetFunction(e)(t)(r,...i)}}}_traceClientRequest(e,t,n,i,a){this.getConfig().requestHook&&this._callRequestHook(t,e);let o=!1;return e.prependListener(`response`,s=>{this._diag.debug(`outgoingRequest on response()`),e.listenerCount(`response`)<=1&&s.resume();let c=(0,f.getOutgoingRequestAttributesOnResponse)(s,this._semconvStability);t.setAttributes(c),i=Object.assign(i,(0,f.getOutgoingRequestMetricAttributesOnResponse)(c)),a=Object.assign(a,(0,f.getOutgoingStableRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(t,s),t.setAttributes(this._headerCapture.client.captureRequestHeaders(t=>e.getHeader(t))),t.setAttributes(this._headerCapture.client.captureResponseHeaders(e=>s.headers[e])),r.context.bind(r.context.active(),s),s.on(`end`,()=>{if(this._diag.debug(`outgoingRequest on end()`),o)return;o=!0;let c;c=s.aborted&&!s.complete?{code:r.SpanStatusCode.ERROR}:{code:(0,f.parseResponseStatus)(r.SpanKind.CLIENT,s.statusCode)},t.setStatus(c),this.getConfig().applyCustomAttributesOnSpan&&(0,l.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(t,e,s),()=>{},!0),this._closeHttpSpan(t,r.SpanKind.CLIENT,n,i,a)}),s.on(u.errorMonitor,e=>{this._diag.debug(`outgoingRequest on error()`,e),!o&&(o=!0,this._onOutgoingRequestError(t,i,a,n,e))})}),e.on(`close`,()=>{this._diag.debug(`outgoingRequest on request close()`),!(e.aborted||o)&&(o=!0,this._closeHttpSpan(t,r.SpanKind.CLIENT,n,i,a))}),e.on(u.errorMonitor,e=>{this._diag.debug(`outgoingRequest on request error()`,e),!o&&(o=!0,this._onOutgoingRequestError(t,i,a,n,e))}),this._diag.debug(`http.ClientRequest return request`),e}_incomingRequestFunction(e,t){let n=this;return function(a,...o){if(a!==`request`)return t.apply(this,[a,...o]);let s=o[0],c=o[1],p=s.method||`GET`;if(n._diag.debug(`${e} instrumentation incomingRequest`),(0,l.safeExecuteInTheMiddle)(()=>n.getConfig().ignoreIncomingRequestHook?.(s),e=>{e!=null&&n._diag.error(`caught ignoreIncomingRequestHook error: `,e)},!0))return r.context.with((0,i.suppressTracing)(r.context.active()),()=>(r.context.bind(r.context.active(),s),r.context.bind(r.context.active(),c),t.apply(this,[a,...o])));let m=s.headers,h=(0,f.getIncomingRequestAttributes)(s,{component:e,serverName:n.getConfig().serverName,hookAttributes:n._callStartSpanHook(s,n.getConfig().startIncomingSpanHook),semconvStability:n._semconvStability,enableSyntheticSourceDetection:n.getConfig().enableSyntheticSourceDetection||!1},n._diag);Object.assign(h,n._headerCapture.server.captureRequestHeaders(e=>s.headers[e]));let g={kind:r.SpanKind.SERVER,attributes:h},_=(0,i.hrTime)(),v=(0,f.getIncomingRequestMetricAttributes)(h),y={[d.ATTR_HTTP_REQUEST_METHOD]:h[d.ATTR_HTTP_REQUEST_METHOD],[d.ATTR_URL_SCHEME]:h[d.ATTR_URL_SCHEME]};h[d.ATTR_NETWORK_PROTOCOL_VERSION]&&(y[d.ATTR_NETWORK_PROTOCOL_VERSION]=h[d.ATTR_NETWORK_PROTOCOL_VERSION]);let b=r.propagation.extract(r.ROOT_CONTEXT,m),x=n._startHttpSpan(p,g,b),S={type:i.RPCType.HTTP,span:x};return r.context.with((0,i.setRPCMetadata)(r.trace.setSpan(b,x),S),()=>{r.context.bind(r.context.active(),s),r.context.bind(r.context.active(),c),n.getConfig().requestHook&&n._callRequestHook(x,s),n.getConfig().responseHook&&n._callResponseHook(x,c);let e=!1;return c.on(`close`,()=>{e||n._onServerResponseFinish(s,c,x,v,y,_)}),c.on(u.errorMonitor,t=>{e=!0,n._onServerResponseError(x,v,y,_,t)}),(0,l.safeExecuteInTheMiddle)(()=>t.apply(this,[a,...o]),e=>{if(e)throw n._onServerResponseError(x,v,y,_,e),e})})}}_outgoingRequestFunction(e,t){let n=this;return function(a,...o){if(!(0,f.isValidOptionsType)(a))return t.apply(this,[a,...o]);let c=typeof o[0]==`object`&&(typeof a==`string`||a instanceof s.URL)?o.shift():void 0,{method:u,invalidUrl:p,optionsParsed:m}=(0,f.getRequestInfo)(n._diag,a,c);if((0,l.safeExecuteInTheMiddle)(()=>n.getConfig().ignoreOutgoingRequestHook?.(m),e=>{e!=null&&n._diag.error(`caught ignoreOutgoingRequestHook error: `,e)},!0))return t.apply(this,[m,...o]);let{hostname:h,port:g}=(0,f.extractHostnameAndPort)(m),_=(0,f.getOutgoingRequestAttributes)(m,{component:e,port:g,hostname:h,hookAttributes:n._callStartSpanHook(m,n.getConfig().startOutgoingSpanHook),redactedQueryParams:n.getConfig().redactedQueryParams},n._semconvStability,n.getConfig().enableSyntheticSourceDetection||!1),v=(0,i.hrTime)(),y=(0,f.getOutgoingRequestMetricAttributes)(_),b={[d.ATTR_HTTP_REQUEST_METHOD]:_[d.ATTR_HTTP_REQUEST_METHOD],[d.ATTR_SERVER_ADDRESS]:_[d.ATTR_SERVER_ADDRESS],[d.ATTR_SERVER_PORT]:_[d.ATTR_SERVER_PORT]};_[d.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(b[d.ATTR_HTTP_RESPONSE_STATUS_CODE]=_[d.ATTR_HTTP_RESPONSE_STATUS_CODE]),_[d.ATTR_NETWORK_PROTOCOL_VERSION]&&(b[d.ATTR_NETWORK_PROTOCOL_VERSION]=_[d.ATTR_NETWORK_PROTOCOL_VERSION]);let x={kind:r.SpanKind.CLIENT,attributes:_},S=n._startHttpSpan(u,x),C=r.context.active(),w=r.trace.setSpan(C,S);return m.headers?m.headers=Object.assign({},m.headers):m.headers={},r.propagation.inject(w,m.headers),r.context.with(w,()=>{let i=o[o.length-1];typeof i==`function`&&(o[o.length-1]=r.context.bind(C,i));let s=(0,l.safeExecuteInTheMiddle)(()=>p?t.apply(this,[a,...o]):t.apply(this,[m,...o]),e=>{if(e)throw n._onOutgoingRequestError(S,y,b,v,e),e});return n._diag.debug(`${e} instrumentation outgoingRequest`),r.context.bind(C,s),n._traceClientRequest(s,S,v,y,b)})}}_onServerResponseFinish(e,t,n,i,a,o){let s=(0,f.getIncomingRequestAttributesOnResponse)(e,t,this._semconvStability);i=Object.assign(i,(0,f.getIncomingRequestMetricAttributesOnResponse)(s)),a=Object.assign(a,(0,f.getIncomingStableRequestMetricAttributesOnResponse)(s)),n.setAttributes(this._headerCapture.server.captureResponseHeaders(e=>t.getHeader(e))),n.setAttributes(s).setStatus({code:(0,f.parseResponseStatus)(r.SpanKind.SERVER,t.statusCode)});let c=s[d.ATTR_HTTP_ROUTE];c&&n.updateName(`${e.method||`GET`} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,l.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,t),()=>{},!0),this._closeHttpSpan(n,r.SpanKind.SERVER,o,i,a)}_onOutgoingRequestError(e,t,n,i,a){(0,f.setSpanWithError)(e,a,this._semconvStability),n[d.ATTR_ERROR_TYPE]=a.name,this._closeHttpSpan(e,r.SpanKind.CLIENT,i,t,n)}_onServerResponseError(e,t,n,i,a){(0,f.setSpanWithError)(e,a,this._semconvStability),n[d.ATTR_ERROR_TYPE]=a.name,this._closeHttpSpan(e,r.SpanKind.SERVER,i,t,n)}_startHttpSpan(e,t,n=r.context.active()){let i=t.kind===r.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,a,o=r.trace.getSpan(n);return a=i===!0&&(!o||!r.trace.isSpanContextValid(o.spanContext()))?r.trace.wrapSpanContext(r.INVALID_SPAN_CONTEXT):i===!0&&o?.spanContext().isRemote?o:this.tracer.startSpan(e,t,n),this._spanNotEnded.add(a),a}_closeHttpSpan(e,t,n,a,o){if(!this._spanNotEnded.has(e))return;e.end(),this._spanNotEnded.delete(e);let s=(0,i.hrTimeToMilliseconds)((0,i.hrTimeDuration)(n,(0,i.hrTime)()));t===r.SpanKind.SERVER?this._recordServerDuration(s,a,o):t===r.SpanKind.CLIENT&&this._recordClientDuration(s,a,o)}_callResponseHook(e,t){(0,l.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,t),()=>{},!0)}_callRequestHook(e,t){(0,l.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,t),()=>{},!0)}_callStartSpanHook(e,t){if(typeof t==`function`)return(0,l.safeExecuteInTheMiddle)(()=>t(e),()=>{},!0)}_createHeaderCapture(e){let t=this.getConfig();return{client:{captureRequestHeaders:(0,f.headerCapture)(`request`,t.headersToSpanAttributes?.client?.requestHeaders??[],e),captureResponseHeaders:(0,f.headerCapture)(`response`,t.headersToSpanAttributes?.client?.responseHeaders??[],e)},server:{captureRequestHeaders:(0,f.headerCapture)(`request`,t.headersToSpanAttributes?.server?.requestHeaders??[],e),captureResponseHeaders:(0,f.headerCapture)(`response`,t.headersToSpanAttributes?.server?.responseHeaders??[],e)}}}}})),vo=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HttpInstrumentation=void 0;var t=_o();Object.defineProperty(e,`HttpInstrumentation`,{enumerable:!0,get:function(){return t.HttpInstrumentation}})})),R,z=n((()=>{R=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__})),B,yo=n((()=>{B=globalThis})),bo,xo=n((()=>{bo=`10.49.0`}));function So(){return Co(B),B}function Co(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.49.0`,t[bo]=t[`10.49.0`]||{}}function wo(e,t,n=B){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[bo]=r[`10.49.0`]||{};return i[e]||(i[e]=t())}var To=n((()=>{xo(),yo()}));function Eo(e){if(!(`console`in B))return e();let t=B.console,n={},r=Object.keys(Lo);r.forEach(e=>{let r=Lo[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Do(){Po().enabled=!0}function Oo(){Po().enabled=!1}function ko(){return Po().enabled}function Ao(...e){No(`log`,...e)}function jo(...e){No(`warn`,...e)}function Mo(...e){No(`error`,...e)}function No(e,...t){R&&ko()&&Eo(()=>{B.console[e](`${Io}[${e}]:`,...t)})}function Po(){return R?wo(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var Fo,Io,Lo,V,H=n((()=>{To(),z(),yo(),Fo=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Io=`Sentry Logger `,Lo={},V={enable:Do,disable:Oo,isEnabled:ko,log:Ao,warn:jo,error:Mo}}));function Ro(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
|
|
2
|
+
`);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Ko.test(n)?n.replace(Ko,`$1`):n;if(!o.includes(`Error: `)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=Go+r)break}}return Bo(i.slice(r))}}function zo(e){return Array.isArray(e)?Ro(...e):e}function Bo(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Vo(t).function||``)&&t.pop(),t.reverse(),qo.test(Vo(t).function||``)&&(t.pop(),qo.test(Vo(t).function||``)&&t.pop()),t.slice(0,Go).map(e=>({...e,filename:e.filename||Vo(t).filename,function:e.function||`?`}))}function Vo(e){return e[e.length-1]||{}}function Ho(e){try{return!e||typeof e!=`function`?Jo:e.name||Jo}catch{return Jo}}function Uo(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function Wo(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var Go,Ko,qo,Jo,Yo=n((()=>{Go=50,Ko=/\(error: (.*)\)/,qo=/captureMessage|captureException/,Jo=`<anonymous>`}));function Xo(e,t){$o[e]=$o[e]||[],$o[e].push(t)}function Zo(e,t){if(!es[e]){es[e]=!0;try{t()}catch(t){R&&V.error(`Error while instrumenting ${e}`,t)}}}function Qo(e,t){let n=e&&$o[e];if(n)for(let r of n)try{r(t)}catch(t){R&&V.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Ho(r)}\nError:`,t)}}var $o,es,ts=n((()=>{z(),H(),Yo(),$o={},es={}}));function ns(e){let t=`error`;Xo(t,e),Zo(t,rs)}function rs(){is=B.onerror,B.onerror=function(e,t,n,r,i){return Qo(`error`,{column:r,error:i,line:n,msg:e,url:t}),is?is.apply(this,arguments):!1},B.onerror.__SENTRY_INSTRUMENTED__=!0}var is,as=n((()=>{yo(),ts(),is=null}));function os(e){let t=`unhandledrejection`;Xo(t,e),Zo(t,ss)}function ss(){cs=B.onunhandledrejection,B.onunhandledrejection=function(e){return Qo(`unhandledrejection`,e),cs?cs.apply(this,arguments):!0},B.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var cs,ls=n((()=>{yo(),ts(),cs=null}));function us(e){switch(ws.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Ss(e,Error)}}function ds(e,t){return ws.call(e)===`[object ${t}]`}function fs(e){return ds(e,`ErrorEvent`)}function ps(e){return ds(e,`String`)}function ms(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function hs(e){return e===null||ms(e)||typeof e!=`object`&&typeof e!=`function`}function gs(e){return ds(e,`Object`)}function _s(e){return typeof Event<`u`&&Ss(e,Event)}function vs(e){return typeof Element<`u`&&Ss(e,Element)}function ys(e){return ds(e,`RegExp`)}function bs(e){return!!(e?.then&&typeof e.then==`function`)}function xs(e){return gs(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function Ss(e,t){try{return e instanceof t}catch{return!1}}function Cs(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}var ws,Ts=n((()=>{ws=Object.prototype.toString}));function Es(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||ks;for(;n&&i++<5&&(o=Ds(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=n.parentNode;return r.reverse().join(` > `)}catch{return`<unknown>`}}function Ds(e,t){let n=e,r=[];if(!n?.tagName)return``;if(Os.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let i=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let e=n.className;if(e&&ps(e)){let t=e.split(/\s+/);for(let e of t)r.push(`.${e}`)}}for(let e of[`aria-label`,`type`,`name`,`title`,`alt`]){let t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join(``)}var Os,ks,As=n((()=>{Ts(),yo(),Os=B,ks=80}));function js(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Ns(i,r);try{e[t]=i}catch{R&&V.log(`Failed to replace method "${t}" in object`,e)}}function Ms(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{R&&V.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ns(e,t){try{e.prototype=t.prototype=t.prototype||{},Ms(e,`__sentry_original__`,t)}catch{}}function Ps(e,t,n,r=!0){let i=e[t];if(typeof i!=`function`)throw Error(`Cannot wrap method: ${t} is not a function`);if(Fs(i))throw Error(`Attempting to wrap method ${t} multiple times`);Ns(n,i),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Fs(e){return e.__sentry_original__}function Is(e){if(us(e))return{message:e.message,name:e.name,stack:e.stack,...Rs(e)};if(_s(e)){let t={type:e.type,target:Ls(e.target),currentTarget:Ls(e.currentTarget),...Rs(e)};return typeof CustomEvent<`u`&&Ss(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Ls(e){try{return vs(e)?Es(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Rs(e){return typeof e==`object`&&e?Object.fromEntries(Object.entries(e)):{}}function zs(e){let t=Object.keys(Is(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}var Bs=n((()=>{z(),As(),H(),Ts()}));function Vs(e){if(Ws!==void 0)return Ws?Ws(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=B;return t in n&&typeof n[t]==`function`?(Ws=n[t],Ws(e)):(Ws=null,e())}function Hs(){return Vs(()=>Math.random())}function Us(){return Vs(()=>Date.now())}var Ws,Gs=n((()=>{yo()}));function Ks(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function qs(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,r);return a>r-5&&(a=r),a===r&&(i=Math.max(a-140,0)),n=n.slice(i,a),i>0&&(n=`'{snip} ${n}`),a<r&&(n+=` {snip}`),n}function Js(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{Cs(r)?n.push(Uo(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function Ys(e,t,n=!1){return ps(e)?ys(t)?t.test(e):ps(t)?n?e===t:e.includes(t):typeof t==`function`?t(e):!1:!1}function Xs(e,t=[],n=!1){return t.some(t=>Ys(e,t,n))}var Zs=n((()=>{Ts(),Yo()}));function Qs(){let e=B;return e.crypto||e.msCrypto}function $s(){return Hs()*16}function ec(e=Qs()){try{if(e?.randomUUID)return Vs(()=>e.randomUUID()).replace(/-/g,``)}catch{}return lc||(lc=`10000000100040008000100000000000`),lc.replace(/[018]/g,e=>(e^($s()&15)>>e/4).toString(16))}function tc(e){return e.exception?.values?.[0]}function nc(e){let{message:t,event_id:n}=e;if(t)return t;let r=tc(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function rc(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||(a.value=t||``),a.type||(a.type=n||`Error`)}function ic(e,t){let n=tc(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}function ac(e){return parseInt(e||``,10)}function oc(e){let t=e.match(uc)||[],n=ac(t[1]),r=ac(t[2]),i=ac(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function sc(e){if(cc(e))return!0;try{Ms(e,`__sentry_captured__`,!0)}catch{}return!1}function cc(e){try{return e.__sentry_captured__}catch{}}var lc,uc,dc=n((()=>{Bs(),Gs(),yo(),uc=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/}));function fc(){return Us()/hc}function pc(){let{performance:e}=B;if(!e?.now||!e.timeOrigin)return fc;let t=e.timeOrigin;return()=>(t+Vs(()=>e.now()))/hc}function mc(){return(gc??(gc=pc()))()}var hc,gc,_c=n((()=>{Gs(),yo(),hc=1e3}));function vc(e){let t=mc(),n={sid:ec(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>xc(n)};return e&&yc(n,e),n}function yc(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||mc(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:ec()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function bc(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),yc(e,n)}function xc(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}var Sc=n((()=>{dc(),_c()}));function Cc(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=Cc(r[e],t[e],n-1));return r}var wc=n((()=>{}));function Tc(){return ec()}function Ec(){return ec().substring(16)}var Dc=n((()=>{dc()}));function Oc(e,t){t?Ms(e,Ac,t):delete e[Ac]}function kc(e){return e[Ac]}var Ac,jc=n((()=>{Bs(),Ac=`_sentrySpan`})),Mc,Nc,Pc=n((()=>{z(),Sc(),H(),Ts(),wc(),dc(),Dc(),Gs(),jc(),Zs(),_c(),Mc=100,Nc=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Tc(),sampleRand:Hs()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Oc(t,kc(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&yc(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():gs(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Oc(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Tc(),sampleRand:Hs()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:Mc;if(n<=0)return this;let r={timestamp:fc(),...e,message:e.message?Ks(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:kc(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Cc(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||ec();if(!this._client)return R&&V.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||ec();if(!this._client)return R&&V.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||ec();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(R&&V.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}}));function Fc(){return wo(`defaultCurrentScope`,()=>new Nc)}function Ic(){return wo(`defaultIsolationScope`,()=>new Nc)}var Lc=n((()=>{To(),Pc()})),Rc,zc,Bc,Vc,Hc=n((()=>{Rc=e=>e instanceof Promise&&!e[zc],zc=Symbol(`chained PromiseLike`),Bc=(e,t,n)=>{let r=e.then(e=>(t(e),e),e=>{throw n(e),e});return Rc(r)&&Rc(e)?r:Vc(e,r)},Vc=(e,t)=>{let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i==`function`?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[zc]:!0}),t}}));function Uc(){let e=Co(So());return e.stack=e.stack||new Jc(Fc(),Ic())}function Wc(e){return Uc().withScope(e)}function Gc(e,t){let n=Uc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Kc(e){return Uc().withScope(()=>e(Uc().getIsolationScope()))}function qc(){return{withIsolationScope:Kc,withScope:Wc,withSetScope:Gc,withSetIsolationScope:(e,t)=>Kc(t),getCurrentScope:()=>Uc().getScope(),getIsolationScope:()=>Uc().getIsolationScope()}}var Jc,Yc=n((()=>{Lc(),Pc(),Hc(),Ts(),To(),Jc=class{constructor(e,t){let n;n=e||new Nc;let r;r=t||new Nc,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return bs(n)?Bc(n,()=>this._popScope(),()=>this._popScope()):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}}));function Xc(e){let t=Co(So());t.acs=e}function Zc(e){let t=Co(e);return t.acs?t.acs:qc()}var Qc=n((()=>{To(),Yc()}));function $c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).includes(`value`)}function el(e,t){let{value:n,unit:r}=$c(e)?e:{value:e,unit:void 0},i=il(n),a=r&&typeof r==`string`?{unit:r}:{};if(i)return{...i,...a};if(!t||t===`skip-undefined`&&n===void 0)return;let o=``;try{o=JSON.stringify(n)??``}catch{}return{value:o,type:`string`,...a}}function tl(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let e=el(i,t);e&&(n[r]=e)}return n}function nl(e){if(!e)return 0;let t=0;for(let[n,r]of Object.entries(e)){t+=n.length*2,t+=r.type.length*2,t+=(r.unit?.length??0)*2;let e=r.value;Array.isArray(e)?t+=rl(e[0])*e.length:hs(e)?t+=rl(e):t+=100}return t}function rl(e){return typeof e==`string`?e.length*2:typeof e==`boolean`?4:typeof e==`number`?8:0}function il(e){let t=typeof e==`string`?`string`:typeof e==`boolean`?`boolean`:typeof e==`number`&&!Number.isNaN(e)?Number.isInteger(e)?`integer`:`double`:null;if(t)return{value:e,type:t}}var al=n((()=>{Ts()}));function ol(){return pl?.()}function sl(){return pl!==void 0}function U(){return Zc(So()).getCurrentScope()}function cl(){return Zc(So()).getIsolationScope()}function ll(){return wo(`globalScope`,()=>new Nc)}function ul(...e){let t=Zc(So());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function dl(...e){let t=Zc(So());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function W(){return U().getClient()}function fl(e){let t=ol();if(t)return{trace_id:t.traceId,span_id:t.spanId};let{traceId:n,parentSpanId:r,propagationSpanId:i}=e.getPropagationContext(),a={trace_id:n,span_id:i||Ec()};return r&&(a.parent_span_id=r),a}var pl,ml=n((()=>{Qc(),To(),Pc(),Dc()})),hl,gl,G,K,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl=n((()=>{hl=`sentry.source`,gl=`sentry.sample_rate`,G=`sentry.op`,K=`sentry.origin`,_l=`sentry.measurement_unit`,vl=`sentry.measurement_value`,yl=`sentry.release`,bl=`sentry.environment`,xl=`sentry.segment.name`,Sl=`sentry.segment.id`,Cl=`sentry.sdk.name`,wl=`sentry.sdk.version`,Tl=`user.id`,El=`user.email`,Dl=`user.ip_address`,Ol=`user.name`,kl=`sentry.custom_span_name`,Al=`sentry.profile_id`,jl=`sentry.exclusive_time`,Ml=`cache.hit`,Nl=`cache.key`,Pl=`cache.item_size`,Fl=`http.request.method`,Il=`url.full`,Ll=`gen_ai.conversation.id`}));function zl(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:`unauthenticated`};case 403:return{code:2,message:`permission_denied`};case 404:return{code:2,message:`not_found`};case 409:return{code:2,message:`already_exists`};case 413:return{code:2,message:`failed_precondition`};case 429:return{code:2,message:`resource_exhausted`};case 499:return{code:2,message:`cancelled`};default:return{code:2,message:`invalid_argument`}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:`unimplemented`};case 503:return{code:2,message:`unavailable`};case 504:return{code:2,message:`deadline_exceeded`};default:return{code:2,message:`internal_error`}}return{code:2,message:`internal_error`}}var Bl=n((()=>{}));function Vl(e){try{let t=B.WeakRef;if(typeof t==`function`)return new t(e)}catch{}return e}function Hl(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}var Ul=n((()=>{yo()}));function Wl(e,t,n){e&&(Ms(e,ql,Vl(n)),Ms(e,Kl,t))}function Gl(e){let t=e;return{scope:t[Kl],isolationScope:Hl(t[ql])}}var Kl,ql,Jl=n((()=>{Bs(),Ul(),Kl=`_sentryScope`,ql=`_sentryIsolationScope`}));function Yl(e){let t=Zl(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.startsWith(`sentry-`)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Xl(e){if(e)return $l(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`${eu}${t}`]=n),e),{}))}function Zl(e){if(!(!e||!ps(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=Ql(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Ql(e)}function Ql(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function $l(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(R&&V.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}var eu,tu=n((()=>{z(),H(),Ts(),eu=`sentry-`}));function nu(e){return e===`http`||e===`https`}function ru(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function iu(e){let t=du.exec(e);if(!t){Eo(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return au({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function au(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function ou(e){if(!R)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(V.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?nu(r)?t&&isNaN(parseInt(t,10))?(V.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(V.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(V.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function su(e){return e.match(uu)?.[1]}function cu(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=su(n)),r}function lu(e){let t=typeof e==`string`?iu(e):au(e);if(!(!t||!ou(t)))return t}var uu,du,fu=n((()=>{z(),H(),uu=/^o(\d+)\./,du=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/}));function pu(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}var mu=n((()=>{}));function hu(e){if(!e)return;let t=e.match(xu);if(!t)return;let n;return t[3]===`1`?n=!0:t[3]===`0`&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function gu(e,t){let n=hu(e),r=Yl(t);if(!n?.traceId)return{traceId:Tc(),sampleRand:Hs()};let i=yu(n,r);r&&(r.sample_rand=i.toString());let{traceId:a,parentSpanId:o,parentSampled:s}=n;return{traceId:a,parentSpanId:o,sampled:s,dsc:r||{},sampleRand:i}}function _u(e=Tc(),t=Ec(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function vu(e=Tc(),t=Ec(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function yu(e,t){let n=pu(t?.sample_rand);if(n!==void 0)return n;let r=pu(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Hs()*r:r+Hs()*(1-r):Hs()}function bu(e,t){let n=cu(e);return t&&n&&t!==n?(V.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):e.getOptions().strictTraceContinuation&&(t&&!n||!t&&n)?(V.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}var xu,Su=n((()=>{H(),tu(),fu(),mu(),Dc(),Gs(),xu=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`)}));function Cu(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:a,status:o,origin:s,links:c}=q(e);return{parent_span_id:a,span_id:t,trace_id:n,data:r,op:i,status:o,origin:s,links:c}}function wu(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:q(e).parent_span_id,a=Gl(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Ec():t,trace_id:n}}function Tu(e){let{traceId:t,spanId:n}=e.spanContext();return _u(t,n,Iu(e))}function Eu(e){let{traceId:t,spanId:n}=e.spanContext();return vu(t,n,Iu(e))}function Du(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function Ou(e){if(e?.length)return e.map(({context:{spanId:e,traceId:t,traceFlags:n},attributes:r})=>({span_id:e,trace_id:t,sampled:n===1,attributes:r}))}function ku(e){return typeof e==`number`?Au(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Au(e.getTime()):mc()}function Au(e){return e>9999999999?e/1e3:e}function q(e){if(Fu(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Pu(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:Mu(e),start_timestamp:ku(i),timestamp:ku(o)||void 0,status:Lu(s),op:r[G],origin:r[K],links:Du(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function ju(e){if(Fu(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Pu(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{name:a,span_id:t,trace_id:n,parent_span_id:Mu(e),start_timestamp:ku(i),end_timestamp:ku(o),is_segment:e===Vu(e),status:Ru(s),attributes:r,links:Ou(c)}}return{span_id:t,trace_id:n,start_timestamp:0,name:``,end_timestamp:0,status:`ok`,is_segment:e===Vu(e)}}function Mu(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function Nu(e){return{...e,attributes:tl(e.attributes),links:e.links?.map(e=>({...e,attributes:tl(e.attributes)}))}}function Pu(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Fu(e){return typeof e.getSpanJSON==`function`}function Iu(e){let{traceFlags:t}=e.spanContext();return t===1}function Lu(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function Ru(e){return!e||e.code===1||e.code===0||e.message===`cancelled`?`ok`:`error`}function zu(e,t){Ms(t,Ku,e[Ku]||e),e[Gu]?e[Gu].add(t):Ms(e,Gu,new Set([t]))}function Bu(e){let t=new Set;function n(e){if(!t.has(e)&&Iu(e)){t.add(e);let r=e[Gu]?Array.from(e[Gu]):[];for(let e of r)n(e)}}return n(e),Array.from(t)}function Vu(e){return e[Ku]||e}function Hu(){let e=Zc(So());return e.getActiveSpan?e.getActiveSpan():kc(U())}function Uu(){Wu||(Eo(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Wu=!0)}var Wu,Gu,Ku,qu,Ju=n((()=>{Qc(),al(),To(),ml(),Rl(),Bl(),Jl(),Bs(),Dc(),_c(),Su(),H(),jc(),Wu=!1,Gu=`_sentryChildSpans`,Ku=`_sentryRootSpan`,qu=Vu}));function Yu(){if(Xu)return;function e(){let e=Hu(),t=e&&qu(e);if(t){let e=`internal_error`;R&&V.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,Xu=!0,ns(e),os(e)}var Xu,Zu=n((()=>{z(),as(),ls(),H(),Ju(),Bl(),Xu=!1}));function Qu(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||W()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}var $u=n((()=>{ml()}));function ed(e){V.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function td(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(rd(n)){if(Ys(e.description,n))return R&&ed(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?Ys(e.description,n.name):!0,r=n.op?e.op&&Ys(e.op,n.op):!0;if(t&&r)return R&&ed(e),!0}return!1}function nd(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function rd(e){return typeof e==`string`||e instanceof RegExp}var id=n((()=>{z(),H(),Zs()})),ad,od=n((()=>{ad=`production`}));function sd(e,t){Ms(e,dd,t)}function cd(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e,org_id:cu(t)};return t.emit(`createDsc`,i),i}function ld(e,t){let n=t.getPropagationContext();return n.dsc||cd(n.traceId,e)}function ud(e){let t=W();if(!t)return{};let n=qu(e),r=q(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n[dd];if(c)return s(c);let l=a?.get(`sentry.dsc`),u=l&&Yl(l);if(u)return s(u);let d=cd(e.spanContext().traceId,t),f=i[`sentry.source`]??i[`sentry.span.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Qu()&&(d.sampled=String(Iu(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??Gl(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}var dd,fd=n((()=>{od(),ml(),Rl(),tu(),fu(),$u(),Bs(),Ju(),Jl(),dd=`_frozenDsc`})),pd,md=n((()=>{Dc(),Ju(),pd=class{constructor(e={}){this._traceId=e.traceId||Tc(),this._spanId=e.spanId||Ec(),this.dropReason=e.dropReason}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:0}}end(e){}setAttribute(e,t){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}recordException(e,t){}}}));function hd(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}var gd=n((()=>{}));function _d(e,t=100,n=1/0){try{return yd(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function vd(e,t=3,n=100*1024){let r=_d(e,t);return Cd(r)>n?vd(e,t-1,n):r}function yd(e,t,n=1/0,r=1/0,i=wd()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=bd(e,t);if(!s.startsWith(`[object `))return s;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__==`number`?t.__sentry_override_normalization_depth__:n;if(c===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let l=t;if(l&&typeof l.toJSON==`function`)try{return yd(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Is(t);for(let e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(d>=r){u[e]=`[MaxProperties ~]`;break}let t=f[e];u[e]=yd(e,t,c-1,r,i),d++}return o(t),u}function bd(e,t){try{if(e===`domain`&&t&&typeof t==`object`&&t._events)return`[Domain]`;if(e===`domainEmitter`)return`[DomainEmitter]`;if(typeof global<`u`&&t===global)return`[Global]`;if(typeof window<`u`&&t===window)return`[Window]`;if(typeof document<`u`&&t===document)return`[Document]`;if(Cs(t))return Uo(t);if(xs(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Ho(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=xd(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function xd(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Sd(e){return~-encodeURI(e).split(/%..|./).length}function Cd(e){return Sd(JSON.stringify(e))}function wd(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}var Td=n((()=>{Ts(),Bs(),Yo()}));function Ed(e,t=[]){return[e,t]}function Dd(e,t){let[n,r]=e;return[n,[...r,t]]}function Od(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function kd(e,t){return Od(e,(e,n)=>t.includes(n))}function Ad(e){let t=Co(B);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function jd(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Ad(r),e]:r.push(typeof e==`string`?Ad(e):e)}for(let e of n){let[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(_d(n))}i(e)}}return typeof r==`string`?r:Md(r)}function Md(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Nd(e){return[{type:`span`},e]}function Pd(e){let t=typeof e.data==`string`?Ad(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}function Fd(e){return e in zd}function Id(e){return Fd(e)?zd[e]:e}function Ld(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Rd(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:ru(r)},...i&&{trace:i}}}var zd,Bd=n((()=>{To(),fu(),Td(),yo(),zd={sessions:`session`,event:`error`,client_report:`internal`,user_report:`default`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,raw_security:`security`,log:`log_item`,trace_metric:`metric`}}));function Vd(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function Hd(e,t,n,r){let i=Ld(n);return Ed({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:ru(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Ud(e,t,n,r){let i=Ld(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Vd(e,n?.sdk);let o=Rd(e,i,r,t);return delete e.sdkProcessingMetadata,Ed(o,[[{type:a},e]])}function Wd(e,t){function n(e){return!!e.trace_id&&!!e.public_key}let r=ud(e[0]),i=t?.getDsn(),a=t?.getOptions().tunnel,o={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!a&&i&&{dsn:ru(i)}},{beforeSendSpan:s,ignoreSpans:c}=t?.getOptions()||{},l=c?.length?e.filter(e=>!td(q(e),c)):e,u=e.length-l.length;u&&t?.recordDroppedEvent(`before_send`,`span`,u);let d=s?e=>{let t=q(e);return(hd(s)?t:s(t))||(Uu(),t)}:q,f=[];for(let e of l){let t=d(e);t&&f.push(Nd(t))}return Ed(o,f)}var Gd=n((()=>{fd(),gd(),fu(),Bd(),id(),Ju()}));function Kd(e){if(!R)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`,parent_span_id:r}=q(e),{spanId:i}=e.spanContext(),a=Iu(e),o=qu(e),s=o===e,c=`[Tracing] Starting ${a?`sampled`:`unsampled`} ${s?`root `:``}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(r&&l.push(`parent ID: ${r}`),!s){let{op:e,description:t}=q(o);l.push(`root ID: ${o.spanContext().spanId}`),e&&l.push(`root op: ${e}`),t&&l.push(`root description: ${t}`)}V.log(`${c}
|
|
3
|
+
${l.join(`
|
|
4
|
+
`)}`)}function qd(e){if(!R)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`}=q(e),{spanId:r}=e.spanContext(),i=`[Tracing] Finishing "${n}" ${qu(e)===e?`root `:``}span "${t}" with ID ${r}`;V.log(i)}var Jd=n((()=>{z(),H(),Ju()}));function Yd(e){if(!e||e.length===0)return;let t={};return e.forEach(e=>{let n=e.attributes||{},r=n[_l],i=n[vl];typeof r==`string`&&typeof i==`number`&&(t[e.name]={value:i,unit:r})}),t}var Xd=n((()=>{Rl()}));function Zd(e){return e.getOptions().traceLifecycle===`stream`}var Qd=n((()=>{}));function $d(e){return e&&typeof e==`number`||e instanceof Date||Array.isArray(e)}function ef(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function tf(e){return e instanceof af&&e.isStandaloneSpan()}function nf(e){let t=W();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent(`before_send`,`span`);return}t.sendEnvelope(e)}var rf,af,of=n((()=>{ml(),z(),Gd(),Rl(),H(),Dc(),Ju(),_c(),fd(),Jd(),Xd(),Qd(),Jl(),rf=1e3,af=class{constructor(e={}){this._traceId=e.traceId||Tc(),this._spanId=e.spanId||Ec(),this._startTime=e.startTimestamp||mc(),this._links=e.links,this._attributes={},this.setAttributes({[K]:`manual`,[G]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),`sampled`in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,t){}spanContext(){let{_spanId:e,_traceId:t,_sampled:n}=this;return{spanId:e,traceId:t,traceFlags:+!!n}}setAttribute(e,t){return t===void 0?delete this._attributes[e]:this._attributes[e]=t,this}setAttributes(e){return Object.keys(e).forEach(t=>this.setAttribute(t,e[t])),this}updateStartTime(e){this._startTime=ku(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(hl,`custom`),this}end(e){this._endTime||(this._endTime=ku(e),qd(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[G],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Lu(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[K],profile_id:this._attributes[Al],exclusive_time:this._attributes[jl],measurements:Yd(this._events),is_segment:this._isStandaloneSpan&&qu(this)===this||void 0,segment_id:this._isStandaloneSpan?qu(this).spanContext().spanId:void 0,links:Du(this._links)}}getStreamedSpanJSON(){return{name:this._name??``,span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:this._endTime??this._startTime,is_segment:this._isStandaloneSpan||this===qu(this),status:Ru(this._status),attributes:this._attributes,links:Ou(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,t,n){R&&V.log(`[Tracing] Adding an event to span:`,e);let r=$d(t)?t:n||mc(),i=$d(t)?{}:t||{},a={name:e,time:ku(r),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=W();if(e&&(e.emit(`spanEnd`,this),this._isStandaloneSpan||e.emit(`afterSpanEnd`,this)),!(this._isStandaloneSpan||this===qu(this)))return;if(this._isStandaloneSpan){this._sampled?nf(Wd([this],e)):(R&&V.log(`[Tracing] Discarding standalone span because its trace was not chosen to be sampled.`),e&&e.recordDroppedEvent(`sample_rate`,`span`));return}else if(e&&Zd(e)){e.emit(`afterSegmentSpanEnd`,this);return}let t=this._convertSpanToTransaction();t&&(Gl(this).scope||U()).captureEvent(t)}_convertSpanToTransaction(){if(!ef(q(this)))return;this._name||(R&&V.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name=`<unlabeled transaction>`);let{scope:e,isolationScope:t}=Gl(this),n=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let r=Bu(this).filter(e=>e!==this&&!tf(e)).map(e=>q(e)).filter(ef),i=this._attributes[hl];delete this._attributes[kl],r.forEach(e=>{delete e.data[kl]});let a={contexts:{trace:Cu(this)},spans:r.length>rf?r.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,rf):r,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:t,dynamicSamplingContext:ud(this)},request:n,...i&&{transaction_info:{source:i}}},o=Yd(this._events);return o&&Object.keys(o).length&&(R&&V.log(`[Measurements] Adding measurements to transaction event`,JSON.stringify(o,void 0,2)),a.measurements=o),a}}}));function sf(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(e){throw t(e),n(),e}return cf(i,t,n,r)}function cf(e,t,n,r){return bs(e)?Bc(e,e=>{n(),r(e)},e=>{t(e),n()}):(n(),r(e),e)}var lf=n((()=>{Hc(),Ts()}));function uf(e,t,n){if(!Qu(e))return[!1];let r,i;typeof e.tracesSampler==`function`?(i=e.tracesSampler({...t,inheritOrSampleWith:e=>typeof t.parentSampleRate==`number`?t.parentSampleRate:typeof t.parentSampled==`boolean`?Number(t.parentSampled):e}),r=!0):t.parentSampled===void 0?e.tracesSampleRate!==void 0&&(i=e.tracesSampleRate,r=!0):i=t.parentSampled;let a=pu(i);if(a===void 0)return R&&V.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!a)return R&&V.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler==`function`?`tracesSampler returned 0 or false`:`a negative sampling decision was inherited or tracesSampleRate is set to 0`}`),[!1,a,r];let o=n<a;return o||R&&V.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[o,a,r]}var df=n((()=>{z(),H(),$u(),mu()}));function ff(e,t){let n=yf();if(n.startSpan)return n.startSpan(e,t);let r=vf(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return ul(s,()=>Cf(a)(()=>{let n=U(),o=Sf(n,a),s=e.onlyIfParent&&!o?new pd:_f({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!Tf(s)||!o)&&Oc(n,s),sf(()=>t(s),()=>{let{status:e}=q(s);s.isRecording()&&(!e||e===`ok`)&&s.setStatus({code:2,message:`internal_error`})},()=>{s.end()})}))}function pf(e,t){let n=yf();if(n.startSpanManual)return n.startSpanManual(e,t);let r=vf(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return ul(s,()=>Cf(a)(()=>{let n=U(),o=Sf(n,a),s=e.onlyIfParent&&!o?new pd:_f({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!Tf(s)||!o)&&Oc(n,s),sf(()=>t(s,()=>s.end()),()=>{let{status:e}=q(s);s.isRecording()&&(!e||e===`ok`)&&s.setStatus({code:2,message:`internal_error`})})}))}function mf(e){let t=yf();if(t.startInactiveSpan)return t.startInactiveSpan(e);let n=vf(e),{forceTransaction:r,parentSpan:i}=e;return(e.scope?t=>ul(e.scope,t):i===void 0?e=>e():e=>hf(i,e))(()=>{let t=U(),a=Sf(t,i);return e.onlyIfParent&&!a?new pd:_f({parentSpan:a,spanArguments:n,forceTransaction:r,scope:t})})}function hf(e,t){let n=yf();return n.withActiveSpan?n.withActiveSpan(e,t):ul(n=>(Oc(n,e||void 0),t(n)))}function gf(e){let t=yf();return t.suppressTracing?t.suppressTracing(e):ul(t=>{t.setSDKProcessingMetadata({[Df]:!0});let n=e();return t.setSDKProcessingMetadata({[Df]:void 0}),n})}function _f({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){if(!Qu()){let r=new pd;return(n||!e)&&sd(r,{sampled:`false`,sample_rate:`0`,transaction:t.name,...ud(r)}),r}let i=W();if(wf(i,t))return Ef(r)||i?.recordDroppedEvent(`ignored`,`span`),new pd({dropReason:`ignored`,traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});let a=cl(),o;if(e&&!n)o=xf(e,r,t),zu(e,o);else if(e){let n=ud(e),{traceId:i,spanId:a}=e.spanContext(),s=Iu(e);o=bf({traceId:i,parentSpanId:a,...t},r,s),sd(o,n)}else{let{traceId:e,dsc:n,parentSpanId:i,sampled:s}={...a.getPropagationContext(),...r.getPropagationContext()};o=bf({traceId:e,parentSpanId:i,...t},r,s),n&&sd(o,n)}return Kd(o),Wl(o,r,a),o}function vf(e){let t={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let n={...t};return n.startTimestamp=ku(e.startTime),delete n.startTime,n}return t}function yf(){return Zc(So())}function bf(e,t,n){let r=W(),i=r?.getOptions()||{},{name:a=``}=e,o={spanAttributes:{...e.attributes},spanName:a,parentSampled:n};r?.emit(`beforeSampling`,o,{decision:!1});let s=o.parentSampled??n,c=o.spanAttributes,l=t.getPropagationContext(),u=Ef(t),[d,f,p]=u?[!1]:uf(i,{name:a,parentSampled:s,attributes:c,parentSampleRate:pu(l.dsc?.sample_rate)},l.sampleRand),m=new af({...e,attributes:{[hl]:`custom`,[gl]:f!==void 0&&p?f:void 0,...c},sampled:d});return!d&&r&&!u&&(R&&V.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),r.recordDroppedEvent(`sample_rate`,Zd(r)?`span`:`transaction`)),r&&r.emit(`spanStart`,m),m}function xf(e,t,n){let{spanId:r,traceId:i}=e.spanContext(),a=Ef(t),o=a?!1:Iu(e),s=o?new af({...n,parentSpanId:r,traceId:i,sampled:o}):new pd({traceId:i});zu(e,s);let c=W();return c?(Zd(c)&&s instanceof pd&&(e instanceof pd&&e.dropReason?(s.dropReason=e.dropReason,c.recordDroppedEvent(e.dropReason,`span`)):a||(s.dropReason=`sample_rate`,c.recordDroppedEvent(`sample_rate`,`span`))),c.emit(`spanStart`,s),n.endTimestamp&&(c.emit(`spanEnd`,s),c.emit(`afterSpanEnd`,s)),s):s}function Sf(e,t){if(t)return t;if(t===null)return;let n=kc(e);if(!n)return;let r=W();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?qu(n):n}function Cf(e){return e===void 0?e=>e():t=>hf(e,t)}function wf(e,t){let n=e?.getOptions().ignoreSpans;return!e||!Zd(e)||!n?.length?!1:td({description:t.name||``,op:t.attributes?.[`sentry.op`]||t.op},n)}function Tf(e){return e instanceof pd&&e.dropReason===`ignored`}function Ef(e){return e.getScopeData().sdkProcessingMetadata[Df]===!0}var Df,Of=n((()=>{Qc(),To(),ml(),z(),Rl(),H(),lf(),$u(),id(),Qd(),mu(),jc(),Ju(),fd(),Jd(),df(),md(),of(),Bl(),Jl(),Df=`__SENTRY_SUPPRESS_TRACING__`}));function kf(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Nf(e,t),r&&If(e,r),Lf(e,n),Pf(e,i),Ff(e,a)}function Af(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;jf(e,`extra`,n),jf(e,`tags`,r),jf(e,`attributes`,i),jf(e,`user`,a),jf(e,`contexts`,o),e.sdkProcessingMetadata=Cc(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function jf(e,t,n){e[t]=Cc(e[t],n,1)}function Mf(e,t){let n=ll().getScopeData();return e&&Af(n,e.getScopeData()),t&&Af(n,t.getScopeData()),n}function Nf(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function Pf(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Ff(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function If(e,t){e.contexts={trace:wu(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ud(t),...e.sdkProcessingMetadata};let n=q(qu(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Lf(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}var Rf=n((()=>{ml(),fd(),wc(),Ju()}));function zf(e,t){let n=ju(e),r=Vu(e),i=ju(r),{isolationScope:a,scope:o}=Gl(e);Bf(n,i,t,Mf(a,o)),n.is_segment&&t.emit(`processSegmentSpan`,n),t.emit(`processSpan`,n);let{beforeSendSpan:s}=t.getOptions(),c=s&&hd(s)?Vf(n,s):n,l=c.attributes?.[hl];return l&&Hf(c,{"sentry.span.source":l}),{...Nu(c),_segmentSpan:r}}function Bf(e,t,n,r){let i=n.getSdkMetadata(),{release:a,environment:o,sendDefaultPii:s}=n.getOptions();Hf(e,{[yl]:a,[bl]:o,[xl]:t.name,[Sl]:t.span_id,[Cl]:i?.sdk?.name,[wl]:i?.sdk?.version,...s?{[Tl]:r.user?.id,[El]:r.user?.email,[Dl]:r.user?.ip_address,[Ol]:r.user?.username}:{},...r.attributes})}function Vf(e,t){return t(e)||(Uu(),e)}function Hf(e,t){let n=e.attributes??(e.attributes={});Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}var Uf=n((()=>{Rl(),Rf(),Ju(),Jl(),gd()}));function Wf(e){return new Yf(t=>{t(e)})}function Gf(e){return new Yf((t,n)=>{n(e)})}var Kf,qf,Jf,Yf,Xf=n((()=>{Ts(),Kf=0,qf=1,Jf=2,Yf=class e{constructor(e){this._state=Kf,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===Kf)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(this._state===qf&&e[1](this._value),this._state===Jf&&e[2](this._value),e[0]=!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===Kf){if(bs(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(qf,e)},r=e=>{t(Jf,e)};try{e(n,r)}catch(e){r(e)}}}}));function Zf(e,t,n,r=0){try{let i=Qf(t,n,e,r);return bs(i)?i:Wf(i)}catch(e){return Gf(e)}}function Qf(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return R&&a===null&&V.log(`Event processor "${i.id||`?`}" dropped event`),bs(a)?a.then(e=>Qf(e,t,n,r+1)):Qf(a,t,n,r+1)}var $f=n((()=>{z(),H(),Ts(),Xf()}));function ep(e){let t=B._sentryDebugIds,n=B._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(ip&&r.length===np&&i.length===rp)return ip;np=r.length,rp=i.length,ip={},tp||(tp={});let a=(t,n)=>{for(let r of t){let t=n[r],i=tp?.[r];if(i&&ip&&t)ip[i[0]]=t,tp&&(tp[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&ip&&tp){ip[i]=t,tp[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),ip}var tp,np,rp,ip,ap=n((()=>{yo()}));function op(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||ec(),timestamp:t.timestamp||fc()},l=n.integrations||e.integrations.map(e=>e.name);sp(c,e),up(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&cp(c,e.stackParser);let u=fp(r,n.captureContext);n.mechanism&&ic(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Mf(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),kf(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Wf(c):Zf(m,c,n)).then(e=>(e&&lp(e),typeof o==`number`&&o>0?dp(e,o,s):e))}function sp(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Ks(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&(e.value=Ks(e.value,a))})}function cp(e,t){let n=ep(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function lp(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function up(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function dp(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:_d(e.data,t,n)}}))},...e.user&&{user:_d(e.user,t,n)},...e.contexts&&{contexts:_d(e.contexts,t,n)},...e.extra&&{extra:_d(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=_d(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:_d(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=_d(e.contexts.flags,3,n)),r}function fp(e,t){if(!t)return e;let n=e?e.clone():new Nc;return n.update(t),n}function pp(e){if(e)return mp(e)||hp(e)?{captureContext:e}:e}function mp(e){return e instanceof Nc||typeof e==`function`}function hp(e){return Object.keys(e).some(e=>gp.includes(e))}var gp,_p=n((()=>{od(),$f(),Pc(),ap(),dc(),Td(),Rf(),Zs(),Xf(),_c(),gp=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`]}));function J(e,t){return U().captureException(e,pp(t))}function vp(e,t){return U().captureEvent(e,t)}async function yp(e){let t=W();return t?t.flush(e):(R&&V.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}async function bp(e){let t=W();return t?t.close(e):(R&&V.warn(`Cannot flush events and disable SDK. No client defined.`),Promise.resolve(!1))}function xp(){let e=W();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Sp(e){let t=cl(),{user:n}=Mf(t,U()),{userAgent:r}=B.navigator||{},i=vc({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&yc(a,{status:`exited`}),Cp(),t.setSession(i),i}function Cp(){let e=cl(),t=U().getSession()||e.getSession();t&&bc(t),wp(),e.setSession()}function wp(){let e=cl(),t=W(),n=e.getSession();n&&t&&t.captureSession(n)}var Tp=n((()=>{ml(),z(),Sc(),H(),_p(),Rf(),yo()}));function Ep(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Dp(e){return`${Ep(e)}${e.projectId}/envelope/`}function Op(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function kp(e,t,n){return t||`${Dp(e)}?${Op(e,n)}`}var Ap=n((()=>{}));function jp(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function Mp(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return jp(r)}function Np(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&Fp(e,t,n)}),n}function Pp(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Fp(e,t,n){if(n[t.name]){R&&V.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Ip.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),Ip.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}R&&V.log(`Integration installed: ${t.name}`)}function Y(e){return e}var Ip,Lp=n((()=>{z(),H(),Ip=[]}));function Rp(e,t){return t?ul(t,()=>{let n=Hu(),r=n?wu(n):fl(t);return[n?ud(n):ld(e,t),r]}):[void 0,void 0]}var zp=n((()=>{ml(),fd(),Ju()}));function Bp(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function Vp(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=ru(r)),Ed(i,[Bp(e)])}var Hp=n((()=>{fu(),Bd()}));function Up(e,t){let n=t??Wp(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Vp(n,r._metadata,r.tunnel,e.getDsn());Gp().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Wp(e){return Gp().get(e)}function Gp(){return wo(`clientToLogBufferMap`,()=>new WeakMap)}var Kp=n((()=>{To(),Hp()}));function qp(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function Jp(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=ru(r)),Ed(i,[qp(e)])}var Yp=n((()=>{fu(),Bd()}));function Xp(e,t){let n=t??Zp(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Jp(n,r._metadata,r.tunnel,e.getDsn());Qp().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Zp(e){return Qp().get(e)}function Qp(){return wo(`clientToMetricBufferMap`,()=>new WeakMap)}var $p=n((()=>{To(),Yp()}));function em(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}var tm=n((()=>{}));function nm(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Gf(rm);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Wf(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>em(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var rm,im=n((()=>{Xf(),tm(),rm=Symbol.for(`SentryBufferFullError`)}));function am(e,t=Us()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?lm:r-t}function om(e,t){return e[t]||e.all||0}function sm(e,t,n=Us()){return om(e,t)>n}function cm(e,{statusCode:t,headers:n},r=Us()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+am(o,r):t===429&&(i.all=r+60*1e3);return i}var lm,um=n((()=>{Gs(),lm=60*1e3}));function dm(e,t,n=nm(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Od(i,(t,n)=>{let i=Id(n);sm(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Ed(i[0],a),s=t=>{if(kd(o,[`client_report`])){R&&V.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Od(o,(n,r)=>{e.recordDroppedEvent(t,Id(r))})};return n.add(()=>t({body:jd(o)}).then(e=>e.statusCode===413?(R&&V.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(R&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&V.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=cm(r,e),e),e=>{throw s(`network_error`),R&&V.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===rm)return R&&V.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}var fm=n((()=>{z(),H(),Bd(),im(),um()}));function pm(e,t,n){let r=[{type:`client_report`},{timestamp:n||fc(),discarded_events:e}];return Ed(t?{dsn:t}:{},[r])}var mm=n((()=>{Bd(),_c()}));function hm(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}var gm=n((()=>{}));function _m(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[Al],exclusive_time:o?.[jl],measurements:e.measurements,is_segment:!0}}function vm(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}var ym=n((()=>{Rl()}));function bm(e){return{message:e,[Im]:!0}}function xm(e){return{message:e,[Lm]:!0}}function Sm(e){return!!e&&typeof e==`object`&&Im in e}function Cm(e){return!!e&&typeof e==`object`&&Lm in e}function wm(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{a+=r(t),a>=8e5?i(e):s||(s=!0,o=em(setTimeout(()=>{i(e)},Rm)))}),e.on(`flush`,()=>{i(e)})}function Tm(e){return e===`replay_event`?`replay`:e||`error`}function Em(e,t){let n=`${t} must return \`null\` or a valid event.`;if(bs(e))return e.then(e=>{if(!gs(e)&&e!==null)throw bm(n);return e},e=>{throw bm(`${t} rejected with ${e}`)});if(!gs(e)&&e!==null)throw bm(n);return e}function Dm(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!hd(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(Om(c)&&i)return i(c,r);if(km(c)){if(s||o){let t=_m(c);if(o?.length&&td(t,o))return null;if(s){let e=s(t);e?c=Cc(n,vm(e)):Uu()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&td(e,o)){nd(n,e);continue}if(s){let n=s(e);n?t.push(n):(Uu(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function Om(e){return e.type===void 0}function km(e){return e.type===`transaction`}function Am(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Mm(e.attributes)}function jm(e){let t=0;return e.message&&(t+=e.message.length*2),t+Mm(e.attributes)}function Mm(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Nm(e[0]):hs(e)?t+=Nm(e):t+=100}),t}function Nm(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}var Pm,Fm,Im,Lm,Rm,zm,Bm=n((()=>{Ap(),od(),ml(),z(),Gd(),Lp(),Kp(),$p(),Sc(),fd(),gd(),fm(),mm(),H(),fu(),Bd(),gm(),Ts(),wc(),dc(),mu(),_p(),im(),Gs(),id(),Ju(),Xf(),tm(),ym(),Pm=`Not capturing exception because it's already been captured.`,Fm=`Discarded session because of missing or non-string release`,Im=Symbol.for(`SentryInternalError`),Lm=Symbol.for(`SentryDoNotSendEventError`),Rm=5e3,zm=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=nm(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=lu(e.dsn):R&&V.warn(`No DSN provided, client will not send events.`),this._dsn){let t=kp(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&wm(this,`afterCaptureLog`,`flushLogs`,jm,Up),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&wm(this,`afterCaptureMetric`,`flushMetrics`,Am,Xp)}captureException(e,t,n){let r=ec();if(sc(e))return R&&V.log(Pm),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:ec(),...n},a=ms(e)?e:String(e),o=hs(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=ec();if(t?.originalException&&sc(t.originalException))return R&&V.log(Pm),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Tm(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),yc(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(!t)return!0;this.emit(`flush`);let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){Up(this);let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),Fp(this,e,this._integrations),t||Pp(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Ud(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Dd(n,Pd(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=ad}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){R&&V.warn(Fm);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){R&&V.warn(Fm);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Hd(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;R&&V.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return R&&V.error(`Error while sending envelope:`,e),{}}return R&&V.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Np(this,e),Pp(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(yc(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),op(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...fl(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ld(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=U(),r=cl()){return R&&Om(e)&&V.log(`Captured error event \`${hm(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{R&&(Cm(e)?V.log(e.message):Sm(e)?V.warn(e.message):V.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=km(e),s=Om(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:pu(a);if(s&&typeof l==`number`&&Hs()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Gf(xm(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=Tm(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),xm("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:Em(Dm(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw xm(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw Cm(e)||Sm(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),bm(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===rm&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){R&&V.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){R&&V.log(`No outcomes to send`);return}if(!this._dsn){R&&V.log(`No dsn provided, will not send outcomes`);return}R&&V.log(`Sending outcomes:`,e);let t=pm(e,this._options.tunnel&&ru(this._dsn));this.sendEnvelope(t)}}}));function Vm(e,t,n,r,i){let a={sent_at:new Date().toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=ru(i)),t&&(a.trace=t),Ed(a,[Hm(e)])}function Hm(e){return[{type:`check_in`},e]}var Um=n((()=>{fu(),Bd()}));function Wm(e){let t=e._metadata?.sdk,n=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...n&&{"user-agent":n},...e.transportOptions?.headers}}}var Gm=n((()=>{}));function Km(e,t){return e(t.stack||``,1)}function qm(e){return us(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Jm(e){return qm(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Ym(e,t){let n={type:t.name||t.constructor.name,value:Jm(t)},r=Km(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Xm(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function Zm(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message '${e.message}'`),t}else if(`message`in e&&typeof e.message==`string`)return e.message;let t=zs(e);if(fs(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Qm(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Qm(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function $m(e,t,n,r){if(us(n))return[n,void 0];if(t.synthetic=!0,gs(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:vd(n,t)},a=Xm(n);if(a)return[a,i];let o=Zm(n),s=r?.syntheticException||Error(o);return s.message=o,[s,i]}let i=r?.syntheticException||Error(n);return i.message=`${n}`,[i,void 0]}function eh(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=$m(e,i,n,r),s={exception:{values:[Ym(t,a)]}};return o&&(s.extra=o),rc(s,void 0,void 0),ic(s,i),{...s,event_id:r?.event_id}}function th(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Km(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},ic(a,{synthetic:!0}))}if(ms(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return a.logentry={message:e,params:n},a}return a.message=t,a}var nh=n((()=>{Ts(),dc(),Td(),Bs()}));function rh(e){let t=cl().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}var ih,ah=n((()=>{Um(),Bm(),ml(),z(),Zu(),H(),dc(),fm(),Gm(),nh(),im(),Xf(),zp(),ih=class extends zm{constructor(e){Yu(),Wm(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=eh(this,this._options.stackParser,e,t);return n.level=`error`,Wf(n)}eventFromMessage(e,t=`info`,n){return Wf(th(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return rh(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&rh(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:ec();if(!this._isEnabled())return R&&V.warn(`SDK not enabled, will not capture check-in.`),r;let{release:i,environment:a,tunnel:o}=this.getOptions(),s={check_in_id:r,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};`duration`in e&&(s.duration=e.duration),t&&(s.monitor_config={schedule:t.schedule,checkin_margin:t.checkinMargin,max_runtime:t.maxRuntime,timezone:t.timezone,failure_issue_threshold:t.failureIssueThreshold,recovery_threshold:t.recoveryThreshold});let[c,l]=Rp(this,n);l&&(s.contexts={trace:l});let u=Vm(s,c,this.getSdkMetadata(),o,this.getDsn());return R&&V.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){R&&V.log(`Disposing client...`);for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=nm(64)}_prepareEvent(e,t,n,r){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,t,n,r)}_setUpMetricsProcessing(){this.on(`processMetric`,e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}}}));function oh(e){e.forEach(e=>{lh.add(e),R&&V.log(`AI provider "${e}" wrapping will be skipped`)})}function sh(e){return lh.has(e)}function ch(){lh.clear(),R&&V.log(`Cleared AI provider skip registrations`)}var lh,uh=n((()=>{z(),H(),lh=new Set}));function dh(e,t){let n=String(e).toLowerCase();return fh.has(n)?!1:ph.has(n)?!0:t?.strict?null:!!e}var fh,ph,mh=n((()=>{fh=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),ph=new Set([`true`,`t`,`y`,`yes`,`on`,`1`])}));function hh(e){return`isRelative`in e}function gh(e,t){let n=e.indexOf(`://`)<=0&&e.indexOf(`//`)!==0,r=t??(n?wh:void 0);try{if(`canParse`in URL&&!URL.canParse(e,r))return;let t=new URL(e,r);return n?{isRelative:n,pathname:t.pathname,search:t.search,hash:t.hash}:t}catch{}}function _h(e){if(hh(e))return e.pathname;let t=new URL(e);return t.search=``,t.hash=``,[`80`,`443`].includes(t.port)&&(t.port=``),t.password&&(t.password=`%filtered%`),t.username&&(t.username=`%filtered%`),t.toString()}function vh(e,t,n,r){return`${n?.method?.toUpperCase()??`GET`} ${r||(e?t===`client`?_h(e):e.pathname:`/`)}`}function yh(e,t,n,r,i){let a={[K]:n,[hl]:`url`};return i&&(a[t===`server`?`http.route`:`url.template`]=i,a[hl]=`route`),r?.method&&(a[Fl]=r.method.toUpperCase()),e&&(e.search&&(a[`url.query`]=e.search),e.hash&&(a[`url.fragment`]=e.hash),e.pathname&&(a[`url.path`]=e.pathname,e.pathname===`/`&&(a[hl]=`route`)),hh(e)||(a[Il]=e.href,e.port&&(a[`url.port`]=e.port),e.protocol&&(a[`url.scheme`]=e.protocol),e.hostname&&(a[t===`server`?`server.address`:`url.domain`]=e.hostname))),[vh(e,t,r,i),a]}function bh(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function xh(e){return e.split(/[?#]/,1)[0]}function Sh(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Ch(e,t=!0){if(e.startsWith(`data:`)){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:`text/plain`,i=e.includes(`;base64,`),a=e.indexOf(`,`),o=``;if(t&&a!==-1){let t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?`,base64`:``}${o?`,${o}`:``}`}return e}var wh,Th=n((()=>{Rl(),wh=`thismessage:/`}));function Eh(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:bo})),i.version=bo)}var Dh=n((()=>{xo()}));function Oh(e={}){let t=e.client||W();if(!xp()||!t)return{};let n=Zc(So());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||U(),i=e.span||Hu();if(!i&&sl())return{};let a=i?Tu(i):kh(r),o=Xl(i?ud(i):ld(t,r));if(!xu.test(a))return V.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?Eu(i):Ah(r)),s}function kh(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return _u(t,r,n)}function Ah(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return vu(t,r,n)}var jh=n((()=>{Qc(),To(),ml(),Tp(),H(),Ju(),fd(),tu(),Su()}));function Mh(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return R&&!r&&V.log(Nh,e),r;let i=Xs(e,t);return n?.set(e,i),R&&!i&&V.log(Nh,e),i}var Nh,Ph=n((()=>{z(),H(),Zs(),Nh=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`}));function Fh(e,t,n){let r,i,a,o=n?.maxWait?Math.max(n.maxWait,t):0,s=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=e(),r}function l(){i!==void 0&&clearTimeout(i),a!==void 0&&clearTimeout(a),i=a=void 0}function u(){return i!==void 0||a!==void 0?c():r}function d(){return i&&clearTimeout(i),i=s(c,t),o&&a===void 0&&(a=s(c,o)),r}return d.cancel=l,d.flush=u,d}var Ih=n((()=>{}));function Lh(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Rh(e){let t=e.headers||{},n=(typeof t[`x-forwarded-host`]==`string`?t[`x-forwarded-host`]:void 0)||(typeof t.host==`string`?t.host:void 0),r=(typeof t[`x-forwarded-proto`]==`string`?t[`x-forwarded-proto`]:void 0)||e.protocol||(e.socket?.encrypted?`https`:`http`),i=e.url||``,a=zh({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Wh(i),headers:Lh(t),cookies:s,data:o}}function zh({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Bh(e,t=!1,n=`request`){let r={};try{Object.entries(e).forEach(([e,i])=>{if(i==null)return;let a=e.toLowerCase();if((a===`cookie`||a===`set-cookie`)&&typeof i==`string`&&i!==``){let e=a===`set-cookie`,o=i.indexOf(`;`),s=e&&o!==-1?i.substring(0,o):i,c=e?[s]:s.split(`; `);for(let e of c){let i=e.indexOf(`=`),o=i===-1?e:e.substring(0,i),s=i===-1?``:e.substring(i+1);Hh(r,a,o.toLowerCase(),s,t,n)}}else Hh(r,a,``,i,t,n)})}catch{}return r}function Vh(e){return e.replace(/-/g,`_`)}function Hh(e,t,n,r,i,a){let o=Uh(n||t,r,i);if(o==null)return;let s=`http.${a}.header.${Vh(t)}${n?`.${Vh(n)}`:``}`;e[s]=o}function Uh(e,t,n){if(n?Gh.some(t=>e.includes(t)):[...Kh,...Gh].some(t=>e.includes(t)))return`[Filtered]`;if(Array.isArray(t))return t.map(e=>e==null?e:String(e)).join(`;`);if(typeof t==`string`)return t}function Wh(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}var Gh,Kh,qh=n((()=>{Gh=[`auth`,`token`,`secret`,`session`,`password`,`passwd`,`pwd`,`key`,`jwt`,`bearer`,`sso`,`saml`,`csrf`,`xsrf`,`credentials`,`set-cookie`,`cookie`],Kh=[`x-forwarded-`,`-user`]}));function Jh(e,t){let n=W(),r=cl();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=Yh}=n.getOptions();if(a<=0)return;let o={timestamp:fc(),...e},s=i?Eo(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}var Yh,Xh=n((()=>{ml(),H(),_c(),Yh=100})),Zh,Qh,$h,eg,tg,ng=n((()=>{ml(),Lp(),Bs(),Qh=`FunctionToString`,$h=new WeakMap,eg=(()=>({name:Qh,setupOnce(){Zh=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Fs(this),n=$h.has(W())&&t!==void 0?t:this;return Zh.apply(n,e)}}catch{}},setup(e){$h.set(e,!0)}})),tg=Y(eg)}));function rg(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:fg],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function ig(e,t){if(!e.type){if(ag(e,t.ignoreErrors))return R&&V.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${nc(e)}`),!0;if(dg(e))return R&&V.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${nc(e)}`),!0;if(sg(e,t.denyUrls))return R&&V.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${nc(e)}.\nUrl: ${ug(e)}`),!0;if(!cg(e,t.allowUrls))return R&&V.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${nc(e)}.\nUrl: ${ug(e)}`),!0}else if(e.type===`transaction`&&og(e,t.ignoreTransactions))return R&&V.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${nc(e)}`),!0;return!1}function ag(e,t){return t?.length?hm(e).some(e=>Xs(e,t)):!1}function og(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Xs(n,t):!1}function sg(e,t){if(!t?.length)return!1;let n=ug(e);return n?Xs(n,t):!1}function cg(e,t){if(!t?.length)return!0;let n=ug(e);return n?Xs(n,t):!0}function lg(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function ug(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?lg(t):null}catch{return R&&V.error(`Cannot extract url for event ${nc(e)}`),null}}function dg(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}var fg,pg,mg,hg,gg=n((()=>{z(),Lp(),H(),gm(),dc(),Zs(),fg=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],pg=`EventFilters`,mg=Y((e={})=>{let t;return{name:pg,setup(n){t=rg(e,n.getOptions())},processEvent(n,r,i){return t||(t=rg(e,i.getOptions())),ig(n,t)?null:n}}}),hg=Y(((e={})=>({...mg(e),name:`InboundFilters`})))}));function _g(e,t,n,r,i,a){if(!i.exception?.values||!a||!Ss(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=vg(e,t,r,a.originalException,n,i.exception.values,o,0))}function vg(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(Ss(r[i],Error)){bg(o,s,r);let a=e(t,r[i]),l=c.length;xg(a,i,l,s),c=vg(e,t,n,r[i],i,[a,...c],a,l)}return yg(r)&&r.errors.forEach((a,l)=>{if(Ss(a,Error)){bg(o,s,r);let u=e(t,a),d=c.length;xg(u,`errors[${l}]`,d,s),c=vg(e,t,n,a,i,[u,...c],u,d)}}),c}function yg(e){return Array.isArray(e.errors)}function bg(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...yg(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function xg(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}var Sg=n((()=>{Ts()})),Cg,wg,Tg,Eg,Dg,Og=n((()=>{Lp(),Sg(),nh(),Cg=`cause`,wg=5,Tg=`LinkedErrors`,Eg=((e={})=>{let t=e.limit||wg,n=e.key||Cg;return{name:Tg,preprocessEvent(e,r,i){_g(Ym,i.getOptions().stackParser,n,t,e,r)}}}),Dg=Y(Eg)}));function kg(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf(`=`,n);if(r===-1)break;let i=e.indexOf(`;`,n);if(i===-1)i=e.length;else if(i<r){n=e.lastIndexOf(`;`,r-1)+1;continue}let a=e.slice(n,r).trim();if(t[a]===void 0){let n=e.slice(r+1,i).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));try{t[a]=n.indexOf(`%`)===-1?n:decodeURIComponent(n)}catch{t[a]=n}}n=i+1}return t}var Ag=n((()=>{}));function jg(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Pg.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Mg(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Ng(e))||null}function Mg(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Ng(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}var Pg,Fg=n((()=>{Pg=[`X-Client-IP`,`X-Forwarded-For`,`Fly-Client-IP`,`CF-Connecting-IP`,`Fastly-Client-Ip`,`True-Client-Ip`,`X-Real-IP`,`X-Cluster-Client-IP`,`X-Forwarded`,`Forwarded-For`,`Forwarded`,`X-Vercel-Forwarded-For`]}));function Ig(e,t,n,r){if(e.request={...e.request,...Lg(t,r)},r.ip){let r=t.headers&&jg(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Lg(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||Pg.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?kg(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}var Rg,zg,Bg,Vg,Hg=n((()=>{Lp(),Ag(),Fg(),Rg={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},zg=`RequestData`,Bg=((e={})=>{let t={...Rg,...e.include};return{name:zg,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,s={...t,ip:t.ip??r.getOptions().sendDefaultPii};return a&&Ig(e,a,{ipAddress:o},s),e}}}),Vg=Y(Bg)}));function Ug(e){let t=`console`;Xo(t,e),Zo(t,Wg)}function Wg(){`console`in B&&Fo.forEach(function(e){e in B.console&&js(B.console,e,function(t){return Lo[e]=t,function(...t){Qo(`console`,{args:t,level:e}),Lo[e]?.apply(B.console,t)}})})}var Gg=n((()=>{H(),Bs(),yo(),ts()}));function Kg(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var qg=n((()=>{})),Jg,Yg,Xg,Zg=n((()=>{Jg=new WeakMap,Yg=(e,t)=>{let n=Jg.get(e);n?n.push(t):Jg.set(e,[t])},Xg=e=>{let t=Jg.get(e);return t||(t=[],Jg.set(e,t)),t}})),Qg,$g,e_,t_,n_,r_,i_=n((()=>{Qg=`express.name`,$g=`http.route`,e_=`express.type`,t_=`router`,n_=`middleware`,r_=`request_handler`}));function a_(e){return e.includes(`:`)||e.includes(`*`)}function o_(e,t){let n=Xg(e);if(n.length===0)return;if(n.every(e=>e===`/`))return e.originalUrl===`/`?`/`:void 0;if(t===`*`||t.includes(`/`)&&(t.includes(`,`)||t.includes(`\\`)||t.includes(`*`)||t.includes(`[`)))return t;let r=t.startsWith(`/`)?t:`/${t}`;return r.length>0&&(e.originalUrl===r||e.originalUrl.startsWith(r)||a_(r))?r:void 0}function s_(e){let t=Xg(e),n=``;for(let e of t)e===`/`||e===`/*`||(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}var c_,l_,u_,d_,f_,p_,m_,h_,g_,__,v_=n((()=>{Zg(),i_(),Zs(),c_=e=>e instanceof Error?[e,e.message]:[String(e),String(e)],l_=(e,t,n)=>{if(t.name===`router`){let r=u_(``,t)||n||e||`/`;return{attributes:{[Qg]:r,[e_]:t_},name:`router - ${r}`}}else if(t.name===`bound dispatch`||t.name===`handle`)return{attributes:{[Qg]:(e||n)??`request handler`,[e_]:r_},name:`request handler${t.path?` - ${e||n}`:``}`};else return{attributes:{[Qg]:t.name,[e_]:n_},name:`middleware - ${t.name}`}},u_=(e,t)=>{let n=Array.isArray(t.handle?.stack)?t.handle?.stack?.[0]:void 0;return n?.route?.path?`${e}${n.route.path}`:n&&Array.isArray(n?.handle?.stack)?u_(e,n):e},d_=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return Xs(e,n.ignoreLayers,!0)}catch{}return!1},f_=e=>{let t=e[0];return Array.isArray(t)?t.map(e=>p_(e)||``).join(`,`):p_(t)},p_=e=>typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0,m_=e=>h_(e?.Router?.prototype),h_=e=>(typeof e==`object`||typeof e==`function`)&&!!e&&`route`in e&&typeof e.route==`function`,g_=e=>h_(e.Router)&&!m_(e),__=e=>!!e&&typeof e==`object`&&`default`in e&&typeof e.default==`function`}));function y_(e){if(!cl()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let t=Rh(e);cl().setSDKProcessingMetadata({normalizedRequest:t})}}var b_=n((()=>{ml(),qh()}));function x_(e,t,n){if(!t?.handle)return;let r=t,i=r.handle;if(Fs(i)||i.length===4)return;function a(t,a,...o){let s=e();y_(t);let c=Hu();if(!c)return i.apply(this,[t,a,...o]);n&&Yg(t,n);let l=Xg(t),u=!!n,d=s_(t),f=o_(t,d);s.onRouteResolved?.(f);let p=l_(d,r,n),m=p.attributes[Qg],h=p.attributes[e_],g=Object.assign(p.attributes,{[K]:`auto.http.express`,[G]:`${h}.express`});if(f&&(g[$g]=f),d_(p.attributes[`express.name`],h,s))return u&&l.pop(),i.apply(this,[t,a,...o]);let _=cl();if(_!==Ic()){if(h===`request_handler`){let e=t.method?t.method.toUpperCase():`GET`;_.setTransactionName(`${e} ${d}`)}}else R&&V.warn(`Isolation scope is still default isolation scope - skipping setting transactionName`);return pf({name:m,attributes:g},e=>{let n=!1;p.attributes[`express.type`]===`router`&&(e.end(),n=!0);let r=()=>{n||(n=!0,e.end())};for(let i=0;i<o.length;i++){let s=o[i];if(typeof s==`function`){o[i]=function(...i){let o=i[0],d=!!o&&o!==`route`&&o!==`router`;if(!n&&d){let[t,n]=c_(o);e.setStatus({code:2,message:n})}return n||(n=!0,a.removeListener(`finish`,r),e.end()),!(t.route&&d)&&u&&l.pop(),hf(c,()=>s.apply(this,i))};break}}try{return i.apply(this,[t,a,...o])}catch(t){let[n,r]=c_(t);throw e.setStatus({code:2,message:r}),t}finally{n||a.once(`finish`,r)}})}for(let e in i)e in a||Object.defineProperty(a,e,{get(){return i[e]},set(t){i[e]=t}});Ns(a,i),Object.defineProperty(r,`handle`,{enumerable:!0,configurable:!0,writable:!0,value:a})}var S_=n((()=>{z(),Rl(),H(),Ju(),Bl(),Bs(),ml(),Of(),Zg(),i_(),v_(),Lc(),b_()}));function C_(e){return!!e.express}function w_(){D_||(D_=!0,R&&V.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function T_(e,t){let n,r;if(!t&&C_(e)){let{express:t,...i}=e;r=t,n=()=>i,w_()}else if(typeof t!=`function`)throw TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");else n=t,r=e;let i=E_(r),a=m_(i)?i.Router.prototype:g_(i)?i.Router:void 0;if(!a)throw TypeError(`no valid Express route function to instrument`);let o=a.route;try{Ps(a,`route`,function(...e){let t=o.apply(this,e),r=this.stack[this.stack.length-1];return x_(n,r,f_(e)),t})}catch(e){R&&V.error(`Failed to patch express route method:`,e)}let s=a.use;try{Ps(a,`use`,function(...e){let t=s.apply(this,e),r=this.stack[this.stack.length-1];return r&&x_(n,r,f_(e)),t})}catch(e){R&&V.error(`Failed to patch express use method:`,e)}let{application:c}=i,l=c.use;try{Ps(c,`use`,function(...e){let t=l.apply(this,e),r=m_(i)?this.router:this._router;if(r){let t=r.stack[r.stack.length-1];t&&x_(n,t,f_(e))}return t})}catch(e){R&&V.error(`Failed to patch express application.use method:`,e)}return i}var E_,D_,O_=n((()=>{H(),z(),v_(),Bs(),S_(),E_=e=>__(e)?e.default:e,D_=!1}));function k_(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=j_.exec(t);return n?n.slice(1):[]}function A_(e){let t=k_(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&(r=r.slice(0,r.length-1)),n+r)}var j_,M_=n((()=>{j_=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/}));function N_(e,t){return!e||typeof e!=`function`?(R&&V.warn(`instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance`),e):P_(e,{requireParentSpan:!0,...t})}function P_(e,t,n){if(e[K_])return e;let r=new Proxy(e,{apply(e,n,i){let a=Reflect.apply(e,n,i);return a&&typeof a==`object`&&`handle`in a&&L_(a,r,t),a},get(e,n){let i=e[n];return typeof n!=`string`||typeof i!=`function`?i:n===`unsafe`||n===`file`?F_(i,e,r,t):n===`begin`||n===`reserve`?I_(i,e,r,t):i}});return n?r[G_]=n:U_(e,r),e[K_]=!0,r[K_]=!0,r}function F_(e,t,n,r){return function(...i){let a=Reflect.apply(e,t,i);return a&&typeof a==`object`&&`handle`in a&&L_(a,n,r),a}}function I_(e,t,n,r){return function(...i){let a=n[G_];if(typeof i[i.length-1]!=`function`){let n=Reflect.apply(e,t,i);return n&&typeof n.then==`function`?n.then(e=>P_(e,r,a)):n}let o=i.length===1?i[0]:i[1],s=function(e){return o(P_(e,r,a))},c=i.length===1?[s]:[i[0],s];return Reflect.apply(e,t,c)}}function L_(e,t,n){if(e.handle?.__sentryWrapped)return;e[q_]=!0;let r=e.handle,i=async function(...i){if(!R_(n))return r.apply(this,i);let a=B_(z_(e.strings));return pf({name:a||`postgresjs.query`,op:`db`},e=>{e.setAttribute(K,`auto.db.postgresjs`),e.setAttributes({"db.system.name":`postgres`,"db.query.text":a});let o=t?t[G_]:void 0;if(V_(e,o),n.requestHook)try{n.requestHook(e,a,o)}catch(t){e.setAttribute(`sentry.hook.error`,`requestHook failed`),R&&V.error(`Error in requestHook for PostgresJs instrumentation:`,t)}let s=this;s.resolve=new Proxy(s.resolve,{apply:(t,n,r)=>{try{H_(e,a,r?.[0]?.command),e.end()}catch(e){R&&V.error(`Error ending span in resolve callback:`,e)}return Reflect.apply(t,n,r)}}),s.reject=new Proxy(s.reject,{apply:(t,n,r)=>{try{e.setStatus({code:2,message:r?.[0]?.message||`unknown_error`}),e.setAttribute(`db.response.status_code`,r?.[0]?.code||`unknown`),e.setAttribute(`error.type`,r?.[0]?.name||`unknown`),H_(e,a),e.end()}catch(e){R&&V.error(`Error ending span in reject callback:`,e)}return Reflect.apply(t,n,r)}});try{return r.apply(this,i)}catch(t){throw e.setStatus({code:2,message:t instanceof Error?t.message:`unknown_error`}),e.end(),t}})};i.__sentryWrapped=!0,e.handle=i}function R_(e){return Hu()!==void 0||!e.requireParentSpan}function z_(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}function B_(e){return e?e.replace(/--.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``).replace(/;\s*$/,``).replace(/\s+/g,` `).trim().replace(/\bX'[0-9A-Fa-f]*'/gi,`?`).replace(/\bB'[01]*'/gi,`?`).replace(/'(?:[^']|'')*'/g,`?`).replace(/\b0x[0-9A-Fa-f]+/gi,`?`).replace(/\b(?:TRUE|FALSE)\b/gi,`?`).replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,`?`).replace(/-?\b\d+\.\d+\b/g,`?`).replace(/-?\.\d+\b/g,`?`).replace(/(?<!\$)-?\b\d+\b/g,`?`).replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,`IN (?)`).replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,`IN ($?)`):`Unknown SQL Query`}function V_(e,t){if(t&&(t.ATTR_DB_NAMESPACE&&e.setAttribute(`db.namespace`,t.ATTR_DB_NAMESPACE),t.ATTR_SERVER_ADDRESS&&e.setAttribute(`server.address`,t.ATTR_SERVER_ADDRESS),t.ATTR_SERVER_PORT!==void 0)){let n=parseInt(t.ATTR_SERVER_PORT,10);isNaN(n)||e.setAttribute(`server.port`,n)}}function H_(e,t,n){if(n){e.setAttribute(`db.operation.name`,n);return}let r=t?.match(W_);r?.[1]&&e.setAttribute(`db.operation.name`,r[1].toUpperCase())}function U_(e,t){let n=e;if(!n.options||typeof n.options!=`object`)return;let r=n.options,i=r.host?.[0]||`localhost`,a=r.port?.[0]||5432;t[G_]={ATTR_DB_NAMESPACE:typeof r.database==`string`&&r.database!==``?r.database:void 0,ATTR_SERVER_ADDRESS:i,ATTR_SERVER_PORT:String(a)}}var W_,G_,K_,q_,J_=n((()=>{z(),Rl(),H(),Ju(),Bl(),Of(),W_=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,G_=Symbol(`sentryPostgresConnectionContext`),K_=Symbol.for(`sentry.instrumented.postgresjs`),q_=Symbol.for(`sentry.query.from.instrumented.sql`)}));function Y_(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Kg(e),message:X_(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${X_(e)}`:`Assertion failed`,n.data.arguments=e}else return;Jh(n,{input:t,level:e})}function X_(e){return`util`in B&&typeof B.util.format==`function`?B.util.format(...e):Js(e,` `)}var Z_,Q_,$_=n((()=>{Xh(),ml(),Gg(),Lp(),H(),qg(),Zs(),yo(),Z_=`Console`,Q_=Y((e={})=>{let t=new Set(e.levels||Fo);return{name:Z_,setup(e){Ug(({args:n,level:r})=>{W()!==e||!t.has(r)||Y_(r,n)})}}})})),ev,tv,nv,rv=n((()=>{ml(),Lp(),Rl(),Ju(),ev=`ConversationId`,tv=(()=>({name:ev,setup(e){e.on(`spanStart`,e=>{let t=U().getScopeData(),n=cl().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=q(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(Ll,r)}})}})),nv=Y(tv)})),iv,av,ov,sv,cv,lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv,Sv,Cv,wv,Tv,Ev,Dv,Ov,kv,Av,jv,Mv,Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv=n((()=>{iv=`gen_ai.prompt`,av=`gen_ai.system`,ov=`gen_ai.request.model`,sv=`gen_ai.request.stream`,cv=`gen_ai.request.temperature`,lv=`gen_ai.request.max_tokens`,uv=`gen_ai.request.frequency_penalty`,dv=`gen_ai.request.presence_penalty`,fv=`gen_ai.request.top_p`,pv=`gen_ai.request.top_k`,mv=`gen_ai.request.encoding_format`,hv=`gen_ai.request.dimensions`,gv=`gen_ai.response.finish_reasons`,_v=`gen_ai.response.model`,vv=`gen_ai.response.id`,yv=`gen_ai.response.stop_reason`,bv=`gen_ai.usage.input_tokens`,xv=`gen_ai.usage.output_tokens`,Sv=`gen_ai.usage.total_tokens`,Cv=`gen_ai.operation.name`,wv=`sentry.sdk_meta.gen_ai.input.messages.original_length`,Tv=`gen_ai.input.messages`,Ev=`gen_ai.output.messages`,Dv=`gen_ai.system_instructions`,Ov=`gen_ai.response.text`,kv=`gen_ai.request.available_tools`,Av=`gen_ai.response.streaming`,jv=`gen_ai.response.tool_calls`,Mv=`gen_ai.agent.name`,Nv=`gen_ai.pipeline.name`,Pv=`gen_ai.conversation.id`,Fv=`gen_ai.usage.cache_creation_input_tokens`,Iv=`gen_ai.usage.cache_read_input_tokens`,Lv=`gen_ai.usage.input_tokens.cache_write`,Rv=`gen_ai.usage.input_tokens.cached`,zv=`gen_ai.invoke_agent`,Bv=`gen_ai.embeddings.input`,Vv=`gen_ai.embeddings`,Hv=`gen_ai.tool.name`,Uv=`gen_ai.tool.call.id`,Wv=`gen_ai.tool.type`,Gv=`gen_ai.tool.input`,Kv=`gen_ai.tool.output`,qv=`gen_ai.tool.description`}));function Yv(e){return!e||typeof e!=`object`?!1:Qv(e)||$v(e)||Xv(e)||ey(e)||ty(e)||ny(e)||ry(e)||iy(e)||ay(e)||oy(e)||sy(e)||cy(e)}function Xv(e){return`image_url`in e?typeof e.image_url==`string`?e.image_url.startsWith(`data:`):Zv(e):!1}function Zv(e){return`image_url`in e&&!!e.image_url&&typeof e.image_url==`object`&&`url`in e.image_url&&typeof e.image_url.url==`string`&&e.image_url.url.startsWith(`data:`)}function Qv(e){return`type`in e&&typeof e.type==`string`&&`source`in e&&Yv(e.source)}function $v(e){return`inlineData`in e&&!!e.inlineData&&typeof e.inlineData==`object`&&`data`in e.inlineData&&typeof e.inlineData.data==`string`}function ey(e){return`type`in e&&e.type===`input_audio`&&`input_audio`in e&&!!e.input_audio&&typeof e.input_audio==`object`&&`data`in e.input_audio&&typeof e.input_audio.data==`string`}function ty(e){return`type`in e&&e.type===`file`&&`file`in e&&!!e.file&&typeof e.file==`object`&&`file_data`in e.file&&typeof e.file.file_data==`string`}function ny(e){return`media_type`in e&&typeof e.media_type==`string`&&`data`in e}function ry(e){return`type`in e&&e.type===`file`&&`mediaType`in e&&typeof e.mediaType==`string`&&`data`in e&&typeof e.data==`string`&&!e.data.startsWith(`http://`)&&!e.data.startsWith(`https://`)}function iy(e){return`type`in e&&e.type===`image`&&`image`in e&&typeof e.image==`string`&&!e.image.startsWith(`http://`)&&!e.image.startsWith(`https://`)}function ay(e){return`type`in e&&(e.type===`blob`||e.type===`base64`)}function oy(e){return`b64_json`in e}function sy(e){return`type`in e&&`result`in e&&e.type===`image_generation`}function cy(e){return`uri`in e&&typeof e.uri==`string`&&e.uri.startsWith(`data:`)}function ly(e){let t={...e};Yv(t.source)&&(t.source=ly(t.source)),$v(e)&&(t.inlineData={...e.inlineData,data:uy}),Zv(e)&&(t.image_url={...e.image_url,url:uy}),ey(e)&&(t.input_audio={...e.input_audio,data:uy}),ty(e)&&(t.file={...e.file,file_data:uy});for(let e of dy)typeof t[e]==`string`&&(t[e]=uy);return t}var uy,dy,fy=n((()=>{uy=`[Blob substitute]`,dy=[`image_url`,`data`,`content`,`b64_json`,`result`,`uri`,`image`]}));function py(e,t){if(Oy(e)<=t)return e;let n=0,r=e.length,i=``;for(;n<=r;){let a=Math.floor((n+r)/2),o=e.slice(0,a);Oy(o)<=t?(i=o,n=a+1):r=a-1}return i}function my(e){return typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``}function hy(e,t){return typeof e==`string`?t:{...e,text:t}}function gy(e){return typeof e==`object`&&!!e&&`content`in e&&typeof e.content==`string`}function _y(e){return typeof e==`object`&&!!e&&`content`in e&&Array.isArray(e.content)}function vy(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)&&e.parts.length>0}function yy(e,t){let n=t-ky({...e,content:``});if(n<=0)return[];let r=py(e.content,n);return[{...e,content:r}]}function by(e){return`parts`in e&&Array.isArray(e.parts)?{key:`parts`,items:e.parts}:`content`in e&&Array.isArray(e.content)?{key:`content`,items:e.content}:{key:null,items:[]}}function xy(e,t){let{key:n,items:r}=by(e);if(n===null||r.length===0)return[];let i=r.map(e=>hy(e,``)),a=t-ky({...e,[n]:i});if(a<=0)return[];let o=[];for(let e of r){let t=my(e),n=Oy(t);if(n<=a)o.push(e),a-=n;else if(o.length===0){let n=py(t,a);n&&o.push(hy(e,n));break}else break}return o.length<=0?[]:[{...e,[n]:o}]}function Sy(e,t){if(!e)return[];if(typeof e==`string`){let n=py(e,t);return n?[n]:[]}return typeof e==`object`?gy(e)?yy(e,t):_y(e)||vy(e)?xy(e,t):[]:[]}function Cy(e){return e.map(e=>{let t;return e&&typeof e==`object`&&(_y(e)?t={...e,content:Cy(e.content)}:`content`in e&&Yv(e.content)&&(t={...e,content:ly(e.content)}),vy(e)&&(t={...t??e,parts:Cy(e.parts)}),Yv(t)?t=ly(t):Yv(e)&&(t=ly(e))),t??e})}function wy(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=Cy([r]),a=i[0];return ky(a)<=n?i:Sy(a,n)}function Ty(e){return wy(e,Dy)}function Ey(e){return py(e,Dy)}var Dy,Oy,ky,Ay=n((()=>{fy(),Dy=2e4,Oy=e=>new TextEncoder().encode(e).length,ky=e=>Oy(JSON.stringify(e))}));function jy(e){let t=!!W()?.getOptions().sendDefaultPii;return{...e,recordInputs:e?.recordInputs??t,recordOutputs:e?.recordOutputs??t}}function My(e){let t=W();return e??!(t&&Zd(t))}function Ny(e,t){return e?`${e}.${t}`:t}function Py(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[bv]:t}),n!==void 0&&e.setAttributes({[xv]:n}),t!==void 0||n!==void 0||r!==void 0||i!==void 0){let a=(t??0)+(n??0)+(r??0)+(i??0);e.setAttributes({[Sv]:a})}}function Fy(e,t,n){if(!e.isRecording())return;let r={[Av]:!0};t.responseId&&(r[vv]=t.responseId),t.responseModel&&(r[_v]=t.responseModel),t.promptTokens!==void 0&&(r[bv]=t.promptTokens),t.completionTokens!==void 0&&(r[xv]=t.completionTokens),t.totalTokens===void 0?(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Sv]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)):r[Sv]=t.totalTokens,t.finishReasons.length&&(r[gv]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[Ov]=t.responseTexts.join(``)),n&&t.toolCalls.length&&(r[jv]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Iy(e){return typeof e==`string`?e:JSON.stringify(e)}function Ly(e){if(typeof e==`string`)return Ey(e);if(Array.isArray(e)){let t=Ty(e);return JSON.stringify(t)}return JSON.stringify(e)}function Ry(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};let t=e.findIndex(e=>e&&typeof e==`object`&&`role`in e&&e.role===`system`);if(t===-1)return{systemInstructions:void 0,filteredMessages:e};let n=e[t],r=typeof n.content==`string`?n.content:n.content===void 0?void 0:JSON.stringify(n.content);return r?{systemInstructions:JSON.stringify([{type:`text`,content:r}]),filteredMessages:[...e.slice(0,t),...e.slice(t+1)]}:{systemInstructions:void 0,filteredMessages:e}}async function zy(e,t,n){let r=e.catch(e=>{throw J(e,{mechanism:{handled:!1,type:n}}),e}),i=await t,a=await r;return a&&typeof a==`object`&&`data`in a?{...a,data:i}:i}function By(e,t,n){return bs(e)?new Proxy(e,{get(e,r){let i=r in Promise.prototype||r===Symbol.toStringTag?t:e,a=Reflect.get(i,r);return r===`withResponse`&&typeof a==`function`?function(){return zy(a.call(e),t,n)}:typeof a==`function`?a.bind(i):a}}):t}var Vy=n((()=>{Tp(),ml(),Qd(),Ts(),Jv(),Ay()})),Hy,Uy,Wy=n((()=>{Hy=new Map,Uy=new Map([[`ai.generateText`,`invoke_agent`],[`ai.streamText`,`invoke_agent`],[`ai.generateObject`,`invoke_agent`],[`ai.streamObject`,`invoke_agent`],[`ai.generateText.doGenerate`,`generate_content`],[`ai.streamText.doStream`,`generate_content`],[`ai.generateObject.doGenerate`,`generate_content`],[`ai.streamObject.doStream`,`generate_content`],[`ai.embed.doEmbed`,`embeddings`],[`ai.embedMany.doEmbed`,`embeddings`],[`ai.rerank.doRerank`,`rerank`],[`ai.toolCall`,`execute_tool`]])})),Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb,ub,db,fb,pb=n((()=>{Gy=`operation.name`,Ky=`ai.operationId`,qy=`ai.prompt`,Jy=`ai.schema`,Yy=`ai.response.object`,Xy=`ai.values`,Zy=`ai.response.text`,Qy=`ai.response.toolCalls`,$y=`ai.response.finishReason`,eb=`ai.prompt.messages`,tb=`ai.prompt.tools`,nb=`ai.model.id`,rb=`ai.response.providerMetadata`,ib=`ai.usage.cachedInputTokens`,ab=`ai.telemetry.functionId`,ob=`ai.usage.completionTokens`,sb=`ai.usage.promptTokens`,cb=`ai.usage.tokens`,lb=`ai.toolCall.name`,ub=`ai.toolCall.id`,db=`ai.toolCall.args`,fb=`ai.toolCall.result`}));function mb(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[bv],i=e.data[xv];if(typeof r==`number`||typeof i==`number`){let e=t.get(n)||{inputTokens:0,outputTokens:0};typeof r==`number`&&(e.inputTokens+=r),typeof i==`number`&&(e.outputTokens+=i),t.set(n,e)}}function hb(e,t){let n=t.get(e.span_id);!n||!e.data||(n.inputTokens>0&&(e.data[bv]=n.inputTokens),n.outputTokens>0&&(e.data[xv]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data[`gen_ai.usage.total_tokens`]=n.inputTokens+n.outputTokens))}function gb(e){let t=new Map;for(let n of e){let e=n.data[kv];if(typeof e==`string`)try{let n=JSON.parse(e);for(let e of n)e.name&&e.description&&!t.has(e.name)&&t.set(e.name,e.description)}catch{}}return t}function _b(e,t){let n=gb(e);for(let r of e){if(r.op===`gen_ai.execute_tool`){let e=r.data[Hv];if(typeof e==`string`){let t=n.get(e);t&&(r.data[qv]=t)}}r.op===`gen_ai.invoke_agent`&&hb(r,t)}}function vb(e){return Hy.get(e)}function yb(e){Hy.delete(e)}function bb(e){let t=e.map(e=>{if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e});return JSON.stringify(t)}function xb(e){return e.filter(e=>!!e&&typeof e==`object`&&`role`in e&&`content`in e)}function Sb(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`){let{messages:e}=t,{prompt:n,system:r}=t,i=[];if(typeof r==`string`&&i.push({role:`system`,content:r}),typeof e==`string`)try{e=JSON.parse(e)}catch{}if(Array.isArray(e))return i.push(...xb(e)),i;if(Array.isArray(n))return i.push(...xb(n)),i;if(typeof n==`string`&&i.push({role:`user`,content:n}),i.length>0)return i}}catch{}return[]}function Cb(e,t,n){if(typeof t[`ai.prompt`]==`string`&&!t[`gen_ai.input.messages`]&&!t[`ai.prompt.messages`]){let r=t[qy],i=Sb(r);if(i.length){let{systemInstructions:t,filteredMessages:r}=Ry(i);t&&e.setAttribute(Dv,t);let a=Array.isArray(r)?r.length:0,o=n?Ly(r):Iy(r);e.setAttributes({[qy]:o,[Tv]:o,[wv]:a})}}else if(typeof t[`ai.prompt.messages`]==`string`)try{let r=JSON.parse(t[eb]);if(Array.isArray(r)){let{systemInstructions:t,filteredMessages:i}=Ry(r);t&&e.setAttribute(Dv,t);let a=Array.isArray(i)?i.length:0,o=n?Ly(i):Iy(i);e.setAttributes({[eb]:o,[Tv]:o,[wv]:a})}}catch{}}var wb=n((()=>{Jv(),Vy(),Wy(),pb()}));function Tb(e){let{data:t,description:n}=q(e);if(!n)return;if(t[`ai.toolCall.name`]&&t[`ai.toolCall.id`]&&n===`ai.toolCall`){jb(e,t);return}if(!t[`ai.operationId`]&&!n.startsWith(`ai.`))return;let r=W()?.getIntegrationByName(`VercelAI`);Mb(e,n,t,My(r?.options?.enableTruncation))}function Eb(e){if(e.type===`transaction`&&e.spans){let t=new Map;for(let n of e.spans)kb(n),mb(n,t);_b(e.spans,t);let n=e.contexts?.trace;n?.op===`gen_ai.invoke_agent`&&hb(n,t)}return e}function Db(e){if(typeof e!=`string`)return`stop`;switch(e){case`tool-calls`:return`tool_call`;case`stop`:case`length`:case`content_filter`:case`error`:return e;default:return e}}function Ob(e){let t=e[Zy],n=e[Qy],r=e[$y];if(t==null&&n==null)return;let i=[];if(typeof t==`string`&&t.length>0&&i.push({type:`text`,content:t}),n!=null)try{let t=typeof n==`string`?JSON.parse(n):n;if(Array.isArray(t)){for(let e of t){let t=e.input??e.args;i.push({type:`tool_call`,id:e.toolCallId,name:e.toolName,arguments:typeof t==`string`?t:JSON.stringify(t??{})})}delete e[Qy]}}catch{}if(i.length>0){let t={role:`assistant`,parts:i,finish_reason:Db(r)};e[Ev]=JSON.stringify([t]),delete e[Zy]}}function kb(e){let{data:t,origin:n}=e;if(n===`auto.vercelai.otel`){if(e.status&&e.status!==`ok`&&(e.status=`internal_error`),Ab(t,ob,xv),Ab(t,sb,bv),Ab(t,ib,Rv),Ab(t,`ai.usage.inputTokens`,bv),Ab(t,`ai.usage.outputTokens`,xv),Ab(t,cb,bv),Ab(t,`ai.response.avgOutputTokensPerSecond`,`ai.response.avgCompletionTokensPerSecond`),typeof t[`gen_ai.usage.input_tokens`]==`number`&&typeof t[`gen_ai.usage.input_tokens.cached`]==`number`&&(t[bv]=t[bv]+t[Rv]),typeof t[`gen_ai.usage.input_tokens`]==`number`&&(t[Sv]=(typeof t[`gen_ai.usage.output_tokens`]==`number`?t[xv]:0)+t[bv]),t[`ai.prompt.tools`]&&Array.isArray(t[`ai.prompt.tools`])&&(t[tb]=bb(t[tb])),t[`operation.name`]){let e=t[`ai.operationId`]?t[Ky]:t[Gy];t[Cv]=Uy.get(e)??e,delete t[Gy]}if(Ab(t,eb,Tv),Ob(t),Ab(t,Yy,`gen_ai.response.object`),Ab(t,tb,`gen_ai.request.available_tools`),Ab(t,db,Gv),Ab(t,fb,Kv),Ab(t,Jy,`gen_ai.request.schema`),Ab(t,nb,ov),Array.isArray(t[`ai.values`])){let e=t[Xy].map(e=>{try{return JSON.parse(e)}catch{return e}});t[Bv]=e.length===1?e[0]:JSON.stringify(e)}Pb(t);for(let e of Object.keys(t))e.startsWith(`ai.`)&&Ab(t,e,`vercel.${e}`)}}function Ab(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function jb(e,t){e.setAttribute(K,`auto.vercelai.otel`),e.setAttribute(G,`gen_ai.execute_tool`),e.setAttribute(Cv,`execute_tool`),Ab(t,lb,Hv),Ab(t,ub,Uv);let n=t[Uv];typeof n==`string`&&Hy.set(n,e.spanContext()),t[`gen_ai.tool.type`]||e.setAttribute(Wv,`function`);let r=t[Hv];r&&e.updateName(`execute_tool ${r}`)}function Mb(e,t,n,r){e.setAttribute(K,`auto.vercelai.otel`);let i=t.replace(`ai.`,``);e.setAttribute(`ai.pipeline.name`,i),e.updateName(i);let a=n[ab];a&&typeof a==`string`&&e.setAttribute(`gen_ai.function_id`,a),Cb(e,n,r),n[`ai.model.id`]&&!n[`gen_ai.response.model`]&&e.setAttribute(_v,n[nb]),e.setAttribute(`ai.streaming`,t.includes(`stream`));let o=Uy.get(t);if(o?e.setAttribute(G,`gen_ai.${o}`):t.startsWith(`ai.stream`)&&e.setAttribute(G,`ai.run`),o===`invoke_agent`){a&&typeof a==`string`?e.updateName(`invoke_agent ${a}`):e.updateName(`invoke_agent`);return}let s=n[nb];s&&o&&e.updateName(`${o} ${s}`)}function Nb(e){e.on(`spanStart`,Tb),e.addEventProcessor(Object.assign(Eb,{id:`VercelAiEventProcessor`}))}function Pb(e){let t=e[rb];if(t)try{let n=JSON.parse(t),r=n.openai??n.azure;r&&(Fb(e,Rv,r.cachedPromptTokens),Fb(e,`gen_ai.usage.output_tokens.reasoning`,r.reasoningTokens),Fb(e,`gen_ai.usage.output_tokens.prediction_accepted`,r.acceptedPredictionTokens),Fb(e,`gen_ai.usage.output_tokens.prediction_rejected`,r.rejectedPredictionTokens),e[`gen_ai.conversation.id`]||Fb(e,`gen_ai.conversation.id`,r.responseId)),n.anthropic&&(Fb(e,Rv,n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens),Fb(e,Lv,n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens)),n.bedrock?.usage&&(Fb(e,Rv,n.bedrock.usage.cacheReadInputTokens),Fb(e,Lv,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(Fb(e,Rv,n.deepseek.promptCacheHitTokens),Fb(e,`gen_ai.usage.input_tokens.cache_miss`,n.deepseek.promptCacheMissTokens))}catch{}}function Fb(e,t,n){n!=null&&(e[t]=n)}var Ib=n((()=>{ml(),Rl(),Vy(),Ju(),Jv(),Wy(),wb(),pb()})),Lb,Rb,zb,Bb,Vb=n((()=>{Lb=`OpenAI`,Rb={"responses.create":{operation:`chat`},"chat.completions.create":{operation:`chat`},"embeddings.create":{operation:`embeddings`},"conversations.create":{operation:`chat`}},zb=[`response.output_item.added`,`response.function_call_arguments.delta`,`response.function_call_arguments.done`,`response.output_item.done`],Bb=[`response.created`,`response.in_progress`,`response.failed`,`response.completed`,`response.incomplete`,`response.queued`,`response.output_text.delta`,...zb]}));function Hb(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&e.type.startsWith(`response.`)}function Ub(e){return typeof e==`object`&&!!e&&`object`in e&&e.object===`chat.completion.chunk`}function Wb(e,t,n){if(!t||typeof t!=`object`)return;let r=t,i={};if(typeof r.id==`string`&&(i[vv]=r.id),typeof r.model==`string`&&(i[_v]=r.model),r.object===`conversation`&&typeof r.id==`string`&&(i[Pv]=r.id),r.usage&&typeof r.usage==`object`){let e=r.usage,t=e.prompt_tokens??e.input_tokens;typeof t==`number`&&(i[bv]=t);let n=e.completion_tokens??e.output_tokens;typeof n==`number`&&(i[xv]=n),typeof e.total_tokens==`number`&&(i[Sv]=e.total_tokens)}if(Array.isArray(r.choices)){let e=r.choices,t=e.map(e=>e.finish_reason).filter(e=>typeof e==`string`);if(t.length>0&&(i[gv]=JSON.stringify(t)),n){let t=e.map(e=>e.message?.content||``);i[Ov]=JSON.stringify(t);let n=e.map(e=>e.message?.tool_calls).filter(e=>Array.isArray(e)&&e.length>0).flat();n.length>0&&(i[jv]=JSON.stringify(n))}}if(typeof r.status==`string`&&(i[`gen_ai.response.finish_reasons`]||(i[gv]=JSON.stringify([r.status]))),n&&(typeof r.output_text==`string`&&!i[`gen_ai.response.text`]&&(i[Ov]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!i[`gen_ai.response.tool_calls`])){let e=r.output.filter(e=>e?.type===`function_call`);e.length>0&&(i[jv]=JSON.stringify(e))}e.setAttributes(i)}function Gb(e){if(`conversation`in e&&typeof e.conversation==`string`)return e.conversation;if(`previous_response_id`in e&&typeof e.previous_response_id==`string`)return e.previous_response_id}function Kb(e){let t={[ov]:e.model??`unknown`};`temperature`in e&&(t[cv]=e.temperature),`top_p`in e&&(t[fv]=e.top_p),`frequency_penalty`in e&&(t[uv]=e.frequency_penalty),`presence_penalty`in e&&(t[dv]=e.presence_penalty),`stream`in e&&(t[sv]=e.stream),`encoding_format`in e&&(t[mv]=e.encoding_format),`dimensions`in e&&(t[hv]=e.dimensions);let n=Gb(e);return n&&(t[Pv]=n),t}var qb=n((()=>{Jv()}));function Jb(e,t){for(let n of e){let e=n.index;if(!(e===void 0||!n.function))if(!(e in t.chatCompletionToolCalls))t.chatCompletionToolCalls[e]={...n,function:{name:n.function.name,arguments:n.function.arguments||``}};else{let r=t.chatCompletionToolCalls[e];n.function.arguments&&r?.function&&(r.function.arguments+=n.function.arguments)}}}function Yb(e,t,n){t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.prompt_tokens,t.completionTokens=e.usage.completion_tokens,t.totalTokens=e.usage.total_tokens);for(let r of e.choices??[])n&&(r.delta?.content&&t.responseTexts.push(r.delta.content),r.delta?.tool_calls&&Jb(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function Xb(e,t,n,r){if(!(e&&typeof e==`object`)){t.eventTypes.push(`unknown:non-object`);return}if(e instanceof Error){r.setStatus({code:2,message:`internal_error`}),J(e,{mechanism:{handled:!1,type:`auto.ai.openai.stream-response`}});return}if(!(`type`in e))return;let i=e;if(!Bb.includes(i.type)){t.eventTypes.push(i.type);return}if(n&&(i.type===`response.output_item.done`&&`item`in i&&t.responsesApiToolCalls.push(i.item),i.type===`response.output_text.delta`&&`delta`in i&&i.delta)){t.responseTexts.push(i.delta);return}if(`response`in i){let{response:e}=i;t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.input_tokens,t.completionTokens=e.usage.output_tokens,t.totalTokens=e.usage.total_tokens),e.status&&t.finishReasons.push(e.status),n&&e.output_text&&t.responseTexts.push(e.output_text)}}async function*Zb(e,t,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:``,responseModel:``,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let i of e)Ub(i)?Yb(i,r,n):Hb(i)&&Xb(i,r,n,t),yield i}finally{let e=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];Fy(t,{...r,toolCalls:e},n)}}var Qb=n((()=>{Tp(),Bl(),Vy(),Vb(),qb()}));function $b(e){let t=Array.isArray(e.tools)?e.tools:[],n=e.web_search_options&&typeof e.web_search_options==`object`?[{type:`web_search_options`,...e.web_search_options}]:[],r=[...t,...n];if(r.length!==0)try{return JSON.stringify(r)}catch(e){R&&V.error(`Failed to serialize OpenAI tools:`,e);return}}function ex(e,t){let n={[av]:`openai`,[Cv]:t,[K]:`auto.ai.openai`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0],r=$b(t);r&&(n[kv]=r),Object.assign(n,Kb(t))}else n[ov]=`unknown`;return n}function tx(e,t,n,r){if(n===`embeddings`&&`input`in t){let n=t.input;if(n==null||typeof n==`string`&&n.length===0||Array.isArray(n)&&n.length===0)return;e.setAttribute(Bv,typeof n==`string`?n:JSON.stringify(n));return}let i=`input`in t?t.input:`messages`in t?t.messages:void 0;if(!i||Array.isArray(i)&&i.length===0)return;let{systemInstructions:a,filteredMessages:o}=Ry(i);a&&e.setAttribute(Dv,a),e.setAttribute(Tv,r?Ly(o):Iy(o)),Array.isArray(o)?e.setAttribute(wv,o.length):e.setAttribute(wv,1)}function nx(e,t,n,r,i){return function(...a){let o=n.operation||`unknown`,s=ex(a,o),c=s[`gen_ai.request.model`]||`unknown`,l=a[0],u=l&&typeof l==`object`&&l.stream===!0,d={name:`${o} ${c}`,op:`gen_ai.${o}`,attributes:s};if(u){let n,s=pf(d,s=>(n=e.apply(r,a),i.recordInputs&&l&&tx(s,l,o,My(i.enableTruncation)),(async()=>{try{return Zb(await n,s,i.recordOutputs??!1)}catch(e){throw s.setStatus({code:2,message:`internal_error`}),J(e,{mechanism:{handled:!1,type:`auto.ai.openai.stream`,data:{function:t}}}),s.end(),e}})()));return By(n,s,`auto.ai.openai`)}let f,p=ff(d,n=>(f=e.apply(r,a),i.recordInputs&&l&&tx(n,l,o,My(i.enableTruncation)),f.then(e=>(Wb(n,e,i.recordOutputs),e),e=>{throw J(e,{mechanism:{handled:!1,type:`auto.ai.openai`,data:{function:t}}}),e})));return By(f,p,`auto.ai.openai`)}}function rx(e,t=``,n){return new Proxy(e,{get(e,r){let i=e[r],a=Ny(t,String(r)),o=Rb[a];return typeof i==`function`&&o?nx(i,a,o,e,n):typeof i==`function`?i.bind(e):i&&typeof i==`object`?rx(i,a,n):i}})}function ix(e,t){return rx(e,``,jy(t))}var ax=n((()=>{z(),Tp(),Rl(),H(),Bl(),Of(),Jv(),Vy(),Vb(),Qb(),qb()})),ox,sx,cx=n((()=>{ox=`Anthropic_AI`,sx={"messages.create":{operation:`chat`},"messages.stream":{operation:`chat`,streaming:!0},"messages.countTokens":{operation:`chat`},"models.get":{operation:`models`},"completions.create":{operation:`chat`},"models.retrieve":{operation:`models`},"beta.messages.create":{operation:`chat`}}}));function lx(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=Ry(t);r&&e.setAttributes({[Dv]:r});let a=Array.isArray(i)?i.length:1;e.setAttributes({[Tv]:n?Ly(i):Iy(i),[wv]:a})}function ux(e){return e&&px[e]||`internal_error`}function dx(e,t){t.error&&(e.setStatus({code:2,message:ux(t.error.type)}),J(t.error,{mechanism:{handled:!1,type:`auto.ai.anthropic.anthropic_error`}}))}function fx(e){let{system:t,messages:n,input:r}=e,i=typeof t==`string`?[{role:`system`,content:e.system}]:[],a=(Array.isArray(r)?r:r==null?void 0:[r])??(Array.isArray(n)?n:n==null?[]:[n]);return[...i,...a]}var px,mx=n((()=>{Tp(),Bl(),Jv(),Vy(),px={invalid_request_error:`invalid_argument`,authentication_error:`unauthenticated`,permission_error:`permission_denied`,not_found_error:`not_found`,request_too_large:`failed_precondition`,rate_limit_error:`resource_exhausted`,api_error:`internal_error`,overloaded_error:`unavailable`}}));function hx(e,t){return`type`in e&&typeof e.type==`string`&&e.type===`error`?(t.setStatus({code:2,message:ux(e.error?.type)}),J(e.error,{mechanism:{handled:!1,type:`auto.ai.anthropic.anthropic_error`}}),!0):!1}function gx(e,t){if(e.type===`message_delta`&&e.usage&&`output_tokens`in e.usage&&typeof e.usage.output_tokens==`number`&&(t.completionTokens=e.usage.output_tokens),e.message){let n=e.message;n.id&&(t.responseId=n.id),n.model&&(t.responseModel=n.model),n.stop_reason&&t.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens==`number`&&(t.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens==`number`&&(t.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens==`number`&&(t.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function _x(e,t){e.type!==`content_block_start`||typeof e.index!=`number`||!e.content_block||(e.content_block.type===`tool_use`||e.content_block.type===`server_tool_use`)&&(t.activeToolBlocks[e.index]={id:e.content_block.id,name:e.content_block.name,inputJsonParts:[]})}function vx(e,t,n){if(!(e.type!==`content_block_delta`||!e.delta)){if(typeof e.index==`number`&&`partial_json`in e.delta&&typeof e.delta.partial_json==`string`){let n=t.activeToolBlocks[e.index];n&&n.inputJsonParts.push(e.delta.partial_json)}n&&typeof e.delta.text==`string`&&t.responseTexts.push(e.delta.text)}}function yx(e,t){if(e.type!==`content_block_stop`||typeof e.index!=`number`)return;let n=t.activeToolBlocks[e.index];if(!n)return;let r=n.inputJsonParts.join(``),i;try{i=r?JSON.parse(r):{}}catch{i={__unparsed:r}}t.toolCalls.push({type:`tool_use`,id:n.id,name:n.name,input:i}),delete t.activeToolBlocks[e.index]}function bx(e,t,n,r){e&&typeof e==`object`&&(hx(e,r)||(gx(e,t),_x(e,t),vx(e,t,n),yx(e,t)))}async function*xx(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:``,responseModel:``,promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let i of e)bx(i,r,n,t),yield i}finally{Fy(t,r,n)}}function Sx(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:``,responseModel:``,promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return e.on(`streamEvent`,e=>{bx(e,r,n,t)}),e.on(`message`,()=>{Fy(t,r,n)}),e.on(`error`,e=>{J(e,{mechanism:{handled:!1,type:`auto.ai.anthropic.stream_error`}}),t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end())}),e}var Cx=n((()=>{Tp(),Bl(),Vy(),mx()}));function wx(e,t,n){let r={[av]:`anthropic`,[Cv]:n,[K]:`auto.ai.anthropic`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0];t.tools&&Array.isArray(t.tools)&&(r[kv]=JSON.stringify(t.tools)),r[ov]=t.model??`unknown`,`temperature`in t&&(r[cv]=t.temperature),`top_p`in t&&(r[fv]=t.top_p),`stream`in t&&(r[sv]=t.stream),`top_k`in t&&(r[pv]=t.top_k),`frequency_penalty`in t&&(r[uv]=t.frequency_penalty),`max_tokens`in t&&(r[lv]=t.max_tokens)}else t===`models.retrieve`||t===`models.get`?r[ov]=e[0]:r[ov]=`unknown`;return r}function Tx(e,t,n){lx(e,fx(t),n),`prompt`in t&&e.setAttributes({[iv]:JSON.stringify(t.prompt)})}function Ex(e,t){if(`content`in t&&Array.isArray(t.content)){e.setAttributes({[Ov]:t.content.map(e=>e.text).filter(e=>!!e).join(``)});let n=[];for(let e of t.content)(e.type===`tool_use`||e.type===`server_tool_use`)&&n.push(e);n.length>0&&e.setAttributes({[jv]:JSON.stringify(n)})}`completion`in t&&e.setAttributes({[Ov]:t.completion}),`input_tokens`in t&&e.setAttributes({[Ov]:JSON.stringify(t.input_tokens)})}function Dx(e,t){`id`in t&&`model`in t&&(e.setAttributes({[vv]:t.id,[_v]:t.model}),`usage`in t&&t.usage&&Py(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function Ox(e,t,n){if(!(!t||typeof t!=`object`)){if(`type`in t&&t.type===`error`){dx(e,t);return}n&&Ex(e,t),Dx(e,t)}}function kx(e,t,n){throw J(e,{mechanism:{handled:!1,type:`auto.ai.anthropic`,data:{function:n}}}),t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end()),e}function Ax(e,t,n,r,i,a,o,s,c,l,u){let d={name:`${a} ${i[`gen_ai.request.model`]??`unknown`}`,op:`gen_ai.${a}`,attributes:i};if(l&&!u){let t,i=pf(d,i=>(t=e.apply(n,r),c.recordInputs&&s&&Tx(i,s,My(c.enableTruncation)),(async()=>{try{return xx(await t,i,c.recordOutputs??!1)}catch(e){return kx(e,i,o)}})()));return By(t,i,`auto.ai.anthropic`)}else return pf(d,e=>{try{return c.recordInputs&&s&&Tx(e,s,My(c.enableTruncation)),Sx(t.apply(n,r),e,c.recordOutputs??!1)}catch(t){return kx(t,e,o)}})}function jx(e,t,n,r,i){return new Proxy(e,{apply(a,o,s){let c=n.operation||`unknown`,l=wx(s,t,c),u=l[`gen_ai.request.model`]??`unknown`,d=typeof s[0]==`object`?s[0]:void 0,f=!!d?.stream,p=n.streaming===!0;if(f||p)return Ax(e,a,r,s,l,c,t,d,i,f,p);let m,h=ff({name:`${c} ${u}`,op:`gen_ai.${c}`,attributes:l},e=>(m=a.apply(r,s),i.recordInputs&&d&&Tx(e,d,My(i.enableTruncation)),m.then(t=>(Ox(e,t,i.recordOutputs),t),e=>{throw J(e,{mechanism:{handled:!1,type:`auto.ai.anthropic`,data:{function:t}}}),e})));return By(m,h,`auto.ai.anthropic`)}})}function Mx(e,t=``,n){return new Proxy(e,{get(e,r){let i=e[r],a=Ny(t,String(r)),o=sx[a];return typeof i==`function`&&o?jx(i,a,o,e,n):typeof i==`function`?i.bind(e):i&&typeof i==`object`?Mx(i,a,n):i}})}function Nx(e,t){return Mx(e,``,jy(t))}var Px=n((()=>{Tp(),Rl(),Bl(),Of(),Jv(),Vy(),cx(),Cx(),mx()})),Fx,Ix,Lx,Rx=n((()=>{Fx=`Google_GenAI`,Ix={"models.generateContent":{operation:`generate_content`},"models.generateContentStream":{operation:`generate_content`,streaming:!0},"models.embedContent":{operation:`embeddings`},"chats.create":{proxyResultPath:`chat`},"chat.sendMessage":{operation:`chat`},"chat.sendMessageStream":{operation:`chat`,streaming:!0}},Lx=`google_genai`}));function zx(e,t){let n=e?.promptFeedback;if(n?.blockReason){let e=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:`internal_error`}),J(`Content blocked: ${e}`,{mechanism:{handled:!1,type:`auto.ai.google_genai`}}),!0}return!1}function Bx(e,t){typeof e.responseId==`string`&&(t.responseId=e.responseId),typeof e.modelVersion==`string`&&(t.responseModel=e.modelVersion);let n=e.usageMetadata;n&&(typeof n.promptTokenCount==`number`&&(t.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount==`number`&&(t.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount==`number`&&(t.totalTokens=n.totalTokenCount))}function Vx(e,t,n){Array.isArray(e.functionCalls)&&t.toolCalls.push(...e.functionCalls);for(let r of e.candidates??[]){r?.finishReason&&!t.finishReasons.includes(r.finishReason)&&t.finishReasons.push(r.finishReason);for(let e of r?.content?.parts??[])n&&e.text&&t.responseTexts.push(e.text),e.functionCall&&t.toolCalls.push({type:`function`,id:e.functionCall.id,name:e.functionCall.name,arguments:e.functionCall.args})}}function Hx(e,t,n,r){!e||zx(e,r)||(Bx(e,t),Vx(e,t,n))}async function*Ux(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)Hx(i,r,n,t),yield i}finally{Fy(t,r,n)}}var Wx=n((()=>{Tp(),Bl(),Vy()}));function Gx(e,t=`user`){return typeof e==`string`?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(e=>Gx(e,t)):typeof e!=`object`||!e?[]:`role`in e&&typeof e.role==`string`?[e]:`parts`in e?[{...e,role:t}]:[{role:t,content:e}]}var Kx=n((()=>{}));function qx(e,t){if(`model`in e&&typeof e.model==`string`)return e.model;if(t&&typeof t==`object`){let e=t;if(`model`in e&&typeof e.model==`string`)return e.model;if(`modelVersion`in e&&typeof e.modelVersion==`string`)return e.modelVersion}return`unknown`}function Jx(e){let t={};return`temperature`in e&&typeof e.temperature==`number`&&(t[cv]=e.temperature),`topP`in e&&typeof e.topP==`number`&&(t[fv]=e.topP),`topK`in e&&typeof e.topK==`number`&&(t[pv]=e.topK),`maxOutputTokens`in e&&typeof e.maxOutputTokens==`number`&&(t[lv]=e.maxOutputTokens),`frequencyPenalty`in e&&typeof e.frequencyPenalty==`number`&&(t[uv]=e.frequencyPenalty),`presencePenalty`in e&&typeof e.presencePenalty==`number`&&(t[dv]=e.presencePenalty),t}function Yx(e,t,n){let r={[av]:Lx,[Cv]:e,[K]:`auto.ai.google_genai`};if(t){if(r[ov]=qx(t,n),`config`in t&&typeof t.config==`object`&&t.config){let e=t.config;if(Object.assign(r,Jx(e)),`tools`in e&&Array.isArray(e.tools)){let t=e.tools.flatMap(e=>e.functionDeclarations);r[kv]=JSON.stringify(t)}}}else r[ov]=qx({},n);return r}function Xx(e,t,n,r){if(n){let n=t.contents;n!=null&&e.setAttribute(Bv,typeof n==`string`?n:JSON.stringify(n));return}let i=[];if(`config`in t&&t.config&&typeof t.config==`object`&&`systemInstruction`in t.config&&t.config.systemInstruction&&i.push(...Gx(t.config.systemInstruction,`system`)),`history`in t&&i.push(...Gx(t.history,`user`)),`contents`in t&&i.push(...Gx(t.contents,`user`)),`message`in t&&i.push(...Gx(t.message,`user`)),Array.isArray(i)&&i.length){let{systemInstructions:t,filteredMessages:n}=Ry(i);t&&e.setAttribute(Dv,t);let a=Array.isArray(n)?n.length:0;e.setAttributes({[wv]:a,[Tv]:r?Ly(n):Iy(n)})}}function Zx(e,t,n){if(!(!t||typeof t!=`object`)){if(t.modelVersion&&e.setAttribute(_v,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata==`object`){let n=t.usageMetadata;typeof n.promptTokenCount==`number`&&e.setAttributes({[bv]:n.promptTokenCount}),typeof n.candidatesTokenCount==`number`&&e.setAttributes({[xv]:n.candidatesTokenCount}),typeof n.totalTokenCount==`number`&&e.setAttributes({[Sv]:n.totalTokenCount})}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let n=t.candidates.map(e=>e.content?.parts&&Array.isArray(e.content.parts)?e.content.parts.map(e=>typeof e.text==`string`?e.text:``).filter(e=>e.length>0).join(``):``).filter(e=>e.length>0);n.length>0&&e.setAttributes({[Ov]:n.join(``)})}if(n&&t.functionCalls){let n=t.functionCalls;Array.isArray(n)&&n.length>0&&e.setAttributes({[jv]:JSON.stringify(n)})}}}function Qx(e,t,n,r,i){let a=n.operation===`embeddings`;return new Proxy(e,{apply(e,o,s){let c=n.operation||`unknown`,l=s[0],u=Yx(c,l,r),d=u[`gen_ai.request.model`]??`unknown`;return n.streaming?pf({name:`${c} ${d}`,op:`gen_ai.${c}`,attributes:u},async n=>{try{return i.recordInputs&&l&&Xx(n,l,a,My(i.enableTruncation)),Ux(await e.apply(r,s),n,!!i.recordOutputs)}catch(e){throw n.setStatus({code:2,message:`internal_error`}),J(e,{mechanism:{handled:!1,type:`auto.ai.google_genai`,data:{function:t}}}),n.end(),e}}):ff({name:`${c} ${d}`,op:`gen_ai.${c}`,attributes:u},n=>(i.recordInputs&&l&&Xx(n,l,a,My(i.enableTruncation)),sf(()=>e.apply(r,s),e=>{J(e,{mechanism:{handled:!1,type:`auto.ai.google_genai`,data:{function:t}}})},()=>{},e=>{a||Zx(n,e,i.recordOutputs)})))}})}function $x(e,t=``,n){return new Proxy(e,{get:(e,r,i)=>{let a=Reflect.get(e,r,i),o=Ny(t,String(r)),s=Ix[o];if(typeof a==`function`&&s){let t=s.operation?Qx(a,o,s,e,n):a.bind(e);return s.proxyResultPath?function(...e){let r=t(...e);return r&&typeof r==`object`?$x(r,s.proxyResultPath,n):r}:t}return typeof a==`function`?a.bind(e):a&&typeof a==`object`?$x(a,o,n):a}})}function eS(e,t){return $x(e,``,jy(t))}var tS=n((()=>{Tp(),Rl(),Bl(),Of(),lf(),Jv(),Vy(),Rx(),Wx(),Kx()})),nS,rS,iS,aS=n((()=>{nS=`LangChain`,rS=`auto.ai.langchain`,iS={human:`user`,ai:`assistant`,assistant:`assistant`,system:`system`,function:`function`,tool:`tool`}}));function oS(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function sS(e){if(Array.isArray(e))try{let t=e.map(e=>e&&typeof e==`object`&&Yv(e)?ly(e):e);return JSON.stringify(t)}catch{return String(e)}return oS(e)}function cS(e){let t=e.toLowerCase();return iS[t]??t}function lS(e){return e.includes(`System`)?`system`:e.includes(`Human`)?`user`:e.includes(`AI`)||e.includes(`Assistant`)?`assistant`:e.includes(`Function`)?`function`:e.includes(`Tool`)?`tool`:`user`}function uS(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function dS(e){return e.map(e=>{let t=e._getType;if(typeof t==`function`)return{role:cS(t.call(e)),content:sS(e.content)};if(e.lc===1&&e.kwargs){let t=e.id,n=Array.isArray(t)&&t.length>0?t[t.length-1]:``;return{role:cS(typeof n==`string`?lS(n):`user`),content:sS(e.kwargs?.content)}}if(e.type)return{role:cS(String(e.type).toLowerCase()),content:sS(e.content)};if(e.role)return{role:cS(String(e.role)),content:sS(e.content)};let n=e.constructor?.name;return n&&n!==`Object`?{role:cS(lS(n)),content:sS(e.content)}:{role:`user`,content:sS(e.content)}})}function fS(e,t,n){let r={},i=`kwargs`in e?e.kwargs:void 0;bS(r,cv,t?.temperature??n?.ls_temperature??i?.temperature),bS(r,lv,t?.max_tokens??n?.ls_max_tokens??i?.max_tokens),bS(r,fv,t?.top_p??i?.top_p);let a=t?.frequency_penalty;bS(r,uv,a);let o=t?.presence_penalty;return bS(r,dv,o),t&&`stream`in t&&yS(r,sv,!!t.stream),r}function pS(e,t,n,r,i){return{[av]:oS(e??`langchain`),[Cv]:`chat`,[ov]:oS(t),[K]:rS,...fS(n,r,i)}}function mS(e,t,n,r,i,a){let o=a?.ls_provider,s=pS(o,i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){yS(s,wv,t.length);let e=t.map(e=>({role:`user`,content:e}));yS(s,Tv,r?Ly(e):Iy(e))}return s}function hS(e,t,n,r,i,a){let o=pS(a?.ls_provider??e.id?.[2],i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){let{systemInstructions:e,filteredMessages:n}=Ry(dS(t.flat()));e&&yS(o,Dv,e),yS(o,wv,Array.isArray(n)?n.length:0),yS(o,Tv,r?Ly(n):Iy(n))}return o}function gS(e,t){let n=[],r=e.flat();for(let e of r){let t=e.message?.content;if(Array.isArray(t))for(let e of t){let t=e;t.type===`tool_use`&&n.push(t)}}n.length>0&&yS(t,jv,oS(n))}function _S(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)bS(t,bv,n.promptTokens),bS(t,xv,n.completionTokens),bS(t,Sv,n.totalTokens);else if(r){bS(t,bv,r.input_tokens),bS(t,xv,r.output_tokens);let e=Number(r.input_tokens),n=Number(r.output_tokens),i=(Number.isNaN(e)?0:e)+(Number.isNaN(n)?0:n);i>0&&bS(t,Sv,i),r.cache_creation_input_tokens!==void 0&&bS(t,Fv,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&bS(t,Iv,r.cache_read_input_tokens)}}function vS(e,t){if(!e)return;let n={};if(Array.isArray(e.generations)){let r=e.generations.flat().map(e=>e.generationInfo?.finish_reason?e.generationInfo.finish_reason:e.generation_info?.finish_reason?e.generation_info.finish_reason:null).filter(e=>typeof e==`string`);if(r.length>0&&yS(n,gv,oS(r)),gS(e.generations,n),t){let t=e.generations.flat().map(e=>e.text??e.message?.content).filter(e=>typeof e==`string`);t.length>0&&yS(n,Ov,oS(t))}}_S(e.llmOutput,n);let r=e.llmOutput,i=e.generations?.[0]?.[0]?.message,a=r?.model_name??r?.model??i?.response_metadata?.model_name;a&&yS(n,_v,a);let o=r?.id??i?.id;o&&yS(n,vv,o);let s=r?.stop_reason??i?.response_metadata?.finish_reason;return s&&yS(n,yv,oS(s)),n}var yS,bS,xS=n((()=>{Rl(),Jv(),fy(),Vy(),aS(),yS=(e,t,n)=>{n!=null&&(e[t]=n)},bS=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)}}));function SS(e={}){let{recordInputs:t,recordOutputs:n}=jy(e),r=My(e.enableTruncation),i=new Map,a=e=>{let t=i.get(e);t?.isRecording()&&(t.end(),i.delete(e))},o={lc_serializable:!1,lc_namespace:[`langchain_core`,`callbacks`,`sentry`],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:[`langchain_core`,`callbacks`,`sentry`],lc_kwargs:{},name:`SentryCallbackHandler`,ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(e,n,a,o,s,c,l,u){let d=mS(e,n,t,r,uS(c),l),f=d[ov],p=d[Cv];pf({name:`${p} ${f}`,op:`gen_ai.chat`,attributes:{...d,[G]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleChatModelStart(e,n,a,o,s,c,l,u){let d=hS(e,n,t,r,uS(c),l),f=d[ov],p=d[Cv];pf({name:`${p} ${f}`,op:`gen_ai.chat`,attributes:{...d,[G]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleLLMEnd(e,t,r,o,s){let c=i.get(t);if(c?.isRecording()){let r=vS(e,n);r&&c.setAttributes(r),a(t)}},handleLLMError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t)),J(e,{mechanism:{handled:!1,type:`${rS}.llm_error_handler`}})},handleChainStart(e,n,r,a,o,s,c,l){let u=l||e.name||`unknown_chain`,d={[K]:`auto.ai.langchain`,"langchain.chain.name":u};t&&(d[`langchain.chain.inputs`]=JSON.stringify(n)),pf({name:`chain ${u}`,op:`gen_ai.invoke_agent`,attributes:{...d,[G]:`gen_ai.invoke_agent`}},e=>(i.set(r,e),e))},handleChainEnd(e,t){let r=i.get(t);r?.isRecording()&&(n&&r.setAttributes({"langchain.chain.outputs":JSON.stringify(e)}),a(t))},handleChainError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t)),J(e,{mechanism:{handled:!1,type:`${rS}.chain_error_handler`}})},handleToolStart(e,n,r,a){let o=e.name||`unknown_tool`,s={[K]:rS,[Hv]:o};t&&(s[Gv]=n),pf({name:`execute_tool ${o}`,op:`gen_ai.execute_tool`,attributes:{...s,[G]:`gen_ai.execute_tool`}},e=>(i.set(r,e),e))},handleToolEnd(e,t){let r=i.get(t);r?.isRecording()&&(n&&r.setAttributes({[Kv]:JSON.stringify(e)}),a(t))},handleToolError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t)),J(e,{mechanism:{handled:!1,type:`${rS}.tool_error_handler`}})},copy(){return o},toJSON(){return{lc:1,type:`not_implemented`,id:o.lc_id}},toJSONNotImplemented(){return{lc:1,type:`not_implemented`,id:o.lc_id}}};return o}var CS=n((()=>{Tp(),Rl(),Bl(),Of(),Jv(),Vy(),aS(),xS()})),wS,TS,ES=n((()=>{wS=`LangGraph`,TS=`auto.ai.langgraph`}));function DS(e){if(!e||e.length===0)return null;let t=[];for(let n of e)if(n&&typeof n==`object`){let e=n.tool_calls;e&&Array.isArray(e)&&t.push(...e)}return t.length>0?t:null}function OS(e){let t=e,n=0,r=0,i=0;if(t.usage_metadata&&typeof t.usage_metadata==`object`){let e=t.usage_metadata;return typeof e.input_tokens==`number`&&(n=e.input_tokens),typeof e.output_tokens==`number`&&(r=e.output_tokens),typeof e.total_tokens==`number`&&(i=e.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:i}}if(t.response_metadata&&typeof t.response_metadata==`object`){let e=t.response_metadata;if(e.tokenUsage&&typeof e.tokenUsage==`object`){let t=e.tokenUsage;typeof t.promptTokens==`number`&&(n=t.promptTokens),typeof t.completionTokens==`number`&&(r=t.completionTokens),typeof t.totalTokens==`number`&&(i=t.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:i}}function kS(e,t){let n=t;if(n.response_metadata&&typeof n.response_metadata==`object`){let t=n.response_metadata;t.model_name&&typeof t.model_name==`string`&&e.setAttribute(_v,t.model_name),t.finish_reason&&typeof t.finish_reason==`string`&&e.setAttribute(gv,[t.finish_reason])}}function AS(e){if(!e.builder?.nodes?.tools?.runnable?.tools)return null;let t=e.builder?.nodes?.tools?.runnable?.tools;return!t||!Array.isArray(t)||t.length===0?null:t.map(e=>({name:e.lc_kwargs?.name,description:e.lc_kwargs?.description,schema:e.lc_kwargs?.schema}))}function jS(e,t,n){let r=n?.messages;if(!r||!Array.isArray(r))return;let i=t?.length??0,a=r.length>i?r.slice(i):[];if(a.length===0)return;let o=DS(a);o&&e.setAttribute(jv,JSON.stringify(o));let s=dS(a);e.setAttribute(Ov,JSON.stringify(s));let c=0,l=0,u=0;for(let t of a){let n=OS(t);c+=n.inputTokens,l+=n.outputTokens,u+=n.totalTokens,kS(e,t)}c>0&&e.setAttribute(bv,c),l>0&&e.setAttribute(xv,l),u>0&&e.setAttribute(Sv,u)}var MS=n((()=>{Jv(),xS()}));function NS(e,t){return new Proxy(e,{apply(e,n,r){return ff({op:`gen_ai.create_agent`,name:`create_agent`,attributes:{[K]:TS,[G]:`gen_ai.create_agent`,[Cv]:`create_agent`}},i=>{try{let a=Reflect.apply(e,n,r),o=r.length>0?r[0]:{};o?.name&&typeof o.name==`string`&&(i.setAttribute(Mv,o.name),i.updateName(`create_agent ${o.name}`));let s=a.invoke;return s&&typeof s==`function`&&(a.invoke=PS(s.bind(a),a,o,t)),a}catch(e){throw i.setStatus({code:2,message:`internal_error`}),J(e,{mechanism:{handled:!1,type:`auto.ai.langgraph.error`}}),e}})}})}function PS(e,t,n,r){return new Proxy(e,{apply(e,i,a){return ff({op:`gen_ai.invoke_agent`,name:`invoke_agent`,attributes:{[K]:TS,[G]:zv,[Cv]:`invoke_agent`}},async o=>{try{let s=n?.name;s&&typeof s==`string`&&(o.setAttribute(Nv,s),o.setAttribute(Mv,s),o.updateName(`invoke_agent ${s}`));let c=(a.length>1?a[1]:void 0)?.configurable?.thread_id;c&&typeof c==`string`&&o.setAttribute(Pv,c);let l=AS(t);l&&o.setAttribute(kv,JSON.stringify(l));let u=r.recordInputs,d=r.recordOutputs,f=a.length>0?a[0]?.messages??[]:[];if(f&&u){let{systemInstructions:e,filteredMessages:t}=Ry(dS(f));e&&o.setAttribute(Dv,e);let n=My(r.enableTruncation),i=Array.isArray(t)?t.length:0;o.setAttributes({[Tv]:n?Ly(t):Iy(t),[wv]:i})}let p=await Reflect.apply(e,i,a);return d&&jS(o,f??null,p),p}catch(e){throw o.setStatus({code:2,message:`internal_error`}),J(e,{mechanism:{handled:!1,type:`auto.ai.langgraph.error`}}),e}})}})}function FS(e,t){return e.compile=NS(e.compile,jy(t)),e}var IS=n((()=>{Tp(),Rl(),Bl(),Of(),Jv(),Vy(),xS(),ES(),MS()}));function LS(e,t,n){let r=n.getDsn(),i=n.getOptions().tunnel,a=Ld(n.getOptions()._metadata);return Ed({sent_at:new Date().toISOString(),...RS(t)&&{trace:t},...a&&{sdk:a},...!!i&&r&&{dsn:ru(r)}},[[{type:`span`,item_count:e.length,content_type:`application/vnd.sentry.items.span.v2+json`},{items:e}]])}function RS(e){return!!e.trace_id&&!!e.public_key}var zS=n((()=>{fu(),Bd()}));function BS(e){let t=156;if(t+=e.name.length*2,t+=nl(e.attributes),e.links&&e.links.length>0){let n=e.links[0]?.attributes,r=100+(n?nl(n):0);t+=r*e.links.length}return t}var VS=n((()=>{al()})),HS,US,WS,GS=n((()=>{z(),H(),tm(),fd(),zS(),VS(),HS=1e3,US=5e6,WS=class{constructor(e,t){this._traceBuckets=new Map,this._client=e;let{maxSpanLimit:n,flushInterval:r,maxTraceWeightInBytes:i}=t??{};this._maxSpanLimit=n&&n>0&&n<=HS?n:HS,this._flushInterval=r&&r>0?r:5e3,this._maxTraceWeight=i&&i>0?i:US,this._client.on(`flush`,()=>{this.drain()}),this._client.on(`close`,()=>{this._traceBuckets.forEach(e=>{clearTimeout(e.timeout)}),this._traceBuckets.clear()})}add(e){let t=e.trace_id,n=this._traceBuckets.get(t);n||(n={spans:new Set,size:0,timeout:em(setTimeout(()=>{this.flush(t)},this._flushInterval))},this._traceBuckets.set(t,n)),n.spans.add(e),n.size+=BS(e),(n.spans.size>=this._maxSpanLimit||n.size>=this._maxTraceWeight)&&this.flush(t)}drain(){this._traceBuckets.size&&(R&&V.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((e,t)=>{this.flush(t)}))}flush(e){let t=this._traceBuckets.get(e);if(!t)return;if(!t.spans.size){this._removeTrace(e);return}let n=Array.from(t.spans),r=n[0]?._segmentSpan;if(!r){R&&V.warn(`No segment span reference found on span JSON, cannot compute DSC`),this._removeTrace(e);return}let i=ud(r),a=n.map(e=>{let{_segmentSpan:t,...n}=e;return n}),o=LS(a,i,this._client);R&&V.log(`Sending span envelope for trace ${e} with ${a.length} spans`),this._client.sendEnvelope(o).then(null,e=>{R&&V.error(`Error while sending streamed span envelope:`,e)}),this._removeTrace(e)}_removeTrace(e){let t=this._traceBuckets.get(e);t&&clearTimeout(t.timeout),this._traceBuckets.delete(e)}}})),KS,qS=n((()=>{z(),Lp(),gd(),Uf(),Qd(),GS(),H(),Ju(),KS=Y(()=>({name:`SpanStreaming`,setup(e){let t=`SpanStreaming integration requires`,n=`Falling back to static trace lifecycle.`,r=e.getOptions();if(!Zd(e)){r.traceLifecycle=`static`,R&&V.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!hd(i)){r.traceLifecycle=`static`,R&&V.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let a=new WS(e);e.on(`afterSpanEnd`,t=>{Iu(t)&&a.add(zf(t,e))})}}))}));function JS(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}var YS=n((()=>{}));function XS(e,t,n){let r=e[t];if(typeof r==`function`){try{e[t]=n}catch{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=n}catch{Object.defineProperty(e,`default`,{value:n,writable:!0,configurable:!0,enumerable:!0})}}}var ZS=n((()=>{}));function QS(e,t=!1){return!(t||e&&!e.startsWith(`/`)&&!e.match(/^[A-Z]:/)&&!e.startsWith(`.`)&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes(`node_modules/`)}function $S(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let a=i.match(r);if(a)return{filename:`<data:${a[2]}>`,function:a[1]};let o=i.match(n);if(o){let t,n,r,i,a;if(o[1]){r=o[1];let e=r.lastIndexOf(`.`);if(r[e-1]===`.`&&e--,e>0){t=r.slice(0,e),n=r.slice(e+1);let i=t.indexOf(`.Module`);i>0&&(r=r.slice(i+1),t=t.slice(0,i))}i=void 0}n&&(i=t,a=n),n===`<anonymous>`&&(a=void 0,r=void 0),r===void 0&&(a=a||`?`,r=i?`${i}.${a}`:a);let s=Wo(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?nC(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:tC(o[3]),colno:tC(o[4]),in_app:QS(s||``,c)}}if(i.match(t))return{filename:i}}}function eC(e){return[90,$S(e)]}function tC(e){return parseInt(e||``,10)||void 0}function nC(e){try{return decodeURI(e)}catch{return}}var rC=n((()=>{Yo()})),iC,aC=n((()=>{iC=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let t=this._cache.get(e);if(t!==void 0)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){if(this._cache.size>=this._maxSize){let e=this._cache.keys().next().value;this._cache.delete(e)}this._cache.set(e,t)}remove(e){let t=this._cache.get(e);return t&&this._cache.delete(e),t}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(t=>e.push(t)),e}}}));function oC(e){let t=e.constructor?.name??``;return t.includes(`OpenAI`)?`openai`:t.includes(`Google`)?`google_genai`:t.includes(`Mistral`)?`mistralai`:t.includes(`Vertex`)?`google_vertexai`:t.includes(`Bedrock`)?`aws_bedrock`:t.includes(`Ollama`)?`ollama`:t.includes(`Cloudflare`)?`cloudflare`:t.includes(`Cohere`)?`cohere`:`langchain`}function sC(e){let t=e??{},n={[K]:rS,[G]:Vv,[Cv]:`embeddings`,[ov]:t.model??`unknown`};return n[av]=oC(t),`dimensions`in t&&(n[hv]=t.dimensions),`encodingFormat`in t&&(n[mv]=t.encodingFormat),n}function cC(e,t={}){let{recordInputs:n}=jy(t);return new Proxy(e,{apply(e,t,r){let i=sC(t),a=i[`gen_ai.request.model`]||`unknown`;if(n){let e=r[0];e!=null&&(i[Bv]=typeof e==`string`?e:JSON.stringify(e))}return ff({name:`embeddings ${a}`,op:Vv,attributes:i},()=>Reflect.apply(e,t,r).then(void 0,e=>{throw J(e,{mechanism:{handled:!1,type:`auto.ai.langchain`}}),e}))}})}function lC(e,t){let n=e;return typeof n.embedQuery==`function`&&(n.embedQuery=cC(n.embedQuery,t)),typeof n.embedDocuments==`function`&&(n.embedDocuments=cC(n.embedDocuments,t)),e}var uC=n((()=>{Tp(),Rl(),Of(),Jv(),Vy(),aS()})),X=n((()=>{Zu(),Jl(),ml(),z(),Rl(),H(),$u(),id(),jc(),Ju(),_c(),fd(),md(),of(),Bl(),Of(),Xd(),df(),Jd(),Uf(),Gd(),Tp(),Lc(),Qc(),To(),Sc(),Pc(),$f(),Ap(),Bm(),ah(),fm(),Bd(),um(),tm(),fu(),Lp(),uh(),mh(),Rf(),_p(),Um(),gd(),Th(),lf(),mu(),Dh(),jh(),Ph(),Ih(),Ul(),qh(),od(),Xh(),ng(),gg(),Og(),yo(),Hg(),Gg(),dc(),qg(),Zs(),O_(),Yo(),Ts(),Td(),Bs(),M_(),J_(),$_(),rv(),tu(),Kp(),$p(),Ib(),wb(),Wy(),ax(),Vb(),Px(),cx(),tS(),Rx(),CS(),aS(),IS(),ES(),GS(),Qd(),qS(),Sg(),YS(),As(),ts(),as(),ls(),im(),ZS(),rC(),Xf(),Su(),mm(),nh(),aC(),Dc(),xo(),ap(),Gs(),uC()}));function Z(e,t,n){return n?fC(e,t,n):dC(e,t)}function dC(e,t){return Object.assign(n=>{let r=hC[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return hC[e]=i,Ni({instrumentations:[i]}),i},{id:e})}function fC(e,t,n){return Object.assign(r=>{let i=n(r),a=hC[e];if(a)return a.setConfig(i),a;let o=new t(i);return hC[e]=o,Ni({instrumentations:[o]}),o},{id:e})}function pC(e){let t=!1,n=[];if(!mC(e))t=!0;else{let r=e._wrap;e._wrap=(...e)=>(t=!0,n.forEach(e=>e()),n=[],r(...e))}return e=>{t?e():n.push(e)}}function mC(e){return typeof e._wrap==`function`}var hC,gC=n((()=>{L(),hC={}})),Q,_C=n((()=>{Q=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__})),vC,yC,bC=n((()=>{vC=`@sentry/instrumentation-http`,yC=1024*1024}));function xC(e,t,n,r){let i=0,a=[];Q&&V.log(r,`Patching request.on`);let o=new WeakMap,s=n===`small`?1e3:n===`medium`?1e4:yC;try{e.on=new Proxy(e.on,{apply:(e,t,n)=>{let[c,l,...u]=n;if(c===`data`){Q&&V.log(r,`Handling request.on("data") with maximum body size of ${s}b`);let n=new Proxy(l,{apply:(e,t,n)=>{try{let e=n[0],t=Buffer.from(e);i<s?(a.push(t),i+=t.byteLength):Q&&V.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Q&&V.error(r,`Encountered error while storing body chunk.`)}return Reflect.apply(e,t,n)}});return o.set(l,n),Reflect.apply(e,t,[c,n,...u])}return Reflect.apply(e,t,n)}}),e.off=new Proxy(e.off,{apply:(e,t,n)=>{let[,r]=n,i=o.get(r);if(i){o.delete(r);let a=n.slice();return a[1]=i,Reflect.apply(e,t,a)}return Reflect.apply(e,t,n)}}),e.on(`end`,()=>{try{let e=Buffer.concat(a).toString(`utf-8`);if(e){let n=Buffer.byteLength(e,`utf-8`)>s?`${Buffer.from(e).subarray(0,s-3).toString(`utf-8`)}...`:e;t.setSDKProcessingMetadata({normalizedRequest:{data:n}})}}catch(e){Q&&V.error(r,`Error building captured request body`,e)}})}catch(e){Q&&V.error(r,`Error patching request to capture body`,e)}}var SC=n((()=>{X(),_C(),bC()}));function CC(e,t){Ms(e,`_startSpanCallback`,new WeakRef(t))}function wC(e,{ignoreRequestBody:t,maxRequestBodySize:n,sessions:r,sessionFlushingDelayMS:i}){let a=e.emit;if(kC.has(a))return;let o=new Proxy(a,{apply(e,a,o){if(o[0]!==`request`)return e.apply(a,o);let s=W();if(O.active().getValue(EC)||!s)return e.apply(a,o);Q&&V.log(DC,`Handling incoming request`);let c=cl().clone(),l=o[1],u=o[2],d=Rh(l),f=l.ip||l.socket?.remoteAddress,p=l.url||`/`;n!==`none`&&!t?.(p,l)&&xC(l,c,n,DC),c.setSDKProcessingMetadata({normalizedRequest:d,ipAddress:f});let m=`${(l.method||`GET`).toUpperCase()} ${xh(p)}`;return c.setTransactionName(m),r&&s&&TC(s,{requestIsolationScope:c,response:u,sessionFlushingDelayMS:i??6e4}),dl(c,()=>{let t={traceId:Tc(),sampleRand:Hs(),propagationSpanId:Ec()};U().setPropagationContext({...t}),c.setPropagationContext({...t});let n=C.extract(O.active(),d.headers).setValue(EC,!0);return O.with(n,()=>{s.emit(`httpServerRequest`,l,u,d);let t=l._startSpanCallback?.deref();return t?t(()=>e.apply(a,o)):e.apply(a,o)})})}});kC.add(o),e.emit=o}function TC(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:`ok`}}),n.once(`close`,()=>{let n=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&n){Q&&V.log(`Recorded request session with status: ${n.status}`);let t=new Date;t.setSeconds(0,0);let i=t.toISOString(),a=OC.get(e),o=a?.[i]||{exited:0,crashed:0,errored:0};if(o[{ok:`exited`,crashed:`crashed`,errored:`errored`}[n.status]]++,a)a[i]=o;else{Q&&V.log(`Opened new request session aggregate.`);let t={[i]:o};OC.set(e,t);let n=()=>{clearTimeout(s),a(),OC.delete(e);let n=Object.entries(t).map(([e,t])=>({started:e,exited:t.exited,errored:t.errored,crashed:t.crashed}));e.sendSession({aggregates:n})},a=e.on(`flush`,()=>{Q&&V.log(`Sending request session aggregate due to client flush`),n()}),s=setTimeout(()=>{Q&&V.log(`Sending request session aggregate due to flushing schedule`),n()},r).unref()}}})}var EC,DC,OC,kC,AC,jC,MC=n((()=>{T(),X(),_C(),SC(),EC=ne(`sentry_http_server_instrumented`),DC=`Http.Server`,OC=new Map,kC=new WeakSet,AC=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody};return{name:DC,setupOnce(){St(`http.server.request.start`,(e=>{wC(e.server,t)}))},afterAllSetup(e){Q&&e.getIntegrationByName(`Http`)&&V.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}}),jC=AC}));function NC(e){return e.headers[`next-router-prefetch`]===`1`}function PC(e){let t=xh(e);return!!(t.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||t.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function FC(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(j(O.active()))return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&PC(r)||n?.(r,e))}function IC(e){let t=LC(e.headers);return t==null?{}:RC(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function LC(e){let t=e[`content-length`];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function RC(e){let t=e[`content-encoding`];return!!t&&t!==`identity`}function zC(e,t){let{socket:n}=e,{statusCode:r,statusMessage:i}=t,a={[me]:r,[Me]:r,"http.status_text":i?.toUpperCase()},o=je(O.active());if(n){let{localAddress:e,localPort:t,remoteAddress:r,remotePort:i}=n;a[Ve]=e,a[Ue]=t,a[ye]=r,a[`net.peer.port`]=i}return a[Me]=r,a[`http.status_text`]=(i||``).toUpperCase(),o?.type===Fe.HTTP&&o.route!==void 0&&(a[he]=o.route),a}function BC(e,t){return t.some(t=>{if(typeof t==`number`)return t===e;let[n,r]=t;return e>=n&&e<=r})}var VC,HC,UC,WC=n((()=>{T(),be(),F(),X(),_C(),MC(),VC=`Http.ServerSpans`,HC=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,r=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:i}=e,{requestHook:a,responseHook:o,applyCustomAttributesOnSpan:s}=e.instrumentation??{};return{name:VC,setup(e){typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__||e.on(`httpServerRequest`,(r,c,l)=>{let u=r,d=c;CC(u,r=>{if(FC(u,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return Q&&V.log(VC,`Skipping span creation for incoming request`,u.url),r();let c=l.url||u.url||`/`,f=gh(c),p=u.headers,m=p[`user-agent`],h=p[`x-forwarded-for`],g=u.httpVersion,_=p.host,v=_?.replace(/^(.*)(:[0-9]{1,5})/,`$1`)||`localhost`,y=e.tracer,b=c.startsWith(`https`)?`https`:`http`,x=l.method||u.method?.toUpperCase()||`GET`,S=f?f.pathname:xh(c),C=`${x} ${S}`,T=y.startSpan(C,{kind:w.SERVER,attributes:{[G]:`http.server`,[K]:`auto.http.otel.http`,"sentry.http.prefetch":NC(u)||void 0,"http.url":c,"http.method":l.method,"http.target":f?`${f.pathname}${f.search}`:S,"http.host":_,"net.host.name":v,"http.client_ip":typeof h==`string`?h.split(`,`)[0]:void 0,"http.user_agent":m,"http.scheme":b,"http.flavor":g,"net.transport":g?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...IC(u),...Bh(l.headers||{},e.getOptions().sendDefaultPii??!1)}});a?.(T,u),o?.(T,d),s?.(T,u,d),i?.(T,u,d);let E={type:Fe.HTTP,span:T};return O.with(Te(D.setSpan(O.active(),T),E),()=>{O.bind(O.active(),u),O.bind(O.active(),d);let e=!1;function t(t){if(e)return;e=!0;let n=zC(u,d);T.setAttributes(n),T.setStatus(t),T.end();let r=n[`http.route`];r&&cl().setTransactionName(`${u.method?.toUpperCase()||`GET`} ${r}`)}return d.on(`close`,()=>{t(zl(d.statusCode))}),d.on(gt,()=>{let e=zl(d.statusCode);t(e.code===2?e:{code:2})}),r()})})})},processEvent(e){if(e.type===`transaction`){let t=e.contexts?.trace?.data?.[`http.response.status_code`];if(typeof t==`number`&&BC(t,r))return Q&&V.log(`Dropping transaction due to status code`,t),null}return e},afterAllSetup(e){Q&&(e.getIntegrationByName(`Http`)&&V.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),e.getIntegrationByName(`Http.Server`)||V.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}}),UC=HC}));function GC(e,t){if(!e)return t;let n=Zl(e),r=Zl(t);if(!r)return e;let i={},a={};for(let[e,t]of Object.entries(r))e.startsWith(`sentry-`)?i[e]=t:a[e]=t;let o=Object.keys(i).length>0,s={};if(n)for(let[e,t]of Object.entries(n))o&&e.startsWith(`sentry-`)||(s[e]=t);Object.assign(s,i);for(let[e,t]of Object.entries(a))s[e]||(s[e]=t);return $l(s)}var KC=n((()=>{X()}));function qC(e,t){let n=YC(e),r=t?.statusCode,i=JS(r);Jh({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function JC(e,t){let n=ZC(e),{tracePropagationTargets:r,propagateTraceparent:i}=W()?.getOptions()||{},a=Mh(n,r,t)?Oh({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(!e.getHeader(`sentry-trace`)){if(o)try{e.setHeader(`sentry-trace`,o),Q&&V.log(QC,`Added sentry-trace header to outgoing request`)}catch(e){Q&&V.error(QC,`Failed to add sentry-trace header to outgoing request:`,us(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Q&&V.log(QC,`Added traceparent header to outgoing request`)}catch(e){Q&&V.error(QC,`Failed to add traceparent header to outgoing request:`,us(e)?e.message:`Unknown error`)}if(s){let t=GC(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Q&&V.log(QC,`Added baggage header to outgoing request`)}catch(e){Q&&V.error(QC,`Failed to add baggage header to outgoing request:`,us(e)?e.message:`Unknown error`)}}}}function YC(e){try{let t=e.getHeader(`host`)||e.host,n=bh(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Sh(n),"http.method":e.method||`GET`};return n.search&&(r[`http.query`]=n.search),n.hash&&(r[`http.fragment`]=n.hash),r}catch{return{}}}function XC(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function ZC(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}var QC,$C=n((()=>{X(),_C(),KC(),QC=`@sentry/instrumentation-http`}));function ew(e){let t=ZC(e),[n,r]=yh(gh(t),`client`,`auto.http.otel.http`,e),i=e.getHeader(`user-agent`);return[n,{[G]:`http.client`,"otel.kind":`CLIENT`,[Re]:i,[Ne]:t,"http.url":t,"http.method":e.method,"http.target":e.path||`/`,"net.peer.name":e.host,"http.host":e.getHeader(`host`),...r}]}function tw(e){let{statusCode:t,statusMessage:n,httpVersion:r,socket:i}=e,a=r.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,o={[me]:t,[Le]:r,"http.flavor":r,[oe]:a,"net.transport":a,"http.status_text":n?.toUpperCase(),"http.status_code":t,...nw(e)};if(i){let{remoteAddress:e,remotePort:t}=i;o[ae]=e,o[se]=t,o[`net.peer.ip`]=e,o[`net.peer.port`]=t}return o}function nw(e){let t=rw(e.headers);return t==null?{}:iw(e.headers)?{[xe]:t}:{[Ce]:t}}function rw(e){let t=e[`content-length`];if(typeof t==`number`)return t;if(typeof t!=`string`)return;let n=parseInt(t,10);if(!isNaN(n))return n}function iw(e){let t=e[`content-encoding`];return!!t&&t!==`identity`}var aw,ow=n((()=>{T(),be(),L(),F(),X(),_C(),bC(),$C(),aw=class extends Za{constructor(e={}){super(vC,bo,e),this._propagationDecisionMap=new iC(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,t=(e=>{let t=e;this._onOutgoingRequestFinish(t.request,t.response)}),n=(e=>{let t=e;this._onOutgoingRequestFinish(t.request,void 0)}),r=(e=>{let t=e;this._onOutgoingRequestCreated(t.request)}),i=i=>e?i:(e=!0,St(`http.client.response.finish`,t),St(`http.client.request.error`,n),(this.getConfig().propagateTraceInOutgoingRequests||this.getConfig().createSpansForOutgoingRequests)&&St(`http.client.request.created`,r),i),a=()=>{Ct(`http.client.response.finish`,t),Ct(`http.client.request.error`,n),Ct(`http.client.request.created`,r)};return[new no(`http`,[`*`],i,a),new no(`https`,[`*`],i,a)]}_startSpanForOutgoingRequest(e){let t=e.once,[n,r]=ew(e),i=mf({name:n,attributes:r,onlyIfParent:!0});this.getConfig().outgoingRequestHook?.(i,e),e.once=new Proxy(t,{apply(e,t,n){let[r]=n;if(r!==`response`)return e.apply(t,n);let a=O.active(),o=D.setSpan(a,i);return O.with(o,()=>e.apply(t,n))}});let a=!1,o=e=>{a||(a=!0,i.setStatus(e),i.end())};return e.prependListener(`response`,t=>{e.listenerCount(`response`)<=1&&t.resume(),O.bind(O.active(),t);let n=tw(t);i.setAttributes(n),this.getConfig().outgoingResponseHook?.(i,t),this.getConfig().outgoingRequestApplyCustomAttributes?.(i,e,t);let r=(e=!1)=>{this._diag.debug(`outgoingRequest on end()`),o(e||typeof t.statusCode!=`number`||t.aborted&&!t.complete?{code:b.ERROR}:zl(t.statusCode))};t.on(`end`,()=>{r()}),t.on(gt,e=>{this._diag.debug(`outgoingRequest on response error()`,e),r(!0)})}),e.on(`close`,()=>{o({code:b.UNSET})}),e.on(gt,e=>{this._diag.debug(`outgoingRequest on request error()`,e),o({code:b.ERROR})}),i}_onOutgoingRequestFinish(e,t){Q&&V.log(`@sentry/instrumentation-http`,`Handling finished outgoing request`);let n=this.getConfig().breadcrumbs,r=n===void 0?!0:n,i=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,i),r&&!i&&qC(e,t)}_onOutgoingRequestCreated(e){Q&&V.log(`@sentry/instrumentation-http`,`Handling outgoing request created`);let t=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,t),t)return;let n=this.getConfig().createSpansForOutgoingRequests&&(this.getConfig().spans??!0),r=this.getConfig().propagateTraceInOutgoingRequests;if(n){let t=this._startSpanForOutgoingRequest(e);if(r&&t.isRecording()){let n=D.setSpan(O.active(),t);O.with(n,()=>{JC(e,this._propagationDecisionMap)})}else r&&JC(e,this._propagationDecisionMap)}else r&&JC(e,this._propagationDecisionMap)}_shouldIgnoreOutgoingRequest(e){if(j(O.active()))return!0;let t=this.getConfig().ignoreOutgoingRequests;if(!t)return!1;let n=XC(e);return t(ZC(e),n)}}})),sw,cw,lw,uw=n((()=>{X(),gC(),MC(),WC(),ow(),sw=`Http`,cw=Z(`${sw}.sentry`,e=>new aw(e)),lw=Y((e={})=>{let t={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},n={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},r={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},i=jC(t),a=UC(n),o=e.spans??!1,s=e.disableIncomingRequestSpans??!1,c=o&&!s;return{name:sw,setup(e){c&&a.setup(e)},setupOnce(){i.setupOnce(),cw(r)},processEvent(e){return a.processEvent(e)}}})})),dw,fw,pw,mw=n((()=>{X(),dw=oc(process.versions.node),fw=dw.major,pw=dw.minor}));function hw(e,t){let n=Sw(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=W()?.getOptions()||{},a=Mh(n,r,t)?Oh({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a,l=Array.isArray(e.headers)?e.headers:gw(e.headers);if(vw(l,Cw),vw(l,ww),i&&vw(l,Tw),yw(l,Cw)===-1){o&&l.push(Cw,o),c&&yw(l,`traceparent`)===-1&&l.push(`traceparent`,c);let e=yw(l,ww);if(s&&e===-1)l.push(ww,s);else if(s){let t=l[e+1],n=GC(t,s);n&&(l[e+1]=n)}}Array.isArray(e.headers)||(e.headers=_w(l))}function gw(e){let t=e.split(`\r
|
|
5
|
+
`),n=[];for(let e of t)try{let t=e.indexOf(`:`);if(t===-1)continue;let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&n.push(r,i)}catch{V.warn(`Failed to convert string request header to array header: ${e}`)}return n}function _w(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];!r||i==null||t.push(`${r}: ${i}`)}return t.length?t.join(`\r
|
|
6
|
+
`).concat(`\r
|
|
7
|
+
`):``}function vw(e,t){let n=-1;for(let r=0;r<e.length;r+=2){if(e[r]!==t)continue;if(n===-1){n=r;continue}let i=e[n+1];if(t===ww&&i){let t=GC(e[r+1],i);t&&(e[n+1]=t)}e.splice(r,2),r-=2}}function yw(e,t){return e.findIndex((e,n)=>n%2==0&&e===t)}function bw(e,t){let n=xw(e),r=t.statusCode,i=JS(r);Jh({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function xw(e){try{let t=bh(Sw(e.origin,e.path)),n={url:Sh(t),"http.method":e.method||`GET`};return t.search&&(n[`http.query`]=t.search),t.hash&&(n[`http.fragment`]=t.hash),n}catch{return{}}}function Sw(e,t=`/`){try{return new URL(t,e).toString()}catch{let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}}var Cw,ww,Tw,Ew=n((()=>{X(),KC(),Cw=`sentry-trace`,ww=`baggage`,Tw=`traceparent`})),Dw,Ow=n((()=>{T(),be(),L(),X(),mw(),Ew(),Dw=class extends Za{constructor(e={}){super(`@sentry/instrumentation-node-fetch`,bo,e),this._channelSubs=[],this._propagationDecisionMap=new iC(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs=[]}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this._subscribeToChannel(`undici:request:create`,this._onRequestCreated.bind(this)),this._subscribeToChannel(`undici:request:headers`,this._onResponseHeaders.bind(this)))}_onRequestCreated({request:e}){let t=this.getConfig();if(t.enabled===!1)return;let n=this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,n),!n&&t.tracePropagation!==!1&&hw(e,this._propagationDecisionMap)}_onResponseHeaders({request:e,response:t}){let n=this.getConfig();if(n.enabled===!1)return;let r=n.breadcrumbs,i=r===void 0?!0:r,a=this._ignoreOutgoingRequestsMap.get(e);i&&!a&&bw(e,t)}_subscribeToChannel(e,t){let n=fw>18||fw===18&&pw>=19,r;if(n)kt.subscribe?.(e,t),r=()=>kt.unsubscribe?.(e,t);else{let n=kt.channel(e);n.subscribe(t),r=()=>n.unsubscribe(t)}this._channelSubs.push({name:e,unsubscribe:r})}_shouldIgnoreOutgoingRequest(e){if(j(O.active()))return!0;let t=Sw(e.origin,e.path),n=this.getConfig().ignoreOutgoingRequests;return typeof n!=`function`||!t?!1:n(t)}}})),kw,Aw,jw,Mw=n((()=>{X(),gC(),Ow(),kw=Z(`NodeFetch.sentry`,Dw,e=>e),Aw=((e={})=>({name:`NodeFetch`,setupOnce(){kw(e)}})),jw=Y(Aw)}));function Nw(e){if(`parentSpanId`in e)return e.parentSpanId;if(`parentSpanContext`in e)return e.parentSpanContext?.spanId}function Pw(e){let t=e;return!!t.attributes&&typeof t.attributes==`object`}function Fw(e){return typeof e.kind==`number`}function Iw(e){return!!e.status}function Lw(e){return!!e.name}function Rw(e){if(!Pw(e))return{};let t=e.attributes[`url.full`]||e.attributes[`http.url`],n={url:t,"http.method":e.attributes[`http.request.method`]||e.attributes[`http.method`]};!n[`http.method`]&&n.url&&(n[`http.method`]=`GET`);try{if(typeof t==`string`){let e=bh(t);n.url=Sh(e),e.search&&(n[`http.query`]=e.search),e.hash&&(n[`http.fragment`]=e.hash)}}catch{}return n}function zw(e){return Fw(e)?e.kind:w.INTERNAL}function Bw(e){return e.getValue(oE)}function Vw(e,t){return e.setValue(oE,t)}function Hw(e,t){Ms(e,uE,Vl(t))}function Uw(e){return Hl(e[uE])}function Ww(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(eE)===`1`:!1;if(t===S.SAMPLED)return!0;if(r)return!1;let i=n?n.get($T):void 0,a=i?Yl(i):void 0;if(a?.sampled===`true`)return!0;if(a?.sampled===`false`)return!1}function Gw(e,t,n){let r=t[`http.request.method`]||t[`http.method`];if(r)return Jw({attributes:t,name:e,kind:n},r);let i=t[`db.system.name`]||t[`db.system`],a=typeof t[`sentry.op`]==`string`&&t[`sentry.op`].startsWith(`cache.`);if(i&&!a)return qw({attributes:t,name:e});let o=t[`sentry.source`]===`custom`?`custom`:`route`;if(t[`rpc.service`])return{...Zw(e,t,`route`),op:`rpc`};if(t[`messaging.system`])return{...Zw(e,t,o),op:`message`};let s=t[Ae];return s?{...Zw(e,t,o),op:s.toString()}:{op:void 0,description:e,source:`custom`}}function Kw(e){let t=Pw(e)?e.attributes:{};return Gw(Lw(e)?e.name:`<unknown>`,t,zw(e))}function qw({attributes:e,name:t}){let n=e[kl];if(typeof n==`string`)return{op:`db`,description:n,source:e[`sentry.source`]||`custom`};if(e[`sentry.source`]===`custom`)return{op:`db`,description:t,source:`custom`};let r=e[ze];return{op:`db`,description:r?r.toString():t,source:`task`}}function Jw({name:e,kind:t,attributes:n},r){let i=[`http`];switch(t){case w.CLIENT:i.push(`client`);break;case w.SERVER:i.push(`server`);break}n[`sentry.http.prefetch`]&&i.push(`prefetch`);let{urlPath:a,url:o,query:s,fragment:c,hasRoute:l}=Xw(n,t);if(!a)return{...Zw(e,n),op:i.join(`.`)};let u=n[XT],d=`${r} ${a}`,f=u?`${d} (${Yw(u)})`:d,p=l||a===`/`?`route`:`url`,m={};o&&(m.url=o),s&&(m[`http.query`]=s),c&&(m[`http.fragment`]=c);let h=t===w.CLIENT||t===w.SERVER,g=!`${n[`sentry.origin`]||`manual`}`.startsWith(`auto`),_=n[hl]===`custom`,v=n[kl],{description:y,source:b}=!_&&v==null&&(h||!g)?{description:f,source:p}:Zw(e,n);return{op:i.join(`.`),description:y,source:b,data:m}}function Yw(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(`, `):`${t.slice(0,5).join(`, `)}, +${t.length-5}`}return`${e}`}function Xw(e,t){let n=e[Ee],r=e[`http.url`]||e[`url.full`],i=e[he],a=typeof r==`string`?bh(r):void 0,o=a?Sh(a):void 0,s=a?.search||void 0,c=a?.hash||void 0;return typeof i==`string`?{urlPath:i,url:o,query:s,fragment:c,hasRoute:!0}:t===w.SERVER&&typeof n==`string`?{urlPath:xh(n),url:o,query:s,fragment:c,hasRoute:!1}:a?{urlPath:o,url:o,query:s,fragment:c,hasRoute:!1}:typeof n==`string`?{urlPath:xh(n),url:o,query:s,fragment:c,hasRoute:!1}:{urlPath:void 0,url:o,query:s,fragment:c,hasRoute:!1}}function Zw(e,t,n=`custom`){let r=t[`sentry.source`]||n,i=t[kl];return i&&typeof i==`string`?{description:i,source:r}:{description:e,source:r}}function Qw(e){e.on(`createDsc`,(e,t)=>{if(!t)return;let n=q(t).data[hl],{description:r}=Lw(t)?Kw(t):{description:void 0};if(n!==`url`&&r&&(e.transaction=r),Qu()){let n=Ww(t.spanContext());e.sampled=n==null?void 0:String(n)}})}function $w(){return D.getActiveSpan()}function eT({dsc:e,sampled:t}){let n=e?Xl(e):void 0,r=new we,i=n?r.set($T,n):r;return t===!1?i.set(eE,`1`):i}function tT(){return Array.from(fE)}function nT(e){fE.add(e)}function rT(e,t={}){let n=D.getSpan(e);if(n?.spanContext().isRemote){let e=n.spanContext();return{dynamicSamplingContext:ud(n),traceId:e.traceId,spanId:void 0,sampled:Ww(e)}}if(n){let e=n.spanContext();return{dynamicSamplingContext:ud(n),traceId:e.traceId,spanId:e.spanId,sampled:Ww(e)}}let r=t.scope||Bw(e)?.scope||U(),i=t.client||W(),a=r.getPropagationContext();return{dynamicSamplingContext:i?ld(i,r):void 0,traceId:a.traceId,spanId:a.propagationSpanId,sampled:a.sampled}}function iT(e,{sentryTrace:t,baggage:n}){let{traceId:r,parentSpanId:i,sampled:a,dsc:o}=gu(t,n),s=W(),c=Yl(n);if(!i||s&&!bu(s,c?.org_id))return e;let l=uT({traceId:r,spanId:i,sampled:a,dsc:o});return D.setSpanContext(e,l)}function aT(e,t,n){let r=oT(iT(e,t));return O.with(r,n)}function oT(e){let t=Bw(e);return Vw(e,{scope:t?t.scope:U().clone(),isolationScope:t?t.isolationScope:cl()})}function sT(e){try{let t=e[QT];return Array.isArray(t)?t.join(`,`):t}catch{return}}function cT(e){try{return e[ZT]}catch{return}}function lT(e){let t=q(e).data,n=t[`http.url`]||t[`url.full`];if(typeof n==`string`)return n;let r=e.spanContext().traceState?.get(tE);if(r)return r}function uT({spanId:e,traceId:t,sampled:n,dsc:r}){let i=eT({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?S.SAMPLED:S.NONE,traceState:i}}function dT(e,t,n){let r=gT(),{name:i,parentSpan:a}=e;return TT(a)(()=>{let a=bT(e.scope,e.forceTransaction),o=e.onlyIfParent&&!D.getSpan(a)?Oe(a):a,s=_T(e);if(!Qu()){let e=j(o)?o:Oe(o);return O.with(e,()=>r.startActiveSpan(i,s,e,e=>(yT(e),O.with(a,()=>sf(()=>t(e),()=>{q(e).status===void 0&&e.setStatus({code:b.ERROR})},n?()=>e.end():void 0)))))}return r.startActiveSpan(i,s,o,e=>(yT(e),sf(()=>t(e),()=>{q(e).status===void 0&&e.setStatus({code:b.ERROR})},n?()=>e.end():void 0)))})}function fT(e,t){return dT(e,t,!0)}function pT(e,t){return dT(e,e=>t(e,()=>e.end()),!1)}function mT(e){let t=gT(),{name:n,parentSpan:r}=e;return TT(r)(()=>{let r=bT(e.scope,e.forceTransaction),i=e.onlyIfParent&&!D.getSpan(r)?Oe(r):r,a=_T(e);Qu()||(i=j(i)?i:Oe(i));let o=t.startSpan(n,a,i);return yT(o),o})}function hT(e,t){let n=e?D.setSpan(O.active(),e):D.deleteSpan(O.active());return O.with(n,()=>t(U()))}function gT(){return W()?.tracer||D.getTracer(`@sentry/opentelemetry`,`10.49.0`)}function _T(e){let{startTime:t,attributes:n,kind:r,op:i,links:a}=e,o=typeof t==`number`?vT(t):t;return{attributes:i?{[G]:i,...n}:n,kind:r,links:a,startTime:o}}function vT(e){return e<9999999999?e*1e3:e}function yT(e){let t=e.end.bind(e);e.end=e=>t(typeof e==`number`?vT(e):e)}function bT(e,t){let n=xT(e),r=D.getSpan(n);if(!r||!t)return n;let i=D.deleteSpan(n),{spanId:a,traceId:o}=r.spanContext(),s=Ww(r.spanContext()),c=eT({dsc:ud(qu(r)),sampled:s}),l={traceId:o,spanId:a,isRemote:!0,traceFlags:s?S.SAMPLED:S.NONE,traceState:c};return D.setSpanContext(i,l)}function xT(e){if(e){let t=Uw(e);if(t)return t}return O.active()}function ST(e,t){return aT(O.active(),e,t)}function CT(e){let t=Tc(),n={traceId:t,spanId:Ec(),isRemote:!0,traceFlags:S.NONE},r=D.setSpanContext(O.active(),n);return O.with(r,()=>(U().setPropagationContext({traceId:t,sampleRand:Hs()}),e()))}function wT(e,t){let n=Uw(t),r=n&&D.getSpan(n),i=r?wu(r):fl(t);return[r?ud(r):ld(e,t),i]}function TT(e){return e===void 0?e=>e():t=>hT(e,t)}function ET(e){let t=Oe(O.active());return O.with(t,e)}function DT(e){e.on(`preprocessEvent`,e=>{let t=$w();if(!(!t||e.type===`transaction`))return e.contexts={trace:wu(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ud(qu(t)),...e.sdkProcessingMetadata},e})}function OT({span:e,scope:t,client:n,propagateTraceparent:r}={}){let i=(t&&Uw(t))??O.active();if(e){let{scope:t}=Gl(e);i=t&&Uw(t)||D.setSpan(O.active(),e)}let{traceId:a,spanId:o,sampled:s,dynamicSamplingContext:c}=rT(i,{scope:t,client:n}),l={"sentry-trace":_u(a,o,s),baggage:Xl(c)};return r&&(l.traceparent=vu(a,o,s)),l}function kT(){function e(){return Bw(O.active())||{scope:Fc(),isolationScope:Ic()}}function t(e){let t=O.active();return O.with(t,()=>e(a()))}function n(e,t){let n=Uw(e)||O.active();return O.with(n.setValue(cE,e),()=>t(e))}function r(e){let t=O.active();return O.with(t.setValue(sE,!0),()=>e(o()))}function i(e,t){let n=O.active();return O.with(n.setValue(lE,e),()=>t(o()))}function a(){return e().scope}function o(){return e().isolationScope}Xc({withScope:t,withSetScope:n,withSetIsolationScope:i,withIsolationScope:r,getCurrentScope:a,getIsolationScope:o,startSpan:fT,startSpanManual:pT,startInactiveSpan:mT,getActiveSpan:$w,suppressTracing:ET,getTraceData:OT,continueTrace:ST,startNewTrace:CT,withActiveSpan:hT})}function AT(e,t){let n=D.getSpan(e),r;if(n?.spanContext().traceState?.get(iE)===`1`){let n=D.deleteSpan(e),i=D.getSpan(t);r=i?D.setSpan(n,i):n}else r=e;let i=Bw(r),a=i?.scope||U(),o=i?.isolationScope||cl(),s=r.getValue(sE)===!0,c=r.getValue(cE),l=r.getValue(lE),u=c||a.clone(),d={scope:u,isolationScope:l||(s?o.clone():o)},f=Vw(r,d).deleteValue(sE).deleteValue(cE).deleteValue(lE);return Hw(u,f),f}function jT(e){let t=new Map;for(let n of e)NT(t,n);return Array.from(t,function([e,t]){return t})}function MT(e){return e.attributes[YT]===!0?void 0:Nw(e)}function NT(e,t){let n=t.spanContext().spanId,r=MT(t);if(!r){FT(e,{id:n,span:t,children:[]});return}let i=PT(e,r),a=FT(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(a)}function PT(e,t){return e.get(t)||FT(e,{id:t,children:[]})}function FT(e,t){let n=e.get(t.id);return n?.span?n:n&&!n.span?(n.span=t.span,n.parentNode=t.parentNode,n):(e.set(t.id,t),t)}function IT(e){let t=Pw(e)?e.attributes:{},n=Iw(e)?e.status:void 0;if(n){if(n.code===b.OK)return{code:1};if(n.code===b.ERROR){if(n.message===void 0){let e=LT(t);if(e)return e}return n.message&&_E(n.message)?{code:2,message:n.message}:{code:2,message:`internal_error`}}}return LT(t)||(n?.code===b.UNSET?{code:1}:{code:2,message:`unknown_error`})}function LT(e){let t=e[`http.response.status_code`]||e[`http.status_code`],n=e[He],r=typeof t==`number`?t:typeof t==`string`?parseInt(t):void 0;if(typeof r==`number`)return zl(r);if(typeof n==`string`)return{code:2,message:gE[n]||`unknown_error`}}function RT(e){let t=e.attributes;return{origin:t[K],op:t[G],source:t[hl]}}function zT(e){let{op:t,description:n,data:r,origin:i=`manual`,source:a}=VT(e),o=Gl(e),s=e.attributes[gl],c={[hl]:a,[gl]:s,[G]:t,[K]:i,...r,...HT(e.attributes)},{links:l}=e,{traceId:u,spanId:d}=e.spanContext(),f={parent_span_id:Nw(e),span_id:d,trace_id:u,data:c,origin:i,op:t,status:Lu(IT(e)),links:Du(l)},p=c[me],m=typeof p==`number`?{response:{status_code:p}}:void 0;return{contexts:{trace:f,otel:{resource:e.resource.attributes},...m},spans:[],start_timestamp:ku(e.startTime),timestamp:ku(e.endTime),transaction:n,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:o.scope,capturedSpanIsolationScope:o.isolationScope,sampleRate:s,dynamicSamplingContext:ud(e)},...a&&{transaction_info:{source:a}}}}function BT(e,t,n){let r=e.span;if(r&&n.add(r),!r){e.children.forEach(e=>{BT(e,t,n)});return}let i=r.spanContext().spanId,a=r.spanContext().traceId,o=Nw(r),{attributes:s,startTime:c,endTime:l,links:u}=r,{op:d,description:f,data:p,origin:m=`manual`}=VT(r),h={[K]:m,[G]:d,...HT(s),...p},g=IT(r),_={span_id:i,trace_id:a,data:h,description:f,parent_span_id:o,start_timestamp:ku(c),timestamp:ku(l)||void 0,status:Lu(g),op:d,origin:m,measurements:Yd(r.events),links:Du(u)};t.push(_),e.children.forEach(e=>{BT(e,t,n)})}function VT(e){let{op:t,source:n,origin:r}=RT(e),{op:i,description:a,source:o,data:s}=Kw(e);return{op:t||i,description:a,source:n||o,origin:r,data:{...s,...UT(e)}}}function HT(e){let t={...e};return delete t[gl],delete t[YT],delete t[kl],t}function UT(e){let t=e.attributes,n={};e.kind!==w.INTERNAL&&(n[`otel.kind`]=w[e.kind]);let r=t[Me];r&&(n[me]=r);let i=Rw(e);return i.url&&(n.url=i.url),i[`http.query`]&&(n[`http.query`]=i[`http.query`].slice(1)),i[`http.fragment`]&&(n[`http.fragment`]=i[`http.fragment`].slice(1)),n}function WT(e,t,n){let r=e.spanContext();if(x(r)&&r.traceId===t){if(r.isRemote){let t=Ww(e.spanContext());return dE&&V.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${t}`),t}let t=Ww(r);return dE&&V.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${t}`),t}}function GT({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:a,ignoredSegmentSpan:o}){let s=KT(t,n);return i!==void 0&&(s=s.set(rE,`${i}`)),r!==void 0&&(s=s.set(nE,`${r}`)),a&&(s=s.set(iE,`1`)),o&&(s=s.set(aE,`1`)),e==null?{decision:Ge.NOT_RECORD,traceState:s}:e===Ge.NOT_RECORD?{decision:e,traceState:s.set(eE,`1`)}:{decision:e,traceState:s}}function KT(e,t){let n=D.getSpan(e)?.spanContext()?.traceState||new we,r=t[`http.url`]||t[`url.full`];return r&&typeof r==`string`&&(n=n.set(tE,r)),n}function qT(e){let t=D.getSpan(e);return t&&x(t.spanContext())?t:void 0}function JT(e){return new CE({[ve]:e,[Pe]:`sentry`,[fe]:bo,[re]:ke[re],[Se]:ke[Se],[Be]:ke[Be]})}var YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE=n((()=>{F(),X(),T(),be(),Ke(),YT=`sentry.parentIsRemote`,XT=`sentry.graphql.operation`,ZT=`sentry-trace`,QT=`baggage`,$T=`sentry.dsc`,eE=`sentry.sampled_not_recording`,tE=`sentry.url`,nE=`sentry.sample_rand`,rE=`sentry.sample_rate`,iE=`sentry.ignored`,aE=`sentry.segment_ignored`,oE=ne(`sentry_scopes`),sE=ne(`sentry_fork_isolation_scope`),cE=ne(`sentry_fork_set_scope`),lE=ne(`sentry_fork_set_isolation_scope`),uE=`_scopeContext`,dE=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,fE=new Set,pE=class extends de{constructor(){super(),nT(`SentryPropagator`),this._urlMatchesTargetsMap=new iC(100)}inject(e,t,n){if(j(e)){dE&&V.log(`[Tracing] Not injecting trace data for url because tracing is suppressed.`);return}let r=D.getSpan(e),i=r&&lT(r),{tracePropagationTargets:a,propagateTraceparent:o}=W()?.getOptions()||{};if(!Mh(i,a,this._urlMatchesTargetsMap)){dE&&V.log(`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`,i);return}let s=sT(t),c=cT(t),l=C.getBaggage(e)||C.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:f,sampled:p}=rT(e);if(s){let e=Zl(s);e&&Object.entries(e).forEach(([e,t])=>{!c&&e.startsWith(`sentry-`)||(l=l.setEntry(e,{value:t}))})}!c&&u&&(l=Object.entries(u).reduce((e,[t,n])=>n?e.setEntry(`${eu}${t}`,{value:n}):e,l)),!c&&d&&d!==`00000000000000000000000000000000`&&(n.set(t,ZT,_u(d,f,p)),o&&n.set(t,`traceparent`,vu(d,f,p))),super.inject(C.setBaggage(e,l),t,n)}extract(e,t,n){let r=n.get(t,ZT),i=n.get(t,QT);return oT(iT(e,{sentryTrace:r?Array.isArray(r)?r[0]:r:void 0,baggage:i}))}fields(){return[ZT,QT,`traceparent`]}},mE=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`],hE=class e{__init(){this._asyncLocalStorage=new Xe}__init2(){this._kOtListeners=Symbol(`OtListeners`)}__init3(){this._wrapped=!1}constructor(){e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),nT(`SentryContextManager`)}active(){return this._asyncLocalStorage.getStore()??ee}with(e,t,n,...r){let i=AT(e,this.active()),a=n==null?t:t.bind(n);return this._asyncLocalStorage.run(i,a,...r)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(e,t){return t instanceof ht?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:oE}}_bindFunction(e,t){let n=this.with.bind(this),r=function(...r){return n(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindEventEmitter(e,t){if(this._getPatchMap(t)!==void 0)return t;this._createPatchMap(t);for(let n of mE)t[n]!==void 0&&(t[n]=this._patchAddListener(t,t[n],e));return 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}_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):r!==void 0&&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]}},gE={1:`cancelled`,2:`unknown_error`,3:`invalid_argument`,4:`deadline_exceeded`,5:`not_found`,6:`already_exists`,7:`permission_denied`,8:`resource_exhausted`,9:`failed_precondition`,10:`aborted`,11:`out_of_range`,12:`unimplemented`,13:`internal_error`,14:`unavailable`,15:`data_loss`,16:`unauthenticated`},_E=e=>Object.values(gE).includes(e),vE=1e3,yE=300,bE=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||yE,this._finishedSpanBuckets=Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Us()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=Fh(this.flush.bind(this),1,{maxWait:100})}export(e){let t=Math.floor(Us()/1e3);if(this._lastCleanupTimestampInS!==t){let e=0;this._finishedSpanBuckets.forEach((n,r)=>{n&&n.timestampInS<=t-this._finishedSpanBucketSize&&(e+=n.spans.size,this._finishedSpanBuckets[r]=void 0)}),e>0&&dE&&V.log(`SpanExporter dropped ${e} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=t}let n=t%this._finishedSpanBucketSize,r=this._finishedSpanBuckets[n]||{timestampInS:t,spans:new Set};this._finishedSpanBuckets[n]=r,r.spans.add(e),this._spansToBucketEntry.set(e,r);let i=MT(e);(!i||this._sentSpans.has(i))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(e=>e?Array.from(e.spans):[]);this._flushSentSpanCache();let t=this._maybeSend(e),n=t.size,r=e.length-n;dE&&V.log(`SpanExporter exported ${n} spans, ${r} spans are waiting for their parent spans to finish`);let i=Us()+yE*1e3;for(let e of t){this._sentSpans.set(e.spanContext().spanId,i);let t=this._spansToBucketEntry.get(e);t&&t.spans.delete(e)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let t=jT(e),n=new Set,r=this._getCompletedRootNodes(t);for(let e of r){let t=e.span;n.add(t);let r=zT(t);if(e.parentNode&&this._sentSpans.has(e.parentNode.id)){let e=r.contexts?.trace?.data;e&&(e[`sentry.parent_span_already_sent`]=!0)}let i=r.spans||[];for(let t of e.children)BT(t,i,n);r.spans=i.length>vE?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,vE):i;let a=Yd(t.events);a&&(r.measurements=a),vp(r)}return n}_flushSentSpanCache(){let e=Us();for(let[t,n]of this._sentSpans.entries())n<=e&&this._sentSpans.delete(t)}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||this._sentSpans.has(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(e=>this._nodeIsCompletedRootNodeOrHasSentParent(e))}},xE=class{constructor(e){nT(`SentrySpanProcessor`),this._exporter=new bE(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,t){let n=D.getSpan(t),r=Bw(t);n&&!n.spanContext().isRemote&&zu(n,e),n?.spanContext().isRemote&&e.setAttribute(YT,!0),t===ee&&(r={scope:Fc(),isolationScope:Ic()}),r&&Wl(e,r.scope,r.isolationScope),Kd(e),W()?.emit(`spanStart`,e)}onEnd(e){qd(e);let t=W();t?.emit(`spanEnd`,e),t&&Zd(t)?t.emit(`afterSpanEnd`,e):this._exporter.export(e)}},SE=class{constructor(e){this._client=e,this._isSpanStreaming=Zd(e),nT(`SentrySampler`)}shouldSample(e,t,n,r,i,a){let o=this._client.getOptions(),{ignoreSpans:s}=o,c=qT(e),l=c?.spanContext();if(!Qu(o))return GT({decision:void 0,context:e,spanAttributes:i});let u=i[`http.method`]||i[`http.request.method`];if(r===w.CLIENT&&u&&(!c||l?.isRemote))return GT({decision:void 0,context:e,spanAttributes:i});let d=c?WT(c,t,n):void 0;if(!(!c||l?.isRemote)){if(this._isSpanStreaming){if(d&&s?.length){let{description:t,op:a}=Gw(n,i,r);if(td({description:t,op:i[`sentry.op`]??a},s))return this._client.recordDroppedEvent(`ignored`,`span`),GT({decision:Ge.NOT_RECORD,context:e,spanAttributes:i,ignoredChildSpan:!0})}if(!d){let e=l?.traceState?.get(aE)===`1`;this._client.recordDroppedEvent(e?`ignored`:`sample_rate`,`span`)}}return GT({decision:d?Ge.RECORD_AND_SAMPLED:Ge.NOT_RECORD,context:e,spanAttributes:i})}let{description:f,data:p,op:m}=Gw(n,i,r),h={...p,...i};if(m&&(h[G]=m),this._isSpanStreaming&&s?.length&&td({description:f,op:h[`sentry.op`]??m},s))return this._client.recordDroppedEvent(`ignored`,`span`),GT({decision:Ge.NOT_RECORD,context:e,spanAttributes:i,ignoredSegmentSpan:!0});let g={decision:!0};if(this._client.emit(`beforeSampling`,{spanAttributes:h,spanName:f,parentSampled:d,parentContext:l},g),!g.decision)return GT({decision:void 0,context:e,spanAttributes:i});let{isolationScope:_}=Bw(e)??{},v=l?.traceState?l.traceState.get($T):void 0,y=v?Yl(v):void 0,b=pu(y?.sample_rand)??Hs(),[x,S,C]=uf(o,{name:f,attributes:h,normalizedRequest:_?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:pu(y?.sample_rate)},b),T=`${u}`.toUpperCase();return T===`OPTIONS`||T===`HEAD`?(dE&&V.log(`[Tracing] Not sampling span because HTTP method is '${T}' for ${n}`),GT({decision:Ge.NOT_RECORD,context:e,spanAttributes:i,sampleRand:b,downstreamTraceSampleRate:0})):(!x&&d===void 0&&(dE&&V.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),this._client.recordDroppedEvent(`sample_rate`,this._isSpanStreaming?`span`:`transaction`)),{...GT({decision:x?Ge.RECORD_AND_SAMPLED:Ge.NOT_RECORD,context:e,spanAttributes:i,sampleRand:b,downstreamTraceSampleRate:C?S:void 0}),attributes:{[gl]:C?S:void 0}})}toString(){return`SentrySampler`}},CE=class e{constructor(e){this._attributes=e}get attributes(){return this._attributes}merge(t){return t?new e({...this._attributes,...t.attributes}):this}getRawAttributes(){return Object.entries(this._attributes)}}})),TE,EE=n((()=>{wE(),TE=hE}));function DE(){E.disable(),E.setLogger({error:V.error,warn:V.warn,info:V.log,debug:V.log,verbose:V.log},te.DEBUG)}var OE=n((()=>{T(),X()}));function kE(e,t){let n=!1,r;e.on(`spawn`,()=>{if(e.spawnfile===`/usr/bin/sw_vers`){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on(`exit`,e=>{n||(n=!0,e!==null&&e!==0&&Jh({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Jh({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function AE(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Jh({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):J(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}var jE,ME,NE=n((()=>{X(),jE=`ChildProcess`,ME=Y((e={})=>({name:jE,setup(){xt.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&kE(t.process,e)}),xt.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&AE(t.worker,e)})}}))}));function PE(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory==`function`){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=dt.freemem()),e}async function FE(){let e=dt.platform();switch(e){case`darwin`:return BE();case`linux`:return HE();default:return{name:YE[e]||e,version:dt.release()}}}function IE(){try{if(typeof process.versions.icu!=`string`)return;let e=new Date(9e8);if(new Intl.DateTimeFormat(`es`,{month:`long`}).format(e)===`enero`){let e=Intl.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone}}}catch{}}function LE(){let e=process.memoryUsage().rss,t={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory==`function`){let e=process.availableMemory?.();e!=null&&(t.free_memory=e)}return t}function RE(e){let t={},n;try{n=dt.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=dt.arch(),(e===!0||e.memory)&&(t.memory_size=dt.totalmem(),t.free_memory=dt.freemem()),e===!0||e.cpu){let e=dt.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}function zE(e,t){let n=e.exec(t);return n?n[1]:void 0}async function BE(){let e={kernel_version:dt.release(),name:`Mac OS X`,version:`10.${Number(dt.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{at(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=zE(/^ProductName:\s+(.*)$/m,t),e.version=zE(/^ProductVersion:\s+(.*)$/m,t),e.build=zE(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function VE(e){return e.split(` `)[0].toLowerCase()}async function HE(){let e={kernel_version:dt.release(),name:`Linux`};try{let t=await GE(`/etc`),n=XE.find(e=>t.includes(e.name));if(!n)return e;let r=(await WE(tt(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(VE(e))>=0)||i[0],e.version=ZE[VE(e.name)]?.(r)}catch{}return e}function UE(){if(process.env.VERCEL)return{"cloud.provider":`vercel`,"cloud.region":process.env.VERCEL_REGION};if(process.env.AWS_REGION)return{"cloud.provider":`aws`,"cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV};if(process.env.GCP_PROJECT)return{"cloud.provider":`gcp`};if(process.env.ALIYUN_REGION_ID)return{"cloud.provider":`alibaba_cloud`,"cloud.region":process.env.ALIYUN_REGION_ID};if(process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME)return{"cloud.provider":`azure`,"cloud.region":process.env.REGION_NAME};if(process.env.IBM_CLOUD_REGION)return{"cloud.provider":`ibm_cloud`,"cloud.region":process.env.IBM_CLOUD_REGION};if(process.env.TENCENTCLOUD_REGION)return{"cloud.provider":`tencent_cloud`,"cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE};if(process.env.NETLIFY)return{"cloud.provider":`netlify`};if(process.env.FLY_REGION)return{"cloud.provider":`fly.io`,"cloud.region":process.env.FLY_REGION};if(process.env.DYNO)return{"cloud.provider":`heroku`}}var WE,GE,KE,qE,JE,YE,XE,ZE,QE=n((()=>{X(),WE=Qe(ct),GE=Qe(ut),KE=`Context`,qE=((e={})=>{let t,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e};async function r(e){t===void 0&&(t=i());let n=PE(await t);return e.contexts={...e.contexts,app:{...n.app,...e.contexts?.app},os:{...n.os,...e.contexts?.os},device:{...n.device,...e.contexts?.device},culture:{...n.culture,...e.contexts?.culture},cloud_resource:{...n.cloud_resource,...e.contexts?.cloud_resource}},e}async function i(){let e={};if(n.os&&(e.os=await FE()),n.app&&(e.app=LE()),n.device&&(e.device=RE(n.device)),n.culture){let t=IE();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=UE()),e}return{name:KE,processEvent(e){return r(e)}}}),JE=Y(qE),YE={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},XE=[{name:`fedora-release`,distros:[`Fedora`]},{name:`redhat-release`,distros:[`Red Hat Linux`,`Centos`]},{name:`redhat_version`,distros:[`Red Hat Linux`]},{name:`SuSE-release`,distros:[`SUSE Linux`]},{name:`lsb-release`,distros:[`Ubuntu Linux`,`Arch Linux`]},{name:`debian_version`,distros:[`Debian`]},{name:`debian_release`,distros:[`Debian`]},{name:`arch-release`,distros:[`Arch Linux`]},{name:`gentoo-release`,distros:[`Gentoo Linux`]},{name:`novell-release`,distros:[`SUSE Linux`]},{name:`alpine-release`,distros:[`Alpine Linux`]}],ZE={alpine:e=>e,arch:e=>zE(/distrib_release=(.*)/,e),centos:e=>zE(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>zE(/release (..)/,e),mint:e=>zE(/distrib_release=(.*)/,e),red:e=>zE(/release ([^ ]+)/,e),suse:e=>zE(/VERSION = (.*)\n/,e),ubuntu:e=>zE(/distrib_release=(.*)/,e)}}));function $E(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function eD(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function tD(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function nD(e,t){let n=fD.get(e);if(n===void 0)return!1;for(let e=t[0];e<=t[1];e++)if(n[e]===void 0)return!1;return!0}function rD(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=dD(r,t),a=[];for(;;){if(n===e.length-1){a.push(i);break}let r=e[n+1];if(typeof r!=`number`)break;r<=i[1]?i[1]=r+t:(a.push(i),i=dD(r,t)),n++}return a}function iD(e,t,n){return new Promise((r,i)=>{let a=ot(e),o=$e({input:a});function s(){a.destroy(),r()}let c=0,l=0,u=t[l];if(u===void 0){s();return}let d=u[0],f=u[1];function p(t){pD.set(e,1),Q&&V.error(`Failed to read file: ${e}. Error: ${t}`),o.close(),o.removeAllListeners(),s()}a.on(`error`,p),o.on(`error`,p),o.on(`close`,s),o.on(`line`,e=>{if(c++,!(c<d)&&(n[c]=qs(e,0),c>=f)){if(l===t.length-1){o.close(),o.removeAllListeners();return}l++;let e=t[l];if(e===void 0){o.close(),o.removeAllListeners();return}d=e[0],f=e[1]}})})}async function aD(e,t){let n={};if(t>0&&e.exception?.values){for(let t of e.exception.values)if(t.stacktrace?.frames?.length)for(let e=t.stacktrace.frames.length-1;e>=0;e--){let r=t.stacktrace.frames[e],i=r?.filename;!r||typeof i!=`string`||typeof r.lineno!=`number`||eD(i)||tD(r)||(n[i]||(n[i]=[]),n[i].push(r.lineno))}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let e of r){if(pD.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=rD(r,t);if(a.every(t=>nD(e,t)))continue;let o=$E(fD,e,{});i.push(iD(e,a,o))}if(await Promise.all(i).catch(()=>{Q&&V.log(`Failed to read one or more source files and resolve context lines`)}),t>0&&e.exception?.values)for(let n of e.exception.values)n.stacktrace?.frames&&n.stacktrace.frames.length>0&&oD(n.stacktrace.frames,t,fD);return e}function oD(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno==`number`){let e=n.get(r.filename);if(e===void 0)continue;cD(r.lineno,r,t,e)}}function sD(e){delete e.pre_context,delete e.context_line,delete e.post_context}function cD(e,t,n,r){if(t.lineno===void 0||r===void 0){Q&&V.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=lD(e,n);i<e;i++){let e=r[i];if(e===void 0){sD(t),Q&&V.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){sD(t),Q&&V.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=uD(e,n);t.post_context=[];for(let n=e+1;n<=i;n++){let e=r[n];if(e===void 0)break;t.post_context.push(e)}}function lD(e,t){return Math.max(1,e-t)}function uD(e,t){return e+t}function dD(e,t){return[lD(e,t),uD(e,t)]}var fD,pD,mD,hD,gD,_D,vD=n((()=>{X(),_C(),fD=new iC(10),pD=new iC(20),mD=7,hD=`ContextLines`,gD=((e={})=>{let t=e.frameContextLines===void 0?mD:e.frameContextLines;return{name:hD,processEvent(e){return aD(e,t)}}}),_D=Y(gD)}));async function yD(){if(bD===void 0)try{bD=!!(await import(`node:inspector`)).url()}catch{bD=!1}return bD}var bD,xD=n((()=>{}));function SD(e,t,n){let r=0,i=5,a=0;return setInterval(()=>{a===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),a=i):(--a,a===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function CD(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function wD(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||CD(e)&&CD(t)}var TD,ED=n((()=>{TD=`__SENTRY_ERROR_LOCAL_VARIABLES__`}));function DD(...e){V.log(`[LocalVariables]`,...e)}var OD,kD,AD=n((()=>{X(),xD(),ED(),OD=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ5LjAgKDc0NWFmNzkpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`,kD=Y(((e={})=>{function t(t,n){let r=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<r.length;t++){let i=r.length-t-1,a=n[t],o=r[i];if(!o||!a)break;a.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!wD(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&`__SENTRY_ERROR_LOCAL_VARIABLES__`in n.originalException&&Array.isArray(n.originalException.__SENTRY_ERROR_LOCAL_VARIABLES__)){for(let r of e.exception?.values||[])t(r,n.originalException[TD]);n.originalException[TD]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Et(new URL(`data:application/javascript;base64,${OD}`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{DD(`Worker error`,e)}),t.once(`exit`,e=>{DD(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await yD()){V.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:V.isEnabled()};r().then(()=>{try{i(n)}catch(e){V.error(`Failed to start worker`,e)}},e=>{V.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}))}));function jD(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function MD(e,t){if(t!==void 0)return jD(e(t,1))}function ND(e){let t=[],n=!1;function r(r){t=[],!n&&(n=!0,e(r))}t.push(r);function i(e){t.push(e)}function a(e){let n=t.pop()||r;try{n(e)}catch{r(e)}}return{add:i,next:a}}var PD,FD,ID,LD,RD=n((()=>{X(),mw(),xD(),ED(),PD=class e{constructor(e){this._session=e}static async create(t){return t||new e(new(await(import(`node:inspector`))).Session)}configureAndConnect(e,t){this._session.connect(),this._session.on(`Debugger.paused`,t=>{e(t,()=>{this._session.post(`Debugger.resume`)})}),this._session.post(`Debugger.enable`),this._session.post(`Debugger.setPauseOnExceptions`,{state:t?`all`:`uncaught`})}setPauseOnExceptions(e){this._session.post(`Debugger.setPauseOnExceptions`,{state:e?`all`:`uncaught`})}getLocalVariables(e,t){this._getProperties(e,e=>{let{add:n,next:r}=ND(t);for(let t of e)if(t.value?.objectId&&t.value.className===`Array`){let e=t.value.objectId;n(n=>this._unrollArray(e,t.name,n,r))}else if(t.value?.objectId&&t.value.className===`Object`){let e=t.value.objectId;n(n=>this._unrollObject(e,t.name,n,r))}else t.value&&n(e=>this._unrollOther(t,e,r));r({})})}_getProperties(e,t){this._session.post(`Runtime.getProperties`,{objectId:e,ownProperties:!0},(e,n)=>{t(e?[]:n.result)})}_unrollArray(e,t,n,r){this._getProperties(e,e=>{n[t]=e.filter(e=>e.name!==`length`&&!isNaN(parseInt(e.name,10))).sort((e,t)=>parseInt(e.name,10)-parseInt(t.name,10)).map(e=>e.value?.value),r(n)})}_unrollObject(e,t,n,r){this._getProperties(e,e=>{n[t]=e.map(e=>[e.name,e.value?.value]).reduce((e,[t,n])=>(e[t]=n,e),{}),r(n)})}_unrollOther(e,t,n){e.value&&(`value`in e.value?e.value.value===void 0||e.value.value===null?t[e.name]=`<${e.value.value}>`:t[e.name]=e.value.value:`description`in e.value&&e.value.type!==`function`?t[e.name]=`<${e.value.description}>`:e.value.type===`undefined`&&(t[e.name]=`<undefined>`)),n(t)}},FD=`LocalVariables`,ID=((e={},t)=>{let n=new iC(20),r,i=!1;function a(t){let r=jD(t.stacktrace?.frames);if(r===void 0)return;let i=n.remove(r);if(i===void 0)return;let a=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<a.length;t++){let n=a.length-t-1,r=i[t],o=a[n];if(!o||!r)break;r.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!wD(o.function,r.function)||(o.vars=r.vars)}}function o(e){for(let t of e.exception?.values||[])a(t);return e}let s;async function c(){let a=W()?.getOptions();if(a?.includeLocalVariables){if(fw<18){V.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await yD()){V.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await PD.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=MD(e,i.description);if(c==null){s();return}let{add:l,next:u}=ND(e=>{n.set(c,e),s()});for(let e=0;e<Math.min(a.length,5);e++){let{scopeChain:t,functionName:n,this:r}=a[e],i=t.find(e=>e.type===`local`),s=r.className===`global`||!r.className?n:`${r.className}.${n}`;if(i?.object.objectId===void 0)l(t=>{t[e]={function:s},u(t)});else{let t=i.object.objectId;l(n=>o.getLocalVariables(t,t=>{n[e]={function:s,vars:t},u(n)}))}}u([])},c=e.captureAllExceptions!==!1;o.configureAndConnect((e,t)=>s(a.stackParser,e,t),c),c&&(r=SD(e.maxExceptionsPerSecond||50,()=>{V.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{V.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){V.log("The `LocalVariables` integration failed to start.",e)}}}return{name:FD,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}}),LD=Y(ID)})),zD,BD=n((()=>{mw(),AD(),RD(),zD=(e={})=>dw.major<19?LD(e):kD(e)}));function VD(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}function HD(){return VD()?!1:fw>=21||fw===20&&pw>=6||fw===18&&pw>=19?!0:(UD||(UD=!0,Eo(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})),!1)}var UD,WD=n((()=>{X(),mw()}));function GD(){try{return t.cache?Object.keys(t.cache):[]}catch{return[]}}function KD(){return{...$D,...XD(),...VD()?qD():{}}}function qD(){let e=t.main?.paths||[],n=GD(),r={},i=new Set;return n.forEach(t=>{let n=t,a=()=>{let t=n;if(n=et(t),!n||t===n||i.has(t))return;if(e.indexOf(n)<0)return a();let o=tt(t,`package.json`);if(i.add(t),!st(o))return a();try{let e=JSON.parse(lt(o,`utf8`));r[e.name]=e.version}catch{}};a()}),r}function JD(){return ZD||(ZD=KD()),ZD}function YD(){try{let e=tt(process.cwd(),`package.json`);return JSON.parse(lt(e,`utf8`))}catch{return{}}}function XD(){let e=YD();return{...e.dependencies,...e.devDependencies}}var ZD,QD,$D,eO,tO,nO=n((()=>{WD(),QD=`Modules`,$D=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,eO=(()=>({name:QD,processEvent(e){return e.modules={...e.modules,...JD()},e},getModules:JD})),tO=eO}));function rO(e){Eo(()=>{console.error(e)});let t=W();if(t===void 0){Q&&V.warn(`No NodeClient was defined, we are exiting the process now.`),global.process.exit(1);return}let n=t.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:iO;t.close(r).then(e=>{e||Q&&V.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Q&&V.error(e)})}var iO,aO=n((()=>{X(),_C(),iO=2e3}));function oO(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=rO;t.onFatalError?c=t.onFatalError:o.onFatalError&&(c=o.onFatalError);let l=global.process.listeners(`uncaughtException`).filter(e=>e.name!==`domainUncaughtExceptionClear`&&e.tag!==`sentry_tracingErrorCallback`&&e._errorHandler!==!0).length===0,u=t.exitEvenIfOtherHandlersAreRegistered||l;n?u&&(i?(Q&&V.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),rO(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,W()===e&&J(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}var sO,cO,lO=n((()=>{X(),_C(),aO(),sO=`OnUncaughtException`,cO=Y((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:sO,setup(e){Dt&&global.process.on(`uncaughtException`,oO(e,t))}}})}));function uO(e){if(typeof e!=`object`||!e)return{name:``,message:String(e??``)};let t=e;return{name:typeof t.name==`string`?t.name:``,message:typeof t.message==`string`?t.message:String(e)}}function dO(e,t){let n=e.name===void 0||Ys(t.name,e.name,!0),r=e.message===void 0||Ys(t.message,e.message);return n&&r}function fO(e,t){let n=uO(t);return e.some(e=>dO(e,n))}function pO(e,t){return function(n,r){if(W()!==e||fO(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>hf(a,e):e=>e())(()=>{J(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),mO(n,t.mode)}}function mO(e,t){let n=`This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:`;t===`warn`?Eo(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(Eo(()=>{console.warn(n)}),rO(e))}var hO,gO,_O,vO,yO=n((()=>{X(),aO(),hO=`OnUnhandledRejection`,gO=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],_O=((e={})=>{let t={mode:e.mode??`warn`,ignore:[...gO,...e.ignore??[]]};return{name:hO,setup(e){global.process.on(`unhandledRejection`,pO(e,t))}}}),vO=Y(_O)})),bO,xO,SO=n((()=>{X(),bO=`ProcessSession`,xO=Y(()=>({name:bO,setupOnce(){Sp(),process.on(`beforeExit`,()=>{cl().getSession()?.status!==`ok`&&Cp()})}}))}));function CO(e,t){let n=wO(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){V.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=jd(e);gf(()=>{let e=yt.request({method:`POST`,path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":`application/x-sentry-envelope`}},e=>{e.statusCode&&e.statusCode>=200&&e.statusCode<400&&(r=0),e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`)});e.on(`error`,()=>{r++,V.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function wO(e){try{return new URL(`${e}`)}catch{V.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var TO,EO,DO,OO=n((()=>{X(),TO=`Spotlight`,EO=((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:TO,setup(e){try{V.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}CO(e,t)}}}),DO=Y(EO)}));function kO(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ze.getSystemErrorMap().has(e.errno)}var AO,jO,MO=n((()=>{X(),AO=`NodeSystemError`,jO=Y((e={})=>({name:AO,processEvent:(t,n,r)=>{if(!kO(n.originalException))return t;let i=n.originalException,a={...i};!r.getOptions().sendDefaultPii&&e.includePaths!==!0&&(delete a.path,delete a.dest),t.contexts={...t.contexts,node_system_error:a};for(let e of t.exception?.values||[])e.value&&(i.path&&e.value.includes(i.path)&&(e.value=e.value.replace(`'${i.path}'`,``).trim()),i.dest&&e.value.includes(i.dest)&&(e.value=e.value.replace(`'${i.dest}'`,``).trim()));return t}}))})),NO,PO,FO=n((()=>{NO=Symbol(`AgentBaseInternalState`),PO=class extends yt.Agent{constructor(e){super(e),this[NO]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`?t.split(`
|
|
8
|
+
`).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1):!1}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)};Promise.resolve().then(()=>this.connect(e,r)).then(i=>{if(i instanceof yt.Agent)return i.addRequest(e,r);this[NO].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[NO].currentSocket;if(this[NO].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[NO].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[NO]&&(this[NO].defaultPort=e)}get protocol(){return this[NO].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[NO]&&(this[NO].protocol=e)}}}));function IO(...e){V.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function LO(e){return new Promise((t,n)=>{let r=0,i=[];function a(){let t=e.read();t?l(t):e.once(`readable`,a)}function o(){e.removeListener(`end`,s),e.removeListener(`error`,c),e.removeListener(`readable`,a)}function s(){o(),IO(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),IO(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
|
|
9
|
+
\r
|
|
10
|
+
`);if(l===-1){IO(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
|
|
11
|
+
`),d=u.shift();if(!d)return e.destroy(),n(Error(`No header received from proxy CONNECT response`));let f=d.split(` `),p=+(f[1]||0),m=f.slice(2).join(` `),h={};for(let t of u){if(!t)continue;let r=t.indexOf(`:`);if(r===-1)return e.destroy(),n(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,r).toLowerCase(),a=t.slice(r+1).trimStart(),o=h[i];typeof o==`string`?h[i]=[o,a]:Array.isArray(o)?o.push(a):h[i]=a}IO(`got proxy server response: %o %o`,d,h),o(),t({connect:{statusCode:p,statusText:m,headers:h},buffered:c})}e.on(`error`,c),e.on(`end`,s),a()})}var RO=n((()=>{X()}));function zO(...e){V.log(`[https-proxy-agent]`,...e)}function BO(e){e.resume()}function VO(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var HO,UO=n((()=>{X(),FO(),RO(),HO=class extends PO{static __initStatic(){this.protocols=[`http`,`https`]}constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},zO(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?VO(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){zO("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=Tt.connect({...this.connectOpts,servername:e&&wt.isIP(e)?void 0:e})}else zO("Creating `net.Socket`: %o",this.connectOpts),r=wt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=wt.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r\n`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||(i[`Proxy-Connection`]=this.keepAlive?`Keep-Alive`:`close`);for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r\n`;let s=LO(r);r.write(`${o}\r\n`);let{connect:c,buffered:l}=await s;if(e.emit(`proxyConnect`,c),this.emit(`proxyConnect`,c,e),c.statusCode===200){if(e.once(`socket`,BO),t.secureEndpoint){zO(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return Tt.connect({...VO(t,`host`,`path`,`port`),socket:r,servername:wt.isIP(e)?void 0:e})}return r}r.destroy();let u=new wt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{zO(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}},HO.__initStatic()}));function WO(e){return new _t({read(){this.push(e),this.push(null)}})}function GO(e){let t;try{t=new URL(e.url)}catch{return Eo(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),dm(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=KO(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?vt:yt,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new HO(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return dm(e,qO(e,e.httpModule??i,o))}function KO(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function qO(e,t,n){let{hostname:r,pathname:i,port:a,protocol:o,search:s}=new URL(e.url);return function(c){return new Promise((l,u)=>{gf(()=>{let d=WO(c.body),f={...e.headers};c.body.length>JO&&(f[`content-encoding`]=`gzip`,d=d.pipe(bt()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}var JO,YO=n((()=>{X(),UO(),JO=1024*32}));function XO(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=dh(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?n??!0:t??n}var ZO=n((()=>{X()}));function QO(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function $O(e=process.argv[1]?A_(process.argv[1]):process.cwd(),t=rt===`\\`){let n=t?QO(e):e;return e=>{if(!e)return;let r=t?QO(e):e,{dir:i,base:a,ext:o}=nt.parse(r);(o===`.js`||o===`.mjs`||o===`.cjs`)&&(a=a.slice(0,o.length*-1));let s=decodeURIComponent(a);i||(i=`.`);let c=i.lastIndexOf(`/node_modules`);if(c>-1)return`${i.slice(c+14).replace(/\//g,`.`)}:${s}`;if(i.startsWith(n)){let e=i.slice(n.length+1).replace(/\//g,`.`);return e?`${e}:${s}`:s}return s}}var ek=n((()=>{X()}));function tk(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(B.SENTRY_RELEASE?.id)return B.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||n||r||e}var nk,rk=n((()=>{X(),ek(),nk=Ro(eC($O()))})),ik,ak,ok=n((()=>{T(),L(),X(),wE(),_C(),ik=6e4,ak=class extends ih{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||dt.hostname(),n={...e,platform:`node`,runtime:e.runtime||{name:`node`,version:global.process.version},serverName:t};e.openTelemetryInstrumentations&&Ni({instrumentations:e.openTelemetryInstrumentations}),Eh(n,`node`),V.log(`Initializing Sentry: process: ${process.pid}, thread: ${Dt?`main`:`worker-${Ot}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Up(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e=bo,t=D.getTracer(`@sentry/node`,e);return this._tracer=t,t}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener);let t=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),t}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{Q&&V.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??ik).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}_setupIntegrations(){ch(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?wT(this,e):[void 0,void 0]}}}));function sk(){if(HD()&&!B._sentryEsmLoaderHookRegistered){B._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,ck.createAddHookMessageChannel)();ft.register(`import-in-the-middle/hook.mjs`,import.meta.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){V.warn(`Failed to register 'import-in-the-middle' hook`,e)}}}var ck,lk=n((()=>{X(),ck=Ua(),WD()}));function uk(){return[hg(),tg(),Dg(),Vg(),jO(),nv(),Q_(),lw(),jw(),cO(),vO(),_D(),zD(),JE(),ME(),xO(),tO()]}function dk(e={}){return fk(e,uk)}function fk(e={},t){let n=mk(e,t);n.debug===!0&&(Q?V.enable():Eo(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&sk(),kT(),U().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===`Spotlight`)&&n.integrations.push(DO({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Eh(n,`node-core`);let r=new ak(n);return U().setClient(r),r.init(),V.log(`SDK initialized from ${VD()?`CommonJS`:`ESM`}`),r.startClientReportTracking(),_k(),Qw(r),DT(r),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function pk(){if(!Q)return;let e=tT(),t=[`SentryContextManager`,`SentryPropagator`];Qu()&&t.push(`SentrySpanProcessor`);for(let n of t)e.includes(n)||V.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);e.includes(`SentrySampler`)||V.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function mk(e,t){let n=hk(e.release),r=XO(e.spotlight),i=gk(e.tracesSampleRate),a={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??GO,stackParser:zo(e.stackParser||nk),release:n,tracesSampleRate:i,spotlight:r,debug:dh(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=Mp({defaultIntegrations:e.defaultIntegrations??t(a),integrations:o});return a.traceLifecycle===`stream`&&!s.some(e=>e.name===`SpanStreaming`)&&s.push(KS()),{...a,integrations:s}}function hk(e){if(e!==void 0)return e;let t=tk();if(t!==void 0)return t}function gk(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let n=parseFloat(t);return isFinite(n)?n:void 0}function _k(){if(dh(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=gu(e,t);U().setPropagationContext(n)}}var vk=n((()=>{X(),wE(),_C(),NE(),QE(),vD(),uw(),BD(),nO(),Mw(),lO(),yO(),SO(),OO(),MO(),YO(),WD(),ZO(),rk(),ok(),lk()}));function yk(e,t){e.setAttribute(K,t)}var bk=n((()=>{X()}));function xk(e){let t=e.protocol||``,n=e.hostname||e.host||``;return`${t}//${n}${!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(n)?``:`:${e.port}`}${e.path?e.path:`/`}`}var Sk=n((()=>{})),$=n((()=>{uw(),WC(),MC(),ow(),Mw(),Ow(),EE(),OE(),gC(),vk(),wE(),ok(),L(),X(),WD(),SO(),mw(),xD(),QE(),vD(),BD(),nO(),lO(),yO(),OO(),MO(),NE(),_C(),rk(),ek(),bk(),Sk(),lk(),YO()}));function Ck(e,t={}){return typeof e.spans==`boolean`?e.spans:!(t.skipOpenTelemetrySetup||!Qu(t)&&Ok)}function wk(e={}){return{disableOutgoingRequestInstrumentation:Ok,ignoreOutgoingRequestHook:t=>{let n=xk(t);if(!n)return!1;let r=e.ignoreOutgoingRequests;return!!r?.(n,t)},requireParentforOutgoingSpans:!1,requestHook:(t,n)=>{yk(t,`auto.http.otel.http`);let r=xk(n);if(r.startsWith(`data:`)){let e=Ch(r);t.setAttribute(`http.url`,e),t.setAttribute(Il,e),t.updateName(`${n.method||`GET`} ${e}`)}e.instrumentation?.requestHook?.(t,n)},responseHook:(t,n)=>{e.instrumentation?.responseHook?.(t,n)},applyCustomAttributesOnSpan:(t,n,r)=>{e.instrumentation?.applyCustomAttributesOnSpan?.(t,n,r)}}}var Tk,Ek,Dk,Ok,kk,Ak,jk,Mk=n((()=>{T(),Tk=vo(),X(),$(),Ek=`Http`,Dk=`@opentelemetry_sentry-patched/instrumentation-http`,Ok=dw.major===22&&dw.minor>=12||dw.major===23&&dw.minor>=2||dw.major>=24,kk=Z(`${Ek}.sentry`,e=>new aw(e)),Ak=Z(Ek,e=>{let t=new Tk.HttpInstrumentation({...e,disableIncomingRequestInstrumentation:!0});try{t._diag=E.createComponentLogger({namespace:Dk}),t.instrumentationName=Dk}catch{}try{let e={get:()=>!1,set:()=>{}};Object.defineProperty(t,`_httpPatched`,e),Object.defineProperty(t,`_httpsPatched`,e)}catch{}return t}),jk=Y((e={})=>{let t=e.spans??!0,n=e.disableIncomingRequestSpans,r={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},i={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},a=jC(r),o=UC(i),s=t&&!n;return{name:Ek,setup(e){let t=e.getOptions();s&&Qu(t)&&o.setup(e)},setupOnce(){let t=Ck(e,W()?.getOptions()||{});a.setupOnce(),kk({breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:typeof e.tracePropagation==`boolean`?e.tracePropagation:Ok||!t,createSpansForOutgoingRequests:Ok,spans:e.spans,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(t,n)=>{let r=xk(n);if(r.startsWith(`data:`)){let e=Ch(r);t.setAttribute(`http.url`,e),t.setAttribute(Il,e),t.updateName(`${n.method||`GET`} ${e}`)}e.instrumentation?.requestHook?.(t,n)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan}),t&&Ak(wk(e))},processEvent(e){return o.processEvent(e)}}})})),Nk=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.24.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-undici`})),Pk=i((n=>{a(),Object.defineProperty(n,`__esModule`,{value:!0}),n.UndiciInstrumentation=void 0;var r=t(`diagnostics_channel`),i=t(`url`),s=(L(),e(I)),c=(T(),e(k)),l=(ui(),e(ci)),u=(F(),e(A)),d=Nk();n.UndiciInstrumentation=class extends s.InstrumentationBase{constructor(e={}){super(d.PACKAGE_NAME,d.PACKAGE_VERSION,e),o(this,`_recordFromReq`,new WeakMap)}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs.length=0}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this.subscribeToChannel(`undici:request:create`,this.onRequestCreated.bind(this)),this.subscribeToChannel(`undici:client:sendHeaders`,this.onRequestHeaders.bind(this)),this.subscribeToChannel(`undici:request:headers`,this.onResponseHeaders.bind(this)),this.subscribeToChannel(`undici:request:trailers`,this.onDone.bind(this)),this.subscribeToChannel(`undici:request:error`,this.onError.bind(this)))}_updateMetricInstruments(){this._httpClientDurationHistogram=this.meter.createHistogram(u.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:`Measures the duration of outbound HTTP requests.`,unit:`s`,valueType:c.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,t){let[n,i]=process.version.replace(`v`,``).split(`.`).map(e=>Number(e)),a=n>18||n===18&&i>=19,o;if(a)r.subscribe?.(e,t),o=()=>r.unsubscribe?.(e,t);else{let n=r.channel(e);n.subscribe(t),o=()=>n.unsubscribe(t)}this._channelSubs.push({name:e,unsubscribe:o})}parseRequestHeaders(e){let t=new Map;if(Array.isArray(e.headers))for(let n=0;n<e.headers.length;n+=2){let r=e.headers[n],i=e.headers[n+1];typeof r==`string`&&t.set(r.toLowerCase(),i)}else if(typeof e.headers==`string`){let n=e.headers.split(`\r
|
|
12
|
+
`);for(let e of n){if(!e)continue;let n=e.indexOf(`:`);if(n===-1)continue;let r=e.substring(0,n).toLowerCase(),i=e.substring(n+1).trim(),a=t.get(r);a&&Array.isArray(a)?a.push(i):a?t.set(r,[a,i]):t.set(r,i)}}return t}onRequestCreated({request:e}){let t=this.getConfig(),n=t.enabled!==!1;if((0,s.safeExecuteInTheMiddle)(()=>!n||e.method===`CONNECT`||t.ignoreRequestHook?.(e),e=>e&&this._diag.error(`caught ignoreRequestHook error: `,e),!0))return;let r=(0,l.hrTime)(),a;try{a=new i.URL(e.path,e.origin)}catch(e){this._diag.warn(`could not determine url.full:`,e);return}let o=a.protocol.replace(`:`,``),d=this.getRequestMethod(e.method),f={[u.ATTR_HTTP_REQUEST_METHOD]:d,[u.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]:e.method,[u.ATTR_URL_FULL]:a.toString(),[u.ATTR_URL_PATH]:a.pathname,[u.ATTR_URL_QUERY]:a.search,[u.ATTR_URL_SCHEME]:o},p={https:`443`,http:`80`},m=a.hostname,h=a.port||p[o];f[u.ATTR_SERVER_ADDRESS]=m,h&&!isNaN(Number(h))&&(f[u.ATTR_SERVER_PORT]=Number(h));let g=this.parseRequestHeaders(e).get(`user-agent`);if(g){let e=Array.isArray(g)?g[g.length-1]:g;f[u.ATTR_USER_AGENT_ORIGINAL]=e}let _=(0,s.safeExecuteInTheMiddle)(()=>t.startSpanHook?.(e),e=>e&&this._diag.error(`caught startSpanHook error: `,e),!0);_&&Object.entries(_).forEach(([e,t])=>{f[e]=t});let v=c.context.active(),y=c.trace.getSpan(v),b;b=t.requireParentforSpans&&(!y||!c.trace.isSpanContextValid(y.spanContext()))?c.trace.wrapSpanContext(c.INVALID_SPAN_CONTEXT):this.tracer.startSpan(d===`_OTHER`?`HTTP`:d,{kind:c.SpanKind.CLIENT,attributes:f},v),(0,s.safeExecuteInTheMiddle)(()=>t.requestHook?.(b,e),e=>e&&this._diag.error(`caught requestHook error: `,e),!0);let x=c.trace.setSpan(c.context.active(),b),S={};c.propagation.inject(x,S);let C=Object.entries(S);for(let t=0;t<C.length;t++){let[n,r]=C[t];typeof e.addHeader==`function`?e.addHeader(n,r):typeof e.headers==`string`?e.headers+=`${n}: ${r}\r\n`:Array.isArray(e.headers)&&e.headers.push(n,r)}this._recordFromReq.set(e,{span:b,attributes:f,startTime:r})}onRequestHeaders({request:e,socket:t}){let n=this._recordFromReq.get(e);if(!n)return;let r=this.getConfig(),{span:i}=n,{remoteAddress:a,remotePort:o}=t,s={[u.ATTR_NETWORK_PEER_ADDRESS]:a,[u.ATTR_NETWORK_PEER_PORT]:o};if(r.headersToSpanAttributes?.requestHeaders){let t=new Set(r.headersToSpanAttributes.requestHeaders.map(e=>e.toLowerCase())),n=this.parseRequestHeaders(e);for(let[e,r]of n.entries())if(t.has(e)){let t=Array.isArray(r)?r:[r];s[`http.request.header.${e}`]=t}}i.setAttributes(s)}onResponseHeaders({request:e,response:t}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:i}=n,a={[u.ATTR_HTTP_RESPONSE_STATUS_CODE]:t.statusCode},o=this.getConfig();if((0,s.safeExecuteInTheMiddle)(()=>o.responseHook?.(r,{request:e,response:t}),e=>e&&this._diag.error(`caught responseHook error: `,e),!0),o.headersToSpanAttributes?.responseHeaders){let e=new Set;o.headersToSpanAttributes?.responseHeaders.forEach(t=>e.add(t.toLowerCase()));for(let n=0;n<t.headers.length;n+=2){let r=t.headers[n].toString().toLowerCase(),i=t.headers[n+1];if(e.has(r)){let e=`http.response.header.${r}`;Object.hasOwn(a,e)?a[e].push(i.toString()):a[e]=[i.toString()]}}}r.setAttributes(a),r.setStatus({code:t.statusCode>=400?c.SpanStatusCode.ERROR:c.SpanStatusCode.UNSET}),n.attributes=Object.assign(i,a)}onDone({request:e}){let t=this._recordFromReq.get(e);if(!t)return;let{span:n,attributes:r,startTime:i}=t;n.end(),this._recordFromReq.delete(e),this.recordRequestDuration(r,i)}onError({request:e,error:t}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:i,startTime:a}=n;r.recordException(t),r.setStatus({code:c.SpanStatusCode.ERROR,message:t.message}),r.end(),this._recordFromReq.delete(e),i[u.ATTR_ERROR_TYPE]=t.message,this.recordRequestDuration(i,a)}recordRequestDuration(e,t){let n={};[u.ATTR_HTTP_RESPONSE_STATUS_CODE,u.ATTR_HTTP_REQUEST_METHOD,u.ATTR_SERVER_ADDRESS,u.ATTR_SERVER_PORT,u.ATTR_URL_SCHEME,u.ATTR_ERROR_TYPE].forEach(t=>{t in e&&(n[t]=e[t])});let r=(0,l.hrTimeToMilliseconds)((0,l.hrTimeDuration)(t,(0,l.hrTime)()))/1e3;this._httpClientDurationHistogram.record(r,n)}getRequestMethod(e){return e.toUpperCase()in{CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0}?e.toUpperCase():`_OTHER`}}})),Fk=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.UndiciInstrumentation=void 0;var t=Pk();Object.defineProperty(e,`UndiciInstrumentation`,{enumerable:!0,get:function(){return t.UndiciInstrumentation}})}));function Ik(e,t=`/`){let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}function Lk(e,t={}){return typeof e.spans==`boolean`?e.spans:!t.skipOpenTelemetrySetup&&Qu(t)}function Rk(e={}){return{requireParentforSpans:!1,ignoreRequestHook:t=>{let n=Ik(t.origin,t.path),r=e.ignoreOutgoingRequests;return!!(r&&n&&r(n))},startSpanHook:e=>{let t=Ik(e.origin,e.path);if(t.startsWith(`data:`)){let n=Ch(t);return{[K]:`auto.http.otel.node_fetch`,"http.url":n,[Il]:n,[kl]:`${e.method||`GET`} ${n}`}}return{[K]:`auto.http.otel.node_fetch`}},requestHook:e.requestHook,responseHook:e.responseHook,headersToSpanAttributes:e.headersToSpanAttributes}}var zk,Bk,Vk,Hk,Uk,Wk,Gk=n((()=>{zk=Fk(),X(),$(),Bk=`NodeFetch`,Vk=Z(Bk,zk.UndiciInstrumentation,e=>Rk(e)),Hk=Z(`${Bk}.sentry`,Dw,e=>e),Uk=((e={})=>({name:`NodeFetch`,setupOnce(){Lk(e,W()?.getOptions())&&Vk(e),Hk(e)}})),Wk=Y(Uk)})),Kk,qk=n((()=>{Kk=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__})),Jk,Yk,Xk,Zk,Qk,$k,eA=n((()=>{L(),T(),be(),$(),X(),qk(),Jk=`Express`,Yk=[`>=4.0.0 <6`],Xk=Z(Jk,e=>new Zk(e)),Zk=class extends Za{constructor(e={}){super(`sentry-express`,bo,e)}init(){return new no(`express`,Yk,e=>{try{T_(e,()=>({...this.getConfig(),onRouteResolved(e){let t=je(O.active());e&&t?.type===Fe.HTTP&&(t.route=e)}}))}catch(e){Kk&&V.error(`Failed to patch express module:`,e)}return e},e=>e)}},Qk=(e=>({name:Jk,setupOnce(){Xk(e)}})),$k=Y(Qk)})),tA,nA,rA=n((()=>{tA=class{emit(e){}},nA=new tA}));function iA(e,t,n){return r=>r===e?t:n}var aA,oA,sA=n((()=>{aA=Symbol.for(`io.opentelemetry.js.api.logs`),oA=globalThis})),cA,lA,uA=n((()=>{rA(),cA=class{getLogger(e,t,n){return new tA}},lA=new cA})),dA,fA=n((()=>{rA(),dA=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):nA}}})),pA,mA=n((()=>{uA(),fA(),pA=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new dA(this,e,t,n)}_getDelegate(){return this._delegate??lA}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}})),hA,gA=n((()=>{sA(),uA(),mA(),hA=class e{constructor(){this._proxyLoggerProvider=new pA}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return oA[aA]?this.getLoggerProvider():(oA[aA]=iA(1,e,lA),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return oA[aA]?.call(oA,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete oA[aA],this._proxyLoggerProvider=new pA}}})),_A,vA=n((()=>{rA(),gA(),_A=hA.getInstance()}));function yA(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function bA(e){e.forEach(e=>e.disable())}var xA=n((()=>{}));function SA(e){let t=e.tracerProvider||D.getTracerProvider(),n=e.meterProvider||v.getMeterProvider(),r=e.loggerProvider||_A.getLoggerProvider(),i=e.instrumentations?.flat()??[];return yA(i,t,n,r),()=>{bA(i)}}var CA=n((()=>{T(),vA(),xA()}));function wA(e,t,n){if(!TA(e))return E.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,`$1`);let r=MA(e);if(!r)return!1;let i=[],a=EA(r,t,i,n);return a&&!n?.includePrerelease?kA(r,i):a}function TA(e){return typeof e==`string`&&UA.test(e)}function EA(e,t,n,r){if(t.includes(`||`)){let i=t.trim().split(`||`);for(let t of i)if(DA(e,t,n,r))return!0;return!1}else if(t.includes(` - `))t=HA(t,r);else if(t.includes(` `)){let i=t.trim().replace(/\s{2,}/g,` `).split(` `);for(let t of i)if(!DA(e,t,n,r))return!1;return!0}return DA(e,t,n,r)}function DA(e,t,n,r){if(t=AA(t,r),t.includes(` `))return EA(e,t,n,r);{let r=NA(t);return n.push(r),OA(e,r)}}function OA(e,t){if(t.invalid)return!1;if(!t.version||PA(t.version))return!0;let n=RA(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];n=!r.length&&!i.length?0:!r.length&&i.length?1:r.length&&!i.length?-1:RA(r,i)}return GA[t.op]?.includes(n)}function kA(e,t){return e.prerelease?t.some(t=>t.prerelease&&t.version===e.version):!0}function AA(e,t){return e=e.trim(),e=BA(e,t),e=zA(e),e=VA(e,t),e=e.trim(),e}function jA(e){return!e||e.toLowerCase()===`x`||e===`*`}function MA(e){let t=e.match(UA);if(!t){E.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,a=n.split(`.`),o=r?.split(`.`);return{op:void 0,version:n,versionSegments:a,versionSegmentCount:a.length,prerelease:r,prereleaseSegments:o,prereleaseSegmentCount:o?o.length:0,build:i}}function NA(e){if(!e)return{};let t=e.match(WA);if(!t)return E.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,a=t.groups.build,o=r.split(`.`),s=i?.split(`.`);return n===`==`&&(n=`=`),{op:n||`=`,version:r,versionSegments:o,versionSegmentCount:o.length,prerelease:i,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:a}}function PA(e){return e===`*`||e===`x`||e===`X`}function FA(e){let t=parseInt(e,10);return isNaN(t)?e:t}function IA(e,t){if(typeof e==typeof t){if(typeof e==`number`||typeof e==`string`)return[e,t];throw Error(`Version segments can only be strings or numbers`)}else return[String(e),String(t)]}function LA(e,t){if(PA(e)||PA(t))return 0;let[n,r]=IA(FA(e),FA(t));return n>r?1:n<r?-1:0}function RA(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=LA(e[n]||`0`,t[n]||`0`);if(r!==0)return r}return 0}function zA(e){let t=sj;return e.replace(t,(e,t,n,r,i)=>{let a;return a=jA(t)?``:jA(n)?`>=${t}.0.0 <${+t+1}.0.0-0`:jA(r)?`>=${t}.${n}.0 <${t}.${+n+1}.0-0`:i?`>=${t}.${n}.${r}-${i} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${r} <${t}.${+n+1}.0-0`,a})}function BA(e,t){let n=lj,r=t?.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>{let o;return o=jA(t)?``:jA(n)?`>=${t}.0.0${r} <${+t+1}.0.0-0`:jA(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.0${r} <${+t+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i}-${a} <${+t+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i}${r} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i} <${+t+1}.0.0-0`,o})}function VA(e,t){let n=rj;return e.replace(n,(e,n,r,i,a,o)=>{let s=jA(r),c=s||jA(i),l=c||jA(a),u=l;return n===`=`&&u&&(n=``),o=t?.includePrerelease?`-0`:``,s?e=n===`>`||n===`<`?`<0.0.0-0`:`*`:n&&u?(c&&(i=0),a=0,n===`>`?(n=`>=`,c?(r=+r+1,i=0,a=0):(i=+i+1,a=0)):n===`<=`&&(n=`<`,c?r=+r+1:i=+i+1),n===`<`&&(o=`-0`),e=`${n+r}.${i}.${a}${o}`):c?e=`>=${r}.0.0${o} <${+r+1}.0.0-0`:l&&(e=`>=${r}.${i}.0${o} <${r}.${+i+1}.0-0`),e})}function HA(e,t){let n=aj;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>(n=jA(r)?``:jA(i)?`>=${r}.0.0${t?.includePrerelease?`-0`:``}`:jA(a)?`>=${r}.${i}.0${t?.includePrerelease?`-0`:``}`:o?`>=${n}`:`>=${n}${t?.includePrerelease?`-0`:``}`,c=jA(l)?``:jA(u)?`<${+l+1}.0.0-0`:jA(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t?.includePrerelease?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()))}var UA,WA,GA,KA,qA,JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj=n((()=>{T(),UA=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,WA=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,GA={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},KA=`[a-zA-Z0-9-]`,qA=`0|[1-9]\\d*`,JA=`\\d*[a-zA-Z-]${KA}*`,YA=`((?:<|>)?=?)`,XA=`(?:${qA}|${JA})`,ZA=`(?:-(${XA}(?:\\.${XA})*))`,QA=`${KA}+`,$A=`(?:\\+(${QA}(?:\\.${QA})*))`,ej=`${qA}|x|X|\\*`,tj=`[v=\\s]*(${ej})(?:\\.(${ej})(?:\\.(${ej})(?:${ZA})?${$A}?)?)?`,nj=`^${YA}\\s*${tj}$`,rj=new RegExp(nj),ij=`^\\s*(${tj})\\s+-\\s+(${tj})\\s*$`,aj=new RegExp(ij),oj=`^(?:~>?)${tj}$`,sj=new RegExp(oj),cj=`^(?:\\^)${tj}$`,lj=new RegExp(cj)}));function dj(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function fj(e){e&&e.logger&&(typeof e.logger==`function`?pj=e.logger:pj(`new logger isn't a function, not replacing`))}var pj,mj,hj,gj,_j,vj=n((()=>{pj=console.error.bind(console),mj=(e,t,n)=>{if(!e||!e[t]){pj(`no original function `+String(t)+` to wrap`);return}if(!n){pj(`no wrapper function`),pj(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){pj(`original object and wrapper must be functions`);return}let i=n(r,t);return dj(i,`__original`,r),dj(i,`__unwrap`,()=>{e[t]===i&&dj(e,t,r)}),dj(i,`__wrapped`,!0),dj(e,t,i),i},hj=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{pj(`must provide one or more modules to patch`),pj(Error().stack);return}if(!(t&&Array.isArray(t))){pj(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{mj(e,t,n)})})},gj=(e,t)=>{if(!e||!e[t]){pj(`no function to unwrap.`),pj(Error().stack);return}let n=e[t];if(!n.__unwrap)pj(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},_j=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{pj(`must provide one or more modules to patch`),pj(Error().stack);return}if(!(t&&Array.isArray(t))){pj(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{gj(e,t)})})},fj.wrap=mj,fj.massWrap=hj,fj.unwrap=gj,fj.massUnwrap=_j})),yj,bj=n((()=>{T(),vA(),vj(),a(),yj=class{constructor(e,t,n){o(this,`_config`,{}),o(this,`_tracer`,void 0),o(this,`_meter`,void 0),o(this,`_logger`,void 0),o(this,`_diag`,void 0),o(this,`instrumentationName`,void 0),o(this,`instrumentationVersion`,void 0),o(this,`_wrap`,mj),o(this,`_unwrap`,gj),o(this,`_massWrap`,hj),o(this,`_massUnwrap`,_j),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=D.getTracer(e,t),this._meter=v.getMeter(e,t),this._logger=_A.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),xj,Sj,Cj=n((()=>{a(),xj=class{constructor(){o(this,`hooks`,[]),o(this,`children`,new Map)}},Sj=class{constructor(){o(this,`_trie`,new xj),o(this,`_counter`,0)}insert(e){let t=this._trie;for(let n of e.moduleName.split(`/`)){let e=t.children.get(n);e||(e=new xj,t.children.set(n,e)),t=e}t.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:t,fullOnly:n}={}){let r=this._trie,i=[],a=!0;for(let t of e.split(`/`)){let e=r.children.get(t);if(!e){a=!1;break}n||i.push(...e.hooks),r=e}return n&&a&&i.push(...r.hooks),i.length===0?[]:i.length===1?[i[0].hook]:(t&&i.sort((e,t)=>e.insertedId-t.insertedId),i.map(({hook:e})=>e))}}}));function wj(e){return qe.sep===`/`?e:e.split(qe.sep).join(`/`)}var Tj,Ej,Dj,Oj=n((()=>{Tj=Na(),Cj(),a(),Ej=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(e=>typeof global[e]==`function`),Dj=class e{constructor(){o(this,`_moduleNameTrie`,new Sj),this._initialize()}_initialize(){new Tj.Hook(null,{internals:!0},(e,t,n)=>{let r=wj(t),i=this._moduleNameTrie.search(r,{maintainInsertionOrder:!0,fullOnly:n===void 0});for(let{onRequire:r}of i)e=r(e,t,n);return e})}register(e,t){let n={moduleName:e,onRequire:t};return this._moduleNameTrie.insert(n),n}static getInstance(){return Ej?new e:this._instance=this._instance??new e}},o(Dj,`_instance`,void 0)})),kj=i((e=>{var t=[],n=new WeakMap,r=new WeakMap,i=new Map,a=[],o={set(e,t,r){let i=n.get(e),a=i&&i[t];return typeof a==`function`?a(r):!0},get(e,t){if(t===Symbol.toStringTag)return`Module`;let n=r.get(e)[t];if(typeof n==`function`)return n()},defineProperty(e,t,r){if(!(`value`in r))throw Error(`Getters/setters are not supported for exports property descriptors.`);let i=n.get(e),a=i&&i[t];return typeof a==`function`?a(r.value):!0}};function s(e,s,c,l,u){i.set(e,u),n.set(s,c),r.set(s,l);let d=new Proxy(s,o);t.forEach(t=>t(e,d,u)),a.push([e,d,u])}e.register=s,e.importHooks=t,e.specifiers=i,e.toHook=a})),Aj=i(((e,n)=>{var r=t(`path`),i=Ma(),{fileURLToPath:a}=t(`url`),{MessageChannel:o}=t(`worker_threads`),{isBuiltin:s}=t(`module`);s||(s=()=>!0);var{importHooks:c,specifiers:l,toHook:u}=kj();function d(e){c.push(e),u.forEach(([t,n,r])=>e(t,n,r))}function f(e){let t=c.indexOf(e);t>-1&&c.splice(t,1)}function p(e,t,n,r){let i=e(t,n,r);i&&i!==t&&`default`in t&&(t.default=i)}var m;function h(){let{port1:e,port2:t}=new o,n=0,r;m=t=>{n++,e.postMessage(t)},e.on(`message`,()=>{n--,r&&n<=0&&r()}).unref();function i(){let e=setInterval(()=>{},1e3),t=new Promise(e=>{r=e}).then(()=>{clearInterval(e)});return n===0&&r(),t}let a=t;return{registerOptions:{data:{addHookMessagePort:a,include:[]},transferList:[a]},addHookMessagePort:a,waitForAllMessagesAcknowledged:i}}function g(e,t,n){if(!(this instanceof g))return new g(e,t,n);typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null);let o=t?t.internals===!0:!1;m&&Array.isArray(e)&&m(e),this._iitmHook=(t,c,u)=>{let d=t,f=d.startsWith(`node:`),m,h;if(f){let e=t.slice(5);s(e)&&(t=e)}else if(d.startsWith(`file://`)){let e=Error.stackTraceLimit;Error.stackTraceLimit=0;try{m=a(t),t=m}catch{}if(Error.stackTraceLimit=e,m){let e=i(m);e&&(t=e.name,h=e.basedir)}}if(e)for(let i of e)if(m&&i===m)p(n,c,m,void 0);else if(i===t){if(!h)p(n,c,t,h);else if(h.endsWith(l.get(d)))p(n,c,t,h);else if(o){let e=t+r.sep+r.relative(h,m);p(n,c,e,h)}}else i===u&&p(n,c,u,h);else p(n,c,t,h)},d(this._iitmHook)}g.prototype.unhook=function(){f(this._iitmHook)},n.exports=g,n.exports.Hook=g,n.exports.addHook=d,n.exports.removeHook=f,n.exports.createAddHookMessageChannel=h}));function jj(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}async function Mj(e,t,n){let r,i;try{i=await e()}catch(e){r=e}finally{if(await t(r,i),r&&!n)throw r;return i}}function Nj(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var Pj=n((()=>{}));function Fj(e,t,n){return t===void 0?e.includes(`*`):e.some(e=>wA(t,e,{includePrerelease:n}))}var Ij,Lj,Rj,zj=n((()=>{uj(),vj(),bj(),Oj(),Ij=Aj(),T(),Lj=Na(),Pj(),a(),Rj=class extends yj{constructor(e,t,n){super(e,t,n),o(this,`_modules`,void 0),o(this,`_hooks`,[]),o(this,`_requireInTheMiddleSingleton`,Dj.getInstance()),o(this,`_enabled`,!1),o(this,`_wrap`,(e,t,n)=>{if(Nj(e[t])&&this._unwrap(e,t),mt.isProxy(e)){let r=mj(Object.assign({},e),t,n);return Object.defineProperty(e,t,{value:r}),r}else return mj(e,t,n)}),o(this,`_unwrap`,(e,t)=>mt.isProxy(e)?Object.defineProperty(e,t,{value:e[t]}):gj(e,t)),o(this,`_massWrap`,(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{E.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){E.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._wrap(e,t,n)})})}),o(this,`_massUnwrap`,(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{E.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){E.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._unwrap(e,t)})})});let r=this.init();r&&!Array.isArray(r)&&(r=[r]),this._modules=r||[],this._config.enabled&&this.enable()}_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let e=t.resolve(n);t.cache[e]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let t=it(qe.join(e,`package.json`),{encoding:`utf8`}),n=JSON.parse(t).version;return typeof n==`string`?n:void 0}catch{E.warn(`Failed extracting version`,e)}}_onRequire(e,t,n,r){if(!r)return typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:e.name}),e.patch(t)):t;let i=this._extractPackageVersion(r);if(e.moduleVersion=i,e.name===n)return Fj(e.supportedVersions,i,e.includePrerelease)&&typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:e.name,version:e.moduleVersion,baseDir:r}),e.patch(t,e.moduleVersion)):t;let a=e.files??[],o=qe.normalize(n);return a.filter(t=>t.name===o&&Fj(t.supportedVersions,i,e.includePrerelease)).reduce((t,n)=>(n.moduleExports=t,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:e.name,version:e.moduleVersion,fileName:n.name,baseDir:r}),n.patch(t,e.moduleVersion)):t),t)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch==`function`&&e.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.patch(t.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let t=(t,n,r)=>{if(!r&&qe.isAbsolute(n)){let e=qe.parse(n);n=e.name,r=e.dir}return this._onRequire(e,t,n,r)},n=(t,n,r)=>this._onRequire(e,t,n,r),r=qe.isAbsolute(e.name)?new Lj.Hook([e.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(e.name,n);this._hooks.push(r);let i=new Ij.Hook([e.name],{internals:!0},t);this._hooks.push(i)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch==`function`&&e.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.unpatch(t.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}}})),Bj=n((()=>{})),Vj=n((()=>{zj(),Bj()})),Hj=n((()=>{Vj()})),Uj,Wj=n((()=>{a(),Uj=class{constructor(e,t,n,r,i){o(this,`files`,void 0),o(this,`name`,void 0),o(this,`supportedVersions`,void 0),o(this,`patch`,void 0),o(this,`unpatch`,void 0),this.files=i||[],this.name=e,this.supportedVersions=t,this.patch=n,this.unpatch=r}}})),Gj,Kj=n((()=>{Hj(),a(),Gj=class{constructor(e,t,n,r){o(this,`name`,void 0),o(this,`supportedVersions`,void 0),o(this,`patch`,void 0),o(this,`unpatch`,void 0),this.name=Je(e),this.supportedVersions=t,this.patch=n,this.unpatch=r}}}));function qj(e,t){let n=Jj.OLD,r=t?.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r??[])if(t.toLowerCase()===e+`/dup`){n=Jj.DUPLICATE;break}else t.toLowerCase()===e&&(n=Jj.STABLE);return n}var Jj,Yj=n((()=>{(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(Jj||(Jj={}))})),Xj=r({InstrumentationBase:()=>Rj,InstrumentationNodeModuleDefinition:()=>Uj,InstrumentationNodeModuleFile:()=>Gj,SemconvStability:()=>Jj,isWrapped:()=>Nj,registerInstrumentations:()=>SA,safeExecuteInTheMiddle:()=>jj,safeExecuteInTheMiddleAsync:()=>Mj,semconvStabilityFromStr:()=>qj}),Zj=n((()=>{CA(),Hj(),Wj(),Kj(),Pj(),Yj()})),Qj=r({author:()=>cM,bugs:()=>lM,default:()=>gM,dependencies:()=>pM,description:()=>tM,devDependencies:()=>fM,funding:()=>dM,homepage:()=>uM,keywords:()=>sM,license:()=>`MIT`,main:()=>nM,name:()=>$j,peerDependencies:()=>mM,repository:()=>oM,scripts:()=>aM,tsd:()=>hM,type:()=>rM,types:()=>iM,version:()=>eM}),$j,eM,tM,nM,rM,iM,aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M=n((()=>{$j=`@fastify/otel`,eM=`0.18.0`,tM=`Official Fastify OpenTelemetry Instrumentation`,nM=`index.js`,rM=`commonjs`,iM=`types/index.d.ts`,aM={lint:`eslint`,"lint:fix":`eslint --fix`,test:`npm run test:all && npm run test:typescript`,"test:unit":`c8 --100 node --test`,"test:all":`npm run test:v4 && npm run test:v5`,"test:v4":`cross-env FASTIFY_VERSION=fastifyv4 npm run test:unit`,"test:v5":`cross-env FASTIFY_VERSION=fastify npm run test:unit`,"test:coverage":`c8 node --test && c8 report --reporter=html`,"test:typescript":`tsd`},oM={type:`git`,url:`git+https://github.com/fastify/otel.git`},sM=[`plugin`,`helper`,`fastify`,`instrumentation`,`otel`,`opentelemetry`],cM=`Carlos Fuentes - @metcoder95 (https://metcoder.dev)`,lM={url:`https://github.com/fastify/otel/issues`},uM=`https://github.com/fastify/otel#readme`,dM=[{type:`github`,url:`https://github.com/sponsors/fastify`},{type:`opencollective`,url:`https://opencollective.com/fastify`}],fM={"@fastify/type-provider-typebox":`^6.1.0`,"@opentelemetry/context-async-hooks":`^2.0.0`,"@opentelemetry/contrib-test-utils":`^0.59.0`,"@opentelemetry/instrumentation-http":`^0.212.0`,"@opentelemetry/propagator-jaeger":`^2.0.0`,"@opentelemetry/sdk-trace-base":`^2.0.0`,"@opentelemetry/sdk-trace-node":`^2.2.0`,"@types/node":`^25.0.3`,c8:`^11.0.0`,"cross-env":`^10.0.0`,eslint:`^9.16.0`,fastify:`^5.1.0`,"fastify-plugin":`^5.1.0`,fastifyv4:`npm:fastify@^4.0.0`,neostandard:`^0.12.0`,tsd:`^0.33.0`},pM={"@opentelemetry/core":`^2.0.0`,"@opentelemetry/instrumentation":`^0.212.0`,"@opentelemetry/semantic-conventions":`^1.28.0`,minimatch:`^10.2.4`},mM={"@opentelemetry/api":`^1.9.0`},hM={directory:`types`},gM={name:$j,version:eM,description:tM,main:nM,type:rM,types:iM,scripts:aM,repository:oM,keywords:sM,author:cM,license:`MIT`,bugs:lM,homepage:uM,funding:dM,devDependencies:fM,dependencies:pM,peerDependencies:mM,tsd:hM}})),vM=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.range=e.balanced=void 0,e.balanced=(n,r,i)=>{let a=n instanceof RegExp?t(n,i):n,o=r instanceof RegExp?t(r,i):r,s=a!==null&&o!=null&&(0,e.range)(a,o,i);return s&&{start:s[0],end:s[1],pre:i.slice(0,s[0]),body:i.slice(s[0]+a.length,s[1]),post:i.slice(s[1]+o.length)}};var t=(e,t)=>{let n=t.match(e);return n?n[0]:null};e.range=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s}})),yM=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.EXPANSION_MAX=void 0,e.expand=x;var t=vM(),n=`\0SLASH`+Math.random()+`\0`,r=`\0OPEN`+Math.random()+`\0`,i=`\0CLOSE`+Math.random()+`\0`,a=`\0COMMA`+Math.random()+`\0`,o=`\0PERIOD`+Math.random()+`\0`,s=new RegExp(n,`g`),c=new RegExp(r,`g`),l=new RegExp(i,`g`),u=new RegExp(a,`g`),d=new RegExp(o,`g`),f=/\\\\/g,p=/\\{/g,m=/\\}/g,h=/\\,/g,g=/\\\./g;e.EXPANSION_MAX=1e5;function _(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function v(e){return e.replace(f,n).replace(p,r).replace(m,i).replace(h,a).replace(g,o)}function y(e){return e.replace(s,`\\`).replace(c,`{`).replace(l,`}`).replace(u,`,`).replace(d,`.`)}function b(e){if(!e)return[``];let n=[],r=(0,t.balanced)(`{`,`}`,e);if(!r)return e.split(`,`);let{pre:i,body:a,post:o}=r,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;let c=b(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),n.push.apply(n,s),n}function x(t,n={}){if(!t)return[];let{max:r=e.EXPANSION_MAX}=n;return t.slice(0,2)===`{}`&&(t=`\\{\\}`+t.slice(2)),E(v(t),r,!0).map(y)}function S(e){return`{`+e+`}`}function C(e){return/^-?0\d/.test(e)}function w(e,t){return e<=t}function T(e,t){return e>=t}function E(e,n,r){let a=[],o=(0,t.balanced)(`{`,`}`,e);if(!o)return[e];let s=o.pre,c=o.post.length?E(o.post,n,!1):[``];if(/\$$/.test(o.pre))for(let e=0;e<c.length&&e<n;e++){let t=s+`{`+o.body+`}`+c[e];a.push(t)}else{let t=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),u=t||l,d=o.body.indexOf(`,`)>=0;if(!u&&!d)return o.post.match(/,(?!,).*\}/)?(e=o.pre+`{`+o.body+i+o.post,E(e,n,!0)):[e];let f;if(u)f=o.body.split(/\.\./);else if(f=b(o.body),f.length===1&&f[0]!==void 0&&(f=E(f[0],n,!1).map(S),f.length===1))return c.map(e=>o.pre+f[0]+e);let p;if(u&&f[0]!==void 0&&f[1]!==void 0){let e=_(f[0]),t=_(f[1]),n=Math.max(f[0].length,f[1].length),r=f.length===3&&f[2]!==void 0?Math.max(Math.abs(_(f[2])),1):1,i=w;t<e&&(r*=-1,i=T);let a=f.some(C);p=[];for(let o=e;i(o,t);o+=r){let e;if(l)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}p.push(e)}}else{p=[];for(let e=0;e<f.length;e++)p.push.apply(p,E(f[e],n,!1))}for(let e=0;e<p.length;e++)for(let t=0;t<c.length&&a.length<n;t++){let n=s+p[e]+c[t];(!r||u||n)&&a.push(n)}}return a}})),bM=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assertValidPattern=void 0;var t=1024*64;e.assertValidPattern=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>t)throw TypeError(`pattern is too long`)}})),xM=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseClass=void 0;var t={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},n=e=>e.replace(/[[\]\\-]/g,`\\$&`),r=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),i=e=>e.join(``);e.parseClass=(e,a)=>{let o=a;if(e.charAt(o)!==`[`)throw Error(`not in a brace expression`);let s=[],c=[],l=o+1,u=!1,d=!1,f=!1,p=!1,m=o,h=``;WHILE:for(;l<e.length;){let r=e.charAt(l);if((r===`!`||r===`^`)&&l===o+1){p=!0,l++;continue}if(r===`]`&&u&&!f){m=l+1;break}if(u=!0,r===`\\`&&!f){f=!0,l++;continue}if(r===`[`&&!f){for(let[n,[r,i,a]]of Object.entries(t))if(e.startsWith(n,l)){if(h)return[`$.`,!1,e.length-o,!0];l+=n.length,a?c.push(r):s.push(r),d=d||i;continue WHILE}}if(f=!1,h){r>h?s.push(n(h)+`-`+n(r)):r===h&&s.push(n(r)),h=``,l++;continue}if(e.startsWith(`-]`,l+1)){s.push(n(r+`-`)),l+=2;continue}if(e.startsWith(`-`,l+1)){h=r,l+=2;continue}s.push(n(r)),l++}if(m<l)return[``,!1,0,!1];if(!s.length&&!c.length)return[`$.`,!1,e.length-o,!0];if(c.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!p)return[r(s[0].length===2?s[0].slice(-1):s[0]),!1,m-o,!1];let g=`[`+(p?`^`:``)+i(s)+`]`,_=`[`+(p?``:`^`)+i(c)+`]`;return[s.length&&c.length?`(`+g+`|`+_+`)`:s.length?g:_,d,m-o,!0]}})),SM=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.unescape=void 0,e.unescape=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`)})),CM=i((e=>{g(),a(),c(),l(),d(),f();var t,n,r;Object.defineProperty(e,`__esModule`,{value:!0}),e.AST=void 0;var i=xM(),_=SM(),v=new Set([`!`,`?`,`+`,`*`,`@`]),y=e=>v.has(e),b=e=>y(e.type),x=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),S=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),C=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),w=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),T=`(?!(?:^|/)\\.\\.?(?:$|/))`,E=`(?!\\.)`,D=new Set([`[`,`.`]),O=new Set([`..`,`.`]),k=new Set(`().*{}+?[]^$\\!`),ee=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),te=`[^/]`,ne=te+`*?`,re=te+`+?`,A=0,j=new WeakMap,ie=new WeakMap,ae=new WeakMap,M=new WeakMap,N=new WeakMap,oe=new WeakMap,se=new WeakMap,ce=new WeakMap,le=new WeakMap,ue=new WeakMap,de=new WeakMap,P=new WeakSet;n=Symbol.for(`nodejs.util.inspect.custom`);var fe=class e{get depth(){return(p(N,this)?.depth??-1)+1}[n](){return{"@@type":`AST`,id:this.id,type:this.type,root:p(j,this).id,parent:p(N,this)?.id,depth:this.depth,partsLength:p(M,this).length,parts:p(M,this)}}constructor(e,t,n={}){u(this,P),o(this,`type`,void 0),m(this,j,void 0),m(this,ie,void 0),m(this,ae,!1),m(this,M,[]),m(this,N,void 0),m(this,oe,void 0),m(this,se,void 0),m(this,ce,!1),m(this,le,void 0),m(this,ue,void 0),m(this,de,!1),o(this,`id`,++A),this.type=e,e&&h(ie,this,!0),h(N,this,t),h(j,this,p(N,this)?p(j,p(N,this)):this),h(le,this,p(j,this)===this?n:p(le,p(j,this))),h(se,this,p(j,this)===this?[]:p(se,p(j,this))),e===`!`&&!p(ce,p(j,this))&&p(se,this).push(this),h(oe,this,p(N,this)?p(M,p(N,this)).length:0)}get hasMagic(){if(p(ie,this)!==void 0)return p(ie,this);for(let e of p(M,this))if(typeof e!=`string`&&(e.type||e.hasMagic))return h(ie,this,!0);return p(ie,this)}toString(){return p(ue,this)===void 0?this.type?h(ue,this,this.type+`(`+p(M,this).map(e=>String(e)).join(`|`)+`)`):h(ue,this,p(M,this).map(e=>String(e)).join(``)):p(ue,this)}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof r&&p(N,t)===this))throw Error(`invalid part: `+t);p(M,this).push(t)}}toJSON(){let e=this.type===null?p(M,this).slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...p(M,this).map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===p(j,this)||p(ce,p(j,this))&&p(N,this)?.type===`!`)&&e.push({}),e}isStart(){if(p(j,this)===this)return!0;if(!p(N,this)?.isStart())return!1;if(p(oe,this)===0)return!0;let e=p(N,this);for(let t=0;t<p(oe,this);t++){let n=p(M,e)[t];if(!(n instanceof r&&n.type===`!`))return!1}return!0}isEnd(){if(p(j,this)===this||p(N,this)?.type===`!`)return!0;if(!p(N,this)?.isEnd())return!1;if(!this.type)return p(N,this)?.isEnd();let e=p(N,this)?p(M,p(N,this)).length:0;return p(oe,this)===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new r(this.type,e);for(let e of p(M,this))t.copyIn(e);return t}static fromGlob(t,n={}){let i=new r(null,void 0,n);return s(e,r,me).call(r,t,i,0,n,0),i}toMMPattern(){if(this!==p(j,this))return p(j,this).toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||p(ie,this)||p(le,this).nocase&&!p(le,this).nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(p(le,this).nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return p(le,this)}toRegExpSource(t){let n=t??!!p(le,this).dot;if(p(j,this)===this&&(s(P,this,Ce).call(this),s(P,this,pe).call(this)),!b(this)){let i=this.isStart()&&this.isEnd()&&!p(M,this).some(e=>typeof e!=`string`),a=p(M,this).map(n=>{let[a,o,c,l]=typeof n==`string`?s(e,r,Te).call(r,n,p(ie,this),i):n.toRegExpSource(t);return h(ie,this,p(ie,this)||c),h(ae,this,p(ae,this)||l),a}).join(``),o=``;if(this.isStart()&&typeof p(M,this)[0]==`string`&&!(p(M,this).length===1&&O.has(p(M,this)[0]))){let e=D,r=n&&e.has(a.charAt(0))||a.startsWith(`\\.`)&&e.has(a.charAt(2))||a.startsWith(`\\.\\.`)&&e.has(a.charAt(4)),i=!n&&!t&&e.has(a.charAt(0));o=r?T:i?E:``}let c=``;return this.isEnd()&&p(ce,p(j,this))&&p(N,this)?.type===`!`&&(c=`(?:$|\\/)`),[o+a+c,(0,_.unescape)(a),h(ie,this,!!p(ie,this)),p(ae,this)]}let i=this.type===`*`||this.type===`+`,a=this.type===`!`?`(?:(?!(?:`:`(?:`,o=s(P,this,we).call(this,n);if(this.isStart()&&this.isEnd()&&!o&&this.type!==`!`){let e=this.toString(),t=this;return h(M,t,[e]),t.type=null,h(ie,t,void 0),[e,(0,_.unescape)(this.toString()),!1,!1]}let c=!i||t||n?``:s(P,this,we).call(this,!0);c===o&&(c=``),c&&(o=`(?:${o})(?:${c})*?`);let l=``;if(this.type===`!`&&p(de,this))l=(this.isStart()&&!n?E:``)+re;else{let e=this.type===`!`?`))`+(this.isStart()&&!n&&!t?E:``)+ne+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&c?`)`:this.type===`*`&&c?`)?`:`)${this.type}`;l=a+o+e}return[l,(0,_.unescape)(o),h(ie,this,!!p(ie,this)),p(ae,this)]}};t=fe;function pe(){if(this!==p(j,this))throw Error(`should only call on root`);if(p(ce,this))return this;this.toString(),h(ce,this,!0);let e;for(;e=p(se,this).pop();){if(e.type!==`!`)continue;let t=e,n=p(N,t);for(;n;){for(let r=p(oe,t)+1;!n.type&&r<p(M,n).length;r++)for(let t of p(M,e)){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(p(M,n)[r])}t=n,n=p(N,t)}}return this}function me(e,n,i,a,o){let c=a.maxExtglobRecursion??2,l=!1,u=!1,d=-1,f=!1;if(n.type===null){let p=i,m=``;for(;p<e.length;){let i=e.charAt(p++);if(l||i===`\\`){l=!l,m+=i;continue}if(u){p===d+1?(i===`^`||i===`!`)&&(f=!0):i===`]`&&!(p===d+2&&f)&&(u=!1),m+=i;continue}else if(i===`[`){u=!0,d=p,f=!1,m+=i;continue}if(!a.noext&&y(i)&&e.charAt(p)===`(`&&o<=c){n.push(m),m=``;let c=new r(i,n);p=s(t,r,me).call(r,e,c,p,a,o+1),n.push(c);continue}m+=i}return n.push(m),p}let m=i+1,g=new r(null,n),_=[],v=``;for(;m<e.length;){let i=e.charAt(m++);if(l||i===`\\`){l=!l,v+=i;continue}if(u){m===d+1?(i===`^`||i===`!`)&&(f=!0):i===`]`&&!(m===d+2&&f)&&(u=!1),v+=i;continue}else if(i===`[`){u=!0,d=m,f=!1,v+=i;continue}if(!a.noext&&y(i)&&e.charAt(m)===`(`&&(o<=c||n&&s(P,n,_e).call(n,i))){let c=n&&s(P,n,_e).call(n,i)?0:1;g.push(v),v=``;let l=new r(i,g);g.push(l),m=s(t,r,me).call(r,e,l,m,a,o+c);continue}if(i===`|`){g.push(v),v=``,_.push(g),g=new r(null,n);continue}if(i===`)`)return v===``&&p(M,n).length===0&&h(de,n,!0),g.push(v),v=``,n.push(..._,g),m;v+=i}return n.type=null,h(ie,n,void 0),h(M,n,[e.substring(i-1)]),m}function he(e){return s(P,this,ge).call(this,e,S)}function ge(e,t=x){if(!e||typeof e!=`object`||e.type!==null||p(M,e).length!==1||this.type===null)return!1;let n=p(M,e)[0];return!n||typeof n!=`object`||n.type===null?!1:s(P,this,_e).call(this,n.type,t)}function _e(e,t=C){return!!t.get(this.type)?.includes(e)}function ve(e,t){let n=p(M,e)[0],i=new r(null,n,this.options);p(M,i).push(``),n.push(i),s(P,this,ye).call(this,e,t)}function ye(e,t){let n=p(M,e)[0];p(M,this).splice(t,1,...p(M,n));for(let e of p(M,n))typeof e==`object`&&h(N,e,this);h(ue,this,void 0)}function be(e){return!!w.get(this.type)?.has(e)}function xe(e){if(!e||typeof e!=`object`||e.type!==null||p(M,e).length!==1||this.type===null||p(M,this).length!==1)return!1;let t=p(M,e)[0];return!t||typeof t!=`object`||t.type===null?!1:s(P,this,be).call(this,t.type)}function Se(e){let t=w.get(this.type),n=p(M,e)[0],r=t?.get(n.type);if(!r)return!1;h(M,this,p(M,n));for(let e of p(M,this))typeof e==`object`&&h(N,e,this);this.type=r,h(ue,this,void 0),h(de,this,!1)}function Ce(){if(b(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<p(M,this).length;e++){let n=p(M,this)[e];typeof n==`object`&&(s(P,n,Ce).call(n),s(P,this,ge).call(this,n)?(t=!1,s(P,this,ye).call(this,n,e)):s(P,this,he).call(this,n)?(t=!1,s(P,this,ve).call(this,n,e)):s(P,this,xe).call(this,n)&&(t=!1,s(P,this,Se).call(this,n)))}}while(!t&&++e<10)}else for(let e of p(M,this))typeof e==`object`&&s(P,e,Ce).call(e);h(ue,this,void 0)}function we(e){return p(M,this).map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return h(ae,this,p(ae,this)||a),n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}function Te(e,t,n=!1){let r=!1,a=``,o=!1,s=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(r){r=!1,a+=(k.has(l)?`\\`:``)+l;continue}if(l===`*`){if(s)continue;s=!0,a+=n&&/^[*]+$/.test(e)?re:ne,t=!0;continue}else s=!1;if(l===`\\`){c===e.length-1?a+=`\\\\`:r=!0;continue}if(l===`[`){let[n,r,s,l]=(0,i.parseClass)(e,c);if(s){a+=n,o=o||r,c+=s-1,t=t||l;continue}}if(l===`?`){a+=te,t=!0;continue}a+=ee(l)}return[a,(0,_.unescape)(e),!!t,o]}e.AST=fe,r=fe})),wM=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.escape=void 0,e.escape=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`)})),TM=i((e=>{g(),a(),f(),Object.defineProperty(e,`__esModule`,{value:!0}),e.unescape=e.escape=e.AST=e.Minimatch=e.match=e.makeRe=e.braceExpand=e.defaults=e.filter=e.GLOBSTAR=e.sep=e.minimatch=void 0;var t=yM(),n=bM(),r=CM(),i=wM(),c=SM();e.minimatch=(e,t,r={})=>((0,n.assertValidPattern)(t),!r.nocomment&&t.charAt(0)===`#`?!1:new se(t,r).match(e));var l=/^\*+([^+@!?*[(]*)$/,d=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),p=e=>t=>t.endsWith(e),m=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),h=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),_=/^\*+\.\*+$/,v=e=>!e.startsWith(`.`)&&e.includes(`.`),y=e=>e!==`.`&&e!==`..`&&e.includes(`.`),b=/^\.\*+$/,x=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),S=/^\*+$/,C=e=>e.length!==0&&!e.startsWith(`.`),w=e=>e.length!==0&&e!==`.`&&e!==`..`,T=/^\?+([^+@!?*[(]*)?$/,E=([e,t=``])=>{let n=ee([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},D=([e,t=``])=>{let n=te([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},O=([e,t=``])=>{let n=te([e]);return t?e=>n(e)&&e.endsWith(t):n},k=([e,t=``])=>{let n=ee([e]);return t?e=>n(e)&&e.endsWith(t):n},ee=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},te=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ne=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,re={win32:{sep:`\\`},posix:{sep:`/`}};e.sep=ne===`win32`?re.win32.sep:re.posix.sep,e.minimatch.sep=e.sep,e.GLOBSTAR=Symbol(`globstar **`),e.minimatch.GLOBSTAR=e.GLOBSTAR;var A=`[^/]*?`,j=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,ie=`(?:(?!(?:\\/|^)\\.).)*?`;e.filter=(t,n={})=>r=>(0,e.minimatch)(r,t,n),e.minimatch.filter=e.filter;var ae=(e,t={})=>Object.assign({},e,t);e.defaults=t=>{if(!t||typeof t!=`object`||!Object.keys(t).length)return e.minimatch;let n=e.minimatch;return Object.assign((e,r,i={})=>n(e,r,ae(t,i)),{Minimatch:class extends n.Minimatch{constructor(e,n={}){super(e,ae(t,n))}static defaults(e){return n.defaults(ae(t,e)).Minimatch}},AST:class extends n.AST{constructor(e,n,r={}){super(e,n,ae(t,r))}static fromGlob(e,r={}){return n.AST.fromGlob(e,ae(t,r))}},unescape:(e,r={})=>n.unescape(e,ae(t,r)),escape:(e,r={})=>n.escape(e,ae(t,r)),filter:(e,r={})=>n.filter(e,ae(t,r)),defaults:e=>n.defaults(ae(t,e)),makeRe:(e,r={})=>n.makeRe(e,ae(t,r)),braceExpand:(e,r={})=>n.braceExpand(e,ae(t,r)),match:(e,r,i={})=>n.match(e,r,ae(t,i)),sep:n.sep,GLOBSTAR:e.GLOBSTAR})},e.minimatch.defaults=e.defaults,e.braceExpand=(e,r={})=>((0,n.assertValidPattern)(e),r.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:(0,t.expand)(e,{max:r.braceExpandMax})),e.minimatch.braceExpand=e.braceExpand,e.makeRe=(e,t={})=>new se(e,t).makeRe(),e.minimatch.makeRe=e.makeRe,e.match=(e,t,n={})=>{let r=new se(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e},e.minimatch.match=e.match;var M=/[?*]|[+@!]\(.*?\)|\[|\]/,N=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),oe=new WeakSet,se=class{constructor(e,t={}){u(this,oe),o(this,`options`,void 0),o(this,`set`,void 0),o(this,`pattern`,void 0),o(this,`windowsPathsNoEscape`,void 0),o(this,`nonegate`,void 0),o(this,`negate`,void 0),o(this,`comment`,void 0),o(this,`empty`,void 0),o(this,`preserveMultipleSlashes`,void 0),o(this,`partial`,void 0),o(this,`globSet`,void 0),o(this,`globParts`,void 0),o(this,`nocase`,void 0),o(this,`isWindows`,void 0),o(this,`platform`,void 0),o(this,`windowsNoMagicRoot`,void 0),o(this,`maxGlobstarRecursion`,void 0),o(this,`regexp`,void 0),(0,n.assertValidPattern)(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ne,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!M.test(e[2]))&&!M.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(t,n,r=!1){let i=0,a=0;if(this.isWindows){let e=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),r=!e&&t[0]===``&&t[1]===``&&t[2]===`?`&&/^[a-z]:$/i.test(t[3]),o=typeof n[0]==`string`&&/^[a-z]:$/i.test(n[0]),s=!o&&n[0]===``&&n[1]===``&&n[2]===`?`&&typeof n[3]==`string`&&/^[a-z]:$/i.test(n[3]),c=r?3:e?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[e,r]=[t[c],n[l]];e.toLowerCase()===r.toLowerCase()&&(n[l]=e,a=l,i=c)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(e.GLOBSTAR)?s(oe,this,ce).call(this,t,n,r,i,a):s(oe,this,ue).call(this,t,n,r,i,a)}braceExpand(){return(0,e.braceExpand)(this.pattern,this.options)}parse(t){(0,n.assertValidPattern)(t);let i=this.options;if(t===`**`)return e.GLOBSTAR;if(t===``)return``;let a,o=null;(a=t.match(S))?o=i.dot?w:C:(a=t.match(l))?o=(i.nocase?i.dot?h:m:i.dot?p:d)(a[1]):(a=t.match(T))?o=(i.nocase?i.dot?D:E:i.dot?O:k)(a):(a=t.match(_))?o=i.dot?y:v:(a=t.match(b))&&(o=x);let s=r.AST.fromGlob(t,this.options).toMMPattern();return o&&typeof s==`object`&&Reflect.defineProperty(s,`test`,{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?A:n.dot?j:ie,i=new Set(n.nocase?[`i`]:[]),a=t.map(t=>{let n=t.map(t=>{if(t instanceof RegExp)for(let e of t.flags.split(``))i.add(e);return typeof t==`string`?N(t):t===e.GLOBSTAR?e.GLOBSTAR:t._src});n.forEach((t,i)=>{let a=n[i+1],o=n[i-1];t!==e.GLOBSTAR||o===e.GLOBSTAR||(o===void 0?a!==void 0&&a!==e.GLOBSTAR?n[i+1]=`(?:\\/|`+r+`\\/)?`+a:n[i]=r:a===void 0?n[i-1]=o+`(?:\\/|\\/`+r+`)?`:a!==e.GLOBSTAR&&(n[i-1]=o+`(?:\\/|\\/`+r+`\\/)`+a,n[i+1]=e.GLOBSTAR))});let a=n.filter(t=>t!==e.GLOBSTAR);if(this.partial&&a.length>=1){let e=[];for(let t=1;t<=a.length;t++)e.push(a.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return a.join(`/`)}).join(`|`),[o,s]=t.length>1?[`(?:`,`)`]:[``,``];a=`^`+o+a+s+`$`,this.partial&&(a=`^(?:\\/|`+o+a.slice(1,-1)+s+`)$`),this.negate&&(a=`^(?!`+a+`).+$`);try{this.regexp=new RegExp(a,[...i].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return e.minimatch.defaults(t).Minimatch}};function ce(t,n,r,i,a){let o=n.indexOf(e.GLOBSTAR,a),c=n.lastIndexOf(e.GLOBSTAR),[l,u,d]=r?[n.slice(a,o),n.slice(o+1),[]]:[n.slice(a,o),n.slice(o+1,c),n.slice(c+1)];if(l.length){let e=t.slice(i,i+l.length);if(!s(oe,this,ue).call(this,e,l,r,0,0))return!1;i+=l.length,a+=l.length}let f=0;if(d.length){if(d.length+i>t.length)return!1;let e=t.length-d.length;if(s(oe,this,ue).call(this,t,d,r,e,0))f=d.length;else{if(t[t.length-1]!==``||i+d.length===t.length||(e--,!s(oe,this,ue).call(this,t,d,r,e,0)))return!1;f=d.length+1}}if(!u.length){let e=!!f;for(let n=i;n<t.length-f;n++){let r=String(t[n]);if(e=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return r||e}let p=[[[],0]],m=p[0],h=0,g=[0];for(let t of u)t===e.GLOBSTAR?(g.push(h),m=[[],0],p.push(m)):(m[0].push(t),h++);let _=p.length-1,v=t.length-f;for(let e of p)e[1]=v-(g[_--]+e[0].length);return!!s(oe,this,le).call(this,t,p,i,0,r,0,!!f)}function le(e,t,n,r,i,a,o){let c=t[r];if(!c){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[l,u]=c;for(;n<=u;){if(s(oe,this,ue).call(this,e.slice(0,n+l.length),l,i,n,0)&&a<this.maxGlobstarRecursion){let c=s(oe,this,le).call(this,e,t,n+l.length,r+1,i,a+1,o);if(c!==!1)return c}let c=e[n];if(c===`.`||c===`..`||!this.options.dot&&c.startsWith(`.`))return!1;n++}return i||null}function ue(t,n,r,i,a){let o,s,c,l;for(o=i,s=a,l=t.length,c=n.length;o<l&&s<c;o++,s++){this.debug(`matchOne loop`);let r=n[s],i=t[o];if(this.debug(n,r,i),r===!1||r===e.GLOBSTAR)return!1;let a;if(typeof r==`string`?(a=i===r,this.debug(`string match`,r,i,a)):(a=r.test(i),this.debug(`pattern match`,r,i,a)),!a)return!1}if(o===l&&s===c)return!0;if(o===l)return r;if(s===c)return o===l-1&&t[o]===``;throw Error(`wtf?`)}e.Minimatch=se;var de=CM();Object.defineProperty(e,`AST`,{enumerable:!0,get:function(){return de.AST}});var P=wM();Object.defineProperty(e,`escape`,{enumerable:!0,get:function(){return P.escape}});var fe=SM();Object.defineProperty(e,`unescape`,{enumerable:!0,get:function(){return fe.unescape}}),e.minimatch.AST=r.AST,e.minimatch.Minimatch=se,e.minimatch.escape=i.escape,e.minimatch.unescape=c.unescape})),EM=i(((n,r)=>{a();var i=t(`node:diagnostics_channel`),{context:s,trace:c,SpanStatusCode:l,propagation:u,diag:d}=(T(),e(k)),{getRPCMetadata:f,RPCType:p}=(ui(),e(ci)),{ATTR_HTTP_ROUTE:m,ATTR_HTTP_RESPONSE_STATUS_CODE:h,ATTR_HTTP_REQUEST_METHOD:g,ATTR_URL_PATH:_}=(F(),e(A)),{InstrumentationBase:v}=(Zj(),e(Xj)),{version:y,name:b}=(_M(),e(Qj).default),x=`>=4.0.0 <6`,S=[`onRequest`,`preParsing`,`preValidation`,`preHandler`,`preSerialization`,`onSend`,`onResponse`,`onError`],C={HOOK_NAME:`hook.name`,FASTIFY_TYPE:`fastify.type`,HOOK_CALLBACK_NAME:`hook.callback.name`,ROOT:`fastify.root`},w={ROUTE:`route-hook`,INSTANCE:`hook`,HANDLER:`request-handler`},E=`anonymous`,D=Symbol(`fastify otel instance`),O=Symbol(`fastify otel request spans`),ee=Symbol(`fastify otel request context`),te=Symbol(`fastify otel addhook original`),ne=Symbol(`fastify otel setnotfound original`),re=Symbol(`fastify otel ignore path`),j=Symbol(`fastify otel record exceptions`),ie=class extends v{constructor(e){if(super(b,y,e),o(this,`logger`,null),o(this,`_requestHook`,null),o(this,`_lifecycleHook`,null),this.logger=d.createComponentLogger({namespace:b}),this[re]=null,this[j]=!0,e?.recordExceptions!=null){if(typeof e.recordExceptions!=`boolean`)throw TypeError(`recordExceptions must be a boolean`);this[j]=e.recordExceptions}if(typeof e?.requestHook==`function`&&(this._requestHook=e.requestHook),typeof e?.lifecycleHook==`function`&&(this._lifecycleHook=e.lifecycleHook),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let t=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof t!=`string`||t.length===0)&&typeof t!=`function`)throw TypeError(`ignorePaths must be a string or a function`);let n=null;this[re]=e=>typeof t==`function`?t(e):(n??(n=TM().minimatch),n(e.url,t))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=e=>{this.plugin()(e.fastify,void 0,()=>{});let t=(e,t,n)=>{n()};t[Symbol.for(`skip-override`)]=!0,t[Symbol.for(`fastify.display-name`)]=`@fastify/otel`,e.fastify.register(t)},i.subscribe(`fastify.initialization`,this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&(i.unsubscribe(`fastify.initialization`,this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return t[Symbol.for(`skip-override`)]=!0,t[Symbol.for(`fastify.display-name`)]=`@fastify/otel`,t[Symbol.for(`plugin-meta`)]={fastify:x,name:`@fastify/otel`},t;function t(t,n,r){t.decorate(D,e),t.decorate(te,t.addHook),t.decorate(ne,t.setNotFoundHandler),t.decorateRequest(`opentelemetry`,function(){let t=this[ee],n=this[O];return{enabled:this.routeOptions.config?.otel!==!1,span:n,tracer:e.tracer,context:t,inject:(e,n)=>u.inject(t,e,n),extract:(e,n)=>u.extract(t,e,n)}}),t.decorateRequest(O,null),t.decorateRequest(ee,null),t.addHook(`onRoute`,function(t){if(e[re]?.(t)===!0){e.logger.debug(`Ignoring route instrumentation ${t.method} ${t.url} because it matches the ignore path`);return}if(t.config?.otel===!1){e.logger.debug(`Ignoring route instrumentation ${t.method} ${t.url} because it is disabled`);return}for(let e of S)if(t[e]!=null){let n=t[e];if(typeof n==`function`)t[e]=y(n,e,{[C.HOOK_NAME]:`${this.pluginName} - route -> ${e}`,[C.FASTIFY_TYPE]:w.ROUTE,[m]:t.url,[C.HOOK_CALLBACK_NAME]:n.name?.length>0?n.name:E});else if(Array.isArray(n)){let r=[];for(let i of n)r.push(y(i,e,{[C.HOOK_NAME]:`${this.pluginName} - route -> ${e}`,[C.FASTIFY_TYPE]:w.ROUTE,[m]:t.url,[C.HOOK_CALLBACK_NAME]:i.name?.length>0?i.name:E}));t[e]=r}}t.onSend==null?t.onSend=i:t.onSend=Array.isArray(t.onSend)?[...t.onSend,i]:[t.onSend,i],t.onError==null?t.onError=a:t.onError=Array.isArray(t.onError)?[...t.onError,a]:[t.onError,a],t.handler=y(t.handler,`handler`,{[C.HOOK_NAME]:`${this.pluginName} - route-handler`,[C.FASTIFY_TYPE]:w.HANDLER,[m]:t.url,[C.HOOK_CALLBACK_NAME]:t.handler.name.length>0?t.handler.name:E})}),t.addHook(`onRequest`,function(e,t,n){if(this[D].isEnabled()===!1||e.routeOptions.config?.otel===!1)return n();if(this[D][re]?.({url:e.url,method:e.method})===!0)return this[D].logger.debug(`Ignoring request ${e.method} ${e.url} because it matches the ignore path`),n();let r=s.active();c.getSpan(r)??(r=u.extract(r,e.headers));let i=f(r);e.routeOptions.url!=null&&i?.type===p.HTTP&&(i.route=e.routeOptions.url);let a={[C.ROOT]:`@fastify/otel`,[g]:e.method,[_]:e.url};e.routeOptions.url!=null&&(a[m]=e.routeOptions.url);let o=this[D].tracer.startSpan(`request`,{attributes:a},r);try{this[D]._requestHook?.(o,e)}catch(e){this[D].logger.error({err:e},`requestHook threw`)}e[ee]=c.setSpan(r,o),e[O]=o,s.with(e[ee],()=>{n()})}),t.addHook(`onResponse`,function(e,t,n){let r=e[O];r!=null&&(r.setAttributes({[h]:t.statusCode}),r.end()),e[O]=null,n()}),t.addHook=o,t.setNotFoundHandler=d,r();function i(e,t,n,r){let i=e[O];i!=null&&(t.statusCode>=500&&i.setStatus({code:l.ERROR}),i.setAttributes({[h]:t.statusCode}),i.end()),e[O]=null,r(null,n)}function a(t,n,r,i){let a=t[O];a!=null&&(a.setStatus({code:l.ERROR,message:r.message}),e[j]!==!1&&a.recordException(r)),i()}function o(e,t){let n=this[te];return S.includes(e)?n.call(this,e,y(t,e,{[C.HOOK_NAME]:`${this.pluginName} - ${e}`,[C.FASTIFY_TYPE]:w.INSTANCE,[C.HOOK_CALLBACK_NAME]:t.name?.length>0?t.name:E})):n.call(this,e,t)}function d(e,t){let n=this[ne];typeof e==`function`?(t=y(e,`notFoundHandler`,{[C.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[C.FASTIFY_TYPE]:w.INSTANCE,[C.HOOK_CALLBACK_NAME]:e.name?.length>0?e.name:E}),n.call(this,t)):(e.preValidation!=null&&(e.preValidation=y(e.preValidation,`notFoundHandler - preValidation`,{[C.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[C.FASTIFY_TYPE]:w.INSTANCE,[C.HOOK_CALLBACK_NAME]:e.preValidation.name?.length>0?e.preValidation.name:E})),e.preHandler!=null&&(e.preHandler=y(e.preHandler,`notFoundHandler - preHandler`,{[C.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[C.FASTIFY_TYPE]:w.INSTANCE,[C.HOOK_CALLBACK_NAME]:e.preHandler.name?.length>0?e.preHandler.name:E})),t=y(t,`notFoundHandler`,{[C.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[C.FASTIFY_TYPE]:w.INSTANCE,[C.HOOK_CALLBACK_NAME]:t.name?.length>0?t.name:E}),n.call(this,e,t))}function v(e){for(let t of e)if(t?.routeOptions&&t.url&&t.method)return t;return null}function y(e,t,n={}){return function(...r){let i=this[D],a=v(r);if(a===null)return i.logger.debug(`Ignoring route instrumentation because ${t} was called without a Fastify request argument`),e.call(this,...r);if(i.isEnabled()===!1||a.routeOptions.config?.otel===!1)return i.logger.debug(`Ignoring route instrumentation ${a.routeOptions.method} ${a.routeOptions.url} because it is disabled`),e.call(this,...r);if(i[re]?.({url:a.url,method:a.method})===!0)return i.logger.debug(`Ignoring route instrumentation ${a.routeOptions.method} ${a.routeOptions.url} because it matches the ignore path`),e.call(this,...r);let o=a[ee]??s.active(),u=e.name?.length>0?e.name:this.pluginName??E,d=i.tracer.startSpan(`${t} - ${u}`,{attributes:n},o);if(i._lifecycleHook!=null)try{i._lifecycleHook(d,{hookName:t,request:a,handler:u})}catch(e){i.logger.error({err:e},`Execution of lifecycleHook failed`)}return s.with(c.setSpan(o,d),function(){try{let t=e.call(this,...r);return typeof t?.then==`function`?t.then(e=>(d.end(),e),e=>(d.setStatus({code:l.ERROR,message:e.message}),i[j]!==!1&&d.recordException(e),d.end(),Promise.reject(e))):(d.end(),t)}catch(e){throw d.setStatus({code:l.ERROR,message:e.message}),i[j]!==!1&&d.recordException(e),d.end(),e}},this)}}}}};r.exports=ie,r.exports.FastifyOtelInstrumentation=ie})),DM,OM,kM,AM=n((()=>{(function(e){e.FASTIFY_NAME=`fastify.name`,e.FASTIFY_TYPE=`fastify.type`,e.HOOK_NAME=`hook.name`,e.PLUGIN_NAME=`plugin.name`})(DM||(DM={})),(function(e){e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`})(OM||(OM={})),(function(e){e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request handler`})(kM||(kM={}))})),jM,MM=n((()=>{jM=Symbol(`opentelemetry.instrumentation.fastify.request_active_span`)}));function NM(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),a=e[jM]||[];return a.push(i),Object.defineProperty(e,jM,{enumerable:!1,configurable:!0,value:a}),i}function PM(e,t){let n=e[jM]||[];n.length&&(n.forEach(e=>{t&&(e.setStatus({code:b.ERROR,message:t.message}),e.recordException(t)),e.end()}),delete e[jM])}function FM(e,t,n){let r,i;try{i=e(),IM(i)&&i.then(e=>t(void 0,e),e=>t(e))}catch(e){r=e}finally{if(!IM(i)&&(t(r,i),r))throw r;return i}}function IM(e){return typeof e==`object`&&e&&typeof Object.getOwnPropertyDescriptor(e,`then`)?.value==`function`||!1}var LM=n((()=>{T(),MM()}));function RM(){let e=W();e&&e.on(`spanStart`,e=>{zM(e)})}function zM(e){let t=q(e).data,n=t[`fastify.type`];if(t[`sentry.op`]||!n)return;e.setAttributes({[K]:`auto.http.otel.fastify`,[G]:`${n}.fastify`});let r=t[`fastify.name`]||t[`plugin.name`]||t[`hook.name`];if(typeof r==`string`){let t=r.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``);e.updateName(t)}}var BM,VM,HM,UM,WM,GM=n((()=>{T(),be(),L(),F(),X(),AM(),LM(),BM=`0.1.0`,VM=`@sentry/instrumentation-fastify-v3`,HM=`anonymous`,UM=new Set([`onTimeout`,`onRequest`,`preParsing`,`preValidation`,`preSerialization`,`preHandler`,`onSend`,`onResponse`,`onError`]),WM=class extends Za{constructor(e={}){super(VM,BM,e)}init(){return[new no(`fastify`,[`>=3.0.0 <4`],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(t,n,r){if(!e.isEnabled())return r();e._wrap(n,`send`,e._patchSend());let i=t,a=je(O.active()),o=i.routeOptions?i.routeOptions.url:t.routerPath;o&&a?.type===Fe.HTTP&&(a.route=o);let s=t.method||`GET`;cl().setTransactionName(`${s} ${o}`),r()}}_wrapHandler(e,t,n,r){let i=this;return this._diag.debug(`Patching fastify route.handler function`),function(...a){if(!i.isEnabled())return n.apply(this,a);let o=n.name||e||HM,s=`${kM.MIDDLEWARE} - ${o}`,c=a[1],l=NM(c,i.tracer,s,{[DM.FASTIFY_TYPE]:OM.MIDDLEWARE,[DM.PLUGIN_NAME]:e,[DM.HOOK_NAME]:t}),u=r&&a[a.length-1];return u&&(a[a.length-1]=function(...e){PM(c),u.apply(this,e)}),O.with(D.setSpan(O.active(),l),()=>FM(()=>n.apply(this,a),e=>{e instanceof Error&&(l.setStatus({code:b.ERROR,message:e.message}),l.recordException(e)),r||PM(c)}))}}_wrapAddHook(){let e=this;return this._diag.debug(`Patching fastify server.addHook function`),function(t){return function(...n){let r=n[0],i=n[1],a=this.pluginName;if(!UM.has(r))return t.apply(this,n);let o=typeof n[n.length-1]==`function`&&i.constructor.name!==`AsyncFunction`;return t.apply(this,[r,e._wrapHandler(a,r,i,o)])}}}_patchConstructor(e){let t=this;function n(...n){let r=e.fastify.apply(this,n);return r.addHook(`onRequest`,t._hookOnRequest()),r.addHook(`preHandler`,t._hookPreHandler()),RM(),t._wrap(r,`addHook`,t._wrapAddHook()),r}return e.errorCodes!==void 0&&(n.errorCodes=e.errorCodes),n.fastify=n,n.default=n,n}_patchSend(){let e=this;return this._diag.debug(`Patching fastify reply.send function`),function(t){return function(...n){let r=n[0];return e.isEnabled()?Wa(()=>t.apply(this,n),e=>{!e&&r instanceof Error&&(e=r),PM(this,e)}):t.apply(this,n)}}}_hookPreHandler(){let e=this;return this._diag.debug(`Patching fastify preHandler function`),function(t,n,r){if(!e.isEnabled())return r();let i=t,a=i.routeOptions?.handler||i.context?.handler,o=a?.name.startsWith(`bound `)?a.name.substring(6):a?.name,s=`${kM.REQUEST_HANDLER} - ${o||this.pluginName||HM}`,c={[DM.PLUGIN_NAME]:this.pluginName,[DM.FASTIFY_TYPE]:OM.REQUEST_HANDLER,[Ie]:i.routeOptions?i.routeOptions.url:t.routerPath};o&&(c[DM.FASTIFY_NAME]=o);let l=NM(n,e.tracer,s,c);zM(l);let{requestHook:u}=e.getConfig();return u&&Wa(()=>u(l,{request:t}),t=>{t&&e._diag.error(`request hook failed`,t)},!0),O.with(D.setSpan(O.active(),l),()=>{r()})}}}}));function KM(){let e=W();if(e)return e.getIntegrationByName($M)}function qM(e,t,n,r){let i=KM()?.getShouldHandleError()||JM;if(r===`diagnostics-channel`&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r===`onError-hook`){Kk&&V.warn(`Fastify error handler was already registered via diagnostics channel.`,"You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}i(e,t,n)&&J(e,{mechanism:{handled:!1,type:`auto.function.fastify`}})}function JM(e,t,n){let r=n.statusCode;return r>=500||r<=299}function YM(e){let t=q(e),n=t.description,r=t.data,i=r[`fastify.type`],a=i===`hook`,o=i===n?.startsWith(`handler -`),s=n===`request`||i===`request-handler`;if(r[`sentry.op`]||!o&&!s&&!a)return;let c=a?`hook`:o?`middleware`:s?`request_handler`:`<unknown>`;e.setAttributes({[K]:`auto.http.otel.fastify`,[G]:`${c}.fastify`});let l=r[`fastify.name`]||r[`plugin.name`]||r[`hook.name`];if(typeof l==`string`){let t=l.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``);e.updateName(t)}}function XM(){let e=W();e&&e.on(`spanStart`,e=>{YM(e)})}function ZM(e){e.addHook(`onRequest`,async(e,t)=>{if(e.opentelemetry){let{span:t}=e.opentelemetry();t&&YM(t)}let n=e.routeOptions?.url,r=e.method||`GET`;cl().setTransactionName(`${r} ${n}`)})}var QM,$M,eN,tN,nN,rN,iN=n((()=>{QM=EM(),X(),$(),qk(),GM(),$M=`Fastify`,eN=Z(`${$M}.v3`,()=>new WM),tN=Z(`${$M}.v5`,()=>{let e=new QM.FastifyOtelInstrumentation,t=e.plugin();return xt.subscribe(`fastify.initialization`,e=>{let n=e.fastify;n?.register(t).after(e=>{e?Kk&&V.error(`Failed to setup Fastify instrumentation`,e):(XM(),n&&ZM(n))})}),xt.subscribe(`tracing:fastify.request.handler:error`,e=>{let{error:t,request:n,reply:r}=e;qM.call(qM,t,n,r,`diagnostics-channel`)}),e}),nN=(({shouldHandleError:e})=>{let t;return{name:$M,setupOnce(){t=e||JM,eN(),tN()},getShouldHandleError(){return t},setShouldHandleError(e){t=e}}}),rN=Y((e={})=>nN(e))})),aN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SpanNames=e.TokenKind=e.AllowedOperationTypes=void 0,(function(e){e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`})(e.AllowedOperationTypes||(e.AllowedOperationTypes={})),(function(e){e.SOF=`<SOF>`,e.EOF=`<EOF>`,e.BANG=`!`,e.DOLLAR=`$`,e.AMP=`&`,e.PAREN_L=`(`,e.PAREN_R=`)`,e.SPREAD=`...`,e.COLON=`:`,e.EQUALS=`=`,e.AT=`@`,e.BRACKET_L=`[`,e.BRACKET_R=`]`,e.BRACE_L=`{`,e.PIPE=`|`,e.BRACE_R=`}`,e.NAME=`Name`,e.INT=`Int`,e.FLOAT=`Float`,e.STRING=`String`,e.BLOCK_STRING=`BlockString`,e.COMMENT=`Comment`})(e.TokenKind||(e.TokenKind={})),(function(e){e.EXECUTE=`graphql.execute`,e.PARSE=`graphql.parse`,e.RESOLVE=`graphql.resolve`,e.VALIDATE=`graphql.validate`,e.SCHEMA_VALIDATE=`graphql.validateSchema`,e.SCHEMA_PARSE=`graphql.parseSchema`})(e.SpanNames||(e.SpanNames={}))})),oN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=void 0,(function(e){e.SOURCE=`graphql.source`,e.FIELD_NAME=`graphql.field.name`,e.FIELD_PATH=`graphql.field.path`,e.FIELD_TYPE=`graphql.field.type`,e.PARENT_NAME=`graphql.parent.name`,e.OPERATION_TYPE=`graphql.operation.type`,e.OPERATION_NAME=`graphql.operation.name`,e.VARIABLES=`graphql.variables.`,e.ERROR_VALIDATION_NAME=`graphql.validation.error`})(e.AttributeNames||(e.AttributeNames={}))})),sN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OTEL_GRAPHQL_DATA_SYMBOL=e.OTEL_PATCHED_SYMBOL=void 0,e.OTEL_PATCHED_SYMBOL=Symbol.for(`opentelemetry.patched`),e.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for(`opentelemetry.graphql_data`)})),cN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.OPERATION_NOT_SUPPORTED=void 0,sN(),e.OPERATION_NOT_SUPPORTED=`Operation$operationName$not supported`})),lN=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.wrapFieldResolver=t.wrapFields=t.getSourceFromLocation=t.getOperation=t.endSpan=t.addSpanSource=t.addInputVariableAttributes=t.isPromise=void 0;var n=(T(),e(k)),r=aN(),i=oN(),a=sN(),o=Object.values(r.AllowedOperationTypes);t.isPromise=e=>typeof e?.then==`function`;var s=e=>typeof e==`object`&&!!e;function c(e,t,n){Array.isArray(n)?n.forEach((n,r)=>{c(e,`${t}.${r}`,n)}):n instanceof Object?Object.entries(n).forEach(([n,r])=>{c(e,`${t}.${n}`,r)}):e.setAttribute(`${i.AttributeNames.VARIABLES}${String(t)}`,n)}function l(e,t){Object.entries(t).forEach(([t,n])=>{c(e,t,n)})}t.addInputVariableAttributes=l;function u(e,t,n,r,a){let o=w(t,n,r,a);e.setAttribute(i.AttributeNames.SOURCE,o)}t.addSpanSource=u;function d(e,t,n,r,i){let a=g(n,i);return a?{field:a,spanAdded:!1}:(a={span:f(e,t,n,r,i,t().flatResolveSpans?v(n):_(n,i))},h(n,i,a),{field:a,spanAdded:!0})}function f(e,t,o,s,c,l){let d={[i.AttributeNames.FIELD_NAME]:s.fieldName,[i.AttributeNames.FIELD_PATH]:c.join(`.`),[i.AttributeNames.FIELD_TYPE]:s.returnType.toString(),[i.AttributeNames.PARENT_NAME]:s.parentType.name},f=e.startSpan(`${r.SpanNames.RESOLVE} ${d[i.AttributeNames.FIELD_PATH]}`,{attributes:d},l?n.trace.setSpan(n.context.active(),l):void 0),p=o[a.OTEL_GRAPHQL_DATA_SYMBOL].source,m=s.fieldNodes.find(e=>e.kind===`Field`);return m&&u(f,p.loc,t().allowValues,m.loc?.start,m.loc?.end),f}function p(e,t){t&&e.recordException(t),e.end()}t.endSpan=p;function m(e,t){if(!(!e||!Array.isArray(e.definitions)))return t?e.definitions.filter(e=>o.indexOf(e?.operation)!==-1).find(e=>t===e?.name?.value):e.definitions.find(e=>o.indexOf(e?.operation)!==-1)}t.getOperation=m;function h(e,t,n){return e[a.OTEL_GRAPHQL_DATA_SYMBOL].fields[t.join(`.`)]=n}function g(e,t){return e[a.OTEL_GRAPHQL_DATA_SYMBOL].fields[t.join(`.`)]}function _(e,t){for(let n=t.length-1;n>0;n--){let r=g(e,t.slice(0,n));if(r)return r.span}return v(e)}function v(e){return e[a.OTEL_GRAPHQL_DATA_SYMBOL].span}function y(e,t){let n=[],r=t;for(;r;){let t=r.key;e&&typeof t==`number`&&(t=`*`),n.push(String(t)),r=r.prev}return n.reverse()}function b(e){return S(`
|
|
13
|
+
`,e)}function x(e){return S(` `,e)}function S(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}var C=[r.TokenKind.FLOAT,r.TokenKind.STRING,r.TokenKind.INT,r.TokenKind.BLOCK_STRING];function w(e,t=!1,n,i){let a=``;if(e?.startToken){let o=typeof n==`number`?n:e.start,s=typeof i==`number`?i:e.end,c=e.startToken.next,l=1;for(;c;){if(c.start<o){c=c.next,l=c?.line;continue}if(c.end>s){c=c.next,l=c?.line;continue}let e=c.value||c.kind,n=``;!t&&C.indexOf(c.kind)>=0&&(e=`*`),c.kind===r.TokenKind.STRING&&(e=`"${e}"`),c.kind===r.TokenKind.EOF&&(e=``),c.line>l?(a+=b(c.line-l),l=c.line,n=x(c.column-1)):c.line===c.prev?.line&&(n=x(c.start-(c.prev?.end||0))),a+=n+e,c&&(c=c.next)}}return a}t.getSourceFromLocation=w;function E(e,t,n){if(!e||e[a.OTEL_PATCHED_SYMBOL])return;let r=e.getFields();e[a.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(e=>{let i=r[e];if(i&&(i.resolve&&(i.resolve=re(t,n,i.resolve)),i.type)){let e=D(i.type);for(let r of e)E(r,t,n)}})}t.wrapFields=E;function D(e){return`ofType`in e?D(e.ofType):O(e)?e.getTypes():ee(e)?[e]:[]}function O(e){return`getTypes`in e&&typeof e.getTypes==`function`}function ee(e){return`getFields`in e&&typeof e.getFields==`function`}var te=(e,t,r)=>{r&&(e.recordException(t),e.setStatus({code:n.SpanStatusCode.ERROR,message:t.message}),e.end())},ne=(e,t)=>{t&&e.end()};function re(e,r,i,o=!1){if(c[a.OTEL_PATCHED_SYMBOL]||typeof i!=`function`)return i;function c(c,l,u,f){if(!i)return;let p=r();if(p.ignoreTrivialResolveSpans&&o&&(s(c)||typeof c==`function`)&&typeof c[f.fieldName]!=`function`||!u[a.OTEL_GRAPHQL_DATA_SYMBOL])return i.call(this,c,l,u,f);let m=y(p.mergeItems,f&&f.path),h=m.filter(e=>typeof e==`string`).length,g,v=!1;if(p.depth>=0&&p.depth<h)g=_(u,m);else{let{field:t,spanAdded:n}=d(e,r,u,f,m);g=t.span,v=n}return n.context.with(n.trace.setSpan(n.context.active(),g),()=>{try{let e=i.call(this,c,l,u,f);return(0,t.isPromise)(e)?e.then(e=>(ne(g,v),e),e=>{throw te(g,e,v),e}):(ne(g,v),e)}catch(e){throw te(g,e,v),e}})}return c[a.OTEL_PATCHED_SYMBOL]=!0,c}t.wrapFieldResolver=re})),uN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.62.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-graphql`})),dN=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.GraphQLInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=aN(),a=oN(),o=sN(),s=cN(),c=lN(),l=uN(),u={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},d=[`>=14.0.0 <17`];t.GraphQLInstrumentation=class extends r.InstrumentationBase{constructor(e={}){super(l.PACKAGE_NAME,l.PACKAGE_VERSION,{...u,...e})}setConfig(e={}){super.setConfig({...u,...e})}init(){let e=new r.InstrumentationNodeModuleDefinition(`graphql`,d);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new r.InstrumentationNodeModuleFile(`graphql/execution/execute.js`,d,e=>((0,r.isWrapped)(e.execute)&&this._unwrap(e,`execute`),this._wrap(e,`execute`,this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,`execute`)})}_addPatchingParser(){return new r.InstrumentationNodeModuleFile(`graphql/language/parser.js`,d,e=>((0,r.isWrapped)(e.parse)&&this._unwrap(e,`parse`),this._wrap(e,`parse`,this._patchParse()),e),e=>{e&&this._unwrap(e,`parse`)})}_addPatchingValidate(){return new r.InstrumentationNodeModuleFile(`graphql/validation/validate.js`,d,e=>((0,r.isWrapped)(e.validate)&&this._unwrap(e,`validate`),this._wrap(e,`validate`,this._patchValidate()),e),e=>{e&&this._unwrap(e,`validate`)})}_patchExecute(e){let t=this;return function(i){return function(){let a;if(arguments.length>=2){let n=arguments;a=t._wrapExecuteArgs(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],e)}else{let n=arguments[0];a=t._wrapExecuteArgs(n.schema,n.document,n.rootValue,n.contextValue,n.variableValues,n.operationName,n.fieldResolver,n.typeResolver,e)}let s=(0,c.getOperation)(a.document,a.operationName),l=t._createExecuteSpan(s,a);return a.contextValue[o.OTEL_GRAPHQL_DATA_SYMBOL]={source:a.document?a.document||a.document[o.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:l,fields:{}},n.context.with(n.trace.setSpan(n.context.active(),l),()=>(0,r.safeExecuteInTheMiddle)(()=>i.apply(this,[a]),(e,n)=>{t._handleExecutionResult(l,e,n)}))}}}_handleExecutionResult(e,t,n){let r=this.getConfig();if(n===void 0||t){(0,c.endSpan)(e,t);return}if((0,c.isPromise)(n))n.then(t=>{if(typeof r.responseHook!=`function`){(0,c.endSpan)(e);return}this._executeResponseHook(e,t)},t=>{(0,c.endSpan)(e,t)});else{if(typeof r.responseHook!=`function`){(0,c.endSpan)(e);return}this._executeResponseHook(e,n)}}_executeResponseHook(e,t){let{responseHook:n}=this.getConfig();n&&(0,r.safeExecuteInTheMiddle)(()=>{n(e,t)},t=>{t&&this._diag.error(`Error running response hook`,t),(0,c.endSpan)(e,void 0)},!0)}_patchParse(){let e=this;return function(t){return function(n,r){return e._parse(this,t,n,r)}}}_patchValidate(){let e=this;return function(t){return function(n,r,i,a,o){return e._validate(this,t,n,r,i,o,a)}}}_parse(e,t,a,o){let s=this.getConfig(),l=this.tracer.startSpan(i.SpanNames.PARSE);return n.context.with(n.trace.setSpan(n.context.active(),l),()=>(0,r.safeExecuteInTheMiddle)(()=>t.call(e,a,o),(e,t)=>{t&&((0,c.getOperation)(t)?t.loc&&(0,c.addSpanSource)(l,t.loc,s.allowValues):l.updateName(i.SpanNames.SCHEMA_PARSE)),(0,c.endSpan)(l,e)}))}_validate(e,t,o,s,l,u,d){let f=this.tracer.startSpan(i.SpanNames.VALIDATE,{});return n.context.with(n.trace.setSpan(n.context.active(),f),()=>(0,r.safeExecuteInTheMiddle)(()=>t.call(e,o,s,l,d,u),(e,t)=>{s.loc||f.updateName(i.SpanNames.SCHEMA_VALIDATE),t&&t.length&&f.recordException({name:a.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(t)}),(0,c.endSpan)(f,e)}))}_createExecuteSpan(e,t){let n=this.getConfig(),r=this.tracer.startSpan(i.SpanNames.EXECUTE,{});if(e){let{operation:t,name:n}=e;r.setAttribute(a.AttributeNames.OPERATION_TYPE,t);let i=n?.value;i?(r.setAttribute(a.AttributeNames.OPERATION_NAME,i),r.updateName(`${t} ${i}`)):r.updateName(t)}else{let e=` `;t.operationName&&(e=` "${t.operationName}" `),e=s.OPERATION_NOT_SUPPORTED.replace(`$operationName$`,e),r.setAttribute(a.AttributeNames.OPERATION_NAME,e)}return t.document?.loc&&(0,c.addSpanSource)(r,t.document.loc,n.allowValues),t.variableValues&&n.allowValues&&(0,c.addInputVariableAttributes)(r,t.variableValues),r}_wrapExecuteArgs(e,t,n,r,i,a,s,l,u){if(r||(r={}),r[o.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:s,typeResolver:l};let d=s==null,f=s??u;return s=(0,c.wrapFieldResolver)(this.tracer,()=>this.getConfig(),f,d),e&&((0,c.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,c.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:s,typeResolver:l}}}})),fN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.GraphQLInstrumentation=void 0;var t=dN();Object.defineProperty(e,`GraphQLInstrumentation`,{enumerable:!0,get:function(){return t.GraphQLInstrumentation}})}));function pN(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}function mN(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(`, `):`${t.slice(0,5).join(`, `)}, +${t.length-5}`}return`${e}`}var hN,gN,_N,vN,yN,bN=n((()=>{T(),hN=fN(),X(),$(),wE(),gN=`Graphql`,_N=Z(gN,hN.GraphQLInstrumentation,e=>{let t=pN(e);return{...t,responseHook(e,n){yk(e,`auto.graphql.otel.graphql`),n.errors?.length&&!q(e).status&&e.setStatus({code:b.ERROR});let r=q(e).data,i=r[`graphql.operation.type`],a=r[`graphql.operation.name`];if(t.useOperationNameForRootSpan&&i){let t=qu(e),n=q(t).data[`sentry.graphql.operation`]||[],r=a?`${i} ${a}`:`${i}`;Array.isArray(n)?(n.push(r),t.setAttribute(XT,n)):typeof n==`string`?t.setAttribute(XT,[n,r]):t.setAttribute(XT,r),q(t).data[`original-description`]||t.setAttribute(`original-description`,q(t).description),t.updateName(`${q(t).data[`original-description`]} (${mN(n)})`)}}}}),vN=((e={})=>({name:gN,setupOnce(){_N(pN(e))}})),yN=Y(vN)})),xN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.EVENT_LISTENERS_SET=void 0,e.EVENT_LISTENERS_SET=Symbol(`opentelemetry.instrumentation.kafkajs.eventListenersSet`)})),SN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.bufferTextMapGetter=void 0,e.bufferTextMapGetter={get(e,t){if(!e)return;let n=Object.keys(e);for(let r of n)if(r===t||r.toLowerCase()===t)return e[r]?.toString()},keys(e){return e?Object.keys(e):[]}}})),CN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.METRIC_MESSAGING_PROCESS_DURATION=e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=e.MESSAGING_SYSTEM_VALUE_KAFKA=e.MESSAGING_OPERATION_TYPE_VALUE_SEND=e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=e.ATTR_MESSAGING_SYSTEM=e.ATTR_MESSAGING_OPERATION_TYPE=e.ATTR_MESSAGING_OPERATION_NAME=e.ATTR_MESSAGING_KAFKA_OFFSET=e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=e.ATTR_MESSAGING_DESTINATION_NAME=e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0,e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=`messaging.batch.message_count`,e.ATTR_MESSAGING_DESTINATION_NAME=`messaging.destination.name`,e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=`messaging.destination.partition.id`,e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=`messaging.kafka.message.key`,e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=`messaging.kafka.message.tombstone`,e.ATTR_MESSAGING_KAFKA_OFFSET=`messaging.kafka.offset`,e.ATTR_MESSAGING_OPERATION_NAME=`messaging.operation.name`,e.ATTR_MESSAGING_OPERATION_TYPE=`messaging.operation.type`,e.ATTR_MESSAGING_SYSTEM=`messaging.system`,e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=`process`,e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=`receive`,e.MESSAGING_OPERATION_TYPE_VALUE_SEND=`send`,e.MESSAGING_SYSTEM_VALUE_KAFKA=`kafka`,e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=`messaging.client.consumed.messages`,e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=`messaging.client.operation.duration`,e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=`messaging.client.sent.messages`,e.METRIC_MESSAGING_PROCESS_DURATION=`messaging.process.duration`})),wN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.23.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-kafkajs`})),TN=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.KafkaJsInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=(F(),e(A)),a=xN(),o=SN(),s=CN(),c=wN();function l(e,t,n){return r=>{e.add(t,{...n,...r?{[i.ATTR_ERROR_TYPE]:r}:{}})}}function u(e,t,n){return r=>{e.record((Date.now()-t)/1e3,{...n,...r?{[i.ATTR_ERROR_TYPE]:r}:{}})}}var d=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10];t.KafkaJsInstrumentation=class extends r.InstrumentationBase{constructor(e={}){super(c.PACKAGE_NAME,c.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(s.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:d}}),this._sentMessages=this.meter.createCounter(s.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(s.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(s.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:d}})}init(){let e=e=>{(0,r.isWrapped)(e?.Kafka?.prototype.producer)&&this._unwrap(e.Kafka.prototype,`producer`),(0,r.isWrapped)(e?.Kafka?.prototype.consumer)&&this._unwrap(e.Kafka.prototype,`consumer`)};return new r.InstrumentationNodeModuleDefinition(`kafkajs`,[`>=0.3.0 <3`],t=>(e(t),this._wrap(t?.Kafka?.prototype,`producer`,this._getProducerPatch()),this._wrap(t?.Kafka?.prototype,`consumer`,this._getConsumerPatch()),t),e)}_getConsumerPatch(){let e=this;return t=>function(...n){let i=t.apply(this,n);return(0,r.isWrapped)(i.run)&&e._unwrap(i,`run`),e._wrap(i,`run`,e._getConsumerRunPatch()),e._setKafkaEventListeners(i),i}}_setKafkaEventListeners(e){e[a.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[a.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[t,n]=e.payload.broker.split(`:`);this._clientDuration.record(e.payload.duration/1e3,{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[i.ATTR_SERVER_ADDRESS]:t,[i.ATTR_SERVER_PORT]:Number.parseInt(n,10)})}_getProducerPatch(){let e=this;return t=>function(...n){let i=t.apply(this,n);return(0,r.isWrapped)(i.sendBatch)&&e._unwrap(i,`sendBatch`),e._wrap(i,`sendBatch`,e._getSendBatchPatch()),(0,r.isWrapped)(i.send)&&e._unwrap(i,`send`),e._wrap(i,`send`,e._getSendPatch()),(0,r.isWrapped)(i.transaction)&&e._unwrap(i,`transaction`),e._wrap(i,`transaction`,e._getProducerTransactionPatch()),e._setKafkaEventListeners(i),i}}_getConsumerRunPatch(){let e=this;return t=>function(...n){let i=n[0];return i?.eachMessage&&((0,r.isWrapped)(i.eachMessage)&&e._unwrap(i,`eachMessage`),e._wrap(i,`eachMessage`,e._getConsumerEachMessagePatch())),i?.eachBatch&&((0,r.isWrapped)(i.eachBatch)&&e._unwrap(i,`eachBatch`),e._wrap(i,`eachBatch`,e._getConsumerEachBatchPatch())),t.call(this,i)}}_getConsumerEachMessagePatch(){let e=this;return t=>function(...r){let i=r[0],a=n.propagation.extract(n.ROOT_CONTEXT,i.message.headers,o.bufferTextMapGetter),c=e._startConsumerSpan({topic:i.topic,message:i.message,operationType:s.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:a,attributes:{[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(i.partition)}}),d=[u(e._processDuration,Date.now(),{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_OPERATION_NAME]:`process`,[s.ATTR_MESSAGING_DESTINATION_NAME]:i.topic,[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(i.partition)}),l(e._consumedMessages,1,{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_OPERATION_NAME]:`process`,[s.ATTR_MESSAGING_DESTINATION_NAME]:i.topic,[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(i.partition)})],f=n.context.with(n.trace.setSpan(a,c),()=>t.apply(this,r));return e._endSpansOnPromise([c],d,f)}}_getConsumerEachBatchPatch(){return e=>{let t=this;return function(...r){let i=r[0],a=t._startConsumerSpan({topic:i.batch.topic,message:void 0,operationType:s.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:n.ROOT_CONTEXT,attributes:{[s.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:i.batch.messages.length,[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(i.batch.partition)}});return n.context.with(n.trace.setSpan(n.context.active(),a),()=>{let c=Date.now(),d=[],f=[l(t._consumedMessages,i.batch.messages.length,{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_OPERATION_NAME]:`process`,[s.ATTR_MESSAGING_DESTINATION_NAME]:i.batch.topic,[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(i.batch.partition)})];i.batch.messages.forEach(e=>{let r=n.propagation.extract(n.ROOT_CONTEXT,e.headers,o.bufferTextMapGetter),a=n.trace.getSpan(r)?.spanContext(),l;a&&(l={context:a}),d.push(t._startConsumerSpan({topic:i.batch.topic,message:e,operationType:s.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:l,attributes:{[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(i.batch.partition)}})),f.push(u(t._processDuration,c,{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_OPERATION_NAME]:`process`,[s.ATTR_MESSAGING_DESTINATION_NAME]:i.batch.topic,[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(i.batch.partition)}))});let p=e.apply(this,r);return d.unshift(a),t._endSpansOnPromise(d,f,p)})}}}_getProducerTransactionPatch(){let e=this;return t=>function(...r){let i=e.tracer.startSpan(`transaction`),a=t.apply(this,r);return a.then(t=>{let r=t.send;t.send=function(...t){return n.context.with(n.trace.setSpan(n.context.active(),i),()=>e._getSendPatch()(r).apply(this,t).catch(e=>{throw i.setStatus({code:n.SpanStatusCode.ERROR,message:e?.message}),i.recordException(e),e}))};let a=t.sendBatch;t.sendBatch=function(...t){return n.context.with(n.trace.setSpan(n.context.active(),i),()=>e._getSendBatchPatch()(a).apply(this,t).catch(e=>{throw i.setStatus({code:n.SpanStatusCode.ERROR,message:e?.message}),i.recordException(e),e}))};let o=t.commit;t.commit=function(...t){let r=o.apply(this,t).then(()=>{i.setStatus({code:n.SpanStatusCode.OK})});return e._endSpansOnPromise([i],[],r)};let s=t.abort;t.abort=function(...t){let n=s.apply(this,t);return e._endSpansOnPromise([i],[],n)}}).catch(e=>{i.setStatus({code:n.SpanStatusCode.ERROR,message:e?.message}),i.recordException(e),i.end()}),a}}_getSendBatchPatch(){let e=this;return t=>function(...n){let r=n[0].topicMessages||[],i=[],a=[];r.forEach(t=>{t.messages.forEach(n=>{i.push(e._startProducerSpan(t.topic,n)),a.push(l(e._sentMessages,1,{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_OPERATION_NAME]:`send`,[s.ATTR_MESSAGING_DESTINATION_NAME]:t.topic,...n.partition===void 0?{}:{[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(n.partition)}}))})});let o=t.apply(this,n);return e._endSpansOnPromise(i,a,o)}}_getSendPatch(){let e=this;return t=>function(...n){let r=n[0],i=r.messages.map(t=>e._startProducerSpan(r.topic,t)),a=r.messages.map(t=>l(e._sentMessages,1,{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_OPERATION_NAME]:`send`,[s.ATTR_MESSAGING_DESTINATION_NAME]:r.topic,...t.partition===void 0?{}:{[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(t.partition)}})),o=t.apply(this,n);return e._endSpansOnPromise(i,a,o)}}_endSpansOnPromise(e,t,r){return Promise.resolve(r).then(e=>(t.forEach(e=>e()),e)).catch(r=>{let a,o=i.ERROR_TYPE_VALUE_OTHER;throw typeof r==`string`||r===void 0?a=r:typeof r==`object`&&Object.prototype.hasOwnProperty.call(r,`message`)&&(a=r.message,o=r.constructor.name),t.forEach(e=>e(o)),e.forEach(e=>{e.setAttribute(i.ATTR_ERROR_TYPE,o),e.setStatus({code:n.SpanStatusCode.ERROR,message:a})}),r}).finally(()=>{e.forEach(e=>e.end())})}_startConsumerSpan({topic:e,message:t,operationType:i,ctx:a,link:o,attributes:c}){let l=i===s.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?`poll`:i,u=this.tracer.startSpan(`${l} ${e}`,{kind:i===s.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?n.SpanKind.CLIENT:n.SpanKind.CONSUMER,attributes:{...c,[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_DESTINATION_NAME]:e,[s.ATTR_MESSAGING_OPERATION_TYPE]:i,[s.ATTR_MESSAGING_OPERATION_NAME]:l,[s.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:t?.key?String(t.key):void 0,[s.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:t?.key&&t.value===null?!0:void 0,[s.ATTR_MESSAGING_KAFKA_OFFSET]:t?.offset},links:o?[o]:[]},a),{consumerHook:d}=this.getConfig();return d&&t&&(0,r.safeExecuteInTheMiddle)(()=>d(u,{topic:e,message:t}),e=>{e&&this._diag.error(`consumerHook error`,e)},!0),u}_startProducerSpan(e,t){let i=this.tracer.startSpan(`send ${e}`,{kind:n.SpanKind.PRODUCER,attributes:{[s.ATTR_MESSAGING_SYSTEM]:s.MESSAGING_SYSTEM_VALUE_KAFKA,[s.ATTR_MESSAGING_DESTINATION_NAME]:e,[s.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:t.key?String(t.key):void 0,[s.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:t.key&&t.value===null?!0:void 0,[s.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:t.partition===void 0?void 0:String(t.partition),[s.ATTR_MESSAGING_OPERATION_NAME]:`send`,[s.ATTR_MESSAGING_OPERATION_TYPE]:s.MESSAGING_OPERATION_TYPE_VALUE_SEND}});t.headers=t.headers??{},n.propagation.inject(n.trace.setSpan(n.context.active(),i),t.headers);let{producerHook:a}=this.getConfig();return a&&(0,r.safeExecuteInTheMiddle)(()=>a(i,{topic:e,message:t}),e=>{e&&this._diag.error(`producerHook error`,e)},!0),i}}})),EN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.KafkaJsInstrumentation=void 0;var t=TN();Object.defineProperty(e,`KafkaJsInstrumentation`,{enumerable:!0,get:function(){return t.KafkaJsInstrumentation}})})),DN,ON,kN,AN,jN,MN=n((()=>{DN=EN(),X(),$(),ON=`Kafka`,kN=Z(ON,()=>new DN.KafkaJsInstrumentation({consumerHook(e){yk(e,`auto.kafkajs.otel.consumer`)},producerHook(e){yk(e,`auto.kafkajs.otel.producer`)}})),AN=(()=>({name:ON,setupOnce(){kN()}})),jN=Y(AN)})),NN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.58.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-lru-memoizer`})),PN=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.LruMemoizerInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=NN();t.LruMemoizerInstrumentation=class extends r.InstrumentationBase{constructor(e={}){super(i.PACKAGE_NAME,i.PACKAGE_VERSION,e)}init(){return[new r.InstrumentationNodeModuleDefinition(`lru-memoizer`,[`>=1.3 <4`],e=>{let t=function(){let t=e.apply(this,arguments);return function(){let e=[...arguments],r=e.pop(),i=typeof r==`function`?n.context.bind(n.context.active(),r):r;return e.push(i),t.apply(this,e)}};return t.sync=e.sync,t},void 0)]}}})),FN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LruMemoizerInstrumentation=void 0;var t=PN();Object.defineProperty(e,`LruMemoizerInstrumentation`,{enumerable:!0,get:function(){return t.LruMemoizerInstrumentation}})})),IN,LN,RN,zN,BN,VN=n((()=>{IN=FN(),X(),$(),LN=`LruMemoizer`,RN=Z(LN,()=>new IN.LruMemoizerInstrumentation),zN=(()=>({name:LN,setupOnce(){RN()}})),BN=Y(zN)})),HN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.METRIC_DB_CLIENT_CONNECTIONS_USAGE=e.DB_SYSTEM_VALUE_MONGODB=e.DB_SYSTEM_NAME_VALUE_MONGODB=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_OPERATION=e.ATTR_DB_NAME=e.ATTR_DB_MONGODB_COLLECTION=e.ATTR_DB_CONNECTION_STRING=void 0,e.ATTR_DB_CONNECTION_STRING=`db.connection_string`,e.ATTR_DB_MONGODB_COLLECTION=`db.mongodb.collection`,e.ATTR_DB_NAME=`db.name`,e.ATTR_DB_OPERATION=`db.operation`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_SYSTEM_NAME_VALUE_MONGODB=`mongodb`,e.DB_SYSTEM_VALUE_MONGODB=`mongodb`,e.METRIC_DB_CLIENT_CONNECTIONS_USAGE=`db.client.connections.usage`})),UN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MongodbCommandType=void 0,(function(e){e.CREATE_INDEXES=`createIndexes`,e.FIND_AND_MODIFY=`findAndModify`,e.IS_MASTER=`isMaster`,e.COUNT=`count`,e.AGGREGATE=`aggregate`,e.UNKNOWN=`unknown`})(e.MongodbCommandType||(e.MongodbCommandType={}))})),WN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.67.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-mongodb`})),GN=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.MongoDBInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=(F(),e(A)),s=HN(),c=UN(),l=WN(),u={requireParentSpan:!0};t.MongoDBInstrumentation=class e extends r.InstrumentationBase{constructor(e={}){super(l.PACKAGE_NAME,l.PACKAGE_VERSION,{...u,...e}),o(this,`_netSemconvStability`,void 0),o(this,`_dbSemconvStability`,void 0),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,r.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,r.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...u,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter(s.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`})}_connCountAdd(e,t,n){this._connectionsUsage?.add(e,{"pool.name":t,state:n})}init(){let{v3PatchConnection:e,v3UnpatchConnection:t}=this._getV3ConnectionPatches(),{v4PatchConnect:n,v4UnpatchConnect:i}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:a,v4PatchConnectionPromise:o,v4UnpatchConnection:s}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:c,v4UnpatchConnectionPool:l}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:u,v4UnpatchSessions:d}=this._getV4SessionsPatches();return[new r.InstrumentationNodeModuleDefinition(`mongodb`,[`>=3.3.0 <4`],void 0,void 0,[new r.InstrumentationNodeModuleFile(`mongodb/lib/core/wireprotocol/index.js`,[`>=3.3.0 <4`],e,t)]),new r.InstrumentationNodeModuleDefinition(`mongodb`,[`>=4.0.0 <8`],void 0,void 0,[new r.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection.js`,[`>=4.0.0 <6.4`],a,s),new r.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection.js`,[`>=6.4.0 <8`],o,s),new r.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection_pool.js`,[`>=4.0.0 <6.4`],c,l),new r.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connect.js`,[`>=4.0.0 <8`],n,i),new r.InstrumentationNodeModuleFile(`mongodb/lib/sessions.js`,[`>=4.0.0 <8`],u,d)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,r.isWrapped)(e.insert)&&this._unwrap(e,`insert`),this._wrap(e,`insert`,this._getV3PatchOperation(`insert`)),(0,r.isWrapped)(e.remove)&&this._unwrap(e,`remove`),this._wrap(e,`remove`,this._getV3PatchOperation(`remove`)),(0,r.isWrapped)(e.update)&&this._unwrap(e,`update`),this._wrap(e,`update`,this._getV3PatchOperation(`update`)),(0,r.isWrapped)(e.command)&&this._unwrap(e,`command`),this._wrap(e,`command`,this._getV3PatchCommand()),(0,r.isWrapped)(e.query)&&this._unwrap(e,`query`),this._wrap(e,`query`,this._getV3PatchFind()),(0,r.isWrapped)(e.getMore)&&this._unwrap(e,`getMore`),this._wrap(e,`getMore`,this._getV3PatchCursor()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,`insert`),this._unwrap(e,`remove`),this._unwrap(e,`update`),this._unwrap(e,`command`),this._unwrap(e,`query`),this._unwrap(e,`getMore`))}}}_getV4SessionsPatches(){return{v4PatchSessions:e=>((0,r.isWrapped)(e.acquire)&&this._unwrap(e,`acquire`),this._wrap(e.ServerSessionPool.prototype,`acquire`,this._getV4AcquireCommand()),(0,r.isWrapped)(e.release)&&this._unwrap(e,`release`),this._wrap(e.ServerSessionPool.prototype,`release`,this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,r.isWrapped)(e.acquire)&&this._unwrap(e,`acquire`),(0,r.isWrapped)(e.release)&&this._unwrap(e,`release`))}}}_getV4AcquireCommand(){let e=this;return t=>function(){let n=this.sessions.length,r=t.call(this),i=this.sessions.length;return n===i?e._connCountAdd(1,e._poolName,`used`):n-1===i&&(e._connCountAdd(-1,e._poolName,`idle`),e._connCountAdd(1,e._poolName,`used`)),r}}_getV4ReleaseCommand(){let e=this;return t=>function(n){let r=t.call(this,n);return e._connCountAdd(-1,e._poolName,`used`),e._connCountAdd(1,e._poolName,`idle`),r}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let t=e.ConnectionPool.prototype;return(0,r.isWrapped)(t.checkOut)&&this._unwrap(t,`checkOut`),this._wrap(t,`checkOut`,this._getV4ConnectionPoolCheckOut()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,`checkOut`)}}}_getV4ConnectPatches(){return{v4PatchConnect:e=>((0,r.isWrapped)(e.connect)&&this._unwrap(e,`connect`),this._wrap(e,`connect`,this._getV4ConnectCommand()),e),v4UnpatchConnect:e=>{e!==void 0&&this._unwrap(e,`connect`)}}}_getV4ConnectionPoolCheckOut(){return e=>function(t){let r=n.context.bind(n.context.active(),t);return e.call(this,r)}}_getV4ConnectCommand(){let e=this;return t=>function(n,r){if(t.length===1){let r=t.call(this,n);return r&&typeof r.then==`function`&&r.then(()=>e.setPoolName(n),()=>void 0),r}return t.call(this,n,function(t,i){if(t||!i){r(t,i);return}e.setPoolName(n),r(t,i)})}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>((0,r.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,r.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,this._getV4PatchCommandPromise()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,`command`)}}}_getV3PatchOperation(e){let t=this;return r=>function(i,a,o,s,c){let l=n.trace.getSpan(n.context.active()),u=t._checkSkipInstrumentation(l),d=typeof s==`function`?s:c;if(u||typeof d!=`function`||typeof o!=`object`)return typeof s==`function`?r.call(this,i,a,o,s):r.call(this,i,a,o,s,c);let f=t._getV3SpanAttributes(a,i,o[0],e),p=t._spanNameFromAttrs(f),m=t.tracer.startSpan(p,{kind:n.SpanKind.CLIENT,attributes:f}),h=t._patchEnd(m,d);return typeof s==`function`?r.call(this,i,a,o,h):r.call(this,i,a,o,s,h)}}_getV3PatchCommand(){let t=this;return r=>function(i,a,o,s,l){let u=n.trace.getSpan(n.context.active()),d=t._checkSkipInstrumentation(u),f=typeof s==`function`?s:l;if(d||typeof f!=`function`||typeof o!=`object`)return typeof s==`function`?r.call(this,i,a,o,s):r.call(this,i,a,o,s,l);let p=e._getCommandType(o),m=p===c.MongodbCommandType.UNKNOWN?void 0:p,h=t._getV3SpanAttributes(a,i,o,m),g=t._spanNameFromAttrs(h),_=t.tracer.startSpan(g,{kind:n.SpanKind.CLIENT,attributes:h}),v=t._patchEnd(_,f);return typeof s==`function`?r.call(this,i,a,o,v):r.call(this,i,a,o,s,v)}}_getV4PatchCommandCallback(){let e=this;return t=>function(r,i,a,o){let s=n.trace.getSpan(n.context.active()),c=e._checkSkipInstrumentation(s),l=o,u=Object.keys(i)[0];if(typeof i!=`object`||i.ismaster||i.hello)return t.call(this,r,i,a,o);let d;if(!c){let t=e._getV4SpanAttributes(this,r,i,u),a=e._spanNameFromAttrs(t);d=e.tracer.startSpan(a,{kind:n.SpanKind.CLIENT,attributes:t})}let f=e._patchEnd(d,l,this.id,u);return t.call(this,r,i,a,f)}}_getV4PatchCommandPromise(){let e=this;return t=>function(...r){let[i,a]=r,o=n.trace.getSpan(n.context.active()),s=e._checkSkipInstrumentation(o),c=Object.keys(a)[0],l=()=>void 0;if(typeof a!=`object`||a.ismaster||a.hello)return t.apply(this,r);let u;if(!s){let t=e._getV4SpanAttributes(this,i,a,c),r=e._spanNameFromAttrs(t);u=e.tracer.startSpan(r,{kind:n.SpanKind.CLIENT,attributes:t})}let d=e._patchEnd(u,l,this.id,c),f=t.apply(this,r);return f.then(e=>d(null,e),e=>d(e)),f}}_getV3PatchFind(){let e=this;return t=>function(r,i,a,o,s,c){let l=n.trace.getSpan(n.context.active()),u=e._checkSkipInstrumentation(l),d=typeof s==`function`?s:c;if(u||typeof d!=`function`||typeof a!=`object`)return typeof s==`function`?t.call(this,r,i,a,o,s):t.call(this,r,i,a,o,s,c);let f=e._getV3SpanAttributes(i,r,a,`find`),p=e._spanNameFromAttrs(f),m=e.tracer.startSpan(p,{kind:n.SpanKind.CLIENT,attributes:f}),h=e._patchEnd(m,d);return typeof s==`function`?t.call(this,r,i,a,o,h):t.call(this,r,i,a,o,s,h)}}_getV3PatchCursor(){let e=this;return t=>function(r,i,a,o,s,c){let l=n.trace.getSpan(n.context.active()),u=e._checkSkipInstrumentation(l),d=typeof s==`function`?s:c;if(u||typeof d!=`function`)return typeof s==`function`?t.call(this,r,i,a,o,s):t.call(this,r,i,a,o,s,c);let f=e._getV3SpanAttributes(i,r,a.cmd,`getMore`),p=e._spanNameFromAttrs(f),m=e.tracer.startSpan(p,{kind:n.SpanKind.CLIENT,attributes:f}),h=e._patchEnd(m,d);return typeof s==`function`?t.call(this,r,i,a,o,h):t.call(this,r,i,a,o,s,h)}}static _getCommandType(e){return e.createIndexes===void 0?e.findandmodify===void 0?e.ismaster===void 0?e.count===void 0?e.aggregate===void 0?c.MongodbCommandType.UNKNOWN:c.MongodbCommandType.AGGREGATE:c.MongodbCommandType.COUNT:c.MongodbCommandType.IS_MASTER:c.MongodbCommandType.FIND_AND_MODIFY:c.MongodbCommandType.CREATE_INDEXES}_getV4SpanAttributes(e,t,n,r){let i,a;if(e){let t=typeof e.address==`string`?e.address.split(`:`):``;t.length===2&&(i=t[0],a=t[1])}let o;return o=n?.documents&&n.documents[0]?n.documents[0]:n?.cursors?n.cursors:n,this._getSpanAttributes(t.db,t.collection,i,a,o,r)}_getV3SpanAttributes(e,t,n,r){let i,a;if(t&&t.s&&(i=t.s.options?.host??t.s.host,a=(t.s.options?.port??t.s.port)?.toString(),i==null||a==null)){let e=t.description?.address;if(e){let t=e.split(`:`);i=t[0],a=t[1]}}let[o,s]=e.toString().split(`.`),c=n?.query??n?.q??n;return this._getSpanAttributes(o,s,i,a,c,r)}_getSpanAttributes(e,t,n,a,o,c){let l={};if(this._dbSemconvStability&r.SemconvStability.OLD&&(l[s.ATTR_DB_SYSTEM]=s.DB_SYSTEM_VALUE_MONGODB,l[s.ATTR_DB_NAME]=e,l[s.ATTR_DB_MONGODB_COLLECTION]=t,l[s.ATTR_DB_OPERATION]=c,l[s.ATTR_DB_CONNECTION_STRING]=`mongodb://${n}:${a}/${e}`),this._dbSemconvStability&r.SemconvStability.STABLE&&(l[i.ATTR_DB_SYSTEM_NAME]=s.DB_SYSTEM_NAME_VALUE_MONGODB,l[i.ATTR_DB_NAMESPACE]=e,l[i.ATTR_DB_OPERATION_NAME]=c,l[i.ATTR_DB_COLLECTION_NAME]=t),n&&a){this._netSemconvStability&r.SemconvStability.OLD&&(l[s.ATTR_NET_PEER_NAME]=n),this._netSemconvStability&r.SemconvStability.STABLE&&(l[i.ATTR_SERVER_ADDRESS]=n);let e=parseInt(a,10);isNaN(e)||(this._netSemconvStability&r.SemconvStability.OLD&&(l[s.ATTR_NET_PEER_PORT]=e),this._netSemconvStability&r.SemconvStability.STABLE&&(l[i.ATTR_SERVER_PORT]=e))}if(o){let{dbStatementSerializer:e}=this.getConfig(),t=typeof e==`function`?e:this._defaultDbStatementSerializer.bind(this);(0,r.safeExecuteInTheMiddle)(()=>{let e=t(o);this._dbSemconvStability&r.SemconvStability.OLD&&(l[s.ATTR_DB_STATEMENT]=e),this._dbSemconvStability&r.SemconvStability.STABLE&&(l[i.ATTR_DB_QUERY_TEXT]=e)},e=>{e&&this._diag.error(`Error running dbStatementSerializer hook`,e)},!0)}return l}_spanNameFromAttrs(e){let t;return t=this._dbSemconvStability&r.SemconvStability.STABLE?[e[i.ATTR_DB_OPERATION_NAME],e[i.ATTR_DB_COLLECTION_NAME]].filter(e=>e).join(` `)||s.DB_SYSTEM_NAME_VALUE_MONGODB:`mongodb.${e[s.ATTR_DB_OPERATION]||`command`}`,t}_getDefaultDbStatementReplacer(){let e=new WeakSet;return(t,n)=>typeof n!=`object`||!n?`?`:e.has(n)?`[Circular]`:(e.add(n),n)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:t}=this.getConfig();return t?JSON.stringify(e):JSON.stringify(e,this._getDefaultDbStatementReplacer())}_handleExecutionResult(e,t){let{responseHook:n}=this.getConfig();typeof n==`function`&&(0,r.safeExecuteInTheMiddle)(()=>{n(e,{data:t})},e=>{e&&this._diag.error(`Error running response hook`,e)},!0)}_patchEnd(e,t,r,i){let a=n.context.active(),o=this,s=!1;return function(...r){if(!s){s=!0;let t=r[0];if(e){if(t instanceof Error)e.setStatus({code:n.SpanStatusCode.ERROR,message:t.message});else{let t=r[1];o._handleExecutionResult(e,t)}e.end()}i===`endSessions`&&o._connCountAdd(-1,o._poolName,`idle`)}return n.context.with(a,()=>t.apply(this,r))}}setPoolName(e){this._poolName=`mongodb://${e.hostAddress?.host}:${e.hostAddress?.port}/${e.dbName}`}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}}})),KN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MongodbCommandType=void 0,(function(e){e.CREATE_INDEXES=`createIndexes`,e.FIND_AND_MODIFY=`findAndModify`,e.IS_MASTER=`isMaster`,e.COUNT=`count`,e.UNKNOWN=`unknown`})(e.MongodbCommandType||(e.MongodbCommandType={}))})),qN=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MongodbCommandType=e.MongoDBInstrumentation=void 0;var t=GN();Object.defineProperty(e,`MongoDBInstrumentation`,{enumerable:!0,get:function(){return t.MongoDBInstrumentation}});var n=KN();Object.defineProperty(e,`MongodbCommandType`,{enumerable:!0,get:function(){return n.MongodbCommandType}})}));function JN(e){let t=YN(e);return JSON.stringify(t)}function YN(e){return Array.isArray(e)?e.map(e=>YN(e)):XN(e)?Object.entries(e).map(([e,t])=>[e,YN(t)]).reduce((e,t)=>(QN(t)&&(e[t[0]]=t[1]),e),{}):`?`}function XN(e){return typeof e==`object`&&!!e&&!ZN(e)}function ZN(e){let t=!1;return typeof Buffer<`u`&&(t=Buffer.isBuffer(e)),t}function QN(e){return Array.isArray(e)}var $N,eP,tP,nP,rP,iP=n((()=>{$N=qN(),X(),$(),eP=`Mongo`,tP=Z(eP,()=>new $N.MongoDBInstrumentation({dbStatementSerializer:JN,responseHook(e){yk(e,`auto.db.otel.mongo`)}})),nP=(()=>({name:eP,setupOnce(){tP()}})),rP=Y(nP)})),aP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DB_SYSTEM_NAME_VALUE_MONGODB=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_USER=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_OPERATION=e.ATTR_DB_NAME=e.ATTR_DB_MONGODB_COLLECTION=void 0,e.ATTR_DB_MONGODB_COLLECTION=`db.mongodb.collection`,e.ATTR_DB_NAME=`db.name`,e.ATTR_DB_OPERATION=`db.operation`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_DB_USER=`db.user`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_SYSTEM_NAME_VALUE_MONGODB=`mongodb`})),oP=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.handleCallbackResponse=t.handlePromiseResponse=t.getAttributesFromCollection=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=aP(),a=(F(),e(A));function o(e,t,n){let o={};return t&r.SemconvStability.OLD&&(o[i.ATTR_DB_MONGODB_COLLECTION]=e.name,o[i.ATTR_DB_NAME]=e.conn.name,o[i.ATTR_DB_USER]=e.conn.user),t&r.SemconvStability.STABLE&&(o[a.ATTR_DB_COLLECTION_NAME]=e.name,o[a.ATTR_DB_NAMESPACE]=e.conn.name),n&r.SemconvStability.OLD&&(o[i.ATTR_NET_PEER_NAME]=e.conn.host,o[i.ATTR_NET_PEER_PORT]=e.conn.port),n&r.SemconvStability.STABLE&&(o[a.ATTR_SERVER_ADDRESS]=e.conn.host,o[a.ATTR_SERVER_PORT]=e.conn.port),o}t.getAttributesFromCollection=o;function s(e,t={}){e.recordException(t),e.setStatus({code:n.SpanStatusCode.ERROR,message:`${t.message} ${t.code?`\nMongoose Error Code: ${t.code}`:``}`})}function c(e,t,i,a=void 0){i&&(0,r.safeExecuteInTheMiddle)(()=>i(e,{moduleVersion:a,response:t}),e=>{e&&n.diag.error(`mongoose instrumentation: responseHook error`,e)},!0)}function l(e,t,n,r=void 0){return e instanceof Promise?e.then(e=>(c(t,e,n,r),e)).catch(e=>{throw s(t,e),e}).finally(()=>t.end()):(c(t,e,n,r),t.end(),e)}t.handlePromiseResponse=l;function u(e,t,n,r,i,a,o=void 0){let l=0;return i.length===2?l=1:i.length===3&&(l=2),i[l]=(t,n)=>(t?s(r,t):c(r,n,a,o),r.end(),e(t,n)),t.apply(n,i)}t.handleCallbackResponse=u})),sP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.60.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-mongoose`})),cP=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.MongooseInstrumentation=t._ALREADY_INSTRUMENTED=t._STORED_PARENT_SPAN=void 0;var n=(T(),e(k)),r=(ui(),e(ci)),i=oP(),s=(L(),e(I)),c=sP(),l=aP(),u=(F(),e(A)),d=[`deleteOne`,`deleteMany`,`find`,`findOne`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`],f=[`remove`,`count`,`findOneAndRemove`,...d],p=[`count`,`findOneAndRemove`,...d],m=[...d];function h(e){return e?e.startsWith(`6.`)||e.startsWith(`5.`)?f:e.startsWith(`7.`)?p:m:d}function g(e){return e&&(e.startsWith(`5.`)||e.startsWith(`6.`))||!1}function _(e){return!e||!e.startsWith(`8.`)?!1:parseInt(e.split(`.`)[1],10)>=21}t._STORED_PARENT_SPAN=Symbol(`stored-parent-span`),t._ALREADY_INSTRUMENTED=Symbol(`already-instrumented`),t.MongooseInstrumentation=class extends s.InstrumentationBase{constructor(e={}){super(c.PACKAGE_NAME,c.PACKAGE_VERSION,e),o(this,`_netSemconvStability`,void 0),o(this,`_dbSemconvStability`,void 0),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,s.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,s.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new s.InstrumentationNodeModuleDefinition(`mongoose`,[`>=5.9.7 <10`],this.patch.bind(this),this.unpatch.bind(this))}patch(e,t){let n=e[Symbol.toStringTag]===`Module`?e.default:e;return this._wrap(n.Model.prototype,`save`,this.patchOnModelMethods(`save`,t)),n.Model.prototype.$save=n.Model.prototype.save,g(t)&&this._wrap(n.Model.prototype,`remove`,this.patchOnModelMethods(`remove`,t)),_(t)&&(this._wrap(n.Model.prototype,`updateOne`,this._patchDocumentUpdateMethods(`updateOne`,t)),this._wrap(n.Model.prototype,`deleteOne`,this._patchDocumentUpdateMethods(`deleteOne`,t))),this._wrap(n.Query.prototype,`exec`,this.patchQueryExec(t)),this._wrap(n.Aggregate.prototype,`exec`,this.patchAggregateExec(t)),h(t).forEach(e=>{this._wrap(n.Query.prototype,e,this.patchAndCaptureSpanContext(e))}),this._wrap(n.Model,`aggregate`,this.patchModelAggregate()),this._wrap(n.Model,`insertMany`,this.patchModelStatic(`insertMany`,t)),this._wrap(n.Model,`bulkWrite`,this.patchModelStatic(`bulkWrite`,t)),n}unpatch(e,t){let n=e[Symbol.toStringTag]===`Module`?e.default:e,r=h(t);this._unwrap(n.Model.prototype,`save`),n.Model.prototype.$save=n.Model.prototype.save,g(t)&&this._unwrap(n.Model.prototype,`remove`),_(t)&&(this._unwrap(n.Model.prototype,`updateOne`),this._unwrap(n.Model.prototype,`deleteOne`)),this._unwrap(n.Query.prototype,`exec`),this._unwrap(n.Aggregate.prototype,`exec`),r.forEach(e=>{this._unwrap(n.Query.prototype,e)}),this._unwrap(n.Model,`aggregate`),this._unwrap(n.Model,`insertMany`),this._unwrap(n.Model,`bulkWrite`)}patchAggregateExec(e){let r=this;return i=>function(a){if(r.getConfig().requireParentSpan&&n.trace.getSpan(n.context.active())===void 0)return i.apply(this,arguments);let o=this[t._STORED_PARENT_SPAN],c={},{dbStatementSerializer:d}=r.getConfig();if(d){let e=d(`aggregate`,{options:this.options,aggregatePipeline:this._pipeline});r._dbSemconvStability&s.SemconvStability.OLD&&(c[l.ATTR_DB_STATEMENT]=e),r._dbSemconvStability&s.SemconvStability.STABLE&&(c[u.ATTR_DB_QUERY_TEXT]=e)}let f=r._startSpan(this._model.collection,this._model?.modelName,`aggregate`,c,o);return r._handleResponse(f,i,this,arguments,a,e)}}patchQueryExec(e){let r=this;return i=>function(a){if(this[t._ALREADY_INSTRUMENTED]||r.getConfig().requireParentSpan&&n.trace.getSpan(n.context.active())===void 0)return i.apply(this,arguments);let o=this[t._STORED_PARENT_SPAN],c={},{dbStatementSerializer:d}=r.getConfig();if(d){let e=d(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});r._dbSemconvStability&s.SemconvStability.OLD&&(c[l.ATTR_DB_STATEMENT]=e),r._dbSemconvStability&s.SemconvStability.STABLE&&(c[u.ATTR_DB_QUERY_TEXT]=e)}let f=r._startSpan(this.mongooseCollection,this.model.modelName,this.op,c,o);return r._handleResponse(f,i,this,arguments,a,e)}}patchOnModelMethods(e,t){let r=this;return i=>function(a,o){if(r.getConfig().requireParentSpan&&n.trace.getSpan(n.context.active())===void 0)return i.apply(this,arguments);let c={document:this};a&&!(a instanceof Function)&&(c.options=a);let d={},{dbStatementSerializer:f}=r.getConfig();if(f){let t=f(e,c);r._dbSemconvStability&s.SemconvStability.OLD&&(d[l.ATTR_DB_STATEMENT]=t),r._dbSemconvStability&s.SemconvStability.STABLE&&(d[u.ATTR_DB_QUERY_TEXT]=t)}let p=r._startSpan(this.constructor.collection,this.constructor.modelName,e,d);return a instanceof Function&&(o=a,a=void 0),r._handleResponse(p,i,this,arguments,o,t)}}_patchDocumentUpdateMethods(e,r){let i=this;return a=>function(o,c,d){if(i.getConfig().requireParentSpan&&n.trace.getSpan(n.context.active())===void 0)return a.apply(this,arguments);let f=d,p=o,m=c;typeof o==`function`?(f=o,p=void 0,m=void 0):typeof c==`function`&&(f=c,m=void 0);let h={},g=i.getConfig().dbStatementSerializer;if(g){let t=g(e,{condition:{_id:this._id},updates:p,options:m});i._dbSemconvStability&s.SemconvStability.OLD&&(h[l.ATTR_DB_STATEMENT]=t),i._dbSemconvStability&s.SemconvStability.STABLE&&(h[u.ATTR_DB_QUERY_TEXT]=t)}let _=i._startSpan(this.constructor.collection,this.constructor.modelName,e,h),v=i._handleResponse(_,a,this,arguments,f,r);return v&&typeof v==`object`&&(v[t._ALREADY_INSTRUMENTED]=!0),v}}patchModelStatic(e,t){let r=this;return i=>function(a,o,c){if(r.getConfig().requireParentSpan&&n.trace.getSpan(n.context.active())===void 0)return i.apply(this,arguments);typeof o==`function`&&(c=o,o=void 0);let d={};switch(e){case`insertMany`:d.documents=a;break;case`bulkWrite`:d.operations=a;break;default:d.document=a;break}o!==void 0&&(d.options=o);let f={},{dbStatementSerializer:p}=r.getConfig();if(p){let t=p(e,d);r._dbSemconvStability&s.SemconvStability.OLD&&(f[l.ATTR_DB_STATEMENT]=t),r._dbSemconvStability&s.SemconvStability.STABLE&&(f[u.ATTR_DB_QUERY_TEXT]=t)}let m=r._startSpan(this.collection,this.modelName,e,f);return r._handleResponse(m,i,this,arguments,c,t)}}patchModelAggregate(){let e=this;return r=>function(){let i=n.trace.getSpan(n.context.active()),a=e._callOriginalFunction(()=>r.apply(this,arguments));return a&&(a[t._STORED_PARENT_SPAN]=i),a}}patchAndCaptureSpanContext(e){let r=this;return e=>function(){return this[t._STORED_PARENT_SPAN]=n.trace.getSpan(n.context.active()),r._callOriginalFunction(()=>e.apply(this,arguments))}}_startSpan(e,t,r,a,o){let c={...a,...(0,i.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&s.SemconvStability.OLD&&(c[l.ATTR_DB_OPERATION]=r,c[l.ATTR_DB_SYSTEM]=`mongoose`),this._dbSemconvStability&s.SemconvStability.STABLE&&(c[u.ATTR_DB_OPERATION_NAME]=r,c[u.ATTR_DB_SYSTEM_NAME]=l.DB_SYSTEM_NAME_VALUE_MONGODB);let d=this._dbSemconvStability&s.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${t}.${r}`;return this.tracer.startSpan(d,{kind:n.SpanKind.CLIENT,attributes:c},o?n.trace.setSpan(n.context.active(),o):void 0)}_handleResponse(e,t,n,r,a,o=void 0){let s=this;if(a instanceof Function)return s._callOriginalFunction(()=>(0,i.handleCallbackResponse)(a,t,n,e,r,s.getConfig().responseHook,o));{let a=s._callOriginalFunction(()=>t.apply(n,r));return(0,i.handlePromiseResponse)(a,e,s.getConfig().responseHook,o)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?n.context.with((0,r.suppressTracing)(n.context.active()),e):e()}}})),lP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MongooseInstrumentation=void 0;var t=cP();Object.defineProperty(e,`MongooseInstrumentation`,{enumerable:!0,get:function(){return t.MongooseInstrumentation}})})),uP,dP,fP,pP,mP,hP=n((()=>{uP=lP(),X(),$(),dP=`Mongoose`,fP=Z(dP,()=>new uP.MongooseInstrumentation({responseHook(e){yk(e,`auto.db.otel.mongoose`)}})),pP=(()=>({name:dP,setupOnce(){fP()}})),mP=Y(pP)})),gP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.METRIC_DB_CLIENT_CONNECTIONS_USAGE=e.DB_SYSTEM_VALUE_MYSQL=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_USER=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_NAME=e.ATTR_DB_CONNECTION_STRING=void 0,e.ATTR_DB_CONNECTION_STRING=`db.connection_string`,e.ATTR_DB_NAME=`db.name`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_DB_USER=`db.user`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_SYSTEM_VALUE_MYSQL=`mysql`,e.METRIC_DB_CLIENT_CONNECTIONS_USAGE=`db.client.connections.usage`})),_P=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=void 0,(function(e){e.MYSQL_VALUES=`db.mysql.values`})(e.AttributeNames||(e.AttributeNames={}))})),vP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getPoolNameOld=e.arrayStringifyHelper=e.getSpanName=e.getDbValues=e.getDbQueryText=e.getJDBCString=e.getConfig=void 0;function t(e){let{host:t,port:n,database:r,user:i}=e&&e.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}e.getConfig=t;function n(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}e.getJDBCString=n;function r(e){return typeof e==`string`?e:e.sql}e.getDbQueryText=r;function i(e,t){return o(typeof e==`string`?t:t||e.values)}e.getDbValues=i;function a(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}e.getSpanName=a;function o(e){return e?`[${e.toString()}]`:``}e.arrayStringifyHelper=o;function s(e){let t=e.config.connectionConfig,n=``;return n+=t.host?`host: '${t.host}', `:``,n+=t.port?`port: ${t.port}, `:``,n+=t.database?`database: '${t.database}', `:``,n+=t.user?`user: '${t.user}'`:``,t.user||(n=n.substring(0,n.length-2)),n.trim()}e.getPoolNameOld=s})),yP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.60.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-mysql`})),bP=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.MySQLInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=(F(),e(A)),s=gP(),c=_P(),l=vP(),u=yP();t.MySQLInstrumentation=class extends r.InstrumentationBase{constructor(e={}){super(u.PACKAGE_NAME,u.PACKAGE_VERSION,e),o(this,`_netSemconvStability`,void 0),o(this,`_dbSemconvStability`,void 0),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,r.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,r.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(s.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`})}_connCountAdd(e,t,n){this._connectionsUsageOld?.add(e,{state:n,name:t})}init(){return[new r.InstrumentationNodeModuleDefinition(`mysql`,[`>=2.0.0 <3`],e=>((0,r.isWrapped)(e.createConnection)&&this._unwrap(e,`createConnection`),this._wrap(e,`createConnection`,this._patchCreateConnection()),(0,r.isWrapped)(e.createPool)&&this._unwrap(e,`createPool`),this._wrap(e,`createPool`,this._patchCreatePool()),(0,r.isWrapped)(e.createPoolCluster)&&this._unwrap(e,`createPoolCluster`),this._wrap(e,`createPoolCluster`,this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,`createConnection`),this._unwrap(e,`createPool`),this._unwrap(e,`createPoolCluster`))})]}_patchCreateConnection(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`query`,t._patchQuery(r)),r}}}_patchCreatePool(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`query`,t._patchQuery(r)),t._wrap(r,`getConnection`,t._patchGetConnection(r)),t._wrap(r,`end`,t._patchPoolEnd(r)),t._setPoolCallbacks(r,``),r}}}_patchPoolEnd(e){return t=>{let n=this;return function(r){let i=e._allConnections.length,a=e._freeConnections.length,o=i-a,s=(0,l.getPoolNameOld)(e);n._connCountAdd(-o,s,`used`),n._connCountAdd(-a,s,`idle`),t.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`getConnection`,t._patchGetConnection(r)),t._wrap(r,`add`,t._patchAdd(r)),r}}}_patchAdd(e){return t=>{let n=this;return function(r,i){if(!n._enabled)return n._unwrap(e,`add`),t.apply(e,arguments);t.apply(e,arguments);let a=e._nodes;if(a){let t=a[typeof r==`object`?`CLUSTER::`+e._lastId:String(r)].pool;n._setPoolCallbacks(t,r)}}}}_patchGetConnection(e){return t=>{let n=this;return function(r,i,a){if(!n._enabled)return n._unwrap(e,`getConnection`),t.apply(e,arguments);if(arguments.length===1&&typeof r==`function`){let i=n._getConnectionCallbackPatchFn(r);return t.call(e,i)}if(arguments.length===2&&typeof i==`function`){let a=n._getConnectionCallbackPatchFn(i);return t.call(e,r,a)}if(arguments.length===3&&typeof a==`function`){let o=n._getConnectionCallbackPatchFn(a);return t.call(e,r,i,o)}return t.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let t=this,i=n.context.active();return function(a,o){o&&((0,r.isWrapped)(o.query)||t._wrap(o,`query`,t._patchQuery(o))),typeof e==`function`&&n.context.with(i,e,this,a,o)}}_patchQuery(e){return t=>{let a=this;return function(o,u,d){if(!a._enabled)return a._unwrap(e,`query`),t.apply(e,arguments);let f={},{host:p,port:m,database:h,user:g}=(0,l.getConfig)(e.config),_=parseInt(m,10),v=(0,l.getDbQueryText)(o);a._dbSemconvStability&r.SemconvStability.OLD&&(f[s.ATTR_DB_SYSTEM]=s.DB_SYSTEM_VALUE_MYSQL,f[s.ATTR_DB_CONNECTION_STRING]=(0,l.getJDBCString)(p,m,h),f[s.ATTR_DB_NAME]=h,f[s.ATTR_DB_USER]=g,f[s.ATTR_DB_STATEMENT]=v),a._dbSemconvStability&r.SemconvStability.STABLE&&(f[i.ATTR_DB_SYSTEM_NAME]=i.DB_SYSTEM_NAME_VALUE_MYSQL,f[i.ATTR_DB_NAMESPACE]=h,f[i.ATTR_DB_QUERY_TEXT]=v),a._netSemconvStability&r.SemconvStability.OLD&&(f[s.ATTR_NET_PEER_NAME]=p,isNaN(_)||(f[s.ATTR_NET_PEER_PORT]=_)),a._netSemconvStability&r.SemconvStability.STABLE&&(f[i.ATTR_SERVER_ADDRESS]=p,isNaN(_)||(f[i.ATTR_SERVER_PORT]=_));let y=a.tracer.startSpan((0,l.getSpanName)(o),{kind:n.SpanKind.CLIENT,attributes:f});if(a.getConfig().enhancedDatabaseReporting){let e;Array.isArray(u)?e=u:arguments[2]&&(e=[u]),y.setAttribute(c.AttributeNames.MYSQL_VALUES,(0,l.getDbValues)(o,e))}let b=Array.from(arguments).findIndex(e=>typeof e==`function`),x=n.context.active();if(b===-1){let r=n.context.with(n.trace.setSpan(n.context.active(),y),()=>t.apply(e,arguments));return n.context.bind(x,r),r.on(`error`,e=>y.setStatus({code:n.SpanStatusCode.ERROR,message:e.message})).on(`end`,()=>{y.end()})}else return a._wrap(arguments,b,a._patchCallbackQuery(y,x)),n.context.with(n.trace.setSpan(n.context.active(),y),()=>t.apply(e,arguments))}}}_patchCallbackQuery(e,t){return r=>function(i,a,o){return i&&e.setStatus({code:n.SpanStatusCode.ERROR,message:i.message}),e.end(),n.context.with(t,()=>r(...arguments))}}_setPoolCallbacks(e,t){let n=t||(0,l.getPoolNameOld)(e);e.on(`connection`,e=>{this._connCountAdd(1,n,`idle`)}),e.on(`acquire`,e=>{this._connCountAdd(-1,n,`idle`),this._connCountAdd(1,n,`used`)}),e.on(`release`,e=>{this._connCountAdd(1,n,`idle`),this._connCountAdd(-1,n,`used`)})}}})),xP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MySQLInstrumentation=void 0;var t=bP();Object.defineProperty(e,`MySQLInstrumentation`,{enumerable:!0,get:function(){return t.MySQLInstrumentation}})})),SP,CP,wP,TP,EP,DP=n((()=>{SP=xP(),X(),$(),CP=`Mysql`,wP=Z(CP,()=>new SP.MySQLInstrumentation({})),TP=(()=>({name:CP,setupOnce(){wP()}})),EP=Y(TP)})),OP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DB_SYSTEM_VALUE_MYSQL=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_USER=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_NAME=e.ATTR_DB_CONNECTION_STRING=void 0,e.ATTR_DB_CONNECTION_STRING=`db.connection_string`,e.ATTR_DB_NAME=`db.name`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_DB_USER=`db.user`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_SYSTEM_VALUE_MYSQL=`mysql`})),kP=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.addSqlCommenterComment=void 0;var n=(T(),e(k)),r=(ui(),e(ci));function i(e){let t=e.indexOf(`--`);return t>=0?!0:e.indexOf(`/*`)<0?!1:t<e.indexOf(`*/`)}function a(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function o(e,t){if(typeof t!=`string`||t.length===0||i(t))return t;let o=new r.W3CTraceContextPropagator,s={};o.inject(n.trace.setSpan(n.ROOT_CONTEXT,e),s,n.defaultTextMapSetter);let c=Object.keys(s).sort();return c.length===0?t:`${t} /*${c.map(e=>`${e}='${a(s[e])}'`).join(`,`)}*/`}t.addSqlCommenterComment=o})),AP=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getConnectionPrototypeToInstrument=t.once=t.getSpanName=t.getQueryText=t.getConnectionAttributes=void 0;var n=OP(),r=(L(),e(I)),i=(F(),e(A));function a(e,t,a){let{host:c,port:l,database:u,user:d}=o(e),f={};t&r.SemconvStability.OLD&&(f[n.ATTR_DB_CONNECTION_STRING]=s(c,l,u),f[n.ATTR_DB_NAME]=u,f[n.ATTR_DB_USER]=d),t&r.SemconvStability.STABLE&&(f[i.ATTR_DB_NAMESPACE]=u);let p=parseInt(l,10);return a&r.SemconvStability.OLD&&(f[n.ATTR_NET_PEER_NAME]=c,isNaN(p)||(f[n.ATTR_NET_PEER_PORT]=p)),a&r.SemconvStability.STABLE&&(f[i.ATTR_SERVER_ADDRESS]=c,isNaN(p)||(f[i.ATTR_SERVER_PORT]=p)),f}t.getConnectionAttributes=a;function o(e){let{host:t,port:n,database:r,user:i}=e&&e.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function s(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function c(e,t,n,r=!1,i=l){let[a,o]=typeof e==`string`?[e,n]:[e.sql,u(e)?n||e.values:n];try{return r?i(a):t&&o?t(a,o):a}catch{return`Could not determine the query due to an error in masking or formatting`}}t.getQueryText=c;function l(e){return e.replace(/\b\d+\b/g,`?`).replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,`?`)}function u(e){return`values`in e}function d(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}t.getSpanName=d,t.once=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function f(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query==`function`&&typeof n?.execute==`function`?n:t}t.getConnectionPrototypeToInstrument=f})),jP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.60.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-mysql2`})),MP=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.MySQL2Instrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=OP(),s=kP(),c=AP(),l=jP(),u=(F(),e(A)),d=[`>=1.4.2 <4`];t.MySQL2Instrumentation=class extends r.InstrumentationBase{constructor(e={}){super(l.PACKAGE_NAME,l.PACKAGE_VERSION,e),o(this,`_netSemconvStability`,void 0),o(this,`_dbSemconvStability`,void 0),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,r.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,r.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function t(t){!e&&t.format&&(e=t.format)}let n=t=>{(0,r.isWrapped)(t.query)&&this._unwrap(t,`query`),this._wrap(t,`query`,this._patchQuery(e,!1)),(0,r.isWrapped)(t.execute)&&this._unwrap(t,`execute`),this._wrap(t,`execute`,this._patchQuery(e,!0))},i=e=>{this._unwrap(e,`query`),this._unwrap(e,`execute`)};return[new r.InstrumentationNodeModuleDefinition(`mysql2`,d,e=>(t(e),e),()=>{},[new r.InstrumentationNodeModuleFile(`mysql2/promise.js`,d,e=>(t(e),e),()=>{}),new r.InstrumentationNodeModuleFile(`mysql2/lib/connection.js`,d,e=>(n((0,c.getConnectionPrototypeToInstrument)(e)),e),e=>{e!==void 0&&i((0,c.getConnectionPrototypeToInstrument)(e))})])]}_patchQuery(e,t){return a=>{let o=this;return function(l,d,f){let p;Array.isArray(d)?p=d:arguments[2]&&(p=[d]);let{maskStatement:m,maskStatementHook:h,responseHook:g}=o.getConfig(),_=(0,c.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),v=(0,c.getQueryText)(l,e,p,m,h);o._dbSemconvStability&r.SemconvStability.OLD&&(_[i.ATTR_DB_SYSTEM]=i.DB_SYSTEM_VALUE_MYSQL,_[i.ATTR_DB_STATEMENT]=v),o._dbSemconvStability&r.SemconvStability.STABLE&&(_[u.ATTR_DB_SYSTEM_NAME]=u.DB_SYSTEM_NAME_VALUE_MYSQL,_[u.ATTR_DB_QUERY_TEXT]=v);let y=o.tracer.startSpan((0,c.getSpanName)(l),{kind:n.SpanKind.CLIENT,attributes:_});!t&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=l=typeof l==`string`?(0,s.addSqlCommenterComment)(y,l):Object.assign(l,{sql:(0,s.addSqlCommenterComment)(y,l.sql)}));let b=(0,c.once)((e,t)=>{e?y.setStatus({code:n.SpanStatusCode.ERROR,message:e.message}):typeof g==`function`&&(0,r.safeExecuteInTheMiddle)(()=>{g(y,{queryResults:t})},e=>{e&&o._diag.warn(`Failed executing responseHook`,e)},!0),y.end()});if(arguments.length===1){typeof l.onResult==`function`&&o._wrap(l,`onResult`,o._patchCallbackQuery(b));let e=a.apply(this,arguments);return e.once(`error`,e=>{b(e)}).once(`result`,e=>{b(void 0,e)}),e}return typeof arguments[1]==`function`?o._wrap(arguments,1,o._patchCallbackQuery(b)):typeof arguments[2]==`function`&&o._wrap(arguments,2,o._patchCallbackQuery(b)),a.apply(this,arguments)}}}_patchCallbackQuery(e){return t=>function(n,r,i){return e(n,r),t(...arguments)}}}})),NP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MySQL2Instrumentation=void 0;var t=MP();Object.defineProperty(e,`MySQL2Instrumentation`,{enumerable:!0,get:function(){return t.MySQL2Instrumentation}})})),PP,FP,IP,LP,RP,zP=n((()=>{PP=NP(),X(),$(),FP=`Mysql2`,IP=Z(FP,()=>new PP.MySQL2Instrumentation({responseHook(e){yk(e,`auto.db.otel.mysql2`)}})),LP=(()=>({name:FP,setupOnce(){IP()}})),RP=Y(LP)})),BP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DB_SYSTEM_VALUE_REDIS=e.DB_SYSTEM_NAME_VALUE_REDIS=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_CONNECTION_STRING=void 0,e.ATTR_DB_CONNECTION_STRING=`db.connection_string`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_SYSTEM_NAME_VALUE_REDIS=`redis`,e.DB_SYSTEM_VALUE_REDIS=`redis`})),VP=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.endSpan=void 0;var n=(T(),e(k));t.endSpan=(e,t)=>{t&&(e.recordException(t),e.setStatus({code:n.SpanStatusCode.ERROR,message:t.message})),e.end()}})),HP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultDbStatementSerializer=void 0;var t=[{regex:/^ECHO/i,args:0},{regex:/^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i,args:1},{regex:/^(HSET|HMSET|LSET|LINSERT)/i,args:2},{regex:/^(ACL|BIT|B[LRZ]|CLIENT|CLUSTER|CONFIG|COMMAND|DECR|DEL|EVAL|EX|FUNCTION|GEO|GET|HINCR|HMGET|HSCAN|INCR|L[TRLM]|MEMORY|P[EFISTU]|RPOP|S[CDIMORSU]|XACK|X[CDGILPRT]|Z[CDILMPRS])/i,args:-1}];e.defaultDbStatementSerializer=(e,n)=>{if(Array.isArray(n)&&n.length){let r=t.find(({regex:t})=>t.test(e))?.args??0,i=r>=0?n.slice(0,r):n;return n.length>i.length&&i.push(`[${n.length-r} other arguments]`),`${e} ${i.join(` `)}`}return e}})),UP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.62.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-ioredis`})),WP=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.IORedisInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=(F(),e(A)),s=BP(),c=(L(),e(I)),l=VP(),u=HP(),d=UP(),f={requireParentSpan:!0};t.IORedisInstrumentation=class extends r.InstrumentationBase{constructor(e={}){super(d.PACKAGE_NAME,d.PACKAGE_VERSION,{...f,...e}),o(this,`_netSemconvStability`,void 0),o(this,`_dbSemconvStability`,void 0),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,r.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,r.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...f,...e})}init(){return[new r.InstrumentationNodeModuleDefinition(`ioredis`,[`>=2.0.0 <6`],(e,t)=>{let n=e[Symbol.toStringTag]===`Module`?e.default:e;return(0,r.isWrapped)(n.prototype.sendCommand)&&this._unwrap(n.prototype,`sendCommand`),this._wrap(n.prototype,`sendCommand`,this._patchSendCommand(t)),(0,r.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,`connect`),this._wrap(n.prototype,`connect`,this._patchConnection()),e},e=>{if(e===void 0)return;let t=e[Symbol.toStringTag]===`Module`?e.default:e;this._unwrap(t.prototype,`sendCommand`),this._unwrap(t.prototype,`connect`)})]}_patchSendCommand(e){return t=>this._traceSendCommand(t,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,t){let a=this;return function(o){if(arguments.length<1||typeof o!=`object`)return e.apply(this,arguments);let d=a.getConfig(),f=d.dbStatementSerializer||u.defaultDbStatementSerializer,p=n.trace.getSpan(n.context.active())===void 0;if(d.requireParentSpan===!0&&p)return e.apply(this,arguments);let m={},{host:h,port:g}=this.options,_=f(o.name,o.args);a._dbSemconvStability&r.SemconvStability.OLD&&(m[s.ATTR_DB_SYSTEM]=s.DB_SYSTEM_VALUE_REDIS,m[s.ATTR_DB_STATEMENT]=_,m[s.ATTR_DB_CONNECTION_STRING]=`redis://${h}:${g}`),a._dbSemconvStability&r.SemconvStability.STABLE&&(m[i.ATTR_DB_SYSTEM_NAME]=s.DB_SYSTEM_NAME_VALUE_REDIS,m[i.ATTR_DB_QUERY_TEXT]=_),a._netSemconvStability&r.SemconvStability.OLD&&(m[s.ATTR_NET_PEER_NAME]=h,m[s.ATTR_NET_PEER_PORT]=g),a._netSemconvStability&r.SemconvStability.STABLE&&(m[i.ATTR_SERVER_ADDRESS]=h,m[i.ATTR_SERVER_PORT]=g);let v=a.tracer.startSpan(o.name,{kind:n.SpanKind.CLIENT,attributes:m}),{requestHook:y}=d;y&&(0,c.safeExecuteInTheMiddle)(()=>y(v,{moduleVersion:t,cmdName:o.name,cmdArgs:o.args}),e=>{e&&n.diag.error(`ioredis instrumentation: request hook failed`,e)},!0);try{let t=e.apply(this,arguments),r=o.resolve;o.resolve=function(e){(0,c.safeExecuteInTheMiddle)(()=>d.responseHook?.(v,o.name,o.args,e),e=>{e&&n.diag.error(`ioredis instrumentation: response hook failed`,e)},!0),(0,l.endSpan)(v,null),r(e)};let i=o.reject;return o.reject=function(e){(0,l.endSpan)(v,e),i(e)},t}catch(e){throw(0,l.endSpan)(v,e),e}}}_traceConnection(e){let t=this;return function(){let a=n.trace.getSpan(n.context.active())===void 0;if(t.getConfig().requireParentSpan===!0&&a)return e.apply(this,arguments);let o={},{host:c,port:u}=this.options;t._dbSemconvStability&r.SemconvStability.OLD&&(o[s.ATTR_DB_SYSTEM]=s.DB_SYSTEM_VALUE_REDIS,o[s.ATTR_DB_STATEMENT]=`connect`,o[s.ATTR_DB_CONNECTION_STRING]=`redis://${c}:${u}`),t._dbSemconvStability&r.SemconvStability.STABLE&&(o[i.ATTR_DB_SYSTEM_NAME]=s.DB_SYSTEM_NAME_VALUE_REDIS,o[i.ATTR_DB_QUERY_TEXT]=`connect`),t._netSemconvStability&r.SemconvStability.OLD&&(o[s.ATTR_NET_PEER_NAME]=c,o[s.ATTR_NET_PEER_PORT]=u),t._netSemconvStability&r.SemconvStability.STABLE&&(o[i.ATTR_SERVER_ADDRESS]=c,o[i.ATTR_SERVER_PORT]=u);let d=t.tracer.startSpan(`connect`,{kind:n.SpanKind.CLIENT,attributes:o});try{let t=e.apply(this,arguments);return(0,l.endSpan)(d,null),t}catch(e){throw(0,l.endSpan)(d,e),e}}}}})),GP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.IORedisInstrumentation=void 0;var t=WP();Object.defineProperty(e,`IORedisInstrumentation`,{enumerable:!0,get:function(){return t.IORedisInstrumentation}})})),KP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.62.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-redis`})),qP=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getTracedCreateStreamTrace=t.getTracedCreateClient=t.endSpan=void 0;var n=(T(),e(k));t.endSpan=(e,t)=>{t&&e.setStatus({code:n.SpanStatusCode.ERROR,message:t.message}),e.end()},t.getTracedCreateClient=e=>function(){let t=e.apply(this,arguments);return n.context.bind(n.context.active(),t)},t.getTracedCreateStreamTrace=e=>function(){return Object.prototype.hasOwnProperty.call(this,`stream`)||Object.defineProperty(this,`stream`,{get(){return this._patched_redis_stream},set(e){n.context.bind(n.context.active(),e),this._patched_redis_stream=e}}),e.apply(this,arguments)}})),JP=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DB_SYSTEM_VALUE_REDIS=e.DB_SYSTEM_NAME_VALUE_REDIS=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_CONNECTION_STRING=void 0,e.ATTR_DB_CONNECTION_STRING=`db.connection_string`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_SYSTEM_NAME_VALUE_REDIS=`redis`,e.DB_SYSTEM_VALUE_REDIS=`redis`})),YP=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.RedisInstrumentationV2_V3=void 0;var n=(L(),e(I)),r=qP(),i=KP(),s=(T(),e(k)),c=(F(),e(A)),l=JP(),u=HP(),d=class e extends n.InstrumentationBase{constructor(e={}){super(i.PACKAGE_NAME,i.PACKAGE_VERSION,e),o(this,`_semconvStability`,void 0),this._semconvStability=e.semconvStability?e.semconvStability:(0,n.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,n.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new n.InstrumentationNodeModuleDefinition(`redis`,[`>=2.6.0 <4`],e=>((0,n.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,`internal_send_command`),this._wrap(e.RedisClient.prototype,`internal_send_command`,this._getPatchInternalSendCommand()),(0,n.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,`create_stream`),this._wrap(e.RedisClient.prototype,`create_stream`,this._getPatchCreateStream()),(0,n.isWrapped)(e.createClient)&&this._unwrap(e,`createClient`),this._wrap(e,`createClient`,this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,`internal_send_command`),this._unwrap(e.RedisClient.prototype,`create_stream`),this._unwrap(e,`createClient`))})]}_getPatchInternalSendCommand(){let t=this;return function(i){return function(a){if(arguments.length!==1||typeof a!=`object`)return i.apply(this,arguments);let o=t.getConfig(),d=s.trace.getSpan(s.context.active())===void 0;if(o.requireParentSpan===!0&&d)return i.apply(this,arguments);let f=o?.dbStatementSerializer||u.defaultDbStatementSerializer,p={};t._semconvStability&n.SemconvStability.OLD&&Object.assign(p,{[l.ATTR_DB_SYSTEM]:l.DB_SYSTEM_VALUE_REDIS,[l.ATTR_DB_STATEMENT]:f(a.command,a.args)}),t._semconvStability&n.SemconvStability.STABLE&&Object.assign(p,{[c.ATTR_DB_SYSTEM_NAME]:l.DB_SYSTEM_NAME_VALUE_REDIS,[c.ATTR_DB_OPERATION_NAME]:a.command,[c.ATTR_DB_QUERY_TEXT]:f(a.command,a.args)});let m=t.tracer.startSpan(`${e.COMPONENT}-${a.command}`,{kind:s.SpanKind.CLIENT,attributes:p});if(this.connection_options){let e={};t._semconvStability&n.SemconvStability.OLD&&Object.assign(e,{[l.ATTR_NET_PEER_NAME]:this.connection_options.host,[l.ATTR_NET_PEER_PORT]:this.connection_options.port}),t._semconvStability&n.SemconvStability.STABLE&&Object.assign(e,{[c.ATTR_SERVER_ADDRESS]:this.connection_options.host,[c.ATTR_SERVER_PORT]:this.connection_options.port}),m.setAttributes(e)}this.address&&t._semconvStability&n.SemconvStability.OLD&&m.setAttribute(l.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let h=arguments[0].callback;if(h){let e=s.context.active();arguments[0].callback=function(i,c){if(o?.responseHook){let e=o.responseHook;(0,n.safeExecuteInTheMiddle)(()=>{e(m,a.command,a.args,c)},e=>{e&&t._diag.error(`Error executing responseHook`,e)},!0)}return(0,r.endSpan)(m,i),s.context.with(e,h,this,...arguments)}}try{return i.apply(this,arguments)}catch(e){throw(0,r.endSpan)(m,e),e}}}}_getPatchCreateClient(){return function(e){return(0,r.getTracedCreateClient)(e)}}_getPatchCreateStream(){return function(e){return(0,r.getTracedCreateStreamTrace)(e)}}};o(d,`COMPONENT`,`redis`),t.RedisInstrumentationV2_V3=d})),XP=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getClientAttributes=void 0;var n=(F(),e(A)),r=JP(),i=(L(),e(I));function a(e,t,a){let s={};return a&i.SemconvStability.OLD&&Object.assign(s,{[r.ATTR_DB_SYSTEM]:r.DB_SYSTEM_VALUE_REDIS,[r.ATTR_NET_PEER_NAME]:t?.socket?.host,[r.ATTR_NET_PEER_PORT]:t?.socket?.port,[r.ATTR_DB_CONNECTION_STRING]:o(e,t?.url)}),a&i.SemconvStability.STABLE&&Object.assign(s,{[n.ATTR_DB_SYSTEM_NAME]:r.DB_SYSTEM_NAME_VALUE_REDIS,[n.ATTR_SERVER_ADDRESS]:t?.socket?.host,[n.ATTR_SERVER_PORT]:t?.socket?.port}),s}t.getClientAttributes=a;function o(e,t){if(!(typeof t!=`string`||!t))try{let e=new URL(t);return e.searchParams.delete(`user_pwd`),e.username=``,e.password=``,e.href}catch(t){e.error(`failed to sanitize redis connection url`,t)}}})),ZP=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.RedisInstrumentationV4_V5=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=XP(),s=HP(),c=KP(),l=(F(),e(A)),u=JP(),d=Symbol(`opentelemetry.instrumentation.redis.open_spans`),f=Symbol(`opentelemetry.instrumentation.redis.multi_command_options`),p=class e extends r.InstrumentationBase{constructor(e={}){super(c.PACKAGE_NAME,c.PACKAGE_VERSION,e),o(this,`_semconvStability`,void 0),this._semconvStability=e.semconvStability?e.semconvStability:(0,r.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,r.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition(`@redis/client`),this._getInstrumentationNodeModuleDefinition(`@node-redis/client`)]}_getInstrumentationNodeModuleDefinition(e){let t=new r.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,[`^1.0.0`],(e,t)=>{let n=e.transformCommandArguments;if(!n)return this._diag.error(`internal instrumentation error, missing transformCommandArguments function`),e;let i=t?.startsWith(`1.0.`)?`extendWithCommands`:`attachCommands`;return(0,r.isWrapped)(e?.[i])&&this._unwrap(e,i),this._wrap(e,i,this._getPatchExtendWithCommands(n)),e},e=>{(0,r.isWrapped)(e?.extendWithCommands)&&this._unwrap(e,`extendWithCommands`),(0,r.isWrapped)(e?.attachCommands)&&this._unwrap(e,`attachCommands`)}),n=new r.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,[`^1.0.0`,`^5.0.0`],e=>{let t=e?.default?.prototype;return(0,r.isWrapped)(t?.exec)&&this._unwrap(t,`exec`),this._wrap(t,`exec`,this._getPatchMultiCommandsExec(!1)),(0,r.isWrapped)(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),this._wrap(t,`execAsPipeline`,this._getPatchMultiCommandsExec(!0)),(0,r.isWrapped)(t?.addCommand)&&this._unwrap(t,`addCommand`),this._wrap(t,`addCommand`,this._getPatchMultiCommandsAddCommand()),e},e=>{let t=e?.default?.prototype;(0,r.isWrapped)(t?.exec)&&this._unwrap(t,`exec`),(0,r.isWrapped)(t?.addCommand)&&this._unwrap(t,`addCommand`)}),i=new r.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,[`^1.0.0`,`^5.0.0`],e=>{let t=e?.default?.prototype;return t?.multi&&((0,r.isWrapped)(t?.multi)&&this._unwrap(t,`multi`),this._wrap(t,`multi`,this._getPatchRedisClientMulti())),t?.MULTI&&((0,r.isWrapped)(t?.MULTI)&&this._unwrap(t,`MULTI`),this._wrap(t,`MULTI`,this._getPatchRedisClientMulti())),(0,r.isWrapped)(t?.sendCommand)&&this._unwrap(t,`sendCommand`),this._wrap(t,`sendCommand`,this._getPatchRedisClientSendCommand()),this._wrap(t,`connect`,this._getPatchedClientConnect()),e},e=>{let t=e?.default?.prototype;(0,r.isWrapped)(t?.multi)&&this._unwrap(t,`multi`),(0,r.isWrapped)(t?.MULTI)&&this._unwrap(t,`MULTI`),(0,r.isWrapped)(t?.sendCommand)&&this._unwrap(t,`sendCommand`)});return new r.InstrumentationNodeModuleDefinition(e,[`^1.0.0`,`^5.0.0`],e=>e,()=>{},[t,n,i])}_getPatchExtendWithCommands(e){let t=this;return function(n){return function(r){if(r?.BaseClass?.name!==`RedisClient`)return n.apply(this,arguments);let i=r.executor;return r.executor=function(n,r){let a=e(n,r).args;return t._traceClientCommand(i,this,arguments,a)},n.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let t=this;return function(n){return function(){let r=n.apply(this,arguments);return typeof r?.then==`function`?r.then(n=>{let r=this[d];return t._endSpansWithRedisReplies(r,n,e),n}).catch(n=>{let r=this[d];if(!r)t._diag.error(`cannot find open spans to end for multi/pipeline`);else{let i=n.constructor.name===`MultiErrorReply`?n.replies:Array(r.length).fill(n);t._endSpansWithRedisReplies(r,i,e)}return Promise.reject(n)}):(t._diag.error(`non-promise result when patching exec/execAsPipeline`),r)}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(t){return function(n){return e._traceClientCommand(t,this,arguments,n)}}}_getPatchRedisClientMulti(){return function(e){return function(){let t=e.apply(this,arguments);return t[f]=this.options,t}}}_getPatchRedisClientSendCommand(){let e=this;return function(t){return function(n){return e._traceClientCommand(t,this,arguments,n)}}}_getPatchedClientConnect(){let t=this;return function(r){return function(){let a=this.options,o=(0,i.getClientAttributes)(t._diag,a,t._semconvStability),s=t.tracer.startSpan(`${e.COMPONENT}-connect`,{kind:n.SpanKind.CLIENT,attributes:o});return n.context.with(n.trace.setSpan(n.context.active(),s),()=>r.apply(this)).then(e=>(s.end(),e)).catch(e=>(s.recordException(e),s.setStatus({code:n.SpanStatusCode.ERROR,message:e.message}),s.end(),Promise.reject(e)))}}}_traceClientCommand(t,a,o,c){if(n.trace.getSpan(n.context.active())===void 0&&this.getConfig().requireParentSpan)return t.apply(a,o);let p=a.options||a[f],m=c[0],h=c.slice(1),g=this.getConfig().dbStatementSerializer||s.defaultDbStatementSerializer,_=(0,i.getClientAttributes)(this._diag,p,this._semconvStability);this._semconvStability&r.SemconvStability.STABLE&&(_[l.ATTR_DB_OPERATION_NAME]=m);try{let e=g(m,h);e!=null&&(this._semconvStability&r.SemconvStability.OLD&&(_[u.ATTR_DB_STATEMENT]=e),this._semconvStability&r.SemconvStability.STABLE&&(_[l.ATTR_DB_QUERY_TEXT]=e))}catch(e){this._diag.error(`dbStatementSerializer throw an exception`,e,{commandName:m})}let v=this.tracer.startSpan(`${e.COMPONENT}-${m}`,{kind:n.SpanKind.CLIENT,attributes:_}),y=n.context.with(n.trace.setSpan(n.context.active(),v),()=>t.apply(a,o));if(typeof y?.then==`function`)y.then(e=>{this._endSpanWithResponse(v,m,h,e,void 0)},e=>{this._endSpanWithResponse(v,m,h,null,e)});else{let e=y;e[d]=e[d]||[],e[d].push({span:v,commandName:m,commandArgs:h})}return y}_endSpansWithRedisReplies(e,t,n=!1){if(!e)return this._diag.error(`cannot find open spans to end for redis multi/pipeline`);if(t.length!==e.length)return this._diag.error(`number of multi command spans does not match response from redis`);let i=e.map(e=>e.commandName),a=i.every(e=>e===i[0])?(n?`PIPELINE `:`MULTI `)+i[0]:n?`PIPELINE`:`MULTI`;for(let n=0;n<e.length;n++){let{span:o,commandArgs:s}=e[n],c=t[n],[u,d]=c instanceof Error?[null,c]:[c,void 0];this._semconvStability&r.SemconvStability.STABLE&&o.setAttribute(l.ATTR_DB_OPERATION_NAME,a),this._endSpanWithResponse(o,i[n],s,u,d)}}_endSpanWithResponse(e,t,r,i,a){let{responseHook:o}=this.getConfig();if(!a&&o)try{o(e,t,r,i)}catch(e){this._diag.error(`responseHook throw an exception`,e)}a&&(e.recordException(a),e.setStatus({code:n.SpanStatusCode.ERROR,message:a?.message})),e.end()}};o(p,`COMPONENT`,`redis`),t.RedisInstrumentationV4_V5=p})),QP=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.RedisInstrumentation=void 0;var n=(L(),e(I)),r=KP(),i=YP(),s=ZP(),c={requireParentSpan:!1};t.RedisInstrumentation=class extends n.InstrumentationBase{constructor(e={}){let t={...c,...e};super(r.PACKAGE_NAME,r.PACKAGE_VERSION,t),o(this,`instrumentationV2_V3`,void 0),o(this,`instrumentationV4_V5`,void 0),o(this,`initialized`,!1),this.instrumentationV2_V3=new i.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new s.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let t={...c,...e};super.setConfig(t),this.initialized&&(this.instrumentationV2_V3.setConfig(t),this.instrumentationV4_V5.setConfig(t))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}}})),$P=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RedisInstrumentation=void 0;var t=QP();Object.defineProperty(e,`RedisInstrumentation`,{enumerable:!0,get:function(){return t.RedisInstrumentation}})}));function eF(e,t){return e.includes(t.toLowerCase())}function tF(e){if(eF(cF,e))return`cache.get`;if(eF(lF,e))return`cache.put`}function nF(e,t){return t.some(t=>e.startsWith(t))}function rF(e,t){try{if(t.length===0)return;let n=e=>typeof e==`string`||typeof e==`number`||Buffer.isBuffer(e)?[e.toString()]:Array.isArray(e)?oF(e.map(e=>n(e))):[`<unknown>`],r=t[0];return eF(sF,e)&&r!=null?n(r):oF(t.map(e=>n(e)))}catch{return}}function iF(e,t,n){if(!tF(e))return!1;for(let e of t)if(nF(e,n))return!0;return!1}function aF(e){let t=e=>{try{return Buffer.isBuffer(e)?e.byteLength:typeof e==`string`?e.length:typeof e==`number`?e.toString().length:e==null?0:JSON.stringify(e).length}catch{return}};return Array.isArray(e)?e.reduce((e,n)=>{let r=t(n);return typeof r==`number`?e===void 0?r:e+r:e},0):t(e)}function oF(e){let t=[],n=e=>{e.forEach(e=>{Array.isArray(e)?n(e):t.push(e)})};return n(e),t}var sF,cF,lF,uF=n((()=>{sF=[`get`,`set`,`setex`],cF=[`get`,`mget`],lF=[`set`,`setex`]})),dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF=n((()=>{dF=GP(),fF=$P(),X(),$(),uF(),pF=`Redis`,mF={},hF=(e,t,n,r)=>{e.setAttribute(K,`auto.db.otel.redis`);let i=rF(t,n),a=tF(t);if(!i||!a||!mF.cachePrefixes||!iF(t,i,mF.cachePrefixes))return;let o=q(e).data[`net.peer.name`],s=q(e).data[`net.peer.port`];s&&o&&e.setAttributes({"network.peer.address":o,"network.peer.port":s});let c=aF(r);c&&e.setAttribute(Pl,c),eF(cF,t)&&c!==void 0&&e.setAttribute(Ml,c>0),e.setAttributes({[G]:a,[Nl]:i});let l=i.join(`, `);e.updateName(mF.maxCacheKeyLength?Ks(l,mF.maxCacheKeyLength):l)},gF=Z(`${pF}.IORedis`,()=>new dF.IORedisInstrumentation({responseHook:hF})),_F=Z(`${pF}.Redis`,()=>new fF.RedisInstrumentation({responseHook:hF})),vF=Object.assign(()=>{gF(),_F()},{id:pF}),yF=((e={})=>({name:pF,setupOnce(){mF=e,vF()}})),bF=Y(yF)})),SF=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.EVENT_LISTENERS_SET=void 0,e.EVENT_LISTENERS_SET=Symbol(`opentelemetry.instrumentation.pg.eventListenersSet`)})),CF=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=void 0,(function(e){e.PG_VALUES=`db.postgresql.values`,e.PG_PLAN=`db.postgresql.plan`,e.IDLE_TIMEOUT_MILLIS=`db.postgresql.idle.timeout.millis`,e.MAX_CLIENT=`db.postgresql.max.client`})(e.AttributeNames||(e.AttributeNames={}))})),wF=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=e.METRIC_DB_CLIENT_CONNECTION_COUNT=e.DB_SYSTEM_VALUE_POSTGRESQL=e.DB_CLIENT_CONNECTION_STATE_VALUE_USED=e.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_USER=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_NAME=e.ATTR_DB_CONNECTION_STRING=e.ATTR_DB_CLIENT_CONNECTION_STATE=e.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0,e.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=`db.client.connection.pool.name`,e.ATTR_DB_CLIENT_CONNECTION_STATE=`db.client.connection.state`,e.ATTR_DB_CONNECTION_STRING=`db.connection_string`,e.ATTR_DB_NAME=`db.name`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_DB_USER=`db.user`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=`idle`,e.DB_CLIENT_CONNECTION_STATE_VALUE_USED=`used`,e.DB_SYSTEM_VALUE_POSTGRESQL=`postgresql`,e.METRIC_DB_CLIENT_CONNECTION_COUNT=`db.client.connection.count`,e.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=`db.client.connection.pending_requests`})),TF=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SpanNames=void 0,(function(e){e.QUERY_PREFIX=`pg.query`,e.CONNECT=`pg.connect`,e.POOL_CONNECT=`pg-pool.connect`})(e.SpanNames||(e.SpanNames={}))})),EF=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.sanitizedErrorMessage=t.isObjectWithTextString=t.getErrorMessage=t.patchClientConnectCallback=t.patchCallbackPGPool=t.updateCounter=t.getPoolName=t.patchCallback=t.handleExecutionResult=t.handleConfigQuery=t.shouldSkipInstrumentation=t.getSemanticAttributesFromPoolConnection=t.getSemanticAttributesFromConnection=t.getConnectionString=t.parseAndMaskConnectionString=t.parseNormalizedOperationName=t.getQuerySpanName=void 0;var n=(T(),e(k)),r=CF(),i=(F(),e(A)),a=wF(),o=(L(),e(I)),s=TF();function c(e,t){if(!t)return s.SpanNames.QUERY_PREFIX;let n=typeof t.name==`string`&&t.name?t.name:l(t.text);return`${s.SpanNames.QUERY_PREFIX}:${n}${e?` ${e}`:``}`}t.getQuerySpanName=c;function l(e){let t=e.trim(),n=t.indexOf(` `),r=n===-1?t:t.slice(0,n);return r=r.toUpperCase(),r.endsWith(`;`)?r.slice(0,-1):r}t.parseNormalizedOperationName=l;function u(e){try{let t=new URL(e);return t.username=``,t.password=``,t.toString()}catch{return`postgresql://localhost:5432/`}}t.parseAndMaskConnectionString=u;function d(e){return`connectionString`in e&&e.connectionString?u(e.connectionString):`postgresql://${e.host||`localhost`}:${e.port||5432}/${e.database||``}`}t.getConnectionString=d;function f(e){if(Number.isInteger(e))return e}function p(e,t){let n={};return t&o.SemconvStability.OLD&&(n={...n,[a.ATTR_DB_SYSTEM]:a.DB_SYSTEM_VALUE_POSTGRESQL,[a.ATTR_DB_NAME]:e.database,[a.ATTR_DB_CONNECTION_STRING]:d(e),[a.ATTR_DB_USER]:e.user,[a.ATTR_NET_PEER_NAME]:e.host,[a.ATTR_NET_PEER_PORT]:f(e.port)}),t&o.SemconvStability.STABLE&&(n={...n,[i.ATTR_DB_SYSTEM_NAME]:i.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[i.ATTR_DB_NAMESPACE]:e.namespace,[i.ATTR_SERVER_ADDRESS]:e.host,[i.ATTR_SERVER_PORT]:f(e.port)}),n}t.getSemanticAttributesFromConnection=p;function m(e,t){let n;try{n=e.connectionString?new URL(e.connectionString):void 0}catch{n=void 0}let s={[r.AttributeNames.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[r.AttributeNames.MAX_CLIENT]:e.maxClient};return t&o.SemconvStability.OLD&&(s={...s,[a.ATTR_DB_SYSTEM]:a.DB_SYSTEM_VALUE_POSTGRESQL,[a.ATTR_DB_NAME]:n?.pathname.slice(1)??e.database,[a.ATTR_DB_CONNECTION_STRING]:d(e),[a.ATTR_NET_PEER_NAME]:n?.hostname??e.host,[a.ATTR_NET_PEER_PORT]:Number(n?.port)||f(e.port),[a.ATTR_DB_USER]:n?.username??e.user}),t&o.SemconvStability.STABLE&&(s={...s,[i.ATTR_DB_SYSTEM_NAME]:i.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[i.ATTR_DB_NAMESPACE]:e.namespace,[i.ATTR_SERVER_ADDRESS]:n?.hostname??e.host,[i.ATTR_SERVER_PORT]:Number(n?.port)||f(e.port)}),s}t.getSemanticAttributesFromPoolConnection=m;function h(e){return e.requireParentSpan===!0&&n.trace.getSpan(n.context.active())===void 0}t.shouldSkipInstrumentation=h;function g(e,t,s,l){let{connectionParameters:u}=this,d=u.database,f=c(d,l),m=e.startSpan(f,{kind:n.SpanKind.CLIENT,attributes:p(u,s)});if(!l)return m;if(l.text&&(s&o.SemconvStability.OLD&&m.setAttribute(a.ATTR_DB_STATEMENT,l.text),s&o.SemconvStability.STABLE&&m.setAttribute(i.ATTR_DB_QUERY_TEXT,l.text)),t.enhancedDatabaseReporting&&Array.isArray(l.values))try{let e=l.values.map(e=>e==null?`null`:e instanceof Buffer?e.toString():typeof e==`object`?typeof e.toPostgres==`function`?e.toPostgres():JSON.stringify(e):e.toString());m.setAttribute(r.AttributeNames.PG_VALUES,e)}catch(e){n.diag.error(`failed to stringify `,l.values,e)}return typeof l.name==`string`&&m.setAttribute(r.AttributeNames.PG_PLAN,l.name),m}t.handleConfigQuery=g;function _(e,t,r){typeof e.responseHook==`function`&&(0,o.safeExecuteInTheMiddle)(()=>{e.responseHook(t,{data:r})},e=>{e&&n.diag.error(`Error running response hook`,e)},!0)}t.handleExecutionResult=_;function v(e,t,r,a,o){return function(s,c){s?(Object.prototype.hasOwnProperty.call(s,`code`)&&(a[i.ATTR_ERROR_TYPE]=s.code),s instanceof Error&&t.recordException(E(s)),t.setStatus({code:n.SpanStatusCode.ERROR,message:s.message})):_(e,t,c),o(),t.end(),r.call(this,s,c)}}t.patchCallback=v;function y(e){let t=``;return t+=(e?.host?`${e.host}`:`unknown_host`)+`:`,t+=(e?.port?`${e.port}`:`unknown_port`)+`/`,t+=e?.database?`${e.database}`:`unknown_database`,t.trim()}t.getPoolName=y;function b(e,t,n,r,i){let o=t.totalCount,s=t.waitingCount,c=t.idleCount,l=o-c;return n.add(l-i.used,{[a.ATTR_DB_CLIENT_CONNECTION_STATE]:a.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[a.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:e}),n.add(c-i.idle,{[a.ATTR_DB_CLIENT_CONNECTION_STATE]:a.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[a.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:e}),r.add(s-i.pending,{[a.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:e}),{used:l,idle:c,pending:s}}t.updateCounter=b;function x(e,t){return function(r,i,a){r&&(r instanceof Error&&e.recordException(E(r)),e.setStatus({code:n.SpanStatusCode.ERROR,message:r.message})),e.end(),t.call(this,r,i,a)}}t.patchCallbackPGPool=x;function S(e,t){return function(r){r&&(r instanceof Error&&e.recordException(E(r)),e.setStatus({code:n.SpanStatusCode.ERROR,message:r.message})),e.end(),t.apply(this,arguments)}}t.patchClientConnectCallback=S;function C(e){return typeof e==`object`&&e&&`message`in e?String(e.message):void 0}t.getErrorMessage=C;function w(e){return typeof e==`object`&&typeof e?.text==`string`}t.isObjectWithTextString=w;function E(e){return`PostgreSQL error of type '${e?.name??`PostgreSQLError`}' occurred (code: ${e?.code??`UNKNOWN`})`}t.sanitizedErrorMessage=E})),DF=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.66.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-pg`})),OF=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.PgInstrumentation=void 0;var n=(L(),e(I)),r=(T(),e(k)),i=SF(),s=EF(),c=kP(),l=DF(),u=TF(),d=(ui(),e(ci)),f=(F(),e(A)),p=wF();function m(e){return e[Symbol.toStringTag]===`Module`?e.default:e}t.PgInstrumentation=class extends n.InstrumentationBase{constructor(e={}){super(l.PACKAGE_NAME,l.PACKAGE_VERSION,e),o(this,`_connectionsCounter`,{used:0,idle:0,pending:0}),o(this,`_semconvStability`,void 0),this._semconvStability=(0,n.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(f.METRIC_DB_CLIENT_OPERATION_DURATION,{description:`Duration of database client operations.`,unit:`s`,valueType:r.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(p.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`}),this._connectionPendingRequests=this.meter.createUpDownCounter(p.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:`The number of current pending requests for an open connection.`,unit:`{connection}`})}init(){let e=[`>=8.0.3 <9`],t=[`>=2.0.0 <4`],r=new n.InstrumentationNodeModuleFile(`pg/lib/native/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),i=new n.InstrumentationNodeModuleFile(`pg/lib/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this));return[new n.InstrumentationNodeModuleDefinition(`pg`,e,e=>{let t=m(e);return this._patchPgClient(t.Client),e},e=>{let t=m(e);return this._unpatchPgClient(t.Client),e},[i,r]),new n.InstrumentationNodeModuleDefinition(`pg-pool`,t,e=>{let t=m(e);return(0,n.isWrapped)(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`connect`,this._getPoolConnectPatch()),t},e=>{let t=m(e);(0,n.isWrapped)(t.prototype.connect)&&this._unwrap(t.prototype,`connect`)})]}_patchPgClient(e){if(!e)return;let t=m(e);return(0,n.isWrapped)(t.prototype.query)&&this._unwrap(t.prototype,`query`),(0,n.isWrapped)(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`query`,this._getClientQueryPatch()),this._wrap(t.prototype,`connect`,this._getClientConnectPatch()),e}_unpatchPgClient(e){let t=m(e);return(0,n.isWrapped)(t.prototype.query)&&this._unwrap(t.prototype,`query`),(0,n.isWrapped)(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),e}_getClientConnectPatch(){let e=this;return t=>function(n){let i=e.getConfig();if(s.shouldSkipInstrumentation(i)||i.ignoreConnectSpans)return t.call(this,n);let a=e.tracer.startSpan(u.SpanNames.CONNECT,{kind:r.SpanKind.CLIENT,attributes:s.getSemanticAttributesFromConnection(this,e._semconvStability)});if(n){let e=r.trace.getSpan(r.context.active());n=s.patchClientConnectCallback(a,n),e&&(n=r.context.bind(r.context.active(),n))}return h(a,r.context.with(r.trace.setSpan(r.context.active(),a),()=>t.call(this,n)))}}recordOperationDuration(e,t){let r={},i=[f.ATTR_DB_NAMESPACE,f.ATTR_ERROR_TYPE,f.ATTR_SERVER_PORT,f.ATTR_SERVER_ADDRESS,f.ATTR_DB_OPERATION_NAME];this._semconvStability&n.SemconvStability.OLD&&i.push(p.ATTR_DB_SYSTEM),this._semconvStability&n.SemconvStability.STABLE&&i.push(f.ATTR_DB_SYSTEM_NAME),i.forEach(t=>{t in e&&(r[t]=e[t])});let a=(0,d.hrTimeToMilliseconds)((0,d.hrTimeDuration)(t,(0,d.hrTime)()))/1e3;this._operationDuration.record(a,r)}_getClientQueryPatch(){let e=this;return t=>(this._diag.debug(`Patching pg.Client.prototype.query`),function(...i){if(s.shouldSkipInstrumentation(e.getConfig()))return t.apply(this,i);let a=(0,d.hrTime)(),o=i[0],l=typeof o==`string`,u=s.isObjectWithTextString(o),m=l?{text:o,values:Array.isArray(i[1])?i[1]:void 0}:u?{...o,name:o.name,text:o.text,values:o.values??(Array.isArray(i[1])?i[1]:void 0)}:void 0,h={[p.ATTR_DB_SYSTEM]:p.DB_SYSTEM_VALUE_POSTGRESQL,[f.ATTR_DB_NAMESPACE]:this.database,[f.ATTR_SERVER_PORT]:this.connectionParameters.port,[f.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};m?.text&&(h[f.ATTR_DB_OPERATION_NAME]=s.parseNormalizedOperationName(m?.text));let g=()=>{e.recordOperationDuration(h,a)},_=e.getConfig(),v=s.handleConfigQuery.call(this,e.tracer,_,e._semconvStability,m);if(_.addSqlCommenterCommentToQueries&&(l?i[0]=(0,c.addSqlCommenterComment)(v,o):u&&!(`name`in o)&&(i[0]={...o,text:(0,c.addSqlCommenterComment)(v,o.text)})),i.length>0){let t=r.trace.getSpan(r.context.active());if(typeof i[i.length-1]==`function`)i[i.length-1]=s.patchCallback(_,v,i[i.length-1],h,g),t&&(i[i.length-1]=r.context.bind(r.context.active(),i[i.length-1]));else if(typeof m?.callback==`function`){let n=s.patchCallback(e.getConfig(),v,m.callback,h,g);t&&(n=r.context.bind(r.context.active(),n)),i[0].callback=n}}let{requestHook:y}=_;typeof y==`function`&&m&&(0,n.safeExecuteInTheMiddle)(()=>{let{database:e,host:t,port:n,user:r}=this.connectionParameters;y(v,{connection:{database:e,host:t,port:n,user:r},query:{text:m.text,values:m.values,name:m.name}})},t=>{t&&e._diag.error(`Error running query hook`,t)},!0);let b;try{b=t.apply(this,i)}catch(e){throw e instanceof Error&&v.recordException(s.sanitizedErrorMessage(e)),v.setStatus({code:r.SpanStatusCode.ERROR,message:s.getErrorMessage(e)}),v.end(),e}return b instanceof Promise?b.then(t=>new Promise(n=>{s.handleExecutionResult(e.getConfig(),v,t),g(),v.end(),n(t)})).catch(e=>new Promise((t,n)=>{e instanceof Error&&v.recordException(s.sanitizedErrorMessage(e)),v.setStatus({code:r.SpanStatusCode.ERROR,message:e.message}),g(),v.end(),n(e)})):b})}_setPoolConnectEventListeners(e){if(e[i.EVENT_LISTENERS_SET])return;let t=s.getPoolName(e.options);e.on(`connect`,()=>{this._connectionsCounter=s.updateCounter(t,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on(`acquire`,()=>{this._connectionsCounter=s.updateCounter(t,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on(`remove`,()=>{this._connectionsCounter=s.updateCounter(t,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on(`release`,()=>{this._connectionsCounter=s.updateCounter(t,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[i.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return t=>function(n){let i=e.getConfig();if(s.shouldSkipInstrumentation(i)||(e._setPoolConnectEventListeners(this),i.ignoreConnectSpans))return t.call(this,n);let a=e.tracer.startSpan(u.SpanNames.POOL_CONNECT,{kind:r.SpanKind.CLIENT,attributes:s.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(n){let e=r.trace.getSpan(r.context.active());n=s.patchCallbackPGPool(a,n),e&&(n=r.context.bind(r.context.active(),n))}return h(a,r.context.with(r.trace.setSpan(r.context.active(),a),()=>t.call(this,n)))}}};function h(e,t){if(!(t instanceof Promise))return t;let n=t;return r.context.bind(r.context.active(),n.then(t=>(e.end(),t)).catch(t=>(t instanceof Error&&e.recordException(s.sanitizedErrorMessage(t)),e.setStatus({code:r.SpanStatusCode.ERROR,message:s.getErrorMessage(t)}),e.end(),Promise.reject(t))))}})),kF=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=e.PgInstrumentation=void 0;var t=OF();Object.defineProperty(e,`PgInstrumentation`,{enumerable:!0,get:function(){return t.PgInstrumentation}});var n=CF();Object.defineProperty(e,`AttributeNames`,{enumerable:!0,get:function(){return n.AttributeNames}})})),AF,jF,MF,NF,PF,FF=n((()=>{AF=kF(),X(),$(),jF=`Postgres`,MF=Z(jF,AF.PgInstrumentation,e=>({requireParentSpan:!0,requestHook(e){yk(e,`auto.db.otel.postgres`)},ignoreConnectSpans:e?.ignoreConnectSpans??!1})),NF=(e=>({name:jF,setupOnce(){MF(e)}})),PF=Y(NF)})),IF,LF,RF,zF,BF,VF,HF,UF,WF=n((()=>{T(),L(),F(),X(),$(),qk(),IF=`PostgresJs`,LF=[`>=3.0.0 <4`],RF=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,zF=Symbol.for(`sentry.query.from.instrumented.sql`),BF=Z(IF,e=>new VF({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),VF=class extends Za{constructor(e){super(`sentry-postgres-js`,bo,e)}init(){let e=new no(`postgres`,LF,e=>{try{return this._patchPostgres(e)}catch(t){return Kk&&V.error(`Failed to patch postgres module:`,t),e}},e=>e);return[`src`,`cf/src`,`cjs/src`].forEach(t=>{e.files.push(new io(`postgres/${t}/query.js`,LF,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let t=typeof e==`function`,n=t?e:e.default;if(typeof n!=`function`)return Kk&&V.warn(`postgres module does not export a function. Skipping instrumentation.`),e;let r=this,i=function(...e){let t=Reflect.construct(n,e);if(!t||typeof t!=`function`)return Kk&&V.warn(`postgres() did not return a valid instance`),t;let i=r.getConfig();return N_(t,{requireParentSpan:i.requireParentSpan,requestHook:i.requestHook})};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let e of Object.getOwnPropertyNames(n))if(![`length`,`name`,`prototype`].includes(e)){let t=Object.getOwnPropertyDescriptor(n,e);t&&Object.defineProperty(i,e,t)}return t?i:(XS(e,`default`,i),e)}_shouldCreateSpans(){let e=this.getConfig();return D.getSpan(O.active())!==void 0||!e.requireParentSpan}_setOperationName(e,t,n){if(n){e.setAttribute(P,n);return}let r=t?.match(RF);r?.[1]&&e.setAttribute(P,r[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}_sanitizeSqlQuery(e){return e?e.replace(/--.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``).replace(/;\s*$/,``).replace(/\s+/g,` `).trim().replace(/\bX'[0-9A-Fa-f]*'/gi,`?`).replace(/\bB'[01]*'/gi,`?`).replace(/'(?:[^']|'')*'/g,`?`).replace(/\b0x[0-9A-Fa-f]+/gi,`?`).replace(/\b(?:TRUE|FALSE)\b/gi,`?`).replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,`?`).replace(/-?\b\d+\.\d+\b/g,`?`).replace(/-?\.\d+\b/g,`?`).replace(/(?<!\$)-?\b\d+\b/g,`?`).replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,`IN (?)`).replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,`IN ($?)`):`Unknown SQL Query`}_patchQueryPrototype(e){let t=this,n=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...e){if(this[zF]||!t._shouldCreateSpans())return n.apply(this,e);let r=t._reconstructQuery(this.strings),i=t._sanitizeSqlQuery(r);return pf({name:i||`postgresjs.query`,op:`db`},r=>{yk(r,`auto.db.postgresjs`),r.setAttributes({[ce]:`postgres`,[ie]:i});let{requestHook:a}=t.getConfig();a&&Wa(()=>a(r,i,void 0),e=>{e&&(r.setAttribute(`sentry.hook.error`,`requestHook failed`),Kk&&V.error(`Error in requestHook for ${IF} integration:`,e))},!0);let o=this.resolve;this.resolve=new Proxy(o,{apply:(e,n,a)=>{try{t._setOperationName(r,i,a?.[0]?.command),r.end()}catch(e){Kk&&V.error(`Error ending span in resolve callback:`,e)}return Reflect.apply(e,n,a)}});let s=this.reject;this.reject=new Proxy(s,{apply:(e,n,a)=>{try{r.setStatus({code:2,message:a?.[0]?.message||`unknown_error`}),r.setAttribute(N,a?.[0]?.code||`unknown`),r.setAttribute(pe,a?.[0]?.name||`unknown`),t._setOperationName(r,i),r.end()}catch(e){Kk&&V.error(`Error ending span in reject callback:`,e)}return Reflect.apply(e,n,a)}});try{return n.apply(this,e)}catch(e){throw r.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),r.end(),e}})},e.Query.prototype.handle.__sentry_original__=n,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},HF=(e=>({name:IF,setupOnce(){BF(e)}})),UF=Y(HF)})),GF,KF,qF=n((()=>{GF=class{emit(e){}},KF=new GF})),JF,YF,XF=n((()=>{qF(),JF=class{getLogger(e,t,n){return new GF}},YF=new JF})),ZF,QF=n((()=>{qF(),ZF=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):KF}}})),$F,eI=n((()=>{XF(),QF(),$F=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new ZF(this,e,t,n)}_getDelegate(){return this._delegate??YF}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}})),tI,nI=n((()=>{tI=typeof globalThis==`object`?globalThis:global})),rI=n((()=>{nI()})),iI=n((()=>{rI()}));function aI(e,t,n){return r=>r===e?t:n}var oI,sI,cI=n((()=>{iI(),oI=Symbol.for(`io.opentelemetry.js.api.logs`),sI=tI})),lI,uI=n((()=>{cI(),XF(),eI(),lI=class e{constructor(){this._proxyLoggerProvider=new $F}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return sI[oI]?this.getLoggerProvider():(sI[oI]=aI(1,e,YF),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return sI[oI]?.call(sI,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete sI[oI],this._proxyLoggerProvider=new $F}}})),dI,fI=n((()=>{qF(),XF(),QF(),eI(),uI(),dI=lI.getInstance()}));function pI(e,t,n){if(!mI(e))return E.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,`$1`);let r=xI(e);if(!r)return!1;let i=[],a=hI(r,t,i,n);return a&&!n?.includePrerelease?vI(r,i):a}function mI(e){return typeof e==`string`&&MI.test(e)}function hI(e,t,n,r){if(t.includes(`||`)){let i=t.trim().split(`||`);for(let t of i)if(gI(e,t,n,r))return!0;return!1}else if(t.includes(` - `))t=jI(t,r);else if(t.includes(` `)){let i=t.trim().replace(/\s{2,}/g,` `).split(` `);for(let t of i)if(!gI(e,t,n,r))return!1;return!0}return gI(e,t,n,r)}function gI(e,t,n,r){if(t=yI(t,r),t.includes(` `))return hI(e,t,n,r);{let r=SI(t);return n.push(r),_I(e,r)}}function _I(e,t){if(t.invalid)return!1;if(!t.version||CI(t.version))return!0;let n=DI(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];n=!r.length&&!i.length?0:!r.length&&i.length?1:r.length&&!i.length?-1:DI(r,i)}return PI[t.op]?.includes(n)}function vI(e,t){return e.prerelease?t.some(t=>t.prerelease&&t.version===e.version):!0}function yI(e,t){return e=e.trim(),e=kI(e,t),e=OI(e),e=AI(e,t),e=e.trim(),e}function bI(e){return!e||e.toLowerCase()===`x`||e===`*`}function xI(e){let t=e.match(MI);if(!t){E.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,a=n.split(`.`),o=r?.split(`.`);return{op:void 0,version:n,versionSegments:a,versionSegmentCount:a.length,prerelease:r,prereleaseSegments:o,prereleaseSegmentCount:o?o.length:0,build:i}}function SI(e){if(!e)return{};let t=e.match(NI);if(!t)return E.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,a=t.groups.build,o=r.split(`.`),s=i?.split(`.`);return n===`==`&&(n=`=`),{op:n||`=`,version:r,versionSegments:o,versionSegmentCount:o.length,prerelease:i,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:a}}function CI(e){return e===`*`||e===`x`||e===`X`}function wI(e){let t=parseInt(e,10);return isNaN(t)?e:t}function TI(e,t){if(typeof e==typeof t){if(typeof e==`number`||typeof e==`string`)return[e,t];throw Error(`Version segments can only be strings or numbers`)}else return[String(e),String(t)]}function EI(e,t){if(CI(e)||CI(t))return 0;let[n,r]=TI(wI(e),wI(t));return n>r?1:n<r?-1:0}function DI(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=EI(e[n]||`0`,t[n]||`0`);if(r!==0)return r}return 0}function OI(e){let t=XI;return e.replace(t,(e,t,n,r,i)=>{let a;return a=bI(t)?``:bI(n)?`>=${t}.0.0 <${+t+1}.0.0-0`:bI(r)?`>=${t}.${n}.0 <${t}.${+n+1}.0-0`:i?`>=${t}.${n}.${r}-${i} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${r} <${t}.${+n+1}.0-0`,a})}function kI(e,t){let n=QI,r=t?.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>{let o;return o=bI(t)?``:bI(n)?`>=${t}.0.0${r} <${+t+1}.0.0-0`:bI(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.0${r} <${+t+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i}-${a} <${+t+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i}${r} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i} <${+t+1}.0.0-0`,o})}function AI(e,t){let n=KI;return e.replace(n,(e,n,r,i,a,o)=>{let s=bI(r),c=s||bI(i),l=c||bI(a),u=l;return n===`=`&&u&&(n=``),o=t?.includePrerelease?`-0`:``,s?e=n===`>`||n===`<`?`<0.0.0-0`:`*`:n&&u?(c&&(i=0),a=0,n===`>`?(n=`>=`,c?(r=+r+1,i=0,a=0):(i=+i+1,a=0)):n===`<=`&&(n=`<`,c?r=+r+1:i=+i+1),n===`<`&&(o=`-0`),e=`${n+r}.${i}.${a}${o}`):c?e=`>=${r}.0.0${o} <${+r+1}.0.0-0`:l&&(e=`>=${r}.${i}.0${o} <${r}.${+i+1}.0-0`),e})}function jI(e,t){let n=JI;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>(n=bI(r)?``:bI(i)?`>=${r}.0.0${t?.includePrerelease?`-0`:``}`:bI(a)?`>=${r}.${i}.0${t?.includePrerelease?`-0`:``}`:o?`>=${n}`:`>=${n}${t?.includePrerelease?`-0`:``}`,c=bI(l)?``:bI(u)?`<${+l+1}.0.0-0`:bI(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t?.includePrerelease?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()))}var MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,UI,WI,GI,KI,qI,JI,YI,XI,ZI,QI,$I=n((()=>{T(),MI=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,NI=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,PI={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},FI=`[a-zA-Z0-9-]`,II=`0|[1-9]\\d*`,LI=`\\d*[a-zA-Z-]${FI}*`,RI=`((?:<|>)?=?)`,zI=`(?:${II}|${LI})`,BI=`(?:-(${zI}(?:\\.${zI})*))`,VI=`${FI}+`,HI=`(?:\\+(${VI}(?:\\.${VI})*))`,UI=`${II}|x|X|\\*`,WI=`[v=\\s]*(${UI})(?:\\.(${UI})(?:\\.(${UI})(?:${BI})?${HI}?)?)?`,GI=`^${RI}\\s*${WI}$`,KI=new RegExp(GI),qI=`^\\s*(${WI})\\s+-\\s+(${WI})\\s*$`,JI=new RegExp(qI),YI=`^(?:~>?)${WI}$`,XI=new RegExp(YI),ZI=`^(?:\\^)${WI}$`,QI=new RegExp(ZI)}));function eL(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function tL(e){e&&e.logger&&(typeof e.logger==`function`?nL=e.logger:nL(`new logger isn't a function, not replacing`))}var nL,rL,iL,aL,oL,sL=n((()=>{nL=console.error.bind(console),rL=(e,t,n)=>{if(!e||!e[t]){nL(`no original function `+String(t)+` to wrap`);return}if(!n){nL(`no wrapper function`),nL(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){nL(`original object and wrapper must be functions`);return}let i=n(r,t);return eL(i,`__original`,r),eL(i,`__unwrap`,()=>{e[t]===i&&eL(e,t,r)}),eL(i,`__wrapped`,!0),eL(e,t,i),i},iL=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{nL(`must provide one or more modules to patch`),nL(Error().stack);return}if(!(t&&Array.isArray(t))){nL(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{rL(e,t,n)})})},aL=(e,t)=>{if(!e||!e[t]){nL(`no function to unwrap.`),nL(Error().stack);return}let n=e[t];if(!n.__unwrap)nL(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},oL=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{nL(`must provide one or more modules to patch`),nL(Error().stack);return}if(!(t&&Array.isArray(t))){nL(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{aL(e,t)})})},tL.wrap=rL,tL.massWrap=iL,tL.unwrap=aL,tL.massUnwrap=oL})),cL,lL=n((()=>{T(),fI(),sL(),a(),cL=class{constructor(e,t,n){o(this,`instrumentationName`,void 0),o(this,`instrumentationVersion`,void 0),o(this,`_config`,{}),o(this,`_tracer`,void 0),o(this,`_meter`,void 0),o(this,`_logger`,void 0),o(this,`_diag`,void 0),o(this,`_wrap`,rL),o(this,`_unwrap`,aL),o(this,`_massWrap`,iL),o(this,`_massUnwrap`,oL),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=D.getTracer(e,t),this._meter=v.getMeter(e,t),this._logger=dI.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),uL,dL,fL=n((()=>{a(),uL=class{constructor(){o(this,`hooks`,[]),o(this,`children`,new Map)}},dL=class{constructor(){o(this,`_trie`,new uL),o(this,`_counter`,0)}insert(e){let t=this._trie;for(let n of e.moduleName.split(`/`)){let e=t.children.get(n);e||(e=new uL,t.children.set(n,e)),t=e}t.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:t,fullOnly:n}={}){let r=this._trie,i=[],a=!0;for(let t of e.split(`/`)){let e=r.children.get(t);if(!e){a=!1;break}n||i.push(...e.hooks),r=e}return n&&a&&i.push(...r.hooks),i.length===0?[]:i.length===1?[i[0].hook]:(t&&i.sort((e,t)=>e.insertedId-t.insertedId),i.map(({hook:e})=>e))}}}));function pL(e){return qe.sep===`/`?e:e.split(qe.sep).join(`/`)}var mL,hL,gL,_L=n((()=>{mL=Na(),fL(),a(),hL=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(e=>typeof global[e]==`function`),gL=class e{constructor(){o(this,`_moduleNameTrie`,new dL),this._initialize()}_initialize(){new mL.Hook(null,{internals:!0},(e,t,n)=>{let r=pL(t),i=this._moduleNameTrie.search(r,{maintainInsertionOrder:!0,fullOnly:n===void 0});for(let{onRequire:r}of i)e=r(e,t,n);return e})}register(e,t){let n={moduleName:e,onRequire:t};return this._moduleNameTrie.insert(n),n}static getInstance(){return hL?new e:this._instance=this._instance??new e}},o(gL,`_instance`,void 0)}));function vL(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var yL=n((()=>{}));function bL(e,t,n){return t===void 0?e.includes(`*`):e.some(e=>pI(t,e,{includePrerelease:n}))}var xL,SL,CL,wL=n((()=>{$I(),sL(),lL(),_L(),xL=Aj(),T(),SL=Na(),yL(),a(),CL=class extends cL{constructor(e,t,n){super(e,t,n),o(this,`_modules`,void 0),o(this,`_hooks`,[]),o(this,`_requireInTheMiddleSingleton`,gL.getInstance()),o(this,`_enabled`,!1),o(this,`_wrap`,(e,t,n)=>{if(vL(e[t])&&this._unwrap(e,t),mt.isProxy(e)){let r=rL(Object.assign({},e),t,n);return Object.defineProperty(e,t,{value:r}),r}else return rL(e,t,n)}),o(this,`_unwrap`,(e,t)=>mt.isProxy(e)?Object.defineProperty(e,t,{value:e[t]}):aL(e,t)),o(this,`_massWrap`,(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{E.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){E.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._wrap(e,t,n)})})}),o(this,`_massUnwrap`,(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{E.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){E.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._unwrap(e,t)})})});let r=this.init();r&&!Array.isArray(r)&&(r=[r]),this._modules=r||[],this._config.enabled&&this.enable()}_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let e=t.resolve(n);t.cache[e]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let t=it(qe.join(e,`package.json`),{encoding:`utf8`}),n=JSON.parse(t).version;return typeof n==`string`?n:void 0}catch{E.warn(`Failed extracting version`,e)}}_onRequire(e,t,n,r){if(!r)return typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:e.name}),e.patch(t)):t;let i=this._extractPackageVersion(r);if(e.moduleVersion=i,e.name===n)return bL(e.supportedVersions,i,e.includePrerelease)&&typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:e.name,version:e.moduleVersion,baseDir:r}),e.patch(t,e.moduleVersion)):t;let a=e.files??[],o=qe.normalize(n);return a.filter(e=>e.name===o).filter(t=>bL(t.supportedVersions,i,e.includePrerelease)).reduce((t,n)=>(n.moduleExports=t,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:e.name,version:e.moduleVersion,fileName:n.name,baseDir:r}),n.patch(t,e.moduleVersion)):t),t)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch==`function`&&e.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.patch(t.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let t=(t,n,r)=>{if(!r&&qe.isAbsolute(n)){let e=qe.parse(n);n=e.name,r=e.dir}return this._onRequire(e,t,n,r)},n=(t,n,r)=>this._onRequire(e,t,n,r),r=qe.isAbsolute(e.name)?new SL.Hook([e.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(e.name,n);this._hooks.push(r);let i=new xL.Hook([e.name],{internals:!1},t);this._hooks.push(i)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch==`function`&&e.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.unpatch(t.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}}})),TL=n((()=>{wL()})),EL=n((()=>{TL()})),DL,OL=n((()=>{a(),DL=class{constructor(e,t,n,r,i){o(this,`name`,void 0),o(this,`supportedVersions`,void 0),o(this,`patch`,void 0),o(this,`unpatch`,void 0),o(this,`files`,void 0),this.name=e,this.supportedVersions=t,this.patch=n,this.unpatch=r,this.files=i||[]}}})),kL=n((()=>{fI(),EL(),OL(),yL()}));function AL(){let e=VL[BL];return e?.helper?e.helper:VL[zL]?.helper}function jL(e){let t={helper:e};VL[BL]=t,VL[zL]=t}function ML(){delete VL[BL],delete VL[zL]}function NL(e){switch(e){case`client`:return w.CLIENT;default:return w.INTERNAL}}function PL(e,t,n,r,i){if(LL(t.name,i))return;let a={attributes:t.attributes,kind:NL(t.kind),startTime:t.startTime};e.startActiveSpan(t.name,a,a=>{r.set(t.id,a.spanContext().spanId),t.links&&a.addLinks(t.links.flatMap(e=>{let t=r.get(e);return t?{context:{spanId:t,traceId:a.spanContext().traceId,traceFlags:a.spanContext().traceFlags}}:[]}));let o=n.filter(e=>e.parentId===t.id);for(let t of o)PL(e,t,n,r,i);a.end(t.endTime)})}function FL(e,t){return IL(t)?t.then(t=>(e.end(),t),t=>{throw e.end(),t}):(e.end(),t)}function IL(e){return e!=null&&typeof e.then==`function`}function LL(e,t){return t.some(t=>typeof t==`string`?t===e:t.test(e))}var RL,zL,BL,VL,HL,UL,WL,GL,KL,qL,JL,YL,XL=n((()=>{T(),kL(),a(),RL={name:`@prisma/instrumentation-contract`,version:`7.6.0`,description:`Shared types and utilities for Prisma instrumentation`,main:`dist/index.js`,module:`dist/index.mjs`,types:`dist/index.d.ts`,exports:{".":{require:{types:`./dist/index.d.ts`,default:`./dist/index.js`},import:{types:`./dist/index.d.mts`,default:`./dist/index.mjs`}}},license:`Apache-2.0`,homepage:`https://www.prisma.io`,repository:{type:`git`,url:`https://github.com/prisma/prisma.git`,directory:`packages/instrumentation-contract`},bugs:`https://github.com/prisma/prisma/issues`,scripts:{dev:`DEV=true tsx helpers/build.ts`,build:`tsx helpers/build.ts`,prepublishOnly:`pnpm run build`,test:`vitest run`},files:[`dist`],sideEffects:!1,devDependencies:{"@opentelemetry/api":`1.9.0`},peerDependencies:{"@opentelemetry/api":`^1.8`}}.version.split(`.`)[0],zL=`PRISMA_INSTRUMENTATION`,BL=`V${RL}_PRISMA_INSTRUMENTATION`,VL=globalThis,HL=process.env.PRISMA_SHOW_ALL_TRACES===`true`,UL=`00-10-10-00`,WL=class{constructor({tracerProvider:e,ignoreSpanTypes:t}){o(this,`tracerProvider`,void 0),o(this,`ignoreSpanTypes`,void 0),this.tracerProvider=e,this.ignoreSpanTypes=t}isEnabled(){return!0}getTraceParent(e){let t=D.getSpanContext(e??O.active());return t?`00-${t.traceId}-${t.spanId}-0${t.traceFlags}`:UL}dispatchEngineSpans(e){let t=this.tracerProvider.getTracer(`prisma`),n=new Map,r=e.filter(e=>e.parentId===null);for(let i of r)PL(t,i,e,n,this.ignoreSpanTypes)}getActiveContext(){return O.active()}runInChildSpan(e,t){if(typeof e==`string`&&(e={name:e}),e.internal&&!HL)return t();let n=this.tracerProvider.getTracer(`prisma`),r=e.context??this.getActiveContext(),i=`prisma:client:${e.name}`;if(LL(i,this.ignoreSpanTypes))return t();if(e.active===!1){let a=n.startSpan(i,e,r);return FL(a,t(a,r))}return n.startActiveSpan(i,e,e=>FL(e,t(e,r)))}},GL={name:`@prisma/instrumentation`,version:`7.6.0`,description:`OpenTelemetry compliant instrumentation for Prisma Client`,main:`dist/index.js`,module:`dist/index.mjs`,types:`dist/index.d.ts`,exports:{".":{require:{types:`./dist/index.d.ts`,default:`./dist/index.js`},import:{types:`./dist/index.d.ts`,default:`./dist/index.mjs`}}},license:`Apache-2.0`,homepage:`https://www.prisma.io`,repository:{type:`git`,url:`https://github.com/prisma/prisma.git`,directory:`packages/instrumentation`},bugs:`https://github.com/prisma/prisma/issues`,devDependencies:{"@opentelemetry/api":`1.9.0`,"@prisma/instrumentation-contract":`workspace:*`,"@types/node":`~20.19.24`,typescript:`5.4.5`},dependencies:{"@opentelemetry/instrumentation":`^0.207.0`},peerDependencies:{"@opentelemetry/api":`^1.8`},files:[`dist`],keywords:[`prisma`,`instrumentation`,`opentelemetry`,`otel`],scripts:{dev:`DEV=true tsx helpers/build.ts`,build:`tsx helpers/build.ts`,prepublishOnly:`pnpm run build`,test:`vitest run`},sideEffects:!1},KL=GL.version,qL=GL.name,JL=`@prisma/client`,YL=class extends CL{constructor(e={}){super(qL,KL,e),o(this,`tracerProvider`,void 0)}setTracerProvider(e){this.tracerProvider=e}init(){return[new DL(JL,[KL])]}enable(){let e=this._config;jL(new WL({tracerProvider:this.tracerProvider??D.getTracerProvider(),ignoreSpanTypes:e.ignoreSpanTypes??[]}))}disable(){ML()}isEnabled(){return AL()!==void 0}}}));function ZL(e){return!!e&&typeof e==`object`&&`dispatchEngineSpans`in e}function QL(){let e=globalThis.PRISMA_INSTRUMENTATION;return e&&typeof e==`object`&&`helper`in e?e.helper:void 0}function $L(e){switch(e){case`client`:return w.CLIENT;default:return w.INTERNAL}}var eR,tR,nR,rR,iR=n((()=>{T(),XL(),X(),$(),eR=`Prisma`,tR=class extends YL{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=QL();ZL(e)&&(e.createEngineSpan=e=>{let t=D.getTracer(`prismaV5Compatibility`),n=t._idGenerator;if(!n){Eo(()=>{console.warn(`[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!`)});return}try{e.spans.forEach(e=>{let r=$L(e.kind),i=e.parent_span_id,a=e.span_id,o=e.trace_id,s=e.links?.map(e=>({context:{traceId:e.trace_id,spanId:e.span_id,traceFlags:S.SAMPLED}})),c=D.setSpanContext(O.active(),{traceId:o,spanId:i,traceFlags:S.SAMPLED});O.with(c,()=>{t._idGenerator={generateTraceId:()=>o,generateSpanId:()=>a},t.startSpan(e.name,{kind:r,links:s,startTime:e.start_time,attributes:e.attributes}).end(e.end_time),t._idGenerator=n})})}finally{t._idGenerator=n}})}},nR=Z(eR,e=>new tR(e)),rR=Y(e=>({name:eR,setupOnce(){nR(e)},setup(e){QL()&&e.on(`spanStart`,e=>{let t=q(e);t.description?.startsWith(`prisma:`)&&e.setAttribute(K,`auto.db.otel.prisma`),t.description===`prisma:engine:db_query`&&t.data[`db.query.text`]&&e.updateName(t.data[`db.query.text`]),t.description===`prisma:engine:db_query`&&!t.data[`db.system`]&&e.setAttribute(`db.system`,`prisma`)})}}))})),aR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.60.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-hapi`})),oR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HapiLifecycleMethodNames=e.HapiLayerType=e.handlerPatched=e.HapiComponentName=void 0,e.HapiComponentName=`@hapi/hapi`,e.handlerPatched=Symbol(`hapi-handler-patched`),e.HapiLayerType={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},e.HapiLifecycleMethodNames=new Set([`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`])})),sR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_HTTP_METHOD=void 0,e.ATTR_HTTP_METHOD=`http.method`})),cR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=void 0,(function(e){e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`})(e.AttributeNames||(e.AttributeNames={}))})),lR=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getPluginFromInput=t.getExtMetadata=t.getRouteMetadata=t.isPatchableExtMethod=t.isDirectExtInput=t.isLifecycleExtEventObj=t.isLifecycleExtType=t.getPluginName=void 0;var n=(F(),e(A)),r=sR(),i=oR(),a=cR(),o=(L(),e(I));function s(e){return e.name?e.name:e.pkg.name}t.getPluginName=s,t.isLifecycleExtType=e=>typeof e==`string`&&i.HapiLifecycleMethodNames.has(e),t.isLifecycleExtEventObj=e=>{let n=e?.type;return n!==void 0&&(0,t.isLifecycleExtType)(n)},t.isDirectExtInput=e=>Array.isArray(e)&&e.length<=3&&(0,t.isLifecycleExtType)(e[0])&&typeof e[1]==`function`,t.isPatchableExtMethod=e=>!Array.isArray(e),t.getRouteMetadata=(e,t,s)=>{let c={[n.ATTR_HTTP_ROUTE]:e.path};t&o.SemconvStability.OLD&&(c[r.ATTR_HTTP_METHOD]=e.method),t&o.SemconvStability.STABLE&&(c[n.ATTR_HTTP_REQUEST_METHOD]=e.method);let l;return s?(c[a.AttributeNames.HAPI_TYPE]=i.HapiLayerType.PLUGIN,c[a.AttributeNames.PLUGIN_NAME]=s,l=`${s}: route - ${e.path}`):(c[a.AttributeNames.HAPI_TYPE]=i.HapiLayerType.ROUTER,l=`route - ${e.path}`),{attributes:c,name:l}},t.getExtMetadata=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[a.AttributeNames.EXT_TYPE]:e,[a.AttributeNames.HAPI_TYPE]:i.HapiLayerType.EXT,[a.AttributeNames.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[a.AttributeNames.EXT_TYPE]:e,[a.AttributeNames.HAPI_TYPE]:i.HapiLayerType.EXT},name:r}},t.getPluginFromInput=e=>`plugin`in e?`plugin`in e.plugin?e.plugin.plugin:e.plugin:e})),uR=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.HapiInstrumentation=void 0;var n=(T(),e(k)),r=(ui(),e(ci)),i=(L(),e(I)),s=aR(),c=oR(),l=lR();t.HapiInstrumentation=class extends i.InstrumentationBase{constructor(e={}){super(s.PACKAGE_NAME,s.PACKAGE_VERSION,e),o(this,`_semconvStability`,void 0),this._semconvStability=(0,i.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new i.InstrumentationNodeModuleDefinition(c.HapiComponentName,[`>=17.0.0 <22`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return(0,i.isWrapped)(t.server)||this._wrap(t,`server`,this._getServerPatch.bind(this)),(0,i.isWrapped)(t.Server)||this._wrap(t,`Server`,this._getServerPatch.bind(this)),t},e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;this._massUnwrap([t],[`server`,`Server`])})}_getServerPatch(e){let t=this,n=this;return function(r){let i=e.apply(this,[r]);return n._wrap(i,`route`,e=>t._getServerRoutePatch.bind(t)(e)),n._wrap(i,`ext`,e=>t._getServerExtPatch.bind(t)(e)),n._wrap(i,`register`,t._getServerRegisterPatch.bind(t)),i}}_getServerRegisterPatch(e){let t=this;return function(n,r){if(Array.isArray(n))for(let e of n){let n=(0,l.getPluginFromInput)(e);t._wrapRegisterHandler(n)}else{let e=(0,l.getPluginFromInput)(n);t._wrapRegisterHandler(e)}return e.apply(this,[n,r])}}_getServerExtPatch(e,t){let n=this;return function(...r){if(Array.isArray(r[0])){let i=r[0];for(let e=0;e<i.length;e++){let r=i[e];if((0,l.isLifecycleExtType)(r.type)){let a=r;a.method=n._wrapExtMethods(a.method,r.type,t),i[e]=a}}return e.apply(this,r)}else if((0,l.isDirectExtInput)(r)){let i=r,a=i[1],o=n._wrapExtMethods(a,i[0],t);return e.apply(this,[i[0],o,i[2]])}else if((0,l.isLifecycleExtEventObj)(r[0])){let i=r[0];return i.method=n._wrapExtMethods(i.method,i.type,t),e.call(this,i)}return e.apply(this,r)}}_getServerRoutePatch(e,t){let n=this;return function(r){if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=n._wrapRouteHandler.call(n,r[e],t);r[e]=i}else r=n._wrapRouteHandler.call(n,r,t);return e.apply(this,[r])}}_wrapRegisterHandler(e){let t=this,n=(0,l.getPluginName)(e),r=e.register,i=this;e.register=function(e,a){return i._wrap(e,`route`,e=>t._getServerRoutePatch.bind(t)(e,n)),i._wrap(e,`ext`,e=>t._getServerExtPatch.bind(t)(e,n)),r.call(this,e,a)}}_wrapExtMethods(e,t,r){let i=this;if(e instanceof Array){for(let n=0;n<e.length;n++)e[n]=i._wrapExtMethods(e[n],t);return e}else if((0,l.isPatchableExtMethod)(e))return e[c.handlerPatched]===!0?e:(e[c.handlerPatched]=!0,async function(...a){if(n.trace.getSpan(n.context.active())===void 0)return await e.apply(this,a);let o=(0,l.getExtMetadata)(t,r,e.name),s=i.tracer.startSpan(o.name,{attributes:o.attributes});try{return await n.context.with(n.trace.setSpan(n.context.active(),s),e,void 0,...a)}catch(e){throw s.recordException(e),s.setStatus({code:n.SpanStatusCode.ERROR,message:e.message}),e}finally{s.end()}});return e}_wrapRouteHandler(e,t){let i=this;if(e[c.handlerPatched]===!0)return e;e[c.handlerPatched]=!0;let a=a=>async function(...o){if(n.trace.getSpan(n.context.active())===void 0)return await a.call(this,...o);let s=(0,r.getRPCMetadata)(n.context.active());s?.type===r.RPCType.HTTP&&(s.route=e.path);let c=(0,l.getRouteMetadata)(e,i._semconvStability,t),u=i.tracer.startSpan(c.name,{attributes:c.attributes});try{return await n.context.with(n.trace.setSpan(n.context.active(),u),()=>a.call(this,...o))}catch(e){throw u.recordException(e),u.setStatus({code:n.SpanStatusCode.ERROR,message:e.message}),e}finally{u.end()}};if(typeof e.handler==`function`)e.handler=a(e.handler);else if(typeof e.options==`function`){let t=e.options;e.options=function(e){let n=t(e);return typeof n.handler==`function`&&(n.handler=a(n.handler)),n}}else typeof e.options?.handler==`function`&&(e.options.handler=a(e.options.handler));return e}}})),dR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=e.HapiInstrumentation=void 0;var t=uR();Object.defineProperty(e,`HapiInstrumentation`,{enumerable:!0,get:function(){return t.HapiInstrumentation}});var n=cR();Object.defineProperty(e,`AttributeNames`,{enumerable:!0,get:function(){return n.AttributeNames}})})),fR,pR,mR,hR,gR,_R=n((()=>{fR=dR(),X(),$(),pR=`Hapi`,mR=Z(pR,()=>new fR.HapiInstrumentation),hR=(()=>({name:pR,setupOnce(){mR()}})),gR=Y(hR)})),vR,yR,bR=n((()=>{vR={HONO_TYPE:`hono.type`,HONO_NAME:`hono.name`},yR={MIDDLEWARE:`middleware`,REQUEST_HANDLER:`request_handler`}})),xR,SR,CR,wR=n((()=>{T(),L(),X(),bR(),xR=`@sentry/instrumentation-hono`,SR=`0.0.1`,CR=class extends Za{constructor(e={}){super(xR,SR,e)}init(){return[new no(`hono`,[`>=4.0.0 <5`],e=>this._patch(e))]}_patch(e){let t=this;class n extends e.Hono{constructor(...e){super(...e),t._wrap(this,`get`,t._patchHandler()),t._wrap(this,`post`,t._patchHandler()),t._wrap(this,`put`,t._patchHandler()),t._wrap(this,`delete`,t._patchHandler()),t._wrap(this,`options`,t._patchHandler()),t._wrap(this,`patch`,t._patchHandler()),t._wrap(this,`all`,t._patchHandler()),t._wrap(this,`on`,t._patchOnHandler()),t._wrap(this,`use`,t._patchMiddlewareHandler())}}try{e.Hono=n}catch{return{...e,Hono:n}}return e}_patchHandler(){let e=this;return function(t){return function(...n){if(typeof n[0]==`string`){let r=n[0];if(n.length===1)return t.apply(this,[r]);let i=n.slice(1);return t.apply(this,[r,...i.map(t=>e._wrapHandler(t))])}return t.apply(this,n.map(t=>e._wrapHandler(t)))}}}_patchOnHandler(){let e=this;return function(t){return function(...n){let r=n.slice(2);return t.apply(this,[...n.slice(0,2),...r.map(t=>e._wrapHandler(t))])}}}_patchMiddlewareHandler(){let e=this;return function(t){return function(...n){if(typeof n[0]==`string`){let r=n[0];if(n.length===1)return t.apply(this,[r]);let i=n.slice(1);return t.apply(this,[r,...i.map(t=>e._wrapHandler(t))])}return t.apply(this,n.map(t=>e._wrapHandler(t)))}}}_wrapHandler(e){let t=this;return function(n,r){if(!t.isEnabled())return e.apply(this,[n,r]);let i=n.req.path,a=t.tracer.startSpan(i);return O.with(D.setSpan(O.active(),a),()=>t._safeExecute(()=>{let o=e.apply(this,[n,r]);if(bs(o))return o.then(n=>{let r=t._determineHandlerType(n);return a.setAttributes({[vR.HONO_TYPE]:r,[vR.HONO_NAME]:r===yR.REQUEST_HANDLER?i:e.name||`anonymous`}),t.getConfig().responseHook?.(a),n});{let n=t._determineHandlerType(o);return a.setAttributes({[vR.HONO_TYPE]:n,[vR.HONO_NAME]:n===yR.REQUEST_HANDLER?i:e.name||`anonymous`}),t.getConfig().responseHook?.(a),o}},()=>a.end(),e=>{t._handleError(a,e),a.end()}))}}_safeExecute(e,t,n){try{let r=e();return bs(r)?r.then(()=>t(),e=>n(e)):t(),r}catch(e){throw n(e),e}}_determineHandlerType(e){return e===void 0?yR.MIDDLEWARE:yR.REQUEST_HANDLER}_handleError(e,t){t instanceof Error&&(e.setStatus({code:b.ERROR,message:t.message}),e.recordException(t))}}}));function TR(e){let t=q(e).data,n=t[vR.HONO_TYPE];if(t[`sentry.op`]||!n)return;e.setAttributes({[K]:`auto.http.otel.hono`,[G]:`${n}.hono`});let r=t[vR.HONO_NAME];if(typeof r==`string`&&e.updateName(r),cl()===Ic()){Kk&&V.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let i=t[he],a=t[M];typeof i==`string`&&typeof a==`string`&&cl().setTransactionName(`${a} ${i}`)}var ER,DR,OR,kR,AR=n((()=>{F(),X(),$(),qk(),bR(),wR(),ER=`Hono`,DR=Z(ER,()=>new CR({responseHook:e=>{TR(e)}})),OR=(()=>({name:ER,setupOnce(){DR()}})),kR=Y(OR)})),jR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.KoaLayerType=void 0,(function(e){e.ROUTER=`router`,e.MIDDLEWARE=`middleware`})(e.KoaLayerType||(e.KoaLayerType={}))})),MR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.62.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-koa`})),NR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AttributeNames=void 0,(function(e){e.KOA_TYPE=`koa.type`,e.KOA_NAME=`koa.name`})(e.AttributeNames||(e.AttributeNames={}))})),PR=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isLayerIgnored=t.getMiddlewareMetadata=void 0;var n=jR(),r=NR(),i=(F(),e(A));t.getMiddlewareMetadata=(e,t,a,o)=>a?{attributes:{[r.AttributeNames.KOA_NAME]:o?.toString(),[r.AttributeNames.KOA_TYPE]:n.KoaLayerType.ROUTER,[i.ATTR_HTTP_ROUTE]:o?.toString()},name:e._matchedRouteName||`router - ${o}`}:{attributes:{[r.AttributeNames.KOA_NAME]:t.name??`middleware`,[r.AttributeNames.KOA_TYPE]:n.KoaLayerType.MIDDLEWARE},name:`middleware - ${t.name}`},t.isLayerIgnored=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e))})),FR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.kLayerPatched=void 0,e.kLayerPatched=Symbol(`koa-layer-patched`)})),IR=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.KoaInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=jR(),a=MR(),o=PR(),s=(ui(),e(ci)),c=FR();t.KoaInstrumentation=class extends r.InstrumentationBase{constructor(e={}){super(a.PACKAGE_NAME,a.PACKAGE_VERSION,e)}init(){return new r.InstrumentationNodeModuleDefinition(`koa`,[`>=2.0.0 <4`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return t==null?t:((0,r.isWrapped)(t.prototype.use)&&this._unwrap(t.prototype,`use`),this._wrap(t.prototype,`use`,this._getKoaUsePatch.bind(this)),e)},e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;(0,r.isWrapped)(t.prototype.use)&&this._unwrap(t.prototype,`use`)})}_getKoaUsePatch(e){let t=this;return function(n){let r;return r=n.router?t._patchRouterDispatch(n):t._patchLayer(n,!1),e.apply(this,[r])}}_patchRouterDispatch(e){n.diag.debug(`Patching @koa/router dispatch`);let t=e.router?.stack??[];for(let e of t){let t=e.path,n=e.stack;for(let e=0;e<n.length;e++){let r=n[e];n[e]=this._patchLayer(r,!0,t)}}return e}_patchLayer(e,t,a){let l=t?i.KoaLayerType.ROUTER:i.KoaLayerType.MIDDLEWARE;return e[c.kLayerPatched]===!0||(0,o.isLayerIgnored)(l,this.getConfig())?e:e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?(n.diag.debug(`ignoring generator-based Koa middleware layer`),e):(e[c.kLayerPatched]=!0,n.diag.debug(`patching Koa middleware layer`),async(i,c)=>{if(n.trace.getSpan(n.context.active())===void 0)return e(i,c);let u=(0,o.getMiddlewareMetadata)(i,e,t,a),d=this.tracer.startSpan(u.name,{attributes:u.attributes}),f=(0,s.getRPCMetadata)(n.context.active());f?.type===s.RPCType.HTTP&&i._matchedRoute&&(f.route=i._matchedRoute.toString());let{requestHook:p}=this.getConfig();p&&(0,r.safeExecuteInTheMiddle)(()=>p(d,{context:i,middlewareLayer:e,layerType:l}),e=>{e&&n.diag.error(`koa instrumentation: request hook failed`,e)},!0);let m=n.trace.setSpan(n.context.active(),d);return n.context.with(m,async()=>{try{return await e(i,c)}catch(e){throw d.recordException(e),e}finally{d.end()}})})}}})),LR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.KoaLayerType=e.AttributeNames=e.KoaInstrumentation=void 0;var t=IR();Object.defineProperty(e,`KoaInstrumentation`,{enumerable:!0,get:function(){return t.KoaInstrumentation}});var n=NR();Object.defineProperty(e,`AttributeNames`,{enumerable:!0,get:function(){return n.AttributeNames}});var r=jR();Object.defineProperty(e,`KoaLayerType`,{enumerable:!0,get:function(){return r.KoaLayerType}})})),RR,zR,BR,VR,HR,UR=n((()=>{RR=LR(),F(),X(),$(),qk(),zR=`Koa`,BR=Z(zR,RR.KoaInstrumentation,(e={})=>({ignoreLayersType:e.ignoreLayersType,requestHook(e,t){yk(e,`auto.http.otel.koa`);let n=q(e).data,r=n[`koa.type`];r&&e.setAttribute(G,`${r}.koa`);let i=n[`koa.name`];if(typeof i==`string`&&e.updateName(i||`< unknown >`),cl()===Ic()){Kk&&V.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let a=n[he],o=t.context?.request?.method?.toUpperCase()||`GET`;a&&cl().setTransactionName(`${o} ${a}`)}})),VR=((e={})=>({name:zR,setupOnce(){BR(e)}})),HR=Y(VR)})),WR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConnectNames=e.ConnectTypes=e.AttributeNames=void 0,(function(e){e.CONNECT_TYPE=`connect.type`,e.CONNECT_NAME=`connect.name`})(e.AttributeNames||(e.AttributeNames={})),(function(e){e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`})(e.ConnectTypes||(e.ConnectTypes={})),(function(e){e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request handler`})(e.ConnectNames||(e.ConnectNames={}))})),GR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.57.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-connect`})),KR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._LAYERS_STORE_PROPERTY=void 0,e._LAYERS_STORE_PROPERTY=Symbol(`opentelemetry.instrumentation-connect.request-route-stack`)})),qR=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.generateRoute=t.replaceCurrentStackRoute=t.addNewStackLayer=void 0;var n=(T(),e(k)),r=KR();t.addNewStackLayer=e=>{Array.isArray(e[r._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(e,r._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e[r._LAYERS_STORE_PROPERTY].push(`/`);let t=e[r._LAYERS_STORE_PROPERTY].length;return()=>{t===e[r._LAYERS_STORE_PROPERTY].length?e[r._LAYERS_STORE_PROPERTY].pop():n.diag.warn(`Connect: Trying to pop the stack multiple time`)}},t.replaceCurrentStackRoute=(e,t)=>{t&&e[r._LAYERS_STORE_PROPERTY].splice(-1,1,t)},t.generateRoute=e=>e[r._LAYERS_STORE_PROPERTY].reduce((e,t)=>e.replace(/\/+$/,``)+t)})),JR=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ConnectInstrumentation=t.ANONYMOUS_NAME=void 0;var n=(T(),e(k)),r=(ui(),e(ci)),i=WR(),a=GR(),o=(L(),e(I)),s=(F(),e(A)),c=qR();t.ANONYMOUS_NAME=`anonymous`,t.ConnectInstrumentation=class extends o.InstrumentationBase{constructor(e={}){super(a.PACKAGE_NAME,a.PACKAGE_VERSION,e)}init(){return[new o.InstrumentationNodeModuleDefinition(`connect`,[`>=3.0.0 <4`],e=>this._patchConstructor(e))]}_patchApp(e){(0,o.isWrapped)(e.use)||this._wrap(e,`use`,this._patchUse.bind(this)),(0,o.isWrapped)(e.handle)||this._wrap(e,`handle`,this._patchHandle.bind(this))}_patchConstructor(e){let t=this;return function(...n){let r=e.apply(this,n);return t._patchApp(r),r}}_patchNext(e,t){return function(n){let r=e.apply(this,[n]);return t(),r}}_startSpan(e,n){let r,a,o;e?(r=i.ConnectTypes.REQUEST_HANDLER,o=i.ConnectNames.REQUEST_HANDLER,a=e):(r=i.ConnectTypes.MIDDLEWARE,o=i.ConnectNames.MIDDLEWARE,a=n.name||t.ANONYMOUS_NAME);let c=`${o} - ${a}`,l={attributes:{[s.ATTR_HTTP_ROUTE]:e.length>0?e:`/`,[i.AttributeNames.CONNECT_TYPE]:r,[i.AttributeNames.CONNECT_NAME]:a}};return this.tracer.startSpan(c,l)}_patchMiddleware(e,i){let a=this,o=i.length===4;function s(){if(!a.isEnabled())return i.apply(this,arguments);let[s,l,u]=o?[1,2,3]:[0,1,2],d=arguments[s],f=arguments[l],p=arguments[u];(0,c.replaceCurrentStackRoute)(d,e);let m=(0,r.getRPCMetadata)(n.context.active());e&&m?.type===r.RPCType.HTTP&&(m.route=(0,c.generateRoute)(d));let h=``;h=e?`request handler - ${e}`:`middleware - ${i.name||t.ANONYMOUS_NAME}`;let g=a._startSpan(e,i);a._diag.debug(`start span`,h);let _=!1;function v(){_?a._diag.debug(`span ${g.name} - already finished`):(_=!0,a._diag.debug(`finishing span ${g.name}`),g.end()),f.removeListener(`close`,v)}return f.addListener(`close`,v),arguments[u]=a._patchNext(p,v),i.apply(this,arguments)}return Object.defineProperty(s,`length`,{value:i.length,writable:!1,configurable:!0}),s}_patchUse(e){let t=this;return function(...n){let r=n[n.length-1],i=n[n.length-2]||``;return n[n.length-1]=t._patchMiddleware(i,r),e.apply(this,n)}}_patchHandle(e){let t=this;return function(){let[n,r]=[0,2],i=arguments[n],a=arguments[r],o=(0,c.addNewStackLayer)(i);return typeof a==`function`&&(arguments[r]=t._patchOut(a,o)),e.apply(this,arguments)}}_patchOut(e,t){return function(...n){return t(),Reflect.apply(e,this,n)}}}})),YR=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConnectTypes=e.ConnectNames=e.AttributeNames=e.ANONYMOUS_NAME=e.ConnectInstrumentation=void 0;var t=JR();Object.defineProperty(e,`ConnectInstrumentation`,{enumerable:!0,get:function(){return t.ConnectInstrumentation}}),Object.defineProperty(e,`ANONYMOUS_NAME`,{enumerable:!0,get:function(){return t.ANONYMOUS_NAME}});var n=WR();Object.defineProperty(e,`AttributeNames`,{enumerable:!0,get:function(){return n.AttributeNames}}),Object.defineProperty(e,`ConnectNames`,{enumerable:!0,get:function(){return n.ConnectNames}}),Object.defineProperty(e,`ConnectTypes`,{enumerable:!0,get:function(){return n.ConnectTypes}})})),XR,ZR,QR,$R,ez,tz=n((()=>{XR=YR(),X(),$(),ZR=`Connect`,QR=Z(ZR,()=>new XR.ConnectInstrumentation),$R=(()=>({name:ZR,setupOnce(){QR()}})),ez=Y($R)})),nz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DB_SYSTEM_VALUE_MSSQL=e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_DB_USER=e.ATTR_DB_SYSTEM=e.ATTR_DB_STATEMENT=e.ATTR_DB_SQL_TABLE=e.ATTR_DB_NAME=void 0,e.ATTR_DB_NAME=`db.name`,e.ATTR_DB_SQL_TABLE=`db.sql.table`,e.ATTR_DB_STATEMENT=`db.statement`,e.ATTR_DB_SYSTEM=`db.system`,e.ATTR_DB_USER=`db.user`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`,e.DB_SYSTEM_VALUE_MSSQL=`mssql`})),rz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.once=e.getSpanName=void 0;function t(e,t,n,r){return e===`execBulkLoad`&&r&&t?`${e} ${r} ${t}`:e===`callProcedure`?t?`${e} ${n} ${t}`:`${e} ${n}`:t?`${e} ${t}`:`${e}`}e.getSpanName=t,e.once=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}}})),iz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.33.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-tedious`})),az=i((n=>{a(),Object.defineProperty(n,`__esModule`,{value:!0}),n.TediousInstrumentation=n.INJECTED_CTX=void 0;var r=(T(),e(k)),i=t(`events`),s=(L(),e(I)),c=(F(),e(A)),l=nz(),u=rz(),d=iz(),f=Symbol(`opentelemetry.instrumentation-tedious.current-database`);n.INJECTED_CTX=Symbol(`opentelemetry.instrumentation-tedious.context-info-injected`);var p=[`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`];function m(e){Object.defineProperty(this,f,{value:e,writable:!0})}var h=class e extends s.InstrumentationBase{constructor(e={}){super(d.PACKAGE_NAME,d.PACKAGE_VERSION,e),o(this,`_netSemconvStability`,void 0),o(this,`_dbSemconvStability`,void 0),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,s.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,s.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new s.InstrumentationNodeModuleDefinition(e.COMPONENT,[`>=1.11.0 <20`],e=>{let t=e.Connection.prototype;for(let n of p)(0,s.isWrapped)(t[n])&&this._unwrap(t,n),this._wrap(t,n,this._patchQuery(n,e));return(0,s.isWrapped)(t.connect)&&this._unwrap(t,`connect`),this._wrap(t,`connect`,this._patchConnect),e},e=>{if(e===void 0)return;let t=e.Connection.prototype;for(let e of p)this._unwrap(t,e);this._unwrap(t,`connect`)})]}_patchConnect(e){return function(){return m.call(this,this.config?.options?.database),this.removeListener(`databaseChange`,m),this.on(`databaseChange`,m),this.once(`end`,()=>{this.removeListener(`databaseChange`,m)}),e.apply(this,arguments)}}_buildTraceparent(e){let t=e.spanContext();return`00-${t.traceId}-${t.spanId}-0${Number(t.traceFlags||r.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,t,r){return new Promise(i=>{try{let a=new t.Request(`set context_info @opentelemetry_traceparent`,e=>{i()});Object.defineProperty(a,n.INJECTED_CTX,{value:!0});let o=Buffer.from(r,`utf8`);a.addParameter(`opentelemetry_traceparent`,t.TYPES.VarBinary,o,{length:o.length}),e.execSql(a)}catch{i()}})}_shouldInjectFor(e){return e===`execSql`||e===`execSqlBatch`||e===`callProcedure`||e===`execute`}_patchQuery(e,t){return a=>{let o=this;function d(d){if(d?.[n.INJECTED_CTX])return a.apply(this,arguments);if(!(d instanceof i.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),a.apply(this,arguments);let p=0,m=0,h=()=>m++,g=()=>p++,_=this[f],v=(e=>e.sqlTextOrProcedure===`sp_prepare`&&e.parametersByName?.stmt?.value?e.parametersByName.stmt.value:e.sqlTextOrProcedure)(d),y={};o._dbSemconvStability&s.SemconvStability.OLD&&(y[l.ATTR_DB_SYSTEM]=l.DB_SYSTEM_VALUE_MSSQL,y[l.ATTR_DB_NAME]=_,y[l.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,y[l.ATTR_DB_STATEMENT]=v,y[l.ATTR_DB_SQL_TABLE]=d.table),o._dbSemconvStability&s.SemconvStability.STABLE&&(y[c.ATTR_DB_NAMESPACE]=_,y[c.ATTR_DB_SYSTEM_NAME]=c.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,y[c.ATTR_DB_QUERY_TEXT]=v,y[c.ATTR_DB_COLLECTION_NAME]=d.table),o._netSemconvStability&s.SemconvStability.OLD&&(y[l.ATTR_NET_PEER_NAME]=this.config?.server,y[l.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&s.SemconvStability.STABLE&&(y[c.ATTR_SERVER_ADDRESS]=this.config?.server,y[c.ATTR_SERVER_PORT]=this.config?.options?.port);let b=o.tracer.startSpan((0,u.getSpanName)(e,_,v,d.table),{kind:r.SpanKind.CLIENT,attributes:y}),x=(0,u.once)(e=>{d.removeListener(`done`,h),d.removeListener(`doneInProc`,h),d.removeListener(`doneProc`,g),d.removeListener(`error`,x),this.removeListener(`end`,x),b.setAttribute(`tedious.procedure_count`,p),b.setAttribute(`tedious.statement_count`,m),e&&b.setStatus({code:r.SpanStatusCode.ERROR,message:e.message}),b.end()});d.on(`done`,h),d.on(`doneInProc`,h),d.on(`doneProc`,g),d.once(`error`,x),this.on(`end`,x),typeof d.callback==`function`?o._wrap(d,`callback`,o._patchCallbackQuery(x)):o._diag.error(`Expected request.callback to be a function`);let S=()=>r.context.with(r.trace.setSpan(r.context.active(),b),a,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return S();let C=o._buildTraceparent(b);o._injectContextInfo(this,t,C).finally(S)}return Object.defineProperty(d,`length`,{value:a.length,writable:!1}),d}}_patchCallbackQuery(e){return t=>function(n,r,i){return e(n),t.apply(this,arguments)}}};o(h,`COMPONENT`,`tedious`),n.TediousInstrumentation=h})),oz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TediousInstrumentation=void 0;var t=az();Object.defineProperty(e,`TediousInstrumentation`,{enumerable:!0,get:function(){return t.TediousInstrumentation}})})),sz,cz,lz,uz,dz,fz,pz=n((()=>{sz=oz(),X(),$(),cz=new Set([`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`]),lz=`Tedious`,uz=Z(lz,()=>new sz.TediousInstrumentation({})),dz=(()=>{let e;return{name:lz,setupOnce(){e=pC(uz())},setup(t){e?.(()=>t.on(`spanStart`,e=>{let{description:t,data:n}=q(e);if(!t||n[`db.system`]!==`mssql`)return;let r=t.split(` `)[0]||``;cz.has(r)&&e.setAttribute(K,`auto.db.otel.tedious`)}))}}}),fz=Y(dz)})),mz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.57.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-generic-pool`})),hz=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.GenericPoolInstrumentation=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=mz(),s=`generic-pool`;t.GenericPoolInstrumentation=class extends r.InstrumentationBase{constructor(e={}){super(i.PACKAGE_NAME,i.PACKAGE_VERSION,e),o(this,`_isDisabled`,!1)}init(){return[new r.InstrumentationNodeModuleDefinition(s,[`>=3.0.0 <4`],e=>{let t=e.Pool;return(0,r.isWrapped)(t.prototype.acquire)&&this._unwrap(t.prototype,`acquire`),this._wrap(t.prototype,`acquire`,this._acquirePatcher.bind(this)),e},e=>{let t=e.Pool;return this._unwrap(t.prototype,`acquire`),e}),new r.InstrumentationNodeModuleDefinition(s,[`>=2.4.0 <3`],e=>{let t=e.Pool;return(0,r.isWrapped)(t.prototype.acquire)&&this._unwrap(t.prototype,`acquire`),this._wrap(t.prototype,`acquire`,this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let t=e.Pool;return this._unwrap(t.prototype,`acquire`),e}),new r.InstrumentationNodeModuleDefinition(s,[`>=2.0.0 <2.4`],e=>(this._isDisabled=!1,(0,r.isWrapped)(e.Pool)&&this._unwrap(e,`Pool`),this._wrap(e,`Pool`,this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let t=this;return function(...r){let i=n.context.active(),a=t.tracer.startSpan(`generic-pool.acquire`,{},i);return n.context.with(n.trace.setSpan(i,a),()=>e.call(this,...r).then(e=>(a.end(),e),e=>{throw a.recordException(e),a.end(),e}))}}_poolWrapper(e){let t=this;return function(){let n=e.apply(this,arguments);return t._wrap(n,`acquire`,t._acquireWithCallbacksPatcher.bind(t)),n}}_acquireWithCallbacksPatcher(e){let t=this;return function(r,i){if(t._isDisabled)return e.call(this,r,i);let a=n.context.active(),o=t.tracer.startSpan(`generic-pool.acquire`,{},a);return n.context.with(n.trace.setSpan(a,o),()=>{e.call(this,(e,t)=>{if(o.end(),r)return r(e,t)},i)})}}}})),gz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.GenericPoolInstrumentation=void 0;var t=hz();Object.defineProperty(e,`GenericPoolInstrumentation`,{enumerable:!0,get:function(){return t.GenericPoolInstrumentation}})})),_z,vz,yz,bz,xz,Sz=n((()=>{_z=gz(),X(),$(),vz=`GenericPool`,yz=Z(vz,()=>new _z.GenericPoolInstrumentation({})),bz=(()=>{let e;return{name:vz,setupOnce(){e=pC(yz())},setup(t){e?.(()=>t.on(`spanStart`,e=>{let t=q(e).description;(t===`generic-pool.aquire`||t===`generic-pool.acquire`)&&e.setAttribute(K,`auto.db.otel.generic_pool`)}))}}}),xz=Y(bz)})),Cz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_NET_PEER_PORT=e.ATTR_NET_PEER_NAME=e.ATTR_MESSAGING_SYSTEM=e.ATTR_MESSAGING_OPERATION=void 0,e.ATTR_MESSAGING_OPERATION=`messaging.operation`,e.ATTR_MESSAGING_SYSTEM=`messaging.system`,e.ATTR_NET_PEER_NAME=`net.peer.name`,e.ATTR_NET_PEER_PORT=`net.peer.port`})),wz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_MESSAGING_CONVERSATION_ID=e.OLD_ATTR_MESSAGING_MESSAGE_ID=e.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=e.ATTR_MESSAGING_URL=e.ATTR_MESSAGING_PROTOCOL_VERSION=e.ATTR_MESSAGING_PROTOCOL=e.MESSAGING_OPERATION_VALUE_PROCESS=e.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=e.ATTR_MESSAGING_DESTINATION_KIND=e.ATTR_MESSAGING_DESTINATION=void 0,e.ATTR_MESSAGING_DESTINATION=`messaging.destination`,e.ATTR_MESSAGING_DESTINATION_KIND=`messaging.destination_kind`,e.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=`messaging.rabbitmq.routing_key`,e.MESSAGING_OPERATION_VALUE_PROCESS=`process`,e.ATTR_MESSAGING_PROTOCOL=`messaging.protocol`,e.ATTR_MESSAGING_PROTOCOL_VERSION=`messaging.protocol_version`,e.ATTR_MESSAGING_URL=`messaging.url`,e.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=`topic`,e.OLD_ATTR_MESSAGING_MESSAGE_ID=`messaging.message_id`,e.ATTR_MESSAGING_CONVERSATION_ID=`messaging.conversation_id`})),Tz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DEFAULT_CONFIG=e.EndOperation=void 0,(function(e){e.AutoAck=`auto ack`,e.Ack=`ack`,e.AckAll=`ackAll`,e.Reject=`reject`,e.Nack=`nack`,e.NackAll=`nackAll`,e.ChannelClosed=`channel closed`,e.ChannelError=`channel error`,e.InstrumentationTimeout=`instrumentation timeout`})(e.EndOperation||(e.EndOperation={})),e.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}})),Ez=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isConfirmChannelTracing=t.unmarkConfirmChannelTracing=t.markConfirmChannelTracing=t.getConnectionAttributesFromUrl=t.getConnectionAttributesFromServer=t.normalizeExchange=t.CONNECTION_ATTRIBUTES=t.CHANNEL_CONSUME_TIMEOUT_TIMER=t.CHANNEL_SPANS_NOT_ENDED=t.MESSAGE_STORED_SPAN=void 0;var n=(T(),e(k)),r=(L(),e(I)),i=(F(),e(A)),a=Cz(),o=wz();t.MESSAGE_STORED_SPAN=Symbol(`opentelemetry.amqplib.message.stored-span`),t.CHANNEL_SPANS_NOT_ENDED=Symbol(`opentelemetry.amqplib.channel.spans-not-ended`),t.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol(`opentelemetry.amqplib.channel.consumer-timeout-timer`),t.CONNECTION_ATTRIBUTES=Symbol(`opentelemetry.amqplib.connection.attributes`);var s=(0,n.createContextKey)(`opentelemetry.amqplib.channel.is-confirm-channel`);t.normalizeExchange=e=>e===``?`<default>`:e;var c=e=>e.replace(/:[^:@/]*@/,`:***@`),l=(e,t)=>e||(t===`AMQP`?5672:5671),u=e=>{let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()},d=e=>e||`localhost`,f=(e,t,r,i)=>r?{[t]:r}:(n.diag.error(`amqplib instrumentation: could not extract connection attribute ${i} from user supplied url`,{url:e}),{});t.getConnectionAttributesFromServer=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[a.ATTR_MESSAGING_SYSTEM]:t}:{}},t.getConnectionAttributesFromUrl=(e,t)=>{let s={[o.ATTR_MESSAGING_PROTOCOL_VERSION]:`0.9.1`};if(e=e||`amqp://localhost`,typeof e==`object`){let n=e,c=u(n?.protocol);Object.assign(s,{...f(e,o.ATTR_MESSAGING_PROTOCOL,c,`protocol`)});let p=d(n?.hostname);t&r.SemconvStability.OLD&&Object.assign(s,{...f(e,a.ATTR_NET_PEER_NAME,p,`hostname`)}),t&r.SemconvStability.STABLE&&Object.assign(s,{...f(e,i.ATTR_SERVER_ADDRESS,p,`hostname`)});let m=l(n.port,c);t&r.SemconvStability.OLD&&Object.assign(s,f(e,a.ATTR_NET_PEER_PORT,m,`port`)),t&r.SemconvStability.STABLE&&Object.assign(s,f(e,i.ATTR_SERVER_PORT,m,`port`))}else{let p=c(e);s[o.ATTR_MESSAGING_URL]=p;try{let e=new URL(p),n=u(e.protocol);Object.assign(s,{...f(p,o.ATTR_MESSAGING_PROTOCOL,n,`protocol`)});let c=d(e.hostname);t&r.SemconvStability.OLD&&Object.assign(s,{...f(p,a.ATTR_NET_PEER_NAME,c,`hostname`)}),t&r.SemconvStability.STABLE&&Object.assign(s,{...f(p,i.ATTR_SERVER_ADDRESS,c,`hostname`)});let m=l(e.port?parseInt(e.port):void 0,n);t&r.SemconvStability.OLD&&Object.assign(s,f(p,a.ATTR_NET_PEER_PORT,m,`port`)),t&r.SemconvStability.STABLE&&Object.assign(s,f(p,i.ATTR_SERVER_PORT,m,`port`))}catch(e){n.diag.error(`amqplib instrumentation: error while extracting connection details from connection url`,{censoredUrl:p,err:e})}}return s},t.markConfirmChannelTracing=e=>e.setValue(s,!0),t.unmarkConfirmChannelTracing=e=>e.deleteValue(s),t.isConfirmChannelTracing=e=>e.getValue(s)===!0})),Dz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PACKAGE_NAME=e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION=`0.61.0`,e.PACKAGE_NAME=`@opentelemetry/instrumentation-amqplib`})),Oz=i((t=>{a(),Object.defineProperty(t,`__esModule`,{value:!0}),t.AmqplibInstrumentation=void 0;var n=(T(),e(k)),r=(ui(),e(ci)),i=(L(),e(I)),s=Cz(),c=wz(),l=Tz(),u=Ez(),d=Dz(),f=[`>=0.5.5 <1`];t.AmqplibInstrumentation=class extends i.InstrumentationBase{constructor(e={}){super(d.PACKAGE_NAME,d.PACKAGE_VERSION,{...l.DEFAULT_CONFIG,...e}),o(this,`_netSemconvStability`,void 0),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,i.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...l.DEFAULT_CONFIG,...e})}init(){let e=new i.InstrumentationNodeModuleFile(`amqplib/lib/channel_model.js`,f,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),t=new i.InstrumentationNodeModuleFile(`amqplib/lib/callback_model.js`,f,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new i.InstrumentationNodeModuleFile(`amqplib/lib/connect.js`,f,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new i.InstrumentationNodeModuleDefinition(`amqplib`,f,void 0,void 0,[e,n,t])}patchConnect(e){return e=this.unpatchConnect(e),(0,i.isWrapped)(e.connect)||this._wrap(e,`connect`,this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,i.isWrapped)(e.connect)&&this._unwrap(e,`connect`),e}patchChannelModel(e,t){return(0,i.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,`publish`,this.getPublishPatch.bind(this,t)),(0,i.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,`consume`,this.getConsumePatch.bind(this,t)),(0,i.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,`ack`,this.getAckPatch.bind(this,!1,l.EndOperation.Ack)),(0,i.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,`nack`,this.getAckPatch.bind(this,!0,l.EndOperation.Nack)),(0,i.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,`reject`,this.getAckPatch.bind(this,!0,l.EndOperation.Reject)),(0,i.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,`ackAll`,this.getAckAllPatch.bind(this,!1,l.EndOperation.AckAll)),(0,i.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,`nackAll`,this.getAckAllPatch.bind(this,!0,l.EndOperation.NackAll)),(0,i.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,`emit`,this.getChannelEmitPatch.bind(this)),(0,i.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,`publish`,this.getConfirmedPublishPatch.bind(this,t)),e}unpatchChannelModel(e){return(0,i.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,`publish`),(0,i.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,`consume`),(0,i.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,`ack`),(0,i.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,`nack`),(0,i.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,`reject`),(0,i.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,`ackAll`),(0,i.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,`nackAll`),(0,i.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,`emit`),(0,i.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,`publish`),e}getConnectPatch(e){let t=this;return function(n,r,i){return e.call(this,n,r,function(e,r){if(e==null){let e=(0,u.getConnectionAttributesFromUrl)(n,t._netSemconvStability),i=(0,u.getConnectionAttributesFromServer)(r);r[u.CONNECTION_ATTRIBUTES]={...e,...i}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let t=this;return function(n){if(n===`close`){t.endAllSpansOnChannel(this,!0,l.EndOperation.ChannelClosed,void 0);let e=this[u.CHANNEL_CONSUME_TIMEOUT_TIMER];e&&clearInterval(e),this[u.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else n===`error`&&t.endAllSpansOnChannel(this,!0,l.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,t,n){let r=this;return function(i){return r.endAllSpansOnChannel(this,e,t,i),n.apply(this,arguments)}}getAckPatch(e,t,n){let r=this;return function(i,a,o){let s=this,c=t===l.EndOperation.Reject?a:o,d=s[u.CHANNEL_SPANS_NOT_ENDED]??[],f=d.findIndex(e=>e.msg===i);if(f<0)r.endConsumerSpan(i,e,t,c);else if(t!==l.EndOperation.Reject&&a){for(let n=0;n<=f;n++)r.endConsumerSpan(d[n].msg,e,t,c);d.splice(0,f+1)}else r.endConsumerSpan(i,e,t,c),d.splice(f,1);return n.apply(this,arguments)}}getConsumePatch(e,t){let a=this;return function(o,d,f){let p=this;if(!Object.prototype.hasOwnProperty.call(p,u.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:e}=a.getConfig();if(e){let t=setInterval(()=>{a.checkConsumeTimeoutOnChannel(p)},e);t.unref(),p[u.CHANNEL_CONSUME_TIMEOUT_TIMER]=t}p[u.CHANNEL_SPANS_NOT_ENDED]=[]}let m=function(t){if(!t)return d.call(this,t);let m=t.properties.headers??{},h=n.propagation.extract(n.ROOT_CONTEXT,m),g=t.fields?.exchange,_;if(a._config.useLinksForConsume){let e=h?n.trace.getSpan(h)?.spanContext():void 0;h=void 0,e&&(_=[{context:e}])}let v=a.tracer.startSpan(`${o} process`,{kind:n.SpanKind.CONSUMER,attributes:{...p?.connection?.[u.CONNECTION_ATTRIBUTES],[c.ATTR_MESSAGING_DESTINATION]:g,[c.ATTR_MESSAGING_DESTINATION_KIND]:c.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[c.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:t.fields?.routingKey,[s.ATTR_MESSAGING_OPERATION]:c.MESSAGING_OPERATION_VALUE_PROCESS,[c.OLD_ATTR_MESSAGING_MESSAGE_ID]:t?.properties.messageId,[c.ATTR_MESSAGING_CONVERSATION_ID]:t?.properties.correlationId},links:_},h),{consumeHook:y}=a.getConfig();y&&(0,i.safeExecuteInTheMiddle)(()=>y(v,{moduleVersion:e,msg:t}),e=>{e&&n.diag.error(`amqplib instrumentation: consumerHook error`,e)},!0),f?.noAck||(p[u.CHANNEL_SPANS_NOT_ENDED].push({msg:t,timeOfConsume:(0,r.hrTime)()}),t[u.MESSAGE_STORED_SPAN]=v);let b=h||n.ROOT_CONTEXT;n.context.with(n.trace.setSpan(b,v),()=>{d.call(this,t)}),f?.noAck&&(a.callConsumeEndHook(v,t,!1,l.EndOperation.AutoAck),v.end())};return arguments[1]=m,t.apply(this,arguments)}}getConfirmedPublishPatch(e,t){let r=this;return function(a,o,s,c,l){let d=this,{span:f,modifiedOptions:p}=r.createPublishSpan(r,a,o,d,c),{publishHook:m}=r.getConfig();m&&(0,i.safeExecuteInTheMiddle)(()=>m(f,{moduleVersion:e,exchange:a,routingKey:o,content:s,options:p,isConfirmChannel:!0}),e=>{e&&n.diag.error(`amqplib instrumentation: publishHook error`,e)},!0);let h=function(t,u){try{l?.call(this,t,u)}finally{let{publishConfirmHook:l}=r.getConfig();l&&(0,i.safeExecuteInTheMiddle)(()=>l(f,{moduleVersion:e,exchange:a,routingKey:o,content:s,options:c,isConfirmChannel:!0,confirmError:t}),e=>{e&&n.diag.error(`amqplib instrumentation: publishConfirmHook error`,e)},!0),t&&f.setStatus({code:n.SpanStatusCode.ERROR,message:`message confirmation has been nack'ed`}),f.end()}},g=(0,u.markConfirmChannelTracing)(n.context.active()),_=[...arguments];return _[3]=p,_[4]=n.context.bind((0,u.unmarkConfirmChannelTracing)(n.trace.setSpan(g,f)),h),n.context.with(g,t.bind(this,..._))}}getPublishPatch(e,t){let r=this;return function(a,o,s,c){if((0,u.isConfirmChannelTracing)(n.context.active()))return t.apply(this,arguments);{let l=this,{span:u,modifiedOptions:d}=r.createPublishSpan(r,a,o,l,c),{publishHook:f}=r.getConfig();f&&(0,i.safeExecuteInTheMiddle)(()=>f(u,{moduleVersion:e,exchange:a,routingKey:o,content:s,options:d,isConfirmChannel:!1}),e=>{e&&n.diag.error(`amqplib instrumentation: publishHook error`,e)},!0);let p=[...arguments];p[3]=d;let m=t.apply(this,p);return u.end(),m}}}createPublishSpan(e,t,r,i,a){let o=(0,u.normalizeExchange)(t),s=e.tracer.startSpan(`publish ${o}`,{kind:n.SpanKind.PRODUCER,attributes:{...i.connection[u.CONNECTION_ATTRIBUTES],[c.ATTR_MESSAGING_DESTINATION]:t,[c.ATTR_MESSAGING_DESTINATION_KIND]:c.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[c.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[c.OLD_ATTR_MESSAGING_MESSAGE_ID]:a?.messageId,[c.ATTR_MESSAGING_CONVERSATION_ID]:a?.correlationId}}),l=a??{};return l.headers=l.headers??{},n.propagation.inject(n.trace.setSpan(n.context.active(),s),l.headers),{span:s,modifiedOptions:l}}endConsumerSpan(e,t,r,i){let a=e[u.MESSAGE_STORED_SPAN];a&&(t!==!1&&a.setStatus({code:n.SpanStatusCode.ERROR,message:r!==l.EndOperation.ChannelClosed&&r!==l.EndOperation.ChannelError?`${r} called on message${i===!0?` with requeue`:i===!1?` without requeue`:``}`:r}),this.callConsumeEndHook(a,e,t,r),a.end(),e[u.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,t,n,r){(e[u.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(e=>{this.endConsumerSpan(e.msg,t,n,r)}),e[u.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,t,r,a){let{consumeEndHook:o}=this.getConfig();o&&(0,i.safeExecuteInTheMiddle)(()=>o(e,{msg:t,rejected:r,endOperation:a}),e=>{e&&n.diag.error(`amqplib instrumentation: consumerEndHook error`,e)},!0)}checkConsumeTimeoutOnChannel(e){let t=(0,r.hrTime)(),n=e[u.CHANNEL_SPANS_NOT_ENDED]??[],i,{consumeTimeoutMs:a}=this.getConfig();for(i=0;i<n.length;i++){let e=n[i],o=(0,r.hrTimeDuration)(e.timeOfConsume,t);if((0,r.hrTimeToMilliseconds)(o)<a)break;this.endConsumerSpan(e.msg,null,l.EndOperation.InstrumentationTimeout,!0)}n.splice(0,i)}}})),kz=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.EndOperation=e.DEFAULT_CONFIG=e.AmqplibInstrumentation=void 0;var t=Oz();Object.defineProperty(e,`AmqplibInstrumentation`,{enumerable:!0,get:function(){return t.AmqplibInstrumentation}});var n=Tz();Object.defineProperty(e,`DEFAULT_CONFIG`,{enumerable:!0,get:function(){return n.DEFAULT_CONFIG}}),Object.defineProperty(e,`EndOperation`,{enumerable:!0,get:function(){return n.EndOperation}})})),Az,jz,Mz,Nz,Pz,Fz,Iz=n((()=>{Az=kz(),X(),$(),jz=`Amqplib`,Mz={consumeEndHook:e=>{yk(e,`auto.amqplib.otel.consumer`)},publishHook:e=>{yk(e,`auto.amqplib.otel.publisher`)}},Nz=Z(jz,()=>new Az.AmqplibInstrumentation(Mz)),Pz=(()=>({name:jz,setupOnce(){Nz()}})),Fz=Y(Pz)})),Lz,Rz=n((()=>{Lz=`VercelAI`}));function zz(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&`error`in t&&`toolName`in t&&`toolCallId`in t&&t.type===`tool-error`&&t.error instanceof Error}function Bz(e){if(typeof e!=`object`||!e||!(`content`in e))return;let t=e;Array.isArray(t.content)&&(Vz(t.content),Hz(t.content))}function Vz(e){for(let t of e){if(!zz(t))continue;let e=vb(t.toolCallId);ul(e?n=>{n.setContext(`trace`,{trace_id:e.traceId,span_id:e.spanId}),n.setTag(`vercel.ai.tool.name`,t.toolName),n.setTag(`vercel.ai.tool.callId`,t.toolCallId),n.setLevel(`error`),J(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})}:e=>{e.setTag(`vercel.ai.tool.name`,t.toolName),e.setTag(`vercel.ai.tool.callId`,t.toolCallId),e.setLevel(`error`),J(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})})}}function Hz(e){for(let t of e)typeof t==`object`&&t&&`toolCallId`in t&&typeof t.toolCallId==`string`&&yb(t.toolCallId)}function Uz(e,t,n,r){return{recordInputs:e?.recordInputs===void 0?t.recordInputs===void 0?n===!0?!0:r:t.recordInputs:e.recordInputs,recordOutputs:e?.recordOutputs===void 0?t.recordOutputs===void 0?n===!0?!0:r:t.recordOutputs:e.recordOutputs}}var Wz,Gz,Kz,qz=n((()=>{L(),X(),Rz(),Wz=[`>=3.0.0 <7`],Gz=[`generateText`,`streamText`,`generateObject`,`streamObject`,`embed`,`embedMany`,`rerank`],Kz=class e extends Za{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(t={}){super(`@sentry/instrumentation-vercel-ai`,bo,t),e.prototype.__init.call(this),e.prototype.__init2.call(this)}init(){return new no(`ai`,Wz,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(e=>e()),this._callbacks=[];let t=e=>new Proxy(e,{apply:(e,t,n)=>{let r=n[0].experimental_telemetry||{},i=r.isEnabled,a=W(),o=a?.getIntegrationByName(Lz),s=o?.options,{recordInputs:c,recordOutputs:l}=Uz(s,r,i,o?!!a?.getOptions().sendDefaultPii:!1);return n[0].experimental_telemetry={...r,isEnabled:i===void 0?!0:i,recordInputs:c,recordOutputs:l},sf(()=>Reflect.apply(e,t,n),e=>{e&&typeof e==`object`&&Ms(e,`_sentry_active_span`,Hu())},()=>{},e=>{Bz(e)})}});if(Object.prototype.toString.call(e)===`[object Module]`){for(let n of Gz)e[n]!=null&&(e[n]=t(e[n]));return e}else{let n=Gz.reduce((n,r)=>(e[r]!=null&&(n[r]=t(e[r])),n),{});return{...e,...n}}}}}));function Jz(e){return!!e.getIntegrationByName(`Modules`)?.getModules?.()?.ai}var Yz,Xz,Zz,Qz=n((()=>{X(),$(),Rz(),qz(),Yz=Z(Lz,()=>new Kz({})),Xz=((e={})=>{let t;return{name:Lz,options:e,setupOnce(){t=Yz()},afterAllSetup(n){e.force??Jz(n)?Nb(n):t?.callWhenPatched(()=>Nb(n))}}}),Zz=Y(Xz)})),$z,eB,tB=n((()=>{L(),X(),$z=[`>=4.0.0 <7`],eB=class extends Za{constructor(e={}){super(`@sentry/instrumentation-openai`,bo,e)}init(){return new no(`openai`,$z,this._patch.bind(this))}_patch(e){let t=e;return t=this._patchClient(t,`OpenAI`),t=this._patchClient(t,`AzureOpenAI`),t}_patchClient(e,t){let n=e[t];if(!n)return e;let r=this.getConfig(),i=function(...e){return sh(`OpenAI`)?Reflect.construct(n,e):ix(Reflect.construct(n,e),r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let e of Object.getOwnPropertyNames(n))if(![`length`,`name`,`prototype`].includes(e)){let t=Object.getOwnPropertyDescriptor(n,e);t&&Object.defineProperty(i,e,t)}try{e[t]=i}catch{Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=i}catch{Object.defineProperty(e,`default`,{value:i,writable:!0,configurable:!0,enumerable:!0})}return e}}})),nB,rB,iB,aB=n((()=>{X(),$(),tB(),nB=Z(Lb,e=>new eB(e)),rB=((e={})=>({name:Lb,setupOnce(){nB(e)}})),iB=Y(rB)})),oB,sB,cB=n((()=>{L(),X(),oB=[`>=0.19.2 <1.0.0`],sB=class extends Za{constructor(e={}){super(`@sentry/instrumentation-anthropic-ai`,bo,e)}init(){return new no(`@anthropic-ai/sdk`,oB,this._patch.bind(this))}_patch(e){let t=e.Anthropic,n=this.getConfig(),r=function(...e){return sh(`Anthropic_AI`)?Reflect.construct(t,e):Nx(Reflect.construct(t,e),n)};Object.setPrototypeOf(r,t),Object.setPrototypeOf(r.prototype,t.prototype);for(let e of Object.getOwnPropertyNames(t))if(![`length`,`name`,`prototype`].includes(e)){let n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(r,e,n)}try{e.Anthropic=r}catch{Object.defineProperty(e,`Anthropic`,{value:r,writable:!0,configurable:!0,enumerable:!0})}if(e.default===t)try{e.default=r}catch{Object.defineProperty(e,`default`,{value:r,writable:!0,configurable:!0,enumerable:!0})}return e}}})),lB,uB,dB,fB=n((()=>{X(),$(),cB(),lB=Z(ox,e=>new sB(e)),uB=((e={})=>({name:ox,options:e,setupOnce(){lB(e)}})),dB=Y(uB)})),pB,mB,hB=n((()=>{L(),X(),pB=[`>=0.10.0 <2`],mB=class extends Za{constructor(e={}){super(`@sentry/instrumentation-google-genai`,bo,e)}init(){return new no(`@google/genai`,pB,e=>this._patch(e),e=>e,[new io(`@google/genai/dist/node/index.cjs`,pB,e=>this._patch(e),e=>e)])}_patch(e){let t=e.GoogleGenAI,n=this.getConfig();if(typeof t!=`function`)return e;let r=function(...e){return sh(`Google_GenAI`)?Reflect.construct(t,e):eS(Reflect.construct(t,e),n)};Object.setPrototypeOf(r,t),Object.setPrototypeOf(r.prototype,t.prototype);for(let e of Object.getOwnPropertyNames(t))if(![`length`,`name`,`prototype`].includes(e)){let n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(r,e,n)}return XS(e,`GoogleGenAI`,r),e}}})),gB,_B,vB,yB=n((()=>{X(),$(),hB(),gB=Z(Fx,e=>new mB(e)),_B=((e={})=>({name:Fx,setupOnce(){gB(e)}})),vB=Y(_B)}));function bB(e,t){return e?Array.isArray(e)?e.includes(t)?e:[...e,t]:typeof e==`object`?[e,t]:e:[t]}function xB(e,t,n){return new Proxy(e,{apply(e,n,r){let i=r[1];(!i||typeof i!=`object`||Array.isArray(i))&&(i={},r[1]=i);let a=i.callbacks,o=bB(a,t);return i.callbacks=o,Reflect.apply(e,n,r)}})}var SB,CB,wB=n((()=>{L(),X(),SB=[`>=0.1.0 <2.0.0`],CB=class extends Za{constructor(e={}){super(`@sentry/instrumentation-langchain`,bo,e)}init(){let e=[];for(let t of[`@langchain/anthropic`,`@langchain/openai`,`@langchain/google-genai`,`@langchain/mistralai`,`@langchain/google-vertexai`,`@langchain/groq`])e.push(new no(t,SB,this._patch.bind(this),e=>e,[new io(`${t}/dist/index.cjs`,SB,this._patch.bind(this),e=>e)]));return e.push(new no(`langchain`,SB,this._patch.bind(this),e=>e,[new io(`langchain/dist/chat_models/universal.cjs`,SB,this._patch.bind(this),e=>e)])),e}_patch(e){oh([Lb,ox,Fx]);let t=this.getConfig(),n=SS(t);return this._patchRunnableMethods(e,n),this._patchEmbeddingsMethods(e,t),e}_patchRunnableMethods(e,t){let n=[`ChatAnthropic`,`ChatOpenAI`,`ChatGoogleGenerativeAI`,`ChatMistralAI`,`ChatVertexAI`,`ChatGroq`,`ConfigurableModel`],r=e.universal_exports??e,i=Object.values(r).find(e=>typeof e==`function`&&n.includes(e.name));if(!i)return;let a=i.prototype;if(!a.__sentry_patched__){a.__sentry_patched__=!0;for(let e of[`invoke`,`stream`,`batch`]){let n=a[e];typeof n==`function`&&(a[e]=xB(n,t))}}}_patchEmbeddingsMethods(e,t){let n=e.universal_exports??e;for(let e of Object.values(n)){if(typeof e!=`function`||!e.prototype)continue;let n=e.prototype;typeof n.embedQuery!=`function`||typeof n.embedDocuments!=`function`||n.__sentry_patched__||(n.__sentry_patched__=!0,lC(n,t))}}}})),TB,EB,DB,OB=n((()=>{X(),$(),wB(),TB=Z(nS,e=>new CB(e)),EB=((e={})=>({name:nS,setupOnce(){TB(e)}})),DB=Y(EB)})),kB,AB,jB=n((()=>{L(),X(),kB=[`>=0.0.0 <2.0.0`],AB=class extends Za{constructor(e={}){super(`@sentry/instrumentation-langgraph`,bo,e)}init(){return new no(`@langchain/langgraph`,kB,this._patch.bind(this),e=>e,[new io(`@langchain/langgraph/dist/index.cjs`,kB,this._patch.bind(this),e=>e)])}_patch(e){return e.StateGraph&&typeof e.StateGraph==`function`&&FS(e.StateGraph.prototype,this.getConfig()),e}}})),MB,NB,PB,FB=n((()=>{X(),$(),jB(),MB=Z(wS,e=>new AB(e)),NB=((e={})=>({name:wS,setupOnce(){MB(e)}})),PB=Y(NB)}));function IB(e,t,n,r,i){let a=()=>{},o=i.firestoreSpanCreationHook;typeof o==`function`&&(a=e=>{Wa(()=>o(e),e=>{e&&E.error(e?.message)},!0)});let s=new no(`@firebase/firestore`,t,t=>LB(t,n,r,e,a));for(let i of[`@firebase/firestore/dist/lite/index.node.cjs.js`,`@firebase/firestore/dist/lite/index.node.mjs.js`,`@firebase/firestore/dist/lite/index.rn.esm2017.js`,`@firebase/firestore/dist/lite/index.cjs.js`])s.files.push(new io(i,t,t=>LB(t,n,r,e,a),e=>RB(e,r)));return s}function LB(e,t,n,r,i){return RB(e,n),t(e,`addDoc`,zB(r,i)),t(e,`getDocs`,VB(r,i)),t(e,`setDoc`,HB(r,i)),t(e,`deleteDoc`,BB(r,i)),e}function RB(e,t){for(let n of[`addDoc`,`getDocs`,`setDoc`,`deleteDoc`])Ka(e[n])&&t(e,n);return e}function zB(e,t){return function(n){return function(r,i){let a=WB(e,`addDoc`,r);return t(a),UB(a,()=>n(r,i))}}}function BB(e,t){return function(n){return function(r){let i=WB(e,`deleteDoc`,r.parent||r);return t(i),UB(i,()=>n(r))}}}function VB(e,t){return function(n){return function(r){let i=WB(e,`getDocs`,r);return t(i),UB(i,()=>n(r))}}}function HB(e,t){return function(n){return function(r,i,a){let o=WB(e,`setDoc`,r.parent||r);return t(o),UB(o,()=>a===void 0?n(r,i):n(r,i,a))}}}function UB(e,t){return O.with(D.setSpan(O.active(),e),()=>Wa(()=>t(),t=>{t&&e.recordException(t),e.end()},!0))}function WB(e,t,n){let r=e.startSpan(`${t} ${n.path}`,{kind:w.CLIENT});return KB(r,n),r.setAttribute(P,t),r}function GB(e){let t,n;if(typeof e.host==`string`)if(e.host.startsWith(`[`)){if(e.host.endsWith(`]`))t=e.host.replace(/^\[|\]$/g,``);else if(e.host.includes(`]:`)){let r=e.host.lastIndexOf(`:`);r!==-1&&(t=e.host.slice(1,r).replace(/^\[|\]$/g,``),n=e.host.slice(r+1))}}else if(wt.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(`:`);r===-1?t=e.host:(t=e.host.slice(0,r),n=e.host.slice(r+1))}return{address:t,port:n?parseInt(n,10):void 0}}function KB(e,t){let n=t.firestore.app,r=n.options,i=(t.firestore.toJSON()||{}).settings||{},a={[le]:t.path,[ue]:n.name,[ce]:`firebase.firestore`,"firebase.firestore.type":t.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:o,port:s}=GB(i);o&&(a[_e]=o),s&&(a[ge]=s),e.setAttributes(a)}var qB=n((()=>{T(),L(),F()}));function JB(e,t,n,r,i){let a=()=>{},o=()=>{},s=i.functions?.errorHook,c=i.functions?.requestHook,l=i.functions?.responseHook;typeof l==`function`&&(o=(e,t)=>{Wa(()=>l(e,t),e=>{e&&E.error(e?.message)},!0)}),typeof c==`function`&&(a=e=>{Wa(()=>c(e),e=>{e&&E.error(e?.message)},!0)});let u=new no(`firebase-functions`,t);return[{name:`firebase-functions/lib/v2/providers/https.js`,triggerType:`function`},{name:`firebase-functions/lib/v2/providers/firestore.js`,triggerType:`firestore`},{name:`firebase-functions/lib/v2/providers/scheduler.js`,triggerType:`scheduler`},{name:`firebase-functions/lib/v2/storage.js`,triggerType:`storage`}].forEach(({name:i,triggerType:c})=>{u.files.push(new io(i,t,t=>XB(t,n,r,e,{requestHook:a,responseHook:o,errorHook:s},c),e=>ZB(e,r)))}),u}function YB(e,t,n){return function(r){return function(...i){let a=typeof i[0]==`function`?i[0]:i[1],o=typeof i[0]==`function`?void 0:i[0];if(!a)return r.call(this,...i);let s=async function(...r){let i=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,o=e.startSpan(`firebase.function.${n}`,{kind:w.SERVER}),s={"faas.name":i,"faas.trigger":n,"faas.provider":`firebase`};return process.env.GCLOUD_PROJECT&&(s[`cloud.project_id`]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(s[`cloud.event_source`]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),o.setAttributes(s),t?.requestHook?.(o),O.with(D.setSpan(O.active(),o),async()=>{let e,n;try{n=await a.apply(this,r)}catch(t){e=t}if(t?.responseHook?.(o,e),e&&o.recordException(e),o.end(),e)throw await t?.errorHook?.(o,e),e;return n})};return o?r.call(this,o,s):r.call(this,s)}}}function XB(e,t,n,r,i,a){switch(ZB(e,n),a){case`function`:t(e,`onRequest`,YB(r,i,`http.request`)),t(e,`onCall`,YB(r,i,`http.call`));break;case`firestore`:t(e,`onDocumentCreated`,YB(r,i,`firestore.document.created`)),t(e,`onDocumentUpdated`,YB(r,i,`firestore.document.updated`)),t(e,`onDocumentDeleted`,YB(r,i,`firestore.document.deleted`)),t(e,`onDocumentWritten`,YB(r,i,`firestore.document.written`)),t(e,`onDocumentCreatedWithAuthContext`,YB(r,i,`firestore.document.created`)),t(e,`onDocumentUpdatedWithAuthContext`,YB(r,i,`firestore.document.updated`)),t(e,`onDocumentDeletedWithAuthContext`,YB(r,i,`firestore.document.deleted`)),t(e,`onDocumentWrittenWithAuthContext`,YB(r,i,`firestore.document.written`));break;case`scheduler`:t(e,`onSchedule`,YB(r,i,`scheduler.scheduled`));break;case`storage`:t(e,`onObjectFinalized`,YB(r,i,`storage.object.finalized`)),t(e,`onObjectArchived`,YB(r,i,`storage.object.archived`)),t(e,`onObjectDeleted`,YB(r,i,`storage.object.deleted`)),t(e,`onObjectMetadataUpdated`,YB(r,i,`storage.object.metadataUpdated`));break}return e}function ZB(e,t){for(let n of[`onSchedule`,`onRequest`,`onCall`,`onObjectFinalized`,`onObjectArchived`,`onObjectDeleted`,`onObjectMetadataUpdated`,`onDocumentCreated`,`onDocumentUpdated`,`onDocumentDeleted`,`onDocumentWritten`,`onDocumentCreatedWithAuthContext`,`onDocumentUpdatedWithAuthContext`,`onDocumentDeletedWithAuthContext`,`onDocumentWrittenWithAuthContext`])Ka(e[n])&&t(e,n);return e}var QB=n((()=>{T(),L()})),$B,eV,tV,nV,rV=n((()=>{L(),X(),qB(),QB(),$B={},eV=[`>=3.0.0 <5`],tV=[`>=6.0.0 <7`],nV=class extends Za{constructor(e=$B){super(`@sentry/instrumentation-firebase`,bo,e)}setConfig(e={}){super.setConfig({...$B,...e})}init(){let e=[];return e.push(IB(this.tracer,eV,this._wrap,this._unwrap,this.getConfig())),e.push(JB(this.tracer,tV,this._wrap,this._unwrap,this.getConfig())),e}}})),iV,aV,oV,sV,cV,lV=n((()=>{X(),$(),rV(),iV=`Firebase`,aV={firestoreSpanCreationHook:e=>{yk(e,`auto.firebase.otel.firestore`),e.setAttribute(G,`db.query`)},functions:{requestHook:e=>{yk(e,`auto.firebase.otel.functions`),e.setAttribute(G,`http.request`)},errorHook:async(e,t)=>{t&&(J(t,{mechanism:{type:`auto.firebase.otel.functions`,handled:!1}}),await yp(2e3))}}},oV=Z(iV,()=>new nV(aV)),sV=(()=>({name:iV,setupOnce(){oV()}})),cV=Y(sV)}));function uV(){return[$k(),rN(),yN(),kR(),rP(),mP(),EP(),RP(),bF(),PF(),rR(),gR(),HR(),ez(),fz(),xz(),jN(),Fz(),BN(),DB(),PB(),Zz(),iB(),dB(),vB(),UF(),cV()]}var dV=n((()=>{Iz(),fB(),tz(),eA(),iN(),lV(),Sz(),yB(),bN(),_R(),AR(),MN(),UR(),OB(),FB(),VN(),iP(),hP(),DP(),zP(),aB(),FF(),WF(),iR(),xF(),pz(),Qz()}));function fV(e,t={}){e.getOptions().debug&&DE();let[n,r]=pV(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function pV(e,t={}){let n=new We({sampler:new SE(e),resource:JT(`node`),forceFlushTimeoutMillis:500,spanProcessors:[new xE({timeout:mV(e.getOptions().maxSpanWaitDuration)}),...t.spanProcessors||[]]});D.setGlobalTracerProvider(n),C.setGlobalPropagator(new pE);let r=new TE;return O.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function mV(e){if(e!=null){if(e>hV)return Kk&&V.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${hV}`),hV;if(e<=0||Number.isNaN(e)){Kk&&V.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}var hV,gV=n((()=>{T(),Ke(),X(),$(),wE(),qk(),hV=1e6}));function _V(){return uk().filter(e=>e.name!==`Http`&&e.name!==`NodeFetch`).concat(jk(),Wk())}function vV(e){return[..._V(),...Qu(e)?uV():[]]}function yV(e={}){return bV(e,vV)}function bV(e={},t){Eh(e,`node`);let n=dk({...e,defaultIntegrations:e.defaultIntegrations??t(e)});return n&&!e.skipOpenTelemetrySetup&&(fV(n,{spanProcessors:e.openTelemetrySpanProcessors}),pk()),n}var xV=n((()=>{X(),$(),Mk(),Gk(),dV(),gV()})),SV=n((()=>{Mk(),Gk(),X(),$(),eA(),iN(),bN(),MN(),VN(),iP(),hP(),DP(),zP(),xF(),FF(),WF(),iR(),_R(),AR(),UR(),tz(),pz(),Sz(),Iz(),Qz(),aB(),fB(),yB(),OB(),FB(),lV(),xV(),gV(),dV(),wE()}));export{ul as a,bp as i,yV as n,J as r,SV as t};
|