@bitrix24/b24jssdk 0.1.1 → 0.1.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.
@@ -1,33 +1,41 @@
1
- (function(_,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(_=typeof globalThis<"u"?globalThis:_||self,S(_.B24Js=_.B24Js||{}))})(this,function(exports){"use strict";var LoggerType=(_=>(_.desktop="desktop",_.log="log",_.info="info",_.warn="warn",_.error="error",_.trace="trace",_))(LoggerType||{});const o=new Map;o.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"]),o.set("desktop",["%cDESKTOP","color: white; font-style: italic; background-color: #29619b; padding: 0 6px; border: 1px solid #29619b"]),o.set("log",["%cLOG","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]),o.set("info",["%cINFO","color: #fff; font-style: italic; background-color: #6b7f96; padding: 0 6px; border: 1px solid #6b7f96"]),o.set("warn",["%cWARNING","color: #f0a74f; font-style: italic; padding: 0 6px; border: 1px solid #f0a74f"]),o.set("error",["%cERROR","color: white; font-style: italic; background-color: #8a3232; padding: 0 6px; border: 1px solid #8a3232"]),o.set("trace",["%cTRACE","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]);class LoggerBrowser{#e;#t={desktop:!0,log:!1,info:!1,warn:!1,error:!0,trace:!0};static build(S,v=!1){const T=new LoggerBrowser(S);return v&&(T.enable("log"),T.enable("info"),T.enable("warn")),T}constructor(S){this.#e=S}#r(S){const v=[],T=[];if(o.has("title")){const O=o.get("title");O[0]&&(v.push(O[0].replace("#title#",this.#e)),T.push(O[1]||""))}if(o.has(S)){const O=o.get(S);O[0]&&(v.push(O[0]),T.push(O[1]||""))}return[v.join(""),...T]}setConfig(S){for(const v in S)this.#t[v]=S[v]}enable(S){return typeof this.#t[S]>"u"?!1:(this.#t[S]=!0,!0)}disable(S){return typeof this.#t[S]>"u"?!1:(this.#t[S]=!1,!0)}isEnabled(S){return this.#t[S]}desktop(...S){this.isEnabled("desktop")&&console.log(...this.#r("desktop"),...S)}log(...S){this.isEnabled("log")&&console.log(...this.#r("log"),...S)}info(...S){this.isEnabled("info")&&console.info(...this.#r("info"),...S)}warn(...S){this.isEnabled("warn")&&console.warn(...this.#r("warn"),...S)}error(...S){this.isEnabled("error")&&console.error(...this.#r("error"),...S)}trace(...S){this.isEnabled("trace")&&console.trace(...this.#r("trace"),...S)}}var DataType=(_=>(_.undefined="undefined",_.any="any",_.integer="integer",_.boolean="boolean",_.double="double",_.date="date",_.datetime="datetime",_.string="string",_.text="text",_.file="file",_.array="array",_.object="object",_.user="user",_.location="location",_.crmCategory="crm_category",_.crmStatus="crm_status",_.crmCurrency="crm_currency",_))(DataType||{});const r$2=Function.prototype.toString.call(Object);let s$3=class{getTag(S){return Object.prototype.toString.call(S)}isString(S){return S===""?!0:S?typeof S=="string"||S instanceof String:!1}isStringFilled(S){return this.isString(S)&&S!==""}isFunction(S){return S===null?!1:typeof S=="function"||S instanceof Function}isObject(S){return!!S&&(typeof S=="object"||typeof S=="function")}isObjectLike(S){return!!S&&typeof S=="object"}isPlainObject(S){if(!this.isObjectLike(S)||this.getTag(S)!=="[object Object]")return!1;const v=Object.getPrototypeOf(S);if(v===null)return!0;const T=v.hasOwnProperty("constructor")&&v.constructor;return typeof T=="function"&&Function.prototype.toString.call(T)===r$2}isJsonRpcRequest(S){return typeof S=="object"&&S&&"jsonrpc"in S&&this.isStringFilled(S.jsonrpc)&&"method"in S&&this.isStringFilled(S.method)}isJsonRpcResponse(S){return typeof S=="object"&&S&&"jsonrpc"in S&&this.isStringFilled(S.jsonrpc)&&"id"in S&&("result"in S||"error"in S)}isBoolean(S){return S===!0||S===!1}isNumber(S){return!Number.isNaN(S)&&typeof S=="number"}isInteger(S){return this.isNumber(S)&&S%1===0}isFloat(S){return this.isNumber(S)&&!this.isInteger(S)}isNil(S){return S==null}isArray(S){return!this.isNil(S)&&Array.isArray(S)}isArrayFilled(S){return this.isArray(S)&&S.length>0}isArrayLike(S){return!this.isNil(S)&&!this.isFunction(S)&&S.length>-1&&S.length<=Number.MAX_SAFE_INTEGER}isDate(S){return this.isObjectLike(S)&&this.getTag(S)==="[object Date]"}isDomNode(S){return this.isObjectLike(S)&&!this.isPlainObject(S)&&"nodeType"in S}isElementNode(S){return this.isDomNode(S)&&S.nodeType===Node.ELEMENT_NODE}isTextNode(S){return this.isDomNode(S)&&S.nodeType===Node.TEXT_NODE}isMap(S){return this.isObjectLike(S)&&this.getTag(S)==="[object Map]"}isSet(S){return this.isObjectLike(S)&&this.getTag(S)==="[object Set]"}isWeakMap(S){return this.isObjectLike(S)&&this.getTag(S)==="[object WeakMap]"}isWeakSet(S){return this.isObjectLike(S)&&this.getTag(S)==="[object WeakSet]"}isPrototype(S){return(typeof(S&&S.constructor)=="function"&&S.constructor.prototype||Object.prototype)===S}isRegExp(S){return this.isObjectLike(S)&&this.getTag(S)==="[object RegExp]"}isNull(S){return S===null}isUndefined(S){return typeof S>"u"}isArrayBuffer(S){return this.isObjectLike(S)&&this.getTag(S)==="[object ArrayBuffer]"}isTypedArray(S){const v=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)]$/;return this.isObjectLike(S)&&v.test(this.getTag(S))}isBlob(S){return this.isObjectLike(S)&&this.isNumber(S.size)&&this.isString(S.type)&&this.isFunction(S.slice)}isFile(S){return this.isBlob(S)&&this.isString(S.name)&&(this.isNumber(S.lastModified)||this.isObjectLike(S.lastModifiedDate))}isFormData(S){return S instanceof FormData}clone(S,v=!0){let T,O,A;if(S===null)return null;if(this.isDomNode(S))T=S.cloneNode(v);else if(typeof S=="object")if(this.isArray(S))for(T=[],O=0,A=S.length;O<A;O++)typeof S[O]=="object"&&v?T[O]=this.clone(S[O],v):T[O]=S[O];else{T={},S.constructor&&(this.isDate(S)?T=new Date(S):T=new S.constructor);for(O in S)S.hasOwnProperty(O)&&(typeof S[O]=="object"&&v?T[O]=this.clone(S[O],v):T[O]=S[O])}else T=S;return T}};const c=new s$3;class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(S){super(`Invalid DateTime: ${S.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(S){super(`Invalid Interval: ${S.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(S){super(`Invalid Duration: ${S.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(S){super(`Invalid unit ${S}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const n$2="numeric",s$2="short",l$3="long",DATE_SHORT={year:n$2,month:n$2,day:n$2},DATE_MED={year:n$2,month:s$2,day:n$2},DATE_MED_WITH_WEEKDAY={year:n$2,month:s$2,day:n$2,weekday:s$2},DATE_FULL={year:n$2,month:l$3,day:n$2},DATE_HUGE={year:n$2,month:l$3,day:n$2,weekday:l$3},TIME_SIMPLE={hour:n$2,minute:n$2},TIME_WITH_SECONDS={hour:n$2,minute:n$2,second:n$2},TIME_WITH_SHORT_OFFSET={hour:n$2,minute:n$2,second:n$2,timeZoneName:s$2},TIME_WITH_LONG_OFFSET={hour:n$2,minute:n$2,second:n$2,timeZoneName:l$3},TIME_24_SIMPLE={hour:n$2,minute:n$2,hourCycle:"h23"},TIME_24_WITH_SECONDS={hour:n$2,minute:n$2,second:n$2,hourCycle:"h23"},TIME_24_WITH_SHORT_OFFSET={hour:n$2,minute:n$2,second:n$2,hourCycle:"h23",timeZoneName:s$2},TIME_24_WITH_LONG_OFFSET={hour:n$2,minute:n$2,second:n$2,hourCycle:"h23",timeZoneName:l$3},DATETIME_SHORT={year:n$2,month:n$2,day:n$2,hour:n$2,minute:n$2},DATETIME_SHORT_WITH_SECONDS={year:n$2,month:n$2,day:n$2,hour:n$2,minute:n$2,second:n$2},DATETIME_MED={year:n$2,month:s$2,day:n$2,hour:n$2,minute:n$2},DATETIME_MED_WITH_SECONDS={year:n$2,month:s$2,day:n$2,hour:n$2,minute:n$2,second:n$2},DATETIME_MED_WITH_WEEKDAY={year:n$2,month:s$2,day:n$2,weekday:s$2,hour:n$2,minute:n$2},DATETIME_FULL={year:n$2,month:l$3,day:n$2,hour:n$2,minute:n$2,timeZoneName:s$2},DATETIME_FULL_WITH_SECONDS={year:n$2,month:l$3,day:n$2,hour:n$2,minute:n$2,second:n$2,timeZoneName:s$2},DATETIME_HUGE={year:n$2,month:l$3,day:n$2,weekday:l$3,hour:n$2,minute:n$2,timeZoneName:l$3},DATETIME_HUGE_WITH_SECONDS={year:n$2,month:l$3,day:n$2,weekday:l$3,hour:n$2,minute:n$2,second:n$2,timeZoneName:l$3};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(S,v){throw new ZoneIsAbstractError}formatOffset(S,v){throw new ZoneIsAbstractError}offset(S){throw new ZoneIsAbstractError}equals(S){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let singleton$1=null;class SystemZone extends Zone{static get instance(){return singleton$1===null&&(singleton$1=new SystemZone),singleton$1}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(S,{format:v,locale:T}){return parseZoneInfo(S,v,T)}formatOffset(S,v){return formatOffset(this.offset(S),v)}offset(S){return-new Date(S).getTimezoneOffset()}equals(S){return S.type==="system"}get isValid(){return!0}}let dtfCache={};function makeDTF(_){return dtfCache[_]||(dtfCache[_]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:_,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),dtfCache[_]}const typeToPos={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function hackyOffset(_,S){const v=_.format(S).replace(/\u200E/g,""),T=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(v),[,O,A,k,C,$,x,N]=T;return[k,O,A,C,$,x,N]}function partsOffset(_,S){const v=_.formatToParts(S),T=[];for(let O=0;O<v.length;O++){const{type:A,value:k}=v[O],C=typeToPos[A];A==="era"?T[C]=k:isUndefined$1(C)||(T[C]=parseInt(k,10))}return T}let ianaZoneCache={};class IANAZone extends Zone{static create(S){return ianaZoneCache[S]||(ianaZoneCache[S]=new IANAZone(S)),ianaZoneCache[S]}static resetCache(){ianaZoneCache={},dtfCache={}}static isValidSpecifier(S){return this.isValidZone(S)}static isValidZone(S){if(!S)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:S}).format(),!0}catch{return!1}}constructor(S){super(),this.zoneName=S,this.valid=IANAZone.isValidZone(S)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(S,{format:v,locale:T}){return parseZoneInfo(S,v,T,this.name)}formatOffset(S,v){return formatOffset(this.offset(S),v)}offset(S){const v=new Date(S);if(isNaN(v))return NaN;const T=makeDTF(this.name);let[O,A,k,C,$,x,N]=T.formatToParts?partsOffset(T,v):hackyOffset(T,v);C==="BC"&&(O=-Math.abs(O)+1);const q=objToLocalTS({year:O,month:A,day:k,hour:$===24?0:$,minute:x,second:N,millisecond:0});let M=+v;const U=M%1e3;return M-=U>=0?U:1e3+U,(q-M)/(60*1e3)}equals(S){return S.type==="iana"&&S.name===this.name}get isValid(){return this.valid}}let intlLFCache={};function getCachedLF(_,S={}){const v=JSON.stringify([_,S]);let T=intlLFCache[v];return T||(T=new Intl.ListFormat(_,S),intlLFCache[v]=T),T}let intlDTCache={};function getCachedDTF(_,S={}){const v=JSON.stringify([_,S]);let T=intlDTCache[v];return T||(T=new Intl.DateTimeFormat(_,S),intlDTCache[v]=T),T}let intlNumCache={};function getCachedINF(_,S={}){const v=JSON.stringify([_,S]);let T=intlNumCache[v];return T||(T=new Intl.NumberFormat(_,S),intlNumCache[v]=T),T}let intlRelCache={};function getCachedRTF(_,S={}){const{base:v,...T}=S,O=JSON.stringify([_,T]);let A=intlRelCache[O];return A||(A=new Intl.RelativeTimeFormat(_,S),intlRelCache[O]=A),A}let sysLocaleCache=null;function systemLocale(){return sysLocaleCache||(sysLocaleCache=new Intl.DateTimeFormat().resolvedOptions().locale,sysLocaleCache)}let weekInfoCache={};function getCachedWeekInfo(_){let S=weekInfoCache[_];if(!S){const v=new Intl.Locale(_);S="getWeekInfo"in v?v.getWeekInfo():v.weekInfo,weekInfoCache[_]=S}return S}function parseLocaleString(_){const S=_.indexOf("-x-");S!==-1&&(_=_.substring(0,S));const v=_.indexOf("-u-");if(v===-1)return[_];{let T,O;try{T=getCachedDTF(_).resolvedOptions(),O=_}catch{const $=_.substring(0,v);T=getCachedDTF($).resolvedOptions(),O=$}const{numberingSystem:A,calendar:k}=T;return[O,A,k]}}function intlConfigString(_,S,v){return(v||S)&&(_.includes("-u-")||(_+="-u"),v&&(_+=`-ca-${v}`),S&&(_+=`-nu-${S}`)),_}function mapMonths(_){const S=[];for(let v=1;v<=12;v++){const T=DateTime.utc(2009,v,1);S.push(_(T))}return S}function mapWeekdays(_){const S=[];for(let v=1;v<=7;v++){const T=DateTime.utc(2016,11,13+v);S.push(_(T))}return S}function listStuff(_,S,v,T){const O=_.listingMode();return O==="error"?null:O==="en"?v(S):T(S)}function supportsFastNumbers(_){return _.numberingSystem&&_.numberingSystem!=="latn"?!1:_.numberingSystem==="latn"||!_.locale||_.locale.startsWith("en")||new Intl.DateTimeFormat(_.intl).resolvedOptions().numberingSystem==="latn"}class PolyNumberFormatter{constructor(S,v,T){this.padTo=T.padTo||0,this.floor=T.floor||!1;const{padTo:O,floor:A,...k}=T;if(!v||Object.keys(k).length>0){const C={useGrouping:!1,...T};T.padTo>0&&(C.minimumIntegerDigits=T.padTo),this.inf=getCachedINF(S,C)}}format(S){if(this.inf){const v=this.floor?Math.floor(S):S;return this.inf.format(v)}else{const v=this.floor?Math.floor(S):roundTo(S,3);return padStart(v,this.padTo)}}}class PolyDateFormatter{constructor(S,v,T){this.opts=T,this.originalZone=void 0;let O;if(this.opts.timeZone)this.dt=S;else if(S.zone.type==="fixed"){const k=-1*(S.offset/60),C=k>=0?`Etc/GMT+${k}`:`Etc/GMT${k}`;S.offset!==0&&IANAZone.create(C).valid?(O=C,this.dt=S):(O="UTC",this.dt=S.offset===0?S:S.setZone("UTC").plus({minutes:S.offset}),this.originalZone=S.zone)}else S.zone.type==="system"?this.dt=S:S.zone.type==="iana"?(this.dt=S,O=S.zone.name):(O="UTC",this.dt=S.setZone("UTC").plus({minutes:S.offset}),this.originalZone=S.zone);const A={...this.opts};A.timeZone=A.timeZone||O,this.dtf=getCachedDTF(v,A)}format(){return this.originalZone?this.formatToParts().map(({value:S})=>S).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const S=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?S.map(v=>{if(v.type==="timeZoneName"){const T=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...v,value:T}}else return v}):S}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(S,v,T){this.opts={style:"long",...T},!v&&hasRelative()&&(this.rtf=getCachedRTF(S,T))}format(S,v){return this.rtf?this.rtf.format(S,v):formatRelativeTime(v,S,this.opts.numeric,this.opts.style!=="long")}formatToParts(S,v){return this.rtf?this.rtf.formatToParts(S,v):[]}}const fallbackWeekSettings={firstDay:1,minimalDays:4,weekend:[6,7]};class Locale{static fromOpts(S){return Locale.create(S.locale,S.numberingSystem,S.outputCalendar,S.weekSettings,S.defaultToEN)}static create(S,v,T,O,A=!1){const k=S||Settings.defaultLocale,C=k||(A?"en-US":systemLocale()),$=v||Settings.defaultNumberingSystem,x=T||Settings.defaultOutputCalendar,N=validateWeekSettings(O)||Settings.defaultWeekSettings;return new Locale(C,$,x,N,k)}static resetCache(){sysLocaleCache=null,intlDTCache={},intlNumCache={},intlRelCache={}}static fromObject({locale:S,numberingSystem:v,outputCalendar:T,weekSettings:O}={}){return Locale.create(S,v,T,O)}constructor(S,v,T,O,A){const[k,C,$]=parseLocaleString(S);this.locale=k,this.numberingSystem=v||C||null,this.outputCalendar=T||$||null,this.weekSettings=O,this.intl=intlConfigString(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=A,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=supportsFastNumbers(this)),this.fastNumbersCached}listingMode(){const S=this.isEnglish(),v=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return S&&v?"en":"intl"}clone(S){return!S||Object.getOwnPropertyNames(S).length===0?this:Locale.create(S.locale||this.specifiedLocale,S.numberingSystem||this.numberingSystem,S.outputCalendar||this.outputCalendar,validateWeekSettings(S.weekSettings)||this.weekSettings,S.defaultToEN||!1)}redefaultToEN(S={}){return this.clone({...S,defaultToEN:!0})}redefaultToSystem(S={}){return this.clone({...S,defaultToEN:!1})}months(S,v=!1){return listStuff(this,S,months,()=>{const T=v?{month:S,day:"numeric"}:{month:S},O=v?"format":"standalone";return this.monthsCache[O][S]||(this.monthsCache[O][S]=mapMonths(A=>this.extract(A,T,"month"))),this.monthsCache[O][S]})}weekdays(S,v=!1){return listStuff(this,S,weekdays,()=>{const T=v?{weekday:S,year:"numeric",month:"long",day:"numeric"}:{weekday:S},O=v?"format":"standalone";return this.weekdaysCache[O][S]||(this.weekdaysCache[O][S]=mapWeekdays(A=>this.extract(A,T,"weekday"))),this.weekdaysCache[O][S]})}meridiems(){return listStuff(this,void 0,()=>meridiems,()=>{if(!this.meridiemCache){const S={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map(v=>this.extract(v,S,"dayperiod"))}return this.meridiemCache})}eras(S){return listStuff(this,S,eras,()=>{const v={era:S};return this.eraCache[S]||(this.eraCache[S]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map(T=>this.extract(T,v,"era"))),this.eraCache[S]})}extract(S,v,T){const O=this.dtFormatter(S,v),A=O.formatToParts(),k=A.find(C=>C.type.toLowerCase()===T);return k?k.value:null}numberFormatter(S={}){return new PolyNumberFormatter(this.intl,S.forceSimple||this.fastNumbers,S)}dtFormatter(S,v={}){return new PolyDateFormatter(S,this.intl,v)}relFormatter(S={}){return new PolyRelFormatter(this.intl,this.isEnglish(),S)}listFormatter(S={}){return getCachedLF(this.intl,S)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hasLocaleWeekInfo()?getCachedWeekInfo(this.locale):fallbackWeekSettings}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(S){return this.locale===S.locale&&this.numberingSystem===S.numberingSystem&&this.outputCalendar===S.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let singleton=null;class FixedOffsetZone extends Zone{static get utcInstance(){return singleton===null&&(singleton=new FixedOffsetZone(0)),singleton}static instance(S){return S===0?FixedOffsetZone.utcInstance:new FixedOffsetZone(S)}static parseSpecifier(S){if(S){const v=S.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(v)return new FixedOffsetZone(signedOffset(v[1],v[2]))}return null}constructor(S){super(),this.fixed=S}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(S,v){return formatOffset(this.fixed,v)}get isUniversal(){return!0}offset(){return this.fixed}equals(S){return S.type==="fixed"&&S.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{constructor(S){super(),this.zoneName=S}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 normalizeZone(_,S){if(isUndefined$1(_)||_===null)return S;if(_ instanceof Zone)return _;if(isString$1(_)){const v=_.toLowerCase();return v==="default"?S:v==="local"||v==="system"?SystemZone.instance:v==="utc"||v==="gmt"?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(v)||IANAZone.create(_)}else return isNumber$1(_)?FixedOffsetZone.instance(_):typeof _=="object"&&"offset"in _&&typeof _.offset=="function"?_:new InvalidZone(_)}const numberingSystems={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"},numberingSystemsUTF16={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]},hanidecChars=numberingSystems.hanidec.replace(/[\[|\]]/g,"").split("");function parseDigits(_){let S=parseInt(_,10);if(isNaN(S)){S="";for(let v=0;v<_.length;v++){const T=_.charCodeAt(v);if(_[v].search(numberingSystems.hanidec)!==-1)S+=hanidecChars.indexOf(_[v]);else for(const O in numberingSystemsUTF16){const[A,k]=numberingSystemsUTF16[O];T>=A&&T<=k&&(S+=T-A)}}return parseInt(S,10)}else return S}let digitRegexCache={};function resetDigitRegexCache(){digitRegexCache={}}function digitRegex({numberingSystem:_},S=""){const v=_||"latn";return digitRegexCache[v]||(digitRegexCache[v]={}),digitRegexCache[v][S]||(digitRegexCache[v][S]=new RegExp(`${numberingSystems[v]}${S}`)),digitRegexCache[v][S]}let now=()=>Date.now(),defaultZone="system",defaultLocale=null,defaultNumberingSystem=null,defaultOutputCalendar=null,twoDigitCutoffYear=60,throwOnInvalid,defaultWeekSettings=null;class Settings{static get now(){return now}static set now(S){now=S}static set defaultZone(S){defaultZone=S}static get defaultZone(){return normalizeZone(defaultZone,SystemZone.instance)}static get defaultLocale(){return defaultLocale}static set defaultLocale(S){defaultLocale=S}static get defaultNumberingSystem(){return defaultNumberingSystem}static set defaultNumberingSystem(S){defaultNumberingSystem=S}static get defaultOutputCalendar(){return defaultOutputCalendar}static set defaultOutputCalendar(S){defaultOutputCalendar=S}static get defaultWeekSettings(){return defaultWeekSettings}static set defaultWeekSettings(S){defaultWeekSettings=validateWeekSettings(S)}static get twoDigitCutoffYear(){return twoDigitCutoffYear}static set twoDigitCutoffYear(S){twoDigitCutoffYear=S%100}static get throwOnInvalid(){return throwOnInvalid}static set throwOnInvalid(S){throwOnInvalid=S}static resetCaches(){Locale.resetCache(),IANAZone.resetCache(),DateTime.resetCache(),resetDigitRegexCache()}}class Invalid{constructor(S,v){this.reason=S,this.explanation=v}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(_,S){return new Invalid("unit out of range",`you specified ${S} (of type ${typeof S}) as a ${_}, which is invalid`)}function dayOfWeek(_,S,v){const T=new Date(Date.UTC(_,S-1,v));_<100&&_>=0&&T.setUTCFullYear(T.getUTCFullYear()-1900);const O=T.getUTCDay();return O===0?7:O}function computeOrdinal(_,S,v){return v+(isLeapYear(_)?leapLadder:nonLeapLadder)[S-1]}function uncomputeOrdinal(_,S){const v=isLeapYear(_)?leapLadder:nonLeapLadder,T=v.findIndex(A=>A<S),O=S-v[T];return{month:T+1,day:O}}function isoWeekdayToLocal(_,S){return(_-S+7)%7+1}function gregorianToWeek(_,S=4,v=1){const{year:T,month:O,day:A}=_,k=computeOrdinal(T,O,A),C=isoWeekdayToLocal(dayOfWeek(T,O,A),v);let $=Math.floor((k-C+14-S)/7),x;return $<1?(x=T-1,$=weeksInWeekYear(x,S,v)):$>weeksInWeekYear(T,S,v)?(x=T+1,$=1):x=T,{weekYear:x,weekNumber:$,weekday:C,...timeObject(_)}}function weekToGregorian(_,S=4,v=1){const{weekYear:T,weekNumber:O,weekday:A}=_,k=isoWeekdayToLocal(dayOfWeek(T,1,S),v),C=daysInYear(T);let $=O*7+A-k-7+S,x;$<1?(x=T-1,$+=daysInYear(x)):$>C?(x=T+1,$-=daysInYear(T)):x=T;const{month:N,day:D}=uncomputeOrdinal(x,$);return{year:x,month:N,day:D,...timeObject(_)}}function gregorianToOrdinal(_){const{year:S,month:v,day:T}=_,O=computeOrdinal(S,v,T);return{year:S,ordinal:O,...timeObject(_)}}function ordinalToGregorian(_){const{year:S,ordinal:v}=_,{month:T,day:O}=uncomputeOrdinal(S,v);return{year:S,month:T,day:O,...timeObject(_)}}function usesLocalWeekValues(_,S){if(!isUndefined$1(_.localWeekday)||!isUndefined$1(_.localWeekNumber)||!isUndefined$1(_.localWeekYear)){if(!isUndefined$1(_.weekday)||!isUndefined$1(_.weekNumber)||!isUndefined$1(_.weekYear))throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");return isUndefined$1(_.localWeekday)||(_.weekday=_.localWeekday),isUndefined$1(_.localWeekNumber)||(_.weekNumber=_.localWeekNumber),isUndefined$1(_.localWeekYear)||(_.weekYear=_.localWeekYear),delete _.localWeekday,delete _.localWeekNumber,delete _.localWeekYear,{minDaysInFirstWeek:S.getMinDaysInFirstWeek(),startOfWeek:S.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function hasInvalidWeekData(_,S=4,v=1){const T=isInteger(_.weekYear),O=integerBetween(_.weekNumber,1,weeksInWeekYear(_.weekYear,S,v)),A=integerBetween(_.weekday,1,7);return T?O?A?!1:unitOutOfRange("weekday",_.weekday):unitOutOfRange("week",_.weekNumber):unitOutOfRange("weekYear",_.weekYear)}function hasInvalidOrdinalData(_){const S=isInteger(_.year),v=integerBetween(_.ordinal,1,daysInYear(_.year));return S?v?!1:unitOutOfRange("ordinal",_.ordinal):unitOutOfRange("year",_.year)}function hasInvalidGregorianData(_){const S=isInteger(_.year),v=integerBetween(_.month,1,12),T=integerBetween(_.day,1,daysInMonth(_.year,_.month));return S?v?T?!1:unitOutOfRange("day",_.day):unitOutOfRange("month",_.month):unitOutOfRange("year",_.year)}function hasInvalidTimeData(_){const{hour:S,minute:v,second:T,millisecond:O}=_,A=integerBetween(S,0,23)||S===24&&v===0&&T===0&&O===0,k=integerBetween(v,0,59),C=integerBetween(T,0,59),$=integerBetween(O,0,999);return A?k?C?$?!1:unitOutOfRange("millisecond",O):unitOutOfRange("second",T):unitOutOfRange("minute",v):unitOutOfRange("hour",S)}function isUndefined$1(_){return typeof _>"u"}function isNumber$1(_){return typeof _=="number"}function isInteger(_){return typeof _=="number"&&_%1===0}function isString$1(_){return typeof _=="string"}function isDate$1(_){return Object.prototype.toString.call(_)==="[object Date]"}function hasRelative(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function hasLocaleWeekInfo(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function maybeArray(_){return Array.isArray(_)?_:[_]}function bestBy(_,S,v){if(_.length!==0)return _.reduce((T,O)=>{const A=[S(O),O];return T&&v(T[0],A[0])===T[0]?T:A},null)[1]}function pick(_,S){return S.reduce((v,T)=>(v[T]=_[T],v),{})}function hasOwnProperty$1(_,S){return Object.prototype.hasOwnProperty.call(_,S)}function validateWeekSettings(_){if(_==null)return null;if(typeof _!="object")throw new InvalidArgumentError("Week settings must be an object");if(!integerBetween(_.firstDay,1,7)||!integerBetween(_.minimalDays,1,7)||!Array.isArray(_.weekend)||_.weekend.some(S=>!integerBetween(S,1,7)))throw new InvalidArgumentError("Invalid week settings");return{firstDay:_.firstDay,minimalDays:_.minimalDays,weekend:Array.from(_.weekend)}}function integerBetween(_,S,v){return isInteger(_)&&_>=S&&_<=v}function floorMod(_,S){return _-S*Math.floor(_/S)}function padStart(_,S=2){const v=_<0;let T;return v?T="-"+(""+-_).padStart(S,"0"):T=(""+_).padStart(S,"0"),T}function parseInteger(_){if(!(isUndefined$1(_)||_===null||_===""))return parseInt(_,10)}function parseFloating(_){if(!(isUndefined$1(_)||_===null||_===""))return parseFloat(_)}function parseMillis(_){if(!(isUndefined$1(_)||_===null||_==="")){const S=parseFloat("0."+_)*1e3;return Math.floor(S)}}function roundTo(_,S,v=!1){const T=10**S;return(v?Math.trunc:Math.round)(_*T)/T}function isLeapYear(_){return _%4===0&&(_%100!==0||_%400===0)}function daysInYear(_){return isLeapYear(_)?366:365}function daysInMonth(_,S){const v=floorMod(S-1,12)+1,T=_+(S-v)/12;return v===2?isLeapYear(T)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][v-1]}function objToLocalTS(_){let S=Date.UTC(_.year,_.month-1,_.day,_.hour,_.minute,_.second,_.millisecond);return _.year<100&&_.year>=0&&(S=new Date(S),S.setUTCFullYear(_.year,_.month-1,_.day)),+S}function firstWeekOffset(_,S,v){return-isoWeekdayToLocal(dayOfWeek(_,1,S),v)+S-1}function weeksInWeekYear(_,S=4,v=1){const T=firstWeekOffset(_,S,v),O=firstWeekOffset(_+1,S,v);return(daysInYear(_)-T+O)/7}function untruncateYear(_){return _>99?_:_>Settings.twoDigitCutoffYear?1900+_:2e3+_}function parseZoneInfo(_,S,v,T=null){const O=new Date(_),A={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};T&&(A.timeZone=T);const k={timeZoneName:S,...A},C=new Intl.DateTimeFormat(v,k).formatToParts(O).find($=>$.type.toLowerCase()==="timezonename");return C?C.value:null}function signedOffset(_,S){let v=parseInt(_,10);Number.isNaN(v)&&(v=0);const T=parseInt(S,10)||0,O=v<0||Object.is(v,-0)?-T:T;return v*60+O}function asNumber(_){const S=Number(_);if(typeof _=="boolean"||_===""||Number.isNaN(S))throw new InvalidArgumentError(`Invalid unit value ${_}`);return S}function normalizeObject(_,S){const v={};for(const T in _)if(hasOwnProperty$1(_,T)){const O=_[T];if(O==null)continue;v[S(T)]=asNumber(O)}return v}function formatOffset(_,S){const v=Math.trunc(Math.abs(_/60)),T=Math.trunc(Math.abs(_%60)),O=_>=0?"+":"-";switch(S){case"short":return`${O}${padStart(v,2)}:${padStart(T,2)}`;case"narrow":return`${O}${v}${T>0?`:${T}`:""}`;case"techie":return`${O}${padStart(v,2)}${padStart(T,2)}`;default:throw new RangeError(`Value format ${S} is out of range for property format`)}}function timeObject(_){return pick(_,["hour","minute","second","millisecond"])}const monthsLong=["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthsNarrow=["J","F","M","A","M","J","J","A","S","O","N","D"];function months(_){switch(_){case"narrow":return[...monthsNarrow];case"short":return[...monthsShort];case"long":return[...monthsLong];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 weekdaysLong=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],weekdaysShort=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],weekdaysNarrow=["M","T","W","T","F","S","S"];function weekdays(_){switch(_){case"narrow":return[...weekdaysNarrow];case"short":return[...weekdaysShort];case"long":return[...weekdaysLong];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const meridiems=["AM","PM"],erasLong=["Before Christ","Anno Domini"],erasShort=["BC","AD"],erasNarrow=["B","A"];function eras(_){switch(_){case"narrow":return[...erasNarrow];case"short":return[...erasShort];case"long":return[...erasLong];default:return null}}function meridiemForDateTime(_){return meridiems[_.hour<12?0:1]}function weekdayForDateTime(_,S){return weekdays(S)[_.weekday-1]}function monthForDateTime(_,S){return months(S)[_.month-1]}function eraForDateTime(_,S){return eras(S)[_.year<0?0:1]}function formatRelativeTime(_,S,v="always",T=!1){const O={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."]},A=["hours","minutes","seconds"].indexOf(_)===-1;if(v==="auto"&&A){const D=_==="days";switch(S){case 1:return D?"tomorrow":`next ${O[_][0]}`;case-1:return D?"yesterday":`last ${O[_][0]}`;case 0:return D?"today":`this ${O[_][0]}`}}const k=Object.is(S,-0)||S<0,C=Math.abs(S),$=C===1,x=O[_],N=T?$?x[1]:x[2]||x[1]:$?O[_][0]:_;return k?`${C} ${N} ago`:`in ${C} ${N}`}function stringifyTokens(_,S){let v="";for(const T of _)T.literal?v+=T.val:v+=S(T.val);return v}const macroTokenToFormatOpts={D:DATE_SHORT,DD:DATE_MED,DDD:DATE_FULL,DDDD:DATE_HUGE,t:TIME_SIMPLE,tt:TIME_WITH_SECONDS,ttt:TIME_WITH_SHORT_OFFSET,tttt:TIME_WITH_LONG_OFFSET,T:TIME_24_SIMPLE,TT:TIME_24_WITH_SECONDS,TTT:TIME_24_WITH_SHORT_OFFSET,TTTT:TIME_24_WITH_LONG_OFFSET,f:DATETIME_SHORT,ff:DATETIME_MED,fff:DATETIME_FULL,ffff:DATETIME_HUGE,F:DATETIME_SHORT_WITH_SECONDS,FF:DATETIME_MED_WITH_SECONDS,FFF:DATETIME_FULL_WITH_SECONDS,FFFF:DATETIME_HUGE_WITH_SECONDS};class Formatter{static create(S,v={}){return new Formatter(S,v)}static parseFormat(S){let v=null,T="",O=!1;const A=[];for(let k=0;k<S.length;k++){const C=S.charAt(k);C==="'"?(T.length>0&&A.push({literal:O||/^\s+$/.test(T),val:T}),v=null,T="",O=!O):O||C===v?T+=C:(T.length>0&&A.push({literal:/^\s+$/.test(T),val:T}),T=C,v=C)}return T.length>0&&A.push({literal:O||/^\s+$/.test(T),val:T}),A}static macroTokenToFormatOpts(S){return macroTokenToFormatOpts[S]}constructor(S,v){this.opts=v,this.loc=S,this.systemLoc=null}formatWithSystemDefault(S,v){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(S,{...this.opts,...v}).format()}dtFormatter(S,v={}){return this.loc.dtFormatter(S,{...this.opts,...v})}formatDateTime(S,v){return this.dtFormatter(S,v).format()}formatDateTimeParts(S,v){return this.dtFormatter(S,v).formatToParts()}formatInterval(S,v){return this.dtFormatter(S.start,v).dtf.formatRange(S.start.toJSDate(),S.end.toJSDate())}resolvedOptions(S,v){return this.dtFormatter(S,v).resolvedOptions()}num(S,v=0){if(this.opts.forceSimple)return padStart(S,v);const T={...this.opts};return v>0&&(T.padTo=v),this.loc.numberFormatter(T).format(S)}formatDateTimeFromString(S,v){const T=this.loc.listingMode()==="en",O=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",A=(M,U)=>this.loc.extract(S,M,U),k=M=>S.isOffsetFixed&&S.offset===0&&M.allowZ?"Z":S.isValid?S.zone.formatOffset(S.ts,M.format):"",C=()=>T?meridiemForDateTime(S):A({hour:"numeric",hourCycle:"h12"},"dayperiod"),$=(M,U)=>T?monthForDateTime(S,M):A(U?{month:M}:{month:M,day:"numeric"},"month"),x=(M,U)=>T?weekdayForDateTime(S,M):A(U?{weekday:M}:{weekday:M,month:"long",day:"numeric"},"weekday"),N=M=>{const U=Formatter.macroTokenToFormatOpts(M);return U?this.formatWithSystemDefault(S,U):M},D=M=>T?eraForDateTime(S,M):A({era:M},"era"),q=M=>{switch(M){case"S":return this.num(S.millisecond);case"u":case"SSS":return this.num(S.millisecond,3);case"s":return this.num(S.second);case"ss":return this.num(S.second,2);case"uu":return this.num(Math.floor(S.millisecond/10),2);case"uuu":return this.num(Math.floor(S.millisecond/100));case"m":return this.num(S.minute);case"mm":return this.num(S.minute,2);case"h":return this.num(S.hour%12===0?12:S.hour%12);case"hh":return this.num(S.hour%12===0?12:S.hour%12,2);case"H":return this.num(S.hour);case"HH":return this.num(S.hour,2);case"Z":return k({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return k({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return k({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return S.zone.offsetName(S.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return S.zone.offsetName(S.ts,{format:"long",locale:this.loc.locale});case"z":return S.zoneName;case"a":return C();case"d":return O?A({day:"numeric"},"day"):this.num(S.day);case"dd":return O?A({day:"2-digit"},"day"):this.num(S.day,2);case"c":return this.num(S.weekday);case"ccc":return x("short",!0);case"cccc":return x("long",!0);case"ccccc":return x("narrow",!0);case"E":return this.num(S.weekday);case"EEE":return x("short",!1);case"EEEE":return x("long",!1);case"EEEEE":return x("narrow",!1);case"L":return O?A({month:"numeric",day:"numeric"},"month"):this.num(S.month);case"LL":return O?A({month:"2-digit",day:"numeric"},"month"):this.num(S.month,2);case"LLL":return $("short",!0);case"LLLL":return $("long",!0);case"LLLLL":return $("narrow",!0);case"M":return O?A({month:"numeric"},"month"):this.num(S.month);case"MM":return O?A({month:"2-digit"},"month"):this.num(S.month,2);case"MMM":return $("short",!1);case"MMMM":return $("long",!1);case"MMMMM":return $("narrow",!1);case"y":return O?A({year:"numeric"},"year"):this.num(S.year);case"yy":return O?A({year:"2-digit"},"year"):this.num(S.year.toString().slice(-2),2);case"yyyy":return O?A({year:"numeric"},"year"):this.num(S.year,4);case"yyyyyy":return O?A({year:"numeric"},"year"):this.num(S.year,6);case"G":return D("short");case"GG":return D("long");case"GGGGG":return D("narrow");case"kk":return this.num(S.weekYear.toString().slice(-2),2);case"kkkk":return this.num(S.weekYear,4);case"W":return this.num(S.weekNumber);case"WW":return this.num(S.weekNumber,2);case"n":return this.num(S.localWeekNumber);case"nn":return this.num(S.localWeekNumber,2);case"ii":return this.num(S.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(S.localWeekYear,4);case"o":return this.num(S.ordinal);case"ooo":return this.num(S.ordinal,3);case"q":return this.num(S.quarter);case"qq":return this.num(S.quarter,2);case"X":return this.num(Math.floor(S.ts/1e3));case"x":return this.num(S.ts);default:return N(M)}};return stringifyTokens(Formatter.parseFormat(v),q)}formatDurationFromString(S,v){const T=$=>{switch($[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},O=$=>x=>{const N=T(x);return N?this.num($.get(N),x.length):x},A=Formatter.parseFormat(v),k=A.reduce(($,{literal:x,val:N})=>x?$:$.concat(N),[]),C=S.shiftTo(...k.map(T).filter($=>$));return stringifyTokens(A,O(C))}}const ianaRegex=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(..._){const S=_.reduce((v,T)=>v+T.source,"");return RegExp(`^${S}$`)}function combineExtractors(..._){return S=>_.reduce(([v,T,O],A)=>{const[k,C,$]=A(S,O);return[{...v,...k},C||T,$]},[{},null,1]).slice(0,2)}function parse$1(_,...S){if(_==null)return[null,null];for(const[v,T]of S){const O=v.exec(_);if(O)return T(O)}return[null,null]}function simpleParse(..._){return(S,v)=>{const T={};let O;for(O=0;O<_.length;O++)T[_[O]]=parseInteger(S[v+O]);return[T,null,v+O]}}const offsetRegex=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,isoExtendedZone=`(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`,isoTimeBaseRegex=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,isoTimeRegex=RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`),isoTimeExtensionRegex=RegExp(`(?:T${isoTimeRegex.source})?`),isoYmdRegex=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,isoWeekRegex=/(\d{4})-?W(\d\d)(?:-?(\d))?/,isoOrdinalRegex=/(\d{4})-?(\d{3})/,extractISOWeekData=simpleParse("weekYear","weekNumber","weekDay"),extractISOOrdinalData=simpleParse("year","ordinal"),sqlYmdRegex=/(\d{4})-(\d\d)-(\d\d)/,sqlTimeRegex=RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`),sqlTimeExtensionRegex=RegExp(`(?: ${sqlTimeRegex.source})?`);function int(_,S,v){const T=_[S];return isUndefined$1(T)?v:parseInteger(T)}function extractISOYmd(_,S){return[{year:int(_,S),month:int(_,S+1,1),day:int(_,S+2,1)},null,S+3]}function extractISOTime(_,S){return[{hours:int(_,S,0),minutes:int(_,S+1,0),seconds:int(_,S+2,0),milliseconds:parseMillis(_[S+3])},null,S+4]}function extractISOOffset(_,S){const v=!_[S]&&!_[S+1],T=signedOffset(_[S+1],_[S+2]),O=v?null:FixedOffsetZone.instance(T);return[{},O,S+3]}function extractIANAZone(_,S){const v=_[S]?IANAZone.create(_[S]):null;return[{},v,S+1]}const isoTimeOnly=RegExp(`^T?${isoTimeBaseRegex.source}$`),isoDuration=/^-?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 extractISODuration(_){const[S,v,T,O,A,k,C,$,x]=_,N=S[0]==="-",D=$&&$[0]==="-",q=(M,U=!1)=>M!==void 0&&(U||M&&N)?-M:M;return[{years:q(parseFloating(v)),months:q(parseFloating(T)),weeks:q(parseFloating(O)),days:q(parseFloating(A)),hours:q(parseFloating(k)),minutes:q(parseFloating(C)),seconds:q(parseFloating($),$==="-0"),milliseconds:q(parseMillis(x),D)}]}const obsOffsets={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function fromStrings(_,S,v,T,O,A,k){const C={year:S.length===2?untruncateYear(parseInteger(S)):parseInteger(S),month:monthsShort.indexOf(v)+1,day:parseInteger(T),hour:parseInteger(O),minute:parseInteger(A)};return k&&(C.second=parseInteger(k)),_&&(C.weekday=_.length>3?weekdaysLong.indexOf(_)+1:weekdaysShort.indexOf(_)+1),C}const rfc2822=/^(?:(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 extractRFC2822(_){const[,S,v,T,O,A,k,C,$,x,N,D]=_,q=fromStrings(S,O,T,v,A,k,C);let M;return $?M=obsOffsets[$]:x?M=0:M=signedOffset(N,D),[q,new FixedOffsetZone(M)]}function preprocessRFC2822(_){return _.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const rfc1123=/^(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$/,rfc850=/^(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$/,ascii=/^(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 extractRFC1123Or850(_){const[,S,v,T,O,A,k,C]=_;return[fromStrings(S,O,T,v,A,k,C),FixedOffsetZone.utcInstance]}function extractASCII(_){const[,S,v,T,O,A,k,C]=_;return[fromStrings(S,C,v,T,O,A,k),FixedOffsetZone.utcInstance]}const isoYmdWithTimeExtensionRegex=combineRegexes(isoYmdRegex,isoTimeExtensionRegex),isoWeekWithTimeExtensionRegex=combineRegexes(isoWeekRegex,isoTimeExtensionRegex),isoOrdinalWithTimeExtensionRegex=combineRegexes(isoOrdinalRegex,isoTimeExtensionRegex),isoTimeCombinedRegex=combineRegexes(isoTimeRegex),extractISOYmdTimeAndOffset=combineExtractors(extractISOYmd,extractISOTime,extractISOOffset,extractIANAZone),extractISOWeekTimeAndOffset=combineExtractors(extractISOWeekData,extractISOTime,extractISOOffset,extractIANAZone),extractISOOrdinalDateAndTime=combineExtractors(extractISOOrdinalData,extractISOTime,extractISOOffset,extractIANAZone),extractISOTimeAndOffset=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseISODate(_){return parse$1(_,[isoYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[isoWeekWithTimeExtensionRegex,extractISOWeekTimeAndOffset],[isoOrdinalWithTimeExtensionRegex,extractISOOrdinalDateAndTime],[isoTimeCombinedRegex,extractISOTimeAndOffset])}function parseRFC2822Date(_){return parse$1(preprocessRFC2822(_),[rfc2822,extractRFC2822])}function parseHTTPDate(_){return parse$1(_,[rfc1123,extractRFC1123Or850],[rfc850,extractRFC1123Or850],[ascii,extractASCII])}function parseISODuration(_){return parse$1(_,[isoDuration,extractISODuration])}const extractISOTimeOnly=combineExtractors(extractISOTime);function parseISOTimeOnly(_){return parse$1(_,[isoTimeOnly,extractISOTimeOnly])}const sqlYmdWithTimeExtensionRegex=combineRegexes(sqlYmdRegex,sqlTimeExtensionRegex),sqlTimeCombinedRegex=combineRegexes(sqlTimeRegex),extractISOTimeOffsetAndIANAZone=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseSQL(_){return parse$1(_,[sqlYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[sqlTimeCombinedRegex,extractISOTimeOffsetAndIANAZone])}const INVALID$2="Invalid Duration",lowOrderMatrix={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},casualMatrix={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:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...lowOrderMatrix},daysInYearAccurate=146097/400,daysInMonthAccurate=146097/4800,accurateMatrix={years:{quarters:4,months:12,weeks:daysInYearAccurate/7,days:daysInYearAccurate,hours:daysInYearAccurate*24,minutes:daysInYearAccurate*24*60,seconds:daysInYearAccurate*24*60*60,milliseconds:daysInYearAccurate*24*60*60*1e3},quarters:{months:3,weeks:daysInYearAccurate/28,days:daysInYearAccurate/4,hours:daysInYearAccurate*24/4,minutes:daysInYearAccurate*24*60/4,seconds:daysInYearAccurate*24*60*60/4,milliseconds:daysInYearAccurate*24*60*60*1e3/4},months:{weeks:daysInMonthAccurate/7,days:daysInMonthAccurate,hours:daysInMonthAccurate*24,minutes:daysInMonthAccurate*24*60,seconds:daysInMonthAccurate*24*60*60,milliseconds:daysInMonthAccurate*24*60*60*1e3},...lowOrderMatrix},orderedUnits$1=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],reverseUnits=orderedUnits$1.slice(0).reverse();function clone$1(_,S,v=!1){const T={values:v?S.values:{..._.values,...S.values||{}},loc:_.loc.clone(S.loc),conversionAccuracy:S.conversionAccuracy||_.conversionAccuracy,matrix:S.matrix||_.matrix};return new Duration(T)}function durationToMillis(_,S){let v=S.milliseconds??0;for(const T of reverseUnits.slice(1))S[T]&&(v+=S[T]*_[T].milliseconds);return v}function normalizeValues(_,S){const v=durationToMillis(_,S)<0?-1:1;orderedUnits$1.reduceRight((T,O)=>{if(isUndefined$1(S[O]))return T;if(T){const A=S[T]*v,k=_[O][T],C=Math.floor(A/k);S[O]+=C*v,S[T]-=C*k*v}return O},null),orderedUnits$1.reduce((T,O)=>{if(isUndefined$1(S[O]))return T;if(T){const A=S[T]%1;S[T]-=A,S[O]+=A*_[T][O]}return O},null)}function removeZeroes(_){const S={};for(const[v,T]of Object.entries(_))T!==0&&(S[v]=T);return S}class Duration{constructor(S){const v=S.conversionAccuracy==="longterm"||!1;let T=v?accurateMatrix:casualMatrix;S.matrix&&(T=S.matrix),this.values=S.values,this.loc=S.loc||Locale.create(),this.conversionAccuracy=v?"longterm":"casual",this.invalid=S.invalid||null,this.matrix=T,this.isLuxonDuration=!0}static fromMillis(S,v){return Duration.fromObject({milliseconds:S},v)}static fromObject(S,v={}){if(S==null||typeof S!="object")throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${S===null?"null":typeof S}`);return new Duration({values:normalizeObject(S,Duration.normalizeUnit),loc:Locale.fromObject(v),conversionAccuracy:v.conversionAccuracy,matrix:v.matrix})}static fromDurationLike(S){if(isNumber$1(S))return Duration.fromMillis(S);if(Duration.isDuration(S))return S;if(typeof S=="object")return Duration.fromObject(S);throw new InvalidArgumentError(`Unknown duration argument ${S} of type ${typeof S}`)}static fromISO(S,v){const[T]=parseISODuration(S);return T?Duration.fromObject(T,v):Duration.invalid("unparsable",`the input "${S}" can't be parsed as ISO 8601`)}static fromISOTime(S,v){const[T]=parseISOTimeOnly(S);return T?Duration.fromObject(T,v):Duration.invalid("unparsable",`the input "${S}" can't be parsed as ISO 8601`)}static invalid(S,v=null){if(!S)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const T=S instanceof Invalid?S:new Invalid(S,v);if(Settings.throwOnInvalid)throw new InvalidDurationError(T);return new Duration({invalid:T})}static normalizeUnit(S){const v={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"}[S&&S.toLowerCase()];if(!v)throw new InvalidUnitError(S);return v}static isDuration(S){return S&&S.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(S,v={}){const T={...v,floor:v.round!==!1&&v.floor!==!1};return this.isValid?Formatter.create(this.loc,T).formatDurationFromString(this,S):INVALID$2}toHuman(S={}){if(!this.isValid)return INVALID$2;const v=orderedUnits$1.map(T=>{const O=this.values[T];return isUndefined$1(O)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...S,unit:T.slice(0,-1)}).format(O)}).filter(T=>T);return this.loc.listFormatter({type:"conjunction",style:S.listStyle||"narrow",...S}).format(v)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let S="P";return this.years!==0&&(S+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(S+=this.months+this.quarters*3+"M"),this.weeks!==0&&(S+=this.weeks+"W"),this.days!==0&&(S+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(S+="T"),this.hours!==0&&(S+=this.hours+"H"),this.minutes!==0&&(S+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(S+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),S==="P"&&(S+="T0S"),S}toISOTime(S={}){if(!this.isValid)return null;const v=this.toMillis();return v<0||v>=864e5?null:(S={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...S,includeOffset:!1},DateTime.fromMillis(v,{zone:"UTC"}).toISOTime(S))}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?durationToMillis(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(S){if(!this.isValid)return this;const v=Duration.fromDurationLike(S),T={};for(const O of orderedUnits$1)(hasOwnProperty$1(v.values,O)||hasOwnProperty$1(this.values,O))&&(T[O]=v.get(O)+this.get(O));return clone$1(this,{values:T},!0)}minus(S){if(!this.isValid)return this;const v=Duration.fromDurationLike(S);return this.plus(v.negate())}mapUnits(S){if(!this.isValid)return this;const v={};for(const T of Object.keys(this.values))v[T]=asNumber(S(this.values[T],T));return clone$1(this,{values:v},!0)}get(S){return this[Duration.normalizeUnit(S)]}set(S){if(!this.isValid)return this;const v={...this.values,...normalizeObject(S,Duration.normalizeUnit)};return clone$1(this,{values:v})}reconfigure({locale:S,numberingSystem:v,conversionAccuracy:T,matrix:O}={}){const k={loc:this.loc.clone({locale:S,numberingSystem:v}),matrix:O,conversionAccuracy:T};return clone$1(this,k)}as(S){return this.isValid?this.shiftTo(S).get(S):NaN}normalize(){if(!this.isValid)return this;const S=this.toObject();return normalizeValues(this.matrix,S),clone$1(this,{values:S},!0)}rescale(){if(!this.isValid)return this;const S=removeZeroes(this.normalize().shiftToAll().toObject());return clone$1(this,{values:S},!0)}shiftTo(...S){if(!this.isValid)return this;if(S.length===0)return this;S=S.map(k=>Duration.normalizeUnit(k));const v={},T={},O=this.toObject();let A;for(const k of orderedUnits$1)if(S.indexOf(k)>=0){A=k;let C=0;for(const x in T)C+=this.matrix[x][k]*T[x],T[x]=0;isNumber$1(O[k])&&(C+=O[k]);const $=Math.trunc(C);v[k]=$,T[k]=(C*1e3-$*1e3)/1e3}else isNumber$1(O[k])&&(T[k]=O[k]);for(const k in T)T[k]!==0&&(v[A]+=k===A?T[k]:T[k]/this.matrix[A][k]);return normalizeValues(this.matrix,v),clone$1(this,{values:v},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const S={};for(const v of Object.keys(this.values))S[v]=this.values[v]===0?0:-this.values[v];return clone$1(this,{values:S},!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(S){if(!this.isValid||!S.isValid||!this.loc.equals(S.loc))return!1;function v(T,O){return T===void 0||T===0?O===void 0||O===0:T===O}for(const T of orderedUnits$1)if(!v(this.values[T],S.values[T]))return!1;return!0}}const INVALID$1="Invalid Interval";function validateStartEnd(_,S){return!_||!_.isValid?Interval.invalid("missing or invalid start"):!S||!S.isValid?Interval.invalid("missing or invalid end"):S<_?Interval.invalid("end before start",`The end of an interval must be after its start, but you had start=${_.toISO()} and end=${S.toISO()}`):null}class Interval{constructor(S){this.s=S.start,this.e=S.end,this.invalid=S.invalid||null,this.isLuxonInterval=!0}static invalid(S,v=null){if(!S)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const T=S instanceof Invalid?S:new Invalid(S,v);if(Settings.throwOnInvalid)throw new InvalidIntervalError(T);return new Interval({invalid:T})}static fromDateTimes(S,v){const T=friendlyDateTime(S),O=friendlyDateTime(v),A=validateStartEnd(T,O);return A??new Interval({start:T,end:O})}static after(S,v){const T=Duration.fromDurationLike(v),O=friendlyDateTime(S);return Interval.fromDateTimes(O,O.plus(T))}static before(S,v){const T=Duration.fromDurationLike(v),O=friendlyDateTime(S);return Interval.fromDateTimes(O.minus(T),O)}static fromISO(S,v){const[T,O]=(S||"").split("/",2);if(T&&O){let A,k;try{A=DateTime.fromISO(T,v),k=A.isValid}catch{k=!1}let C,$;try{C=DateTime.fromISO(O,v),$=C.isValid}catch{$=!1}if(k&&$)return Interval.fromDateTimes(A,C);if(k){const x=Duration.fromISO(O,v);if(x.isValid)return Interval.after(A,x)}else if($){const x=Duration.fromISO(T,v);if(x.isValid)return Interval.before(C,x)}}return Interval.invalid("unparsable",`the input "${S}" can't be parsed as ISO 8601`)}static isInterval(S){return S&&S.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e: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(S="milliseconds"){return this.isValid?this.toDuration(S).get(S):NaN}count(S="milliseconds",v){if(!this.isValid)return NaN;const T=this.start.startOf(S,v);let O;return v?.useLocaleWeeks?O=this.end.reconfigure({locale:T.locale}):O=this.end,O=O.startOf(S,v),Math.floor(O.diff(T,S).get(S))+(O.valueOf()!==this.end.valueOf())}hasSame(S){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,S):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(S){return this.isValid?this.s>S:!1}isBefore(S){return this.isValid?this.e<=S:!1}contains(S){return this.isValid?this.s<=S&&this.e>S:!1}set({start:S,end:v}={}){return this.isValid?Interval.fromDateTimes(S||this.s,v||this.e):this}splitAt(...S){if(!this.isValid)return[];const v=S.map(friendlyDateTime).filter(k=>this.contains(k)).sort((k,C)=>k.toMillis()-C.toMillis()),T=[];let{s:O}=this,A=0;for(;O<this.e;){const k=v[A]||this.e,C=+k>+this.e?this.e:k;T.push(Interval.fromDateTimes(O,C)),O=C,A+=1}return T}splitBy(S){const v=Duration.fromDurationLike(S);if(!this.isValid||!v.isValid||v.as("milliseconds")===0)return[];let{s:T}=this,O=1,A;const k=[];for(;T<this.e;){const C=this.start.plus(v.mapUnits($=>$*O));A=+C>+this.e?this.e:C,k.push(Interval.fromDateTimes(T,A)),T=A,O+=1}return k}divideEqually(S){return this.isValid?this.splitBy(this.length()/S).slice(0,S):[]}overlaps(S){return this.e>S.s&&this.s<S.e}abutsStart(S){return this.isValid?+this.e==+S.s:!1}abutsEnd(S){return this.isValid?+S.e==+this.s:!1}engulfs(S){return this.isValid?this.s<=S.s&&this.e>=S.e:!1}equals(S){return!this.isValid||!S.isValid?!1:this.s.equals(S.s)&&this.e.equals(S.e)}intersection(S){if(!this.isValid)return this;const v=this.s>S.s?this.s:S.s,T=this.e<S.e?this.e:S.e;return v>=T?null:Interval.fromDateTimes(v,T)}union(S){if(!this.isValid)return this;const v=this.s<S.s?this.s:S.s,T=this.e>S.e?this.e:S.e;return Interval.fromDateTimes(v,T)}static merge(S){const[v,T]=S.sort((O,A)=>O.s-A.s).reduce(([O,A],k)=>A?A.overlaps(k)||A.abutsStart(k)?[O,A.union(k)]:[O.concat([A]),k]:[O,k],[[],null]);return T&&v.push(T),v}static xor(S){let v=null,T=0;const O=[],A=S.map($=>[{time:$.s,type:"s"},{time:$.e,type:"e"}]),k=Array.prototype.concat(...A),C=k.sort(($,x)=>$.time-x.time);for(const $ of C)T+=$.type==="s"?1:-1,T===1?v=$.time:(v&&+v!=+$.time&&O.push(Interval.fromDateTimes(v,$.time)),v=null);return Interval.merge(O)}difference(...S){return Interval.xor([this].concat(S)).map(v=>this.intersection(v)).filter(v=>v&&!v.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:INVALID$1}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(S=DATE_SHORT,v={}){return this.isValid?Formatter.create(this.s.loc.clone(v),S).formatInterval(this):INVALID$1}toISO(S){return this.isValid?`${this.s.toISO(S)}/${this.e.toISO(S)}`:INVALID$1}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:INVALID$1}toISOTime(S){return this.isValid?`${this.s.toISOTime(S)}/${this.e.toISOTime(S)}`:INVALID$1}toFormat(S,{separator:v=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(S)}${v}${this.e.toFormat(S)}`:INVALID$1}toDuration(S,v){return this.isValid?this.e.diff(this.s,S,v):Duration.invalid(this.invalidReason)}mapEndpoints(S){return Interval.fromDateTimes(S(this.s),S(this.e))}}class Info{static hasDST(S=Settings.defaultZone){const v=DateTime.now().setZone(S).set({month:12});return!S.isUniversal&&v.offset!==v.set({month:6}).offset}static isValidIANAZone(S){return IANAZone.isValidZone(S)}static normalizeZone(S){return normalizeZone(S,Settings.defaultZone)}static getStartOfWeek({locale:S=null,locObj:v=null}={}){return(v||Locale.create(S)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:S=null,locObj:v=null}={}){return(v||Locale.create(S)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:S=null,locObj:v=null}={}){return(v||Locale.create(S)).getWeekendDays().slice()}static months(S="long",{locale:v=null,numberingSystem:T=null,locObj:O=null,outputCalendar:A="gregory"}={}){return(O||Locale.create(v,T,A)).months(S)}static monthsFormat(S="long",{locale:v=null,numberingSystem:T=null,locObj:O=null,outputCalendar:A="gregory"}={}){return(O||Locale.create(v,T,A)).months(S,!0)}static weekdays(S="long",{locale:v=null,numberingSystem:T=null,locObj:O=null}={}){return(O||Locale.create(v,T,null)).weekdays(S)}static weekdaysFormat(S="long",{locale:v=null,numberingSystem:T=null,locObj:O=null}={}){return(O||Locale.create(v,T,null)).weekdays(S,!0)}static meridiems({locale:S=null}={}){return Locale.create(S).meridiems()}static eras(S="short",{locale:v=null}={}){return Locale.create(v,null,"gregory").eras(S)}static features(){return{relative:hasRelative(),localeWeek:hasLocaleWeekInfo()}}}function dayDiff(_,S){const v=O=>O.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),T=v(S)-v(_);return Math.floor(Duration.fromMillis(T).as("days"))}function highOrderDiffs(_,S,v){const T=[["years",($,x)=>x.year-$.year],["quarters",($,x)=>x.quarter-$.quarter+(x.year-$.year)*4],["months",($,x)=>x.month-$.month+(x.year-$.year)*12],["weeks",($,x)=>{const N=dayDiff($,x);return(N-N%7)/7}],["days",dayDiff]],O={},A=_;let k,C;for(const[$,x]of T)v.indexOf($)>=0&&(k=$,O[$]=x(_,S),C=A.plus(O),C>S?(O[$]--,_=A.plus(O),_>S&&(C=_,O[$]--,_=A.plus(O))):_=C);return[_,O,C,k]}function diff(_,S,v,T){let[O,A,k,C]=highOrderDiffs(_,S,v);const $=S-O,x=v.filter(D=>["hours","minutes","seconds","milliseconds"].indexOf(D)>=0);x.length===0&&(k<S&&(k=O.plus({[C]:1})),k!==O&&(A[C]=(A[C]||0)+$/(k-O)));const N=Duration.fromObject(A,T);return x.length>0?Duration.fromMillis($,T).shiftTo(...x).plus(N):N}const MISSING_FTP="missing Intl.DateTimeFormat.formatToParts support";function intUnit(_,S=v=>v){return{regex:_,deser:([v])=>S(parseDigits(v))}}const NBSP="\xA0",spaceOrNBSP=`[ ${NBSP}]`,spaceOrNBSPRegExp=new RegExp(spaceOrNBSP,"g");function fixListRegex(_){return _.replace(/\./g,"\\.?").replace(spaceOrNBSPRegExp,spaceOrNBSP)}function stripInsensitivities(_){return _.replace(/\./g,"").replace(spaceOrNBSPRegExp," ").toLowerCase()}function oneOf(_,S){return _===null?null:{regex:RegExp(_.map(fixListRegex).join("|")),deser:([v])=>_.findIndex(T=>stripInsensitivities(v)===stripInsensitivities(T))+S}}function offset(_,S){return{regex:_,deser:([,v,T])=>signedOffset(v,T),groups:S}}function simple(_){return{regex:_,deser:([S])=>S}}function escapeToken(_){return _.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function unitForToken(_,S){const v=digitRegex(S),T=digitRegex(S,"{2}"),O=digitRegex(S,"{3}"),A=digitRegex(S,"{4}"),k=digitRegex(S,"{6}"),C=digitRegex(S,"{1,2}"),$=digitRegex(S,"{1,3}"),x=digitRegex(S,"{1,6}"),N=digitRegex(S,"{1,9}"),D=digitRegex(S,"{2,4}"),q=digitRegex(S,"{4,6}"),M=W=>({regex:RegExp(escapeToken(W.val)),deser:([j])=>j,literal:!0}),z=(W=>{if(_.literal)return M(W);switch(W.val){case"G":return oneOf(S.eras("short"),0);case"GG":return oneOf(S.eras("long"),0);case"y":return intUnit(x);case"yy":return intUnit(D,untruncateYear);case"yyyy":return intUnit(A);case"yyyyy":return intUnit(q);case"yyyyyy":return intUnit(k);case"M":return intUnit(C);case"MM":return intUnit(T);case"MMM":return oneOf(S.months("short",!0),1);case"MMMM":return oneOf(S.months("long",!0),1);case"L":return intUnit(C);case"LL":return intUnit(T);case"LLL":return oneOf(S.months("short",!1),1);case"LLLL":return oneOf(S.months("long",!1),1);case"d":return intUnit(C);case"dd":return intUnit(T);case"o":return intUnit($);case"ooo":return intUnit(O);case"HH":return intUnit(T);case"H":return intUnit(C);case"hh":return intUnit(T);case"h":return intUnit(C);case"mm":return intUnit(T);case"m":return intUnit(C);case"q":return intUnit(C);case"qq":return intUnit(T);case"s":return intUnit(C);case"ss":return intUnit(T);case"S":return intUnit($);case"SSS":return intUnit(O);case"u":return simple(N);case"uu":return simple(C);case"uuu":return intUnit(v);case"a":return oneOf(S.meridiems(),0);case"kkkk":return intUnit(A);case"kk":return intUnit(D,untruncateYear);case"W":return intUnit(C);case"WW":return intUnit(T);case"E":case"c":return intUnit(v);case"EEE":return oneOf(S.weekdays("short",!1),1);case"EEEE":return oneOf(S.weekdays("long",!1),1);case"ccc":return oneOf(S.weekdays("short",!0),1);case"cccc":return oneOf(S.weekdays("long",!0),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${C.source})(?::(${T.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${C.source})(${T.source})?`),2);case"z":return simple(/[a-z_+-/]{1,256}?/i);case" ":return simple(/[^\S\n\r]/);default:return M(W)}})(_)||{invalidReason:MISSING_FTP};return z.token=_,z}const partTypeStyleToTokenVal={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 tokenForPart(_,S,v){const{type:T,value:O}=_;if(T==="literal"){const $=/^\s+$/.test(O);return{literal:!$,val:$?" ":O}}const A=S[T];let k=T;T==="hour"&&(S.hour12!=null?k=S.hour12?"hour12":"hour24":S.hourCycle!=null?S.hourCycle==="h11"||S.hourCycle==="h12"?k="hour12":k="hour24":k=v.hour12?"hour12":"hour24");let C=partTypeStyleToTokenVal[k];if(typeof C=="object"&&(C=C[A]),C)return{literal:!1,val:C}}function buildRegex(_){return[`^${_.map(v=>v.regex).reduce((v,T)=>`${v}(${T.source})`,"")}$`,_]}function match(_,S,v){const T=_.match(S);if(T){const O={};let A=1;for(const k in v)if(hasOwnProperty$1(v,k)){const C=v[k],$=C.groups?C.groups+1:1;!C.literal&&C.token&&(O[C.token.val[0]]=C.deser(T.slice(A,A+$))),A+=$}return[T,O]}else return[T,{}]}function dateTimeFromMatches(_){const S=A=>{switch(A){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 v=null,T;return isUndefined$1(_.z)||(v=IANAZone.create(_.z)),isUndefined$1(_.Z)||(v||(v=new FixedOffsetZone(_.Z)),T=_.Z),isUndefined$1(_.q)||(_.M=(_.q-1)*3+1),isUndefined$1(_.h)||(_.h<12&&_.a===1?_.h+=12:_.h===12&&_.a===0&&(_.h=0)),_.G===0&&_.y&&(_.y=-_.y),isUndefined$1(_.u)||(_.S=parseMillis(_.u)),[Object.keys(_).reduce((A,k)=>{const C=S(k);return C&&(A[C]=_[k]),A},{}),v,T]}let dummyDateTimeCache=null;function getDummyDateTime(){return dummyDateTimeCache||(dummyDateTimeCache=DateTime.fromMillis(1555555555555)),dummyDateTimeCache}function maybeExpandMacroToken(_,S){if(_.literal)return _;const v=Formatter.macroTokenToFormatOpts(_.val),T=formatOptsToTokens(v,S);return T==null||T.includes(void 0)?_:T}function expandMacroTokens(_,S){return Array.prototype.concat(..._.map(v=>maybeExpandMacroToken(v,S)))}class TokenParser{constructor(S,v){if(this.locale=S,this.format=v,this.tokens=expandMacroTokens(Formatter.parseFormat(v),S),this.units=this.tokens.map(T=>unitForToken(T,S)),this.disqualifyingUnit=this.units.find(T=>T.invalidReason),!this.disqualifyingUnit){const[T,O]=buildRegex(this.units);this.regex=RegExp(T,"i"),this.handlers=O}}explainFromTokens(S){if(this.isValid){const[v,T]=match(S,this.regex,this.handlers),[O,A,k]=T?dateTimeFromMatches(T):[null,null,void 0];if(hasOwnProperty$1(T,"a")&&hasOwnProperty$1(T,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:S,tokens:this.tokens,regex:this.regex,rawMatches:v,matches:T,result:O,zone:A,specificOffset:k}}else return{input:S,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function explainFromTokens(_,S,v){return new TokenParser(_,v).explainFromTokens(S)}function parseFromTokens(_,S,v){const{result:T,zone:O,specificOffset:A,invalidReason:k}=explainFromTokens(_,S,v);return[T,O,A,k]}function formatOptsToTokens(_,S){if(!_)return null;const T=Formatter.create(S,_).dtFormatter(getDummyDateTime()),O=T.formatToParts(),A=T.resolvedOptions();return O.map(k=>tokenForPart(k,_,A))}const INVALID="Invalid DateTime",MAX_DATE=864e13;function unsupportedZone(_){return new Invalid("unsupported zone",`the zone "${_.name}" is not supported`)}function possiblyCachedWeekData(_){return _.weekData===null&&(_.weekData=gregorianToWeek(_.c)),_.weekData}function possiblyCachedLocalWeekData(_){return _.localWeekData===null&&(_.localWeekData=gregorianToWeek(_.c,_.loc.getMinDaysInFirstWeek(),_.loc.getStartOfWeek())),_.localWeekData}function clone(_,S){const v={ts:_.ts,zone:_.zone,c:_.c,o:_.o,loc:_.loc,invalid:_.invalid};return new DateTime({...v,...S,old:v})}function fixOffset(_,S,v){let T=_-S*60*1e3;const O=v.offset(T);if(S===O)return[T,S];T-=(O-S)*60*1e3;const A=v.offset(T);return O===A?[T,O]:[_-Math.min(O,A)*60*1e3,Math.max(O,A)]}function tsToObj(_,S){_+=S*60*1e3;const v=new Date(_);return{year:v.getUTCFullYear(),month:v.getUTCMonth()+1,day:v.getUTCDate(),hour:v.getUTCHours(),minute:v.getUTCMinutes(),second:v.getUTCSeconds(),millisecond:v.getUTCMilliseconds()}}function objToTS(_,S,v){return fixOffset(objToLocalTS(_),S,v)}function adjustTime(_,S){const v=_.o,T=_.c.year+Math.trunc(S.years),O=_.c.month+Math.trunc(S.months)+Math.trunc(S.quarters)*3,A={..._.c,year:T,month:O,day:Math.min(_.c.day,daysInMonth(T,O))+Math.trunc(S.days)+Math.trunc(S.weeks)*7},k=Duration.fromObject({years:S.years-Math.trunc(S.years),quarters:S.quarters-Math.trunc(S.quarters),months:S.months-Math.trunc(S.months),weeks:S.weeks-Math.trunc(S.weeks),days:S.days-Math.trunc(S.days),hours:S.hours,minutes:S.minutes,seconds:S.seconds,milliseconds:S.milliseconds}).as("milliseconds"),C=objToLocalTS(A);let[$,x]=fixOffset(C,v,_.zone);return k!==0&&($+=k,x=_.zone.offset($)),{ts:$,o:x}}function parseDataToDateTime(_,S,v,T,O,A){const{setZone:k,zone:C}=v;if(_&&Object.keys(_).length!==0||S){const $=S||C,x=DateTime.fromObject(_,{...v,zone:$,specificOffset:A});return k?x:x.setZone(C)}else return DateTime.invalid(new Invalid("unparsable",`the input "${O}" can't be parsed as ${T}`))}function toTechFormat(_,S,v=!0){return _.isValid?Formatter.create(Locale.create("en-US"),{allowZ:v,forceSimple:!0}).formatDateTimeFromString(_,S):null}function toISODate(_,S){const v=_.c.year>9999||_.c.year<0;let T="";return v&&_.c.year>=0&&(T+="+"),T+=padStart(_.c.year,v?6:4),S?(T+="-",T+=padStart(_.c.month),T+="-",T+=padStart(_.c.day)):(T+=padStart(_.c.month),T+=padStart(_.c.day)),T}function toISOTime(_,S,v,T,O,A){let k=padStart(_.c.hour);return S?(k+=":",k+=padStart(_.c.minute),(_.c.millisecond!==0||_.c.second!==0||!v)&&(k+=":")):k+=padStart(_.c.minute),(_.c.millisecond!==0||_.c.second!==0||!v)&&(k+=padStart(_.c.second),(_.c.millisecond!==0||!T)&&(k+=".",k+=padStart(_.c.millisecond,3))),O&&(_.isOffsetFixed&&_.offset===0&&!A?k+="Z":_.o<0?(k+="-",k+=padStart(Math.trunc(-_.o/60)),k+=":",k+=padStart(Math.trunc(-_.o%60))):(k+="+",k+=padStart(Math.trunc(_.o/60)),k+=":",k+=padStart(Math.trunc(_.o%60)))),A&&(k+="["+_.zone.ianaName+"]"),k}const defaultUnitValues={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},defaultWeekUnitValues={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},defaultOrdinalUnitValues={ordinal:1,hour:0,minute:0,second:0,millisecond:0},orderedUnits=["year","month","day","hour","minute","second","millisecond"],orderedWeekUnits=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],orderedOrdinalUnits=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnit(_){const S={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"}[_.toLowerCase()];if(!S)throw new InvalidUnitError(_);return S}function normalizeUnitWithLocalWeeks(_){switch(_.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return normalizeUnit(_)}}function guessOffsetForZone(_){return zoneOffsetGuessCache[_]||(zoneOffsetTs===void 0&&(zoneOffsetTs=Settings.now()),zoneOffsetGuessCache[_]=_.offset(zoneOffsetTs)),zoneOffsetGuessCache[_]}function quickDT(_,S){const v=normalizeZone(S.zone,Settings.defaultZone);if(!v.isValid)return DateTime.invalid(unsupportedZone(v));const T=Locale.fromObject(S);let O,A;if(isUndefined$1(_.year))O=Settings.now();else{for(const $ of orderedUnits)isUndefined$1(_[$])&&(_[$]=defaultUnitValues[$]);const k=hasInvalidGregorianData(_)||hasInvalidTimeData(_);if(k)return DateTime.invalid(k);const C=guessOffsetForZone(v);[O,A]=objToTS(_,C,v)}return new DateTime({ts:O,zone:v,loc:T,o:A})}function diffRelative(_,S,v){const T=isUndefined$1(v.round)?!0:v.round,O=(k,C)=>(k=roundTo(k,T||v.calendary?0:2,!0),S.loc.clone(v).relFormatter(v).format(k,C)),A=k=>v.calendary?S.hasSame(_,k)?0:S.startOf(k).diff(_.startOf(k),k).get(k):S.diff(_,k).get(k);if(v.unit)return O(A(v.unit),v.unit);for(const k of v.units){const C=A(k);if(Math.abs(C)>=1)return O(C,k)}return O(_>S?-0:0,v.units[v.units.length-1])}function lastOpts(_){let S={},v;return _.length>0&&typeof _[_.length-1]=="object"?(S=_[_.length-1],v=Array.from(_).slice(0,_.length-1)):v=Array.from(_),[S,v]}let zoneOffsetTs,zoneOffsetGuessCache={};class DateTime{constructor(S){const v=S.zone||Settings.defaultZone;let T=S.invalid||(Number.isNaN(S.ts)?new Invalid("invalid input"):null)||(v.isValid?null:unsupportedZone(v));this.ts=isUndefined$1(S.ts)?Settings.now():S.ts;let O=null,A=null;if(!T)if(S.old&&S.old.ts===this.ts&&S.old.zone.equals(v))[O,A]=[S.old.c,S.old.o];else{const C=isNumber$1(S.o)&&!S.old?S.o:v.offset(this.ts);O=tsToObj(this.ts,C),T=Number.isNaN(O.year)?new Invalid("invalid input"):null,O=T?null:O,A=T?null:C}this._zone=v,this.loc=S.loc||Locale.create(),this.invalid=T,this.weekData=null,this.localWeekData=null,this.c=O,this.o=A,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[S,v]=lastOpts(arguments),[T,O,A,k,C,$,x]=v;return quickDT({year:T,month:O,day:A,hour:k,minute:C,second:$,millisecond:x},S)}static utc(){const[S,v]=lastOpts(arguments),[T,O,A,k,C,$,x]=v;return S.zone=FixedOffsetZone.utcInstance,quickDT({year:T,month:O,day:A,hour:k,minute:C,second:$,millisecond:x},S)}static fromJSDate(S,v={}){const T=isDate$1(S)?S.valueOf():NaN;if(Number.isNaN(T))return DateTime.invalid("invalid input");const O=normalizeZone(v.zone,Settings.defaultZone);return O.isValid?new DateTime({ts:T,zone:O,loc:Locale.fromObject(v)}):DateTime.invalid(unsupportedZone(O))}static fromMillis(S,v={}){if(isNumber$1(S))return S<-MAX_DATE||S>MAX_DATE?DateTime.invalid("Timestamp out of range"):new DateTime({ts:S,zone:normalizeZone(v.zone,Settings.defaultZone),loc:Locale.fromObject(v)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof S} with value ${S}`)}static fromSeconds(S,v={}){if(isNumber$1(S))return new DateTime({ts:S*1e3,zone:normalizeZone(v.zone,Settings.defaultZone),loc:Locale.fromObject(v)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(S,v={}){S=S||{};const T=normalizeZone(v.zone,Settings.defaultZone);if(!T.isValid)return DateTime.invalid(unsupportedZone(T));const O=Locale.fromObject(v),A=normalizeObject(S,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:k,startOfWeek:C}=usesLocalWeekValues(A,O),$=Settings.now(),x=isUndefined$1(v.specificOffset)?T.offset($):v.specificOffset,N=!isUndefined$1(A.ordinal),D=!isUndefined$1(A.year),q=!isUndefined$1(A.month)||!isUndefined$1(A.day),M=D||q,U=A.weekYear||A.weekNumber;if((M||N)&&U)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(q&&N)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const z=U||A.weekday&&!M;let W,j,B=tsToObj($,x);z?(W=orderedWeekUnits,j=defaultWeekUnitValues,B=gregorianToWeek(B,k,C)):N?(W=orderedOrdinalUnits,j=defaultOrdinalUnitValues,B=gregorianToOrdinal(B)):(W=orderedUnits,j=defaultUnitValues);let Z=!1;for(const se of W){const ie=A[se];isUndefined$1(ie)?Z?A[se]=j[se]:A[se]=B[se]:Z=!0}const X=z?hasInvalidWeekData(A,k,C):N?hasInvalidOrdinalData(A):hasInvalidGregorianData(A),Q=X||hasInvalidTimeData(A);if(Q)return DateTime.invalid(Q);const ee=z?weekToGregorian(A,k,C):N?ordinalToGregorian(A):A,[ce,pe]=objToTS(ee,x,T),ae=new DateTime({ts:ce,zone:T,o:pe,loc:O});return A.weekday&&M&&S.weekday!==ae.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${A.weekday} and a date of ${ae.toISO()}`):ae.isValid?ae:DateTime.invalid(ae.invalid)}static fromISO(S,v={}){const[T,O]=parseISODate(S);return parseDataToDateTime(T,O,v,"ISO 8601",S)}static fromRFC2822(S,v={}){const[T,O]=parseRFC2822Date(S);return parseDataToDateTime(T,O,v,"RFC 2822",S)}static fromHTTP(S,v={}){const[T,O]=parseHTTPDate(S);return parseDataToDateTime(T,O,v,"HTTP",v)}static fromFormat(S,v,T={}){if(isUndefined$1(S)||isUndefined$1(v))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:O=null,numberingSystem:A=null}=T,k=Locale.fromOpts({locale:O,numberingSystem:A,defaultToEN:!0}),[C,$,x,N]=parseFromTokens(k,S,v);return N?DateTime.invalid(N):parseDataToDateTime(C,$,T,`format ${v}`,S,x)}static fromString(S,v,T={}){return DateTime.fromFormat(S,v,T)}static fromSQL(S,v={}){const[T,O]=parseSQL(S);return parseDataToDateTime(T,O,v,"SQL",S)}static invalid(S,v=null){if(!S)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const T=S instanceof Invalid?S:new Invalid(S,v);if(Settings.throwOnInvalid)throw new InvalidDateTimeError(T);return new DateTime({invalid:T})}static isDateTime(S){return S&&S.isLuxonDateTime||!1}static parseFormatForOpts(S,v={}){const T=formatOptsToTokens(S,Locale.fromObject(v));return T?T.map(O=>O?O.val:null).join(""):null}static expandFormat(S,v={}){return expandMacroTokens(Formatter.parseFormat(S),Locale.fromObject(v)).map(O=>O.val).join("")}static resetCache(){zoneOffsetTs=void 0,zoneOffsetGuessCache={}}get(S){return this[S]}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?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?possiblyCachedLocalWeekData(this).weekday:NaN}get localWeekNumber(){return this.isValid?possiblyCachedLocalWeekData(this).weekNumber:NaN}get localWeekYear(){return this.isValid?possiblyCachedLocalWeekData(this).weekYear:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.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 S=864e5,v=6e4,T=objToLocalTS(this.c),O=this.zone.offset(T-S),A=this.zone.offset(T+S),k=this.zone.offset(T-O*v),C=this.zone.offset(T-A*v);if(k===C)return[this];const $=T-k*v,x=T-C*v,N=tsToObj($,k),D=tsToObj(x,C);return N.hour===D.hour&&N.minute===D.minute&&N.second===D.second&&N.millisecond===D.millisecond?[clone(this,{ts:$}),clone(this,{ts:x})]:[this]}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?weeksInWeekYear(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(S={}){const{locale:v,numberingSystem:T,calendar:O}=Formatter.create(this.loc.clone(S),S).resolvedOptions(this);return{locale:v,numberingSystem:T,outputCalendar:O}}toUTC(S=0,v={}){return this.setZone(FixedOffsetZone.instance(S),v)}toLocal(){return this.setZone(Settings.defaultZone)}setZone(S,{keepLocalTime:v=!1,keepCalendarTime:T=!1}={}){if(S=normalizeZone(S,Settings.defaultZone),S.equals(this.zone))return this;if(S.isValid){let O=this.ts;if(v||T){const A=S.offset(this.ts),k=this.toObject();[O]=objToTS(k,A,S)}return clone(this,{ts:O,zone:S})}else return DateTime.invalid(unsupportedZone(S))}reconfigure({locale:S,numberingSystem:v,outputCalendar:T}={}){const O=this.loc.clone({locale:S,numberingSystem:v,outputCalendar:T});return clone(this,{loc:O})}setLocale(S){return this.reconfigure({locale:S})}set(S){if(!this.isValid)return this;const v=normalizeObject(S,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:T,startOfWeek:O}=usesLocalWeekValues(v,this.loc),A=!isUndefined$1(v.weekYear)||!isUndefined$1(v.weekNumber)||!isUndefined$1(v.weekday),k=!isUndefined$1(v.ordinal),C=!isUndefined$1(v.year),$=!isUndefined$1(v.month)||!isUndefined$1(v.day),x=C||$,N=v.weekYear||v.weekNumber;if((x||k)&&N)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if($&&k)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let D;A?D=weekToGregorian({...gregorianToWeek(this.c,T,O),...v},T,O):isUndefined$1(v.ordinal)?(D={...this.toObject(),...v},isUndefined$1(v.day)&&(D.day=Math.min(daysInMonth(D.year,D.month),D.day))):D=ordinalToGregorian({...gregorianToOrdinal(this.c),...v});const[q,M]=objToTS(D,this.o,this.zone);return clone(this,{ts:q,o:M})}plus(S){if(!this.isValid)return this;const v=Duration.fromDurationLike(S);return clone(this,adjustTime(this,v))}minus(S){if(!this.isValid)return this;const v=Duration.fromDurationLike(S).negate();return clone(this,adjustTime(this,v))}startOf(S,{useLocaleWeeks:v=!1}={}){if(!this.isValid)return this;const T={},O=Duration.normalizeUnit(S);switch(O){case"years":T.month=1;case"quarters":case"months":T.day=1;case"weeks":case"days":T.hour=0;case"hours":T.minute=0;case"minutes":T.second=0;case"seconds":T.millisecond=0;break}if(O==="weeks")if(v){const A=this.loc.getStartOfWeek(),{weekday:k}=this;k<A&&(T.weekNumber=this.weekNumber-1),T.weekday=A}else T.weekday=1;if(O==="quarters"){const A=Math.ceil(this.month/3);T.month=(A-1)*3+1}return this.set(T)}endOf(S,v){return this.isValid?this.plus({[S]:1}).startOf(S,v).minus(1):this}toFormat(S,v={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(v)).formatDateTimeFromString(this,S):INVALID}toLocaleString(S=DATE_SHORT,v={}){return this.isValid?Formatter.create(this.loc.clone(v),S).formatDateTime(this):INVALID}toLocaleParts(S={}){return this.isValid?Formatter.create(this.loc.clone(S),S).formatDateTimeParts(this):[]}toISO({format:S="extended",suppressSeconds:v=!1,suppressMilliseconds:T=!1,includeOffset:O=!0,extendedZone:A=!1}={}){if(!this.isValid)return null;const k=S==="extended";let C=toISODate(this,k);return C+="T",C+=toISOTime(this,k,v,T,O,A),C}toISODate({format:S="extended"}={}){return this.isValid?toISODate(this,S==="extended"):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:S=!1,suppressSeconds:v=!1,includeOffset:T=!0,includePrefix:O=!1,extendedZone:A=!1,format:k="extended"}={}){return this.isValid?(O?"T":"")+toISOTime(this,k==="extended",v,S,T,A):null}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:S=!0,includeZone:v=!1,includeOffsetSpace:T=!0}={}){let O="HH:mm:ss.SSS";return(v||S)&&(T&&(O+=" "),v?O+="z":S&&(O+="ZZ")),toTechFormat(this,O,!0)}toSQL(S={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(S)}`:null}toString(){return this.isValid?this.toISO():INVALID}[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(S={}){if(!this.isValid)return{};const v={...this.c};return S.includeConfig&&(v.outputCalendar=this.outputCalendar,v.numberingSystem=this.loc.numberingSystem,v.locale=this.loc.locale),v}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(S,v="milliseconds",T={}){if(!this.isValid||!S.isValid)return Duration.invalid("created by diffing an invalid DateTime");const O={locale:this.locale,numberingSystem:this.numberingSystem,...T},A=maybeArray(v).map(Duration.normalizeUnit),k=S.valueOf()>this.valueOf(),C=k?this:S,$=k?S:this,x=diff(C,$,A,O);return k?x.negate():x}diffNow(S="milliseconds",v={}){return this.diff(DateTime.now(),S,v)}until(S){return this.isValid?Interval.fromDateTimes(this,S):this}hasSame(S,v,T){if(!this.isValid)return!1;const O=S.valueOf(),A=this.setZone(S.zone,{keepLocalTime:!0});return A.startOf(v,T)<=O&&O<=A.endOf(v,T)}equals(S){return this.isValid&&S.isValid&&this.valueOf()===S.valueOf()&&this.zone.equals(S.zone)&&this.loc.equals(S.loc)}toRelative(S={}){if(!this.isValid)return null;const v=S.base||DateTime.fromObject({},{zone:this.zone}),T=S.padding?this<v?-S.padding:S.padding:0;let O=["years","months","days","hours","minutes","seconds"],A=S.unit;return Array.isArray(S.unit)&&(O=S.unit,A=void 0),diffRelative(v,this.plus(T),{...S,numeric:"always",units:O,unit:A})}toRelativeCalendar(S={}){return this.isValid?diffRelative(S.base||DateTime.fromObject({},{zone:this.zone}),this,{...S,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...S){if(!S.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(S,v=>v.valueOf(),Math.min)}static max(...S){if(!S.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(S,v=>v.valueOf(),Math.max)}static fromFormatExplain(S,v,T={}){const{locale:O=null,numberingSystem:A=null}=T,k=Locale.fromOpts({locale:O,numberingSystem:A,defaultToEN:!0});return explainFromTokens(k,S,v)}static fromStringExplain(S,v,T={}){return DateTime.fromFormatExplain(S,v,T)}static buildFormatParser(S,v={}){const{locale:T=null,numberingSystem:O=null}=v,A=Locale.fromOpts({locale:T,numberingSystem:O,defaultToEN:!0});return new TokenParser(A,S)}static fromFormatParser(S,v,T={}){if(isUndefined$1(S)||isUndefined$1(v))throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");const{locale:O=null,numberingSystem:A=null}=T,k=Locale.fromOpts({locale:O,numberingSystem:A,defaultToEN:!0});if(!k.equals(v.locale))throw new InvalidArgumentError(`fromFormatParser called with a locale of ${k}, but the format parser was created for ${v.locale}`);const{result:C,zone:$,specificOffset:x,invalidReason:N}=v.explainFromTokens(S);return N?DateTime.invalid(N):parseDataToDateTime(C,$,T,`format ${v.format}`,S,x)}static get DATE_SHORT(){return DATE_SHORT}static get DATE_MED(){return DATE_MED}static get DATE_MED_WITH_WEEKDAY(){return DATE_MED_WITH_WEEKDAY}static get DATE_FULL(){return DATE_FULL}static get DATE_HUGE(){return DATE_HUGE}static get TIME_SIMPLE(){return TIME_SIMPLE}static get TIME_WITH_SECONDS(){return TIME_WITH_SECONDS}static get TIME_WITH_SHORT_OFFSET(){return TIME_WITH_SHORT_OFFSET}static get TIME_WITH_LONG_OFFSET(){return TIME_WITH_LONG_OFFSET}static get TIME_24_SIMPLE(){return TIME_24_SIMPLE}static get TIME_24_WITH_SECONDS(){return TIME_24_WITH_SECONDS}static get TIME_24_WITH_SHORT_OFFSET(){return TIME_24_WITH_SHORT_OFFSET}static get TIME_24_WITH_LONG_OFFSET(){return TIME_24_WITH_LONG_OFFSET}static get DATETIME_SHORT(){return DATETIME_SHORT}static get DATETIME_SHORT_WITH_SECONDS(){return DATETIME_SHORT_WITH_SECONDS}static get DATETIME_MED(){return DATETIME_MED}static get DATETIME_MED_WITH_SECONDS(){return DATETIME_MED_WITH_SECONDS}static get DATETIME_MED_WITH_WEEKDAY(){return DATETIME_MED_WITH_WEEKDAY}static get DATETIME_FULL(){return DATETIME_FULL}static get DATETIME_FULL_WITH_SECONDS(){return DATETIME_FULL_WITH_SECONDS}static get DATETIME_HUGE(){return DATETIME_HUGE}static get DATETIME_HUGE_WITH_SECONDS(){return DATETIME_HUGE_WITH_SECONDS}}function friendlyDateTime(_){if(DateTime.isDateTime(_))return _;if(_&&_.valueOf&&isNumber$1(_.valueOf()))return DateTime.fromJSDate(_);if(_&&typeof _=="object")return DateTime.fromObject(_);throw new InvalidArgumentError(`Unknown datetime argument: ${_}, of type ${typeof _}`)}const e$3={};let p$2;const u$3=new Uint8Array(16),y$1=[];for(let _=0;_<256;++_)y$1.push((_+256).toString(16).slice(1));function g(_,S,v){return _.msecs??=-1/0,_.seq??=0,S>_.msecs?(_.seq=v[6]<<23|v[7]<<16|v[8]<<8|v[9],_.msecs=S):(_.seq=Math.trunc(_.seq+1),_.seq===0&&_.msecs++),_}function l$2(_,S,v,T,O=0){return T||(T=new Uint8Array(16),O=0),S??=Date.now(),v??=_[6]*127<<24|_[7]<<16|_[8]<<8|_[9],T[O++]=S/1099511627776&255,T[O++]=S/4294967296&255,T[O++]=S/16777216&255,T[O++]=S/65536&255,T[O++]=S/256&255,T[O++]=S&255,T[O++]=112|v>>>28&15,T[O++]=v>>>20&255,T[O++]=128|v>>>14&63,T[O++]=v>>>6&255,T[O++]=v<<2&255|_[10]&3,T[O++]=_[11],T[O++]=_[12],T[O++]=_[13],T[O++]=_[14],T[O++]=_[15],T}function V$1(_,S=0){return(y$1[_[S]]+y$1[_[S+1]]+y$1[_[S+2]]+y$1[_[S+3]]+"-"+y$1[_[S+4]]+y$1[_[S+5]]+"-"+y$1[_[S+6]]+y$1[_[S+7]]+"-"+y$1[_[S+8]]+y$1[_[S+9]]+"-"+y$1[_[S+10]]+y$1[_[S+11]]+y$1[_[S+12]]+y$1[_[S+13]]+y$1[_[S+14]]+y$1[_[S+15]]).toLowerCase()}function d$1(){const _=Date.now();if(!p$2){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported.");p$2=crypto.getRandomValues.bind(crypto)}const S=p$2(u$3);g(e$3,_,S);const v=l$2(S,e$3.msecs,e$3.seq,void 0,void 0);return V$1(v)}const p$1=/[&<>'"]/g,l$1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,d={"&":"&amp","<":"&lt",">":"&gt","'":"&#39",'"':"&quot"},f$1={"&amp":"&","&#38":"&","&lt":"<","&#60":"<","&gt":">","&#62":">","&apos":"'","&#39":"'","&quot":'"',"&#34":'"'};class b{getRandom(S=8){return[...Array(S)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,S=>{const v=Math.trunc(Math.random()*16);return(S==="x"?v:v&3|8).toString(16)})}getUuidRfc4122(){return d$1()}encode(S){return c.isString(S)?S.replace(p$1,v=>d[v]):S}decode(S){return c.isString(S)?S.replace(l$1,v=>f$1[v]):S}toNumber(S){const v=Number.parseFloat(S);return c.isNumber(v)?v:0}toInteger(S){return this.toNumber(Number.parseInt(S,10))}toBoolean(S,v=[]){const T=c.isString(S)?S.toLowerCase():S;return["true","y","1",1,!0,...v].includes(T)}toCamelCase(S){if(!c.isStringFilled(S))return S;const v=/[-_\s]+(.)?/g;return v.test(S)?(S=S.toLowerCase(),S=S.replace(v,(T,O)=>O?O.toUpperCase():""),S[0].toLowerCase()+S.substring(1)):S.match(/^[A-Z]+$/)?S.toLowerCase():S[0].toLowerCase()+S.slice(1)}toPascalCase(S){return c.isStringFilled(S)?this.capitalize(this.toCamelCase(S)):S}toKebabCase(S){if(!c.isStringFilled(S))return S;const v=S.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return v?v.map(T=>T.toLowerCase()).join("-"):S}capitalize(S){return c.isStringFilled(S)?S[0].toUpperCase()+S.substring(1):S}numberFormat(S,v=0,T=".",O=","){const A=Number.isFinite(S)?S:0,k=Number.isFinite(v)?Math.abs(v):0,C=(k?(($,x)=>{const N=Math.pow(10,x);return Math.round($*N)/N})(A,k):Math.round(A)).toString().split(".");return C[0].length>3&&(C[0]=C[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,O)),(C[1]||"").length<k&&(C[1]=C[1]||"",C[1]+=new Array(k-C[1].length+1).join("0")),C.join(T)}toDateTime(S,v,T){return!(typeof v>"u")&&c.isStringFilled(v)?DateTime.fromFormat(S,v,T):DateTime.fromISO(S,T)}getDateForLog(){return DateTime.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(S){let v="";for(const T in S){if(!S.hasOwnProperty(T))continue;const O=S[T];c.isArray(O)?O.forEach((A,k)=>{v+=encodeURIComponent(T+"["+k+"]")+"="+encodeURIComponent(A)+"&"}):v+=encodeURIComponent(T)+"="+encodeURIComponent(O)+"&"}return v.length>0&&(v=v.substring(0,v.length-1)),v}}const h$1=new b;let e$2="";try{e$2=navigator?.userAgent.toLowerCase()}catch{e$2="?"}let r$1=class{isOpera(){return e$2.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return e$2.includes("msie 6")}isIE7(){return e$2.includes("msie 7")}isIE8(){return e$2.includes("msie 8")}isIE9(){return"documentMode"in document&&document.documentMode>=9}isIE10(){return"documentMode"in document&&document.documentMode>=10}isSafari(){return e$2.includes("safari")&&!e$2.includes("chrome")}isFirefox(){return e$2.includes("firefox")}isChrome(){return e$2.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let S=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?S=11:this.isIE10()?S=10:this.isIE9()?S=9:this.isIE()&&(S=8),S===-1||S===8){if(navigator.appName==="Microsoft Internet Explorer"){const v=new RegExp("MSIE ([0-9]+[.0-9]*)"),T=navigator.userAgent.match(v);c.isArrayLike(T)&&T.length>0&&(S=Number.parseFloat(T[1]))}if(navigator.appName==="Netscape"){S=11;const v=new RegExp("Trident/.*rv:([0-9]+[.0-9]*)");if(v.exec(navigator.userAgent)!=null){const T=navigator.userAgent.match(v);c.isArrayLike(T)&&T.length>0&&(S=Number.parseFloat(T[1]))}}}return S}isIE11(){return this.detectIEVersion()>=11}isMac(){return e$2.includes("macintosh")}isWin(){return e$2.includes("windows")}isLinux(){return e$2.includes("linux")&&!this.isAndroid()}isAndroid(){return e$2.includes("android")}isIPad(){return e$2.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return e$2.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||e$2.includes("mobile")||e$2.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}isDoctype(S){const v=S||document;return v.compatMode?v.compatMode==="CSS1Compat":v.documentElement&&v.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const S=new RegExp("Android ([0-9]+[.0-9]*)");if(S.exec(navigator.userAgent)!=null){const v=navigator.userAgent.match(S);if(c.isArrayLike(v)&&v.length>0)return Number.parseFloat(v[1])}return 0}};const s$1=new r$1,RestrictionManagerParamsBase={sleep:1e3,speed:.001,amount:30},RestrictionManagerParamsForEnterprise={sleep:600,speed:.01,amount:30*5};var EnumCrmEntityType=(_=>(_.undefined="UNDEFINED",_.lead="CRM_LEAD",_.deal="CRM_DEAL",_.contact="CRM_CONTACT",_.company="CRM_COMPANY",_.oldInvoice="CRM_INVOICE",_.invoice="CRM_SMART_INVOICE",_.quote="CRM_QUOTE",_.requisite="CRM_REQUISITE",_))(EnumCrmEntityType||{}),EnumCrmEntityTypeId=(_=>(_[_.undefined=0]="undefined",_[_.lead=1]="lead",_[_.deal=2]="deal",_[_.contact=3]="contact",_[_.company=4]="company",_[_.oldInvoice=5]="oldInvoice",_[_.invoice=31]="invoice",_[_.quote=7]="quote",_[_.requisite=8]="requisite",_))(EnumCrmEntityTypeId||{}),LoadDataType=(_=>(_.App="app",_.Profile="profile",_.Currency="currency",_.AppOptions="appOptions",_.UserOptions="userOptions",_))(LoadDataType||{});const EnumAppStatus={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},StatusDescriptions={[EnumAppStatus.Free]:"Free",[EnumAppStatus.Demo]:"Demo",[EnumAppStatus.Trial]:"Trial",[EnumAppStatus.Paid]:"Paid",[EnumAppStatus.Local]:"Local",[EnumAppStatus.Subscription]:"Subscription"},TypeSpecificUrl={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var TypeOption=(_=>(_.NotSet="notSet",_.JsonArray="jsonArray",_.JsonObject="jsonObject",_.FloatVal="float",_.IntegerVal="integer",_.BoolYN="boolYN",_.StringVal="string",_))(TypeOption||{}),ConnectionType=(_=>(_.Undefined="undefined",_.WebSocket="webSocket",_.LongPolling="longPolling",_))(ConnectionType||{}),LsKeys=(_=>(_.PullConfig="bx-pull-config",_.WebsocketBlocked="bx-pull-websocket-blocked",_.LongPollingBlocked="bx-pull-longpolling-blocked",_.LoggingEnabled="bx-pull-logging-enabled",_))(LsKeys||{}),PullStatus=(_=>(_.Online="online",_.Offline="offline",_.Connecting="connect",_))(PullStatus||{}),SenderType=(_=>(_[_.Unknown=0]="Unknown",_[_.Client=1]="Client",_[_.Backend=2]="Backend",_))(SenderType||{}),SubscriptionType=(_=>(_.Server="server",_.Client="client",_.Online="online",_.Status="status",_.Revision="revision",_))(SubscriptionType||{}),CloseReasons=(_=>(_[_.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",_[_.SERVER_DIE=1001]="SERVER_DIE",_[_.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",_[_.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",_[_.SERVER_RESTARTED=3002]="SERVER_RESTARTED",_[_.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",_[_.MANUAL=3004]="MANUAL",_[_.STUCK=3005]="STUCK",_[_.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",_))(CloseReasons||{}),SystemCommands=(_=>(_.CHANNEL_EXPIRE="CHANNEL_EXPIRE",_.CONFIG_EXPIRE="CONFIG_EXPIRE",_.SERVER_RESTART="SERVER_RESTART",_))(SystemCommands||{}),ServerMode=(_=>(_.Shared="shared",_.Personal="personal",_))(ServerMode||{});const ListRpcError={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 RpcMethod=(_=>(_.Publish="publish",_.GetUsersLastSeen="getUsersLastSeen",_.Ping="ping",_.ListChannels="listChannels",_.SubscribeStatusChange="subscribeStatusChange",_.UnsubscribeStatusChange="unsubscribeStatusChange",_))(RpcMethod||{});class Result{_errorCollection;_data;constructor(){this._errorCollection=new Set,this._data=null}get isSuccess(){return this._errorCollection.size===0}setData(S){return this._data=S,this}getData(){return this._data}addError(S){return S instanceof Error?this._errorCollection.add(S):this._errorCollection.add(new Error(S.toString())),this}addErrors(S){for(const v of S)v instanceof Error?this._errorCollection.add(v):this._errorCollection.add(new Error(v.toString()));return this}getErrors(){return this._errorCollection.values()}getErrorMessages(){return[...this.getErrors()].map(S=>S.message)}toString(){return this.isSuccess?`Result (success): data: ${JSON.stringify(this._data)}`:`Result (failure): errors: ${this.getErrorMessages().join(", ")}`}}class AjaxError extends Error{cause;_status;_answerError;constructor(S){const v=`${S.answerError.error}${S.answerError.errorDescription?": "+S.answerError.errorDescription:""}`;super(v),this.cause=S.cause||null,this.name=this.constructor.name,this._status=S.status,this._answerError=S.answerError}get answerError(){return this._answerError}get status(){return this._status}set status(S){this._status=S}toString(){return`${this.answerError.error}${this.answerError.errorDescription?": "+this.answerError.errorDescription:""} (${this.status})`}}class AjaxResult extends Result{_status;_query;_data;constructor(S,v,T){if(super(),this._data=S,this._query=structuredClone(v),this._status=T,typeof this._data.error<"u"){const O=typeof this._data.error=="string"?this._data:this._data.error;this.addError(new AjaxError({status:this._status,answerError:{error:O.error||"",errorDescription:O.error_description||""}}))}}setData(S){throw new Error("AjaxResult not support setData()")}getData(){return this._data}isMore(){return c.isNumber(this._data?.next)}getTotal(){return h$1.toInteger(this._data?.total)}getStatus(){return this._status}getQuery(){return this._query}async getNext(S){return this.isMore()&&this.isSuccess?(this._query.start=Number.parseInt(this._data?.next),S.call(this._query.method,this._query.params,this._query.start)):Promise.resolve(!1)}}let a$1=class{#e;#t;#r;_logger=null;constructor(){this.#e=RestrictionManagerParamsBase,this.#r=0,this.#t=0}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}get params(){return{...this.#e}}set params(S){this.#e=S,this.getLogger().log("new restriction manager params",S)}check(S=""){return new Promise(v=>{if(this.#i(),this.#s())return this.getLogger().log(`>> no sleep >>> ${S}`,this.#n()),this.#o(),v(null);{const T=A=>{this.getLogger().info(`>> go sleep >>> ${S}`,this.#n()),setTimeout(()=>{A()},this.#e.sleep)},O=()=>{if(this.#i(),this.#s())return this.getLogger().info(`<< stop sleep <<< ${S}`,this.#n()),this.#o(),v(null);T(O)};T(O)}})}#n(){return`${this.#r.toFixed(4)} from ${this.#e.amount}`}#i(){this.#t>0&&(this.#r-=(Date.now()-this.#t)*this.#e.speed,this.#r<0&&(this.#r=0)),this.#t=Date.now()}#o(){this.#r++}#s(){return this.#r<this.#e.amount}};const t$2="X-Request-ID",r="bx24_request_id",n$1="bx24_sdk_ver";let u$2=class{getQueryStringParameterName(){return r}getQueryStringSdkParameterName(){return n$1}generate(){return h$1.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return t$2}};function bind(_,S){return function(){return _.apply(S,arguments)}}const{toString}=Object.prototype,{getPrototypeOf}=Object,kindOf=(_=>S=>{const v=toString.call(S);return _[v]||(_[v]=v.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=_=>(_=_.toLowerCase(),S=>kindOf(S)===_),typeOfTest=_=>S=>typeof S===_,{isArray}=Array,isUndefined=typeOfTest("undefined");function isBuffer(_){return _!==null&&!isUndefined(_)&&_.constructor!==null&&!isUndefined(_.constructor)&&isFunction(_.constructor.isBuffer)&&_.constructor.isBuffer(_)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(_){let S;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?S=ArrayBuffer.isView(_):S=_&&_.buffer&&isArrayBuffer(_.buffer),S}const isString=typeOfTest("string"),isFunction=typeOfTest("function"),isNumber=typeOfTest("number"),isObject=_=>_!==null&&typeof _=="object",isBoolean=_=>_===!0||_===!1,isPlainObject=_=>{if(kindOf(_)!=="object")return!1;const S=getPrototypeOf(_);return(S===null||S===Object.prototype||Object.getPrototypeOf(S)===null)&&!(Symbol.toStringTag in _)&&!(Symbol.iterator in _)},isDate=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=_=>isObject(_)&&isFunction(_.pipe),isFormData=_=>{let S;return _&&(typeof FormData=="function"&&_ instanceof FormData||isFunction(_.append)&&((S=kindOf(_))==="formdata"||S==="object"&&isFunction(_.toString)&&_.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim=_=>_.trim?_.trim():_.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(_,S,{allOwnKeys:v=!1}={}){if(_===null||typeof _>"u")return;let T,O;if(typeof _!="object"&&(_=[_]),isArray(_))for(T=0,O=_.length;T<O;T++)S.call(null,_[T],T,_);else{const A=v?Object.getOwnPropertyNames(_):Object.keys(_),k=A.length;let C;for(T=0;T<k;T++)C=A[T],S.call(null,_[C],C,_)}}function findKey(_,S){S=S.toLowerCase();const v=Object.keys(_);let T=v.length,O;for(;T-- >0;)if(O=v[T],S===O.toLowerCase())return O;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,isContextDefined=_=>!isUndefined(_)&&_!==_global;function merge(){const{caseless:_}=isContextDefined(this)&&this||{},S={},v=(T,O)=>{const A=_&&findKey(S,O)||O;isPlainObject(S[A])&&isPlainObject(T)?S[A]=merge(S[A],T):isPlainObject(T)?S[A]=merge({},T):isArray(T)?S[A]=T.slice():S[A]=T};for(let T=0,O=arguments.length;T<O;T++)arguments[T]&&forEach(arguments[T],v);return S}const extend=(_,S,v,{allOwnKeys:T}={})=>(forEach(S,(O,A)=>{v&&isFunction(O)?_[A]=bind(O,v):_[A]=O},{allOwnKeys:T}),_),stripBOM=_=>(_.charCodeAt(0)===65279&&(_=_.slice(1)),_),inherits=(_,S,v,T)=>{_.prototype=Object.create(S.prototype,T),_.prototype.constructor=_,Object.defineProperty(_,"super",{value:S.prototype}),v&&Object.assign(_.prototype,v)},toFlatObject=(_,S,v,T)=>{let O,A,k;const C={};if(S=S||{},_==null)return S;do{for(O=Object.getOwnPropertyNames(_),A=O.length;A-- >0;)k=O[A],(!T||T(k,_,S))&&!C[k]&&(S[k]=_[k],C[k]=!0);_=v!==!1&&getPrototypeOf(_)}while(_&&(!v||v(_,S))&&_!==Object.prototype);return S},endsWith=(_,S,v)=>{_=String(_),(v===void 0||v>_.length)&&(v=_.length),v-=S.length;const T=_.indexOf(S,v);return T!==-1&&T===v},toArray=_=>{if(!_)return null;if(isArray(_))return _;let S=_.length;if(!isNumber(S))return null;const v=new Array(S);for(;S-- >0;)v[S]=_[S];return v},isTypedArray=(_=>S=>_&&S instanceof _)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(_,S)=>{const T=(_&&_[Symbol.iterator]).call(_);let O;for(;(O=T.next())&&!O.done;){const A=O.value;S.call(_,A[0],A[1])}},matchAll=(_,S)=>{let v;const T=[];for(;(v=_.exec(S))!==null;)T.push(v);return T},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=_=>_.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(v,T,O){return T.toUpperCase()+O}),hasOwnProperty=(({hasOwnProperty:_})=>(S,v)=>_.call(S,v))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(_,S)=>{const v=Object.getOwnPropertyDescriptors(_),T={};forEach(v,(O,A)=>{let k;(k=S(O,A,_))!==!1&&(T[A]=k||O)}),Object.defineProperties(_,T)},freezeMethods=_=>{reduceDescriptors(_,(S,v)=>{if(isFunction(_)&&["arguments","caller","callee"].indexOf(v)!==-1)return!1;const T=_[v];if(isFunction(T)){if(S.enumerable=!1,"writable"in S){S.writable=!1;return}S.set||(S.set=()=>{throw Error("Can not rewrite read-only method '"+v+"'")})}})},toObjectSet=(_,S)=>{const v={},T=O=>{O.forEach(A=>{v[A]=!0})};return isArray(_)?T(_):T(String(_).split(S)),v},noop=()=>{},toFiniteNumber=(_,S)=>_!=null&&Number.isFinite(_=+_)?_:S,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(_=16,S=ALPHABET.ALPHA_DIGIT)=>{let v="";const{length:T}=S;for(;_--;)v+=S[Math.random()*T|0];return v};function isSpecCompliantForm(_){return!!(_&&isFunction(_.append)&&_[Symbol.toStringTag]==="FormData"&&_[Symbol.iterator])}const toJSONObject=_=>{const S=new Array(10),v=(T,O)=>{if(isObject(T)){if(S.indexOf(T)>=0)return;if(!("toJSON"in T)){S[O]=T;const A=isArray(T)?[]:{};return forEach(T,(k,C)=>{const $=v(k,O+1);!isUndefined($)&&(A[C]=$)}),S[O]=void 0,A}}return T};return v(_,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=_=>_&&(isObject(_)||isFunction(_))&&isFunction(_.then)&&isFunction(_.catch),_setImmediate=((_,S)=>_?setImmediate:S?((v,T)=>(_global.addEventListener("message",({source:O,data:A})=>{O===_global&&A===v&&T.length&&T.shift()()},!1),O=>{T.push(O),_global.postMessage(v,"*")}))(`axios@${Math.random()}`,[]):v=>setTimeout(v))(typeof setImmediate=="function",isFunction(_global.postMessage)),asap=typeof queueMicrotask<"u"?queueMicrotask.bind(_global):typeof process<"u"&&process.nextTick||_setImmediate,utils$2={isArray,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString,isNumber,isBoolean,isObject,isPlainObject,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate,isFile,isBlob,isRegExp,isFunction,isStream,isURLSearchParams,isTypedArray,isFileList,forEach,merge,extend,trim,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray,forEachEntry,matchAll,isHTMLForm,hasOwnProperty,hasOwnProp:hasOwnProperty,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable,setImmediate:_setImmediate,asap};function AxiosError$1(_,S,v,T,O){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=_,this.name="AxiosError",S&&(this.code=S),v&&(this.config=v),T&&(this.request=T),O&&(this.response=O,this.status=O.status?O.status:null)}utils$2.inherits(AxiosError$1,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:utils$2.toJSONObject(this.config),code:this.code,status:this.status}}});const prototype$1=AxiosError$1.prototype,descriptors={};["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(_=>{descriptors[_]={value:_}}),Object.defineProperties(AxiosError$1,descriptors),Object.defineProperty(prototype$1,"isAxiosError",{value:!0}),AxiosError$1.from=(_,S,v,T,O,A)=>{const k=Object.create(prototype$1);return utils$2.toFlatObject(_,k,function($){return $!==Error.prototype},C=>C!=="isAxiosError"),AxiosError$1.call(k,_.message,S,v,T,O),k.cause=_,k.name=_.name,A&&Object.assign(k,A),k};const httpAdapter=null;function isVisitable(_){return utils$2.isPlainObject(_)||utils$2.isArray(_)}function removeBrackets(_){return utils$2.endsWith(_,"[]")?_.slice(0,-2):_}function renderKey(_,S,v){return _?_.concat(S).map(function(O,A){return O=removeBrackets(O),!v&&A?"["+O+"]":O}).join(v?".":""):S}function isFlatArray(_){return utils$2.isArray(_)&&!_.some(isVisitable)}const predicates=utils$2.toFlatObject(utils$2,{},null,function(S){return/^is[A-Z]/.test(S)});function toFormData$1(_,S,v){if(!utils$2.isObject(_))throw new TypeError("target must be an object");S=S||new FormData,v=utils$2.toFlatObject(v,{metaTokens:!0,dots:!1,indexes:!1},!1,function(z,W){return!utils$2.isUndefined(W[z])});const T=v.metaTokens,O=v.visitor||N,A=v.dots,k=v.indexes,$=(v.Blob||typeof Blob<"u"&&Blob)&&utils$2.isSpecCompliantForm(S);if(!utils$2.isFunction(O))throw new TypeError("visitor must be a function");function x(U){if(U===null)return"";if(utils$2.isDate(U))return U.toISOString();if(!$&&utils$2.isBlob(U))throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");return utils$2.isArrayBuffer(U)||utils$2.isTypedArray(U)?$&&typeof Blob=="function"?new Blob([U]):Buffer.from(U):U}function N(U,z,W){let j=U;if(U&&!W&&typeof U=="object"){if(utils$2.endsWith(z,"{}"))z=T?z:z.slice(0,-2),U=JSON.stringify(U);else if(utils$2.isArray(U)&&isFlatArray(U)||(utils$2.isFileList(U)||utils$2.endsWith(z,"[]"))&&(j=utils$2.toArray(U)))return z=removeBrackets(z),j.forEach(function(Z,X){!(utils$2.isUndefined(Z)||Z===null)&&S.append(k===!0?renderKey([z],X,A):k===null?z:z+"[]",x(Z))}),!1}return isVisitable(U)?!0:(S.append(renderKey(W,z,A),x(U)),!1)}const D=[],q=Object.assign(predicates,{defaultVisitor:N,convertValue:x,isVisitable});function M(U,z){if(!utils$2.isUndefined(U)){if(D.indexOf(U)!==-1)throw Error("Circular reference detected in "+z.join("."));D.push(U),utils$2.forEach(U,function(j,B){(!(utils$2.isUndefined(j)||j===null)&&O.call(S,j,utils$2.isString(B)?B.trim():B,z,q))===!0&&M(j,z?z.concat(B):[B])}),D.pop()}}if(!utils$2.isObject(_))throw new TypeError("data must be an object");return M(_),S}function encode$1(_){const S={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(_).replace(/[!'()~]|%20|%00/g,function(T){return S[T]})}function AxiosURLSearchParams(_,S){this._pairs=[],_&&toFormData$1(_,this,S)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(S,v){this._pairs.push([S,v])},prototype.toString=function(S){const v=S?function(T){return S.call(this,T,encode$1)}:encode$1;return this._pairs.map(function(O){return v(O[0])+"="+v(O[1])},"").join("&")};function encode(_){return encodeURIComponent(_).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(_,S,v){if(!S)return _;const T=v&&v.encode||encode,O=v&&v.serialize;let A;if(O?A=O(S,v):A=utils$2.isURLSearchParams(S)?S.toString():new AxiosURLSearchParams(S,v).toString(T),A){const k=_.indexOf("#");k!==-1&&(_=_.slice(0,k)),_+=(_.indexOf("?")===-1?"?":"&")+A}return _}class InterceptorManager{constructor(){this.handlers=[]}use(S,v,T){return this.handlers.push({fulfilled:S,rejected:v,synchronous:T?T.synchronous:!1,runWhen:T?T.runWhen:null}),this.handlers.length-1}eject(S){this.handlers[S]&&(this.handlers[S]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(S){utils$2.forEach(this.handlers,function(T){T!==null&&S(T)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$1=typeof Blob<"u"?Blob:null,platform$1={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",_navigator=typeof navigator=="object"&&navigator||void 0,hasStandardBrowserEnv=hasBrowserEnv&&(!_navigator||["ReactNative","NativeScript","NS"].indexOf(_navigator.product)<0),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils$1={__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,navigator:_navigator,origin},platform={...utils$1,...platform$1};function toURLEncodedForm(_,S){return toFormData$1(_,new platform.classes.URLSearchParams,Object.assign({visitor:function(v,T,O,A){return platform.isNode&&utils$2.isBuffer(v)?(this.append(T,v.toString("base64")),!1):A.defaultVisitor.apply(this,arguments)}},S))}function parsePropPath(_){return utils$2.matchAll(/\w+|\[(\w*)]/g,_).map(S=>S[0]==="[]"?"":S[1]||S[0])}function arrayToObject(_){const S={},v=Object.keys(_);let T;const O=v.length;let A;for(T=0;T<O;T++)A=v[T],S[A]=_[A];return S}function formDataToJSON(_){function S(v,T,O,A){let k=v[A++];if(k==="__proto__")return!0;const C=Number.isFinite(+k),$=A>=v.length;return k=!k&&utils$2.isArray(O)?O.length:k,$?(utils$2.hasOwnProp(O,k)?O[k]=[O[k],T]:O[k]=T,!C):((!O[k]||!utils$2.isObject(O[k]))&&(O[k]=[]),S(v,T,O[k],A)&&utils$2.isArray(O[k])&&(O[k]=arrayToObject(O[k])),!C)}if(utils$2.isFormData(_)&&utils$2.isFunction(_.entries)){const v={};return utils$2.forEachEntry(_,(T,O)=>{S(parsePropPath(T),O,v,0)}),v}return null}function stringifySafely(_,S,v){if(utils$2.isString(_))try{return(S||JSON.parse)(_),utils$2.trim(_)}catch(T){if(T.name!=="SyntaxError")throw T}return(0,JSON.stringify)(_)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function(S,v){const T=v.getContentType()||"",O=T.indexOf("application/json")>-1,A=utils$2.isObject(S);if(A&&utils$2.isHTMLForm(S)&&(S=new FormData(S)),utils$2.isFormData(S))return O?JSON.stringify(formDataToJSON(S)):S;if(utils$2.isArrayBuffer(S)||utils$2.isBuffer(S)||utils$2.isStream(S)||utils$2.isFile(S)||utils$2.isBlob(S)||utils$2.isReadableStream(S))return S;if(utils$2.isArrayBufferView(S))return S.buffer;if(utils$2.isURLSearchParams(S))return v.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),S.toString();let C;if(A){if(T.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(S,this.formSerializer).toString();if((C=utils$2.isFileList(S))||T.indexOf("multipart/form-data")>-1){const $=this.env&&this.env.FormData;return toFormData$1(C?{"files[]":S}:S,$&&new $,this.formSerializer)}}return A||O?(v.setContentType("application/json",!1),stringifySafely(S)):S}],transformResponse:[function(S){const v=this.transitional||defaults.transitional,T=v&&v.forcedJSONParsing,O=this.responseType==="json";if(utils$2.isResponse(S)||utils$2.isReadableStream(S))return S;if(S&&utils$2.isString(S)&&(T&&!this.responseType||O)){const k=!(v&&v.silentJSONParsing)&&O;try{return JSON.parse(S)}catch(C){if(k)throw C.name==="SyntaxError"?AxiosError$1.from(C,AxiosError$1.ERR_BAD_RESPONSE,this,null,this.response):C}}return S}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function(S){return S>=200&&S<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$2.forEach(["delete","get","head","post","put","patch"],_=>{defaults.headers[_]={}});const ignoreDuplicateOf=utils$2.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"]),parseHeaders=_=>{const S={};let v,T,O;return _&&_.split(`
2
- `).forEach(function(k){O=k.indexOf(":"),v=k.substring(0,O).trim().toLowerCase(),T=k.substring(O+1).trim(),!(!v||S[v]&&ignoreDuplicateOf[v])&&(v==="set-cookie"?S[v]?S[v].push(T):S[v]=[T]:S[v]=S[v]?S[v]+", "+T:T)}),S},$internals=Symbol("internals");function normalizeHeader(_){return _&&String(_).trim().toLowerCase()}function normalizeValue(_){return _===!1||_==null?_:utils$2.isArray(_)?_.map(normalizeValue):String(_)}function parseTokens(_){const S=Object.create(null),v=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let T;for(;T=v.exec(_);)S[T[1]]=T[2];return S}const isValidHeaderName=_=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_.trim());function matchHeaderValue(_,S,v,T,O){if(utils$2.isFunction(T))return T.call(this,S,v);if(O&&(S=v),!!utils$2.isString(S)){if(utils$2.isString(T))return S.indexOf(T)!==-1;if(utils$2.isRegExp(T))return T.test(S)}}function formatHeader(_){return _.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(S,v,T)=>v.toUpperCase()+T)}function buildAccessors(_,S){const v=utils$2.toCamelCase(" "+S);["get","set","has"].forEach(T=>{Object.defineProperty(_,T+v,{value:function(O,A,k){return this[T].call(this,S,O,A,k)},configurable:!0})})}let AxiosHeaders$1=class{constructor(S){S&&this.set(S)}set(S,v,T){const O=this;function A(C,$,x){const N=normalizeHeader($);if(!N)throw new Error("header name must be a non-empty string");const D=utils$2.findKey(O,N);(!D||O[D]===void 0||x===!0||x===void 0&&O[D]!==!1)&&(O[D||$]=normalizeValue(C))}const k=(C,$)=>utils$2.forEach(C,(x,N)=>A(x,N,$));if(utils$2.isPlainObject(S)||S instanceof this.constructor)k(S,v);else if(utils$2.isString(S)&&(S=S.trim())&&!isValidHeaderName(S))k(parseHeaders(S),v);else if(utils$2.isHeaders(S))for(const[C,$]of S.entries())A($,C,T);else S!=null&&A(v,S,T);return this}get(S,v){if(S=normalizeHeader(S),S){const T=utils$2.findKey(this,S);if(T){const O=this[T];if(!v)return O;if(v===!0)return parseTokens(O);if(utils$2.isFunction(v))return v.call(this,O,T);if(utils$2.isRegExp(v))return v.exec(O);throw new TypeError("parser must be boolean|regexp|function")}}}has(S,v){if(S=normalizeHeader(S),S){const T=utils$2.findKey(this,S);return!!(T&&this[T]!==void 0&&(!v||matchHeaderValue(this,this[T],T,v)))}return!1}delete(S,v){const T=this;let O=!1;function A(k){if(k=normalizeHeader(k),k){const C=utils$2.findKey(T,k);C&&(!v||matchHeaderValue(T,T[C],C,v))&&(delete T[C],O=!0)}}return utils$2.isArray(S)?S.forEach(A):A(S),O}clear(S){const v=Object.keys(this);let T=v.length,O=!1;for(;T--;){const A=v[T];(!S||matchHeaderValue(this,this[A],A,S,!0))&&(delete this[A],O=!0)}return O}normalize(S){const v=this,T={};return utils$2.forEach(this,(O,A)=>{const k=utils$2.findKey(T,A);if(k){v[k]=normalizeValue(O),delete v[A];return}const C=S?formatHeader(A):String(A).trim();C!==A&&delete v[A],v[C]=normalizeValue(O),T[C]=!0}),this}concat(...S){return this.constructor.concat(this,...S)}toJSON(S){const v=Object.create(null);return utils$2.forEach(this,(T,O)=>{T!=null&&T!==!1&&(v[O]=S&&utils$2.isArray(T)?T.join(", "):T)}),v}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([S,v])=>S+": "+v).join(`
3
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(S){return S instanceof this?S:new this(S)}static concat(S,...v){const T=new this(S);return v.forEach(O=>T.set(O)),T}static accessor(S){const T=(this[$internals]=this[$internals]={accessors:{}}).accessors,O=this.prototype;function A(k){const C=normalizeHeader(k);T[C]||(buildAccessors(O,k),T[C]=!0)}return utils$2.isArray(S)?S.forEach(A):A(S),this}};AxiosHeaders$1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),utils$2.reduceDescriptors(AxiosHeaders$1.prototype,({value:_},S)=>{let v=S[0].toUpperCase()+S.slice(1);return{get:()=>_,set(T){this[v]=T}}}),utils$2.freezeMethods(AxiosHeaders$1);function transformData(_,S){const v=this||defaults,T=S||v,O=AxiosHeaders$1.from(T.headers);let A=T.data;return utils$2.forEach(_,function(C){A=C.call(v,A,O.normalize(),S?S.status:void 0)}),O.normalize(),A}function isCancel$1(_){return!!(_&&_.__CANCEL__)}function CanceledError$1(_,S,v){AxiosError$1.call(this,_??"canceled",AxiosError$1.ERR_CANCELED,S,v),this.name="CanceledError"}utils$2.inherits(CanceledError$1,AxiosError$1,{__CANCEL__:!0});function settle(_,S,v){const T=v.config.validateStatus;!v.status||!T||T(v.status)?_(v):S(new AxiosError$1("Request failed with status code "+v.status,[AxiosError$1.ERR_BAD_REQUEST,AxiosError$1.ERR_BAD_RESPONSE][Math.floor(v.status/100)-4],v.config,v.request,v))}function parseProtocol(_){const S=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_);return S&&S[1]||""}function speedometer(_,S){_=_||10;const v=new Array(_),T=new Array(_);let O=0,A=0,k;return S=S!==void 0?S:1e3,function($){const x=Date.now(),N=T[A];k||(k=x),v[O]=$,T[O]=x;let D=A,q=0;for(;D!==O;)q+=v[D++],D=D%_;if(O=(O+1)%_,O===A&&(A=(A+1)%_),x-k<S)return;const M=N&&x-N;return M?Math.round(q*1e3/M):void 0}}function throttle(_,S){let v=0,T=1e3/S,O,A;const k=(x,N=Date.now())=>{v=N,O=null,A&&(clearTimeout(A),A=null),_.apply(null,x)};return[(...x)=>{const N=Date.now(),D=N-v;D>=T?k(x,N):(O=x,A||(A=setTimeout(()=>{A=null,k(O)},T-D)))},()=>O&&k(O)]}const progressEventReducer=(_,S,v=3)=>{let T=0;const O=speedometer(50,250);return throttle(A=>{const k=A.loaded,C=A.lengthComputable?A.total:void 0,$=k-T,x=O($),N=k<=C;T=k;const D={loaded:k,total:C,progress:C?k/C:void 0,bytes:$,rate:x||void 0,estimated:x&&C&&N?(C-k)/x:void 0,event:A,lengthComputable:C!=null,[S?"download":"upload"]:!0};_(D)},v)},progressEventDecorator=(_,S)=>{const v=_!=null;return[T=>S[0]({lengthComputable:v,total:_,loaded:T}),S[1]]},asyncDecorator=_=>(...S)=>utils$2.asap(()=>_(...S)),isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const S=platform.navigator&&/(msie|trident)/i.test(platform.navigator.userAgent),v=document.createElement("a");let T;function O(A){let k=A;return S&&(v.setAttribute("href",k),k=v.href),v.setAttribute("href",k),{href:v.href,protocol:v.protocol?v.protocol.replace(/:$/,""):"",host:v.host,search:v.search?v.search.replace(/^\?/,""):"",hash:v.hash?v.hash.replace(/^#/,""):"",hostname:v.hostname,port:v.port,pathname:v.pathname.charAt(0)==="/"?v.pathname:"/"+v.pathname}}return T=O(window.location.href),function(k){const C=utils$2.isString(k)?O(k):k;return C.protocol===T.protocol&&C.host===T.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(_,S,v,T,O,A){const k=[_+"="+encodeURIComponent(S)];utils$2.isNumber(v)&&k.push("expires="+new Date(v).toGMTString()),utils$2.isString(T)&&k.push("path="+T),utils$2.isString(O)&&k.push("domain="+O),A===!0&&k.push("secure"),document.cookie=k.join("; ")},read(_){const S=document.cookie.match(new RegExp("(^|;\\s*)("+_+")=([^;]*)"));return S?decodeURIComponent(S[3]):null},remove(_){this.write(_,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(_){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(_)}function combineURLs(_,S){return S?_.replace(/\/?\/$/,"")+"/"+S.replace(/^\/+/,""):_}function buildFullPath(_,S){return _&&!isAbsoluteURL(S)?combineURLs(_,S):S}const headersToObject=_=>_ instanceof AxiosHeaders$1?{..._}:_;function mergeConfig$1(_,S){S=S||{};const v={};function T(x,N,D){return utils$2.isPlainObject(x)&&utils$2.isPlainObject(N)?utils$2.merge.call({caseless:D},x,N):utils$2.isPlainObject(N)?utils$2.merge({},N):utils$2.isArray(N)?N.slice():N}function O(x,N,D){if(utils$2.isUndefined(N)){if(!utils$2.isUndefined(x))return T(void 0,x,D)}else return T(x,N,D)}function A(x,N){if(!utils$2.isUndefined(N))return T(void 0,N)}function k(x,N){if(utils$2.isUndefined(N)){if(!utils$2.isUndefined(x))return T(void 0,x)}else return T(void 0,N)}function C(x,N,D){if(D in S)return T(x,N);if(D in _)return T(void 0,x)}const $={url:A,method:A,data:A,baseURL:k,transformRequest:k,transformResponse:k,paramsSerializer:k,timeout:k,timeoutMessage:k,withCredentials:k,withXSRFToken:k,adapter:k,responseType:k,xsrfCookieName:k,xsrfHeaderName:k,onUploadProgress:k,onDownloadProgress:k,decompress:k,maxContentLength:k,maxBodyLength:k,beforeRedirect:k,transport:k,httpAgent:k,httpsAgent:k,cancelToken:k,socketPath:k,responseEncoding:k,validateStatus:C,headers:(x,N)=>O(headersToObject(x),headersToObject(N),!0)};return utils$2.forEach(Object.keys(Object.assign({},_,S)),function(N){const D=$[N]||O,q=D(_[N],S[N],N);utils$2.isUndefined(q)&&D!==C||(v[N]=q)}),v}const resolveConfig=_=>{const S=mergeConfig$1({},_);let{data:v,withXSRFToken:T,xsrfHeaderName:O,xsrfCookieName:A,headers:k,auth:C}=S;S.headers=k=AxiosHeaders$1.from(k),S.url=buildURL(buildFullPath(S.baseURL,S.url),_.params,_.paramsSerializer),C&&k.set("Authorization","Basic "+btoa((C.username||"")+":"+(C.password?unescape(encodeURIComponent(C.password)):"")));let $;if(utils$2.isFormData(v)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)k.setContentType(void 0);else if(($=k.getContentType())!==!1){const[x,...N]=$?$.split(";").map(D=>D.trim()).filter(Boolean):[];k.setContentType([x||"multipart/form-data",...N].join("; "))}}if(platform.hasStandardBrowserEnv&&(T&&utils$2.isFunction(T)&&(T=T(S)),T||T!==!1&&isURLSameOrigin(S.url))){const x=O&&A&&cookies.read(A);x&&k.set(O,x)}return S},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(_){return new Promise(function(v,T){const O=resolveConfig(_);let A=O.data;const k=AxiosHeaders$1.from(O.headers).normalize();let{responseType:C,onUploadProgress:$,onDownloadProgress:x}=O,N,D,q,M,U;function z(){M&&M(),U&&U(),O.cancelToken&&O.cancelToken.unsubscribe(N),O.signal&&O.signal.removeEventListener("abort",N)}let W=new XMLHttpRequest;W.open(O.method.toUpperCase(),O.url,!0),W.timeout=O.timeout;function j(){if(!W)return;const Z=AxiosHeaders$1.from("getAllResponseHeaders"in W&&W.getAllResponseHeaders()),Q={data:!C||C==="text"||C==="json"?W.responseText:W.response,status:W.status,statusText:W.statusText,headers:Z,config:_,request:W};settle(function(ce){v(ce),z()},function(ce){T(ce),z()},Q),W=null}"onloadend"in W?W.onloadend=j:W.onreadystatechange=function(){!W||W.readyState!==4||W.status===0&&!(W.responseURL&&W.responseURL.indexOf("file:")===0)||setTimeout(j)},W.onabort=function(){W&&(T(new AxiosError$1("Request aborted",AxiosError$1.ECONNABORTED,_,W)),W=null)},W.onerror=function(){T(new AxiosError$1("Network Error",AxiosError$1.ERR_NETWORK,_,W)),W=null},W.ontimeout=function(){let X=O.timeout?"timeout of "+O.timeout+"ms exceeded":"timeout exceeded";const Q=O.transitional||transitionalDefaults;O.timeoutErrorMessage&&(X=O.timeoutErrorMessage),T(new AxiosError$1(X,Q.clarifyTimeoutError?AxiosError$1.ETIMEDOUT:AxiosError$1.ECONNABORTED,_,W)),W=null},A===void 0&&k.setContentType(null),"setRequestHeader"in W&&utils$2.forEach(k.toJSON(),function(X,Q){W.setRequestHeader(Q,X)}),utils$2.isUndefined(O.withCredentials)||(W.withCredentials=!!O.withCredentials),C&&C!=="json"&&(W.responseType=O.responseType),x&&([q,U]=progressEventReducer(x,!0),W.addEventListener("progress",q)),$&&W.upload&&([D,M]=progressEventReducer($),W.upload.addEventListener("progress",D),W.upload.addEventListener("loadend",M)),(O.cancelToken||O.signal)&&(N=Z=>{W&&(T(!Z||Z.type?new CanceledError$1(null,_,W):Z),W.abort(),W=null)},O.cancelToken&&O.cancelToken.subscribe(N),O.signal&&(O.signal.aborted?N():O.signal.addEventListener("abort",N)));const B=parseProtocol(O.url);if(B&&platform.protocols.indexOf(B)===-1){T(new AxiosError$1("Unsupported protocol "+B+":",AxiosError$1.ERR_BAD_REQUEST,_));return}W.send(A||null)})},composeSignals=(_,S)=>{const{length:v}=_=_?_.filter(Boolean):[];if(S||v){let T=new AbortController,O;const A=function(x){if(!O){O=!0,C();const N=x instanceof Error?x:this.reason;T.abort(N instanceof AxiosError$1?N:new CanceledError$1(N instanceof Error?N.message:N))}};let k=S&&setTimeout(()=>{k=null,A(new AxiosError$1(`timeout ${S} of ms exceeded`,AxiosError$1.ETIMEDOUT))},S);const C=()=>{_&&(k&&clearTimeout(k),k=null,_.forEach(x=>{x.unsubscribe?x.unsubscribe(A):x.removeEventListener("abort",A)}),_=null)};_.forEach(x=>x.addEventListener("abort",A));const{signal:$}=T;return $.unsubscribe=()=>utils$2.asap(C),$}},streamChunk=function*(_,S){let v=_.byteLength;if(v<S){yield _;return}let T=0,O;for(;T<v;)O=T+S,yield _.slice(T,O),T=O},readBytes=async function*(_,S){for await(const v of readStream(_))yield*streamChunk(v,S)},readStream=async function*(_){if(_[Symbol.asyncIterator]){yield*_;return}const S=_.getReader();try{for(;;){const{done:v,value:T}=await S.read();if(v)break;yield T}}finally{await S.cancel()}},trackStream=(_,S,v,T)=>{const O=readBytes(_,S);let A=0,k,C=$=>{k||(k=!0,T&&T($))};return new ReadableStream({async pull($){try{const{done:x,value:N}=await O.next();if(x){C(),$.close();return}let D=N.byteLength;if(v){let q=A+=D;v(q)}$.enqueue(new Uint8Array(N))}catch(x){throw C(x),x}},cancel($){return C($),O.return()}},{highWaterMark:2})},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(_=>S=>_.encode(S))(new TextEncoder):async _=>new Uint8Array(await new Response(_).arrayBuffer())),test=(_,...S)=>{try{return!!_(...S)}catch{return!1}},supportsRequestStream=isReadableStreamSupported&&test(()=>{let _=!1;const S=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){return _=!0,"half"}}).headers.has("Content-Type");return _&&!S}),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&test(()=>utils$2.isReadableStream(new Response("").body)),resolvers={stream:supportsResponseStream&&(_=>_.body)};isFetchSupported&&(_=>{["text","arrayBuffer","blob","formData","stream"].forEach(S=>{!resolvers[S]&&(resolvers[S]=utils$2.isFunction(_[S])?v=>v[S]():(v,T)=>{throw new AxiosError$1(`Response type '${S}' is not supported`,AxiosError$1.ERR_NOT_SUPPORT,T)})})})(new Response);const getBodyLength=async _=>{if(_==null)return 0;if(utils$2.isBlob(_))return _.size;if(utils$2.isSpecCompliantForm(_))return(await new Request(platform.origin,{method:"POST",body:_}).arrayBuffer()).byteLength;if(utils$2.isArrayBufferView(_)||utils$2.isArrayBuffer(_))return _.byteLength;if(utils$2.isURLSearchParams(_)&&(_=_+""),utils$2.isString(_))return(await encodeText(_)).byteLength},resolveBodyLength=async(_,S)=>{const v=utils$2.toFiniteNumber(_.getContentLength());return v??getBodyLength(S)},fetchAdapter=isFetchSupported&&(async _=>{let{url:S,method:v,data:T,signal:O,cancelToken:A,timeout:k,onDownloadProgress:C,onUploadProgress:$,responseType:x,headers:N,withCredentials:D="same-origin",fetchOptions:q}=resolveConfig(_);x=x?(x+"").toLowerCase():"text";let M=composeSignals([O,A&&A.toAbortSignal()],k),U;const z=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let W;try{if($&&supportsRequestStream&&v!=="get"&&v!=="head"&&(W=await resolveBodyLength(N,T))!==0){let Q=new Request(S,{method:"POST",body:T,duplex:"half"}),ee;if(utils$2.isFormData(T)&&(ee=Q.headers.get("content-type"))&&N.setContentType(ee),Q.body){const[ce,pe]=progressEventDecorator(W,progressEventReducer(asyncDecorator($)));T=trackStream(Q.body,DEFAULT_CHUNK_SIZE,ce,pe)}}utils$2.isString(D)||(D=D?"include":"omit");const j="credentials"in Request.prototype;U=new Request(S,{...q,signal:M,method:v.toUpperCase(),headers:N.normalize().toJSON(),body:T,duplex:"half",credentials:j?D:void 0});let B=await fetch(U);const Z=supportsResponseStream&&(x==="stream"||x==="response");if(supportsResponseStream&&(C||Z&&z)){const Q={};["status","statusText","headers"].forEach(ae=>{Q[ae]=B[ae]});const ee=utils$2.toFiniteNumber(B.headers.get("content-length")),[ce,pe]=C&&progressEventDecorator(ee,progressEventReducer(asyncDecorator(C),!0))||[];B=new Response(trackStream(B.body,DEFAULT_CHUNK_SIZE,ce,()=>{pe&&pe(),z&&z()}),Q)}x=x||"text";let X=await resolvers[utils$2.findKey(resolvers,x)||"text"](B,_);return!Z&&z&&z(),await new Promise((Q,ee)=>{settle(Q,ee,{data:X,headers:AxiosHeaders$1.from(B.headers),status:B.status,statusText:B.statusText,config:_,request:U})})}catch(j){throw z&&z(),j&&j.name==="TypeError"&&/fetch/i.test(j.message)?Object.assign(new AxiosError$1("Network Error",AxiosError$1.ERR_NETWORK,_,U),{cause:j.cause||j}):AxiosError$1.from(j,j&&j.code,_,U)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$2.forEach(knownAdapters,(_,S)=>{if(_){try{Object.defineProperty(_,"name",{value:S})}catch{}Object.defineProperty(_,"adapterName",{value:S})}});const renderReason=_=>`- ${_}`,isResolvedHandle=_=>utils$2.isFunction(_)||_===null||_===!1,adapters={getAdapter:_=>{_=utils$2.isArray(_)?_:[_];const{length:S}=_;let v,T;const O={};for(let A=0;A<S;A++){v=_[A];let k;if(T=v,!isResolvedHandle(v)&&(T=knownAdapters[(k=String(v)).toLowerCase()],T===void 0))throw new AxiosError$1(`Unknown adapter '${k}'`);if(T)break;O[k||"#"+A]=T}if(!T){const A=Object.entries(O).map(([C,$])=>`adapter ${C} `+($===!1?"is not supported by the environment":"is not available in the build"));let k=S?A.length>1?`since :
4
- `+A.map(renderReason).join(`
5
- `):" "+renderReason(A[0]):"as no adapter specified";throw new AxiosError$1("There is no suitable adapter to dispatch the request "+k,"ERR_NOT_SUPPORT")}return T},adapters:knownAdapters};function throwIfCancellationRequested(_){if(_.cancelToken&&_.cancelToken.throwIfRequested(),_.signal&&_.signal.aborted)throw new CanceledError$1(null,_)}function dispatchRequest(_){return throwIfCancellationRequested(_),_.headers=AxiosHeaders$1.from(_.headers),_.data=transformData.call(_,_.transformRequest),["post","put","patch"].indexOf(_.method)!==-1&&_.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(_.adapter||defaults.adapter)(_).then(function(T){return throwIfCancellationRequested(_),T.data=transformData.call(_,_.transformResponse,T),T.headers=AxiosHeaders$1.from(T.headers),T},function(T){return isCancel$1(T)||(throwIfCancellationRequested(_),T&&T.response&&(T.response.data=transformData.call(_,_.transformResponse,T.response),T.response.headers=AxiosHeaders$1.from(T.response.headers))),Promise.reject(T)})}const VERSION$1="1.7.7",validators$1={};["object","boolean","number","function","string","symbol"].forEach((_,S)=>{validators$1[_]=function(T){return typeof T===_||"a"+(S<1?"n ":" ")+_}});const deprecatedWarnings={};validators$1.transitional=function(S,v,T){function O(A,k){return"[Axios v"+VERSION$1+"] Transitional option '"+A+"'"+k+(T?". "+T:"")}return(A,k,C)=>{if(S===!1)throw new AxiosError$1(O(k," has been removed"+(v?" in "+v:"")),AxiosError$1.ERR_DEPRECATED);return v&&!deprecatedWarnings[k]&&(deprecatedWarnings[k]=!0,console.warn(O(k," has been deprecated since v"+v+" and will be removed in the near future"))),S?S(A,k,C):!0}};function assertOptions(_,S,v){if(typeof _!="object")throw new AxiosError$1("options must be an object",AxiosError$1.ERR_BAD_OPTION_VALUE);const T=Object.keys(_);let O=T.length;for(;O-- >0;){const A=T[O],k=S[A];if(k){const C=_[A],$=C===void 0||k(C,A,_);if($!==!0)throw new AxiosError$1("option "+A+" must be "+$,AxiosError$1.ERR_BAD_OPTION_VALUE);continue}if(v!==!0)throw new AxiosError$1("Unknown option "+A,AxiosError$1.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;let Axios$1=class{constructor(S){this.defaults=S,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(S,v){try{return await this._request(S,v)}catch(T){if(T instanceof Error){let O;Error.captureStackTrace?Error.captureStackTrace(O={}):O=new Error;const A=O.stack?O.stack.replace(/^.+\n/,""):"";try{T.stack?A&&!String(T.stack).endsWith(A.replace(/^.+\n.+\n/,""))&&(T.stack+=`
6
- `+A):T.stack=A}catch{}}throw T}}_request(S,v){typeof S=="string"?(v=v||{},v.url=S):v=S||{},v=mergeConfig$1(this.defaults,v);const{transitional:T,paramsSerializer:O,headers:A}=v;T!==void 0&&validator.assertOptions(T,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),O!=null&&(utils$2.isFunction(O)?v.paramsSerializer={serialize:O}:validator.assertOptions(O,{encode:validators.function,serialize:validators.function},!0)),v.method=(v.method||this.defaults.method||"get").toLowerCase();let k=A&&utils$2.merge(A.common,A[v.method]);A&&utils$2.forEach(["delete","get","head","post","put","patch","common"],U=>{delete A[U]}),v.headers=AxiosHeaders$1.concat(k,A);const C=[];let $=!0;this.interceptors.request.forEach(function(z){typeof z.runWhen=="function"&&z.runWhen(v)===!1||($=$&&z.synchronous,C.unshift(z.fulfilled,z.rejected))});const x=[];this.interceptors.response.forEach(function(z){x.push(z.fulfilled,z.rejected)});let N,D=0,q;if(!$){const U=[dispatchRequest.bind(this),void 0];for(U.unshift.apply(U,C),U.push.apply(U,x),q=U.length,N=Promise.resolve(v);D<q;)N=N.then(U[D++],U[D++]);return N}q=C.length;let M=v;for(D=0;D<q;){const U=C[D++],z=C[D++];try{M=U(M)}catch(W){z.call(this,W);break}}try{N=dispatchRequest.call(this,M)}catch(U){return Promise.reject(U)}for(D=0,q=x.length;D<q;)N=N.then(x[D++],x[D++]);return N}getUri(S){S=mergeConfig$1(this.defaults,S);const v=buildFullPath(S.baseURL,S.url);return buildURL(v,S.params,S.paramsSerializer)}};utils$2.forEach(["delete","get","head","options"],function(S){Axios$1.prototype[S]=function(v,T){return this.request(mergeConfig$1(T||{},{method:S,url:v,data:(T||{}).data}))}}),utils$2.forEach(["post","put","patch"],function(S){function v(T){return function(A,k,C){return this.request(mergeConfig$1(C||{},{method:S,headers:T?{"Content-Type":"multipart/form-data"}:{},url:A,data:k}))}}Axios$1.prototype[S]=v(),Axios$1.prototype[S+"Form"]=v(!0)});let CancelToken$1=class Et{constructor(S){if(typeof S!="function")throw new TypeError("executor must be a function.");let v;this.promise=new Promise(function(A){v=A});const T=this;this.promise.then(O=>{if(!T._listeners)return;let A=T._listeners.length;for(;A-- >0;)T._listeners[A](O);T._listeners=null}),this.promise.then=O=>{let A;const k=new Promise(C=>{T.subscribe(C),A=C}).then(O);return k.cancel=function(){T.unsubscribe(A)},k},S(function(A,k,C){T.reason||(T.reason=new CanceledError$1(A,k,C),v(T.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(S){if(this.reason){S(this.reason);return}this._listeners?this._listeners.push(S):this._listeners=[S]}unsubscribe(S){if(!this._listeners)return;const v=this._listeners.indexOf(S);v!==-1&&this._listeners.splice(v,1)}toAbortSignal(){const S=new AbortController,v=T=>{S.abort(T)};return this.subscribe(v),S.signal.unsubscribe=()=>this.unsubscribe(v),S.signal}static source(){let S;return{token:new Et(function(O){S=O}),cancel:S}}};function spread$1(_){return function(v){return _.apply(null,v)}}function isAxiosError$1(_){return utils$2.isObject(_)&&_.isAxiosError===!0}const HttpStatusCode$1={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(HttpStatusCode$1).forEach(([_,S])=>{HttpStatusCode$1[S]=_});function createInstance(_){const S=new Axios$1(_),v=bind(Axios$1.prototype.request,S);return utils$2.extend(v,Axios$1.prototype,S,{allOwnKeys:!0}),utils$2.extend(v,S,null,{allOwnKeys:!0}),v.create=function(O){return createInstance(mergeConfig$1(_,O))},v}const axios=createInstance(defaults);axios.Axios=Axios$1,axios.CanceledError=CanceledError$1,axios.CancelToken=CancelToken$1,axios.isCancel=isCancel$1,axios.VERSION=VERSION$1,axios.toFormData=toFormData$1,axios.AxiosError=AxiosError$1,axios.Cancel=axios.CanceledError,axios.all=function(S){return Promise.all(S)},axios.spread=spread$1,axios.isAxiosError=isAxiosError$1,axios.mergeConfig=mergeConfig$1,axios.AxiosHeaders=AxiosHeaders$1,axios.formToJSON=_=>formDataToJSON(utils$2.isHTMLForm(_)?new FormData(_):_),axios.getAdapter=adapters.getAdapter,axios.HttpStatusCode=HttpStatusCode$1,axios.default=axios;const{Axios,AxiosError,CanceledError,isCancel,CancelToken,VERSION,all,Cancel,isAxiosError,spread,toFormData,AxiosHeaders,HttpStatusCode,formToJSON,getAdapter,mergeConfig}=axios;var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}function getAugmentedNamespace(_){if(_.__esModule)return _;var S=_.default;if(typeof S=="function"){var v=function T(){return this instanceof T?Reflect.construct(S,arguments,this.constructor):S.apply(this,arguments)};v.prototype=S.prototype}else v={};return Object.defineProperty(v,"__esModule",{value:!0}),Object.keys(_).forEach(function(T){var O=Object.getOwnPropertyDescriptor(_,T);Object.defineProperty(v,T,O.get?O:{enumerable:!0,get:function(){return _[T]}})}),v}var esErrors,hasRequiredEsErrors;function requireEsErrors(){return hasRequiredEsErrors||(hasRequiredEsErrors=1,esErrors=Error),esErrors}var _eval,hasRequired_eval;function require_eval(){return hasRequired_eval||(hasRequired_eval=1,_eval=EvalError),_eval}var range,hasRequiredRange;function requireRange(){return hasRequiredRange||(hasRequiredRange=1,range=RangeError),range}var ref,hasRequiredRef;function requireRef(){return hasRequiredRef||(hasRequiredRef=1,ref=ReferenceError),ref}var syntax,hasRequiredSyntax;function requireSyntax(){return hasRequiredSyntax||(hasRequiredSyntax=1,syntax=SyntaxError),syntax}var type$1,hasRequiredType$1;function requireType$1(){return hasRequiredType$1||(hasRequiredType$1=1,type$1=TypeError),type$1}var uri,hasRequiredUri;function requireUri(){return hasRequiredUri||(hasRequiredUri=1,uri=URIError),uri}var shams,hasRequiredShams;function requireShams(){return hasRequiredShams||(hasRequiredShams=1,shams=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var S={},v=Symbol("test"),T=Object(v);if(typeof v=="string"||Object.prototype.toString.call(v)!=="[object Symbol]"||Object.prototype.toString.call(T)!=="[object Symbol]")return!1;var O=42;S[v]=O;for(v in S)return!1;if(typeof Object.keys=="function"&&Object.keys(S).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(S).length!==0)return!1;var A=Object.getOwnPropertySymbols(S);if(A.length!==1||A[0]!==v||!Object.prototype.propertyIsEnumerable.call(S,v))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var k=Object.getOwnPropertyDescriptor(S,v);if(k.value!==O||k.enumerable!==!0)return!1}return!0}),shams}var hasSymbols,hasRequiredHasSymbols;function requireHasSymbols(){if(hasRequiredHasSymbols)return hasSymbols;hasRequiredHasSymbols=1;var _=typeof Symbol<"u"&&Symbol,S=requireShams();return hasSymbols=function(){return typeof _!="function"||typeof Symbol!="function"||typeof _("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:S()},hasSymbols}var hasProto,hasRequiredHasProto;function requireHasProto(){if(hasRequiredHasProto)return hasProto;hasRequiredHasProto=1;var _={__proto__:null,foo:{}},S=Object;return hasProto=function(){return{__proto__:_}.foo===_.foo&&!(_ instanceof S)},hasProto}var implementation,hasRequiredImplementation;function requireImplementation(){if(hasRequiredImplementation)return implementation;hasRequiredImplementation=1;var _="Function.prototype.bind called on incompatible ",S=Object.prototype.toString,v=Math.max,T="[object Function]",O=function($,x){for(var N=[],D=0;D<$.length;D+=1)N[D]=$[D];for(var q=0;q<x.length;q+=1)N[q+$.length]=x[q];return N},A=function($,x){for(var N=[],D=x,q=0;D<$.length;D+=1,q+=1)N[q]=$[D];return N},k=function(C,$){for(var x="",N=0;N<C.length;N+=1)x+=C[N],N+1<C.length&&(x+=$);return x};return implementation=function($){var x=this;if(typeof x!="function"||S.apply(x)!==T)throw new TypeError(_+x);for(var N=A(arguments,1),D,q=function(){if(this instanceof D){var j=x.apply(this,O(N,arguments));return Object(j)===j?j:this}return x.apply($,O(N,arguments))},M=v(0,x.length-N.length),U=[],z=0;z<M;z++)U[z]="$"+z;if(D=Function("binder","return function ("+k(U,",")+"){ return binder.apply(this,arguments); }")(q),x.prototype){var W=function(){};W.prototype=x.prototype,D.prototype=new W,W.prototype=null}return D},implementation}var functionBind,hasRequiredFunctionBind;function requireFunctionBind(){if(hasRequiredFunctionBind)return functionBind;hasRequiredFunctionBind=1;var _=requireImplementation();return functionBind=Function.prototype.bind||_,functionBind}var hasown,hasRequiredHasown;function requireHasown(){if(hasRequiredHasown)return hasown;hasRequiredHasown=1;var _=Function.prototype.call,S=Object.prototype.hasOwnProperty,v=requireFunctionBind();return hasown=v.call(_,S),hasown}var getIntrinsic,hasRequiredGetIntrinsic;function requireGetIntrinsic(){if(hasRequiredGetIntrinsic)return getIntrinsic;hasRequiredGetIntrinsic=1;var _,S=requireEsErrors(),v=require_eval(),T=requireRange(),O=requireRef(),A=requireSyntax(),k=requireType$1(),C=requireUri(),$=Function,x=function(me){try{return $('"use strict"; return ('+me+").constructor;")()}catch{}},N=Object.getOwnPropertyDescriptor;if(N)try{N({},"")}catch{N=null}var D=function(){throw new k},q=N?function(){try{return arguments.callee,D}catch{try{return N(arguments,"callee").get}catch{return D}}}():D,M=requireHasSymbols()(),U=requireHasProto()(),z=Object.getPrototypeOf||(U?function(me){return me.__proto__}:null),W={},j=typeof Uint8Array>"u"||!z?_:z(Uint8Array),B={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?_:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?_:ArrayBuffer,"%ArrayIteratorPrototype%":M&&z?z([][Symbol.iterator]()):_,"%AsyncFromSyncIteratorPrototype%":_,"%AsyncFunction%":W,"%AsyncGenerator%":W,"%AsyncGeneratorFunction%":W,"%AsyncIteratorPrototype%":W,"%Atomics%":typeof Atomics>"u"?_:Atomics,"%BigInt%":typeof BigInt>"u"?_:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?_:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?_:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?_:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":S,"%eval%":eval,"%EvalError%":v,"%Float32Array%":typeof Float32Array>"u"?_:Float32Array,"%Float64Array%":typeof Float64Array>"u"?_:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?_:FinalizationRegistry,"%Function%":$,"%GeneratorFunction%":W,"%Int8Array%":typeof Int8Array>"u"?_:Int8Array,"%Int16Array%":typeof Int16Array>"u"?_:Int16Array,"%Int32Array%":typeof Int32Array>"u"?_:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":M&&z?z(z([][Symbol.iterator]())):_,"%JSON%":typeof JSON=="object"?JSON:_,"%Map%":typeof Map>"u"?_:Map,"%MapIteratorPrototype%":typeof Map>"u"||!M||!z?_:z(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?_:Promise,"%Proxy%":typeof Proxy>"u"?_:Proxy,"%RangeError%":T,"%ReferenceError%":O,"%Reflect%":typeof Reflect>"u"?_:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?_:Set,"%SetIteratorPrototype%":typeof Set>"u"||!M||!z?_:z(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?_:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":M&&z?z(""[Symbol.iterator]()):_,"%Symbol%":M?Symbol:_,"%SyntaxError%":A,"%ThrowTypeError%":q,"%TypedArray%":j,"%TypeError%":k,"%Uint8Array%":typeof Uint8Array>"u"?_:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?_:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?_:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?_:Uint32Array,"%URIError%":C,"%WeakMap%":typeof WeakMap>"u"?_:WeakMap,"%WeakRef%":typeof WeakRef>"u"?_:WeakRef,"%WeakSet%":typeof WeakSet>"u"?_:WeakSet};if(z)try{null.error}catch(me){var Z=z(z(me));B["%Error.prototype%"]=Z}var X=function me(oe){var Se;if(oe==="%AsyncFunction%")Se=x("async function () {}");else if(oe==="%GeneratorFunction%")Se=x("function* () {}");else if(oe==="%AsyncGeneratorFunction%")Se=x("async function* () {}");else if(oe==="%AsyncGenerator%"){var ye=me("%AsyncGeneratorFunction%");ye&&(Se=ye.prototype)}else if(oe==="%AsyncIteratorPrototype%"){var ve=me("%AsyncGenerator%");ve&&z&&(Se=z(ve.prototype))}return B[oe]=Se,Se},Q={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ee=requireFunctionBind(),ce=requireHasown(),pe=ee.call(Function.call,Array.prototype.concat),ae=ee.call(Function.apply,Array.prototype.splice),se=ee.call(Function.call,String.prototype.replace),ie=ee.call(Function.call,String.prototype.slice),fe=ee.call(Function.call,RegExp.prototype.exec),Oe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ue=/\\(\\)?/g,le=function(oe){var Se=ie(oe,0,1),ye=ie(oe,-1);if(Se==="%"&&ye!=="%")throw new A("invalid intrinsic syntax, expected closing `%`");if(ye==="%"&&Se!=="%")throw new A("invalid intrinsic syntax, expected opening `%`");var ve=[];return se(oe,Oe,function(Ee,Ie,de,Ce){ve[ve.length]=de?se(Ce,ue,"$1"):Ie||Ee}),ve},_e=function(oe,Se){var ye=oe,ve;if(ce(Q,ye)&&(ve=Q[ye],ye="%"+ve[0]+"%"),ce(B,ye)){var Ee=B[ye];if(Ee===W&&(Ee=X(ye)),typeof Ee>"u"&&!Se)throw new k("intrinsic "+oe+" exists, but is not available. Please file an issue!");return{alias:ve,name:ye,value:Ee}}throw new A("intrinsic "+oe+" does not exist!")};return getIntrinsic=function(oe,Se){if(typeof oe!="string"||oe.length===0)throw new k("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Se!="boolean")throw new k('"allowMissing" argument must be a boolean');if(fe(/^%?[^%]*%?$/,oe)===null)throw new A("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ye=le(oe),ve=ye.length>0?ye[0]:"",Ee=_e("%"+ve+"%",Se),Ie=Ee.name,de=Ee.value,Ce=!1,Le=Ee.alias;Le&&(ve=Le[0],ae(ye,pe([0,1],Le)));for(var Fe=1,xe=!0;Fe<ye.length;Fe+=1){var Ae=ye[Fe],De=ie(Ae,0,1),qe=ie(Ae,-1);if((De==='"'||De==="'"||De==="`"||qe==='"'||qe==="'"||qe==="`")&&De!==qe)throw new A("property names with quotes must have matching quotes");if((Ae==="constructor"||!xe)&&(Ce=!0),ve+="."+Ae,Ie="%"+ve+"%",ce(B,Ie))de=B[Ie];else if(de!=null){if(!(Ae in de)){if(!Se)throw new k("base intrinsic for "+oe+" exists, but the property is not available.");return}if(N&&Fe+1>=ye.length){var Pe=N(de,Ae);xe=!!Pe,xe&&"get"in Pe&&!("originalValue"in Pe.get)?de=Pe.get:de=de[Ae]}else xe=ce(de,Ae),de=de[Ae];xe&&!Ce&&(B[Ie]=de)}}return de},getIntrinsic}var callBind={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var _=requireGetIntrinsic(),S=_("%Object.defineProperty%",!0)||!1;if(S)try{S({},"a",{value:1})}catch{S=!1}return esDefineProperty=S,esDefineProperty}var gopd,hasRequiredGopd;function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var _=requireGetIntrinsic(),S=_("%Object.getOwnPropertyDescriptor%",!0);if(S)try{S([],"length")}catch{S=null}return gopd=S,gopd}var defineDataProperty,hasRequiredDefineDataProperty;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var _=requireEsDefineProperty(),S=requireSyntax(),v=requireType$1(),T=requireGopd();return defineDataProperty=function(A,k,C){if(!A||typeof A!="object"&&typeof A!="function")throw new v("`obj` must be an object or a function`");if(typeof k!="string"&&typeof k!="symbol")throw new v("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new v("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new v("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new v("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new v("`loose`, if provided, must be a boolean");var $=arguments.length>3?arguments[3]:null,x=arguments.length>4?arguments[4]:null,N=arguments.length>5?arguments[5]:null,D=arguments.length>6?arguments[6]:!1,q=!!T&&T(A,k);if(_)_(A,k,{configurable:N===null&&q?q.configurable:!N,enumerable:$===null&&q?q.enumerable:!$,value:C,writable:x===null&&q?q.writable:!x});else if(D||!$&&!x&&!N)A[k]=C;else throw new S("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},defineDataProperty}var hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors;function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var _=requireEsDefineProperty(),S=function(){return!!_};return S.hasArrayLengthDefineBug=function(){if(!_)return null;try{return _([],"length",{value:1}).length!==1}catch{return!0}},hasPropertyDescriptors_1=S,hasPropertyDescriptors_1}var setFunctionLength,hasRequiredSetFunctionLength;function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var _=requireGetIntrinsic(),S=requireDefineDataProperty(),v=requireHasPropertyDescriptors()(),T=requireGopd(),O=requireType$1(),A=_("%Math.floor%");return setFunctionLength=function(C,$){if(typeof C!="function")throw new O("`fn` is not a function");if(typeof $!="number"||$<0||$>4294967295||A($)!==$)throw new O("`length` must be a positive 32-bit integer");var x=arguments.length>2&&!!arguments[2],N=!0,D=!0;if("length"in C&&T){var q=T(C,"length");q&&!q.configurable&&(N=!1),q&&!q.writable&&(D=!1)}return(N||D||!x)&&(v?S(C,"length",$,!0,!0):S(C,"length",$)),C},setFunctionLength}var hasRequiredCallBind;function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,function(_){var S=requireFunctionBind(),v=requireGetIntrinsic(),T=requireSetFunctionLength(),O=requireType$1(),A=v("%Function.prototype.apply%"),k=v("%Function.prototype.call%"),C=v("%Reflect.apply%",!0)||S.call(k,A),$=requireEsDefineProperty(),x=v("%Math.max%");_.exports=function(q){if(typeof q!="function")throw new O("a function is required");var M=C(S,k,arguments);return T(M,1+x(0,q.length-(arguments.length-1)),!0)};var N=function(){return C(S,A,arguments)};$?$(_.exports,"apply",{value:N}):_.exports.apply=N}(callBind)),callBind.exports}var callBound,hasRequiredCallBound;function requireCallBound(){if(hasRequiredCallBound)return callBound;hasRequiredCallBound=1;var _=requireGetIntrinsic(),S=requireCallBind(),v=S(_("String.prototype.indexOf"));return callBound=function(O,A){var k=_(O,!!A);return typeof k=="function"&&v(O,".prototype.")>-1?S(k):k},callBound}const _nodeResolve_empty={},_nodeResolve_empty$1={__proto__:null,default:_nodeResolve_empty},require$$0=getAugmentedNamespace(_nodeResolve_empty$1);var objectInspect,hasRequiredObjectInspect;function requireObjectInspect(){if(hasRequiredObjectInspect)return objectInspect;hasRequiredObjectInspect=1;var _=typeof Map=="function"&&Map.prototype,S=Object.getOwnPropertyDescriptor&&_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,v=_&&S&&typeof S.get=="function"?S.get:null,T=_&&Map.prototype.forEach,O=typeof Set=="function"&&Set.prototype,A=Object.getOwnPropertyDescriptor&&O?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,k=O&&A&&typeof A.get=="function"?A.get:null,C=O&&Set.prototype.forEach,$=typeof WeakMap=="function"&&WeakMap.prototype,x=$?WeakMap.prototype.has:null,N=typeof WeakSet=="function"&&WeakSet.prototype,D=N?WeakSet.prototype.has:null,q=typeof WeakRef=="function"&&WeakRef.prototype,M=q?WeakRef.prototype.deref:null,U=Boolean.prototype.valueOf,z=Object.prototype.toString,W=Function.prototype.toString,j=String.prototype.match,B=String.prototype.slice,Z=String.prototype.replace,X=String.prototype.toUpperCase,Q=String.prototype.toLowerCase,ee=RegExp.prototype.test,ce=Array.prototype.concat,pe=Array.prototype.join,ae=Array.prototype.slice,se=Math.floor,ie=typeof BigInt=="function"?BigInt.prototype.valueOf:null,fe=Object.getOwnPropertySymbols,Oe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ue=typeof Symbol=="function"&&typeof Symbol.iterator=="object",le=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ue||!0)?Symbol.toStringTag:null,_e=Object.prototype.propertyIsEnumerable,me=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(Y){return Y.__proto__}:null);function oe(Y,K){if(Y===1/0||Y===-1/0||Y!==Y||Y&&Y>-1e3&&Y<1e3||ee.call(/e/,K))return K;var ge=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof Y=="number"){var Te=Y<0?-se(-Y):se(Y);if(Te!==Y){var we=String(Te),be=B.call(K,we.length+1);return Z.call(we,ge,"$&_")+"."+Z.call(Z.call(be,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Z.call(K,ge,"$&_")}var Se=require$$0,ye=Se.custom,ve=je(ye)?ye:null,Ee={__proto__:null,double:'"',single:"'"},Ie={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};objectInspect=function Y(K,ge,Te,we){var be=ge||{};if(Re(be,"quoteStyle")&&!Re(Ee,be.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Re(be,"maxStringLength")&&(typeof be.maxStringLength=="number"?be.maxStringLength<0&&be.maxStringLength!==1/0:be.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var He=Re(be,"customInspect")?be.customInspect:!0;if(typeof He!="boolean"&&He!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Re(be,"indent")&&be.indent!==null&&be.indent!==" "&&!(parseInt(be.indent,10)===be.indent&&be.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Re(be,"numericSeparator")&&typeof be.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ue=be.numericSeparator;if(typeof K>"u")return"undefined";if(K===null)return"null";if(typeof K=="boolean")return K?"true":"false";if(typeof K=="string")return Ge(K,be);if(typeof K=="number"){if(K===0)return 1/0/K>0?"0":"-0";var Ne=String(K);return Ue?oe(K,Ne):Ne}if(typeof K=="bigint"){var ze=String(K)+"n";return Ue?oe(K,ze):ze}var ct=typeof be.depth>"u"?5:be.depth;if(typeof Te>"u"&&(Te=0),Te>=ct&&ct>0&&typeof K=="object")return Le(K)?"[Array]":"[Object]";var Ye=te(be,Te);if(typeof we>"u")we=[];else if(tt(we,K)>=0)return"[Circular]";function Be(Ke,st,At){if(st&&(we=ae.call(we),we.push(st)),At){var Ot={depth:be.depth};return Re(be,"quoteStyle")&&(Ot.quoteStyle=be.quoteStyle),Y(Ke,Ot,Te+1,we)}return Y(Ke,be,Te+1,we)}if(typeof K=="function"&&!xe(K)){var yt=ot(K),bt=he(K,Be);return"[Function"+(yt?": "+yt:" (anonymous)")+"]"+(bt.length>0?" { "+pe.call(bt,", ")+" }":"")}if(je(K)){var St=ue?Z.call(String(K),/^(Symbol\(.*\))_[^)]*$/,"$1"):Oe.call(K);return typeof K=="object"&&!ue?Je(St):St}if(ut(K)){for(var et="<"+Q.call(String(K.nodeName)),ft=K.attributes||[],it=0;it<ft.length;it++)et+=" "+ft[it].name+"="+de(Ce(ft[it].value),"double",be);return et+=">",K.childNodes&&K.childNodes.length&&(et+="..."),et+="</"+Q.call(String(K.nodeName))+">",et}if(Le(K)){if(K.length===0)return"[]";var dt=he(K,Be);return Ye&&!re(dt)?"["+ne(dt,Ye)+"]":"[ "+pe.call(dt,", ")+" ]"}if(Ae(K)){var ht=he(K,Be);return!("cause"in Error.prototype)&&"cause"in K&&!_e.call(K,"cause")?"{ ["+String(K)+"] "+pe.call(ce.call("[cause]: "+Be(K.cause),ht),", ")+" }":ht.length===0?"["+String(K)+"]":"{ ["+String(K)+"] "+pe.call(ht,", ")+" }"}if(typeof K=="object"&&He){if(ve&&typeof K[ve]=="function"&&Se)return Se(K,{depth:ct-Te});if(He!=="symbol"&&typeof K.inspect=="function")return K.inspect()}if(rt(K)){var vt=[];return T&&T.call(K,function(Ke,st){vt.push(Be(st,K,!0)+" => "+Be(Ke,K))}),ke("Map",v.call(K),vt,Ye)}if(nt(K)){var wt=[];return C&&C.call(K,function(Ke){wt.push(Be(Ke,K))}),ke("Set",k.call(K),wt,Ye)}if(at(K))return Xe("WeakMap");if(Qe(K))return Xe("WeakSet");if(Me(K))return Xe("WeakRef");if(qe(K))return Je(Be(Number(K)));if($e(K))return Je(Be(ie.call(K)));if(Pe(K))return Je(U.call(K));if(De(K))return Je(Be(String(K)));if(typeof window<"u"&&K===window)return"{ [object Window] }";if(typeof globalThis<"u"&&K===globalThis||typeof commonjsGlobal<"u"&&K===commonjsGlobal)return"{ [object globalThis] }";if(!Fe(K)&&!xe(K)){var pt=he(K,Be),_t=me?me(K)===Object.prototype:K instanceof Object||K.constructor===Object,mt=K instanceof Object?"":"null prototype",Tt=!_t&&le&&Object(K)===K&&le in K?B.call(We(K),8,-1):mt?"Object":"",It=_t||typeof K.constructor!="function"?"":K.constructor.name?K.constructor.name+" ":"",gt=It+(Tt||mt?"["+pe.call(ce.call([],Tt||[],mt||[]),": ")+"] ":"");return pt.length===0?gt+"{}":Ye?gt+"{"+ne(pt,Ye)+"}":gt+"{ "+pe.call(pt,", ")+" }"}return String(K)};function de(Y,K,ge){var Te=ge.quoteStyle||K,we=Ee[Te];return we+Y+we}function Ce(Y){return Z.call(String(Y),/"/g,"&quot;")}function Le(Y){return We(Y)==="[object Array]"&&(!le||!(typeof Y=="object"&&le in Y))}function Fe(Y){return We(Y)==="[object Date]"&&(!le||!(typeof Y=="object"&&le in Y))}function xe(Y){return We(Y)==="[object RegExp]"&&(!le||!(typeof Y=="object"&&le in Y))}function Ae(Y){return We(Y)==="[object Error]"&&(!le||!(typeof Y=="object"&&le in Y))}function De(Y){return We(Y)==="[object String]"&&(!le||!(typeof Y=="object"&&le in Y))}function qe(Y){return We(Y)==="[object Number]"&&(!le||!(typeof Y=="object"&&le in Y))}function Pe(Y){return We(Y)==="[object Boolean]"&&(!le||!(typeof Y=="object"&&le in Y))}function je(Y){if(ue)return Y&&typeof Y=="object"&&Y instanceof Symbol;if(typeof Y=="symbol")return!0;if(!Y||typeof Y!="object"||!Oe)return!1;try{return Oe.call(Y),!0}catch{}return!1}function $e(Y){if(!Y||typeof Y!="object"||!ie)return!1;try{return ie.call(Y),!0}catch{}return!1}var Ve=Object.prototype.hasOwnProperty||function(Y){return Y in this};function Re(Y,K){return Ve.call(Y,K)}function We(Y){return z.call(Y)}function ot(Y){if(Y.name)return Y.name;var K=j.call(W.call(Y),/^function\s*([\w$]+)/);return K?K[1]:null}function tt(Y,K){if(Y.indexOf)return Y.indexOf(K);for(var ge=0,Te=Y.length;ge<Te;ge++)if(Y[ge]===K)return ge;return-1}function rt(Y){if(!v||!Y||typeof Y!="object")return!1;try{v.call(Y);try{k.call(Y)}catch{return!0}return Y instanceof Map}catch{}return!1}function at(Y){if(!x||!Y||typeof Y!="object")return!1;try{x.call(Y,x);try{D.call(Y,D)}catch{return!0}return Y instanceof WeakMap}catch{}return!1}function Me(Y){if(!M||!Y||typeof Y!="object")return!1;try{return M.call(Y),!0}catch{}return!1}function nt(Y){if(!k||!Y||typeof Y!="object")return!1;try{k.call(Y);try{v.call(Y)}catch{return!0}return Y instanceof Set}catch{}return!1}function Qe(Y){if(!D||!Y||typeof Y!="object")return!1;try{D.call(Y,D);try{x.call(Y,x)}catch{return!0}return Y instanceof WeakSet}catch{}return!1}function ut(Y){return!Y||typeof Y!="object"?!1:typeof HTMLElement<"u"&&Y instanceof HTMLElement?!0:typeof Y.nodeName=="string"&&typeof Y.getAttribute=="function"}function Ge(Y,K){if(Y.length>K.maxStringLength){var ge=Y.length-K.maxStringLength,Te="... "+ge+" more character"+(ge>1?"s":"");return Ge(B.call(Y,0,K.maxStringLength),K)+Te}var we=Ie[K.quoteStyle||"single"];we.lastIndex=0;var be=Z.call(Z.call(Y,we,"\\$1"),/[\x00-\x1f]/g,lt);return de(be,"single",K)}function lt(Y){var K=Y.charCodeAt(0),ge={8:"b",9:"t",10:"n",12:"f",13:"r"}[K];return ge?"\\"+ge:"\\x"+(K<16?"0":"")+X.call(K.toString(16))}function Je(Y){return"Object("+Y+")"}function Xe(Y){return Y+" { ? }"}function ke(Y,K,ge,Te){var we=Te?ne(ge,Te):pe.call(ge,", ");return Y+" ("+K+") {"+we+"}"}function re(Y){for(var K=0;K<Y.length;K++)if(tt(Y[K],`
7
- `)>=0)return!1;return!0}function te(Y,K){var ge;if(Y.indent===" ")ge=" ";else if(typeof Y.indent=="number"&&Y.indent>0)ge=pe.call(Array(Y.indent+1)," ");else return null;return{base:ge,prev:pe.call(Array(K+1),ge)}}function ne(Y,K){if(Y.length===0)return"";var ge=`
8
- `+K.prev+K.base;return ge+pe.call(Y,","+ge)+`
9
- `+K.prev}function he(Y,K){var ge=Le(Y),Te=[];if(ge){Te.length=Y.length;for(var we=0;we<Y.length;we++)Te[we]=Re(Y,we)?K(Y[we],Y):""}var be=typeof fe=="function"?fe(Y):[],He;if(ue){He={};for(var Ue=0;Ue<be.length;Ue++)He["$"+be[Ue]]=be[Ue]}for(var Ne in Y)Re(Y,Ne)&&(ge&&String(Number(Ne))===Ne&&Ne<Y.length||ue&&He["$"+Ne]instanceof Symbol||(ee.call(/[^\w$]/,Ne)?Te.push(K(Ne,Y)+": "+K(Y[Ne],Y)):Te.push(Ne+": "+K(Y[Ne],Y))));if(typeof fe=="function")for(var ze=0;ze<be.length;ze++)_e.call(Y,be[ze])&&Te.push("["+K(be[ze])+"]: "+K(Y[be[ze]],Y));return Te}return objectInspect}var sideChannel,hasRequiredSideChannel;function requireSideChannel(){if(hasRequiredSideChannel)return sideChannel;hasRequiredSideChannel=1;var _=requireGetIntrinsic(),S=requireCallBound(),v=requireObjectInspect(),T=requireType$1(),O=_("%WeakMap%",!0),A=_("%Map%",!0),k=S("WeakMap.prototype.get",!0),C=S("WeakMap.prototype.set",!0),$=S("WeakMap.prototype.has",!0),x=S("Map.prototype.get",!0),N=S("Map.prototype.set",!0),D=S("Map.prototype.has",!0),q=function(W,j){for(var B=W,Z;(Z=B.next)!==null;B=Z)if(Z.key===j)return B.next=Z.next,Z.next=W.next,W.next=Z,Z},M=function(W,j){var B=q(W,j);return B&&B.value},U=function(W,j,B){var Z=q(W,j);Z?Z.value=B:W.next={key:j,next:W.next,value:B}},z=function(W,j){return!!q(W,j)};return sideChannel=function(){var j,B,Z,X={assert:function(Q){if(!X.has(Q))throw new T("Side channel does not contain "+v(Q))},get:function(Q){if(O&&Q&&(typeof Q=="object"||typeof Q=="function")){if(j)return k(j,Q)}else if(A){if(B)return x(B,Q)}else if(Z)return M(Z,Q)},has:function(Q){if(O&&Q&&(typeof Q=="object"||typeof Q=="function")){if(j)return $(j,Q)}else if(A){if(B)return D(B,Q)}else if(Z)return z(Z,Q);return!1},set:function(Q,ee){O&&Q&&(typeof Q=="object"||typeof Q=="function")?(j||(j=new O),C(j,Q,ee)):A?(B||(B=new A),N(B,Q,ee)):(Z||(Z={key:{},next:null}),U(Z,Q,ee))}};return X},sideChannel}var formats,hasRequiredFormats;function requireFormats(){if(hasRequiredFormats)return formats;hasRequiredFormats=1;var _=String.prototype.replace,S=/%20/g,v={RFC1738:"RFC1738",RFC3986:"RFC3986"};return formats={default:v.RFC3986,formatters:{RFC1738:function(T){return _.call(T,S,"+")},RFC3986:function(T){return String(T)}},RFC1738:v.RFC1738,RFC3986:v.RFC3986},formats}var utils,hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1;var _=requireFormats(),S=Object.prototype.hasOwnProperty,v=Array.isArray,T=function(){for(var W=[],j=0;j<256;++j)W.push("%"+((j<16?"0":"")+j.toString(16)).toUpperCase());return W}(),O=function(j){for(;j.length>1;){var B=j.pop(),Z=B.obj[B.prop];if(v(Z)){for(var X=[],Q=0;Q<Z.length;++Q)typeof Z[Q]<"u"&&X.push(Z[Q]);B.obj[B.prop]=X}}},A=function(j,B){for(var Z=B&&B.plainObjects?Object.create(null):{},X=0;X<j.length;++X)typeof j[X]<"u"&&(Z[X]=j[X]);return Z},k=function W(j,B,Z){if(!B)return j;if(typeof B!="object"){if(v(j))j.push(B);else if(j&&typeof j=="object")(Z&&(Z.plainObjects||Z.allowPrototypes)||!S.call(Object.prototype,B))&&(j[B]=!0);else return[j,B];return j}if(!j||typeof j!="object")return[j].concat(B);var X=j;return v(j)&&!v(B)&&(X=A(j,Z)),v(j)&&v(B)?(B.forEach(function(Q,ee){if(S.call(j,ee)){var ce=j[ee];ce&&typeof ce=="object"&&Q&&typeof Q=="object"?j[ee]=W(ce,Q,Z):j.push(Q)}else j[ee]=Q}),j):Object.keys(B).reduce(function(Q,ee){var ce=B[ee];return S.call(Q,ee)?Q[ee]=W(Q[ee],ce,Z):Q[ee]=ce,Q},X)},C=function(j,B){return Object.keys(B).reduce(function(Z,X){return Z[X]=B[X],Z},j)},$=function(W,j,B){var Z=W.replace(/\+/g," ");if(B==="iso-8859-1")return Z.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(Z)}catch{return Z}},x=1024,N=function(j,B,Z,X,Q){if(j.length===0)return j;var ee=j;if(typeof j=="symbol"?ee=Symbol.prototype.toString.call(j):typeof j!="string"&&(ee=String(j)),Z==="iso-8859-1")return escape(ee).replace(/%u[0-9a-f]{4}/gi,function(Oe){return"%26%23"+parseInt(Oe.slice(2),16)+"%3B"});for(var ce="",pe=0;pe<ee.length;pe+=x){for(var ae=ee.length>=x?ee.slice(pe,pe+x):ee,se=[],ie=0;ie<ae.length;++ie){var fe=ae.charCodeAt(ie);if(fe===45||fe===46||fe===95||fe===126||fe>=48&&fe<=57||fe>=65&&fe<=90||fe>=97&&fe<=122||Q===_.RFC1738&&(fe===40||fe===41)){se[se.length]=ae.charAt(ie);continue}if(fe<128){se[se.length]=T[fe];continue}if(fe<2048){se[se.length]=T[192|fe>>6]+T[128|fe&63];continue}if(fe<55296||fe>=57344){se[se.length]=T[224|fe>>12]+T[128|fe>>6&63]+T[128|fe&63];continue}ie+=1,fe=65536+((fe&1023)<<10|ae.charCodeAt(ie)&1023),se[se.length]=T[240|fe>>18]+T[128|fe>>12&63]+T[128|fe>>6&63]+T[128|fe&63]}ce+=se.join("")}return ce},D=function(j){for(var B=[{obj:{o:j},prop:"o"}],Z=[],X=0;X<B.length;++X)for(var Q=B[X],ee=Q.obj[Q.prop],ce=Object.keys(ee),pe=0;pe<ce.length;++pe){var ae=ce[pe],se=ee[ae];typeof se=="object"&&se!==null&&Z.indexOf(se)===-1&&(B.push({obj:ee,prop:ae}),Z.push(se))}return O(B),j},q=function(j){return Object.prototype.toString.call(j)==="[object RegExp]"},M=function(j){return!j||typeof j!="object"?!1:!!(j.constructor&&j.constructor.isBuffer&&j.constructor.isBuffer(j))},U=function(j,B){return[].concat(j,B)},z=function(j,B){if(v(j)){for(var Z=[],X=0;X<j.length;X+=1)Z.push(B(j[X]));return Z}return B(j)};return utils={arrayToObject:A,assign:C,combine:U,compact:D,decode:$,encode:N,isBuffer:M,isRegExp:q,maybeMap:z,merge:k},utils}var stringify_1,hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify_1;hasRequiredStringify=1;var _=requireSideChannel(),S=requireUtils(),v=requireFormats(),T=Object.prototype.hasOwnProperty,O={brackets:function(W){return W+"[]"},comma:"comma",indices:function(W,j){return W+"["+j+"]"},repeat:function(W){return W}},A=Array.isArray,k=Array.prototype.push,C=function(z,W){k.apply(z,A(W)?W:[W])},$=Date.prototype.toISOString,x=v.default,N={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:S.encode,encodeValuesOnly:!1,format:x,formatter:v.formatters[x],indices:!1,serializeDate:function(W){return $.call(W)},skipNulls:!1,strictNullHandling:!1},D=function(W){return typeof W=="string"||typeof W=="number"||typeof W=="boolean"||typeof W=="symbol"||typeof W=="bigint"},q={},M=function z(W,j,B,Z,X,Q,ee,ce,pe,ae,se,ie,fe,Oe,ue,le,_e,me){for(var oe=W,Se=me,ye=0,ve=!1;(Se=Se.get(q))!==void 0&&!ve;){var Ee=Se.get(W);if(ye+=1,typeof Ee<"u"){if(Ee===ye)throw new RangeError("Cyclic object value");ve=!0}typeof Se.get(q)>"u"&&(ye=0)}if(typeof ae=="function"?oe=ae(j,oe):oe instanceof Date?oe=fe(oe):B==="comma"&&A(oe)&&(oe=S.maybeMap(oe,function(Ve){return Ve instanceof Date?fe(Ve):Ve})),oe===null){if(Q)return pe&&!le?pe(j,N.encoder,_e,"key",Oe):j;oe=""}if(D(oe)||S.isBuffer(oe)){if(pe){var Ie=le?j:pe(j,N.encoder,_e,"key",Oe);return[ue(Ie)+"="+ue(pe(oe,N.encoder,_e,"value",Oe))]}return[ue(j)+"="+ue(String(oe))]}var de=[];if(typeof oe>"u")return de;var Ce;if(B==="comma"&&A(oe))le&&pe&&(oe=S.maybeMap(oe,pe)),Ce=[{value:oe.length>0?oe.join(",")||null:void 0}];else if(A(ae))Ce=ae;else{var Le=Object.keys(oe);Ce=se?Le.sort(se):Le}var Fe=ce?j.replace(/\./g,"%2E"):j,xe=Z&&A(oe)&&oe.length===1?Fe+"[]":Fe;if(X&&A(oe)&&oe.length===0)return xe+"[]";for(var Ae=0;Ae<Ce.length;++Ae){var De=Ce[Ae],qe=typeof De=="object"&&typeof De.value<"u"?De.value:oe[De];if(!(ee&&qe===null)){var Pe=ie&&ce?De.replace(/\./g,"%2E"):De,je=A(oe)?typeof B=="function"?B(xe,Pe):xe:xe+(ie?"."+Pe:"["+Pe+"]");me.set(W,ye);var $e=_();$e.set(q,me),C(de,z(qe,je,B,Z,X,Q,ee,ce,B==="comma"&&le&&A(oe)?null:pe,ae,se,ie,fe,Oe,ue,le,_e,$e))}}return de},U=function(W){if(!W)return N;if(typeof W.allowEmptyArrays<"u"&&typeof W.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof W.encodeDotInKeys<"u"&&typeof W.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(W.encoder!==null&&typeof W.encoder<"u"&&typeof W.encoder!="function")throw new TypeError("Encoder has to be a function.");var j=W.charset||N.charset;if(typeof W.charset<"u"&&W.charset!=="utf-8"&&W.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var B=v.default;if(typeof W.format<"u"){if(!T.call(v.formatters,W.format))throw new TypeError("Unknown format option provided.");B=W.format}var Z=v.formatters[B],X=N.filter;(typeof W.filter=="function"||A(W.filter))&&(X=W.filter);var Q;if(W.arrayFormat in O?Q=W.arrayFormat:"indices"in W?Q=W.indices?"indices":"repeat":Q=N.arrayFormat,"commaRoundTrip"in W&&typeof W.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var ee=typeof W.allowDots>"u"?W.encodeDotInKeys===!0?!0:N.allowDots:!!W.allowDots;return{addQueryPrefix:typeof W.addQueryPrefix=="boolean"?W.addQueryPrefix:N.addQueryPrefix,allowDots:ee,allowEmptyArrays:typeof W.allowEmptyArrays=="boolean"?!!W.allowEmptyArrays:N.allowEmptyArrays,arrayFormat:Q,charset:j,charsetSentinel:typeof W.charsetSentinel=="boolean"?W.charsetSentinel:N.charsetSentinel,commaRoundTrip:W.commaRoundTrip,delimiter:typeof W.delimiter>"u"?N.delimiter:W.delimiter,encode:typeof W.encode=="boolean"?W.encode:N.encode,encodeDotInKeys:typeof W.encodeDotInKeys=="boolean"?W.encodeDotInKeys:N.encodeDotInKeys,encoder:typeof W.encoder=="function"?W.encoder:N.encoder,encodeValuesOnly:typeof W.encodeValuesOnly=="boolean"?W.encodeValuesOnly:N.encodeValuesOnly,filter:X,format:B,formatter:Z,serializeDate:typeof W.serializeDate=="function"?W.serializeDate:N.serializeDate,skipNulls:typeof W.skipNulls=="boolean"?W.skipNulls:N.skipNulls,sort:typeof W.sort=="function"?W.sort:null,strictNullHandling:typeof W.strictNullHandling=="boolean"?W.strictNullHandling:N.strictNullHandling}};return stringify_1=function(z,W){var j=z,B=U(W),Z,X;typeof B.filter=="function"?(X=B.filter,j=X("",j)):A(B.filter)&&(X=B.filter,Z=X);var Q=[];if(typeof j!="object"||j===null)return"";var ee=O[B.arrayFormat],ce=ee==="comma"&&B.commaRoundTrip;Z||(Z=Object.keys(j)),B.sort&&Z.sort(B.sort);for(var pe=_(),ae=0;ae<Z.length;++ae){var se=Z[ae];B.skipNulls&&j[se]===null||C(Q,M(j[se],se,ee,ce,B.allowEmptyArrays,B.strictNullHandling,B.skipNulls,B.encodeDotInKeys,B.encode?B.encoder:null,B.filter,B.sort,B.allowDots,B.serializeDate,B.format,B.formatter,B.encodeValuesOnly,B.charset,pe))}var ie=Q.join(B.delimiter),fe=B.addQueryPrefix===!0?"?":"";return B.charsetSentinel&&(B.charset==="iso-8859-1"?fe+="utf8=%26%2310003%3B&":fe+="utf8=%E2%9C%93&"),ie.length>0?fe+ie:""},stringify_1}var parse,hasRequiredParse$1;function requireParse$1(){if(hasRequiredParse$1)return parse;hasRequiredParse$1=1;var _=requireUtils(),S=Object.prototype.hasOwnProperty,v=Array.isArray,T={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:_.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},O=function(q){return q.replace(/&#(\d+);/g,function(M,U){return String.fromCharCode(parseInt(U,10))})},A=function(q,M){return q&&typeof q=="string"&&M.comma&&q.indexOf(",")>-1?q.split(","):q},k="utf8=%26%2310003%3B",C="utf8=%E2%9C%93",$=function(M,U){var z={__proto__:null},W=U.ignoreQueryPrefix?M.replace(/^\?/,""):M;W=W.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var j=U.parameterLimit===1/0?void 0:U.parameterLimit,B=W.split(U.delimiter,j),Z=-1,X,Q=U.charset;if(U.charsetSentinel)for(X=0;X<B.length;++X)B[X].indexOf("utf8=")===0&&(B[X]===C?Q="utf-8":B[X]===k&&(Q="iso-8859-1"),Z=X,X=B.length);for(X=0;X<B.length;++X)if(X!==Z){var ee=B[X],ce=ee.indexOf("]="),pe=ce===-1?ee.indexOf("="):ce+1,ae,se;pe===-1?(ae=U.decoder(ee,T.decoder,Q,"key"),se=U.strictNullHandling?null:""):(ae=U.decoder(ee.slice(0,pe),T.decoder,Q,"key"),se=_.maybeMap(A(ee.slice(pe+1),U),function(fe){return U.decoder(fe,T.decoder,Q,"value")})),se&&U.interpretNumericEntities&&Q==="iso-8859-1"&&(se=O(se)),ee.indexOf("[]=")>-1&&(se=v(se)?[se]:se);var ie=S.call(z,ae);ie&&U.duplicates==="combine"?z[ae]=_.combine(z[ae],se):(!ie||U.duplicates==="last")&&(z[ae]=se)}return z},x=function(q,M,U,z){for(var W=z?M:A(M,U),j=q.length-1;j>=0;--j){var B,Z=q[j];if(Z==="[]"&&U.parseArrays)B=U.allowEmptyArrays&&(W===""||U.strictNullHandling&&W===null)?[]:[].concat(W);else{B=U.plainObjects?Object.create(null):{};var X=Z.charAt(0)==="["&&Z.charAt(Z.length-1)==="]"?Z.slice(1,-1):Z,Q=U.decodeDotInKeys?X.replace(/%2E/g,"."):X,ee=parseInt(Q,10);!U.parseArrays&&Q===""?B={0:W}:!isNaN(ee)&&Z!==Q&&String(ee)===Q&&ee>=0&&U.parseArrays&&ee<=U.arrayLimit?(B=[],B[ee]=W):Q!=="__proto__"&&(B[Q]=W)}W=B}return W},N=function(M,U,z,W){if(M){var j=z.allowDots?M.replace(/\.([^.[]+)/g,"[$1]"):M,B=/(\[[^[\]]*])/,Z=/(\[[^[\]]*])/g,X=z.depth>0&&B.exec(j),Q=X?j.slice(0,X.index):j,ee=[];if(Q){if(!z.plainObjects&&S.call(Object.prototype,Q)&&!z.allowPrototypes)return;ee.push(Q)}for(var ce=0;z.depth>0&&(X=Z.exec(j))!==null&&ce<z.depth;){if(ce+=1,!z.plainObjects&&S.call(Object.prototype,X[1].slice(1,-1))&&!z.allowPrototypes)return;ee.push(X[1])}if(X){if(z.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+z.depth+" and strictDepth is true");ee.push("["+j.slice(X.index)+"]")}return x(ee,U,z,W)}},D=function(M){if(!M)return T;if(typeof M.allowEmptyArrays<"u"&&typeof M.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof M.decodeDotInKeys<"u"&&typeof M.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(M.decoder!==null&&typeof M.decoder<"u"&&typeof M.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof M.charset<"u"&&M.charset!=="utf-8"&&M.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var U=typeof M.charset>"u"?T.charset:M.charset,z=typeof M.duplicates>"u"?T.duplicates:M.duplicates;if(z!=="combine"&&z!=="first"&&z!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var W=typeof M.allowDots>"u"?M.decodeDotInKeys===!0?!0:T.allowDots:!!M.allowDots;return{allowDots:W,allowEmptyArrays:typeof M.allowEmptyArrays=="boolean"?!!M.allowEmptyArrays:T.allowEmptyArrays,allowPrototypes:typeof M.allowPrototypes=="boolean"?M.allowPrototypes:T.allowPrototypes,allowSparse:typeof M.allowSparse=="boolean"?M.allowSparse:T.allowSparse,arrayLimit:typeof M.arrayLimit=="number"?M.arrayLimit:T.arrayLimit,charset:U,charsetSentinel:typeof M.charsetSentinel=="boolean"?M.charsetSentinel:T.charsetSentinel,comma:typeof M.comma=="boolean"?M.comma:T.comma,decodeDotInKeys:typeof M.decodeDotInKeys=="boolean"?M.decodeDotInKeys:T.decodeDotInKeys,decoder:typeof M.decoder=="function"?M.decoder:T.decoder,delimiter:typeof M.delimiter=="string"||_.isRegExp(M.delimiter)?M.delimiter:T.delimiter,depth:typeof M.depth=="number"||M.depth===!1?+M.depth:T.depth,duplicates:z,ignoreQueryPrefix:M.ignoreQueryPrefix===!0,interpretNumericEntities:typeof M.interpretNumericEntities=="boolean"?M.interpretNumericEntities:T.interpretNumericEntities,parameterLimit:typeof M.parameterLimit=="number"?M.parameterLimit:T.parameterLimit,parseArrays:M.parseArrays!==!1,plainObjects:typeof M.plainObjects=="boolean"?M.plainObjects:T.plainObjects,strictDepth:typeof M.strictDepth=="boolean"?!!M.strictDepth:T.strictDepth,strictNullHandling:typeof M.strictNullHandling=="boolean"?M.strictNullHandling:T.strictNullHandling}};return parse=function(q,M){var U=D(M);if(q===""||q===null||typeof q>"u")return U.plainObjects?Object.create(null):{};for(var z=typeof q=="string"?$(q,U):q,W=U.plainObjects?Object.create(null):{},j=Object.keys(z),B=0;B<j.length;++B){var Z=j[B],X=N(Z,z[Z],U,typeof q=="string");W=_.merge(W,X,U)}return U.allowSparse===!0?W:_.compact(W)},parse}var lib,hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;var _=requireStringify(),S=requireParse$1(),v=requireFormats();return lib={formats:v,parse:S,stringify:_},lib}var libExports=requireLib();const y=getDefaultExportFromCjs(libExports);let L$1=class{#e;#t;#r;#n;_logger=null;#i="";constructor(S,v,T){this.#e=axios.create({baseURL:S,...T}),this.#t=v,this.#r=new a$1,this.#n=new u$2}setLogger(S){this._logger=S,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}setRestrictionManagerParams(S){this.#r.params=S}getRestrictionManagerParams(){return this.#r.params}setLogTag(S){this.#i=S}clearLogTag(){this.#i=""}async batch(S,v=!0){const T=Array.isArray(S),O=T?[]:{};let A=0;const k=(C,$)=>{let x=null,N=null;if(Array.isArray(C)?(x=C[0],N=C[1]):C.method&&(x=C.method,N=C.params),x){A++;const D=x+"?"+y.stringify(N);T||Array.isArray(O)?O.push(D):O[$]=D}};if(T)for(const[C,$]of S.entries())k($,C);else for(const[C,$]of Object.entries(S))k($,C);return A<1?Promise.resolve(new Result):this.call("batch",{halt:v?1:0,cmd:O}).then(C=>{const $=C.getData().result,x=T?[]:{},N=(U,z)=>{if(typeof $.result[z]<"u"||typeof $.result_error[z]<"u"){const W=U.split("?"),j=new AjaxResult({result:c.isUndefined($.result[z])?{}:$.result[z],error:$?.result_error[z]||void 0,total:$.result_total[z],next:$.result_next[z]},{method:W[0]||"",params:y.parse(W[1]||""),start:0},C.getStatus());T||Array.isArray(x)?x.push(j):x[z]=j}};if(Array.isArray(O))for(const[U,z]of O.entries())N(z,U);else for(const[U,z]of Object.entries(O))N(z,U);let D;const q=U=>new AjaxError({status:0,answerError:{error:U.getErrorMessages().join("; "),errorDescription:`batch ${U.getQuery().method}: ${y.stringify(U.getQuery().params,{encode:!1})}`},cause:U.getErrors().next().value}),M=new Result;if(T||Array.isArray(x)){D=[];for(const U of x){if(U.getStatus()!==200||!U.isSuccess){const z=q(U);if(!v&&!U.isSuccess){M.addError(z);continue}return Promise.reject(z)}D.push(U.getData().result)}}else{D={};for(const U of Object.keys(x)){const z=x[U];if(z.getStatus()!==200||!z.isSuccess){const W=q(z);if(!v&&!z.isSuccess){M.addError(W);continue}return Promise.reject(W)}D[U]=z.getData().result}}return M.setData(D),Promise.resolve(M)})}async call(S,v,T=0){let O=this.#t.getAuthData();return O===!1&&(O=await this.#t.refreshAuth()),await this.#r.check(),this.#e.post(this.#s(S),this.#o(O,v,T)).then(A=>{const k=A.data;return Promise.resolve({status:A.status,payload:k})},async A=>{let k={error:A?.code||0,errorDescription:A?.message||""};if(A instanceof AxiosError&&A.response&&A.response.data){const $=A.response.data;k={error:$.error,errorDescription:$.error_description}}const C=new AjaxError({status:A.response?.status||0,answerError:k,cause:A});return C.status===401&&["expired_token","invalid_token"].includes(C.answerError.error)?(this.getLogger().info(`refreshAuth >> ${C.answerError.error} >>>`),O=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#s(S),this.#o(O,v,T)).then(async $=>{const x=$.data;return Promise.resolve({status:$.status,payload:x})},async $=>{let x={error:$?.code||0,errorDescription:$?.message||""};if($ instanceof AxiosError&&$.response&&$.response.data){const D=$.response.data;x={error:D.error,errorDescription:D.error_description}}const N=new AjaxError({status:$.response?.status||0,answerError:x,cause:$});return Promise.reject(N)})):Promise.reject(C)}).then(A=>{const k=new AjaxResult(A.payload,{method:S,params:v,start:T},A.status);return Promise.resolve(k)})}#o(S,v,T=0){const O=Object.assign({},v);return this.#i.length>0&&(O.logTag=this.#i),O[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),O[this.#n.getQueryStringSdkParameterName()]="0.1.1",O.data&&O.data.start&&delete O.data.start,S.refresh_token!=="hook"&&(O.auth=S.access_token),O.start=T,O}#s(S){return`${encodeURIComponent(S)}.json`}};class AbstractB24{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(S){this._logger=S,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}callMethod(S,v,T){return this.getHttpClient().call(S,v||{},T||0)}async callListMethod(S,v={},T=null,O=null){const A=new Result;return c.isFunction(T)&&T!==null&&T(0),this.callMethod(S,v,0).then(async k=>{let C=[],$;if(O===null?$=k.getData().result:$=k.getData().result[O],C=[...C,...$],k.isMore()){let x=k;for(;x=await x.getNext(this.getHttpClient()),x!==!1;){let N;if(O===null?N=x.getData().result:N=x.getData().result[O],C=[...C,...N],T){const D=x.getTotal();T(D>0?Math.round(100*C.length/D):100)}}}return A.setData(C),T&&T(100),A})}async*fetchListMethod(S,v={},T="ID",O=null){v.order=v.order||{},v.filter=v.filter||{},v.start=-1;const A=`>${T}`;v.order[T]="ASC",v.filter[A]=0;do{const k=await this.callMethod(S,v,v.start);let C;if(c.isNull(O)&&O!==null?C=k.getData().result[O]:C=k.getData().result,C.length===0||(yield C,C.length<AbstractB24.batchSize))break;const $=C.at(-1);$&&T in $&&(v.filter[A]=$[T])}while(!0)}async callBatch(S,v=!0){return this.getHttpClient().batch(S,v)}chunkArray(S,v=50){const T=[];for(let O=0;O<S.length;O+=v){const A=S.slice(O,O+v);T.push(A)}return T}async callBatchByChunk(S,v=!0){const T=new Result,O=[],A=this.chunkArray(S,AbstractB24.batchSize);for(const k of A){const C=await this.callBatch(k,v);O.push(...C.getData())}return T.setData(O)}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 B24LangList=(_=>(_.en="en",_.de="de",_.la="la",_.br="br",_.fr="fr",_.it="it",_.pl="pl",_.ru="ru",_.ua="ua",_.tr="tr",_.sc="sc",_.tc="tc",_.ja="ja",_.vn="vn",_.id="id",_.ms="ms",_.th="th",_.ar="ar",_))(B24LangList||{});const e$1=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let t$1=class Ze{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!Ze.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");Ze.isInternalConstructing=!1}static getInstance(){return Ze.instance||(Ze.isInternalConstructing=!0,Ze.instance=new Ze),Ze.instance}setDefLocale(S){this._defLocale=S}format(S,v){let T;(typeof v>"u"||!c.isStringFilled(v))&&(v=c.isStringFilled(this._defLocale)?this._defLocale||"en":navigator?.language),Number.isInteger(S)?T=new Intl.NumberFormat(v,{minimumFractionDigits:0,maximumFractionDigits:0}):T=new Intl.NumberFormat(v,{minimumFractionDigits:2,maximumFractionDigits:2});let O=T.format(S);return v.includes("ru")&&(O=O.replace(",",".")),O}};class IbanSpecification{countryCode;length;structure;example;_cachedRegex=null;constructor(S,v,T,O){this.countryCode=S,this.length=v,this.structure=T,this.example=O}isValid(S){return this.length===S.length&&this.countryCode===S.slice(0,2)&&this._regex().test(S.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(S))==1}toBBAN(S,v){return(this._regex().exec(S.slice(4)||"")||[]).slice(1).join(v)}fromBBAN(S){if(!this.isValidBBAN(S))throw new Error("Invalid BBAN");const v=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+S)))).slice(-2);return this.countryCode+v+S}isValidBBAN(S){return this.length-4===S.length&&this._regex().test(S)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(S){const v=(S.match(/(.{3})/g)||[]).map(T=>{let O;const A=T.slice(0,1),k=Number.parseInt(T.slice(1),10);switch(A){case"A":O="0-9A-Za-z";break;case"B":O="0-9A-Z";break;case"C":O="A-Za-z";break;case"F":O="0-9";break;case"L":O="a-z";break;case"U":O="A-Z";break;case"W":O="0-9a-z";break}return"(["+O+"]{"+k+"})"});return new RegExp("^"+v.join("")+"$")}_iso13616Prepare(S){return S=S.toUpperCase(),S=S.substring(4)+S.substring(0,4),S.split("").map(v=>{const T=v.charCodeAt(0);return T>=65&&T<=90?(T-65+10).toString():v}).join("")}_iso7064Mod9710(S){let v=S,T;for(;v.length>2;)T=v.slice(0,9),v=Number.parseInt(T,10)%97+v.slice(T.length);return Number.parseInt(v,10)%97}}class FormatterIban{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!FormatterIban.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");FormatterIban.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return FormatterIban.instance||(FormatterIban.isInternalConstructing=!0,FormatterIban.instance=new FormatterIban),FormatterIban.instance}addSpecification(S){this._countries.set(S.countryCode,S)}isValid(S){if(!this._isString(S))return!1;S=this.electronicFormat(S);const v=S.slice(0,2);if(!this._countries.has(v))throw new Error(`No country with code ${v}`);const T=this._countries.get(v);return!!T&&T.isValid(S)}printFormat(S,v){typeof v>"u"&&(v=" ");const T=/(.{4})(?!$)/g;return this.electronicFormat(S).replace(T,"$1"+v)}electronicFormat(S){const v=/[^a-zA-Z0-9]/g;return S.replace(v,"").toUpperCase()}toBBAN(S,v){typeof v>"u"&&(v=" "),S=this.electronicFormat(S);const T=S.slice(0,2);if(!this._countries.has(T))throw new Error(`No country with code ${T}`);const O=this._countries.get(T);if(!O)throw new Error(`No country with code ${T}`);return O.toBBAN(S,v)}fromBBAN(S,v){if(!this._countries.has(S))throw new Error(`No country with code ${S}`);const T=this._countries.get(S);if(!T)throw new Error(`No country with code ${S}`);return T.fromBBAN(this.electronicFormat(v))}isValidBBAN(S,v){if(!this._isString(v))return!1;if(!this._countries.has(S))throw new Error(`No country with code ${S}`);const T=this._countries.get(S);return!!T&&T.isValidBBAN(this.electronicFormat(v))}_isString(S){return typeof S=="string"||S instanceof String}}const useFormatter=()=>{const _=t$1.getInstance(),S=FormatterIban.getInstance();return S.addSpecification(new IbanSpecification("AD",24,"F04F04A12","AD1200012030200359100100")),S.addSpecification(new IbanSpecification("AE",23,"F03F16","AE070331234567890123456")),S.addSpecification(new IbanSpecification("AL",28,"F08A16","AL47212110090000000235698741")),S.addSpecification(new IbanSpecification("AT",20,"F05F11","AT611904300234573201")),S.addSpecification(new IbanSpecification("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),S.addSpecification(new IbanSpecification("BA",20,"F03F03F08F02","BA391290079401028494")),S.addSpecification(new IbanSpecification("BE",16,"F03F07F02","BE68539007547034")),S.addSpecification(new IbanSpecification("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),S.addSpecification(new IbanSpecification("BH",22,"U04A14","BH67BMAG00001299123456")),S.addSpecification(new IbanSpecification("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),S.addSpecification(new IbanSpecification("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),S.addSpecification(new IbanSpecification("CH",21,"F05A12","CH9300762011623852957")),S.addSpecification(new IbanSpecification("CR",22,"F04F14","CR72012300000171549015")),S.addSpecification(new IbanSpecification("CY",28,"F03F05A16","CY17002001280000001200527600")),S.addSpecification(new IbanSpecification("CZ",24,"F04F06F10","CZ6508000000192000145399")),S.addSpecification(new IbanSpecification("DE",22,"F08F10","DE89370400440532013000")),S.addSpecification(new IbanSpecification("DK",18,"F04F09F01","DK5000400440116243")),S.addSpecification(new IbanSpecification("DO",28,"U04F20","DO28BAGR00000001212453611324")),S.addSpecification(new IbanSpecification("EE",20,"F02F02F11F01","EE382200221020145685")),S.addSpecification(new IbanSpecification("EG",29,"F04F04F17","EG800002000156789012345180002")),S.addSpecification(new IbanSpecification("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),S.addSpecification(new IbanSpecification("FI",18,"F06F07F01","FI2112345600000785")),S.addSpecification(new IbanSpecification("FO",18,"F04F09F01","FO6264600001631634")),S.addSpecification(new IbanSpecification("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),S.addSpecification(new IbanSpecification("GB",22,"U04F06F08","GB29NWBK60161331926819")),S.addSpecification(new IbanSpecification("GE",22,"U02F16","GE29NB0000000101904917")),S.addSpecification(new IbanSpecification("GI",23,"U04A15","GI75NWBK000000007099453")),S.addSpecification(new IbanSpecification("GL",18,"F04F09F01","GL8964710001000206")),S.addSpecification(new IbanSpecification("GR",27,"F03F04A16","GR1601101250000000012300695")),S.addSpecification(new IbanSpecification("GT",28,"A04A20","GT82TRAJ01020000001210029690")),S.addSpecification(new IbanSpecification("HR",21,"F07F10","HR1210010051863000160")),S.addSpecification(new IbanSpecification("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),S.addSpecification(new IbanSpecification("IE",22,"U04F06F08","IE29AIBK93115212345678")),S.addSpecification(new IbanSpecification("IL",23,"F03F03F13","IL620108000000099999999")),S.addSpecification(new IbanSpecification("IS",26,"F04F02F06F10","IS140159260076545510730339")),S.addSpecification(new IbanSpecification("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),S.addSpecification(new IbanSpecification("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),S.addSpecification(new IbanSpecification("JO",30,"A04F22","JO15AAAA1234567890123456789012")),S.addSpecification(new IbanSpecification("KW",30,"U04A22","KW81CBKU0000000000001234560101")),S.addSpecification(new IbanSpecification("KZ",20,"F03A13","KZ86125KZT5004100100")),S.addSpecification(new IbanSpecification("LB",28,"F04A20","LB62099900000001001901229114")),S.addSpecification(new IbanSpecification("LC",32,"U04F24","LC07HEMM000100010012001200013015")),S.addSpecification(new IbanSpecification("LI",21,"F05A12","LI21088100002324013AA")),S.addSpecification(new IbanSpecification("LT",20,"F05F11","LT121000011101001000")),S.addSpecification(new IbanSpecification("LU",20,"F03A13","LU280019400644750000")),S.addSpecification(new IbanSpecification("LV",21,"U04A13","LV80BANK0000435195001")),S.addSpecification(new IbanSpecification("MC",27,"F05F05A11F02","MC5811222000010123456789030")),S.addSpecification(new IbanSpecification("MD",24,"U02A18","MD24AG000225100013104168")),S.addSpecification(new IbanSpecification("ME",22,"F03F13F02","ME25505000012345678951")),S.addSpecification(new IbanSpecification("MK",19,"F03A10F02","MK07250120000058984")),S.addSpecification(new IbanSpecification("MR",27,"F05F05F11F02","MR1300020001010000123456753")),S.addSpecification(new IbanSpecification("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),S.addSpecification(new IbanSpecification("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),S.addSpecification(new IbanSpecification("NL",18,"U04F10","NL91ABNA0417164300")),S.addSpecification(new IbanSpecification("NO",15,"F04F06F01","NO9386011117947")),S.addSpecification(new IbanSpecification("PK",24,"U04A16","PK36SCBL0000001123456702")),S.addSpecification(new IbanSpecification("PL",28,"F08F16","PL61109010140000071219812874")),S.addSpecification(new IbanSpecification("PS",29,"U04A21","PS92PALS000000000400123456702")),S.addSpecification(new IbanSpecification("PT",25,"F04F04F11F02","PT50000201231234567890154")),S.addSpecification(new IbanSpecification("QA",29,"U04A21","QA30AAAA123456789012345678901")),S.addSpecification(new IbanSpecification("RO",24,"U04A16","RO49AAAA1B31007593840000")),S.addSpecification(new IbanSpecification("RS",22,"F03F13F02","RS35260005601001611379")),S.addSpecification(new IbanSpecification("SA",24,"F02A18","SA0380000000608010167519")),S.addSpecification(new IbanSpecification("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),S.addSpecification(new IbanSpecification("SE",24,"F03F16F01","SE4550000000058398257466")),S.addSpecification(new IbanSpecification("SI",19,"F05F08F02","SI56263300012039086")),S.addSpecification(new IbanSpecification("SK",24,"F04F06F10","SK3112000000198742637541")),S.addSpecification(new IbanSpecification("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),S.addSpecification(new IbanSpecification("ST",25,"F08F11F02","ST68000100010051845310112")),S.addSpecification(new IbanSpecification("SV",28,"U04F20","SV62CENR00000000000000700025")),S.addSpecification(new IbanSpecification("TL",23,"F03F14F02","TL380080012345678910157")),S.addSpecification(new IbanSpecification("TN",24,"F02F03F13F02","TN5910006035183598478831")),S.addSpecification(new IbanSpecification("TR",26,"F05F01A16","TR330006100519786457841326")),S.addSpecification(new IbanSpecification("UA",29,"F25","UA511234567890123456789012345")),S.addSpecification(new IbanSpecification("VA",22,"F18","VA59001123000012345678")),S.addSpecification(new IbanSpecification("VG",24,"U04F16","VG96VPVG0000012345678901")),S.addSpecification(new IbanSpecification("XK",20,"F04F10F02","XK051212012345678906")),S.addSpecification(new IbanSpecification("AO",25,"F21","AO69123456789012345678901")),S.addSpecification(new IbanSpecification("BF",27,"F23","BF2312345678901234567890123")),S.addSpecification(new IbanSpecification("BI",16,"F12","BI41123456789012")),S.addSpecification(new IbanSpecification("BJ",28,"F24","BJ39123456789012345678901234")),S.addSpecification(new IbanSpecification("CI",28,"U02F22","CI70CI1234567890123456789012")),S.addSpecification(new IbanSpecification("CM",27,"F23","CM9012345678901234567890123")),S.addSpecification(new IbanSpecification("CV",25,"F21","CV30123456789012345678901")),S.addSpecification(new IbanSpecification("DZ",24,"F20","DZ8612345678901234567890")),S.addSpecification(new IbanSpecification("IR",26,"F22","IR861234568790123456789012")),S.addSpecification(new IbanSpecification("MG",27,"F23","MG1812345678901234567890123")),S.addSpecification(new IbanSpecification("ML",28,"U01F23","ML15A12345678901234567890123")),S.addSpecification(new IbanSpecification("MZ",25,"F21","MZ25123456789012345678901")),S.addSpecification(new IbanSpecification("SN",28,"U01F23","SN52A12345678901234567890123")),S.addSpecification(new IbanSpecification("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),S.addSpecification(new IbanSpecification("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),S.addSpecification(new IbanSpecification("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),S.addSpecification(new IbanSpecification("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),S.addSpecification(new IbanSpecification("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),S.addSpecification(new IbanSpecification("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),S.addSpecification(new IbanSpecification("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),S.addSpecification(new IbanSpecification("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),S.addSpecification(new IbanSpecification("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),S.addSpecification(new IbanSpecification("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),S.addSpecification(new IbanSpecification("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),S.addSpecification(new IbanSpecification("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:_,formatterIban:S}};class AuthHookManager{#e;constructor(S){this.#e=Object.freeze(Object.assign({},S))}getAuthData(){const S=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:S,member_id:S}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(S){const v=this.getAuthData();if(v===!1)throw new Error("AuthData not init");return[S,v.member_id].join("_")}getTargetOrigin(){return`${this.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class B24Hook extends AbstractB24{#e;constructor(S){super(),this.#e=new AuthHookManager(S),this._http=new L$1(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._isInit=!0}setLogger(S){super.setLogger(S)}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var MessageCommands=(_=>(_.getInitData="getInitData",_.setInstallFinish="setInstallFinish",_.setInstall="setInstall",_.refreshAuth="refreshAuth",_.setAppOption="setAppOption",_.setUserOption="setUserOption",_.resizeWindow="resizeWindow",_.reloadWindow="reloadWindow",_.setTitle="setTitle",_.setScroll="setScroll",_.openApplication="openApplication",_.closeApplication="closeApplication",_.openPath="openPath",_.imCallTo="imCallTo",_.imPhoneTo="imPhoneTo",_.imOpenMessenger="imOpenMessenger",_.imOpenHistory="imOpenHistory",_.selectUser="selectUser",_.selectAccess="selectAccess",_.selectCRM="selectCRM",_.showAppForm="showAppForm",_))(MessageCommands||{});class MessageManager{#e;#t;_logger=null;runCallbackHandler;constructor(S){this.#e=S,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(S,v=null){return new Promise((T,O)=>{let A;const k={resolve:T,reject:O,timeoutId:null},C=this.#r(k);if(S.toString().includes(":"))A={method:S.toString(),params:v??"",callback:C,appSid:this.#e.getAppSid()};else{A=S.toString();const $=[v?JSON.stringify(v):null,C,this.#e.getAppSid()];A+=":"+$.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:A}),parent.postMessage(A,this.#e.getTargetOrigin()),v?.isSafely&&(this.#t.get(C).timeoutId=window.setTimeout(()=>{this.#t.has(C)&&(this.getLogger().warn(`Action ${S.toString()} stop by timeout`),this.#t.delete(C),T({isSafely:!0}))},Number.parseInt(String(v?.safelyTime||900))))})}_runCallback(S){if(S.origin===this.#e.getTargetOrigin()&&S.data){this.getLogger().log(`get from ${S.origin}`,{data:S.data});const v=S.data.split(":"),T={id:v[0],args:v.slice(1).join(":")};if(T.args&&(T.args=JSON.parse(T.args)),this.#t.has(T.id)){const O=this.#t.get(T.id);O.timeoutId&&clearTimeout(O.timeoutId),this.#t.delete(T.id),O.resolve(T.args)}}}#r(S){const v=h$1.getUniqId();return this.#t.set(v,S),v}}class AppFrame{#e="";#t=!0;#r=null;#n=null;#i=null;constructor(S){S.DOMAIN&&(this.#e=S.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=S.PROTOCOL===!0,S.LANG&&(this.#i=S.LANG),S.APP_SID&&(this.#r=S.APP_SID)}initData(S){return this.#e||(this.#e=S.DOMAIN),this.#n||(this.#n=S.PATH),this.#i||(this.#i=S.LANG),this.#t=Number.parseInt(S.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.#i||B24LangList.en}}class AuthManager{#e=null;#t=null;#r=0;#n=null;#i=!1;#o;#s;constructor(S,v){this.#o=S,this.#s=v}initData(S){return S.AUTH_ID&&(this.#e=S.AUTH_ID,this.#t=S.REFRESH_ID,this.#r=Date.now()+Number.parseInt(S.AUTH_EXPIRES)*1e3,this.#i=S.IS_ADMIN,this.#n=S.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#s.send(MessageCommands.refreshAuth,{}).then(S=>(this.#e=S.AUTH_ID,this.#t=S.REFRESH_ID,this.#r=Date.now()+Number.parseInt(S.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(S){return[S,this.#n||""].join("_")}get isAdmin(){return this.#i}}class ParentManager{#e;constructor(S){this.#e=S}async closeApplication(){return this.#e.send(MessageCommands.closeApplication,{isSafely:!1})}async fitWindow(){const S="100%",v=this.getScrollSize().scrollHeight;return this.#e.send(MessageCommands.resizeWindow,{width:S,height:v,isSafely:!0})}async resizeWindow(S,v){return S>0&&v>0?this.#e.send(MessageCommands.resizeWindow,{width:S,height:v,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${S} or height:number = ${v}`))}async resizeWindowAuto(S=null,v=0,T=0){const O=document.body;let A=Math.max(O.scrollWidth,O.offsetWidth);T>0&&(A=Math.max(T,A));let k=Math.max(O.scrollHeight,O.offsetHeight);return S&&(k=Math.max(S.scrollHeight,S.offsetHeight)),v>0&&(k=Math.max(v,k)),this.resizeWindow(A,k)}getScrollSize(){return e$1()}async scrollParentWindow(S){return Number.isInteger(S)?(S<0&&(S=0),this.#e.send(MessageCommands.setScroll,{scroll:S,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(MessageCommands.reloadWindow,{isSafely:!0})}async setTitle(S){return this.#e.send(MessageCommands.setTitle,{title:S.toString(),isSafely:!0})}async imCallTo(S,v=!0){return this.#e.send(MessageCommands.imCallTo,{userId:S,video:v,isSafely:!0})}async imPhoneTo(S){return this.#e.send(MessageCommands.imPhoneTo,{phone:S,isSafely:!0})}async imOpenMessenger(S){return this.#e.send(MessageCommands.imOpenMessenger,{dialogId:S,isSafely:!0})}async imOpenHistory(S){return this.#e.send(MessageCommands.imOpenHistory,{dialogId:S,isSafely:!0})}}let OptionsManager$1=class{#e;#t=null;#r=null;constructor(S){this.#e=S}initData(S){return S.APP_OPTIONS&&(this.#t=S.APP_OPTIONS),S.USER_OPTIONS&&(this.#r=S.USER_OPTIONS),this}appGet(S){if(this.#t&&this.#t[S])return this.#t[S];throw new Error(`app.option.${S} not set`)}async appSet(S,v){return this.#t||(this.#t=[]),this.#t[S]=v,this.#n(MessageCommands.setAppOption,S,this.#t[S])}userGet(S){if(this.#r&&this.#r[S])return this.#r[S];throw new Error(`user.option.${S} not set`)}async userSet(S,v){return this.#t||(this.#t=[]),this.#t[S]||(this.#t[S]=null),this.#r[S]=v,this.#n(MessageCommands.setUserOption,S,this.#r[S])}async#n(S,v,T){return this.#e.send(S,{name:v,value:T,isSafely:!0}).then(()=>Promise.resolve())}};class DialogManager{#e;constructor(S){this.#e=S}async selectUser(){return this.#e.send(MessageCommands.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(MessageCommands.selectUser,{mult:!0})}async selectAccess(S=[]){return console.warn("@deprecated selectAccess"),this.#e.send(MessageCommands.selectAccess,{value:S})}async selectCRM(S){return console.warn("@deprecated selectCRM"),this.#e.send(MessageCommands.selectCRM,{entityType:S?.entityType,multiple:S?.multiple,value:S?.value})}}class SliderManager{#e;#t;constructor(S,v){this.#e=S,this.#t=v}getUrl(S="/"){return new URL(S,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(S={}){return this.#t.send(MessageCommands.openApplication,S)}async closeSliderAppPage(){return this.#t.send(MessageCommands.closeApplication,{isSafely:!1})}#r(S=1640){return S>0?S>1200&&S<=1640?"/crm/type/0/details/0/../../../../..":S>950&&S<=1200?"/company/personal/user/0/groups/create/../../../../../..":S>900&&S<=950?"/crm/company/requisite/0/../../../..":S<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(S,v=1640){const T=new URL(S);return T.searchParams.set("IFRAME","Y"),T.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(MessageCommands.openPath,{path:[this.#r(v),T.pathname,T.search].join("")}).then(O=>O?.result==="error"?O?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((A,k)=>{const C=window.open(S,"_blank");if(!C){k(new Error("Error open window"));return}let $=0;const x=1e3*60*5,N=window.setInterval(()=>{$=$+1,C.closed?(clearInterval(N),A({isOpenAtNewWindow:!0,isClose:!0})):$>x&&(clearInterval(N),A({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(O?.errorCode)):O?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(S){return console.warn("@deprecated showAppForm"),this.#t.send(MessageCommands.showAppForm,{params:S,isSafely:!0})}}class PlacementManager{#e="";#t={};constructor(){}initData(S){this.#e=S.PLACEMENT||"DEFAULT";const v=S.PLACEMENT_OPTIONS;return this.#t=Object.freeze(v),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class B24Frame extends AbstractB24{#e=!1;#t=!1;#r;#n;#i;#o;#s;#u;#l;#a;constructor(S){super(),this.#r=new AppFrame(S),this.#n=new MessageManager(this.#r),this.#n.subscribe(),this.#i=new AuthManager(this.#r,this.#n),this.#o=new ParentManager(this.#n),this.#s=new OptionsManager$1(this.#n),this.#u=new DialogManager(this.#n),this.#l=new SliderManager(this.#r,this.#n),this.#a=new PlacementManager,this._isInit=!1}setLogger(S){super.setLogger(S),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.#o}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#l}get placement(){return this._ensureInitialized(),this.#a}get options(){return this._ensureInitialized(),this.#s}get dialog(){return this._ensureInitialized(),this.#u}async init(){return this.#n.send(MessageCommands.getInitData,{}).then(S=>(this.getLogger().log("init data:",S),this.#r.initData(S),this.#i.initData(S),this.#a.initData(S),this.#s.initData(S),this.#e=S.INSTALL,this.#t=S.FIRST_RUN,this._http=new L$1(this.#r.getTargetOriginWithPath(),this.#i,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(MessageCommands.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(MessageCommands.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 UnhandledMatchError extends Error{constructor(S,...v){super(...v),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${S}`,this.stack=new Error("for stack").stack}}class AbstractHelper{_b24;_logger=null;_data=null;constructor(S){this._b24=S}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}async initData(S){return this.getLogger().log(S),Promise.reject(new Error("Rewrite this function"))}}class ProfileManager extends AbstractHelper{_data=null;async initData(S){this._data=S}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class AppManager extends AbstractHelper{_data=null;async initData(S){this._data=S}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return StatusDescriptions[this.data.status]||"Unknown status"}}class PaymentManager extends AbstractHelper{_data=null;async initData(S){this._data=S}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class LicenseManager extends AbstractHelper{_data=null;async initData(S){this._data=S,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`,RestrictionManagerParamsForEnterprise),this._b24.getHttpClient().setRestrictionManagerParams(RestrictionManagerParamsForEnterprise))}}class CurrencyManager extends AbstractHelper{async initData(S){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(S.currencyBase),this.setCurrencyList(S.currencyList);try{await this.loadData()}catch(v){throw v instanceof Error?v:(console.error(v),new Error("Failed to load data"))}}async loadData(){const S=this.currencyList.map(v=>({method:"crm.currency.get",params:{id:v}}));if(S.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(S,!0)).getData().forEach(v=>{if(typeof v.LANG>"u")return;const T=v.CURRENCY,O=this.data.currencyList.get(T);if(!(typeof O>"u"))for(const[A,k]of Object.entries(v.LANG))switch(O.lang[A]={decimals:Number.parseInt(k.DECIMALS),decPoint:k.DEC_POINT,formatString:k.FORMAT_STRING,fullName:k.FULL_NAME,isHideZero:k.HIDE_ZERO==="Y",thousandsSep:k.THOUSANDS_SEP,thousandsVariant:k.THOUSANDS_VARIANT},O.lang[A].thousandsVariant){case"N":O.lang[A].thousandsSep="";break;case"D":O.lang[A].thousandsSep=".";break;case"C":O.lang[A].thousandsSep=",";break;case"S":O.lang[A].thousandsSep=" ";break;case"B":O.lang[A].thousandsSep="&nbsp;";break;default:c.isStringFilled(O.lang[A].thousandsSep)||(O.lang[A].thousandsSep=" ");break}})}catch(v){console.error(v)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(S){this._data.currencyBase=S}get baseCurrency(){return this.data.currencyBase}setCurrencyList(S=[]){this.data.currencyList.clear();for(const v of S)this.data.currencyList.set(v.CURRENCY,{amount:Number.parseFloat(v.CURRENCY),amountCnt:Number.parseInt(v.AMOUNT_CNT),isBase:v.BASE==="Y",currencyCode:v.CURRENCY,dateUpdate:h$1.toDateTime(v.DATE_UPDATE),decimals:Number.parseInt(v.DECIMALS),decPoint:v.DEC_POINT,formatString:v.FORMAT_STRING,fullName:v.FULL_NAME,lid:v.LID,sort:Number.parseInt(v.SORT),thousandsSep:v?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(S,v){const T=this.data.currencyList.get(S);if(typeof T>"u")throw new UnhandledMatchError(S);let O=T.fullName;if(!(typeof v>"u")){const A=T.lang[v];c.isUndefined(A)||(O=A.fullName)}return O}getCurrencyLiteral(S,v){const T=this.data.currencyList.get(S);if(typeof T>"u")throw new UnhandledMatchError(S);let O=T.formatString;if(!(typeof v>"u")){const A=T.lang[v];c.isUndefined(A)||(O=A.formatString)}return O.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(S,v,T){const O=this.data.currencyList.get(v);if(typeof O>"u")throw new UnhandledMatchError(v);const A={formatString:O.formatString,decimals:O.decimals,decPoint:O.decPoint,thousandsSep:O.thousandsSep};c.isStringFilled(A.thousandsSep)||(A.thousandsSep="");const k=O.lang[T];return c.isUndefined(k)||(A.formatString=k.formatString,A.decimals=k.decimals,A.decPoint=k.decPoint,A.thousandsSep=k.thousandsSep),A.formatString.replaceAll("&#","&%").replace("#",h$1.numberFormat(S,A.decimals,A.decPoint,A.thousandsSep)).replaceAll("&%","&#")||""}}class OptionsManager extends AbstractHelper{_data;_type;static getSupportTypes(){return[TypeOption.NotSet,TypeOption.JsonArray,TypeOption.JsonObject,TypeOption.FloatVal,TypeOption.IntegerVal,TypeOption.BoolYN,TypeOption.StringVal]}static prepareArrayList(S){return c.isArray(S)?S:c.isObject(S)?Object.values(S):[]}constructor(S,v){super(S),this._type=v,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(S){if(this.reset(),c.isObject(S))for(const[v,T]of Object.entries(S))this.data.set(v,T)}getJsonArray(S,v=[]){if(!this.data.has(S))return v;let T=this.data.get(S);try{T=JSON.parse(T),!c.isArray(T)&&!c.isObject(T)&&(T=v)}catch(O){this.getLogger().error(O),T=v}return OptionsManager.prepareArrayList(T)}getJsonObject(S,v={}){if(!this.data.has(S))return v;let T=this.data.get(S);try{T=JSON.parse(T)}catch(O){this.getLogger().error(O),T=v}return c.isObject(T)||(T=v),T}getFloat(S,v=0){return this.data.has(S)?h$1.toNumber(this.data.get(S)):v}getInteger(S,v=0){return this.data.has(S)?h$1.toInteger(this.data.get(S)):v}getBoolYN(S,v=!0){return this.data.has(S)?h$1.toBoolean(this.data.get(S)):v}getBoolNY(S,v=!1){return this.data.has(S)?h$1.toBoolean(this.data.get(S)):v}getString(S,v=""){return this.data.has(S)?this.data.get(S).toString():v}getDate(S,v=null){if(!this.data.has(S))return v;try{const T=h$1.toDateTime(this.data.get(S).toString());return T.isValid?T:v}catch{return v}}encode(S){return JSON.stringify(S)}decode(S,v){try{return S.length>0?JSON.parse(S):v}catch(T){this.getLogger().warn(T,S)}return v}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(S,v){const T=[];return T.push({method:this.getMethodSave(),params:{options:S}}),c.isObject(v)&&T.push({method:"pull.application.event.add",params:{COMMAND:v?.command,PARAMS:v?.params,MODULE_ID:v?.moduleId}}),this._b24.callBatch(T,!0)}}class StorageManager{_logger=null;userId;siteId;constructor(S={}){this.userId=S.userId?h$1.toInteger(S.userId):0,this.siteId=S.siteId??"none"}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}set(S,v){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof v!="string"&&v&&(v=JSON.stringify(v)),window.localStorage.setItem(this._getKey(S),v)}get(S,v){if(typeof window.localStorage>"u")return v||null;const T=window.localStorage.getItem(this._getKey(S));return T===null?v||null:JSON.parse(T)}remove(S){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(S))}_getKey(S){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${S}`}compareKey(S,v){return S===this._getKey(v)}}class ErrorNotConnected extends Error{constructor(S){super(S),this.name="ErrorNotConnected"}}class ErrorTimeout extends Error{constructor(S){super(S),this.name="ErrorTimeout"}}const u$1="2.0";class JsonRpc{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(S){if(this._connector=S.connector,c.isPlainObject(S.handlers))for(const v in S.handlers)this.handle(v,S.handlers[v])}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}handle(S,v){this._handlers[S]=v}async executeOutgoingRpcCommand(S,v,T=5){return new Promise((O,A)=>{const k=this.createRequest(S,v);this._connector.send(JSON.stringify(k))||A(new ErrorNotConnected("websocket is not connected"));const C=setTimeout(()=>{this._rpcResponseAwaiters.delete(k.id),A(new ErrorTimeout("no response"))},T*1e3);this._rpcResponseAwaiters.set(k.id,{resolve:O,reject:A,timeout:C})})}executeOutgoingRpcBatch(S){const v=[],T=[];return S.forEach(({method:O,params:A,id:k})=>{const C=this.createRequest(O,A,k);v.push(C),T.push(new Promise(($,x)=>this._rpcResponseAwaiters.set(C.id,{resolve:$,reject:x})))}),this._connector.send(JSON.stringify(v)),T}processRpcResponse(S){if("id"in S&&this._rpcResponseAwaiters.has(Number(S.id))){const v=this._rpcResponseAwaiters.get(Number(S.id));v&&("result"in S?v.resolve(S.result):"error"in S?v.reject(S?.error||"error"):v.reject("wrong response structure"),clearTimeout(v.timeout),this._rpcResponseAwaiters.delete(Number(S.id)));return}this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: Received rpc response with unknown id`),S)}parseJsonRpcMessage(S){let v;try{v=JSON.parse(S)}catch(T){this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: Could not decode json rpc message`),T);return}if(c.isArray(v))return this.executeIncomingRpcBatch(v);if(c.isJsonRpcRequest(v))return this.executeIncomingRpcCommand(v);if(c.isJsonRpcResponse(v))return this.processRpcResponse(v);this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: unknown rpc packet`),v)}executeIncomingRpcCommand({method:S,params:v}){return S in this._handlers?this._handlers[S].call(this,v||{}):{jsonrpc:u$1,error:ListRpcError.MethodNotFound}}executeIncomingRpcBatch(S){const v=[];for(const T of S)if("jsonrpc"in T)if("method"in T){const O=this.executeIncomingRpcCommand(T);O&&(O.jsonrpc=u$1,O.id=T.id,v.push(O))}else this.processRpcResponse(T);else this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: unknown rpc command in batch`),T),v.push({jsonrpc:u$1,error:ListRpcError.InvalidRequest});return v}nextId(){return++this._idCounter}createPublishRequest(S){return S.map(v=>this.createRequest("publish",v))}createRequest(S,v,T){return T||(T=this.nextId()),{jsonrpc:u$1,method:S,params:v,id:T}}}class SharedConfig{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(S={}){S=S||{},this._storage=S.storage||new StorageManager,this._callbacks={onWebSocketBlockChanged:c.isFunction(S.onWebSocketBlockChanged)?S.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}onLocalStorageSet(S){this._storage.compareKey(S.key||"",LsKeys.WebsocketBlocked)&&S.newValue!==S.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(LsKeys.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(S){if(!this._storage)return!1;try{this._storage.set(LsKeys.WebsocketBlocked,S?Date.now()+this._ttl:0)}catch(v){return this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),v),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(LsKeys.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(S){if(!this._storage)return!1;try{this._storage.set(LsKeys.LongPollingBlocked,S?Date.now()+this._ttl:0)}catch(v){return this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),v),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(LsKeys.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(S){if(!this._storage)return!1;try{this._storage.set(LsKeys.LoggingEnabled,S?this.getTimestamp()+this._ttl:0)}catch(v){return this.getLogger().error(new Error(`${h$1.getDateForLog()}: LocalStorage error: `),v),!1}return!0}getTimestamp(){return Date.now()}}class ChannelManager{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(S){this._publicIds=new Map,this._restClient=S.b24,this._getPublicListMethod=S.getPublicListMethod}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}async getPublicIds(S){const v=new Date,T={},O=[];for(const A of S){const k=this._publicIds.get(A);k&&k.end>v?T[k.userId]=k:O.push(A)}return O.length===0?Promise.resolve(T):new Promise(A=>{this._restClient.callMethod(this._getPublicListMethod,{users:O}).then(k=>{const C=k.getData().result;this.setPublicIds(Object.values(C));for(const $ of O){const x=this._publicIds.get($);x&&(T[x.userId]=x)}A(T)}).catch(k=>(this.getLogger().error(k),A({})))})}setPublicIds(S){S.forEach(v=>{const T=Number(v.user_id);this._publicIds.set(T,{userId:T,publicId:v.public_id,signature:v.signature,start:new Date(v.start),end:new Date(v.end)})})}}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=_;function _(S,v){for(var T=new Array(arguments.length-1),O=0,A=2,k=!0;A<arguments.length;)T[O++]=arguments[A++];return new Promise(function($,x){T[O]=function(D){if(k)if(k=!1,D)x(D);else{for(var q=new Array(arguments.length-1),M=0;M<q.length;)q[M++]=arguments[M];$.apply(null,q)}};try{S.apply(v||null,T)}catch(N){k&&(k=!1,x(N))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(_){var S=_;S.length=function(C){var $=C.length;if(!$)return 0;for(var x=0;--$%4>1&&C.charAt($)==="=";)++x;return Math.ceil(C.length*3)/4-x};for(var v=new Array(64),T=new Array(123),O=0;O<64;)T[v[O]=O<26?O+65:O<52?O+71:O<62?O-4:O-59|43]=O++;S.encode=function(C,$,x){for(var N=null,D=[],q=0,M=0,U;$<x;){var z=C[$++];switch(M){case 0:D[q++]=v[z>>2],U=(z&3)<<4,M=1;break;case 1:D[q++]=v[U|z>>4],U=(z&15)<<2,M=2;break;case 2:D[q++]=v[U|z>>6],D[q++]=v[z&63],M=0;break}q>8191&&((N||(N=[])).push(String.fromCharCode.apply(String,D)),q=0)}return M&&(D[q++]=v[U],D[q++]=61,M===1&&(D[q++]=61)),N?(q&&N.push(String.fromCharCode.apply(String,D.slice(0,q))),N.join("")):String.fromCharCode.apply(String,D.slice(0,q))};var A="invalid encoding";S.decode=function(C,$,x){for(var N=x,D=0,q,M=0;M<C.length;){var U=C.charCodeAt(M++);if(U===61&&D>1)break;if((U=T[U])===void 0)throw Error(A);switch(D){case 0:q=U,D=1;break;case 1:$[x++]=q<<2|(U&48)>>4,q=U,D=2;break;case 2:$[x++]=(q&15)<<4|(U&60)>>2,q=U,D=3;break;case 3:$[x++]=(q&3)<<6|U,D=0;break}}if(D===1)throw Error(A);return x-N},S.test=function(C){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(C)}}(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=_;function _(){this._listeners={}}return _.prototype.on=function(v,T,O){return(this._listeners[v]||(this._listeners[v]=[])).push({fn:T,ctx:O||this}),this},_.prototype.off=function(v,T){if(v===void 0)this._listeners={};else if(T===void 0)this._listeners[v]=[];else for(var O=this._listeners[v],A=0;A<O.length;)O[A].fn===T?O.splice(A,1):++A;return this},_.prototype.emit=function(v){var T=this._listeners[v];if(T){for(var O=[],A=1;A<arguments.length;)O.push(arguments[A++]);for(A=0;A<T.length;)T[A].fn.apply(T[A++].ctx,O)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=_(_);function _(A){return typeof Float32Array<"u"?function(){var k=new Float32Array([-0]),C=new Uint8Array(k.buffer),$=C[3]===128;function x(M,U,z){k[0]=M,U[z]=C[0],U[z+1]=C[1],U[z+2]=C[2],U[z+3]=C[3]}function N(M,U,z){k[0]=M,U[z]=C[3],U[z+1]=C[2],U[z+2]=C[1],U[z+3]=C[0]}A.writeFloatLE=$?x:N,A.writeFloatBE=$?N:x;function D(M,U){return C[0]=M[U],C[1]=M[U+1],C[2]=M[U+2],C[3]=M[U+3],k[0]}function q(M,U){return C[3]=M[U],C[2]=M[U+1],C[1]=M[U+2],C[0]=M[U+3],k[0]}A.readFloatLE=$?D:q,A.readFloatBE=$?q:D}():function(){function k($,x,N,D){var q=x<0?1:0;if(q&&(x=-x),x===0)$(1/x>0?0:2147483648,N,D);else if(isNaN(x))$(2143289344,N,D);else if(x>34028234663852886e22)$((q<<31|2139095040)>>>0,N,D);else if(x<11754943508222875e-54)$((q<<31|Math.round(x/1401298464324817e-60))>>>0,N,D);else{var M=Math.floor(Math.log(x)/Math.LN2),U=Math.round(x*Math.pow(2,-M)*8388608)&8388607;$((q<<31|M+127<<23|U)>>>0,N,D)}}A.writeFloatLE=k.bind(null,S),A.writeFloatBE=k.bind(null,v);function C($,x,N){var D=$(x,N),q=(D>>31)*2+1,M=D>>>23&255,U=D&8388607;return M===255?U?NaN:q*(1/0):M===0?q*1401298464324817e-60*U:q*Math.pow(2,M-150)*(U+8388608)}A.readFloatLE=C.bind(null,T),A.readFloatBE=C.bind(null,O)}(),typeof Float64Array<"u"?function(){var k=new Float64Array([-0]),C=new Uint8Array(k.buffer),$=C[7]===128;function x(M,U,z){k[0]=M,U[z]=C[0],U[z+1]=C[1],U[z+2]=C[2],U[z+3]=C[3],U[z+4]=C[4],U[z+5]=C[5],U[z+6]=C[6],U[z+7]=C[7]}function N(M,U,z){k[0]=M,U[z]=C[7],U[z+1]=C[6],U[z+2]=C[5],U[z+3]=C[4],U[z+4]=C[3],U[z+5]=C[2],U[z+6]=C[1],U[z+7]=C[0]}A.writeDoubleLE=$?x:N,A.writeDoubleBE=$?N:x;function D(M,U){return C[0]=M[U],C[1]=M[U+1],C[2]=M[U+2],C[3]=M[U+3],C[4]=M[U+4],C[5]=M[U+5],C[6]=M[U+6],C[7]=M[U+7],k[0]}function q(M,U){return C[7]=M[U],C[6]=M[U+1],C[5]=M[U+2],C[4]=M[U+3],C[3]=M[U+4],C[2]=M[U+5],C[1]=M[U+6],C[0]=M[U+7],k[0]}A.readDoubleLE=$?D:q,A.readDoubleBE=$?q:D}():function(){function k($,x,N,D,q,M){var U=D<0?1:0;if(U&&(D=-D),D===0)$(0,q,M+x),$(1/D>0?0:2147483648,q,M+N);else if(isNaN(D))$(0,q,M+x),$(2146959360,q,M+N);else if(D>17976931348623157e292)$(0,q,M+x),$((U<<31|2146435072)>>>0,q,M+N);else{var z;if(D<22250738585072014e-324)z=D/5e-324,$(z>>>0,q,M+x),$((U<<31|z/4294967296)>>>0,q,M+N);else{var W=Math.floor(Math.log(D)/Math.LN2);W===1024&&(W=1023),z=D*Math.pow(2,-W),$(z*4503599627370496>>>0,q,M+x),$((U<<31|W+1023<<20|z*1048576&1048575)>>>0,q,M+N)}}}A.writeDoubleLE=k.bind(null,S,0,4),A.writeDoubleBE=k.bind(null,v,4,0);function C($,x,N,D,q){var M=$(D,q+x),U=$(D,q+N),z=(U>>31)*2+1,W=U>>>20&2047,j=4294967296*(U&1048575)+M;return W===2047?j?NaN:z*(1/0):W===0?z*5e-324*j:z*Math.pow(2,W-1075)*(j+4503599627370496)}A.readDoubleLE=C.bind(null,T,0,4),A.readDoubleBE=C.bind(null,O,4,0)}(),A}function S(A,k,C){k[C]=A&255,k[C+1]=A>>>8&255,k[C+2]=A>>>16&255,k[C+3]=A>>>24}function v(A,k,C){k[C]=A>>>24,k[C+1]=A>>>16&255,k[C+2]=A>>>8&255,k[C+3]=A&255}function T(A,k){return(A[k]|A[k+1]<<8|A[k+2]<<16|A[k+3]<<24)>>>0}function O(A,k){return(A[k]<<24|A[k+1]<<16|A[k+2]<<8|A[k+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(_){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(_){var S=_;S.length=function(T){for(var O=0,A=0,k=0;k<T.length;++k)A=T.charCodeAt(k),A<128?O+=1:A<2048?O+=2:(A&64512)===55296&&(T.charCodeAt(k+1)&64512)===56320?(++k,O+=4):O+=3;return O},S.read=function(T,O,A){var k=A-O;if(k<1)return"";for(var C=null,$=[],x=0,N;O<A;)N=T[O++],N<128?$[x++]=N:N>191&&N<224?$[x++]=(N&31)<<6|T[O++]&63:N>239&&N<365?(N=((N&7)<<18|(T[O++]&63)<<12|(T[O++]&63)<<6|T[O++]&63)-65536,$[x++]=55296+(N>>10),$[x++]=56320+(N&1023)):$[x++]=(N&15)<<12|(T[O++]&63)<<6|T[O++]&63,x>8191&&((C||(C=[])).push(String.fromCharCode.apply(String,$)),x=0);return C?(x&&C.push(String.fromCharCode.apply(String,$.slice(0,x))),C.join("")):String.fromCharCode.apply(String,$.slice(0,x))},S.write=function(T,O,A){for(var k=A,C,$,x=0;x<T.length;++x)C=T.charCodeAt(x),C<128?O[A++]=C:C<2048?(O[A++]=C>>6|192,O[A++]=C&63|128):(C&64512)===55296&&(($=T.charCodeAt(x+1))&64512)===56320?(C=65536+((C&1023)<<10)+($&1023),++x,O[A++]=C>>18|240,O[A++]=C>>12&63|128,O[A++]=C>>6&63|128,O[A++]=C&63|128):(O[A++]=C>>12|224,O[A++]=C>>6&63|128,O[A++]=C&63|128);return A-k}}(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=_;function _(S,v,T){var O=T||8192,A=O>>>1,k=null,C=O;return function(x){if(x<1||x>A)return S(x);C+x>O&&(k=S(O),C=0);var N=v.call(k,C,C+=x);return C&7&&(C=(C|7)+1),N}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=S;var _=requireMinimal();function S(A,k){this.lo=A>>>0,this.hi=k>>>0}var v=S.zero=new S(0,0);v.toNumber=function(){return 0},v.zzEncode=v.zzDecode=function(){return this},v.length=function(){return 1};var T=S.zeroHash="\0\0\0\0\0\0\0\0";S.fromNumber=function(k){if(k===0)return v;var C=k<0;C&&(k=-k);var $=k>>>0,x=(k-$)/4294967296>>>0;return C&&(x=~x>>>0,$=~$>>>0,++$>4294967295&&($=0,++x>4294967295&&(x=0))),new S($,x)},S.from=function(k){if(typeof k=="number")return S.fromNumber(k);if(_.isString(k))if(_.Long)k=_.Long.fromString(k);else return S.fromNumber(parseInt(k,10));return k.low||k.high?new S(k.low>>>0,k.high>>>0):v},S.prototype.toNumber=function(k){if(!k&&this.hi>>>31){var C=~this.lo+1>>>0,$=~this.hi>>>0;return C||($=$+1>>>0),-(C+$*4294967296)}return this.lo+this.hi*4294967296},S.prototype.toLong=function(k){return _.Long?new _.Long(this.lo|0,this.hi|0,!!k):{low:this.lo|0,high:this.hi|0,unsigned:!!k}};var O=String.prototype.charCodeAt;return S.fromHash=function(k){return k===T?v:new S((O.call(k,0)|O.call(k,1)<<8|O.call(k,2)<<16|O.call(k,3)<<24)>>>0,(O.call(k,4)|O.call(k,5)<<8|O.call(k,6)<<16|O.call(k,7)<<24)>>>0)},S.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)},S.prototype.zzEncode=function(){var k=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^k)>>>0,this.lo=(this.lo<<1^k)>>>0,this},S.prototype.zzDecode=function(){var k=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^k)>>>0,this.hi=(this.hi>>>1^k)>>>0,this},S.prototype.length=function(){var k=this.lo,C=(this.lo>>>28|this.hi<<4)>>>0,$=this.hi>>>24;return $===0?C===0?k<16384?k<128?1:2:k<2097152?3:4:C<16384?C<128?5:6:C<2097152?7:8:$<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(_){var S=_;S.asPromise=requireAspromise(),S.base64=requireBase64(),S.EventEmitter=requireEventemitter(),S.float=requireFloat(),S.inquire=requireInquire(),S.utf8=requireUtf8(),S.pool=requirePool(),S.LongBits=requireLongbits(),S.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),S.global=S.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||minimal,S.emptyArray=Object.freeze?Object.freeze([]):[],S.emptyObject=Object.freeze?Object.freeze({}):{},S.isInteger=Number.isInteger||function(A){return typeof A=="number"&&isFinite(A)&&Math.floor(A)===A},S.isString=function(A){return typeof A=="string"||A instanceof String},S.isObject=function(A){return A&&typeof A=="object"},S.isset=S.isSet=function(A,k){var C=A[k];return C!=null&&A.hasOwnProperty(k)?typeof C!="object"||(Array.isArray(C)?C.length:Object.keys(C).length)>0:!1},S.Buffer=function(){try{var O=S.inquire("buffer").Buffer;return O.prototype.utf8Write?O:null}catch{return null}}(),S._Buffer_from=null,S._Buffer_allocUnsafe=null,S.newBuffer=function(A){return typeof A=="number"?S.Buffer?S._Buffer_allocUnsafe(A):new S.Array(A):S.Buffer?S._Buffer_from(A):typeof Uint8Array>"u"?A:new Uint8Array(A)},S.Array=typeof Uint8Array<"u"?Uint8Array:Array,S.Long=S.global.dcodeIO&&S.global.dcodeIO.Long||S.global.Long||S.inquire("long"),S.key2Re=/^true|false|0|1$/,S.key32Re=/^-?(?:0|[1-9][0-9]*)$/,S.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,S.longToHash=function(A){return A?S.LongBits.from(A).toHash():S.LongBits.zeroHash},S.longFromHash=function(A,k){var C=S.LongBits.fromHash(A);return S.Long?S.Long.fromBits(C.lo,C.hi,k):C.toNumber(!!k)};function v(O,A,k){for(var C=Object.keys(A),$=0;$<C.length;++$)(O[C[$]]===void 0||!k)&&(O[C[$]]=A[C[$]]);return O}S.merge=v,S.lcFirst=function(A){return A.charAt(0).toLowerCase()+A.substring(1)};function T(O){function A(k,C){if(!(this instanceof A))return new A(k,C);Object.defineProperty(this,"message",{get:function(){return k}}),Error.captureStackTrace?Error.captureStackTrace(this,A):Object.defineProperty(this,"stack",{value:new Error().stack||""}),C&&v(this,C)}return A.prototype=Object.create(Error.prototype,{constructor:{value:A,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return O},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),A}S.newError=T,S.ProtocolError=T("ProtocolError"),S.oneOfGetter=function(A){for(var k={},C=0;C<A.length;++C)k[A[C]]=1;return function(){for(var $=Object.keys(this),x=$.length-1;x>-1;--x)if(k[$[x]]===1&&this[$[x]]!==void 0&&this[$[x]]!==null)return $[x]}},S.oneOfSetter=function(A){return function(k){for(var C=0;C<A.length;++C)A[C]!==k&&delete this[A[C]]}},S.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},S._configure=function(){var O=S.Buffer;if(!O){S._Buffer_from=S._Buffer_allocUnsafe=null;return}S._Buffer_from=O.from!==Uint8Array.from&&O.from||function(k,C){return new O(k,C)},S._Buffer_allocUnsafe=O.allocUnsafe||function(k){return new O(k)}}}(minimal)),minimal}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=$;var _=requireMinimal(),S,v=_.LongBits,T=_.base64,O=_.utf8;function A(W,j,B){this.fn=W,this.len=j,this.next=void 0,this.val=B}function k(){}function C(W){this.head=W.head,this.tail=W.tail,this.len=W.len,this.next=W.states}function $(){this.len=0,this.head=new A(k,0,0),this.tail=this.head,this.states=null}var x=function(){return _.Buffer?function(){return($.create=function(){return new S})()}:function(){return new $}};$.create=x(),$.alloc=function(j){return new _.Array(j)},_.Array!==Array&&($.alloc=_.pool($.alloc,_.Array.prototype.subarray)),$.prototype._push=function(j,B,Z){return this.tail=this.tail.next=new A(j,B,Z),this.len+=B,this};function N(W,j,B){j[B]=W&255}function D(W,j,B){for(;W>127;)j[B++]=W&127|128,W>>>=7;j[B]=W}function q(W,j){this.len=W,this.next=void 0,this.val=j}q.prototype=Object.create(A.prototype),q.prototype.fn=D,$.prototype.uint32=function(j){return this.len+=(this.tail=this.tail.next=new q((j=j>>>0)<128?1:j<16384?2:j<2097152?3:j<268435456?4:5,j)).len,this},$.prototype.int32=function(j){return j<0?this._push(M,10,v.fromNumber(j)):this.uint32(j)},$.prototype.sint32=function(j){return this.uint32((j<<1^j>>31)>>>0)};function M(W,j,B){for(;W.hi;)j[B++]=W.lo&127|128,W.lo=(W.lo>>>7|W.hi<<25)>>>0,W.hi>>>=7;for(;W.lo>127;)j[B++]=W.lo&127|128,W.lo=W.lo>>>7;j[B++]=W.lo}$.prototype.uint64=function(j){var B=v.from(j);return this._push(M,B.length(),B)},$.prototype.int64=$.prototype.uint64,$.prototype.sint64=function(j){var B=v.from(j).zzEncode();return this._push(M,B.length(),B)},$.prototype.bool=function(j){return this._push(N,1,j?1:0)};function U(W,j,B){j[B]=W&255,j[B+1]=W>>>8&255,j[B+2]=W>>>16&255,j[B+3]=W>>>24}$.prototype.fixed32=function(j){return this._push(U,4,j>>>0)},$.prototype.sfixed32=$.prototype.fixed32,$.prototype.fixed64=function(j){var B=v.from(j);return this._push(U,4,B.lo)._push(U,4,B.hi)},$.prototype.sfixed64=$.prototype.fixed64,$.prototype.float=function(j){return this._push(_.float.writeFloatLE,4,j)},$.prototype.double=function(j){return this._push(_.float.writeDoubleLE,8,j)};var z=_.Array.prototype.set?function(j,B,Z){B.set(j,Z)}:function(j,B,Z){for(var X=0;X<j.length;++X)B[Z+X]=j[X]};return $.prototype.bytes=function(j){var B=j.length>>>0;if(!B)return this._push(N,1,0);if(_.isString(j)){var Z=$.alloc(B=T.length(j));T.decode(j,Z,0),j=Z}return this.uint32(B)._push(z,B,j)},$.prototype.string=function(j){var B=O.length(j);return B?this.uint32(B)._push(O.write,B,j):this._push(N,1,0)},$.prototype.fork=function(){return this.states=new C(this),this.head=this.tail=new A(k,0,0),this.len=0,this},$.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 A(k,0,0),this.len=0),this},$.prototype.ldelim=function(){var j=this.head,B=this.tail,Z=this.len;return this.reset().uint32(Z),Z&&(this.tail.next=j.next,this.tail=B,this.len+=Z),this},$.prototype.finish=function(){for(var j=this.head.next,B=this.constructor.alloc(this.len),Z=0;j;)j.fn(j.val,B,Z),Z+=j.len,j=j.next;return B},$._configure=function(W){S=W,$.create=x(),S._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=v;var _=requireWriter();(v.prototype=Object.create(_.prototype)).constructor=v;var S=requireMinimal();function v(){_.call(this)}v._configure=function(){v.alloc=S._Buffer_allocUnsafe,v.writeBytesBuffer=S.Buffer&&S.Buffer.prototype instanceof Uint8Array&&S.Buffer.prototype.set.name==="set"?function(A,k,C){k.set(A,C)}:function(A,k,C){if(A.copy)A.copy(k,C,0,A.length);else for(var $=0;$<A.length;)k[C++]=A[$++]}},v.prototype.bytes=function(A){S.isString(A)&&(A=S._Buffer_from(A,"base64"));var k=A.length>>>0;return this.uint32(k),k&&this._push(v.writeBytesBuffer,k,A),this};function T(O,A,k){O.length<40?S.utf8.write(O,A,k):A.utf8Write?A.utf8Write(O,k):A.write(O,k)}return v.prototype.string=function(A){var k=S.Buffer.byteLength(A);return this.uint32(k),k&&this._push(T,k,A),this},v._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=A;var _=requireMinimal(),S,v=_.LongBits,T=_.utf8;function O(D,q){return RangeError("index out of range: "+D.pos+" + "+(q||1)+" > "+D.len)}function A(D){this.buf=D,this.pos=0,this.len=D.length}var k=typeof Uint8Array<"u"?function(q){if(q instanceof Uint8Array||Array.isArray(q))return new A(q);throw Error("illegal buffer")}:function(q){if(Array.isArray(q))return new A(q);throw Error("illegal buffer")},C=function(){return _.Buffer?function(M){return(A.create=function(z){return _.Buffer.isBuffer(z)?new S(z):k(z)})(M)}:k};A.create=C(),A.prototype._slice=_.Array.prototype.subarray||_.Array.prototype.slice,A.prototype.uint32=function(){var q=4294967295;return function(){if(q=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(q=(q|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(q=(q|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(q=(q|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(q=(q|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return q;if((this.pos+=5)>this.len)throw this.pos=this.len,O(this,10);return q}}(),A.prototype.int32=function(){return this.uint32()|0},A.prototype.sint32=function(){var q=this.uint32();return q>>>1^-(q&1)|0};function $(){var D=new v(0,0),q=0;if(this.len-this.pos>4){for(;q<4;++q)if(D.lo=(D.lo|(this.buf[this.pos]&127)<<q*7)>>>0,this.buf[this.pos++]<128)return D;if(D.lo=(D.lo|(this.buf[this.pos]&127)<<28)>>>0,D.hi=(D.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return D;q=0}else{for(;q<3;++q){if(this.pos>=this.len)throw O(this);if(D.lo=(D.lo|(this.buf[this.pos]&127)<<q*7)>>>0,this.buf[this.pos++]<128)return D}return D.lo=(D.lo|(this.buf[this.pos++]&127)<<q*7)>>>0,D}if(this.len-this.pos>4){for(;q<5;++q)if(D.hi=(D.hi|(this.buf[this.pos]&127)<<q*7+3)>>>0,this.buf[this.pos++]<128)return D}else for(;q<5;++q){if(this.pos>=this.len)throw O(this);if(D.hi=(D.hi|(this.buf[this.pos]&127)<<q*7+3)>>>0,this.buf[this.pos++]<128)return D}throw Error("invalid varint encoding")}A.prototype.bool=function(){return this.uint32()!==0};function x(D,q){return(D[q-4]|D[q-3]<<8|D[q-2]<<16|D[q-1]<<24)>>>0}A.prototype.fixed32=function(){if(this.pos+4>this.len)throw O(this,4);return x(this.buf,this.pos+=4)},A.prototype.sfixed32=function(){if(this.pos+4>this.len)throw O(this,4);return x(this.buf,this.pos+=4)|0};function N(){if(this.pos+8>this.len)throw O(this,8);return new v(x(this.buf,this.pos+=4),x(this.buf,this.pos+=4))}return A.prototype.float=function(){if(this.pos+4>this.len)throw O(this,4);var q=_.float.readFloatLE(this.buf,this.pos);return this.pos+=4,q},A.prototype.double=function(){if(this.pos+8>this.len)throw O(this,4);var q=_.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,q},A.prototype.bytes=function(){var q=this.uint32(),M=this.pos,U=this.pos+q;if(U>this.len)throw O(this,q);if(this.pos+=q,Array.isArray(this.buf))return this.buf.slice(M,U);if(M===U){var z=_.Buffer;return z?z.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,M,U)},A.prototype.string=function(){var q=this.bytes();return T.read(q,0,q.length)},A.prototype.skip=function(q){if(typeof q=="number"){if(this.pos+q>this.len)throw O(this,q);this.pos+=q}else do if(this.pos>=this.len)throw O(this);while(this.buf[this.pos++]&128);return this},A.prototype.skipType=function(D){switch(D){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(D=this.uint32()&7)!==4;)this.skipType(D);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+D+" at offset "+this.pos)}return this},A._configure=function(D){S=D,A.create=C(),S._configure();var q=_.Long?"toLong":"toNumber";_.merge(A.prototype,{int64:function(){return $.call(this)[q](!1)},uint64:function(){return $.call(this)[q](!0)},sint64:function(){return $.call(this).zzDecode()[q](!1)},fixed64:function(){return N.call(this)[q](!0)},sfixed64:function(){return N.call(this)[q](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=v;var _=requireReader();(v.prototype=Object.create(_.prototype)).constructor=v;var S=requireMinimal();function v(T){_.call(this,T)}return v._configure=function(){S.Buffer&&(v.prototype._slice=S.Buffer.prototype.slice)},v.prototype.string=function(){var O=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+O,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+O,this.len))},v._configure(),reader_buffer}var rpc={},service$1,hasRequiredService$1;function requireService$1(){if(hasRequiredService$1)return service$1;hasRequiredService$1=1,service$1=S;var _=requireMinimal();(S.prototype=Object.create(_.EventEmitter.prototype)).constructor=S;function S(v,T,O){if(typeof v!="function")throw TypeError("rpcImpl must be a function");_.EventEmitter.call(this),this.rpcImpl=v,this.requestDelimited=!!T,this.responseDelimited=!!O}return S.prototype.rpcCall=function v(T,O,A,k,C){if(!k)throw TypeError("request must be specified");var $=this;if(!C)return _.asPromise(v,$,T,O,A,k);if(!$.rpcImpl){setTimeout(function(){C(Error("already ended"))},0);return}try{return $.rpcImpl(T,O[$.requestDelimited?"encodeDelimited":"encode"](k).finish(),function(N,D){if(N)return $.emit("error",N,T),C(N);if(D===null){$.end(!0);return}if(!(D instanceof A))try{D=A[$.responseDelimited?"decodeDelimited":"decode"](D)}catch(q){return $.emit("error",q,T),C(q)}return $.emit("data",D,T),C(null,D)})}catch(x){$.emit("error",x,T),setTimeout(function(){C(x)},0);return}},S.prototype.end=function(T){return this.rpcImpl&&(T||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service$1}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(_){var S=_;S.Service=requireService$1()}(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(_){var S=_;S.build="minimal",S.Writer=requireWriter(),S.BufferWriter=requireWriter_buffer(),S.Reader=requireReader(),S.BufferReader=requireReader_buffer(),S.util=requireMinimal(),S.rpc=requireRpc(),S.roots=requireRoots(),S.configure=v;function v(){S.util._configure(),S.Writer._configure(S.BufferWriter),S.Reader._configure(S.BufferReader)}v()}(indexMinimal)),indexMinimal}var util={exports:{}},codegen_1,hasRequiredCodegen;function requireCodegen(){if(hasRequiredCodegen)return codegen_1;hasRequiredCodegen=1,codegen_1=_;function _(S,v){typeof S=="string"&&(v=S,S=void 0);var T=[];function O(k){if(typeof k!="string"){var C=A();if(_.verbose&&console.log("codegen: "+C),C="return "+C,k){for(var $=Object.keys(k),x=new Array($.length+1),N=new Array($.length),D=0;D<$.length;)x[D]=$[D],N[D]=k[$[D++]];return x[D]=C,Function.apply(null,x).apply(null,N)}return Function(C)()}for(var q=new Array(arguments.length-1),M=0;M<q.length;)q[M]=arguments[++M];if(M=0,k=k.replace(/%([%dfijs])/g,function(z,W){var j=q[M++];switch(W){case"d":case"f":return String(Number(j));case"i":return String(Math.floor(j));case"j":return JSON.stringify(j);case"s":return String(j)}return"%"}),M!==q.length)throw Error("parameter count mismatch");return T.push(k),O}function A(k){return"function "+(k||v||"")+"("+(S&&S.join(",")||"")+`){
10
- `+T.join(`
1
+ (function(q,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(q=typeof globalThis<"u"?globalThis:q||self,M(q.B24Js=q.B24Js||{}))})(this,function(q){"use strict";var M=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(M||{});const Ze=new Map;Ze.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"]),Ze.set("desktop",["%cDESKTOP","color: white; font-style: italic; background-color: #29619b; padding: 0 6px; border: 1px solid #29619b"]),Ze.set("log",["%cLOG","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]),Ze.set("info",["%cINFO","color: #fff; font-style: italic; background-color: #6b7f96; padding: 0 6px; border: 1px solid #6b7f96"]),Ze.set("warn",["%cWARNING","color: #f0a74f; font-style: italic; padding: 0 6px; border: 1px solid #f0a74f"]),Ze.set("error",["%cERROR","color: white; font-style: italic; background-color: #8a3232; padding: 0 6px; border: 1px solid #8a3232"]),Ze.set("trace",["%cTRACE","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]);class Pe{#e;#t={desktop:!0,log:!1,info:!1,warn:!1,error:!0,trace:!0};static build(e,t=!1){const n=new Pe(e);return t&&(n.enable("log"),n.enable("info"),n.enable("warn")),n}constructor(e){this.#e=e}#r(e){const t=[],n=[];if(Ze.has("title")){const i=Ze.get("title");i[0]&&(t.push(i[0].replace("#title#",this.#e)),n.push(i[1]||""))}if(Ze.has(e)){const i=Ze.get(e);i[0]&&(t.push(i[0]),n.push(i[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 Wi=(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))(Wi||{});const _l=Function.prototype.toString.call(Object);let El=class{getTag(e){return Object.prototype.toString.call(e)}isString(e){return e===""?!0:e?typeof e=="string"||e instanceof String:!1}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)===_l}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!Number.isNaN(e)&&typeof e=="number"}isInteger(e){return this.isNumber(e)&&e%1===0}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 this.isObjectLike(e)&&this.getTag(e)==="[object 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 e instanceof FormData}clone(e,t=!0){let n,i,s;if(e===null)return null;if(this.isDomNode(e))n=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(n=[],i=0,s=e.length;i<s;i++)typeof e[i]=="object"&&t?n[i]=this.clone(e[i],t):n[i]=e[i];else{n={},e.constructor&&(this.isDate(e)?n=new Date(e):n=new e.constructor);for(i in e)e.hasOwnProperty(i)&&(typeof e[i]=="object"&&t?n[i]=this.clone(e[i],t):n[i]=e[i])}else n=e;return n}};const x=new El;class vt extends Error{}class kl extends vt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ol extends vt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Tl extends vt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Pt extends vt{}class qi extends vt{constructor(e){super(`Invalid unit ${e}`)}}class Te extends vt{}class ct extends vt{constructor(){super("Zone is an abstract class")}}const L="numeric",Ye="short",De="long",vr={year:L,month:L,day:L},Vi={year:L,month:Ye,day:L},Al={year:L,month:Ye,day:L,weekday:Ye},Hi={year:L,month:De,day:L},zi={year:L,month:De,day:L,weekday:De},Ji={hour:L,minute:L},Gi={hour:L,minute:L,second:L},Zi={hour:L,minute:L,second:L,timeZoneName:Ye},Yi={hour:L,minute:L,second:L,timeZoneName:De},Ki={hour:L,minute:L,hourCycle:"h23"},Qi={hour:L,minute:L,second:L,hourCycle:"h23"},Xi={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:Ye},es={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:De},ts={year:L,month:L,day:L,hour:L,minute:L},rs={year:L,month:L,day:L,hour:L,minute:L,second:L},ns={year:L,month:Ye,day:L,hour:L,minute:L},is={year:L,month:Ye,day:L,hour:L,minute:L,second:L},Il={year:L,month:Ye,day:L,weekday:Ye,hour:L,minute:L},ss={year:L,month:De,day:L,hour:L,minute:L,timeZoneName:Ye},os={year:L,month:De,day:L,hour:L,minute:L,second:L,timeZoneName:Ye},as={year:L,month:De,day:L,weekday:De,hour:L,minute:L,timeZoneName:De},ls={year:L,month:De,day:L,weekday:De,hour:L,minute:L,second:L,timeZoneName:De};class er{get type(){throw new ct}get name(){throw new ct}get ianaName(){return this.name}get isUniversal(){throw new ct}offsetName(e,t){throw new ct}formatOffset(e,t){throw new ct}offset(e){throw new ct}equals(e){throw new ct}get isValid(){throw new ct}}let rn=null;class Sr extends er{static get instance(){return rn===null&&(rn=new Sr),rn}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Fs(e,t,n)}formatOffset(e,t){return ir(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let _r={};function Cl(r){return _r[r]||(_r[r]=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"})),_r[r]}const Rl={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Nl(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,s,o,l,a,u,c]=n;return[o,i,s,l,a,u,c]}function Pl(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:s,value:o}=t[i],l=Rl[s];s==="era"?n[l]=o:J(l)||(n[l]=parseInt(o,10))}return n}let Er={};class ot extends er{static create(e){return Er[e]||(Er[e]=new ot(e)),Er[e]}static resetCache(){Er={},_r={}}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=ot.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Fs(e,t,n,this.name)}formatOffset(e,t){return ir(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const n=Cl(this.name);let[i,s,o,l,a,u,c]=n.formatToParts?Pl(n,t):Nl(n,t);l==="BC"&&(i=-Math.abs(i)+1);const f=Ir({year:i,month:s,day:o,hour:a===24?0:a,minute:u,second:c,millisecond:0});let d=+t;const g=d%1e3;return d-=g>=0?g:1e3+g,(f-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let cs={};function Fl(r,e={}){const t=JSON.stringify([r,e]);let n=cs[t];return n||(n=new Intl.ListFormat(r,e),cs[t]=n),n}let nn={};function sn(r,e={}){const t=JSON.stringify([r,e]);let n=nn[t];return n||(n=new Intl.DateTimeFormat(r,e),nn[t]=n),n}let on={};function Ml(r,e={}){const t=JSON.stringify([r,e]);let n=on[t];return n||(n=new Intl.NumberFormat(r,e),on[t]=n),n}let an={};function Ll(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let s=an[i];return s||(s=new Intl.RelativeTimeFormat(r,e),an[i]=s),s}let tr=null;function Dl(){return tr||(tr=new Intl.DateTimeFormat().resolvedOptions().locale,tr)}let us={};function xl(r){let e=us[r];if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,us[r]=e}return e}function jl(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,i;try{n=sn(r).resolvedOptions(),i=r}catch{const a=r.substring(0,t);n=sn(a).resolvedOptions(),i=a}const{numberingSystem:s,calendar:o}=n;return[i,s,o]}}function Ul(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function Bl(r){const e=[];for(let t=1;t<=12;t++){const n=z.utc(2009,t,1);e.push(r(n))}return e}function $l(r){const e=[];for(let t=1;t<=7;t++){const n=z.utc(2016,11,13+t);e.push(r(n))}return e}function kr(r,e,t,n){const i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function Wl(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}class ql{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:i,floor:s,...o}=n;if(!t||Object.keys(o).length>0){const l={useGrouping:!1,...n};n.padTo>0&&(l.minimumIntegerDigits=n.padTo),this.inf=Ml(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):gn(e,3);return ve(t,this.padTo)}}}class Vl{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let i;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&&ot.create(l).valid?(i=l,this.dt=e):(i="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,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=sn(t,s)}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 Hl{constructor(e,t,n){this.opts={style:"long",...n},!t&&Cs()&&(this.rtf=Ll(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):pc(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const zl={firstDay:1,minimalDays:4,weekend:[6,7]};class le{static fromOpts(e){return le.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,i,s=!1){const o=e||ye.defaultLocale,l=o||(s?"en-US":Dl()),a=t||ye.defaultNumberingSystem,u=n||ye.defaultOutputCalendar,c=dn(i)||ye.defaultWeekSettings;return new le(l,a,u,c,o)}static resetCache(){tr=null,nn={},on={},an={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:i}={}){return le.create(e,t,n,i)}constructor(e,t,n,i,s){const[o,l,a]=jl(e);this.locale=o,this.numberingSystem=t||l||null,this.outputCalendar=n||a||null,this.weekSettings=i,this.intl=Ul(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Wl(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:le.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,dn(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 kr(this,e,Ds,()=>{const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=Bl(s=>this.extract(s,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return kr(this,e,Us,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=$l(s=>this.extract(s,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return kr(this,void 0,()=>Bs,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[z.utc(2016,11,13,9),z.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return kr(this,e,$s,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[z.utc(-40,1,1),z.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const i=this.dtFormatter(e,t),s=i.formatToParts(),o=s.find(l=>l.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new ql(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Vl(e,this.intl,t)}relFormatter(e={}){return new Hl(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Fl(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Rs()?xl(this.locale):zl}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 ln=null;class Fe extends er{static get utcInstance(){return ln===null&&(ln=new Fe(0)),ln}static instance(e){return e===0?Fe.utcInstance:new Fe(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Fe(Cr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ir(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ir(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return ir(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 Jl extends er{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 ut(r,e){if(J(r)||r===null)return e;if(r instanceof er)return r;if(Xl(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Sr.instance:t==="utc"||t==="gmt"?Fe.utcInstance:Fe.parseSpecifier(t)||ot.create(r)}else return ft(r)?Fe.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new Jl(r)}const cn={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"},fs={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]},Gl=cn.hanidec.replace(/[\[|\]]/g,"").split("");function Zl(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(cn.hanidec)!==-1)e+=Gl.indexOf(r[t]);else for(const i in fs){const[s,o]=fs[i];n>=s&&n<=o&&(e+=n-s)}}return parseInt(e,10)}else return e}let Ft={};function Yl(){Ft={}}function Ke({numberingSystem:r},e=""){const t=r||"latn";return Ft[t]||(Ft[t]={}),Ft[t][e]||(Ft[t][e]=new RegExp(`${cn[t]}${e}`)),Ft[t][e]}let hs=()=>Date.now(),ds="system",ps=null,gs=null,ms=null,ys=60,ws,bs=null;class ye{static get now(){return hs}static set now(e){hs=e}static set defaultZone(e){ds=e}static get defaultZone(){return ut(ds,Sr.instance)}static get defaultLocale(){return ps}static set defaultLocale(e){ps=e}static get defaultNumberingSystem(){return gs}static set defaultNumberingSystem(e){gs=e}static get defaultOutputCalendar(){return ms}static set defaultOutputCalendar(e){ms=e}static get defaultWeekSettings(){return bs}static set defaultWeekSettings(e){bs=dn(e)}static get twoDigitCutoffYear(){return ys}static set twoDigitCutoffYear(e){ys=e%100}static get throwOnInvalid(){return ws}static set throwOnInvalid(e){ws=e}static resetCaches(){le.resetCache(),ot.resetCache(),z.resetCache(),Yl()}}class Qe{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const vs=[0,31,59,90,120,151,181,212,243,273,304,334],Ss=[0,31,60,91,121,152,182,213,244,274,305,335];function qe(r,e){return new Qe("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function un(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return i===0?7:i}function _s(r,e,t){return t+(rr(r)?Ss:vs)[e-1]}function Es(r,e){const t=rr(r)?Ss:vs,n=t.findIndex(s=>s<e),i=e-t[n];return{month:n+1,day:i}}function fn(r,e){return(r-e+7)%7+1}function Or(r,e=4,t=1){const{year:n,month:i,day:s}=r,o=_s(n,i,s),l=fn(un(n,i,s),t);let a=Math.floor((o-l+14-e)/7),u;return a<1?(u=n-1,a=nr(u,e,t)):a>nr(n,e,t)?(u=n+1,a=1):u=n,{weekYear:u,weekNumber:a,weekday:l,...Nr(r)}}function ks(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:s}=r,o=fn(un(n,1,e),t),l=Lt(n);let a=i*7+s-o-7+e,u;a<1?(u=n-1,a+=Lt(u)):a>l?(u=n+1,a-=Lt(n)):u=n;const{month:c,day:h}=Es(u,a);return{year:u,month:c,day:h,...Nr(r)}}function hn(r){const{year:e,month:t,day:n}=r,i=_s(e,t,n);return{year:e,ordinal:i,...Nr(r)}}function Os(r){const{year:e,ordinal:t}=r,{month:n,day:i}=Es(e,t);return{year:e,month:n,day:i,...Nr(r)}}function Ts(r,e){if(!J(r.localWeekday)||!J(r.localWeekNumber)||!J(r.localWeekYear)){if(!J(r.weekday)||!J(r.weekNumber)||!J(r.weekYear))throw new Pt("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}}function Kl(r,e=4,t=1){const n=Tr(r.weekYear),i=Ve(r.weekNumber,1,nr(r.weekYear,e,t)),s=Ve(r.weekday,1,7);return n?i?s?!1:qe("weekday",r.weekday):qe("week",r.weekNumber):qe("weekYear",r.weekYear)}function Ql(r){const e=Tr(r.year),t=Ve(r.ordinal,1,Lt(r.year));return e?t?!1:qe("ordinal",r.ordinal):qe("year",r.year)}function As(r){const e=Tr(r.year),t=Ve(r.month,1,12),n=Ve(r.day,1,Ar(r.year,r.month));return e?t?n?!1:qe("day",r.day):qe("month",r.month):qe("year",r.year)}function Is(r){const{hour:e,minute:t,second:n,millisecond:i}=r,s=Ve(e,0,23)||e===24&&t===0&&n===0&&i===0,o=Ve(t,0,59),l=Ve(n,0,59),a=Ve(i,0,999);return s?o?l?a?!1:qe("millisecond",i):qe("second",n):qe("minute",t):qe("hour",e)}function J(r){return typeof r>"u"}function ft(r){return typeof r=="number"}function Tr(r){return typeof r=="number"&&r%1===0}function Xl(r){return typeof r=="string"}function ec(r){return Object.prototype.toString.call(r)==="[object Date]"}function Cs(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Rs(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function tc(r){return Array.isArray(r)?r:[r]}function Ns(r,e,t){if(r.length!==0)return r.reduce((n,i)=>{const s=[e(i),i];return n&&t(n[0],s[0])===n[0]?n:s},null)[1]}function rc(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function Mt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function dn(r){if(r==null)return null;if(typeof r!="object")throw new Te("Week settings must be an object");if(!Ve(r.firstDay,1,7)||!Ve(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Ve(e,1,7)))throw new Te("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Ve(r,e,t){return Tr(r)&&r>=e&&r<=t}function nc(r,e){return r-e*Math.floor(r/e)}function ve(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function ht(r){if(!(J(r)||r===null||r===""))return parseInt(r,10)}function St(r){if(!(J(r)||r===null||r===""))return parseFloat(r)}function pn(r){if(!(J(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function gn(r,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function rr(r){return r%4===0&&(r%100!==0||r%400===0)}function Lt(r){return rr(r)?366:365}function Ar(r,e){const t=nc(e-1,12)+1,n=r+(e-t)/12;return t===2?rr(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ir(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 Ps(r,e,t){return-fn(un(r,1,e),t)+e-1}function nr(r,e=4,t=1){const n=Ps(r,e,t),i=Ps(r+1,e,t);return(Lt(r)-n+i)/7}function mn(r){return r>99?r:r>ye.twoDigitCutoffYear?1900+r:2e3+r}function Fs(r,e,t,n=null){const i=new Date(r),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(s.timeZone=n);const o={timeZoneName:e,...s},l=new Intl.DateTimeFormat(t,o).formatToParts(i).find(a=>a.type.toLowerCase()==="timezonename");return l?l.value:null}function Cr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-n:n;return t*60+i}function Ms(r){const e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new Te(`Invalid unit value ${r}`);return e}function Rr(r,e){const t={};for(const n in r)if(Mt(r,n)){const i=r[n];if(i==null)continue;t[e(n)]=Ms(i)}return t}function ir(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),i=r>=0?"+":"-";switch(e){case"short":return`${i}${ve(t,2)}:${ve(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${ve(t,2)}${ve(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Nr(r){return rc(r,["hour","minute","second","millisecond"])}const ic=["January","February","March","April","May","June","July","August","September","October","November","December"],Ls=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sc=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ds(r){switch(r){case"narrow":return[...sc];case"short":return[...Ls];case"long":return[...ic];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 xs=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],js=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],oc=["M","T","W","T","F","S","S"];function Us(r){switch(r){case"narrow":return[...oc];case"short":return[...js];case"long":return[...xs];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Bs=["AM","PM"],ac=["Before Christ","Anno Domini"],lc=["BC","AD"],cc=["B","A"];function $s(r){switch(r){case"narrow":return[...cc];case"short":return[...lc];case"long":return[...ac];default:return null}}function uc(r){return Bs[r.hour<12?0:1]}function fc(r,e){return Us(e)[r.weekday-1]}function hc(r,e){return Ds(e)[r.month-1]}function dc(r,e){return $s(e)[r.year<0?0:1]}function pc(r,e,t="always",n=!1){const i={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."]},s=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&s){const h=r==="days";switch(e){case 1:return h?"tomorrow":`next ${i[r][0]}`;case-1:return h?"yesterday":`last ${i[r][0]}`;case 0:return h?"today":`this ${i[r][0]}`}}const o=Object.is(e,-0)||e<0,l=Math.abs(e),a=l===1,u=i[r],c=n?a?u[1]:u[2]||u[1]:a?i[r][0]:r;return o?`${l} ${c} ago`:`in ${l} ${c}`}function Ws(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const gc={D:vr,DD:Vi,DDD:Hi,DDDD:zi,t:Ji,tt:Gi,ttt:Zi,tttt:Yi,T:Ki,TT:Qi,TTT:Xi,TTTT:es,f:ts,ff:ns,fff:ss,ffff:as,F:rs,FF:is,FFF:os,FFFF:ls};class Ae{static create(e,t={}){return new Ae(e,t)}static parseFormat(e){let t=null,n="",i=!1;const s=[];for(let o=0;o<e.length;o++){const l=e.charAt(o);l==="'"?(n.length>0&&s.push({literal:i||/^\s+$/.test(n),val:n}),t=null,n="",i=!i):i||l===t?n+=l:(n.length>0&&s.push({literal:/^\s+$/.test(n),val:n}),n=l,t=l)}return n.length>0&&s.push({literal:i||/^\s+$/.test(n),val:n}),s}static macroTokenToFormatOpts(e){return gc[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){if(this.opts.forceSimple)return ve(e,t);const n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(d,g)=>this.loc.extract(e,d,g),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",l=()=>n?uc(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(d,g)=>n?hc(e,d):s(g?{month:d}:{month:d,day:"numeric"},"month"),u=(d,g)=>n?fc(e,d):s(g?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),c=d=>{const g=Ae.macroTokenToFormatOpts(d);return g?this.formatWithSystemDefault(e,g):d},h=d=>n?dc(e,d):s({era:d},"era"),f=d=>{switch(d){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 i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({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 i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({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 i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({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 i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("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(d)}};return Ws(Ae.parseFormat(t),f)}formatDurationFromString(e,t){const n=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=a=>u=>{const c=n(u);return c?this.num(a.get(c),u.length):u},s=Ae.parseFormat(t),o=s.reduce((a,{literal:u,val:c})=>u?a:a.concat(c),[]),l=e.shiftTo(...o.map(n).filter(a=>a));return Ws(s,i(l))}}const qs=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Dt(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function xt(...r){return e=>r.reduce(([t,n,i],s)=>{const[o,l,a]=s(e,i);return[{...t,...o},l||n,a]},[{},null,1]).slice(0,2)}function jt(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const i=t.exec(r);if(i)return n(i)}return[null,null]}function Vs(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=ht(e[t+i]);return[n,null,t+i]}}const Hs=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,mc=`(?:${Hs.source}?(?:\\[(${qs.source})\\])?)?`,yn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,zs=RegExp(`${yn.source}${mc}`),wn=RegExp(`(?:T${zs.source})?`),yc=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,wc=/(\d{4})-?W(\d\d)(?:-?(\d))?/,bc=/(\d{4})-?(\d{3})/,vc=Vs("weekYear","weekNumber","weekDay"),Sc=Vs("year","ordinal"),_c=/(\d{4})-(\d\d)-(\d\d)/,Js=RegExp(`${yn.source} ?(?:${Hs.source}|(${qs.source}))?`),Ec=RegExp(`(?: ${Js.source})?`);function Ut(r,e,t){const n=r[e];return J(n)?t:ht(n)}function kc(r,e){return[{year:Ut(r,e),month:Ut(r,e+1,1),day:Ut(r,e+2,1)},null,e+3]}function Bt(r,e){return[{hours:Ut(r,e,0),minutes:Ut(r,e+1,0),seconds:Ut(r,e+2,0),milliseconds:pn(r[e+3])},null,e+4]}function sr(r,e){const t=!r[e]&&!r[e+1],n=Cr(r[e+1],r[e+2]),i=t?null:Fe.instance(n);return[{},i,e+3]}function or(r,e){const t=r[e]?ot.create(r[e]):null;return[{},t,e+1]}const Oc=RegExp(`^T?${yn.source}$`),Tc=/^-?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 Ac(r){const[e,t,n,i,s,o,l,a,u]=r,c=e[0]==="-",h=a&&a[0]==="-",f=(d,g=!1)=>d!==void 0&&(g||d&&c)?-d:d;return[{years:f(St(t)),months:f(St(n)),weeks:f(St(i)),days:f(St(s)),hours:f(St(o)),minutes:f(St(l)),seconds:f(St(a),a==="-0"),milliseconds:f(pn(u),h)}]}const Ic={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function bn(r,e,t,n,i,s,o){const l={year:e.length===2?mn(ht(e)):ht(e),month:Ls.indexOf(t)+1,day:ht(n),hour:ht(i),minute:ht(s)};return o&&(l.second=ht(o)),r&&(l.weekday=r.length>3?xs.indexOf(r)+1:js.indexOf(r)+1),l}const Cc=/^(?:(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 Rc(r){const[,e,t,n,i,s,o,l,a,u,c,h]=r,f=bn(e,i,n,t,s,o,l);let d;return a?d=Ic[a]:u?d=0:d=Cr(c,h),[f,new Fe(d)]}function Nc(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const Pc=/^(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$/,Fc=/^(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$/,Mc=/^(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 Gs(r){const[,e,t,n,i,s,o,l]=r;return[bn(e,i,n,t,s,o,l),Fe.utcInstance]}function Lc(r){const[,e,t,n,i,s,o,l]=r;return[bn(e,l,t,n,i,s,o),Fe.utcInstance]}const Dc=Dt(yc,wn),xc=Dt(wc,wn),jc=Dt(bc,wn),Uc=Dt(zs),Zs=xt(kc,Bt,sr,or),Bc=xt(vc,Bt,sr,or),$c=xt(Sc,Bt,sr,or),Wc=xt(Bt,sr,or);function qc(r){return jt(r,[Dc,Zs],[xc,Bc],[jc,$c],[Uc,Wc])}function Vc(r){return jt(Nc(r),[Cc,Rc])}function Hc(r){return jt(r,[Pc,Gs],[Fc,Gs],[Mc,Lc])}function zc(r){return jt(r,[Tc,Ac])}const Jc=xt(Bt);function Gc(r){return jt(r,[Oc,Jc])}const Zc=Dt(_c,Ec),Yc=Dt(Js),Kc=xt(Bt,sr,or);function Qc(r){return jt(r,[Zc,Zs],[Yc,Kc])}const Ys="Invalid Duration",Ks={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Xc={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:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Ks},He=146097/400,$t=146097/4800,eu={years:{quarters:4,months:12,weeks:He/7,days:He,hours:He*24,minutes:He*24*60,seconds:He*24*60*60,milliseconds:He*24*60*60*1e3},quarters:{months:3,weeks:He/28,days:He/4,hours:He*24/4,minutes:He*24*60/4,seconds:He*24*60*60/4,milliseconds:He*24*60*60*1e3/4},months:{weeks:$t/7,days:$t,hours:$t*24,minutes:$t*24*60,seconds:$t*24*60*60,milliseconds:$t*24*60*60*1e3},...Ks},_t=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],tu=_t.slice(0).reverse();function dt(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 ie(n)}function Qs(r,e){let t=e.milliseconds??0;for(const n of tu.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function Xs(r,e){const t=Qs(r,e)<0?-1:1;_t.reduceRight((n,i)=>{if(J(e[i]))return n;if(n){const s=e[n]*t,o=r[i][n],l=Math.floor(s/o);e[i]+=l*t,e[n]-=l*o*t}return i},null),_t.reduce((n,i)=>{if(J(e[i]))return n;if(n){const s=e[n]%1;e[n]-=s,e[i]+=s*r[n][i]}return i},null)}function ru(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class ie{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?eu:Xc;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||le.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return ie.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Te(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ie({values:Rr(e,ie.normalizeUnit),loc:le.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ft(e))return ie.fromMillis(e);if(ie.isDuration(e))return e;if(typeof e=="object")return ie.fromObject(e);throw new Te(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=zc(e);return n?ie.fromObject(n,t):ie.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=Gc(e);return n?ie.fromObject(n,t):ie.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Te("need to specify a reason the Duration is invalid");const n=e instanceof Qe?e:new Qe(e,t);if(ye.throwOnInvalid)throw new Tl(n);return new ie({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 qi(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?Ae.create(this.loc,n).formatDurationFromString(this,e):Ys}toHuman(e={}){if(!this.isValid)return Ys;const t=_t.map(n=>{const i=this.values[n];return J(i)?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(t)}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+=gn(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},z.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?Qs(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ie.fromDurationLike(e),n={};for(const i of _t)(Mt(t.values,i)||Mt(this.values,i))&&(n[i]=t.get(i)+this.get(i));return dt(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=ie.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]=Ms(e(this.values[n],n));return dt(this,{values:t},!0)}get(e){return this[ie.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Rr(e,ie.normalizeUnit)};return dt(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:i}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:n};return dt(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Xs(this.matrix,e),dt(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=ru(this.normalize().shiftToAll().toObject());return dt(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ie.normalizeUnit(o));const t={},n={},i=this.toObject();let s;for(const o of _t)if(e.indexOf(o)>=0){s=o;let l=0;for(const u in n)l+=this.matrix[u][o]*n[u],n[u]=0;ft(i[o])&&(l+=i[o]);const a=Math.trunc(l);t[o]=a,n[o]=(l*1e3-a*1e3)/1e3}else ft(i[o])&&(n[o]=i[o]);for(const o in n)n[o]!==0&&(t[s]+=o===s?n[o]:n[o]/this.matrix[s][o]);return Xs(this.matrix,t),dt(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 dt(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,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(const n of _t)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Wt="Invalid Interval";function nu(r,e){return!r||!r.isValid?we.invalid("missing or invalid start"):!e||!e.isValid?we.invalid("missing or invalid end"):e<r?we.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 we{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 Te("need to specify a reason the Interval is invalid");const n=e instanceof Qe?e:new Qe(e,t);if(ye.throwOnInvalid)throw new Ol(n);return new we({invalid:n})}static fromDateTimes(e,t){const n=lr(e),i=lr(t),s=nu(n,i);return s??new we({start:n,end:i})}static after(e,t){const n=ie.fromDurationLike(t),i=lr(e);return we.fromDateTimes(i,i.plus(n))}static before(e,t){const n=ie.fromDurationLike(t),i=lr(e);return we.fromDateTimes(i.minus(n),i)}static fromISO(e,t){const[n,i]=(e||"").split("/",2);if(n&&i){let s,o;try{s=z.fromISO(n,t),o=s.isValid}catch{o=!1}let l,a;try{l=z.fromISO(i,t),a=l.isValid}catch{a=!1}if(o&&a)return we.fromDateTimes(s,l);if(o){const u=ie.fromISO(i,t);if(u.isValid)return we.after(s,u)}else if(a){const u=ie.fromISO(n,t);if(u.isValid)return we.before(l,u)}}return we.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 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 i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(n,e).get(e))+(i.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?we.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(lr).filter(o=>this.contains(o)).sort((o,l)=>o.toMillis()-l.toMillis()),n=[];let{s:i}=this,s=0;for(;i<this.e;){const o=t[s]||this.e,l=+o>+this.e?this.e:o;n.push(we.fromDateTimes(i,l)),i=l,s+=1}return n}splitBy(e){const t=ie.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,i=1,s;const o=[];for(;n<this.e;){const l=this.start.plus(t.mapUnits(a=>a*i));s=+l>+this.e?this.e:l,o.push(we.fromDateTimes(n,s)),n=s,i+=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:we.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 we.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const i=[],s=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...s),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&&i.push(we.fromDateTimes(t,a.time)),t=null);return we.merge(i)}difference(...e){return we.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()})`:Wt}[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=vr,t={}){return this.isValid?Ae.create(this.s.loc.clone(t),e).formatInterval(this):Wt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Wt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Wt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Wt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Wt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ie.invalid(this.invalidReason)}mapEndpoints(e){return we.fromDateTimes(e(this.s),e(this.e))}}class Pr{static hasDST(e=ye.defaultZone){const t=z.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return ot.isValidZone(e)}static normalizeZone(e){return ut(e,ye.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||le.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||le.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||le.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||le.create(t,n,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||le.create(t,n,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||le.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||le.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return le.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return le.create(t,null,"gregory").eras(e)}static features(){return{relative:Cs(),localeWeek:Rs()}}}function eo(r,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(ie.fromMillis(n).as("days"))}function iu(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=eo(a,u);return(c-c%7)/7}],["days",eo]],i={},s=r;let o,l;for(const[a,u]of n)t.indexOf(a)>=0&&(o=a,i[a]=u(r,e),l=s.plus(i),l>e?(i[a]--,r=s.plus(i),r>e&&(l=r,i[a]--,r=s.plus(i))):r=l);return[r,i,l,o]}function su(r,e,t,n){let[i,s,o,l]=iu(r,e,t);const a=e-i,u=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);u.length===0&&(o<e&&(o=i.plus({[l]:1})),o!==i&&(s[l]=(s[l]||0)+a/(o-i)));const c=ie.fromObject(s,n);return u.length>0?ie.fromMillis(a,n).shiftTo(...u).plus(c):c}const ou="missing Intl.DateTimeFormat.formatToParts support";function ae(r,e=t=>t){return{regex:r,deser:([t])=>e(Zl(t))}}const to="[ \xA0]",ro=new RegExp(to,"g");function au(r){return r.replace(/\./g,"\\.?").replace(ro,to)}function no(r){return r.replace(/\./g,"").replace(ro," ").toLowerCase()}function Xe(r,e){return r===null?null:{regex:RegExp(r.map(au).join("|")),deser:([t])=>r.findIndex(n=>no(t)===no(n))+e}}function io(r,e){return{regex:r,deser:([,t,n])=>Cr(t,n),groups:e}}function Fr(r){return{regex:r,deser:([e])=>e}}function lu(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function cu(r,e){const t=Ke(e),n=Ke(e,"{2}"),i=Ke(e,"{3}"),s=Ke(e,"{4}"),o=Ke(e,"{6}"),l=Ke(e,"{1,2}"),a=Ke(e,"{1,3}"),u=Ke(e,"{1,6}"),c=Ke(e,"{1,9}"),h=Ke(e,"{2,4}"),f=Ke(e,"{4,6}"),d=m=>({regex:RegExp(lu(m.val)),deser:([y])=>y,literal:!0}),p=(m=>{if(r.literal)return d(m);switch(m.val){case"G":return Xe(e.eras("short"),0);case"GG":return Xe(e.eras("long"),0);case"y":return ae(u);case"yy":return ae(h,mn);case"yyyy":return ae(s);case"yyyyy":return ae(f);case"yyyyyy":return ae(o);case"M":return ae(l);case"MM":return ae(n);case"MMM":return Xe(e.months("short",!0),1);case"MMMM":return Xe(e.months("long",!0),1);case"L":return ae(l);case"LL":return ae(n);case"LLL":return Xe(e.months("short",!1),1);case"LLLL":return Xe(e.months("long",!1),1);case"d":return ae(l);case"dd":return ae(n);case"o":return ae(a);case"ooo":return ae(i);case"HH":return ae(n);case"H":return ae(l);case"hh":return ae(n);case"h":return ae(l);case"mm":return ae(n);case"m":return ae(l);case"q":return ae(l);case"qq":return ae(n);case"s":return ae(l);case"ss":return ae(n);case"S":return ae(a);case"SSS":return ae(i);case"u":return Fr(c);case"uu":return Fr(l);case"uuu":return ae(t);case"a":return Xe(e.meridiems(),0);case"kkkk":return ae(s);case"kk":return ae(h,mn);case"W":return ae(l);case"WW":return ae(n);case"E":case"c":return ae(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 io(new RegExp(`([+-]${l.source})(?::(${n.source}))?`),2);case"ZZZ":return io(new RegExp(`([+-]${l.source})(${n.source})?`),2);case"z":return Fr(/[a-z_+-/]{1,256}?/i);case" ":return Fr(/[^\S\n\r]/);default:return d(m)}})(r)||{invalidReason:ou};return p.token=r,p}const uu={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:n,value:i}=r;if(n==="literal"){const a=/^\s+$/.test(i);return{literal:!a,val:a?" ":i}}const s=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=uu[o];if(typeof l=="object"&&(l=l[s]),l)return{literal:!1,val:l}}function hu(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function du(r,e,t){const n=r.match(e);if(n){const i={};let s=1;for(const o in t)if(Mt(t,o)){const l=t[o],a=l.groups?l.groups+1:1;!l.literal&&l.token&&(i[l.token.val[0]]=l.deser(n.slice(s,s+a))),s+=a}return[n,i]}else return[n,{}]}function pu(r){const e=s=>{switch(s){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 J(r.z)||(t=ot.create(r.z)),J(r.Z)||(t||(t=new Fe(r.Z)),n=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=pn(r.u)),[Object.keys(r).reduce((s,o)=>{const l=e(o);return l&&(s[l]=r[o]),s},{}),t,n]}let vn=null;function gu(){return vn||(vn=z.fromMillis(1555555555555)),vn}function mu(r,e){if(r.literal)return r;const t=Ae.macroTokenToFormatOpts(r.val),n=lo(t,e);return n==null||n.includes(void 0)?r:n}function so(r,e){return Array.prototype.concat(...r.map(t=>mu(t,e)))}class oo{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=so(Ae.parseFormat(t),e),this.units=this.tokens.map(n=>cu(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,i]=hu(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,n]=du(e,this.regex,this.handlers),[i,s,o]=n?pu(n):[null,null,void 0];if(Mt(n,"a")&&Mt(n,"H"))throw new Pt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:i,zone:s,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 ao(r,e,t){return new oo(r,t).explainFromTokens(e)}function yu(r,e,t){const{result:n,zone:i,specificOffset:s,invalidReason:o}=ao(r,e,t);return[n,i,s,o]}function lo(r,e){if(!r)return null;const n=Ae.create(e,r).dtFormatter(gu()),i=n.formatToParts(),s=n.resolvedOptions();return i.map(o=>fu(o,r,s))}const Sn="Invalid DateTime",co=864e13;function ar(r){return new Qe("unsupported zone",`the zone "${r.name}" is not supported`)}function _n(r){return r.weekData===null&&(r.weekData=Or(r.c)),r.weekData}function En(r){return r.localWeekData===null&&(r.localWeekData=Or(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function Et(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new z({...t,...e,old:t})}function uo(r,e,t){let n=r-e*60*1e3;const i=t.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;const s=t.offset(n);return i===s?[n,i]:[r-Math.min(i,s)*60*1e3,Math.max(i,s)]}function Mr(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 Lr(r,e,t){return uo(Ir(r),e,t)}function fo(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),i=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...r.c,year:n,month:i,day:Math.min(r.c.day,Ar(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ie.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=Ir(s);let[a,u]=uo(l,t,r.zone);return o!==0&&(a+=o,u=r.zone.offset(a)),{ts:a,o:u}}function qt(r,e,t,n,i,s){const{setZone:o,zone:l}=t;if(r&&Object.keys(r).length!==0||e){const a=e||l,u=z.fromObject(r,{...t,zone:a,specificOffset:s});return o?u:u.setZone(l)}else return z.invalid(new Qe("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Dr(r,e,t=!0){return r.isValid?Ae.create(le.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function kn(r,e){const t=r.c.year>9999||r.c.year<0;let n="";return t&&r.c.year>=0&&(n+="+"),n+=ve(r.c.year,t?6:4),e?(n+="-",n+=ve(r.c.month),n+="-",n+=ve(r.c.day)):(n+=ve(r.c.month),n+=ve(r.c.day)),n}function ho(r,e,t,n,i,s){let o=ve(r.c.hour);return e?(o+=":",o+=ve(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=":")):o+=ve(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=ve(r.c.second),(r.c.millisecond!==0||!n)&&(o+=".",o+=ve(r.c.millisecond,3))),i&&(r.isOffsetFixed&&r.offset===0&&!s?o+="Z":r.o<0?(o+="-",o+=ve(Math.trunc(-r.o/60)),o+=":",o+=ve(Math.trunc(-r.o%60))):(o+="+",o+=ve(Math.trunc(r.o/60)),o+=":",o+=ve(Math.trunc(r.o%60)))),s&&(o+="["+r.zone.ianaName+"]"),o}const po={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},bu={ordinal:1,hour:0,minute:0,second:0,millisecond:0},go=["year","month","day","hour","minute","second","millisecond"],vu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Su=["year","ordinal","hour","minute","second","millisecond"];function _u(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 qi(r);return e}function mo(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return _u(r)}}function Eu(r){return jr[r]||(xr===void 0&&(xr=ye.now()),jr[r]=r.offset(xr)),jr[r]}function yo(r,e){const t=ut(e.zone,ye.defaultZone);if(!t.isValid)return z.invalid(ar(t));const n=le.fromObject(e);let i,s;if(J(r.year))i=ye.now();else{for(const a of go)J(r[a])&&(r[a]=po[a]);const o=As(r)||Is(r);if(o)return z.invalid(o);const l=Eu(t);[i,s]=Lr(r,l,t)}return new z({ts:i,zone:t,loc:n,o:s})}function wo(r,e,t){const n=J(t.round)?!0:t.round,i=(o,l)=>(o=gn(o,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,l)),s=o=>t.calendary?e.hasSame(r,o)?0:e.startOf(o).diff(r.startOf(o),o).get(o):e.diff(r,o).get(o);if(t.unit)return i(s(t.unit),t.unit);for(const o of t.units){const l=s(o);if(Math.abs(l)>=1)return i(l,o)}return i(r>e?-0:0,t.units[t.units.length-1])}function bo(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 xr,jr={};class z{constructor(e){const t=e.zone||ye.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Qe("invalid input"):null)||(t.isValid?null:ar(t));this.ts=J(e.ts)?ye.now():e.ts;let i=null,s=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,s]=[e.old.c,e.old.o];else{const l=ft(e.o)&&!e.old?e.o:t.offset(this.ts);i=Mr(this.ts,l),n=Number.isNaN(i.year)?new Qe("invalid input"):null,i=n?null:i,s=n?null:l}this._zone=t,this.loc=e.loc||le.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new z({})}static local(){const[e,t]=bo(arguments),[n,i,s,o,l,a,u]=t;return yo({year:n,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static utc(){const[e,t]=bo(arguments),[n,i,s,o,l,a,u]=t;return e.zone=Fe.utcInstance,yo({year:n,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const n=ec(e)?e.valueOf():NaN;if(Number.isNaN(n))return z.invalid("invalid input");const i=ut(t.zone,ye.defaultZone);return i.isValid?new z({ts:n,zone:i,loc:le.fromObject(t)}):z.invalid(ar(i))}static fromMillis(e,t={}){if(ft(e))return e<-co||e>co?z.invalid("Timestamp out of range"):new z({ts:e,zone:ut(t.zone,ye.defaultZone),loc:le.fromObject(t)});throw new Te(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ft(e))return new z({ts:e*1e3,zone:ut(t.zone,ye.defaultZone),loc:le.fromObject(t)});throw new Te("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=ut(t.zone,ye.defaultZone);if(!n.isValid)return z.invalid(ar(n));const i=le.fromObject(t),s=Rr(e,mo),{minDaysInFirstWeek:o,startOfWeek:l}=Ts(s,i),a=ye.now(),u=J(t.specificOffset)?n.offset(a):t.specificOffset,c=!J(s.ordinal),h=!J(s.year),f=!J(s.month)||!J(s.day),d=h||f,g=s.weekYear||s.weekNumber;if((d||c)&&g)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new Pt("Can't mix ordinal dates with month/day");const p=g||s.weekday&&!d;let m,y,w=Mr(a,u);p?(m=vu,y=wu,w=Or(w,o,l)):c?(m=Su,y=bu,w=hn(w)):(m=go,y=po);let _=!1;for(const R of m){const Y=s[R];J(Y)?_?s[R]=y[R]:s[R]=w[R]:_=!0}const b=p?Kl(s,o,l):c?Ql(s):As(s),k=b||Is(s);if(k)return z.invalid(k);const S=p?ks(s,o,l):c?Os(s):s,[O,C]=Lr(S,u,n),F=new z({ts:O,zone:n,o:C,loc:i});return s.weekday&&d&&e.weekday!==F.weekday?z.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${F.toISO()}`):F.isValid?F:z.invalid(F.invalid)}static fromISO(e,t={}){const[n,i]=qc(e);return qt(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=Vc(e);return qt(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=Hc(e);return qt(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(J(e)||J(t))throw new Te("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:s=null}=n,o=le.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[l,a,u,c]=yu(o,e,t);return c?z.invalid(c):qt(l,a,n,`format ${t}`,e,u)}static fromString(e,t,n={}){return z.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=Qc(e);return qt(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Te("need to specify a reason the DateTime is invalid");const n=e instanceof Qe?e:new Qe(e,t);if(ye.throwOnInvalid)throw new kl(n);return new z({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=lo(e,le.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return so(Ae.parseFormat(e),le.fromObject(t)).map(i=>i.val).join("")}static resetCache(){xr=void 0,jr={}}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?_n(this).weekYear:NaN}get weekNumber(){return this.isValid?_n(this).weekNumber:NaN}get weekday(){return this.isValid?_n(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?En(this).weekday:NaN}get localWeekNumber(){return this.isValid?En(this).weekNumber:NaN}get localWeekYear(){return this.isValid?En(this).weekYear:NaN}get ordinal(){return this.isValid?hn(this.c).ordinal:NaN}get monthShort(){return this.isValid?Pr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Pr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Pr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Pr.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=Ir(this.c),i=this.zone.offset(n-e),s=this.zone.offset(n+e),o=this.zone.offset(n-i*t),l=this.zone.offset(n-s*t);if(o===l)return[this];const a=n-o*t,u=n-l*t,c=Mr(a,o),h=Mr(u,l);return c.hour===h.hour&&c.minute===h.minute&&c.second===h.second&&c.millisecond===h.millisecond?[Et(this,{ts:a}),Et(this,{ts:u})]:[this]}get isInLeapYear(){return rr(this.year)}get daysInMonth(){return Ar(this.year,this.month)}get daysInYear(){return this.isValid?Lt(this.year):NaN}get weeksInWeekYear(){return this.isValid?nr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?nr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:i}=Ae.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(Fe.instance(e),t)}toLocal(){return this.setZone(ye.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=ut(e,ye.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||n){const s=e.offset(this.ts),o=this.toObject();[i]=Lr(o,s,e)}return Et(this,{ts:i,zone:e})}else return z.invalid(ar(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Et(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Rr(e,mo),{minDaysInFirstWeek:n,startOfWeek:i}=Ts(t,this.loc),s=!J(t.weekYear)||!J(t.weekNumber)||!J(t.weekday),o=!J(t.ordinal),l=!J(t.year),a=!J(t.month)||!J(t.day),u=l||a,c=t.weekYear||t.weekNumber;if((u||o)&&c)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Pt("Can't mix ordinal dates with month/day");let h;s?h=ks({...Or(this.c,n,i),...t},n,i):J(t.ordinal)?(h={...this.toObject(),...t},J(t.day)&&(h.day=Math.min(Ar(h.year,h.month),h.day))):h=Os({...hn(this.c),...t});const[f,d]=Lr(h,this.o,this.zone);return Et(this,{ts:f,o:d})}plus(e){if(!this.isValid)return this;const t=ie.fromDurationLike(e);return Et(this,fo(this,t))}minus(e){if(!this.isValid)return this;const t=ie.fromDurationLike(e).negate();return Et(this,fo(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},i=ie.normalizeUnit(e);switch(i){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(i==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(n.weekNumber=this.weekNumber-1),n.weekday=s}else n.weekday=1;if(i==="quarters"){const s=Math.ceil(this.month/3);n.month=(s-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?Ae.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Sn}toLocaleString(e=vr,t={}){return this.isValid?Ae.create(this.loc.clone(t),e).formatDateTime(this):Sn}toLocaleParts(e={}){return this.isValid?Ae.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:s=!1}={}){if(!this.isValid)return null;const o=e==="extended";let l=kn(this,o);return l+="T",l+=ho(this,o,t,n,i,s),l}toISODate({format:e="extended"}={}){return this.isValid?kn(this,e==="extended"):null}toISOWeekDate(){return Dr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended"}={}){return this.isValid?(i?"T":"")+ho(this,o==="extended",t,e,n,s):null}toRFC2822(){return Dr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Dr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?kn(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(n&&(i+=" "),t?i+="z":e&&(i+="ZZ")),Dr(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Sn}[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 ie.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...n},s=tc(t).map(ie.normalizeUnit),o=e.valueOf()>this.valueOf(),l=o?this:e,a=o?e:this,u=su(l,a,s,i);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(z.now(),e,t)}until(e){return this.isValid?we.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,n)<=i&&i<=s.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||z.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),wo(t,this.plus(n),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?wo(e.base||z.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(z.isDateTime))throw new Te("min requires all arguments be DateTimes");return Ns(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(z.isDateTime))throw new Te("max requires all arguments be DateTimes");return Ns(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:i=null,numberingSystem:s=null}=n,o=le.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return ao(o,e,t)}static fromStringExplain(e,t,n={}){return z.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:i=null}=t,s=le.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new oo(s,e)}static fromFormatParser(e,t,n={}){if(J(e)||J(t))throw new Te("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:s=null}=n,o=le.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(t.locale))throw new Te(`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?z.invalid(c):qt(l,a,n,`format ${t.format}`,e,u)}static get DATE_SHORT(){return vr}static get DATE_MED(){return Vi}static get DATE_MED_WITH_WEEKDAY(){return Al}static get DATE_FULL(){return Hi}static get DATE_HUGE(){return zi}static get TIME_SIMPLE(){return Ji}static get TIME_WITH_SECONDS(){return Gi}static get TIME_WITH_SHORT_OFFSET(){return Zi}static get TIME_WITH_LONG_OFFSET(){return Yi}static get TIME_24_SIMPLE(){return Ki}static get TIME_24_WITH_SECONDS(){return Qi}static get TIME_24_WITH_SHORT_OFFSET(){return Xi}static get TIME_24_WITH_LONG_OFFSET(){return es}static get DATETIME_SHORT(){return ts}static get DATETIME_SHORT_WITH_SECONDS(){return rs}static get DATETIME_MED(){return ns}static get DATETIME_MED_WITH_SECONDS(){return is}static get DATETIME_MED_WITH_WEEKDAY(){return Il}static get DATETIME_FULL(){return ss}static get DATETIME_FULL_WITH_SECONDS(){return os}static get DATETIME_HUGE(){return as}static get DATETIME_HUGE_WITH_SECONDS(){return ls}}function lr(r){if(z.isDateTime(r))return r;if(r&&r.valueOf&&ft(r.valueOf()))return z.fromJSDate(r);if(r&&typeof r=="object")return z.fromObject(r);throw new Te(`Unknown datetime argument: ${r}, of type ${typeof r}`)}const On={};let Tn;const ku=new Uint8Array(16),ke=[];for(let r=0;r<256;++r)ke.push((r+256).toString(16).slice(1));function Ou(r,e,t){return r.msecs??=-1/0,r.seq??=0,e>r.msecs?(r.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],r.msecs=e):(r.seq=Math.trunc(r.seq+1),r.seq===0&&r.msecs++),r}function Tu(r,e,t,n,i=0){return n||(n=new Uint8Array(16),i=0),e??=Date.now(),t??=r[6]*127<<24|r[7]<<16|r[8]<<8|r[9],n[i++]=e/1099511627776&255,n[i++]=e/4294967296&255,n[i++]=e/16777216&255,n[i++]=e/65536&255,n[i++]=e/256&255,n[i++]=e&255,n[i++]=112|t>>>28&15,n[i++]=t>>>20&255,n[i++]=128|t>>>14&63,n[i++]=t>>>6&255,n[i++]=t<<2&255|r[10]&3,n[i++]=r[11],n[i++]=r[12],n[i++]=r[13],n[i++]=r[14],n[i++]=r[15],n}function Au(r,e=0){return(ke[r[e]]+ke[r[e+1]]+ke[r[e+2]]+ke[r[e+3]]+"-"+ke[r[e+4]]+ke[r[e+5]]+"-"+ke[r[e+6]]+ke[r[e+7]]+"-"+ke[r[e+8]]+ke[r[e+9]]+"-"+ke[r[e+10]]+ke[r[e+11]]+ke[r[e+12]]+ke[r[e+13]]+ke[r[e+14]]+ke[r[e+15]]).toLowerCase()}function Iu(){const r=Date.now();if(!Tn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported.");Tn=crypto.getRandomValues.bind(crypto)}const e=Tn(ku);Ou(On,r,e);const t=Tu(e,On.msecs,On.seq,void 0,void 0);return Au(t)}const Cu=/[&<>'"]/g,Ru=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,Nu={"&":"&amp","<":"&lt",">":"&gt","'":"&#39",'"':"&quot"},Pu={"&amp":"&","&#38":"&","&lt":"<","&#60":"<","&gt":">","&#62":">","&apos":"'","&#39":"'","&quot":'"',"&#34":'"'};class Fu{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 Iu()}encode(e){return x.isString(e)?e.replace(Cu,t=>Nu[t]):e}decode(e){return x.isString(e)?e.replace(Ru,t=>Pu[t]):e}toNumber(e){const t=Number.parseFloat(e);return x.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const n=x.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(n)}toCamelCase(e){if(!x.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(n,i)=>i?i.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return x.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!x.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 x.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,n=".",i=","){const s=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})(s,o):Math.round(s)).toString().split(".");return l[0].length>3&&(l[0]=l[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(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")&&x.isStringFilled(t)?z.fromFormat(e,t,n):z.fromISO(e,n)}getDateForLog(){return z.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const i=e[n];x.isArray(i)?i.forEach((s,o)=>{t+=encodeURIComponent(n+"["+o+"]")+"="+encodeURIComponent(s)+"&"}):t+=encodeURIComponent(n)+"="+encodeURIComponent(i)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const G=new Fu;let Se="";try{Se=navigator?.userAgent.toLowerCase()}catch{Se="?"}let Mu=class{isOpera(){return Se.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return Se.includes("msie 6")}isIE7(){return Se.includes("msie 7")}isIE8(){return Se.includes("msie 8")}isIE9(){return"documentMode"in document&&document.documentMode>=9}isIE10(){return"documentMode"in document&&document.documentMode>=10}isSafari(){return Se.includes("safari")&&!Se.includes("chrome")}isFirefox(){return Se.includes("firefox")}isChrome(){return Se.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);x.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);x.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return Se.includes("macintosh")}isWin(){return Se.includes("windows")}isLinux(){return Se.includes("linux")&&!this.isAndroid()}isAndroid(){return Se.includes("android")}isIPad(){return Se.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return Se.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||Se.includes("mobile")||Se.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(x.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const vo=new Mu,So={sleep:1e3,speed:.001,amount:30},An={sleep:600,speed:.01,amount:30*5};var _o=(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))(_o||{}),Eo=(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))(Eo||{}),de=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(de||{});const kt={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},ko={[kt.Free]:"Free",[kt.Demo]:"Demo",[kt.Trial]:"Trial",[kt.Paid]:"Paid",[kt.Local]:"Local",[kt.Subscription]:"Subscription"},Ot={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var at=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(at||{}),ge=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(ge||{}),xe=(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))(xe||{}),je=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(je||{}),Ur=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Ur||{}),Ue=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(Ue||{}),Ie=(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))(Ie||{}),cr=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(cr||{}),In=(r=>(r.Shared="shared",r.Personal="personal",r))(In||{});const Cn={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||{});class Vt{_errorCollection;_data;constructor(){this._errorCollection=new Set,this._data=null}get isSuccess(){return this._errorCollection.size===0}setData(e){return this._data=e,this}getData(){return this._data}addError(e){return e instanceof Error?this._errorCollection.add(e):this._errorCollection.add(new Error(e.toString())),this}addErrors(e){for(const t of e)t instanceof Error?this._errorCollection.add(t):this._errorCollection.add(new Error(t.toString()));return this}getErrors(){return this._errorCollection.values()}getErrorMessages(){return[...this.getErrors()].map(e=>e.message)}toString(){return this.isSuccess?`Result (success): data: ${JSON.stringify(this._data)}`:`Result (failure): errors: ${this.getErrorMessages().join(", ")}`}}class ur extends Error{cause;_status;_answerError;constructor(e){const t=`${e.answerError.error}${e.answerError.errorDescription?": "+e.answerError.errorDescription:""}`;super(t),this.cause=e.cause||null,this.name=this.constructor.name,this._status=e.status,this._answerError=e.answerError}get answerError(){return this._answerError}get status(){return this._status}set status(e){this._status=e}toString(){return`${this.answerError.error}${this.answerError.errorDescription?": "+this.answerError.errorDescription:""} (${this.status})`}}class Rn extends Vt{_status;_query;_data;constructor(e,t,n){if(super(),this._data=e,this._query=structuredClone(t),this._status=n,typeof this._data.error<"u"){const i=typeof this._data.error=="string"?this._data:this._data.error;this.addError(new ur({status:this._status,answerError:{error:i.error||"",errorDescription:i.error_description||""}}))}}setData(e){throw new Error("AjaxResult not support setData()")}getData(){return this._data}isMore(){return x.isNumber(this._data?.next)}getTotal(){return G.toInteger(this._data?.total)}getStatus(){return this._status}getQuery(){return this._query}async getNext(e){return this.isMore()&&this.isSuccess?(this._query.start=Number.parseInt(this._data?.next),e.call(this._query.method,this._query.params,this._query.start)):Promise.resolve(!1)}}let Lu=class{#e;#t;#r;_logger=null;constructor(){this.#e=So,this.#r=0,this.#t=0}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.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.#i(),this.#s())return this.getLogger().log(`>> no sleep >>> ${e}`,this.#n()),this.#o(),t(null);{const n=s=>{this.getLogger().info(`>> go sleep >>> ${e}`,this.#n()),setTimeout(()=>{s()},this.#e.sleep)},i=()=>{if(this.#i(),this.#s())return this.getLogger().info(`<< stop sleep <<< ${e}`,this.#n()),this.#o(),t(null);n(i)};n(i)}})}#n(){return`${this.#r.toFixed(4)} from ${this.#e.amount}`}#i(){this.#t>0&&(this.#r-=(Date.now()-this.#t)*this.#e.speed,this.#r<0&&(this.#r=0)),this.#t=Date.now()}#o(){this.#r++}#s(){return this.#r<this.#e.amount}};const Du="X-Request-ID",xu="bx24_request_id",ju="bx24_sdk_ver";let Uu=class{getQueryStringParameterName(){return xu}getQueryStringSdkParameterName(){return ju}generate(){return G.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return Du}};function Oo(r,e){return function(){return r.apply(e,arguments)}}const{toString:Bu}=Object.prototype,{getPrototypeOf:Nn}=Object,Br=(r=>e=>{const t=Bu.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),et=r=>(r=r.toLowerCase(),e=>Br(e)===r),$r=r=>e=>typeof e===r,{isArray:Ht}=Array,fr=$r("undefined");function $u(r){return r!==null&&!fr(r)&&r.constructor!==null&&!fr(r.constructor)&&Be(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const To=et("ArrayBuffer");function Wu(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&To(r.buffer),e}const qu=$r("string"),Be=$r("function"),Ao=$r("number"),Wr=r=>r!==null&&typeof r=="object",Vu=r=>r===!0||r===!1,qr=r=>{if(Br(r)!=="object")return!1;const e=Nn(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},Hu=et("Date"),zu=et("File"),Ju=et("Blob"),Gu=et("FileList"),Zu=r=>Wr(r)&&Be(r.pipe),Yu=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Be(r.append)&&((e=Br(r))==="formdata"||e==="object"&&Be(r.toString)&&r.toString()==="[object FormData]"))},Ku=et("URLSearchParams"),[Qu,Xu,ef,tf]=["ReadableStream","Request","Response","Headers"].map(et),rf=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function hr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),Ht(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{const s=t?Object.getOwnPropertyNames(r):Object.keys(r),o=s.length;let l;for(n=0;n<o;n++)l=s[n],e.call(null,r[l],l,r)}}function Io(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const Tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Co=r=>!fr(r)&&r!==Tt;function Pn(){const{caseless:r}=Co(this)&&this||{},e={},t=(n,i)=>{const s=r&&Io(e,i)||i;qr(e[s])&&qr(n)?e[s]=Pn(e[s],n):qr(n)?e[s]=Pn({},n):Ht(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&hr(arguments[n],t);return e}const nf=(r,e,t,{allOwnKeys:n}={})=>(hr(e,(i,s)=>{t&&Be(i)?r[s]=Oo(i,t):r[s]=i},{allOwnKeys:n}),r),sf=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),of=(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)},af=(r,e,t,n)=>{let i,s,o;const l={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),s=i.length;s-- >0;)o=i[s],(!n||n(o,r,e))&&!l[o]&&(e[o]=r[o],l[o]=!0);r=t!==!1&&Nn(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},lf=(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},cf=r=>{if(!r)return null;if(Ht(r))return r;let e=r.length;if(!Ao(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},uf=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Nn(Uint8Array)),ff=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(r,s[0],s[1])}},hf=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},df=et("HTMLFormElement"),pf=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),Ro=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),gf=et("RegExp"),No=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};hr(t,(i,s)=>{let o;(o=e(i,s,r))!==!1&&(n[s]=o||i)}),Object.defineProperties(r,n)},mf=r=>{No(r,(e,t)=>{if(Be(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Be(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+"'")})}})},yf=(r,e)=>{const t={},n=i=>{i.forEach(s=>{t[s]=!0})};return Ht(r)?n(r):n(String(r).split(e)),t},wf=()=>{},bf=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,Fn="abcdefghijklmnopqrstuvwxyz",Po="0123456789",Fo={DIGIT:Po,ALPHA:Fn,ALPHA_DIGIT:Fn+Fn.toUpperCase()+Po},vf=(r=16,e=Fo.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;r--;)t+=e[Math.random()*n|0];return t};function Sf(r){return!!(r&&Be(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const _f=r=>{const e=new Array(10),t=(n,i)=>{if(Wr(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ht(n)?[]:{};return hr(n,(o,l)=>{const a=t(o,i+1);!fr(a)&&(s[l]=a)}),e[i]=void 0,s}}return n};return t(r,0)},Ef=et("AsyncFunction"),kf=r=>r&&(Wr(r)||Be(r))&&Be(r.then)&&Be(r.catch),Mo=((r,e)=>r?setImmediate:e?((t,n)=>(Tt.addEventListener("message",({source:i,data:s})=>{i===Tt&&s===t&&n.length&&n.shift()()},!1),i=>{n.push(i),Tt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Be(Tt.postMessage)),Of=typeof queueMicrotask<"u"?queueMicrotask.bind(Tt):typeof process<"u"&&process.nextTick||Mo,T={isArray:Ht,isArrayBuffer:To,isBuffer:$u,isFormData:Yu,isArrayBufferView:Wu,isString:qu,isNumber:Ao,isBoolean:Vu,isObject:Wr,isPlainObject:qr,isReadableStream:Qu,isRequest:Xu,isResponse:ef,isHeaders:tf,isUndefined:fr,isDate:Hu,isFile:zu,isBlob:Ju,isRegExp:gf,isFunction:Be,isStream:Zu,isURLSearchParams:Ku,isTypedArray:uf,isFileList:Gu,forEach:hr,merge:Pn,extend:nf,trim:rf,stripBOM:sf,inherits:of,toFlatObject:af,kindOf:Br,kindOfTest:et,endsWith:lf,toArray:cf,forEachEntry:ff,matchAll:hf,isHTMLForm:df,hasOwnProperty:Ro,hasOwnProp:Ro,reduceDescriptors:No,freezeMethods:mf,toObjectSet:yf,toCamelCase:pf,noop:wf,toFiniteNumber:bf,findKey:Io,global:Tt,isContextDefined:Co,ALPHABET:Fo,generateString:vf,isSpecCompliantForm:Sf,toJSONObject:_f,isAsyncFn:Ef,isThenable:kf,setImmediate:Mo,asap:Of};function Q(r,e,t,n,i){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),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Q,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:T.toJSONObject(this.config),code:this.code,status:this.status}}});const Lo=Q.prototype,Do={};["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=>{Do[r]={value:r}}),Object.defineProperties(Q,Do),Object.defineProperty(Lo,"isAxiosError",{value:!0}),Q.from=(r,e,t,n,i,s)=>{const o=Object.create(Lo);return T.toFlatObject(r,o,function(a){return a!==Error.prototype},l=>l!=="isAxiosError"),Q.call(o,r.message,e,t,n,i),o.cause=r,o.name=r.name,s&&Object.assign(o,s),o};const Tf=null;function Mn(r){return T.isPlainObject(r)||T.isArray(r)}function xo(r){return T.endsWith(r,"[]")?r.slice(0,-2):r}function jo(r,e,t){return r?r.concat(e).map(function(i,s){return i=xo(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function Af(r){return T.isArray(r)&&!r.some(Mn)}const If=T.toFlatObject(T,{},null,function(e){return/^is[A-Z]/.test(e)});function Vr(r,e,t){if(!T.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=T.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,m){return!T.isUndefined(m[p])});const n=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(e);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!a&&T.isBlob(g))throw new Q("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?a&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function c(g,p,m){let y=g;if(g&&!m&&typeof g=="object"){if(T.endsWith(p,"{}"))p=n?p:p.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&Af(g)||(T.isFileList(g)||T.endsWith(p,"[]"))&&(y=T.toArray(g)))return p=xo(p),y.forEach(function(_,b){!(T.isUndefined(_)||_===null)&&e.append(o===!0?jo([p],b,s):o===null?p:p+"[]",u(_))}),!1}return Mn(g)?!0:(e.append(jo(m,p,s),u(g)),!1)}const h=[],f=Object.assign(If,{defaultVisitor:c,convertValue:u,isVisitable:Mn});function d(g,p){if(!T.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+p.join("."));h.push(g),T.forEach(g,function(y,w){(!(T.isUndefined(y)||y===null)&&i.call(e,y,T.isString(w)?w.trim():w,p,f))===!0&&d(y,p?p.concat(w):[w])}),h.pop()}}if(!T.isObject(r))throw new TypeError("data must be an object");return d(r),e}function Uo(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Ln(r,e){this._pairs=[],r&&Vr(r,this,e)}const Bo=Ln.prototype;Bo.append=function(e,t){this._pairs.push([e,t])},Bo.toString=function(e){const t=e?function(n){return e.call(this,n,Uo)}:Uo;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function Cf(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $o(r,e,t){if(!e)return r;const n=t&&t.encode||Cf,i=t&&t.serialize;let s;if(i?s=i(e,t):s=T.isURLSearchParams(e)?e.toString():new Ln(e,t).toString(n),s){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class Wo{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){T.forEach(this.handlers,function(n){n!==null&&e(n)})}}const qo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Rf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ln,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Dn=typeof window<"u"&&typeof document<"u",xn=typeof navigator=="object"&&navigator||void 0,Nf=Dn&&(!xn||["ReactNative","NativeScript","NS"].indexOf(xn.product)<0),Pf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ff=Dn&&window.location.href||"http://localhost",Me={...{__proto__:null,hasBrowserEnv:Dn,hasStandardBrowserEnv:Nf,hasStandardBrowserWebWorkerEnv:Pf,navigator:xn,origin:Ff},...Rf};function Mf(r,e){return Vr(r,new Me.classes.URLSearchParams,Object.assign({visitor:function(t,n,i,s){return Me.isNode&&T.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Lf(r){return T.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Df(r){const e={},t=Object.keys(r);let n;const i=t.length;let s;for(n=0;n<i;n++)s=t[n],e[s]=r[s];return e}function Vo(r){function e(t,n,i,s){let o=t[s++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),a=s>=t.length;return o=!o&&T.isArray(i)?i.length:o,a?(T.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!l):((!i[o]||!T.isObject(i[o]))&&(i[o]=[]),e(t,n,i[o],s)&&T.isArray(i[o])&&(i[o]=Df(i[o])),!l)}if(T.isFormData(r)&&T.isFunction(r.entries)){const t={};return T.forEachEntry(r,(n,i)=>{e(Lf(n),i,t,0)}),t}return null}function xf(r,e,t){if(T.isString(r))try{return(e||JSON.parse)(r),T.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(0,JSON.stringify)(r)}const dr={transitional:qo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=T.isObject(e);if(s&&T.isHTMLForm(e)&&(e=new FormData(e)),T.isFormData(e))return i?JSON.stringify(Vo(e)):e;if(T.isArrayBuffer(e)||T.isBuffer(e)||T.isStream(e)||T.isFile(e)||T.isBlob(e)||T.isReadableStream(e))return e;if(T.isArrayBufferView(e))return e.buffer;if(T.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Mf(e,this.formSerializer).toString();if((l=T.isFileList(e))||n.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Vr(l?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),xf(e)):e}],transformResponse:[function(e){const t=this.transitional||dr.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(e)||T.isReadableStream(e))return e;if(e&&T.isString(e)&&(n&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?Q.from(l,Q.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:Me.classes.FormData,Blob:Me.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],r=>{dr.headers[r]={}});const jf=T.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"]),Uf=r=>{const e={};let t,n,i;return r&&r.split(`
2
+ `).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!t||e[t]&&jf[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},Ho=Symbol("internals");function pr(r){return r&&String(r).trim().toLowerCase()}function Hr(r){return r===!1||r==null?r:T.isArray(r)?r.map(Hr):String(r)}function Bf(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 $f=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function jn(r,e,t,n,i){if(T.isFunction(n))return n.call(this,e,t);if(i&&(e=t),!!T.isString(e)){if(T.isString(n))return e.indexOf(n)!==-1;if(T.isRegExp(n))return n.test(e)}}function Wf(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function qf(r,e){const t=T.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let Le=class{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(l,a,u){const c=pr(a);if(!c)throw new Error("header name must be a non-empty string");const h=T.findKey(i,c);(!h||i[h]===void 0||u===!0||u===void 0&&i[h]!==!1)&&(i[h||a]=Hr(l))}const o=(l,a)=>T.forEach(l,(u,c)=>s(u,c,a));if(T.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(T.isString(e)&&(e=e.trim())&&!$f(e))o(Uf(e),t);else if(T.isHeaders(e))for(const[l,a]of e.entries())s(a,l,n);else e!=null&&s(t,e,n);return this}get(e,t){if(e=pr(e),e){const n=T.findKey(this,e);if(n){const i=this[n];if(!t)return i;if(t===!0)return Bf(i);if(T.isFunction(t))return t.call(this,i,n);if(T.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=pr(e),e){const n=T.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||jn(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let i=!1;function s(o){if(o=pr(o),o){const l=T.findKey(n,o);l&&(!t||jn(n,n[l],l,t))&&(delete n[l],i=!0)}}return T.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const s=t[n];(!e||jn(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,n={};return T.forEach(this,(i,s)=>{const o=T.findKey(n,s);if(o){t[o]=Hr(i),delete t[s];return}const l=e?Wf(s):String(s).trim();l!==s&&delete t[s],t[l]=Hr(i),n[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return T.forEach(this,(n,i)=>{n!=null&&n!==!1&&(t[i]=e&&T.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(`
3
+ `)}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(i=>n.set(i)),n}static accessor(e){const n=(this[Ho]=this[Ho]={accessors:{}}).accessors,i=this.prototype;function s(o){const l=pr(o);n[l]||(qf(i,o),n[l]=!0)}return T.isArray(e)?e.forEach(s):s(e),this}};Le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),T.reduceDescriptors(Le.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),T.freezeMethods(Le);function Un(r,e){const t=this||dr,n=e||t,i=Le.from(n.headers);let s=n.data;return T.forEach(r,function(l){s=l.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function zo(r){return!!(r&&r.__CANCEL__)}function zt(r,e,t){Q.call(this,r??"canceled",Q.ERR_CANCELED,e,t),this.name="CanceledError"}T.inherits(zt,Q,{__CANCEL__:!0});function Jo(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new Q("Request failed with status code "+t.status,[Q.ERR_BAD_REQUEST,Q.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Vf(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function Hf(r,e){r=r||10;const t=new Array(r),n=new Array(r);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),c=n[s];o||(o=u),t[i]=a,n[i]=u;let h=s,f=0;for(;h!==i;)f+=t[h++],h=h%r;if(i=(i+1)%r,i===s&&(s=(s+1)%r),u-o<e)return;const d=c&&u-c;return d?Math.round(f*1e3/d):void 0}}function zf(r,e){let t=0,n=1e3/e,i,s;const o=(u,c=Date.now())=>{t=c,i=null,s&&(clearTimeout(s),s=null),r.apply(null,u)};return[(...u)=>{const c=Date.now(),h=c-t;h>=n?o(u,c):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-h)))},()=>i&&o(i)]}const zr=(r,e,t=3)=>{let n=0;const i=Hf(50,250);return zf(s=>{const o=s.loaded,l=s.lengthComputable?s.total:void 0,a=o-n,u=i(a),c=o<=l;n=o;const h={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:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};r(h)},t)},Go=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},Zo=r=>(...e)=>T.asap(()=>r(...e)),Jf=Me.hasStandardBrowserEnv?function(){const e=Me.navigator&&/(msie|trident)/i.test(Me.navigator.userAgent),t=document.createElement("a");let n;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(o){const l=T.isString(o)?i(o):o;return l.protocol===n.protocol&&l.host===n.host}}():function(){return function(){return!0}}(),Gf=Me.hasStandardBrowserEnv?{write(r,e,t,n,i,s){const o=[r+"="+encodeURIComponent(e)];T.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),T.isString(n)&&o.push("path="+n),T.isString(i)&&o.push("domain="+i),s===!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 Zf(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Yf(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Yo(r,e){return r&&!Zf(e)?Yf(r,e):e}const Ko=r=>r instanceof Le?{...r}:r;function At(r,e){e=e||{};const t={};function n(u,c,h){return T.isPlainObject(u)&&T.isPlainObject(c)?T.merge.call({caseless:h},u,c):T.isPlainObject(c)?T.merge({},c):T.isArray(c)?c.slice():c}function i(u,c,h){if(T.isUndefined(c)){if(!T.isUndefined(u))return n(void 0,u,h)}else return n(u,c,h)}function s(u,c){if(!T.isUndefined(c))return n(void 0,c)}function o(u,c){if(T.isUndefined(c)){if(!T.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function l(u,c,h){if(h in e)return n(u,c);if(h in r)return n(void 0,u)}const a={url:s,method:s,data:s,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)=>i(Ko(u),Ko(c),!0)};return T.forEach(Object.keys(Object.assign({},r,e)),function(c){const h=a[c]||i,f=h(r[c],e[c],c);T.isUndefined(f)&&h!==l||(t[c]=f)}),t}const Qo=r=>{const e=At({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:l}=e;e.headers=o=Le.from(o),e.url=$o(Yo(e.baseURL,e.url),r.params,r.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let a;if(T.isFormData(t)){if(Me.hasStandardBrowserEnv||Me.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...c]=a?a.split(";").map(h=>h.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...c].join("; "))}}if(Me.hasStandardBrowserEnv&&(n&&T.isFunction(n)&&(n=n(e)),n||n!==!1&&Jf(e.url))){const u=i&&s&&Gf.read(s);u&&o.set(i,u)}return e},Kf=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const i=Qo(r);let s=i.data;const o=Le.from(i.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:u}=i,c,h,f,d,g;function p(){d&&d(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(c),i.signal&&i.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout;function y(){if(!m)return;const _=Le.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),k={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:_,config:r,request:m};Jo(function(O){t(O),p()},function(O){n(O),p()},k),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 Q("Request aborted",Q.ECONNABORTED,r,m)),m=null)},m.onerror=function(){n(new Q("Network Error",Q.ERR_NETWORK,r,m)),m=null},m.ontimeout=function(){let b=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const k=i.transitional||qo;i.timeoutErrorMessage&&(b=i.timeoutErrorMessage),n(new Q(b,k.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,r,m)),m=null},s===void 0&&o.setContentType(null),"setRequestHeader"in m&&T.forEach(o.toJSON(),function(b,k){m.setRequestHeader(k,b)}),T.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),l&&l!=="json"&&(m.responseType=i.responseType),u&&([f,g]=zr(u,!0),m.addEventListener("progress",f)),a&&m.upload&&([h,d]=zr(a),m.upload.addEventListener("progress",h),m.upload.addEventListener("loadend",d)),(i.cancelToken||i.signal)&&(c=_=>{m&&(n(!_||_.type?new zt(null,r,m):_),m.abort(),m=null)},i.cancelToken&&i.cancelToken.subscribe(c),i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c)));const w=Vf(i.url);if(w&&Me.protocols.indexOf(w)===-1){n(new Q("Unsupported protocol "+w+":",Q.ERR_BAD_REQUEST,r));return}m.send(s||null)})},Qf=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,i;const s=function(u){if(!i){i=!0,l();const c=u instanceof Error?u:this.reason;n.abort(c instanceof Q?c:new zt(c instanceof Error?c.message:c))}};let o=e&&setTimeout(()=>{o=null,s(new Q(`timeout ${e} of ms exceeded`,Q.ETIMEDOUT))},e);const l=()=>{r&&(o&&clearTimeout(o),o=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),r=null)};r.forEach(u=>u.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>T.asap(l),a}},Xf=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,i;for(;n<t;)i=n+e,yield r.slice(n,i),n=i},eh=async function*(r,e){for await(const t of th(r))yield*Xf(t,e)},th=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()}},Xo=(r,e,t,n)=>{const i=eh(r,e);let s=0,o,l=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{const{done:u,value:c}=await i.next();if(u){l(),a.close();return}let h=c.byteLength;if(t){let f=s+=h;t(f)}a.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(a){return l(a),i.return()}},{highWaterMark:2})},Jr=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ea=Jr&&typeof ReadableStream=="function",rh=Jr&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),ta=(r,...e)=>{try{return!!r(...e)}catch{return!1}},nh=ea&&ta(()=>{let r=!1;const e=new Request(Me.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),ra=64*1024,Bn=ea&&ta(()=>T.isReadableStream(new Response("").body)),Gr={stream:Bn&&(r=>r.body)};Jr&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Gr[e]&&(Gr[e]=T.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new Q(`Response type '${e}' is not supported`,Q.ERR_NOT_SUPPORT,n)})})})(new Response);const ih=async r=>{if(r==null)return 0;if(T.isBlob(r))return r.size;if(T.isSpecCompliantForm(r))return(await new Request(Me.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(T.isArrayBufferView(r)||T.isArrayBuffer(r))return r.byteLength;if(T.isURLSearchParams(r)&&(r=r+""),T.isString(r))return(await rh(r)).byteLength},sh=async(r,e)=>{const t=T.toFiniteNumber(r.getContentLength());return t??ih(e)},$n={http:Tf,xhr:Kf,fetch:Jr&&(async r=>{let{url:e,method:t,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:l,onUploadProgress:a,responseType:u,headers:c,withCredentials:h="same-origin",fetchOptions:f}=Qo(r);u=u?(u+"").toLowerCase():"text";let d=Qf([i,s&&s.toAbortSignal()],o),g;const p=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let m;try{if(a&&nh&&t!=="get"&&t!=="head"&&(m=await sh(c,n))!==0){let k=new Request(e,{method:"POST",body:n,duplex:"half"}),S;if(T.isFormData(n)&&(S=k.headers.get("content-type"))&&c.setContentType(S),k.body){const[O,C]=Go(m,zr(Zo(a)));n=Xo(k.body,ra,O,C)}}T.isString(h)||(h=h?"include":"omit");const y="credentials"in Request.prototype;g=new Request(e,{...f,signal:d,method:t.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",credentials:y?h:void 0});let w=await fetch(g);const _=Bn&&(u==="stream"||u==="response");if(Bn&&(l||_&&p)){const k={};["status","statusText","headers"].forEach(F=>{k[F]=w[F]});const S=T.toFiniteNumber(w.headers.get("content-length")),[O,C]=l&&Go(S,zr(Zo(l),!0))||[];w=new Response(Xo(w.body,ra,O,()=>{C&&C(),p&&p()}),k)}u=u||"text";let b=await Gr[T.findKey(Gr,u)||"text"](w,r);return!_&&p&&p(),await new Promise((k,S)=>{Jo(k,S,{data:b,headers:Le.from(w.headers),status:w.status,statusText:w.statusText,config:r,request:g})})}catch(y){throw p&&p(),y&&y.name==="TypeError"&&/fetch/i.test(y.message)?Object.assign(new Q("Network Error",Q.ERR_NETWORK,r,g),{cause:y.cause||y}):Q.from(y,y&&y.code,r,g)}})};T.forEach($n,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const na=r=>`- ${r}`,oh=r=>T.isFunction(r)||r===null||r===!1,ia={getAdapter:r=>{r=T.isArray(r)?r:[r];const{length:e}=r;let t,n;const i={};for(let s=0;s<e;s++){t=r[s];let o;if(n=t,!oh(t)&&(n=$n[(o=String(t)).toLowerCase()],n===void 0))throw new Q(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+s]=n}if(!n){const s=Object.entries(i).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since :
4
+ `+s.map(na).join(`
5
+ `):" "+na(s[0]):"as no adapter specified";throw new Q("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:$n};function Wn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new zt(null,r)}function sa(r){return Wn(r),r.headers=Le.from(r.headers),r.data=Un.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),ia.getAdapter(r.adapter||dr.adapter)(r).then(function(n){return Wn(r),n.data=Un.call(r,r.transformResponse,n),n.headers=Le.from(n.headers),n},function(n){return zo(n)||(Wn(r),n&&n.response&&(n.response.data=Un.call(r,r.transformResponse,n.response),n.response.headers=Le.from(n.response.headers))),Promise.reject(n)})}const oa="1.7.7",qn={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{qn[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});const aa={};qn.transitional=function(e,t,n){function i(s,o){return"[Axios v"+oa+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,l)=>{if(e===!1)throw new Q(i(o," has been removed"+(t?" in "+t:"")),Q.ERR_DEPRECATED);return t&&!aa[o]&&(aa[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,l):!0}};function ah(r,e,t){if(typeof r!="object")throw new Q("options must be an object",Q.ERR_BAD_OPTION_VALUE);const n=Object.keys(r);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const l=r[s],a=l===void 0||o(l,s,r);if(a!==!0)throw new Q("option "+s+" must be "+a,Q.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Q("Unknown option "+s,Q.ERR_BAD_OPTION)}}const Vn={assertOptions:ah,validators:qn},pt=Vn.validators;let It=class{constructor(e){this.defaults=e,this.interceptors={request:new Wo,response:new Wo}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
6
+ `+s):n.stack=s}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=At(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;n!==void 0&&Vn.assertOptions(n,{silentJSONParsing:pt.transitional(pt.boolean),forcedJSONParsing:pt.transitional(pt.boolean),clarifyTimeoutError:pt.transitional(pt.boolean)},!1),i!=null&&(T.isFunction(i)?t.paramsSerializer={serialize:i}:Vn.assertOptions(i,{encode:pt.function,serialize:pt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&T.merge(s.common,s[t.method]);s&&T.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),t.headers=Le.concat(o,s);const l=[];let a=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(t)===!1||(a=a&&p.synchronous,l.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let c,h=0,f;if(!a){const g=[sa.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),f=g.length,c=Promise.resolve(t);h<f;)c=c.then(g[h++],g[h++]);return c}f=l.length;let d=t;for(h=0;h<f;){const g=l[h++],p=l[h++];try{d=g(d)}catch(m){p.call(this,m);break}}try{c=sa.call(this,d)}catch(g){return Promise.reject(g)}for(h=0,f=u.length;h<f;)c=c.then(u[h++],u[h++]);return c}getUri(e){e=At(this.defaults,e);const t=Yo(e.baseURL,e.url);return $o(t,e.params,e.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(e){It.prototype[e]=function(t,n){return this.request(At(n||{},{method:e,url:t,data:(n||{}).data}))}}),T.forEach(["post","put","patch"],function(e){function t(n){return function(s,o,l){return this.request(At(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}It.prototype[e]=t(),It.prototype[e+"Form"]=t(!0)});let lh=class Sl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(l=>{n.subscribe(l),s=l}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,l){n.reason||(n.reason=new zt(s,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 Sl(function(i){e=i}),cancel:e}}};function ch(r){return function(t){return r.apply(null,t)}}function uh(r){return T.isObject(r)&&r.isAxiosError===!0}const Hn={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(Hn).forEach(([r,e])=>{Hn[e]=r});function la(r){const e=new It(r),t=Oo(It.prototype.request,e);return T.extend(t,It.prototype,e,{allOwnKeys:!0}),T.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return la(At(r,i))},t}const be=la(dr);be.Axios=It,be.CanceledError=zt,be.CancelToken=lh,be.isCancel=zo,be.VERSION=oa,be.toFormData=Vr,be.AxiosError=Q,be.Cancel=be.CanceledError,be.all=function(e){return Promise.all(e)},be.spread=ch,be.isAxiosError=uh,be.mergeConfig=At,be.AxiosHeaders=Le,be.formToJSON=r=>Vo(T.isHTMLForm(r)?new FormData(r):r),be.getAdapter=ia.getAdapter,be.HttpStatusCode=Hn,be.default=be;const{Axios:vd,AxiosError:ca,CanceledError:Sd,isCancel:_d,CancelToken:Ed,VERSION:kd,all:Od,Cancel:Td,isAxiosError:Ad,spread:Id,toFormData:Cd,AxiosHeaders:Rd,HttpStatusCode:Nd,formToJSON:Pd,getAdapter:Fd,mergeConfig:Md}=be;var Ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ua(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function fh(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var zn,fa;function hh(){return fa||(fa=1,zn=Error),zn}var Jn,ha;function dh(){return ha||(ha=1,Jn=EvalError),Jn}var Gn,da;function ph(){return da||(da=1,Gn=RangeError),Gn}var Zn,pa;function gh(){return pa||(pa=1,Zn=ReferenceError),Zn}var Yn,ga;function ma(){return ga||(ga=1,Yn=SyntaxError),Yn}var Kn,ya;function gr(){return ya||(ya=1,Kn=TypeError),Kn}var Qn,wa;function mh(){return wa||(wa=1,Qn=URIError),Qn}var Xn,ba;function yh(){return ba||(ba=1,Xn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==i||o.enumerable!==!0)return!1}return!0}),Xn}var ei,va;function wh(){if(va)return ei;va=1;var r=typeof Symbol<"u"&&Symbol,e=yh();return ei=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},ei}var ti,Sa;function bh(){if(Sa)return ti;Sa=1;var r={__proto__:null,foo:{}},e=Object;return ti=function(){return{__proto__:r}.foo===r.foo&&!(r instanceof e)},ti}var ri,_a;function vh(){if(_a)return ri;_a=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(a,u){for(var c=[],h=0;h<a.length;h+=1)c[h]=a[h];for(var f=0;f<u.length;f+=1)c[f+a.length]=u[f];return c},s=function(a,u){for(var c=[],h=u,f=0;h<a.length;h+=1,f+=1)c[f]=a[h];return c},o=function(l,a){for(var u="",c=0;c<l.length;c+=1)u+=l[c],c+1<l.length&&(u+=a);return u};return ri=function(a){var u=this;if(typeof u!="function"||e.apply(u)!==n)throw new TypeError(r+u);for(var c=s(arguments,1),h,f=function(){if(this instanceof h){var y=u.apply(this,i(c,arguments));return Object(y)===y?y:this}return u.apply(a,i(c,arguments))},d=t(0,u.length-c.length),g=[],p=0;p<d;p++)g[p]="$"+p;if(h=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(f),u.prototype){var m=function(){};m.prototype=u.prototype,h.prototype=new m,m.prototype=null}return h},ri}var ni,Ea;function ii(){if(Ea)return ni;Ea=1;var r=vh();return ni=Function.prototype.bind||r,ni}var si,ka;function Sh(){if(ka)return si;ka=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=ii();return si=t.call(r,e),si}var oi,Oa;function Jt(){if(Oa)return oi;Oa=1;var r,e=hh(),t=dh(),n=ph(),i=gh(),s=ma(),o=gr(),l=mh(),a=Function,u=function(X){try{return a('"use strict"; return ('+X+").constructor;")()}catch{}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch{c=null}var h=function(){throw new o},f=c?function(){try{return arguments.callee,h}catch{try{return c(arguments,"callee").get}catch{return h}}}():h,d=wh()(),g=bh()(),p=Object.getPrototypeOf||(g?function(X){return X.__proto__}:null),m={},y=typeof Uint8Array>"u"||!p?r:p(Uint8Array),w={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":d&&p?p([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":m,"%AsyncGenerator%":m,"%AsyncGeneratorFunction%":m,"%AsyncIteratorPrototype%":m,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":a,"%GeneratorFunction%":m,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&p?p(p([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!d||!p?r:p(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!d||!p?r:p(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&p?p(""[Symbol.iterator]()):r,"%Symbol%":d?Symbol:r,"%SyntaxError%":s,"%ThrowTypeError%":f,"%TypedArray%":y,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":l,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(p)try{null.error}catch(X){var _=p(p(X));w["%Error.prototype%"]=_}var b=function X(A){var ne;if(A==="%AsyncFunction%")ne=u("async function () {}");else if(A==="%GeneratorFunction%")ne=u("function* () {}");else if(A==="%AsyncGeneratorFunction%")ne=u("async function* () {}");else if(A==="%AsyncGenerator%"){var te=X("%AsyncGeneratorFunction%");te&&(ne=te.prototype)}else if(A==="%AsyncIteratorPrototype%"){var ce=X("%AsyncGenerator%");ce&&p&&(ne=p(ce.prototype))}return w[A]=ne,ne},k={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=ii(),O=Sh(),C=S.call(Function.call,Array.prototype.concat),F=S.call(Function.apply,Array.prototype.splice),R=S.call(Function.call,String.prototype.replace),Y=S.call(Function.call,String.prototype.slice),B=S.call(Function.call,RegExp.prototype.exec),W=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ee=/\\(\\)?/g,D=function(A){var ne=Y(A,0,1),te=Y(A,-1);if(ne==="%"&&te!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(te==="%"&&ne!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var ce=[];return R(A,W,function($,re,K,se){ce[ce.length]=K?R(se,ee,"$1"):re||$}),ce},he=function(A,ne){var te=A,ce;if(O(k,te)&&(ce=k[te],te="%"+ce[0]+"%"),O(w,te)){var $=w[te];if($===m&&($=b(te)),typeof $>"u"&&!ne)throw new o("intrinsic "+A+" exists, but is not available. Please file an issue!");return{alias:ce,name:te,value:$}}throw new s("intrinsic "+A+" does not exist!")};return oi=function(A,ne){if(typeof A!="string"||A.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ne!="boolean")throw new o('"allowMissing" argument must be a boolean');if(B(/^%?[^%]*%?$/,A)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var te=D(A),ce=te.length>0?te[0]:"",$=he("%"+ce+"%",ne),re=$.name,K=$.value,se=!1,ue=$.alias;ue&&(ce=ue[0],F(te,C([0,1],ue)));for(var me=1,U=!0;me<te.length;me+=1){var pe=te[me],Re=Y(pe,0,1),$e=Y(pe,-1);if((Re==='"'||Re==="'"||Re==="`"||$e==='"'||$e==="'"||$e==="`")&&Re!==$e)throw new s("property names with quotes must have matching quotes");if((pe==="constructor"||!U)&&(se=!0),ce+="."+pe,re="%"+ce+"%",O(w,re))K=w[re];else if(K!=null){if(!(pe in K)){if(!ne)throw new o("base intrinsic for "+A+" exists, but the property is not available.");return}if(c&&me+1>=te.length){var ze=c(K,pe);U=!!ze,U&&"get"in ze&&!("originalValue"in ze.get)?K=ze.get:K=K[pe]}else U=O(K,pe),K=K[pe];U&&!se&&(w[re]=K)}}return K},oi}var ai={exports:{}},li,Ta;function ci(){if(Ta)return li;Ta=1;var r=Jt(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return li=e,li}var ui,Aa;function Ia(){if(Aa)return ui;Aa=1;var r=Jt(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return ui=e,ui}var fi,Ca;function _h(){if(Ca)return fi;Ca=1;var r=ci(),e=ma(),t=gr(),n=Ia();return fi=function(s,o,l){if(!s||typeof s!="object"&&typeof s!="function")throw new t("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,f=!!n&&n(s,o);if(r)r(s,o,{configurable:c===null&&f?f.configurable:!c,enumerable:a===null&&f?f.enumerable:!a,value:l,writable:u===null&&f?f.writable:!u});else if(h||!a&&!u&&!c)s[o]=l;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},fi}var hi,Ra;function Eh(){if(Ra)return hi;Ra=1;var r=ci(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},hi=e,hi}var di,Na;function kh(){if(Na)return di;Na=1;var r=Jt(),e=_h(),t=Eh()(),n=Ia(),i=gr(),s=r("%Math.floor%");return di=function(l,a){if(typeof l!="function")throw new i("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||s(a)!==a)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],c=!0,h=!0;if("length"in l&&n){var f=n(l,"length");f&&!f.configurable&&(c=!1),f&&!f.writable&&(h=!1)}return(c||h||!u)&&(t?e(l,"length",a,!0,!0):e(l,"length",a)),l},di}var Pa;function Oh(){return Pa||(Pa=1,function(r){var e=ii(),t=Jt(),n=kh(),i=gr(),s=t("%Function.prototype.apply%"),o=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(o,s),a=ci(),u=t("%Math.max%");r.exports=function(f){if(typeof f!="function")throw new i("a function is required");var d=l(e,o,arguments);return n(d,1+u(0,f.length-(arguments.length-1)),!0)};var c=function(){return l(e,s,arguments)};a?a(r.exports,"apply",{value:c}):r.exports.apply=c}(ai)),ai.exports}var pi,Fa;function Th(){if(Fa)return pi;Fa=1;var r=Jt(),e=Oh(),t=e(r("String.prototype.indexOf"));return pi=function(i,s){var o=r(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e(o):o},pi}const Ah=fh({__proto__:null,default:{}});var gi,Ma;function Ih(){if(Ma)return gi;Ma=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=i&&s&&typeof s.get=="function"?s.get:null,l=i&&Set.prototype.forEach,a=typeof WeakMap=="function"&&WeakMap.prototype,u=a?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,h=c?WeakSet.prototype.has:null,f=typeof WeakRef=="function"&&WeakRef.prototype,d=f?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,p=Object.prototype.toString,m=Function.prototype.toString,y=String.prototype.match,w=String.prototype.slice,_=String.prototype.replace,b=String.prototype.toUpperCase,k=String.prototype.toLowerCase,S=RegExp.prototype.test,O=Array.prototype.concat,C=Array.prototype.join,F=Array.prototype.slice,R=Math.floor,Y=typeof BigInt=="function"?BigInt.prototype.valueOf:null,B=Object.getOwnPropertySymbols,W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ee=typeof Symbol=="function"&&typeof Symbol.iterator=="object",D=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ee||!0)?Symbol.toStringTag:null,he=Object.prototype.propertyIsEnumerable,X=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(v){return v.__proto__}:null);function A(v,E){if(v===1/0||v===-1/0||v!==v||v&&v>-1e3&&v<1e3||S.call(/e/,E))return E;var P=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof v=="number"){var V=v<0?-R(-v):R(v);if(V!==v){var Z=String(V),H=w.call(E,Z.length+1);return _.call(Z,P,"$&_")+"."+_.call(_.call(H,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(E,P,"$&_")}var ne=Ah,te=ne.custom,ce=tt(te)?te:null,$={__proto__:null,double:'"',single:"'"},re={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};gi=function v(E,P,V,Z){var H=P||{};if(rt(H,"quoteStyle")&&!rt($,H.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(rt(H,"maxStringLength")&&(typeof H.maxStringLength=="number"?H.maxStringLength<0&&H.maxStringLength!==1/0:H.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ne=rt(H,"customInspect")?H.customInspect:!0;if(typeof Ne!="boolean"&&Ne!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(rt(H,"indent")&&H.indent!==null&&H.indent!==" "&&!(parseInt(H.indent,10)===H.indent&&H.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(rt(H,"numericSeparator")&&typeof H.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var nt=H.numericSeparator;if(typeof E>"u")return"undefined";if(E===null)return"null";if(typeof E=="boolean")return E?"true":"false";if(typeof E=="string")return We(E,H);if(typeof E=="number"){if(E===0)return 1/0/E>0?"0":"-0";var Oe=String(E);return nt?A(E,Oe):Oe}if(typeof E=="bigint"){var wt=String(E)+"n";return nt?A(E,wt):wt}var Li=typeof H.depth>"u"?5:H.depth;if(typeof V>"u"&&(V=0),V>=Li&&Li>0&&typeof E=="object")return ue(E)?"[Array]":"[Object]";var Qt=Mi(H,V);if(typeof Z>"u")Z=[];else if(Qr(Z,E)>=0)return"[Circular]";function it(Xt,tn,hd){if(tn&&(Z=F.call(Z),Z.push(tn)),hd){var vl={depth:H.depth};return rt(H,"quoteStyle")&&(vl.quoteStyle=H.quoteStyle),v(Xt,vl,V+1,Z)}return v(Xt,H,V+1,Z)}if(typeof E=="function"&&!U(E)){var dl=Ge(E),pl=N(E,it);return"[Function"+(dl?": "+dl:" (anonymous)")+"]"+(pl.length>0?" { "+C.call(pl,", ")+" }":"")}if(tt(E)){var gl=ee?_.call(String(E),/^(Symbol\(.*\))_[^)]*$/,"$1"):W.call(E);return typeof E=="object"&&!ee?yt(gl):gl}if(Pi(E)){for(var br="<"+k.call(String(E.nodeName)),Di=E.attributes||[],en=0;en<Di.length;en++)br+=" "+Di[en].name+"="+K(se(Di[en].value),"double",H);return br+=">",E.childNodes&&E.childNodes.length&&(br+="..."),br+="</"+k.call(String(E.nodeName))+">",br}if(ue(E)){if(E.length===0)return"[]";var xi=N(E,it);return Qt&&!Fi(xi)?"["+Ee(xi,Qt)+"]":"[ "+C.call(xi,", ")+" ]"}if(pe(E)){var ji=N(E,it);return!("cause"in Error.prototype)&&"cause"in E&&!he.call(E,"cause")?"{ ["+String(E)+"] "+C.call(O.call("[cause]: "+it(E.cause),ji),", ")+" }":ji.length===0?"["+String(E)+"]":"{ ["+String(E)+"] "+C.call(ji,", ")+" }"}if(typeof E=="object"&&Ne){if(ce&&typeof E[ce]=="function"&&ne)return ne(E,{depth:Li-V});if(Ne!=="symbol"&&typeof E.inspect=="function")return E.inspect()}if(mt(E)){var ml=[];return n&&n.call(E,function(Xt,tn){ml.push(it(tn,E,!0)+" => "+it(Xt,E))}),Xr("Map",t.call(E),ml,Qt)}if(Ri(E)){var yl=[];return l&&l.call(E,function(Xt){yl.push(it(Xt,E))}),Xr("Set",o.call(E),yl,Qt)}if(Ii(E))return Nt("WeakMap");if(Ni(E))return Nt("WeakSet");if(Ci(E))return Nt("WeakRef");if($e(E))return yt(it(Number(E)));if(Kt(E))return yt(it(Y.call(E)));if(ze(E))return yt(g.call(E));if(Re(E))return yt(it(String(E)));if(typeof window<"u"&&E===window)return"{ [object Window] }";if(typeof globalThis<"u"&&E===globalThis||typeof Ct<"u"&&E===Ct)return"{ [object globalThis] }";if(!me(E)&&!U(E)){var Ui=N(E,it),wl=X?X(E)===Object.prototype:E instanceof Object||E.constructor===Object,Bi=E instanceof Object?"":"null prototype",bl=!wl&&D&&Object(E)===E&&D in E?w.call(Je(E),8,-1):Bi?"Object":"",fd=wl||typeof E.constructor!="function"?"":E.constructor.name?E.constructor.name+" ":"",$i=fd+(bl||Bi?"["+C.call(O.call([],bl||[],Bi||[]),": ")+"] ":"");return Ui.length===0?$i+"{}":Qt?$i+"{"+Ee(Ui,Qt)+"}":$i+"{ "+C.call(Ui,", ")+" }"}return String(E)};function K(v,E,P){var V=P.quoteStyle||E,Z=$[V];return Z+v+Z}function se(v){return _.call(String(v),/"/g,"&quot;")}function ue(v){return Je(v)==="[object Array]"&&(!D||!(typeof v=="object"&&D in v))}function me(v){return Je(v)==="[object Date]"&&(!D||!(typeof v=="object"&&D in v))}function U(v){return Je(v)==="[object RegExp]"&&(!D||!(typeof v=="object"&&D in v))}function pe(v){return Je(v)==="[object Error]"&&(!D||!(typeof v=="object"&&D in v))}function Re(v){return Je(v)==="[object String]"&&(!D||!(typeof v=="object"&&D in v))}function $e(v){return Je(v)==="[object Number]"&&(!D||!(typeof v=="object"&&D in v))}function ze(v){return Je(v)==="[object Boolean]"&&(!D||!(typeof v=="object"&&D in v))}function tt(v){if(ee)return v&&typeof v=="object"&&v instanceof Symbol;if(typeof v=="symbol")return!0;if(!v||typeof v!="object"||!W)return!1;try{return W.call(v),!0}catch{}return!1}function Kt(v){if(!v||typeof v!="object"||!Y)return!1;try{return Y.call(v),!0}catch{}return!1}var Rt=Object.prototype.hasOwnProperty||function(v){return v in this};function rt(v,E){return Rt.call(v,E)}function Je(v){return p.call(v)}function Ge(v){if(v.name)return v.name;var E=y.call(m.call(v),/^function\s*([\w$]+)/);return E?E[1]:null}function Qr(v,E){if(v.indexOf)return v.indexOf(E);for(var P=0,V=v.length;P<V;P++)if(v[P]===E)return P;return-1}function mt(v){if(!t||!v||typeof v!="object")return!1;try{t.call(v);try{o.call(v)}catch{return!0}return v instanceof Map}catch{}return!1}function Ii(v){if(!u||!v||typeof v!="object")return!1;try{u.call(v,u);try{h.call(v,h)}catch{return!0}return v instanceof WeakMap}catch{}return!1}function Ci(v){if(!d||!v||typeof v!="object")return!1;try{return d.call(v),!0}catch{}return!1}function Ri(v){if(!o||!v||typeof v!="object")return!1;try{o.call(v);try{t.call(v)}catch{return!0}return v instanceof Set}catch{}return!1}function Ni(v){if(!h||!v||typeof v!="object")return!1;try{h.call(v,h);try{u.call(v,u)}catch{return!0}return v instanceof WeakSet}catch{}return!1}function Pi(v){return!v||typeof v!="object"?!1:typeof HTMLElement<"u"&&v instanceof HTMLElement?!0:typeof v.nodeName=="string"&&typeof v.getAttribute=="function"}function We(v,E){if(v.length>E.maxStringLength){var P=v.length-E.maxStringLength,V="... "+P+" more character"+(P>1?"s":"");return We(w.call(v,0,E.maxStringLength),E)+V}var Z=re[E.quoteStyle||"single"];Z.lastIndex=0;var H=_.call(_.call(v,Z,"\\$1"),/[\x00-\x1f]/g,wr);return K(H,"single",E)}function wr(v){var E=v.charCodeAt(0),P={8:"b",9:"t",10:"n",12:"f",13:"r"}[E];return P?"\\"+P:"\\x"+(E<16?"0":"")+b.call(E.toString(16))}function yt(v){return"Object("+v+")"}function Nt(v){return v+" { ? }"}function Xr(v,E,P,V){var Z=V?Ee(P,V):C.call(P,", ");return v+" ("+E+") {"+Z+"}"}function Fi(v){for(var E=0;E<v.length;E++)if(Qr(v[E],`
7
+ `)>=0)return!1;return!0}function Mi(v,E){var P;if(v.indent===" ")P=" ";else if(typeof v.indent=="number"&&v.indent>0)P=C.call(Array(v.indent+1)," ");else return null;return{base:P,prev:C.call(Array(E+1),P)}}function Ee(v,E){if(v.length===0)return"";var P=`
8
+ `+E.prev+E.base;return P+C.call(v,","+P)+`
9
+ `+E.prev}function N(v,E){var P=ue(v),V=[];if(P){V.length=v.length;for(var Z=0;Z<v.length;Z++)V[Z]=rt(v,Z)?E(v[Z],v):""}var H=typeof B=="function"?B(v):[],Ne;if(ee){Ne={};for(var nt=0;nt<H.length;nt++)Ne["$"+H[nt]]=H[nt]}for(var Oe in v)rt(v,Oe)&&(P&&String(Number(Oe))===Oe&&Oe<v.length||ee&&Ne["$"+Oe]instanceof Symbol||(S.call(/[^\w$]/,Oe)?V.push(E(Oe,v)+": "+E(v[Oe],v)):V.push(Oe+": "+E(v[Oe],v))));if(typeof B=="function")for(var wt=0;wt<H.length;wt++)he.call(v,H[wt])&&V.push("["+E(H[wt])+"]: "+E(v[H[wt]],v));return V}return gi}var mi,La;function Ch(){if(La)return mi;La=1;var r=Jt(),e=Th(),t=Ih(),n=gr(),i=r("%WeakMap%",!0),s=r("%Map%",!0),o=e("WeakMap.prototype.get",!0),l=e("WeakMap.prototype.set",!0),a=e("WeakMap.prototype.has",!0),u=e("Map.prototype.get",!0),c=e("Map.prototype.set",!0),h=e("Map.prototype.has",!0),f=function(m,y){for(var w=m,_;(_=w.next)!==null;w=_)if(_.key===y)return w.next=_.next,_.next=m.next,m.next=_,_},d=function(m,y){var w=f(m,y);return w&&w.value},g=function(m,y,w){var _=f(m,y);_?_.value=w:m.next={key:y,next:m.next,value:w}},p=function(m,y){return!!f(m,y)};return mi=function(){var y,w,_,b={assert:function(k){if(!b.has(k))throw new n("Side channel does not contain "+t(k))},get:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return o(y,k)}else if(s){if(w)return u(w,k)}else if(_)return d(_,k)},has:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return a(y,k)}else if(s){if(w)return h(w,k)}else if(_)return p(_,k);return!1},set:function(k,S){i&&k&&(typeof k=="object"||typeof k=="function")?(y||(y=new i),l(y,k,S)):s?(w||(w=new s),c(w,k,S)):(_||(_={key:{},next:null}),g(_,k,S))}};return b},mi}var yi,Da;function wi(){if(Da)return yi;Da=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return yi={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},yi}var bi,xa;function ja(){if(xa)return bi;xa=1;var r=wi(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var m=[],y=0;y<256;++y)m.push("%"+((y<16?"0":"")+y.toString(16)).toUpperCase());return m}(),i=function(y){for(;y.length>1;){var w=y.pop(),_=w.obj[w.prop];if(t(_)){for(var b=[],k=0;k<_.length;++k)typeof _[k]<"u"&&b.push(_[k]);w.obj[w.prop]=b}}},s=function(y,w){for(var _=w&&w.plainObjects?Object.create(null):{},b=0;b<y.length;++b)typeof y[b]<"u"&&(_[b]=y[b]);return _},o=function m(y,w,_){if(!w)return y;if(typeof w!="object"){if(t(y))y.push(w);else if(y&&typeof y=="object")(_&&(_.plainObjects||_.allowPrototypes)||!e.call(Object.prototype,w))&&(y[w]=!0);else return[y,w];return y}if(!y||typeof y!="object")return[y].concat(w);var b=y;return t(y)&&!t(w)&&(b=s(y,_)),t(y)&&t(w)?(w.forEach(function(k,S){if(e.call(y,S)){var O=y[S];O&&typeof O=="object"&&k&&typeof k=="object"?y[S]=m(O,k,_):y.push(k)}else y[S]=k}),y):Object.keys(w).reduce(function(k,S){var O=w[S];return e.call(k,S)?k[S]=m(k[S],O,_):k[S]=O,k},b)},l=function(y,w){return Object.keys(w).reduce(function(_,b){return _[b]=w[b],_},y)},a=function(m,y,w){var _=m.replace(/\+/g," ");if(w==="iso-8859-1")return _.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(_)}catch{return _}},u=1024,c=function(y,w,_,b,k){if(y.length===0)return y;var S=y;if(typeof y=="symbol"?S=Symbol.prototype.toString.call(y):typeof y!="string"&&(S=String(y)),_==="iso-8859-1")return escape(S).replace(/%u[0-9a-f]{4}/gi,function(W){return"%26%23"+parseInt(W.slice(2),16)+"%3B"});for(var O="",C=0;C<S.length;C+=u){for(var F=S.length>=u?S.slice(C,C+u):S,R=[],Y=0;Y<F.length;++Y){var B=F.charCodeAt(Y);if(B===45||B===46||B===95||B===126||B>=48&&B<=57||B>=65&&B<=90||B>=97&&B<=122||k===r.RFC1738&&(B===40||B===41)){R[R.length]=F.charAt(Y);continue}if(B<128){R[R.length]=n[B];continue}if(B<2048){R[R.length]=n[192|B>>6]+n[128|B&63];continue}if(B<55296||B>=57344){R[R.length]=n[224|B>>12]+n[128|B>>6&63]+n[128|B&63];continue}Y+=1,B=65536+((B&1023)<<10|F.charCodeAt(Y)&1023),R[R.length]=n[240|B>>18]+n[128|B>>12&63]+n[128|B>>6&63]+n[128|B&63]}O+=R.join("")}return O},h=function(y){for(var w=[{obj:{o:y},prop:"o"}],_=[],b=0;b<w.length;++b)for(var k=w[b],S=k.obj[k.prop],O=Object.keys(S),C=0;C<O.length;++C){var F=O[C],R=S[F];typeof R=="object"&&R!==null&&_.indexOf(R)===-1&&(w.push({obj:S,prop:F}),_.push(R))}return i(w),y},f=function(y){return Object.prototype.toString.call(y)==="[object RegExp]"},d=function(y){return!y||typeof y!="object"?!1:!!(y.constructor&&y.constructor.isBuffer&&y.constructor.isBuffer(y))},g=function(y,w){return[].concat(y,w)},p=function(y,w){if(t(y)){for(var _=[],b=0;b<y.length;b+=1)_.push(w(y[b]));return _}return w(y)};return bi={arrayToObject:s,assign:l,combine:g,compact:h,decode:a,encode:c,isBuffer:d,isRegExp:f,maybeMap:p,merge:o},bi}var vi,Ua;function Rh(){if(Ua)return vi;Ua=1;var r=Ch(),e=ja(),t=wi(),n=Object.prototype.hasOwnProperty,i={brackets:function(m){return m+"[]"},comma:"comma",indices:function(m,y){return m+"["+y+"]"},repeat:function(m){return m}},s=Array.isArray,o=Array.prototype.push,l=function(p,m){o.apply(p,s(m)?m:[m])},a=Date.prototype.toISOString,u=t.default,c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,format:u,formatter:t.formatters[u],indices:!1,serializeDate:function(m){return a.call(m)},skipNulls:!1,strictNullHandling:!1},h=function(m){return typeof m=="string"||typeof m=="number"||typeof m=="boolean"||typeof m=="symbol"||typeof m=="bigint"},f={},d=function p(m,y,w,_,b,k,S,O,C,F,R,Y,B,W,ee,D,he,X){for(var A=m,ne=X,te=0,ce=!1;(ne=ne.get(f))!==void 0&&!ce;){var $=ne.get(m);if(te+=1,typeof $<"u"){if($===te)throw new RangeError("Cyclic object value");ce=!0}typeof ne.get(f)>"u"&&(te=0)}if(typeof F=="function"?A=F(y,A):A instanceof Date?A=B(A):w==="comma"&&s(A)&&(A=e.maybeMap(A,function(Rt){return Rt instanceof Date?B(Rt):Rt})),A===null){if(k)return C&&!D?C(y,c.encoder,he,"key",W):y;A=""}if(h(A)||e.isBuffer(A)){if(C){var re=D?y:C(y,c.encoder,he,"key",W);return[ee(re)+"="+ee(C(A,c.encoder,he,"value",W))]}return[ee(y)+"="+ee(String(A))]}var K=[];if(typeof A>"u")return K;var se;if(w==="comma"&&s(A))D&&C&&(A=e.maybeMap(A,C)),se=[{value:A.length>0?A.join(",")||null:void 0}];else if(s(F))se=F;else{var ue=Object.keys(A);se=R?ue.sort(R):ue}var me=O?y.replace(/\./g,"%2E"):y,U=_&&s(A)&&A.length===1?me+"[]":me;if(b&&s(A)&&A.length===0)return U+"[]";for(var pe=0;pe<se.length;++pe){var Re=se[pe],$e=typeof Re=="object"&&typeof Re.value<"u"?Re.value:A[Re];if(!(S&&$e===null)){var ze=Y&&O?Re.replace(/\./g,"%2E"):Re,tt=s(A)?typeof w=="function"?w(U,ze):U:U+(Y?"."+ze:"["+ze+"]");X.set(m,te);var Kt=r();Kt.set(f,X),l(K,p($e,tt,w,_,b,k,S,O,w==="comma"&&D&&s(A)?null:C,F,R,Y,B,W,ee,D,he,Kt))}}return K},g=function(m){if(!m)return c;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.encodeDotInKeys<"u"&&typeof m.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(m.encoder!==null&&typeof m.encoder<"u"&&typeof m.encoder!="function")throw new TypeError("Encoder has to be a function.");var y=m.charset||c.charset;if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var w=t.default;if(typeof m.format<"u"){if(!n.call(t.formatters,m.format))throw new TypeError("Unknown format option provided.");w=m.format}var _=t.formatters[w],b=c.filter;(typeof m.filter=="function"||s(m.filter))&&(b=m.filter);var k;if(m.arrayFormat in i?k=m.arrayFormat:"indices"in m?k=m.indices?"indices":"repeat":k=c.arrayFormat,"commaRoundTrip"in m&&typeof m.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var S=typeof m.allowDots>"u"?m.encodeDotInKeys===!0?!0:c.allowDots:!!m.allowDots;return{addQueryPrefix:typeof m.addQueryPrefix=="boolean"?m.addQueryPrefix:c.addQueryPrefix,allowDots:S,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:k,charset:y,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:c.charsetSentinel,commaRoundTrip:m.commaRoundTrip,delimiter:typeof m.delimiter>"u"?c.delimiter:m.delimiter,encode:typeof m.encode=="boolean"?m.encode:c.encode,encodeDotInKeys:typeof m.encodeDotInKeys=="boolean"?m.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof m.encoder=="function"?m.encoder:c.encoder,encodeValuesOnly:typeof m.encodeValuesOnly=="boolean"?m.encodeValuesOnly:c.encodeValuesOnly,filter:b,format:w,formatter:_,serializeDate:typeof m.serializeDate=="function"?m.serializeDate:c.serializeDate,skipNulls:typeof m.skipNulls=="boolean"?m.skipNulls:c.skipNulls,sort:typeof m.sort=="function"?m.sort:null,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:c.strictNullHandling}};return vi=function(p,m){var y=p,w=g(m),_,b;typeof w.filter=="function"?(b=w.filter,y=b("",y)):s(w.filter)&&(b=w.filter,_=b);var k=[];if(typeof y!="object"||y===null)return"";var S=i[w.arrayFormat],O=S==="comma"&&w.commaRoundTrip;_||(_=Object.keys(y)),w.sort&&_.sort(w.sort);for(var C=r(),F=0;F<_.length;++F){var R=_[F];w.skipNulls&&y[R]===null||l(k,d(y[R],R,S,O,w.allowEmptyArrays,w.strictNullHandling,w.skipNulls,w.encodeDotInKeys,w.encode?w.encoder:null,w.filter,w.sort,w.allowDots,w.serializeDate,w.format,w.formatter,w.encodeValuesOnly,w.charset,C))}var Y=k.join(w.delimiter),B=w.addQueryPrefix===!0?"?":"";return w.charsetSentinel&&(w.charset==="iso-8859-1"?B+="utf8=%26%2310003%3B&":B+="utf8=%E2%9C%93&"),Y.length>0?B+Y:""},vi}var Si,Ba;function Nh(){if(Ba)return Si;Ba=1;var r=ja(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(f){return f.replace(/&#(\d+);/g,function(d,g){return String.fromCharCode(parseInt(g,10))})},s=function(f,d){return f&&typeof f=="string"&&d.comma&&f.indexOf(",")>-1?f.split(","):f},o="utf8=%26%2310003%3B",l="utf8=%E2%9C%93",a=function(d,g){var p={__proto__:null},m=g.ignoreQueryPrefix?d.replace(/^\?/,""):d;m=m.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var y=g.parameterLimit===1/0?void 0:g.parameterLimit,w=m.split(g.delimiter,y),_=-1,b,k=g.charset;if(g.charsetSentinel)for(b=0;b<w.length;++b)w[b].indexOf("utf8=")===0&&(w[b]===l?k="utf-8":w[b]===o&&(k="iso-8859-1"),_=b,b=w.length);for(b=0;b<w.length;++b)if(b!==_){var S=w[b],O=S.indexOf("]="),C=O===-1?S.indexOf("="):O+1,F,R;C===-1?(F=g.decoder(S,n.decoder,k,"key"),R=g.strictNullHandling?null:""):(F=g.decoder(S.slice(0,C),n.decoder,k,"key"),R=r.maybeMap(s(S.slice(C+1),g),function(B){return g.decoder(B,n.decoder,k,"value")})),R&&g.interpretNumericEntities&&k==="iso-8859-1"&&(R=i(R)),S.indexOf("[]=")>-1&&(R=t(R)?[R]:R);var Y=e.call(p,F);Y&&g.duplicates==="combine"?p[F]=r.combine(p[F],R):(!Y||g.duplicates==="last")&&(p[F]=R)}return p},u=function(f,d,g,p){for(var m=p?d:s(d,g),y=f.length-1;y>=0;--y){var w,_=f[y];if(_==="[]"&&g.parseArrays)w=g.allowEmptyArrays&&(m===""||g.strictNullHandling&&m===null)?[]:[].concat(m);else{w=g.plainObjects?Object.create(null):{};var b=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,k=g.decodeDotInKeys?b.replace(/%2E/g,"."):b,S=parseInt(k,10);!g.parseArrays&&k===""?w={0:m}:!isNaN(S)&&_!==k&&String(S)===k&&S>=0&&g.parseArrays&&S<=g.arrayLimit?(w=[],w[S]=m):k!=="__proto__"&&(w[k]=m)}m=w}return m},c=function(d,g,p,m){if(d){var y=p.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,w=/(\[[^[\]]*])/,_=/(\[[^[\]]*])/g,b=p.depth>0&&w.exec(y),k=b?y.slice(0,b.index):y,S=[];if(k){if(!p.plainObjects&&e.call(Object.prototype,k)&&!p.allowPrototypes)return;S.push(k)}for(var O=0;p.depth>0&&(b=_.exec(y))!==null&&O<p.depth;){if(O+=1,!p.plainObjects&&e.call(Object.prototype,b[1].slice(1,-1))&&!p.allowPrototypes)return;S.push(b[1])}if(b){if(p.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+p.depth+" and strictDepth is true");S.push("["+y.slice(b.index)+"]")}return u(S,g,p,m)}},h=function(d){if(!d)return n;if(typeof d.allowEmptyArrays<"u"&&typeof d.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof d.decodeDotInKeys<"u"&&typeof d.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(d.decoder!==null&&typeof d.decoder<"u"&&typeof d.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof d.charset<"u"&&d.charset!=="utf-8"&&d.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var g=typeof d.charset>"u"?n.charset:d.charset,p=typeof d.duplicates>"u"?n.duplicates:d.duplicates;if(p!=="combine"&&p!=="first"&&p!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var m=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:n.allowDots:!!d.allowDots;return{allowDots:m,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:n.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:n.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:n.arrayLimit,charset:g,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:n.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:n.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:n.decoder,delimiter:typeof d.delimiter=="string"||r.isRegExp(d.delimiter)?d.delimiter:n.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:n.depth,duplicates:p,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:n.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:n.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:n.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:n.strictNullHandling}};return Si=function(f,d){var g=h(d);if(f===""||f===null||typeof f>"u")return g.plainObjects?Object.create(null):{};for(var p=typeof f=="string"?a(f,g):f,m=g.plainObjects?Object.create(null):{},y=Object.keys(p),w=0;w<y.length;++w){var _=y[w],b=c(_,p[_],g,typeof f=="string");m=r.merge(m,b,g)}return g.allowSparse===!0?m:r.compact(m)},Si}var _i,$a;function Ph(){if($a)return _i;$a=1;var r=Rh(),e=Nh(),t=wi();return _i={formats:t,parse:e,stringify:r},_i}var Fh=Ph();const Ei=ua(Fh);let Wa=class{#e;#t;#r;#n;_logger=null;#i="";constructor(e,t,n){this.#e=be.create({baseURL:e,...n}),this.#t=t,this.#r=new Lu,this.#n=new Uu}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#i=e}clearLogTag(){this.#i=""}async batch(e,t=!0){const n=Array.isArray(e),i=n?[]:{};let s=0;const o=(l,a)=>{let u=null,c=null;if(Array.isArray(l)?(u=l[0],c=l[1]):l.method&&(u=l.method,c=l.params),u){s++;const h=u+"?"+Ei.stringify(c);n||Array.isArray(i)?i.push(h):i[a]=h}};if(n)for(const[l,a]of e.entries())o(a,l);else for(const[l,a]of Object.entries(e))o(a,l);return s<1?Promise.resolve(new Vt):this.call("batch",{halt:t?1:0,cmd:i}).then(l=>{const a=l.getData().result,u=n?[]:{},c=(g,p)=>{if(typeof a.result[p]<"u"||typeof a.result_error[p]<"u"){const m=g.split("?"),y=new Rn({result:x.isUndefined(a.result[p])?{}:a.result[p],error:a?.result_error[p]||void 0,total:a.result_total[p],next:a.result_next[p]},{method:m[0]||"",params:Ei.parse(m[1]||""),start:0},l.getStatus());n||Array.isArray(u)?u.push(y):u[p]=y}};if(Array.isArray(i))for(const[g,p]of i.entries())c(p,g);else for(const[g,p]of Object.entries(i))c(p,g);let h;const f=g=>new ur({status:0,answerError:{error:g.getErrorMessages().join("; "),errorDescription:`batch ${g.getQuery().method}: ${Ei.stringify(g.getQuery().params,{encode:!1})}`},cause:g.getErrors().next().value}),d=new Vt;if(n||Array.isArray(u)){h=[];for(const g of u){if(g.getStatus()!==200||!g.isSuccess){const p=f(g);if(!t&&!g.isSuccess){d.addError(p);continue}return Promise.reject(p)}h.push(g.getData().result)}}else{h={};for(const g of Object.keys(u)){const p=u[g];if(p.getStatus()!==200||!p.isSuccess){const m=f(p);if(!t&&!p.isSuccess){d.addError(m);continue}return Promise.reject(m)}h[g]=p.getData().result}}return d.setData(h),Promise.resolve(d)})}async call(e,t,n=0){let i=this.#t.getAuthData();return i===!1&&(i=await this.#t.refreshAuth()),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,t,n)).then(s=>{const o=s.data;return Promise.resolve({status:s.status,payload:o})},async s=>{let o={error:s?.code||0,errorDescription:s?.message||""};if(s instanceof ca&&s.response&&s.response.data){const a=s.response.data;o={error:a.error,errorDescription:a.error_description}}const l=new ur({status:s.response?.status||0,answerError:o,cause:s});return l.status===401&&["expired_token","invalid_token"].includes(l.answerError.error)?(this.getLogger().info(`refreshAuth >> ${l.answerError.error} >>>`),i=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,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 ca&&a.response&&a.response.data){const h=a.response.data;u={error:h.error,errorDescription:h.error_description}}const c=new ur({status:a.response?.status||0,answerError:u,cause:a});return Promise.reject(c)})):Promise.reject(l)}).then(s=>{const o=new Rn(s.payload,{method:e,params:t,start:n},s.status);return Promise.resolve(o)})}#o(e,t,n=0){const i=Object.assign({},t);return this.#i.length>0&&(i.logTag=this.#i),i[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),i[this.#n.getQueryStringSdkParameterName()]="0.1.2",i.data&&i.data.start&&delete i.data.start,e.refresh_token!=="hook"&&(i.auth=e.access_token),i.start=n,i}#s(e){return`${encodeURIComponent(e)}.json`}};class Gt{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=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,i=null){const s=new Vt;return x.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let l=[],a;if(i===null?a=o.getData().result:a=o.getData().result[i],l=[...l,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let c;if(i===null?c=u.getData().result:c=u.getData().result[i],l=[...l,...c],n){const h=u.getTotal();n(h>0?Math.round(100*l.length/h):100)}}}return s.setData(l),n&&n(100),s})}async*fetchListMethod(e,t={},n="ID",i=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const s=`>${n}`;t.order[n]="ASC",t.filter[s]=0;do{const o=await this.callMethod(e,t,t.start);let l;if(x.isNull(i)&&i!==null?l=o.getData().result[i]:l=o.getData().result,l.length===0||(yield l,l.length<Gt.batchSize))break;const a=l.at(-1);a&&n in a&&(t.filter[s]=a[n])}while(!0)}async callBatch(e,t=!0){return this.getHttpClient().batch(e,t)}chunkArray(e,t=50){const n=[];for(let i=0;i<e.length;i+=t){const s=e.slice(i,i+t);n.push(s)}return n}async callBatchByChunk(e,t=!0){const n=new Vt,i=[],s=this.chunkArray(e,Gt.batchSize);for(const o of s){const l=await this.callBatch(o,t);i.push(...l.getData())}return n.setData(i)}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 ki=(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))(ki||{});const Mh=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let Lh=class bt{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!bt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");bt.isInternalConstructing=!1}static getInstance(){return bt.instance||(bt.isInternalConstructing=!0,bt.instance=new bt),bt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!x.isStringFilled(t))&&(t=x.isStringFilled(this._defLocale)?this._defLocale||"en":navigator?.language),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let i=n.format(e);return t.includes("ru")&&(i=i.replace(",",".")),i}};class I{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,i){this.countryCode=e,this.length=t,this.structure=n,this.example=i}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 i;const s=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(s){case"A":i="0-9A-Za-z";break;case"B":i="0-9A-Z";break;case"C":i="A-Za-z";break;case"F":i="0-9";break;case"L":i="a-z";break;case"U":i="A-Z";break;case"W":i="0-9a-z";break}return"(["+i+"]{"+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 lt{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!lt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");lt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return lt.instance||(lt.isInternalConstructing=!0,lt.instance=new lt),lt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!this._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 i=this._countries.get(n);if(!i)throw new Error(`No country with code ${n}`);return i.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(!this._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))}_isString(e){return typeof e=="string"||e instanceof String}}const Dh=()=>{const r=Lh.getInstance(),e=lt.getInstance();return e.addSpecification(new I("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new I("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new I("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new I("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new I("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new I("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new I("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new I("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new I("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new I("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new I("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new I("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new I("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new I("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new I("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new I("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new I("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new I("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new I("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new I("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new I("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new I("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new I("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new I("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new I("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new I("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new I("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new I("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new I("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new I("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new I("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new I("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new I("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new I("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new I("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new I("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new I("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new I("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new I("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new I("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new I("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new I("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new I("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new I("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new I("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new I("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new I("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new I("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new I("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new I("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new I("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new I("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new I("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new I("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new I("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new I("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new I("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new I("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new I("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new I("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new I("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new I("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new I("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new I("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new I("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new I("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new I("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new I("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new I("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new I("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new I("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new I("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new I("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new I("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new I("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new I("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new I("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new I("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new I("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new I("BI",16,"F12","BI41123456789012")),e.addSpecification(new I("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new I("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new I("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new I("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new I("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new I("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new I("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new I("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new I("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new I("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new I("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new I("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new I("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new I("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new I("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new I("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new I("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new I("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new I("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new I("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new I("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new I("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class qa{#e;constructor(e){this.#e=Object.freeze(Object.assign({},e))}getAuthData(){const e=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:e,member_id:e}}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.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class xh extends Gt{#e;constructor(e){super(),this.#e=new qa(e),this._http=new Wa(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var fe=(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))(fe||{});class Va{#e;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.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,i)=>{let s;const o={resolve:n,reject:i,timeoutId:null},l=this.#r(o);if(e.toString().includes(":"))s={method:e.toString(),params:t??"",callback:l,appSid:this.#e.getAppSid()};else{s=e.toString();const a=[t?JSON.stringify(t):null,l,this.#e.getAppSid()];s+=":"+a.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:s}),parent.postMessage(s,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 i=this.#t.get(n.id);i.timeoutId&&clearTimeout(i.timeoutId),this.#t.delete(n.id),i.resolve(n.args)}}}#r(e){const t=G.getUniqId();return this.#t.set(t,e),t}}class Ha{#e="";#t=!0;#r=null;#n=null;#i=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#i=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.#i||(this.#i=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.#i||ki.en}}class za{#e=null;#t=null;#r=0;#n=null;#i=!1;#o;#s;constructor(e,t){this.#o=e,this.#s=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#i=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#s.send(fe.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.#n||""].join("_")}get isAdmin(){return this.#i}}class Ja{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(fe.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(fe.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(fe.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 i=document.body;let s=Math.max(i.scrollWidth,i.offsetWidth);n>0&&(s=Math.max(n,s));let o=Math.max(i.scrollHeight,i.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(s,o)}getScrollSize(){return Mh()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(fe.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(fe.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(fe.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(fe.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(fe.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(fe.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(fe.imOpenHistory,{dialogId:e,isSafely:!0})}}let Ga=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(fe.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(fe.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 Za{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(fe.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(fe.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(fe.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(fe.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Ya{#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(fe.openApplication,e)}async closeSliderAppPage(){return this.#t.send(fe.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(fe.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(i=>i?.result==="error"?i?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((s,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),s({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(c),s({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(i?.errorCode)):i?.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(fe.showAppForm,{params:e,isSafely:!0})}}class Ka{#e="";#t={};constructor(){}initData(e){this.#e=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class Qa extends Gt{#e=!1;#t=!1;#r;#n;#i;#o;#s;#l;#c;#a;constructor(e){super(),this.#r=new Ha(e),this.#n=new Va(this.#r),this.#n.subscribe(),this.#i=new za(this.#r,this.#n),this.#o=new Ja(this.#n),this.#s=new Ga(this.#n),this.#l=new Za(this.#n),this.#c=new Ya(this.#r,this.#n),this.#a=new Ka,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.#o}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#a}get options(){return this._ensureInitialized(),this.#s}get dialog(){return this._ensureInitialized(),this.#l}async init(){return this.#n.send(fe.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#r.initData(e),this.#i.initData(e),this.#a.initData(e),this.#s.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new Wa(this.#r.getTargetOriginWithPath(),this.#i,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(fe.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(fe.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 Oi 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 Zt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class jh extends Zt{_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 Uh extends Zt{_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 ko[this.data.status]||"Unknown status"}}class Bh extends Zt{_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 $h extends Zt{_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`,An),this._b24.getHttpClient().setRestrictionManagerParams(An))}}class Wh extends Zt{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,i=this.data.currencyList.get(n);if(!(typeof i>"u"))for(const[s,o]of Object.entries(t.LANG))switch(i.lang[s]={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},i.lang[s].thousandsVariant){case"N":i.lang[s].thousandsSep="";break;case"D":i.lang[s].thousandsSep=".";break;case"C":i.lang[s].thousandsSep=",";break;case"S":i.lang[s].thousandsSep=" ";break;case"B":i.lang[s].thousandsSep="&nbsp;";break;default:x.isStringFilled(i.lang[s].thousandsSep)||(i.lang[s].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:G.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 Oi(e);let i=n.fullName;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.fullName)}return i}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Oi(e);let i=n.formatString;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.formatString)}return i.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const i=this.data.currencyList.get(t);if(typeof i>"u")throw new Oi(t);const s={formatString:i.formatString,decimals:i.decimals,decPoint:i.decPoint,thousandsSep:i.thousandsSep};x.isStringFilled(s.thousandsSep)||(s.thousandsSep="");const o=i.lang[n];return x.isUndefined(o)||(s.formatString=o.formatString,s.decimals=o.decimals,s.decPoint=o.decPoint,s.thousandsSep=o.thousandsSep),s.formatString.replaceAll("&#","&%").replace("#",G.numberFormat(e,s.decimals,s.decPoint,s.thousandsSep)).replaceAll("&%","&#")||""}}class Ti extends Zt{_data;_type;static getSupportTypes(){return[at.NotSet,at.JsonArray,at.JsonObject,at.FloatVal,at.IntegerVal,at.BoolYN,at.StringVal]}static prepareArrayList(e){return x.isArray(e)?e:x.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(),x.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),!x.isArray(n)&&!x.isObject(n)&&(n=t)}catch(i){this.getLogger().error(i),n=t}return Ti.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(i){this.getLogger().error(i),n=t}return x.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?G.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?G.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?G.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?G.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=G.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}}),x.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 Xa{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?G.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.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 qh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class Vh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Zr="2.0";class Hh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,x.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=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((i,s)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||s(new qh("websocket is not connected"));const l=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),s(new Vh("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:i,reject:s,timeout:l})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:i,params:s,id:o})=>{const l=this.createRequest(i,s,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(`${G.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(`${G.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(x.isArray(t))return this.executeIncomingRpcBatch(t);if(x.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(x.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Zr,error:Cn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const i=this.executeIncomingRpcCommand(n);i&&(i.jsonrpc=Zr,i.id=n.id,t.push(i))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Zr,error:Cn.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:Zr,method:e,params:t,id:n}}}class zh{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Xa,this._callbacks={onWebSocketBlockChanged:x.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=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",xe.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(xe.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(xe.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(xe.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(xe.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class Jh{_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=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},i=[];for(const s of e){const o=this._publicIds.get(s);o&&o.end>t?n[o.userId]=o:i.push(s)}return i.length===0?Promise.resolve(n):new Promise(s=>{this._restClient.callMethod(this._getPublicListMethod,{users:i}).then(o=>{const l=o.getData().result;this.setPublicIds(Object.values(l));for(const a of i){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}s(n)}).catch(o=>(this.getLogger().error(o),s({})))})}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 Ai={exports:{}};/*!
10
+ * protobuf.js v6.8.6 (c) 2016, daniel wirtz
11
+ * compiled mon, 26 feb 2018 11:35:34 utc
12
+ * licensed under the bsd-3-clause license
13
+ * see: https://github.com/dcodeio/protobuf.js for details
14
+ *
15
+ * Modify a list for integration with Bitrix Framework:
16
+ * - removed integration with RequireJS and AMD package builders;
17
+ */var el;function Gh(){return el||(el=1,function(r){(function(e){(function(t,n,i){function s(l){var a=n[l];return a||t[l][0].call(a=n[l]={exports:{}},s,a,a.exports),a.exports}var o=s(i[0]);r&&r.exports&&(r.exports=o)})({1:[function(t,n,i){n.exports=s;function s(o,l){for(var a=new Array(arguments.length-1),u=0,c=2,h=!0;c<arguments.length;)a[u++]=arguments[c++];return new Promise(function(f,d){a[u]=function(g){if(h)if(h=!1,g)d(g);else{for(var p=new Array(arguments.length-1),m=0;m<p.length;)p[m++]=arguments[m];f.apply(null,p)}};try{o.apply(l||null,a)}catch(g){h&&(h=!1,d(g))}})}},{}],2:[function(t,n,i){var s=i;s.length=function(c){var h=c.length;if(!h)return 0;for(var f=0;--h%4>1&&c.charAt(h)==="=";)++f;return Math.ceil(c.length*3)/4-f};for(var o=new Array(64),l=new Array(123),a=0;a<64;)l[o[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;s.encode=function(c,h,f){for(var d=null,g=[],p=0,m=0,y;h<f;){var w=c[h++];switch(m){case 0:g[p++]=o[w>>2],y=(w&3)<<4,m=1;break;case 1:g[p++]=o[y|w>>4],y=(w&15)<<2,m=2;break;case 2:g[p++]=o[y|w>>6],g[p++]=o[w&63],m=0;break}p>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,g)),p=0)}return m&&(g[p++]=o[y],g[p++]=61,m===1&&(g[p++]=61)),d?(p&&d.push(String.fromCharCode.apply(String,g.slice(0,p))),d.join("")):String.fromCharCode.apply(String,g.slice(0,p))};var u="invalid encoding";s.decode=function(c,h,f){for(var d=f,g=0,p,m=0;m<c.length;){var y=c.charCodeAt(m++);if(y===61&&g>1)break;if((y=l[y])===e)throw Error(u);switch(g){case 0:p=y,g=1;break;case 1:h[f++]=p<<2|(y&48)>>4,p=y,g=2;break;case 2:h[f++]=(p&15)<<4|(y&60)>>2,p=y,g=3;break;case 3:h[f++]=(p&3)<<6|y,g=0;break}}if(g===1)throw Error(u);return f-d},s.test=function(c){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(c)}},{}],3:[function(t,n,i){n.exports=s;function s(o,l){typeof o=="string"&&(l=o,o=e);var a=[];function u(h){if(typeof h!="string"){var f=c();if(s.verbose&&console.log("codegen: "+f),f="return "+f,h){for(var d=Object.keys(h),g=new Array(d.length+1),p=new Array(d.length),m=0;m<d.length;)g[m]=d[m],p[m]=h[d[m++]];return g[m]=f,Function.apply(null,g).apply(null,p)}return Function(f)()}for(var y=new Array(arguments.length-1),w=0;w<y.length;)y[w]=arguments[++w];if(w=0,h=h.replace(/%([%dfijs])/g,function(_,b){var k=y[w++];switch(b){case"d":case"f":return String(Number(k));case"i":return String(Math.floor(k));case"j":return JSON.stringify(k);case"s":return String(k)}return"%"}),w!==y.length)throw Error("parameter count mismatch");return a.push(h),u}function c(h){return"function "+(h||l||"")+"("+(o&&o.join(",")||"")+`){
18
+ `+a.join(`
11
19
  `)+`
12
- }`}return O.toString=A,O}return _.verbose=!1,codegen_1}var fetch_1,hasRequiredFetch;function requireFetch(){if(hasRequiredFetch)return fetch_1;hasRequiredFetch=1,fetch_1=T;var _=requireAspromise(),S=requireInquire(),v=S("fs");function T(O,A,k){return typeof A=="function"?(k=A,A={}):A||(A={}),k?!A.xhr&&v&&v.readFile?v.readFile(O,function($,x){return $&&typeof XMLHttpRequest<"u"?T.xhr(O,A,k):$?k($):k(null,A.binary?x:x.toString("utf8"))}):T.xhr(O,A,k):_(T,this,O,A)}return T.xhr=function(A,k,C){var $=new XMLHttpRequest;$.onreadystatechange=function(){if($.readyState===4){if($.status!==0&&$.status!==200)return C(Error("status "+$.status));if(k.binary){var N=$.response;if(!N){N=[];for(var D=0;D<$.responseText.length;++D)N.push($.responseText.charCodeAt(D)&255)}return C(null,typeof Uint8Array<"u"?new Uint8Array(N):N)}return C(null,$.responseText)}},k.binary&&("overrideMimeType"in $&&$.overrideMimeType("text/plain; charset=x-user-defined"),$.responseType="arraybuffer"),$.open("GET",A),$.send()},fetch_1}var path={},hasRequiredPath;function requirePath(){return hasRequiredPath||(hasRequiredPath=1,function(_){var S=_,v=S.isAbsolute=function(A){return/^(?:\/|\w+:)/.test(A)},T=S.normalize=function(A){A=A.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var k=A.split("/"),C=v(A),$="";C&&($=k.shift()+"/");for(var x=0;x<k.length;)k[x]===".."?x>0&&k[x-1]!==".."?k.splice(--x,2):C?k.splice(x,1):++x:k[x]==="."?k.splice(x,1):++x;return $+k.join("/")};S.resolve=function(A,k,C){return C||(k=T(k)),v(k)?k:(C||(A=T(A)),(A=A.replace(/(?:\/|^)[^/]+$/,"")).length?T(A+"/"+k):k)}}(path)),path}var types={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(_){var S=_,v=requireUtil(),T=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function O(A,k){var C=0,$={};for(k|=0;C<A.length;)$[T[C+k]]=A[C++];return $}S.basic=O([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),S.defaults=O([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",v.emptyArray,null]),S.long=O([0,0,0,1,1],7),S.mapKey=O([0,0,0,5,5,0,0,0,1,1,0,2],2),S.packed=O([1,5,0,0,0,5,5,0,0,0,1,1,0])}(types)),types}var field,hasRequiredField;function requireField(){if(hasRequiredField)return field;hasRequiredField=1,field=k;var _=requireObject();((k.prototype=Object.create(_.prototype)).constructor=k).className="Field";var S=require_enum(),v=requireTypes(),T=requireUtil(),O,A=/^required|optional|repeated$/;k.fromJSON=function($,x){return new k($,x.id,x.type,x.rule,x.extend,x.options,x.comment)};function k(C,$,x,N,D,q,M){if(T.isObject(N)?(M=D,q=N,N=D=void 0):T.isObject(D)&&(M=q,q=D,D=void 0),_.call(this,C,q),!T.isInteger($)||$<0)throw TypeError("id must be a non-negative integer");if(!T.isString(x))throw TypeError("type must be a string");if(N!==void 0&&!A.test(N=N.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(D!==void 0&&!T.isString(D))throw TypeError("extend must be a string");N==="proto3_optional"&&(N="optional"),this.rule=N&&N!=="optional"?N:void 0,this.type=x,this.id=$,this.extend=D||void 0,this.required=N==="required",this.optional=!this.required,this.repeated=N==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=T.Long?v.long[x]!==void 0:!1,this.bytes=x==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=M}return Object.defineProperty(k.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),k.prototype.setOption=function($,x,N){return $==="packed"&&(this._packed=null),_.prototype.setOption.call(this,$,x,N)},k.prototype.toJSON=function($){var x=$?!!$.keepComments:!1;return T.toObject(["rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",x?this.comment:void 0])},k.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=v.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof O?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof S&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof S))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=T.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var $;T.base64.test(this.typeDefault)?T.base64.decode(this.typeDefault,$=T.newBuffer(T.base64.length(this.typeDefault)),0):T.utf8.write(this.typeDefault,$=T.newBuffer(T.utf8.length(this.typeDefault)),0),this.typeDefault=$}return this.map?this.defaultValue=T.emptyObject:this.repeated?this.defaultValue=T.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof O&&(this.parent.ctor.prototype[this.name]=this.defaultValue),_.prototype.resolve.call(this)},k.d=function($,x,N,D){return typeof x=="function"?x=T.decorateType(x).name:x&&typeof x=="object"&&(x=T.decorateEnum(x).name),function(M,U){T.decorateType(M.constructor).add(new k(U,$,x,N,{default:D}))}},k._configure=function($){O=$},field}var oneof,hasRequiredOneof;function requireOneof(){if(hasRequiredOneof)return oneof;hasRequiredOneof=1,oneof=T;var _=requireObject();((T.prototype=Object.create(_.prototype)).constructor=T).className="OneOf";var S=requireField(),v=requireUtil();function T(A,k,C,$){if(Array.isArray(k)||(C=k,k=void 0),_.call(this,A,C),!(k===void 0||Array.isArray(k)))throw TypeError("fieldNames must be an Array");this.oneof=k||[],this.fieldsArray=[],this.comment=$}T.fromJSON=function(k,C){return new T(k,C.oneof,C.options,C.comment)},T.prototype.toJSON=function(k){var C=k?!!k.keepComments:!1;return v.toObject(["options",this.options,"oneof",this.oneof,"comment",C?this.comment:void 0])};function O(A){if(A.parent)for(var k=0;k<A.fieldsArray.length;++k)A.fieldsArray[k].parent||A.parent.add(A.fieldsArray[k])}return T.prototype.add=function(k){if(!(k instanceof S))throw TypeError("field must be a Field");return k.parent&&k.parent!==this.parent&&k.parent.remove(k),this.oneof.push(k.name),this.fieldsArray.push(k),k.partOf=this,O(this),this},T.prototype.remove=function(k){if(!(k instanceof S))throw TypeError("field must be a Field");var C=this.fieldsArray.indexOf(k);if(C<0)throw Error(k+" is not a member of "+this);return this.fieldsArray.splice(C,1),C=this.oneof.indexOf(k.name),C>-1&&this.oneof.splice(C,1),k.partOf=null,this},T.prototype.onAdd=function(k){_.prototype.onAdd.call(this,k);for(var C=this,$=0;$<this.oneof.length;++$){var x=k.get(this.oneof[$]);x&&!x.partOf&&(x.partOf=C,C.fieldsArray.push(x))}O(this)},T.prototype.onRemove=function(k){for(var C=0,$;C<this.fieldsArray.length;++C)($=this.fieldsArray[C]).parent&&$.parent.remove($);_.prototype.onRemove.call(this,k)},T.d=function(){for(var k=new Array(arguments.length),C=0;C<arguments.length;)k[C]=arguments[C++];return function(x,N){v.decorateType(x.constructor).add(new T(N,k)),Object.defineProperty(x,N,{get:v.oneOfGetter(k),set:v.oneOfSetter(k)})}},oneof}var namespace,hasRequiredNamespace;function requireNamespace(){if(hasRequiredNamespace)return namespace;hasRequiredNamespace=1,namespace=$;var _=requireObject();(($.prototype=Object.create(_.prototype)).constructor=$).className="Namespace";var S=requireField(),v=requireUtil(),T=requireOneof(),O,A,k;$.fromJSON=function(D,q){return new $(D,q.options).addJSON(q.nested)};function C(N,D){if(N&&N.length){for(var q={},M=0;M<N.length;++M)q[N[M].name]=N[M].toJSON(D);return q}}$.arrayToJSON=C,$.isReservedId=function(D,q){if(D){for(var M=0;M<D.length;++M)if(typeof D[M]!="string"&&D[M][0]<=q&&D[M][1]>q)return!0}return!1},$.isReservedName=function(D,q){if(D){for(var M=0;M<D.length;++M)if(D[M]===q)return!0}return!1};function $(N,D){_.call(this,N,D),this.nested=void 0,this._nestedArray=null}function x(N){return N._nestedArray=null,N}return Object.defineProperty($.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=v.toArray(this.nested))}}),$.prototype.toJSON=function(D){return v.toObject(["options",this.options,"nested",C(this.nestedArray,D)])},$.prototype.addJSON=function(D){var q=this;if(D)for(var M=Object.keys(D),U=0,z;U<M.length;++U)z=D[M[U]],q.add((z.fields!==void 0?O.fromJSON:z.values!==void 0?k.fromJSON:z.methods!==void 0?A.fromJSON:z.id!==void 0?S.fromJSON:$.fromJSON)(M[U],z));return this},$.prototype.get=function(D){return this.nested&&this.nested[D]||null},$.prototype.getEnum=function(D){if(this.nested&&this.nested[D]instanceof k)return this.nested[D].values;throw Error("no such enum: "+D)},$.prototype.add=function(D){if(!(D instanceof S&&D.extend!==void 0||D instanceof O||D instanceof T||D instanceof k||D instanceof A||D instanceof $))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var q=this.get(D.name);if(q)if(q instanceof $&&D instanceof $&&!(q instanceof O||q instanceof A)){for(var M=q.nestedArray,U=0;U<M.length;++U)D.add(M[U]);this.remove(q),this.nested||(this.nested={}),D.setOptions(q.options,!0)}else throw Error("duplicate name '"+D.name+"' in "+this)}return this.nested[D.name]=D,D.onAdd(this),x(this)},$.prototype.remove=function(D){if(!(D instanceof _))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=void 0),D.onRemove(this),x(this)},$.prototype.define=function(D,q){if(v.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 U=D.shift();if(M.nested&&M.nested[U]){if(M=M.nested[U],!(M instanceof $))throw Error("path conflicts with non-namespace objects")}else M.add(M=new $(U))}return q&&M.addJSON(q),M},$.prototype.resolveAll=function(){for(var D=this.nestedArray,q=0;q<D.length;)D[q]instanceof $?D[q++].resolveAll():D[q++].resolve();return this.resolve()},$.prototype.lookup=function(D,q,M){if(typeof q=="boolean"?(M=q,q=void 0):q&&!Array.isArray(q)&&(q=[q]),v.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),q);var U=this.get(D[0]);if(U){if(D.length===1){if(!q||q.indexOf(U.constructor)>-1)return U}else if(U instanceof $&&(U=U.lookup(D.slice(1),q,!0)))return U}else for(var z=0;z<this.nestedArray.length;++z)if(this._nestedArray[z]instanceof $&&(U=this._nestedArray[z].lookup(D,q,!0)))return U;return this.parent===null||M?null:this.parent.lookup(D,q)},$.prototype.lookupType=function(D){var q=this.lookup(D,[O]);if(!q)throw Error("no such type: "+D);return q},$.prototype.lookupEnum=function(D){var q=this.lookup(D,[k]);if(!q)throw Error("no such Enum '"+D+"' in "+this);return q},$.prototype.lookupTypeOrEnum=function(D){var q=this.lookup(D,[O,k]);if(!q)throw Error("no such Type or Enum '"+D+"' in "+this);return q},$.prototype.lookupService=function(D){var q=this.lookup(D,[A]);if(!q)throw Error("no such Service '"+D+"' in "+this);return q},$._configure=function(N,D,q){O=N,A=D,k=q},namespace}var mapfield,hasRequiredMapfield;function requireMapfield(){if(hasRequiredMapfield)return mapfield;hasRequiredMapfield=1,mapfield=T;var _=requireField();((T.prototype=Object.create(_.prototype)).constructor=T).className="MapField";var S=requireTypes(),v=requireUtil();function T(O,A,k,C,$,x){if(_.call(this,O,A,C,void 0,void 0,$,x),!v.isString(k))throw TypeError("keyType must be a string");this.keyType=k,this.resolvedKeyType=null,this.map=!0}return T.fromJSON=function(A,k){return new T(A,k.id,k.keyType,k.type,k.options,k.comment)},T.prototype.toJSON=function(A){var k=A?!!A.keepComments:!1;return v.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",k?this.comment:void 0])},T.prototype.resolve=function(){if(this.resolved)return this;if(S.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return _.prototype.resolve.call(this)},T.d=function(A,k,C){return typeof C=="function"?C=v.decorateType(C).name:C&&typeof C=="object"&&(C=v.decorateEnum(C).name),function(x,N){v.decorateType(x.constructor).add(new T(N,A,k,C))}},mapfield}var method,hasRequiredMethod;function requireMethod(){if(hasRequiredMethod)return method;hasRequiredMethod=1,method=v;var _=requireObject();((v.prototype=Object.create(_.prototype)).constructor=v).className="Method";var S=requireUtil();function v(T,O,A,k,C,$,x,N,D){if(S.isObject(C)?(x=C,C=$=void 0):S.isObject($)&&(x=$,$=void 0),!(O===void 0||S.isString(O)))throw TypeError("type must be a string");if(!S.isString(A))throw TypeError("requestType must be a string");if(!S.isString(k))throw TypeError("responseType must be a string");_.call(this,T,x),this.type=O||"rpc",this.requestType=A,this.requestStream=C?!0:void 0,this.responseType=k,this.responseStream=$?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=N,this.parsedOptions=D}return v.fromJSON=function(O,A){return new v(O,A.type,A.requestType,A.responseType,A.requestStream,A.responseStream,A.options,A.comment,A.parsedOptions)},v.prototype.toJSON=function(O){var A=O?!!O.keepComments:!1;return S.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",A?this.comment:void 0,"parsedOptions",this.parsedOptions])},v.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),_.prototype.resolve.call(this))},method}var service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=O;var _=requireNamespace();((O.prototype=Object.create(_.prototype)).constructor=O).className="Service";var S=requireMethod(),v=requireUtil(),T=requireRpc();function O(k,C){_.call(this,k,C),this.methods={},this._methodsArray=null}O.fromJSON=function(C,$){var x=new O(C,$.options);if($.methods)for(var N=Object.keys($.methods),D=0;D<N.length;++D)x.add(S.fromJSON(N[D],$.methods[N[D]]));return $.nested&&x.addJSON($.nested),x.comment=$.comment,x},O.prototype.toJSON=function(C){var $=_.prototype.toJSON.call(this,C),x=C?!!C.keepComments:!1;return v.toObject(["options",$&&$.options||void 0,"methods",_.arrayToJSON(this.methodsArray,C)||{},"nested",$&&$.nested||void 0,"comment",x?this.comment:void 0])},Object.defineProperty(O.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=v.toArray(this.methods))}});function A(k){return k._methodsArray=null,k}return O.prototype.get=function(C){return this.methods[C]||_.prototype.get.call(this,C)},O.prototype.resolveAll=function(){for(var C=this.methodsArray,$=0;$<C.length;++$)C[$].resolve();return _.prototype.resolve.call(this)},O.prototype.add=function(C){if(this.get(C.name))throw Error("duplicate name '"+C.name+"' in "+this);return C instanceof S?(this.methods[C.name]=C,C.parent=this,A(this)):_.prototype.add.call(this,C)},O.prototype.remove=function(C){if(C instanceof S){if(this.methods[C.name]!==C)throw Error(C+" is not a member of "+this);return delete this.methods[C.name],C.parent=null,A(this)}return _.prototype.remove.call(this,C)},O.prototype.create=function(C,$,x){for(var N=new T.Service(C,$,x),D=0,q;D<this.methodsArray.length;++D){var M=v.lcFirst((q=this._methodsArray[D]).resolve().name).replace(/[^$\w_]/g,"");N[M]=v.codegen(["r","c"],v.isReserved(M)?M+"_":M)("return this.rpcCall(m,q,s,r,c)")({m:q,q:q.resolvedRequestType.ctor,s:q.resolvedResponseType.ctor})}return N},service}var message,hasRequiredMessage;function requireMessage(){if(hasRequiredMessage)return message;hasRequiredMessage=1,message=S;var _=requireMinimal();function S(v){if(v)for(var T=Object.keys(v),O=0;O<T.length;++O)this[T[O]]=v[T[O]]}return S.create=function(T){return this.$type.create(T)},S.encode=function(T,O){return this.$type.encode(T,O)},S.encodeDelimited=function(T,O){return this.$type.encodeDelimited(T,O)},S.decode=function(T){return this.$type.decode(T)},S.decodeDelimited=function(T){return this.$type.decodeDelimited(T)},S.verify=function(T){return this.$type.verify(T)},S.fromObject=function(T){return this.$type.fromObject(T)},S.toObject=function(T,O){return this.$type.toObject(T,O)},S.prototype.toJSON=function(){return this.$type.toObject(this,_.toJSONOptions)},message}var decoder_1,hasRequiredDecoder;function requireDecoder(){if(hasRequiredDecoder)return decoder_1;hasRequiredDecoder=1,decoder_1=O;var _=require_enum(),S=requireTypes(),v=requireUtil();function T(A){return"missing required '"+A.name+"'"}function O(A){var k=v.codegen(["r","l"],A.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(A.fieldsArray.filter(function(q){return q.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");A.group&&k("if((t&7)===4)")("break"),k("switch(t>>>3){");for(var C=0;C<A.fieldsArray.length;++C){var $=A._fieldsArray[C].resolve(),x=$.resolvedType instanceof _?"int32":$.type,N="m"+v.safeProp($.name);k("case %i: {",$.id),$.map?(k("if(%s===util.emptyObject)",N)("%s={}",N)("var c2 = r.uint32()+r.pos"),S.defaults[$.keyType]!==void 0?k("k=%j",S.defaults[$.keyType]):k("k=null"),S.defaults[x]!==void 0?k("value=%j",S.defaults[x]):k("value=null"),k("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",$.keyType)("case 2:"),S.basic[x]===void 0?k("value=types[%i].decode(r,r.uint32())",C):k("value=r.%s()",x),k("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),S.long[$.keyType]!==void 0?k('%s[typeof k==="object"?util.longToHash(k):k]=value',N):k("%s[k]=value",N)):$.repeated?(k("if(!(%s&&%s.length))",N,N)("%s=[]",N),S.packed[x]!==void 0&&k("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",N,x)("}else"),S.basic[x]===void 0?k($.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",N,C):k("%s.push(r.%s())",N,x)):S.basic[x]===void 0?k($.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",N,C):k("%s=r.%s()",N,x),k("break")("}")}for(k("default:")("r.skipType(t&7)")("break")("}")("}"),C=0;C<A._fieldsArray.length;++C){var D=A._fieldsArray[C];D.required&&k("if(!m.hasOwnProperty(%j))",D.name)("throw util.ProtocolError(%j,{instance:m})",T(D))}return k("return m")}return decoder_1}var verifier_1,hasRequiredVerifier;function requireVerifier(){if(hasRequiredVerifier)return verifier_1;hasRequiredVerifier=1,verifier_1=A;var _=require_enum(),S=requireUtil();function v(k,C){return k.name+": "+C+(k.repeated&&C!=="array"?"[]":k.map&&C!=="object"?"{k:"+k.keyType+"}":"")+" expected"}function T(k,C,$,x){if(C.resolvedType)if(C.resolvedType instanceof _){k("switch(%s){",x)("default:")("return%j",v(C,"enum value"));for(var N=Object.keys(C.resolvedType.values),D=0;D<N.length;++D)k("case %i:",C.resolvedType.values[N[D]]);k("break")("}")}else k("{")("var e=types[%i].verify(%s);",$,x)("if(e)")("return%j+e",C.name+".")("}");else switch(C.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":k("if(!util.isInteger(%s))",x)("return%j",v(C,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":k("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",x,x,x,x)("return%j",v(C,"integer|Long"));break;case"float":case"double":k('if(typeof %s!=="number")',x)("return%j",v(C,"number"));break;case"bool":k('if(typeof %s!=="boolean")',x)("return%j",v(C,"boolean"));break;case"string":k("if(!util.isString(%s))",x)("return%j",v(C,"string"));break;case"bytes":k('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',x,x,x)("return%j",v(C,"buffer"));break}return k}function O(k,C,$){switch(C.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":k("if(!util.key32Re.test(%s))",$)("return%j",v(C,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":k("if(!util.key64Re.test(%s))",$)("return%j",v(C,"integer|Long key"));break;case"bool":k("if(!util.key2Re.test(%s))",$)("return%j",v(C,"boolean key"));break}return k}function A(k){var C=S.codegen(["m"],k.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),$=k.oneofsArray,x={};$.length&&C("var p={}");for(var N=0;N<k.fieldsArray.length;++N){var D=k._fieldsArray[N].resolve(),q="m"+S.safeProp(D.name);if(D.optional&&C("if(%s!=null&&m.hasOwnProperty(%j)){",q,D.name),D.map)C("if(!util.isObject(%s))",q)("return%j",v(D,"object"))("var k=Object.keys(%s)",q)("for(var i=0;i<k.length;++i){"),O(C,D,"k[i]"),T(C,D,N,q+"[k[i]]")("}");else if(D.repeated)C("if(!Array.isArray(%s))",q)("return%j",v(D,"array"))("for(var i=0;i<%s.length;++i){",q),T(C,D,N,q+"[i]")("}");else{if(D.partOf){var M=S.safeProp(D.partOf.name);x[D.partOf.name]===1&&C("if(p%s===1)",M)("return%j",D.partOf.name+": multiple values"),x[D.partOf.name]=1,C("p%s=1",M)}T(C,D,N,q)}D.optional&&C("}")}return C("return null")}return verifier_1}var converter={},hasRequiredConverter;function requireConverter(){return hasRequiredConverter||(hasRequiredConverter=1,function(_){var S=_,v=require_enum(),T=requireUtil();function O(k,C,$,x){var N=!1;if(C.resolvedType)if(C.resolvedType instanceof v){k("switch(d%s){",x);for(var D=C.resolvedType.values,q=Object.keys(D),M=0;M<q.length;++M)D[q[M]]===C.typeDefault&&!N&&(k("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',x,x,x),C.repeated||k("break"),N=!0),k("case%j:",q[M])("case %i:",D[q[M]])("m%s=%j",x,D[q[M]])("break");k("}")}else k('if(typeof d%s!=="object")',x)("throw TypeError(%j)",C.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",x,$,x);else{var U=!1;switch(C.type){case"double":case"float":k("m%s=Number(d%s)",x,x);break;case"uint32":case"fixed32":k("m%s=d%s>>>0",x,x);break;case"int32":case"sint32":case"sfixed32":k("m%s=d%s|0",x,x);break;case"uint64":U=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":k("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",x,x,U)('else if(typeof d%s==="string")',x)("m%s=parseInt(d%s,10)",x,x)('else if(typeof d%s==="number")',x)("m%s=d%s",x,x)('else if(typeof d%s==="object")',x)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",x,x,x,U?"true":"");break;case"bytes":k('if(typeof d%s==="string")',x)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",x,x,x)("else if(d%s.length >= 0)",x)("m%s=d%s",x,x);break;case"string":k("m%s=String(d%s)",x,x);break;case"bool":k("m%s=Boolean(d%s)",x,x);break}}return k}S.fromObject=function(C){var $=C.fieldsArray,x=T.codegen(["d"],C.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!$.length)return x("return new this.ctor");x("var m=new this.ctor");for(var N=0;N<$.length;++N){var D=$[N].resolve(),q=T.safeProp(D.name);D.map?(x("if(d%s){",q)('if(typeof d%s!=="object")',q)("throw TypeError(%j)",D.fullName+": object expected")("m%s={}",q)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",q),O(x,D,N,q+"[ks[i]]")("}")("}")):D.repeated?(x("if(d%s){",q)("if(!Array.isArray(d%s))",q)("throw TypeError(%j)",D.fullName+": array expected")("m%s=[]",q)("for(var i=0;i<d%s.length;++i){",q),O(x,D,N,q+"[i]")("}")("}")):(D.resolvedType instanceof v||x("if(d%s!=null){",q),O(x,D,N,q),D.resolvedType instanceof v||x("}"))}return x("return m")};function A(k,C,$,x){if(C.resolvedType)C.resolvedType instanceof v?k("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",x,$,x,x,$,x,x):k("d%s=types[%i].toObject(m%s,o)",x,$,x);else{var N=!1;switch(C.type){case"double":case"float":k("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",x,x,x,x);break;case"uint64":N=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":k('if(typeof m%s==="number")',x)("d%s=o.longs===String?String(m%s):m%s",x,x,x)("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",x,x,x,x,N?"true":"",x);break;case"bytes":k("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",x,x,x,x,x);break;default:k("d%s=m%s",x,x);break}}return k}S.toObject=function(C){var $=C.fieldsArray.slice().sort(T.compareFieldsById);if(!$.length)return T.codegen()("return {}");for(var x=T.codegen(["m","o"],C.name+"$toObject")("if(!o)")("o={}")("var d={}"),N=[],D=[],q=[],M=0;M<$.length;++M)$[M].partOf||($[M].resolve().repeated?N:$[M].map?D:q).push($[M]);if(N.length){for(x("if(o.arrays||o.defaults){"),M=0;M<N.length;++M)x("d%s=[]",T.safeProp(N[M].name));x("}")}if(D.length){for(x("if(o.objects||o.defaults){"),M=0;M<D.length;++M)x("d%s={}",T.safeProp(D[M].name));x("}")}if(q.length){for(x("if(o.defaults){"),M=0;M<q.length;++M){var U=q[M],z=T.safeProp(U.name);if(U.resolvedType instanceof v)x("d%s=o.enums===String?%j:%j",z,U.resolvedType.valuesById[U.typeDefault],U.typeDefault);else if(U.long)x("if(util.Long){")("var n=new util.Long(%i,%i,%j)",U.typeDefault.low,U.typeDefault.high,U.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",z)("}else")("d%s=o.longs===String?%j:%i",z,U.typeDefault.toString(),U.typeDefault.toNumber());else if(U.bytes){var W="["+Array.prototype.slice.call(U.typeDefault).join(",")+"]";x("if(o.bytes===String)d%s=%j",z,String.fromCharCode.apply(String,U.typeDefault))("else{")("d%s=%s",z,W)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",z,z)("}")}else x("d%s=%j",z,U.typeDefault)}x("}")}var j=!1;for(M=0;M<$.length;++M){var U=$[M],B=C._fieldsArray.indexOf(U),z=T.safeProp(U.name);U.map?(j||(j=!0,x("var ks2")),x("if(m%s&&(ks2=Object.keys(m%s)).length){",z,z)("d%s={}",z)("for(var j=0;j<ks2.length;++j){"),A(x,U,B,z+"[ks2[j]]")("}")):U.repeated?(x("if(m%s&&m%s.length){",z,z)("d%s=[]",z)("for(var j=0;j<m%s.length;++j){",z),A(x,U,B,z+"[j]")("}")):(x("if(m%s!=null&&m.hasOwnProperty(%j)){",z,U.name),A(x,U,B,z),U.partOf&&x("if(o.oneofs)")("d%s=%j",T.safeProp(U.partOf.name),U.name)),x("}")}return x("return d")}}(converter)),converter}var wrappers={},hasRequiredWrappers;function requireWrappers(){return hasRequiredWrappers||(hasRequiredWrappers=1,function(_){var S=_,v=requireMessage();S[".google.protobuf.Any"]={fromObject:function(T){if(T&&T["@type"]){var O=T["@type"].substring(T["@type"].lastIndexOf("/")+1),A=this.lookup(O);if(A){var k=T["@type"].charAt(0)==="."?T["@type"].slice(1):T["@type"];return k.indexOf("/")===-1&&(k="/"+k),this.create({type_url:k,value:A.encode(A.fromObject(T)).finish()})}}return this.fromObject(T)},toObject:function(T,O){var A="type.googleapis.com/",k="",C="";if(O&&O.json&&T.type_url&&T.value){C=T.type_url.substring(T.type_url.lastIndexOf("/")+1),k=T.type_url.substring(0,T.type_url.lastIndexOf("/")+1);var $=this.lookup(C);$&&(T=$.decode(T.value))}if(!(T instanceof this.ctor)&&T instanceof v){var x=T.$type.toObject(T,O),N=T.$type.fullName[0]==="."?T.$type.fullName.slice(1):T.$type.fullName;return k===""&&(k=A),C=k+N,x["@type"]=C,x}return this.toObject(T,O)}}}(wrappers)),wrappers}var type,hasRequiredType;function requireType(){if(hasRequiredType)return type;hasRequiredType=1,type=z;var _=requireNamespace();((z.prototype=Object.create(_.prototype)).constructor=z).className="Type";var S=require_enum(),v=requireOneof(),T=requireField(),O=requireMapfield(),A=requireService(),k=requireMessage(),C=requireReader(),$=requireWriter(),x=requireUtil(),N=requireEncoder(),D=requireDecoder(),q=requireVerifier(),M=requireConverter(),U=requireWrappers();function z(j,B){_.call(this,j,B),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(z.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var j=Object.keys(this.fields),B=0;B<j.length;++B){var Z=this.fields[j[B]],X=Z.id;if(this._fieldsById[X])throw Error("duplicate id "+X+" in "+this);this._fieldsById[X]=Z}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=x.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=x.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=z.generateConstructor(this)())},set:function(j){var B=j.prototype;B instanceof k||((j.prototype=new k).constructor=j,x.merge(j.prototype,B)),j.$type=j.prototype.$type=this,x.merge(j,k,!0),this._ctor=j;for(var Z=0;Z<this.fieldsArray.length;++Z)this._fieldsArray[Z].resolve();var X={};for(Z=0;Z<this.oneofsArray.length;++Z)X[this._oneofsArray[Z].resolve().name]={get:x.oneOfGetter(this._oneofsArray[Z].oneof),set:x.oneOfSetter(this._oneofsArray[Z].oneof)};Z&&Object.defineProperties(j.prototype,X)}}}),z.generateConstructor=function(B){for(var Z=x.codegen(["p"],B.name),X=0,Q;X<B.fieldsArray.length;++X)(Q=B._fieldsArray[X]).map?Z("this%s={}",x.safeProp(Q.name)):Q.repeated&&Z("this%s=[]",x.safeProp(Q.name));return Z("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 W(j){return j._fieldsById=j._fieldsArray=j._oneofsArray=null,delete j.encode,delete j.decode,delete j.verify,j}return z.fromJSON=function(B,Z){var X=new z(B,Z.options);X.extensions=Z.extensions,X.reserved=Z.reserved;for(var Q=Object.keys(Z.fields),ee=0;ee<Q.length;++ee)X.add((typeof Z.fields[Q[ee]].keyType<"u"?O.fromJSON:T.fromJSON)(Q[ee],Z.fields[Q[ee]]));if(Z.oneofs)for(Q=Object.keys(Z.oneofs),ee=0;ee<Q.length;++ee)X.add(v.fromJSON(Q[ee],Z.oneofs[Q[ee]]));if(Z.nested)for(Q=Object.keys(Z.nested),ee=0;ee<Q.length;++ee){var ce=Z.nested[Q[ee]];X.add((ce.id!==void 0?T.fromJSON:ce.fields!==void 0?z.fromJSON:ce.values!==void 0?S.fromJSON:ce.methods!==void 0?A.fromJSON:_.fromJSON)(Q[ee],ce))}return Z.extensions&&Z.extensions.length&&(X.extensions=Z.extensions),Z.reserved&&Z.reserved.length&&(X.reserved=Z.reserved),Z.group&&(X.group=!0),Z.comment&&(X.comment=Z.comment),X},z.prototype.toJSON=function(B){var Z=_.prototype.toJSON.call(this,B),X=B?!!B.keepComments:!1;return x.toObject(["options",Z&&Z.options||void 0,"oneofs",_.arrayToJSON(this.oneofsArray,B),"fields",_.arrayToJSON(this.fieldsArray.filter(function(Q){return!Q.declaringField}),B)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",Z&&Z.nested||void 0,"comment",X?this.comment:void 0])},z.prototype.resolveAll=function(){for(var B=this.fieldsArray,Z=0;Z<B.length;)B[Z++].resolve();var X=this.oneofsArray;for(Z=0;Z<X.length;)X[Z++].resolve();return _.prototype.resolveAll.call(this)},z.prototype.get=function(B){return this.fields[B]||this.oneofs&&this.oneofs[B]||this.nested&&this.nested[B]||null},z.prototype.add=function(B){if(this.get(B.name))throw Error("duplicate name '"+B.name+"' in "+this);if(B instanceof T&&B.extend===void 0){if(this._fieldsById?this._fieldsById[B.id]:this.fieldsById[B.id])throw Error("duplicate id "+B.id+" in "+this);if(this.isReservedId(B.id))throw Error("id "+B.id+" is reserved in "+this);if(this.isReservedName(B.name))throw Error("name '"+B.name+"' is reserved in "+this);return B.parent&&B.parent.remove(B),this.fields[B.name]=B,B.message=this,B.onAdd(this),W(this)}return B instanceof v?(this.oneofs||(this.oneofs={}),this.oneofs[B.name]=B,B.onAdd(this),W(this)):_.prototype.add.call(this,B)},z.prototype.remove=function(B){if(B instanceof T&&B.extend===void 0){if(!this.fields||this.fields[B.name]!==B)throw Error(B+" is not a member of "+this);return delete this.fields[B.name],B.parent=null,B.onRemove(this),W(this)}if(B instanceof v){if(!this.oneofs||this.oneofs[B.name]!==B)throw Error(B+" is not a member of "+this);return delete this.oneofs[B.name],B.parent=null,B.onRemove(this),W(this)}return _.prototype.remove.call(this,B)},z.prototype.isReservedId=function(B){return _.isReservedId(this.reserved,B)},z.prototype.isReservedName=function(B){return _.isReservedName(this.reserved,B)},z.prototype.create=function(B){return new this.ctor(B)},z.prototype.setup=function(){for(var B=this.fullName,Z=[],X=0;X<this.fieldsArray.length;++X)Z.push(this._fieldsArray[X].resolve().resolvedType);this.encode=N(this)({Writer:$,types:Z,util:x}),this.decode=D(this)({Reader:C,types:Z,util:x}),this.verify=q(this)({types:Z,util:x}),this.fromObject=M.fromObject(this)({types:Z,util:x}),this.toObject=M.toObject(this)({types:Z,util:x});var Q=U[B];if(Q){var ee=Object.create(this);ee.fromObject=this.fromObject,this.fromObject=Q.fromObject.bind(ee),ee.toObject=this.toObject,this.toObject=Q.toObject.bind(ee)}return this},z.prototype.encode=function(B,Z){return this.setup().encode(B,Z)},z.prototype.encodeDelimited=function(B,Z){return this.encode(B,Z&&Z.len?Z.fork():Z).ldelim()},z.prototype.decode=function(B,Z){return this.setup().decode(B,Z)},z.prototype.decodeDelimited=function(B){return B instanceof C||(B=C.create(B)),this.decode(B,B.uint32())},z.prototype.verify=function(B){return this.setup().verify(B)},z.prototype.fromObject=function(B){return this.setup().fromObject(B)},z.prototype.toObject=function(B,Z){return this.setup().toObject(B,Z)},z.d=function(B){return function(X){x.decorateType(X,B)}},type}var root,hasRequiredRoot;function requireRoot(){if(hasRequiredRoot)return root;hasRequiredRoot=1,root=$;var _=requireNamespace();(($.prototype=Object.create(_.prototype)).constructor=$).className="Root";var S=requireField(),v=require_enum(),T=requireOneof(),O=requireUtil(),A,k,C;function $(q){_.call(this,"",q),this.deferred=[],this.files=[]}$.fromJSON=function(M,U){return U||(U=new $),M.options&&U.setOptions(M.options),U.addJSON(M.nested)},$.prototype.resolvePath=O.path.resolve,$.prototype.fetch=O.fetch;function x(){}$.prototype.load=function q(M,U,z){typeof U=="function"&&(z=U,U=void 0);var W=this;if(!z)return O.asPromise(q,W,M,U);var j=z===x;function B(ae,se){if(z){if(j)throw ae;var ie=z;z=null,ie(ae,se)}}function Z(ae){var se=ae.lastIndexOf("google/protobuf/");if(se>-1){var ie=ae.substring(se);if(ie in C)return ie}return null}function X(ae,se){try{if(O.isString(se)&&se.charAt(0)==="{"&&(se=JSON.parse(se)),!O.isString(se))W.setOptions(se.options).addJSON(se.nested);else{k.filename=ae;var ie=k(se,W,U),fe,Oe=0;if(ie.imports)for(;Oe<ie.imports.length;++Oe)(fe=Z(ie.imports[Oe])||W.resolvePath(ae,ie.imports[Oe]))&&Q(fe);if(ie.weakImports)for(Oe=0;Oe<ie.weakImports.length;++Oe)(fe=Z(ie.weakImports[Oe])||W.resolvePath(ae,ie.weakImports[Oe]))&&Q(fe,!0)}}catch(ue){B(ue)}!j&&!ee&&B(null,W)}function Q(ae,se){if(ae=Z(ae)||ae,!(W.files.indexOf(ae)>-1)){if(W.files.push(ae),ae in C){j?X(ae,C[ae]):(++ee,setTimeout(function(){--ee,X(ae,C[ae])}));return}if(j){var ie;try{ie=O.fs.readFileSync(ae).toString("utf8")}catch(fe){se||B(fe);return}X(ae,ie)}else++ee,W.fetch(ae,function(fe,Oe){if(--ee,!!z){if(fe){se?ee||B(null,W):B(fe);return}X(ae,Oe)}})}}var ee=0;O.isString(M)&&(M=[M]);for(var ce=0,pe;ce<M.length;++ce)(pe=W.resolvePath("",M[ce]))&&Q(pe);if(j)return W;ee||B(null,W)},$.prototype.loadSync=function(M,U){if(!O.isNode)throw Error("not supported");return this.load(M,U,x)},$.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(M){return"'extend "+M.extend+"' in "+M.parent.fullName}).join(", "));return _.prototype.resolveAll.call(this)};var N=/^[A-Z]/;function D(q,M){var U=M.parent.lookup(M.extend);if(U){var z=new S(M.fullName,M.id,M.type,M.rule,void 0,M.options);return U.get(z.name)||(z.declaringField=M,M.extensionField=z,U.add(z)),!0}return!1}return $.prototype._handleAdd=function(M){if(M instanceof S)M.extend!==void 0&&!M.extensionField&&(D(this,M)||this.deferred.push(M));else if(M instanceof v)N.test(M.name)&&(M.parent[M.name]=M.values);else if(!(M instanceof T)){if(M instanceof A)for(var U=0;U<this.deferred.length;)D(this,this.deferred[U])?this.deferred.splice(U,1):++U;for(var z=0;z<M.nestedArray.length;++z)this._handleAdd(M._nestedArray[z]);N.test(M.name)&&(M.parent[M.name]=M)}},$.prototype._handleRemove=function(M){if(M instanceof S){if(M.extend!==void 0)if(M.extensionField)M.extensionField.parent.remove(M.extensionField),M.extensionField=null;else{var U=this.deferred.indexOf(M);U>-1&&this.deferred.splice(U,1)}}else if(M instanceof v)N.test(M.name)&&delete M.parent[M.name];else if(M instanceof _){for(var z=0;z<M.nestedArray.length;++z)this._handleRemove(M._nestedArray[z]);N.test(M.name)&&delete M.parent[M.name]}},$._configure=function(q,M,U){A=q,k=M,C=U},root}var hasRequiredUtil;function requireUtil(){if(hasRequiredUtil)return util.exports;hasRequiredUtil=1;var _=util.exports=requireMinimal(),S=requireRoots(),v,T;_.codegen=requireCodegen(),_.fetch=requireFetch(),_.path=requirePath(),_.fs=_.inquire("fs"),_.toArray=function(x){if(x){for(var N=Object.keys(x),D=new Array(N.length),q=0;q<N.length;)D[q]=x[N[q++]];return D}return[]},_.toObject=function(x){for(var N={},D=0;D<x.length;){var q=x[D++],M=x[D++];M!==void 0&&(N[q]=M)}return N};var O=/\\/g,A=/"/g;_.isReserved=function(x){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(x)},_.safeProp=function(x){return!/^[$\w_]+$/.test(x)||_.isReserved(x)?'["'+x.replace(O,"\\\\").replace(A,'\\"')+'"]':"."+x},_.ucFirst=function(x){return x.charAt(0).toUpperCase()+x.substring(1)};var k=/_([a-z])/g;_.camelCase=function(x){return x.substring(0,1)+x.substring(1).replace(k,function(N,D){return D.toUpperCase()})},_.compareFieldsById=function(x,N){return x.id-N.id},_.decorateType=function(x,N){if(x.$type)return N&&x.$type.name!==N&&(_.decorateRoot.remove(x.$type),x.$type.name=N,_.decorateRoot.add(x.$type)),x.$type;v||(v=requireType());var D=new v(N||x.name);return _.decorateRoot.add(D),D.ctor=x,Object.defineProperty(x,"$type",{value:D,enumerable:!1}),Object.defineProperty(x.prototype,"$type",{value:D,enumerable:!1}),D};var C=0;return _.decorateEnum=function(x){if(x.$type)return x.$type;T||(T=require_enum());var N=new T("Enum"+C++,x);return _.decorateRoot.add(N),Object.defineProperty(x,"$type",{value:N,enumerable:!1}),N},_.setProperty=function(x,N,D){function q(M,U,z){var W=U.shift();if(W==="__proto__"||W==="prototype")return M;if(U.length>0)M[W]=q(M[W]||{},U,z);else{var j=M[W];j&&(z=[].concat(j).concat(z)),M[W]=z}return M}if(typeof x!="object")throw TypeError("dst must be an object");if(!N)throw TypeError("path must be specified");return N=N.split("."),q(x,N,D)},Object.defineProperty(_,"decorateRoot",{get:function(){return S.decorated||(S.decorated=new(requireRoot()))}}),util.exports}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=v,v.className="ReflectionObject";var _=requireUtil(),S;function v(T,O){if(!_.isString(T))throw TypeError("name must be a string");if(O&&!_.isObject(O))throw TypeError("options must be an object");this.options=O,this.parsedOptions=null,this.name=T,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(v.prototype,{root:{get:function(){for(var T=this;T.parent!==null;)T=T.parent;return T}},fullName:{get:function(){for(var T=[this.name],O=this.parent;O;)T.unshift(O.name),O=O.parent;return T.join(".")}}}),v.prototype.toJSON=function(){throw Error()},v.prototype.onAdd=function(O){this.parent&&this.parent!==O&&this.parent.remove(this),this.parent=O,this.resolved=!1;var A=O.root;A instanceof S&&A._handleAdd(this)},v.prototype.onRemove=function(O){var A=O.root;A instanceof S&&A._handleRemove(this),this.parent=null,this.resolved=!1},v.prototype.resolve=function(){return this.resolved?this:(this.root instanceof S&&(this.resolved=!0),this)},v.prototype.getOption=function(O){if(this.options)return this.options[O]},v.prototype.setOption=function(O,A,k){return(!k||!this.options||this.options[O]===void 0)&&((this.options||(this.options={}))[O]=A),this},v.prototype.setParsedOption=function(O,A,k){this.parsedOptions||(this.parsedOptions=[]);var C=this.parsedOptions;if(k){var $=C.find(function(D){return Object.prototype.hasOwnProperty.call(D,O)});if($){var x=$[O];_.setProperty(x,k,A)}else $={},$[O]=_.setProperty({},k,A),C.push($)}else{var N={};N[O]=A,C.push(N)}return this},v.prototype.setOptions=function(O,A){if(O)for(var k=Object.keys(O),C=0;C<k.length;++C)this.setOption(k[C],O[k[C]],A);return this},v.prototype.toString=function(){var O=this.constructor.className,A=this.fullName;return A.length?O+" "+A:O},v._configure=function(T){S=T},object}var _enum,hasRequired_enum;function require_enum(){if(hasRequired_enum)return _enum;hasRequired_enum=1,_enum=T;var _=requireObject();((T.prototype=Object.create(_.prototype)).constructor=T).className="Enum";var S=requireNamespace(),v=requireUtil();function T(O,A,k,C,$,x){if(_.call(this,O,k),A&&typeof A!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=C,this.comments=$||{},this.valuesOptions=x,this.reserved=void 0,A)for(var N=Object.keys(A),D=0;D<N.length;++D)typeof A[N[D]]=="number"&&(this.valuesById[this.values[N[D]]=A[N[D]]]=N[D])}return T.fromJSON=function(A,k){var C=new T(A,k.values,k.options,k.comment,k.comments);return C.reserved=k.reserved,C},T.prototype.toJSON=function(A){var k=A?!!A.keepComments:!1;return v.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",k?this.comment:void 0,"comments",k?this.comments:void 0])},T.prototype.add=function(A,k,C,$){if(!v.isString(A))throw TypeError("name must be a string");if(!v.isInteger(k))throw TypeError("id must be an integer");if(this.values[A]!==void 0)throw Error("duplicate name '"+A+"' in "+this);if(this.isReservedId(k))throw Error("id "+k+" is reserved in "+this);if(this.isReservedName(A))throw Error("name '"+A+"' is reserved in "+this);if(this.valuesById[k]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+k+" in "+this);this.values[A]=k}else this.valuesById[this.values[A]=k]=A;return $&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[A]=$||null),this.comments[A]=C||null,this},T.prototype.remove=function(A){if(!v.isString(A))throw TypeError("name must be a string");var k=this.values[A];if(k==null)throw Error("name '"+A+"' does not exist in "+this);return delete this.valuesById[k],delete this.values[A],delete this.comments[A],this.valuesOptions&&delete this.valuesOptions[A],this},T.prototype.isReservedId=function(A){return S.isReservedId(this.reserved,A)},T.prototype.isReservedName=function(A){return S.isReservedName(this.reserved,A)},_enum}var encoder_1,hasRequiredEncoder;function requireEncoder(){if(hasRequiredEncoder)return encoder_1;hasRequiredEncoder=1,encoder_1=O;var _=require_enum(),S=requireTypes(),v=requireUtil();function T(A,k,C,$){return k.resolvedType.group?A("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",C,$,(k.id<<3|3)>>>0,(k.id<<3|4)>>>0):A("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",C,$,(k.id<<3|2)>>>0)}function O(A){for(var k=v.codegen(["m","w"],A.name+"$encode")("if(!w)")("w=Writer.create()"),C,$,x=A.fieldsArray.slice().sort(v.compareFieldsById),C=0;C<x.length;++C){var N=x[C].resolve(),D=A._fieldsArray.indexOf(N),q=N.resolvedType instanceof _?"int32":N.type,M=S.basic[q];$="m"+v.safeProp(N.name),N.map?(k("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",$,N.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",$)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(N.id<<3|2)>>>0,8|S.mapKey[N.keyType],N.keyType),M===void 0?k("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",D,$):k(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|M,q,$),k("}")("}")):N.repeated?(k("if(%s!=null&&%s.length){",$,$),N.packed&&S.packed[q]!==void 0?k("w.uint32(%i).fork()",(N.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",$)("w.%s(%s[i])",q,$)("w.ldelim()"):(k("for(var i=0;i<%s.length;++i)",$),M===void 0?T(k,N,D,$+"[i]"):k("w.uint32(%i).%s(%s[i])",(N.id<<3|M)>>>0,q,$)),k("}")):(N.optional&&k("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",$,N.name),M===void 0?T(k,N,D,$):k("w.uint32(%i).%s(%s)",(N.id<<3|M)>>>0,q,$))}return k("return w")}return encoder_1}var hasRequiredIndexLight;function requireIndexLight(){if(hasRequiredIndexLight)return indexLight.exports;hasRequiredIndexLight=1;var _=indexLight.exports=requireIndexMinimal();_.build="light";function S(T,O,A){return typeof O=="function"?(A=O,O=new _.Root):O||(O=new _.Root),O.load(T,A)}_.load=S;function v(T,O){return O||(O=new _.Root),O.loadSync(T)}return _.loadSync=v,_.encoder=requireEncoder(),_.decoder=requireDecoder(),_.verifier=requireVerifier(),_.converter=requireConverter(),_.ReflectionObject=requireObject(),_.Namespace=requireNamespace(),_.Root=requireRoot(),_.Enum=require_enum(),_.Type=requireType(),_.Field=requireField(),_.OneOf=requireOneof(),_.MapField=requireMapfield(),_.Service=requireService(),_.Method=requireMethod(),_.Message=requireMessage(),_.wrappers=requireWrappers(),_.types=requireTypes(),_.util=requireUtil(),_.ReflectionObject._configure(_.Root),_.Namespace._configure(_.Type,_.Service,_.Enum),_.Root._configure(_.Type),_.Field._configure(_.Type),indexLight.exports}var tokenize_1,hasRequiredTokenize;function requireTokenize(){if(hasRequiredTokenize)return tokenize_1;hasRequiredTokenize=1,tokenize_1=N;var _=/[\s{}=;:[\],'"()<>]/g,S=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,v=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,T=/^ *[*/]+ */,O=/^\s*\*?\/*/,A=/\n/g,k=/\s/,C=/\\(.?)/g,$={0:"\0",r:"\r",n:`
13
- `,t:" "};function x(D){return D.replace(C,function(q,M){switch(M){case"\\":case"":return M;default:return $[M]||""}})}N.unescape=x;function N(D,q){D=D.toString();var M=0,U=D.length,z=1,W=0,j={},B=[],Z=null;function X(le){return Error("illegal "+le+" (line "+z+")")}function Q(){var le=Z==="'"?v:S;le.lastIndex=M-1;var _e=le.exec(D);if(!_e)throw X("string");return M=le.lastIndex,ie(Z),Z=null,x(_e[1])}function ee(le){return D.charAt(le)}function ce(le,_e,me){var oe={type:D.charAt(le++),lineEmpty:!1,leading:me},Se;q?Se=2:Se=3;var ye=le-Se,ve;do if(--ye<0||(ve=D.charAt(ye))===`
14
- `){oe.lineEmpty=!0;break}while(ve===" "||ve===" ");for(var Ee=D.substring(le,_e).split(A),Ie=0;Ie<Ee.length;++Ie)Ee[Ie]=Ee[Ie].replace(q?O:T,"").trim();oe.text=Ee.join(`
15
- `).trim(),j[z]=oe,W=z}function pe(le){var _e=ae(le),me=D.substring(le,_e),oe=/^\s*\/\//.test(me);return oe}function ae(le){for(var _e=le;_e<U&&ee(_e)!==`
16
- `;)_e++;return _e}function se(){if(B.length>0)return B.shift();if(Z)return Q();var le,_e,me,oe,Se,ye=M===0;do{if(M===U)return null;for(le=!1;k.test(me=ee(M));)if(me===`
17
- `&&(ye=!0,++z),++M===U)return null;if(ee(M)==="/"){if(++M===U)throw X("comment");if(ee(M)==="/")if(q){if(oe=M,Se=!1,pe(M-1)){Se=!0;do if(M=ae(M),M===U||(M++,!ye))break;while(pe(M))}else M=Math.min(U,ae(M)+1);Se&&(ce(oe,M,ye),ye=!0),z++,le=!0}else{for(Se=ee(oe=M+1)==="/";ee(++M)!==`
18
- `;)if(M===U)return null;++M,Se&&(ce(oe,M-1,ye),ye=!0),++z,le=!0}else if((me=ee(M))==="*"){oe=M+1,Se=q||ee(oe)==="*";do{if(me===`
19
- `&&++z,++M===U)throw X("comment");_e=me,me=ee(M)}while(_e!=="*"||me!=="/");++M,Se&&(ce(oe,M-2,ye),ye=!0),le=!0}else return"/"}}while(le);var ve=M;_.lastIndex=0;var Ee=_.test(ee(ve++));if(!Ee)for(;ve<U&&!_.test(ee(ve));)++ve;var Ie=D.substring(M,M=ve);return(Ie==='"'||Ie==="'")&&(Z=Ie),Ie}function ie(le){B.push(le)}function fe(){if(!B.length){var le=se();if(le===null)return null;ie(le)}return B[0]}function Oe(le,_e){var me=fe(),oe=me===le;if(oe)return se(),!0;if(!_e)throw X("token '"+me+"', '"+le+"' expected");return!1}function ue(le){var _e=null,me;return le===void 0?(me=j[z-1],delete j[z-1],me&&(q||me.type==="*"||me.lineEmpty)&&(_e=me.leading?me.text:null)):(W<le&&fe(),me=j[le],delete j[le],me&&!me.lineEmpty&&(q||me.type==="/")&&(_e=me.leading?null:me.text)),_e}return Object.defineProperty({next:se,peek:fe,push:ie,skip:Oe,cmnt:ue},"line",{get:function(){return z}})}return tokenize_1}var parse_1,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse_1;hasRequiredParse=1,parse_1=Q,Q.filename=null,Q.defaults={keepCase:!1};var _=requireTokenize(),S=requireRoot(),v=requireType(),T=requireField(),O=requireMapfield(),A=requireOneof(),k=require_enum(),C=requireService(),$=requireMethod(),x=requireTypes(),N=requireUtil(),D=/^[1-9][0-9]*$/,q=/^-?[1-9][0-9]*$/,M=/^0[x][0-9a-fA-F]+$/,U=/^-?0[x][0-9a-fA-F]+$/,z=/^0[0-7]+$/,W=/^-?0[0-7]+$/,j=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,B=/^[a-zA-Z_][a-zA-Z_0-9]*$/,Z=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,X=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function Q(ee,ce,pe){ce instanceof S||(pe=ce,ce=new S),pe||(pe=Q.defaults);var ae=pe.preferTrailingComment||!1,se=_(ee,pe.alternateCommentMode||!1),ie=se.next,fe=se.push,Oe=se.peek,ue=se.skip,le=se.cmnt,_e=!0,me,oe,Se,ye,ve=!1,Ee=ce,Ie=pe.keepCase?function(re){return re}:N.camelCase;function de(re,te,ne){var he=Q.filename;return ne||(Q.filename=null),Error("illegal "+(te||"token")+" '"+re+"' ("+(he?he+", ":"")+"line "+se.line+")")}function Ce(){var re=[],te;do{if((te=ie())!=='"'&&te!=="'")throw de(te);re.push(ie()),ue(te),te=Oe()}while(te==='"'||te==="'");return re.join("")}function Le(re){var te=ie();switch(te){case"'":case'"':return fe(te),Ce();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return xe(te,!0)}catch{if(Z.test(te))return te;throw de(te,"value")}}function Fe(re,te){var ne,he;do te&&((ne=Oe())==='"'||ne==="'")?re.push(Ce()):re.push([he=Ae(ie()),ue("to",!0)?Ae(ie()):he]);while(ue(",",!0));var Y={options:void 0};Y.setOption=function(K,ge){this.options===void 0&&(this.options={}),this.options[K]=ge},$e(Y,function(ge){if(ge==="option")Me(Y,ge),ue(";");else throw de(ge)},function(){Ge(Y)})}function xe(re,te){var ne=1;switch(re.charAt(0)==="-"&&(ne=-1,re=re.substring(1)),re){case"inf":case"INF":case"Inf":return ne*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(D.test(re))return ne*parseInt(re,10);if(M.test(re))return ne*parseInt(re,16);if(z.test(re))return ne*parseInt(re,8);if(j.test(re))return ne*parseFloat(re);throw de(re,"number",te)}function Ae(re,te){switch(re){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!te&&re.charAt(0)==="-")throw de(re,"id");if(q.test(re))return parseInt(re,10);if(U.test(re))return parseInt(re,16);if(W.test(re))return parseInt(re,8);throw de(re,"id")}function De(){if(me!==void 0)throw de("package");if(me=ie(),!Z.test(me))throw de(me,"name");Ee=Ee.define(me),ue(";")}function qe(){var re=Oe(),te;switch(re){case"weak":te=Se||(Se=[]),ie();break;case"public":ie();default:te=oe||(oe=[]);break}re=Ce(),ue(";"),te.push(re)}function Pe(){if(ue("="),ye=Ce(),ve=ye==="proto3",!ve&&ye!=="proto2")throw de(ye,"syntax");ce.setOption("syntax",ye),ue(";")}function je(re,te){switch(te){case"option":return Me(re,te),ue(";"),!0;case"message":return Ve(re,te),!0;case"enum":return rt(re,te),!0;case"service":return lt(re,te),!0;case"extend":return Xe(re,te),!0}return!1}function $e(re,te,ne){var he=se.line;if(re&&(typeof re.comment!="string"&&(re.comment=le()),re.filename=Q.filename),ue("{",!0)){for(var Y;(Y=ie())!=="}";)te(Y);ue(";",!0)}else ne&&ne(),ue(";"),re&&(typeof re.comment!="string"||ae)&&(re.comment=le(he)||re.comment)}function Ve(re,te){if(!B.test(te=ie()))throw de(te,"type name");var ne=new v(te);$e(ne,function(Y){if(!je(ne,Y))switch(Y){case"map":ot(ne);break;case"required":case"repeated":Re(ne,Y);break;case"optional":ve?Re(ne,"proto3_optional"):Re(ne,"optional");break;case"oneof":tt(ne,Y);break;case"extensions":Fe(ne.extensions||(ne.extensions=[]));break;case"reserved":Fe(ne.reserved||(ne.reserved=[]),!0);break;default:if(!ve||!Z.test(Y))throw de(Y);fe(Y),Re(ne,"optional");break}}),re.add(ne)}function Re(re,te,ne){var he=ie();if(he==="group"){We(re,te);return}for(;he.endsWith(".")||Oe().startsWith(".");)he+=ie();if(!Z.test(he))throw de(he,"type");var Y=ie();if(!B.test(Y))throw de(Y,"name");Y=Ie(Y),ue("=");var K=new T(Y,Ae(ie()),he,te,ne);if($e(K,function(we){if(we==="option")Me(K,we),ue(";");else throw de(we)},function(){Ge(K)}),te==="proto3_optional"){var ge=new A("_"+Y);K.setOption("proto3_optional",!0),ge.add(K),re.add(ge)}else re.add(K);!ve&&K.repeated&&(x.packed[he]!==void 0||x.basic[he]===void 0)&&K.setOption("packed",!1,!0)}function We(re,te){var ne=ie();if(!B.test(ne))throw de(ne,"name");var he=N.lcFirst(ne);ne===he&&(ne=N.ucFirst(ne)),ue("=");var Y=Ae(ie()),K=new v(ne);K.group=!0;var ge=new T(he,Y,ne,te);ge.filename=Q.filename,$e(K,function(we){switch(we){case"option":Me(K,we),ue(";");break;case"required":case"repeated":Re(K,we);break;case"optional":ve?Re(K,"proto3_optional"):Re(K,"optional");break;case"message":Ve(K,we);break;case"enum":rt(K,we);break;default:throw de(we)}}),re.add(K).add(ge)}function ot(re){ue("<");var te=ie();if(x.mapKey[te]===void 0)throw de(te,"type");ue(",");var ne=ie();if(!Z.test(ne))throw de(ne,"type");ue(">");var he=ie();if(!B.test(he))throw de(he,"name");ue("=");var Y=new O(Ie(he),Ae(ie()),te,ne);$e(Y,function(ge){if(ge==="option")Me(Y,ge),ue(";");else throw de(ge)},function(){Ge(Y)}),re.add(Y)}function tt(re,te){if(!B.test(te=ie()))throw de(te,"name");var ne=new A(Ie(te));$e(ne,function(Y){Y==="option"?(Me(ne,Y),ue(";")):(fe(Y),Re(ne,"optional"))}),re.add(ne)}function rt(re,te){if(!B.test(te=ie()))throw de(te,"name");var ne=new k(te);$e(ne,function(Y){switch(Y){case"option":Me(ne,Y),ue(";");break;case"reserved":Fe(ne.reserved||(ne.reserved=[]),!0);break;default:at(ne,Y)}}),re.add(ne)}function at(re,te){if(!B.test(te))throw de(te,"name");ue("=");var ne=Ae(ie(),!0),he={options:void 0};he.setOption=function(Y,K){this.options===void 0&&(this.options={}),this.options[Y]=K},$e(he,function(K){if(K==="option")Me(he,K),ue(";");else throw de(K)},function(){Ge(he)}),re.add(te,ne,he.comment,he.options)}function Me(re,te){var ne=ue("(",!0);if(!Z.test(te=ie()))throw de(te,"name");var he=te,Y=he,K;ne&&(ue(")"),he="("+he+")",Y=he,te=Oe(),X.test(te)&&(K=te.slice(1),he+=te,ie())),ue("=");var ge=nt(re,he);ut(re,Y,ge,K)}function nt(re,te){if(ue("{",!0)){for(var ne={};!ue("}",!0);){if(!B.test(ke=ie()))throw de(ke,"name");if(ke===null)throw de(ke,"end of input");var he,Y=ke;if(ue(":",!0),Oe()==="{")he=nt(re,te+"."+ke);else if(Oe()==="["){he=[];var K;if(ue("[",!0)){do K=Le(),he.push(K);while(ue(",",!0));ue("]"),typeof K<"u"&&Qe(re,te+"."+ke,K)}}else he=Le(),Qe(re,te+"."+ke,he);var ge=ne[Y];ge&&(he=[].concat(ge).concat(he)),ne[Y]=he,ue(",",!0),ue(";",!0)}return ne}var Te=Le();return Qe(re,te,Te),Te}function Qe(re,te,ne){re.setOption&&re.setOption(te,ne)}function ut(re,te,ne,he){re.setParsedOption&&re.setParsedOption(te,ne,he)}function Ge(re){if(ue("[",!0)){do Me(re,"option");while(ue(",",!0));ue("]")}return re}function lt(re,te){if(!B.test(te=ie()))throw de(te,"service name");var ne=new C(te);$e(ne,function(Y){if(!je(ne,Y))if(Y==="rpc")Je(ne,Y);else throw de(Y)}),re.add(ne)}function Je(re,te){var ne=le(),he=te;if(!B.test(te=ie()))throw de(te,"name");var Y=te,K,ge,Te,we;if(ue("("),ue("stream",!0)&&(ge=!0),!Z.test(te=ie())||(K=te,ue(")"),ue("returns"),ue("("),ue("stream",!0)&&(we=!0),!Z.test(te=ie())))throw de(te);Te=te,ue(")");var be=new $(Y,he,K,Te,ge,we);be.comment=ne,$e(be,function(Ue){if(Ue==="option")Me(be,Ue),ue(";");else throw de(Ue)}),re.add(be)}function Xe(re,te){if(!Z.test(te=ie()))throw de(te,"reference");var ne=te;$e(null,function(Y){switch(Y){case"required":case"repeated":Re(re,Y,ne);break;case"optional":ve?Re(re,"proto3_optional",ne):Re(re,"optional",ne);break;default:if(!ve||!Z.test(Y))throw de(Y);fe(Y),Re(re,"optional",ne);break}})}for(var ke;(ke=ie())!==null;)switch(ke){case"package":if(!_e)throw de(ke);De();break;case"import":if(!_e)throw de(ke);qe();break;case"syntax":if(!_e)throw de(ke);Pe();break;case"option":Me(Ee,ke),ue(";");break;default:if(je(Ee,ke)){_e=!1;continue}throw de(ke)}return Q.filename=null,{package:me,imports:oe,weakImports:Se,syntax:ye,root:ce}}return parse_1}var common_1,hasRequiredCommon;function requireCommon(){if(hasRequiredCommon)return common_1;hasRequiredCommon=1,common_1=S;var _=/\/|\./;function S(T,O){_.test(T)||(T="google/protobuf/"+T+".proto",O={nested:{google:{nested:{protobuf:{nested:O}}}}}),S[T]=O}S("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var v;return S("duration",{Duration:v={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),S("timestamp",{Timestamp:v}),S("empty",{Empty:{fields:{}}}),S("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}}}}),S("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}}}}),S("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),S.get=function(O){return S[O]||null},common_1}var hasRequiredSrc;function requireSrc(){if(hasRequiredSrc)return src.exports;hasRequiredSrc=1;var _=src.exports=requireIndexLight();return _.build="full",_.tokenize=requireTokenize(),_.parse=requireParse(),_.common=requireCommon(),_.Root._configure(_.Type,_.parse,_.common),src.exports}var protobufjs,hasRequiredProtobufjs;function requireProtobufjs(){return hasRequiredProtobufjs||(hasRequiredProtobufjs=1,protobufjs=requireSrc()),protobufjs}var protobufjsExports=requireProtobufjs();const h=getDefaultExportFromCjs(protobufjsExports);let i$1=h.Reader,l=h.Writer,f=h.util;const $root=h.roots["push-server"]||(h.roots["push-server"]={});$root.RequestBatch=function(){function _(S){if(this.requests=[],S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.requests=f.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,v){if(v||(v=l.create()),S.requests!=null&&S.requests.length)for(var T=0;T<S.requests.length;++T)$root.Request.encode(S.requests[T],v.uint32(10).fork()).ldelim();return v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.RequestBatch;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.requests&&O.requests.length||(O.requests=[]),O.requests.push($root.Request.decode(S,S.uint32()));break;default:S.skipType(A&7);break}}return O},_}(),$root.Request=function(){function _(v){if(v)for(var T=Object.keys(v),O=0;O<T.length;++O)v[T[O]]!=null&&(this[T[O]]=v[T[O]])}_.prototype.incomingMessages=null,_.prototype.channelStats=null,_.prototype.serverStats=null;var S;return Object.defineProperty(_.prototype,"command",{get:f.oneOfGetter(S=["incomingMessages","channelStats","serverStats"]),set:f.oneOfSetter(S)}),_.create=function(v){return new _(v)},_.encode=function(v,T){return T||(T=l.create()),v.incomingMessages!=null&&v.hasOwnProperty("incomingMessages")&&$root.IncomingMessagesRequest.encode(v.incomingMessages,T.uint32(10).fork()).ldelim(),v.channelStats!=null&&v.hasOwnProperty("channelStats")&&$root.ChannelStatsRequest.encode(v.channelStats,T.uint32(18).fork()).ldelim(),v.serverStats!=null&&v.hasOwnProperty("serverStats")&&$root.ServerStatsRequest.encode(v.serverStats,T.uint32(26).fork()).ldelim(),T},_.decode=function(v,T){v instanceof i$1||(v=i$1.create(v));for(var O=T===void 0?v.len:v.pos+T,A=new $root.Request;v.pos<O;){var k=v.uint32();switch(k>>>3){case 1:A.incomingMessages=$root.IncomingMessagesRequest.decode(v,v.uint32());break;case 2:A.channelStats=$root.ChannelStatsRequest.decode(v,v.uint32());break;case 3:A.serverStats=$root.ServerStatsRequest.decode(v,v.uint32());break;default:v.skipType(k&7);break}}return A},_}(),$root.IncomingMessagesRequest=function(){function _(S){if(this.messages=[],S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.messages=f.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,v){if(v||(v=l.create()),S.messages!=null&&S.messages.length)for(var T=0;T<S.messages.length;++T)$root.IncomingMessage.encode(S.messages[T],v.uint32(10).fork()).ldelim();return v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.IncomingMessagesRequest;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.messages&&O.messages.length||(O.messages=[]),O.messages.push($root.IncomingMessage.decode(S,S.uint32()));break;default:S.skipType(A&7);break}}return O},_}(),$root.IncomingMessage=function(){function _(S){if(this.receivers=[],S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.receivers=f.emptyArray,_.prototype.sender=null,_.prototype.body="",_.prototype.expiry=0,_.prototype.type="",_.create=function(S){return new _(S)},_.encode=function(S,v){if(v||(v=l.create()),S.receivers!=null&&S.receivers.length)for(var T=0;T<S.receivers.length;++T)$root.Receiver.encode(S.receivers[T],v.uint32(10).fork()).ldelim();return S.sender!=null&&S.hasOwnProperty("sender")&&$root.Sender.encode(S.sender,v.uint32(18).fork()).ldelim(),S.body!=null&&S.hasOwnProperty("body")&&v.uint32(26).string(S.body),S.expiry!=null&&S.hasOwnProperty("expiry")&&v.uint32(32).uint32(S.expiry),S.type!=null&&S.hasOwnProperty("type")&&v.uint32(42).string(S.type),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.IncomingMessage;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.receivers&&O.receivers.length||(O.receivers=[]),O.receivers.push($root.Receiver.decode(S,S.uint32()));break;case 2:O.sender=$root.Sender.decode(S,S.uint32());break;case 3:O.body=S.string();break;case 4:O.expiry=S.uint32();break;case 5:O.type=S.string();break;default:S.skipType(A&7);break}}return O},_}(),$root.ChannelStatsRequest=function(){function _(S){if(this.channels=[],S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.channels=f.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,v){if(v||(v=l.create()),S.channels!=null&&S.channels.length)for(var T=0;T<S.channels.length;++T)$root.ChannelId.encode(S.channels[T],v.uint32(10).fork()).ldelim();return v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.ChannelStatsRequest;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.channels&&O.channels.length||(O.channels=[]),O.channels.push($root.ChannelId.decode(S,S.uint32()));break;default:S.skipType(A&7);break}}return O},_}(),$root.ChannelId=function(){function _(S){if(S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.id=f.newBuffer([]),_.prototype.isPrivate=!1,_.prototype.signature=f.newBuffer([]),_.create=function(S){return new _(S)},_.encode=function(S,v){return v||(v=l.create()),S.id!=null&&S.hasOwnProperty("id")&&v.uint32(10).bytes(S.id),S.isPrivate!=null&&S.hasOwnProperty("isPrivate")&&v.uint32(16).bool(S.isPrivate),S.signature!=null&&S.hasOwnProperty("signature")&&v.uint32(26).bytes(S.signature),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.ChannelId;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.id=S.bytes();break;case 2:O.isPrivate=S.bool();break;case 3:O.signature=S.bytes();break;default:S.skipType(A&7);break}}return O},_}(),$root.ServerStatsRequest=function(){function _(S){if(S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.create=function(S){return new _(S)},_.encode=function(S,v){return v||(v=l.create()),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.ServerStatsRequest;S.pos<T;){var A=S.uint32();switch(A>>>3){default:S.skipType(A&7);break}}return O},_}(),$root.Sender=function(){function _(S){if(S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.type=0,_.prototype.id=f.newBuffer([]),_.create=function(S){return new _(S)},_.encode=function(S,v){return v||(v=l.create()),S.type!=null&&S.hasOwnProperty("type")&&v.uint32(8).int32(S.type),S.id!=null&&S.hasOwnProperty("id")&&v.uint32(18).bytes(S.id),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.Sender;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.type=S.int32();break;case 2:O.id=S.bytes();break;default:S.skipType(A&7);break}}return O},_}(),$root.SenderType=function(){var _={},S=Object.create(_);return S[_[0]="UNKNOWN"]=0,S[_[1]="CLIENT"]=1,S[_[2]="BACKEND"]=2,S}(),$root.Receiver=function(){function _(S){if(S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.id=f.newBuffer([]),_.prototype.isPrivate=!1,_.prototype.signature=f.newBuffer([]),_.create=function(S){return new _(S)},_.encode=function(S,v){return v||(v=l.create()),S.id!=null&&S.hasOwnProperty("id")&&v.uint32(10).bytes(S.id),S.isPrivate!=null&&S.hasOwnProperty("isPrivate")&&v.uint32(16).bool(S.isPrivate),S.signature!=null&&S.hasOwnProperty("signature")&&v.uint32(26).bytes(S.signature),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.Receiver;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.id=S.bytes();break;case 2:O.isPrivate=S.bool();break;case 3:O.signature=S.bytes();break;default:S.skipType(A&7);break}}return O},_}(),$root.ResponseBatch=function(){function _(S){if(this.responses=[],S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.responses=f.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,v){if(v||(v=l.create()),S.responses!=null&&S.responses.length)for(var T=0;T<S.responses.length;++T)$root.Response.encode(S.responses[T],v.uint32(10).fork()).ldelim();return v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.ResponseBatch;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.responses&&O.responses.length||(O.responses=[]),O.responses.push($root.Response.decode(S,S.uint32()));break;default:S.skipType(A&7);break}}return O},_}(),$root.Response=function(){function _(v){if(v)for(var T=Object.keys(v),O=0;O<T.length;++O)v[T[O]]!=null&&(this[T[O]]=v[T[O]])}_.prototype.outgoingMessages=null,_.prototype.channelStats=null,_.prototype.serverStats=null;var S;return Object.defineProperty(_.prototype,"command",{get:f.oneOfGetter(S=["outgoingMessages","channelStats","serverStats"]),set:f.oneOfSetter(S)}),_.create=function(v){return new _(v)},_.encode=function(v,T){return T||(T=l.create()),v.outgoingMessages!=null&&v.hasOwnProperty("outgoingMessages")&&$root.OutgoingMessagesResponse.encode(v.outgoingMessages,T.uint32(10).fork()).ldelim(),v.channelStats!=null&&v.hasOwnProperty("channelStats")&&$root.ChannelStatsResponse.encode(v.channelStats,T.uint32(18).fork()).ldelim(),v.serverStats!=null&&v.hasOwnProperty("serverStats")&&$root.JsonResponse.encode(v.serverStats,T.uint32(26).fork()).ldelim(),T},_.decode=function(v,T){v instanceof i$1||(v=i$1.create(v));for(var O=T===void 0?v.len:v.pos+T,A=new $root.Response;v.pos<O;){var k=v.uint32();switch(k>>>3){case 1:A.outgoingMessages=$root.OutgoingMessagesResponse.decode(v,v.uint32());break;case 2:A.channelStats=$root.ChannelStatsResponse.decode(v,v.uint32());break;case 3:A.serverStats=$root.JsonResponse.decode(v,v.uint32());break;default:v.skipType(k&7);break}}return A},_}(),$root.OutgoingMessagesResponse=function(){function _(S){if(this.messages=[],S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.messages=f.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,v){if(v||(v=l.create()),S.messages!=null&&S.messages.length)for(var T=0;T<S.messages.length;++T)$root.OutgoingMessage.encode(S.messages[T],v.uint32(10).fork()).ldelim();return v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.OutgoingMessagesResponse;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.messages&&O.messages.length||(O.messages=[]),O.messages.push($root.OutgoingMessage.decode(S,S.uint32()));break;default:S.skipType(A&7);break}}return O},_}(),$root.OutgoingMessage=function(){function _(S){if(S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.id=f.newBuffer([]),_.prototype.body="",_.prototype.expiry=0,_.prototype.created=0,_.prototype.sender=null,_.create=function(S){return new _(S)},_.encode=function(S,v){return v||(v=l.create()),S.id!=null&&S.hasOwnProperty("id")&&v.uint32(10).bytes(S.id),S.body!=null&&S.hasOwnProperty("body")&&v.uint32(18).string(S.body),S.expiry!=null&&S.hasOwnProperty("expiry")&&v.uint32(24).uint32(S.expiry),S.created!=null&&S.hasOwnProperty("created")&&v.uint32(37).fixed32(S.created),S.sender!=null&&S.hasOwnProperty("sender")&&$root.Sender.encode(S.sender,v.uint32(42).fork()).ldelim(),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.OutgoingMessage;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.id=S.bytes();break;case 2:O.body=S.string();break;case 3:O.expiry=S.uint32();break;case 4:O.created=S.fixed32();break;case 5:O.sender=$root.Sender.decode(S,S.uint32());break;default:S.skipType(A&7);break}}return O},_}(),$root.ChannelStatsResponse=function(){function _(S){if(this.channels=[],S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.channels=f.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,v){if(v||(v=l.create()),S.channels!=null&&S.channels.length)for(var T=0;T<S.channels.length;++T)$root.ChannelStats.encode(S.channels[T],v.uint32(10).fork()).ldelim();return v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.ChannelStatsResponse;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.channels&&O.channels.length||(O.channels=[]),O.channels.push($root.ChannelStats.decode(S,S.uint32()));break;default:S.skipType(A&7);break}}return O},_}(),$root.ChannelStats=function(){function _(S){if(S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.id=f.newBuffer([]),_.prototype.isPrivate=!1,_.prototype.isOnline=!1,_.create=function(S){return new _(S)},_.encode=function(S,v){return v||(v=l.create()),S.id!=null&&S.hasOwnProperty("id")&&v.uint32(10).bytes(S.id),S.isPrivate!=null&&S.hasOwnProperty("isPrivate")&&v.uint32(16).bool(S.isPrivate),S.isOnline!=null&&S.hasOwnProperty("isOnline")&&v.uint32(24).bool(S.isOnline),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.ChannelStats;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.id=S.bytes();break;case 2:O.isPrivate=S.bool();break;case 3:O.isOnline=S.bool();break;default:S.skipType(A&7);break}}return O},_}(),$root.JsonResponse=function(){function _(S){if(S)for(var v=Object.keys(S),T=0;T<v.length;++T)S[v[T]]!=null&&(this[v[T]]=S[v[T]])}return _.prototype.json="",_.create=function(S){return new _(S)},_.encode=function(S,v){return v||(v=l.create()),S.json!=null&&S.hasOwnProperty("json")&&v.uint32(10).string(S.json),v},_.decode=function(S,v){S instanceof i$1||(S=i$1.create(S));for(var T=v===void 0?S.len:S.pos+v,O=new $root.JsonResponse;S.pos<T;){var A=S.uint32();switch(A>>>3){case 1:O.json=S.string();break;default:S.skipType(A&7);break}}return O},_}(),$root.Response;const ResponseBatch=$root.ResponseBatch;$root.Request;const RequestBatch=$root.RequestBatch;$root.IncomingMessagesRequest;const IncomingMessage=$root.IncomingMessage,Receiver=$root.Receiver;class AbstractConnector{_logger=null;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(S){this._parent=S.parent,this._connectionType=ConnectionType.Undefined,this._callbacks={onOpen:c.isFunction(S.onOpen)?S.onOpen:()=>{},onDisconnect:c.isFunction(S.onDisconnect)?S.onDisconnect:()=>{},onError:c.isFunction(S.onError)?S.onError:()=>{},onMessage:c.isFunction(S.onMessage)?S.onMessage:()=>{}}}setLogger(S){this._logger=S}getLogger(){return this._logger===null&&(this._logger=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}destroy(){}get connected(){return this._connected}set connected(S){S!=this._connected&&(this._connected=S,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 WebSocketConnector extends AbstractConnector{_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(S){super(S),this._connectionType=ConnectionType.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(S,v){this._socket!==null&&(this.clearEventListener(),this._socket.close(S,v)),this._socket=null,this._disconnectCode=S,this._disconnectReason=v,this.connected=!1}send(S){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: WebSocket is not connected`)),!1):(this._socket.send(S),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(S){this._socket=null,this._disconnectCode=Number(S.code),this._disconnectReason=S.reason,this.connected=!1}_onSocketError(S){this._callbacks.onError(new Error(`Socket error: ${S}`))}_onSocketMessage(S){this._callbacks.onMessage(S.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 a=60;class LongPollingConnector extends AbstractConnector{_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(S){super(S),this._active=!1,this._connectionType=ConnectionType.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=this.createXhr(),this._requestAborted=!1}connect(){this._active=!0,this.performRequest()}disconnect(S,v){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=S,this._disconnectReason=v,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),a*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(S){const v=this._parent.getPublicationPath();if(!v)return this.getLogger().error(new Error(`${h$1.getDateForLog()}: Pull: publication path is empty`)),!1;const T=new XMLHttpRequest;return T.open("POST",v),T.send(S),!0}onResponse(S){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,c.isStringFilled(S)||S instanceof ArrayBuffer?this._callbacks.onMessage(S):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 v=this._xhr.getResponseHeader("Last-Message-Id");c.isStringFilled(v)&&this._parent.setLastMessageId(v||"")}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 S=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(S.responseType="arraybuffer"),S.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),S}}const m$1=19,I=30*60,H=5e3,G=60*1e3,E=10,R=10,F="ping",J="pong",w="bx-pull-session",V=20,L={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class PullClient{_logger=null;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=ConnectionType.WebSocket;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[ConnectionType.Undefined]:null,[ConnectionType.WebSocket]:null,[ConnectionType.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(S){this._restClient=S.b24,this._status=PullStatus.Offline,this._context="master",S.restApplication&&(typeof S.configGetMethod>"u"&&(S.configGetMethod="pull.application.config.get"),typeof S.skipCheckRevision>"u"&&(S.skipCheckRevision=!0),c.isStringFilled(S.restApplication)&&(S.siteId=S.restApplication),S.serverEnabled=!0),this._guestMode=S.guestMode?h$1.toBoolean(S.guestMode):!1,this._guestUserId=S.guestUserId?h$1.toInteger(S.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=S.userId?h$1.toInteger(S.userId):0),this._siteId=S.siteId??"none",this._enabled=c.isUndefined(S.serverEnabled)?!0:S.serverEnabled===!0,this._configGetMethod=c.isStringFilled(S.configGetMethod)?S.configGetMethod||"":"pull.config.get",this._getPublicListMethod=c.isStringFilled(S.getPublicListMethod)?S.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=S.skipStorageInit===!0,this._skipCheckRevision=S.skipCheckRevision===!0,c.isUndefined(S.configTimestamp)||(this._configTimestamp=h$1.toInteger(S.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new StorageManager({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new SharedConfig({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new ChannelManager({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(S){this._logger=S,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=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}destroy(){this.stop(CloseReasons.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new WebSocketConnector({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 LongPollingConnector({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()?ConnectionType.WebSocket:ConnectionType.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 JsonRpc({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(S){this._status!==S&&(this._status=S,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),S===PullStatus.Offline?this.sendPullStatusDelayed(S,H):this.sendPullStatus(S))}get session(){return this._session}subscribe(S){if(!c.isPlainObject(S))return this.attachCommandHandler(S);if(S=S,S.type=S.type||SubscriptionType.Server,S.command=S.command||null,S.type==SubscriptionType.Server||S.type==SubscriptionType.Client){if(typeof S.moduleId>"u")throw new TypeError(`${h$1.getDateForLog()}: Pull.subscribe: parameter moduleId is not specified`);return typeof this._subscribers[S.type]>"u"&&(this._subscribers[S.type]={}),typeof this._subscribers[S.type][S.moduleId]>"u"&&(this._subscribers[S.type][S.moduleId]={callbacks:[],commands:{}}),S.command?(typeof this._subscribers[S.type][S.moduleId].commands[S.command]>"u"&&(this._subscribers[S.type][S.moduleId].commands[S.command]=[]),this._subscribers[S.type][S.moduleId].commands[S.command].push(S.callback),()=>{typeof S.type>"u"||typeof S.moduleId>"u"||typeof S.command>"u"||S.command===null||(this._subscribers[S.type][S.moduleId].commands[S.command]=this._subscribers[S.type][S.moduleId].commands[S.command].filter(v=>v!==S.callback))}):(this._subscribers[S.type][S.moduleId].callbacks.push(S.callback),()=>{typeof S.type>"u"||typeof S.moduleId>"u"||(this._subscribers[S.type][S.moduleId].callbacks=this._subscribers[S.type][S.moduleId].callbacks.filter(v=>v!==S.callback))})}else return typeof this._subscribers[S.type]>"u"&&(this._subscribers[S.type]=[]),this._subscribers[S.type].push(S.callback),()=>{typeof S.type>"u"||(this._subscribers[S.type]=this._subscribers[S.type].filter(v=>v!==S.callback))}}attachCommandHandler(S){if(typeof S.getModuleId!="function"||typeof S.getModuleId()!="string")return this.getLogger().error(`${h$1.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let v=SubscriptionType.Server;return typeof S.getSubscriptionType=="function"&&(v=S.getSubscriptionType()),this.subscribe({type:v,moduleId:S.getModuleId(),callback:T=>{let O=null;if(typeof S.getMap=="function"){const A=S.getMap();if(A&&typeof A=="object"){const k=A[T.command];typeof k=="function"?O=k.bind(S):typeof k=="string"&&typeof S[k]=="function"&&(O=S[k].bind(S))}}if(!O){const A=`handle${h$1.capitalize(T.command)}`;typeof S[A]=="function"&&(O=S[A].bind(S))}O&&(this._debug&&this._context!=="master"&&this.getLogger().warn(`${h$1.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,T),O(T.params,T.extra,T.command))}})}async start(S=null){let v=!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 T=!1;if(S&&c.isPlainObject(S)&&(typeof S?.skipReconnectToLastSession<"u"&&(T=S.skipReconnectToLastSession,delete S.skipReconnectToLastSession),this._config=S,v=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const O=Date.now();let A;return!T&&this._storage&&(A=this._storage.get(w,null)),c.isPlainObject(A)&&A.hasOwnProperty("ttl")&&A.ttl>=O&&(this._session.mid=A.mid),this._starting=!0,this._startingPromise=new Promise((k,C)=>{this.loadConfig("client_start").then($=>{this.setConfig($,v),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>k(!0),x=>C(x))}).catch($=>{this._starting=!1,this.status=PullStatus.Offline,this.stopCheckConfig(),this.getLogger().error(`${h$1.getDateForLog()}: Pull: could not read push-server config `,$),C($)})})}restart(S=CloseReasons.NORMAL_CLOSURE,v="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().log(`${h$1.getDateForLog()}: Pull: restarting with code ${S}`),this.disconnect(S,v),this._storage&&this._storage.remove(LsKeys.PullConfig),this._config=null;const T=`${S}_${v.replaceAll(" ","_")}`;this.loadConfig(T).then(O=>{this.setConfig(O,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(A=>{this.getLogger().error(A)})},O=>{this.getLogger().error(`${h$1.getDateForLog()}: Pull: could not read push-server config `,O),this.status=PullStatus.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(O?.status==401||O?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(S=CloseReasons.NORMAL_CLOSURE,v="manual stop"){this.disconnect(S,v),this.stopCheckConfig()}reconnect(S,v,T=1){this.disconnect(S,v),this.scheduleReconnect(T)}setLastMessageId(S){this._session.mid=S}async sendMessage(S,v,T,O,A){const k={userList:S,body:{module_id:v,command:T,params:O},expiry:A};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.Publish,k):this.sendMessageBatch([k])}async sendMessageToChannels(S,v,T,O,A){const k={channelList:S,body:{module_id:v,command:T,params:O},expiry:A};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.Publish,k):this.sendMessageBatch([k])}capturePullEvent(S=!0){this._debug=S}enableLogging(S=!0){this._sharedConfig.setLoggingEnabled(S),this._loggingEnabled=S}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(S){if(!c.isArray(S)||!S.every(T=>typeof T=="number"))throw new Error("userList must be an array of numbers");const v={};return new Promise((T,O)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.GetUsersLastSeen,{userList:S}).then(A=>{const k=[];for(let $=0;$<S.length;$++)A.hasOwnProperty(S[$])||k.push(S[$]);if(k.length===0)return T(v);const C={userIds:k,sendToQueueSever:!0};this._restClient.callMethod("pull.api.user.getLastSeen",C).then($=>{const x=$.getData().result;for(const N in x)v[Number(N)]=Number(x[N]);return T(v)}).catch($=>{this.getLogger().error($),O($)})}).catch(A=>{this.getLogger().error(A),O(A)})})}async ping(S=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.Ping,{},S)}async subscribeUserStatusChange(S,v){return new Promise((T,O)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.SubscribeStatusChange,{userId:S}).then(()=>(this._userStatusCallbacks[S]||(this._userStatusCallbacks[S]=[]),c.isFunction(v)&&this._userStatusCallbacks[S].push(v),T())).catch(A=>O(A))})}async unsubscribeUserStatusChange(S,v){return this._userStatusCallbacks[S]&&(this._userStatusCallbacks[S]=this._userStatusCallbacks[S].filter(T=>T!==v),this._userStatusCallbacks[S].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.UnsubscribeStatusChange,{userId:S}):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 S;this._config&&this._config.channels?S={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:S={ConfigError:"config is not loaded"};let v="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?v="json-rpc":v=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":v,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...S,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(S){let v;const T={};switch(S){case ConnectionType.WebSocket:v=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case ConnectionType.LongPolling:v=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${S}`)}if(!c.isStringFilled(v))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")T.token=this._config?.jwt;else{const O=[];if(this._config?.channels?.private&&O.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&O.push(this._config.channels.private.id),this._config?.channels.shared?.id&&O.push(this._config.channels.shared.id),O.length===0)throw new Error("Empty channels");T.CHANNEL_ID=O.join("/")}if(this.isJsonRpc()?T.jsonRpc="true":this.isProtobufSupported()&&(T.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");T.clientId=this._config.clientId}return this._session.mid&&(T.mid=this._session.mid),this._session.tag&&(T.tag=this._session.tag),this._session.time&&(T.time=this._session.time),T.revision=m$1,`${v}?${h$1.buildQueryString(T)}`}getPublicationPath(){const S=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!S)return"";const v=[];this._config?.channels.private?.id&&v.push(this._config.channels.private.id),this._config?.channels.shared?.id&&v.push(this._config.channels.shared.id);const T={CHANNEL_ID:v.join("/")};return S+"?"+h$1.buildQueryString(T)}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&&!s$1.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===ServerMode.Shared}emit(S){if(S.type==SubscriptionType.Server||S.type==SubscriptionType.Client){if(typeof this._subscribers[S.type]>"u"&&(this._subscribers[S.type]={}),typeof S.moduleId>"u")throw new TypeError(`${h$1.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[S.type][S.moduleId]>"u"&&(this._subscribers[S.type][S.moduleId]={callbacks:[],commands:{}}),this._subscribers[S.type][S.moduleId].callbacks.length>0&&this._subscribers[S.type][S.moduleId].callbacks.forEach(v=>{v(S.data,{type:S.type,moduleId:S.moduleId})}),!(typeof S.data>"u")&&!(typeof S.data.command>"u")&&this._subscribers[S.type][S.moduleId].commands[S.data.command]&&this._subscribers[S.type][S.moduleId].commands[S.data.command].length>0&&this._subscribers[S.type][S.moduleId].commands[S.data.command].forEach(v=>{typeof S.data>"u"||v(S.data.params,S.data.extra,S.data.command,{type:S.type,moduleId:S.moduleId})}),!0}else return typeof this._subscribers[S.type]>"u"&&(this._subscribers[S.type]=[]),this._subscribers[S.type].length<=0||this._subscribers[S.type].forEach(v=>{v(S.data,{type:S.type})}),!0}broadcastMessage(S){const v=S.module_id=S.module_id.toLowerCase(),T=S.command;S.extra||(S.extra={}),S.extra.server_time_unix&&(S.extra.server_time_ago=(Date.now()-S.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),S.extra.server_time_ago=S.extra.server_time_ago>0?S.extra.server_time_ago:0),this.logMessage(S);try{S.extra.sender&&S.extra.sender.type===SenderType.Client?(this.onCustomEvent("onPullClientEvent-"+v,[T,S.params,S.extra],!0),this.onCustomEvent("onPullClientEvent",[v,T,S.params,S.extra],!0),this.emit({type:SubscriptionType.Client,moduleId:v,data:{command:T,params:c.clone(S.params),extra:c.clone(S.extra)}})):v==="pull"?this.handleInternalPullEvent(T,S):v=="online"?((S?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[T,S.params,S.extra],!0),this.emit({type:SubscriptionType.Online,data:{command:T,params:c.clone(S.params),extra:c.clone(S.extra)}})),T==="userStatusChange"&&this.emitUserStatusChange(S.params.user_id,S.params.online)):(this.onCustomEvent("onPullEvent-"+v,[T,S.params,S.extra],!0),this.onCustomEvent("onPullEvent",[v,T,S.params,S.extra],!0),this.emit({type:SubscriptionType.Server,moduleId:v,data:{command:T,params:c.clone(S.params),extra:c.clone(S.extra)}}))}catch(O){this.getLogger().warn(`
20
+ }`}return u.toString=c,u}s.verbose=!1},{}],4:[function(t,n,i){n.exports=s;function s(){this._listeners={}}s.prototype.on=function(o,l,a){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:l,ctx:a||this}),this},s.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},s.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,i){n.exports=a;var s=t(1),o=t(7),l=o("fs");function a(u,c,h){return typeof c=="function"?(h=c,c={}):c||(c={}),h?!c.xhr&&l&&l.readFile?l.readFile(u,function(f,d){return f&&typeof XMLHttpRequest<"u"?a.xhr(u,c,h):f?h(f):h(null,c.binary?d:d.toString("utf8"))}):a.xhr(u,c,h):s(a,this,u,c)}a.xhr=function(u,c,h){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState!==4)return e;if(f.status!==0&&f.status!==200)return h(Error("status "+f.status));if(c.binary){var d=f.response;if(!d){d=[];for(var g=0;g<f.responseText.length;++g)d.push(f.responseText.charCodeAt(g)&255)}return h(null,typeof Uint8Array<"u"?new Uint8Array(d):d)}return h(null,f.responseText)},c.binary&&("overrideMimeType"in f&&f.overrideMimeType("text/plain; charset=x-user-defined"),f.responseType="arraybuffer"),f.open("GET",u),f.send()}},{1:1,7:7}],6:[function(t,n,i){n.exports=s(s);function s(c){return typeof Float32Array<"u"?function(){var h=new Float32Array([-0]),f=new Uint8Array(h.buffer),d=f[3]===128;function g(w,_,b){h[0]=w,_[b]=f[0],_[b+1]=f[1],_[b+2]=f[2],_[b+3]=f[3]}function p(w,_,b){h[0]=w,_[b]=f[3],_[b+1]=f[2],_[b+2]=f[1],_[b+3]=f[0]}c.writeFloatLE=d?g:p,c.writeFloatBE=d?p:g;function m(w,_){return f[0]=w[_],f[1]=w[_+1],f[2]=w[_+2],f[3]=w[_+3],h[0]}function y(w,_){return f[3]=w[_],f[2]=w[_+1],f[1]=w[_+2],f[0]=w[_+3],h[0]}c.readFloatLE=d?m:y,c.readFloatBE=d?y:m}():function(){function h(d,g,p,m){var y=g<0?1:0;if(y&&(g=-g),g===0)d(1/g>0?0:2147483648,p,m);else if(isNaN(g))d(2143289344,p,m);else if(g>34028234663852886e22)d((y<<31|2139095040)>>>0,p,m);else if(g<11754943508222875e-54)d((y<<31|Math.round(g/1401298464324817e-60))>>>0,p,m);else{var w=Math.floor(Math.log(g)/Math.LN2),_=Math.round(g*Math.pow(2,-w)*8388608)&8388607;d((y<<31|w+127<<23|_)>>>0,p,m)}}c.writeFloatLE=h.bind(null,o),c.writeFloatBE=h.bind(null,l);function f(d,g,p){var m=d(g,p),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=f.bind(null,a),c.readFloatBE=f.bind(null,u)}(),typeof Float64Array<"u"?function(){var h=new Float64Array([-0]),f=new Uint8Array(h.buffer),d=f[7]===128;function g(w,_,b){h[0]=w,_[b]=f[0],_[b+1]=f[1],_[b+2]=f[2],_[b+3]=f[3],_[b+4]=f[4],_[b+5]=f[5],_[b+6]=f[6],_[b+7]=f[7]}function p(w,_,b){h[0]=w,_[b]=f[7],_[b+1]=f[6],_[b+2]=f[5],_[b+3]=f[4],_[b+4]=f[3],_[b+5]=f[2],_[b+6]=f[1],_[b+7]=f[0]}c.writeDoubleLE=d?g:p,c.writeDoubleBE=d?p:g;function m(w,_){return f[0]=w[_],f[1]=w[_+1],f[2]=w[_+2],f[3]=w[_+3],f[4]=w[_+4],f[5]=w[_+5],f[6]=w[_+6],f[7]=w[_+7],h[0]}function y(w,_){return f[7]=w[_],f[6]=w[_+1],f[5]=w[_+2],f[4]=w[_+3],f[3]=w[_+4],f[2]=w[_+5],f[1]=w[_+6],f[0]=w[_+7],h[0]}c.readDoubleLE=d?m:y,c.readDoubleBE=d?y:m}():function(){function h(d,g,p,m,y,w){var _=m<0?1:0;if(_&&(m=-m),m===0)d(0,y,w+g),d(1/m>0?0:2147483648,y,w+p);else if(isNaN(m))d(0,y,w+g),d(2146959360,y,w+p);else if(m>17976931348623157e292)d(0,y,w+g),d((_<<31|2146435072)>>>0,y,w+p);else{var b;if(m<22250738585072014e-324)b=m/5e-324,d(b>>>0,y,w+g),d((_<<31|b/4294967296)>>>0,y,w+p);else{var k=Math.floor(Math.log(m)/Math.LN2);k===1024&&(k=1023),b=m*Math.pow(2,-k),d(b*4503599627370496>>>0,y,w+g),d((_<<31|k+1023<<20|b*1048576&1048575)>>>0,y,w+p)}}}c.writeDoubleLE=h.bind(null,o,0,4),c.writeDoubleBE=h.bind(null,l,4,0);function f(d,g,p,m,y){var w=d(m,y+g),_=d(m,y+p),b=(_>>31)*2+1,k=_>>>20&2047,S=4294967296*(_&1048575)+w;return k===2047?S?NaN:b*(1/0):k===0?b*5e-324*S:b*Math.pow(2,k-1075)*(S+4503599627370496)}c.readDoubleLE=f.bind(null,a,0,4),c.readDoubleBE=f.bind(null,u,4,0)}(),c}function o(c,h,f){h[f]=c&255,h[f+1]=c>>>8&255,h[f+2]=c>>>16&255,h[f+3]=c>>>24}function l(c,h,f){h[f]=c>>>24,h[f+1]=c>>>16&255,h[f+2]=c>>>8&255,h[f+3]=c&255}function a(c,h){return(c[h]|c[h+1]<<8|c[h+2]<<16|c[h+3]<<24)>>>0}function u(c,h){return(c[h]<<24|c[h+1]<<16|c[h+2]<<8|c[h+3])>>>0}},{}],7:[function(t,n,i){n.exports=s;function s(o){try{var l=t(o);if(l&&(l.length||Object.keys(l).length))return l}catch{}return null}},{}],8:[function(t,n,i){var s=i,o=s.isAbsolute=function(a){return/^(?:\/|\w+:)/.test(a)},l=s.normalize=function(a){a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var u=a.split("/"),c=o(a),h="";c&&(h=u.shift()+"/");for(var f=0;f<u.length;)u[f]===".."?f>0&&u[f-1]!==".."?u.splice(--f,2):c?u.splice(f,1):++f:u[f]==="."?u.splice(f,1):++f;return h+u.join("/")};s.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,i){n.exports=s;function s(o,l,a){var u=a||8192,c=u>>>1,h=null,f=u;return function(d){if(d<1||d>c)return o(d);f+d>u&&(h=o(u),f=0);var g=l.call(h,f,f+=d);return f&7&&(f=(f|7)+1),g}}},{}],10:[function(t,n,i){var s=i;s.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},s.read=function(o,l,a){var u=a-l;if(u<1)return"";for(var c=null,h=[],f=0,d;l<a;)d=o[l++],d<128?h[f++]=d:d>191&&d<224?h[f++]=(d&31)<<6|o[l++]&63:d>239&&d<365?(d=((d&7)<<18|(o[l++]&63)<<12|(o[l++]&63)<<6|o[l++]&63)-65536,h[f++]=55296+(d>>10),h[f++]=56320+(d&1023)):h[f++]=(d&15)<<12|(o[l++]&63)<<6|o[l++]&63,f>8191&&((c||(c=[])).push(String.fromCharCode.apply(String,h)),f=0);return c?(f&&c.push(String.fromCharCode.apply(String,h.slice(0,f))),c.join("")):String.fromCharCode.apply(String,h.slice(0,f))},s.write=function(o,l,a){for(var u=a,c,h,f=0;f<o.length;++f)c=o.charCodeAt(f),c<128?l[a++]=c:c<2048?(l[a++]=c>>6|192,l[a++]=c&63|128):(c&64512)===55296&&((h=o.charCodeAt(f+1))&64512)===56320?(c=65536+((c&1023)<<10)+(h&1023),++f,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,i){n.exports=o;var s=/\/|\./;function o(a,u){s.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,i){var s=i,o=t(15),l=t(37);function a(c,h,f,d){if(h.resolvedType)if(h.resolvedType instanceof o){c("switch(d%s){",d);for(var g=h.resolvedType.values,p=Object.keys(g),m=0;m<p.length;++m)h.repeated&&g[p[m]]===h.typeDefault&&c("default:"),c("case%j:",p[m])("case %i:",g[p[m]])("m%s=%j",d,g[p[m]])("break");c("}")}else c('if(typeof d%s!=="object")',d)("throw TypeError(%j)",h.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",d,f,d);else{var y=!1;switch(h.type){case"double":case"float":c("m%s=Number(d%s)",d,d);break;case"uint32":case"fixed32":c("m%s=d%s>>>0",d,d);break;case"int32":case"sint32":case"sfixed32":c("m%s=d%s|0",d,d);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",d,d,y)('else if(typeof d%s==="string")',d)("m%s=parseInt(d%s,10)",d,d)('else if(typeof d%s==="number")',d)("m%s=d%s",d,d)('else if(typeof d%s==="object")',d)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",d,d,d,y?"true":"");break;case"bytes":c('if(typeof d%s==="string")',d)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",d,d,d)("else if(d%s.length)",d)("m%s=d%s",d,d);break;case"string":c("m%s=String(d%s)",d,d);break;case"bool":c("m%s=Boolean(d%s)",d,d);break}}return c}s.fromObject=function(c){var h=c.fieldsArray,f=l.codegen(["d"],c.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!h.length)return f("return new this.ctor");f("var m=new this.ctor");for(var d=0;d<h.length;++d){var g=h[d].resolve(),p=l.safeProp(g.name);g.map?(f("if(d%s){",p)('if(typeof d%s!=="object")',p)("throw TypeError(%j)",g.fullName+": object expected")("m%s={}",p)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",p),a(f,g,d,p+"[ks[i]]")("}")("}")):g.repeated?(f("if(d%s){",p)("if(!Array.isArray(d%s))",p)("throw TypeError(%j)",g.fullName+": array expected")("m%s=[]",p)("for(var i=0;i<d%s.length;++i){",p),a(f,g,d,p+"[i]")("}")("}")):(g.resolvedType instanceof o||f("if(d%s!=null){",p),a(f,g,d,p),g.resolvedType instanceof o||f("}"))}return f("return m")};function u(c,h,f,d){if(h.resolvedType)h.resolvedType instanceof o?c("d%s=o.enums===String?types[%i].values[m%s]:m%s",d,f,d,d):c("d%s=types[%i].toObject(m%s,o)",d,f,d);else{var g=!1;switch(h.type){case"double":case"float":c("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",d,d,d,d);break;case"uint64":g=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":c('if(typeof m%s==="number")',d)("d%s=o.longs===String?String(m%s):m%s",d,d,d)("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",d,d,d,d,g?"true":"",d);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",d,d,d,d,d);break;default:c("d%s=m%s",d,d);break}}return c}s.toObject=function(c){var h=c.fieldsArray.slice().sort(l.compareFieldsById);if(!h.length)return l.codegen()("return {}");for(var f=l.codegen(["m","o"],c.name+"$toObject")("if(!o)")("o={}")("var d={}"),d=[],g=[],p=[],m=0;m<h.length;++m)h[m].partOf||(h[m].resolve().repeated?d:h[m].map?g:p).push(h[m]);if(d.length){for(f("if(o.arrays||o.defaults){"),m=0;m<d.length;++m)f("d%s=[]",l.safeProp(d[m].name));f("}")}if(g.length){for(f("if(o.objects||o.defaults){"),m=0;m<g.length;++m)f("d%s={}",l.safeProp(g[m].name));f("}")}if(p.length){for(f("if(o.defaults){"),m=0;m<p.length;++m){var y=p[m],w=l.safeProp(y.name);y.resolvedType instanceof o?f("d%s=o.enums===String?%j:%j",w,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?f("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?f("d%s=o.bytes===String?%j:%s",w,String.fromCharCode.apply(String,y.typeDefault),"["+Array.prototype.slice.call(y.typeDefault).join(",")+"]"):f("d%s=%j",w,y.typeDefault)}f("}")}var _=!1;for(m=0;m<h.length;++m){var y=h[m],b=c._fieldsArray.indexOf(y),w=l.safeProp(y.name);y.map?(_||(_=!0,f("var ks2")),f("if(m%s&&(ks2=Object.keys(m%s)).length){",w,w)("d%s={}",w)("for(var j=0;j<ks2.length;++j){"),u(f,y,b,w+"[ks2[j]]")("}")):y.repeated?(f("if(m%s&&m%s.length){",w,w)("d%s=[]",w)("for(var j=0;j<m%s.length;++j){",w),u(f,y,b,w+"[j]")("}")):(f("if(m%s!=null&&m.hasOwnProperty(%j)){",w,y.name),u(f,y,b,w),y.partOf&&f("if(o.oneofs)")("d%s=%j",l.safeProp(y.partOf.name),y.name)),f("}")}return f("return d")}},{15:15,37:37}],13:[function(t,n,i){n.exports=u;var s=t(15),o=t(36),l=t(37);function a(c){return"missing required '"+c.name+"'"}function u(c){var h=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&&h("if((t&7)===4)")("break"),h("switch(t>>>3){");for(var f=0;f<c.fieldsArray.length;++f){var d=c._fieldsArray[f].resolve(),g=d.resolvedType instanceof s?"int32":d.type,p="m"+l.safeProp(d.name);h("case %i:",d.id),d.map?(h("r.skip().pos++")("if(%s===util.emptyObject)",p)("%s={}",p)("k=r.%s()",d.keyType)("r.pos++"),o.long[d.keyType]!==e?o.basic[g]===e?h('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',p,f):h('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',p,g):o.basic[g]===e?h("%s[k]=types[%i].decode(r,r.uint32())",p,f):h("%s[k]=r.%s()",p,g)):d.repeated?(h("if(!(%s&&%s.length))",p,p)("%s=[]",p),o.packed[g]!==e&&h("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",p,g)("}else"),o.basic[g]===e?h(d.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",p,f):h("%s.push(r.%s())",p,g)):o.basic[g]===e?h(d.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",p,f):h("%s=r.%s()",p,g),h("break")}for(h("default:")("r.skipType(t&7)")("break")("}")("}"),f=0;f<c._fieldsArray.length;++f){var m=c._fieldsArray[f];m.required&&h("if(!m.hasOwnProperty(%j))",m.name)("throw util.ProtocolError(%j,{instance:m})",a(m))}return h("return m")}},{15:15,36:36,37:37}],14:[function(t,n,i){n.exports=u;var s=t(15),o=t(36),l=t(37);function a(c,h,f,d){return h.resolvedType.group?c("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",f,d,(h.id<<3|3)>>>0,(h.id<<3|4)>>>0):c("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",f,d,(h.id<<3|2)>>>0)}function u(c){for(var h=l.codegen(["m","w"],c.name+"$encode")("if(!w)")("w=Writer.create()"),g,f,d=c.fieldsArray.slice().sort(l.compareFieldsById),g=0;g<d.length;++g){var p=d[g].resolve(),m=c._fieldsArray.indexOf(p),y=p.resolvedType instanceof s?"int32":p.type,w=o.basic[y];f="m"+l.safeProp(p.name),p.map?(h("if(%s!=null&&m.hasOwnProperty(%j)){",f,p.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",f)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(p.id<<3|2)>>>0,8|o.mapKey[p.keyType],p.keyType),w===e?h("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,f):h(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|w,y,f),h("}")("}")):p.repeated?(h("if(%s!=null&&%s.length){",f,f),p.packed&&o.packed[y]!==e?h("w.uint32(%i).fork()",(p.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",f)("w.%s(%s[i])",y,f)("w.ldelim()"):(h("for(var i=0;i<%s.length;++i)",f),w===e?a(h,p,m,f+"[i]"):h("w.uint32(%i).%s(%s[i])",(p.id<<3|w)>>>0,y,f)),h("}")):(p.optional&&h("if(%s!=null&&m.hasOwnProperty(%j))",f,p.name),w===e?a(h,p,m,f):h("w.uint32(%i).%s(%s)",(p.id<<3|w)>>>0,y,f))}return h("return w")}},{15:15,36:36,37:37}],15:[function(t,n,i){n.exports=a;var s=t(24);((a.prototype=Object.create(s.prototype)).constructor=a).className="Enum";var o=t(23),l=t(37);function a(u,c,h,f,d){if(s.call(this,u,h),c&&typeof c!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=f,this.comments=d||{},this.reserved=e,c)for(var g=Object.keys(c),p=0;p<g.length;++p)typeof c[g[p]]=="number"&&(this.valuesById[this.values[g[p]]=c[g[p]]]=g[p])}a.fromJSON=function(u,c){var h=new a(u,c.values,c.options,c.comment,c.comments);return h.reserved=c.reserved,h},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,h){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]=h||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,i){n.exports=h;var s=t(24);((h.prototype=Object.create(s.prototype)).constructor=h).className="Field";var o=t(15),l=t(36),a=t(37),u,c=/^required|optional|repeated$/;h.fromJSON=function(f,d){return new h(f,d.id,d.type,d.rule,d.extend,d.options,d.comment)};function h(f,d,g,p,m,y,w){if(a.isObject(p)?(w=m,y=p,p=m=e):a.isObject(m)&&(w=y,y=m,m=e),s.call(this,f,y),!a.isInteger(d)||d<0)throw TypeError("id must be a non-negative integer");if(!a.isString(g))throw TypeError("type must be a string");if(p!==e&&!c.test(p=p.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=p&&p!=="optional"?p:e,this.type=g,this.id=d,this.extend=m||e,this.required=p==="required",this.optional=!this.required,this.repeated=p==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=a.Long?l.long[g]!==e:!1,this.bytes=g==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=w}Object.defineProperty(h.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),h.prototype.setOption=function(f,d,g){return f==="packed"&&(this._packed=null),s.prototype.setOption.call(this,f,d,g)},h.prototype.toJSON=function(f){var d=f?!!f.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",d?this.comment:e])},h.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 f;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,f=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,f=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=f}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),s.prototype.resolve.call(this)},h.d=function(f,d,g,p){return typeof d=="function"?d=a.decorateType(d).name:d&&typeof d=="object"&&(d=a.decorateEnum(d).name),function(m,y){a.decorateType(m.constructor).add(new h(y,f,d,g,{default:p}))}},h._configure=function(f){u=f}},{15:15,24:24,36:36,37:37}],17:[function(t,n,i){var s=n.exports=t(18);s.build="light";function o(a,u,c){return typeof u=="function"?(c=u,u=new s.Root):u||(u=new s.Root),u.load(a,c)}s.load=o;function l(a,u){return u||(u=new s.Root),u.loadSync(a)}s.loadSync=l,s.encoder=t(14),s.decoder=t(13),s.verifier=t(40),s.converter=t(12),s.ReflectionObject=t(24),s.Namespace=t(23),s.Root=t(29),s.Enum=t(15),s.Type=t(35),s.Field=t(16),s.OneOf=t(25),s.MapField=t(20),s.Service=t(33),s.Method=t(22),s.Message=t(21),s.wrappers=t(41),s.types=t(36),s.util=t(37),s.ReflectionObject._configure(s.Root),s.Namespace._configure(s.Type,s.Service),s.Root._configure(s.Type),s.Field._configure(s.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,i){var s=i;s.build="minimal",s.Writer=t(42),s.BufferWriter=t(43),s.Reader=t(27),s.BufferReader=t(28),s.util=t(39),s.rpc=t(31),s.roots=t(30),s.configure=o;function o(){s.Reader._configure(s.BufferReader),s.util._configure()}s.Writer._configure(s.BufferWriter),o()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(t,n,i){var s=n.exports=t(17);s.build="full",s.tokenize=t(34),s.parse=t(26),s.common=t(11),s.Root._configure(s.Type,s.parse,s.common)},{11:11,17:17,26:26,34:34}],20:[function(t,n,i){n.exports=a;var s=t(16);((a.prototype=Object.create(s.prototype)).constructor=a).className="MapField";var o=t(36),l=t(37);function a(u,c,h,f,d,g){if(s.call(this,u,c,f,e,e,d,g),!l.isString(h))throw TypeError("keyType must be a string");this.keyType=h,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 s.prototype.resolve.call(this)},a.d=function(u,c,h){return typeof h=="function"?h=l.decorateType(h).name:h&&typeof h=="object"&&(h=l.decorateEnum(h).name),function(f,d){l.decorateType(f.constructor).add(new a(d,u,c,h))}}},{16:16,36:36,37:37}],21:[function(t,n,i){n.exports=o;var s=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,s.toJSONOptions)}},{39:39}],22:[function(t,n,i){n.exports=l;var s=t(24);((l.prototype=Object.create(s.prototype)).constructor=l).className="Method";var o=t(37);function l(a,u,c,h,f,d,g,p){if(o.isObject(f)?(g=f,f=d=e):o.isObject(d)&&(g=d,d=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(h))throw TypeError("responseType must be a string");s.call(this,a,g),this.type=u||"rpc",this.requestType=c,this.requestStream=f?!0:e,this.responseType=h,this.responseStream=d?!0:e,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=p}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),s.prototype.resolve.call(this))}},{24:24,37:37}],23:[function(t,n,i){n.exports=f;var s=t(24);((f.prototype=Object.create(s.prototype)).constructor=f).className="Namespace";var o=t(15),l=t(16),a=t(37),u,c;f.fromJSON=function(g,p){return new f(g,p.options).addJSON(p.nested)};function h(g,p){if(!(g&&g.length))return e;for(var m={},y=0;y<g.length;++y)m[g[y].name]=g[y].toJSON(p);return m}f.arrayToJSON=h,f.isReservedId=function(g,p){if(g){for(var m=0;m<g.length;++m)if(typeof g[m]!="string"&&g[m][0]<=p&&g[m][1]>=p)return!0}return!1},f.isReservedName=function(g,p){if(g){for(var m=0;m<g.length;++m)if(g[m]===p)return!0}return!1};function f(g,p){s.call(this,g,p),this.nested=e,this._nestedArray=null}function d(g){return g._nestedArray=null,g}Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=a.toArray(this.nested))}}),f.prototype.toJSON=function(g){return a.toObject(["options",this.options,"nested",h(this.nestedArray,g)])},f.prototype.addJSON=function(g){var p=this;if(g)for(var m=Object.keys(g),y=0,w;y<m.length;++y)w=g[m[y]],p.add((w.fields!==e?u.fromJSON:w.values!==e?o.fromJSON:w.methods!==e?c.fromJSON:w.id!==e?l.fromJSON:f.fromJSON)(m[y],w));return this},f.prototype.get=function(g){return this.nested&&this.nested[g]||null},f.prototype.getEnum=function(g){if(this.nested&&this.nested[g]instanceof o)return this.nested[g].values;throw Error("no such enum: "+g)},f.prototype.add=function(g){if(!(g instanceof l&&g.extend!==e||g instanceof u||g instanceof o||g instanceof c||g instanceof f))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var p=this.get(g.name);if(p)if(p instanceof f&&g instanceof f&&!(p instanceof u||p instanceof c)){for(var m=p.nestedArray,y=0;y<m.length;++y)g.add(m[y]);this.remove(p),this.nested||(this.nested={}),g.setOptions(p.options,!0)}else throw Error("duplicate name '"+g.name+"' in "+this)}return this.nested[g.name]=g,g.onAdd(this),d(this)},f.prototype.remove=function(g){if(!(g instanceof s))throw TypeError("object must be a ReflectionObject");if(g.parent!==this)throw Error(g+" is not a member of "+this);return delete this.nested[g.name],Object.keys(this.nested).length||(this.nested=e),g.onRemove(this),d(this)},f.prototype.define=function(g,p){if(a.isString(g))g=g.split(".");else if(!Array.isArray(g))throw TypeError("illegal path");if(g&&g.length&&g[0]==="")throw Error("path must be relative");for(var m=this;g.length>0;){var y=g.shift();if(m.nested&&m.nested[y]){if(m=m.nested[y],!(m instanceof f))throw Error("path conflicts with non-namespace objects")}else m.add(m=new f(y))}return p&&m.addJSON(p),m},f.prototype.resolveAll=function(){for(var g=this.nestedArray,p=0;p<g.length;)g[p]instanceof f?g[p++].resolveAll():g[p++].resolve();return this.resolve()},f.prototype.lookup=function(g,p,m){if(typeof p=="boolean"?(m=p,p=e):p&&!Array.isArray(p)&&(p=[p]),a.isString(g)&&g.length){if(g===".")return this.root;g=g.split(".")}else if(!g.length)return this;if(g[0]==="")return this.root.lookup(g.slice(1),p);var y=this.get(g[0]);if(y){if(g.length===1){if(!p||p.indexOf(y.constructor)>-1)return y}else if(y instanceof f&&(y=y.lookup(g.slice(1),p,!0)))return y}else for(var w=0;w<this.nestedArray.length;++w)if(this._nestedArray[w]instanceof f&&(y=this._nestedArray[w].lookup(g,p,!0)))return y;return this.parent===null||m?null:this.parent.lookup(g,p)},f.prototype.lookupType=function(g){var p=this.lookup(g,[u]);if(!p)throw Error("no such type: "+g);return p},f.prototype.lookupEnum=function(g){var p=this.lookup(g,[o]);if(!p)throw Error("no such Enum '"+g+"' in "+this);return p},f.prototype.lookupTypeOrEnum=function(g){var p=this.lookup(g,[u,o]);if(!p)throw Error("no such Type or Enum '"+g+"' in "+this);return p},f.prototype.lookupService=function(g){var p=this.lookup(g,[c]);if(!p)throw Error("no such Service '"+g+"' in "+this);return p},f._configure=function(g,p){u=g,c=p}},{15:15,16:16,24:24,37:37}],24:[function(t,n,i){n.exports=l,l.className="ReflectionObject";var s=t(37),o;function l(a,u){if(!s.isString(a))throw TypeError("name must be a string");if(u&&!s.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),h=0;h<c.length;++h)this.setOption(c[h],a[c[h]],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,i){n.exports=a;var s=t(24);((a.prototype=Object.create(s.prototype)).constructor=a).className="OneOf";var o=t(16),l=t(37);function a(c,h,f,d){if(Array.isArray(h)||(f=h,h=e),s.call(this,c,f),!(h===e||Array.isArray(h)))throw TypeError("fieldNames must be an Array");this.oneof=h||[],this.fieldsArray=[],this.comment=d}a.fromJSON=function(c,h){return new a(c,h.oneof,h.options,h.comment)},a.prototype.toJSON=function(c){var h=c?!!c.keepComments:!1;return l.toObject(["options",this.options,"oneof",this.oneof,"comment",h?this.comment:e])};function u(c){if(c.parent)for(var h=0;h<c.fieldsArray.length;++h)c.fieldsArray[h].parent||c.parent.add(c.fieldsArray[h])}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 h=this.fieldsArray.indexOf(c);if(h<0)throw Error(c+" is not a member of "+this);return this.fieldsArray.splice(h,1),h=this.oneof.indexOf(c.name),h>-1&&this.oneof.splice(h,1),c.partOf=null,this},a.prototype.onAdd=function(c){s.prototype.onAdd.call(this,c);for(var h=this,f=0;f<this.oneof.length;++f){var d=c.get(this.oneof[f]);d&&!d.partOf&&(d.partOf=h,h.fieldsArray.push(d))}u(this)},a.prototype.onRemove=function(c){for(var h=0,f;h<this.fieldsArray.length;++h)(f=this.fieldsArray[h]).parent&&f.parent.remove(f);s.prototype.onRemove.call(this,c)},a.d=function(){for(var c=new Array(arguments.length),h=0;h<arguments.length;)c[h]=arguments[h++];return function(f,d){l.decorateType(f.constructor).add(new a(d,c)),Object.defineProperty(f,d,{get:l.oneOfGetter(c),set:l.oneOfSetter(c)})}}},{16:16,24:24,37:37}],26:[function(t,n,i){n.exports=R,R.filename=null,R.defaults={keepCase:!1};var s=t(34),o=t(29),l=t(35),a=t(16),u=t(20),c=t(25),h=t(15),f=t(33),d=t(22),g=t(36),p=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]+$/,k=/^-?0[0-7]+$/,S=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,O=/^[a-zA-Z_][a-zA-Z_0-9]*$/,C=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,F=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function R(Y,B,W){B instanceof o||(W=B,B=new o),W||(W=R.defaults);var ee=s(Y,W.alternateCommentMode||!1),D=ee.next,he=ee.push,X=ee.peek,A=ee.skip,ne=ee.cmnt,te=!0,ce,$,re,K,se=!1,ue=B,me=W.keepCase?function(N){return N}:p.camelCase;function U(N,v,E){var P=R.filename;return E||(R.filename=null),Error("illegal "+(v||"token")+" '"+N+"' ("+(P?P+", ":"")+"line "+ee.line+")")}function pe(){var N=[],v;do{if((v=D())!=='"'&&v!=="'")throw U(v);N.push(D()),A(v),v=X()}while(v==='"'||v==="'");return N.join("")}function Re(N){var v=D();switch(v){case"'":case'"':return he(v),pe();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return ze(v,!0)}catch{if(C.test(v))return v;throw U(v,"value")}}function $e(N,v){var E,P;do v&&((E=X())==='"'||E==="'")?N.push(pe()):N.push([P=tt(D()),A("to",!0)?tt(D()):P]);while(A(",",!0));A(";")}function ze(N,v){var E=1;switch(N.charAt(0)==="-"&&(E=-1,N=N.substring(1)),N){case"inf":case"INF":case"Inf":return E*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(m.test(N))return E*parseInt(N,10);if(w.test(N))return E*parseInt(N,16);if(b.test(N))return E*parseInt(N,8);if(S.test(N))return E*parseFloat(N);throw U(N,"number",v)}function tt(N,v){switch(N){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!v&&N.charAt(0)==="-")throw U(N,"id");if(y.test(N))return parseInt(N,10);if(_.test(N))return parseInt(N,16);if(k.test(N))return parseInt(N,8);throw U(N,"id")}function Kt(){if(ce!==e)throw U("package");if(ce=D(),!C.test(ce))throw U(ce,"name");ue=ue.define(ce),A(";")}function Rt(){var N=X(),v;switch(N){case"weak":v=re||(re=[]),D();break;case"public":D();default:v=$||($=[]);break}N=pe(),A(";"),v.push(N)}function rt(){if(A("="),K=pe(),se=K==="proto3",!se&&K!=="proto2")throw U(K,"syntax");A(";")}function Je(N,v){switch(v){case"option":return We(N,v),A(";"),!0;case"message":return Qr(N,v),!0;case"enum":return Ni(N,v),!0;case"service":return Xr(N,v),!0;case"extend":return Mi(N,v),!0}return!1}function Ge(N,v,E){var P=ee.line;if(N&&(N.comment=ne(),N.filename=R.filename),A("{",!0)){for(var V;(V=D())!=="}";)v(V);A(";",!0)}else E&&E(),A(";"),N&&typeof N.comment!="string"&&(N.comment=ne(P))}function Qr(N,v){if(!O.test(v=D()))throw U(v,"type name");var E=new l(v);Ge(E,function(P){if(!Je(E,P))switch(P){case"map":Ci(E);break;case"required":case"optional":case"repeated":mt(E,P);break;case"oneof":Ri(E,P);break;case"extensions":$e(E.extensions||(E.extensions=[]));break;case"reserved":$e(E.reserved||(E.reserved=[]),!0);break;default:if(!se||!C.test(P))throw U(P);he(P),mt(E,"optional");break}}),N.add(E)}function mt(N,v,E){var P=D();if(P==="group"){Ii(N,v);return}if(!C.test(P))throw U(P,"type");var V=D();if(!O.test(V))throw U(V,"name");V=me(V),A("=");var Z=new a(V,tt(D()),P,v,E);Ge(Z,function(H){if(H==="option")We(Z,H),A(";");else throw U(H)},function(){Nt(Z)}),N.add(Z),!se&&Z.repeated&&(g.packed[P]!==e||g.basic[P]===e)&&Z.setOption("packed",!1,!0)}function Ii(N,v){var E=D();if(!O.test(E))throw U(E,"name");var P=p.lcFirst(E);E===P&&(E=p.ucFirst(E)),A("=");var V=tt(D()),Z=new l(E);Z.group=!0;var H=new a(P,V,E,v);H.filename=R.filename,Ge(Z,function(Ne){switch(Ne){case"option":We(Z,Ne),A(";");break;case"required":case"optional":case"repeated":mt(Z,Ne);break;default:throw U(Ne)}}),N.add(Z).add(H)}function Ci(N){A("<");var v=D();if(g.mapKey[v]===e)throw U(v,"type");A(",");var E=D();if(!C.test(E))throw U(E,"type");A(">");var P=D();if(!O.test(P))throw U(P,"name");A("=");var V=new u(me(P),tt(D()),v,E);Ge(V,function(Z){if(Z==="option")We(V,Z),A(";");else throw U(Z)},function(){Nt(V)}),N.add(V)}function Ri(N,v){if(!O.test(v=D()))throw U(v,"name");var E=new c(me(v));Ge(E,function(P){P==="option"?(We(E,P),A(";")):(he(P),mt(E,"optional"))}),N.add(E)}function Ni(N,v){if(!O.test(v=D()))throw U(v,"name");var E=new h(v);Ge(E,function(P){switch(P){case"option":We(E,P),A(";");break;case"reserved":$e(E.reserved||(E.reserved=[]),!0);break;default:Pi(E,P)}}),N.add(E)}function Pi(N,v){if(!O.test(v))throw U(v,"name");A("=");var E=tt(D(),!0),P={};Ge(P,function(V){if(V==="option")We(P,V),A(";");else throw U(V)},function(){Nt(P)}),N.add(v,E,P.comment)}function We(N,v){var E=A("(",!0);if(!C.test(v=D()))throw U(v,"name");var P=v;E&&(A(")"),P="("+P+")",v=X(),F.test(v)&&(P+=v,D())),A("="),wr(N,P)}function wr(N,v){if(A("{",!0))do{if(!O.test(Ee=D()))throw U(Ee,"name");X()==="{"?wr(N,v+"."+Ee):(A(":"),X()==="{"?wr(N,v+"."+Ee):yt(N,v+"."+Ee,Re()))}while(!A("}",!0));else yt(N,v,Re())}function yt(N,v,E){N.setOption&&N.setOption(v,E)}function Nt(N){if(A("[",!0)){do We(N,"option");while(A(",",!0));A("]")}return N}function Xr(N,v){if(!O.test(v=D()))throw U(v,"service name");var E=new f(v);Ge(E,function(P){if(!Je(E,P))if(P==="rpc")Fi(E,P);else throw U(P)}),N.add(E)}function Fi(N,v){var E=v;if(!O.test(v=D()))throw U(v,"name");var P=v,V,Z,H,Ne;if(A("("),A("stream",!0)&&(Z=!0),!C.test(v=D())||(V=v,A(")"),A("returns"),A("("),A("stream",!0)&&(Ne=!0),!C.test(v=D())))throw U(v);H=v,A(")");var nt=new d(P,E,V,H,Z,Ne);Ge(nt,function(Oe){if(Oe==="option")We(nt,Oe),A(";");else throw U(Oe)}),N.add(nt)}function Mi(N,v){if(!C.test(v=D()))throw U(v,"reference");var E=v;Ge(null,function(P){switch(P){case"required":case"repeated":case"optional":mt(N,P,E);break;default:if(!se||!C.test(P))throw U(P);he(P),mt(N,"optional",E);break}})}for(var Ee;(Ee=D())!==null;)switch(Ee){case"package":if(!te)throw U(Ee);Kt();break;case"import":if(!te)throw U(Ee);Rt();break;case"syntax":if(!te)throw U(Ee);rt();break;case"option":if(!te)throw U(Ee);We(ue,Ee),A(";");break;default:if(Je(ue,Ee)){te=!1;continue}throw U(Ee)}return R.filename=null,{package:ce,imports:$,weakImports:re,syntax:K,root:B}}},{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,i){n.exports=c;var s=t(39),o,l=s.LongBits,a=s.utf8;function u(p,m){return RangeError("index out of range: "+p.pos+" + "+(m||1)+" > "+p.len)}function c(p){this.buf=p,this.pos=0,this.len=p.length}var h=typeof Uint8Array<"u"?function(p){if(p instanceof Uint8Array||Array.isArray(p))return new c(p);throw Error("illegal buffer")}:function(p){if(Array.isArray(p))return new c(p);throw Error("illegal buffer")};c.create=s.Buffer?function(p){return(c.create=function(m){return s.Buffer.isBuffer(m)?new o(m):h(m)})(p)}:h,c.prototype._slice=s.Array.prototype.subarray||s.Array.prototype.slice,c.prototype.uint32=function(){var p=4294967295;return function(){if(p=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(p=(p|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(p=(p|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(p=(p|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(p=(p|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return p;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return p}}(),c.prototype.int32=function(){return this.uint32()|0},c.prototype.sint32=function(){var p=this.uint32();return p>>>1^-(p&1)|0};function f(){var p=new l(0,0),m=0;if(this.len-this.pos>4){for(;m<4;++m)if(p.lo=(p.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return p;if(p.lo=(p.lo|(this.buf[this.pos]&127)<<28)>>>0,p.hi=(p.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return p;m=0}else{for(;m<3;++m){if(this.pos>=this.len)throw u(this);if(p.lo=(p.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return p}return p.lo=(p.lo|(this.buf[this.pos++]&127)<<m*7)>>>0,p}if(this.len-this.pos>4){for(;m<5;++m)if(p.hi=(p.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return p}else for(;m<5;++m){if(this.pos>=this.len)throw u(this);if(p.hi=(p.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return p}throw Error("invalid varint encoding")}c.prototype.bool=function(){return this.uint32()!==0};function d(p,m){return(p[m-4]|p[m-3]<<8|p[m-2]<<16|p[m-1]<<24)>>>0}c.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)|0};function g(){if(this.pos+8>this.len)throw u(this,8);return new l(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var p=s.float.readFloatLE(this.buf,this.pos);return this.pos+=4,p},c.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var p=s.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,p},c.prototype.bytes=function(){var p=this.uint32(),m=this.pos,y=this.pos+p;if(y>this.len)throw u(this,p);return this.pos+=p,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 p=this.bytes();return a.read(p,0,p.length)},c.prototype.skip=function(p){if(typeof p=="number"){if(this.pos+p>this.len)throw u(this,p);this.pos+=p}else do if(this.pos>=this.len)throw u(this);while(this.buf[this.pos++]&128);return this},c.prototype.skipType=function(p){switch(p){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((p=this.uint32()&7)===4)break;this.skipType(p)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+p+" at offset "+this.pos)}return this},c._configure=function(p){o=p;var m=s.Long?"toLong":"toNumber";s.merge(c.prototype,{int64:function(){return f.call(this)[m](!1)},uint64:function(){return f.call(this)[m](!0)},sint64:function(){return f.call(this).zzDecode()[m](!1)},fixed64:function(){return g.call(this)[m](!0)},sfixed64:function(){return g.call(this)[m](!1)}})}},{39:39}],28:[function(t,n,i){n.exports=l;var s=t(27);(l.prototype=Object.create(s.prototype)).constructor=l;var o=t(39);function l(a){s.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,i){n.exports=d;var s=t(23);((d.prototype=Object.create(s.prototype)).constructor=d).className="Root";var o=t(16),l=t(15),a=t(25),u=t(37),c,h,f;function d(y){s.call(this,"",y),this.deferred=[],this.files=[]}d.fromJSON=function(y,w){return w||(w=new d),y.options&&w.setOptions(y.options),w.addJSON(y.nested)},d.prototype.resolvePath=u.path.resolve;function g(){}d.prototype.load=function y(w,_,b){typeof _=="function"&&(b=_,_=e);var k=this;if(!b)return u.asPromise(y,k,w,_);var S=b===g;function O(W,ee){if(b){var D=b;if(b=null,S)throw W;D(W,ee)}}function C(W,ee){try{if(u.isString(ee)&&ee.charAt(0)==="{"&&(ee=JSON.parse(ee)),!u.isString(ee))k.setOptions(ee.options).addJSON(ee.nested);else{h.filename=W;var D=h(ee,k,_),he,X=0;if(D.imports)for(;X<D.imports.length;++X)(he=k.resolvePath(W,D.imports[X]))&&F(he);if(D.weakImports)for(X=0;X<D.weakImports.length;++X)(he=k.resolvePath(W,D.weakImports[X]))&&F(he,!0)}}catch(A){O(A)}!S&&!R&&O(null,k)}function F(W,ee){var D=W.lastIndexOf("google/protobuf/");if(D>-1){var he=W.substring(D);he in f&&(W=he)}if(!(k.files.indexOf(W)>-1)){if(k.files.push(W),W in f){S?C(W,f[W]):(++R,setTimeout(function(){--R,C(W,f[W])}));return}if(S){var X;try{X=u.fs.readFileSync(W).toString("utf8")}catch(A){ee||O(A);return}C(W,X)}else++R,u.fetch(W,function(A,ne){if(--R,!!b){if(A){ee?R||O(null,k):O(A);return}C(W,ne)}})}}var R=0;u.isString(w)&&(w=[w]);for(var Y=0,B;Y<w.length;++Y)(B=k.resolvePath("",w[Y]))&&F(B);return S?k:(R||O(null,k),e)},d.prototype.loadSync=function(y,w){if(!u.isNode)throw Error("not supported");return this.load(y,w,g)},d.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 s.prototype.resolveAll.call(this)};var p=/^[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}d.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)p.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[_]);p.test(y.name)&&(y.parent[y.name]=y)}},d.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)p.test(y.name)&&delete y.parent[y.name];else if(y instanceof s){for(var _=0;_<y.nestedArray.length;++_)this._handleRemove(y._nestedArray[_]);p.test(y.name)&&delete y.parent[y.name]}},d._configure=function(y,w,_){c=y,h=w,f=_}},{15:15,16:16,23:23,25:25,37:37}],30:[function(t,n,i){n.exports={}},{}],31:[function(t,n,i){var s=i;s.Service=t(32)},{32:32}],32:[function(t,n,i){n.exports=o;var s=t(39);(o.prototype=Object.create(s.EventEmitter.prototype)).constructor=o;function o(l,a,u){if(typeof l!="function")throw TypeError("rpcImpl must be a function");s.EventEmitter.call(this),this.rpcImpl=l,this.requestDelimited=!!a,this.responseDelimited=!!u}o.prototype.rpcCall=function l(a,u,c,h,f){if(!h)throw TypeError("request must be specified");var d=this;if(!f)return s.asPromise(l,d,a,u,c,h);if(!d.rpcImpl)return setTimeout(function(){f(Error("already ended"))},0),e;try{return d.rpcImpl(a,u[d.requestDelimited?"encodeDelimited":"encode"](h).finish(),function(g,p){if(g)return d.emit("error",g,a),f(g);if(p===null)return d.end(!0),e;if(!(p instanceof c))try{p=c[d.responseDelimited?"decodeDelimited":"decode"](p)}catch(m){return d.emit("error",m,a),f(m)}return d.emit("data",p,a),f(null,p)})}catch(g){return d.emit("error",g,a),setTimeout(function(){f(g)},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,i){n.exports=u;var s=t(23);((u.prototype=Object.create(s.prototype)).constructor=u).className="Service";var o=t(22),l=t(37),a=t(31);function u(h,f){s.call(this,h,f),this.methods={},this._methodsArray=null}u.fromJSON=function(h,f){var d=new u(h,f.options);if(f.methods)for(var g=Object.keys(f.methods),p=0;p<g.length;++p)d.add(o.fromJSON(g[p],f.methods[g[p]]));return f.nested&&d.addJSON(f.nested),d.comment=f.comment,d},u.prototype.toJSON=function(h){var f=s.prototype.toJSON.call(this,h),d=h?!!h.keepComments:!1;return l.toObject(["options",f&&f.options||e,"methods",s.arrayToJSON(this.methodsArray,h)||{},"nested",f&&f.nested||e,"comment",d?this.comment:e])},Object.defineProperty(u.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=l.toArray(this.methods))}});function c(h){return h._methodsArray=null,h}u.prototype.get=function(h){return this.methods[h]||s.prototype.get.call(this,h)},u.prototype.resolveAll=function(){for(var h=this.methodsArray,f=0;f<h.length;++f)h[f].resolve();return s.prototype.resolve.call(this)},u.prototype.add=function(h){if(this.get(h.name))throw Error("duplicate name '"+h.name+"' in "+this);return h instanceof o?(this.methods[h.name]=h,h.parent=this,c(this)):s.prototype.add.call(this,h)},u.prototype.remove=function(h){if(h instanceof o){if(this.methods[h.name]!==h)throw Error(h+" is not a member of "+this);return delete this.methods[h.name],h.parent=null,c(this)}return s.prototype.remove.call(this,h)},u.prototype.create=function(h,f,d){for(var g=new a.Service(h,f,d),p=0,m;p<this.methodsArray.length;++p){var y=l.lcFirst((m=this._methodsArray[p]).resolve().name).replace(/[^$\w_]/g,"");g[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 g}},{22:22,23:23,31:31,37:37}],34:[function(t,n,i){n.exports=p;var s=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,l=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,a=/^ *[*/]+ */,u=/^\s*\*?\/*/,c=/\n/g,h=/\s/,f=/\\(.?)/g,d={0:"\0",r:"\r",n:`
21
+ `,t:" "};function g(m){return m.replace(f,function(y,w){switch(w){case"\\":case"":return w;default:return d[w]||""}})}p.unescape=g;function p(m,y){m=m.toString();var w=0,_=m.length,b=1,k=null,S=null,O=0,C=!1,F=[],R=null;function Y($){return Error("illegal "+$+" (line "+b+")")}function B(){var $=R==="'"?l:o;$.lastIndex=w-1;var re=$.exec(m);if(!re)throw Y("string");return w=$.lastIndex,A(R),R=null,g(re[1])}function W($){return m.charAt($)}function ee($,re){k=m.charAt($++),O=b,C=!1;var K;y?K=2:K=3;var se=$-K,ue;do if(--se<0||(ue=m.charAt(se))===`
22
+ `){C=!0;break}while(ue===" "||ue===" ");for(var me=m.substring($,re).split(c),U=0;U<me.length;++U)me[U]=me[U].replace(y?u:a,"").trim();S=me.join(`
23
+ `).trim()}function D($){var re=he($),K=m.substring($,re),se=/^\s*\/{1,2}/.test(K);return se}function he($){for(var re=$;re<_&&W(re)!==`
24
+ `;)re++;return re}function X(){if(F.length>0)return F.shift();if(R)return B();var $,re,K,se,ue;do{if(w===_)return null;for($=!1;h.test(K=W(w));)if(K===`
25
+ `&&++b,++w===_)return null;if(W(w)==="/"){if(++w===_)throw Y("comment");if(W(w)==="/")if(y){if(se=w,ue=!1,D(w)){ue=!0;do{if(w=he(w),w===_)break;w++}while(D(w))}else w=Math.min(_,he(w)+1);ue&&ee(se,w),b++,$=!0}else{for(ue=W(se=w+1)==="/";W(++w)!==`
26
+ `;)if(w===_)return null;++w,ue&&ee(se,w-1),++b,$=!0}else if((K=W(w))==="*"){se=w+1,ue=y||W(se)==="*";do{if(K===`
27
+ `&&++b,++w===_)throw Y("comment");re=K,K=W(w)}while(re!=="*"||K!=="/");++w,ue&&ee(se,w-2),$=!0}else return"/"}}while($);var me=w;s.lastIndex=0;var U=s.test(W(me++));if(!U)for(;me<_&&!s.test(W(me));)++me;var pe=m.substring(w,w=me);return(pe==='"'||pe==="'")&&(R=pe),pe}function A($){F.push($)}function ne(){if(!F.length){var $=X();if($===null)return null;A($)}return F[0]}function te($,re){var K=ne(),se=K===$;if(se)return X(),!0;if(!re)throw Y("token '"+K+"', '"+$+"' expected");return!1}function ce($){var re=null;return $===e?O===b-1&&(y||k==="*"||C)&&(re=S):(O<$&&ne(),O===$&&!C&&(y||k==="/")&&(re=S)),re}return Object.defineProperty({next:X,peek:ne,push:A,skip:te,cmnt:ce},"line",{get:function(){return b}})}},{}],35:[function(t,n,i){n.exports=b;var s=t(23);((b.prototype=Object.create(s.prototype)).constructor=b).className="Type";var o=t(15),l=t(25),a=t(16),u=t(20),c=t(33),h=t(21),f=t(27),d=t(42),g=t(37),p=t(14),m=t(13),y=t(40),w=t(12),_=t(41);function b(S,O){s.call(this,S,O),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),O=0;O<S.length;++O){var C=this.fields[S[O]],F=C.id;if(this._fieldsById[F])throw Error("duplicate id "+F+" in "+this);this._fieldsById[F]=C}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=g.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=g.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=b.generateConstructor(this)())},set:function(S){var O=S.prototype;O instanceof h||((S.prototype=new h).constructor=S,g.merge(S.prototype,O)),S.$type=S.prototype.$type=this,g.merge(S,h,!0),this._ctor=S;for(var C=0;C<this.fieldsArray.length;++C)this._fieldsArray[C].resolve();var F={};for(C=0;C<this.oneofsArray.length;++C)F[this._oneofsArray[C].resolve().name]={get:g.oneOfGetter(this._oneofsArray[C].oneof),set:g.oneOfSetter(this._oneofsArray[C].oneof)};C&&Object.defineProperties(S.prototype,F)}}}),b.generateConstructor=function(S){for(var O=g.codegen(["p"],S.name),C=0,F;C<S.fieldsArray.length;++C)(F=S._fieldsArray[C]).map?O("this%s={}",g.safeProp(F.name)):F.repeated&&O("this%s=[]",g.safeProp(F.name));return O("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 k(S){return S._fieldsById=S._fieldsArray=S._oneofsArray=null,delete S.encode,delete S.decode,delete S.verify,S}b.fromJSON=function(S,O){var C=new b(S,O.options);C.extensions=O.extensions,C.reserved=O.reserved;for(var F=Object.keys(O.fields),R=0;R<F.length;++R)C.add((typeof O.fields[F[R]].keyType<"u"?u.fromJSON:a.fromJSON)(F[R],O.fields[F[R]]));if(O.oneofs)for(F=Object.keys(O.oneofs),R=0;R<F.length;++R)C.add(l.fromJSON(F[R],O.oneofs[F[R]]));if(O.nested)for(F=Object.keys(O.nested),R=0;R<F.length;++R){var Y=O.nested[F[R]];C.add((Y.id!==e?a.fromJSON:Y.fields!==e?b.fromJSON:Y.values!==e?o.fromJSON:Y.methods!==e?c.fromJSON:s.fromJSON)(F[R],Y))}return O.extensions&&O.extensions.length&&(C.extensions=O.extensions),O.reserved&&O.reserved.length&&(C.reserved=O.reserved),O.group&&(C.group=!0),O.comment&&(C.comment=O.comment),C},b.prototype.toJSON=function(S){var O=s.prototype.toJSON.call(this,S),C=S?!!S.keepComments:!1;return g.toObject(["options",O&&O.options||e,"oneofs",s.arrayToJSON(this.oneofsArray,S),"fields",s.arrayToJSON(this.fieldsArray.filter(function(F){return!F.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",O&&O.nested||e,"comment",C?this.comment:e])},b.prototype.resolveAll=function(){for(var S=this.fieldsArray,O=0;O<S.length;)S[O++].resolve();var C=this.oneofsArray;for(O=0;O<C.length;)C[O++].resolve();return s.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),k(this)}return S instanceof l?(this.oneofs||(this.oneofs={}),this.oneofs[S.name]=S,S.onAdd(this),k(this)):s.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),k(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),k(this)}return s.prototype.remove.call(this,S)},b.prototype.isReservedId=function(S){return s.isReservedId(this.reserved,S)},b.prototype.isReservedName=function(S){return s.isReservedName(this.reserved,S)},b.prototype.create=function(S){return new this.ctor(S)},b.prototype.setup=function(){for(var S=this.fullName,O=[],C=0;C<this.fieldsArray.length;++C)O.push(this._fieldsArray[C].resolve().resolvedType);this.encode=p(this)({Writer:d,types:O,util:g}),this.decode=m(this)({Reader:f,types:O,util:g}),this.verify=y(this)({types:O,util:g}),this.fromObject=w.fromObject(this)({types:O,util:g}),this.toObject=w.toObject(this)({types:O,util:g});var F=_[S];if(F){var R=Object.create(this);R.fromObject=this.fromObject,this.fromObject=F.fromObject.bind(R),R.toObject=this.toObject,this.toObject=F.toObject.bind(R)}return this},b.prototype.encode=function(S,O){return this.setup().encode(S,O)},b.prototype.encodeDelimited=function(S,O){return this.encode(S,O&&O.len?O.fork():O).ldelim()},b.prototype.decode=function(S,O){return this.setup().decode(S,O)},b.prototype.decodeDelimited=function(S){return S instanceof f||(S=f.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,O){return this.setup().toObject(S,O)},b.d=function(S){return function(O){g.decorateType(O,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,i){var s=i,o=t(37),l=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function a(u,c){var h=0,f={};for(c|=0;h<u.length;)f[l[h+c]]=u[h++];return f}s.basic=a([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),s.defaults=a([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",o.emptyArray,null]),s.long=a([0,0,0,1,1],7),s.mapKey=a([0,0,0,5,5,0,0,0,1,1,0,2],2),s.packed=a([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(t,n,i){var s=n.exports=t(39),o=t(30),l,a;s.codegen=t(3),s.fetch=t(5),s.path=t(8),s.fs=s.inquire("fs"),s.toArray=function(d){if(d){for(var g=Object.keys(d),p=new Array(g.length),m=0;m<g.length;)p[m]=d[g[m++]];return p}return[]},s.toObject=function(d){for(var g={},p=0;p<d.length;){var m=d[p++],y=d[p++];y!==e&&(g[m]=y)}return g};var u=/\\/g,c=/"/g;s.isReserved=function(d){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(d)},s.safeProp=function(d){return!/^[$\w_]+$/.test(d)||s.isReserved(d)?'["'+d.replace(u,"\\\\").replace(c,'\\"')+'"]':"."+d},s.ucFirst=function(d){return d.charAt(0).toUpperCase()+d.substring(1)};var h=/_([a-z])/g;s.camelCase=function(d){return d.substring(0,1)+d.substring(1).replace(h,function(g,p){return p.toUpperCase()})},s.compareFieldsById=function(d,g){return d.id-g.id},s.decorateType=function(d,g){if(d.$type)return g&&d.$type.name!==g&&(s.decorateRoot.remove(d.$type),d.$type.name=g,s.decorateRoot.add(d.$type)),d.$type;l||(l=t(35));var p=new l(g||d.name);return s.decorateRoot.add(p),p.ctor=d,Object.defineProperty(d,"$type",{value:p,enumerable:!1}),Object.defineProperty(d.prototype,"$type",{value:p,enumerable:!1}),p};var f=0;s.decorateEnum=function(d){if(d.$type)return d.$type;a||(a=t(15));var g=new a("Enum"+f++,d);return s.decorateRoot.add(g),Object.defineProperty(d,"$type",{value:g,enumerable:!1}),g},Object.defineProperty(s,"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,i){n.exports=o;var s=t(39);function o(c,h){this.lo=c>>>0,this.hi=h>>>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 h=c<0;h&&(c=-c);var f=c>>>0,d=(c-f)/4294967296>>>0;return h&&(d=~d>>>0,f=~f>>>0,++f>4294967295&&(f=0,++d>4294967295&&(d=0))),new o(f,d)},o.from=function(c){if(typeof c=="number")return o.fromNumber(c);if(s.isString(c))if(s.Long)c=s.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 h=~this.lo+1>>>0,f=~this.hi>>>0;return h||(f=f+1>>>0),-(h+f*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(c){return s.Long?new s.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,h=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return f===0?h===0?c<16384?c<128?1:2:c<2097152?3:4:h<16384?h<128?5:6:h<2097152?7:8:f<128?9:10}},{39:39}],39:[function(t,n,i){var s=i;s.asPromise=t(1),s.base64=t(2),s.EventEmitter=t(4),s.float=t(6),s.inquire=t(7),s.utf8=t(10),s.pool=t(9),s.LongBits=t(38),s.emptyArray=Object.freeze?Object.freeze([]):[],s.emptyObject=Object.freeze?Object.freeze({}):{},s.isNode=!!(Ct.process&&Ct.process.versions&&Ct.process.versions.node),s.isInteger=Number.isInteger||function(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a},s.isString=function(a){return typeof a=="string"||a instanceof String},s.isObject=function(a){return a&&typeof a=="object"},s.isset=s.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},s.Buffer=function(){try{var a=s.inquire("buffer").Buffer;return a.prototype.utf8Write?a:null}catch{return null}}(),s._Buffer_from=null,s._Buffer_allocUnsafe=null,s.newBuffer=function(a){return typeof a=="number"?s.Buffer?s._Buffer_allocUnsafe(a):new s.Array(a):s.Buffer?s._Buffer_from(a):typeof Uint8Array>"u"?a:new Uint8Array(a)},s.Array=typeof Uint8Array<"u"?Uint8Array:Array,s.Long=Ct.dcodeIO&&Ct.dcodeIO.Long||s.inquire("long"),s.key2Re=/^true|false|0|1$/,s.key32Re=/^-?(?:0|[1-9][0-9]*)$/,s.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,s.longToHash=function(a){return a?s.LongBits.from(a).toHash():s.LongBits.zeroHash},s.longFromHash=function(a,u){var c=s.LongBits.fromHash(a);return s.Long?s.Long.fromBits(c.lo,c.hi,u):c.toNumber(!!u)};function o(a,u,c){for(var h=Object.keys(u),f=0;f<h.length;++f)(a[h[f]]===e||!c)&&(a[h[f]]=u[h[f]]);return a}s.merge=o,s.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function l(a){function u(c,h){if(!(this instanceof u))return new u(c,h);Object.defineProperty(this,"message",{get:function(){return c}}),Error.captureStackTrace?Error.captureStackTrace(this,u):Object.defineProperty(this,"stack",{value:new Error().stack||""}),h&&o(this,h)}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}s.newError=l,s.ProtocolError=l("ProtocolError"),s.oneOfGetter=function(a){for(var u={},c=0;c<a.length;++c)u[a[c]]=1;return function(){for(var h=Object.keys(this),f=h.length-1;f>-1;--f)if(u[h[f]]===1&&this[h[f]]!==e&&this[h[f]]!==null)return h[f]}},s.oneOfSetter=function(a){return function(u){for(var c=0;c<a.length;++c)a[c]!==u&&delete this[a[c]]}},s.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},s._configure=function(){var a=s.Buffer;if(!a){s._Buffer_from=s._Buffer_allocUnsafe=null;return}s._Buffer_from=a.from!==Uint8Array.from&&a.from||function(u,c){return new a(u,c)},s._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,i){n.exports=c;var s=t(15),o=t(37);function l(h,f){return h.name+": "+f+(h.repeated&&f!=="array"?"[]":h.map&&f!=="object"?"{k:"+h.keyType+"}":"")+" expected"}function a(h,f,d,g){if(f.resolvedType)if(f.resolvedType instanceof s){h("switch(%s){",g)("default:")("return%j",l(f,"enum value"));for(var p=Object.keys(f.resolvedType.values),m=0;m<p.length;++m)h("case %i:",f.resolvedType.values[p[m]]);h("break")("}")}else h("{")("var e=types[%i].verify(%s);",d,g)("if(e)")("return%j+e",f.name+".")("}");else switch(f.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":h("if(!util.isInteger(%s))",g)("return%j",l(f,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":h("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",g,g,g,g)("return%j",l(f,"integer|Long"));break;case"float":case"double":h('if(typeof %s!=="number")',g)("return%j",l(f,"number"));break;case"bool":h('if(typeof %s!=="boolean")',g)("return%j",l(f,"boolean"));break;case"string":h("if(!util.isString(%s))",g)("return%j",l(f,"string"));break;case"bytes":h('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',g,g,g)("return%j",l(f,"buffer"));break}return h}function u(h,f,d){switch(f.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":h("if(!util.key32Re.test(%s))",d)("return%j",l(f,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":h("if(!util.key64Re.test(%s))",d)("return%j",l(f,"integer|Long key"));break;case"bool":h("if(!util.key2Re.test(%s))",d)("return%j",l(f,"boolean key"));break}return h}function c(h){var f=o.codegen(["m"],h.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),d=h.oneofsArray,g={};d.length&&f("var p={}");for(var p=0;p<h.fieldsArray.length;++p){var m=h._fieldsArray[p].resolve(),y="m"+o.safeProp(m.name);if(m.optional&&f("if(%s!=null&&m.hasOwnProperty(%j)){",y,m.name),m.map)f("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(f,m,"k[i]"),a(f,m,p,y+"[k[i]]")("}");else if(m.repeated)f("if(!Array.isArray(%s))",y)("return%j",l(m,"array"))("for(var i=0;i<%s.length;++i){",y),a(f,m,p,y+"[i]")("}");else{if(m.partOf){var w=o.safeProp(m.partOf.name);g[m.partOf.name]===1&&f("if(p%s===1)",w)("return%j",m.partOf.name+": multiple values"),g[m.partOf.name]=1,f("p%s=1",w)}a(f,m,p,y)}m.optional&&f("}")}return f("return null")}},{15:15,37:37}],41:[function(t,n,i){var s=i,o=t(21);s[".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 h=l.$type.toObject(l,a);return h["@type"]=l.$type.fullName,h}return this.toObject(l,a)}}},{21:21}],42:[function(t,n,i){n.exports=d;var s=t(39),o,l=s.LongBits,a=s.base64,u=s.utf8;function c(b,k,S){this.fn=b,this.len=k,this.next=e,this.val=S}function h(){}function f(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function d(){this.len=0,this.head=new c(h,0,0),this.tail=this.head,this.states=null}d.create=s.Buffer?function(){return(d.create=function(){return new o})()}:function(){return new d},d.alloc=function(b){return new s.Array(b)},s.Array!==Array&&(d.alloc=s.pool(d.alloc,s.Array.prototype.subarray)),d.prototype._push=function(b,k,S){return this.tail=this.tail.next=new c(b,k,S),this.len+=k,this};function g(b,k,S){k[S]=b&255}function p(b,k,S){for(;b>127;)k[S++]=b&127|128,b>>>=7;k[S]=b}function m(b,k){this.len=b,this.next=e,this.val=k}m.prototype=Object.create(c.prototype),m.prototype.fn=p,d.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},d.prototype.int32=function(b){return b<0?this._push(y,10,l.fromNumber(b)):this.uint32(b)},d.prototype.sint32=function(b){return this.uint32((b<<1^b>>31)>>>0)};function y(b,k,S){for(;b.hi;)k[S++]=b.lo&127|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)k[S++]=b.lo&127|128,b.lo=b.lo>>>7;k[S++]=b.lo}d.prototype.uint64=function(b){var k=l.from(b);return this._push(y,k.length(),k)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(b){var k=l.from(b).zzEncode();return this._push(y,k.length(),k)},d.prototype.bool=function(b){return this._push(g,1,b?1:0)};function w(b,k,S){k[S]=b&255,k[S+1]=b>>>8&255,k[S+2]=b>>>16&255,k[S+3]=b>>>24}d.prototype.fixed32=function(b){return this._push(w,4,b>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(b){var k=l.from(b);return this._push(w,4,k.lo)._push(w,4,k.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(b){return this._push(s.float.writeFloatLE,4,b)},d.prototype.double=function(b){return this._push(s.float.writeDoubleLE,8,b)};var _=s.Array.prototype.set?function(b,k,S){k.set(b,S)}:function(b,k,S){for(var O=0;O<b.length;++O)k[S+O]=b[O]};d.prototype.bytes=function(b){var k=b.length>>>0;if(!k)return this._push(g,1,0);if(s.isString(b)){var S=d.alloc(k=a.length(b));a.decode(b,S,0),b=S}return this.uint32(k)._push(_,k,b)},d.prototype.string=function(b){var k=u.length(b);return k?this.uint32(k)._push(u.write,k,b):this._push(g,1,0)},d.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new c(h,0,0),this.len=0,this},d.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(h,0,0),this.len=0),this},d.prototype.ldelim=function(){var b=this.head,k=this.tail,S=this.len;return this.reset().uint32(S),S&&(this.tail.next=b.next,this.tail=k,this.len+=S),this},d.prototype.finish=function(){for(var b=this.head.next,k=this.constructor.alloc(this.len),S=0;b;)b.fn(b.val,k,S),S+=b.len,b=b.next;return k},d._configure=function(b){o=b}},{39:39}],43:[function(t,n,i){n.exports=a;var s=t(42);(a.prototype=Object.create(s.prototype)).constructor=a;var o=t(39),l=o.Buffer;function a(){s.call(this)}a.alloc=function(h){return(a.alloc=o._Buffer_allocUnsafe)(h)};var u=l&&l.prototype instanceof Uint8Array&&l.prototype.set.name==="set"?function(h,f,d){f.set(h,d)}:function(h,f,d){if(h.copy)h.copy(f,d,0,h.length);else for(var g=0;g<h.length;)f[d++]=h[g++]};a.prototype.bytes=function(h){o.isString(h)&&(h=o._Buffer_from(h,"base64"));var f=h.length>>>0;return this.uint32(f),f&&this._push(u,f,h),this};function c(h,f,d){h.length<40?o.utf8.write(h,f,d):f.utf8Write(h,d)}a.prototype.string=function(h){var f=l.byteLength(h);return this.uint32(f),f&&this._push(c,f,h),this}},{39:39,42:42}]},{},[19])})()}(Ai)),Ai.exports}var Zh=Gh();const mr=ua(Zh);let oe=mr.Reader,Ce=mr.Writer,_e=mr.util;const j=mr.roots["push-server"]||(mr.roots["push-server"]={});j.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=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.requests!=null&&e.requests.length)for(var n=0;n<e.requests.length;++n)j.Request.encode(e.requests[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.RequestBatch;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.requests&&i.requests.length||(i.requests=[]),i.requests.push(j.Request.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.Request=function(){function r(t){if(t)for(var n=Object.keys(t),i=0;i<n.length;++i)t[n[i]]!=null&&(this[n[i]]=t[n[i]])}r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:_e.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:_e.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=Ce.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&j.IncomingMessagesRequest.encode(t.incomingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&j.ChannelStatsRequest.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&j.ServerStatsRequest.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof oe||(t=oe.create(t));for(var i=n===void 0?t.len:t.pos+n,s=new j.Request;t.pos<i;){var o=t.uint32();switch(o>>>3){case 1:s.incomingMessages=j.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:s.channelStats=j.ChannelStatsRequest.decode(t,t.uint32());break;case 3:s.serverStats=j.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return s},r}(),j.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=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)j.IncomingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.IncomingMessagesRequest;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.messages&&i.messages.length||(i.messages=[]),i.messages.push(j.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.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=_e.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=Ce.create()),e.receivers!=null&&e.receivers.length)for(var n=0;n<e.receivers.length;++n)j.Receiver.encode(e.receivers[n],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&j.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 oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.IncomingMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.receivers&&i.receivers.length||(i.receivers=[]),i.receivers.push(j.Receiver.decode(e,e.uint32()));break;case 2:i.sender=j.Sender.decode(e,e.uint32());break;case 3:i.body=e.string();break;case 4:i.expiry=e.uint32();break;case 5:i.type=e.string();break;default:e.skipType(s&7);break}}return i},r}(),j.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=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)j.ChannelId.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelStatsRequest;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.channels&&i.channels.length||(i.channels=[]),i.channels.push(j.ChannelId.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.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=_e.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=_e.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.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 oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelId;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.isPrivate=e.bool();break;case 3:i.signature=e.bytes();break;default:e.skipType(s&7);break}}return i},r}(),j.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=Ce.create()),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ServerStatsRequest;e.pos<n;){var s=e.uint32();switch(s>>>3){default:e.skipType(s&7);break}}return i},r}(),j.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=_e.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.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 oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.Sender;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.type=e.int32();break;case 2:i.id=e.bytes();break;default:e.skipType(s&7);break}}return i},r}(),j.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}(),j.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=_e.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=_e.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.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 oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.Receiver;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.isPrivate=e.bool();break;case 3:i.signature=e.bytes();break;default:e.skipType(s&7);break}}return i},r}(),j.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=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.responses!=null&&e.responses.length)for(var n=0;n<e.responses.length;++n)j.Response.encode(e.responses[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ResponseBatch;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.responses&&i.responses.length||(i.responses=[]),i.responses.push(j.Response.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.Response=function(){function r(t){if(t)for(var n=Object.keys(t),i=0;i<n.length;++i)t[n[i]]!=null&&(this[n[i]]=t[n[i]])}r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:_e.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:_e.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=Ce.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&j.OutgoingMessagesResponse.encode(t.outgoingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&j.ChannelStatsResponse.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&j.JsonResponse.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof oe||(t=oe.create(t));for(var i=n===void 0?t.len:t.pos+n,s=new j.Response;t.pos<i;){var o=t.uint32();switch(o>>>3){case 1:s.outgoingMessages=j.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:s.channelStats=j.ChannelStatsResponse.decode(t,t.uint32());break;case 3:s.serverStats=j.JsonResponse.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return s},r}(),j.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=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)j.OutgoingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.OutgoingMessagesResponse;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.messages&&i.messages.length||(i.messages=[]),i.messages.push(j.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.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=_e.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=Ce.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")&&j.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.OutgoingMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.body=e.string();break;case 3:i.expiry=e.uint32();break;case 4:i.created=e.fixed32();break;case 5:i.sender=j.Sender.decode(e,e.uint32());break;default:e.skipType(s&7);break}}return i},r}(),j.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=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)j.ChannelStats.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelStatsResponse;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.channels&&i.channels.length||(i.channels=[]),i.channels.push(j.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.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=_e.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=Ce.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 oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelStats;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.isPrivate=e.bool();break;case 3:i.isOnline=e.bool();break;default:e.skipType(s&7);break}}return i},r}(),j.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=Ce.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.JsonResponse;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.json=e.string();break;default:e.skipType(s&7);break}}return i},r}();const Yh=j.ResponseBatch,tl=j.RequestBatch,Kh=j.IncomingMessage,rl=j.Receiver;class nl{_logger=null;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._parent=e.parent,this._connectionType=ge.Undefined,this._callbacks={onOpen:x.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:x.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:x.isFunction(e.onError)?e.onError:()=>{},onMessage:x.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.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 Qh extends nl{_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=ge.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(`${G.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 Xh=60;class ed extends nl{_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=ge.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),Xh*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(`${G.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,x.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");x.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 yr=19,il=30*60,td=5e3,rd=60*1e3,sl=10,ol=10,nd="ping",id="pong",al="bx-pull-session",sd=20,ll={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class cl{_logger=null;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=ge.WebSocket;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[ge.Undefined]:null,[ge.WebSocket]:null,[ge.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=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=je.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),x.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?G.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?G.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?G.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=x.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=x.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=x.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,x.isUndefined(e.configTimestamp)||(this._configTimestamp=G.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new Xa({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new zh({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new Jh({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=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}destroy(){this.stop(Ie.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new Qh({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 ed({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()?ge.WebSocket:ge.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 Hh({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===je.Offline?this.sendPullStatusDelayed(e,td):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!x.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||Ue.Server,e.command=e.command||null,e.type==Ue.Server||e.type==Ue.Client){if(typeof e.moduleId>"u")throw new TypeError(`${G.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(`${G.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=Ue.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:n=>{let i=null;if(typeof e.getMap=="function"){const s=e.getMap();if(s&&typeof s=="object"){const o=s[n.command];typeof o=="function"?i=o.bind(e):typeof o=="string"&&typeof e[o]=="function"&&(i=e[o].bind(e))}}if(!i){const s=`handle${G.capitalize(n.command)}`;typeof e[s]=="function"&&(i=e[s].bind(e))}i&&(this._debug&&this._context!=="master"&&this.getLogger().warn(`${G.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,n),i(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&&x.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 i=Date.now();let s;return!n&&this._storage&&(s=this._storage.get(al,null)),x.isPlainObject(s)&&s.hasOwnProperty("ttl")&&s.ttl>=i&&(this._session.mid=s.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=je.Offline,this.stopCheckConfig(),this.getLogger().error(`${G.getDateForLog()}: Pull: could not read push-server config `,a),l(a)})})}restart(e=Ie.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().log(`${G.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(xe.PullConfig),this._config=null;const n=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(n).then(i=>{this.setConfig(i,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(s=>{this.getLogger().error(s)})},i=>{this.getLogger().error(`${G.getDateForLog()}: Pull: could not read push-server config `,i),this.status=je.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(i?.status==401||i?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=Ie.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,i,s){const o={userList:e,body:{module_id:t,command:n,params:i},expiry:s};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Publish,o):this.sendMessageBatch([o])}async sendMessageToChannels(e,t,n,i,s){const o={channelList:e,body:{module_id:t,command:n,params:i},expiry:s};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.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(st.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!x.isArray(e)||!e.every(n=>typeof n=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((n,i)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.GetUsersLastSeen,{userList:e}).then(s=>{const o=[];for(let a=0;a<e.length;a++)s.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),i(a)})}).catch(s=>{this.getLogger().error(s),i(s)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((n,i)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),x.isFunction(t)&&this._userStatusCallbacks[e].push(t),n())).catch(s=>i(s))})}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(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 n={};switch(e){case ge.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case ge.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(!x.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")n.token=this._config?.jwt;else{const i=[];if(this._config?.channels?.private&&i.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&i.push(this._config.channels.private.id),this._config?.channels.shared?.id&&i.push(this._config.channels.shared.id),i.length===0)throw new Error("Empty channels");n.CHANNEL_ID=i.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=yr,`${t}?${G.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+"?"+G.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&&!vo.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===In.Shared}emit(e){if(e.type==Ue.Server||e.type==Ue.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${G.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=e.extra.server_time_ago>0?e.extra.server_time_ago:0),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Ur.Client?(this.onCustomEvent("onPullClientEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,n,e.params,e.extra],!0),this.emit({type:Ue.Client,moduleId:t,data:{command:n,params:x.clone(e.params),extra:x.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:Ue.Online,data:{command:n,params:x.clone(e.params),extra:x.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:Ue.Server,moduleId:t,data:{command:n,params:x.clone(e.params),extra:x.clone(e.extra)}}))}catch(i){this.getLogger().warn(`
20
28
  ========= PULL ERROR ===========
21
29
  Error type: broadcastMessages execute error
22
- Error event: `,O,`
23
- Message: `,S,`
30
+ Error event: `,i,`
31
+ Message: `,e,`
24
32
  ================================
25
- `)}S.extra&&S.extra.revision_web&&this.checkRevision(h$1.toInteger(S.extra.revision_web))}broadcastMessages(S){for(const v of S)this.broadcastMessage(v)}async sendMessageBatch(S){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 v=this._jsonRpcAdapter?.createPublishRequest(S);return this.connector?.send(JSON.stringify(v)),Promise.resolve(!0)}else{const v={};for(const T of S)if(typeof T.userList<"u")for(const O of T.userList){const A=Number(O);v[A]=A}this._channelManager?.getPublicIds(Object.values(v)).then(T=>{const O=this.connector?.send(this.encodeMessageBatch(S,T));return Promise.resolve(O)})}}encodeMessageBatch(S,v){const T=[];S.forEach(A=>{const k=A.body;let C=[];if(A.userList&&(C=this.createMessageReceivers(A.userList,v)),A.channelList){if(!c.isArray(A.channelList))throw new TypeError("messageFields.publicChannels must be an array");A.channelList.forEach(x=>{let N,D;if(typeof x=="string"&&x.includes(".")){const q=x.toString().split(".");N=q[0],D=q[1]}else if(typeof x=="object"&&"publicId"in x&&"signature"in x)N=x?.publicId,D=x?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);C.push(Receiver.create({id:this.encodeId(N),signature:this.encodeId(D)}))})}const $=IncomingMessage.create({receivers:C,body:JSON.stringify(k),expiry:A.expiry||0});T.push($)});const O=RequestBatch.create({requests:[{incomingMessages:{messages:T}}]});return RequestBatch.encode(O).finish()}createMessageReceivers(S,v){const T=[];for(const O of S){if(!v[O]||!v[O].publicId)throw new Error(`Could not determine public id for user ${O}`);T.push(Receiver.create({id:this.encodeId(v[O].publicId),signature:this.encodeId(v[O].signature)}))}return T}emitUserStatusChange(S,v){if(this._userStatusCallbacks[S])for(const T of this._userStatusCallbacks[S])T({userId:S,isOnline:v})}restoreUserStatusSubscription(){for(const S in this._userStatusCallbacks)this._userStatusCallbacks.hasOwnProperty(S)&&this._userStatusCallbacks[S].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.SubscribeStatusChange,{userId:S})}async loadConfig(S){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},L)}else{this._config=Object.assign({},L);let v;if(this._storage&&(v=this._storage.get(LsKeys.PullConfig,null)),this.isConfigActual(v)&&this.checkRevision(v.api.revision_web))return Promise.resolve(v);this._storage&&this._storage.remove(LsKeys.PullConfig)}return new Promise((v,T)=>{this._restClient.getHttpClient().setLogTag(S),this._restClient.callMethod(this._configGetMethod,{CACHE:"N"}).then(O=>{const A=O.getData().result,k=Math.floor((Date.now()-new Date(A.serverTime).getTime())/1e3);delete A.serverTime;const C=Object.assign({},A);C.server.timeShift=k,v(C)}).catch(O=>{(O?.answerError?.error==="AUTHORIZE_ERROR"||O?.answerError?.error==="WRONG_AUTH_TYPE")&&(O.status=403),T(O)}).finally(()=>{this._restClient.getHttpClient().clearLogTag()})})}isConfigActual(S){if(!c.isPlainObject(S)||Number(S.server.config_timestamp)!==this._configTimestamp)return!1;const v=new Date;if(c.isNumber(S.exp)&&S.exp>0&&S.exp<v.getTime()/1e3||Object.keys(S.channels).length===0)return!1;for(const T in S.channels){if(!S.channels.hasOwnProperty(T))continue;const O=S.channels[T];if(new Date(O.end)<v)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),G)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(h$1.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(CloseReasons.CONFIG_EXPIRED,"config expired");return!0}setConfig(S,v){for(const T in S)S.hasOwnProperty(T)&&this._config?.hasOwnProperty(T)&&(this._config[T]=S[T]);if(S.publicChannels&&this.setPublicIds(Object.values(S.publicChannels)),this._configTimestamp=Number(S.server.config_timestamp),this._storage&&v)try{this._storage.set(LsKeys.PullConfig,S)}catch(T){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${h$1.getDateForLog()}: Pull: Could not cache config in local storage. Error: `,T)}}setPublicIds(S){this._channelManager.setPublicIds(S)}checkRevision(S){return this._skipCheckRevision?!0:S>0&&S!==m$1?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(CloseReasons.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[S,m$1]),this.emit({type:SubscriptionType.Revision,data:{server:S,client:m$1}}),this.logToConsole(`Pull revision changed from ${m$1} to ${S}. Reload required`),!1):!0}disconnect(S,v){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(S,v))}restoreWebSocketConnection(){this._connectionType!==ConnectionType.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(S=0){this._enabled&&(S||(S=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${S} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(v=>{this.getLogger().error(v)})},S*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${I} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=0,this.restoreWebSocketConnection()},I*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=PullStatus.Connecting,this._connectionAttempt++,new Promise((S,v)=>{this._connectPromise={resolve:S,reject:v},this.connector?.connect()})):Promise.reject()}scheduleRestart(S,v,T=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),T<1&&(T=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(S,v),T*1e3)}handleRpcIncomingMessage(S){this._session.mid=S.mid;const v=S.body;return S.body.extra||(v.extra={}),v.extra.sender=S.sender,"user_params"in S&&c.isPlainObject(S.user_params)&&Object.assign(v.params,S.user_params),"dictionary"in S&&c.isPlainObject(S.dictionary)&&Object.assign(v.params,S.dictionary),this.checkDuplicate(S.mid)&&(this.addMessageToStat(v),this.trimDuplicates(),this.broadcastMessage(v)),this.connector?.send(`mack:${S.mid}`),{}}handleIncomingEvents(S){const v=[];if(S.length===0){this._session.mid=null;return}for(const T of S)this.updateSessionFromEvent(T),!(T.mid&&!this.checkDuplicate(T.mid))&&(this.addMessageToStat(T.text),v.push(T.text));this.trimDuplicates(),this.broadcastMessages(v)}updateSessionFromEvent(S){this._session.mid=S.mid||null,this._session.tag=S.tag||null,this._session.time=S.time||null}handleInternalPullEvent(S,v){switch(S.toUpperCase()){case SystemCommands.CHANNEL_EXPIRE:{if(v.params.action==="reconnect"){const T=v.params?.channel.type;T==="private"&&this._config?.channels?.private&&(this._config.channels.private=v.params.new_channel,this.logToConsole(`Pull: new config for ${v.params.channel.type} channel set: ${this._config.channels.private}`)),T==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=v.params.new_channel,this.logToConsole(`Pull: new config for ${v.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(CloseReasons.CONFIG_REPLACED,"config was replaced")}else this.restart(CloseReasons.CHANNEL_EXPIRED,"channel expired received");break}case SystemCommands.CONFIG_EXPIRE:{this.restart(CloseReasons.CONFIG_EXPIRED,"config expired received");break}case SystemCommands.SERVER_RESTART:{this.reconnect(CloseReasons.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(S){if(this.isJsonRpc())S===F?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(S);else{const v=this.extractMessages(S);this.handleIncomingEvents(v)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=PullStatus.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(S){this._connectionType===ConnectionType.LongPolling&&(this.status=PullStatus.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${S.code}, reason: ${S.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(S){this._starting=!1,this._connectionType===ConnectionType.LongPolling&&(this.status=PullStatus.Offline),this.getLogger().error(`${h$1.getDateForLog()}: Pull: Long polling connection error `,S),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(S),this.clearPingWaitTimeout()}onWebSocketBlockChanged(S){const v=S.isWebSocketBlocked;v&&this._connectionType===ConnectionType.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=ConnectionType.LongPolling,this.scheduleReconnect(1)):!v&&this._connectionType===ConnectionType.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=ConnectionType.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=PullStatus.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==ConnectionType.LongPolling&&(this._connectionType=ConnectionType.WebSocket,this._connectors.longPolling?.disconnect(CloseReasons.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(S){this._connectionType===ConnectionType.WebSocket&&(this.status=PullStatus.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${S.code}, reason: ${S.reason}`,!0),this._isManualDisconnect||(S.code==CloseReasons.WRONG_CHANNEL_ID?this.scheduleRestart(CloseReasons.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(S){this._starting=!1,this._connectionType===ConnectionType.WebSocket&&(this.status=PullStatus.Offline),this.getLogger().error(`${h$1.getDateForLog()}: Pull: WebSocket connection error `,S),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(S),this.clearPingWaitTimeout()}extractMessages(S){if(S instanceof ArrayBuffer)return this.extractProtobufMessages(S);if(c.isStringFilled(S))return this.extractPlainTextMessages(S);throw new Error("Error pullEvent type")}extractProtobufMessages(S){const v=[];try{const T=ResponseBatch.decode(new Uint8Array(S));for(let O=0;O<T.responses.length;O++){const A=T.responses[O];if(A.command!=="outgoingMessages")continue;const k=A.outgoingMessages.messages;for(const C of k){let $;try{$=JSON.parse(C.body)}catch(N){this.getLogger().error(`${h$1.getDateForLog()}: Pull: Could not parse message body `,N);continue}$.extra||($.extra={}),$.extra.sender={type:C.sender.type},C.sender.id instanceof Uint8Array&&($.extra.sender.id=this.decodeId(C.sender.id));const x={mid:this.decodeId(C.id),text:$};v.push(x)}}}catch(T){this.getLogger().error(`${h$1.getDateForLog()}: Pull: Could not parse message `,T)}return v}extractPlainTextMessages(S){const v=[],T=S.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/gm);if(T===null){const O=`
33
+ `)}e.extra&&e.extra.revision_web&&this.checkRevision(G.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 i of n.userList){const s=Number(i);t[s]=s}this._channelManager?.getPublicIds(Object.values(t)).then(n=>{const i=this.connector?.send(this.encodeMessageBatch(e,n));return Promise.resolve(i)})}}encodeMessageBatch(e,t){const n=[];e.forEach(s=>{const o=s.body;let l=[];if(s.userList&&(l=this.createMessageReceivers(s.userList,t)),s.channelList){if(!x.isArray(s.channelList))throw new TypeError("messageFields.publicChannels must be an array");s.channelList.forEach(u=>{let c,h;if(typeof u=="string"&&u.includes(".")){const f=u.toString().split(".");c=f[0],h=f[1]}else if(typeof u=="object"&&"publicId"in u&&"signature"in u)c=u?.publicId,h=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(rl.create({id:this.encodeId(c),signature:this.encodeId(h)}))})}const a=Kh.create({receivers:l,body:JSON.stringify(o),expiry:s.expiry||0});n.push(a)});const i=tl.create({requests:[{incomingMessages:{messages:n}}]});return tl.encode(i).finish()}createMessageReceivers(e,t){const n=[];for(const i of e){if(!t[i]||!t[i].publicId)throw new Error(`Could not determine public id for user ${i}`);n.push(rl.create({id:this.encodeId(t[i].publicId),signature:this.encodeId(t[i].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(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({},ll)}else{this._config=Object.assign({},ll);let t;if(this._storage&&(t=this._storage.get(xe.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(xe.PullConfig)}return new Promise((t,n)=>{this._restClient.getHttpClient().setLogTag(e),this._restClient.callMethod(this._configGetMethod,{CACHE:"N"}).then(i=>{const s=i.getData().result,o=Math.floor((Date.now()-new Date(s.serverTime).getTime())/1e3);delete s.serverTime;const l=Object.assign({},s);l.server.timeShift=o,t(l)}).catch(i=>{(i?.answerError?.error==="AUTHORIZE_ERROR"||i?.answerError?.error==="WRONG_AUTH_TYPE")&&(i.status=403),n(i)}).finally(()=>{this._restClient.getHttpClient().clearLogTag()})})}isConfigActual(e){if(!x.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(x.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 i=e.channels[n];if(new Date(i.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),rd)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(G.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(Ie.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(xe.PullConfig,e)}catch(n){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${G.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!==yr?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(Ie.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,yr]),this.emit({type:Ue.Revision,data:{server:e,client:yr}}),this.logToConsole(`Pull revision changed from ${yr} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==ge.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 ${il} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=0,this.restoreWebSocketConnection()},il*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=je.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&&x.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&x.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 cr.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(Ie.CONFIG_REPLACED,"config was replaced")}else this.restart(Ie.CHANNEL_EXPIRED,"channel expired received");break}case cr.CONFIG_EXPIRE:{this.restart(Ie.CONFIG_EXPIRED,"config expired received");break}case cr.SERVER_RESTART:{this.reconnect(Ie.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===nd?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=je.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===ge.LongPolling&&(this.status=je.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===ge.LongPolling&&(this.status=je.Offline),this.getLogger().error(`${G.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===ge.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=ge.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===ge.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=ge.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=je.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==ge.LongPolling&&(this._connectionType=ge.WebSocket,this._connectors.longPolling?.disconnect(Ie.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===ge.WebSocket&&(this.status=je.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==Ie.WRONG_CHANNEL_ID?this.scheduleRestart(Ie.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===ge.WebSocket&&(this.status=je.Offline),this.getLogger().error(`${G.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(x.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const n=Yh.decode(new Uint8Array(e));for(let i=0;i<n.responses.length;i++){const s=n.responses[i];if(s.command!=="outgoingMessages")continue;const o=s.outgoingMessages.messages;for(const l of o){let a;try{a=JSON.parse(l.body)}catch(c){this.getLogger().error(`${G.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(`${G.getDateForLog()}: Pull: Could not parse message `,n)}return t}extractPlainTextMessages(e){const t=[],n=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/gm);if(n===null){const i=`
26
34
  ========= PULL ERROR ===========
27
35
  Error type: parseResponse error parsing message
28
36
 
29
- Data string: ${S}
37
+ Data string: ${e}
30
38
  ================================
31
39
 
32
- `;return this.getLogger().warn(O),[]}for(let O=0;O<T.length;O++){if(T[O]=T[O].substring(12,T[O].length-12),T[O].length<=0)continue;let A;try{A=JSON.parse(T[O])}catch{continue}v.push(A)}return v}decodeId(S){let v="";for(const T of S){const O=T.toString(16);O.length===1&&(v+="0"),v+=O}return v}encodeId(S){if(!S)return new Uint8Array;const v=[];for(let T=0;T<S.length;T+=2)v.push(Number.parseInt(S.slice(T,T+2),16));return new Uint8Array(v)}onOffline(){this.disconnect(CloseReasons.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(S=>{this.getLogger().error(S)})}onBeforeUnload(){this._unloading=!0;const S=c.clone(this.session);if(S.ttl=Date.now()+V*1e3,this._storage)try{this._storage.set(w,JSON.stringify(S))}catch(v){this.getLogger().error(`${h$1.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,v)}this.scheduleReconnect(15)}sendPullStatusDelayed(S,v){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(S)},v)}sendPullStatus(S){this._unloading||(this.onCustomEvent("onPullStatus",[S]),this.emit({type:SubscriptionType.Status,data:{status:S}}))}extendWatch(S,v=!1){this._watchTagsQueue.get(S)||(this._watchTagsQueue.set(S,!0),v&&this.updateWatch(v))}updateWatch(S=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const v=[...this._watchTagsQueue.keys()];v.length>0?this._restClient.callMethod("pull.watch.extend",{tags:v}).then(T=>{const O=T.getData().result;for(const A of O)this.clearWatch(A);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},S?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(S){this._watchTagsQueue.delete(S)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(J)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,R*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 ${R*2} seconds. Reconnecting`),this.disconnect(CloseReasons.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(S){let v;return S<1?v=.5:S<3?v=15:S<5?v=45:S<10?v=600:v=3600,v+v*Math.random()*.2}checkDuplicate(S){return this._session.lastMessageIds.includes(S)?(this.getLogger().warn(`Duplicate message ${S} skipped`),!1):(this._session.lastMessageIds.push(S),!0)}trimDuplicates(){this._session.lastMessageIds.length>E&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-E))}logMessage(S){this._debug&&(S.extra?.sender&&S.extra.sender.type===SenderType.Client?this.getLogger().info(`onPullClientEvent-${S.module_id}`,S.command,S.params,S.extra):S.module_id=="online"?this.getLogger().info("onPullOnlineEvent",S.command,S.params,S.extra):this.getLogger().info("onPullEvent",S.module_id,S.command,S.params,S.extra))}logToConsole(S,v=!1){(this._loggingEnabled||v)&&this.getLogger().log(`${h$1.getDateForLog()}: ${S}`)}addMessageToStat(S){this._session.history[S.module_id]||(this._session.history[S.module_id]={}),this._session.history[S.module_id][S.command]||(this.session.history[S.module_id][S.command]=0),this._session.history[S.module_id][S.command]++,this._session.messageCount++}showNotification(S){this.getLogger().warn(S)}onCustomEvent(S,v,T=!1){}}class B24HelperManager{_b24;_logger=null;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";constructor(S){this._b24=S,this.setLogger(this._b24.getLogger())}setLogger(S){this._logger=S,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=LoggerBrowser.build("NullLogger"),this._logger.setConfig({[LoggerType.desktop]:!1,[LoggerType.log]:!1,[LoggerType.info]:!1,[LoggerType.warn]:!1,[LoggerType.error]:!0,[LoggerType.trace]:!1})),this._logger}destroy(){this._destroyPullClient()}async loadData(S=[LoadDataType.App,LoadDataType.Profile]){const v={[LoadDataType.App]:{method:"app.info"},[LoadDataType.Profile]:{method:"profile"},[LoadDataType.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[LoadDataType.AppOptions]:{method:"app.option.get"},[LoadDataType.UserOptions]:{method:"user.option.get"}},T=S.reduce((O,A)=>{if(v[A])if(Array.isArray(v[A]))for(const[k,C]of v[A].entries())O[`get_${A}_${k}`]=C;else O[`get_${A}`]=v[A];return O},{});try{const O=(await this._b24.callBatch(T)).getData();O[`get_${LoadDataType.App}`]&&(this._app=await this.parseAppData(O[`get_${LoadDataType.App}`]),this._payment=await this.parsePaymentData(O[`get_${LoadDataType.App}`]),this._license=await this.parseLicenseData(O[`get_${LoadDataType.App}`])),O[`get_${LoadDataType.Profile}`]&&(this._profile=await this.parseUserData(O[`get_${LoadDataType.Profile}`])),O[`get_${LoadDataType.Currency}_0`]&&O[`get_${LoadDataType.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:O[`get_${LoadDataType.Currency}_0`],currencyList:O[`get_${LoadDataType.Currency}_1`]})),O[`get_${LoadDataType.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",O[`get_${LoadDataType.AppOptions}`])),O[`get_${LoadDataType.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",O[`get_${LoadDataType.UserOptions}`])),this._isInit=!0}catch(O){throw O instanceof Error?O:(console.error("Error loading data:",O),new Error("Failed to load data"))}}async parseUserData(S){const v=new ProfileManager(this._b24);return v.setLogger(this.getLogger()),v.initData({id:Number(S.ID),isAdmin:S.ADMIN===!0,lastName:S?.LAST_NAME||"",name:S?.NAME||"",gender:S?.PERSONAL_GENDER||"",photo:S?.PERSONAL_PHOTO||"",TimeZone:S?.TIME_ZONE||"",TimeZoneOffset:S?.TIME_ZONE_OFFSET}).then(()=>v)}async parseAppData(S){const v=new AppManager(this._b24);return v.setLogger(this.getLogger()),v.initData({id:Number.parseInt(S.ID),code:S.CODE,version:Number.parseInt(S.VERSION),status:S.STATUS,isInstalled:S.INSTALLED}).then(()=>v)}async parsePaymentData(S){const v=new PaymentManager(this._b24);return v.setLogger(this.getLogger()),v.initData({isExpired:S.PAYMENT_EXPIRED==="Y",days:Number.parseInt(S.DAYS||"0")}).then(()=>v)}async parseLicenseData(S){const v=new LicenseManager(this._b24);return v.setLogger(this.getLogger()),v.initData({languageId:S.LANGUAGE_ID,license:S.LICENSE,licensePrevious:S.LICENSE_PREVIOUS,licenseType:S.LICENSE_TYPE,licenseFamily:S.LICENSE_FAMILY,isSelfHosted:S.LICENSE.includes("selfhosted")}).then(()=>v)}async parseCurrencyData(S){const v=new CurrencyManager(this._b24);return v.setLogger(this.getLogger()),v.initData(S).then(()=>v)}async parseOptionsData(S,v){const T=new OptionsManager(this._b24,S);return T.setLogger(this.getLogger()),T.initData(v).then(()=>T)}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?{[TypeSpecificUrl.MainSettings]:"/configs/",[TypeSpecificUrl.UfList]:"/configs/userfield_list.php",[TypeSpecificUrl.UfPage]:"/configs/userfield.php"}:{[TypeSpecificUrl.MainSettings]:"/settings/configs/",[TypeSpecificUrl.UfList]:"/settings/configs/userfield_list.php",[TypeSpecificUrl.UfPage]:"/settings/configs/userfield.php"}}usePullClient(S="prefix",v){return this._b24PullClient?this:(this.initializePullClient(typeof v>"u"?this.profileInfo.data.id||0:v,S),this)}initializePullClient(S,v="prefix"){this._b24PullClient=new PullClient({b24:this._b24,restApplication:this._b24.auth.getUniq(v),userId:S})}subscribePullClient(S,v="application"){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId=v,this._pullClientUnSubscribe.push(this._b24PullClient.subscribe({moduleId:this._pullClientModuleId,callback:S})),this}startPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");this._b24PullClient.start().catch(S=>{this.getLogger().error(`${h$1.getDateForLog()}: Pull not running`,S)})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const S of this._pullClientUnSubscribe)S();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}const useB24Helper=()=>{let _=!1,S=!1,v=null;return{initB24Helper:async(T,O=[LoadDataType.App,LoadDataType.Profile])=>(v===null&&(v=new B24HelperManager(T)),_?v:v.loadData(O).then(()=>(_=!0,v))),isInitB24Helper:()=>_,destroyB24Helper:()=>{v?.destroy(),v=null,_=!1,S=!1},getB24Helper:()=>{if(v===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return v},usePullClient:()=>{if(v===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");v.usePullClient(),S=!0},useSubscribePullClient:(T,O="application")=>{if(!S)throw new Error("PullClient is not initialized. You need to call usePullClient first.");v?.subscribePullClient(T,O)},startPullClient:()=>{if(!S)throw new Error("PullClient is not initialized. You need to call usePullClient first.");v?.startPullClient()}}},P=50;let e=null,n=!1,t=null,s=!1,i=[],u=!1;function m(){window.setTimeout(()=>{if(!n||e===null){m();return}p(),i=[]},P)}function p(){if(t!==null)for(const _ of i)_.reject(t);if(!(!n||e===null))for(const _ of i)_.resolve(e)}async function initializeB24Frame(){return n&&e!==null?Promise.resolve(e):s?(u||(u=!0,m()),new Promise((_,S)=>{i.push({resolve:_,reject:S})})):(s=!0,new Promise((_,S)=>{const v={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[T,O,A]=window.name.split("|");v.DOMAIN=T,v.PROTOCOL=Number.parseInt(O)===1,v.APP_SID=A,v.LANG=null}(!v.DOMAIN||!v.APP_SID)&&(t=new Error("Unable to initialize Bitrix24Frame library!"),S(t)),e=new B24Frame(v),e.init().then(()=>{n=!0,_(e)}).catch(T=>{t=T,S(t)})}))}exports.AbstractB24=AbstractB24,exports.AjaxError=AjaxError,exports.AjaxResult=AjaxResult,exports.AppFrame=AppFrame,exports.AuthHookManager=AuthHookManager,exports.AuthManager=AuthManager,exports.B24Frame=B24Frame,exports.B24Hook=B24Hook,exports.B24LangList=B24LangList,exports.B24PullClientManager=PullClient,exports.Browser=s$1,exports.CloseReasons=CloseReasons,exports.ConnectionType=ConnectionType,exports.DataType=DataType,exports.DialogManager=DialogManager,exports.EnumAppStatus=EnumAppStatus,exports.EnumCrmEntityType=EnumCrmEntityType,exports.EnumCrmEntityTypeId=EnumCrmEntityTypeId,exports.ListRpcError=ListRpcError,exports.LoadDataType=LoadDataType,exports.LoggerBrowser=LoggerBrowser,exports.LoggerType=LoggerType,exports.LsKeys=LsKeys,exports.MessageCommands=MessageCommands,exports.MessageManager=MessageManager,exports.OptionsManager=OptionsManager$1,exports.ParentManager=ParentManager,exports.PlacementManager=PlacementManager,exports.PullStatus=PullStatus,exports.RestrictionManagerParamsBase=RestrictionManagerParamsBase,exports.RestrictionManagerParamsForEnterprise=RestrictionManagerParamsForEnterprise,exports.Result=Result,exports.RpcMethod=RpcMethod,exports.SenderType=SenderType,exports.ServerMode=ServerMode,exports.SliderManager=SliderManager,exports.StatusDescriptions=StatusDescriptions,exports.SubscriptionType=SubscriptionType,exports.SystemCommands=SystemCommands,exports.Text=h$1,exports.Type=c,exports.TypeOption=TypeOption,exports.TypeSpecificUrl=TypeSpecificUrl,exports.initializeB24Frame=initializeB24Frame,exports.useB24Helper=useB24Helper,exports.useFormatter=useFormatter});
40
+ `;return this.getLogger().warn(i),[]}for(let i=0;i<n.length;i++){if(n[i]=n[i].substring(12,n[i].length-12),n[i].length<=0)continue;let s;try{s=JSON.parse(n[i])}catch{continue}t.push(s)}return t}decodeId(e){let t="";for(const n of e){const i=n.toString(16);i.length===1&&(t+="0"),t+=i}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(Ie.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error(e)})}onBeforeUnload(){this._unloading=!0;const e=x.clone(this.session);if(e.ttl=Date.now()+sd*1e3,this._storage)try{this._storage.set(al,JSON.stringify(e))}catch(t){this.getLogger().error(`${G.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:Ue.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 i=n.getData().result;for(const s of i)this.clearWatch(s);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(id)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,ol*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 ${ol*2} seconds. Reconnecting`),this.disconnect(Ie.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>sl&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-sl))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Ur.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(`${G.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 od{_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=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}destroy(){this._destroyPullClient()}async loadData(e=[de.App,de.Profile]){const t={[de.App]:{method:"app.info"},[de.Profile]:{method:"profile"},[de.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[de.AppOptions]:{method:"app.option.get"},[de.UserOptions]:{method:"user.option.get"}},n=e.reduce((i,s)=>{if(t[s])if(Array.isArray(t[s]))for(const[o,l]of t[s].entries())i[`get_${s}_${o}`]=l;else i[`get_${s}`]=t[s];return i},{});try{const i=(await this._b24.callBatch(n)).getData();i[`get_${de.App}`]&&(this._app=await this.parseAppData(i[`get_${de.App}`]),this._payment=await this.parsePaymentData(i[`get_${de.App}`]),this._license=await this.parseLicenseData(i[`get_${de.App}`])),i[`get_${de.Profile}`]&&(this._profile=await this.parseUserData(i[`get_${de.Profile}`])),i[`get_${de.Currency}_0`]&&i[`get_${de.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:i[`get_${de.Currency}_0`],currencyList:i[`get_${de.Currency}_1`]})),i[`get_${de.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",i[`get_${de.AppOptions}`])),i[`get_${de.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",i[`get_${de.UserOptions}`])),this._isInit=!0}catch(i){throw i instanceof Error?i:(console.error("Error loading data:",i),new Error("Failed to load data"))}}async parseUserData(e){const t=new jh(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 Uh(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 Bh(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 $h(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 Wh(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const n=new Ti(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?{[Ot.MainSettings]:"/configs/",[Ot.UfList]:"/configs/userfield_list.php",[Ot.UfPage]:"/configs/userfield.php"}:{[Ot.MainSettings]:"/settings/configs/",[Ot.UfList]:"/settings/configs/userfield_list.php",[Ot.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 cl({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(`${G.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 ad=()=>{let r=!1,e=!1,t=null;return{initB24Helper:async(n,i=[de.App,de.Profile])=>(t===null&&(t=new od(n)),r?t:t.loadData(i).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,i="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(n,i)},startPullClient:()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()}}},ld=50;let gt=null,Yr=!1,Yt=null,ul=!1,Kr=[],fl=!1;function hl(){window.setTimeout(()=>{if(!Yr||gt===null){hl();return}cd(),Kr=[]},ld)}function cd(){if(Yt!==null)for(const r of Kr)r.reject(Yt);if(!(!Yr||gt===null))for(const r of Kr)r.resolve(gt)}async function ud(){return Yr&&gt!==null?Promise.resolve(gt):ul?(fl||(fl=!0,hl()),new Promise((r,e)=>{Kr.push({resolve:r,reject:e})})):(ul=!0,new Promise((r,e)=>{const t={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,i,s]=window.name.split("|");t.DOMAIN=n,t.PROTOCOL=Number.parseInt(i)===1,t.APP_SID=s,t.LANG=null}(!t.DOMAIN||!t.APP_SID)&&(Yt=new Error("Unable to initialize Bitrix24Frame library!"),e(Yt)),gt=new Qa(t),gt.init().then(()=>{Yr=!0,r(gt)}).catch(n=>{Yt=n,e(Yt)})}))}q.AbstractB24=Gt,q.AjaxError=ur,q.AjaxResult=Rn,q.AppFrame=Ha,q.AuthHookManager=qa,q.AuthManager=za,q.B24Frame=Qa,q.B24Hook=xh,q.B24LangList=ki,q.B24PullClientManager=cl,q.Browser=vo,q.CloseReasons=Ie,q.ConnectionType=ge,q.DataType=Wi,q.DialogManager=Za,q.EnumAppStatus=kt,q.EnumCrmEntityType=_o,q.EnumCrmEntityTypeId=Eo,q.ListRpcError=Cn,q.LoadDataType=de,q.LoggerBrowser=Pe,q.LoggerType=M,q.LsKeys=xe,q.MessageCommands=fe,q.MessageManager=Va,q.OptionsManager=Ga,q.ParentManager=Ja,q.PlacementManager=Ka,q.PullStatus=je,q.RestrictionManagerParamsBase=So,q.RestrictionManagerParamsForEnterprise=An,q.Result=Vt,q.RpcMethod=st,q.SenderType=Ur,q.ServerMode=In,q.SliderManager=Ya,q.StatusDescriptions=ko,q.SubscriptionType=Ue,q.SystemCommands=cr,q.Text=G,q.Type=x,q.TypeOption=at,q.TypeSpecificUrl=Ot,q.initializeB24Frame=ud,q.useB24Helper=ad,q.useFormatter=Dh});
33
41
  //# sourceMappingURL=index.min.js.map