@readmagic/workmate 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/AddWorkspaceDirectory-BSLHrjbt.js +1 -0
- package/dist/chunks/App-DY5O6IKw.js +1 -0
- package/dist/chunks/ApproveApiKey-BEzfC6r3.js +1 -0
- package/dist/chunks/ApproveApiKey-DfAPwDix.js +1 -0
- package/dist/chunks/AssistantSessionChooser-Ce3PraaD.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-Dvhcgahe.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-B68V1bCq.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-BV7HHcgL.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CTWhpIm8.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-CU5fCPKq.js +1 -0
- package/dist/chunks/DesktopHandoff-BRbU4is4.js +1 -0
- package/dist/chunks/Dialog-vfLXEPed.js +1 -0
- package/dist/chunks/DiffDialog-CBluIK-x.js +6 -0
- package/dist/chunks/Doctor-B0CRtxi2.js +1 -0
- package/dist/chunks/Doctor-WxNv49HC.js +3 -0
- package/dist/chunks/ExitFlow-CRPgptCN.js +2 -0
- package/dist/chunks/Feedback-CEtzaLr3.js +2 -0
- package/dist/chunks/Grove--kttLxvs.js +11 -0
- package/dist/chunks/Grove-CelgLWH4.js +1 -0
- package/dist/chunks/HybridTransport-BgV5_7Az.js +4 -0
- package/dist/chunks/InvalidConfigDialog-DCGwXW_p.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-jTwsdXWr.js +1 -0
- package/dist/chunks/ListItem-vfLXEPed.js +1 -0
- package/dist/chunks/MCPConnectionManager-BX0LMz9J.js +1 -0
- package/dist/chunks/McpParsingWarnings-WQrWJeWP.js +1 -0
- package/dist/chunks/MessageSelector-_UZB8cGb.js +3 -0
- package/dist/chunks/Messages-jCoW_1Rr.js +11 -0
- package/dist/chunks/Onboarding-BoIVNCgc.js +1 -0
- package/dist/chunks/OverageCreditUpsell-1FCN8bH3.js +1 -0
- package/dist/chunks/PermissionDialog-0ya1CU5k.js +1 -0
- package/dist/chunks/PluginSettings-BD9JLV9-.js +17 -0
- package/dist/chunks/PressEnterToContinue-Dl9Hg9Mf.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-CrGST0Cq.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-B2TDpbpw.js +1 -0
- package/dist/chunks/QueryEngine-D2HUnwmU.js +1 -0
- package/dist/chunks/REPL-BV4WyYMg.js +142 -0
- package/dist/chunks/REPL-DcpN3MRC.js +1 -0
- package/dist/chunks/RemoteCallout-DS_EV6Fh.js +1 -0
- package/dist/chunks/RemoteSessionManager-Tx1N2uVL.js +2 -0
- package/dist/chunks/ResumeConversation-Cw3vP4G8.js +1 -0
- package/dist/chunks/SSETransport-BXiEBMpb.js +4 -0
- package/dist/chunks/SearchBox-vfLXEPed.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-D3VOFq9R.js +1 -0
- package/dist/chunks/Settings-ns6mRsDc.js +2 -0
- package/dist/chunks/TeleportProgress-CcDzMC5L.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-DZbxl4sD.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-EowJO5nm.js +1 -0
- package/dist/chunks/ThemePicker-BYbChJpu.js +1 -0
- package/dist/chunks/TrustDialog-DA3YTk_k.js +1 -0
- package/dist/chunks/TungstenTool-Cb7gJvq4.js +1 -0
- package/dist/chunks/TungstenTool-CxMQVCuF.js +1 -0
- package/dist/chunks/ValidationErrorsList-Cx-hoRwG.js +2 -0
- package/dist/chunks/WelcomeV2-BTfttGcv.js +1 -0
- package/dist/chunks/add-dir-CWt69NAZ.js +1 -0
- package/dist/chunks/agentDisplay-CQ4mZWFH.js +1 -0
- package/dist/chunks/agents-C6jzKOit.js +2 -0
- package/dist/chunks/agents-D4clhuCl.js +103 -0
- package/dist/chunks/ajv-5vMo9UcX.js +8 -0
- package/dist/chunks/allErrors-HMPqE0jK.js +1 -0
- package/dist/chunks/analytics-BotDBGh0.js +1 -0
- package/dist/chunks/ant-9Z5bppVC.js +1 -0
- package/dist/chunks/api-L2IgleTV.js +1 -0
- package/dist/chunks/api-TgV7fl9V.js +1 -0
- package/dist/chunks/asciicast-DYbkzGCN.js +1 -0
- package/dist/chunks/asciicast-n-BBfgDq.js +4 -0
- package/dist/chunks/assistant-BA9_Mo9U.js +1 -0
- package/dist/chunks/assistant-BiNOSla3.js +1 -0
- package/dist/chunks/assistant-YvbVKjVh.js +1 -0
- package/dist/chunks/attributionHooks-CUAoGkU6.js +1 -0
- package/dist/chunks/attributionTrailer-oKKrF3z8.js +1 -0
- package/dist/chunks/auth-CEig4Gxp.js +1 -0
- package/dist/chunks/auth-CbGDlhyO.js +1 -0
- package/dist/chunks/auth-DHyCIxCk.js +15 -0
- package/dist/chunks/autoMode-Db4QrgFr.js +45 -0
- package/dist/chunks/autoModeDenials-BxNzGJdR.js +1 -0
- package/dist/chunks/autonomy-BkAMA7du.js +1 -0
- package/dist/chunks/autonomy-D4Vy-RPQ.js +15 -0
- package/dist/chunks/autonomyPanel-EjfO8jvg.js +1 -0
- package/dist/chunks/axios-BHBm_hhU.js +1 -0
- package/dist/chunks/axios-DaWTGg7G.js +16 -0
- package/dist/chunks/backgroundHousekeeping-BNEKWHhH.js +1 -0
- package/dist/chunks/backgroundHousekeeping-hDDE8mJC.js +17 -0
- package/dist/chunks/banner-hD6wZygx.js +2 -0
- package/dist/chunks/base64-js-0wLHn8zB.js +1 -0
- package/dist/chunks/bedrockClient-DxE_mHFI.js +15 -0
- package/dist/chunks/bg-BzG63WOm.js +1 -0
- package/dist/chunks/bg-DQ0Q3Qv-.js +9 -0
- package/dist/chunks/branch-CeQ9IyZk.js +3 -0
- package/dist/chunks/break-cache-Bd0clV2N.js +8 -0
- package/dist/chunks/bridge-yerAiaK2.js +2 -0
- package/dist/chunks/bridgeConfig-CCtXe8ak.js +1 -0
- package/dist/chunks/bridgeConfig-D5dB38xD.js +1 -0
- package/dist/chunks/bridgeEnabled--F-6TUi4.js +1 -0
- package/dist/chunks/bridgeEnabled-DKX8-T_H.js +1 -0
- package/dist/chunks/bridgeMain--R1HFbOv.js +68 -0
- package/dist/chunks/bridgeMain-d06JByZn.js +1 -0
- package/dist/chunks/bridgeMessaging-CqbLTDcx.js +1 -0
- package/dist/chunks/bridgePointer-W_jdQ8zf.js +1 -0
- package/dist/chunks/browser-Bd7GeBH1.js +1 -0
- package/dist/chunks/btw-CVGRmL9a.js +1 -0
- package/dist/chunks/bundledMode--fG1S62b.js +1 -0
- package/dist/chunks/caches-BtmAri4e.js +3 -0
- package/dist/chunks/caches-BuTIAOtY.js +1 -0
- package/dist/chunks/capacityWake-CV_x9H8j.js +1 -0
- package/dist/chunks/ccrClient-HqMi5Kfu.js +1 -0
- package/dist/chunks/checksum-DgbnMdM-.js +1 -0
- package/dist/chunks/classPrivateFieldSet2-D4U5K-I3.js +1 -0
- package/dist/chunks/classPrivateMethodInitSpec-BXQD0Vh4.js +1 -0
- package/dist/chunks/claudeDesktop-aUMx06RK.js +1 -0
- package/dist/chunks/clear-C6nRzIQE.js +1 -0
- package/dist/chunks/cliLaunch-2AUoMnqx.js +1 -0
- package/dist/chunks/client-BeET1hnC.js +1 -0
- package/dist/chunks/client-DchQnIJD.js +36 -0
- package/dist/chunks/client-DvAL7lY8.js +8 -0
- package/dist/chunks/color-DXI_4ibU.js +1 -0
- package/dist/chunks/color-convert-p91EwGT7.js +1 -0
- package/dist/chunks/commands-VjcG4qFq.js +1 -0
- package/dist/chunks/commitAttribution-Cm40fdNU.js +2 -0
- package/dist/chunks/commitAttribution-Lb3qUlAR.js +1 -0
- package/dist/chunks/compact-DPTVpJ4D.js +2 -0
- package/dist/chunks/completionCache-BQaLkB4d.js +4 -0
- package/dist/chunks/completionCache-CW8lKIgy.js +1 -0
- package/dist/chunks/config-0cRberzR.js +1 -0
- package/dist/chunks/config-BSXLgwpD.js +1 -0
- package/dist/chunks/config-BrxKpHpR.js +1 -0
- package/dist/chunks/config-C7YHKCPV.js +3 -0
- package/dist/chunks/config-CLmFk-5V.js +1 -0
- package/dist/chunks/connectHeadless-CqRoEtrg.js +1 -0
- package/dist/chunks/context-C_cKrBUn.js +1 -0
- package/dist/chunks/context-noninteractive-DnH6Q9Lu.js +54 -0
- package/dist/chunks/context-noninteractive-rUZ3ydmJ.js +1 -0
- package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +1 -0
- package/dist/chunks/conversation-GJxfkr6M.js +1 -0
- package/dist/chunks/conversation-oK3aFzqO.js +1 -0
- package/dist/chunks/createSSHSession--bWmmIk9.js +6 -0
- package/dist/chunks/createSession-DIr4sUp6.js +1 -0
- package/dist/chunks/createSession-DM4acqaC.js +1 -0
- package/dist/chunks/cron-3LntnnhJ.js +1 -0
- package/dist/chunks/crossProjectResume-DKrtjTpm.js +40 -0
- package/dist/chunks/cwd-BuJhkTrc.js +1 -0
- package/dist/chunks/cwd-D-tY2NKc.js +1 -0
- package/dist/chunks/daemon-B9lBPdBJ.js +2 -0
- package/dist/chunks/dangerousBackend-DwcP0P08.js +1 -0
- package/dist/chunks/datadog-ByS7LGGa.js +1 -0
- package/dist/chunks/datadog-DNCsyfSO.js +1 -0
- package/dist/chunks/debug-DzZUT2Wv.js +1 -0
- package/dist/chunks/debug-IKW-jE7K.js +39 -0
- package/dist/chunks/debugUtils-D2981c0Z.js +1 -0
- package/dist/chunks/defineProperty-C-QyHrDq.js +1 -0
- package/dist/chunks/desktop-B5cvrcOQ.js +1 -0
- package/dist/chunks/detached-rfIUyc-B.js +5 -0
- package/dist/chunks/detect-libc-CxbBtWJu.js +1 -0
- package/dist/chunks/detectRepository-6nw-Aw3v.js +1 -0
- package/dist/chunks/detectRepository-ReZ0Fz8Z.js +1 -0
- package/dist/chunks/diff-cXAp9cNN.js +1 -0
- package/dist/chunks/directoryCompletion-DBM2o5kx.js +1 -0
- package/dist/chunks/dist-CXlEpGqr.js +20 -0
- package/dist/chunks/dist-DESLAofA.js +1 -0
- package/dist/chunks/dist-DIee4wq1.js +29 -0
- package/dist/chunks/dist-Dopnn8wS.js +5 -0
- package/dist/chunks/dist-es-5t7v8oaj.js +1 -0
- package/dist/chunks/dist-es-BF6bR-Ik.js +2 -0
- package/dist/chunks/dist-es-BIjDeceU.js +1 -0
- package/dist/chunks/dist-es-BOPBJQo3.js +1 -0
- package/dist/chunks/dist-es-Bfr4TzQe.js +3 -0
- package/dist/chunks/dist-es-Byxccz_-.js +1 -0
- package/dist/chunks/dist-es-C-OjW2Ao.js +1 -0
- package/dist/chunks/dist-es-C3reqy7X.js +1 -0
- package/dist/chunks/dist-es-C7vygWzp.js +1 -0
- package/dist/chunks/dist-es-CEk66gUu.js +1 -0
- package/dist/chunks/dist-es-CIULjvtA2.js +1 -0
- package/dist/chunks/dist-es-CMtO44xC.js +1 -0
- package/dist/chunks/dist-es-CQMt6zRM.js +1 -0
- package/dist/chunks/dist-es-CYPVg66r.js +9 -0
- package/dist/chunks/dist-es-Cd_AeqMK.js +6 -0
- package/dist/chunks/dist-es-Cgsa8pb82.js +1 -0
- package/dist/chunks/dist-es-Cwru7c2B2.js +1 -0
- package/dist/chunks/dist-es-D1Y8zSMI.js +1 -0
- package/dist/chunks/dist-es-D1wHe_zh.js +1 -0
- package/dist/chunks/dist-es-DKFm0FJ7.js +1 -0
- package/dist/chunks/dist-es-DKIwwJME.js +1 -0
- package/dist/chunks/dist-es-DNFTCbrP.js +1 -0
- package/dist/chunks/dist-es-DXIR5NLi2.js +1 -0
- package/dist/chunks/dist-es-DelBIxNM.js +1 -0
- package/dist/chunks/dist-es-DmdZmEJ-.js +1 -0
- package/dist/chunks/dist-es-Gt_DpXlP.js +1 -0
- package/dist/chunks/dist-es-gUzZ_7Vf.js +1 -0
- package/dist/chunks/dist-es-kj-F5A132.js +1 -0
- package/dist/chunks/dist-es-yHGBqhBe.js +1 -0
- package/dist/chunks/doctor-CTMHXZvQ.js +1 -0
- package/dist/chunks/earlyInput-BTC_Wucv.js +2 -0
- package/dist/chunks/earlyInput-xcoTbKQn.js +1 -0
- package/dist/chunks/effort-Br8KKHdx.js +9 -0
- package/dist/chunks/entry-4lIRMrLI.js +14 -0
- package/dist/chunks/envLessBridgeConfig-CGuIxFzJ.js +1 -0
- package/dist/chunks/envLessBridgeConfig-D_Jg4fJy.js +1 -0
- package/dist/chunks/envUtils-DSxRz_kt.js +1 -0
- package/dist/chunks/esm-BYnFh4pG.js +1 -0
- package/dist/chunks/esm-Bx6rTxIs.js +1 -0
- package/dist/chunks/esm-C367Cyo-.js +1 -0
- package/dist/chunks/esm-C8Zkk1Ux.js +1 -0
- package/dist/chunks/esm-CGx9qY3q.js +56 -0
- package/dist/chunks/esm-CXM9jqO_.js +1 -0
- package/dist/chunks/esm-CXczu_-W.js +1 -0
- package/dist/chunks/esm-CXt5K8Xt.js +1 -0
- package/dist/chunks/esm-Cb-L4oAk.js +1 -0
- package/dist/chunks/esm-D6ZZCdtk.js +1 -0
- package/dist/chunks/esm-DhRjocaU.js +1 -0
- package/dist/chunks/esm-DklLYEuz.js +1 -0
- package/dist/chunks/esm-IYgGg4wR.js +1 -0
- package/dist/chunks/esm-lWlUmoUA.js +1 -0
- package/dist/chunks/esm-lyfry1WB.js +10 -0
- package/dist/chunks/esm-wGnzjq4Z.js +1 -0
- package/dist/chunks/event-streams-C0Zy0Uqv.js +1 -0
- package/dist/chunks/event-streams-DoqJmjFN.js +1 -0
- package/dist/chunks/eventLoopStallDetector-Cg_RXU1q.js +1 -0
- package/dist/chunks/execAsync-Bv2yxuGe.js +1 -0
- package/dist/chunks/execFileNoThrow-COKYqVQj.js +34 -0
- package/dist/chunks/execSyncWrapper-DZJ3tNWF.js +1 -0
- package/dist/chunks/exit-BOhGfSlm.js +2 -0
- package/dist/chunks/exit-Z9oWrqE4.js +1 -0
- package/dist/chunks/extra-usage-BS4aVOt5.js +1 -0
- package/dist/chunks/extra-usage-DtAIhW74.js +1 -0
- package/dist/chunks/extra-usage-core-CdL1ltqq.js +1 -0
- package/dist/chunks/extra-usage-noninteractive-DxxRI0Yx.js +1 -0
- package/dist/chunks/extraUsage-BYZdi44Y.js +1 -0
- package/dist/chunks/extractMemories-C4f9JWuI.js +1 -0
- package/dist/chunks/fast-B0OB4x7K.js +1 -0
- package/dist/chunks/fast-DKqiojzf.js +1 -0
- package/dist/chunks/featureCheck-CrJeuheQ.js +1 -0
- package/dist/chunks/featureCheck-HslM03dr.js +1 -0
- package/dist/chunks/feedback-yB19xph5.js +1 -0
- package/dist/chunks/figures-5ThXQEtq.js +1 -0
- package/dist/chunks/file-D1cN3LMK.js +12 -0
- package/dist/chunks/fileStateCache-DDW5toIs.js +1 -0
- package/dist/chunks/files-DAzGtmzz.js +2 -0
- package/dist/chunks/firstPartyEventLogger-CdUpe6Lh.js +1 -0
- package/dist/chunks/firstPartyEventLogger-hU-LPkje.js +5 -0
- package/dist/chunks/flushGate-ZFr8yv7F.js +1 -0
- package/dist/chunks/foundry-sdk-BdeF2aBu.js +1 -0
- package/dist/chunks/fpsMetrics-Cf_hdtiJ.js +1 -0
- package/dist/chunks/from-CgDRRLiX.js +4 -0
- package/dist/chunks/gemini-DqAv8_GY.js +1 -0
- package/dist/chunks/generateRecap-lO2PDlx8.js +1 -0
- package/dist/chunks/generateSessionName-48veu5dv.js +1 -0
- package/dist/chunks/genericProcessUtils-F1Qcb1sO.js +23 -0
- package/dist/chunks/getMachineId-bsd-Cut1kHoA.js +1 -0
- package/dist/chunks/getMachineId-darwin-CsRhaP3y.js +2 -0
- package/dist/chunks/getMachineId-linux-Bd7UBNRQ.js +1 -0
- package/dist/chunks/getMachineId-unsupported-vFGP8E_8.js +1 -0
- package/dist/chunks/getMachineId-win-DamF2CH_.js +1 -0
- package/dist/chunks/git-BE_FiJZp.js +1 -0
- package/dist/chunks/git-tyaWOgRL.js +6 -0
- package/dist/chunks/githubRepoPathMapping-BlR0BphY.js +1 -0
- package/dist/chunks/goal-Bn8Kz2Dp.js +3 -0
- package/dist/chunks/graceful-fs-DDVg0cja.js +2 -0
- package/dist/chunks/grok-DhnO_KDC.js +1 -0
- package/dist/chunks/grove-DotW04-v.js +7 -0
- package/dist/chunks/hash-Tu-My5Vp.js +1 -0
- package/dist/chunks/heapdump-DkZSKNbp.js +5 -0
- package/dist/chunks/help-DU_BcZtU.js +1 -0
- package/dist/chunks/hooks-BTMWE5Qx.js +79 -0
- package/dist/chunks/hooks-DONAb_nq.js +1 -0
- package/dist/chunks/hostGuard-Dh296c6q.js +1 -0
- package/dist/chunks/inboundAttachments-BcEgi49j.js +1 -0
- package/dist/chunks/inboundAttachments-DVs3_m48.js +1 -0
- package/dist/chunks/index.min-D75yiGLN.js +1 -0
- package/dist/chunks/initReplBridge-D0Xec8S-.js +1 -0
- package/dist/chunks/install-BkfXeXpv.js +1 -0
- package/dist/chunks/instinctParser-Dt-lqnDe.js +1 -0
- package/dist/chunks/instrumentation-H0XRS1yG.js +21 -0
- package/dist/chunks/intl-cKc-V6Mq.js +1 -0
- package/dist/chunks/isObject-C6qM3WEW.js +1 -0
- package/dist/chunks/isSymbol-BO6cdPI7.js +1 -0
- package/dist/chunks/job-DKtLkF8V.js +2 -0
- package/dist/chunks/json-bigint-bonnP-Hz.js +8 -0
- package/dist/chunks/jsx-runtime-Bb4Xn-E0.js +1 -0
- package/dist/chunks/jws-BscXOT9I.js +3 -0
- package/dist/chunks/jwtUtils-C-ojmb8W.js +1 -0
- package/dist/chunks/keybindings-ez51eHHp.js +2 -0
- package/dist/chunks/language-BuRSO2sR.js +1 -0
- package/dist/chunks/language-Da4KNbjm.js +1 -0
- package/dist/chunks/launchAgentsPlatform-BQyPdrHp.js +1 -0
- package/dist/chunks/launchCommand-1qkTCKpf.js +1 -0
- package/dist/chunks/launchLocalMemory-CWHAj7CX.js +3 -0
- package/dist/chunks/launchLocalVault-D8iJdtsP.js +3 -0
- package/dist/chunks/launchMemoryStores-W7jWG2uH.js +1 -0
- package/dist/chunks/launchOnboarding-q__LaLy1.js +8 -0
- package/dist/chunks/launchSchedule-BWi9F5vh.js +1 -0
- package/dist/chunks/launchSkillStore-4wd4MQBc.js +1 -0
- package/dist/chunks/launchTeleport-BlCf2QM_.js +3 -0
- package/dist/chunks/launchVault-C7u7LZV7.js +1 -0
- package/dist/chunks/lazySchema-uxlVVNM1.js +1 -0
- package/dist/chunks/lib-BSzUGQb_.js +2 -0
- package/dist/chunks/lib-BlVGipXx.js +14 -0
- package/dist/chunks/lib-rQZENxQg.js +8 -0
- package/dist/chunks/loadAgentsDir-Dgd-fzNt.js +1 -0
- package/dist/chunks/loadAgentsDir-nzr38hai.js +3990 -0
- package/dist/chunks/loadPluginHooks-z1-zvBLw.js +1 -0
- package/dist/chunks/loadSso-DSxfVpgX.js +1 -0
- package/dist/chunks/localSearch-B-L_ldos.js +1 -0
- package/dist/chunks/localSearch-D-FprOMr.js +1 -0
- package/dist/chunks/lockfile-D5-j7HOZ.js +1 -0
- package/dist/chunks/log-B3eB4EFv.js +1 -0
- package/dist/chunks/logoV2Utils-RQ160dI2.js +1 -0
- package/dist/chunks/magicDocs-BqZ0GewA.js +57 -0
- package/dist/chunks/main-DeFMhaFE.js +31 -0
- package/dist/chunks/main-y7LJ5qUc.js +1243 -0
- package/dist/chunks/mappers-CWykjGfP.js +1 -0
- package/dist/chunks/mcp-CSFPAfaW.js +2 -0
- package/dist/chunks/mcp-DBwT4pa9.js +6 -0
- package/dist/chunks/mcp-DvZTaHZE.js +1 -0
- package/dist/chunks/memoize-BK3gG5ob.js +1 -0
- package/dist/chunks/memoize-BO31Ws9Q.js +1 -0
- package/dist/chunks/memory-DcpPpYN0.js +1 -0
- package/dist/chunks/metadata-BRLJvh61.js +1 -0
- package/dist/chunks/modalContext-DFjKLCB6.js +1 -0
- package/dist/chunks/mode-BkViT_0o.js +2 -0
- package/dist/chunks/model--z4Di9QO.js +1 -0
- package/dist/chunks/model-CZktWw6o.js +1 -0
- package/dist/chunks/model-DfFA3qMO.js +1 -0
- package/dist/chunks/multipart-parser-DDLYsngd.js +2 -0
- package/dist/chunks/nativeInstaller-GcIk7G2Y.js +1 -0
- package/dist/chunks/oauth-BqJqV-2M.js +1 -0
- package/dist/chunks/oauth-C8X_p8Gc.js +1 -0
- package/dist/chunks/observationStore-DzCdXq8U.js +4 -0
- package/dist/chunks/onChangeAppState-DwGVi-BC.js +1 -0
- package/dist/chunks/open-BtQHzzL9.js +1 -0
- package/dist/chunks/openai-B2wxZDQx.js +10 -0
- package/dist/chunks/openaiShared-G2-w4gJt.js +1 -0
- package/dist/chunks/output-style-BM3qAHLA.js +1 -0
- package/dist/chunks/overageCreditGrant-CjK49axw.js +1 -0
- package/dist/chunks/p-map-B1EeBuI8.js +1 -0
- package/dist/chunks/p-map-HKDr3iDo.js +1 -0
- package/dist/chunks/package-BC0bllK8.js +1 -0
- package/dist/chunks/panel-B-nrcHpm.js +1 -0
- package/dist/chunks/panel-R4ue6pSW.js +1 -0
- package/dist/chunks/panelCall-I_fbgub5.js +1 -0
- package/dist/chunks/parseConnectUrl-BiyKR5-x.js +1 -0
- package/dist/chunks/parser-BlM_Fk4J.js +1 -0
- package/dist/chunks/parser-CQrasoUB.js +1 -0
- package/dist/chunks/partition-CxRF7T-f.js +1 -0
- package/dist/chunks/passes-U_h-hNu-.js +1 -0
- package/dist/chunks/path-BCSE0S-c.js +1 -0
- package/dist/chunks/permissions-B8epy16o.js +3 -0
- package/dist/chunks/permissions-CeYKbtSC.js +1 -0
- package/dist/chunks/permissions-Cn_6f8CB.js +1 -0
- package/dist/chunks/pidLock-CBJDnBG_.js +3 -0
- package/dist/chunks/pipeTransport-D3Qx9v1V.js +1 -0
- package/dist/chunks/plan-BAhStVci.js +1 -0
- package/dist/chunks/platform-EtecGacO.js +2 -0
- package/dist/chunks/plist-Bzo2VMe9.js +6 -0
- package/dist/chunks/plugin-D9huNnv6.js +1 -0
- package/dist/chunks/pluginAutoupdate-BfmyxR5g.js +1 -0
- package/dist/chunks/pluginBlocklist-03sZaZa6.js +1 -0
- package/dist/chunks/pluginCliCommands-P2Ndi1r1.js +1 -0
- package/dist/chunks/pluginFlagging-BVy7Xv_0.js +1 -0
- package/dist/chunks/pluginOperations-Cz37qcjF.js +2 -0
- package/dist/chunks/pluginStartupCheck-BqUwHcMD.js +1 -0
- package/dist/chunks/pluginStartupCheck-w24D-wwk.js +1 -0
- package/dist/chunks/plugins-B0hiIN4q.js +4 -0
- package/dist/chunks/policyLimits-Dem-XJ_h.js +1 -0
- package/dist/chunks/pollConfig-C2Ac8WMU.js +1 -0
- package/dist/chunks/poller-CpLBoB-N.js +1 -0
- package/dist/chunks/poor-CfbMKZNJ.js +1 -0
- package/dist/chunks/poorMode-Bsw2V-V_.js +1 -0
- package/dist/chunks/poorMode-jvImnkty.js +1 -0
- package/dist/chunks/postCommitAttribution-DoSP9wZD.js +1 -0
- package/dist/chunks/print-ozjC0Mhg.js +23 -0
- package/dist/chunks/privacy-settings-DeGoBRrZ.js +1 -0
- package/dist/chunks/process-CNfq37LF.js +1 -0
- package/dist/chunks/process-gEbdy6uY.js +1 -0
- package/dist/chunks/processBashCommand-loWZ8MSE.js +1 -0
- package/dist/chunks/processSlashCommand-BdouajZb.js +5 -0
- package/dist/chunks/projectContext-BaDZBAoK.js +1 -0
- package/dist/chunks/projectContext-D9MDwJUF.js +1 -0
- package/dist/chunks/prompt-Bef63FhB.js +132 -0
- package/dist/chunks/prompt-C7wd1H_i.js +1 -0
- package/dist/chunks/prompt-DIoNqZvO.js +1 -0
- package/dist/chunks/promptEditor-foiayhdY.js +4 -0
- package/dist/chunks/protocolHandler-BsiB1oW_.js +13 -0
- package/dist/chunks/protocols-CCsohXid.js +18 -0
- package/dist/chunks/protocols-CnYQjBlj.js +2 -0
- package/dist/chunks/proxy-Cn2YwITp.js +99 -0
- package/dist/chunks/rate-limit-options-DTJPDcTr.js +1 -0
- package/dist/chunks/rcDebugLog-BUuD-X1D.js +11 -0
- package/dist/chunks/reconciler-DqXTmV3J.js +4 -0
- package/dist/chunks/referral-DP_GshTS.js +1 -0
- package/dist/chunks/refresh-CNzXPAFw.js +1 -0
- package/dist/chunks/registerProtocol-CjxlFsKw.js +36 -0
- package/dist/chunks/release-notes-BxgK8zWO.js +4 -0
- package/dist/chunks/releaseNotes-CbSktIJW.js +2 -0
- package/dist/chunks/reload-plugins-CDu6yU5-.js +1 -0
- package/dist/chunks/remote-env-B4HnhISc.js +1 -0
- package/dist/chunks/remoteBridgeCore-D-wG5jau.js +1 -0
- package/dist/chunks/remoteManagedSettings-B7gt0VAX.js +1 -0
- package/dist/chunks/rename-DlbMb24l.js +1 -0
- package/dist/chunks/renderOptions-5kWQpVr2.js +1 -0
- package/dist/chunks/resume-BB5iBogS.js +2 -0
- package/dist/chunks/rewind-D12hCfZD.js +1 -0
- package/dist/chunks/ripgrep-BQgJ02F9.js +1 -0
- package/dist/chunks/ripgrep-BvDwiKJ3.js +5 -0
- package/dist/chunks/rollback-BPWRKlIZ.js +11 -0
- package/dist/chunks/rolldown-runtime-DaDcL9Zw.js +1 -0
- package/dist/chunks/runtimeObserver-BNH2WGE3.js +1 -0
- package/dist/chunks/runtimeObserver-Ci-5gvYg.js +10 -0
- package/dist/chunks/sandbox-adapter-Coe1GDAE.js +1 -0
- package/dist/chunks/sandbox-toggle-B2Yk4y2V.js +1 -0
- package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
- package/dist/chunks/satisfies-DQJHNtpQ.js +1 -0
- package/dist/chunks/sdkHeapDumpMonitor-WdXUV7DV.js +1 -0
- package/dist/chunks/searchExtraTools-BnWZ9roi.js +1 -0
- package/dist/chunks/semver-BMRJYn3q.js +1 -0
- package/dist/chunks/semver-DQo45qGo.js +1 -0
- package/dist/chunks/serde-f76bObzR.js +4 -0
- package/dist/chunks/server-LdbAb0sV.js +1 -0
- package/dist/chunks/serverBanner-BdExKFHT.js +1 -0
- package/dist/chunks/serverLog-BFmvyJ93.js +1 -0
- package/dist/chunks/session-Bmx7L3Mt.js +2 -0
- package/dist/chunks/sessionDataUploader-CaCjwsA2.js +1 -0
- package/dist/chunks/sessionDiscovery-DcEAr5vJ.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-BhdOmW9o.js +1 -0
- package/dist/chunks/sessionManager-CPa049BO.js +1 -0
- package/dist/chunks/sessionMemory-Bsg2unYX.js +1 -0
- package/dist/chunks/sessionMemory-CIbCojm-.js +1 -0
- package/dist/chunks/sessionMemoryUtils-Cjb57wtC.js +1 -0
- package/dist/chunks/sessionObserver-CRU1qWnP.js +1 -0
- package/dist/chunks/sessionObserver-DQwHsDrM.js +20 -0
- package/dist/chunks/sessionStorage-BxDN8qRc.js +1 -0
- package/dist/chunks/sessionStoragePortable-Cx6JQ5Ye.js +3 -0
- package/dist/chunks/sessionTitle-B8jcexkQ.js +14 -0
- package/dist/chunks/sessionTracing-BuLsL6qA.js +11 -0
- package/dist/chunks/settings-5PQdphqC.js +19 -0
- package/dist/chunks/settingsSync-BDeuErb5.js +1 -0
- package/dist/chunks/setup-BKEnSLR9.js +3 -0
- package/dist/chunks/shadowedRuleDetection-7Z8ezTKF.js +1 -0
- package/dist/chunks/shellQuote-fB02N16J.js +4 -0
- package/dist/chunks/sideQuestion-CYdNATPW.js +20 -0
- package/dist/chunks/signin-CPaEtsnK.js +1 -0
- package/dist/chunks/sink-DjKoYMsA.js +1 -0
- package/dist/chunks/sink-iYxWapbU.js +1 -0
- package/dist/chunks/sinks-GryGVRT8.js +2 -0
- package/dist/chunks/sinks-jfaIjsRJ.js +1 -0
- package/dist/chunks/skill-learning-E8tQed-Q.js +5 -0
- package/dist/chunks/skillChangeDetector-A8SAuyo9.js +1 -0
- package/dist/chunks/skillGapStore-B5rl12bV.js +1 -0
- package/dist/chunks/skillGapStore-CjJrxxjk.js +5 -0
- package/dist/chunks/skillGenerator-BDR_z3-X.js +8 -0
- package/dist/chunks/skillLearning-BQtfFE0g.js +1 -0
- package/dist/chunks/skillLearning-C8ihdryM.js +1 -0
- package/dist/chunks/skillPanel-yR8Oi-mO.js +28 -0
- package/dist/chunks/skillSearchPanel-DUQQUCUS.js +21 -0
- package/dist/chunks/skills-NAZQ3j-t.js +1 -0
- package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +1 -0
- package/dist/chunks/src-CDCSSo0U2.js +53 -0
- package/dist/chunks/src-CHw1lvBc.js +3 -0
- package/dist/chunks/src-CST_jFnT.js +1 -0
- package/dist/chunks/src-CgZmCiiH.js +2 -0
- package/dist/chunks/src-CiJCsqUl.js +9 -0
- package/dist/chunks/src-D06Xyj4g.js +2 -0
- package/dist/chunks/src-DCUgdrYl.js +5 -0
- package/dist/chunks/src-DLz3FZm1.js +1 -0
- package/dist/chunks/src-DPUAq5Ty.js +1 -0
- package/dist/chunks/src-DQOX_xI1.js +1 -0
- package/dist/chunks/src-Dt5IJd3C.js +1 -0
- package/dist/chunks/src-Dvp6-vB7.js +19 -0
- package/dist/chunks/src-PM8NIIu_.js +1 -0
- package/dist/chunks/src-l6_O0K-a.js +1 -0
- package/dist/chunks/src-xRRBgNzF.js +25 -0
- package/dist/chunks/sso-oidc-DFJ7SBvI.js +1 -0
- package/dist/chunks/startupProfiler-B0m6crkd.js +1 -0
- package/dist/chunks/startupProfiler-DxRQteII.js +3 -0
- package/dist/chunks/state-4KQ3kaqz.js +1 -0
- package/dist/chunks/state-53JDbNQM.js +1 -0
- package/dist/chunks/state-Cn_m2NOf.js +1 -0
- package/dist/chunks/staticRender-BIxpgNUq.js +1 -0
- package/dist/chunks/stats-h4yu84Q-.js +1 -0
- package/dist/chunks/status-BbdeubJG.js +1 -0
- package/dist/chunks/status-is_Bg_IB.js +2 -0
- package/dist/chunks/statusNoticeHelpers-CQ7CUugR.js +1 -0
- package/dist/chunks/stdio-4S7b8Uhx.js +1 -0
- package/dist/chunks/stdio-W_Kokrkh.js +3 -0
- package/dist/chunks/stickers-qJoNhPk4.js +1 -0
- package/dist/chunks/store-Z8rTjDHe.js +1 -0
- package/dist/chunks/stringUtils-CvXbHQRH.js +4 -0
- package/dist/chunks/sts-C2Gf2WYN.js +1 -0
- package/dist/chunks/subprocessEnv-BSQSomcK.js +1 -0
- package/dist/chunks/subprocessEnv-vrwzMgKn.js +1 -0
- package/dist/chunks/supports-color-uJ1LqA-P.js +1 -0
- package/dist/chunks/systemPromptSections-CgpggIYX.js +1 -0
- package/dist/chunks/systemPromptSections-IePG5K8r.js +1 -0
- package/dist/chunks/systemTheme-Ceakddth.js +1 -0
- package/dist/chunks/tag-i3HZ4lhj.js +11 -0
- package/dist/chunks/tasks-HzsYNTZ1.js +1 -0
- package/dist/chunks/teleport-hN3cAbYC.js +1 -0
- package/dist/chunks/templateJobs-CIv_ysje.js +12 -0
- package/dist/chunks/terminalSetup-C0PF87iu.js +33 -0
- package/dist/chunks/terminalSetup-CxniwSF-.js +1 -0
- package/dist/chunks/theme-BKIHX_Dx.js +1 -0
- package/dist/chunks/thinkback-BA4cMz4D.js +1 -0
- package/dist/chunks/thinkback-mT-8FIT-.js +1 -0
- package/dist/chunks/thinkback-play-Cfk49mvF.js +1 -0
- package/dist/chunks/tmux-CbsW-VDJ.js +1 -0
- package/dist/chunks/toolEventObserver-8FQtxeVv.js +1 -0
- package/dist/chunks/toolEventObserver-B1xvyKdE.js +1 -0
- package/dist/chunks/toolPool-CHVDZqh7.js +1 -0
- package/dist/chunks/trustedDevice-BYCh1ff7.js +1 -0
- package/dist/chunks/trustedDevice-DnIWErCt.js +1 -0
- package/dist/chunks/tui-fTa_pzdA.js +6 -0
- package/dist/chunks/types-BUyOCzUt.js +1 -0
- package/dist/chunks/types-Czs-_G1S.js +3 -0
- package/dist/chunks/types-a7X-tJpJ.js +17 -0
- package/dist/chunks/udsClient-Cg9bBD0p.js +1 -0
- package/dist/chunks/ultrareviewCommand-DCFRZsKp.js +3 -0
- package/dist/chunks/undercover-B-kKUWtK.js +1 -0
- package/dist/chunks/undercover-CsLPQb-a.js +31 -0
- package/dist/chunks/up-dO5BcPaq.js +12 -0
- package/dist/chunks/updateCCB-CfUnkOLT.js +11 -0
- package/dist/chunks/upgrade-CngUwvY4.js +1 -0
- package/dist/chunks/upgrade-kpttjebY.js +1 -0
- package/dist/chunks/upload-DDhQqV8n.js +1 -0
- package/dist/chunks/upstreamproxy-CvcjNY7J.js +11 -0
- package/dist/chunks/usage-CJ5w0907.js +1 -0
- package/dist/chunks/usage-eZRwLa77.js +1 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-yAroCqu4.js +1 -0
- package/dist/chunks/useMainLoopModel-BNFW-g8E.js +1 -0
- package/dist/chunks/useManagePlugins-CTtPaQRP.js +1 -0
- package/dist/chunks/useMergedTools-CZJffsmf.js +1 -0
- package/dist/chunks/useSearchInput-C-CqUK6w.js +1 -0
- package/dist/chunks/useSettingsErrors-BWlJCgYF.js +1 -0
- package/dist/chunks/util-DJV0joAW.js +1 -0
- package/dist/chunks/v4-jw6qOKwQ.js +65 -0
- package/dist/chunks/validatePlugin-CRmpIGLV.js +1 -0
- package/dist/chunks/vertex-sdk-DjXcZ2J7.js +9 -0
- package/dist/chunks/vim-n8-UT5w-.js +1 -0
- package/dist/chunks/which-BBCjXfI2.js +1 -0
- package/dist/chunks/windowsPaths-D6T_3XaU.js +1 -0
- package/dist/chunks/windowsPaths-DUKTzBck.js +1 -0
- package/dist/chunks/workSecret-C_lv0dRh.js +1 -0
- package/dist/chunks/workerRegistry-BdHi7_sN.js +1 -0
- package/dist/chunks/worktree-YDeHMlHZ.js +1 -0
- package/dist/chunks/worktreeModeEnabled-BFOYTTTr.js +1 -0
- package/dist/chunks/worktreeModeEnabled-D68iEHpC.js +1 -0
- package/dist/chunks/wrapper-K8ZapJVu.js +6 -0
- package/dist/chunks/xdg-DcF9ejUM.js +1 -0
- package/dist/chunks/zod-CuNujUwx.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/ripgrep/x64-linux/rg +0 -0
- package/package.json +218 -0
- package/scripts/postinstall.cjs +389 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{n as o,t as s}from"./src-DCUgdrYl.js";import{n as c,t as l}from"./dist-Dopnn8wS.js";import{t as u}from"./jws-BscXOT9I.js";import{t as d}from"./semver-DQo45qGo.js";import f from"path";import p,{inspect as m}from"node:util";import h from"node:process";import{Readable as g}from"stream";import{accessSync as _,constants as ee,readFileSync as te,statSync as ne}from"fs";import re from"node:child_process";import ie,{EOL as ae}from"node:os";import{createHash as v,createPrivateKey as oe,randomUUID as se}from"node:crypto";import ce,{createHash as le}from"crypto";import ue from"child_process";import de from"http";import{Transform as fe}from"node:stream";import{readFile as pe}from"node:fs/promises";import me from"node:zlib";import he from"node:https";import ge from"node:http";var _e,ve,ye,be,xe,Se,Ce=t((()=>{_e=`4.13.1`,ve=`04b07795-8ddb-461a-bbee-02f9e1bf7b46`,(function(e){e.AzureChina=`https://login.chinacloudapi.cn`,e.AzureGermany=`https://login.microsoftonline.de`,e.AzureGovernment=`https://login.microsoftonline.us`,e.AzurePublicCloud=`https://login.microsoftonline.com`})(ye||(ye={})),be=ye.AzurePublicCloud,xe=[`*`],Se=`nocae`}));function we(){return ke!==void 0&&Ae!==void 0}function Te(e){let t={cache:{},broker:{...e.brokerOptions,isEnabled:e.brokerOptions?.enabled??!1,enableMsaPassthrough:e.brokerOptions?.legacyEnableMsaPassthrough??!1}};if(e.tokenCachePersistenceOptions?.enabled){if(De===void 0)throw Error([`Persistent token caching was requested, but no persistence provider was configured.`,"You must install the identity-cache-persistence plugin package (`npm install --save @azure/identity-cache-persistence`)","and enable it by importing `useIdentityPlugin` from `@azure/identity` and calling","`useIdentityPlugin(cachePersistencePlugin)` before using `tokenCachePersistenceOptions`."].join(` `));let n=e.tokenCachePersistenceOptions.name||`msal.cache`;t.cache.cachePlugin=De({name:`${n}.${Se}`,...e.tokenCachePersistenceOptions}),t.cache.cachePluginCae=De({name:`${n}.cae`,...e.tokenCachePersistenceOptions})}return e.brokerOptions?.enabled&&(t.broker.nativeBrokerPlugin=Ee(e.isVSCodeCredential||!1)),t}function Ee(e){let{credentialName:t,packageName:n,pluginVar:r,brokerInfo:i}=Me[e?`vsCode`:`native`];if(i===void 0)throw Error(je.missing(t,n,r));if(i.broker.isBrokerAvailable===!1)throw Error(je.unavailable(t,n));return i.broker}var De,Oe,ke,Ae,je,Me,Ne,Pe=t((()=>{Ce(),De=void 0,Oe=void 0,ke=void 0,Ae=void 0,je={missing:(e,t,n)=>[`${e} was requested, but no plugin was configured or no authentication record was found.`,`You must install the ${t} plugin package (npm install --save ${t})`,"and enable it by importing `useIdentityPlugin` from `@azure/identity` and calling",`useIdentityPlugin(${n}) before using enableBroker.`].join(` `),unavailable:(e,t)=>[`${e} was requested, and the plugin is configured, but the broker is unavailable.`,`Ensure the ${e} plugin is properly installed and configured.`,`Check for missing native dependencies and ensure the package is properly installed.`,`See the README for prerequisites on installing and using ${t}.`].join(` `)},Me={vsCode:{credentialName:`Visual Studio Code Credential`,packageName:`@azure/identity-vscode`,pluginVar:`vsCodePlugin`,get brokerInfo(){return Ae}},native:{credentialName:`Broker for WAM`,packageName:`@azure/identity-broker`,pluginVar:`nativeBrokerPlugin`,get brokerInfo(){return Oe}}},Ne={generatePluginConfiguration:Te}})),Fe=t((()=>{}));function Ie(e){return e&&typeof e.error==`string`&&typeof e.error_description==`string`}function Le(e){return{error:e.error,errorDescription:e.error_description,correlationId:e.correlation_id,errorCodes:e.error_codes,timestamp:e.timestamp,traceId:e.trace_id}}var Re,y,ze,Be,Ve,He,Ue,b=t((()=>{i(),Re=`CredentialUnavailableError`,y=class extends Error{constructor(e,t){super(e,t),this.name=Re}},ze=`AuthenticationError`,Be=class extends Error{constructor(e,t,n){let r={error:`unknown`,errorDescription:`An unknown error occurred and no additional details are available.`};if(Ie(t))r=Le(t);else if(typeof t==`string`)try{r=Le(JSON.parse(t))}catch{r=e===400?{error:`invalid_request`,errorDescription:`The service indicated that the request was invalid.\n\n${t}`}:{error:`unknown_error`,errorDescription:`An unknown error has occurred. Response body:\n\n${t}`}}else r={error:`unknown_error`,errorDescription:`An unknown error occurred and no additional details are available.`};super(`${r.error} Status code: ${e}\nMore details:\n${r.errorDescription},`,n),a(this,`statusCode`,void 0),a(this,`errorResponse`,void 0),this.statusCode=e,this.errorResponse=r,this.name=ze}},Ve=`AggregateAuthenticationError`,He=class extends Error{constructor(e,t){let n=e.join(`
|
|
2
|
+
`);super(`${t}\n${n}`),a(this,`errors`,void 0),this.errors=e,this.name=Ve}},Ue=class extends Error{constructor(e){super(e.message,e.cause?{cause:e.cause}:void 0),a(this,`scopes`,void 0),a(this,`getTokenOptions`,void 0),this.scopes=e.scopes,this.getTokenOptions=e.getTokenOptions,this.name=`AuthenticationRequiredError`}}}));function We(e,...t){h.stderr.write(`${p.format(e,...t)}${ae}`)}var Ge=t((()=>{}));function Ke(e){return h.env[e]}var qe=t((()=>{typeof h.versions.deno==`string`&&h.versions.deno.length,typeof h.versions.bun==`string`&&h.versions.bun.length}));function Je(e){nt=e,rt=[],it=[];let t=e.split(`,`).map(e=>e.trim());for(let e of t)e.startsWith(`-`)?it.push(e.substring(1)):rt.push(e);for(let e of at)e.enabled=Ye(e.namespace)}function Ye(e){if(e.endsWith(`*`))return!0;for(let t of it)if(Xe(e,t))return!1;for(let t of rt)if(Xe(e,t))return!0;return!1}function Xe(e,t){if(t.indexOf(`*`)===-1)return e===t;let n=t;if(t.indexOf(`**`)!==-1){let e=[],r=``;for(let n of t)if(n===`*`&&r===`*`)continue;else r=n,e.push(n);n=e.join(``)}let r=0,i=0,a=n.length,o=e.length,s=-1,c=-1;for(;r<o&&i<a;)if(n[i]===`*`){if(s=i,i++,i===a)return!0;for(;e[r]!==n[i];)if(r++,r===o)return!1;c=r,r++,i++;continue}else if(n[i]===e[r])i++,r++;else if(s>=0){if(i=s+1,r=c+1,r===o)return!1;for(;e[r]!==n[i];)if(r++,r===o)return!1;c=r,r++,i++;continue}else return!1;let l=r===e.length,u=i===n.length,d=i===n.length-1&&n[i]===`*`;return l&&(u||d)}function Ze(){let e=nt||``;return Je(``),e}function Qe(e){let t=Object.assign(n,{enabled:Ye(e),destroy:$e,log:ot.log,namespace:e,extend:et});function n(...n){t.enabled&&(n.length>0&&(n[0]=`${e} ${n[0]}`),t.log(...n))}return at.push(t),t}function $e(){let e=at.indexOf(this);return e>=0?(at.splice(e,1),!0):!1}function et(e){let t=Qe(`${this.namespace}:${e}`);return t.log=this.log,t}var tt,nt,rt,it,at,ot,st=t((()=>{Ge(),qe(),tt=Ke(`DEBUG`),rt=[],it=[],at=[],tt&&Je(tt),ot=Object.assign(e=>Qe(e),{enable:Je,enabled:Ye,disable:Ze,log:We})}));function ct(e,t){t.log=(...t)=>{e.log(...t)}}function lt(e){return ft.includes(e)}function ut(e){let t=new Set,n=Ke(e.logLevelEnvVarName),r,i=ot(e.namespace);i.log=(...e)=>{ot.log(...e)};function a(e){if(e&&!lt(e))throw Error(`Unknown log level '${e}'. Acceptable values: ${ft.join(`,`)}`);r=e;let n=[];for(let e of t)o(e)&&n.push(e.namespace);ot.enable(n.join(`,`))}n&&(lt(n)?a(n):console.error(`${e.logLevelEnvVarName} set to unknown log level '${n}'; logging is not enabled. Acceptable values: ${ft.join(`, `)}.`));function o(e){return!!(r&&pt[e.level]<=pt[r])}function s(e,n){let r=Object.assign(e.extend(n),{level:n});if(ct(e,r),o(r)){let e=ot.disable();ot.enable(e+`,`+r.namespace)}return t.add(r),r}function c(){return r}function l(e){let t=i.extend(e);return ct(i,t),{error:s(t,`error`),warning:s(t,`warning`),info:s(t,`info`),verbose:s(t,`verbose`)}}return{setLogLevel:a,getLogLevel:c,createClientLogger:l,logger:i}}function dt(e){return mt.createClientLogger(e)}var ft,pt,mt,ht=t((()=>{st(),qe(),ft=[`verbose`,`info`,`warning`,`error`],pt={verbose:400,info:300,warning:200,error:100},mt=ut({logLevelEnvVarName:`TYPESPEC_RUNTIME_LOG_LEVEL`,namespace:`typeSpecRuntime`}),mt.logger})),gt=t((()=>{ht()}));function _t(){return yt.getLogLevel()}function vt(e){return yt.createClientLogger(e)}var yt,bt=t((()=>{gt(),yt=ut({logLevelEnvVarName:`AZURE_LOG_LEVEL`,namespace:`azure`}),yt.logger}));function xt(e){return e.reduce((e,t)=>(process.env[t]?e.assigned.push(t):e.missing.push(t),e),{missing:[],assigned:[]})}function St(e){return`SUCCESS. Scopes: ${Array.isArray(e)?e.join(`, `):e}.`}function x(e,t){let n=`ERROR.`;return e?.length&&(n+=` Scopes: ${Array.isArray(e)?e.join(`, `):e}.`),`${n} Error message: ${typeof t==`string`?t:t.message}.`}function Ct(e,t,n=wt){let r=t?`${t.fullTitle} ${e}`:e;function i(e){n.info(`${r} =>`,e)}function a(e){n.warning(`${r} =>`,e)}function o(e){n.verbose(`${r} =>`,e)}function s(e){n.error(`${r} =>`,e)}return{title:e,fullTitle:r,info:i,warning:a,verbose:o,error:s}}function S(e,t=wt){let n=Ct(e,void 0,t);return{...n,parent:t,getToken:Ct(`=> getToken()`,n,t)}}var wt,C=t((()=>{bt(),wt=vt(`identity`)}));function Tt(e={}){let t=new Dt(e.parentContext);return e.span&&(t=t.setValue(Et.span,e.span)),e.namespace&&(t=t.setValue(Et.namespace,e.namespace)),t}var Et,Dt,Ot=t((()=>{i(),Et={span:Symbol.for(`@azure/core-tracing span`),namespace:Symbol.for(`@azure/core-tracing namespace`)},Dt=class e{constructor(t){a(this,`_contextMap`,void 0),this._contextMap=t instanceof e?new Map(t._contextMap):new Map}setValue(t,n){let r=new e(this);return r._contextMap.set(t,n),r}getValue(e){return this._contextMap.get(e)}deleteValue(t){let n=new e(this);return n._contextMap.delete(t),n}}})),kt=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.state=void 0,e.state={instrumenterImplementation:void 0}})),At,jt,Mt=t((()=>{At=kt(),jt=At.state}));function Nt(){return{end:()=>{},isRecording:()=>!1,recordException:()=>{},setAttribute:()=>{},setStatus:()=>{},addEvent:()=>{}}}function Pt(){return{createRequestHeaders:()=>({}),parseTraceparentHeader:()=>{},startSpan:(e,t)=>({span:Nt(),tracingContext:Tt({parentContext:t.tracingContext})}),withContext(e,t,...n){return t(...n)}}}function Ft(){return jt.instrumenterImplementation||(jt.instrumenterImplementation=Pt()),jt.instrumenterImplementation}var It=t((()=>{Ot(),Mt()}));function Lt(e){let{namespace:t,packageName:n,packageVersion:r}=e;function i(e,i,a){let o=Ft().startSpan(e,{...a,packageName:n,packageVersion:r,tracingContext:i?.tracingOptions?.tracingContext}),s=o.tracingContext,c=o.span;return s.getValue(Et.namespace)||(s=s.setValue(Et.namespace,t)),c.setAttribute(`az.namespace`,s.getValue(Et.namespace)),{span:c,updatedOptions:Object.assign({},i,{tracingOptions:{...i?.tracingOptions,tracingContext:s}})}}async function a(e,t,n,r){let{span:a,updatedOptions:s}=i(e,t,r);try{let e=await o(s.tracingOptions.tracingContext,()=>Promise.resolve(n(s,a)));return a.setStatus({status:`success`}),e}catch(e){throw a.setStatus({status:`error`,error:e}),e}finally{a.end()}}function o(e,t,...n){return Ft().withContext(e,t,...n)}function s(e){return Ft().parseTraceparentHeader(e)}function c(e){return Ft().createRequestHeaders(e)}return{startSpan:i,withSpan:a,withContext:o,parseTraceparentHeader:s,createRequestHeaders:c}}var Rt=t((()=>{It(),Ot()})),zt=t((()=>{It(),Rt()})),w,T=t((()=>{Ce(),zt(),w=Lt({namespace:`Microsoft.AAD`,packageName:`@azure/identity`,packageVersion:_e})})),Bt,Vt,Ht=t((()=>{b(),C(),T(),i(),Bt=S(`ChainedTokenCredential`),Vt=class{constructor(...e){a(this,`_sources`,[]),this._sources=e}async getToken(e,t={}){let{token:n}=await this.getTokenInternal(e,t);return n}async getTokenInternal(e,t={}){let n=null,r,i=[];return w.withSpan(`ChainedTokenCredential.getToken`,t,async t=>{for(let a=0;a<this._sources.length&&n===null;a++)try{n=await this._sources[a].getToken(e,t),r=this._sources[a]}catch(t){if(t.name===`CredentialUnavailableError`||t.name===`AuthenticationRequiredError`)i.push(t);else throw Bt.getToken.info(x(e,t)),t}if(!n&&i.length>0){let t=new He(i,`ChainedTokenCredential authentication failed.`);throw Bt.getToken.info(x(e,t)),t}if(Bt.getToken.info(`Result for ${r.constructor.name}: ${St(e)}`),n===null)throw new y(`Failed to retrieve a valid token`);return{token:n,successfulCredential:r}})}}})),Ut,Wt=t((()=>{Ut=class{static serializeJSONBlob(e){return JSON.stringify(e)}static serializeAccounts(e){let t={};return Object.keys(e).map(function(n){let r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,realm:r.realm,local_account_id:r.localAccountId,username:r.username,authority_type:r.authorityType,name:r.name,client_info:r.clientInfo,last_modification_time:r.lastModificationTime,last_modification_app:r.lastModificationApp,tenantProfiles:r.tenantProfiles?.map(e=>JSON.stringify(e))}}),t}static serializeIdTokens(e){let t={};return Object.keys(e).map(function(n){let r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,realm:r.realm}}),t}static serializeAccessTokens(e){let t={};return Object.keys(e).map(function(n){let r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,realm:r.realm,target:r.target,cached_at:r.cachedAt,expires_on:r.expiresOn,extended_expires_on:r.extendedExpiresOn,refresh_on:r.refreshOn,key_id:r.keyId,token_type:r.tokenType,userAssertionHash:r.userAssertionHash,resource:r.resource,additionalCacheKeyComponents:r.additionalCacheKeyComponents}}),t}static serializeRefreshTokens(e){let t={};return Object.keys(e).map(function(n){let r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,family_id:r.familyId,target:r.target,realm:r.realm}}),t}static serializeAppMetadata(e){let t={};return Object.keys(e).map(function(n){let r=e[n];t[n]={client_id:r.clientId,environment:r.environment,family_id:r.familyId}}),t}static serializeAllCache(e){return{Account:this.serializeAccounts(e.accounts),IdToken:this.serializeIdTokens(e.idTokens),AccessToken:this.serializeAccessTokens(e.accessTokens),RefreshToken:this.serializeRefreshTokens(e.refreshTokens),AppMetadata:this.serializeAppMetadata(e.appMetadata)}}}})),Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn=t((()=>{Gt=`client_id`,Kt=`redirect_uri`,qt=`response_type`,Jt=`response_mode`,Yt=`grant_type`,Xt=`claims`,Zt=`scope`,Qt=`refresh_token`,$t=`state`,en=`nonce`,tn=`prompt`,nn=`code`,rn=`code_challenge`,an=`code_challenge_method`,on=`code_verifier`,sn=`client-request-id`,cn=`x-client-SKU`,ln=`x-client-VER`,un=`x-client-OS`,dn=`x-client-CPU`,fn=`x-client-current-telemetry`,pn=`x-client-last-telemetry`,mn=`x-ms-lib-capability`,hn=`x-app-name`,gn=`x-app-ver`,_n=`post_logout_redirect_uri`,vn=`id_token_hint`,yn=`device_code`,bn=`client_secret`,xn=`client_assertion`,Sn=`client_assertion_type`,Cn=`token_type`,wn=`req_cnf`,Tn=`assertion`,En=`requested_token_use`,Dn=`on_behalf_of`,On=`return_spa_code`,kn=`logout_hint`,An=`login_hint`,jn=`domain_hint`,Mn=`x-client-xtra-sku`,Nn=`brk_client_id`,Pn=`brk_redirect_uri`,Fn=`instance_aware`,In=`resource`,Ln=`clidata`,Rn=`user_federated_identity_credential`,zn=`username`,Bn=`user_id`,Vn=`fmi_path`})),Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar,or,sr,cr,lr,E,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,D,br,xr,Sr,Cr,O,wr,Tr,k,Er,Dr,Or,kr,Ar,jr,A,Mr,j=t((()=>{Un=`msal.js.common`,Wn=`https://login.microsoftonline.com/common/`,Gn=`login.microsoftonline.com`,Kn=`common`,qn=`adfs`,Jn=`dstsv2`,Yn=`${Wn}discovery/instance?api-version=1.1&authorization_endpoint=`,Xn=`.ciamlogin.com`,Zn=`.onmicrosoft.com`,Qn=`openid`,$n=`profile`,er=`offline_access`,tr=`email`,nr=`application/x-www-form-urlencoded;charset=utf-8`,rr=`http://169.254.169.254/metadata/instance/compute`,ir=`2021-02-01`,ar=2e3,or=`login.microsoft.com`,sr=[`login.microsoftonline.com`,`login.windows.net`,`login.microsoft.com`,`sts.windows.net`],cr=[Qn,$n,er],lr=[...cr,tr],E={CONTENT_TYPE:`Content-Type`,CONTENT_LENGTH:`Content-Length`,RETRY_AFTER:`Retry-After`,CCS_HEADER:`X-AnchorMailbox`,WWWAuthenticate:`WWW-Authenticate`,AuthenticationInfo:`Authentication-Info`,X_MS_REQUEST_ID:`x-ms-request-id`,X_MS_HTTP_VERSION:`x-ms-httpver`},ur={COMMON:`common`,ORGANIZATIONS:`organizations`,CONSUMERS:`consumers`},dr={ACCESS_TOKEN:`access_token`,XMS_CC:`xms_cc`,ID_TOKEN:`id_token`,SIGNIN_STATE:`signin_state`,LOGIN_HINT:`login_hint`},fr={LOGIN:`login`,SELECT_ACCOUNT:`select_account`,CONSENT:`consent`,NONE:`none`,CREATE:`create`,NO_SESSION:`no_session`},pr={PLAIN:`plain`,S256:`S256`},mr={CODE:`code`,IDTOKEN_TOKEN:`id_token token`,IDTOKEN_TOKEN_REFRESHTOKEN:`id_token token refresh_token`},hr={QUERY:`query`,FRAGMENT:`fragment`,FORM_POST:`form_post`},gr={IMPLICIT_GRANT:`implicit`,AUTHORIZATION_CODE_GRANT:`authorization_code`,CLIENT_CREDENTIALS_GRANT:`client_credentials`,RESOURCE_OWNER_PASSWORD_GRANT:`password`,REFRESH_TOKEN_GRANT:`refresh_token`,DEVICE_CODE_GRANT:`device_code`,JWT_BEARER:`urn:ietf:params:oauth:grant-type:jwt-bearer`,USER_FIC:`user_fic`},_r=`MSSTS`,vr=`ADFS`,yr=`Generic`,D={ID_TOKEN:`IdToken`,ACCESS_TOKEN:`AccessToken`,ACCESS_TOKEN_WITH_AUTH_SCHEME:`AccessToken_With_AuthScheme`,REFRESH_TOKEN:`RefreshToken`},br=`appmetadata`,xr=`client_info`,Sr=`authority-metadata`,Cr=3600*24,O={CONFIG:`config`,CACHE:`cache`,NETWORK:`network`,HARDCODED_VALUES:`hardcoded_values`},wr=`server-telemetry`,Tr=`unknown_error`,k={BEARER:`Bearer`,POP:`pop`,SSH:`ssh-cert`},Er=3600,Dr=`throttling`,Or=`retry-after, h429`,kr={username:`username`,password:`password`},Ar={FAILED_AUTO_DETECTION:`1`,INTERNAL_CACHE:`2`,ENVIRONMENT_VARIABLE:`3`,IMDS:`4`},jr={CONFIGURED_MATCHES_DETECTED:`1`,CONFIGURED_NO_AUTO_DETECTION:`2`,CONFIGURED_NOT_DETECTED:`3`,AUTO_DETECTION_REQUESTED_SUCCESSFUL:`4`,AUTO_DETECTION_REQUESTED_FAILED:`5`},A={NOT_APPLICABLE:`0`,FORCE_REFRESH_OR_CLAIMS:`1`,NO_CACHED_ACCESS_TOKEN:`2`,CACHED_ACCESS_TOKEN_EXPIRED:`3`,PROACTIVELY_REFRESHED:`4`},Mr={BASE64:`base64`,HEX:`hex`,UTF8:`utf-8`}}));function Nr(e){return`See https://aka.ms/msal.js.errors#${e} for details`}function Pr(e,t,n){return new M(e,t,n||Nr(e))}var M,Fr=t((()=>{M=class e extends Error{constructor(t,n,r,i){let a=r||(t?Nr(t):``),o=a?`${t}: ${a}`:t;super(o),Object.setPrototypeOf(this,e.prototype),this.errorCode=t||``,this.errorMessage=a||``,this.subError=i||``,this.correlationId=n,this.name=`AuthError`}}}));function N(e,t,n){return new Ir(e,t,n)}var Ir,P=t((()=>{Fr(),Ir=class e extends M{constructor(t,n,r){super(t,n,r),this.name=`ClientAuthError`,Object.setPrototypeOf(this,e.prototype)}}})),Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,F,ci,li,I=t((()=>{Lr=`client_info_decoding_error`,Rr=`client_info_empty_error`,zr=`token_parsing_error`,Br=`null_or_empty_token`,Vr=`endpoints_resolution_error`,Hr=`network_error`,Ur=`openid_config_error`,Wr=`hash_not_deserialized`,Gr=`invalid_state`,Kr=`state_mismatch`,qr=`nonce_mismatch`,Jr=`multiple_matching_tokens`,Yr=`multiple_matching_appMetadata`,Xr=`request_cannot_be_made`,Zr=`cannot_remove_empty_scope`,Qr=`cannot_append_scopeset`,$r=`empty_input_scopeset`,ei=`no_account_in_silent_request`,ti=`invalid_cache_record`,ni=`invalid_cache_environment`,ri=`no_crypto_object`,ii=`token_refresh_required`,ai=`token_claims_cnf_required_for_signedjwt`,oi=`end_session_endpoint_not_supported`,si=`key_id_missing`,F=`method_not_implemented`,ci=`resource_parameter_required`,li=`misplaced_resource_parameter`}));function ui(e,t){if(!e)throw N(Rr,``);try{let n=t(e);return JSON.parse(n)}catch{throw N(Lr,``)}}function di(e){if(!e)throw N(Lr,``);let t=e.split(`.`,2);return{uid:t[0],utid:t.length<2?``:t[1]}}var fi=t((()=>{P(),j(),I()}));function pi(e,t,n){let r=hi(e,n);try{let e=t(r);return JSON.parse(e)}catch{throw N(zr,n)}}function mi(e){if(!e.signin_state)return!1;let t=[`kmsi`,`dvc_dmjd`];return e.signin_state.some(e=>t.includes(e.trim().toLowerCase()))}function hi(e,t){if(!e)throw N(Br,t);let n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(e);if(!n||n.length<4)throw N(zr,t);return n[2]}var gi=t((()=>{P(),I()}));function _i(e,t){return!!e&&!!t&&e===t.split(`.`)[1]}function vi(e,t,n,r,i){if(i){let{oid:t,sub:n,tid:a,name:o,tfp:s,acr:c,preferred_username:l,upn:u,login_hint:d}=i,f=a||s||c||``;return{tenantId:f,localAccountId:t||n||``,name:o,username:l||u||``,loginHint:d,isHomeTenant:_i(f,e),upn:u,...r&&{nativeAccountId:r}}}else return{tenantId:n,localAccountId:t,username:``,isHomeTenant:_i(n,e),...r&&{nativeAccountId:r}}}function yi(e,t,n,r){let i=e;if(t){let{isHomeTenant:n,...r}=t;i={...e,...r}}if(n){let{isHomeTenant:t,...a}=vi(e.homeAccountId,e.localAccountId,e.tenantId,i.nativeAccountId,n);return i={...i,...a,idTokenClaims:n,idToken:r,kmsi:mi(n)},i}return i}var bi=t((()=>{gi()})),xi,Si=t((()=>{xi={Default:0,Adfs:1,Dsts:2,Ciam:3}}));function Ci(e){return e&&(e.tid||e.tfp||e.acr)||null}var wi=t((()=>{})),Ti,Ei=t((()=>{Ti={AAD:`AAD`,OIDC:`OIDC`,EAR:`EAR`}}));function Di(e){let t=e.tenantProfiles||[];t.length===0&&e.realm&&e.localAccountId&&t.push(vi(e.homeAccountId,e.localAccountId,e.realm,e.nativeAccountId));let n=t.find(t=>t.tenantId===e.realm)?.nativeAccountId||e.nativeAccountId;return{homeAccountId:e.homeAccountId,environment:e.environment,tenantId:e.realm,username:e.username,localAccountId:e.localAccountId,loginHint:e.loginHint,name:e.name,nativeAccountId:n,authorityType:e.authorityType,tenantProfiles:new Map(t.map(e=>[e.tenantId,e])),dataBoundary:e.dataBoundary}}function Oi(e,t,n,r){let i;i=t.authorityType===xi.Adfs?vr:t.protocolMode===Ti.OIDC?yr:_r;let a,o;e.clientInfo&&r&&(a=ui(e.clientInfo,r),a.xms_tdbr&&(o=a.xms_tdbr===`EU`?`EU`:`None`));let s=e.environment||t&&t.getPreferredCache();if(!s)throw N(ni,n);let c=e.idTokenClaims?.preferred_username||e.idTokenClaims?.upn,l=e.idTokenClaims?.emails?e.idTokenClaims.emails[0]:null,u=c||l||``,d=e.idTokenClaims?.login_hint,f=a?.utid||Ci(e.idTokenClaims)||``,p=a?.uid||e.idTokenClaims?.oid||e.idTokenClaims?.sub||``,m;return m=e.tenantProfiles?e.tenantProfiles:[vi(e.homeAccountId,p,f,e.nativeAccountId,e.idTokenClaims)],{homeAccountId:e.homeAccountId,environment:s,realm:f,localAccountId:p,username:u,authorityType:i,loginHint:d,clientInfo:e.clientInfo,name:e.idTokenClaims?.name||``,lastModificationTime:void 0,lastModificationApp:void 0,cloudGraphHostName:e.cloudGraphHostName,msGraphHost:e.msGraphHost,nativeAccountId:e.nativeAccountId,tenantProfiles:m,dataBoundary:o}}function ki(e,t,n,r,i,a){if(!(t===xi.Adfs||t===xi.Dsts)){if(e)try{let t=ui(e,r.base64Decode);if(t.uid&&t.utid)return`${t.uid}.${t.utid}`}catch{}n.warning(`No client info in response`,i)}return a?.sub||``}function Ai(e){return e?e.hasOwnProperty(`homeAccountId`)&&e.hasOwnProperty(`environment`)&&e.hasOwnProperty(`realm`)&&e.hasOwnProperty(`localAccountId`)&&e.hasOwnProperty(`username`)&&e.hasOwnProperty(`authorityType`):!1}var ji=t((()=>{j(),fi(),bi(),P(),Si(),wi(),Ei(),I()})),Mi,Ni=t((()=>{Mi=`post_request_failed`}));function L(e,t){return new Pi(e,t)}var Pi,Fi=t((()=>{Fr(),Pi=class e extends M{constructor(t,n){super(t,n),this.name=`ClientConfigurationError`,Object.setPrototypeOf(this,e.prototype)}}})),Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi=t((()=>{Ii=`redirect_uri_empty`,Li=`authority_uri_insecure`,Ri=`url_parse_error`,zi=`empty_url_error`,Bi=`empty_input_scopes_error`,Vi=`invalid_claims`,Hi=`token_request_empty`,Ui=`logout_request_empty`,Wi=`pkce_params_missing`,Gi=`invalid_cloud_discovery_metadata`,Ki=`invalid_authority_metadata`,qi=`untrusted_authority`,Ji=`missing_ssh_jwk`,Yi=`issuer_validation_failed`,Xi=`invalid_response_mode`}));function Qi(e){return e.hasOwnProperty(`authorization_endpoint`)&&e.hasOwnProperty(`token_endpoint`)&&e.hasOwnProperty(`issuer`)&&e.hasOwnProperty(`jwks_uri`)}var $i=t((()=>{})),ea,ta=t((()=>{ea=class{static isEmptyObj(e){if(e)try{let t=JSON.parse(e);return Object.keys(t).length===0}catch{}return!0}static startsWith(e,t){return e.indexOf(t)===0}static endsWith(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length}static queryStringToObject(e){let t={},n=e.split(`&`),r=e=>decodeURIComponent(e.replace(/\+/g,` `));return n.forEach(e=>{if(e.trim()){let[n,i]=e.split(/=(.+)/g,2);n&&i&&(t[r(n)]=r(i))}}),t}static trimArrayEntries(e){return e.map(e=>e.trim())}static removeEmptyStringsFromArray(e){return e.filter(e=>!!e)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}}})),R,na=t((()=>{Fi(),ta(),j(),Zi(),R=class e{get urlString(){return this._urlString}constructor(t,n){if(this._urlString=t,this.correlationId=n,!this._urlString)throw L(zi,n);t.includes(`#`)||(this._urlString=e.canonicalizeUri(t))}static canonicalizeUri(e){if(e){let t=e.toLowerCase();return ea.endsWith(t,`?`)?t=t.slice(0,-1):ea.endsWith(t,`?/`)&&(t=t.slice(0,-2)),ea.endsWith(t,`/`)||(t+=`/`),t}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw L(Ri,this.correlationId)}if(!e.HostNameAndPort||!e.PathSegments)throw L(Ri,this.correlationId);if(!e.Protocol||e.Protocol.toLowerCase()!==`https:`)throw L(Li,this.correlationId)}static appendQueryString(e,t){return t?e.indexOf(`?`)<0?`${e}?${t}`:`${e}&${t}`:e}static removeHashFromUrl(t){return e.canonicalizeUri(t.split(`#`)[0])}replaceTenantPath(t){let n=this.getUrlComponents(),r=n.PathSegments;return t&&r.length!==0&&(r[0]===ur.COMMON||r[0]===ur.ORGANIZATIONS)&&(r[0]=t),e.constructAuthorityUriFromObject(n,this.correlationId)}getUrlComponents(){let e=RegExp(`^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?`),t=this.urlString.match(e);if(!t)throw L(Ri,this.correlationId);let n={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]},r=n.AbsolutePath.split(`/`);return r=r.filter(e=>e&&e.length>0),n.PathSegments=r,n.QueryString&&n.QueryString.endsWith(`/`)&&(n.QueryString=n.QueryString.substring(0,n.QueryString.length-1)),n}static getDomainFromUrl(e,t){let n=RegExp(`^([^:/?#]+://)?([^/?#]*)`),r=e.match(n);if(!r)throw L(Ri,t);return r[2]}static getAbsoluteUrl(t,n,r){if(t[0]===`/`){let i=new e(n,r).getUrlComponents();return i.Protocol+`//`+i.HostNameAndPort+t}return t}static constructAuthorityUriFromObject(t,n){return new e(t.Protocol+`//`+t.HostNameAndPort+`/`+t.PathSegments.join(`/`),n)}}}));function ra(e,t){return{token_endpoint:`https://${e}/{tenantid}/oauth2/v2.0/token`,jwks_uri:`https://${e}/{tenantid}/discovery/v2.0/keys`,issuer:`https://${t}/{tenantid}/v2.0`,authorization_endpoint:`https://${e}/{tenantid}/oauth2/v2.0/authorize`,end_session_endpoint:`https://${e}/{tenantid}/oauth2/v2.0/logout`}}function ia(e,t,n){let r,i=e.canonicalAuthority;if(i){let a=new R(i,n).getUrlComponents().HostNameAndPort;r=aa(t,n,a,e.cloudDiscoveryMetadata?.metadata,O.CONFIG)||aa(t,n,a,da.metadata,O.HARDCODED_VALUES)||e.knownAuthorities}return r||[]}function aa(e,t,n,r,i){if(e.trace(`getAliasesFromMetadata called with source: '${i}'`,t),n&&r){let a=sa(r,n);if(a)return e.trace(`getAliasesFromMetadata: found cloud discovery metadata in '${i}', returning aliases`,t),a.aliases;e.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in '${i}'`,t)}return null}function oa(e){return sa(da.metadata,e)}function sa(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.aliases.includes(t))return r}return null}var ca,la,ua,da,fa,pa=t((()=>{na(),j(),ca=[{host:`login.microsoftonline.com`},{host:`login.chinacloudapi.cn`,issuerHost:`login.partner.microsoftonline.cn`},{host:`login.microsoftonline.us`},{host:`login.sovcloud-identity.fr`},{host:`login.sovcloud-identity.de`},{host:`login.sovcloud-identity.sg`}],la={endpointMetadata:ca.reduce((e,{host:t,issuerHost:n})=>(e[t]=ra(t,n||t),e),{}),instanceDiscoveryMetadata:{metadata:[{preferred_network:`login.microsoftonline.com`,preferred_cache:`login.windows.net`,aliases:[`login.microsoftonline.com`,`login.windows.net`,`login.microsoft.com`,`sts.windows.net`]},{preferred_network:`login.partner.microsoftonline.cn`,preferred_cache:`login.partner.microsoftonline.cn`,aliases:[`login.partner.microsoftonline.cn`,`login.chinacloudapi.cn`]},{preferred_network:`login.microsoftonline.de`,preferred_cache:`login.microsoftonline.de`,aliases:[`login.microsoftonline.de`]},{preferred_network:`login.microsoftonline.us`,preferred_cache:`login.microsoftonline.us`,aliases:[`login.microsoftonline.us`,`login.usgovcloudapi.net`]},{preferred_network:`login-us.microsoftonline.com`,preferred_cache:`login-us.microsoftonline.com`,aliases:[`login-us.microsoftonline.com`]},{preferred_network:`login.sovcloud-identity.fr`,preferred_cache:`login.sovcloud-identity.fr`,aliases:[`login.sovcloud-identity.fr`]},{preferred_network:`login.sovcloud-identity.de`,preferred_cache:`login.sovcloud-identity.de`,aliases:[`login.sovcloud-identity.de`]},{preferred_network:`login.sovcloud-identity.sg`,preferred_cache:`login.sovcloud-identity.sg`,aliases:[`login.sovcloud-identity.sg`]},{preferred_network:`login.windows-ppe.net`,preferred_cache:`login.windows-ppe.net`,aliases:[`login.windows-ppe.net`,`sts.windows-ppe.net`,`login.microsoft-ppe.com`]}]}},ua=la.endpointMetadata,da=la.instanceDiscoveryMetadata,fa=new Set,da.metadata.forEach(e=>{e.aliases.forEach(e=>{fa.add(e)})})})),ma,ha=t((()=>{ma={None:`none`,AzurePublic:`https://login.microsoftonline.com`,AzurePpe:`https://login.windows-ppe.net`,AzureChina:`https://login.chinacloudapi.cn`,AzureGermany:`https://login.microsoftonline.de`,AzureUsGovernment:`https://login.microsoftonline.us`}}));function ga(e){return e.hasOwnProperty(`tenant_discovery_endpoint`)&&e.hasOwnProperty(`metadata`)}var _a=t((()=>{}));function va(e){return e.hasOwnProperty(`error`)&&e.hasOwnProperty(`error_description`)}var ya=t((()=>{})),ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua=t((()=>{ba=`networkClientSendPostRequestAsync`,xa=`refreshTokenClientExecutePostToTokenEndpoint`,Sa=`authorizationCodeClientExecutePostToTokenEndpoint`,Ca=`refreshTokenClientExecuteTokenRequest`,wa=`refreshTokenClientAcquireToken`,Ta=`refreshTokenClientAcquireTokenWithCachedRefreshToken`,Ea=`refreshTokenClientCreateTokenRequestBody`,Da=`silentFlowClientGenerateResultFromCacheRecord`,Oa=`authClientExecuteTokenRequest`,ka=`authClientCreateTokenRequestBody`,Aa=`updateTokenEndpointAuthority`,ja=`popTokenGenerateCnf`,Ma=`handleServerTokenResponse`,Na=`authorityResolveEndpointsAsync`,Pa=`authorityGetCloudDiscoveryMetadataFromNetwork`,Fa=`authorityUpdateCloudDiscoveryMetadata`,Ia=`authorityGetEndpointMetadataFromNetwork`,La=`authorityUpdateEndpointMetadata`,Ra=`authorityUpdateMetadataWithRegionalInformation`,za=`regionDiscoveryDetectRegion`,Ba=`regionDiscoveryGetRegionFromIMDS`,Va=`regionDiscoveryGetCurrentVersion`,Ha=`cacheManagerGetRefreshToken`})),Wa,z,Ga=t((()=>{Wa=(e,t,n,r,i)=>(...a)=>{n.trace(`Executing function '${t}'`,i);let o=r.startMeasurement(t,i);i&&r.incrementFields({[`ext.${t}CallCount`]:1},i);try{let r=e(...a);return o.end({success:!0}),n.trace(`Returning result from '${t}'`,i),r}catch(e){n.trace(`Error occurred in '${t}'`,i);try{n.trace(JSON.stringify(e),i)}catch{n.trace(`Unable to print error message.`,i)}throw o.end({success:!1},e),e}},z=(e,t,n,r,i)=>(...a)=>{n.trace(`Executing function '${t}'`,i);let o=r.startMeasurement(t,i);return i&&r.incrementFields({[`ext.${t}CallCount`]:1},i),e(...a).then(e=>(n.trace(`Returning result from '${t}'`,i),o.end({success:!0}),e)).catch(e=>{n.trace(`Error occurred in '${t}'`,i);try{n.trace(JSON.stringify(e),i)}catch{n.trace(`Unable to print error message.`,i)}throw o.end({success:!1},e),e})}})),Ka,qa=t((()=>{j(),Ua(),Ga(),Ka=class e{constructor(e,t,n,r){this.networkInterface=e,this.logger=t,this.performanceClient=n,this.correlationId=r}async detectRegion(t,n){let r=t;if(r)n.region_source=Ar.ENVIRONMENT_VARIABLE;else{let t=e.IMDS_OPTIONS;try{let e=await z(this.getRegionFromIMDS.bind(this),Ba,this.logger,this.performanceClient,this.correlationId)(ir,t);if(e.status===200&&(r=e.body?.location,r&&(n.region_source=Ar.IMDS)),e.status===400){let e=await z(this.getCurrentVersion.bind(this),Va,this.logger,this.performanceClient,this.correlationId)(t);if(!e)return n.region_source=Ar.FAILED_AUTO_DETECTION,null;let i=await z(this.getRegionFromIMDS.bind(this),Ba,this.logger,this.performanceClient,this.correlationId)(e,t);i.status===200&&(r=i.body?.location,r&&(n.region_source=Ar.IMDS))}}catch{return n.region_source=Ar.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=Ar.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,t){return this.networkInterface.sendGetRequestAsync(`${rr}?api-version=${e}`,t,ar)}async getCurrentVersion(e){try{let t=await this.networkInterface.sendGetRequestAsync(`${rr}?format=json`,e);return t.status===400&&t.body&&t.body[`newest-versions`]&&t.body[`newest-versions`].length>0?t.body[`newest-versions`][0]:null}catch{return null}}},Ka.IMDS_OPTIONS={headers:{Metadata:`true`}}}));function B(){return Math.round(new Date().getTime()/1e3)}function Ja(e){return e?new Date(Number(e)*1e3):new Date}function Ya(e,t){let n=Number(e)||0;return B()+t>n}function Xa(e){return Number(e)>B()}function Za(e,t){return new Promise(n=>setTimeout(()=>n(t),e))}var Qa=t((()=>{}));function $a(e,t,n,r,i){return{credentialType:D.ID_TOKEN,homeAccountId:e,environment:t,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function eo(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h={homeAccountId:e,credentialType:D.ACCESS_TOKEN,secret:n,cachedAt:B().toString(),expiresOn:o.toString(),extendedExpiresOn:s.toString(),environment:t,clientId:r,realm:i,target:a,tokenType:d||k.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(h.userAssertionHash=f),u&&(h.refreshOn=u.toString()),h.tokenType?.toLowerCase()!==k.BEARER.toLowerCase())switch(h.credentialType=D.ACCESS_TOKEN_WITH_AUTH_SCHEME,h.tokenType){case k.POP:let e=pi(n,c,l);if(!e?.cnf?.kid)throw N(ai,l);h.keyId=e.cnf.kid;break;case k.SSH:h.keyId=p}return m&&Object.keys(m).length>0&&(h.additionalCacheKeyComponents=m),h}function to(e,t,n,r,i,a,o){let s={credentialType:D.REFRESH_TOKEN,homeAccountId:e,environment:t,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return a&&(s.userAssertionHash=a),i&&(s.familyId=i),o&&(s.expiresOn=o.toString()),s}function no(e){return e.hasOwnProperty(`homeAccountId`)&&e.hasOwnProperty(`environment`)&&e.hasOwnProperty(`credentialType`)&&e.hasOwnProperty(`clientId`)&&e.hasOwnProperty(`secret`)}function ro(e){return e?no(e)&&e.hasOwnProperty(`realm`)&&e.hasOwnProperty(`target`)&&(e.credentialType===D.ACCESS_TOKEN||e.credentialType===D.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function io(e){return e?no(e)&&e.hasOwnProperty(`realm`)&&e.credentialType===D.ID_TOKEN:!1}function ao(e){return e?no(e)&&e.credentialType===D.REFRESH_TOKEN:!1}function oo(e,t){let n=e.indexOf(wr)===0,r=!0;return t&&(r=t.hasOwnProperty(`failedRequests`)&&t.hasOwnProperty(`errors`)&&t.hasOwnProperty(`cacheHits`)),n&&r}function so(e,t){let n=!1;e&&(n=e.indexOf(Dr)===0);let r=!0;return t&&(r=t.hasOwnProperty(`throttleTime`)),n&&r}function co({environment:e,clientId:t}){return[br,e,t].join(`-`).toLowerCase()}function lo(e,t){return t?e.indexOf(`appmetadata`)===0&&t.hasOwnProperty(`clientId`)&&t.hasOwnProperty(`environment`):!1}function uo(e,t){return t?e.indexOf(`authority-metadata`)===0&&t.hasOwnProperty(`aliases`)&&t.hasOwnProperty(`preferred_cache`)&&t.hasOwnProperty(`preferred_network`)&&t.hasOwnProperty(`canonical_authority`)&&t.hasOwnProperty(`authorization_endpoint`)&&t.hasOwnProperty(`token_endpoint`)&&t.hasOwnProperty(`issuer`)&&t.hasOwnProperty(`aliasesFromNetwork`)&&t.hasOwnProperty(`endpointsFromNetwork`)&&t.hasOwnProperty(`expiresAt`)&&t.hasOwnProperty(`jwks_uri`):!1}function fo(){return B()+Cr}function po(e,t,n){e.authorization_endpoint=t.authorization_endpoint,e.token_endpoint=t.token_endpoint,e.end_session_endpoint=t.end_session_endpoint,e.issuer=t.issuer,e.endpointsFromNetwork=n,e.jwks_uri=t.jwks_uri}function mo(e,t,n){e.aliases=t.aliases,e.preferred_cache=t.preferred_cache,e.preferred_network=t.preferred_network,e.aliasesFromNetwork=n}function ho(e){return e.expiresAt<=B()}var go=t((()=>{gi(),P(),j(),Qa(),I()}));function _o(e,t){let n=new R(e,t).getUrlComponents().PathSegments.slice(-1)[0]?.toLowerCase();switch(n){case ur.COMMON:case ur.ORGANIZATIONS:case ur.CONSUMERS:return;default:return n}}function vo(e){return e.endsWith(`/`)?e:`${e}/`}function yo(e){let t=e.cloudDiscoveryMetadata,n;if(t)try{n=JSON.parse(t)}catch{throw L(Gi,``)}return{canonicalAuthority:e.authority?vo(e.authority):void 0,knownAuthorities:e.knownAuthorities,cloudDiscoveryMetadata:n}}var bo,xo=t((()=>{Si(),$i(),na(),P(),j(),pa(),Fi(),Ei(),ha(),_a(),ya(),qa(),Fr(),Ua(),Ga(),go(),I(),Zi(),bo=class e{constructor(e,t,n,r,i,a,o,s){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=n,this.authorityOptions=r,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=i,this.performanceClient=o,this.correlationId=a,this.managedIdentity=s||!1,this.regionDiscovery=new Ka(t,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(`.ciamlogin.com`))return xi.Ciam;let t=e.PathSegments;if(t.length)switch(t[0].toLowerCase()){case qn:return xi.Adfs;case Jn:return xi.Dsts}return xi.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new R(e,this.correlationId),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw N(Vr,this.correlationId)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw N(Vr,this.correlationId)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace(`/token`,`/devicecode`));throw N(Vr,this.correlationId)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw N(oi,this.correlationId);return this.replacePath(this.metadata.end_session_endpoint)}else throw N(Vr,this.correlationId)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw N(Vr,this.correlationId)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw N(Vr,this.correlationId)}canReplaceTenant(t){return t.PathSegments.length===1&&!e.reservedTenantDomains.has(t.PathSegments[0])&&this.getAuthorityType(t)===xi.Default&&this.protocolMode!==Ti.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let t=e,n=new R(this.metadata.canonical_authority,this.correlationId).getUrlComponents(),r=n.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((e,i)=>{let a=r[i];if(i===0&&this.canReplaceTenant(n)){let e=new R(this.metadata.authorization_endpoint,this.correlationId).getUrlComponents().PathSegments[0];a!==e&&(this.logger.verbose(`Replacing tenant domain name '${a}' with id '${e}'`,this.correlationId),a=e)}e!==a&&(t=t.replace(`/${a}/`,`/${e}/`))}),this.replaceTenant(t)}get defaultOpenIdConfigurationEndpoint(){let e=this.hostnameAndPort;return this.canonicalAuthority.endsWith(`v2.0/`)||this.authorityType===xi.Adfs||this.protocolMode===Ti.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){let e=this.getCurrentMetadataEntity(),t=await z(this.updateCloudDiscoveryMetadata.bind(this),Fa,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);let n=await z(this.updateEndpointMetadata.bind(this),La,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,t,{source:n}),this.performanceClient?.addFields({cloudDiscoverySource:t,authorityEndpointSource:n},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort,this.correlationId);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:``,token_endpoint:``,end_session_endpoint:``,issuer:``,aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:fo(),jwks_uri:``}),e}updateCachedMetadata(e,t,n){t!==O.CACHE&&n?.source!==O.CACHE&&(e.expiresAt=fo(),e.canonical_authority=this.canonicalAuthority);let r=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache,this.correlationId);this.cacheManager.setAuthorityMetadata(r,e,this.correlationId),this.metadata=e}async updateEndpointMetadata(e){let t=this.updateEndpointMetadataFromLocalSources(e);if(t)return t.source===O.HARDCODED_VALUES&&this.authorityOptions.azureRegionConfiguration?.azureRegion&&t.metadata&&(po(e,await z(this.updateMetadataWithRegionalInformation.bind(this),Ra,this.logger,this.performanceClient,this.correlationId)(t.metadata),!1),e.canonical_authority=this.canonicalAuthority),t.source;let n=await z(this.getEndpointMetadataFromNetwork.bind(this),Ia,this.logger,this.performanceClient,this.correlationId)();if(n)return this.validateIssuer(n.issuer),this.authorityOptions.azureRegionConfiguration?.azureRegion&&(n=await z(this.updateMetadataWithRegionalInformation.bind(this),Ra,this.logger,this.performanceClient,this.correlationId)(n)),po(e,n,!0),O.NETWORK;throw N(Ur,this.defaultOpenIdConfigurationEndpoint,this.correlationId)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose(`Attempting to get endpoint metadata from authority configuration`,this.correlationId);let t=this.getEndpointMetadataFromConfig();if(t)return this.logger.verbose(`Found endpoint metadata in authority configuration`,this.correlationId),po(e,t,!1),{source:O.CONFIG};this.logger.verbose(`Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values.`,this.correlationId);let n=this.getEndpointMetadataFromHardcodedValues();if(n)return po(e,n,!1),{source:O.HARDCODED_VALUES,metadata:n};this.logger.verbose(`Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.`,this.correlationId);let r=ho(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose(`Found endpoint metadata in the cache.`,``),{source:O.CACHE}):(r&&this.logger.verbose(`The metadata entity is expired.`,``),null)}isAuthoritySameType(e){return new R(e.canonical_authority,this.correlationId).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw L(Ki,this.correlationId)}return null}async getEndpointMetadataFromNetwork(){let e={},t=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from '${t}'`,this.correlationId);try{let n=await this.networkInterface.sendGetRequestAsync(t,e);return Qi(n.body)?n.body:(this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration`,this.correlationId),null)}catch(e){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: '${e}'`,this.correlationId),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in ua?ua[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(t){let n=this.authorityOptions.azureRegionConfiguration?.azureRegion;if(n){if(n!==`TryAutoDetect`)return this.regionDiscoveryMetadata.region_outcome=jr.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,e.replaceWithRegionalInformation(t,n,this.correlationId);let r=await z(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),za,this.logger,this.performanceClient,this.correlationId)(this.authorityOptions.azureRegionConfiguration?.environmentRegion,this.regionDiscoveryMetadata);if(r)return this.regionDiscoveryMetadata.region_outcome=jr.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=r,e.replaceWithRegionalInformation(t,r,this.correlationId);this.regionDiscoveryMetadata.region_outcome=jr.AUTO_DETECTION_REQUESTED_FAILED}return t}async updateCloudDiscoveryMetadata(e){let t=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(t)return t;let n=await z(this.getCloudDiscoveryMetadataFromNetwork.bind(this),Pa,this.logger,this.performanceClient,this.correlationId)();if(n)return mo(e,n,!0),O.NETWORK;throw L(qi,this.correlationId)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose(`Attempting to get cloud discovery metadata from authority configuration`,this.correlationId),this.logger.verbosePii(`Known Authorities: '${this.authorityOptions.knownAuthorities||`N/A`}'`,this.correlationId),this.logger.verbosePii(`Authority Metadata: '${this.authorityOptions.authorityMetadata||`N/A`}'`,this.correlationId),this.logger.verbosePii(`Canonical Authority: '${e.canonical_authority||`N/A`}'`,this.correlationId);let t=this.getCloudDiscoveryMetadataFromConfig();if(t)return this.logger.verbose(`Found cloud discovery metadata in authority configuration`,this.correlationId),mo(e,t,!1),O.CONFIG;this.logger.verbose(`Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values.`,this.correlationId);let n=oa(this.hostnameAndPort);if(n)return this.logger.verbose(`Found cloud discovery metadata from hardcoded values.`,this.correlationId),mo(e,n,!1),O.HARDCODED_VALUES;this.logger.verbose(`Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.`,this.correlationId);let r=ho(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose(`Found cloud discovery metadata in the cache.`,``),O.CACHE):(r&&this.logger.verbose(`The metadata entity is expired.`,``),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===xi.Ciam)return this.logger.verbose(`CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host.`,this.correlationId),e.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose(`The cloud discovery metadata has been provided as a network response, in the config.`,this.correlationId);try{this.logger.verbose(`Attempting to parse the cloud discovery metadata.`,this.correlationId);let e=sa(JSON.parse(this.authorityOptions.cloudDiscoveryMetadata).metadata,this.hostnameAndPort);if(this.logger.verbose(`Parsed the cloud discovery metadata.`,``),e)return this.logger.verbose(`There is returnable metadata attached to the parsed cloud discovery metadata.`,this.correlationId),e;this.logger.verbose(`There is no metadata attached to the parsed cloud discovery metadata.`,this.correlationId)}catch{throw this.logger.verbose(`Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.`,this.correlationId),L(Gi,this.correlationId)}}return this.isInKnownAuthorities(this.hostnameAndPort)?(this.logger.verbose(`The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.`,this.correlationId),e.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){let t=`${Yn}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={},r=null;try{let e=await this.networkInterface.sendGetRequestAsync(t,n),i,a;if(ga(e.body))i=e.body,a=i.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: '${i.tenant_discovery_endpoint}'`,this.correlationId);else if(va(e.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: '${e.status}'`,this.correlationId),i=e.body,i.error===`invalid_instance`)return this.logger.error(`The CloudInstanceDiscoveryErrorResponse error is invalid_instance.`,this.correlationId),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is '${i.error}'`,this.correlationId),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is '${i.error_description}'`,this.correlationId),this.logger.warning(`Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network, correlationId) to []`,this.correlationId),a=[]}else return this.logger.error(`AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse`,this.correlationId),null;this.logger.verbose(`Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.`,this.correlationId),r=sa(a,this.hostnameAndPort)}catch(e){if(e instanceof M)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.\nError: '${e.errorCode}'\nError Description: '${e.errorMessage}'`,this.correlationId);else{let t=e;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: '${t.name}'\nError Description: '${t.message}'`,this.correlationId)}return null}return r||(this.logger.warning(`The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request.`,this.correlationId),this.logger.verbose(`Creating custom Authority for custom domain scenario.`,this.correlationId),r=e.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(e){let t=e.toLowerCase();return this.authorityOptions.knownAuthorities.filter(e=>e&&R.getDomainFromUrl(e,this.correlationId).toLowerCase()===t).length>0}static generateAuthority(e,t){let n;if(t&&t.azureCloudInstance!==ma.None){let e=t.tenant?t.tenant:Kn;n=`${t.azureCloudInstance}/${e}/`}return n||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return Gn;if(this.discoveryComplete())return this.metadata.preferred_cache;throw N(Vr,this.correlationId)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return fa.has(e)}validateIssuer(e){if(!e)throw L(Yi,this.correlationId);let t;try{t=new URL(e)}catch{throw L(Yi,this.correlationId)}let n=t.protocol,r=t.host,i=(this.canonicalAuthorityUrlComponents.Protocol||``).toLowerCase(),a=(this.canonicalAuthorityUrlComponents.HostNameAndPort||``).toLowerCase(),o=this.matchesAuthorityOrigin(n,r,i,a),s=n===`https:`&&this.isAliasOfKnownMicrosoftAuthority(r),c=n===`https:`&&this.matchesRegionalMicrosoftHost(r),l=this.matchesCiamTenantPattern(t,a,this.canonicalAuthorityUrlComponents.PathSegments),u=n===`https:`&&this.isInKnownAuthorities(r);if(!(o||s||c||l||u))throw L(Yi,this.correlationId)}matchesAuthorityOrigin(e,t,n,r){return e===n&&t===r}matchesRegionalMicrosoftHost(e){let t=e.indexOf(`.`);if(t>0&&t<e.length-1){let n=e.substring(t+1);return this.isAliasOfKnownMicrosoftAuthority(n)}return!1}matchesCiamTenantPattern(e,t,n){let r=n[0],i=r?r.endsWith(`.onmicrosoft.com`)?r.slice(0,-Zn.length):r:t.split(`.`)[0];if(!i)return!1;let a=`https://${i}${Xn}`,o=[a,`${a}/${i}`,`${a}/${i}/v2.0`,`${a}/${i}${Zn}`,`${a}/${i}${Zn}/v2.0`],s=e.pathname.replace(/\/+$/,``),c=`${e.protocol}//${e.host}${s}`;return o.some(e=>e===c)}static isPublicCloudAuthority(e){return sr.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,n,r){let i=new R(e,n);i.validateAsUri();let a=i.getUrlComponents(),o=`${t}.${a.HostNameAndPort}`;this.isPublicCloudAuthority(a.HostNameAndPort)&&(o=`${t}.${or}`);let s=R.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:o},n).urlString;return r?`${s}?${r}`:s}static replaceWithRegionalInformation(t,n,r){let i={...t};return i.authorization_endpoint=e.buildRegionalAuthorityString(i.authorization_endpoint,n,r),i.token_endpoint=e.buildRegionalAuthorityString(i.token_endpoint,n,r),i.end_session_endpoint&&(i.end_session_endpoint=e.buildRegionalAuthorityString(i.end_session_endpoint,n,r)),i}static transformCIAMAuthority(e,t){let n=e,r=new R(e,t).getUrlComponents();if(r.PathSegments.length===0&&r.HostNameAndPort.endsWith(`.ciamlogin.com`)){let e=r.HostNameAndPort.split(`.`)[0];n=`${n}${e}${Zn}`}return n}},bo.reservedTenantDomains=new Set([`{tenant}`,`{tenantid}`,ur.COMMON,ur.CONSUMERS,ur.ORGANIZATIONS])}));async function So(e,t,n,r,i,a,o){let s=new bo(bo.transformCIAMAuthority(vo(e),a),t,n,r,i,a,o);try{return await z(s.resolveEndpointsAsync.bind(s),Na,i,o,a)(),s}catch{throw N(Vr,a)}}var Co=t((()=>{xo(),P(),Ua(),Ga(),I()})),V,wo=t((()=>{Fi(),ta(),P(),j(),Zi(),I(),V=class e{constructor(e,t){this.correlationId=t;let n=e?ea.trimArrayEntries([...e]):[],r=n?ea.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw L(Bi,t);this.scopes=new Set,r.forEach(e=>this.scopes.add(e))}static fromString(t,n){let r=(t||``).split(` `);return new e(r,n)}static createSearchScopes(t,n){let r=t&&t.length>0?t:[...cr],i=new e(r,n);return i.containsOnlyOIDCScopes()?i.removeScope(er):i.removeOIDCScopes(),i}containsScope(t){let n=this.printScopesLowerCase().split(` `),r=new e(n,this.correlationId);return t?r.scopes.has(t.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(e=>this.containsScope(e))}containsOnlyOIDCScopes(){let e=0;return lr.forEach(t=>{this.containsScope(t)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(e=>this.appendScope(e))}catch{throw N(Qr,this.correlationId)}}removeScope(e){if(!e)throw N(Zr,this.correlationId);this.scopes.delete(e.trim())}removeOIDCScopes(){lr.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw N($r,this.correlationId);let t=new Set;return e.scopes.forEach(e=>t.add(e.toLowerCase())),this.scopes.forEach(e=>t.add(e.toLowerCase())),t}intersectingScopeSets(e){if(!e)throw N($r,this.correlationId);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();let t=this.unionScopeSets(e),n=e.getScopeCount(),r=this.getScopeCount();return t.size<r+n}getScopeCount(){return this.scopes.size}asArray(){let e=[];return this.scopes.forEach(t=>e.push(t)),e}printScopes(){return this.scopes?this.asArray().join(` `):``}printScopesLowerCase(){return this.printScopes().toLowerCase()}}}));function To(e,t,n){if(!t)return;let r=e.get(Gt);r&&e.has(`brk_client_id`)&&n?.addFields({embeddedClientId:r,embeddedRedirectUri:e.get(Kt)},t)}function Eo(e,t){e.set(qt,t)}function Do(e,t){e.set(Jt,t||hr.QUERY)}function Oo(e,t,n,r=!0,i=cr){r&&!i.includes(`openid`)&&!t.includes(`openid`)&&i.push(`openid`);let a=new V(r?[...t||[],...i]:t||[],n);e.set(Zt,a.printScopes())}function ko(e,t){e.set(Gt,t)}function Ao(e,t){e.set(Kt,t)}function jo(e,t){e.set(_n,t)}function Mo(e,t){e.set(vn,t)}function No(e,t){e.set(jn,t)}function Po(e,t){e.set(An,t)}function Fo(e,t){e.set(E.CCS_HEADER,`UPN:${t}`)}function Io(e,t){e.set(E.CCS_HEADER,`Oid:${t.uid}@${t.utid}`)}function Lo(e,t){e.set(`sid`,t)}function Ro(e,t,n,r,i){let a=os(n,i&&e.has(`brk_client_id`)?void 0:r,t);e.set(Xt,a)}function zo(e,t){e.set(sn,t)}function Bo(e,t){e.set(cn,t.sku),e.set(ln,t.version),t.os&&e.set(un,t.os),t.cpu&&e.set(dn,t.cpu)}function Vo(e,t){t?.appName&&e.set(hn,t.appName),t?.appVersion&&e.set(gn,t.appVersion)}function Ho(e,t){e.set(tn,t)}function Uo(e,t){t&&e.set($t,t)}function Wo(e,t){e.set(en,t)}function Go(e,t,n){if(t&&n)e.set(rn,t),e.set(an,n);else throw L(Wi,``)}function Ko(e,t){e.set(nn,t)}function qo(e,t){e.set(yn,t)}function Jo(e,t){e.set(Qt,t)}function Yo(e,t){e.set(on,t)}function Xo(e,t){e.set(bn,t)}function Zo(e,t){t&&e.set(xn,t)}function Qo(e,t){t&&e.set(Sn,t)}function $o(e,t){e.set(Tn,t)}function es(e,t){e.set(En,t)}function ts(e,t){e.set(Yt,t)}function ns(e){e.set(xr,`1`)}function rs(e){e.set(Ln,`1`)}function is(e){e.has(`instance_aware`)||e.set(Fn,`true`)}function as(e,t){Object.entries(t).forEach(([t,n])=>{!e.has(t)&&n&&e.set(t,n)})}function os(e,t,n=``){let r;if(!e)r={};else try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`Claims must be a JSON object`);r=t}catch{throw L(Vi,n)}Object.prototype.hasOwnProperty.call(r,dr.ID_TOKEN)||(r[dr.ID_TOKEN]={});let i=r[dr.ID_TOKEN];for(let[e,t]of Object.entries(gs))e in i||(i[e]=t);return t&&t.length>0&&(Object.prototype.hasOwnProperty.call(r,dr.ACCESS_TOKEN)||(r[dr.ACCESS_TOKEN]={}),r[dr.ACCESS_TOKEN][dr.XMS_CC]={values:t}),JSON.stringify(r)}function ss(e,t){e.set(kr.username,t)}function cs(e,t){e.set(kr.password,t)}function ls(e,t){t&&(e.set(Cn,k.POP),e.set(wn,t))}function us(e,t){t&&(e.set(Cn,k.SSH),e.set(wn,t))}function ds(e,t){e.set(fn,t.generateCurrentRequestHeaderValue()),e.set(pn,t.generateLastRequestHeaderValue())}function fs(e){e.set(mn,Or)}function ps(e,t){e.set(kn,t)}function ms(e,t,n){e.has(`brk_client_id`)||e.set(Nn,t),e.has(`brk_redirect_uri`)||e.set(Pn,n)}function hs(e,t){t&&e.set(In,t)}var gs,_s=t((()=>{j(),Hn(),wo(),Fi(),Zi(),gs={[dr.SIGNIN_STATE]:{essential:!1},[dr.LOGIN_HINT]:{essential:!1}}}));function vs(e){return e.startsWith(`#/`)?e.substring(2):e.startsWith(`#`)||e.startsWith(`?`)?e.substring(1):e}function ys(e){if(!e||e.indexOf(`=`)<0)return null;try{let t=vs(e),n=Object.fromEntries(new URLSearchParams(t));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw N(Wr,``)}return null}function H(e){let t=[];return e.forEach((e,n)=>{t.push(`${n}=${encodeURIComponent(e)}`)}),t.join(`&`)}var bs=t((()=>{P(),I()})),xs,Ss=t((()=>{P(),I(),xs={createNewGuid:()=>{throw N(F,``)},base64Decode:()=>{throw N(F,``)},base64Encode:()=>{throw N(F,``)},base64UrlEncode:()=>{throw N(F,``)},encodeKid:()=>{throw N(F,``)},async getPublicKeyThumbprint(){throw N(F,``)},async removeTokenBindingKey(){throw N(F,``)},async clearKeystore(){throw N(F,``)},async signJwt(){throw N(F,``)},async hashString(){throw N(F,``)}}}));function Cs(e,t){Os.delete(e),Os.set(e,t)}function ws(e,t){let n=Date.now(),r=Os.get(e);if(r)Cs(e,r);else if(r={logs:[],firstEventTime:n},Os.set(e,r),Os.size>Es){let e=Os.keys().next().value;e!==void 0&&Os.delete(e)}r.logs.push({...t,milliseconds:n-r.firstEventTime}),r.logs.length>Ds&&r.logs.shift()}function Ts(e){if(e.length<6||e.length>6&&e[6]!==` `)return null;for(let t=0;t<6;t++){let n=e[t];if(!(n>=`a`&&n<=`z`||n>=`A`&&n<=`Z`||n>=`0`&&n<=`9`))return null}return e.substring(0,6)}var U,Es,Ds,Os,ks,As=t((()=>{(function(e){e[e.Error=0]=`Error`,e[e.Warning=1]=`Warning`,e[e.Info=2]=`Info`,e[e.Verbose=3]=`Verbose`,e[e.Trace=4]=`Trace`})(U||(U={})),Es=50,Ds=500,Os=new Map,ks=class e{constructor(t,n,r){this.level=U.Info;let i=()=>{},a=t||e.createDefaultLoggerOptions();this.localCallback=a.loggerCallback||i,this.piiLoggingEnabled=a.piiLoggingEnabled||!1,this.level=typeof a.logLevel==`number`?a.logLevel:U.Info,this.packageName=n||``,this.packageVersion=r||``}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:U.Info}}clone(t,n){return new e({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level},t,n)}logMessage(e,t){let n=t.correlationId,r=Ts(e);if(r&&ws(n,{hash:r,level:t.logLevel,containsPii:t.containsPii||!1,milliseconds:0}),t.logLevel>this.level||!this.piiLoggingEnabled&&t.containsPii)return;let i=`${`[${new Date().toUTCString()}] : [${n}]`} : ${this.packageName}@${this.packageVersion} : ${U[t.logLevel]} - ${e}`;this.executeCallback(t.logLevel,i,t.containsPii||!1)}executeCallback(e,t,n){this.localCallback&&this.localCallback(e,t,n)}error(e,t){this.logMessage(e,{logLevel:U.Error,containsPii:!1,correlationId:t})}errorPii(e,t){this.logMessage(e,{logLevel:U.Error,containsPii:!0,correlationId:t})}warning(e,t){this.logMessage(e,{logLevel:U.Warning,containsPii:!1,correlationId:t})}warningPii(e,t){this.logMessage(e,{logLevel:U.Warning,containsPii:!0,correlationId:t})}info(e,t){this.logMessage(e,{logLevel:U.Info,containsPii:!1,correlationId:t})}infoPii(e,t){this.logMessage(e,{logLevel:U.Info,containsPii:!0,correlationId:t})}verbose(e,t){this.logMessage(e,{logLevel:U.Verbose,containsPii:!1,correlationId:t})}verbosePii(e,t){this.logMessage(e,{logLevel:U.Verbose,containsPii:!0,correlationId:t})}trace(e,t){this.logMessage(e,{logLevel:U.Trace,containsPii:!1,correlationId:t})}tracePii(e,t){this.logMessage(e,{logLevel:U.Trace,containsPii:!0,correlationId:t})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}})),js,Ms,Ns=t((()=>{js=`@azure/msal-common`,Ms=`16.11.1`})),Ps,Fs,Is=t((()=>{Ps=`cache_quota_exceeded`,Fs=`cache_error_unknown`}));function Ls(e){return e instanceof Error?e.name===`QuotaExceededError`||e.name===`NS_ERROR_DOM_QUOTA_REACHED`||e.message.includes(`exceeded the quota`)?new Rs(Ps):new Rs(e.name,e.message):new Rs(Fs)}var Rs,zs=t((()=>{Is(),Fr(),Rs=class e extends Error{constructor(t,n){let r=n||Nr(t);super(r),Object.setPrototypeOf(this,e.prototype),this.name=`CacheError`,this.errorCode=t,this.errorMessage=r}}})),Bs,Vs,Hs=t((()=>{bi(),gi(),pa(),Fr(),zs(),P(),Ns(),wo(),j(),ji(),I(),Bs=class{constructor(e,t,n,r,i){this.clientId=e,this.cryptoImpl=t,this.commonLogger=n.clone(js,Ms),this.staticAuthorityOptions=i,this.performanceClient=r}getAllAccounts(e={},t){return this.buildTenantProfiles(this.getAccountsFilteredBy(e,t),t,e)}getAccountInfoFilteredBy(e,t){if(Object.keys(e).length===0||Object.values(e).every(e=>e==null||e===``))return this.commonLogger.warning(`getAccountInfoFilteredBy: Account filter is empty or invalid, returning null`,t),null;let n=this.getAllAccounts(e,t);return n.length>1?n.sort((e,t)=>{let n=+!!e.idTokenClaims;return+!!t.idTokenClaims-n})[0]:n.length===1?n[0]:null}getBaseAccountInfo(e,t){let n=this.getAccountsFilteredBy(e,t);return n.length>0?Di(n[0]):null}buildTenantProfiles(e,t,n){return e.flatMap(e=>this.getTenantProfilesFromAccountEntity(e,t,n?.tenantId,n))}getTenantedAccountInfoByFilter(e,t,n,r,i){let a=null,o;if(i&&!this.tenantProfileMatchesFilter(n,i))return null;let s=this.getIdToken(e,r,t,n.tenantId);return s&&(o=pi(s.secret,this.cryptoImpl.base64Decode,r),!this.idTokenClaimsMatchTenantProfileFilter(o,i))?null:(a=yi(e,n,o,s?.secret),a)}getTenantProfilesFromAccountEntity(e,t,n,r){let i=Di(e),a=i.tenantProfiles||new Map,o=this.getTokenKeys();if(n){let e=a.get(n);if(e)a=new Map([[n,e]]);else return[]}let s=[];return a.forEach(e=>{let n=this.getTenantedAccountInfoByFilter(i,o,e,t,r);n&&s.push(n)}),s}tenantProfileMatchesFilter(e,t){return!(t.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,t.localAccountId)||t.name&&e.name!==t.name||t.isHomeTenant!==void 0&&e.isHomeTenant!==t.isHomeTenant||t.username&&!this.matchUsername(e.username,t.username)&&!this.matchUsername(e.upn,t.username)||t.loginHint&&!this.matchLoginHintWithTenantProfile(e,t.loginHint)||t.upn&&e.upn!==t.upn||t.nativeAccountId&&e.nativeAccountId!==t.nativeAccountId)}idTokenClaimsMatchTenantProfileFilter(e,t){return!(t&&(t.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,t.localAccountId)||t.loginHint&&!this.matchLoginHintFromTokenClaims(e,t.loginHint)||t.username&&!this.matchUsername(e.preferred_username,t.username)&&!this.matchUsername(e.upn,t.username)||t.name&&!this.matchName(e,t.name)||t.sid&&!this.matchSid(e,t.sid)))}async saveCacheRecord(e,t,n,r,i){if(!e)throw N(ti,t);try{e.account&&await this.setAccount(e.account,t,n,r),e.idToken&&i?.idToken!==!1&&await this.setIdTokenCredential(e.idToken,t,n),e.accessToken&&i?.accessToken!==!1&&await this.saveAccessToken(e.accessToken,t,n),e.refreshToken&&i?.refreshToken!==!1&&await this.setRefreshTokenCredential(e.refreshToken,t,n),e.appMetadata&&this.setAppMetadata(e.appMetadata,t)}catch(e){throw this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`,t),e instanceof M?e:Ls(e)}}async saveAccessToken(e,t,n){let r={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType},i=this.getTokenKeys(),a=V.fromString(e.target,t);i.accessToken.forEach(e=>{if(!this.accessTokenKeyMatchesFilter(e,r,!1))return;let n=this.getAccessTokenCredential(e,t);n&&this.credentialMatchesFilter(n,r,t)&&V.fromString(n.target,t).intersectingScopeSets(a)&&this.removeAccessToken(e,t)}),await this.setAccessTokenCredential(e,t,n)}getAccountsFilteredBy(e,t){let n=this.getAccountKeys(),r=[];return n.forEach(n=>{let i=this.getAccount(n,t);if(!i||e.homeAccountId&&!this.matchHomeAccountId(i,e.homeAccountId)||e.environment&&!this.matchEnvironment(i,e.environment,t)||e.realm&&!this.matchRealm(i,e.realm)||e.authorityType&&!this.matchAuthorityType(i,e.authorityType))return;let a={localAccountId:e?.localAccountId,name:e?.name,username:e?.username,loginHint:e?.loginHint,upn:e?.upn,nativeAccountId:e?.nativeAccountId},o=i.tenantProfiles?.filter(e=>this.tenantProfileMatchesFilter(e,a));o&&o.length===0||r.push(i)}),r}credentialMatchesFilter(e,t,n){if(t.clientId&&!this.matchClientId(e,t.clientId)||t.userAssertionHash&&!this.matchUserAssertionHash(e,t.userAssertionHash)||typeof t.homeAccountId==`string`&&!this.matchHomeAccountId(e,t.homeAccountId)||t.environment&&!this.matchEnvironment(e,t.environment,n)||t.realm&&!this.matchRealm(e,t.realm)||t.credentialType&&!this.matchCredentialType(e,t.credentialType)||t.familyId&&!this.matchFamilyId(e,t.familyId)||t.target&&!this.matchTarget(e,t.target,n)||e.credentialType===D.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(t.tokenType&&!this.matchTokenType(e,t.tokenType)||t.tokenType===k.SSH&&t.keyId&&!this.matchKeyId(e,t.keyId)))return!1;let r=e.additionalCacheKeyComponents,i=t.additionalCacheKeyComponents,a=!!r&&Object.keys(r).length>0,o=!!i&&Object.keys(i).length>0;if(a!==o)return!1;if(a&&o){let e=Object.keys(r).sort(),t=Object.keys(i).sort();if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n]||r[e[n]]!==i[t[n]])return!1}return!0}getAppMetadataFilteredBy(e,t){let n=this.getKeys(),r={};return n.forEach(n=>{if(!this.isAppMetadata(n))return;let i=this.getAppMetadata(n,t);i&&(e.environment&&!this.matchEnvironment(i,e.environment,t)||e.clientId&&!this.matchClientId(i,e.clientId)||(r[n]=i))}),r}getAuthorityMetadataByAlias(e,t){let n=this.getAuthorityMetadataKeys(),r=null;return n.forEach(n=>{if(!this.isAuthorityMetadata(n)||n.indexOf(this.clientId)===-1)return;let i=this.getAuthorityMetadata(n,t);i&&i.aliases.indexOf(e)!==-1&&(r=i)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(t=>{this.removeAccount(t,e)})}removeAccount(e,t){this.removeAccountContext(e,t),this.getAccountKeys().filter(t=>t.includes(e.homeAccountId)&&t.includes(e.environment)).forEach(e=>{this.removeItem(e,t),this.performanceClient.incrementFields({accountsRemoved:1},t)})}removeAccountContext(e,t){let n=this.getTokenKeys(),r=t=>t.includes(e.homeAccountId)&&t.includes(e.environment);n.idToken.filter(r).forEach(e=>{this.removeIdToken(e,t)}),n.accessToken.filter(r).forEach(e=>{this.removeAccessToken(e,t)}),n.refreshToken.filter(r).forEach(e=>{this.removeRefreshToken(e,t)})}removeAccessToken(e,t){let n=this.getAccessTokenCredential(e,t);if(n&&(this.removeItem(e,t),this.performanceClient.incrementFields({accessTokensRemoved:1},t),n.credentialType.toLowerCase()===D.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()&&n.tokenType===k.POP)){let e=n.keyId;e&&this.cryptoImpl.removeTokenBindingKey(e,t).catch(()=>{this.commonLogger.error(`Failed to remove token binding key '${e}'`,t),this.performanceClient?.incrementFields({removeTokenBindingKeyFailure:1},t)})}}removeAppMetadata(e){return this.getKeys().forEach(t=>{this.isAppMetadata(t)&&this.removeItem(t,e)}),!0}getIdToken(e,t,n,r){this.commonLogger.trace(`CacheManager - getIdToken called`,t);let i={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:D.ID_TOKEN,clientId:this.clientId,realm:r},a=this.getIdTokensByFilter(i,t,n),o=a.size;if(o<1)return this.commonLogger.info(`CacheManager:getIdToken - No token found`,t),null;if(o>1){let n=a;if(!r){let r=new Map;a.forEach((t,n)=>{t.realm===e.tenantId&&r.set(n,t)});let i=r.size;if(i<1)return this.commonLogger.info(`CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result`,t),a.values().next().value??null;if(i===1)return this.commonLogger.info(`CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile`,t),r.values().next().value??null;n=r}return this.commonLogger.info(`CacheManager:getIdToken - Multiple matching ID tokens found, clearing them`,t),n.forEach((e,n)=>{this.removeIdToken(n,t)}),this.performanceClient.addFields({multiMatchedID:a.size},t),null}return this.commonLogger.info(`CacheManager:getIdToken - Returning ID token`,t),a.values().next().value??null}getIdTokensByFilter(e,t,n){let r=n&&n.idToken||this.getTokenKeys().idToken,i=new Map;return r.forEach(n=>{if(!this.idTokenKeyMatchesFilter(n,{clientId:this.clientId,...e}))return;let r=this.getIdTokenCredential(n,t);r&&this.credentialMatchesFilter(r,e,t)&&i.set(n,r)}),i}idTokenKeyMatchesFilter(e,t){let n=e.toLowerCase();return!(t.clientId&&n.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&n.indexOf(t.homeAccountId.toLowerCase())===-1)}removeIdToken(e,t){this.removeItem(e,t)}removeRefreshToken(e,t){this.removeItem(e,t)}getAccessToken(e,t,n,r){let i=t.correlationId;this.commonLogger.trace(`CacheManager - getAccessToken called`,i);let a=V.createSearchScopes(t.scopes,i),o=t.authenticationScheme||k.BEARER,s=o&&o.toLowerCase()!==k.BEARER.toLowerCase()?D.ACCESS_TOKEN_WITH_AUTH_SCHEME:D.ACCESS_TOKEN,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:s,clientId:this.clientId,realm:r||e.tenantId,target:a,tokenType:o,keyId:t.sshKid},l=n&&n.accessToken||this.getTokenKeys().accessToken,u=[];l.forEach(e=>{if(this.accessTokenKeyMatchesFilter(e,c,!0)){let t=this.getAccessTokenCredential(e,i);t&&this.credentialMatchesFilter(t,c,i)&&u.push(t)}});let d=u.length;return d<1?(this.commonLogger.info(`CacheManager:getAccessToken - No token found`,i),null):d>1?(this.commonLogger.info(`CacheManager:getAccessToken - Multiple access tokens found, clearing them`,i),u.forEach(e=>{this.removeAccessToken(this.generateCredentialKey(e),i)}),this.performanceClient.addFields({multiMatchedAT:u.length},i),null):(this.commonLogger.info(`CacheManager:getAccessToken - Returning access token`,i),u[0])}accessTokenKeyMatchesFilter(e,t,n){let r=e.toLowerCase();if(t.clientId&&r.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&r.indexOf(t.homeAccountId.toLowerCase())===-1||t.realm&&r.indexOf(t.realm.toLowerCase())===-1)return!1;if(t.target){let e=t.target.asArray();for(let t=0;t<e.length;t++)if(n&&!r.includes(e[t].toLowerCase()))return!1;else if(!n&&r.includes(e[t].toLowerCase()))return!0}return!0}getAccessTokensByFilter(e,t){let n=this.getTokenKeys(),r=[];return n.accessToken.forEach(n=>{if(!this.accessTokenKeyMatchesFilter(n,e,!0))return;let i=this.getAccessTokenCredential(n,t);i&&this.credentialMatchesFilter(i,e,t)&&r.push(i)}),r}getRefreshToken(e,t,n,r){this.commonLogger.trace(`CacheManager - getRefreshToken called`,n);let i=t?`1`:void 0,a={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:D.REFRESH_TOKEN,clientId:this.clientId,familyId:i},o=r&&r.refreshToken||this.getTokenKeys().refreshToken,s=[];o.forEach(e=>{if(this.refreshTokenKeyMatchesFilter(e,a)){let t=this.getRefreshTokenCredential(e,n);t&&this.credentialMatchesFilter(t,a,n)&&s.push(t)}});let c=s.length;return c<1?(this.commonLogger.info(`CacheManager:getRefreshToken - No refresh token found.`,n),null):(c>1&&this.performanceClient.addFields({multiMatchedRT:c},n),this.commonLogger.info(`CacheManager:getRefreshToken - returning refresh token`,n),s[0])}refreshTokenKeyMatchesFilter(e,t){let n=e.toLowerCase();return!(t.familyId&&n.indexOf(t.familyId.toLowerCase())===-1||!t.familyId&&t.clientId&&n.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&n.indexOf(t.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e,t){let n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n,t),i=Object.keys(r).map(e=>r[e]),a=i.length;if(a<1)return null;if(a>1)throw N(Yr,t);return i[0]}isAppMetadataFOCI(e,t){let n=this.readAppMetadataFromCache(e,t);return!!(n&&n.familyId===`1`)}matchHomeAccountId(e,t){return typeof e.homeAccountId==`string`&&t===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,t){return t===(e.oid||e.sub)}matchLocalAccountIdFromTenantProfile(e,t){return e.localAccountId===t}matchName(e,t){return t.toLowerCase()===e.name?.toLowerCase()}matchUsername(e,t){return!!(e&&typeof e==`string`&&t?.toLowerCase()===e.toLowerCase())}matchLoginHintWithTenantProfile(e,t){return e.loginHint===t||e.username===t||e.upn===t}matchUserAssertionHash(e,t){return!!(e.userAssertionHash&&t===e.userAssertionHash)}matchEnvironment(e,t,n){if(this.staticAuthorityOptions){let r=ia(this.staticAuthorityOptions,this.commonLogger,n);if(r.includes(t)&&r.includes(e.environment))return!0}let r=this.getAuthorityMetadataByAlias(t,n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,t){return!!(e.clientId&&t===e.clientId)}matchFamilyId(e,t){return!!(e.familyId&&t===e.familyId)}matchRealm(e,t){return e.realm?.toLowerCase()===t.toLowerCase()}matchLoginHintFromTokenClaims(e,t){return!!(e.login_hint===t||e.preferred_username===t||e.upn===t||e.emails&&e.emails.includes(t))}matchSid(e,t){return e.sid===t}matchAuthorityType(e,t){return!!(e.authorityType&&t.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,t,n){return e.credentialType!==D.ACCESS_TOKEN&&e.credentialType!==D.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:V.fromString(e.target,n).containsScopeSet(t)}matchTokenType(e,t){return!!(e.tokenType&&e.tokenType===t)}matchKeyId(e,t){return!!(e.keyId&&e.keyId===t)}isAppMetadata(e){return e.indexOf(br)!==-1}isAuthorityMetadata(e){return e.indexOf(Sr)!==-1}generateAuthorityMetadataCacheKey(e){return`${Sr}-${this.clientId}-${e}`}static toObject(e,t){for(let n in t)e[n]=t[n];return e}},Vs=class extends Bs{async setAccount(){throw N(F,``)}getAccount(){throw N(F,``)}async setIdTokenCredential(){throw N(F,``)}getIdTokenCredential(){throw N(F,``)}async setAccessTokenCredential(){throw N(F,``)}getAccessTokenCredential(){throw N(F,``)}async setRefreshTokenCredential(){throw N(F,``)}getRefreshTokenCredential(){throw N(F,``)}setAppMetadata(){throw N(F,``)}getAppMetadata(){throw N(F,``)}setServerTelemetry(){throw N(F,``)}getServerTelemetry(){throw N(F,``)}setAuthorityMetadata(){throw N(F,``)}getAuthorityMetadata(){throw N(F,``)}getAuthorityMetadataKeys(){throw N(F,``)}setThrottlingCache(){throw N(F,``)}getThrottlingCache(){throw N(F,``)}removeItem(){throw N(F,``)}getKeys(){throw N(F,``)}getAccountKeys(){throw N(F,``)}getTokenKeys(){throw N(F,``)}generateCredentialKey(){throw N(F,``)}generateAccountKey(){throw N(F,``)}}})),Us,Ws=t((()=>{Us={NotStarted:0,InProgress:1,Completed:2}})),Gs,Ks=t((()=>{Ws(),Gs=class{generateId(){return`callback-id`}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:Us.InProgress,authority:``,libraryName:``,libraryVersion:``,clientId:``,name:e,startTimeMs:Date.now(),correlationId:t||``}}}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return``}emitEvents(){}addFields(){}addGlobalFields(){}incrementFields(){}cacheEventByCorrelationId(){}}}));function qs({authOptions:e,systemOptions:t,loggerOptions:n,storageInterface:r,networkInterface:i,cryptoInterface:a,clientCredentials:o,libraryInfo:s,telemetry:c,serverTelemetryManager:l,persistencePlugin:u,serializableCache:d}){let f={...Zs,...n};return{authOptions:Js(e),systemOptions:{...Xs,...t},loggerOptions:f,storageInterface:r||new Vs(e.clientId,xs,new ks(f,`@azure/msal-common`,`16.11.1`),new Gs),networkInterface:i||Qs,cryptoInterface:a||xs,clientCredentials:o||ec,libraryInfo:{...$s,...s},telemetry:{...nc,...c},serverTelemetryManager:l||null,persistencePlugin:u||null,serializableCache:d||null}}function Js(e){return{clientCapabilities:[],azureCloudOptions:tc,instanceAware:!1,isMcp:!1,...e}}function Ys(e){return e.authOptions.authority.options.protocolMode===Ti.OIDC}var Xs,Zs,Qs,$s,ec,tc,nc,rc=t((()=>{Ss(),As(),j(),Ns(),ha(),Hs(),Ei(),P(),Ks(),I(),Xs={tokenRenewalOffsetSeconds:300,preventCorsPreflight:!1},Zs={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:U.Info,correlationId:``},Qs={async sendGetRequestAsync(){throw N(F,``)},async sendPostRequestAsync(){throw N(F,``)}},$s={sku:Un,version:Ms,cpu:``,os:``},ec={clientSecret:``,clientAssertion:void 0},tc={azureCloudInstance:ma.None,tenant:`${Kn}`},nc={application:{appName:``,appVersion:``}}})),ic,ac=t((()=>{ic=class{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}})),oc,sc,cc=t((()=>{Qa(),na(),Ua(),Ga(),oc={SW:`sw`},sc=class{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){let n=await z(this.generateKid.bind(this),ja,t,this.performanceClient,e.correlationId)(e),r=this.cryptoUtils.base64UrlEncode(JSON.stringify(n));return{kid:n.kid,reqCnfString:r}}async generateKid(e){return{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:oc.SW}}async signPopToken(e,t,n){return this.signPayload(e,t,n)}async signPayload(e,t,n,r){let{resourceRequestMethod:i,resourceRequestUri:a,shrClaims:o,shrNonce:s,shrOptions:c}=n,l=(a?new R(a,n.correlationId):void 0)?.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:B(),m:i?.toUpperCase(),u:l?.HostNameAndPort,nonce:s||this.cryptoUtils.createNewGuid(),p:l?.AbsolutePath,q:l?.QueryString?[[],l.QueryString]:void 0,client_claims:o||void 0,...r},t,c,n.correlationId)}}})),lc,uc,dc,fc,pc,mc,hc,gc,_c=t((()=>{lc=`no_tokens_found`,uc=`refresh_token_expired`,dc=`ui_not_allowed`,fc=`interaction_required`,pc=`consent_required`,mc=`login_required`,hc=`bad_token`,gc=`interrupted_user`}));function vc(e,t,n){let r=!!e&&bc.indexOf(e)>-1,i=!!n&&xc.indexOf(n)>-1,a=!!t&&bc.some(e=>t.indexOf(e)>-1);return r||a||i}function yc(e,t,n){return new Sc(e,t,n)}var bc,xc,Sc,Cc=t((()=>{Fr(),_c(),bc=[fc,pc,mc,hc,dc,gc],xc=[`message_only`,`additional_action`,`basic_action`,`user_password_expired`,`consent_required`,`bad_token`,`ui_not_allowed`,`interrupted_user`],Sc=class e extends M{constructor(t,n,r,i,a,o,s,c){super(t,n,r,i),Object.setPrototypeOf(this,e.prototype),this.timestamp=a||``,this.traceId=o||``,this.claims=s||``,this.name=`InteractionRequiredAuthError`,this.errorNo=c}}})),wc,Tc=t((()=>{Fr(),wc=class e extends M{constructor(t,n,r,i,a,o){super(t,n,r,i),this.name=`ServerError`,this.errorNo=a,this.status=o,Object.setPrototypeOf(this,e.prototype)}}}));function Ec(e,t,n){if(!e)throw N(ri,n);if(!t)throw N(Gr,n);try{let n=t.split(`|`),r=n[0],i=n.length>1?n.slice(1).join(`|`):``,a=e(r),o=JSON.parse(a);return{userRequestState:i||``,libraryState:o}}catch{throw N(Gr,n)}}var Dc=t((()=>{j(),P(),I()}));function Oc(e,t,n,r,i,a,o,s,c,l,u,d,f){d?.verbose(`setCachedAccount called`,i);let p=s||t.getPreferredCache(),m=e.getAccountsFilteredBy({homeAccountId:n,environment:p},i);f?.addFields({cacheMatchedAccounts:m.length},i),m.length>1&&d?.warning(`Multiple base accounts matched homeAccountId. Ignoring cached account and creating a new base account.`,i);let h=(m.length===1?m[0]:null)||Oi({homeAccountId:n,idTokenClaims:a,clientInfo:o,environment:s,cloudGraphHostName:l?.cloud_graph_host_name,msGraphHost:l?.msgraph_host,nativeAccountId:u},t,i,r),g=h.tenantProfiles||[],_=c||h.realm;if(_&&!g.find(e=>e.tenantId===_)){let e=vi(n,h.localAccountId,_,u,a);g.push(e)}return h.tenantProfiles=g,h}var kc,Ac=t((()=>{bi(),gi(),wi(),ac(),ji(),go(),cc(),P(),Cc(),Tc(),wo(),j(),Dc(),Qa(),I(),kc=class e{constructor(e,t,n,r,i,a,o){this.clientId=e,this.cacheStorage=t,this.cryptoObj=n,this.logger=r,this.performanceClient=i,this.serializableCache=a,this.persistencePlugin=o}validateTokenResponse(e,t,n){if(e.error||e.error_description||e.suberror){let r=`Error(s): ${e.error_codes||`Not Available`} - Timestamp: ${e.timestamp||`Not Available`} - Description: ${e.error_description||`Not Available`} - Correlation ID: ${e.correlation_id||`Not Available`} - Trace ID: ${e.trace_id||`Not Available`}`,i=e.error_codes?.length?e.error_codes[0]:void 0,a=new wc(e.error||``,e.correlation_id||``,r,e.suberror,i,e.status);if(n&&e.status&&e.status>=500&&e.status<=599){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.\n${a}`,t);return}else if(n&&e.status&&e.status>=400&&e.status<=499){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token.\n${a}`,t);return}throw vc(e.error,e.error_description,e.suberror)?new Sc(e.error||``,e.correlation_id||``,e.error_description,e.suberror,e.timestamp||``,e.trace_id||``,e.claims||``,i):a}}async handleServerTokenResponse(t,n,r,i,a,o,s,c,l,u,d){let f;if(t.id_token&&(f=pi(t.id_token||``,this.cryptoObj.base64Decode,i.correlationId),o&&o.nonce&&f.nonce!==o.nonce))throw N(qr,i.correlationId);this.homeAccountIdentifier=ki(t.client_info||``,n.authorityType,this.logger,this.cryptoObj,i.correlationId,f);let p;o&&o.state&&(p=Ec(this.cryptoObj.base64Decode,o.state,i.correlationId)),t.key_id=t.key_id||i.sshKid||void 0;let m=this.generateCacheRecord(t,n,r,i,f,s,o,d),h;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose(`Persistence enabled, calling beforeCacheAccess`,i.correlationId),h=new ic(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(h)),c&&!l&&m.account&&this.cacheStorage.getAllAccounts({homeAccountId:m.account.homeAccountId,environment:m.account.environment},i.correlationId).length<1)return this.logger.warning(`Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache`,i.correlationId),this.performanceClient?.addFields({acntLoggedOut:!0},i.correlationId),await e.generateAuthenticationResult(this.cryptoObj,n,m,!1,i,this.performanceClient,f,p,void 0,u);await this.cacheStorage.saveCacheRecord(m,i.correlationId,mi(f||{}),a,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&h&&(this.logger.verbose(`Persistence enabled, calling afterCacheAccess`,i.correlationId),await this.persistencePlugin.afterCacheAccess(h))}return e.generateAuthenticationResult(this.cryptoObj,n,m,!1,i,this.performanceClient,f,p,t,u)}generateCacheRecord(e,t,n,r,i,a,o,s){let c=t.getPreferredCache();if(!c)throw N(ni,r.correlationId);let l=Ci(i),u,d;e.id_token&&i&&(u=$a(this.homeAccountIdentifier,c,e.id_token,this.clientId,l||``),d=Oc(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,r.correlationId,i,e.client_info,c,l,o,void 0,this.logger,this.performanceClient));let f=null;if(e.access_token){let i=e.scope?V.fromString(e.scope,r.correlationId):new V(r.scopes||[],r.correlationId),o=(typeof e.expires_in==`string`?parseInt(e.expires_in,10):e.expires_in)||0,u=(typeof e.ext_expires_in==`string`?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,d=(typeof e.refresh_in==`string`?parseInt(e.refresh_in,10):e.refresh_in)||void 0,p=n+o,m=p+u,h=d&&d>0?n+d:void 0;f=eo(this.homeAccountIdentifier,c,e.access_token,this.clientId,l||t.tenant||``,i.printScopes(),p,m,this.cryptoObj.base64Decode,r.correlationId,h,e.token_type,a,e.key_id,s);let g=r.resource||null;g&&(f.resource=g)}let p=null;if(e.refresh_token){let t;e.refresh_token_expires_in&&(t=n+(typeof e.refresh_token_expires_in==`string`?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in),this.performanceClient?.addFields({ntwkRtExpiresOnSeconds:t},r.correlationId)),p=to(this.homeAccountIdentifier,c,e.refresh_token,this.clientId,e.foci,a,t)}let m=null;return e.foci&&(m={clientId:this.clientId,environment:c,familyId:e.foci}),{account:d,idToken:u,accessToken:f,refreshToken:p,appMetadata:m}}static async generateAuthenticationResult(e,t,n,r,i,a,o,s,c,l){let u=``,d=[],f=null,p,m,h=``;if(n.accessToken){if(n.accessToken.tokenType===k.POP&&!i.popKid){let t=new sc(e,a),{secret:r,keyId:o}=n.accessToken;if(!o)throw N(si,i.correlationId);u=await t.signPopToken(r,o,i)}else u=n.accessToken.secret;d=V.fromString(n.accessToken.target,i.correlationId).asArray(),f=Ja(n.accessToken.expiresOn),p=Ja(n.accessToken.extendedExpiresOn),n.accessToken.refreshOn&&(m=Ja(n.accessToken.refreshOn))}n.appMetadata&&(h=n.appMetadata.familyId===`1`?`1`:``);let g=o?.oid||o?.sub||``,_=o?.tid||``;if(c?.spa_accountid&&n.account){n.account.nativeAccountId=c?.spa_accountid;let e=_||n.account.realm;if(n.account.tenantProfiles){let t=n.account.tenantProfiles.find(t=>t.tenantId===e);t&&(t.nativeAccountId=c.spa_accountid)}}let ee=n.account?yi(Di(n.account),void 0,o,n.idToken?.secret):null;return{authority:t.canonicalAuthority,uniqueId:g,tenantId:_,scopes:d,account:ee,idToken:n?.idToken?.secret||``,idTokenClaims:o||{},accessToken:u,fromCache:r,expiresOn:f,extExpiresOn:p,refreshOn:m,correlationId:i.correlationId,requestId:l||``,familyId:h,tokenType:n.accessToken?.tokenType||``,state:s?s.userRequestState:``,cloudGraphHostName:n.account?.cloudGraphHostName||``,msGraphHost:n.account?.msGraphHost||``,code:c?.spa_code,fromPlatformBroker:!1}}}})),jc,Mc=t((()=>{jc={HOME_ACCOUNT_ID:`home_account_id`,UPN:`UPN`}}));async function Nc(e,t,n,r){return typeof e==`string`?e:e({clientId:t,tokenEndpoint:n,fmiPath:r})}var Pc=t((()=>{}));function Fc(e,t,n){return{clientId:e,authority:t.authority,scopes:t.scopes,homeAccountIdentifier:n,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid,embeddedClientId:t.embeddedClientId||t.extraParameters?.clientId,resource:t.resource}}var Ic=t((()=>{})),Lc,Rc=t((()=>{j(),Tc(),Ic(),Lc=class e{static generateThrottlingStorageKey(e){return`${Dr}.${JSON.stringify(e)}`}static preProcess(t,n,r){let i=e.generateThrottlingStorageKey(n),a=t.getThrottlingCache(i,r);if(a){if(a.throttleTime<Date.now()){t.removeItem(i,r);return}throw new wc(a.errorCodes?.join(` `)||``,r,a.errorMessage,a.subError)}}static postProcess(t,n,r,i){if(e.checkResponseStatus(r)||e.checkResponseForRetryAfter(r)){let a={throttleTime:e.calculateThrottleTime(parseInt(r.headers[E.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};t.setThrottlingCache(e.generateThrottlingStorageKey(n),a,i)}}static checkResponseStatus(e){return e.status===429||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(E.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){let t=e<=0?0:e,n=Date.now()/1e3;return Math.floor(Math.min(n+(t||60),n+Er)*1e3)}static removeThrottle(e,t,n,r){let i=Fc(t,n,r),a=this.generateThrottlingStorageKey(i);e.removeItem(a,n.correlationId)}}}));function zc(e,t,n,r){return e.errorMessage=`${e.errorMessage}, additionalErrorInfo: error.name:${r?.name}, error.message:${r?.message}`,new Bc(e,t,n)}var Bc,Vc=t((()=>{Fr(),Bc=class e extends M{constructor(t,n,r){super(t.errorCode,t.correlationId,t.errorMessage,t.subError),Object.setPrototypeOf(this,e.prototype),this.name=`NetworkError`,this.error=t,this.httpStatus=n,this.responseHeaders=r}}}));function Hc(e,t,n){let r={};if(r[E.CONTENT_TYPE]=nr,!t&&n)switch(n.type){case jc.HOME_ACCOUNT_ID:try{let e=di(n.credential);r[E.CCS_HEADER]=`Oid:${e.uid}@${e.utid}`}catch(t){e.verbose(`Could not parse home account ID for CCS Header: '${t}'`,``)}break;case jc.UPN:r[E.CCS_HEADER]=`UPN: ${n.credential}`;break}return r}function Uc(e,t,n,r){let i=new Map;return e.embeddedClientId&&ms(i,t,n),e.extraQueryParameters&&as(i,e.extraQueryParameters),zo(i,e.correlationId),To(i,e.correlationId,r),H(i)}async function Wc(e,t,n,r,i,a,o,s,c,l){let u=await Gc(r,e,{body:t,headers:n},i,a,o,s,c);return l&&u.status<500&&u.status!==429&&l.clearTelemetryCache(),u}async function Gc(e,t,n,r,i,a,o,s){Lc.preProcess(i,e,r);let c;try{c=await z(a.sendPostRequestAsync.bind(a),ba,o,s,r)(t,n);let e=c.headers||{};s?.addFields({refreshTokenSize:c.body.refresh_token?.length||0,httpVerToken:e[E.X_MS_HTTP_VERSION]||``,requestId:e[E.X_MS_REQUEST_ID]||``},r)}catch(e){if(e instanceof Bc){let t=e.responseHeaders;throw t&&s?.addFields({httpVerToken:t[E.X_MS_HTTP_VERSION]||``,requestId:t[E.X_MS_REQUEST_ID]||``,contentTypeHeader:t[E.CONTENT_TYPE]||void 0,contentLengthHeader:t[E.CONTENT_LENGTH]||void 0,httpStatus:e.httpStatus},r),e.error}throw e instanceof M?e:N(Hr,r)}return Lc.postProcess(i,e,c,r),c}var Kc=t((()=>{Mc(),fi(),j(),_s(),bs(),Rc(),Vc(),Fr(),P(),Ga(),Ua(),I()})),qc,Jc=t((()=>{_s(),bs(),j(),Hn(),rc(),Ac(),P(),na(),cc(),Qa(),fi(),Mc(),Fi(),Ua(),Ga(),Pc(),Ic(),Kc(),Co(),As(),Ns(),I(),Zi(),qc=class{constructor(e,t){this.includeRedirectUri=!0,this.config=qs(e),this.logger=new ks(this.config.loggerOptions,js,Ms),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t,this.oidcDefaultScopes=this.config.authOptions.authority.options.OIDCOptions?.defaultScopes}async acquireToken(e,t,n){if(!e.code)throw N(Xr,e.correlationId);n&&n.cloud_instance_host_name&&await z(this.updateTokenEndpointAuthority.bind(this),Aa,this.logger,this.performanceClient,e.correlationId)(n.cloud_instance_host_name,e.correlationId);let r=B(),i=await z(this.executeTokenRequest.bind(this),Oa,this.logger,this.performanceClient,e.correlationId)(this.authority,e,this.serverTelemetryManager),a=i.headers?.[E.X_MS_REQUEST_ID],o=new kc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.performanceClient,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(i.body,e.correlationId),z(o.handleServerTokenResponse.bind(o),Ma,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,t,n,void 0,void 0,void 0,a)}getLogoutUri(e){if(!e)throw L(Ui,``);let t=this.createLogoutUrlQueryString(e);return R.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t,n){let r=Uc(t,this.config.authOptions.clientId,this.config.authOptions.redirectUri,this.performanceClient),i=R.appendQueryString(e.tokenEndpoint,r),a=await z(this.createTokenRequestBody.bind(this),ka,this.logger,this.performanceClient,t.correlationId)(t),o;if(t.clientInfo)try{let e=ui(t.clientInfo,this.cryptoUtils.base64Decode);o={credential:`${e.uid}.${e.utid}`,type:jc.HOME_ACCOUNT_ID}}catch(e){this.logger.verbose(`Could not parse client info for CCS Header: '${e}'`,t.correlationId)}let s=Hc(this.logger,this.config.systemOptions.preventCorsPreflight,o||t.ccsCredential),c=Fc(this.config.authOptions.clientId,t);return z(Wc,Sa,this.logger,this.performanceClient,t.correlationId)(i,a,s,c,t.correlationId,this.cacheManager,this.networkClient,this.logger,this.performanceClient,n)}async createTokenRequestBody(e){let t=new Map;if(ko(t,e.embeddedClientId||e.extraParameters?.client_id||this.config.authOptions.clientId),this.includeRedirectUri)Ao(t,e.redirectUri);else if(!e.redirectUri)throw L(Ii,e.correlationId);if(Oo(t,e.scopes,e.correlationId,!0,this.oidcDefaultScopes),hs(t,e.resource),Ko(t,e.code),Bo(t,this.config.libraryInfo),Vo(t,this.config.telemetry.application),fs(t),this.serverTelemetryManager&&!Ys(this.config)&&ds(t,this.serverTelemetryManager),e.codeVerifier&&Yo(t,e.codeVerifier),this.config.clientCredentials.clientSecret&&Xo(t,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){let n=this.config.clientCredentials.clientAssertion;Zo(t,await Nc(n.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),Qo(t,n.assertionType)}if(ts(t,gr.AUTHORIZATION_CODE_GRANT),ns(t),e.authenticationScheme===k.POP){let n=new sc(this.cryptoUtils,this.performanceClient),r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await z(n.generateCnf.bind(n),ja,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,ls(t,r)}else if(e.authenticationScheme===k.SSH)if(e.sshJwk)us(t,e.sshJwk);else throw L(Ji,e.correlationId);let n;if(e.clientInfo)try{let t=ui(e.clientInfo,this.cryptoUtils.base64Decode);n={credential:`${t.uid}.${t.utid}`,type:jc.HOME_ACCOUNT_ID}}catch(t){this.logger.verbose(`Could not parse client info for CCS Header: '${t}'`,e.correlationId)}else n=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case jc.HOME_ACCOUNT_ID:try{Io(t,di(n.credential))}catch(t){this.logger.verbose(`Could not parse home account ID for CCS Header: '${t}'`,e.correlationId)}break;case jc.UPN:Fo(t,n.credential);break}return e.embeddedClientId&&ms(t,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.extraParameters&&as(t,e.extraParameters),e.enableSpaAuthorizationCode&&(!e.extraParameters||!e.extraParameters.return_spa_code)&&as(t,{[On]:`1`}),To(t,e.correlationId,this.performanceClient),Ro(t,e.correlationId,e.claims,this.config.authOptions.clientCapabilities,e.skipBrokerClaims),H(t)}createLogoutUrlQueryString(e){let t=new Map;return e.postLogoutRedirectUri&&jo(t,e.postLogoutRedirectUri),e.correlationId&&zo(t,e.correlationId),e.idTokenHint&&Mo(t,e.idTokenHint),e.state&&Uo(t,e.state),e.logoutHint&&ps(t,e.logoutHint),e.extraQueryParameters&&as(t,e.extraQueryParameters),this.config.authOptions.instanceAware&&is(t),H(t)}async updateTokenEndpointAuthority(e,t){let n=await So(`https://${e}/${this.authority.tenant}/`,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=n}}}));function Yc(e,t,n,r){let i=t.correlationId,a=new Map;if(ko(a,t.embeddedClientId||t.extraQueryParameters?.client_id||e.clientId),Oo(a,[...t.scopes||[],...t.extraScopesToConsent||[]],t.correlationId,!0,e.authority.options.OIDCOptions?.defaultScopes),hs(a,t.resource),Ao(a,t.redirectUri),zo(a,i),Do(a,t.responseMode),ns(a),rs(a),t.prompt&&(Ho(a,t.prompt),r?.addFields({prompt:t.prompt},i)),t.domainHint&&(No(a,t.domainHint),r?.addFields({domainHintFromRequest:!0},i)),t.prompt!==fr.SELECT_ACCOUNT)if(t.sid&&t.prompt===fr.NONE)n.verbose(`createAuthCodeUrlQueryString: Prompt is none, adding sid from request`,t.correlationId),Lo(a,t.sid),r?.addFields({sidFromRequest:!0},i);else if(t.account){let e=Zc(t.account),o=Qc(t.account);if(o&&t.domainHint&&(n.warning(`AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint`,t.correlationId),o=null),o){n.verbose(`createAuthCodeUrlQueryString: login_hint claim present on account`,t.correlationId),Po(a,o),r?.addFields({loginHintFromClaim:!0},i);try{Io(a,di(t.account.homeAccountId))}catch{n.verbose(`createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header`,t.correlationId)}}else if(e&&t.prompt===fr.NONE){n.verbose(`createAuthCodeUrlQueryString: Prompt is none, adding sid from account`,t.correlationId),Lo(a,e),r?.addFields({sidFromClaim:!0},i);try{Io(a,di(t.account.homeAccountId))}catch{n.verbose(`createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header`,t.correlationId)}}else if(t.loginHint)n.verbose(`createAuthCodeUrlQueryString: Adding login_hint from request`,t.correlationId),Po(a,t.loginHint),Fo(a,t.loginHint),r?.addFields({loginHintFromRequest:!0},i);else if(t.account.username){n.verbose(`createAuthCodeUrlQueryString: Adding login_hint from account`,t.correlationId),Po(a,t.account.username),r?.addFields({loginHintFromUpn:!0},i);try{Io(a,di(t.account.homeAccountId))}catch{n.verbose(`createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header`,t.correlationId)}}}else t.loginHint&&(n.verbose(`createAuthCodeUrlQueryString: No account, adding login_hint from request`,t.correlationId),Po(a,t.loginHint),Fo(a,t.loginHint),r?.addFields({loginHintFromRequest:!0},i));else n.verbose(`createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints`,t.correlationId);return t.nonce&&Wo(a,t.nonce),t.state&&Uo(a,t.state),t.embeddedClientId&&ms(a,e.clientId,e.redirectUri),Ro(a,t.correlationId,t.claims,e.clientCapabilities,t.skipBrokerClaims),e.instanceAware&&(!t.extraQueryParameters||!Object.keys(t.extraQueryParameters).includes(`instance_aware`))&&is(a),a}function Xc(e,t){let n=H(t);return R.appendQueryString(e.authorizationEndpoint,n)}function Zc(e){return e.idTokenClaims?.sid||null}function Qc(e){return e.loginHint||e.idTokenClaims?.login_hint||null}var $c=t((()=>{_s(),Hn(),j(),fi(),bs(),na()})),el,tl,nl=t((()=>{rc(),_s(),bs(),j(),Hn(),Ac(),cc(),Fi(),P(),Tc(),Qa(),na(),Mc(),fi(),Cc(),Ua(),Ga(),Pc(),Ic(),Kc(),As(),Ns(),_c(),Zi(),I(),el=300,tl=class{constructor(e,t){this.config=qs(e),this.logger=new ks(this.config.loggerOptions,js,Ms),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}async acquireToken(e,t){let n=B(),r=await z(this.executeTokenRequest.bind(this),Ca,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=r.headers?.[E.X_MS_REQUEST_ID],a=new kc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.performanceClient,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(r.body,e.correlationId),z(a.handleServerTokenResponse.bind(a),Ma,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,t,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e,t){if(!e)throw L(Hi,``);if(!e.account)throw N(ei,e.correlationId);if(this.cacheManager.isAppMetadataFOCI(e.account.environment,e.correlationId))try{return await z(this.acquireTokenWithCachedRefreshToken.bind(this),Ta,this.logger,this.performanceClient,e.correlationId)(e,!0,t)}catch(n){let r=n instanceof Sc&&n.errorCode===`no_tokens_found`,i=n instanceof wc&&n.errorCode===`invalid_grant`&&n.subError===`client_mismatch`;if(r||i)return z(this.acquireTokenWithCachedRefreshToken.bind(this),Ta,this.logger,this.performanceClient,e.correlationId)(e,!1,t);throw n}return z(this.acquireTokenWithCachedRefreshToken.bind(this),Ta,this.logger,this.performanceClient,e.correlationId)(e,!1,t)}async acquireTokenWithCachedRefreshToken(e,t,n){let r=Wa(this.cacheManager.getRefreshToken.bind(this.cacheManager),Ha,this.logger,this.performanceClient,e.correlationId)(e.account,t,e.correlationId,void 0);if(!r)throw yc(lc,e.correlationId);if(r.expiresOn){let t=e.refreshTokenExpirationOffsetSeconds||el;if(this.performanceClient?.addFields({cacheRtExpiresOnSeconds:Number(r.expiresOn),rtOffsetSeconds:t},e.correlationId),Ya(r.expiresOn,t))throw yc(uc,e.correlationId)}let i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||k.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:jc.HOME_ACCOUNT_ID}};try{return await z(this.acquireToken.bind(this),wa,this.logger,this.performanceClient,e.correlationId)(i,n)}catch(t){if(t instanceof Sc&&t.subError===`bad_token`){this.logger.verbose(`acquireTokenWithRefreshToken: bad refresh token, removing from cache`,e.correlationId);let t=this.cacheManager.generateCredentialKey(r);this.cacheManager.removeRefreshToken(t,e.correlationId)}throw t}}async executeTokenRequest(e,t){let n=Uc(e,this.config.authOptions.clientId,this.config.authOptions.redirectUri,this.performanceClient),r=R.appendQueryString(t.tokenEndpoint,n),i=await z(this.createTokenRequestBody.bind(this),Ea,this.logger,this.performanceClient,e.correlationId)(e),a=Hc(this.logger,this.config.systemOptions.preventCorsPreflight,e.ccsCredential),o=Fc(this.config.authOptions.clientId,e);return z(Wc,xa,this.logger,this.performanceClient,e.correlationId)(r,i,a,o,e.correlationId,this.cacheManager,this.networkClient,this.logger,this.performanceClient,this.serverTelemetryManager)}async createTokenRequestBody(e){let t=new Map;if(ko(t,e.embeddedClientId||e.extraParameters?.client_id||this.config.authOptions.clientId),e.redirectUri&&Ao(t,e.redirectUri),Oo(t,e.scopes,e.correlationId,!0,this.config.authOptions.authority.options.OIDCOptions?.defaultScopes),ts(t,gr.REFRESH_TOKEN_GRANT),ns(t),Bo(t,this.config.libraryInfo),Vo(t,this.config.telemetry.application),fs(t),this.serverTelemetryManager&&!Ys(this.config)&&ds(t,this.serverTelemetryManager),Jo(t,e.refreshToken),this.config.clientCredentials.clientSecret&&Xo(t,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){let n=this.config.clientCredentials.clientAssertion;Zo(t,await Nc(n.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),Qo(t,n.assertionType)}if(e.authenticationScheme===k.POP){let n=new sc(this.cryptoUtils,this.performanceClient),r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await z(n.generateCnf.bind(n),ja,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,ls(t,r)}else if(e.authenticationScheme===k.SSH)if(e.sshJwk)us(t,e.sshJwk);else throw L(Ji,e.correlationId);if(this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case jc.HOME_ACCOUNT_ID:try{Io(t,di(e.ccsCredential.credential))}catch(t){this.logger.verbose(`Could not parse home account ID for CCS Header: '${t}'`,e.correlationId)}break;case jc.UPN:Fo(t,e.ccsCredential.credential);break}return e.embeddedClientId&&ms(t,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.extraParameters&&as(t,{...e.extraParameters}),To(t,e.correlationId,this.performanceClient),Ro(t,e.correlationId,e.claims,this.config.authOptions.clientCapabilities,e.skipBrokerClaims),H(t)}}}));function rl(e){let{skus:t,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:a}=e,o=new Map([[0,[n,r]],[2,[i,a]]]),s=[];if(t?.length){if(s=t.split(al),s.length<4)return t}else s=Array.from({length:4},()=>ol);return o.forEach((e,t)=>{e.length===2&&e[0]?.length&&e[1]?.length&&il({skuArr:s,index:t,skuName:e[0],skuVersion:e[1]})}),s.join(al)}function il(e){let{skuArr:t,index:n,skuName:r,skuVersion:i}=e;n>=t.length||(t[n]=[r,i].join(ol))}var al,ol,sl,cl=t((()=>{j(),Fr(),al=`,`,ol=`|`,sl=class e{constructor(e,t){this.cacheOutcome=A.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||``,this.wrapperVer=e.wrapperVer||``,this.telemetryCacheKey=wr+`-`+e.clientId}generateCurrentRequestHeaderValue(){let e=`${this.apiId},${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],n=this.getNativeBrokerErrorCode();n?.length&&t.push(`broker_error=${n}`);let r=t.join(`,`);return[5,[e,this.getRegionDiscoveryFields()].join(`,`),r].join(`|`)}generateLastRequestHeaderValue(){let t=this.getLastRequests(),n=e.maxErrorsToSend(t),r=t.failedRequests.slice(0,2*n).join(`,`),i=t.errors.slice(0,n).join(`,`),a=t.errors.length,o=[a,n<a?`1`:`0`].join(`,`);return[5,t.cacheHits,r,i,o].join(`|`)}cacheFailedRequest(e){try{let t=this.getLastRequests();t.errors.length>=50&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof M?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(Tr),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t,this.correlationId)}catch{}}incrementCacheHits(){let e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){return this.cacheManager.getServerTelemetry(this.telemetryCacheKey,this.correlationId)||{failedRequests:[],errors:[],cacheHits:0}}clearTelemetryCache(){let t=this.getLastRequests(),n=e.maxErrorsToSend(t);if(n===t.errors.length)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{let e={failedRequests:t.failedRequests.slice(n*2),errors:t.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId)}}static maxErrorsToSend(e){let t,n=0,r=0,i=e.errors.length;for(t=0;t<i;t++){let i=e.failedRequests[2*t]||``,a=e.failedRequests[2*t+1]||``,o=e.errors[t]||``;if(r+=i.toString().length+a.toString().length+o.length+3,r<330)n+=1;else break}return n}getRegionDiscoveryFields(){let e=[];return e.push(this.regionUsed||``),e.push(this.regionSource||``),e.push(this.regionOutcome||``),e.join(`,`)}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){let t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t,this.correlationId)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){let e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId)}static makeExtraSkuString(e){return rl(e)}}})),ll,ul=t((()=>{rc(),Qa(),P(),Ac(),j(),ta(),gi(),Ua(),Ga(),xo(),As(),Ns(),I(),ll=class{constructor(e,t){this.config=qs(e),this.logger=new ks(this.config.loggerOptions,js,Ms),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}async acquireCachedToken(e){let t=A.NOT_APPLICABLE;if(e.forceRefresh||!ea.isEmptyObj(e.claims))throw this.setCacheOutcome(A.FORCE_REFRESH_OR_CLAIMS,e.correlationId),N(ii,e.correlationId);if(!e.account)throw N(ei,e.correlationId);let n=e.account.tenantId||_o(e.authority,e.correlationId),r=this.cacheManager.getTokenKeys(),i=this.cacheManager.getAccessToken(e.account,e,r,n);if(!i)throw this.setCacheOutcome(A.NO_CACHED_ACCESS_TOKEN,e.correlationId),N(ii,e.correlationId);if(Xa(i.cachedAt)||Ya(i.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(A.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),N(ii,e.correlationId);if(e.resource){if(i.resource!==e.resource)throw this.setCacheOutcome(A.NO_CACHED_ACCESS_TOKEN,e.correlationId),N(ii,e.correlationId)}else i.refreshOn&&Ya(i.refreshOn,0)&&(t=A.PROACTIVELY_REFRESHED);let a=e.authority||this.authority.getPreferredCache(),o={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:i,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,r,n),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(a,e.correlationId)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await z(this.generateResultFromCacheRecord.bind(this),Da,this.logger,this.performanceClient,e.correlationId)(o,e),t]}setCacheOutcome(e,t){this.serverTelemetryManager?.setCacheOutcome(e),this.performanceClient?.addFields({cacheOutcome:e},t),e!==A.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: '${e}'`,t)}async generateResultFromCacheRecord(e,t){let n;return e.idToken&&(n=pi(e.idToken.secret,this.config.cryptoInterface.base64Decode,t.correlationId)),kc.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,this.performanceClient,n)}}}));function dl(e,t){if(e){if(t.resource&&(fl(t.extraParameters)||fl(t.extraQueryParameters)))throw N(li,t.correlationId||``);if(!t.resource)throw N(ci,t.correlationId||``)}}function fl(e){return e?Object.prototype.hasOwnProperty.call(e,`resource`):!1}var pl=t((()=>{P(),I()})),W=t((()=>{Hn(),ji(),Fr(),Ni(),gi(),Fi(),j(),Zi(),xo(),Co(),Si(),Jc(),$c(),ha(),zs(),go(),Hs(),Mc(),Pc(),P(),I(),Ss(),rc(),Cc(),As(),Vc(),Ei(),nl(),_s(),Ac(),wo(),Tc(),cl(),ul(),ta(),Ks(),Rc(),Qa(),ac(),Kc(),na(),bs(),fi(),bi(),pl(),Ga(),Ns()})),ml,hl=t((()=>{W(),ml=class{static deserializeJSONBlob(e){return e?JSON.parse(e):{}}static deserializeAccounts(e){let t={};return e&&Object.keys(e).map(function(n){let r=e[n],i={homeAccountId:r.home_account_id,environment:r.environment,realm:r.realm,localAccountId:r.local_account_id,username:r.username,authorityType:r.authority_type,name:r.name,clientInfo:r.client_info,lastModificationTime:r.last_modification_time,lastModificationApp:r.last_modification_app,tenantProfiles:r.tenantProfiles?.map(e=>JSON.parse(e)),lastUpdatedAt:Date.now().toString()},a={};Bs.toObject(a,i),t[n]=a}),t}static deserializeIdTokens(e){let t={};return e&&Object.keys(e).map(function(n){let r=e[n],i={homeAccountId:r.home_account_id,environment:r.environment,credentialType:r.credential_type,clientId:r.client_id,secret:r.secret,realm:r.realm,lastUpdatedAt:Date.now().toString()};t[n]=i}),t}static deserializeAccessTokens(e){let t={};return e&&Object.keys(e).map(function(n){let r=e[n],i={homeAccountId:r.home_account_id,environment:r.environment,credentialType:r.credential_type,clientId:r.client_id,secret:r.secret,realm:r.realm,target:r.target,cachedAt:r.cached_at,expiresOn:r.expires_on,extendedExpiresOn:r.extended_expires_on,refreshOn:r.refresh_on,keyId:r.key_id,tokenType:r.token_type,userAssertionHash:r.userAssertionHash,resource:r.resource,additionalCacheKeyComponents:r.additionalCacheKeyComponents,lastUpdatedAt:Date.now().toString()};t[n]=i}),t}static deserializeRefreshTokens(e){let t={};return e&&Object.keys(e).map(function(n){let r=e[n],i={homeAccountId:r.home_account_id,environment:r.environment,credentialType:r.credential_type,clientId:r.client_id,secret:r.secret,familyId:r.family_id,target:r.target,realm:r.realm,lastUpdatedAt:Date.now().toString()};t[n]=i}),t}static deserializeAppMetadata(e){let t={};return e&&Object.keys(e).map(function(n){let r=e[n];t[n]={clientId:r.client_id,environment:r.environment,familyId:r.family_id}}),t}static deserializeAllCache(e){return{accounts:e.Account?this.deserializeAccounts(e.Account):{},idTokens:e.IdToken?this.deserializeIdTokens(e.IdToken):{},accessTokens:e.AccessToken?this.deserializeAccessTokens(e.AccessToken):{},refreshTokens:e.RefreshToken?this.deserializeRefreshTokens(e.RefreshToken):{},appMetadata:e.AppMetadata?this.deserializeAppMetadata(e.AppMetadata):{}}}}})),gl,_l,vl,yl,G,K,q,J,bl,xl,Sl,Cl,wl,Tl,El,Y,Dl,Ol,X=t((()=>{W(),gl=`system_assigned_managed_identity`,_l=`managed_identity`,vl=`https://login.microsoftonline.com/${_l}/`,yl={AUTHORIZATION_HEADER_NAME:`Authorization`,METADATA_HEADER_NAME:`Metadata`,APP_SERVICE_SECRET_HEADER_NAME:`X-IDENTITY-HEADER`,ML_AND_SF_SECRET_HEADER_NAME:`secret`,CLIENT_SKU:cn,CLIENT_VER:ln,CLIENT_REQUEST_ID:`x-ms-client-request-id`},G={API_VERSION:`api-version`,RESOURCE:`resource`,SHA256_TOKEN_TO_REFRESH:`token_sha256_to_refresh`,XMS_CC:`xms_cc`},K={AZURE_POD_IDENTITY_AUTHORITY_HOST:`AZURE_POD_IDENTITY_AUTHORITY_HOST`,DEFAULT_IDENTITY_CLIENT_ID:`DEFAULT_IDENTITY_CLIENT_ID`,IDENTITY_ENDPOINT:`IDENTITY_ENDPOINT`,IDENTITY_HEADER:`IDENTITY_HEADER`,IDENTITY_SERVER_THUMBPRINT:`IDENTITY_SERVER_THUMBPRINT`,IMDS_ENDPOINT:`IMDS_ENDPOINT`,MSI_ENDPOINT:`MSI_ENDPOINT`,MSI_SECRET:`MSI_SECRET`},q={APP_SERVICE:`AppService`,AZURE_ARC:`AzureArc`,CLOUD_SHELL:`CloudShell`,DEFAULT_TO_IMDS:`DefaultToImds`,IMDS:`Imds`,MACHINE_LEARNING:`MachineLearning`,SERVICE_FABRIC:`ServiceFabric`},J={SYSTEM_ASSIGNED:`system-assigned`,USER_ASSIGNED_CLIENT_ID:`user-assigned-client-id`,USER_ASSIGNED_RESOURCE_ID:`user-assigned-resource-id`,USER_ASSIGNED_OBJECT_ID:`user-assigned-object-id`},bl={GET:`GET`,POST:`POST`},xl=`REGION_NAME`,Sl=`MSAL_FORCE_REGION`,Cl={SHA256:`sha256`},wl={CV_CHARSET:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~`},Tl={KEY_SEPARATOR:`-`},El={MSAL_SKU:`msal.js.node`,JWT_BEARER_ASSERTION_TYPE:`urn:ietf:params:oauth:client-assertion-type:jwt-bearer`,HTTP_PROTOCOL:`http://`,LOCALHOST:`localhost`},Y={acquireTokenSilent:62,acquireTokenByUsernamePassword:371,acquireTokenByDeviceCode:671,acquireTokenByClientCredential:771,acquireTokenByOBO:772,acquireTokenWithManagedIdentity:773,acquireTokenByUserFederatedIdentityCredential:774,acquireTokenByCode:871,acquireTokenByRefreshToken:872},Dl={RSA_256:`RS256`,PSS_256:`PS256`,X5T_256:`x5t#S256`,X5T:`x5t`,X5C:`x5c`,AUDIENCE:`aud`,EXPIRATION_TIME:`exp`,ISSUER:`iss`,SUBJECT:`sub`,NOT_BEFORE:`nbf`,JWT_ID:`jti`},Ol={INTERVAL_MS:100,TIMEOUT_MS:5e3}}));function kl(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}function Al(e){let t=new Headers;return e&&e.headers&&Object.entries(e.headers).forEach(([e,n])=>{t.append(e,n)}),t}var jl,Ml=t((()=>{W(),X(),jl=class{async sendGetRequestAsync(e,t,n){return this.sendRequest(e,bl.GET,t,n)}async sendPostRequestAsync(e,t){return this.sendRequest(e,bl.POST,t)}async sendRequest(e,t,n,r){let i=new AbortController,a;r&&(a=setTimeout(()=>{i.abort()},r));let o={method:t,headers:Al(n),signal:i.signal};t===bl.POST&&(o.body=n?.body||``);let s;try{s=await fetch(e,o)}catch(e){throw a&&clearTimeout(a),e instanceof Error&&e.name===`AbortError`?Pr(Hr,``,`Request timeout`):zc(Pr(Hr,``,`Network request failed: ${e instanceof Error?e.message:`unknown`}`),void 0,void 0,e instanceof Error?e:void 0)}a&&clearTimeout(a);try{return{headers:kl(s.headers),body:await s.json(),status:s.status}}catch(e){throw Pr(zr,``,`Failed to parse response: ${e instanceof Error?e.message:`unknown`}`)}}}})),Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl=t((()=>{X(),Nl=`invalid_file_extension`,Pl=`invalid_file_path`,Fl=`invalid_managed_identity_id_type`,Il=`invalid_secret`,Ll=`missing_client_id`,Rl=`network_unavailable`,zl=`platform_not_supported`,Bl=`unable_to_create_azure_arc`,Vl=`unable_to_create_cloud_shell`,Hl=`unable_to_create_source`,Ul=`unable_to_read_secret_file`,Wl=`user_assigned_not_available_at_runtime`,Gl=`www_authenticate_header_missing`,Kl=`www_authenticate_header_unsupported_format`,ql={[K.AZURE_POD_IDENTITY_AUTHORITY_HOST]:`azure_pod_identity_authority_host_url_malformed`,[K.IDENTITY_ENDPOINT]:`identity_endpoint_url_malformed`,[K.IMDS_ENDPOINT]:`imds_endpoint_url_malformed`,[K.MSI_ENDPOINT]:`msi_endpoint_url_malformed`}}));function Z(e,t){return new Xl(e,t)}var Yl,Xl,Zl=t((()=>{W(),Jl(),X(),Yl={[Nl]:`The file path in the WWW-Authenticate header does not contain a .key file.`,[Pl]:`The file path in the WWW-Authenticate header is not in a valid Windows or Linux Format.`,[Fl]:`More than one ManagedIdentityIdType was provided.`,[Il]:`The secret in the file on the file path in the WWW-Authenticate header is greater than 4096 bytes.`,[zl]:`The platform is not supported by Azure Arc. Azure Arc only supports Windows and Linux.`,[Ll]:`A ManagedIdentityId id was not provided.`,[ql.AZURE_POD_IDENTITY_AUTHORITY_HOST]:`The Managed Identity's '${K.AZURE_POD_IDENTITY_AUTHORITY_HOST}' environment variable is malformed.`,[ql.IDENTITY_ENDPOINT]:`The Managed Identity's '${K.IDENTITY_ENDPOINT}' environment variable is malformed.`,[ql.IMDS_ENDPOINT]:`The Managed Identity's '${K.IMDS_ENDPOINT}' environment variable is malformed.`,[ql.MSI_ENDPOINT]:`The Managed Identity's '${K.MSI_ENDPOINT}' environment variable is malformed.`,[Rl]:`Authentication unavailable. The request to the managed identity endpoint timed out.`,[Bl]:`Azure Arc Managed Identities can only be system assigned.`,[Vl]:`Cloud Shell Managed Identities can only be system assigned.`,[Hl]:`Unable to create a Managed Identity source based on environment variables.`,[Ul]:`Unable to read the secret file.`,[Wl]:`Service Fabric user assigned managed identity ClientId or ResourceId is not configurable at runtime.`,[Gl]:`A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is missing.`,[Kl]:`A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format.`},Xl=class e extends M{constructor(t,n){super(t,n,Yl[t]),this.name=`ManagedIdentityError`,Object.setPrototypeOf(this,e.prototype)}}})),Ql,$l=t((()=>{Zl(),X(),Jl(),Ql=class{get id(){return this._id}set id(e){this._id=e}get idType(){return this._idType}set idType(e){this._idType=e}constructor(e){let t=e?.userAssignedClientId,n=e?.userAssignedResourceId,r=e?.userAssignedObjectId;if(t){if(n||r)throw Z(Fl,``);this.id=t,this.idType=J.USER_ASSIGNED_CLIENT_ID}else if(n){if(t||r)throw Z(Fl,``);this.id=n,this.idType=J.USER_ASSIGNED_RESOURCE_ID}else if(r){if(t||n)throw Z(Fl,``);this.id=r,this.idType=J.USER_ASSIGNED_OBJECT_ID}else this.id=gl,this.idType=J.SYSTEM_ASSIGNED}}})),Q,eu,tu=t((()=>{W(),Q={invalidLoopbackAddressType:{code:`invalid_loopback_server_address_type`,desc:`Loopback server address is not type string. This is unexpected.`},unableToLoadRedirectUri:{code:`unable_to_load_redirectUrl`,desc:`Loopback server callback was invoked without a url. This is unexpected.`},noAuthCodeInResponse:{code:`no_auth_code_in_response`,desc:`No auth code found in the server response. Please check your network trace to determine what happened.`},noLoopbackServerExists:{code:`no_loopback_server_exists`,desc:`No loopback server exists yet.`},loopbackServerAlreadyExists:{code:`loopback_server_already_exists`,desc:`Loopback server already exists. Cannot create another.`},loopbackServerTimeout:{code:`loopback_server_timeout`,desc:`Timed out waiting for auth code listener to be registered.`},stateNotFoundError:{code:`state_not_found`,desc:`State not found. Please verify that the request originated from msal.`},thumbprintMissing:{code:`thumbprint_missing_from_client_certificate`,desc:`Client certificate does not contain a SHA-1 or SHA-256 thumbprint.`},redirectUriNotSupported:{code:`redirect_uri_not_supported`,desc:`RedirectUri is not supported in this scenario. Please remove redirectUri from the request.`}},eu=class e extends M{constructor(e,t,n){super(e,t,n),this.name=`NodeAuthError`}static createInvalidLoopbackAddressTypeError(){return new e(Q.invalidLoopbackAddressType.code,``,`${Q.invalidLoopbackAddressType.desc}`)}static createUnableToLoadRedirectUrlError(){return new e(Q.unableToLoadRedirectUri.code,``,`${Q.unableToLoadRedirectUri.desc}`)}static createNoAuthCodeInResponseError(t=``){return new e(Q.noAuthCodeInResponse.code,t,`${Q.noAuthCodeInResponse.desc}`)}static createNoLoopbackServerExistsError(){return new e(Q.noLoopbackServerExists.code,``,`${Q.noLoopbackServerExists.desc}`)}static createLoopbackServerAlreadyExistsError(){return new e(Q.loopbackServerAlreadyExists.code,``,`${Q.loopbackServerAlreadyExists.desc}`)}static createLoopbackServerTimeoutError(t=``){return new e(Q.loopbackServerTimeout.code,t,`${Q.loopbackServerTimeout.desc}`)}static createStateNotFoundError(t=``){return new e(Q.stateNotFoundError.code,t,Q.stateNotFoundError.desc)}static createThumbprintMissingError(){return new e(Q.thumbprintMissing.code,``,Q.thumbprintMissing.desc)}static createRedirectUriNotSupportedError(t=``){return new e(Q.redirectUriNotSupported.code,t,Q.redirectUriNotSupported.desc)}}}));function nu({auth:e,broker:t,cache:n,system:r,telemetry:i}){let a={...ou,networkClient:new jl,loggerOptions:r?.loggerOptions||au,disableInternalRetries:r?.disableInternalRetries||!1};if(e.clientCertificate&&!e.clientCertificate.thumbprint&&!e.clientCertificate.thumbprintSha256)throw eu.createStateNotFoundError();return{auth:{...iu,...e},broker:{...t},cache:{...n},system:{...a,...r},telemetry:{...su,...i}}}function ru({clientCapabilities:e,managedIdentityIdParams:t,system:n}){let r=new Ql(t),i=n?.loggerOptions||au,a;return a=n?.networkClient?n.networkClient:new jl,{clientCapabilities:e||[],managedIdentityId:r,system:{loggerOptions:i,networkClient:a},disableInternalRetries:n?.disableInternalRetries||!1}}var iu,au,ou,su,cu=t((()=>{W(),Ml(),$l(),tu(),iu={clientId:``,authority:Wn,clientSecret:``,clientAssertion:``,clientCertificate:{thumbprint:``,thumbprintSha256:``,privateKey:``,x5c:``},knownAuthorities:[],cloudDiscoveryMetadata:``,authorityMetadata:``,clientCapabilities:[],azureCloudOptions:{azureCloudInstance:ma.None,tenant:``},isMcp:!1},au={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:U.Info},ou={loggerOptions:au,networkClient:new jl,disableInternalRetries:!1,protocolMode:Ti.AAD},su={application:{appName:``,appVersion:``}}})),lu,uu=t((()=>{lu=class{generateGuid(){return se()}isGuid(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}}})),du,fu=t((()=>{W(),du=class e{static base64Encode(e,t){return Buffer.from(e,t).toString(Mr.BASE64)}static base64EncodeUrl(t,n){return e.base64Encode(t,n).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)}static base64Decode(e){return Buffer.from(e,Mr.BASE64).toString(`utf8`)}static base64DecodeUrl(t){let n=t.replace(/-/g,`+`).replace(/_/g,`/`);for(;n.length%4;)n+=`=`;return e.base64Decode(n)}}})),pu,mu=t((()=>{X(),pu=class{sha256(e){return ce.createHash(Cl.SHA256).update(e).digest()}}})),hu,gu=t((()=>{W(),X(),fu(),mu(),hu=class{constructor(){this.hashUtils=new pu}async generatePkceCodes(){let e=this.generateCodeVerifier();return{verifier:e,challenge:this.generateCodeChallengeFromVerifier(e)}}generateCodeVerifier(){let e=[],t=256-256%wl.CV_CHARSET.length;for(;e.length<=32;){let n=ce.randomBytes(1)[0];if(n>=t)continue;let r=n%wl.CV_CHARSET.length;e.push(wl.CV_CHARSET[r])}let n=e.join(``);return du.base64EncodeUrl(n)}generateCodeChallengeFromVerifier(e){return du.base64EncodeUrl(this.hashUtils.sha256(e).toString(Mr.BASE64),Mr.BASE64)}}})),_u,vu=t((()=>{W(),uu(),fu(),gu(),mu(),_u=class{constructor(){this.pkceGenerator=new hu,this.guidGenerator=new lu,this.hashUtils=new pu}base64UrlEncode(){throw Error(`Method not implemented.`)}encodeKid(){throw Error(`Method not implemented.`)}createNewGuid(){return this.guidGenerator.generateGuid()}base64Encode(e){return du.base64Encode(e)}base64Decode(e){return du.base64Decode(e)}generatePkceCodes(){return this.pkceGenerator.generatePkceCodes()}getPublicKeyThumbprint(){throw Error(`Method not implemented.`)}removeTokenBindingKey(){throw Error(`Method not implemented.`)}clearKeystore(){throw Error(`Method not implemented.`)}signJwt(){throw Error(`Method not implemented.`)}async hashString(e){return du.base64EncodeUrl(this.hashUtils.sha256(e).toString(Mr.BASE64),Mr.BASE64)}}}));function yu(e){let t=Object.keys(e).sort().map(t=>t+e[t]).join(``);return le(`sha256`).update(t,`utf8`).digest(`base64url`)}function bu(e){let t=e.credentialType===D.REFRESH_TOKEN&&e.familyId||e.clientId,n=e.tokenType&&e.tokenType.toLowerCase()!==k.BEARER.toLowerCase()?e.tokenType.toLowerCase():``,r=[e.homeAccountId,e.environment,e.credentialType,t,e.realm||``,e.target||``,n];return e.additionalCacheKeyComponents&&Object.keys(e.additionalCacheKeyComponents).length>0&&r.push(yu(e.additionalCacheKeyComponents)),r.join(Tl.KEY_SEPARATOR).toLowerCase()}function xu(e){let t=e.homeAccountId.split(`.`)[1];return[e.homeAccountId,e.environment,t||e.tenantId||``].join(Tl.KEY_SEPARATOR).toLowerCase()}var Su=t((()=>{W(),X()})),Cu,wu=t((()=>{W(),hl(),Wt(),Su(),Cu=class extends Bs{constructor(e,t,n,r){super(t,n,e,new Gs,r),this.cache={},this.changeEmitters=[],this.logger=e}registerChangeEmitter(e){this.changeEmitters.push(e)}emitChange(){this.changeEmitters.forEach(e=>e.call(null))}cacheToInMemoryCache(e){let t={accounts:{},idTokens:{},accessTokens:{},refreshTokens:{},appMetadata:{}};for(let n in e){let r=e[n];if(typeof r==`object`)if(Ai(r))t.accounts[n]=r;else if(io(r))t.idTokens[n]=r;else if(ro(r))t.accessTokens[n]=r;else if(ao(r))t.refreshTokens[n]=r;else if(lo(n,r))t.appMetadata[n]=r;else continue}return t}inMemoryCacheToCache(e){let t=this.getCache();return t={...t,...e.accounts,...e.idTokens,...e.accessTokens,...e.refreshTokens,...e.appMetadata},t}getInMemoryCache(){return this.logger.trace(`Getting in-memory cache`,``),this.cacheToInMemoryCache(this.getCache())}setInMemoryCache(e){this.logger.trace(`Setting in-memory cache`,``);let t=this.inMemoryCacheToCache(e);this.setCache(t),this.emitChange()}getCache(){return this.logger.trace(`Getting cache key-value store`,``),this.cache}setCache(e){this.logger.trace(`Setting cache key value store`,``),this.cache=e,this.emitChange()}getItem(e){return this.logger.tracePii(`Item key: ${e}`,``),this.getCache()[e]}setItem(e,t){this.logger.tracePii(`Item key: ${e}`,``);let n=this.getCache();n[e]=t,this.setCache(n)}generateCredentialKey(e){return bu(e)}generateAccountKey(e){return xu(e)}getAccountKeys(){let e=this.getInMemoryCache();return Object.keys(e.accounts)}getTokenKeys(){let e=this.getInMemoryCache();return{idToken:Object.keys(e.idTokens),accessToken:Object.keys(e.accessTokens),refreshToken:Object.keys(e.refreshTokens)}}getAccount(e){let t=this.getItem(e);return t&&typeof t==`object`?{...t}:null}async setAccount(e){let t=this.generateAccountKey(Di(e));this.setItem(t,e)}getIdTokenCredential(e){let t=this.getItem(e);return io(t)?t:null}async setIdTokenCredential(e){let t=this.generateCredentialKey(e);this.setItem(t,e)}getAccessTokenCredential(e){let t=this.getItem(e);return ro(t)?t:null}async setAccessTokenCredential(e){let t=this.generateCredentialKey(e);this.setItem(t,e)}getRefreshTokenCredential(e){let t=this.getItem(e);return ao(t)?t:null}async setRefreshTokenCredential(e){let t=this.generateCredentialKey(e);this.setItem(t,e)}getAppMetadata(e){let t=this.getItem(e);return lo(e,t)?t:null}setAppMetadata(e){let t=co(e);this.setItem(t,e)}getServerTelemetry(e){let t=this.getItem(e);return t&&oo(e,t)?t:null}setServerTelemetry(e,t){this.setItem(e,t)}getAuthorityMetadata(e){let t=this.getItem(e);return t&&uo(e,t)?t:null}getAuthorityMetadataKeys(){return this.getKeys().filter(e=>this.isAuthorityMetadata(e))}setAuthorityMetadata(e,t){this.setItem(e,t)}getThrottlingCache(e){let t=this.getItem(e);return t&&so(e,t)?t:null}setThrottlingCache(e,t){this.setItem(e,t)}removeItem(e){this.logger.tracePii(`Item key: ${e}`,``);let t=!1,n=this.getCache();return n[e]&&(delete n[e],t=!0),t&&(this.setCache(n),this.emitChange()),t}removeOutdatedAccount(e){this.removeItem(e)}containsKey(e){return this.getKeys().includes(e)}getKeys(){this.logger.trace(`Retrieving all cache keys`,``);let e=this.getCache();return[...Object.keys(e)]}clear(){this.logger.trace(`Clearing cache entries created by MSAL`,``),this.getKeys().forEach(e=>{this.isAuthorityMetadata(e)||this.removeItem(e)}),this.emitChange()}static generateInMemoryCache(e){return ml.deserializeAllCache(ml.deserializeJSONBlob(e))}static generateJsonCache(e){return Ut.serializeAllCache(e)}updateCredentialCacheKey(e,t){let n=this.generateCredentialKey(t);if(e!==n){let r=this.getItem(e);if(r)return this.removeItem(e),this.setItem(n,r),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`,``),n;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`,``)}return e}}})),Tu,Eu,Du=t((()=>{wu(),W(),hl(),Wt(),uu(),vu(),Tu={Account:{},IdToken:{},AccessToken:{},RefreshToken:{},AppMetadata:{}},Eu=class{constructor(e,t,n){this.cacheHasChanged=!1,this.storage=e,this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this)),n&&(this.persistence=n),this.logger=t}hasChanged(){return this.cacheHasChanged}serialize(){this.logger.trace(`Serializing in-memory cache`,``);let e=Ut.serializeAllCache(this.storage.getInMemoryCache());return this.cacheSnapshot?(this.logger.trace(`Reading cache snapshot from disk`,``),e=this.mergeState(JSON.parse(this.cacheSnapshot),e)):this.logger.trace(`No cache snapshot to merge`,``),this.cacheHasChanged=!1,JSON.stringify(e)}deserialize(e){if(this.logger.trace(`Deserializing JSON to in-memory cache`,``),this.cacheSnapshot=e,this.cacheSnapshot){this.logger.trace(`Reading cache snapshot from disk`,``);let e=ml.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));this.storage.setInMemoryCache(e)}else this.logger.trace(`No cache snapshot to deserialize`,``)}getKVStore(){return this.storage.getCache()}getCacheSnapshot(){let e=Cu.generateInMemoryCache(this.cacheSnapshot);return this.storage.inMemoryCacheToCache(e)}async getAllAccounts(e=new _u().createNewGuid()){this.logger.trace(`getAllAccounts called`,e);let t;try{return this.persistence&&(t=new ic(this,!1),await this.persistence.beforeCacheAccess(t)),this.storage.getAllAccounts({},e)}finally{this.persistence&&t&&await this.persistence.afterCacheAccess(t)}}async getAccountByHomeId(e){let t=await this.getAllAccounts();return e&&t&&t.length&&t.filter(t=>t.homeAccountId===e)[0]||null}async getAccountByLocalId(e){let t=await this.getAllAccounts();return e&&t&&t.length&&t.filter(t=>t.localAccountId===e)[0]||null}async removeAccount(e,t){this.logger.trace(`removeAccount called`,t||``);let n;try{this.persistence&&(n=new ic(this,!0),await this.persistence.beforeCacheAccess(n)),this.storage.removeAccount(e,t||new lu().generateGuid())}finally{this.persistence&&n&&await this.persistence.afterCacheAccess(n)}}async overwriteCache(){if(!this.persistence){this.logger.info(`No persistence layer specified, cache cannot be overwritten`,``);return}this.logger.info(`Overwriting in-memory cache with persistent cache`,``),this.storage.clear();let e=new ic(this,!1);await this.persistence.beforeCacheAccess(e);let t=this.getCacheSnapshot();this.storage.setCache(t),await this.persistence.afterCacheAccess(e)}handleChangeEvent(){this.cacheHasChanged=!0}mergeState(e,t){this.logger.trace(`Merging in-memory cache with cache snapshot`,``);let n=this.mergeRemovals(e,t);return this.mergeUpdates(n,t)}mergeUpdates(e,t){return Object.keys(t).forEach(n=>{let r=t[n];if(!e.hasOwnProperty(n))r!==null&&(e[n]=r);else{let t=r!==null,i=typeof r==`object`,a=!Array.isArray(r),o=e[n]!==void 0&&e[n]!==null;t&&i&&a&&o?this.mergeUpdates(e[n],r):e[n]=r}}),e}mergeRemovals(e,t){this.logger.trace(`Remove updated entries in cache`,``);let n=e.Account?this.mergeRemovalsDict(e.Account,t.Account):e.Account,r=e.AccessToken?this.mergeRemovalsDict(e.AccessToken,t.AccessToken):e.AccessToken,i=e.RefreshToken?this.mergeRemovalsDict(e.RefreshToken,t.RefreshToken):e.RefreshToken,a=e.IdToken?this.mergeRemovalsDict(e.IdToken,t.IdToken):e.IdToken,o=e.AppMetadata?this.mergeRemovalsDict(e.AppMetadata,t.AppMetadata):e.AppMetadata;return{...e,Account:n,AccessToken:r,RefreshToken:i,IdToken:a,AppMetadata:o}}mergeRemovalsDict(e,t){let n={...e};return Object.keys(e).forEach(e=>{(!t||!t.hasOwnProperty(e))&&delete n[e]}),n}overlayDefaults(e){return this.logger.trace(`Overlaying input cache with the default cache`,``),{Account:{...Tu.Account,...e.Account},IdToken:{...Tu.IdToken,...e.IdToken},AccessToken:{...Tu.AccessToken,...e.AccessToken},RefreshToken:{...Tu.RefreshToken,...e.RefreshToken},AppMetadata:{...Tu.AppMetadata,...e.AppMetadata}}}}})),Ou=r(((e,t)=>{var n=u();t.exports=function(e,t){t=t||{};var r=n.decode(e,t);if(!r)return null;var i=r.payload;if(typeof i==`string`)try{var a=JSON.parse(i);typeof a==`object`&&a&&(i=a)}catch{}return t.complete===!0?{header:r.header,payload:i,signature:r.signature}:i}})),ku=r(((e,t)=>{var n=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=`JsonWebTokenError`,this.message=e,t&&(this.inner=t)};n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,t.exports=n})),Au=r(((e,t)=>{var n=ku(),r=function(e,t){n.call(this,e),this.name=`NotBeforeError`,this.date=t};r.prototype=Object.create(n.prototype),r.prototype.constructor=r,t.exports=r})),ju=r(((e,t)=>{var n=ku(),r=function(e,t){n.call(this,e),this.name=`TokenExpiredError`,this.expiredAt=t};r.prototype=Object.create(n.prototype),r.prototype.constructor=r,t.exports=r})),Mu=r(((e,t)=>{var n=o();t.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if(typeof e==`string`){var i=n(e);return i===void 0?void 0:Math.floor(r+i/1e3)}else if(typeof e==`number`)return r+e;else return}})),Nu=r(((e,t)=>{t.exports=d().satisfies(process.version,`>=15.7.0`)})),Pu=r(((e,t)=>{t.exports=d().satisfies(process.version,`>=16.9.0`)})),Fu=r(((e,t)=>{var n=Nu(),r=Pu(),i={ec:[`ES256`,`ES384`,`ES512`],rsa:[`RS256`,`PS256`,`RS384`,`PS384`,`RS512`,`PS512`],"rsa-pss":[`PS256`,`PS384`,`PS512`]},a={ES256:`prime256v1`,ES384:`secp384r1`,ES512:`secp521r1`};t.exports=function(e,t){if(!e||!t)return;let o=t.asymmetricKeyType;if(!o)return;let s=i[o];if(!s)throw Error(`Unknown key type "${o}".`);if(!s.includes(e))throw Error(`"alg" parameter for "${o}" key type must be one of: ${s.join(`, `)}.`);if(n)switch(o){case`ec`:let n=t.asymmetricKeyDetails.namedCurve,i=a[e];if(n!==i)throw Error(`"alg" parameter "${e}" requires curve "${i}".`);break;case`rsa-pss`:if(r){let n=parseInt(e.slice(-3),10),{hashAlgorithm:r,mgf1HashAlgorithm:i,saltLength:a}=t.asymmetricKeyDetails;if(r!==`sha${n}`||i!==r)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(a!==void 0&&a>n>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}break}}})),Iu=r(((e,t)=>{t.exports=d().satisfies(process.version,`^6.12.0 || >=8.0.0`)})),Lu=r(((t,n)=>{var r=ku(),i=Au(),a=ju(),o=Ou(),s=Mu(),c=Fu(),l=Iu(),d=u(),{KeyObject:f,createSecretKey:p,createPublicKey:m}=e(`crypto`),h=[`RS256`,`RS384`,`RS512`],g=[`ES256`,`ES384`,`ES512`],_=[`RS256`,`RS384`,`RS512`],ee=[`HS256`,`HS384`,`HS512`];l&&(h.splice(h.length,0,`PS256`,`PS384`,`PS512`),_.splice(_.length,0,`PS256`,`PS384`,`PS512`)),n.exports=function(e,t,n,l){typeof n==`function`&&!l&&(l=n,n={}),n||(n={}),n=Object.assign({},n);let u;if(u=l||function(e,t){if(e)throw e;return t},n.clockTimestamp&&typeof n.clockTimestamp!=`number`)return u(new r(`clockTimestamp must be a number`));if(n.nonce!==void 0&&(typeof n.nonce!=`string`||n.nonce.trim()===``))return u(new r(`nonce must be a non-empty string`));if(n.allowInvalidAsymmetricKeyTypes!==void 0&&typeof n.allowInvalidAsymmetricKeyTypes!=`boolean`)return u(new r(`allowInvalidAsymmetricKeyTypes must be a boolean`));let te=n.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return u(new r(`jwt must be provided`));if(typeof e!=`string`)return u(new r(`jwt must be a string`));let ne=e.split(`.`);if(ne.length!==3)return u(new r(`jwt malformed`));let re;try{re=o(e,{complete:!0})}catch(e){return u(e)}if(!re)return u(new r(`invalid token`));let ie=re.header,ae;if(typeof t==`function`){if(!l)return u(new r(`verify must be called asynchronous if secret or public key is provided as a callback`));ae=t}else ae=function(e,n){return n(null,t)};return ae(ie,function(t,o){if(t)return u(new r(`error in secret or public key callback: `+t.message));let l=ne[2].trim()!==``;if(!l&&o)return u(new r(`jwt signature is required`));if(l&&!o)return u(new r(`secret or public key must be provided`));if(!l&&!n.algorithms)return u(new r(`please specify "none" in "algorithms" to verify unsigned tokens`));if(o!=null&&!(o instanceof f))try{o=m(o)}catch{try{o=p(typeof o==`string`?Buffer.from(o):o)}catch{return u(new r(`secretOrPublicKey is not valid key material`))}}if(n.algorithms||(o.type===`secret`?n.algorithms=ee:[`rsa`,`rsa-pss`].includes(o.asymmetricKeyType)?n.algorithms=_:o.asymmetricKeyType===`ec`?n.algorithms=g:n.algorithms=h),n.algorithms.indexOf(re.header.alg)===-1)return u(new r(`invalid algorithm`));if(ie.alg.startsWith(`HS`)&&o.type!==`secret`)return u(new r(`secretOrPublicKey must be a symmetric key when using ${ie.alg}`));if(/^(?:RS|PS|ES)/.test(ie.alg)&&o.type!==`public`)return u(new r(`secretOrPublicKey must be an asymmetric key when using ${ie.alg}`));if(!n.allowInvalidAsymmetricKeyTypes)try{c(ie.alg,o)}catch(e){return u(e)}let ae;try{ae=d.verify(e,re.header.alg,o)}catch(e){return u(e)}if(!ae)return u(new r(`invalid signature`));let v=re.payload;if(v.nbf!==void 0&&!n.ignoreNotBefore){if(typeof v.nbf!=`number`)return u(new r(`invalid nbf value`));if(v.nbf>te+(n.clockTolerance||0))return u(new i(`jwt not active`,new Date(v.nbf*1e3)))}if(v.exp!==void 0&&!n.ignoreExpiration){if(typeof v.exp!=`number`)return u(new r(`invalid exp value`));if(te>=v.exp+(n.clockTolerance||0))return u(new a(`jwt expired`,new Date(v.exp*1e3)))}if(n.audience){let e=Array.isArray(n.audience)?n.audience:[n.audience];if(!(Array.isArray(v.aud)?v.aud:[v.aud]).some(function(t){return e.some(function(e){return e instanceof RegExp?e.test(t):e===t})}))return u(new r(`jwt audience invalid. expected: `+e.join(` or `)))}if(n.issuer&&(typeof n.issuer==`string`&&v.iss!==n.issuer||Array.isArray(n.issuer)&&n.issuer.indexOf(v.iss)===-1))return u(new r(`jwt issuer invalid. expected: `+n.issuer));if(n.subject&&v.sub!==n.subject)return u(new r(`jwt subject invalid. expected: `+n.subject));if(n.jwtid&&v.jti!==n.jwtid)return u(new r(`jwt jwtid invalid. expected: `+n.jwtid));if(n.nonce&&v.nonce!==n.nonce)return u(new r(`jwt nonce invalid. expected: `+n.nonce));if(n.maxAge){if(typeof v.iat!=`number`)return u(new r(`iat required when maxAge is specified`));let e=s(n.maxAge,v.iat);if(e===void 0)return u(new r(`"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60`));if(te>=e+(n.clockTolerance||0))return u(new a(`maxAge exceeded`,new Date(e*1e3)))}if(n.complete===!0){let e=re.signature;return u(null,{header:ie,payload:v,signature:e})}return u(null,v)})}})),Ru=r(((e,t)=>{var n=9007199254740991,r=NaN,i=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=/^(?:0|[1-9]\d*)$/,l=parseInt;function u(e,t){for(var n=-1,r=e?e.length:0,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function d(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function f(e,t,n){if(t!==t)return d(e,p,n);for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function p(e){return e!==e}function m(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function h(e,t){return u(t,function(t){return e[t]})}function g(e,t){return function(n){return e(t(n))}}var _=Object.prototype,ee=_.hasOwnProperty,te=_.toString,ne=_.propertyIsEnumerable,re=g(Object.keys,Object),ie=Math.max;function ae(e,t){var n=ue(e)||le(e)?m(e.length,String):[],r=n.length,i=!!r;for(var a in e)(t||ee.call(e,a))&&!(i&&(a==`length`||oe(a,r)))&&n.push(a);return n}function v(e){if(!se(e))return re(e);var t=[];for(var n in Object(e))ee.call(e,n)&&n!=`constructor`&&t.push(n);return t}function oe(e,t){return t=t??n,!!t&&(typeof e==`number`||c.test(e))&&e>-1&&e%1==0&&e<t}function se(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||_)}function ce(e,t,n,r){e=de(e)?e:Ce(e),n=n&&!r?be(n):0;var i=e.length;return n<0&&(n=ie(i+n,0)),_e(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&f(e,t,n)>-1}function le(e){return fe(e)&&ee.call(e,`callee`)&&(!ne.call(e,`callee`)||te.call(e)==`[object Arguments]`)}var ue=Array.isArray;function de(e){return e!=null&&me(e.length)&&!pe(e)}function fe(e){return ge(e)&&de(e)}function pe(e){var t=he(e)?te.call(e):``;return t==`[object Function]`||t==`[object GeneratorFunction]`}function me(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}function he(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function ge(e){return!!e&&typeof e==`object`}function _e(e){return typeof e==`string`||!ue(e)&&ge(e)&&te.call(e)==`[object String]`}function ve(e){return typeof e==`symbol`||ge(e)&&te.call(e)==`[object Symbol]`}function ye(e){return e?(e=xe(e),e===1/0||e===-1/0?(e<0?-1:1)*17976931348623157e292:e===e?e:0):e===0?e:0}function be(e){var t=ye(e),n=t%1;return t===t?n?t-n:t:0}function xe(e){if(typeof e==`number`)return e;if(ve(e))return r;if(he(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=he(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(i,``);var n=o.test(e);return n||s.test(e)?l(e.slice(2),n?2:8):a.test(e)?r:+e}function Se(e){return de(e)?ae(e):v(e)}function Ce(e){return e?h(e,Se(e)):[]}t.exports=ce})),zu=r(((e,t)=>{var n=Object.prototype.toString;function r(e){return e===!0||e===!1||i(e)&&n.call(e)==`[object Boolean]`}function i(e){return!!e&&typeof e==`object`}t.exports=r})),Bu=r(((e,t)=>{var n=NaN,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=Object.prototype.toString;function l(e){return typeof e==`number`&&e==m(e)}function u(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function d(e){return!!e&&typeof e==`object`}function f(e){return typeof e==`symbol`||d(e)&&c.call(e)==`[object Symbol]`}function p(e){return e?(e=h(e),e===1/0||e===-1/0?(e<0?-1:1)*17976931348623157e292:e===e?e:0):e===0?e:0}function m(e){var t=p(e),n=t%1;return t===t?n?t-n:t:0}function h(e){if(typeof e==`number`)return e;if(f(e))return n;if(u(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=u(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?n:+e}t.exports=l})),Vu=r(((e,t)=>{var n=Object.prototype.toString;function r(e){return!!e&&typeof e==`object`}function i(e){return typeof e==`number`||r(e)&&n.call(e)==`[object Number]`}t.exports=i})),Hu=r(((e,t)=>{function n(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function r(e,t){return function(n){return e(t(n))}}var i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,c=o.call(Object),l=a.toString,u=r(Object.getPrototypeOf,Object);function d(e){return!!e&&typeof e==`object`}function f(e){if(!d(e)||l.call(e)!=`[object Object]`||n(e))return!1;var t=u(e);if(t===null)return!0;var r=s.call(t,`constructor`)&&t.constructor;return typeof r==`function`&&r instanceof r&&o.call(r)==c}t.exports=f})),Uu=r(((e,t)=>{var n=Object.prototype.toString,r=Array.isArray;function i(e){return!!e&&typeof e==`object`}function a(e){return typeof e==`string`||!r(e)&&i(e)&&n.call(e)==`[object String]`}t.exports=a})),Wu=r(((e,t)=>{var n=NaN,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=Object.prototype.toString;function l(e,t){var n;if(typeof t!=`function`)throw TypeError(`Expected a function`);return e=h(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}function u(e){return l(2,e)}function d(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function f(e){return!!e&&typeof e==`object`}function p(e){return typeof e==`symbol`||f(e)&&c.call(e)==`[object Symbol]`}function m(e){return e?(e=g(e),e===1/0||e===-1/0?(e<0?-1:1)*17976931348623157e292:e===e?e:0):e===0?e:0}function h(e){var t=m(e),n=t%1;return t===t?n?t-n:t:0}function g(e){if(typeof e==`number`)return e;if(p(e))return n;if(d(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=d(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?n:+e}t.exports=u})),Gu=r(((t,n)=>{var r=Mu(),i=Iu(),a=Fu(),o=u(),s=Ru(),c=zu(),l=Bu(),d=Vu(),f=Hu(),p=Uu(),m=Wu(),{KeyObject:h,createSecretKey:g,createPrivateKey:_}=e(`crypto`),ee=[`RS256`,`RS384`,`RS512`,`ES256`,`ES384`,`ES512`,`HS256`,`HS384`,`HS512`,`none`];i&&ee.splice(3,0,`PS256`,`PS384`,`PS512`);var te={expiresIn:{isValid:function(e){return l(e)||p(e)&&e},message:`"expiresIn" should be a number of seconds or string representing a timespan`},notBefore:{isValid:function(e){return l(e)||p(e)&&e},message:`"notBefore" should be a number of seconds or string representing a timespan`},audience:{isValid:function(e){return p(e)||Array.isArray(e)},message:`"audience" must be a string or array`},algorithm:{isValid:s.bind(null,ee),message:`"algorithm" must be a valid string enum value`},header:{isValid:f,message:`"header" must be an object`},encoding:{isValid:p,message:`"encoding" must be a string`},issuer:{isValid:p,message:`"issuer" must be a string`},subject:{isValid:p,message:`"subject" must be a string`},jwtid:{isValid:p,message:`"jwtid" must be a string`},noTimestamp:{isValid:c,message:`"noTimestamp" must be a boolean`},keyid:{isValid:p,message:`"keyid" must be a string`},mutatePayload:{isValid:c,message:`"mutatePayload" must be a boolean`},allowInsecureKeySizes:{isValid:c,message:`"allowInsecureKeySizes" must be a boolean`},allowInvalidAsymmetricKeyTypes:{isValid:c,message:`"allowInvalidAsymmetricKeyTypes" must be a boolean`}},ne={iat:{isValid:d,message:`"iat" should be a number of seconds`},exp:{isValid:d,message:`"exp" should be a number of seconds`},nbf:{isValid:d,message:`"nbf" should be a number of seconds`}};function re(e,t,n,r){if(!f(n))throw Error(`Expected "`+r+`" to be a plain object.`);Object.keys(n).forEach(function(i){let a=e[i];if(!a){if(!t)throw Error(`"`+i+`" is not allowed in "`+r+`"`);return}if(!a.isValid(n[i]))throw Error(a.message)})}function ie(e){return re(te,!1,e,`options`)}function ae(e){return re(ne,!0,e,`payload`)}var v={audience:`aud`,issuer:`iss`,subject:`sub`,jwtid:`jti`},oe=[`expiresIn`,`notBefore`,`noTimestamp`,`audience`,`issuer`,`subject`,`jwtid`];n.exports=function(e,t,n,i){typeof n==`function`?(i=n,n={}):n=n||{};let s=typeof e==`object`&&!Buffer.isBuffer(e),c=Object.assign({alg:n.algorithm||`HS256`,typ:s?`JWT`:void 0,kid:n.keyid},n.header);function l(e){if(i)return i(e);throw e}if(!t&&n.algorithm!==`none`)return l(Error(`secretOrPrivateKey must have a value`));if(t!=null&&!(t instanceof h))try{t=_(t)}catch{try{t=g(typeof t==`string`?Buffer.from(t):t)}catch{return l(Error(`secretOrPrivateKey is not valid key material`))}}if(c.alg.startsWith(`HS`)&&t.type!==`secret`)return l(Error(`secretOrPrivateKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)){if(t.type!==`private`)return l(Error(`secretOrPrivateKey must be an asymmetric key when using ${c.alg}`));if(!n.allowInsecureKeySizes&&!c.alg.startsWith(`ES`)&&t.asymmetricKeyDetails!==void 0&&t.asymmetricKeyDetails.modulusLength<2048)return l(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`))}if(e===void 0)return l(Error(`payload is required`));if(s){try{ae(e)}catch(e){return l(e)}n.mutatePayload||(e=Object.assign({},e))}else{let t=oe.filter(function(e){return n[e]!==void 0});if(t.length>0)return l(Error(`invalid `+t.join(`,`)+` option for `+typeof e+` payload`))}if(e.exp!==void 0&&n.expiresIn!==void 0)return l(Error(`Bad "options.expiresIn" option the payload already has an "exp" property.`));if(e.nbf!==void 0&&n.notBefore!==void 0)return l(Error(`Bad "options.notBefore" option the payload already has an "nbf" property.`));try{ie(n)}catch(e){return l(e)}if(!n.allowInvalidAsymmetricKeyTypes)try{a(c.alg,t)}catch(e){return l(e)}let u=e.iat||Math.floor(Date.now()/1e3);if(n.noTimestamp?delete e.iat:s&&(e.iat=u),n.notBefore!==void 0){try{e.nbf=r(n.notBefore,u)}catch(e){return l(e)}if(e.nbf===void 0)return l(Error(`"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60`))}if(n.expiresIn!==void 0&&typeof e==`object`){try{e.exp=r(n.expiresIn,u)}catch(e){return l(e)}if(e.exp===void 0)return l(Error(`"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60`))}Object.keys(v).forEach(function(t){let r=v[t];if(n[t]!==void 0){if(e[r]!==void 0)return l(Error(`Bad "options.`+t+`" option. The payload already has an "`+r+`" property.`));e[r]=n[t]}});let d=n.encoding||`utf8`;if(typeof i==`function`)i=i&&m(i),o.createSign({header:c,privateKey:t,payload:e,encoding:d}).once(`error`,i).once(`done`,function(e){if(!n.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&e.length<256)return i(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`));i(null,e)});else{let r=o.sign({header:c,payload:e,secret:t,encoding:d});if(!n.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&r.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`);return r}}})),Ku=r(((e,t)=>{t.exports={decode:Ou(),verify:Lu(),sign:Gu(),JsonWebTokenError:ku(),NotBeforeError:Au(),TokenExpiredError:ju()}})),qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd=t((()=>{qu=`missing_tenant_id_error`,Ju=`user_timeout_reached`,Yu=`invalid_assertion`,Xu=`invalid_client_credential`,Zu=`empty_fic_assertion`,Qu=`conflicting_user_identifiers`,$u=`missing_user_identifier`,ed=`device_code_polling_cancelled`,td=`device_code_expired`,nd=`device_code_unknown_error`})),id,ad,od=t((()=>{id=n(Ku(),1),W(),fu(),X(),rd(),ad=class e{static fromAssertion(t){let n=new e;return n.jwt=t,n}static fromCertificate(t,n,r){let i=new e;return i.privateKey=n,i.thumbprint=t,i.useSha256=!1,r&&(i.publicCertificate=this.parseCertificate(r)),i}static fromCertificateWithSha256Thumbprint(t,n,r){let i=new e;return i.privateKey=n,i.thumbprint=t,i.useSha256=!0,r&&(i.publicCertificate=this.parseCertificate(r)),i}getJwt(e,t,n){if(this.privateKey&&this.thumbprint)return this.jwt&&!this.isExpired()&&t===this.issuer&&n===this.jwtAudience?this.jwt:this.createJwt(e,t,n);if(this.jwt)return this.jwt;throw N(Yu,``)}createJwt(e,t,n){this.issuer=t,this.jwtAudience=n;let r=B();this.expirationTime=r+600;let i={alg:this.useSha256?Dl.PSS_256:Dl.RSA_256},a=this.useSha256?Dl.X5T_256:Dl.X5T;Object.assign(i,{[a]:du.base64EncodeUrl(this.thumbprint,Mr.HEX)}),this.publicCertificate&&Object.assign(i,{[Dl.X5C]:this.publicCertificate});let o={[Dl.AUDIENCE]:this.jwtAudience,[Dl.EXPIRATION_TIME]:this.expirationTime,[Dl.ISSUER]:this.issuer,[Dl.SUBJECT]:this.issuer,[Dl.NOT_BEFORE]:r,[Dl.JWT_ID]:e.createNewGuid()};return this.jwt=id.default.sign(o,this.privateKey,{header:i}),this.jwt}isExpired(){return this.expirationTime<B()}static parseCertificate(e){let t=/-----BEGIN CERTIFICATE-----\r*\n(.+?)\r*\n-----END CERTIFICATE-----/gs,n=[],r;for(;(r=t.exec(e))!==null;)n.push(r[1].replace(/\r*\n/g,``));return n}}})),sd,cd,ld=t((()=>{sd=`@azure/msal-node`,cd=`5.4.0`})),ud,dd=t((()=>{W(),ld(),ud=class{constructor(e){this.config=qs(e),this.logger=new ks(this.config.loggerOptions,sd,cd),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=new Gs}createTokenRequestHeaders(e){return Hc(this.logger,!1,e)}async executePostToTokenEndpoint(e,t,n,r,i){return Wc(e,t,n,r,i,this.cacheManager,this.networkClient,this.logger,this.performanceClient,this.serverTelemetryManager)}async sendPostRequest(e,t,n,r){return Gc(e,t,n,r,this.cacheManager,this.networkClient,this.logger,this.performanceClient)}createTokenQueryParameters(e){return Uc(e,this.config.authOptions.clientId,this.config.authOptions.redirectUri,this.performanceClient)}}})),fd,pd=t((()=>{W(),X(),dd(),fd=class extends ud{constructor(e){super(e)}async acquireToken(e){this.logger.info(`in acquireToken call in username-password client`,e.correlationId);let t=B(),n=await this.executeTokenRequest(this.authority,e),r=new kc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.performanceClient,this.config.serializableCache,this.config.persistencePlugin);return r.validateTokenResponse(n.body,e.correlationId),r.handleServerTokenResponse(n.body,this.authority,t,e,Y.acquireTokenByUsernamePassword)}async executeTokenRequest(e,t){let n=this.createTokenQueryParameters(t),r=R.appendQueryString(e.tokenEndpoint,n),i=await this.createTokenRequestBody(t),a=this.createTokenRequestHeaders({credential:t.username,type:jc.UPN}),o={clientId:this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return this.executePostToTokenEndpoint(r,i,a,o,t.correlationId)}async createTokenRequestBody(e){let t=new Map;ko(t,this.config.authOptions.clientId),ss(t,e.username),cs(t,e.password),Oo(t,e.scopes,e.correlationId),Eo(t,mr.IDTOKEN_TOKEN),ts(t,gr.RESOURCE_OWNER_PASSWORD_GRANT),ns(t),Bo(t,this.config.libraryInfo),Vo(t,this.config.telemetry.application),fs(t),this.serverTelemetryManager&&ds(t,this.serverTelemetryManager),zo(t,e.correlationId||this.config.cryptoInterface.createNewGuid()),this.config.clientCredentials.clientSecret&&Xo(t,this.config.clientCredentials.clientSecret);let n=this.config.clientCredentials.clientAssertion;return n&&(Zo(t,await Nc(n.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),Qo(t,n.assertionType)),(!ea.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&Ro(t,e.correlationId,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.username&&Fo(t,e.username),H(t)}}}));function md(e,t,n,r){let i=Yc({...e.auth,authority:t,redirectUri:n.redirectUri||``},n,r);return Bo(i,{sku:El.MSAL_SKU,version:cd,cpu:process.arch||``,os:process.platform||``}),e.system.protocolMode!==Ti.OIDC&&Vo(i,e.telemetry.application),Eo(i,mr.CODE),n.codeChallenge&&n.codeChallengeMethod&&Go(i,n.codeChallenge,n.codeChallengeMethod),as(i,n.extraQueryParameters||{}),Xc(t,i)}var hd=t((()=>{W(),X(),ld()})),gd,_d=t((()=>{W(),cu(),vu(),wu(),X(),Du(),od(),ld(),tu(),pd(),hd(),gd=class{constructor(e){this.config=nu(e),this.cryptoProvider=new _u,this.logger=new ks(this.config.system.loggerOptions,sd,cd),this.storage=new Cu(this.logger,this.config.auth.clientId,this.cryptoProvider,yo(this.config.auth)),this.tokenCache=new Eu(this.storage,this.logger,this.config.cache.cachePlugin)}async getAuthCodeUrl(e){this.logger.info(`getAuthCodeUrl called`,e.correlationId||``);let t={...e,...await this.initializeBaseRequest(e),responseMode:e.responseMode||hr.QUERY,authenticationScheme:k.BEARER,state:e.state||``,nonce:e.nonce||``},n=await this.createAuthority(t.authority,t.correlationId,void 0,e.azureCloudOptions);return md(this.config,n,t,this.logger)}async acquireTokenByCode(e,t){this.logger.info(`acquireTokenByCode called`,e.correlationId||``),e.state&&t&&(this.logger.info(`acquireTokenByCode - validating state`,e.correlationId||``),this.validateState(e.state,t.state||``,e.correlationId||``),t={...t,state:``});let n={...e,...await this.initializeBaseRequest(e),authenticationScheme:k.BEARER},r=this.initializeServerTelemetryManager(Y.acquireTokenByCode,n.correlationId);try{let i=await this.createAuthority(n.authority,n.correlationId,void 0,e.azureCloudOptions),a=new qc(await this.buildOauthClientConfiguration(i,n.correlationId,n.redirectUri,r),new Gs);return this.logger.verbose(`Auth code client created`,n.correlationId),await a.acquireToken(n,Y.acquireTokenByCode,t)}catch(e){throw e instanceof M&&(e.correlationId=n.correlationId),r.cacheFailedRequest(e),e}}async acquireTokenByRefreshToken(e){this.logger.info(`acquireTokenByRefreshToken called`,e.correlationId||``);let t={...e,...await this.initializeBaseRequest(e),authenticationScheme:k.BEARER},n=this.initializeServerTelemetryManager(Y.acquireTokenByRefreshToken,t.correlationId);try{let r=await this.createAuthority(t.authority,t.correlationId,void 0,e.azureCloudOptions),i=new tl(await this.buildOauthClientConfiguration(r,t.correlationId,t.redirectUri||``,n),new Gs);return this.logger.verbose(`Refresh token client created`,t.correlationId),await i.acquireToken(t,Y.acquireTokenByRefreshToken)}catch(e){throw e instanceof M&&(e.correlationId=t.correlationId),n.cacheFailedRequest(e),e}}async acquireTokenSilent(e){let t={...e,...await this.initializeBaseRequest(e),forceRefresh:e.forceRefresh||!1},n=this.initializeServerTelemetryManager(Y.acquireTokenSilent,t.correlationId,t.forceRefresh);try{let r=await this.createAuthority(t.authority,t.correlationId,void 0,e.azureCloudOptions),i=await this.buildOauthClientConfiguration(r,t.correlationId,t.redirectUri||``,n),a=new ll(i,new Gs);this.logger.verbose(`Silent flow client created`,t.correlationId);try{return await this.tokenCache.overwriteCache(),await this.acquireCachedTokenSilent(t,a,i)}catch(e){if(e instanceof Ir&&e.errorCode===`token_refresh_required`)return new tl(i,new Gs).acquireTokenByRefreshToken(t,Y.acquireTokenSilent);throw e}}catch(e){throw e instanceof M&&(e.correlationId=t.correlationId),n.cacheFailedRequest(e),e}}async acquireCachedTokenSilent(e,t,n){let[r,i]=await t.acquireCachedToken({...e,scopes:e.scopes?.length?e.scopes:[...cr]});if(i===A.PROACTIVELY_REFRESHED){this.logger.info(`ClientApplication:acquireCachedTokenSilent - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.`,e.correlationId);let t=new tl(n,new Gs);try{await t.acquireTokenByRefreshToken(e,Y.acquireTokenSilent)}catch{}}return r}async acquireTokenByUsernamePassword(e){this.logger.info(`acquireTokenByUsernamePassword called`,e.correlationId||``);let t={...e,...await this.initializeBaseRequest(e)},n=this.initializeServerTelemetryManager(Y.acquireTokenByUsernamePassword,t.correlationId);try{let r=await this.createAuthority(t.authority,t.correlationId,void 0,e.azureCloudOptions),i=new fd(await this.buildOauthClientConfiguration(r,t.correlationId,``,n));return this.logger.verbose(`Username password client created`,t.correlationId),await i.acquireToken(t)}catch(e){throw e instanceof M&&(e.correlationId=t.correlationId),n.cacheFailedRequest(e),e}}getTokenCache(){return this.logger.info(`getTokenCache called`,``),this.tokenCache}validateState(e,t,n){if(!e)throw eu.createStateNotFoundError(n);if(e!==t)throw N(Kr,n)}getLogger(){return this.logger}setLogger(e){this.logger=e}async buildOauthClientConfiguration(e,t,n,r){return this.logger.verbose(`buildOauthClientConfiguration called`,t),this.logger.info(`Building oauth client configuration with the following authority: ${e.tokenEndpoint}.`,t),r?.updateRegionDiscoveryMetadata(e.regionDiscoveryMetadata),{authOptions:{clientId:this.config.auth.clientId,authority:e,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:n,isMcp:this.config.auth.isMcp},loggerOptions:{logLevel:this.config.system.loggerOptions.logLevel,loggerCallback:this.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:this.config.system.loggerOptions.piiLoggingEnabled,correlationId:t},cryptoInterface:this.cryptoProvider,networkInterface:this.config.system.networkClient,storageInterface:this.storage,serverTelemetryManager:r,clientCredentials:{clientSecret:this.clientSecret,clientAssertion:await this.getClientAssertion(e)},libraryInfo:{sku:El.MSAL_SKU,version:cd,cpu:process.arch||``,os:process.platform||``},telemetry:this.config.telemetry,persistencePlugin:this.config.cache.cachePlugin,serializableCache:this.tokenCache}}async getClientAssertion(e){return this.developerProvidedClientAssertion&&(this.clientAssertion=ad.fromAssertion(await Nc(this.developerProvidedClientAssertion,this.config.auth.clientId,e.tokenEndpoint))),this.clientAssertion&&{assertion:this.clientAssertion.getJwt(this.cryptoProvider,this.config.auth.clientId,e.tokenEndpoint),assertionType:El.JWT_BEARER_ASSERTION_TYPE}}async initializeBaseRequest(e){let t=e.correlationId||this.cryptoProvider.createNewGuid();return this.logger.verbose(`initializeRequestScopes called`,t),e.authenticationScheme&&e.authenticationScheme===k.POP&&this.logger.verbose(`Authentication Scheme 'pop' is not supported yet, setting Authentication Scheme to 'Bearer' for request`,t),e.authenticationScheme=k.BEARER,{...e,scopes:[...e&&e.scopes||[],...cr],correlationId:t,authority:e.authority||this.config.auth.authority}}initializeServerTelemetryManager(e,t,n){return new sl({clientId:this.config.auth.clientId,correlationId:t,apiId:e,forceRefresh:n||!1},this.storage)}async createAuthority(e,t,n,r){this.logger.verbose(`createAuthority called`,t);let i=bo.generateAuthority(e,r||this.config.auth.azureCloudOptions),a={protocolMode:this.config.system.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,azureRegionConfiguration:n};return So(i,this.config.system.networkClient,this.storage,a,this.logger,t,new Gs)}clearCache(){this.storage.clear()}}})),vd,yd=t((()=>{W(),tu(),X(),vd=class{constructor(e){this.preferredPort=e}async listenForAuthCode(e,t){if(this.server)throw eu.createLoopbackServerAlreadyExistsError();return new Promise((n,r)=>{this.server=de.createServer((i,a)=>{let o=i.method?.toUpperCase();if(o!==`GET`&&o!==`POST`){a.writeHead(405,{Allow:`GET, POST`}),a.end(`Method Not Allowed`);return}let s=i.url;if(!s){a.end(t||`Error occurred loading redirectUrl`),r(eu.createUnableToLoadRedirectUrlError());return}else if(s===`/`){if(o===`POST`){this.handlePostRequest(i,a,n,e,t);return}a.end(e||`Auth code was successfully acquired. You can close this window now.`);return}if(o===`GET`){let e=this.getRedirectUri(),r=ys(new URL(s,e).search)||{};if(!r.code&&!r.error){a.writeHead(200),a.end();return}r.code&&(a.writeHead(302,{location:e}),a.end()),r.error&&a.end(t||`Error occurred: ${r.error}`),n(r)}else a.writeHead(200),a.end()});let i=this.preferredPort||0;this.server.on(`error`,e=>{e.code===`EADDRINUSE`&&this.preferredPort&&i!==0?this.server?.listen(0,`127.0.0.1`):r(e)}),this.server.listen(i,`127.0.0.1`)})}handlePostRequest(e,t,n,r,i){if(e.headers[`content-type`]?.split(`;`)[0]?.trim()!==`application/x-www-form-urlencoded`){t.writeHead(415),t.end(`Unsupported Media Type`);return}let a=``;e.on(`error`,()=>{t.headersSent||t.writeHead(400),t.end()}),e.on(`data`,e=>{a+=e.toString()}),e.on(`end`,()=>{let e=ys(`?${a}`)||{};if(!e.code&&!e.error){t.writeHead(200),t.end();return}e.error?(t.writeHead(200),t.end(i||`Error occurred: ${e.error}`)):(t.writeHead(200),t.end(r||`Auth code was successfully acquired. You can close this window now.`)),n(e)})}getRedirectUri(){if(!this.server||!this.server.listening)throw eu.createNoLoopbackServerExistsError();let e=this.server.address();if(!e||typeof e==`string`||!e.port)throw this.closeServer(),eu.createInvalidLoopbackAddressTypeError();let t=e&&e.port;return`${El.HTTP_PROTOCOL}${El.LOCALHOST}:${t}`}closeServer(){this.server&&(this.server.close(),typeof this.server.closeAllConnections==`function`&&this.server.closeAllConnections(),this.server.unref(),this.server=void 0)}}})),bd,xd=t((()=>{W(),X(),rd(),dd(),bd=class extends ud{constructor(e){super(e)}async acquireToken(e){let t=await this.getDeviceCode(e);e.deviceCodeCallback(t);let n=B(),r=await this.acquireTokenWithDeviceCode(e,t),i=new kc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.performanceClient,this.config.serializableCache,this.config.persistencePlugin);return i.validateTokenResponse(r,e.correlationId),i.handleServerTokenResponse(r,this.authority,n,e,Y.acquireTokenByDeviceCode)}async getDeviceCode(e){let t=this.createExtraQueryParameters(e),n=R.appendQueryString(this.authority.deviceCodeEndpoint,t),r=this.createQueryString(e),i=this.createTokenRequestHeaders(),a={clientId:this.config.authOptions.clientId,authority:e.authority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return this.executePostRequestToDeviceCodeEndpoint(n,r,i,a,e.correlationId)}createExtraQueryParameters(e){let t=new Map;return e.extraQueryParameters&&as(t,e.extraQueryParameters),H(t)}async executePostRequestToDeviceCodeEndpoint(e,t,n,r,i){let{body:{user_code:a,device_code:o,verification_uri:s,expires_in:c,interval:l,message:u}}=await this.sendPostRequest(r,e,{body:t,headers:n},i);return{userCode:a,deviceCode:o,verificationUri:s,expiresIn:c,interval:l,message:u}}createQueryString(e){let t=new Map;return Oo(t,e.scopes,e.correlationId),ko(t,this.config.authOptions.clientId),e.extraQueryParameters&&as(t,e.extraQueryParameters),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&Ro(t,e.correlationId,e.claims,this.config.authOptions.clientCapabilities),H(t)}continuePolling(e,t,n,r){if(r)throw this.logger.error(`Token request cancelled by setting DeviceCodeRequest.cancel = true`,t),N(ed,t);if(n&&n<e&&B()>n)throw this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${n}`,t),N(Ju,t);if(B()>e)throw n&&this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${n}`,t),this.logger.error(`Device code expired. Expiration time of device code was ${e}`,t),N(td,t);return!0}async acquireTokenWithDeviceCode(e,t){let n=this.createTokenQueryParameters(e),r=R.appendQueryString(this.authority.tokenEndpoint,n),i=this.createTokenRequestBody(e,t),a=this.createTokenRequestHeaders(),o=e.timeout?B()+e.timeout:void 0,s=B()+t.expiresIn,c=t.interval*1e3;for(;this.continuePolling(s,e.correlationId,o,e.cancel);){let t={clientId:this.config.authOptions.clientId,authority:e.authority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid},n=await this.executePostToTokenEndpoint(r,i,a,t,e.correlationId);if(n.body&&n.body.error)if(n.body.error===`authorization_pending`)this.logger.info(`Authorization pending. Continue polling.`,e.correlationId),await Za(c);else throw this.logger.info(`Unexpected error in polling from the server`,e.correlationId),Pr(Mi,e.correlationId,n.body.error);else return this.logger.verbose(`Authorization completed successfully. Polling stopped.`,e.correlationId),n.body}throw this.logger.error(`Polling stopped for unknown reasons.`,e.correlationId),N(nd,e.correlationId)}createTokenRequestBody(e,t){let n=new Map;return Oo(n,e.scopes,e.correlationId),ko(n,this.config.authOptions.clientId),ts(n,gr.DEVICE_CODE_GRANT),qo(n,t.deviceCode),zo(n,e.correlationId||this.config.cryptoInterface.createNewGuid()),ns(n),Bo(n,this.config.libraryInfo),Vo(n,this.config.telemetry.application),fs(n),this.serverTelemetryManager&&ds(n,this.serverTelemetryManager),(!ea.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&Ro(n,e.correlationId,e.claims,this.config.authOptions.clientCapabilities),H(n)}}})),Sd,Cd=t((()=>{X(),W(),_d(),tu(),yd(),xd(),ld(),Sd=class extends gd{constructor(e){super(e),this.config.broker.nativeBrokerPlugin&&(this.config.broker.nativeBrokerPlugin.isBrokerAvailable?(this.nativeBrokerPlugin=this.config.broker.nativeBrokerPlugin,this.nativeBrokerPlugin.setLogger(this.config.system.loggerOptions)):this.logger.warning(`NativeBroker implementation was provided but the broker is unavailable.`,``)),this.skus=sl.makeExtraSkuString({libraryName:El.MSAL_SKU,libraryVersion:cd})}async acquireTokenByDeviceCode(e){this.logger.info(`acquireTokenByDeviceCode called`,e.correlationId||``),dl(this.config.auth.isMcp,e);let t=Object.assign(e,await this.initializeBaseRequest(e)),n=this.initializeServerTelemetryManager(Y.acquireTokenByDeviceCode,t.correlationId);try{let r=await this.createAuthority(t.authority,t.correlationId,void 0,e.azureCloudOptions),i=new bd(await this.buildOauthClientConfiguration(r,t.correlationId,``,n));return this.logger.verbose(`Device code client created`,t.correlationId),await i.acquireToken(t)}catch(e){throw e instanceof M&&(e.correlationId=t.correlationId),n.cacheFailedRequest(e),e}}async acquireTokenInteractive(e){let t=e.correlationId||this.cryptoProvider.createNewGuid();this.logger.trace(`acquireTokenInteractive called`,t),dl(this.config.auth.isMcp,e);let{openBrowser:n,successTemplate:r,errorTemplate:i,windowHandle:a,loopbackClient:o,preferredPort:s,...c}=e;if(o&&this.logger.warning(`The loopbackClient option is deprecated and will be removed in a future major version. Omit it to use the built-in loopback server, and set preferredPort when a fixed port is required.`,t),this.nativeBrokerPlugin){let n={...c,clientId:this.config.auth.clientId,scopes:e.scopes||cr,redirectUri:e.redirectUri||``,authority:e.authority||this.config.auth.authority,correlationId:t,extraParameters:{...c.extraQueryParameters,...c.extraParameters,[Mn]:this.skus},accountId:c.account?.nativeAccountId};return this.nativeBrokerPlugin.acquireTokenInteractive(n,a)}if(e.redirectUri){if(!this.config.broker.nativeBrokerPlugin)throw eu.createRedirectUriNotSupportedError(t);e.redirectUri=``}let{verifier:l,challenge:u}=await this.cryptoProvider.generatePkceCodes(),d=o||new vd(s),f=c.responseMode??hr.QUERY;if(f!==hr.QUERY&&f!==hr.FORM_POST)throw L(Xi,t);let p={},m=null;try{let a=d.listenForAuthCode(r,i).then(e=>{p=e}).catch(e=>{m=e}),o=await this.waitForRedirectUri(d,t),s={...c,correlationId:t,scopes:e.scopes||cr,redirectUri:o,responseMode:f,codeChallenge:u,codeChallengeMethod:pr.S256};if(await n(await this.getAuthCodeUrl(s)),await a,m)throw m;if(p.error)throw new wc(p.error,t,p.error_description,p.suberror);if(!p.code)throw eu.createNoAuthCodeInResponseError(t);let h=p.client_info,g={code:p.code,codeVerifier:l,clientInfo:h||``,...s};return await this.acquireTokenByCode(g)}finally{d.closeServer()}}async acquireTokenSilent(e){let t=e.correlationId||this.cryptoProvider.createNewGuid();if(this.logger.trace(`acquireTokenSilent called`,t),dl(this.config.auth.isMcp,e),this.nativeBrokerPlugin){let n={...e,clientId:this.config.auth.clientId,scopes:e.scopes||cr,redirectUri:e.redirectUri||``,authority:e.authority||this.config.auth.authority,correlationId:t,extraParameters:{...e.extraQueryParameters,...e.extraParameters,[Mn]:this.skus},accountId:e.account.nativeAccountId,forceRefresh:e.forceRefresh||!1};return this.nativeBrokerPlugin.acquireTokenSilent(n)}if(e.redirectUri){if(!this.config.broker.nativeBrokerPlugin)throw eu.createRedirectUriNotSupportedError(t);e.redirectUri=``}return super.acquireTokenSilent(e)}async acquireTokenByCode(e,t){return dl(this.config.auth.isMcp,e),super.acquireTokenByCode(e,t)}async acquireTokenByRefreshToken(e){return dl(this.config.auth.isMcp,e),super.acquireTokenByRefreshToken(e)}async signOut(e){if(this.nativeBrokerPlugin&&e.account.nativeAccountId){let t={clientId:this.config.auth.clientId,accountId:e.account.nativeAccountId,correlationId:e.correlationId||this.cryptoProvider.createNewGuid()};await this.nativeBrokerPlugin.signOut(t)}await this.getTokenCache().removeAccount(e.account,e.correlationId)}async getAllAccounts(){if(this.nativeBrokerPlugin){let e=this.cryptoProvider.createNewGuid();return this.nativeBrokerPlugin.getAllAccounts(this.config.auth.clientId,e)}return this.getTokenCache().getAllAccounts()}async waitForRedirectUri(e,t){return new Promise((n,r)=>{let i=0,a=setInterval(()=>{if(Ol.TIMEOUT_MS/Ol.INTERVAL_MS<i){clearInterval(a),r(eu.createLoopbackServerTimeoutError(t));return}try{let t=e.getRedirectUri();clearInterval(a),n(t);return}catch(e){if(e instanceof M&&e.errorCode===Q.noLoopbackServerExists.code){i++;return}clearInterval(a),r(e);return}},Ol.INTERVAL_MS)})}}})),wd,Td=t((()=>{W(),X(),dd(),wd=class extends ud{constructor(e,t){super(e),this.appTokenProvider=t}async acquireToken(e){let t;if(e.fmiPath&&(t={fmi_path:e.fmiPath}),e.skipCache||e.claims)return this.executeTokenRequest(e,this.authority,void 0,t);let[n,r]=await this.getCachedAuthenticationResult(e,this.config,this.cryptoUtils,this.authority,this.cacheManager,this.serverTelemetryManager,t);return n?(r===A.PROACTIVELY_REFRESHED&&(this.logger.info(`ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.`,e.correlationId),await this.executeTokenRequest(e,this.authority,!0,t)),n):this.executeTokenRequest(e,this.authority,void 0,t)}async getCachedAuthenticationResult(e,t,n,r,i,a,o){let s=t,c=t,l=A.NOT_APPLICABLE,u;s.serializableCache&&s.persistencePlugin&&(u=new ic(s.serializableCache,!1),await s.persistencePlugin.beforeCacheAccess(u));let d=this.readAccessTokenFromCache(r,c.managedIdentityId?.id||s.authOptions.clientId,new V(e.scopes||[],e.correlationId),i,e.correlationId,o);return s.serializableCache&&s.persistencePlugin&&u&&await s.persistencePlugin.afterCacheAccess(u),d?Ya(d.expiresOn,s.systemOptions?.tokenRenewalOffsetSeconds||300)?(a?.setCacheOutcome(A.CACHED_ACCESS_TOKEN_EXPIRED),[null,A.CACHED_ACCESS_TOKEN_EXPIRED]):(d.refreshOn&&Ya(d.refreshOn.toString(),0)&&(l=A.PROACTIVELY_REFRESHED,a?.setCacheOutcome(A.PROACTIVELY_REFRESHED)),[await kc.generateAuthenticationResult(n,r,{account:null,idToken:null,accessToken:d,refreshToken:null,appMetadata:null},!0,e,this.performanceClient),l]):(a?.setCacheOutcome(A.NO_CACHED_ACCESS_TOKEN),[null,A.NO_CACHED_ACCESS_TOKEN])}readAccessTokenFromCache(e,t,n,r,i,a){let o={homeAccountId:``,environment:e.canonicalAuthorityUrlComponents.HostNameAndPort,credentialType:D.ACCESS_TOKEN,clientId:t,realm:e.tenant,target:V.createSearchScopes(n.asArray(),i),additionalCacheKeyComponents:a},s=r.getAccessTokensByFilter(o,i);if(s.length<1)return null;if(s.length>1)throw N(Jr,i);return s[0]}async executeTokenRequest(e,t,n,r){let i,a;if(this.appTokenProvider){this.logger.info(`Using appTokenProvider extensibility.`,e.correlationId);let t={correlationId:e.correlationId,tenantId:this.config.authOptions.authority.tenant,scopes:e.scopes,claims:e.claims};a=B();let n=await this.appTokenProvider(t);i={access_token:n.accessToken,expires_in:n.expiresInSeconds,refresh_in:n.refreshInSeconds,token_type:k.BEARER}}else{let n=this.createTokenQueryParameters(e),r=R.appendQueryString(t.tokenEndpoint,n),o=await this.createTokenRequestBody(e),s=this.createTokenRequestHeaders(),c={clientId:this.config.authOptions.clientId,authority:e.authority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};this.logger.info(`Sending token request to endpoint: `+t.tokenEndpoint,e.correlationId),a=B();let l=await this.executePostToTokenEndpoint(r,o,s,c,e.correlationId);i=l.body,i.status=l.status}let o=new kc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.performanceClient,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(i,e.correlationId,n),await o.handleServerTokenResponse(i,this.authority,a,e,Y.acquireTokenByClientCredential,void 0,void 0,void 0,void 0,void 0,r)}async createTokenRequestBody(e){let t=new Map;ko(t,this.config.authOptions.clientId),Oo(t,e.scopes,e.correlationId,!1),ts(t,gr.CLIENT_CREDENTIALS_GRANT),Bo(t,this.config.libraryInfo),Vo(t,this.config.telemetry.application),fs(t),this.serverTelemetryManager&&ds(t,this.serverTelemetryManager),zo(t,e.correlationId||this.config.cryptoInterface.createNewGuid()),this.config.clientCredentials.clientSecret&&Xo(t,this.config.clientCredentials.clientSecret);let n=e.clientAssertion||this.config.clientCredentials.clientAssertion;return n&&(Zo(t,await Nc(n.assertion,this.config.authOptions.clientId,this.authority.tokenEndpoint,e.fmiPath)),Qo(t,n.assertionType)),e.fmiPath&&t.set(Vn,e.fmiPath),(!ea.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&Ro(t,e.correlationId,e.claims,this.config.authOptions.clientCapabilities),H(t)}}})),Ed,Dd=t((()=>{W(),X(),fu(),dd(),Ed=class extends ud{constructor(e){super(e)}async acquireToken(e){if(this.scopeSet=new V(e.scopes||[],e.correlationId),this.userAssertionHash=await this.cryptoUtils.hashString(e.oboAssertion),e.skipCache||e.claims)return this.executeTokenRequest(e,this.authority,this.userAssertionHash);try{return await this.getCachedAuthenticationResult(e)}catch{return await this.executeTokenRequest(e,this.authority,this.userAssertionHash)}}async getCachedAuthenticationResult(e){let t=this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId,e);if(!t)throw this.serverTelemetryManager?.setCacheOutcome(A.NO_CACHED_ACCESS_TOKEN),this.logger.info(`SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.`,e.correlationId),N(ii,e.correlationId);if(Ya(t.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.serverTelemetryManager?.setCacheOutcome(A.CACHED_ACCESS_TOKEN_EXPIRED),this.logger.info(`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`,e.correlationId),N(ii,e.correlationId);let n=this.readIdTokenFromCacheForOBO(t.homeAccountId,e.correlationId),r,i=null;if(n){r=pi(n.secret,du.base64Decode,e.correlationId);let t=r.oid||r.sub,a={homeAccountId:n.homeAccountId,environment:n.environment,tenantId:n.realm,username:``,localAccountId:t||``};i=this.cacheManager.getAccount(this.cacheManager.generateAccountKey(a),e.correlationId)}return this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),kc.generateAuthenticationResult(this.cryptoUtils,this.authority,{account:i,accessToken:t,idToken:n,refreshToken:null,appMetadata:null},!0,e,this.performanceClient,r)}readIdTokenFromCacheForOBO(e,t){let n={homeAccountId:e,environment:this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,credentialType:D.ID_TOKEN,clientId:this.config.authOptions.clientId,realm:this.authority.tenant},r=this.cacheManager.getIdTokensByFilter(n,t);return Object.values(r).length<1?null:Object.values(r)[0]}readAccessTokenFromCacheForOBO(e,t){let n=t.authenticationScheme||k.BEARER,r={credentialType:n&&n.toLowerCase()!==k.BEARER.toLowerCase()?D.ACCESS_TOKEN_WITH_AUTH_SCHEME:D.ACCESS_TOKEN,clientId:e,target:V.createSearchScopes(this.scopeSet.asArray(),t.correlationId),tokenType:n,keyId:t.sshKid,userAssertionHash:this.userAssertionHash},i=this.cacheManager.getAccessTokensByFilter(r,t.correlationId),a=i.length;if(a<1)return null;if(a>1)throw N(Jr,t.correlationId);return i[0]}async executeTokenRequest(e,t,n){let r=this.createTokenQueryParameters(e),i=R.appendQueryString(t.tokenEndpoint,r),a=await this.createTokenRequestBody(e),o=this.createTokenRequestHeaders(),s={clientId:this.config.authOptions.clientId,authority:e.authority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid},c=B(),l=await this.executePostToTokenEndpoint(i,a,o,s,e.correlationId),u=new kc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.performanceClient,this.config.serializableCache,this.config.persistencePlugin);return u.validateTokenResponse(l.body,e.correlationId),await u.handleServerTokenResponse(l.body,this.authority,c,e,Y.acquireTokenByOBO,void 0,n)}async createTokenRequestBody(e){let t=new Map;ko(t,this.config.authOptions.clientId),Oo(t,e.scopes,e.correlationId),ts(t,gr.JWT_BEARER),ns(t),Bo(t,this.config.libraryInfo),Vo(t,this.config.telemetry.application),fs(t),this.serverTelemetryManager&&ds(t,this.serverTelemetryManager),zo(t,e.correlationId||this.config.cryptoInterface.createNewGuid()),es(t,Dn),$o(t,e.oboAssertion),this.config.clientCredentials.clientSecret&&Xo(t,this.config.clientCredentials.clientSecret);let n=this.config.clientCredentials.clientAssertion;return n&&(Zo(t,await Nc(n.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),Qo(t,n.assertionType)),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&Ro(t,e.correlationId,e.claims,this.config.authOptions.clientCapabilities),H(t)}}})),Od,kd=t((()=>{W(),X(),dd(),Od=class extends ud{constructor(e){super(e)}async acquireToken(e){return this.executeTokenRequest(e,this.authority)}async executeTokenRequest(e,t){let n=new V(e.scopes||[],e.correlationId);n.appendScopes(cr);let r=n.asArray(),i=this.createTokenQueryParameters(e),a=R.appendQueryString(t.tokenEndpoint,i),o=await this.createTokenRequestBody(e,r),s=this.createTokenRequestHeaders(),c={clientId:this.config.authOptions.clientId,authority:e.authority,scopes:r,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid},l=B(),u=await this.executePostToTokenEndpoint(a,o,s,c,e.correlationId),d=new kc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.performanceClient,this.config.serializableCache,this.config.persistencePlugin);return d.validateTokenResponse(u.body,e.correlationId),await d.handleServerTokenResponse(u.body,this.authority,l,e,Y.acquireTokenByUserFederatedIdentityCredential)}async createTokenRequestBody(e,t){let n=new Map;ko(n,this.config.authOptions.clientId),Oo(n,t,e.correlationId),ts(n,gr.USER_FIC),ns(n),n.set(Rn,e.assertion),e.username?n.set(zn,e.username):e.userObjectId&&n.set(Bn,e.userObjectId),Bo(n,this.config.libraryInfo),Vo(n,this.config.telemetry.application),fs(n),this.serverTelemetryManager&&ds(n,this.serverTelemetryManager),zo(n,e.correlationId||this.config.cryptoInterface.createNewGuid()),this.config.clientCredentials.clientSecret&&Xo(n,this.config.clientCredentials.clientSecret);let r=e.clientAssertion||this.config.clientCredentials.clientAssertion;return r&&(Zo(n,await Nc(r.assertion,this.config.authOptions.clientId,this.authority.tokenEndpoint)),Qo(n,r.assertionType)),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&Ro(n,e.correlationId,e.claims,this.config.authOptions.clientCapabilities),H(n)}}})),Ad,jd=t((()=>{_d(),od(),X(),W(),Td(),Dd(),kd(),rd(),Ad=class extends gd{constructor(e){super(e);let t=!!this.config.auth.clientSecret,n=!!this.config.auth.clientAssertion,r=(!!this.config.auth.clientCertificate?.thumbprint||!!this.config.auth.clientCertificate?.thumbprintSha256)&&!!this.config.auth.clientCertificate?.privateKey;if(!this.appTokenProvider){if(t&&n||n&&r||t&&r)throw N(Xu,``);if(this.config.auth.clientSecret){this.clientSecret=this.config.auth.clientSecret;return}if(this.config.auth.clientAssertion){this.developerProvidedClientAssertion=this.config.auth.clientAssertion;return}if(r)this.clientAssertion=this.config.auth.clientCertificate.thumbprintSha256?ad.fromCertificateWithSha256Thumbprint(this.config.auth.clientCertificate.thumbprintSha256,this.config.auth.clientCertificate.privateKey,this.config.auth.clientCertificate.x5c):ad.fromCertificate(this.config.auth.clientCertificate.thumbprint,this.config.auth.clientCertificate.privateKey,this.config.auth.clientCertificate.x5c);else throw N(Xu,``);this.appTokenProvider=void 0}}SetAppTokenProvider(e){this.appTokenProvider=e}async acquireTokenByClientCredential(e){this.logger.info(`acquireTokenByClientCredential called`,e.correlationId||``);let t;e.clientAssertion&&(t={assertion:await Nc(e.clientAssertion,this.config.auth.clientId),assertionType:El.JWT_BEARER_ASSERTION_TYPE});let n=await this.initializeBaseRequest(e),r={...n,scopes:n.scopes.filter(e=>!cr.includes(e))},i={...e,...r,clientAssertion:t},a=new R(i.authority,i.correlationId).getUrlComponents().PathSegments[0];if(Object.values(ur).includes(a))throw N(qu,i.correlationId);let o=process.env[Sl],s;i.azureRegion!==`DisableMsalForceRegion`&&(s=!i.azureRegion&&o?o:i.azureRegion);let c={azureRegion:s,environmentRegion:process.env[xl]},l=this.initializeServerTelemetryManager(Y.acquireTokenByClientCredential,i.correlationId,i.skipCache);try{let t=await this.createAuthority(i.authority,i.correlationId,c,e.azureCloudOptions),n=new wd(await this.buildOauthClientConfiguration(t,i.correlationId,``,l),this.appTokenProvider);return this.logger.verbose(`Client credential client created`,i.correlationId),await n.acquireToken(i)}catch(e){throw e instanceof M&&(e.correlationId=i.correlationId),l.cacheFailedRequest(e),e}}async acquireTokenOnBehalfOf(e){this.logger.info(`acquireTokenOnBehalfOf called`,e.correlationId||``);let t={...e,...await this.initializeBaseRequest(e)};try{let n=await this.createAuthority(t.authority,t.correlationId,void 0,e.azureCloudOptions),r=new Ed(await this.buildOauthClientConfiguration(n,t.correlationId,``,void 0));return this.logger.verbose(`On behalf of client created`,t.correlationId),await r.acquireToken(t)}catch(e){throw e instanceof M&&(e.correlationId=t.correlationId),e}}async acquireTokenByUserFederatedIdentityCredential(e){if(this.logger.info(`acquireTokenByUserFederatedIdentityCredential called`,e.correlationId||``),e.userObjectId&&e.username)throw N(Qu,e.correlationId||``);if(!e.userObjectId&&!e.username)throw N($u,e.correlationId||``);if(!e.assertion)throw N(Zu,e.correlationId||``);let t;e.clientAssertion&&(t={assertion:await Nc(e.clientAssertion,this.config.auth.clientId),assertionType:El.JWT_BEARER_ASSERTION_TYPE});let n=await this.initializeBaseRequest(e),r={...e,...n,assertion:e.assertion,clientAssertion:t},i=this.initializeServerTelemetryManager(Y.acquireTokenByUserFederatedIdentityCredential,r.correlationId);try{let t=await this.createAuthority(r.authority,r.correlationId,void 0,e.azureCloudOptions),n=new Od(await this.buildOauthClientConfiguration(t,r.correlationId,``,i));return this.logger.verbose(`UserFederatedIdentityCredential client created`,r.correlationId),await n.acquireToken(r)}catch(e){throw e instanceof M&&(e.correlationId=r.correlationId),i.cacheFailedRequest(e),e}}}}));function Md(e){if(typeof e!=`string`)return!1;let t=new Date(e);return!isNaN(t.getTime())&&t.toISOString()===e}var Nd=t((()=>{})),Pd,Fd=t((()=>{W(),X(),Pd=class{constructor(e,t,n){this.httpClientNoRetries=e,this.retryPolicy=t,this.logger=n}async sendNetworkRequestAsyncHelper(e,t,n){return e===bl.GET?this.httpClientNoRetries.sendGetRequestAsync(t,n):this.httpClientNoRetries.sendPostRequestAsync(t,n)}async sendNetworkRequestAsync(e,t,n){let r=await this.sendNetworkRequestAsyncHelper(e,t,n);`isNewRequest`in this.retryPolicy&&(this.retryPolicy.isNewRequest=!0);let i=0;for(;await this.retryPolicy.pauseForRetry(r.status,i,this.logger,r.headers[E.RETRY_AFTER]);)r=await this.sendNetworkRequestAsyncHelper(e,t,n),i++;return r}async sendGetRequestAsync(e,t){return this.sendNetworkRequestAsync(bl.GET,e,t)}async sendPostRequestAsync(e,t){return this.sendNetworkRequestAsync(bl.POST,e,t)}}})),Id,Ld,Rd=t((()=>{W(),X(),Zl(),Nd(),Fd(),Jl(),Id={MANAGED_IDENTITY_CLIENT_ID_2017:`clientid`,MANAGED_IDENTITY_CLIENT_ID:`client_id`,MANAGED_IDENTITY_OBJECT_ID:`object_id`,MANAGED_IDENTITY_RESOURCE_ID_IMDS:`msi_res_id`,MANAGED_IDENTITY_RESOURCE_ID_NON_IMDS:`mi_res_id`},Ld=class{constructor(e,t,n,r,i){this.logger=e,this.nodeStorage=t,this.networkClient=n,this.cryptoProvider=r,this.disableInternalRetries=i}createCorrelationId(){return this.cryptoProvider.createNewGuid()}async getServerTokenResponseAsync(e,t,n,r){return this.getServerTokenResponse(e)}getServerTokenResponse(e){let t,n;return e.body.expires_on&&(Md(e.body.expires_on)&&(e.body.expires_on=new Date(e.body.expires_on).getTime()/1e3),n=e.body.expires_on-B(),n>2*3600&&(t=n/2)),{status:e.status,access_token:e.body.access_token,expires_in:n,scope:e.body.resource,token_type:e.body.token_type,refresh_in:t,correlation_id:e.body.correlation_id||e.body.correlationId,error:typeof e.body.error==`string`?e.body.error:e.body.error?.code,error_description:e.body.message||(typeof e.body.error==`string`?e.body.error_description:e.body.error?.message),error_codes:e.body.error_codes,timestamp:e.body.timestamp,trace_id:e.body.trace_id}}async acquireTokenWithManagedIdentity(e,t,n,r){let i=this.createRequest(e.resource,t);if(e.revokedTokenSha256Hash&&(this.logger.info(`[Managed Identity] The following claims are present in the request: ${e.claims}`,``),i.queryParameters[G.SHA256_TOKEN_TO_REFRESH]=e.revokedTokenSha256Hash),e.clientCapabilities?.length){let t=e.clientCapabilities.toString();this.logger.info(`[Managed Identity] The following client capabilities are present in the request: ${t}`,``),i.queryParameters[G.XMS_CC]=t}let a=i.headers;a[E.CONTENT_TYPE]=nr;let o={headers:a};Object.keys(i.bodyParameters).length&&(o.body=i.computeParametersBodyString());let s=this.disableInternalRetries?this.networkClient:new Pd(this.networkClient,i.retryPolicy,this.logger),c=B(),l;try{l=i.httpMethod===bl.POST?await s.sendPostRequestAsync(i.computeUri(),o):await s.sendGetRequestAsync(i.computeUri(),o)}catch(t){throw t instanceof M?t:N(Hr,e.correlationId)}let u=new kc(t.id,this.nodeStorage,this.cryptoProvider,this.logger,new Gs,null,null),d=await this.getServerTokenResponseAsync(l,s,i,o);return u.validateTokenResponse(d,d.correlation_id||``,r),u.handleServerTokenResponse(d,n,c,e,Y.acquireTokenWithManagedIdentity)}getManagedIdentityUserAssignedIdQueryParameterKey(e,t,n){switch(e){case J.USER_ASSIGNED_CLIENT_ID:return this.logger.info(`[Managed Identity] [API version ${n?`2017+`:`2019+`}] Adding user assigned client id to the request.`,``),n?Id.MANAGED_IDENTITY_CLIENT_ID_2017:Id.MANAGED_IDENTITY_CLIENT_ID;case J.USER_ASSIGNED_RESOURCE_ID:return this.logger.info(`[Managed Identity] Adding user assigned resource id to the request.`,``),t?Id.MANAGED_IDENTITY_RESOURCE_ID_IMDS:Id.MANAGED_IDENTITY_RESOURCE_ID_NON_IMDS;case J.USER_ASSIGNED_OBJECT_ID:return this.logger.info(`[Managed Identity] Adding user assigned object id to the request.`,``),Id.MANAGED_IDENTITY_OBJECT_ID;default:throw Z(Fl,``)}}},Ld.getValidatedEnvVariableUrlString=(e,t,n,r)=>{try{return new R(t,``).urlString}catch{throw r.info(`[Managed Identity] ${n} managed identity is unavailable because the '${e}' environment variable is malformed.`,``),Z(ql[e],``)}}})),zd,Bd=t((()=>{zd=class{calculateDelay(e,t){if(!e)return t;let n=Math.round(parseFloat(e)*1e3);return isNaN(n)&&(n=new Date(e).valueOf()-new Date().valueOf()),Math.max(t,n)}}})),Vd,Hd,Ud,Wd=t((()=>{W(),Bd(),Vd=1e3,Hd=[404,408,429,500,503,504],Ud=class e{constructor(){this.linearRetryStrategy=new zd}static get DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS(){return Vd}async pauseForRetry(t,n,r,i){if(Hd.includes(t)&&n<3){let t=this.linearRetryStrategy.calculateDelay(i,e.DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS);return r.verbose(`Retrying request in ${t}ms (retry attempt: ${n+1})`,``),await new Promise(e=>setTimeout(e,t)),!0}return!1}}})),Gd,Kd=t((()=>{W(),Wd(),Gd=class{constructor(e,t,n){this.httpMethod=e,this._baseEndpoint=t,this.headers={},this.bodyParameters={},this.queryParameters={},this.retryPolicy=n||new Ud}computeUri(){let e=new Map;this.queryParameters&&as(e,this.queryParameters);let t=H(e);return R.appendQueryString(this._baseEndpoint,t)}computeParametersBodyString(){let e=new Map;return this.bodyParameters&&as(e,this.bodyParameters),H(e)}}})),qd,Jd,Yd=t((()=>{Rd(),X(),Kd(),qd=`2019-08-01`,Jd=class e extends Ld{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i),this.identityEndpoint=a,this.identityHeader=o}static getEnvironmentVariables(){return[process.env[K.IDENTITY_ENDPOINT],process.env[K.IDENTITY_HEADER]]}static tryCreate(t,n,r,i,a){let[o,s]=e.getEnvironmentVariables();if(!o||!s)return t.info(`[Managed Identity] ${q.APP_SERVICE} managed identity is unavailable because one or both of the '${K.IDENTITY_HEADER}' and '${K.IDENTITY_ENDPOINT}' environment variables are not defined.`,``),null;let c=e.getValidatedEnvVariableUrlString(K.IDENTITY_ENDPOINT,o,q.APP_SERVICE,t);return t.info(`[Managed Identity] Environment variables validation passed for ${q.APP_SERVICE} managed identity. Endpoint URI: ${c}. Creating ${q.APP_SERVICE} managed identity.`,``),new e(t,n,r,i,a,o,s)}createRequest(e,t){let n=new Gd(bl.GET,this.identityEndpoint);return n.headers[yl.APP_SERVICE_SECRET_HEADER_NAME]=this.identityHeader,n.queryParameters[G.API_VERSION]=qd,n.queryParameters[G.RESOURCE]=e,t.idType!==J.SYSTEM_ASSIGNED&&(n.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(t.idType)]=t.id),n}}})),Xd,Zd,Qd,$d,ef,tf,nf=t((()=>{W(),Kd(),Rd(),Zl(),X(),Jl(),Xd=`2019-11-01`,Zd=`http://127.0.0.1:40342/metadata/identity/oauth2/token`,Qd=`N/A: himds executable exists`,$d={win32:`${process.env.ProgramData}\\AzureConnectedMachineAgent\\Tokens\\`,linux:`/var/opt/azcmagent/tokens/`},ef={win32:`${process.env.ProgramFiles}\\AzureConnectedMachineAgent\\himds.exe`,linux:`/opt/azcmagent/bin/himds`},tf=class e extends Ld{constructor(e,t,n,r,i,a){super(e,t,n,r,i),this.identityEndpoint=a}static getEnvironmentVariables(){let e=process.env[K.IDENTITY_ENDPOINT],t=process.env[K.IMDS_ENDPOINT];if(!e||!t){let n=ef[process.platform];try{_(n,ee.F_OK|ee.R_OK),e=Zd,t=Qd}catch{}}return[e,t]}static tryCreate(t,n,r,i,a,o){let[s,c]=e.getEnvironmentVariables();if(!s||!c)return t.info(`[Managed Identity] ${q.AZURE_ARC} managed identity is unavailable through environment variables because one or both of '${K.IDENTITY_ENDPOINT}' and '${K.IMDS_ENDPOINT}' are not defined. ${q.AZURE_ARC} managed identity is also unavailable through file detection.`,``),null;if(c===Qd)t.info(`[Managed Identity] ${q.AZURE_ARC} managed identity is available through file detection. Defaulting to known ${q.AZURE_ARC} endpoint: ${Zd}. Creating ${q.AZURE_ARC} managed identity.`,``);else{let n=e.getValidatedEnvVariableUrlString(K.IDENTITY_ENDPOINT,s,q.AZURE_ARC,t);n.endsWith(`/`)&&n.slice(0,-1),e.getValidatedEnvVariableUrlString(K.IMDS_ENDPOINT,c,q.AZURE_ARC,t),t.info(`[Managed Identity] Environment variables validation passed for ${q.AZURE_ARC} managed identity. Endpoint URI: ${n}. Creating ${q.AZURE_ARC} managed identity.`,``)}if(o.idType!==J.SYSTEM_ASSIGNED)throw Z(Bl,``);return new e(t,n,r,i,a,s)}createRequest(e){let t=new Gd(bl.GET,this.identityEndpoint.replace(`localhost`,`127.0.0.1`));return t.headers[yl.METADATA_HEADER_NAME]=`true`,t.queryParameters[G.API_VERSION]=Xd,t.queryParameters[G.RESOURCE]=e,t}async getServerTokenResponseAsync(e,t,n,r){let i;if(e.status===401){let a=e.headers[`www-authenticate`];if(!a)throw Z(Gl,``);if(!a.includes(`Basic realm=`))throw Z(Kl,``);let o=a.split(`Basic realm=`)[1];if(!$d.hasOwnProperty(process.platform))throw Z(zl,``);let s=$d[process.platform],c=f.basename(o);if(!c.endsWith(`.key`))throw Z(Nl,``);if(s+c!==o)throw Z(Pl,``);let l;try{l=await ne(o).size}catch{throw Z(Ul,``)}if(l>4096)throw Z(Il,``);let u;try{u=te(o,Mr.UTF8)}catch{throw Z(Ul,``)}let d=`Basic ${u}`;this.logger.info(`[Managed Identity] Adding authorization header to the request.`,``),n.headers[yl.AUTHORIZATION_HEADER_NAME]=d;try{i=await t.sendGetRequestAsync(n.computeUri(),r)}catch(e){throw e instanceof M?e:N(Hr,``)}}return this.getServerTokenResponse(i||e)}}})),rf,af=t((()=>{Kd(),Rd(),X(),Zl(),Jl(),rf=class e extends Ld{constructor(e,t,n,r,i,a){super(e,t,n,r,i),this.msiEndpoint=a}static getEnvironmentVariables(){return[process.env[K.MSI_ENDPOINT]]}static tryCreate(t,n,r,i,a,o){let[s]=e.getEnvironmentVariables();if(!s)return t.info(`[Managed Identity] ${q.CLOUD_SHELL} managed identity is unavailable because the '${K.MSI_ENDPOINT} environment variable is not defined.`,``),null;let c=e.getValidatedEnvVariableUrlString(K.MSI_ENDPOINT,s,q.CLOUD_SHELL,t);if(t.info(`[Managed Identity] Environment variable validation passed for ${q.CLOUD_SHELL} managed identity. Endpoint URI: ${c}. Creating ${q.CLOUD_SHELL} managed identity.`,``),o.idType!==J.SYSTEM_ASSIGNED)throw Z(Vl,``);return new e(t,n,r,i,a,s)}createRequest(e){let t=new Gd(bl.POST,this.msiEndpoint);return t.headers[yl.METADATA_HEADER_NAME]=`true`,t.bodyParameters[G.RESOURCE]=e,t}}})),of,sf=t((()=>{of=class{constructor(e,t,n){this.minExponentialBackoff=e,this.maxExponentialBackoff=t,this.exponentialDeltaBackoff=n}calculateDelay(e){return e===0?this.minExponentialBackoff:Math.min(2**(e-1)*this.exponentialDeltaBackoff,this.maxExponentialBackoff)}}})),cf,lf,uf,df,ff,pf,mf,hf,gf=t((()=>{W(),sf(),cf=[404,408,410,429],lf=3,uf=7,df=1e3,ff=4e3,pf=2e3,mf=10*1e3,hf=class e{constructor(){this.exponentialRetryStrategy=new of(e.MIN_EXPONENTIAL_BACKOFF_MS,e.MAX_EXPONENTIAL_BACKOFF_MS,e.EXPONENTIAL_DELTA_BACKOFF_MS)}static get MIN_EXPONENTIAL_BACKOFF_MS(){return df}static get MAX_EXPONENTIAL_BACKOFF_MS(){return ff}static get EXPONENTIAL_DELTA_BACKOFF_MS(){return pf}static get HTTP_STATUS_GONE_RETRY_AFTER_MS(){return mf}set isNewRequest(e){this._isNewRequest=e}async pauseForRetry(t,n,r){if(this._isNewRequest&&(this._isNewRequest=!1,this.maxRetries=t===410?uf:lf),(cf.includes(t)||t>=500&&t<=599&&n<this.maxRetries)&&n<this.maxRetries){let i=t===410?e.HTTP_STATUS_GONE_RETRY_AFTER_MS:this.exponentialRetryStrategy.calculateDelay(n);return r.verbose(`Retrying request in ${i}ms (retry attempt: ${n+1})`,``),await new Promise(e=>setTimeout(e,i)),!0}return!1}}})),_f,vf,yf,bf,xf=t((()=>{Kd(),Rd(),X(),gf(),ld(),_f=`/metadata/identity/oauth2/token`,vf=`http://169.254.169.254${_f}`,yf=`2018-02-01`,bf=class e extends Ld{constructor(e,t,n,r,i,a){super(e,t,n,r,i),this.identityEndpoint=a}static tryCreate(t,n,r,i,a){let o;return process.env[K.AZURE_POD_IDENTITY_AUTHORITY_HOST]?(t.info(`[Managed Identity] Environment variable ${K.AZURE_POD_IDENTITY_AUTHORITY_HOST} for ${q.IMDS} returned endpoint: ${process.env[K.AZURE_POD_IDENTITY_AUTHORITY_HOST]}`,``),o=e.getValidatedEnvVariableUrlString(K.AZURE_POD_IDENTITY_AUTHORITY_HOST,`${process.env[K.AZURE_POD_IDENTITY_AUTHORITY_HOST]}${_f}`,q.IMDS,t)):(t.info(`[Managed Identity] Unable to find ${K.AZURE_POD_IDENTITY_AUTHORITY_HOST} environment variable for ${q.IMDS}, using the default endpoint.`,``),o=vf),new e(t,n,r,i,a,o)}createRequest(e,t){let n=new Gd(bl.GET,this.identityEndpoint);return n.headers[yl.METADATA_HEADER_NAME]=`true`,n.headers[yl.CLIENT_SKU]=El.MSAL_SKU,n.headers[yl.CLIENT_VER]=cd,n.headers[yl.CLIENT_REQUEST_ID]=this.createCorrelationId(),n.queryParameters[G.API_VERSION]=yf,n.queryParameters[G.RESOURCE]=e,t.idType!==J.SYSTEM_ASSIGNED&&(n.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(t.idType,!0)]=t.id),n.retryPolicy=new hf,n}}})),Sf,Cf,wf=t((()=>{Kd(),Rd(),X(),Sf=`2019-07-01-preview`,Cf=class e extends Ld{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i),this.identityEndpoint=a,this.identityHeader=o}static getEnvironmentVariables(){return[process.env[K.IDENTITY_ENDPOINT],process.env[K.IDENTITY_HEADER],process.env[K.IDENTITY_SERVER_THUMBPRINT]]}static tryCreate(t,n,r,i,a,o){let[s,c,l]=e.getEnvironmentVariables();if(!s||!c||!l)return t.info(`[Managed Identity] ${q.SERVICE_FABRIC} managed identity is unavailable because one or all of the '${K.IDENTITY_HEADER}', '${K.IDENTITY_ENDPOINT}' or '${K.IDENTITY_SERVER_THUMBPRINT}' environment variables are not defined.`,``),null;let u=e.getValidatedEnvVariableUrlString(K.IDENTITY_ENDPOINT,s,q.SERVICE_FABRIC,t);return t.info(`[Managed Identity] Environment variables validation passed for ${q.SERVICE_FABRIC} managed identity. Endpoint URI: ${u}. Creating ${q.SERVICE_FABRIC} managed identity.`,``),o.idType!==J.SYSTEM_ASSIGNED&&t.warning(`[Managed Identity] ${q.SERVICE_FABRIC} user assigned managed identity is configured in the cluster, not during runtime. See also: https://learn.microsoft.com/en-us/azure/service-fabric/configure-existing-cluster-enable-managed-identity-token-service.`,``),new e(t,n,r,i,a,s,c)}createRequest(e,t){let n=new Gd(bl.GET,this.identityEndpoint);return n.headers[yl.ML_AND_SF_SECRET_HEADER_NAME]=this.identityHeader,n.queryParameters[G.API_VERSION]=Sf,n.queryParameters[G.RESOURCE]=e,t.idType!==J.SYSTEM_ASSIGNED&&(n.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(t.idType)]=t.id),n}}})),Tf,Ef,Df,Of=t((()=>{Rd(),X(),Kd(),Tf=`2017-09-01`,Ef=`Only client id is supported for user-assigned managed identity in ${q.MACHINE_LEARNING}.`,Df=class e extends Ld{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i),this.msiEndpoint=a,this.secret=o}static getEnvironmentVariables(){return[process.env[K.MSI_ENDPOINT],process.env[K.MSI_SECRET]]}static tryCreate(t,n,r,i,a){let[o,s]=e.getEnvironmentVariables();if(!o||!s)return t.info(`[Managed Identity] ${q.MACHINE_LEARNING} managed identity is unavailable because one or both of the '${K.MSI_ENDPOINT}' and '${K.MSI_SECRET}' environment variables are not defined.`,``),null;let c=e.getValidatedEnvVariableUrlString(K.MSI_ENDPOINT,o,q.MACHINE_LEARNING,t);return t.info(`[Managed Identity] Environment variables validation passed for ${q.MACHINE_LEARNING} managed identity. Endpoint URI: ${c}. Creating ${q.MACHINE_LEARNING} managed identity.`,``),new e(t,n,r,i,a,o,s)}createRequest(e,t){let n=new Gd(bl.GET,this.msiEndpoint);if(n.headers[yl.METADATA_HEADER_NAME]=`true`,n.headers[yl.ML_AND_SF_SECRET_HEADER_NAME]=this.secret,n.queryParameters[G.API_VERSION]=Tf,n.queryParameters[G.RESOURCE]=e,t.idType===J.SYSTEM_ASSIGNED)n.queryParameters[Id.MANAGED_IDENTITY_CLIENT_ID_2017]=process.env[K.DEFAULT_IDENTITY_CLIENT_ID];else if(t.idType===J.USER_ASSIGNED_CLIENT_ID)n.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(t.idType,!1,!0)]=t.id;else throw Error(Ef);return n}}})),kf,Af=t((()=>{Yd(),nf(),af(),xf(),wf(),Zl(),X(),Of(),Jl(),kf=class e{constructor(e,t,n,r,i){this.logger=e,this.nodeStorage=t,this.networkClient=n,this.cryptoProvider=r,this.disableInternalRetries=i}async sendManagedIdentityTokenRequest(t,n,r,i){return e.identitySource||(e.identitySource=this.selectManagedIdentitySource(this.logger,this.nodeStorage,this.networkClient,this.cryptoProvider,this.disableInternalRetries,n)),e.identitySource.acquireTokenWithManagedIdentity(t,n,r,i)}allEnvironmentVariablesAreDefined(e){return Object.values(e).every(e=>e!==void 0)}getManagedIdentitySource(){return e.sourceName=this.allEnvironmentVariablesAreDefined(Cf.getEnvironmentVariables())?q.SERVICE_FABRIC:this.allEnvironmentVariablesAreDefined(Jd.getEnvironmentVariables())?q.APP_SERVICE:this.allEnvironmentVariablesAreDefined(Df.getEnvironmentVariables())?q.MACHINE_LEARNING:this.allEnvironmentVariablesAreDefined(rf.getEnvironmentVariables())?q.CLOUD_SHELL:this.allEnvironmentVariablesAreDefined(tf.getEnvironmentVariables())?q.AZURE_ARC:q.DEFAULT_TO_IMDS,e.sourceName}selectManagedIdentitySource(e,t,n,r,i,a){let o=Cf.tryCreate(e,t,n,r,i,a)||Jd.tryCreate(e,t,n,r,i)||Df.tryCreate(e,t,n,r,i)||rf.tryCreate(e,t,n,r,i,a)||tf.tryCreate(e,t,n,r,i,a)||bf.tryCreate(e,t,n,r,i);if(!o)throw Z(Hl,``);return o}}})),jf,Mf,Nf=t((()=>{W(),cu(),ld(),vu(),Td(),Af(),wu(),X(),mu(),jf=[q.SERVICE_FABRIC],Mf=class e{constructor(t){this.config=ru(t||{}),this.logger=new ks(this.config.system.loggerOptions,sd,cd);let n={canonicalAuthority:Wn};e.nodeStorage||(e.nodeStorage=new Cu(this.logger,this.config.managedIdentityId.id,xs,n)),this.networkClient=this.config.system.networkClient,this.cryptoProvider=new _u;let r={protocolMode:Ti.AAD,knownAuthorities:[vl],cloudDiscoveryMetadata:``,authorityMetadata:``};this.fakeAuthority=new bo(vl,this.networkClient,e.nodeStorage,r,this.logger,this.cryptoProvider.createNewGuid(),new Gs,!0),this.fakeClientCredentialClient=new wd({authOptions:{clientId:this.config.managedIdentityId.id,authority:this.fakeAuthority}}),this.managedIdentityClient=new kf(this.logger,e.nodeStorage,this.networkClient,this.cryptoProvider,this.config.disableInternalRetries),this.hashUtils=new pu}async acquireToken(t){if(!t.resource)throw L(zi,``);let n={forceRefresh:t.forceRefresh,resource:t.resource.replace(`/.default`,``),scopes:[t.resource.replace(`/.default`,``)],authority:this.fakeAuthority.canonicalAuthority,correlationId:this.cryptoProvider.createNewGuid(),claims:t.claims,clientCapabilities:this.config.clientCapabilities};if(n.forceRefresh)return this.acquireTokenFromManagedIdentity(n,this.config.managedIdentityId,this.fakeAuthority);let[r,i]=await this.fakeClientCredentialClient.getCachedAuthenticationResult(n,this.config,this.cryptoProvider,this.fakeAuthority,e.nodeStorage);if(n.claims){let e=this.managedIdentityClient.getManagedIdentitySource();return r&&jf.includes(e)&&(n.revokedTokenSha256Hash=this.hashUtils.sha256(r.accessToken).toString(Mr.HEX)),this.acquireTokenFromManagedIdentity(n,this.config.managedIdentityId,this.fakeAuthority)}return r?(i===A.PROACTIVELY_REFRESHED&&(this.logger.info(`ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.`,n.correlationId),await this.acquireTokenFromManagedIdentity(n,this.config.managedIdentityId,this.fakeAuthority,!0)),r):this.acquireTokenFromManagedIdentity(n,this.config.managedIdentityId,this.fakeAuthority)}async acquireTokenFromManagedIdentity(e,t,n,r){return this.managedIdentityClient.sendManagedIdentityTokenRequest(e,t,n,r)}getManagedIdentitySource(){return kf.sourceName||this.managedIdentityClient.getManagedIdentitySource()}}})),Pf=t((()=>{W(),Cd(),jd(),Nf(),od(),Du(),X(),vu(),ld()}));function Ff(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}var If=t((()=>{}));function Lf(e,t){let n=t.retryDelayInMs*2**e,r=Math.min(t.maxRetryDelayInMs,n);return{retryAfterInMs:r/2+Ff(0,r/2)}}var Rf=t((()=>{If()}));function zf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}var Bf=t((()=>{}));function Vf(e){if(zf(e)){let t=typeof e.name==`string`,n=typeof e.message==`string`;return t&&n}return!1}var Hf=t((()=>{Bf()}));function Uf(){return crypto.randomUUID()}var Wf=t((()=>{}));function Gf(e,t){return Buffer.from(e,t)}var Kf=t((()=>{})),qf,Jf,Yf,Xf,Zf=t((()=>{Bf(),i(),qf=`REDACTED`,Jf=`x-ms-client-request-id.x-ms-return-client-request-id.x-ms-useragent.x-ms-correlation-request-id.x-ms-request-id.client-request-id.ms-cv.return-client-request-id.traceparent.Access-Control-Allow-Credentials.Access-Control-Allow-Headers.Access-Control-Allow-Methods.Access-Control-Allow-Origin.Access-Control-Expose-Headers.Access-Control-Max-Age.Access-Control-Request-Headers.Access-Control-Request-Method.Origin.Accept.Accept-Encoding.Cache-Control.Connection.Content-Length.Content-Type.Date.ETag.Expires.If-Match.If-Modified-Since.If-None-Match.If-Unmodified-Since.Last-Modified.Pragma.Request-Id.Retry-After.Server.Transfer-Encoding.User-Agent.WWW-Authenticate`.split(`.`),Yf=[`api-version`],Xf=class{constructor({additionalAllowedHeaderNames:e=[],additionalAllowedQueryParameters:t=[]}={}){a(this,`allowedHeaderNames`,void 0),a(this,`allowedQueryParameters`,void 0),e=Jf.concat(e),t=Yf.concat(t),this.allowedHeaderNames=new Set(e.map(e=>e.toLowerCase())),this.allowedQueryParameters=new Set(t.map(e=>e.toLowerCase()))}sanitize(e){let t=new Set;return JSON.stringify(e,(e,n)=>{if(n instanceof Error)return{...n,name:n.name,message:n.message};if(e===`headers`&&zf(n))return this.sanitizeHeaders(n);if(e===`url`&&typeof n==`string`)return this.sanitizeUrl(n);if(e===`query`&&zf(n))return this.sanitizeQuery(n);if(e!==`body`&&e!==`response`&&e!==`operationSpec`){if(Array.isArray(n)||zf(n)){if(t.has(n))return`[Circular]`;t.add(n)}return n}},2)}sanitizeUrl(e){if(typeof e!=`string`||e===null||e===``)return e;let t=new URL(e);if(!t.search)return e;for(let[e]of t.searchParams)this.allowedQueryParameters.has(e.toLowerCase())||t.searchParams.set(e,qf);return t.toString()}sanitizeHeaders(e){let t={};for(let n of Object.keys(e))this.allowedHeaderNames.has(n.toLowerCase())?t[n]=e[n]:t[n]=qf;return t}sanitizeQuery(e){if(typeof e!=`object`||!e)return e;let t={};for(let n of Object.keys(e))this.allowedQueryParameters.has(n.toLowerCase())?t[n]=e[n]:t[n]=qf;return t}}})),Qf=t((()=>{Rf(),Hf(),qe(),Zf()})),$f,ep=t((()=>{$f=class extends Error{constructor(e){super(e),this.name=`AbortError`}}})),tp=t((()=>{ep()}));function np(e,t){let{cleanupBeforeAbort:n,abortSignal:r,abortErrorMsg:i}=t??{};return new Promise((t,a)=>{function o(){a(new $f(i??`The operation was aborted.`))}function s(){r?.removeEventListener(`abort`,c)}function c(){n?.(),s(),o()}if(r?.aborted)return o();try{e(e=>{s(),t(e)},e=>{s(),a(e)})}catch(e){a(e)}r?.addEventListener(`abort`,c)})}var rp=t((()=>{tp()}));function ip(e,t){let n,{abortSignal:r,abortErrorMsg:i}=t??{};return np(t=>{n=setTimeout(t,e)},{cleanupBeforeAbort:()=>clearTimeout(n),abortSignal:r,abortErrorMsg:i??ap})}var ap,op=t((()=>{rp(),ap=`The delay was aborted.`}));function sp(e){if(Vf(e))return e.message;{let t;try{t=typeof e==`object`&&e?JSON.stringify(e):String(e)}catch{t=`[unable to stringify input]`}return`Unknown error ${t}`}}var cp=t((()=>{Qf()}));function lp(e,t){return Lf(e,t)}function up(e){return Vf(e)}var dp,fp,pp=t((()=>{Qf(),rp(),op(),cp(),dp=!0,fp=!0})),mp=t((()=>{Pf()}));function hp(e,t,n){let r=t=>(wp.getToken.info(t),new Ue({scopes:Array.isArray(e)?e:[e],getTokenOptions:n,message:t}));if(!t)throw r(`No response`);if(!t.expiresOn)throw r(`Response had no "expiresOn" property.`);if(!t.accessToken)throw r(`Response had no "accessToken" property.`)}function gp(e){let t=e?.authorityHost;return!t&&fp&&(t=process.env.AZURE_AUTHORITY_HOST),t??be}function _p(e,t){return t||(t=be),RegExp(`${e}/?$`).test(t)?t:t.endsWith(`/`)?t+e:`${t}/${e}`}function vp(e,t,n){return e===`adfs`&&t||n?[t]:[]}function yp(e){switch(e){case`error`:return U.Error;case`info`:return U.Info;case`verbose`:return U.Verbose;case`warning`:return U.Warning;default:return U.Info}}function bp(e,t,n){if(t.name===`AuthError`||t.name===`ClientAuthError`||t.name===`BrowserAuthError`){let n=t;switch(n.errorCode){case`endpoints_resolution_error`:return wp.info(x(e,t.message)),new y(t.message);case`device_code_polling_cancelled`:return new $f(`The authentication has been aborted by the caller.`);case`consent_required`:case`interaction_required`:case`login_required`:wp.info(x(e,`Authentication returned errorCode ${n.errorCode}`));break;default:wp.info(x(e,`Failed to acquire token: ${t.message}`));break}}return t.name===`ClientConfigurationError`||t.name===`BrowserConfigurationAuthError`||t.name===`AbortError`||t.name===`AuthenticationError`?t:t.name===`NativeAuthError`?(wp.info(x(e,`Error from the native broker: ${t.message} with status code: ${t.statusCode}`)),t):new Ue({scopes:e,getTokenOptions:n,message:t.message})}function xp(e){return{localAccountId:e.homeAccountId,environment:e.authority,username:e.username,homeAccountId:e.homeAccountId,tenantId:e.tenantId}}function Sp(e,t){return{authority:t.environment??`login.microsoftonline.com`,homeAccountId:t.homeAccountId,tenantId:t.tenantId||`common`,username:t.username,clientId:e,version:Tp}}function Cp(e){let t=JSON.parse(e);if(t.version&&t.version!==Tp)throw Error(`Unsupported AuthenticationRecord version`);return t}var wp,Tp,Ep,Dp=t((()=>{b(),C(),Ce(),pp(),tp(),mp(),wp=S(`IdentityUtils`),Tp=`1.0`,Ep=(e,t=dp?`Node`:`Browser`)=>(n,r,i)=>{if(!i)switch(n){case U.Error:e.info(`MSAL ${t} V2 error: ${r}`);return;case U.Info:e.info(`MSAL ${t} V2 info message: ${r}`);return;case U.Verbose:e.info(`MSAL ${t} V2 verbose message: ${r}`);return;case U.Warning:e.info(`MSAL ${t} V2 warning: ${r}`);return}}})),Op=t((()=>{}));function kp(e,t){return t!==`Composite`&&t!==`Dictionary`&&(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||t?.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i)!==null||e==null)}function Ap(e){let t={...e.headers,...e.body};return e.hasNullableType&&Object.getOwnPropertyNames(t).length===0?e.shouldWrapBody?{body:null}:null:e.shouldWrapBody?{...e.headers,body:e.body}:t}function jp(e,t){let n=e.parsedHeaders;if(e.request.method===`HEAD`)return{...n,body:e.parsedBody};let r=t&&t.bodyMapper,i=!!r?.nullable,a=r?.type.name;if(a===`Stream`)return{...n,blobBody:e.blobBody,readableStreamBody:e.readableStreamBody};let o=a===`Composite`&&r.type.modelProperties||{},s=Object.keys(o).some(e=>o[e].serializedName===``);if(a===`Sequence`||s){let t=e.parsedBody??[];for(let n of Object.keys(o))o[n].serializedName&&(t[n]=e.parsedBody?.[n]);if(n)for(let e of Object.keys(n))t[e]=n[e];return i&&!e.parsedBody&&!n&&Object.getOwnPropertyNames(o).length===0?null:t}return Ap({body:e.parsedBody,headers:n,hasNullableType:i,shouldWrapBody:kp(e.parsedBody,a)})}var Mp=t((()=>{})),Np,Pp=t((()=>{Np={Base64Url:`Base64Url`,Boolean:`Boolean`,ByteArray:`ByteArray`,Composite:`Composite`,Date:`Date`,DateTime:`DateTime`,DateTimeRfc1123:`DateTimeRfc1123`,Dictionary:`Dictionary`,Enum:`Enum`,Number:`Number`,Object:`Object`,Sequence:`Sequence`,String:`String`,Stream:`Stream`,TimeSpan:`TimeSpan`,UnixTime:`UnixTime`}})),Fp,Ip=t((()=>{Fp=class extends Error{constructor(e){super(e),this.name=`AbortError`}}}));function Lp(e){return e.toLowerCase()}function Rp(e){return String(e).trim().replace(/[\r\n]/g,``)}function*zp(e){for(let t of e.values())yield[t.name,t.value]}function Bp(e){return new Hp(e)}var Vp,Hp,Up=t((()=>{i(),Vp=Symbol.iterator,Hp=class{constructor(e){if(a(this,`_headersMap`,void 0),this._headersMap=new Map,e)for(let t of Object.keys(e))this.set(t,e[t])}set(e,t){this._headersMap.set(Lp(e),{name:e,value:Rp(t)})}get(e){return this._headersMap.get(Lp(e))?.value}has(e){return this._headersMap.has(Lp(e))}delete(e){this._headersMap.delete(Lp(e))}toJSON(e={}){let t={};if(e.preserveCase)for(let e of this._headersMap.values())t[e.name]=e.value;else for(let[e,n]of this._headersMap)t[e]=n.value;return t}toString(){return JSON.stringify(this.toJSON({preserveCase:!0}))}[Vp](){return zp(this._headersMap)}}}));function Wp(e){return new Gp(e)}var Gp,Kp=t((()=>{Up(),Wf(),i(),Gp=class{constructor(e){a(this,`url`,void 0),a(this,`method`,void 0),a(this,`headers`,void 0),a(this,`timeout`,void 0),a(this,`withCredentials`,void 0),a(this,`body`,void 0),a(this,`multipartBody`,void 0),a(this,`formData`,void 0),a(this,`streamResponseStatusCodes`,void 0),a(this,`enableBrowserStreams`,void 0),a(this,`proxySettings`,void 0),a(this,`disableKeepAlive`,void 0),a(this,`abortSignal`,void 0),a(this,`requestId`,void 0),a(this,`allowInsecureConnection`,void 0),a(this,`onUploadProgress`,void 0),a(this,`onDownloadProgress`,void 0),a(this,`requestOverrides`,void 0),a(this,`authSchemes`,void 0),this.url=e.url,this.body=e.body,this.headers=e.headers??Bp(),this.method=e.method??`GET`,this.timeout=e.timeout??0,this.multipartBody=e.multipartBody,this.formData=e.formData,this.disableKeepAlive=e.disableKeepAlive??!1,this.proxySettings=e.proxySettings,this.streamResponseStatusCodes=e.streamResponseStatusCodes,this.withCredentials=e.withCredentials??!1,this.abortSignal=e.abortSignal,this.onUploadProgress=e.onUploadProgress,this.onDownloadProgress=e.onDownloadProgress,this.requestId=e.requestId||Uf(),this.allowInsecureConnection=e.allowInsecureConnection??!1,this.enableBrowserStreams=e.enableBrowserStreams??!1,this.requestOverrides=e.requestOverrides,this.authSchemes=e.authSchemes}}}));function qp(){return Yp.create()}var Jp,Yp,Xp=t((()=>{i(),Jp=new Set([`Deserialize`,`Serialize`,`Retry`,`Sign`]),Yp=class e{constructor(e){a(this,`_policies`,[]),a(this,`_orderedPolicies`,void 0),this._policies=e?.slice(0)??[],this._orderedPolicies=void 0}addPolicy(e,t={}){if(t.phase&&t.afterPhase)throw Error(`Policies inside a phase cannot specify afterPhase.`);if(t.phase&&!Jp.has(t.phase))throw Error(`Invalid phase name: ${t.phase}`);if(t.afterPhase&&!Jp.has(t.afterPhase))throw Error(`Invalid afterPhase name: ${t.afterPhase}`);this._policies.push({policy:e,options:t}),this._orderedPolicies=void 0}removePolicy(e){let t=[];return this._policies=this._policies.filter(n=>e.name&&n.policy.name===e.name||e.phase&&n.options.phase===e.phase?(t.push(n.policy),!1):!0),this._orderedPolicies=void 0,t}sendRequest(e,t){return this.getOrderedPolicies().reduceRight((e,t)=>n=>t.sendRequest(n,e),t=>e.sendRequest(t))(t)}getOrderedPolicies(){return this._orderedPolicies||(this._orderedPolicies=this.orderPolicies()),this._orderedPolicies}clone(){return new e(this._policies)}static create(){return new e}orderPolicies(){let e=[],t=new Map;function n(e){return{name:e,policies:new Set,hasRun:!1,hasAfterPolicies:!1}}let r=n(`Serialize`),i=n(`None`),a=n(`Deserialize`),o=n(`Retry`),s=n(`Sign`),c=[r,i,a,o,s];function l(e){return e===`Retry`?o:e===`Serialize`?r:e===`Deserialize`?a:e===`Sign`?s:i}for(let e of this._policies){let n=e.policy,r=e.options,i=n.name;if(t.has(i))throw Error(`Duplicate policy names not allowed in pipeline`);let a={policy:n,dependsOn:new Set,dependants:new Set};r.afterPhase&&(a.afterPhase=l(r.afterPhase),a.afterPhase.hasAfterPolicies=!0),t.set(i,a),l(r.phase).policies.add(a)}for(let e of this._policies){let{policy:n,options:r}=e,i=n.name,a=t.get(i);if(!a)throw Error(`Missing node for policy ${i}`);if(r.afterPolicies)for(let e of r.afterPolicies){let n=t.get(e);n&&(a.dependsOn.add(n),n.dependants.add(a))}if(r.beforePolicies)for(let e of r.beforePolicies){let n=t.get(e);n&&(n.dependsOn.add(a),a.dependants.add(n))}}function u(n){n.hasRun=!0;for(let r of n.policies)if(!(r.afterPhase&&(!r.afterPhase.hasRun||r.afterPhase.policies.size))&&r.dependsOn.size===0){e.push(r.policy);for(let e of r.dependants)e.dependsOn.delete(r);t.delete(r.policy.name),n.policies.delete(r)}}function d(){for(let e of c){if(u(e),e.policies.size>0&&e!==i){i.hasRun||u(i);return}e.hasAfterPolicies&&u(i)}}let f=0;for(;t.size>0;){f++;let t=e.length;if(d(),e.length<=t&&f>1)throw Error(`Cannot satisfy policy dependencies due to requirements cycle.`)}return e}}})),Zp,Qp=t((()=>{Zp=m.custom}));function $p(e){return e instanceof tm||Vf(e)&&e.name===`RestError`}var em,tm,nm=t((()=>{Hf(),Qp(),Zf(),i(),em=new Xf,tm=class e extends Error{constructor(t,n={}){super(t),a(this,`code`,void 0),a(this,`statusCode`,void 0),a(this,`request`,void 0),a(this,`response`,void 0),a(this,`details`,void 0),this.name=`RestError`,this.code=n.code,this.statusCode=n.statusCode,Object.defineProperty(this,"request",{value:n.request,enumerable:!1}),Object.defineProperty(this,"response",{value:n.response,enumerable:!1});let r=this.request?.agent?{maxFreeSockets:this.request.agent.maxFreeSockets,maxSockets:this.request.agent.maxSockets}:void 0;Object.defineProperty(this,Zp,{value:()=>`RestError: ${this.message} \n ${em.sanitize({...this,request:{...this.request,agent:r},response:this.response})}`,enumerable:!1}),Object.setPrototypeOf(this,e.prototype)}},a(tm,`REQUEST_SEND_ERROR`,`REQUEST_SEND_ERROR`),a(tm,`PARSE_ERROR`,`PARSE_ERROR`)})),rm,im=t((()=>{ht(),rm=dt(`ts-http-runtime`)}));function am(e){return e&&typeof e.pipe==`function`}function om(e){return e.readable===!1?Promise.resolve():new Promise(t=>{let n=()=>{t(),e.removeListener(`close`,n),e.removeListener(`end`,n),e.removeListener(`error`,n)};e.on(`close`,n),e.on(`end`,n),e.on(`error`,n)})}function sm(e){return e&&typeof e.byteLength==`number`}function cm(e){let t=Bp();for(let n of Object.keys(e.headers)){let r=e.headers[n];Array.isArray(r)?r.length>0&&t.set(n,r[0]):r&&t.set(n,r)}return t}function lm(e,t){let n=t.get(`Content-Encoding`);if(n===`gzip`){let t=me.createGunzip();return e.pipe(t),t}else if(n===`deflate`){let t=me.createInflate();return e.pipe(t),t}return e}function um(e){return new Promise((t,n)=>{let r=[];e.on(`data`,e=>{Buffer.isBuffer(e)?r.push(e):r.push(Buffer.from(e))}),e.on(`end`,()=>{t(Buffer.concat(r).toString(`utf8`))}),e.on(`error`,e=>{e&&e?.name===`AbortError`?n(e):n(new tm(`Error reading response as text: ${e.message}`,{code:tm.PARSE_ERROR}))})})}function dm(e){return e?Buffer.isBuffer(e)?e.length:am(e)?null:sm(e)?e.byteLength:typeof e==`string`?Buffer.from(e).length:null:0}function fm(){return new hm}var pm,mm,hm,gm=t((()=>{Ip(),Up(),nm(),im(),Zf(),i(),pm={},mm=class extends fe{_transform(e,t,n){this.push(e),this.loadedBytes+=e.length;try{this.progressCallback({loadedBytes:this.loadedBytes}),n()}catch(e){n(e)}}constructor(e){super(),a(this,`loadedBytes`,0),a(this,`progressCallback`,void 0),this.progressCallback=e}},hm=class{constructor(){a(this,`cachedHttpAgent`,void 0),a(this,`cachedHttpsAgents`,new WeakMap)}async sendRequest(e){let t=new AbortController,n;if(e.abortSignal){if(e.abortSignal.aborted)throw new Fp(`The operation was aborted. Request has already been canceled.`);n=e=>{e.type===`abort`&&t.abort()},e.abortSignal.addEventListener(`abort`,n)}let r;e.timeout>0&&(r=setTimeout(()=>{let n=new Xf;rm.info(`request to '${n.sanitizeUrl(e.url)}' timed out. canceling...`),t.abort()},e.timeout));let i=e.headers.get(`Accept-Encoding`),a=i?.includes(`gzip`)||i?.includes(`deflate`),o=typeof e.body==`function`?e.body():e.body;if(o&&!e.headers.has(`Content-Length`)){let t=dm(o);t!==null&&e.headers.set(`Content-Length`,t)}let s;try{if(o&&e.onUploadProgress){let t=e.onUploadProgress,n=new mm(t);n.on(`error`,e=>{rm.error(`Error in upload progress`,e)}),am(o)?o.pipe(n):n.end(o),o=n}let n=await this.makeRequest(e,t,o);r!==void 0&&clearTimeout(r);let i=cm(n),c={status:n.statusCode??0,headers:i,request:e};if(e.method===`HEAD`)return n.resume(),c;s=a?lm(n,i):n;let l=e.onDownloadProgress;if(l){let e=new mm(l);e.on(`error`,e=>{rm.error(`Error in download progress`,e)}),s.pipe(e),s=e}return e.streamResponseStatusCodes?.has(1/0)||e.streamResponseStatusCodes?.has(c.status)?c.readableStreamBody=s:c.bodyAsText=await um(s),c}finally{if(e.abortSignal&&n){let t=Promise.resolve();am(o)&&(t=om(o));let r=Promise.resolve();am(s)&&(r=om(s)),Promise.all([t,r]).then(()=>{n&&e.abortSignal?.removeEventListener(`abort`,n)}).catch(e=>{rm.warning(`Error when cleaning up abortListener on httpRequest`,e)})}}}makeRequest(e,t,n){let r=new URL(e.url),i=r.protocol!==`https:`;if(i&&!e.allowInsecureConnection)throw Error(`Cannot connect to ${e.url} while allowInsecureConnection is false.`);let a={agent:e.agent??this.getOrCreateAgent(e,i),hostname:r.hostname,path:`${r.pathname}${r.search}`,port:r.port,method:e.method,headers:e.headers.toJSON({preserveCase:!0}),...e.requestOverrides};return new Promise((r,o)=>{let s=i?ge.request(a,r):he.request(a,r);s.once(`error`,t=>{o(new tm(t.message,{code:t.code??tm.REQUEST_SEND_ERROR,request:e}))}),t.signal.addEventListener(`abort`,()=>{let e=new Fp(`The operation was aborted. Rejecting from abort signal callback while making request.`);s.destroy(e),o(e)}),n&&am(n)?n.pipe(s):n?typeof n==`string`||Buffer.isBuffer(n)?s.end(n):sm(n)?s.end(ArrayBuffer.isView(n)?Buffer.from(n.buffer,n.byteOffset,n.byteLength):Buffer.from(n)):(rm.error(`Unrecognized body type`,n),o(new tm(`Unrecognized body type`))):s.end()})}getOrCreateAgent(e,t){let n=e.disableKeepAlive;if(t)return n?ge.globalAgent:(this.cachedHttpAgent||(this.cachedHttpAgent=new ge.Agent({keepAlive:!0})),this.cachedHttpAgent);{if(n&&!e.tlsSettings)return he.globalAgent;let t=e.tlsSettings??pm,r=this.cachedHttpsAgents.get(t);return r&&r.options.keepAlive===!n?r:(rm.info(`No cached TLS Agent exist, creating a new Agent`),r=new he.Agent({keepAlive:!n,...t}),this.cachedHttpsAgents.set(t,r),r)}}}}));function _m(){return fm()}var vm=t((()=>{gm()}));function ym(e={}){let t=e.logger??rm.info,n=new Xf({additionalAllowedHeaderNames:e.additionalAllowedHeaderNames,additionalAllowedQueryParameters:e.additionalAllowedQueryParameters});return{name:bm,async sendRequest(e,r){if(!t.enabled)return r(e);t(`Request: ${n.sanitize(e)}`);let i=await r(e);return t(`Response status code: ${i.status}`),t(`Headers: ${n.sanitize(i.headers)}`),i}}}var bm,xm=t((()=>{im(),Zf(),bm=`logPolicy`})),Sm=t((()=>{}));function Cm(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>i(new Fp(n?.abortErrorMsg?n?.abortErrorMsg:Tm)),c=()=>{n?.abortSignal&&o&&n.abortSignal.removeEventListener(`abort`,o)};if(o=()=>(a&&clearTimeout(a),c(),s()),n?.abortSignal&&n.abortSignal.aborted)return s();a=setTimeout(()=>{c(),r(t)},e),n?.abortSignal&&n.abortSignal.addEventListener(`abort`,o)})}function wm(e,t){let n=e.headers.get(t);if(!n)return;let r=Number(n);if(!Number.isNaN(r))return r}var Tm,Em=t((()=>{Ip(),Tm=`The operation was aborted.`}));function Dm(e){if(e&&[429,503].includes(e.status))try{for(let t of jm){let n=wm(e,t);if(n===0||n)return n*(t===Am?1e3:1)}let t=e.headers.get(Am);if(!t)return;let n=Date.parse(t)-Date.now();return Number.isFinite(n)?Math.max(0,n):void 0}catch{return}}function Om(e){return Number.isFinite(Dm(e))}function km(){return{name:`throttlingRetryStrategy`,retry({response:e}){let t=Dm(e);return Number.isFinite(t)?{retryAfterInMs:t}:{skipStrategy:!0}}}}var Am,jm,Mm=t((()=>{Em(),Am=`Retry-After`,jm=[`retry-after-ms`,`x-ms-retry-after-ms`,Am]}));function Nm(e={}){let t=e.retryDelayInMs??Im,n=e.maxRetryDelayInMs??Lm;return{name:`exponentialRetryStrategy`,retry({retryCount:r,response:i,responseError:a}){let o=Fm(a),s=o&&e.ignoreSystemErrors,c=Pm(i),l=c&&e.ignoreHttpStatusCodes;return i&&(Om(i)||!c)||l||s?{skipStrategy:!0}:a&&!o&&!c?{errorToThrow:a}:Lf(r,{retryDelayInMs:t,maxRetryDelayInMs:n})}}}function Pm(e){return!!(e&&e.status!==void 0&&(e.status>=500||e.status===408)&&e.status!==501&&e.status!==505)}function Fm(e){return e?e.code===`ETIMEDOUT`||e.code===`ESOCKETTIMEDOUT`||e.code===`ECONNREFUSED`||e.code===`ECONNRESET`||e.code===`ENOENT`||e.code===`ENOTFOUND`:!1}var Im,Lm,Rm=t((()=>{Rf(),Mm(),Im=1e3,Lm=1e3*64}));function zm(e,t={maxRetries:3}){let n=t.logger||Bm;return{name:Vm,async sendRequest(r,i){let a,o,s=-1;retryRequest:for(;;){s+=1,a=void 0,o=void 0;try{n.info(`Retry ${s}: Attempting to send request`,r.requestId),a=await i(r),n.info(`Retry ${s}: Received a response from request`,r.requestId)}catch(e){if(n.error(`Retry ${s}: Received an error from request`,r.requestId),!$p(e))throw e;o=e,a=e.response}if(r.abortSignal?.aborted)throw n.error(`Retry ${s}: Request aborted.`),new Fp;if(s>=(t.maxRetries??3)){if(n.info(`Retry ${s}: Maximum retries reached. Returning the last received response, or throwing the last received error.`),o)throw o;if(a)return a;throw Error(`Maximum retries reached with no response or error to throw`)}n.info(`Retry ${s}: Processing ${e.length} retry strategies.`);strategiesLoop:for(let t of e){let e=t.logger||n;e.info(`Retry ${s}: Processing retry strategy ${t.name}.`);let i=t.retry({retryCount:s,response:a,responseError:o});if(i.skipStrategy){e.info(`Retry ${s}: Skipped.`);continue strategiesLoop}let{errorToThrow:c,retryAfterInMs:l,redirectTo:u}=i;if(c)throw e.error(`Retry ${s}: Retry strategy ${t.name} throws error:`,c),c;if(l||l===0){e.info(`Retry ${s}: Retry strategy ${t.name} retries after ${l}`),await Cm(l,void 0,{abortSignal:r.abortSignal});continue retryRequest}if(u){e.info(`Retry ${s}: Retry strategy ${t.name} redirects to ${u}`),r.url=u;continue retryRequest}}if(o)throw n.info(`None of the retry strategies could work with the received error. Throwing it.`),o;if(a)return n.info(`None of the retry strategies could work with the received response. Returning it.`),a}}}}var Bm,Vm,Hm=t((()=>{Em(),nm(),Ip(),ht(),Sm(),Bm=dt(`ts-http-runtime retryPolicy`),Vm=`retryPolicy`}));function Um(e={}){return{name:Wm,sendRequest:zm([km(),Nm(e)],{maxRetries:e.maxRetries??3}).sendRequest}}var Wm,Gm=t((()=>{Rm(),Mm(),Hm(),Sm(),Wm=`defaultRetryPolicy`}));function Km(e){if(typeof FormData<`u`&&e instanceof FormData){let t={};for(let[n,r]of e.entries()){let e=t[n];Array.isArray(e)?e.push(r):t[n]=e===void 0?[r]:[e,r]}return t}}var qm=t((()=>{}));function Jm(){return{name:Zm,async sendRequest(e,t){let n=Km(e.body);if(n&&(e.formData=n,e.body=void 0),e.formData){let t=e.headers.get(`Content-Type`);t&&t.indexOf(`application/x-www-form-urlencoded`)!==-1?e.body=Ym(e.formData):await Xm(e.formData,e),e.formData=void 0}return t(e)}}}function Ym(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(Array.isArray(r))for(let e of r)t.append(n,e.toString());else t.append(n,r.toString());return t.toString()}async function Xm(e,t){let n=t.headers.get(`Content-Type`);if(n&&!n.startsWith(`multipart/form-data`))return;t.headers.set(`Content-Type`,n??`multipart/form-data`);let r=[];for(let[t,n]of Object.entries(e))for(let e of Array.isArray(n)?n:[n])if(typeof e==`string`)r.push({headers:Bp({"Content-Disposition":`form-data; name="${t}"`}),body:Gf(e,`utf-8`)});else if(typeof e!=`object`||!e)throw Error(`Unexpected value for key ${t}: ${e}. Value should be serialized to string first.`);else{let n=e.name||`blob`,i=Bp();i.set(`Content-Disposition`,`form-data; name="${t}"; filename="${n}"`),i.set(`Content-Type`,e.type||`application/octet-stream`),r.push({headers:i,body:e})}t.multipartBody={parts:r}}var Zm,Qm=t((()=>{Kf(),qm(),Up(),Zm=`formDataPolicy`}));function $m(e){return{name:eh,sendRequest:async(t,n)=>(t.agent||(t.agent=e),n(t))}}var eh,th=t((()=>{eh=`agentPolicy`}));function nh(e){return{name:rh,sendRequest:async(t,n)=>(t.tlsSettings||(t.tlsSettings=e),n(t))}}var rh,ih=t((()=>{rh=`tlsPolicy`})),ah=r((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},a=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HttpProxyAgent=void 0;var o=i(e(`net`)),l=i(e(`tls`)),u=a(s()),d=e(`events`),f=c(),p=e(`url`),m=(0,u.default)(`http-proxy-agent`),h=class extends f.Agent{constructor(e,t){super(t),this.proxy=typeof e==`string`?new p.URL(e):e,this.proxyHeaders=t?.headers??{},m(`Creating new HttpProxyAgent 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={...t?g(t,`headers`):null,host:n,port:r}}addRequest(e,t){e._header=null,this.setRequestProps(e,t),super.addRequest(e,t)}setRequestProps(e,t){let{proxy:n}=this,r=`${t.secureEndpoint?`https:`:`http:`}//${e.getHeader(`host`)||`localhost`}`,i=new p.URL(e.path,r);t.port!==80&&(i.port=String(t.port)),e.path=String(i);let a=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders};if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;a[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}a[`Proxy-Connection`]||(a[`Proxy-Connection`]=this.keepAlive?`Keep-Alive`:`close`);for(let t of Object.keys(a)){let n=a[t];n&&e.setHeader(t,n)}}async connect(e,t){e._header=null,e.path.includes(`://`)||this.setRequestProps(e,t);let n,r;m(`Regenerating stored HTTP header string for request`),e._implicitHeader(),e.outputData&&e.outputData.length>0&&(m(`Patching connection write() output buffer with updated header`),n=e.outputData[0].data,r=n.indexOf(`\r
|
|
3
|
+
\r
|
|
4
|
+
`)+4,e.outputData[0].data=e._header+n.substring(r),m(`Output buffer: %o`,e.outputData[0].data));let i;return this.proxy.protocol===`https:`?(m("Creating `tls.Socket`: %o",this.connectOpts),i=l.connect(this.connectOpts)):(m("Creating `net.Socket`: %o",this.connectOpts),i=o.connect(this.connectOpts)),await(0,d.once)(i,`connect`),i}};h.protocols=[`http`,`https`],t.HttpProxyAgent=h;function g(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}}));function oh(e){if(process.env[e])return process.env[e];if(process.env[e.toLowerCase()])return process.env[e.toLowerCase()]}function sh(){if(!process)return;let e=oh(gh),t=oh(vh),n=oh(_h);return e||t||n}function ch(e,t,n){if(t.length===0)return!1;let r=new URL(e).hostname;if(n?.has(r))return n.get(r);let i=!1;for(let e of t)e[0]===`.`?(r.endsWith(e)||r.length===e.length-1&&r===e.slice(1))&&(i=!0):r===e&&(i=!0);return n?.set(r,i),i}function lh(){let e=oh(yh);return Sh=!0,e?e.split(`,`).map(e=>e.trim()).filter(e=>e.length):[]}function uh(){let e=sh();return e?new URL(e):void 0}function dh(e){let t;try{t=new URL(e.host)}catch{throw Error(`Expecting a valid host string in proxy settings, but found "${e.host}".`)}return t.port=String(e.port),e.username&&(t.username=e.username),e.password&&(t.password=e.password),t}function fh(e,t,n){if(e.agent)return;let r=new URL(e.url).protocol!==`https:`;e.tlsSettings&&rm.warning(`TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.`),r?(t.httpProxyAgent||(t.httpProxyAgent=new hh.HttpProxyAgent(n)),e.agent=t.httpProxyAgent):(t.httpsProxyAgent||(t.httpsProxyAgent=new mh.HttpsProxyAgent(n)),e.agent=t.httpsProxyAgent)}function ph(e,t){Sh||xh.push(...lh());let n=e?dh(e):uh(),r={};return{name:bh,async sendRequest(e,i){return!e.proxySettings&&n&&!ch(e.url,t?.customNoProxyList??xh,t?.customNoProxyList?void 0:Ch)?fh(e,r,n):e.proxySettings&&fh(e,r,dh(e.proxySettings)),i(e)}}}var mh,hh,gh,_h,vh,yh,bh,xh,Sh,Ch,wh=t((()=>{mh=l(),hh=ah(),im(),gh=`HTTPS_PROXY`,_h=`HTTP_PROXY`,vh=`ALL_PROXY`,yh=`NO_PROXY`,bh=`proxyPolicy`,xh=[],Sh=!1,Ch=new Map}));function Th(){return{name:Eh,async sendRequest(e,t){return e.method!==`HEAD`&&e.headers.set(`Accept-Encoding`,`gzip,deflate`),t(e)}}}var Eh,Dh=t((()=>{Eh=`decompressResponsePolicy`}));function Oh(e={}){let{maxRetries:t=20,allowCrossOriginRedirects:n=!1}=e;return{name:Ah,async sendRequest(e,r){return kh(r,await r(e),t,n)}}}async function kh(e,t,n,r,i=0){let{request:a,status:o,headers:s}=t,c=s.get(`location`);if(c&&(o===300||o===301&&jh.includes(a.method)||o===302&&jh.includes(a.method)||o===303&&a.method===`POST`||o===307)&&i<n){let s=new URL(c,a.url);if(!r){let e=new URL(a.url);if(s.origin!==e.origin)return rm.verbose(`Skipping cross-origin redirect from ${e.origin} to ${s.origin}.`),t}return a.url=s.toString(),o===303&&(a.method=`GET`,a.headers.delete(`Content-Length`),delete a.body),a.headers.delete(`Authorization`),kh(e,await e(a),n,r,i+1)}return t}var Ah,jh,Mh=t((()=>{im(),Ah=`redirectPolicy`,jh=[`GET`,`HEAD`]}));function Nh(e){return e instanceof Blob}var Ph=t((()=>{}));async function*Fh(){let e=this.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}function Ih(e){e[Symbol.asyncIterator]||(e[Symbol.asyncIterator]=Fh.bind(e)),e.values||(e.values=Fh.bind(e))}function Lh(e){return e instanceof ReadableStream?(Ih(e),g.fromWeb(e)):e}function Rh(e){return e instanceof Uint8Array?g.from(Buffer.from(e)):Nh(e)?Lh(e.stream()):Lh(e)}async function zh(e){return function(){let t=e.map(e=>typeof e==`function`?e():e).map(Rh);return g.from((async function*(){for(let e of t)for await(let t of e)yield t})())}}var Bh=t((()=>{Ph()}));function Vh(){return`----AzSDKFormBoundary${Uf()}`}function Hh(e){let t=``;for(let[n,r]of e)t+=`${n}: ${r}\r\n`;return t}function Uh(e){if(e instanceof Uint8Array)return e.byteLength;if(Nh(e))return e.size===-1?void 0:e.size}function Wh(e){let t=0;for(let n of e){let e=Uh(n);if(e===void 0)return;t+=e}return t}async function Gh(e,t,n){let r=[Gf(`--${n}`,`utf-8`),...t.flatMap(e=>[Gf(`\r
|
|
5
|
+
`,`utf-8`),Gf(Hh(e.headers),`utf-8`),Gf(`\r
|
|
6
|
+
`,`utf-8`),e.body,Gf(`\r\n--${n}`,`utf-8`)]),Gf(`--\r
|
|
7
|
+
\r
|
|
8
|
+
`,`utf-8`)],i=Wh(r);i&&e.headers.set(`Content-Length`,i),e.body=await zh(r)}function Kh(e){if(e.length>Yh)throw Error(`Multipart boundary "${e}" exceeds maximum length of 70 characters`);if(Array.from(e).some(e=>!Xh.has(e)))throw Error(`Multipart boundary "${e}" contains invalid characters`)}function qh(){return{name:Jh,async sendRequest(e,t){if(!e.multipartBody)return t(e);if(e.body)throw Error(`multipartBody and regular body cannot be set at the same time`);let n=e.multipartBody.boundary,r=e.headers.get(`Content-Type`)??`multipart/mixed`,i=r.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/);if(!i)throw Error(`Got multipart request body, but content-type header was not multipart: ${r}`);let[,a,o]=i;if(o&&n&&o!==n)throw Error(`Multipart boundary was specified as ${o} in the header, but got ${n} in the request body`);return n??(n=o),n?Kh(n):n=Vh(),e.headers.set(`Content-Type`,`${a}; boundary=${n}`),await Gh(e,e.multipartBody.parts,n),e.multipartBody=void 0,t(e)}}}var Jh,Yh,Xh,Zh=t((()=>{Kf(),Ph(),Wf(),Bh(),Jh=`multipartPolicy`,Yh=70,Xh=new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`)})),Qh=t((()=>{Ip(),ht(),Up(),Kp(),Xp(),nm(),vm(),xm(),Sm(),Gm(),Qm(),th(),ih(),wh(),Dh(),Mh(),Zh(),im(),qe(),Ph()}));function $h(){return qp()}var eg=t((()=>{Qh()})),tg,ng=t((()=>{bt(),tg=vt(`core-rest-pipeline`)})),rg=t((()=>{th(),Dh(),Gm(),Rm(),Hm(),Sm(),Mm(),Qm(),xm(),Zh(),wh(),Mh(),ih()}));function ig(e={}){return ym({logger:tg.info,...e})}var ag=t((()=>{ng(),rg()}));function og(e={}){return Oh(e)}var sg=t((()=>{rg()}));function cg(){return`User-Agent`}async function lg(e){if(h&&h.versions){let t=`${ie.type()} ${ie.release()}; ${ie.arch()}`;h.versions.bun?e.set(`Bun`,`${h.versions.bun} (${t})`):h.versions.deno?e.set(`Deno`,`${h.versions.deno} (${t})`):h.versions.node&&e.set(`Node`,`${h.versions.node} (${t})`)}}var ug=t((()=>{})),dg,fg=t((()=>{dg=`1.24.0`}));function pg(e){let t=[];for(let[n,r]of e){let e=r?`${n}/${r}`:n;t.push(e)}return t.join(` `)}function mg(){return cg()}async function hg(e){let t=new Map;t.set(`core-rest-pipeline`,dg),await lg(t);let n=pg(t);return e?`${e} ${n}`:n}var gg=t((()=>{ug(),fg()}));function _g(e={}){let t=hg(e.userAgentPrefix);return{name:yg,async sendRequest(e,n){return e.headers.has(vg)||e.headers.set(vg,await t),n(e)}}}var vg,yg,bg=t((()=>{gg(),vg=mg(),yg=`userAgentPolicy`}));function xg(e){return typeof e[Cg]==`function`}function Sg(e){return xg(e)?e[Cg]():e}var Cg,wg=t((()=>{wg(),Cg=Symbol(`rawContent`)}));function Tg(){let e=qh();return{name:Eg,sendRequest:async(t,n)=>{if(t.multipartBody)for(let e of t.multipartBody.parts)xg(e.body)&&(e.body=Sg(e.body));return e.sendRequest(t,n)}}}var Eg,Dg=t((()=>{rg(),wg(),Eg=Jh}));function Og(){return Th()}var kg=t((()=>{rg()}));function Ag(e={}){return Um(e)}var jg=t((()=>{rg()}));function Mg(){return Jm()}var Ng=t((()=>{rg()}));function Pg(e,t){return ph(e,t)}var Fg=t((()=>{rg()}));function Ig(e=`x-ms-client-request-id`){return{name:Lg,async sendRequest(t,n){return t.headers.has(e)||t.headers.set(e,t.requestId),n(t)}}}var Lg,Rg=t((()=>{Lg=`setClientRequestIdPolicy`}));function zg(e){return $m(e)}var Bg=t((()=>{rg()}));function Vg(e){return nh(e)}var Hg=t((()=>{rg()}));function Ug(e){return $p(e)}var Wg,Gg=t((()=>{Qh(),Wg=tm}));function Kg(e={}){let t=hg(e.userAgentPrefix),n=new Xf({additionalAllowedQueryParameters:e.additionalAllowedQueryParameters}),r=qg();return{name:Zg,async sendRequest(e,i){if(!r)return i(e);let a=await t,o={"http.url":n.sanitizeUrl(e.url),"http.method":e.method,"http.user_agent":a,requestId:e.requestId};a&&(o[`http.user_agent`]=a);let{span:s,tracingContext:c}=Jg(r,e,o)??{};if(!s||!c)return i(e);try{let t=await r.withContext(c,i,e);return Xg(s,t),t}catch(e){throw Yg(s,e),e}}}}function qg(){try{return Lt({namespace:``,packageName:`@azure/core-rest-pipeline`,packageVersion:dg})}catch(e){tg.warning(`Error when creating the TracingClient: ${sp(e)}`);return}}function Jg(e,t,n){try{let{span:r,updatedOptions:i}=e.startSpan(`HTTP ${t.method}`,{tracingOptions:t.tracingOptions},{spanKind:`client`,spanAttributes:n});if(!r.isRecording()){r.end();return}let a=e.createRequestHeaders(i.tracingOptions.tracingContext);for(let[e,n]of Object.entries(a))t.headers.set(e,n);return{span:r,tracingContext:i.tracingOptions.tracingContext}}catch(e){tg.warning(`Skipping creating a tracing span due to an error: ${sp(e)}`);return}}function Yg(e,t){try{e.setStatus({status:`error`,error:up(t)?t:void 0}),Ug(t)&&t.statusCode&&e.setAttribute(`http.status_code`,t.statusCode),e.end()}catch(e){tg.warning(`Skipping tracing span processing due to an error: ${sp(e)}`)}}function Xg(e,t){try{e.setAttribute(`http.status_code`,t.status);let n=t.headers.get(`x-ms-request-id`);n&&e.setAttribute(`serviceRequestId`,n),t.status>=400&&e.setStatus({status:`error`}),e.end()}catch(e){tg.warning(`Skipping tracing span processing due to an error: ${sp(e)}`)}}var Zg,Qg=t((()=>{zt(),fg(),gg(),ng(),pp(),Gg(),Qf(),Zg=`tracingPolicy`}));function $g(e){if(e instanceof AbortSignal)return{abortSignal:e};if(e.aborted)return{abortSignal:AbortSignal.abort(`reason`in e?e.reason:void 0)};let t=new AbortController,n=!0;function r(){n&&(e.removeEventListener(`abort`,i),n=!1)}function i(){t.abort(`reason`in e?e.reason:void 0),r()}return e.addEventListener(`abort`,i),{abortSignal:t.signal,cleanup:r}}var e_=t((()=>{}));function t_(){return{name:n_,sendRequest:async(e,t)=>{if(!e.abortSignal)return t(e);let{abortSignal:n,cleanup:r}=$g(e.abortSignal);e.abortSignal=n;try{return await t(e)}finally{r?.()}}}}var n_,r_=t((()=>{e_(),n_=`wrapAbortSignalLikePolicy`}));function i_(e){let t=$h();return fp&&(e.agent&&t.addPolicy(zg(e.agent)),e.tlsOptions&&t.addPolicy(Vg(e.tlsOptions)),t.addPolicy(Pg(e.proxyOptions)),t.addPolicy(Og())),t.addPolicy(t_()),t.addPolicy(Mg(),{beforePolicies:[Eg]}),t.addPolicy(_g(e.userAgentOptions)),t.addPolicy(Ig(e.telemetryOptions?.clientRequestIdHeaderName)),t.addPolicy(Tg(),{afterPhase:`Deserialize`}),t.addPolicy(Ag(e.retryOptions),{phase:`Retry`}),t.addPolicy(Kg({...e.userAgentOptions,...e.loggingOptions}),{afterPhase:`Retry`}),fp&&t.addPolicy(og(e.redirectOptions),{afterPhase:`Retry`}),t.addPolicy(ig(e.loggingOptions),{afterPhase:`Sign`}),t}var a_=t((()=>{ag(),eg(),sg(),bg(),Dg(),kg(),jg(),Ng(),pp(),Fg(),Rg(),Bg(),Hg(),Qg(),r_()}));function o_(){let e=_m();return{async sendRequest(t){let{abortSignal:n,cleanup:r}=t.abortSignal?$g(t.abortSignal):{};try{return t.abortSignal=n,await e.sendRequest(t)}finally{r?.()}}}}var s_=t((()=>{Qh(),e_()}));function c_(e){return Bp(e)}var l_=t((()=>{Qh()}));function u_(e){return Wp(e)}var d_=t((()=>{Qh()}));function f_(e,t={maxRetries:3}){return zm(e,{logger:p_,...t})}var p_,m_=t((()=>{bt(),fg(),rg(),p_=vt(`core-rest-pipeline retryPolicy`)}));async function h_(e,t,n){async function r(){if(Date.now()<n)try{return await e()}catch{return null}else{let t=await e();if(t===null)throw Error(`Failed to refresh access token.`);return t}}let i=await r();for(;i===null;)await ip(t),i=await r();return i}function g_(e,t){let n=null,r=null,i,a={...__,...t},o={get isRefreshing(){return n!==null},get shouldRefresh(){return r===null?!0:o.isRefreshing?!1:r.refreshAfterTimestamp&&r.refreshAfterTimestamp<Date.now()?!0:r.expiresOnTimestamp-a.refreshWindowInMs<Date.now()},get mustRefresh(){return r===null||r.expiresOnTimestamp-a.forcedRefreshWindowInMs<Date.now()}};function s(t,s){return o.isRefreshing||(n=h_(()=>e.getToken(t,s),a.retryIntervalInMs,r?.expiresOnTimestamp??Date.now()).then(e=>(n=null,r=e,i=s.tenantId,r)).catch(e=>{throw n=null,r=null,i=void 0,e})),n}return async(e,t)=>{let n=!!t.claims,a=i!==t.tenantId;return n&&(r=null),a||n||o.mustRefresh?s(e,t):(o.shouldRefresh&&s(e,t),r)}}var __,v_=t((()=>{pp(),__={forcedRefreshWindowInMs:1e3,retryIntervalInMs:3e3,refreshWindowInMs:1e3*60*2}}));async function y_(e,t){try{return[await t(e),void 0]}catch(e){if(Ug(e)&&e.response)return[e.response,e];throw e}}async function b_(e){let{scopes:t,getAccessToken:n,request:r}=e,i=await n(t,{abortSignal:r.abortSignal,tracingOptions:r.tracingOptions,enableCae:!0});i&&e.request.headers.set(`Authorization`,`Bearer ${i.token}`)}function x_(e){return e.status===401&&e.headers.has(`WWW-Authenticate`)}async function S_(e,t){let{scopes:n}=e,r=await e.getAccessToken(n,{enableCae:!0,claims:t});return r?(e.request.headers.set(`Authorization`,`${r.tokenType??`Bearer`} ${r.token}`),!0):!1}function C_(e){let{credential:t,scopes:n,challengeCallbacks:r}=e,i=e.logger||tg,a={authorizeRequest:r?.authorizeRequest?.bind(r)??b_,authorizeRequestOnChallenge:r?.authorizeRequestOnChallenge?.bind(r)},o=t?g_(t):()=>Promise.resolve(null);return{name:E_,async sendRequest(e,t){if(!e.url.toLowerCase().startsWith(`https://`))throw Error(`Bearer token authentication is not permitted for non-TLS protected (non-https) URLs.`);await a.authorizeRequest({scopes:Array.isArray(n)?n:[n],request:e,getAccessToken:o,logger:i});let r,s,c;if([r,s]=await y_(e,t),x_(r)){let l=T_(r.headers.get(`WWW-Authenticate`));if(l){let a;try{a=atob(l)}catch{return i.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${l}`),r}c=await S_({scopes:Array.isArray(n)?n:[n],response:r,request:e,getAccessToken:o,logger:i},a),c&&([r,s]=await y_(e,t))}else if(a.authorizeRequestOnChallenge&&(c=await a.authorizeRequestOnChallenge({scopes:Array.isArray(n)?n:[n],request:e,response:r,getAccessToken:o,logger:i}),c&&([r,s]=await y_(e,t)),x_(r)&&(l=T_(r.headers.get(`WWW-Authenticate`)??``),l))){let a;try{a=atob(l)}catch{return i.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${l}`),r}c=await S_({scopes:Array.isArray(n)?n:[n],response:r,request:e,getAccessToken:o,logger:i},a),c&&([r,s]=await y_(e,t))}}if(s)throw s;return r}}}function w_(e){let t=/(\w+)\s+((?:\w+=(?:"[^"]*"|[^,]*),?\s*)+)/g,n=/(\w+)="([^"]*)"/g,r=[],i;for(;(i=t.exec(e))!==null;){let e=i[1],t=i[2],a={},o;for(;(o=n.exec(t))!==null;)a[o[1]]=o[2];r.push({scheme:e,params:a})}return r}function T_(e){if(e)return w_(e).find(e=>e.scheme===`Bearer`&&e.params.claims&&e.params.error===`insufficient_claims`)?.params.claims}var E_,D_=t((()=>{v_(),ng(),Gg(),E_=`bearerTokenAuthenticationPolicy`})),O_=t((()=>{eg(),a_(),s_(),l_(),d_(),Gg(),kg(),rg(),Rg(),ag(),Dg(),Fg(),sg(),m_(),Qg(),jg(),bg(),Hg(),Ng(),D_(),v_(),ng(),Bg(),wg()})),k_=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.state=void 0,e.state={operationRequestMap:new WeakMap}})),A_,j_,M_=t((()=>{A_=k_(),j_=A_.state}));function N_(e,t,n){let r=t.parameterPath,i=t.mapper,a;if(typeof r==`string`&&(r=[r]),Array.isArray(r)){if(r.length>0)if(i.isConstant)a=i.defaultValue;else{let t=P_(e,r);!t.propertyFound&&n&&(t=P_(n,r));let o=!1;t.propertyFound||(o=i.required||r[0]===`options`&&r.length===2),a=o?i.defaultValue:t.propertyValue}}else{i.required&&(a={});for(let[t,o]of Object.entries(r)){let r=i.type.modelProperties[t],s=N_(e,{parameterPath:o,mapper:r},n);s!==void 0&&(a||(a={}),Object.defineProperty(a,t,{value:s,enumerable:!0,configurable:!0,writable:!0}))}}return a}function P_(e,t){let n={propertyFound:!1},r=0;for(;r<t.length;++r){let n=t[r];if(e&&n in e)e=e[n];else break}return r===t.length&&(n.propertyValue=e,n.propertyFound=!0),n}function F_(e){return L_ in e}function I_(e){if(F_(e))return I_(e[L_]);let t=j_.operationRequestMap.get(e);return t||(t={},j_.operationRequestMap.set(e,t)),t}var L_,R_=t((()=>{M_(),L_=Symbol.for(`@azure/core-client original request`)}));function z_(e={}){let t=e.expectedContentTypes?.json??K_,n=e.expectedContentTypes?.xml??q_,r=e.parseXML,i=e.serializerOptions,a={xml:{rootName:i?.xml.rootName??``,includeRoot:i?.xml.includeRoot??!1,xmlCharKey:i?.xml.xmlCharKey??`_`}};return{name:J_,async sendRequest(e,i){let o=await i(e);return H_(t,n,o,a,r)}}}function B_(e){let t,n=e.request,r=I_(n),i=r?.operationSpec;return i&&(t=r?.operationResponseGetter?r?.operationResponseGetter(i,e):i.responses[e.status]),t}function V_(e){let t=e.request,n=I_(t)?.shouldDeserialize,r;return r=n===void 0?!0:typeof n==`boolean`?n:n(e),r}async function H_(e,t,n,r,i){let a=await G_(e,t,n,r,i);if(!V_(a))return a;let o=I_(a.request)?.operationSpec;if(!o||!o.responses)return a;let s=B_(a),{error:c,shouldReturnResponse:l}=W_(a,o,s,r);if(c)throw c;if(l)return a;if(s){if(s.bodyMapper){let e=a.parsedBody;o.isXML&&s.bodyMapper.type.name===Np.Sequence&&(e=typeof e==`object`?e[s.bodyMapper.xmlElementName]:[]);try{a.parsedBody=o.serializer.deserialize(s.bodyMapper,e,`operationRes.parsedBody`,r)}catch(e){throw new Wg(`Error ${e} occurred in deserializing the responseBody - ${a.bodyAsText}`,{statusCode:a.status,request:a.request,response:a})}}else o.httpMethod===`HEAD`&&(a.parsedBody=n.status>=200&&n.status<300);s.headersMapper&&(a.parsedHeaders=o.serializer.deserialize(s.headersMapper,a.headers.toJSON(),`operationRes.parsedHeaders`,{xml:{},ignoreUnknownProperties:!0}))}return a}function U_(e){let t=Object.keys(e.responses);return t.length===0||t.length===1&&t[0]==="default"}function W_(e,t,n,r){let i=200<=e.status&&e.status<300;if(U_(t)?i:n)if(n){if(!n.isError)return{error:null,shouldReturnResponse:!1}}else return{error:null,shouldReturnResponse:!1};let a=n??t.responses.default,o=new Wg(e.request.streamResponseStatusCodes?.has(e.status)?`Unexpected status code: ${e.status}`:e.bodyAsText,{statusCode:e.status,request:e.request,response:e});if(!a&&!(e.parsedBody?.error?.code&&e.parsedBody?.error?.message))throw o;let s=a?.bodyMapper,c=a?.headersMapper;try{if(e.parsedBody){let n=e.parsedBody,i;if(s){let e=n;if(t.isXML&&s.type.name===Np.Sequence){e=[];let t=s.xmlElementName;typeof n==`object`&&t&&(e=n[t])}i=t.serializer.deserialize(s,e,`error.response.parsedBody`,r)}let a=n.error||i||n;o.code=a.code,a.message&&(o.message=a.message),s&&(o.response.parsedBody=i)}e.headers&&c&&(o.response.parsedHeaders=t.serializer.deserialize(c,e.headers.toJSON(),`operationRes.parsedHeaders`))}catch(t){o.message=`Error "${t.message}" occurred in deserializing the responseBody - "${e.bodyAsText}" for the default response.`}return{error:o,shouldReturnResponse:!1}}async function G_(e,t,n,r,i){if(!n.request.streamResponseStatusCodes?.has(n.status)&&n.bodyAsText){let a=n.bodyAsText,o=n.headers.get(`Content-Type`)||``,s=o?o.split(`;`).map(e=>e.toLowerCase()):[];try{if(s.length===0||s.some(t=>e.indexOf(t)!==-1))return n.parsedBody=JSON.parse(a),n;if(s.some(e=>t.indexOf(e)!==-1)){if(!i)throw Error(`Parsing XML not supported.`);return n.parsedBody=await i(a,r.xml),n}}catch(e){throw new Wg(`Error "${e}" occurred while parsing the response body - ${n.bodyAsText}.`,{code:e.code||Wg.PARSE_ERROR,statusCode:n.status,request:n.request,response:n})}}return n}var K_,q_,J_,Y_=t((()=>{Op(),O_(),Pp(),R_(),K_=[`application/json`,`text/json`],q_=[`application/xml`,`application/atom+xml`],J_=`deserializationPolicy`}));function X_(e){let t=new Set;for(let[n,r]of Object.entries(e.responses))r.bodyMapper&&r.bodyMapper.type.name===Np.Stream&&t.add(Number(n));return t}function Z_(e){let{parameterPath:t,mapper:n}=e,r;return r=typeof t==`string`?t:Array.isArray(t)?t.join(`.`):n.serializedName,r}var Q_=t((()=>{Pp()}));function $_(e={}){let t=e.stringifyXML;return{name:iv,sendRequest(e,n){let r=I_(e),i=r?.operationSpec,a=r?.operationArguments;return i&&a&&(ev(e,a,i),tv(e,a,i,t)),n(e)}}}function ev(e,t,n){if(n.headerParameters)for(let r of n.headerParameters){let i=N_(t,r);if(i!=null||r.mapper.required){i=n.serializer.serialize(r.mapper,i,Z_(r));let t=r.mapper.headerCollectionPrefix;if(t)for(let n of Object.keys(i))e.headers.set(t+n,i[n]);else e.headers.set(r.mapper.serializedName||Z_(r),i)}}let r=t.options?.requestOptions?.customHeaders;if(r)for(let t of Object.keys(r))e.headers.set(t,r[t])}function tv(e,t,n,r=function(){throw Error(`XML serialization unsupported!`)}){let i=t.options?.serializerOptions,a={xml:{rootName:i?.xml.rootName??``,includeRoot:i?.xml.includeRoot??!1,xmlCharKey:i?.xml.xmlCharKey??`_`}},o=a.xml.xmlCharKey;if(n.requestBody&&n.requestBody.mapper){e.body=N_(t,n.requestBody);let i=n.requestBody.mapper,{required:s,serializedName:c,xmlName:l,xmlElementName:u,xmlNamespace:d,xmlNamespacePrefix:f,nullable:p}=i,m=i.type.name;try{if(e.body!==void 0&&e.body!==null||p&&e.body===null||s){let t=Z_(n.requestBody);e.body=n.serializer.serialize(i,e.body,t,a);let s=m===Np.Stream;if(n.isXML){let t=f?`xmlns:${f}`:`xmlns`,n=nv(d,t,m,e.body,a);m===Np.Sequence?e.body=r(rv(n,u||l||c,t,d),{rootName:l||c,xmlCharKey:o}):s||(e.body=r(n,{rootName:l||c,xmlCharKey:o}))}else if(m===Np.String&&(n.contentType?.match(`text/plain`)||n.mediaType===`text`))return;else s||(e.body=JSON.stringify(e.body))}}catch(e){throw Error(`Error "${e.message}" occurred in serializing the payload - ${JSON.stringify(c,void 0,` `)}.`)}}else if(n.formDataParameters&&n.formDataParameters.length>0){e.formData={};for(let r of n.formDataParameters){let i=N_(t,r);if(i!=null){let t=r.mapper.serializedName||Z_(r);e.formData[t]=n.serializer.serialize(r.mapper,i,Z_(r),a)}}}}function nv(e,t,n,r,i){if(e&&![`Composite`,`Sequence`,`Dictionary`].includes(n)){let n={};return n[i.xml.xmlCharKey]=r,n.$={[t]:e},n}return r}function rv(e,t,n,r){if(Array.isArray(e)||(e=[e]),!n||!r)return{[t]:e};let i={[t]:e};return i.$={[n]:r},i}var iv,av=t((()=>{Op(),R_(),Pp(),Q_(),iv=`serializationPolicy`}));function ov(e={}){let t=i_(e??{});return e.credentialOptions&&t.addPolicy(C_({credential:e.credentialOptions.credential,scopes:e.credentialOptions.credentialScopes})),t.addPolicy($_(e.serializationOptions),{phase:`Serialize`}),t.addPolicy(z_(e.deserializationOptions),{phase:`Deserialize`}),t}var sv=t((()=>{Y_(),O_(),av()}));function cv(){return lv||(lv=o_()),lv}var lv,uv=t((()=>{O_()}));function dv(e,t,n,r){let i=pv(t,n,r),a=!1,o=fv(e,i);if(t.path){let e=fv(t.path,i);t.path===`/{nextLink}`&&e.startsWith(`/`)&&(e=e.substring(1)),mv(e)?(o=e,a=!0):o=hv(o,e)}let{queryParams:s,sequenceParams:c}=gv(t,n,r);return o=vv(o,s,c,a),o}function fv(e,t){let n=e;for(let[e,r]of t)n=n.split(e).join(r);return n}function pv(e,t,n){let r=new Map;if(e.urlParameters?.length)for(let i of e.urlParameters){let a=N_(t,i,n),o=Z_(i);a=e.serializer.serialize(i.mapper,a,o),i.skipEncoding||(a=encodeURIComponent(a)),r.set(`{${i.mapper.serializedName||o}}`,a)}return r}function mv(e){return e.includes(`://`)}function hv(e,t){if(!t)return e;let n=new URL(e),r=n.pathname;r.endsWith(`/`)||(r=`${r}/`),t.startsWith(`/`)&&(t=t.substring(1));let i=t.indexOf(`?`);if(i!==-1){let e=t.substring(0,i),a=t.substring(i+1);r+=e,a&&(n.search=n.search?`${n.search}&${a}`:a)}else r+=t;return Object.assign(n,{pathname:r}),n.toString()}function gv(e,t,n){let r=new Map,i=new Set;if(e.queryParameters?.length)for(let a of e.queryParameters){a.mapper.type.name===`Sequence`&&a.mapper.serializedName&&i.add(a.mapper.serializedName);let o=N_(t,a,n);if(o!=null||a.mapper.required){o=e.serializer.serialize(a.mapper,o,Z_(a));let t=a.collectionFormat?yv[a.collectionFormat]:``;if(Array.isArray(o)&&(o=o.map(e=>e??``)),a.collectionFormat===`Multi`&&o.length===0)continue;Array.isArray(o)&&(a.collectionFormat===`SSV`||a.collectionFormat===`TSV`)&&(o=o.join(t)),a.skipEncoding||(o=Array.isArray(o)?o.map(e=>encodeURIComponent(e)):encodeURIComponent(o)),Array.isArray(o)&&(a.collectionFormat===`CSV`||a.collectionFormat===`Pipes`)&&(o=o.join(t)),r.set(a.mapper.serializedName||Z_(a),o)}}return{queryParams:r,sequenceParams:i}}function _v(e){let t=new Map;if(!e||e[0]!==`?`)return t;e=e.slice(1);let n=e.split(`&`);for(let e of n){let[n,r]=e.split(`=`,2),i=t.get(n);i?Array.isArray(i)?i.push(r):t.set(n,[i,r]):t.set(n,r)}return t}function vv(e,t,n,r=!1){if(t.size===0)return e;let i=new URL(e),a=_v(i.search);for(let[e,i]of t){let t=a.get(e);if(Array.isArray(t))if(Array.isArray(i)){t.push(...i);let n=new Set(t);a.set(e,Array.from(n))}else t.push(i);else t?(Array.isArray(i)?i.unshift(t):n.has(e)&&a.set(e,[t,i]),r||a.set(e,i)):a.set(e,i)}let o=[];for(let[e,t]of a)if(typeof t==`string`)o.push(`${e}=${t}`);else if(Array.isArray(t))for(let n of t)o.push(`${e}=${n}`);else o.push(`${e}=${t}`);return i.search=o.length?`?${o.join(`&`)}`:``,i.toString()}var yv,bv=t((()=>{R_(),Q_(),yv={CSV:`,`,SSV:` `,Multi:`Multi`,TSV:` `,Pipes:`|`}})),xv,Sv=t((()=>{bt(),xv=vt(`core-client`)}));function Cv(e){let t=wv(e),n=e.credential&&t?{credentialScopes:t,credential:e.credential}:void 0;return ov({...e,credentialOptions:n})}function wv(e){if(e.credentialScopes)return e.credentialScopes;if(e.endpoint)return`${e.endpoint}/.default`;if(e.baseUri)return`${e.baseUri}/.default`;if(e.credential)throw Error(`When using credentials, the ServiceClientOptions must contain either a endpoint or a credentialScopes. Unable to create a bearerTokenAuthenticationPolicy`)}var Tv,Ev=t((()=>{O_(),sv(),Mp(),uv(),R_(),bv(),Q_(),Sv(),i(),Tv=class{constructor(e={}){if(a(this,`_endpoint`,void 0),a(this,`_requestContentType`,void 0),a(this,`_allowInsecureConnection`,void 0),a(this,`_httpClient`,void 0),a(this,`pipeline`,void 0),this._requestContentType=e.requestContentType,this._endpoint=e.endpoint??e.baseUri,e.baseUri&&xv.warning(`The baseUri option for SDK Clients has been deprecated, please use endpoint instead.`),this._allowInsecureConnection=e.allowInsecureConnection,this._httpClient=e.httpClient||cv(),this.pipeline=e.pipeline||Cv(e),e.additionalPolicies?.length)for(let{policy:t,position:n}of e.additionalPolicies){let e=n===`perRetry`?`Sign`:void 0;this.pipeline.addPolicy(t,{afterPhase:e})}}sendRequest(e){return this.pipeline.sendRequest(this._httpClient,e)}async sendOperationRequest(e,t){let n=t.baseUrl||this._endpoint;if(!n)throw Error(`If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.`);let r=u_({url:dv(n,t,e,this)});r.method=t.httpMethod;let i=I_(r);i.operationSpec=t,i.operationArguments=e;let a=t.contentType||this._requestContentType;a&&t.requestBody&&r.headers.set(`Content-Type`,a);let o=e.options;if(o){let e=o.requestOptions;e&&(e.timeout&&(r.timeout=e.timeout),e.onUploadProgress&&(r.onUploadProgress=e.onUploadProgress),e.onDownloadProgress&&(r.onDownloadProgress=e.onDownloadProgress),e.shouldDeserialize!==void 0&&(i.shouldDeserialize=e.shouldDeserialize),e.allowInsecureConnection&&(r.allowInsecureConnection=!0)),o.abortSignal&&(r.abortSignal=o.abortSignal),o.tracingOptions&&(r.tracingOptions=o.tracingOptions)}this._allowInsecureConnection&&(r.allowInsecureConnection=!0),r.streamResponseStatusCodes===void 0&&(r.streamResponseStatusCodes=X_(t));try{let e=await this.sendRequest(r),n=jp(e,t.responses[e.status]);return o?.onResponse&&o.onResponse(e,n),n}catch(e){if(typeof e==`object`&&e?.response){let n=e.response,r=jp(n,t.responses[e.statusCode]||t.responses.default);e.details=r,o?.onResponse&&o.onResponse(n,r,e)}throw e}}}})),Dv=t((()=>{Pp(),Ev(),sv(),Op(),Y_(),av(),Sv(),pp()}));function Ov(e){return e===`adfs`?`oauth2/token`:`oauth2/v2.0/token`}var kv=t((()=>{}));function Av(e){let t=``;if(Array.isArray(e)){if(e.length!==1)return;t=e[0]}else typeof e==`string`&&(t=e);return t.endsWith(Nv)?t.substr(0,t.lastIndexOf(Nv)):t}function jv(e){if(typeof e.expires_on==`number`)return e.expires_on*1e3;if(typeof e.expires_on==`string`){let t=+e.expires_on;if(!isNaN(t))return t*1e3;let n=Date.parse(e.expires_on);if(!isNaN(n))return n}if(typeof e.expires_in==`number`)return Date.now()+e.expires_in*1e3;throw Error(`Failed to parse token expiration from body. expires_in="${e.expires_in}", expires_on="${e.expires_on}"`)}function Mv(e){if(e.refresh_on){if(typeof e.refresh_on==`number`)return e.refresh_on*1e3;if(typeof e.refresh_on==`string`){let t=+e.refresh_on;if(!isNaN(t))return t*1e3;let n=Date.parse(e.refresh_on);if(!isNaN(n))return n}throw Error(`Failed to parse refresh_on from body. refresh_on="${e.refresh_on}"`)}else return}var Nv,Pv,Fv=t((()=>{Nv=`/.default`,Pv="Specifying a `clientId` or `resourceId` is not supported by the Service Fabric managed identity environment. The managed identity configuration is determined by the Service Fabric cluster resource configuration. See https://aka.ms/servicefabricmi for more information"}));function Iv(e){let t=e?.authorityHost;return dp&&(t=t??process.env.AZURE_AUTHORITY_HOST),t??be}var Lv,Rv,zv=t((()=>{Dv(),pp(),O_(),b(),kv(),Ce(),T(),C(),Fv(),i(),Lv=`noCorrelationId`,Rv=class extends Tv{constructor(e){let t=`azsdk-js-identity/${_e}`,n=e?.userAgentOptions?.userAgentPrefix?`${e.userAgentOptions.userAgentPrefix} ${t}`:`${t}`,r=Iv(e);if(!r.startsWith(`https:`))throw Error(`The authorityHost address must use the 'https' protocol.`);super({requestContentType:`application/json; charset=utf-8`,retryOptions:{maxRetries:3},...e,userAgentOptions:{userAgentPrefix:n},baseUri:r}),a(this,`authorityHost`,void 0),a(this,`allowLoggingAccountIdentifiers`,void 0),a(this,`abortControllers`,void 0),a(this,`allowInsecureConnection`,!1),a(this,`tokenCredentialOptions`,void 0),this.authorityHost=r,this.abortControllers=new Map,this.allowLoggingAccountIdentifiers=e?.loggingOptions?.allowLoggingAccountIdentifiers,this.tokenCredentialOptions={...e},e?.allowInsecureConnection&&(this.allowInsecureConnection=e.allowInsecureConnection)}async sendTokenRequest(e){wt.info(`IdentityClient: sending token request to [${e.url}]`);let t=await this.sendRequest(e);if(t.bodyAsText&&(t.status===200||t.status===201)){let n=JSON.parse(t.bodyAsText);if(!n.access_token)return null;this.logIdentifiers(t);let r={accessToken:{token:n.access_token,expiresOnTimestamp:jv(n),refreshAfterTimestamp:Mv(n),tokenType:`Bearer`},refreshToken:n.refresh_token};return wt.info(`IdentityClient: [${e.url}] token acquired, expires on ${r.accessToken.expiresOnTimestamp}`),r}else{let e=new Be(t.status,t.bodyAsText);throw wt.warning(`IdentityClient: authentication error. HTTP status: ${t.status}, ${e.errorResponse.errorDescription}`),e}}async refreshAccessToken(e,t,n,r,i,a={}){if(r===void 0)return null;wt.info(`IdentityClient: refreshing access token with client ID: ${t}, scopes: ${n} started`);let o={grant_type:`refresh_token`,client_id:t,refresh_token:r,scope:n};i!==void 0&&(o.client_secret=i);let s=new URLSearchParams(o);return w.withSpan(`IdentityClient.refreshAccessToken`,a,async n=>{try{let r=Ov(e),i=u_({url:`${this.authorityHost}/${e}/${r}`,method:`POST`,body:s.toString(),abortSignal:a.abortSignal,headers:c_({Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`}),tracingOptions:n.tracingOptions}),o=await this.sendTokenRequest(i);return wt.info(`IdentityClient: refreshed token for client ID: ${t}`),o}catch(e){if(e.name===`AuthenticationError`&&e.errorResponse.error===`interaction_required`)return wt.info(`IdentityClient: interaction required for client ID: ${t}`),null;throw wt.warning(`IdentityClient: failed refreshing token for client ID: ${t}: ${e}`),e}})}generateAbortSignal(e){let t=new AbortController,n=this.abortControllers.get(e)||[];n.push(t),this.abortControllers.set(e,n);let r=t.signal.onabort;return t.signal.onabort=(...n)=>{this.abortControllers.set(e,void 0),r&&r.apply(t.signal,n)},t.signal}abortRequests(e){let t=e||Lv,n=[...this.abortControllers.get(t)||[],...this.abortControllers.get(Lv)||[]];if(n.length){for(let e of n)e.abort();this.abortControllers.set(t,void 0)}}getCorrelationId(e){let t=e?.body?.split(`&`).map(e=>e.split(`=`)).find(([e])=>e===`client-request-id`);return t&&t.length&&t[1]||Lv}async sendGetRequestAsync(e,t){let n=u_({url:e,method:`GET`,body:t?.body,allowInsecureConnection:this.allowInsecureConnection,headers:c_(t?.headers),abortSignal:this.generateAbortSignal(Lv)}),r=await this.sendRequest(n);return this.logIdentifiers(r),{body:r.bodyAsText?JSON.parse(r.bodyAsText):void 0,headers:r.headers.toJSON(),status:r.status}}async sendPostRequestAsync(e,t){let n=u_({url:e,method:`POST`,body:t?.body,headers:c_(t?.headers),allowInsecureConnection:this.allowInsecureConnection,abortSignal:this.generateAbortSignal(this.getCorrelationId(t))}),r=await this.sendRequest(n);return this.logIdentifiers(r),{body:r.bodyAsText?JSON.parse(r.bodyAsText):void 0,headers:r.headers.toJSON(),status:r.status}}getTokenCredentialOptions(){return this.tokenCredentialOptions}logIdentifiers(e){if(!(!this.allowLoggingAccountIdentifiers||!e.bodyAsText))try{let t=(e.parsedBody||JSON.parse(e.bodyAsText)).access_token;if(!t)return;let n=t.split(`.`)[1],{appid:r,upn:i,tid:a,oid:o}=JSON.parse(Buffer.from(n,`base64`).toString(`utf8`));wt.info(`[Authenticated account] Client ID: ${r}. Tenant ID: ${a}. User Principal Name: ${i||`No User Principal Name available`}. Object ID (user): ${o}`)}catch(e){wt.warning(`allowLoggingAccountIdentifiers was set, but we couldn't log the account information. Error:`,e.message)}}}}));function Bv(e){let t=e;return t===void 0&&globalThis.process?.env?.AZURE_REGIONAL_AUTHORITY_NAME!==void 0&&(t=process.env.AZURE_REGIONAL_AUTHORITY_NAME),t===Vv.AutoDiscoverRegion?`AUTO_DISCOVER`:t}var Vv,Hv=t((()=>{(function(e){e.AutoDiscoverRegion=`AutoDiscoverRegion`,e.USWest=`westus`,e.USWest2=`westus2`,e.USCentral=`centralus`,e.USEast=`eastus`,e.USEast2=`eastus2`,e.USNorthCentral=`northcentralus`,e.USSouthCentral=`southcentralus`,e.USWestCentral=`westcentralus`,e.CanadaCentral=`canadacentral`,e.CanadaEast=`canadaeast`,e.BrazilSouth=`brazilsouth`,e.EuropeNorth=`northeurope`,e.EuropeWest=`westeurope`,e.UKSouth=`uksouth`,e.UKWest=`ukwest`,e.FranceCentral=`francecentral`,e.FranceSouth=`francesouth`,e.SwitzerlandNorth=`switzerlandnorth`,e.SwitzerlandWest=`switzerlandwest`,e.GermanyNorth=`germanynorth`,e.GermanyWestCentral=`germanywestcentral`,e.NorwayWest=`norwaywest`,e.NorwayEast=`norwayeast`,e.AsiaEast=`eastasia`,e.AsiaSouthEast=`southeastasia`,e.JapanEast=`japaneast`,e.JapanWest=`japanwest`,e.AustraliaEast=`australiaeast`,e.AustraliaSouthEast=`australiasoutheast`,e.AustraliaCentral=`australiacentral`,e.AustraliaCentral2=`australiacentral2`,e.IndiaCentral=`centralindia`,e.IndiaSouth=`southindia`,e.IndiaWest=`westindia`,e.KoreaSouth=`koreasouth`,e.KoreaCentral=`koreacentral`,e.UAECentral=`uaecentral`,e.UAENorth=`uaenorth`,e.SouthAfricaNorth=`southafricanorth`,e.SouthAfricaWest=`southafricawest`,e.ChinaNorth=`chinanorth`,e.ChinaEast=`chinaeast`,e.ChinaNorth2=`chinanorth2`,e.ChinaEast2=`chinaeast2`,e.GermanyCentral=`germanycentral`,e.GermanyNorthEast=`germanynortheast`,e.GovernmentUSVirginia=`usgovvirginia`,e.GovernmentUSIowa=`usgoviowa`,e.GovernmentUSArizona=`usgovarizona`,e.GovernmentUSTexas=`usgovtexas`,e.GovernmentUSDodEast=`usdodeast`,e.GovernmentUSDodCentral=`usdodcentral`})(Vv||(Vv={}))}));function Uv(e){return`The current credential is not configured to acquire tokens for tenant ${e}. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add "*" to AdditionallyAllowedTenants to allow acquiring tokens for any tenant.`}function Wv(e,t,n=[],r){let i;if(i=process.env.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH||e===`adfs`?e:t?.tenantId??e,e&&i!==e&&!n.includes(`*`)&&!n.some(e=>e.localeCompare(i)===0)){let e=Uv(i);throw r?.info(e),new y(e)}return i}var Gv=t((()=>{b()}));function Kv(e,t){if(!t.match(/^[0-9a-zA-Z-.]+$/)){let t=Error(`Invalid tenant id provided. You can locate your tenant id by following the instructions listed here: https://learn.microsoft.com/partner-center/find-ids-and-domain-names.`);throw e.info(x(``,t)),t}}function qv(e,t,n){return t?(Kv(e,t),t):(n||(n=ve),n===`04b07795-8ddb-461a-bbee-02f9e1bf7b46`?`organizations`:`common`)}function Jv(e){return!e||e.length===0?[]:e.includes(`*`)?xe:e}var Yv=t((()=>{Ce(),C(),Gv()}));function Xv(e,t,n={}){let r=qv(n.logger??$,t,e),i=_p(r,gp(n)),a=new Rv({...n.tokenCredentialOptions,authorityHost:i,loggingOptions:n.loggingOptions});return{auth:{clientId:e,authority:i,knownAuthorities:vp(r,i,n.disableInstanceDiscovery)},system:{networkClient:a,loggerOptions:{loggerCallback:Ep(n.logger??$),logLevel:yp(_t()),piiLoggingEnabled:n.loggingOptions?.enableUnsafeSupportLogging}}}}function Zv(e,t,n={}){let r={msalConfig:Xv(e,t,n),cachedAccount:n.authenticationRecord?xp(n.authenticationRecord):null,pluginConfiguration:Ne.generatePluginConfiguration(n),logger:n.logger??$},i=new Map;async function a(e={}){let t=e.enableCae?`CAE`:`default`,n=i.get(t);if(n)return r.logger.getToken.info(`Existing PublicClientApplication found in cache, returning it.`),n;r.logger.getToken.info(`Creating new PublicClientApplication with CAE ${e.enableCae?`enabled`:`disabled`}.`);let a=e.enableCae?r.pluginConfiguration.cache.cachePluginCae:r.pluginConfiguration.cache.cachePlugin;return r.msalConfig.auth.clientCapabilities=e.enableCae?[`cp1`]:void 0,n=new Sd({...r.msalConfig,broker:{nativeBrokerPlugin:r.pluginConfiguration.broker.nativeBrokerPlugin},cache:{cachePlugin:await a}}),i.set(t,n),n}let o=new Map;async function s(e={}){let t=e.enableCae?`CAE`:`default`,n=o.get(t);if(n)return r.logger.getToken.info(`Existing ConfidentialClientApplication found in cache, returning it.`),n;r.logger.getToken.info(`Creating new ConfidentialClientApplication with CAE ${e.enableCae?`enabled`:`disabled`}.`);let i=e.enableCae?r.pluginConfiguration.cache.cachePluginCae:r.pluginConfiguration.cache.cachePlugin;return r.msalConfig.auth.clientCapabilities=e.enableCae?[`cp1`]:void 0,n=new Ad({...r.msalConfig,broker:{nativeBrokerPlugin:r.pluginConfiguration.broker.nativeBrokerPlugin},cache:{cachePlugin:await i}}),o.set(t,n),n}async function c(e,t,n={}){if(r.cachedAccount===null)throw r.logger.getToken.info(`No cached account found in local state.`),new Ue({scopes:t});n.claims&&(r.cachedClaims=n.claims);let i={account:r.cachedAccount,scopes:t,claims:r.cachedClaims};r.pluginConfiguration.broker.isEnabled&&(i.extraQueryParameters||(i.extraQueryParameters={}),r.pluginConfiguration.broker.enableMsaPassthrough&&(i.extraQueryParameters.msal_request_type=`consumer_passthrough`)),n.proofOfPossessionOptions&&(i.shrNonce=n.proofOfPossessionOptions.nonce,i.authenticationScheme=`pop`,i.resourceRequestMethod=n.proofOfPossessionOptions.resourceRequestMethod,i.resourceRequestUri=n.proofOfPossessionOptions.resourceRequestUrl),r.logger.getToken.info(`Attempting to acquire token silently`);try{return await e.acquireTokenSilent(i)}catch(e){throw bp(t,e,n)}}function l(e){return e?.tenantId?_p(e.tenantId,gp(n)):r.msalConfig.auth.authority}async function u(e,t,n,i){let a=null;try{a=await c(e,t,n)}catch(e){if(e.name!==`AuthenticationRequiredError`)throw e;if(n.disableAutomaticAuthentication)throw new Ue({scopes:t,getTokenOptions:n,message:`Automatic authentication has been disabled. You may call the authentication() method.`})}if(a===null)try{a=await i()}catch(e){throw bp(t,e,n)}return hp(t,a,n),r.cachedAccount=a?.account??null,r.logger.getToken.info(St(t)),{token:a.accessToken,expiresOnTimestamp:a.expiresOn.getTime(),refreshAfterTimestamp:a.refreshOn?.getTime(),tokenType:a.tokenType}}async function d(e,t,n={}){r.logger.getToken.info(`Attempting to acquire token using client secret`),r.msalConfig.auth.clientSecret=t;let i=await s(n);try{let t=await i.acquireTokenByClientCredential({scopes:e,authority:l(n),azureRegion:Bv(),claims:n?.claims});return hp(e,t,n),r.logger.getToken.info(St(e)),{token:t.accessToken,expiresOnTimestamp:t.expiresOn.getTime(),refreshAfterTimestamp:t.refreshOn?.getTime(),tokenType:t.tokenType}}catch(t){throw bp(e,t,n)}}async function f(e,t,n={}){r.logger.getToken.info(`Attempting to acquire token using client assertion`),r.msalConfig.auth.clientAssertion=t;let i=await s(n);try{let a=await i.acquireTokenByClientCredential({scopes:e,authority:l(n),azureRegion:Bv(),claims:n?.claims,clientAssertion:t});return hp(e,a,n),r.logger.getToken.info(St(e)),{token:a.accessToken,expiresOnTimestamp:a.expiresOn.getTime(),refreshAfterTimestamp:a.refreshOn?.getTime(),tokenType:a.tokenType}}catch(t){throw bp(e,t,n)}}async function p(e,t,n={}){r.logger.getToken.info(`Attempting to acquire token using client certificate`),r.msalConfig.auth.clientCertificate=t;let i=await s(n);try{let t=await i.acquireTokenByClientCredential({scopes:e,authority:l(n),azureRegion:Bv(),claims:n?.claims});return hp(e,t,n),r.logger.getToken.info(St(e)),{token:t.accessToken,expiresOnTimestamp:t.expiresOn.getTime(),refreshAfterTimestamp:t.refreshOn?.getTime(),tokenType:t.tokenType}}catch(t){throw bp(e,t,n)}}async function m(e,t,n={}){r.logger.getToken.info(`Attempting to acquire token using device code`);let i=await a(n);return u(i,e,n,()=>{let r={scopes:e,cancel:n?.abortSignal?.aborted??!1,deviceCodeCallback:t,authority:l(n),claims:n?.claims},a=i.acquireTokenByDeviceCode(r);return n.abortSignal&&n.abortSignal.addEventListener(`abort`,()=>{r.cancel=!0}),a})}async function h(e,t,n,i={}){r.logger.getToken.info(`Attempting to acquire token using username and password`);let o=await a(i);return u(o,e,i,()=>{let r={scopes:e,username:t,password:n,authority:l(i),claims:i?.claims};return o.acquireTokenByUsernamePassword(r)})}function g(){if(r.cachedAccount)return Sp(e,r.cachedAccount)}async function _(e,t,n,i,o={}){r.logger.getToken.info(`Attempting to acquire token using authorization code`);let c;return i?(r.msalConfig.auth.clientSecret=i,c=await s(o)):c=await a(o),u(c,e,o,()=>c.acquireTokenByCode({scopes:e,redirectUri:t,code:n,authority:l(o),claims:o?.claims}))}async function ee(e,t,n,i={}){$.getToken.info(`Attempting to acquire token on behalf of another user`),typeof n==`string`?($.getToken.info(`Using client secret for on behalf of flow`),r.msalConfig.auth.clientSecret=n):typeof n==`function`?($.getToken.info(`Using client assertion callback for on behalf of flow`),r.msalConfig.auth.clientAssertion=n):($.getToken.info(`Using client certificate for on behalf of flow`),r.msalConfig.auth.clientCertificate=n);let a=await s(i);try{let n=await a.acquireTokenOnBehalfOf({scopes:e,authority:l(i),claims:i.claims,oboAssertion:t});return hp(e,n,i),$.getToken.info(St(e)),{token:n.accessToken,expiresOnTimestamp:n.expiresOn.getTime(),refreshAfterTimestamp:n.refreshOn?.getTime(),tokenType:n.tokenType}}catch(t){throw bp(e,t,i)}}function te(e,t){return{openBrowser:async e=>{await(await import(`./open-BtQHzzL9.js`)).default(e,{newInstance:!0})},scopes:e,authority:l(t),claims:t?.claims,loginHint:t?.loginHint,errorTemplate:t?.browserCustomizationOptions?.errorMessage,successTemplate:t?.browserCustomizationOptions?.successMessage,prompt:t?.loginHint?`login`:`select_account`}}async function ne(e,t,n={}){$.verbose(`Authentication will resume through the broker`);let i=await a(n),o=te(e,n);r.pluginConfiguration.broker.parentWindowHandle?o.windowHandle=Buffer.from(r.pluginConfiguration.broker.parentWindowHandle):$.warning(`Parent window handle is not specified for the broker. This may cause unexpected behavior. Please provide the parentWindowHandle.`),r.pluginConfiguration.broker.enableMsaPassthrough&&((o.extraQueryParameters??(o.extraQueryParameters={})).msal_request_type=`consumer_passthrough`),t?(o.prompt=`none`,$.verbose(`Attempting broker authentication using the default broker account`)):$.verbose(`Attempting broker authentication without the default broker account`),n.proofOfPossessionOptions&&(o.shrNonce=n.proofOfPossessionOptions.nonce,o.authenticationScheme=`pop`,o.resourceRequestMethod=n.proofOfPossessionOptions.resourceRequestMethod,o.resourceRequestUri=n.proofOfPossessionOptions.resourceRequestUrl);try{return await i.acquireTokenInteractive(o)}catch(r){if($.verbose(`Failed to authenticate through the broker: ${r.message}`),n.disableAutomaticAuthentication)throw new Ue({scopes:e,getTokenOptions:n,message:`Cannot silently authenticate with default broker account.`});if(t)return ne(e,!1,n);throw r}}async function re(e,t,n={}){$.getToken.info(`Attempting to acquire token using brokered authentication with useDefaultBrokerAccount: ${t}`);let i=await ne(e,t,n);return hp(e,i,n),r.cachedAccount=i?.account??null,r.logger.getToken.info(St(e)),{token:i.accessToken,expiresOnTimestamp:i.expiresOn.getTime(),refreshAfterTimestamp:i.refreshOn?.getTime(),tokenType:i.tokenType}}async function ie(e,t={}){$.getToken.info(`Attempting to acquire token interactively`);let n=await a(t);return u(n,e,t,async()=>{let i=te(e,t);return r.pluginConfiguration.broker.isEnabled?ne(e,r.pluginConfiguration.broker.useDefaultBrokerAccount??!1,t):(t.proofOfPossessionOptions&&(i.shrNonce=t.proofOfPossessionOptions.nonce,i.authenticationScheme=`pop`,i.resourceRequestMethod=t.proofOfPossessionOptions.resourceRequestMethod,i.resourceRequestUri=t.proofOfPossessionOptions.resourceRequestUrl),n.acquireTokenInteractive(i))})}return{getActiveAccount:g,getBrokeredToken:re,getTokenByClientSecret:d,getTokenByClientAssertion:f,getTokenByClientCertificate:p,getTokenByDeviceCode:m,getTokenByUsernamePassword:h,getTokenByAuthorizationCode:_,getTokenOnBehalfOf:ee,getTokenByInteractiveRequest:ie}}var $,Qv=t((()=>{Pf(),C(),Pe(),Dp(),b(),zv(),Hv(),bt(),Yv(),$=S(`MsalClient`)}));async function $v(e,t){let n=e.certificate,r=e.certificatePath,i=n||await pe(r,`utf8`),a=t?i:void 0,o=/(-+BEGIN CERTIFICATE-+)(\n\r?|\r\n?)([A-Za-z0-9+/\n\r]+=*)(\n\r?|\r\n?)(-+END CERTIFICATE-+)/g,s=[],c;do c=o.exec(i),c&&s.push(c[3]);while(c);if(s.length===0)throw Error(`The file at the specified path does not contain a PEM-encoded certificate.`);let l=v(`sha1`).update(Buffer.from(s[0],`base64`)).digest(`hex`).toUpperCase();return{certificateContents:i,thumbprintSha256:v(`sha256`).update(Buffer.from(s[0],`base64`)).digest(`hex`).toUpperCase(),thumbprint:l,x5c:a}}var ey,ty,ny,ry=t((()=>{Qv(),Yv(),C(),T(),i(),ey=`ClientCertificateCredential`,ty=S(ey),ny=class{constructor(e,t,n,r={}){if(a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`certificateConfiguration`,void 0),a(this,`sendCertificateChain`,void 0),a(this,`msalClient`,void 0),!e||!t)throw Error(`${ey}: tenantId and clientId are required parameters.`);this.tenantId=e,this.additionallyAllowedTenantIds=Jv(r?.additionallyAllowedTenants),this.sendCertificateChain=r.sendCertificateChain,this.certificateConfiguration={...typeof n==`string`?{certificatePath:n}:n};let i=this.certificateConfiguration.certificate,o=this.certificateConfiguration.certificatePath;if(!this.certificateConfiguration||!(i||o))throw Error(`${ey}: Provide either a PEM certificate in string form, or the path to that certificate in the filesystem. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.`);if(i&&o)throw Error(`${ey}: To avoid unexpected behaviors, providing both the contents of a PEM certificate and the path to a PEM certificate is forbidden. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.`);this.msalClient=Zv(t,e,{...r,logger:ty,tokenCredentialOptions:r})}async getToken(e,t={}){return w.withSpan(`${ey}.getToken`,t,async t=>{t.tenantId=Wv(this.tenantId,t,this.additionallyAllowedTenantIds,ty);let n=Array.isArray(e)?e:[e],r=await this.buildClientCertificate();return this.msalClient.getTokenByClientCertificate(n,r,t)})}async buildClientCertificate(){let e=await $v(this.certificateConfiguration,this.sendCertificateChain??!1),t;return t=this.certificateConfiguration.certificatePassword===void 0?e.certificateContents:oe({key:e.certificateContents,passphrase:this.certificateConfiguration.certificatePassword,format:`pem`}).export({format:`pem`,type:`pkcs8`}).toString(),{thumbprint:e.thumbprint,thumbprintSha256:e.thumbprintSha256,privateKey:t,x5c:e.x5c}}}}));function iy(e){return Array.isArray(e)?e:[e]}function ay(e,t){if(!e.match(/^[0-9a-zA-Z-_.:/]+$/)){let n=Error(`Invalid scope was specified by the user or calling client`);throw t.getToken.info(x(e,n)),n}}function oy(e){return e.replace(/\/.default$/,``)}var sy=t((()=>{C()})),cy,ly,uy=t((()=>{Qv(),Yv(),b(),C(),sy(),T(),i(),cy=S(`ClientSecretCredential`),ly=class{constructor(e,t,n,r={}){if(a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`msalClient`,void 0),a(this,`clientSecret`,void 0),!e)throw new y(`ClientSecretCredential: tenantId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.`);if(!t)throw new y(`ClientSecretCredential: clientId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.`);if(!n)throw new y(`ClientSecretCredential: clientSecret is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.`);this.clientSecret=n,this.tenantId=e,this.additionallyAllowedTenantIds=Jv(r?.additionallyAllowedTenants),this.msalClient=Zv(t,e,{...r,logger:cy,tokenCredentialOptions:r})}async getToken(e,t={}){return w.withSpan(`${this.constructor.name}.getToken`,t,async t=>{t.tenantId=Wv(this.tenantId,t,this.additionallyAllowedTenantIds,cy);let n=iy(e);return this.msalClient.getTokenByClientSecret(n,this.clientSecret,t)})}}})),dy,fy,py=t((()=>{Qv(),Yv(),b(),C(),sy(),T(),i(),dy=S(`UsernamePasswordCredential`),fy=class{constructor(e,t,n,r,i={}){if(a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`msalClient`,void 0),a(this,`username`,void 0),a(this,`password`,void 0),!e)throw new y(`UsernamePasswordCredential: tenantId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/usernamepasswordcredential/troubleshoot.`);if(!t)throw new y(`UsernamePasswordCredential: clientId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/usernamepasswordcredential/troubleshoot.`);if(!n)throw new y(`UsernamePasswordCredential: username is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/usernamepasswordcredential/troubleshoot.`);if(!r)throw new y(`UsernamePasswordCredential: password is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/usernamepasswordcredential/troubleshoot.`);this.tenantId=e,this.additionallyAllowedTenantIds=Jv(i?.additionallyAllowedTenants),this.username=n,this.password=r,this.msalClient=Zv(t,this.tenantId,{...i,tokenCredentialOptions:i??{}})}async getToken(e,t={}){return w.withSpan(`${this.constructor.name}.getToken`,t,async t=>{t.tenantId=Wv(this.tenantId,t,this.additionallyAllowedTenantIds,dy);let n=iy(e);return this.msalClient.getTokenByUsernamePassword(n,this.username,this.password,t)})}}}));function my(){return(process.env.AZURE_ADDITIONALLY_ALLOWED_TENANTS??``).split(`;`)}function hy(){let e=(process.env.AZURE_CLIENT_SEND_CERTIFICATE_CHAIN??``).toLowerCase(),t=e===`true`||e===`1`;return vy.verbose(`AZURE_CLIENT_SEND_CERTIFICATE_CHAIN: ${process.env.AZURE_CLIENT_SEND_CERTIFICATE_CHAIN}; sendCertificateChain: ${t}`),t}var gy,_y,vy,yy,by=t((()=>{b(),C(),ry(),uy(),py(),Yv(),T(),i(),gy=[`AZURE_TENANT_ID`,`AZURE_CLIENT_ID`,`AZURE_CLIENT_SECRET`,`AZURE_CLIENT_CERTIFICATE_PATH`,`AZURE_CLIENT_CERTIFICATE_PASSWORD`,`AZURE_USERNAME`,`AZURE_PASSWORD`,`AZURE_ADDITIONALLY_ALLOWED_TENANTS`,`AZURE_CLIENT_SEND_CERTIFICATE_CHAIN`],_y=`EnvironmentCredential`,vy=S(_y),yy=class{constructor(e){a(this,`_credential`,void 0);let t=xt(gy).assigned.join(`, `);vy.info(`Found the following environment variables: ${t}`);let n=process.env.AZURE_TENANT_ID,r=process.env.AZURE_CLIENT_ID,i=process.env.AZURE_CLIENT_SECRET,o=my(),s=hy(),c={...e,additionallyAllowedTenantIds:o,sendCertificateChain:s};if(n&&Kv(vy,n),n&&r&&i){vy.info(`Invoking ClientSecretCredential with tenant ID: ${n}, clientId: ${r} and clientSecret: [REDACTED]`),this._credential=new ly(n,r,i,c);return}let l=process.env.AZURE_CLIENT_CERTIFICATE_PATH,u=process.env.AZURE_CLIENT_CERTIFICATE_PASSWORD;if(n&&r&&l){vy.info(`Invoking ClientCertificateCredential with tenant ID: ${n}, clientId: ${r} and certificatePath: ${l}`),this._credential=new ny(n,r,{certificatePath:l,certificatePassword:u},c);return}let d=process.env.AZURE_USERNAME,f=process.env.AZURE_PASSWORD;n&&r&&d&&f&&(vy.info(`Invoking UsernamePasswordCredential with tenant ID: ${n}, clientId: ${r} and username: ${d}`),vy.warning(`Environment is configured to use username and password authentication. This authentication method is deprecated, as it doesn't support multifactor authentication (MFA). Use a more secure credential. For more details, see https://aka.ms/azsdk/identity/mfa.`),this._credential=new fy(n,r,d,f,c))}async getToken(e,t={}){return w.withSpan(`${_y}.getToken`,t,async t=>{if(this._credential)try{let n=await this._credential.getToken(e,t);return vy.getToken.info(St(e)),n}catch(t){let n=new Be(400,{error:`${_y} authentication failed. To troubleshoot, visit https://aka.ms/azsdk/js/identity/environmentcredential/troubleshoot.`,error_description:t.message.toString().split(`More details:`).join(``)});throw vy.getToken.info(x(e,n)),n}throw new y(`${_y} is unavailable. No underlying credential could be used. To troubleshoot, visit https://aka.ms/azsdk/js/identity/environmentcredential/troubleshoot.`)})}}}));function xy(e){return f_([{name:`imdsRetryPolicy`,retry:({retryCount:t,response:n})=>n?.status!==404&&n?.status!==410?{skipStrategy:!0}:lp(t,{retryDelayInMs:n?.status===410?Math.max(Cy,e.startDelayInMs):e.startDelayInMs,maxRetryDelayInMs:Sy})}],{maxRetries:e.maxRetries})}var Sy,Cy,wy=t((()=>{O_(),pp(),Sy=1e3*64,Cy=3e3}));function Ty(e){if(!Av(e))throw Error(`${Ey}: Multiple scopes are not supported.`);return{url:`${new URL(ky,process.env.AZURE_POD_IDENTITY_AUTHORITY_HOST??Oy)}`,method:`GET`,headers:c_({Accept:`application/json`})}}var Ey,Dy,Oy,ky,Ay,jy=t((()=>{O_(),pp(),C(),Fv(),T(),Ey=`ManagedIdentityCredential - IMDS`,Dy=S(Ey),Oy=`http://169.254.169.254`,ky=`/metadata/identity/oauth2/token`,Ay={name:`imdsMsi`,async isAvailable(e){let{scopes:t,identityClient:n,getTokenOptions:r}=e,i=Av(t);if(!i)return Dy.info(`${Ey}: Unavailable. Multiple scopes are not supported.`),!1;if(process.env.AZURE_POD_IDENTITY_AUTHORITY_HOST)return!0;if(!n)throw Error(`Missing IdentityClient`);let a=Ty(i);return w.withSpan(`ManagedIdentityCredential-pingImdsEndpoint`,r??{},async e=>{a.tracingOptions=e.tracingOptions;let t=u_(a);t.timeout=e.requestOptions?.timeout||1e3,t.allowInsecureConnection=!0;let r;try{Dy.info(`${Ey}: Pinging the Azure IMDS endpoint`),r=await n.sendRequest(t)}catch(e){return up(e)&&Dy.verbose(`${Ey}: Caught error ${e.name}: ${e.message}`),Dy.info(`${Ey}: The Azure IMDS endpoint is unavailable`),!1}return r.status===403&&r.bodyAsText?.includes(`unreachable`)?(Dy.info(`${Ey}: The Azure IMDS endpoint is unavailable`),Dy.info(`${Ey}: ${r.bodyAsText}`),!1):(Dy.info(`${Ey}: The Azure IMDS endpoint is available`),!0)})}}})),My,Ny,Py=t((()=>{Qv(),Yv(),b(),C(),T(),i(),My=S(`ClientAssertionCredential`),Ny=class{constructor(e,t,n,r={}){if(a(this,`msalClient`,void 0),a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`getAssertion`,void 0),a(this,`options`,void 0),!e)throw new y(`ClientAssertionCredential: tenantId is a required parameter.`);if(!t)throw new y(`ClientAssertionCredential: clientId is a required parameter.`);if(!n)throw new y(`ClientAssertionCredential: clientAssertion is a required parameter.`);this.tenantId=e,this.additionallyAllowedTenantIds=Jv(r?.additionallyAllowedTenants),this.options=r,this.getAssertion=n,this.msalClient=Zv(t,e,{...r,logger:My,tokenCredentialOptions:this.options})}async getToken(e,t={}){return w.withSpan(`${this.constructor.name}.getToken`,t,async t=>{t.tenantId=Wv(this.tenantId,t,this.additionallyAllowedTenantIds,My);let n=Array.isArray(e)?e:[e];return this.msalClient.getTokenByClientAssertion(n,this.getAssertion,t)})}}})),Fy,Iy,Ly,Ry,zy=t((()=>{C(),Py(),b(),Yv(),i(),Fy=`WorkloadIdentityCredential`,Iy=[`AZURE_TENANT_ID`,`AZURE_CLIENT_ID`,`AZURE_FEDERATED_TOKEN_FILE`],Ly=S(Fy),Ry=class{constructor(e){a(this,`client`,void 0),a(this,`azureFederatedTokenFileContent`,void 0),a(this,`cacheDate`,void 0),a(this,`federatedTokenFilePath`,void 0);let t=xt(Iy).assigned.join(`, `);Ly.info(`Found the following environment variables: ${t}`);let n=e??{},r=n.tenantId||process.env.AZURE_TENANT_ID,i=n.clientId||process.env.AZURE_CLIENT_ID;if(this.federatedTokenFilePath=n.tokenFilePath||process.env.AZURE_FEDERATED_TOKEN_FILE,r&&Kv(Ly,r),!i)throw new y(`${Fy}: is unavailable. clientId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_CLIENT_ID".
|
|
9
|
+
See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`);if(!r)throw new y(`${Fy}: is unavailable. tenantId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_TENANT_ID".
|
|
10
|
+
See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`);if(!this.federatedTokenFilePath)throw new y(`${Fy}: is unavailable. federatedTokenFilePath is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_FEDERATED_TOKEN_FILE".
|
|
11
|
+
See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`);Ly.info(`Invoking ClientAssertionCredential with tenant ID: ${r}, clientId: ${n.clientId} and federated token path: [REDACTED]`),this.client=new Ny(r,i,this.readFileContents.bind(this),e)}async getToken(e,t){if(!this.client){let e=`${Fy}: is unavailable. tenantId, clientId, and federatedTokenFilePath are required parameters.
|
|
12
|
+
In DefaultAzureCredential and ManagedIdentityCredential, these can be provided as environment variables -
|
|
13
|
+
"AZURE_TENANT_ID",
|
|
14
|
+
"AZURE_CLIENT_ID",
|
|
15
|
+
"AZURE_FEDERATED_TOKEN_FILE". See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`;throw Ly.info(e),new y(e)}return Ly.info(`Invoking getToken() of Client Assertion Credential`),this.client.getToken(e,t)}async readFileContents(){if(this.cacheDate!==void 0&&Date.now()-this.cacheDate>=1e3*60*5&&(this.azureFederatedTokenFileContent=void 0),!this.federatedTokenFilePath)throw new y(`${Fy}: is unavailable. Invalid file path provided ${this.federatedTokenFilePath}.`);if(!this.azureFederatedTokenFileContent){let e=(await pe(this.federatedTokenFilePath,`utf8`)).trim();if(e)this.azureFederatedTokenFileContent=e,this.cacheDate=Date.now();else throw new y(`${Fy}: is unavailable. No content on the file ${this.federatedTokenFilePath}.`)}return this.azureFederatedTokenFileContent}}})),By,Vy,Hy,Uy=t((()=>{zy(),C(),By=`ManagedIdentityCredential - Token Exchange`,Vy=S(By),Hy={name:`tokenExchangeMsi`,async isAvailable(e){let t=process.env,n=!!((e||t.AZURE_CLIENT_ID)&&t.AZURE_TENANT_ID&&process.env.AZURE_FEDERATED_TOKEN_FILE);return n||Vy.info(`${By}: Unavailable. The environment variables needed are: AZURE_CLIENT_ID (or the client ID sent through the parameters), AZURE_TENANT_ID and AZURE_FEDERATED_TOKEN_FILE`),n},async getToken(e,t={}){let{scopes:n,clientId:r}=e;return new Ry({clientId:r,tenantId:process.env.AZURE_TENANT_ID,tokenFilePath:process.env.AZURE_FEDERATED_TOKEN_FILE,disableInstanceDiscovery:!0}).getToken(n,t)}}}));function Wy(e){return!!(e.errorCode===`network_error`||e.code===`ENETUNREACH`||e.code===`EHOSTUNREACH`||(e.statusCode===403||e.code===403)&&e.message.includes(`unreachable`))}var Gy,Ky,qy=t((()=>{bt(),Pf(),zv(),b(),Dp(),wy(),C(),T(),jy(),Uy(),Fv(),i(),Gy=S(`ManagedIdentityCredential`),Ky=class{constructor(e,t){a(this,`managedIdentityApp`,void 0),a(this,`identityClient`,void 0),a(this,`clientId`,void 0),a(this,`resourceId`,void 0),a(this,`objectId`,void 0),a(this,`msiRetryConfig`,{maxRetries:5,startDelayInMs:800,intervalIncrement:2}),a(this,`isAvailableIdentityClient`,void 0),a(this,`sendProbeRequest`,void 0);let n;typeof e==`string`?(this.clientId=e,n=t??{}):(this.clientId=e?.clientId,n=e??{}),this.resourceId=n?.resourceId,this.objectId=n?.objectId,this.sendProbeRequest=n?.sendProbeRequest??!1;let r=[{key:`clientId`,value:this.clientId},{key:`resourceId`,value:this.resourceId},{key:`objectId`,value:this.objectId}].filter(e=>e.value);if(r.length>1)throw Error(`ManagedIdentityCredential: only one of 'clientId', 'resourceId', or 'objectId' can be provided. Received values: ${JSON.stringify({clientId:this.clientId,resourceId:this.resourceId,objectId:this.objectId})}`);n.allowInsecureConnection=!0,n.retryOptions?.maxRetries!==void 0&&(this.msiRetryConfig.maxRetries=n.retryOptions.maxRetries),this.identityClient=new Rv({...n,additionalPolicies:[{policy:xy(this.msiRetryConfig),position:`perCall`}]}),this.managedIdentityApp=new Mf({managedIdentityIdParams:{userAssignedClientId:this.clientId,userAssignedResourceId:this.resourceId,userAssignedObjectId:this.objectId},system:{disableInternalRetries:!0,networkClient:this.identityClient,loggerOptions:{logLevel:yp(_t()),piiLoggingEnabled:n.loggingOptions?.enableUnsafeSupportLogging,loggerCallback:Ep(Gy)}}}),this.isAvailableIdentityClient=new Rv({...n,retryOptions:{maxRetries:0}});let i=this.managedIdentityApp.getManagedIdentitySource();if(i===`CloudShell`&&(this.clientId||this.resourceId||this.objectId))throw Gy.warning(`CloudShell MSI detected with user-provided IDs - throwing. Received values: ${JSON.stringify({clientId:this.clientId,resourceId:this.resourceId,objectId:this.objectId})}.`),new y(`ManagedIdentityCredential: Specifying a user-assigned managed identity is not supported for CloudShell at runtime. When using Managed Identity in CloudShell, omit the clientId, resourceId, and objectId parameters.`);if(i===`ServiceFabric`&&(this.clientId||this.resourceId||this.objectId))throw Gy.warning(`Service Fabric detected with user-provided IDs - throwing. Received values: ${JSON.stringify({clientId:this.clientId,resourceId:this.resourceId,objectId:this.objectId})}.`),new y(`ManagedIdentityCredential: ${Pv}`);if(Gy.info(`Using ${i} managed identity.`),r.length===1){let{key:e,value:t}=r[0];Gy.info(`${i} with ${e}: ${t}`)}}async getToken(e,t={}){Gy.getToken.info(`Using the MSAL provider for Managed Identity.`);let n=Av(e);if(!n)throw new y(`ManagedIdentityCredential: Multiple scopes are not supported. Scopes: ${JSON.stringify(e)}`);return w.withSpan(`ManagedIdentityCredential.getToken`,t,async()=>{try{let r=await Hy.isAvailable(this.clientId),i=this.managedIdentityApp.getManagedIdentitySource(),a=i===`DefaultToImds`||i===`Imds`;if(Gy.getToken.info(`MSAL Identity source: ${i}`),r){Gy.getToken.info(`Using the token exchange managed identity.`);let t=await Hy.getToken({scopes:e,clientId:this.clientId,identityClient:this.identityClient,retryConfig:this.msiRetryConfig,resourceId:this.resourceId});if(t===null)throw new y(`Attempted to use the token exchange managed identity, but received a null response.`);return t}else if(a&&this.sendProbeRequest&&(Gy.getToken.info(`Using the IMDS endpoint to probe for availability.`),!await Ay.isAvailable({scopes:e,clientId:this.clientId,getTokenOptions:t,identityClient:this.isAvailableIdentityClient,resourceId:this.resourceId})))throw new y(`Attempted to use the IMDS endpoint, but it is not available.`);Gy.getToken.info(`Calling into MSAL for managed identity token.`);let o=await this.managedIdentityApp.acquireToken({resource:n});return this.ensureValidMsalToken(e,o,t),Gy.getToken.info(St(e)),{expiresOnTimestamp:o.expiresOn.getTime(),token:o.accessToken,refreshAfterTimestamp:o.refreshOn?.getTime(),tokenType:`Bearer`}}catch(t){throw Gy.getToken.error(x(e,t)),t.name===`AuthenticationRequiredError`?t:Wy(t)?new y(`ManagedIdentityCredential: Network unreachable. Message: ${t.message}`,{cause:t}):new y(`ManagedIdentityCredential: Authentication failed. Message ${t.message}`,{cause:t})}})}ensureValidMsalToken(e,t,n){let r=t=>(Gy.getToken.info(t),new Ue({scopes:Array.isArray(e)?e:[e],getTokenOptions:n,message:t}));if(!t)throw r(`No response.`);if(!t.expiresOn)throw r(`Response had no "expiresOn" property.`);if(!t.accessToken)throw r(`Response had no "accessToken" property.`)}}})),Jy,Yy,Xy,Zy,Qy=t((()=>{C(),b(),Yv(),T(),sy(),i(),Jy=S(`AzureDeveloperCliCredential`),Yy={notInstalled:`Azure Developer CLI couldn't be found. To mitigate this issue, see the troubleshooting guidelines at https://aka.ms/azsdk/js/identity/azdevclicredential/troubleshoot.`,login:`Please run 'azd auth login' from a command prompt to authenticate before using this credential. For more information, see the troubleshooting guidelines at https://aka.ms/azsdk/js/identity/azdevclicredential/troubleshoot.`,unknown:`Unknown error while trying to retrieve the access token`,claim:`This credential doesn't support claims challenges. To authenticate with the required claims, please run the following command:`},Xy={getSafeWorkingDir(){if(process.platform===`win32`){let e=process.env.SystemRoot||process.env.SYSTEMROOT;return e||(Jy.getToken.warning(`The SystemRoot environment variable is not set. This may cause issues when using the Azure Developer CLI credential.`),e=`C:\\Windows`),e}else return`/bin`},async getAzdAccessToken(e,t,n,r){let i=[];t&&(i=[`--tenant-id`,t]);let a=[];return r&&(a=[`--claims`,btoa(r)]),new Promise((t,r)=>{try{let r=[`azd`,`auth`,`token`,`--output`,`json`,`--no-prompt`,...e.reduce((e,t)=>e.concat(`--scope`,t),[]),...i,...a].join(` `);ue.exec(r,{cwd:Xy.getSafeWorkingDir(),timeout:n},(e,n,r)=>{t({stdout:n,stderr:r,error:e})})}catch(e){r(e)}})}},Zy=class{constructor(e){a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`timeout`,void 0),e?.tenantId&&(Kv(Jy,e?.tenantId),this.tenantId=e?.tenantId),this.additionallyAllowedTenantIds=Jv(e?.additionallyAllowedTenants),this.timeout=e?.processTimeoutInMs}async getToken(e,t={}){let n=Wv(this.tenantId,t,this.additionallyAllowedTenantIds);n&&Kv(Jy,n);let r;return r=typeof e==`string`?[e]:e,Jy.getToken.info(`Using the scopes ${e}`),w.withSpan(`${this.constructor.name}.getToken`,t,async()=>{try{r.forEach(e=>{ay(e,Jy)});let i=await Xy.getAzdAccessToken(r,n,this.timeout,t.claims),a=i.stderr?.match(`must use multi-factor authentication`)||i.stderr?.match(`reauthentication required`),o=i.stderr?.match("not logged in, run `azd login` to login")||i.stderr?.match("not logged in, run `azd auth login` to login");if(i.stderr?.match(`azd:(.*)not found`)||i.stderr?.startsWith(`'azd' is not recognized`)||i.error&&i.error.code===`ENOENT`){let t=new y(Yy.notInstalled);throw Jy.getToken.info(x(e,t)),t}if(o){let t=new y(Yy.login);throw Jy.getToken.info(x(e,t)),t}if(a){let t=`azd auth login ${r.reduce((e,t)=>e.concat(`--scope`,t),[]).join(` `)}`,n=new y(`${Yy.claim} ${t}`);throw Jy.getToken.info(x(e,n)),n}try{let t=JSON.parse(i.stdout);return Jy.getToken.info(St(e)),{token:t.token,expiresOnTimestamp:new Date(t.expiresOn).getTime(),tokenType:`Bearer`}}catch(e){throw i.stderr?new y(i.stderr):e}}catch(t){let n=t.name===`CredentialUnavailableError`?t:new y(t.message||Yy.unknown);throw Jy.getToken.info(x(e,n)),n}})}}}));function $y(e,t){if(!t.match(/^[0-9a-zA-Z-._ ]+$/)){let n=Error(`Subscription '${t}' contains invalid characters. If this is the name of a subscription, use its ID instead. You can locate your subscription by following the instructions listed here: https://learn.microsoft.com/azure/azure-portal/get-subscription-tenant-id`);throw e.info(x(``,n)),n}}var eb=t((()=>{C()})),tb,nb,rb,ib,ab=t((()=>{Yv(),C(),sy(),b(),T(),eb(),i(),tb=S(`AzureCliCredential`),nb={claim:`This credential doesn't support claims challenges. To authenticate with the required claims, please run the following command:`,notInstalled:`Azure CLI could not be found. Please visit https://aka.ms/azure-cli for installation instructions and then, once installed, authenticate to your Azure account using 'az login'.`,login:`Please run 'az login' from a command prompt to authenticate before using this credential.`,unknown:`Unknown error while trying to retrieve the access token`,unexpectedResponse:`Unexpected response from Azure CLI when getting token. Expected "expiresOn" to be a RFC3339 date string. Got:`},rb={getSafeWorkingDir(){if(process.platform===`win32`){let e=process.env.SystemRoot||process.env.SYSTEMROOT;return e||(tb.getToken.warning(`The SystemRoot environment variable is not set. This may cause issues when using the Azure CLI credential.`),e=`C:\\Windows`),e}else return`/bin`},async getAzureCliAccessToken(e,t,n,r){let i=[],a=[];return t&&(i=[`--tenant`,t]),n&&(a=[`--subscription`,`"${n}"`]),new Promise((t,n)=>{try{let n=[`az`,`account`,`get-access-token`,`--output`,`json`,`--resource`,e,...i,...a].join(` `);ue.exec(n,{cwd:rb.getSafeWorkingDir(),timeout:r},(e,n,r)=>{t({stdout:n,stderr:r,error:e})})}catch(e){n(e)}})}},ib=class{constructor(e){a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`timeout`,void 0),a(this,`subscription`,void 0),e?.tenantId&&(Kv(tb,e?.tenantId),this.tenantId=e?.tenantId),e?.subscription&&($y(tb,e?.subscription),this.subscription=e?.subscription),this.additionallyAllowedTenantIds=Jv(e?.additionallyAllowedTenants),this.timeout=e?.processTimeoutInMs}async getToken(e,t={}){let n=typeof e==`string`?e:e[0],r=t.claims;if(r&&r.trim()){let e=`az login --claims-challenge ${btoa(r)} --scope ${n}`,i=t.tenantId;i&&(e+=` --tenant ${i}`);let a=new y(`${nb.claim} ${e}`);throw tb.getToken.info(x(n,a)),a}let i=Wv(this.tenantId,t,this.additionallyAllowedTenantIds);return i&&Kv(tb,i),this.subscription&&$y(tb,this.subscription),tb.getToken.info(`Using the scope ${n}`),w.withSpan(`${this.constructor.name}.getToken`,t,async()=>{try{ay(n,tb);let t=oy(n),r=await rb.getAzureCliAccessToken(t,i,this.subscription,this.timeout),a=r.stderr?.match(`(.*)az login --scope(.*)`),o=r.stderr?.match(`(.*)az login(.*)`)&&!a;if(r.stderr?.match(`az:(.*)not found`)||r.stderr?.startsWith(`'az' is not recognized`)){let t=new y(nb.notInstalled);throw tb.getToken.info(x(e,t)),t}if(o){let t=new y(nb.login);throw tb.getToken.info(x(e,t)),t}try{let t=r.stdout,n=this.parseRawResponse(t);return tb.getToken.info(St(e)),n}catch(e){throw r.stderr?new y(r.stderr):e}}catch(t){let n=t.name===`CredentialUnavailableError`?t:new y(t.message||nb.unknown);throw tb.getToken.info(x(e,n)),n}})}parseRawResponse(e){let t=JSON.parse(e),n=t.accessToken,r=Number.parseInt(t.expires_on,10)*1e3;if(!isNaN(r))return tb.getToken.info(`expires_on is available and is valid, using it`),{token:n,expiresOnTimestamp:r,tokenType:`Bearer`};if(r=new Date(t.expiresOn).getTime(),isNaN(r))throw new y(`${nb.unexpectedResponse} "${t.expiresOn}"`);return{token:n,expiresOnTimestamp:r,tokenType:`Bearer`}}}})),ob,sb=t((()=>{ob={execFile(e,t,n){return new Promise((r,i)=>{re.execFile(e,t,n,(e,t,n)=>{Buffer.isBuffer(t)&&(t=t.toString(`utf8`)),Buffer.isBuffer(n)&&(n=n.toString(`utf8`)),n||e?i(n?Error(n):e):r(t)})})}}}));function cb(e){return fb?`${e}.exe`:e}async function lb(e,t){let n=[];for(let r of e){let[e,...i]=r,a=await ob.execFile(e,i,{encoding:`utf8`,timeout:t});n.push(a)}return n}async function ub(e){let t=e.match(/{[^{}]*}/g),n=e;if(t)try{for(let e of t)try{let t=JSON.parse(e);if(t?.Token)return n=n.replace(e,``),n&&db.getToken.warning(n),t}catch{continue}}catch{throw Error(`Unable to parse the output of PowerShell. Received output: ${e}`)}throw Error(`No access token found in the output. Received output: ${e}`)}var db,fb,pb,mb,hb,gb,_b,vb,yb=t((()=>{Yv(),C(),sy(),b(),sb(),T(),i(),db=S(`AzurePowerShellCredential`),fb=process.platform===`win32`,pb={login:`Run Connect-AzAccount to login`,installed:`The specified module 'Az.Accounts' with version '2.2.0' was not loaded because no valid module file was found in any module directory`},mb={login:`Please run 'Connect-AzAccount' from PowerShell to authenticate before using this credential.`,installed:`The 'Az.Account' module >= 2.2.0 is not installed. Install the Azure Az PowerShell module with: "Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force".`,claim:`This credential doesn't support claims challenges. To authenticate with the required claims, please run the following command:`,troubleshoot:`To troubleshoot, visit https://aka.ms/azsdk/js/identity/powershellcredential/troubleshoot.`},hb=e=>e.message.match(`(.*)${pb.login}(.*)`),gb=e=>e.message.match(pb.installed),_b=[cb(`pwsh`)],fb&&_b.push(cb(`powershell`)),vb=class{constructor(e){a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`timeout`,void 0),e?.tenantId&&(Kv(db,e?.tenantId),this.tenantId=e?.tenantId),this.additionallyAllowedTenantIds=Jv(e?.additionallyAllowedTenants),this.timeout=e?.processTimeoutInMs}async getAzurePowerShellAccessToken(e,t,n){for(let r of[..._b]){try{await lb([[r,`/?`]],n)}catch{_b.shift();continue}let i=(await lb([[r,`-NoProfile`,`-NonInteractive`,`-Command`,`
|
|
16
|
+
$tenantId = "${t??``}"
|
|
17
|
+
$m = Import-Module Az.Accounts -MinimumVersion 2.2.0 -PassThru
|
|
18
|
+
$useSecureString = $m.Version -ge [version]'2.17.0' -and $m.Version -lt [version]'5.0.0'
|
|
19
|
+
|
|
20
|
+
$params = @{
|
|
21
|
+
ResourceUrl = "${e}"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if ($tenantId.Length -gt 0) {
|
|
25
|
+
$params["TenantId"] = $tenantId
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if ($useSecureString) {
|
|
29
|
+
$params["AsSecureString"] = $true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$token = Get-AzAccessToken @params
|
|
33
|
+
|
|
34
|
+
$result = New-Object -TypeName PSObject
|
|
35
|
+
$result | Add-Member -MemberType NoteProperty -Name ExpiresOn -Value $token.ExpiresOn
|
|
36
|
+
|
|
37
|
+
if ($token.Token -is [System.Security.SecureString]) {
|
|
38
|
+
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
|
39
|
+
$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($token.Token)
|
|
40
|
+
try {
|
|
41
|
+
$result | Add-Member -MemberType NoteProperty -Name Token -Value ([System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr))
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
[System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
$result | Add-Member -MemberType NoteProperty -Name Token -Value ($token.Token | ConvertFrom-SecureString -AsPlainText)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
$result | Add-Member -MemberType NoteProperty -Name Token -Value $token.Token
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
Write-Output (ConvertTo-Json $result)
|
|
56
|
+
`]]))[0];return ub(i)}throw Error(`Unable to execute PowerShell. Ensure that it is installed in your system`)}async getToken(e,t={}){return w.withSpan(`${this.constructor.name}.getToken`,t,async()=>{let n=typeof e==`string`?e:e[0],r=t.claims;if(r&&r.trim()){let e=`Connect-AzAccount -ClaimsChallenge ${btoa(r)}`,i=t.tenantId;i&&(e+=` -Tenant ${i}`);let a=new y(`${mb.claim} ${e}`);throw db.getToken.info(x(n,a)),a}let i=Wv(this.tenantId,t,this.additionallyAllowedTenantIds);i&&Kv(db,i);try{ay(n,db),db.getToken.info(`Using the scope ${n}`);let t=oy(n),r=await this.getAzurePowerShellAccessToken(t,i,this.timeout);return db.getToken.info(St(e)),{token:r.Token,expiresOnTimestamp:new Date(r.ExpiresOn).getTime(),tokenType:`Bearer`}}catch(e){if(gb(e)){let e=new y(mb.installed);throw db.getToken.info(x(n,e)),e}else if(hb(e)){let e=new y(mb.login);throw db.getToken.info(x(n,e)),e}let t=new y(`${e}. ${mb.troubleshoot}`);throw db.getToken.info(x(n,t)),t}})}}}));function bb(e){let t=wb[e];if(t)throw new y(t)}var xb,Sb,Cb,wb,Tb,Eb=t((()=>{C(),Yv(),b(),Qv(),sy(),Pe(),Dp(),i(),xb=`common`,Sb=`aebc6443-996d-45c2-90f0-388ff96faa56`,Cb=S(`VisualStudioCodeCredential`),wb={adfs:`The VisualStudioCodeCredential does not support authentication with ADFS tenants.`},Tb=class{constructor(e){a(this,`tenantId`,void 0),a(this,`additionallyAllowedTenantIds`,void 0),a(this,`msalClient`,void 0),a(this,`options`,void 0),a(this,`preparePromise`,void 0),this.options=e||{},e&&e.tenantId?(Kv(Cb,e.tenantId),this.tenantId=e.tenantId):this.tenantId=xb,this.additionallyAllowedTenantIds=Jv(e?.additionallyAllowedTenants),bb(this.tenantId)}async prepare(e){let t=Wv(this.tenantId,this.options,this.additionallyAllowedTenantIds,Cb)||this.tenantId;if(!we()||!ke)throw new y(`Visual Studio Code Authentication is not available. Ensure you have have Azure Resources Extension installed in VS Code, signed into Azure via VS Code, installed the @azure/identity-vscode package, and properly configured the extension.`);let n=await this.loadAuthRecord(ke,e);this.msalClient=Zv(Sb,t,{...this.options,isVSCodeCredential:!0,brokerOptions:{enabled:!0,parentWindowHandle:new Uint8Array,useDefaultBrokerAccount:!0},authenticationRecord:n})}prepareOnce(e){return this.preparePromise||(this.preparePromise=this.prepare(e)),this.preparePromise}async getToken(e,t){let n=iy(e);if(await this.prepareOnce(n),!this.msalClient)throw new y(`Visual Studio Code Authentication failed to initialize. Ensure you have have Azure Resources Extension installed in VS Code, signed into Azure via VS Code, installed the @azure/identity-vscode package, and properly configured the extension.`);return this.msalClient.getTokenByInteractiveRequest(n,{...t,disableAutomaticAuthentication:!0})}async loadAuthRecord(e,t){try{return Cp(await pe(e,{encoding:`utf8`}))}catch(e){throw Cb.getToken.info(x(t,e)),new y(`Cannot load authentication record in Visual Studio Code. Ensure you have have Azure Resources Extension installed in VS Code, signed into Azure via VS Code, installed the @azure/identity-vscode package, and properly configured the extension.`)}}}})),Db,Ob,kb=t((()=>{Yv(),C(),sy(),T(),Qv(),Ce(),b(),i(),Db=S(`BrokerCredential`),Ob=class{constructor(e){a(this,`brokerMsalClient`,void 0),a(this,`brokerTenantId`,void 0),a(this,`brokerAdditionallyAllowedTenantIds`,void 0),this.brokerTenantId=qv(Db,e.tenantId),this.brokerAdditionallyAllowedTenantIds=Jv(e?.additionallyAllowedTenants);let t={...e,tokenCredentialOptions:e,logger:Db,brokerOptions:{enabled:!0,parentWindowHandle:new Uint8Array,useDefaultBrokerAccount:!0}};this.brokerMsalClient=Zv(ve,this.brokerTenantId,t)}async getToken(e,t={}){return w.withSpan(`${this.constructor.name}.getToken`,t,async t=>{t.tenantId=Wv(this.brokerTenantId,t,this.brokerAdditionallyAllowedTenantIds,Db);let n=iy(e);try{return this.brokerMsalClient.getBrokeredToken(n,!0,{...t,disableAutomaticAuthentication:!0})}catch(e){throw Db.getToken.info(x(n,e)),new y(`Failed to acquire token using broker authentication`,{cause:e})}})}}}));function Ab(e={}){return new Ob(e)}function jb(e={}){return new Tb(e)}function Mb(e={}){e.retryOptions??(e.retryOptions={maxRetries:5,retryDelayInMs:800}),e.sendProbeRequest??(e.sendProbeRequest=!0);let t=e?.managedIdentityClientId??process.env.AZURE_CLIENT_ID,n=e?.workloadIdentityClientId??t,r=e?.managedIdentityResourceId,i=process.env.AZURE_FEDERATED_TOKEN_FILE,a=e?.tenantId??process.env.AZURE_TENANT_ID;return r?new Ky({...e,resourceId:r}):i&&n?new Ky(n,{...e,tenantId:a}):t?new Ky({...e,clientId:t}):new Ky(e)}function Nb(e){let t=e?.managedIdentityClientId??process.env.AZURE_CLIENT_ID,n=e?.workloadIdentityClientId??t,r=process.env.AZURE_FEDERATED_TOKEN_FILE,i=e?.tenantId??process.env.AZURE_TENANT_ID;return r&&n?new Ry({...e,tenantId:i,clientId:n,tokenFilePath:r}):i?new Ry({...e,tenantId:i}):new Ry(e)}function Pb(e={}){return new Zy(e)}function Fb(e={}){return new ib(e)}function Ib(e={}){return new vb(e)}function Lb(e={}){return new yy(e)}var Rb=t((()=>{by(),qy(),zy(),Qy(),ab(),yb(),Eb(),kb()}));function zb(e){if(e?.requiredEnvVars){let t=(Array.isArray(e.requiredEnvVars)?e.requiredEnvVars:[e.requiredEnvVars]).filter(e=>!process.env[e]);if(t.length>0){let e=`Required environment ${t.length===1?`variable`:`variables`} '${t.join(`, `)}' for DefaultAzureCredential ${t.length===1?`is`:`are`} not set or empty.`;throw Bb.warning(e),Error(e)}}}var Bb,Vb,Hb,Ub=t((()=>{Ht(),C(),Rb(),i(),Bb=S(`DefaultAzureCredential`),Vb=class{constructor(e,t){a(this,`credentialUnavailableErrorMessage`,void 0),a(this,`credentialName`,void 0),this.credentialName=e,this.credentialUnavailableErrorMessage=t}getToken(){return Bb.getToken.info(`Skipping ${this.credentialName}, reason: ${this.credentialUnavailableErrorMessage}`),Promise.resolve(null)}},Hb=class extends Vt{constructor(e){zb(e);let t=process.env.AZURE_TOKEN_CREDENTIALS?process.env.AZURE_TOKEN_CREDENTIALS.trim().toLowerCase():void 0,n=[jb,Fb,Ib,Pb,Ab],r=[Lb,Nb,Mb],i=[];if(t)switch(t){case`dev`:i=n;break;case`prod`:i=r;break;case`environmentcredential`:i=[Lb];break;case`workloadidentitycredential`:i=[Nb];break;case`managedidentitycredential`:i=[()=>Mb({sendProbeRequest:!1})];break;case`visualstudiocodecredential`:i=[jb];break;case`azureclicredential`:i=[Fb];break;case`azurepowershellcredential`:i=[Ib];break;case`azuredeveloperclicredential`:i=[Pb];break;default:{let e=`Invalid value for AZURE_TOKEN_CREDENTIALS = ${process.env.AZURE_TOKEN_CREDENTIALS}. Valid values are 'prod' or 'dev' or any of these credentials - EnvironmentCredential, WorkloadIdentityCredential, ManagedIdentityCredential, VisualStudioCodeCredential, AzureCliCredential, AzurePowerShellCredential, AzureDeveloperCliCredential.`;throw Bb.warning(e),Error(e)}}else i=[...r,...n];let a=i.map(t=>{try{return t(e??{})}catch(e){return Bb.warning(`Skipped ${t.name} because of an error creating the credential: ${e}`),new Vb(t.name,e.message)}});super(...a)}}}));function Wb(e,t,n){let{abortSignal:r,tracingOptions:i}=n||{},a=$h();a.addPolicy(C_({credential:e,scopes:t}));async function o(){let e=(await a.sendRequest({sendRequest:e=>Promise.resolve({request:e,status:200,headers:e.headers})},u_({url:`https://example.com`,abortSignal:r,tracingOptions:i}))).headers.get(`authorization`)?.split(` `)[1];if(!e)throw Error(`Failed to get access token`);return e}return o}var Gb=t((()=>{O_()}));t((()=>{Fe(),b(),Dp(),Ht(),uy(),Ub(),by(),ry(),Py(),ab(),Qy(),Yv(),C(),sy(),T(),Qv(),Ce(),qy(),O_(),zv(),yb(),py(),Eb(),zy(),Gb()}))();export{Hb as DefaultAzureCredential,Wb as getBearerTokenProvider};
|