@coboot/headless 0.2.2-rc.1 → 0.2.2-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -31
- package/browser-runtime/playwright-core/LICENSE +202 -0
- package/browser-runtime/playwright-core/NOTICE +5 -0
- package/browser-runtime/playwright-core/README.md +3 -0
- package/browser-runtime/playwright-core/ThirdPartyNotices.txt +4076 -0
- package/browser-runtime/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/browser-runtime/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/browser-runtime/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/browser-runtime/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/browser-runtime/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/browser-runtime/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/browser-runtime/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/browser-runtime/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/browser-runtime/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/browser-runtime/playwright-core/browsers.json +79 -0
- package/browser-runtime/playwright-core/cli.js +18 -0
- package/browser-runtime/playwright-core/index.js +32 -0
- package/browser-runtime/playwright-core/index.mjs +28 -0
- package/browser-runtime/playwright-core/lib/androidServerImpl.js +65 -0
- package/browser-runtime/playwright-core/lib/browserServerImpl.js +120 -0
- package/browser-runtime/playwright-core/lib/cli/driver.js +97 -0
- package/browser-runtime/playwright-core/lib/cli/program.js +589 -0
- package/browser-runtime/playwright-core/lib/cli/programWithTestStub.js +74 -0
- package/browser-runtime/playwright-core/lib/client/android.js +361 -0
- package/browser-runtime/playwright-core/lib/client/api.js +137 -0
- package/browser-runtime/playwright-core/lib/client/artifact.js +79 -0
- package/browser-runtime/playwright-core/lib/client/browser.js +161 -0
- package/browser-runtime/playwright-core/lib/client/browserContext.js +582 -0
- package/browser-runtime/playwright-core/lib/client/browserType.js +185 -0
- package/browser-runtime/playwright-core/lib/client/cdpSession.js +51 -0
- package/browser-runtime/playwright-core/lib/client/channelOwner.js +194 -0
- package/browser-runtime/playwright-core/lib/client/clientHelper.js +64 -0
- package/browser-runtime/playwright-core/lib/client/clientInstrumentation.js +55 -0
- package/browser-runtime/playwright-core/lib/client/clientStackTrace.js +69 -0
- package/browser-runtime/playwright-core/lib/client/clock.js +68 -0
- package/browser-runtime/playwright-core/lib/client/connection.js +318 -0
- package/browser-runtime/playwright-core/lib/client/consoleMessage.js +58 -0
- package/browser-runtime/playwright-core/lib/client/coverage.js +44 -0
- package/browser-runtime/playwright-core/lib/client/dialog.js +56 -0
- package/browser-runtime/playwright-core/lib/client/download.js +62 -0
- package/browser-runtime/playwright-core/lib/client/electron.js +138 -0
- package/browser-runtime/playwright-core/lib/client/elementHandle.js +284 -0
- package/browser-runtime/playwright-core/lib/client/errors.js +77 -0
- package/browser-runtime/playwright-core/lib/client/eventEmitter.js +314 -0
- package/browser-runtime/playwright-core/lib/client/events.js +103 -0
- package/browser-runtime/playwright-core/lib/client/fetch.js +368 -0
- package/browser-runtime/playwright-core/lib/client/fileChooser.js +46 -0
- package/browser-runtime/playwright-core/lib/client/fileUtils.js +34 -0
- package/browser-runtime/playwright-core/lib/client/frame.js +409 -0
- package/browser-runtime/playwright-core/lib/client/harRouter.js +87 -0
- package/browser-runtime/playwright-core/lib/client/input.js +84 -0
- package/browser-runtime/playwright-core/lib/client/jsHandle.js +109 -0
- package/browser-runtime/playwright-core/lib/client/jsonPipe.js +39 -0
- package/browser-runtime/playwright-core/lib/client/localUtils.js +60 -0
- package/browser-runtime/playwright-core/lib/client/locator.js +369 -0
- package/browser-runtime/playwright-core/lib/client/network.js +747 -0
- package/browser-runtime/playwright-core/lib/client/page.js +745 -0
- package/browser-runtime/playwright-core/lib/client/pageAgent.js +64 -0
- package/browser-runtime/playwright-core/lib/client/platform.js +77 -0
- package/browser-runtime/playwright-core/lib/client/playwright.js +71 -0
- package/browser-runtime/playwright-core/lib/client/selectors.js +55 -0
- package/browser-runtime/playwright-core/lib/client/stream.js +39 -0
- package/browser-runtime/playwright-core/lib/client/timeoutSettings.js +79 -0
- package/browser-runtime/playwright-core/lib/client/tracing.js +119 -0
- package/browser-runtime/playwright-core/lib/client/types.js +28 -0
- package/browser-runtime/playwright-core/lib/client/video.js +59 -0
- package/browser-runtime/playwright-core/lib/client/waiter.js +142 -0
- package/browser-runtime/playwright-core/lib/client/webError.js +39 -0
- package/browser-runtime/playwright-core/lib/client/webSocket.js +93 -0
- package/browser-runtime/playwright-core/lib/client/worker.js +85 -0
- package/browser-runtime/playwright-core/lib/client/writableStream.js +39 -0
- package/browser-runtime/playwright-core/lib/generated/bindingsControllerSource.js +28 -0
- package/browser-runtime/playwright-core/lib/generated/clockSource.js +28 -0
- package/browser-runtime/playwright-core/lib/generated/injectedScriptSource.js +28 -0
- package/browser-runtime/playwright-core/lib/generated/pollingRecorderSource.js +28 -0
- package/browser-runtime/playwright-core/lib/generated/storageScriptSource.js +28 -0
- package/browser-runtime/playwright-core/lib/generated/utilityScriptSource.js +28 -0
- package/browser-runtime/playwright-core/lib/generated/webSocketMockSource.js +336 -0
- package/browser-runtime/playwright-core/lib/inProcessFactory.js +60 -0
- package/browser-runtime/playwright-core/lib/inprocess.js +3 -0
- package/browser-runtime/playwright-core/lib/mcpBundle.js +84 -0
- package/browser-runtime/playwright-core/lib/mcpBundleImpl/index.js +147 -0
- package/browser-runtime/playwright-core/lib/outofprocess.js +76 -0
- package/browser-runtime/playwright-core/lib/protocol/serializers.js +197 -0
- package/browser-runtime/playwright-core/lib/protocol/validator.js +2969 -0
- package/browser-runtime/playwright-core/lib/protocol/validatorPrimitives.js +193 -0
- package/browser-runtime/playwright-core/lib/remote/playwrightConnection.js +129 -0
- package/browser-runtime/playwright-core/lib/remote/playwrightServer.js +334 -0
- package/browser-runtime/playwright-core/lib/server/agent/actionRunner.js +335 -0
- package/browser-runtime/playwright-core/lib/server/agent/actions.js +128 -0
- package/browser-runtime/playwright-core/lib/server/agent/codegen.js +111 -0
- package/browser-runtime/playwright-core/lib/server/agent/context.js +150 -0
- package/browser-runtime/playwright-core/lib/server/agent/expectTools.js +156 -0
- package/browser-runtime/playwright-core/lib/server/agent/pageAgent.js +204 -0
- package/browser-runtime/playwright-core/lib/server/agent/performTools.js +262 -0
- package/browser-runtime/playwright-core/lib/server/agent/tool.js +109 -0
- package/browser-runtime/playwright-core/lib/server/android/android.js +465 -0
- package/browser-runtime/playwright-core/lib/server/android/backendAdb.js +177 -0
- package/browser-runtime/playwright-core/lib/server/artifact.js +127 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiBrowser.js +549 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiChromium.js +149 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiConnection.js +213 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiDeserializer.js +116 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiExecutionContext.js +267 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiFirefox.js +128 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiInput.js +146 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiNetworkManager.js +383 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiOverCdp.js +102 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiPage.js +583 -0
- package/browser-runtime/playwright-core/lib/server/bidi/bidiPdf.js +106 -0
- package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiProtocolCore.js +180 -0
- package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- package/browser-runtime/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
- package/browser-runtime/playwright-core/lib/server/browser.js +149 -0
- package/browser-runtime/playwright-core/lib/server/browserContext.js +702 -0
- package/browser-runtime/playwright-core/lib/server/browserType.js +336 -0
- package/browser-runtime/playwright-core/lib/server/callLog.js +82 -0
- package/browser-runtime/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/browser-runtime/playwright-core/lib/server/chromium/chromium.js +397 -0
- package/browser-runtime/playwright-core/lib/server/chromium/chromiumSwitches.js +104 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crBrowser.js +520 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crConnection.js +197 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crCoverage.js +235 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crDevTools.js +111 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crDragDrop.js +131 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crExecutionContext.js +146 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crInput.js +187 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crNetworkManager.js +707 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crPage.js +1001 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crPdf.js +121 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crProtocolHelper.js +145 -0
- package/browser-runtime/playwright-core/lib/server/chromium/crServiceWorker.js +136 -0
- package/browser-runtime/playwright-core/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/browser-runtime/playwright-core/lib/server/chromium/protocol.d.js +16 -0
- package/browser-runtime/playwright-core/lib/server/clock.js +149 -0
- package/browser-runtime/playwright-core/lib/server/codegen/csharp.js +327 -0
- package/browser-runtime/playwright-core/lib/server/codegen/java.js +274 -0
- package/browser-runtime/playwright-core/lib/server/codegen/javascript.js +247 -0
- package/browser-runtime/playwright-core/lib/server/codegen/jsonl.js +52 -0
- package/browser-runtime/playwright-core/lib/server/codegen/language.js +132 -0
- package/browser-runtime/playwright-core/lib/server/codegen/languages.js +68 -0
- package/browser-runtime/playwright-core/lib/server/codegen/python.js +279 -0
- package/browser-runtime/playwright-core/lib/server/codegen/types.js +16 -0
- package/browser-runtime/playwright-core/lib/server/console.js +57 -0
- package/browser-runtime/playwright-core/lib/server/cookieStore.js +206 -0
- package/browser-runtime/playwright-core/lib/server/debugController.js +191 -0
- package/browser-runtime/playwright-core/lib/server/debugger.js +119 -0
- package/browser-runtime/playwright-core/lib/server/deviceDescriptors.js +39 -0
- package/browser-runtime/playwright-core/lib/server/deviceDescriptorsSource.json +1779 -0
- package/browser-runtime/playwright-core/lib/server/dialog.js +116 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/androidDispatcher.js +325 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +384 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/browserDispatcher.js +118 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +64 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/dialogDispatcher.js +47 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/dispatcher.js +364 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/electronDispatcher.js +89 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/frameDispatcher.js +227 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +149 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/networkDispatchers.js +213 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/pageAgentDispatcher.js +96 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/pageDispatcher.js +393 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +108 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/streamDispatcher.js +67 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/tracingDispatcher.js +68 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/webSocketRouteDispatcher.js +165 -0
- package/browser-runtime/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
- package/browser-runtime/playwright-core/lib/server/dom.js +815 -0
- package/browser-runtime/playwright-core/lib/server/download.js +70 -0
- package/browser-runtime/playwright-core/lib/server/electron/electron.js +273 -0
- package/browser-runtime/playwright-core/lib/server/electron/loader.js +29 -0
- package/browser-runtime/playwright-core/lib/server/errors.js +69 -0
- package/browser-runtime/playwright-core/lib/server/fetch.js +621 -0
- package/browser-runtime/playwright-core/lib/server/fileChooser.js +43 -0
- package/browser-runtime/playwright-core/lib/server/fileUploadUtils.js +84 -0
- package/browser-runtime/playwright-core/lib/server/firefox/ffBrowser.js +418 -0
- package/browser-runtime/playwright-core/lib/server/firefox/ffConnection.js +142 -0
- package/browser-runtime/playwright-core/lib/server/firefox/ffExecutionContext.js +150 -0
- package/browser-runtime/playwright-core/lib/server/firefox/ffInput.js +159 -0
- package/browser-runtime/playwright-core/lib/server/firefox/ffNetworkManager.js +256 -0
- package/browser-runtime/playwright-core/lib/server/firefox/ffPage.js +497 -0
- package/browser-runtime/playwright-core/lib/server/firefox/firefox.js +114 -0
- package/browser-runtime/playwright-core/lib/server/firefox/protocol.d.js +16 -0
- package/browser-runtime/playwright-core/lib/server/formData.js +147 -0
- package/browser-runtime/playwright-core/lib/server/frameSelectors.js +160 -0
- package/browser-runtime/playwright-core/lib/server/frames.js +1471 -0
- package/browser-runtime/playwright-core/lib/server/har/harRecorder.js +147 -0
- package/browser-runtime/playwright-core/lib/server/har/harTracer.js +607 -0
- package/browser-runtime/playwright-core/lib/server/harBackend.js +157 -0
- package/browser-runtime/playwright-core/lib/server/helper.js +96 -0
- package/browser-runtime/playwright-core/lib/server/index.js +58 -0
- package/browser-runtime/playwright-core/lib/server/input.js +277 -0
- package/browser-runtime/playwright-core/lib/server/instrumentation.js +72 -0
- package/browser-runtime/playwright-core/lib/server/javascript.js +291 -0
- package/browser-runtime/playwright-core/lib/server/launchApp.js +128 -0
- package/browser-runtime/playwright-core/lib/server/localUtils.js +214 -0
- package/browser-runtime/playwright-core/lib/server/macEditingCommands.js +143 -0
- package/browser-runtime/playwright-core/lib/server/network.js +667 -0
- package/browser-runtime/playwright-core/lib/server/page.js +830 -0
- package/browser-runtime/playwright-core/lib/server/pipeTransport.js +89 -0
- package/browser-runtime/playwright-core/lib/server/playwright.js +69 -0
- package/browser-runtime/playwright-core/lib/server/progress.js +132 -0
- package/browser-runtime/playwright-core/lib/server/protocolError.js +52 -0
- package/browser-runtime/playwright-core/lib/server/recorder/chat.js +161 -0
- package/browser-runtime/playwright-core/lib/server/recorder/recorderApp.js +366 -0
- package/browser-runtime/playwright-core/lib/server/recorder/recorderRunner.js +138 -0
- package/browser-runtime/playwright-core/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/browser-runtime/playwright-core/lib/server/recorder/recorderUtils.js +157 -0
- package/browser-runtime/playwright-core/lib/server/recorder/throttledFile.js +57 -0
- package/browser-runtime/playwright-core/lib/server/recorder.js +499 -0
- package/browser-runtime/playwright-core/lib/server/registry/browserFetcher.js +177 -0
- package/browser-runtime/playwright-core/lib/server/registry/dependencies.js +371 -0
- package/browser-runtime/playwright-core/lib/server/registry/index.js +1422 -0
- package/browser-runtime/playwright-core/lib/server/registry/nativeDeps.js +1280 -0
- package/browser-runtime/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +127 -0
- package/browser-runtime/playwright-core/lib/server/screencast.js +190 -0
- package/browser-runtime/playwright-core/lib/server/screenshotter.js +333 -0
- package/browser-runtime/playwright-core/lib/server/selectors.js +112 -0
- package/browser-runtime/playwright-core/lib/server/socksClientCertificatesInterceptor.js +383 -0
- package/browser-runtime/playwright-core/lib/server/socksInterceptor.js +95 -0
- package/browser-runtime/playwright-core/lib/server/trace/recorder/snapshotter.js +147 -0
- package/browser-runtime/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +561 -0
- package/browser-runtime/playwright-core/lib/server/trace/recorder/tracing.js +604 -0
- package/browser-runtime/playwright-core/lib/server/trace/viewer/traceParser.js +72 -0
- package/browser-runtime/playwright-core/lib/server/trace/viewer/traceViewer.js +245 -0
- package/browser-runtime/playwright-core/lib/server/transport.js +181 -0
- package/browser-runtime/playwright-core/lib/server/types.js +28 -0
- package/browser-runtime/playwright-core/lib/server/usKeyboardLayout.js +145 -0
- package/browser-runtime/playwright-core/lib/server/utils/ascii.js +44 -0
- package/browser-runtime/playwright-core/lib/server/utils/comparators.js +139 -0
- package/browser-runtime/playwright-core/lib/server/utils/crypto.js +216 -0
- package/browser-runtime/playwright-core/lib/server/utils/debug.js +42 -0
- package/browser-runtime/playwright-core/lib/server/utils/debugLogger.js +122 -0
- package/browser-runtime/playwright-core/lib/server/utils/env.js +73 -0
- package/browser-runtime/playwright-core/lib/server/utils/eventsHelper.js +39 -0
- package/browser-runtime/playwright-core/lib/server/utils/expectUtils.js +123 -0
- package/browser-runtime/playwright-core/lib/server/utils/fileUtils.js +191 -0
- package/browser-runtime/playwright-core/lib/server/utils/happyEyeballs.js +207 -0
- package/browser-runtime/playwright-core/lib/server/utils/hostPlatform.js +138 -0
- package/browser-runtime/playwright-core/lib/server/utils/httpServer.js +203 -0
- package/browser-runtime/playwright-core/lib/server/utils/imageUtils.js +141 -0
- package/browser-runtime/playwright-core/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/browser-runtime/playwright-core/lib/server/utils/image_tools/compare.js +109 -0
- package/browser-runtime/playwright-core/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/browser-runtime/playwright-core/lib/server/utils/image_tools/stats.js +102 -0
- package/browser-runtime/playwright-core/lib/server/utils/linuxUtils.js +71 -0
- package/browser-runtime/playwright-core/lib/server/utils/network.js +242 -0
- package/browser-runtime/playwright-core/lib/server/utils/nodePlatform.js +154 -0
- package/browser-runtime/playwright-core/lib/server/utils/pipeTransport.js +84 -0
- package/browser-runtime/playwright-core/lib/server/utils/processLauncher.js +241 -0
- package/browser-runtime/playwright-core/lib/server/utils/profiler.js +65 -0
- package/browser-runtime/playwright-core/lib/server/utils/socksProxy.js +511 -0
- package/browser-runtime/playwright-core/lib/server/utils/spawnAsync.js +41 -0
- package/browser-runtime/playwright-core/lib/server/utils/task.js +51 -0
- package/browser-runtime/playwright-core/lib/server/utils/userAgent.js +98 -0
- package/browser-runtime/playwright-core/lib/server/utils/wsServer.js +121 -0
- package/browser-runtime/playwright-core/lib/server/utils/zipFile.js +74 -0
- package/browser-runtime/playwright-core/lib/server/utils/zones.js +57 -0
- package/browser-runtime/playwright-core/lib/server/videoRecorder.js +124 -0
- package/browser-runtime/playwright-core/lib/server/webkit/protocol.d.js +16 -0
- package/browser-runtime/playwright-core/lib/server/webkit/webkit.js +108 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkBrowser.js +335 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkConnection.js +144 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkExecutionContext.js +154 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkInput.js +181 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkInterceptableRequest.js +197 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkPage.js +1159 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/browser-runtime/playwright-core/lib/server/webkit/wkWorkers.js +105 -0
- package/browser-runtime/playwright-core/lib/third_party/pixelmatch.js +255 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/ariaSnapshot.js +455 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/assert.js +31 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/colors.js +72 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/cssParser.js +245 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/headers.js +53 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/locatorGenerators.js +689 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/locatorParser.js +176 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/lruCache.js +51 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/manualPromise.js +114 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/mimeType.js +459 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/multimap.js +80 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/protocolFormatter.js +81 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/protocolMetainfo.js +330 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/rtti.js +43 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/selectorParser.js +386 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/semaphore.js +54 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/stackTrace.js +158 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/stringUtils.js +204 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/time.js +49 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/entries.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/snapshotRenderer.js +499 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/traceLoader.js +131 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/traceModel.js +365 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/traceModernizer.js +400 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/traceUtils.js +58 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/types.js +16 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/urlMatch.js +190 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/browser-runtime/playwright-core/lib/utils/isomorphic/yaml.js +84 -0
- package/browser-runtime/playwright-core/lib/utils.js +111 -0
- package/browser-runtime/playwright-core/lib/utilsBundle.js +109 -0
- package/browser-runtime/playwright-core/lib/utilsBundleImpl/index.js +218 -0
- package/browser-runtime/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
- package/browser-runtime/playwright-core/lib/zipBundle.js +34 -0
- package/browser-runtime/playwright-core/lib/zipBundleImpl.js +5 -0
- package/browser-runtime/playwright-core/node_modules/.bin/playwright-core +21 -0
- package/browser-runtime/playwright-core/package.json +43 -0
- package/cli.mjs +33 -4
- package/daemon.mjs +21 -2
- package/entry.mjs +655 -354
- package/launcher.mjs +22 -0
- package/package.json +7 -6
- package/updater.mjs +6 -0
package/daemon.mjs
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
`;r.appendFile(B(e),i,()=>{}),e==="daemon"&&process.stdout.write(i)}function k(e){try{return JSON.parse(r.readFileSync(e,"utf8"))}catch{return null}}function H(e,n){r.mkdirSync(t.dirname(e),{recursive:!0}),r.writeFileSync(e,JSON.stringify(n,null,2),"utf8")}function E(e){try{r.unlinkSync(e)}catch{}}function R(){let e=k(t.join(f,"manifest.json"));if(typeof e?.version=="string"&&e.version.trim())return e.version.trim();try{return t.basename(r.realpathSync(f))}catch{return process.env.APP_VERSION||"unknown"}}function J(){let e=process.env.HEADLESS_DEVICE_CREDENTIAL_PATH||process.env.SIBOOT_DEVICE_CREDENTIAL_PATH;if(e&&e.trim())return t.resolve(e.trim());let n=process.env.HEADLESS_DATA_DIR||process.env.SIBOOT_DATA_DIR||t.join(F.homedir(),".siboot");return t.join(n,"headless-device-credential.json")}function K(){try{return r.existsSync(J())}catch{return!1}}function a(e={}){H(U,{pid:process.pid,client_pid:o?.pid||null,updater_pid:c?.pid||null,client_ready:m,client_ready_at:D,client_start_count:v,updater_start_count:L,version:R(),current_dir:f,state:_?"stopping":"running",started_at:M,updated_at:new Date().toISOString(),...e})}function W(e,n){let i=p=>{let u=Buffer.from(p);r.appendFile(B(n),u,()=>{})};e.stdout?.on("data",i),e.stderr?.on("data",i)}function $(){if(!Number.isFinite(y)||y<=0)return;let e=Date.now();for(let n of["daemon","client","update"]){let i=t.join(l,n);if(r.existsSync(i))for(let p of r.readdirSync(i)){let u=t.join(i,p),O=null;try{O=r.statSync(u)}catch{continue}if(!O.isFile())continue;e-O.mtimeMs>y*24*60*60*1e3&&E(u)}}}function w(){if(_||o)return;if(!r.existsSync(I)){s("daemon",`client entry missing entry=${I}`),a({state:"client_entry_missing"}),setTimeout(w,P).unref?.();return}v+=1,m=!1,D=null;let e={...process.env,APP_VERSION:R(),CLIENT_TYPE:process.env.CLIENT_TYPE||"anydev",SIBOOT_BASE_DIR:d,SIBOOT_CURRENT_DIR:f,SIBOOT_RUN_DIR:S,SIBOOT_LOG_DIR:l};K()&&(delete e.HEADLESS_DEVICE_TOKEN,delete process.env.HEADLESS_DEVICE_TOKEN),s("daemon",`starting client entry=${I} cwd=${A} version=${R()} start_count=${v}`),o=h(process.execPath,[I],{cwd:A,env:e,stdio:["ignore","pipe","pipe","ipc"]}),r.writeFileSync(N,String(o.pid)),W(o,"client"),a(),o.on("message",n=>{n?.type==="headless-client-ready"&&(m=!0,D=new Date().toISOString(),a(),s("daemon",`client ready pid=${o?.pid||""}`))}),o.on("error",n=>{s("daemon",`client spawn error error=${n.message}`)}),o.on("exit",(n,i)=>{s("daemon",`client exited pid=${o?.pid||""} code=${n} signal=${i}`),o=null,m=!1,D=null,E(N),a({client_exit_code:n,client_exit_signal:i}),_||setTimeout(w,P).unref?.()})}function Y(){if(!(_||c||process.env.ANYDEV_UPDATE_ENABLED==="0")){if(!r.existsSync(T)){s("daemon",`updater entry missing entry=${T}`);return}L+=1,s("daemon",`starting updater entry=${T} start_count=${L}`),c=h(process.execPath,[T],{cwd:d,env:{...process.env,CLIENT_TYPE:"anydev",SIBOOT_BASE_DIR:d,SIBOOT_CURRENT_DIR:f,SIBOOT_RUN_DIR:S,SIBOOT_LOG_DIR:l},stdio:["ignore","inherit","inherit"]}),r.writeFileSync(g,String(c.pid)),a(),c.on("error",e=>{s("daemon",`updater spawn error error=${e.message}`)}),c.on("exit",(e,n)=>{s("daemon",`updater exited pid=${c?.pid||""} code=${e} signal=${n}`),c=null,E(g),a({updater_exit_code:e,updater_exit_signal:n}),_||setTimeout(Y,G).unref?.()})}}function C(e,n){return e?.pid?(s("daemon",`stopping ${n} pid=${e.pid}`),new Promise(i=>{let p=!1,u=()=>{p||(p=!0,i())};e.once("exit",u);try{e.kill("SIGTERM")}catch{u();return}setTimeout(()=>{if(!p){try{e.kill("SIGKILL")}catch{}u()}},5e3).unref?.()})):Promise.resolve()}async function j(e){_||(_=!0,s("daemon",`shutdown signal=${e}`),a({state:"stopping",signal:e}),await Promise.all([C(c,"updater"),C(o,"client")]),E(g),E(N),E(x),a({state:"stopped",signal:e}),process.exit(0))}function Q(){V(),r.writeFileSync(x,String(process.pid)),process.on("SIGTERM",()=>{j("SIGTERM")}),process.on("SIGINT",()=>{j("SIGINT")}),s("daemon",`started base=${d} version=${R()}`),a({state:"starting"}),$(),w(),Y(),setInterval($,3600*1e3)}Q();
|
|
2
|
+
import { createRequire as __runtimeCreateRequire } from "node:module"; const require = __runtimeCreateRequire(import.meta.url);
|
|
3
|
+
var Ur=Object.defineProperty;var Hs=Object.getOwnPropertyDescriptor;var Fs=Object.getOwnPropertyNames;var ks=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>(e&&(t=e(e=0)),t);var js=(e,t)=>{for(var r in t)Ur(e,r,{get:t[r],enumerable:!0})},Ks=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Fs(t))!ks.call(e,i)&&i!==r&&Ur(e,i,{get:()=>t[i],enumerable:!(n=Hs(t,i))||n.enumerable});return e};var Ys=e=>Ks(Ur({},"__esModule",{value:!0}),e);var Js,Dt,Br=m(()=>{"use strict";Js=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Dt=(function(e){Js(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.name="OTLPExporterError",o.data=i,o.code=n,o}return t})(Error)});var j,Vr=m(()=>{"use strict";j="1.9.1"});function eu(e){let t=new Set([e]),r=new Set,n=e.match(so);if(!n)return()=>!1;let i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(l){return l===e};function o(u){return r.add(u),!1}function s(u){return t.add(u),!0}return function(l){if(t.has(l))return!0;if(r.has(l))return!1;let a=l.match(so);if(!a)return o(l);let c={major:+a[1],minor:+a[2],patch:+a[3],prerelease:a[4]};return c.prerelease!=null||i.major!==c.major?o(l):i.major===0?i.minor===c.minor&&i.patch<=c.patch?s(l):o(l):i.minor<=c.minor?s(l):o(l)}}var so,uo,co=m(()=>{"use strict";Vr();so=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;uo=eu(j)});function vt(e,t,r,n=!1){var i;let o=Vt[Bt]=(i=Vt[Bt])!==null&&i!==void 0?i:{version:j};if(!n&&o[e]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(o.version!==j){let s=new Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${j}`);return r.error(s.stack||s.message),!1}return o[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${j}.`),!0}function K(e){var t,r;let n=(t=Vt[Bt])===null||t===void 0?void 0:t.version;if(!(!n||!uo(n)))return(r=Vt[Bt])===null||r===void 0?void 0:r[e]}function Tt(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${j}.`);let r=Vt[Bt];r&&delete r[e]}var ru,Bt,Vt,Ht=m(()=>{"use strict";Vr();co();ru=j.split(".")[0],Bt=Symbol.for(`opentelemetry.js.api.${ru}`),Vt=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Ft(e,t,r){let n=K("diag");if(n)return n[e](t,...r)}var Ae,lo=m(()=>{"use strict";Ht();Ae=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return Ft("debug",this._namespace,t)}error(...t){return Ft("error",this._namespace,t)}info(...t){return Ft("info",this._namespace,t)}warn(...t){return Ft("warn",this._namespace,t)}verbose(...t){return Ft("verbose",this._namespace,t)}}});var g,Oe=m(()=>{"use strict";(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(g||(g={}))});function fo(e,t){e<g.NONE?e=g.NONE:e>g.ALL&&(e=g.ALL),t=t||{};function r(n,i){let o=t[n];return typeof o=="function"&&e>=i?o.bind(t):function(){}}return{error:r("error",g.ERROR),warn:r("warn",g.WARN),info:r("info",g.INFO),debug:r("debug",g.DEBUG),verbose:r("verbose",g.VERBOSE)}}var _o=m(()=>{"use strict";Oe()});var nu,M,kt=m(()=>{"use strict";lo();_o();Oe();Ht();nu="diag",M=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(i){return function(...o){let s=K("diag");if(s)return s[i](...o)}}let r=this,n=(i,o={logLevel:g.INFO})=>{var s,u,l;if(i===r){let f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=f.stack)!==null&&s!==void 0?s:f.message),!1}typeof o=="number"&&(o={logLevel:o});let a=K("diag"),c=fo((u=o.logLevel)!==null&&u!==void 0?u:g.INFO,i);if(a&&!o.suppressOverrideMessage){let f=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";a.warn(`Current logger will be overwritten from ${f}`),c.warn(`Current logger will overwrite one already registered from ${f}`)}return vt("diag",c,r,!0)};r.setLogger=n,r.disable=()=>{Tt(nu,r)},r.createComponentLogger=i=>new Ae(i),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}});var po,ho=m(()=>{"use strict";po=Symbol("BaggageEntryMetadata")});function Hr(e){return typeof e!="string"&&(ou.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:po,toString(){return e}}}var ou,mo=m(()=>{"use strict";kt();ho();ou=M.instance()});function jt(e){return Symbol.for(e)}var Fr,kr,Re=m(()=>{"use strict";Fr=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,i)=>{let o=new e(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=n=>{let i=new e(r._currentContext);return i._currentContext.delete(n),i}}},kr=new Fr});function qr(){return iu}var jr,gt,Kr,Yr,Xr,Wr,Kt,zr,$r,Jr,iu,au,su,uu,cu,lu,fu,_u,Eo=m(()=>{"use strict";jr=class{constructor(){}createGauge(t,r){return su}createHistogram(t,r){return uu}createCounter(t,r){return au}createUpDownCounter(t,r){return cu}createObservableGauge(t,r){return fu}createObservableCounter(t,r){return lu}createObservableUpDownCounter(t,r){return _u}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}},gt=class{},Kr=class extends gt{add(t,r){}},Yr=class extends gt{add(t,r){}},Xr=class extends gt{record(t,r){}},Wr=class extends gt{record(t,r){}},Kt=class{addCallback(t){}removeCallback(t){}},zr=class extends Kt{},$r=class extends Kt{},Jr=class extends Kt{},iu=new jr,au=new Kr,su=new Xr,uu=new Wr,cu=new Yr,lu=new zr,fu=new $r,_u=new Jr});var R,vo=m(()=>{"use strict";(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(R||(R={}))});var xe,To=m(()=>{"use strict";Re();xe=class{active(){return kr}with(t,r,n,...i){return r.call(n,...i)}bind(t,r){return r}enable(){return this}disable(){return this}}});var Zr,pu,$,Le=m(()=>{"use strict";To();Ht();kt();Zr="context",pu=new xe,$=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return vt(Zr,t,M.instance())}active(){return this._getContextManager().active()}with(t,r,n,...i){return this._getContextManager().with(t,r,n,...i)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return K(Zr)||pu}disable(){this._getContextManager().disable(),Tt(Zr,M.instance())}}});var it,Qr=m(()=>{"use strict";(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(it||(it={}))});var tn,en,go,rn=m(()=>{"use strict";Qr();tn="0000000000000000",en="00000000000000000000000000000000",go={traceId:en,spanId:tn,traceFlags:it.NONE}});var H,Pe=m(()=>{"use strict";rn();H=class{constructor(t=go){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}}});function be(e){return e.getValue(nn)||void 0}function So(){return be($.getInstance().active())}function Yt(e,t){return e.setValue(nn,t)}function yo(e){return e.deleteValue(nn)}function Ao(e,t){return Yt(e,new H(t))}function Me(e){var t;return(t=be(e))===null||t===void 0?void 0:t.spanContext()}var nn,on=m(()=>{"use strict";Re();Pe();Le();nn=jt("OpenTelemetry Context Key SPAN")});function Oo(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(Ie[e.charCodeAt(n)]|0)+(Ie[e.charCodeAt(n+1)]|0)+(Ie[e.charCodeAt(n+2)]|0)+(Ie[e.charCodeAt(n+3)]|0);return r===t}function Ro(e){return Oo(e,32)&&e!==en}function xo(e){return Oo(e,16)&&e!==tn}function at(e){return Ro(e.traceId)&&xo(e.spanId)}function Lo(e){return new H(e)}var Ie,we=m(()=>{"use strict";rn();Pe();Ie=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function du(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var an,St,sn=m(()=>{"use strict";Le();on();Pe();we();an=$.getInstance(),St=class{startSpan(t,r,n=an.active()){if(!!r?.root)return new H;let o=n&&Me(n);return du(o)&&at(o)?new H(o):new H}startActiveSpan(t,r,n,i){let o,s,u;if(arguments.length<2)return;arguments.length===2?u=r:arguments.length===3?(o=r,u=n):(o=r,s=n,u=i);let l=s??an.active(),a=this.startSpan(t,o,l),c=Yt(l,a);return an.with(c,u,void 0,a)}}});var hu,Ne,Po=m(()=>{"use strict";sn();hu=new St,Ne=class{constructor(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,i){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):hu}}});var Ce,bo=m(()=>{"use strict";sn();Ce=class{getTracer(t,r,n){return new St}}});var mu,Xt,Mo=m(()=>{"use strict";Po();bo();mu=new Ce,Xt=class{getTracer(t,r,n){var i;return(i=this.getDelegateTracer(t,r,n))!==null&&i!==void 0?i:new Ne(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:mu}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(t,r,n)}}});var I,Io=m(()=>{"use strict";Le();I=$.getInstance()});var _,wo=m(()=>{"use strict";kt();_=M.instance()});var un,Ue,No=m(()=>{"use strict";Ht();Mo();we();on();kt();un="trace",Ue=class e{constructor(){this._proxyTracerProvider=new Xt,this.wrapSpanContext=Lo,this.isSpanContextValid=at,this.deleteSpan=yo,this.getSpan=be,this.getActiveSpan=So,this.getSpanContext=Me,this.setSpan=Yt,this.setSpanContext=Ao}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=vt(un,this._proxyTracerProvider,M.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return K(un)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){Tt(un,M.instance()),this._proxyTracerProvider=new Xt}}});var st,Co=m(()=>{"use strict";No();st=Ue.getInstance()});var h=m(()=>{"use strict";mo();Re();Oe();Eo();vo();Qr();we();Io();wo();Co()});function Ma(e){var t=[429,502,503,504];return t.includes(e)}function Ia(e){if(e!=null){var t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;var r=new Date(e).getTime()-Date.now();return r>=0?r:0}}var wa=m(()=>{"use strict"});var Ua={};js(Ua,{compressAndSend:()=>Ca,createHttpAgent:()=>Ml,sendWithHttp:()=>Pl});import*as gr from"http";import*as Sr from"https";import*as Na from"zlib";import{Readable as Ll}from"stream";function Pl(e,t,r,n,i){var o=new URL(e.url),s=Number(process.versions.node.split(".")[0]),u={hostname:o.hostname,port:o.port,path:o.pathname,method:"POST",headers:Bn({},e.headers()),agent:t},l=o.protocol==="http:"?gr.request:Sr.request,a=l(u,function(f){var d=[];f.on("data",function(T){return d.push(T)}),f.on("end",function(){if(f.statusCode&&f.statusCode<299)n({status:"success",data:Buffer.concat(d)});else if(f.statusCode&&Ma(f.statusCode))n({status:"retryable",retryInMillis:Ia(f.headers["retry-after"])});else{var T=new Dt(f.statusMessage,f.statusCode,Buffer.concat(d).toString());n({status:"failure",error:T})}})});a.setTimeout(i,function(){a.destroy(),n({status:"failure",error:new Error("Request Timeout")})}),a.on("error",function(f){n({status:"failure",error:f})});var c=s>=14?"close":"abort";a.on(c,function(){n({status:"failure",error:new Error("Request timed out")})}),Ca(a,e.compression,r,function(f){n({status:"failure",error:f})})}function Ca(e,t,r,n){var i=bl(r);t==="gzip"&&(e.setHeader("Content-Encoding","gzip"),i=i.on("error",n).pipe(Na.createGzip()).on("error",n)),i.pipe(e).on("error",n)}function bl(e){var t=new Ll;return t.push(e),t.push(null),t}function Ml(e,t){var r=new URL(e),n=r.protocol==="http:"?gr.Agent:Sr.Agent;return new n(t)}var Bn,Da=m(()=>{"use strict";wa();Br();Bn=function(){return Bn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Bn.apply(this,arguments)}});import xf from"fs";import ys from"os";import Lf from"path";import{StringDecoder as Pf}from"string_decoder";var Xs=/\b(authorization|proxy-authorization|cookie|set-cookie)\s*:\s*[^\r\n]*/gi,Ws=/\b(bearer|basic)\s+[A-Z0-9._~+/=-]+/gi,zs=/\b(authorization|proxy[-_]authorization|cookie|set[-_]cookie|credential[-_]grant|taihu[-_]auth[-_]grant|app[-_]publish[-_]grant|access[-_]token|refresh[-_]token|id[-_]token|token|api[-_]?key|password|secret)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;&]+)/gi;function ve(e){return(e instanceof Error?`${e.name}: ${e.message}`:String(e??"")).replace(Xs,"$1: [redacted]").replace(Ws,"$1 [redacted]").replace(zs,"$1=[redacted]").replace(/\s+/g," ").trim().slice(0,2e3)}function to(e,t,r,n){let i=ve(r),o=Object.fromEntries(Object.entries(n).map(([s,u])=>[s,ve(u)]));if(Object.keys(o).length===0){e[t](i);return}e[t](i,o)}var wt;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(wt||(wt={}));var Te=(function(){function e(){}return e.prototype.emit=function(t){},e})();var Nt=new Te;var $s=(function(){function e(){}return e.prototype.getLogger=function(t,r,n){return new Te},e})();var ge=new $s;var eo=(function(){function e(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}return e.prototype.emit=function(t){this._getLogger().emit(t)},e.prototype._getLogger=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Nt},e})();var Dr=(function(){function e(){}return e.prototype.getLogger=function(t,r,n){var i;return(i=this.getDelegateLogger(t,r,n))!==null&&i!==void 0?i:new eo(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ge},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateLogger=function(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,r,n)},e})();var Se=typeof globalThis=="object"?globalThis:global;var Ct=Symbol.for("io.opentelemetry.js.api.logs"),Et=Se;function ro(e,t,r){return function(n){return n===e?t:r}}var Gr=1;var no=(function(){function e(){this._proxyLoggerProvider=new Dr}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalLoggerProvider=function(t){return Et[Ct]?this.getLoggerProvider():(Et[Ct]=ro(Gr,t,ge),this._proxyLoggerProvider.setDelegate(t),t)},e.prototype.getLoggerProvider=function(){var t,r;return(r=(t=Et[Ct])===null||t===void 0?void 0:t.call(Et,Gr))!==null&&r!==void 0?r:this._proxyLoggerProvider},e.prototype.getLogger=function(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)},e.prototype.disable=function(){delete Et[Ct],this._proxyLoggerProvider=new Dr},e})();var L_=no.getInstance();var Ut=(function(){function e(t){this._delegate=t}return e.prototype.export=function(t,r){this._delegate.export(t,r)},e.prototype.forceFlush=function(){return this._delegate.forceFlush()},e.prototype.shutdown=function(){return this._delegate.shutdown()},e})();function qs(e){if(!Number.isNaN(e)&&Number.isFinite(e)&&e>0)return e;throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '"+e+"')")}function ye(e){if(e!=null)return function(){return e}}function oo(e,t,r){var n,i,o,s,u,l;return{timeoutMillis:qs((i=(n=e.timeoutMillis)!==null&&n!==void 0?n:t.timeoutMillis)!==null&&i!==void 0?i:r.timeoutMillis),concurrencyLimit:(s=(o=e.concurrencyLimit)!==null&&o!==void 0?o:t.concurrencyLimit)!==null&&s!==void 0?s:r.concurrencyLimit,compression:(l=(u=e.compression)!==null&&u!==void 0?u:t.compression)!==null&&l!==void 0?l:r.compression}}function io(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Gt;(function(e){e.NONE="none",e.GZIP="gzip"})(Gt||(Gt={}));var Zs=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Qs=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},tu=(function(){function e(t){this._sendingPromises=[],this._concurrencyLimit=t}return e.prototype.pushPromise=function(t){var r=this;if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);var n=function(){var i=r._sendingPromises.indexOf(t);r._sendingPromises.splice(i,1)};t.then(n,n)},e.prototype.hasReachedLimit=function(){return this._sendingPromises.length>=this._concurrencyLimit},e.prototype.awaitAll=function(){return Zs(this,void 0,void 0,function(){return Qs(this,function(t){switch(t.label){case 0:return[4,Promise.all(this._sendingPromises)];case 1:return t.sent(),[2]}})})},e})();function ao(e){return new tu(e.concurrencyLimit)}h();var Eu=jt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Uo(e){return e.setValue(Eu,!0)}var Do="=",De=";",cn=",";var Go=8192;h();var vu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function Bo(e){return e.reduce(function(t,r){var n=""+t+(t!==""?cn:"")+r;return n.length>Go?t:n},"")}function Vo(e){return e.getAllEntries().map(function(t){var r=vu(t,2),n=r[0],i=r[1],o=encodeURIComponent(n)+"="+encodeURIComponent(i.value);return i.metadata!==void 0&&(o+=De+i.metadata.toString()),o})}function ln(e){var t=e.split(De);if(!(t.length<=0)){var r=t.shift();if(r){var n=r.indexOf(Do);if(!(n<=0)){var i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return t.length>0&&(s=Hr(t.join(De))),{key:i,value:o,metadata:s}}}}}function Ho(e){return typeof e!="string"||e.length===0?{}:e.split(cn).map(function(t){return ln(t)}).filter(function(t){return t!==void 0&&t.value.length>0}).reduce(function(t,r){return t[r.key]=r.value,t},{})}var Tu=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Ge(e){return e==null?!0:Array.isArray(e)?gu(e):Fo(e)}function gu(e){var t,r,n;try{for(var i=Tu(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!=null){if(!n){if(Fo(s)){n=typeof s;continue}return!1}if(typeof s!==n)return!1}}}catch(u){t={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!0}function Fo(e){switch(typeof e){case"number":case"boolean":case"string":return!0}return!1}h();function ko(){return function(e){_.error(Su(e))}}function Su(e){return typeof e=="string"?e:JSON.stringify(yu(e))}function yu(e){for(var t={},r=e;r!==null;)Object.getOwnPropertyNames(r).forEach(function(n){if(!t[n]){var i=r[n];i&&(t[n]=String(i))}}),r=Object.getPrototypeOf(r);return t}var Au=ko();function Y(e){try{Au(e)}catch{}}h();var Be;(function(e){e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(Be||(Be={}));var Ou=",",Ru=["OTEL_SDK_DISABLED"];function xu(e){return Ru.indexOf(e)>-1}var Lu=["OTEL_BSP_EXPORT_TIMEOUT","OTEL_BSP_MAX_EXPORT_BATCH_SIZE","OTEL_BSP_MAX_QUEUE_SIZE","OTEL_BSP_SCHEDULE_DELAY","OTEL_BLRP_EXPORT_TIMEOUT","OTEL_BLRP_MAX_EXPORT_BATCH_SIZE","OTEL_BLRP_MAX_QUEUE_SIZE","OTEL_BLRP_SCHEDULE_DELAY","OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_EVENT_COUNT_LIMIT","OTEL_SPAN_LINK_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT","OTEL_EXPORTER_OTLP_TIMEOUT","OTEL_EXPORTER_OTLP_TRACES_TIMEOUT","OTEL_EXPORTER_OTLP_METRICS_TIMEOUT","OTEL_EXPORTER_OTLP_LOGS_TIMEOUT","OTEL_EXPORTER_JAEGER_AGENT_PORT"];function Pu(e){return Lu.indexOf(e)>-1}var bu=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function Mu(e){return bu.indexOf(e)>-1}var yt=1/0,At=128,jo=128,Ko=128,Ve={OTEL_SDK_DISABLED:!1,CONTAINER_NAME:"",ECS_CONTAINER_METADATA_URI_V4:"",ECS_CONTAINER_METADATA_URI:"",HOSTNAME:"",KUBERNETES_SERVICE_HOST:"",NAMESPACE:"",OTEL_BSP_EXPORT_TIMEOUT:3e4,OTEL_BSP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BSP_MAX_QUEUE_SIZE:2048,OTEL_BSP_SCHEDULE_DELAY:5e3,OTEL_BLRP_EXPORT_TIMEOUT:3e4,OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BLRP_MAX_QUEUE_SIZE:2048,OTEL_BLRP_SCHEDULE_DELAY:5e3,OTEL_EXPORTER_JAEGER_AGENT_HOST:"",OTEL_EXPORTER_JAEGER_AGENT_PORT:6832,OTEL_EXPORTER_JAEGER_ENDPOINT:"",OTEL_EXPORTER_JAEGER_PASSWORD:"",OTEL_EXPORTER_JAEGER_USER:"",OTEL_EXPORTER_OTLP_ENDPOINT:"",OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"",OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"",OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:"",OTEL_EXPORTER_OTLP_HEADERS:"",OTEL_EXPORTER_OTLP_TRACES_HEADERS:"",OTEL_EXPORTER_OTLP_METRICS_HEADERS:"",OTEL_EXPORTER_OTLP_LOGS_HEADERS:"",OTEL_EXPORTER_OTLP_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:1e4,OTEL_EXPORTER_ZIPKIN_ENDPOINT:"http://localhost:9411/api/v2/spans",OTEL_LOG_LEVEL:g.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:yt,OTEL_ATTRIBUTE_COUNT_LIMIT:At,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:yt,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:At,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:yt,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:At,OTEL_SPAN_EVENT_COUNT_LIMIT:128,OTEL_SPAN_LINK_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:jo,OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:Ko,OTEL_TRACES_EXPORTER:"",OTEL_TRACES_SAMPLER:Be.ParentBasedAlwaysOn,OTEL_TRACES_SAMPLER_ARG:"",OTEL_LOGS_EXPORTER:"",OTEL_EXPORTER_OTLP_INSECURE:"",OTEL_EXPORTER_OTLP_TRACES_INSECURE:"",OTEL_EXPORTER_OTLP_METRICS_INSECURE:"",OTEL_EXPORTER_OTLP_LOGS_INSECURE:"",OTEL_EXPORTER_OTLP_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_COMPRESSION:"",OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:"",OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:"",OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:"",OTEL_EXPORTER_OTLP_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"cumulative",OTEL_SEMCONV_STABILITY_OPT_IN:[]};function Iu(e,t,r){if(!(typeof r[e]>"u")){var n=String(r[e]);t[e]=n.toLowerCase()==="true"}}function wu(e,t,r,n,i){if(n===void 0&&(n=-1/0),i===void 0&&(i=1/0),typeof r[e]<"u"){var o=Number(r[e]);isNaN(o)||(o<n?t[e]=n:o>i?t[e]=i:t[e]=o)}}function Nu(e,t,r,n){n===void 0&&(n=Ou);var i=r[e];typeof i=="string"&&(t[e]=i.split(n).map(function(o){return o.trim()}))}var Cu={ALL:g.ALL,VERBOSE:g.VERBOSE,DEBUG:g.DEBUG,INFO:g.INFO,WARN:g.WARN,ERROR:g.ERROR,NONE:g.NONE};function Uu(e,t,r){var n=r[e];if(typeof n=="string"){var i=Cu[n.toUpperCase()];i!=null&&(t[e]=i)}}function He(e){var t={};for(var r in Ve){var n=r;switch(n){case"OTEL_LOG_LEVEL":Uu(n,t,e);break;default:if(xu(n))Iu(n,t,e);else if(Pu(n))wu(n,t,e);else if(Mu(n))Nu(n,t,e);else{var i=e[n];typeof i<"u"&&i!==null&&(t[n]=String(i))}}}return t}function F(){var e=He(process.env);return Object.assign({},Ve,e)}function zt(){return He(process.env)}function Yo(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function $t(e){for(var t=new Uint8Array(e.length/2),r=0,n=0;n<e.length;n+=2){var i=Yo(e.charCodeAt(n)),o=Yo(e.charCodeAt(n+1));t[r++]=i<<4|o}return t}import{performance as Du}from"perf_hooks";var ut=Du;var Xo="1.30.1";var Gu="process.runtime.name";var Bu="service.name";var Vu="telemetry.sdk.name",Hu="telemetry.sdk.language",Fu="telemetry.sdk.version";var Wo=Gu;var zo=Bu;var Jt=Vu,qt=Hu,Zt=Fu;var ku="nodejs";var $o=ku;var Ot,ct=(Ot={},Ot[Jt]="opentelemetry",Ot[Wo]="node",Ot[qt]=$o,Ot[Zt]=Xo,Ot);function lt(e){e.unref()}var Xu=9,Wu=6,zu=Math.pow(10,Wu),fn=Math.pow(10,Xu);function D(e){var t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*zu);return[r,n]}function _n(){var e=ut.timeOrigin;if(typeof e!="number"){var t=ut;e=t.timing&&t.timing.fetchStart}return e}function Jo(e){var t=D(_n()),r=D(typeof e=="number"?e:ut.now());return Zo(t,r)}function Fe(e){if(qo(e))return e;if(typeof e=="number")return e<_n()?Jo(e):D(e);if(e instanceof Date)return D(e.getTime());throw TypeError("Invalid input type")}function pn(e){return e[0]*fn+e[1]}function J(e){return e[0]*1e6+e[1]/1e3}function qo(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function Zo(e,t){var r=[e[0]+t[0],e[1]+t[1]];return r[1]>=fn&&(r[1]-=fn,r[0]+=1),r}var O;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(O||(O={}));var $u="[object Object]",Ju="[object Null]",qu="[object Undefined]",Zu=Function.prototype,Qo=Zu.toString,Qu=Qo.call(Object),tc=ec(Object.getPrototypeOf,Object),ti=Object.prototype,ei=ti.hasOwnProperty,ft=Symbol?Symbol.toStringTag:void 0,ri=ti.toString;function ec(e,t){return function(r){return e(t(r))}}function dn(e){if(!rc(e)||nc(e)!==$u)return!1;var t=tc(e);if(t===null)return!0;var r=ei.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Qo.call(r)===Qu}function rc(e){return e!=null&&typeof e=="object"}function nc(e){return e==null?e===void 0?qu:Ju:ft&&ft in Object(e)?oc(e):ic(e)}function oc(e){var t=ei.call(e,ft),r=e[ft],n=!1;try{e[ft]=void 0,n=!0}catch{}var i=ri.call(e);return n&&(t?e[ft]=r:delete e[ft]),i}function ic(e){return ri.call(e)}var ac=20;function mn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=e.shift(),n=new WeakMap;e.length>0;)r=oi(r,e.shift(),0,n);return r}function hn(e){return je(e)?e.slice():e}function oi(e,t,r,n){r===void 0&&(r=0);var i;if(!(r>ac)){if(r++,ke(e)||ke(t)||ii(t))i=hn(t);else if(je(e)){if(i=e.slice(),je(t))for(var o=0,s=t.length;o<s;o++)i.push(hn(t[o]));else if(Qt(t))for(var u=Object.keys(t),o=0,s=u.length;o<s;o++){var l=u[o];i[l]=hn(t[l])}}else if(Qt(e))if(Qt(t)){if(!sc(e,t))return t;i=Object.assign({},e);for(var u=Object.keys(t),o=0,s=u.length;o<s;o++){var l=u[o],a=t[l];if(ke(a))typeof a>"u"?delete i[l]:i[l]=a;else{var c=i[l],f=a;if(ni(e,l,n)||ni(t,l,n))delete i[l];else{if(Qt(c)&&Qt(f)){var d=n.get(c)||[],T=n.get(f)||[];d.push({obj:e,key:l}),T.push({obj:t,key:l}),n.set(c,d),n.set(f,T)}i[l]=oi(i[l],a,r,n)}}}}else i=t;return i}}function ni(e,t,r){for(var n=r.get(e[t])||[],i=0,o=n.length;i<o;i++){var s=n[i];if(s.key===t&&s.obj===e)return!0}return!1}function je(e){return Array.isArray(e)}function ii(e){return typeof e=="function"}function Qt(e){return!ke(e)&&!je(e)&&!ii(e)&&typeof e=="object"}function ke(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function sc(e,t){return!(!dn(e)||!dn(t))}var uc=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ai=(function(e){uc(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return t})(Error);function te(e,t){var r,n=new Promise(function(o,s){r=setTimeout(function(){s(new ai("Operation timed out."))},t)});return Promise.race([e,n]).then(function(i){return clearTimeout(r),i},function(i){throw clearTimeout(r),i})}var si=(function(){function e(){var t=this;this._promise=new Promise(function(r,n){t._resolve=r,t._reject=n})}return Object.defineProperty(e.prototype,"promise",{get:function(){return this._promise},enumerable:!1,configurable:!0}),e.prototype.resolve=function(t){this._resolve(t)},e.prototype.reject=function(t){this._reject(t)},e})();var cc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},lc=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},ee=(function(){function e(t,r){this._callback=t,this._that=r,this._isCalled=!1,this._deferred=new si}return Object.defineProperty(e.prototype,"isCalled",{get:function(){return this._isCalled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promise",{get:function(){return this._deferred.promise},enumerable:!1,configurable:!0}),e.prototype.call=function(){for(var t,r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(!this._isCalled){this._isCalled=!0;try{Promise.resolve((t=this._callback).call.apply(t,lc([this._that],cc(n),!1))).then(function(o){return r._deferred.resolve(o)},function(o){return r._deferred.reject(o)})}catch(o){this._deferred.reject(o)}}return this._deferred.promise},e})();h();function ui(e,t){return new Promise(function(r){I.with(Uo(I.active()),function(){e.export(t,function(n){r(n)})})})}var re={getKeyPairs:Vo,serializeKeyPairs:Bo,parseKeyPairsIntoRecord:Ho,parsePairKeyValue:ln},Ke={_export:ui};Br();h();function fc(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function ci(){return{handleResponse:function(e){e==null||!fc(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||_.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}h();var _c=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},pc=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},dc=(function(){function e(t,r,n,i,o){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=i,this._timeout=o,this._diagLogger=_.createComponentLogger({namespace:"OTLPExportDelegate"})}return e.prototype.export=function(t,r){var n=this;if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:O.FAILED,error:new Error("Concurrent export limit reached")});return}var i=this._serializer.serializeRequest(t);if(i==null){r({code:O.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(i,this._timeout).then(function(o){if(o.status==="success"){if(o.data!=null)try{n._responseHandler.handleResponse(n._serializer.deserializeResponse(o.data))}catch(s){n._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",s,o.data)}r({code:O.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:O.FAILED,error:o.error});return}else o.status==="retryable"?r({code:O.FAILED,error:new Dt("Export failed with retryable status")}):r({code:O.FAILED,error:new Dt("Export failed with unknown error")})},function(o){return r({code:O.FAILED,error:o})}))},e.prototype.forceFlush=function(){return this._promiseQueue.awaitAll()},e.prototype.shutdown=function(){return _c(this,void 0,void 0,function(){return pc(this,function(t){switch(t.label){case 0:return this._diagLogger.debug("shutdown started"),[4,this.forceFlush()];case 1:return t.sent(),this._transport.shutdown(),[2]}})})},e})();function li(e,t){return new dc(e.transport,e.serializer,ci(),e.promiseHandler,t.timeout)}function _i(e){var t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}function hc(e){var t=Number(BigInt.asUintN(32,e)),r=Number(BigInt.asUintN(32,e>>BigInt(32)));return{low:t,high:r}}function pi(e){var t=_i(e);return hc(t)}function mc(e){var t=_i(e);return t.toString()}var Ec=typeof BigInt<"u"?mc:pn;function fi(e){return e}function di(e){if(e!==void 0)return $t(e)}var vc={encodeHrTime:pi,encodeSpanContext:$t,encodeOptionalSpanContext:di};function Ye(e){var t,r;if(e===void 0)return vc;var n=(t=e.useLongBits)!==null&&t!==void 0?t:!0,i=(r=e.useHex)!==null&&r!==void 0?r:!1;return{encodeHrTime:n?pi:Ec,encodeSpanContext:i?fi:$t,encodeOptionalSpanContext:i?fi:di}}var Tc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function Xe(e){return{attributes:ne(e.attributes),droppedAttributesCount:0}}function We(e){return{name:e.name,version:e.version}}function ne(e){return Object.keys(e).map(function(t){return ze(t,e[t])})}function ze(e,t){return{key:e,value:$e(t)}}function $e(e){var t=typeof e;return t==="string"?{stringValue:e}:t==="number"?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:t==="boolean"?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map($e)}}:t==="object"&&e!=null?{kvlistValue:{values:Object.entries(e).map(function(r){var n=Tc(r,2),i=n[0],o=n[1];return ze(i,o)})}}:{}}var gc=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},hi=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function mi(e,t){var r=Ye(t);return{resourceLogs:yc(e,r)}}function Sc(e){var t,r,n=new Map;try{for(var i=gc(e),o=i.next();!o.done;o=i.next()){var s=o.value,u=s.resource,l=s.instrumentationScope,a=l.name,c=l.version,f=c===void 0?"":c,d=l.schemaUrl,T=d===void 0?"":d,U=n.get(u);U||(U=new Map,n.set(u,U));var ot=a+"@"+f+":"+T,mt=U.get(ot);mt||(mt=[],U.set(ot,mt)),mt.push(s)}}catch(Ee){t={error:Ee}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function yc(e,t){var r=Sc(e);return Array.from(r,function(n){var i=hi(n,2),o=i[0],s=i[1];return{resource:Xe(o),scopeLogs:Array.from(s,function(u){var l=hi(u,2),a=l[1];return{scope:We(a[0].instrumentationScope),logRecords:a.map(function(c){return Ac(c,t)}),schemaUrl:a[0].instrumentationScope.schemaUrl}}),schemaUrl:void 0}})}function Ac(e,t){var r,n,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:$e(e.body),attributes:Oc(e.attributes),droppedAttributesCount:e.droppedAttributesCount,flags:(r=e.spanContext)===null||r===void 0?void 0:r.traceFlags,traceId:t.encodeOptionalSpanContext((n=e.spanContext)===null||n===void 0?void 0:n.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)===null||i===void 0?void 0:i.spanId)}}function Oc(e){return Object.keys(e).map(function(t){return ze(t,e[t])})}h();var A;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(A||(A={}));var x;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(x||(x={}));h();var Rc=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Ei=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},vi=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},xc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Lc=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Pc=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Ti(e){return e!=null}function Je(e){var t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(function(r){return[r,e[r]]})))}function gi(e){var t,r;return e.name+":"+((t=e.version)!==null&&t!==void 0?t:"")+":"+((r=e.schemaUrl)!==null&&r!==void 0?r:"")}var En=(function(e){Rc(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return t})(Error);function q(e,t){var r,n=new Promise(function(o,s){r=setTimeout(function(){s(new En("Operation timed out."))},t)});return Promise.race([e,n]).then(function(i){return clearTimeout(r),i},function(i){throw clearTimeout(r),i})}function Si(e){return Ei(this,void 0,void 0,function(){var t=this;return vi(this,function(r){return[2,Promise.all(e.map(function(n){return Ei(t,void 0,void 0,function(){var i,o;return vi(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,n];case 1:return i=s.sent(),[2,{status:"fulfilled",value:i}];case 2:return o=s.sent(),[2,{status:"rejected",reason:o}];case 3:return[2]}})})}))]})})}function yi(e){return e.status==="rejected"}function vn(e,t){var r=[];return e.forEach(function(n){r.push.apply(r,Lc([],xc(t(n)),!1))}),r}function Ai(e,t){var r,n;if(e.size!==t.size)return!1;try{for(var i=Pc(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(!t.has(s))return!1}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}function Oi(e,t){for(var r=0,n=e.length-1,i=e.length;n>=r;){var o=r+Math.trunc((n-r)/2);e[o]<t?r=o+1:(i=o,n=o-1)}return i}function Ri(e,t){return e.toLowerCase()===t.toLowerCase()}h();var w;(function(e){e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(w||(w={}));var Tn=(function(){function e(){this.kind=w.DROP}return e.prototype.createAccumulation=function(){},e.prototype.merge=function(t,r){},e.prototype.diff=function(t,r){},e.prototype.toMetricData=function(t,r,n,i){},e})();h();var p;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(p||(p={}));function k(e,t,r){var n,i,o,s;return Mc(e)||_.warn('Invalid metric name: "'+e+'". The metric name should be a ASCII string with a length no greater than 255 characters.'),{name:e,type:t,description:(n=r?.description)!==null&&n!==void 0?n:"",unit:(i=r?.unit)!==null&&i!==void 0?i:"",valueType:(o=r?.valueType)!==null&&o!==void 0?o:R.DOUBLE,advice:(s=r?.advice)!==null&&s!==void 0?s:{}}}function xi(e,t){var r,n;return{name:(r=e.name)!==null&&r!==void 0?r:t.name,description:(n=e.description)!==null&&n!==void 0?n:t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Li(e,t){return Ri(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var bc=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function Mc(e){return e.match(bc)!=null}var Ic=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function wc(e){var t=e.map(function(){return 0});return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var qe=(function(){function e(t,r,n,i){n===void 0&&(n=!0),i===void 0&&(i=wc(r)),this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=i}return e.prototype.record=function(t){if(!Number.isNaN(t)){this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);var r=Oi(this._boundaries,t);this._current.buckets.counts[r]+=1}},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var Ze=(function(){function e(t,r){this._boundaries=t,this._recordMinMax=r,this.kind=w.HISTOGRAM}return e.prototype.createAccumulation=function(t){return new qe(t,this._boundaries,this._recordMinMax)},e.prototype.merge=function(t,r){for(var n=t.toPointValue(),i=r.toPointValue(),o=n.buckets.counts,s=i.buckets.counts,u=new Array(o.length),l=0;l<o.length;l++)u[l]=o[l]+s[l];var a=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&i.hasMinMax?(a=Math.min(n.min,i.min),c=Math.max(n.max,i.max)):n.hasMinMax?(a=n.min,c=n.max):i.hasMinMax&&(a=i.min,c=i.max)),new qe(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:u},count:n.count+i.count,sum:n.sum+i.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||i.hasMinMax),min:a,max:c})},e.prototype.diff=function(t,r){for(var n=t.toPointValue(),i=r.toPointValue(),o=n.buckets.counts,s=i.buckets.counts,u=new Array(o.length),l=0;l<o.length;l++)u[l]=s[l]-o[l];return new qe(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:u},count:i.count-n.count,sum:i.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:x.HISTOGRAM,dataPoints:n.map(function(o){var s=Ic(o,2),u=s[0],l=s[1],a=l.toPointValue(),c=t.type===p.GAUGE||t.type===p.UP_DOWN_COUNTER||t.type===p.OBSERVABLE_GAUGE||t.type===p.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:u,startTime:l.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}},e})();h();var gn=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Sn=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},yn=(function(){function e(t,r,n,i){t===void 0&&(t=new Nc),r===void 0&&(r=0),n===void 0&&(n=0),i===void 0&&(i=0),this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=i}return Object.defineProperty(e.prototype,"offset",{get:function(){return this.indexStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1},enumerable:!1,configurable:!0}),e.prototype.counts=function(){var t=this;return Array.from({length:this.length},function(r,n){return t.at(n)})},e.prototype.at=function(t){var r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)},e.prototype.incrementBucket=function(t,r){this.backing.increment(t,r)},e.prototype.decrementBucket=function(t,r){this.backing.decrement(t,r)},e.prototype.trim=function(){for(var t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(var t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()},e.prototype.downscale=function(t){this._rotate();for(var r=1+this.indexEnd-this.indexStart,n=1<<t,i=0,o=0,s=this.indexStart;s<=this.indexEnd;){var u=s%n;u<0&&(u+=n);for(var l=u;l<n&&i<r;l++)this._relocateBucket(o,i),i++,s++;o++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart},e.prototype.clone=function(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)},e.prototype._rotate=function(){var t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)},e.prototype._relocateBucket=function(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))},e})();var Nc=(function(){function e(t){t===void 0&&(t=[0]),this._counts=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this._counts.length},enumerable:!1,configurable:!0}),e.prototype.countAt=function(t){return this._counts[t]},e.prototype.growTo=function(t,r,n){var i=new Array(t).fill(0);i.splice.apply(i,Sn([n,this._counts.length-r],gn(this._counts.slice(r)),!1)),i.splice.apply(i,Sn([0,r],gn(this._counts.slice(0,r)),!1)),this._counts=i},e.prototype.reverse=function(t,r){for(var n=Math.floor((t+r)/2)-t,i=0;i<n;i++){var o=this._counts[t+i];this._counts[t+i]=this._counts[r-i-1],this._counts[r-i-1]=o}},e.prototype.emptyBucket=function(t){var r=this._counts[t];return this._counts[t]=0,r},e.prototype.increment=function(t,r){this._counts[t]+=r},e.prototype.decrement=function(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0},e.prototype.clone=function(){return new e(Sn([],gn(this._counts),!1))},e})();var Pi=52,Cc=2146435072,Uc=1048575,An=1023,Qe=-An+1,tr=An,oe=Math.pow(2,-1022);function er(e){var t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);var r=t.getUint32(0),n=(r&Cc)>>20;return n-An}function rr(e){var t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);var r=t.getUint32(0),n=t.getUint32(4),i=(r&Uc)*Math.pow(2,32);return i+n}function ie(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function Mi(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var Dc=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Z=(function(e){Dc(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Error);var wi=(function(){function e(t){this._shift=-t}return e.prototype.mapToIndex=function(t){if(t<oe)return this._minNormalLowerBoundaryIndex();var r=er(t),n=this._rightShift(rr(t)-1,Pi);return r+n>>this._shift},e.prototype.lowerBoundary=function(t){var r=this._minNormalLowerBoundaryIndex();if(t<r)throw new Z("underflow: "+t+" is < minimum lower boundary: "+r);var n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new Z("overflow: "+t+" is > maximum lower boundary: "+n);return ie(1,t<<this._shift)},Object.defineProperty(e.prototype,"scale",{get:function(){return this._shift===0?0:-this._shift},enumerable:!1,configurable:!0}),e.prototype._minNormalLowerBoundaryIndex=function(){var t=Qe>>this._shift;return this._shift<2&&t--,t},e.prototype._maxNormalLowerBoundaryIndex=function(){return tr>>this._shift},e.prototype._rightShift=function(t,r){return Math.floor(t*Math.pow(2,-r))},e})();var Ni=(function(){function e(t){this._scale=t,this._scaleFactor=ie(Math.LOG2E,t),this._inverseFactor=ie(Math.LN2,-t)}return e.prototype.mapToIndex=function(t){if(t<=oe)return this._minNormalLowerBoundaryIndex()-1;if(rr(t)===0){var r=er(t);return(r<<this._scale)-1}var n=Math.floor(Math.log(t)*this._scaleFactor),i=this._maxNormalLowerBoundaryIndex();return n>=i?i:n},e.prototype.lowerBoundary=function(t){var r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new Z("overflow: "+t+" is > maximum lower boundary: "+r)}var n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return oe;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new Z("overflow: "+t+" is < minimum lower boundary: "+n)}return Math.exp(t*this._inverseFactor)},Object.defineProperty(e.prototype,"scale",{get:function(){return this._scale},enumerable:!1,configurable:!0}),e.prototype._minNormalLowerBoundaryIndex=function(){return Qe<<this._scale},e.prototype._maxNormalLowerBoundaryIndex=function(){return(tr+1<<this._scale)-1},e})();var Ci=-10,Ui=20,Gc=Array.from({length:31},function(e,t){return t>10?new Ni(t-10):new wi(t-10)});function On(e){if(e>Ui||e<Ci)throw new Z("expected scale >= "+Ci+" && <= "+Ui+", got: "+e);return Gc[e+10]}var Bc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},nr=(function(){function e(t,r){this.low=t,this.high=r}return e.combine=function(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))},e})(),Vc=20,Hc=160,Rn=2,Di=(function(){function e(t,r,n,i,o,s,u,l,a,c,f){t===void 0&&(t=t),r===void 0&&(r=Hc),n===void 0&&(n=!0),i===void 0&&(i=0),o===void 0&&(o=0),s===void 0&&(s=0),u===void 0&&(u=Number.POSITIVE_INFINITY),l===void 0&&(l=Number.NEGATIVE_INFINITY),a===void 0&&(a=new yn),c===void 0&&(c=new yn),f===void 0&&(f=On(Vc)),this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=i,this._count=o,this._zeroCount=s,this._min=u,this._max=l,this._positive=a,this._negative=c,this._mapping=f,this._maxSize<Rn&&(_.warn("Exponential Histogram Max Size set to "+this._maxSize+", changing to the minimum size of: "+Rn),this._maxSize=Rn)}return e.prototype.record=function(t){this.updateByIncrement(t,1)},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}},Object.defineProperty(e.prototype,"sum",{get:function(){return this._sum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zeroCount",{get:function(){return this._zeroCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this._count===this._zeroCount?0:this._mapping.scale},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"positive",{get:function(){return this._positive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"negative",{get:function(){return this._negative},enumerable:!1,configurable:!0}),e.prototype.updateByIncrement=function(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}},e.prototype.merge=function(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;var r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)},e.prototype.diff=function(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;var r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)},e.prototype.clone=function(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)},e.prototype._updateBuckets=function(t,r,n){var i=this._mapping.mapToIndex(r),o=!1,s=0,u=0;if(t.length===0?(t.indexStart=i,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):i<t.indexStart&&t.indexEnd-i>=this._maxSize?(o=!0,u=i,s=t.indexEnd):i>t.indexEnd&&i-t.indexStart>=this._maxSize&&(o=!0,u=t.indexStart,s=i),o){var l=this._changeScale(s,u);this._downscale(l),i=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,i,n)},e.prototype._incrementIndexBy=function(t,r,n){if(n!==0){if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){var i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){var i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}var o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}},e.prototype._grow=function(t,r){var n=t.backing.length,i=t.indexBase-t.indexStart,o=n-i,s=Mi(r);s>this._maxSize&&(s=this._maxSize);var u=s-i;t.backing.growTo(s,o,u)},e.prototype._changeScale=function(t,r){for(var n=0;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n},e.prototype._downscale=function(t){if(t!==0){if(t<0)throw new Error("impossible change of scale: "+this.scale);var r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=On(r)}},e.prototype._minScale=function(t){var r=Math.min(this.scale,t.scale),n=nr.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),i=nr.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(i.high,i.low))},e.prototype._highLowAtScale=function(t,r,n){if(t.length===0)return new nr(0,-1);var i=r-n;return new nr(t.indexStart>>i,t.indexEnd>>i)},e.prototype._mergeBuckets=function(t,r,n,i){for(var o=n.offset,s=r.scale-i,u=0;u<n.length;u++)this._incrementIndexBy(t,o+u>>s,n.at(u))},e.prototype._diffBuckets=function(t,r,n,i){for(var o=n.offset,s=r.scale-i,u=0;u<n.length;u++){var l=o+u>>s,a=l-t.indexBase;a<0&&(a+=t.backing.length),t.decrementBucket(a,n.at(u))}t.trim()},e})();var xn=(function(){function e(t,r){this._maxSize=t,this._recordMinMax=r,this.kind=w.EXPONENTIAL_HISTOGRAM}return e.prototype.createAccumulation=function(t){return new Di(t,this._maxSize,this._recordMinMax)},e.prototype.merge=function(t,r){var n=r.clone();return n.merge(t),n},e.prototype.diff=function(t,r){var n=r.clone();return n.diff(t),n},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:x.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(function(o){var s=Bc(o,2),u=s[0],l=s[1],a=l.toPointValue(),c=t.type===p.GAUGE||t.type===p.UP_DOWN_COUNTER||t.type===p.OBSERVABLE_GAUGE||t.type===p.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:u,startTime:l.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}},e})();var Fc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},or=(function(){function e(t,r,n){r===void 0&&(r=0),n===void 0&&(n=[0,0]),this.startTime=t,this._current=r,this.sampleTime=n}return e.prototype.record=function(t){this._current=t,this.sampleTime=D(Date.now())},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var Ln=(function(){function e(){this.kind=w.LAST_VALUE}return e.prototype.createAccumulation=function(t){return new or(t)},e.prototype.merge=function(t,r){var n=J(r.sampleTime)>=J(t.sampleTime)?r:t;return new or(t.startTime,n.toPointValue(),n.sampleTime)},e.prototype.diff=function(t,r){var n=J(r.sampleTime)>=J(t.sampleTime)?r:t;return new or(r.startTime,n.toPointValue(),n.sampleTime)},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:x.GAUGE,dataPoints:n.map(function(o){var s=Fc(o,2),u=s[0],l=s[1];return{attributes:u,startTime:l.startTime,endTime:i,value:l.toPointValue()}})}},e})();var kc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Rt=(function(){function e(t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1),this.startTime=t,this.monotonic=r,this._current=n,this.reset=i}return e.prototype.record=function(t){this.monotonic&&t<0||(this._current+=t)},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var ir=(function(){function e(t){this.monotonic=t,this.kind=w.SUM}return e.prototype.createAccumulation=function(t){return new Rt(t,this.monotonic)},e.prototype.merge=function(t,r){var n=t.toPointValue(),i=r.toPointValue();return r.reset?new Rt(r.startTime,this.monotonic,i,r.reset):new Rt(t.startTime,this.monotonic,n+i)},e.prototype.diff=function(t,r){var n=t.toPointValue(),i=r.toPointValue();return this.monotonic&&n>i?new Rt(r.startTime,this.monotonic,i,!0):new Rt(r.startTime,this.monotonic,i-n)},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:x.SUM,dataPoints:n.map(function(o){var s=kc(o,2),u=s[0],l=s[1];return{attributes:u,startTime:l.startTime,endTime:i,value:l.toPointValue()}}),isMonotonic:this.monotonic}},e})();var _t=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),P=(function(){function e(){}return e.Drop=function(){return ji},e.Sum=function(){return Ki},e.LastValue=function(){return Yi},e.Histogram=function(){return Xi},e.ExponentialHistogram=function(){return jc},e.Default=function(){return Kc},e})();var Gi=(function(e){_t(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new Tn,t})(P);var ae=(function(e){_t(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){switch(r.type){case p.COUNTER:case p.OBSERVABLE_COUNTER:case p.HISTOGRAM:return t.MONOTONIC_INSTANCE;default:return t.NON_MONOTONIC_INSTANCE}},t.MONOTONIC_INSTANCE=new ir(!0),t.NON_MONOTONIC_INSTANCE=new ir(!1),t})(P);var Bi=(function(e){_t(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new Ln,t})(P);var Vi=(function(e){_t(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new Ze([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0),t})(P);var Hi=(function(e){_t(t,e);function t(r,n){n===void 0&&(n=!0);var i=e.call(this)||this;if(i._recordMinMax=n,r==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");r=r.concat(),r=r.sort(function(u,l){return u-l});var o=r.lastIndexOf(-1/0),s=r.indexOf(1/0);return s===-1&&(s=void 0),i._boundaries=r.slice(o+1,s),i}return t.prototype.createAggregator=function(r){return new Ze(this._boundaries,this._recordMinMax)},t})(P);var Fi=(function(e){_t(t,e);function t(r,n){r===void 0&&(r=160),n===void 0&&(n=!0);var i=e.call(this)||this;return i._maxSize=r,i._recordMinMax=n,i}return t.prototype.createAggregator=function(r){return new xn(this._maxSize,this._recordMinMax)},t})(P);var ki=(function(e){_t(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._resolve=function(r){switch(r.type){case p.COUNTER:case p.UP_DOWN_COUNTER:case p.OBSERVABLE_COUNTER:case p.OBSERVABLE_UP_DOWN_COUNTER:return Ki;case p.GAUGE:case p.OBSERVABLE_GAUGE:return Yi;case p.HISTOGRAM:return r.advice.explicitBucketBoundaries?new Hi(r.advice.explicitBucketBoundaries):Xi}return _.warn("Unable to recognize instrument type: "+r.type),ji},t.prototype.createAggregator=function(r){return this._resolve(r).createAggregator(r)},t})(P);var ji=new Gi,Ki=new ae,Yi=new Bi,Xi=new Vi,jc=new Fi,Kc=new ki;var Wi=function(e){return P.Default()},zi=function(e){return A.CUMULATIVE};var Pn=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},bn=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},$i=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Yc=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Ji=(function(){function e(t){var r,n,i;this._shutdown=!1,this._aggregationSelector=(r=t?.aggregationSelector)!==null&&r!==void 0?r:Wi,this._aggregationTemporalitySelector=(n=t?.aggregationTemporalitySelector)!==null&&n!==void 0?n:zi,this._metricProducers=(i=t?.metricProducers)!==null&&i!==void 0?i:[],this._cardinalitySelector=t?.cardinalitySelector}return e.prototype.setMetricProducer=function(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()},e.prototype.selectAggregation=function(t){return this._aggregationSelector(t)},e.prototype.selectAggregationTemporality=function(t){return this._aggregationTemporalitySelector(t)},e.prototype.selectCardinalityLimit=function(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3},e.prototype.onInitialized=function(){},e.prototype.collect=function(t){return Pn(this,void 0,void 0,function(){var r,n,i,o,s,u;return bn(this,function(l){switch(l.label){case 0:if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");return[4,Promise.all(Yc([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis})],$i(this._metricProducers.map(function(a){return a.collect({timeoutMillis:t?.timeoutMillis})})),!1))];case 1:return r=$i.apply(void 0,[l.sent()]),n=r[0],i=r.slice(1),o=n.errors.concat(vn(i,function(a){return a.errors})),s=n.resourceMetrics.resource,u=n.resourceMetrics.scopeMetrics.concat(vn(i,function(a){return a.resourceMetrics.scopeMetrics})),[2,{resourceMetrics:{resource:s,scopeMetrics:u},errors:o}]}})})},e.prototype.shutdown=function(t){return Pn(this,void 0,void 0,function(){return bn(this,function(r){switch(r.label){case 0:return this._shutdown?(_.error("Cannot call shutdown twice."),[2]):t?.timeoutMillis!=null?[3,2]:[4,this.onShutdown()];case 1:return r.sent(),[3,4];case 2:return[4,q(this.onShutdown(),t.timeoutMillis)];case 3:r.sent(),r.label=4;case 4:return this._shutdown=!0,[2]}})})},e.prototype.forceFlush=function(t){return Pn(this,void 0,void 0,function(){return bn(this,function(r){switch(r.label){case 0:return this._shutdown?(_.warn("Cannot forceFlush on already shutdown MetricReader."),[2]):t?.timeoutMillis!=null?[3,2]:[4,this.onForceFlush()];case 1:return r.sent(),[2];case 2:return[4,q(this.onForceFlush(),t.timeoutMillis)];case 3:return r.sent(),[2]}})})},e})();h();var Xc=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ar=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},sr=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Wc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},zc=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Mn=(function(e){Xc(t,e);function t(r){var n,i,o,s,u=e.call(this,{aggregationSelector:(n=r.exporter.selectAggregation)===null||n===void 0?void 0:n.bind(r.exporter),aggregationTemporalitySelector:(i=r.exporter.selectAggregationTemporality)===null||i===void 0?void 0:i.bind(r.exporter),metricProducers:r.metricProducers})||this;if(r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<=0)throw Error("exportIntervalMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportTimeoutMillis<=0)throw Error("exportTimeoutMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<r.exportTimeoutMillis)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");return u._exportInterval=(o=r.exportIntervalMillis)!==null&&o!==void 0?o:6e4,u._exportTimeout=(s=r.exportTimeoutMillis)!==null&&s!==void 0?s:3e4,u._exporter=r.exporter,u}return t.prototype._runOnce=function(){return ar(this,void 0,void 0,function(){var r;return sr(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,q(this._doRun(),this._exportTimeout)];case 1:return n.sent(),[3,3];case 2:return r=n.sent(),r instanceof En?(_.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout),[2]):(Y(r),[3,3]);case 3:return[2]}})})},t.prototype._doRun=function(){var r,n;return ar(this,void 0,void 0,function(){var i,o,s,u,l,a;return sr(this,function(c){switch(c.label){case 0:return[4,this.collect({timeoutMillis:this._exportTimeout})];case 1:if(i=c.sent(),o=i.resourceMetrics,s=i.errors,s.length>0&&(a=_).error.apply(a,zc(["PeriodicExportingMetricReader: metrics collection errors"],Wc(s),!1)),!o.resource.asyncAttributesPending)return[3,5];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,(n=(r=o.resource).waitForAsyncAttributes)===null||n===void 0?void 0:n.call(r)];case 3:return c.sent(),[3,5];case 4:return u=c.sent(),_.debug("Error while resolving async portion of resource: ",u),Y(u),[3,5];case 5:return o.scopeMetrics.length===0?[2]:[4,Ke._export(this._exporter,o)];case 6:if(l=c.sent(),l.code!==O.SUCCESS)throw new Error("PeriodicExportingMetricReader: metrics export failed (error "+l.error+")");return[2]}})})},t.prototype.onInitialized=function(){var r=this;this._interval=setInterval(function(){r._runOnce()},this._exportInterval),lt(this._interval)},t.prototype.onForceFlush=function(){return ar(this,void 0,void 0,function(){return sr(this,function(r){switch(r.label){case 0:return[4,this._runOnce()];case 1:return r.sent(),[4,this._exporter.forceFlush()];case 2:return r.sent(),[2]}})})},t.prototype.onShutdown=function(){return ar(this,void 0,void 0,function(){return sr(this,function(r){switch(r.label){case 0:return this._interval&&clearInterval(this._interval),[4,this.onForceFlush()];case 1:return r.sent(),[4,this._exporter.shutdown()];case 2:return r.sent(),[2]}})})},t})(Ji);h();h();function ur(){return"unknown_service:"+process.argv0}var Q=function(){return Q=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Q.apply(this,arguments)},$c=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Jc=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},qc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},G=(function(){function e(t,r){var n=this,i;this._attributes=t,this.asyncAttributesPending=r!=null,this._syncAttributes=(i=this._attributes)!==null&&i!==void 0?i:{},this._asyncAttributesPromise=r?.then(function(o){return n._attributes=Object.assign({},n._attributes,o),n.asyncAttributesPending=!1,o},function(o){return _.debug("a resource's async attributes promise rejected: %s",o),n.asyncAttributesPending=!1,{}})}return e.empty=function(){return e.EMPTY},e.default=function(){var t;return new e((t={},t[zo]=ur(),t[qt]=ct[qt],t[Jt]=ct[Jt],t[Zt]=ct[Zt],t))},Object.defineProperty(e.prototype,"attributes",{get:function(){var t;return this.asyncAttributesPending&&_.error("Accessing resource attributes before async attributes settled"),(t=this._attributes)!==null&&t!==void 0?t:{}},enumerable:!1,configurable:!0}),e.prototype.waitForAsyncAttributes=function(){return $c(this,void 0,void 0,function(){return Jc(this,function(t){switch(t.label){case 0:return this.asyncAttributesPending?[4,this._asyncAttributesPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},e.prototype.merge=function(t){var r=this,n;if(!t)return this;var i=Q(Q({},this._syncAttributes),(n=t._syncAttributes)!==null&&n!==void 0?n:t.attributes);if(!this._asyncAttributesPromise&&!t._asyncAttributesPromise)return new e(i);var o=Promise.all([this._asyncAttributesPromise,t._asyncAttributesPromise]).then(function(s){var u,l=qc(s,2),a=l[0],c=l[1];return Q(Q(Q(Q({},r._syncAttributes),a),(u=t._syncAttributes)!==null&&u!==void 0?u:t.attributes),c)});return new e(i,o)},e.EMPTY=new e({}),e})();var qi=(function(){function e(){this._registeredViews=[]}return e.prototype.addView=function(t){this._registeredViews.push(t)},e.prototype.findViews=function(t,r){var n=this,i=this._registeredViews.filter(function(o){return n._matchInstrument(o.instrumentSelector,t)&&n._matchMeter(o.meterSelector,r)});return i},e.prototype._matchInstrument=function(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)},e.prototype._matchMeter=function(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))},e})();h();var pt=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),cr=(function(){function e(t,r){this._writableMetricStorage=t,this._descriptor=r}return e.prototype._record=function(t,r,n){if(r===void 0&&(r={}),n===void 0&&(n=I.active()),typeof t!="number"){_.warn("non-number value provided to metric "+this._descriptor.name+": "+t);return}this._descriptor.valueType===R.INT&&!Number.isInteger(t)&&(_.warn("INT value type cannot accept a floating-point value for "+this._descriptor.name+", ignoring the fractional digits."),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,D(Date.now()))},e})();var Zi=(function(e){pt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n,i){this._record(r,n,i)},t})(cr);var Qi=(function(e){pt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n,i){if(r<0){_.warn("negative value provided to counter "+this._descriptor.name+": "+r);return}this._record(r,n,i)},t})(cr);var ta=(function(e){pt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n,i){this._record(r,n,i)},t})(cr);var ea=(function(e){pt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n,i){if(r<0){_.warn("negative value provided to histogram "+this._descriptor.name+": "+r);return}this._record(r,n,i)},t})(cr);var lr=(function(){function e(t,r,n){this._observableRegistry=n,this._descriptor=t,this._metricStorages=r}return e.prototype.addCallback=function(t){this._observableRegistry.addCallback(t,this)},e.prototype.removeCallback=function(t){this._observableRegistry.removeCallback(t,this)},e})();var ra=(function(e){pt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(lr);var na=(function(e){pt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(lr);var oa=(function(e){pt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(lr);function se(e){return e instanceof lr}var ia=(function(){function e(t){this._meterSharedState=t}return e.prototype.createGauge=function(t,r){var n=k(t,p.GAUGE,r),i=this._meterSharedState.registerMetricStorage(n);return new ta(i,n)},e.prototype.createHistogram=function(t,r){var n=k(t,p.HISTOGRAM,r),i=this._meterSharedState.registerMetricStorage(n);return new ea(i,n)},e.prototype.createCounter=function(t,r){var n=k(t,p.COUNTER,r),i=this._meterSharedState.registerMetricStorage(n);return new Qi(i,n)},e.prototype.createUpDownCounter=function(t,r){var n=k(t,p.UP_DOWN_COUNTER,r),i=this._meterSharedState.registerMetricStorage(n);return new Zi(i,n)},e.prototype.createObservableGauge=function(t,r){var n=k(t,p.OBSERVABLE_GAUGE,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new na(n,i,this._meterSharedState.observableRegistry)},e.prototype.createObservableCounter=function(t,r){var n=k(t,p.OBSERVABLE_COUNTER,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new ra(n,i,this._meterSharedState.observableRegistry)},e.prototype.createObservableUpDownCounter=function(t,r){var n=k(t,p.OBSERVABLE_UP_DOWN_COUNTER,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new oa(n,i,this._meterSharedState.observableRegistry)},e.prototype.addBatchObservableCallback=function(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)},e.prototype.removeBatchObservableCallback=function(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)},e})();var fr=(function(){function e(t){this._instrumentDescriptor=t}return e.prototype.getInstrumentDescriptor=function(){return this._instrumentDescriptor},e.prototype.updateDescription=function(t){this._instrumentDescriptor=k(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})},e})();var Zc=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),aa=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Qc=(function(){function e(t){this._hash=t,this._valueMap=new Map,this._keyMap=new Map}return e.prototype.get=function(t,r){return r??(r=this._hash(t)),this._valueMap.get(r)},e.prototype.getOrDefault=function(t,r){var n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);var i=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,i),i},e.prototype.set=function(t,r,n){n??(n=this._hash(t)),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)},e.prototype.has=function(t,r){return r??(r=this._hash(t)),this._valueMap.has(r)},e.prototype.keys=function(){var t,r;return aa(this,function(n){switch(n.label){case 0:t=this._keyMap.entries(),r=t.next(),n.label=1;case 1:return r.done===!0?[3,3]:[4,[r.value[1],r.value[0]]];case 2:return n.sent(),r=t.next(),[3,1];case 3:return[2]}})},e.prototype.entries=function(){var t,r;return aa(this,function(n){switch(n.label){case 0:t=this._valueMap.entries(),r=t.next(),n.label=1;case 1:return r.done===!0?[3,3]:[4,[this._keyMap.get(r.value[0]),r.value[1],r.value[0]]];case 2:return n.sent(),r=t.next(),[3,1];case 3:return[2]}})},Object.defineProperty(e.prototype,"size",{get:function(){return this._valueMap.size},enumerable:!1,configurable:!0}),e})();var B=(function(e){Zc(t,e);function t(){return e.call(this,Je)||this}return t})(Qc);var tl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},_r=(function(){function e(t,r){this._aggregator=t,this._activeCollectionStorage=new B,this._cumulativeMemoStorage=new B,this._overflowAttributes={"otel.metric.overflow":!0},this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=Je(this._overflowAttributes)}return e.prototype.record=function(t,r,n,i){var o=this,s=this._activeCollectionStorage.get(r);if(!s){if(this._activeCollectionStorage.size>=this._cardinalityLimit){var u=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,function(){return o._aggregator.createAccumulation(i)});u?.record(t);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(r,s)}s?.record(t)},e.prototype.batchCumulate=function(t,r){var n=this;Array.from(t.entries()).forEach(function(i){var o=tl(i,3),s=o[0],u=o[1],l=o[2],a=n._aggregator.createAccumulation(r);a?.record(u);var c=a;if(n._cumulativeMemoStorage.has(s,l)){var f=n._cumulativeMemoStorage.get(s,l);c=n._aggregator.diff(f,a)}else if(n._cumulativeMemoStorage.size>=n._cardinalityLimit&&(s=n._overflowAttributes,l=n._overflowHashCode,n._cumulativeMemoStorage.has(s,l))){var f=n._cumulativeMemoStorage.get(s,l);c=n._aggregator.diff(f,a)}if(n._activeCollectionStorage.has(s,l)){var d=n._activeCollectionStorage.get(s,l);c=n._aggregator.merge(d,c)}n._cumulativeMemoStorage.set(s,a,l),n._activeCollectionStorage.set(s,c,l)})},e.prototype.collect=function(){var t=this._activeCollectionStorage;return this._activeCollectionStorage=new B,t},e})();var In=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},sa=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},pr=(function(){function e(t,r){var n=this;this._aggregator=t,this._unreportedAccumulations=new Map,this._reportHistory=new Map,r.forEach(function(i){n._unreportedAccumulations.set(i,[])})}return e.prototype.buildMetrics=function(t,r,n,i){this._stashAccumulations(n);var o=this._getMergedUnreportedAccumulations(t),s=o,u;if(this._reportHistory.has(t)){var l=this._reportHistory.get(t),a=l.collectionTime;u=l.aggregationTemporality,u===A.CUMULATIVE?s=e.merge(l.accumulations,o,this._aggregator):s=e.calibrateStartTime(l.accumulations,o,a)}else u=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:i,aggregationTemporality:u});var c=el(s);if(c.length!==0)return this._aggregator.toMetricData(r,u,c,i)},e.prototype._stashAccumulations=function(t){var r,n,i=this._unreportedAccumulations.keys();try{for(var o=In(i),s=o.next();!s.done;s=o.next()){var u=s.value,l=this._unreportedAccumulations.get(u);l===void 0&&(l=[],this._unreportedAccumulations.set(u,l)),l.push(t)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype._getMergedUnreportedAccumulations=function(t){var r,n,i=new B,o=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),o===void 0)return i;try{for(var s=In(o),u=s.next();!u.done;u=s.next()){var l=u.value;i=e.merge(i,l,this._aggregator)}}catch(a){r={error:a}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.merge=function(t,r,n){for(var i=t,o=r.entries(),s=o.next();s.done!==!0;){var u=sa(s.value,3),l=u[0],a=u[1],c=u[2];if(t.has(l,c)){var f=t.get(l,c),d=n.merge(f,a);i.set(l,d,c)}else i.set(l,a,c);s=o.next()}return i},e.calibrateStartTime=function(t,r,n){var i,o;try{for(var s=In(t.keys()),u=s.next();!u.done;u=s.next()){var l=sa(u.value,2),a=l[0],c=l[1],f=r.get(a,c);f?.setStartTime(n)}}catch(d){i={error:d}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return r},e})();function el(e){return Array.from(e.entries())}var rl=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),nl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ua=(function(e){rl(t,e);function t(r,n,i,o,s){var u=e.call(this,r)||this;return u._attributesProcessor=i,u._aggregationCardinalityLimit=s,u._deltaMetricStorage=new _r(n,u._aggregationCardinalityLimit),u._temporalMetricStorage=new pr(n,o),u}return t.prototype.record=function(r,n){var i=this,o=new B;Array.from(r.entries()).forEach(function(s){var u=nl(s,2),l=u[0],a=u[1];o.set(i._attributesProcessor.process(l),a)}),this._deltaMetricStorage.batchCumulate(o,n)},t.prototype.collect=function(r,n){var i=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,i,n)},t})(fr);h();function wn(e,t){var r="";return e.unit!==t.unit&&(r+=" - Unit '"+e.unit+"' does not match '"+t.unit+`'
|
|
4
|
+
`),e.type!==t.type&&(r+=" - Type '"+e.type+"' does not match '"+t.type+`'
|
|
5
|
+
`),e.valueType!==t.valueType&&(r+=" - Value Type '"+e.valueType+"' does not match '"+t.valueType+`'
|
|
6
|
+
`),e.description!==t.description&&(r+=" - Description '"+e.description+"' does not match '"+t.description+`'
|
|
7
|
+
`),r}function ol(e,t){return" - use valueType '"+e.valueType+"' on instrument creation or use an instrument name other than '"+t.name+"'"}function il(e,t){return" - use unit '"+e.unit+"' on instrument creation or use an instrument name other than '"+t.name+"'"}function al(e,t){var r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return" - create a new view with a name other than '"+e.name+"' and InstrumentSelector '"+n+"'"}function sl(e,t){var r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return" - create a new view with a name other than '"+e.name+"' and InstrumentSelector '"+n+`'
|
|
8
|
+
- OR - create a new view with the name `+e.name+" and description '"+e.description+"' and InstrumentSelector "+n+`
|
|
9
|
+
- OR - create a new view with the name `+t.name+" and description '"+e.description+"' and InstrumentSelector "+n}function Nn(e,t){return e.valueType!==t.valueType?ol(e,t):e.unit!==t.unit?il(e,t):e.type!==t.type?al(e,t):e.description!==t.description?sl(e,t):""}var Cn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ca=(function(){function e(){this._sharedRegistry=new Map,this._perCollectorRegistry=new Map}return e.create=function(){return new e},e.prototype.getStorages=function(t){var r,n,i,o,s=[];try{for(var u=Cn(this._sharedRegistry.values()),l=u.next();!l.done;l=u.next()){var a=l.value;s=s.concat(a)}}catch(T){r={error:T}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}var c=this._perCollectorRegistry.get(t);if(c!=null)try{for(var f=Cn(c.values()),d=f.next();!d.done;d=f.next()){var a=d.value;s=s.concat(a)}}catch(T){i={error:T}}finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}return s},e.prototype.register=function(t){this._registerStorage(t,this._sharedRegistry)},e.prototype.registerForCollector=function(t,r){var n=this._perCollectorRegistry.get(t);n==null&&(n=new Map,this._perCollectorRegistry.set(t,n)),this._registerStorage(r,n)},e.prototype.findOrUpdateCompatibleStorage=function(t){var r=this._sharedRegistry.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)},e.prototype.findOrUpdateCompatibleCollectorStorage=function(t,r){var n=this._perCollectorRegistry.get(t);if(n===void 0)return null;var i=n.get(r.name);return i===void 0?null:this._findOrUpdateCompatibleStorage(r,i)},e.prototype._registerStorage=function(t,r){var n=t.getInstrumentDescriptor(),i=r.get(n.name);if(i===void 0){r.set(n.name,[t]);return}i.push(t)},e.prototype._findOrUpdateCompatibleStorage=function(t,r){var n,i,o=null;try{for(var s=Cn(r),u=s.next();!u.done;u=s.next()){var l=u.value,a=l.getInstrumentDescriptor();Li(a,t)?(a.description!==t.description&&(t.description.length>a.description.length&&l.updateDescription(t.description),_.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
|
|
10
|
+
`,`Details:
|
|
11
|
+
`,wn(a,t),`The longer description will be used.
|
|
12
|
+
To resolve the conflict:`,Nn(a,t))),o=l):_.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
|
|
13
|
+
`,`Details:
|
|
14
|
+
`,wn(a,t),`To resolve the conflict:
|
|
15
|
+
`,Nn(a,t))}}catch(c){n={error:c}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return o},e})();var la=(function(){function e(t){this._backingStorages=t}return e.prototype.record=function(t,r,n,i){this._backingStorages.forEach(function(o){o.record(t,r,n,i)})},e})();h();h();var fa=(function(){function e(t,r){this._instrumentName=t,this._valueType=r,this._buffer=new B}return e.prototype.observe=function(t,r){if(r===void 0&&(r={}),typeof t!="number"){_.warn("non-number value provided to metric "+this._instrumentName+": "+t);return}this._valueType===R.INT&&!Number.isInteger(t)&&(_.warn("INT value type cannot accept a floating-point value for "+this._instrumentName+", ignoring the fractional digits."),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)},e})();var _a=(function(){function e(){this._buffer=new Map}return e.prototype.observe=function(t,r,n){if(n===void 0&&(n={}),!!se(t)){var i=this._buffer.get(t);if(i==null&&(i=new B,this._buffer.set(t,i)),typeof r!="number"){_.warn("non-number value provided to metric "+t._descriptor.name+": "+r);return}t._descriptor.valueType===R.INT&&!Number.isInteger(r)&&(_.warn("INT value type cannot accept a floating-point value for "+t._descriptor.name+", ignoring the fractional digits."),r=Math.trunc(r),!Number.isInteger(r))||i.set(n,r)}},e})();var Un=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Dn=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},pa=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},da=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},ha=(function(){function e(){this._callbacks=[],this._batchCallbacks=[]}return e.prototype.addCallback=function(t,r){var n=this._findCallback(t,r);n>=0||this._callbacks.push({callback:t,instrument:r})},e.prototype.removeCallback=function(t,r){var n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)},e.prototype.addBatchCallback=function(t,r){var n=new Set(r.filter(se));if(n.size===0){_.error("BatchObservableCallback is not associated with valid instruments",r);return}var i=this._findBatchCallback(t,n);i>=0||this._batchCallbacks.push({callback:t,instruments:n})},e.prototype.removeBatchCallback=function(t,r){var n=new Set(r.filter(se)),i=this._findBatchCallback(t,n);i<0||this._batchCallbacks.splice(i,1)},e.prototype.observe=function(t,r){return Un(this,void 0,void 0,function(){var n,i,o,s;return Dn(this,function(u){switch(u.label){case 0:return n=this._observeCallbacks(t,r),i=this._observeBatchCallbacks(t,r),[4,Si(da(da([],pa(n),!1),pa(i),!1))];case 1:return o=u.sent(),s=o.filter(yi).map(function(l){return l.reason}),[2,s]}})})},e.prototype._observeCallbacks=function(t,r){var n=this;return this._callbacks.map(function(i){var o=i.callback,s=i.instrument;return Un(n,void 0,void 0,function(){var u,l;return Dn(this,function(a){switch(a.label){case 0:return u=new fa(s._descriptor.name,s._descriptor.valueType),l=Promise.resolve(o(u)),r!=null&&(l=q(l,r)),[4,l];case 1:return a.sent(),s._metricStorages.forEach(function(c){c.record(u._buffer,t)}),[2]}})})})},e.prototype._observeBatchCallbacks=function(t,r){var n=this;return this._batchCallbacks.map(function(i){var o=i.callback,s=i.instruments;return Un(n,void 0,void 0,function(){var u,l;return Dn(this,function(a){switch(a.label){case 0:return u=new _a,l=Promise.resolve(o(u)),r!=null&&(l=q(l,r)),[4,l];case 1:return a.sent(),s.forEach(function(c){var f=u._buffer.get(c);f!=null&&c._metricStorages.forEach(function(d){d.record(f,t)})}),[2]}})})})},e.prototype._findCallback=function(t,r){return this._callbacks.findIndex(function(n){return n.callback===t&&n.instrument===r})},e.prototype._findBatchCallback=function(t,r){return this._batchCallbacks.findIndex(function(n){return n.callback===t&&Ai(n.instruments,r)})},e})();var ul=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ma=(function(e){ul(t,e);function t(r,n,i,o,s){var u=e.call(this,r)||this;return u._attributesProcessor=i,u._aggregationCardinalityLimit=s,u._deltaMetricStorage=new _r(n,u._aggregationCardinalityLimit),u._temporalMetricStorage=new pr(n,o),u}return t.prototype.record=function(r,n,i,o){n=this._attributesProcessor.process(n,i),this._deltaMetricStorage.record(r,n,i,o)},t.prototype.collect=function(r,n){var i=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,i,n)},t})(fr);var Ea=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),xt=(function(){function e(){}return e.Noop=function(){return ll},e})();var cl=(function(e){Ea(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.process=function(r,n){return r},t})(xt);var va=(function(e){Ea(t,e);function t(r){var n=e.call(this)||this;return n._allowedAttributeNames=r,n}return t.prototype.process=function(r,n){var i=this,o={};return Object.keys(r).filter(function(s){return i._allowedAttributeNames.includes(s)}).forEach(function(s){return o[s]=r[s]}),o},t})(xt);var ll=new cl;var fl=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},_l=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},pl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Ta=(function(){function e(t,r){this._meterProviderSharedState=t,this._instrumentationScope=r,this.metricStorageRegistry=new ca,this.observableRegistry=new ha,this.meter=new ia(this)}return e.prototype.registerMetricStorage=function(t){var r=this._registerMetricStorage(t,ma);return r.length===1?r[0]:new la(r)},e.prototype.registerAsyncMetricStorage=function(t){var r=this._registerMetricStorage(t,ua);return r},e.prototype.collect=function(t,r,n){return fl(this,void 0,void 0,function(){var i,o,s;return _l(this,function(u){switch(u.label){case 0:return[4,this.observableRegistry.observe(r,n?.timeoutMillis)];case 1:return i=u.sent(),o=this.metricStorageRegistry.getStorages(t),o.length===0?[2,null]:(s=o.map(function(l){return l.collect(t,r)}).filter(Ti),s.length===0?[2,{errors:i}]:[2,{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:i}])}})})},e.prototype._registerMetricStorage=function(t,r){var n=this,i=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope),o=i.map(function(l){var a=xi(l,t),c=n.metricStorageRegistry.findOrUpdateCompatibleStorage(a);if(c!=null)return c;var f=l.aggregation.createAggregator(a),d=new r(a,f,l.attributesProcessor,n._meterProviderSharedState.metricCollectors,l.aggregationCardinalityLimit);return n.metricStorageRegistry.register(d),d});if(o.length===0){var s=this._meterProviderSharedState.selectAggregations(t.type),u=s.map(function(l){var a=pl(l,2),c=a[0],f=a[1],d=n.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(c,t);if(d!=null)return d;var T=f.createAggregator(t),U=c.selectCardinalityLimit(t.type),ot=new r(t,T,xt.Noop(),[c],U);return n.metricStorageRegistry.registerForCollector(c,ot),ot});o=o.concat(u)}return o},e})();var dl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ga=(function(){function e(t){this.resource=t,this.viewRegistry=new qi,this.metricCollectors=[],this.meterSharedStates=new Map}return e.prototype.getMeterSharedState=function(t){var r=gi(t),n=this.meterSharedStates.get(r);return n==null&&(n=new Ta(this,t),this.meterSharedStates.set(r,n)),n},e.prototype.selectAggregations=function(t){var r,n,i=[];try{for(var o=dl(this.metricCollectors),s=o.next();!s.done;s=o.next()){var u=s.value;i.push([u,u.selectAggregation(t)])}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e})();var dr=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},hr=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},hl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ml=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Sa=(function(){function e(t,r){this._sharedState=t,this._metricReader=r}return e.prototype.collect=function(t){return dr(this,void 0,void 0,function(){var r,n,i,o,s=this;return hr(this,function(u){switch(u.label){case 0:return r=D(Date.now()),n=[],i=[],o=Array.from(this._sharedState.meterSharedStates.values()).map(function(l){return dr(s,void 0,void 0,function(){var a;return hr(this,function(c){switch(c.label){case 0:return[4,l.collect(this,r,t)];case 1:return a=c.sent(),a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&i.push.apply(i,ml([],hl(a.errors),!1)),[2]}})})}),[4,Promise.all(o)];case 1:return u.sent(),[2,{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:i}]}})})},e.prototype.forceFlush=function(t){return dr(this,void 0,void 0,function(){return hr(this,function(r){switch(r.label){case 0:return[4,this._metricReader.forceFlush(t)];case 1:return r.sent(),[2]}})})},e.prototype.shutdown=function(t){return dr(this,void 0,void 0,function(){return hr(this,function(r){switch(r.label){case 0:return[4,this._metricReader.shutdown(t)];case 1:return r.sent(),[2]}})})},e.prototype.selectAggregationTemporality=function(t){return this._metricReader.selectAggregationTemporality(t)},e.prototype.selectAggregation=function(t){return this._metricReader.selectAggregation(t)},e.prototype.selectCardinalityLimit=function(t){var r,n,i;return(i=(n=(r=this._metricReader).selectCardinalityLimit)===null||n===void 0?void 0:n.call(r,t))!==null&&i!==void 0?i:2e3},e})();var ya=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Aa=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Oa=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function El(e,t){var r=t??G.empty();return e?G.default().merge(r):r}var Gn=(function(){function e(t){var r,n,i,o,s;if(this._shutdown=!1,this._sharedState=new ga(El((s=t?.mergeResourceWithDefaults)!==null&&s!==void 0?s:!0,t?.resource)),t?.views!=null&&t.views.length>0)try{for(var u=Oa(t.views),l=u.next();!l.done;l=u.next()){var a=l.value;this._sharedState.viewRegistry.addView(a)}}catch(T){r={error:T}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}if(t?.readers!=null&&t.readers.length>0)try{for(var c=Oa(t.readers),f=c.next();!f.done;f=c.next()){var d=f.value;this.addMetricReader(d)}}catch(T){i={error:T}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}}return e.prototype.getMeter=function(t,r,n){return r===void 0&&(r=""),n===void 0&&(n={}),this._shutdown?(_.warn("A shutdown MeterProvider cannot provide a Meter"),qr()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter},e.prototype.addMetricReader=function(t){var r=new Sa(this._sharedState,t);t.setMetricProducer(r),this._sharedState.metricCollectors.push(r)},e.prototype.shutdown=function(t){return ya(this,void 0,void 0,function(){return Aa(this,function(r){switch(r.label){case 0:return this._shutdown?(_.warn("shutdown may only be called once per MeterProvider"),[2]):(this._shutdown=!0,[4,Promise.all(this._sharedState.metricCollectors.map(function(n){return n.shutdown(t)}))]);case 1:return r.sent(),[2]}})})},e.prototype.forceFlush=function(t){return ya(this,void 0,void 0,function(){return Aa(this,function(r){switch(r.label){case 0:return this._shutdown?(_.warn("invalid attempt to force flush after MeterProvider shutdown"),[2]):[4,Promise.all(this._sharedState.metricCollectors.map(function(n){return n.forceFlush(t)}))];case 1:return r.sent(),[2]}})})},e})();var vl=/[\^$\\.+?()[\]{}|]/g,mr=(function(){function e(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}return e.prototype.match=function(t){return this._matchAll?!0:this._regexp.test(t)},e.escapePattern=function(t){return"^"+t.replace(vl,"\\$&").replace("*",".*")+"$"},e.hasWildcard=function(t){return t.includes("*")},e})();var Lt=(function(){function e(t){this._matchAll=t===void 0,this._pattern=t}return e.prototype.match=function(t){return!!(this._matchAll||t===this._pattern)},e})();var Ra=(function(){function e(t){var r;this._nameFilter=new mr((r=t?.name)!==null&&r!==void 0?r:"*"),this._type=t?.type,this._unitFilter=new Lt(t?.unit)}return e.prototype.getType=function(){return this._type},e.prototype.getNameFilter=function(){return this._nameFilter},e.prototype.getUnitFilter=function(){return this._unitFilter},e})();var xa=(function(){function e(t){this._nameFilter=new Lt(t?.name),this._versionFilter=new Lt(t?.version),this._schemaUrlFilter=new Lt(t?.schemaUrl)}return e.prototype.getNameFilter=function(){return this._nameFilter},e.prototype.getVersionFilter=function(){return this._versionFilter},e.prototype.getSchemaUrlFilter=function(){return this._schemaUrlFilter},e})();function Tl(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}var Er=(function(){function e(t){var r;if(Tl(t))throw new Error("Cannot create view with no selector arguments supplied");if(t.name!=null&&(t?.instrumentName==null||mr.hasWildcard(t.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");t.attributeKeys!=null?this.attributesProcessor=new va(t.attributeKeys):this.attributesProcessor=xt.Noop(),this.name=t.name,this.description=t.description,this.aggregation=(r=t.aggregation)!==null&&r!==void 0?r:P.Default(),this.instrumentSelector=new Ra({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new xa({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}return e})();function gl(e,t){var r=Ye(t);return{resource:Xe(e.resource),schemaUrl:void 0,scopeMetrics:Sl(e.scopeMetrics,r)}}function Sl(e,t){return Array.from(e.map(function(r){return{scope:We(r.scope),metrics:r.metrics.map(function(n){return yl(n,t)}),schemaUrl:r.scope.schemaUrl}}))}function yl(e,t){var r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=xl(e.aggregationTemporality);switch(e.dataPointType){case x.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:La(e,t)};break;case x.GAUGE:r.gauge={dataPoints:La(e,t)};break;case x.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Ol(e,t)};break;case x.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Rl(e,t)};break}return r}function Al(e,t,r){var n={attributes:ne(e.attributes),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case R.INT:n.asInt=e.value;break;case R.DOUBLE:n.asDouble=e.value;break}return n}function La(e,t){return e.dataPoints.map(function(r){return Al(r,e.descriptor.valueType,t)})}function Ol(e,t){return e.dataPoints.map(function(r){var n=r.value;return{attributes:ne(r.attributes),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Rl(e,t){return e.dataPoints.map(function(r){var n=r.value;return{attributes:ne(r.attributes),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function xl(e){switch(e){case A.DELTA:return 1;case A.CUMULATIVE:return 2}}function Pa(e,t){return{resourceMetrics:e.map(function(r){return gl(r,t)})}}var vr={serializeRequest:function(e){var t=mi(e,{useHex:!0,useLongBits:!1}),r=new TextEncoder;return r.encode(JSON.stringify(t))},deserializeResponse:function(e){var t=new TextDecoder;return JSON.parse(t.decode(e))}};var Tr={serializeRequest:function(e){var t=Pa([e],{useLongBits:!1}),r=new TextEncoder;return r.encode(JSON.stringify(t))},deserializeResponse:function(e){var t=new TextDecoder;return JSON.parse(t.decode(e))}};var ba="0.57.2";var Il=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},wl=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Nl=(function(){function e(t){this._parameters=t,this._send=null,this._agent=null}return e.prototype.send=function(t,r){return Il(this,void 0,void 0,function(){var n,i,o,s=this;return wl(this,function(u){return this._send==null&&(n=(Da(),Ys(Ua)),i=n.sendWithHttp,o=n.createHttpAgent,this._agent=o(this._parameters.url,this._parameters.agentOptions),this._send=i),[2,new Promise(function(l){var a;(a=s._send)===null||a===void 0||a.call(s,s._parameters,s._agent,t,function(c){l(c)},r)})]})})},e.prototype.shutdown=function(){},e})();function Ga(e){return new Nl(e)}var Cl=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Ul=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Dl=5,Gl=1e3,Bl=5e3,Vl=1.5,Ba=.2;function Hl(){return Math.random()*(2*Ba)-Ba}var Fl=(function(){function e(t){this._transport=t}return e.prototype.retry=function(t,r,n){var i=this;return new Promise(function(o,s){setTimeout(function(){i._transport.send(t,r).then(o,s)},n)})},e.prototype.send=function(t,r){var n;return Cl(this,void 0,void 0,function(){var i,o,s,u,l,a,c;return Ul(this,function(f){switch(f.label){case 0:return i=Date.now()+r,[4,this._transport.send(t,r)];case 1:o=f.sent(),s=Dl,u=Gl,f.label=2;case 2:return o.status==="retryable"&&s>0?(s--,l=Math.max(Math.min(u,Bl)+Hl(),0),u=u*Vl,a=(n=o.retryInMillis)!==null&&n!==void 0?n:l,c=i-Date.now(),a>c?[2,o]:[4,this.retry(t,c,a)]):[3,4];case 3:return o=f.sent(),[3,2];case 4:return[2,o]}})})},e.prototype.shutdown=function(){return this._transport.shutdown()},e})();function Va(e){return new Fl(e.transport)}function ue(e,t){return li({transport:Va({transport:Ga(e)}),serializer:t,promiseHandler:ao(e)},{timeout:e.timeoutMillis})}h();function Ha(e){var t,r=(t=process.env[e])===null||t===void 0?void 0:t.trim();if(r!=null&&r!==""){var n=Number(r);if(!Number.isNaN(n)&&Number.isFinite(n)&&n>0)return n;_.warn("Configuration: "+e+" is invalid, expected number greater than 0 (actual: "+r+")")}}function kl(e){var t=Ha("OTEL_EXPORTER_OTLP_"+e+"_TIMEOUT"),r=Ha("OTEL_EXPORTER_OTLP_TIMEOUT");return t??r}function Fa(e){var t,r=(t=process.env[e])===null||t===void 0?void 0:t.trim();if(r!==""){if(r==null||r==="none"||r==="gzip")return r;_.warn("Configuration: "+e+" is invalid, expected 'none' or 'gzip' (actual: '"+r+"')")}}function jl(e){var t=Fa("OTEL_EXPORTER_OTLP_"+e+"_COMPRESSION"),r=Fa("OTEL_EXPORTER_OTLP_COMPRESSION");return t??r}function ka(e){return{timeoutMillis:kl(e),compression:jl(e)}}h();var Kl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function ja(e){return function(){var t,r={};return Object.entries((t=e?.())!==null&&t!==void 0?t:{}).forEach(function(n){var i=Kl(n,2),o=i[0],s=i[1];typeof s<"u"?r[o]=String(s):_.warn('Header "'+o+'" has invalid value ('+s+") and will be ignored")}),r}}var dt=function(){return dt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},dt.apply(this,arguments)};function Yl(e,t,r){var n=dt({},r()),i={};return function(){return t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,n)}}function Xl(e){if(e!=null)try{return new URL(e),e}catch{throw new Error("Configuration: Could not parse user-provided export URL: '"+e+"'")}}function Ka(e,t,r){var n,i,o,s;return dt(dt({},oo(e,t,r)),{headers:Yl(ja(e.headers),t.headers,r.headers),url:(i=(n=Xl(e.url))!==null&&n!==void 0?n:t.url)!==null&&i!==void 0?i:r.url,agentOptions:(s=(o=e.agentOptions)!==null&&o!==void 0?o:t.agentOptions)!==null&&s!==void 0?s:r.agentOptions})}function Ya(e,t){return dt(dt({},io()),{headers:function(){return e},url:"http://localhost:4318/"+t,agentOptions:{keepAlive:!0}})}h();var yr=function(){return yr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},yr.apply(this,arguments)};function Wl(e){var t,r,n=(t=process.env["OTEL_EXPORTER_OTLP_"+e+"_HEADERS"])===null||t===void 0?void 0:t.trim(),i=(r=process.env.OTEL_EXPORTER_OTLP_HEADERS)===null||r===void 0?void 0:r.trim(),o=re.parseKeyPairsIntoRecord(n),s=re.parseKeyPairsIntoRecord(i);if(!(Object.keys(o).length===0&&Object.keys(s).length===0))return Object.assign({},re.parseKeyPairsIntoRecord(i),re.parseKeyPairsIntoRecord(n))}function zl(e){try{var t=new URL(e);return t.toString()}catch{_.warn("Configuration: Could not parse environment-provided export URL: '"+e+"', falling back to undefined");return}}function $l(e,t){try{new URL(e)}catch{_.warn("Configuration: Could not parse environment-provided export URL: '"+e+"', falling back to undefined");return}e.endsWith("/")||(e=e+"/"),e+=t;try{new URL(e)}catch{_.warn("Configuration: Provided URL appended with '"+t+"' is not a valid URL, using 'undefined' instead of '"+e+"'");return}return e}function Jl(e){var t,r=(t=process.env.OTEL_EXPORTER_OTLP_ENDPOINT)===null||t===void 0?void 0:t.trim();if(!(r==null||r===""))return $l(r,e)}function ql(e){var t,r=(t=process.env["OTEL_EXPORTER_OTLP_"+e+"_ENDPOINT"])===null||t===void 0?void 0:t.trim();if(!(r==null||r===""))return zl(r)}function Xa(e,t){var r;return yr(yr({},ka(e)),{url:(r=ql(e))!==null&&r!==void 0?r:Jl(t),headers:ye(Wl(e))})}h();function Zl(e){return e?.keepAlive!=null&&(e.httpAgentOptions!=null?e.httpAgentOptions.keepAlive==null&&(e.httpAgentOptions.keepAlive=e.keepAlive):e.httpAgentOptions={keepAlive:e.keepAlive}),e.httpAgentOptions}function ce(e,t,r,n){return e.metadata&&_.warn("Metadata cannot be set when using http"),Ka({url:e.url,headers:ye(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentOptions:Zl(e)},Xa(t,r),Ya(n,r))}var Ql=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),le=(function(e){Ql(t,e);function t(r){return r===void 0&&(r={}),e.call(this,ue(ce(r,"LOGS","v1/logs",{"User-Agent":"OTel-OTLP-Exporter-JavaScript/"+ba,"Content-Type":"application/json"}),vr))||this}return t})(Ut);h();h();h();h();var tf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ef=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Wa=(function(){function e(t,r,n){this.attributes={},this.totalAttributesCount=0,this._isReadonly=!1;var i=n.timestamp,o=n.observedTimestamp,s=n.severityNumber,u=n.severityText,l=n.body,a=n.attributes,c=a===void 0?{}:a,f=n.context,d=Date.now();if(this.hrTime=Fe(i??d),this.hrTimeObserved=Fe(o??d),f){var T=st.getSpanContext(f);T&&at(T)&&(this.spanContext=T)}this.severityNumber=s,this.severityText=u,this.body=l,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this.setAttributes(c)}return Object.defineProperty(e.prototype,"severityText",{get:function(){return this._severityText},set:function(t){this._isLogRecordReadonly()||(this._severityText=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"severityNumber",{get:function(){return this._severityNumber},set:function(t){this._isLogRecordReadonly()||(this._severityNumber=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this._body},set:function(t){this._isLogRecordReadonly()||(this._body=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"droppedAttributesCount",{get:function(){return this.totalAttributesCount-Object.keys(this.attributes).length},enumerable:!1,configurable:!0}),e.prototype.setAttribute=function(t,r){return this._isLogRecordReadonly()?this:r===null?this:t.length===0?(_.warn("Invalid attribute key: "+t),this):!Ge(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(_.warn("Invalid attribute value set for key: "+t),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this.droppedAttributesCount===1&&_.warn("Dropping extra attributes."),this):(Ge(r)?this.attributes[t]=this._truncateToSize(r):this.attributes[t]=r,this))},e.prototype.setAttributes=function(t){var r,n;try{for(var i=tf(Object.entries(t)),o=i.next();!o.done;o=i.next()){var s=ef(o.value,2),u=s[0],l=s[1];this.setAttribute(u,l)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return this},e.prototype.setBody=function(t){return this.body=t,this},e.prototype.setSeverityNumber=function(t){return this.severityNumber=t,this},e.prototype.setSeverityText=function(t){return this.severityText=t,this},e.prototype._makeReadonly=function(){this._isReadonly=!0},e.prototype._truncateToSize=function(t){var r=this,n=this._logRecordLimits.attributeValueLengthLimit;return n<=0?(_.warn("Attribute value limit must be positive, got "+n),t):typeof t=="string"?this._truncateToLimitUtil(t,n):Array.isArray(t)?t.map(function(i){return typeof i=="string"?r._truncateToLimitUtil(i,n):i}):t},e.prototype._truncateToLimitUtil=function(t,r){return t.length<=r?t:t.substring(0,r)},e.prototype._isLogRecordReadonly=function(){return this._isReadonly&&_.warn("Can not execute the operation on emitted log record"),this._isReadonly},e})();var Vn=function(){return Vn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Vn.apply(this,arguments)},za=(function(){function e(t,r){this.instrumentationScope=t,this._sharedState=r}return e.prototype.emit=function(t){var r=t.context||I.active(),n=new Wa(this._sharedState,this.instrumentationScope,Vn({context:r},t));this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()},e})();function $a(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:F().OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:F().OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT},includeTraceContext:!0,mergeResourceWithDefaults:!0}}function Ja(e){var t,r,n,i,o,s,u=zt();return{attributeCountLimit:(n=(r=(t=e.attributeCountLimit)!==null&&t!==void 0?t:u.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT)!==null&&r!==void 0?r:u.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&n!==void 0?n:At,attributeValueLengthLimit:(s=(o=(i=e.attributeValueLengthLimit)!==null&&i!==void 0?i:u.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&o!==void 0?o:u.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&s!==void 0?s:yt}}var qa=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Za=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Qa=(function(){function e(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}return e.prototype.forceFlush=function(){return qa(this,void 0,void 0,function(){var t;return Za(this,function(r){switch(r.label){case 0:return t=this.forceFlushTimeoutMillis,[4,Promise.all(this.processors.map(function(n){return te(n.forceFlush(),t)}))];case 1:return r.sent(),[2]}})})},e.prototype.onEmit=function(t,r){this.processors.forEach(function(n){return n.onEmit(t,r)})},e.prototype.shutdown=function(){return qa(this,void 0,void 0,function(){return Za(this,function(t){switch(t.label){case 0:return[4,Promise.all(this.processors.map(function(r){return r.shutdown()}))];case 1:return t.sent(),[2]}})})},e})();var ts=(function(){function e(){}return e.prototype.forceFlush=function(){return Promise.resolve()},e.prototype.onEmit=function(t,r){},e.prototype.shutdown=function(){return Promise.resolve()},e})();var es=(function(){function e(t,r,n){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.loggers=new Map,this.registeredLogRecordProcessors=[],this.activeProcessor=new ts}return e})();var rf="unknown";function nf(e,t){var r=t??G.empty();return e?G.default().merge(r):r}var Hn=(function(){function e(t){t===void 0&&(t={});var r=mn({},$a(),t),n=nf(r.mergeResourceWithDefaults,t.resource);this._sharedState=new es(n,r.forceFlushTimeoutMillis,Ja(r.logRecordLimits)),this._shutdownOnce=new ee(this._shutdown,this)}return e.prototype.getLogger=function(t,r,n){if(this._shutdownOnce.isCalled)return _.warn("A shutdown LoggerProvider cannot provide a Logger"),Nt;t||_.warn("Logger requested without instrumentation scope name.");var i=t||rf,o=i+"@"+(r||"")+":"+(n?.schemaUrl||"");return this._sharedState.loggers.has(o)||this._sharedState.loggers.set(o,new za({name:i,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(o)},e.prototype.addLogRecordProcessor=function(t){this._sharedState.registeredLogRecordProcessors.length===0&&this._sharedState.activeProcessor.shutdown().catch(function(r){return _.error("Error while trying to shutdown current log record processor",r)}),this._sharedState.registeredLogRecordProcessors.push(t),this._sharedState.activeProcessor=new Qa(this._sharedState.registeredLogRecordProcessors,this._sharedState.forceFlushTimeoutMillis)},e.prototype.forceFlush=function(){return this._shutdownOnce.isCalled?(_.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()},e.prototype.shutdown=function(){return this._shutdownOnce.isCalled?(_.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()},e.prototype._shutdown=function(){return this._sharedState.activeProcessor.shutdown()},e})();var of=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Fn=(function(){function e(){}return e.prototype.export=function(t,r){this._sendLogRecords(t,r)},e.prototype.shutdown=function(){return Promise.resolve()},e.prototype._exportInfo=function(t){var r,n,i;return{resource:{attributes:t.resource.attributes},instrumentationScope:t.instrumentationScope,timestamp:J(t.hrTime),traceId:(r=t.spanContext)===null||r===void 0?void 0:r.traceId,spanId:(n=t.spanContext)===null||n===void 0?void 0:n.spanId,traceFlags:(i=t.spanContext)===null||i===void 0?void 0:i.traceFlags,severityText:t.severityText,severityNumber:t.severityNumber,body:t.body,attributes:t.attributes}},e.prototype._sendLogRecords=function(t,r){var n,i;try{for(var o=of(t),s=o.next();!s.done;s=o.next()){var u=s.value;console.dir(this._exportInfo(u),{depth:3})}}catch(l){n={error:l}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}r?.({code:O.SUCCESS})},e})();h();var af=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},sf=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},rs=(function(){function e(t,r){var n,i,o,s;this._exporter=t,this._finishedLogRecords=[];var u=F();this._maxExportBatchSize=(n=r?.maxExportBatchSize)!==null&&n!==void 0?n:u.OTEL_BLRP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=(i=r?.maxQueueSize)!==null&&i!==void 0?i:u.OTEL_BLRP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=(o=r?.scheduledDelayMillis)!==null&&o!==void 0?o:u.OTEL_BLRP_SCHEDULE_DELAY,this._exportTimeoutMillis=(s=r?.exportTimeoutMillis)!==null&&s!==void 0?s:u.OTEL_BLRP_EXPORT_TIMEOUT,this._shutdownOnce=new ee(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(_.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}return e.prototype.onEmit=function(t){this._shutdownOnce.isCalled||this._addToBuffer(t)},e.prototype.forceFlush=function(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()},e.prototype.shutdown=function(){return this._shutdownOnce.call()},e.prototype._shutdown=function(){return af(this,void 0,void 0,function(){return sf(this,function(t){switch(t.label){case 0:return this.onShutdown(),[4,this._flushAll()];case 1:return t.sent(),[4,this._exporter.shutdown()];case 2:return t.sent(),[2]}})})},e.prototype._addToBuffer=function(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())},e.prototype._flushAll=function(){var t=this;return new Promise(function(r,n){for(var i=[],o=Math.ceil(t._finishedLogRecords.length/t._maxExportBatchSize),s=0;s<o;s++)i.push(t._flushOneBatch());Promise.all(i).then(function(){r()}).catch(n)})},e.prototype._flushOneBatch=function(){var t=this;return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise(function(r,n){te(t._export(t._finishedLogRecords.splice(0,t._maxExportBatchSize)),t._exportTimeoutMillis).then(function(){return r()}).catch(n)})},e.prototype._maybeStartTimer=function(){var t=this;this._timer===void 0&&(this._timer=setTimeout(function(){t._flushOneBatch().then(function(){t._finishedLogRecords.length>0&&(t._clearTimer(),t._maybeStartTimer())}).catch(function(r){Y(r)})},this._scheduledDelayMillis),lt(this._timer))},e.prototype._clearTimer=function(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)},e.prototype._export=function(t){var r=this,n=function(){return Ke._export(r._exporter,t).then(function(o){var s;o.code!==O.SUCCESS&&Y((s=o.error)!==null&&s!==void 0?s:new Error("BatchLogRecordProcessor: log record export failed (status "+o+")"))}).catch(Y)},i=t.map(function(o){return o.resource}).filter(function(o){return o.asyncAttributesPending});return i.length===0?n():Promise.all(i.map(function(o){var s;return(s=o.waitForAsyncAttributes)===null||s===void 0?void 0:s.call(o)})).then(n,Y)},e})();var uf=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Pt=(function(e){uf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onShutdown=function(){},t})(rs);var fe={TARGET:"target",NAMESPACE:"namespace",ENV_NAME:"envname",HOST_IP:"net.host.ip",HOST_NAME:"net.host.name",HOST_PORT:"net.host.port",CONTAINER_NAME:"container.name",SET_NAME:"set.name",SERVICE_NAME:"service.name",SERVER_OWNER:"server.owner",TENANT_ID:"tps.tenant.id",CMDB_ID:"cmdb.module.id",LANGUAGE:"telemetry.sdk.language",SDK_NAME:"telemetry.sdk.name",SDK_VERSION:"telemetry.sdk.version"};var ns;(function(e){e.ClientStartedTotal="rpc_client_started_total",e.ClientHandledTotal="rpc_client_handled_total",e.ClientHandledSeconds="rpc_client_handled_seconds",e.ServerStartedTotal="rpc_server_started_total",e.ServerHandledTotal="rpc_server_handled_total",e.ServerHandledSeconds="rpc_server_handled_seconds"})(ns||(ns={}));var os;(function(e){e.ProcessCpuUsage="process_cpu_usage",e.ProcessResidentMemoryUsage="process_resident_memory_usage",e.ProcessNetworkInBytes="process_network_in_bytes",e.ProcessNetworkOutBytes="process_network_out_bytes",e.ProcessBlockReadBytes="process_block_read_bytes",e.ProcessBlockWriteBytes="process_block_write_bytes",e.ProcessContainerNum="process_container_num",e.ProcessGpuUsage="process_gpu_usage",e.ProcessVideoMemoryUsage="process_video_memory_usage",e.ProcessDiskUsage="process_disk_usage",e.ProcessTcpNum="process_tcp_num",e.ProcessUdpNum="process_udp_num",e.ProcessMaxFds="process_max_fds",e.ProcessOpenFds="process_open_fds",e.ProcessPidNum="process_pid_num",e.ProcessDiskFree="process_disk_free",e.ProcessDiskUsed="process_disk_used",e.ProcessDiskUsedFraction="process_disk_used_fraction",e.ProcessCpuCores="process_cpu_cores"})(os||(os={}));var y;(function(e){e.CallerService="caller_service",e.CallerMethod="caller_method",e.CallerConSetid="caller_con_setid",e.CallerServer="caller_server",e.CalleeServer="callee_server",e.CalleeService="callee_service",e.CalleeMethod="callee_method",e.CalleeConSetid="callee_con_setid",e.CallerGroup="caller_group",e.CodeType="code_type",e.Code="code",e.UserExt1="user_ext1",e.UserExt2="user_ext2",e.UserExt3="user_ext3",e.CalleeIp="callee_ip",e.CalleeContainer="callee_container",e.CallerIp="caller_ip",e.CallerContainer="caller_container"})(y||(y={}));var is;(function(e){e.clientMetrics="client_metrics",e.serverMetrics="server_metrics"})(is||(is={}));var b;(function(e){e.Target="target",e.EnvName="env_name",e.Namespace="namespace",e.ServiceName="service_name",e.ContainerName="container_name",e.Instance="instance",e.Version="version",e.ConSetid="con_setid"})(b||(b={}));var V;(function(e){e.Development="Development",e.Production="Production"})(V||(V={}));var tt;(function(e){e.Formal="formal",e.Test="test"})(tt||(tt={}));var Ar;(function(e){e.Webjs="webjs",e.Nodejs="nodejs"})(Ar||(Ar={}));var as="galileo";h();var cf="https://galileotelemetry.tencent.com/v1/metrics";var ss="https://galileotelemetry.tencent.com/v1/logs";var lf="https://galileotelemetry.tencent.com/v1/metrics";var ff="https://sg.tgalileo.com/v1/metrics";var _f="http://galileotelemetry.tencent.com:80/v1/metrics";var pf=e=>{try{let t=new URL(e).hostname.toLowerCase();if(t==="galileotelemetry.tencent.com")return"mainland-public";if(t==="sg.tgalileo.com"||t.endsWith(".sg.tgalileo.com"))return"singapore-public";if(t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com")return"singapore-intranet"}catch{}return"mainland-intranet"};var us=e=>{switch(pf(e)){case"mainland-public":return lf;case"singapore-public":return ff;case"singapore-intranet":return _f;default:return cf}},bt="0.3.12",cs="NodeStats",df=[y.UserExt1,y.UserExt2,y.UserExt3];var hf={[y.CallerService]:"",[y.CallerMethod]:"",[y.CallerConSetid]:"",[y.CallerServer]:"",[y.CallerGroup]:"",[y.CallerIp]:"",[y.CallerContainer]:"",[y.CalleeService]:"",[y.CalleeMethod]:"",[y.CalleeConSetid]:"",[y.CalleeServer]:"",[y.CalleeIp]:"",[y.CalleeContainer]:""};h();var _e;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(_e||(_e={}));h();var mf=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),kn=function(){return A.CUMULATIVE},ls=function(e){switch(e){case p.COUNTER:case p.OBSERVABLE_COUNTER:case p.GAUGE:case p.HISTOGRAM:case p.OBSERVABLE_GAUGE:return A.DELTA;case p.UP_DOWN_COUNTER:case p.OBSERVABLE_UP_DOWN_COUNTER:return A.CUMULATIVE}},fs=function(e){switch(e){case p.COUNTER:case p.HISTOGRAM:return A.DELTA;case p.GAUGE:case p.UP_DOWN_COUNTER:case p.OBSERVABLE_UP_DOWN_COUNTER:case p.OBSERVABLE_COUNTER:case p.OBSERVABLE_GAUGE:return A.CUMULATIVE}};function Ef(){var e=F(),t=e.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();return t==="cumulative"?kn:t==="delta"?ls:t==="lowmemory"?fs:(_.warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '"+e.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE+"', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead."),kn)}function vf(e){return e!=null?e===_e.DELTA?ls:e===_e.LOWMEMORY?fs:kn:Ef()}function Tf(e){return e?.aggregationPreference?e.aggregationPreference:function(t){return P.Default()}}var _s=(function(e){mf(t,e);function t(r,n){var i=e.call(this,r)||this;return i._aggregationSelector=Tf(n),i._aggregationTemporalitySelector=vf(n?.temporalityPreference),i}return t.prototype.selectAggregation=function(r){return this._aggregationSelector(r)},t.prototype.selectAggregationTemporality=function(r){return this._aggregationTemporalitySelector(r)},t})(Ut);var ps="0.57.2";var gf=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Or=function(){return Or=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Or.apply(this,arguments)},Sf={"User-Agent":"OTel-OTLP-Exporter-JavaScript/"+ps},pe=(function(e){gf(t,e);function t(r){return e.call(this,ue(ce(r??{},"METRICS","v1/metrics",Or(Or({},Sf),{"Content-Type":"application/json"})),Tr),r)||this}return t})(_s);var ds=e=>{let r=[new Mn({exporter:new pe({temporalityPreference:A.DELTA,url:e.addr,concurrencyLimit:30,compression:Gt.GZIP}),exportIntervalMillis:3e4,exportTimeoutMillis:2e4})],n=[new Er({instrumentName:"node_instrument_start",aggregation:new ae,instrumentType:p.COUNTER}),new Er({instrumentName:"node_instrument_end",aggregation:new ae,instrumentType:p.COUNTER})];return new Gn({resource:e.resource,views:n,readers:r})};var ms=(e,t,r)=>ds({resource:new G({[b.Target]:"PCG-123.galileo.otp",[b.ServiceName]:"galileo.otp",[b.Namespace]:V.Production,[b.EnvName]:e===V.Production?tt.Formal:t,[b.Version]:bt,[b.Instance]:"",[b.ContainerName]:"",[b.ConSetid]:""}),addr:r});var hs=function(){let e=new WeakSet;return function(t,r){if(r instanceof Error)return`Error.message: ${r.message}
|
|
16
|
+
Error.stack: ${r.stack}`;if(typeof r=="object"&&r!==null){if(e.has(r))return`[Circular ${t||"root"}]`;e.add(r)}return r}},Es=function(e){if(typeof e=="string")return e;try{return e instanceof Error?(JSON.stringify(e,hs())||"undefined").replace(/"/gim,""):JSON.stringify(e,hs())||"undefined"}catch(t){return`error happen when aegis stringify:
|
|
17
|
+
${t?.message}
|
|
18
|
+
${t?.stack}`}};var vs=()=>{var e;let t=st.getSpan(I.active());return((e=t?.spanContext())===null||e===void 0?void 0:e.traceFlags)===it.SAMPLED};var de;(function(e){e.trace="trace",e.debug="debug",e.info="info",e.warn="warn",e.error="error"})(de||(de={}));var Mt;(function(e){e[e.trace=1]="trace",e[e.debug=5]="debug",e[e.info=9]="info",e[e.warn=13]="warn",e[e.error=17]="error"})(Mt||(Mt={}));function yf(e){if(!e)return de.trace;if(typeof e=="string"){let t=e.toLowerCase();return Object.values(de).includes(t)?t:de.trace}return e}var Rr=class{constructor(t){var r;this.getResource=Ee=>{let{platform:Vs,serverName:Qn}=this;return new G({[b.Target]:`${Vs}.${Qn}`,[b.Namespace]:Ee,[fe.SERVICE_NAME]:`${Qn}`,[fe.SDK_NAME]:as,[fe.LANGUAGE]:Ar.Nodejs,[fe.SDK_VERSION]:bt})};let{env:n=tt.Test,namespace:i,app:o,server:s,attributes:u={},platform:l,logCollectorAddr:a=ss,enableLocalConsole:c=!1,enableConsole:f=!1,level:d,mustLogTraced:T=!1}=t,U=i===V.Production?tt.Formal:n,ot=us(a);this.platform=l,this.serverName=`${o}.${s}`,this.enableLocalConsole=c,this.enableConsole=f,this.mustLogTraced=T;let mt=(r=process.env)===null||r===void 0?void 0:r.GALILEO_LOG_LEVEL;if(this.currentLevel=yf(d||mt),!this.serverName)throw new Error("app and server are required");this.initLogRecorder(U,u),this.logger=this.initLogger(i,U,a),this.selfMeter=ms(i,U,ot).getMeter(cs,""),this.selfAttributes={SdkTarget:`${l}.${this.serverName}`,TargetNameSpace:i,ReportType:"log",Protocol:"",Kind:"",Status:""},this.nodeInstrumentStartCounter=this.selfMeter.createCounter("node_instrument_start",{valueType:R.INT}),this.nodeInstrumentEndCounter=this.selfMeter.createCounter("node_instrument_end",{valueType:R.INT});try{this.enableConsole&&this.overrideConsole()}catch{}}initLogRecorder(t,r){this.logRecorder={severityNumber:wt.INFO,severityText:"info",body:"",attributes:{...r,server:this.serverName,env:t},instrumentationScope:{name:"default",version:bt}}}updateLogRecorderAttributes(t){if(!t)throw new Error("attributes is required");this.logRecorder.attributes={...this.logRecorder.attributes,...t}}initLogger(t,r,n){let i=this.getResource(t),o=new Hn({resource:i}),s={url:n,headers:{"Content-Type":"application/json"},concurrencyLimit:30},u=new le(s),l=new Pt(u);return o.addLogRecordProcessor(l),this.enableLocalConsole&&t!==V.Production&&r!==tt.Formal&&o.addLogRecordProcessor(new Pt(new Fn)),o.getLogger("default",bt)}emit(t){this.logger.emit(t)}overrideConsole(){let t=console,r=this;["log","info","error","warn","debug","trace"].forEach(i=>{let o=t[i];console[i]=function(...s){try{let u=new Error().stack,l="";if(u){let a=u.split(`
|
|
19
|
+
`);a.length>2&&(l=a[2].trim())}if(l.includes("trpc-config-env"))return;if(!l.includes("galileo-node-sdk")){let a=s.map(c=>typeof c=="string"?c:Es(c)).join(" ");i==="log"?r.method("info",`[Console.log] ${a}`):r.method(i,`[Console.${i}] ${a}`)}}catch{}o.apply(t,s)}})}shouldLog(t){return Mt[t]>=Mt[this.currentLevel]}method(t,r,n){var i,o;this.nodeInstrumentStartCounter.add(1,{...this.selfAttributes});let s=t;if(!(s in Mt))throw new Error(`method [${s}] not found`);if(!(this.mustLogTraced&&vs())&&!this.shouldLog(s))return;let l=n&&!(!((i=Object.values(n))===null||i===void 0)&&i.some(T=>typeof T!="string")),a={},c=st.getSpan(I.active()),f=(o=c?.attributes)===null||o===void 0?void 0:o["http.user_agent"];f&&(a.user_agent=f);let d={...this.logRecorder,attributes:{...this.logRecorder.attributes,...a,...l?n:{}},severityNumber:Mt[s],severityText:s,body:r};this.nodeInstrumentEndCounter.add(1,{...this.selfAttributes,Status:"success"}),this.emit(d)}info(t,r){this.method("info",t,r)}error(t,r){this.method("error",t,r)}debug(t,r){this.method("debug",t,r)}trace(t,r){this.method("trace",t,r)}warn(t,r){this.method("warn",t,r)}sampledInfo(t,r){this.method("info",t,r)}};var Af=!0,Of={siboot:"",coboot:"https://galileotelemetry.tencent.com"};function Ts(e,t,r={platform:e==="coboot"?"ElectronApp":"Electron",app:e,server:"app_main"}){let n=Of[e];return{...r,namespace:t?V.Production:V.Development,env:t?"formal":"test",metricsCollectorAddr:`${n}/v1/metrics`,traceCollectorAddr:`${n}/v1/traces`,logCollectorAddr:`${n}/v1/logs`,enableRemoteConfig:!1}}function gs(e){return new Rr(e)}var jn=(e,t)=>e[t]?.trim()||void 0;function Rf(e,t=process.env){return{platform:jn(t,"CU_HEADLESS_GALILEO_PLATFORM")||(e==="coboot"?"ElectronApp":"Electron"),app:jn(t,"CU_HEADLESS_GALILEO_APP")||e,server:jn(t,"CU_HEADLESS_GALILEO_SERVER")||"app_main"}}function Ss(e,t,r=process.env){return{...Ts(e,t,Rf(e,r)),enableHTTP:!1,enableTRPC:!1,enableFetch:!1,traceConfig:{enable:!1,processor:{sampler:{fraction:0,enableRandomSample:!1,enableParentSample:!1},enableTraceBody:!1}}}}var As=16384,bf=15100,Mf=/(?:^|\s)(event|level|run_id|daemon_pid|pid|start_count|retry_ms|duration_ms|stopping|exit_signal|job_id|type|version|from_version|target_version|phase|exit_code)=([^\s]+)/g;function Os(e){return ve(e.replace(/https?:\/\/[^\s"'<>]+/gi,t=>{try{let r=new URL(t);return r.username="",r.password="",r.search="",r.hash="",r.toString()}catch{return"[redacted-url]"}}).replace(/\b(signature|sign|HEADLESS_DEVICE_TOKEN)\s*[:=]\s*[^\s,;]+/gi,"$1=[redacted]"))}function If(e){return/^\S+ \[daemon\] /.test(e)||e.startsWith("[daemon]")?"daemon":/^\S+ \[anydev-update\] /.test(e)?"update":"startup"}function wf(e){if(!e.SIBOOT_BASE_DIR)return e.APP_VERSION||"unknown";try{return JSON.parse(xf.readFileSync(Lf.join(e.SIBOOT_BASE_DIR,"current/manifest.json"),"utf8")).version||e.APP_VERSION||"unknown"}catch{return e.APP_VERSION||"unknown"}}function Nf(e,t,r,n){let i={clientType:r.CLIENT_TYPE||"anydev",hostname:r.HOSTNAME||ys.hostname(),device_id:r.HOSTNAME||ys.hostname(),uid:r.CLIENT_UID||r.ANY_USERNAME||"",log_source:n,stream:t,version:wf(r)};for(let s of e.matchAll(Mf))i[s[1]]=s[2];return{level:i.level==="error"||t==="stderr"||i.level!=="info"&&/\b(failed|error|missing|job_failed)\b/i.test(e)?"error":"info",body:Os(e),attributes:Object.fromEntries(Object.entries(i).map(([s,u])=>[s,Os(u)]))}}var xr=class{constructor(t){this.env=t;let r=Ss("coboot",!(t.BACKEND_URL||"").includes("testsite"),{});this.logger=gs({...r,enableConsole:!1,enableLocalConsole:!1})}logger;lastRecordAt=0;closing;record(t,r,n=If(t)){if(!t.trim()||this.closing)return;let i=Nf(t,r,this.env,n);to(this.logger,i.level,i.body,i.attributes),this.lastRecordAt=Date.now()}close(){let t=this.lastRecordAt?Math.max(0,bf-(Date.now()-this.lastRecordAt)):0;return this.closing??=new Promise(r=>setTimeout(r,t)),this.closing}};function Rs(e){let t=new Pf("utf8"),r="",n=!1,i=o=>{for(let s of o.split(/(?<=\n)/))n||(r+=s,r.length>As&&(r=r.slice(0,As),n=!0)),s.endsWith(`
|
|
20
|
+
`)&&(e(r.trimEnd()),r="",n=!1)};return{write:o=>i(t.write(o)),end:()=>{i(t.end()),r&&e(r),r=""}}}function xs(e){if(process.env.ANYDEV_LOG_CAPTURED==="1"||e==="startup"&&process.argv.slice(2).includes("logs"))return()=>Promise.resolve();let t=new xr(process.env),r=["stdout","stderr"].map(o=>{let s=process[o],u=s.write.bind(s),l=Rs(a=>t.record(a,o,e));return s.write=(a,c,f)=>(l.write(typeof a=="string"?Buffer.from(a,typeof c=="string"?c:void 0):Buffer.from(a)),typeof c=="function"?u(a,c):u(a,c,f)),{lines:l,stream:s,original:u}}),n,i=()=>{if(!n){for(let{lines:o,stream:s,original:u}of r)s.write=u,o.end();n=t.close()}return n};return process.once("beforeExit",()=>{i()}),i}import v from"fs";import Cf from"net";import Uf from"os";import E from"path";import{spawn as Cr}from"child_process";var Ir=xs("daemon"),C=process.env.SIBOOT_BASE_DIR,z=E.join(C,"current"),wr=process.env.WORKSPACE||"/data/siboot/workspace",nt=E.join(C,"run"),et=E.join(C,"logs"),ht=E.join(z,"entry.mjs"),Nr=E.join(C,"electron-headless-host"),Ls=E.join(C,"scripts","fetch-electron-headless-host.sh"),Lr=E.join(C,"scripts","updater.mjs"),Cs=E.join(nt,"daemon.pid"),Ps=E.join(nt,"node.pid"),bs=E.join(nt,"updater.pid"),Df=E.join(nt,"status.json"),Us=73,Gf=5e3,Bf=3e4,Xn=Number.parseInt(process.env.ANYDEV_CLIENT_RESTART_DELAY_MS||"1000",10),Ms=Number.parseInt(process.env.ANYDEV_UPDATER_RESTART_DELAY_MS||"10000",10),Kn=Number.parseInt(process.env.ANYDEV_LOG_RETENTION_DAYS||"4",10),N=null,X=null,It=null,L=!1,he=0,Wn=0,Pr=!1,br=null,Mr=null,rt=0,zn=null,Vf=new Date().toISOString(),Hf=`${process.pid}-${Date.now()}`,Ff={siboot:{path:"\0siboot-anydev-daemon-v1",port:43880},coboot:{path:"\0coboot-anydev-daemon-v1",port:43882}};function kf(){let e=process.env.CU_EDITION==="coboot"?"coboot":"siboot",t=Ff[e];return process.platform==="linux"?{path:t.path}:{host:"127.0.0.1",port:t.port,exclusive:!0}}async function jf(){let e=Cf.createServer(r=>r.destroy()),t=kf();await new Promise((r,n)=>{e.once("error",n),e.listen(t,()=>{e.removeListener("error",n),r()})})}function Kf(){for(let e of[nt,wr,E.join(et,"daemon"),E.join(et,"client"),E.join(et,"update")])v.mkdirSync(e,{recursive:!0})}function Yf(){return new Date().toISOString().slice(0,10)}function $n(e){return E.join(et,e,`${Yf()}.log`)}function Xf(e,t){let r=`${new Date().toISOString()} [${e}] ${t}
|
|
21
|
+
`;(e!=="daemon"||!Wf($n(e)))&&v.appendFile($n(e),r,()=>{}),e==="daemon"&&process.stdout.write(r)}function Wf(e){try{let t=v.fstatSync(process.stdout.fd),r=v.statSync(e);return t.isFile()&&t.dev===r.dev&&t.ino===r.ino}catch{return!1}}function S(e,t,r="info"){Xf("daemon",`event=${e} level=${r} run_id=${Hf} daemon_pid=${process.pid} ${t}`)}function Ds(e){try{return JSON.parse(v.readFileSync(e,"utf8"))}catch{return null}}function zf(e,t){v.mkdirSync(E.dirname(e),{recursive:!0}),v.writeFileSync(e,JSON.stringify(t,null,2),"utf8")}function $f(e){try{v.unlinkSync(e)}catch{}}function qn(e,t){if(t)try{v.readFileSync(e,"utf8").trim()===String(t)&&v.unlinkSync(e)}catch(r){r.code!=="ENOENT"&&S("pid_cleanup_failed",`pid cleanup failed file=${e} error=${r.message}`,"error")}}function me(){let e=Ds(E.join(z,"manifest.json"));if(typeof e?.version=="string"&&e.version.trim())return e.version.trim();try{return E.basename(v.realpathSync(z))}catch{return process.env.APP_VERSION||"unknown"}}function Jf(){let e=process.env.HEADLESS_DEVICE_CREDENTIAL_PATH||process.env.SIBOOT_DEVICE_CREDENTIAL_PATH;if(e&&e.trim())return E.resolve(e.trim());let t=process.env.HEADLESS_DATA_DIR||process.env.SIBOOT_DATA_DIR||E.join(Uf.homedir(),process.env.CU_EDITION==="coboot"?".coboot":".siboot");return E.join(t,"headless-device-credential.json")}function qf(){try{return v.existsSync(Jf())}catch{return!1}}function W(e={}){zf(Df,{pid:process.pid,client_pid:N?.pid||null,updater_pid:X?.pid||null,client_ready:Pr,client_ready_at:br,client_version:Mr,client_lock_conflict_count:rt,client_retry_at:zn,client_start_count:he,updater_start_count:Wn,version:me(),current_dir:z,state:L?"stopping":rt>0?"client_lock_conflict":"running",started_at:Vf,updated_at:new Date().toISOString(),...e})}function Zn(e,t){let r=n=>{let i=Buffer.from(n);v.appendFile($n(t),i,()=>{})};e.stdout?.on("data",r),e.stderr?.on("data",r)}function Is(){if(!Number.isFinite(Kn)||Kn<=0)return;let e=Date.now();for(let t of["daemon","client","update"]){let r=E.join(et,t);if(v.existsSync(r))for(let n of v.readdirSync(r)){let i=E.join(r,n),o=null;try{o=v.statSync(i)}catch{continue}if(!o.isFile())continue;e-o.mtimeMs>Kn*24*60*60*1e3&&$f(i)}}}function Gs(){let e=E.join(Nr,"electron-headless-host"),t=v.existsSync(E.join(e,"electron-host-app","main","entry.js"))?e:z,r=E.join(t,"electron-host-app","main","entry.js"),n=E.join(t,"patches","electron","v32.3.3","runtime.json"),i={CU_ELECTRON_RUNTIME_CACHE:process.env.CU_ELECTRON_RUNTIME_CACHE||E.join(C,"electron-runtime"),HEADLESS:process.env.HEADLESS||"true"};return process.platform==="linux"&&(process.getuid?.()===0||process.env.ELECTRON_NO_SANDBOX==="1")&&(i.ELECTRON_NO_SANDBOX="1"),v.existsSync(n)&&(i.CU_APP_DESKTOP_ROOT=t),v.existsSync(r)&&(i.ELECTRON_HEADLESS_APP_PATH=r),i}function Zf(){let e=Ds(E.join(z,"manifest.json"));return String(process.env.ELECTRON_HOST_CDN_BASE||e?.electron_host_cdn_base||"").trim()}function ws(){return v.existsSync(E.join(Nr,"electron-headless-host","electron-host-app","main","entry.js"))&&v.existsSync(E.join(Nr,"electron-headless-host","patches","electron","v32.3.3","runtime.json"))}async function Qf(){if(ws())return!0;let e=Zf();if(!e||!v.existsSync(Ls))return S("electron_host_unavailable","electron host bundle is not configured; continuing without browser host"),!1;S("electron_host_download_start",`downloading electron host bundle base=${e}`),await new Promise((r,n)=>{let i=Cr("bash",[Ls],{env:{...process.env,ELECTRON_HOST_CDN_BASE:e,ELECTRON_HOST_FETCH_DIR:Nr},stdio:["ignore","pipe","pipe"]});Zn(i,"electron-host"),i.once("error",n),i.once("exit",o=>{o===0?r():n(new Error(`electron host bundle fetch exited with code=${o}`))})});let t=ws();return t||S("electron_host_invalid","electron host bundle missing required files after download","error"),t}function t_(e){It||process.env.HEADLESS_PREWARM_ELECTRON_RUNTIME==="0"||!v.existsSync(ht)||!e.ELECTRON_HEADLESS_APP_PATH||e.CU_APP_DESKTOP_ROOT&&(S("electron_prewarm_start",`prewarming patched electron runtime entry=${ht}`),It=Cr(process.execPath,[ht,"--prewarm-electron-runtime"],{cwd:wr,env:e,stdio:["ignore","pipe","pipe"]}),Zn(It,"client"),It.on("exit",(t,r)=>{S("electron_prewarm_exit",`electron runtime prewarm exited exit_code=${t} exit_signal=${r}`,t!==0&&!L?"error":"info"),It=null}))}function Jn(){if(L||N)return;if(!v.existsSync(ht)){S("client_entry_missing",`client entry missing entry=${ht} retry_ms=${Xn}`,"error"),W({state:"client_entry_missing"}),setTimeout(Jn,Xn).unref?.();return}he+=1,Pr=!1,br=null,Mr=me(),zn=null;let e={...process.env,...Gs(),APP_VERSION:Mr,CLIENT_TYPE:process.env.CLIENT_TYPE||"anydev",SIBOOT_BASE_DIR:C,SIBOOT_CURRENT_DIR:z,SIBOOT_RUN_DIR:nt,SIBOOT_LOG_DIR:et};qf()&&(delete e.HEADLESS_DEVICE_TOKEN,delete process.env.HEADLESS_DEVICE_TOKEN);let t=Date.now();S("client_start",`starting client entry=${ht} cwd=${wr} version=${me()} start_count=${he}`),N=Cr(process.execPath,[ht],{cwd:wr,env:e,stdio:["ignore","pipe","pipe","ipc"]});let r=N;v.writeFileSync(Ps,String(N.pid)),Zn(N,"client"),W(),N.on("message",n=>{n?.type!=="headless-client-ready"||N!==r||(rt>0&&S("client_lock_recovered",`client lock recovered conflicts=${rt} pid=${r.pid}`),rt=0,Pr=!0,br=new Date().toISOString(),W(),S("client_ready",`client ready pid=${r.pid} start_count=${he} duration_ms=${Date.now()-t}`))}),N.on("error",n=>{S("client_spawn_failed",`client spawn error error=${n.message}`,"error")}),N.on("exit",(n,i)=>{let o=e_(n);S("client_exit",`client exited pid=${r.pid} exit_code=${n} exit_signal=${i} stopping=${L} start_count=${he} retry_ms=${L?0:o}`,!L&&n!==0?"error":"info"),N=null,Pr=!1,br=null,Mr=null,qn(Ps,r.pid),zn=L?null:new Date(Date.now()+o).toISOString(),W({client_exit_code:n,client_exit_signal:i}),L||setTimeout(Jn,o).unref?.()})}function e_(e){return e!==Us?Xn:(rt+=1,rt===1&&S("client_lock_conflict","client lock conflict; retrying with bounded backoff"),Math.min(Gf*2**Math.min(rt-1,3),Bf))}function Bs(){if(L||X||process.env.ANYDEV_UPDATE_ENABLED==="0")return;if(!v.existsSync(Lr)){S("updater_entry_missing",`updater entry missing entry=${Lr}`,"error");return}Wn+=1,S("updater_start",`starting updater entry=${Lr} start_count=${Wn}`),X=Cr(process.execPath,[Lr],{cwd:C,env:{...process.env,CLIENT_TYPE:"anydev",SIBOOT_BASE_DIR:C,SIBOOT_CURRENT_DIR:z,SIBOOT_RUN_DIR:nt,SIBOOT_LOG_DIR:et},stdio:["ignore","inherit","inherit"]});let e=X;v.writeFileSync(bs,String(X.pid)),W(),X.on("error",t=>{S("updater_spawn_failed",`updater spawn error error=${t.message}`,"error")}),X.on("exit",(t,r)=>{S("updater_exit",`updater exited pid=${e.pid} exit_code=${t} exit_signal=${r} stopping=${L} retry_ms=${L?0:Ms}`,!L&&t!==0?"error":"info"),X=null,qn(bs,e.pid),W({updater_exit_code:t,updater_exit_signal:r}),L||setTimeout(Bs,Ms).unref?.()})}function Yn(e,t){return e?.pid?(S("child_stop",`stopping ${t} pid=${e.pid}`),new Promise(r=>{let n=!1,i=()=>{n||(n=!0,r())};e.once("exit",i);try{e.kill("SIGTERM")}catch{i();return}setTimeout(()=>{if(!n){S("child_kill_timeout",`child did not stop within 5000ms child=${t} pid=${e.pid}`,"error");try{e.kill("SIGKILL")}catch{}i()}},5e3).unref?.()})):Promise.resolve()}async function Ns(e){L||(L=!0,S("daemon_shutdown",`shutdown exit_signal=${e}`),W({state:"stopping",signal:e}),await Promise.all([Yn(X,"updater"),Yn(N,"client"),Yn(It,"electron-runtime-prewarm")]),qn(Cs,process.pid),W({state:"stopped",signal:e}),typeof Ir<"u"&&await Ir(),process.exit(0))}async function r_(){await jf(),Kf(),v.writeFileSync(Cs,String(process.pid)),process.on("SIGTERM",()=>{Ns("SIGTERM")}),process.on("SIGINT",()=>{Ns("SIGINT")}),S("daemon_start",`started base=${C} version=${me()}`),W({state:"starting"}),Is();try{await Qf()}catch(t){S("electron_host_fetch_failed",`electron host bundle fetch failed: ${t.message}`,"error")}let e={...process.env,...Gs(),APP_VERSION:me(),CLIENT_TYPE:process.env.CLIENT_TYPE||"anydev",SIBOOT_BASE_DIR:C,SIBOOT_CURRENT_DIR:z,SIBOOT_RUN_DIR:nt,SIBOOT_LOG_DIR:et};t_(e),Jn(),Bs(),setInterval(Is,3600*1e3)}r_().catch(async e=>{let t=e.code==="EADDRINUSE";process.stderr.write(`[daemon] ${t?"another daemon is already running":e.message}
|
|
22
|
+
`),typeof Ir<"u"&&await Ir(),process.exit(t?Us:1)});
|