@bitrix24/b24jssdk 0.5.1 → 1.0.2
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-AI.md +2 -1
- package/dist/esm/_virtual/_commonjsHelpers.mjs +16 -0
- package/dist/esm/_virtual/_commonjsHelpers.mjs.map +1 -0
- package/dist/esm/_virtual/protobuf.mjs +16 -0
- package/dist/esm/_virtual/protobuf.mjs.map +1 -0
- package/dist/esm/_virtual/protobuf2.mjs +12 -0
- package/dist/esm/_virtual/protobuf2.mjs.map +1 -0
- package/dist/esm/core/abstract-b24.mjs +355 -0
- package/dist/esm/core/abstract-b24.mjs.map +1 -0
- package/dist/esm/core/actions/abstract-action.mjs +24 -0
- package/dist/esm/core/actions/abstract-action.mjs.map +1 -0
- package/dist/esm/core/actions/abstract-batch.mjs +95 -0
- package/dist/esm/core/actions/abstract-batch.mjs.map +1 -0
- package/dist/esm/core/actions/manager.mjs +53 -0
- package/dist/esm/core/actions/manager.mjs.map +1 -0
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs +92 -0
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs.map +1 -0
- package/dist/esm/core/actions/v2/batch.mjs +126 -0
- package/dist/esm/core/actions/v2/batch.mjs.map +1 -0
- package/dist/esm/core/actions/v2/call-list.mjs +131 -0
- package/dist/esm/core/actions/v2/call-list.mjs.map +1 -0
- package/dist/esm/core/actions/v2/call.mjs +68 -0
- package/dist/esm/core/actions/v2/call.mjs.map +1 -0
- package/dist/esm/core/actions/v2/fetch-list.mjs +132 -0
- package/dist/esm/core/actions/v2/fetch-list.mjs.map +1 -0
- package/dist/esm/core/actions/v2/manager-v2.mjs +74 -0
- package/dist/esm/core/actions/v2/manager-v2.mjs.map +1 -0
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs +91 -0
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs.map +1 -0
- package/dist/esm/core/actions/v3/batch.mjs +129 -0
- package/dist/esm/core/actions/v3/batch.mjs.map +1 -0
- package/dist/esm/core/actions/v3/call-list.mjs +127 -0
- package/dist/esm/core/actions/v3/call-list.mjs.map +1 -0
- package/dist/esm/core/actions/v3/call.mjs +58 -0
- package/dist/esm/core/actions/v3/call.mjs.map +1 -0
- package/dist/esm/core/actions/v3/fetch-list.mjs +125 -0
- package/dist/esm/core/actions/v3/fetch-list.mjs.map +1 -0
- package/dist/esm/core/actions/v3/manager-v3.mjs +74 -0
- package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -0
- package/dist/esm/core/http/abstract-http.mjs +563 -0
- package/dist/esm/core/http/abstract-http.mjs.map +1 -0
- package/dist/esm/core/http/ajax-error.mjs +107 -0
- package/dist/esm/core/http/ajax-error.mjs.map +1 -0
- package/dist/esm/core/http/ajax-result.mjs +176 -0
- package/dist/esm/core/http/ajax-result.mjs.map +1 -0
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs +135 -0
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs.map +1 -0
- package/dist/esm/core/http/limiters/manager.mjs +309 -0
- package/dist/esm/core/http/limiters/manager.mjs.map +1 -0
- package/dist/esm/core/http/limiters/operating-limiter.mjs +171 -0
- package/dist/esm/core/http/limiters/operating-limiter.mjs.map +1 -0
- package/dist/esm/core/http/limiters/params-factory.mjs +121 -0
- package/dist/esm/core/http/limiters/params-factory.mjs.map +1 -0
- package/dist/esm/core/http/limiters/rate-limiter.mjs +402 -0
- package/dist/esm/core/http/limiters/rate-limiter.mjs.map +1 -0
- package/dist/esm/core/http/v2.mjs +100 -0
- package/dist/esm/core/http/v2.mjs.map +1 -0
- package/dist/esm/core/http/v3.mjs +94 -0
- package/dist/esm/core/http/v3.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +69 -0
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/parse-row.mjs +67 -0
- package/dist/esm/core/interaction/batch/parse-row.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +42 -0
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +121 -0
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +118 -0
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/v2.mjs +44 -0
- package/dist/esm/core/interaction/batch/v2.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/v3.mjs +42 -0
- package/dist/esm/core/interaction/batch/v3.mjs.map +1 -0
- package/dist/esm/core/language/list.mjs +56 -0
- package/dist/esm/core/language/list.mjs.map +1 -0
- package/dist/esm/core/request-id-generator.mjs +42 -0
- package/dist/esm/core/request-id-generator.mjs.map +1 -0
- package/dist/esm/core/result.mjs +101 -0
- package/dist/esm/core/result.mjs.map +1 -0
- package/dist/esm/core/sdk-error.mjs +83 -0
- package/dist/esm/core/sdk-error.mjs.map +1 -0
- package/dist/esm/core/tools/abstract-tool.mjs +24 -0
- package/dist/esm/core/tools/abstract-tool.mjs.map +1 -0
- package/dist/esm/core/tools/healthcheck.mjs +48 -0
- package/dist/esm/core/tools/healthcheck.mjs.map +1 -0
- package/dist/esm/core/tools/manager.mjs +50 -0
- package/dist/esm/core/tools/manager.mjs.map +1 -0
- package/dist/esm/core/tools/ping.mjs +56 -0
- package/dist/esm/core/tools/ping.mjs.map +1 -0
- package/dist/esm/core/version-manager.mjs +116 -0
- package/dist/esm/core/version-manager.mjs.map +1 -0
- package/dist/esm/frame/auth.mjs +98 -0
- package/dist/esm/frame/auth.mjs.map +1 -0
- package/dist/esm/frame/b24.mjs +170 -0
- package/dist/esm/frame/b24.mjs.map +1 -0
- package/dist/esm/frame/dialog.mjs +78 -0
- package/dist/esm/frame/dialog.mjs.map +1 -0
- package/dist/esm/frame/frame.mjs +101 -0
- package/dist/esm/frame/frame.mjs.map +1 -0
- package/dist/esm/frame/message/commands.mjs +37 -0
- package/dist/esm/frame/message/commands.mjs.map +1 -0
- package/dist/esm/frame/message/controller.mjs +178 -0
- package/dist/esm/frame/message/controller.mjs.map +1 -0
- package/dist/esm/frame/options.mjs +106 -0
- package/dist/esm/frame/options.mjs.map +1 -0
- package/dist/esm/frame/parent.mjs +253 -0
- package/dist/esm/frame/parent.mjs.map +1 -0
- package/dist/esm/frame/placement.mjs +131 -0
- package/dist/esm/frame/placement.mjs.map +1 -0
- package/dist/esm/frame/slider.mjs +156 -0
- package/dist/esm/frame/slider.mjs.map +1 -0
- package/dist/esm/helper/abstract-helper.mjs +52 -0
- package/dist/esm/helper/abstract-helper.mjs.map +1 -0
- package/dist/esm/helper/app-manager.mjs +37 -0
- package/dist/esm/helper/app-manager.mjs.map +1 -0
- package/dist/esm/helper/currency-manager.mjs +207 -0
- package/dist/esm/helper/currency-manager.mjs.map +1 -0
- package/dist/esm/helper/helper-manager.mjs +388 -0
- package/dist/esm/helper/helper-manager.mjs.map +1 -0
- package/dist/esm/helper/license-manager.mjs +50 -0
- package/dist/esm/helper/license-manager.mjs.map +1 -0
- package/dist/esm/helper/options-manager.mjs +196 -0
- package/dist/esm/helper/options-manager.mjs.map +1 -0
- package/dist/esm/helper/payment-manager.mjs +33 -0
- package/dist/esm/helper/payment-manager.mjs.map +1 -0
- package/dist/esm/helper/profile-manager.mjs +33 -0
- package/dist/esm/helper/profile-manager.mjs.map +1 -0
- package/dist/esm/helper/use-b24-helper.mjs +84 -0
- package/dist/esm/helper/use-b24-helper.mjs.map +1 -0
- package/dist/esm/hook/auth.mjs +77 -0
- package/dist/esm/hook/auth.mjs.map +1 -0
- package/dist/esm/hook/b24.mjs +115 -0
- package/dist/esm/hook/b24.mjs.map +1 -0
- package/dist/esm/index.d.mts +2768 -534
- package/dist/esm/index.d.ts +2768 -534
- package/dist/esm/index.mjs +70 -14118
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/loader-b24frame.mjs +101 -0
- package/dist/esm/loader-b24frame.mjs.map +1 -0
- package/dist/esm/logger/abstract-logger.mjs +69 -0
- package/dist/esm/logger/abstract-logger.mjs.map +1 -0
- package/dist/esm/logger/browser.mjs +162 -0
- package/dist/esm/logger/browser.mjs.map +1 -0
- package/dist/esm/logger/formatter/abstract-formatter.mjs +34 -0
- package/dist/esm/logger/formatter/abstract-formatter.mjs.map +1 -0
- package/dist/esm/logger/formatter/json-formatter.mjs +34 -0
- package/dist/esm/logger/formatter/json-formatter.mjs.map +1 -0
- package/dist/esm/logger/formatter/line-formatter.mjs +41 -0
- package/dist/esm/logger/formatter/line-formatter.mjs.map +1 -0
- package/dist/esm/logger/formatter/telegram-formatter.mjs +103 -0
- package/dist/esm/logger/formatter/telegram-formatter.mjs.map +1 -0
- package/dist/esm/logger/handler/abstract-handler.mjs +39 -0
- package/dist/esm/logger/handler/abstract-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/consola-adapter.mjs +62 -0
- package/dist/esm/logger/handler/consola-adapter.mjs.map +1 -0
- package/dist/esm/logger/handler/console-handler.mjs +98 -0
- package/dist/esm/logger/handler/console-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/console-v2-handler.mjs +51 -0
- package/dist/esm/logger/handler/console-v2-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/memory-handler.mjs +48 -0
- package/dist/esm/logger/handler/memory-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/stream-handler.mjs +73 -0
- package/dist/esm/logger/handler/stream-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/telegram-handler.mjs +157 -0
- package/dist/esm/logger/handler/telegram-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/winston-adapter.mjs +57 -0
- package/dist/esm/logger/handler/winston-adapter.mjs.map +1 -0
- package/dist/esm/logger/logger-factory.mjs +67 -0
- package/dist/esm/logger/logger-factory.mjs.map +1 -0
- package/dist/esm/logger/logger.mjs +76 -0
- package/dist/esm/logger/logger.mjs.map +1 -0
- package/dist/esm/logger/null-logger.mjs +32 -0
- package/dist/esm/logger/null-logger.mjs.map +1 -0
- package/dist/esm/logger/processor/memory-usage-processor.mjs +20 -0
- package/dist/esm/logger/processor/memory-usage-processor.mjs.map +1 -0
- package/dist/esm/logger/processor/pid-processor.mjs +20 -0
- package/dist/esm/logger/processor/pid-processor.mjs.map +1 -0
- package/dist/esm/oauth/auth.mjs +211 -0
- package/dist/esm/oauth/auth.mjs.map +1 -0
- package/dist/esm/oauth/b24.mjs +117 -0
- package/dist/esm/oauth/b24.mjs.map +1 -0
- package/dist/esm/oauth/refresh-token-error.mjs +20 -0
- package/dist/esm/oauth/refresh-token-error.mjs.map +1 -0
- package/dist/esm/pullClient/abstract-connector.mjs +78 -0
- package/dist/esm/pullClient/abstract-connector.mjs.map +1 -0
- package/dist/esm/pullClient/channel-manager.mjs +89 -0
- package/dist/esm/pullClient/channel-manager.mjs.map +1 -0
- package/dist/esm/pullClient/client.mjs +2064 -0
- package/dist/esm/pullClient/client.mjs.map +1 -0
- package/dist/esm/pullClient/errors.mjs +31 -0
- package/dist/esm/pullClient/errors.mjs.map +1 -0
- package/dist/esm/pullClient/json-rpc.mjs +210 -0
- package/dist/esm/pullClient/json-rpc.mjs.map +1 -0
- package/dist/esm/pullClient/long-polling-connector.mjs +157 -0
- package/dist/esm/pullClient/long-polling-connector.mjs.map +1 -0
- package/dist/esm/pullClient/protobuf/index.mjs +17 -0
- package/dist/esm/pullClient/protobuf/index.mjs.map +1 -0
- package/dist/esm/pullClient/protobuf/model.mjs +1058 -0
- package/dist/esm/pullClient/protobuf/model.mjs.map +1 -0
- package/dist/esm/pullClient/protobuf/protobuf.mjs +4653 -0
- package/dist/esm/pullClient/protobuf/protobuf.mjs.map +1 -0
- package/dist/esm/pullClient/shared-config.mjs +133 -0
- package/dist/esm/pullClient/shared-config.mjs.map +1 -0
- package/dist/esm/pullClient/storage-manager.mjs +72 -0
- package/dist/esm/pullClient/storage-manager.mjs.map +1 -0
- package/dist/esm/pullClient/web-socket-connector.mjs +129 -0
- package/dist/esm/pullClient/web-socket-connector.mjs.map +1 -0
- package/dist/esm/tools/browser.mjs +154 -0
- package/dist/esm/tools/browser.mjs.map +1 -0
- package/dist/esm/tools/environment.mjs +29 -0
- package/dist/esm/tools/environment.mjs.map +1 -0
- package/dist/esm/tools/formatters/iban.mjs +304 -0
- package/dist/esm/tools/formatters/iban.mjs.map +1 -0
- package/dist/esm/tools/formatters/numbers.mjs +64 -0
- package/dist/esm/tools/formatters/numbers.mjs.map +1 -0
- package/dist/esm/tools/index.mjs +37 -0
- package/dist/esm/tools/index.mjs.map +1 -0
- package/dist/esm/tools/scroll-size.mjs +25 -0
- package/dist/esm/tools/scroll-size.mjs.map +1 -0
- package/dist/esm/tools/text.mjs +208 -0
- package/dist/esm/tools/text.mjs.map +1 -0
- package/dist/esm/tools/type.mjs +337 -0
- package/dist/esm/tools/type.mjs.map +1 -0
- package/dist/esm/tools/use-formatters.mjs +460 -0
- package/dist/esm/tools/use-formatters.mjs.map +1 -0
- package/dist/esm/tools/uuidv7.mjs +54 -0
- package/dist/esm/tools/uuidv7.mjs.map +1 -0
- package/dist/esm/types/b24-helper.mjs +56 -0
- package/dist/esm/types/b24-helper.mjs.map +1 -0
- package/dist/esm/types/b24.mjs +16 -0
- package/dist/esm/types/b24.mjs.map +1 -0
- package/dist/esm/types/bizproc/index.mjs +187 -0
- package/dist/esm/types/bizproc/index.mjs.map +1 -0
- package/dist/esm/types/catalog/index.mjs +35 -0
- package/dist/esm/types/catalog/index.mjs.map +1 -0
- package/dist/esm/types/common.mjs +31 -0
- package/dist/esm/types/common.mjs.map +1 -0
- package/dist/esm/types/crm/entity-type.mjs +57 -0
- package/dist/esm/types/crm/entity-type.mjs.map +1 -0
- package/dist/esm/types/crm/productrow.mjs +17 -0
- package/dist/esm/types/crm/productrow.mjs.map +1 -0
- package/dist/esm/types/logger.mjs +22 -0
- package/dist/esm/types/logger.mjs.map +1 -0
- package/dist/esm/types/pull.mjs +83 -0
- package/dist/esm/types/pull.mjs.map +1 -0
- package/dist/umd/index.js +31312 -26912
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +63 -40
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +34 -29
package/dist/umd/index.min.js
CHANGED
|
@@ -1,44 +1,67 @@
|
|
|
1
|
-
(function(R,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(R=typeof globalThis<"u"?globalThis:R||self,I(R.B24Js=R.B24Js||{}))})(this,(function(R){"use strict";var I=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(I||{});const je=new Map;je.set("title",["%c#title#","color: #959ca4; font-style: italic; padding: 0 6px; border-top: 1px solid #ccc; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc"]),je.set("desktop",["%cDESKTOP","color: white; font-style: italic; background-color: #29619b; padding: 0 6px; border: 1px solid #29619b"]),je.set("log",["%cLOG","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]),je.set("info",["%cINFO","color: #fff; font-style: italic; background-color: #6b7f96; padding: 0 6px; border: 1px solid #6b7f96"]),je.set("warn",["%cWARNING","color: #f0a74f; font-style: italic; padding: 0 6px; border: 1px solid #f0a74f"]),je.set("error",["%cERROR","color: white; font-style: italic; background-color: #8a3232; padding: 0 6px; border: 1px solid #8a3232"]),je.set("trace",["%cTRACE","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]);class we{#e;#t={desktop:!0,log:!1,info:!1,warn:!1,error:!0,trace:!0};static build(e,t=!1){const n=new we(e);return t&&(n.enable("log"),n.enable("info"),n.enable("warn")),n}constructor(e){this.#e=e}#r(e){const t=[],n=[];if(je.has("title")){const s=je.get("title");s[0]&&(t.push(s[0].replace("#title#",this.#e)),n.push(s[1]||""))}if(je.has(e)){const s=je.get(e);s[0]&&(t.push(s[0]),n.push(s[1]||""))}return[t.join(""),...n]}setConfig(e){for(const t in e)this.#t[t]=e[t]}enable(e){return typeof this.#t[e]>"u"?!1:(this.#t[e]=!0,!0)}disable(e){return typeof this.#t[e]>"u"?!1:(this.#t[e]=!1,!0)}isEnabled(e){return this.#t[e]}desktop(...e){this.isEnabled("desktop")&&console.log(...this.#r("desktop"),...e)}log(...e){this.isEnabled("log")&&console.log(...this.#r("log"),...e)}info(...e){this.isEnabled("info")&&console.info(...this.#r("info"),...e)}warn(...e){this.isEnabled("warn")&&console.warn(...this.#r("warn"),...e)}error(...e){this.isEnabled("error")&&console.error(...this.#r("error"),...e)}trace(...e){this.isEnabled("trace")&&console.trace(...this.#r("trace"),...e)}}var Yn=(r=>(r.undefined="undefined",r.any="any",r.integer="integer",r.boolean="boolean",r.double="double",r.date="date",r.datetime="datetime",r.string="string",r.text="text",r.file="file",r.array="array",r.object="object",r.user="user",r.location="location",r.crmCategory="crm_category",r.crmStatus="crm_status",r.crmCurrency="crm_currency",r))(Yn||{});const aa=Function.prototype.toString.call(Object);class la{getTag(e){return Object.prototype.toString.call(e)}isString(e){return typeof e=="string"||e instanceof String}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=t.hasOwnProperty("constructor")&&t.constructor;return typeof n=="function"&&Function.prototype.toString.call(n)===aa}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return typeof e=="number"&&!Number.isNaN(e)}isInteger(e){return Number.isInteger(e)}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return e instanceof Date}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return typeof FormData<"u"&&e instanceof FormData?!0:this.isObjectLike(e)&&this.getTag(e)==="[object FormData]"}clone(e,t=!0){let n,s,i;if(this.isNil(e)||typeof e!="object")return e;if(this.isDomNode(e))n=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(n=[],s=0,i=e.length;s<i;s++)typeof e[s]=="object"&&t?n[s]=this.clone(e[s],t):n[s]=e[s];else{n={},e.constructor&&(this.isDate(e)?n=new Date(e):n=new e.constructor);for(s in e)e.hasOwnProperty(s)&&(typeof e[s]=="object"&&t?n[s]=this.clone(e[s],t):n[s]=e[s])}else n=e;return n}}const C=new la;function ca(r,e){const t={};for(const n of e)t[n]=r[n];return t}function Kn(r,e){const t={...r};for(const n of e)delete t[n];return t}function ua(r){return Array.isArray(r[0])}function ha(r,e){return Object.values(r).includes(e)?e:void 0}class dt extends Error{}class fa extends dt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class da extends dt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class pa extends dt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Et extends dt{}class Qn extends dt{constructor(e){super(`Invalid unit ${e}`)}}class be extends dt{}class at extends dt{constructor(){super("Zone is an abstract class")}}const N="numeric",Be="short",Ne="long",ar={year:N,month:N,day:N},Xn={year:N,month:Be,day:N},ga={year:N,month:Be,day:N,weekday:Be},es={year:N,month:Ne,day:N},ts={year:N,month:Ne,day:N,weekday:Ne},rs={hour:N,minute:N},ns={hour:N,minute:N,second:N},ss={hour:N,minute:N,second:N,timeZoneName:Be},is={hour:N,minute:N,second:N,timeZoneName:Ne},os={hour:N,minute:N,hourCycle:"h23"},as={hour:N,minute:N,second:N,hourCycle:"h23"},ls={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:Be},cs={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:Ne},us={year:N,month:N,day:N,hour:N,minute:N},hs={year:N,month:N,day:N,hour:N,minute:N,second:N},fs={year:N,month:Be,day:N,hour:N,minute:N},ds={year:N,month:Be,day:N,hour:N,minute:N,second:N},ma={year:N,month:Be,day:N,weekday:Be,hour:N,minute:N},ps={year:N,month:Ne,day:N,hour:N,minute:N,timeZoneName:Be},gs={year:N,month:Ne,day:N,hour:N,minute:N,second:N,timeZoneName:Be},ms={year:N,month:Ne,day:N,weekday:Ne,hour:N,minute:N,timeZoneName:Ne},ys={year:N,month:Ne,day:N,weekday:Ne,hour:N,minute:N,second:N,timeZoneName:Ne};class Wt{get type(){throw new at}get name(){throw new at}get ianaName(){return this.name}get isUniversal(){throw new at}offsetName(e,t){throw new at}formatOffset(e,t){throw new at}offset(e){throw new at}equals(e){throw new at}get isValid(){throw new at}}let $r=null;class lr extends Wt{static get instance(){return $r===null&&($r=new lr),$r}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Vs(e,t,n)}formatOffset(e,t){return Ht(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Wr=new Map;function ya(r){let e=Wr.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Wr.set(r,e)),e}const wa={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ba(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,o,l,a,u,c]=n;return[o,s,i,l,a,u,c]}function Sa(r,e){const t=r.formatToParts(e),n=[];for(let s=0;s<t.length;s++){const{type:i,value:o}=t[s],l=wa[i];i==="era"?n[l]=o:W(l)||(n[l]=parseInt(o,10))}return n}const Vr=new Map;class Qe extends Wt{static create(e){let t=Vr.get(e);return t===void 0&&Vr.set(e,t=new Qe(e)),t}static resetCache(){Vr.clear(),Wr.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=Qe.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Vs(e,t,n,this.name)}formatOffset(e,t){return Ht(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=ya(this.name);let[s,i,o,l,a,u,c]=n.formatToParts?Sa(n,t):ba(n,t);l==="BC"&&(s=-Math.abs(s)+1);const h=dr({year:s,month:i,day:o,hour:a===24?0:a,minute:u,second:c,millisecond:0});let p=+t;const d=p%1e3;return p-=d>=0?d:1e3+d,(h-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ws={};function _a(r,e={}){const t=JSON.stringify([r,e]);let n=ws[t];return n||(n=new Intl.ListFormat(r,e),ws[t]=n),n}const qr=new Map;function zr(r,e={}){const t=JSON.stringify([r,e]);let n=qr.get(t);return n===void 0&&(n=new Intl.DateTimeFormat(r,e),qr.set(t,n)),n}const Hr=new Map;function ka(r,e={}){const t=JSON.stringify([r,e]);let n=Hr.get(t);return n===void 0&&(n=new Intl.NumberFormat(r,e),Hr.set(t,n)),n}const Jr=new Map;function va(r,e={}){const{base:t,...n}=e,s=JSON.stringify([r,n]);let i=Jr.get(s);return i===void 0&&(i=new Intl.RelativeTimeFormat(r,e),Jr.set(s,i)),i}let Vt=null;function Ea(){return Vt||(Vt=new Intl.DateTimeFormat().resolvedOptions().locale,Vt)}const Zr=new Map;function bs(r){let e=Zr.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),Zr.set(r,e)),e}const Gr=new Map;function Ta(r){let e=Gr.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...Ss,...e}),Gr.set(r,e)}return e}function Oa(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let n,s;try{n=zr(r).resolvedOptions(),s=r}catch{const a=r.substring(0,t);n=zr(a).resolvedOptions(),s=a}const{numberingSystem:i,calendar:o}=n;return[s,i,o]}}function Aa(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function Ia(r){const e=[];for(let t=1;t<=12;t++){const n=U.utc(2009,t,1);e.push(r(n))}return e}function Ca(r){const e=[];for(let t=1;t<=7;t++){const n=U.utc(2016,11,13+t);e.push(r(n))}return e}function cr(r,e,t,n){const s=r.listingMode();return s==="error"?null:s==="en"?t(e):n(e)}function Na(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||bs(r.locale).numberingSystem==="latn"}class Ra{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:s,floor:i,...o}=n;if(!t||Object.keys(o).length>0){const l={useGrouping:!1,...n};n.padTo>0&&(l.minimumIntegerDigits=n.padTo),this.inf=ka(e,l)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):sn(e,3);return fe(t,this.padTo)}}}class La{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),l=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Qe.create(l).valid?(s=l,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||s,this.dtf=zr(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Pa{constructor(e,t,n){this.opts={style:"long",...n},!t&&Bs()&&(this.rtf=va(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):tl(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Ss={firstDay:1,minimalDays:4,weekend:[6,7]};class Q{static fromOpts(e){return Q.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,s,i=!1){const o=e||ae.defaultLocale,l=o||(i?"en-US":Ea()),a=t||ae.defaultNumberingSystem,u=n||ae.defaultOutputCalendar,c=rn(s)||ae.defaultWeekSettings;return new Q(l,a,u,c,o)}static resetCache(){Vt=null,qr.clear(),Hr.clear(),Jr.clear(),Zr.clear(),Gr.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:s}={}){return Q.create(e,t,n,s)}constructor(e,t,n,s,i){const[o,l,a]=Oa(e);this.locale=o,this.numberingSystem=t||l||null,this.outputCalendar=n||a||null,this.weekSettings=s,this.intl=Aa(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Na(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Q.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,rn(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return cr(this,e,Hs,()=>{const n=this.intl==="ja"||this.intl.startsWith("ja-");t&=!n;const s=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const o=n?l=>this.dtFormatter(l,s).format():l=>this.extract(l,s,"month");this.monthsCache[i][e]=Ia(o)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return cr(this,e,Gs,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=t?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=Ca(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return cr(this,void 0,()=>Ys,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[U.utc(2016,11,13,9),U.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return cr(this,e,Ks,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[U.utc(-40,1,1),U.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const s=this.dtFormatter(e,t),i=s.formatToParts(),o=i.find(l=>l.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new Ra(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new La(e,this.intl,t)}relFormatter(e={}){return new Pa(this.intl,this.isEnglish(),e)}listFormatter(e={}){return _a(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||bs(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Us()?Ta(this.locale):Ss}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Yr=null;class Te extends Wt{static get utcInstance(){return Yr===null&&(Yr=new Te(0)),Yr}static instance(e){return e===0?Te.utcInstance:new Te(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Te(pr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ht(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ht(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Ht(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Da extends Wt{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function lt(r,e){if(W(r)||r===null)return e;if(r instanceof Wt)return r;if(Ua(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?lr.instance:t==="utc"||t==="gmt"?Te.utcInstance:Te.parseSpecifier(t)||Qe.create(r)}else return ct(r)?Te.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new Da(r)}const Kr={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},_s={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ma=Kr.hanidec.replace(/[\[|\]]/g,"").split("");function Fa(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const n=r.charCodeAt(t);if(r[t].search(Kr.hanidec)!==-1)e+=Ma.indexOf(r[t]);else for(const s in _s){const[i,o]=_s[s];n>=i&&n<=o&&(e+=n-i)}}return parseInt(e,10)}else return e}const Qr=new Map;function xa(){Qr.clear()}function Ue({numberingSystem:r},e=""){const t=r||"latn";let n=Qr.get(t);n===void 0&&(n=new Map,Qr.set(t,n));let s=n.get(e);return s===void 0&&(s=new RegExp(`${Kr[t]}${e}`),n.set(e,s)),s}let ks=()=>Date.now(),vs="system",Es=null,Ts=null,Os=null,As=60,Is,Cs=null;class ae{static get now(){return ks}static set now(e){ks=e}static set defaultZone(e){vs=e}static get defaultZone(){return lt(vs,lr.instance)}static get defaultLocale(){return Es}static set defaultLocale(e){Es=e}static get defaultNumberingSystem(){return Ts}static set defaultNumberingSystem(e){Ts=e}static get defaultOutputCalendar(){return Os}static set defaultOutputCalendar(e){Os=e}static get defaultWeekSettings(){return Cs}static set defaultWeekSettings(e){Cs=rn(e)}static get twoDigitCutoffYear(){return As}static set twoDigitCutoffYear(e){As=e%100}static get throwOnInvalid(){return Is}static set throwOnInvalid(e){Is=e}static resetCaches(){Q.resetCache(),Qe.resetCache(),U.resetCache(),xa()}}class $e{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Ns=[0,31,59,90,120,151,181,212,243,273,304,334],Rs=[0,31,60,91,121,152,182,213,244,274,305,335];function De(r,e){return new $e("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function Xr(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const s=n.getUTCDay();return s===0?7:s}function Ls(r,e,t){return t+(qt(r)?Rs:Ns)[e-1]}function Ps(r,e){const t=qt(r)?Rs:Ns,n=t.findIndex(i=>i<e),s=e-t[n];return{month:n+1,day:s}}function en(r,e){return(r-e+7)%7+1}function ur(r,e=4,t=1){const{year:n,month:s,day:i}=r,o=Ls(n,s,i),l=en(Xr(n,s,i),t);let a=Math.floor((o-l+14-e)/7),u;return a<1?(u=n-1,a=zt(u,e,t)):a>zt(n,e,t)?(u=n+1,a=1):u=n,{weekYear:u,weekNumber:a,weekday:l,...mr(r)}}function Ds(r,e=4,t=1){const{weekYear:n,weekNumber:s,weekday:i}=r,o=en(Xr(n,1,e),t),l=Ot(n);let a=s*7+i-o-7+e,u;a<1?(u=n-1,a+=Ot(u)):a>l?(u=n+1,a-=Ot(n)):u=n;const{month:c,day:f}=Ps(u,a);return{year:u,month:c,day:f,...mr(r)}}function tn(r){const{year:e,month:t,day:n}=r,s=Ls(e,t,n);return{year:e,ordinal:s,...mr(r)}}function Ms(r){const{year:e,ordinal:t}=r,{month:n,day:s}=Ps(e,t);return{year:e,month:n,day:s,...mr(r)}}function Fs(r,e){if(!W(r.localWeekday)||!W(r.localWeekNumber)||!W(r.localWeekYear)){if(!W(r.weekday)||!W(r.weekNumber)||!W(r.weekYear))throw new Et("Cannot mix locale-based week fields with ISO-based week fields");return W(r.localWeekday)||(r.weekday=r.localWeekday),W(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),W(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ja(r,e=4,t=1){const n=hr(r.weekYear),s=Me(r.weekNumber,1,zt(r.weekYear,e,t)),i=Me(r.weekday,1,7);return n?s?i?!1:De("weekday",r.weekday):De("week",r.weekNumber):De("weekYear",r.weekYear)}function Ba(r){const e=hr(r.year),t=Me(r.ordinal,1,Ot(r.year));return e?t?!1:De("ordinal",r.ordinal):De("year",r.year)}function xs(r){const e=hr(r.year),t=Me(r.month,1,12),n=Me(r.day,1,fr(r.year,r.month));return e?t?n?!1:De("day",r.day):De("month",r.month):De("year",r.year)}function js(r){const{hour:e,minute:t,second:n,millisecond:s}=r,i=Me(e,0,23)||e===24&&t===0&&n===0&&s===0,o=Me(t,0,59),l=Me(n,0,59),a=Me(s,0,999);return i?o?l?a?!1:De("millisecond",s):De("second",n):De("minute",t):De("hour",e)}function W(r){return typeof r>"u"}function ct(r){return typeof r=="number"}function hr(r){return typeof r=="number"&&r%1===0}function Ua(r){return typeof r=="string"}function $a(r){return Object.prototype.toString.call(r)==="[object Date]"}function Bs(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Us(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Wa(r){return Array.isArray(r)?r:[r]}function $s(r,e,t){if(r.length!==0)return r.reduce((n,s)=>{const i=[e(s),s];return n&&t(n[0],i[0])===n[0]?n:i},null)[1]}function Va(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function Tt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function rn(r){if(r==null)return null;if(typeof r!="object")throw new be("Week settings must be an object");if(!Me(r.firstDay,1,7)||!Me(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Me(e,1,7)))throw new be("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Me(r,e,t){return hr(r)&&r>=e&&r<=t}function qa(r,e){return r-e*Math.floor(r/e)}function fe(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function ut(r){if(!(W(r)||r===null||r===""))return parseInt(r,10)}function pt(r){if(!(W(r)||r===null||r===""))return parseFloat(r)}function nn(r){if(!(W(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function sn(r,e,t="round"){const n=10**e;switch(t){case"expand":return r>0?Math.ceil(r*n)/n:Math.floor(r*n)/n;case"trunc":return Math.trunc(r*n)/n;case"round":return Math.round(r*n)/n;case"floor":return Math.floor(r*n)/n;case"ceil":return Math.ceil(r*n)/n;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function qt(r){return r%4===0&&(r%100!==0||r%400===0)}function Ot(r){return qt(r)?366:365}function fr(r,e){const t=qa(e-1,12)+1,n=r+(e-t)/12;return t===2?qt(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function dr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function Ws(r,e,t){return-en(Xr(r,1,e),t)+e-1}function zt(r,e=4,t=1){const n=Ws(r,e,t),s=Ws(r+1,e,t);return(Ot(r)-n+s)/7}function on(r){return r>99?r:r>ae.twoDigitCutoffYear?1900+r:2e3+r}function Vs(r,e,t,n=null){const s=new Date(r),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);const o={timeZoneName:e,...i},l=new Intl.DateTimeFormat(t,o).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return l?l.value:null}function pr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-n:n;return t*60+s}function qs(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new be(`Invalid unit value ${r}`);return e}function gr(r,e){const t={};for(const n in r)if(Tt(r,n)){const s=r[n];if(s==null)continue;t[e(n)]=qs(s)}return t}function Ht(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),s=r>=0?"+":"-";switch(e){case"short":return`${s}${fe(t,2)}:${fe(n,2)}`;case"narrow":return`${s}${t}${n>0?`:${n}`:""}`;case"techie":return`${s}${fe(t,2)}${fe(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function mr(r){return Va(r,["hour","minute","second","millisecond"])}const za=["January","February","March","April","May","June","July","August","September","October","November","December"],zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ha=["J","F","M","A","M","J","J","A","S","O","N","D"];function Hs(r){switch(r){case"narrow":return[...Ha];case"short":return[...zs];case"long":return[...za];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Js=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Zs=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ja=["M","T","W","T","F","S","S"];function Gs(r){switch(r){case"narrow":return[...Ja];case"short":return[...Zs];case"long":return[...Js];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Ys=["AM","PM"],Za=["Before Christ","Anno Domini"],Ga=["BC","AD"],Ya=["B","A"];function Ks(r){switch(r){case"narrow":return[...Ya];case"short":return[...Ga];case"long":return[...Za];default:return null}}function Ka(r){return Ys[r.hour<12?0:1]}function Qa(r,e){return Gs(e)[r.weekday-1]}function Xa(r,e){return Hs(e)[r.month-1]}function el(r,e){return Ks(e)[r.year<0?0:1]}function tl(r,e,t="always",n=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&i){const f=r==="days";switch(e){case 1:return f?"tomorrow":`next ${s[r][0]}`;case-1:return f?"yesterday":`last ${s[r][0]}`;case 0:return f?"today":`this ${s[r][0]}`}}const o=Object.is(e,-0)||e<0,l=Math.abs(e),a=l===1,u=s[r],c=n?a?u[1]:u[2]||u[1]:a?s[r][0]:r;return o?`${l} ${c} ago`:`in ${l} ${c}`}function Qs(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const rl={D:ar,DD:Xn,DDD:es,DDDD:ts,t:rs,tt:ns,ttt:ss,tttt:is,T:os,TT:as,TTT:ls,TTTT:cs,f:us,ff:fs,fff:ps,ffff:ms,F:hs,FF:ds,FFF:gs,FFFF:ys};class Se{static create(e,t={}){return new Se(e,t)}static parseFormat(e){let t=null,n="",s=!1;const i=[];for(let o=0;o<e.length;o++){const l=e.charAt(o);l==="'"?((n.length>0||s)&&i.push({literal:s||/^\s+$/.test(n),val:n===""?"'":n}),t=null,n="",s=!s):s||l===t?n+=l:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=l,t=l)}return n.length>0&&i.push({literal:s||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return rl[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return fe(e,t);const s={...this.opts};return t>0&&(s.padTo=t),n&&(s.signDisplay=n),this.loc.numberFormatter(s).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,d)=>this.loc.extract(e,p,d),o=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",l=()=>n?Ka(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(p,d)=>n?Xa(e,p):i(d?{month:p}:{month:p,day:"numeric"},"month"),u=(p,d)=>n?Qa(e,p):i(d?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{const d=Se.macroTokenToFormatOpts(p);return d?this.formatWithSystemDefault(e,d):p},f=p=>n?el(e,p):i({era:p},"era"),h=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return l();case"d":return s?i({day:"numeric"},"day"):this.num(e.day);case"dd":return s?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return s?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return s?i({month:"numeric"},"month"):this.num(e.month);case"MM":return s?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return s?i({year:"numeric"},"year"):this.num(e.year);case"yy":return s?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(p)}};return Qs(Se.parseFormat(t),h)}formatDurationFromString(e,t){const n=this.opts.signMode==="negativeLargestOnly"?-1:1,s=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=(c,f)=>h=>{const p=s(h);if(p){const d=f.isNegativeDuration&&p!==f.largestUnit?n:1;let g;return this.opts.signMode==="negativeLargestOnly"&&p!==f.largestUnit?g="never":this.opts.signMode==="all"?g="always":g="auto",this.num(c.get(p)*d,h.length,g)}else return h},o=Se.parseFormat(t),l=o.reduce((c,{literal:f,val:h})=>f?c:c.concat(h),[]),a=e.shiftTo(...l.map(s).filter(c=>c)),u={isNegativeDuration:a<0,largestUnit:Object.keys(a.values)[0]};return Qs(o,i(a,u))}}const Xs=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function At(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function It(...r){return e=>r.reduce(([t,n,s],i)=>{const[o,l,a]=i(e,s);return[{...t,...o},l||n,a]},[{},null,1]).slice(0,2)}function Ct(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const s=t.exec(r);if(s)return n(s)}return[null,null]}function ei(...r){return(e,t)=>{const n={};let s;for(s=0;s<r.length;s++)n[r[s]]=ut(e[t+s]);return[n,null,t+s]}}const ti=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,nl=`(?:${ti.source}?(?:\\[(${Xs.source})\\])?)?`,an=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ri=RegExp(`${an.source}${nl}`),ln=RegExp(`(?:[Tt]${ri.source})?`),sl=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,il=/(\d{4})-?W(\d\d)(?:-?(\d))?/,ol=/(\d{4})-?(\d{3})/,al=ei("weekYear","weekNumber","weekDay"),ll=ei("year","ordinal"),cl=/(\d{4})-(\d\d)-(\d\d)/,ni=RegExp(`${an.source} ?(?:${ti.source}|(${Xs.source}))?`),ul=RegExp(`(?: ${ni.source})?`);function Nt(r,e,t){const n=r[e];return W(n)?t:ut(n)}function hl(r,e){return[{year:Nt(r,e),month:Nt(r,e+1,1),day:Nt(r,e+2,1)},null,e+3]}function Rt(r,e){return[{hours:Nt(r,e,0),minutes:Nt(r,e+1,0),seconds:Nt(r,e+2,0),milliseconds:nn(r[e+3])},null,e+4]}function Jt(r,e){const t=!r[e]&&!r[e+1],n=pr(r[e+1],r[e+2]),s=t?null:Te.instance(n);return[{},s,e+3]}function Zt(r,e){const t=r[e]?Qe.create(r[e]):null;return[{},t,e+1]}const fl=RegExp(`^T?${an.source}$`),dl=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function pl(r){const[e,t,n,s,i,o,l,a,u]=r,c=e[0]==="-",f=a&&a[0]==="-",h=(p,d=!1)=>p!==void 0&&(d||p&&c)?-p:p;return[{years:h(pt(t)),months:h(pt(n)),weeks:h(pt(s)),days:h(pt(i)),hours:h(pt(o)),minutes:h(pt(l)),seconds:h(pt(a),a==="-0"),milliseconds:h(nn(u),f)}]}const gl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function cn(r,e,t,n,s,i,o){const l={year:e.length===2?on(ut(e)):ut(e),month:zs.indexOf(t)+1,day:ut(n),hour:ut(s),minute:ut(i)};return o&&(l.second=ut(o)),r&&(l.weekday=r.length>3?Js.indexOf(r)+1:Zs.indexOf(r)+1),l}const ml=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function yl(r){const[,e,t,n,s,i,o,l,a,u,c,f]=r,h=cn(e,s,n,t,i,o,l);let p;return a?p=gl[a]:u?p=0:p=pr(c,f),[h,new Te(p)]}function wl(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const bl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Sl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,_l=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function si(r){const[,e,t,n,s,i,o,l]=r;return[cn(e,s,n,t,i,o,l),Te.utcInstance]}function kl(r){const[,e,t,n,s,i,o,l]=r;return[cn(e,l,t,n,s,i,o),Te.utcInstance]}const vl=At(sl,ln),El=At(il,ln),Tl=At(ol,ln),Ol=At(ri),ii=It(hl,Rt,Jt,Zt),Al=It(al,Rt,Jt,Zt),Il=It(ll,Rt,Jt,Zt),Cl=It(Rt,Jt,Zt);function Nl(r){return Ct(r,[vl,ii],[El,Al],[Tl,Il],[Ol,Cl])}function Rl(r){return Ct(wl(r),[ml,yl])}function Ll(r){return Ct(r,[bl,si],[Sl,si],[_l,kl])}function Pl(r){return Ct(r,[dl,pl])}const Dl=It(Rt);function Ml(r){return Ct(r,[fl,Dl])}const Fl=At(cl,ul),xl=At(ni),jl=It(Rt,Jt,Zt);function Bl(r){return Ct(r,[Fl,ii],[xl,jl])}const oi="Invalid Duration",ai={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ul={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ai},Fe=146097/400,Lt=146097/4800,$l={years:{quarters:4,months:12,weeks:Fe/7,days:Fe,hours:Fe*24,minutes:Fe*24*60,seconds:Fe*24*60*60,milliseconds:Fe*24*60*60*1e3},quarters:{months:3,weeks:Fe/28,days:Fe/4,hours:Fe*24/4,minutes:Fe*24*60/4,seconds:Fe*24*60*60/4,milliseconds:Fe*24*60*60*1e3/4},months:{weeks:Lt/7,days:Lt,hours:Lt*24,minutes:Lt*24*60,seconds:Lt*24*60*60,milliseconds:Lt*24*60*60*1e3},...ai},gt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Wl=gt.slice(0).reverse();function Xe(r,e,t=!1){const n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new G(n)}function li(r,e){let t=e.milliseconds??0;for(const n of Wl.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function ci(r,e){const t=li(r,e)<0?-1:1;gt.reduceRight((n,s)=>{if(W(e[s]))return n;if(n){const i=e[n]*t,o=r[s][n],l=Math.floor(i/o);e[s]+=l*t,e[n]-=l*o*t}return s},null),gt.reduce((n,s)=>{if(W(e[s]))return n;if(n){const i=e[n]%1;e[n]-=i,e[s]+=i*r[n][s]}return s},null)}function ui(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class G{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?$l:Ul;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Q.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return G.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new be(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new G({values:gr(e,G.normalizeUnit),loc:Q.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ct(e))return G.fromMillis(e);if(G.isDuration(e))return e;if(typeof e=="object")return G.fromObject(e);throw new be(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=Pl(e);return n?G.fromObject(n,t):G.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=Ml(e);return n?G.fromObject(n,t):G.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new be("need to specify a reason the Duration is invalid");const n=e instanceof $e?e:new $e(e,t);if(ae.throwOnInvalid)throw new pa(n);return new G({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Qn(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Se.create(this.loc,n).formatDurationFromString(this,e):oi}toHuman(e={}){if(!this.isValid)return oi;const t=e.showZeros!==!1,n=gt.map(s=>{const i=this.values[s];return W(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:s.slice(0,-1)}).format(i)}).filter(s=>s);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=sn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},U.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?li(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=G.fromDurationLike(e),n={};for(const s of gt)(Tt(t.values,s)||Tt(this.values,s))&&(n[s]=t.get(s)+this.get(s));return Xe(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=G.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=qs(e(this.values[n],n));return Xe(this,{values:t},!0)}get(e){return this[G.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...gr(e,G.normalizeUnit)};return Xe(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:s}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:s,conversionAccuracy:n};return Xe(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return ci(this.matrix,e),Xe(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=ui(this.normalize().shiftToAll().toObject());return Xe(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>G.normalizeUnit(o));const t={},n={},s=this.toObject();let i;for(const o of gt)if(e.indexOf(o)>=0){i=o;let l=0;for(const u in n)l+=this.matrix[u][o]*n[u],n[u]=0;ct(s[o])&&(l+=s[o]);const a=Math.trunc(l);t[o]=a,n[o]=(l*1e3-a*1e3)/1e3}else ct(s[o])&&(n[o]=s[o]);for(const o in n)n[o]!==0&&(t[i]+=o===i?n[o]:n[o]/this.matrix[i][o]);return ci(this.matrix,t),Xe(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Xe(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=ui(this.values);return Xe(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,s){return n===void 0||n===0?s===void 0||s===0:n===s}for(const n of gt)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Pt="Invalid Interval";function Vl(r,e){return!r||!r.isValid?le.invalid("missing or invalid start"):!e||!e.isValid?le.invalid("missing or invalid end"):e<r?le.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}class le{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new be("need to specify a reason the Interval is invalid");const n=e instanceof $e?e:new $e(e,t);if(ae.throwOnInvalid)throw new da(n);return new le({invalid:n})}static fromDateTimes(e,t){const n=Kt(e),s=Kt(t),i=Vl(n,s);return i??new le({start:n,end:s})}static after(e,t){const n=G.fromDurationLike(t),s=Kt(e);return le.fromDateTimes(s,s.plus(n))}static before(e,t){const n=G.fromDurationLike(t),s=Kt(e);return le.fromDateTimes(s.minus(n),s)}static fromISO(e,t){const[n,s]=(e||"").split("/",2);if(n&&s){let i,o;try{i=U.fromISO(n,t),o=i.isValid}catch{o=!1}let l,a;try{l=U.fromISO(s,t),a=l.isValid}catch{a=!1}if(o&&a)return le.fromDateTimes(i,l);if(o){const u=G.fromISO(s,t);if(u.isValid)return le.after(i,u)}else if(a){const u=G.fromISO(n,t);if(u.isValid)return le.before(l,u)}}return le.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let s;return t?.useLocaleWeeks?s=this.end.reconfigure({locale:n.locale}):s=this.end,s=s.startOf(e,t),Math.floor(s.diff(n,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?le.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Kt).filter(o=>this.contains(o)).sort((o,l)=>o.toMillis()-l.toMillis()),n=[];let{s}=this,i=0;for(;s<this.e;){const o=t[i]||this.e,l=+o>+this.e?this.e:o;n.push(le.fromDateTimes(s,l)),s=l,i+=1}return n}splitBy(e){const t=G.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,s=1,i;const o=[];for(;n<this.e;){const l=this.start.plus(t.mapUnits(a=>a*s));i=+l>+this.e?this.e:l,o.push(le.fromDateTimes(n,i)),n=i,s+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:le.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return le.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((s,i)=>s.s-i.s).reduce(([s,i],o)=>i?i.overlaps(o)||i.abutsStart(o)?[s,i.union(o)]:[s.concat([i]),o]:[s,o],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const s=[],i=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...i),l=o.sort((a,u)=>a.time-u.time);for(const a of l)n+=a.type==="s"?1:-1,n===1?t=a.time:(t&&+t!=+a.time&&s.push(le.fromDateTimes(t,a.time)),t=null);return le.merge(s)}difference(...e){return le.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Pt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=ar,t={}){return this.isValid?Se.create(this.s.loc.clone(t),e).formatInterval(this):Pt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Pt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Pt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Pt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Pt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):G.invalid(this.invalidReason)}mapEndpoints(e){return le.fromDateTimes(e(this.s),e(this.e))}}class yr{static hasDST(e=ae.defaultZone){const t=U.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Qe.isValidZone(e)}static normalizeZone(e){return lt(e,ae.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Q.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Q.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Q.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||Q.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||Q.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||Q.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||Q.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Q.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Q.create(t,null,"gregory").eras(e)}static features(){return{relative:Bs(),localeWeek:Us()}}}function hi(r,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(G.fromMillis(n).as("days"))}function ql(r,e,t){const n=[["years",(a,u)=>u.year-a.year],["quarters",(a,u)=>u.quarter-a.quarter+(u.year-a.year)*4],["months",(a,u)=>u.month-a.month+(u.year-a.year)*12],["weeks",(a,u)=>{const c=hi(a,u);return(c-c%7)/7}],["days",hi]],s={},i=r;let o,l;for(const[a,u]of n)t.indexOf(a)>=0&&(o=a,s[a]=u(r,e),l=i.plus(s),l>e?(s[a]--,r=i.plus(s),r>e&&(l=r,s[a]--,r=i.plus(s))):r=l);return[r,s,l,o]}function zl(r,e,t,n){let[s,i,o,l]=ql(r,e,t);const a=e-s,u=t.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);u.length===0&&(o<e&&(o=s.plus({[l]:1})),o!==s&&(i[l]=(i[l]||0)+a/(o-s)));const c=G.fromObject(i,n);return u.length>0?G.fromMillis(a,n).shiftTo(...u).plus(c):c}const Hl="missing Intl.DateTimeFormat.formatToParts support";function K(r,e=t=>t){return{regex:r,deser:([t])=>e(Fa(t))}}const fi="[ \xA0]",di=new RegExp(fi,"g");function Jl(r){return r.replace(/\./g,"\\.?").replace(di,fi)}function pi(r){return r.replace(/\./g,"").replace(di," ").toLowerCase()}function We(r,e){return r===null?null:{regex:RegExp(r.map(Jl).join("|")),deser:([t])=>r.findIndex(n=>pi(t)===pi(n))+e}}function gi(r,e){return{regex:r,deser:([,t,n])=>pr(t,n),groups:e}}function wr(r){return{regex:r,deser:([e])=>e}}function Zl(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Gl(r,e){const t=Ue(e),n=Ue(e,"{2}"),s=Ue(e,"{3}"),i=Ue(e,"{4}"),o=Ue(e,"{6}"),l=Ue(e,"{1,2}"),a=Ue(e,"{1,3}"),u=Ue(e,"{1,6}"),c=Ue(e,"{1,9}"),f=Ue(e,"{2,4}"),h=Ue(e,"{4,6}"),p=m=>({regex:RegExp(Zl(m.val)),deser:([y])=>y,literal:!0}),g=(m=>{if(r.literal)return p(m);switch(m.val){case"G":return We(e.eras("short"),0);case"GG":return We(e.eras("long"),0);case"y":return K(u);case"yy":return K(f,on);case"yyyy":return K(i);case"yyyyy":return K(h);case"yyyyyy":return K(o);case"M":return K(l);case"MM":return K(n);case"MMM":return We(e.months("short",!0),1);case"MMMM":return We(e.months("long",!0),1);case"L":return K(l);case"LL":return K(n);case"LLL":return We(e.months("short",!1),1);case"LLLL":return We(e.months("long",!1),1);case"d":return K(l);case"dd":return K(n);case"o":return K(a);case"ooo":return K(s);case"HH":return K(n);case"H":return K(l);case"hh":return K(n);case"h":return K(l);case"mm":return K(n);case"m":return K(l);case"q":return K(l);case"qq":return K(n);case"s":return K(l);case"ss":return K(n);case"S":return K(a);case"SSS":return K(s);case"u":return wr(c);case"uu":return wr(l);case"uuu":return K(t);case"a":return We(e.meridiems(),0);case"kkkk":return K(i);case"kk":return K(f,on);case"W":return K(l);case"WW":return K(n);case"E":case"c":return K(t);case"EEE":return We(e.weekdays("short",!1),1);case"EEEE":return We(e.weekdays("long",!1),1);case"ccc":return We(e.weekdays("short",!0),1);case"cccc":return We(e.weekdays("long",!0),1);case"Z":case"ZZ":return gi(new RegExp(`([+-]${l.source})(?::(${n.source}))?`),2);case"ZZZ":return gi(new RegExp(`([+-]${l.source})(${n.source})?`),2);case"z":return wr(/[a-z_+-/]{1,256}?/i);case" ":return wr(/[^\S\n\r]/);default:return p(m)}})(r)||{invalidReason:Hl};return g.token=r,g}const Yl={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Kl(r,e,t){const{type:n,value:s}=r;if(n==="literal"){const a=/^\s+$/.test(s);return{literal:!a,val:a?" ":s}}const i=e[n];let o=n;n==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let l=Yl[o];if(typeof l=="object"&&(l=l[i]),l)return{literal:!1,val:l}}function Ql(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function Xl(r,e,t){const n=r.match(e);if(n){const s={};let i=1;for(const o in t)if(Tt(t,o)){const l=t[o],a=l.groups?l.groups+1:1;!l.literal&&l.token&&(s[l.token.val[0]]=l.deser(n.slice(i,i+a))),i+=a}return[n,s]}else return[n,{}]}function ec(r){const e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,n;return W(r.z)||(t=Qe.create(r.z)),W(r.Z)||(t||(t=new Te(r.Z)),n=r.Z),W(r.q)||(r.M=(r.q-1)*3+1),W(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),W(r.u)||(r.S=nn(r.u)),[Object.keys(r).reduce((i,o)=>{const l=e(o);return l&&(i[l]=r[o]),i},{}),t,n]}let un=null;function tc(){return un||(un=U.fromMillis(1555555555555)),un}function rc(r,e){if(r.literal)return r;const t=Se.macroTokenToFormatOpts(r.val),n=bi(t,e);return n==null||n.includes(void 0)?r:n}function mi(r,e){return Array.prototype.concat(...r.map(t=>rc(t,e)))}class yi{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=mi(Se.parseFormat(t),e),this.units=this.tokens.map(n=>Gl(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,s]=Ql(this.units);this.regex=RegExp(n,"i"),this.handlers=s}}explainFromTokens(e){if(this.isValid){const[t,n]=Xl(e,this.regex,this.handlers),[s,i,o]=n?ec(n):[null,null,void 0];if(Tt(n,"a")&&Tt(n,"H"))throw new Et("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:s,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function wi(r,e,t){return new yi(r,t).explainFromTokens(e)}function nc(r,e,t){const{result:n,zone:s,specificOffset:i,invalidReason:o}=wi(r,e,t);return[n,s,i,o]}function bi(r,e){if(!r)return null;const n=Se.create(e,r).dtFormatter(tc()),s=n.formatToParts(),i=n.resolvedOptions();return s.map(o=>Kl(o,r,i))}const hn="Invalid DateTime",Si=864e13;function Gt(r){return new $e("unsupported zone",`the zone "${r.name}" is not supported`)}function fn(r){return r.weekData===null&&(r.weekData=ur(r.c)),r.weekData}function dn(r){return r.localWeekData===null&&(r.localWeekData=ur(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function mt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new U({...t,...e,old:t})}function _i(r,e,t){let n=r-e*60*1e3;const s=t.offset(n);if(e===s)return[n,e];n-=(s-e)*60*1e3;const i=t.offset(n);return s===i?[n,s]:[r-Math.min(s,i)*60*1e3,Math.max(s,i)]}function br(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Sr(r,e,t){return _i(dr(r),e,t)}function ki(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),s=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...r.c,year:n,month:s,day:Math.min(r.c.day,fr(n,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=G.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),l=dr(i);let[a,u]=_i(l,t,r.zone);return o!==0&&(a+=o,u=r.zone.offset(a)),{ts:a,o:u}}function Dt(r,e,t,n,s,i){const{setZone:o,zone:l}=t;if(r&&Object.keys(r).length!==0||e){const a=e||l,u=U.fromObject(r,{...t,zone:a,specificOffset:i});return o?u:u.setZone(l)}else return U.invalid(new $e("unparsable",`the input "${s}" can't be parsed as ${n}`))}function _r(r,e,t=!0){return r.isValid?Se.create(Q.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function pn(r,e,t){const n=r.c.year>9999||r.c.year<0;let s="";if(n&&r.c.year>=0&&(s+="+"),s+=fe(r.c.year,n?6:4),t==="year")return s;if(e){if(s+="-",s+=fe(r.c.month),t==="month")return s;s+="-"}else if(s+=fe(r.c.month),t==="month")return s;return s+=fe(r.c.day),s}function vi(r,e,t,n,s,i,o){let l=!t||r.c.millisecond!==0||r.c.second!==0,a="";switch(o){case"day":case"month":case"year":break;default:if(a+=fe(r.c.hour),o==="hour")break;if(e){if(a+=":",a+=fe(r.c.minute),o==="minute")break;l&&(a+=":",a+=fe(r.c.second))}else{if(a+=fe(r.c.minute),o==="minute")break;l&&(a+=fe(r.c.second))}if(o==="second")break;l&&(!n||r.c.millisecond!==0)&&(a+=".",a+=fe(r.c.millisecond,3))}return s&&(r.isOffsetFixed&&r.offset===0&&!i?a+="Z":r.o<0?(a+="-",a+=fe(Math.trunc(-r.o/60)),a+=":",a+=fe(Math.trunc(-r.o%60))):(a+="+",a+=fe(Math.trunc(r.o/60)),a+=":",a+=fe(Math.trunc(r.o%60)))),i&&(a+="["+r.zone.ianaName+"]"),a}const Ei={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},sc={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ic={ordinal:1,hour:0,minute:0,second:0,millisecond:0},kr=["year","month","day","hour","minute","second","millisecond"],oc=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ac=["year","ordinal","hour","minute","second","millisecond"];function vr(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new Qn(r);return e}function Ti(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return vr(r)}}function lc(r){if(Yt===void 0&&(Yt=ae.now()),r.type!=="iana")return r.offset(Yt);const e=r.name;let t=gn.get(e);return t===void 0&&(t=r.offset(Yt),gn.set(e,t)),t}function Oi(r,e){const t=lt(e.zone,ae.defaultZone);if(!t.isValid)return U.invalid(Gt(t));const n=Q.fromObject(e);let s,i;if(W(r.year))s=ae.now();else{for(const a of kr)W(r[a])&&(r[a]=Ei[a]);const o=xs(r)||js(r);if(o)return U.invalid(o);const l=lc(t);[s,i]=Sr(r,l,t)}return new U({ts:s,zone:t,loc:n,o:i})}function Ai(r,e,t){const n=W(t.round)?!0:t.round,s=W(t.rounding)?"trunc":t.rounding,i=(l,a)=>(l=sn(l,n||t.calendary?0:2,t.calendary?"round":s),e.loc.clone(t).relFormatter(t).format(l,a)),o=l=>t.calendary?e.hasSame(r,l)?0:e.startOf(l).diff(r.startOf(l),l).get(l):e.diff(r,l).get(l);if(t.unit)return i(o(t.unit),t.unit);for(const l of t.units){const a=o(l);if(Math.abs(a)>=1)return i(a,l)}return i(r>e?-0:0,t.units[t.units.length-1])}function Ii(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}let Yt;const gn=new Map;class U{constructor(e){const t=e.zone||ae.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new $e("invalid input"):null)||(t.isValid?null:Gt(t));this.ts=W(e.ts)?ae.now():e.ts;let s=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,i]=[e.old.c,e.old.o];else{const l=ct(e.o)&&!e.old?e.o:t.offset(this.ts);s=br(this.ts,l),n=Number.isNaN(s.year)?new $e("invalid input"):null,s=n?null:s,i=n?null:l}this._zone=t,this.loc=e.loc||Q.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=s,this.o=i,this.isLuxonDateTime=!0}static now(){return new U({})}static local(){const[e,t]=Ii(arguments),[n,s,i,o,l,a,u]=t;return Oi({year:n,month:s,day:i,hour:o,minute:l,second:a,millisecond:u},e)}static utc(){const[e,t]=Ii(arguments),[n,s,i,o,l,a,u]=t;return e.zone=Te.utcInstance,Oi({year:n,month:s,day:i,hour:o,minute:l,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const n=$a(e)?e.valueOf():NaN;if(Number.isNaN(n))return U.invalid("invalid input");const s=lt(t.zone,ae.defaultZone);return s.isValid?new U({ts:n,zone:s,loc:Q.fromObject(t)}):U.invalid(Gt(s))}static fromMillis(e,t={}){if(ct(e))return e<-Si||e>Si?U.invalid("Timestamp out of range"):new U({ts:e,zone:lt(t.zone,ae.defaultZone),loc:Q.fromObject(t)});throw new be(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ct(e))return new U({ts:e*1e3,zone:lt(t.zone,ae.defaultZone),loc:Q.fromObject(t)});throw new be("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=lt(t.zone,ae.defaultZone);if(!n.isValid)return U.invalid(Gt(n));const s=Q.fromObject(t),i=gr(e,Ti),{minDaysInFirstWeek:o,startOfWeek:l}=Fs(i,s),a=ae.now(),u=W(t.specificOffset)?n.offset(a):t.specificOffset,c=!W(i.ordinal),f=!W(i.year),h=!W(i.month)||!W(i.day),p=f||h,d=i.weekYear||i.weekNumber;if((p||c)&&d)throw new Et("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new Et("Can't mix ordinal dates with month/day");const g=d||i.weekday&&!p;let m,y,w=br(a,u);g?(m=oc,y=sc,w=ur(w,o,l)):c?(m=ac,y=ic,w=tn(w)):(m=kr,y=Ei);let _=!1;for(const x of m){const J=i[x];W(J)?_?i[x]=y[x]:i[x]=w[x]:_=!0}const b=g?ja(i,o,l):c?Ba(i):xs(i),E=b||js(i);if(E)return U.invalid(E);const S=g?Ds(i,o,l):c?Ms(i):i,[v,L]=Sr(S,u,n),j=new U({ts:v,zone:n,o:L,loc:s});return i.weekday&&p&&e.weekday!==j.weekday?U.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${j.toISO()}`):j.isValid?j:U.invalid(j.invalid)}static fromISO(e,t={}){const[n,s]=Nl(e);return Dt(n,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,s]=Rl(e);return Dt(n,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,s]=Ll(e);return Dt(n,s,t,"HTTP",t)}static fromFormat(e,t,n={}){if(W(e)||W(t))throw new be("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:i=null}=n,o=Q.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0}),[l,a,u,c]=nc(o,e,t);return c?U.invalid(c):Dt(l,a,n,`format ${t}`,e,u)}static fromString(e,t,n={}){return U.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,s]=Bl(e);return Dt(n,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new be("need to specify a reason the DateTime is invalid");const n=e instanceof $e?e:new $e(e,t);if(ae.throwOnInvalid)throw new fa(n);return new U({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=bi(e,Q.fromObject(t));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return mi(Se.parseFormat(e),Q.fromObject(t)).map(s=>s.val).join("")}static resetCache(){Yt=void 0,gn.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?fn(this).weekYear:NaN}get weekNumber(){return this.isValid?fn(this).weekNumber:NaN}get weekday(){return this.isValid?fn(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?dn(this).weekday:NaN}get localWeekNumber(){return this.isValid?dn(this).weekNumber:NaN}get localWeekYear(){return this.isValid?dn(this).weekYear:NaN}get ordinal(){return this.isValid?tn(this.c).ordinal:NaN}get monthShort(){return this.isValid?yr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?yr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?yr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?yr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=dr(this.c),s=this.zone.offset(n-e),i=this.zone.offset(n+e),o=this.zone.offset(n-s*t),l=this.zone.offset(n-i*t);if(o===l)return[this];const a=n-o*t,u=n-l*t,c=br(a,o),f=br(u,l);return c.hour===f.hour&&c.minute===f.minute&&c.second===f.second&&c.millisecond===f.millisecond?[mt(this,{ts:a}),mt(this,{ts:u})]:[this]}get isInLeapYear(){return qt(this.year)}get daysInMonth(){return fr(this.year,this.month)}get daysInYear(){return this.isValid?Ot(this.year):NaN}get weeksInWeekYear(){return this.isValid?zt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?zt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:s}=Se.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(Te.instance(e),t)}toLocal(){return this.setZone(ae.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=lt(e,ae.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||n){const i=e.offset(this.ts),o=this.toObject();[s]=Sr(o,i,e)}return mt(this,{ts:s,zone:e})}else return U.invalid(Gt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return mt(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=gr(e,Ti),{minDaysInFirstWeek:n,startOfWeek:s}=Fs(t,this.loc),i=!W(t.weekYear)||!W(t.weekNumber)||!W(t.weekday),o=!W(t.ordinal),l=!W(t.year),a=!W(t.month)||!W(t.day),u=l||a,c=t.weekYear||t.weekNumber;if((u||o)&&c)throw new Et("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Et("Can't mix ordinal dates with month/day");let f;i?f=Ds({...ur(this.c,n,s),...t},n,s):W(t.ordinal)?(f={...this.toObject(),...t},W(t.day)&&(f.day=Math.min(fr(f.year,f.month),f.day))):f=Ms({...tn(this.c),...t});const[h,p]=Sr(f,this.o,this.zone);return mt(this,{ts:h,o:p})}plus(e){if(!this.isValid)return this;const t=G.fromDurationLike(e);return mt(this,ki(this,t))}minus(e){if(!this.isValid)return this;const t=G.fromDurationLike(e).negate();return mt(this,ki(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},s=G.normalizeUnit(e);switch(s){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(s==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:o}=this;o<i&&(n.weekNumber=this.weekNumber-1),n.weekday=i}else n.weekday=1;if(s==="quarters"){const i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Se.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):hn}toLocaleString(e=ar,t={}){return this.isValid?Se.create(this.loc.clone(t),e).formatDateTime(this):hn}toLocaleParts(e={}){return this.isValid?Se.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:s=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=vr(o);const l=e==="extended";let a=pn(this,l,o);return kr.indexOf(o)>=3&&(a+="T"),a+=vi(this,l,t,n,s,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?pn(this,e==="extended",vr(t)):null}toISOWeekDate(){return _r(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:s=!1,extendedZone:i=!1,format:o="extended",precision:l="milliseconds"}={}){return this.isValid?(l=vr(l),(s&&kr.indexOf(l)>=3?"T":"")+vi(this,o==="extended",t,e,n,i,l)):null}toRFC2822(){return _r(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return _r(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?pn(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(n&&(s+=" "),t?s+="z":e&&(s+="ZZ")),_r(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():hn}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return G.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=Wa(t).map(G.normalizeUnit),o=e.valueOf()>this.valueOf(),l=o?this:e,a=o?e:this,u=zl(l,a,i,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(U.now(),e,t)}until(e){return this.isValid?le.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const s=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=s&&s<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||U.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let s=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(s=e.unit,i=void 0),Ai(t,this.plus(n),{...e,numeric:"always",units:s,unit:i})}toRelativeCalendar(e={}){return this.isValid?Ai(e.base||U.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(U.isDateTime))throw new be("min requires all arguments be DateTimes");return $s(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(U.isDateTime))throw new be("max requires all arguments be DateTimes");return $s(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:s=null,numberingSystem:i=null}=n,o=Q.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});return wi(o,e,t)}static fromStringExplain(e,t,n={}){return U.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:s=null}=t,i=Q.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});return new yi(i,e)}static fromFormatParser(e,t,n={}){if(W(e)||W(t))throw new be("fromFormatParser requires an input string and a format parser");const{locale:s=null,numberingSystem:i=null}=n,o=Q.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new be(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:l,zone:a,specificOffset:u,invalidReason:c}=t.explainFromTokens(e);return c?U.invalid(c):Dt(l,a,n,`format ${t.format}`,e,u)}static get DATE_SHORT(){return ar}static get DATE_MED(){return Xn}static get DATE_MED_WITH_WEEKDAY(){return ga}static get DATE_FULL(){return es}static get DATE_HUGE(){return ts}static get TIME_SIMPLE(){return rs}static get TIME_WITH_SECONDS(){return ns}static get TIME_WITH_SHORT_OFFSET(){return ss}static get TIME_WITH_LONG_OFFSET(){return is}static get TIME_24_SIMPLE(){return os}static get TIME_24_WITH_SECONDS(){return as}static get TIME_24_WITH_SHORT_OFFSET(){return ls}static get TIME_24_WITH_LONG_OFFSET(){return cs}static get DATETIME_SHORT(){return us}static get DATETIME_SHORT_WITH_SECONDS(){return hs}static get DATETIME_MED(){return fs}static get DATETIME_MED_WITH_SECONDS(){return ds}static get DATETIME_MED_WITH_WEEKDAY(){return ma}static get DATETIME_FULL(){return ps}static get DATETIME_FULL_WITH_SECONDS(){return gs}static get DATETIME_HUGE(){return ms}static get DATETIME_HUGE_WITH_SECONDS(){return ys}}function Kt(r){if(U.isDateTime(r))return r;if(r&&r.valueOf&&ct(r.valueOf()))return U.fromJSDate(r);if(r&&typeof r=="object")return U.fromObject(r);throw new be(`Unknown datetime argument: ${r}, of type ${typeof r}`)}const me=[];for(let r=0;r<256;++r)me.push((r+256).toString(16).slice(1));function cc(r,e,t,n){return()=>{r|=0,e|=0,t|=0,n|=0;const s=(r+e|0)+n|0;return n=n+1|0,r=e^e>>>9,e=t+(t<<3)|0,t=(t<<21|t>>>11)+s|0,s>>>0}}function uc(){const r=new Uint8Array(16),e=BigInt(Date.now()),t=BigInt(Math.floor(performance.now()*1e3)%65535),n=e<<16n|t;r[0]=Number(n>>40n&0xffn),r[1]=Number(n>>32n&0xffn),r[2]=Number(n>>24n&0xffn),r[3]=Number(n>>16n&0xffn),r[4]=Number(n>>8n&0xffn),r[5]=Number(n&0xffn);const s=(Math.random()*4294967295^Date.now()^performance.now())>>>0,i=cc(2654435769,608135816,3084996962,s),o=new DataView(r.buffer);return o.setUint32(6,i()),o.setUint32(10,i()),o.setUint16(14,i()),r[6]=112|r[6]&15,r[8]=128|r[8]&63,(me[r[0]]+me[r[1]]+me[r[2]]+me[r[3]]+"-"+me[r[4]]+me[r[5]]+"-"+me[r[6]]+me[r[7]]+"-"+me[r[8]]+me[r[9]]+"-"+me[r[10]]+me[r[11]]+me[r[12]]+me[r[13]]+me[r[14]]+me[r[15]]).toLowerCase()}const hc=/[&<>'"]/g,fc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,dc={"&":"&","<":"<",">":">","'":"'",'"':"""},pc={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","&apos":"'","'":"'",""":'"',""":'"'};class gc{getRandom(e=8){return[...Array(e)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return uc()}encode(e){return C.isString(e)?e.replace(hc,t=>dc[t]):e}decode(e){return C.isString(e)?e.replace(fc,t=>pc[t]):e}toNumber(e){const t=Number.parseFloat(e);return C.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const n=C.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(n)}toCamelCase(e){if(!C.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(n,s)=>s?s.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return C.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!C.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return t?t.map(n=>n.toLowerCase()).join("-"):e}capitalize(e){return C.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,n=".",s=","){const i=Number.isFinite(e)?e:0,o=Number.isFinite(t)?Math.abs(t):0,l=(o?((a,u)=>{const c=Math.pow(10,u);return Math.round(a*c)/c})(i,o):Math.round(i)).toString().split(".");return l[0].length>3&&(l[0]=l[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,s)),(l[1]||"").length<o&&(l[1]=l[1]||"",l[1]+=new Array(o-l[1].length+1).join("0")),l.join(n)}toDateTime(e,t,n){return!(typeof t>"u")&&C.isStringFilled(t)?U.fromFormat(e,t,n):U.fromISO(e,n)}getDateForLog(){return U.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const s=e[n];C.isArray(s)?s.forEach((i,o)=>{t+=encodeURIComponent(n+"["+o+"]")+"="+encodeURIComponent(i)+"&"}):t+=encodeURIComponent(n)+"="+encodeURIComponent(s)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const V=new gc;let pe="";try{pe=navigator?.userAgent.toLowerCase()}catch{pe="?"}let mc=class{isOpera(){return pe.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return pe.includes("msie 6")}isIE7(){return pe.includes("msie 7")}isIE8(){return pe.includes("msie 8")}isIE9(){return"documentMode"in document&&document.documentMode>=9}isIE10(){return"documentMode"in document&&document.documentMode>=10}isSafari(){return pe.includes("safari")&&!pe.includes("chrome")}isFirefox(){return pe.includes("firefox")}isChrome(){return pe.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=new RegExp("MSIE ([0-9]+[.0-9]*)"),n=navigator.userAgent.match(t);C.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}if(navigator.appName==="Netscape"){e=11;const t=new RegExp("Trident/.*rv:([0-9]+[.0-9]*)");if(t.exec(navigator.userAgent)!=null){const n=navigator.userAgent.match(t);C.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return pe.includes("macintosh")}isWin(){return pe.includes("windows")}isLinux(){return pe.includes("linux")&&!this.isAndroid()}isAndroid(){return pe.includes("android")}isIPad(){return pe.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return pe.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||pe.includes("mobile")||pe.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=new RegExp("Android ([0-9]+[.0-9]*)");if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(C.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const Ci=new mc,Ni={sleep:1e3,speed:.001,amount:30},mn={sleep:600,speed:.01,amount:150};var Ri=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r.order="ORDER",r))(Ri||{}),Ve=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r[r.order=14]="order",r))(Ve||{}),yn=(r=>(r.undefined="?",r.lead="L",r.deal="D",r.contact="C",r.company="CO",r.oldInvoice="I",r.invoice="SI",r.quote="Q",r.requisite="RQ",r.order="O",r))(yn||{});function yc(r){const e=Ve[r];return yn[e]||"?"}var Li=(r=>(r[r.undefined=0]="undefined",r[r.absolute=1]="absolute",r[r.percentage=2]="percentage",r))(Li||{}),Pi=(r=>(r[r.undefined=0]="undefined",r[r.product=1]="product",r[r.service=7]="service",r[r.sku=3]="sku",r[r.skuEmpty=6]="skuEmpty",r[r.offer=4]="offer",r[r.offerEmpty=5]="offerEmpty",r))(Pi||{}),Di=(r=>(r.undefined="UNDEFINED",r.detail="DETAIL_PICTURE",r.preview="PREVIEW_PICTURE",r.morePhoto="MORE_PHOTO",r))(Di||{}),Mi=(r=>(r[r.undefined=0]="undefined",r[r.mathematical=1]="mathematical",r[r.roundingUp=2]="roundingUp",r[r.roundingDown=4]="roundingDown",r))(Mi||{}),Fi=(r=>(r.undefined="undefined",r.b24="b24",r.box="box",r))(Fi||{}),xi=(r=>(r.undefined="undefined",r.crm="crm",r.disk="disk",r.lists="lists",r))(xi||{}),ji=(r=>(r.undefined="undefined",r.lead="CCrmDocumentLead",r.company="CCrmDocumentCompany",r.contact="CCrmDocumentContact",r.deal="CCrmDocumentDeal",r.invoice="Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",r.quote="Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",r.order="Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",r.dynamic="Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",r.disk="Bitrix\\Disk\\BizProcDocument",r.lists="BizprocDocument",r.listsList="Bitrix\\Lists\\BizprocDocumentLists",r))(ji||{});function wc(r){switch(r){case"CCrmDocumentLead":return Ve.lead;case"CCrmDocumentCompany":return Ve.company;case"CCrmDocumentContact":return Ve.contact;case"CCrmDocumentDeal":return Ve.deal;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":return Ve.invoice;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":return Ve.quote;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":return Ve.order}return Ve.undefined}function wn(r,e){let t="",n="undefined";switch(r){case"CCrmDocumentLead":n="crm",t="LEAD";break;case"CCrmDocumentCompany":n="crm",t="COMPANY";break;case"CCrmDocumentContact":n="crm",t="CONTACT";break;case"CCrmDocumentDeal":n="crm",t="DEAL";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":n="crm",t="SMART_INVOICE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":n="crm",t="QUOTE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":n="crm",t="ORDER";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(n="crm",t=`DYNAMIC_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Disk\\BizProcDocument":if(n="disk",t=`STORAGE_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"BizprocDocument":if(n="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Lists\\BizprocDocumentLists":if(n="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break}return[n,r,t]}function bc(r,e,t){let n="";const s=wn(r,1);switch(r){case"CCrmDocumentLead":n=`LEAD_${e}`;break;case"CCrmDocumentCompany":n=`COMPANY_${e}`;break;case"CCrmDocumentContact":n=`CONTACT_${e}`;break;case"CCrmDocumentDeal":n=`DEAL_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":n=`SMART_INVOICE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":n=`QUOTE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":n=`ORDER_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(n=`DYNAMIC_${t||0}_${e}`,(t||0)<1)throw new Error("Need set dynamicId");break;case"Bitrix\\Disk\\BizProcDocument":n=`${e}`;break;case"BizprocDocument":n=`${e}`;break;case"Bitrix\\Lists\\BizprocDocumentLists":n=`${e}`;break}return[s[0],s[1],n]}function Sc(r){const e=wn(r,1);return[e[0],e[1]]}var ne=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(ne||{});const et={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},Bi={[et.Free]:"Free",[et.Demo]:"Demo",[et.Trial]:"Trial",[et.Paid]:"Paid",[et.Local]:"Local",[et.Subscription]:"Subscription"},yt={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var tt=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(tt||{}),se=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(se||{}),Re=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(Re||{}),Le=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(Le||{}),Er=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Er||{}),Pe=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(Pe||{}),_e=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(_e||{}),Qt=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(Qt||{}),bn=(r=>(r.Shared="shared",r.Personal="personal",r))(bn||{});const Sn={Parse:{code:-32700,message:"Parse error"},InvalidRequest:{code:-32600,message:"Invalid Request"},MethodNotFound:{code:-32601,message:"Method not found"},InvalidParams:{code:-32602,message:"Invalid params"},Internal:{code:-32603,message:"Internal error"}};var Je=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(Je||{});class qe{_errors;_data;constructor(e){this._errors=new Map,this._data=e??null}get isSuccess(){return this._errors.size===0}get errors(){return this._errors}setData(e){return this._data=e,this}getData(){return this._data}addError(e,t){const n=t??V.getUuidRfc4122(),s=typeof e=="string"?new Error(e):e;return this._errors.set(n,s),this}addErrors(e){for(const t of e)this.addError(t);return this}getErrors(){return this._errors.values()}hasError(e){return this._errors.has(e)}getErrorMessages(){return Array.from(this._errors.values(),e=>e.message)}toString(){const e=this.isSuccess?"success":"failure",t=this.safeStringify(this._data);return this.isSuccess?`Result(${e}): ${t}`:`Result(${e}): ${t}
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var Oy=Object.defineProperty;var a=(R,W)=>Oy(R,"name",{value:W,configurable:!0});/**
|
|
2
|
+
* @package @bitrix24/b24jssdk
|
|
3
|
+
* @version 1.0.2
|
|
4
|
+
* @copyright (c) 2026 Bitrix24
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @see https://github.com/bitrix24/b24jssdk
|
|
7
|
+
* @see https://bitrix24.github.io/b24jssdk/
|
|
8
|
+
*/(function(R,W){typeof exports=="object"&&typeof module<"u"?W(exports):typeof define=="function"&&define.amd?define(["exports"],W):(R=typeof globalThis<"u"?globalThis:R||self,W(R.B24Js={}))})(this,(function(R){"use strict";var W=(r=>(r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.NOTICE=2]="NOTICE",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r[r.CRITICAL=5]="CRITICAL",r[r.ALERT=6]="ALERT",r[r.EMERGENCY=7]="EMERGENCY",r))(W||{});class vt extends Error{static{a(this,"LuxonError")}}class Ac extends vt{static{a(this,"InvalidDateTimeError")}constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Rc extends vt{static{a(this,"InvalidIntervalError")}constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Cc extends vt{static{a(this,"InvalidDurationError")}constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Lt extends vt{static{a(this,"ConflictingSpecificationError")}}class Pn extends vt{static{a(this,"InvalidUnitError")}constructor(e){super(`Invalid unit ${e}`)}}class Ie extends vt{static{a(this,"InvalidArgumentError")}}class pt extends vt{static{a(this,"ZoneIsAbstractError")}constructor(){super("Zone is an abstract class")}}const D="numeric",Ye="short",je="long",wr={year:D,month:D,day:D},Fn={year:D,month:Ye,day:D},Nc={year:D,month:Ye,day:D,weekday:Ye},xn={year:D,month:je,day:D},$n={year:D,month:je,day:D,weekday:je},Bn={hour:D,minute:D},jn={hour:D,minute:D,second:D},Un={hour:D,minute:D,second:D,timeZoneName:Ye},Vn={hour:D,minute:D,second:D,timeZoneName:je},qn={hour:D,minute:D,hourCycle:"h23"},Wn={hour:D,minute:D,second:D,hourCycle:"h23"},Hn={hour:D,minute:D,second:D,hourCycle:"h23",timeZoneName:Ye},zn={hour:D,minute:D,second:D,hourCycle:"h23",timeZoneName:je},Jn={year:D,month:D,day:D,hour:D,minute:D},Gn={year:D,month:D,day:D,hour:D,minute:D,second:D},Yn={year:D,month:Ye,day:D,hour:D,minute:D},Zn={year:D,month:Ye,day:D,hour:D,minute:D,second:D},Dc={year:D,month:Ye,day:D,weekday:Ye,hour:D,minute:D},Kn={year:D,month:je,day:D,hour:D,minute:D,timeZoneName:Ye},Xn={year:D,month:je,day:D,hour:D,minute:D,second:D,timeZoneName:Ye},Qn={year:D,month:je,day:D,weekday:je,hour:D,minute:D,timeZoneName:je},ei={year:D,month:je,day:D,weekday:je,hour:D,minute:D,second:D,timeZoneName:je};class Zt{static{a(this,"Zone")}get type(){throw new pt}get name(){throw new pt}get ianaName(){return this.name}get isUniversal(){throw new pt}offsetName(e,t){throw new pt}formatOffset(e,t){throw new pt}offset(e){throw new pt}equals(e){throw new pt}get isValid(){throw new pt}}let hs=null;class Sr extends Zt{static{a(this,"SystemZone")}static get instance(){return hs===null&&(hs=new Sr),hs}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return Ti(e,t,s)}formatOffset(e,t){return er(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const ds=new Map;function Mc(r){let e=ds.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),ds.set(r,e)),e}a(Mc,"makeDTF");const Lc={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Pc(r,e){const t=r.format(e).replace(/\u200E/g,""),s=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,n,i,c,o,u,d,l]=s;return[c,n,i,o,u,d,l]}a(Pc,"hackyOffset");function Fc(r,e){const t=r.formatToParts(e),s=[];for(let n=0;n<t.length;n++){const{type:i,value:c}=t[n],o=Lc[i];i==="era"?s[o]=c:J(o)||(s[o]=parseInt(c,10))}return s}a(Fc,"partsOffset");const fs=new Map;class at extends Zt{static{a(this,"IANAZone")}static create(e){let t=fs.get(e);return t===void 0&&fs.set(e,t=new at(e)),t}static resetCache(){fs.clear(),ds.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=at.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return Ti(e,t,s,this.name)}formatOffset(e,t){return er(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const s=Mc(this.name);let[n,i,c,o,u,d,l]=s.formatToParts?Fc(s,t):Pc(s,t);o==="BC"&&(n=-Math.abs(n)+1);const f=Tr({year:n,month:i,day:c,hour:u===24?0:u,minute:d,second:l,millisecond:0});let p=+t;const h=p%1e3;return p-=h>=0?h:1e3+h,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ti={};function xc(r,e={}){const t=JSON.stringify([r,e]);let s=ti[t];return s||(s=new Intl.ListFormat(r,e),ti[t]=s),s}a(xc,"getCachedLF");const ps=new Map;function gs(r,e={}){const t=JSON.stringify([r,e]);let s=ps.get(t);return s===void 0&&(s=new Intl.DateTimeFormat(r,e),ps.set(t,s)),s}a(gs,"getCachedDTF");const ms=new Map;function $c(r,e={}){const t=JSON.stringify([r,e]);let s=ms.get(t);return s===void 0&&(s=new Intl.NumberFormat(r,e),ms.set(t,s)),s}a($c,"getCachedINF");const ys=new Map;function Bc(r,e={}){const{base:t,...s}=e,n=JSON.stringify([r,s]);let i=ys.get(n);return i===void 0&&(i=new Intl.RelativeTimeFormat(r,e),ys.set(n,i)),i}a(Bc,"getCachedRTF");let Kt=null;function jc(){return Kt||(Kt=new Intl.DateTimeFormat().resolvedOptions().locale,Kt)}a(jc,"systemLocale");const bs=new Map;function ri(r){let e=bs.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),bs.set(r,e)),e}a(ri,"getCachedIntResolvedOptions");const _s=new Map;function Uc(r){let e=_s.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...si,...e}),_s.set(r,e)}return e}a(Uc,"getCachedWeekInfo");function Vc(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let s,n;try{s=gs(r).resolvedOptions(),n=r}catch{const u=r.substring(0,t);s=gs(u).resolvedOptions(),n=u}const{numberingSystem:i,calendar:c}=s;return[n,i,c]}}a(Vc,"parseLocaleString");function qc(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}a(qc,"intlConfigString");function Wc(r){const e=[];for(let t=1;t<=12;t++){const s=V.utc(2009,t,1);e.push(r(s))}return e}a(Wc,"mapMonths");function Hc(r){const e=[];for(let t=1;t<=7;t++){const s=V.utc(2016,11,13+t);e.push(r(s))}return e}a(Hc,"mapWeekdays");function vr(r,e,t,s){const n=r.listingMode();return n==="error"?null:n==="en"?t(e):s(e)}a(vr,"listStuff");function zc(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||ri(r.locale).numberingSystem==="latn"}a(zc,"supportsFastNumbers");class Jc{static{a(this,"PolyNumberFormatter")}constructor(e,t,s){this.padTo=s.padTo||0,this.floor=s.floor||!1;const{padTo:n,floor:i,...c}=s;if(!t||Object.keys(c).length>0){const o={useGrouping:!1,...s};s.padTo>0&&(o.minimumIntegerDigits=s.padTo),this.inf=$c(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):As(e,3);return _e(t,this.padTo)}}}class Gc{static{a(this,"PolyDateFormatter")}constructor(e,t,s){this.opts=s,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const c=-1*(e.offset/60),o=c>=0?`Etc/GMT+${c}`:`Etc/GMT${c}`;e.offset!==0&&at.create(o).valid?(n=o,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=gs(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const s=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:s}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Yc{static{a(this,"PolyRelFormatter")}constructor(e,t,s){this.opts={style:"long",...s},!t&&vi()&&(this.rtf=Bc(e,s))}format(e,t){return this.rtf?this.rtf.format(e,t):yl(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const si={firstDay:1,minimalDays:4,weekend:[6,7]};class se{static{a(this,"Locale")}static fromOpts(e){return se.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,s,n,i=!1){const c=e||fe.defaultLocale,o=c||(i?"en-US":jc()),u=t||fe.defaultNumberingSystem,d=s||fe.defaultOutputCalendar,l=Ts(n)||fe.defaultWeekSettings;return new se(o,u,d,l,c)}static resetCache(){Kt=null,ps.clear(),ms.clear(),ys.clear(),bs.clear(),_s.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:s,weekSettings:n}={}){return se.create(e,t,s,n)}constructor(e,t,s,n,i){const[c,o,u]=Vc(e);this.locale=c,this.numberingSystem=t||o||null,this.outputCalendar=s||u||null,this.weekSettings=n,this.intl=qc(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=zc(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:se.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Ts(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return vr(this,e,Ri,()=>{const s=this.intl==="ja"||this.intl.startsWith("ja-");t&=!s;const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const c=s?o=>this.dtFormatter(o,n).format():o=>this.extract(o,n,"month");this.monthsCache[i][e]=Wc(c)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return vr(this,e,Di,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=Hc(i=>this.extract(i,s,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return vr(this,void 0,()=>Mi,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[V.utc(2016,11,13,9),V.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return vr(this,e,Li,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[V.utc(-40,1,1),V.utc(2017,1,1)].map(s=>this.extract(s,t,"era"))),this.eraCache[e]})}extract(e,t,s){const n=this.dtFormatter(e,t),i=n.formatToParts(),c=i.find(o=>o.type.toLowerCase()===s);return c?c.value:null}numberFormatter(e={}){return new Jc(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Gc(e,this.intl,t)}relFormatter(e={}){return new Yc(this.intl,this.isEnglish(),e)}listFormatter(e={}){return xc(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ri(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ei()?Uc(this.locale):si}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let ws=null;class Me extends Zt{static{a(this,"FixedOffsetZone")}static get utcInstance(){return ws===null&&(ws=new Me(0)),ws}static instance(e){return e===0?Me.utcInstance:new Me(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Me(Ir(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${er(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${er(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return er(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Zc extends Zt{static{a(this,"InvalidZone")}constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function gt(r,e){if(J(r)||r===null)return e;if(r instanceof Zt)return r;if(rl(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Sr.instance:t==="utc"||t==="gmt"?Me.utcInstance:Me.parseSpecifier(t)||at.create(r)}else return mt(r)?Me.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new Zc(r)}a(gt,"normalizeZone");const Ss={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},ni={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Kc=Ss.hanidec.replace(/[\[|\]]/g,"").split("");function Xc(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const s=r.charCodeAt(t);if(r[t].search(Ss.hanidec)!==-1)e+=Kc.indexOf(r[t]);else for(const n in ni){const[i,c]=ni[n];s>=i&&s<=c&&(e+=s-i)}}return parseInt(e,10)}else return e}a(Xc,"parseDigits");const vs=new Map;function Qc(){vs.clear()}a(Qc,"resetDigitRegexCache");function Ze({numberingSystem:r},e=""){const t=r||"latn";let s=vs.get(t);s===void 0&&(s=new Map,vs.set(t,s));let n=s.get(e);return n===void 0&&(n=new RegExp(`${Ss[t]}${e}`),s.set(e,n)),n}a(Ze,"digitRegex");let ii=a(()=>Date.now(),"now"),oi="system",ai=null,ci=null,li=null,ui=60,hi,di=null;class fe{static{a(this,"Settings")}static get now(){return ii}static set now(e){ii=e}static set defaultZone(e){oi=e}static get defaultZone(){return gt(oi,Sr.instance)}static get defaultLocale(){return ai}static set defaultLocale(e){ai=e}static get defaultNumberingSystem(){return ci}static set defaultNumberingSystem(e){ci=e}static get defaultOutputCalendar(){return li}static set defaultOutputCalendar(e){li=e}static get defaultWeekSettings(){return di}static set defaultWeekSettings(e){di=Ts(e)}static get twoDigitCutoffYear(){return ui}static set twoDigitCutoffYear(e){ui=e%100}static get throwOnInvalid(){return hi}static set throwOnInvalid(e){hi=e}static resetCaches(){se.resetCache(),at.resetCache(),V.resetCache(),Qc()}}class Ke{static{a(this,"Invalid")}constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const fi=[0,31,59,90,120,151,181,212,243,273,304,334],pi=[0,31,60,91,121,152,182,213,244,274,305,335];function He(r,e){return new Ke("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}a(He,"unitOutOfRange");function Es(r,e,t){const s=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&s.setUTCFullYear(s.getUTCFullYear()-1900);const n=s.getUTCDay();return n===0?7:n}a(Es,"dayOfWeek");function gi(r,e,t){return t+(Xt(r)?pi:fi)[e-1]}a(gi,"computeOrdinal");function mi(r,e){const t=Xt(r)?pi:fi,s=t.findIndex(i=>i<e),n=e-t[s];return{month:s+1,day:n}}a(mi,"uncomputeOrdinal");function Os(r,e){return(r-e+7)%7+1}a(Os,"isoWeekdayToLocal");function Er(r,e=4,t=1){const{year:s,month:n,day:i}=r,c=gi(s,n,i),o=Os(Es(s,n,i),t);let u=Math.floor((c-o+14-e)/7),d;return u<1?(d=s-1,u=Qt(d,e,t)):u>Qt(s,e,t)?(d=s+1,u=1):d=s,{weekYear:d,weekNumber:u,weekday:o,...Rr(r)}}a(Er,"gregorianToWeek");function yi(r,e=4,t=1){const{weekYear:s,weekNumber:n,weekday:i}=r,c=Os(Es(s,1,e),t),o=Ft(s);let u=n*7+i-c-7+e,d;u<1?(d=s-1,u+=Ft(d)):u>o?(d=s+1,u-=Ft(s)):d=s;const{month:l,day:g}=mi(d,u);return{year:d,month:l,day:g,...Rr(r)}}a(yi,"weekToGregorian");function ks(r){const{year:e,month:t,day:s}=r,n=gi(e,t,s);return{year:e,ordinal:n,...Rr(r)}}a(ks,"gregorianToOrdinal");function bi(r){const{year:e,ordinal:t}=r,{month:s,day:n}=mi(e,t);return{year:e,month:s,day:n,...Rr(r)}}a(bi,"ordinalToGregorian");function _i(r,e){if(!J(r.localWeekday)||!J(r.localWeekNumber)||!J(r.localWeekYear)){if(!J(r.weekday)||!J(r.weekNumber)||!J(r.weekYear))throw new Lt("Cannot mix locale-based week fields with ISO-based week fields");return J(r.localWeekday)||(r.weekday=r.localWeekday),J(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),J(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}a(_i,"usesLocalWeekValues");function el(r,e=4,t=1){const s=Or(r.weekYear),n=ze(r.weekNumber,1,Qt(r.weekYear,e,t)),i=ze(r.weekday,1,7);return s?n?i?!1:He("weekday",r.weekday):He("week",r.weekNumber):He("weekYear",r.weekYear)}a(el,"hasInvalidWeekData");function tl(r){const e=Or(r.year),t=ze(r.ordinal,1,Ft(r.year));return e?t?!1:He("ordinal",r.ordinal):He("year",r.year)}a(tl,"hasInvalidOrdinalData");function wi(r){const e=Or(r.year),t=ze(r.month,1,12),s=ze(r.day,1,kr(r.year,r.month));return e?t?s?!1:He("day",r.day):He("month",r.month):He("year",r.year)}a(wi,"hasInvalidGregorianData");function Si(r){const{hour:e,minute:t,second:s,millisecond:n}=r,i=ze(e,0,23)||e===24&&t===0&&s===0&&n===0,c=ze(t,0,59),o=ze(s,0,59),u=ze(n,0,999);return i?c?o?u?!1:He("millisecond",n):He("second",s):He("minute",t):He("hour",e)}a(Si,"hasInvalidTimeData");function J(r){return typeof r>"u"}a(J,"isUndefined$1");function mt(r){return typeof r=="number"}a(mt,"isNumber$1");function Or(r){return typeof r=="number"&&r%1===0}a(Or,"isInteger");function rl(r){return typeof r=="string"}a(rl,"isString$1");function sl(r){return Object.prototype.toString.call(r)==="[object Date]"}a(sl,"isDate$1");function vi(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}a(vi,"hasRelative");function Ei(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}a(Ei,"hasLocaleWeekInfo");function nl(r){return Array.isArray(r)?r:[r]}a(nl,"maybeArray");function Oi(r,e,t){if(r.length!==0)return r.reduce((s,n)=>{const i=[e(n),n];return s&&t(s[0],i[0])===s[0]?s:i},null)[1]}a(Oi,"bestBy");function il(r,e){return e.reduce((t,s)=>(t[s]=r[s],t),{})}a(il,"pick$1");function Pt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}a(Pt,"hasOwnProperty$1");function Ts(r){if(r==null)return null;if(typeof r!="object")throw new Ie("Week settings must be an object");if(!ze(r.firstDay,1,7)||!ze(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!ze(e,1,7)))throw new Ie("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}a(Ts,"validateWeekSettings");function ze(r,e,t){return Or(r)&&r>=e&&r<=t}a(ze,"integerBetween");function ol(r,e){return r-e*Math.floor(r/e)}a(ol,"floorMod");function _e(r,e=2){const t=r<0;let s;return t?s="-"+(""+-r).padStart(e,"0"):s=(""+r).padStart(e,"0"),s}a(_e,"padStart");function yt(r){if(!(J(r)||r===null||r===""))return parseInt(r,10)}a(yt,"parseInteger");function Et(r){if(!(J(r)||r===null||r===""))return parseFloat(r)}a(Et,"parseFloating");function Is(r){if(!(J(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}a(Is,"parseMillis");function As(r,e,t="round"){const s=10**e;switch(t){case"expand":return r>0?Math.ceil(r*s)/s:Math.floor(r*s)/s;case"trunc":return Math.trunc(r*s)/s;case"round":return Math.round(r*s)/s;case"floor":return Math.floor(r*s)/s;case"ceil":return Math.ceil(r*s)/s;default:throw new RangeError(`Value rounding ${t} is out of range`)}}a(As,"roundTo");function Xt(r){return r%4===0&&(r%100!==0||r%400===0)}a(Xt,"isLeapYear");function Ft(r){return Xt(r)?366:365}a(Ft,"daysInYear");function kr(r,e){const t=ol(e-1,12)+1,s=r+(e-t)/12;return t===2?Xt(s)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}a(kr,"daysInMonth");function Tr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}a(Tr,"objToLocalTS");function ki(r,e,t){return-Os(Es(r,1,e),t)+e-1}a(ki,"firstWeekOffset");function Qt(r,e=4,t=1){const s=ki(r,e,t),n=ki(r+1,e,t);return(Ft(r)-s+n)/7}a(Qt,"weeksInWeekYear");function Rs(r){return r>99?r:r>fe.twoDigitCutoffYear?1900+r:2e3+r}a(Rs,"untruncateYear");function Ti(r,e,t,s=null){const n=new Date(r),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};s&&(i.timeZone=s);const c={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,c).formatToParts(n).find(u=>u.type.toLowerCase()==="timezonename");return o?o.value:null}a(Ti,"parseZoneInfo");function Ir(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const s=parseInt(e,10)||0,n=t<0||Object.is(t,-0)?-s:s;return t*60+n}a(Ir,"signedOffset");function Ii(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new Ie(`Invalid unit value ${r}`);return e}a(Ii,"asNumber");function Ar(r,e){const t={};for(const s in r)if(Pt(r,s)){const n=r[s];if(n==null)continue;t[e(s)]=Ii(n)}return t}a(Ar,"normalizeObject");function er(r,e){const t=Math.trunc(Math.abs(r/60)),s=Math.trunc(Math.abs(r%60)),n=r>=0?"+":"-";switch(e){case"short":return`${n}${_e(t,2)}:${_e(s,2)}`;case"narrow":return`${n}${t}${s>0?`:${s}`:""}`;case"techie":return`${n}${_e(t,2)}${_e(s,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}a(er,"formatOffset");function Rr(r){return il(r,["hour","minute","second","millisecond"])}a(Rr,"timeObject");const al=["January","February","March","April","May","June","July","August","September","October","November","December"],Ai=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],cl=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ri(r){switch(r){case"narrow":return[...cl];case"short":return[...Ai];case"long":return[...al];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}a(Ri,"months");const Ci=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ni=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ll=["M","T","W","T","F","S","S"];function Di(r){switch(r){case"narrow":return[...ll];case"short":return[...Ni];case"long":return[...Ci];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}a(Di,"weekdays");const Mi=["AM","PM"],ul=["Before Christ","Anno Domini"],hl=["BC","AD"],dl=["B","A"];function Li(r){switch(r){case"narrow":return[...dl];case"short":return[...hl];case"long":return[...ul];default:return null}}a(Li,"eras");function fl(r){return Mi[r.hour<12?0:1]}a(fl,"meridiemForDateTime");function pl(r,e){return Di(e)[r.weekday-1]}a(pl,"weekdayForDateTime");function gl(r,e){return Ri(e)[r.month-1]}a(gl,"monthForDateTime");function ml(r,e){return Li(e)[r.year<0?0:1]}a(ml,"eraForDateTime");function yl(r,e,t="always",s=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&i){const g=r==="days";switch(e){case 1:return g?"tomorrow":`next ${n[r][0]}`;case-1:return g?"yesterday":`last ${n[r][0]}`;case 0:return g?"today":`this ${n[r][0]}`}}const c=Object.is(e,-0)||e<0,o=Math.abs(e),u=o===1,d=n[r],l=s?u?d[1]:d[2]||d[1]:u?n[r][0]:r;return c?`${o} ${l} ago`:`in ${o} ${l}`}a(yl,"formatRelativeTime");function Pi(r,e){let t="";for(const s of r)s.literal?t+=s.val:t+=e(s.val);return t}a(Pi,"stringifyTokens");const bl={D:wr,DD:Fn,DDD:xn,DDDD:$n,t:Bn,tt:jn,ttt:Un,tttt:Vn,T:qn,TT:Wn,TTT:Hn,TTTT:zn,f:Jn,ff:Yn,fff:Kn,ffff:Qn,F:Gn,FF:Zn,FFF:Xn,FFFF:ei};class Ae{static{a(this,"Formatter")}static create(e,t={}){return new Ae(e,t)}static parseFormat(e){let t=null,s="",n=!1;const i=[];for(let c=0;c<e.length;c++){const o=e.charAt(c);o==="'"?((s.length>0||n)&&i.push({literal:n||/^\s+$/.test(s),val:s===""?"'":s}),t=null,s="",n=!n):n||o===t?s+=o:(s.length>0&&i.push({literal:/^\s+$/.test(s),val:s}),s=o,t=o)}return s.length>0&&i.push({literal:n||/^\s+$/.test(s),val:s}),i}static macroTokenToFormatOpts(e){return bl[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,s=void 0){if(this.opts.forceSimple)return _e(e,t);const n={...this.opts};return t>0&&(n.padTo=t),s&&(n.signDisplay=s),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const s=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=a((p,h)=>this.loc.extract(e,p,h),"string"),c=a(p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"","formatOffset"),o=a(()=>s?fl(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),"meridiem"),u=a((p,h)=>s?gl(e,p):i(h?{month:p}:{month:p,day:"numeric"},"month"),"month"),d=a((p,h)=>s?pl(e,p):i(h?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),"weekday"),l=a(p=>{const h=Ae.macroTokenToFormatOpts(p);return h?this.formatWithSystemDefault(e,h):p},"maybeMacro"),g=a(p=>s?ml(e,p):i({era:p},"era"),"era"),f=a(p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return c({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return c({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return c({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?i({day:"numeric"},"day"):this.num(e.day);case"dd":return n?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return d("short",!0);case"cccc":return d("long",!0);case"ccccc":return d("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return d("short",!1);case"EEEE":return d("long",!1);case"EEEEE":return d("narrow",!1);case"L":return n?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return n?i({month:"numeric"},"month"):this.num(e.month);case"MM":return n?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return n?i({year:"numeric"},"year"):this.num(e.year);case"yy":return n?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(p)}},"tokenToString");return Pi(Ae.parseFormat(t),f)}formatDurationFromString(e,t){const s=this.opts.signMode==="negativeLargestOnly"?-1:1,n=a(l=>{switch(l[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},"tokenToField"),i=a((l,g)=>f=>{const p=n(f);if(p){const h=g.isNegativeDuration&&p!==g.largestUnit?s:1;let m;return this.opts.signMode==="negativeLargestOnly"&&p!==g.largestUnit?m="never":this.opts.signMode==="all"?m="always":m="auto",this.num(l.get(p)*h,f.length,m)}else return f},"tokenToString"),c=Ae.parseFormat(t),o=c.reduce((l,{literal:g,val:f})=>g?l:l.concat(f),[]),u=e.shiftTo(...o.map(n).filter(l=>l)),d={isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]};return Pi(c,i(u,d))}}const Fi=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function xt(...r){const e=r.reduce((t,s)=>t+s.source,"");return RegExp(`^${e}$`)}a(xt,"combineRegexes");function $t(...r){return e=>r.reduce(([t,s,n],i)=>{const[c,o,u]=i(e,n);return[{...t,...c},o||s,u]},[{},null,1]).slice(0,2)}a($t,"combineExtractors");function Bt(r,...e){if(r==null)return[null,null];for(const[t,s]of e){const n=t.exec(r);if(n)return s(n)}return[null,null]}a(Bt,"parse");function xi(...r){return(e,t)=>{const s={};let n;for(n=0;n<r.length;n++)s[r[n]]=yt(e[t+n]);return[s,null,t+n]}}a(xi,"simpleParse");const $i=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,_l=`(?:${$i.source}?(?:\\[(${Fi.source})\\])?)?`,Cs=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Bi=RegExp(`${Cs.source}${_l}`),Ns=RegExp(`(?:[Tt]${Bi.source})?`),wl=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Sl=/(\d{4})-?W(\d\d)(?:-?(\d))?/,vl=/(\d{4})-?(\d{3})/,El=xi("weekYear","weekNumber","weekDay"),Ol=xi("year","ordinal"),kl=/(\d{4})-(\d\d)-(\d\d)/,ji=RegExp(`${Cs.source} ?(?:${$i.source}|(${Fi.source}))?`),Tl=RegExp(`(?: ${ji.source})?`);function jt(r,e,t){const s=r[e];return J(s)?t:yt(s)}a(jt,"int");function Il(r,e){return[{year:jt(r,e),month:jt(r,e+1,1),day:jt(r,e+2,1)},null,e+3]}a(Il,"extractISOYmd");function Ut(r,e){return[{hours:jt(r,e,0),minutes:jt(r,e+1,0),seconds:jt(r,e+2,0),milliseconds:Is(r[e+3])},null,e+4]}a(Ut,"extractISOTime");function tr(r,e){const t=!r[e]&&!r[e+1],s=Ir(r[e+1],r[e+2]),n=t?null:Me.instance(s);return[{},n,e+3]}a(tr,"extractISOOffset");function rr(r,e){const t=r[e]?at.create(r[e]):null;return[{},t,e+1]}a(rr,"extractIANAZone");const Al=RegExp(`^T?${Cs.source}$`),Rl=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Cl(r){const[e,t,s,n,i,c,o,u,d]=r,l=e[0]==="-",g=u&&u[0]==="-",f=a((p,h=!1)=>p!==void 0&&(h||p&&l)?-p:p,"maybeNegate");return[{years:f(Et(t)),months:f(Et(s)),weeks:f(Et(n)),days:f(Et(i)),hours:f(Et(c)),minutes:f(Et(o)),seconds:f(Et(u),u==="-0"),milliseconds:f(Is(d),g)}]}a(Cl,"extractISODuration");const Nl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ds(r,e,t,s,n,i,c){const o={year:e.length===2?Rs(yt(e)):yt(e),month:Ai.indexOf(t)+1,day:yt(s),hour:yt(n),minute:yt(i)};return c&&(o.second=yt(c)),r&&(o.weekday=r.length>3?Ci.indexOf(r)+1:Ni.indexOf(r)+1),o}a(Ds,"fromStrings");const Dl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ml(r){const[,e,t,s,n,i,c,o,u,d,l,g]=r,f=Ds(e,n,s,t,i,c,o);let p;return u?p=Nl[u]:d?p=0:p=Ir(l,g),[f,new Me(p)]}a(Ml,"extractRFC2822");function Ll(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}a(Ll,"preprocessRFC2822");const Pl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Fl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,xl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Ui(r){const[,e,t,s,n,i,c,o]=r;return[Ds(e,n,s,t,i,c,o),Me.utcInstance]}a(Ui,"extractRFC1123Or850");function $l(r){const[,e,t,s,n,i,c,o]=r;return[Ds(e,o,t,s,n,i,c),Me.utcInstance]}a($l,"extractASCII");const Bl=xt(wl,Ns),jl=xt(Sl,Ns),Ul=xt(vl,Ns),Vl=xt(Bi),Vi=$t(Il,Ut,tr,rr),ql=$t(El,Ut,tr,rr),Wl=$t(Ol,Ut,tr,rr),Hl=$t(Ut,tr,rr);function zl(r){return Bt(r,[Bl,Vi],[jl,ql],[Ul,Wl],[Vl,Hl])}a(zl,"parseISODate");function Jl(r){return Bt(Ll(r),[Dl,Ml])}a(Jl,"parseRFC2822Date");function Gl(r){return Bt(r,[Pl,Ui],[Fl,Ui],[xl,$l])}a(Gl,"parseHTTPDate");function Yl(r){return Bt(r,[Rl,Cl])}a(Yl,"parseISODuration");const Zl=$t(Ut);function Kl(r){return Bt(r,[Al,Zl])}a(Kl,"parseISOTimeOnly");const Xl=xt(kl,Tl),Ql=xt(ji),eu=$t(Ut,tr,rr);function tu(r){return Bt(r,[Xl,Vi],[Ql,eu])}a(tu,"parseSQL");const qi="Invalid Duration",Wi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},ru={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Wi},Je=146097/400,Vt=146097/4800,su={years:{quarters:4,months:12,weeks:Je/7,days:Je,hours:Je*24,minutes:Je*24*60,seconds:Je*24*60*60,milliseconds:Je*24*60*60*1e3},quarters:{months:3,weeks:Je/28,days:Je/4,hours:Je*24/4,minutes:Je*24*60/4,seconds:Je*24*60*60/4,milliseconds:Je*24*60*60*1e3/4},months:{weeks:Vt/7,days:Vt,hours:Vt*24,minutes:Vt*24*60,seconds:Vt*24*60*60,milliseconds:Vt*24*60*60*1e3},...Wi},Ot=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],nu=Ot.slice(0).reverse();function ct(r,e,t=!1){const s={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new Q(s)}a(ct,"clone$1");function Hi(r,e){let t=e.milliseconds??0;for(const s of nu.slice(1))e[s]&&(t+=e[s]*r[s].milliseconds);return t}a(Hi,"durationToMillis");function zi(r,e){const t=Hi(r,e)<0?-1:1;Ot.reduceRight((s,n)=>{if(J(e[n]))return s;if(s){const i=e[s]*t,c=r[n][s],o=Math.floor(i/c);e[n]+=o*t,e[s]-=o*c*t}return n},null),Ot.reduce((s,n)=>{if(J(e[n]))return s;if(s){const i=e[s]%1;e[s]-=i,e[n]+=i*r[s][n]}return n},null)}a(zi,"normalizeValues");function Ji(r){const e={};for(const[t,s]of Object.entries(r))s!==0&&(e[t]=s);return e}a(Ji,"removeZeroes");class Q{static{a(this,"Duration")}constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let s=t?su:ru;e.matrix&&(s=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=s,this.isLuxonDuration=!0}static fromMillis(e,t){return Q.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Ie(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new Q({values:Ar(e,Q.normalizeUnit),loc:se.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(mt(e))return Q.fromMillis(e);if(Q.isDuration(e))return e;if(typeof e=="object")return Q.fromObject(e);throw new Ie(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[s]=Yl(e);return s?Q.fromObject(s,t):Q.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[s]=Kl(e);return s?Q.fromObject(s,t):Q.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Ie("need to specify a reason the Duration is invalid");const s=e instanceof Ke?e:new Ke(e,t);if(fe.throwOnInvalid)throw new Cc(s);return new Q({invalid:s})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Pn(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const s={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Ae.create(this.loc,s).formatDurationFromString(this,e):qi}toHuman(e={}){if(!this.isValid)return qi;const t=e.showZeros!==!1,s=Ot.map(n=>{const i=this.values[n];return J(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(s)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=As(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},V.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Hi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e),s={};for(const n of Ot)(Pt(t.values,n)||Pt(this.values,n))&&(s[n]=t.get(n)+this.get(n));return ct(this,{values:s},!0)}minus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const s of Object.keys(this.values))t[s]=Ii(e(this.values[s],s));return ct(this,{values:t},!0)}get(e){return this[Q.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Ar(e,Q.normalizeUnit)};return ct(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:s,matrix:n}={}){const c={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:s};return ct(this,c)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return zi(this.matrix,e),ct(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Ji(this.normalize().shiftToAll().toObject());return ct(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(c=>Q.normalizeUnit(c));const t={},s={},n=this.toObject();let i;for(const c of Ot)if(e.indexOf(c)>=0){i=c;let o=0;for(const d in s)o+=this.matrix[d][c]*s[d],s[d]=0;mt(n[c])&&(o+=n[c]);const u=Math.trunc(o);t[c]=u,s[c]=(o*1e3-u*1e3)/1e3}else mt(n[c])&&(s[c]=n[c]);for(const c in s)s[c]!==0&&(t[i]+=c===i?s[c]:s[c]/this.matrix[i][c]);return zi(this.matrix,t),ct(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return ct(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=Ji(this.values);return ct(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(s,n){return s===void 0||s===0?n===void 0||n===0:s===n}a(t,"eq");for(const s of Ot)if(!t(this.values[s],e.values[s]))return!1;return!0}}const qt="Invalid Interval";function iu(r,e){return!r||!r.isValid?pe.invalid("missing or invalid start"):!e||!e.isValid?pe.invalid("missing or invalid end"):e<r?pe.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}a(iu,"validateStartEnd");class pe{static{a(this,"Interval")}constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Ie("need to specify a reason the Interval is invalid");const s=e instanceof Ke?e:new Ke(e,t);if(fe.throwOnInvalid)throw new Rc(s);return new pe({invalid:s})}static fromDateTimes(e,t){const s=ir(e),n=ir(t),i=iu(s,n);return i??new pe({start:s,end:n})}static after(e,t){const s=Q.fromDurationLike(t),n=ir(e);return pe.fromDateTimes(n,n.plus(s))}static before(e,t){const s=Q.fromDurationLike(t),n=ir(e);return pe.fromDateTimes(n.minus(s),n)}static fromISO(e,t){const[s,n]=(e||"").split("/",2);if(s&&n){let i,c;try{i=V.fromISO(s,t),c=i.isValid}catch{c=!1}let o,u;try{o=V.fromISO(n,t),u=o.isValid}catch{u=!1}if(c&&u)return pe.fromDateTimes(i,o);if(c){const d=Q.fromISO(n,t);if(d.isValid)return pe.after(i,d)}else if(u){const d=Q.fromISO(s,t);if(d.isValid)return pe.before(o,d)}}return pe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const s=this.start.startOf(e,t);let n;return t?.useLocaleWeeks?n=this.end.reconfigure({locale:s.locale}):n=this.end,n=n.startOf(e,t),Math.floor(n.diff(s,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?pe.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(ir).filter(c=>this.contains(c)).sort((c,o)=>c.toMillis()-o.toMillis()),s=[];let{s:n}=this,i=0;for(;n<this.e;){const c=t[i]||this.e,o=+c>+this.e?this.e:c;s.push(pe.fromDateTimes(n,o)),n=o,i+=1}return s}splitBy(e){const t=Q.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s}=this,n=1,i;const c=[];for(;s<this.e;){const o=this.start.plus(t.mapUnits(u=>u*n));i=+o>+this.e?this.e:o,c.push(pe.fromDateTimes(s,i)),s=i,n+=1}return c}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,s=this.e<e.e?this.e:e.e;return t>=s?null:pe.fromDateTimes(t,s)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,s=this.e>e.e?this.e:e.e;return pe.fromDateTimes(t,s)}static merge(e){const[t,s]=e.sort((n,i)=>n.s-i.s).reduce(([n,i],c)=>i?i.overlaps(c)||i.abutsStart(c)?[n,i.union(c)]:[n.concat([i]),c]:[n,c],[[],null]);return s&&t.push(s),t}static xor(e){let t=null,s=0;const n=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),c=Array.prototype.concat(...i),o=c.sort((u,d)=>u.time-d.time);for(const u of o)s+=u.type==="s"?1:-1,s===1?t=u.time:(t&&+t!=+u.time&&n.push(pe.fromDateTimes(t,u.time)),t=null);return pe.merge(n)}difference(...e){return pe.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:qt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=wr,t={}){return this.isValid?Ae.create(this.s.loc.clone(t),e).formatInterval(this):qt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:qt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:qt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:qt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:qt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Q.invalid(this.invalidReason)}mapEndpoints(e){return pe.fromDateTimes(e(this.s),e(this.e))}}class Cr{static{a(this,"Info")}static hasDST(e=fe.defaultZone){const t=V.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return at.isValidZone(e)}static normalizeZone(e){return gt(e,fe.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||se.create(t,s,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||se.create(t,s,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||se.create(t,s,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||se.create(t,s,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return se.create(t,null,"gregory").eras(e)}static features(){return{relative:vi(),localeWeek:Ei()}}}function Gi(r,e){const t=a(n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),"utcDayStart"),s=t(e)-t(r);return Math.floor(Q.fromMillis(s).as("days"))}a(Gi,"dayDiff");function ou(r,e,t){const s=[["years",(u,d)=>d.year-u.year],["quarters",(u,d)=>d.quarter-u.quarter+(d.year-u.year)*4],["months",(u,d)=>d.month-u.month+(d.year-u.year)*12],["weeks",(u,d)=>{const l=Gi(u,d);return(l-l%7)/7}],["days",Gi]],n={},i=r;let c,o;for(const[u,d]of s)t.indexOf(u)>=0&&(c=u,n[u]=d(r,e),o=i.plus(n),o>e?(n[u]--,r=i.plus(n),r>e&&(o=r,n[u]--,r=i.plus(n))):r=o);return[r,n,o,c]}a(ou,"highOrderDiffs");function au(r,e,t,s){let[n,i,c,o]=ou(r,e,t);const u=e-n,d=t.filter(g=>["hours","minutes","seconds","milliseconds"].indexOf(g)>=0);d.length===0&&(c<e&&(c=n.plus({[o]:1})),c!==n&&(i[o]=(i[o]||0)+u/(c-n)));const l=Q.fromObject(i,s);return d.length>0?Q.fromMillis(u,s).shiftTo(...d).plus(l):l}a(au,"diff");const cu="missing Intl.DateTimeFormat.formatToParts support";function re(r,e=t=>t){return{regex:r,deser:a(([t])=>e(Xc(t)),"deser")}}a(re,"intUnit");const Yi="[ \xA0]",Zi=new RegExp(Yi,"g");function lu(r){return r.replace(/\./g,"\\.?").replace(Zi,Yi)}a(lu,"fixListRegex");function Ki(r){return r.replace(/\./g,"").replace(Zi," ").toLowerCase()}a(Ki,"stripInsensitivities");function Xe(r,e){return r===null?null:{regex:RegExp(r.map(lu).join("|")),deser:a(([t])=>r.findIndex(s=>Ki(t)===Ki(s))+e,"deser")}}a(Xe,"oneOf");function Xi(r,e){return{regex:r,deser:a(([,t,s])=>Ir(t,s),"deser"),groups:e}}a(Xi,"offset");function Nr(r){return{regex:r,deser:a(([e])=>e,"deser")}}a(Nr,"simple");function uu(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}a(uu,"escapeToken");function hu(r,e){const t=Ze(e),s=Ze(e,"{2}"),n=Ze(e,"{3}"),i=Ze(e,"{4}"),c=Ze(e,"{6}"),o=Ze(e,"{1,2}"),u=Ze(e,"{1,3}"),d=Ze(e,"{1,6}"),l=Ze(e,"{1,9}"),g=Ze(e,"{2,4}"),f=Ze(e,"{4,6}"),p=a(y=>({regex:RegExp(uu(y.val)),deser:a(([b])=>b,"deser"),literal:!0}),"literal"),m=a(y=>{if(r.literal)return p(y);switch(y.val){case"G":return Xe(e.eras("short"),0);case"GG":return Xe(e.eras("long"),0);case"y":return re(d);case"yy":return re(g,Rs);case"yyyy":return re(i);case"yyyyy":return re(f);case"yyyyyy":return re(c);case"M":return re(o);case"MM":return re(s);case"MMM":return Xe(e.months("short",!0),1);case"MMMM":return Xe(e.months("long",!0),1);case"L":return re(o);case"LL":return re(s);case"LLL":return Xe(e.months("short",!1),1);case"LLLL":return Xe(e.months("long",!1),1);case"d":return re(o);case"dd":return re(s);case"o":return re(u);case"ooo":return re(n);case"HH":return re(s);case"H":return re(o);case"hh":return re(s);case"h":return re(o);case"mm":return re(s);case"m":return re(o);case"q":return re(o);case"qq":return re(s);case"s":return re(o);case"ss":return re(s);case"S":return re(u);case"SSS":return re(n);case"u":return Nr(l);case"uu":return Nr(o);case"uuu":return re(t);case"a":return Xe(e.meridiems(),0);case"kkkk":return re(i);case"kk":return re(g,Rs);case"W":return re(o);case"WW":return re(s);case"E":case"c":return re(t);case"EEE":return Xe(e.weekdays("short",!1),1);case"EEEE":return Xe(e.weekdays("long",!1),1);case"ccc":return Xe(e.weekdays("short",!0),1);case"cccc":return Xe(e.weekdays("long",!0),1);case"Z":case"ZZ":return Xi(new RegExp(`([+-]${o.source})(?::(${s.source}))?`),2);case"ZZZ":return Xi(new RegExp(`([+-]${o.source})(${s.source})?`),2);case"z":return Nr(/[a-z_+-/]{1,256}?/i);case" ":return Nr(/[^\S\n\r]/);default:return p(y)}},"unitate")(r)||{invalidReason:cu};return m.token=r,m}a(hu,"unitForToken");const du={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function fu(r,e,t){const{type:s,value:n}=r;if(s==="literal"){const u=/^\s+$/.test(n);return{literal:!u,val:u?" ":n}}const i=e[s];let c=s;s==="hour"&&(e.hour12!=null?c=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?c="hour12":c="hour24":c=t.hour12?"hour12":"hour24");let o=du[c];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}a(fu,"tokenForPart");function pu(r){return[`^${r.map(t=>t.regex).reduce((t,s)=>`${t}(${s.source})`,"")}$`,r]}a(pu,"buildRegex");function gu(r,e,t){const s=r.match(e);if(s){const n={};let i=1;for(const c in t)if(Pt(t,c)){const o=t[c],u=o.groups?o.groups+1:1;!o.literal&&o.token&&(n[o.token.val[0]]=o.deser(s.slice(i,i+u))),i+=u}return[s,n]}else return[s,{}]}a(gu,"match");function mu(r){const e=a(i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},"toField");let t=null,s;return J(r.z)||(t=at.create(r.z)),J(r.Z)||(t||(t=new Me(r.Z)),s=r.Z),J(r.q)||(r.M=(r.q-1)*3+1),J(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),J(r.u)||(r.S=Is(r.u)),[Object.keys(r).reduce((i,c)=>{const o=e(c);return o&&(i[o]=r[c]),i},{}),t,s]}a(mu,"dateTimeFromMatches");let Ms=null;function yu(){return Ms||(Ms=V.fromMillis(1555555555555)),Ms}a(yu,"getDummyDateTime");function bu(r,e){if(r.literal)return r;const t=Ae.macroTokenToFormatOpts(r.val),s=ro(t,e);return s==null||s.includes(void 0)?r:s}a(bu,"maybeExpandMacroToken");function Qi(r,e){return Array.prototype.concat(...r.map(t=>bu(t,e)))}a(Qi,"expandMacroTokens");class eo{static{a(this,"TokenParser")}constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Qi(Ae.parseFormat(t),e),this.units=this.tokens.map(s=>hu(s,e)),this.disqualifyingUnit=this.units.find(s=>s.invalidReason),!this.disqualifyingUnit){const[s,n]=pu(this.units);this.regex=RegExp(s,"i"),this.handlers=n}}explainFromTokens(e){if(this.isValid){const[t,s]=gu(e,this.regex,this.handlers),[n,i,c]=s?mu(s):[null,null,void 0];if(Pt(s,"a")&&Pt(s,"H"))throw new Lt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:s,result:n,zone:i,specificOffset:c}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function to(r,e,t){return new eo(r,t).explainFromTokens(e)}a(to,"explainFromTokens");function _u(r,e,t){const{result:s,zone:n,specificOffset:i,invalidReason:c}=to(r,e,t);return[s,n,i,c]}a(_u,"parseFromTokens");function ro(r,e){if(!r)return null;const s=Ae.create(e,r).dtFormatter(yu()),n=s.formatToParts(),i=s.resolvedOptions();return n.map(c=>fu(c,r,i))}a(ro,"formatOptsToTokens");const Ls="Invalid DateTime",so=864e13;function sr(r){return new Ke("unsupported zone",`the zone "${r.name}" is not supported`)}a(sr,"unsupportedZone");function Ps(r){return r.weekData===null&&(r.weekData=Er(r.c)),r.weekData}a(Ps,"possiblyCachedWeekData");function Fs(r){return r.localWeekData===null&&(r.localWeekData=Er(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}a(Fs,"possiblyCachedLocalWeekData");function kt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new V({...t,...e,old:t})}a(kt,"clone");function no(r,e,t){let s=r-e*60*1e3;const n=t.offset(s);if(e===n)return[s,e];s-=(n-e)*60*1e3;const i=t.offset(s);return n===i?[s,n]:[r-Math.min(n,i)*60*1e3,Math.max(n,i)]}a(no,"fixOffset");function Dr(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}a(Dr,"tsToObj");function Mr(r,e,t){return no(Tr(r),e,t)}a(Mr,"objToTS");function io(r,e){const t=r.o,s=r.c.year+Math.trunc(e.years),n=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...r.c,year:s,month:n,day:Math.min(r.c.day,kr(s,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},c=Q.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Tr(i);let[u,d]=no(o,t,r.zone);return c!==0&&(u+=c,d=r.zone.offset(u)),{ts:u,o:d}}a(io,"adjustTime");function Wt(r,e,t,s,n,i){const{setZone:c,zone:o}=t;if(r&&Object.keys(r).length!==0||e){const u=e||o,d=V.fromObject(r,{...t,zone:u,specificOffset:i});return c?d:d.setZone(o)}else return V.invalid(new Ke("unparsable",`the input "${n}" can't be parsed as ${s}`))}a(Wt,"parseDataToDateTime");function Lr(r,e,t=!0){return r.isValid?Ae.create(se.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}a(Lr,"toTechFormat");function xs(r,e,t){const s=r.c.year>9999||r.c.year<0;let n="";if(s&&r.c.year>=0&&(n+="+"),n+=_e(r.c.year,s?6:4),t==="year")return n;if(e){if(n+="-",n+=_e(r.c.month),t==="month")return n;n+="-"}else if(n+=_e(r.c.month),t==="month")return n;return n+=_e(r.c.day),n}a(xs,"toISODate");function oo(r,e,t,s,n,i,c){let o=!t||r.c.millisecond!==0||r.c.second!==0,u="";switch(c){case"day":case"month":case"year":break;default:if(u+=_e(r.c.hour),c==="hour")break;if(e){if(u+=":",u+=_e(r.c.minute),c==="minute")break;o&&(u+=":",u+=_e(r.c.second))}else{if(u+=_e(r.c.minute),c==="minute")break;o&&(u+=_e(r.c.second))}if(c==="second")break;o&&(!s||r.c.millisecond!==0)&&(u+=".",u+=_e(r.c.millisecond,3))}return n&&(r.isOffsetFixed&&r.offset===0&&!i?u+="Z":r.o<0?(u+="-",u+=_e(Math.trunc(-r.o/60)),u+=":",u+=_e(Math.trunc(-r.o%60))):(u+="+",u+=_e(Math.trunc(r.o/60)),u+=":",u+=_e(Math.trunc(r.o%60)))),i&&(u+="["+r.zone.ianaName+"]"),u}a(oo,"toISOTime");const ao={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},wu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Su={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Pr=["year","month","day","hour","minute","second","millisecond"],vu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Eu=["year","ordinal","hour","minute","second","millisecond"];function Fr(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new Pn(r);return e}a(Fr,"normalizeUnit");function co(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Fr(r)}}a(co,"normalizeUnitWithLocalWeeks");function Ou(r){if(nr===void 0&&(nr=fe.now()),r.type!=="iana")return r.offset(nr);const e=r.name;let t=$s.get(e);return t===void 0&&(t=r.offset(nr),$s.set(e,t)),t}a(Ou,"guessOffsetForZone");function lo(r,e){const t=gt(e.zone,fe.defaultZone);if(!t.isValid)return V.invalid(sr(t));const s=se.fromObject(e);let n,i;if(J(r.year))n=fe.now();else{for(const u of Pr)J(r[u])&&(r[u]=ao[u]);const c=wi(r)||Si(r);if(c)return V.invalid(c);const o=Ou(t);[n,i]=Mr(r,o,t)}return new V({ts:n,zone:t,loc:s,o:i})}a(lo,"quickDT");function uo(r,e,t){const s=J(t.round)?!0:t.round,n=J(t.rounding)?"trunc":t.rounding,i=a((o,u)=>(o=As(o,s||t.calendary?0:2,t.calendary?"round":n),e.loc.clone(t).relFormatter(t).format(o,u)),"format"),c=a(o=>t.calendary?e.hasSame(r,o)?0:e.startOf(o).diff(r.startOf(o),o).get(o):e.diff(r,o).get(o),"differ");if(t.unit)return i(c(t.unit),t.unit);for(const o of t.units){const u=c(o);if(Math.abs(u)>=1)return i(u,o)}return i(r>e?-0:0,t.units[t.units.length-1])}a(uo,"diffRelative");function ho(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}a(ho,"lastOpts");let nr;const $s=new Map;class V{static{a(this,"DateTime")}constructor(e){const t=e.zone||fe.defaultZone;let s=e.invalid||(Number.isNaN(e.ts)?new Ke("invalid input"):null)||(t.isValid?null:sr(t));this.ts=J(e.ts)?fe.now():e.ts;let n=null,i=null;if(!s)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const o=mt(e.o)&&!e.old?e.o:t.offset(this.ts);n=Dr(this.ts,o),s=Number.isNaN(n.year)?new Ke("invalid input"):null,n=s?null:n,i=s?null:o}this._zone=t,this.loc=e.loc||se.create(),this.invalid=s,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new V({})}static local(){const[e,t]=ho(arguments),[s,n,i,c,o,u,d]=t;return lo({year:s,month:n,day:i,hour:c,minute:o,second:u,millisecond:d},e)}static utc(){const[e,t]=ho(arguments),[s,n,i,c,o,u,d]=t;return e.zone=Me.utcInstance,lo({year:s,month:n,day:i,hour:c,minute:o,second:u,millisecond:d},e)}static fromJSDate(e,t={}){const s=sl(e)?e.valueOf():NaN;if(Number.isNaN(s))return V.invalid("invalid input");const n=gt(t.zone,fe.defaultZone);return n.isValid?new V({ts:s,zone:n,loc:se.fromObject(t)}):V.invalid(sr(n))}static fromMillis(e,t={}){if(mt(e))return e<-so||e>so?V.invalid("Timestamp out of range"):new V({ts:e,zone:gt(t.zone,fe.defaultZone),loc:se.fromObject(t)});throw new Ie(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(mt(e))return new V({ts:e*1e3,zone:gt(t.zone,fe.defaultZone),loc:se.fromObject(t)});throw new Ie("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const s=gt(t.zone,fe.defaultZone);if(!s.isValid)return V.invalid(sr(s));const n=se.fromObject(t),i=Ar(e,co),{minDaysInFirstWeek:c,startOfWeek:o}=_i(i,n),u=fe.now(),d=J(t.specificOffset)?s.offset(u):t.specificOffset,l=!J(i.ordinal),g=!J(i.year),f=!J(i.month)||!J(i.day),p=g||f,h=i.weekYear||i.weekNumber;if((p||l)&&h)throw new Lt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&l)throw new Lt("Can't mix ordinal dates with month/day");const m=h||i.weekday&&!p;let y,b,w=Dr(u,d);m?(y=vu,b=wu,w=Er(w,c,o)):l?(y=Eu,b=Su,w=ks(w)):(y=Pr,b=ao);let _=!1;for(const M of y){const $=i[M];J($)?_?i[M]=b[M]:i[M]=w[M]:_=!0}const S=m?el(i,c,o):l?tl(i):wi(i),k=S||Si(i);if(k)return V.invalid(k);const v=m?yi(i,c,o):l?bi(i):i,[I,E]=Mr(v,d,s),T=new V({ts:I,zone:s,o:E,loc:n});return i.weekday&&p&&e.weekday!==T.weekday?V.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${T.toISO()}`):T.isValid?T:V.invalid(T.invalid)}static fromISO(e,t={}){const[s,n]=zl(e);return Wt(s,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[s,n]=Jl(e);return Wt(s,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[s,n]=Gl(e);return Wt(s,n,t,"HTTP",t)}static fromFormat(e,t,s={}){if(J(e)||J(t))throw new Ie("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=s,c=se.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,u,d,l]=_u(c,e,t);return l?V.invalid(l):Wt(o,u,s,`format ${t}`,e,d)}static fromString(e,t,s={}){return V.fromFormat(e,t,s)}static fromSQL(e,t={}){const[s,n]=tu(e);return Wt(s,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Ie("need to specify a reason the DateTime is invalid");const s=e instanceof Ke?e:new Ke(e,t);if(fe.throwOnInvalid)throw new Ac(s);return new V({invalid:s})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const s=ro(e,se.fromObject(t));return s?s.map(n=>n?n.val:null).join(""):null}static expandFormat(e,t={}){return Qi(Ae.parseFormat(e),se.fromObject(t)).map(n=>n.val).join("")}static resetCache(){nr=void 0,$s.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ps(this).weekYear:NaN}get weekNumber(){return this.isValid?Ps(this).weekNumber:NaN}get weekday(){return this.isValid?Ps(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Fs(this).weekday:NaN}get localWeekNumber(){return this.isValid?Fs(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Fs(this).weekYear:NaN}get ordinal(){return this.isValid?ks(this.c).ordinal:NaN}get monthShort(){return this.isValid?Cr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Cr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Cr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Cr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,s=Tr(this.c),n=this.zone.offset(s-e),i=this.zone.offset(s+e),c=this.zone.offset(s-n*t),o=this.zone.offset(s-i*t);if(c===o)return[this];const u=s-c*t,d=s-o*t,l=Dr(u,c),g=Dr(d,o);return l.hour===g.hour&&l.minute===g.minute&&l.second===g.second&&l.millisecond===g.millisecond?[kt(this,{ts:u}),kt(this,{ts:d})]:[this]}get isInLeapYear(){return Xt(this.year)}get daysInMonth(){return kr(this.year,this.month)}get daysInYear(){return this.isValid?Ft(this.year):NaN}get weeksInWeekYear(){return this.isValid?Qt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Qt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:s,calendar:n}=Ae.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:s,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(Me.instance(e),t)}toLocal(){return this.setZone(fe.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:s=!1}={}){if(e=gt(e,fe.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||s){const i=e.offset(this.ts),c=this.toObject();[n]=Mr(c,i,e)}return kt(this,{ts:n,zone:e})}else return V.invalid(sr(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:s}={}){const n=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:s});return kt(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Ar(e,co),{minDaysInFirstWeek:s,startOfWeek:n}=_i(t,this.loc),i=!J(t.weekYear)||!J(t.weekNumber)||!J(t.weekday),c=!J(t.ordinal),o=!J(t.year),u=!J(t.month)||!J(t.day),d=o||u,l=t.weekYear||t.weekNumber;if((d||c)&&l)throw new Lt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new Lt("Can't mix ordinal dates with month/day");let g;i?g=yi({...Er(this.c,s,n),...t},s,n):J(t.ordinal)?(g={...this.toObject(),...t},J(t.day)&&(g.day=Math.min(kr(g.year,g.month),g.day))):g=bi({...ks(this.c),...t});const[f,p]=Mr(g,this.o,this.zone);return kt(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e);return kt(this,io(this,t))}minus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e).negate();return kt(this,io(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const s={},n=Q.normalizeUnit(e);switch(n){case"years":s.month=1;case"quarters":case"months":s.day=1;case"weeks":case"days":s.hour=0;case"hours":s.minute=0;case"minutes":s.second=0;case"seconds":s.millisecond=0;break}if(n==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:c}=this;c<i&&(s.weekNumber=this.weekNumber-1),s.weekday=i}else s.weekday=1;if(n==="quarters"){const i=Math.ceil(this.month/3);s.month=(i-1)*3+1}return this.set(s)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Ae.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ls}toLocaleString(e=wr,t={}){return this.isValid?Ae.create(this.loc.clone(t),e).formatDateTime(this):Ls}toLocaleParts(e={}){return this.isValid?Ae.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:s=!1,includeOffset:n=!0,extendedZone:i=!1,precision:c="milliseconds"}={}){if(!this.isValid)return null;c=Fr(c);const o=e==="extended";let u=xs(this,o,c);return Pr.indexOf(c)>=3&&(u+="T"),u+=oo(this,o,t,s,n,i,c),u}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?xs(this,e==="extended",Fr(t)):null}toISOWeekDate(){return Lr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:s=!0,includePrefix:n=!1,extendedZone:i=!1,format:c="extended",precision:o="milliseconds"}={}){return this.isValid?(o=Fr(o),(n&&Pr.indexOf(o)>=3?"T":"")+oo(this,c==="extended",t,e,s,i,o)):null}toRFC2822(){return Lr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Lr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?xs(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:s=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(s&&(n+=" "),t?n+="z":e&&(n+="ZZ")),Lr(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ls}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",s={}){if(!this.isValid||!e.isValid)return Q.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...s},i=nl(t).map(Q.normalizeUnit),c=e.valueOf()>this.valueOf(),o=c?this:e,u=c?e:this,d=au(o,u,i,n);return c?d.negate():d}diffNow(e="milliseconds",t={}){return this.diff(V.now(),e,t)}until(e){return this.isValid?pe.fromDateTimes(this,e):this}hasSame(e,t,s){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,s)<=n&&n<=i.endOf(t,s)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||V.fromObject({},{zone:this.zone}),s=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),uo(t,this.plus(s),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?uo(e.base||V.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(V.isDateTime))throw new Ie("min requires all arguments be DateTimes");return Oi(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(V.isDateTime))throw new Ie("max requires all arguments be DateTimes");return Oi(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,s={}){const{locale:n=null,numberingSystem:i=null}=s,c=se.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return to(c,e,t)}static fromStringExplain(e,t,s={}){return V.fromFormatExplain(e,t,s)}static buildFormatParser(e,t={}){const{locale:s=null,numberingSystem:n=null}=t,i=se.fromOpts({locale:s,numberingSystem:n,defaultToEN:!0});return new eo(i,e)}static fromFormatParser(e,t,s={}){if(J(e)||J(t))throw new Ie("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:i=null}=s,c=se.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});if(!c.equals(t.locale))throw new Ie(`fromFormatParser called with a locale of ${c}, but the format parser was created for ${t.locale}`);const{result:o,zone:u,specificOffset:d,invalidReason:l}=t.explainFromTokens(e);return l?V.invalid(l):Wt(o,u,s,`format ${t.format}`,e,d)}static get DATE_SHORT(){return wr}static get DATE_MED(){return Fn}static get DATE_MED_WITH_WEEKDAY(){return Nc}static get DATE_FULL(){return xn}static get DATE_HUGE(){return $n}static get TIME_SIMPLE(){return Bn}static get TIME_WITH_SECONDS(){return jn}static get TIME_WITH_SHORT_OFFSET(){return Un}static get TIME_WITH_LONG_OFFSET(){return Vn}static get TIME_24_SIMPLE(){return qn}static get TIME_24_WITH_SECONDS(){return Wn}static get TIME_24_WITH_SHORT_OFFSET(){return Hn}static get TIME_24_WITH_LONG_OFFSET(){return zn}static get DATETIME_SHORT(){return Jn}static get DATETIME_SHORT_WITH_SECONDS(){return Gn}static get DATETIME_MED(){return Yn}static get DATETIME_MED_WITH_SECONDS(){return Zn}static get DATETIME_MED_WITH_WEEKDAY(){return Dc}static get DATETIME_FULL(){return Kn}static get DATETIME_FULL_WITH_SECONDS(){return Xn}static get DATETIME_HUGE(){return Qn}static get DATETIME_HUGE_WITH_SECONDS(){return ei}}function ir(r){if(V.isDateTime(r))return r;if(r&&r.valueOf&&mt(r.valueOf()))return V.fromJSDate(r);if(r&&typeof r=="object")return V.fromObject(r);throw new Ie(`Unknown datetime argument: ${r}, of type ${typeof r}`)}a(ir,"friendlyDateTime");var ku=Object.defineProperty,Tu=a((r,e)=>ku(r,"name",{value:e,configurable:!0}),"o$r");class Bs{static{a(this,"AbstractFormatter")}static{Tu(this,"AbstractFormatter")}dateFormat;constructor(e="YYYY-MM-DD HH:mm:ss"){this.dateFormat=e}_formatTimestamp(e){const t=V.fromJSDate(e);return Math.floor(t.toSeconds()).toFixed(0)}_formatDate(e){return V.fromJSDate(e).toFormat(this.dateFormat.replace(/YYYY/g,"yyyy").replace(/YY/g,"yy").replace(/DD/g,"dd").replace(/D/g,"d"))}}var Iu=Object.defineProperty,Au=a((r,e)=>Iu(r,"name",{value:e,configurable:!0}),"m$7");class Ru extends Bs{static{a(this,"JsonFormatter")}static{Au(this,"JsonFormatter")}constructor(e="YYYY-MM-DD HH:mm:ss"){super(e)}format(e){return JSON.stringify({channel:e.channel,levelName:e.levelName,message:e.message,context:e.context,extra:e.extra,timestamp:this._formatTimestamp(e.timestamp),date:this._formatDate(e.timestamp)})}}var Cu=Object.defineProperty,Nu=a((r,e)=>Cu(r,"name",{value:e,configurable:!0}),"s$w");class xr extends Bs{static{a(this,"LineFormatter")}static{Nu(this,"LineFormatter")}formatString;constructor(e="[{channel}] {levelName}: {message} {context} {extra} {date}",t="YYYY-MM-DD HH:mm:ss"){super(t),this.formatString=e}format(e){let t=this.formatString;const s={"{channel}":e.channel,"{levelName}":e.levelName,"{message}":e.message,"{context}":JSON.stringify(e.context),"{extra}":JSON.stringify(e.extra),"{timestamp}":this._formatTimestamp(e.timestamp),"{date}":this._formatDate(e.timestamp)};for(const[n,i]of Object.entries(s))t=t.replace(n,i);return t}}var Du=Object.defineProperty,Mu=a((r,e)=>Du(r,"name",{value:e,configurable:!0}),"n$f");class fo extends Bs{static{a(this,"TelegramFormatter")}static{Mu(this,"TelegramFormatter")}useHtml;maxMessageLength;constructor(e=!0,t="YYYY-MM-DD HH:mm:ss",s=4096){super(t),this.useHtml=e,this.maxMessageLength=s}format(e){let t=this._formatBaseMessage(e);const s=this._formatAdditionalInfo(e);return s&&(t+=`
|
|
9
|
+
|
|
10
|
+
${s}`),t.length>this.maxMessageLength&&(t=t.substring(0,this.maxMessageLength-3)+"..."),t}_formatBaseMessage(e){const t=this._formatDate(e.timestamp),s=e.levelName;return this.useHtml?`<b>${s}</b> | <code>${e.channel}</code>
|
|
11
|
+
<i>Time:</i> ${t}
|
|
12
|
+
<i>Message:</i>
|
|
13
|
+
${e.message}`:`*${s}* \`${e.channel}\`
|
|
14
|
+
_Time:_ \`${t}\`
|
|
15
|
+
_Message:_
|
|
16
|
+
${e.message}`}_formatAdditionalInfo(e){const t=[];if(e.context&&Object.keys(e.context).length>0){const s=JSON.stringify(e.context,null,2);this.useHtml?t.push(`<i>Context:</i>
|
|
17
|
+
<pre><code class="language-json">${this._escapeHtml(s)}</code></pre>`):t.push(`_Context:_
|
|
18
|
+
\`\`\`json
|
|
19
|
+
${s}
|
|
20
|
+
\`\`\``)}if(e.extra&&Object.keys(e.extra).length>0){const s=JSON.stringify(e.extra,null,2);this.useHtml?t.push(`<i>Extra:</i>
|
|
21
|
+
<pre><code class="language-json">${this._escapeHtml(s)}</code></pre>`):t.push(`_Extra:_
|
|
22
|
+
\`\`\`json
|
|
23
|
+
${s}
|
|
24
|
+
\`\`\``)}return t.join(`
|
|
25
|
+
|
|
26
|
+
`)}_escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}_escapeMarkdownV2(e){return e.replace(/_/g,"\\_").replace(/\*/g,"\\*").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/~/g,"\\~").replace(/`/g,"\\`").replace(/>/g,"\\>").replace(/#/g,"\\#").replace(/\+/g,"\\+").replace(/-/g,"\\-").replace(/=/g,"\\=").replace(/\|/g,"\\|").replace(/\{/g,"\\{").replace(/\}/g,"\\}").replace(/\./g,"\\.").replace(/!/g,"\\!")}setUseHtml(e){return this.useHtml=e,this}setMaxMessageLength(e){return this.maxMessageLength=e,this}}var Lu=Object.defineProperty,Pu=a((r,e)=>Lu(r,"name",{value:e,configurable:!0}),"e$c");const Fu=Pu(r=>(r.extra.pid="?",typeof process<"u"&&process.pid&&(r.extra.pid=process.pid),r),"pidProcessor");var xu=Object.defineProperty,$u=a((r,e)=>xu(r,"name",{value:e,configurable:!0}),"o$q");const Bu=$u(r=>(r.extra.memoryUsage="?",typeof process<"u"&&process.memoryUsage&&(r.extra.memoryUsage=Math.round(process.memoryUsage().heapUsed/1024/1024)+"MB"),r),"memoryUsageProcessor");var ju=Object.defineProperty,Uu=a((r,e)=>ju(r,"name",{value:e,configurable:!0}),"o$p");class Ht{static{a(this,"AbstractHandler")}static{Uu(this,"AbstractHandler")}level;formatter=null;bubble=!0;constructor(e=W.DEBUG,t){this.level=e,t!==void 0&&(this.bubble=t)}isHandling(e){return e>=this.level}shouldBubble(){return this.bubble}setFormatter(e){this.formatter=e}getFormatter(){return this.formatter}}var Vu=Object.defineProperty,qu=a((r,e)=>Vu(r,"name",{value:e,configurable:!0}),"c$a");class po extends Ht{static{a(this,"ConsoleHandler")}static{qu(this,"ConsoleHandler")}_styles=new Map;_useStyles;constructor(e=W.DEBUG,t){const s={useStyles:!0,...t};super(e,s.bubble),this._useStyles=s.useStyles,this._initStyles(),this.setFormatter(new xr)}_initStyles(){const e="color: _color_; background: _bg_; padding: 2px 6px; border-radius: 3px; font-size: 11px;";this._styles.set(W.DEBUG,["%cDEBUG",e.replace("_color_","#666666").replace("_bg_","#F0F0F0")]),this._styles.set(W.INFO,["%cINFO",e.replace("_color_","white").replace("_bg_","#2196F3")]),this._styles.set(W.NOTICE,["%cNOTICE",e.replace("_color_","white").replace("_bg_","#213BF3")]),this._styles.set(W.WARNING,["%cWARN",e.replace("_color_","white").replace("_bg_","#FF9800")]),this._styles.set(W.ERROR,["%cERROR",e.replace("_color_","white").replace("_bg_","#F44336")]),this._styles.set(W.CRITICAL,["%cCRITICAL",e.replace("_color_","white").replace("_bg_","#9C27B0")])}async handle(e){const t=this.getFormatter().format(e);let s=this._getConsoleMethod(e.level);e.context.needTrace===!0&&(s="trace");const n=[];if(this._useStyles&&this._styles.has(e.level)){const i=this._styles.get(e.level);n.push(i[0],i[1])}return n.push(t),console[s](...n.filter(Boolean)),!0}_getConsoleMethod(e){switch(e){case W.INFO:case W.NOTICE:return"info";case W.WARNING:return"warn";case W.ERROR:case W.CRITICAL:case W.ALERT:case W.EMERGENCY:return"error";default:return"log"}}}var Wu=Object.defineProperty,Hu=a((r,e)=>Wu(r,"name",{value:e,configurable:!0}),"a$o");class js extends po{static{a(this,"ConsoleV2Handler")}static{Hu(this,"ConsoleV2Handler")}constructor(e=W.DEBUG,t){super(e,t),this.setFormatter(new xr("[{channel}]: {message}"))}async handle(e){const t=this.getFormatter().format(e);let s=this._getConsoleMethod(e.level);e.context.needTrace===!0&&(s="trace");const n=e.context&&Object.keys(e.context).length>0?e.context:void 0,i=e.extra&&Object.keys(e.extra).length>0?e.extra:void 0,c=[];if(this._useStyles&&this._styles.has(e.level)){const o=this._styles.get(e.level);c.push(o[0],o[1])}return c.push(t),c.push(n),c.push(i),console[s](...c.filter(Boolean)),!0}}var zu=Object.defineProperty,Ju=a((r,e)=>zu(r,"name",{value:e,configurable:!0}),"t$a");class Gu extends Ht{static{a(this,"MemoryHandler")}static{Ju(this,"MemoryHandler")}records=[];limit;constructor(e=W.DEBUG,t){const s={bubble:!0,limit:1e3,...t};super(e,s.bubble),this.limit=s.limit}async handle(e){return this.records.push(e),this.records.length>this.limit&&this.records.shift(),!0}getRecords(){return[...this.records]}clear(){this.records=[]}}var Yu=Object.defineProperty,Zu=a((r,e)=>Yu(r,"name",{value:e,configurable:!0}),"s$s");class Ku extends Ht{static{a(this,"StreamHandler")}static{Zu(this,"StreamHandler")}stream;constructor(e=W.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.stream=s.stream,this.setFormatter(new xr)}async handle(e){try{const t=this.getFormatter().format(e)+`
|
|
27
|
+
`;this.stream.write(t)}catch(t){return console.error(`StreamHandler write error: ${t}`),!1}return!0}async close(){if(typeof this.stream.end=="function")return new Promise((e,t)=>{this.stream.end(s=>{s?t(s):e()})})}}var Xu=Object.defineProperty,Qu=a((r,e)=>Xu(r,"name",{value:e,configurable:!0}),"o$o");class eh extends Ht{static{a(this,"ConsolaAdapter")}static{Qu(this,"ConsolaAdapter")}consolaInstance;constructor(e=W.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.consolaInstance=s.consolaInstance}setFormatter(e){}getFormatter(){return null}async handle(e){const t=`[${e.channel}] ${e.levelName}: ${e.message}`,s={...e.context,...e.extra,timestamp:e.timestamp};switch(e.level){case W.DEBUG:this.consolaInstance.log(t,s);break;case W.INFO:this.consolaInstance.info(t,s);break;case W.NOTICE:this.consolaInstance.success(t,s);break;case W.WARNING:this.consolaInstance.warn(t,s);break;case W.ERROR:case W.CRITICAL:case W.ALERT:case W.EMERGENCY:this.consolaInstance.error(t,s);break;default:this.consolaInstance.log(t,s)}return!0}}var th=Object.defineProperty,rh=a((r,e)=>th(r,"name",{value:e,configurable:!0}),"n$e");class sh extends Ht{static{a(this,"WinstonAdapter")}static{rh(this,"WinstonAdapter")}winstonLogger;constructor(e=W.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.winstonLogger=s.winstonLogger}setFormatter(e){}getFormatter(){return null}async handle(e){const t={DEBUG:"debug",INFO:"info",NOTICE:"notice",WARNING:"warn",ERROR:"error",CRITICAL:"error",ALERT:"error",EMERGENCY:"error"},s=t[e.levelName]||t.INFO;return this.winstonLogger.log({level:s,channel:e.channel,message:e.message,context:e.context,extra:e.extra,timestamp:e.timestamp}),!0}}var nh=Object.defineProperty,ih=a((r,e)=>nh(r,"name",{value:e,configurable:!0}),"e$b"),or=(r=>(r.UNKNOWN="unknown",r.BROWSE="browser",r.NODE="node",r))(or||{});function $r(){return typeof window<"u"&&typeof window.document<"u"?"browser":typeof process<"u"&&process.versions&&process.versions.node?"node":"unknown"}a($r,"getEnvironment"),ih($r,"getEnvironment");var oh=Object.defineProperty,ah=a((r,e)=>oh(r,"name",{value:e,configurable:!0}),"s$q");class ch extends Ht{static{a(this,"TelegramHandler")}static{ah(this,"TelegramHandler")}botToken;chatId;parseMode;disableNotification;disableWebPagePreview;environment;warnInBrowser;constructor(e=W.ERROR,t){if(super(e,t.bubble),!t.botToken)throw new Error("botToken is required for TelegramHandler");if(!t.chatId)throw new Error("chatId is required for TelegramHandler");this.botToken=t.botToken,this.chatId=t.chatId,this.parseMode=t.parseMode||"HTML",this.disableNotification=t.disableNotification||!1,this.disableWebPagePreview=t.disableWebPagePreview||!0,this.environment=$r(),this.warnInBrowser=t.warnInBrowser!==!1,this.setFormatter(new fo(this.parseMode==="HTML"))}async handle(e){const t=this.getFormatter();if(!t)return console.error("TelegramHandler: No formatter set"),!1;const s=t.format(e);return this.environment===or.BROWSE?this._handleInBrowser(s,e):this.environment===or.NODE?this._handleInNode(s,e):(console.warn("TelegramHandler: Unknown environment, using fallback"),this._handleFallback(s))}async _handleInBrowser(e,t){if(this.warnInBrowser){const s=`\u26A0\uFE0F TelegramHandler: Cannot send logs to Telegram from browser environment.
|
|
28
|
+
This would expose your bot token. Consider disabling this handler in browser.
|
|
29
|
+
Log message: ${t.message}
|
|
30
|
+
If you need to send logs from browser, use a proxy server.`;console.warn(s),console.log("%cTelegram Handler Warning","color: #FF9800; background: #FFF3E0; padding: 8px; border: 1px solid #FFB74D; border-radius: 4px;",s)}return!1}async _handleInNode(e,t){try{const s=`https://api.telegram.org/bot${this.botToken}/sendMessage`,n=JSON.stringify({chat_id:this.chatId,text:e,parse_mode:this.parseMode,disable_notification:this.disableNotification,disable_web_page_preview:this.disableWebPagePreview}),i=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:n})).json();return i.ok?!0:(console.error("TelegramHandler: Failed to send message",i),!1)}catch(s){return console.error("TelegramHandler: Error sending message",s),!1}}async _handleFallback(e){return console.log("TelegramHandler (fallback):",e),!1}updateSettings(e){return e.botToken&&(this.botToken=e.botToken),e.chatId&&(this.chatId=e.chatId),e.parseMode&&(this.parseMode=e.parseMode),e.disableNotification!==void 0&&(this.disableNotification=e.disableNotification),e.disableWebPagePreview!==void 0&&(this.disableWebPagePreview=e.disableWebPagePreview),e.warnInBrowser!==void 0&&(this.warnInBrowser=e.warnInBrowser),this}getEnvironment(){return this.environment}async testConnection(){if(this.environment==="browser")return console.warn("TelegramHandler: Cannot test connection in browser environment"),!1;try{const e=`https://api.telegram.org/bot${this.botToken}/getMe`;return(await(await fetch(e)).json()).ok===!0}catch(e){return console.error("TelegramHandler: Test connection failed",e),!1}}}var lh=Object.defineProperty,uh=a((r,e)=>lh(r,"name",{value:e,configurable:!0}),"n$d");class Us{static{a(this,"AbstractLogger")}static{uh(this,"AbstractLogger")}async debug(e,t){return this.log(W.DEBUG,e,t)}async info(e,t){return this.log(W.INFO,e,t)}async notice(e,t){return this.log(W.NOTICE,e,t)}async warning(e,t){return this.log(W.WARNING,e,t)}async error(e,t){return this.log(W.ERROR,e,t)}async critical(e,t){return this.log(W.CRITICAL,e,t)}async alert(e,t){return this.log(W.ALERT,e,t)}async emergency(e,t){return this.log(W.EMERGENCY,e,t)}}var hh=Object.defineProperty,dh=a((r,e)=>hh(r,"name",{value:e,configurable:!0}),"r$h");class ar extends Us{static{a(this,"NullLogger")}static{dh(this,"NullLogger")}static create(){return new ar}async log(e,t,s){}}var fh=Object.defineProperty,ph=a((r,e)=>fh(r,"name",{value:e,configurable:!0}),"o$m");class cr extends Us{static{a(this,"Logger")}static{ph(this,"Logger")}channel;handlers=[];processors=[];constructor(e){super(),this.channel=e}static create(e){return new cr(e)}pushHandler(e){return this.handlers.push(e),this}popHandler(){return this.handlers.pop()||null}setHandlers(e){return this.handlers=e,this}pushProcessor(e){return this.processors.push(e),this}async log(e,t,s){let n={channel:this.channel,level:e,levelName:W[e],message:t,context:s??{},extra:{},timestamp:new Date};for(const i of this.processors)n=i(n);for(const i of this.handlers)if(i.isHandling(e)&&await i.handle(n)&&!i.shouldBubble())break}}var gh=Object.defineProperty,mh=a((r,e)=>gh(r,"name",{value:e,configurable:!0}),"t$8");class ee{static{a(this,"LoggerFactory")}static{mh(this,"LoggerFactory")}static createNullLogger(){return ar.create()}static createForBrowser(e,t=!1){return t?ee.createForBrowserDevelopment(e):ee.createForBrowserProduction(e)}static createForBrowserDevelopment(e,t=W.DEBUG){const s=new cr(e),n=new js(t);return s.pushHandler(n),s}static createForBrowserProduction(e,t=W.ERROR){const s=new cr(e),n=new js(t);return s.pushHandler(n),s}static async forcedLog(e,t,s,n){if(!(typeof globalThis<"u"&&"vitest"in globalThis)){if(e instanceof ar)switch(t){case"debug":console.log(s,n);return;case"info":case"notice":console.info(s,n);return;case"warning":console.warn(s,n);return;default:console.error(s,n);return}return e[t](s,n)}}}var yh=Object.defineProperty,bh=a((r,e)=>yh(r,"name",{value:e,configurable:!0}),"t$7");const ke="@deprecate: use Logger. https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/logger/";var go=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(go||{});class Vs{static{a(this,"LoggerBrowser")}static{bh(this,"LoggerBrowser")}#e;static build(e,t=!1){return new Vs(e,t)}constructor(e,t=!1){console.warn(ke),t?this.#e=ee.createForBrowserDevelopment(e):this.#e=ee.createForBrowserProduction(e)}setConfig(e){console.warn(ke)}enable(e){return console.warn(ke),!0}disable(e){return console.warn(ke),!0}isEnabled(e){return console.warn(ke),!1}async desktop(...e){console.warn(ke);const t={needDesktop:!0,params:{...e}};return this.#e.debug("desktop",t)}async log(...e){console.warn(ke);const t={params:{...e}};return this.#e.debug("log",t)}async info(...e){console.warn(ke);const t={params:{...e}};return this.#e.info("info",t)}async warn(...e){console.warn(ke);const t={params:{...e}};return this.#e.warning("warn",t)}async error(...e){console.warn(ke);const t={params:{...e}};return this.#e.error("error",t)}async trace(...e){console.warn(ke);const t={needTrace:!0,params:{...e}};return this.#e.debug("trace",t)}async debug(...e){console.warn(ke);const t={params:{...e}};return this.#e.debug("debug",t)}async notice(...e){console.warn(ke);const t={params:{...e}};return this.#e.info("notice",t)}async warning(...e){console.warn(ke);const t={params:{...e}};return this.#e.warning("warning",t)}async critical(...e){console.warn(ke);const t={params:{...e}};return this.#e.critical("critical",t)}async alert(...e){console.warn(ke);const t={params:{...e}};return this.#e.alert("alert",t)}async emergency(...e){console.warn(ke);const t={params:{...e}};return this.#e.emergency("alert",t)}}var mo=(r=>(r.undefined="undefined",r.any="any",r.integer="integer",r.boolean="boolean",r.double="double",r.date="date",r.datetime="datetime",r.string="string",r.text="text",r.file="file",r.array="array",r.object="object",r.user="user",r.location="location",r.crmCategory="crm_category",r.crmStatus="crm_status",r.crmCurrency="crm_currency",r))(mo||{}),_h=Object.defineProperty,wh=a((r,e)=>_h(r,"name",{value:e,configurable:!0}),"o$k");const Sh=Function.prototype.toString.call(Object);let vh=class{static{a(this,"y")}static{wh(this,"TypeManager")}getTag(e){return Object.prototype.toString.call(e)}isString(e){return typeof e=="string"||e instanceof String}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const s=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof s=="function"&&Function.prototype.toString.call(s)===Sh}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return typeof e=="number"&&!Number.isNaN(e)}isInteger(e){return Number.isInteger(e)}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return e instanceof Date}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)\]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return typeof FormData<"u"&&e instanceof FormData?!0:this.isObjectLike(e)&&this.getTag(e)==="[object FormData]"}clone(e,t=!0){let s,n,i;if(this.isNil(e)||typeof e!="object")return e;if(this.isDomNode(e))s=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(s=[],n=0,i=e.length;n<i;n++)typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n];else{s={},e.constructor&&(this.isDate(e)?s=new Date(e):s=new e.constructor);for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n])}else s=e;return s}};const L=new vh;var Eh=Object.defineProperty,Br=a((r,e)=>Eh(r,"name",{value:e,configurable:!0}),"r$g");function yo(r,e){const t={};for(const s of e)t[s]=r[s];return t}a(yo,"pick"),Br(yo,"pick");function qs(r,e){const t={...r};for(const s of e)delete t[s];return t}a(qs,"omit"),Br(qs,"omit");function bo(r){return Array.isArray(r[0])}a(bo,"isArrayOfArray"),Br(bo,"isArrayOfArray");function _o(r,e){return Object.values(r).includes(e)?e:void 0}a(_o,"getEnumValue"),Br(_o,"getEnumValue");var Oh=Object.defineProperty,wo=a((r,e)=>Oh(r,"name",{value:e,configurable:!0}),"i$g");const Te=[];for(let r=0;r<256;++r)Te.push((r+256).toString(16).slice(1));function So(r,e,t,s){return()=>{r|=0,e|=0,t|=0,s|=0;const n=(r+e|0)+s|0;return s=s+1|0,r=e^e>>>9,e=t+(t<<3)|0,t=(t<<21|t>>>11)+n|0,n>>>0}}a(So,"m$6"),wo(So,"sfc32");function vo(){const r=new Uint8Array(16),e=BigInt(Date.now()),t=BigInt(Math.floor(performance.now()*1e3)%65535),s=e<<16n|t;r[0]=Number(s>>40n&0xFFn),r[1]=Number(s>>32n&0xFFn),r[2]=Number(s>>24n&0xFFn),r[3]=Number(s>>16n&0xFFn),r[4]=Number(s>>8n&0xFFn),r[5]=Number(s&0xFFn);const n=(Math.random()*4294967295^Date.now()^performance.now())>>>0,i=So(2654435769,608135816,3084996962,n),c=new DataView(r.buffer);return c.setUint32(6,i()),c.setUint32(10,i()),c.setUint16(14,i()),r[6]=112|r[6]&15,r[8]=128|r[8]&63,(Te[r[0]]+Te[r[1]]+Te[r[2]]+Te[r[3]]+"-"+Te[r[4]]+Te[r[5]]+"-"+Te[r[6]]+Te[r[7]]+"-"+Te[r[8]]+Te[r[9]]+"-"+Te[r[10]]+Te[r[11]]+Te[r[12]]+Te[r[13]]+Te[r[14]]+Te[r[15]]).toLowerCase()}a(vo,"a$k"),wo(vo,"uuidv7");var kh=Object.defineProperty,Eo=a((r,e)=>kh(r,"name",{value:e,configurable:!0}),"u$8");const Th=/[&<>'"]/g,Ih=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,Ah={"&":"&","<":"<",">":">","'":"'",'"':"""},Rh={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","&apos":"'","'":"'",""":'"',""":'"'};class Ch{static{a(this,"F")}static{Eo(this,"TextManager")}getRandom(e=8){return[...Array(e)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return vo()}encode(e){return L.isString(e)?e.replace(Th,t=>Ah[t]):e}decode(e){return L.isString(e)?e.replace(Ih,t=>Rh[t]):e}toNumber(e){const t=Number.parseFloat(e);return L.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const s=L.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(s)}toCamelCase(e){if(!L.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(s,n)=>n?n.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return L.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!L.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+\d*|\b)|[A-Z]?[a-z]+\d*|[A-Z]|\d+/g);return t?t.map(s=>s.toLowerCase()).join("-"):e}capitalize(e){return L.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,s=".",n=","){const i=Number.isFinite(e)?e:0,c=Number.isFinite(t)?Math.abs(t):0,o=(c?Eo((u,d)=>{const l=Math.pow(10,d);return Math.round(u*l)/l},"toFixedFix")(i,c):Math.round(i)).toString().split(".");return o[0]&&o[0].length>3&&(o[0]=o[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,n)),(o[1]||"").length<c&&(o[1]=o[1]||"",o[1]+=new Array(c-o[1].length+1).join("0")),o.join(s)}toDateTime(e,t,s){return!(typeof t>"u")&&L.isStringFilled(t)?V.fromFormat(e,t,s):V.fromISO(e,s)}toB24Format(e){return typeof e=="string"?e:e instanceof Date?this.toB24Format(V.fromJSDate(e)):e.toFormat("yyyy-MM-dd'T'HH:mm:ssZZ")}getDateForLog(){return V.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const n=e[s];L.isArray(n)?n.forEach((i,c)=>{t+=encodeURIComponent(s+"["+c+"]")+"="+encodeURIComponent(i)+"&"}):t+=encodeURIComponent(s)+"="+encodeURIComponent(n)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const H=new Ch;var Nh=Object.defineProperty,Dh=a((r,e)=>Nh(r,"name",{value:e,configurable:!0}),"s$o");let ve="";try{ve=navigator?.userAgent.toLowerCase()}catch{ve="?"}let Mh=class{static{a(this,"u")}static{Dh(this,"BrowserManager")}isOpera(){return ve.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return ve.includes("msie 6")}isIE7(){return ve.includes("msie 7")}isIE8(){return ve.includes("msie 8")}isIE9(){return"documentMode"in document&&document?.documentMode>=9}isIE10(){return"documentMode"in document&&document?.documentMode>=10}isSafari(){return ve.includes("safari")&&!ve.includes("chrome")}isFirefox(){return ve.includes("firefox")}isChrome(){return ve.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=/MSIE (\d[.0-9]*)/,s=navigator.userAgent.match(t);L.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}if(navigator.appName==="Netscape"){e=11;const t=/Trident\/.*rv:(\d[.0-9]*)/;if(t.exec(navigator.userAgent)!=null){const s=navigator.userAgent.match(t);L.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return ve.includes("macintosh")}isWin(){return ve.includes("windows")}isLinux(){return ve.includes("linux")&&!this.isAndroid()}isAndroid(){return ve.includes("android")}isIPad(){return ve.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return ve.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||ve.includes("mobile")||ve.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=/Android (\d[.0-9]*)/;if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(L.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const Oo=new Mh;var X=(r=>(r.v3="v3",r.v2="v2",r))(X||{}),Lh=Object.defineProperty,Ph=a((r,e)=>Lh(r,"name",{value:e,configurable:!0}),"R$2"),ko=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r.order="ORDER",r))(ko||{}),Qe=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r[r.order=14]="order",r))(Qe||{}),Ws=(r=>(r.undefined="?",r.lead="L",r.deal="D",r.contact="C",r.company="CO",r.oldInvoice="I",r.invoice="SI",r.quote="Q",r.requisite="RQ",r.order="O",r))(Ws||{});function To(r){const e=Qe[r];return Ws[e]||"?"}a(To,"getEnumCrmEntityTypeShort"),Ph(To,"getEnumCrmEntityTypeShort");var Io=(r=>(r[r.undefined=0]="undefined",r[r.absolute=1]="absolute",r[r.percentage=2]="percentage",r))(Io||{}),Ao=(r=>(r[r.undefined=0]="undefined",r[r.product=1]="product",r[r.service=7]="service",r[r.sku=3]="sku",r[r.skuEmpty=6]="skuEmpty",r[r.offer=4]="offer",r[r.offerEmpty=5]="offerEmpty",r))(Ao||{}),Ro=(r=>(r.undefined="UNDEFINED",r.detail="DETAIL_PICTURE",r.preview="PREVIEW_PICTURE",r.morePhoto="MORE_PHOTO",r))(Ro||{}),Co=(r=>(r[r.undefined=0]="undefined",r[r.mathematical=1]="mathematical",r[r.roundingUp=2]="roundingUp",r[r.roundingDown=4]="roundingDown",r))(Co||{}),Fh=Object.defineProperty,jr=a((r,e)=>Fh(r,"name",{value:e,configurable:!0}),"u$6"),No=(r=>(r.undefined="undefined",r.b24="b24",r.box="box",r))(No||{}),Do=(r=>(r.undefined="undefined",r.crm="crm",r.disk="disk",r.lists="lists",r))(Do||{}),Mo=(r=>(r.undefined="undefined",r.lead="CCrmDocumentLead",r.company="CCrmDocumentCompany",r.contact="CCrmDocumentContact",r.deal="CCrmDocumentDeal",r.invoice="Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",r.quote="Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",r.order="Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",r.dynamic="Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",r.disk="Bitrix\\Disk\\BizProcDocument",r.lists="BizprocDocument",r.listsList="Bitrix\\Lists\\BizprocDocumentLists",r))(Mo||{});function Lo(r){switch(r){case"CCrmDocumentLead":return Qe.lead;case"CCrmDocumentCompany":return Qe.company;case"CCrmDocumentContact":return Qe.contact;case"CCrmDocumentDeal":return Qe.deal;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":return Qe.invoice;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":return Qe.quote;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":return Qe.order}return Qe.undefined}a(Lo,"convertBizprocDocumentTypeToCrmEntityTypeId"),jr(Lo,"convertBizprocDocumentTypeToCrmEntityTypeId");function Ur(r,e){let t="",s="undefined";switch(r){case"CCrmDocumentLead":s="crm",t="LEAD";break;case"CCrmDocumentCompany":s="crm",t="COMPANY";break;case"CCrmDocumentContact":s="crm",t="CONTACT";break;case"CCrmDocumentDeal":s="crm",t="DEAL";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s="crm",t="SMART_INVOICE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s="crm",t="QUOTE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s="crm",t="ORDER";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s="crm",t=`DYNAMIC_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Disk\\BizProcDocument":if(s="disk",t=`STORAGE_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"BizprocDocument":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Lists\\BizprocDocumentLists":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break}return[s,r,t]}a(Ur,"getDocumentType"),jr(Ur,"getDocumentType");function Po(r,e,t){let s="";const n=Ur(r,1);switch(r){case"CCrmDocumentLead":s=`LEAD_${e}`;break;case"CCrmDocumentCompany":s=`COMPANY_${e}`;break;case"CCrmDocumentContact":s=`CONTACT_${e}`;break;case"CCrmDocumentDeal":s=`DEAL_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s=`SMART_INVOICE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s=`QUOTE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s=`ORDER_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s=`DYNAMIC_${t||0}_${e}`,(t||0)<1)throw new Error("Need set dynamicId");break;case"Bitrix\\Disk\\BizProcDocument":s=`${e}`;break;case"BizprocDocument":s=`${e}`;break;case"Bitrix\\Lists\\BizprocDocumentLists":s=`${e}`;break}return[n[0],n[1],s]}a(Po,"getDocumentId"),jr(Po,"getDocumentId");function Fo(r){const e=Ur(r,1);return[e[0],e[1]]}a(Fo,"getDocumentTypeForFilter"),jr(Fo,"getDocumentTypeForFilter");var le=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(le||{});const lt={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},xo={[lt.Free]:"Free",[lt.Demo]:"Demo",[lt.Trial]:"Trial",[lt.Paid]:"Paid",[lt.Local]:"Local",[lt.Subscription]:"Subscription"},Tt={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var ut=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(ut||{}),he=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(he||{}),Ue=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(Ue||{}),Ve=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(Ve||{}),Vr=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Vr||{}),qe=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(qe||{}),Re=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(Re||{}),lr=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(lr||{}),Hs=(r=>(r.Shared="shared",r.Personal="personal",r))(Hs||{});const zs={Parse:{code:-32700,message:"Parse error"},InvalidRequest:{code:-32600,message:"Invalid Request"},MethodNotFound:{code:-32601,message:"Method not found"},InvalidParams:{code:-32602,message:"Invalid params"},Internal:{code:-32603,message:"Internal error"}};var st=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(st||{}),Js=(r=>(r.ru="ru",r.id="id",r.ms="ms",r.de="de",r.en="en",r.la="la",r.fr="fr",r.in="in",r.it="it",r.pl="pl",r.br="br",r.vn="vn",r.tr="tr",r.kz="kz",r.ua="ua",r.ar="ar",r.th="th",r.sc="sc",r.tc="tc",r.ja="ja",r))(Js||{});const xh={ru:"ru-RU",id:"id-ID",ms:"ms-MY",de:"de-DE",en:"en-EN",la:"es-ES",fr:"fr-FR",in:"hi-IN",it:"it-IT",pl:"pl-PL",br:"pt-BR",vn:"vi-VN",tr:"tr-TR",kz:"kk",ua:"uk-UA",ar:"ar-SA",th:"th-TH",sc:"zh-CN",tc:"zh-TW",ja:"ja-JP"};var $h=Object.defineProperty,Bh=a((r,e)=>$h(r,"name",{value:e,configurable:!0}),"s$n");class Le{static{a(this,"Result")}static{Bh(this,"Result")}_errors;_data;constructor(e){this._errors=new Map,this._data=e??null}get isSuccess(){return this._errors.size===0}get errors(){return this._errors}setData(e){return this._data=e,this}getData(){return this._data}addError(e,t){const s=t??H.getUuidRfc4122(),n=typeof e=="string"?new Error(e):e;return this._errors.set(s,n),this}addErrors(e){for(const t of e)this.addError(t);return this}getErrors(){return this._errors.values()}hasError(e){return this._errors.has(e)}getErrorMessages(){return Array.from(this._errors.values(),e=>e.message)}toString(){const e=this.isSuccess?"success":"failure",t=this.safeStringify(this._data);return this.isSuccess?`Result(${e}): ${t}`:`Result(${e}): ${t}
|
|
31
|
+
Errors: ${this.getErrorMessages().join(", ")}`}safeStringify(e){try{return JSON.stringify(e,this.replacer,2)}catch{return"[Unable to serialize data]"}}replacer(e,t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}static ok(e){return new Le(e)}static fail(e,t){return new Le().addError(e,t)}}var jh=Object.defineProperty,Uh=a((r,e)=>jh(r,"name",{value:e,configurable:!0}),"r$f");class ne extends Error{static{a(this,"SdkError")}static{Uh(this,"SdkError")}code;_status;timestamp;originalError;constructor(e){const t=ne.formatErrorMessage(e);super(t),this.name="SdkError",this.code=e.code,this._status=e.status,this.originalError=e.originalError,this.timestamp=new Date,this.cleanErrorStack()}get status(){return this._status}static fromException(e,t){return e instanceof ne?e:new ne({code:t?.code||"JSSDK_INTERNAL_ERROR",status:t?.status||500,description:e instanceof Error?e.message:`${e}`,originalError:e})}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this._status,timestamp:this.timestamp.toISOString(),stack:this.stack}}toString(){let e=`[${this.name}] ${this.code} (${this._status}): ${this.message}`;return this.stack&&(e+=`
|
|
32
|
+
Stack trace:
|
|
33
|
+
${this.stack}`),e}static formatErrorMessage(e){return e?.description?`${e.description}`:"Internal error"}cleanErrorStack(){typeof this.stack=="string"&&(this.stack=this.stack.split(`
|
|
34
|
+
`).filter(e=>!e.includes("SdkError.constructor")).join(`
|
|
35
|
+
`))}}var Vh=Object.defineProperty,qh=a((r,e)=>Vh(r,"name",{value:e,configurable:!0}),"e$8");class be extends ne{static{a(this,"AjaxError")}static{qh(this,"AjaxError")}requestInfo;constructor(e){(e.code==="AUTHORIZE_ERROR"||e.code==="WRONG_AUTH_TYPE")&&(e.status=403),e.description=be.formatErrorMessage(e),super(e),this.name="AjaxError",this.requestInfo=e.requestInfo,this.cleanErrorStack()}static fromResponse(e){return new be({code:e.data?.error||"JSSDK_INTERNAL_AJAX_ERROR",description:e.data?.error_description,status:e.status,requestInfo:e.config})}static fromException(e,t){return e instanceof be?e:new be({code:t?.code||"JSSDK_INTERNAL_AJAX_ERROR",status:t?.status||500,description:e instanceof Error?e.message:String(e),requestInfo:t?.requestInfo,originalError:e})}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this._status,timestamp:this.timestamp.toISOString(),requestInfo:this.requestInfo,stack:this.stack}}toString(){let e=`[${this.name}] ${this.code} (${this._status}): ${this.message}`;return this.requestInfo&&(e+=`
|
|
36
|
+
Request: ${this.requestInfo?.requestId?`[${this.requestInfo.requestId}] `:""}${this.requestInfo.method} ${this.requestInfo.url}`),this.stack&&(e+=`
|
|
4
37
|
Stack trace:
|
|
5
|
-
${this.stack}`),e}static formatErrorMessage(e){
|
|
38
|
+
${this.stack}`),e}static formatErrorMessage(e){return e?.description?`${e.description}`:e.requestInfo?.method&&e.requestInfo.url?`${e.code} (on ${e.requestInfo.method}${e.requestInfo?.url?" "+e.requestInfo.url:""})`:"Internal ajax error"}cleanErrorStack(){typeof this.stack=="string"&&(this.stack=this.stack.split(`
|
|
6
39
|
`).filter(e=>!e.includes("AjaxError.constructor")).join(`
|
|
7
|
-
`))}}class Tr extends qe{_status;_query;_data;constructor(e){super(),this._data=Object.freeze(e.answer),this._query=Object.freeze(structuredClone(e.query)),this._status=e.status,this.#e()}#e(){const{error:e}=this._data;if(!e)return;const t=this.#t(e);this.addError(this.#r(t),"base-error")}#t(e){return typeof e=="string"?{code:e,description:this._data.error_description||""}:{code:e.error,description:e.error_description||""}}#r(e){return new xe({code:String(this._status),description:e.description,status:this._status,requestInfo:{method:this._query.method,params:this._query.params}})}getData(){return Object.freeze({result:this._data.result,next:this._data.next,total:this._data.total,time:this._data.time})}hasMore(){return this.isMore()}isMore(){return C.isNumber(this._data?.next)}getTotal(){return V.toInteger(this._data?.total)}getStatus(){return this._status}getQuery(){return this._query}async fetchNext(e){const t=await this.getNext(e);return t===!1?null:t}async getNext(e){if(!this.isMore()||!this.isSuccess)return!1;const t=this.#n();return e.call(t.method,t.params,t.start)}#n(){return{...this._query,start:V.toInteger(this._data.next)}}setData(){throw new ReferenceError("AjaxResult does not allow data modification")}}let _c=class{#e;#t;#r;_logger=null;constructor(){this.#e=Ni,this.#r=0,this.#t=0}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}get params(){return{...this.#e}}set params(e){this.#e=e,this.getLogger().log("new restriction manager params",e)}check(e=""){return new Promise(t=>{if(this.#s(),this.#o())return this.getLogger().log(`>> no sleep >>> ${e}`,this.#n()),this.#i(),t(null);{const n=i=>{this.getLogger().info(`>> go sleep >>> ${e}`,this.#n()),setTimeout(()=>{i()},this.#e.sleep)},s=()=>{if(this.#s(),this.#o())return this.getLogger().info(`<< stop sleep <<< ${e}`,this.#n()),this.#i(),t(null);n(s)};n(s)}})}#n(){return`${this.#r.toFixed(4)} from ${this.#e.amount}`}#s(){this.#t>0&&(this.#r-=(Date.now()-this.#t)*this.#e.speed,this.#r<0&&(this.#r=0)),this.#t=Date.now()}#i(){this.#r++}#o(){return this.#r<this.#e.amount}};const kc="X-Request-ID",vc="bx24_request_id",Ec="bx24_sdk_ver",Tc="bx24_sdk_type";let Oc=class{getQueryStringParameterName(){return vc}getQueryStringSdkParameterName(){return Ec}getQueryStringSdkTypeParameterName(){return Tc}generate(){return V.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return kc}};function Ui(r,e){return function(){return r.apply(e,arguments)}}const{toString:Ac}=Object.prototype,{getPrototypeOf:_n}=Object,{iterator:Or,toStringTag:$i}=Symbol,Ar=(r=>e=>{const t=Ac.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ze=r=>(r=r.toLowerCase(),e=>Ar(e)===r),Ir=r=>e=>typeof e===r,{isArray:Mt}=Array,Ft=Ir("undefined");function Xt(r){return r!==null&&!Ft(r)&&r.constructor!==null&&!Ft(r.constructor)&&Oe(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const Wi=ze("ArrayBuffer");function Ic(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Wi(r.buffer),e}const Cc=Ir("string"),Oe=Ir("function"),Vi=Ir("number"),er=r=>r!==null&&typeof r=="object",Nc=r=>r===!0||r===!1,Cr=r=>{if(Ar(r)!=="object")return!1;const e=_n(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!($i in r)&&!(Or in r)},Rc=r=>{if(!er(r)||Xt(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},Lc=ze("Date"),Pc=ze("File"),Dc=ze("Blob"),Mc=ze("FileList"),Fc=r=>er(r)&&Oe(r.pipe),xc=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Oe(r.append)&&((e=Ar(r))==="formdata"||e==="object"&&Oe(r.toString)&&r.toString()==="[object FormData]"))},jc=ze("URLSearchParams"),[Bc,Uc,$c,Wc]=["ReadableStream","Request","Response","Headers"].map(ze),Vc=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,s;if(typeof r!="object"&&(r=[r]),Mt(r))for(n=0,s=r.length;n<s;n++)e.call(null,r[n],n,r);else{if(Xt(r))return;const i=t?Object.getOwnPropertyNames(r):Object.keys(r),o=i.length;let l;for(n=0;n<o;n++)l=i[n],e.call(null,r[l],l,r)}}function qi(r,e){if(Xt(r))return null;e=e.toLowerCase();const t=Object.keys(r);let n=t.length,s;for(;n-- >0;)if(s=t[n],e===s.toLowerCase())return s;return null}const wt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,zi=r=>!Ft(r)&&r!==wt;function kn(){const{caseless:r,skipUndefined:e}=zi(this)&&this||{},t={},n=(s,i)=>{const o=r&&qi(t,i)||i;Cr(t[o])&&Cr(s)?t[o]=kn(t[o],s):Cr(s)?t[o]=kn({},s):Mt(s)?t[o]=s.slice():(!e||!Ft(s))&&(t[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&tr(arguments[s],n);return t}const qc=(r,e,t,{allOwnKeys:n}={})=>(tr(e,(s,i)=>{t&&Oe(s)?r[i]=Ui(s,t):r[i]=s},{allOwnKeys:n}),r),zc=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Hc=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},Jc=(r,e,t,n)=>{let s,i,o;const l={};if(e=e||{},r==null)return e;do{for(s=Object.getOwnPropertyNames(r),i=s.length;i-- >0;)o=s[i],(!n||n(o,r,e))&&!l[o]&&(e[o]=r[o],l[o]=!0);r=t!==!1&&_n(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},Zc=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},Gc=r=>{if(!r)return null;if(Mt(r))return r;let e=r.length;if(!Vi(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Yc=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&_n(Uint8Array)),Kc=(r,e)=>{const n=(r&&r[Or]).call(r);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(r,i[0],i[1])}},Qc=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},Xc=ze("HTMLFormElement"),eu=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,s){return n.toUpperCase()+s}),Hi=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),tu=ze("RegExp"),Ji=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};tr(t,(s,i)=>{let o;(o=e(s,i,r))!==!1&&(n[i]=o||s)}),Object.defineProperties(r,n)},ru=r=>{Ji(r,(e,t)=>{if(Oe(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Oe(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},nu=(r,e)=>{const t={},n=s=>{s.forEach(i=>{t[i]=!0})};return Mt(r)?n(r):n(String(r).split(e)),t},su=()=>{},iu=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function ou(r){return!!(r&&Oe(r.append)&&r[$i]==="FormData"&&r[Or])}const au=r=>{const e=new Array(10),t=(n,s)=>{if(er(n)){if(e.indexOf(n)>=0)return;if(Xt(n))return n;if(!("toJSON"in n)){e[s]=n;const i=Mt(n)?[]:{};return tr(n,(o,l)=>{const a=t(o,s+1);!Ft(a)&&(i[l]=a)}),e[s]=void 0,i}}return n};return t(r,0)},lu=ze("AsyncFunction"),cu=r=>r&&(er(r)||Oe(r))&&Oe(r.then)&&Oe(r.catch),Zi=((r,e)=>r?setImmediate:e?((t,n)=>(wt.addEventListener("message",({source:s,data:i})=>{s===wt&&i===t&&n.length&&n.shift()()},!1),s=>{n.push(s),wt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Oe(wt.postMessage)),uu=typeof queueMicrotask<"u"?queueMicrotask.bind(wt):typeof process<"u"&&process.nextTick||Zi,k={isArray:Mt,isArrayBuffer:Wi,isBuffer:Xt,isFormData:xc,isArrayBufferView:Ic,isString:Cc,isNumber:Vi,isBoolean:Nc,isObject:er,isPlainObject:Cr,isEmptyObject:Rc,isReadableStream:Bc,isRequest:Uc,isResponse:$c,isHeaders:Wc,isUndefined:Ft,isDate:Lc,isFile:Pc,isBlob:Dc,isRegExp:tu,isFunction:Oe,isStream:Fc,isURLSearchParams:jc,isTypedArray:Yc,isFileList:Mc,forEach:tr,merge:kn,extend:qc,trim:Vc,stripBOM:zc,inherits:Hc,toFlatObject:Jc,kindOf:Ar,kindOfTest:ze,endsWith:Zc,toArray:Gc,forEachEntry:Kc,matchAll:Qc,isHTMLForm:Xc,hasOwnProperty:Hi,hasOwnProp:Hi,reduceDescriptors:Ji,freezeMethods:ru,toObjectSet:nu,toCamelCase:eu,noop:su,toFiniteNumber:iu,findKey:qi,global:wt,isContextDefined:zi,isSpecCompliantForm:ou,toJSONObject:au,isAsyncFn:lu,isThenable:cu,setImmediate:Zi,asap:uu,isIterable:r=>r!=null&&Oe(r[Or])};function H(r,e,t,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}k.inherits(H,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:k.toJSONObject(this.config),code:this.code,status:this.status}}});const Gi=H.prototype,Yi={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Yi[r]={value:r}}),Object.defineProperties(H,Yi),Object.defineProperty(Gi,"isAxiosError",{value:!0}),H.from=(r,e,t,n,s,i)=>{const o=Object.create(Gi);k.toFlatObject(r,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=r&&r.message?r.message:"Error",a=e==null&&r?r.code:e;return H.call(o,l,a,t,n,s),r&&o.cause==null&&Object.defineProperty(o,"cause",{value:r,configurable:!0}),o.name=r&&r.name||"Error",i&&Object.assign(o,i),o};const hu=null;function vn(r){return k.isPlainObject(r)||k.isArray(r)}function Ki(r){return k.endsWith(r,"[]")?r.slice(0,-2):r}function Qi(r,e,t){return r?r.concat(e).map(function(s,i){return s=Ki(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function fu(r){return k.isArray(r)&&!r.some(vn)}const du=k.toFlatObject(k,{},null,function(e){return/^is[A-Z]/.test(e)});function Nr(r,e,t){if(!k.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=k.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,m){return!k.isUndefined(m[g])});const n=t.metaTokens,s=t.visitor||c,i=t.dots,o=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&k.isSpecCompliantForm(e);if(!k.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(k.isDate(d))return d.toISOString();if(k.isBoolean(d))return d.toString();if(!a&&k.isBlob(d))throw new H("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(d)||k.isTypedArray(d)?a&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function c(d,g,m){let y=d;if(d&&!m&&typeof d=="object"){if(k.endsWith(g,"{}"))g=n?g:g.slice(0,-2),d=JSON.stringify(d);else if(k.isArray(d)&&fu(d)||(k.isFileList(d)||k.endsWith(g,"[]"))&&(y=k.toArray(d)))return g=Ki(g),y.forEach(function(_,b){!(k.isUndefined(_)||_===null)&&e.append(o===!0?Qi([g],b,i):o===null?g:g+"[]",u(_))}),!1}return vn(d)?!0:(e.append(Qi(m,g,i),u(d)),!1)}const f=[],h=Object.assign(du,{defaultVisitor:c,convertValue:u,isVisitable:vn});function p(d,g){if(!k.isUndefined(d)){if(f.indexOf(d)!==-1)throw Error("Circular reference detected in "+g.join("."));f.push(d),k.forEach(d,function(y,w){(!(k.isUndefined(y)||y===null)&&s.call(e,y,k.isString(w)?w.trim():w,g,h))===!0&&p(y,g?g.concat(w):[w])}),f.pop()}}if(!k.isObject(r))throw new TypeError("data must be an object");return p(r),e}function Xi(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function En(r,e){this._pairs=[],r&&Nr(r,this,e)}const eo=En.prototype;eo.append=function(e,t){this._pairs.push([e,t])},eo.toString=function(e){const t=e?function(n){return e.call(this,n,Xi)}:Xi;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function pu(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function to(r,e,t){if(!e)return r;const n=t&&t.encode||pu;k.isFunction(t)&&(t={serialize:t});const s=t&&t.serialize;let i;if(s?i=s(e,t):i=k.isURLSearchParams(e)?e.toString():new En(e,t).toString(n),i){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r}class ro{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){k.forEach(this.handlers,function(n){n!==null&&e(n)})}}const no={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gu={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:En,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Tn=typeof window<"u"&&typeof document<"u",On=typeof navigator=="object"&&navigator||void 0,mu=Tn&&(!On||["ReactNative","NativeScript","NS"].indexOf(On.product)<0),yu=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",wu=Tn&&window.location.href||"http://localhost",ke={...{__proto__:null,hasBrowserEnv:Tn,hasStandardBrowserEnv:mu,hasStandardBrowserWebWorkerEnv:yu,navigator:On,origin:wu},...gu};function bu(r,e){return Nr(r,new ke.classes.URLSearchParams,{visitor:function(t,n,s,i){return ke.isNode&&k.isBuffer(t)?(this.append(n,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Su(r){return k.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function _u(r){const e={},t=Object.keys(r);let n;const s=t.length;let i;for(n=0;n<s;n++)i=t[n],e[i]=r[i];return e}function so(r){function e(t,n,s,i){let o=t[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),a=i>=t.length;return o=!o&&k.isArray(s)?s.length:o,a?(k.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!l):((!s[o]||!k.isObject(s[o]))&&(s[o]=[]),e(t,n,s[o],i)&&k.isArray(s[o])&&(s[o]=_u(s[o])),!l)}if(k.isFormData(r)&&k.isFunction(r.entries)){const t={};return k.forEachEntry(r,(n,s)=>{e(Su(n),s,t,0)}),t}return null}function ku(r,e,t){if(k.isString(r))try{return(e||JSON.parse)(r),k.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}const rr={transitional:no,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",s=n.indexOf("application/json")>-1,i=k.isObject(e);if(i&&k.isHTMLForm(e)&&(e=new FormData(e)),k.isFormData(e))return s?JSON.stringify(so(e)):e;if(k.isArrayBuffer(e)||k.isBuffer(e)||k.isStream(e)||k.isFile(e)||k.isBlob(e)||k.isReadableStream(e))return e;if(k.isArrayBufferView(e))return e.buffer;if(k.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return bu(e,this.formSerializer).toString();if((l=k.isFileList(e))||n.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Nr(l?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),ku(e)):e}],transformResponse:[function(e){const t=this.transitional||rr.transitional,n=t&&t.forcedJSONParsing,s=this.responseType==="json";if(k.isResponse(e)||k.isReadableStream(e))return e;if(e&&k.isString(e)&&(n&&!this.responseType||s)){const o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?H.from(l,H.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ke.classes.FormData,Blob:ke.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch"],r=>{rr.headers[r]={}});const vu=k.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Eu=r=>{const e={};let t,n,s;return r&&r.split(`
|
|
8
|
-
`).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!t||e[t]&&vu[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},io=Symbol("internals");function nr(r){return r&&String(r).trim().toLowerCase()}function Rr(r){return r===!1||r==null?r:k.isArray(r)?r.map(Rr):String(r)}function Tu(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}const Ou=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function An(r,e,t,n,s){if(k.isFunction(n))return n.call(this,e,t);if(s&&(e=t),!!k.isString(e)){if(k.isString(n))return e.indexOf(n)!==-1;if(k.isRegExp(n))return n.test(e)}}function Au(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Iu(r,e){const t=k.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(s,i,o){return this[n].call(this,e,s,i,o)},configurable:!0})})}let Ae=class{constructor(e){e&&this.set(e)}set(e,t,n){const s=this;function i(l,a,u){const c=nr(a);if(!c)throw new Error("header name must be a non-empty string");const f=k.findKey(s,c);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||a]=Rr(l))}const o=(l,a)=>k.forEach(l,(u,c)=>i(u,c,a));if(k.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(k.isString(e)&&(e=e.trim())&&!Ou(e))o(Eu(e),t);else if(k.isObject(e)&&k.isIterable(e)){let l={},a,u;for(const c of e){if(!k.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(a=l[u])?k.isArray(a)?[...a,c[1]]:[a,c[1]]:c[1]}o(l,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=nr(e),e){const n=k.findKey(this,e);if(n){const s=this[n];if(!t)return s;if(t===!0)return Tu(s);if(k.isFunction(t))return t.call(this,s,n);if(k.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=nr(e),e){const n=k.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||An(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let s=!1;function i(o){if(o=nr(o),o){const l=k.findKey(n,o);l&&(!t||An(n,n[l],l,t))&&(delete n[l],s=!0)}}return k.isArray(e)?e.forEach(i):i(e),s}clear(e){const t=Object.keys(this);let n=t.length,s=!1;for(;n--;){const i=t[n];(!e||An(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,n={};return k.forEach(this,(s,i)=>{const o=k.findKey(n,i);if(o){t[o]=Rr(s),delete t[i];return}const l=e?Au(i):String(i).trim();l!==i&&delete t[i],t[l]=Rr(s),n[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return k.forEach(this,(n,s)=>{n!=null&&n!==!1&&(t[s]=e&&k.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
9
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[io]=this[io]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=nr(o);n[l]||(Iu(s,o),n[l]=!0)}return k.isArray(e)?e.forEach(i):i(e),this}};Ae.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),k.reduceDescriptors(Ae.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),k.freezeMethods(Ae);function In(r,e){const t=this||rr,n=e||t,s=Ae.from(n.headers);let i=n.data;return k.forEach(r,function(l){i=l.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function oo(r){return!!(r&&r.__CANCEL__)}function xt(r,e,t){H.call(this,r??"canceled",H.ERR_CANCELED,e,t),this.name="CanceledError"}k.inherits(xt,H,{__CANCEL__:!0});function ao(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new H("Request failed with status code "+t.status,[H.ERR_BAD_REQUEST,H.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Cu(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function Nu(r,e){r=r||10;const t=new Array(r),n=new Array(r);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),c=n[i];o||(o=u),t[s]=a,n[s]=u;let f=i,h=0;for(;f!==s;)h+=t[f++],f=f%r;if(s=(s+1)%r,s===i&&(i=(i+1)%r),u-o<e)return;const p=c&&u-c;return p?Math.round(h*1e3/p):void 0}}function Ru(r,e){let t=0,n=1e3/e,s,i;const o=(u,c=Date.now())=>{t=c,s=null,i&&(clearTimeout(i),i=null),r(...u)};return[(...u)=>{const c=Date.now(),f=c-t;f>=n?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Lr=(r,e,t=3)=>{let n=0;const s=Nu(50,250);return Ru(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,a=o-n,u=s(a),c=o<=l;n=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:a,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};r(f)},t)},lo=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},co=r=>(...e)=>k.asap(()=>r(...e)),Lu=ke.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,ke.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(ke.origin),ke.navigator&&/(msie|trident)/i.test(ke.navigator.userAgent)):()=>!0,Pu=ke.hasStandardBrowserEnv?{write(r,e,t,n,s,i){const o=[r+"="+encodeURIComponent(e)];k.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),k.isString(n)&&o.push("path="+n),k.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Du(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Mu(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function uo(r,e,t){let n=!Du(e);return r&&(n||t==!1)?Mu(r,e):e}const ho=r=>r instanceof Ae?{...r}:r;function bt(r,e){e=e||{};const t={};function n(u,c,f,h){return k.isPlainObject(u)&&k.isPlainObject(c)?k.merge.call({caseless:h},u,c):k.isPlainObject(c)?k.merge({},c):k.isArray(c)?c.slice():c}function s(u,c,f,h){if(k.isUndefined(c)){if(!k.isUndefined(u))return n(void 0,u,f,h)}else return n(u,c,f,h)}function i(u,c){if(!k.isUndefined(c))return n(void 0,c)}function o(u,c){if(k.isUndefined(c)){if(!k.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function l(u,c,f){if(f in e)return n(u,c);if(f in r)return n(void 0,u)}const a={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,c,f)=>s(ho(u),ho(c),f,!0)};return k.forEach(Object.keys({...r,...e}),function(c){const f=a[c]||s,h=f(r[c],e[c],c);k.isUndefined(h)&&f!==l||(t[c]=h)}),t}const fo=r=>{const e=bt({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=e;if(e.headers=o=Ae.from(o),e.url=to(uo(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),k.isFormData(t)){if(ke.hasStandardBrowserEnv||ke.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(k.isFunction(t.getHeaders)){const a=t.getHeaders(),u=["content-type","content-length"];Object.entries(a).forEach(([c,f])=>{u.includes(c.toLowerCase())&&o.set(c,f)})}}if(ke.hasStandardBrowserEnv&&(n&&k.isFunction(n)&&(n=n(e)),n||n!==!1&&Lu(e.url))){const a=s&&i&&Pu.read(i);a&&o.set(s,a)}return e},Fu=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const s=fo(r);let i=s.data;const o=Ae.from(s.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:u}=s,c,f,h,p,d;function g(){p&&p(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function y(){if(!m)return;const _=Ae.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),E={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:_,config:r,request:m};ao(function(v){t(v),g()},function(v){n(v),g()},E),m=null}"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(y)},m.onabort=function(){m&&(n(new H("Request aborted",H.ECONNABORTED,r,m)),m=null)},m.onerror=function(b){const E=b&&b.message?b.message:"Network Error",S=new H(E,H.ERR_NETWORK,r,m);S.event=b||null,n(S),m=null},m.ontimeout=function(){let b=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||no;s.timeoutErrorMessage&&(b=s.timeoutErrorMessage),n(new H(b,E.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,r,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&k.forEach(o.toJSON(),function(b,E){m.setRequestHeader(E,b)}),k.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([h,d]=Lr(u,!0),m.addEventListener("progress",h)),a&&m.upload&&([f,p]=Lr(a),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(c=_=>{m&&(n(!_||_.type?new xt(null,r,m):_),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const w=Cu(s.url);if(w&&ke.protocols.indexOf(w)===-1){n(new H("Unsupported protocol "+w+":",H.ERR_BAD_REQUEST,r));return}m.send(i||null)})},xu=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,s;const i=function(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;n.abort(c instanceof H?c:new xt(c instanceof Error?c.message:c))}};let o=e&&setTimeout(()=>{o=null,i(new H(`timeout ${e} of ms exceeded`,H.ETIMEDOUT))},e);const l=()=>{r&&(o&&clearTimeout(o),o=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),r=null)};r.forEach(u=>u.addEventListener("abort",i));const{signal:a}=n;return a.unsubscribe=()=>k.asap(l),a}},ju=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,s;for(;n<t;)s=n+e,yield r.slice(n,s),n=s},Bu=async function*(r,e){for await(const t of Uu(r))yield*ju(t,e)},Uu=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},po=(r,e,t,n)=>{const s=Bu(r,e);let i=0,o,l=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{const{done:u,value:c}=await s.next();if(u){l(),a.close();return}let f=c.byteLength;if(t){let h=i+=f;t(h)}a.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(a){return l(a),s.return()}},{highWaterMark:2})},go=64*1024,{isFunction:Pr}=k,$u=(({Request:r,Response:e})=>({Request:r,Response:e}))(k.global),{ReadableStream:mo,TextEncoder:yo}=k.global,wo=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Wu=r=>{r=k.merge.call({skipUndefined:!0},$u,r);const{fetch:e,Request:t,Response:n}=r,s=e?Pr(e):typeof fetch=="function",i=Pr(t),o=Pr(n);if(!s)return!1;const l=s&&Pr(mo),a=s&&(typeof yo=="function"?(d=>g=>d.encode(g))(new yo):async d=>new Uint8Array(await new t(d).arrayBuffer())),u=i&&l&&wo(()=>{let d=!1;const g=new t(ke.origin,{body:new mo,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!g}),c=o&&l&&wo(()=>k.isReadableStream(new n("").body)),f={stream:c&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!f[d]&&(f[d]=(g,m)=>{let y=g&&g[d];if(y)return y.call(g);throw new H(`Response type '${d}' is not supported`,H.ERR_NOT_SUPPORT,m)})});const h=async d=>{if(d==null)return 0;if(k.isBlob(d))return d.size;if(k.isSpecCompliantForm(d))return(await new t(ke.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(k.isArrayBufferView(d)||k.isArrayBuffer(d))return d.byteLength;if(k.isURLSearchParams(d)&&(d=d+""),k.isString(d))return(await a(d)).byteLength},p=async(d,g)=>{const m=k.toFiniteNumber(d.getContentLength());return m??h(g)};return async d=>{let{url:g,method:m,data:y,signal:w,cancelToken:_,timeout:b,onDownloadProgress:E,onUploadProgress:S,responseType:v,headers:L,withCredentials:j="same-origin",fetchOptions:x}=fo(d),J=e||fetch;v=v?(v+"").toLowerCase():"text";let ue=xu([w,_&&_.toAbortSignal()],b),$=null;const Z=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()});let B;try{if(S&&u&&m!=="get"&&m!=="head"&&(B=await p(L,y))!==0){let ye=new t(g,{method:"POST",body:y,duplex:"half"}),q;if(k.isFormData(y)&&(q=ye.headers.get("content-type"))&&L.setContentType(q),ye.body){const[te,re]=lo(B,Lr(co(S)));y=po(ye.body,go,te,re)}}k.isString(j)||(j=j?"include":"omit");const X=i&&"credentials"in t.prototype,ie={...x,signal:ue,method:m.toUpperCase(),headers:L.normalize().toJSON(),body:y,duplex:"half",credentials:X?j:void 0};$=i&&new t(g,ie);let M=await(i?J($,x):J(g,ie));const He=c&&(v==="stream"||v==="response");if(c&&(E||He&&Z)){const ye={};["status","statusText","headers"].forEach(oe=>{ye[oe]=M[oe]});const q=k.toFiniteNumber(M.headers.get("content-length")),[te,re]=E&&lo(q,Lr(co(E),!0))||[];M=new n(po(M.body,go,te,()=>{re&&re(),Z&&Z()}),ye)}v=v||"text";let st=await f[k.findKey(f,v)||"text"](M,d);return!He&&Z&&Z(),await new Promise((ye,q)=>{ao(ye,q,{data:st,headers:Ae.from(M.headers),status:M.status,statusText:M.statusText,config:d,request:$})})}catch(X){throw Z&&Z(),X&&X.name==="TypeError"&&/Load failed|fetch/i.test(X.message)?Object.assign(new H("Network Error",H.ERR_NETWORK,d,$),{cause:X.cause||X}):H.from(X,X&&X.code,d,$)}}},Vu=new Map,bo=r=>{let e=r?r.env:{};const{fetch:t,Request:n,Response:s}=e,i=[n,s,t];let o=i.length,l=o,a,u,c=Vu;for(;l--;)a=i[l],u=c.get(a),u===void 0&&c.set(a,u=l?new Map:Wu(e)),c=u;return u};bo();const Cn={http:hu,xhr:Fu,fetch:{get:bo}};k.forEach(Cn,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const So=r=>`- ${r}`,qu=r=>k.isFunction(r)||r===null||r===!1,_o={getAdapter:(r,e)=>{r=k.isArray(r)?r:[r];const{length:t}=r;let n,s;const i={};for(let o=0;o<t;o++){n=r[o];let l;if(s=n,!qu(n)&&(s=Cn[(l=String(n)).toLowerCase()],s===void 0))throw new H(`Unknown adapter '${l}'`);if(s&&(k.isFunction(s)||(s=s.get(e))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([a,u])=>`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=t?o.length>1?`since :
|
|
10
|
-
`+o.map(So).join(`
|
|
11
|
-
|
|
12
|
-
`+i):n.stack=i}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=bt(this.defaults,t);const{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&Mr.assertOptions(n,{silentJSONParsing:Ze.transitional(Ze.boolean),forcedJSONParsing:Ze.transitional(Ze.boolean),clarifyTimeoutError:Ze.transitional(Ze.boolean)},!1),s!=null&&(k.isFunction(s)?t.paramsSerializer={serialize:s}:Mr.assertOptions(s,{encode:Ze.function,serialize:Ze.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Mr.assertOptions(t,{baseUrl:Ze.spelling("baseURL"),withXsrfToken:Ze.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[t.method]);i&&k.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),t.headers=Ae.concat(o,i);const l=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(t)===!1||(a=a&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let c,f=0,h;if(!a){const d=[ko.bind(this),void 0];for(d.unshift(...l),d.push(...u),h=d.length,c=Promise.resolve(t);f<h;)c=c.then(d[f++],d[f++]);return c}h=l.length;let p=t;for(;f<h;){const d=l[f++],g=l[f++];try{p=d(p)}catch(m){g.call(this,m);break}}try{c=ko.call(this,p)}catch(d){return Promise.reject(d)}for(f=0,h=u.length;f<h;)c=c.then(u[f++],u[f++]);return c}getUri(e){e=bt(this.defaults,e);const t=uo(e.baseURL,e.url,e.allowAbsoluteUrls);return to(t,e.params,e.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(e){St.prototype[e]=function(t,n){return this.request(bt(n||{},{method:e,url:t,data:(n||{}).data}))}}),k.forEach(["post","put","patch"],function(e){function t(n){return function(i,o,l){return this.request(bt(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}St.prototype[e]=t(),St.prototype[e+"Form"]=t(!0)});let Hu=class oa{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{n.subscribe(l),i=l}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,l){n.reason||(n.reason=new xt(i,o,l),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new oa(function(s){e=s}),cancel:e}}};function Ju(r){return function(t){return r.apply(null,t)}}function Zu(r){return k.isObject(r)&&r.isAxiosError===!0}const Rn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Rn).forEach(([r,e])=>{Rn[e]=r});function To(r){const e=new St(r),t=Ui(St.prototype.request,e);return k.extend(t,St.prototype,e,{allOwnKeys:!0}),k.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return To(bt(r,s))},t}const ce=To(rr);ce.Axios=St,ce.CanceledError=xt,ce.CancelToken=Hu,ce.isCancel=oo,ce.VERSION=vo,ce.toFormData=Nr,ce.AxiosError=H,ce.Cancel=ce.CanceledError,ce.all=function(e){return Promise.all(e)},ce.spread=Ju,ce.isAxiosError=Zu,ce.mergeConfig=bt,ce.AxiosHeaders=Ae,ce.formToJSON=r=>so(k.isHTMLForm(r)?new FormData(r):r),ce.getAdapter=_o.getAdapter,ce.HttpStatusCode=Rn,ce.default=ce;const{Axios:kf,AxiosError:Ln,CanceledError:vf,isCancel:Ef,CancelToken:Tf,VERSION:Of,all:Af,Cancel:If,isAxiosError:Cf,spread:Nf,toFormData:Rf,AxiosHeaders:Lf,HttpStatusCode:Pf,formToJSON:Df,getAdapter:Mf,mergeConfig:Ff}=ce,Gu=String.prototype.replace,Yu=/%20/g,Oo={RFC1738:"RFC1738",RFC3986:"RFC3986"},Ku={RFC1738:function(r){return Gu.call(r,Yu,"+")},RFC3986:function(r){return String(r)}},Qu=Oo.RFC1738,Xu=Oo.RFC3986,Pn=Object.prototype.hasOwnProperty,_t=Array.isArray,Ge=(function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),eh=function(e){for(;e.length>1;){const t=e.pop(),n=t.obj[t.prop];if(_t(n)){const s=[];for(let i=0;i<n.length;++i)typeof n[i]<"u"&&s.push(n[i]);t.obj[t.prop]=s}}},th=function(e,t){const n=t&&t.plainObjects?Object.create(null):{};for(let s=0;s<e.length;++s)typeof e[s]<"u"&&(n[s]=e[s]);return n},rh=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(_t(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Pn.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);let s=e;return _t(e)&&!_t(t)&&(s=th(e,n)),_t(e)&&_t(t)?(t.forEach(function(i,o){if(Pn.call(e,o)){const l=e[o];l&&typeof l=="object"&&i&&typeof i=="object"?e[o]=r(l,i,n):e.push(i)}else e[o]=i}),e):Object.keys(t).reduce(function(i,o){const l=t[o];return Pn.call(i,o)?i[o]=r(i[o],l,n):i[o]=l,i},s)},nh=function(r,e,t){const n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Dn=1024,sh=function(e,t,n,s,i){if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let l="";for(let a=0;a<o.length;a+=Dn){const u=o.length>=Dn?o.slice(a,a+Dn):o,c=[];for(let f=0;f<u.length;++f){let h=u.charCodeAt(f);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||i===Qu&&(h===40||h===41)){c[c.length]=u.charAt(f);continue}if(h<128){c[c.length]=Ge[h];continue}if(h<2048){c[c.length]=Ge[192|h>>6]+Ge[128|h&63];continue}if(h<55296||h>=57344){c[c.length]=Ge[224|h>>12]+Ge[128|h>>6&63]+Ge[128|h&63];continue}f+=1,h=65536+((h&1023)<<10|u.charCodeAt(f)&1023),c[c.length]=Ge[240|h>>18]+Ge[128|h>>12&63]+Ge[128|h>>6&63]+Ge[128|h&63]}l+=c.join("")}return l},ih=function(e){const t=[{obj:{o:e},prop:"o"}],n=[];for(let s=0;s<t.length;++s){const i=t[s],o=i.obj[i.prop],l=Object.keys(o);for(let a=0;a<l.length;++a){const u=l[a],c=o[u];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:u}),n.push(c))}}return eh(t),e},oh=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},ah=function(e,t){return[].concat(e,t)},Mn=function(e,t){if(_t(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)},lh={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},rt=Array.isArray,ch=Array.prototype.push,Ao=function(r,e){ch.apply(r,rt(e)?e:[e])},uh=Date.prototype.toISOString,Io=Xu,Fr={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:sh,encodeValuesOnly:!1,format:Io,formatter:Ku[Io],indices:!1,serializeDate:function(e){return uh.call(e)},skipNulls:!1,strictNullHandling:!1},hh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Fn={},Co=function(e,t,n,s,i,o,l,a,u,c,f,h,p,d,g,m,y,w){let _=e,b=w,E=0,S=!1;for(;(b=b.get(Fn))!==void 0&&!S;){const J=b.get(e);if(E+=1,typeof J<"u"){if(J===E)throw new RangeError("Cyclic object value");S=!0}typeof b.get(Fn)>"u"&&(E=0)}if(typeof c=="function"?_=c(t,_):_ instanceof Date?_=p(_):n==="comma"&&rt(_)&&(_=Mn(_,function(J){return J instanceof Date?p(J):J})),_===null){if(o)return u&&!m?u(t,Fr.encoder,y,"key",d):t;_=""}if(hh(_)||oh(_)){if(u){const J=m?t:u(t,Fr.encoder,y,"key",d);return[g(J)+"="+g(u(_,Fr.encoder,y,"value",d))]}return[g(t)+"="+g(String(_))]}const v=[];if(typeof _>"u")return v;let L;if(n==="comma"&&rt(_))m&&u&&(_=Mn(_,u)),L=[{value:_.length>0?_.join(",")||null:void 0}];else if(rt(c))L=c;else{const J=Object.keys(_);L=f?J.sort(f):J}const j=a?t.replace(/\./g,"%2E"):t,x=s&&rt(_)&&_.length===1?j+"[]":j;if(i&&rt(_)&&_.length===0)return x+"[]";for(let J=0;J<L.length;++J){const ue=L[J],$=typeof ue=="object"&&typeof ue.value<"u"?ue.value:_[ue];if(l&&$===null)continue;const Z=h&&a?ue.replace(/\./g,"%2E"):ue,B=rt(_)?typeof n=="function"?n(x,Z):x:x+(h?"."+Z:"["+Z+"]");w.set(e,E);const X=new WeakMap;X.set(Fn,w),Ao(v,Co($,B,n,s,i,o,l,a,n==="comma"&&m&&rt(_)?null:u,c,f,h,p,d,g,m,y,X))}return v},fh=function(e){return Fr};function No(r,e){let t=r;const n=fh();let s,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):rt(n.filter)&&(i=n.filter,s=i);const o=[];if(typeof t!="object"||t===null)return"";const l=lh[n.arrayFormat],a=l==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);const u=new WeakMap;for(let h=0;h<s.length;++h){const p=s[h];n.skipNulls&&t[p]===null||Ao(o,Co(t[p],p,l,a,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}const c=o.join(n.delimiter);let f=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),c.length>0?f+c:""}const xn=Object.prototype.hasOwnProperty,dh=Array.isArray,xr={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:nh,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},ph=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Ro=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},gh="utf8=%26%2310003%3B",mh="utf8=%E2%9C%93",yh=function(e,t){const n={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,o=s.split(t.delimiter,i);let l=-1,a,u=t.charset;if(t.charsetSentinel)for(a=0;a<o.length;++a)o[a].indexOf("utf8=")===0&&(o[a]===mh?u="utf-8":o[a]===gh&&(u="iso-8859-1"),l=a,a=o.length);for(a=0;a<o.length;++a){if(a===l)continue;const c=o[a],f=c.indexOf("]="),h=f===-1?c.indexOf("="):f+1;let p,d;h===-1?(p=t.decoder(c,xr.decoder,u,"key"),d=t.strictNullHandling?null:""):(p=t.decoder(c.slice(0,h),xr.decoder,u,"key"),d=Mn(Ro(c.slice(h+1),t),function(m){return t.decoder(m,xr.decoder,u,"value")})),d&&t.interpretNumericEntities&&u==="iso-8859-1"&&(d=ph(d)),c.indexOf("[]=")>-1&&(d=dh(d)?[d]:d);const g=xn.call(n,p);g&&t.duplicates==="combine"?n[p]=ah(n[p],d):(!g||t.duplicates==="last")&&(n[p]=d)}return n},wh=function(r,e,t,n){let s=n?e:Ro(e,t);for(let i=r.length-1;i>=0;--i){let o;const l=r[i];if(l==="[]"&&t.parseArrays)o=t.allowEmptyArrays&&s===""?[]:[].concat(s);else{o=t.plainObjects?Object.create(null):{};const a=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=t.decodeDotInKeys?a.replace(/%2E/g,"."):a,c=parseInt(u,10);!t.parseArrays&&u===""?o={0:s}:!isNaN(c)&&l!==u&&String(c)===u&&c>=0&&t.parseArrays&&c<=t.arrayLimit?(o=[],o[c]=s):u!=="__proto__"&&(o[u]=s)}s=o}return s},bh=function(e,t,n,s){if(!e)return;const i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g;let a=n.depth>0&&o.exec(i);const u=a?i.slice(0,a.index):i,c=[];if(u){if(!n.plainObjects&&xn.call(Object.prototype,u)&&!n.allowPrototypes)return;c.push(u)}let f=0;for(;n.depth>0&&(a=l.exec(i))!==null&&f<n.depth;){if(f+=1,!n.plainObjects&&xn.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(a[1])}return a&&c.push("["+i.slice(a.index)+"]"),wh(c,t,n,s)},Sh=function(e){return xr};function Lo(r,e){const t=Sh();if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};const n=typeof r=="string"?yh(r,t):r;let s=t.plainObjects?Object.create(null):{};const i=Object.keys(n);for(let o=0;o<i.length;++o){const l=i[o],a=bh(l,n[l],t,typeof r=="string");s=rh(s,a,t)}return t.allowSparse===!0?s:ih(s)}class jn{#e;#t;#r;#n;_logger=null;_loggerSystem=null;#s="";#i=!1;#o="";constructor(e,t,n){const s={};this.#e=ce.create({baseURL:e,headers:{...s,...n?n.headers:{}},...n&&{...n,headers:void 0}}),this.#t=t,this.#r=new _c,this.#n=new Oc}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}getSystemLogger(){return this._loggerSystem===null&&(this._loggerSystem=we.build("SystemLogger"),this._loggerSystem.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!0,[I.warn]:!0,[I.error]:!0,[I.trace]:!1})),this._loggerSystem}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#s=e}clearLogTag(){this.#s=""}async batch(e,t=!0,n=!1){return Array.isArray(e)?this.#c(e,t,n):this.#a(e,t,n)}async#a(e,t=!0,n=!1){const s={};let i=0;const o=(l,a)=>{let u=null,c=null;l.method?(u=l.method??null,c=l?.params??null):Array.isArray(l)&&l.length>0&&(u=l[0]??null,c=l[1]??null),u&&(i++,s[a]=u+"?"+No(c))};for(const[l,a]of Object.entries(e))o(a,l);return i<1?Promise.resolve(new qe):this.call("batch",{halt:t?1:0,cmd:s}).then(l=>{const a=l.getData().result,u={},c=(d,g)=>{if(typeof a.result[g]<"u"||typeof a.result_error[g]<"u"){const m=d.split("?");u[g]=new Tr({answer:{result:C.isUndefined(a.result[g])?{}:a.result[g],error:a?.result_error[g]||void 0,total:a.result_total[g],next:a.result_next[g],time:a.result_time[g]},query:{method:m[0]||"",params:Lo(m[1]||""),start:0},status:l.getStatus()})}};for(const[d,g]of Object.entries(s))c(g,d);const f={},h=d=>d.hasError("base-error")?d.errors.get("base-error"):new xe({code:"0",description:d.getErrorMessages().join("; "),status:0,requestInfo:{method:d.getQuery().method,params:d.getQuery().params},originalError:d.getErrors().next().value}),p=new qe;for(const d of Object.keys(u)){const g=u[d];if(g.getStatus()!==200||!g.isSuccess){const m=h(g);if(!t&&!g.isSuccess){p.addError(m,d);continue}return Promise.reject(m)}f[d]=n?g:g.getData().result}return p.setData(f),Promise.resolve(p)})}async#c(e,t=!0,n=!1){const s=[];let i=0;const o=l=>{let a=null,u=null;if(l.method?(a=l.method??null,u=l?.params??null):Array.isArray(l)&&l.length>0&&(a=l[0]??null,u=l[1]??null),a){i++;const c=a+"?"+No(u);s.push(c)}};for(const[l,a]of e.entries())o(a);return i<1?Promise.resolve(new qe):this.call("batch",{halt:t?1:0,cmd:s}).then(l=>{const a=l.getData().result,u=[],c=(d,g)=>{if(typeof a.result[g]<"u"||typeof a.result_error[g]<"u"){const m=d.split("?"),y=new Tr({answer:{result:C.isUndefined(a.result[g])?{}:a.result[g],error:a?.result_error[g]||void 0,total:a.result_total[g],next:a.result_next[g],time:a.result_time[g]},query:{method:m[0]||"",params:Lo(m[1]||""),start:0},status:l.getStatus()});u.push(y)}};for(const[d,g]of s.entries())c(g,d);const f=[],h=d=>d.hasError("base-error")?d.errors.get("base-error"):new xe({code:"0",description:d.getErrorMessages().join("; "),status:0,requestInfo:{method:d.getQuery().method,params:d.getQuery().params},originalError:d.getErrors().next().value}),p=new qe;for(const d of u){if(d.getStatus()!==200||!d.isSuccess){const g=h(d);if(!t&&!d.isSuccess){p.addError(g);continue}return Promise.reject(g)}f.push(n?d:d.getData().result)}return p.setData(f),Promise.resolve(p)})}async call(e,t,n=0){let s=this.#t.getAuthData();return s===!1&&(s=await this.#t.refreshAuth()),await this.#r.check(),this.#i&&!this.isServerSide()&&C.isStringFilled(this.#o)&&this.getSystemLogger().warn(this.#o),this.#e.post(this.#u(e),this.#l(s,t,n)).then(i=>{const o=i.data;return Promise.resolve({status:i.status,payload:o})},async i=>{let o={error:i?.code||0,errorDescription:i?.message||""};if(i instanceof Ln&&i.response&&i.response.data&&!C.isUndefined(i.response.data.error)){const a=i.response.data;o={error:a.error,errorDescription:a.error_description}}const l=new xe({code:String(o.error),description:o.errorDescription,status:i.response?.status||0,requestInfo:{method:e,params:t},originalError:i});return l.status===401&&["expired_token","invalid_token"].includes(l.answerError.error)?(this.getLogger().info(`refreshAuth >> ${l.answerError.error} >>>`),s=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#u(e),this.#l(s,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof Ln&&a.response&&a.response.data){const f=a.response.data;u={error:f.error,errorDescription:f.error_description}}const c=new xe({code:String(u.error),description:u.errorDescription,status:i.response?.status||0,requestInfo:{method:e,params:t},originalError:a});return Promise.reject(c)})):Promise.reject(l)}).then(i=>{const o=new Tr({answer:i.payload,query:{method:e,params:t,start:n},status:i.status});return Promise.resolve(o)})}#l(e,t,n=0){const s=Object.assign({},t);return this.#s.length>0&&(s.logTag=this.#s),s.data&&s.data.start&&delete s.data.start,e.refresh_token!=="hook"&&(s.auth=e.access_token),s.start=n,s}#u(e){const t=`${encodeURIComponent(e)}.json`;if(e.includes("task."))return`${t}`;const n=new URLSearchParams({[this.#n.getQueryStringParameterName()]:this.#n.getRequestId(),[this.#n.getQueryStringSdkParameterName()]:"0.5.1",[this.#n.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${t}?${n.toString()}`}setClientSideWarning(e,t){this.#i=e,this.#o=t}isServerSide(){return typeof window>"u"}}class kt{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,s=null){const i=new qe;return C.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let l=[],a;if(s===null?a=o.getData().result:a=o.getData().result[s],l=[...l,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let c;if(s===null?c=u.getData().result:c=u.getData().result[s],l=[...l,...c],n){const f=u.getTotal();n(f>0?Math.round(100*l.length/f):100)}}}return i.setData(l),n&&n(100),i})}async*fetchListMethod(e,t={},n="ID",s=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const i=`>${n}`;t.order[n]="ASC",t.filter[i]=0;do{const o=await this.callMethod(e,t,t.start);let l;if(!C.isNull(s)&&s!==null?l=o.getData().result[s]:l=o.getData().result,l.length===0||(yield l,l.length<kt.batchSize))break;const a=l.at(-1);a&&n in a&&(t.filter[i]=a[n])}while(!0)}async callBatch(e,t=!0,n=!1){return this.getHttpClient().batch(e,t,n)}chunkArray(e,t=50){const n=[];for(let s=0;s<e.length;s+=t){const i=e.slice(s,s+t);n.push(i)}return n}async callBatchByChunk(e,t=!0){const n=new qe,s=[],i=this.chunkArray(e,kt.batchSize);for(const o of i){const l=await this.callBatch(o,t);s.push(...l.getData())}return n.setData(s)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var Bn=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))(Bn||{});const _h={en:"en-EN",de:"de-DE",la:"es-ES",br:"pt-BR",fr:"fr-FR",it:"it-IT",pl:"pl-PL",ru:"ru-RU",ua:"uk-UA",tr:"tr-TR",sc:"zh-CN",tc:"zh-TW",ja:"ja-JP",vn:"vi-VN",id:"id-ID",ms:"ms-MY",th:"th-TH",ar:"ar-SA"},kh=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let vh=class ft{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!ft.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");ft.isInternalConstructing=!1}static getInstance(){return ft.instance||(ft.isInternalConstructing=!0,ft.instance=new ft),ft.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!C.isStringFilled(t))&&(t=C.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let s=n.format(e);return t.includes("ru")&&(s=s.replace(",",".")),s}};class T{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,s){this.countryCode=e,this.length=t,this.structure=n,this.example=s}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let s;const i=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(i){case"A":s="0-9A-Za-z";break;case"B":s="0-9A-Z";break;case"C":s="A-Za-z";break;case"F":s="0-9";break;case"L":s="a-z";break;case"U":s="A-Z";break;case"W":s="0-9a-z";break}return"(["+s+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class nt{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!nt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");nt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return nt.instance||(nt.isInternalConstructing=!0,nt.instance=new nt),nt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!C.isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const s=this._countries.get(n);if(!s)throw new Error(`No country with code ${n}`);return s.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!C.isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}}const Eh=()=>{const r=vh.getInstance(),e=nt.getInstance();return e.addSpecification(new T("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new T("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new T("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new T("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new T("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new T("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new T("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new T("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new T("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new T("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new T("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new T("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new T("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new T("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new T("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new T("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new T("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new T("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new T("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new T("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new T("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new T("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new T("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new T("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new T("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new T("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new T("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new T("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new T("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new T("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new T("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new T("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new T("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new T("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new T("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new T("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new T("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new T("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new T("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new T("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new T("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new T("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new T("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new T("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new T("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new T("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new T("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new T("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new T("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new T("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new T("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new T("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new T("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new T("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new T("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new T("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new T("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new T("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new T("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new T("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new T("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new T("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new T("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new T("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new T("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new T("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new T("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new T("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new T("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new T("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new T("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new T("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new T("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new T("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new T("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new T("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new T("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new T("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new T("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new T("BI",16,"F12","BI41123456789012")),e.addSpecification(new T("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new T("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new T("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new T("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new T("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new T("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new T("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new T("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new T("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new T("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new T("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new T("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new T("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new T("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new T("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new T("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new T("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new T("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new T("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new T("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new T("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new T("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class Po{#e;#t;#r;#n;constructor(e){this.#e=Object.freeze(Object.assign({},e)),this.#t=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#r=`https://${this.#t}/rest`,this.#n=`https://${this.#t}`}getAuthData(){return{access_token:this.#e.secret,refresh_token:"hook",expires:0,expires_in:0,domain:this.#t,member_id:this.#t}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#n}`}getTargetOriginWithPath(){return`${this.#r}/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class Un extends kt{#e;constructor(e){super(),this.#e=new Po(e),this._http=new jn(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use hook requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}static fromWebhookUrl(e){if(!e.trim())throw new Error("Webhook URL cannot be empty");let t;try{t=new URL(e)}catch{throw new Error(`Invalid webhook URL format: ${e}`)}if(t.protocol!=="https:")throw new Error("Webhook requires HTTPS protocol");const n=t.pathname.split("/").filter(Boolean);if(n.length<3||n[0]!=="rest")throw new Error("Webhook URL must follow format: /rest/<userId>/<secret>");const s=n[1],i=n[2];if(!/^\d+$/.test(s))throw new Error(`User ID must be numeric in webhook URL, received: ${s}`);const o=Number.parseInt(s,10);return new Un({b24Url:t.origin,userId:o,secret:i})}}var ee=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r.getInterface="getInterface",r.placementBindEvent="placementBindEvent",r))(ee||{});class Do{#e;#t;#r;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.#r=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,s)=>{let i;const o={resolve:n,reject:s,timeoutId:null},l=this.#n(o);let a=null;const u=Kn(t||{},["singleOption","callBack","isSafely","safelyTime"]),{callBack:c,singleOption:f}=t||{};if(c&&this.#r.set(l,c),f?a=f:Object.keys(u).length>0&&(a={...u}),e.toString().includes(":"))i={method:e.toString(),params:a||"",callback:l,appSid:this.#e.getAppSid()};else{i=e.toString(),t?.isRawValue!==!0&&a?a=JSON.stringify(a):t?.isRawValue===!0&&a&&C.isPlainObject(a)&&a.value&&(a=a.value);const h=[a||"",l,this.#e.getAppSid()];i+=":"+h.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:i}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely&&(this.#t.get(l).timeoutId=window.setTimeout(()=>{this.#t.has(l)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#t.delete(l),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#t.has(n.id)){const s=this.#t.get(n.id);s.timeoutId&&clearTimeout(s.timeoutId),this.#t.delete(n.id),s.resolve(n.args)}else if(this.#r.has(n.id)){const s=this.#r.get(n.id);s&&s.apply(globalThis,[n.args])}}}#n(e){const t=V.getUniqId();return this.#t.set(t,e),t}}class Mo{#e="";#t=!0;#r=null;#n=null;#s=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#s=e.LANG),e.APP_SID&&(this.#r=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#s||(this.#s=e.LANG),this.#t=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#r===null)throw new Error("Not init appSid");return this.#r}getTargetOrigin(){return`${this.#t?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#s||Bn.en}}class Fo{#e=null;#t=null;#r=0;#n=0;#s=null;#i=!1;#o;#a;constructor(e,t){this.#o=e,this.#a=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#n=Number.parseInt(e.AUTH_EXPIRES),this.#r=Date.now()+this.#n*1e3,this.#i=e.IS_ADMIN,this.#s=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires:this.#r/1e3,expires_in:this.#n,domain:this.#o.getTargetOrigin(),member_id:this.#s}:!1}async refreshAuth(){return this.#a.send(ee.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#s||""].join("_")}get isAdmin(){return this.#i}}class xo{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(ee.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(ee.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(ee.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const s=document.body;let i=Math.max(s.scrollWidth,s.offsetWidth);n>0&&(i=Math.max(n,i));let o=Math.max(s.scrollHeight,s.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(i,o)}getScrollSize(){return kh()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(ee.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(ee.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(ee.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(ee.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(ee.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(ee.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(ee.imOpenHistory,{dialogId:e,isSafely:!0})}}let jo=class{#e;#t=null;#r=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#t=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#r=e.USER_OPTIONS),this}appGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#t||(this.#t=[]),this.#t[e]=t,this.#n(ee.setAppOption,e,this.#t[e])}userGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#t||(this.#t=[]),this.#t[e]||(this.#t[e]=null),this.#r[e]=t,this.#n(ee.setUserOption,e,this.#r[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Bo{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(ee.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(ee.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(ee.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(ee.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Uo{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#t.send(ee.openApplication,e)}async closeSliderAppPage(){return this.#t.send(ee.closeApplication,{isSafely:!1})}#r(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(ee.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(s=>s?.result==="error"?s?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,o)=>{const l=window.open(e,"_blank");if(!l){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,c=window.setInterval(()=>{a=a+1,l.closed?(clearInterval(c),i({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(c),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(s?.errorCode)):s?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#t.send(ee.showAppForm,{params:e,isSafely:!0})}}class $o{#e;#t="";#r={};constructor(e){this.#e=e}initData(e){this.#t=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#r=Object.freeze(t),this}get title(){return this.#t}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#r}get isSliderMode(){return this.options?.IFRAME==="Y"}async getInterface(){return this.#e.send(ee.getInterface,{isSafely:!0})}async bindEvent(e,t){return this.#e.send(ee.placementBindEvent,{event:e,callBack:t,isSafely:!0})}async call(e,t={}){return this.#e.send(e,{...t,isSafely:!0,isRawValue:["setValue"].includes(e)})}async callCustomBind(e,t=null,n){let s={};return C.isString(t)?s.singleOption=t:C.isObjectLike(t)&&(s={...t}),this.#e.send(e,{...s,callBack:n,isSafely:!0})}}class Wo extends kt{#e=!1;#t=!1;#r;#n;#s;#i;#o;#a;#c;#l;constructor(e){super(),this.#r=new Mo(e),this.#n=new Do(this.#r),this.#n.subscribe(),this.#s=new Fo(this.#r,this.#n),this.#i=new xo(this.#n),this.#o=new jo(this.#n),this.#a=new Bo(this.#n),this.#c=new Uo(this.#r,this.#n),this.#l=new $o(this.#n),this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#t}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#i}get auth(){return this._ensureInitialized(),this.#s}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#l}get options(){return this._ensureInitialized(),this.#o}get dialog(){return this._ensureInitialized(),this.#a}async init(){return this.#n.send(ee.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#r.initData(e),this.#s.initData(e),this.#l.initData(e),this.#o.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new jn(this.#r.getTargetOriginWithPath(),this.#s,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(ee.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(ee.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#r.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#r.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#r.getAppSid()}getLang(){return this._ensureInitialized(),this.#r.getLang()}}class Th extends xe{}class Vo{#e;#t=null;#r=null;#n;#s;#i=0;#o=0;#a;#c;#l;#u;#h=null;constructor(e,t){this.#n=Object.assign({},e),this.#s=Object.freeze(Object.assign({},t)),this.#a=this.#n.domain.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#c=this.#n.clientEndpoint,this.#l=this.#c.replace("/rest/",""),this.#u=this.#n.serverEndpoint.replace("/rest/",""),this.#i=this.#n.expires*1e3,this.#o=this.#n.expiresIn,this.#e=ce.create({baseURL:this.#u,headers:{"Content-Type":"application/json"}})}getAuthData(){return this.#i>Date.now()?{access_token:this.#n.accessToken,refresh_token:this.#n.refreshToken,expires:this.#i/1e3,expires_in:this.#o,domain:this.#a,member_id:this.#n.memberId}:!1}async refreshAuth(){try{let e;if(this.#r)e=await this.#r();else{const n=await this.#e.get("/oauth/token/",{params:{grant_type:"refresh_token",client_id:this.#s.clientId,client_secret:this.#s.clientSecret,refresh_token:this.#n.refreshToken}});if(n.data.error)throw new Error(`Token update error: ${n.data.error}`);if(n.status!==200)throw new Error(`Token update error status code: ${n.status}`);e=n.data}if(!e)throw new Error("Unable to obtain authorization update data");this.#n.accessToken=e.access_token,this.#n.refreshToken=e.refresh_token,this.#n.expires=Number.parseInt(e.expires||"0"),this.#n.expiresIn=Number.parseInt(e.expires_in||"3600"),this.#n.clientEndpoint=e.client_endpoint,this.#n.serverEndpoint=e.server_endpoint,this.#n.scope=e.scope,this.#n.status=Object.values(et).find(n=>n===e.status)||et.Free,this.#i=this.#n.expires*1e3;const t=this.getAuthData();return this.#t&&await this.#t({authData:t,b24OAuthParams:this.#n}),t}catch(e){if(e instanceof Ln){let t={error:e?.code||0,errorDescription:e?.message||""};if(e.response&&e.response.data&&!C.isUndefined(e.response.data.error)){const n=e.response.data;t={error:n.error,errorDescription:n.error_description}}throw new Th({code:String(t.error),description:t.errorDescription,status:e.response?.status||0,requestInfo:{method:"/oauth/token/"}})}else if(e instanceof Error)throw e;throw new Error(`Strange error: ${e instanceof Error?e.message:e}`,{cause:e})}}setCallbackRefreshAuth(e){this.#t=e}removeCallbackRefreshAuth(){this.#t=null}setCustomRefreshAuth(e){this.#r=e}removeCustomRefreshAuth(){this.#r=null}getUniq(e){return[e,this.#n.memberId||""].join("_")}getTargetOrigin(){return`${this.#l}`}getTargetOriginWithPath(){return`${this.#c}`}get isAdmin(){if(this.#h===null)throw new Error("isAdmin not init. You need call B24OAuth::initIsAdmin().");return this.#h}async initIsAdmin(e){const t=await e.call("profile",{},0);if(!t.isSuccess)throw new Error(t.getErrorMessages().join(";"));t.getData().result?.ADMIN&&(this.#h=!0)}}class Oh extends kt{#e;constructor(e,t){super(),this.#e=new Vo(e,t),this._http=new jn(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use oauth requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}async initIsAdmin(){return this._ensureInitialized(),this.#e.initIsAdmin(this._http)}setCallbackRefreshAuth(e){this._ensureInitialized(),this.#e.setCallbackRefreshAuth(e)}removeCallbackRefreshAuth(){this._ensureInitialized(),this.#e.removeCallbackRefreshAuth()}setCustomRefreshAuth(e){this._ensureInitialized(),this.#e.setCustomRefreshAuth(e)}removeCustomRefreshAuth(){this._ensureInitialized(),this.#e.removeCustomRefreshAuth()}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}class $n extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class jt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class Ah extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class Ih extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return Bi[this.data.status]||"Unknown status"}}class Ch extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class Nh extends jt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,mn),this._b24.getHttpClient().setRestrictionManagerParams(mn))}}class Rh extends jt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,s=this.data.currencyList.get(n);if(!(typeof s>"u"))for(const[i,o]of Object.entries(t.LANG))switch(s.lang[i]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},s.lang[i].thousandsVariant){case"N":s.lang[i].thousandsSep="";break;case"D":s.lang[i].thousandsSep=".";break;case"C":s.lang[i].thousandsSep=",";break;case"S":s.lang[i].thousandsSep=" ";break;case"B":s.lang[i].thousandsSep=" ";break;default:C.isStringFilled(s.lang[i].thousandsSep)||(s.lang[i].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:V.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new $n(e);let s=n.fullName;if(!(typeof t>"u")){const i=n.lang[t];C.isUndefined(i)||(s=i.fullName)}return s}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new $n(e);let s=n.formatString;if(!(typeof t>"u")){const i=n.lang[t];C.isUndefined(i)||(s=i.formatString)}return s.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const s=this.data.currencyList.get(t);if(typeof s>"u")throw new $n(t);const i={formatString:s.formatString,decimals:s.decimals,decPoint:s.decPoint,thousandsSep:s.thousandsSep};C.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const o=s.lang[n];return C.isUndefined(o)||(i.formatString=o.formatString,i.decimals=o.decimals,i.decPoint=o.decPoint,i.thousandsSep=o.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",V.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}class Wn extends jt{_data;_type;static getSupportTypes(){return[tt.NotSet,tt.JsonArray,tt.JsonObject,tt.FloatVal,tt.IntegerVal,tt.BoolYN,tt.StringVal]}static prepareArrayList(e){return C.isArray(e)?e:C.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),C.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!C.isArray(n)&&!C.isObject(n)&&(n=t)}catch(s){this.getLogger().error(s),n=t}return Wn.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(s){this.getLogger().error(s),n=t}return C.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?V.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?V.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?V.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?V.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=V.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),C.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class qo{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?V.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class Lh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class Ph extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const jr="2.0";class Dh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,C.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((s,i)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||i(new Lh("websocket is not connected"));const l=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),i(new Ph("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:s,reject:i,timeout:l})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:s,params:i,id:o})=>{const l=this.createRequest(s,i,o);t.push(l),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(l.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(C.isArray(t))return this.executeIncomingRpcBatch(t);if(C.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(C.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:jr,error:Sn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const s=this.executeIncomingRpcCommand(n);s&&(s.jsonrpc=jr,s.id=n.id,t.push(s))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:jr,error:Sn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:jr,method:e,params:t,id:n}}}class Mh{_logger=null;_storage;_ttl=1440*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new qo,this._callbacks={onWebSocketBlockChanged:C.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Re.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Re.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Re.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Re.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Re.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${V.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class Fh{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},s=[];for(const i of e){const o=this._publicIds.get(i);o&&o.end>t?n[o.userId]=o:s.push(i)}return s.length===0?Promise.resolve(n):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:s}).then(o=>{const l=o.getData().result;this.setPublicIds(Object.values(l));for(const a of s){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}i(n)}).catch(o=>(this.getLogger().error(o),i({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vn={exports:{}};/*!
|
|
13
|
-
* protobuf.js v6.8.6 (c) 2016, daniel wirtz
|
|
14
|
-
* compiled mon, 26 feb 2018 11:35:34 utc
|
|
15
|
-
* licensed under the bsd-3-clause license
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
40
|
+
`))}}var Wh=Object.defineProperty,Hh=a((r,e)=>Wh(r,"name",{value:e,configurable:!0}),"i$d");class ur extends Le{static{a(this,"AjaxResult")}static{Hh(this,"AjaxResult")}_status;_query;_data;constructor(e){super(),this._data=e.answer?Object.freeze(e.answer):void 0,this._query=Object.freeze(structuredClone(e.query)),this._status=e.status,this.#r()}get isSuccess(){return this.#e()}#e(){return this._errors.size===0}getData(){if(!this.isSuccess)return;const e=this._data;return Object.freeze({result:e.result,next:"next"in e?e.next:void 0,total:"total"in e?e.total:void 0,time:e.time})}#r(){if(this._data&&typeof this._data=="object"&&"error"in this._data){const e=this._data;if(e.error&&typeof e.error=="object"&&"code"in e.error){const t=e.error.code;let s=e.error.message.trimEnd();e.error.validation&&(s.length>0&&(s.endsWith(".")||(s+="."),s+=" "),e.error.validation.forEach(n=>{s+=`${n?.message||JSON.stringify(n)}`})),this.addError(this.#s({code:t,description:s,status:this._status}),"base-error")}else if(e.error&&typeof e.error=="string"){const t=e.error!=="0"?e.error:"JSSDK_RESPONSE_ERROR",s=e?.error_description??"Some error in response";this.addError(this.#s({code:t,description:s,status:this._status}),"base-error")}}}#s(e){return new be({code:e.code,description:e.description,status:e.status,requestInfo:{method:this._query.method,params:this._query.params,requestId:this._query.requestId}})}hasMore(){return this.isMore()}isMore(){if(!this.isSuccess)return!1;const e=this._data,t="next"in e?e.next:void 0;return L.isNumber(t)}getTotal(){if(!this.isSuccess)return 0;const e=this._data,t="total"in e?e.total:void 0;return H.toInteger(t)}getStatus(){return this._status}getQuery(){return this._query}async fetchNext(e){const t=await this.getNext(e);return t===!1?null:t}async getNext(e){if(e.apiVersion===X.v3)throw new ne({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:"restApi:v3 not support method getNext",status:500});if(!this.isSuccess||!this.isMore())return!1;const t=this.#t();return e.call(t.method,t.params)}#t(){const e={...this._query},t=this._data,s="next"in t?t.next:void 0;return e.params.start=H.toInteger(H.toInteger(s)),e}setData(){throw new ReferenceError("AjaxResult does not allow data modification")}}var zh=Object.defineProperty,Jh=a((r,e)=>zh(r,"name",{value:e,configurable:!0}),"a$h");class Gs{static{a(this,"ParamsFactory")}static{Jh(this,"ParamsFactory")}static getDefault(){return{rateLimit:{burstLimit:50,drainRate:2,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:80},adaptiveConfig:{enabled:!0,thresholdPercent:80,coefficient:.01,maxDelay:7e3},maxRetries:3,retryDelay:1e3}}static getEnterprise(){return{...this.getDefault(),rateLimit:{burstLimit:250,drainRate:5,adaptiveEnabled:!0}}}static getBatchProcessing(){return{...this.getDefault(),rateLimit:{burstLimit:30,drainRate:1,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:50},adaptiveConfig:{enabled:!0,thresholdPercent:50,coefficient:.015,maxDelay:1e4},maxRetries:5}}static getRealtime(){return{...this.getDefault(),adaptiveConfig:{enabled:!1,thresholdPercent:100,coefficient:.001,maxDelay:48e4},maxRetries:1}}static fromTariffPlan(e){switch(e.toLowerCase()){case"enterprise":return this.getEnterprise();case"company":case"start":case"standard":case"basic":default:return this.getDefault()}}}var Gh=Object.defineProperty,Yh=a((r,e)=>Gh(r,"name",{value:e,configurable:!0}),"c$7");class $o{static{a(this,"RateLimiter")}static{Yh(this,"RateLimiter")}#e;#r;#s;#t;#i=[];#n;#o=5;#c=20;#h=.5;#d=5;#a=[];#u=[];_logger;constructor(e){this._logger=ee.createNullLogger(),this.#t=e,this.#n={...e},this.#e=e.burstLimit,this.#r=Date.now(),this.#s=1e3/e.drainRate}getTitle(){return"rateLimiter"}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){await this.#l(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;return this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1}finally{this.#f()}}async waitIfNeeded(e,t,s){await this.#l(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;if(this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1)return this.#e-=1,0;const c=1-this.#e;return Math.ceil(c*this.#s)}finally{this.#f()}}async handleExceeded(e){await this.#l(e);try{return this.#_(),this.#t.adaptiveEnabled&&this.#g()&&this.#m(e),this.#e=0,this.#s+1e3}finally{this.#f()}}async updateStats(e,t,s){if(!t.startsWith("batch::")){await this.#l(e);try{this.#w(),this.#t.adaptiveEnabled&&this.#k(e),this.#t.adaptiveEnabled&&this.#p()&&this.#b(e)}finally{this.#f()}}}async reset(){await this.#l("reset");try{this.#e=this.#t.burstLimit,this.#r=Date.now(),this.#a=[],this.#u=[],this.#t.drainRate=this.#n.drainRate,this.#t.burstLimit=this.#n.burstLimit,this.#s=1e3/this.#t.drainRate}finally{this.#f()}}getStats(){return{tokens:this.#e,burstLimit:this.#t.burstLimit,originalBurstLimit:this.#n.burstLimit,drainRate:this.#t.drainRate,originalDrainRate:this.#n.drainRate,refillIntervalMs:this.#s,lastRefill:this.#r,pendingRequests:this.#i.length,recentErrors:this.#a.length,recentSuccesses:this.#u.length}}async setConfig(e){await this.#l("setConfig");try{this.#t=e,this.#n={...e},this.#s=1e3/this.#t.drainRate,e.burstLimit>this.#e&&(this.#e=Math.min(e.burstLimit,this.#e)),this.#a=[],this.#u=[]}finally{this.#f()}}async#l(e){return new Promise(t=>{const s=this.#i.push(t);s>1&&this.#O(e,s),this.#i.length===1&&t()})}#f(){if(this.#i.shift(),this.#i.length>0){const e=this.#i[0];e()}}#g(){return this.#a.length>=this.#o}#p(){return this.#u.length>=this.#c&&this.#a.length<this.#o/2&&(this.#t.drainRate<this.#n.drainRate||this.#t.burstLimit<this.#n.burstLimit)}#m(e){const t=Math.max(this.#h,Number.parseFloat((this.#t.drainRate*.8).toFixed(2))),s=Math.max(this.#d,Number.parseFloat((this.#t.burstLimit*.8).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#v(e,t,s),this.#a=[],this.#u=[]}#b(e){if(this.#t.drainRate===this.#n.drainRate&&this.#t.burstLimit===this.#n.burstLimit)return;const t=Math.min(this.#n.drainRate,Number.parseFloat((this.#t.drainRate*1.1).toFixed(2))),s=Math.min(this.#n.burstLimit,Number.parseFloat((this.#t.burstLimit*1.1).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#E(e,t,s),this.#a=[],this.#u=[]}#_(){const e=Date.now();this.#a.push(e),this.#u=[],this.#y(e)}#y(e){const t=e-6e4;this.#a=this.#a.filter(s=>s>t)}#w(){const e=Date.now();this.#u.push(e),this.#S(),this.#y(e)}#S(){this.#u=this.#u.slice(-1*this.#c)}#v(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} is lowering limits due to frequent errors`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}})}#E(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} increases limits during stable operation`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}})}#O(e,t){this.getLogger().debug(`${this.getTitle()} request in queue`,{requestId:e,queueLength:t})}#k(e){const t=this.#u.length,s=this.#c,n=t>=s,i=this.#a.length,c=this.#o,o=i<c/2,u=this.#t.drainRate,d=this.#n.drainRate,l=u<d,g=this.#t.burstLimit,f=this.#n.burstLimit,p=g<f;this.getLogger().debug(`${this.getTitle()} state`,{requestId:e,success:{count:t,threshold:s,condition:n,formatted:`(${t} >= ${s}) ${n}`},fail:{count:i,threshold:c/2,condition:o,formatted:`(${i} < ${c/2}) ${o}`},drainRate:{current:u,original:d,condition:l,formatted:`(${u} < ${d}) ${l}`},burstLimit:{current:g,original:f,condition:p,formatted:`(${g} < ${f}) ${p}`}})}}var Zh=Object.defineProperty,Kh=a((r,e)=>Zh(r,"name",{value:e,configurable:!0}),"g$a");class Bo{static{a(this,"OperatingLimiter")}static{Kh(this,"OperatingLimiter")}#e;#r=new Map;#s={heavyRequestCount:0};_logger;getTitle(){return"operatingLimiter"}constructor(e){this._logger=ee.createNullLogger(),this.#e=e}setLogger(e){this._logger=e}getLogger(){return this._logger}get limitMs(){return this.#e.limitMs}getMethodStat(e){const t=this.#r.get(e);if(t)return t}async canProceed(e,t,s){return await this.getTimeToFree(e,t,s)===0}async waitIfNeeded(e,t,s){return this.getTimeToFree(e,t,s)}async getTimeToFree(e,t,s,n){if(this.#i(),t==="batch")return this.#t(e,s);const i=this.#r.get(t);if(!i)return 0;const c=Math.max(1e3,this.#e.limitMs-5e3);if(i.operating>=c){const o=Date.now();return i.operating_reset_at>o?i.operating_reset_at-o+1e3:5e3}return 0}async#t(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(i=>i.split("?")[0]).filter(Boolean);for(const i of n){const c=await this.getTimeToFree(e,`batch::${i}`,{});s=Math.max(s,c)}return s}async updateStats(e,t,s){this.#i();const{operating:n,operating_reset_at:i}=s;if(n==null)return;this.#r.has(t)||this.#r.set(t,{operating:0,operating_reset_at:0,lastUpdated:Date.now()});const c=this.#r.get(t);c.operating=n*1e3,c.operating_reset_at=i*1e3,c.lastUpdated=Date.now();const o=c.operating/this.#e.limitMs*100;o>this.#e.heavyPercent&&(this.#s.heavyRequestCount++,this.#n(e,t,o,c.operating))}#i(){const e=Date.now(),t=this.#e.windowMs+1e4;for(const[s,n]of this.#r.entries())e-n.lastUpdated>t&&this.#r.delete(s)}async reset(){this.#r.clear(),this.#s={heavyRequestCount:0}}getStats(){const e={};for(const[t,s]of this.#r.entries())e[t]=Number.parseFloat((s.operating/1e3).toFixed(2));return{...this.#s,operatingStats:e}}async setConfig(e){this.#e=e}#n(e,t,s,n){this.getLogger().debug(`${this.getTitle()} detected limit for method ${t}`,{requestId:e,method:t,operating:{percent:Number.parseFloat(s.toFixed(2)),current:Number.parseFloat((n/1e3).toFixed(0)),max:Number.parseFloat((this.#e.limitMs/1e3).toFixed(0))}})}}var Xh=Object.defineProperty,Qh=a((r,e)=>Xh(r,"name",{value:e,configurable:!0}),"l$6");class jo{static{a(this,"AdaptiveDelayer")}static{Qh(this,"AdaptiveDelayer")}#e;#r;#s={adaptiveDelays:0,totalAdaptiveDelay:0};_logger;getTitle(){return"adaptiveDelayer"}constructor(e,t){this._logger=ee.createNullLogger(),this.#e=e,this.#r=t}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){return!0}async waitIfNeeded(e,t,s){if(!this.#e.enabled)return 0;const n=this.#t(e,t,s);return n>0&&(this.incrementAdaptiveDelays(),this.#s.totalAdaptiveDelay+=n),n}#t(e,t,s){if(t==="batch")return this.#i(e,s);const n=this.#r.getMethodStat(t);if(typeof n>"u")return 0;const i=n.operating/this.#r.limitMs*100;if(i>this.#e.thresholdPercent){let c=0;const o=Date.now();n.operating_reset_at>o?c+=(n.operating_reset_at-o)*this.#e.coefficient:c+=7e3;const u=Number.parseInt(Math.min(c,this.#e.maxDelay).toFixed(0));return this.#n(e,t,i,c,u),u}return 0}#i(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(c=>c.split("?")[0]).filter(Boolean),i=[...new Set(n)];for(const c of i){const o=this.#t(e,`batch::${c}`,{});s=Math.max(s,o)}return s}async updateStats(e,t,s){}async reset(){this.#s={adaptiveDelays:0,totalAdaptiveDelay:0}}getStats(){return{...this.#s,adaptiveDelayAvg:this.#s.adaptiveDelays>0?this.#s.totalAdaptiveDelay/this.#s.adaptiveDelays:0}}async setConfig(e){this.#e=e}incrementAdaptiveDelays(){this.#s.adaptiveDelays++}#n(e,t,s,n,i){this.getLogger().debug(`${this.getTitle()} state for method ${t}`,{requestId:e,method:t,percent:Number.parseFloat(s.toFixed(2)),delays:{calculated:n,actual:i}})}}var ed=Object.defineProperty,td=a((r,e)=>ed(r,"name",{value:e,configurable:!0}),"E$2");class Uo{static{a(this,"RestrictionManager")}static{td(this,"RestrictionManager")}#e;#r;#s;#t;#i={retries:0,consecutiveErrors:0,limitHits:0};#n=new Map;_logger;constructor(e){this._logger=ee.createNullLogger(),this.#t=e,this.#e=new $o(e.rateLimit),this.#r=new Bo(e.operatingLimit),this.#s=new jo(e.adaptiveConfig,this.#r)}setLogger(e){this._logger=e,this.#e.setLogger(this._logger),this.#r.setLogger(this._logger),this.#s.setLogger(this._logger)}getLogger(){return this._logger}async applyOperatingLimits(e,t,s){const n=await this.#r.waitIfNeeded(e,t,s);if(n>0)this.incrementStats("limitHits"),this.#f(this.#r.getTitle(),e,t,n),await this.#l(n);else{const i=await this.#s.waitIfNeeded(e,t,s);i>0&&(this.incrementStats("limitHits"),this.#f(this.#s.getTitle(),e,t,i),await this.#l(i))}}async checkRateLimit(e,t){let s,n=1;do s=await this.#e.waitIfNeeded(e,t),s>0&&(this.incrementStats("limitHits"),this.#g(this.#e.getTitle(),e,t,s,n),await this.#l(s),n++);while(s>0)}async updateStats(e,t,s){await this.#r.updateStats(e,t,s),await this.#s.updateStats(e,t,s),await this.#e.updateStats(e,t,s)}async handleError(e,t,s,n,i){if(this.#o(n)){const c=await this.#c(e)*Math.pow(1.5,i);return this.#p(this.#e.getTitle(),e,"QUERY_LIMIT_EXCEEDED",n.message,t,c),c}if(this.#h(n)){const c=Math.max(1e4,await this.#d(e,t,s,n));return this.#p(this.#r.getTitle(),e,"OPERATION_TIME_LIMIT",n.message,t,c),c}if(!this.#a(n)){const c=await this.#u(e),o=Math.max(3e4,c),u=Math.min(o,c*Math.pow(2,i)),d=u*.1*(Math.random()*2-1),l=Math.max(100,u+d);return this.#m(e,n?.code?`${n.code}`:"?",n.message,t,l),l}return 0}#o(e){return e.status===503||e.code==="QUERY_LIMIT_EXCEEDED"}async#c(e){return this.#e.handleExceeded(e)}#h(e){return e.status===429||e.code==="OPERATION_TIME_LIMIT"}async#d(e,t,s,n){return this.#r.getTimeToFree(e,t,s,n)}#a(e){const t={code:e?.code??"-1",description:e?.message??""};return[...this.exceptionCodeForHard,...this.exceptionCodeForSoft].includes(t.code)||(t.description??"").includes("Could not find value for parameter")}get exceptionCodeForHard(){return["ERR_BAD_REQUEST","JSSDK_UNKNOWN_ERROR","100","INTERNAL_SERVER_ERROR","ERROR_UNEXPECTED_ANSWER","PORTAL_DELETED","ERROR_BATCH_METHOD_NOT_ALLOWED","ERROR_BATCH_LENGTH_EXCEEDED","NO_AUTH_FOUND","INVALID_REQUEST","OVERLOAD_LIMIT","expired_token","ACCESS_DENIED","INVALID_CREDENTIALS","user_access_error","insufficient_scope","ERROR_MANIFEST_IS_NOT_AVAILABLE","allowed_only_intranet_user","NOT_FOUND","INVALID_ARG_VALUE"]}get exceptionCodeForSoft(){return["ERROR_ENTITY_NOT_FOUND","BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDJSONEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDFILTEREXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION","BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_DTOVALIDATIONEXCEPTION"]}async#u(e){return this.#t.retryDelay}incrementError(e){const t=this.#n.get(e)||0;this.#n.set(e,t+1),this.incrementStats("consecutiveErrors")}resetErrors(e){this.#n.delete(e),this.#i.consecutiveErrors=0}incrementStats(e){this.#i[e]++}getStats(){return{...this.#i,...this.#e.getStats(),...this.#s.getStats(),...this.#r.getStats(),errorCounts:Object.fromEntries(this.#n)}}async reset(){await this.#e.reset(),await this.#r.reset(),await this.#s.reset(),this.#n.clear(),this.#i={retries:0,consecutiveErrors:0,limitHits:0}}async setConfig(e){this.#t=e,await this.#e.setConfig(e.rateLimit),await this.#r.setConfig(e.operatingLimit),await this.#s.setConfig(e.adaptiveConfig)}getParams(){return{...this.#t}}async#l(e){return new Promise(t=>setTimeout(t,e))}async waiteDelay(e){return this.#l(e)}#f(e,t,s,n){this.getLogger().notice(`${e} blocked method ${s}`,{requestId:t,method:s,wait:n,limiter:e})}#g(e,t,s,n,i){this.getLogger().notice(`${e} blocked method ${s} | ${i} times`,{requestId:t,method:s,times:i,wait:n,limiter:e})}#p(e,t,s,n,i,c){this.getLogger().error(`${e} recognized the ${s} error for the ${i} method`,{requestId:t,method:i,wait:c,limiter:e,error:{code:s,message:n}})}#m(e,t,s,n,i){this.getLogger().error(`recognized the ${t} error for the ${n} method`,{requestId:e,method:n,wait:i,error:{code:t,message:s}})}}var rd=Object.defineProperty,sd=a((r,e)=>rd(r,"name",{value:e,configurable:!0}),"r$e");class bt{static{a(this,"ParseRow")}static{sd(this,"ParseRow")}static getBatchCommand(e,t){if(e){if(typeof e=="object"&&"method"in e&&typeof e.method=="string")return{method:e.method,query:e.params,as:e.as??t.asDefaultValue,parallel:e.parallel??t.parallelDefaultValue};if(Array.isArray(e)&&e.length>0&&typeof e[0]=="string")return{method:e[0],query:e[1],as:t.asDefaultValue,parallel:t.parallelDefaultValue}}throw new ne({code:"JSSDK_INTERACTION_BATCH_ROW_FAIL",description:`There were difficulties parsing the command for batch.
|
|
41
|
+
${JSON.stringify({row:e,options:t})}`,status:500})}static getMethodsFromCommands(e){const t=[],s={parallelDefaultValue:!1};return Array.isArray(e)?e.forEach(n=>{const i=bt.getBatchCommand(n,s);t.push(i.method)}):Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...s,asDefaultValue:n});t.push(c.method)}),t}}var nd=Object.defineProperty,id=a((r,e)=>nd(r,"name",{value:e,configurable:!0}),"i$b");const nt=class kc{static{a(this,"a")}static{id(this,"VersionManager")}#e;constructor(){this.#e=["/batch","/scopes","/rest.scope.list","/rest.documentation.openapi","/documentation","/main.eventlog.list","/main.eventlog.get","/main.eventlog.tail","/tasks.task.chat.message.send","/tasks.task.access.get","/tasks.task.file.attach","/tasks.task.update","/tasks.task.delete","/tasks.task.add","/tasks.task.get"]}static create(){return new kc}getAllApiVersions(){return[X.v3,X.v2]}isSupport(e,t){switch(e){case X.v3:return this.#r(t);case X.v2:return!0}return!1}#r(e){return this.#e.includes(`/${e}`)}automaticallyObtainApiVersion(e){const t=this.getAllApiVersions().find(s=>nt.isSupport(s,e));if(!t)throw new ne({code:"JSSDK_VERSION_MANAGER_NOT_DETECT_FOR_METHOD",description:`No API version found that supports method ${e}.`,status:500});return t}automaticallyObtainApiVersionForBatch(e){const t=bt.getMethodsFromCommands(e);let s=!0;for(const[n,i]of t.entries())if(!this.isSupport(X.v3,i)){s=!1;break}return s?X.v3:X.v2}}.create();var od=Object.defineProperty,ad=a((r,e)=>od(r,"name",{value:e,configurable:!0}),"o$i");class It{static{a(this,"AbstractAction")}static{ad(this,"AbstractAction")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}}var cd=Object.defineProperty,ld=a((r,e)=>cd(r,"name",{value:e,configurable:!0}),"r$d");class ud extends It{static{a(this,"CallV2")}static{ld(this,"CallV2")}async make(e){nt.isSupport(X.v3,e.method)&&ee.forcedLog(this._logger,"warning",`The method ${e.method} is available in restApi:v3. It's worth migrating to the new API.`,{method:e.method,requestId:e.requestId,code:"JSSDK_CORE_METHOD_AVAILABLE_IN_API_V3"});const t=e.params||{};return this._b24.getHttpClient(X.v2).call(e.method,t,e.requestId)}}var hd=Object.defineProperty,dd=a((r,e)=>hd(r,"name",{value:e,configurable:!0}),"p$b");class fd extends It{static{a(this,"CallListV2")}static{dd(this,"CallListV2")}async make(e){const t=new Le,s=e?.idKey??"ID",n=e?.customKeyForResult??null,i=e?.params??{},c=`>${s}`,o={...i,order:{...i.order||{},[s]:"ASC"},filter:{...i.filter||{},[c]:0},start:-1};let u=[],d=!0;do{const l=await this._b24.actions.v2.call.make({method:e.method,params:o,requestId:e.requestId});if(!l.isSuccess){this._logger.error("callFastListMethod",{method:e.method,requestId:e.requestId,messages:l.getErrorMessages()});for(const[h,m]of l.errors)t.addError(m,h);d=!1;break}const g=l.getData();if(!g){d=!1;break}let f=[];if(n===null?f=g.result:f=g.result[n],f.length===0){d=!1;break}if(u=[...u,...f],f.length<50){d=!1;break}const p=f[f.length-1];if(p&&typeof p[s]<"u")o.filter[c]=Number.parseInt(p[s]);else{d=!1;break}}while(d);return t.setData(u)}}var pd=Object.defineProperty,gd=a((r,e)=>pd(r,"name",{value:e,configurable:!0}),"d$3");class md extends It{static{a(this,"FetchListV2")}static{gd(this,"FetchListV2")}async*make(e){const t=e?.idKey??"ID",s=e?.customKeyForResult??null,n=e?.params??{},i=`>${t}`,c={...n,order:{...n.order||{},[t]:"ASC"},filter:{...n.filter||{},[i]:0},start:-1};let o=!0;do{const u=await this._b24.actions.v2.call.make({method:e.method,params:c,requestId:e.requestId});if(!u.isSuccess)throw this._logger.error("fetchListMethod",{method:e.method,requestId:e.requestId,messages:u.getErrorMessages()}),new ne({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V2",description:`API Error: ${u.getErrorMessages().join("; ")}`,status:500});const d=u.getData();if(!d){o=!1;break}let l=[];if(s===null?l=d.result:l=d.result[s],l.length===0){o=!1;break}if(yield l,l.length<50){o=!1;break}const g=l[l.length-1];if(g&&typeof g[t]<"u")c.filter[i]=Number.parseInt(g[t]);else{o=!1;break}}while(o)}}var yd=Object.defineProperty,bd=a((r,e)=>yd(r,"name",{value:e,configurable:!0}),"u$5");class qr extends It{static{a(this,"AbstractBatch")}static{bd(this,"AbstractBatch")}_addBatchErrorsIfAny(e,t){if(!e.isSuccess)for(const[s,n]of e.errors)t.addError(n,s)}_processBatchResponse(e,t,s){const n=Array.isArray(t);return s.returnAjaxResult?this._createBatchResultWithAjax(e,n):this._createBatchResultSimple(e,n)}_createBatchResultWithAjax(e,t){return t?this._createBatchArrayResult(e):this._createBatchObjectResult(e)}_createBatchArrayResult(e){const t=new Le;this._addBatchErrorsIfAny(e,t);const s=[];for(const[n,i]of e.getData().result)s.push(i);return t.setData(s)}_createBatchObjectResult(e){const t=new Le;this._addBatchErrorsIfAny(e,t);const s={};for(const[n,i]of e.getData().result)s[n]=i;return t.setData(s)}_createBatchResultSimple(e,t){const s=new Le;return this._addBatchErrorsIfAny(e,s),s.setData(this._extractBatchSimpleData(e,t))}_extractBatchSimpleData(e,t){if(t){const s=[];for(const[n,i]of e.getData().result)i.isSuccess&&s.push(i.getData().result);return s}else{const s={};for(const[n,i]of e.getData().result)i.isSuccess&&(s[n]=i.getData().result);return s}}chunkArray(e,t=50){const s=[];for(let n=0;n<e.length;n+=t){const i=e.slice(n,n+t);s.push(i)}return s}}var _d=Object.defineProperty,wd=a((r,e)=>_d(r,"name",{value:e,configurable:!0}),"o$h");class Sd extends qr{static{a(this,"BatchV2")}static{wd(this,"BatchV2")}async make(e){const t={...e.options,apiVersion:X.v2},s=await this._b24.getHttpClient(X.v2).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var vd=Object.defineProperty,Ed=a((r,e)=>vd(r,"name",{value:e,configurable:!0}),"r$c");class Od extends qr{static{a(this,"BatchByChunkV2")}static{Ed(this,"BatchByChunkV2")}async make(e){const t={...e.options,returnAjaxResult:!1,apiVersion:X.v2},s=new Le,n=[],i=this.chunkArray(e.calls,50);for(const c of i){const o=await this._b24.getHttpClient(X.v2).batch(c,t);o.isSuccess||this._addBatchErrorsIfAny(o,s);for(const[u,d]of o.getData().result)d.isSuccess&&n.push(d.getData().result)}return s.setData(n)}}var kd=Object.defineProperty,Td=a((r,e)=>kd(r,"name",{value:e,configurable:!0}),"r$b");const Ys=Symbol("call_V2"),Zs=Symbol("callList_V2"),Ks=Symbol("fetchList_V2"),Xs=Symbol("batch_V2"),Qs=Symbol("batchByChunk_V2");class Id{static{a(this,"ActionsManagerV2")}static{Td(this,"ActionsManagerV2")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(Ys)||this._mapActions.set(Ys,new ud(this._b24,this._logger)),this._mapActions.get(Ys)}get callList(){return this._mapActions.has(Zs)||this._mapActions.set(Zs,new fd(this._b24,this._logger)),this._mapActions.get(Zs)}get fetchList(){return this._mapActions.has(Ks)||this._mapActions.set(Ks,new md(this._b24,this._logger)),this._mapActions.get(Ks)}get batch(){return this._mapActions.has(Xs)||this._mapActions.set(Xs,new Sd(this._b24,this._logger)),this._mapActions.get(Xs)}get batchByChunk(){return this._mapActions.has(Qs)||this._mapActions.set(Qs,new Od(this._b24,this._logger)),this._mapActions.get(Qs)}}var Ad=Object.defineProperty,Rd=a((r,e)=>Ad(r,"name",{value:e,configurable:!0}),"e$6");class Cd extends It{static{a(this,"CallV3")}static{Rd(this,"CallV3")}async make(e){if(!nt.isSupport(X.v3,e.method))throw new ne({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:`restApi:v3 not support method ${e.method}`,status:500});const t=e.params||{};return this._b24.getHttpClient(X.v3).call(e.method,t,e.requestId)}}var Nd=Object.defineProperty,Dd=a((r,e)=>Nd(r,"name",{value:e,configurable:!0}),"f$3");class Md extends It{static{a(this,"CallListV3")}static{Dd(this,"CallListV3")}async make(e){const t=e?.limit??50,s=new Le,n=e?.idKey??"id",i=e?.customKeyForResult??null,c=e?.params??{},o={...c,order:{...c.order||{},[n]:"ASC"},filter:[...c.filter||[]],pagination:{page:0,limit:t}};let u=[],d=!0,l=0;do{({...o}).filter.push([n,">",l]);const g=await this._b24.actions.v3.call.make({method:e.method,params:o,requestId:e.requestId});if(!g.isSuccess){this._logger.error("callFastListMethod",{method:e.method,requestId:e.requestId,messages:g.getErrorMessages()});for(const[m,y]of g.errors)s.addError(y,m);d=!1;break}const f=g.getData();if(!f){d=!1;break}const p=f.result[i];if(p.length===0){d=!1;break}if(u=[...u,...p],p.length<t){d=!1;break}const h=p[p.length-1];if(h&&typeof h[n]<"u")l=Number.parseInt(h[n]);else{d=!1;break}}while(d);return s.setData(u)}}var Ld=Object.defineProperty,Pd=a((r,e)=>Ld(r,"name",{value:e,configurable:!0}),"u$4");class Fd extends It{static{a(this,"FetchListV3")}static{Pd(this,"FetchListV3")}async*make(e){const t=e?.limit??50,s=e?.idKey??"id",n=e?.customKeyForResult??null,i=e?.params??{},c={...i,order:{...i.order||{},[s]:"ASC"},filter:[...i.filter||[]],pagination:{page:0,limit:t}};let o=!0,u=0;do{({...c}).filter.push([s,">",u]);const d=await this._b24.actions.v3.call.make({method:e.method,params:c,requestId:e.requestId});if(!d.isSuccess)throw this._logger.error("fetchListMethod",{method:e.method,requestId:e.requestId,messages:d.getErrorMessages()}),new ne({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3",description:`API Error: ${d.getErrorMessages().join("; ")}`,status:500});const l=d.getData();if(!l){o=!1;break}const g=l.result[n];if(g.length===0){o=!1;break}if(yield g,g.length<t){o=!1;break}const f=g[g.length-1];if(f&&typeof f[s]<"u")u=Number.parseInt(f[s]);else{o=!1;break}}while(o)}}var xd=Object.defineProperty,$d=a((r,e)=>xd(r,"name",{value:e,configurable:!0}),"o$f");class Bd extends qr{static{a(this,"BatchV3")}static{$d(this,"BatchV3")}async make(e){const t={...e.options,apiVersion:X.v3};if(nt.automaticallyObtainApiVersionForBatch(e.calls)!==t.apiVersion)throw new ne({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:`restApi:v3 not support some methods in calls: ${JSON.stringify(e.calls)}`,status:500});const s=await this._b24.getHttpClient(X.v3).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var jd=Object.defineProperty,Ud=a((r,e)=>jd(r,"name",{value:e,configurable:!0}),"r$a");class Vd extends qr{static{a(this,"BatchByChunkV3")}static{Ud(this,"BatchByChunkV3")}async make(e){const t={...e.options,returnAjaxResult:!1,apiVersion:X.v3},s=new Le,n=[],i=this.chunkArray(e.calls,50);for(const c of i){const o=await this._b24.getHttpClient(X.v3).batch(c,t);o.isSuccess||this._addBatchErrorsIfAny(o,s);for(const[u,d]of o.getData().result)d.isSuccess&&n.push(d.getData().result)}return s.setData(n)}}var qd=Object.defineProperty,Wd=a((r,e)=>qd(r,"name",{value:e,configurable:!0}),"r$9");const en=Symbol("call_V3"),tn=Symbol("callList_V3"),rn=Symbol("fetchList_V3"),sn=Symbol("batch_V3"),nn=Symbol("batchByChunk_V3");class Hd{static{a(this,"ActionsManagerV3")}static{Wd(this,"ActionsManagerV3")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(en)||this._mapActions.set(en,new Cd(this._b24,this._logger)),this._mapActions.get(en)}get callList(){return this._mapActions.has(tn)||this._mapActions.set(tn,new Md(this._b24,this._logger)),this._mapActions.get(tn)}get fetchList(){return this._mapActions.has(rn)||this._mapActions.set(rn,new Fd(this._b24,this._logger)),this._mapActions.get(rn)}get batch(){return this._mapActions.has(sn)||this._mapActions.set(sn,new Bd(this._b24,this._logger)),this._mapActions.get(sn)}get batchByChunk(){return this._mapActions.has(nn)||this._mapActions.set(nn,new Vd(this._b24,this._logger)),this._mapActions.get(nn)}}var zd=Object.defineProperty,Jd=a((r,e)=>zd(r,"name",{value:e,configurable:!0}),"s$k");const on=Symbol(X.v2),an=Symbol(X.v3);class Gd{static{a(this,"ActionsManager")}static{Jd(this,"ActionsManager")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e,this.v2.setLogger(this._logger),this.v3.setLogger(this._logger)}getLogger(){return this._logger}get v2(){return this._mapActions.has(on)||this._mapActions.set(on,new Id(this._b24)),this._mapActions.get(on)}get v3(){return this._mapActions.has(an)||this._mapActions.set(an,new Hd(this._b24)),this._mapActions.get(an)}}var Yd=Object.defineProperty,Zd=a((r,e)=>Yd(r,"name",{value:e,configurable:!0}),"o$c");class Vo{static{a(this,"AbstractTool")}static{Zd(this,"AbstractTool")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}}var Kd=Object.defineProperty,Xd=a((r,e)=>Kd(r,"name",{value:e,configurable:!0}),"r$8");class Qd extends Vo{static{a(this,"Ping")}static{Xd(this,"Ping")}async make(e){const t=Date.now();try{return await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId}),Date.now()-t}catch{return-1}}}var ef=Object.defineProperty,tf=a((r,e)=>ef(r,"name",{value:e,configurable:!0}),"s$i");class rf extends Vo{static{a(this,"HealthCheck")}static{tf(this,"HealthCheck")}async make(e){try{return(await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId})).isSuccess}catch{return!1}}}var sf=Object.defineProperty,nf=a((r,e)=>sf(r,"name",{value:e,configurable:!0}),"g$7");const cn=Symbol("ping"),ln=Symbol("healthCheck");class of{static{a(this,"ToolsManager")}static{nf(this,"ToolsManager")}_b24;_logger;_mapTools;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapTools=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get ping(){return this._mapTools.has(cn)||this._mapTools.set(cn,new Qd(this._b24,this._logger)),this._mapTools.get(cn)}get healthCheck(){return this._mapTools.has(ln)||this._mapTools.set(ln,new rf(this._b24,this._logger)),this._mapTools.get(ln)}}var af=Object.defineProperty,cf=a((r,e)=>af(r,"name",{value:e,configurable:!0}),"u$3");class Wr{static{a(this,"AbstractB24")}static{cf(this,"AbstractB24")}static batchSize=50;_isInit=!1;_httpV2=null;_httpV3=null;_logger;_actionsManager;_toolsManager;constructor(){this._isInit=!1,this._logger=ee.createNullLogger(),this._actionsManager=new Gd(this),this._toolsManager=new of(this)}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}get actions(){return this._ensureInitialized(),this._actionsManager}get tools(){return this._ensureInitialized(),this._toolsManager}async callMethod(e,t,s){return ee.forcedLog(this._logger,"warning","The AbstractB24.callMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.call.make(options) or b24.actions.v2.call.make(options)",{class:"AbstractB24",method:"callMethod",replacement:"b24.actions.v3.call.make(options) | b24.actions.v2.call.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"}),t={...t},!("start"in t&&Number.isInteger(t.start))&&Number.isInteger(s)&&(t.start=s),this._actionsManager.v2.call.make({method:e,params:t})}async callListMethod(e,t,s,n){ee.forcedLog(this._logger,"warning","The AbstractB24.callListMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.callList.make(options) or b24.actions.v2.callList.make(options)",{class:"AbstractB24",method:"callListMethod",replacement:"b24.actions.v3.callList.make(options) | b24.actions.v2.callList.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i=new Le;L.isFunction(s)&&s!==null&&s(0);const c={...t,start:0};return this.actions.v2.call.make({method:e,params:c}).then(async o=>{let u=[],d;if(n?d=o.getData().result[n]:d=o.getData().result,u=[...u,...d],o.isMore()){let l=o;for(;l=await l.getNext(this.getHttpClient(X.v2)),l!==!1;){let g;if(n?g=l.getData().result[n]:g=l.getData().result,u=[...u,...g],s){const f=l.getTotal();s(f>0?Math.round(100*u.length/f):100)}}}return i.setData(u),s&&s(100),i})}async*fetchListMethod(e,t,s,n){ee.forcedLog(this._logger,"warning","The AbstractB24.fetchListMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.fetchList.make(options) or b24.actions.v2.fetchList.make(options)",{class:"AbstractB24",method:"fetchListMethod",replacement:"b24.actions.v3.fetchList.make(options) | b24.actions.v2.fetchList.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i={method:e,params:t,idKey:s,customKeyForResult:n===null?void 0:n};yield*this.actions.v2.fetchList.make(i)}async callBatch(e,t,s){ee.forcedLog(this._logger,"warning","The AbstractB24.callBatch() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.batch.make(options) or b24.actions.v2.batch.make(options)",{class:"AbstractB24",method:"callBatch",replacement:"b24.actions.v3.batch.make(options) | b24.actions.v2.batch.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const n=e,i={isHaltOnError:t??!0,returnAjaxResult:s??!1};return this.actions.v2.batch.make({calls:n,options:i})}async callBatchByChunk(e,t){ee.forcedLog(this._logger,"warning","The AbstractB24.callBatchByChunk() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.batchByChunk.make(options) or b24.actions.v2.batchByChunk.make(options)",{class:"AbstractB24",method:"callBatchByChunk",replacement:"b24.actions.v3.batchByChunk.make(options) | b24.actions.v2.batchByChunk.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const s=e,n={isHaltOnError:t,returnAjaxResult:!1};return this.actions.v2.batchByChunk.make({calls:s,options:n})}getHttpClient(e){switch(this._ensureInitialized(),e){case X.v3:if(this._httpV3===null)throw new ne({code:"JSSDK_CORE_B24_HTTP_V3_NOT_INIT",description:"HttpV3 not init",status:500});return this._httpV3;case X.v2:if(this._httpV2===null)throw new ne({code:"JSSDK_CORE_B24_HTTP_V2_NOT_INIT",description:"HttpV2 not init",status:500});return this._httpV2}throw new ne({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setHttpClient(e,t){switch(e){case X.v3:this._httpV3=t;return;case X.v2:this._httpV2=t;return}throw new ne({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setLogger(e){this._logger=e,this._actionsManager.setLogger(this._logger),this._toolsManager.setLogger(this._logger),nt.getAllApiVersions().forEach(t=>{this.getHttpClient(t).setLogger(this._logger)})}getLogger(){return this._logger}async setRestrictionManagerParams(e){const t=nt.getAllApiVersions().map(s=>this.getHttpClient(s).setRestrictionManagerParams(e));await Promise.allSettled(t)}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new ne({code:"JSSDK_CORE_B24_NOT_INIT",description:"B24 not initialized",status:500})}}function qo(r,e){return a(function(){return r.apply(e,arguments)},"wrap")}a(qo,"bind");const{toString:lf}=Object.prototype,{getPrototypeOf:un}=Object,{iterator:Hr,toStringTag:Wo}=Symbol,zr=(r=>e=>{const t=lf.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),et=a(r=>(r=r.toLowerCase(),e=>zr(e)===r),"kindOfTest"),Jr=a(r=>e=>typeof e===r,"typeOfTest"),{isArray:zt}=Array,Jt=Jr("undefined");function hr(r){return r!==null&&!Jt(r)&&r.constructor!==null&&!Jt(r.constructor)&&Fe(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}a(hr,"isBuffer$1");const Ho=et("ArrayBuffer");function uf(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Ho(r.buffer),e}a(uf,"isArrayBufferView");const hf=Jr("string"),Fe=Jr("function"),zo=Jr("number"),dr=a(r=>r!==null&&typeof r=="object","isObject"),df=a(r=>r===!0||r===!1,"isBoolean"),Gr=a(r=>{if(zr(r)!=="object")return!1;const e=un(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Wo in r)&&!(Hr in r)},"isPlainObject"),ff=a(r=>{if(!dr(r)||hr(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},"isEmptyObject"),pf=et("Date"),gf=et("File"),mf=et("Blob"),yf=et("FileList"),bf=a(r=>dr(r)&&Fe(r.pipe),"isStream"),_f=a(r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Fe(r.append)&&((e=zr(r))==="formdata"||e==="object"&&Fe(r.toString)&&r.toString()==="[object FormData]"))},"isFormData"),wf=et("URLSearchParams"),[Sf,vf,Ef,Of]=["ReadableStream","Request","Response","Headers"].map(et),kf=a(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function fr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let s,n;if(typeof r!="object"&&(r=[r]),zt(r))for(s=0,n=r.length;s<n;s++)e.call(null,r[s],s,r);else{if(hr(r))return;const i=t?Object.getOwnPropertyNames(r):Object.keys(r),c=i.length;let o;for(s=0;s<c;s++)o=i[s],e.call(null,r[o],o,r)}}a(fr,"forEach");function Jo(r,e){if(hr(r))return null;e=e.toLowerCase();const t=Object.keys(r);let s=t.length,n;for(;s-- >0;)if(n=t[s],e===n.toLowerCase())return n;return null}a(Jo,"findKey");const At=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Go=a(r=>!Jt(r)&&r!==At,"isContextDefined");function hn(){const{caseless:r,skipUndefined:e}=Go(this)&&this||{},t={},s=a((n,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=r&&Jo(t,i)||i;Gr(t[c])&&Gr(n)?t[c]=hn(t[c],n):Gr(n)?t[c]=hn({},n):zt(n)?t[c]=n.slice():(!e||!Jt(n))&&(t[c]=n)},"assignValue");for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&fr(arguments[n],s);return t}a(hn,"merge");const Tf=a((r,e,t,{allOwnKeys:s}={})=>(fr(e,(n,i)=>{t&&Fe(n)?Object.defineProperty(r,i,{value:qo(n,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,i,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),r),"extend"),If=a(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),Af=a((r,e,t,s)=>{r.prototype=Object.create(e.prototype,s),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),Rf=a((r,e,t,s)=>{let n,i,c;const o={};if(e=e||{},r==null)return e;do{for(n=Object.getOwnPropertyNames(r),i=n.length;i-- >0;)c=n[i],(!s||s(c,r,e))&&!o[c]&&(e[c]=r[c],o[c]=!0);r=t!==!1&&un(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),Cf=a((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const s=r.indexOf(e,t);return s!==-1&&s===t},"endsWith"),Nf=a(r=>{if(!r)return null;if(zt(r))return r;let e=r.length;if(!zo(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),Df=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&un(Uint8Array)),Mf=a((r,e)=>{const s=(r&&r[Hr]).call(r);let n;for(;(n=s.next())&&!n.done;){const i=n.value;e.call(r,i[0],i[1])}},"forEachEntry"),Lf=a((r,e)=>{let t;const s=[];for(;(t=r.exec(e))!==null;)s.push(t);return s},"matchAll"),Pf=et("HTMLFormElement"),Ff=a(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,a(function(t,s,n){return s.toUpperCase()+n},"replacer")),"toCamelCase"),Yo=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),xf=et("RegExp"),Zo=a((r,e)=>{const t=Object.getOwnPropertyDescriptors(r),s={};fr(t,(n,i)=>{let c;(c=e(n,i,r))!==!1&&(s[i]=c||n)}),Object.defineProperties(r,s)},"reduceDescriptors"),$f=a(r=>{Zo(r,(e,t)=>{if(Fe(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=r[t];if(Fe(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),Bf=a((r,e)=>{const t={},s=a(n=>{n.forEach(i=>{t[i]=!0})},"define");return zt(r)?s(r):s(String(r).split(e)),t},"toObjectSet"),jf=a(()=>{},"noop"),Uf=a((r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,"toFiniteNumber");function Vf(r){return!!(r&&Fe(r.append)&&r[Wo]==="FormData"&&r[Hr])}a(Vf,"isSpecCompliantForm");const qf=a(r=>{const e=new Array(10),t=a((s,n)=>{if(dr(s)){if(e.indexOf(s)>=0)return;if(hr(s))return s;if(!("toJSON"in s)){e[n]=s;const i=zt(s)?[]:{};return fr(s,(c,o)=>{const u=t(c,n+1);!Jt(u)&&(i[o]=u)}),e[n]=void 0,i}}return s},"visit");return t(r,0)},"toJSONObject"),Wf=et("AsyncFunction"),Hf=a(r=>r&&(dr(r)||Fe(r))&&Fe(r.then)&&Fe(r.catch),"isThenable"),Ko=((r,e)=>r?setImmediate:e?((t,s)=>(At.addEventListener("message",({source:n,data:i})=>{n===At&&i===t&&s.length&&s.shift()()},!1),n=>{s.push(n),At.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Fe(At.postMessage)),zf=typeof queueMicrotask<"u"?queueMicrotask.bind(At):typeof process<"u"&&process.nextTick||Ko,O={isArray:zt,isArrayBuffer:Ho,isBuffer:hr,isFormData:_f,isArrayBufferView:uf,isString:hf,isNumber:zo,isBoolean:df,isObject:dr,isPlainObject:Gr,isEmptyObject:ff,isReadableStream:Sf,isRequest:vf,isResponse:Ef,isHeaders:Of,isUndefined:Jt,isDate:pf,isFile:gf,isBlob:mf,isRegExp:xf,isFunction:Fe,isStream:bf,isURLSearchParams:wf,isTypedArray:Df,isFileList:yf,forEach:fr,merge:hn,extend:Tf,trim:kf,stripBOM:If,inherits:Af,toFlatObject:Rf,kindOf:zr,kindOfTest:et,endsWith:Cf,toArray:Nf,forEachEntry:Mf,matchAll:Lf,isHTMLForm:Pf,hasOwnProperty:Yo,hasOwnProp:Yo,reduceDescriptors:Zo,freezeMethods:$f,toObjectSet:Bf,toCamelCase:Ff,noop:jf,toFiniteNumber:Uf,findKey:Jo,global:At,isContextDefined:Go,isSpecCompliantForm:Vf,toJSONObject:qf,isAsyncFn:Wf,isThenable:Hf,setImmediate:Ko,asap:zf,isIterable:a(r=>r!=null&&Fe(r[Hr]),"isIterable")};let z=class Tc extends Error{static{a(this,"AxiosError")}static from(e,t,s,n,i,c){const o=new Tc(e.message,t||e.code,s,n,i);return o.cause=e,o.name=e.name,c&&Object.assign(o,c),o}constructor(e,t,s,n,i){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),s&&(this.config=s),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:O.toJSONObject(this.config),code:this.code,status:this.status}}};z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",z.ERR_BAD_OPTION="ERR_BAD_OPTION",z.ECONNABORTED="ECONNABORTED",z.ETIMEDOUT="ETIMEDOUT",z.ERR_NETWORK="ERR_NETWORK",z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",z.ERR_DEPRECATED="ERR_DEPRECATED",z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",z.ERR_BAD_REQUEST="ERR_BAD_REQUEST",z.ERR_CANCELED="ERR_CANCELED",z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",z.ERR_INVALID_URL="ERR_INVALID_URL";const Jf=null;function dn(r){return O.isPlainObject(r)||O.isArray(r)}a(dn,"isVisitable");function Xo(r){return O.endsWith(r,"[]")?r.slice(0,-2):r}a(Xo,"removeBrackets");function Qo(r,e,t){return r?r.concat(e).map(a(function(n,i){return n=Xo(n),!t&&i?"["+n+"]":n},"each")).join(t?".":""):e}a(Qo,"renderKey");function Gf(r){return O.isArray(r)&&!r.some(dn)}a(Gf,"isFlatArray");const Yf=O.toFlatObject(O,{},null,a(function(e){return/^is[A-Z]/.test(e)},"filter"));function Yr(r,e,t){if(!O.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=O.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,a(function(m,y){return!O.isUndefined(y[m])},"defined"));const s=t.metaTokens,n=t.visitor||l,i=t.dots,c=t.indexes,u=(t.Blob||typeof Blob<"u"&&Blob)&&O.isSpecCompliantForm(e);if(!O.isFunction(n))throw new TypeError("visitor must be a function");function d(h){if(h===null)return"";if(O.isDate(h))return h.toISOString();if(O.isBoolean(h))return h.toString();if(!u&&O.isBlob(h))throw new z("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(h)||O.isTypedArray(h)?u&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}a(d,"convertValue");function l(h,m,y){let b=h;if(h&&!y&&typeof h=="object"){if(O.endsWith(m,"{}"))m=s?m:m.slice(0,-2),h=JSON.stringify(h);else if(O.isArray(h)&&Gf(h)||(O.isFileList(h)||O.endsWith(m,"[]"))&&(b=O.toArray(h)))return m=Xo(m),b.forEach(a(function(_,S){!(O.isUndefined(_)||_===null)&&e.append(c===!0?Qo([m],S,i):c===null?m:m+"[]",d(_))},"each")),!1}return dn(h)?!0:(e.append(Qo(y,m,i),d(h)),!1)}a(l,"defaultVisitor");const g=[],f=Object.assign(Yf,{defaultVisitor:l,convertValue:d,isVisitable:dn});function p(h,m){if(!O.isUndefined(h)){if(g.indexOf(h)!==-1)throw Error("Circular reference detected in "+m.join("."));g.push(h),O.forEach(h,a(function(b,w){(!(O.isUndefined(b)||b===null)&&n.call(e,b,O.isString(w)?w.trim():w,m,f))===!0&&p(b,m?m.concat(w):[w])},"each")),g.pop()}}if(a(p,"build"),!O.isObject(r))throw new TypeError("data must be an object");return p(r),e}a(Yr,"toFormData$1");function ea(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,a(function(s){return e[s]},"replacer"))}a(ea,"encode$2");function fn(r,e){this._pairs=[],r&&Yr(r,this,e)}a(fn,"AxiosURLSearchParams");const ta=fn.prototype;ta.append=a(function(e,t){this._pairs.push([e,t])},"append"),ta.toString=a(function(e){const t=e?function(s){return e.call(this,s,ea)}:ea;return this._pairs.map(a(function(n){return t(n[0])+"="+t(n[1])},"each"),"").join("&")},"toString");function Zf(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}a(Zf,"encode$1");function ra(r,e,t){if(!e)return r;const s=t&&t.encode||Zf,n=O.isFunction(t)?{serialize:t}:t,i=n&&n.serialize;let c;if(i?c=i(e,n):c=O.isURLSearchParams(e)?e.toString():new fn(e,n).toString(s),c){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+c}return r}a(ra,"buildURL");class sa{static{a(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){O.forEach(this.handlers,a(function(s){s!==null&&e(s)},"forEachHandler"))}}const pn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Kf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:fn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},gn=typeof window<"u"&&typeof document<"u",mn=typeof navigator=="object"&&navigator||void 0,Xf=gn&&(!mn||["ReactNative","NativeScript","NS"].indexOf(mn.product)<0),Qf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ep=gn&&window.location.href||"http://localhost",Ce={...{__proto__:null,hasBrowserEnv:gn,hasStandardBrowserEnv:Xf,hasStandardBrowserWebWorkerEnv:Qf,navigator:mn,origin:ep},...Kf};function tp(r,e){return Yr(r,new Ce.classes.URLSearchParams,{visitor:a(function(t,s,n,i){return Ce.isNode&&O.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},"visitor"),...e})}a(tp,"toURLEncodedForm");function rp(r){return O.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}a(rp,"parsePropPath");function sp(r){const e={},t=Object.keys(r);let s;const n=t.length;let i;for(s=0;s<n;s++)i=t[s],e[i]=r[i];return e}a(sp,"arrayToObject");function na(r){function e(t,s,n,i){let c=t[i++];if(c==="__proto__")return!0;const o=Number.isFinite(+c),u=i>=t.length;return c=!c&&O.isArray(n)?n.length:c,u?(O.hasOwnProp(n,c)?n[c]=[n[c],s]:n[c]=s,!o):((!n[c]||!O.isObject(n[c]))&&(n[c]=[]),e(t,s,n[c],i)&&O.isArray(n[c])&&(n[c]=sp(n[c])),!o)}if(a(e,"buildPath"),O.isFormData(r)&&O.isFunction(r.entries)){const t={};return O.forEachEntry(r,(s,n)=>{e(rp(s),n,t,0)}),t}return null}a(na,"formDataToJSON");function np(r,e,t){if(O.isString(r))try{return(e||JSON.parse)(r),O.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}a(np,"stringifySafely");const pr={transitional:pn,adapter:["xhr","http","fetch"],transformRequest:[a(function(e,t){const s=t.getContentType()||"",n=s.indexOf("application/json")>-1,i=O.isObject(e);if(i&&O.isHTMLForm(e)&&(e=new FormData(e)),O.isFormData(e))return n?JSON.stringify(na(e)):e;if(O.isArrayBuffer(e)||O.isBuffer(e)||O.isStream(e)||O.isFile(e)||O.isBlob(e)||O.isReadableStream(e))return e;if(O.isArrayBufferView(e))return e.buffer;if(O.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return tp(e,this.formSerializer).toString();if((o=O.isFileList(e))||s.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Yr(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),np(e)):e},"transformRequest")],transformResponse:[a(function(e){const t=this.transitional||pr.transitional,s=t&&t.forcedJSONParsing,n=this.responseType==="json";if(O.isResponse(e)||O.isReadableStream(e))return e;if(e&&O.isString(e)&&(s&&!this.responseType||n)){const c=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(o){if(c)throw o.name==="SyntaxError"?z.from(o,z.ERR_BAD_RESPONSE,this,null,this.response):o}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ce.classes.FormData,Blob:Ce.classes.Blob},validateStatus:a(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch"],r=>{pr.headers[r]={}});const ip=O.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),op=a(r=>{const e={};let t,s,n;return r&&r.split(`
|
|
42
|
+
`).forEach(a(function(c){n=c.indexOf(":"),t=c.substring(0,n).trim().toLowerCase(),s=c.substring(n+1).trim(),!(!t||e[t]&&ip[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)},"parser")),e},"parseHeaders"),ia=Symbol("internals");function gr(r){return r&&String(r).trim().toLowerCase()}a(gr,"normalizeHeader");function Zr(r){return r===!1||r==null?r:O.isArray(r)?r.map(Zr):String(r)}a(Zr,"normalizeValue");function ap(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(r);)e[s[1]]=s[2];return e}a(ap,"parseTokens");const cp=a(r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim()),"isValidHeaderName");function yn(r,e,t,s,n){if(O.isFunction(s))return s.call(this,e,t);if(n&&(e=t),!!O.isString(e)){if(O.isString(s))return e.indexOf(s)!==-1;if(O.isRegExp(s))return s.test(e)}}a(yn,"matchHeaderValue");function lp(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}a(lp,"formatHeader");function up(r,e){const t=O.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(r,s+t,{value:a(function(n,i,c){return this[s].call(this,e,n,i,c)},"value"),configurable:!0})})}a(up,"buildAccessors");let xe=class{static{a(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,s){const n=this;function i(o,u,d){const l=gr(u);if(!l)throw new Error("header name must be a non-empty string");const g=O.findKey(n,l);(!g||n[g]===void 0||d===!0||d===void 0&&n[g]!==!1)&&(n[g||u]=Zr(o))}a(i,"setHeader");const c=a((o,u)=>O.forEach(o,(d,l)=>i(d,l,u)),"setHeaders");if(O.isPlainObject(e)||e instanceof this.constructor)c(e,t);else if(O.isString(e)&&(e=e.trim())&&!cp(e))c(op(e),t);else if(O.isObject(e)&&O.isIterable(e)){let o={},u,d;for(const l of e){if(!O.isArray(l))throw TypeError("Object iterator must return a key-value pair");o[d=l[0]]=(u=o[d])?O.isArray(u)?[...u,l[1]]:[u,l[1]]:l[1]}c(o,t)}else e!=null&&i(t,e,s);return this}get(e,t){if(e=gr(e),e){const s=O.findKey(this,e);if(s){const n=this[s];if(!t)return n;if(t===!0)return ap(n);if(O.isFunction(t))return t.call(this,n,s);if(O.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=gr(e),e){const s=O.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||yn(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let n=!1;function i(c){if(c=gr(c),c){const o=O.findKey(s,c);o&&(!t||yn(s,s[o],o,t))&&(delete s[o],n=!0)}}return a(i,"deleteHeader"),O.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let s=t.length,n=!1;for(;s--;){const i=t[s];(!e||yn(this,this[i],i,e,!0))&&(delete this[i],n=!0)}return n}normalize(e){const t=this,s={};return O.forEach(this,(n,i)=>{const c=O.findKey(s,i);if(c){t[c]=Zr(n),delete t[i];return}const o=e?lp(i):String(i).trim();o!==i&&delete t[i],t[o]=Zr(n),s[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return O.forEach(this,(s,n)=>{s!=null&&s!==!1&&(t[n]=e&&O.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
43
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(n=>s.set(n)),s}static accessor(e){const s=(this[ia]=this[ia]={accessors:{}}).accessors,n=this.prototype;function i(c){const o=gr(c);s[o]||(up(n,c),s[o]=!0)}return a(i,"defineAccessor"),O.isArray(e)?e.forEach(i):i(e),this}};xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),O.reduceDescriptors(xe.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:a(()=>r,"get"),set(s){this[t]=s}}}),O.freezeMethods(xe);function bn(r,e){const t=this||pr,s=e||t,n=xe.from(s.headers);let i=s.data;return O.forEach(r,a(function(o){i=o.call(t,i,n.normalize(),e?e.status:void 0)},"transform")),n.normalize(),i}a(bn,"transformData");function oa(r){return!!(r&&r.__CANCEL__)}a(oa,"isCancel$1");let mr=class extends z{static{a(this,"CanceledError")}constructor(e,t,s){super(e??"canceled",z.ERR_CANCELED,t,s),this.name="CanceledError",this.__CANCEL__=!0}};function aa(r,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?r(t):e(new z("Request failed with status code "+t.status,[z.ERR_BAD_REQUEST,z.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}a(aa,"settle");function hp(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}a(hp,"parseProtocol");function dp(r,e){r=r||10;const t=new Array(r),s=new Array(r);let n=0,i=0,c;return e=e!==void 0?e:1e3,a(function(u){const d=Date.now(),l=s[i];c||(c=d),t[n]=u,s[n]=d;let g=i,f=0;for(;g!==n;)f+=t[g++],g=g%r;if(n=(n+1)%r,n===i&&(i=(i+1)%r),d-c<e)return;const p=l&&d-l;return p?Math.round(f*1e3/p):void 0},"push")}a(dp,"speedometer");function fp(r,e){let t=0,s=1e3/e,n,i;const c=a((d,l=Date.now())=>{t=l,n=null,i&&(clearTimeout(i),i=null),r(...d)},"invoke");return[a((...d)=>{const l=Date.now(),g=l-t;g>=s?c(d,l):(n=d,i||(i=setTimeout(()=>{i=null,c(n)},s-g)))},"throttled"),a(()=>n&&c(n),"flush")]}a(fp,"throttle");const Kr=a((r,e,t=3)=>{let s=0;const n=dp(50,250);return fp(i=>{const c=i.loaded,o=i.lengthComputable?i.total:void 0,u=c-s,d=n(u),l=c<=o;s=c;const g={loaded:c,total:o,progress:o?c/o:void 0,bytes:u,rate:d||void 0,estimated:d&&o&&l?(o-c)/d:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(g)},t)},"progressEventReducer"),ca=a((r,e)=>{const t=r!=null;return[s=>e[0]({lengthComputable:t,total:r,loaded:s}),e[1]]},"progressEventDecorator"),la=a(r=>(...e)=>O.asap(()=>r(...e)),"asyncDecorator"),pp=Ce.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Ce.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Ce.origin),Ce.navigator&&/(msie|trident)/i.test(Ce.navigator.userAgent)):()=>!0,gp=Ce.hasStandardBrowserEnv?{write(r,e,t,s,n,i,c){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];O.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),O.isString(s)&&o.push(`path=${s}`),O.isString(n)&&o.push(`domain=${n}`),i===!0&&o.push("secure"),O.isString(c)&&o.push(`SameSite=${c}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function mp(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}a(mp,"isAbsoluteURL");function yp(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}a(yp,"combineURLs");function ua(r,e,t){let s=!mp(e);return r&&(s||t==!1)?yp(r,e):e}a(ua,"buildFullPath");const ha=a(r=>r instanceof xe?{...r}:r,"headersToObject");function Rt(r,e){e=e||{};const t={};function s(d,l,g,f){return O.isPlainObject(d)&&O.isPlainObject(l)?O.merge.call({caseless:f},d,l):O.isPlainObject(l)?O.merge({},l):O.isArray(l)?l.slice():l}a(s,"getMergedValue");function n(d,l,g,f){if(O.isUndefined(l)){if(!O.isUndefined(d))return s(void 0,d,g,f)}else return s(d,l,g,f)}a(n,"mergeDeepProperties");function i(d,l){if(!O.isUndefined(l))return s(void 0,l)}a(i,"valueFromConfig2");function c(d,l){if(O.isUndefined(l)){if(!O.isUndefined(d))return s(void 0,d)}else return s(void 0,l)}a(c,"defaultToConfig2");function o(d,l,g){if(g in e)return s(d,l);if(g in r)return s(void 0,d)}a(o,"mergeDirectKeys");const u={url:i,method:i,data:i,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:o,headers:a((d,l,g)=>n(ha(d),ha(l),g,!0),"headers")};return O.forEach(Object.keys({...r,...e}),a(function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const g=O.hasOwnProp(u,l)?u[l]:n,f=g(r[l],e[l],l);O.isUndefined(f)&&g!==o||(t[l]=f)},"computeConfigValue")),t}a(Rt,"mergeConfig$1");const da=a(r=>{const e=Rt({},r);let{data:t,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:i,headers:c,auth:o}=e;if(e.headers=c=xe.from(c),e.url=ra(ua(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),o&&c.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),O.isFormData(t)){if(Ce.hasStandardBrowserEnv||Ce.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(O.isFunction(t.getHeaders)){const u=t.getHeaders(),d=["content-type","content-length"];Object.entries(u).forEach(([l,g])=>{d.includes(l.toLowerCase())&&c.set(l,g)})}}if(Ce.hasStandardBrowserEnv&&(s&&O.isFunction(s)&&(s=s(e)),s||s!==!1&&pp(e.url))){const u=n&&i&&gp.read(i);u&&c.set(n,u)}return e},"resolveConfig"),bp=typeof XMLHttpRequest<"u"&&function(r){return new Promise(a(function(t,s){const n=da(r);let i=n.data;const c=xe.from(n.headers).normalize();let{responseType:o,onUploadProgress:u,onDownloadProgress:d}=n,l,g,f,p,h;function m(){p&&p(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}a(m,"done");let y=new XMLHttpRequest;y.open(n.method.toUpperCase(),n.url,!0),y.timeout=n.timeout;function b(){if(!y)return;const _=xe.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),k={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:_,config:r,request:y};aa(a(function(I){t(I),m()},"_resolve"),a(function(I){s(I),m()},"_reject"),k),y=null}a(b,"onloadend"),"onloadend"in y?y.onloadend=b:y.onreadystatechange=a(function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},"handleLoad"),y.onabort=a(function(){y&&(s(new z("Request aborted",z.ECONNABORTED,r,y)),y=null)},"handleAbort"),y.onerror=a(function(S){const k=S&&S.message?S.message:"Network Error",v=new z(k,z.ERR_NETWORK,r,y);v.event=S||null,s(v),y=null},"handleError"),y.ontimeout=a(function(){let S=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const k=n.transitional||pn;n.timeoutErrorMessage&&(S=n.timeoutErrorMessage),s(new z(S,k.clarifyTimeoutError?z.ETIMEDOUT:z.ECONNABORTED,r,y)),y=null},"handleTimeout"),i===void 0&&c.setContentType(null),"setRequestHeader"in y&&O.forEach(c.toJSON(),a(function(S,k){y.setRequestHeader(k,S)},"setRequestHeader")),O.isUndefined(n.withCredentials)||(y.withCredentials=!!n.withCredentials),o&&o!=="json"&&(y.responseType=n.responseType),d&&([f,h]=Kr(d,!0),y.addEventListener("progress",f)),u&&y.upload&&([g,p]=Kr(u),y.upload.addEventListener("progress",g),y.upload.addEventListener("loadend",p)),(n.cancelToken||n.signal)&&(l=a(_=>{y&&(s(!_||_.type?new mr(null,r,y):_),y.abort(),y=null)},"onCanceled"),n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const w=hp(n.url);if(w&&Ce.protocols.indexOf(w)===-1){s(new z("Unsupported protocol "+w+":",z.ERR_BAD_REQUEST,r));return}y.send(i||null)},"dispatchXhrRequest"))},_p=a((r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let s=new AbortController,n;const i=a(function(d){if(!n){n=!0,o();const l=d instanceof Error?d:this.reason;s.abort(l instanceof z?l:new mr(l instanceof Error?l.message:l))}},"onabort");let c=e&&setTimeout(()=>{c=null,i(new z(`timeout of ${e}ms exceeded`,z.ETIMEDOUT))},e);const o=a(()=>{r&&(c&&clearTimeout(c),c=null,r.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),r=null)},"unsubscribe");r.forEach(d=>d.addEventListener("abort",i));const{signal:u}=s;return u.unsubscribe=()=>O.asap(o),u}},"composeSignals"),wp=a(function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let s=0,n;for(;s<t;)n=s+e,yield r.slice(s,n),s=n},"streamChunk"),Sp=a(async function*(r,e){for await(const t of vp(r))yield*wp(t,e)},"readBytes"),vp=a(async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},"readStream"),fa=a((r,e,t,s)=>{const n=Sp(r,e);let i=0,c,o=a(u=>{c||(c=!0,s&&s(u))},"_onFinish");return new ReadableStream({async pull(u){try{const{done:d,value:l}=await n.next();if(d){o(),u.close();return}let g=l.byteLength;if(t){let f=i+=g;t(f)}u.enqueue(new Uint8Array(l))}catch(d){throw o(d),d}},cancel(u){return o(u),n.return()}},{highWaterMark:2})},"trackStream"),pa=64*1024,{isFunction:Xr}=O,Ep=(({Request:r,Response:e})=>({Request:r,Response:e}))(O.global),{ReadableStream:ga,TextEncoder:ma}=O.global,ya=a((r,...e)=>{try{return!!r(...e)}catch{return!1}},"test"),Op=a(r=>{r=O.merge.call({skipUndefined:!0},Ep,r);const{fetch:e,Request:t,Response:s}=r,n=e?Xr(e):typeof fetch=="function",i=Xr(t),c=Xr(s);if(!n)return!1;const o=n&&Xr(ga),u=n&&(typeof ma=="function"?(h=>m=>h.encode(m))(new ma):async h=>new Uint8Array(await new t(h).arrayBuffer())),d=i&&o&&ya(()=>{let h=!1;const m=new t(Ce.origin,{body:new ga,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!m}),l=c&&o&&ya(()=>O.isReadableStream(new s("").body)),g={stream:l&&(h=>h.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!g[h]&&(g[h]=(m,y)=>{let b=m&&m[h];if(b)return b.call(m);throw new z(`Response type '${h}' is not supported`,z.ERR_NOT_SUPPORT,y)})});const f=a(async h=>{if(h==null)return 0;if(O.isBlob(h))return h.size;if(O.isSpecCompliantForm(h))return(await new t(Ce.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(O.isArrayBufferView(h)||O.isArrayBuffer(h))return h.byteLength;if(O.isURLSearchParams(h)&&(h=h+""),O.isString(h))return(await u(h)).byteLength},"getBodyLength"),p=a(async(h,m)=>{const y=O.toFiniteNumber(h.getContentLength());return y??f(m)},"resolveBodyLength");return async h=>{let{url:m,method:y,data:b,signal:w,cancelToken:_,timeout:S,onDownloadProgress:k,onUploadProgress:v,responseType:I,headers:E,withCredentials:T="same-origin",fetchOptions:M}=da(h),$=e||fetch;I=I?(I+"").toLowerCase():"text";let j=_p([w,_&&_.toAbortSignal()],S),ae=null;const de=j&&j.unsubscribe&&(()=>{j.unsubscribe()});let G;try{if(v&&d&&y!=="get"&&y!=="head"&&(G=await p(E,b))!==0){let Oe=new t(m,{method:"POST",body:b,duplex:"half"}),Pe;if(O.isFormData(b)&&(Pe=Oe.headers.get("content-type"))&&E.setContentType(Pe),Oe.body){const[We,K]=ca(G,Kr(la(v)));b=fa(Oe.body,pa,We,K)}}O.isString(T)||(T=T?"include":"omit");const Z=i&&"credentials"in t.prototype,q={...M,signal:j,method:y.toUpperCase(),headers:E.normalize().toJSON(),body:b,duplex:"half",credentials:Z?T:void 0};ae=i&&new t(m,q);let ce=await(i?$(ae,M):$(m,q));const ue=l&&(I==="stream"||I==="response");if(l&&(k||ue&&de)){const Oe={};["status","statusText","headers"].forEach(oe=>{Oe[oe]=ce[oe]});const Pe=O.toFiniteNumber(ce.headers.get("content-length")),[We,K]=k&&ca(Pe,Kr(la(k),!0))||[];ce=new s(fa(ce.body,pa,We,()=>{K&&K(),de&&de()}),Oe)}I=I||"text";let U=await g[O.findKey(g,I)||"text"](ce,h);return!ue&&de&&de(),await new Promise((Oe,Pe)=>{aa(Oe,Pe,{data:U,headers:xe.from(ce.headers),status:ce.status,statusText:ce.statusText,config:h,request:ae})})}catch(Z){throw de&&de(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)?Object.assign(new z("Network Error",z.ERR_NETWORK,h,ae,Z&&Z.response),{cause:Z.cause||Z}):z.from(Z,Z&&Z.code,h,ae,Z&&Z.response)}}},"factory"),kp=new Map,ba=a(r=>{let e=r&&r.env||{};const{fetch:t,Request:s,Response:n}=e,i=[s,n,t];let c=i.length,o=c,u,d,l=kp;for(;o--;)u=i[o],d=l.get(u),d===void 0&&l.set(u,d=o?new Map:Op(e)),l=d;return d},"getFetch");ba();const _n={http:Jf,xhr:bp,fetch:{get:ba}};O.forEach(_n,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const _a=a(r=>`- ${r}`,"renderReason"),Tp=a(r=>O.isFunction(r)||r===null||r===!1,"isResolvedHandle");function Ip(r,e){r=O.isArray(r)?r:[r];const{length:t}=r;let s,n;const i={};for(let c=0;c<t;c++){s=r[c];let o;if(n=s,!Tp(s)&&(n=_n[(o=String(s)).toLowerCase()],n===void 0))throw new z(`Unknown adapter '${o}'`);if(n&&(O.isFunction(n)||(n=n.get(e))))break;i[o||"#"+c]=n}if(!n){const c=Object.entries(i).map(([u,d])=>`adapter ${u} `+(d===!1?"is not supported by the environment":"is not available in the build"));let o=t?c.length>1?`since :
|
|
44
|
+
`+c.map(_a).join(`
|
|
45
|
+
`):" "+_a(c[0]):"as no adapter specified";throw new z("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n}a(Ip,"getAdapter$1");const wa={getAdapter:Ip,adapters:_n};function wn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new mr(null,r)}a(wn,"throwIfCancellationRequested");function Sa(r){return wn(r),r.headers=xe.from(r.headers),r.data=bn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),wa.getAdapter(r.adapter||pr.adapter,r)(r).then(a(function(s){return wn(r),s.data=bn.call(r,r.transformResponse,s),s.headers=xe.from(s.headers),s},"onAdapterResolution"),a(function(s){return oa(s)||(wn(r),s&&s.response&&(s.response.data=bn.call(r,r.transformResponse,s.response),s.response.headers=xe.from(s.response.headers))),Promise.reject(s)},"onAdapterRejection"))}a(Sa,"dispatchRequest");const va="1.13.5",Qr={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Qr[r]=a(function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r},"validator")});const Ea={};Qr.transitional=a(function(e,t,s){function n(i,c){return"[Axios v"+va+"] Transitional option '"+i+"'"+c+(s?". "+s:"")}return a(n,"formatMessage"),(i,c,o)=>{if(e===!1)throw new z(n(c," has been removed"+(t?" in "+t:"")),z.ERR_DEPRECATED);return t&&!Ea[c]&&(Ea[c]=!0,console.warn(n(c," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,c,o):!0}},"transitional"),Qr.spelling=a(function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)},"spelling");function Ap(r,e,t){if(typeof r!="object")throw new z("options must be an object",z.ERR_BAD_OPTION_VALUE);const s=Object.keys(r);let n=s.length;for(;n-- >0;){const i=s[n],c=e[i];if(c){const o=r[i],u=o===void 0||c(o,i,r);if(u!==!0)throw new z("option "+i+" must be "+u,z.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new z("Unknown option "+i,z.ERR_BAD_OPTION)}}a(Ap,"assertOptions");const es={assertOptions:Ap,validators:Qr},Ge=es.validators;let Ct=class{static{a(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new sa,response:new sa}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const i=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
46
|
+
`+i):s.stack=i}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Rt(this.defaults,t);const{transitional:s,paramsSerializer:n,headers:i}=t;s!==void 0&&es.assertOptions(s,{silentJSONParsing:Ge.transitional(Ge.boolean),forcedJSONParsing:Ge.transitional(Ge.boolean),clarifyTimeoutError:Ge.transitional(Ge.boolean),legacyInterceptorReqResOrdering:Ge.transitional(Ge.boolean)},!1),n!=null&&(O.isFunction(n)?t.paramsSerializer={serialize:n}:es.assertOptions(n,{encode:Ge.function,serialize:Ge.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),es.assertOptions(t,{baseUrl:Ge.spelling("baseURL"),withXsrfToken:Ge.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let c=i&&O.merge(i.common,i[t.method]);i&&O.forEach(["delete","get","head","post","put","patch","common"],h=>{delete i[h]}),t.headers=xe.concat(c,i);const o=[];let u=!0;this.interceptors.request.forEach(a(function(m){if(typeof m.runWhen=="function"&&m.runWhen(t)===!1)return;u=u&&m.synchronous;const y=t.transitional||pn;y&&y.legacyInterceptorReqResOrdering?o.unshift(m.fulfilled,m.rejected):o.push(m.fulfilled,m.rejected)},"unshiftRequestInterceptors"));const d=[];this.interceptors.response.forEach(a(function(m){d.push(m.fulfilled,m.rejected)},"pushResponseInterceptors"));let l,g=0,f;if(!u){const h=[Sa.bind(this),void 0];for(h.unshift(...o),h.push(...d),f=h.length,l=Promise.resolve(t);g<f;)l=l.then(h[g++],h[g++]);return l}f=o.length;let p=t;for(;g<f;){const h=o[g++],m=o[g++];try{p=h(p)}catch(y){m.call(this,y);break}}try{l=Sa.call(this,p)}catch(h){return Promise.reject(h)}for(g=0,f=d.length;g<f;)l=l.then(d[g++],d[g++]);return l}getUri(e){e=Rt(this.defaults,e);const t=ua(e.baseURL,e.url,e.allowAbsoluteUrls);return ra(t,e.params,e.paramsSerializer)}};O.forEach(["delete","get","head","options"],a(function(e){Ct.prototype[e]=function(t,s){return this.request(Rt(s||{},{method:e,url:t,data:(s||{}).data}))}},"forEachMethodNoData")),O.forEach(["post","put","patch"],a(function(e){function t(s){return a(function(i,c,o){return this.request(Rt(o||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:c}))},"httpMethod")}a(t,"generateHTTPMethod"),Ct.prototype[e]=t(),Ct.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));let Rp=class Ic{static{a(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(a(function(i){t=i},"promiseExecutor"));const s=this;this.promise.then(n=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](n);s._listeners=null}),this.promise.then=n=>{let i;const c=new Promise(o=>{s.subscribe(o),i=o}).then(n);return c.cancel=a(function(){s.unsubscribe(i)},"reject"),c},e(a(function(i,c,o){s.reason||(s.reason=new mr(i,c,o),t(s.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=a(s=>{e.abort(s)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Ic(a(function(n){e=n},"executor")),cancel:e}}};function Cp(r){return a(function(t){return r.apply(null,t)},"wrap")}a(Cp,"spread$1");function Np(r){return O.isObject(r)&&r.isAxiosError===!0}a(Np,"isAxiosError$1");const Sn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Sn).forEach(([r,e])=>{Sn[e]=r});function Oa(r){const e=new Ct(r),t=qo(Ct.prototype.request,e);return O.extend(t,Ct.prototype,e,{allOwnKeys:!0}),O.extend(t,e,null,{allOwnKeys:!0}),t.create=a(function(n){return Oa(Rt(r,n))},"create"),t}a(Oa,"createInstance");const ge=Oa(pr);ge.Axios=Ct,ge.CanceledError=mr,ge.CancelToken=Rp,ge.isCancel=oa,ge.VERSION=va,ge.toFormData=Yr,ge.AxiosError=z,ge.Cancel=ge.CanceledError,ge.all=a(function(e){return Promise.all(e)},"all"),ge.spread=Cp,ge.isAxiosError=Np,ge.mergeConfig=Rt,ge.AxiosHeaders=xe,ge.formToJSON=r=>na(O.isHTMLForm(r)?new FormData(r):r),ge.getAdapter=wa.getAdapter,ge.HttpStatusCode=Sn,ge.default=ge;const{Axios:My,AxiosError:vn,CanceledError:Ly,isCancel:Py,CancelToken:Fy,VERSION:xy,all:$y,Cancel:By,isAxiosError:jy,spread:Uy,toFormData:Vy,AxiosHeaders:qy,HttpStatusCode:Wy,formToJSON:Hy,getAdapter:zy,mergeConfig:Jy}=ge;var Dp=Object.defineProperty,Mp=a((r,e)=>Dp(r,"name",{value:e,configurable:!0}),"t$5");const Lp="X-Request-ID",Pp="bx24_request_id",Fp="bx24_sdk_ver",xp="bx24_sdk_type";class $p{static{a(this,"RequestIdGenerator")}static{Mp(this,"RequestIdGenerator")}getQueryStringParameterName(){return Pp}getQueryStringSdkParameterName(){return Fp}getQueryStringSdkTypeParameterName(){return xp}generate(){return H.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return Lp}}var Bp=Object.defineProperty,jp=a((r,e)=>Bp(r,"name",{value:e,configurable:!0}),"h$1");class ka{static{a(this,"AbstractHttp")}static{jp(this,"AbstractHttp")}_clientAxios;_authActions;_requestIdGenerator;_restrictionManager;_logger;_isClientSideWarning=!1;_clientSideWarningMessage="";_version;_metrics={totalRequests:0,successfulRequests:0,failedRequests:0,totalDuration:0,byMethod:new Map,lastErrors:[]};constructor(e,t,s){this._version=X.v2,this._logger=ee.createNullLogger();const n={};this.isServerSide()&&(n["User-Agent"]="b24-js-sdk/1.0.2"),this._authActions=e,this._requestIdGenerator=new $p,this._clientAxios=ge.create({headers:{...n,...t?t.headers:{}},timeout:3e4,timeoutErrorMessage:"Request timeout exceeded",...t&&{...t,headers:void 0}});const i={...Gs.getDefault(),...s};this._restrictionManager=new Uo(i)}get apiVersion(){return this._version}get ajaxClient(){return this._clientAxios}setLogger(e){this._logger=e,this._restrictionManager.setLogger(this._logger)}getLogger(){return this._logger}async setRestrictionManagerParams(e){await this._restrictionManager.setConfig(e)}getRestrictionManagerParams(){return this._restrictionManager.getParams()}getStats(){return{...this._restrictionManager.getStats(),totalRequests:this._metrics.totalDuration,successfulRequests:this._metrics.successfulRequests,failedRequests:this._metrics.failedRequests,totalDuration:this._metrics.totalDuration,byMethod:this._metrics.byMethod,lastErrors:this._metrics.lastErrors}}async reset(){return this._metrics.totalDuration=0,this._metrics.successfulRequests=0,this._metrics.failedRequests=0,this._metrics.totalDuration=0,this._metrics.byMethod.clear(),this._metrics.lastErrors=[],this._restrictionManager.reset()}_updateMetrics(e,t,s,n){this._metrics.totalRequests++,t?this._metrics.successfulRequests++:(this._metrics.failedRequests++,n instanceof be&&(this._metrics.lastErrors.push({method:e,error:n.message,timestamp:Date.now()}),this._metrics.lastErrors.length>100&&(this._metrics.lastErrors=this._metrics.lastErrors.slice(-100)))),this._metrics.byMethod.has(e)||this._metrics.byMethod.set(e,{count:0,totalDuration:0});const i=this._metrics.byMethod.get(e);i.count++,i.totalDuration+=s}_validateParams(e,t,s){try{JSON.stringify(s)}catch(n){throw new be({code:"JSSDK_INVALID_PARAMS",description:"Parameters contain circular references",status:400,requestInfo:{method:t,params:s,requestId:e},originalError:n})}}async call(e,t,s){s=s??this._requestIdGenerator.getRequestId();const n=this._restrictionManager.getParams().maxRetries;this._validateParams(s,e,t),this._logRequest(s,e,t);let i=null;const c=Date.now();for(let o=0;o<n;o++)try{this._logAttempt(s,e,o+1,n),await this._restrictionManager.applyOperatingLimits(s,e,t);const u=await this._executeSingleCall(s,e,t),d=Date.now()-c;return this._restrictionManager.resetErrors(e),this._updateMetrics(e,!0,d),this._logSuccessfulRequest(s,e,d),u}catch(u){i=this._convertToAjaxError(s,u,e,t);const d=Date.now()-c;if(this._restrictionManager.incrementError(e),this._updateMetrics(e,!1,d,i),this._logFailedRequest(s,e,o+1,n,i),o<n){const l=await this._restrictionManager.handleError(s,e,t,i,o);if(l>0){this._restrictionManager.incrementStats("limitHits"),this._logAttemptRetryWaiteDelay(s,e,l,o+1,n),await this._restrictionManager.waiteDelay(l),this._restrictionManager.incrementStats("retries");continue}}if(o+1===n&&this._logAllAttemptsExhausted(s,e,o+1,n),this._restrictionManager.exceptionCodeForSoft.includes(i.code))return this._createAjaxResultWithErrorFromResponse(i,s,e,t);throw i}throw new be({code:"JSSDK_CALL_ALL_ATTEMPTS_EXHAUSTED",description:"All attempts exhausted",status:i?.status||500,requestInfo:{method:e,params:t,requestId:s},originalError:i?.originalError||null})}_convertToAjaxError(e,t,s,n){return t instanceof be?t:t instanceof vn?this._convertAxiosErrorToAjaxError(e,t,s,n):this._convertUnknownErrorToAjaxError(e,t,s,n)}_convertAxiosErrorToAjaxError(e,t,s,n){let i=`${t.code||"JSSDK_AXIOS_ERROR"}`,c=t.message;const o=t.response?.status||0;if(i==="ERR_NETWORK")return new be({code:"NETWORK_ERROR",description:"Network connection failed",status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t});if(i==="ECONNABORTED"||t.message.includes("timeout"))return new be({code:"REQUEST_TIMEOUT",description:"Request timeout exceeded",status:408,requestInfo:{method:s,params:n,requestId:e},originalError:t});if(t.response?.data&&typeof t.response.data=="object"){const u=t.response.data;u.error&&typeof u.error=="object"&&"code"in u.error?(i=u.error.code,c=u.error.message.trimEnd(),u.error.validation&&(c.length>0&&(c.endsWith(".")||(c+="."),c+=" "),u.error.validation.forEach(d=>{c+=`${d?.message||JSON.stringify(d)}`}))):u.error&&typeof u.error=="string"&&(i=u.error!=="0"?u.error:i,c=u?.error_description??c)}return new be({code:i,description:c,status:o,requestInfo:{method:s,params:n,requestId:e},originalError:t})}_convertUnknownErrorToAjaxError(e,t,s,n){return new be({code:"JSSDK_UNKNOWN_ERROR",description:t instanceof Error?t.message:String(t),status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t})}async _executeSingleCall(e,t,s){this._checkClientSideWarning(e);const n=await this._ensureAuth(e),i=await this._makeRequestWithAuthRetry(e,t,s,n);return this._createAjaxResultFromResponse(i,e,t,s)}async _ensureAuth(e){let t=this._authActions.getAuthData();return t===!1&&(this._logRefreshingAuthToken(e),t=await this._authActions.refreshAuth()),t}async _makeRequestWithAuthRetry(e,t,s,n){try{return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,n)}catch(i){if(i instanceof vn&&this.getLogger().info("post/catchError",{requestId:e,status:i.status,responseData:JSON.stringify(i?.response?.data,null,0)}),this._isAuthError(i)){this._logAuthErrorDetected(e),this._logRefreshingAuthToken(e);const c=await this._authActions.refreshAuth();return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,c)}throw i}}async _makeAxiosRequest(e,t,s,n){const i=this._prepareMethod(e,t,this.getBaseUrl()),c=this._prepareParams(n,s),o=JSON.stringify(c,null,0),u=300,d=100;this.getLogger().info("post/send",{requestId:e,method:i,params:o.length>u?o.slice(0,d)+"...":o});const l=await this._clientAxios.post(i,c),g=JSON.stringify(l.data.result,null,0);return this.getLogger().info("post/response",{requestId:e,result:g.length>u?g.slice(0,d)+"...":g,time:JSON.stringify(l.data.time,null,0)}),{status:l.status,payload:l.data}}_isAuthError(e){return e instanceof be?e.status===401&&["expired_token","invalid_token"].includes(e.code):!1}async _createAjaxResultFromResponse(e,t,s,n){const i=new ur({answer:e.payload,query:{method:s,params:n,requestId:t},status:e.status});if(i.isSuccess){const c=i.getData()?.time;await this._restrictionManager.updateStats(t,s,c)}return i}_createAjaxResultWithErrorFromResponse(e,t,s,n){return new ur({answer:{error:{code:e.code,message:e.message}},query:{method:s,params:n,requestId:t},status:e.status})}_prepareParams(e,t){const s={...t};if(e.refresh_token!=="hook"&&(s.auth=e.access_token),s?.data&&"start"in s.data){const{start:n,...i}=s.data;s.data=i}return s}setClientSideWarning(e,t){this._isClientSideWarning=e,this._clientSideWarningMessage=t}isServerSide(){return $r()!==or.BROWSE}getBaseUrl(){return this._authActions.getTargetOriginWithPath().get(this._version)}_sanitizeParams(e){const t={...e};return["auth","password","token","secret","access_token","refresh_token"].forEach(s=>{s in t&&t[s]&&(t[s]="***REDACTED***")}),t}_logRequest(e,t,s){this.getLogger().debug("http request starting",{requestId:e,method:t,params:this._sanitizeParams(s),api:this.apiVersion,timestamp:Date.now()})}_logAttempt(e,t,s,n){this.getLogger().info("http request attempt",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}})}_logRefreshingAuthToken(e){this.getLogger().info("http refreshing auth token",{requestId:e,api:this.apiVersion})}_logAuthErrorDetected(e){this.getLogger().info("http auth error detected",{requestId:e,api:this.apiVersion})}_logSuccessfulRequest(e,t,s){this.getLogger().debug("http request successful",{requestId:e,method:t,api:this.apiVersion,duration:{ms:s,sec:Number.parseFloat((s/1e3).toFixed(2))}})}_logFailedRequest(e,t,s,n,i){this.getLogger().debug("http request failed",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n},error:{code:i.code,message:i.message,status:i.status}})}_logAttemptRetryWaiteDelay(e,t,s,n,i){this.getLogger().debug(`http wait ${(s/1e3).toFixed(2)} sec.`,{requestId:e,method:t,api:this.apiVersion,wait:s,attempt:{current:n,max:i}})}_logAllAttemptsExhausted(e,t,s,n){this.getLogger().warning("http all retry attempts exhausted",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}})}_logBatchStart(e,t,s){const n=Array.isArray(t)?t.length:Object.keys(t).length;this.getLogger().debug("http batch request starting ",{requestId:e,callCount:n,api:this.apiVersion,isHaltOnError:s.isHaltOnError,timestamp:Date.now()})}_logBatchCompletion(e,t,s){this.getLogger().debug("http batch request completed",{requestId:e,api:this.apiVersion,totalCalls:t,successful:t-s,failed:s,successRate:t>0?((t-s)/t*100).toFixed(1)+"%":"??"})}_checkClientSideWarning(e){this._isClientSideWarning&&!this.isServerSide()&&L.isStringFilled(this._clientSideWarningMessage)&&ee.forcedLog(this.getLogger(),"warning",this._clientSideWarningMessage,{requestId:e,code:"JSSDK_CLIENT_SIDE_WARNING"})}}var Up=Object.defineProperty,Vp=a((r,e)=>Up(r,"name",{value:e,configurable:!0}),"r$7");class Ta{static{a(this,"AbstractInteractionBatch")}static{Vp(this,"AbstractInteractionBatch")}parallelDefaultValue;requestId;restrictionManager;processingStrategy;_commands=[];constructor(e){this.parallelDefaultValue=e.parallelDefaultValue,this.requestId=e.requestId,this.restrictionManager=e.restrictionManager,this.processingStrategy=e.processingStrategy}setProcessingStrategy(e){this.processingStrategy=e}get size(){return this._commands.length}get maxSize(){return 0}addCommands(e){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});this._commands=this.processingStrategy.prepareCommands(e,{parallelDefaultValue:this.parallelDefaultValue})}getCommandsForCall(){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});return this.processingStrategy.buildCommands(this._commands)}}var qp=Object.defineProperty,Wp=a((r,e)=>qp(r,"name",{value:e,configurable:!0}),"s$e");const Hp=50;class zp extends Ta{static{a(this,"InteractionBatchV2")}static{Wp(this,"InteractionBatchV2")}get maxSize(){return Hp}async prepareResponse(e){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}const Jp=String.prototype.replace,Gp=/%20/g,Ia={RFC1738:"RFC1738",RFC3986:"RFC3986"},Yp={RFC1738:a(function(r){return Jp.call(r,Gp,"+")},"RFC1738"),RFC3986:a(function(r){return String(r)},"RFC3986")},Zp=Ia.RFC1738,Kp=Ia.RFC3986,Xp=Array.isArray,it=(function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),En=1024,Qp=a(function(e,t,s,n,i){if(e.length===0)return e;let c=e;if(typeof e=="symbol"?c=Symbol.prototype.toString.call(e):typeof e!="string"&&(c=String(e)),s==="iso-8859-1")return escape(c).replace(/%u[0-9a-f]{4}/gi,function(u){return"%26%23"+parseInt(u.slice(2),16)+"%3B"});let o="";for(let u=0;u<c.length;u+=En){const d=c.length>=En?c.slice(u,u+En):c,l=[];for(let g=0;g<d.length;++g){let f=d.charCodeAt(g);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===Zp&&(f===40||f===41)){l[l.length]=d.charAt(g);continue}if(f<128){l[l.length]=it[f];continue}if(f<2048){l[l.length]=it[192|f>>6]+it[128|f&63];continue}if(f<55296||f>=57344){l[l.length]=it[224|f>>12]+it[128|f>>6&63]+it[128|f&63];continue}g+=1,f=65536+((f&1023)<<10|d.charCodeAt(g)&1023),l[l.length]=it[240|f>>18]+it[128|f>>12&63]+it[128|f>>6&63]+it[128|f&63]}o+=l.join("")}return o},"encode"),eg=a(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),Aa=a(function(e,t){if(Xp(e)){const s=[];for(let n=0;n<e.length;n+=1)s.push(t(e[n]));return s}return t(e)},"maybeMap"),tg={brackets:a(function(e){return e+"[]"},"brackets"),comma:"comma",indices:a(function(e,t){return e+"["+t+"]"},"indices"),repeat:a(function(e){return e},"repeat")},ht=Array.isArray,rg=Array.prototype.push,Ra=a(function(r,e){rg.apply(r,ht(e)?e:[e])},"pushToArray"),sg=Date.prototype.toISOString,Ca=Kp,ts={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Qp,encodeValuesOnly:!1,format:Ca,formatter:Yp[Ca],indices:!1,serializeDate:a(function(e){return sg.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},ng=a(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),On={},Na=a(function(e,t,s,n,i,c,o,u,d,l,g,f,p,h,m,y,b,w){let _=e,S=w,k=0,v=!1;for(;(S=S.get(On))!==void 0&&!v;){const $=S.get(e);if(k+=1,typeof $<"u"){if($===k)throw new RangeError("Cyclic object value");v=!0}typeof S.get(On)>"u"&&(k=0)}if(typeof l=="function"?_=l(t,_):_ instanceof Date?_=p(_):s==="comma"&&ht(_)&&(_=Aa(_,function($){return $ instanceof Date?p($):$})),_===null){if(c)return d&&!y?d(t,ts.encoder,b,"key",h):t;_=""}if(ng(_)||eg(_)){if(d){const $=y?t:d(t,ts.encoder,b,"key",h);return[m($)+"="+m(d(_,ts.encoder,b,"value",h))]}return[m(t)+"="+m(String(_))]}const I=[];if(typeof _>"u")return I;let E;if(s==="comma"&&ht(_))y&&d&&(_=Aa(_,d)),E=[{value:_.length>0?_.join(",")||null:void 0}];else if(ht(l))E=l;else{const $=Object.keys(_);E=g?$.sort(g):$}const T=u?t.replace(/\./g,"%2E"):t,M=n&&ht(_)&&_.length===1?T+"[]":T;if(i&&ht(_)&&_.length===0)return M+"[]";for(let $=0;$<E.length;++$){const j=E[$],ae=typeof j=="object"&&typeof j.value<"u"?j.value:_[j];if(o&&ae===null)continue;const de=f&&u?j.replace(/\./g,"%2E"):j,G=ht(_)?typeof s=="function"?s(M,de):M:M+(f?"."+de:"["+de+"]");w.set(e,k);const Z=new WeakMap;Z.set(On,w),Ra(I,Na(ae,G,s,n,i,c,o,u,s==="comma"&&y&&ht(_)?null:d,l,g,f,p,h,m,y,b,Z))}return I},"stringify"),ig=a(function(e){return ts},"normalizeStringifyOptions");function og(r,e){let t=r;const s=ig();let n,i;typeof s.filter=="function"?(i=s.filter,t=i("",t)):ht(s.filter)&&(i=s.filter,n=i);const c=[];if(typeof t!="object"||t===null)return"";const o=tg[s.arrayFormat],u=o==="comma"&&s.commaRoundTrip;n||(n=Object.keys(t)),s.sort&&n.sort(s.sort);const d=new WeakMap;for(let f=0;f<n.length;++f){const p=n[f];s.skipNulls&&t[p]===null||Ra(c,Na(t[p],p,o,u,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,d))}const l=c.join(s.delimiter);let g=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),l.length>0?g+l:""}a(og,"stringify");var ag=Object.defineProperty,cg=a((r,e)=>ag(r,"name",{value:e,configurable:!0}),"s$d");class Da{static{a(this,"AbstractProcessing")}static{cg(this,"AbstractProcessing")}_getBatchResultByIndex(e,t){if(e)return e[t]}_createErrorFromAjaxResult(e){return e.hasError("base-error")?e.errors.get("base-error"):new be({code:"JSSDK_BATCH_SUB_ERROR",description:e.getErrorMessages().join("; "),status:e.getStatus(),requestInfo:{...e.getQuery()},originalError:e.getErrors().next().value})}}var lg=Object.defineProperty,ug=a((r,e)=>lg(r,"name",{value:e,configurable:!0}),"l$5");class Ma extends Da{static{a(this,"AbstractProcessingV2")}static{ug(this,"AbstractProcessingV2")}_buildRow(e){return`${e.method}?${og(e.query||{})}`}buildCommands(e){if(e.length<1)throw new ne({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMANDS",description:"commands not set",status:500});const t=e[0];if(typeof t.as=="string"&&t.as.length>0){const n={};for(const i of e)n[i.as]=this._buildRow(i);return n}const s=[];for(const n of e)s.push(this._buildRow(n));return s}async prepareItems(e,t){const s=new Map;for(const[n,i]of e.entries())await this._processResponseItem(i,i.as??n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i.result,t),o=this._getBatchResultByIndex(i.result_error,t);if(typeof c<"u"||typeof o<"u"){const u=e.method,d=this._getBatchResultByIndex(i.result_time,t);typeof d<"u"&&await s.restrictionManager.updateStats(s.requestId,`batch::${u}`,d);const l=new ur({answer:{error:o?typeof o=="string"?o:o.error:void 0,error_description:o?typeof o=="string"?void 0:o.error_description:void 0,result:c??{},total:Number.parseInt(this._getBatchResultByIndex(i.result_total,t)||"0"),next:Number.parseInt(this._getBatchResultByIndex(i.result_next,t)||"0"),time:d},query:{method:u,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,l);return}if(s.parallelDefaultValue)throw new ne({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMAND_RESPONSE",description:`There were difficulties parsing the response for batch { index: ${t}, method: ${e.method} }`,status:500})}async handleResults(e,t,s){const n=new Le,i=new Map;for(const[c,o]of t){if(o.getStatus()!==200||!o.isSuccess){const u=this._createErrorFromAjaxResult(o);this._processResponseError(n,u,`${c}`),i.set(c,o)}i.set(c,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var hg=Object.defineProperty,dg=a((r,e)=>hg(r,"name",{value:e,configurable:!0}),"o$7");class fg extends Ma{static{a(this,"ProcessingAsArrayV2")}static{dg(this,"ProcessingAsArrayV2")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=bt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t)}}var pg=Object.defineProperty,gg=a((r,e)=>pg(r,"name",{value:e,configurable:!0}),"s$c");class mg extends Ma{static{a(this,"ProcessingAsObjectV2")}static{gg(this,"ProcessingAsObjectV2")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var yg=Object.defineProperty,bg=a((r,e)=>yg(r,"name",{value:e,configurable:!0}),"i$5");class rs extends ka{static{a(this,"HttpV2")}static{bg(this,"HttpV2")}constructor(e,t,s){super(e,t,s),this._version=X.v2}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new zp({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new fg):i.setProcessingStrategy(new mg),i.addCommands(e),i.size>i.maxSize)throw new be({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new be({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c=await this.call("batch",{halt:s.isHaltOnError?1:0,cmd:i.getCommandsForCall()},n),o=await i.prepareResponse(c);return this._logBatchCompletion(n,o.getData()?.result?.size??0,o.getErrorMessages().length),o}_prepareMethod(e,t,s){const n=`/${encodeURIComponent(t)}`;if(t.includes("task."))return`${s}${n}`;const i=new URLSearchParams({[this._requestIdGenerator.getQueryStringParameterName()]:e,[this._requestIdGenerator.getQueryStringSdkParameterName()]:"1.0.2",[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${s}${n}?${i.toString()}`}}var _g=Object.defineProperty,wg=a((r,e)=>_g(r,"name",{value:e,configurable:!0}),"s$b");const Sg=50;class vg extends Ta{static{a(this,"InteractionBatchV3")}static{wg(this,"InteractionBatchV3")}get maxSize(){return Sg}async prepareResponse(e){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}var Eg=Object.defineProperty,Og=a((r,e)=>Eg(r,"name",{value:e,configurable:!0}),"d$2");class La extends Da{static{a(this,"AbstractProcessingV3")}static{Og(this,"AbstractProcessingV3")}buildCommands(e){if(e.length<1)throw new ne({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMANDS",description:"commands not set",status:500});return e}async prepareItems(e,t){const s=new Map;if(!t.response.isSuccess)return s;for(const[n,i]of e.entries())await this._processResponseItem(i,n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i,t),o=e.method,u=void 0,d=s.response.getData().time;typeof d<"u"&&await s.restrictionManager.updateStats(s.requestId,`batch::${o}`,d);const l=new ur({answer:{result:c??{},error:u,time:d},query:{method:e.method,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,l)}async handleResults(e,t,s){const n=new Le,i=new Map;if(!s.response.isSuccess){for(const[c,o]of s.response.errors)n.addError(o,c);return n.setData({result:i,time:void 0}),n}for(const[c,o]of t){const u=Number.parseInt(`${c}`),d=e[u];if(typeof d>"u")throw new ne({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMAND",description:`command for index ${c} not set`,status:500});const l=d.as??c;if(o.getStatus()!==200||!o.isSuccess){const g=this._createErrorFromAjaxResult(o);this._processResponseError(n,g,`${l}`),i.set(l,o)}i.set(l,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var kg=Object.defineProperty,Tg=a((r,e)=>kg(r,"name",{value:e,configurable:!0}),"o$5");class Ig extends La{static{a(this,"ProcessingAsArrayV3")}static{Tg(this,"ProcessingAsArrayV3")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=bt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t)}}var Ag=Object.defineProperty,Rg=a((r,e)=>Ag(r,"name",{value:e,configurable:!0}),"s$a");class Cg extends La{static{a(this,"ProcessingAsObjectV3")}static{Rg(this,"ProcessingAsObjectV3")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var Ng=Object.defineProperty,Dg=a((r,e)=>Ng(r,"name",{value:e,configurable:!0}),"i$4");class ss extends ka{static{a(this,"HttpV3")}static{Dg(this,"HttpV3")}constructor(e,t,s){super(e,t,s),this._version=X.v3}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new vg({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new Ig):i.setProcessingStrategy(new Cg),i.addCommands(e),i.size>i.maxSize)throw new be({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new be({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c=await this.call("batch",i.getCommandsForCall(),n),o=await i.prepareResponse(c);return this._logBatchCompletion(n,o.getData()?.result?.size??0,o.getErrorMessages().length),o}_prepareMethod(e,t,s){const n=`/${encodeURIComponent(t)}`,i=new URLSearchParams({[this._requestIdGenerator.getQueryStringParameterName()]:e,[this._requestIdGenerator.getQueryStringSdkParameterName()]:"1.0.2",[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${s}${n}?${i.toString()}`}}var Mg=Object.defineProperty,Lg=a((r,e)=>Mg(r,"name",{value:e,configurable:!0}),"e$3");const Pg=Lg(()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)}),"useScrollSize");var Fg=Object.defineProperty,xg=a((r,e)=>Fg(r,"name",{value:e,configurable:!0}),"s$9");let $g=class St{static{a(this,"t")}static{xg(this,"FormatterNumbers")}static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!St.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");St.isInternalConstructing=!1}static getInstance(){return St.instance||(St.isInternalConstructing=!0,St.instance=new St),St.instance}setDefLocale(e){this._defLocale=e}format(e,t){let s;(typeof t>"u"||!L.isStringFilled(t))&&(t=L.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?s=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):s=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let n=s.format(e);return t.includes("ru")&&(n=n.replace(",",".")),n}};var Bg=Object.defineProperty,Pa=a((r,e)=>Bg(r,"name",{value:e,configurable:!0}),"n$7");class A{static{a(this,"IbanSpecification")}static{Pa(this,"IbanSpecification")}countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,s,n){this.countryCode=e,this.length=t,this.structure=s,this.example=n}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(s=>{let n;const i=s.slice(0,1),c=Number.parseInt(s.slice(1),10);switch(i){case"A":n="0-9A-Za-z";break;case"B":n="0-9A-Z";break;case"C":n="A-Za-z";break;case"F":n="0-9";break;case"L":n="a-z";break;case"U":n="A-Z";break;case"W":n="0-9a-z";break}return"(["+n+"]{"+c+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const s=t.charCodeAt(0);return s>=65&&s<=90?(s-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,s;for(;t.length>2;)s=t.slice(0,9),t=Number.parseInt(s,10)%97+t.slice(s.length);return Number.parseInt(t,10)%97}}class dt{static{a(this,"FormatterIban")}static{Pa(this,"FormatterIban")}static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!dt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");dt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return dt.instance||(dt.isInternalConstructing=!0,dt.instance=new dt),dt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!L.isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const s=this._countries.get(t);return!!s&&s.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const s=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(s,"$1"+t)}electronicFormat(e){const t=/[^a-z0-9]/gi;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const s=e.slice(0,2);if(!this._countries.has(s))throw new Error(`No country with code ${s}`);const n=this._countries.get(s);if(!n)throw new Error(`No country with code ${s}`);return n.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);if(!s)throw new Error(`No country with code ${e}`);return s.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!L.isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);return!!s&&s.isValidBBAN(this.electronicFormat(t))}}var jg=Object.defineProperty,Ug=a((r,e)=>jg(r,"name",{value:e,configurable:!0}),"n$6");const Vg=Ug(()=>{const r=$g.getInstance(),e=dt.getInstance();return e.addSpecification(new A("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new A("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new A("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new A("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new A("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new A("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new A("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new A("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new A("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new A("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new A("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new A("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new A("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new A("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new A("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new A("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new A("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new A("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new A("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new A("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new A("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new A("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new A("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new A("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new A("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new A("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new A("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new A("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new A("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new A("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new A("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new A("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new A("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new A("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new A("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new A("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new A("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new A("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new A("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new A("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new A("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new A("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new A("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new A("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new A("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new A("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new A("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new A("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new A("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new A("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new A("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new A("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new A("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new A("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new A("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new A("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new A("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new A("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new A("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new A("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new A("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new A("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new A("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new A("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new A("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new A("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new A("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new A("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new A("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new A("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new A("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new A("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new A("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new A("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new A("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new A("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new A("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new A("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new A("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new A("BI",16,"F12","BI41123456789012")),e.addSpecification(new A("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new A("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new A("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new A("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new A("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new A("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new A("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new A("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new A("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new A("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new A("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new A("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new A("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new A("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new A("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new A("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new A("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new A("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new A("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new A("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new A("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new A("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}},"useFormatter");var qg=Object.defineProperty,Wg=a((r,e)=>qg(r,"name",{value:e,configurable:!0}),"r$6");class Fa{static{a(this,"AuthHookManager")}static{Wg(this,"AuthHookManager")}#e;#r;#s;#t;#i;constructor(e){this.#e=Object.freeze(Object.assign({},e)),this.#r=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#s=`https://${this.#r}/rest`,this.#t=`https://${this.#r}`,this.#i=new Map,this.#i.set(X.v2,`${this.#s}/${this.#e.userId}/${this.#e.secret}`),this.#i.set(X.v3,`${this.#s}/api/${this.#e.userId}/${this.#e.secret}`)}getAuthData(){return{access_token:this.#e.secret,refresh_token:"hook",expires:0,expires_in:0,domain:this.#r,member_id:this.#r}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#t}`}getTargetOriginWithPath(){return this.#i}get isAdmin(){return!0}}var Hg=Object.defineProperty,zg=a((r,e)=>Hg(r,"name",{value:e,configurable:!0}),"s$8");class kn extends Wr{static{a(this,"B24Hook")}static{zg(this,"B24Hook")}#e;constructor(e,t){super(),this.#e=new Fa(e);const s=`The B24Hook object is intended exclusively for use on the server.
|
|
47
|
+
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new rs(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV2.setClientSideWarning(!0,s),this._httpV3=new ss(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV3.setClientSideWarning(!0,s),this._isInit=!0}get auth(){return this.#e}offClientSideWarning(){nt.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}static fromWebhookUrl(e,t){if(!e.trim())throw new Error("Webhook URL cannot be empty");let s;try{s=new URL(e.replace("/rest/api","/rest"))}catch{throw new Error(`Invalid webhook URL format: ${e}`)}if(s.protocol!=="https:")throw new Error("Webhook requires HTTPS protocol");const n=s.pathname.split("/").filter(Boolean);if(!(n.length===3&&n[0]==="rest"||n.length===4&&n[0]==="rest"&&n[1]==="api"))throw new Error("Webhook URL must follow format: /rest/<userId>/<secret> or /rest/api/<userId>/<secret>");const i=n[1]==="api"?2:1,c=n[1]==="api"?3:2,o=n[i],u=n[c];if(!/^\d+$/.test(o))throw new Error(`User ID must be numeric in webhook URL, received: ${o}`);const d=Number.parseInt(o,10);return new kn({b24Url:s.origin,userId:d,secret:u},t)}}var ie=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r.getInterface="getInterface",r.placementBindEvent="placementBindEvent",r))(ie||{}),Jg=Object.defineProperty,Gg=a((r,e)=>Jg(r,"name",{value:e,configurable:!0}),"m$3");class xa{static{a(this,"MessageManager")}static{Gg(this,"MessageManager")}#e;#r;#s;_logger;runCallbackHandler;constructor(e){this._logger=ee.createNullLogger(),this.#e=e,this.#r=new Map,this.#s=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((s,n)=>{let i;const c={resolve:s,reject:n,timeoutId:null},o=this.#t(c);let u=null;const d=qs(t||{},["singleOption","callBack","isSafely","safelyTime","requestId"]),{callBack:l,singleOption:g,requestId:f}=t||{};if(l&&this.#s.set(o,l),g?u=g:Object.keys(d).length>0&&(u={...d}),e.toString().includes(":"))i={method:e.toString(),params:u||"",callback:o,appSid:this.#e.getAppSid(),requestId:f};else{i=e.toString(),t?.isRawValue!==!0&&u?u=JSON.stringify(u):t?.isRawValue===!0&&u&&L.isPlainObject(u)&&u.value&&(u=u.value);const p=[u||"",o,this.#e.getAppSid()];i+=":"+p.filter(Boolean).join(":")}if(this.getLogger().debug(`send to ${this.#e.getTargetOrigin()}`,{cmd:i,origin:this.#e.getTargetOrigin()}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely){const p=Number.parseInt(String(t?.safelyTime||900));this.#r.get(o).timeoutId=window.setTimeout(()=>{this.#r.has(o)&&(this.getLogger().warning(`action ${e.toString()} stop by timeout`,{command:e.toString(),safelyTime:p}),this.#r.delete(o),s({isSafely:!0}))},p)}})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().debug(`get from ${e.origin}`,{data:e.data,origin:e.origin});const t=e.data.split(":"),s={id:t[0],args:t.slice(1).join(":")};if(s.args&&(s.args=JSON.parse(s.args)),this.#r.has(s.id)){const n=this.#r.get(s.id);n.timeoutId&&clearTimeout(n.timeoutId),this.#r.delete(s.id),n.resolve(s.args)}else if(this.#s.has(s.id)){const n=this.#s.get(s.id);n&&n.apply(globalThis,[s.args])}}}#t(e){const t=H.getUniqId();return this.#r.set(t,e),t}}var Yg=Object.defineProperty,Zg=a((r,e)=>Yg(r,"name",{value:e,configurable:!0}),"h");class $a{static{a(this,"AppFrame")}static{Zg(this,"AppFrame")}#e="";#r=!0;#s=null;#t=null;#i=null;#n;#o;#c;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#r=e.PROTOCOL===!0,e.LANG&&(this.#i=e.LANG),e.APP_SID&&(this.#s=e.APP_SID),this.#c=new Map,this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(X.v2,`${this.#n}`),this.#c.set(X.v3,`${this.#n}/api`)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#t||(this.#t=e.PATH),this.#i||(this.#i=e.LANG),this.#r=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(X.v2,`${this.#n}`),this.#c.set(X.v3,`${this.#n}/api`),this}getAppSid(){if(this.#s===null)throw new Error("Not init appSid");return this.#s}getTargetOrigin(){return this.#o}getTargetOriginWithPath(){return this.#c}getLang(){return this.#i||Js.en}}var Kg=Object.defineProperty,Xg=a((r,e)=>Kg(r,"name",{value:e,configurable:!0}),"s$7");class Ba{static{a(this,"AuthManager")}static{Xg(this,"AuthManager")}#e=null;#r=null;#s=0;#t=0;#i=null;#n=!1;#o;#c;constructor(e,t){this.#o=e,this.#c=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Number.parseInt(e.AUTH_EXPIRES),this.#s=Date.now()+this.#t*1e3,this.#n=e.IS_ADMIN,this.#i=e.MEMBER_ID||""),this}getAuthData(){return this.#s>Date.now()?{access_token:this.#e,refresh_token:this.#r,expires:this.#s/1e3,expires_in:this.#t,domain:this.#o.getTargetOrigin(),member_id:this.#i}:!1}async refreshAuth(){return this.#c.send(ie.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#s=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#i||""].join("_")}get isAdmin(){return this.#n}getTargetOrigin(){return this.#o.getTargetOrigin()}getTargetOriginWithPath(){return this.#o.getTargetOriginWithPath()}}var Qg=Object.defineProperty,em=a((r,e)=>Qg(r,"name",{value:e,configurable:!0}),"m$2");class ja{static{a(this,"ParentManager")}static{em(this,"ParentManager")}#e;constructor(e){this.#e=e}get message(){return this.#e}async closeApplication(){return this.#e.send(ie.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(ie.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(ie.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,s=0){const n=document.body;let i=Math.max(n.scrollWidth,n.offsetWidth);s>0&&(i=Math.max(s,i));let c=Math.max(n.scrollHeight,n.offsetHeight);return e&&(c=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(c=Math.max(t,c)),this.resizeWindow(i,c)}getScrollSize(){return Pg()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(ie.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(ie.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(ie.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(ie.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(ie.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(ie.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(ie.imOpenHistory,{dialogId:e,isSafely:!0})}}var tm=Object.defineProperty,rm=a((r,e)=>tm(r,"name",{value:e,configurable:!0}),"r$4");let Ua=class{static{a(this,"OptionsManager")}static{rm(this,"OptionsManager")}#e;#r=null;#s=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#r=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#s=e.USER_OPTIONS),this}appGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#r||(this.#r=[]),this.#r[e]=t,this.#t(ie.setAppOption,e,this.#r[e])}userGet(e){if(this.#s&&this.#s[e])return this.#s[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#r||(this.#r=[]),this.#r[e]||(this.#r[e]=null),this.#s[e]=t,this.#t(ie.setUserOption,e,this.#s[e])}async#t(e,t,s){return this.#e.send(e,{name:t,value:s,isSafely:!0}).then(()=>Promise.resolve())}};var sm=Object.defineProperty,nm=a((r,e)=>sm(r,"name",{value:e,configurable:!0}),"s$6");class Va{static{a(this,"DialogManager")}static{nm(this,"DialogManager")}#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(ie.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(ie.selectUser,{mult:!0})}async selectAccess(e=[]){return this.#e.send(ie.selectAccess,{value:e})}async selectCRM(e){return this.#e.send(ie.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}var im=Object.defineProperty,om=a((r,e)=>im(r,"name",{value:e,configurable:!0}),"m$1");class qa{static{a(this,"SliderManager")}static{om(this,"SliderManager")}#e;#r;constructor(e,t){this.#e=e,this.#r=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#r.send(ie.openApplication,e)}async closeSliderAppPage(){return this.#r.send(ie.closeApplication,{isSafely:!1})}#s(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const s=new URL(e);return s.searchParams.set("IFRAME","Y"),s.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#r.send(ie.openPath,{path:[this.#s(t),s.pathname,s.search].join("")}).then(n=>n?.result==="error"?n?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,c)=>{const o=window.open(e,"_blank");if(!o){c(new Error("Error open window"));return}let u=0;const d=1e3*60*5,l=window.setInterval(()=>{u=u+1,o.closed?(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!0})):u>d&&(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(n?.errorCode)):n?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}}var am=Object.defineProperty,cm=a((r,e)=>am(r,"name",{value:e,configurable:!0}),"i$2");class Wa{static{a(this,"PlacementManager")}static{cm(this,"PlacementManager")}#e;#r="";#s={};constructor(e){this.#e=e}initData(e){return this.#r=e.PLACEMENT||"DEFAULT",this.#s=Object.freeze(e.PLACEMENT_OPTIONS),this}get title(){return this.#r}get placement(){return this.#r}get isDefault(){return this.placement==="DEFAULT"}get options(){return this.#s}get isSliderMode(){return this.options?.IFRAME==="Y"}async getInterface(){return this.#e.send(ie.getInterface,{isSafely:!0})}async bindEvent(e,t){return this.#e.send(ie.placementBindEvent,{event:e,callBack:t,isSafely:!0})}async call(e,t={}){return this.#e.send(e,{...t,isSafely:!0,isRawValue:["setValue"].includes(e)})}async callCustomBind(e,t=null,s){let n={};return L.isString(t)?n.singleOption=t:L.isObjectLike(t)&&(n={...t}),this.#e.send(e,{...n,callBack:s,isSafely:!0})}}var lm=Object.defineProperty,um=a((r,e)=>lm(r,"name",{value:e,configurable:!0}),"r$3");class Ha extends Wr{static{a(this,"B24Frame")}static{um(this,"B24Frame")}#e=!1;#r=!1;#s;#t;#i;#n;#o;#c;#h;#d;#a;constructor(e,t){super(),this.#a=t?.restrictionParams,this.#s=new $a(e),this.#t=new xa(this.#s),this.#t.subscribe(),this.#i=new Ba(this.#s,this.#t),this.#n=new ja(this.#t),this.#o=new Ua(this.#t),this.#c=new Va(this.#t),this.#h=new qa(this.#s,this.#t),this.#d=new Wa(this.#t),this._isInit=!1}setLogger(e){super.setLogger(e),this.#t.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#r}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#n}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#h}get placement(){return this._ensureInitialized(),this.#d}get options(){return this._ensureInitialized(),this.#o}get dialog(){return this._ensureInitialized(),this.#c}async init(){const e=await this.#t.send(ie.getInitData,{});return this.getLogger().debug("init data",{data:e}),this.#s.initData(e),this.#i.initData(e),this.#d.initData(e),this.#o.initData(e),this.#e=e.INSTALL,this.#r=e.FIRST_RUN,this._httpV2=new rs(this.#i,this._getHttpOptions(),this.#a),this._httpV3=new ss(this.#i,this._getHttpOptions(),this.#a),this._isInit=!0,this.#r?this.#t.send(ie.setInstall,{install:!0}):Promise.resolve()}destroy(){this.#t.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#t.send(ie.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#i.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#i.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#s.getAppSid()}getLang(){return this._ensureInitialized(),this.#s.getLang()}}var hm=Object.defineProperty,dm=a((r,e)=>hm(r,"name",{value:e,configurable:!0}),"e$2");class za extends ne{static{a(this,"RefreshTokenError")}static{dm(this,"RefreshTokenError")}}var fm=Object.defineProperty,pm=a((r,e)=>fm(r,"name",{value:e,configurable:!0}),"a$8");class Ja{static{a(this,"AuthOAuthManager")}static{pm(this,"AuthOAuthManager")}#e;#r=null;#s=null;#t;#i;#n=0;#o=0;#c;#h;#d;#a;#u;#l=null;constructor(e,t){this.#t=Object.assign({},e),this.#i=Object.freeze(Object.assign({},t)),this.#c=this.#t.domain.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#h=this.#t.clientEndpoint,this.#d=this.#h.replace("/rest/",""),this.#u=this.#t.serverEndpoint.replace("/rest/",""),this.#n=this.#t.expires*1e3,this.#o=this.#t.expiresIn,this.#e=ge.create({baseURL:this.#u,headers:{"Content-Type":"application/json"}}),this.#a=new Map,this.#a.set(X.v2,`${this.#h}`),this.#a.set(X.v3,`${this.#h}/api`)}getAuthData(){return this.#n>Date.now()?{access_token:this.#t.accessToken,refresh_token:this.#t.refreshToken,expires:this.#n/1e3,expires_in:this.#o,domain:this.#c,member_id:this.#t.memberId}:!1}async refreshAuth(){try{let e;if(this.#s)e=await this.#s();else{const s=await this.#e.get("/oauth/token/",{params:{grant_type:"refresh_token",client_id:this.#i.clientId,client_secret:this.#i.clientSecret,refresh_token:this.#t.refreshToken}});if(s.data.error)throw new Error(`Token update error: ${s.data.error}`);if(s.status!==200)throw new Error(`Token update error status code: ${s.status}`);e=s.data}if(!e)throw new Error("Unable to obtain authorization update data");this.#t.accessToken=e.access_token,this.#t.refreshToken=e.refresh_token,this.#t.expires=Number.parseInt(e.expires||"0"),this.#t.expiresIn=Number.parseInt(e.expires_in||"3600"),this.#t.clientEndpoint=e.client_endpoint,this.#t.serverEndpoint=e.server_endpoint,this.#t.scope=e.scope,this.#t.status=Object.values(lt).find(s=>s===e.status)||lt.Free,this.#n=this.#t.expires*1e3;const t=this.getAuthData();return this.#r&&await this.#r({authData:t,b24OAuthParams:this.#t}),t}catch(e){if(e instanceof vn){const t={code:e?.code||0,description:e?.message||""};if(e.response&&e.response.data&&!L.isUndefined(e.response.data.error)){const s=e.response.data;s.error&&typeof s.error=="object"&&"code"in s.error?(t.code=s.error.code,t.description=s.error.message,s.error.validation&&s.error.validation.forEach(n=>{t.description+=`${n?.message||JSON.stringify(n)}`})):s.error&&typeof s.error=="string"&&(t.code=s.error,t.description=s?.error_description??t.description)}throw new za({code:String(t.code),description:t.description,status:e.response?.status||0})}else if(e instanceof Error)throw e;throw new Error(`Strange error: ${e instanceof Error?e.message:e}`,{cause:e})}}setCallbackRefreshAuth(e){this.#r=e}removeCallbackRefreshAuth(){this.#r=null}setCustomRefreshAuth(e){this.#s=e}removeCustomRefreshAuth(){this.#s=null}getUniq(e){return[e,this.#t.memberId||""].join("_")}getTargetOrigin(){return`${this.#d}`}getTargetOriginWithPath(){return this.#a}get isAdmin(){if(this.#l===null)throw new Error("isAdmin not init. You need call B24OAuth::initIsAdmin().");return this.#l}async initIsAdmin(e,t){if(this.#l=!1,e.apiVersion===X.v3){const n=await e.call("profile",{},t);if(!n.isSuccess)throw new Error(n.getErrorMessages().join(";"));n.getData().result.profile?.admin&&(this.#l=!0);return}const s=await e.call("profile",{},t);if(!s.isSuccess)throw new Error(s.getErrorMessages().join(";"));s.getData().result?.ADMIN&&(this.#l=!0)}}var gm=Object.defineProperty,mm=a((r,e)=>gm(r,"name",{value:e,configurable:!0}),"n$4");class ym extends Wr{static{a(this,"B24OAuth")}static{mm(this,"B24OAuth")}#e;constructor(e,t,s){super(),this.#e=new Ja(e,t);const n=`The B24OAuth object is intended exclusively for use on the server.
|
|
48
|
+
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new rs(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV2.setClientSideWarning(!0,n),this._httpV3=new ss(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV3.setClientSideWarning(!0,n),this._isInit=!0}async initIsAdmin(e){const t="profile";this._ensureInitialized();try{const s=nt.automaticallyObtainApiVersion(t),n=this.getHttpClient(s);return this.#e.initIsAdmin(n,e)}catch{return}}setCallbackRefreshAuth(e){this._ensureInitialized(),this.#e.setCallbackRefreshAuth(e)}removeCallbackRefreshAuth(){this._ensureInitialized(),this.#e.removeCallbackRefreshAuth()}setCustomRefreshAuth(e){this._ensureInitialized(),this.#e.setCustomRefreshAuth(e)}removeCustomRefreshAuth(){this._ensureInitialized(),this.#e.removeCustomRefreshAuth()}offClientSideWarning(){nt.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var bm=Object.defineProperty,Ga=a((r,e)=>bm(r,"name",{value:e,configurable:!0}),"t$3");class Tn extends Error{static{a(this,"UnhandledMatchError")}static{Ga(this,"UnhandledMatchError")}constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=`${new Error("for stack").stack}`}}class Gt{static{a(this,"AbstractHelper")}static{Ga(this,"AbstractHelper")}_b24;_data=null;_logger;constructor(e){this._b24=e,this._logger=ee.createNullLogger()}setLogger(e){this._logger=e}getLogger(){return this._logger}async initData(e){return Promise.reject(new Error("Rewrite this function"))}}var _m=Object.defineProperty,wm=a((r,e)=>_m(r,"name",{value:e,configurable:!0}),"t$2");class Sm extends Gt{static{a(this,"ProfileManager")}static{wm(this,"ProfileManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}var vm=Object.defineProperty,Em=a((r,e)=>vm(r,"name",{value:e,configurable:!0}),"a$4");class Om extends Gt{static{a(this,"AppManager")}static{Em(this,"AppManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return xo[this.data.status]||"Unknown status"}}var km=Object.defineProperty,Tm=a((r,e)=>km(r,"name",{value:e,configurable:!0}),"a$3");class Im extends Gt{static{a(this,"PaymentManager")}static{Tm(this,"PaymentManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}var Am=Object.defineProperty,Rm=a((r,e)=>Am(r,"name",{value:e,configurable:!0}),"t$1");class Cm extends Gt{static{a(this,"LicenseManager")}static{Rm(this,"LicenseManager")}_data=null;async initData(e){this._data=e,await this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}async makeRestrictionManagerParams(){if(!this.data?.license)return;const e=Gs.fromTariffPlan(this.data.license);this.getLogger().debug("set restriction manager params",{license:this.data.license,restrictionParams:e}),await this._b24.setRestrictionManagerParams(e)}}var Nm=Object.defineProperty,Dm=a((r,e)=>Nm(r,"name",{value:e,configurable:!0}),"g$4");class Mm extends Gt{static{a(this,"CurrencyManager")}static{Dm(this,"CurrencyManager")}async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(this.getLogger().error("Failed to load data",{error:t}),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const s=t.CURRENCY,n=this.data.currencyList.get(s);if(!(typeof n>"u"))for(const[i,c]of Object.entries(t.LANG))switch(n.lang[i]={decimals:Number.parseInt(c.DECIMALS),decPoint:c.DEC_POINT,formatString:c.FORMAT_STRING,fullName:c.FULL_NAME,isHideZero:c.HIDE_ZERO==="Y",thousandsSep:c.THOUSANDS_SEP,thousandsVariant:c.THOUSANDS_VARIANT},n.lang[i].thousandsVariant){case"N":n.lang[i].thousandsSep="";break;case"D":n.lang[i].thousandsSep=".";break;case"C":n.lang[i].thousandsSep=",";break;case"S":n.lang[i].thousandsSep=" ";break;case"B":n.lang[i].thousandsSep=" ";break;default:L.isStringFilled(n.lang[i].thousandsSep)||(n.lang[i].thousandsSep=" ");break}})}catch(t){this.getLogger().error("Failed to load data",{error:t})}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:H.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const s=this.data.currencyList.get(e);if(typeof s>"u")throw new Tn(e);let n=s.fullName;if(!(typeof t>"u")){const i=s.lang[t];L.isUndefined(i)||(n=i.fullName)}return n}getCurrencyLiteral(e,t){const s=this.data.currencyList.get(e);if(typeof s>"u")throw new Tn(e);let n=s.formatString;if(!(typeof t>"u")){const i=s.lang[t];L.isUndefined(i)||(n=i.formatString)}return n.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,s){const n=this.data.currencyList.get(t);if(typeof n>"u")throw new Tn(t);const i={formatString:n.formatString,decimals:n.decimals,decPoint:n.decPoint,thousandsSep:n.thousandsSep};L.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const c=n.lang[s];return L.isUndefined(c)||(i.formatString=c.formatString,i.decimals=c.decimals,i.decPoint=c.decPoint,i.thousandsSep=c.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",H.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}var Lm=Object.defineProperty,Pm=a((r,e)=>Lm(r,"name",{value:e,configurable:!0}),"o$2");class In extends Gt{static{a(this,"OptionsManager")}static{Pm(this,"OptionsManager")}_data;_type;static getSupportTypes(){return[ut.NotSet,ut.JsonArray,ut.JsonObject,ut.FloatVal,ut.IntegerVal,ut.BoolYN,ut.StringVal]}static prepareArrayList(e){return L.isArray(e)?e:L.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),L.isObject(e))for(const[t,s]of Object.entries(e))this.data.set(t,s)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s),!L.isArray(s)&&!L.isObject(s)&&(s=t)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}),s=t}return In.prepareArrayList(s)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}),s=t}return L.isObject(s)||(s=t),s}getFloat(e,t=0){return this.data.has(e)?H.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?H.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?H.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?H.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const s=H.toDateTime(this.data.get(e).toString());return s.isValid?s:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(s){this.getLogger().error("Failed JSON parse",{error:s})}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const s=[];return s.push({method:this.getMethodSave(),params:{options:e}}),L.isObject(t)&&s.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(s,!0)}}var Fm=Object.defineProperty,xm=a((r,e)=>Fm(r,"name",{value:e,configurable:!0}),"g$2");class Ya{static{a(this,"StorageManager")}static{xm(this,"StorageManager")}_logger;userId;siteId;constructor(e={}){this._logger=ee.createNullLogger(),this.userId=e.userId?H.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")});return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const s=window.localStorage.getItem(this._getKey(e));return s===null?t||null:JSON.parse(s)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")});return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}var $m=Object.defineProperty,Za=a((r,e)=>$m(r,"name",{value:e,configurable:!0}),"t");class Bm extends Error{static{a(this,"ErrorNotConnected")}static{Za(this,"ErrorNotConnected")}constructor(e){super(e),this.name="ErrorNotConnected"}}class jm extends Error{static{a(this,"ErrorTimeout")}static{Za(this,"ErrorTimeout")}constructor(e){super(e),this.name="ErrorTimeout"}}var Um=Object.defineProperty,Vm=a((r,e)=>Um(r,"name",{value:e,configurable:!0}),"R$1");const ns="2.0";class qm{static{a(this,"JsonRpc")}static{Vm(this,"JsonRpc")}_logger;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._logger=ee.createNullLogger(),this._connector=e.connector,L.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,s=5){return new Promise((n,i)=>{const c=this.createRequest(e,t);this._connector.send(JSON.stringify(c))||i(new Bm("websocket is not connected"));const o=setTimeout(()=>{this._rpcResponseAwaiters.delete(c.id),i(new jm("no response"))},s*1e3);this._rpcResponseAwaiters.set(c.id,{resolve:n,reject:i,timeout:o})})}executeOutgoingRpcBatch(e){const t=[],s=[];return e.forEach(({method:n,params:i,id:c})=>{const o=this.createRequest(n,i,c);t.push(o),s.push(new Promise((u,d)=>this._rpcResponseAwaiters.set(o.id,{resolve:u,reject:d})))}),this._connector.send(JSON.stringify(t)),s}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(`${H.getDateForLog()}: Pull: Received rpc response with unknown id`,{response:e})}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(s){return this.getLogger().error(`${H.getDateForLog()}: Pull: Could not decode json rpc message`,{error:s}),[]}return L.isArray(t)?this.executeIncomingRpcBatch(t):L.isJsonRpcRequest(t)?this.executeIncomingRpcCommand(t):L.isJsonRpcResponse(t)?(this.processRpcResponse(t),[]):(this.getLogger().error(`${H.getDateForLog()}: Pull: unknown rpc packet`,{decoded:t}),[])}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:ns,error:zs.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const s of e)if("jsonrpc"in s)if("method"in s){const n=this.executeIncomingRpcCommand(s);n&&(n.jsonrpc=ns,n.id=s.id,t.push(n))}else this.processRpcResponse(s);else this.getLogger().error(`${H.getDateForLog()}: Pull: unknown rpc command in batch`,{command:s}),t.push({jsonrpc:ns,error:zs.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,s){return s||(s=this.nextId()),{jsonrpc:ns,method:e,params:t,id:s}}}var Wm=Object.defineProperty,Hm=a((r,e)=>Wm(r,"name",{value:e,configurable:!0}),"g$1");class zm{static{a(this,"SharedConfig")}static{Hm(this,"SharedConfig")}_logger;_storage;_ttl=1440*60;_callbacks;constructor(e={}){this._logger=ee.createNullLogger(),e=e||{},this._storage=e.storage||new Ya,this._callbacks={onWebSocketBlockChanged:L.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Ue.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Ue.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ue.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${H.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage`,{error:t}),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Ue.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ue.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${H.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage.`,{error:t}),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Ue.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Ue.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(`${H.getDateForLog()}: LocalStorage error.`,{error:t}),!1}return!0}getTimestamp(){return Date.now()}}var Jm=Object.defineProperty,Gm=a((r,e)=>Jm(r,"name",{value:e,configurable:!0}),"l$3");class Ym{static{a(this,"ChannelManager")}static{Gm(this,"ChannelManager")}_logger;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._logger=ee.createNullLogger(),this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger}async getPublicIds(e){const t=new Date,s={},n=[];for(const i of e){const c=this._publicIds.get(i);c&&c.end>t?s[c.userId]=c:n.push(i)}return n.length===0?Promise.resolve(s):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:n}).then(c=>{const o=c.getData().result;this.setPublicIds(Object.values(o));for(const u of n){const d=this._publicIds.get(u);d&&(s[d.userId]=d)}i(s)}).catch(c=>(this.getLogger().error("some error in getPublicIds",{error:c}),i({})))})}setPublicIds(e){e.forEach(t=>{const s=Number(t.user_id);this._publicIds.set(s,{userId:s,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var yr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zm(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}a(Zm,"getDefaultExportFromCjs");var An={exports:{}},Ka;function Km(){return Ka||(Ka=1,(function(r){var e=Object.defineProperty,t=a((s,n)=>e(s,"name",{value:n,configurable:!0}),"i");/*!
|
|
49
|
+
* protobuf.js v6.8.6 (c) 2016, daniel wirtz
|
|
50
|
+
* compiled mon, 26 feb 2018 11:35:34 utc
|
|
51
|
+
* licensed under the bsd-3-clause license
|
|
52
|
+
* see: https://github.com/dcodeio/protobuf.js for details
|
|
53
|
+
*
|
|
54
|
+
* Modify a list for integration with Bitrix Framework:
|
|
55
|
+
* - removed integration with RequireJS and AMD package builders;
|
|
56
|
+
*/(function(s){t((function(n,i,c){function o(d){var l=i[d];return l||n[d][0].call(l=i[d]={exports:{}},o,l,l.exports),l.exports}a(o,"d"),t(o,"$require");var u=o(c[0]);r&&r.exports&&(r.exports=u)}),"prelude")({1:[function(n,i,c){i.exports=o;function o(u,d){for(var l=new Array(arguments.length-1),g=0,f=2,p=!0;f<arguments.length;)l[g++]=arguments[f++];return new Promise(t(function(h,m){l[g]=t(function(y){if(p)if(p=!1,y)m(y);else{for(var b=new Array(arguments.length-1),w=0;w<b.length;)b[w++]=arguments[w];h.apply(null,b)}},"callback");try{u.apply(d||null,l)}catch(y){p&&(p=!1,m(y))}},"executor"))}a(o,"l"),t(o,"asPromise")},{}],2:[function(n,i,c){var o=c;o.length=t(function(f){var p=f.length;if(!p)return 0;for(var h=0;--p%4>1&&f.charAt(p)==="=";)++h;return Math.ceil(f.length*3)/4-h},"length");for(var u=new Array(64),d=new Array(123),l=0;l<64;)d[u[l]=l<26?l+65:l<52?l+71:l<62?l-4:l-59|43]=l++;o.encode=t(function(f,p,h){for(var m=null,y=[],b=0,w=0,_;p<h;){var S=f[p++];switch(w){case 0:y[b++]=u[S>>2],_=(S&3)<<4,w=1;break;case 1:y[b++]=u[_|S>>4],_=(S&15)<<2,w=2;break;case 2:y[b++]=u[_|S>>6],y[b++]=u[S&63],w=0;break}b>8191&&((m||(m=[])).push(String.fromCharCode.apply(String,y)),b=0)}return w&&(y[b++]=u[_],y[b++]=61,w===1&&(y[b++]=61)),m?(b&&m.push(String.fromCharCode.apply(String,y.slice(0,b))),m.join("")):String.fromCharCode.apply(String,y.slice(0,b))},"encode");var g="invalid encoding";o.decode=t(function(f,p,h){for(var m=h,y=0,b,w=0;w<f.length;){var _=f.charCodeAt(w++);if(_===61&&y>1)break;if((_=d[_])===s)throw Error(g);switch(y){case 0:b=_,y=1;break;case 1:p[h++]=b<<2|(_&48)>>4,b=_,y=2;break;case 2:p[h++]=(b&15)<<4|(_&60)>>2,b=_,y=3;break;case 3:p[h++]=(b&3)<<6|_,y=0;break}}if(y===1)throw Error(g);return h-m},"decode"),o.test=t(function(f){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(f)},"test")},{}],3:[function(n,i,c){i.exports=o;function o(u,d){typeof u=="string"&&(d=u,u=s);var l=[];function g(p){if(typeof p!="string"){var h=f();if(o.verbose&&console.log("codegen: "+h),h="return "+h,p){for(var m=Object.keys(p),y=new Array(m.length+1),b=new Array(m.length),w=0;w<m.length;)y[w]=m[w],b[w]=p[m[w++]];return y[w]=h,Function.apply(null,y).apply(null,b)}return Function(h)()}for(var _=new Array(arguments.length-1),S=0;S<_.length;)_[S]=arguments[++S];if(S=0,p=p.replace(/%([%dfijs])/g,t(function(k,v){var I=_[S++];switch(v){case"d":case"f":return String(Number(I));case"i":return String(Math.floor(I));case"j":return JSON.stringify(I);case"s":return String(I)}return"%"},"replace")),S!==_.length)throw Error("parameter count mismatch");return l.push(p),g}a(g,"a"),t(g,"Codegen");function f(p){return"function "+(p||d||"")+"("+(u&&u.join(",")||"")+`){
|
|
57
|
+
`+l.join(`
|
|
22
58
|
`)+`
|
|
23
|
-
}`}return u.toString=c,u}i.verbose=!1},{}],4:[function(t,n,s){n.exports=i;function i(){this._listeners={}}i.prototype.on=function(o,l,a){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:l,ctx:a||this}),this},i.prototype.off=function(o,l){if(o===e)this._listeners={};else if(l===e)this._listeners[o]=[];else for(var a=this._listeners[o],u=0;u<a.length;)a[u].fn===l?a.splice(u,1):++u;return this},i.prototype.emit=function(o){var l=this._listeners[o];if(l){for(var a=[],u=1;u<arguments.length;)a.push(arguments[u++]);for(u=0;u<l.length;)l[u].fn.apply(l[u++].ctx,a)}return this}},{}],5:[function(t,n,s){n.exports=a;var i=t(1),o=t(7),l=o("fs");function a(u,c,f){return typeof c=="function"?(f=c,c={}):c||(c={}),f?!c.xhr&&l&&l.readFile?l.readFile(u,function(h,p){return h&&typeof XMLHttpRequest<"u"?a.xhr(u,c,f):h?f(h):f(null,c.binary?p:p.toString("utf8"))}):a.xhr(u,c,f):i(a,this,u,c)}a.xhr=function(u,c,f){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState!==4)return e;if(h.status!==0&&h.status!==200)return f(Error("status "+h.status));if(c.binary){var p=h.response;if(!p){p=[];for(var d=0;d<h.responseText.length;++d)p.push(h.responseText.charCodeAt(d)&255)}return f(null,typeof Uint8Array<"u"?new Uint8Array(p):p)}return f(null,h.responseText)},c.binary&&("overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.responseType="arraybuffer"),h.open("GET",u),h.send()}},{1:1,7:7}],6:[function(t,n,s){n.exports=i(i);function i(c){return typeof Float32Array<"u"?(function(){var f=new Float32Array([-0]),h=new Uint8Array(f.buffer),p=h[3]===128;function d(w,_,b){f[0]=w,_[b]=h[0],_[b+1]=h[1],_[b+2]=h[2],_[b+3]=h[3]}function g(w,_,b){f[0]=w,_[b]=h[3],_[b+1]=h[2],_[b+2]=h[1],_[b+3]=h[0]}c.writeFloatLE=p?d:g,c.writeFloatBE=p?g:d;function m(w,_){return h[0]=w[_],h[1]=w[_+1],h[2]=w[_+2],h[3]=w[_+3],f[0]}function y(w,_){return h[3]=w[_],h[2]=w[_+1],h[1]=w[_+2],h[0]=w[_+3],f[0]}c.readFloatLE=p?m:y,c.readFloatBE=p?y:m})():(function(){function f(p,d,g,m){var y=d<0?1:0;if(y&&(d=-d),d===0)p(1/d>0?0:2147483648,g,m);else if(isNaN(d))p(2143289344,g,m);else if(d>34028234663852886e22)p((y<<31|2139095040)>>>0,g,m);else if(d<11754943508222875e-54)p((y<<31|Math.round(d/1401298464324817e-60))>>>0,g,m);else{var w=Math.floor(Math.log(d)/Math.LN2),_=Math.round(d*Math.pow(2,-w)*8388608)&8388607;p((y<<31|w+127<<23|_)>>>0,g,m)}}c.writeFloatLE=f.bind(null,o),c.writeFloatBE=f.bind(null,l);function h(p,d,g){var m=p(d,g),y=(m>>31)*2+1,w=m>>>23&255,_=m&8388607;return w===255?_?NaN:y*(1/0):w===0?y*1401298464324817e-60*_:y*Math.pow(2,w-150)*(_+8388608)}c.readFloatLE=h.bind(null,a),c.readFloatBE=h.bind(null,u)})(),typeof Float64Array<"u"?(function(){var f=new Float64Array([-0]),h=new Uint8Array(f.buffer),p=h[7]===128;function d(w,_,b){f[0]=w,_[b]=h[0],_[b+1]=h[1],_[b+2]=h[2],_[b+3]=h[3],_[b+4]=h[4],_[b+5]=h[5],_[b+6]=h[6],_[b+7]=h[7]}function g(w,_,b){f[0]=w,_[b]=h[7],_[b+1]=h[6],_[b+2]=h[5],_[b+3]=h[4],_[b+4]=h[3],_[b+5]=h[2],_[b+6]=h[1],_[b+7]=h[0]}c.writeDoubleLE=p?d:g,c.writeDoubleBE=p?g:d;function m(w,_){return h[0]=w[_],h[1]=w[_+1],h[2]=w[_+2],h[3]=w[_+3],h[4]=w[_+4],h[5]=w[_+5],h[6]=w[_+6],h[7]=w[_+7],f[0]}function y(w,_){return h[7]=w[_],h[6]=w[_+1],h[5]=w[_+2],h[4]=w[_+3],h[3]=w[_+4],h[2]=w[_+5],h[1]=w[_+6],h[0]=w[_+7],f[0]}c.readDoubleLE=p?m:y,c.readDoubleBE=p?y:m})():(function(){function f(p,d,g,m,y,w){var _=m<0?1:0;if(_&&(m=-m),m===0)p(0,y,w+d),p(1/m>0?0:2147483648,y,w+g);else if(isNaN(m))p(0,y,w+d),p(2146959360,y,w+g);else if(m>17976931348623157e292)p(0,y,w+d),p((_<<31|2146435072)>>>0,y,w+g);else{var b;if(m<22250738585072014e-324)b=m/5e-324,p(b>>>0,y,w+d),p((_<<31|b/4294967296)>>>0,y,w+g);else{var E=Math.floor(Math.log(m)/Math.LN2);E===1024&&(E=1023),b=m*Math.pow(2,-E),p(b*4503599627370496>>>0,y,w+d),p((_<<31|E+1023<<20|b*1048576&1048575)>>>0,y,w+g)}}}c.writeDoubleLE=f.bind(null,o,0,4),c.writeDoubleBE=f.bind(null,l,4,0);function h(p,d,g,m,y){var w=p(m,y+d),_=p(m,y+g),b=(_>>31)*2+1,E=_>>>20&2047,S=4294967296*(_&1048575)+w;return E===2047?S?NaN:b*(1/0):E===0?b*5e-324*S:b*Math.pow(2,E-1075)*(S+4503599627370496)}c.readDoubleLE=h.bind(null,a,0,4),c.readDoubleBE=h.bind(null,u,4,0)})(),c}function o(c,f,h){f[h]=c&255,f[h+1]=c>>>8&255,f[h+2]=c>>>16&255,f[h+3]=c>>>24}function l(c,f,h){f[h]=c>>>24,f[h+1]=c>>>16&255,f[h+2]=c>>>8&255,f[h+3]=c&255}function a(c,f){return(c[f]|c[f+1]<<8|c[f+2]<<16|c[f+3]<<24)>>>0}function u(c,f){return(c[f]<<24|c[f+1]<<16|c[f+2]<<8|c[f+3])>>>0}},{}],7:[function(t,n,s){n.exports=i;function i(o){try{var l=t(o);if(l&&(l.length||Object.keys(l).length))return l}catch{}return null}},{}],8:[function(t,n,s){var i=s,o=i.isAbsolute=function(a){return/^(?:\/|\w+:)/.test(a)},l=i.normalize=function(a){a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var u=a.split("/"),c=o(a),f="";c&&(f=u.shift()+"/");for(var h=0;h<u.length;)u[h]===".."?h>0&&u[h-1]!==".."?u.splice(--h,2):c?u.splice(h,1):++h:u[h]==="."?u.splice(h,1):++h;return f+u.join("/")};i.resolve=function(a,u,c){return c||(u=l(u)),o(u)?u:(c||(a=l(a)),(a=a.replace(/(?:\/|^)[^/]+$/,"")).length?l(a+"/"+u):u)}},{}],9:[function(t,n,s){n.exports=i;function i(o,l,a){var u=a||8192,c=u>>>1,f=null,h=u;return function(p){if(p<1||p>c)return o(p);h+p>u&&(f=o(u),h=0);var d=l.call(f,h,h+=p);return h&7&&(h=(h|7)+1),d}}},{}],10:[function(t,n,s){var i=s;i.length=function(o){for(var l=0,a=0,u=0;u<o.length;++u)a=o.charCodeAt(u),a<128?l+=1:a<2048?l+=2:(a&64512)===55296&&(o.charCodeAt(u+1)&64512)===56320?(++u,l+=4):l+=3;return l},i.read=function(o,l,a){var u=a-l;if(u<1)return"";for(var c=null,f=[],h=0,p;l<a;)p=o[l++],p<128?f[h++]=p:p>191&&p<224?f[h++]=(p&31)<<6|o[l++]&63:p>239&&p<365?(p=((p&7)<<18|(o[l++]&63)<<12|(o[l++]&63)<<6|o[l++]&63)-65536,f[h++]=55296+(p>>10),f[h++]=56320+(p&1023)):f[h++]=(p&15)<<12|(o[l++]&63)<<6|o[l++]&63,h>8191&&((c||(c=[])).push(String.fromCharCode.apply(String,f)),h=0);return c?(h&&c.push(String.fromCharCode.apply(String,f.slice(0,h))),c.join("")):String.fromCharCode.apply(String,f.slice(0,h))},i.write=function(o,l,a){for(var u=a,c,f,h=0;h<o.length;++h)c=o.charCodeAt(h),c<128?l[a++]=c:c<2048?(l[a++]=c>>6|192,l[a++]=c&63|128):(c&64512)===55296&&((f=o.charCodeAt(h+1))&64512)===56320?(c=65536+((c&1023)<<10)+(f&1023),++h,l[a++]=c>>18|240,l[a++]=c>>12&63|128,l[a++]=c>>6&63|128,l[a++]=c&63|128):(l[a++]=c>>12|224,l[a++]=c>>6&63|128,l[a++]=c&63|128);return a-u}},{}],11:[function(t,n,s){n.exports=o;var i=/\/|\./;function o(a,u){i.test(a)||(a="google/protobuf/"+a+".proto",u={nested:{google:{nested:{protobuf:{nested:u}}}}}),o[a]=u}o("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var l;o("duration",{Duration:l={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),o("timestamp",{Timestamp:l}),o("empty",{Empty:{fields:{}}}),o("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),o("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),o("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),o.get=function(a){return o[a]||null}},{}],12:[function(t,n,s){var i=s,o=t(15),l=t(37);function a(c,f,h,p){if(f.resolvedType)if(f.resolvedType instanceof o){c("switch(d%s){",p);for(var d=f.resolvedType.values,g=Object.keys(d),m=0;m<g.length;++m)f.repeated&&d[g[m]]===f.typeDefault&&c("default:"),c("case%j:",g[m])("case %i:",d[g[m]])("m%s=%j",p,d[g[m]])("break");c("}")}else c('if(typeof d%s!=="object")',p)("throw TypeError(%j)",f.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",p,h,p);else{var y=!1;switch(f.type){case"double":case"float":c("m%s=Number(d%s)",p,p);break;case"uint32":case"fixed32":c("m%s=d%s>>>0",p,p);break;case"int32":case"sint32":case"sfixed32":c("m%s=d%s|0",p,p);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":c("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",p,p,y)('else if(typeof d%s==="string")',p)("m%s=parseInt(d%s,10)",p,p)('else if(typeof d%s==="number")',p)("m%s=d%s",p,p)('else if(typeof d%s==="object")',p)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",p,p,p,y?"true":"");break;case"bytes":c('if(typeof d%s==="string")',p)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",p,p,p)("else if(d%s.length)",p)("m%s=d%s",p,p);break;case"string":c("m%s=String(d%s)",p,p);break;case"bool":c("m%s=Boolean(d%s)",p,p);break}}return c}i.fromObject=function(c){var f=c.fieldsArray,h=l.codegen(["d"],c.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!f.length)return h("return new this.ctor");h("var m=new this.ctor");for(var p=0;p<f.length;++p){var d=f[p].resolve(),g=l.safeProp(d.name);d.map?(h("if(d%s){",g)('if(typeof d%s!=="object")',g)("throw TypeError(%j)",d.fullName+": object expected")("m%s={}",g)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",g),a(h,d,p,g+"[ks[i]]")("}")("}")):d.repeated?(h("if(d%s){",g)("if(!Array.isArray(d%s))",g)("throw TypeError(%j)",d.fullName+": array expected")("m%s=[]",g)("for(var i=0;i<d%s.length;++i){",g),a(h,d,p,g+"[i]")("}")("}")):(d.resolvedType instanceof o||h("if(d%s!=null){",g),a(h,d,p,g),d.resolvedType instanceof o||h("}"))}return h("return m")};function u(c,f,h,p){if(f.resolvedType)f.resolvedType instanceof o?c("d%s=o.enums===String?types[%i].values[m%s]:m%s",p,h,p,p):c("d%s=types[%i].toObject(m%s,o)",p,h,p);else{var d=!1;switch(f.type){case"double":case"float":c("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",p,p,p,p);break;case"uint64":d=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":c('if(typeof m%s==="number")',p)("d%s=o.longs===String?String(m%s):m%s",p,p,p)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",p,p,p,p,d?"true":"",p);break;case"bytes":c("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",p,p,p,p,p);break;default:c("d%s=m%s",p,p);break}}return c}i.toObject=function(c){var f=c.fieldsArray.slice().sort(l.compareFieldsById);if(!f.length)return l.codegen()("return {}");for(var h=l.codegen(["m","o"],c.name+"$toObject")("if(!o)")("o={}")("var d={}"),p=[],d=[],g=[],m=0;m<f.length;++m)f[m].partOf||(f[m].resolve().repeated?p:f[m].map?d:g).push(f[m]);if(p.length){for(h("if(o.arrays||o.defaults){"),m=0;m<p.length;++m)h("d%s=[]",l.safeProp(p[m].name));h("}")}if(d.length){for(h("if(o.objects||o.defaults){"),m=0;m<d.length;++m)h("d%s={}",l.safeProp(d[m].name));h("}")}if(g.length){for(h("if(o.defaults){"),m=0;m<g.length;++m){var y=g[m],w=l.safeProp(y.name);y.resolvedType instanceof o?h("d%s=o.enums===String?%j:%j",w,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?h("if(util.Long){")("var n=new util.Long(%i,%i,%j)",y.typeDefault.low,y.typeDefault.high,y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",w)("}else")("d%s=o.longs===String?%j:%i",w,y.typeDefault.toString(),y.typeDefault.toNumber()):y.bytes?h("d%s=o.bytes===String?%j:%s",w,String.fromCharCode.apply(String,y.typeDefault),"["+Array.prototype.slice.call(y.typeDefault).join(",")+"]"):h("d%s=%j",w,y.typeDefault)}h("}")}var _=!1;for(m=0;m<f.length;++m){var y=f[m],b=c._fieldsArray.indexOf(y),w=l.safeProp(y.name);y.map?(_||(_=!0,h("var ks2")),h("if(m%s&&(ks2=Object.keys(m%s)).length){",w,w)("d%s={}",w)("for(var j=0;j<ks2.length;++j){"),u(h,y,b,w+"[ks2[j]]")("}")):y.repeated?(h("if(m%s&&m%s.length){",w,w)("d%s=[]",w)("for(var j=0;j<m%s.length;++j){",w),u(h,y,b,w+"[j]")("}")):(h("if(m%s!=null&&m.hasOwnProperty(%j)){",w,y.name),u(h,y,b,w),y.partOf&&h("if(o.oneofs)")("d%s=%j",l.safeProp(y.partOf.name),y.name)),h("}")}return h("return d")}},{15:15,37:37}],13:[function(t,n,s){n.exports=u;var i=t(15),o=t(36),l=t(37);function a(c){return"missing required '"+c.name+"'"}function u(c){var f=l.codegen(["r","l"],c.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(c.fieldsArray.filter(function(y){return y.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");c.group&&f("if((t&7)===4)")("break"),f("switch(t>>>3){");for(var h=0;h<c.fieldsArray.length;++h){var p=c._fieldsArray[h].resolve(),d=p.resolvedType instanceof i?"int32":p.type,g="m"+l.safeProp(p.name);f("case %i:",p.id),p.map?(f("r.skip().pos++")("if(%s===util.emptyObject)",g)("%s={}",g)("k=r.%s()",p.keyType)("r.pos++"),o.long[p.keyType]!==e?o.basic[d]===e?f('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',g,h):f('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',g,d):o.basic[d]===e?f("%s[k]=types[%i].decode(r,r.uint32())",g,h):f("%s[k]=r.%s()",g,d)):p.repeated?(f("if(!(%s&&%s.length))",g,g)("%s=[]",g),o.packed[d]!==e&&f("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",g,d)("}else"),o.basic[d]===e?f(p.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",g,h):f("%s.push(r.%s())",g,d)):o.basic[d]===e?f(p.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",g,h):f("%s=r.%s()",g,d),f("break")}for(f("default:")("r.skipType(t&7)")("break")("}")("}"),h=0;h<c._fieldsArray.length;++h){var m=c._fieldsArray[h];m.required&&f("if(!m.hasOwnProperty(%j))",m.name)("throw util.ProtocolError(%j,{instance:m})",a(m))}return f("return m")}},{15:15,36:36,37:37}],14:[function(t,n,s){n.exports=u;var i=t(15),o=t(36),l=t(37);function a(c,f,h,p){return f.resolvedType.group?c("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",h,p,(f.id<<3|3)>>>0,(f.id<<3|4)>>>0):c("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",h,p,(f.id<<3|2)>>>0)}function u(c){for(var f=l.codegen(["m","w"],c.name+"$encode")("if(!w)")("w=Writer.create()"),d,h,p=c.fieldsArray.slice().sort(l.compareFieldsById),d=0;d<p.length;++d){var g=p[d].resolve(),m=c._fieldsArray.indexOf(g),y=g.resolvedType instanceof i?"int32":g.type,w=o.basic[y];h="m"+l.safeProp(g.name),g.map?(f("if(%s!=null&&m.hasOwnProperty(%j)){",h,g.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",h)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(g.id<<3|2)>>>0,8|o.mapKey[g.keyType],g.keyType),w===e?f("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,h):f(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|w,y,h),f("}")("}")):g.repeated?(f("if(%s!=null&&%s.length){",h,h),g.packed&&o.packed[y]!==e?f("w.uint32(%i).fork()",(g.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",h)("w.%s(%s[i])",y,h)("w.ldelim()"):(f("for(var i=0;i<%s.length;++i)",h),w===e?a(f,g,m,h+"[i]"):f("w.uint32(%i).%s(%s[i])",(g.id<<3|w)>>>0,y,h)),f("}")):(g.optional&&f("if(%s!=null&&m.hasOwnProperty(%j))",h,g.name),w===e?a(f,g,m,h):f("w.uint32(%i).%s(%s)",(g.id<<3|w)>>>0,y,h))}return f("return w")}},{15:15,36:36,37:37}],15:[function(t,n,s){n.exports=a;var i=t(24);((a.prototype=Object.create(i.prototype)).constructor=a).className="Enum";var o=t(23),l=t(37);function a(u,c,f,h,p){if(i.call(this,u,f),c&&typeof c!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=h,this.comments=p||{},this.reserved=e,c)for(var d=Object.keys(c),g=0;g<d.length;++g)typeof c[d[g]]=="number"&&(this.valuesById[this.values[d[g]]=c[d[g]]]=d[g])}a.fromJSON=function(u,c){var f=new a(u,c.values,c.options,c.comment,c.comments);return f.reserved=c.reserved,f},a.prototype.toJSON=function(u){var c=u?!!u.keepComments:!1;return l.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"comment",c?this.comment:e,"comments",c?this.comments:e])},a.prototype.add=function(u,c,f){if(!l.isString(u))throw TypeError("name must be a string");if(!l.isInteger(c))throw TypeError("id must be an integer");if(this.values[u]!==e)throw Error("duplicate name '"+u+"' in "+this);if(this.isReservedId(c))throw Error("id "+c+" is reserved in "+this);if(this.isReservedName(u))throw Error("name '"+u+"' is reserved in "+this);if(this.valuesById[c]!==e){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+c+" in "+this);this.values[u]=c}else this.valuesById[this.values[u]=c]=u;return this.comments[u]=f||null,this},a.prototype.remove=function(u){if(!l.isString(u))throw TypeError("name must be a string");var c=this.values[u];if(c==null)throw Error("name '"+u+"' does not exist in "+this);return delete this.valuesById[c],delete this.values[u],delete this.comments[u],this},a.prototype.isReservedId=function(u){return o.isReservedId(this.reserved,u)},a.prototype.isReservedName=function(u){return o.isReservedName(this.reserved,u)}},{23:23,24:24,37:37}],16:[function(t,n,s){n.exports=f;var i=t(24);((f.prototype=Object.create(i.prototype)).constructor=f).className="Field";var o=t(15),l=t(36),a=t(37),u,c=/^required|optional|repeated$/;f.fromJSON=function(h,p){return new f(h,p.id,p.type,p.rule,p.extend,p.options,p.comment)};function f(h,p,d,g,m,y,w){if(a.isObject(g)?(w=m,y=g,g=m=e):a.isObject(m)&&(w=y,y=m,m=e),i.call(this,h,y),!a.isInteger(p)||p<0)throw TypeError("id must be a non-negative integer");if(!a.isString(d))throw TypeError("type must be a string");if(g!==e&&!c.test(g=g.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(m!==e&&!a.isString(m))throw TypeError("extend must be a string");this.rule=g&&g!=="optional"?g:e,this.type=d,this.id=p,this.extend=m||e,this.required=g==="required",this.optional=!this.required,this.repeated=g==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=a.Long?l.long[d]!==e:!1,this.bytes=d==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=w}Object.defineProperty(f.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),f.prototype.setOption=function(h,p,d){return h==="packed"&&(this._packed=null),i.prototype.setOption.call(this,h,p,d)},f.prototype.toJSON=function(h){var p=h?!!h.keepComments:!1;return a.toObject(["rule",this.rule!=="optional"&&this.rule||e,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",p?this.comment:e])},f.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=l.defaults[this.type])===e&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof u?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==e&&this.resolvedType&&!(this.resolvedType instanceof o))&&delete this.options.packed,Object.keys(this.options).length||(this.options=e)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var h;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,h=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,h=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=h}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof u&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},f.d=function(h,p,d,g){return typeof p=="function"?p=a.decorateType(p).name:p&&typeof p=="object"&&(p=a.decorateEnum(p).name),function(m,y){a.decorateType(m.constructor).add(new f(y,h,p,d,{default:g}))}},f._configure=function(h){u=h}},{15:15,24:24,36:36,37:37}],17:[function(t,n,s){var i=n.exports=t(18);i.build="light";function o(a,u,c){return typeof u=="function"?(c=u,u=new i.Root):u||(u=new i.Root),u.load(a,c)}i.load=o;function l(a,u){return u||(u=new i.Root),u.loadSync(a)}i.loadSync=l,i.encoder=t(14),i.decoder=t(13),i.verifier=t(40),i.converter=t(12),i.ReflectionObject=t(24),i.Namespace=t(23),i.Root=t(29),i.Enum=t(15),i.Type=t(35),i.Field=t(16),i.OneOf=t(25),i.MapField=t(20),i.Service=t(33),i.Method=t(22),i.Message=t(21),i.wrappers=t(41),i.types=t(36),i.util=t(37),i.ReflectionObject._configure(i.Root),i.Namespace._configure(i.Type,i.Service),i.Root._configure(i.Type),i.Field._configure(i.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(t,n,s){var i=s;i.build="minimal",i.Writer=t(42),i.BufferWriter=t(43),i.Reader=t(27),i.BufferReader=t(28),i.util=t(39),i.rpc=t(31),i.roots=t(30),i.configure=o;function o(){i.Reader._configure(i.BufferReader),i.util._configure()}i.Writer._configure(i.BufferWriter),o()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(t,n,s){var i=n.exports=t(17);i.build="full",i.tokenize=t(34),i.parse=t(26),i.common=t(11),i.Root._configure(i.Type,i.parse,i.common)},{11:11,17:17,26:26,34:34}],20:[function(t,n,s){n.exports=a;var i=t(16);((a.prototype=Object.create(i.prototype)).constructor=a).className="MapField";var o=t(36),l=t(37);function a(u,c,f,h,p,d){if(i.call(this,u,c,h,e,e,p,d),!l.isString(f))throw TypeError("keyType must be a string");this.keyType=f,this.resolvedKeyType=null,this.map=!0}a.fromJSON=function(u,c){return new a(u,c.id,c.keyType,c.type,c.options,c.comment)},a.prototype.toJSON=function(u){var c=u?!!u.keepComments:!1;return l.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",c?this.comment:e])},a.prototype.resolve=function(){if(this.resolved)return this;if(o.mapKey[this.keyType]===e)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},a.d=function(u,c,f){return typeof f=="function"?f=l.decorateType(f).name:f&&typeof f=="object"&&(f=l.decorateEnum(f).name),function(h,p){l.decorateType(h.constructor).add(new a(p,u,c,f))}}},{16:16,36:36,37:37}],21:[function(t,n,s){n.exports=o;var i=t(39);function o(l){if(l)for(var a=Object.keys(l),u=0;u<a.length;++u)this[a[u]]=l[a[u]]}o.create=function(l){return this.$type.create(l)},o.encode=function(l,a){return this.$type.encode(l,a)},o.encodeDelimited=function(l,a){return this.$type.encodeDelimited(l,a)},o.decode=function(l){return this.$type.decode(l)},o.decodeDelimited=function(l){return this.$type.decodeDelimited(l)},o.verify=function(l){return this.$type.verify(l)},o.fromObject=function(l){return this.$type.fromObject(l)},o.toObject=function(l,a){return this.$type.toObject(l,a)},o.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{39:39}],22:[function(t,n,s){n.exports=l;var i=t(24);((l.prototype=Object.create(i.prototype)).constructor=l).className="Method";var o=t(37);function l(a,u,c,f,h,p,d,g){if(o.isObject(h)?(d=h,h=p=e):o.isObject(p)&&(d=p,p=e),!(u===e||o.isString(u)))throw TypeError("type must be a string");if(!o.isString(c))throw TypeError("requestType must be a string");if(!o.isString(f))throw TypeError("responseType must be a string");i.call(this,a,d),this.type=u||"rpc",this.requestType=c,this.requestStream=h?!0:e,this.responseType=f,this.responseStream=p?!0:e,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=g}l.fromJSON=function(a,u){return new l(a,u.type,u.requestType,u.responseType,u.requestStream,u.responseStream,u.options,u.comment)},l.prototype.toJSON=function(a){var u=a?!!a.keepComments:!1;return o.toObject(["type",this.type!=="rpc"&&this.type||e,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",u?this.comment:e])},l.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},{24:24,37:37}],23:[function(t,n,s){n.exports=h;var i=t(24);((h.prototype=Object.create(i.prototype)).constructor=h).className="Namespace";var o=t(15),l=t(16),a=t(37),u,c;h.fromJSON=function(d,g){return new h(d,g.options).addJSON(g.nested)};function f(d,g){if(!(d&&d.length))return e;for(var m={},y=0;y<d.length;++y)m[d[y].name]=d[y].toJSON(g);return m}h.arrayToJSON=f,h.isReservedId=function(d,g){if(d){for(var m=0;m<d.length;++m)if(typeof d[m]!="string"&&d[m][0]<=g&&d[m][1]>=g)return!0}return!1},h.isReservedName=function(d,g){if(d){for(var m=0;m<d.length;++m)if(d[m]===g)return!0}return!1};function h(d,g){i.call(this,d,g),this.nested=e,this._nestedArray=null}function p(d){return d._nestedArray=null,d}Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=a.toArray(this.nested))}}),h.prototype.toJSON=function(d){return a.toObject(["options",this.options,"nested",f(this.nestedArray,d)])},h.prototype.addJSON=function(d){var g=this;if(d)for(var m=Object.keys(d),y=0,w;y<m.length;++y)w=d[m[y]],g.add((w.fields!==e?u.fromJSON:w.values!==e?o.fromJSON:w.methods!==e?c.fromJSON:w.id!==e?l.fromJSON:h.fromJSON)(m[y],w));return this},h.prototype.get=function(d){return this.nested&&this.nested[d]||null},h.prototype.getEnum=function(d){if(this.nested&&this.nested[d]instanceof o)return this.nested[d].values;throw Error("no such enum: "+d)},h.prototype.add=function(d){if(!(d instanceof l&&d.extend!==e||d instanceof u||d instanceof o||d instanceof c||d instanceof h))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var g=this.get(d.name);if(g)if(g instanceof h&&d instanceof h&&!(g instanceof u||g instanceof c)){for(var m=g.nestedArray,y=0;y<m.length;++y)d.add(m[y]);this.remove(g),this.nested||(this.nested={}),d.setOptions(g.options,!0)}else throw Error("duplicate name '"+d.name+"' in "+this)}return this.nested[d.name]=d,d.onAdd(this),p(this)},h.prototype.remove=function(d){if(!(d instanceof i))throw TypeError("object must be a ReflectionObject");if(d.parent!==this)throw Error(d+" is not a member of "+this);return delete this.nested[d.name],Object.keys(this.nested).length||(this.nested=e),d.onRemove(this),p(this)},h.prototype.define=function(d,g){if(a.isString(d))d=d.split(".");else if(!Array.isArray(d))throw TypeError("illegal path");if(d&&d.length&&d[0]==="")throw Error("path must be relative");for(var m=this;d.length>0;){var y=d.shift();if(m.nested&&m.nested[y]){if(m=m.nested[y],!(m instanceof h))throw Error("path conflicts with non-namespace objects")}else m.add(m=new h(y))}return g&&m.addJSON(g),m},h.prototype.resolveAll=function(){for(var d=this.nestedArray,g=0;g<d.length;)d[g]instanceof h?d[g++].resolveAll():d[g++].resolve();return this.resolve()},h.prototype.lookup=function(d,g,m){if(typeof g=="boolean"?(m=g,g=e):g&&!Array.isArray(g)&&(g=[g]),a.isString(d)&&d.length){if(d===".")return this.root;d=d.split(".")}else if(!d.length)return this;if(d[0]==="")return this.root.lookup(d.slice(1),g);var y=this.get(d[0]);if(y){if(d.length===1){if(!g||g.indexOf(y.constructor)>-1)return y}else if(y instanceof h&&(y=y.lookup(d.slice(1),g,!0)))return y}else for(var w=0;w<this.nestedArray.length;++w)if(this._nestedArray[w]instanceof h&&(y=this._nestedArray[w].lookup(d,g,!0)))return y;return this.parent===null||m?null:this.parent.lookup(d,g)},h.prototype.lookupType=function(d){var g=this.lookup(d,[u]);if(!g)throw Error("no such type: "+d);return g},h.prototype.lookupEnum=function(d){var g=this.lookup(d,[o]);if(!g)throw Error("no such Enum '"+d+"' in "+this);return g},h.prototype.lookupTypeOrEnum=function(d){var g=this.lookup(d,[u,o]);if(!g)throw Error("no such Type or Enum '"+d+"' in "+this);return g},h.prototype.lookupService=function(d){var g=this.lookup(d,[c]);if(!g)throw Error("no such Service '"+d+"' in "+this);return g},h._configure=function(d,g){u=d,c=g}},{15:15,16:16,24:24,37:37}],24:[function(t,n,s){n.exports=l,l.className="ReflectionObject";var i=t(37),o;function l(a,u){if(!i.isString(a))throw TypeError("name must be a string");if(u&&!i.isObject(u))throw TypeError("options must be an object");this.options=u,this.name=a,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(l.prototype,{root:{get:function(){for(var a=this;a.parent!==null;)a=a.parent;return a}},fullName:{get:function(){for(var a=[this.name],u=this.parent;u;)a.unshift(u.name),u=u.parent;return a.join(".")}}}),l.prototype.toJSON=function(){throw Error()},l.prototype.onAdd=function(a){this.parent&&this.parent!==a&&this.parent.remove(this),this.parent=a,this.resolved=!1;var u=a.root;u instanceof o&&u._handleAdd(this)},l.prototype.onRemove=function(a){var u=a.root;u instanceof o&&u._handleRemove(this),this.parent=null,this.resolved=!1},l.prototype.resolve=function(){return this.resolved?this:(this.root instanceof o&&(this.resolved=!0),this)},l.prototype.getOption=function(a){return this.options?this.options[a]:e},l.prototype.setOption=function(a,u,c){return(!c||!this.options||this.options[a]===e)&&((this.options||(this.options={}))[a]=u),this},l.prototype.setOptions=function(a,u){if(a)for(var c=Object.keys(a),f=0;f<c.length;++f)this.setOption(c[f],a[c[f]],u);return this},l.prototype.toString=function(){var a=this.constructor.className,u=this.fullName;return u.length?a+" "+u:a},l._configure=function(a){o=a}},{37:37}],25:[function(t,n,s){n.exports=a;var i=t(24);((a.prototype=Object.create(i.prototype)).constructor=a).className="OneOf";var o=t(16),l=t(37);function a(c,f,h,p){if(Array.isArray(f)||(h=f,f=e),i.call(this,c,h),!(f===e||Array.isArray(f)))throw TypeError("fieldNames must be an Array");this.oneof=f||[],this.fieldsArray=[],this.comment=p}a.fromJSON=function(c,f){return new a(c,f.oneof,f.options,f.comment)},a.prototype.toJSON=function(c){var f=c?!!c.keepComments:!1;return l.toObject(["options",this.options,"oneof",this.oneof,"comment",f?this.comment:e])};function u(c){if(c.parent)for(var f=0;f<c.fieldsArray.length;++f)c.fieldsArray[f].parent||c.parent.add(c.fieldsArray[f])}a.prototype.add=function(c){if(!(c instanceof o))throw TypeError("field must be a Field");return c.parent&&c.parent!==this.parent&&c.parent.remove(c),this.oneof.push(c.name),this.fieldsArray.push(c),c.partOf=this,u(this),this},a.prototype.remove=function(c){if(!(c instanceof o))throw TypeError("field must be a Field");var f=this.fieldsArray.indexOf(c);if(f<0)throw Error(c+" is not a member of "+this);return this.fieldsArray.splice(f,1),f=this.oneof.indexOf(c.name),f>-1&&this.oneof.splice(f,1),c.partOf=null,this},a.prototype.onAdd=function(c){i.prototype.onAdd.call(this,c);for(var f=this,h=0;h<this.oneof.length;++h){var p=c.get(this.oneof[h]);p&&!p.partOf&&(p.partOf=f,f.fieldsArray.push(p))}u(this)},a.prototype.onRemove=function(c){for(var f=0,h;f<this.fieldsArray.length;++f)(h=this.fieldsArray[f]).parent&&h.parent.remove(h);i.prototype.onRemove.call(this,c)},a.d=function(){for(var c=new Array(arguments.length),f=0;f<arguments.length;)c[f]=arguments[f++];return function(h,p){l.decorateType(h.constructor).add(new a(p,c)),Object.defineProperty(h,p,{get:l.oneOfGetter(c),set:l.oneOfSetter(c)})}}},{16:16,24:24,37:37}],26:[function(t,n,s){n.exports=x,x.filename=null,x.defaults={keepCase:!1};var i=t(34),o=t(29),l=t(35),a=t(16),u=t(20),c=t(25),f=t(15),h=t(33),p=t(22),d=t(36),g=t(37),m=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,w=/^0[x][0-9a-fA-F]+$/,_=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,E=/^-?0[0-7]+$/,S=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,v=/^[a-zA-Z_][a-zA-Z_0-9]*$/,L=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,j=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function x(J,ue,$){ue instanceof o||($=ue,ue=new o),$||($=x.defaults);var Z=i(J,$.alternateCommentMode||!1),B=Z.next,X=Z.push,ie=Z.peek,M=Z.skip,He=Z.cmnt,st=!0,ye,q,te,re,oe=!1,Ee=ue,Ie=$.keepCase?function(A){return A}:g.camelCase;function z(A,O,P){var F=x.filename;return P||(x.filename=null),Error("illegal "+(O||"token")+" '"+A+"' ("+(F?F+", ":"")+"line "+Z.line+")")}function it(){var A=[],O;do{if((O=B())!=='"'&&O!=="'")throw z(O);A.push(B()),M(O),O=ie()}while(O==='"'||O==="'");return A.join("")}function sa(A){var O=B();switch(O){case"'":case'"':return X(O),it();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return tf(O,!0)}catch{if(L.test(O))return O;throw z(O,"value")}}function qn(A,O){var P,F;do O&&((P=ie())==='"'||P==="'")?A.push(it()):A.push([F=Ut(B()),M("to",!0)?Ut(B()):F]);while(M(",",!0));M(";")}function tf(A,O){var P=1;switch(A.charAt(0)==="-"&&(P=-1,A=A.substring(1)),A){case"inf":case"INF":case"Inf":return P*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(m.test(A))return P*parseInt(A,10);if(w.test(A))return P*parseInt(A,16);if(b.test(A))return P*parseInt(A,8);if(S.test(A))return P*parseFloat(A);throw z(A,"number",O)}function Ut(A,O){switch(A){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!O&&A.charAt(0)==="-")throw z(A,"id");if(y.test(A))return parseInt(A,10);if(_.test(A))return parseInt(A,16);if(E.test(A))return parseInt(A,8);throw z(A,"id")}function rf(){if(ye!==e)throw z("package");if(ye=B(),!L.test(ye))throw z(ye,"name");Ee=Ee.define(ye),M(";")}function nf(){var A=ie(),O;switch(A){case"weak":O=te||(te=[]),B();break;case"public":B();default:O=q||(q=[]);break}A=it(),M(";"),O.push(A)}function sf(){if(M("="),re=it(),oe=re==="proto3",!oe&&re!=="proto2")throw z(re,"syntax");M(";")}function zn(A,O){switch(O){case"option":return Ke(A,O),M(";"),!0;case"message":return of(A,O),!0;case"enum":return uf(A,O),!0;case"service":return ff(A,O),!0;case"extend":return pf(A,O),!0}return!1}function Ye(A,O,P){var F=Z.line;if(A&&(A.comment=He(),A.filename=x.filename),M("{",!0)){for(var he;(he=B())!=="}";)O(he);M(";",!0)}else P&&P(),M(";"),A&&typeof A.comment!="string"&&(A.comment=He(F))}function of(A,O){if(!v.test(O=B()))throw z(O,"type name");var P=new l(O);Ye(P,function(F){if(!zn(P,F))switch(F){case"map":lf(P);break;case"required":case"optional":case"repeated":$t(P,F);break;case"oneof":cf(P,F);break;case"extensions":qn(P.extensions||(P.extensions=[]));break;case"reserved":qn(P.reserved||(P.reserved=[]),!0);break;default:if(!oe||!L.test(F))throw z(F);X(F),$t(P,"optional");break}}),A.add(P)}function $t(A,O,P){var F=B();if(F==="group"){af(A,O);return}if(!L.test(F))throw z(F,"type");var he=B();if(!v.test(he))throw z(he,"name");he=Ie(he),M("=");var de=new a(he,Ut(B()),F,O,P);Ye(de,function(ot){if(ot==="option")Ke(de,ot),M(";");else throw z(ot)},function(){Jn(de)}),A.add(de),!oe&&de.repeated&&(d.packed[F]!==e||d.basic[F]===e)&&de.setOption("packed",!1,!0)}function af(A,O){var P=B();if(!v.test(P))throw z(P,"name");var F=g.lcFirst(P);P===F&&(P=g.ucFirst(P)),M("=");var he=Ut(B()),de=new l(P);de.group=!0;var ot=new a(F,he,P,O);ot.filename=x.filename,Ye(de,function(vt){switch(vt){case"option":Ke(de,vt),M(";");break;case"required":case"optional":case"repeated":$t(de,vt);break;default:throw z(vt)}}),A.add(de).add(ot)}function lf(A){M("<");var O=B();if(d.mapKey[O]===e)throw z(O,"type");M(",");var P=B();if(!L.test(P))throw z(P,"type");M(">");var F=B();if(!v.test(F))throw z(F,"name");M("=");var he=new u(Ie(F),Ut(B()),O,P);Ye(he,function(de){if(de==="option")Ke(he,de),M(";");else throw z(de)},function(){Jn(he)}),A.add(he)}function cf(A,O){if(!v.test(O=B()))throw z(O,"name");var P=new c(Ie(O));Ye(P,function(F){F==="option"?(Ke(P,F),M(";")):(X(F),$t(P,"optional"))}),A.add(P)}function uf(A,O){if(!v.test(O=B()))throw z(O,"name");var P=new f(O);Ye(P,function(F){switch(F){case"option":Ke(P,F),M(";");break;case"reserved":qn(P.reserved||(P.reserved=[]),!0);break;default:hf(P,F)}}),A.add(P)}function hf(A,O){if(!v.test(O))throw z(O,"name");M("=");var P=Ut(B(),!0),F={};Ye(F,function(he){if(he==="option")Ke(F,he),M(";");else throw z(he)},function(){Jn(F)}),A.add(O,P,F.comment)}function Ke(A,O){var P=M("(",!0);if(!L.test(O=B()))throw z(O,"name");var F=O;P&&(M(")"),F="("+F+")",O=ie(),j.test(O)&&(F+=O,B())),M("="),Hn(A,F)}function Hn(A,O){if(M("{",!0))do{if(!v.test(Ce=B()))throw z(Ce,"name");ie()==="{"?Hn(A,O+"."+Ce):(M(":"),ie()==="{"?Hn(A,O+"."+Ce):ia(A,O+"."+Ce,sa()))}while(!M("}",!0));else ia(A,O,sa())}function ia(A,O,P){A.setOption&&A.setOption(O,P)}function Jn(A){if(M("[",!0)){do Ke(A,"option");while(M(",",!0));M("]")}return A}function ff(A,O){if(!v.test(O=B()))throw z(O,"service name");var P=new h(O);Ye(P,function(F){if(!zn(P,F))if(F==="rpc")df(P,F);else throw z(F)}),A.add(P)}function df(A,O){var P=O;if(!v.test(O=B()))throw z(O,"name");var F=O,he,de,ot,vt;if(M("("),M("stream",!0)&&(de=!0),!L.test(O=B())||(he=O,M(")"),M("returns"),M("("),M("stream",!0)&&(vt=!0),!L.test(O=B())))throw z(O);ot=O,M(")");var Zn=new p(F,P,he,ot,de,vt);Ye(Zn,function(Gn){if(Gn==="option")Ke(Zn,Gn),M(";");else throw z(Gn)}),A.add(Zn)}function pf(A,O){if(!L.test(O=B()))throw z(O,"reference");var P=O;Ye(null,function(F){switch(F){case"required":case"repeated":case"optional":$t(A,F,P);break;default:if(!oe||!L.test(F))throw z(F);X(F),$t(A,"optional",P);break}})}for(var Ce;(Ce=B())!==null;)switch(Ce){case"package":if(!st)throw z(Ce);rf();break;case"import":if(!st)throw z(Ce);nf();break;case"syntax":if(!st)throw z(Ce);sf();break;case"option":if(!st)throw z(Ce);Ke(Ee,Ce),M(";");break;default:if(zn(Ee,Ce)){st=!1;continue}throw z(Ce)}return x.filename=null,{package:ye,imports:q,weakImports:te,syntax:re,root:ue}}},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(t,n,s){n.exports=c;var i=t(39),o,l=i.LongBits,a=i.utf8;function u(g,m){return RangeError("index out of range: "+g.pos+" + "+(m||1)+" > "+g.len)}function c(g){this.buf=g,this.pos=0,this.len=g.length}var f=typeof Uint8Array<"u"?function(g){if(g instanceof Uint8Array||Array.isArray(g))return new c(g);throw Error("illegal buffer")}:function(g){if(Array.isArray(g))return new c(g);throw Error("illegal buffer")};c.create=i.Buffer?function(g){return(c.create=function(m){return i.Buffer.isBuffer(m)?new o(m):f(m)})(g)}:f,c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(function(){var g=4294967295;return function(){if(g=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(g=(g|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(g=(g|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(g=(g|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(g=(g|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return g;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return g}})(),c.prototype.int32=function(){return this.uint32()|0},c.prototype.sint32=function(){var g=this.uint32();return g>>>1^-(g&1)|0};function h(){var g=new l(0,0),m=0;if(this.len-this.pos>4){for(;m<4;++m)if(g.lo=(g.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return g;if(g.lo=(g.lo|(this.buf[this.pos]&127)<<28)>>>0,g.hi=(g.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return g;m=0}else{for(;m<3;++m){if(this.pos>=this.len)throw u(this);if(g.lo=(g.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return g}return g.lo=(g.lo|(this.buf[this.pos++]&127)<<m*7)>>>0,g}if(this.len-this.pos>4){for(;m<5;++m)if(g.hi=(g.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return g}else for(;m<5;++m){if(this.pos>=this.len)throw u(this);if(g.hi=(g.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return g}throw Error("invalid varint encoding")}c.prototype.bool=function(){return this.uint32()!==0};function p(g,m){return(g[m-4]|g[m-3]<<8|g[m-2]<<16|g[m-1]<<24)>>>0}c.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return p(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return p(this.buf,this.pos+=4)|0};function d(){if(this.pos+8>this.len)throw u(this,8);return new l(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}c.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var g=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,g},c.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var g=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,g},c.prototype.bytes=function(){var g=this.uint32(),m=this.pos,y=this.pos+g;if(y>this.len)throw u(this,g);return this.pos+=g,Array.isArray(this.buf)?this.buf.slice(m,y):m===y?new this.buf.constructor(0):this._slice.call(this.buf,m,y)},c.prototype.string=function(){var g=this.bytes();return a.read(g,0,g.length)},c.prototype.skip=function(g){if(typeof g=="number"){if(this.pos+g>this.len)throw u(this,g);this.pos+=g}else do if(this.pos>=this.len)throw u(this);while(this.buf[this.pos++]&128);return this},c.prototype.skipType=function(g){switch(g){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((g=this.uint32()&7)===4)break;this.skipType(g)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+g+" at offset "+this.pos)}return this},c._configure=function(g){o=g;var m=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[m](!1)},uint64:function(){return h.call(this)[m](!0)},sint64:function(){return h.call(this).zzDecode()[m](!1)},fixed64:function(){return d.call(this)[m](!0)},sfixed64:function(){return d.call(this)[m](!1)}})}},{39:39}],28:[function(t,n,s){n.exports=l;var i=t(27);(l.prototype=Object.create(i.prototype)).constructor=l;var o=t(39);function l(a){i.call(this,a)}o.Buffer&&(l.prototype._slice=o.Buffer.prototype.slice),l.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len))}},{27:27,39:39}],29:[function(t,n,s){n.exports=p;var i=t(23);((p.prototype=Object.create(i.prototype)).constructor=p).className="Root";var o=t(16),l=t(15),a=t(25),u=t(37),c,f,h;function p(y){i.call(this,"",y),this.deferred=[],this.files=[]}p.fromJSON=function(y,w){return w||(w=new p),y.options&&w.setOptions(y.options),w.addJSON(y.nested)},p.prototype.resolvePath=u.path.resolve;function d(){}p.prototype.load=function y(w,_,b){typeof _=="function"&&(b=_,_=e);var E=this;if(!b)return u.asPromise(y,E,w,_);var S=b===d;function v($,Z){if(b){var B=b;if(b=null,S)throw $;B($,Z)}}function L($,Z){try{if(u.isString(Z)&&Z.charAt(0)==="{"&&(Z=JSON.parse(Z)),!u.isString(Z))E.setOptions(Z.options).addJSON(Z.nested);else{f.filename=$;var B=f(Z,E,_),X,ie=0;if(B.imports)for(;ie<B.imports.length;++ie)(X=E.resolvePath($,B.imports[ie]))&&j(X);if(B.weakImports)for(ie=0;ie<B.weakImports.length;++ie)(X=E.resolvePath($,B.weakImports[ie]))&&j(X,!0)}}catch(M){v(M)}!S&&!x&&v(null,E)}function j($,Z){var B=$.lastIndexOf("google/protobuf/");if(B>-1){var X=$.substring(B);X in h&&($=X)}if(!(E.files.indexOf($)>-1)){if(E.files.push($),$ in h){S?L($,h[$]):(++x,setTimeout(function(){--x,L($,h[$])}));return}if(S){var ie;try{ie=u.fs.readFileSync($).toString("utf8")}catch(M){Z||v(M);return}L($,ie)}else++x,u.fetch($,function(M,He){if(--x,!!b){if(M){Z?x||v(null,E):v(M);return}L($,He)}})}}var x=0;u.isString(w)&&(w=[w]);for(var J=0,ue;J<w.length;++J)(ue=E.resolvePath("",w[J]))&&j(ue);return S?E:(x||v(null,E),e)},p.prototype.loadSync=function(y,w){if(!u.isNode)throw Error("not supported");return this.load(y,w,d)},p.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(y){return"'extend "+y.extend+"' in "+y.parent.fullName}).join(", "));return i.prototype.resolveAll.call(this)};var g=/^[A-Z]/;function m(y,w){var _=w.parent.lookup(w.extend);if(_){var b=new o(w.fullName,w.id,w.type,w.rule,e,w.options);return b.declaringField=w,w.extensionField=b,_.add(b),!0}return!1}p.prototype._handleAdd=function(y){if(y instanceof o)y.extend!==e&&!y.extensionField&&(m(this,y)||this.deferred.push(y));else if(y instanceof l)g.test(y.name)&&(y.parent[y.name]=y.values);else if(!(y instanceof a)){if(y instanceof c)for(var w=0;w<this.deferred.length;)m(this,this.deferred[w])?this.deferred.splice(w,1):++w;for(var _=0;_<y.nestedArray.length;++_)this._handleAdd(y._nestedArray[_]);g.test(y.name)&&(y.parent[y.name]=y)}},p.prototype._handleRemove=function(y){if(y instanceof o){if(y.extend!==e)if(y.extensionField)y.extensionField.parent.remove(y.extensionField),y.extensionField=null;else{var w=this.deferred.indexOf(y);w>-1&&this.deferred.splice(w,1)}}else if(y instanceof l)g.test(y.name)&&delete y.parent[y.name];else if(y instanceof i){for(var _=0;_<y.nestedArray.length;++_)this._handleRemove(y._nestedArray[_]);g.test(y.name)&&delete y.parent[y.name]}},p._configure=function(y,w,_){c=y,f=w,h=_}},{15:15,16:16,23:23,25:25,37:37}],30:[function(t,n,s){n.exports={}},{}],31:[function(t,n,s){var i=s;i.Service=t(32)},{32:32}],32:[function(t,n,s){n.exports=o;var i=t(39);(o.prototype=Object.create(i.EventEmitter.prototype)).constructor=o;function o(l,a,u){if(typeof l!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=l,this.requestDelimited=!!a,this.responseDelimited=!!u}o.prototype.rpcCall=function l(a,u,c,f,h){if(!f)throw TypeError("request must be specified");var p=this;if(!h)return i.asPromise(l,p,a,u,c,f);if(!p.rpcImpl)return setTimeout(function(){h(Error("already ended"))},0),e;try{return p.rpcImpl(a,u[p.requestDelimited?"encodeDelimited":"encode"](f).finish(),function(d,g){if(d)return p.emit("error",d,a),h(d);if(g===null)return p.end(!0),e;if(!(g instanceof c))try{g=c[p.responseDelimited?"decodeDelimited":"decode"](g)}catch(m){return p.emit("error",m,a),h(m)}return p.emit("data",g,a),h(null,g)})}catch(d){return p.emit("error",d,a),setTimeout(function(){h(d)},0),e}},o.prototype.end=function(l){return this.rpcImpl&&(l||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{39:39}],33:[function(t,n,s){n.exports=u;var i=t(23);((u.prototype=Object.create(i.prototype)).constructor=u).className="Service";var o=t(22),l=t(37),a=t(31);function u(f,h){i.call(this,f,h),this.methods={},this._methodsArray=null}u.fromJSON=function(f,h){var p=new u(f,h.options);if(h.methods)for(var d=Object.keys(h.methods),g=0;g<d.length;++g)p.add(o.fromJSON(d[g],h.methods[d[g]]));return h.nested&&p.addJSON(h.nested),p.comment=h.comment,p},u.prototype.toJSON=function(f){var h=i.prototype.toJSON.call(this,f),p=f?!!f.keepComments:!1;return l.toObject(["options",h&&h.options||e,"methods",i.arrayToJSON(this.methodsArray,f)||{},"nested",h&&h.nested||e,"comment",p?this.comment:e])},Object.defineProperty(u.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=l.toArray(this.methods))}});function c(f){return f._methodsArray=null,f}u.prototype.get=function(f){return this.methods[f]||i.prototype.get.call(this,f)},u.prototype.resolveAll=function(){for(var f=this.methodsArray,h=0;h<f.length;++h)f[h].resolve();return i.prototype.resolve.call(this)},u.prototype.add=function(f){if(this.get(f.name))throw Error("duplicate name '"+f.name+"' in "+this);return f instanceof o?(this.methods[f.name]=f,f.parent=this,c(this)):i.prototype.add.call(this,f)},u.prototype.remove=function(f){if(f instanceof o){if(this.methods[f.name]!==f)throw Error(f+" is not a member of "+this);return delete this.methods[f.name],f.parent=null,c(this)}return i.prototype.remove.call(this,f)},u.prototype.create=function(f,h,p){for(var d=new a.Service(f,h,p),g=0,m;g<this.methodsArray.length;++g){var y=l.lcFirst((m=this._methodsArray[g]).resolve().name).replace(/[^$\w_]/g,"");d[y]=l.codegen(["r","c"],l.isReserved(y)?y+"_":y)("return this.rpcCall(m,q,s,r,c)")({m,q:m.resolvedRequestType.ctor,s:m.resolvedResponseType.ctor})}return d}},{22:22,23:23,31:31,37:37}],34:[function(t,n,s){n.exports=g;var i=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,l=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,a=/^ *[*/]+ */,u=/^\s*\*?\/*/,c=/\n/g,f=/\s/,h=/\\(.?)/g,p={0:"\0",r:"\r",n:`
|
|
24
|
-
`,t:" "};function
|
|
25
|
-
`){
|
|
26
|
-
`).trim()}function
|
|
27
|
-
`;)
|
|
28
|
-
`&&++
|
|
29
|
-
`;)if(
|
|
30
|
-
`&&++b,++w===_)throw J("comment");te=re,re=$(w)}while(te!=="*"||re!=="/");++w,Ee&&Z(oe,w-2),q=!0}else return"/"}}while(q);var Ie=w;i.lastIndex=0;var z=i.test($(Ie++));if(!z)for(;Ie<_&&!i.test($(Ie));)++Ie;var it=m.substring(w,w=Ie);return(it==='"'||it==="'")&&(x=it),it}function M(q){j.push(q)}function He(){if(!j.length){var q=ie();if(q===null)return null;M(q)}return j[0]}function st(q,te){var re=He(),oe=re===q;if(oe)return ie(),!0;if(!te)throw J("token '"+re+"', '"+q+"' expected");return!1}function ye(q){var te=null;return q===e?v===b-1&&(y||E==="*"||L)&&(te=S):(v<q&&He(),v===q&&!L&&(y||E==="/")&&(te=S)),te}return Object.defineProperty({next:ie,peek:He,push:M,skip:st,cmnt:ye},"line",{get:function(){return b}})}},{}],35:[function(t,n,s){n.exports=b;var i=t(23);((b.prototype=Object.create(i.prototype)).constructor=b).className="Type";var o=t(15),l=t(25),a=t(16),u=t(20),c=t(33),f=t(21),h=t(27),p=t(42),d=t(37),g=t(14),m=t(13),y=t(40),w=t(12),_=t(41);function b(S,v){i.call(this,S,v),this.fields={},this.oneofs=e,this.extensions=e,this.reserved=e,this.group=e,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(b.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var S=Object.keys(this.fields),v=0;v<S.length;++v){var L=this.fields[S[v]],j=L.id;if(this._fieldsById[j])throw Error("duplicate id "+j+" in "+this);this._fieldsById[j]=L}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=b.generateConstructor(this)())},set:function(S){var v=S.prototype;v instanceof f||((S.prototype=new f).constructor=S,d.merge(S.prototype,v)),S.$type=S.prototype.$type=this,d.merge(S,f,!0),this._ctor=S;for(var L=0;L<this.fieldsArray.length;++L)this._fieldsArray[L].resolve();var j={};for(L=0;L<this.oneofsArray.length;++L)j[this._oneofsArray[L].resolve().name]={get:d.oneOfGetter(this._oneofsArray[L].oneof),set:d.oneOfSetter(this._oneofsArray[L].oneof)};L&&Object.defineProperties(S.prototype,j)}}}),b.generateConstructor=function(S){for(var v=d.codegen(["p"],S.name),L=0,j;L<S.fieldsArray.length;++L)(j=S._fieldsArray[L]).map?v("this%s={}",d.safeProp(j.name)):j.repeated&&v("this%s=[]",d.safeProp(j.name));return v("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")};function E(S){return S._fieldsById=S._fieldsArray=S._oneofsArray=null,delete S.encode,delete S.decode,delete S.verify,S}b.fromJSON=function(S,v){var L=new b(S,v.options);L.extensions=v.extensions,L.reserved=v.reserved;for(var j=Object.keys(v.fields),x=0;x<j.length;++x)L.add((typeof v.fields[j[x]].keyType<"u"?u.fromJSON:a.fromJSON)(j[x],v.fields[j[x]]));if(v.oneofs)for(j=Object.keys(v.oneofs),x=0;x<j.length;++x)L.add(l.fromJSON(j[x],v.oneofs[j[x]]));if(v.nested)for(j=Object.keys(v.nested),x=0;x<j.length;++x){var J=v.nested[j[x]];L.add((J.id!==e?a.fromJSON:J.fields!==e?b.fromJSON:J.values!==e?o.fromJSON:J.methods!==e?c.fromJSON:i.fromJSON)(j[x],J))}return v.extensions&&v.extensions.length&&(L.extensions=v.extensions),v.reserved&&v.reserved.length&&(L.reserved=v.reserved),v.group&&(L.group=!0),v.comment&&(L.comment=v.comment),L},b.prototype.toJSON=function(S){var v=i.prototype.toJSON.call(this,S),L=S?!!S.keepComments:!1;return d.toObject(["options",v&&v.options||e,"oneofs",i.arrayToJSON(this.oneofsArray,S),"fields",i.arrayToJSON(this.fieldsArray.filter(function(j){return!j.declaringField}),S)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:e,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"group",this.group||e,"nested",v&&v.nested||e,"comment",L?this.comment:e])},b.prototype.resolveAll=function(){for(var S=this.fieldsArray,v=0;v<S.length;)S[v++].resolve();var L=this.oneofsArray;for(v=0;v<L.length;)L[v++].resolve();return i.prototype.resolveAll.call(this)},b.prototype.get=function(S){return this.fields[S]||this.oneofs&&this.oneofs[S]||this.nested&&this.nested[S]||null},b.prototype.add=function(S){if(this.get(S.name))throw Error("duplicate name '"+S.name+"' in "+this);if(S instanceof a&&S.extend===e){if(this._fieldsById?this._fieldsById[S.id]:this.fieldsById[S.id])throw Error("duplicate id "+S.id+" in "+this);if(this.isReservedId(S.id))throw Error("id "+S.id+" is reserved in "+this);if(this.isReservedName(S.name))throw Error("name '"+S.name+"' is reserved in "+this);return S.parent&&S.parent.remove(S),this.fields[S.name]=S,S.message=this,S.onAdd(this),E(this)}return S instanceof l?(this.oneofs||(this.oneofs={}),this.oneofs[S.name]=S,S.onAdd(this),E(this)):i.prototype.add.call(this,S)},b.prototype.remove=function(S){if(S instanceof a&&S.extend===e){if(!this.fields||this.fields[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.fields[S.name],S.parent=null,S.onRemove(this),E(this)}if(S instanceof l){if(!this.oneofs||this.oneofs[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.oneofs[S.name],S.parent=null,S.onRemove(this),E(this)}return i.prototype.remove.call(this,S)},b.prototype.isReservedId=function(S){return i.isReservedId(this.reserved,S)},b.prototype.isReservedName=function(S){return i.isReservedName(this.reserved,S)},b.prototype.create=function(S){return new this.ctor(S)},b.prototype.setup=function(){for(var S=this.fullName,v=[],L=0;L<this.fieldsArray.length;++L)v.push(this._fieldsArray[L].resolve().resolvedType);this.encode=g(this)({Writer:p,types:v,util:d}),this.decode=m(this)({Reader:h,types:v,util:d}),this.verify=y(this)({types:v,util:d}),this.fromObject=w.fromObject(this)({types:v,util:d}),this.toObject=w.toObject(this)({types:v,util:d});var j=_[S];if(j){var x=Object.create(this);x.fromObject=this.fromObject,this.fromObject=j.fromObject.bind(x),x.toObject=this.toObject,this.toObject=j.toObject.bind(x)}return this},b.prototype.encode=function(S,v){return this.setup().encode(S,v)},b.prototype.encodeDelimited=function(S,v){return this.encode(S,v&&v.len?v.fork():v).ldelim()},b.prototype.decode=function(S,v){return this.setup().decode(S,v)},b.prototype.decodeDelimited=function(S){return S instanceof h||(S=h.create(S)),this.decode(S,S.uint32())},b.prototype.verify=function(S){return this.setup().verify(S)},b.prototype.fromObject=function(S){return this.setup().fromObject(S)},b.prototype.toObject=function(S,v){return this.setup().toObject(S,v)},b.d=function(S){return function(v){d.decorateType(v,S)}}},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(t,n,s){var i=s,o=t(37),l=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function a(u,c){var f=0,h={};for(c|=0;f<u.length;)h[l[f+c]]=u[f++];return h}i.basic=a([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=a([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",o.emptyArray,null]),i.long=a([0,0,0,1,1],7),i.mapKey=a([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=a([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(t,n,s){var i=n.exports=t(39),o=t(30),l,a;i.codegen=t(3),i.fetch=t(5),i.path=t(8),i.fs=i.inquire("fs"),i.toArray=function(p){if(p){for(var d=Object.keys(p),g=new Array(d.length),m=0;m<d.length;)g[m]=p[d[m++]];return g}return[]},i.toObject=function(p){for(var d={},g=0;g<p.length;){var m=p[g++],y=p[g++];y!==e&&(d[m]=y)}return d};var u=/\\/g,c=/"/g;i.isReserved=function(p){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(p)},i.safeProp=function(p){return!/^[$\w_]+$/.test(p)||i.isReserved(p)?'["'+p.replace(u,"\\\\").replace(c,'\\"')+'"]':"."+p},i.ucFirst=function(p){return p.charAt(0).toUpperCase()+p.substring(1)};var f=/_([a-z])/g;i.camelCase=function(p){return p.substring(0,1)+p.substring(1).replace(f,function(d,g){return g.toUpperCase()})},i.compareFieldsById=function(p,d){return p.id-d.id},i.decorateType=function(p,d){if(p.$type)return d&&p.$type.name!==d&&(i.decorateRoot.remove(p.$type),p.$type.name=d,i.decorateRoot.add(p.$type)),p.$type;l||(l=t(35));var g=new l(d||p.name);return i.decorateRoot.add(g),g.ctor=p,Object.defineProperty(p,"$type",{value:g,enumerable:!1}),Object.defineProperty(p.prototype,"$type",{value:g,enumerable:!1}),g};var h=0;i.decorateEnum=function(p){if(p.$type)return p.$type;a||(a=t(15));var d=new a("Enum"+h++,p);return i.decorateRoot.add(d),Object.defineProperty(p,"$type",{value:d,enumerable:!1}),d},Object.defineProperty(i,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(t(29)))}})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(t,n,s){n.exports=o;var i=t(39);function o(c,f){this.lo=c>>>0,this.hi=f>>>0}var l=o.zero=new o(0,0);l.toNumber=function(){return 0},l.zzEncode=l.zzDecode=function(){return this},l.length=function(){return 1};var a=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(c){if(c===0)return l;var f=c<0;f&&(c=-c);var h=c>>>0,p=(c-h)/4294967296>>>0;return f&&(p=~p>>>0,h=~h>>>0,++h>4294967295&&(h=0,++p>4294967295&&(p=0))),new o(h,p)},o.from=function(c){if(typeof c=="number")return o.fromNumber(c);if(i.isString(c))if(i.Long)c=i.Long.fromString(c);else return o.fromNumber(parseInt(c,10));return c.low||c.high?new o(c.low>>>0,c.high>>>0):l},o.prototype.toNumber=function(c){if(!c&&this.hi>>>31){var f=~this.lo+1>>>0,h=~this.hi>>>0;return f||(h=h+1>>>0),-(f+h*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(c){return i.Long?new i.Long(this.lo|0,this.hi|0,!!c):{low:this.lo|0,high:this.hi|0,unsigned:!!c}};var u=String.prototype.charCodeAt;o.fromHash=function(c){return c===a?l:new o((u.call(c,0)|u.call(c,1)<<8|u.call(c,2)<<16|u.call(c,3)<<24)>>>0,(u.call(c,4)|u.call(c,5)<<8|u.call(c,6)<<16|u.call(c,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var c=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^c)>>>0,this.lo=(this.lo<<1^c)>>>0,this},o.prototype.zzDecode=function(){var c=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^c)>>>0,this.hi=(this.hi>>>1^c)>>>0,this},o.prototype.length=function(){var c=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,h=this.hi>>>24;return h===0?f===0?c<16384?c<128?1:2:c<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:h<128?9:10}},{39:39}],39:[function(t,n,s){var i=s;i.asPromise=t(1),i.base64=t(2),i.EventEmitter=t(4),i.float=t(6),i.inquire=t(7),i.utf8=t(10),i.pool=t(9),i.LongBits=t(38),i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isNode=!!(sr.process&&sr.process.versions&&sr.process.versions.node),i.isInteger=Number.isInteger||function(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a},i.isString=function(a){return typeof a=="string"||a instanceof String},i.isObject=function(a){return a&&typeof a=="object"},i.isset=i.isSet=function(a,u){var c=a[u];return c!=null&&a.hasOwnProperty(u)?typeof c!="object"||(Array.isArray(c)?c.length:Object.keys(c).length)>0:!1},i.Buffer=(function(){try{var a=i.inquire("buffer").Buffer;return a.prototype.utf8Write?a:null}catch{return null}})(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(a){return typeof a=="number"?i.Buffer?i._Buffer_allocUnsafe(a):new i.Array(a):i.Buffer?i._Buffer_from(a):typeof Uint8Array>"u"?a:new Uint8Array(a)},i.Array=typeof Uint8Array<"u"?Uint8Array:Array,i.Long=sr.dcodeIO&&sr.dcodeIO.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(a){return a?i.LongBits.from(a).toHash():i.LongBits.zeroHash},i.longFromHash=function(a,u){var c=i.LongBits.fromHash(a);return i.Long?i.Long.fromBits(c.lo,c.hi,u):c.toNumber(!!u)};function o(a,u,c){for(var f=Object.keys(u),h=0;h<f.length;++h)(a[f[h]]===e||!c)&&(a[f[h]]=u[f[h]]);return a}i.merge=o,i.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function l(a){function u(c,f){if(!(this instanceof u))return new u(c,f);Object.defineProperty(this,"message",{get:function(){return c}}),Error.captureStackTrace?Error.captureStackTrace(this,u):Object.defineProperty(this,"stack",{value:new Error().stack||""}),f&&o(this,f)}return(u.prototype=Object.create(Error.prototype)).constructor=u,Object.defineProperty(u.prototype,"name",{get:function(){return a}}),u.prototype.toString=function(){return this.name+": "+this.message},u}i.newError=l,i.ProtocolError=l("ProtocolError"),i.oneOfGetter=function(a){for(var u={},c=0;c<a.length;++c)u[a[c]]=1;return function(){for(var f=Object.keys(this),h=f.length-1;h>-1;--h)if(u[f[h]]===1&&this[f[h]]!==e&&this[f[h]]!==null)return f[h]}},i.oneOfSetter=function(a){return function(u){for(var c=0;c<a.length;++c)a[c]!==u&&delete this[a[c]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var a=i.Buffer;if(!a){i._Buffer_from=i._Buffer_allocUnsafe=null;return}i._Buffer_from=a.from!==Uint8Array.from&&a.from||function(u,c){return new a(u,c)},i._Buffer_allocUnsafe=a.allocUnsafe||function(u){return new a(u)}}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(t,n,s){n.exports=c;var i=t(15),o=t(37);function l(f,h){return f.name+": "+h+(f.repeated&&h!=="array"?"[]":f.map&&h!=="object"?"{k:"+f.keyType+"}":"")+" expected"}function a(f,h,p,d){if(h.resolvedType)if(h.resolvedType instanceof i){f("switch(%s){",d)("default:")("return%j",l(h,"enum value"));for(var g=Object.keys(h.resolvedType.values),m=0;m<g.length;++m)f("case %i:",h.resolvedType.values[g[m]]);f("break")("}")}else f("{")("var e=types[%i].verify(%s);",p,d)("if(e)")("return%j+e",h.name+".")("}");else switch(h.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.isInteger(%s))",d)("return%j",l(h,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",d,d,d,d)("return%j",l(h,"integer|Long"));break;case"float":case"double":f('if(typeof %s!=="number")',d)("return%j",l(h,"number"));break;case"bool":f('if(typeof %s!=="boolean")',d)("return%j",l(h,"boolean"));break;case"string":f("if(!util.isString(%s))",d)("return%j",l(h,"string"));break;case"bytes":f('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',d,d,d)("return%j",l(h,"buffer"));break}return f}function u(f,h,p){switch(h.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.key32Re.test(%s))",p)("return%j",l(h,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.key64Re.test(%s))",p)("return%j",l(h,"integer|Long key"));break;case"bool":f("if(!util.key2Re.test(%s))",p)("return%j",l(h,"boolean key"));break}return f}function c(f){var h=o.codegen(["m"],f.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),p=f.oneofsArray,d={};p.length&&h("var p={}");for(var g=0;g<f.fieldsArray.length;++g){var m=f._fieldsArray[g].resolve(),y="m"+o.safeProp(m.name);if(m.optional&&h("if(%s!=null&&m.hasOwnProperty(%j)){",y,m.name),m.map)h("if(!util.isObject(%s))",y)("return%j",l(m,"object"))("var k=Object.keys(%s)",y)("for(var i=0;i<k.length;++i){"),u(h,m,"k[i]"),a(h,m,g,y+"[k[i]]")("}");else if(m.repeated)h("if(!Array.isArray(%s))",y)("return%j",l(m,"array"))("for(var i=0;i<%s.length;++i){",y),a(h,m,g,y+"[i]")("}");else{if(m.partOf){var w=o.safeProp(m.partOf.name);d[m.partOf.name]===1&&h("if(p%s===1)",w)("return%j",m.partOf.name+": multiple values"),d[m.partOf.name]=1,h("p%s=1",w)}a(h,m,g,y)}m.optional&&h("}")}return h("return null")}},{15:15,37:37}],41:[function(t,n,s){var i=s,o=t(21);i[".google.protobuf.Any"]={fromObject:function(l){if(l&&l["@type"]){var a=this.lookup(l["@type"]);if(a){var u=l["@type"].charAt(0)==="."?l["@type"].substr(1):l["@type"];return this.create({type_url:"/"+u,value:a.encode(a.fromObject(l)).finish()})}}return this.fromObject(l)},toObject:function(l,a){if(a&&a.json&&l.type_url&&l.value){var u=l.type_url.substring(l.type_url.lastIndexOf("/")+1),c=this.lookup(u);c&&(l=c.decode(l.value))}if(!(l instanceof this.ctor)&&l instanceof o){var f=l.$type.toObject(l,a);return f["@type"]=l.$type.fullName,f}return this.toObject(l,a)}}},{21:21}],42:[function(t,n,s){n.exports=p;var i=t(39),o,l=i.LongBits,a=i.base64,u=i.utf8;function c(b,E,S){this.fn=b,this.len=E,this.next=e,this.val=S}function f(){}function h(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function p(){this.len=0,this.head=new c(f,0,0),this.tail=this.head,this.states=null}p.create=i.Buffer?function(){return(p.create=function(){return new o})()}:function(){return new p},p.alloc=function(b){return new i.Array(b)},i.Array!==Array&&(p.alloc=i.pool(p.alloc,i.Array.prototype.subarray)),p.prototype._push=function(b,E,S){return this.tail=this.tail.next=new c(b,E,S),this.len+=E,this};function d(b,E,S){E[S]=b&255}function g(b,E,S){for(;b>127;)E[S++]=b&127|128,b>>>=7;E[S]=b}function m(b,E){this.len=b,this.next=e,this.val=E}m.prototype=Object.create(c.prototype),m.prototype.fn=g,p.prototype.uint32=function(b){return this.len+=(this.tail=this.tail.next=new m((b=b>>>0)<128?1:b<16384?2:b<2097152?3:b<268435456?4:5,b)).len,this},p.prototype.int32=function(b){return b<0?this._push(y,10,l.fromNumber(b)):this.uint32(b)},p.prototype.sint32=function(b){return this.uint32((b<<1^b>>31)>>>0)};function y(b,E,S){for(;b.hi;)E[S++]=b.lo&127|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)E[S++]=b.lo&127|128,b.lo=b.lo>>>7;E[S++]=b.lo}p.prototype.uint64=function(b){var E=l.from(b);return this._push(y,E.length(),E)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(b){var E=l.from(b).zzEncode();return this._push(y,E.length(),E)},p.prototype.bool=function(b){return this._push(d,1,b?1:0)};function w(b,E,S){E[S]=b&255,E[S+1]=b>>>8&255,E[S+2]=b>>>16&255,E[S+3]=b>>>24}p.prototype.fixed32=function(b){return this._push(w,4,b>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(b){var E=l.from(b);return this._push(w,4,E.lo)._push(w,4,E.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(b){return this._push(i.float.writeFloatLE,4,b)},p.prototype.double=function(b){return this._push(i.float.writeDoubleLE,8,b)};var _=i.Array.prototype.set?function(b,E,S){E.set(b,S)}:function(b,E,S){for(var v=0;v<b.length;++v)E[S+v]=b[v]};p.prototype.bytes=function(b){var E=b.length>>>0;if(!E)return this._push(d,1,0);if(i.isString(b)){var S=p.alloc(E=a.length(b));a.decode(b,S,0),b=S}return this.uint32(E)._push(_,E,b)},p.prototype.string=function(b){var E=u.length(b);return E?this.uint32(E)._push(u.write,E,b):this._push(d,1,0)},p.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new c(f,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(f,0,0),this.len=0),this},p.prototype.ldelim=function(){var b=this.head,E=this.tail,S=this.len;return this.reset().uint32(S),S&&(this.tail.next=b.next,this.tail=E,this.len+=S),this},p.prototype.finish=function(){for(var b=this.head.next,E=this.constructor.alloc(this.len),S=0;b;)b.fn(b.val,E,S),S+=b.len,b=b.next;return E},p._configure=function(b){o=b}},{39:39}],43:[function(t,n,s){n.exports=a;var i=t(42);(a.prototype=Object.create(i.prototype)).constructor=a;var o=t(39),l=o.Buffer;function a(){i.call(this)}a.alloc=function(f){return(a.alloc=o._Buffer_allocUnsafe)(f)};var u=l&&l.prototype instanceof Uint8Array&&l.prototype.set.name==="set"?function(f,h,p){h.set(f,p)}:function(f,h,p){if(f.copy)f.copy(h,p,0,f.length);else for(var d=0;d<f.length;)h[p++]=f[d++]};a.prototype.bytes=function(f){o.isString(f)&&(f=o._Buffer_from(f,"base64"));var h=f.length>>>0;return this.uint32(h),h&&this._push(u,h,f),this};function c(f,h,p){f.length<40?o.utf8.write(f,h,p):h.utf8Write(f,p)}a.prototype.string=function(f){var h=l.byteLength(f);return this.uint32(h),h&&this._push(c,h,f),this}},{39:39,42:42}]},{},[19])})()})(Vn)),Vn.exports}var Bh=jh();const ir=xh(Bh);let Y=ir.Reader,ve=ir.Writer,ge=ir.util;const D=ir.roots["push-server"]||(ir.roots["push-server"]={});D.RequestBatch=(function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.requests=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.requests!=null&&e.requests.length)for(var n=0;n<e.requests.length;++n)D.Request.encode(e.requests[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.RequestBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.requests&&s.requests.length||(s.requests=[]),s.requests.push(D.Request.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),D.Request=(function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:ge.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:ge.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ve.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&D.IncomingMessagesRequest.encode(t.incomingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&D.ChannelStatsRequest.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&D.ServerStatsRequest.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof Y||(t=Y.create(t));for(var s=n===void 0?t.len:t.pos+n,i=new D.Request;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.incomingMessages=D.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=D.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=D.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r})(),D.IncomingMessagesRequest=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)D.IncomingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.IncomingMessagesRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(D.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),D.IncomingMessage=(function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.receivers=ge.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.receivers!=null&&e.receivers.length)for(var n=0;n<e.receivers.length;++n)D.Receiver.encode(e.receivers[n],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&D.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.IncomingMessage;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.receivers&&s.receivers.length||(s.receivers=[]),s.receivers.push(D.Receiver.decode(e,e.uint32()));break;case 2:s.sender=D.Sender.decode(e,e.uint32());break;case 3:s.body=e.string();break;case 4:s.expiry=e.uint32();break;case 5:s.type=e.string();break;default:e.skipType(i&7);break}}return s},r})(),D.ChannelStatsRequest=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)D.ChannelId.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.ChannelStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(D.ChannelId.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),D.ChannelId=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=ge.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.ChannelId;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.signature=e.bytes();break;default:e.skipType(i&7);break}}return s},r})(),D.ServerStatsRequest=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.ServerStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return s},r})(),D.Sender=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.type=0,r.prototype.id=ge.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.Sender;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.type=e.int32();break;case 2:s.id=e.bytes();break;default:e.skipType(i&7);break}}return s},r})(),D.SenderType=(function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e})(),D.Receiver=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=ge.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.Receiver;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.signature=e.bytes();break;default:e.skipType(i&7);break}}return s},r})(),D.ResponseBatch=(function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.responses=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.responses!=null&&e.responses.length)for(var n=0;n<e.responses.length;++n)D.Response.encode(e.responses[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.ResponseBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.responses&&s.responses.length||(s.responses=[]),s.responses.push(D.Response.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),D.Response=(function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:ge.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:ge.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ve.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&D.OutgoingMessagesResponse.encode(t.outgoingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&D.ChannelStatsResponse.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&D.JsonResponse.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof Y||(t=Y.create(t));for(var s=n===void 0?t.len:t.pos+n,i=new D.Response;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.outgoingMessages=D.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=D.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=D.JsonResponse.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r})(),D.OutgoingMessagesResponse=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)D.OutgoingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.OutgoingMessagesResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(D.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),D.OutgoingMessage=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&D.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.OutgoingMessage;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.body=e.string();break;case 3:s.expiry=e.uint32();break;case 4:s.created=e.fixed32();break;case 5:s.sender=D.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return s},r})(),D.ChannelStatsResponse=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)D.ChannelStats.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.ChannelStatsResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(D.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),D.ChannelStats=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.ChannelStats;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.isOnline=e.bool();break;default:e.skipType(i&7);break}}return s},r})(),D.JsonResponse=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.json="",r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},r.decode=function(e,t){e instanceof Y||(e=Y.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new D.JsonResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.json=e.string();break;default:e.skipType(i&7);break}}return s},r})();const Uh=D.ResponseBatch,Ho=D.RequestBatch,$h=D.IncomingMessage,Jo=D.Receiver;class Zo{_logger=null;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._parent=e.parent,this._connectionType=se.Undefined,this._callbacks={onOpen:C.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:C.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:C.isFunction(e.onError)?e.onError:()=>{},onMessage:C.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}class Wh extends Zo{_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=se.WebSocket,this._socket=null,this._onSocketOpenHandler=this._onSocketOpen.bind(this),this._onSocketCloseHandler=this._onSocketClose.bind(this),this._onSocketErrorHandler=this._onSocketError.bind(this),this._onSocketMessageHandler=this._onSocketMessage.bind(this)}destroy(){super.destroy(),this._socket&&(this._socket.close(),this._socket=null)}connect(){if(this._socket){if(this._socket.readyState===1)return;this.clearEventListener(),this._socket.close(),this._socket=null}this._createSocket()}get socket(){return this._socket}disconnect(e,t){this._socket!==null&&(this.clearEventListener(),this._socket.close(e,t)),this._socket=null,this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}send(e){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: WebSocket is not connected`)),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}const Vh=60;class qh extends Zo{_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=se.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=this.createXhr(),this._requestAborted=!1}connect(){this._active=!0,this.performRequest()}disconnect(e,t){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}performRequest(){if(this._active){if(!this.connectionPath)throw new Error("Long polling connection path is not defined");this._xhr.readyState!==0&&this._xhr.readyState!==4||(this.clearTimeOut(),this._failureTimeout=setTimeout(()=>{this.connected=!0},5e3),this._requestTimeout=setTimeout(this.onRequestTimeout.bind(this),Vh*1e3),this._xhr.open("GET",this.connectionPath),this._xhr.send())}}onRequestTimeout(){this._requestAborted=!0,this._xhr.abort(),this.performRequest()}onXhrReadyStateChange(){this._xhr.readyState===4&&((!this._requestAborted||this._xhr.status==200)&&this.onResponse(this._xhr.response),this._requestAborted=!1)}send(e){const t=this._parent.getPublicationPath();if(!t)return this.getLogger().error(new Error(`${V.getDateForLog()}: Pull: publication path is empty`)),!1;const n=new XMLHttpRequest;return n.open("POST",t),n.send(e),!0}onResponse(e){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,C.isStringFilled(e)||e instanceof ArrayBuffer?this._callbacks.onMessage(e):this._parent.session.mid=null,this.performRequest();else if(this._xhr.status===304){if(this.connected=!0,this._xhr.getResponseHeader("Expires")==="Thu, 01 Jan 1973 11:11:01 GMT"){const t=this._xhr.getResponseHeader("Last-Message-Id");C.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}const or=19,Go=1800,zh=5e3,Hh=60*1e3,Yo=10,Ko=10,Jh="ping",Zh="pong",Qo="bx-pull-session",Gh=20,Xo={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class ea{_logger=null;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=se.WebSocket;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[se.Undefined]:null,[se.WebSocket]:null,[se.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._restClient=e.b24,this._status=Le.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),C.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?V.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?V.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?V.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=C.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=C.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=C.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,C.isUndefined(e.configTimestamp)||(this._configTimestamp=V.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new qo({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new Mh({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new Fh({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){this.stop(_e.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new Wh({parent:this,onOpen:this.onWebSocketOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onWebSocketDisconnect.bind(this),onError:this.onWebSocketError.bind(this)}),this._connectors.longPolling=new qh({parent:this,onOpen:this.onLongPollingOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onLongPollingDisconnect.bind(this),onError:this.onLongPollingError.bind(this)}),this._connectionType=this.isWebSocketAllowed()?se.WebSocket:se.LongPolling,window.addEventListener("beforeunload",this.onBeforeUnload.bind(this)),window.addEventListener("offline",this.onOffline.bind(this)),window.addEventListener("online",this.onOnline.bind(this)),this._jsonRpcAdapter=new Dh({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}})}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===Le.Offline?this.sendPullStatusDelayed(e,zh):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!C.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||Pe.Server,e.command=e.command||null,e.type==Pe.Server||e.type==Pe.Client){if(typeof e.moduleId>"u")throw new TypeError(`${V.getDateForLog()}: Pull.subscribe: parameter moduleId is not specified`);return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),e.command?(typeof this._subscribers[e.type][e.moduleId].commands[e.command]>"u"&&(this._subscribers[e.type][e.moduleId].commands[e.command]=[]),this._subscribers[e.type][e.moduleId].commands[e.command].push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||typeof e.command>"u"||e.command===null||(this._subscribers[e.type][e.moduleId].commands[e.command]=this._subscribers[e.type][e.moduleId].commands[e.command].filter(t=>t!==e.callback))}):(this._subscribers[e.type][e.moduleId].callbacks.push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||(this._subscribers[e.type][e.moduleId].callbacks=this._subscribers[e.type][e.moduleId].callbacks.filter(t=>t!==e.callback))})}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].push(e.callback),()=>{typeof e.type>"u"||(this._subscribers[e.type]=this._subscribers[e.type].filter(t=>t!==e.callback))}}attachCommandHandler(e){if(typeof e.getModuleId!="function"||typeof e.getModuleId()!="string")return this.getLogger().error(`${V.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=Pe.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:n=>{let s=null;if(typeof e.getMap=="function"){const i=e.getMap();if(i&&typeof i=="object"){const o=i[n.command];typeof o=="function"?s=o.bind(e):typeof o=="string"&&typeof e[o]=="function"&&(s=e[o].bind(e))}}if(!s){const i=`handle${V.capitalize(n.command)}`;typeof e[i]=="function"&&(s=e[i].bind(e))}s&&(this._debug&&this._context!=="master"&&this.getLogger().warn(`${V.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,n),s(n.params,n.extra,n.command))}})}async start(e=null){let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let n=!1;if(e&&C.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(n=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const s=Date.now();let i;return!n&&this._storage&&(i=this._storage.get(Qo,null)),C.isPlainObject(i)&&i.hasOwnProperty("ttl")&&i.ttl>=s&&(this._session.mid=i.mid),this._starting=!0,this._startingPromise=new Promise((o,l)=>{this.loadConfig("client_start").then(a=>{this.setConfig(a,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>o(!0),u=>l(u))}).catch(a=>{this._starting=!1,this.status=Le.Offline,this.stopCheckConfig(),this.getLogger().error(`${V.getDateForLog()}: Pull: could not read push-server config `,a),l(a)})})}restart(e=_e.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().log(`${V.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(Re.PullConfig),this._config=null;const n=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(n).then(s=>{this.setConfig(s,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error(i)})},s=>{this.getLogger().error(`${V.getDateForLog()}: Pull: could not read push-server config `,s),this.status=Le.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(s?.status==401||s?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=_e.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,n=1){this.disconnect(e,t),this.scheduleReconnect(n)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,n,s,i){const o={userList:e,body:{module_id:t,command:n,params:s},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.Publish,o):this.sendMessageBatch([o])}async sendMessageToChannels(e,t,n,s,i){const o={channelList:e,body:{module_id:t,command:n,params:s},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.Publish,o):this.sendMessageBatch([o])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!C.isArray(e)||!e.every(n=>typeof n=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((n,s)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.GetUsersLastSeen,{userList:e}).then(i=>{const o=[];for(let a=0;a<e.length;a++)i.hasOwnProperty(e[a])||o.push(e[a]);if(o.length===0)return n(t);const l={userIds:o,sendToQueueSever:!0};this._restClient.callMethod("pull.api.user.getLastSeen",l).then(a=>{const u=a.getData().result;for(const c in u)t[Number(c)]=Number(u[c]);return n(t)}).catch(a=>{this.getLogger().error(a),s(a)})}).catch(i=>{this.getLogger().error(i),s(i)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((n,s)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),C.isFunction(t)&&this._userStatusCallbacks[e].push(t),n())).catch(i=>s(i))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(n=>n!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text"),{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const n={};switch(e){case se.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case se.LongPolling:t=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${e}`)}if(!C.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")n.token=this._config?.jwt;else{const s=[];if(this._config?.channels?.private&&s.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&s.push(this._config.channels.private.id),this._config?.channels.shared?.id&&s.push(this._config.channels.shared.id),s.length===0)throw new Error("Empty channels");n.CHANNEL_ID=s.join("/")}if(this.isJsonRpc()?n.jsonRpc="true":this.isProtobufSupported()&&(n.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");n.clientId=this._config.clientId}return this._session.mid&&(n.mid=this._session.mid),this._session.tag&&(n.tag=this._session.tag),this._session.time&&(n.time=this._session.time),n.revision=or,`${t}?${V.buildQueryString(n)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const n={CHANNEL_ID:t.join("/")};return e+"?"+V.buildQueryString(n)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!Ci.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===bn.Shared}emit(e){if(e.type==Pe.Server||e.type==Pe.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${V.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),n=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=Math.max(e.extra.server_time_ago,0)),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Er.Client?(this.onCustomEvent("onPullClientEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,n,e.params,e.extra],!0),this.emit({type:Pe.Client,moduleId:t,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(n,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[n,e.params,e.extra],!0),this.emit({type:Pe.Online,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}})),n==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,n,e.params,e.extra],!0),this.emit({type:Pe.Server,moduleId:t,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}}))}catch(s){this.getLogger().warn(`
|
|
31
|
-
========= PULL ERROR ===========
|
|
32
|
-
Error type: broadcastMessages execute error
|
|
33
|
-
Error event: `,s,`
|
|
34
|
-
Message: `,e,`
|
|
35
|
-
================================
|
|
36
|
-
`)}e.extra&&e.extra.revision_web&&this.checkRevision(V.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled"),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const n of e)if(typeof n.userList<"u")for(const s of n.userList){const i=Number(s);t[i]=i}this._channelManager?.getPublicIds(Object.values(t)).then(n=>{const s=this.connector?.send(this.encodeMessageBatch(e,n));return Promise.resolve(s)})}}encodeMessageBatch(e,t){const n=[];e.forEach(i=>{const o=i.body;let l=[];if(i.userList&&(l=this.createMessageReceivers(i.userList,t)),i.channelList){if(!C.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(u=>{let c,f;if(typeof u=="string"&&u.includes(".")){const h=u.toString().split(".");c=h[0],f=h[1]}else if(typeof u=="object"&&"publicId"in u&&"signature"in u)c=u?.publicId,f=u?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);l.push(Jo.create({id:this.encodeId(c),signature:this.encodeId(f)}))})}const a=$h.create({receivers:l,body:JSON.stringify(o),expiry:i.expiry||0});n.push(a)});const s=Ho.create({requests:[{incomingMessages:{messages:n}}]});return Ho.encode(s).finish()}createMessageReceivers(e,t){const n=[];for(const s of e){if(!t[s]||!t[s].publicId)throw new Error(`Could not determine public id for user ${s}`);n.push(Jo.create({id:this.encodeId(t[s].publicId),signature:this.encodeId(t[s].signature)}))}return n}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const n of this._userStatusCallbacks[e])n({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)this._userStatusCallbacks.hasOwnProperty(e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(Je.SubscribeStatusChange,{userId:e})}async loadConfig(e){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},Xo)}else{this._config=Object.assign({},Xo);let t;if(this._storage&&(t=this._storage.get(Re.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(Re.PullConfig)}return new Promise((t,n)=>{this._restClient.getHttpClient().setLogTag(e),this._restClient.callMethod(this._configGetMethod,{CACHE:"N"}).then(s=>{const i=s.getData().result,o=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const l=Object.assign({},i);l.server.timeShift=o,t(l)}).catch(s=>{(s?.answerError?.error==="AUTHORIZE_ERROR"||s?.answerError?.error==="WRONG_AUTH_TYPE")&&(s.status=403),n(s)}).finally(()=>{this._restClient.getHttpClient().clearLogTag()})})}isConfigActual(e){if(!C.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(C.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const n in e.channels){if(!e.channels.hasOwnProperty(n))continue;const s=e.channels[n];if(new Date(s.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),Hh)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(V.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(_e.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const n in e)e.hasOwnProperty(n)&&this._config?.hasOwnProperty(n)&&(this._config[n]=e[n]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(Re.PullConfig,e)}catch(n){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${V.getDateForLog()}: Pull: Could not cache config in local storage. Error: `,n)}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==or?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(_e.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,or]),this.emit({type:Pe.Revision,data:{server:e,client:or}}),this.logToConsole(`Pull revision changed from ${or} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==se.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._enabled&&(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(t=>{this.getLogger().error(t)})},e*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${Go} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=null,this.restoreWebSocketConnection()},Go*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=Le.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,n=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),n<1&&(n=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),n*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&C.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&C.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const n of e)this.updateSessionFromEvent(n),!(n.mid&&!this.checkDuplicate(n.mid))&&(this.addMessageToStat(n.text),t.push(n.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case Qt.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const n=t.params?.channel.type;n==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.private}`)),n==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(_e.CONFIG_REPLACED,"config was replaced")}else this.restart(_e.CHANNEL_EXPIRED,"channel expired received");break}case Qt.CONFIG_EXPIRE:{this.restart(_e.CONFIG_EXPIRED,"config expired received");break}case Qt.SERVER_RESTART:{this.reconnect(_e.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===Jh?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Le.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===se.LongPolling&&(this.status=Le.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===se.LongPolling&&(this.status=Le.Offline),this.getLogger().error(`${V.getDateForLog()}: Pull: Long polling connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===se.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=se.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===se.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=se.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Le.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==se.LongPolling&&(this._connectionType=se.WebSocket,this._connectors.longPolling?.disconnect(_e.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===se.WebSocket&&(this.status=Le.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==_e.WRONG_CHANNEL_ID?this.scheduleRestart(_e.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===se.WebSocket&&(this.status=Le.Offline),this.getLogger().error(`${V.getDateForLog()}: Pull: WebSocket connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(C.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const n=Uh.decode(new Uint8Array(e));for(let s=0;s<n.responses.length;s++){const i=n.responses[s];if(i.command!=="outgoingMessages")continue;const o=i.outgoingMessages.messages;for(const l of o){let a;try{a=JSON.parse(l.body)}catch(c){this.getLogger().error(`${V.getDateForLog()}: Pull: Could not parse message body `,c);continue}a.extra||(a.extra={}),a.extra.sender={type:l.sender.type},l.sender.id instanceof Uint8Array&&(a.extra.sender.id=this.decodeId(l.sender.id));const u={mid:this.decodeId(l.id),text:a};t.push(u)}}}catch(n){this.getLogger().error(`${V.getDateForLog()}: Pull: Could not parse message `,n)}return t}extractPlainTextMessages(e){const t=[],n=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/gm);if(n===null){const s=`
|
|
37
|
-
========= PULL ERROR ===========
|
|
38
|
-
Error type: parseResponse error parsing message
|
|
39
|
-
|
|
40
|
-
Data string: ${e}
|
|
41
|
-
================================
|
|
42
|
-
|
|
43
|
-
`;return this.getLogger().warn(s),[]}for(let s=0;s<n.length;s++){if(n[s]=n[s].substring(12,n[s].length-12),n[s].length<=0)continue;let i;try{i=JSON.parse(n[s])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const n of e){const s=n.toString(16);s.length===1&&(t+="0"),t+=s}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(_e.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error(e)})}onBeforeUnload(){this._unloading=!0;const e=C.clone(this.session);if(e.ttl=Date.now()+Gh*1e3,this._storage)try{this._storage.set(Qo,JSON.stringify(e))}catch(t){this.getLogger().error(`${V.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,t)}this.scheduleReconnect(15)}sendPullStatusDelayed(e,t){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:Pe.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.callMethod("pull.watch.extend",{tags:t}).then(n=>{const s=n.getData().result;for(const i of s)this.clearWatch(i);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(Zh)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,Ko*2*1e3)}clearPingWaitTimeout(){this._pingWaitTimeout&&clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null}onPingTimeout(){this._pingWaitTimeout=null,!(!this._enabled||!this.isConnected())&&(this.getLogger().warn(`No pings are received in ${Ko*2} seconds. Reconnecting`),this.disconnect(_e.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warn(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>Yo&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-Yo))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Er.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,e.command,e.params,e.extra):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",e.command,e.params,e.extra):this.getLogger().info("onPullEvent",e.module_id,e.command,e.params,e.extra))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().log(`${V.getDateForLog()}: ${e}`)}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().warn(e)}onCustomEvent(e,t,n=!1){}}class Yh{_b24;_logger=null;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";constructor(e){this._b24=e,this.setLogger(this._b24.getLogger())}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=we.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){this._destroyPullClient()}async loadData(e=[ne.App,ne.Profile]){const t={[ne.App]:{method:"app.info"},[ne.Profile]:{method:"profile"},[ne.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[ne.AppOptions]:{method:"app.option.get"},[ne.UserOptions]:{method:"user.option.get"}},n=e.reduce((s,i)=>{if(t[i])if(Array.isArray(t[i]))for(const[o,l]of t[i].entries())s[`get_${i}_${o}`]=l;else s[`get_${i}`]=t[i];return s},{});try{const s=(await this._b24.callBatch(n)).getData();s[`get_${ne.App}`]&&(this._app=await this.parseAppData(s[`get_${ne.App}`]),this._payment=await this.parsePaymentData(s[`get_${ne.App}`]),this._license=await this.parseLicenseData(s[`get_${ne.App}`])),s[`get_${ne.Profile}`]&&(this._profile=await this.parseUserData(s[`get_${ne.Profile}`])),s[`get_${ne.Currency}_0`]&&s[`get_${ne.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:s[`get_${ne.Currency}_0`],currencyList:s[`get_${ne.Currency}_1`]})),s[`get_${ne.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",s[`get_${ne.AppOptions}`])),s[`get_${ne.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",s[`get_${ne.UserOptions}`])),this._isInit=!0}catch(s){throw s instanceof Error?s:(console.error("Error loading data:",s),new Error("Failed to load data"))}}async parseUserData(e){const t=new Ah(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number(e.ID),isAdmin:e.ADMIN===!0,lastName:e?.LAST_NAME||"",name:e?.NAME||"",gender:e?.PERSONAL_GENDER||"",photo:e?.PERSONAL_PHOTO||"",TimeZone:e?.TIME_ZONE||"",TimeZoneOffset:e?.TIME_ZONE_OFFSET}).then(()=>t)}async parseAppData(e){const t=new Ih(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number.parseInt(e.ID),code:e.CODE,version:Number.parseInt(e.VERSION),status:e.STATUS,isInstalled:e.INSTALLED}).then(()=>t)}async parsePaymentData(e){const t=new Ch(this._b24);return t.setLogger(this.getLogger()),t.initData({isExpired:e.PAYMENT_EXPIRED==="Y",days:Number.parseInt(e.DAYS||"0")}).then(()=>t)}async parseLicenseData(e){const t=new Nh(this._b24);return t.setLogger(this.getLogger()),t.initData({languageId:e.LANGUAGE_ID,license:e.LICENSE,licensePrevious:e.LICENSE_PREVIOUS,licenseType:e.LICENSE_TYPE,licenseFamily:e.LICENSE_FAMILY,isSelfHosted:e.LICENSE.includes("selfhosted")}).then(()=>t)}async parseCurrencyData(e){const t=new Rh(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const n=new Wn(this._b24,e);return n.setLogger(this.getLogger()),n.initData(t).then(()=>n)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[yt.MainSettings]:"/configs/",[yt.UfList]:"/configs/userfield_list.php",[yt.UfPage]:"/configs/userfield.php"}:{[yt.MainSettings]:"/settings/configs/",[yt.UfList]:"/settings/configs/userfield_list.php",[yt.UfPage]:"/settings/configs/userfield.php"}}usePullClient(e="prefix",t){return this._b24PullClient?this:(this.initializePullClient(typeof t>"u"?this.profileInfo.data.id||0:t,e),this)}initializePullClient(e,t="prefix"){this._b24PullClient=new ea({b24:this._b24,restApplication:this._b24.auth.getUniq(t),userId:e})}subscribePullClient(e,t="application"){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId=t,this._pullClientUnSubscribe.push(this._b24PullClient.subscribe({moduleId:this._pullClientModuleId,callback:e})),this}startPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");this._b24PullClient.start().catch(e=>{this.getLogger().error(`${V.getDateForLog()}: Pull not running`,e)})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}const Kh=()=>{let r=!1,e=!1,t=null;return{initB24Helper:async(n,s=[ne.App,ne.Profile])=>(t===null&&(t=new Yh(n)),r?t:t.loadData(s).then(()=>(r=!0,t))),isInitB24Helper:()=>r,destroyB24Helper:()=>{t?.destroy(),t=null,r=!1,e=!1},getB24Helper:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return t},usePullClient:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");t.usePullClient(),e=!0},useSubscribePullClient:(n,s="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(n,s)},startPullClient:()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()}}},Qh=50;let ht=null,Br=!1,Bt=null,ta=!1,Ur=[],ra=!1;function na(){window.setTimeout(()=>{if(!Br||ht===null){na();return}Xh(),Ur=[]},Qh)}function Xh(){if(Bt!==null)for(const r of Ur)r.reject(Bt);if(!(!Br||ht===null))for(const r of Ur)r.resolve(ht)}async function ef(){return Br&&ht!==null?Promise.resolve(ht):ta?(ra||(ra=!0,na()),new Promise((r,e)=>{Ur.push({resolve:r,reject:e})})):(ta=!0,new Promise((r,e)=>{const t={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,s,i]=window.name.split("|");t.DOMAIN=n,t.PROTOCOL=Number.parseInt(s)===1,t.APP_SID=i,t.LANG=null}(!t.DOMAIN||!t.APP_SID)&&(Bt=new Error("Unable to initialize Bitrix24Frame library!"),e(Bt)),ht=new Wo(t),ht.init().then(()=>{Br=!0,r(ht)}).catch(n=>{Bt=n,e(Bt)})}))}R.AbstractB24=kt,R.AjaxError=xe,R.AjaxResult=Tr,R.AppFrame=Mo,R.AuthHookManager=Po,R.AuthManager=Fo,R.AuthOAuthManager=Vo,R.B24Frame=Wo,R.B24Hook=Un,R.B24LangList=Bn,R.B24LocaleMap=_h,R.B24OAuth=Oh,R.B24PullClientManager=ea,R.Browser=Ci,R.CatalogProductImageType=Di,R.CatalogProductType=Pi,R.CatalogRoundingRuleType=Mi,R.CloseReasons=_e,R.ConnectionType=se,R.DataType=Yn,R.DialogManager=Bo,R.EnumAppStatus=et,R.EnumBitrix24Edition=Fi,R.EnumBizprocBaseType=xi,R.EnumBizprocDocumentType=ji,R.EnumCrmEntityType=Ri,R.EnumCrmEntityTypeId=Ve,R.EnumCrmEntityTypeShort=yn,R.ListRpcError=Sn,R.LoadDataType=ne,R.LoggerBrowser=we,R.LoggerType=I,R.LsKeys=Re,R.MessageCommands=ee,R.MessageManager=Do,R.OptionsManager=jo,R.ParentManager=xo,R.PlacementManager=$o,R.ProductRowDiscountTypeId=Li,R.PullStatus=Le,R.RestrictionManagerParamsBase=Ni,R.RestrictionManagerParamsForEnterprise=mn,R.Result=qe,R.RpcMethod=Je,R.SenderType=Er,R.ServerMode=bn,R.SliderManager=Uo,R.StatusDescriptions=Bi,R.SubscriptionType=Pe,R.SystemCommands=Qt,R.Text=V,R.Type=C,R.TypeOption=tt,R.TypeSpecificUrl=yt,R.convertBizprocDocumentTypeToCrmEntityTypeId=wc,R.getDocumentId=bc,R.getDocumentType=wn,R.getDocumentTypeForFilter=Sc,R.getEnumCrmEntityTypeShort=yc,R.getEnumValue=ha,R.initializeB24Frame=ef,R.isArrayOfArray=ua,R.omit=Kn,R.pick=ca,R.useB24Helper=Kh,R.useFormatter=Eh}));
|
|
59
|
+
}`}return a(f,"s"),t(f,"toString"),g.toString=f,g}a(o,"l"),t(o,"codegen"),o.verbose=!1},{}],4:[function(n,i,c){i.exports=o;function o(){this._listeners={}}a(o,"l"),t(o,"EventEmitter"),o.prototype.on=t(function(u,d,l){return(this._listeners[u]||(this._listeners[u]=[])).push({fn:d,ctx:l||this}),this},"on"),o.prototype.off=t(function(u,d){if(u===s)this._listeners={};else if(d===s)this._listeners[u]=[];else for(var l=this._listeners[u],g=0;g<l.length;)l[g].fn===d?l.splice(g,1):++g;return this},"off"),o.prototype.emit=t(function(u){var d=this._listeners[u];if(d){for(var l=[],g=1;g<arguments.length;)l.push(arguments[g++]);for(g=0;g<d.length;)d[g].fn.apply(d[g++].ctx,l)}return this},"emit")},{}],5:[function(n,i,c){i.exports=l;var o=n(1),u=n(7),d=u("fs");function l(g,f,p){return typeof f=="function"?(p=f,f={}):f||(f={}),p?!f.xhr&&d&&d.readFile?d.readFile(g,t(function(h,m){return h&&typeof XMLHttpRequest<"u"?l.xhr(g,f,p):h?p(h):p(null,f.binary?m:m.toString("utf8"))},"fetchReadFileCallback")):l.xhr(g,f,p):o(l,this,g,f)}a(l,"u"),t(l,"fetch"),l.xhr=t(function(g,f,p){var h=new XMLHttpRequest;h.onreadystatechange=t(function(){if(h.readyState!==4)return s;if(h.status!==0&&h.status!==200)return p(Error("status "+h.status));if(f.binary){var m=h.response;if(!m){m=[];for(var y=0;y<h.responseText.length;++y)m.push(h.responseText.charCodeAt(y)&255)}return p(null,typeof Uint8Array<"u"?new Uint8Array(m):m)}return p(null,h.responseText)},"fetchOnReadyStateChange"),f.binary&&("overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.responseType="arraybuffer"),h.open("GET",g),h.send()},"fetch_xhr")},{1:1,7:7}],6:[function(n,i,c){i.exports=o(o);function o(f){return typeof Float32Array<"u"?(function(){var p=new Float32Array([-0]),h=new Uint8Array(p.buffer),m=h[3]===128;function y(S,k,v){p[0]=S,k[v]=h[0],k[v+1]=h[1],k[v+2]=h[2],k[v+3]=h[3]}a(y,"f"),t(y,"writeFloat_f32_cpy");function b(S,k,v){p[0]=S,k[v]=h[3],k[v+1]=h[2],k[v+2]=h[1],k[v+3]=h[0]}a(b,"n"),t(b,"writeFloat_f32_rev"),f.writeFloatLE=m?y:b,f.writeFloatBE=m?b:y;function w(S,k){return h[0]=S[k],h[1]=S[k+1],h[2]=S[k+2],h[3]=S[k+3],p[0]}a(w,"o"),t(w,"readFloat_f32_cpy");function _(S,k){return h[3]=S[k],h[2]=S[k+1],h[1]=S[k+2],h[0]=S[k+3],p[0]}a(_,"p"),t(_,"readFloat_f32_rev"),f.readFloatLE=m?w:_,f.readFloatBE=m?_:w})():(function(){function p(m,y,b,w){var _=y<0?1:0;if(_&&(y=-y),y===0)m(1/y>0?0:2147483648,b,w);else if(isNaN(y))m(2143289344,b,w);else if(y>34028234663852886e22)m((_<<31|2139095040)>>>0,b,w);else if(y<11754943508222875e-54)m((_<<31|Math.round(y/1401298464324817e-60))>>>0,b,w);else{var S=Math.floor(Math.log(y)/Math.LN2),k=Math.round(y*Math.pow(2,-S)*8388608)&8388607;m((_<<31|S+127<<23|k)>>>0,b,w)}}a(p,"t"),t(p,"writeFloat_ieee754"),f.writeFloatLE=p.bind(null,u),f.writeFloatBE=p.bind(null,d);function h(m,y,b){var w=m(y,b),_=(w>>31)*2+1,S=w>>>23&255,k=w&8388607;return S===255?k?NaN:_*(1/0):S===0?_*1401298464324817e-60*k:_*Math.pow(2,S-150)*(k+8388608)}a(h,"r"),t(h,"readFloat_ieee754"),f.readFloatLE=h.bind(null,l),f.readFloatBE=h.bind(null,g)})(),typeof Float64Array<"u"?(function(){var p=new Float64Array([-0]),h=new Uint8Array(p.buffer),m=h[7]===128;function y(S,k,v){p[0]=S,k[v]=h[0],k[v+1]=h[1],k[v+2]=h[2],k[v+3]=h[3],k[v+4]=h[4],k[v+5]=h[5],k[v+6]=h[6],k[v+7]=h[7]}a(y,"f"),t(y,"writeDouble_f64_cpy");function b(S,k,v){p[0]=S,k[v]=h[7],k[v+1]=h[6],k[v+2]=h[5],k[v+3]=h[4],k[v+4]=h[3],k[v+5]=h[2],k[v+6]=h[1],k[v+7]=h[0]}a(b,"n"),t(b,"writeDouble_f64_rev"),f.writeDoubleLE=m?y:b,f.writeDoubleBE=m?b:y;function w(S,k){return h[0]=S[k],h[1]=S[k+1],h[2]=S[k+2],h[3]=S[k+3],h[4]=S[k+4],h[5]=S[k+5],h[6]=S[k+6],h[7]=S[k+7],p[0]}a(w,"o"),t(w,"readDouble_f64_cpy");function _(S,k){return h[7]=S[k],h[6]=S[k+1],h[5]=S[k+2],h[4]=S[k+3],h[3]=S[k+4],h[2]=S[k+5],h[1]=S[k+6],h[0]=S[k+7],p[0]}a(_,"p"),t(_,"readDouble_f64_rev"),f.readDoubleLE=m?w:_,f.readDoubleBE=m?_:w})():(function(){function p(m,y,b,w,_,S){var k=w<0?1:0;if(k&&(w=-w),w===0)m(0,_,S+y),m(1/w>0?0:2147483648,_,S+b);else if(isNaN(w))m(0,_,S+y),m(2146959360,_,S+b);else if(w>17976931348623157e292)m(0,_,S+y),m((k<<31|2146435072)>>>0,_,S+b);else{var v;if(w<22250738585072014e-324)v=w/5e-324,m(v>>>0,_,S+y),m((k<<31|v/4294967296)>>>0,_,S+b);else{var I=Math.floor(Math.log(w)/Math.LN2);I===1024&&(I=1023),v=w*Math.pow(2,-I),m(v*4503599627370496>>>0,_,S+y),m((k<<31|I+1023<<20|v*1048576&1048575)>>>0,_,S+b)}}}a(p,"t"),t(p,"writeDouble_ieee754"),f.writeDoubleLE=p.bind(null,u,0,4),f.writeDoubleBE=p.bind(null,d,4,0);function h(m,y,b,w,_){var S=m(w,_+y),k=m(w,_+b),v=(k>>31)*2+1,I=k>>>20&2047,E=4294967296*(k&1048575)+S;return I===2047?E?NaN:v*(1/0):I===0?v*5e-324*E:v*Math.pow(2,I-1075)*(E+4503599627370496)}a(h,"r"),t(h,"readDouble_ieee754"),f.readDoubleLE=h.bind(null,l,0,4),f.readDoubleBE=h.bind(null,g,4,0)})(),f}a(o,"l"),t(o,"factory");function u(f,p,h){p[h]=f&255,p[h+1]=f>>>8&255,p[h+2]=f>>>16&255,p[h+3]=f>>>24}a(u,"d"),t(u,"writeUintLE");function d(f,p,h){p[h]=f>>>24,p[h+1]=f>>>16&255,p[h+2]=f>>>8&255,p[h+3]=f&255}a(d,"c"),t(d,"writeUintBE");function l(f,p){return(f[p]|f[p+1]<<8|f[p+2]<<16|f[p+3]<<24)>>>0}a(l,"u"),t(l,"readUintLE");function g(f,p){return(f[p]<<24|f[p+1]<<16|f[p+2]<<8|f[p+3])>>>0}a(g,"a"),t(g,"readUintBE")},{}],7:[function(n,i,c){i.exports=o;function o(u){try{var d=n(u);if(d&&(d.length||Object.keys(d).length))return d}catch{}return null}a(o,"l"),t(o,"inquire")},{}],8:[function(n,i,c){var o=c,u=o.isAbsolute=t(function(l){return/^(?:\/|\w+:)/.test(l)},"isAbsolute"),d=o.normalize=t(function(l){l=l.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var g=l.split("/"),f=u(l),p="";f&&(p=g.shift()+"/");for(var h=0;h<g.length;)g[h]===".."?h>0&&g[h-1]!==".."?g.splice(--h,2):f?g.splice(h,1):++h:g[h]==="."?g.splice(h,1):++h;return p+g.join("/")},"normalize");o.resolve=t(function(l,g,f){return f||(g=d(g)),u(g)?g:(f||(l=d(l)),(l=l.replace(/(?:\/|^)[^/]+$/,"")).length?d(l+"/"+g):g)},"resolve")},{}],9:[function(n,i,c){i.exports=o;function o(u,d,l){var g=l||8192,f=g>>>1,p=null,h=g;return t(function(m){if(m<1||m>f)return u(m);h+m>g&&(p=u(g),h=0);var y=d.call(p,h,h+=m);return h&7&&(h=(h|7)+1),y},"pool_alloc")}a(o,"l"),t(o,"pool")},{}],10:[function(n,i,c){var o=c;o.length=t(function(u){for(var d=0,l=0,g=0;g<u.length;++g)l=u.charCodeAt(g),l<128?d+=1:l<2048?d+=2:(l&64512)===55296&&(u.charCodeAt(g+1)&64512)===56320?(++g,d+=4):d+=3;return d},"utf8_length"),o.read=t(function(u,d,l){var g=l-d;if(g<1)return"";for(var f=null,p=[],h=0,m;d<l;)m=u[d++],m<128?p[h++]=m:m>191&&m<224?p[h++]=(m&31)<<6|u[d++]&63:m>239&&m<365?(m=((m&7)<<18|(u[d++]&63)<<12|(u[d++]&63)<<6|u[d++]&63)-65536,p[h++]=55296+(m>>10),p[h++]=56320+(m&1023)):p[h++]=(m&15)<<12|(u[d++]&63)<<6|u[d++]&63,h>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,p)),h=0);return f?(h&&f.push(String.fromCharCode.apply(String,p.slice(0,h))),f.join("")):String.fromCharCode.apply(String,p.slice(0,h))},"utf8_read"),o.write=t(function(u,d,l){for(var g=l,f,p,h=0;h<u.length;++h)f=u.charCodeAt(h),f<128?d[l++]=f:f<2048?(d[l++]=f>>6|192,d[l++]=f&63|128):(f&64512)===55296&&((p=u.charCodeAt(h+1))&64512)===56320?(f=65536+((f&1023)<<10)+(p&1023),++h,d[l++]=f>>18|240,d[l++]=f>>12&63|128,d[l++]=f>>6&63|128,d[l++]=f&63|128):(d[l++]=f>>12|224,d[l++]=f>>6&63|128,d[l++]=f&63|128);return l-g},"utf8_write")},{}],11:[function(n,i,c){i.exports=u;var o=/\/|\./;function u(l,g){o.test(l)||(l="google/protobuf/"+l+".proto",g={nested:{google:{nested:{protobuf:{nested:g}}}}}),u[l]=g}a(u,"d"),t(u,"common"),u("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var d;u("duration",{Duration:d={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),u("timestamp",{Timestamp:d}),u("empty",{Empty:{fields:{}}}),u("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),u("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),u("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),u.get=t(function(l){return u[l]||null},"get")},{}],12:[function(n,i,c){var o=c,u=n(15),d=n(37);function l(f,p,h,m){if(p.resolvedType)if(p.resolvedType instanceof u){f("switch(d%s){",m);for(var y=p.resolvedType.values,b=Object.keys(y),w=0;w<b.length;++w)p.repeated&&y[b[w]]===p.typeDefault&&f("default:"),f("case%j:",b[w])("case %i:",y[b[w]])("m%s=%j",m,y[b[w]])("break");f("}")}else f('if(typeof d%s!=="object")',m)("throw TypeError(%j)",p.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",m,h,m);else{var _=!1;switch(p.type){case"double":case"float":f("m%s=Number(d%s)",m,m);break;case"uint32":case"fixed32":f("m%s=d%s>>>0",m,m);break;case"int32":case"sint32":case"sfixed32":f("m%s=d%s|0",m,m);break;case"uint64":_=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":f("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",m,m,_)('else if(typeof d%s==="string")',m)("m%s=parseInt(d%s,10)",m,m)('else if(typeof d%s==="number")',m)("m%s=d%s",m,m)('else if(typeof d%s==="object")',m)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",m,m,m,_?"true":"");break;case"bytes":f('if(typeof d%s==="string")',m)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",m,m,m)("else if(d%s.length)",m)("m%s=d%s",m,m);break;case"string":f("m%s=String(d%s)",m,m);break;case"bool":f("m%s=Boolean(d%s)",m,m);break}}return f}a(l,"u"),t(l,"genValuePartial_fromObject"),o.fromObject=t(function(f){var p=f.fieldsArray,h=d.codegen(["d"],f.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!p.length)return h("return new this.ctor");h("var m=new this.ctor");for(var m=0;m<p.length;++m){var y=p[m].resolve(),b=d.safeProp(y.name);y.map?(h("if(d%s){",b)('if(typeof d%s!=="object")',b)("throw TypeError(%j)",y.fullName+": object expected")("m%s={}",b)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",b),l(h,y,m,b+"[ks[i]]")("}")("}")):y.repeated?(h("if(d%s){",b)("if(!Array.isArray(d%s))",b)("throw TypeError(%j)",y.fullName+": array expected")("m%s=[]",b)("for(var i=0;i<d%s.length;++i){",b),l(h,y,m,b+"[i]")("}")("}")):(y.resolvedType instanceof u||h("if(d%s!=null){",b),l(h,y,m,b),y.resolvedType instanceof u||h("}"))}return h("return m")},"fromObject");function g(f,p,h,m){if(p.resolvedType)p.resolvedType instanceof u?f("d%s=o.enums===String?types[%i].values[m%s]:m%s",m,h,m,m):f("d%s=types[%i].toObject(m%s,o)",m,h,m);else{var y=!1;switch(p.type){case"double":case"float":f("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",m,m,m,m);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":f('if(typeof m%s==="number")',m)("d%s=o.longs===String?String(m%s):m%s",m,m,m)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",m,m,m,m,y?"true":"",m);break;case"bytes":f("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",m,m,m,m,m);break;default:f("d%s=m%s",m,m);break}}return f}a(g,"a"),t(g,"genValuePartial_toObject"),o.toObject=t(function(f){var p=f.fieldsArray.slice().sort(d.compareFieldsById);if(!p.length)return d.codegen()("return {}");for(var h=d.codegen(["m","o"],f.name+"$toObject")("if(!o)")("o={}")("var d={}"),m=[],y=[],b=[],w=0;w<p.length;++w)p[w].partOf||(p[w].resolve().repeated?m:p[w].map?y:b).push(p[w]);if(m.length){for(h("if(o.arrays||o.defaults){"),w=0;w<m.length;++w)h("d%s=[]",d.safeProp(m[w].name));h("}")}if(y.length){for(h("if(o.objects||o.defaults){"),w=0;w<y.length;++w)h("d%s={}",d.safeProp(y[w].name));h("}")}if(b.length){for(h("if(o.defaults){"),w=0;w<b.length;++w){var _=b[w],S=d.safeProp(_.name);_.resolvedType instanceof u?h("d%s=o.enums===String?%j:%j",S,_.resolvedType.valuesById[_.typeDefault],_.typeDefault):_.long?h("if(util.Long){")("var n=new util.Long(%i,%i,%j)",_.typeDefault.low,_.typeDefault.high,_.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",S)("}else")("d%s=o.longs===String?%j:%i",S,_.typeDefault.toString(),_.typeDefault.toNumber()):_.bytes?h("d%s=o.bytes===String?%j:%s",S,String.fromCharCode.apply(String,_.typeDefault),"["+Array.prototype.slice.call(_.typeDefault).join(",")+"]"):h("d%s=%j",S,_.typeDefault)}h("}")}var k=!1;for(w=0;w<p.length;++w){var _=p[w],v=f._fieldsArray.indexOf(_),S=d.safeProp(_.name);_.map?(k||(k=!0,h("var ks2")),h("if(m%s&&(ks2=Object.keys(m%s)).length){",S,S)("d%s={}",S)("for(var j=0;j<ks2.length;++j){"),g(h,_,v,S+"[ks2[j]]")("}")):_.repeated?(h("if(m%s&&m%s.length){",S,S)("d%s=[]",S)("for(var j=0;j<m%s.length;++j){",S),g(h,_,v,S+"[j]")("}")):(h("if(m%s!=null&&m.hasOwnProperty(%j)){",S,_.name),g(h,_,v,S),_.partOf&&h("if(o.oneofs)")("d%s=%j",d.safeProp(_.partOf.name),_.name)),h("}")}return h("return d")},"toObject")},{15:15,37:37}],13:[function(n,i,c){i.exports=g;var o=n(15),u=n(36),d=n(37);function l(f){return"missing required '"+f.name+"'"}a(l,"u"),t(l,"missing");function g(f){var p=d.codegen(["r","l"],f.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(f.fieldsArray.filter(function(_){return _.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");f.group&&p("if((t&7)===4)")("break"),p("switch(t>>>3){");for(var h=0;h<f.fieldsArray.length;++h){var m=f._fieldsArray[h].resolve(),y=m.resolvedType instanceof o?"int32":m.type,b="m"+d.safeProp(m.name);p("case %i:",m.id),m.map?(p("r.skip().pos++")("if(%s===util.emptyObject)",b)("%s={}",b)("k=r.%s()",m.keyType)("r.pos++"),u.long[m.keyType]!==s?u.basic[y]===s?p('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',b,h):p('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',b,y):u.basic[y]===s?p("%s[k]=types[%i].decode(r,r.uint32())",b,h):p("%s[k]=r.%s()",b,y)):m.repeated?(p("if(!(%s&&%s.length))",b,b)("%s=[]",b),u.packed[y]!==s&&p("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",b,y)("}else"),u.basic[y]===s?p(m.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",b,h):p("%s.push(r.%s())",b,y)):u.basic[y]===s?p(m.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",b,h):p("%s=r.%s()",b,y),p("break")}for(p("default:")("r.skipType(t&7)")("break")("}")("}"),h=0;h<f._fieldsArray.length;++h){var w=f._fieldsArray[h];w.required&&p("if(!m.hasOwnProperty(%j))",w.name)("throw util.ProtocolError(%j,{instance:m})",l(w))}return p("return m")}a(g,"a"),t(g,"decoder")},{15:15,36:36,37:37}],14:[function(n,i,c){i.exports=g;var o=n(15),u=n(36),d=n(37);function l(f,p,h,m){return p.resolvedType.group?f("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",h,m,(p.id<<3|3)>>>0,(p.id<<3|4)>>>0):f("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",h,m,(p.id<<3|2)>>>0)}a(l,"u"),t(l,"genTypePartial");function g(f){for(var p=d.codegen(["m","w"],f.name+"$encode")("if(!w)")("w=Writer.create()"),y,h,m=f.fieldsArray.slice().sort(d.compareFieldsById),y=0;y<m.length;++y){var b=m[y].resolve(),w=f._fieldsArray.indexOf(b),_=b.resolvedType instanceof o?"int32":b.type,S=u.basic[_];h="m"+d.safeProp(b.name),b.map?(p("if(%s!=null&&m.hasOwnProperty(%j)){",h,b.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",h)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(b.id<<3|2)>>>0,8|u.mapKey[b.keyType],b.keyType),S===s?p("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",w,h):p(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|S,_,h),p("}")("}")):b.repeated?(p("if(%s!=null&&%s.length){",h,h),b.packed&&u.packed[_]!==s?p("w.uint32(%i).fork()",(b.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",h)("w.%s(%s[i])",_,h)("w.ldelim()"):(p("for(var i=0;i<%s.length;++i)",h),S===s?l(p,b,w,h+"[i]"):p("w.uint32(%i).%s(%s[i])",(b.id<<3|S)>>>0,_,h)),p("}")):(b.optional&&p("if(%s!=null&&m.hasOwnProperty(%j))",h,b.name),S===s?l(p,b,w,h):p("w.uint32(%i).%s(%s)",(b.id<<3|S)>>>0,_,h))}return p("return w")}a(g,"a"),t(g,"encoder")},{15:15,36:36,37:37}],15:[function(n,i,c){i.exports=l;var o=n(24);((l.prototype=Object.create(o.prototype)).constructor=l).className="Enum";var u=n(23),d=n(37);function l(g,f,p,h,m){if(o.call(this,g,p),f&&typeof f!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=h,this.comments=m||{},this.reserved=s,f)for(var y=Object.keys(f),b=0;b<y.length;++b)typeof f[y[b]]=="number"&&(this.valuesById[this.values[y[b]]=f[y[b]]]=y[b])}a(l,"u"),t(l,"Enum"),l.fromJSON=t(function(g,f){var p=new l(g,f.values,f.options,f.comment,f.comments);return p.reserved=f.reserved,p},"fromJSON"),l.prototype.toJSON=t(function(g){var f=g?!!g.keepComments:!1;return d.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"comment",f?this.comment:s,"comments",f?this.comments:s])},"toJSON"),l.prototype.add=t(function(g,f,p){if(!d.isString(g))throw TypeError("name must be a string");if(!d.isInteger(f))throw TypeError("id must be an integer");if(this.values[g]!==s)throw Error("duplicate name '"+g+"' in "+this);if(this.isReservedId(f))throw Error("id "+f+" is reserved in "+this);if(this.isReservedName(g))throw Error("name '"+g+"' is reserved in "+this);if(this.valuesById[f]!==s){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+f+" in "+this);this.values[g]=f}else this.valuesById[this.values[g]=f]=g;return this.comments[g]=p||null,this},"add"),l.prototype.remove=t(function(g){if(!d.isString(g))throw TypeError("name must be a string");var f=this.values[g];if(f==null)throw Error("name '"+g+"' does not exist in "+this);return delete this.valuesById[f],delete this.values[g],delete this.comments[g],this},"remove"),l.prototype.isReservedId=t(function(g){return u.isReservedId(this.reserved,g)},"isReservedId"),l.prototype.isReservedName=t(function(g){return u.isReservedName(this.reserved,g)},"isReservedName")},{23:23,24:24,37:37}],16:[function(n,i,c){i.exports=p;var o=n(24);((p.prototype=Object.create(o.prototype)).constructor=p).className="Field";var u=n(15),d=n(36),l=n(37),g,f=/^required|optional|repeated$/;p.fromJSON=t(function(h,m){return new p(h,m.id,m.type,m.rule,m.extend,m.options,m.comment)},"fromJSON");function p(h,m,y,b,w,_,S){if(l.isObject(b)?(S=w,_=b,b=w=s):l.isObject(w)&&(S=_,_=w,w=s),o.call(this,h,_),!l.isInteger(m)||m<0)throw TypeError("id must be a non-negative integer");if(!l.isString(y))throw TypeError("type must be a string");if(b!==s&&!f.test(b=b.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(w!==s&&!l.isString(w))throw TypeError("extend must be a string");this.rule=b&&b!=="optional"?b:s,this.type=y,this.id=m,this.extend=w||s,this.required=b==="required",this.optional=!this.required,this.repeated=b==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=l.Long?d.long[y]!==s:!1,this.bytes=y==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=S}a(p,"t"),t(p,"Field"),Object.defineProperty(p.prototype,"packed",{get:t(function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed},"get")}),p.prototype.setOption=t(function(h,m,y){return h==="packed"&&(this._packed=null),o.prototype.setOption.call(this,h,m,y)},"setOption"),p.prototype.toJSON=t(function(h){var m=h?!!h.keepComments:!1;return l.toObject(["rule",this.rule!=="optional"&&this.rule||s,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",m?this.comment:s])},"toJSON"),p.prototype.resolve=t(function(){if(this.resolved)return this;if((this.typeDefault=d.defaults[this.type])===s&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof g?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof u&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==s&&this.resolvedType&&!(this.resolvedType instanceof u))&&delete this.options.packed,Object.keys(this.options).length||(this.options=s)),this.long)this.typeDefault=l.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var h;l.base64.test(this.typeDefault)?l.base64.decode(this.typeDefault,h=l.newBuffer(l.base64.length(this.typeDefault)),0):l.utf8.write(this.typeDefault,h=l.newBuffer(l.utf8.length(this.typeDefault)),0),this.typeDefault=h}return this.map?this.defaultValue=l.emptyObject:this.repeated?this.defaultValue=l.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof g&&(this.parent.ctor.prototype[this.name]=this.defaultValue),o.prototype.resolve.call(this)},"resolve"),p.d=t(function(h,m,y,b){return typeof m=="function"?m=l.decorateType(m).name:m&&typeof m=="object"&&(m=l.decorateEnum(m).name),t(function(w,_){l.decorateType(w.constructor).add(new p(_,h,m,y,{default:b}))},"fieldDecorator")},"decorateField"),p._configure=t(function(h){g=h},"configure")},{15:15,24:24,36:36,37:37}],17:[function(n,i,c){var o=i.exports=n(18);o.build="light";function u(l,g,f){return typeof g=="function"?(f=g,g=new o.Root):g||(g=new o.Root),g.load(l,f)}a(u,"d"),t(u,"load"),o.load=u;function d(l,g){return g||(g=new o.Root),g.loadSync(l)}a(d,"c"),t(d,"loadSync"),o.loadSync=d,o.encoder=n(14),o.decoder=n(13),o.verifier=n(40),o.converter=n(12),o.ReflectionObject=n(24),o.Namespace=n(23),o.Root=n(29),o.Enum=n(15),o.Type=n(35),o.Field=n(16),o.OneOf=n(25),o.MapField=n(20),o.Service=n(33),o.Method=n(22),o.Message=n(21),o.wrappers=n(41),o.types=n(36),o.util=n(37),o.ReflectionObject._configure(o.Root),o.Namespace._configure(o.Type,o.Service),o.Root._configure(o.Type),o.Field._configure(o.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(n,i,c){var o=c;o.build="minimal",o.Writer=n(42),o.BufferWriter=n(43),o.Reader=n(27),o.BufferReader=n(28),o.util=n(39),o.rpc=n(31),o.roots=n(30),o.configure=u;function u(){o.Reader._configure(o.BufferReader),o.util._configure()}a(u,"d"),t(u,"configure"),o.Writer._configure(o.BufferWriter),u()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(n,i,c){var o=i.exports=n(17);o.build="full",o.tokenize=n(34),o.parse=n(26),o.common=n(11),o.Root._configure(o.Type,o.parse,o.common)},{11:11,17:17,26:26,34:34}],20:[function(n,i,c){i.exports=l;var o=n(16);((l.prototype=Object.create(o.prototype)).constructor=l).className="MapField";var u=n(36),d=n(37);function l(g,f,p,h,m,y){if(o.call(this,g,f,h,s,s,m,y),!d.isString(p))throw TypeError("keyType must be a string");this.keyType=p,this.resolvedKeyType=null,this.map=!0}a(l,"u"),t(l,"MapField"),l.fromJSON=t(function(g,f){return new l(g,f.id,f.keyType,f.type,f.options,f.comment)},"fromJSON"),l.prototype.toJSON=t(function(g){var f=g?!!g.keepComments:!1;return d.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",f?this.comment:s])},"toJSON"),l.prototype.resolve=t(function(){if(this.resolved)return this;if(u.mapKey[this.keyType]===s)throw Error("invalid key type: "+this.keyType);return o.prototype.resolve.call(this)},"resolve"),l.d=t(function(g,f,p){return typeof p=="function"?p=d.decorateType(p).name:p&&typeof p=="object"&&(p=d.decorateEnum(p).name),t(function(h,m){d.decorateType(h.constructor).add(new l(m,g,f,p))},"mapFieldDecorator")},"decorateMapField")},{16:16,36:36,37:37}],21:[function(n,i,c){i.exports=u;var o=n(39);function u(d){if(d)for(var l=Object.keys(d),g=0;g<l.length;++g)this[l[g]]=d[l[g]]}a(u,"d"),t(u,"Message"),u.create=t(function(d){return this.$type.create(d)},"create"),u.encode=t(function(d,l){return this.$type.encode(d,l)},"encode"),u.encodeDelimited=t(function(d,l){return this.$type.encodeDelimited(d,l)},"encodeDelimited"),u.decode=t(function(d){return this.$type.decode(d)},"decode"),u.decodeDelimited=t(function(d){return this.$type.decodeDelimited(d)},"decodeDelimited"),u.verify=t(function(d){return this.$type.verify(d)},"verify"),u.fromObject=t(function(d){return this.$type.fromObject(d)},"fromObject"),u.toObject=t(function(d,l){return this.$type.toObject(d,l)},"toObject"),u.prototype.toJSON=t(function(){return this.$type.toObject(this,o.toJSONOptions)},"toJSON")},{39:39}],22:[function(n,i,c){i.exports=d;var o=n(24);((d.prototype=Object.create(o.prototype)).constructor=d).className="Method";var u=n(37);function d(l,g,f,p,h,m,y,b){if(u.isObject(h)?(y=h,h=m=s):u.isObject(m)&&(y=m,m=s),!(g===s||u.isString(g)))throw TypeError("type must be a string");if(!u.isString(f))throw TypeError("requestType must be a string");if(!u.isString(p))throw TypeError("responseType must be a string");o.call(this,l,y),this.type=g||"rpc",this.requestType=f,this.requestStream=h?!0:s,this.responseType=p,this.responseStream=m?!0:s,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=b}a(d,"c"),t(d,"Method"),d.fromJSON=t(function(l,g){return new d(l,g.type,g.requestType,g.responseType,g.requestStream,g.responseStream,g.options,g.comment)},"fromJSON"),d.prototype.toJSON=t(function(l){var g=l?!!l.keepComments:!1;return u.toObject(["type",this.type!=="rpc"&&this.type||s,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",g?this.comment:s])},"toJSON"),d.prototype.resolve=t(function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),o.prototype.resolve.call(this))},"resolve")},{24:24,37:37}],23:[function(n,i,c){i.exports=h;var o=n(24);((h.prototype=Object.create(o.prototype)).constructor=h).className="Namespace";var u=n(15),d=n(16),l=n(37),g,f;h.fromJSON=t(function(y,b){return new h(y,b.options).addJSON(b.nested)},"fromJSON");function p(y,b){if(!(y&&y.length))return s;for(var w={},_=0;_<y.length;++_)w[y[_].name]=y[_].toJSON(b);return w}a(p,"t"),t(p,"arrayToJSON"),h.arrayToJSON=p,h.isReservedId=t(function(y,b){if(y){for(var w=0;w<y.length;++w)if(typeof y[w]!="string"&&y[w][0]<=b&&y[w][1]>=b)return!0}return!1},"isReservedId"),h.isReservedName=t(function(y,b){if(y){for(var w=0;w<y.length;++w)if(y[w]===b)return!0}return!1},"isReservedName");function h(y,b){o.call(this,y,b),this.nested=s,this._nestedArray=null}a(h,"r"),t(h,"Namespace");function m(y){return y._nestedArray=null,y}a(m,"e"),t(m,"clearCache"),Object.defineProperty(h.prototype,"nestedArray",{get:t(function(){return this._nestedArray||(this._nestedArray=l.toArray(this.nested))},"get")}),h.prototype.toJSON=t(function(y){return l.toObject(["options",this.options,"nested",p(this.nestedArray,y)])},"toJSON"),h.prototype.addJSON=t(function(y){var b=this;if(y)for(var w=Object.keys(y),_=0,S;_<w.length;++_)S=y[w[_]],b.add((S.fields!==s?g.fromJSON:S.values!==s?u.fromJSON:S.methods!==s?f.fromJSON:S.id!==s?d.fromJSON:h.fromJSON)(w[_],S));return this},"addJSON"),h.prototype.get=t(function(y){return this.nested&&this.nested[y]||null},"get"),h.prototype.getEnum=t(function(y){if(this.nested&&this.nested[y]instanceof u)return this.nested[y].values;throw Error("no such enum: "+y)},"getEnum"),h.prototype.add=t(function(y){if(!(y instanceof d&&y.extend!==s||y instanceof g||y instanceof u||y instanceof f||y instanceof h))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var b=this.get(y.name);if(b)if(b instanceof h&&y instanceof h&&!(b instanceof g||b instanceof f)){for(var w=b.nestedArray,_=0;_<w.length;++_)y.add(w[_]);this.remove(b),this.nested||(this.nested={}),y.setOptions(b.options,!0)}else throw Error("duplicate name '"+y.name+"' in "+this)}return this.nested[y.name]=y,y.onAdd(this),m(this)},"add"),h.prototype.remove=t(function(y){if(!(y instanceof o))throw TypeError("object must be a ReflectionObject");if(y.parent!==this)throw Error(y+" is not a member of "+this);return delete this.nested[y.name],Object.keys(this.nested).length||(this.nested=s),y.onRemove(this),m(this)},"remove"),h.prototype.define=t(function(y,b){if(l.isString(y))y=y.split(".");else if(!Array.isArray(y))throw TypeError("illegal path");if(y&&y.length&&y[0]==="")throw Error("path must be relative");for(var w=this;y.length>0;){var _=y.shift();if(w.nested&&w.nested[_]){if(w=w.nested[_],!(w instanceof h))throw Error("path conflicts with non-namespace objects")}else w.add(w=new h(_))}return b&&w.addJSON(b),w},"define"),h.prototype.resolveAll=t(function(){for(var y=this.nestedArray,b=0;b<y.length;)y[b]instanceof h?y[b++].resolveAll():y[b++].resolve();return this.resolve()},"resolveAll"),h.prototype.lookup=t(function(y,b,w){if(typeof b=="boolean"?(w=b,b=s):b&&!Array.isArray(b)&&(b=[b]),l.isString(y)&&y.length){if(y===".")return this.root;y=y.split(".")}else if(!y.length)return this;if(y[0]==="")return this.root.lookup(y.slice(1),b);var _=this.get(y[0]);if(_){if(y.length===1){if(!b||b.indexOf(_.constructor)>-1)return _}else if(_ instanceof h&&(_=_.lookup(y.slice(1),b,!0)))return _}else for(var S=0;S<this.nestedArray.length;++S)if(this._nestedArray[S]instanceof h&&(_=this._nestedArray[S].lookup(y,b,!0)))return _;return this.parent===null||w?null:this.parent.lookup(y,b)},"lookup"),h.prototype.lookupType=t(function(y){var b=this.lookup(y,[g]);if(!b)throw Error("no such type: "+y);return b},"lookupType"),h.prototype.lookupEnum=t(function(y){var b=this.lookup(y,[u]);if(!b)throw Error("no such Enum '"+y+"' in "+this);return b},"lookupEnum"),h.prototype.lookupTypeOrEnum=t(function(y){var b=this.lookup(y,[g,u]);if(!b)throw Error("no such Type or Enum '"+y+"' in "+this);return b},"lookupTypeOrEnum"),h.prototype.lookupService=t(function(y){var b=this.lookup(y,[f]);if(!b)throw Error("no such Service '"+y+"' in "+this);return b},"lookupService"),h._configure=function(y,b){g=y,f=b}},{15:15,16:16,24:24,37:37}],24:[function(n,i,c){i.exports=d,d.className="ReflectionObject";var o=n(37),u;function d(l,g){if(!o.isString(l))throw TypeError("name must be a string");if(g&&!o.isObject(g))throw TypeError("options must be an object");this.options=g,this.name=l,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}a(d,"c"),t(d,"ReflectionObject"),Object.defineProperties(d.prototype,{root:{get:t(function(){for(var l=this;l.parent!==null;)l=l.parent;return l},"get")},fullName:{get:t(function(){for(var l=[this.name],g=this.parent;g;)l.unshift(g.name),g=g.parent;return l.join(".")},"get")}}),d.prototype.toJSON=t(function(){throw Error()},"toJSON"),d.prototype.onAdd=t(function(l){this.parent&&this.parent!==l&&this.parent.remove(this),this.parent=l,this.resolved=!1;var g=l.root;g instanceof u&&g._handleAdd(this)},"onAdd"),d.prototype.onRemove=t(function(l){var g=l.root;g instanceof u&&g._handleRemove(this),this.parent=null,this.resolved=!1},"onRemove"),d.prototype.resolve=t(function(){return this.resolved?this:(this.root instanceof u&&(this.resolved=!0),this)},"resolve"),d.prototype.getOption=t(function(l){return this.options?this.options[l]:s},"getOption"),d.prototype.setOption=t(function(l,g,f){return(!f||!this.options||this.options[l]===s)&&((this.options||(this.options={}))[l]=g),this},"setOption"),d.prototype.setOptions=t(function(l,g){if(l)for(var f=Object.keys(l),p=0;p<f.length;++p)this.setOption(f[p],l[f[p]],g);return this},"setOptions"),d.prototype.toString=t(function(){var l=this.constructor.className,g=this.fullName;return g.length?l+" "+g:l},"toString"),d._configure=function(l){u=l}},{37:37}],25:[function(n,i,c){i.exports=l;var o=n(24);((l.prototype=Object.create(o.prototype)).constructor=l).className="OneOf";var u=n(16),d=n(37);function l(f,p,h,m){if(Array.isArray(p)||(h=p,p=s),o.call(this,f,h),!(p===s||Array.isArray(p)))throw TypeError("fieldNames must be an Array");this.oneof=p||[],this.fieldsArray=[],this.comment=m}a(l,"u"),t(l,"OneOf"),l.fromJSON=t(function(f,p){return new l(f,p.oneof,p.options,p.comment)},"fromJSON"),l.prototype.toJSON=t(function(f){var p=f?!!f.keepComments:!1;return d.toObject(["options",this.options,"oneof",this.oneof,"comment",p?this.comment:s])},"toJSON");function g(f){if(f.parent)for(var p=0;p<f.fieldsArray.length;++p)f.fieldsArray[p].parent||f.parent.add(f.fieldsArray[p])}a(g,"a"),t(g,"addFieldsToParent"),l.prototype.add=t(function(f){if(!(f instanceof u))throw TypeError("field must be a Field");return f.parent&&f.parent!==this.parent&&f.parent.remove(f),this.oneof.push(f.name),this.fieldsArray.push(f),f.partOf=this,g(this),this},"add"),l.prototype.remove=t(function(f){if(!(f instanceof u))throw TypeError("field must be a Field");var p=this.fieldsArray.indexOf(f);if(p<0)throw Error(f+" is not a member of "+this);return this.fieldsArray.splice(p,1),p=this.oneof.indexOf(f.name),p>-1&&this.oneof.splice(p,1),f.partOf=null,this},"remove"),l.prototype.onAdd=t(function(f){o.prototype.onAdd.call(this,f);for(var p=this,h=0;h<this.oneof.length;++h){var m=f.get(this.oneof[h]);m&&!m.partOf&&(m.partOf=p,p.fieldsArray.push(m))}g(this)},"onAdd"),l.prototype.onRemove=t(function(f){for(var p=0,h;p<this.fieldsArray.length;++p)(h=this.fieldsArray[p]).parent&&h.parent.remove(h);o.prototype.onRemove.call(this,f)},"onRemove"),l.d=t(function(){for(var f=new Array(arguments.length),p=0;p<arguments.length;)f[p]=arguments[p++];return t(function(h,m){d.decorateType(h.constructor).add(new l(m,f)),Object.defineProperty(h,m,{get:d.oneOfGetter(f),set:d.oneOfSetter(f)})},"oneOfDecorator")},"decorateOneOf")},{16:16,24:24,37:37}],26:[function(n,i,c){i.exports=j,j.filename=null,j.defaults={keepCase:!1};var o=n(34),u=n(29),d=n(35),l=n(16),g=n(20),f=n(25),p=n(15),h=n(33),m=n(22),y=n(36),b=n(37),w=/^[1-9][0-9]*$/,_=/^-?[1-9][0-9]*$/,S=/^0[x][0-9a-fA-F]+$/,k=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,I=/^-?0[0-7]+$/,E=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,T=/^[a-zA-Z_][a-zA-Z_0-9]*$/,M=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,$=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function j(ae,de,G){de instanceof u||(G=de,de=new u),G||(G=j.defaults);var Z=o(ae,G.alternateCommentMode||!1),q=Z.next,ce=Z.push,ue=Z.peek,U=Z.skip,Oe=Z.cmnt,Pe=!0,We,K,oe,me,we=!1,De=de,$e=G.keepCase?function(N){return N}:b.camelCase;function Y(N,C,P){var B=j.filename;return P||(j.filename=null),Error("illegal "+(C||"token")+" '"+N+"' ("+(B?B+", ":"")+"line "+Z.line+")")}a(Y,"F"),t(Y,"illegal");function ot(){var N=[],C;do{if((C=q())!=='"'&&C!=="'")throw Y(C);N.push(q()),U(C),C=ue()}while(C==='"'||C==="'");return N.join("")}a(ot,"Y"),t(ot,"readString");function Nn(N){var C=q();switch(C){case"'":case'"':return ce(C),ot();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return dc(C,!0)}catch{if(N&&M.test(C))return C;throw Y(C,"value")}}a(Nn,"ht"),t(Nn,"readValue");function as(N,C){var P,B;do C&&((P=ue())==='"'||P==="'")?N.push(ot()):N.push([B=Nt(q()),U("to",!0)?Nt(q()):B]);while(U(",",!0));U(";")}a(as,"ot"),t(as,"readRanges");function dc(N,C){var P=1;switch(N.charAt(0)==="-"&&(P=-1,N=N.substring(1)),N){case"inf":case"INF":case"Inf":return P*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(w.test(N))return P*parseInt(N,10);if(S.test(N))return P*parseInt(N,16);if(v.test(N))return P*parseInt(N,8);if(E.test(N))return P*parseFloat(N);throw Y(N,"number",C)}a(dc,"pt"),t(dc,"parseNumber");function Nt(N,C){switch(N){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!C&&N.charAt(0)==="-")throw Y(N,"id");if(_.test(N))return parseInt(N,10);if(k.test(N))return parseInt(N,16);if(I.test(N))return parseInt(N,8);throw Y(N,"id")}a(Nt,"nt"),t(Nt,"parseId");function fc(){if(We!==s)throw Y("package");if(We=q(),!M.test(We))throw Y(We,"name");De=De.define(We),U(";")}a(fc,"dt"),t(fc,"parsePackage");function pc(){var N=ue(),C;switch(N){case"weak":C=oe||(oe=[]),q();break;case"public":q();default:C=K||(K=[]);break}N=ot(),U(";"),C.push(N)}a(pc,"yt"),t(pc,"parseImport");function gc(){if(U("="),me=ot(),we=me==="proto3",!we&&me!=="proto2")throw Y(me,"syntax");U(";")}a(gc,"mt"),t(gc,"parseSyntax");function cs(N,C){switch(C){case"option":return rt(N,C),U(";"),!0;case"message":return mc(N,C),!0;case"enum":return wc(N,C),!0;case"service":return vc(N,C),!0;case"extend":return Oc(N,C),!0}return!1}a(cs,"at"),t(cs,"parseCommon");function tt(N,C,P){var B=Z.line;if(N&&(N.comment=Oe(),N.filename=j.filename),U("{",!0)){for(var ye;(ye=q())!=="}";)C(ye);U(";",!0)}else P&&P(),U(";"),N&&typeof N.comment!="string"&&(N.comment=Oe(B))}a(tt,"K"),t(tt,"ifBlock");function mc(N,C){if(!T.test(C=q()))throw Y(C,"type name");var P=new d(C);tt(P,t(function(B){if(!cs(P,B))switch(B){case"map":bc(P);break;case"required":case"optional":case"repeated":Dt(P,B);break;case"oneof":_c(P,B);break;case"extensions":as(P.extensions||(P.extensions=[]));break;case"reserved":as(P.reserved||(P.reserved=[]),!0);break;default:if(!we||!M.test(B))throw Y(B);ce(B),Dt(P,"optional");break}},"parseType_block")),N.add(P)}a(mc,"vt"),t(mc,"parseType");function Dt(N,C,P){var B=q();if(B==="group"){yc(N,C);return}if(!M.test(B))throw Y(B,"type");var ye=q();if(!T.test(ye))throw Y(ye,"name");ye=$e(ye),U("=");var Se=new l(ye,Nt(q()),B,C,P);tt(Se,t(function(ft){if(ft==="option")rt(Se,ft),U(";");else throw Y(ft)},"parseField_block"),t(function(){us(Se)},"parseField_line")),N.add(Se),!we&&Se.repeated&&(y.packed[B]!==s||y.basic[B]===s)&&Se.setOption("packed",!1,!0)}a(Dt,"st"),t(Dt,"parseField");function yc(N,C){var P=q();if(!T.test(P))throw Y(P,"name");var B=b.lcFirst(P);P===B&&(P=b.ucFirst(P)),U("=");var ye=Nt(q()),Se=new d(P);Se.group=!0;var ft=new l(B,ye,P,C);ft.filename=j.filename,tt(Se,t(function(Mt){switch(Mt){case"option":rt(Se,Mt),U(";");break;case"required":case"optional":case"repeated":Dt(Se,Mt);break;default:throw Y(Mt)}},"parseGroup_block")),N.add(Se).add(ft)}a(yc,"gt"),t(yc,"parseGroup");function bc(N){U("<");var C=q();if(y.mapKey[C]===s)throw Y(C,"type");U(",");var P=q();if(!M.test(P))throw Y(P,"type");U(">");var B=q();if(!T.test(B))throw Y(B,"name");U("=");var ye=new g($e(B),Nt(q()),C,P);tt(ye,t(function(Se){if(Se==="option")rt(ye,Se),U(";");else throw Y(Se)},"parseMapField_block"),t(function(){us(ye)},"parseMapField_line")),N.add(ye)}a(bc,"wt"),t(bc,"parseMapField");function _c(N,C){if(!T.test(C=q()))throw Y(C,"name");var P=new f($e(C));tt(P,t(function(B){B==="option"?(rt(P,B),U(";")):(ce(B),Dt(P,"optional"))},"parseOneOf_block")),N.add(P)}a(_c,"Ot"),t(_c,"parseOneOf");function wc(N,C){if(!T.test(C=q()))throw Y(C,"name");var P=new p(C);tt(P,t(function(B){switch(B){case"option":rt(P,B),U(";");break;case"reserved":as(P.reserved||(P.reserved=[]),!0);break;default:Sc(P,B)}},"parseEnum_block")),N.add(P)}a(wc,"bt"),t(wc,"parseEnum");function Sc(N,C){if(!T.test(C))throw Y(C,"name");U("=");var P=Nt(q(),!0),B={};tt(B,t(function(ye){if(ye==="option")rt(B,ye),U(";");else throw Y(ye)},"parseEnumValue_block"),t(function(){us(B)},"parseEnumValue_line")),N.add(C,P,B.comment)}a(Sc,"_t"),t(Sc,"parseEnumValue");function rt(N,C){var P=U("(",!0);if(!M.test(C=q()))throw Y(C,"name");var B=C;P&&(U(")"),B="("+B+")",C=ue(),$.test(C)&&(B+=C,q())),U("="),ls(N,B)}a(rt,"Q"),t(rt,"parseOption");function ls(N,C){if(U("{",!0))do{if(!T.test(Be=q()))throw Y(Be,"name");ue()==="{"?ls(N,C+"."+Be):(U(":"),ue()==="{"?ls(N,C+"."+Be):Dn(N,C+"."+Be,Nn(!0)))}while(!U("}",!0));else Dn(N,C,Nn(!0))}a(ls,"ut"),t(ls,"parseOptionValue");function Dn(N,C,P){N.setOption&&N.setOption(C,P)}a(Dn,"ct"),t(Dn,"setOption");function us(N){if(U("[",!0)){do rt(N,"option");while(U(",",!0));U("]")}return N}a(us,"ft"),t(us,"parseInlineOptions");function vc(N,C){if(!T.test(C=q()))throw Y(C,"service name");var P=new h(C);tt(P,t(function(B){if(!cs(P,B))if(B==="rpc")Ec(P,B);else throw Y(B)},"parseService_block")),N.add(P)}a(vc,"xt"),t(vc,"parseService");function Ec(N,C){var P=C;if(!T.test(C=q()))throw Y(C,"name");var B=C,ye,Se,ft,Mt;if(U("("),U("stream",!0)&&(Se=!0),!M.test(C=q())||(ye=C,U(")"),U("returns"),U("("),U("stream",!0)&&(Mt=!0),!M.test(C=q())))throw Y(C);ft=C,U(")");var Mn=new m(B,P,ye,ft,Se,Mt);tt(Mn,t(function(Ln){if(Ln==="option")rt(Mn,Ln),U(";");else throw Y(Ln)},"parseMethod_block")),N.add(Mn)}a(Ec,"At"),t(Ec,"parseMethod");function Oc(N,C){if(!M.test(C=q()))throw Y(C,"reference");var P=C;tt(null,t(function(B){switch(B){case"required":case"repeated":case"optional":Dt(N,B,P);break;default:if(!we||!M.test(B))throw Y(B);ce(B),Dt(N,"optional",P);break}},"parseExtension_block"))}a(Oc,"St"),t(Oc,"parseExtension");for(var Be;(Be=q())!==null;)switch(Be){case"package":if(!Pe)throw Y(Be);fc();break;case"import":if(!Pe)throw Y(Be);pc();break;case"syntax":if(!Pe)throw Y(Be);gc();break;case"option":if(!Pe)throw Y(Be);rt(De,Be),U(";");break;default:if(cs(De,Be)){Pe=!1;continue}throw Y(Be)}return j.filename=null,{package:We,imports:K,weakImports:oe,syntax:me,root:de}}a(j,"T"),t(j,"parse")},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(n,i,c){i.exports=f;var o=n(39),u,d=o.LongBits,l=o.utf8;function g(b,w){return RangeError("index out of range: "+b.pos+" + "+(w||1)+" > "+b.len)}a(g,"a"),t(g,"indexOutOfRange");function f(b){this.buf=b,this.pos=0,this.len=b.length}a(f,"s"),t(f,"Reader");var p=typeof Uint8Array<"u"?t(function(b){if(b instanceof Uint8Array||Array.isArray(b))return new f(b);throw Error("illegal buffer")},"create_typed_array"):t(function(b){if(Array.isArray(b))return new f(b);throw Error("illegal buffer")},"create_array");f.create=o.Buffer?t(function(b){return(f.create=t(function(w){return o.Buffer.isBuffer(w)?new u(w):p(w)},"create_buffer"))(b)},"create_buffer_setup"):p,f.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,f.prototype.uint32=t((function(){var b=4294967295;return t(function(){if(b=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(b=(b|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return b;if((this.pos+=5)>this.len)throw this.pos=this.len,g(this,10);return b},"read_uint32")}),"read_uint32_setup")(),f.prototype.int32=t(function(){return this.uint32()|0},"read_int32"),f.prototype.sint32=t(function(){var b=this.uint32();return b>>>1^-(b&1)|0},"read_sint32");function h(){var b=new d(0,0),w=0;if(this.len-this.pos>4){for(;w<4;++w)if(b.lo=(b.lo|(this.buf[this.pos]&127)<<w*7)>>>0,this.buf[this.pos++]<128)return b;if(b.lo=(b.lo|(this.buf[this.pos]&127)<<28)>>>0,b.hi=(b.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return b;w=0}else{for(;w<3;++w){if(this.pos>=this.len)throw g(this);if(b.lo=(b.lo|(this.buf[this.pos]&127)<<w*7)>>>0,this.buf[this.pos++]<128)return b}return b.lo=(b.lo|(this.buf[this.pos++]&127)<<w*7)>>>0,b}if(this.len-this.pos>4){for(;w<5;++w)if(b.hi=(b.hi|(this.buf[this.pos]&127)<<w*7+3)>>>0,this.buf[this.pos++]<128)return b}else for(;w<5;++w){if(this.pos>=this.len)throw g(this);if(b.hi=(b.hi|(this.buf[this.pos]&127)<<w*7+3)>>>0,this.buf[this.pos++]<128)return b}throw Error("invalid varint encoding")}a(h,"r"),t(h,"readLongVarint"),f.prototype.bool=t(function(){return this.uint32()!==0},"read_bool");function m(b,w){return(b[w-4]|b[w-3]<<8|b[w-2]<<16|b[w-1]<<24)>>>0}a(m,"e"),t(m,"readFixed32_end"),f.prototype.fixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return m(this.buf,this.pos+=4)},"read_fixed32"),f.prototype.sfixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return m(this.buf,this.pos+=4)|0},"read_sfixed32");function y(){if(this.pos+8>this.len)throw g(this,8);return new d(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}a(y,"f"),t(y,"readFixed64"),f.prototype.float=t(function(){if(this.pos+4>this.len)throw g(this,4);var b=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,b},"read_float"),f.prototype.double=t(function(){if(this.pos+8>this.len)throw g(this,4);var b=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,b},"read_double"),f.prototype.bytes=t(function(){var b=this.uint32(),w=this.pos,_=this.pos+b;if(_>this.len)throw g(this,b);return this.pos+=b,Array.isArray(this.buf)?this.buf.slice(w,_):w===_?new this.buf.constructor(0):this._slice.call(this.buf,w,_)},"read_bytes"),f.prototype.string=t(function(){var b=this.bytes();return l.read(b,0,b.length)},"read_string"),f.prototype.skip=t(function(b){if(typeof b=="number"){if(this.pos+b>this.len)throw g(this,b);this.pos+=b}else do if(this.pos>=this.len)throw g(this);while(this.buf[this.pos++]&128);return this},"skip"),f.prototype.skipType=function(b){switch(b){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((b=this.uint32()&7)===4)break;this.skipType(b)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+b+" at offset "+this.pos)}return this},f._configure=function(b){u=b;var w=o.Long?"toLong":"toNumber";o.merge(f.prototype,{int64:t(function(){return h.call(this)[w](!1)},"read_int64"),uint64:t(function(){return h.call(this)[w](!0)},"read_uint64"),sint64:t(function(){return h.call(this).zzDecode()[w](!1)},"read_sint64"),fixed64:t(function(){return y.call(this)[w](!0)},"read_fixed64"),sfixed64:t(function(){return y.call(this)[w](!1)},"read_sfixed64")})}},{39:39}],28:[function(n,i,c){i.exports=d;var o=n(27);(d.prototype=Object.create(o.prototype)).constructor=d;var u=n(39);function d(l){o.call(this,l)}a(d,"c"),t(d,"BufferReader"),u.Buffer&&(d.prototype._slice=u.Buffer.prototype.slice),d.prototype.string=t(function(){var l=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+l,this.len))},"read_string_buffer")},{27:27,39:39}],29:[function(n,i,c){i.exports=m;var o=n(23);((m.prototype=Object.create(o.prototype)).constructor=m).className="Root";var u=n(16),d=n(15),l=n(25),g=n(37),f,p,h;function m(_){o.call(this,"",_),this.deferred=[],this.files=[]}a(m,"e"),t(m,"Root"),m.fromJSON=t(function(_,S){return S||(S=new m),_.options&&S.setOptions(_.options),S.addJSON(_.nested)},"fromJSON"),m.prototype.resolvePath=g.path.resolve;function y(){}a(y,"f"),t(y,"SYNC"),m.prototype.load=t(a(function _(S,k,v){typeof k=="function"&&(v=k,k=s);var I=this;if(!v)return g.asPromise(_,I,S,k);var E=v===y;function T(G,Z){if(v){var q=v;if(v=null,E)throw G;q(G,Z)}}a(T,"g"),t(T,"finish");function M(G,Z){try{if(g.isString(Z)&&Z.charAt(0)==="{"&&(Z=JSON.parse(Z)),!g.isString(Z))I.setOptions(Z.options).addJSON(Z.nested);else{p.filename=G;var q=p(Z,I,k),ce,ue=0;if(q.imports)for(;ue<q.imports.length;++ue)(ce=I.resolvePath(G,q.imports[ue]))&&$(ce);if(q.weakImports)for(ue=0;ue<q.weakImports.length;++ue)(ce=I.resolvePath(G,q.weakImports[ue]))&&$(ce,!0)}}catch(U){T(U)}!E&&!j&&T(null,I)}a(M,"_"),t(M,"process");function $(G,Z){var q=G.lastIndexOf("google/protobuf/");if(q>-1){var ce=G.substring(q);ce in h&&(G=ce)}if(!(I.files.indexOf(G)>-1)){if(I.files.push(G),G in h){E?M(G,h[G]):(++j,setTimeout(function(){--j,M(G,h[G])}));return}if(E){var ue;try{ue=g.fs.readFileSync(G).toString("utf8")}catch(U){Z||T(U);return}M(G,ue)}else++j,g.fetch(G,function(U,Oe){if(--j,!!v){if(U){Z?j||T(null,I):T(U);return}M(G,Oe)}})}}a($,"D"),t($,"fetch");var j=0;g.isString(S)&&(S=[S]);for(var ae=0,de;ae<S.length;++ae)(de=I.resolvePath("",S[ae]))&&$(de);return E?I:(j||T(null,I),s)},"p"),"load"),m.prototype.loadSync=t(function(_,S){if(!g.isNode)throw Error("not supported");return this.load(_,S,y)},"loadSync"),m.prototype.resolveAll=t(function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(_){return"'extend "+_.extend+"' in "+_.parent.fullName}).join(", "));return o.prototype.resolveAll.call(this)},"resolveAll");var b=/^[A-Z]/;function w(_,S){var k=S.parent.lookup(S.extend);if(k){var v=new u(S.fullName,S.id,S.type,S.rule,s,S.options);return v.declaringField=S,S.extensionField=v,k.add(v),!0}return!1}a(w,"o"),t(w,"tryHandleExtension"),m.prototype._handleAdd=t(function(_){if(_ instanceof u)_.extend!==s&&!_.extensionField&&(w(this,_)||this.deferred.push(_));else if(_ instanceof d)b.test(_.name)&&(_.parent[_.name]=_.values);else if(!(_ instanceof l)){if(_ instanceof f)for(var S=0;S<this.deferred.length;)w(this,this.deferred[S])?this.deferred.splice(S,1):++S;for(var k=0;k<_.nestedArray.length;++k)this._handleAdd(_._nestedArray[k]);b.test(_.name)&&(_.parent[_.name]=_)}},"_handleAdd"),m.prototype._handleRemove=t(function(_){if(_ instanceof u){if(_.extend!==s)if(_.extensionField)_.extensionField.parent.remove(_.extensionField),_.extensionField=null;else{var S=this.deferred.indexOf(_);S>-1&&this.deferred.splice(S,1)}}else if(_ instanceof d)b.test(_.name)&&delete _.parent[_.name];else if(_ instanceof o){for(var k=0;k<_.nestedArray.length;++k)this._handleRemove(_._nestedArray[k]);b.test(_.name)&&delete _.parent[_.name]}},"_handleRemove"),m._configure=function(_,S,k){f=_,p=S,h=k}},{15:15,16:16,23:23,25:25,37:37}],30:[function(n,i,c){i.exports={}},{}],31:[function(n,i,c){var o=c;o.Service=n(32)},{32:32}],32:[function(n,i,c){i.exports=u;var o=n(39);(u.prototype=Object.create(o.EventEmitter.prototype)).constructor=u;function u(d,l,g){if(typeof d!="function")throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=d,this.requestDelimited=!!l,this.responseDelimited=!!g}a(u,"d"),t(u,"Service"),u.prototype.rpcCall=t(a(function d(l,g,f,p,h){if(!p)throw TypeError("request must be specified");var m=this;if(!h)return o.asPromise(d,m,l,g,f,p);if(!m.rpcImpl)return setTimeout(function(){h(Error("already ended"))},0),s;try{return m.rpcImpl(l,g[m.requestDelimited?"encodeDelimited":"encode"](p).finish(),t(function(y,b){if(y)return m.emit("error",y,l),h(y);if(b===null)return m.end(!0),s;if(!(b instanceof f))try{b=f[m.responseDelimited?"decodeDelimited":"decode"](b)}catch(w){return m.emit("error",w,l),h(w)}return m.emit("data",b,l),h(null,b)},"rpcCallback"))}catch(y){return m.emit("error",y,l),setTimeout(function(){h(y)},0),s}},"c"),"rpcCall"),u.prototype.end=t(function(d){return this.rpcImpl&&(d||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},"end")},{39:39}],33:[function(n,i,c){i.exports=g;var o=n(23);((g.prototype=Object.create(o.prototype)).constructor=g).className="Service";var u=n(22),d=n(37),l=n(31);function g(p,h){o.call(this,p,h),this.methods={},this._methodsArray=null}a(g,"a"),t(g,"Service"),g.fromJSON=t(function(p,h){var m=new g(p,h.options);if(h.methods)for(var y=Object.keys(h.methods),b=0;b<y.length;++b)m.add(u.fromJSON(y[b],h.methods[y[b]]));return h.nested&&m.addJSON(h.nested),m.comment=h.comment,m},"fromJSON"),g.prototype.toJSON=t(function(p){var h=o.prototype.toJSON.call(this,p),m=p?!!p.keepComments:!1;return d.toObject(["options",h&&h.options||s,"methods",o.arrayToJSON(this.methodsArray,p)||{},"nested",h&&h.nested||s,"comment",m?this.comment:s])},"toJSON"),Object.defineProperty(g.prototype,"methodsArray",{get:t(function(){return this._methodsArray||(this._methodsArray=d.toArray(this.methods))},"get")});function f(p){return p._methodsArray=null,p}a(f,"s"),t(f,"clearCache"),g.prototype.get=t(function(p){return this.methods[p]||o.prototype.get.call(this,p)},"get"),g.prototype.resolveAll=t(function(){for(var p=this.methodsArray,h=0;h<p.length;++h)p[h].resolve();return o.prototype.resolve.call(this)},"resolveAll"),g.prototype.add=t(function(p){if(this.get(p.name))throw Error("duplicate name '"+p.name+"' in "+this);return p instanceof u?(this.methods[p.name]=p,p.parent=this,f(this)):o.prototype.add.call(this,p)},"add"),g.prototype.remove=t(function(p){if(p instanceof u){if(this.methods[p.name]!==p)throw Error(p+" is not a member of "+this);return delete this.methods[p.name],p.parent=null,f(this)}return o.prototype.remove.call(this,p)},"remove"),g.prototype.create=t(function(p,h,m){for(var y=new l.Service(p,h,m),b=0,w;b<this.methodsArray.length;++b){var _=d.lcFirst((w=this._methodsArray[b]).resolve().name).replace(/[^$\w_]/g,"");y[_]=d.codegen(["r","c"],d.isReserved(_)?_+"_":_)("return this.rpcCall(m,q,s,r,c)")({m:w,q:w.resolvedRequestType.ctor,s:w.resolvedResponseType.ctor})}return y},"create")},{22:22,23:23,31:31,37:37}],34:[function(n,i,c){i.exports=b;var o=/[\s{}=;:[\],'"()<>]/g,u=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,d=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,l=/^ *[*/]+ */,g=/^\s*\*?\/*/,f=/\n/g,p=/\s/,h=/\\(.?)/g,m={0:"\0",r:"\r",n:`
|
|
60
|
+
`,t:" "};function y(w){return w.replace(h,function(_,S){switch(S){case"\\":case"":return S;default:return m[S]||""}})}a(y,"f"),t(y,"unescape"),b.unescape=y;function b(w,_){w=w.toString();var S=0,k=w.length,v=1,I=null,E=null,T=0,M=!1,$=[],j=null;function ae(K){return Error("illegal "+K+" (line "+v+")")}a(ae,"J"),t(ae,"illegal");function de(){var K=j==="'"?d:u;K.lastIndex=S-1;var oe=K.exec(w);if(!oe)throw ae("string");return S=K.lastIndex,U(j),j=null,y(oe[1])}a(de,"H"),t(de,"readString");function G(K){return w.charAt(K)}a(G,"I"),t(G,"charAt");function Z(K,oe){I=w.charAt(K++),T=v,M=!1;var me;_?me=2:me=3;var we=K-me,De;do if(--we<0||(De=w.charAt(we))===`
|
|
61
|
+
`){M=!0;break}while(De===" "||De===" ");for(var $e=w.substring(K,oe).split(f),Y=0;Y<$e.length;++Y)$e[Y]=$e[Y].replace(_?g:l,"").trim();E=$e.join(`
|
|
62
|
+
`).trim()}a(Z,"$"),t(Z,"setComment");function q(K){var oe=ce(K),me=w.substring(K,oe),we=/^\s*\/{1,2}/.test(me);return we}a(q,"B"),t(q,"isDoubleSlashCommentLine");function ce(K){for(var oe=K;oe<k&&G(oe)!==`
|
|
63
|
+
`;)oe++;return oe}a(ce,"U"),t(ce,"findEndOfLine");function ue(){if($.length>0)return $.shift();if(j)return de();var K,oe,me,we,De;do{if(S===k)return null;for(K=!1;p.test(me=G(S));)if(me===`
|
|
64
|
+
`&&++v,++S===k)return null;if(G(S)==="/"){if(++S===k)throw ae("comment");if(G(S)==="/")if(_){if(we=S,De=!1,q(S)){De=!0;do{if(S=ce(S),S===k)break;S++}while(q(S))}else S=Math.min(k,ce(S)+1);De&&Z(we,S),v++,K=!0}else{for(De=G(we=S+1)==="/";G(++S)!==`
|
|
65
|
+
`;)if(S===k)return null;++S,De&&Z(we,S-1),++v,K=!0}else if((me=G(S))==="*"){we=S+1,De=_||G(we)==="*";do{if(me===`
|
|
66
|
+
`&&++v,++S===k)throw ae("comment");oe=me,me=G(S)}while(oe!=="*"||me!=="/");++S,De&&Z(we,S-2),K=!0}else return"/"}}while(K);var $e=S;o.lastIndex=0;var Y=o.test(G($e++));if(!Y)for(;$e<k&&!o.test(G($e));)++$e;var ot=w.substring(S,S=$e);return(ot==='"'||ot==="'")&&(j=ot),ot}a(ue,"P"),t(ue,"next");function U(K){$.push(K)}a(U,"N"),t(U,"push");function Oe(){if(!$.length){var K=ue();if(K===null)return null;U(K)}return $[0]}a(Oe,"q"),t(Oe,"peek");function Pe(K,oe){var me=Oe(),we=me===K;if(we)return ue(),!0;if(!oe)throw ae("token '"+me+"', '"+K+"' expected");return!1}a(Pe,"rt"),t(Pe,"skip");function We(K){var oe=null;return K===s?T===v-1&&(_||I==="*"||M)&&(oe=E):(T<K&&Oe(),T===K&&!M&&(_||I==="/")&&(oe=E)),oe}return a(We,"tt"),t(We,"cmnt"),Object.defineProperty({next:ue,peek:Oe,push:U,skip:Pe,cmnt:We},"line",{get:t(function(){return v},"get")})}a(b,"n"),t(b,"tokenize")},{}],35:[function(n,i,c){i.exports=v;var o=n(23);((v.prototype=Object.create(o.prototype)).constructor=v).className="Type";var u=n(15),d=n(25),l=n(16),g=n(20),f=n(33),p=n(21),h=n(27),m=n(42),y=n(37),b=n(14),w=n(13),_=n(40),S=n(12),k=n(41);function v(E,T){o.call(this,E,T),this.fields={},this.oneofs=s,this.extensions=s,this.reserved=s,this.group=s,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}a(v,"m"),t(v,"Type"),Object.defineProperties(v.prototype,{fieldsById:{get:t(function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var E=Object.keys(this.fields),T=0;T<E.length;++T){var M=this.fields[E[T]],$=M.id;if(this._fieldsById[$])throw Error("duplicate id "+$+" in "+this);this._fieldsById[$]=M}return this._fieldsById},"get")},fieldsArray:{get:t(function(){return this._fieldsArray||(this._fieldsArray=y.toArray(this.fields))},"get")},oneofsArray:{get:t(function(){return this._oneofsArray||(this._oneofsArray=y.toArray(this.oneofs))},"get")},ctor:{get:t(function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},"get"),set:t(function(E){var T=E.prototype;T instanceof p||((E.prototype=new p).constructor=E,y.merge(E.prototype,T)),E.$type=E.prototype.$type=this,y.merge(E,p,!0),this._ctor=E;for(var M=0;M<this.fieldsArray.length;++M)this._fieldsArray[M].resolve();var $={};for(M=0;M<this.oneofsArray.length;++M)$[this._oneofsArray[M].resolve().name]={get:y.oneOfGetter(this._oneofsArray[M].oneof),set:y.oneOfSetter(this._oneofsArray[M].oneof)};M&&Object.defineProperties(E.prototype,$)},"set")}}),v.generateConstructor=t(function(E){for(var T=y.codegen(["p"],E.name),M=0,$;M<E.fieldsArray.length;++M)($=E._fieldsArray[M]).map?T("this%s={}",y.safeProp($.name)):$.repeated&&T("this%s=[]",y.safeProp($.name));return T("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},"generateConstructor");function I(E){return E._fieldsById=E._fieldsArray=E._oneofsArray=null,delete E.encode,delete E.decode,delete E.verify,E}a(I,"w"),t(I,"clearCache"),v.fromJSON=t(function(E,T){var M=new v(E,T.options);M.extensions=T.extensions,M.reserved=T.reserved;for(var $=Object.keys(T.fields),j=0;j<$.length;++j)M.add((typeof T.fields[$[j]].keyType<"u"?g.fromJSON:l.fromJSON)($[j],T.fields[$[j]]));if(T.oneofs)for($=Object.keys(T.oneofs),j=0;j<$.length;++j)M.add(d.fromJSON($[j],T.oneofs[$[j]]));if(T.nested)for($=Object.keys(T.nested),j=0;j<$.length;++j){var ae=T.nested[$[j]];M.add((ae.id!==s?l.fromJSON:ae.fields!==s?v.fromJSON:ae.values!==s?u.fromJSON:ae.methods!==s?f.fromJSON:o.fromJSON)($[j],ae))}return T.extensions&&T.extensions.length&&(M.extensions=T.extensions),T.reserved&&T.reserved.length&&(M.reserved=T.reserved),T.group&&(M.group=!0),T.comment&&(M.comment=T.comment),M},"fromJSON"),v.prototype.toJSON=t(function(E){var T=o.prototype.toJSON.call(this,E),M=E?!!E.keepComments:!1;return y.toObject(["options",T&&T.options||s,"oneofs",o.arrayToJSON(this.oneofsArray,E),"fields",o.arrayToJSON(this.fieldsArray.filter(function($){return!$.declaringField}),E)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:s,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"group",this.group||s,"nested",T&&T.nested||s,"comment",M?this.comment:s])},"toJSON"),v.prototype.resolveAll=t(function(){for(var E=this.fieldsArray,T=0;T<E.length;)E[T++].resolve();var M=this.oneofsArray;for(T=0;T<M.length;)M[T++].resolve();return o.prototype.resolveAll.call(this)},"resolveAll"),v.prototype.get=t(function(E){return this.fields[E]||this.oneofs&&this.oneofs[E]||this.nested&&this.nested[E]||null},"get"),v.prototype.add=t(function(E){if(this.get(E.name))throw Error("duplicate name '"+E.name+"' in "+this);if(E instanceof l&&E.extend===s){if(this._fieldsById?this._fieldsById[E.id]:this.fieldsById[E.id])throw Error("duplicate id "+E.id+" in "+this);if(this.isReservedId(E.id))throw Error("id "+E.id+" is reserved in "+this);if(this.isReservedName(E.name))throw Error("name '"+E.name+"' is reserved in "+this);return E.parent&&E.parent.remove(E),this.fields[E.name]=E,E.message=this,E.onAdd(this),I(this)}return E instanceof d?(this.oneofs||(this.oneofs={}),this.oneofs[E.name]=E,E.onAdd(this),I(this)):o.prototype.add.call(this,E)},"add"),v.prototype.remove=t(function(E){if(E instanceof l&&E.extend===s){if(!this.fields||this.fields[E.name]!==E)throw Error(E+" is not a member of "+this);return delete this.fields[E.name],E.parent=null,E.onRemove(this),I(this)}if(E instanceof d){if(!this.oneofs||this.oneofs[E.name]!==E)throw Error(E+" is not a member of "+this);return delete this.oneofs[E.name],E.parent=null,E.onRemove(this),I(this)}return o.prototype.remove.call(this,E)},"remove"),v.prototype.isReservedId=t(function(E){return o.isReservedId(this.reserved,E)},"isReservedId"),v.prototype.isReservedName=t(function(E){return o.isReservedName(this.reserved,E)},"isReservedName"),v.prototype.create=t(function(E){return new this.ctor(E)},"create"),v.prototype.setup=t(function(){for(var E=this.fullName,T=[],M=0;M<this.fieldsArray.length;++M)T.push(this._fieldsArray[M].resolve().resolvedType);this.encode=b(this)({Writer:m,types:T,util:y}),this.decode=w(this)({Reader:h,types:T,util:y}),this.verify=_(this)({types:T,util:y}),this.fromObject=S.fromObject(this)({types:T,util:y}),this.toObject=S.toObject(this)({types:T,util:y});var $=k[E];if($){var j=Object.create(this);j.fromObject=this.fromObject,this.fromObject=$.fromObject.bind(j),j.toObject=this.toObject,this.toObject=$.toObject.bind(j)}return this},"setup"),v.prototype.encode=t(function(E,T){return this.setup().encode(E,T)},"encode_setup"),v.prototype.encodeDelimited=t(function(E,T){return this.encode(E,T&&T.len?T.fork():T).ldelim()},"encodeDelimited"),v.prototype.decode=t(function(E,T){return this.setup().decode(E,T)},"decode_setup"),v.prototype.decodeDelimited=t(function(E){return E instanceof h||(E=h.create(E)),this.decode(E,E.uint32())},"decodeDelimited"),v.prototype.verify=t(function(E){return this.setup().verify(E)},"verify_setup"),v.prototype.fromObject=t(function(E){return this.setup().fromObject(E)},"fromObject"),v.prototype.toObject=t(function(E,T){return this.setup().toObject(E,T)},"toObject"),v.d=t(function(E){return t(function(T){y.decorateType(T,E)},"typeDecorator")},"decorateType")},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(n,i,c){var o=c,u=n(37),d=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function l(g,f){var p=0,h={};for(f|=0;p<g.length;)h[d[p+f]]=g[p++];return h}a(l,"u"),t(l,"bake"),o.basic=l([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),o.defaults=l([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",u.emptyArray,null]),o.long=l([0,0,0,1,1],7),o.mapKey=l([0,0,0,5,5,0,0,0,1,1,0,2],2),o.packed=l([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(n,i,c){var o=i.exports=n(39),u=n(30),d,l;o.codegen=n(3),o.fetch=n(5),o.path=n(8),o.fs=o.inquire("fs"),o.toArray=t(function(m){if(m){for(var y=Object.keys(m),b=new Array(y.length),w=0;w<y.length;)b[w]=m[y[w++]];return b}return[]},"toArray"),o.toObject=t(function(m){for(var y={},b=0;b<m.length;){var w=m[b++],_=m[b++];_!==s&&(y[w]=_)}return y},"toObject");var g=/\\/g,f=/"/g;o.isReserved=t(function(m){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(m)},"isReserved"),o.safeProp=t(function(m){return!/^[$\w_]+$/.test(m)||o.isReserved(m)?'["'+m.replace(g,"\\\\").replace(f,'\\"')+'"]':"."+m},"safeProp"),o.ucFirst=t(function(m){return m.charAt(0).toUpperCase()+m.substring(1)},"ucFirst");var p=/_([a-z])/g;o.camelCase=t(function(m){return m.substring(0,1)+m.substring(1).replace(p,function(y,b){return b.toUpperCase()})},"camelCase"),o.compareFieldsById=t(function(m,y){return m.id-y.id},"compareFieldsById"),o.decorateType=t(function(m,y){if(m.$type)return y&&m.$type.name!==y&&(o.decorateRoot.remove(m.$type),m.$type.name=y,o.decorateRoot.add(m.$type)),m.$type;d||(d=n(35));var b=new d(y||m.name);return o.decorateRoot.add(b),b.ctor=m,Object.defineProperty(m,"$type",{value:b,enumerable:!1}),Object.defineProperty(m.prototype,"$type",{value:b,enumerable:!1}),b},"decorateType");var h=0;o.decorateEnum=t(function(m){if(m.$type)return m.$type;l||(l=n(15));var y=new l("Enum"+h++,m);return o.decorateRoot.add(y),Object.defineProperty(m,"$type",{value:y,enumerable:!1}),y},"decorateEnum"),Object.defineProperty(o,"decorateRoot",{get:t(function(){return u.decorated||(u.decorated=new(n(29)))},"get")})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(n,i,c){i.exports=u;var o=n(39);function u(f,p){this.lo=f>>>0,this.hi=p>>>0}a(u,"d"),t(u,"LongBits");var d=u.zero=new u(0,0);d.toNumber=function(){return 0},d.zzEncode=d.zzDecode=function(){return this},d.length=function(){return 1};var l=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=t(function(f){if(f===0)return d;var p=f<0;p&&(f=-f);var h=f>>>0,m=(f-h)/4294967296>>>0;return p&&(m=~m>>>0,h=~h>>>0,++h>4294967295&&(h=0,++m>4294967295&&(m=0))),new u(h,m)},"fromNumber"),u.from=t(function(f){if(typeof f=="number")return u.fromNumber(f);if(o.isString(f))if(o.Long)f=o.Long.fromString(f);else return u.fromNumber(parseInt(f,10));return f.low||f.high?new u(f.low>>>0,f.high>>>0):d},"from"),u.prototype.toNumber=t(function(f){if(!f&&this.hi>>>31){var p=~this.lo+1>>>0,h=~this.hi>>>0;return p||(h=h+1>>>0),-(p+h*4294967296)}return this.lo+this.hi*4294967296},"toNumber"),u.prototype.toLong=t(function(f){return o.Long?new o.Long(this.lo|0,this.hi|0,!!f):{low:this.lo|0,high:this.hi|0,unsigned:!!f}},"toLong");var g=String.prototype.charCodeAt;u.fromHash=t(function(f){return f===l?d:new u((g.call(f,0)|g.call(f,1)<<8|g.call(f,2)<<16|g.call(f,3)<<24)>>>0,(g.call(f,4)|g.call(f,5)<<8|g.call(f,6)<<16|g.call(f,7)<<24)>>>0)},"fromHash"),u.prototype.toHash=t(function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},"toHash"),u.prototype.zzEncode=t(function(){var f=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^f)>>>0,this.lo=(this.lo<<1^f)>>>0,this},"zzEncode"),u.prototype.zzDecode=t(function(){var f=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^f)>>>0,this.hi=(this.hi>>>1^f)>>>0,this},"zzDecode"),u.prototype.length=t(function(){var f=this.lo,p=(this.lo>>>28|this.hi<<4)>>>0,h=this.hi>>>24;return h===0?p===0?f<16384?f<128?1:2:f<2097152?3:4:p<16384?p<128?5:6:p<2097152?7:8:h<128?9:10},"length")},{39:39}],39:[function(n,i,c){var o=c;o.asPromise=n(1),o.base64=n(2),o.EventEmitter=n(4),o.float=n(6),o.inquire=n(7),o.utf8=n(10),o.pool=n(9),o.LongBits=n(38),o.emptyArray=Object.freeze?Object.freeze([]):[],o.emptyObject=Object.freeze?Object.freeze({}):{},o.isNode=!!(yr.process&&yr.process.versions&&yr.process.versions.node),o.isInteger=Number.isInteger||t(function(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l},"isInteger"),o.isString=t(function(l){return typeof l=="string"||l instanceof String},"isString"),o.isObject=t(function(l){return l&&typeof l=="object"},"isObject"),o.isset=o.isSet=t(function(l,g){var f=l[g];return f!=null&&l.hasOwnProperty(g)?typeof f!="object"||(Array.isArray(f)?f.length:Object.keys(f).length)>0:!1},"isSet"),o.Buffer=(function(){try{var l=o.inquire("buffer").Buffer;return l.prototype.utf8Write?l:null}catch{return null}})(),o._Buffer_from=null,o._Buffer_allocUnsafe=null,o.newBuffer=t(function(l){return typeof l=="number"?o.Buffer?o._Buffer_allocUnsafe(l):new o.Array(l):o.Buffer?o._Buffer_from(l):typeof Uint8Array>"u"?l:new Uint8Array(l)},"newBuffer"),o.Array=typeof Uint8Array<"u"?Uint8Array:Array,o.Long=yr.dcodeIO&&yr.dcodeIO.Long||o.inquire("long"),o.key2Re=/^true|false|0|1$/,o.key32Re=/^-?(?:0|[1-9][0-9]*)$/,o.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,o.longToHash=t(function(l){return l?o.LongBits.from(l).toHash():o.LongBits.zeroHash},"longToHash"),o.longFromHash=t(function(l,g){var f=o.LongBits.fromHash(l);return o.Long?o.Long.fromBits(f.lo,f.hi,g):f.toNumber(!!g)},"longFromHash");function u(l,g,f){for(var p=Object.keys(g),h=0;h<p.length;++h)(l[p[h]]===s||!f)&&(l[p[h]]=g[p[h]]);return l}a(u,"d"),t(u,"merge"),o.merge=u,o.lcFirst=t(function(l){return l.charAt(0).toLowerCase()+l.substring(1)},"lcFirst");function d(l){function g(f,p){if(!(this instanceof g))return new g(f,p);Object.defineProperty(this,"message",{get:t(function(){return f},"get")}),Error.captureStackTrace?Error.captureStackTrace(this,g):Object.defineProperty(this,"stack",{value:new Error().stack||""}),p&&u(this,p)}return a(g,"a"),t(g,"CustomError"),(g.prototype=Object.create(Error.prototype)).constructor=g,Object.defineProperty(g.prototype,"name",{get:t(function(){return l},"get")}),g.prototype.toString=t(function(){return this.name+": "+this.message},"toString"),g}a(d,"c"),t(d,"newError"),o.newError=d,o.ProtocolError=d("ProtocolError"),o.oneOfGetter=t(function(l){for(var g={},f=0;f<l.length;++f)g[l[f]]=1;return function(){for(var p=Object.keys(this),h=p.length-1;h>-1;--h)if(g[p[h]]===1&&this[p[h]]!==s&&this[p[h]]!==null)return p[h]}},"getOneOf"),o.oneOfSetter=t(function(l){return function(g){for(var f=0;f<l.length;++f)l[f]!==g&&delete this[l[f]]}},"setOneOf"),o.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},o._configure=function(){var l=o.Buffer;if(!l){o._Buffer_from=o._Buffer_allocUnsafe=null;return}o._Buffer_from=l.from!==Uint8Array.from&&l.from||t(function(g,f){return new l(g,f)},"Buffer_from"),o._Buffer_allocUnsafe=l.allocUnsafe||t(function(g){return new l(g)},"Buffer_allocUnsafe")}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(n,i,c){i.exports=f;var o=n(15),u=n(37);function d(p,h){return p.name+": "+h+(p.repeated&&h!=="array"?"[]":p.map&&h!=="object"?"{k:"+p.keyType+"}":"")+" expected"}a(d,"c"),t(d,"invalid");function l(p,h,m,y){if(h.resolvedType)if(h.resolvedType instanceof o){p("switch(%s){",y)("default:")("return%j",d(h,"enum value"));for(var b=Object.keys(h.resolvedType.values),w=0;w<b.length;++w)p("case %i:",h.resolvedType.values[b[w]]);p("break")("}")}else p("{")("var e=types[%i].verify(%s);",m,y)("if(e)")("return%j+e",h.name+".")("}");else switch(h.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":p("if(!util.isInteger(%s))",y)("return%j",d(h,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":p("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",y,y,y,y)("return%j",d(h,"integer|Long"));break;case"float":case"double":p('if(typeof %s!=="number")',y)("return%j",d(h,"number"));break;case"bool":p('if(typeof %s!=="boolean")',y)("return%j",d(h,"boolean"));break;case"string":p("if(!util.isString(%s))",y)("return%j",d(h,"string"));break;case"bytes":p('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',y,y,y)("return%j",d(h,"buffer"));break}return p}a(l,"u"),t(l,"genVerifyValue");function g(p,h,m){switch(h.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":p("if(!util.key32Re.test(%s))",m)("return%j",d(h,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":p("if(!util.key64Re.test(%s))",m)("return%j",d(h,"integer|Long key"));break;case"bool":p("if(!util.key2Re.test(%s))",m)("return%j",d(h,"boolean key"));break}return p}a(g,"a"),t(g,"genVerifyKey");function f(p){var h=u.codegen(["m"],p.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),m=p.oneofsArray,y={};m.length&&h("var p={}");for(var b=0;b<p.fieldsArray.length;++b){var w=p._fieldsArray[b].resolve(),_="m"+u.safeProp(w.name);if(w.optional&&h("if(%s!=null&&m.hasOwnProperty(%j)){",_,w.name),w.map)h("if(!util.isObject(%s))",_)("return%j",d(w,"object"))("var k=Object.keys(%s)",_)("for(var i=0;i<k.length;++i){"),g(h,w,"k[i]"),l(h,w,b,_+"[k[i]]")("}");else if(w.repeated)h("if(!Array.isArray(%s))",_)("return%j",d(w,"array"))("for(var i=0;i<%s.length;++i){",_),l(h,w,b,_+"[i]")("}");else{if(w.partOf){var S=u.safeProp(w.partOf.name);y[w.partOf.name]===1&&h("if(p%s===1)",S)("return%j",w.partOf.name+": multiple values"),y[w.partOf.name]=1,h("p%s=1",S)}l(h,w,b,_)}w.optional&&h("}")}return h("return null")}a(f,"s"),t(f,"verifier")},{15:15,37:37}],41:[function(n,i,c){var o=c,u=n(21);o[".google.protobuf.Any"]={fromObject:t(function(d){if(d&&d["@type"]){var l=this.lookup(d["@type"]);if(l){var g=d["@type"].charAt(0)==="."?d["@type"].substr(1):d["@type"];return this.create({type_url:"/"+g,value:l.encode(l.fromObject(d)).finish()})}}return this.fromObject(d)},"fromObject"),toObject:t(function(d,l){if(l&&l.json&&d.type_url&&d.value){var g=d.type_url.substring(d.type_url.lastIndexOf("/")+1),f=this.lookup(g);f&&(d=f.decode(d.value))}if(!(d instanceof this.ctor)&&d instanceof u){var p=d.$type.toObject(d,l);return p["@type"]=d.$type.fullName,p}return this.toObject(d,l)},"toObject")}},{21:21}],42:[function(n,i,c){i.exports=m;var o=n(39),u,d=o.LongBits,l=o.base64,g=o.utf8;function f(v,I,E){this.fn=v,this.len=I,this.next=s,this.val=E}a(f,"s"),t(f,"Op");function p(){}a(p,"t"),t(p,"noop");function h(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}a(h,"r"),t(h,"State");function m(){this.len=0,this.head=new f(p,0,0),this.tail=this.head,this.states=null}a(m,"e"),t(m,"Writer"),m.create=o.Buffer?t(function(){return(m.create=t(function(){return new u},"create_buffer"))()},"create_buffer_setup"):t(function(){return new m},"create_array"),m.alloc=t(function(v){return new o.Array(v)},"alloc"),o.Array!==Array&&(m.alloc=o.pool(m.alloc,o.Array.prototype.subarray)),m.prototype._push=t(function(v,I,E){return this.tail=this.tail.next=new f(v,I,E),this.len+=I,this},"push");function y(v,I,E){I[E]=v&255}a(y,"f"),t(y,"writeByte");function b(v,I,E){for(;v>127;)I[E++]=v&127|128,v>>>=7;I[E]=v}a(b,"n"),t(b,"writeVarint32");function w(v,I){this.len=v,this.next=s,this.val=I}a(w,"o"),t(w,"VarintOp"),w.prototype=Object.create(f.prototype),w.prototype.fn=b,m.prototype.uint32=t(function(v){return this.len+=(this.tail=this.tail.next=new w((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},"write_uint32"),m.prototype.int32=t(function(v){return v<0?this._push(_,10,d.fromNumber(v)):this.uint32(v)},"write_int32"),m.prototype.sint32=t(function(v){return this.uint32((v<<1^v>>31)>>>0)},"write_sint32");function _(v,I,E){for(;v.hi;)I[E++]=v.lo&127|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;v.lo>127;)I[E++]=v.lo&127|128,v.lo=v.lo>>>7;I[E++]=v.lo}a(_,"p"),t(_,"writeVarint64"),m.prototype.uint64=t(function(v){var I=d.from(v);return this._push(_,I.length(),I)},"write_uint64"),m.prototype.int64=m.prototype.uint64,m.prototype.sint64=t(function(v){var I=d.from(v).zzEncode();return this._push(_,I.length(),I)},"write_sint64"),m.prototype.bool=t(function(v){return this._push(y,1,v?1:0)},"write_bool");function S(v,I,E){I[E]=v&255,I[E+1]=v>>>8&255,I[E+2]=v>>>16&255,I[E+3]=v>>>24}a(S,"h"),t(S,"writeFixed32"),m.prototype.fixed32=t(function(v){return this._push(S,4,v>>>0)},"write_fixed32"),m.prototype.sfixed32=m.prototype.fixed32,m.prototype.fixed64=t(function(v){var I=d.from(v);return this._push(S,4,I.lo)._push(S,4,I.hi)},"write_fixed64"),m.prototype.sfixed64=m.prototype.fixed64,m.prototype.float=t(function(v){return this._push(o.float.writeFloatLE,4,v)},"write_float"),m.prototype.double=t(function(v){return this._push(o.float.writeDoubleLE,8,v)},"write_double");var k=o.Array.prototype.set?t(function(v,I,E){I.set(v,E)},"writeBytes_set"):t(function(v,I,E){for(var T=0;T<v.length;++T)I[E+T]=v[T]},"writeBytes_for");m.prototype.bytes=t(function(v){var I=v.length>>>0;if(!I)return this._push(y,1,0);if(o.isString(v)){var E=m.alloc(I=l.length(v));l.decode(v,E,0),v=E}return this.uint32(I)._push(k,I,v)},"write_bytes"),m.prototype.string=t(function(v){var I=g.length(v);return I?this.uint32(I)._push(g.write,I,v):this._push(y,1,0)},"write_string"),m.prototype.fork=t(function(){return this.states=new h(this),this.head=this.tail=new f(p,0,0),this.len=0,this},"fork"),m.prototype.reset=t(function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new f(p,0,0),this.len=0),this},"reset"),m.prototype.ldelim=t(function(){var v=this.head,I=this.tail,E=this.len;return this.reset().uint32(E),E&&(this.tail.next=v.next,this.tail=I,this.len+=E),this},"ldelim"),m.prototype.finish=t(function(){for(var v=this.head.next,I=this.constructor.alloc(this.len),E=0;v;)v.fn(v.val,I,E),E+=v.len,v=v.next;return I},"finish"),m._configure=function(v){u=v}},{39:39}],43:[function(n,i,c){i.exports=l;var o=n(42);(l.prototype=Object.create(o.prototype)).constructor=l;var u=n(39),d=u.Buffer;function l(){o.call(this)}a(l,"u"),t(l,"BufferWriter"),l.alloc=t(function(p){return(l.alloc=u._Buffer_allocUnsafe)(p)},"alloc_buffer");var g=d&&d.prototype instanceof Uint8Array&&d.prototype.set.name==="set"?t(function(p,h,m){h.set(p,m)},"writeBytesBuffer_set"):t(function(p,h,m){if(p.copy)p.copy(h,m,0,p.length);else for(var y=0;y<p.length;)h[m++]=p[y++]},"writeBytesBuffer_copy");l.prototype.bytes=t(function(p){u.isString(p)&&(p=u._Buffer_from(p,"base64"));var h=p.length>>>0;return this.uint32(h),h&&this._push(g,h,p),this},"write_bytes_buffer");function f(p,h,m){p.length<40?u.utf8.write(p,h,m):h.utf8Write(p,m)}a(f,"s"),t(f,"writeStringBuffer"),l.prototype.string=t(function(p){var h=d.byteLength(p);return this.uint32(h),h&&this._push(f,h,p),this},"write_string_buffer")},{39:39,42:42}]},{},[19])})()})(An)),An.exports}a(Km,"requireProtobuf");var Xm=Km();const br=Zm(Xm);var Qm=Object.defineProperty,x=a((r,e)=>Qm(r,"name",{value:e,configurable:!0}),"s$3");let te=br.Reader,Ne=br.Writer,Ee=br.util;const F=br.roots["push-server"]||(br.roots["push-server"]={});F.RequestBatch=(function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"RequestBatch"),r.prototype.requests=Ee.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.requests!=null&&e.requests.length)for(var s=0;s<e.requests.length;++s)F.Request.encode(e.requests[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.RequestBatch;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.requests&&n.requests.length||(n.requests=[]),n.requests.push(F.Request.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.Request=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),x(r,"Request"),r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:Ee.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:Ee.oneOfSetter(e)}),r.create=x(function(t){return new r(t)},"create"),r.encode=x(function(t,s){return s||(s=Ne.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&F.IncomingMessagesRequest.encode(t.incomingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&F.ChannelStatsRequest.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&F.ServerStatsRequest.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=x(function(t,s){t instanceof te||(t=te.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new F.Request;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.incomingMessages=F.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=F.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=F.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),F.IncomingMessagesRequest=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"IncomingMessagesRequest"),r.prototype.messages=Ee.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)F.IncomingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.IncomingMessagesRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.messages&&n.messages.length||(n.messages=[]),n.messages.push(F.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.IncomingMessage=(function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"IncomingMessage"),r.prototype.receivers=Ee.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.receivers!=null&&e.receivers.length)for(var s=0;s<e.receivers.length;++s)F.Receiver.encode(e.receivers[s],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&F.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.IncomingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.receivers&&n.receivers.length||(n.receivers=[]),n.receivers.push(F.Receiver.decode(e,e.uint32()));break;case 2:n.sender=F.Sender.decode(e,e.uint32());break;case 3:n.body=e.string();break;case 4:n.expiry=e.uint32();break;case 5:n.type=e.string();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelStatsRequest=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelStatsRequest"),r.prototype.channels=Ee.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)F.ChannelId.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelStatsRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.channels&&n.channels.length||(n.channels=[]),n.channels.push(F.ChannelId.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelId=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelId"),r.prototype.id=Ee.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=Ee.newBuffer([]),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelId;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ServerStatsRequest=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ServerStatsRequest"),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ServerStatsRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return n},"decode"),r})(),F.Sender=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"Sender"),r.prototype.type=0,r.prototype.id=Ee.newBuffer([]),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.Sender;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.type=e.int32();break;case 2:n.id=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.SenderType=(function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e})(),F.Receiver=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"Receiver"),r.prototype.id=Ee.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=Ee.newBuffer([]),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.Receiver;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ResponseBatch=(function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ResponseBatch"),r.prototype.responses=Ee.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.responses!=null&&e.responses.length)for(var s=0;s<e.responses.length;++s)F.Response.encode(e.responses[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ResponseBatch;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.responses&&n.responses.length||(n.responses=[]),n.responses.push(F.Response.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.Response=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),x(r,"Response"),r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:Ee.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:Ee.oneOfSetter(e)}),r.create=x(function(t){return new r(t)},"create"),r.encode=x(function(t,s){return s||(s=Ne.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&F.OutgoingMessagesResponse.encode(t.outgoingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&F.ChannelStatsResponse.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&F.JsonResponse.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=x(function(t,s){t instanceof te||(t=te.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new F.Response;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.outgoingMessages=F.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=F.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=F.JsonResponse.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),F.OutgoingMessagesResponse=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"OutgoingMessagesResponse"),r.prototype.messages=Ee.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)F.OutgoingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.OutgoingMessagesResponse;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.messages&&n.messages.length||(n.messages=[]),n.messages.push(F.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.OutgoingMessage=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"OutgoingMessage"),r.prototype.id=Ee.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&F.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.OutgoingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.body=e.string();break;case 3:n.expiry=e.uint32();break;case 4:n.created=e.fixed32();break;case 5:n.sender=F.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelStatsResponse=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelStatsResponse"),r.prototype.channels=Ee.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)F.ChannelStats.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelStatsResponse;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.channels&&n.channels.length||(n.channels=[]),n.channels.push(F.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelStats=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelStats"),r.prototype.id=Ee.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelStats;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.isOnline=e.bool();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.JsonResponse=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"JsonResponse"),r.prototype.json="",r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.JsonResponse;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.json=e.string();break;default:e.skipType(i&7);break}}return n},"decode"),r})();const ey=F.ResponseBatch,Xa=F.RequestBatch,ty=F.IncomingMessage,Qa=F.Receiver;var ry=Object.defineProperty,sy=a((r,e)=>ry(r,"name",{value:e,configurable:!0}),"o$1");class ec{static{a(this,"AbstractConnector")}static{sy(this,"AbstractConnector")}_logger;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._logger=ee.createNullLogger(),this._parent=e.parent,this._connectionType=he.Undefined,this._callbacks={onOpen:L.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:L.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:L.isFunction(e.onError)?e.onError:()=>{},onMessage:L.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}var ny=Object.defineProperty,iy=a((r,e)=>ny(r,"name",{value:e,configurable:!0}),"s$2");class oy extends ec{static{a(this,"WebSocketConnector")}static{iy(this,"WebSocketConnector")}_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=he.WebSocket,this._socket=null,this._onSocketOpenHandler=this._onSocketOpen.bind(this),this._onSocketCloseHandler=this._onSocketClose.bind(this),this._onSocketErrorHandler=this._onSocketError.bind(this),this._onSocketMessageHandler=this._onSocketMessage.bind(this)}destroy(){super.destroy(),this._socket&&(this._socket.close(),this._socket=null)}connect(){if(this._socket){if(this._socket.readyState===1)return;this.clearEventListener(),this._socket.close(),this._socket=null}this._createSocket()}get socket(){return this._socket}disconnect(e,t){this._socket!==null&&(this.clearEventListener(),this._socket.close(e,t)),this._socket=null,this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}send(e){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(`${H.getDateForLog()}: Pull: WebSocket is not connected`),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}var ay=Object.defineProperty,cy=a((r,e)=>ay(r,"name",{value:e,configurable:!0}),"s$1");const ly=60;class uy extends ec{static{a(this,"LongPollingConnector")}static{cy(this,"LongPollingConnector")}_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=he.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=this.createXhr(),this._requestAborted=!1}connect(){this._active=!0,this.performRequest()}disconnect(e,t){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}performRequest(){if(this._active){if(!this.connectionPath)throw new Error("Long polling connection path is not defined");this._xhr.readyState!==0&&this._xhr.readyState!==4||(this.clearTimeOut(),this._failureTimeout=setTimeout(()=>{this.connected=!0},5e3),this._requestTimeout=setTimeout(this.onRequestTimeout.bind(this),ly*1e3),this._xhr.open("GET",this.connectionPath),this._xhr.send())}}onRequestTimeout(){this._requestAborted=!0,this._xhr.abort(),this.performRequest()}onXhrReadyStateChange(){this._xhr.readyState===4&&((!this._requestAborted||this._xhr.status==200)&&this.onResponse(this._xhr.response),this._requestAborted=!1)}send(e){const t=this._parent.getPublicationPath();if(!t)return this.getLogger().error(`${H.getDateForLog()}: Pull: publication path is empty`),!1;const s=new XMLHttpRequest;return s.open("POST",t),s.send(e),!0}onResponse(e){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,L.isStringFilled(e)||e instanceof ArrayBuffer?this._callbacks.onMessage(e):this._parent.session.mid=null,this.performRequest();else if(this._xhr.status===304){if(this.connected=!0,this._xhr.getResponseHeader("Expires")==="Thu, 01 Jan 1973 11:11:01 GMT"){const t=this._xhr.getResponseHeader("Last-Message-Id");L.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}var hy=Object.defineProperty,tc=a((r,e)=>hy(r,"name",{value:e,configurable:!0}),"v");const _r=19,rc=1800,dy=5e3,fy=60*1e3,sc=10,nc=10,py="ping",gy="pong",ic="bx-pull-session",my=20,oc={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class ac{static{a(this,"PullClient")}static{tc(this,"PullClient")}_logger;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=he.WebSocket;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[he.Undefined]:null,[he.WebSocket]:null,[he.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._logger=ee.createNullLogger(),this._restClient=e.b24,this._status=Ve.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),L.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?H.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?H.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?H.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=L.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=L.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=L.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,L.isUndefined(e.configTimestamp)||(this._configTimestamp=H.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new Ya({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new zm({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new Ym({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this.stop(Re.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new oy({parent:this,onOpen:this.onWebSocketOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onWebSocketDisconnect.bind(this),onError:this.onWebSocketError.bind(this)}),this._connectors.longPolling=new uy({parent:this,onOpen:this.onLongPollingOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onLongPollingDisconnect.bind(this),onError:this.onLongPollingError.bind(this)}),this._connectionType=this.isWebSocketAllowed()?he.WebSocket:he.LongPolling,window.addEventListener("beforeunload",this.onBeforeUnload.bind(this)),window.addEventListener("offline",this.onOffline.bind(this)),window.addEventListener("online",this.onOnline.bind(this)),this._jsonRpcAdapter=new qm({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}})}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===Ve.Offline?this.sendPullStatusDelayed(e,dy):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!L.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||qe.Server,e.command=e.command||null,e.type==qe.Server||e.type==qe.Client){if(typeof e.moduleId>"u")throw new TypeError(`${H.getDateForLog()}: Pull.subscribe: parameter moduleId is not specified`);return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),e.command?(typeof this._subscribers[e.type][e.moduleId].commands[e.command]>"u"&&(this._subscribers[e.type][e.moduleId].commands[e.command]=[]),this._subscribers[e.type][e.moduleId].commands[e.command].push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||typeof e.command>"u"||e.command===null||(this._subscribers[e.type][e.moduleId].commands[e.command]=this._subscribers[e.type][e.moduleId].commands[e.command].filter(t=>t!==e.callback))}):(this._subscribers[e.type][e.moduleId].callbacks.push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||(this._subscribers[e.type][e.moduleId].callbacks=this._subscribers[e.type][e.moduleId].callbacks.filter(t=>t!==e.callback))})}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].push(e.callback),()=>{typeof e.type>"u"||(this._subscribers[e.type]=this._subscribers[e.type].filter(t=>t!==e.callback))}}attachCommandHandler(e){if(typeof e.getModuleId!="function"||typeof e.getModuleId()!="string")return this.getLogger().error(`${H.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=qe.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:tc(s=>{let n=null;if(typeof e.getMap=="function"){const i=e.getMap();if(i&&typeof i=="object"){const c=i[s.command];typeof c=="function"?n=c.bind(e):typeof c=="string"&&typeof e[c]=="function"&&(n=e[c].bind(e))}}if(!n){const i=`handle${H.capitalize(s.command)}`;typeof e[i]=="function"&&(n=e[i].bind(e))}n&&(this._debug&&this._context!=="master"&&this.getLogger().warning(`${H.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,{data:s}),n(s.params,s.extra,s.command))},"callback")})}async start(e=null){let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let s=!1;if(e&&L.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(s=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const n=Date.now();let i;return!s&&this._storage&&(i=this._storage.get(ic,null)),L.isPlainObject(i)&&Object.prototype.hasOwnProperty.call(i,"ttl")&&i.ttl>=n&&(this._session.mid=i.mid),this._starting=!0,this._startingPromise=new Promise((c,o)=>{this.loadConfig("client_start").then(u=>{this.setConfig(u,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>c(!0),d=>o(d))}).catch(u=>{this._starting=!1,this.status=Ve.Offline,this.stopCheckConfig(),this.getLogger().error(`${H.getDateForLog()}: Pull: could not read push-server config`,{error:u}),o(u)})})}restart(e=Re.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().debug(`${H.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(Ue.PullConfig),this._config=null;const s=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(s).then(n=>{this.setConfig(n,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error("restart error",{error:i})})},n=>{this.getLogger().error(`${H.getDateForLog()}: Pull: could not read push-server config `,{error:n}),this.status=Ve.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(n?.status==401||n?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=Re.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,s=1){this.disconnect(e,t),this.scheduleReconnect(s)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,s,n,i){const c={userList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Publish,c):this.sendMessageBatch([c])}async sendMessageToChannels(e,t,s,n,i){const c={channelList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Publish,c):this.sendMessageBatch([c])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!L.isArray(e)||!e.every(s=>typeof s=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.GetUsersLastSeen,{userList:e}).then(i=>{const c=[];for(let u=0;u<e.length;u++)Object.prototype.hasOwnProperty.call(i,e[u])||c.push(e[u]);if(c.length===0)return s(t);const o={userIds:c,sendToQueueSever:!0};this._restClient.actions.v2.call.make({method:"pull.api.user.getLastSeen",params:o}).then(u=>{const d=u.getData().result;for(const l in d)t[Number(l)]=Number(d[l]);return s(t)}).catch(u=>{this.getLogger().error("getUsersLastSeen",{error:u}),n(u)})}).catch(i=>{this.getLogger().error("getUsersLastSeen",{error:i}),n(i)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),L.isFunction(t)&&this._userStatusCallbacks[e].push(t),s())).catch(i=>n(i))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(s=>s!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text"),{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const s={};switch(e){case he.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case he.LongPolling:t=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${e}`)}if(!L.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")s.token=this._config?.jwt;else{const n=[];if(this._config?.channels?.private&&n.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&n.push(this._config.channels.private.id),this._config?.channels.shared?.id&&n.push(this._config.channels.shared.id),n.length===0)throw new Error("Empty channels");s.CHANNEL_ID=n.join("/")}if(this.isJsonRpc()?s.jsonRpc="true":this.isProtobufSupported()&&(s.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");s.clientId=this._config.clientId}return this._session.mid&&(s.mid=this._session.mid),this._session.tag&&(s.tag=this._session.tag),this._session.time&&(s.time=this._session.time),s.revision=_r,`${t}?${H.buildQueryString(s)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const s={CHANNEL_ID:t.join("/")};return e+"?"+H.buildQueryString(s)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!Oo.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===Hs.Shared}emit(e){if(e.type==qe.Server||e.type==qe.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${H.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId??"?"})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),s=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=Math.max(e.extra.server_time_ago,0)),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Vr.Client?(this.onCustomEvent("onPullClientEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,s,e.params,e.extra],!0),this.emit({type:qe.Client,moduleId:t,data:{command:s,params:L.clone(e.params),extra:L.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(s,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[s,e.params,e.extra],!0),this.emit({type:qe.Online,data:{command:s,params:L.clone(e.params),extra:L.clone(e.extra)}})),s==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,s,e.params,e.extra],!0),this.emit({type:qe.Server,moduleId:t,data:{command:s,params:L.clone(e.params),extra:L.clone(e.extra)}}))}catch(n){this.getLogger().warning("PULL ERROR",{errorType:"broadcastMessages execute error",errorEvent:n,message:e})}e.extra&&e.extra.revision_web&&this.checkRevision(H.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled"),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const s of e)if(typeof s.userList<"u")for(const n of s.userList){const i=Number(n);t[i]=i}this._channelManager?.getPublicIds(Object.values(t)).then(s=>{const n=this.connector?.send(this.encodeMessageBatch(e,s));return Promise.resolve(n)})}}encodeMessageBatch(e,t){const s=[];e.forEach(i=>{const c=i.body;let o=[];if(i.userList&&(o=this.createMessageReceivers(i.userList,t)),i.channelList){if(!L.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(d=>{let l,g;if(typeof d=="string"&&d.includes(".")){const f=d.toString().split(".");l=f[0],g=f[1]}else if(typeof d=="object"&&"publicId"in d&&"signature"in d)l=d?.publicId,g=d?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);o.push(Qa.create({id:this.encodeId(l),signature:this.encodeId(g)}))})}const u=ty.create({receivers:o,body:JSON.stringify(c),expiry:i.expiry||0});s.push(u)});const n=Xa.create({requests:[{incomingMessages:{messages:s}}]});return Xa.encode(n).finish()}createMessageReceivers(e,t){const s=[];for(const n of e){if(!t[n]||!t[n].publicId)throw new Error(`Could not determine public id for user ${n}`);s.push(Qa.create({id:this.encodeId(t[n].publicId),signature:this.encodeId(t[n].signature)}))}return s}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const s of this._userStatusCallbacks[e])s({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)Object.prototype.hasOwnProperty.call(this._userStatusCallbacks,e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.SubscribeStatusChange,{userId:e})}async loadConfig(e){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},oc)}else{this._config=Object.assign({},oc);let t;if(this._storage&&(t=this._storage.get(Ue.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(Ue.PullConfig)}return new Promise((t,s)=>{this._restClient.actions.v2.call.make({method:this._configGetMethod,params:{CACHE:"N"}}).then(n=>{const i=n.getData().result,c=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const o=Object.assign({},i);o.server.timeShift=c,t(o)}).catch(n=>{s(n)})})}isConfigActual(e){if(!L.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(L.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const s in e.channels){if(!Object.prototype.hasOwnProperty.call(e.channels,s))continue;const n=e.channels[s];if(new Date(n.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),fy)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(H.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(Re.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&Object.prototype.hasOwnProperty.call(this._config,s)&&(this._config[s]=e[s]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(Ue.PullConfig,e)}catch(s){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${H.getDateForLog()}: Pull: Could not cache config in local storage.`,{error:s})}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==_r?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(Re.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,_r]),this.emit({type:qe.Revision,data:{server:e,client:_r}}),this.logToConsole(`Pull revision changed from ${_r} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==he.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._enabled&&(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(t=>{this.getLogger().error("scheduleReconnect",{error:t})})},e*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${rc} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=null,this.restoreWebSocketConnection()},rc*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=Ve.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,s=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),s<1&&(s=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),s*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&L.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&L.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const s of e)this.updateSessionFromEvent(s),!(s.mid&&!this.checkDuplicate(s.mid))&&(this.addMessageToStat(s.text),t.push(s.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case lr.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const s=t.params?.channel.type;s==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.private}`)),s==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(Re.CONFIG_REPLACED,"config was replaced")}else this.restart(Re.CHANNEL_EXPIRED,"channel expired received");break}case lr.CONFIG_EXPIRE:{this.restart(Re.CONFIG_EXPIRED,"config expired received");break}case lr.SERVER_RESTART:{this.reconnect(Re.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===py?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Ve.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===he.LongPolling&&(this.status=Ve.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===he.LongPolling&&(this.status=Ve.Offline),this.getLogger().error(`${H.getDateForLog()}: Pull: Long polling connection error`,{error:e}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===he.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=he.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===he.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=he.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Ve.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==he.LongPolling&&(this._connectionType=he.WebSocket,this._connectors.longPolling?.disconnect(Re.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===he.WebSocket&&(this.status=Ve.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==Re.WRONG_CHANNEL_ID?this.scheduleRestart(Re.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===he.WebSocket&&(this.status=Ve.Offline),this.getLogger().error(`${H.getDateForLog()}: Pull: WebSocket connection error`,{error:e}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(L.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const s=ey.decode(new Uint8Array(e));for(let n=0;n<s.responses.length;n++){const i=s.responses[n];if(i.command!=="outgoingMessages")continue;const c=i.outgoingMessages.messages;for(const o of c){let u;try{u=JSON.parse(o.body)}catch(l){this.getLogger().error(`${H.getDateForLog()}: Pull: Could not parse message body`,{error:l});continue}u.extra||(u.extra={}),u.extra.sender={type:o.sender.type},o.sender.id instanceof Uint8Array&&(u.extra.sender.id=this.decodeId(o.sender.id));const d={mid:this.decodeId(o.id),text:u};t.push(d)}}}catch(s){this.getLogger().error(`${H.getDateForLog()}: Pull: Could not parse message`,{error:s})}return t}extractPlainTextMessages(e){const t=[],s=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/g);if(s===null)return this.getLogger().warning("PULL ERROR",{errorType:"parseResponse error parsing message",dataString:e}),[];for(let n=0;n<s.length;n++){if(s[n]=s[n].substring(12,s[n].length-12),s[n].length<=0)continue;let i;try{i=JSON.parse(s[n])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const s of e){const n=s.toString(16);n.length===1&&(t+="0"),t+=n}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let s=0;s<e.length;s+=2)t.push(Number.parseInt(e.slice(s,s+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(Re.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error("onOnline",{error:e})})}onBeforeUnload(){this._unloading=!0;const e=L.clone(this.session);if(e.ttl=Date.now()+my*1e3,this._storage)try{this._storage.set(ic,JSON.stringify(e))}catch(t){this.getLogger().error(`${H.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,{error:t})}this.scheduleReconnect(15)}sendPullStatusDelayed(e,t){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:qe.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.actions.v2.call.make({method:"pull.watch.extend",params:{tags:t}}).then(s=>{const n=s.getData().result;for(const i of n)this.clearWatch(i);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(gy)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,nc*2*1e3)}clearPingWaitTimeout(){this._pingWaitTimeout&&clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null}onPingTimeout(){this._pingWaitTimeout=null,!(!this._enabled||!this.isConnected())&&(this.getLogger().warning(`No pings are received in ${nc*2} seconds. Reconnecting`),this.disconnect(Re.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warning(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>sc&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-sc))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Vr.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,{command:e.command,params:e.params,extra:e.extra}):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",{command:e.command,params:e.params,extra:e.extra}):this.getLogger().info("onPullEvent",{moduleId:e.module_id,command:e.command,params:e.params,extra:e.extra}))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().debug(`${H.getDateForLog()}: ${e}`)}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().notice(e)}onCustomEvent(e,t,s=!1){}}var yy=Object.defineProperty,by=a((r,e)=>yy(r,"name",{value:e,configurable:!0}),"l$1");class _y{static{a(this,"B24HelperManager")}static{by(this,"B24HelperManager")}_b24;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";_logger;constructor(e){this._logger=ee.createNullLogger(),this._b24=e}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this._destroyPullClient()}async loadData(e=[le.App,le.Profile]){const t={[le.App]:{method:"app.info"},[le.Profile]:{method:"profile"},[le.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[le.AppOptions]:{method:"app.option.get"},[le.UserOptions]:{method:"user.option.get"}},s=e.reduce((n,i)=>{if(t[i])if(Array.isArray(t[i]))for(const[c,o]of t[i].entries())n[`get_${i}_${c}`]=o;else n[`get_${i}`]=t[i];return n},{});try{const n=(await this._b24.callBatch(s)).getData();n[`get_${le.App}`]&&(this._app=await this.parseAppData(n[`get_${le.App}`]),this._payment=await this.parsePaymentData(n[`get_${le.App}`]),this._license=await this.parseLicenseData(n[`get_${le.App}`])),n[`get_${le.Profile}`]&&(this._profile=await this.parseUserData(n[`get_${le.Profile}`])),n[`get_${le.Currency}_0`]&&n[`get_${le.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:n[`get_${le.Currency}_0`],currencyList:n[`get_${le.Currency}_1`]})),n[`get_${le.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",n[`get_${le.AppOptions}`])),n[`get_${le.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",n[`get_${le.UserOptions}`])),this._isInit=!0}catch(n){throw n instanceof Error?n:(this.getLogger().error("Failed to load data",{error:n}),new Error("Failed to load data"))}}async parseUserData(e){const t=new Sm(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number(e.ID),isAdmin:e.ADMIN===!0,lastName:e?.LAST_NAME||"",name:e?.NAME||"",gender:e?.PERSONAL_GENDER||"",photo:e?.PERSONAL_PHOTO||"",TimeZone:e?.TIME_ZONE||"",TimeZoneOffset:e?.TIME_ZONE_OFFSET}).then(()=>t)}async parseAppData(e){const t=new Om(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number.parseInt(e.ID),code:e.CODE,version:Number.parseInt(e.VERSION),status:e.STATUS,isInstalled:e.INSTALLED}).then(()=>t)}async parsePaymentData(e){const t=new Im(this._b24);return t.setLogger(this.getLogger()),t.initData({isExpired:e.PAYMENT_EXPIRED==="Y",days:Number.parseInt(e.DAYS||"0")}).then(()=>t)}async parseLicenseData(e){const t=new Cm(this._b24);return t.setLogger(this.getLogger()),t.initData({languageId:e.LANGUAGE_ID,license:e.LICENSE,licensePrevious:e.LICENSE_PREVIOUS,licenseType:e.LICENSE_TYPE,licenseFamily:e.LICENSE_FAMILY,isSelfHosted:e.LICENSE.includes("selfhosted")}).then(()=>t)}async parseCurrencyData(e){const t=new Mm(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const s=new In(this._b24,e);return s.setLogger(this.getLogger()),s.initData(t).then(()=>s)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[Tt.MainSettings]:"/configs/",[Tt.UfList]:"/configs/userfield_list.php",[Tt.UfPage]:"/configs/userfield.php"}:{[Tt.MainSettings]:"/settings/configs/",[Tt.UfList]:"/settings/configs/userfield_list.php",[Tt.UfPage]:"/settings/configs/userfield.php"}}usePullClient(e="prefix",t){return this._b24PullClient?this:(this.initializePullClient(typeof t>"u"?this.profileInfo.data.id||0:t,e),this)}initializePullClient(e,t="prefix"){this._b24PullClient=new ac({b24:this._b24,restApplication:this._b24.auth.getUniq(t),userId:e})}subscribePullClient(e,t="application"){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId=t,this._pullClientUnSubscribe.push(this._b24PullClient.subscribe({moduleId:this._pullClientModuleId,callback:e})),this}startPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");this._b24PullClient.start().catch(e=>{this.getLogger().error(`${H.getDateForLog()}: Pull not running`,{error:e})})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}var wy=Object.defineProperty,_t=a((r,e)=>wy(r,"name",{value:e,configurable:!0}),"l");const Sy=_t(()=>{let r=!1,e=!1,t=null;return{initB24Helper:_t(async(s,n=[le.App,le.Profile])=>(t===null&&(t=new _y(s)),r?t:t.loadData(n).then(()=>(r=!0,t))),"initB24Helper"),isInitB24Helper:_t(()=>r,"isInitB24Helper"),destroyB24Helper:_t(()=>{t?.destroy(),t=null,r=!1,e=!1},"destroyB24Helper"),getB24Helper:_t(()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return t},"getB24Helper"),usePullClient:_t(()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");t.usePullClient(),e=!0},"usePullClient"),useSubscribePullClient:_t((s,n="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(s,n)},"useSubscribePullClient"),startPullClient:_t(()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()},"startPullClient")}},"useB24Helper");var vy=Object.defineProperty,Rn=a((r,e)=>vy(r,"name",{value:e,configurable:!0}),"n");const Ey=50;let wt=null,is=!1,Yt=null,cc=!1,os=[],lc=!1;function Cn(){window.setTimeout(()=>{if(!is||wt===null){Cn();return}uc(),os=[]},Ey)}a(Cn,"p"),Rn(Cn,"startWatch");function uc(){if(Yt!==null)for(const r of os)r.reject(Yt);if(!(!is||wt===null))for(const r of os)r.resolve(wt)}a(uc,"I"),Rn(uc,"processResult");async function hc(r){return is&&wt!==null?Promise.resolve(wt):cc?(lc||(lc=!0,Cn()),new Promise((e,t)=>{os.push({resolve:e,reject:t})})):(cc=!0,new Promise((e,t)=>{const s={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,i,c]=window.name.split("|");s.DOMAIN=n,s.PROTOCOL=Number.parseInt(i??"0")===1,s.APP_SID=c,s.LANG=null}(!s.DOMAIN||!s.APP_SID)&&(Yt=new ne({code:"JSSDK_CLIENT_SIDE_WARNING",description:"Well done! Now paste this URL into the Bitrix24 app settings",status:500}),t(Yt)),wt=new Ha(s,r),wt.init().then(()=>{is=!0,e(wt)}).catch(n=>{Yt=n,t(Yt)})}))}a(hc,"initializeB24Frame"),Rn(hc,"initializeB24Frame"),R.AbstractB24=Wr,R.AbstractLogger=Us,R.AdaptiveDelayer=jo,R.AjaxError=be,R.AjaxResult=ur,R.ApiVersion=X,R.AppFrame=$a,R.AuthHookManager=Fa,R.AuthManager=Ba,R.AuthOAuthManager=Ja,R.B24Frame=Ha,R.B24Hook=kn,R.B24LangList=Js,R.B24LocaleMap=xh,R.B24OAuth=ym,R.B24PullClientManager=ac,R.Browser=Oo,R.CatalogProductImageType=Ro,R.CatalogProductType=Ao,R.CatalogRoundingRuleType=Co,R.CloseReasons=Re,R.ConnectionType=he,R.ConsolaAdapter=eh,R.ConsoleHandler=po,R.ConsoleV2Handler=js,R.DataType=mo,R.DialogManager=Va,R.EnumAppStatus=lt,R.EnumBitrix24Edition=No,R.EnumBizprocBaseType=Do,R.EnumBizprocDocumentType=Mo,R.EnumCrmEntityType=ko,R.EnumCrmEntityTypeId=Qe,R.EnumCrmEntityTypeShort=Ws,R.Environment=or,R.HttpV2=rs,R.HttpV3=ss,R.JsonFormatter=Ru,R.LineFormatter=xr,R.ListRpcError=zs,R.LoadDataType=le,R.LogLevel=W,R.Logger=cr,R.LoggerBrowser=Vs,R.LoggerFactory=ee,R.LoggerType=go,R.LsKeys=Ue,R.MemoryHandler=Gu,R.MessageCommands=ie,R.MessageManager=xa,R.NullLogger=ar,R.OperatingLimiter=Bo,R.OptionsManager=Ua,R.ParamsFactory=Gs,R.ParentManager=ja,R.PlacementManager=Wa,R.ProductRowDiscountTypeId=Io,R.PullStatus=Ve,R.RateLimiter=$o,R.RefreshTokenError=za,R.RestrictionManager=Uo,R.Result=Le,R.RpcMethod=st,R.SdkError=ne,R.SenderType=Vr,R.ServerMode=Hs,R.SliderManager=qa,R.StatusDescriptions=xo,R.StreamHandler=Ku,R.SubscriptionType=qe,R.SystemCommands=lr,R.TelegramFormatter=fo,R.TelegramHandler=ch,R.Text=H,R.Type=L,R.TypeOption=ut,R.TypeSpecificUrl=Tt,R.WinstonAdapter=sh,R.convertBizprocDocumentTypeToCrmEntityTypeId=Lo,R.getDocumentId=Po,R.getDocumentType=Ur,R.getDocumentTypeForFilter=Fo,R.getEnumCrmEntityTypeShort=To,R.getEnumValue=_o,R.getEnvironment=$r,R.initializeB24Frame=hc,R.isArrayOfArray=bo,R.memoryUsageProcessor=Bu,R.omit=qs,R.pick=yo,R.pidProcessor=Fu,R.useB24Helper=Sy,R.useFormatter=Vg,R.versionManager=nt}));
|
|
44
67
|
//# sourceMappingURL=index.min.js.map
|