@bitrix24/b24jssdk 0.1.0

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.
@@ -0,0 +1,33 @@
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,$,P]=T;return[k,O,A,C,x,$,P]}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,$,P]=T.formatToParts?partsOffset(T,v):hackyOffset(T,v);C==="BC"&&(O=-Math.abs(O)+1);const N=objToLocalTS({year:O,month:A,day:k,hour:x===24?0:x,minute:$,second:P,millisecond:0});let M=+v;const q=M%1e3;return M-=q>=0?q:1e3+q,(N-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 x=_.substring(0,v);T=getCachedDTF(x).resolvedOptions(),O=x}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()),x=v||Settings.defaultNumberingSystem,$=T||Settings.defaultOutputCalendar,P=validateWeekSettings(O)||Settings.defaultWeekSettings;return new Locale(C,x,$,P,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,x]=parseLocaleString(S);this.locale=k,this.numberingSystem=v||C||null,this.outputCalendar=T||x||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 x=Math.floor((k-C+14-S)/7),$;return x<1?($=T-1,x=weeksInWeekYear($,S,v)):x>weeksInWeekYear(T,S,v)?($=T+1,x=1):$=T,{weekYear:$,weekNumber:x,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 x=O*7+A-k-7+S,$;x<1?($=T-1,x+=daysInYear($)):x>C?($=T+1,x-=daysInYear(T)):$=T;const{month:P,day:D}=uncomputeOrdinal($,x);return{year:$,month:P,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),x=integerBetween(O,0,999);return A?k?C?x?!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(x=>x.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),x=C===1,$=O[_],P=T?x?$[1]:$[2]||$[1]:x?O[_][0]:_;return k?`${C} ${P} ago`:`in ${C} ${P}`}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,q)=>this.loc.extract(S,M,q),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"),x=(M,q)=>T?monthForDateTime(S,M):A(q?{month:M}:{month:M,day:"numeric"},"month"),$=(M,q)=>T?weekdayForDateTime(S,M):A(q?{weekday:M}:{weekday:M,month:"long",day:"numeric"},"weekday"),P=M=>{const q=Formatter.macroTokenToFormatOpts(M);return q?this.formatWithSystemDefault(S,q):M},D=M=>T?eraForDateTime(S,M):A({era:M},"era"),N=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 $("short",!0);case"cccc":return $("long",!0);case"ccccc":return $("narrow",!0);case"E":return this.num(S.weekday);case"EEE":return $("short",!1);case"EEEE":return $("long",!1);case"EEEEE":return $("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 x("short",!0);case"LLLL":return x("long",!0);case"LLLLL":return x("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 x("short",!1);case"MMMM":return x("long",!1);case"MMMMM":return x("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 P(M)}};return stringifyTokens(Formatter.parseFormat(v),N)}formatDurationFromString(S,v){const T=x=>{switch(x[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 P=T($);return P?this.num(x.get(P),$.length):$},A=Formatter.parseFormat(v),k=A.reduce((x,{literal:$,val:P})=>$?x:x.concat(P),[]),C=S.shiftTo(...k.map(T).filter(x=>x));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,x]=A(S,O);return[{...v,...k},C||T,x]},[{},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,$]=_,P=S[0]==="-",D=x&&x[0]==="-",N=(M,q=!1)=>M!==void 0&&(q||M&&P)?-M:M;return[{years:N(parseFloating(v)),months:N(parseFloating(T)),weeks:N(parseFloating(O)),days:N(parseFloating(A)),hours:N(parseFloating(k)),minutes:N(parseFloating(C)),seconds:N(parseFloating(x),x==="-0"),milliseconds:N(parseMillis($),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,$,P,D]=_,N=fromStrings(S,O,T,v,A,k,C);let M;return x?M=obsOffsets[x]:$?M=0:M=signedOffset(P,D),[N,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 $ in T)C+=this.matrix[$][k]*T[$],T[$]=0;isNumber$1(O[k])&&(C+=O[k]);const x=Math.trunc(C);v[k]=x,T[k]=(C*1e3-x*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,x;try{C=DateTime.fromISO(O,v),x=C.isValid}catch{x=!1}if(k&&x)return Interval.fromDateTimes(A,C);if(k){const $=Duration.fromISO(O,v);if($.isValid)return Interval.after(A,$)}else if(x){const $=Duration.fromISO(T,v);if($.isValid)return Interval.before(C,$)}}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(x=>x*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(x=>[{time:x.s,type:"s"},{time:x.e,type:"e"}]),k=Array.prototype.concat(...A),C=k.sort((x,$)=>x.time-$.time);for(const x of C)T+=x.type==="s"?1:-1,T===1?v=x.time:(v&&+v!=+x.time&&O.push(Interval.fromDateTimes(v,x.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,$)=>$.year-x.year],["quarters",(x,$)=>$.quarter-x.quarter+($.year-x.year)*4],["months",(x,$)=>$.month-x.month+($.year-x.year)*12],["weeks",(x,$)=>{const P=dayDiff(x,$);return(P-P%7)/7}],["days",dayDiff]],O={},A=_;let k,C;for(const[x,$]of T)v.indexOf(x)>=0&&(k=x,O[x]=$(_,S),C=A.plus(O),C>S?(O[x]--,_=A.plus(O),_>S&&(C=_,O[x]--,_=A.plus(O))):_=C);return[_,O,C,k]}function diff(_,S,v,T){let[O,A,k,C]=highOrderDiffs(_,S,v);const x=S-O,$=v.filter(D=>["hours","minutes","seconds","milliseconds"].indexOf(D)>=0);$.length===0&&(k<S&&(k=O.plus({[C]:1})),k!==O&&(A[C]=(A[C]||0)+x/(k-O)));const P=Duration.fromObject(A,T);return $.length>0?Duration.fromMillis(x,T).shiftTo(...$).plus(P):P}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}"),x=digitRegex(S,"{1,3}"),$=digitRegex(S,"{1,6}"),P=digitRegex(S,"{1,9}"),D=digitRegex(S,"{2,4}"),N=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($);case"yy":return intUnit(D,untruncateYear);case"yyyy":return intUnit(A);case"yyyyy":return intUnit(N);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(x);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(x);case"SSS":return intUnit(O);case"u":return simple(P);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 x=/^\s+$/.test(O);return{literal:!x,val:x?" ":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],x=C.groups?C.groups+1:1;!C.literal&&C.token&&(O[C.token.val[0]]=C.deser(T.slice(A,A+x))),A+=x}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&&(x+=k,$=_.zone.offset(x)),{ts:x,o:$}}function parseDataToDateTime(_,S,v,T,O,A){const{setZone:k,zone:C}=v;if(_&&Object.keys(_).length!==0||S){const x=S||C,$=DateTime.fromObject(_,{...v,zone:x,specificOffset:A});return k?$:$.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 x of orderedUnits)isUndefined$1(_[x])&&(_[x]=defaultUnitValues[x]);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:x,millisecond:$},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:x,millisecond:$},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),x=Settings.now(),$=isUndefined$1(v.specificOffset)?T.offset(x):v.specificOffset,P=!isUndefined$1(A.ordinal),D=!isUndefined$1(A.year),N=!isUndefined$1(A.month)||!isUndefined$1(A.day),M=D||N,q=A.weekYear||A.weekNumber;if((M||P)&&q)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(N&&P)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const z=q||A.weekday&&!M;let W,j,U=tsToObj(x,$);z?(W=orderedWeekUnits,j=defaultWeekUnitValues,U=gregorianToWeek(U,k,C)):P?(W=orderedOrdinalUnits,j=defaultOrdinalUnitValues,U=gregorianToOrdinal(U)):(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]=U[se]:Z=!0}const X=z?hasInvalidWeekData(A,k,C):P?hasInvalidOrdinalData(A):hasInvalidGregorianData(A),Q=X||hasInvalidTimeData(A);if(Q)return DateTime.invalid(Q);const ee=z?weekToGregorian(A,k,C):P?ordinalToGregorian(A):A,[ce,pe]=objToTS(ee,$,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,$,P]=parseFromTokens(k,S,v);return P?DateTime.invalid(P):parseDataToDateTime(C,x,T,`format ${v}`,S,$)}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 x=T-k*v,$=T-C*v,P=tsToObj(x,k),D=tsToObj($,C);return P.hour===D.hour&&P.minute===D.minute&&P.second===D.second&&P.millisecond===D.millisecond?[clone(this,{ts:x}),clone(this,{ts:$})]:[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),x=!isUndefined$1(v.month)||!isUndefined$1(v.day),$=C||x,P=v.weekYear||v.weekNumber;if(($||k)&&P)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(x&&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[N,M]=objToTS(D,this.o,this.zone);return clone(this,{ts:N,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,x=k?S:this,$=diff(C,x,A,O);return k?$.negate():$}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:x,specificOffset:$,invalidReason:P}=v.explainFromTokens(S);return P?DateTime.invalid(P):parseDataToDateTime(C,x,T,`format ${v.format}`,S,$)}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$2(){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$1={"&":"&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.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$2()}encode(S){return c.isString(S)?S.replace(p$1,v=>d$1[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 P=Math.pow(10,$);return Math.round(x*P)/P})(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<1}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){return S.forEach(v=>{v instanceof Error?this._errorCollection.add(v):this._errorCollection.add(new Error(v.toString()))}),this}getErrors(){return this._errorCollection.values()}getErrorMessages(){return Array.from(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"){let 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=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 x=v(k,O+1);!isUndefined(x)&&(A[C]=x)}),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(x){return x!==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||P,A=v.dots,k=v.indexes,x=(v.Blob||typeof Blob<"u"&&Blob)&&utils$2.isSpecCompliantForm(S);if(!utils$2.isFunction(O))throw new TypeError("visitor must be a function");function $(q){if(q===null)return"";if(utils$2.isDate(q))return q.toISOString();if(!x&&utils$2.isBlob(q))throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");return utils$2.isArrayBuffer(q)||utils$2.isTypedArray(q)?x&&typeof Blob=="function"?new Blob([q]):Buffer.from(q):q}function P(q,z,W){let j=q;if(q&&!W&&typeof q=="object"){if(utils$2.endsWith(z,"{}"))z=T?z:z.slice(0,-2),q=JSON.stringify(q);else if(utils$2.isArray(q)&&isFlatArray(q)||(utils$2.isFileList(q)||utils$2.endsWith(z,"[]"))&&(j=utils$2.toArray(q)))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+"[]",$(Z))}),!1}return isVisitable(q)?!0:(S.append(renderKey(W,z,A),$(q)),!1)}const D=[],N=Object.assign(predicates,{defaultVisitor:P,convertValue:$,isVisitable});function M(q,z){if(!utils$2.isUndefined(q)){if(D.indexOf(q)!==-1)throw Error("Circular reference detected in "+z.join("."));D.push(q),utils$2.forEach(q,function(j,U){(!(utils$2.isUndefined(j)||j===null)&&O.call(S,j,utils$2.isString(U)?U.trim():U,z,N))===!0&&M(j,z?z.concat(U):[U])}),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),x=A>=v.length;return k=!k&&utils$2.isArray(O)?O.length:k,x?(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 x=this.env&&this.env.FormData;return toFormData$1(C?{"files[]":S}:S,x&&new x,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 P=normalizeHeader(x);if(!P)throw new Error("header name must be a non-empty string");const D=utils$2.findKey(O,P);(!D||O[D]===void 0||$===!0||$===void 0&&O[D]!==!1)&&(O[D||x]=normalizeValue(C))}const k=(C,x)=>utils$2.forEach(C,($,P)=>A($,P,x));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,x]of S.entries())A(x,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(x){const $=Date.now(),P=T[A];k||(k=$),v[O]=x,T[O]=$;let D=A,N=0;for(;D!==O;)N+=v[D++],D=D%_;if(O=(O+1)%_,O===A&&(A=(A+1)%_),$-k<S)return;const M=P&&$-P;return M?Math.round(N*1e3/M):void 0}}function throttle(_,S){let v=0,T=1e3/S,O,A;const k=($,P=Date.now())=>{v=P,O=null,A&&(clearTimeout(A),A=null),_.apply(null,$)};return[(...$)=>{const P=Date.now(),D=P-v;D>=T?k($,P):(O=$,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,x=k-T,$=O(x),P=k<=C;T=k;const D={loaded:k,total:C,progress:C?k/C:void 0,bytes:x,rate:$||void 0,estimated:$&&C&&P?(C-k)/$: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($,P,D){return utils$2.isPlainObject($)&&utils$2.isPlainObject(P)?utils$2.merge.call({caseless:D},$,P):utils$2.isPlainObject(P)?utils$2.merge({},P):utils$2.isArray(P)?P.slice():P}function O($,P,D){if(utils$2.isUndefined(P)){if(!utils$2.isUndefined($))return T(void 0,$,D)}else return T($,P,D)}function A($,P){if(!utils$2.isUndefined(P))return T(void 0,P)}function k($,P){if(utils$2.isUndefined(P)){if(!utils$2.isUndefined($))return T(void 0,$)}else return T(void 0,P)}function C($,P,D){if(D in S)return T($,P);if(D in _)return T(void 0,$)}const x={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:($,P)=>O(headersToObject($),headersToObject(P),!0)};return utils$2.forEach(Object.keys(Object.assign({},_,S)),function(P){const D=x[P]||O,N=D(_[P],S[P],P);utils$2.isUndefined(N)&&D!==C||(v[P]=N)}),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 x;if(utils$2.isFormData(v)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)k.setContentType(void 0);else if((x=k.getContentType())!==!1){const[$,...P]=x?x.split(";").map(D=>D.trim()).filter(Boolean):[];k.setContentType([$||"multipart/form-data",...P].join("; "))}}if(platform.hasStandardBrowserEnv&&(T&&utils$2.isFunction(T)&&(T=T(S)),T||T!==!1&&isURLSameOrigin(S.url))){const $=O&&A&&cookies.read(A);$&&k.set(O,$)}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:x,onDownloadProgress:$}=O,P,D,N,M,q;function z(){M&&M(),q&&q(),O.cancelToken&&O.cancelToken.unsubscribe(P),O.signal&&O.signal.removeEventListener("abort",P)}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),$&&([N,q]=progressEventReducer($,!0),W.addEventListener("progress",N)),x&&W.upload&&([D,M]=progressEventReducer(x),W.upload.addEventListener("progress",D),W.upload.addEventListener("loadend",M)),(O.cancelToken||O.signal)&&(P=Z=>{W&&(T(!Z||Z.type?new CanceledError$1(null,_,W):Z),W.abort(),W=null)},O.cancelToken&&O.cancelToken.subscribe(P),O.signal&&(O.signal.aborted?P():O.signal.addEventListener("abort",P)));const U=parseProtocol(O.url);if(U&&platform.protocols.indexOf(U)===-1){T(new AxiosError$1("Unsupported protocol "+U+":",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($){if(!O){O=!0,C();const P=$ instanceof Error?$:this.reason;T.abort(P instanceof AxiosError$1?P:new CanceledError$1(P instanceof Error?P.message:P))}};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($=>{$.unsubscribe?$.unsubscribe(A):$.removeEventListener("abort",A)}),_=null)};_.forEach($=>$.addEventListener("abort",A));const{signal:x}=T;return x.unsubscribe=()=>utils$2.asap(C),x}},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=x=>{k||(k=!0,T&&T(x))};return new ReadableStream({async pull(x){try{const{done:$,value:P}=await O.next();if($){C(),x.close();return}let D=P.byteLength;if(v){let N=A+=D;v(N)}x.enqueue(new Uint8Array(P))}catch($){throw C($),$}},cancel(x){return C(x),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:x,responseType:$,headers:P,withCredentials:D="same-origin",fetchOptions:N}=resolveConfig(_);$=$?($+"").toLowerCase():"text";let M=composeSignals([O,A&&A.toAbortSignal()],k),q;const z=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let W;try{if(x&&supportsRequestStream&&v!=="get"&&v!=="head"&&(W=await resolveBodyLength(P,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"))&&P.setContentType(ee),Q.body){const[ce,pe]=progressEventDecorator(W,progressEventReducer(asyncDecorator(x)));T=trackStream(Q.body,DEFAULT_CHUNK_SIZE,ce,pe)}}utils$2.isString(D)||(D=D?"include":"omit");const j="credentials"in Request.prototype;q=new Request(S,{...N,signal:M,method:v.toUpperCase(),headers:P.normalize().toJSON(),body:T,duplex:"half",credentials:j?D:void 0});let U=await fetch(q);const Z=supportsResponseStream&&($==="stream"||$==="response");if(supportsResponseStream&&(C||Z&&z)){const Q={};["status","statusText","headers"].forEach(ae=>{Q[ae]=U[ae]});const ee=utils$2.toFiniteNumber(U.headers.get("content-length")),[ce,pe]=C&&progressEventDecorator(ee,progressEventReducer(asyncDecorator(C),!0))||[];U=new Response(trackStream(U.body,DEFAULT_CHUNK_SIZE,ce,()=>{pe&&pe(),z&&z()}),Q)}$=$||"text";let X=await resolvers[utils$2.findKey(resolvers,$)||"text"](U,_);return!Z&&z&&z(),await new Promise((Q,ee)=>{settle(Q,ee,{data:X,headers:AxiosHeaders$1.from(U.headers),status:U.status,statusText:U.statusText,config:_,request:q})})}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,_,q),{cause:j.cause||j}):AxiosError$1.from(j,j&&j.code,_,q)}}),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,x])=>`adapter ${C} `+(x===!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],x=C===void 0||k(C,A,_);if(x!==!0)throw new AxiosError$1("option "+A+" must be "+x,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"],q=>{delete A[q]}),v.headers=AxiosHeaders$1.concat(k,A);const C=[];let x=!0;this.interceptors.request.forEach(function(z){typeof z.runWhen=="function"&&z.runWhen(v)===!1||(x=x&&z.synchronous,C.unshift(z.fulfilled,z.rejected))});const $=[];this.interceptors.response.forEach(function(z){$.push(z.fulfilled,z.rejected)});let P,D=0,N;if(!x){const q=[dispatchRequest.bind(this),void 0];for(q.unshift.apply(q,C),q.push.apply(q,$),N=q.length,P=Promise.resolve(v);D<N;)P=P.then(q[D++],q[D++]);return P}N=C.length;let M=v;for(D=0;D<N;){const q=C[D++],z=C[D++];try{M=q(M)}catch(W){z.call(this,W);break}}try{P=dispatchRequest.call(this,M)}catch(q){return Promise.reject(q)}for(D=0,N=$.length;D<N;)P=P.then($[D++],$[D++]);return P}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 P=[],D=0;D<x.length;D+=1)P[D]=x[D];for(var N=0;N<$.length;N+=1)P[N+x.length]=$[N];return P},A=function(x,$){for(var P=[],D=$,N=0;D<x.length;D+=1,N+=1)P[N]=x[D];return P},k=function(C,x){for(var $="",P=0;P<C.length;P+=1)$+=C[P],P+1<C.length&&($+=x);return $};return implementation=function(x){var $=this;if(typeof $!="function"||S.apply($)!==T)throw new TypeError(_+$);for(var P=A(arguments,1),D,N=function(){if(this instanceof D){var j=$.apply(this,O(P,arguments));return Object(j)===j?j:this}return $.apply(x,O(P,arguments))},M=v(0,$.length-P.length),q=[],z=0;z<M;z++)q[z]="$"+z;if(D=Function("binder","return function ("+k(q,",")+"){ return binder.apply(this,arguments); }")(N),$.prototype){var W=function(){};W.prototype=$.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(),x=Function,$=function(me){try{return x('"use strict"; return ('+me+").constructor;")()}catch{}},P=Object.getOwnPropertyDescriptor;if(P)try{P({},"")}catch{P=null}var D=function(){throw new k},N=P?function(){try{return arguments.callee,D}catch{try{return P(arguments,"callee").get}catch{return D}}}():D,M=requireHasSymbols()(),q=requireHasProto()(),z=Object.getPrototypeOf||(q?function(me){return me.__proto__}:null),W={},j=typeof Uint8Array>"u"||!z?_:z(Uint8Array),U={__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%":x,"%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%":N,"%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));U["%Error.prototype%"]=Z}var X=function me(oe){var be;if(oe==="%AsyncFunction%")be=$("async function () {}");else if(oe==="%GeneratorFunction%")be=$("function* () {}");else if(oe==="%AsyncGeneratorFunction%")be=$("async function* () {}");else if(oe==="%AsyncGenerator%"){var ye=me("%AsyncGeneratorFunction%");ye&&(be=ye.prototype)}else if(oe==="%AsyncIteratorPrototype%"){var ve=me("%AsyncGenerator%");ve&&z&&(be=z(ve.prototype))}return U[oe]=be,be},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 be=ie(oe,0,1),ye=ie(oe,-1);if(be==="%"&&ye!=="%")throw new A("invalid intrinsic syntax, expected closing `%`");if(ye==="%"&&be!=="%")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,be){var ye=oe,ve;if(ce(Q,ye)&&(ve=Q[ye],ye="%"+ve[0]+"%"),ce(U,ye)){var Ee=U[ye];if(Ee===W&&(Ee=X(ye)),typeof Ee>"u"&&!be)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,be){if(typeof oe!="string"||oe.length===0)throw new k("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof be!="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+"%",be),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,$e=!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"||!$e)&&(Ce=!0),ve+="."+Ae,Ie="%"+ve+"%",ce(U,Ie))de=U[Ie];else if(de!=null){if(!(Ae in de)){if(!be)throw new k("base intrinsic for "+oe+" exists, but the property is not available.");return}if(P&&Fe+1>=ye.length){var Ne=P(de,Ae);$e=!!Ne,$e&&"get"in Ne&&!("originalValue"in Ne.get)?de=Ne.get:de=de[Ae]}else $e=ce(de,Ae),de=de[Ae];$e&&!Ce&&(U[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 x=arguments.length>3?arguments[3]:null,$=arguments.length>4?arguments[4]:null,P=arguments.length>5?arguments[5]:null,D=arguments.length>6?arguments[6]:!1,N=!!T&&T(A,k);if(_)_(A,k,{configurable:P===null&&N?N.configurable:!P,enumerable:x===null&&N?N.enumerable:!x,value:C,writable:$===null&&N?N.writable:!$});else if(D||!x&&!$&&!P)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,x){if(typeof C!="function")throw new O("`fn` is not a function");if(typeof x!="number"||x<0||x>4294967295||A(x)!==x)throw new O("`length` must be a positive 32-bit integer");var $=arguments.length>2&&!!arguments[2],P=!0,D=!0;if("length"in C&&T){var N=T(C,"length");N&&!N.configurable&&(P=!1),N&&!N.writable&&(D=!1)}return(P||D||!$)&&(v?S(C,"length",x,!0,!0):S(C,"length",x)),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),x=requireEsDefineProperty(),$=v("%Math.max%");_.exports=function(N){if(typeof N!="function")throw new O("a function is required");var M=C(S,k,arguments);return T(M,1+$(0,N.length-(arguments.length-1)),!0)};var P=function(){return C(S,A,arguments)};x?x(_.exports,"apply",{value:P}):_.exports.apply=P}(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,x=typeof WeakMap=="function"&&WeakMap.prototype,$=x?WeakMap.prototype.has:null,P=typeof WeakSet=="function"&&WeakSet.prototype,D=P?WeakSet.prototype.has:null,N=typeof WeakRef=="function"&&WeakRef.prototype,M=N?WeakRef.prototype.deref:null,q=Boolean.prototype.valueOf,z=Object.prototype.toString,W=Function.prototype.toString,j=String.prototype.match,U=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),Se=U.call(K,we.length+1);return Z.call(we,ge,"$&_")+"."+Z.call(Z.call(Se,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Z.call(K,ge,"$&_")}var be=require$$0,ye=be.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 Se=ge||{};if(Re(Se,"quoteStyle")&&!Re(Ee,Se.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Re(Se,"maxStringLength")&&(typeof Se.maxStringLength=="number"?Se.maxStringLength<0&&Se.maxStringLength!==1/0:Se.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var He=Re(Se,"customInspect")?Se.customInspect:!0;if(typeof He!="boolean"&&He!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Re(Se,"indent")&&Se.indent!==null&&Se.indent!==" "&&!(parseInt(Se.indent,10)===Se.indent&&Se.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Re(Se,"numericSeparator")&&typeof Se.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ue=Se.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,Se);if(typeof K=="number"){if(K===0)return 1/0/K>0?"0":"-0";var Pe=String(K);return Ue?oe(K,Pe):Pe}if(typeof K=="bigint"){var ze=String(K)+"n";return Ue?oe(K,ze):ze}var ct=typeof Se.depth>"u"?5:Se.depth;if(typeof Te>"u"&&(Te=0),Te>=ct&&ct>0&&typeof K=="object")return Le(K)?"[Array]":"[Object]";var Ye=te(Se,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:Se.depth};return Re(Se,"quoteStyle")&&(Ot.quoteStyle=Se.quoteStyle),Y(Ke,Ot,Te+1,we)}return Y(Ke,Se,Te+1,we)}if(typeof K=="function"&&!$e(K)){var yt=ot(K),St=he(K,Be);return"[Function"+(yt?": "+yt:" (anonymous)")+"]"+(St.length>0?" { "+pe.call(St,", ")+" }":"")}if(je(K)){var bt=ue?Z.call(String(K),/^(Symbol\(.*\))_[^)]*$/,"$1"):Oe.call(K);return typeof K=="object"&&!ue?Je(bt):bt}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",Se);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"&&be)return be(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(xe(K))return Je(Be(ie.call(K)));if(Ne(K))return Je(q.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)&&!$e(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?U.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 $e(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 Ne(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 xe(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(!$||!Y||typeof Y!="object")return!1;try{$.call(Y,$);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{$.call(Y,$)}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(U.call(Y,0,K.maxStringLength),K)+Te}var we=Ie[K.quoteStyle||"single"];we.lastIndex=0;var Se=Z.call(Z.call(Y,we,"\\$1"),/[\x00-\x1f]/g,lt);return de(Se,"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 Se=typeof fe=="function"?fe(Y):[],He;if(ue){He={};for(var Ue=0;Ue<Se.length;Ue++)He["$"+Se[Ue]]=Se[Ue]}for(var Pe in Y)Re(Y,Pe)&&(ge&&String(Number(Pe))===Pe&&Pe<Y.length||ue&&He["$"+Pe]instanceof Symbol||(ee.call(/[^\w$]/,Pe)?Te.push(K(Pe,Y)+": "+K(Y[Pe],Y)):Te.push(Pe+": "+K(Y[Pe],Y))));if(typeof fe=="function")for(var ze=0;ze<Se.length;ze++)_e.call(Y,Se[ze])&&Te.push("["+K(Se[ze])+"]: "+K(Y[Se[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),x=S("WeakMap.prototype.has",!0),$=S("Map.prototype.get",!0),P=S("Map.prototype.set",!0),D=S("Map.prototype.has",!0),N=function(W,j){for(var U=W,Z;(Z=U.next)!==null;U=Z)if(Z.key===j)return U.next=Z.next,Z.next=W.next,W.next=Z,Z},M=function(W,j){var U=N(W,j);return U&&U.value},q=function(W,j,U){var Z=N(W,j);Z?Z.value=U:W.next={key:j,next:W.next,value:U}},z=function(W,j){return!!N(W,j)};return sideChannel=function(){var j,U,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(U)return $(U,Q)}else if(Z)return M(Z,Q)},has:function(Q){if(O&&Q&&(typeof Q=="object"||typeof Q=="function")){if(j)return x(j,Q)}else if(A){if(U)return D(U,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?(U||(U=new A),P(U,Q,ee)):(Z||(Z={key:{},next:null}),q(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 U=j.pop(),Z=U.obj[U.prop];if(v(Z)){for(var X=[],Q=0;Q<Z.length;++Q)typeof Z[Q]<"u"&&X.push(Z[Q]);U.obj[U.prop]=X}}},A=function(j,U){for(var Z=U&&U.plainObjects?Object.create(null):{},X=0;X<j.length;++X)typeof j[X]<"u"&&(Z[X]=j[X]);return Z},k=function W(j,U,Z){if(!U)return j;if(typeof U!="object"){if(v(j))j.push(U);else if(j&&typeof j=="object")(Z&&(Z.plainObjects||Z.allowPrototypes)||!S.call(Object.prototype,U))&&(j[U]=!0);else return[j,U];return j}if(!j||typeof j!="object")return[j].concat(U);var X=j;return v(j)&&!v(U)&&(X=A(j,Z)),v(j)&&v(U)?(U.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(U).reduce(function(Q,ee){var ce=U[ee];return S.call(Q,ee)?Q[ee]=W(Q[ee],ce,Z):Q[ee]=ce,Q},X)},C=function(j,U){return Object.keys(U).reduce(function(Z,X){return Z[X]=U[X],Z},j)},x=function(W,j,U){var Z=W.replace(/\+/g," ");if(U==="iso-8859-1")return Z.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(Z)}catch{return Z}},$=1024,P=function(j,U,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+=$){for(var ae=ee.length>=$?ee.slice(pe,pe+$):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 U=[{obj:{o:j},prop:"o"}],Z=[],X=0;X<U.length;++X)for(var Q=U[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&&(U.push({obj:ee,prop:ae}),Z.push(se))}return O(U),j},N=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))},q=function(j,U){return[].concat(j,U)},z=function(j,U){if(v(j)){for(var Z=[],X=0;X<j.length;X+=1)Z.push(U(j[X]));return Z}return U(j)};return utils={arrayToObject:A,assign:C,combine:q,compact:D,decode:x,encode:P,isBuffer:M,isRegExp:N,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])},x=Date.prototype.toISOString,$=v.default,P={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:S.encode,encodeValuesOnly:!1,format:$,formatter:v.formatters[$],indices:!1,serializeDate:function(W){return x.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"},N={},M=function z(W,j,U,Z,X,Q,ee,ce,pe,ae,se,ie,fe,Oe,ue,le,_e,me){for(var oe=W,be=me,ye=0,ve=!1;(be=be.get(N))!==void 0&&!ve;){var Ee=be.get(W);if(ye+=1,typeof Ee<"u"){if(Ee===ye)throw new RangeError("Cyclic object value");ve=!0}typeof be.get(N)>"u"&&(ye=0)}if(typeof ae=="function"?oe=ae(j,oe):oe instanceof Date?oe=fe(oe):U==="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,P.encoder,_e,"key",Oe):j;oe=""}if(D(oe)||S.isBuffer(oe)){if(pe){var Ie=le?j:pe(j,P.encoder,_e,"key",Oe);return[ue(Ie)+"="+ue(pe(oe,P.encoder,_e,"value",Oe))]}return[ue(j)+"="+ue(String(oe))]}var de=[];if(typeof oe>"u")return de;var Ce;if(U==="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,$e=Z&&A(oe)&&oe.length===1?Fe+"[]":Fe;if(X&&A(oe)&&oe.length===0)return $e+"[]";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 Ne=ie&&ce?De.replace(/\./g,"%2E"):De,je=A(oe)?typeof U=="function"?U($e,Ne):$e:$e+(ie?"."+Ne:"["+Ne+"]");me.set(W,ye);var xe=_();xe.set(N,me),C(de,z(qe,je,U,Z,X,Q,ee,ce,U==="comma"&&le&&A(oe)?null:pe,ae,se,ie,fe,Oe,ue,le,_e,xe))}}return de},q=function(W){if(!W)return P;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||P.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 U=v.default;if(typeof W.format<"u"){if(!T.call(v.formatters,W.format))throw new TypeError("Unknown format option provided.");U=W.format}var Z=v.formatters[U],X=P.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=P.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:P.allowDots:!!W.allowDots;return{addQueryPrefix:typeof W.addQueryPrefix=="boolean"?W.addQueryPrefix:P.addQueryPrefix,allowDots:ee,allowEmptyArrays:typeof W.allowEmptyArrays=="boolean"?!!W.allowEmptyArrays:P.allowEmptyArrays,arrayFormat:Q,charset:j,charsetSentinel:typeof W.charsetSentinel=="boolean"?W.charsetSentinel:P.charsetSentinel,commaRoundTrip:W.commaRoundTrip,delimiter:typeof W.delimiter>"u"?P.delimiter:W.delimiter,encode:typeof W.encode=="boolean"?W.encode:P.encode,encodeDotInKeys:typeof W.encodeDotInKeys=="boolean"?W.encodeDotInKeys:P.encodeDotInKeys,encoder:typeof W.encoder=="function"?W.encoder:P.encoder,encodeValuesOnly:typeof W.encodeValuesOnly=="boolean"?W.encodeValuesOnly:P.encodeValuesOnly,filter:X,format:U,formatter:Z,serializeDate:typeof W.serializeDate=="function"?W.serializeDate:P.serializeDate,skipNulls:typeof W.skipNulls=="boolean"?W.skipNulls:P.skipNulls,sort:typeof W.sort=="function"?W.sort:null,strictNullHandling:typeof W.strictNullHandling=="boolean"?W.strictNullHandling:P.strictNullHandling}};return stringify_1=function(z,W){var j=z,U=q(W),Z,X;typeof U.filter=="function"?(X=U.filter,j=X("",j)):A(U.filter)&&(X=U.filter,Z=X);var Q=[];if(typeof j!="object"||j===null)return"";var ee=O[U.arrayFormat],ce=ee==="comma"&&U.commaRoundTrip;Z||(Z=Object.keys(j)),U.sort&&Z.sort(U.sort);for(var pe=_(),ae=0;ae<Z.length;++ae){var se=Z[ae];U.skipNulls&&j[se]===null||C(Q,M(j[se],se,ee,ce,U.allowEmptyArrays,U.strictNullHandling,U.skipNulls,U.encodeDotInKeys,U.encode?U.encoder:null,U.filter,U.sort,U.allowDots,U.serializeDate,U.format,U.formatter,U.encodeValuesOnly,U.charset,pe))}var ie=Q.join(U.delimiter),fe=U.addQueryPrefix===!0?"?":"";return U.charsetSentinel&&(U.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(N){return N.replace(/&#(\d+);/g,function(M,q){return String.fromCharCode(parseInt(q,10))})},A=function(N,M){return N&&typeof N=="string"&&M.comma&&N.indexOf(",")>-1?N.split(","):N},k="utf8=%26%2310003%3B",C="utf8=%E2%9C%93",x=function(M,q){var z={__proto__:null},W=q.ignoreQueryPrefix?M.replace(/^\?/,""):M;W=W.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var j=q.parameterLimit===1/0?void 0:q.parameterLimit,U=W.split(q.delimiter,j),Z=-1,X,Q=q.charset;if(q.charsetSentinel)for(X=0;X<U.length;++X)U[X].indexOf("utf8=")===0&&(U[X]===C?Q="utf-8":U[X]===k&&(Q="iso-8859-1"),Z=X,X=U.length);for(X=0;X<U.length;++X)if(X!==Z){var ee=U[X],ce=ee.indexOf("]="),pe=ce===-1?ee.indexOf("="):ce+1,ae,se;pe===-1?(ae=q.decoder(ee,T.decoder,Q,"key"),se=q.strictNullHandling?null:""):(ae=q.decoder(ee.slice(0,pe),T.decoder,Q,"key"),se=_.maybeMap(A(ee.slice(pe+1),q),function(fe){return q.decoder(fe,T.decoder,Q,"value")})),se&&q.interpretNumericEntities&&Q==="iso-8859-1"&&(se=O(se)),ee.indexOf("[]=")>-1&&(se=v(se)?[se]:se);var ie=S.call(z,ae);ie&&q.duplicates==="combine"?z[ae]=_.combine(z[ae],se):(!ie||q.duplicates==="last")&&(z[ae]=se)}return z},$=function(N,M,q,z){for(var W=z?M:A(M,q),j=N.length-1;j>=0;--j){var U,Z=N[j];if(Z==="[]"&&q.parseArrays)U=q.allowEmptyArrays&&(W===""||q.strictNullHandling&&W===null)?[]:[].concat(W);else{U=q.plainObjects?Object.create(null):{};var X=Z.charAt(0)==="["&&Z.charAt(Z.length-1)==="]"?Z.slice(1,-1):Z,Q=q.decodeDotInKeys?X.replace(/%2E/g,"."):X,ee=parseInt(Q,10);!q.parseArrays&&Q===""?U={0:W}:!isNaN(ee)&&Z!==Q&&String(ee)===Q&&ee>=0&&q.parseArrays&&ee<=q.arrayLimit?(U=[],U[ee]=W):Q!=="__proto__"&&(U[Q]=W)}W=U}return W},P=function(M,q,z,W){if(M){var j=z.allowDots?M.replace(/\.([^.[]+)/g,"[$1]"):M,U=/(\[[^[\]]*])/,Z=/(\[[^[\]]*])/g,X=z.depth>0&&U.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 $(ee,q,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 q=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:q,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(N,M){var q=D(M);if(N===""||N===null||typeof N>"u")return q.plainObjects?Object.create(null):{};for(var z=typeof N=="string"?x(N,q):N,W=q.plainObjects?Object.create(null):{},j=Object.keys(z),U=0;U<j.length;++U){var Z=j[U],X=P(Z,z[Z],q,typeof N=="string");W=_.merge(W,X,q)}return q.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 d=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);let O=T?[]:{},A=0;const k=(C,x)=>{let $=null,P=null;if(Array.isArray(C)?($=C[0],P=C[1]):C.method&&($=C.method,P=C.params),$){A++;let D=$+"?"+d.stringify(P);T||Array.isArray(O)?O.push(D):O[x]=D}};return T?S.forEach((C,x)=>k(C,x)):Object.entries(S).forEach(([C,x])=>k(x,C)),A<1?Promise.resolve(new Result):this.call("batch",{halt:v?1:0,cmd:O}).then(C=>{const x=C.getData().result,$=T?[]:{},P=(q,z)=>{if(typeof x.result[z]<"u"||typeof x.result_error[z]<"u"){let W=q.split("?"),j=new AjaxResult({result:typeof x.result[z]<"u"?x.result[z]:{},error:x?.result_error[z]||void 0,total:x.result_total[z],next:x.result_next[z]},{method:W[0]||"",params:d.parse(W[1]||""),start:0},C.getStatus());T||Array.isArray($)?$.push(j):$[z]=j}};Array.isArray(O)?O.forEach((q,z)=>P(q,z)):Object.entries(O).forEach(([q,z])=>P(z,q));let D;const N=q=>new AjaxError({status:0,answerError:{error:q.getErrorMessages().join("; "),errorDescription:`batch ${q.getQuery().method}: ${d.stringify(q.getQuery().params,{encode:!1})}`},cause:q.getErrors().next().value}),M=new Result;if(T||Array.isArray($)){D=[];for(let q of $){if(q.getStatus()!==200||!q.isSuccess){const z=N(q);if(!v&&!q.isSuccess){M.addError(z);continue}return Promise.reject(z)}D.push(q.getData().result)}}else{D={};for(let q of Object.keys($)){let z=$[q];if(z.getStatus()!==200||!z.isSuccess){const W=N(z);if(!v&&!z.isSuccess){M.addError(W);continue}return Promise.reject(W)}D[q]=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 x=A.response.data;k={error:x.error,errorDescription:x.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 x=>{const $=x.data;return Promise.resolve({status:x.status,payload:$})},async x=>{let $={error:x?.code||0,errorDescription:x?.message||""};if(x instanceof AxiosError&&x.response&&x.response.data){const D=x.response.data;$={error:D.error,errorDescription:D.error_description}}const P=new AjaxError({status:x.response?.status||0,answerError:$,cause:x});return Promise.reject(P)})):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){let 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.0",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=[],x;if(O===null?x=k.getData().result:x=k.getData().result[O],C=[...C,...x],k.isMore()){let $=k;for(;$=await $.getNext(this.getHttpClient()),$!==!1;){let P;if(O===null?P=$.getData().result:P=$.getData().result[O],C=[...C,...P],T){const D=$.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 x=C.at(-1);x&&T in x&&(v.filter[A]=x[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().indexOf(":")>=0)A={method:S.toString(),params:v||"",callback:C,appSid:this.#e.getAppSid()};else{A=S.toString();let x=[v?JSON.stringify(v):null,C,this.#e.getAppSid()];A+=":"+x.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}))},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});let v=S.data.split(":");const 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){let 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=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=new Date().valueOf()+parseInt(S.AUTH_EXPIRES)*1e3,this.#i=S.IS_ADMIN,this.#n=S.MEMBER_ID||""),this}getAuthData(){return this.#r>new Date().valueOf()?{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=new Date().valueOf()+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 x=0,$=1e3*60*5,P=window.setInterval(()=>{x=x+1,C.closed?(clearInterval(P),A({isOpenAtNewWindow:!0,isClose:!0})):x>$&&(clearInterval(P),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().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<1)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);typeof O>"u"||Object.entries(v.LANG).forEach(([A,k])=>{switch(O.lang[A]={decimals: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;case"OWN":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(),S.forEach(v=>{this.data.currencyList.set(v.CURRENCY,{amount:parseFloat(v.CURRENCY),amountCnt:parseInt(v.AMOUNT_CNT),isBase:v.BASE==="Y",currencyCode:v.CURRENCY,dateUpdate:h$1.toDateTime(v.DATE_UPDATE),decimals:parseInt(v.DECIMALS),decPoint:v.DEC_POINT,formatString:v.FORMAT_STRING,fullName:v.FULL_NAME,lid:v.LID,sort: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 Array.from(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)?Array.from(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){this.reset(),c.isObject(S)&&Object.entries(S).forEach(([v,T])=>{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{let 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:x,reject:$})))}),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;let T={},O=[];return S.forEach(A=>{const k=this._publicIds.get(A);k&&k.end>v?T[k.userId]=k:O.push(A)}),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)),O.forEach(x=>{const $=this._publicIds.get(x);$&&(T[$.userId]=$)}),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)$(D);else{for(var N=new Array(arguments.length-1),M=0;M<N.length;)N[M++]=arguments[M];x.apply(null,N)}};try{S.apply(v||null,T)}catch(P){k&&(k=!1,$(P))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(_){var S=_;S.length=function(C){var x=C.length;if(!x)return 0;for(var $=0;--x%4>1&&C.charAt(x)==="=";)++$;return Math.ceil(C.length*3)/4-$};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 P=null,D=[],N=0,M=0,q;x<$;){var z=C[x++];switch(M){case 0:D[N++]=v[z>>2],q=(z&3)<<4,M=1;break;case 1:D[N++]=v[q|z>>4],q=(z&15)<<2,M=2;break;case 2:D[N++]=v[q|z>>6],D[N++]=v[z&63],M=0;break}N>8191&&((P||(P=[])).push(String.fromCharCode.apply(String,D)),N=0)}return M&&(D[N++]=v[q],D[N++]=61,M===1&&(D[N++]=61)),P?(N&&P.push(String.fromCharCode.apply(String,D.slice(0,N))),P.join("")):String.fromCharCode.apply(String,D.slice(0,N))};var A="invalid encoding";S.decode=function(C,x,$){for(var P=$,D=0,N,M=0;M<C.length;){var q=C.charCodeAt(M++);if(q===61&&D>1)break;if((q=T[q])===void 0)throw Error(A);switch(D){case 0:N=q,D=1;break;case 1:x[$++]=N<<2|(q&48)>>4,N=q,D=2;break;case 2:x[$++]=(N&15)<<4|(q&60)>>2,N=q,D=3;break;case 3:x[$++]=(N&3)<<6|q,D=0;break}}if(D===1)throw Error(A);return $-P},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),x=C[3]===128;function $(M,q,z){k[0]=M,q[z]=C[0],q[z+1]=C[1],q[z+2]=C[2],q[z+3]=C[3]}function P(M,q,z){k[0]=M,q[z]=C[3],q[z+1]=C[2],q[z+2]=C[1],q[z+3]=C[0]}A.writeFloatLE=x?$:P,A.writeFloatBE=x?P:$;function D(M,q){return C[0]=M[q],C[1]=M[q+1],C[2]=M[q+2],C[3]=M[q+3],k[0]}function N(M,q){return C[3]=M[q],C[2]=M[q+1],C[1]=M[q+2],C[0]=M[q+3],k[0]}A.readFloatLE=x?D:N,A.readFloatBE=x?N:D}():function(){function k(x,$,P,D){var N=$<0?1:0;if(N&&($=-$),$===0)x(1/$>0?0:2147483648,P,D);else if(isNaN($))x(2143289344,P,D);else if($>34028234663852886e22)x((N<<31|2139095040)>>>0,P,D);else if($<11754943508222875e-54)x((N<<31|Math.round($/1401298464324817e-60))>>>0,P,D);else{var M=Math.floor(Math.log($)/Math.LN2),q=Math.round($*Math.pow(2,-M)*8388608)&8388607;x((N<<31|M+127<<23|q)>>>0,P,D)}}A.writeFloatLE=k.bind(null,S),A.writeFloatBE=k.bind(null,v);function C(x,$,P){var D=x($,P),N=(D>>31)*2+1,M=D>>>23&255,q=D&8388607;return M===255?q?NaN:N*(1/0):M===0?N*1401298464324817e-60*q:N*Math.pow(2,M-150)*(q+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),x=C[7]===128;function $(M,q,z){k[0]=M,q[z]=C[0],q[z+1]=C[1],q[z+2]=C[2],q[z+3]=C[3],q[z+4]=C[4],q[z+5]=C[5],q[z+6]=C[6],q[z+7]=C[7]}function P(M,q,z){k[0]=M,q[z]=C[7],q[z+1]=C[6],q[z+2]=C[5],q[z+3]=C[4],q[z+4]=C[3],q[z+5]=C[2],q[z+6]=C[1],q[z+7]=C[0]}A.writeDoubleLE=x?$:P,A.writeDoubleBE=x?P:$;function D(M,q){return C[0]=M[q],C[1]=M[q+1],C[2]=M[q+2],C[3]=M[q+3],C[4]=M[q+4],C[5]=M[q+5],C[6]=M[q+6],C[7]=M[q+7],k[0]}function N(M,q){return C[7]=M[q],C[6]=M[q+1],C[5]=M[q+2],C[4]=M[q+3],C[3]=M[q+4],C[2]=M[q+5],C[1]=M[q+6],C[0]=M[q+7],k[0]}A.readDoubleLE=x?D:N,A.readDoubleBE=x?N:D}():function(){function k(x,$,P,D,N,M){var q=D<0?1:0;if(q&&(D=-D),D===0)x(0,N,M+$),x(1/D>0?0:2147483648,N,M+P);else if(isNaN(D))x(0,N,M+$),x(2146959360,N,M+P);else if(D>17976931348623157e292)x(0,N,M+$),x((q<<31|2146435072)>>>0,N,M+P);else{var z;if(D<22250738585072014e-324)z=D/5e-324,x(z>>>0,N,M+$),x((q<<31|z/4294967296)>>>0,N,M+P);else{var W=Math.floor(Math.log(D)/Math.LN2);W===1024&&(W=1023),z=D*Math.pow(2,-W),x(z*4503599627370496>>>0,N,M+$),x((q<<31|W+1023<<20|z*1048576&1048575)>>>0,N,M+P)}}}A.writeDoubleLE=k.bind(null,S,0,4),A.writeDoubleBE=k.bind(null,v,4,0);function C(x,$,P,D,N){var M=x(D,N+$),q=x(D,N+P),z=(q>>31)*2+1,W=q>>>20&2047,j=4294967296*(q&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,P;O<A;)P=T[O++],P<128?x[$++]=P:P>191&&P<224?x[$++]=(P&31)<<6|T[O++]&63:P>239&&P<365?(P=((P&7)<<18|(T[O++]&63)<<12|(T[O++]&63)<<6|T[O++]&63)-65536,x[$++]=55296+(P>>10),x[$++]=56320+(P&1023)):x[$++]=(P&15)<<12|(T[O++]&63)<<6|T[O++]&63,$>8191&&((C||(C=[])).push(String.fromCharCode.apply(String,x)),$=0);return C?($&&C.push(String.fromCharCode.apply(String,x.slice(0,$))),C.join("")):String.fromCharCode.apply(String,x.slice(0,$))},S.write=function(T,O,A){for(var k=A,C,x,$=0;$<T.length;++$)C=T.charCodeAt($),C<128?O[A++]=C:C<2048?(O[A++]=C>>6|192,O[A++]=C&63|128):(C&64512)===55296&&((x=T.charCodeAt($+1))&64512)===56320?(C=65536+((C&1023)<<10)+(x&1023),++$,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($){if($<1||$>A)return S($);C+$>O&&(k=S(O),C=0);var P=v.call(k,C,C+=$);return C&7&&(C=(C|7)+1),P}}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 x=k>>>0,$=(k-x)/4294967296>>>0;return C&&($=~$>>>0,x=~x>>>0,++x>4294967295&&(x=0,++$>4294967295&&($=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,x=~this.hi>>>0;return C||(x=x+1>>>0),-(C+x*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,x=this.hi>>>24;return x===0?C===0?k<16384?k<128?1:2:k<2097152?3:4:C<16384?C<128?5:6:C<2097152?7:8:x<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),x=0;x<C.length;++x)(O[C[x]]===void 0||!k)&&(O[C[x]]=A[C[x]]);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 x=Object.keys(this),$=x.length-1;$>-1;--$)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=x;var _=requireMinimal(),S,v=_.LongBits,T=_.base64,O=_.utf8;function A(W,j,U){this.fn=W,this.len=j,this.next=void 0,this.val=U}function k(){}function C(W){this.head=W.head,this.tail=W.tail,this.len=W.len,this.next=W.states}function x(){this.len=0,this.head=new A(k,0,0),this.tail=this.head,this.states=null}var $=function(){return _.Buffer?function(){return(x.create=function(){return new S})()}:function(){return new x}};x.create=$(),x.alloc=function(j){return new _.Array(j)},_.Array!==Array&&(x.alloc=_.pool(x.alloc,_.Array.prototype.subarray)),x.prototype._push=function(j,U,Z){return this.tail=this.tail.next=new A(j,U,Z),this.len+=U,this};function P(W,j,U){j[U]=W&255}function D(W,j,U){for(;W>127;)j[U++]=W&127|128,W>>>=7;j[U]=W}function N(W,j){this.len=W,this.next=void 0,this.val=j}N.prototype=Object.create(A.prototype),N.prototype.fn=D,x.prototype.uint32=function(j){return this.len+=(this.tail=this.tail.next=new N((j=j>>>0)<128?1:j<16384?2:j<2097152?3:j<268435456?4:5,j)).len,this},x.prototype.int32=function(j){return j<0?this._push(M,10,v.fromNumber(j)):this.uint32(j)},x.prototype.sint32=function(j){return this.uint32((j<<1^j>>31)>>>0)};function M(W,j,U){for(;W.hi;)j[U++]=W.lo&127|128,W.lo=(W.lo>>>7|W.hi<<25)>>>0,W.hi>>>=7;for(;W.lo>127;)j[U++]=W.lo&127|128,W.lo=W.lo>>>7;j[U++]=W.lo}x.prototype.uint64=function(j){var U=v.from(j);return this._push(M,U.length(),U)},x.prototype.int64=x.prototype.uint64,x.prototype.sint64=function(j){var U=v.from(j).zzEncode();return this._push(M,U.length(),U)},x.prototype.bool=function(j){return this._push(P,1,j?1:0)};function q(W,j,U){j[U]=W&255,j[U+1]=W>>>8&255,j[U+2]=W>>>16&255,j[U+3]=W>>>24}x.prototype.fixed32=function(j){return this._push(q,4,j>>>0)},x.prototype.sfixed32=x.prototype.fixed32,x.prototype.fixed64=function(j){var U=v.from(j);return this._push(q,4,U.lo)._push(q,4,U.hi)},x.prototype.sfixed64=x.prototype.fixed64,x.prototype.float=function(j){return this._push(_.float.writeFloatLE,4,j)},x.prototype.double=function(j){return this._push(_.float.writeDoubleLE,8,j)};var z=_.Array.prototype.set?function(j,U,Z){U.set(j,Z)}:function(j,U,Z){for(var X=0;X<j.length;++X)U[Z+X]=j[X]};return x.prototype.bytes=function(j){var U=j.length>>>0;if(!U)return this._push(P,1,0);if(_.isString(j)){var Z=x.alloc(U=T.length(j));T.decode(j,Z,0),j=Z}return this.uint32(U)._push(z,U,j)},x.prototype.string=function(j){var U=O.length(j);return U?this.uint32(U)._push(O.write,U,j):this._push(P,1,0)},x.prototype.fork=function(){return this.states=new C(this),this.head=this.tail=new A(k,0,0),this.len=0,this},x.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},x.prototype.ldelim=function(){var j=this.head,U=this.tail,Z=this.len;return this.reset().uint32(Z),Z&&(this.tail.next=j.next,this.tail=U,this.len+=Z),this},x.prototype.finish=function(){for(var j=this.head.next,U=this.constructor.alloc(this.len),Z=0;j;)j.fn(j.val,U,Z),Z+=j.len,j=j.next;return U},x._configure=function(W){S=W,x.create=$(),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 x=0;x<A.length;)k[C++]=A[x++]}},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,N){return RangeError("index out of range: "+D.pos+" + "+(N||1)+" > "+D.len)}function A(D){this.buf=D,this.pos=0,this.len=D.length}var k=typeof Uint8Array<"u"?function(N){if(N instanceof Uint8Array||Array.isArray(N))return new A(N);throw Error("illegal buffer")}:function(N){if(Array.isArray(N))return new A(N);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 N=4294967295;return function(){if(N=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(N=(N|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(N=(N|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(N=(N|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(N=(N|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return N;if((this.pos+=5)>this.len)throw this.pos=this.len,O(this,10);return N}}(),A.prototype.int32=function(){return this.uint32()|0},A.prototype.sint32=function(){var N=this.uint32();return N>>>1^-(N&1)|0};function x(){var D=new v(0,0),N=0;if(this.len-this.pos>4){for(;N<4;++N)if(D.lo=(D.lo|(this.buf[this.pos]&127)<<N*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;N=0}else{for(;N<3;++N){if(this.pos>=this.len)throw O(this);if(D.lo=(D.lo|(this.buf[this.pos]&127)<<N*7)>>>0,this.buf[this.pos++]<128)return D}return D.lo=(D.lo|(this.buf[this.pos++]&127)<<N*7)>>>0,D}if(this.len-this.pos>4){for(;N<5;++N)if(D.hi=(D.hi|(this.buf[this.pos]&127)<<N*7+3)>>>0,this.buf[this.pos++]<128)return D}else for(;N<5;++N){if(this.pos>=this.len)throw O(this);if(D.hi=(D.hi|(this.buf[this.pos]&127)<<N*7+3)>>>0,this.buf[this.pos++]<128)return D}throw Error("invalid varint encoding")}A.prototype.bool=function(){return this.uint32()!==0};function $(D,N){return(D[N-4]|D[N-3]<<8|D[N-2]<<16|D[N-1]<<24)>>>0}A.prototype.fixed32=function(){if(this.pos+4>this.len)throw O(this,4);return $(this.buf,this.pos+=4)},A.prototype.sfixed32=function(){if(this.pos+4>this.len)throw O(this,4);return $(this.buf,this.pos+=4)|0};function P(){if(this.pos+8>this.len)throw O(this,8);return new v($(this.buf,this.pos+=4),$(this.buf,this.pos+=4))}return A.prototype.float=function(){if(this.pos+4>this.len)throw O(this,4);var N=_.float.readFloatLE(this.buf,this.pos);return this.pos+=4,N},A.prototype.double=function(){if(this.pos+8>this.len)throw O(this,4);var N=_.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,N},A.prototype.bytes=function(){var N=this.uint32(),M=this.pos,q=this.pos+N;if(q>this.len)throw O(this,N);if(this.pos+=N,Array.isArray(this.buf))return this.buf.slice(M,q);if(M===q){var z=_.Buffer;return z?z.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,M,q)},A.prototype.string=function(){var N=this.bytes();return T.read(N,0,N.length)},A.prototype.skip=function(N){if(typeof N=="number"){if(this.pos+N>this.len)throw O(this,N);this.pos+=N}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 N=_.Long?"toLong":"toNumber";_.merge(A.prototype,{int64:function(){return x.call(this)[N](!1)},uint64:function(){return x.call(this)[N](!0)},sint64:function(){return x.call(this).zzDecode()[N](!1)},fixed64:function(){return P.call(this)[N](!0)},sfixed64:function(){return P.call(this)[N](!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 x=this;if(!C)return _.asPromise(v,x,T,O,A,k);if(!x.rpcImpl){setTimeout(function(){C(Error("already ended"))},0);return}try{return x.rpcImpl(T,O[x.requestDelimited?"encodeDelimited":"encode"](k).finish(),function(P,D){if(P)return x.emit("error",P,T),C(P);if(D===null){x.end(!0);return}if(!(D instanceof A))try{D=A[x.responseDelimited?"decodeDelimited":"decode"](D)}catch(N){return x.emit("error",N,T),C(N)}return x.emit("data",D,T),C(null,D)})}catch($){x.emit("error",$,T),setTimeout(function(){C($)},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 x=Object.keys(k),$=new Array(x.length+1),P=new Array(x.length),D=0;D<x.length;)$[D]=x[D],P[D]=k[x[D++]];return $[D]=C,Function.apply(null,$).apply(null,P)}return Function(C)()}for(var N=new Array(arguments.length-1),M=0;M<N.length;)N[M]=arguments[++M];if(M=0,k=k.replace(/%([%dfijs])/g,function(z,W){var j=N[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!==N.length)throw Error("parameter count mismatch");return T.push(k),O}function A(k){return"function "+(k||v||"")+"("+(S&&S.join(",")||"")+`){
10
+ `+T.join(`
11
+ `)+`
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 x&&typeof XMLHttpRequest<"u"?T.xhr(O,A,k):x?k(x):k(null,A.binary?$:$.toString("utf8"))}):T.xhr(O,A,k):_(T,this,O,A)}return T.xhr=function(A,k,C){var x=new XMLHttpRequest;x.onreadystatechange=function(){if(x.readyState===4){if(x.status!==0&&x.status!==200)return C(Error("status "+x.status));if(k.binary){var P=x.response;if(!P){P=[];for(var D=0;D<x.responseText.length;++D)P.push(x.responseText.charCodeAt(D)&255)}return C(null,typeof Uint8Array<"u"?new Uint8Array(P):P)}return C(null,x.responseText)}},k.binary&&("overrideMimeType"in x&&x.overrideMimeType("text/plain; charset=x-user-defined"),x.responseType="arraybuffer"),x.open("GET",A),x.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),x="";C&&(x=k.shift()+"/");for(var $=0;$<k.length;)k[$]===".."?$>0&&k[$-1]!==".."?k.splice(--$,2):C?k.splice($,1):++$:k[$]==="."?k.splice($,1):++$;return x+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,x={};for(k|=0;C<A.length;)x[T[C+k]]=A[C++];return x}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,$.type,$.rule,$.extend,$.options,$.comment)};function k(C,x,$,P,D,N,M){if(T.isObject(P)?(M=D,N=P,P=D=void 0):T.isObject(D)&&(M=N,N=D,D=void 0),_.call(this,C,N),!T.isInteger(x)||x<0)throw TypeError("id must be a non-negative integer");if(!T.isString($))throw TypeError("type must be a string");if(P!==void 0&&!A.test(P=P.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(D!==void 0&&!T.isString(D))throw TypeError("extend must be a string");P==="proto3_optional"&&(P="optional"),this.rule=P&&P!=="optional"?P:void 0,this.type=$,this.id=x,this.extend=D||void 0,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=T.Long?v.long[$]!==void 0:!1,this.bytes=$==="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,$,P){return x==="packed"&&(this._packed=null),_.prototype.setOption.call(this,x,$,P)},k.prototype.toJSON=function(x){var $=x?!!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",$?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 x;T.base64.test(this.typeDefault)?T.base64.decode(this.typeDefault,x=T.newBuffer(T.base64.length(this.typeDefault)),0):T.utf8.write(this.typeDefault,x=T.newBuffer(T.utf8.length(this.typeDefault)),0),this.typeDefault=x}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,$,P,D){return typeof $=="function"?$=T.decorateType($).name:$&&typeof $=="object"&&($=T.decorateEnum($).name),function(M,q){T.decorateType(M.constructor).add(new k(q,x,$,P,{default:D}))}},k._configure=function(x){O=x},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,x){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=x}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,x=0;x<this.oneof.length;++x){var $=k.get(this.oneof[x]);$&&!$.partOf&&($.partOf=C,C.fieldsArray.push($))}O(this)},T.prototype.onRemove=function(k){for(var C=0,x;C<this.fieldsArray.length;++C)(x=this.fieldsArray[C]).parent&&x.parent.remove(x);_.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($,P){v.decorateType($.constructor).add(new T(P,k)),Object.defineProperty($,P,{get:v.oneOfGetter(k),set:v.oneOfSetter(k)})}},oneof}var namespace,hasRequiredNamespace;function requireNamespace(){if(hasRequiredNamespace)return namespace;hasRequiredNamespace=1,namespace=x;var _=requireObject();((x.prototype=Object.create(_.prototype)).constructor=x).className="Namespace";var S=requireField(),v=requireUtil(),T=requireOneof(),O,A,k;x.fromJSON=function(D,N){return new x(D,N.options).addJSON(N.nested)};function C(P,D){if(P&&P.length){for(var N={},M=0;M<P.length;++M)N[P[M].name]=P[M].toJSON(D);return N}}x.arrayToJSON=C,x.isReservedId=function(D,N){if(D){for(var M=0;M<D.length;++M)if(typeof D[M]!="string"&&D[M][0]<=N&&D[M][1]>N)return!0}return!1},x.isReservedName=function(D,N){if(D){for(var M=0;M<D.length;++M)if(D[M]===N)return!0}return!1};function x(P,D){_.call(this,P,D),this.nested=void 0,this._nestedArray=null}function $(P){return P._nestedArray=null,P}return Object.defineProperty(x.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=v.toArray(this.nested))}}),x.prototype.toJSON=function(D){return v.toObject(["options",this.options,"nested",C(this.nestedArray,D)])},x.prototype.addJSON=function(D){var N=this;if(D)for(var M=Object.keys(D),q=0,z;q<M.length;++q)z=D[M[q]],N.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:x.fromJSON)(M[q],z));return this},x.prototype.get=function(D){return this.nested&&this.nested[D]||null},x.prototype.getEnum=function(D){if(this.nested&&this.nested[D]instanceof k)return this.nested[D].values;throw Error("no such enum: "+D)},x.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 x))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var N=this.get(D.name);if(N)if(N instanceof x&&D instanceof x&&!(N instanceof O||N instanceof A)){for(var M=N.nestedArray,q=0;q<M.length;++q)D.add(M[q]);this.remove(N),this.nested||(this.nested={}),D.setOptions(N.options,!0)}else throw Error("duplicate name '"+D.name+"' in "+this)}return this.nested[D.name]=D,D.onAdd(this),$(this)},x.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),$(this)},x.prototype.define=function(D,N){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 q=D.shift();if(M.nested&&M.nested[q]){if(M=M.nested[q],!(M instanceof x))throw Error("path conflicts with non-namespace objects")}else M.add(M=new x(q))}return N&&M.addJSON(N),M},x.prototype.resolveAll=function(){for(var D=this.nestedArray,N=0;N<D.length;)D[N]instanceof x?D[N++].resolveAll():D[N++].resolve();return this.resolve()},x.prototype.lookup=function(D,N,M){if(typeof N=="boolean"?(M=N,N=void 0):N&&!Array.isArray(N)&&(N=[N]),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),N);var q=this.get(D[0]);if(q){if(D.length===1){if(!N||N.indexOf(q.constructor)>-1)return q}else if(q instanceof x&&(q=q.lookup(D.slice(1),N,!0)))return q}else for(var z=0;z<this.nestedArray.length;++z)if(this._nestedArray[z]instanceof x&&(q=this._nestedArray[z].lookup(D,N,!0)))return q;return this.parent===null||M?null:this.parent.lookup(D,N)},x.prototype.lookupType=function(D){var N=this.lookup(D,[O]);if(!N)throw Error("no such type: "+D);return N},x.prototype.lookupEnum=function(D){var N=this.lookup(D,[k]);if(!N)throw Error("no such Enum '"+D+"' in "+this);return N},x.prototype.lookupTypeOrEnum=function(D){var N=this.lookup(D,[O,k]);if(!N)throw Error("no such Type or Enum '"+D+"' in "+this);return N},x.prototype.lookupService=function(D){var N=this.lookup(D,[A]);if(!N)throw Error("no such Service '"+D+"' in "+this);return N},x._configure=function(P,D,N){O=P,A=D,k=N},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($,P){v.decorateType($.constructor).add(new T(P,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,$,P,D){if(S.isObject(C)?($=C,C=x=void 0):S.isObject(x)&&($=x,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,$),this.type=O||"rpc",this.requestType=A,this.requestStream=C?!0:void 0,this.responseType=k,this.responseStream=x?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=P,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,x){var $=new O(C,x.options);if(x.methods)for(var P=Object.keys(x.methods),D=0;D<P.length;++D)$.add(S.fromJSON(P[D],x.methods[P[D]]));return x.nested&&$.addJSON(x.nested),$.comment=x.comment,$},O.prototype.toJSON=function(C){var x=_.prototype.toJSON.call(this,C),$=C?!!C.keepComments:!1;return v.toObject(["options",x&&x.options||void 0,"methods",_.arrayToJSON(this.methodsArray,C)||{},"nested",x&&x.nested||void 0,"comment",$?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,x=0;x<C.length;++x)C[x].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 P=new T.Service(C,x,$),D=0,N;D<this.methodsArray.length;++D){var M=v.lcFirst((N=this._methodsArray[D]).resolve().name).replace(/[^$\w_]/g,"");P[M]=v.codegen(["r","c"],v.isReserved(M)?M+"_":M)("return this.rpcCall(m,q,s,r,c)")({m:N,q:N.resolvedRequestType.ctor,s:N.resolvedResponseType.ctor})}return P},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(N){return N.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 x=A._fieldsArray[C].resolve(),$=x.resolvedType instanceof _?"int32":x.type,P="m"+v.safeProp(x.name);k("case %i: {",x.id),x.map?(k("if(%s===util.emptyObject)",P)("%s={}",P)("var c2 = r.uint32()+r.pos"),S.defaults[x.keyType]!==void 0?k("k=%j",S.defaults[x.keyType]):k("k=null"),S.defaults[$]!==void 0?k("value=%j",S.defaults[$]):k("value=null"),k("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",x.keyType)("case 2:"),S.basic[$]===void 0?k("value=types[%i].decode(r,r.uint32())",C):k("value=r.%s()",$),k("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),S.long[x.keyType]!==void 0?k('%s[typeof k==="object"?util.longToHash(k):k]=value',P):k("%s[k]=value",P)):x.repeated?(k("if(!(%s&&%s.length))",P,P)("%s=[]",P),S.packed[$]!==void 0&&k("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",P,$)("}else"),S.basic[$]===void 0?k(x.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",P,C):k("%s.push(r.%s())",P,$)):S.basic[$]===void 0?k(x.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",P,C):k("%s=r.%s()",P,$),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){",$)("default:")("return%j",v(C,"enum value"));for(var P=Object.keys(C.resolvedType.values),D=0;D<P.length;++D)k("case %i:",C.resolvedType.values[P[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))",$)("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)))",$,$,$,$)("return%j",v(C,"integer|Long"));break;case"float":case"double":k('if(typeof %s!=="number")',$)("return%j",v(C,"number"));break;case"bool":k('if(typeof %s!=="boolean")',$)("return%j",v(C,"boolean"));break;case"string":k("if(!util.isString(%s))",$)("return%j",v(C,"string"));break;case"bytes":k('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',$,$,$)("return%j",v(C,"buffer"));break}return k}function O(k,C,x){switch(C.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":k("if(!util.key32Re.test(%s))",x)("return%j",v(C,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":k("if(!util.key64Re.test(%s))",x)("return%j",v(C,"integer|Long key"));break;case"bool":k("if(!util.key2Re.test(%s))",x)("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"),x=k.oneofsArray,$={};x.length&&C("var p={}");for(var P=0;P<k.fieldsArray.length;++P){var D=k._fieldsArray[P].resolve(),N="m"+S.safeProp(D.name);if(D.optional&&C("if(%s!=null&&m.hasOwnProperty(%j)){",N,D.name),D.map)C("if(!util.isObject(%s))",N)("return%j",v(D,"object"))("var k=Object.keys(%s)",N)("for(var i=0;i<k.length;++i){"),O(C,D,"k[i]"),T(C,D,P,N+"[k[i]]")("}");else if(D.repeated)C("if(!Array.isArray(%s))",N)("return%j",v(D,"array"))("for(var i=0;i<%s.length;++i){",N),T(C,D,P,N+"[i]")("}");else{if(D.partOf){var M=S.safeProp(D.partOf.name);$[D.partOf.name]===1&&C("if(p%s===1)",M)("return%j",D.partOf.name+": multiple values"),$[D.partOf.name]=1,C("p%s=1",M)}T(C,D,P,N)}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 P=!1;if(C.resolvedType)if(C.resolvedType instanceof v){k("switch(d%s){",$);for(var D=C.resolvedType.values,N=Object.keys(D),M=0;M<N.length;++M)D[N[M]]===C.typeDefault&&!P&&(k("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',$,$,$),C.repeated||k("break"),P=!0),k("case%j:",N[M])("case %i:",D[N[M]])("m%s=%j",$,D[N[M]])("break");k("}")}else k('if(typeof d%s!=="object")',$)("throw TypeError(%j)",C.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",$,x,$);else{var q=!1;switch(C.type){case"double":case"float":k("m%s=Number(d%s)",$,$);break;case"uint32":case"fixed32":k("m%s=d%s>>>0",$,$);break;case"int32":case"sint32":case"sfixed32":k("m%s=d%s|0",$,$);break;case"uint64":q=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":k("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",$,$,q)('else if(typeof d%s==="string")',$)("m%s=parseInt(d%s,10)",$,$)('else if(typeof d%s==="number")',$)("m%s=d%s",$,$)('else if(typeof d%s==="object")',$)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",$,$,$,q?"true":"");break;case"bytes":k('if(typeof d%s==="string")',$)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",$,$,$)("else if(d%s.length >= 0)",$)("m%s=d%s",$,$);break;case"string":k("m%s=String(d%s)",$,$);break;case"bool":k("m%s=Boolean(d%s)",$,$);break}}return k}S.fromObject=function(C){var x=C.fieldsArray,$=T.codegen(["d"],C.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!x.length)return $("return new this.ctor");$("var m=new this.ctor");for(var P=0;P<x.length;++P){var D=x[P].resolve(),N=T.safeProp(D.name);D.map?($("if(d%s){",N)('if(typeof d%s!=="object")',N)("throw TypeError(%j)",D.fullName+": object expected")("m%s={}",N)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",N),O($,D,P,N+"[ks[i]]")("}")("}")):D.repeated?($("if(d%s){",N)("if(!Array.isArray(d%s))",N)("throw TypeError(%j)",D.fullName+": array expected")("m%s=[]",N)("for(var i=0;i<d%s.length;++i){",N),O($,D,P,N+"[i]")("}")("}")):(D.resolvedType instanceof v||$("if(d%s!=null){",N),O($,D,P,N),D.resolvedType instanceof v||$("}"))}return $("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,$,$):k("d%s=types[%i].toObject(m%s,o)",$,x,$);else{var P=!1;switch(C.type){case"double":case"float":k("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",$,$,$,$);break;case"uint64":P=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":k('if(typeof m%s==="number")',$)("d%s=o.longs===String?String(m%s):m%s",$,$,$)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",$,$,$,$,P?"true":"",$);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",$,$,$,$,$);break;default:k("d%s=m%s",$,$);break}}return k}S.toObject=function(C){var x=C.fieldsArray.slice().sort(T.compareFieldsById);if(!x.length)return T.codegen()("return {}");for(var $=T.codegen(["m","o"],C.name+"$toObject")("if(!o)")("o={}")("var d={}"),P=[],D=[],N=[],M=0;M<x.length;++M)x[M].partOf||(x[M].resolve().repeated?P:x[M].map?D:N).push(x[M]);if(P.length){for($("if(o.arrays||o.defaults){"),M=0;M<P.length;++M)$("d%s=[]",T.safeProp(P[M].name));$("}")}if(D.length){for($("if(o.objects||o.defaults){"),M=0;M<D.length;++M)$("d%s={}",T.safeProp(D[M].name));$("}")}if(N.length){for($("if(o.defaults){"),M=0;M<N.length;++M){var q=N[M],z=T.safeProp(q.name);if(q.resolvedType instanceof v)$("d%s=o.enums===String?%j:%j",z,q.resolvedType.valuesById[q.typeDefault],q.typeDefault);else if(q.long)$("if(util.Long){")("var n=new util.Long(%i,%i,%j)",q.typeDefault.low,q.typeDefault.high,q.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,q.typeDefault.toString(),q.typeDefault.toNumber());else if(q.bytes){var W="["+Array.prototype.slice.call(q.typeDefault).join(",")+"]";$("if(o.bytes===String)d%s=%j",z,String.fromCharCode.apply(String,q.typeDefault))("else{")("d%s=%s",z,W)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",z,z)("}")}else $("d%s=%j",z,q.typeDefault)}$("}")}var j=!1;for(M=0;M<x.length;++M){var q=x[M],U=C._fieldsArray.indexOf(q),z=T.safeProp(q.name);q.map?(j||(j=!0,$("var ks2")),$("if(m%s&&(ks2=Object.keys(m%s)).length){",z,z)("d%s={}",z)("for(var j=0;j<ks2.length;++j){"),A($,q,U,z+"[ks2[j]]")("}")):q.repeated?($("if(m%s&&m%s.length){",z,z)("d%s=[]",z)("for(var j=0;j<m%s.length;++j){",z),A($,q,U,z+"[j]")("}")):($("if(m%s!=null&&m.hasOwnProperty(%j)){",z,q.name),A($,q,U,z),q.partOf&&$("if(o.oneofs)")("d%s=%j",T.safeProp(q.partOf.name),q.name)),$("}")}return $("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 x=this.lookup(C);x&&(T=x.decode(T.value))}if(!(T instanceof this.ctor)&&T instanceof v){var $=T.$type.toObject(T,O),P=T.$type.fullName[0]==="."?T.$type.fullName.slice(1):T.$type.fullName;return k===""&&(k=A),C=k+P,$["@type"]=C,$}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(),x=requireWriter(),$=requireUtil(),P=requireEncoder(),D=requireDecoder(),N=requireVerifier(),M=requireConverter(),q=requireWrappers();function z(j,U){_.call(this,j,U),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),U=0;U<j.length;++U){var Z=this.fields[j[U]],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=$.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=$.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=z.generateConstructor(this)())},set:function(j){var U=j.prototype;U instanceof k||((j.prototype=new k).constructor=j,$.merge(j.prototype,U)),j.$type=j.prototype.$type=this,$.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:$.oneOfGetter(this._oneofsArray[Z].oneof),set:$.oneOfSetter(this._oneofsArray[Z].oneof)};Z&&Object.defineProperties(j.prototype,X)}}}),z.generateConstructor=function(U){for(var Z=$.codegen(["p"],U.name),X=0,Q;X<U.fieldsArray.length;++X)(Q=U._fieldsArray[X]).map?Z("this%s={}",$.safeProp(Q.name)):Q.repeated&&Z("this%s=[]",$.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(U,Z){var X=new z(U,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(U){var Z=_.prototype.toJSON.call(this,U),X=U?!!U.keepComments:!1;return $.toObject(["options",Z&&Z.options||void 0,"oneofs",_.arrayToJSON(this.oneofsArray,U),"fields",_.arrayToJSON(this.fieldsArray.filter(function(Q){return!Q.declaringField}),U)||{},"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 U=this.fieldsArray,Z=0;Z<U.length;)U[Z++].resolve();var X=this.oneofsArray;for(Z=0;Z<X.length;)X[Z++].resolve();return _.prototype.resolveAll.call(this)},z.prototype.get=function(U){return this.fields[U]||this.oneofs&&this.oneofs[U]||this.nested&&this.nested[U]||null},z.prototype.add=function(U){if(this.get(U.name))throw Error("duplicate name '"+U.name+"' in "+this);if(U instanceof T&&U.extend===void 0){if(this._fieldsById?this._fieldsById[U.id]:this.fieldsById[U.id])throw Error("duplicate id "+U.id+" in "+this);if(this.isReservedId(U.id))throw Error("id "+U.id+" is reserved in "+this);if(this.isReservedName(U.name))throw Error("name '"+U.name+"' is reserved in "+this);return U.parent&&U.parent.remove(U),this.fields[U.name]=U,U.message=this,U.onAdd(this),W(this)}return U instanceof v?(this.oneofs||(this.oneofs={}),this.oneofs[U.name]=U,U.onAdd(this),W(this)):_.prototype.add.call(this,U)},z.prototype.remove=function(U){if(U instanceof T&&U.extend===void 0){if(!this.fields||this.fields[U.name]!==U)throw Error(U+" is not a member of "+this);return delete this.fields[U.name],U.parent=null,U.onRemove(this),W(this)}if(U instanceof v){if(!this.oneofs||this.oneofs[U.name]!==U)throw Error(U+" is not a member of "+this);return delete this.oneofs[U.name],U.parent=null,U.onRemove(this),W(this)}return _.prototype.remove.call(this,U)},z.prototype.isReservedId=function(U){return _.isReservedId(this.reserved,U)},z.prototype.isReservedName=function(U){return _.isReservedName(this.reserved,U)},z.prototype.create=function(U){return new this.ctor(U)},z.prototype.setup=function(){for(var U=this.fullName,Z=[],X=0;X<this.fieldsArray.length;++X)Z.push(this._fieldsArray[X].resolve().resolvedType);this.encode=P(this)({Writer:x,types:Z,util:$}),this.decode=D(this)({Reader:C,types:Z,util:$}),this.verify=N(this)({types:Z,util:$}),this.fromObject=M.fromObject(this)({types:Z,util:$}),this.toObject=M.toObject(this)({types:Z,util:$});var Q=q[U];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(U,Z){return this.setup().encode(U,Z)},z.prototype.encodeDelimited=function(U,Z){return this.encode(U,Z&&Z.len?Z.fork():Z).ldelim()},z.prototype.decode=function(U,Z){return this.setup().decode(U,Z)},z.prototype.decodeDelimited=function(U){return U instanceof C||(U=C.create(U)),this.decode(U,U.uint32())},z.prototype.verify=function(U){return this.setup().verify(U)},z.prototype.fromObject=function(U){return this.setup().fromObject(U)},z.prototype.toObject=function(U,Z){return this.setup().toObject(U,Z)},z.d=function(U){return function(X){$.decorateType(X,U)}},type}var root,hasRequiredRoot;function requireRoot(){if(hasRequiredRoot)return root;hasRequiredRoot=1,root=x;var _=requireNamespace();((x.prototype=Object.create(_.prototype)).constructor=x).className="Root";var S=requireField(),v=require_enum(),T=requireOneof(),O=requireUtil(),A,k,C;function x(N){_.call(this,"",N),this.deferred=[],this.files=[]}x.fromJSON=function(M,q){return q||(q=new x),M.options&&q.setOptions(M.options),q.addJSON(M.nested)},x.prototype.resolvePath=O.path.resolve,x.prototype.fetch=O.fetch;function $(){}x.prototype.load=function N(M,q,z){typeof q=="function"&&(z=q,q=void 0);var W=this;if(!z)return O.asPromise(N,W,M,q);var j=z===$;function U(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,q),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){U(ue)}!j&&!ee&&U(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||U(fe);return}X(ae,ie)}else++ee,W.fetch(ae,function(fe,Oe){if(--ee,!!z){if(fe){se?ee||U(null,W):U(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||U(null,W)},x.prototype.loadSync=function(M,q){if(!O.isNode)throw Error("not supported");return this.load(M,q,$)},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 P=/^[A-Z]/;function D(N,M){var q=M.parent.lookup(M.extend);if(q){var z=new S(M.fullName,M.id,M.type,M.rule,void 0,M.options);return q.get(z.name)||(z.declaringField=M,M.extensionField=z,q.add(z)),!0}return!1}return x.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)P.test(M.name)&&(M.parent[M.name]=M.values);else if(!(M instanceof T)){if(M instanceof A)for(var q=0;q<this.deferred.length;)D(this,this.deferred[q])?this.deferred.splice(q,1):++q;for(var z=0;z<M.nestedArray.length;++z)this._handleAdd(M._nestedArray[z]);P.test(M.name)&&(M.parent[M.name]=M)}},x.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 q=this.deferred.indexOf(M);q>-1&&this.deferred.splice(q,1)}}else if(M instanceof v)P.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]);P.test(M.name)&&delete M.parent[M.name]}},x._configure=function(N,M,q){A=N,k=M,C=q},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($){if($){for(var P=Object.keys($),D=new Array(P.length),N=0;N<P.length;)D[N]=$[P[N++]];return D}return[]},_.toObject=function($){for(var P={},D=0;D<$.length;){var N=$[D++],M=$[D++];M!==void 0&&(P[N]=M)}return P};var O=/\\/g,A=/"/g;_.isReserved=function($){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($)},_.safeProp=function($){return!/^[$\w_]+$/.test($)||_.isReserved($)?'["'+$.replace(O,"\\\\").replace(A,'\\"')+'"]':"."+$},_.ucFirst=function($){return $.charAt(0).toUpperCase()+$.substring(1)};var k=/_([a-z])/g;_.camelCase=function($){return $.substring(0,1)+$.substring(1).replace(k,function(P,D){return D.toUpperCase()})},_.compareFieldsById=function($,P){return $.id-P.id},_.decorateType=function($,P){if($.$type)return P&&$.$type.name!==P&&(_.decorateRoot.remove($.$type),$.$type.name=P,_.decorateRoot.add($.$type)),$.$type;v||(v=requireType());var D=new v(P||$.name);return _.decorateRoot.add(D),D.ctor=$,Object.defineProperty($,"$type",{value:D,enumerable:!1}),Object.defineProperty($.prototype,"$type",{value:D,enumerable:!1}),D};var C=0;return _.decorateEnum=function($){if($.$type)return $.$type;T||(T=require_enum());var P=new T("Enum"+C++,$);return _.decorateRoot.add(P),Object.defineProperty($,"$type",{value:P,enumerable:!1}),P},_.setProperty=function($,P,D){function N(M,q,z){var W=q.shift();if(W==="__proto__"||W==="prototype")return M;if(q.length>0)M[W]=N(M[W]||{},q,z);else{var j=M[W];j&&(z=[].concat(j).concat(z)),M[W]=z}return M}if(typeof $!="object")throw TypeError("dst must be an object");if(!P)throw TypeError("path must be specified");return P=P.split("."),N($,P,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 x=C.find(function(D){return Object.prototype.hasOwnProperty.call(D,O)});if(x){var $=x[O];_.setProperty($,k,A)}else x={},x[O]=_.setProperty({},k,A),C.push(x)}else{var P={};P[O]=A,C.push(P)}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=x||{},this.valuesOptions=$,this.reserved=void 0,A)for(var P=Object.keys(A),D=0;D<P.length;++D)typeof A[P[D]]=="number"&&(this.valuesById[this.values[P[D]]=A[P[D]]]=P[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,x){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 x&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[A]=x||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,x){return k.resolvedType.group?A("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",C,x,(k.id<<3|3)>>>0,(k.id<<3|4)>>>0):A("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",C,x,(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<$.length;++C){var P=$[C].resolve(),D=A._fieldsArray.indexOf(P),N=P.resolvedType instanceof _?"int32":P.type,M=S.basic[N];x="m"+v.safeProp(P.name),P.map?(k("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",x,P.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",x)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(P.id<<3|2)>>>0,8|S.mapKey[P.keyType],P.keyType),M===void 0?k("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",D,x):k(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|M,N,x),k("}")("}")):P.repeated?(k("if(%s!=null&&%s.length){",x,x),P.packed&&S.packed[N]!==void 0?k("w.uint32(%i).fork()",(P.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",x)("w.%s(%s[i])",N,x)("w.ldelim()"):(k("for(var i=0;i<%s.length;++i)",x),M===void 0?T(k,P,D,x+"[i]"):k("w.uint32(%i).%s(%s[i])",(P.id<<3|M)>>>0,N,x)),k("}")):(P.optional&&k("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",x,P.name),M===void 0?T(k,P,D,x):k("w.uint32(%i).%s(%s)",(P.id<<3|M)>>>0,N,x))}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=P;var _=/[\s{}=;:[\],'"()<>]/g,S=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,v=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,T=/^ *[*/]+ */,O=/^\s*\*?\/*/,A=/\n/g,k=/\s/,C=/\\(.?)/g,x={0:"\0",r:"\r",n:`
13
+ `,t:" "};function $(D){return D.replace(C,function(N,M){switch(M){case"\\":case"":return M;default:return x[M]||""}})}P.unescape=$;function P(D,N){D=D.toString();var M=0,q=D.length,z=1,W=0,j={},U=[],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,$(_e[1])}function ee(le){return D.charAt(le)}function ce(le,_e,me){var oe={type:D.charAt(le++),lineEmpty:!1,leading:me},be;N?be=2:be=3;var ye=le-be,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(N?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<q&&ee(_e)!==`
16
+ `;)_e++;return _e}function se(){if(U.length>0)return U.shift();if(Z)return Q();var le,_e,me,oe,be,ye=M===0;do{if(M===q)return null;for(le=!1;k.test(me=ee(M));)if(me===`
17
+ `&&(ye=!0,++z),++M===q)return null;if(ee(M)==="/"){if(++M===q)throw X("comment");if(ee(M)==="/")if(N){if(oe=M,be=!1,pe(M-1)){be=!0;do if(M=ae(M),M===q||(M++,!ye))break;while(pe(M))}else M=Math.min(q,ae(M)+1);be&&(ce(oe,M,ye),ye=!0),z++,le=!0}else{for(be=ee(oe=M+1)==="/";ee(++M)!==`
18
+ `;)if(M===q)return null;++M,be&&(ce(oe,M-1,ye),ye=!0),++z,le=!0}else if((me=ee(M))==="*"){oe=M+1,be=N||ee(oe)==="*";do{if(me===`
19
+ `&&++z,++M===q)throw X("comment");_e=me,me=ee(M)}while(_e!=="*"||me!=="/");++M,be&&(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<q&&!_.test(ee(ve));)++ve;var Ie=D.substring(M,M=ve);return(Ie==='"'||Ie==="'")&&(Z=Ie),Ie}function ie(le){U.push(le)}function fe(){if(!U.length){var le=se();if(le===null)return null;ie(le)}return U[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&&(N||me.type==="*"||me.lineEmpty)&&(_e=me.leading?me.text:null)):(W<le&&fe(),me=j[le],delete j[le],me&&!me.lineEmpty&&(N||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(),x=requireMethod(),$=requireTypes(),P=requireUtil(),D=/^[1-9][0-9]*$/,N=/^-?[1-9][0-9]*$/,M=/^0[x][0-9a-fA-F]+$/,q=/^-?0[x][0-9a-fA-F]+$/,z=/^0[0-7]+$/,W=/^-?0[0-7]+$/,j=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,U=/^[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,be,ye,ve=!1,Ee=ce,Ie=pe.keepCase?function(re){return re}:P.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 $e(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},xe(Y,function(ge){if(ge==="option")Me(Y,ge),ue(";");else throw de(ge)},function(){Ge(Y)})}function $e(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(N.test(re))return parseInt(re,10);if(q.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=be||(be=[]),ie();break;case"public":ie();default:te=oe||(oe=[]);break}re=Ce(),ue(";"),te.push(re)}function Ne(){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 xe(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(!U.test(te=ie()))throw de(te,"type name");var ne=new v(te);xe(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(!U.test(Y))throw de(Y,"name");Y=Ie(Y),ue("=");var K=new T(Y,Ae(ie()),he,te,ne);if(xe(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&&($.packed[he]!==void 0||$.basic[he]===void 0)&&K.setOption("packed",!1,!0)}function We(re,te){var ne=ie();if(!U.test(ne))throw de(ne,"name");var he=P.lcFirst(ne);ne===he&&(ne=P.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,xe(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($.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(!U.test(he))throw de(he,"name");ue("=");var Y=new O(Ie(he),Ae(ie()),te,ne);xe(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(!U.test(te=ie()))throw de(te,"name");var ne=new A(Ie(te));xe(ne,function(Y){Y==="option"?(Me(ne,Y),ue(";")):(fe(Y),Re(ne,"optional"))}),re.add(ne)}function rt(re,te){if(!U.test(te=ie()))throw de(te,"name");var ne=new k(te);xe(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(!U.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},xe(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(!U.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(!U.test(te=ie()))throw de(te,"service name");var ne=new C(te);xe(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(!U.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 Se=new x(Y,he,K,Te,ge,we);Se.comment=ne,xe(Se,function(Ue){if(Ue==="option")Me(Se,Ue),ue(";");else throw de(Ue)}),re.add(Se)}function Xe(re,te){if(!Z.test(te=ie()))throw de(te,"reference");var ne=te;xe(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);Ne();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:be,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 y=19,I=30*60,H=5e3,F=60*1e3,E=10,R=10,G="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 Error(`${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=new Date().getTime();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(x=>{this.setConfig(x,v),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>k(!0),$=>C($))}).catch(x=>{this._starting=!1,this.status=PullStatus.Offline,this.stopCheckConfig(),this.getLogger().error(`${h$1.getDateForLog()}: Pull: could not read push-server config `,x),C(x)})})}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");let v={};return new Promise((T,O)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(RpcMethod.GetUsersLastSeen,{userList:S}).then(A=>{let k=[];for(let x=0;x<S.length;x++)A.hasOwnProperty(S[x])||k.push(S[x]);if(k.length===0)return T(v);const C={userIds:k,sendToQueueSever:!0};this._restClient.callMethod("pull.api.user.getLastSeen",C).then(x=>{let $=x.getData().result;for(let P in $)v[Number(P)]=Number($[P]);return T(v)}).catch(x=>{this.getLogger().error(x),O(x)})}).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?this._session.mid:"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(S){let v,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{let 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=y,`${v}?${h$1.buildQueryString(T)}`}getPublicationPath(){const S=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!S)return"";let 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 Error(`${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=(new Date().getTime()-S.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift?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
+ ========= PULL ERROR ===========
21
+ Error type: broadcastMessages execute error
22
+ Error event: `,O,`
23
+ Message: `,S,`
24
+ ================================
25
+ `)}S.extra&&S.extra.revision_web&&this.checkRevision(h$1.toInteger(S.extra.revision_web))}broadcastMessages(S){S.forEach(v=>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()){let v=this._jsonRpcAdapter?.createPublishRequest(S);return this.connector?.send(JSON.stringify(v)),Promise.resolve(!0)}else{let v={};for(let T=0;T<S.length;T++){const O=S[T];if(typeof O.userList<"u"){const A=O.userList.length;for(let k=0;k<A;k++){const C=Number(O.userList[k]);v[C]=C}}}this._channelManager?.getPublicIds(Object.values(v)).then(T=>{const O=this.connector?.send(this.encodeMessageBatch(S,T));return Promise.resolve(O)})}}encodeMessageBatch(S,v){let 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 Error("messageFields.publicChannels must be an array");A.channelList.forEach($=>{let P,D;if(typeof $=="string"&&$.includes(".")){const N=$.toString().split(".");P=N[0],D=N[1]}else if(typeof $=="object"&&"publicId"in $&&"signature"in $)P=$?.publicId,D=$?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);C.push(Receiver.create({id:this.encodeId(P),signature:this.encodeId(D)}))})}const x=IncomingMessage.create({receivers:C,body:JSON.stringify(k),expiry:A.expiry||0});T.push(x)});const O=RequestBatch.create({requests:[{incomingMessages:{messages:T}}]});return RequestBatch.encode(O).finish()}createMessageReceivers(S,v){let T=[];for(let O=0;O<S.length;O++){let A=S[O];if(!v[A]||!v[A].publicId)throw new Error(`Could not determine public id for user ${A}`);T.push(Receiver.create({id:this.encodeId(v[A].publicId),signature:this.encodeId(v[A].signature)}))}return T}emitUserStatusChange(S,v){this._userStatusCallbacks[S]&&this._userStatusCallbacks[S].forEach(T=>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;let k;k=Math.floor((new Date().getTime()-new Date(A.serverTime).getTime())/1e3),delete A.serverTime;let 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(let 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),F)}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(let T in S)S.hasOwnProperty(T)&&this._config?.hasOwnProperty(T)&&(this._config[T]=S[T]);if(S.publicChannels&&this.setPublicIds(Array.from(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!==y?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(CloseReasons.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[S,y]),this.emit({type:SubscriptionType.Revision,data:{server:S,client:y}}),this.logToConsole(`Pull revision changed from ${y} 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;let 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){let v=[];if(S.length===0){this._session.mid=null;return}for(let T=0;T<S.length;T++){let O=S[T];this.updateSessionFromEvent(O),!(O.mid&&!this.checkDuplicate(O.mid))&&(this.addMessageToStat(O.text),v.push(O.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===G?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){let v=[];try{let T=ResponseBatch.decode(new Uint8Array(S));for(let O=0;O<T.responses.length;O++){let A=T.responses[O];if(A.command!=="outgoingMessages")continue;let k=A.outgoingMessages.messages;for(let C=0;C<k.length;C++){const x=k[C];let $;try{$=JSON.parse(x.body)}catch(D){this.getLogger().error(`${h$1.getDateForLog()}: Pull: Could not parse message body `,D);continue}$.extra||($.extra={}),$.extra.sender={type:x.sender.type},x.sender.id instanceof Uint8Array&&($.extra.sender.id=this.decodeId(x.sender.id));const P={mid:this.decodeId(x.id),text:$};v.push(P)}}}catch(T){this.getLogger().error(`${h$1.getDateForLog()}: Pull: Could not parse message `,T)}return v}extractPlainTextMessages(S){let v=[];const T=S.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/gm);if(T===null){const O=`
26
+ ========= PULL ERROR ===========
27
+ Error type: parseResponse error parsing message
28
+
29
+ Data string: ${S}
30
+ ================================
31
+
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(let T=0;T<S.length;T++){const O=S[T].toString(16);O.length===1&&(v+="0"),v+=O}return v}encodeId(S){if(!S)return new Uint8Array;let v=[];for(let T=0;T<S.length;T+=2)v.push(parseInt(S.substring(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=new Date().getTime()+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=Array.from(this._watchTagsQueue.keys());v.length>0?this._restClient.callMethod("pull.watch.extend",{tags:v}).then(T=>{T.getData().result.forEach(O=>this.clearWatch(O)),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)=>(v[A]&&(Array.isArray(v[A])?v[A].forEach((k,C)=>{O[`get_${A}_${C}`]=k}):O[`get_${A}`]=v[A]),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:parseInt(S.ID),code:S.CODE,version: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: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(){this._pullClientUnSubscribe.forEach(S=>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,i=!1,t=null,s=!1,n=[],u=!1;function m(){window.setTimeout(()=>{if(!i||e===null){m();return}B(),n=[]},p)}function B(){t!==null&&n.forEach(_=>{_.reject(t)}),!(!i||e===null)&&n.forEach(_=>{_.resolve(e)})}async function initializeB24Frame(){return i&&e!==null?Promise.resolve(e):s?(u||(u=!0,m()),new Promise((_,S)=>{n.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=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(()=>{i=!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});
33
+ //# sourceMappingURL=index.min.js.map